query
stringlengths 7
9.55k
| document
stringlengths 10
363k
| metadata
dict | negatives
listlengths 0
101
| negative_scores
listlengths 0
101
| document_score
stringlengths 3
10
| document_rank
stringclasses 102
values |
|---|---|---|---|---|---|---|
:positive / :neutral / :negative
|
def polarity
@polarity ||=
case
when score.zero?
:neutral
when score.positive?
:positive
when score.negative?
:negative
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def positive; end",
"def positive; end",
"def positive?; end",
"def negative?() @positive==false end",
"def label() @positive end",
"def negative?\n !@positive \n end",
"def negative?; end",
"def positive?() @positive==true end",
"def negative_test\r\n @negative = true\r\n end",
"def unlabeled?() @positive.nil? end",
"def natural_bonus\n 0\n end",
"def polarity\n @polarity ||= if strength > 0\n \"positive\"\n elsif strength < 0\n \"negative\"\n else\n \"neutral\"\n end\n end",
"def negative(num)\n num.positive? ? -num : num\nend",
"def negative?\n @negative\n end",
"def negative?\n @negative\n end",
"def negative(num)\n if num.positive?\n -num\n else\n num\n end\nend",
"def include_negative?\n @include_negative\n end",
"def negative_to_positive\n nTwenty = Node.new(-20)\n nSeventeen = Node.new(-17)\n nNineteen = Node.new(-19, nTwenty, nSeventeen)\n one = Node.new(1)\n zero = Node.new(0, nil, one)\n ten = Node.new(10)\n two = Node.new(2, zero, ten)\n \n Node.new(-15, nNineteen, two)\nend",
"def negative?\n !!@negative\n end",
"def is_negative(tal)\n if tal < 0\n return true\n else\n return false\n end\nend",
"def mood\n if self.happiness && self.nausea\n mood = self.happiness - self.nausea\n mood > 0 ? \"happy\" : \"sad\"\n end\nend",
"def negative(num)\n num < 0 ? num : -1 * num\nend",
"def neg?\n sign < 0\n end",
"def negative(num)\r\n num > 0 ? -num : num \r\nend",
"def negative(num)\n num < 0 ? num : -num\nend",
"def cardinal; end",
"def negative?\n return self < 0\n end",
"def method_two(arg)\n case\n when arg > 0 then \"positive\"\n when arg < 0 then \"negative\"\t\n else \t\t\t\t\"zero\"\t\n end\nend",
"def negative(num)\n num <= 0 ? num : -num\nend",
"def negative(num)\n num <= 0 ? num : -num\nend",
"def neutralize(sentence)\n words = sentence.split(' ')\n ok_words = words.select do |word|\n !negative?(word)\n end\n\n ok_words.join(' ')\nend",
"def negative?\n self < 0\n end",
"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 make_numbers_negative(number)\n number.positive? ? -(number) : number\nend",
"def mood\n if self.happiness < self.nausea\n \"sad\"\n else\n \"happy\"\n end\n end",
"def failure_message_when_negated; end",
"def failure_message_when_negated; end",
"def failure_message_when_negated; end",
"def is_positive? tweet\n\t\t\tif tweet == \"Positive\"\n\t\t\t\ttrue\n\t\t\telse\n\t\t\t\tfalse\n\t\t\tend\n\t end",
"def sign\n return -1 if self < 0\n return 1 if self > 0\n return 0\n end",
"def negative(num)\n return num<0\nend",
"def negative(number)\n number > 0 ? -number : number\nend",
"def negative(number)\n number > 0 ? -number : number\nend",
"def nonpositive?\n return self <= 0\n end",
"def negetive?(number) #the arguement number is whats in the bracket and it represents that negetive? accepts number\n puts number < 0 #rememeber you want the booleans true to be written when you have a - number and a number less than 0\nend",
"def negative(num)\n num > 0 ? -num : num # or -num.abs\nend",
"def total_counter(negative_value, neutral_value, positive_value)\n if [positive_value, neutral_value, negative_value].rindex([positive_value, neutral_value, negative_value].max) == 0\n @total_positives +=1\n elsif [positive_value, neutral_value, negative_value].rindex([positive_value, neutral_value, negative_value].max) == 1\n @total_neutrals += 1\n else\n @total_negatives +=1\n end\n end",
"def mood\n if self.nausea > self.happiness\n \"sad\"\n else\n \"happy\"\n end\n end",
"def reverse_polarity\n end",
"def negative(num)\n if num > 0\n p (-num)\n else\n p num\n end\nend",
"def negative(integer)\n integer > 0 ? -integer : integer\nend",
"def negative?\n self <= 0\n end",
"def total_score\n score || 0 #pos - neg\n end",
"def make_negative(num)\r\n num > 0 ? -num : num\r\nend",
"def makeNegative(num)\n num < 0 ? num : -num\nend",
"def negative\n abs.flip_sign\n end",
"def negative(number)\n number <= 0 ? number : number * -1\nend",
"def make_positive(number)\n if number < 0\n -number\n else\n number\n end\nend",
"def negative(int)\n int <= 0 ? int : -int\nend",
"def negative(num)\n\n if num <=0\n num\n else \n num * -1\n end\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 mood \n if self.happiness && self.nausea\n mood = self.happiness - self.nausea\n mood > 0 ? \"happy\" : \"sad\"\n end\n end",
"def negative(input)\n input.abs * -1\nend",
"def negative(num)\n return num if num.negative?\n -num\nend",
"def negative(value = (not_set = true))\n return @negative if not_set\n\n @negative = value\n end",
"def negative(num)\n return -num if num > 0\n num\nend",
"def negation\n \"not\" if negate?\n end",
"def mood\n if self.nausea && self.happiness\n self.nausea > self.happiness ? (return \"sad\") : (return \"happy\")\n end\n end",
"def negative(num)\n - num.abs\nend",
"def negative(num)\n\treturn -num unless num <= 0\n\tnum\nend",
"def negative(num)\n num *= -1 if num > 0\n num\nend",
"def new_apnf_rules_for_negated_implication\n end",
"def mood\n if nausea && happiness\n self.nausea > self.happiness ? \"sad\" : \"happy\" \n end\n end",
"def negative?\n self < 0\n end",
"def negatives \n negatives ||= numbers.select {|num| num < 0}\n end",
"def page_sentiment (positive, negative)\n totalwords = 0\n count = 0.0\n sentimentwords = 0.0\n if(@thewords)\n #This is the main loop, if each word is positive or negative in the document adjust variables accordingly.\n @thewords.each do |word|\n totalwords+= 1\n if positive.map(&:downcase).include? word[0].downcase\n # puts word[0]\n count +=word[1]\n sentimentwords +=word[1]\n elsif negative.map(&:downcase).include? word[0].downcase\n # puts word[0]\n count -=word[1]\n sentimentwords +=word[1]\n end\n end\n end\n ratio = count/sentimentwords\n if (ratio > 0.10)\n count = 1\n elsif (ratio < -0.10)\n count = -1\n else\n count = 0\n end\n return count\n end",
"def isnegative(siffra)\n output = false\n if siffra < 0\n output = true\n end\n\n return output\nend",
"def neutral?(id)\n return @neutral.include?(id)\n end",
"def test_neg_prospectors\n\t\trefute check_args([1, -1])\n\tend",
"def score \n return 'love' if @points == 0 \n return 'fifteen' if @points == 1 \n return 'thirty' if @points == 2 \n return 'forty' if @points == 3\n end",
"def badge\n positive? ? \"+\" : \"-\"\n end",
"def neutral\n @page.find(input_elements[:neutral])\n end",
"def silly_adjective; end",
"def makeNegative(num)\n num > 0 ? num * -1 : num\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 mood\n self.happiness > self.nausea ? \"happy\" : \"sad\"\n end",
"def mood\n \tself.happiness > self.nausea ? \"happy\" : \"sad\" if self.happiness && self.nausea\n end",
"def negative(number)\n return number if number.negative? || number.zero?\n -number\nend",
"def virality\n 0\n end",
"def nonnegative?\n return self >= 0\n end",
"def is_positive?\n return POSITIVE_RESPONSES.include?(self)\n end",
"def score\n return 'love' if @points == 0\n return 'fifteen' if @points == 1\n return 'thirty' if @points == 2\n return 'forty' if @points == 3 \n end",
"def sign(v) \n if(v > 0)\n +1\n elsif(v < 0)\n -1\n else\n 0\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"
] |
[
"0.76109487",
"0.76109487",
"0.75455785",
"0.748136",
"0.7091676",
"0.70389146",
"0.7023802",
"0.6953184",
"0.67904353",
"0.66695666",
"0.64578575",
"0.6450785",
"0.64476395",
"0.644294",
"0.644294",
"0.6316237",
"0.62634635",
"0.6204397",
"0.6199487",
"0.6189255",
"0.6182144",
"0.6177477",
"0.61628366",
"0.615707",
"0.6125213",
"0.61043364",
"0.6068204",
"0.60673046",
"0.6063966",
"0.6063966",
"0.60633916",
"0.6060529",
"0.6055834",
"0.6055834",
"0.6055834",
"0.6055834",
"0.6039568",
"0.6014185",
"0.60053766",
"0.60053766",
"0.60053766",
"0.6003476",
"0.60023475",
"0.5997242",
"0.5972732",
"0.5972732",
"0.5967291",
"0.595348",
"0.59459156",
"0.5931165",
"0.5928495",
"0.59277254",
"0.59221154",
"0.5916312",
"0.59114146",
"0.5894083",
"0.58901644",
"0.58827144",
"0.58789784",
"0.5874866",
"0.5871274",
"0.5849038",
"0.5832798",
"0.58183765",
"0.5818311",
"0.58179",
"0.58113134",
"0.5796637",
"0.57862663",
"0.5786208",
"0.57854843",
"0.57843584",
"0.578387",
"0.5782771",
"0.5781239",
"0.57805306",
"0.57802",
"0.577946",
"0.57753855",
"0.5772828",
"0.57679933",
"0.5760658",
"0.5759418",
"0.57461685",
"0.57314026",
"0.57241726",
"0.57175905",
"0.57085913",
"0.57085913",
"0.57085913",
"0.57085913",
"0.5708475",
"0.5704493",
"0.570354",
"0.57011676",
"0.5697821",
"0.56920254",
"0.5683632",
"0.567215",
"0.56702334"
] |
0.63083667
|
16
|
TODO: Dry it up. This is duplicated elsewhere.
|
def object_for(object_or_id, klass)
case object_or_id
when klass then object_or_id
when Integer
klass.find_by(id: object_or_id)
else
raise ArgumentError,
"must provide a #{ klass } or a valid #{ klass } id"
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def private; end",
"def probers; end",
"def specie; end",
"def specie; end",
"def specie; end",
"def specie; end",
"def schubert; end",
"def from; end",
"def from; end",
"def from; end",
"def from; end",
"def terpene; end",
"def anchored; end",
"def loc; end",
"def loc; end",
"def loc; end",
"def offences_by; end",
"def berlioz; end",
"def formation; end",
"def internal; end",
"def implementation; end",
"def implementation; end",
"def wrapper; end",
"def custom; end",
"def custom; end",
"def escaper=(_); end",
"def refutal()\n end",
"def identify; end",
"def same; end",
"def probers=(_arg0); end",
"def stderrs; end",
"def isolated; end",
"def isolated; end",
"def verdi; end",
"def r; end",
"def r; end",
"def rassoc(p0) end",
"def suivre; end",
"def weber; end",
"def original; end",
"def internship_passed; end",
"def original_result; end",
"def reflector; end",
"def reflector; end",
"def trd; end",
"def parslet; end",
"def parslet; end",
"def parslet; end",
"def parslet; end",
"def missing?; end",
"def used?; end",
"def intensifier; end",
"def missing; end",
"def next() end",
"def next() end",
"def extra; end",
"def pos; end",
"def pos; end",
"def pos; end",
"def pos; end",
"def pos; end",
"def pos; end",
"def spec; end",
"def spec; end",
"def implemented_in; end",
"def specialty; end",
"def returns; end",
"def ibu; end",
"def position; end",
"def position; end",
"def position; end",
"def position; end",
"def position; end",
"def position; end",
"def position; end",
"def position; end",
"def offences_by=(_arg0); end",
"def required_positionals; end",
"def starting_position; end",
"def ignores; end",
"def final; end",
"def called_from; end",
"def called_from; end",
"def expanded; end",
"def internal?; end",
"def escaper; end",
"def sitemaps; end",
"def first; end",
"def first; end",
"def rest_positionals; end",
"def explicit; end",
"def ext=(_arg0); end",
"def ext=(_arg0); end",
"def ext=(_arg0); end",
"def code_point=(_); end",
"def jack_handey; end",
"def pos() end",
"def pos() end",
"def pos() end",
"def pos() end",
"def villian; end"
] |
[
"0.7258023",
"0.6360955",
"0.6296373",
"0.6296373",
"0.6296373",
"0.6296373",
"0.5965617",
"0.5780043",
"0.5780043",
"0.5780043",
"0.5780043",
"0.5772213",
"0.5748733",
"0.5733801",
"0.5733801",
"0.5733801",
"0.5730782",
"0.5696027",
"0.5662914",
"0.560671",
"0.55952805",
"0.55952805",
"0.5592636",
"0.55698144",
"0.55698144",
"0.5556272",
"0.5549142",
"0.55299985",
"0.55287564",
"0.55139655",
"0.55018497",
"0.54827523",
"0.54827523",
"0.54695106",
"0.5466183",
"0.5466183",
"0.5462297",
"0.5451425",
"0.5449444",
"0.54426754",
"0.5442437",
"0.54354113",
"0.5432114",
"0.5432114",
"0.5426229",
"0.5420349",
"0.5420349",
"0.5420349",
"0.5420349",
"0.5416029",
"0.5413363",
"0.54132557",
"0.54123765",
"0.5412053",
"0.5412053",
"0.54042184",
"0.5397813",
"0.5397813",
"0.5397813",
"0.5397813",
"0.5397813",
"0.5397813",
"0.5376829",
"0.5376829",
"0.53721863",
"0.5370283",
"0.53605586",
"0.53577423",
"0.53469515",
"0.53469515",
"0.53469515",
"0.53469515",
"0.53469515",
"0.53469515",
"0.53469515",
"0.53469515",
"0.5344521",
"0.53429705",
"0.5328224",
"0.5326864",
"0.5326601",
"0.5324544",
"0.5324544",
"0.53243816",
"0.5315403",
"0.5313756",
"0.5311775",
"0.5310733",
"0.5310733",
"0.5306099",
"0.53045374",
"0.5299121",
"0.5299121",
"0.5299121",
"0.5288741",
"0.52750057",
"0.5273011",
"0.5273011",
"0.5273011",
"0.5273011",
"0.5267949"
] |
0.0
|
-1
|
Write a method that takes the 3 angles of a triangle as arguments, and returns a symbol :right, :acute, :obtuse, or :invalid depending on whether the triangle is a right, acute, obtuse, or invalid triangle. Input : 3 numbers, angles of the triangle, integers values Output : symbol, type of the triangle or invalid msg (acute, right, obtuse, invalid) Rules: :invalid sum of 3 angles must be == 180 all of angles must be greater than 0 :right one angle is a right angle (90 degrees) :acute all 3 angles are less than 90 degrees :obtuse one angle is greater than 90 degrees Data structure Input numbers integer values converted to array of 3 elements output symbol that represent type of triangle or invalid input Algorithm create array of angles case statement that returns appropriate symbol when certain requirments are met => :invalid if angles sum != 180 or angles include 0 => :right if any angle == 90 => :acute if all angles are less than 90 => :obtuse otherwise
|
def triangle(angle_1, angle_2, angle_3)
angles = [angle_1, angle_2, angle_3]
case
when angles.sum != 180 || angles.include?(0)
:invalid
when angles.any?(90)
:right
when angles.all? { |angle| angle < 90 }
:acute
else
:obtuse
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def triangle(angle1, angle2, angle3)\n angles = [angle1, angle2, angle3]\n return :invalid if angles.sum != 180\n return :invalid if angles.any? {|angle| angle <= 0}\n return :right if angles.any? {|angle| angle == 90}\n return :acute if angles.all? {|angle| angle < 90}\n return :obtuse if angles.any? {|angle| angle > 90}\nend",
"def triangle(angle1, angle2, angle3)\n angles = [angle1, angle2, angle3]\n return :invalid unless is_triangle?(angles)\n\n case\n when angles.any? { |a| a == 90 }\n :right\n when angles.all? { |a| a < 90 }\n :acute\n else\n :obtuse\n end\nend",
"def triangle(angle1, angle2, angle3)\n angles = [angle1, angle2, angle3]\n\n case\n when angles.reduce(:+) != 180, angles.include?(0)\n :invalid\n when angles.include?(90)\n :right\n when angles.all? { |angle| angle < 90 }\n :acute\n else\n :obtuse\n end\nend",
"def triangle(angle1, angle2, angle3)\n angles = [angle1, angle2, angle3]\n \n case \n when angles.reduce(:+) != 180 || angles.include?(0)\n :invalid\n when angles.count(90) == 1\n :right\n when angles.count {|an| an < 90} == 3\n :acute\n when angle1 > 90 || angle2 > 90 || angle3 > 90 \n :obtuse\n end\nend",
"def triangle(angle_1, angle_2, angle_3)\n angles = [angle_1, angle_2, angle_3]\n case\n when angles.inject(:+) != 180 || angles.include?(0)\n :invalid\n when angles.include?(90)\n :right\n when angles.any? { |angle| angle > 90}\n :obtuse\n when angles.all? { |angle| angle < 90 }\n :acute\n end\nend",
"def triangle(a1, a2, a3)\n angles = [a1, a2, a3]\n\n return :invalid if angles.sum != 180 || angles.include?(0)\n return :right if angles.include?(90)\n return :acute if angles.max < 90\n return :obtuse if angles.max > 90\nend",
"def triangle(angle1, angle2, angle3)\n angles = [angle1, angle2, angle3]\n return :invalid unless angles.sum == 180 && angles.all?(&:positive?)\n\n if angles.include?(90)\n :right\n elsif angles.all? { |angle| angle < 90 }\n :acute\n else\n :obtuse\n end\nend",
"def triangle(angle1, angle2, angle3)\n angles = [angle1, angle2, angle3]\n case\n when angles.inject(:+) != 180 then :invalid\n when angles.any? { |angle| angle <= 0 } then :invalid\n when angles.any? { |angle| angle > 90 } then :obtuse\n when angles.any? { |angle| angle == 90 } then :right\n else :acute\n end\nend",
"def triangle(angle_1, angle_2, angle_3)\n angles = [angle_1, angle_2, angle_3]\n return :invalid if angles.include?(0) || angles.sum != 180\n \n if angles.include?(90) then :right\n elsif angles.select {|angle| angle > 90}.size > 0 then :obtuse\n else :acute\n end\n\nend",
"def triangle(angle1, angle2, angle3)\n sides = [angle1, angle2, angle3]\n return :invalid if invalid_triangle? [angle1, angle2, angle3]\n return :acute if acute? sides\n return :obtuse if obtuse? sides\n return :right if right? sides\nend",
"def triangle(first, second, third)\n angles = [first, second, third]\n return :invalid unless angles.sum == 180 && angles.none?(0)\n\n case\n when angles.any?(90) then :right\n when angles.all? { |angle| angle < 90 } then :acute\n when angles.one? { |angle| angle > 90 } then :obtuse\n else :invalid\n end\nend",
"def triangle(angle1, angle2, angle3)\n angles = [angle1, angle2, angle3]\n return :invalid if angles.sum != 180 || angles.min.zero?\n case angles.max\n when 90 then :right\n when 0...90 then :acute\n else :obtuse\n end\nend",
"def triangle(a, b, c)\n angles = [a, b, c]\n case\n when angles.any? { |x| x <= 0 } || angles.sum != 180 then :invalid\n when angles.any? { |x| x == 90 } then :right\n when angles.all? { |x| x < 90 } then :acute\n when angles.any? { |x| x > 90 } then :obtuse\n end\nend",
"def triangle(a, b, c)\n angles = [a, b, c]\n\n # angles.sum = angles.reduce(:+) \n return :invalid if angles.sum != 180 || angles.any?(0)\n return :right if angles.any?(90)\n return :acute if angles.all? { |angle| angle < 90 }\n :obtuse\nend",
"def triangle(a, b, c)\n angles = [a, b, c]\n return :invalid unless angles.sum == 180 && angles.none?(&:zero?) # no 0s and sum to 180\n return :right if angles.any? { |x| x == 90 }\n return :obtuse if angles.any? { |x| x > 90 }\n :acute\nend",
"def triangle(*angles)\n return :invalid if angles.any?(0) || angles.sum != 180\n\n return :right if angles.include?(90)\n return :obtuse if angles.sort.last > 90\n :acute\nend",
"def triangle(angle1, angle2, angle3)\n angles = [angle1, angle2, angle3]\n largest_angle = angles.max\n\n case\n when angles.sum != 180, angles.include?(0)\n :invalid\n when largest_angle > 90\n :obtuse\n when largest_angle == 90\n :right\n else\n :acute\n end\nend",
"def triangle(a, b, c)\n angles = [a, b, c]\n sum = angles.reduce(:+)\n case\n when sum != 180 || angles.any? { |ang| ang <= 0 }\n :invalid\n when angles.any? { |ang| ang == 90 }\n :right\n when angles.any? { |ang| ang > 90 }\n :obtuse\n when angles.all? { |ang| ang < 90 }\n :acute\n end\nend",
"def triangle(*angles)\n return :invalid if angles.reduce(:+) != 180 || angles.include?(0)\n return :right if angles.include?(90)\n return :obtuse if angles.max > 90\n :acute\nend",
"def triangle(a, b, c)\n angles = [a, b, c]\n\n case\n when angles.sum != 180 || angles.min <= 0\n :invalid\n when angles.max == 90\n :right\n when angles.max > 90\n :obtuse\n else\n :acute\n end\nend",
"def tri_angle(ang1, ang2, ang3)\n angles = [ang1, ang2, ang3]\n return :invalid unless valid_angles?(angles)\n return :right if angles.include?(90)\n return :acute if angles.all? { |ang| ang < 90 }\n return :obtuse\nend",
"def triangle(ang1, ang2, ang3)\n ary = [ang1, ang2, ang3].sort\n return :invalid if ary.sum != 180 || ary.include?(0)\n if ary[-1] < 90\n :acute\n elsif ary[-1] == 90\n :right\n else\n :obtuse\n end\nend",
"def triangle(num1, num2, num3)\n if (num1 + num2 + num3) != 180\n return :invalid \n elsif num1 == 0 || num2 == 0 || num3 == 0 \n return :invalid\n elsif num1 > 90 || num2 > 90 || num3 > 90\n return :obtuse \n elsif num1 == 90 || num2 == 90 || num3 == 90\n return :right \n else \n :acute\n end\nend",
"def triangle(side1, side2, side3)\n arr = [side1, side2, side3]\n if arr.sum != 180 || arr.any?(0)\n :invalid\n elsif arr.any?(90)\n :right\n elsif arr.any? { |n| n > 90 }\n :obtuse\n else\n :acute\n end\nend",
"def valid_triangle(deg1, deg2, deg3)\n return :invalid if deg1 + deg2 + deg3 != 180\n return :invalid if deg1 <= 0 || deg2 <= 0 || deg3 <= 0\n :valid\nend",
"def triangle(a, b, c)\n sides = [a, b, c]\n \n return :invalid if sides.include?(0) || sides.max >= sides.min(2).sum\n return :equilateral if sides.max == sides.min\n return :isosceles if sides.tally.value?(2)\n :scalene\nend",
"def is_valid_triangle(angle1, angle2, angle3)\n angles = [angle1, angle2, angle3]\n if angles.reduce(:+) == 180 && angle1 != 0 && angle2 != 0 && angle3 != 0\n true\n else\n false\n end\nend",
"def triangle(len1, len2, len3)\n lengths = [len1, len2, len3].sort\n return :invalid unless valid_triangle?(lengths)\n return :equilateral if lengths.all?(lengths[0])\n return :scalene if lengths.uniq == lengths\n return :isosceles\nend",
"def triangle(a,b,c)\n raise TriangleError unless is_valid_triangle?(a,b,c)\n h = [a]\n h << b unless h.include?(b)\n h << c unless h.include?(c)\n return :equilateral if h.length == 1\n return :isosceles if h.length == 2\n :scalene\nend",
"def triangle(a, b, c)\n return :invalid if [a, b, c].any?(&:zero?) # if any length is 0\n return :invalid unless [a, b, c].sort[0..1].sum > [a, b, c].max # sum of smaller > largest\n return :equilateral if a == b && b == c # if all sides are the same length\n return :isosceles if [a, b, c].uniq.size == 2 # if one length is repeated 2x\n :scalene # all other valid triangles\nend",
"def triangle(a, b, c)\n if numbers_below_possible(a, b, c)\n raise TriangleError, \"One of the sides are 0 or negative (below allowed)\"\n end\n\n if triangle_not_possible(a, b, c)\n raise TriangleError, \"Triangle not possible with values passed\"\n end\n\n if a == b && a == c\n return :equilateral\n end\n\n if a == b || a == c || b == c\n return :isosceles\n end\n\n :scalene\nend",
"def triangle(s1, s2, s3)\n sides = [s1, s2, s3]\n return :invalid if sides.any?(0) || sides.max > sides.reduce(:+) - sides.max\n type_of_triangle(sides)\nend",
"def triangle(side_1, side_2, side_3)\n ordered_array = [side_1, side_2, side_3].sort\n if !ordered_array.all? { |side| side > 0 }\n return :invalid\n end\n if (ordered_array[0] + ordered_array[1]) <= ordered_array[2]\n return :invalid\n end\n if (side_1 == side_2) && (side_2 == side_3)\n :equilateral\n elsif (side_1 == side_2) || (side_1 == side_3) || (side_2 == side_3)\n :isosceles\n else\n :scalene\n end\nend",
"def triangle(a, b, c)\n sides = a, b, c\n case\n when sides.any? { |side| side.zero? }\n :invalid\n when sides.any? { |side| sides.reduce(:+) - side < side }\n :invalid\n when sides.all? { |side| side == sides.first }\n :equilateral\n when sides == sides.uniq\n :scalene\n else\n :isosceles\n end\nend",
"def triangle(side1, side2, side3)\n arr = [side1, side2, side3].sort\n return :invalid if arr[0] + arr[1] <= arr[2]\n return :equilateral if arr[0] == arr[1] && arr[1] == arr[2]\n return :isosceles if arr.uniq.size == 2\n return :scalene if arr.uniq.size == 3\nend",
"def triangle(a, b, c)\n\t\n\tcheckValidity(a,b,c)\n\t\n\tif (equilateral?(a,b,c))\n\t\treturn :equilateral\n\tend\n\tif (isosceles?(a,b,c))\n\t\treturn :isosceles\n\tend\n\t:scalene\nend",
"def triangle(x, y, z)\n sides = [x, y, z]\n largest_side = sides.max\n\n # binding.pry\n case\n when sides.inject(:+) != 180, sides.include?(0)\n puts :invalid\n when sides.inject(:+) == 180 && sides.include?(90)\n puts :right\n when sides.inject(:+) == 180 && largest_side > 90\n puts :obtuse\n else \n puts :acute\n end\nend",
"def triangle(side1, side2, side3)\n sides = [side1, side2, side3]\n return :invalid if sides.max > sides.sum / 2 || sides.min.zero?\n case sides.uniq.size\n when 1 then :equilateral\n when 2 then :isosceles\n else :scalene\n end\nend",
"def valid_triangle?(angle1, angle2, angle3)\n sides = [angle1, angle2, angle3]\n\n return true if sides.reduce(:+) == 180 && sides.all? { | num| num > 0}\n false\nend",
"def triangle(side1, side2, side3)\n sides = [side1, side2, side3]\n sides.sort!\n return :invalid if sides.include?(0) || sides[0] + sides[1] < sides[2]\n sides_uniq = sides.uniq\n case sides_uniq.length\n when 1 then return :equilateral\n when 2 then return :isosceles\n when 3 then return :scalene\n end\nend",
"def triangle(side1, side2, side3)\n if side1 + side2 > side3 && side2 + side3 > side1 && side1 + side3 > side2\n if side1 == side2 && side2 == side3\n return :equilateral\n elsif side1 == side2 || side2 == side3 || side1 == side3\n return :isosceles\n else\n return :scalene\n end\n else\n return :invalid\n end\nend",
"def triangle(n1, n2, n3)\n sides = [n1, n2, n3].sort\n case\n when sides.any?{|side| side <= 0 }, sides[0..1].sum <= sides.last\n :invalid\n when sides.uniq.size == 1\n :equilateral\n when sides.uniq.size == 2\n :isosceles\n else\n :scalene\n end\nend",
"def triangle(a, b, c)\n #sort arguments by length\n triangle_array = [a, b, c].sort\n\n #initialize variables to sorted sides\n x = triangle_array[0]\n y = triangle_array[1]\n z = triangle_array[2]\n \n # rule out invalid triangles\n if x + y <= z || (x*y*z) == 0\n return :invalid\n end\n\n if x == y && x == z\n :equilateral\n elsif x == y || x == z || y == z\n :isosceles\n else\n :scalene\n end\nend",
"def triangle(a, b, c)\r\n lengths = [a,b,c].sort\r\n return :invalid if lengths.any? { |side| side == 0 } || lengths[0..1].sum <= lengths.max\r\n if lengths.each_cons(2).any? { |pair| pair[0] == pair [1] }\r\n lengths.uniq.size == 1 ? :equilateral : :isosceles\r\n else\r\n :scalene\r\n end\r\nend",
"def triangle(side1, side2, side3)\n sides = [side1, side2, side3].sort\n\n if sides.count(0) > 0 || sides[0] + sides[1] <= sides[2]\n :invalid\n elsif sides.uniq.size == 1\n :equilateral\n elsif sides.uniq.size == 2\n :isosceles\n elsif sides.uniq.size == 3\n :scalene\n end\nend",
"def triangle(a, b, c)\n if a==0||b==0||c==0\n\traise TriangleError, \"one of the sides equals zero\"\n end\n if (a+b<=c)||(a+c<=b)||(b+c<=a)\n\traise TriangleError, \"2 any sides must be greater then 1\"\n end\n if a<0||b<0||c<0\n\traise TriangleError, \"negative sides\"\n end\n if (a==b) && (a==c) && (b==c)\n :equilateral\n\telsif (a==b)||(a==c)||(b==c)\n :isosceles\n\telse \n :scalene\nend\n\nend",
"def triangle(side1, side2, side3)\n arr = [side1, side2, side3].sort!\n if arr[0] + arr[1] <= arr[2]\n :invalid\n elsif arr[0] == arr[1] && arr[0] == arr[2]\n :equilateral\n elsif arr[0] == arr[1] || arr[0] == arr[2] || arr[1] == arr[2]\n :isosceles\n else\n :scalene\n end\nend",
"def triangle(side1, side2, side3)\n side_array = [side1, side2, side3].sort\n if side_array.include?(0)\n :invalid\n elsif !((side1 + side2) > side3) || !((side2 + side3) > side1)\n :invalid\n elsif side1 == side2 && side1 == side3\n :equilateral\n elsif (side1 == side2 && side1 != side3) || side2 == side3 && side2 != side1 || side1 == side3 && side1 != side2\n :isosceles\n elsif side1 != side2 && side1 != side3 && side3 != side2\n :scalene\n end\nend",
"def triangle(side1, side2, side3)\n arr = [side1, side2, side3].sort\n if side1 == side2 && side2 == side3\n :equilateral\n elsif (arr[0] + arr[1]) < arr[2] || arr.include?(0)\n :invalid\n elsif arr[0] == arr[1] || arr[1] == arr[2]\n :isosceles\n else\n :scalene\n end\nend",
"def triangle(a, b, c)\n sorted_triangle_sizes = [a, b, c].sort\n return :invalid if sorted_triangle_sizes.include?(0) || sorted_triangle_sizes[0] + sorted_triangle_sizes[1] < sorted_triangle_sizes[2]\n\n return :equilateral if a == b && a == c\n return :isosceles if a == b && a != c\n return :scalene\nend",
"def triangle(s1, s2, s3)\n sides = [s1, s2, s3]\n longest_side = sides.max\n\n case\n when largest_side > sides.reduce(:+) - largest_side, sides.include?(0)\n :invalid\n when s1 == s2 && s2 == s3\n :equilateral\n when s1 == s2 || s1 == s3 || s2 == s3\n :issoceles\n else\n :scalene\n end\nend",
"def triangle(side1, side2, side3)\n sides = [side1, side2, side3]\n largest_side = sides.max\n\n case\n when 2 * largest_side > sides.reduce(:+), sides.include?(0)\n :invalid\n when side1 == side2 && side2 == side3\n :equilateral\n when side1 == side2 || side1 == side3 || side2 == side3\n :isosceles\n else\n :scalene\n end\nend",
"def triangle(side1, side2, side3)\n sides = [side1, side2, side3]\n largest_side = sides.max\n\n case\n when 2 * largest_side > sides.reduce(:+), sides.include?(0)\n :invalid\n when side1 == side2 && side2 == side3\n :equilateral\n when side1 == side2 || side1 == side3 || side2 == side3\n :isosceles\n else\n :scalene\n end\nend",
"def triangle(x,y,z)\n sides = [x, y, z].sort \n return :invalid unless sides.all?{ |e| e.is_a?(Numeric) && e > 0 }\n return :invalid if sides[0] + sides[1] <= sides[2]\n # Now, since the sides are sorted, we can do the following:\n if sides[0] == sides[2]\n :equilateral\n elsif sides[0] == sides[1] || sides[1] == sides[2]\n :isosceles\n else\n :scalene\n end\nend",
"def triangle(a, b, c)\n sides = [a, b, c]\n\n # https://stackoverflow.com/a/11361502\n raise TriangleError if sides.min <= 0\n\n # my original answer\n #sides.each do |item|\n # if item <= 0\n # raise TriangleError\n # end\n #end\n\n # https://stackoverflow.com/a/11361502\n x, y, z = sides.sort\n raise TriangleError if x + y <= z\n\n # my original answer\n #if a + b <= c or b + c <= a or c + a <= b\n # raise TriangleError\n #end\n\n # https://stackoverflow.com/questions/4742692/a-more-elegant-solution-to-ruby-koans-triangle-rb\n case sides.uniq.size\n when 1 then :equilateral\n when 2 then :isosceles\n else :scalene\n end\n\n # my original answer\n #if a == b and b == c\n # :equilateral\n #elsif a == b or b == c or c == a\n # :isosceles\n #else\n # :scalene\n #end\nend",
"def triangle(num1, num2, num3)\n sides = [num1, num2, num3]\n\n sides.sort!\n\n return :invalid if sides[0..1].sum <= sides.last\n\n\n if sides.uniq.size == 1\n :equilateral\n elsif sides.uniq.size == 2\n :isosceles\n elsif sides.uniq.size == 3\n :scalene\n end\nend",
"def triangle(*sides)\n # could have used sides.includes?(0)\n return :invalid unless sides.none?(&:zero?)\n return :invalid if sides.max > sides.reduce(:+) - sides.max\n return :equilateral if sides.min == sides.max\n return :isosceles if sides.count { |x| x == sides.max } == 2\n :scalene\nend",
"def triangle(a, b, c)\n sides = [a,b,c]\n validate_sides(sides)\n\n unique_side_lengths = sides.uniq.length\n\n case unique_side_lengths\n when 1\n :equilateral\n when 2\n :isosceles\n when 3\n :scalene\n end\nend",
"def triangle(first, second, third)\n sides_array = [first, second, third]\n max_value = sides_array.max\n sum_of_smaller_sides = sides_array.sum - max_value\n check_array = sides_array.uniq\n\n if sides_array.include?(0) || sum_of_smaller_sides < max_value\n return :invalid\n elsif check_array.size == 1\n return :equilateral\n elsif check_array.size == 2\n return :isosceles\n else\n return :scalene\n end\nend",
"def valid_triangle?(a, b, c)\n if (a + b > c) && (a + c > b) && (b + c) > a\n\ttrue\n else\n\tfalse\n end\n\n\n # arr = [a, b, c]\n # largest_side = a\n # index = 0\n # for i in arr\n # \tif i >= largest_side\n # \t\tlargest_side = i\n # \t\tindex_of = arr.index(i)\n # \tend\n # end\n # arr.delete_at(index_of)\n # puts arr\n # angle = (arr[0]**2 + arr[1]**2 - largest_side**2).to_f / (2*arr[0]*arr[1])\n # if largest_side**2 == (arr[0])**2 + (arr[1])**2 - 2*arr[0]*arr[1]*angle\n # \ttrue\n # else\n # \tfalse\n # end\n\n\n\n # if (a**2 == b**2 + c**2) || (b**2 == c**2 + a**2 ) || (c**2 == b**2 + a**2)\n # \ttrue\n # else\n # \tfalse\n # end\n\nend",
"def triangle(a, b, c)\n #\n # My first solution\n #\n # # Test that the triangle is valid\n # # No side can be <= 0\n # raise TriangleError if a <= 0 || b <= 0 || c <= 0\n # # Sum of any two sides must be > third side\n # raise TriangleError if a >= b+c || b >= a+c || c >= a+b\n\n # return :equilateral if a == b && b == c\n # return :isosceles if a == b || b == c || a == c\n # return :scalene\n #\n\n #\n # The Stack Overflow assisted version\n #\n\n # Sort the triangle sides in ascending order such that a is the smallest\n a, b, c = sides = [a, b, c].sort\n\n # If a <= 0\n raise TriangleError if a <= 0 || a + b <= c\n # Slightly easier to read version:\n # raise TriangleError unless a > 0 || a + b > c\n\n # Find out how many unique lengths there are. If 1, return :equilateral; if\n # 2, return :isoceles; if 3, return :scalene. Note the clever usage of the\n # negative indexing into the array to directly map the number of unique sides\n # to the type of triangle without needing to pad the array\n [:scalene, :isosceles, :equilateral][-sides.uniq.size]\nend",
"def triangle(a, b, c)\n tri = [a, b, c].sort\n\n if tri[0..1].sum <= tri[2] then :invalid\n elsif tri.any? { |side| side <= 0 } then :invalid\n elsif tri[0] == tri[1] && tri[1] == tri[2] then :equilateral\n elsif tri[0] != tri[1] && tri[0] != tri[2] && tri[1] != tri[2] then :scalene\n else :isosceles\n end\nend",
"def valid_triangle?(angles)\n return false if angles.any?(&:zero?)\n\n angles.sum == 180\nend",
"def triangle(a_side, b_side, c_side)\n # WRITE THIS CODE\n sum = a_side + b_side + c_side\n minimum = [a_side, b_side, c_side].min\n maximum = [a_side, b_side, c_side].max\n raise TriangleError unless minimum.positive? && (maximum < sum - maximum)\n\n return :equilateral if equilateral?(a_side, b_side, c_side)\n\n return :isosceles if isosceles?(a_side, b_side, c_side)\n\n :scalene\nend",
"def triangle(a, b, c)\n arr = [a, b, c]\n puts \n if checkLengths(arr.dup) || arr.any? {|x| x < 1} \n raise TriangleError, 'That was wrong biatch'\n end\n uni = arr.uniq!\n return :scalene unless uni\n case uni.length \n when 1\n :equilateral\n when 2\n :isosceles\n end\nend",
"def valid_triangle?(a,b,c)\n\n integer_cant_be_zero = (a == 0) || (b == 0) || (c == 0)\n invalid_triangle = ((a + b) < c) || ((b + c) < a) || ((a + c) < b)\n equilateral_triangle = (a == b) && (b == c)\n isoceles_triangle = (a == b) || (b == c) || (a == c)\n c_b_squared_equ_a_squared = (a > b) && (a > c) && (c**2 + b**2 == a**2)\n a_c_squared_equ_b_squared = (b > a) && (b > c) && (c**2 + a**2 == b**2)\n b_a_squared_equ_c_squared = (c > a) && (c > b) && (b**2 + a**2 == c**2)\n\n if integer_cant_be_zero || invalid_triangle\n return false\n elsif equilateral_triangle || isoceles_triangle\n return true\n elsif c_b_squared_equ_a_squared || a_c_squared_equ_b_squared || b_a_squared_equ_c_squared\n return true\n end\n\nend",
"def valid_triangle?(a, b, c)\n if (a==0 || b==0 || c==0)\n return false\n elsif (a+b<=c) || (a+c<=b) || (c+b<=a)\n return false\n elsif (a==b && a==c && b==c)\n return true\n elsif (a==b || a==c || b==c)\n return true\n elsif (((a**2)+(b**2))==(c**2) || ((a**2)+(c**2))==(b**2) || ((c**2)+(b**2))==(a**2))\n return true\n else\n return false\n end\nend",
"def triangle_bk(s1, s2, s3)\n sorted_sides = [s1, s2, s3].sort\n if sorted_sides.any? { |side| side <= 0} || (sorted_sides[0] + sorted_sides[1] <= sorted_sides[2])\n :invalid\n elsif sorted_sides.all? { |side| side == sorted_sides[0]}\n :equilateral\n elsif sorted_sides[0] != sorted_sides[1] && sorted_sides[1] != sorted_sides[2]\n :scalene\n else\n :isosceles\n end\nend",
"def valid_triangle?(a, b, c)\n if a == 0 or b == 0 or c == 0\n return false\n elsif a == b and b == c and a == c\n return true\n elsif a + b < c or a + c < b or b + c < a\n return false\n else\n return true\n end\nend",
"def check_error(val_a, val_b, val_c)\n raise TriangleError if (val_b + val_c <= val_a) || (val_c + val_a <= val_b)\n raise TriangleError if val_a + val_b <= val_c\nend",
"def triangle(a, b, c)\n triangle = Triangle.new(a,b,c)\n triangle.type\nend",
"def test_error(val_a, val_b, val_c)\n raise TriangleError if val_a <= 0 || val_b <= 0 || val_c <= 0\n sum = (val_a + val_b + val_c) / 2.0\n raise TriangleError if ((sum - val_a) * (sum - val_b) * (sum - val_c)) <= 0\nend",
"def is_triangle(side1,side2,side3)\n sides = [side1,side2,side3]\n unique_sides = sides.uniq.length\n raise TriangleError if triangle_error_found?(sides)\n type_of_triangle(unique_sides)\nend",
"def validity \n if @a + @b <= @c || @c + @a <= @b || @b + @c <=@a\n puts \"These is not a valid triangle, please make sure 2 sides are greater than the addition of one.\"\n return false \n else \n return true \n end \n end",
"def valid_triangle?(a, b, c)\n a + b > c && b + c > a && c + a > b\nend",
"def valid_triangle?(a, b, c)\n a + b > c && a + c > b && b + c > a\nend",
"def valid_triangle?(a, b, c)\n a + b > c && a + c > b && b + c > a\nend",
"def valid_triangle?(a, b, c)\n a + b > c && a + c > b && b + c > a\nend",
"def valid_triangle?(a, b, c)\n ((a+b>c) && (b+c>a) && (a+c>b))? true:false\nend",
"def valid_triangle?(a, b, c)\n if (a + b > c) && (a + c > b) && (b + c > a)\n true\n else\n false\n end\nend",
"def valid_triangle? (num1,num2,num3)\n if num1 + num2 < num3\n true\n elsif num1 + num3 < num2\n true\n elsif num2 + num3 < num1\n true\n else\n false\n end\nend",
"def isTriangle(a, b, c)\n a, b, c = [a, b, c].sort\n a + b > c\nend",
"def initialize(side_one_length, side_two_length, side_three_length)\n @side_one_length = side_one_length\n @side_two_length = side_two_length\n @side_three_length = side_three_length\n #I find working with an array of the three sides easier than working with the instance variables\n triangle_sides = []\n triangle_sides << @side_one_length\n triangle_sides << @side_two_length\n triangle_sides << @side_three_length\n #No sides of a triangle may be equal to zero\n if triangle_sides.any?{|side| side <= 0}\n raise TriangleError\n #The sum of the lengths of any two sides of a triangle always\n #exceeds the length of the third side. I have to check\n #to see if this is true, and if not I need to raise a \n #TriangleError\n elsif (triangle_sides[0] + triangle_sides[1] <= triangle_sides[2]) || (triangle_sides[1] + triangle_sides[2] <= triangle_sides[0]) || (triangle_sides[0] + triangle_sides[2] <= triangle_sides[1])\n raise TriangleError\n # An equilateral triangle has all sides equal\n elsif triangle_sides.all?{|side| side == triangle_sides[0]}\n @kind = :equilateral \n #An isosceles triangle has 2 sides that are equal, so here I'm checking to see that any two sides are equal.\n elsif triangle_sides[1] == triangle_sides[2] || triangle_sides[0] == triangle_sides[2] || triangle_sides[0] == triangle_sides[1]\n @kind = :isosceles\n #scalene triangles have no equal sides. Similar to what I just did but instead they cannot be equal\n elsif (triangle_sides[0] != triangle_sides[1] || triangle_sides[2]) && (triangle_sides[1] != triangle_sides[2])\n @kind = :scalene\n end\n end",
"def valid_triangle?(s1, s2, s3)\n triangle = [s1,s2,s3]\n triangle.sort!\n triangle[2] < triangle[0] + triangle[1] ? true : false\nend",
"def angles\n [angle_a, angle_b, angle_c]\n end",
"def triangle_validation (sides) #unsure about stuff in parens here, if need etc\n #if is_triangle(a, b, c) then True elseif print \"This is not a valid triangle\" end\n #if has_3_sides(sides) then True elseif print \"You must enter THREE sides\" end\n\n if not has_3_sides(sides)\n print \"You must enter THREE sides\\n\"\n return false\n end\n if not is_triangle(sides[0], sides[1], sides[2])\n print \"This is not a valid triangle\\n\"\n return false\n end\n return true\n\n #if not is_triangle(a, b, c) then return False and print \"This is not a valid triangle\" end\n #if not has_3_sides(sides) then return False and print \"You must enter THREE sides\" end\n # return True if is_triangle(a, b, c) and has_3_sides(sides)\n #return False if is not has_3_sides(sides)\n #if False print \"You must enter THREE sides\"\nend",
"def isTriangle(a,b,c)\n if (a > 0) || (b > 0) || (c > 0)\n if ((a + b) > c) && ((a + c) > b) && ((b + c) > a)\n return true\n else\n return false\n end\n else\n return false\n end\nend",
"def valid_triangle?(a, b, c)\n if a + b > c && a + c > b && b + c > a\n return true\n else\n return false\n end\nend",
"def is_valid_triangle?(sides)\n !(sides.include?(0) || sides.sum != 180)\nend",
"def isTriangle(a,b,c)\n a + b > c && b + c > a && a + c > b\nend",
"def valid_triangle?(a, b, c)\n # Your code goes here!\na+b > c && a+c > b && b+c >a\nend",
"def isTriangle(a,b,c)\n a + b > c && b + c > a && a + c > b\nend",
"def isTriangle(a,b,c)\n (a+b>c && a+c>b && c+b>a)? true : false\nend",
"def valid_triangle?(side1, side2, side3)\n\n triangle_sides = [side1, side2, side3].sort\n triangle_sides[0] + triangle_sides[1] > triangle_sides[2] \nend",
"def valid_triangle?(a, b, c)\n # Your code goes here!\n if (c + b > a) && (a + c > b) && (a + b >c)\n true\n else\n false\n end\n \nend",
"def right_triangle?(a, b, c)\n a**2 + b**2 == c**2\nend",
"def valid_triangle?(a, b, c)\n if a <= 0 || b <= 0 || c <= 0\n return false\n end\n\n if a + b >= c && a + c >= b && b + c >= a\n return true\n else\n return false\n end\nend",
"def isTriangle(a,b,c)\n a+b>c && a + c > b && b + c > a ? true : false\nend",
"def checktriangle(a, b, c)\n if a + b <= c\n return false\n elsif b + c <= a\n return false\n elsif c + a <= b\n return false\n else\n return true\n end\nend",
"def test_different_lengths_of_triangles_and_compare_to_radius(radius)\n sum = 0\n # the greatest length of one of the triangle sides is 2 * radius\n max_length = 2 * radius\n # the smallest length is 1\n (1..max_length).each do |a|\n (a..max_length).each do |b|\n (b..max_length).each do |c|\n sorted = [a,b,c].sort\n next if bad_combo?(sorted)\n if radius.to_f == (calculated_radius = get_circle_radius_for_side_lengths(sorted).to_f rescue 0)\n puts \"A: #{a}, B: #{b}, C: #{c}\"\n sum += radius \n elsif (calculated_radius.to_i.to_f != calculated_radius.to_f rescue true)# combo sucks, ignore for next time\n ignore_combo(sorted)\n end\n end\n end\n end\n if sum > 0\n @successful_radii[radius] ||= []\n @successful_radii[radius] << sum/radius # count of triangles\n end\n return sum\nend"
] |
[
"0.85333085",
"0.85224205",
"0.8477124",
"0.8457057",
"0.84270364",
"0.84120065",
"0.8407602",
"0.84048146",
"0.8391992",
"0.8371835",
"0.83487827",
"0.8312553",
"0.83079696",
"0.82998854",
"0.8250665",
"0.82035416",
"0.8194497",
"0.81898564",
"0.81737095",
"0.8096712",
"0.78266007",
"0.7812555",
"0.7689574",
"0.7520274",
"0.7376392",
"0.71877575",
"0.71068406",
"0.70786256",
"0.70054054",
"0.6959481",
"0.6956827",
"0.6916162",
"0.69040966",
"0.6865813",
"0.6835279",
"0.681535",
"0.67961913",
"0.67897093",
"0.67838454",
"0.67635757",
"0.6756482",
"0.67520523",
"0.67292327",
"0.6717935",
"0.6716906",
"0.66945827",
"0.6689035",
"0.66890144",
"0.66805387",
"0.667877",
"0.6663138",
"0.6646319",
"0.6646319",
"0.6636145",
"0.6608038",
"0.66014886",
"0.6581134",
"0.65608275",
"0.6555956",
"0.65384024",
"0.65086406",
"0.64797306",
"0.64276105",
"0.642691",
"0.63931876",
"0.6304168",
"0.624209",
"0.6204722",
"0.6185485",
"0.6077943",
"0.6069342",
"0.60431135",
"0.6034758",
"0.60115993",
"0.5984751",
"0.5973953",
"0.5973953",
"0.5973953",
"0.59530187",
"0.5946501",
"0.59331864",
"0.5863486",
"0.5852008",
"0.58096385",
"0.5798629",
"0.57980645",
"0.5794133",
"0.57937425",
"0.5777476",
"0.57725364",
"0.57700896",
"0.57622874",
"0.5759055",
"0.57542104",
"0.57436526",
"0.5689338",
"0.5665631",
"0.5659609",
"0.56499887",
"0.56350124"
] |
0.8493945
|
2
|
Autorizacion, pregunta si el usuario esta logueado
|
def logged_in_dog
unless logged_in?
redirect_to '/'
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def logado?\n !current_user.nil?\n end",
"def revisar_usuario\n if session[:usuario].empty?\n flash[:notice] = \"Debe loguearsar para poder seguir\"\n redirect_to \"/login\"\n end\n end",
"def verificar_autenticado_admin\n unless session[:usuario_admin] #else if,tiene quer ser falso\n bitacora \"Intento de accceso sin autenticacion a la zona del admin\"\n flash[:error]=\"Debe autenticarse como Administrador\"\n redirect_to :action => \"index\" , :controller => \"externo\"\n return false\n end\n end",
"def logado?\n !admin_atual.nil?\n end",
"def logged_in?\n #Dependiendo de lo que regrese current_user\n if current_user\n #Regresa true si el usuario existe\n true\n else\n #Si no existe regresa false\n false\n end\n end",
"def first_login\n if !current_user.adm? && (!current_user.last_name.present? || !current_user.email.present? || \n !current_user.job.present? || !current_user.cpf.present? || current_user.email == (0...6).map { ('a'..'z').to_a[rand(26)] }.join+\"@facebook.com\") \n redirect_to edit_user_path(current_user)\n flash[:info] = \"Complete seu cadastro!\"\n \n if !current_user.last_name.present?\n flash[:info] = \"Sobrenome não registrado.\"\n end\n \n if !current_user.email.present?\n flash[:info] = \"Email não registrado.\"\n end\n \n if !current_user.job.present?\n flash[:info] = \"Trabalho não registrado.\"\n end\n \n if !current_user.cpf.present?\n flash[:info] = \"CPF não registrado.\"\n end\n \n if current_user.email == (0...6).map { ('a'..'z').to_a[rand(26)] }.join+\"@facebook.com\"\n flash[:info] = \"Registre o seu email.\"\n end\n end\n end",
"def control_usuario \n usuarios = Usuario.all\n usuarios.each do |u|\n if cuentum_signed_in? && current_cuentum.id == u.cuenta_id\n if u.rol == \"USUARIO\" \n redirect_to \"welcome/index\" \n end\n end\n end\n end",
"def control_usuario \n usuarios = Usuario.all\n usuarios.each do |u|\n if cuentum_signed_in? && current_cuentum.id == u.cuenta_id\n if u.rol == \"USUARIO\" \n redirect_to \"welcome/index\" \n end\n end\n end\n end",
"def loguear\n\t\tif !(verificaUsuario)\n\t\t\tif verificaPass\n\t\t\t\treturn \"correcto\" #Si puede loguearse\n\t\t\telse\n\t\t\t\treturn \"passincorrecto\" #no puede loguearse por que la contrasena no es correcta\n\t\t\tend\n\t\telse\n\t\t\treturn \"usuarioincorrecto\" #no puede loguearse por que el usuario no existe\n\t\tend\n\tend",
"def user_have\n unless current_user\n redirect_to root_path, :alert => \"Зарегистрируйтесь или войдите\"\n end\n end",
"def comprobar_usuario_login\n @usuario_actual=nil\n return unless session[:user_id]\n @usuario_actual = Usuario.find_by_id(session[:user_id])\n end",
"def pide_login\n if !logado\n redirect_to login_path,:notice=>'Se requiere usuario y clave'\n\t end\n end",
"def logged_in?\n \t#devuelve un booleano para saber si hay un usuario loggeado o no. \n \t#para eso sirven los dos signos de exclamacion !!\n \t!!usuario_actual\n end",
"def login_disponible(login)\n usuario = UsuarioService.new.listar_usuario(login)\n usuario.nil?\n end",
"def exibe_para_usuario?\n \t\tif usuario_signed_in?\n \t\t\tif current_usuario.admin?\n \t\t\t\treturn true\n \t\t\telse\n \t\t\t\treturn false\n \t\t\tend\n \t\telse\n \t\t\treturn false\n \t\tend\n \tend",
"def user_login?\n\t\treval = user_info[:uid] > 0 ? true : false\n\t\tif reval\n\t\t\tuser_session_update user_info[:sid], user_info[:uid]\n\t\tend\n\t\treval\n\tend",
"def check_for_user\n if User.count == 0\n User.create({:login => \"admin\", :password => \"password\", :password_confirmation => \"password\", :name => 'blog owner', :email => \"none@none\", :time_zone => \"Europe/London\"})\n # Display the newly created users details\n notify \"No users found, so default user created: authenticate with login \\\"admin\\\", password \\\"password\\\", and then change your password.\"\n end\n login_required\n end",
"def authticate\n unless User.find_by_id(session[:user_id])\n flash[:notice] = \"Please log in.\"\n redirect_to :controller => 'admin', :action => 'login'\n end \n end",
"def set_usuario\n \n end",
"def fazer_login\n self.input_email.set $dados['user']['user_submarino']\n self.input_senha.set $dados['user']['password_submarino']\n self.button_continuar.click\n end",
"def autologin_the_user\n #unless logged_in?\n # FrontendUserSession.create(params[:frontend_user_session])\n #end\n end",
"def authorize\n if current_user.nil? || current_user.tipo_usuario == \"Empleado\"\n redirect_to login_url, notice: \"No esta autorizado para ver esto. Por favor ingrese al sistema o reingrese como administrador.\"\n end\n end",
"def switch\n authorize!(:manage, :all)\n user = User.find_by(login: params[:login].upcase)\n if user\n session[:original_user_id] = session[:user_id]\n session[:user_id] = user.id\n redirect_to root_url, notice: \"Sie sind nun der Nutzer mit dem Login #{user.login}.\"\n else\n redirect_to root_url, notice: \"Der Nutzer existiert nicht im System.\"\n end\n end",
"def autenticathe_login!\n unless someone_is_logged_in?\n store_location\n flash[:danger] = \"Por favor, Inicie sesion.\"\n redirect_to welcome_path\n end\n end",
"def logar(usuario, senha)\n login.set usuario\n password.set senha\n click_button 'acessarcti'\n end",
"def authenticate_user!\n if user_signed_in?\n if @current_user.stato != 'confermato'\n signed_out = (Devise.sign_out_all_scopes ? sign_out : sign_out(resource_name))\n #cancello sessioni di openweb\n if signed_out\n session.keys.each{ |chiave_sessione|\n next if chiave_sessione == \"_csrf_token\"\n session.delete(chiave_sessione.to_sym)\n }\n messaggio = \"Utente non confermato dall'amministratore\"\n redirect_to auth_hub.new_user_session_path, notice: messaggio\n return\n end\n end\n \n return true\n else\n messaggio = nil\n #controllo se arrivo da form di login\n if request.post? and !params['user'].blank?\n @current_user = warden.authenticate!(:scope => :user)\n #controllo se lo stato è confermato\n if @current_user.stato == 'confermato'\n return true\n else\n signed_out = (Devise.sign_out_all_scopes ? sign_out : sign_out(resource_name))\n #cancello sessioni di openweb\n if signed_out\n session.keys.each{ |chiave_sessione|\n next if chiave_sessione == \"_csrf_token\"\n session.delete(chiave_sessione.to_sym)\n }\n messaggio = \"Utente non confermato dall'amministratore\"\n end\n end\n end\n messaggio ||= \"Si prega di accedere per vedere la pagina!\"\n redirect_to auth_hub.new_user_session_path, notice: messaggio\n end\n end",
"def admin_logado?\n !!admin_logado\n end",
"def needs_login?() false end",
"def logged_in_user\n unless logged_in?\n flash[:danger] = \"Você não está logado no sistema.\"\n redirect_to login_url\n end\n end",
"def login(user)\n\tif $users_profil.include?(user)\n\t\tputs \"Username: #{user}\"\n\t\tputs \"Profil: #{$users_profil[user]}\" \n\telse \n\t\tputs \"Numele de utilizator este gresit.\"\n\t\tprima # daca a scris usernamul gresit sau daca acel username nu exista atunci scriptul practic se reinitializeaza\n\tend\nend",
"def logged_in_user\n unless logged_in?\n store_location\n flash[:danger] = \"Veuillez svp vous connecter\"\n redirect_to connexion_url\n end\n end",
"def validate_usuario\n if current_usuario.tipo!='Administrador' || !current_usuario.activo\n redirect_to root_path\n end\n end",
"def ha_accedido?\n\t\t!usuario_actual.nil?\n\tend",
"def Usuario_noLogueado\n redirect_to(root_url) unless logged_in?\n end",
"def user_logged_in_sin_hogar\n\n\t\t redirect_to new_direccion_path if logged_in? && !tiene_hogar?\n\n \tend",
"def logged_in?\n !current_utente.nil?\n end",
"def ingreso\n\t\t@titulo = \"Ingreso al portal\"\n\t\treset_session\n\t\tif params[:id] && params[:token]\n\t\t\tid = params[:id]\n\t\t\ttoken = params[:token]\n\t\t\tif __es_numero_entero?(id) && __es_token?(token)\n\t\t\t\tif @usuario = Usuario.validar_token(id,token)\n\t\t\t\t\tif @usuario.activo == 0\n\t\t\t\t\t\tbitacora \"Ingreso correcto al sistema para el usuario con id #{params[:id]} y token #{params[:token]}\"\n\t\t\t\t\t\treturn\n\t\t\t\t\telse\n\t\t\t\t\t\tflash[:error] = \"Disculpe, pero su usuario ya se encuentra activo.\"\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\n\t\tbitacora \"Intento fallido de ingreso al sistema con id #{params[:id]} y token #{params[:token]}\"\n\t\tredirect_to :action => \"index\", :controller => \"inicio\"\n\tend",
"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(\"teste_timeinfra@corp.globo.com\")\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 correсt_user\n @user = User.find(params[:id])\n redirect_to(root_path) unless (current_user?(@user) or is_admin?)\n\n end",
"def redirecionar_usuario_logado\n if current_account != nil \n redirect_to accounts_url\n end\n end",
"def authentication_successful?\n @user.present?\n end",
"def create\n estudiante = Estudiante.find_by(correo: (params[:session][:correo]+\"@ciencias.unam.mx\").downcase)\n if estudiante && estudiante.authenticate(params[:session][:password])\n if estudiante.activado?\n log_in estudiante\n params[:session][:remember_me] == '1' ? remember(estudiante) : forget(estudiante)\n redirect_to estudiante\n else\n mensaje = \"Cuenta no activada. \"\n mensaje += \"Revisa tu correo para visitar el link de activacion.\"\n flash.now[:warning] = mensaje\n render 'new'\n end\n else\n flash.now[:danger] = 'Contraseña/correo incorrecto'\n render 'new'\n end\n end",
"def require_user\n unless logged_in?\n store_target_location\n flash[:notice] = \"Debe iniciar sesion para poder acceder a esta pagina\"\n redirect_to login_url\n return false\n end\n true\n end",
"def active_for_authentication?\n super && bloqueado == 0\n end",
"def authorize?(user)\n true\n #user.login == \"administrador\"\n end",
"def is_user?\ncurrent_user.username == @userl.username\n end",
"def nuevo_usuario\n @user = User.new(params[:user])\n @user.cantidad_bots = 1\n\n # Según tipo de registro\n if params[:tipo] == \"plus\"\n @user.registro = true\n end\n\n # Se agrega perfil de usuario (0)\n @user.perfil = 0\n if @user.valid?\n @user.save\n # Login automatico al registrar\n session[:login] = @user\n session[:last_seen] = Time.now\n UserMailer.welcome_email(@user).deliver\n redirect_to bot_path, :notice => \"Registro OK, Bienvenido\"\n else\n flash[:error] = \"Error en los datos ingresados\"\n render 'bots/registrar'\n end\n end",
"def realizar_login_restrito(usuario, senha) \n\n @usuario = usuario\n @senha = senha\n\n usuario_restrito_input.set(@usuario)\n sleep(1)\n senha_restrito_input.set(@senha)\n sleep(1)\n acessar_restrito_button.click\n\n end",
"def check_user\n if (!user_signed_in?)\n redirect_to root_path, notice: 'You must log in to do that'\n end\n # if (!current_user.superadmin_role)\n # redirect_to root_path, notice: 'You do not have permissions to do that'\n # end\n end",
"def check_user_logged\n if current_user.type_access == 'User'\n flash[:danger] = 'Voçê não tem permissão para acessar essa pagina!'\n redirect_to root_path\n end\n end",
"def check_user\n if user_signed_in?\n else\n redirect_to root_path, :alert => \"Unauthorised Access\"\n end\n \n end",
"def check_user\n if user_signed_in?\n else\n redirect_to root_path, :alert => \"Unauthorised Access\"\n end\n \n end",
"def logged_in?\n \t#devuelve un booleano para saber si hay un usuario loggeado o no. \n \t#para eso sirven los dos signos de exclamacion !!\n \t!!current_user\n end",
"def login_required\n if params[:create_user] # hidden field in posted form. Create the user.\n user = User.new\n user.last_login = request.remote_ip\n if user.save && user.errors.empty?\n self.current_user = user # !! now logged in\n else\n flash[:error] = \"I am sorry. the system could not create a new account for you.\"\n access_denied\n end\n elsif authorized?\n return true\n else\n access_denied\n end\n end",
"def realizar_login\n input_login.set \"juzi\"\n input_senha.set \"jose\"\n btn_login.click\n end",
"def users_only\n deny_access(\"Necesitas crear una cuenta para entrar a esta sección\") unless signed_in?\n end",
"def correct_user\n @user = User.find(params[:id])\n redirect_to(users_path,:notice =>'Accés non autorisé') unless( current_user?(@user)|| current_user.is_admin?)\n end",
"def create\n \n user = Farmacium.where(correo: params[:correo]).first\n if user==nil\n redirect_to \"/login\", notice: 'Correo no se encuentra Registrado' \n else\n if(user.verificado==true or user.correo=='ADMIN')\n if user && user.authenticate(params[:password])\n # Save the farmacia id inside the browser cookie. This is how we keep the farmacia \n # logged in when tey navigate arund our website.\n session[:farmacia_id] = user.id\n if user.correo == 'ADMIN'\n redirect_to '/laboratorios'\n else\n redirect_to '/lab_fars'\n end\n else\n # If farmacia's login doesn't work, send them back to the login form.\n redirect_to \"/login\", notice: 'Error de autenticacion' \n end\n \n else\n redirect_to \"/login\", notice: 'Usuario no verificado' \n \n end\n end\nend",
"def authenticate\n if sesssion[:user_id].nil?\n redirect_to login_path, notice: \"You must log in first.\"\n end\n end",
"def authenticate_current_user\n unless current_user.admin == true\n unless current_user == User.find(params[:id]) \n flash[:danger] = \"Impossible d'aller sur cette page.\"\n redirect_to root_path\n end\n end\n end",
"def logged_in_user\n unless logged_in?\n redirect_to login_url, flash: { danger: 'Por favor, faça login' }\n end\n end",
"def usuario_correto\n @usuario = Usuario.find(params[:id])\n redirect_to(root_path) unless usuario_corrente?(@usuario)\n end",
"def tentarlogar(email, senha)\n campo_email.set email\n campo_senha.set senha\n botao_entrar.click\n end",
"def logged_in_user\n unless logged_in?\n puts \"not logged in\"\n end\n end",
"def correct_user(id)\n @user = User.find(id)\n unless current_user? @user\n flash[:danger] = \"Azione non autorizzata\"\n redirect_to groups_path\n end\n end",
"def authorise\n unless User.find_by_id(session[:user_id]) || (self.controller_name == 'users' && (self.action_name == 'new' || self.action_name == 'create'))\n session[:original_uri] = request.request_uri\n flash[:notice] = \"Please login!\"\n redirect_to login_url\n end\n end",
"def correct_user\n @usuario = Usuario.find(params[:id])\n redirect_to(root_url) unless current_user?(@usuario)\n end",
"def login_user\n puts \"Please enter your name\"\n name = CLI.gets_with_quit\n\n if self.user_exists(name)\n user = self.find_user(name)\n if check_password(user)\n CLI.active_user = user\n # fall through to CLI.start\n else\n CLI.start\n end\n\n else\n puts \"Sorry, User not found!\"\n if CLI.yes_no(\"Sign Up\")\n self.signup_user(name)\n else\n CLI.start\n end\n end\n end",
"def logged_in_user\n unless logged_in?\n store_location\n flash[:danger] = \"Per compiere quest'azione è necessario effettuare login\"\n redirect_to login_path\n end\n end",
"def ensure_user\n current_user? || deny_access('You must be logged in to perform this action.')\n end",
"def author_login\r\n user.login if user\r\n end",
"def fully_authed?\n !(user.nil? || password.nil?)\n end",
"def usuario_actual\n \t#se guarda al usuario actual que esta loggeado por cuestion de eficiencia\n \t#para no accesar a la base de datos todo el tiempo\n \t@usuario_actual ||= Alumno.find(session[:alumno_id]) if session[:alumno_id]\n end",
"def make_sure_logged_in\n\n\t\tif current_user.nil?\n\n\t\tflash[:error] = \"You need to be signed up\"\n\n\t\tredirect_to new_user_path\n\n\n\t\tend\n\n\n\n\n\tend",
"def inicio_sesion?\n usuario_id.blank?\n end",
"def authenticate_user\n if session[:user_id]\n # set current user object to @current_user object variable\n puts \"===============================================auth_if==============================================\"\n @current_user = User.find session[:user_id]\n return true\n else\n puts \"===============================================auth_else==============================================\"\n redirect_to(:controller => 'welcome', :action => 'index')\n return false\n end\n end",
"def relogin\n\n reset_session\n\n reentrada = Reentrada.find_by_id(params[:id])\n\n session[:ObjLogon] = Usuario.find_by_cadastro_id(reentrada.cadastro_2.id)\n\n\n if usuario_logado == true\n redirect_to root_path, notice: 'Usuario logado com sucesso.'\n else\n flash[:error] = \"Usuario ou senha incorretos.\"\n end \n end",
"def make_sure_logged_in\n\n\t\tif current_user.nil?\n\n\t\tflash[:error] = \"You need to be signed up\"\n\t\tredirect_to new_user_path \n\n\n\t\tend\t\n\n\n\tend",
"def logged_in_user\n\t\tunless logged_in?\n\t\t\tstore_location\n\t\t\tflash[:danger] = \"E' necessario accedere\"\n\t\t\tredirect_to login_url\n\t\tend\n\tend",
"def solo_perfilados\n redirect_to root_path if current_user.perfilado !=true\n end",
"def logged_in_user\n unless logged_in?\n store_location\n flash[:danger] = \"Вы не вошли на сайт. Пожалуйста выполните вход.\"\n redirect_to login_url\n end\n end",
"def authentication_successful?\n current_user.present?\n end",
"def usuario_actual?(usuario)\n\t\tusuario == usuario_actual\n\tend",
"def usuario_correcto\n @user = User.find(params[:id])\n redirect_to(root_url) unless usuario_actual?(@user)\n end",
"def logar(usuario, senha)\n login.set usuario\n password.set senha\n click_button 'kc-login'\n end",
"def logar(usuario, senha)\n login.set usuario\n password.set senha\n click_button 'kc-login'\n end",
"def logged_in\r\n end",
"def index\n @usuario = Usuario.new\n $error_login = false;\n #Verifica si se ha enviado el formulario.\n if request.post?\n \n @user = Usuario.find_by_user(params[:nombre_usuario])\n #Verifica si el nombre de usuario y la contraseña son correctos.\n if login(params[:nombre_usuario], params[:contrasena])\n #Los datos son correctos así que redirecciona a la página de bienvenida.\n redirect_to :controller => \"principal\", :action => \"principal\";\n \n else\n #Los datos son incorrectos así que setea la variable @error_login a true para mostrar el error por pantalla.\n $error_login = true;\n redirect_to usuarios_index_path\n end\n end\n end",
"def user_on\n session[:user_id] = '3980284084'\n end",
"def check_login\n if !session[:user_name]\n redirect_to sign_in_path\n end\n end",
"def logged_in_user\n unless logged_in?\n store_location\n flash[:danger] = \"Primero has Log In\"\n redirect_to login_url\n end\n end",
"def revisa_conectado\n unless conectado?\n redirect_to root_path\n end\n end",
"def _is_login\n p session[:user]\n session[:user] ? true : false\n end",
"def user?\n @user = User.find_by(email: @email) if @userinfo\n\n # No user with that email so create the user with auth0_id.\n create_user_and_login @userinfo if @user.nil?\n end",
"def login_check\n if not is_logged_in session\n # should never get in here\n redirect_to :action => :index\n end\n sunet = session[:user_hash][\"username\"]\n if User.find_by_sunet(sunet)\n redirect_to :action => :index\n else\n # create new user\n gn = session[:user_hash][\"gn\"] || \"\"\n sn = session[:user_hash][\"sn\"] || \"\"\n phone = session[:user_hash][\"phone_number\"] || \"\"\n major = session[:user_hash][\"org\"] || \"\"\n @user = User.new(:sunet => sunet, :first_name => gn.titlecase, :last_name => sn.titlecase, :bio => \"I dance for Basmati Raas!\", :is_alumni => false, :is_undergrad => true, :phone => phone, :major => major)\n @user.save\n flash[:notice] = \"Welcome! We started filling out your profile. Please upload a picture and update your information.\"\n redirect_to \"/users/#{@user.id}/edit\"\n end\n end",
"def login_check\n if not is_logged_in session\n # should never get in here\n redirect_to :action => :index\n end\n sunet = session[:user_hash][\"username\"]\n if User.find_by_sunet(sunet)\n redirect_to :action => :index\n else\n # create new user\n gn = session[:user_hash][\"gn\"] || \"\"\n sn = session[:user_hash][\"sn\"] || \"\"\n phone = session[:user_hash][\"phone_number\"] || \"\"\n major = session[:user_hash][\"org\"] || \"\"\n @user = User.new(:sunet => sunet, :first_name => gn.titlecase, :last_name => sn.titlecase, :bio => \"I dance for Basmati Raas!\", :is_alumni => false, :is_undergrad => true, :phone => phone, :major => major)\n @user.save\n flash[:notice] = \"Welcome! We started filling out your profile. Please upload a picture and update your information.\"\n redirect_to \"/users/#{@user.id}/edit\"\n end\n end",
"def verificar_session\n unless session[:usuario] and session[:usuario][:tipo] == 'admin'\n redirect_to \"/\"\n end\n end",
"def logged_in_user\n unless logged_in?\n # store current location to automatically redirect user after login\n store_location\n # show a flash message on the page\n flash[:danger] = \"Per favore effettua il login\"\n # redirect user to login page\n redirect_to login_url\n end\n end",
"def check_login_status\n # If user hasn't logged in\n unless logged_in?\n # Show reminder message\n flash[:info] = \"Log in to continue.\"\n\n # Redirect user to login page\n redirect_to login_url\n end\n end",
"def authorized_user\n @event = Event.friendly.find(params[:id])\n if @event.creator_id != current_user.id\n if current_user.email == 'pubudu@eventhub.lk' || current_user.email == 'pavithra@eventhub.lk'\n return true\n end\n redirect_to root_path, alert: \"Oops! You don't have permission to do that\"\n end\n end",
"def user_login?\n\t !!current_user\n\tend"
] |
[
"0.72099483",
"0.70316184",
"0.7003652",
"0.6995591",
"0.6963468",
"0.68989384",
"0.6888302",
"0.6888302",
"0.687992",
"0.68741006",
"0.6810691",
"0.67748564",
"0.6759546",
"0.6743784",
"0.67345256",
"0.67239904",
"0.6689287",
"0.66641426",
"0.66192067",
"0.661506",
"0.66056246",
"0.6558663",
"0.6552509",
"0.65143776",
"0.65114653",
"0.650413",
"0.64789015",
"0.6469844",
"0.6452802",
"0.6448317",
"0.64426154",
"0.64149374",
"0.6413461",
"0.63917446",
"0.6386924",
"0.6384916",
"0.63795954",
"0.63748324",
"0.637365",
"0.6371829",
"0.63562244",
"0.6333447",
"0.632356",
"0.63175887",
"0.6314202",
"0.6308643",
"0.6303612",
"0.6301204",
"0.6293377",
"0.62910795",
"0.6282973",
"0.6282973",
"0.6271521",
"0.62684184",
"0.62444466",
"0.6230867",
"0.6221156",
"0.621759",
"0.6214709",
"0.6212344",
"0.6211552",
"0.620559",
"0.620383",
"0.6198079",
"0.61959577",
"0.61949384",
"0.6192748",
"0.6192458",
"0.619167",
"0.6186304",
"0.6181316",
"0.6177236",
"0.61668277",
"0.61653286",
"0.61621225",
"0.6162095",
"0.6160114",
"0.61545616",
"0.6147211",
"0.61435777",
"0.6134468",
"0.6131159",
"0.61311054",
"0.6115527",
"0.6110398",
"0.6110398",
"0.61082226",
"0.61071175",
"0.61055696",
"0.60895157",
"0.60873955",
"0.6084602",
"0.6079753",
"0.6071265",
"0.60711104",
"0.60711104",
"0.60678864",
"0.60612047",
"0.6061113",
"0.6058667",
"0.6052376"
] |
0.0
|
-1
|
Hovers the widget defined by +name+ and optional +args+.
|
def hover(name, *args)
widget(name, *args).hover
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def hover\n base.image_for(\"#{name}_hover\")\n end",
"def hover_click(*args)\n if args.size == 1\n driver.action.click(element).perform\n else\n sym,id = args\n driver.action.click(driver.find_element(sym.to_sym,id)).perform\n end\n\n end",
"def mouse_over locator\r\n command 'mouseOver', locator\r\n end",
"def mouse_over locator\r\n command 'mouseOver', locator\r\n end",
"def lbSetTooltip _args\n \"lbSetTooltip _args;\" \n end",
"def widget(name, *args)\n eventually { document.widget(name, *args) }\n end",
"def double_click(name, *args)\n widget(name, *args).double_click\n end",
"def right_click(name, *args)\n widget(name, *args).right_click\n end",
"def hover(componentName, componentInfo = nil, delay = 500)\n driver.action.move_to(get_component(componentName, componentInfo)).perform\n java.lang.Thread.sleep(delay)\nend",
"def isAutoHoverOn _args\n \"isAutoHoverOn _args;\" \n end",
"def run_widget_hook(name, *args)\n self.class.callbacks_for_hook(name).each { |blk| instance_exec(*args, &blk) }\n end",
"def hover_element (element)\n element = element.downcase.gsub(' ', '_')\n wait_until{send(\"#{element}?\")}\n\n select = send(\"#{element}_element\")\n wait_until{select.visible?}\n\n select.hover\n end",
"def draw_element(*args)\n image_to_draw = hovering? && !image_hover.nil? ? image_hover : image\n image_to_draw.draw(point.x, point.y, *args)\n end",
"def hover(componentName, delay = 500, componentInfo = nil)\n driver.action.move_to(get_component(componentName, componentInfo)).perform\n java.lang.Thread.sleep(delay)\nend",
"def widgets(name, *args)\n document.widgets(name, *args)\n end",
"def ctrlSetTooltipColorBox _obj, _args\n \"_obj ctrlSetTooltipColorBox _args;\" \n end",
"def ctrlSetTooltip _obj, _args\n \"_obj ctrlSetTooltip _args;\" \n end",
"def hover_over_element(access_type, access_name)\n element = $driver.find_element(:\"#{access_type}\" => \"#{access_name}\")\n $driver.action.move_to(element).perform\nend",
"def mouse_over(text, x: 0, y: 0, index: 1)\n Element.new(\"Clicking #{text}\", :xpath, \"(//*[text()=\\\"#{text}\\\"])[#{index}]\").mouse_over(x: x, y: y)\n end",
"def mouse_up *args; end",
"def hover_over_sponsor(sponsor)\n page.execute_script(\"$('#{sponsor_container_selector(sponsor)}').trigger('mouseover')\")\nend",
"def tag(name, *args, &block)\n _gestalt_call_tag(name.to_s, args, &block)\n end",
"def invoke(name, *args, **keywords, &blk)\n window.send(name, *args, **keywords, &blk)\n end",
"def hover_event(element)\n # replaces element colour with overlay only\n # while mouse over\n element.colour = OVERLAY\nend",
"def hover_over_link(text)\n find(\"a\", text: text).hover\n end",
"def on_hover(&block)\n hover_handlers << block\n self\n end",
"def setMousePosition _args\n \"setMousePosition _args;\" \n end",
"def curatorMouseOver \n \"curatorMouseOver\" \n end",
"def mouse_in(e)\n @state = :hover\n end",
"def link_to_with_tooltip(name, target, *args, &proc)\n args << returning(args.extract_options!) do |options|\n options[:class] = 'tooltip-target ' + options[:class].to_s\n options[:rel] = default_prototip_options\n end\n link_to name, target, *args, &proc\n end",
"def [](*args, &block)\n name = args.shift\n config.component_class[name.to_sym].wedge_new self, *args, &block\n end",
"def native_hover\n # original watir-webdriver code for hover\n assert_exists\n assert_has_input_devices_for :hover\n\n driver.action.move_to(@element).perform\n end",
"def hover_click(element)\n driver.action.click(element).perform\n end",
"def render_mouse_crosshairs args, mouse\n return unless args.state.show_gridlines\n args.labels << [10, 25, \"mouse: #{mouse.x} #{mouse.y}\", 255, 255, 255]\nend",
"def hover_within(wrapper, locator, type)\n within(wrapper) do\n find(type.to_sym, locator).hover\n end\n end",
"def mouse_press *args\n\t\t\tevent(:mouse_press, *args)\n\t\tend",
"def hover_over_element(access_type,access_name)\n element = WAIT.until {$driver.find_element(:\"#{access_type}\" => \"#{access_name}\")}\n $driver.action.move_to(element).perform\nend",
"def hover\n root_node.hover\n end",
"def l(text=\"\", name=\"\")\n JLabel.new(text) #.tap{|jl| jl.name = name }\n end",
"def link_to_function(name, *args, &block)\n html_options = args.extract_options!.symbolize_keys\n\n function = block_given? ? update_page(&block) : args[0] || ''\n onclick = \"#{\"#{html_options[:onclick]}; \" if html_options[:onclick]}#{function}; return false;\"\n href = html_options[:href] || '#'\n\n content_tag(:a, name, html_options.merge(:href => href, :onclick => onclick))\n end",
"def clicked\n @callback.call if mouse_over?\n end",
"def ctrlSetTooltipColorShade _obj, _args\n \"_obj ctrlSetTooltipColorShade _args;\" \n end",
"def mouse_over_link(link_id)\r\n\r\n link_using_id = get_link_using_id(link_id)\r\n\r\n link_using_id.fire_event 'onMouseOver'\r\n\r\n end",
"def ctrlSetTooltipColorText _obj, _args\n \"_obj ctrlSetTooltipColorText _args;\" \n end",
"def name _args\n \"name _args;\" \n end",
"def %(name)\n self.label = name\n self\n end",
"def [](name, *args, &block)\n config.component_class[name].wedge_new self, *args, &block\n end",
"def click(*args)\n\t\t\t# if no argument has been provided, click on the\n\t\t\t# window itself\n\t\t\th = (args.length == 0) ? @handle : child(args[0]).handle\n\t\t\t\n\t\t\trectangle = [0, 0, 0, 0].pack 'LLLL'\n\t\t\tget_window_rect h, rectangle\n\t\t\tleft, top, right, bottom = rectangle.unpack 'LLLL'\n\t\t\t\n\t\t\tcenter = [(left + right) / 2, (top + bottom) / 2]\n\t\t\tset_cursor_pos *center\n\t\t\t\n\t\t\tmouse_event MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0\n\t\t\tmouse_event MOUSEEVENTF_LEFTUP, 0, 0, 0, 0\n\t\tend",
"def setTitleEffect _obj, _args\n \"_obj setTitleEffect _args;\" \n end",
"def mouse_over(&block)\n self.listen_to :event => :mousemove, :with => :location, &block\n end",
"def add_widget(name)\n @browser.div(:id=>\"add_goodies_body\").li(:text=>/#{Regexp.escape(name)}/).button.click\n end",
"def britelink icon, name, time = nil, bg = \"#8c9\", &blk\n flow width: 300, margin: [4, 2, 4, 4] do\n b = background bg, curve: 6, height: 29, hidden: true\n img = image HH::STATIC + \"/\" + icon, margin_top: 3\n p1 = para link(fg(name, black)){blk.call}, size: 13, width: 200\n para(fg(time.short, tr_color(\"#396\")), size: 9, width: 50, margin_top: 4) if time\n p1.hover{b.show}\n p1.leave{b.hide}\n end\n end",
"def flag_mouse_over_tag_options(object, options={})\n {:onmouseover => \"$('#{flag_link_dom_id(object)}').show();\",\n :onmouseout => \"$('#{flag_link_dom_id(object)}').hide();\"}.merge(options)\n end",
"def mouse_pressed(componentName, o1 = nil, o2 = nil, o3 = nil, o4 = nil, o5 = nil)\n $marathon.notSupported('Use webdriver directly to perform a mouse_pressed event')\nend",
"def newOverlay _obj, _args\n \"_obj newOverlay _args;\" \n end",
"def hover_provider\n attributes.fetch(:hoverProvider)\n end",
"def onGroupIconOverEnter _args\n \"onGroupIconOverEnter _args;\" \n end",
"def action(name, altname=nil, &block) \n Runner.instance.add_action name, altname, &block\n end",
"def react_to *args; end",
"def get_linked_custom_name( name )\n h.link_to( \"#{name}\", meeting_show_full_path(id: object.id), { 'data-toggle'=>'tooltip', 'title'=>I18n.t('meeting.show_results_tooltip') } )\n end",
"def click(name, tag)\n within(SELECTOR_MAPPING[TOOLBAR_EDITOR]['Components']['items'][SELECTOR], visible: true) do\n find(SELECTOR_MAPPING[TOOLBAR_EDITOR][name][tag][SELECTOR], visible: true).click\n end\n end",
"def draw_flyover(locator, options = {})\n attribute_name = options.fetch(:attribute, 'title')\n offset_x = options.fetch(:offset_x, 5)\n offset_y = options.fetch(:offset_y, 15)\n from_last_pos = options.fetch(:from_last_pos, false)\n draw_symbol = options.fetch(:draw_symbol, false)\n\n symbol_id = random_id\n tooltip_id = random_id\n\n execute_script(%(\n var element = arguments[0];\n if (! window.rudraTooltipSymbol) {\n window.rudraTooltipSymbol = 9311;\n }\n if (! window.rudraTooltipLastPos) {\n window.rudraTooltipLastPos = { x: 0, y: 0 };\n }\n var rect = element.getBoundingClientRect();\n var title = element.getAttribute(\"#{attribute_name}\") || 'N/A';\n var left = window.scrollX + rect.left;\n var top = window.scrollY + rect.top;\n if (#{draw_symbol}) {\n window.rudraTooltipSymbol++;\n var symbol = document.createElement('div');\n symbol.id = \"#{symbol_id}\";\n symbol.textContent = String.fromCharCode(rudraTooltipSymbol);\n symbol.style.color = '#f00';\n symbol.style.display = 'block';\n symbol.style.fontSize = '12px';\n symbol.style.left = (left - 12) + 'px';\n symbol.style.position = 'absolute';\n symbol.style.top = top + 'px';\n symbol.style.zIndex = '99999';\n document.body.appendChild(symbol);\n }\n var tooltip = document.createElement('div');\n tooltip.id = \"#{tooltip_id}\";\n tooltip.textContent = (#{draw_symbol}) ?\n String.fromCharCode(rudraTooltipSymbol) + \" \" + title : title;\n tooltip.style.position = 'absolute';\n tooltip.style.color = '#000';\n tooltip.style.backgroundColor = '#F5FCDE';\n tooltip.style.border = '3px solid #f00';\n tooltip.style.fontSize = '12px';\n tooltip.style.zIndex = '99999';\n tooltip.style.display = 'block';\n tooltip.style.height = '16px';\n tooltip.style.padding = '2px';\n tooltip.style.verticalAlign = 'middle';\n tooltip.style.top = ((#{from_last_pos}) ?\n window.rudraTooltipLastPos.y : (top + #{offset_y})) + 'px';\n tooltip.style.left = ((#{from_last_pos}) ?\n window.rudraTooltipLastPos.x : (left + #{offset_x})) + 'px';\n document.body.appendChild(tooltip);\n if (tooltip.scrollHeight > tooltip.offsetHeight) {\n \ttooltip.style.height = (tooltip.scrollHeight + 3) + 'px';\n }\n var lastPos = tooltip.getBoundingClientRect();\n window.rudraTooltipLastPos = {\n x: window.scrollX + lastPos.left, y: window.scrollY + lastPos.bottom\n };\n return;\n ), find_element(locator))\n\n find_element(\"id=#{tooltip_id}\")\n end",
"def initialize(args=nil)\n Interactive << self\n @viewport = Viewport.new(0,0,0,0)\n @inner = Rect.new\n @inner >> @viewport\n @name = args.delete(:name) if args && args[:name]\n set_parent(args.delete(:parent)) if args && args[:parent]\n @style = Style.new\n @style.css_match(self)\n set(args, false)\n initialize_intern_components\n compute\n end",
"def mouse_release *args\n\t\t\tevent(:mouse_release, *args)\n\t\tend",
"def method_missing(stylename, &styles)\n properties = Limelight.new(&styles).styles\n style(stylename, properties)\n end",
"def mouse_over(&block)\n self.listen_to :event => :mouseover do |script|\n script << \"mouse_location = last_mouse_location;\"\n\n yield script, :mouse_location\n end\n end",
"def host( *args )\n props = args.last.is_a?( Hash ) && args.pop || {}\n name = args.first.is_a?( String ) && args.shift\n props = props.merge( name: name ) if name\n raise \"Missing required name parameter\" unless props[ :name ]\n host = @hosts[ props[ :name ] ] ||= Host.new( self )\n host.merge_props( props )\n host.add( *args )\n host\n end",
"def link_to_function(name, *args, &block)\n html_options = args.last.is_a?(Hash) ? args.pop : {}\n html_options[:href] ||= args.first# if args.first.is_a? Hash\n core_link_to_function(name, args, html_options, &block)\n end",
"def attach_symname_button(name, ivar_name, tooltip_text = nil)\n\t\tself.attach_label('Name', tooltip_text)\n\t\tw = Gtk::Button.new #(:label => 'OpAmp.sym')\n\t\tw.tooltip_text = tooltip_text\n\t\tw.hexpand = true\n\t\t@grid.attach(w, 1, @row, 1, 1)\n\t\t@row += 1\n\t\treturn w\n\tend",
"def hook(name, *args)\n name = ('hook_' + name.to_s).to_sym\n send name, *args if respond_to? name\n end",
"def highlight name, &block\n @nodes << HighlightNode.new(name)\n @nodes.last.instance_eval(&block)\n end",
"def drawLink _obj, _args\n \"_obj drawLink _args;\" \n end",
"def mouse_over_element(element)\n driver.action.move_to(element).perform\n end",
"def invoke(name, args)\n\t\tself.class.invoke_instance_method(self, name, args)\n\tend",
"def link_to_icon(name, *args, &block)\n name = name.is_a?(Symbol) ? \"icon-#{name.to_s.dasherize}\" : name\n icon = content_tag(:i, '', class: name)\n link_to(icon, *args, &block).html_safe\n end",
"def mouse_released(componentName, o1 = nil, o2 = nil, o3 = nil, o4 = nil, o5 = nil)\n $marathon.notSupported('Use webdriver directly to perform a mouse_released event')\nend",
"def loginza_button_tag(*args, &block)\n if block_given?\n callback_url = args.first\n options = args.second || {}\n html_options = args.third\n\n loginza_button_tag(capture(&block), callback_url, options, html_options)\n else\n name = args[0]\n callback_url = args[1]\n options = args[2] || {}\n html_options = args[3] || {}\n\n html_options[:class] ||= \"loginza\"\n url = generate_url(callback_url, options)\n\n html = \"\"\n html << javascript_include_tag(\"http://s1.loginza.ru/js/widget.js\")\n html << link_to(name, url, options, html_options)\n html\n end\n end",
"def slider name, *args\n args = _apply_field_defaults(args)\n options = args.extract_options!\n out = ''.html_safe\n\n field_wrapper :slider, name do\n out.concat label(name, options[:label]) if options[:label]\n out.concat @template.content_tag :div, '', class: 'slider-edit'\n out.concat hidden(name)\n end\n end",
"def add_alias(name, action, args)\n\t\t\t@aliases[name] = { :action => action, :args => args }\n\t\tend",
"def at_css(*args); end",
"def at_css(*args); end",
"def callback(widget)\n # Display the 'label' property of the widget.\n # Refer to the API reference for more information.\n puts \"Hello again - #{widget.label}(#{widget}) was pressed.\"\nend",
"def initialize(name, master, position, dimensions, text = '', on_click = nil, hover = true)\n super(name, master, position, Layers::UI)\n @dimensions = dimensions\n\n @color_fg = 0xff_000000\n @color_bg = 0xff_ffffff\n\n @state = 0\n\n @font = Gosu::Font.new(50)\n @text = text\n @enabled = true\n @hover = hover\n\n # * This allows an event handler to operate on this button. Rather than defining it within the object itself, it is assigned a\n # * function that it calls upon achieving the state.\n @click = on_click\n @collider = Collider.new(master, position, dimensions, [])\n self\n end",
"def render_widget!(type, id, *args)\n self << widget(type, id, *args)\n render_widget id, :display\n end",
"def mouse_over_element(element)\r\n @driver.action.move_to(element).perform\r\nend",
"def method_missing(name, *args)\n if @c_window.respond_to? name.to_s\n @c_window.send name.to_s, *args\n else\n super\n end\n end",
"def _gestalt_call_tag(name, args, &block)\n if args.size == 1 and args[0].kind_of? Hash\n # args are just attributes, children in block...\n _gestalt_build_tag name, args[0], &block\n elsif args[1].kind_of? Hash\n # args are text and attributes ie. a('mylink', :href => '/mylink')\n _gestalt_build_tag(name, args[1], args[0], &block)\n else\n # no attributes, but text\n _gestalt_build_tag name, {}, args, &block\n end\n end",
"def b(*args)\n JButton.new *args\n end",
"def ppEffectCreate _args\n \"ppEffectCreate _args;\" \n end",
"def share(name)\n name_li(name).button(:title=>\"Share content\").click\n self.wait_until { self.text.include? \"Or, share it on a webservice:\" }\n self.class.class_eval { include ShareWithPopUp }\n end",
"def game_over(name)\n end",
"def _entry_2_xscrollcommand(*args)\n\n end",
"def hover(file, line, col); end",
"def hover(file, line, col); end",
"def ctrlFade _args\n \"ctrlFade _args;\" \n end",
"def method_missing(name, *args)\n if @colours.include? name\n \"#{@colours[name]}#{args[0]}\\033[0m\"\n else\n \"#{@default}#{args[0]}\\033[0m\"\n end\n end",
"def _button_2_command(*args)\n\n end",
"def _button_2_command(*args)\n\n end",
"def method_missing(name, *args)\n start(name.to_s)\n end",
"def update\n \n if(isOverButton)\n @hover = true\n else\n @hover = false\n end\n \n if(@clicked)\n @clicked = false\n @hover = false\n return true\n end\n \n return false\n end"
] |
[
"0.59003514",
"0.5877121",
"0.5668789",
"0.5668789",
"0.559635",
"0.548851",
"0.5447665",
"0.54334414",
"0.540149",
"0.53910315",
"0.5373412",
"0.5340327",
"0.5338084",
"0.5295968",
"0.52948105",
"0.52810556",
"0.5279943",
"0.5199232",
"0.51675224",
"0.5116657",
"0.50699365",
"0.5051806",
"0.50267327",
"0.5012189",
"0.49885437",
"0.4974387",
"0.49672285",
"0.4918908",
"0.48905095",
"0.48819974",
"0.485081",
"0.48482445",
"0.47992623",
"0.47854993",
"0.47702438",
"0.47625345",
"0.47621235",
"0.47306237",
"0.47256193",
"0.47236234",
"0.47186",
"0.46994185",
"0.46920055",
"0.4665776",
"0.46599993",
"0.46478727",
"0.45965043",
"0.45951244",
"0.4588334",
"0.45868558",
"0.45714125",
"0.45615405",
"0.4555868",
"0.45444953",
"0.45374644",
"0.45368633",
"0.45263076",
"0.45223114",
"0.44812545",
"0.44793242",
"0.44773087",
"0.44695893",
"0.4467809",
"0.446609",
"0.4459374",
"0.44591737",
"0.4458404",
"0.4441462",
"0.44382676",
"0.44380262",
"0.44335264",
"0.4430251",
"0.44245216",
"0.44146603",
"0.4414404",
"0.44143957",
"0.44140863",
"0.44035667",
"0.4401223",
"0.43966177",
"0.43966177",
"0.439243",
"0.43878",
"0.43877393",
"0.43875524",
"0.43846273",
"0.43795294",
"0.43761444",
"0.43721038",
"0.43615776",
"0.43563974",
"0.4354276",
"0.4353371",
"0.4353371",
"0.43505245",
"0.43493897",
"0.434908",
"0.434908",
"0.43471628",
"0.43284082"
] |
0.90037346
|
0
|
Double clicks the widget defined by +name+ and optional +args+.
|
def double_click(name, *args)
widget(name, *args).double_click
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def right_click(name, *args)\n widget(name, *args).right_click\n end",
"def doubleclick(componentName, o1 = nil, o2 = nil, o3 = nil, o4 = nil)\n $marathon.click(componentName, false, 2, o1, o2, o3, o4)\nend",
"def double_click(*args)\n case args.length\n when 1 then click_image(args[0], true)\n when 2 then click_point(args[0], args[1], true)\n else raise ArgumentError\n end\n end",
"def doubleclick(componentName, o1 = nil, o2 = nil, o3 = nil, o4 = nil)\n $marathon.click(componentName, false, 2, o1, o2, o3, o4)\nend",
"def onDoubleClick _obj, _args\n \"_obj onDoubleClick _args;\" \n end",
"def double_click locator\r\n command 'doubleClick', locator\r\n end",
"def doubleclick(btn = 'left')\n compatible_call :doubleclick, btn\n end",
"def doubleClick\n\t@selenium.double_click(@locator)\n end",
"def double_click obj = nil, wait = 0.2\n move_mouse_to obj, wait: 0 if obj\n Mouse.double_click\n sleep wait\n end",
"def double_click(element = T.unsafe(nil), device: T.unsafe(nil)); end",
"def double_click_at locator, coord_string\r\n command 'doubleClickAt', locator, coord_string\r\n end",
"def dClick\n doubleClick(waitForObject(@symbolicName))\n Log.AppendLog(@@logCmd.dClick(self))\n end",
"def double_click_button_inside_frame(browser_handle, frame_prop, frame_prop_val, button_prop, button_prop_val)\n browser_handle.frame(frame_prop.intern, /#{frame_prop_val}/).button(button_prop.intern, /#{button_prop_val}/).fire_event(\"ondblclick\")\nend",
"def tripleclick(btn = 'left')\n compatible_call :doubleclick, btn\n end",
"def onLButtonDoubleClick(flags, x, y, view)\n end",
"def double_click_on(object)\n page.driver.browser.mouse.double_click(object.native)\n end",
"def hover_click(*args)\n if args.size == 1\n driver.action.click(element).perform\n else\n sym,id = args\n driver.action.click(driver.find_element(sym.to_sym,id)).perform\n end\n\n end",
"def rightclick(componentName, o1 = nil, o2 = nil, o3 = nil, o4 = nil, o5 = nil)\n $marathon.click(componentName, true, o1, o2, o3, o4, o5)\nend",
"def double_click(element_name)\n begin\n $driver.action.double_click(el(element_name)).perform\n rescue Exception => e\n $LOG.error \"error in perform double click on element \\n element name : #{element_name} \"+e.message\n $driver.save_screenshot(\"log/webscreenshot/webScreenshot_#{$webscreenshot}.png\")\n $webscreenshot = $webscreenshot+1\n raise \"error in perform double click on element \\n element name : #{element_name} \"+e.message\n end\n end",
"def rightclick(componentName, o1 = nil, o2 = nil, o3 = nil, o4 = nil, o5 = nil)\n $marathon.click(componentName, true, o1, o2, o3, o4, o5)\nend",
"def double_click(locator, offset = {})\n x = offset.fetch(:x, 0)\n y = offset.fetch(:y, 0)\n\n element = find_element(locator)\n\n action\n .move_to(element, x, y)\n .double_click\n .perform\n end",
"def double_click()\n double_click_at :center, :center\n end",
"def double_click_button(browser_handle, property, property_value)\n browser_handle.button(property.intern, /#{property_value}/).fire_event(\"ondblclick\")\nend",
"def double_click_button_with_popup_inside_frame(browser_handle, frame_prop, frame_prop_val, button_prop, button_prop_val)\n browser_handle.frame(frame_prop.intern, /#{frame_prop_val}/).button(button_prop.intern, /#{button_prop_val}/).fire_event_no_wait(\"ondblclick\")\nend",
"def click(*args)\n\t\t\t# if no argument has been provided, click on the\n\t\t\t# window itself\n\t\t\th = (args.length == 0) ? @handle : child(args[0]).handle\n\t\t\t\n\t\t\trectangle = [0, 0, 0, 0].pack 'LLLL'\n\t\t\tget_window_rect h, rectangle\n\t\t\tleft, top, right, bottom = rectangle.unpack 'LLLL'\n\t\t\t\n\t\t\tcenter = [(left + right) / 2, (top + bottom) / 2]\n\t\t\tset_cursor_pos *center\n\t\t\t\n\t\t\tmouse_event MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0\n\t\t\tmouse_event MOUSEEVENTF_LEFTUP, 0, 0, 0, 0\n\t\tend",
"def click_point(x, y, is_double = false)\n if is_double\n @java_obj.doubleClick(org.sikuli.script::Location.new(x, y).offset(x(), y()), 0)\n else\n @java_obj.click(org.sikuli.script::Location.new(x, y).offset(x(), y()), 0)\n end\n end",
"def onRButtonDoubleClick(flags, x, y, view)\n end",
"def doubleclick(btn)\n not_supported \"anything other than left clicking\" unless btn == 'left'\n execute_applescript(%Q`\n tell application \"Extra Suites\"\n ES click mouse with double click\n end tell\n `)\n end",
"def double_click_image_inside_frame(browser_handle, frame_prop, frame_prop_val, image_prop, image_prop_val)\n browser_handle.frame(frame_prop.intern, /#{frame_prop_val}/).image(image_prop.intern, /#{image_prop_val}/).fire_event(\"ondblclick\")\nend",
"def triple_click obj = nil, wait = 0.2\n move_mouse_to obj, wait: 0 if obj\n Mouse.triple_click\n sleep wait\n end",
"def click(name, tag)\n click_on_button(name, tag, @klass)\n end",
"def click; end",
"def click; end",
"def click; end",
"def click(componentName, o1 = nil, o2 = nil, o3 = nil, o4 = nil, o5 = nil)\n $marathon.click(componentName, false, o1, o2, o3, o4, o5)\nend",
"def click(componentName, o1 = nil, o2 = nil, o3 = nil, o4 = nil, o5 = nil)\n $marathon.click(componentName, false, o1, o2, o3, o4, o5)\nend",
"def double_click?(btn)\n @dbl_click[btn]\n end",
"def click()\n mouse_down\n mouse_up\n stall :click\n end",
"def double_click_image_with_popup_inside_frame(browser_handle, frame_prop, frame_prop_val, image_prop, image_prop_val)\n browser_handle.frame(frame_prop.intern, /#{frame_prop_val}/).image(image_prop.intern, /#{image_prop_val}/).fire_event_no_wait(\"ondblclick\")\nend",
"def clicked(e)\n \n end",
"def double_click_button_with_popup(browser_handle, property, property_value)\n browser_handle.button(property.intern, /#{property_value}/).fire_event_no_wait(\"ondblclick\")\nend",
"def click\n raise \"Must implement custom click method.\"\n end",
"def clicked(mouse_event)\n end",
"def widget(name, *args)\n eventually { document.widget(name, *args) }\n end",
"def force_click(*args)\n elems = make_list_from_nested(args)\n\n elems.each do |elem|\n click_types(elem, DEFAULT_CLICK_TYPES)\n end\n end",
"def click_button_with_name(name, opts={})\r\n find_element(:name, name).click\r\n end",
"def unclicked(e)\n puts \"Unclicked!\"\n end",
"def click_on(*args, context: page)\n label = self.class.labels[args[0]] # attempt to get the label\n context = context.element if context.respond_to? :element\n label.present? ? context.click_on(label) : context.click_on(*args)\n end",
"def mouse_up *args; end",
"def trackClick(selector, *args)\n raise 'Not enough arguments' if args.empty?\n raise 'Too many arguments' if args.size > 2\n\n queue << ['trackClick', selector, *args]\n end",
"def mouse_down locator\r\n command 'mouseDown', locator\r\n end",
"def mouse_down locator\r\n command 'mouseDown', locator\r\n end",
"def clicked;end",
"def double_click_div(browser_handle, property, property_value)\n browser_handle.div(property.intern, /#{property_value}/).fire_event(\"ondblclick\")\nend",
"def click\r\n start_point = screen.find ident\r\n click_x = start_point.x + offset_x\r\n click_y = start_point.y + offset_y\r\n\r\n screen.click click_x, click_y\r\n end",
"def double_click_tree(tree, *path)\n path = tree_path(path_elements)\n append_to_script \"double_click_tree \\\"#{tree}\\\",#{path}\"\n end",
"def onClick(block=nil)\n @gtkEvent.signal_connect(\"button_release_event\") { |_, event|\n isClick(event.x.truncate,event.y.truncate)\n }\n end",
"def run_widget_hook(name, *args)\n self.class.callbacks_for_hook(name).each { |blk| instance_exec(*args, &blk) }\n end",
"def click_and_hold(element = T.unsafe(nil), button: T.unsafe(nil), device: T.unsafe(nil)); end",
"def click\n @clicked_x = @x\n @clicked_y = @y\n fire(:click, @clicked_x, @clicked_y)\n end",
"def click\n Log.Trace(\"Clicking on #{@symbolicName}\")\n mouseClick(waitForObject(@symbolicName))\n Log.AppendLog(@@logCmd.click(self))\n end",
"def mouse_release *args\n\t\t\tevent(:mouse_release, *args)\n\t\tend",
"def _button_2_command(*args)\n\n end",
"def _button_2_command(*args)\n\n end",
"def click locator\r\n command 'click', locator\r\n end",
"def click locator\r\n command 'click', locator\r\n end",
"def double_click_div_with_popup(browser_handle, property, property_value)\n browser_handle.div(property.intern, /#{property_value}/).fire_event_no_wait(\"ondblclick\")\nend",
"def on_click(elem)\n elem.fire_event('onClick')\n end",
"def click obj = nil, wait = 0.2\n move_mouse_to obj, wait: 0 if obj\n Mouse.click_down\n yield if block_given?\n ensure\n Mouse.click_up\n sleep wait\n end",
"def mouse_press *args\n\t\t\tevent(:mouse_press, *args)\n\t\tend",
"def click(id)\n\t\t\th = child(id).handle\n\t\t\t\n\t\t\trectangle = [0, 0, 0, 0].pack 'LLLL'\n\t\t\tget_window_rect h, rectangle\n\t\t\tleft, top, right, bottom = rectangle.unpack 'LLLL'\n\t\t\t\n\t\t\tcenter = [(left + right) / 2, (top + bottom) / 2]\n\t\t\tset_cursor_pos *center\n\t\t\t\n\t\t\tmouse_event MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0\n\t\t\tmouse_event MOUSEEVENTF_LEFTUP, 0, 0, 0, 0\n\t\tend",
"def click_image(filename, is_double = false)\n begin\n if is_double\n @java_obj.doubleClick(filename, 0)\n else\n @java_obj.click(filename, 0)\n end\n rescue NativeException => e\n raise_exception e, filename\n end\n end",
"def right_click()\n right_mouse_down\n right_mouse_up\n stall :right_click\n end",
"def mouse_down_at locator, coord_string\r\n command 'mouseDownAt', locator, coord_string\r\n end",
"def unclicked(mouse_event)\n end",
"def onClick(dialog, which)\n end",
"def _button_3_command(*args)\n\n end",
"def on_click\n\t\tend",
"def click\n @mech.click self\n end",
"def mousedown(btn = 'left')\n compatible_call :mousedown, btn\n end",
"def _button_4_command(*args)\n\n end",
"def click_mouse(button)\n XDo::FFILib.xdo_click @_xdo_pointer, @_window, button\n end",
"def click_element(element_label, **options)\n if options.empty?\n send(element_label).click\n else\n send(element_label, **options).click\n end\n end",
"def button_down(id); end",
"def click_button(button = T.unsafe(nil)); end",
"def button_down(id)\n fire :button_down, id\n end",
"def click_at locator, coord_string\r\n command 'clickAt', locator, coord_string\r\n end",
"def double_click_list(list, row_index)\n append_to_script \"double_click_list \\\"#{list}\\\" , \\\"#{row_index}\\\"\"\n end",
"def tripleclick(btn)\n not_supported \"anything other than left clicking\" unless btn == 'left'\n execute_applescript(%Q`\n tell application \"Extra Suites\"\n ES click mouse\n ES click mouse\n ES click mouse\n end tell\n `)\n end",
"def click_with_index(value)\n # NO-OP\n end",
"def click_on(id, x, y)\n # Get the position of this window id\n position = get_position(id)\n # Add the [x, y] passed in by get_position to our x and y\n x += position[0]\n y += position[1]\n # Move the mouse to (x, y), then click\n xdotool \"mousemove #{x} #{y}\"\n xdotool \"click 1\"\n # sleep $sleep_time\nend",
"def fireAtTarget _obj, _args\n \"_obj fireAtTarget _args;\" \n end",
"def toggle_click(name, tag, state = true)\n toggle_click_on_button(name, tag, @klass, state)\n end",
"def _entry_2_xscrollcommand(*args)\n\n end",
"def update\n @prev_down = @down.clone\n @down = @next_down.clone\n @next_down.delete_if { |_, v| v.zero? }\n @dbl_click.clear\n\n if @click\n @click[:action].call\n @click = nil\n end\n\n @dbl_click_timer.each do |k, v|\n if v < G.double_click_delay\n @dbl_click_timer[k] += 1\n else\n @dbl_click_timer.delete(k)\n end\n end\n\n %i[left middle right].each do |key|\n if @down[key]\n @dbl_click[key] = true if @dbl_click_timer[key]\n @dbl_click_timer.delete(key)\n elsif @prev_down[key]\n @dbl_click_timer[key] = 0\n end\n end\n\n @x = G.window.mouse_x.round\n @y = G.window.mouse_y.round\n end",
"def hover(name, *args)\n widget(name, *args).hover\n end",
"def click_action\n raise NotImplementedError \"Subclasses must implement this method\"\n end",
"def click(name, tag)\n within(@page_container_list, text: @description) do\n case name.downcase\n when 'edit', 'delete'\n click_on_button('Action', 'button', OBJECTIVE)\n self.send(\"wait_until_#{SELECTOR_MAPPING[OBJECTIVE]['Action']['dropdown'][ELEMENT]}_visible\")\n self.send(\"#{SELECTOR_MAPPING[OBJECTIVE]['Action']['section'][ELEMENT]}\").send(name.downcase)\n else\n click_on_button(name, tag, OBJECTIVE)\n end\n end\n end",
"def double_click_table_row(table, row_index)\n append_to_script \"double_click_table_row \\\"#{table}\\\" , \\\"#{row_index}\\\"\"\n end",
"def widgets(name, *args)\n document.widgets(name, *args)\n end"
] |
[
"0.75034124",
"0.7450685",
"0.7434601",
"0.7431053",
"0.735549",
"0.7069308",
"0.68412656",
"0.6669535",
"0.6624832",
"0.65474355",
"0.6547266",
"0.64397454",
"0.63531953",
"0.63485444",
"0.63150084",
"0.63038003",
"0.61704737",
"0.61327314",
"0.6113735",
"0.61123866",
"0.6111024",
"0.6058064",
"0.6046252",
"0.60105336",
"0.5956845",
"0.59100866",
"0.59099936",
"0.5877469",
"0.5875173",
"0.5856515",
"0.58226985",
"0.580272",
"0.580272",
"0.580272",
"0.5768016",
"0.5752165",
"0.5726303",
"0.5720768",
"0.57066035",
"0.56615716",
"0.5655758",
"0.56500137",
"0.56442904",
"0.5615995",
"0.5593897",
"0.5586649",
"0.55633533",
"0.5541331",
"0.55347866",
"0.5519068",
"0.55155474",
"0.55155474",
"0.5504744",
"0.5484311",
"0.54694325",
"0.54443145",
"0.54380774",
"0.5426853",
"0.53904855",
"0.53842354",
"0.53717184",
"0.53537005",
"0.53376764",
"0.53376764",
"0.5332059",
"0.5332059",
"0.53084683",
"0.5296383",
"0.52875555",
"0.5274298",
"0.525931",
"0.5242606",
"0.5226934",
"0.51324457",
"0.51251537",
"0.5119306",
"0.5115123",
"0.5098229",
"0.5043804",
"0.5035191",
"0.50158995",
"0.5004666",
"0.50038177",
"0.49947423",
"0.499062",
"0.49889156",
"0.49746156",
"0.49740875",
"0.49692923",
"0.49509278",
"0.49507824",
"0.49154958",
"0.49142754",
"0.4912109",
"0.49018323",
"0.48992914",
"0.48968026",
"0.48869577",
"0.4871215",
"0.4858123"
] |
0.916154
|
0
|
Right clicks the widget defined by +name+ and optional +args+.
|
def right_click(name, *args)
widget(name, *args).right_click
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def double_click(name, *args)\n widget(name, *args).double_click\n end",
"def rightclick(componentName, o1 = nil, o2 = nil, o3 = nil, o4 = nil, o5 = nil)\n $marathon.click(componentName, true, o1, o2, o3, o4, o5)\nend",
"def rightclick(componentName, o1 = nil, o2 = nil, o3 = nil, o4 = nil, o5 = nil)\n $marathon.click(componentName, true, o1, o2, o3, o4, o5)\nend",
"def click(*args)\n\t\t\t# if no argument has been provided, click on the\n\t\t\t# window itself\n\t\t\th = (args.length == 0) ? @handle : child(args[0]).handle\n\t\t\t\n\t\t\trectangle = [0, 0, 0, 0].pack 'LLLL'\n\t\t\tget_window_rect h, rectangle\n\t\t\tleft, top, right, bottom = rectangle.unpack 'LLLL'\n\t\t\t\n\t\t\tcenter = [(left + right) / 2, (top + bottom) / 2]\n\t\t\tset_cursor_pos *center\n\t\t\t\n\t\t\tmouse_event MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0\n\t\t\tmouse_event MOUSEEVENTF_LEFTUP, 0, 0, 0, 0\n\t\tend",
"def doubleclick(componentName, o1 = nil, o2 = nil, o3 = nil, o4 = nil)\n $marathon.click(componentName, false, 2, o1, o2, o3, o4)\nend",
"def doubleclick(componentName, o1 = nil, o2 = nil, o3 = nil, o4 = nil)\n $marathon.click(componentName, false, 2, o1, o2, o3, o4)\nend",
"def hover_click(*args)\n if args.size == 1\n driver.action.click(element).perform\n else\n sym,id = args\n driver.action.click(driver.find_element(sym.to_sym,id)).perform\n end\n\n end",
"def double_click(*args)\n case args.length\n when 1 then click_image(args[0], true)\n when 2 then click_point(args[0], args[1], true)\n else raise ArgumentError\n end\n end",
"def onDoubleClick _obj, _args\n \"_obj onDoubleClick _args;\" \n end",
"def click\n raise \"Must implement custom click method.\"\n end",
"def click; end",
"def click; end",
"def click; end",
"def right_click()\n right_mouse_down\n right_mouse_up\n stall :right_click\n end",
"def double_click locator\r\n command 'doubleClick', locator\r\n end",
"def right_click(locator, offset = {})\n x = offset.fetch(:x, 0)\n y = offset.fetch(:y, 0)\n\n element = find_element(locator)\n action.move_to(element, x, y).context_click.perform\n end",
"def _button_2_command(*args)\n\n end",
"def _button_2_command(*args)\n\n end",
"def click(componentName, o1 = nil, o2 = nil, o3 = nil, o4 = nil, o5 = nil)\n $marathon.click(componentName, false, o1, o2, o3, o4, o5)\nend",
"def click locator\r\n command 'click', locator\r\n end",
"def click locator\r\n command 'click', locator\r\n end",
"def click(componentName, o1 = nil, o2 = nil, o3 = nil, o4 = nil, o5 = nil)\n $marathon.click(componentName, false, o1, o2, o3, o4, o5)\nend",
"def click_button_with_name(name, opts={})\r\n find_element(:name, name).click\r\n end",
"def click_on(*args, context: page)\n label = self.class.labels[args[0]] # attempt to get the label\n context = context.element if context.respond_to? :element\n label.present? ? context.click_on(label) : context.click_on(*args)\n end",
"def click(name, tag)\n click_on_button(name, tag, @klass)\n end",
"def clicked(mouse_event)\n end",
"def clicked(e)\n \n end",
"def click\r\n start_point = screen.find ident\r\n click_x = start_point.x + offset_x\r\n click_y = start_point.y + offset_y\r\n\r\n screen.click click_x, click_y\r\n end",
"def doubleclick(btn = 'left')\n compatible_call :doubleclick, btn\n end",
"def click(btn = 'left')\n compatible_call :click, btn\n end",
"def clicked;end",
"def onClick(block=nil)\n @gtkEvent.signal_connect(\"button_release_event\") { |_, event|\n isClick(event.x.truncate,event.y.truncate)\n }\n end",
"def click(id)\n\t\t\th = child(id).handle\n\t\t\t\n\t\t\trectangle = [0, 0, 0, 0].pack 'LLLL'\n\t\t\tget_window_rect h, rectangle\n\t\t\tleft, top, right, bottom = rectangle.unpack 'LLLL'\n\t\t\t\n\t\t\tcenter = [(left + right) / 2, (top + bottom) / 2]\n\t\t\tset_cursor_pos *center\n\t\t\t\n\t\t\tmouse_event MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0\n\t\t\tmouse_event MOUSEEVENTF_LEFTUP, 0, 0, 0, 0\n\t\tend",
"def mouse_up *args; end",
"def force_click(*args)\n elems = make_list_from_nested(args)\n\n elems.each do |elem|\n click_types(elem, DEFAULT_CLICK_TYPES)\n end\n end",
"def onClick(dialog, which)\n end",
"def _button_3_command(*args)\n\n end",
"def click()\n mouse_down\n mouse_up\n stall :click\n end",
"def onLButtonDoubleClick(flags, x, y, view)\n end",
"def click_action\n raise NotImplementedError \"Subclasses must implement this method\"\n end",
"def mouse_press *args\n\t\t\tevent(:mouse_press, *args)\n\t\tend",
"def on_click(elem)\n elem.fire_event('onClick')\n end",
"def click\n `#{@el}.click() || Opal.nil`\n end",
"def run_widget_hook(name, *args)\n self.class.callbacks_for_hook(name).each { |blk| instance_exec(*args, &blk) }\n end",
"def click(name, tag)\n within(SELECTOR_MAPPING[TOOLBAR_EDITOR]['Components']['items'][SELECTOR], visible: true) do\n find(SELECTOR_MAPPING[TOOLBAR_EDITOR][name][tag][SELECTOR], visible: true).click\n end\n end",
"def onClick(block=nil)\n return unless block_given?\n @gtkObject.signal_connect(\"button_release_event\") { |_, event|\n if event.button==Click::LEFT\n yield\n end\n }\n end",
"def tripleclick(btn = 'left')\n compatible_call :doubleclick, btn\n end",
"def click\n @clicked_x = @x\n @clicked_y = @y\n fire(:click, @clicked_x, @clicked_y)\n end",
"def double_click_on(object)\n page.driver.browser.mouse.double_click(object.native)\n end",
"def _button_4_command(*args)\n\n end",
"def click\n Log.Trace(\"Clicking on #{@symbolicName}\")\n mouseClick(waitForObject(@symbolicName))\n Log.AppendLog(@@logCmd.click(self))\n end",
"def invoke(name, *args, **keywords, &blk)\n window.send(name, *args, **keywords, &blk)\n end",
"def click(btn)\n not_supported \"anything other than left clicking\" unless btn == 'left'\n execute_applescript(%Q`\n tell application \"Extra Suites\"\n ES click mouse\n end tell\n `)\n end",
"def double_click_at locator, coord_string\r\n command 'doubleClickAt', locator, coord_string\r\n end",
"def onRButtonDoubleClick(flags, x, y, view)\n end",
"def widget(name, *args)\n eventually { document.widget(name, *args) }\n end",
"def opera_action(name, *args)\n driver.operaAction(name, args.to_java(:string))\n end",
"def click_button(button = T.unsafe(nil)); end",
"def click\n p [ :app_click ]\n view.click\n end",
"def action\n trigger :click\n end",
"def doubleClick\n\t@selenium.double_click(@locator)\n end",
"def double_click obj = nil, wait = 0.2\n move_mouse_to obj, wait: 0 if obj\n Mouse.double_click\n sleep wait\n end",
"def click_point(x, y, is_double = false)\n if is_double\n @java_obj.doubleClick(org.sikuli.script::Location.new(x, y).offset(x(), y()), 0)\n else\n @java_obj.click(org.sikuli.script::Location.new(x, y).offset(x(), y()), 0)\n end\n end",
"def click\n `#@native.click()`\n end",
"def click_at locator, coord_string\r\n command 'clickAt', locator, coord_string\r\n end",
"def click\n @mech.click self\n end",
"def click obj = nil, wait = 0.2\n move_mouse_to obj, wait: 0 if obj\n Mouse.click_down\n yield if block_given?\n ensure\n Mouse.click_up\n sleep wait\n end",
"def on_click\n\t\tend",
"def click(name, tag)\n within(@page_container_list, text: @description) do\n case name.downcase\n when 'edit', 'delete'\n click_on_button('Action', 'button', OBJECTIVE)\n self.send(\"wait_until_#{SELECTOR_MAPPING[OBJECTIVE]['Action']['dropdown'][ELEMENT]}_visible\")\n self.send(\"#{SELECTOR_MAPPING[OBJECTIVE]['Action']['section'][ELEMENT]}\").send(name.downcase)\n else\n click_on_button(name, tag, OBJECTIVE)\n end\n end\n end",
"def double_click_button_inside_frame(browser_handle, frame_prop, frame_prop_val, button_prop, button_prop_val)\n browser_handle.frame(frame_prop.intern, /#{frame_prop_val}/).button(button_prop.intern, /#{button_prop_val}/).fire_event(\"ondblclick\")\nend",
"def mouse_down locator\r\n command 'mouseDown', locator\r\n end",
"def mouse_down locator\r\n command 'mouseDown', locator\r\n end",
"def click\n Vedeu.log(type: :input,\n message: \"Mouse pressed: '#{button}' (x: #{x}, y: #{y})\")\n\n if left_click?\n Vedeu.trigger(:_cursor_reposition_, Vedeu.focus, y, x)\n\n elsif wheel_up?\n Vedeu.trigger(:_cursor_up_, Vedeu.focus)\n\n elsif wheel_down?\n Vedeu.trigger(:_cursor_down_, Vedeu.focus)\n\n else\n Vedeu.log(type: :input,\n message: 'Vedeu does not support mouse button ' \\\n \"'#{button}' yet.\")\n\n end\n end",
"def unclicked(e)\n puts \"Unclicked!\"\n end",
"def mouse_release *args\n\t\t\tevent(:mouse_release, *args)\n\t\tend",
"def doubleclick(btn)\n not_supported \"anything other than left clicking\" unless btn == 'left'\n execute_applescript(%Q`\n tell application \"Extra Suites\"\n ES click mouse with double click\n end tell\n `)\n end",
"def triple_click obj = nil, wait = 0.2\n move_mouse_to obj, wait: 0 if obj\n Mouse.triple_click\n sleep wait\n end",
"def trackClick(selector, *args)\n raise 'Not enough arguments' if args.empty?\n raise 'Too many arguments' if args.size > 2\n\n queue << ['trackClick', selector, *args]\n end",
"def double_click(element = T.unsafe(nil), device: T.unsafe(nil)); end",
"def mousedown(btn = 'left')\n compatible_call :mousedown, btn\n end",
"def click_mouse(button)\n XDo::FFILib.xdo_click @_xdo_pointer, @_window, button\n end",
"def click\n `#@native.click()`\n self\n end",
"def rightClick?(object=nil,width=-1,height=-1)\n if object.nil?\n return Input.triggerex?(Input::Mouse_Left)\n else\n return (self.over?(object,width,height) && Input.triggerex?(Input::Mouse_Right))\n end\n end",
"def mouse_clicked(event)\n \n puts \"IN schemasTreeTable_mouse_clicked : #{event.inspect}\"\n puts \"MOUSE #{event.class} : #{event.getClickCount} : BUTTON #{event.getButton}\"\n\n # Double Click => EDIT\n if(event.getClickCount == 2)\n puts \"edit\"\n \n elsif( event.getButton == java.awt.event.MouseEvent::BUTTON3)\n \n transfer[:event] = event\n\n listener = PopupActionListener.new( self )\n\n items = [\"Select All\", \"Clear\"]\n\n listener.add_callback_method(\"Select All\", :select_all_action_performed )\n\n listener.add_callback(\"Clear\") do\n puts \"CLEAR SCHEMA SELECTION\"\n end\n\n pmenu = PopupMenuController.create_instance\n\n pmenu.open(event, items, listener )\n end\n end",
"def perform_action action_name, *args\n raise \"No such action #{action_name} defined for current page\" if !@current_page[:page_data].user_data['actions'].has_key?(action_name)\n # override locator from config file if needed\n if args[0].is_a?(Hash) and args[0].has_key?('locator')\n locator = args[0]['locator']\n else\n locator = @current_page[:page_data].user_data['actions'][action_name]['locator']\n end\n # search the entire dom or just under the current element\n if args[0].is_a?(Hash) and args[0].has_key?('root_search')\n dom = args[0]['root_search'].eql?(true) ? @driver : @element\n else\n dom = @driver\n end\n # perform the search\n @element = dom.find_element(locator)\n # json contains only a predefined set of instructions\n if action_name.include?('click')\n @element.click\n elsif action_name.include?('type')\n @element.send_keys args[0]\n elsif action_name.include?('submit')\n @element.submit\n elsif action_name.include?('inspect')\n @element\n else\n raise \"Don't know how to perform this action\"\n end\n # wait for a specific element or page to be present after the action\n wait_and_update @current_page[:page_data].user_data['actions'][action_name]['wait']\n end",
"def double_click(locator, offset = {})\n x = offset.fetch(:x, 0)\n y = offset.fetch(:y, 0)\n\n element = find_element(locator)\n\n action\n .move_to(element, x, y)\n .double_click\n .perform\n end",
"def click_element(element_label, **options)\n if options.empty?\n send(element_label).click\n else\n send(element_label, **options).click\n end\n end",
"def click_on_a_button(selector)\n\n click_button(selector)\n\n end",
"def click_with_index(value)\n # NO-OP\n end",
"def click_on(id, x, y)\n # Get the position of this window id\n position = get_position(id)\n # Add the [x, y] passed in by get_position to our x and y\n x += position[0]\n y += position[1]\n # Move the mouse to (x, y), then click\n xdotool \"mousemove #{x} #{y}\"\n xdotool \"click 1\"\n # sleep $sleep_time\nend",
"def open_menu_with_rightclick(element, menu_name)\n wait_start\n element.right_click\n wait_for_menu_shown(menu_name)\n end",
"def react_to *args; end",
"def dClick\n doubleClick(waitForObject(@symbolicName))\n Log.AppendLog(@@logCmd.dClick(self))\n end",
"def hover(name, *args)\n widget(name, *args).hover\n end",
"def click(&block)\n @clicks << block\n end",
"def action(name, altname=nil, &block) \n Runner.instance.add_action name, altname, &block\n end",
"def tripleclick(btn)\n not_supported \"anything other than left clicking\" unless btn == 'left'\n execute_applescript(%Q`\n tell application \"Extra Suites\"\n ES click mouse\n ES click mouse\n ES click mouse\n end tell\n `)\n end",
"def perform_action(*args)\n end",
"def action(*args,&block)\n name, options = _parse_name_and_options(args)\n command.action({:name=>name}.merge(options),&block)\n end",
"def double_click()\n double_click_at :center, :center\n end"
] |
[
"0.81100863",
"0.7150753",
"0.7143982",
"0.6974602",
"0.67703515",
"0.67618877",
"0.67600584",
"0.66718864",
"0.64862144",
"0.629425",
"0.6235374",
"0.6235374",
"0.6235374",
"0.6178716",
"0.6176475",
"0.6120835",
"0.6095269",
"0.6095269",
"0.60702384",
"0.60663825",
"0.60663825",
"0.6064417",
"0.6059166",
"0.604303",
"0.60175866",
"0.6009162",
"0.5992911",
"0.59898806",
"0.59861207",
"0.59608585",
"0.59569776",
"0.59511787",
"0.59364116",
"0.5906916",
"0.5857935",
"0.585776",
"0.5850802",
"0.58447754",
"0.58367807",
"0.58070076",
"0.5791821",
"0.57872623",
"0.57200253",
"0.571121",
"0.5679307",
"0.5660017",
"0.56574947",
"0.5630044",
"0.56171286",
"0.560715",
"0.5605776",
"0.55995977",
"0.5589635",
"0.5585761",
"0.55774844",
"0.55652153",
"0.5559198",
"0.5557046",
"0.55397964",
"0.55390894",
"0.5532239",
"0.55304575",
"0.55257076",
"0.5512547",
"0.54867977",
"0.547489",
"0.5471451",
"0.54625183",
"0.5462327",
"0.54577255",
"0.5449926",
"0.5449926",
"0.54458237",
"0.54457575",
"0.54440916",
"0.54387677",
"0.5431671",
"0.54209733",
"0.5372545",
"0.536539",
"0.53643304",
"0.53634655",
"0.5355745",
"0.53541684",
"0.5344608",
"0.534438",
"0.53439575",
"0.5330921",
"0.5329621",
"0.5328701",
"0.53283924",
"0.53223",
"0.531651",
"0.5304879",
"0.529556",
"0.52812636",
"0.52811646",
"0.52740234",
"0.5266581",
"0.526073"
] |
0.8895936
|
0
|
Returns a widget instance for the given name.
|
def widget(name, *args)
eventually { document.widget(name, *args) }
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def get_object(name)\n gtk_builder_get_object(@builder, name)\n end",
"def jmaki_load_widget(name)\n # Return previously parsed content (if any)\n if !@jmaki_widgets\n @jmaki_widgets = { }\n end\n previous = @jmaki_widgets[name]\n if previous\n return previous\n end\n content = \"\"\n filename = JMAKI_RESOURCES + name.tr('.', '/') + \"/widget.json\"\n File.open(filename, \"r\") do |file|\n while line = file.gets(nil)\n content += line\n end\n end\n current = jmaki_parse_json(content, filename)\n @jmaki_widgets[name] = current\n current\n end",
"def name\n self.widget.name\n end",
"def new(name)\n if @data.create(name)\n \"You created widget #{name}\"\n else\n \"#{name} already exists!\"\n end\n end",
"def create_widget\n widget_class.new(widget_assigns)\n end",
"def w(type, params = {})\n puts \"creating #{type.inspect} with #{params.inspect}\"\n klass = eval(camelize(type.to_s))\n widget = klass.new\n\n if (params[:name])\n name = params[:name]\n end\n\n if params[:text]\n widget.text = params[:text]\n end\n\n if (name)\n name_hash[name] = widget\n end\n puts \"returning #{widget.inspect}\"\n widget\n end",
"def netzke(name, config = {})\n ::ActiveSupport::Deprecation.warn(\"widget_class_name option is deprecated. Use class_name instead\", caller) if config[:widget_class_name]\n class_name = config[:class_name] ||= config[:widget_class_name] || name.to_s.camelcase\n config[:name] = name\n Netzke::Base.reg_widget(config)\n w = Netzke::Base.instance_by_config(config)\n w.before_load # inform the widget about initial load\n content_for :netzke_js_classes, w.js_missing_code(@rendered_classes ||= [])\n content_for :netzke_on_ready, \"#{w.js_widget_instance}\\n\\n#{w.js_widget_render}\"\n \n # Now mark this widget's class as rendered, so that we only generate it once per view\n @rendered_classes << class_name unless @rendered_classes.include?(class_name)\n\n # Return the html for this widget\n w.js_widget_html\n end",
"def get_instance_by_name(group, name)\n get_instances(group).each {|instance|\n return instance if (instance.tags['name_s'] || \"\").casecmp(name) == 0\n return instance if (instance.tags['Name'] || \"\").casecmp(name) == 0\n }\n raise \"unknown instance: #{name} in group #{group} \"\n end",
"def named(name)\n NamedMarkup.new self, name\n end",
"def widget\n @widget = \"#{params[:name].camelize}Widget\".constantize.new(current_user)\n respond_to do |format|\n format.js\n end\n end",
"def static_widget\n \n # look for existing static widget\n self.widgets.each do |widget| \n return widget if widget.name == \"Static Widget\"\n end\n \n # create widget if non-existent\n self.widgets.create({:name => \"Static Widget\", :module => \"StaticWidget\"})\n end",
"def find(name)\n instances.find { |instance| instance.name == (name) }\n end",
"def widget_named path\n widget = Gtk::Window.toplevels.first\n path.split('.').each do |name|\n widget = widget.children.select{|child| child.name == name}.first\n end\n widget\nrescue\n puts \"Cannot find widget: #{path}. Failed on children of #{name}\"\nend",
"def get_instance(name)\n name = name[0, 2].upcase\n cls = case name\n when 'ET'\n 'Rbeapi::Api::EthernetInterface'\n when 'PO'\n 'Rbeapi::Api::PortchannelInterface'\n when 'VX'\n 'Rbeapi::Api::VxlanInterface'\n when 'VL'\n 'Rbeapi::Api::VlanInterface'\n else\n 'Rbeapi::Api::BaseInterface'\n end\n\n return @instances[name] if @instances.include?(cls)\n instance = Rbeapi::Utils.class_from_string(cls).new(@node)\n @instances[name] = instance\n instance\n end",
"def new\n @widget = Widget.new\n end",
"def find_widget widget_description\n @widgets.find widget_description\n end",
"def get(id)\n\t\t\tkparams = {}\n\t\t\tclient.add_param(kparams, 'id', id);\n\t\t\tclient.queue_service_action_call('widget', 'get', 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 instance(name)\n apps[name] ||= new\n end",
"def instance(name)\n apps[name] ||= new\n end",
"def jmaki_widget(name, options = {})\n\n # Set up variables we will need\n result = \"\"\n nameSlashed = name.tr('.', '/')\n widgetDir = \"/resources/\" + nameSlashed # FIXME - relative to context path?\n\n # Decorate the options hash with our required attributes\n options['name'] = name\n if !options['uuid']\n options['uuid'] = jmaki_generate_uuid(name)\n end\n options['widgetDir'] = widgetDir\n# puts \"options = \" + options.inspect \n\n # Render the widget-specific libraries and stylesheets\n widget = jmaki_load_widget(name)\n# puts \"Loaded data is \" + widget.inspect\n config = widget['config']\n if config\n type = config['type']\n if type\n id = type['id']\n if ((id != nil) && !jmaki_type_include?(id))\n # preload\n preload = type['preload']\n if preload\n result += jmaki_generate_script(preload)\n end\n #apikey\n apikey = type['apikey']\n gkeys = config['apikeys']\n if !apikey\n apikey = \"\"\n elsif gkeys\n for i in 0...gkeys.length \n # check if we have a global apikey ex. google\n if gkeys[i]['id'] == apikey\n urlkeys = gkeys[i]['keys'];\n # check if we can match the url to one of the keys\n #FIXME -use global variables to compute the webRoot\n railsURI = request.request_uri \n requestURI = request.env['REQUEST_URI'] \n webRoot = requestURI[0, (requestURI.length - railsURI.length)] + \"/\"\n for i in 0...urlkeys.length \n # check the apikey against the webRoot and account for wildcards\n if urlkeys[i]['url'] == webRoot || urlkeys[i]['url'] == '*'\n # set the key equal to the new apikey\n apikey = urlkeys[i]['key']\n end\n end\n end \n end \n end\n # libs\n libs = type['libs']\n dynamicallyLoadable = type['dynamicallyLoadable']\n if libs\n for i in 0...libs.length\n scriptName = \"\"\n # if the lib starts with http don't add the widget dir\n if libs[i].match(/^http/)\n scriptName = libs[i] + apikey\n else\n scriptName = widgetDir + \"/\" + libs[i] + apikey\n end \n # use jmaki script loader when dynamicallyLoadable is false\n # the uuid is needed to identify the widget to the end user\n if dynamicallyLoadable != nil && !dynamicallyLoadable\n script = \"jmaki.writeScript('\" + scriptName + \"','\" + options['uuid'] + \"');\"\n result += jmaki_generate_script(script)\n else \n result += jmaki_generate_js(scriptName)\n end\n end\n end\n # postload\n postload = type['postload']\n if postload\n result += jmaki_generate_script(postload)\n end\n # themes\n themes = type['themes']\n if themes\n defaultTheme = nil\n for i in 0...themes.length\n # check each theme if its the default. Last one with default wins\n if @jmakiGlobalTheme && themes[i]['id']\n if @jmakiGlobalTheme == themes[i]['id']\n theme = themes[i]['style']\n end\n end\n if themes[i]['default']\n defaultTheme = themes[i]['style'] \n end\n end\n if theme == nil\n theme = defaultTheme \n end\n\n if theme\n if theme.match(/^http/)\n result += jmaki_generate_css(theme)\n else\n result += jmaki_generate_css(widgetDir + \"/\" + theme)\n end\n end \n end \n # styles\n styles = type['styles']\n if styles\n for i in 0...styles.length\n if styles[i].match(/^http/)\n result += jmaki_generate_css(styles[i])\n else\n result += jmaki_generate_css(widgetDir + \"/\" + styles[i])\n end \n end\n end\n jmaki_type_include(id)\n end\n end\n end\n\n # Render link to widget stylesheet (if any)\n # FIXME - allow \"component.css\" override with \"style\" attribute\n if (File.exist?(JMAKI_RESOURCES + nameSlashed + \"/component.css\"))\n result += jmaki_generate_css(widgetDir + \"/component.css\")\n end\n\n # Render link to widget javascript (assumed to exist)\n # FIXME - allow \"component.js\" override with \"script\" attribute\n result += jmaki_generate_js(widgetDir + \"/component.js\")\n\n # Create an empty options hash if we did not receive one\n if !options\n options = { }\n end\n\n # Deal with the widget template (if any), including parameter replacements\n # FIXME - override local filename with \"template\" attribute\n template = nil\n templateFilename = JMAKI_RESOURCES + nameSlashed + \"/component.htm\"\n if (File.exist?(templateFilename))\n template = jmaki_generate_content(templateFilename)\n elsif (File.exist?(templateFilename + \"l\"))\n template = jmaki_generate_content(templateFilename + \"l\")\n end\n if template\n # FIXME - do substitutions in writeTemplate() other than ${uuid}\n template = template.gsub('${uuid}', options['uuid'])\n result += template\n end\n\n# puts \"OPTIONS=\" + options.to_json\n\n # Render the widget constructor call\n result += \"<script type='text/javascript'>\\n\" +\n \" jmaki.addWidget(\" + options.to_json + \");\\n\" +\n \"</script>\\n\"\n\n # Return the completed result\n result\n\n end",
"def widgets(name, *args)\n document.widgets(name, *args)\n end",
"def add_widget(name)\n @browser.div(:id=>\"add_goodies_body\").li(:text=>/#{Regexp.escape(name)}/).button.click\n end",
"def build(name)\n Interface.new(find(name))\n end",
"def new(name)\n self[name]\n end",
"def widget\n html = \"<div class='widget'>\"\n html += provider.widget(internal_id)\n html += \"</div>\"\n return html.html_safe\n end",
"def find_widget(widget_id)\n find {|node| node.name.to_s == widget_id.to_s}\n end",
"def component(name)\n components.each { |c| return c if c.name == name.to_sym }\n return nil\n end",
"def add_widget widget\n # this help to access widget by a name\n if widget.respond_to? :name and !widget.name.nil?\n @by_name[widget.name] = widget\n end\n\n @widgets << widget\n @focusable_modified = true\n\n return @widgets.length-1\n end",
"def element(name)\n elements.find { |el| el.name == name.to_s }\n end",
"def item_by_name\n IITVisual.new(@ole.ItemByName)\n end",
"def item_by_name\n IITWindow.new(@ole.ItemByName)\n end",
"def create_widget_for_pointer(pointer)\n new_widget = @gui_factory.new_widget(\"DisplayFile/#{get_gui_name_for(pointer)}\")\n # Initialize the widget with the pointer's content\n if pointer.is_a?(Model::FileInfo)\n file_name = pointer.get_absolute_name\n File.open(file_name, 'rb') do |file|\n new_widget.init_with_data(pointer, IOBlockReader::init(file, :block_size => Model::FileInfo::CRC_BLOCK_SIZE), 0, File.size(file_name))\n end\n else\n file_name = pointer.file_info.get_absolute_name\n segment = pointer.segment\n File.open(file_name, 'rb') do |file|\n new_widget.init_with_data(pointer, IOBlockReader::init(file, :block_size => Model::FileInfo::CRC_BLOCK_SIZE), segment.begin_offset, segment.end_offset)\n end\n end\n\n return new_widget\n end",
"def widgets(win_name)\n @driver.getQuickWidgetList(win_name).map do |java_widget|\n case java_widget.getType\n when QuickWidget::WIDGET_ENUM_MAP[:button]\n QuickButton.new(self,java_widget)\n when QuickWidget::WIDGET_ENUM_MAP[:checkbox]\n QuickCheckbox.new(self,java_widget)\n when QuickWidget::WIDGET_ENUM_MAP[:dialogtab]\n QuickDialogTab.new(self,java_widget)\n when QuickWidget::WIDGET_ENUM_MAP[:dropdown]\n QuickDropdown.new(self,java_widget)\n when QuickWidget::WIDGET_ENUM_MAP[:editfield]\n QuickEditField.new(self,java_widget)\n when QuickWidget::WIDGET_ENUM_MAP[:label]\n QuickLabel.new(self,java_widget)\n when QuickWidget::WIDGET_ENUM_MAP[:radiobutton]\n QuickRadioButton.new(self,java_widget)\n when QuickWidget::WIDGET_ENUM_MAP[:treeview]\n QuickTreeView.new(self,java_widget)\n when QuickWidget::WIDGET_ENUM_MAP[:treeitem]\n QuickTreeItem.new(self,java_widget)\n when QuickWidget::WIDGET_ENUM_MAP[:thumbnail]\n QuickTreeItem.new(self,java_widget)\n else\n QuickWidget.new(self,java_widget)\n end\n end.to_a\n end",
"def get_renderer(name)\n begin\n class_name = name.to_s.capitalize.to_sym\n renderer = ::Hyde::Renderers.const_get(class_name)\n rescue NameError\n renderer = nil\n end\n renderer\n end",
"def find_widget widget_description\n @form.find_widget widget_description\n end",
"def widget(widget_class, assigns={}, &block)\n child = widget_class.new(helpers, assigns, doc, &block)\n child.render\n end",
"def find(name)\n Template.find(name)\n end",
"def get(name)\n name = camelize(name) if name.downcase == name\n begin\n Object.const_get(name)\n rescue NameError\n nil\n end\n end",
"def locator(name)\n locator_by_type(:base, name)\n end",
"def component(name, locator)\n self.finders[name] = ElementFinder.new(:find, locator, wrapper: Component)\n end",
"def font_builder(name)\n key = font_key(name)\n klass = @builders[key]\n check_is_a!(klass, Class)\n klass\n end",
"def find_by_name(name)\n find_by('name', name)\n end",
"def current_name_window_builder\n return UI::Window.window_builder(current_name_windowskin)\n end",
"def iframe(name)\n iframes.find { |el| el.name == name.to_s }\n end",
"def find_by_name(name)\n Textalk::Theme.list.select { |theme| theme.dig(:params, :component) == name }\n end",
"def find(name)\n @boxes.each do |box|\n return box if box.name == name\n end\n\n nil\n end",
"def find(name)\n @boxes.each do |box|\n return box if box.name == name\n end\n\n nil\n end",
"def find_by_name(name)\n domain_record = finder(:select => [:id, :name], :conditions => {:name => name})\n return nil if domain_record.nil?\n\n new(domain_record)\n end",
"def class_by_name name\n # http://stackoverflow.com/questions/14070369/how-to-instantiate-class-from-name-string-in-rails\n Object.const_get name.to_s\n\n end",
"def form(name, klass = self.class)\n _unique(name)\n input = _form(name)\n form = _build_form(name, input, klass)\n forms[name] = form\n end",
"def get_resource(name)\n resource = Resource.new\n resource.name = name\n resource.get_resource\n yield resource.resource if block_given?\n resource\n end",
"def [](name, *args)\n component = components[name.to_sym]\n\n component.klass.new(*args)\n end",
"def container_model_by_name(name)\n if model = find_container_model_by_name(name)\n model\n else\n raise NotFound, \"#{self} has no container type named #{name}\"\n end\n end",
"def resolve_instance(name=nil)\n\t\t\tif name\n\t\t\t\t@mgr.setparam(\"name\", name)\n\t\t\t\t@mgr.normalize_name_parameters()\n\t\t\tend\n\t\t\tname, dbname = @mgr.getparams(\"name\", \"dbname\")\n\t\t\tdbi = @resource.db_instance(dbname)\n\t\t\tbegin\n\t\t\t\t# Innocuous call that will raise an exception if it doesn't exist\n\t\t\t\tdbi.db_instance_arn\n\t\t\trescue\n\t\t\t\treturn nil\n\t\t\tend\n\t\t\treturn dbi\n\t\tend",
"def find_obj_for_name(name)\n idx = @field_names.index(name)\n if idx\n instantiate_obj(idx)\n @field_objs[idx].obj\n else\n nil\n end\n end",
"def child_for_name(name)\n child = child_with_exact_name(name)\n if child\n child\n else\n fallback_child\n end\n end",
"def oauth_instance(name)\n instance = Rack::OAuth.get(oauth_request_env, name)\n if instance.nil?\n raise Rack::OAuthError, \"Couldn't find Rack::OAuth instance with name #{name}\"\n end\n instance\n end",
"def get_plugin(name); Ricer::Plugin.by_name(name); end",
"def find_container_model_by_name(name)\n container_models[name.to_str]\n end",
"def get_instance_by_name\n # return the existing object if any, otherwise return true\n end",
"def set_simple_widget\n @simple_widget = SimpleWidget.find(params[:id])\n end",
"def find_object(name); end",
"def load_builder(name)\n if(builders[name.to_sym])\n require File.join(builders[name.to_sym], name)\n else\n raise NameError.new(\"Requested end point builder not found (#{name})\")\n end\n self\n end",
"def remove_widget widget\n if widget.respond_to? :name and !widget.name.nil?\n @by_name.delete(widget.name)\n end\n @focusable_modified = true\n @widgets.delete widget\n end",
"def widget\n end",
"def widget\n end",
"def device_with_name(name)\n c = settings.subaru_config[:devices][name]\n return Object.const_get(\"Subaru::Definitions::#{c[:definition]}\").new(c) if c\n rescue => e\n puts e.message\n return nil\n end",
"def build (name, attrs = {})\n factory_by_name(name).build(attrs)\n end",
"def build (name, attrs = {})\n factory_by_name(name).build(attrs)\n end",
"def get_factory_for(name)\n factories[name]\n end",
"def element(name)\n Vidalia::checkvar(name,String,self.class.ancestors,\"name\")\n child = get_child(name)\n unless child\n # Child does not yet exist. Create it.\n child = Vidalia::Element.new(\n :name => name,\n :parent => self,\n :definition => @source_artifact.get_child(name)\n )\n end\n child\n end",
"def set_widget\n @widget = Widget.find(params[:id])\n end",
"def set_widget\n @widget = Widget.find(params[:id])\n end",
"def by_name(name, options = {})\n html = get('/tools/quickinfo.php', :query => {:show => name}, :format => :html)\n show_info = Crack::XML.parse(html)[\"pre\"]\n raise ShowNotFound unless show_info\n id = show_info.split(\"\\n\").first.gsub(%r{^Show ID@}, '').strip\n Show.new(id, options)\n end",
"def get(name)\n @all.find { |e| e.name == name.to_s || e.name == \"#{name}_engine\" }\n end",
"def get_by_name(name)\n network=connection.lookup_network_by_name(name)\n return network\n # new(:raw => network)\n end",
"def instance(name)\n IbmCloudRest::instance.new(self, name)\n end",
"def get_view\n\t\treturn \"control_widget\"\n\tend",
"def find_by_name(name)\n Discovery.find_by_name(name)\n end",
"def set_widget\n @widget = Widget.find(params[:id])\n end",
"def set_widget\r\n @widget = Widget.find(params[:id])\r\n end",
"def find name\n object = objects.find { |o| o.name == name.to_s }\n end",
"def button_locator(name)\n locator_by_type(:button, name)\n end",
"def instance!(name)\n create_db(name) rescue nil\n instance(name)\n end",
"def by_name(name)\n elt = self[name]\n return elt unless elt.nil?\n\n @elements.each_key do |subelt_name|\n if self[subelt_name].is_a?(Model)\n elt = self[subelt_name][name]\n return elt unless elt.nil?\n end\n end\n\n nil\n end",
"def component_instance(name, strong_config = {})\n composite = self\n name.to_s.split('__').each do |cmp|\n cmp = cmp.to_sym\n\n component_config = composite.components[cmp]\n raise ArgumentError, \"No child component '#{cmp}' defined for component '#{composite.global_id}'\" if component_config.nil?\n\n component_class_name = component_config[:class_name]\n raise ArgumentError, \"No class_name specified for component #{cmp} of #{composite.global_id}\" if component_class_name.nil?\n\n component_class = constantize_class_name(component_class_name)\n raise ArgumentError, \"Unknown constant #{component_class_name}\" if component_class.nil?\n\n instance_config = weak_children_config.merge(component_config).merge(strong_config).merge(:name => cmp)\n\n composite = component_class.new(instance_config, composite) # params: config, parent\n end\n composite\n end",
"def get_child(name)\n Vidalia::checkvar(name,String,self.class.ancestors,\"name\")\n @children[name]\n end",
"def remove_widget(name)\n @browser.div(:id=>\"add_goodies_body\").li(:text=>/#{Regexp.escape(name)}/, :id=>/_remove_/).button.click\n end",
"def use(name)\n Vedeu::Interface.new(Vedeu::Interfaces.find(name))\n end",
"def find_model(name)\n @models[name.to_s.downcase.to_sym]\n end",
"def window(name)\n Tk.execute_only(:tkwait, :window, name)\n end",
"def recipe_instance(recipe_name) \n Recipe.find_by name: recipe_name\n end",
"def click_button_with_name(name, opts={})\r\n find_element(:name, name).click\r\n end",
"def find_widget_index widget_description\n @widgets.find_index widget_description\n end",
"def create_by_name(name)\n self.new.tap do |o|\n o.name = name # ambos sirven\n end\n end",
"def find_by_name name\n name = CGI.escape name.downcase.gsub(/\\s/, '')\n DynamicModel.new perform_request api_url \"summoners/by-name/#{name}\"\n end",
"def find_by_name name\n name = CGI.escape name.downcase.gsub(/\\s/, '')\n DynamicModel.new perform_request api_url \"summoners/by-name/#{name}\"\n end",
"def find_name(name)\n @driver.find_element(:name, name).click\n end",
"def render_widget_for(widget_id, opts, &block)\n if widget_id.kind_of?(::Apotomo::Widget)\n widget = widget_id\n else\n widget = root.find_widget(widget_id)\n raise \"Couldn't render non-existent widget `#{widget_id}`\" unless widget\n end\n \n \n ### TODO: pass options in invoke.\n widget.opts = opts unless opts.empty?\n \n widget.invoke(&block)\n end",
"def get(name)\n name = camelize(name) if name.downcase == name\n begin\n const_get(name)\n rescue NameError\n nil\n end\n end"
] |
[
"0.6700946",
"0.6534847",
"0.6436914",
"0.6254253",
"0.60838956",
"0.6064248",
"0.5990443",
"0.5872015",
"0.5869043",
"0.5864325",
"0.5836126",
"0.5826878",
"0.58184946",
"0.57983124",
"0.5732239",
"0.56951845",
"0.5688887",
"0.5665339",
"0.56639415",
"0.5634459",
"0.56262785",
"0.5623165",
"0.56140774",
"0.5578215",
"0.5569048",
"0.5565143",
"0.5534027",
"0.55277455",
"0.5485806",
"0.54729575",
"0.54680985",
"0.54616994",
"0.5451856",
"0.54485095",
"0.5442648",
"0.54413855",
"0.5440953",
"0.54225874",
"0.5421126",
"0.5372492",
"0.5358714",
"0.53585756",
"0.5358325",
"0.5335321",
"0.5307741",
"0.5306711",
"0.5306711",
"0.5302344",
"0.5301106",
"0.5257564",
"0.5238189",
"0.5219388",
"0.52105546",
"0.52099353",
"0.5198842",
"0.51842606",
"0.5179732",
"0.51752216",
"0.5171432",
"0.51582474",
"0.5151581",
"0.5151224",
"0.5138908",
"0.5131032",
"0.51283795",
"0.51283795",
"0.5128094",
"0.51211166",
"0.51211166",
"0.51076645",
"0.5087743",
"0.50855774",
"0.50855774",
"0.50795174",
"0.50777006",
"0.5077218",
"0.50769025",
"0.507574",
"0.50727296",
"0.5072497",
"0.50712943",
"0.50653297",
"0.5045895",
"0.50436556",
"0.5037014",
"0.503095",
"0.5017707",
"0.50137126",
"0.50047547",
"0.49988917",
"0.49981093",
"0.4997258",
"0.4992993",
"0.49924782",
"0.49880847",
"0.49821213",
"0.49821213",
"0.49689695",
"0.49686232",
"0.49566096"
] |
0.67785233
|
0
|
Returns a list of widget instances for the given name.
|
def widgets(name, *args)
document.widgets(name, *args)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def widgets(win_name)\n @driver.getQuickWidgetList(win_name).map do |java_widget|\n case java_widget.getType\n when QuickWidget::WIDGET_ENUM_MAP[:button]\n QuickButton.new(self,java_widget)\n when QuickWidget::WIDGET_ENUM_MAP[:checkbox]\n QuickCheckbox.new(self,java_widget)\n when QuickWidget::WIDGET_ENUM_MAP[:dialogtab]\n QuickDialogTab.new(self,java_widget)\n when QuickWidget::WIDGET_ENUM_MAP[:dropdown]\n QuickDropdown.new(self,java_widget)\n when QuickWidget::WIDGET_ENUM_MAP[:editfield]\n QuickEditField.new(self,java_widget)\n when QuickWidget::WIDGET_ENUM_MAP[:label]\n QuickLabel.new(self,java_widget)\n when QuickWidget::WIDGET_ENUM_MAP[:radiobutton]\n QuickRadioButton.new(self,java_widget)\n when QuickWidget::WIDGET_ENUM_MAP[:treeview]\n QuickTreeView.new(self,java_widget)\n when QuickWidget::WIDGET_ENUM_MAP[:treeitem]\n QuickTreeItem.new(self,java_widget)\n when QuickWidget::WIDGET_ENUM_MAP[:thumbnail]\n QuickTreeItem.new(self,java_widget)\n else\n QuickWidget.new(self,java_widget)\n end\n end.to_a\n end",
"def widgets\n @widgets\n end",
"def widgets\n names = []\n if FileTest.directory?(@path)\n FileUtils.cd(@path) { names += Dir[\"*\"] }\n end\n if FileTest.directory?(@system_path)\n FileUtils.cd(@system_path) { names += Dir[\"*\"] }\n end\n names.uniq!\n names\n end",
"def widgets(window)\n\n # If window specifies window name, and the active window has this name\n # use its id to get the widgets,\n if window.is_a? String\n active_win_id = driver.getActiveQuickWindowID()\n active_win_name = driver.getQuickWindowName(active_win_id)\n\n #If the active window is of same type, then grab that one, not first\n if active_win_name == window #e.g. Both Document Window\n window = active_win_id\n end\n end\n driver.getQuickWidgetList(window).map do |java_widget|\n case java_widget.getType\n when QuickWidget::WIDGET_ENUM_MAP[:button]\n QuickButton.new(self,java_widget)\n when QuickWidget::WIDGET_ENUM_MAP[:checkbox]\n QuickCheckbox.new(self,java_widget)\n when QuickWidget::WIDGET_ENUM_MAP[:dialogtab]\n QuickDialogTab.new(self,java_widget)\n when QuickWidget::WIDGET_ENUM_MAP[:dropdown]\n QuickDropdown.new(self,java_widget)\n when QuickWidget::WIDGET_ENUM_MAP[:editfield]\n QuickEditField.new(self,java_widget)\n when QuickWidget::WIDGET_ENUM_MAP[:label]\n QuickLabel.new(self,java_widget)\n when QuickWidget::WIDGET_ENUM_MAP[:radiobutton]\n QuickRadioButton.new(self,java_widget)\n when QuickWidget::WIDGET_ENUM_MAP[:treeview]\n QuickTreeView.new(self,java_widget)\n when QuickWidget::WIDGET_ENUM_MAP[:treeitem]\n QuickTreeItem.new(self,java_widget)\n when QuickWidget::WIDGET_ENUM_MAP[:thumbnail]\n QuickTreeItem.new(self,java_widget)\n else\n QuickWidget.new(self,java_widget)\n end\n end.to_a\n end",
"def get_widgets_list\n dataset_array = []\n @site.contexts.each {|c| c.context_datasets.each {|d| dataset_array << d.dataset_id}}\n dataset_array.uniq!\n widgets = WidgetService.from_datasets dataset_array\n widgets.map do |w|\n { id: w.id, name: w.name,\n visualization: w.widget_config, description: w.description }\n end\n end",
"def list(filter=KalturaNotImplemented, pager=KalturaNotImplemented)\n\t\t\tkparams = {}\n\t\t\tclient.add_param(kparams, 'filter', filter);\n\t\t\tclient.add_param(kparams, 'pager', pager);\n\t\t\tclient.queue_service_action_call('widget', 'list', 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 widgets\n @form.widgets\n end",
"def extend_widget_by\n []\n end",
"def find_widgets widgets_description\n @widgets.find_all widgets_description\n end",
"def [] i\n @widgets[i]\n end",
"def available_widgets\n options = {:page_template => page.page_template, :block => block_type}\n UbiquoDesign::Structure.get(options)[:widgets].map(&:keys).flatten\n end",
"def all_elements_by_name(name, options = {})\n default_options = {\n :count => :all,\n :from_page => :all,\n :language => session[:language]\n }\n options = default_options.merge(options)\n if options[:from_page] == :all\n elements = Element.find_all_by_name_and_public(name, true, :limit => options[:count] == :all ? nil : options[:count])\n elsif options[:from_page].class == String\n page = Page.find_by_page_layout_and_language(options[:from_page], options[:language])\n return [] if page.blank?\n elements = page.elements.find_all_by_name_and_public(name, true, :limit => options[:count] == :all ? nil : options[:count])\n else\n elements = options[:from_page].elements.find_all_by_name_and_public(name, true, :limit => options[:count] == :all ? nil : options[:count])\n end\n end",
"def objects_of_class(name)\n find_all { |r| name === r['class'] }\n end",
"def get_widgets(property)\n widgets = []\n\n type = property.type\n values = property.values\n\n label = Gtk::Label.new(\"#{property.label}:\")\n label.xalign = 0\n\n widget, getter, setter = create_widget(property, type, values)\n\n val = property.get(@instance)\n setter.call(val) unless setter.nil?\n\n return [label, widget], [getter, setter, property]\n end",
"def list_by_name(name)\n params = Hash.new\n params[:name] = name\n self.list(params)\n end",
"def displayed_widgets\n list = []\n self.div(:class=>\"fl-container-flex widget-content\").divs(:class=>\"s3d-contentpage-title\").each do |div|\n list << div.text\n end\n return list\n end",
"def jmaki_load_widget(name)\n # Return previously parsed content (if any)\n if !@jmaki_widgets\n @jmaki_widgets = { }\n end\n previous = @jmaki_widgets[name]\n if previous\n return previous\n end\n content = \"\"\n filename = JMAKI_RESOURCES + name.tr('.', '/') + \"/widget.json\"\n File.open(filename, \"r\") do |file|\n while line = file.gets(nil)\n content += line\n end\n end\n current = jmaki_parse_json(content, filename)\n @jmaki_widgets[name] = current\n current\n end",
"def find(name)\n instances.find { |instance| instance.name == (name) }\n end",
"def index\n @simple_widgets = SimpleWidget.all\n end",
"def find_widgets widgets_description\n @form.find_widgets widgets_description\n end",
"def generate\n widgets = {}\n self.widgets.each do |name|\n config = self.process_config(name)\n widgets[name] = WidgetStructure.new(\n name,\n config,\n self.process_javascripts(config, name),\n self.process_layout(config, name)\n )\n end\n Ruhoh::Utils.report('Widgets', widgets, [])\n\n widgets\n end",
"def find_widgets_index widgets_description\n @widgets.find_index_all widgets_description\n end",
"def widgets= mine_widgets\n @widgets = []\n mine_widgets.each do |widget|\n self.add_widget widget\n end\n end",
"def add_widget widget\n # this help to access widget by a name\n if widget.respond_to? :name and !widget.name.nil?\n @by_name[widget.name] = widget\n end\n\n @widgets << widget\n @focusable_modified = true\n\n return @widgets.length-1\n end",
"def all\n @all ||= widget_types.reject(&:abstract?).inject({}) {|res, type| res.deep_merge(type.instances_hash)}\n end",
"def index\n @widget_forms = WidgetForm.all\n end",
"def find_widgets_index widgets_description\n @form.find_widgets_index widgets_description\n end",
"def get_containers_by_given_name(given_name)\n @containers.select { |label, container|\n container.attributes[:name].match(/#{ComposeUtils.dir_name}_#{given_name}_\\d+/)\n }.values\n end",
"def name\n self.widget.name\n end",
"def all_widgets\n if self.current_layout\n return self.widgets + self.current_layout.widgets\n else \n return self.widgets\n end\n end",
"def widget(name, *args)\n eventually { document.widget(name, *args) }\n end",
"def widget_named path\n widget = Gtk::Window.toplevels.first\n path.split('.').each do |name|\n widget = widget.children.select{|child| child.name == name}.first\n end\n widget\nrescue\n puts \"Cannot find widget: #{path}. Failed on children of #{name}\"\nend",
"def load_widgets\n if params[:all_widgets]\n @widgets = Widget.find(:all)\n else\n @widgets = @potato_man.theme_package.widgets\n end\n end",
"def multi_get(page, options = {})\n widgets_with_key = {}\n all_widgets = []\n page.blocks.each do |block|\n block.real_block.widgets.each do |widget|\n key = calculate_key(widget, options)\n all_widgets << [widget, key] if key\n end\n end\n\n valid_widgets = validate_parents(all_widgets, options)\n valid_widgets.each do |elems|\n widgets_with_key[elems[0].id] = elems[1]\n end\n\n crypted_table = crypt_all_keys(widgets_with_key.values)\n\n cached_widgets = begin\n multi_retrieve crypted_table.keys\n rescue CacheNotAvailable\n return {}\n end\n\n widgets = {}\n cached_widgets.each do |cached_widget|\n if cached_widget.last\n key = widgets_with_key.index(crypted_table[cached_widget.first])\n Rails.logger.debug \"Widget cache hit for widget with id: #{key} with key #{crypted_table[cached_widget.first]}\"\n widgets[key] = cached_widget.last\n end\n end\n widgets\n end",
"def objects_of_type(name)\n find_all { |r| name === r['type'] }\n end",
"def create_widgets_by_config(hash = config, prefix = '')\n # Raise an exception if hash is not config or hash\n if !hash.is_a?(Hash) and !hash.is_a?(HupoWidget::Configuration)\n raise UnknownWidget, 'Unknown widget type %s' % prefix.underscore.gsub('/', '.')\n end\n\n hash.each do |widget_type, values|\n widget_type = widget_type.camelize\n widget_type = '%s::%s' % [prefix, widget_type] if prefix != ''\n class_name = '%sWidget' % widget_type\n\n if (widget_class = class_name.safe_constantize)\n @widget_types << widget_class\n\n if widget_class.singleton?\n # Create a singleton object\n widget_class.instance\n else\n values.each_key {|key| widget_class.new(key)}\n end\n else\n # We need to go deeper\n create_widgets_by_config(values, widget_type)\n end\n end\n end",
"def components(name, locator, wrapper: nil)\n self.finders[name] = ElementFinder.new(:all, locator, wrapper: wrapper)\n end",
"def index\n @user_widgets = UserWidget.all\n end",
"def get_by_model(instance, context = nil)\n ([widgets = [], version_widgets = []]).tap do\n get(context).each_pair do |widget, policies|\n detected = (policies[:models] || []).to_a.detect{|model| instance.is_a?(model.first.to_s.constantize)}\n if detected.present?\n related = detected.last\n if related[:params].blank? && related[:procs].blank?\n version_widgets << widget\n else\n widgets << widget\n end\n end\n end\n end\n end",
"def add_widget(name)\n @browser.div(:id=>\"add_goodies_body\").li(:text=>/#{Regexp.escape(name)}/).button.click\n end",
"def find_all_places_by_name(name)\n _places = places.select {|place| place.name == name}\n\n if block_given?\n _places.each {|place| yield place}\n else\n return _places\n end\n end",
"def find_names name\n find_elements :name, name\n end",
"def add_all_widgets\n array = @browser.div(:id=>\"add_goodies_body\").lis.select { |li| li.class_name == \"add\" }\n sub_array = array.select { |li| li.visible? }\n sub_array.each do |li|\n li.button(:text=>\"Add\").click\n wait_for_ajax\n end\n close_add_widget\n end",
"def vms_by_name(name)\n get('VM', :by_name_label, name).collect do |vm|\n UltraVM::VM.new(self, vm)\n end\n end",
"def cell_elements_by_name(name)\n if cell = cells.find_by_name(name)\n cell.elements\n else\n Alchemy::Logger.warn(\"Cell with name `#{name}` could not be found!\", caller.first)\n Element.none\n end\n end",
"def netzke(name, config = {})\n ::ActiveSupport::Deprecation.warn(\"widget_class_name option is deprecated. Use class_name instead\", caller) if config[:widget_class_name]\n class_name = config[:class_name] ||= config[:widget_class_name] || name.to_s.camelcase\n config[:name] = name\n Netzke::Base.reg_widget(config)\n w = Netzke::Base.instance_by_config(config)\n w.before_load # inform the widget about initial load\n content_for :netzke_js_classes, w.js_missing_code(@rendered_classes ||= [])\n content_for :netzke_on_ready, \"#{w.js_widget_instance}\\n\\n#{w.js_widget_render}\"\n \n # Now mark this widget's class as rendered, so that we only generate it once per view\n @rendered_classes << class_name unless @rendered_classes.include?(class_name)\n\n # Return the html for this widget\n w.js_widget_html\n end",
"def structs(name = nil)\n find_children_of_type(\"Struct\", name)\n end",
"def add_widget_at widget, i\n self.init_widget widget\n if i > @widgets.length\n @widgets << widget\n else\n res = []\n @widgets.each_index do |index|\n res << elem if index == i\n res << @widgets[index]\n end\n @widgets = res\n end\n end",
"def instances_of(class_name, options = {})\n unless class_name.is_a?(Class)\n # class_name is actually an instance of the class to search for, not the class itself.\n class_name = class_name.class\n end\n @_componentable_container.select do |name, component|\n component.is_a?(class_name)\n end.keys\n end",
"def get(name)\n @all.find { |e| e.name == name.to_s || e.name == \"#{name}_engine\" }\n end",
"def get_shows_by_name(showname)\n videos = get_listings.videos.select do |s|\n !s.copy_protected? && s.title =~ /#{showname}/\n end\n videos.sort_by(&:time_captured)\n end",
"def find_by_name(name)\n Textalk::Theme.list.select { |theme| theme.dig(:params, :component) == name }\n end",
"def extend_widgets(widget,mapping,children=true)\n class_name = mapping[widget.objectName]\n if class_name\n UiLoader.redefine_widget_class_name widget,class_name\n spec = find_plugin_spec!({:plugin_name => class_name})\n spec.extend_plugin(widget) if spec\n end\n return widget unless children\n\n #extend childs and add accessor for QObject\n #find will find children recursive \n #objectNames are unique for widgets if the ui file was \n #generated with the qt designer therefore we can put them to the toplevel\n #warning: ruby objects have the wrong parent\n children = widget.findChildren(Qt::Object)\n children.each do |child|\n if child.objectName && child.objectName.size > 0\n extend_widgets child, mapping,false\n (class << widget; self;end).send(:define_method,child.objectName){child}\n end\n end\n widget\n end",
"def viewsWithStylename name\n r = []\n subviews.each do |view|\n if view.stylename == name\n r.push name\n end\n r += view.viewsWithStylename name\n end\n r\n end",
"def find_widget widget_description\n @widgets.find widget_description\n end",
"def find(name)\n @boxes.each do |box|\n return box if box.name == name\n end\n\n nil\n end",
"def find(name)\n @boxes.each do |box|\n return box if box.name == name\n end\n\n nil\n end",
"def instances_list\n return [] unless configured?\n\n @service.fetch_all do |token|\n @service.list_instances(@gcp_config['project'], @gcp_config['zone'], page_token: token)\n end.map(&:name)\n end",
"def get_object(name)\n gtk_builder_get_object(@builder, name)\n end",
"def content_tags(name)\n array = []\n name_li(name).div(:class=>/(mylibrary_item_|searchcontent_result_)tags/).lis.each do |li|\n array << li.span(:class=>\"s3d-search-result-tag\").text\n end\n return array\n end",
"def get_all(name=nil)\n if name.class == String && !block_given?\n return @j_del.java_method(:getAll, [Java::java.lang.String.java_class]).call(name).to_a.map { |elt| elt }\n end\n raise ArgumentError, \"Invalid arguments when calling get_all(name)\"\n end",
"def collection(name)\n Kernel.const_get(\"#{name}Collection\").new(@browser)\n end",
"def []= i, widget\n self.init_widget\n @widgets[i] = widget\n end",
"def nodes_for_name(name)\n if node = self.nodes[name]\n Config::ObjectList.new(node)\n elsif service = self.services[name]\n service.node_list\n elsif tag = self.tags[name]\n tag.node_list\n else\n {}\n end\n end",
"def initialize name\n\t\t@name = name\n\t\t@@instances << self\n\tend",
"def nesting(name)\n nesting = []\n namespace = name.split(\"::\")\n namespace.inject(Object) do |base, n|\n klass = base.const_get(n)\n nesting << klass\n klass\n end\n nesting.reverse\n end",
"def get(id)\n\t\t\tkparams = {}\n\t\t\tclient.add_param(kparams, 'id', id);\n\t\t\tclient.queue_service_action_call('widget', 'get', 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 jmaki_widget(name, options = {})\n\n # Set up variables we will need\n result = \"\"\n nameSlashed = name.tr('.', '/')\n widgetDir = \"/resources/\" + nameSlashed # FIXME - relative to context path?\n\n # Decorate the options hash with our required attributes\n options['name'] = name\n if !options['uuid']\n options['uuid'] = jmaki_generate_uuid(name)\n end\n options['widgetDir'] = widgetDir\n# puts \"options = \" + options.inspect \n\n # Render the widget-specific libraries and stylesheets\n widget = jmaki_load_widget(name)\n# puts \"Loaded data is \" + widget.inspect\n config = widget['config']\n if config\n type = config['type']\n if type\n id = type['id']\n if ((id != nil) && !jmaki_type_include?(id))\n # preload\n preload = type['preload']\n if preload\n result += jmaki_generate_script(preload)\n end\n #apikey\n apikey = type['apikey']\n gkeys = config['apikeys']\n if !apikey\n apikey = \"\"\n elsif gkeys\n for i in 0...gkeys.length \n # check if we have a global apikey ex. google\n if gkeys[i]['id'] == apikey\n urlkeys = gkeys[i]['keys'];\n # check if we can match the url to one of the keys\n #FIXME -use global variables to compute the webRoot\n railsURI = request.request_uri \n requestURI = request.env['REQUEST_URI'] \n webRoot = requestURI[0, (requestURI.length - railsURI.length)] + \"/\"\n for i in 0...urlkeys.length \n # check the apikey against the webRoot and account for wildcards\n if urlkeys[i]['url'] == webRoot || urlkeys[i]['url'] == '*'\n # set the key equal to the new apikey\n apikey = urlkeys[i]['key']\n end\n end\n end \n end \n end\n # libs\n libs = type['libs']\n dynamicallyLoadable = type['dynamicallyLoadable']\n if libs\n for i in 0...libs.length\n scriptName = \"\"\n # if the lib starts with http don't add the widget dir\n if libs[i].match(/^http/)\n scriptName = libs[i] + apikey\n else\n scriptName = widgetDir + \"/\" + libs[i] + apikey\n end \n # use jmaki script loader when dynamicallyLoadable is false\n # the uuid is needed to identify the widget to the end user\n if dynamicallyLoadable != nil && !dynamicallyLoadable\n script = \"jmaki.writeScript('\" + scriptName + \"','\" + options['uuid'] + \"');\"\n result += jmaki_generate_script(script)\n else \n result += jmaki_generate_js(scriptName)\n end\n end\n end\n # postload\n postload = type['postload']\n if postload\n result += jmaki_generate_script(postload)\n end\n # themes\n themes = type['themes']\n if themes\n defaultTheme = nil\n for i in 0...themes.length\n # check each theme if its the default. Last one with default wins\n if @jmakiGlobalTheme && themes[i]['id']\n if @jmakiGlobalTheme == themes[i]['id']\n theme = themes[i]['style']\n end\n end\n if themes[i]['default']\n defaultTheme = themes[i]['style'] \n end\n end\n if theme == nil\n theme = defaultTheme \n end\n\n if theme\n if theme.match(/^http/)\n result += jmaki_generate_css(theme)\n else\n result += jmaki_generate_css(widgetDir + \"/\" + theme)\n end\n end \n end \n # styles\n styles = type['styles']\n if styles\n for i in 0...styles.length\n if styles[i].match(/^http/)\n result += jmaki_generate_css(styles[i])\n else\n result += jmaki_generate_css(widgetDir + \"/\" + styles[i])\n end \n end\n end\n jmaki_type_include(id)\n end\n end\n end\n\n # Render link to widget stylesheet (if any)\n # FIXME - allow \"component.css\" override with \"style\" attribute\n if (File.exist?(JMAKI_RESOURCES + nameSlashed + \"/component.css\"))\n result += jmaki_generate_css(widgetDir + \"/component.css\")\n end\n\n # Render link to widget javascript (assumed to exist)\n # FIXME - allow \"component.js\" override with \"script\" attribute\n result += jmaki_generate_js(widgetDir + \"/component.js\")\n\n # Create an empty options hash if we did not receive one\n if !options\n options = { }\n end\n\n # Deal with the widget template (if any), including parameter replacements\n # FIXME - override local filename with \"template\" attribute\n template = nil\n templateFilename = JMAKI_RESOURCES + nameSlashed + \"/component.htm\"\n if (File.exist?(templateFilename))\n template = jmaki_generate_content(templateFilename)\n elsif (File.exist?(templateFilename + \"l\"))\n template = jmaki_generate_content(templateFilename + \"l\")\n end\n if template\n # FIXME - do substitutions in writeTemplate() other than ${uuid}\n template = template.gsub('${uuid}', options['uuid'])\n result += template\n end\n\n# puts \"OPTIONS=\" + options.to_json\n\n # Render the widget constructor call\n result += \"<script type='text/javascript'>\\n\" +\n \" jmaki.addWidget(\" + options.to_json + \");\\n\" +\n \"</script>\\n\"\n\n # Return the completed result\n result\n\n end",
"def find_widget_index widget_description\n @widgets.find_index widget_description\n end",
"def names\n Tk.execute(:image, :names).to_a\n end",
"def els(element_name)\n element_reader = get_locator(element_name)\n begin\n if element_reader.length > 0\n element_reader.each do |k,v|\n if(k=='class' || k=='css' || k=='id' || k=='xpath' || k=='partial_link_text' || k=='tag_name')\n begin\n $elems = $driver.find_elements(k.to_sym,v.to_s)\n $LOG.info \"Elements found \\n #{element_name} : #{k} => #{v}\"\n rescue Exception => e\n $LOG.error \"Element not found \"\n $LOG.error \"#{element_name} : #{k} => #{v}\"\n $LOG.error \"Error message :: \" + e.message\n raise \"Element not found \\n #{element_name} : #{k} => #{v} \\n Error Message :: \" + e.message\n end\n $elems\n end\n end\n else\n $LOG.error \"Element not present in object repository\"\n raise \"Element not present in object repository\"\n end\n $elems\n rescue Exception => e\n $LOG.error \"Error in finding the element :: \" + e.message\n raise \"Error in finding the element :: \" + e.message\n end\n end",
"def get_instance_by_name(group, name)\n get_instances(group).each {|instance|\n return instance if (instance.tags['name_s'] || \"\").casecmp(name) == 0\n return instance if (instance.tags['Name'] || \"\").casecmp(name) == 0\n }\n raise \"unknown instance: #{name} in group #{group} \"\n end",
"def specs_with_name(name)\n matching_specs = @specs.select do |spec|\n spec[0].name == name\n end\n\n name_tuples = []\n matching_specs.each do |(name_tuple, _)|\n name_tuples << name_tuple\n end\n\n name_tuples\n end",
"def classes(name = nil)\n if name\n classes.find(:name => name)\n else\n @classes.flatten\n end\n end",
"def named_windows\n return [] unless children\n children.inject([]) do | names, child |\n names << child.name if child.name\n names += child.named_windows if child.kind_of?(Parent)\n names\n end\n end",
"def named_instances\n @named_instances ||= Hash[instances.map { |i| [i.name || i.instance_id, i] }]\n end",
"def remove_widget widget\n if widget.respond_to? :name and !widget.name.nil?\n @by_name.delete(widget.name)\n end\n @focusable_modified = true\n @widgets.delete widget\n end",
"def observations_by_name\n query = create_query(:Observation, :all, by: :name)\n show_selected_observations(query)\n end",
"def generate_watcher_widgets\n @dtw_all_watchers = {}\n @watchers.each { | w, wname, wdesc |\n @dtw_all_watchers[w] = g = {}\n g[:dt] = dtw = {}\n g[:widget] = wid = {}\n hf = newHFFlat @f_watcher_switcher\n w.fields.each { |sym, type, default, name, desc|\n dtw[sym] = FXDataTarget.new(default)\n wid[sym] = case type\n when :bool\n newLabel(hf, name)\n newCheck(hf, '', target: dtw[sym])\n when :int\n newLabel(hf, name)\n newIntegerField(hf, target: dtw[sym])\n when :float\n newLabel(hf, name)\n newNumberField(hf, target: dtw[sym])\n when :string\n newLabel(hf, name)\n newTextField(hf, target: dtw[sym])\n end \n }\n }\n end",
"def tags(class_name)\n find_elements :class, class_name\n end",
"def list_methods_matching name\n found = []\n\n find_methods name do |store, klass, ancestor, types, method|\n if types == :instance or types == :both then\n methods = store.instance_methods[ancestor]\n\n if methods then\n matches = methods.grep(/^#{Regexp.escape method.to_s}/)\n\n matches = matches.map do |match|\n \"#{klass}##{match}\"\n end\n\n found.concat matches\n end\n end\n\n if types == :class or types == :both then\n methods = store.class_methods[ancestor]\n\n next unless methods\n matches = methods.grep(/^#{Regexp.escape method.to_s}/)\n\n matches = matches.map do |match|\n \"#{klass}::#{match}\"\n end\n\n found.concat matches\n end\n end\n\n found.uniq\n end",
"def list(name)\n lists.find { |list| ::File.basename(list.url) == name }\n end",
"def contents_by_name(name)\n contents.select { |content| content.name == name.to_s }\n end",
"def run_widget_hook(name, *args)\n self.class.callbacks_for_hook(name).each { |blk| instance_exec(*args, &blk) }\n end",
"def static_widget\n \n # look for existing static widget\n self.widgets.each do |widget| \n return widget if widget.name == \"Static Widget\"\n end\n \n # create widget if non-existent\n self.widgets.create({:name => \"Static Widget\", :module => \"StaticWidget\"})\n end",
"def iframe(name)\n iframes.find { |el| el.name == name.to_s }\n end",
"def find_attributes(name)\n\t\t\tr=[]\n\t\t\tp=self\n\t\t\twhile(p)\n\t\t\t\tif(p.respond_to?(name))\n\t\t\t\t\tv=p.send(name)\n\t\t\t\t\tr << v if(v)\n\t\t\t\tend\n\t\t\t\tbreak if(!p.respond_to?(\"container\"))\n\t\t\t\tp=p.container\n\t\t\tend\n\t\t\tr\n\t\tend",
"def find_all_plugin_specs(*pattern)\n return Array.new if pattern.empty?\n pattern = pattern.first\n if pattern.size == 1 && pattern[:plugin_name]\n spec = @plugin_specs[pattern[:plugin_name]]\n return Array(spec) if spec \n #try to find a cplusplus widget which is not registered \n #and register it \n if widget?(pattern[:plugin_name])\n result = Array(UiLoader.extend_cplusplus_widget_class(pattern[:plugin_name]))\n return result\n end\n end\n @plugin_specs.values.find_all do |spec|\n spec.match?(pattern)\n end\n end",
"def instances\n packages = []\n\n begin\n execpipe(listcmd) do |process|\n fields = [:name, :ensure]\n\n # yaourt -Q returns a list of packages in the format of\n # repo/package version (group)\n regex = /^\\w+\\/(\\S+)\\s+(\\S+)/\n\n process.each_line do |line|\n hash = {}\n\n if match = line.match(regex)\n fields.zip(match.captures) do |field, value|\n hash[field] = value\n end\n\n hash[:provider] = self.name\n packages << new(hash)\n else\n warning('Failed to match line %s' % line)\n end\n end\n end\n rescue Puppet::ExecutionFailure\n return nil\n end\n\n return packages\n end",
"def main_widgets\n drop_targets.where(html_id: \"drop-target-main\").first.try(:widgets) || []\n end",
"def remove_all_widgets\n array = @browser.div(:id=>\"add_goodies_body\").lis.select { |li| li.class_name == \"remove\" }\n sub_array = array.select { |li| li.visible? }\n sub_array.each do |li|\n li.button(:text=>\"Remove\").click\n wait_for_ajax\n end\n close_add_widget\n end",
"def names name = \"\"\n find_all_by_name( name ).map(&:name)\n end",
"def element(name)\n elements.find { |el| el.name == name.to_s }\n end",
"def instances #:nodoc:\n r = []\n ObjectSpace.each_object(self) { |mod| r << mod }\n r\n end",
"def kitchen_instances(regexp, config)\n instances = Kitchen::Config.new(config).instances\n return instances if regexp.nil? || regexp == 'all'\n instances.get_all(Regexp.new(regexp))\n end",
"def names\n [name]\n end",
"def find_all(name)\n if name and not name.empty?\n proxy_owner.send(:list_queues, \"QueueNamePrefix\" => name)\n else\n proxy_target\n end\n end",
"def remove_widget(name)\n @browser.div(:id=>\"add_goodies_body\").li(:text=>/#{Regexp.escape(name)}/, :id=>/_remove_/).button.click\n end",
"def widgets= mine_widgets\n @form.wigets = mine_widgets\n end",
"def get(name)\n self._list.detect { |entry| entry.name == name.to_sym }\n end"
] |
[
"0.7471749",
"0.6291563",
"0.6247767",
"0.62255275",
"0.60761404",
"0.60491467",
"0.60024506",
"0.5961512",
"0.5910529",
"0.58980614",
"0.5896949",
"0.5856864",
"0.58459985",
"0.5744007",
"0.5697456",
"0.5674075",
"0.56366825",
"0.5594575",
"0.55323553",
"0.553062",
"0.5500948",
"0.5463807",
"0.5389068",
"0.5350646",
"0.5340579",
"0.53342116",
"0.5331278",
"0.53265554",
"0.5295322",
"0.52914286",
"0.528603",
"0.5283481",
"0.52810186",
"0.52671105",
"0.5262851",
"0.5225023",
"0.52119267",
"0.51954985",
"0.5173309",
"0.5171906",
"0.51642954",
"0.5152714",
"0.512354",
"0.50971866",
"0.50125873",
"0.5003524",
"0.49939945",
"0.49869728",
"0.49824935",
"0.49765354",
"0.49750215",
"0.4958803",
"0.49413612",
"0.49357486",
"0.49127203",
"0.4912471",
"0.4912471",
"0.49072993",
"0.49069986",
"0.49062428",
"0.49038914",
"0.4900316",
"0.48550442",
"0.4846735",
"0.48365217",
"0.48340476",
"0.48229575",
"0.48182613",
"0.48176727",
"0.48159915",
"0.48156905",
"0.48011443",
"0.47969952",
"0.479382",
"0.4787756",
"0.47798818",
"0.47757703",
"0.47709343",
"0.47696564",
"0.47532",
"0.47497672",
"0.47424254",
"0.47391564",
"0.47359705",
"0.47346303",
"0.47072566",
"0.47018656",
"0.47009334",
"0.46942464",
"0.46941516",
"0.46863607",
"0.4684854",
"0.46846664",
"0.46825716",
"0.46815285",
"0.4672263",
"0.466496",
"0.46537736",
"0.46497992",
"0.46398336"
] |
0.68105316
|
1
|
rerun one or more assertions until either they all pass, or Capybara::UI times out, which will result in a test failure.
|
def eventually(wait_time = Capybara.default_max_wait_time, &block)
Checkpoint.wait_for wait_time, &block
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def test02_4GroupsRepostArticle\n\t\trepostArticlePop\n\t\tsleep 3\n\t\tfourGroupSelect\n\t\tsleep 3\n\t\t\n\t\tbegin \n\t\tassert $repost_confirmation.exists?\n\t\t\trescue => e\n\t\t\tputs \"RS06T02: FAILED! User unable to repost!\"\n\t\t\tputs e\n\t\tend\n\tend",
"def test_040\n test_000\n login(\"root\",\"root\")\n create_2nd_user\n sleep WAIT_TIME\n (2..7).each do |i|\n if(i!=3)\n assert_equal \"\",@selenium.get_text($xpath[\"user\"][\"user_register\"]+\"/tr[#{i}]/td\")\n else\n assert_equal \"\",@selenium.get_text($xpath[\"user\"][\"user_register\"]+\"/tr[#{i}]/td/input[@id='user_last_name']\")\n assert_equal \"\",@selenium.get_text($xpath[\"user\"][\"user_register\"]+\"/tr[#{i}]/td/input[@id='user_first_name']\")\n end\n end\n logout\n end",
"def test_015\n test_000\n login(\"root\",\"root\")\n @selenium.open($xpath[\"admin_menu_page\"])\n sleep WAIT_TIME\n @selenium.click($xpath[\"user\"][\"user_management\"])\n sleep WAIT_TIME\n @selenium.click(\"link=#{$link_texts[\"register\"]}\")\n sleep WAIT_TIME\n user_id = @selenium.get_text($xpath[\"user\"][\"user_register\"]+\"/tr[1]/td\")\n @selenium.type \"user_account_name\", USER_ACCOUNT_NAME\n @selenium.type \"user_last_name\",USER_LAST_NAME\n @selenium.type \"user_first_name\", USER_FIRST_NAME\n @selenium.type \"user_password\", USER_PASSWORD\n @selenium.type \"user_password_confirmation\", USER_PASSWORD\n post_time = Time.now\n second = post_time.strftime(\"%S\")\n hour_and_minute = post_time.strftime(\"%H:%M:\")\n @selenium.click($xpath[\"pu_user\"][\"register_button\"])\n sleep WAIT_TIME\n delay = 10\n result = 0\n for i in 0..delay do\n second_delay = (second.to_i + i).to_s\n if second_delay.to_i < 10\n second_delay = '0'+second_delay\n end\n log_display = hour_and_minute + second_delay +\" \"+$messages[\"register_user_failed\"]\n if @selenium.is_text_present(log_display)\n result = 1\n break\n end\n end\n assert_equal result,1\n logout\n end",
"def test_019\n test_000\n login(\"root\",\"root\")\n @selenium.open($xpath[\"admin_menu_page\"])\n sleep WAIT_TIME\n @selenium.click($xpath[\"user\"][\"user_management\"])\n sleep WAIT_TIME\n @selenium.click(\"link=#{$link_texts[\"register\"]}\")\n sleep WAIT_TIME\n user_id = @selenium.get_text($xpath[\"user\"][\"user_register\"]+\"/tr[1]/td\")\n @selenium.type \"user_account_name\", USER_ACCOUNT_NAME\n @selenium.type \"user_last_name\",USER_LAST_NAME\n @selenium.type \"user_first_name\", USER_FIRST_NAME\n @selenium.type \"user_email\", USER_EMAIL\n @selenium.type \"user_password_confirmation\", USER_PASSWORD\n post_time = Time.now\n second = post_time.strftime(\"%S\")\n hour_and_minute = post_time.strftime(\"%H:%M:\")\n @selenium.click($xpath[\"pu_user\"][\"register_button\"])\n sleep WAIT_TIME\n delay = 10\n result = 0\n for i in 0..delay do\n second_delay = (second.to_i + i).to_s\n if second_delay.to_i < 10\n second_delay = '0'+second_delay\n end\n log_display = hour_and_minute + second_delay +\" \"+$messages[\"register_user_failed\"]\n if @selenium.is_text_present(log_display)\n result = 1\n break\n end\n end\n assert_equal result,1\n logout\n end",
"def test05_TwoGroupsRepostNote\n\t\trepostNotePop\n\t\tsleep 3\n \t\ttwoGroupSelect\n \t\tsleep 3\n\t\t\n\t\tbegin \n\t\tassert $repost_confirmation.exists?\n\t\t\trescue => e\n\t\t\tputs \"RS2T05: FAILED! User unable to repost!\"\n\t\t\tputs e\n\t\tend\n\tend",
"def test_033\n test_000\n login(\"root\",\"root\")\n create_1st_user\n sleep WAIT_TIME\n (2..7).each do |i|\n if(i!=3)\n assert_equal \"\",@selenium.get_text($xpath[\"user\"][\"user_register\"]+\"/tr[#{i}]/td\")\n else\n assert_equal \"\",@selenium.get_text($xpath[\"user\"][\"user_register\"]+\"/tr[#{i}]/td/input[@id='user_last_name']\")\n assert_equal \"\",@selenium.get_text($xpath[\"user\"][\"user_register\"]+\"/tr[#{i}]/td/input[@id='user_first_name']\")\n end\n end\n logout\n end",
"def wait_for_element_and_click(element)\n wait_for_element(element)\n \n i = 0\n begin\n @element.click\n rescue Exception => ex\n i+=1\n sleep(1)\n retry if i<20\n raise ex \n end\n \n end",
"def wait_until_done!\n retries = 0\n until done?\n secs = (2 * retries) + 5\n sleep secs\n retries += 1\n reload!\n end\n end",
"def patiently(seconds=Capybara.default_max_wait_time, &block)\n #puts \"Tried waiting\"\n old_wait_time = Capybara.default_max_wait_time\n # dont make nested wait_untils use up all the alloted time\n Capybara.default_max_wait_time = 0 # for we are a jealous gem\n if page.driver.wait?\n start_time = Time.now\n begin\n block.call\n rescue Exception => e\n raise e unless RETRY_ERRORS.include?(e.class.name)\n puts \"Failed: #{e.message}\" if SimpliTest.mode == 'DEBUG'\n wait_time = SimpliTest.config_settings ? SimpliTest.config_settings['MAX_WAIT_TIME'] : 5\n raise e if (Time.now - start_time) >= wait_time\n sleep(0.1)\n raise Capybara::FrozenInTime, \"time appears to be frozen, Capybara does not work with libraries which freeze time, consider using time travelling instead\" if Time.now == start_time\n puts \"Retrying...\" if SimpliTest.mode == 'DEBUG'\n retry\n end\n else\n block.call\n end\n ensure\n Capybara.default_max_wait_time = old_wait_time\n end",
"def test_017\n test_000\n login(\"root\",\"root\")\n create_1st_user(\"new_user\",\"new\",\"user\",\"\",\"abcdef\")\n sleep WAIT_TIME\n (2..7).each do |i|\n if(i!=3)\n assert_equal \"\",@selenium.get_text($xpath[\"user\"][\"user_register\"]+\"/tr[#{i}]/td\")\n else\n assert_equal \"\",@selenium.get_text($xpath[\"user\"][\"user_register\"]+\"/tr[#{i}]/td/input[@id='user_last_name']\")\n assert_equal \"\",@selenium.get_text($xpath[\"user\"][\"user_register\"]+\"/tr[#{i}]/td/input[@id='user_first_name']\")\n end\n end\n logout\n end",
"def test_011\n test_000\n login(\"root\",\"root\")\n @selenium.open($xpath[\"admin_menu_page\"])\n sleep WAIT_TIME\n @selenium.click($xpath[\"user\"][\"user_management\"])\n sleep WAIT_TIME\n @selenium.click(\"link=#{$link_texts[\"register\"]}\")\n sleep WAIT_TIME\n @selenium.type \"user_account_name\", USER_ACCOUNT_NAME\n @selenium.type \"user_last_name\",USER_LAST_NAME\n @selenium.type \"user_email\", USER_EMAIL\n @selenium.type \"user_password\", USER_PASSWORD\n @selenium.type \"user_password_confirmation\", USER_PASSWORD\n post_time = Time.now\n second = post_time.strftime(\"%S\")\n hour_and_minute = post_time.strftime(\"%H:%M:\")\n @selenium.click($xpath[\"pu_user\"][\"register_button\"])\n sleep WAIT_TIME\n delay = 60\n result = 0\n for i in 0..delay do\n second_delay = (second.to_i + i).to_s\n if second_delay.to_i < 10\n second_delay = '0'+second_delay\n end\n log_display = hour_and_minute + second_delay +\" \"+$messages[\"register_user_failed\"]\n if @selenium.is_text_present(log_display)\n result = 1\n end\n end\n assert_equal result,1\n end",
"def test_036\n test_000\n login(\"root\",\"root\")\n @selenium.open($xpath[\"admin_menu_page\"])\n sleep WAIT_TIME\n @selenium.click($xpath[\"user\"][\"user_management\"])\n sleep WAIT_TIME\n @selenium.click(\"link=#{$link_texts[\"register\"]}\")\n sleep WAIT_TIME\n @selenium.type \"user_account_name\", USER_ACCOUNT_NAME\n @selenium.type \"user_last_name\",USER_LAST_NAME\n @selenium.type \"user_first_name\", USER_FIRST_NAME\n @selenium.type \"user_email\", USER_EMAIL\n @selenium.type \"user_password\", USER_PASSWORD\n @selenium.type \"user_password_confirmation\", USER_PASSWORD\n @selenium.click($xpath[\"pu_user\"][\"register_button\"])\n sleep WAIT_TIME\n @selenium.type \"user_account_name\", NEW_USER_ACCOUNT_NAME\n @selenium.type \"user_last_name\",NEW_USER_LAST_NAME\n @selenium.type \"user_first_name\", NEW_USER_FIRST_NAME\n @selenium.type \"user_email\", NEW_USER_EMAIL\n @selenium.type \"user_password\", NEW_USER_PASSWORD\n @selenium.type \"user_password_confirmation\", NEW_USER_PASSWORD\n post_time = Time.now\n second = post_time.strftime(\"%S\")\n hour_and_minute = post_time.strftime(\"%H:%M:\")\n @selenium.click($xpath[\"pu_user\"][\"register_button\"])\n run_script(\"destroy_subwindow()\")\n sleep WAIT_TIME\n delay = 60\n result = 0\n for i in 0..delay do\n second_delay = (second.to_i + i).to_s\n if second_delay.to_i < 10\n second_delay = '0'+ second_delay\n end\n log_display =hour_and_minute + second_delay +\" \" + $messages[\"register_user_success\"].sub(\"_NEW_USER_\",NEW_USER_LAST_NAME)\n if @selenium.is_text_present(log_display)\n result = 1\n break\n end\n end\n assert_equal result,1\n end",
"def test_027\n test_000\n login(\"root\",\"root\")\n @selenium.open($xpath[\"admin_menu_page\"])\n sleep WAIT_TIME\n @selenium.click($xpath[\"user\"][\"user_management\"])\n sleep WAIT_TIME\n @selenium.click(\"link=#{$link_texts[\"register\"]}\")\n sleep WAIT_TIME\n @selenium.type \"user_account_name\", USER_ACCOUNT_NAME\n @selenium.type \"user_last_name\", USER_LAST_NAME\n @selenium.type \"user_first_name\", USER_FIRST_NAME\n @selenium.type \"user_email\", USER_EMAIL\n @selenium.type \"user_password\", USER_PASSWORD\n @selenium.type \"user_password_confirmation\", WRONG_PASSWORD\n @selenium.click($xpath[\"pu_user\"][\"register_button\"])\n sleep WAIT_TIME\n (2..7).each do |i|\n if(i!=3)\n assert_equal \"\",@selenium.get_text($xpath[\"user\"][\"user_register\"]+\"/tr[#{i}]/td\")\n else\n assert_equal \"\",@selenium.get_text($xpath[\"user\"][\"user_register\"]+\"/tr[#{i}]/td/input[@id='user_last_name']\")\n assert_equal \"\",@selenium.get_text($xpath[\"user\"][\"user_register\"]+\"/tr[#{i}]/td/input[@id='user_first_name']\")\n end\n end\n logout\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 test04_4GroupsRepostEvent\n\t\trepostEventPop\n\t\tsleep 3\n\t\tfourGroupSelect\n\t\t\n\t\tsleep 3\n\t\t\n\t\tbegin \n\t\tassert $repost_confirmation.exists?\n\t\t\trescue => e\n\t\t\tputs \"RS06T04: FAILED! User unable to repost!\"\n\t\t\tputs e\n\t\tend\n\tend",
"def test_024\n test_000\n login(\"root\",\"root\")\n @selenium.open($xpath[\"admin_menu_page\"])\n sleep WAIT_TIME\n @selenium.click($xpath[\"user\"][\"user_management\"])\n sleep WAIT_TIME\n @selenium.click(\"link=#{$link_texts[\"register\"]}\")\n sleep WAIT_TIME\n @selenium.type \"user_account_name\", USER_ACCOUNT_NAME\n @selenium.type \"user_last_name\", USER_LAST_NAME\n @selenium.type \"user_first_name\", USER_FIRST_NAME\n @selenium.type \"user_email\", USER_EMAIL\n @selenium.type \"user_password\", USER_PASSWORD\n @selenium.click($xpath[\"pu_user\"][\"register_button\"])\n sleep WAIT_TIME\n (2..7).each do |i|\n if(i!=3)\n assert_equal \"\",@selenium.get_text($xpath[\"user\"][\"user_register\"]+\"/tr[#{i}]/td\")\n else\n assert_equal \"\",@selenium.get_text($xpath[\"user\"][\"user_register\"]+\"/tr[#{i}]/td/input[@id='user_last_name']\")\n assert_equal \"\",@selenium.get_text($xpath[\"user\"][\"user_register\"]+\"/tr[#{i}]/td/input[@id='user_first_name']\")\n end\n end\n logout\n end",
"def wait_trn\n $tester.cycle(repeat: trn + 1)\n end",
"def check_rerun\n\tcontent = get_junit_line\n\n\t# Check number of failures, nb of errors, nb of tests\n\t/failures=\\\"(?<failure>[^\\\"]*)\\\"/ =~ content\n\t/errors=\\\"(?<error>[^\\\"]*)\\\"/ =~ content\n\t# /skipped=\\\"([^\\\"]*)\\\"/ =~ content\n\t/tests=\\\"(?<test>[^\\\"]*)\\\"/ =~ content\n\n\terrors = error.to_i + failure.to_i\n\tratio = errors.to_f / test.to_f\n\n\t# Debug line and return results\n\tif ratio == 0\n\t\tputs \"Nothing to rerun\"\n\telsif ratio > 0 && ratio < 0.4\n\t\tputs \"Rerun\"\n\telse\n\t\tputs \"Too many errors (#{errors} / #{test}) , please launch again the whole job\"\n\tend\n\tratio\nend",
"def test02_GroupRepostArticle\n\t\trepostArticlePop\n\t\tsleep 3\n\t\tgroupAddRemoveAdd\n \t\tsleep 3\n\t\t\n\t\tbegin \n\t\tassert $repost_confirmation.exists?\n\t\t\trescue => e\n\t\t\tputs \"RS2T02: FAILED! User unable to repost!\"\n\t\t\tputs e\n\t\tend\n\tend",
"def run_tests\n puts \"Running exactly #{@spec.size} tests.\"\n @spec.each do |test_case|\n sleep test_case.wait_before_request\n response = send_request_for(test_case)\n Checker.available_plugins.each do |plugin|\n result = @expectation.check(plugin, response, test_case)\n if not result.success?\n putc \"F\"\n @results << result\n break\n else\n if plugin == Checker.available_plugins.last\n @results << result\n putc \".\"\n end\n end\n end\n end\n end",
"def test_013\n test_000\n login(\"root\",\"root\")\n create_1st_user(\"new_user\",\"new\",\"\",\"newuser@tsdv.com.vn\",\"abcdef\")\n sleep WAIT_TIME\n (2..7).each do |i|\n if(i!=3)\n assert_equal \"\",@selenium.get_text($xpath[\"user\"][\"user_register\"]+\"/tr[#{i}]/td\")\n else\n assert_equal \"\",@selenium.get_text($xpath[\"user\"][\"user_register\"]+\"/tr[#{i}]/td/input[@id='user_last_name']\")\n assert_equal \"\",@selenium.get_text($xpath[\"user\"][\"user_register\"]+\"/tr[#{i}]/td/input[@id='user_first_name']\")\n end\n end\n logout\n end",
"def test_009\n test_000\n login(\"root\",\"root\")\n create_1st_user(\"new_user\",\"\",\"user\",\"newuser@tsdv.com.vn\",\"abcdef\")\n sleep WAIT_TIME\n (2..7).each do |i|\n if(i!=3)\n assert_equal \"\",@selenium.get_text($xpath[\"user\"][\"user_register\"]+\"/tr[#{i}]/td\")\n else\n assert_equal \"\",@selenium.get_text($xpath[\"user\"][\"user_register\"]+\"/tr[#{i}]/td/input[@id='user_last_name']\")\n assert_equal \"\",@selenium.get_text($xpath[\"user\"][\"user_register\"]+\"/tr[#{i}]/td/input[@id='user_first_name']\")\n end\n end\n logout\n end",
"def test_021\n test_000\n login(\"root\",\"root\")\n @selenium.open($xpath[\"admin_menu_page\"])\n sleep WAIT_TIME\n @selenium.click($xpath[\"user\"][\"user_management\"])\n sleep WAIT_TIME\n @selenium.click(\"link=#{$link_texts[\"register\"]}\")\n sleep WAIT_TIME\n @selenium.type \"user_account_name\", USER_ACCOUNT_NAME\n @selenium.type \"user_last_name\", USER_LAST_NAME\n @selenium.type \"user_first_name\", USER_FIRST_NAME\n @selenium.type \"user_email\", USER_EMAIL\n @selenium.type \"user_password_confirmation\", USER_PASSWORD\n @selenium.click($xpath[\"pu_user\"][\"register_button\"])\n sleep WAIT_TIME\n (2..7).each do |i|\n if(i!=3)\n assert_equal \"\",@selenium.get_text($xpath[\"user\"][\"user_register\"]+\"/tr[#{i}]/td\")\n else\n assert_equal \"\",@selenium.get_text($xpath[\"user\"][\"user_register\"]+\"/tr[#{i}]/td/input[@id='user_last_name']\")\n assert_equal \"\",@selenium.get_text($xpath[\"user\"][\"user_register\"]+\"/tr[#{i}]/td/input[@id='user_first_name']\")\n end\n end\n logout\n end",
"def test_006\n test_000\n login(\"root\",\"root\")\n create_1st_user(\"\",\"new\",\"user\",\"newuser@tsdv.com.vn\",\"abcdef\")\n sleep WAIT_TIME\n (2..7).each do |i|\n if(i!=3)\n assert_equal \"\",@selenium.get_text($xpath[\"user\"][\"user_register\"]+\"/tr[#{i}]/td\")\n else\n assert_equal \"\",@selenium.get_text($xpath[\"user\"][\"user_register\"]+\"/tr[#{i}]/td/input[@id='user_last_name']\")\n assert_equal \"\",@selenium.get_text($xpath[\"user\"][\"user_register\"]+\"/tr[#{i}]/td/input[@id='user_first_name']\")\n end\n end\n logout\n end",
"def test03_4GroupsRepostMedia\n\t\trepostMediaPop\n\t\tsleep 3\n\t\tfourGroupSelect\n\t\tsleep 3\n\t\t\n\t\tbegin \n\t\tassert $repost_confirmation.exists?\n\t\t\trescue => e\n\t\t\tputs \"RS06T03: FAILED! User unable to repost!\"\n\t\t\tputs e\n\t\tend\n\tend",
"def wait_templates_on_the_screen(expected_num_templates_on_screen, template_path, timeout = 20, threshold_value = 0.8, take_res_if_expect_fail = true)\n logc(\"method: #{__method__}, params: #{expected_num_templates_on_screen}, #{template_path},\" + \n \" #{timeout}, #{threshold_value} #{take_res_if_expect_fail}\")\n\n time_start = Time.now\n time_end = time_start + timeout.to_i\n logc(\"Checking will be ended at '#{time_end}'\")\n\n res_image_path = File.join(@report_path,\n \"#{@scenario_name.to_s.gsub(\" \", \"_\").downcase}\" +\n \"_result_find_template_\" +\n \"#{File.basename(template_path)}\")\n\n #wait for time_end reached OR expectation reached\n res_of_finding = nil\n occurrences = nil\n attempt_counter = 1\n while true\n attempt_time = Time.now\n logc(\"Attempt: '#{attempt_counter}', time: #{attempt_time}\")\n res_of_finding = find_templates_on_the_screen(template_path, res_image_path, threshold_value)\n occurrences = res_of_finding[\"point_clouds\"].to_i\n\n if (occurrences == expected_num_templates_on_screen) || (attempt_time > time_end)\n break\n else\n attempt_counter += 1\n sleep 1\n end\n end\n\n assert_false_custom(occurrences.nil? || res_of_finding.nil?,\n \"Error: template occurrences or res_of_finding on image can't be nil. Check find method\")\n\n logc(\"Occurrences found: #{occurrences}\\n Time spent to wait expected result: #{Time.now - time_start}\")\n\n is_expectation_reached = (occurrences == expected_num_templates_on_screen)\n # remove_file_if_exist(res_image_path) if is_expectation_reached || !take_res_if_expect_fail\n\n return res_of_finding\nend",
"def test_NewQuestionSetsErrors\n randomName = SecureRandom.hex(4)\n \n #PRECONDITION: Must be logged in\n Common.login(Users::USER_EMAIL, Users::PASSWORD)\n \n # 1 - Go to \"Question Sets\" Tab\n Common.goToTab(HomePage::QUESTION_SETS_LINK_XPATH)\n \n test = [\n {\"displayed\" => QuestionSetsHomePage::QUESTION_SETS_HOME_BTN_NEW_XPATH},\n # 2 - Click on New button \n {\"click_and_load\" => QuestionSetsHomePage::QUESTION_SETS_HOME_BTN_NEW_XPATH},\n {\"displayed\" => QuestionSetsNew::QUESTION_SETS_NEW_BTN_SAVE_XPATH},\n # 4 - Click on \"Save\" button \n {\"click_and_load\" => QuestionSetsNew::QUESTION_SETS_NEW_BTN_SAVE_XPATH},\n ]\n Common.main(test)\n \n #RESULT\n assert $wait.until{\n $browser.find_element(:xpath => QuestionSetsNew::ERROR_NAME_QUESTION_SETS_NEW_XPATH).displayed?\n $browser.find_element(:xpath => QuestionSetsNew::ERROR_NAME_QUESTION_SETS_NEW_XPATH).text == QuestionSetsNew::ERROR_NAME_QUESTION_SETS_NEW_TEXT\n }\n \n # 5 - Fill all the required fields\n $browser.find_element(:id => QuestionSetsNew::QUESTION_SETS_NEW_NAME_ID).send_keys randomName\n \n # 6 - Enter invalid value into number fields (\"Passing Score\").\n $browser.find_element(:xpath => QuestionSetsNew::QUESTIONS_SETS_NEW_PASSING_SCORE_XPATH).send_keys QuestionSetsNew::QUESTION_SETS_PASSING_SCORE_INVALID_TEXT\n \n # 7 - Click on \"Save\" button\n $browser.find_element(:xpath => QuestionSetsNew::QUESTION_SETS_NEW_BTN_SAVE_XPATH).click\n \n $wait.until{\n $browser.find_element(:xpath => QuestionSetsNew::ERROR_NUMBER_QUESTION_SETS_NEW_XPATH).displayed?\n }\n \n #RESULT\n assert_equal($browser.find_element(:xpath => QuestionSetsNew::ERROR_NUMBER_QUESTION_SETS_NEW_XPATH).text, QuestionSetsNew::ERROR_NUMBER_QUESTION_SETS_NEW_TEXT) \n \n end",
"def retry_block(n = MAX_NODE_QUERY_RETRIES, &block)\n begin\n block.call\n rescue Selenium::WebDriver::Error::StaleElementReferenceError, Capybara::TimeoutError, Capybara::ElementNotFound, Selenium::WebDriver::Error::UnknownError, Capybara::Driver::Webkit::NodeNotAttachedError\n if (n -= 1) >= 0\n sleep(30 / (n + 1))\n retry\n else\n raise\n end\n end\nend",
"def all_failing\n all(\"#qunit-tests .fail\")\n end",
"def test_ID_25825_invalid_password\n login $user_1_email, $master_password\n go_to_change_password_page\n verify_text \"Change your Password\", \"Old password\" , \"New password\", \"Confirm password\"\n \n $profile_old_pass.when_present().set $master_password\n assert !($profile_save_changes.enabled?)\n $profile_new_pass.when_present().set \"newValidPass\"\n assert !($profile_save_changes.enabled?)\n $profile_confirm_pass.when_present().set \"unMatchedPass\"\n assert !($profile_save_changes.enabled?)\n \n $profile_old_pass.when_present().set $master_password\n $profile_new_pass.when_present().set \"newValidPass\"\n $profile_confirm_pass.when_present().set \"newValidPass\"\n assert $profile_save_changes.enabled?\n \n $profile_old_pass.when_present().set $master_password\n $profile_new_pass.when_present().set \"newValidPass\"\n $profile_confirm_pass.when_present().set \"unMatchedPass\"\n sleep 3\n assert $browser.text.include? \"Please make sure that your passwords match\"\n $profile_confirm_pass.when_present().set newValidPass\n sleep 3\n assert !($browser.text.include? \"Please make sure that your passwords match\")\n \n $profile_old_pass.when_present().set oldWrongPass\n $profile_new_pass.when_present().set \"pass11\"\n $profile_confirm_pass.when_present().set \"pass11\"\n $profile_save_changes.when_present().click\n sleep 3 \"pass11\"\n verify_text \"Password incorrect\"\n \n $profile_old_pass.when_present().clear\n $profile_old_pass.when_present().set \"oldPassword\"\n $profile_new_pass.when_present().clear\n $profile_new_pass.when_present().set \"pass\"\n $profile_confirm_pass.when_present().clear\n $profile_confirm_pass.when_present().set \"pass\"\n $profile_save_changes.when_present().click\n sleep 3 \n \n verify_text \"Please check for errors\", \"Must be at least 7 characters\"\n end",
"def wait_until\n Timeout.timeout(Capybara.default_max_wait_time) do\n loop until yield\n end\nend",
"def await_failure_delay\n while @fail_wait_mutex.locked?\n sleep(1.second)\n end\n end",
"def wait_until\n Timeout.timeout(Capybara.default_wait_time) do\n loop until yield\n end\n end",
"def wait_until_done!\n backoff = lambda do |retries|\n delay = [(retries**2) + 5, 60].min # Maximum delay is 60\n sleep delay\n end\n retries = 0\n until done?\n backoff.call retries\n retries += 1\n reload!\n end\n end",
"def test03_post_closed_news_TwoGroupsRepostArticle\n\t\trepostArticlePop\n\t\tsleep 3\n\t\ttwoGroupSelect\n\t\tsleep 3\n\t\t\n\t\tassert $repost_confirmation.exists?\n\tend",
"def long_wait_for_element(yaml_data_key, times = 6)\n how = get_yaml_data( yaml_data_key, 0 )\n what = get_yaml_data( yaml_data_key, 1 )\n e = nil\n times.times do\n # note that find-element auto-waits\n begin\n e = $driver.find_element(how, what)\n rescue Exception => error\n $debug and print \"Got exception in long_wait_for_element: #{error}\\n\"\n end\n if e and e.displayed?\n $debug and print \"element in long_wait_for_element: #{e.inspect}\\n\"\n break\n end\n $debug and print \"waiting in long_wait_for_elemnt\\n\"\n\n sleep 10\n end\n e.should be_displayed\n return e\n end",
"def test_passwordresetlinkmultipleloginattempts\n loginpage = Hudl_Login_Page.new @@driver\n\n loginpage.LogIn(@@longusername, \"\")\n loginpage.LogIn(@@longusername, \"\")\n loginpage.LogIn(@@longusername, \"\")\n loginpage.LogIn(@@longusername, \"\")\n loginpage.LogIn(@@longusername, \"\")\n loginpage.LogIn(@@longusername, \"\")\n\n loginpage.ClickPasswordResetLink()\n\n end",
"def wait_for_ajax\n\tTimeout.timeout(Capybara.default_wait_time) do\n loop until finished_all_ajax_requests?\n end\nend",
"def retry_action_with_scroll_down\n tries ||= 2\n yield\nrescue Capybara::ElementNotFound, Selenium::WebDriver::Error::UnknownError\n navigation.scroll_down\n retry unless (tries -= 1).zero?\nend",
"def wait_until_without_failing(timeout=UI_UPDATE_DELAY)\n start = Time.now\n while ((Time.now - start) <= timeout)\n break if yield\n sleep(WaitHelpers::LOOP_DELAY)\n end\nend",
"def wait_for_ajax\n Timeout.timeout(Capybara.default_max_wait_time) do\n loop until finished_all_ajax_requests?\n end\n rescue => ex\n p ex\n $logger.error(ex) # armazena o erro em logs.\n end",
"def test_025\n test_000\n login(\"root\",\"root\")\n @selenium.open($xpath[\"admin_menu_page\"])\n sleep WAIT_TIME\n @selenium.click($xpath[\"user\"][\"user_management\"])\n sleep WAIT_TIME\n @selenium.click(\"link=#{$link_texts[\"register\"]}\")\n sleep WAIT_TIME\n user_id = @selenium.get_text($xpath[\"user\"][\"user_register\"]+\"/tr[1]/td\")\n @selenium.type \"user_account_name\", USER_ACCOUNT_NAME\n @selenium.type \"user_last_name\",USER_LAST_NAME\n @selenium.type \"user_first_name\", USER_FIRST_NAME\n @selenium.type \"user_email\", USER_EMAIL\n @selenium.type \"user_password\", USER_PASSWORD\n @selenium.click($xpath[\"pu_user\"][\"register_button\"])\n sleep WAIT_TIME\n begin\n assert_equal user_id, @selenium.get_text($xpath[\"user\"][\"user_register\"]+\"/tr[1]/td\")\n rescue Test::Unit::AssertionFailedError\n @verification_errors << $!\n end\n logout\n end",
"def verifyMyAccountLinks()\n\t\n\tputs \"************** START: Verify MyAccount Links ****************\"\n\t\n\tputs \"Step 1 : Verify all the links under My Account screen.\"\n\t$browser.click \"//img[@alt='Your profile picture']\"\n\t$browser.wait_for_page_to_load \n\tbegin\n\t\tassert $browser.is_text_present(\"Your Account on Razoo\")\n\t\tputs \"Step 1.1 : User has reached the Account page successfully.\"\n\trescue Test::Unit::AssertionFailedError\n\t\tputs \"Step 1.1 : User had failed to reach the Account page.\"\n\t\t$verification_errors << $!\n\tend\n\t$browser.click \"link=Edit Profile\"\n\t$browser.wait_for_page_to_load \n\tbegin\n\t\tassert $browser.is_text_present(\"Edit My Profile\")\n\t\tputs \"Step 1.2 : User has reached the EditMyProfile page successfully.\"\n\trescue Test::Unit::AssertionFailedError\n\t\tputs \"Step 1.2 : User had failed to reach the EditMyProfile page.\"\n\t\t$verification_errors << $!\n\tend\n\t$browser.click \"link=My Donations\"\n\t$browser.wait_for_page_to_load \n\tbegin\n\t\tassert $browser.is_text_present(\"Start donating\")\n\t\tputs \"Step 1.3 : User has reached the My Donations page successfully.\"\n\trescue Test::Unit::AssertionFailedError\n\t\tputs \"Step 1.3 : User had failed to reach the My Donations page.\"\n\t\t$verification_errors << $!\n\tend\n\t$browser.click \"link=Account Settings\"\n\t$browser.wait_for_page_to_load \n\tbegin\n\t\tassert $browser.is_text_present(\"Change your login information\")\n\t\tputs \"Step 1.4 : User has reached the Account Settings page successfully.\"\n\trescue Test::Unit::AssertionFailedError\n\t\tputs \"Step 1.4 : User had failed to reach the Account Settings page.\"\n\t\t$verification_errors << $!\n\tend\n\tbegin\n\t\tassert $browser.is_element_present(\"link=My Saved Cards\")\n\t\t$browser.click \"link=My Saved Cards\"\n\t\t$browser.wait_for_page_to_load \n\t\tbegin\n\t\t\tassert $browser.is_text_present(\"My Credit Cards\")\n\t\t\tputs \"Step 1.5 : User has reached the My Saved Card page successfully.\"\n\t\trescue Test::Unit::AssertionFailedError\n\t\t\tputs \"Step 1.5 : User had failed to reach the My Saved Card page.\"\n\t\t\t$verification_errors << $!\n\t\tend\n\trescue\n\t\t$verification_errors << $!\n\t\tputs \"Step 1.5 : My Saved card link is not available for this User.\"\n\tend\n\t\n\tputs \"************** END: Verify MyAccount Links ****************\"\n\t\nend",
"def verifySignupLoginLinks()\n\t\n\tputs \"************** START: Verify SignUp Login Links ****************\"\n\tputs \"Step 1 : Click on Sign Up Link at the Header.\"\n\t$browser.click \"link=Sign up\"\n\t$browser.wait_for_page_to_load \n\tbegin\n\t\tassert $browser.is_text_present(\"Create an account on Razoo\")\n\t\tputs \"Step 1 is passed. User has reached the Sign Up screen successfully.\"\n\trescue Test::Unit::AssertionFailedError\n\t\tputs \"Step 1 is Failed. User had failed to reach the Sign Up screen.\"\n\t\t$verification_errors << $!\n\tend\n\t\n\tputs \"Step 2 : Click on Login Link in the Sign up screen.\"\n\t$browser.click \"link=Log in\"\n\t$browser.wait_for_page_to_load \n\tbegin\n\t\tassert $browser.is_text_present(\"Log in\")\n\t\tputs \"Step 2 is passed. User has reached the Login screen successfully.\"\n\trescue Test::Unit::AssertionFailedError\n\t\tputs \"Step 2 is Failed. User had failed to reach the Login screen.\"\n\t\t$verification_errors << $!\n\tend\n\t\n\tputs \"Step 3 : Click on Forgot Password Link in the Login screen.\"\n\t$browser.click \"link=exact:Forgot login details?\"\n\t$browser.wait_for_page_to_load \n\tbegin\n\t\tassert $browser.is_text_present(\"Reset Your Password\")\n\t\tputs \"Step 3 is passed. User has reached the Reset Your Password screen successfully.\"\n\trescue Test::Unit::AssertionFailedError\n\t\tputs \"Step 3 is Failed. User had failed to reach the Reset Your Password screen.\"\n\t\t$verification_errors << $!\n\tend\n\t\n\tputs \"************** END: Verify SignUp Login Links ****************\"\nend",
"def finish\n\t\tbegin\n\t\t\twait = Selenium::WebDriver::Wait.new(:timeout => 5)\n\t\t\tbegin # Handles A/B testing\n\t\t\t wait.until { $selenium_driver.find_element(:id => \"newPassword\").displayed? }\n\t\t\t $selenium_driver.find_element(:id, \"newPassword\").clear\n\t\t\t $selenium_driver.find_element(:id, \"newPassword\").send_keys params[:password]\n\t\t\t $selenium_driver.find_element(:id, \"confirmPassword\").clear\n\t\t\t $selenium_driver.find_element(:id, \"confirmPassword\").send_keys params[:password]\n\t\t\t $selenium_driver.find_element(:id, \"reset-password-submit-button\").click\n\t\t\trescue Selenium::WebDriver::Error::TimeOutError => e\n\t\t\t\twait.until { $selenium_driver.find_element(:id => \"challenge-input\").displayed? }\n\t\t\t $selenium_driver.find_element(:id, \"challenge-input\").clear\n\t\t\t $selenium_driver.find_element(:id, \"challenge-input\").send_keys params[:temp_code]\n\n\t\t\t wait = Selenium::WebDriver::Wait.new(:timeout => 5)\n\t\t\t\twait.until { $selenium_driver.find_element(:css, \"div.cp-challenge-actions.form-actions > input.btn-submit\").displayed? }\n\t\t\t $selenium_driver.find_element(:css, \"div.cp-challenge-actions.form-actions > input.btn-submit\").click\n\t\t\t \n\t\t\t wait = Selenium::WebDriver::Wait.new(:timeout => 5)\n\t\t\t\twait.until { $selenium_driver.find_element(:id => \"new_password-newPassword-passwordReset\").displayed? }\n\t\t\t\t$selenium_driver.find_element(:id, \"new_password-newPassword-passwordReset\").clear\n\t\t\t $selenium_driver.find_element(:id, \"new_password-newPassword-passwordReset\").send_keys params[:password]\n\t\t\t $selenium_driver.find_element(:id, \"new_password_again-newPassword-passwordReset\").clear\n\t\t\t $selenium_driver.find_element(:id, \"new_password_again-newPassword-passwordReset\").send_keys params[:password]\n\t\t\t $selenium_driver.find_element(:id, \"reset\").click\n\t\t\tend\n\n\t \trender :json => {\"website\": \"linkedin\", \"status\": \"Password reset successful!\"} # Replace WEBSITE with appropiate website name\n\n\t rescue Exception => e\n\t\t\tputs e.to_s\n\t\t\tputs e.backtrace\n\t\t\trender :status => 500, :json => {\"website\": \"linkedin\", \"status\": \"Password reset failed!\"} # Replace WEBSITE with appropiate website name\n\t\tend\n\tend",
"def test04_GroupRepostEvent\n\t\trepostEventPop\n\t\tsleep 3\n\t\tgroupAddRemoveAdd\n \t\tsleep 3\n\t\t\n\t\tbegin \n\t\tassert $repost_confirmation.exists?\n\t\t\trescue => e\n\t\t\tputs \"RS2T04: FAILED! User unable to repost!\"\n\t\t\tputs e\n\t\tend\n\tend",
"def verifySignupLoginLinks()\n\t\n\tputs \"************** START: Verify SignUp Login Links ****************\"\n\tputs \"Step 1 : Click on Sign Up Link at the Header.\"\n\t$browser.click \"link=Sign up\"\n\t$browser.wait_for_page_to_load \n\tbegin\n\t\tassert $browser.is_text_present(\"Create an account on Razoo\")\n\t\tputs \"Step 1 is passed. User has reached the Sign Up screen successfully.\"\n\trescue Test::Unit::AssertionFailedError\n\t\tputs \"Step 1 is Failed. User had failed to reach the Sign Up screen.\"\n\t\t$verification_errors << $!\n\tend\n\t\n\tputs \"Step 2 : Click on Login Link in the Sign up screen.\"\n\t$browser.click \"link=Log In\"\n\t$browser.wait_for_page_to_load \n\tbegin\n\t\tassert $browser.is_text_present(\"Log in\")\n\t\tputs \"Step 2 is passed. User has reached the Login screen successfully.\"\n\trescue Test::Unit::AssertionFailedError\n\t\tputs \"Step 2 is Failed. User had failed to reach the Login screen.\"\n\t\t$verification_errors << $!\n\tend\n\t\n\tputs \"Step 3 : Click on Forgot Password Link in the Login screen.\"\n\t$browser.click \"link=exact:Forgot login details?\"\n\t$browser.wait_for_page_to_load \n\tbegin\n\t\tassert $browser.is_text_present(\"Reset Your Password\")\n\t\tputs \"Step 3 is passed. User has reached the Reset Your Password screen successfully.\"\n\trescue Test::Unit::AssertionFailedError\n\t\tputs \"Step 3 is Failed. User had failed to reach the Reset Your Password screen.\"\n\t\t$verification_errors << $!\n\tend\n\t\n\tputs \"************** END: Verify SignUp Login Links ****************\"\nend",
"def verifySignupLoginLinks()\n\t\n\tputs \"************** START: Verify SignUp Login Links ****************\"\n\tputs \"Step 1 : Click on Sign Up Link at the Header.\"\n\t$browser.click \"link=Sign up\"\n\t$browser.wait_for_page_to_load \n\tbegin\n\t\tassert $browser.is_text_present(\"Create an account on Razoo\")\n\t\tputs \"Step 1 is passed. User has reached the Sign Up screen successfully.\"\n\trescue Test::Unit::AssertionFailedError\n\t\tputs \"Step 1 is Failed. User had failed to reach the Sign Up screen.\"\n\t\t$verification_errors << $!\n\tend\n\t\n\tputs \"Step 2 : Click on Login Link in the Sign up screen.\"\n\t$browser.click \"link=Log In\"\n\t$browser.wait_for_page_to_load \n\tbegin\n\t\tassert $browser.is_text_present(\"Log in\")\n\t\tputs \"Step 2 is passed. User has reached the Login screen successfully.\"\n\trescue Test::Unit::AssertionFailedError\n\t\tputs \"Step 2 is Failed. User had failed to reach the Login screen.\"\n\t\t$verification_errors << $!\n\tend\n\t\n\tputs \"Step 3 : Click on Forgot Password Link in the Login screen.\"\n\t$browser.click \"link=exact:Forgot login details?\"\n\t$browser.wait_for_page_to_load \n\tbegin\n\t\tassert $browser.is_text_present(\"Reset Your Password\")\n\t\tputs \"Step 3 is passed. User has reached the Reset Your Password screen successfully.\"\n\trescue Test::Unit::AssertionFailedError\n\t\tputs \"Step 3 is Failed. User had failed to reach the Reset Your Password screen.\"\n\t\t$verification_errors << $!\n\tend\n\t\n\tputs \"************** END: Verify SignUp Login Links ****************\"\nend",
"def verifyStoryAdminLinks()\n\t\n\tputs \"************** START: Verify PRO page Links ****************\"\n\t\n\tputs \"Step 1 : Click on EditPage link on the Story page.\"\n\t$browser.click \"link=Edit\"\n\t$browser.wait_for_page_to_load \n\tbegin\n\t\tassert $browser.is_text_present(\"Tell Your Story\")\n\t\tputs \"Step 1 is Passed. User has reached the EditPage screen successfully.\"\n\trescue Test::Unit::AssertionFailedError\n\t\tputs \"Step 1 is Failed. User had failed to reach EditPage screen.\"\n\t\t$verification_errors << $!\n\tend\n\t\n\tputs \"Step 3 : Click on Matching Grants link on the Story page.\"\n\t$browser.click \"link=Matching Grants\"\n\t$browser.wait_for_page_to_load \n\tbegin\n\t\tassert $browser.is_text_present(\"Set Up a Matching Grant\")\n\t\tputs \"Step 3 is Passed. User has reached the Matching Grants screen successfully.\"\n\trescue Test::Unit::AssertionFailedError\n\t\tputs \"Step 3 is Failed. User had failed to reach Matching Grants screen.\"\n\t\t$verification_errors << $!\n\tend\n\t\n\t\n\tputs \"Step 6 : Click on Donations link on the Story page.\"\n\t$browser.click \"link=Donations\"\n\t$browser.wait_for_page_to_load \n\tbegin\n\t\tassert $browser.is_text_present(\"Donations Listing\")\n\t\tputs \"Step 6 is Passed. User has reached the Donations screen successfully.\"\n\trescue Test::Unit::AssertionFailedError\n\t\tputs \"Step 6 is Failed. User had failed to reach Donations screen.\"\n\t\t$verification_errors << $!\n\tend\n\t\n\tputs \"************** END: Verify PRO page Links ****************\"\n\t\nend",
"def verifyMyAccountLinks()\n\t\n\tputs \"************** START: Verify MyAccount Links ****************\"\n\t\n\tputs \"Step 1 : Verify all the links under My Account screen.\"\n\t$browser.click \"myAccountHeaderLink\"\n\t$browser.wait_for_page_to_load \n\tbegin\n\t\tassert $browser.is_text_present(\"My Account\")\n\t\tputs \"Step 1.1 : User has reached the Account page successfully.\"\n\trescue Test::Unit::AssertionFailedError\n\t\tputs \"Step 1.1 : User had failed to reach the Account page.\"\n\t\t$verification_errors << $!\n\tend\n\t$browser.click \"link=Edit My Profile\"\n\t$browser.wait_for_page_to_load \n\tbegin\n\t\tassert $browser.is_text_present(\"Edit My Profile\")\n\t\tputs \"Step 1.2 : User has reached the EditMyProfile page successfully.\"\n\trescue Test::Unit::AssertionFailedError\n\t\tputs \"Step 1.2 : User had failed to reach the EditMyProfile page.\"\n\t\t$verification_errors << $!\n\tend\n\t$browser.click \"link=My Donations\"\n\t$browser.wait_for_page_to_load \n\tbegin\n\t\tassert $browser.is_text_present(\"Start donating\")\n\t\tputs \"Step 1.3 : User has reached the My Donations page successfully.\"\n\trescue Test::Unit::AssertionFailedError\n\t\tputs \"Step 1.3 : User had failed to reach the My Donations page.\"\n\t\t$verification_errors << $!\n\tend\n\t$browser.click \"link=Account Settings\"\n\t$browser.wait_for_page_to_load \n\tbegin\n\t\tassert $browser.is_text_present(\"Change your login information\")\n\t\tputs \"Step 1.4 : User has reached the Account Settings page successfully.\"\n\trescue Test::Unit::AssertionFailedError\n\t\tputs \"Step 1.4 : User had failed to reach the Account Settings page.\"\n\t\t$verification_errors << $!\n\tend\n\tbegin\n\t\tassert $browser.is_element_present(\"link=My Saved Cards\")\n\t\t$browser.click \"link=My Saved Cards\"\n\t\t$browser.wait_for_page_to_load \n\t\tbegin\n\t\t\tassert $browser.is_text_present(\"My Credit Cards\")\n\t\t\tputs \"Step 1.5 : User has reached the My Saved Card page successfully.\"\n\t\trescue Test::Unit::AssertionFailedError\n\t\t\tputs \"Step 1.5 : User had failed to reach the My Saved Card page.\"\n\t\t\t$verification_errors << $!\n\t\tend\n\trescue\n\t\t$verification_errors << $!\n\t\tputs \"Step 1.5 : My Saved card link is not available for this User.\"\n\tend\n\t\n\tputs \"************** END: Verify MyAccount Links ****************\"\n\t\nend",
"def verifyMyAccountLinks()\n\t\n\tputs \"************** START: Verify MyAccount Links ****************\"\n\t\n\tputs \"Step 1 : Verify all the links under My Account screen.\"\n\t$browser.click \"myAccountHeaderLink\"\n\t$browser.wait_for_page_to_load \n\tbegin\n\t\tassert $browser.is_text_present(\"My Account\")\n\t\tputs \"Step 1.1 : User has reached the Account page successfully.\"\n\trescue Test::Unit::AssertionFailedError\n\t\tputs \"Step 1.1 : User had failed to reach the Account page.\"\n\t\t$verification_errors << $!\n\tend\n\t$browser.click \"link=Edit My Profile\"\n\t$browser.wait_for_page_to_load \n\tbegin\n\t\tassert $browser.is_text_present(\"Edit My Profile\")\n\t\tputs \"Step 1.2 : User has reached the EditMyProfile page successfully.\"\n\trescue Test::Unit::AssertionFailedError\n\t\tputs \"Step 1.2 : User had failed to reach the EditMyProfile page.\"\n\t\t$verification_errors << $!\n\tend\n\t$browser.click \"link=My Donations\"\n\t$browser.wait_for_page_to_load \n\tbegin\n\t\tassert $browser.is_text_present(\"Start donating\")\n\t\tputs \"Step 1.3 : User has reached the My Donations page successfully.\"\n\trescue Test::Unit::AssertionFailedError\n\t\tputs \"Step 1.3 : User had failed to reach the My Donations page.\"\n\t\t$verification_errors << $!\n\tend\n\t$browser.click \"link=Account Settings\"\n\t$browser.wait_for_page_to_load \n\tbegin\n\t\tassert $browser.is_text_present(\"Change your login information\")\n\t\tputs \"Step 1.4 : User has reached the Account Settings page successfully.\"\n\trescue Test::Unit::AssertionFailedError\n\t\tputs \"Step 1.4 : User had failed to reach the Account Settings page.\"\n\t\t$verification_errors << $!\n\tend\n\tbegin\n\t\tassert $browser.is_element_present(\"link=My Saved Cards\")\n\t\t$browser.click \"link=My Saved Cards\"\n\t\t$browser.wait_for_page_to_load \n\t\tbegin\n\t\t\tassert $browser.is_text_present(\"My Credit Cards\")\n\t\t\tputs \"Step 1.5 : User has reached the My Saved Card page successfully.\"\n\t\trescue Test::Unit::AssertionFailedError\n\t\t\tputs \"Step 1.5 : User had failed to reach the My Saved Card page.\"\n\t\t\t$verification_errors << $!\n\t\tend\n\trescue\n\t\t$verification_errors << $!\n\t\tputs \"Step 1.5 : My Saved card link is not available for this User.\"\n\tend\n\t\n\tputs \"************** END: Verify MyAccount Links ****************\"\n\t\nend",
"def test_002\n test_000\n login(\"root\",\"root\")\n ## delete user \"pj_member\"\n delete_user(3)\n @selenium.open($xpath[\"admin_menu_page\"])\n sleep WAIT_TIME\n @selenium.click($xpath[\"user\"][\"user_management\"])\n sleep WAIT_TIME\n begin\n assert @selenium.is_element_present($xpath[\"user\"][\"user_list_row\"]+\"[1]/th[1]\")\n rescue Test::Unit::AssertionFailedError\n @verification_errors << $!\n end\n begin\n assert @selenium.is_element_present($xpath[\"user\"][\"user_list_row\"]+\"[2]/td[1]\")\n rescue Test::Unit::AssertionFailedError\n @verification_errors << $!\n end\n begin\n assert_equal ADMIN_NAME, @selenium.get_text($xpath[\"user\"][\"user_list_row\"]+\"[2]/td[4]\")\n rescue Test::Unit::AssertionFailedError\n @verification_errors << $!\n end\n #only admin\n (1..9).each do |i|\n begin\n assert !@selenium.is_element_present($xpath[\"user\"][\"user_list_row\"]+\"[3]/td[#{i}]\")\n rescue Test::Unit::AssertionFailedError\n @verification_errors << $!\n end\n end\n logout\n end",
"def atest_ID_25891_scheduled_posts_01\n login $user_1_email, $master_password\n go_to_edit_profile_page\n $profiles_your_posts.click\n sleep 5\n scheduledPostCount = count_scheduled_current\n if (scheduledPostCount < 5)\n i=1\n while i < 3\n $browser.goto($patch_note)\n $post_pick_group.when_present().click\n $group_select.when_present().select(\"Sports\")\n $post_compose_note.wait_until_present()\n $browser.link(:text, \"Basketball\").when_present().click\n $post_compose_note.when_present().set(\"Note field populated by automated test.\")\n $advanced_options.when_present().click\n currentTime = Time.now() + 2\n currentDate = currentTime.strftime(\"%Y-%m-%d\")\n $post_advanced_calendar.when_present().set(\"#{currentDate}\")\n $post_advanced_time.when_present().set(\"11:00 PM\")\n sleep 3\n $browser.link(:text => /11:00/).click\n $profile_schedule.when_present().fire_event(\"onclick\")\n sleep 3\n i = i+1\n end\n end\n end",
"def teardown\n @driver.quit\n assert_equal [], @verification_errors\n end",
"def teardown\n @driver.quit\n assert_equal [], @verification_errors\n end",
"def teardown\n @driver.quit\n assert_equal [], @verification_errors\n end",
"def teardown\n @driver.quit\n assert_equal [], @verification_errors\n end",
"def teardown\n @driver.quit\n assert_equal [], @verification_errors\n end",
"def teardown\n @driver.quit\n assert_equal [], @verification_errors\n end",
"def teardown\n @driver.quit\n assert_equal [], @verification_errors\n end",
"def teardown\n @driver.quit\n assert_equal [], @verification_errors\n end",
"def teardown\n @driver.quit\n assert_equal [], @verification_errors\n end",
"def teardown\n @driver.quit\n assert_equal [], @verification_errors\n end",
"def verifyStoryAdminLinks()\n\t\n\tputs \"************** START: Verify PRO page Links ****************\"\n\t\n\tputs \"Step 1 : Click on EditPage link on the Story page.\"\n\t$browser.click \"link=Edit Page\"\n\t$browser.wait_for_page_to_load \n\tbegin\n\t\tassert $browser.is_text_present(\"The Basics\")\n\t\tputs \"Step 1 is Passed. User has reached the EditPage screen successfully.\"\n\trescue Test::Unit::AssertionFailedError\n\t\tputs \"Step 1 is Failed. User had failed to reach EditPage screen.\"\n\t\t$verification_errors << $!\n\tend\n\n\tputs \"Step 2 : Click on Thumbnail link on the Story page.\"\n\t$browser.click \"link=Thumbnail\"\n\t$browser.wait_for_page_to_load \n\tbegin\n\t\tassert $browser.is_text_present(\"Current Thumbnail\")\n\t\tputs \"Step 2 is Passed. User has reached the Thumbnail screen successfully.\"\n\trescue Test::Unit::AssertionFailedError\n\t\tputs \"Step 2 is Failed. User had failed to reach Thumbnail screen.\"\n\t\t$verification_errors << $!\n\tend\n\t\n\tputs \"Step 3 : Click on Matching Grants link on the Story page.\"\n\t$browser.click \"link=Matching Grants\"\n\t$browser.wait_for_page_to_load \n\tbegin\n\t\tassert $browser.is_text_present(\"Grantor\")\n\t\tputs \"Step 3 is Passed. User has reached the Matching Grants screen successfully.\"\n\trescue Test::Unit::AssertionFailedError\n\t\tputs \"Step 3 is Failed. User had failed to reach Matching Grants screen.\"\n\t\t$verification_errors << $!\n\tend\n\t\n\tputs \"Step 4 : Click on Promote link on the Story page.\"\n\t$browser.click \"link=Promote\"\n\t$browser.wait_for_page_to_load \n\tbegin\n\t\tassert $browser.is_text_present(\"Or get a donation button to put on your website\")\n\t\tputs \"Step 4 is Passed. User has reached the Promote screen successfully.\"\n\trescue Test::Unit::AssertionFailedError\n\t\tputs \"Step 4 is Failed. User had failed to reach Promote screen.\"\n\t\t$verification_errors << $!\n\tend\n\t\n\tputs \"Step 5 : Click on DonateAnywhere link on the Story page.\"\n\t$browser.click \"link=DonateAnywhere\"\n\t$browser.wait_for_page_to_load \n\tbegin\n\t\tassert $browser.is_text_present(\"DonateAnywhere\")\n\t\tputs \"Step 5 is Passed. User has reached the DonateAnywhere screen successfully.\"\n\trescue Test::Unit::AssertionFailedError\n\t\tputs \"Step 5 is Failed. User had failed to reach DonateAnywhere screen.\"\n\t\t$verification_errors << $!\n\tend\n\t\n\tputs \"Step 6 : Click on Donations link on the Story page.\"\n\t$browser.click \"link=Donations\"\n\t$browser.wait_for_page_to_load \n\tbegin\n\t\tassert $browser.is_text_present(\"Donations Listing\")\n\t\tputs \"Step 6 is Passed. User has reached the Donations screen successfully.\"\n\trescue Test::Unit::AssertionFailedError\n\t\tputs \"Step 6 is Failed. User had failed to reach Donations screen.\"\n\t\t$verification_errors << $!\n\tend\n\t\n\tputs \"************** END: Verify PRO page Links ****************\"\n\t\nend",
"def verifyStoryAdminLinks()\n\t\n\tputs \"************** START: Verify PRO page Links ****************\"\n\t\n\tputs \"Step 1 : Click on EditPage link on the Story page.\"\n\t$browser.click \"link=Edit Page\"\n\t$browser.wait_for_page_to_load \n\tbegin\n\t\tassert $browser.is_text_present(\"The Basics\")\n\t\tputs \"Step 1 is Passed. User has reached the EditPage screen successfully.\"\n\trescue Test::Unit::AssertionFailedError\n\t\tputs \"Step 1 is Failed. User had failed to reach EditPage screen.\"\n\t\t$verification_errors << $!\n\tend\n\n\tputs \"Step 2 : Click on Thumbnail link on the Story page.\"\n\t$browser.click \"link=Thumbnail\"\n\t$browser.wait_for_page_to_load \n\tbegin\n\t\tassert $browser.is_text_present(\"Current Thumbnail\")\n\t\tputs \"Step 2 is Passed. User has reached the Thumbnail screen successfully.\"\n\trescue Test::Unit::AssertionFailedError\n\t\tputs \"Step 2 is Failed. User had failed to reach Thumbnail screen.\"\n\t\t$verification_errors << $!\n\tend\n\t\n\tputs \"Step 3 : Click on Matching Grants link on the Story page.\"\n\t$browser.click \"link=Matching Grants\"\n\t$browser.wait_for_page_to_load \n\tbegin\n\t\tassert $browser.is_text_present(\"Grantor\")\n\t\tputs \"Step 3 is Passed. User has reached the Matching Grants screen successfully.\"\n\trescue Test::Unit::AssertionFailedError\n\t\tputs \"Step 3 is Failed. User had failed to reach Matching Grants screen.\"\n\t\t$verification_errors << $!\n\tend\n\t\n\tputs \"Step 4 : Click on Promote link on the Story page.\"\n\t$browser.click \"link=Promote\"\n\t$browser.wait_for_page_to_load \n\tbegin\n\t\tassert $browser.is_text_present(\"Or get a donation button to put on your website\")\n\t\tputs \"Step 4 is Passed. User has reached the Promote screen successfully.\"\n\trescue Test::Unit::AssertionFailedError\n\t\tputs \"Step 4 is Failed. User had failed to reach Promote screen.\"\n\t\t$verification_errors << $!\n\tend\n\t\n\tputs \"Step 5 : Click on DonateAnywhere link on the Story page.\"\n\t$browser.click \"link=DonateAnywhere\"\n\t$browser.wait_for_page_to_load \n\tbegin\n\t\tassert $browser.is_text_present(\"DonateAnywhere\")\n\t\tputs \"Step 5 is Passed. User has reached the DonateAnywhere screen successfully.\"\n\trescue Test::Unit::AssertionFailedError\n\t\tputs \"Step 5 is Failed. User had failed to reach DonateAnywhere screen.\"\n\t\t$verification_errors << $!\n\tend\n\t\n\tputs \"Step 6 : Click on Donations link on the Story page.\"\n\t$browser.click \"link=Donations\"\n\t$browser.wait_for_page_to_load \n\tbegin\n\t\tassert $browser.is_text_present(\"Donations Listing\")\n\t\tputs \"Step 6 is Passed. User has reached the Donations screen successfully.\"\n\trescue Test::Unit::AssertionFailedError\n\t\tputs \"Step 6 is Failed. User had failed to reach Donations screen.\"\n\t\t$verification_errors << $!\n\tend\n\t\n\tputs \"************** END: Verify PRO page Links ****************\"\n\t\nend",
"def test_single_item_result\n while_logged_in do\n with_queries do\n pass\n #assert_nothing_raised{ @conn.tasks(query:@single_page_query) }\n end\n end\n end",
"def test05_post_closed_board_TwoGroupsRepostNote\n\t\trepostNotePop\n\t\tsleep 3\n \t\ttwoGroupSelect\n \t\tsleep 3\n\t\t\n\t\tassert $repost_confirmation.exists?\n\tend",
"def step_3()\n\twait = Selenium::WebDriver::Wait.new(timeout: 3)\n\tsaa = SaaPage.new()\n\twait_longer = Selenium::WebDriver::Wait.new(timeout: 30)\n\ttest_val = TestValidation.new()\n\n\t#First name\n\ttest_val.text_input(saa.first_name,('a'..'z').to_a.shuffle[0,8].join + \"'\",false,saa.last_name)\n\n\t#Last name\n\ttest_val.text_input(saa.last_name, ('a'..'z').to_a.shuffle[0,8].join + \"-\" + ('a'..'z').to_a.shuffle[0,8].join, false, saa.first_name)\n\n\t#Email\n\ttest_val.text_input(saa.email, ('a'..'z').to_a.shuffle[0,8].join + \"@topnotchltd.com\", false, saa.first_name)\n\n\t#Month\n\ttest_val.text_input(saa.dob_month, rand(1 .. 12), false, saa.first_name)\n\n\t#Day\n\ttest_val.text_input(saa.dob_day, rand(1 .. 31), false, saa.first_name)\n\n\t#Year\n\ttest_val.text_input(saa.dob_year, \"1975\", false, saa.first_name)\n\n\t#Phone number\n\t#Area code\n\ttest_val.text_input(saa.pn_area_code, 666, false, saa.email)\n\n\t#Exchange code\n\ttest_val.text_input(saa.pn_exchange_code, 666, false, saa.email)\n\n\t#Suffix code\n\ttest_val.text_input(saa.pn_suffix_code, \"666666\", false, saa.email) #Extra characters just in case\n\n\t#Click on 'yes' under \"Does the patient have dental insurance?\"\n\twait.until { saa.insurance_yes.displayed? }\n\tsaa.insurance_yes.click\n\n\t#Wait for calander to propogate\n\twait_longer.until { saa.apt_time_header.displayed? }\nend",
"def atest_ID_25891_scheduled_posts_02\n login $user_1_email, $master_password\n go_to_edit_profile_page\n $profiles_your_posts.click\n sleep 5\n go_to_scheduled_tab_on_your_post_page\n verify_text \"Your Posts\",\"Current Drafts\", \"Scheduled Posts\", \"Published Posts\", \"Scheduled\"\n assert $profile_edit_post.exists?\n assert $profile_delete.exists?\n assert $count_of_scheduled.exists?\n end",
"def wait_until(states)\n Timeout.timeout(timeout, Errors::Backend::EntityTimeoutError) do\n loop do\n sleep waiter_step\n refresher.call waitee\n early_fail!\n break if wanted?(states)\n end\n end\n\n yield waitee if block_given?\n end",
"def test_007\n test_000\n login(\"root\",\"root\")\n @selenium.open($xpath[\"admin_menu_page\"])\n sleep WAIT_TIME\n @selenium.click($xpath[\"user\"][\"user_management\"])\n sleep WAIT_TIME\n @selenium.click(\"link=#{$link_texts[\"register\"]}\")\n sleep WAIT_TIME\n user_id = @selenium.get_text($xpath[\"user\"][\"user_register\"]+\"/tr[1]/td\")\n @selenium.type \"user_last_name\",USER_LAST_NAME\n @selenium.type \"user_first_name\",USER_FIRST_NAME\n @selenium.type \"user_email\", USER_EMAIL\n @selenium.type \"user_password\", USER_PASSWORD\n @selenium.type \"user_password_confirmation\", USER_PASSWORD\n @selenium.click($xpath[\"pu_user\"][\"register_button\"])\n sleep WAIT_TIME\n begin\n assert_equal user_id, @selenium.get_text($xpath[\"user\"][\"user_register\"]+\"/tr[1]/td\")\n rescue Test::Unit::AssertionFailedError\n @verification_errors << $!\n end\n logout\n end",
"def test03_GroupRepostMedia\n\t\trepostMediaPop\n\t\tsleep 3\n\t\tgroupAddRemoveAdd\n \t\tsleep 3\n\t\t\n\t\tbegin \n\t\tassert $repost_confirmation.exists?\n\t\t\trescue => e\n\t\t\tputs \"RS2T03: FAILED! User unable to repost!\"\n\t\t\tputs e\n\t\tend\n\tend",
"def wait_for_ajax\n Capybara.default_wait_time = 100\n Timeout.timeout(Capybara.default_wait_time) do\n loop until finished_all_ajax_requests?\n end\n end",
"def reset_checks\n @checks_remaining = 3\n end",
"def test04_250RepostArticle\n\t\trepostArticlePop\n\t\tsleep 3\n\t\trepostPopulate250\n\t\tsleep 3\n\t\t\n\t\tbegin \n\t\tassert $repost_confirmation.exists?\n\t\t\trescue => e\n\t\t\tputs \"RS4T04: FAILED! User unable to repost!\"\n\t\t\tputs e\n\t\tend\n\tend",
"def test_018\n test_000\n login(\"root\",\"root\")\n @selenium.open($xpath[\"admin_menu_page\"])\n sleep WAIT_TIME\n @selenium.click($xpath[\"user\"][\"user_management\"])\n sleep WAIT_TIME\n @selenium.click(\"link=#{$link_texts[\"register\"]}\")\n sleep WAIT_TIME\n user_id = @selenium.get_text($xpath[\"user\"][\"user_register\"]+\"/tr[1]/td\")\n @selenium.type \"user_account_name\", USER_ACCOUNT_NAME\n @selenium.type \"user_last_name\",USER_LAST_NAME\n @selenium.type \"user_first_name\", USER_FIRST_NAME\n @selenium.type \"user_password\", USER_PASSWORD\n @selenium.type \"user_password_confirmation\", USER_PASSWORD\n @selenium.click($xpath[\"pu_user\"][\"register_button\"])\n sleep WAIT_TIME\n begin\n assert_equal user_id, @selenium.get_text($xpath[\"user\"][\"user_register\"]+\"/tr[1]/td\")\n rescue Test::Unit::AssertionFailedError\n @verification_errors << $!\n end\n logout\n end",
"def wait_for_next_application_failure(failures_until_now)\n failures_now = 0\n count = 0\n while count < 90\n begin\n count += 1\n failures_now = num_container_failures\n if failures_now < failures_until_now+1\n puts \"* Try #{count}, waiting for application failure no. #{failures_until_now+1}, got #{failures_now}\"\n sleep 1\n else\n puts \"Got application failure no. #{failures_now}\"\n @app_failures = failures_now\n break\n end\n end\n end\n if failures_now != failures_until_now+1\n flunk \"Did not get application failure in #{count} seconds\"\n end\n end",
"def ensure_failed(broker, targets, response_dataset, max_retries: 30, query_interval: 1)\n transaction_ids = response_dataset.map { |data| data['transaction_id'] }\n agent_identities(targets).zip(transaction_ids).map do |identity, transaction_id|\n check_non_blocking_response(broker, identity, transaction_id, max_retries, query_interval) do |result|\n assert_equal('failure', result['status'], 'Action was expected to fail')\n assert_equal(nil, result['stdout'], 'Successful action expected to have no output on stdout')\n assert_equal(1, result['exitcode'], \"Successful action expected to have exit code #{exit_code}\")\n yield result['stderr'] if block_given?\n end\n end\nend",
"def wait_for_ajax\n Timeout.timeout(Capybara.default_max_wait_time) do\n loop until finished_all_ajax_requests?\n end\n end",
"def wait_for_ajax\n Timeout.timeout(Capybara.default_max_wait_time) do\n loop until finished_all_ajax_requests?\n end\n end",
"def wait_for_ajax\n Timeout.timeout(Capybara.default_wait_time) do\n loop until finished_all_ajax_requests?\n end\n end",
"def trap_error(&block)\n time_secs = 0\n begin\n fail \"\\nERROR: #{e}\\n\" if time_secs > 5.0\n yield\n rescue Capybara::ElementNotFound => e\n fail \"\\nCapybara::ElementNotFound => #{e}\\n\"\n rescue Selenium::WebDriver::Error::StaleElementReferenceError => e\n puts \"\\nError locating element: #{e} : retrying\"\n sleep 0.5\n time_secs += 0.5\n retry\n rescue Selenium::WebDriver::Error::ObsoleteElementError => e\n puts \"\\nError locating element: #{e} : retrying\"\n sleep 0.5\n time_secs += 0.5\n retry\n end\n end",
"def wait_and_click(sym, id)\n found_element = false\n\n #if the specified symbol and id point to multiple elements, we want to find the first visible one\n #and click that\n @wait.until do\n driver.find_elements(sym,id).shuffle.each do |element|\n if element.displayed? and element.enabled?\n @element=element\n found_element = true\n end \n \n end\n found_element \n end\n\n i = 0\n\n begin\n @element.click\n rescue Exception => ex\n i+=1\n sleep(1)\n retry if i<20\n raise ex \n end\n \n end",
"def wait(duration)\n for i in 0...duration\n update_basic(false, true, true)\n end\n end",
"def multi_element_check( elements )\n elements.each do |element|\n wait_for_element(element[0].to_sym, element[1])\n print \".\"\n end\n end",
"def teardown\n #@driver.quit\n assert_equal [], @verification_errors\n end",
"def verifyNPOAdminLinks(story_name)\n\t\n\tputs \"************** START: Verify ORG page Links ****************\"\n\t\n\tputs \"Click on MY NPO link at the Header.\"\n\tbegin \n\t\tassert $browser.is_element_present(\"link=My nonprofit\")\n\t\t$browser.click \"link=My nonprofit\"\n\t\t$browser.wait_for_page_to_load \n\t\tbegin\n\t\t\tassert $browser.is_text_present(story_name)\n\t\t\tputs \"Step 1 is Passed. User has reached the MY NPO screen successfully.\"\n\t\trescue Test::Unit::AssertionFailedError\n\t\t\tputs \"Step 1 is Failed. User had failed to reach MY NPO screen.\"\n\t\tend\n\trescue\n\t\t$browser.click \"link=My nonprofits\"\n\t\t$browser.wait_for_page_to_load\n\t\tbegin\n\t\t\tassert $browser.is_text_present(\"News Feed\")\n\t\t\tputs \"Step 1 is Passed. User has reached the Account screen successfully.\"\n\t\t\t$browser.click \"link=Harvard College\"\n\t\t\t$browser.wait_for_page_to_load\n\t\trescue Test::Unit::AssertionFailedError\n\t\t\tputs \"Step 1 is Failed. User had failed to reach Account screen.\"\n\t\tend\n\tend \n\tsleep 5\n\tputs \"Step 2 : Click on EditPage link on the Story page.\"\n\t$browser.click \"link=Edit\"\n\t$browser.wait_for_page_to_load \n\tbegin\n\t\tassert $browser.is_text_present(\"Tell Your Story\")\n\t\tputs \"Step 2 is Passed. User has reached the EditPage screen successfully.\"\n\trescue Test::Unit::AssertionFailedError\n\t\tputs \"Step 2 is Failed. User had failed to reach EditPage screen.\"\n\t\t$verification_errors << $!\n\tend\n\t\n\tputs \"Step 4 : Click on Matching Grants link on the Story page.\"\n\t$browser.click \"link=Matching Grants\"\n\t$browser.wait_for_page_to_load \n\tbegin\n\t\tassert $browser.is_text_present(\"Matching Grant\")\n\t\tputs \"Step 4 is Passed. User has reached the Matching Grants screen successfully.\"\n\trescue Test::Unit::AssertionFailedError\n\t\tputs \"Step 4 is Failed. User had failed to reach Matching Grants screen.\"\n\t\t$verification_errors << $!\n\tend\n\t\n\tputs \"Step 8 : Click on Donations link on the Story page.\"\n\t$browser.click \"link=Donations\"\n\t$browser.wait_for_page_to_load \n\tbegin\n\t\tassert $browser.is_text_present(\"Donations Listing\")\n\t\tputs \"Step 8 is Passed. User has reached the Donations screen successfully.\"\n\trescue Test::Unit::AssertionFailedError\n\t\tputs \"Step 8 is Failed. User had failed to reach Donations screen.\"\n\t\t$verification_errors << $!\n\tend\n\t\n\t# ------------------------------ Global Admin Links -----------------------------\n\tbegin \n\t\tassert $browser.is_element_present(\"link=Razoo Admins\")\n\t\tputs \"Step 10 : Click on Create Data Sources link on the Story page.\"\n\t\t$browser.click \"link=Data Sources\"\n\t\t$browser.wait_for_page_to_load \n\t\tbegin\n\t\t\tassert $browser.is_text_present(\"Razoo Admin Area\")\n\t\t\tputs \"Step 10 is Passed. User has reached the Data Sources screen successfully.\"\n\t\trescue Test::Unit::AssertionFailedError\n\t\t\tputs \"Step 10 is Failed. User had failed to reach Data Sources screen.\"\n\t\t\t$verification_errors << $!\n\t\tend\n\t\tputs \"Step 11 : Click on Create Audits link on the Story page.\"\n\t\t$browser.click \"link=Audits\"\n\t\t$browser.wait_for_page_to_load \n\t\tbegin\n\t\t\tassert $browser.is_text_present(\"PATRIOT Act\")\n\t\t\tputs \"Step 11 is Passed. User has reached the Audits screen successfully.\"\n\t\trescue Test::Unit::AssertionFailedError\n\t\t\tputs \"Step 11 is Failed. User had failed to reach Audits screen.\"\n\t\t\t$verification_errors << $!\n\t\tend\n\trescue\n\t\tputs \"Step 10 & 11 : I don't have access to view Data Sources and Audit links.\"\n\tend\n\t# ------------------------------ Global Admin Links -----------------------------\n\n\t\n\tputs \"************** END: Verify ORG page Links ****************\"\n\nend",
"def test_018\n\n # login\n login\n\n # Open PU management page\n open_pu_management_page_1\n\n #Find a PU\n\n @@pu = Pu.find_by_name('SamplePU1')\n open \"/devgroup/pu_index/#{@@pu.id}\"\n wait_for_page_to_load \"30000\"\n\n sleep 2\n\n #Find a PJ of PU\n open_pj_management_page(@@pu.id)\n\n @@pj = Pj.find_by_name('SamplePJ1')\n open\"/devgroup/pj_index/#{@@pu.id}/#{@@pj.id}\"\n wait_for_page_to_load \"30000\"\n\n #Open \"Registration of analysis task\" page\n open(\"/task/index2/#{@@pu.id}/#{@@pj.id}\")\n #Open master control tab\n click $xpath[\"task\"][\"main_area_td4\"]\n assert !60.times{ break if (is_text_present(_(\"Registration of an Analysis Task\")) rescue false); sleep 2 }\n #Master tab\n click $xpath[\"task\"][\"master_tab\"]\n assert !60.times{ break if (is_text_present(_(\"Select a master\")) rescue false); sleep 2 }\n assert is_text_present(\"qac\")\n sleep 3\n #Click link set of qac\n click $xpath[\"task\"][\"set_qac_link\"]\n\n sleep 3\n #wait for loading page\n wait_for_condition(\"Ajax.Request\",\"30000\")\n #An option is checked\n assert is_checked($xpath[\"task\"][\"master_option_chk2\"])\n #Click a directory link\n click $xpath[\"task\"][\"master_option_dir1\"]\n sleep 2\n #Click a sub directory link\n click $xpath[\"task\"][\"master_option_file1\"]\n sleep 2\n #uncheck a file\n\n click $xpath[\"task\"][\"master_option_chk5\"]\n sleep 2\n\n #The state of other check boxes is not influenced.\n assert is_checked($xpath[\"task\"][\"master_option_chk6\"])\n\n run_script \"destroy_subwindow()\"\n\n\n # logout\n logout\n\n end",
"def test_028\n test_000\n login(\"root\",\"root\")\n @selenium.open($xpath[\"admin_menu_page\"])\n sleep WAIT_TIME\n @selenium.click($xpath[\"user\"][\"user_management\"])\n sleep WAIT_TIME\n @selenium.click(\"link=#{$link_texts[\"register\"]}\")\n sleep WAIT_TIME\n user_id = @selenium.get_text($xpath[\"user\"][\"user_register\"]+\"/tr[1]/td\")\n @selenium.type \"user_account_name\", USER_ACCOUNT_NAME\n @selenium.type \"user_last_name\",USER_LAST_NAME\n @selenium.type \"user_first_name\", USER_FIRST_NAME\n @selenium.type \"user_email\", USER_EMAIL\n @selenium.type \"user_password\", USER_PASSWORD\n @selenium.type \"user_password_confirmation\", WRONG_PASSWORD\n @selenium.click($xpath[\"pu_user\"][\"register_button\"])\n sleep WAIT_TIME\n begin\n assert_equal user_id, @selenium.get_text($xpath[\"user\"][\"user_register\"]+\"/tr[1]/td\")\n rescue Test::Unit::AssertionFailedError\n @verification_errors << $!\n end\n logout\n end",
"def retry_block(attempts: 1, sleep_for: 0.5)\n begin\n yield\n rescue Capybara::ElementNotFound => ex\n if attempts > 0\n attempts -= 1\n sleep(sleep_for)\n retry\n else\n raise ex\n end\n end\n end",
"def test_014\n test_000\n login(\"root\",\"root\")\n @selenium.open($xpath[\"admin_menu_page\"])\n sleep WAIT_TIME\n @selenium.click($xpath[\"user\"][\"user_management\"])\n sleep WAIT_TIME\n @selenium.click(\"link=#{$link_texts[\"register\"]}\")\n sleep WAIT_TIME\n user_id = @selenium.get_text($xpath[\"user\"][\"user_register\"]+\"/tr[1]/td\")\n @selenium.type \"user_account_name\", USER_ACCOUNT_NAME\n @selenium.type \"user_last_name\",USER_LAST_NAME\n @selenium.type \"user_email\", USER_EMAIL\n @selenium.type \"user_password\", USER_PASSWORD\n @selenium.type \"user_password_confirmation\", USER_PASSWORD\n @selenium.click($xpath[\"pu_user\"][\"register_button\"])\n sleep WAIT_TIME\n begin\n assert_equal user_id, @selenium.get_text($xpath[\"user\"][\"user_register\"]+\"/tr[1]/td\")\n rescue Test::Unit::AssertionFailedError\n @verification_errors << $!\n end\n logout\n end",
"def test_035\n test_000\n login(\"root\",\"root\")\n create_2nd_user\n begin\n assert !@selenium.is_editable($xpath[\"pu_user\"][\"register_button\"])\n rescue Test::Unit::AssertionFailedError\n printf \"This Test Fail!\\n\"\n @verification_errors << $!\n end\n logout\n end",
"def wait_and_check(actual, expectation_name)\n attempt = 0\n\n QA::Runtime::Logger.debug(\n \"Running eventually matcher with '#{operator_msg}' operator with: '#{retry_args}' arguments\"\n )\n QA::Support::Retrier.retry_until(**retry_args, log: false) do\n QA::Runtime::Logger.debug(\"evaluating expectation, attempt: #{attempt += 1}\")\n\n public_send(expectation_name, actual)\n rescue RSpec::Expectations::ExpectationNotMetError, QA::Resource::ApiFabricator::ResourceNotFoundError\n false\n end\n rescue QA::Support::Repeater::RetriesExceededError, QA::Support::Repeater::WaitExceededError => e\n @e = e\n false\n end",
"def test_022\n test_000\n login(\"root\",\"root\")\n @selenium.open($xpath[\"admin_menu_page\"])\n sleep WAIT_TIME\n @selenium.click($xpath[\"user\"][\"user_management\"])\n sleep WAIT_TIME\n @selenium.click(\"link=#{$link_texts[\"register\"]}\")\n sleep WAIT_TIME\n user_id = @selenium.get_text($xpath[\"user\"][\"user_register\"]+\"/tr[1]/td\")\n @selenium.type \"user_account_name\", USER_ACCOUNT_NAME\n @selenium.type \"user_last_name\",USER_LAST_NAME\n @selenium.type \"user_first_name\", USER_FIRST_NAME\n @selenium.type \"user_email\", USER_EMAIL\n @selenium.type \"user_password_confirmation\", USER_PASSWORD\n @selenium.click($xpath[\"pu_user\"][\"register_button\"])\n sleep WAIT_TIME\n begin\n assert_equal user_id, @selenium.get_text($xpath[\"user\"][\"user_register\"]+\"/tr[1]/td\")\n rescue Test::Unit::AssertionFailedError\n @verification_errors << $!\n end\n logout\n end",
"def test_038\n test_000\n login(\"root\",\"root\")\n create_2nd_user\n run_script(\"destroy_subwindow()\")\n sleep WAIT_TIME\n total_user=get_xpath_count($xpath[\"user\"][\"user_list_row\"])\n assert_equal NEW_USER_LAST_NAME + \" \"+ NEW_USER_FIRST_NAME, @selenium.get_text($xpath[\"user\"][\"user_list_row\"]+\"[#{total_user}]/td[4]\")\n assert_equal NEW_USER_EMAIL, @selenium.get_text($xpath[\"user\"][\"user_list_row\"]+\"[#{total_user}]/td[6]\")\n logout\n end",
"def check_table_contents(id, state, timeout=nil, recurse=true)\r\n begin\r\n count = page_all_xpath(\"//table[@id='\" + id + \"']/tbody/tr\").count\r\n if state == \"empty\"\r\n if count == 1\r\n # Empty tables have a single row with a single indicator label in it\r\n indicator = page_all_xpath(\"//table[@id='\" + id + \"']/tbody/tr/td/div/div/div/div[@class='gwt-Label']\").count\r\n if indicator != 1\r\n # I only want to sleep if the initial check doesn't work, because it slows down the tests\r\n if (recurse)\r\n timeout = normalize_timeout(timeout)\r\n sleep(timeout)\r\n check_table_contents(id, state, timeout, false)\r\n else\r\n raise \"Expected empty table, but found rows\"\r\n end\r\n end\r\n elsif count > 1\r\n # I only want to sleep if the initial check doesn't work, because it slows down the tests\r\n if (recurse)\r\n timeout = normalize_timeout(timeout)\r\n sleep(timeout)\r\n check_table_contents(id, state, timeout, false)\r\n else\r\n raise \"Expected empty table, but found rows\"\r\n end\r\n end\r\n elsif state == \"not empty\"\r\n if count == 1\r\n # Empty tables have a single row with a single indicator label in it\r\n indicator = page_all_xpath(\"//table[@id='\" + id + \"']/tbody/tr/td/div/div/div/div[@class='gwt-Label']\").count\r\n if indicator == 1\r\n # I only want to sleep if the initial check doesn't work, because it slows down the tests\r\n if (recurse)\r\n timeout = normalize_timeout(timeout)\r\n sleep(timeout)\r\n check_table_contents(id, state, timeout, false)\r\n else\r\n raise \"Expected non-empty table, but did not find rows\"\r\n end\r\n end\r\n elsif count < 1\r\n # I only want to sleep if the initial check doesn't work, because it slows down the tests\r\n if (recurse)\r\n timeout = normalize_timeout(timeout)\r\n sleep(timeout)\r\n check_table_contents(id, state, timeout, false)\r\n else\r\n raise \"Expected non-empty table, but did not find rows\"\r\n end\r\n end\r\n end\r\n rescue Selenium::WebDriver::Error::StaleElementReferenceError\r\n retry\r\n end\r\n end",
"def test_041\n test_000\n login(\"root\",\"root\")\n @selenium.open($xpath[\"admin_menu_page\"])\n sleep WAIT_TIME\n @selenium.click($xpath[\"user\"][\"user_management\"])\n sleep WAIT_TIME\n @selenium.click(\"link=#{$link_texts[\"register\"]}\")\n sleep WAIT_TIME\n user_id = @selenium.get_text($xpath[\"user\"][\"user_register\"]+\"/tr[1]/td\")\n create_2nd_user\n sleep WAIT_TIME\n new_user_id= @selenium.get_text($xpath[\"user\"][\"user_register\"]+\"/tr[1]/td\")\n user_id = user_id.to_i\n new_user_id=new_user_id.to_i\n assert user_id +2 , new_user_id\n logout\n end",
"def test_016\n\n # login\n login\n\n # Open PU management page\n open_pu_management_page_1\n\n #Find a PU\n\n @@pu = Pu.find_by_name('SamplePU1')\n open \"/devgroup/pu_index/#{@@pu.id}\"\n wait_for_page_to_load \"30000\"\n\n sleep 2\n\n #Find a PJ of PU\n open_pj_management_page(@@pu.id)\n\n @@pj = Pj.find_by_name('SamplePJ1')\n open\"/devgroup/pj_index/#{@@pu.id}/#{@@pj.id}\"\n wait_for_page_to_load \"30000\"\n\n #Open \"Registration of analysis task\" page\n open(\"/task/index2/#{@@pu.id}/#{@@pj.id}\")\n #Open master control tab\n click $xpath[\"task\"][\"main_area_td4\"]\n assert !60.times{ break if (is_text_present(_(\"Registration of an Analysis Task\")) rescue false); sleep 2 }\n #Master tab\n click $xpath[\"task\"][\"master_tab\"]\n assert !60.times{ break if (is_text_present(_(\"Select a master\")) rescue false); sleep 2 }\n assert is_text_present(\"qac\")\n sleep 3\n #Click link set of qac\n click $xpath[\"task\"][\"set_qac_link\"]\n\n sleep 3\n #wait for loading page\n wait_for_condition(\"Ajax.Request\",\"30000\")\n #An option setup was performed\n\n assert is_checked($xpath[\"task\"][\"master_option_chk2\"])\n\n #uncheck an option setup of a directory.\n click $xpath[\"task\"][\"master_option_chk2\"]\n sleep 3\n\n #Click a directory link\n click $xpath[\"task\"][\"master_option_dir1\"]\n sleep 2\n assert !is_checked($xpath[\"task\"][\"master_option_chk3\"])\n assert !is_checked($xpath[\"task\"][\"master_option_chk4\"])\n\n\n run_script \"destroy_subwindow()\"\n\n\n # logout\n logout\n\n end",
"def _test_pages_available\n #execute this code x number of times\n @custom_number_of_users.times do |i|\n puts 'Running tests for user #'+i.to_s\n # assert_section nil\n end\n end",
"def test_changeStatusValidation\n Common.login(Users::USER_EMAIL, Users::PASSWORD)\n Common.goToTab(HomePage::REQUISITION_TAB_LINK_XPATH)\n test = [{\"displayed\" =>RequisitionsHomePage::REQUISITIONS_PAGE_FIRST_ENTRY_SELECT_XPATH},\n {\"click\" => RequisitionsHomePage::REQUISITIONS_PAGE_FIRST_ENTRY_SELECT_XPATH},\n {\"click\" => RequisitionsHomePage::REQUISITIONS_PAGE_BTN_CHANGE_STATUS_JOBS_XPATH},\n {\"displayed\" => RequisitionsChangeStatus::REQUISITIONS_CHANGE_STATUS_NEW_STATUS_XPATH},\n {\"click\" => RequisitionsChangeStatus::REQUISITIONS_CHANGE_STATUS_BTN_UPDATE_STATUS_XPATH}]\n Common.main(test)\n assert $wait.until {\n $browser.find_element(:xpath, RequisitionsChangeStatus::ERROR_STATUS_MUST_BE_SELECTED).displayed?\n }\nend",
"def run_all\n passed = @runner.run_all!\n\n throw :task_has_failed unless passed\n end"
] |
[
"0.59381896",
"0.5861545",
"0.5833031",
"0.5802814",
"0.5767462",
"0.5763799",
"0.5761762",
"0.5761372",
"0.57537913",
"0.5729829",
"0.5718388",
"0.5703899",
"0.56978977",
"0.5696707",
"0.569051",
"0.56802905",
"0.5666066",
"0.5663195",
"0.5642982",
"0.5642401",
"0.5626163",
"0.56108046",
"0.5562459",
"0.5530855",
"0.55281246",
"0.5514952",
"0.550173",
"0.5495789",
"0.5485059",
"0.5476087",
"0.54719055",
"0.54712486",
"0.54711884",
"0.5444845",
"0.543703",
"0.5433542",
"0.54314804",
"0.54234076",
"0.54201597",
"0.53929335",
"0.5384218",
"0.5377479",
"0.53748244",
"0.53595376",
"0.53562796",
"0.53543925",
"0.5351997",
"0.5351997",
"0.5342191",
"0.53406215",
"0.53406215",
"0.5330577",
"0.5311474",
"0.5307277",
"0.5307277",
"0.5307277",
"0.5307277",
"0.5307277",
"0.5307277",
"0.5307277",
"0.5307277",
"0.5307277",
"0.5307277",
"0.530425",
"0.530425",
"0.52965474",
"0.529218",
"0.5282449",
"0.52737665",
"0.52678263",
"0.5264265",
"0.5259826",
"0.52571344",
"0.5256562",
"0.5255764",
"0.5250293",
"0.5248742",
"0.5246594",
"0.5243841",
"0.5243841",
"0.52347416",
"0.52344954",
"0.5232714",
"0.522848",
"0.5226963",
"0.5223041",
"0.5216331",
"0.52140534",
"0.52120507",
"0.5206349",
"0.52041745",
"0.5200295",
"0.5197824",
"0.519029",
"0.51860195",
"0.5184487",
"0.51793706",
"0.5165333",
"0.5164522",
"0.51547116",
"0.51533705"
] |
0.0
|
-1
|
Needs a better name
|
def new_url_friendly_token
self.title.downcase.gsub(/\.|!|,|:|\/|\\|"|'|\?/, "").gsub(/\s+/, '-')
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def private; end",
"def probers; end",
"def specie; end",
"def specie; end",
"def specie; end",
"def specie; end",
"def schubert; end",
"def custom; end",
"def custom; end",
"def formation; end",
"def who_we_are\r\n end",
"def terpene; end",
"def suivre; end",
"def verdi; end",
"def loc; end",
"def loc; end",
"def loc; end",
"def internal; end",
"def extra; end",
"def stderrs; end",
"def intensifier; end",
"def implementation; end",
"def implementation; end",
"def probers=(_arg0); end",
"def refutal()\n end",
"def berlioz; end",
"def operations; end",
"def operations; end",
"def same; end",
"def anchored; end",
"def jack_handey; end",
"def pos; end",
"def pos; end",
"def pos; end",
"def pos; end",
"def pos; end",
"def pos; end",
"def identify; end",
"def ismn; end",
"def specialty; end",
"def r; end",
"def r; end",
"def from; end",
"def from; end",
"def from; end",
"def from; end",
"def position; end",
"def position; end",
"def position; end",
"def position; end",
"def position; end",
"def position; end",
"def position; end",
"def position; end",
"def used?; end",
"def trd; end",
"def returns; end",
"def parslet; end",
"def parslet; end",
"def parslet; end",
"def parslet; end",
"def flag; end",
"def real_name; end",
"def code_of_conduct; end",
"def internship_passed; end",
"def villian; end",
"def name() end",
"def weber; end",
"def name; end",
"def name; end",
"def name; end",
"def name; end",
"def name; end",
"def name; end",
"def name; end",
"def name; end",
"def name; end",
"def name; end",
"def name; end",
"def name; end",
"def name; end",
"def name; end",
"def name; end",
"def name; end",
"def name; end",
"def name; end",
"def name; end",
"def name; end",
"def name; end",
"def name; end",
"def name; end",
"def name; end",
"def name; end",
"def name; end",
"def name; end",
"def name; end",
"def name; end",
"def name; end",
"def name; end",
"def name; end",
"def name; end"
] |
[
"0.7934856",
"0.6995856",
"0.69715554",
"0.69715554",
"0.69715554",
"0.69715554",
"0.6818438",
"0.65719235",
"0.65719235",
"0.6519513",
"0.64612186",
"0.64191276",
"0.64080924",
"0.62746495",
"0.62142885",
"0.62142885",
"0.62142885",
"0.6213299",
"0.6207486",
"0.6191437",
"0.6184942",
"0.6179293",
"0.6179293",
"0.61646163",
"0.6157661",
"0.6142312",
"0.61127335",
"0.61127335",
"0.61075383",
"0.6103286",
"0.6098095",
"0.60580206",
"0.60580206",
"0.60580206",
"0.60580206",
"0.60580206",
"0.60580206",
"0.60515076",
"0.60491216",
"0.6045916",
"0.6035135",
"0.6035135",
"0.60240304",
"0.60240304",
"0.60240304",
"0.60240304",
"0.6019315",
"0.6019315",
"0.6019315",
"0.6019315",
"0.6019315",
"0.6019315",
"0.6019315",
"0.6019315",
"0.6016043",
"0.6015136",
"0.6010227",
"0.6006014",
"0.6006014",
"0.6006014",
"0.6006014",
"0.6003574",
"0.5999361",
"0.5990187",
"0.5954665",
"0.5953448",
"0.5938537",
"0.5933947",
"0.5931546",
"0.5931546",
"0.5931546",
"0.5931546",
"0.5931546",
"0.5931546",
"0.5931546",
"0.5931546",
"0.5931546",
"0.5931546",
"0.5931546",
"0.5931546",
"0.5931546",
"0.5931546",
"0.5931546",
"0.5931546",
"0.5931546",
"0.5931546",
"0.5931546",
"0.5931546",
"0.5931546",
"0.5931546",
"0.5931546",
"0.5931546",
"0.5931546",
"0.5931546",
"0.5931546",
"0.5931546",
"0.5931546",
"0.5931546",
"0.5931546",
"0.5931546",
"0.5931546"
] |
0.0
|
-1
|
EMPLOYEE_LDAP_UID = "212386" Takes an object that responds to :ldap_uid Or, takes the ldap_uid as a String or Integer.
|
def login_user(ldap_obj)
if ldap_obj.is_a?(String) || ldap_obj.is_a?(Integer)
ldap_uid = ldap_obj
else
ldap_uid = ldap_obj.ldap_uid
end
OmniAuth.config.test_mode = true
OmniAuth.config.add_mock(:cas, { uid: ldap_uid.to_s })
visit(login_url())
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def get_ldap_id\n\t\tself.id = Devise::LDAP::Adapter.get_ldap_param(self.username,\"uidnumber\").first\n end",
"def ldap_person\n @person ||= UCB::LDAP::Person.find_by_uid(self.login) if self.login\n end",
"def get_uid(email, ldap_entry)\n # Get the first uid value (this should always be the canonical username)\n uid = ldap_entry.uid ? ldap_entry.uid[0] : nil\n # Update the cache\n self.cache[email] = uid if uid && self.use_cache\n # Return the uid\n uid\n end",
"def ldap_username\n @attributes[:ldap_username]\n end",
"def login(user, pass)\n conn = LDAP::Conn.new($ldap_conf[:server], $ldap_conf[:port])\n conn.set_option(LDAP::LDAP_OPT_PROTOCOL_VERSION, 3)\n conn.start_tls\n\n begin\n if conn.bind('uid=' + user + ',' + $ldap_conf[:people_dn], pass)\n get_uidNumber conn, user\n else\n False\n end\n rescue Exception => e\n nil\n end\nend",
"def student_id\n @net_ldap_entry[:berkeleyedustuid].first\n end",
"def name2uid(value)\n Integer(value) rescue uid(value) || false\n end",
"def name2uid(value)\n Integer(value) rescue uid(value) || false\n end",
"def populateLDAP\n \n #quit if no email or netid to work with\n return if !self.netid\n \n ldap = Net::LDAP.new(host: 'directory.yale.edu', port: 389)\n b = 'ou=People,o=yale.edu'\n f = Net::LDAP::Filter.eq('uid', self.netid)\n a = %w(givenname sn mail knownAs class college)\n\n p = ldap.search(base: b, filter: f, attributes: a).first\n \n\n\n self.fname = ( p['knownAs'] ? p['knownAs'][0] : '' )\n if self.fname.blank?\n self.fname = ( p['givenname'] ? p['givenname'][0] : '' )\n end\n self.lname = ( p['sn'] ? p['sn'][0] : '' )\n self.email = ( p['mail'] ? p['mail'][0] : '' )\n self.year = ( p['class'] ? p['class'][0].to_i : 0 )\n self.college = ( p['college'] ? p['college'][0] : '' )\n self.save!\n end",
"def get_uid_int\n self.uid.to_i\n end",
"def ldap_before_save\n self.email = Devise::LDAP::Adapter.get_ldap_param(username, 'mail').first\n end",
"def employee_id_from_matter_people_id(mpid)\n e = MatterPeople.find(mpid)\n e.employee_user_id\n end",
"def ldap_username_field\n @attributes[:ldap_username_field]\n end",
"def login_user(ldap_obj)\n if ldap_obj.is_a?(String) || ldap_obj.is_a?(Integer)\n ldap_uid = ldap_obj\n else\n ldap_uid = ldap_obj.ldap_uid\n end\n\n OmniAuth.config.test_mode = true\n OmniAuth.config.add_mock(:cas, { uid: ldap_uid.to_s })\n\n visit_path(login_url)\n end",
"def ldap_realname(username)\n\n begin\n # Workaround for bug in jruby-ldap-0.0.1:\n LDAP::load_configuration()\n rescue\n\n end\n\n ldap_host = 'ldap.uio.no'\n conn = LDAP::Conn.new(ldap_host, LDAP::LDAP_PORT)\n filter = \"(uid=#{username})\";\n base_dn = \"dc=uio,dc=no\"\n\n if conn.bound? then\n conn.unbind()\n end\n\n ansatt = nil\n conn.bind do\n\n conn.search2(\"dc=uio,dc=no\", LDAP::LDAP_SCOPE_SUBTREE,\n \"(uid=#{username})\", nil, false, 0, 0).each do |entry|\n\n brukernavn = entry.to_hash[\"uid\"][0]\n fornavn = entry.to_hash[\"givenName\"][0]\n etternavn = entry.to_hash[\"sn\"][0]\n # epost = entry.to_hash[\"mail\"][0]\n # adresse = entry.to_hash[\"postalAddress\"][0]\n\n return fornavn + \" \" + etternavn\n end\n end\n\nend",
"def get_ldap_details(username)\n search_filter = Net::LDAP::Filter.eq(\"uid\", username)\n result = LDAP_CONNECTION.search(:filter => search_filter)\n puts result.inspect\nend",
"def create_user(ldap) \n puts \"Enter user name to create user\"\n firstname = gets.chomp\n puts \"Enter Last name\"\n lastname = gets.chomp\n puts \"Enter password\"\n password = gets.chomp\n \n dn = \"cn=#{firstname},ou=people,dc=example,dc=com\"\n attr = {\n :objectClass => 'inetOrgPerson',\n :cn=> firstname,\n :sn => lastname,\n :userPassword => password\n }\n ldap.add(:dn => dn, :attributes => attr) \n puts \"****** Create_user result *******\" \n puts ldap.get_operation_result \n \n end",
"def get_ldap_data\n if Rails.env.production?\n result = LdapHelper::find_user(self.username)\n\n if result\n self.legacy_id ||= result.try(:employeeNumber).try(:first)\n self.first_name ||= result.try(:givenName).try(:first)\n self.last_name ||= result.try(:sn).try(:first)\n self.display_name ||= result.try(:displayName).try(:first)\n self.status ||= result.try(:employeeType).try(:first) || \"potential\"\n self.email ||= result.try(:mail).try(:first) || \"#{username}@fake.me\"\n end\n end\n end",
"def resolve_unix_uid_to_user(uid)\n\t\trequire 'etc'\n\n\t\t@uid_map ||= {}\n\t\tuid = uid.to_i\n\n\t\treturn @uid_map[uid] if !@uid_map[uid].nil?\n\t\t\n\t\tbegin\n\t\t\trecord = Etc.getpwuid(uid)\n\t\trescue ArgumentError\n\t\t\treturn nil\n\t\tend\n\n\t\t@uid_map[uid] = record.name\n\t\t@uid_map[uid]\n\tend",
"def resolve_unix_uid_to_user(uid)\n\t\trequire 'etc'\n\n\t\t@uid_map ||= {}\n\t\tuid = uid.to_i\n\n\t\treturn @uid_map[uid] if !@uid_map[uid].nil?\n\t\t\n\t\tbegin\n\t\t\trecord = Etc.getpwuid(uid)\n\t\trescue ArgumentError\n\t\t\treturn nil\n\t\tend\n\n\t\t@uid_map[uid] = record.name\n\t\t@uid_map[uid]\n\tend",
"def ldap_domain\n @attributes[:ldap_domain]\n end",
"def uid=(p0) end",
"def unix_uid=(_arg0); end",
"def to_param\n\t\tuid\n\tend",
"def to_param; uid end",
"def to_param; uid end",
"def initialize(options)\n options.symbolize_keys!\n\n if options.has_key?(:ldap_uid)\n @ldap_uid = options.fetch(:ldap_uid)\n elsif options.has_key?(:ldap_person)\n @ldap_person = options.fetch(:ldap_person)\n else\n raise InvalidOption, \"Expects :ldap_uid or :ldap_person as options\"\n end\n end",
"def filter(uid: '*')\n Net::LDAP::Filter.eq('uid', uid)\n end",
"def set_user\n id = params[:id] == 'me' ? current_user.login : params[:id]\n @user = LDAP::User.find(id)\n end",
"def corp_lookup\n\n basedn = \"cn=users,dc=bigdatalab,dc=ibm,dc=com\"\n scope = Net::LDAP::SearchScope_WholeSubtree\n filter = \"(&(objectClass=person)(!(objectClass=computer))(!(userAccountControl:1.2.840.113556.1.4.803:=2)))\"\n attrs = ['sAMAccountName','mail','pwdLastSet']\n skip_accounts = ['CORP$']\n\n ldap = Net::LDAP.new\n ldap.host = \"dc-0.bigdatalab.ibm.com\"\n ldap.port = \"389\"\n ldap.auth ENV['BIND_USER'], ENV['BIND_PASS']\n\n if !ldap.bind\n puts \"Problem with AD connection. Aborting!\"\n end\n \n ldap.search(:base => basedn, :scope => scope, :filter => filter, :attributes => attrs, :return_result => true) do |entry|\n if skip_accounts.include? entry.sAMAccountName.first.to_s\n next\n end\n\n begin\n acct = { \n :id => entry.sAMAccountName.first.to_s, \n :mail => entry.mail.first.to_s,\n :pwdays => 0,\n :notify => false,\n }\n rescue\n puts \"Caught exception: #{entry.inspect}\"\n end\n\n # Calculate the epoch time from windows time and get a number of days till expiration\n unix_time = (entry.pwdLastSet.first.to_i)/10000000-11644473600\n numDays = (unix_time + $maxPwAge - Time.now.to_i)/86400\n\n if numDays < 0\n acct[:pwdays] = numDays\n $accounts.push acct\n end\n\n end\nend",
"def get_user_details_from_ldap(username)\n\tresult_attrs = [\"uid\", \"displayName\", \"mail\"]\n\tsearch_filter = Net::LDAP::Filter.eq(\"uid\", username)\n\tLDAP_CONNECTION.search(:filter => search_filter, :attributes => result_attrs) { |item| \n\t puts \"#{item.uid.first}: #{item.displayName.first} (#{item.mail.first})\" \n\t}\n\t\nend",
"def get_entry_guid(username)\n filter = Net::LDAP::Filter.eq(@attribute.to_s, username)\n result = @ldap.search(filter: filter, attributes: ['objectguid'], size: 1)\n result.size > 0 ? result[0]['objectguid'][0] : nil\n end",
"def ldap_base_dn\n @attributes[:ldap_base_dn]\n end",
"def employee_id\n\n self.user_official_info.employee_id\n\n end",
"def activedirectory_users(opts, accountname_expr = 'jturner')\n\n ldap = Net::LDAP.new :host => opts[:ldaphost],\n\t:port => opts[:ldapport],\n\t:auth => {\n\t:method => :simple,\n\t:username => opts[:binddn],\n\t:password => opts[:bindpassword]\n \n }\n\n filter = Net::LDAP::Filter.construct(\"(&(objectCategory=Person)(sAMAccountName=#{accountname_expr}))\")\n\n ldap.search(\n\t:base => opts[:basedn],\n\t:filter => filter,\n\t:attributes => [:samaccountname, :displayname, :mail, :telephonenumber, :description, :department, :company, :physicaldeliveryofficename, :streetaddress, :l, :st, :postalcode, :co, :thumbnailPhoto]\n ) \nend",
"def given_name\n @net_ldap_entry[:givenname].first\n end",
"def set_organization_id_on_employee(employee = resource)\n employee.organization_id ||= current_organization.id\n end",
"def uid2name(id)\n return id.to_s if id.is_a?(Symbol) or id.is_a?(String)\n return nil if id > Puppet[:maximum_uid].to_i\n\n begin\n user = Etc.getpwuid(id)\n rescue TypeError, ArgumentError\n return nil\n end\n\n if user.uid == \"\"\n return nil\n else\n return user.name\n end\n end",
"def verified_lawyer #(userid)\n #$employee_id = userid\n $employee_id = self.id\n end",
"def request_uid(*args)\n uid\n end",
"def request_uid(*args)\n uid\n end",
"def request_uid(*args)\n uid\n end",
"def set_employee_user\n @employee_user = if current_manager\n EmployeeUser.find_by!(id: params[:id], organization_id: current_manager.organization_id)\n else\n EmployeeUser.find(params[:id])\n end\n end",
"def validate_id( uid )\n\t\tself.log.debug \"validating userid (UID) %p\" % [ uid ]\n\t\tfinish_with Apache::BAD_REQUEST, \"missing ID\" if uid.nil?\n\t\tfinish_with Apache::BAD_REQUEST, \"malformed or invalid ID: #{uid}\" unless\n\t\t\tuid =~ /^\\w{3,16}$/\n\n\t\tuid.untaint\n\t\treturn uid\n\tend",
"def corp_lookup\n\n basedn = \"cn=users,dc=bigdatalab,dc=ibm,dc=com\"\n scope = Net::LDAP::SearchScope_WholeSubtree\n filter = \"(&(objectClass=person)(!(objectClass=computer))(!(userAccountControl:1.2.840.113556.1.4.803:=2)))\"\n attrs = ['sAMAccountName','mail','pwdLastSet']\n\n ldap = Net::LDAP.new\n ldap.host = \"dc-0.bigdatalab.ibm.com\"\n ldap.port = \"389\"\n ldap.auth ENV['BIND_USER'], ENV['BIND_PASS']\n\n if !ldap.bind\n puts \"Problem with AD connection. Aborting!\"\n end\n \n ldap.search(:base => basedn, :scope => scope, :filter => filter, :attributes => attrs, :return_result => true) do |entry|\n\n acct = { \n :id => entry.sAMAccountName.first.to_s, \n :pwdays => 0,\n :notify => false,\n }\n\n if entry.respond_to? :mail\n acct[:mail] = entry.mail.first.to_s\n else\n acct[:mail] = \"im-bigdata-pgh-sysadmins@wwpdl.vnet.ibm.com\"\n end\n\n # Calculate the epoch time from windows time and get a number of days till expiration\n unix_time = (entry.pwdLastSet.first.to_i)/10000000-11644473600\n numDays = (unix_time + $maxPwAge - Time.now.to_i)/86400\n\n if numDays < 0\n next # These passwords have already expired.\n end\n\n # Send a notice 14, 7, 3, 2 and 1 days before expiration\n if [14, 7, 3, 2, 1].include? numDays\n acct[:notify] = true\n acct[:pwDays] = numDays\n end\n\n $accounts.push acct\n end\nend",
"def ldap_authenticate \n filter = Net::LDAP::Filter.eq(\"uid\",\"#{username}\")\n \n ldap_connection.search(:base => ldap_treebase, :filter => filter, :attributes => ldap_attrs, :return_result => false) do |entry|\n return true\n end\n \n self.errors.add(:username, \" is invalid\")\n return false\n end",
"def valid_user?\n #create a new LDAP object using the ruby-net-ldap library\n @ldap = Net::LDAP.new(:base => \"dc=#{@domain},dc=#{@tld}\",\n :host => @adshost,\n :auth => {:username => \"#{@username}@#{@domain}.#{@tld}\",\n :password => @password,\n :method => :simple})\n #return a boolean indicating whether authentication was successful or not\n return @ldap.bind\n end",
"def find_user_data_by_ext_user_id(ext_user_id)\n # ap(find_user_data_by_ext_user_id: {ext_user_id: ext_user_id})\n if existing_record = @user_data.find_one(\"ext_user_id\" => ext_user_id)\n [existing_record[\"_id\"].to_s, reject_record_id(existing_record)]\n end\n end",
"def lookup_uuid\n get(KABUIDProperty)\n end",
"def uid(*) end",
"def ldap_before_save\n self.email = Devise::LDAP::Adapter.get_ldap_param(self.username, \"mail\").first\n self.encrypted_password = Devise::LDAP::Adapter.get_ldap_param(self.username, \"userPassword\").first\n display_name = Devise::LDAP::Adapter.get_ldap_param(self.username, \"displayName\" )\n if display_name.present?\n display_name = display_name.first.split(' ')\n self.firstname = display_name[1]\n self.lastname = display_name.shift\n end\n end",
"def uid\n read_attribute :uid\n end",
"def ldap_user_name=(ldap_user_name)\n\n if !ldap_user_name.nil? && ldap_user_name.to_s.length > 50\n fail ArgumentError, \"invalid value for 'ldap_user_name', the character length must be smaller than or equal to 50.\"\n end\n\n @ldap_user_name = ldap_user_name\n end",
"def parse_ldap_dn(pdu, subject)\n ldap_dn = parse_octet_string(pdu, subject)\n\n unless ldap_dn.empty? or ldap_dn =~ /^\\w+=\\w+(,\\w+=\\w+)*$/\n raise Error::InvalidDNSyntaxError, \"#{ldap_dn} is not legal as LDAP DN.\"\n end\n\n ldap_dn\n end",
"def uid_to_username(uid)\n uid = Integer(uid)\n Etc.getpwuid(uid).name\n end",
"def set_uid\n @uid = Uid.find(params[:id])\n end",
"def ldap\n @attributes[:ldap]\n end",
"def _uid(uuid = @uuid)\n uuid && uuid[0,6]\n end",
"def get_user_id(reaktoruser_id)\n IdStore.get(:reaktoruser, reaktoruser_id)\n end",
"def unix_uid; end",
"def find_email\n val = @email\n return if val.nil? \n val = LdapQuery::Scanner.search(val).as_user_attributes[:email] \n if val.nil?\n errors.add :base, 'Email address not found'\n return false\n end\n @email = val\n xdelegate = User.find_by_email(val.to_s)\n if xdelegate.nil?\n errors.add :base, 'Email does not have an account on this website'\n return false\n else\n self.delegate_user_id = xdelegate.id\n end\n\n end",
"def fetch_uid\n uid = query('id')\n return false unless uid.gsub!(/.*uid=(\\d+).*/, '\\\\1').to_i == 0\n true\n end",
"def ldap=(value)\n conf['dashboard']['ldap'] = value.to_hash\n end",
"def uid_endpoint\n\t\t\t@uid[-2, 2]\n\t\tend",
"def education_user_id\n teacher.nil? ? student.external_id : teacher.external_id\n end",
"def get_ldap_attributes\n attributes = YaleLDAP.lookup(upi: upi.to_s)\n .slice(:first_name, :nickname, :last_name, :upi, :netid,\n :email, :organization, :curriculum, :college_name, :college_abbreviation,\n :class_year, :school, :telephone, :address)\n self.update_attributes(attributes)\n end",
"def uid\n @uid\n end",
"def authenticate (ldap)\n auth=ldap.authenticate \"cn=admin,dc=example,dc=com\",'123' \n puts \"***** authentication result *******\" \n puts ldap.get_operation_result \n end",
"def convert_user_name_to_user_id\n @pars = address_params\n if @pars.has_key?(\"user_id\")\n name = @pars[:user_id]\n if name\n @pars[:user_id] = find_user_id(name) unless integer?(name)\n end\n end\n end",
"def uid\n return nil unless user_id\n user_id.split('/').first\n end",
"def uid\n return nil unless user_id\n user_id.split('/').first\n end",
"def generate_attributes_from_ldap_info\n self.username = self.uid\n self.email = self.mail\n end",
"def auth_ext_id=(val)\n\t\tself.auth_ext = Ecstore::AuthExt.find(val) if val.present?\n\tend",
"def add_ou(agency)\n #creates an organizational unit and places an agency inside\n begin\n entry = {\n 'objectclass' => ['organizationalUnit'],\n 'ou' => [agency]\n }\n admin_bind.add(\"ou=#{entry['ou'][0]}, dc=localhost, dc=localdomain\", entry)\n return(true)\n rescue LDAP::ResultError => error\n return(false)\n end\nend",
"def employee_identifer=(employee_identifer)\n\n if !employee_identifer.nil? && employee_identifer.to_s.length > 10\n fail ArgumentError, \"invalid value for 'employee_identifer', the character length must be smaller than or equal to 10.\"\n end\n\n @employee_identifer = employee_identifer\n end",
"def user_uid=(uid=\"\")\n if uid != \"\"\n write_attribute(:user_uid, uid)\n end\n end",
"def uid; end",
"def try_update_ldap\n auths = self.authentications.where(provider: 'shibboleth')\n return false if auths.length > 0\n\n auths = self.authentications.where(provider: 'ldap')\n if auths.length > 0\n uid = auths.first.uid\n else\n uid = self.login_id\n end\n begin\n Ldap_User::LDAP.replace_attribute(uid, 'mail', [self.email])\n rescue LdapMixin::LdapException => ex\n return false\n end\n return true\n end",
"def uid\n @uid ||= (@in['uid_hi'] << 16) | @in['uid_lo']\n end",
"def by_uid(uid)\n find_by(uid: uid.to_s)\n end",
"def by_uid(uid)\n find_by(uid: uid.to_s)\n end",
"def by_uid(uid)\n find_by(uid: uid.to_s)\n end",
"def uid_from(*args)\n build_uid(*args)\n end",
"def ldap_verify_and_update\n return unless self.is_ldap?\n\n scanner = LdapQuery::Scanner.search self.login, :only=>:ldap\n\n if scanner.errors.size > 0\n errors.add(:login, 'Login is invalid or cannot be found in OHSU\\'s servers')\n return\n end\n\n # Update our information from ldap\n self.assign_attributes scanner.as_user_attributes\n\n end",
"def find(email = nil)\n\n # Search cache\n if self.use_cache\n uid = self.cache[email]\n return uid if uid\n end\n\n # Search LDAP for the email address as given\n filter = Net::LDAP::Filter.eq('mail', email)\n @ldap.search(attributes: ['uid'], base: self.base, filter: filter) do |entry|\n uid = get_uid(email, entry)\n return uid if uid\n end\n\n # The exact email address wasn't found, try the form \"username@domain\" if the username component looks like\n # a username (assumes that usernames do not contain punctuation)\n user, domain = email.split('@')\n unless user.nil? || user.empty? || user.include?('.')\n filter = Net::LDAP::Filter.eq('uid', user)\n @ldap.search(attributes: ['uid'], base: self.base, filter: filter) do |entry|\n uid = get_uid(email, entry)\n return uid if uid\n end\n end\n\n # No matches found\n nil\n\n end",
"def uid() end",
"def next_uid\n LdapUser.all(limit: 1, sort_by: :uidnumber, order: :desc).first[:uidnumber]+1\n end",
"def find_for_ldap_authentication(attributes={}, authenticator = EpiCas::LdapAuthenticator)\n authenticator.new(attributes, self).authenticate_ldap\n end",
"def author_exuid=(exuid)\n self.author = User.with_param(exuid).first\n end",
"def setuid?() end",
"def populateLDAP\n return unless Rails.env.production?\n #quit if no email or netid to work with\n self.email ||= ''\n return if !self.email.include?('@yale.edu') && !self.netid\n\n begin\n ldap = Net::LDAP.new( :host =>\"directory.yale.edu\" , :port =>\"389\" )\n\n #set e filter, use netid, then email\n if !self.netid.blank? #netid\n f = Net::LDAP::Filter.eq('uid', self.netid)\n else\n f = Net::LDAP::Filter.eq('mail', self.email)\n end\n\n b = 'ou=People,o=yale.edu'\n p = ldap.search(:base => b, :filter => f, :return_result => true).first\n\n rescue Exception => e\n guessFromEmail\n end\n\n return unless p\n\n self.netid = ( p['uid'] ? p['uid'][0] : '' )\n self.fname = ( p['knownAs'] ? p['knownAs'][0] : '' )\n self.fname ||= ( p['givenname'] ? p['givenname'][0] : '' )\n self.lname = ( p['sn'] ? p['sn'][0] : '' )\n self.email = ( p['mail'] ? p['mail'][0] : '' )\n self.year = ( p['class'] ? p['class'][0].to_i : 0 )\n self.college = ( p['college'] ? p['college'][0] : '' )\n\n # Don't save the model, because they are going to be shown a form to edit info\n # self.save!\n end",
"def uid2user(uid)\n begin\n pwent = Etc.getpwuid(uid)\n return pwent.name\n rescue ArgumentError => e\n # Invalid user id? No user? Return the uid.\n logger.warn(\"Failed to find username for uid #{uid}\")\n return uid.to_s\n end\n end",
"def get_user_dn(login)\n\t\tldap_con = initialize_ldap_con(self.account, self.encrypted_password)\n\t\tlogin_filter = Net::LDAP::Filter.eq( self.attr_login, login ) \n\t\tobject_filter = Net::LDAP::Filter.eq( \"objectClass\", \"*\" ) \n\t\tattrs = {}\n\t\t\n\t\tldap_con.search( :base => self.base_dn, \n\t\t\t:filter => object_filter & login_filter, \n\t\t\t:attributes=> search_attributes) do |entry|\n\t\t\t\n\t\t\tattrs = get_user_attributes_from_ldap_entry(entry)\n\t\t\tattrs.merge!(:member_of => entry[self.attr_member].map {|e| /CN=([^,]+?)[,$]/i.match(e).captures.first })\n\t\t\t\n\t\t\tlogger.debug \"DN found for #{login}: #{attrs[:dn]}\" if logger && logger.debug?\n\t\tend\n\t\t\n\t\t\n\t\tattrs\n\tend",
"def facebook_uid_field(value=nil)\n rw_config(:facebook_uid_field, value, :facebook_uid)\n end",
"def facebook_uid_field(value=nil)\n rw_config(:facebook_uid_field, value, :facebook_uid)\n end",
"def facebook_uid_field(value=nil)\n rw_config(:facebook_uid_field, value, :facebook_uid)\n end",
"def search(basedn, scope, deref, filter)\n #raise LDAP::ResultError::UnwillingToPerform, \"Bad base DN\" unless basedn == BASEDN\n #raise LDAP::ResultError::UnwillingToPerform, \"Bad filter\" unless filter[0..1] == [:eq, \"uid\"]\n uid = filter[3]\n @@pool.borrow do |sql|\n q = \"select login_id,passwd from #{TABLE} where login='#{sql.quote(uid)}'\"\n puts \"SQL Query #{sql.object_id}: #{q}\" if $debug\n res = sql.query(q)\n res.each do |login_id,passwd|\n @@cache.add(login_id, passwd)\n send_SearchResultEntry(\"id=#{login_id},#{BASEDN}\", {\n \"maildir\"=>[\"/netapp/#{uid}/\"],\n })\n end\n end\n end",
"def find_next_userid\n number = ldap.search(:base => user_dn, :filter => \"cn=*\")\n uids = []\n number.each do |result|\n uids.push(result[:uidnumber])\n end\n next_uid = uids.flatten.last.to_i + 1\n if uids.flatten.include?(next_uid)\n next_uid + 1\n elsif uids.empty?\n next_uid = 20000\n end\n next_uid\n end",
"def get_external_id_by_user_id(id)\n get_user_by_id(id)[\"external_user_id\"]\n end",
"def ldap_attr(attr_name)\n Devise::LDAP::Adapter.get_ldap_param(login, attr_name).first\n rescue NoMethodError\n # return blank when ldap does not have the desired attribute.\n logger.warn \"LDAP attribute '#{attr_name}' not found for '#{login}'\"\n ''\n end"
] |
[
"0.68740445",
"0.6342161",
"0.6110116",
"0.58546776",
"0.5807252",
"0.5701588",
"0.56797004",
"0.56797004",
"0.56554055",
"0.56110746",
"0.55768347",
"0.5570641",
"0.5544131",
"0.5540651",
"0.55337566",
"0.5528226",
"0.5523299",
"0.55200166",
"0.54965156",
"0.54965156",
"0.5457405",
"0.54108864",
"0.5410196",
"0.53806293",
"0.53802425",
"0.53802425",
"0.53695244",
"0.534866",
"0.53286594",
"0.5316455",
"0.53067005",
"0.529536",
"0.5245812",
"0.521922",
"0.5197988",
"0.51911324",
"0.51842844",
"0.51813734",
"0.5164359",
"0.5159724",
"0.5159724",
"0.5159724",
"0.51563996",
"0.514969",
"0.51493126",
"0.514186",
"0.5134568",
"0.5133966",
"0.5127351",
"0.51200944",
"0.5110815",
"0.5095418",
"0.5095298",
"0.5082886",
"0.5074847",
"0.50598466",
"0.50541717",
"0.5052989",
"0.5050646",
"0.5046194",
"0.5042924",
"0.5030823",
"0.5025425",
"0.5016996",
"0.50139606",
"0.5013359",
"0.50111735",
"0.5006655",
"0.50033057",
"0.50029296",
"0.50029296",
"0.49998724",
"0.49920347",
"0.49889722",
"0.49874994",
"0.49871293",
"0.49861425",
"0.49831772",
"0.49811175",
"0.49550912",
"0.49550912",
"0.49550912",
"0.4954922",
"0.49531028",
"0.49511567",
"0.49508393",
"0.49501792",
"0.4944342",
"0.49431267",
"0.49386734",
"0.49336335",
"0.49282643",
"0.49261296",
"0.49190596",
"0.49190596",
"0.49190596",
"0.49157363",
"0.49108854",
"0.49067596",
"0.490632"
] |
0.53609556
|
27
|
D: Return a cached rendering of the object loaded for later drawing usage.
|
def gl_draw_list( model )
@face_index.each do |fidx|
# https://docs.microsoft.com/en-us/windows/desktop/opengl/glbegin
# What do the faces look like?
#glBegin( GL_TRIANGLES ) # triangles
#glBegin( GL_QUADS ) # squares
glBegin( GL_POLYGON ) # polygon shapes, (openGL figures it out...)
face = @faces[fidx]
# draw each texture face on the object mesh.
for i in 0...face.vertex_count do
# prep tri/quad/poly face section drawing vars
vi = face.vtx_index[i]
ni = face.nrm_index[0] != -1 ? face.nrm_index[i] : nil
ti = face.tex_index[0] != -1 ? face.tex_index[i] : nil
# vertext plane start location:
glNormal3f( model.normal[ni][0], model.normal[ni][1], model.normal[ni][2] ) if ni
if ti # if has texture.
# Gosu has issues with inversion Y plane for texture maping.
# for this we offset the text cord by bottom of image reading down instead of up.
# OpenGL textures are read from the bottomRight of the image to the TopLeft.
# Gosu loads images into IO stream TopLeft and would end up being read Upside down.
# Hense a subtraction from fload 1.0 for text cord. - BestGuiGui
glTexCoord2f( model.texcoord[ti][0], 1.0 - model.texcoord[ti][1] )
end
# plane texture corners to vertex points:
glVertex3f( model.vertex[vi][0], model.vertex[vi][1], model.vertex[vi][2] )
end
glEnd()
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def cached_render\n if Global.file_cache\n cached_render_file\n else\n cached_render_memory\n end\n end",
"def cached_render_file\n rendered = uncached_render\n\n global_epath = Global.public_root/self.controller.mapping/extended_path\n FileUtils.mkdir_p(File.dirname(global_epath))\n File.open(global_epath, 'w+') {|fp| fp.print(rendered) }\n\n rendered\n end",
"def renders\n @_renders ||= {}\n end",
"def cached_render_memory\n cache = Cache.actions\n options = cache_options\n store_options = {}\n key = full_path\n\n if options.respond_to?(:values_at)\n block, ttl = options.values_at(:key, :ttl)\n\n key = [full_path, block.call] if block\n store_options[:ttl] = ttl if ttl\n end\n\n cached_memory_process(cache, key, store_options)\n end",
"def cached\n self\n end",
"def uncached_render\n before_process\n\n content = engine.transform(self)\n\n if path and tlayout = layout\n [instance, tlayout.instance].each do |i|\n i.instance_variable_set(\"@content\", content)\n end\n\n content = tlayout.render\n end\n\n content\n\n ensure\n after_process unless $!\n end",
"def cached_instance\n @cached_instance ||= read_instance\n end",
"def rendered\n @_rendered ||= ( persisted? ) ? Regulate::Git::Interface.find_rendered(id) : build_rendered_html\n @_rendered\n end",
"def read_or_render(template_name,language,key,render_args={},&prerender_block)\n # @logger.debug(\"render_base.read_or_render(#{template_name},#{language},#{key})\") if @logger\n #check cache\n\n renderer=nil\n unless key\n #try to generate the key\n renderer ||= get_renderer(template_name)\n\n key=renderer.get_key( render_args)\n end\n if key\n result=peek(language,key)\n end\n unless result\n\n template_name,key,render_args = process_prerender_block(\n template_name,\n key,\n render_args,\n &prerender_block)\n \n renderer ||= get_renderer(template_name)\n result=renderer.render(language,render_args,{})\n put_page_into_s3(language,key,result)\n else\n # @logger.debug(\"got it from cache\") if @logger\n\n end\n return result\n end",
"def draw\n if @cache.nil?\n prog = CGPProgram.new(@program, 2, 3)\n png = ChunkyPNG::Image.new(Config::image_width,\n Config::image_height, \n ChunkyPNG::Color::TRANSPARENT)\n Config::image_width.times do |x|\n Config::image_height.times do |y|\n # Takes in X,Y, gives HSL\n # For sanity sake, putting X/Y in terms of 0-1\n xf = x.to_f / Config::image_width\n yf = y.to_f / Config::image_height\n o = prog.evaluate([xf, yf])\n # Now, from the chunky_png docs,\n # Hue is 0-360:\n h = o[0] * 360\n # Sat is 0-1\n s = o[1]\n # Val is 0-1\n v = o[2]\n png[x,y] = ChunkyPNG::Color.from_hsv(h,s,v)\n end\n end\n @cache = png\n end\n return @cache\n end",
"def cached\n @cached ||= Rails.cache.read(self.cache_key, opts_for_cache)\n end",
"def pictures_nocache\r\n plan_id = params[:id]\r\n str = pictures_helper(plan_id)\r\n\r\n #MES- Is there a cache entry?\r\n cache_entry = @@pictures_cache[plan_id]\r\n if !cache_entry.nil?\r\n #MES- Is it stale?\r\n if cache_entry != str\r\n #MES- It's stale, reset it\r\n @@pictures_cache[plan_id] = str\r\n end\r\n end\r\n render :text => str\r\n end",
"def cached\n raise NotImplementedError\n end",
"def cached?; end",
"def instance_cache; end",
"def cache\n @cached = { y: @y, x: @x }\n end",
"def source\n @source ||= {}\n @source[Locomotive::Mounter.locale] ||= self.template.need_for_prerendering? ? self.template.render : self.template.data\n end",
"def cache_read(obj)\n # This is just a safety check. It can probably be disabled in the future\n # to increase performance.\n if obj.respond_to?(:is_poxreference?)\n # If this condition triggers, we have a bug in the library.\n PEROBS.log.fatal \"POXReference objects should never be cached\"\n end\n @reads[index(obj)] = obj\n end",
"def sync_render_context\n @sync_render_context ||= Renderer.new\n end",
"def render(_context=Context.new)\n _context = Context.new(_context) if _context.is_a?(Hash)\n @proc ||= _render()\n return _context.instance_eval(&@proc)\n end",
"def render\n render_background\n\n render_heat_maps\n\n render_star\n render_target\n render_hills\n render_walls\n\n render_paths\n end",
"def render_renderable(renderable, buffer = nil, locs = {})\n buffer ||= ''.html_safe\n\n benchmark \"Rendered #{renderable.cache_key}\", :level => :warn, :silence => true do\n locs.merge!(:renderable => renderable)\n\n klass = renderable.class\n\n html = ''\n\n partial_path = klass.respond_to?(:partial_path) ? klass.partial_path : klass.model_name.partial_path\n\n html.concat render({\n :partial => partial_path,\n :object => renderable,\n :locals => locs,\n :layout => 'shared/renderable'\n })\n\n element = klass.respond_to?(:element) ? klass.element : klass.model_name.element\n\n div_args = { :id => renderable.to_anchor, :class => \"renderable renderable-#{locs[:render_index]} #{element}\" }\n\n if klass.renderable? && current_user.role.includes?(renderable.role)\n div_args[:\"data-node\"] = node = locs[:node] && locs[:node].id\n div_args[:\"data-renderable\"] = element\n div_args[:\"data-renderable-name\"] = renderable.name\n\n div_args[:\"data-update-node-path\"] = edit_polymorphic_path([:admin, locs[:node]]) rescue nil\n\n # try a few argument setups for polymorphic routes\n path_arg_attempts = [\n\n # admin scoped, object class (the standard)\n [:admin, klass],\n\n # no scope, the object class\n [nil, klass]\n\n # no scope, the object base class (if individual subclass routes don't exist)\n #[nil, klass.base_class]\n ]\n\n begin\n scope, klass = path_arg_attempts.shift\n div_args[:\"data-renderables-path\"] = polymorphic_path([scope, klass])\n div_args[:\"data-renderable-path\"] = edit_polymorphic_path([scope, renderable.becomes(klass)]).sub(/\\/edit$/, '')\n rescue\n retry unless path_arg_attempts.empty?\n end\n end\n\n buffer << content_tag(:div, html.html_safe, div_args)\n end\n end",
"def load_cached\n content = File.open(self.cache_file_name, \"rb\") { |f| f.read }\n puts(\"[MODEL_FILE] Loaded #{self.cache_file_name} from cache\")\n return content\n end",
"def cached(key)\n return nil unless cache?(key)\n auth_objects_cache[key]\n end",
"def cache; end",
"def cache; end",
"def cache; end",
"def cache; end",
"def cache; end",
"def cache; end",
"def cache; end",
"def render(cache: true, &block)\n\t\t\t@cache = cache\n\t\t\t## Compile Tilt to instance hash\n\t\t\treturn unless @filename\n\n\t\t\ttilt = compile_file\n\t\t\t## Render Tilt from instance hash with new options\n\t\t\tlayout_render tilt.render(@scope, @locals, &block)\n\t\tend",
"def try_load_object(name, cache_path)\n obj = Registry.at(name)\n cache_object(name, cache_path) if obj && cache_path\n obj\n end",
"def cache( object = nil )\n return @cache unless object\n @cache[ object.id ] = object\n end",
"def cache\n DataCache\n end",
"def load( id, object=nil )\n @cache[id] ||= read(id)\n end",
"def renderable\n self\n end",
"def render(obj = Object.new, locals = {})\n output = template.result(obj.instance_eval {binding})\n end",
"def cache_render(\n serializer,\n cacheable,\n key: UNDEFINED, collection: nil, status: nil,\n meta: {}, meta_key: :meta,\n **options\n )\n plan = CacheCrispies::Plan.new(\n serializer,\n cacheable,\n key: key, collection: collection,\n **options\n )\n\n if CacheCrispies.config.etags?\n response.weak_etag = plan.etag\n end\n\n serializer_json =\n if plan.collection?\n plan.cache do\n CacheCrispies::Collection.new(\n cacheable, serializer, options\n ).as_json\n end\n else\n plan.cache { serializer.new(cacheable, options).as_json }\n end\n\n json_hash = plan.wrap(serializer_json)\n json_hash[meta_key] = meta if meta.present?\n\n render_hash = { json: Oj.dump(json_hash, mode: OJ_MODE) }\n render_hash[:status] = status if status\n\n render render_hash\n end",
"def load_cache\n @load_cache\n end",
"def try_load_object(name, cache_path); end",
"def generate_with_cache(checksums)\n changed_files = []\n Registry.checksums.each do |file, hash|\n changed_files << file if checksums[file] != hash\n end\n Registry.load_all\n all_objects.each do |object|\n if object.files.any? {|f, line| changed_files.include?(f) }\n log.info \"Re-generating object #{object.path}...\"\n opts = options.merge(:object => object, :type => :layout)\n Templates::Engine.render(opts)\n end\n end\n end",
"def render opts = {}\n renderer.render opts\n end",
"def cache\n @cache ||= build_cache\n end",
"def cache\n # Do a deep copy\n Marshal.load(Marshal.dump(@@cache))\n end",
"def get_if_cached(classname, id)\n classname = classname.to_sym\n id = id.to_i\n\n if @objects[classname] and obj = Wref::Map.get!(id)\n return obj\n end\n\n return nil\n end",
"def to_image\n @to_image ||= begin\n draw\n renderer.finish\n renderer.image\n end\n end",
"def pictures_cached\r\n plan_id = params[:id]\r\n #MES- Can we find the pictures sidebar text in the cache?\r\n cache_entry = @@pictures_cache[plan_id]\r\n str = ''\r\n if cache_entry.nil?\r\n #MES- The pictures sidebar is NOT in the cache, get the string and\r\n # put it in the cache\r\n str = pictures_helper(plan_id)\r\n @@pictures_cache[plan_id] = str\r\n else\r\n #MES- The pictures sidebar IS in the cache- get the string\r\n str = cache_entry\r\n #MES- The cache entry MAY be stale, so append some JavaScript that'll update the\r\n # HTML\r\n str += render_to_string(:partial => 'pictures_cached_javascript')\r\n end\r\n render :text => str\r\n end",
"def render(object = T.unsafe(nil)); end",
"def render\n glClearColor(*@background_color)\n @render_list.each { | o | o.render }\n end",
"def draw\n lastpixel = RuTui::Pixel.new(rand(255), rand(255), \".\")\n @map = Marshal.load( Marshal.dump( @smap )) # Deep copy\n\n # get all the objects\n @objects.each do |o|\n next if o.x.nil? or o.y.nil?\n o.each do |ri,ci,pixel|\n if !pixel.nil? and o.y+ri >= 0 and o.x+ci >= 0 and o.y+ri < @map.size and o.x+ci < @map[0].size\n # -1 enables a \"transparent\" effect\n if pixel.bg == -1\n pixel.bg = @map[o.y + ri][o.x + ci].bg if !@map[o.y + ri][o.x + ci].nil?\n pixel.bg = RuTui::Theme.get(:background).bg if pixel.bg == -1\n end\n if pixel.fg == -1\n pixel.fg = @map[o.y + ri][o.x + ci].fg if !@map[o.y + ri][o.x + ci].nil?\n pixel.fg = RuTui::Theme.get(:background).fg if pixel.fg == -1\n end\n\n @map[o.y + ri][o.x + ci] = pixel\n end\n end\n end\n\n out = \"\" # Color.go_home\n # and DRAW!\n @map.each do |line|\n line.each do |pixel|\n if lastpixel != pixel\n # out += RuTui::Ansi.clear_color if lastpixel != 0\n out << RuTui::Ansi.clear_color if lastpixel != 0\n if pixel.nil?\n # out += \"#{RuTui::Ansi.bg(@default.bg)}#{RuTui::Ansi.fg(@default.fg)}#{@default.symbol}\"\n out << \"#{RuTui::Ansi.bg(@default.bg)}#{RuTui::Ansi.fg(@default.fg)}#{@default.symbol}\"\n else\n # out += \"#{RuTui::Ansi.bg(pixel.bg)}#{RuTui::Ansi.fg(pixel.fg)}#{pixel.symbol}\"\n out << \"#{RuTui::Ansi.bg(pixel.bg)}#{RuTui::Ansi.fg(pixel.fg)}#{pixel.symbol}\"\n end\n lastpixel = pixel\n else\n if pixel.nil?\n # out += @default.symbol\n out << @default.symbol\n else\n # out += pixel.symbol\n out << pixel.symbol\n end\n end\n end\n end\n\n # draw out\n print out.chomp\n $stdout.flush\n end",
"def render\n\n # Skip if page is not letterhead.\n unless self.class::LETTERHEAD_FORMAT == :none\n\n # Determine letterhead properties.\n path = Rails.root.join('lib', 'assets', 'letterhead', \"#{self.class::LETTERHEAD_FORMAT.to_s}.png\")\n x = nil\n y = nil\n width = nil\n height = 1.25\n case self.class::LETTERHEAD_FORMAT\n when :portrait, :portrait_mono\n x = 0.25\n y = 10.75\n width = 8\n when :landscape, :landscape_mono, :packing_list, :packing_list_mono\n x = 0.25\n y = 8.25\n width = 10.5\n end\n\n # Draw graphic on each page.\n self.repeat(:all) do\n self.image(path, at: [x.in, y.in], width: width.in, height: height.in)\n end\n\n end\n\n # Call parent render.\n super\n\n end",
"def cache\n @@_cache[self.class.name]\n end",
"def draw\n\t\t\t\tprotect_runtime_errors do\n\t\t\t\t\t# render the selected state\n\t\t\t\t\t# (it has been rendered before, so it should render now without errors)\n\t\t\t\t\tunless @history_cache.nil?\n\t\t\t\t\t\t# render the states\n\t\t\t\t\t\t# puts \"history: #{@history_cache.size} - #{@history_cache.collect{|x| !x.nil?}.inspect}\"\n\t\t\t\t\t\t\n\t\t\t\t\t\t# TODO: render to FBO once and then render that same state to the screen over and over again as long as @time_travel_i is unchanged\n\t\t\t\t\t\t# currently, framerate is down to ~30fps, because this render operation is expensive.\n\t\t\t\t\t\t\n\t\t\t\t\t\t# State 0 is not renderable, because that is before the first update runs. Without the first update, the first draw will fail. Just skip state 0. Later, when we attempt to compress history by diffs, state 0 may come in handy.\n\t\t\t\t\t\trender_onion_skin(\n\t\t\t\t\t\t\t@history_cache[1..(@time_travel_i-1)], ONION_SKIN_STANDARD_COLOR,\n\t\t\t\t\t\t\t@history_cache[@time_travel_i], ONION_SKIN_NOW_COLOR,\n\t\t\t\t\t\t\t@history_cache[@forecast_range], ONION_SKIN_ERROR_COLOR\n\t\t\t\t\t\t)\n\t\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\t# @history_cache[@time_travel_i].draw @window\n\t\t\t\t\t\t\n\t\t\t\t\t\t# ^ currently the saved state is rendering some UI which shows what the current TurnCounter values are. This is going to have weird interactions with onion skinning. Should consider separating UI drawing from main entity drawing.\n\t\t\t\t\t\t# (or maybe onion-skinning the UI will be cool? idk)\\\t\t\t\t\t\n\t\t\t\t\tend\n\t\t\t\t\t\n\t\t\t\t\t@ui.draw @window, @wrapped_object, @history_cache, @turn\n\t\t\t\tend\n\t\t\tend",
"def draw\n\t\t\tlastpixel = Pixel.new(rand(255), rand(255), \".\")\n\t\t\t@map = Marshal.load( Marshal.dump( @smap )) # Deep copy\n\n\t\t\t# get all the objects\n\t\t\t@objects.each do |o|\n\t\t\t\tnext if o.x.nil? or o.y.nil?\n\t\t\t\to.each do |ri,ci,pixel|\n\t\t\t\t\tif !pixel.nil? and o.y+ri >= 0 and o.x+ci >= 0 and o.y+ri < @map.size and o.x+ci < @map[0].size\n\t\t\t\t\t\t# -1 enables a \"transparent\" effect\n\t\t\t\t\t\tif pixel.bg == -1\n\t\t\t\t\t\t\tpixel.bg = @map[o.y + ri][o.x + ci].bg if !@map[o.y + ri][o.x + ci].nil?\n\t\t\t\t\t\t\tpixel.bg = Theme.get(:background).bg if pixel.bg == -1\n\t\t\t\t\t\tend\n\t\t\t\t\t\tif pixel.fg == -1\n\t\t\t\t\t\t\tpixel.fg = @map[o.y + ri][o.x + ci].fg if !@map[o.y + ri][o.x + ci].nil?\n\t\t\t\t\t\t\tpixel.fg = Theme.get(:background).fg if pixel.fg == -1\n\t\t\t\t\t\tend\n\n\t\t\t\t\t\t@map[o.y + ri][o.x + ci] = pixel\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tout = \"\" # Color.go_home\n\t\t\t# and DRAW!\n\t\t\t@map.each do |line|\n\t\t\t\tline.each do |pixel|\n\t\t\t\t\tif lastpixel != pixel\n\t\t\t\t\t\tout << RuTui::Ansi.clear_color if lastpixel != 0\n\t\t\t\t\t\tif pixel.nil?\n\t\t\t\t\t\t\tout << \"#{RuTui::Ansi.bg(@default.bg)}#{RuTui::Ansi.fg(@default.fg)}#{@default.symbol}\"\n\t\t\t\t\t\telse\n\t\t\t\t\t\t\tout << \"#{RuTui::Ansi.bg(pixel.bg)}#{RuTui::Ansi.fg(pixel.fg)}#{pixel.symbol}\"\n\t\t\t\t\t\tend\n\t\t\t\t\t\tlastpixel = pixel\n\t\t\t\t\telse\n\t\t\t\t\t\tif pixel.nil?\n\t\t\t\t\t\t\tout << @default.symbol\n\t\t\t\t\t\telse\n\t\t\t\t\t\t\tout << pixel.symbol\n\t\t\t\t\t\tend\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\tend\n\n\t\t\t# draw out\n\t\t\tprint out.chomp\n\t\t\t$stdout.flush\n\t\tend",
"def render_hash\n Motion.serializer.weak_digest(self)\n end",
"def render_object\n\n\t\t\tcase @params[:render_mode]\n\t\t\twhen :text\n\t\t\t\tHana::PlainText.new(@wiki_query, @params[:data_to_render])\n\t\t\twhen :csv\n\t\t\t\tHana::CSV.new(@wiki_query, @params[:data_to_render])\n\t\t\twhen :json\n\t\t\t\tHana::JsonOutput.new(@wiki_query)\n\t\t\tend\n\n\t\tend",
"def show\n # store timestamp of the previous last usage\n @last_used_before_now = @model.last_used_at\n \n # update timestamp in the current Model record\n # (this will also trigger timestamp update in the corresponding Asset)\n @model.last_used_at = Time.now\n @model.save_without_timestamping\n \n respond_to do |format|\n format.html # show.html.erb\n format.xml\n format.svg { render :text=>to_svg(@model,params[:deep]=='true',@model)}\n format.dot { render :text=>to_dot(@model,params[:deep]=='true',@model)}\n format.png { render :text=>to_png(@model,params[:deep]=='true',@model)}\n end\n end",
"def _template_cache\n @cache ||= {}\n end",
"def render_model\n model.render\n end",
"def render(view, locals, buffer=nil, &block)\n mod = view.is_a?(Deface.template_class) ? Deface.template_class : view.singleton_class\n\n if @compiled && !mod.instance_methods.include?(method_name.to_sym)\n @compiled = false\n @source = refresh(view).source\n end\n buffer.nil? ? super(view, locals, buffer, &block) : super(view, locals, **buffer, &block)\n end",
"def cache!\n @@cache\n end",
"def get_object(obj_name)\n key = obj_name.to_s\n obj = @cache[key]\n unless obj\n if extra_inputs_has(key)\n obj = @extra_inputs[key]\n else\n case @defs[key]\n when MethodDef\n obj = construct_method(key)\n when FactoryDef\n obj = construct_factory(key)\n @cache[key] = obj\n else\n obj = construct_object(key)\n @cache[key] = obj if @defs[key].singleton?\n end\n end\n end\n obj\n end",
"def _cached_field(field)\n cached_obj = self.class._cache[\"#{object.id}.#{object.updated_at.to_i}\"] || {}\n cached_obj[field]\n end",
"def sync_render_context\n self\n end",
"def sync_render_context\n self\n end",
"def get_render(id, opts = {})\n data, status_code, headers = get_render_with_http_info(id, opts)\n return data\n end",
"def gl_draw\n return if @destoryed # map will take care of the class object.\n # https://docs.microsoft.com/en-us/windows/desktop/opengl/glpushmatrix\n glPushMatrix # for the most part operations should keep to themselfs with location configuration.\n #---------------------------------------------------------\n # https://docs.microsoft.com/en-us/windows/desktop/opengl/gltranslatef\n glTranslatef(@x, @y, @z) # Moving function from the current gluPerspective by x,y,z change\n #---------------------------------------------------------\n # https://docs.microsoft.com/en-us/windows/desktop/opengl/glrotatef\n # glRotatef(angle, X axis scale, Y axis scale, Z axis scale)\n glRotatef(@angle[0], @angle[1], @angle[2], @angle[3])\n #---------------------------------------------------------\n # https://www.rubydoc.info/github/gosu/gosu/master/Gosu/GLTexInfo\n if @texture.nil? || @texture_debugging\n # debug texture drawing: helps find things by painting them a color.\n # https://docs.microsoft.com/en-us/windows/desktop/opengl/gldisable\n glDisable(GL_TEXTURE_2D)\n # https://docs.microsoft.com/en-us/windows/desktop/opengl/glcolor3ub\n glColor3ub(255, 100, 100) # or a diffrent color if desired...\n else # normal drawing\n # https://docs.microsoft.com/en-us/windows/desktop/opengl/glpushmatrix\n glBindTexture(GL_TEXTURE_2D, @texture.tex_name)\n end\n #---------------------------------------------------------\n # https://docs.microsoft.com/en-us/windows/desktop/opengl/glscalef\n # scales the whole object including texture mapping.\n glScalef(@scale, @scale, @scale)\n #---------------------------------------------------------\n # call the cached draw recording for the model.\n unless @object_model.nil?\n @object_model.render\n else\n puts(\"No model to draw for object: [ #{@obj_filename} ]\")\n exit\n end\n #---------------------------------------------------------\n # https://docs.microsoft.com/en-us/windows/desktop/opengl/glpopmatrix\n glPopMatrix\n end",
"def render\n \"\".tap do |output|\n (1..height).each do |y|\n (1..width).each do |x|\n object = objects_at(Locatable::Point.new(x: x, y: y)).first\n\n output << (object.nil? ? \" \" : object.sprite)\n end\n\n output << \"\\n\"\n end\n end\n end",
"def render\n\n\t\t\tcontent = render_object.render\n\n\t\t\tif params[:output_file]\n\t\t\t\tcreate_output_file(content)\n\t\t\telse\n\t\t\t\tputs content\n\t\t\tend\n\n\t\tend",
"def do_render\n Mustache.render(template, self)\n end",
"def value_cached_based_on(*whatever)\n segmented_path = lazy_cache_key_for(whatever)\n fragment = (@controller || self).read_fragment(segmented_path)\n fragment ? Marshal.load(fragment) : returning(yield) {|f| (@controller || self).write_fragment(segmented_path, Marshal.dump(f)) }\n end",
"def build_asset(path, pathname, options)\n # Memory cache\n key = cache_key_for(pathname, options)\n if @assets.key?(key)\n @assets[key]\n else\n @assets[key] = begin\n # Persisted cache\n cache_asset(key) do\n super\n end\n end\n end\n end",
"def render( render_state )\n\t\treturn nil\n\tend",
"def render view, options\n options.format! view\n path_store.cached options do\n options.file = template_path view, options\n view.render_with options\n end\n end",
"def render\n template = Template.new(@sprite, template_options)\n template.render(File.read(template_path))\n end",
"def render\n Log.dev(\"Action: #{self}\")\n stack do\n if should_cache?\n # Ignore cache if there is flash session data as the response probably\n # expects to include it, making it unique for this user and request.\n if Global.no_cache_flash && !Current.session.flash.empty?\n Log.debug(\"Action caching ignored as session flash data is present.\")\n uncached_render\n else\n cached_render\n end\n else\n uncached_render\n end\n end\n end",
"def read\n @_cache ||= (value = read_value) ? serializer_class.load(read_value) : {}\n end",
"def rendered=(_arg0); end",
"def render(graphics)\n notify :before_render, graphics\n #game_state.manager(:game_object).game_objects.each { |game_object| game_object.draw if game_object.respond_to? :draw}\n game_state.manager(:game_object).layers_by_order.each do |game_objects|\n game_objects.each { |game_object| game_object.draw(graphics) if game_object.respond_to? :draw}\n end\n\n render_debug_overlay(graphics)\n notify :after_render, graphics\n end",
"def render_object(object, direction = nil)\n flow top: (object.y+1)*n, left: object.x*n, width: n, height: n do\n image = image_for_object object, direction\n style background: image if image\n end.tap do |element|\n @elements[object] = element\n end",
"def value_cache\n C.value_cache\n end",
"def render(type=:all, options={})\n\t\t\tif type == :all\n\t\t\t\t# Rely on the face that << works on both strings and arrays\n\t\t\t\t# and that gen_tags is either set for both (so return array), or none\n\t\t\t\t# (so return string)\n\t\t\t\tjs = render(:js, options)\n\t\t\t\tcss = render(:css, options)\n\t\t\t\t# Since we're rendering all assets, if we're not separating js and css by\n\t\t\t\t# tags, separate them into a hash instead\n\t\t\t\tif options[:gen_tags] == false\n\t\t\t\t\treturn {:js => js, :css => css}\n\t\t\t\telse\n\t\t\t\t\treturn js << css\n\t\t\t\tend\n\t\t\tend\n\n\t\t\toptions = {\n\t\t\t\t\t:gen_tags => true,\n\t\t\t\t\t:inline => false,\n\t\t\t\t\t:request_path => @options[:request_path],\n\t\t\t}.merge(options)\n\n\t\t\tfinalize() unless @finalized\n\t\t\t@finalized = true\n\n\t\t\t# Generate all cache files, if needed, and get an array of generated packs\n\t\t\tpacks = @groups_to_render.inject([]){ |s, group| s.push(*group.generate(type, :inline => options[:inline])) }\n\t\t\tfiles = packs.map{ |pack| pack.render(options) }\n\t\t\t# If returning tags, make them a string from an array\n\t\t\t# Similarly, join inline assets, if they're of the same type\n\t\t\tfiles = files.join(\"\\n\") if options[:gen_tags] || options[:inline]\n\t\t\treturn files\n\t\tend",
"def render\n @document.playback_attributes @attributes\n renderer.render(@template_name, self)\n end",
"def render(scope=Object.new, locals={}, &block)\n if @data.nil?\n @data = @reader.call(self)\n compile!\n end\n evaluate scope, locals || {}, &block\n end",
"def render(x, y, z)\n @image.draw(x, y, z)\n end",
"def update_graphics\r\n @tile_id = @character.tile_id\r\n @character_name = @character.character_name\r\n self.visible = !@character_name.empty? || @tile_id > 0\r\n if @tile_id >= 384\r\n update_tile_graphic\r\n else\r\n self.bitmap = RPG::Cache.character(@character_name, 0)\r\n @cw = bitmap.width / 4\r\n @height = @ch = bitmap.height / 4\r\n self.ox = @cw / 2\r\n self.oy = @ch\r\n self.zoom = 1 if zoom_x != 1\r\n src_rect.set(@character.pattern * @cw, (@character.direction - 2) / 2 * @ch, @cw, @ch)\r\n @pattern = @character.pattern\r\n @direction = @character.direction\r\n end\r\n end",
"def cache_instance(klass)\n klass.instance_variable_get('@static_record_cache')\n end",
"def get!(key)\n record = object(key)\n return nil unless record\n record.rewrite_cache\n record.value\n end",
"def render\n generate_content\n @pdf.render\n end",
"def lookup(obj, pos)\n @cache[pos][obj.object_id] \n end",
"def render(options = {})\n raise double_render! if rendered?\n @render_opts = options\n end",
"def render(query)\n Rails.cache.fetch(query, expires_in: 5.minutes) do\n JobListSerializer.render_as_json(job_list(query))\n end\n end",
"def is_cached_entity?\n # Set in initialize via marshal_load\n @loaded_from_cache\n end",
"def render_page_from_cache\n if cached_page.live_exists?\n render :file => cached_page.live_path\n return true\n else\n render :text => 'Currently not in cache', :status => 503\n return false\n end\n end",
"def load_obj_file\n if self.use_wavefrontOBJ_loader() == nil\n # there was an issue loading the object data, dont bother with the image file.\n return nil\n end\n # save the @texture refrence as its refered to later and you dont want to loose the refrence object.\n if @obj_filename != @texture_file\n file = \"Media/Textures/#{@texture_file}.png\"\n else # nest the object file, keeps the directory cleaner this way.\n file = \"Media/3dModels/#{@texture_file}/#{@texture_file}.png\"\n end\n file_dir = File.join(ROOT, file)\n image = Gosu::Image.new(file_dir, retro: true) rescue nil\n if image.nil?\n puts(\"Texture image file was not found for: #{file_dir}\")\n unless TEXTURE_DEBUG\n exit\n else\n return true\n end\n end\n @texture = Yume::Texture.new(image)\n puts(\"Using local 3D object file texture setting:\\n \\\"#{file}\\\"\")\n #--------------------------------------\n # https://www.rubydoc.info/github/gosu/gosu/master/Gosu/Image#gl_tex_info-instance_method\n # @tex_info = @texture.gl_tex_info # helper structure that contains image data\n # not very reliably held to tho, needs a proper class object formater to load images as textures.\n return true # success\n end",
"def render(rendering_strategy=Mariner.rendering_strategies[:default])\n rendering_strategy.factory(:item, self).render\n end",
"def inspect\n \"<#{self.class} #{render}>\"\n end",
"def rerender\n GL::NewList($rubyList, GL::COMPILE)\n $ruby.render\n GL::EndList()\n GLUT.PostRedisplay\nend",
"def read_cache(obj, options = {})\n k = key(obj)\n\n ret = storage.get(k) || save_cache(obj)\n\n if options[:deserialized]\n serializer.deserialize(ret)\n else\n ret\n end\n end",
"def render\n @pdf.render\n end"
] |
[
"0.7685884",
"0.63373435",
"0.6220672",
"0.604395",
"0.59927267",
"0.59593034",
"0.58232397",
"0.5812821",
"0.576603",
"0.5667125",
"0.56234354",
"0.5606334",
"0.56011724",
"0.55613625",
"0.55403614",
"0.5491478",
"0.5486506",
"0.5449549",
"0.5441233",
"0.5425705",
"0.54163086",
"0.53858984",
"0.538493",
"0.5382413",
"0.5378094",
"0.5378094",
"0.5378094",
"0.5378094",
"0.5378094",
"0.5378094",
"0.5378094",
"0.5368541",
"0.5350621",
"0.5324475",
"0.5306845",
"0.529634",
"0.52499086",
"0.52488554",
"0.5240828",
"0.52394843",
"0.5237445",
"0.5203483",
"0.5185332",
"0.5182163",
"0.51658565",
"0.51531786",
"0.5151335",
"0.5148505",
"0.51402456",
"0.5140131",
"0.5129052",
"0.51247376",
"0.51242286",
"0.5110136",
"0.50916296",
"0.50883144",
"0.5086452",
"0.5076214",
"0.5072358",
"0.5069782",
"0.5055936",
"0.5043925",
"0.50428325",
"0.50404495",
"0.5040182",
"0.5040182",
"0.501873",
"0.49950263",
"0.49925113",
"0.4987438",
"0.49820682",
"0.497582",
"0.49753314",
"0.49748516",
"0.49700478",
"0.4967399",
"0.49659762",
"0.49655873",
"0.4965419",
"0.49635577",
"0.49628544",
"0.49606827",
"0.49585637",
"0.49578974",
"0.49576572",
"0.49550328",
"0.4953096",
"0.49500144",
"0.49497262",
"0.49491575",
"0.49448863",
"0.49370998",
"0.49365687",
"0.49362797",
"0.49339235",
"0.49308985",
"0.4928835",
"0.4920033",
"0.4919941",
"0.49195564",
"0.4916913"
] |
0.0
|
-1
|
D: return the objects total face count.
|
def get_face_count
count = 0
@groups.each_value do |grp|
count += grp.faces.size
end
return count
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def game_objects_count\n @game_objects.count\n end",
"def count_objects\n ObjectSpace.count_objects\n end",
"def count_objects\n count = 0\n @objects.keys.each do |key|\n count += @objects[key].length\n end\n\n return count\n end",
"def objects_count\n @objects_count ||= objects.size\n end",
"def total_count\n object.nodes.size\n end",
"def object_count\n 0\n end",
"def number_of_verts\n\t\t@number_of_verts ||= begin\n\t\t\tsize = 0\n\t\t\t@primitives.each do |primitive|\n\t\t\t\tprimitive[:verts].each do |index|\n\t\t\t\t\tvert = @verts[index]\n\t\t\t\t\tsize += vert[:vector].length\n\t\t\t\tend\n\t\t\tend\n\t\t\tsize\n\t\tend\n\tend",
"def size\n @objects.size\n end",
"def size\n @objects.size\n end",
"def type_count\n @game_objects.type_count\n end",
"def total_size\n object_versions.inject(0) { |sum, obj| sum += obj.size }\n end",
"def length\n\n count_objects()\n end",
"def total_count()\n @raw_data.size\n end",
"def total_count\n @all.size\n end",
"def size\n count = 0\n @properties.each do |gid, values|\n if ! values.empty?\n count += 1\n end\n end\n return count\n end",
"def size\n self.points.count\n end",
"def total\n object.nodes.size\n end",
"def count\n folder.data_objects.all(parameters).count\n end",
"def total_entries\n @delegated_to_object.size\n end",
"def get_total_stat_boxes\n return @stats.length\n end",
"def total_count\n total_entries\n end",
"def painting_count\n self.paintings.length\n end",
"def object_shape_count\n ::RubyVM::YJIT.runtime_stats[:object_shape_count]\n end",
"def get_total_games_played\n return games.size\n end",
"def numbers_of_planes\n\t\t@landed_planes.count \n\tend",
"def total_entries\n collection.total_count\n end",
"def total_cards\n cards.count\n end",
"def counts\r\n @counts\r\n end",
"def members_count\n object.space_memberships.count\n end",
"def total\n traits.size + factories.size + factories.sum { |factory| factory.traits.size }\n end",
"def size\n @count\n end",
"def size\n @count\n end",
"def total\n count\n end",
"def get_total_games_played\n\t\treturn games.size\n\tend",
"def count\n to_a.size\n end",
"def count\n to_a.size\n end",
"def count\n @data.size\n end",
"def full_count\n @clazz.count\n end",
"def count_measures\n measures = 0\n \n self.measure_ids.each do |measure|\n measures += 1 if !measure.empty?\n end\n \n return measures\n end",
"def loaded_count\n loaded_objects.size\n end",
"def size\n @references.count do |_, ref|\n ref.object\n end\n end",
"def frequency\n opponents_faced.to_f / sample_size\n end",
"def count\n each.size\n end",
"def count_factors\n factors.count\n end",
"def count\n @atlas.count\n end",
"def count\n @ole.Count\n end",
"def count\n @ole.Count\n end",
"def count\n @ole.Count\n end",
"def count\n @ole.Count\n end",
"def count\n @ole.Count\n end",
"def count\n @ole.Count\n end",
"def count\n @ole.Count\n end",
"def count\n @ole.Count\n end",
"def size\n return TUTOR_BOX_COUNT if type == \"tutor_table\"\n @boxes.nil? ? 0 : @boxes.count\n end",
"def numVertices\n @vertices.size\n end",
"def numVertices\n @vertices.size\n end",
"def count\n @cards.size\n end",
"def count\n @cards.size\n end",
"def get_total_snpinfo_boxes\n return @snpinfo_tracks.length\n end",
"def count\n @obj['count'].to_i\n end",
"def count\n all.size\n end",
"def count_objects\n\n count = 0\n\n Find.find(@basepath) do |path|\n\n next unless File.exist? path\n next if File.stat(path).directory?\n\n count += 1 if path[-5..-1] == '.yaml'\n end\n\n count\n end",
"def count\n @bitmap.count\n end",
"def count; @value.size; end",
"def images_count\r\n images_count = 0\r\n jobs.each do |job|\r\n images_count += job.images_for_jobs.count\r\n end\r\n images_count\r\n end",
"def number_of_members()\n return members().count\n end",
"def album_count\n return @albums.length\n end",
"def total_count(object)\n unless object.blank?\n unless object.total_count.to_i == 0\n tot_per = object.total_count.to_i / object.limit_value.to_i\n tot_mod = object.total_count.to_i % object.limit_value.to_i\n if tot_mod < object.limit_value.to_i\n if tot_mod != 0\n tot_per += 1\n else\n tot_per = tot_mod\n end\n end\n end\n return tot_per\n end\n end",
"def games_played\n games.size\n end",
"def games_played\n games.size\n end",
"def count\n to_a.size\n end",
"def Count()\n _getproperty(1, [], [])\n end",
"def num_of_tracks\n\t\t@tracks.count\t \n\tend",
"def total_count\n @_total_count || @_original_array.length\n end",
"def count\n if @count\n @count - @deleted_entries.cardinality\n else\n determine_count\n end\n end",
"def media_object_count\n @media_object_count ||= MediaObject.where(\"collection_ssim\" => name).count\n end",
"def count\n @deck.size\n end",
"def party_size\n @actors.size + 3\n end",
"def counters\n return {} if object.guest?\n\n {\n files: files_private_count,\n folders: folders_private_count,\n apps: apps_private_count,\n workflows: workflows_count,\n jobs: jobs_count,\n assets: assets_count,\n notes: notes_count,\n }\n end",
"def count\n @cards.length\n end",
"def C_GetObjectSize()\n @pk.C_GetObjectSize(@sess, @obj)\n end",
"def num_points\n @size * @size\n end",
"def numCards\n\t\t@cards.reduce(0) {|memo, card| memo += card.copies}\n\tend",
"def size\n @references_to_keys_map.count do |_, ref|\n ref.object\n end\n end",
"def count\n @all.size\n end",
"def count\n @cards.count\n end",
"def num_vertices\n\t\treturn @Vertices.length\n\tend",
"def size\n @vertices.length\n end",
"def count_edge\n count = 0\n @f_net.each_with_index do |followees, follower|\n count += followees_of(follower).count\n end\n count\n end",
"def shape_count\n\t\treturn @shapes.length\n\tend",
"def count_documents\n size = 0\n @data.each_value do |documents|\n size += documents.size\n end\n\n size\n end",
"def count\n each.count\n end",
"def appearances\n positions.size\n end",
"def total_votes\n num_of_votes = self.votes.count\n return num_of_votes\n end",
"def get_size\n return @content_objects.count\n end",
"def count\n self.class.count(self)\n end",
"def total_points\n self.user_points.reduce(0) { |sum, points| sum + points.point_category.number_of_points}\n end",
"def count_tickets\n tickets = self.tickets\n total_tickets = tickets.count\n return total_tickets\n end",
"def count\n all.count\n end",
"def objects_count\n obj_count = {total_count: Building.count, building_complexes_count: BuildingComplex.count, apartments_count: Apartment.count, penthouses_count: Penthouse.count, apartment_houses_count: ApartmentHouse.count}\n render json: obj_count\n end"
] |
[
"0.7563178",
"0.75399995",
"0.73734385",
"0.7326226",
"0.700369",
"0.69684803",
"0.6877062",
"0.6816855",
"0.6805063",
"0.6798709",
"0.6780053",
"0.6742576",
"0.67302614",
"0.672904",
"0.6615932",
"0.6594205",
"0.6587683",
"0.6582197",
"0.65558004",
"0.65522766",
"0.6549445",
"0.6549257",
"0.6548105",
"0.6510059",
"0.64869887",
"0.64653134",
"0.646243",
"0.6460096",
"0.6459586",
"0.6454536",
"0.64535546",
"0.64535546",
"0.644491",
"0.64405346",
"0.643783",
"0.643783",
"0.64147377",
"0.64102316",
"0.64085454",
"0.63931435",
"0.6381345",
"0.6376143",
"0.63671863",
"0.63398784",
"0.63212717",
"0.6318926",
"0.6318926",
"0.6318926",
"0.6318926",
"0.6318926",
"0.6318926",
"0.6318926",
"0.6318926",
"0.6309045",
"0.63087755",
"0.63087755",
"0.62917393",
"0.62917393",
"0.62788725",
"0.6270957",
"0.62697667",
"0.6268825",
"0.6259913",
"0.62582904",
"0.6250705",
"0.6245991",
"0.623818",
"0.622721",
"0.62193984",
"0.62193984",
"0.6213751",
"0.62030834",
"0.62003684",
"0.61969346",
"0.61921906",
"0.6183029",
"0.6179998",
"0.6170476",
"0.6169773",
"0.6165573",
"0.6162718",
"0.61595917",
"0.61554956",
"0.6153697",
"0.61527455",
"0.6146812",
"0.61446804",
"0.6142278",
"0.6134368",
"0.6129487",
"0.61249125",
"0.6109585",
"0.6101763",
"0.6098588",
"0.6094724",
"0.60940766",
"0.6087944",
"0.6085895",
"0.6084015",
"0.60807496"
] |
0.8467805
|
0
|
D: Called from with in a ' gl do ' block after the object was properly loaded.
|
def render
@groups.each_value do |grp|
#print("#{grp.name} ")
glCallList( grp.displaylist ) # call precahed operation to save gpu/cpu
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def loaded()\n end",
"def onLoaded()\n @object.loaded\n end",
"def gl_draw\n return if @destoryed # map will take care of the class object.\n # https://docs.microsoft.com/en-us/windows/desktop/opengl/glpushmatrix\n glPushMatrix # for the most part operations should keep to themselfs with location configuration.\n #---------------------------------------------------------\n # https://docs.microsoft.com/en-us/windows/desktop/opengl/gltranslatef\n glTranslatef(@x, @y, @z) # Moving function from the current gluPerspective by x,y,z change\n #---------------------------------------------------------\n # https://docs.microsoft.com/en-us/windows/desktop/opengl/glrotatef\n # glRotatef(angle, X axis scale, Y axis scale, Z axis scale)\n glRotatef(@angle[0], @angle[1], @angle[2], @angle[3])\n #---------------------------------------------------------\n # https://www.rubydoc.info/github/gosu/gosu/master/Gosu/GLTexInfo\n if @texture.nil? || @texture_debugging\n # debug texture drawing: helps find things by painting them a color.\n # https://docs.microsoft.com/en-us/windows/desktop/opengl/gldisable\n glDisable(GL_TEXTURE_2D)\n # https://docs.microsoft.com/en-us/windows/desktop/opengl/glcolor3ub\n glColor3ub(255, 100, 100) # or a diffrent color if desired...\n else # normal drawing\n # https://docs.microsoft.com/en-us/windows/desktop/opengl/glpushmatrix\n glBindTexture(GL_TEXTURE_2D, @texture.tex_name)\n end\n #---------------------------------------------------------\n # https://docs.microsoft.com/en-us/windows/desktop/opengl/glscalef\n # scales the whole object including texture mapping.\n glScalef(@scale, @scale, @scale)\n #---------------------------------------------------------\n # call the cached draw recording for the model.\n unless @object_model.nil?\n @object_model.render\n else\n puts(\"No model to draw for object: [ #{@obj_filename} ]\")\n exit\n end\n #---------------------------------------------------------\n # https://docs.microsoft.com/en-us/windows/desktop/opengl/glpopmatrix\n glPopMatrix\n end",
"def ident; glLoadIdentity; end",
"def onLoad\n end",
"def loaded\n @gazelles_loaded.promise unless @gazelles_loaded.nil?\n end",
"def begin_load\n load_stack.push(true)\n end",
"def post_soft_load(mod); end",
"def object_loaded?(goid)\n @game_objects.loaded?(goid)\n end",
"def post_hard_load(mod); end",
"def load!; end",
"def load_obj_file\n if self.use_wavefrontOBJ_loader() == nil\n # there was an issue loading the object data, dont bother with the image file.\n return nil\n end\n # save the @texture refrence as its refered to later and you dont want to loose the refrence object.\n if @obj_filename != @texture_file\n file = \"Media/Textures/#{@texture_file}.png\"\n else # nest the object file, keeps the directory cleaner this way.\n file = \"Media/3dModels/#{@texture_file}/#{@texture_file}.png\"\n end\n file_dir = File.join(ROOT, file)\n image = Gosu::Image.new(file_dir, retro: true) rescue nil\n if image.nil?\n puts(\"Texture image file was not found for: #{file_dir}\")\n unless TEXTURE_DEBUG\n exit\n else\n return true\n end\n end\n @texture = Yume::Texture.new(image)\n puts(\"Using local 3D object file texture setting:\\n \\\"#{file}\\\"\")\n #--------------------------------------\n # https://www.rubydoc.info/github/gosu/gosu/master/Gosu/Image#gl_tex_info-instance_method\n # @tex_info = @texture.gl_tex_info # helper structure that contains image data\n # not very reliably held to tho, needs a proper class object formater to load images as textures.\n return true # success\n end",
"def load_obj\n @obj=nil\n raise 'Sovrascrivi funzione \"load_obj\" in figli la definizione di questa variabile: @obj'\n end",
"def loadworld\r\n\t\t\t@world = @save.world\r\n\t\tend",
"def load_and_report(obj) # prints a message it's adding a suitcase to the cargo hold, and gives us the suitcase's Object Id number.\n print \"Loading object \"\n puts obj.object_id # also does some reporting of the current state of the stack.\n\n add_to_stack(obj) # adding items to the instance (the stacklike thing-the cargo hold in this case)\n end",
"def on_load_success\r\n Sound.play_load\r\n fadeout_all\r\n $game_system.on_after_load\r\n SceneManager.goto(Scene_Map)\r\n end",
"def reload!\n begin\n #TODO not implemented 2007/04/09 by shino\n raise \"not yet implemented!\"\n end\n end",
"def reload!\n begin\n #TODO not implemented 2007/04/09 by shino\n raise \"not yet implemented!\"\n end\n end",
"def reload!\n begin\n #TODO not implemented 2007/04/09 by shino\n raise \"not yet implemented!\"\n end\n end",
"def reload!\n begin\n #TODO not implemented 2007/04/09 by shino\n raise \"not yet implemented!\"\n end\n end",
"def load; end",
"def load; end",
"def load; end",
"def on_load_success\n fadeout_all\n $game_system.on_after_load\n SceneManager.goto(Scene_Map)\n end",
"def after_loaded(o={}, &block)\n end",
"def load\r\n \r\n end",
"def initialize(options = {})\n super(options)\n @obj_filename = options[:filename] || \"\"\n @texture_file = options[:texture] || @obj_filename # eventually will tie into the load module.\n @texture_debugging = TEXTURE_DEBUG || options[:debug_draw] # skip drawing texture, use defualt mat white.\n #---------------------------------------------------------\n @object_name = '' # Is there an object name provided from .obj file or one set to this Ruby Object?\n @face_count = 0 # how many faces the object has.\n @object_model = nil # container that holds onto the wavefront 3d object data.\n @texture_resource = nil # A string or array that contains the name of textures used when drawing the .obj\n # debug printing of information, time between update posts for string creation.\n @time_between_debug_prints = 0\n @hud_font = Gosu::Font.new(22) # Gosu::Font container\n @string = \"\" # container for HUD information\n # try loading a source .obj file\n success = load_obj_file() rescue nil\n if success.nil?\n # there was an issue that was reported that resulted in a fail loading.\n puts(\"issue with object loading (#{@obj_filename})\")\n puts(\"-\" * 70)\n self.destroy # mark for map clean up/ removal\n return nil\n else\n if @verbose\n puts(\"-\" * 70)\n puts(\"Initializing new OpenGL 3D object... #{self}\")\n end\n end\n # speak if asked.\n if @verbose\n puts(\"New 3D object created from: \\\"#{@object_name}.obj\\\"\")\n puts(\"-\" * 70)\n end\n #@scale = 1.0 # scale the whole object.\n end",
"def load\n\t\t\t\t0\n\t\t\tend",
"def initialized?; end",
"def initialized?; end",
"def initialized?; end",
"def initialized?; end",
"def loader; end",
"def use_wavefrontOBJ_loader\n # nest the object file, keeps the directory cleaner this way.\n @file_dir = File.join(ROOT, \"Media/3dModels/#{@obj_filename}/#{@obj_filename}.obj\") rescue nil\n unless FileTest.exists?(@file_dir)\n puts(\"Mesh Loader Error: Could not find 3D object (#{@obj_filename}) source file.\\n #{@file_dir}\")\n #throw Error.new() \n #exit\n return nil\n end\n #---------------------------------------------------------\n # module that manages loading of 3d objects.\n options = {:object_name => @obj_filename, :verbose => @verbose}\n @object_model = WavefrontOBJ::Model.new(options) rescue nil\n if @object_model.nil?\n puts(\"Failed to load model data for: (#{@obj_filename})\")\n self.destroy # mark self for clean up from object container in map\n return nil\n end\n # seperated to allow for load steping for larger object groups...\n @object_model.setup() # create draw recording array\n # confirm creaion, get some details about the object.\n @object_name = @object_model.object_name\n @face_count = @object_model.get_face_count\n end",
"def on_after_load\n end",
"def finalize!; end",
"def setObjectTextureGlobal _obj, _args\n \"_obj setObjectTextureGlobal _args;\" \n end",
"def loaded?\n true\n end",
"def on_doc_loaded\r\n\t\t@graph = @doc.at('Graph')\r\n\t\t@scene = @graph.at('Scene')\r\n\t\t@logic = @doc.at('Logic')\r\n\r\n\t\tgenerate_custom_classes\r\n\t\trebuild_caches_from_document\r\n\r\n\t\tnil\r\n\tend",
"def load(&_block)\n nil\n end",
"def is_loaded\n\t\tend",
"def loaded!\n @loaded = true\n @stale_state = stale_state\n end",
"def loaded!\n @loaded = true\n @stale_state = stale_state\n end",
"def new_load!(new_lo, new_hi)\n Thread.new do\n Debugger.debug_print(2, \"Got new load: #{new_lo} #{new_hi}\")\n self.stop\n @lo = new_lo\n @hi = new_hi\n @end = false\n self.solve\n end\n end",
"def marshal_load(obj)\r\n @depth, @map_id, @event_id, @list, @index, @branch = obj\r\n create_fiber\r\n end",
"def finalize\n end",
"def load\n end",
"def finalize\n end",
"def finalize\n end",
"def finalize\n end",
"def finalize\n end",
"def finalize\n end",
"def finalize\n end",
"def finalize\n end",
"def un_load\n\n NSLog('Whatever hasn\\'t been unloaded and could be better be now!')\n NSLog('We probably don\\'t need this now that we\\'re using RubyMotion and it\\'s awesome!')\n\n end",
"def post_init\n end",
"def load\n end",
"def load\n end",
"def loaded\n @img.add_class :loaded\n @loader.loading = false\n end",
"def before_load(o={}, &block) \n end",
"def post_init\n end",
"def draw\n # gl will execute the given block in a clean OpenGL environment, then reset\n # everything so Gosu's rendering can take place again.\n \n #gl do\n # glClearColor(0.0, 0.2, 0.5, 1.0)\n # glClearDepth(0)\n # glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT)\n # \n # @gl_background.exec_gl\n #end\n #@background_image.draw(0, 0, ZOrder::Background)\n \n @bullets.each { |o| o.draw }\n @e_bullets.each { |o| o.draw }\n @ennemies.each{|e| e.draw}\n @bonuses.each{|b| b.draw}\n @particles.each{|p| p.draw}\n \n @player.draw\n \n # TODO externalize UI methods\n # Score\n @font.draw(\"Score: #{@player.score}\", 10, 10, ZOrder::UI, 1.0, 1.0, 0xffffff00)\n # Player's lives count\n @font.draw(\"LIVES: #{(@player.lives > -1)? @player.lives : \"GAME OVER\"}\", 10, 30, ZOrder::UI, 1.0, 1.0, 0xffff0000)\n # Current level\n @font.draw(\"LEVEL: #{@w_generator.current_level}\", 10, 50, ZOrder::UI, 1.0, 1.0, 0xffff0000)\n \n # Pause label\n if @state == :paused\n @big_font.draw(\" PAUSE \", @GAME_OVER_X, @GAME_OVER_Y, ZOrder::UI, 1.0, 1.0, 0xffff0000)\n end\n # Game Over label\n if @player.lives < 0\n @big_font.draw(\"GAME OVER\", @GAME_OVER_X, @GAME_OVER_Y, ZOrder::UI, 1.0, 1.0, 0xffff0000)\n end\n # End game label\n if @finished\n @big_font.draw(\"THE END\", @GAME_OVER_X, @GAME_OVER_Y, ZOrder::UI, 1.0, 1.0, 0xffff0000)\n end\n end",
"def loaded? goid\n !!@ghash[goid]\n end",
"def post_init\n\tend",
"def loaded_features; end",
"def loadGame()\n\nend",
"def register_ensure_loaded(object); end",
"def finalize\n\n end",
"def gl(z=nil, &custom_gl_code); end",
"def loaded?\n @loaded ||= false\n end",
"def set_gl\n @gl = Gl.find(params[:id])\n end",
"def finalize_game\n\n end",
"def load_object(game_object_id, game_objects)\n object = nil\n file = nil\n\n open_store \"goids\" do |gd|\n file = gd[game_object_id]\n end\n\n if file.nil?\n log \"No file found for that goid (#{game_object_id})\"\n raise MUDError::NoSuchGOID\n end\n\n open_store file do |gd|\n object = Marshal.load(gd[game_object_id])\n end\n\n if object.nil?\n log \"Tried to load object (#{game_object_id}), but got nil\"\n raise MUDError::ObjectLoadError\n end\n\n if object.respond_to? :inventory\n log \"Loading inventory for #{object}\", Logger::Ultimate\n load_too = object.inventory.map{ |e| e[0]}\n object.inventory = Inventory.new(object.inventory.capacity)\n load_too.each do |goid|\n if game_objects.find_by_id(goid)\n obj = game_objects.find_by_id(goid)\n else\n obj = load_object(goid, game_objects)\n end\n\n #Don't want to load players until they are playing.\n #We can add the player to a room once they login, not before.\n object.inventory << obj unless obj.is_a? Player\n obj.container = object.goid\n end\n end\n\n if object.respond_to? :equipment\n log \"Loading equipment for #{object}\", Logger::Ultimate\n load_too = object.equipment.inventory.map{ |e| e[0]}\n object.equipment.inventory = Inventory.new\n load_too.each do |goid|\n if game_objects.find_by_id(goid)\n obj = game_objects.find_by_id(goid)\n else\n obj = load_object(goid, game_objects)\n end\n\n #Don't want to load players until they are playing.\n #We can add the player to a room once they login, not before.\n unless obj.is_a? Player or obj.nil?\n object.equipment.inventory << obj\n obj.info.equipment_of = object.goid\n end\n\n #Remove object if it does not seem to exist any longer\n if obj.nil?\n object.equipment.delete(goid)\n end\n end\n\n object.load_defaults\n end\n\n\n object.rehydrate(nil)\n game_objects << object\n\n unless object.container.nil? or game_objects.loaded? object.container\n begin\n load_object(object.container, game_objects)\n rescue MUDError::NoSuchGOID, MUDError::ObjectLoadError\n object.container = ServerConfig.start_room\n end\n end\n\n return object\n end",
"def setup\n OpenGL.reset_flags\n end",
"def post_init()\n puts \"#{self} post_init done!\"\n end",
"def post_init()\n puts \"#{self} post_init done!\"\n end",
"def setup\n self.parse() # load file\n puts(\"+Constructing a total of (#{@groups.keys.size}) Groups:\") if @verbose\n @groups.each_value do |grp|\n grp.displaylist = glGenLists( 1 )\n glNewList(grp.displaylist, GL_COMPILE )\n puts(\" * \\\"#{grp.name}\\\" : Faces(#{grp.faces.size}) openGL draw list cached.\") if @verbose\n grp.gl_draw_list(self) # create precahced draw operation\n glEndList()\n end\n puts(\"+Total Count of Faces: [ #{self.get_face_count} ]\") if @verbose\n # display materials information\n puts(\"+Material Lib: \\\"#{material_lib}\\\" with (#{@current_materials.size}) Name Refrences.\") if @verbose\n end",
"def load\n self.class.load self # pass the loading off to the class\n end",
"def on_load\n clear_output\n end",
"def at_init\n\n\t\tend",
"def on_initialization_finished()\n end",
"def on_load(&block)\n @on_load = block\n end",
"def finalized; end",
"def myinit\r\n position = [0.0, 3.0, 3.0, 0.0];\r\n local_view = [0.0];\r\n\r\n GL.Enable(GL::DEPTH_TEST);\r\n GL.DepthFunc(GL::LESS);\r\n\r\n GL.Light(GL::LIGHT0, GL::POSITION, position);\r\n GL.LightModel(GL::LIGHT_MODEL_LOCAL_VIEWER, local_view);\r\n\r\n GL.FrontFace(GL::CW);\r\n GL.Enable(GL::LIGHTING);\r\n GL.Enable(GL::LIGHT0);\r\n GL.Enable(GL::AUTO_NORMAL);\r\n GL.Enable(GL::NORMALIZE);\r\n GL.Enable(GL::FOG);\r\n fogColor = [0.5, 0.5, 0.5, 1.0];\r\n\r\n fogMode = GL::EXP;\r\n GL.Fog(GL::FOG_MODE, fogMode);\r\n GL.Fog(GL::FOG_COLOR, fogColor);\r\n GL.Fog(GL::FOG_DENSITY, 0.35);\r\n GL.Hint(GL::FOG_HINT, GL::DONT_CARE);\r\n GL.ClearColor(0.5, 0.5, 0.5, 1.0);\r\nend",
"def camPreload _obj, _args\n \"_obj camPreload _args;\" \n end",
"def loaded?\n @loaded ||= false\n end",
"def use\n\t\tglUseProgram @id\n\tend",
"def draw_gl_Building\n # Draw building, replace this simple cube with actual building eventually\n draw_textured_gl_cube\n end",
"def InitGL(width, height) # We call this right after our OpenGL window \n return false unless load_gl_textures() # If Texture Didn't Load Return FALSE \n glEnable(GL_TEXTURE_2D)\t\t\t\t\t\t\t# Enable Texture Mapping\n glShadeModel(GL_SMOOTH)\t\t\t\t\t\t\t# Enable Smooth Shading\n glClearColor(0.0, 0.0, 0.0, 0.5)\t\t\t\t# Black Background\n glClearDepth(1.0)\t\t\t\t\t\t\t\t\t# Depth Buer Setup\n glEnable(GL_DEPTH_TEST)\t\t\t\t\t\t\t# Enables Depth Testing\n glDepthFunc(GL_LEQUAL)\t\t\t\t\t\t\t\t# The Type Of Depth Testing To Do\n glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST)\t# Really Nice Perspective Calculations\n\n glLightfv(GL_LIGHT1, GL_AMBIENT, $LightAmbient)\t\t# Setup The Ambient Light\n glLightfv(GL_LIGHT1, GL_DIFFUSE, $LightDiffuse)\t\t# Setup The Diffuse Light\n glLightfv(GL_LIGHT1, GL_POSITION,$LightPosition)\t# Position The Light\n glEnable(GL_LIGHT1)\t\t\t\t\t\t\t\t# Enable Light One\n glColor4f(1.0, 1.0, 1.0, 0.5) # Full Brightness 50% alpha\n glBlendFunc(GL_SRC_ALPHA,GL_ONE)\n return true # Initialization Went OK\nend",
"def reloader; end",
"def reloader; end",
"def init\n GL.ClearColor(0.0, 0.1, 0.2, 0.0)\n GL.ShadeModel(GL::SMOOTH)\n\n GL.Enable(GL::LIGHTING)\n GL.Enable(GL::LIGHT0)\n GL.Enable(GL::BLEND)\n GL.Enable(GL::NORMALIZE)\n\n GL::DepthFunc(GL::LESS);\n GL::ShadeModel(GL::SMOOTH);\n GL::BlendFunc(GL::ONE, GL::ONE)\n\n lm_ambient = [ 0.2, 0.2, 0.2, 0.0 ];\n\n GL.Light(GL::LIGHT0, GL::POSITION, [4, 4, 4])\n GL.Light(GL::LIGHT0, GL::POSITION, [-2, 6, 3])\n #GL::LightModel(GL::LIGHT_MODEL_AMBIENT, lm_ambient);\n GL::LightModel(GL::LIGHT_MODEL_TWO_SIDE, 2);\n\n $ruby = RubyRuby.new\n GL::NewList($rubyList, GL::COMPILE)\n $ruby.render\n GL::EndList()\nend",
"def main\r\n Graphics.update until @unlocked\r\n $scene = @@class.new(*@@args)\r\n $scene.main\r\n if $scene != self\r\n $scene = nil\r\n @thread.kill\r\n end\r\n rescue Exception\r\n manage_exception\r\n end",
"def finished_init\n loc = self.location\n loc.move_item_inside(self) unless loc.nil?\n nil\n end",
"def pbSceneStandby\n Graphics.frame_reset; yield\n $scene.disposeSpritesets if $scene && $scene.is_a?(Scene_Map)\n $scene.createSpritesets if $scene && $scene.is_a?(Scene_Map)\nend",
"def gc_resume\n\n fail 'State got closed, cannot proceed' unless @pointer\n Lib.lua_gc(@pointer, LUA_GCRESTART, 0)\n end",
"def load\n end",
"def load\n end",
"def load\n end",
"def garbage_collect\n self.components.clear\n GC.start\n ObjectSpace.each_object(Component) do |c|\n components << c if c.world == self\n end\n end",
"def refresh_frame(run_whereami = T.unsafe(nil)); end"
] |
[
"0.65729517",
"0.6163924",
"0.6021082",
"0.6014012",
"0.5973201",
"0.5861735",
"0.5779779",
"0.5762361",
"0.5747806",
"0.57429296",
"0.57343614",
"0.56684595",
"0.5666622",
"0.56608355",
"0.5644843",
"0.56314695",
"0.56200767",
"0.56200767",
"0.56200767",
"0.56200767",
"0.56141686",
"0.56141686",
"0.56141686",
"0.5607587",
"0.5551021",
"0.55470896",
"0.5546315",
"0.5540181",
"0.5504714",
"0.5504714",
"0.5504714",
"0.5504714",
"0.5498617",
"0.5493511",
"0.5488884",
"0.5467078",
"0.5423073",
"0.54204804",
"0.5418376",
"0.54083824",
"0.5398713",
"0.5397058",
"0.5397058",
"0.5375285",
"0.5371966",
"0.53599316",
"0.5346338",
"0.5345004",
"0.5345004",
"0.5345004",
"0.5345004",
"0.5345004",
"0.5345004",
"0.5345004",
"0.53322774",
"0.5318853",
"0.5318601",
"0.5318601",
"0.5302421",
"0.530064",
"0.52985203",
"0.529555",
"0.5271848",
"0.52688485",
"0.5266048",
"0.52550447",
"0.52402115",
"0.52388734",
"0.5223979",
"0.5209795",
"0.52083254",
"0.5203985",
"0.51983947",
"0.51982313",
"0.5197913",
"0.5197913",
"0.51928395",
"0.51877403",
"0.5185667",
"0.5185433",
"0.51771307",
"0.51760286",
"0.5174439",
"0.5172303",
"0.51722527",
"0.5163198",
"0.5159921",
"0.5152546",
"0.5142348",
"0.513257",
"0.513257",
"0.5129702",
"0.51181567",
"0.51179117",
"0.5109683",
"0.510762",
"0.51065856",
"0.51065856",
"0.51065856",
"0.5105157",
"0.50881416"
] |
0.0
|
-1
|
D: Read a .obj file and turn the lines into data points to create the object.
|
def parse
wo_lines = IO.readlines( @file_dir )
@current_group = get_group( "default" )
@current_material_name = "default"
puts("+Loading .obj file:\n \"#{@file_dir.sub(ROOT, '')}\"") if @verbose
# parse file context
wo_lines.each do |line|
tokens = line.split
# make sense of the object tokens
string = line.sub("\r", "")
process_line(tokens[0], tokens[1..tokens.length-1], string.sub("\n", ""))
end
@object_name = @file_dir.split('/').last
@object_name.sub!(".obj", '')
# verbose status updates
puts("+Object name is \"#{@object_name}\" with (#{@objects.size}) Internal Objects.") if @verbose
if get_group("default").faces.empty?
@groups.delete("default")
end
@current_group = nil
@current_material_name = nil
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def read_objects(file, objects)\n objects.each do |data_type|\n num = DataNumber.new.read(file).data\n\n # use i to indentify the type of object.\n num.times do ||\n _obj = data_type.new.read(file)\n end\n end\n end",
"def from_file line\n\t\tvals = line.split(\"-\")\n\t\t@type = vals[0].to_i\n\t\t@obj = vals[1]\n\t\tif vals[2] != nil\n\t\t\t@sensor = vals[2]\n\t\tend\n\t\tif vals[3] != nil\n\t\t\t@value = vals[3].to_f\n\t\tend\n\tend",
"def initialize(filename)\n\t\tbegin\n @sourcefile = filename\n \n\t\t\tFile.open(filename, \"r\") do |objfile|\n\t\t\t\tunless getl(objfile) == \"LINK\"\n\t\t\t\t\tputs \"Invalid file format: \" + filename\n\t\t\t\t\treturn nil\n\t\t\t\tend\n\n\t\t\t\t# Read header info\n\t\t\t\t@nsegs, @nsyms, @nrlocs = getl(objfile).split(' ').collect {|x| x.to_i}\n\t\t\t\t\n\t\t\t\t# Parse segs\n\t\t\t\t@segrecs = [], @segnames = {}\n\t\t\t\tgather_segs(objfile)\n\t\t\t\t\n\t\t\t\t# Parse symbols\n\t\t\t\t@symrecs = [], @symnames = {}\n\t\t\t\tgather_syms(objfile)\n\t\t\t\t\n\t\t\t\t# Parse relocations\n\t\t\t\t@rlocrecs = []\n\t\t\t\tgather_rlocs(objfile)\n\t\t\t\t\n\t\t\t\t# Slurp in data\n\t\t\t\t@segrecs.select {|seg| /P/===seg[:type]}.each do |seg|\n\t\t\t\t\tseg[:data] = getl(objfile).hex2bin\n\t\t\t\tend\n\n\t\t\tend\n\t\trescue\n\t\t\tputs \"Could not open object file: \" + filename\n\t\tend\n\tend",
"def load_dataE(filename)\r\n Log.ger.debug('Read '+filename)\r\n File.open(filename, \"rb\") { |f|\r\n obj = Marshal.load(f)\r\n }\r\nend",
"def parse_file\n filename = full_path_from_edict_file(@config[\"filename\"])\n ### Get all the line into memory\n file_obj = File.new(filename, \"r\")\n file_obj.each do |line|\n @added_lines.push line\n end\n end",
"def import_next_object(f, order)\n f_size = read_word(f)\n f_type = read_word(f)\n f_data = f.read(f_size - 4)\n frag = Fragment.create! order: order, orig_data: f_data, scenario_id: id, f_type: f_type, size: f_size\n f_type == 16 ? create_line(frag) : 0\n end",
"def obj_file source\n ext = @data['extensions'][@language]['source']\n obj, src = builddir(source.sub(/#{ext}$/, objext)), srcdir(source)\n d = File.dirname(obj)\n\n directory d\n file obj => [ d, src ] do\n make_object obj, src\n end\n CLEAN.include obj\n\n obj\n end",
"def read_points(points_file)\n points = []\n\n File.open \"../../samples/\" << points_file do |file|\n file.each_line do |line|\n coordinates = line.split(' ').map { |x| x.to_f }\n points << Geometry::Point.new(coordinates[0], coordinates[1])\n end\n end\n points\nend",
"def generate(obj)\n factory = obj.factory\n if @type_format == :ewkb || @type_format == :wkb12\n @cur_has_z = factory.property(:has_z_coordinate)\n @cur_has_m = factory.property(:has_m_coordinate)\n else\n @cur_has_z = nil\n @cur_has_m = nil\n end\n @cur_dims = 2 + (@cur_has_z ? 1 : 0) + (@cur_has_m ? 1 : 0)\n start_emitter\n generate_feature(obj, true)\n finish_emitter\n end",
"def use_wavefrontOBJ_loader\n # nest the object file, keeps the directory cleaner this way.\n @file_dir = File.join(ROOT, \"Media/3dModels/#{@obj_filename}/#{@obj_filename}.obj\") rescue nil\n unless FileTest.exists?(@file_dir)\n puts(\"Mesh Loader Error: Could not find 3D object (#{@obj_filename}) source file.\\n #{@file_dir}\")\n #throw Error.new() \n #exit\n return nil\n end\n #---------------------------------------------------------\n # module that manages loading of 3d objects.\n options = {:object_name => @obj_filename, :verbose => @verbose}\n @object_model = WavefrontOBJ::Model.new(options) rescue nil\n if @object_model.nil?\n puts(\"Failed to load model data for: (#{@obj_filename})\")\n self.destroy # mark self for clean up from object container in map\n return nil\n end\n # seperated to allow for load steping for larger object groups...\n @object_model.setup() # create draw recording array\n # confirm creaion, get some details about the object.\n @object_name = @object_model.object_name\n @face_count = @object_model.get_face_count\n end",
"def export_obj faces, filename\n v = []\n v_index = {}\n f = []\n\n faces.each do |face|\n f << []\n face.each do |vert|\n if(v_index[vert.to_s].nil?)\n v << vert\n v_index[vert.to_s] = v.length-1\n f[f.length-1] << v.length\n else\n f[f.length-1] << v_index[vert.to_s] + 1\n end\n end\n end\n\n first_part = \"v \" + v.join(\"\\nv \")\n f_strings = f.map {|face| face.join(\" \")}\n second_part = \"\\nf \" + f_strings.join(\"\\nf \")\n\n File.write(\"#{filename}.obj\", first_part + second_part)\nend",
"def write_obj_file output_path\n File.open(output_path, 'w') do |f|\n @vbuffer.each_triple do |a,b,c|\n f.puts \"v #{a} #{b} #{c}\"\n end\n @vnbuffer.each_triple do |a,b,c|\n f.puts \"vn #{a} #{b} #{c}\"\n end\n @fbuffer.each_triple do |a,b,c|\n f.puts \"f #{a+1}//#{a+1} #{b+1}//#{b+1} #{c+1}//#{c+1}\"\n end\n end\n self\n end",
"def load_obj_file\n if self.use_wavefrontOBJ_loader() == nil\n # there was an issue loading the object data, dont bother with the image file.\n return nil\n end\n # save the @texture refrence as its refered to later and you dont want to loose the refrence object.\n if @obj_filename != @texture_file\n file = \"Media/Textures/#{@texture_file}.png\"\n else # nest the object file, keeps the directory cleaner this way.\n file = \"Media/3dModels/#{@texture_file}/#{@texture_file}.png\"\n end\n file_dir = File.join(ROOT, file)\n image = Gosu::Image.new(file_dir, retro: true) rescue nil\n if image.nil?\n puts(\"Texture image file was not found for: #{file_dir}\")\n unless TEXTURE_DEBUG\n exit\n else\n return true\n end\n end\n @texture = Yume::Texture.new(image)\n puts(\"Using local 3D object file texture setting:\\n \\\"#{file}\\\"\")\n #--------------------------------------\n # https://www.rubydoc.info/github/gosu/gosu/master/Gosu/Image#gl_tex_info-instance_method\n # @tex_info = @texture.gl_tex_info # helper structure that contains image data\n # not very reliably held to tho, needs a proper class object formater to load images as textures.\n return true # success\n end",
"def read_data(file_name)\n file = File.open(file_name,\"r\")\n object = eval(file.gets)\n file.close()\n return object\nend",
"def import\n fragments.each(&:destroy)\n File.open(bin_file_name, \"rb\") do |f|\n order = 0\n new_lines = 0\n until f.eof?\n new_lines += import_next_object(f, order)\n order += 1\n end\n update! lines: new_lines\n end\n add_locations\n end",
"def load_data(filename)\n if File.exist? filename\n File.foreach (filename) do |line|\n line = line.chomp.split(\" \").map(&:to_i)\n if line.length == 1\n @num_vertices = line[0]\n next\n else\n @edges << [line[2], line[0], line[1]]\n if !@groups[line[0]]\n @groups[line[0]] = [line[0]]\n @leader_pointers[line[0]] = line[0]\n end\n if !@groups[line[1]]\n @groups[line[1]] = [line[1]]\n @leader_pointers[line[1]] = line[1]\n end \n end\n end\n end\n # sort edges costs\n @edges.sort! { |a, b| a[0] <=> b[0] }\n end",
"def save_dataE(obj, filename) \r\n File.open(filename, \"wb\") { |f|\r\n Marshal.dump(obj, f)\r\n }\r\nend",
"def load_file (filename)\n @name = nil\n File.open(filename, mode: 'r').each do |ln|\n flds = ln.split(',')\n if !@name\n @name = flds[0]\n end\n dts = flds[1];\n @obvs << \"#{dts[2..3]}-#{dts[4..5]}-#{dts[6..7]}\"\n @values << flds[2].to_f\n end\n #puts \"load_file: #{@values.size}\"\n end",
"def load objid\n DataObj.new @repo, self, objid\n end",
"def load_xy_file(filename)\n xy_data = Array.new\n File.open(filename, \"r\") do |xy_file|\n xy_file.each_line do |line|\n x, y = line.split(' ')\n xy_data << [ string_to_number(x), string_to_number(y) ] \n end\n end\n xy_data\n end",
"def load(handle, args={})\n File.open(handle) do |handle|\n db = DnaIO.new handle\n db.each do |record|\n self.add(record.sequence, record.name)\n end\n end\n end",
"def load_obj\n @obj=nil\n raise 'Sovrascrivi funzione \"load_obj\" in figli la definizione di questa variabile: @obj'\n end",
"def read_cities_from_input!\n file = nil\n\n if(ARGV[0] and not ARGV[0].empty?)\n file = File.open(ARGV[0], \"r\")\n else\n file = File.open(\"cities.txt\", \"r\")\n end\n\n file.each_with_index do |line, idx|\n line_ar = line.split(\"\\t\")\n #Loads each line into an object with a name and a location vector with latitude and longitude\n @@cities[idx] = {:name=>line_ar[0], :location=>Vector[line_ar[1].to_f, line_ar[2].to_f]}\n end\n end",
"def load_objects\n objects = []\n [@opts[:organization_data], @opts[:ticket_data], @opts[:user_data]]\n .zip(['organization', 'ticket', 'user'])\n .map do |file_paths, object_type|\n file_paths.each do |file_path|\n read_objects = JSON.parse File.read(file_path)\n read_objects.each { |o| o['_type'] = object_type }\n objects.concat read_objects\n end\n end\n return objects\n end",
"def read_contents\n\n #puts \"pofr file #{@file_blob.filename}\"\n\n file_lines=[]\n @file_blob.open do |file|\n File.open(file){|x| file_lines = x.readlines}\n puts file_lines[0]\n puts file_lines.last\n end\n\n if @file_blob.filename.extension == \"out\" # GNOM\n getDataLinesFromGnom(file_lines)\n elsif @file_blob.filename.extension == \"dat\" # scatter\n puts \"reading file @file #{@file_blob.filename}\"\n getDataLinesFromScatter(file_lines)\n end\n\n @dmax = @r_values.last\n @pr_values.each do |y|\n @pr_max = (y[1] > @pr_max) ? y[1] : @pr_max\n @pr_min = (y[1] < @pr_min) ? y[1] : @pr_min\n end\n\n end",
"def readObject\n raise NotImplementedError, <<-STR\n\n \\e[91m\n I'm afraid this might not work.\n > you need access to the original class definitions (and a)\n > Java runtime to load them into) to turn the stream data back\n > something approaching the original objects.\n \\e[0m\n STR\n end",
"def load_xy_file(filename)\n xy_data = Array.new\n File.open(filename, \"r\") do |xy_file|\n xy_file.each_line do |line|\n x, y = line.split(' ')\n xy_data << [ string_to_number(x), string_to_number(y) ]\n end\n end\n xy_data\n end",
"def read_data_object( filename )\n\n data_dir = self.config['data_dir'] || '_data'\n data_path = File.join(self.config['source'], data_dir)\n if File.symlink?(data_path)\n return \"Data directory '#{data_path}' cannot be a symlink\"\n end\n file = File.join(data_path, filename)\n\n return \"File #{file} could not be found\" if !File.exists?( file )\n \n result = nil\n Dir.chdir(data_path) do\n rows = []\n CSV.foreach(filename, headers: true, col_sep: ',') do |row|\n rows << row.to_hash\n end\n result = rows\n end\n puts \"## Error: No data in #{file}\" if result.nil?\n result = JSON.parse( result.to_json ) if result\n { 'data' => result,\n 'mtime' => File.mtime(file) }\n end",
"def load_objects\n @objects.each do |obj|\n case obj[:type]\n when :sphere\n draw_sphere(obj[:radius], obj[:point])\n when :text\n draw_text(obj[:text], obj[:point])\n when :point\n draw_point(obj[:point])\n end\n end\n end",
"def load_simple_objects\n simple_objects = {}\n simple_objects[:scenarios] = [\n {id: :base, name: 'Base'},\n {id: :optimistic, name: 'Optimistic'}\n ]\n simple_objects[:products] = [\n {id: :consulting, name: 'Consulting'},\n {id: :tv_ads, name: 'Television ads'},\n {id: :radio_ads, name: 'Radio ads'},\n {id: :billboard_ads, name: 'Billboard ads'},\n {id: :mag_ads, name: 'Magazine ads'},\n {id: :conferences, name: 'Conferences'},\n {id: :affiliate_rev, name: 'Affiliate revenue'}\n ]\n simple_objects[:segments] = [\n {id: :platinum, name: 'Platinum'},\n {id: :gold, name: 'Gold'},\n {id: :silver, name: 'Silver'}\n ]\n simple_objects[:stages] = [\n {id: :customer, name: 'Customer', position: 1},\n {id: :lead, name: 'Lead', position: 2},\n {id: :prospect, name: 'Prospect', position: 3, lag_periods: 1}\n ]\n simple_objects[:employee_types] = [\n {id: :partner, name: 'Partner'},\n {id: :creative, name: 'Creative'},\n {id: :acct_exec, name: 'Account Executive'},\n {id: :assistant, name: 'Assistant'}\n ]\n simple_objects[:vendors] = [\n {id: :big_media, name: 'Big Media Co.'},\n {id: :mad_props, name: 'Madison Avenue Properties'},\n {id: :winston, name: 'Winston\\'s Cigars'},\n {id: :staples, name: 'Staples'},\n {id: :staples, name: 'Derek the contractor', is_contractor: true}\n ]\n simple_objects.each do |object_name, collection|\n collection.each do |attributes|\n create_object! object_name, attributes[:id], without(attributes, [:id])\n end\n end\n end",
"def import_a_igcfile(file)\n\n columns = [ :lat_lon, :baro_alt, :gps_alt, :enl, :seq_secs, :igcfile_id, :rlat, :rlon, :x, :y]\n options = { :validate => false }\n save_obj=Hash.new\n sma=[]\n\n objects = []\n num_recs=1 # to prevent divide by zero\n counter=0\n\n begin\n igcfile = Igcfile.new()\n igcfile.filename=file\n igcfile.save!\n rescue\n next\n end\n\n start = Time.now\n\n # I033638FXA3941ENL4247REX an I record defines B record extensions\n counter=0\n time=0\n fp = File.open(file, \"r\")\n contents = fp.read\n\n # get I record\n b_extensions2 = Hash.new\n contents.each_line do |line|\n a=line.unpack('a1a2a7a7a7a7a7a7a7') # hopefully enough\n if a[0]=='A'\n next\n end\n if a[0]=='H'\n next\n end\n if a[0]=='I'\n if not a[1].nil?\n 0.upto(a[1].to_i){|n|\n b=a[n+2].unpack('a2a2a3')\n b_extensions2[b[2]]={:start => b[0], :finnish => b[1]}\n }\n end\n break\n end\n break\n end\n\n if b_extensions2.length == 0\n puts 'No I record'\n end\n\n if b_extensions2['ENL'].nil?\n puts 'No ENL in I record'\n else\n # puts b_extensions2['ENL'].inspect\n end\n\n # last_time=0\n contents.each_line do |line|\n # 0(1)=rec, 1(6)=time, 2(8)=lat, 3(9)=lon, 4(1)=validity, 5(5)=baro_alt, 6(5)=gps_alt\n # optional see Irec 7(3)=fix_accuracy, 8(2)=num_satelites, 9(3)=enl\n\n a=line.unpack('a1a6a8a9a1a5a5a')\n if a[0].to_s == 'B'\n\n num_recs=num_recs+1\n\n # time B0915235535648N01340869EA-006900049000\n h,m,s = a[1].scan(%r{(\\d{2})(\\d{2})(\\d{2})}).flatten\n time = h.to_i * 3600 + m.to_i * 60 + s.to_i\n # if last_time==0\n # last_time=time\n # end\n\n # enl\n if hv=b_extensions2['ENL']\n enl=line[hv[:start].to_i..hv[:finnish].to_i]\n else\n enl='0'\n end\n\n dd,mm,mmm,ns = a[2].scan(%r{(\\d{2})(\\d{2})(\\d{3})(\\w{1})}).flatten #Latitude DDMMMMMN Valid characters N, S, 0-9\n rlat = ((dd.to_f + mm.to_f/60 + (mmm.to_f/1000)/60))*RAD_PER_DEG\n rlat = - rlat unless ns=='N'\n\n ddd,mm,mmm,ew = a[3].scan(%r{(\\d{3})(\\d{2})(\\d{3})(\\w{1})}).flatten #Longitude DDDMMMMME Valid characters E,W, 0-9\n rlon = ((ddd.to_f + mm.to_f/60 + (mmm.to_f/1000)/60))*RAD_PER_DEG\n rlon = - rlon unless ew=='E'\n\n # cartesian\n x = (RADIUS * Math.cos(rlat) * Math.cos(rlon)).to_i\n y = (RADIUS * Math.cos(rlat) * Math.sin(rlon)).to_i\n\n #columns = [ :lat_lon, :baro_alt, :gps_alt, :enl, :seq_secs, :igcfile_id, :rlat, :rlon, :x, :y]\n #objects << [ a[2]+','+a[3],a[5].to_i,a[6].to_i,enl.to_i, time, igcfile.id,rlat,rlon,x.to_i,y.to_i]\n obj = { :lat_lon => a[2]+','+a[3], :baro_alt => a[5].to_i, :gps_alt => a[6].to_i,\n :enl => enl.to_i, :seq_secs => time, :igcfile_id => igcfile.id, :rlat => rlat, :rlon => rlon,\n :x => x, :y => y}\n\n if not save_obj.empty?\n #puts \"one time\"\n\n #speed\n obj[:ms] = (((obj[:x] - save_obj[:x])**2 + (obj[:y] - save_obj[:y])**2)**0.5)/(obj[:seq_secs] - save_obj[:seq_secs])\n #obj[:ms] = (obj[:seq_secs] - save_obj[:seq_secs])\n #obj[:ms] = (obj[:seq_secs] - save_obj[:seq_secs])\n # if obj[:ms] == 0\n # puts obj[:ms]\n # end\n # energy change\n obj[:pe] = GLIDER_MASS * GRAV_CONST * (obj[:baro_alt] )\n #obj[:pe] = GLIDER_MASS * GRAV_CONST * (obj[:baro_alt] + Polar_sink[obj[:ms]] * (obj[:seq_secs] - save_obj[:seq_secs]))\n obj[:ke] = 0.5 * GLIDER_MASS * (obj[:ms])**2 # should compensate speed for wind component here\n #obj[:te]= obj[:ke] + obj[:pe]\n obj[:dedt]=((obj[:pe] - save_obj[:pe]) + (obj[:ke] - save_obj[:ke])) / (obj[:seq_secs] - save_obj[:seq_secs])\n\n\n #moving average speed in 2 dimnsions. could be moved out of this loop\n max=0\n may=0\n avg_cnt=0\n objects.reverse_each {|item|\n break if item[:seq_secs] < obj[:seq_secs]-30\n avg_cnt+=1\n max=max+item[:x]\n may=may+item[:y]\n }\n\n if avg_cnt > 0\n obj[:max]=(max/avg_cnt).to_i\n obj[:may]=(may/avg_cnt).to_i\n else\n obj[:max]=obj[:x]\n obj[:may]=obj[:y]\n end\n\n obj[:mams] = (((obj[:max] - save_obj[:max])**2 + (obj[:may] - save_obj[:may])**2)**0.5)/(obj[:seq_secs] - save_obj[:seq_secs]).to_i\n #obj[:mams] = (obj[:seq_secs] - save_obj[:seq_secs]) * 100\n # if obj[:mams] == 0\n # obj[:mams]=10\n # else\n # end\n #obj[:mams] = save_obj[:seq_secs]\n #obj[:mams]=0\n\n objects << obj\n else\n obj[:ms]=0\n obj[:pe]=0\n obj[:ke]=0\n obj[:max]=obj[:x]\n obj[:may]=obj[:y]\n end\n\n save_obj=obj\n end\n end\n\n #\n objects.each_with_index do |object,index|\n\n avg_cnt=0\n objects[0..index].reverse_each {|item|\n break if item[:seq_secs] < object[:seq_secs]-40\n avg_cnt+=1\n\n # te = (object[:te] - save_obj[:te]) unless save_obj[:te].nil?\n # tt = (object[:seq_secs] - save_obj[:seq_secs]) unless save_obj[:seq_secs].nil?\n # dedt = te/tt - ()\n\n # max=max+item[:x]\n # may=may+item[:y]\n }\n\n # if avg_cnt > 0\n # obj[:max]=(max/avg_cnt).to_i\n # obj[:may]=(may/avg_cnt).to_i\n # obj[:mams] = (((obj[:max] - item[:max])**2 + (obj[:may] - item[:may])**2)**0.5)/(obj[:seq_secs] -item[:seq_secs]).to_i\n # else\n # obj[:mams]=0\n # #obj[:max]=obj[:x]\n # #obj[:may]=obj[:y]\n # end\n # the import bogs down if there are too many records so chop it up\n counter=counter+1\n # if counter > 100\n # Igcpoint.import(columns, objects, options)\n # objects=[]\n # counter=0\n # end\n end\n\n ary = []\n objects.each do |obj|\n ary << [ obj[:lat_lon], obj[:baro_alt], obj[:dedt], obj[:enl], obj[:seq_secs], obj[:igcfile_id], obj[:rlat], obj[:rlon], obj[:x], obj[:y]]\n #ary << [ obj[:lat_lon], obj[:baro_alt], obj[:gps_alt], obj[:enl], obj[:seq_secs], obj[:igcfile_id], obj[:rlat], obj[:rlon], obj[:x], obj[:y]]\n end\n\n Igcpoint.import(columns, ary, options) unless ary.length==0\n secs = Time.now - start\n puts file.to_s + ' ' + num_recs.to_s + ' ' + (num_recs/secs).to_i.to_s\n STDOUT.flush\n\n fp.close\n num_recs\n end",
"def readFile\n File.open(ARGV[0], \"r\") do |f|\n f.each_line do |line|\n if line != \" \" or line != \"\"\n auxData = line.split\n n = Operations.new(auxData[1],auxData[2],auxData[3])\n $data.push(n)\n end\n end\n end\nend",
"def diphot_metadata_to_h\n File.open(@qualified_filename, 'r') do |fd|\n diff = fd.readline.chomp\n reference = fd.readline.chomp\n @obj_metadata = { 'diff' => diff, 'reference' => reference }\n end\n end",
"def import_line(line)\n line_array = line.split(\"\\t\") #? name\n\n # destructuring\n @name, @cuisine, @price = line_array\n\n return self # returns the OBJECT\n end",
"def process_input_file file_name\n\tFile.open(file_name, \"r\").each_line do |line|\n\t\tobj=MerchantGuideToGalaxy.new(line)\n\t\tobj.compute_line\n\tend\nend",
"def rehydrate_model_from(filename)\n log(\"Reading saved #{method2str} model from #{filename}.\")\n File.open(filename, \"r\") do |file|\n @model = JSON.parse(file.read)\n end \n end",
"def load_data(filename)\n if File.exist? filename\n line_num = 0\n File.foreach (filename) do |line|\n line_num += 1\n line = line.chomp.to_i\n if line_num == 1\n @number_of_vertices = line \n else\n @weights << line\n end\n end\n end\n end",
"def writeVertexBufferObjectFiles (typeName, structHash)\n\tcurrentDate = Time.new.strftime(\"%Y/%m/%d\")\n\tcurrentYear = Time.new.strftime(\"%Y\")\n\t\n\tif typeName =~ /NezInstanceAttribute(\\w+)/ then\n\t\tclassName = 'NezInstanceAttributeBufferObject'+$1\n\telse\n\t\tclassName = 'NezInstanceAttributeBufferObject'+typeName\n\tend\n\n\tFile.open(className+'.h', 'w') do |f2|\n\t\tf2.puts('//')\n\t\tf2.puts('// '+className+'.h')\n\t\tf2.puts('// Aletteration3')\n\t\tf2.puts('//')\n\t\tf2.puts('// Created by David Nesbitt on '+currentDate+'.')\n\t\tf2.puts('// Copyright (c) '+currentYear+' David Nesbitt. All rights reserved.')\n\t\tf2.puts('//')\n\t\tf2.puts('')\n\t\tf2.puts('#import \"NezInstanceAttributeBufferObject.h\"')\n\t\tf2.puts('')\n\t\tf2.puts('@interface '+className+' : NezInstanceAttributeBufferObject')\n\t\tf2.puts('')\n\t\tf2.puts('@property (readonly, getter = getInstanceAttributeList) '+typeName+' *instanceAttributeList;')\n\t\tf2.puts('')\n\t\tf2.puts('@end')\n\tend\n\n\tFile.open(className+'.m', 'w') do |f2|\n\t\tf2.puts('//')\n\t\tf2.puts('// '+className+'.m')\n\t\tf2.puts('// Aletteration3')\n\t\tf2.puts('//')\n\t\tf2.puts('// Created by David Nesbitt on '+currentDate+'.')\n\t\tf2.puts('// Copyright (c) '+currentYear+' David Nesbitt. All rights reserved.')\n\t\tf2.puts('//')\n\t\tf2.puts('')\n\t\tf2.puts('#import \"'+className+'.h\"')\n\t\tf2.puts('#import \"NezGLSLProgram.h\"')\n\t\tf2.puts('')\n\t\tf2.puts('@implementation '+className)\n\t\tf2.puts('')\n\t\tf2.puts('-(instancetype)initWithInstanceCount:(GLsizei)instanceCount {')\n\t\tf2.puts('\tif ((self = [super initWithInstanceCount:instanceCount])) {')\n\t\tf2.puts('\t\t'+typeName+' *aDst = self.instanceAttributeList;');\n\t\tf2.puts('\t\tfor (NSInteger i=0; i<instanceCount; i++) {')\n\t\tstructHash.each_key {|key|\n\t\t\tif structHash[key] == 'GLKMatrix4' then\n\t\tf2.puts('\t\t\taDst[i].'+key+' = GLKMatrix4Identity;')\n\t\t\telsif structHash[key] == 'GLKVector2' then\n\t\tf2.puts('\t\t\taDst[i].'+key+' = GLKVector2Make(0.0f, 0.0f);')\n\t\t\telsif structHash[key] == 'GLKVector3' then\n\t\tf2.puts('\t\t\taDst[i].'+key+' = GLKVector3Make(0.0f, 0.0f, 0.0f);')\n\t\t\telsif structHash[key] == 'GLKVector4' then\n\t\tf2.puts('\t\t\taDst[i].'+key+' = GLKVector4Make(0.0f, 0.0f, 0.0f, 0.0f);')\n\t\t\telsif structHash[key] == 'GLKQuaternion' then\n\t\tf2.puts('\t\t\taDst[i].'+key+' = GLKQuaternionIdentity;')\n\t\t\telsif structHash[key] == 'float' then\n\t\tf2.puts('\t\t\taDst[i].'+key+' = 0.0f;')\n\t\t\tend\n\t\t}\n\t\tf2.puts('\t\t}')\n\t\tf2.puts('\t}')\n\t\tf2.puts('\treturn self;')\n\t\tf2.puts('}')\n\t\tf2.puts('')\n\t\tf2.puts('-(GLsizei)getSizeofInstanceAttribute {')\n\t\tf2.puts('\treturn sizeof('+typeName+');')\n\t\tf2.puts('}')\n\t\tf2.puts('')\n\t\tf2.puts('-('+typeName+'*)getInstanceAttributeList {')\n\t\tf2.puts('\treturn ('+typeName+'*)_instanceData.bytes;')\n\t\tf2.puts('}')\n\t\tf2.puts('')\n\t\tf2.puts('-(void)enableInstanceVertexAttributesForProgram:(NezGLSLProgram*)program {')\n\t\tstructHash.each_key {|key|\n\t\t\tif structHash[key] == 'float' then\n\t\tf2.puts('\t[self enableInstanceVertexAttributeWithLocation:program.a_'+key+' size:1 stride:self.sizeofInstanceAttribute offset:(void*)offsetof('+typeName+', '+key+')];')\n\t\t\t\telsif structHash[key] == 'GLKVector2' then\n\t\tf2.puts('\t[self enableInstanceVertexAttributeWithLocation:program.a_'+key+' size:2 stride:self.sizeofInstanceAttribute offset:(void*)offsetof('+typeName+', '+key+')];')\n\t\t\t\telsif structHash[key] == 'GLKVector3' then\n\t\tf2.puts('\t[self enableInstanceVertexAttributeWithLocation:program.a_'+key+' size:3 stride:self.sizeofInstanceAttribute offset:(void*)offsetof('+typeName+', '+key+')];')\n\t\t\t\telsif structHash[key] == 'GLKVector4' then\n\t\tf2.puts('\t[self enableInstanceVertexAttributeWithLocation:program.a_'+key+' size:4 stride:self.sizeofInstanceAttribute offset:(void*)offsetof('+typeName+', '+key+')];')\n\t\t\t\telsif structHash[key] == 'GLKQuaternion' then\n\t\tf2.puts('\t[self enableInstanceVertexAttributeWithLocation:program.a_'+key+' size:4 stride:self.sizeofInstanceAttribute offset:(void*)offsetof('+typeName+', '+key+')];')\n\t\t\t\telsif structHash[key] == 'GLKMatrix4' then\n\t\tf2.puts('\t[self enableInstanceVertexAttributeWithLocation:program.a_'+key+'Column0 size:4 stride:self.sizeofInstanceAttribute offset:(void*)offsetof('+typeName+', '+key+'.m00)];')\n\t\tf2.puts('\t[self enableInstanceVertexAttributeWithLocation:program.a_'+key+'Column1 size:4 stride:self.sizeofInstanceAttribute offset:(void*)offsetof('+typeName+', '+key+'.m10)];')\n\t\tf2.puts('\t[self enableInstanceVertexAttributeWithLocation:program.a_'+key+'Column2 size:4 stride:self.sizeofInstanceAttribute offset:(void*)offsetof('+typeName+', '+key+'.m20)];')\n\t\tf2.puts('\t[self enableInstanceVertexAttributeWithLocation:program.a_'+key+'Column3 size:4 stride:self.sizeofInstanceAttribute offset:(void*)offsetof('+typeName+', '+key+'.m30)];')\n\t\t\tend\n\t\t}\n\t\tf2.puts('}')\n\t\tf2.puts('')\n\t\tf2.puts('@end')\n\tend\nend",
"def data\n @data ||= Dir['data/*'].reduce({}) do |data, file|\n raw_data = File.read(file)\n filename = parse_filename(file)\n schema = schemas[filename]\n\n data[filename] = raw_data.split(\"\\n\").map do |row|\n schema.reduce({}) do |object, column|\n # slice from the beginning of the row the relevant number of\n # characters based on the column's attribute length\n raw_value = row.slice!(0, column[:length].to_i)\n\n parsed_value = parse_attribute(raw_value, column[:type])\n object[column[:name]] = parsed_value\n object\n end\n end\n end\n end",
"def initialize filename\n\t\tFile.open(filename) do |f|\n\t\t\ts = f.gets\n\t\t\tputs \"first line of the vineRecord file (should be the entire json string): #{string}\"\n\t\tend\n\n\t\t@record = JSON.parse(s)\n\tend",
"def read_data(file_name)\n file = File.open(file_name,\"r\")\n object = eval(file.gets.untaint.encode('UTF-8', :invalid => :replace, :replace => '').gsub('\\n', \"\"))\n file.close()\n return object\nend",
"def create_features_from_file\n pg_lyr = @pg_ds.get_layer(0)\n dst_feat = Gdal::Ogr::Feature.new( feature_def = pg_lyr.get_layer_defn() )\n \n\t\twkt_list = [ '10', '2', '1', '3d_1', '4', '5', '6' ]\n wkt = nil\n \n wkt_list.each do |item|\n file_name = File.join('..', '..','ogr','data','wkb_wkt',item + '.wkt')\n\t\t\tFile.open(file_name, 'rb') do |file|\n\t\t\t wkt = file.read\n\t\t\tend\n\t\t\n\t\t\tgeom = Gdal::Ogr.create_geometry_from_wkt( wkt )\n \n\t\t\t## Write geometry as a new Postgis feature.\n\t\t\tdst_feat.set_geometry_directly( geom )\n\t\t\tdst_feat.set_field( 'PRFEDEA', item )\n\t\t\tpg_lyr.create_feature( dst_feat )\n\t\tend\n\tend",
"def load_model(model_class)\n begin\n file_content = File.read(model_class.db_filename)\n json_data = JSON.parse(file_content)\n rescue Errno::ENOENT\n # The file does not exists\n json_data = []\n end\n json_data.each do |data_hash|\n new_object = model_class.from_hash(data_hash)\n new_object.save\n end\nend",
"def load_model(model_class)\n begin\n file_content = File.read(model_class.db_filename)\n json_data = JSON.parse(file_content)\n rescue Errno::ENOENT\n # The file does not exists\n json_data = []\n end\n json_data.each do |data_hash|\n new_object = model_class.from_hash(data_hash)\n new_object.save\n end\nend",
"def read_genotypes (filename, people)\n file = File.open(filename)\n\n header = file.readline.strip.split(/\\s+/)\n header.shift # omit the first field, \"Marker\"\n\n file.readlines.each do |line|\n marker = line[0..8].gsub(/\\s/, \"\")\n line = line[9..-1]\n header.each_with_index do |person, i|\n start = i*7\n people[person].gen[marker] = parse_genotype line[start..(start+6)]\n end\n end\nend",
"def fromFile( filename ) \n lines = IO.readlines( filename )\n loadAll( lines )\n end",
"def initialize file\n EasyTranslate.api_key = 'AIzaSyDrbD0AfKHiMZTYoite-ec4byLNlPxoX8k'\n @file = file\n @properties = []\n \n File.open(file, \"r:UTF-8\").each do |line| \n @properties << line \n end\n end",
"def initialize(object, file)\n @file = file\n\n @source = PuppetStrings::Yard::Util.ast_to_text(object)\n @line = object.line\n @comments_range = nil\n end",
"def create_from_file\n end",
"def c_sv_to_object(file, opts = {})\n c_sv_to_object_with_http_info(file, opts)\n return nil\n end",
"def code2file(_objects_file = nil)\n @filename = _objects_file\n if !@filename\n exit\n end\n\n File.open(_objects_file, \"w\") do |aFile|\n aFile.print @renderer.code\n end\n end",
"def generateObjectFromOrder_NV(pdfName)\n o={}\n o[:communityType] = 'NVHomes'\n o[:fileName] = pdfName\n o[:FaucetSpread] = 'faucet centered, soap 8\" to R' #Default faucet spread\n o[:changeOrders] = []\n currentChangeOrderDate = nil\n currentChangeOrderNumber = nil\n tmpChangeOrderObj = nil \n\n reader = PDF::Reader.new(pdfName)\n\n reader.pages.each{|x| #Iterate over each of the pages in the reader\n x.text.split(/\\n/).each{|y| #iterate over each line in the page\n\n if y[\"CHANGE ORDER\"] && y[\"Date:\"] #Does \"CHANGE ORDER\" occur in the string y\n if tmpChangeOrderObj.nil? == false && tmpChangeOrderObj.keys.count > 2\n o[:changeOrders] << tmpChangeOrderObj\n end\n\n currentChangeOrderDate = y.split(\"|\")[1] #we'll change this later for dates\n begin\n currentChangeOrderDate = Date.strptime(currentChangeOrderDate[currentChangeOrderDate.index(\"Date:\")+5...-1].strip,'%m/%d/%Y')\n rescue\n currentChangeOrderDate = \"FAILED TO PARSE DATE\"\n end\n\n currentChangeOrderNumber = y.split(\"|\")[0]\n tmpChangeOrderObj = {} \n tmpChangeOrderObj[:ChangeOrderNumber] = currentChangeOrderNumber\n tmpChangeOrderObj[:ChangeOrderDate] = currentChangeOrderDate\n end\n if currentChangeOrderDate.nil? then\n #if currentChangeOrderDate.nil? then\n #Parse the start date to determine sink\n\n begin\n \ty[\"Contract Date\"] \n o[:contractDate] = Date.strptime(y[y.index(\"Contract Date\")+13..-1].split*\"\", '%m/%d/%Y')\n rescue\n \tcontractDate = \"FAILED TO PARSE DATE\"\n end\n\n if y[\"Set/\"] && o[:houseTypeCode].nil?\n o[:houseTypeCode] = y[y.rindex(\"(\")+1..y.rindex(\"-\")-1]\n end\n if y[\"999QK00\"]\n #We’re definately in a color line\n o[:\"ColorCode\"] = y.split[8..-1]*\" \"\n if y[\"UPDATE\"]\n o[:\"UpdatedColor\"] = y.split[8..-1]*\" \"\n #We’re on a color line *AND* it’s an update\n else\n #We’re on a color line *AND* it’s *NOT* an update\n o[:\"ColorCode\"] = y.split[8..-1]*\" \"\n end\n end\n\n if y[\"APPLIANCE PKG FREESTANDING\"] #If the current line contains \"freestanding\"\n o[:CooktopCode] = \"freestanding\"\n end\n if y[\"4CB\"] #If the current line contains \"4CB\"\n o[:CooktopCode] = \"jgp323setss\"\n end\n if (y[\"4CF\"]||y[\"4CH\"]||y[\"4CQ\"]) #If the current line contains \"4CF,4CH,4CQ\"\n o[:CooktopCode] = \"pgp976setss\"\n end\n if y[\"4CD\"] #If the current line contains \"4CD\"\n o[:CooktopCode] = \"pgp943setss\"\n end\n if y[\"4CP\"] #If the current line contains \"4CP\"\n o[:CooktopCode] = \"zgu385nsmss\"\n end\n if y[\"4CG\"] #If the current line contains \"4CG\"\n o[:CooktopCode] = \"jgp633setss\"\n end\n\n #Parse the Faucet and Sink fixtures from the doc\n if y[\"KFK\"] then \n faucetAndSink = determineFaucetSpreadAndKitchenSink_NV(o[:contractDate], \"KFK\", o[:houseTypeCode])\n o[:FaucetSpread] = faucetAndSink[:FaucetSpread]\n o[:KitchenSink] = faucetAndSink[:KitchenSink]\n end\n if (y[\"KFL\"]|| y[\"KFM\"]) then\n faucetAndSink = determineFaucetSpreadAndKitchenSink_NV(o[:contractDate], \"KFL\", o[:houseTypeCode])\n o[:FaucetSpread] = faucetAndSink[:FaucetSpread]\n o[:KitchenSink] = faucetAndSink[:KitchenSink] \n end\n else\n #we're in change orders\n if y[\"999QK00\"] \n tmpChangeOrderObj[:ColorCode] = y.split[5..-3]*\" \"\n end\n\n if y[\"APPLIANCE PKG FREESTANDING\"] \n tmpChangeOrderObj[:CooktopCode] = \"freestanding\"\n end\n if (y[\"4CF\"]||y[\"4CH\"]||y[\"4CQ\"])\n tmpChangeOrderObj[:CooktopCode] = \"pgp976setss\"\n end\n if y[\"4CB\"]\n tmpChangeOrderObj[:CooktopCode] = \"jgp333setss\"\n end\n if y[\"4CD\"] #If the current line contains \"4CD\"\n tmpChangeOrderObj[:CooktopCode] = \"pgp943setss\"\n end\n if y[\"4CP\"] #If the current line contains \"4CP\"\n tmpChangeOrderObj[:CooktopCode] = \"zgu385nsmss\"\n end\n if y[\"4CG\"] #If the current line contains \"4CG\"\n tmpChangeOrderObj[:CooktopCode] = \"jgp633setss\"\n end\n if y[\"KFK\"]\n tmpChangeOrderObj[:KitchenSink] = \"11409\"\n end\n if (y[\"KFL\"]|| y[\"KFM\"])\n tmpChangeOrderObj[:KitchenSink] = \"k3821-4\"\n end\n \n if y[\"KFK\"] then \n faucetAndSink = determineFaucetSpreadAndKitchenSink_NV(o[:contractDate], \"KFK\", o[:houseTypeCode])\n tmpChangeOrderObj[:KitchenSink] = faucetAndSink[:KitchenSink]\n end\n if (y[\"KFL\"]|| y[\"KFM\"]) then\n faucetAndSink = determineFaucetSpreadAndKitchenSink_NV(o[:contractDate], \"KFL\", o[:houseTypeCode])\n tmpChangeOrderObj[:KitchenSink] = faucetAndSink[:KitchenSink] \n end\n end \n \n }\n }\n return o\nend",
"def readObjects(section)\n \n puts \"Using objects dir: #{@object_dir}\" if @debug\n section_dir=@object_dir+\"/\"+section\n @objects=Hash.new\n # Read specific config\n if File.directory?section_dir\n puts \"Found section: \"+section_dir if @debug\n # Read all Ruby files on section\n Dir.glob(section_dir+\"/*.rb\") do |file|\n obj=eval(File.read(file)) unless File.basename(file) == \"Local.rb\"\n @objects.merge!(obj) if obj\n end\n # Read all YAML files on section, except Local.obj\n Dir.glob(section_dir+\"/*.obj\") do |file|\n obj=YAML.load(File.open(file)) unless File.basename(file) == \"Local.obj\"\n @objects.merge!(obj) if obj\n end\n end\n # Read local Ruby files\n if File.exists?section_dir+\"/Local.rb\"\n obj=eval(File.read(section_dir+\"/Local.rb\"))\n @objects.merge!(obj) if obj\n end\n # Read local YAML file\n if File.exists?section_dir+\"/Local.obj\"\n obj=YAML.load(File.open(section_dir+\"/Local.obj\"))\n @objects.merge!(obj) if obj\n end\n puts \"Objects:\" if @debug\n puts YAML.dump(@objects) if @debug\n @objects\n end",
"def create_fedora_objects(model, attributes)\n ::Importer::Factory.for(model.to_s).new(attributes, @files_directory, files(attributes)).run\n end",
"def readAMF3Object\n handle = readAMF3Int\n inline = ( handle & 1 ) != 0\n handle = handle >> 1\n\n if ! inline\n return @storedObjects[ handle ]\n end\n\n inlineClassDef = ( handle &1 ) != 0\n handle = handle >> 1\n if inlineClassDef\n typeId = readAMF3String\n externalizable = ( handle &1 ) != 0\n handle = handle >> 1\n dynamic = ( handle &1 ) !=0\n handle = handle >> 1\n classMemberCount = handle\n\n classMemberDefinitions = Array.new\n classMemberCount.times do\n classMemberDefinitions << readAMF3String\n end\n\n classDefinition = {\n 'type' => typeId,\n 'externalizable' => externalizable,\n 'dynamic' => dynamic,\n 'members' => classMemberDefinitions\n }\n @storedDefinitions << classDefinition\n else\n classDefinition = @storedDefinitions[ handle ]\n end\n\n obj = OpenStruct.new\n @storedObjects << obj\n\n if classDefinition[ 'externalizable' ]\n obj.send( \"#{ AMF_FIELD_EXTERNALIZED_DATA }=\", readAMF3Data )\n else\n classDefinition[ 'members' ].each do |member|\n obj.send( \"#{ member }=\", readAMF3Data )\n end\n\n if classDefinition[ 'dynamic' ]\n key = readAMF3String\n while key != ''\n obj.send( \"#{ key }=\", readAMF3Data )\n key = readAMF3String\n end\n end\n end\n\n if classDefinition[ 'type' ] != ''\n obj.send( \"#{ AMF_FIELD_EXPLICIT_TYPE }=\", classDefinition[ 'type' ] )\n end\n\n obj\n end",
"def load(fn) # :nodoc:\n lines = File.read fn\n lines.gsub!(/\\\\ /, SPACE_MARK)\n lines.gsub!(/#[^\\n]*\\n/m, \"\")\n lines.gsub!(/\\\\\\n/, \" \")\n lines.each_line do |line|\n process_line(line)\n end\n end",
"def to_obj\n v = vertices.map {|v| \"v #{v.join ' '}\"}\n f = faces.map {|f| \"f #{f.join ' '}\"}\n (v + f).join \"\\n\"\n end",
"def parse\r\n raise \"directory #{@config[:model_dir]} not exists\" unless File.directory? @config[:model_dir]\r\n Dir[\"#{@config[:model_dir]}/*.rb\"].each do |file|\r\n crt_model = Model.new\r\n model_attrs_ = Hash.new\r\n in_public = true\r\n File.open(file, 'r:utf-8').each do |line|\r\n line.chomp!\r\n\r\n # erd_tag and attr\r\n if /^[\\#\\s]*erd_tag\\:?\\s*(?<tag_>[\\w\\.]+)/ =~ line\r\n crt_model.tag = tag_ \r\n crt_model.attrs = @config[:tags][tag_]\r\n end\r\n\r\n # catch class definition\r\n if /^\\s*class\\s+(?<name_>\\w+)/ =~ line\r\n crt_model.name = name_.underscore \r\n self.parse_erd crt_model, line\r\n if /^\\s*class\\s+\\w+\\s+\\<\\s+(?<parent_>\\w+)/ =~ line\r\n crt_model.parent = parent_.underscore if parent_\r\n end\r\n end\r\n \r\n # catch functions\r\n in_public = true if /public\\:/ =~ line\r\n in_public = false if /private\\:/ =~ line\r\n\r\n if /^\\s*def\\s+(?<func_>[^#]+)\\s*/ =~ line\r\n field_ = Fields.new\r\n field_.name, field_.type = func_, 'function'\r\n self.parse_erd field_, line # parse erd attr and label\r\n # arbitrage link\r\n if /\\-\\>\\s*(?<name_>\\w+)(\\{(?<attrs_>.+)\\})?/ =~ line\r\n attrs = {}\r\n attrs = YAML.load(attrs_) if attrs_\r\n field_.edge = [name_, '', attrs]\r\n end\r\n crt_model.fields << field_ \r\n end\r\n\r\n # catch field\r\n if /^\\s*field\\s+\\:(?<name_>\\w+)\\s*\\,.*\\:?type\\:?\\s*(?<type_>[A-Za-z_0-9\\:]+)/ =~ line\r\n field_ = Fields.new\r\n field_.name, field_.type = name_, type_\r\n self.parse_erd field_, line # parse erd attr and label\r\n # arbitrage link\r\n if /\\-\\>\\s*(?<name_>\\w+)(\\{(?<attrs_>.+)\\})?/ =~ line\r\n attrs = {}\r\n attrs = YAML.load(attrs_) if attrs_\r\n field_.edge = [name_, '', attrs]\r\n end\r\n crt_model.fields << field_ \r\n end\r\n\r\n # catch relations\r\n if /^\\s*(?<rel_>embeds_many|embeds_one|has_many|has_one|belongs_to|embedded_in)\\s+\\:(?<name_>\\w+)\\s*(\\,.*\\:?as\\:?\\s*(?<as_>\\w+))?/ =~ line\r\n field_ = Fields.new\r\n field_.name, field_.type = rel_, name_\r\n field_.name = \"#{rel_} (as #{as_})\" if as_\r\n self.parse_erd field_, line # parse erd attr and label\r\n crt_model.fields << field_ \r\n #if %w[belongs_to embedded_in embeds_one has_one].include? rel_\r\n field_.edge = [name_, '', {label: rel_, arrowhead: 'normal'}]\r\n #end\r\n end\r\n \r\n # common extension field\r\n if /^\\s*symbolize\\s+\\:(?<name>\\w+)\\s*\\,.*\\:?in\\:?.*(?<in_>\\[.+\\])/ =~ line\r\n field_ = Fields.new\r\n field_.name, field_.type = name_, \"symbolized in #{in_}\"\r\n self.parse_erd field_, line # parse erd attr and label\r\n crt_model.fields << field_ \r\n end\r\n\r\n if /^\\s*state_machine\\s+\\:(?<state_>\\w+)/ =~ line\r\n field_ = Fields.new\r\n field_.name = state_ == \"initial\" ? \"state\" : state_\r\n field_.type = \"state_machine\"\r\n self.parse_erd field_, line # parse erd attr and label\r\n crt_model.fields << field_ \r\n end\r\n\r\n if /\\s*as_enum\\s+\\:(?<name_>\\w+)\\s*\\,\\s*(?<enum_>[^#]+)/ =~ line\r\n field_ = Fields.new\r\n field_.name = name_\r\n field_.type = \"[ENUM] \" + enum_ \r\n self.parse_erd field_, line # parse erd attr and label\r\n crt_model.fields << field_ \r\n end\r\n\r\n end # open and parse one file\r\n\r\n # assign attributes at the last moment\r\n crt_model.attrs.merge! model_attrs_\r\n\r\n # if config.include/tag, default to exclude_it = true\r\n if @config[:include].size > 0 or @config[:tag].size > 0\r\n include_it = false\r\n else\r\n include_it = true\r\n end\r\n\r\n # if in the include list, include it\r\n include_it = true if @config[:include] and @config[:include].include? crt_model.name\r\n @config[:tag].each do |t|\r\n include_it = true if t == crt_model.tag or /^#{t}(\\..+)?/.match(crt_model.tag)\r\n end\r\n\r\n include_it = false if @config[:exclude].include? crt_model.name\r\n @models[crt_model.name] = crt_model if include_it\r\n end # open directory\r\n self\r\n end",
"def readModelAndInit(config, modelFile, printLoading) # MaxentTagger.java:840\n File.open(modelFile, \"r\") do |file|\n rf = DataInputStream.new(file)\n # t = Timing.new\n source = nil\n\n if printLoading\n if config != nil\n source = config.getProperty(\"model\")\n end\n if source == nil\n source = \"data stream\"\n end\n end\n\n taggerConfig = TaggerConfig.readConfig(rf)\n\n if config != nil\n taggerConfig.setProperties(config)\n end\n\n # then init tagger\n init(taggerConfig)\n\n xSize = rf.readInt\n ySize = rf.readInt\n # dict = new Dictionary(); # this method is called in constructor, and it's initialized as empty already\n dict.read(rf)\n\n puts \"Tagger dictionary read.\" if @verbose\n\n tags.read(rf)\n readExtractors(rf)\n dict.setAmbClasses(ambClasses, veryCommonWordThresh, tags)\n\n # int[] numFA = new int[extractors.size() + extractorsRare.size()]\n numFA = [0] * (extractors.length + extractorsRare.length)\n sizeAssoc = rf.readInt\n @fAssociations = [] # Generics.newArrayList()\n (extractors.length + extractorsRare.length).times do\n fAssociations.push Hash.new\n end\n # for (int i = 0; i < extractors.size() + extractorsRare.size(); ++i) {\n # fAssociations.add(Generics.<String, int[]>newHashMap());\n # }\n\n puts \"Reading #{sizeAssoc} feature keys...\" if @verbose\n\n # PrintFile pfVP = null;\n # if (@verbose) {\n # pfVP = new PrintFile(\"pairs.txt\");\n # }\n # for (int i = 0; i < sizeAssoc; i++) {\n sizeAssoc.times do |i|\n numF = rf.readInt\n fK = FeatureKey.new\n fK.read(rf)\n numFA[fK.num] += 1\n\n # TODO: rewrite the writing / reading code to store\n # fAssociations in a cleaner manner? Only do this when\n # rebuilding all the tagger models anyway. When we do that, we\n # can get rid of FeatureKey\n fValueAssociations = fAssociations.get(fK.num) # Map<String, int[]>\n fTagAssociations = fValueAssociations.get(fK.val) # int[]\n if fTagAssociations == nil\n fTagAssociations = [] # new int[ySize];\n ySize.times do |j| # for (int j = 0; j < ySize; ++j) {\n fTagAssociations[j] = -1\n end\n fValueAssociations.put(fK.val, fTagAssociations)\n end\n fTagAssociations[tags.getIndex(fK.tag)] = numF\n end\n\n # if (@verbose) {\n # IOUtils.closeIgnoringExceptions(pfVP);\n # }\n\n if @verbose\n numFA.times do |k| # for (int k = 0; k < numFA.length; k++) {\n puts \"Number of features of kind #{k} #{numFA[k]}\"\n end\n end\n\n @prob = LambdaSolveTagger.new(rf)\n\n if @verbose\n puts \"prob read \"\n end\n\n if printLoading\n # t.done(log, \"Reading POS tagger model from \" + source)\n puts \"Reading POS tagger model from #{source}\"\n end\n end\n end",
"def readShapesFromFile(filename)\n\nss = Shapeset.new\ninputFile = File.new(filename, \"r\")\n\nfor line in inputFile\n if line.split(/, */)[0].strip == 'circle'\n ss.addShape(Circle.new(line.split(/, */)[1].strip))\n elsif line.split(/, */)[0].strip == 'square'\n ss.addShape(Square.new(line.split(/, */)[1].strip))\n else\n ss.addShape(Triangle.new(line.split(/, */)[1].strip,line.split(/, */)[2].strip))\n end \nend\n\nreturn ss\n\nend",
"def parse_points\n points = Array.new\n begin\n file = File.open(\"../data/data_points.txt\", \"r\") do |f|\n f.each do |line|\n arr = line.split(\",\")\n points.push(ChunkyPNG::Point.new(arr[0], arr[1]))\n end\n f.close\n File.delete(f)\n end\n rescue \n return nil\n end\n return points\n end",
"def read_file(filename, graph)\n File.foreach(filename) do |x|\n id, data, neighbors = vertex_creation(x)\n graph.add_vertex(id, data, neighbors)\n end\n graph\nend",
"def load_model file\n self.clear_model\n\n xml_file = File.new file\n doc = Document.new xml_file\n\n doc.elements.each(\"model/entities/entity\") do |element|\n\n id = element.elements[1].text.to_i\n name = element.elements[2].text\n type = element.elements[3].text\n definition = element.elements[4].text\n x = element.elements[5].text.to_i\n y = element.elements[6].text.to_i\n\n if id.to_i > @max_id\n @max_id = id.to_i\n end\n\n ent = self.add_entity name, type, definition, x, y\n ent.id = id\n end\n\n doc.elements.each(\"model/connections/connection\") do |element|\n name = element.elements[1].text\n definition = element.elements[2].text\n source_entity_id = element.elements[3].text.to_i\n target_entity_id = element.elements[4].text.to_i\n source_point_type = element.elements[5].text\n target_point_type = element.elements[6].text\n source_point_x = element.elements[7].text.to_i\n source_point_y = element.elements[8].text.to_i\n target_point_x = element.elements[9].text.to_i\n target_point_y = element.elements[10].text.to_i\n label_x = element.elements[11].text.to_i\n label_y = element.elements[12].text.to_i\n\n source_entity = self.get_entity source_entity_id\n target_entity = self.get_entity target_entity_id\n source_point = Point2D::Double.new source_point_x, source_point_y\n target_point = Point2D::Double.new target_point_x, target_point_y\n\n con = self.add_connection_specific_endpoints source_entity,\n target_entity,\n source_point,\n target_point,\n source_point_type,\n target_point_type,\n name,\n definition\n\n con.label.set_location label_x, label_y\n end\n @panel.repaint\n end",
"def initialize(filename)\n file = File.open(filename, \"r\")\n self.data = file.read\n file.close\n\n # inicializacia atributov\n self.skip_spaces = true\n self.errors = []\n self.line = [0]\n self.length = data.length\n self.position = self.last_position = 0\n\n # zoznam terminalov a operatorov\n self.terminals = [\n 'BEGIN',\n 'END',\n ':=',\n ';',\n '(',\n ')',\n 'WRITE',\n 'READ',\n 'IF',\n 'THEN',\n 'ELSE',\n 'IDENT',\n '+',\n '-',\n 'NOT',\n 'AND',\n 'OR',\n 'TRUE',\n 'FALSE',\n ','\n ]\n\n end",
"def load_objects(dir_name, kind, klass)\n files(dir_name).map do |filename|\n # Read and parse data\n meta, content = *parse_file(filename, kind)\n\n # Get attributes\n attributes = {\n :filename => filename,\n :extension => File.extname(filename)[1..-1],\n :file => Nanoc3::Extra::FileProxy.new(filename)\n }.merge(meta)\n\n # Get actual identifier\n identifier = filename_to_identifier(filename, dir_name)\n\n # Get mtime\n mtime = File.stat(filename).mtime\n\n # Build item\n klass.new(content, attributes, identifier, mtime)\n end\n end",
"def initialize(filename, start_date, duration=Float::MAX, offset=0.0)\n data = RubyUtils::FileReader.new(filename, \" \").data\n # create meta data from first entry\n meta_data = MetaData.new(data[0], start_date)\n data.delete_at(0)\n @data_repository = RubyUtils::DataRepository.new(meta_data)\n fill_repository(data, duration, offset, start_date)\n end",
"def ingest_object(row)\n\n @touch = File.join(\"/tmp\", row[\"exportedAs\"])\n \n unless File.exists?(@touch)\n obj = File.join(@directory, File.basename(row[\"exportedAs\"].gsub('\\\\', '/')))\n sourceFile = File.join(obj,File.basename(row[\"exportedAs\"].gsub('\\\\', '/')))\n \n if File.exists?(obj)\n # Gets a new PID\n pid = Nokogiri::XML(open(@fedora_uri + \"/management/getNextPID?xml=true&namespace=#{@fedora_ns}\", {:http_basic_authentication=>[@fedora_user, @fedora_pass]})).xpath(\"//pid\").text\n \n #testing stuff\n #pid = \"druid:1\"\n \n fedora_obj = AimsDocument.new(:pid => pid)\n fedora_obj.label = File.basename(obj)\n fedora_obj.save\n print obj + \" ===> \"\n # now glob the object directory and makes datastreams for each of the files and add them as datastream to the fedora object.\n # fedora_obj.save\n \n dsid = 'rightsMetadata'\n xml_content = fedora_obj.datastreams_in_memory[dsid].content\n ds = Hydra::RightsMetadata.from_xml(xml_content)\n pid = fedora_obj.pid\n ds.pid = pid\n ds.dsid = dsid\n fedora_obj.datastreams_in_memory[dsid] = ds\n permissions = {\"group\"=>{\"public\"=>\"read\", \"archivist\" => \"edit\", \"researcher\" => \"read\", \"patron\" => 'read', \"donor\" => 'edit' }, \"person\" => {\"archivist1\" => \"edit\"}}\n ds.update_permissions(permissions)\n permissions = {\"group\" => {\"public\"=>\"read\"}}\n ds.update_permissions(permissions)\n \n fedora_obj.save\n \n Dir[\"#{obj}/**/**\"].each do |f|\n \n #damn OS X spotlight. \n unless f.include?('DS_Store')\n \n # text files and jp2000s get added as datastreams in the object. the wordperfect files get added as their own objects\n if f =~ /(.*)\\.(txt)/\n fedora_obj.add_datastream(create_file_ds(f, File.basename(f), File.basename(f)))\n \n elsif f =~ /(.*)\\.(pdf)/\n fedora_obj.add_datastream(create_file_ds(f, 'pdf', \"#{File.basename(f)}.pdf\"))\n elsif f =~ /(.*)\\.(jp2)/\n # Below is if you want to not have the jp2 imported into fedora. it will just move them to a directory.\n #jp2_dir = File.join('/tmp', fedora_obj.pid.gsub(\"druid:\", \"druid_\"))\n #FileUtils.mkdir_p(jp2_dir) unless File.directory?(jp2_dir)\n #FileUtils.cp(f, jp2_dir, :verbose => true)\n # Below this adds the jp2000s into fedora.\n fedora_obj.add_datastream(create_file_ds(f, File.basename(f), File.basename(f)))\n\t\t elsif f == sourceFile #source file gets its own fedora object. \n cpid = Nokogiri::XML(open(@fedora_uri + \"/management/getNextPID?xml=true&namespace=#{@fedora_ns}\", {:http_basic_authentication=>[@fedora_user, @fedora_pass]})).xpath(\"//pid\").text\n \n child_obj = FileAsset.new(:pid => cpid)\n child_obj.label = File.basename(f)\n dc = child_obj.datastreams['descMetadata']\n dc.extent_values << File.size(f)\n \n \n fedora_obj.add_relationship(:has_part, child_obj )\n fedora_obj.add_relationship(:has_collection_member, child_obj)\n puts \"processing:#{f} for objectID #{cpid}\"\n ext = File.extname(f)\n id = \"DS1\"\n label = File.basename(f)\n child_obj.add_datastream(create_file_ds(f, id, label ))\n child_obj.save\n print f + \"\\n\"\n else\n puts \"not a file to ingest ==> #{f}\"\n end #if\n end #unless\n end #dir\n \n dm = fedora_obj.datastreams[\"descMetadata\"]\n prop = fedora_obj.datastreams[\"properties\"]\n \n labels = row[\"labels\"].split(',')\n \n loutput = {\"subjects\" => [], \"access\" => []}\n doc_values = { \"D\" => \"Document\", \"S\" => \"Spreadsheet\", \"E\" => \"Email\", \"IM\" => \"Image\", \"V\" => \"Video\", \"SO\" => \"Sound\"} \n comp_values = {\"CM:5.25\" => \"5.25 inch. floppy diskettes\", \"CM:3.5\" => \"3.5 inch. floppy diskettes\", \"CM:P\" => \"Punch cards\", \"CM:T\" => \"Tape\" }\n access_values = {\"O\" => \"owner\", \"A\" => \"Archivists\", \"I\" => \"Invited\", \"P\" =>\"Public\", \"M\"=>\"Reading\"}\n \n \n labels.each do |l|\n if doc_values.has_key?(l)\n loutput[\"doctype\"] = doc_values[l]\n elsif comp_values.has_key?(l)\n loutput[\"mediatype\"] = comp_values[l]\n elsif access_values.has_key?(l)\n loutput[\"access\"] << access_values[l]\n elsif l.include?(\"S:\")\n loutput[\"subjects\"] << l.gsub(\"S:\", '') \n end #if\n end #do\n \n pp(loutput)\n prop.collection_values << \"Steven J. Gould\"\n prop.pages_values << number_of_pages(fedora_obj)\n prop.path_values << row['path']\n prop.file_size_values << row['size']\n prop.md5_values << row['md5']\n prop.sha1_values << row['sha1']\n prop.file_type_values << row['type']\n prop.filename_values << File.basename(obj)\n \n dm.isPartOf_values = row[\"subseries\"].gsub(/[0-9]|Bookmark:|\\./,\"\").strip\n dm.source_values << row['filename']\n dm.type_values << loutput['doctype']\n dm.format_values << loutput[\"mediatype\"]\n \n \n \n loutput['subjects'].each { |s| dm.subject_values << s.gsub(\"S:\", \"\") }\n \n dm.save\n prop.save\n fedora_obj.save\n\n solr_doc = fedora_obj.to_solr\n solr_doc << Solr::Field.new( :discover_access_group_t => \"public\" )\n ActiveFedora::SolrService.instance.conn.update(solr_doc)\n FileUtils.mkdir_p(@touch)\n end #unless\n end #if exists? \n rescue Exception => e \n puts e.backtrace\n\tputs \"erroring....\"\n sleep(300)\n return nil\n rescue Timeout::Error => e\n puts \"timeout error ....\" \n sleep(350)\n\n \n end",
"def initialize(fileobj, offset=nil)\n size = begin \n File.size fileobj.path\n rescue ERRNO::ENOENT, IOError\n fileobj.seek(0, IO::SEEK_END)\n fileobj.tell\n end\n\n # If we don't get an offset, try to skip an ID3v2 tag.\n if offset.nil?\n fileobj.rewind\n idata = fileobj.read 10\n if (val = idata.unpack('a3xxxa4')).include? nil\n id3, insize = '', 0\n else\n id3, insize = val\n end\n\n insize = Mutagen::ID3::BitPaddedInteger.new insize\n\n if id3 == 'ID3' and insize > 0\n offset = insize + 10\n else\n offset = 0\n end\n end\n\n # Try to find two valid headers (meaning, very likely, MPEG data)\n # at the given offset, 30% through the file, 60% through the file,\n # and 90% through the file.\n flag = false\n [offset, 0.3*size, 0.6*size, 0.9*size].each do |i|\n begin \n try(fileobj, Integer(i), size - offset)\n rescue Mutagen::MP3::ERROR\n pass\n else \n flag = true\n break\n end\n end\n # If we can't find any two consecutive frames, try to find just\n # one frame back at the original offset given.\n unless flag\n try(fileobj, offset, size - offset, false)\n @sketchy = true\n end\n end",
"def parse filename\n doc = Document.new(File.new(filename))\n elements = doc.elements\n # Let each entity definition do it's own lower level parsing\n self.entities.each do |e|\n @instances[e.name] = e.parse(self, elements)\n end\n # Let each relationship definition do it's own lower level parsing\n self.relationships.each do |r|\n r.parse(self, @instances)\n end\n end",
"def parse\n # TODO: Try to convert lsynth parts, maybe flag parts that are troublesome for manual editing,\n # look up to see if I've stored a conversion from ldraw ID to Bricklink ID,\n # convert Ldraw color IDs to BL color IDs, etc.\n parts = {}\n temp_parts = []\n\n @lines.each_with_index do |line, i|\n # This will stop getting parts for the base model once a submodel is reached\n break if line.match(/0 FILE/) && i > 15\n\n @submodels << line.match(/\\w+\\.ldr/).to_s.downcase if line.match(/^1/) && line.match(/\\.ldr$/)\n @lsynthed_parts << line.gsub('0 SYNTH BEGIN', '').split if line =~ /^0 SYNTH BEGIN/\n next unless line.match(/^1/) && line.match(/.dat$/)\n\n part = line.match(/\\w+\\.dat/).to_s.gsub!('.dat', '')\n next if lsynth_part?(part)\n\n color = line.match(/^1\\s\\d+/).to_s.gsub!('1 ', '')\n bl_part = get_bl_part_number(part)\n temp_parts << [bl_part, color, part]\n end\n\n # Now go through all submodels to determine the parts belonging to the submodels\n temp_parts = handle_submodels(temp_parts)\n\n # Not yet functional\n # handle_lsynthed_parts(temp_parts)\n\n temp_parts.each do |info|\n if parts.key?(\"#{info[0]}_#{info[1]}\")\n parts[\"#{info[0]}_#{info[1]}\"]['quantity'] += 1\n else\n parts[\"#{info[0]}_#{info[1]}\"] = {}\n parts[\"#{info[0]}_#{info[1]}\"]['quantity'] = 1\n parts[\"#{info[0]}_#{info[1]}\"]['ldraw_part_num'] = info[2]\n end\n end\n\n parts\n end",
"def readData(filename)\n\t\t@dataArray = Array.new\n\t\tfile = File.open(filename)\n\t\t\n\t\tfile.each_line do |line|\n\t\t\tarray = line.split(/,/)\n\t\t\tentry = Struct::ContactEntry.new(array[0], array[1], array[2])\n\t\t\t@dataArray.push(entry)\n\t\tend\n\t\n\t\tfile.close\n\t\t\n\tend",
"def read_binary_object(fname,fd)\n # first: read the marker byte\n buff = fd.read(1)\n\n object_length = buff.unpack(\"C*\")\n object_length = object_length[0] & 0xF\n\n buff = buff.unpack(\"H*\")\n object_type = buff[0][0].chr\n\n if(object_type != \"0\" && object_length == 15) then\n object_length = read_binary_object(fname,fd)\n object_length = object_length.value\n end\n\n retval = nil\n case object_type\n when '0' then # null, false, true, fillbyte\n retval = read_binary_null_type(object_length)\n when '1' then # integer\n retval = read_binary_int(fname,fd,object_length)\n when '2' then # real\n retval = read_binary_real(fname,fd,object_length)\n when '3' then # date\n retval = read_binary_date(fname,fd,object_length)\n when '4' then # data\n retval = read_binary_data(fname,fd,object_length)\n when '5' then # byte string, usually utf8 encoded\n retval = read_binary_string(fname,fd,object_length)\n when '6' then # unicode string (utf16be)\n retval = read_binary_unicode_string(fname,fd,object_length)\n when 'a' then # array\n retval = read_binary_array(fname,fd,object_length)\n when 'd' then # dictionary\n retval = read_binary_dict(fname,fd,object_length)\n end\n\n return retval\n end",
"def marshal_load(obj)\r\n @depth, @map_id, @event_id, @list, @index, @branch = obj\r\n create_fiber\r\n end",
"def initialize(filename, read_properties=true)\n end",
"def initialize(filename, read_properties=true)\n end",
"def load(fn)\n return if ! File.exists?(fn)\n lines = File.read fn\n lines.gsub!(/\\\\ /, SPACE_MARK)\n lines.gsub!(/#[^\\n]*\\n/m, \"\")\n lines.gsub!(/\\\\\\n/, ' ')\n lines.each_line do |line|\n process_line(line)\n end\n end",
"def initialize file\n EasyTranslate.api_key = 'AIzaSyDrbD0AfKHiMZTYoite-ec4byLNlPxoX8k'\n @file = file\n @properties = {}\n \n File.open(file, \"r:UTF-8\").each do |line| \n if line.include? \":\"\n splited_line = line.encode!('UTF-8').strip.split(':')\n @properties[splited_line[0]] = splited_line[1] \n end \n end\n end",
"def convert_csv_file_to_object\n begin\n CSV.foreach(@file_name) do |row|\n @csv_object.push(row)\n end \n rescue => exception\n raise FileReadError, exception\n end\n end",
"def read_instance(filename)\n File.open(filename) do | f |\n read_ukp_instance(f)\n end\nend",
"def create_people_raw\n @@people_raw = CsvMapper.import('test_ward.csv') do\n read_attributes_from_file\n end\nend",
"def initialize(filename)\n @data_source\n @metros = Hash.new\n if !File.file?(filename)\n puts \"Files does not exit. check your path\"\n exit\n end\n file = File.read(filename)\n dataset = JSON.parse(file)\n initialize_data_source(dataset['data sources'])\n initialize_metros(dataset['metros'])\n if (dataset.has_key?('single_route'))\n initialize_routes(dataset['routes'], 1)\n else\n initialize_routes(dataset['routes'], 0)\n end\n end",
"def load file='GOL.sav'\n self.state=File.open(file,'r') do |f|\n Marshal.load(f)\n end\n end",
"def initialize(file)\n @name = PropertyName.new.read(file).name.val[0...-1]\n if @name != 'None'\n @data = strip_data(PropertyData.new.read(file), file)\n else\n @data = 'None'\n end\n end",
"def parse\n self.data = BdlFile.strip_comments self.data\n save!\n tokenize\n Instruction.create_references!\n end",
"def readDataSingleSource(nameout)\n\t\t\tif nameout.include?(\".source\") == false\n\t\t\t\tnameout = nameout + \".source\"\n\t\t\tend\n\t\t\tdatautils = DataUtils.new\n\t\t\t#puts \"nameout: \" + nameout;\n\t\t\t@l = -1;\n\t\t\t@b = -1;\n\t\t\t@r = -1;\n\t\t\t@ell_a = -1;\n\t\t\t@ell_b = -1;\n\t\t\t@ell_phi = -1;\n\t\t\t\n\t\t\t@sicalc = 0\n\t\t\t@sicalc_error = 0\n\n\t\t\t#read upper limit\n\t\t\tindex2 = 0;\n\t\t\t@r = -1;\n\t\t\t@galcoeff = \"-1\"\n\t\t\t@galcoeff_err = \"-1\"\n\t\t\t@galcoeffzero = \"-1\"\n\t\t\t@galcoeffzero_err = \"-1\"\t\n\t\t\t@isocoeff = \"-1\"\n\t\t\t@isocoeff_err = \"-1\"\n\t\t\t@isocoeffzero = \"-1\"\n\t\t\t@isocoeffzero_err = \"-1\"\t\n\t\t\t@fitdata = \"-1, -1, -1, -1, -1, -1, -1\"\n\t\t\tFile.open(nameout).each_line do | line |\n\t\t\t\tindex2 = index2 + 1;\n\t\t\t\tlll = line.split(\" \")\n\t\t\t\tif index2.to_i == 15\n\t\t\t\t\t@label =lll[0];\n\t\t\t\t\t@fix =lll[1];\n\t\t\t\t\t@si_start = lll[2];\n\t\t\t\t\t@ulconflevel = lll[3];\n\t\t\t\t\t@srcconflevel = lll[4];\n\t\t\t\t\t@startL = lll[5];\n\t\t\t\t\t@startB = lll[6];\n\t\t\t\t\t@startFlux = lll[7];\n\t\t\t\t\t@lmin = lll[9];\n\t\t\t\t\t@lmax = lll[11];\n\t\t\t\t\t@bmin = lll[14];\n\t\t\t\t\t@bmax = lll[16];\n\t\t\t\tend\n\t\t\t\tif index2.to_i == 16\n\t\t\t\t\t@sqrtTS =lll[0];\n\t\t\t\tend\n\t\t\t\tif index2.to_i == 17\n\t\t\t\t\t@l_peak = lll[0];\n\t\t\t\t\t@b_peak = lll[1];\n\t\t\t\t\t@dist = lll[2];\n\t\t\t\tend\n\t\t\t\tif index2.to_i == 18\n\t\t\t\t\t@l = lll[0]\n\t\t\t\t\t@b = lll[1]\n\t\t\t\t\t@distellipse = lll[2];\n\t\t\t\t\t@r = lll[3];\n\t\t\t\t\t@ell_a = lll[4];\n\t\t\t\t\t@ell_b = lll[5];\n\t\t\t\t\t@ell_phi = lll[6];\n\t\t\t\t\t@fullellipseline = format(\"%.2f %.2f %.2f %.2f %.2f %.2f %.2f\", @l, @b, @distellipse, @r, @ell_a, @ell_b, @ell_phi)\n\t\t\t\tend\n\t\t\t\tif index2.to_i == 19\n\t\t\t\t\t@counts = lll[0]\n\t\t\t\t\t@counts_error = lll[1]\n\t\t\t\t\t@counts_error_p = lll[2]\n\t\t\t\t\t@counts_error_m = lll[3]\n\t\t\t\t\t@counts_ul = lll[4];\n\t\t\t\tend\n\t\t\t\tif index2.to_i == 20\n\t\t\t\t\t@flux = lll[0]\n\t\t\t\t\t@flux_error = lll[1]\n\t\t\t\t\t@flux_error_p = lll[2]\n\t\t\t\t\t@flux_error_m = lll[3]\n\t\t\t\t\t@flux_ul = lll[4];\n\t\t\t\t\t@exposure = lll[5]\n\t\t\t\tend\n\t\t\t\tif index2.to_i == 21\n\t\t\t\t\t@sicalc = lll[0]\n\t\t\t\t\t@sicalc_error = lll[1]\n\t\t\t\tend\n\t\t\t\t\n\t\t\t\tif index2.to_i == 22\n\t\t\t\t\t@fit_cts = lll[0]\n\t\t\t\t\t@fit_fcn0 = lll[1]\n\t\t\t\t\t@fit_fcn1 = lll[2]\n\t\t\t\t\t@fit_edm0 = lll[3]\n\t\t\t\t\t@fit_edm1 = lll[4]\n\t\t\t\t\t@fit_iter0 = lll[5]\n\t\t\t\t\t@fit_iter1 = lll[6]\n\t\t\t\tend\n\t\t\t\t\n\t\t\t\tif index2.to_i == 23\n\t\t\t\t\t@galcoeff = lll[0]\n\t\t\t\t\t@galcoeff_err = lll[1]\n\t\t\t\tend\n\t\t\t\t\n\t\t\t\tif index2.to_i == 24\n\t\t\t\t\t@galcoeffzero = lll[0]\n\t\t\t\t\t@galcoeffzero_err = lll[1]\n\t\t\t\tend\n\t\t\t\t\n\t\t\t\tif index2.to_i == 25\n\t\t\t\t\t@isocoeff = lll[0]\n\t\t\t\t\t@isocoeff_err = lll[1]\n\t\t\t\tend\n\t\t\t\t\n\t\t\t\tif index2.to_i == 26\n\t\t\t\t\t@isocoeffzero = lll[0]\n\t\t\t\t\t@isocoeffzero_err = lll[1]\n\t\t\t\tend\n\t\t\t\t\n\t\t\t\tif index2.to_i == 27\n\t\t\t\t\t@tstart = lll[0]\n\t\t\t\t\t@tstop = lll[1]\n\t\t\t\t\t\n\t\t\t\t\t@timestart_utc = @tstart\n\t\t\t\t\t@timestop_utc = @tstop\n\t\t\t\t\t@timestart_tt = datautils.time_utc_to_tt(@tstart);\n\t\t\t\t\t@timestop_tt = datautils.time_utc_to_tt(@tstop);\n\t\t\t\t\t@timestart_mjd = datautils.time_tt_to_mjd(@timestart_tt);\n\t\t\t\t\t@timestop_mjd = datautils.time_tt_to_mjd(@timestop_tt);\n\t\t\t\t\t\n\t\t\t\t\t#calcolo fase orbitale\n\t\t\t\t\t@orbitalphase = -1;\n\t\t\t\t\tif(@calcorbitalphase_period.to_f != 0)\n\t\t\t\t\t\ttimemjd = @timestart_mjd.to_f + (@timestop_mjd.to_f-@timestart_mjd.to_f)\n\t\t\t\t\t\t@orbitalphase = (timemjd.to_f - @calcorbitalphase_t0.to_f) / @calcorbitalphase_period.to_f;\n\t\t\t\t\t\t@orbitalphase = @orbitalphase.to_f - @orbitalphase.to_i;\n\t\t\t\t\tend\n\t\t\t\t\t\n\t\t\t\tend\n\t\t\t\t\n\t\t\t\tif index2.to_i == 28\n\t\t\t\t\t@energyrange = lll[0]\n\t\t\t\t\t@fovrange = lll[1]\n\t\t\t\t\t@albedo = lll[2]\n\t\t\t\t\t@binsize = lll[3] \n\t\t\t\t\t@expstep = lll[4] \n\t\t\t\t\t@phasecode = lll[5] \n\t\t\t\tend\n\t\t\tend\n\n\tend",
"def load!\n path = path()\n raise \"data object #{@type}:#{@id} does not exist\" unless File.directory? path\n @fields = Configuration.new path, 'metadata'\n @fields.dup.each do |k, v|\n if (cfg = @type[k])\n @fields[k] = Field.from(@repo, cfg).set(v)\n else\n warn \"unrecognised metadata #{k} = #{v.inspect}\"\n @fields[k] = v\n end\n end\n @type.each_field do |k, cfg|\n next if @fields[k]\n fieldobj = Field.from(@repo, cfg)\n if (dflt = fieldobj.default)\n @fields[k] = fieldobj.tap{|f| f.default! }\n elsif fieldobj.required?\n raise \"data object #{@type}:#{@id} missing required field #{k}\"\n end\n end\n self\n end",
"def read_data(file_name)\r\n file = File.open(file_name,\"r\")\r\n object = eval(file.gets.untaint.encode('UTF-8', :invalid => :replace))\r\n file.close()\r\n return object\r\nend",
"def initialize(filename)\n @name = ''\n @desc = ''\n @diagram = ''\n \n file = File.open(filename)\n \n while(line = file.gets)\n line.chomp!\n if(line == 'NAME')\n @name = file.gets.chomp!\n elsif(line == 'DESC')\n while((line = file.gets) && line != \"END\\n\")\n @desc += line\n end\n elsif(line == 'DIAGRAM')\n while((line = file.gets) && line != \"END\\n\")\n @diagram += line\n end \n end\n end\n file.close()\n end",
"def load(file); end",
"def read_binary_object_at(fname,fd,pos)\n position = @offsets[pos]\n fd.seek(position,IO::SEEK_SET)\n return read_binary_object(fname,fd)\n end",
"def initialize(input, type=:auto)\n @name = nil\n case type\n when :auto\n if !input.include? \"\\n\"\n # attempt to identify tpye by file extension\n case input.split(\".\").last\n when /[Ss][Tt][Ll]/ then load_stl input\n when /[Oo][Bb][Jj]/ then load_obj input\n else\n throw \"Couldn't identify mesh file by extension.\"\n end\n else\n # attempt to identify tpye by first non whitespace or comment line of the file\n input.each_line do |line|\n next if line =~ /^\\s*(#(.)*)?$/\n case line\n when /^\\s*solid (.*)/ then load_stl input\n when /^\\s*v\\s+(\\-?\\d*\\.\\d+)\\s+(\\-?\\d*\\.\\d+)\\s+(\\-?\\d*\\.\\d+)/ then load_obj input\n else\n throw \"Couldn't guess file format.\"\n end\n end\n end\n when :stl then load_stl input\n when :obj then load_obj input\n else\n throw \"Unknown mesh type: #{type}\"\n end\n end",
"def gen_shapes\n input_file = ARGV[0].nil? ? \"example.dat\" : ARGV[0]\n shapes_json = gen_json(input_file)\n shapes_json[:geometry][:shape].map do |shape_json|\n Shape.new(shape_json)\n end\n end",
"def decl_obj(name)\n src = File.join SRC_DIR,\"#{name}.cpp\"\n fail \"Cannot find #{src}\" unless File.exists?(src)\n obj = File.join OBJ_DIR,\"#{name}.o\"\n file obj => deps(src) + [OBJ_DIR] do\n sh \"g++ -o#{obj} #{OBJ_FLAGS.map{|f|\"-#{f}\"}.join(' ')} #{src}\"\n end\nend",
"def set_up_local_data\n Player.deserialize_from_file('players.dat')\n Game.deserialize_from_file('games.dat')\n Performance.deserialize_from_file('performance.dat')\n end",
"def from_file(filename, &block)\n deserialize(open(filename))\n end",
"def save_to_file(obj)\n File.open(@filename, @mode) do |aFile|\n aFile.puts \"#{obj}\"\n end\n end",
"def load_object(robject, data)\n robject.raw_data = data[:value]\n robject.content_type = data[:content_type]\n robject.links = data[:links]\n robject.indexes = data[:indexes]\n robject.meta = data[:meta]\n robject.etag = data[:etag]\n robject.last_modified = data[:last_modified]\n robject.vclock = data[:vclock]\n robject\n end",
"def initialize(filename:, directory: '.')\n @directory = directory.gsub(/\\/$/, '')\n @qualified_filename = @directory + '/' + filename\n @filename = filename\n @obj_metadata = {} # If we failed to read file\n diphot_metadata_to_h if File.extname(filename) == '.dat'\n end",
"def initialize(object, file)\n super(object, file)\n @name = object.name\n end",
"def initialize(object, file)\n super(object, file)\n @name = object.name\n end"
] |
[
"0.6930454",
"0.62949574",
"0.61179334",
"0.60561913",
"0.59808797",
"0.59243625",
"0.5873185",
"0.56598336",
"0.5589822",
"0.55775833",
"0.5478374",
"0.54504454",
"0.53911966",
"0.53388566",
"0.53007317",
"0.5274141",
"0.5268032",
"0.5266095",
"0.5262088",
"0.5230244",
"0.521455",
"0.5197013",
"0.51700586",
"0.5163603",
"0.5144619",
"0.51412904",
"0.5135277",
"0.51329154",
"0.5094014",
"0.50815725",
"0.5079498",
"0.50768334",
"0.50753653",
"0.5049947",
"0.50498027",
"0.50382257",
"0.50356716",
"0.5032159",
"0.5030585",
"0.50277704",
"0.50225496",
"0.4991457",
"0.49898776",
"0.49898776",
"0.49885458",
"0.49853626",
"0.49771896",
"0.49724036",
"0.49706218",
"0.49705347",
"0.49644265",
"0.495704",
"0.49383828",
"0.49334377",
"0.4920356",
"0.49178204",
"0.49054793",
"0.49022114",
"0.4899469",
"0.48931938",
"0.48884702",
"0.48789236",
"0.4877203",
"0.48729867",
"0.48697308",
"0.4869033",
"0.48554552",
"0.48536155",
"0.48507714",
"0.48419666",
"0.4832149",
"0.48306832",
"0.48239574",
"0.48218882",
"0.48218882",
"0.4812549",
"0.47999373",
"0.4789449",
"0.47880197",
"0.47787058",
"0.47780338",
"0.47720546",
"0.47686988",
"0.4765503",
"0.4759965",
"0.4757844",
"0.4754755",
"0.4747882",
"0.47404963",
"0.47402596",
"0.47388053",
"0.4738742",
"0.473606",
"0.47296864",
"0.4729309",
"0.47289637",
"0.4725954",
"0.47253856",
"0.47247496",
"0.47247496"
] |
0.6578253
|
1
|
parse D: Record the draw action for faster refrence in later gl_draws for the object.
|
def setup
self.parse() # load file
puts("+Constructing a total of (#{@groups.keys.size}) Groups:") if @verbose
@groups.each_value do |grp|
grp.displaylist = glGenLists( 1 )
glNewList(grp.displaylist, GL_COMPILE )
puts(" * \"#{grp.name}\" : Faces(#{grp.faces.size}) openGL draw list cached.") if @verbose
grp.gl_draw_list(self) # create precahced draw operation
glEndList()
end
puts("+Total Count of Faces: [ #{self.get_face_count} ]") if @verbose
# display materials information
puts("+Material Lib: \"#{material_lib}\" with (#{@current_materials.size}) Name Refrences.") if @verbose
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def draw\n\t\t@move_action.draw\n\tend",
"def draw; end",
"def draw; end",
"def draw\n end",
"def draw\n end",
"def draw\n end",
"def draw\n end",
"def draw\n\t\t\n\tend",
"def draw\n\t\t\n\tend",
"def draw\n\t\t\n\tend",
"def draw\n\t\t\n\tend",
"def draw\n\tend",
"def draw\n\n\t\tend",
"def draw\n\t\tend",
"def draw(view)\r\n @drawn = false\r\n \r\n # Show the current input point\r\n if( @ip.valid? && @ip.display? )\r\n @ip.draw(view)\r\n @drawn = true\r\n end\r\n\r\n case @state\r\n when STATE_PICK\r\n # do nothing\r\n when STATE_PICK_NEXT\r\n # just draw a line from the start to the end point\r\n view.set_color_from_line(@ip1, @ip)\r\n inference_locked = view.inference_locked?\r\n view.line_width = 3 if inference_locked\r\n view.draw(GL_LINE_STRIP, @pts[0], @pts[1])\r\n view.line_width = 1 if inference_locked\r\n @drawn = true\r\n else\r\n # draw a rectangle\r\n view.drawing_color = \"black\"\r\n view.draw(GL_LINE_STRIP, @pts)\r\n @drawn = true\r\n end\r\nend",
"def draw\n\t\t@currentState.draw\n\tend",
"def draw\n\t\t\t\t\n\t\t\tend",
"def draw\n\t\t#puts \"Node#draw : #{@node_x}, #{@node_y}\"\n\t\t#puts \"Node#draw: str_pos: \" + @str_pos.to_s\n\t\tpushStyle\n\t\t\tno_stroke\n\t\t\tfill 40, 50, 70\n\t\t\tellipse(@node_x, @node_y, @@node_size, @@node_size)\n\t\tpopStyle\n\tend",
"def draw(dc, theme, width, height)\r\n meth_handl = @graphic_handler[@state_gfx]\r\n send(meth_handl, dc, width, height) if meth_handl\r\n end",
"def draw(view)\r\n # puts \"draw state = #{@state}\"\r\n # Show the current input point\r\n if (@ip.valid? && @ip.display?)\r\n @ip.draw(view)\r\n @drawn = true\r\n end\r\n\r\n # show the wall base outline\r\n if (@state == STATE_PICK_NEXT)\r\n\t\t#puts \"wall width3: \" + @wall.width.to_s + \" \" + @wall.width.class.to_s\r\n (@offset_pt0, @offset_pt1) = MM_HouseBuilder.draw_outline(view, @pts[0], @pts[1], @wall.width, @wall.justify, \"gray\")\r\n @drawn = true\r\n end\r\nend",
"def draw_effect\n end",
"def draw? \n end",
"def draw\n raise \"Not implemented\"\n end",
"def drawLocation _obj, _args\n \"_obj drawLocation _args;\" \n end",
"def drawLine _obj, _args\n \"_obj drawLine _args;\" \n end",
"def draw\n @osd.draw\n end",
"def drawArrow _obj, _args\n \"_obj drawArrow _args;\" \n end",
"def draw(&proc)\n end",
"def draw(&proc)\n end",
"def draw(&proc)\n end",
"def do_draw( event )\n dirty_rects = draw( event.screen )\n event.screen.update_rects(dirty_rects)\n end",
"def draw\n return if @type == Type[:EMPTY]\n\n @window.mvaddstr(@x, @y, @appearance)\n end",
"def draw()\n @ucCharFace.draw()\n @cCharName.draw()\n @ucCharLvl.draw()\n @cHpStatGauge.draw()\n @ucHpStat.draw()\n @cMpStatGauge.draw()\n @ucMpStat.draw()\n end",
"def draw()\n @ucCharFace.draw()\n @cCharName.draw()\n @ucCharLvl.draw()\n @cHpStatGauge.draw()\n @ucHpStat.draw()\n @cMpStatGauge.draw()\n @ucMpStat.draw()\n end",
"def draw()\n @ucActStates.draw()\n @cCharImage.draw()\n @cCharName.draw()\n @ucCharLvl.draw()\n @cHpStatGauge.draw()\n @ucHpStat.draw()\n @cMpStatGauge.draw()\n @ucMpStat.draw()\n @cExpGauge.draw()\n @ucExp.draw()\n end",
"def set_draw\n @draw = Draw.find(params[:id])\n end",
"def draw\n framerate_counter.update\n\n draw_background_on self\n poops.each {|poop| poop.draw_on self }\n draw_targets_on self\n boid.draw_on self\n draw_ui_on self\n end",
"def draw(&proc)\n instance_eval(&proc)\n end",
"def draw\n\t\t\t\tprotect_runtime_errors do\n\t\t\t\t\t# render the selected state\n\t\t\t\t\t# (it has been rendered before, so it should render now without errors)\n\t\t\t\t\tunless @history_cache.nil?\n\t\t\t\t\t\t# render the states\n\t\t\t\t\t\t# puts \"history: #{@history_cache.size} - #{@history_cache.collect{|x| !x.nil?}.inspect}\"\n\t\t\t\t\t\t\n\t\t\t\t\t\t# TODO: render to FBO once and then render that same state to the screen over and over again as long as @time_travel_i is unchanged\n\t\t\t\t\t\t# currently, framerate is down to ~30fps, because this render operation is expensive.\n\t\t\t\t\t\t\n\t\t\t\t\t\t# State 0 is not renderable, because that is before the first update runs. Without the first update, the first draw will fail. Just skip state 0. Later, when we attempt to compress history by diffs, state 0 may come in handy.\n\t\t\t\t\t\trender_onion_skin(\n\t\t\t\t\t\t\t@history_cache[1..(@time_travel_i-1)], ONION_SKIN_STANDARD_COLOR,\n\t\t\t\t\t\t\t@history_cache[@time_travel_i], ONION_SKIN_NOW_COLOR,\n\t\t\t\t\t\t\t@history_cache[@forecast_range], ONION_SKIN_ERROR_COLOR\n\t\t\t\t\t\t)\n\t\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\t# @history_cache[@time_travel_i].draw @window\n\t\t\t\t\t\t\n\t\t\t\t\t\t# ^ currently the saved state is rendering some UI which shows what the current TurnCounter values are. This is going to have weird interactions with onion skinning. Should consider separating UI drawing from main entity drawing.\n\t\t\t\t\t\t# (or maybe onion-skinning the UI will be cool? idk)\\\t\t\t\t\t\n\t\t\t\t\tend\n\t\t\t\t\t\n\t\t\t\t\t@ui.draw @window, @wrapped_object, @history_cache, @turn\n\t\t\t\tend\n\t\t\tend",
"def draw_delauney\nend",
"def declare_draw(board, game_id, num)\n\t\tmark_last_move_as_drawing(game_id, num)\n\t\t@games_move_history[num].delete(game_id)\n\tend",
"def draw(&proc)\n obj.instance_eval(&proc)\n end",
"def draw_advanced(rect, item) end",
"def drawLink _obj, _args\n \"_obj drawLink _args;\" \n end",
"def create\n @draw = Draw.new(draw_params)\n respond_to do |format|\n if @draw.save\n format.html { redirect_to @draw, notice: 'Draw was successfully created.' }\n format.json { render :show, status: :created, location: @draw }\n else\n format.html { render :new }\n format.json { render json: @draw.errors, status: :unprocessable_entity }\n end\n end\n end",
"def draw(view)\r\n # show the wall base outline\r\n\r\n # draw the outline of the wall\r\n @corners = [] if not defined?(@corners)\r\n @corners[0] = @pts[0]\r\n @corners[1] = @pts[1]\r\n (a, b) = MM_HouseBuilder.draw_outline(view, @pts[0], @pts[1], @wall.width, @wall.justify, \"gray\")\r\n # puts \"a = \" + a.inspect\r\n @corners[2] = b\r\n @corners[3] = a\r\n @corners[4] = @pts[0]\r\n vec = @pts[1] - @pts[0]\r\n @wall.objects.each do |obj|\r\n vec.length = obj.center_offset - obj.width/2\r\n obj_start = @wall.origin + vec\r\n vec.length = obj.width\r\n obj_end = obj_start + vec\r\n if (defined?(@selected_obj) && (obj == @selected_obj))\r\n MM_HouseBuilder.draw_outline(view, obj_start, obj_end, @wall.width, @wall.justify, \"red\", 3)\r\n else\r\n MM_HouseBuilder.draw_outline(view, obj_start, obj_end, @wall.width, @wall.justify, \"gray\")\r\n end\r\n end\r\n \r\n if ((@state == STATE_PICK) || (@state == STATE_MOVING))\r\n if (@pt_to_move)\r\n view.draw_points(@pt_to_move, 10, 1, \"red\");\r\n end\r\n if (@state == STATE_MOVING)\r\n view.set_color_from_line(@start_input_point.position, @pt_to_move)\r\n view.line_stipple = \".\" # dotted line\r\n view.draw(GL_LINE_STRIP, @start_input_point.position, @pt_to_move)\r\n end\r\n end\r\n \r\n @drawn = true\r\nend",
"def draw()\n\t\t# convert integer array to X and O\n\t\tplayer_moves = @gameplay_positions.map do |n|\n\t\t\tcase n\n\t\t\twhen 1\n\t\t\t \"X\"\n\t\t\twhen 2\n\t\t\t \"O\"\n\t\t\telse\n\t\t\t \" \"\n\t\t\tend\n\t\tend\n\n\t\tprintMap(player_moves)\n\t\t\n\tend",
"def create\n @draw = Draw.new(params[:draw])\n\n respond_to do |format|\n if @draw.save\n format.html { redirect_to @draw, notice: 'Draw was successfully created.' }\n format.json { render json: @draw, status: :created, location: @draw }\n else\n format.html { render action: \"new\" }\n format.json { render json: @draw.errors, status: :unprocessable_entity }\n end\n end\n end",
"def draw()\n @ucActStates.draw()\n @cHpStatGauge.draw()\n @ucHpStat.draw()\n @cMpStatGauge.draw()\n @ucMpStat.draw()\n @ucAtkStat.draw()\n @ucDefStat.draw()\n @ucSpiStat.draw()\n @ucAgiStat.draw()\n @ucEvaStat.draw()\n @ucHitStat.draw()\n @ucCriStat.draw()\n end",
"def draw(entity)\n case entity\n when Edge then draw_edge entity\n when Box then draw_box entity\n end\n end",
"def draw(&proc)\n instance_eval(&proc)\n end",
"def draw(&proc)\n instance_eval(&proc)\n end",
"def draw(&proc)\n instance_eval(&proc)\n end",
"def draw(view)\r\n # Show the current input point\r\n if (@ip.valid? && @ip.display?)\r\n @ip.draw(view)\r\n @drawn = true\r\n end \r\n\r\n # draw the outline of the wall\r\n MM_HouseBuilder.draw_outline(view, @wall.origin, @wall.endpt, @wall.width, @wall.justify, \"gray\")\r\n vec = @end_pt - @start_pt\r\n # draw the outline of each door and window\r\n @wall.objects.each do |obj|\r\n vec.length = obj.center_offset - obj.width/2\r\n obj_start = @wall.origin + vec\r\n vec.length = obj.width\r\n obj_end = obj_start + vec\r\n MM_HouseBuilder.draw_outline(view, obj_start, obj_end, @wall.width, @wall.justify, \"gray\")\r\n end\r\n MM_HouseBuilder.draw_outline(view, @start_pt, @end_pt, @wall.width, @wall.justify, \"orange\", 2)\r\n @drawn = true\r\nend",
"def draw2d(opengl_primitive, *points)\n end",
"def draw()\n draw_controls()\n end",
"def draw_advanced(rect, item)\n end",
"def draw\n @drawer.clear\n draw_ss\n draw_graph\n @segments.each do |s|\n s.draw(@drawer) \n end\n end",
"def draw\n @graphics.draw\n @script.draw\n end",
"def draw(graphics)\n graphics.set_color @color.native_color\n graphics.draw @line\n end",
"def draw()\n @ucEncounters.draw()\n @ucDefeated.draw()\n @ucEscaped.draw()\n @ucExp.draw()\n @ucGold.draw()\n end",
"def draw\n\t\tsub_face_left = face_left?\n\n\t\tdraw_sub(sub_face_left)\n\t\t@has_moved = false\n\t\t@prawn.draw\n\tend",
"def draw(&proc)\n self.instance_eval(&proc)\n end",
"def draw(&proc)\n self.instance_eval(&proc)\n end",
"def draw\n @num_drawn += 1\n @rep.pop\n end",
"def draw\n\tsuper\n\t@onclick = {}\n\tScreen.font.draw_blended_utf8(@surface, \"WAVE: #{Game.wave.number}\", 6, 9, 0, 0, 0)\n\tif Game.player.can_trigger_next_wave?\n\t Screen.font.draw_blended_utf8(@surface, \"NEXT\", 122, 9, 0, 0, 0)\n\t @onclick[[100, 0, 200, 40]] = proc do\n\t Game.player.next_wave\n\t end\n\telse\n\t Screen.font.draw_blended_utf8(@surface, \"NEXT\", 122, 9, 0x88, 0x88, 0x88)\n\tend\n\tScreen.font.draw_blended_utf8(@surface, \"BUILDINGS:\", 44, 49, 0, 0, 0)\n\toff_y = 80\n\t\n\t@towers = Model::Tower.get_all_basic unless @towers\n\t@towers.each do |i|\n\t draw_tower i, off_y, :buy\n\t off_y += 40 \n\tend\n\t\n\tif Game.scene.selected_tower\n\t if @base_tower_class != Game.scene.selected_tower.class\n\t @base_tower_class = Game.scene.selected_tower.class\n\t @upgrades = Model::Tower.get_all_upgrades @base_tower_class\n\t end\n\t \n\t if @upgrades.length > 0\n\t Screen.font.draw_blended_utf8(@surface, \"UPGRADES:\", 45, off_y+9, 0, 0, 0)\n\n\t off_y += 40\n\t end\n\t \n\t @upgrades.each do |i|\n\t draw_tower i, off_y, :sell\n\t off_y += 40\n\t end\n\t \n\t Screen.font.draw_blended_utf8(@surface, \"SELL\", 78, off_y+9, 0, 0, 0)\n\t @onclick[[0, off_y, 200, off_y+40]] = proc do\n\t Game.player.sell_tower Game.scene.selected_tower\n\t end\n\t \n\t Screen.font.draw_blended_utf8(@surface, \"SELECTED:\", 47, 369, 0, 0, 0)\n\t off_y = 400\n\t draw_tower Game.scene.selected_tower.class, off_y, :extended\n\t \n\tend\n\t\n\tScreen.font.draw_blended_utf8(@surface, \"TDef\", 10, 489, 0, 0, 0)\n\tScreen.smallfont.draw_blended_utf8(@surface, \"Marcin Łabanowski (131565)\", 10, 509, 0, 0, 0)\n\tScreen.smallfont.draw_blended_utf8(@surface, \"Adam Łaguna (131566)\", 10, 522, 0, 0, 0)\n\t@surface.draw_rect(0,0,100,40,Screen.handle.format.mapRGB( 0, 0, 0))\n\t@surface.draw_rect(100,0,100,40,Screen.handle.format.mapRGB( 0, 0, 0))\n\t@surface.draw_rect(0,40,200,40,Screen.handle.format.mapRGB( 0, 0, 0))\n\t@surface.draw_rect(0,80,200,40,Screen.handle.format.mapRGB( 0, 0, 0))\n\t@surface.draw_rect(0,120,200,40,Screen.handle.format.mapRGB( 0, 0, 0))\n\t@surface.draw_rect(0,160,200,40,Screen.handle.format.mapRGB( 0, 0, 0))\n\t@surface.draw_rect(0,200,200,40,Screen.handle.format.mapRGB( 0, 0, 0))\n\t@surface.draw_rect(0,240,200,40,Screen.handle.format.mapRGB( 0, 0, 0))\n\t@surface.draw_rect(0,280,200,40,Screen.handle.format.mapRGB( 0, 0, 0))\n\t@surface.draw_rect(0,320,200,40,Screen.handle.format.mapRGB( 0, 0, 0))\n\t@surface.draw_rect(0,360,200,40,Screen.handle.format.mapRGB( 0, 0, 0))\n\t@surface.draw_rect(0,400,200,80,Screen.handle.format.mapRGB( 0, 0, 0))\n\t@surface.draw_rect(0,480,200,80,Screen.handle.format.mapRGB( 0, 0, 0))\n\t\n\t@t_onclick = @onclick\n end",
"def draw(view)\n if( @ip1.valid? )\n if( @ip1.display? )\n @ip1.draw(view)\n @drawn = true\n end\n \n if( @ip2.valid? )\n @ip2.draw(view) if( @ip2.display? )\n \n # The set_color_from_line method determines what color\n # to use to draw a line based on its direction. For example\n # red, green or blue.\n view.set_color_from_line(@ip1, @ip2)\n self.draw_geometry(@ip1.position, @ip2.position, view)\n @drawn = true\n end\n end\nend",
"def draw_basic_actions\n y = line_height\n enemy.actions.each do |action|\n next unless action.kind == 0\n draw_basic_action(y, action)\n y += line_height\n end\n y\n end",
"def ddot!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 37 )\n\n\n\n type = DDOT\n channel = ANTLR3::DEFAULT_CHANNEL\n # - - - - label initialization - - - -\n\n\n # - - - - main rule block - - - -\n # at line 58:7: ':'\n match( 0x3a )\n\n\n @state.type = type\n @state.channel = channel\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 37 )\n\n\n end",
"def draw(view, x, y)\r\n view.line_width = 1\r\n view.line_stipple = STIPPLE_SOLID\r\n tr = Geom::Transformation.new([x, y, 0])\r\n @cache.each { |color, points|\r\n view.drawing_color = color\r\n view.draw2d(GL_LINES, points.map { |point| point.transform(tr) } )\r\n }\r\n nil\r\n end",
"def draw_completed? ; false ; end",
"def draw(view)\r\n # show the wall base outline\r\n\r\n # draw the outline of the wall\r\n @corners[0] = @wall.origin\r\n @corners[1] = @wall.endpt\r\n (a, b) = MM_HouseBuilder.draw_outline(view, @corners[0], @corners[1], @wall.width, @wall.justify, \"gray\")\r\n # puts \"a = \" + a.inspect\r\n @corners[2] = b\r\n @corners[3] = a\r\n @corners[4] = @corners[0]\r\n vec = @corners[1] - @corners[0]\r\n @wall.objects.each do |obj|\r\n vec.length = obj.center_offset - obj.width/2\r\n obj_start = @wall.origin + vec\r\n vec.length = obj.width\r\n obj_end = obj_start + vec\r\n if (defined?(@selected_obj) && (obj == @selected_obj))\r\n if (@state != STATE_MOVING)\r\n MM_HouseBuilder.draw_outline(view, obj_start, obj_end, @wall.width, @wall.justify, \"red\", 3)\r\n end\r\n else\r\n MM_HouseBuilder.draw_outline(view, obj_start, obj_end, @wall.width, @wall.justify, \"gray\")\r\n end\r\n end\r\n if (@state == STATE_MOVING)\r\n MM_HouseBuilder.draw_outline(view, @start_pt, @end_pt, @wall.width, @wall.justify, \"red\", 2)\r\n end\r\n \r\n @drawn = true\r\nend",
"def draw\n @game.state.views.each do |view|\n view.draw\n end\n end",
"def draw_reward(r_id, y)\n reward = @quest.rewards[r_id]\n case reward[0]\n when :item, 0 # Item\n draw_item_reward(y, $data_items[reward[1]], reward[2] ? reward[2] : 1)\n when :weapon, 1 # Weapon\n draw_item_reward(y, $data_weapons[reward[1]], reward[2] ? reward[2] : 1)\n when :armor, 2 # Armor\n draw_item_reward(y, $data_armors[reward[1]], reward[2] ? reward[2] : 1)\n when :gold, 3 # Gold\n draw_basic_data(y, QuestData::ICONS[:reward_gold], \n QuestData::VOCAB[:reward_gold], (reward[1] ? reward[1] : 0).to_s)\n when :exp, 4 # Exp\n draw_basic_data(y, QuestData::ICONS[:reward_exp], \n QuestData::VOCAB[:reward_exp], (reward[1] ? reward[1] : 0).to_s)\n when :string, 5 # String\n draw_basic_data(y, reward[1] ? reward[1] : 0, reward[3] ? reward[3].to_s : \"\", \n reward[2] ? reward[2].to_s : \"\")\n end\n end",
"def draw\r\n @game_objects.draw\r\n end",
"def draw\n intro if @intro_flag\n draw_ruby\n draw_emerald\n @dude.draw(mouse_x - 75, mouse_y - 75, 1)\n hitter\n draw_header\n game_over unless @playing || @intro_flag\n end",
"def gl_draw\n return if @destoryed # map will take care of the class object.\n # https://docs.microsoft.com/en-us/windows/desktop/opengl/glpushmatrix\n glPushMatrix # for the most part operations should keep to themselfs with location configuration.\n #---------------------------------------------------------\n # https://docs.microsoft.com/en-us/windows/desktop/opengl/gltranslatef\n glTranslatef(@x, @y, @z) # Moving function from the current gluPerspective by x,y,z change\n #---------------------------------------------------------\n # https://docs.microsoft.com/en-us/windows/desktop/opengl/glrotatef\n # glRotatef(angle, X axis scale, Y axis scale, Z axis scale)\n glRotatef(@angle[0], @angle[1], @angle[2], @angle[3])\n #---------------------------------------------------------\n # https://www.rubydoc.info/github/gosu/gosu/master/Gosu/GLTexInfo\n if @texture.nil? || @texture_debugging\n # debug texture drawing: helps find things by painting them a color.\n # https://docs.microsoft.com/en-us/windows/desktop/opengl/gldisable\n glDisable(GL_TEXTURE_2D)\n # https://docs.microsoft.com/en-us/windows/desktop/opengl/glcolor3ub\n glColor3ub(255, 100, 100) # or a diffrent color if desired...\n else # normal drawing\n # https://docs.microsoft.com/en-us/windows/desktop/opengl/glpushmatrix\n glBindTexture(GL_TEXTURE_2D, @texture.tex_name)\n end\n #---------------------------------------------------------\n # https://docs.microsoft.com/en-us/windows/desktop/opengl/glscalef\n # scales the whole object including texture mapping.\n glScalef(@scale, @scale, @scale)\n #---------------------------------------------------------\n # call the cached draw recording for the model.\n unless @object_model.nil?\n @object_model.render\n else\n puts(\"No model to draw for object: [ #{@obj_filename} ]\")\n exit\n end\n #---------------------------------------------------------\n # https://docs.microsoft.com/en-us/windows/desktop/opengl/glpopmatrix\n glPopMatrix\n end",
"def draw(&proc)\n self.instance_eval(&proc)\n end",
"def draw(&proc)\n self.instance_eval(&proc)\n end",
"def draw(&proc)\n self.instance_eval(&proc)\n end",
"def draw(update=false)\n\t\tif update or not @animate\n\t\t\tprint \"\\e[H\"\n\t\t\tif not @animate; print \"\\e[2J\"; end\n\t\t\tsuper()\n\t\telse\n\t\t\tprint \"\\e[2J\"\n\t\t\tcarve_passages\n\t\tend\n\tend",
"def draw\n @help.draw(30, 120, 100)\n @cancel.draw\n end",
"def draw\n process_result 0.5\n end",
"def draw( &blk )\n register\n instance_eval &blk if blk\n self\n end",
"def draw()\n if self.enemy != nil\n bitmap = Cache.battler(self.enemy.battler_name, self.enemy.battler_hue)\n @cEnemyGraphic.img_bitmap = bitmap\n @cEnemyGraphic.src_rect = Rect.new(0, 0, bitmap.width, bitmap.height)\n @cEnemyGraphic.draw()\n end\n end",
"def draw\n @help.draw(20, 10, 100)\n @return.draw\n end",
"def draw\n case @status\n when :alive\n @normal_image.draw(@x - @normal_image.width / 2, @y - @normal_image.height / 2, ZOrder::Player)\n when :crashed\n @crash_image.draw(@x - @crash_image.width / 2, @y - @crash_image.height / 2, ZOrder::Player)\n when :resurrecting\n @normal_image.draw(@x - @normal_image.width / 2, @y - @normal_image.height / 2, ZOrder::Player) if (Time.now.to_f * 1000).to_i % 2 == 0\n end\n end",
"def draw\n @player.draw\n if @twoplayer\n @player2.draw\n else\n @bot.draw\n end\n @ball.draw\n @wall.draw\n @score.draw\n @help.draw\n end",
"def draw(name = @cur_deck_name)\n\n end",
"def draw\n draw_background\n draw_ambient\n draw_objects\n draw_ui\n end",
"def draw(view)\n if( @ip1.valid? )\n if( @ip1.display? )\n @ip1.draw(view)\n @drawn = true\n end\n \n if( @ip2.valid? )\n @ip2.draw(view) if( @ip2.display? )\n \n # The set_color_from_line method determines what color\n # to use to draw a line based on its direction. For example\n # red, green or blue.\n view.set_color_from_line(@ip1, @ip2)\n \t\t\tview.line_stipple = \".\"\n \t\t\tview.draw_line(@gp1, @gp2)\n \t\t\tview.line_stipple = \"\"\n \t\t\t \n @drawn = true\n end\n end\n end",
"def getDrawColor()\n return @drawColor\n end",
"def draw()\n if self.actor != nil\n bitmap = Cache.character(self.actor.character_name)\n sign = self.actor.character_name[/^[\\!\\$]./]\n if sign != nil && sign.include?('$')\n cw = bitmap.width / 3\n ch = bitmap.height / 4\n else\n cw = bitmap.width / 12\n ch = bitmap.height / 8\n end\n n = self.actor.character_index\n \n @cCharGraphic.img_bitmap = bitmap\n @cCharGraphic.src_rect = Rect.new((n%4*3+1)*cw, (n/4*4+@direction)*ch, cw, ch)\n @cCharGraphic.draw()\n end\n end",
"def draw\r\n $scene.draw\r\n end",
"def draw\n\t\tif !@flipped and !@matched then\n\t\t\t@rev.draw(@xLocation, @yLocation, 0)\n\t\telsif @flipped and !@matched\n\t\t\t@image.draw(@xLocation, @yLocation, 0)\n\t\telse\n\t\t\t@chkImage.draw(@xLocation, @yLocation, 0)\n\t\tend\n\tend",
"def draw \n\t\tsuper(\"Lives: #{@lives.to_s}\", X, Y, 5)\n\tend",
"def update\n respond_to do |format|\n if @draw.update(draw_params)\n format.html { redirect_to @draw, notice: 'Draw was successfully updated.' }\n format.json { render :show, status: :ok, location: @draw }\n else\n format.html { render :edit }\n format.json { render json: @draw.errors, status: :unprocessable_entity }\n end\n end\n end",
"def draw\n return if @destoryed\n return unless @verbose\n unless DEBUG_PRINT_WAIT.nil?\n @string = get_debug_string\n end\n @hud_font.draw_text(@string, $program.width - 200, $program.height - 300, 100, 1, 1, 0xff_000000, :default)\n end",
"def drawing_params\n params.require(:drawing).permit(:name, :leds, :user_id, :leds => [])\n end",
"def draw(view)\n if( @ip1.valid? )\n if( @ip1.display? )\n @ip1.draw(view)\n @drawn = true\n end\n\n if( @ip2.valid? )\n @ip2.draw(view) if( @ip2.display? )\n\n # The set_color_from_line method determines what color\n # to use to draw a line based on its direction. For example\n # red, green or blue.\n view.set_color_from_line(@ip1, @ip2)\n self.draw_geometry(@ip1.position, @ip2.position, view)\n @drawn = true\n end\n end\n end",
"def show\n @draw_data = Draw.find_by_id params[:id]\n end"
] |
[
"0.6554437",
"0.5880962",
"0.5880962",
"0.5828265",
"0.5828265",
"0.5828265",
"0.578141",
"0.5737402",
"0.5737402",
"0.5737402",
"0.5737402",
"0.5718622",
"0.56853026",
"0.5673699",
"0.54960084",
"0.54728097",
"0.5469598",
"0.5464913",
"0.545161",
"0.5439377",
"0.5413563",
"0.53992844",
"0.5396772",
"0.5382781",
"0.53586143",
"0.5282865",
"0.5269369",
"0.526102",
"0.526102",
"0.526102",
"0.5248201",
"0.52401054",
"0.52311534",
"0.52311534",
"0.5227667",
"0.5153327",
"0.51286477",
"0.5127707",
"0.51234204",
"0.51210785",
"0.5114445",
"0.510784",
"0.50951946",
"0.50928605",
"0.5091077",
"0.5082106",
"0.5064165",
"0.50601596",
"0.50549287",
"0.5050988",
"0.50498885",
"0.50498885",
"0.50498885",
"0.5043419",
"0.5017653",
"0.4976501",
"0.49747515",
"0.49673554",
"0.49539912",
"0.49520317",
"0.4951601",
"0.49511853",
"0.49450177",
"0.49450177",
"0.4936682",
"0.49364388",
"0.49327865",
"0.49236685",
"0.49234578",
"0.49221027",
"0.4922098",
"0.4921925",
"0.49209368",
"0.49051267",
"0.49036327",
"0.48978683",
"0.48892188",
"0.48813394",
"0.48813394",
"0.48813394",
"0.48714387",
"0.48659554",
"0.485208",
"0.48490548",
"0.48471636",
"0.48421118",
"0.4835578",
"0.48174685",
"0.48128918",
"0.48034993",
"0.48001164",
"0.4797562",
"0.47958073",
"0.47879106",
"0.47840548",
"0.47822833",
"0.4779631",
"0.47738248",
"0.4773643",
"0.47665447",
"0.4766275"
] |
0.0
|
-1
|
D: Returns Group object (or creates new Group when there's no matching group found)
|
def get_group( name )
if ( !@groups.has_key?( name ) )
@groups[name] = Group.new( name )
end
return @groups[name]
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def get_or_create_group\n name = metadata['group']\n\n db = DB::Groups.find(name, pool)\n grp = load_group\n\n if db.nil?\n # The group does not exist, create it\n Commands::Group::Create.run!(\n pool: pool.name,\n name: grp.name\n )\n\n return DB::Groups.find(name, pool) || (fail 'expected group')\n end\n\n db\n end",
"def group\n @group ||= Group.new @instance, group_id\n end",
"def find_or_create_group(group_data)\n @groups.each do |group|\n return group if group.id == group_data[:id]\n end\n\n new_group = OctoFeed::EventGroup.new group_data\n @groups.push new_group\n new_group\n end",
"def group; Group.get(self.group_id); end",
"def get_create_group( group_name )\n check_user_pass\n existing_group_id = get_group_id( group_name )\n if existing_group_id == nil\n new_group_id = create_group( group_name )\n return new_group_id\n end\n return existing_group_id\n end",
"def lost_and_found_group\n existing_lost_and_found_group || Group.create_unique_group(self, LOST_AND_FOUND_GROUP)\n end",
"def group\n Group.get!(gidnumber)\n end",
"def create_or_find_group(name, parent)\n conds = [\"name = ? AND path = ?::ltree || ?\", name, parent.path, parent.id.to_s]\n AssetGroup.where(conds).first || AssetGroup.create(:name => name, :parent => parent)\n end",
"def group\n @group ||= group_id && course.groups.find_by(id: group_id)\n end",
"def find_or_create_panel_group(panel_groups, metric)\n panel_group = find_panel_group(panel_groups, metric)\n return panel_group if panel_group\n\n panel_group = new_panel_group(metric)\n panel_groups << panel_group\n\n panel_group\n end",
"def group\n @group ||= producer.groups.first\n end",
"def new\n @group = Group.new\n end",
"def new\n @group = Group.new\n end",
"def new\n @group = Group.new\n end",
"def new\n @group = Group.new\n end",
"def new\n @group = Group.new\n end",
"def new\n @group = Group.new\n end",
"def find_group(name)\n NetCDF::Group.new(@netcdf_elmt.findGroup(name))\n end",
"def load_group\n @group = Group.find_by_name(params[:id].titleize) or raise ActiveRecord::RecordNotFound\n end",
"def group\n @group ||= Innsights::Fetchers::Group.new(@group_object) if @group_object\n end",
"def new\n \t@group = Group.new\n end",
"def group\n return nil if item_type != 'group'\n @group ||= Group.where(code: item_code).last\n end",
"def [](group_key)\n key = Levels::Key.new(group_key)\n Group.new(key)\n end",
"def new\n @group = Group.new \n end",
"def group\n @group ||= Interface::Group.new(self)\n end",
"def load_group(group_entry)\n if @virtual_attributes.enabled?\n VirtualGroup.new(self, group_entry)\n elsif posix_support_enabled? && PosixGroup.valid?(group_entry)\n PosixGroup.new(self, group_entry)\n else\n Group.new(self, group_entry)\n end\n end",
"def get(key)\n key = to_key key\n return @group[key] if @group.key? key\n create key\n end",
"def get_group_by_name(groupname)\n return @grouphash[groupname]\n end",
"def get_group\n @group = Group.find(params[:id])\n end",
"def find_group(id)\n id = id.to_s\n groups.select{|gr| gr.id == id}.first\n end",
"def group\n return if record.respond_to?(:where)\n record.group\n end",
"def find_groups\n @groups ||= Group.find(:all)\n end",
"def new_group(stone,lives)\n group = @garbage_groups.pop\n if group\n return group.recycle!(stone,lives)\n else\n @num_groups += 1\n return Group.new(self,stone,lives,@num_groups)\n end\n end",
"def create\n\t\t@group = Group.new(params[:group])\n\t\trespond_to do |format|\n\t\t\tif fonct_new_dup?\n\t\t\t\tobject_orig=Group.find(params[:object_orig_id])\n\t\t\tst = @group.create_duplicate(object_orig)\n\t\t\telse\n\t\t\tst = @group.save\n\t\t\tend\n\t\t\tif st\n\t\t\t\tflash[:notice] = t(:ctrl_object_created, :typeobj => t(:ctrl_group), :ident => @group.name)\n\t\t\t\tparams[:id]=@group.id\n\t\t\t\tshow_\n\t\t\t\tformat.html { render :action => \"show\" }\n\t\t\t\tformat.xml { render :xml => @group, :status => :created, :location => @group }\n\t\t\telse\n\t\t\t\tflash[:error] = t(:ctrl_object_not_created, :typeobj => t(:ctrl_group), :msg => nil)\n\t\t\t\tformat.html { render :action => \"new\" }\n\t\t\t\tformat.xml { render :xml => @group.errors, :status => :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend",
"def find_group(name)\n login unless authenticated?\n group = JSON.parse RestClient.get(resource_url(\"groups/#{URI.escape(name)}\"), :cookies => @cookies).body\n return group['name'] == name ? group : nil\n rescue RestClient::ResourceNotFound\n return nil\n end",
"def find_or_build_recipe_group\n params[:id].blank? ? current_user.recipe_groups.new(params[:recipe_group]) : current_user.recipe_groups.find(params[:id])\n end",
"def createGroup\n call :createGroup\n end",
"def assign_group\n return unless group.nil?\n\n self.group = Group.find_by(name: 'Pilot')\n end",
"def get_group group_uuid\n group_uuid = @everyone_group if group_uuid.blank?\n \n return group_uuid if group_uuid.is_a?(Group)\n\n tmp = @groups.find{|grp|grp.uuid == group_uuid}\n \n raise \"unknown group or user with id #{group_uuid}\" unless tmp\n \n tmp\n end",
"def get_group_by_group_id(group_id)\n id = $r.get(\"group_id.to.id:#{group_id}\")\n return nil if !id\n get_group_by_id(id)\n end",
"def new group_identifier, object_identifier_or_array = []\n groups.store self.class.identifierize(group_identifier), self.class.identifier_collect(object_identifier_or_array)\n end",
"def group\n object.group.id\n end",
"def group(name)\n groups.detect { |group| group.name == name } ||\n raise(\"No such Fever group: #{name.inspect}\")\n end",
"def create\n\t\t@group = Group.new(params[:group])\n\t\trespond_to do |format|\n\t\t\tif params[:fonct] == \"new_dup\"\n\t\t\t\tobject_orig=Group.find(params[:object_orig_id])\n\t\t\tst = @group.create_duplicate(object_orig)\n\t\t\telse\n\t\t\tst = @group.save\n\t\t\tend\n\t\t\tif st\n\t\t\t\tflash[:notice] = t(:ctrl_object_created, :typeobj => t(:ctrl_group), :ident => @group.name)\n\t\t\t\tformat.html { redirect_to(@group) }\n\t\t\t\tformat.xml { render :xml => @group, :status => :created, :location => @group }\n\t\t\telse\n\t\t\t\tflash[:error] = t(:ctrl_object_not_created, :typeobj => t(:ctrl_group), :msg => nil)\n\t\t\t\tformat.html { render :action => \"new\" }\n\t\t\t\tformat.xml { render :xml => @group.errors, :status => :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend",
"def group\n strong_memoize(:group) do\n if params[:group_id].present? && valid_request?\n the_group = Group.find_by(id: params[:group_id])\n can?(current_user, :read_group, the_group) ? the_group : nil\n end\n end\n end",
"def new\n Group.rebuild! if nil.|Group.find(:first).rgt\n\t @group = Group.new\n\t @groups = current_user.get_unique_group_branches.map {|g| g.get_self_and_children?}.flatten\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @group }\n end\n end",
"def get_group(group_id)\n group_found = nil\n filter = Net::LDAP::Filter.eq( \"cn\", group_id)\n Net::LDAP.open(@ldap_conf) do |ldap|\n group_found = ldap.search(:base => @group_base, :filter => filter).to_a()[0]\n end\n group_found\n end",
"def get_group_by_name(name)\n @groups.each do |group|\n if group[0][\"name\"].downcase == name.downcase\n return group\n end\n end\n end",
"def group\n @group\n end",
"def new\n @group = Group.find(params[:group_id])\n @match = Match.clone_match_from_last_one(@group)\n \n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @match }\n end\n end",
"def create_group(group_name,group_uuid,classes = {},rule_term,parent_group)\n load_classifier\n groups = @classifier.groups\n @classifier.update_classes.update\n current_group = groups.get_groups.select { |group| group['name'] == group_name}\n if current_group.empty?\n cputs \"Creating #{group_name} group in classifier\"\n groups.create_group({\n 'name' => group_name,\n 'id' => group_uuid,\n 'classes' => classes,\n 'parent' => groups.get_group_id(\"#{parent_group}\"),\n 'rule' => rule_term\n })\n else\n cputs \"NODE GROUP #{group_name} ALREADY EXISTS!!! Skipping\"\n end\nend",
"def get group_identifier\n groups.fetch self.class.identifierize(group_identifier), nil\n end",
"def createGroupIfNotExistsFor(groupMapper)\n call :createGroupIfNotExistsFor, :groupMapper => groupMapper\n end",
"def retrieve_group\n @group = Group.find(params[:group_id])\n end",
"def new_group(name, sub_group_path = nil)\n group = project.new(PBXGroup)\n group.name = name\n\n target = find_subpath(sub_group_path, true)\n target.children << group\n group\n end",
"def new_group(name, sub_group_path = nil)\n group = project.new(PBXGroup)\n group.name = name\n\n target = find_subpath(sub_group_path, true)\n target.children << group\n group\n end",
"def group(name = nil)\n if name\n @groups << name\n self.class.groups[name] ||= []\n self.class.groups[name] << self\n else\n @groups\n end\n end",
"def find_or_create_node_group_model(options={})\n options[\"environment\"] ||= \"production\"\n if options[\"name\"] && existing = get_node_group_by_name(options[\"name\"], options[\"environment\"])\n replace_node_group_with_update_hash(existing, options)\n else\n create_new_node_group_model(options)\n end\n end",
"def create\n @group = Group.new(params[:group])\n @group.owner = current_user\n\n group_name_exists = false\n current_user.owned_groups.each do |g|\n if g.name == @group.name\n group_name_exists = true\n break\n end\n end\n \n respond_to do |format|\n if group_name_exists\n format.html { redirect_to groups_path, :alert => \"You already have a list by the name '#{@group.name}'.\" }\n format.json { render :json => @group, :status => :created, :location => @group }\n elsif @group.save\n format.html { redirect_to @group, :notice => 'Group was successfully created.' }\n format.json { render :json => @group, :status => :created, :location => @group }\n else\n error_msg = 'Unexpected error while creating group.'\n if @group.errors.messages.count > 0\n error_msg = 'Following error(s) prevented the group from being saved: '\n multiple = false\n @group.errors.full_messages.each do |msg|\n if multiple\n error_msg += ', '\n end\n error_msg += msg\n multiple = true\n end\n end\n format.html { redirect_to groups_path, :action => 'index', :alert => error_msg }\n format.json { render :json => @group.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create_group(group_node)\n name_ru = group_node.text.delete(\"0-9\")\n Group.create(name_ru: name_ru)\n end",
"def fetch_group\n @group = Group.find(params[:group_id])\n end",
"def get_single_group(group_id,include,opts={})\n query_param_keys = [\n :include\n ]\n\n form_param_keys = [\n \n ]\n\n # verify existence of params\n raise \"group_id is required\" if group_id.nil?\n raise \"include is required\" if include.nil?\n # set default values and merge with input\n options = underscored_merge_opts(opts,\n :group_id => group_id,\n :include => include\n )\n\n # resource path\n path = path_replace(\"/v1/groups/{group_id}\",\n :group_id => group_id)\n headers = nil\n form_params = select_params(options, form_param_keys)\n query_params = select_params(options, query_param_keys)\n if opts[:next_page]\n pagination_params = page_params_load(:get, path)\n query_params.merge! pagination_params if pagination_params\n end\n response = mixed_request(:get, path, query_params, form_params, headers)\n page_params_store(:get, path)\n Group.new(response)\n end",
"def create(*args)\n synchronize do\n begin\n create!(*args)\n rescue Exceptions::GroupAlreadyExistsError\n # ok, this is a little odd, if you call create! and it fails, semantically\n # in this method we're supposed to catch the exception and return. The problem\n # is that the @known_members and @last_stat won't have been set up. we want\n # both of these methods available, so we need to set that state up here, but\n # only if create! fails in this particular way\n @created = true\n broadcast_membership_change!\n nil\n end\n end\n end",
"def group\n nil\n end",
"def create\n ::ActiveRecord::Base.transaction do\n if group.save!\n membership = add_creator_as_group_admin!\n @side_effects << membership\n end\n end\n rescue ActiveRecord::RecordInvalid => _exception\n raise if group.valid?\n group\n end",
"def existing_ce_group\n self.refresh_access_token!\n\n response = @oauth_access_token.get(\n 'https://www.google.com/m8/feeds/groups/default/full?max-results=100000',\n {\n headers: {\n 'Content-type' => 'application/atom+xml',\n 'GData-Version' => '3.0'\n }\n }\n ).body\n\n doc = Nokogiri::XML(response)\n\n ids = doc.xpath('//atom:entry/atom:id', {'atom' => ATOM_NAMESPACE}).map do |e|\n e.content.split('/')[-1]\n end\n\n titles = doc.xpath('//atom:entry/atom:title', {'atom' => ATOM_NAMESPACE}).map do |e|\n e.content\n end\n\n entries = Hash[titles.zip(ids)]\n entries['Contact Exchange']\n end",
"def group\n return nil if item_type != 'group'\n direct_group\n end",
"def group_present(name)\n group_exists = false\n execute(\"dscacheutil -q group -a name #{name}\") do |result|\n group_exists = result.stdout.start_with?(\"name: #{name}\")\n end\n\n return if group_exists\n\n gid = gid_next\n create_cmd = \"dscl . create /Groups/#{name}\"\n create_cmd << \" && dscl . create /Groups/#{name} PrimaryGroupID #{gid}\"\n execute(create_cmd)\n end",
"def new\n @group = current_user.created_groups.new\n end",
"def guest_group\n Group.find(:first, :conditions => \"#{self.class.primary_key}=#{self.id} AND name='Guest'\")\n end",
"def group\n @group\n end",
"def get_group_by_id(id)\n $r.hgetall(\"group:#{id}\")\n end",
"def group(name)\n group = name if name.kind_of? Salticid::Group\n group ||= @salticid.group name\n group.hosts |= [self]\n @groups |= [group]\n group\n end",
"def group\n return @group\n end",
"def group\n return @group\n end",
"def create_target_group(groupname, title, description)\n params = { \":name\" => groupname }\n params[\"sakai:category\"] = \"group\"\n params[\"sakai:group-description\"] = description || \"\"\n params[\"sakai:group-id\"] = groupname\n params[\"sakai:group-title\"] = title || \"\"\n params[\"sakai:joinRole\"] = \"member\"\n params[\"sakai:roles\"] = '[{\"id\":\"member\",\"title\":\"Member\",\"allowManage\":false},{\"id\":\"manager\",\"title\":\"Manager\",\"allowManage\":true}]'\n params[\"sakai:templateid\"] = \"simplegroup\"\n response = @sling.execute_post(@sling.url_for($GROUP_URI), params)\n @log.info(\"create_target_group() for #{groupname} POST response code: #{response.code}\")\n @log.debug(\"create_target_group() for #{groupname} POST response body: #{response.body}\")\n @file_log.info(\"create_target_group() for #{groupname} POST response code: #{response.code}\") if (@file_log)\n @file_log.debug(\"create_target_group() for #{groupname} POST response body: #{response.body}\") if (@file_log)\n if (response.code.to_i > 299)\n @log.warn(\"create_target_group() returned #{response.code} group may already exist?\")\n @file_log.warn(\"create_target_group() returned #{response.code} group may already exist?\") if (@file_log)\n end\n group = Group.new(groupname)\n return group\n end",
"def create\n @group = Group.new(params[:group])\n if @group.save\n #@group.isGroupCreator(current_user.id) == 'true'\n render ('create')\n else\n render ('new')\n end\n end",
"def get_group(string); end",
"def create\n name = params[:name]\n @group = Group.new(name: name)\n @group.creator_id = @current_user.id\n if @group.save\n @current_user.creator_join!(@group)\n respond_with(@group, only: [:id, :name, :creator_id, :admin_id])\n else\n render_error(404, request.path, 20101, @group.errors.as_json)\n end\n end",
"def create #:nodoc:\n @group = Group.new(params[:group])\n\n respond_to do |format|\n if @group.save\n flash[:notice] = I18n.t(\"{{value}} was successfully created.\", :default => \"{{value}} was successfully created.\", :value => I18n.t(\"Group\", :default => \"Group\"))\n if params[:create_and_new_button]\n format.html { redirect_to new_group_url }\n else\n format.html { redirect_to groups_url }\n # format.xml { render :xml => @group, :status => :created, :location => @group }\n end\n else\n format.html { render :action => \"new\" }\n # format.xml { render :xml => @group.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def group_from_string(group_path = :root)\n # Get the context group\n if group_path == '' or group_path == :root then\n group = @db.root\n elsif group_path == :inbox then\n group = @db.incomingGroup\n elsif group_path == :tags then\n group = @db.tagsGroup\n else\n group = @devonthink.getRecordAt_in_(group_path, @db)\n end\n raise \"No group with path: #{group_path}\" unless group\n\n return group\n end",
"def support_group\n support_group = Group.new(:name => 'Support')\n support_contact = Contact.new(:name => 'Email us for more help or suggestions.', :email => 'name@example.com') #TODO put in real e-mail/etc.\n #support_contact.group = support_group\n support_group.contacts << support_contact\n support_group\n end",
"def create\n @group = Group.new(params[:group])\n\n if @group.save\n flash[:notice] = t('flash_msg46')\n @groups = Group.all\n else\n @error = true\n end\n end",
"def new_group(key)\n []\n end",
"def <<(group) \n @groups[group.name] = group\n end",
"def add_ce_group\n self.refresh_access_token!\n\n haml_template = File.read(File.join(TEMPLATES_DIR, 'group.xml.haml'))\n request_body = Haml::Engine.new(haml_template, remove_whitespace: true).render(Object.new)\n\n @response = @oauth_access_token.post(\n 'https://www.google.com/m8/feeds/groups/default/full',\n {\n body: request_body,\n headers: {\n 'Content-type' => 'application/atom+xml',\n 'GData-Version' => '3.0'\n }\n }\n )\n\n group_id = GROUP_REGEX.match(@response.body)[1]\n\n @response.status == 201 ? group_id : nil\n end",
"def create\n entity = Entity.find_by(id: group_params[:entity_id]) || not_found\n group = Group.new(\n group_name: \"#{entity.entity_name} Group\",\n entity_id: group_params[:entity_id],\n creator_id: current_user.id\n )\n if group.save\n group.entity.seatgeek_import if group.events.future.empty?\n group.join_group current_user, 'admin'\n flash.keep\n flash[:notice] = 'Group created!'\n redirect_to action: 'show', id: group.id\n else\n flash.keep\n flash[:error] = 'Group could not be created.'\n redirect_to action: 'new', entity_id: params[:entity_id]\n end\n end",
"def new\n @group = current_user.groups.new\n end",
"def create\n create_params = params_for_create\n\n if group_exists?(create_params[:name])\n render_error_with_message(t('controllers.api.v1.groups.group_found'), :bad_request)\n return\n end\n\n group = @project.groups.new(name: create_params[:name])\n errors = update_article_groups(group, create_params)\n if errors\n render_errors(errors)\n return\n end\n\n respond_with @project do |format|\n format.json { render json: decorate_group(group) }\n end\n end",
"def group(base_name)\n entry = domain(base_name).bind\n return unless entry\n\n load_group(entry)\n end",
"def get_instances(group)\n raise \"unknown group: #{group}\" if !@groups.key? group\n @groups[group].dup\n end",
"def group_new(name, client_id = nil)\n args = { :user => self, :name => name }\n args[:client_id] = client_id unless client_id.nil?\n return CakeMail::Group.create(args)\n end",
"def group_for_id(id)\n find_groups if @groups.nil?\n @groups.detect { |g| g.include? id }\n end",
"def create\n if params[:member_id].nil?\n @group = Group.new(params[:group])\n respond_to do |format|\n if @group.save\n flash[:notice] = 'Group was successfully created.'\n format.html { redirect_to(@group) }\n format.xml { render :xml => @group, :status => :created, :location => @group }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @group.errors, :status => :unprocessable_entity }\n end\n end\n else\n # Add member to an group.\n # POST /members/:member_id/groups\n RAILS_DEFAULT_LOGGER.debug(\"Add member #{params[:member_id]} to group #{params[:post][:group_id]}.\")\n @member = Member.find(params[:member_id])\n @member.group << Group.find(params[:post][:group_id])\n\n respond_to do |format|\n flash[:notice] = 'Group was successfully added.'\n format.html { redirect_to(@member) }\n format.xml { render :xml => @member, :status => :created, :location => @member }\n end\n end\n end",
"def createGroup(groupName, gid)\r\n uri = sprintf(\"/api/v1/group_categories/%d/groups\", gid) \r\n \r\n dbg(\"POST #{uri}\")\r\n dbg(\"name=#{groupName}\")\r\n newGroup = $canvas.post(uri, {'name' => groupName})\r\n dbg(newGroup)\r\n return newGroup\r\nend",
"def createGroup(groupName, gid)\r\n uri = sprintf(\"/api/v1/group_categories/%d/groups\", gid) \r\n \r\n dbg(\"POST #{uri}\")\r\n dbg(\"name=#{groupName}\")\r\n newGroup = $canvas.post(uri, {'name' => groupName})\r\n dbg(newGroup)\r\n return newGroup\r\nend",
"def create\n @group = @current_user.create_group(params[:group])\n # @group = @current_user.groups.build(params[:group])\n # @group = Group.new(params[:group])\n\n respond_to do |format|\n if @group.valid?\n format.html { redirect_to circle_groups_path, notice: 'Group was successfully created.' }\n format.json { render json: @group, status: :created, location: @group }\n else\n format.html { render action: \"new\" }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def get_group_by_id(id)\n get(\"/groups/#{id}\")\n end",
"def primary_group\n # @primary_group ||= Group.find_by_objectsid(primary_group_sid)\n @primary_group ||= self.class.group_klass\n .find_by_objectsid(primary_group_sid)\n end",
"def group\n nil\n end"
] |
[
"0.77750725",
"0.7636884",
"0.7586702",
"0.7051282",
"0.7011853",
"0.6918788",
"0.6911392",
"0.6824593",
"0.66583335",
"0.6640229",
"0.65873617",
"0.652099",
"0.652099",
"0.652099",
"0.652099",
"0.652099",
"0.6519217",
"0.6499652",
"0.64856726",
"0.6478147",
"0.64704424",
"0.64689875",
"0.6458536",
"0.64431524",
"0.6435889",
"0.6391798",
"0.6377313",
"0.63765204",
"0.63739514",
"0.63011503",
"0.62608105",
"0.6259856",
"0.62515026",
"0.624545",
"0.62316805",
"0.6215164",
"0.6211971",
"0.62079316",
"0.62004787",
"0.61916393",
"0.6184504",
"0.6167175",
"0.61666083",
"0.61660147",
"0.6164182",
"0.6153685",
"0.61447024",
"0.6125508",
"0.61157846",
"0.6115632",
"0.61140364",
"0.61135656",
"0.610816",
"0.608764",
"0.6084468",
"0.6084468",
"0.6077013",
"0.60653365",
"0.6063935",
"0.60618454",
"0.603749",
"0.6023166",
"0.6007001",
"0.59942126",
"0.5990987",
"0.5985258",
"0.5981614",
"0.597643",
"0.59758395",
"0.59697187",
"0.5967927",
"0.5961768",
"0.5949782",
"0.59494513",
"0.59494513",
"0.5945301",
"0.59333694",
"0.59315515",
"0.5922043",
"0.59143555",
"0.5910357",
"0.5907719",
"0.59075695",
"0.59016716",
"0.5901099",
"0.5890985",
"0.5882876",
"0.5882065",
"0.58794445",
"0.58785653",
"0.5873861",
"0.5871418",
"0.58708876",
"0.5861978",
"0.58605564",
"0.58605564",
"0.58583015",
"0.5855792",
"0.5854583",
"0.58523285"
] |
0.68601763
|
7
|
D: Read each line of an object file exported with 3d party software for loading into OpenGL draw methods. D:
|
def process_line( key, values, line_string)
case key
#---------------------------------------------------------
# List of geometric vertices, with (x, y, z [,w]) coordinates,
# w is optional and defaults to 1.0.
when "v"
values.collect! { |v| v.to_f }
@vertex.push( values )
#---------------------------------------------------------
# List of vertex normals in (x,y,z) form; normals might not be unit vectors.
# https://en.wikipedia.org/wiki/Normal_(geometry)
when "vn"
values.collect! { |v| v.to_f }
@normal.push( values )
#---------------------------------------------------------
# List of texture coordinates, in (u, [v ,w]) coordinates, these
# will vary between 0 and 1, v and w are optional and default to 0.
when "vt"
values.collect! { |v| v.to_f }
values = values[0..1]
#values.size.times do |index|
# values[index] *= -1.0 # inverse Y cord in texture file?
#end
@texcoord.push( values ) # u and v
puts("Texture pos: [#{values.join(', ')}] From: \'#{line_string}\'") if DEBUGGING
#---------------------------------------------------------
# Named objects and polygon groups.
when "o"
@objects << values.first
#---------------------------------------------------------
# Polygon group names.
when "g", "group"
if values.length == 0
# p "anonymous group detected. treat as \"default\"."
@current_group = get_group( "default" )
else
# Only the first group is adopted even if there are multiple group names on the line.
@current_group = get_group( values[0] )
end
@current_group.mtl_name = @current_material_name
#---------------------------------------------------------
# Smooth shading across polygons? * can also mark shader groups with int value *
when "s"
setting = values.first # convert into boolean
@smooth_shading = setting.include?('on') or setting.include?('true')
#---------------------------------------------------------
# Polygonal face element, these can be packaged in a number of ways.
# index is offset to start drawing at tile index 0, hense minus 1
when "f"
vertex_count = values.length
case values[0]
when /\d+\/\d+\/\d+/ # v/vt/vn
face = Face.new( vertex_count )
print("Face: ") if DEBUGGING
values.each_with_index do |value, i|
v, vt, vn = value.split( '/' )
face.vtx_index[i] = v.to_i - 1
face.tex_index[i] = vt.to_i - 1
face.nrm_index[i] = vn.to_i - 1
print("[#{face.vtx_index[i]}, #{face.tex_index[i]}, #{face.nrm_index[i]}] ") if DEBUGGING
end
# --------------------------------------
when /\d+\/\/\d+/ # v//vn
face = Face.new( vertex_count )
print("Face: ") if DEBUGGING
values.each_with_index do |value, i|
v, vn = value.split( '//' )
face.vtx_index[i] = v.to_i - 1
face.nrm_index[i] = vn.to_i - 1
print("[#{face.vtx_index[i]}, #{face.nrm_index[i]}] ") if DEBUGGING
end
# --------------------------------------
when /\d+\/\d+/ # v/vt
face = Face.new( vertex_count )
print("Face: ") if DEBUGGING
values.each_with_index do |value, i|
v, vt = value.split( '/' )
face.vtx_index[i] = v.to_i - 1
face.tex_index[i] = vt.to_i - 1
print("[#{face.vtx_index[i]}, #{face.tex_index[i]}] ") if DEBUGGING
end
# --------------------------------------
when /\d+/ # v
face = Face.new( vertex_count )
print("Face: ") if DEBUGGING
values.each_with_index do |value, i|
face.vtx_index[i] = value.to_i - 1
print("[#{face.vtx_index[i]}] ") if DEBUGGING
end
# --------------------------------------
else
p "unknown face format detected."
end
@current_group.faces.push( face )
@current_group.face_index.push( @current_group.faces.length - 1 )
puts("") if DEBUGGING
#---------------------------------------------------------
when /^\#+/, nil
#puts "comment or empty line."
#---------------------------------------------------------
# The .mtl file may contain one or more named material definitions.
when "mtllib"
# https://en.wikipedia.org/wiki/Materials_system
# https://en.wikipedia.org/wiki/Wavefront_.obj_file#Material_template_library
@material_lib = MaterialLibrary.new(values.first)
#---------------------------------------------------------
# The material name matches a named material definition in an external .mtl file.
when "usemtl"
@current_materials << values.first
#---------------------------------------------------------
else
puts " -Unsupported .obj token #{key} given. Ignored."
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def parse_file\n filename = full_path_from_edict_file(@config[\"filename\"])\n ### Get all the line into memory\n file_obj = File.new(filename, \"r\")\n file_obj.each do |line|\n @added_lines.push line\n end\n end",
"def parse\n wo_lines = IO.readlines( @file_dir )\n @current_group = get_group( \"default\" )\n @current_material_name = \"default\"\n puts(\"+Loading .obj file:\\n \\\"#{@file_dir.sub(ROOT, '')}\\\"\") if @verbose\n # parse file context\n wo_lines.each do |line|\n tokens = line.split\n # make sense of the object tokens\n string = line.sub(\"\\r\", \"\")\n process_line(tokens[0], tokens[1..tokens.length-1], string.sub(\"\\n\", \"\"))\n end\n @object_name = @file_dir.split('/').last\n @object_name.sub!(\".obj\", '')\n # verbose status updates\n puts(\"+Object name is \\\"#{@object_name}\\\" with (#{@objects.size}) Internal Objects.\") if @verbose\n if get_group(\"default\").faces.empty?\n @groups.delete(\"default\")\n end\n @current_group = nil\n @current_material_name = nil\n end",
"def read_contents\n\n #puts \"pofr file #{@file_blob.filename}\"\n\n file_lines=[]\n @file_blob.open do |file|\n File.open(file){|x| file_lines = x.readlines}\n puts file_lines[0]\n puts file_lines.last\n end\n\n if @file_blob.filename.extension == \"out\" # GNOM\n getDataLinesFromGnom(file_lines)\n elsif @file_blob.filename.extension == \"dat\" # scatter\n puts \"reading file @file #{@file_blob.filename}\"\n getDataLinesFromScatter(file_lines)\n end\n\n @dmax = @r_values.last\n @pr_values.each do |y|\n @pr_max = (y[1] > @pr_max) ? y[1] : @pr_max\n @pr_min = (y[1] < @pr_min) ? y[1] : @pr_min\n end\n\n end",
"def read_objects(file, objects)\n objects.each do |data_type|\n num = DataNumber.new.read(file).data\n\n # use i to indentify the type of object.\n num.times do ||\n _obj = data_type.new.read(file)\n end\n end\n end",
"def import_next_object(f, order)\n f_size = read_word(f)\n f_type = read_word(f)\n f_data = f.read(f_size - 4)\n frag = Fragment.create! order: order, orig_data: f_data, scenario_id: id, f_type: f_type, size: f_size\n f_type == 16 ? create_line(frag) : 0\n end",
"def use_wavefrontOBJ_loader\n # nest the object file, keeps the directory cleaner this way.\n @file_dir = File.join(ROOT, \"Media/3dModels/#{@obj_filename}/#{@obj_filename}.obj\") rescue nil\n unless FileTest.exists?(@file_dir)\n puts(\"Mesh Loader Error: Could not find 3D object (#{@obj_filename}) source file.\\n #{@file_dir}\")\n #throw Error.new() \n #exit\n return nil\n end\n #---------------------------------------------------------\n # module that manages loading of 3d objects.\n options = {:object_name => @obj_filename, :verbose => @verbose}\n @object_model = WavefrontOBJ::Model.new(options) rescue nil\n if @object_model.nil?\n puts(\"Failed to load model data for: (#{@obj_filename})\")\n self.destroy # mark self for clean up from object container in map\n return nil\n end\n # seperated to allow for load steping for larger object groups...\n @object_model.setup() # create draw recording array\n # confirm creaion, get some details about the object.\n @object_name = @object_model.object_name\n @face_count = @object_model.get_face_count\n end",
"def load_dataE(filename)\r\n Log.ger.debug('Read '+filename)\r\n File.open(filename, \"rb\") { |f|\r\n obj = Marshal.load(f)\r\n }\r\nend",
"def import\n fragments.each(&:destroy)\n File.open(bin_file_name, \"rb\") do |f|\n order = 0\n new_lines = 0\n until f.eof?\n new_lines += import_next_object(f, order)\n order += 1\n end\n update! lines: new_lines\n end\n add_locations\n end",
"def openFile(folder, arquive)\n file = File.open(folder+\"/\"+arquive+\".txt\",\"r\")\n @dataLines=file.read\n file.close\n @vectorLines = split_input(@dataLines, \"\\n\")\n end",
"def read_points(points_file)\n points = []\n\n File.open \"../../samples/\" << points_file do |file|\n file.each_line do |line|\n coordinates = line.split(' ').map { |x| x.to_f }\n points << Geometry::Point.new(coordinates[0], coordinates[1])\n end\n end\n points\nend",
"def load_obj_file\n if self.use_wavefrontOBJ_loader() == nil\n # there was an issue loading the object data, dont bother with the image file.\n return nil\n end\n # save the @texture refrence as its refered to later and you dont want to loose the refrence object.\n if @obj_filename != @texture_file\n file = \"Media/Textures/#{@texture_file}.png\"\n else # nest the object file, keeps the directory cleaner this way.\n file = \"Media/3dModels/#{@texture_file}/#{@texture_file}.png\"\n end\n file_dir = File.join(ROOT, file)\n image = Gosu::Image.new(file_dir, retro: true) rescue nil\n if image.nil?\n puts(\"Texture image file was not found for: #{file_dir}\")\n unless TEXTURE_DEBUG\n exit\n else\n return true\n end\n end\n @texture = Yume::Texture.new(image)\n puts(\"Using local 3D object file texture setting:\\n \\\"#{file}\\\"\")\n #--------------------------------------\n # https://www.rubydoc.info/github/gosu/gosu/master/Gosu/Image#gl_tex_info-instance_method\n # @tex_info = @texture.gl_tex_info # helper structure that contains image data\n # not very reliably held to tho, needs a proper class object formater to load images as textures.\n return true # success\n end",
"def read_ld_output_file(ldfile)\n snp_lds = Array.new\n\n begin\n File.open(ldfile, \"r\") do |file|\n file.each_line do |oline|\n oline.each_line(\"\\r\") do |line|\n next if line =~ /^\\n$/\n if line =~ /LOD/\n next\n end\n\n data=strip_and_split(line) \n snp_lds << SNPCombination.new(data[0], data[1], data[2], data[3], data[4])\n end\n end\n end\n rescue StandardError => e\n puts e\n exit(1)\n end\n return snp_lds\n\n end",
"def do_it_lines\n open(file_name).each {|x| p x; }\n end",
"def initialize(filename)\n\t\tbegin\n @sourcefile = filename\n \n\t\t\tFile.open(filename, \"r\") do |objfile|\n\t\t\t\tunless getl(objfile) == \"LINK\"\n\t\t\t\t\tputs \"Invalid file format: \" + filename\n\t\t\t\t\treturn nil\n\t\t\t\tend\n\n\t\t\t\t# Read header info\n\t\t\t\t@nsegs, @nsyms, @nrlocs = getl(objfile).split(' ').collect {|x| x.to_i}\n\t\t\t\t\n\t\t\t\t# Parse segs\n\t\t\t\t@segrecs = [], @segnames = {}\n\t\t\t\tgather_segs(objfile)\n\t\t\t\t\n\t\t\t\t# Parse symbols\n\t\t\t\t@symrecs = [], @symnames = {}\n\t\t\t\tgather_syms(objfile)\n\t\t\t\t\n\t\t\t\t# Parse relocations\n\t\t\t\t@rlocrecs = []\n\t\t\t\tgather_rlocs(objfile)\n\t\t\t\t\n\t\t\t\t# Slurp in data\n\t\t\t\t@segrecs.select {|seg| /P/===seg[:type]}.each do |seg|\n\t\t\t\t\tseg[:data] = getl(objfile).hex2bin\n\t\t\t\tend\n\n\t\t\tend\n\t\trescue\n\t\t\tputs \"Could not open object file: \" + filename\n\t\tend\n\tend",
"def process_externals_lines\n File.open(file_name, \"r\") do |f|\n #File.open(\"./lib/externals/externals_table_data_input_lines.txt\", \"r\") do |f|\n f.each_line do |line|\n puts line.to_textual\n sleep(0.01)\n end\n end\n end",
"def load_objects\n @objects.each do |obj|\n case obj[:type]\n when :sphere\n draw_sphere(obj[:radius], obj[:point])\n when :text\n draw_text(obj[:text], obj[:point])\n when :point\n draw_point(obj[:point])\n end\n end\n end",
"def load_file (filename)\n @name = nil\n File.open(filename, mode: 'r').each do |ln|\n flds = ln.split(',')\n if !@name\n @name = flds[0]\n end\n dts = flds[1];\n @obvs << \"#{dts[2..3]}-#{dts[4..5]}-#{dts[6..7]}\"\n @values << flds[2].to_f\n end\n #puts \"load_file: #{@values.size}\"\n end",
"def get_lines(filename); end",
"def process_input_file file_name\n\tFile.open(file_name, \"r\").each_line do |line|\n\t\tobj=MerchantGuideToGalaxy.new(line)\n\t\tobj.compute_line\n\tend\nend",
"def load(handle, args={})\n File.open(handle) do |handle|\n db = DnaIO.new handle\n db.each do |record|\n self.add(record.sequence, record.name)\n end\n end\n end",
"def load_rewind_batch_lines\n @options = @text.rewind_batch.to_braille.lines.map { |l| l.to_text }\n @line_index = @options.size\n end",
"def import_ori(file_path)\n string = IO.read(file_path)\n array = string.split(\"\\n\")\n array.shift\n return array\n end",
"def loop_over_asset_lines(file_name)\n line_count = 0\n puts \"Loading #{file_name}\"\n batch_size = 25000\n File.open(file_name) do |file|\n file.each_slice(batch_size) do |lines|\n line_count += lines.length\n Parallel.each(lines, in_processes: 8) do |line|\n asset_json = FastJsonparser.parse(line, symbolize_keys: false)\n AssetRouter.new(asset_json, @import_id, @db)\n line_count += 1\n end\n end\n end\n\n puts \"\\n\\nDone loading #{file_name}. (#{line_count} lines)\"\n end",
"def load_data\n self.open if @io.nil?\n @lines = @io.readlines\n @io.rewind\n @lines.delete_if {|line| line.match(/^\\s*$/)}\n @num_lines = @lines.count\n end",
"def readlines(*several_variants)\n #This is a stub, used for indexing\n end",
"def read filename\n # Open file, Read in and process data.\n file = File.open(filename)\n file.each do |line|\n # Comma seperated data.\n # E.g. 1,2,1 => x=1, y=2, output=1\n line = line.chomp\n if line.size > 0\n # If the line is not empty, then it has data\n line = line.split \",\"\n @x << line[0].to_i\n @y << line[1].to_i\n @output << line[2].to_i\n end\n end\n end",
"def lines(source); end",
"def parse\n # TODO: Try to convert lsynth parts, maybe flag parts that are troublesome for manual editing,\n # look up to see if I've stored a conversion from ldraw ID to Bricklink ID,\n # convert Ldraw color IDs to BL color IDs, etc.\n parts = {}\n temp_parts = []\n\n @lines.each_with_index do |line, i|\n # This will stop getting parts for the base model once a submodel is reached\n break if line.match(/0 FILE/) && i > 15\n\n @submodels << line.match(/\\w+\\.ldr/).to_s.downcase if line.match(/^1/) && line.match(/\\.ldr$/)\n @lsynthed_parts << line.gsub('0 SYNTH BEGIN', '').split if line =~ /^0 SYNTH BEGIN/\n next unless line.match(/^1/) && line.match(/.dat$/)\n\n part = line.match(/\\w+\\.dat/).to_s.gsub!('.dat', '')\n next if lsynth_part?(part)\n\n color = line.match(/^1\\s\\d+/).to_s.gsub!('1 ', '')\n bl_part = get_bl_part_number(part)\n temp_parts << [bl_part, color, part]\n end\n\n # Now go through all submodels to determine the parts belonging to the submodels\n temp_parts = handle_submodels(temp_parts)\n\n # Not yet functional\n # handle_lsynthed_parts(temp_parts)\n\n temp_parts.each do |info|\n if parts.key?(\"#{info[0]}_#{info[1]}\")\n parts[\"#{info[0]}_#{info[1]}\"]['quantity'] += 1\n else\n parts[\"#{info[0]}_#{info[1]}\"] = {}\n parts[\"#{info[0]}_#{info[1]}\"]['quantity'] = 1\n parts[\"#{info[0]}_#{info[1]}\"]['ldraw_part_num'] = info[2]\n end\n end\n\n parts\n end",
"def load_xy_file(filename)\n xy_data = Array.new\n File.open(filename, \"r\") do |xy_file|\n xy_file.each_line do |line|\n x, y = line.split(' ')\n xy_data << [ string_to_number(x), string_to_number(y) ] \n end\n end\n xy_data\n end",
"def load_lines file\n\n\t\tlines = Array.new\n\t\tlines = @file.split(\"\\n\")\n\n\t\t#fuck that, i dont like the dyanmic feed, just pre-parse it\n\t\tlines.map! do |line| #map overwrites the old array\n\t\t\tif line.include? '#'\n\t\t\t\tsplit = line.split '#'\n\t\t\t\t#puts split.to_s\n\t\t\t\tsplit.shift\n\t\t\telse\n\t\t\t\tline\n\t\t\tend\n\t\tend\n\n\t\t#removing blank lines\n\t\tlines.delete_if do |line|\n\t\t\ttrue if line.empty?\n\t\tend\n\n\t\tlines.each { |line| line.chomp! }\n\n\t\tlines\n\tend",
"def readObject\n raise NotImplementedError, <<-STR\n\n \\e[91m\n I'm afraid this might not work.\n > you need access to the original class definitions (and a)\n > Java runtime to load them into) to turn the stream data back\n > something approaching the original objects.\n \\e[0m\n STR\n end",
"def attempt_load_world_from_file\n return if state.world # return if the world collection is already populated\n state.world ||= [] # initialized as an empty collection\n exported_world = gtk.read_file(MAP_FILE_PATH) # reads the file using the path mentioned at top of code\n return unless exported_world # return unless the file read was successful\n state.world = exported_world.each_line.map do |l| # perform action on each line of exported_world\n l.split(',').map(&:to_i) # calls split using ',' as a delimiter, and invokes .map on the collection,\n # calling to_i (converts to integers) on each element\n end\n end",
"def read_data(file_name)\n file = File.open(file_name,\"r\")\n object = eval(file.gets)\n file.close()\n return object\nend",
"def from_file line\n\t\tvals = line.split(\"-\")\n\t\t@type = vals[0].to_i\n\t\t@obj = vals[1]\n\t\tif vals[2] != nil\n\t\t\t@sensor = vals[2]\n\t\tend\n\t\tif vals[3] != nil\n\t\t\t@value = vals[3].to_f\n\t\tend\n\tend",
"def write_obj_file output_path\n File.open(output_path, 'w') do |f|\n @vbuffer.each_triple do |a,b,c|\n f.puts \"v #{a} #{b} #{c}\"\n end\n @vnbuffer.each_triple do |a,b,c|\n f.puts \"vn #{a} #{b} #{c}\"\n end\n @fbuffer.each_triple do |a,b,c|\n f.puts \"f #{a+1}//#{a+1} #{b+1}//#{b+1} #{c+1}//#{c+1}\"\n end\n end\n self\n end",
"def import_a_igcfile(file)\n\n columns = [ :lat_lon, :baro_alt, :gps_alt, :enl, :seq_secs, :igcfile_id, :rlat, :rlon, :x, :y]\n options = { :validate => false }\n save_obj=Hash.new\n sma=[]\n\n objects = []\n num_recs=1 # to prevent divide by zero\n counter=0\n\n begin\n igcfile = Igcfile.new()\n igcfile.filename=file\n igcfile.save!\n rescue\n next\n end\n\n start = Time.now\n\n # I033638FXA3941ENL4247REX an I record defines B record extensions\n counter=0\n time=0\n fp = File.open(file, \"r\")\n contents = fp.read\n\n # get I record\n b_extensions2 = Hash.new\n contents.each_line do |line|\n a=line.unpack('a1a2a7a7a7a7a7a7a7') # hopefully enough\n if a[0]=='A'\n next\n end\n if a[0]=='H'\n next\n end\n if a[0]=='I'\n if not a[1].nil?\n 0.upto(a[1].to_i){|n|\n b=a[n+2].unpack('a2a2a3')\n b_extensions2[b[2]]={:start => b[0], :finnish => b[1]}\n }\n end\n break\n end\n break\n end\n\n if b_extensions2.length == 0\n puts 'No I record'\n end\n\n if b_extensions2['ENL'].nil?\n puts 'No ENL in I record'\n else\n # puts b_extensions2['ENL'].inspect\n end\n\n # last_time=0\n contents.each_line do |line|\n # 0(1)=rec, 1(6)=time, 2(8)=lat, 3(9)=lon, 4(1)=validity, 5(5)=baro_alt, 6(5)=gps_alt\n # optional see Irec 7(3)=fix_accuracy, 8(2)=num_satelites, 9(3)=enl\n\n a=line.unpack('a1a6a8a9a1a5a5a')\n if a[0].to_s == 'B'\n\n num_recs=num_recs+1\n\n # time B0915235535648N01340869EA-006900049000\n h,m,s = a[1].scan(%r{(\\d{2})(\\d{2})(\\d{2})}).flatten\n time = h.to_i * 3600 + m.to_i * 60 + s.to_i\n # if last_time==0\n # last_time=time\n # end\n\n # enl\n if hv=b_extensions2['ENL']\n enl=line[hv[:start].to_i..hv[:finnish].to_i]\n else\n enl='0'\n end\n\n dd,mm,mmm,ns = a[2].scan(%r{(\\d{2})(\\d{2})(\\d{3})(\\w{1})}).flatten #Latitude DDMMMMMN Valid characters N, S, 0-9\n rlat = ((dd.to_f + mm.to_f/60 + (mmm.to_f/1000)/60))*RAD_PER_DEG\n rlat = - rlat unless ns=='N'\n\n ddd,mm,mmm,ew = a[3].scan(%r{(\\d{3})(\\d{2})(\\d{3})(\\w{1})}).flatten #Longitude DDDMMMMME Valid characters E,W, 0-9\n rlon = ((ddd.to_f + mm.to_f/60 + (mmm.to_f/1000)/60))*RAD_PER_DEG\n rlon = - rlon unless ew=='E'\n\n # cartesian\n x = (RADIUS * Math.cos(rlat) * Math.cos(rlon)).to_i\n y = (RADIUS * Math.cos(rlat) * Math.sin(rlon)).to_i\n\n #columns = [ :lat_lon, :baro_alt, :gps_alt, :enl, :seq_secs, :igcfile_id, :rlat, :rlon, :x, :y]\n #objects << [ a[2]+','+a[3],a[5].to_i,a[6].to_i,enl.to_i, time, igcfile.id,rlat,rlon,x.to_i,y.to_i]\n obj = { :lat_lon => a[2]+','+a[3], :baro_alt => a[5].to_i, :gps_alt => a[6].to_i,\n :enl => enl.to_i, :seq_secs => time, :igcfile_id => igcfile.id, :rlat => rlat, :rlon => rlon,\n :x => x, :y => y}\n\n if not save_obj.empty?\n #puts \"one time\"\n\n #speed\n obj[:ms] = (((obj[:x] - save_obj[:x])**2 + (obj[:y] - save_obj[:y])**2)**0.5)/(obj[:seq_secs] - save_obj[:seq_secs])\n #obj[:ms] = (obj[:seq_secs] - save_obj[:seq_secs])\n #obj[:ms] = (obj[:seq_secs] - save_obj[:seq_secs])\n # if obj[:ms] == 0\n # puts obj[:ms]\n # end\n # energy change\n obj[:pe] = GLIDER_MASS * GRAV_CONST * (obj[:baro_alt] )\n #obj[:pe] = GLIDER_MASS * GRAV_CONST * (obj[:baro_alt] + Polar_sink[obj[:ms]] * (obj[:seq_secs] - save_obj[:seq_secs]))\n obj[:ke] = 0.5 * GLIDER_MASS * (obj[:ms])**2 # should compensate speed for wind component here\n #obj[:te]= obj[:ke] + obj[:pe]\n obj[:dedt]=((obj[:pe] - save_obj[:pe]) + (obj[:ke] - save_obj[:ke])) / (obj[:seq_secs] - save_obj[:seq_secs])\n\n\n #moving average speed in 2 dimnsions. could be moved out of this loop\n max=0\n may=0\n avg_cnt=0\n objects.reverse_each {|item|\n break if item[:seq_secs] < obj[:seq_secs]-30\n avg_cnt+=1\n max=max+item[:x]\n may=may+item[:y]\n }\n\n if avg_cnt > 0\n obj[:max]=(max/avg_cnt).to_i\n obj[:may]=(may/avg_cnt).to_i\n else\n obj[:max]=obj[:x]\n obj[:may]=obj[:y]\n end\n\n obj[:mams] = (((obj[:max] - save_obj[:max])**2 + (obj[:may] - save_obj[:may])**2)**0.5)/(obj[:seq_secs] - save_obj[:seq_secs]).to_i\n #obj[:mams] = (obj[:seq_secs] - save_obj[:seq_secs]) * 100\n # if obj[:mams] == 0\n # obj[:mams]=10\n # else\n # end\n #obj[:mams] = save_obj[:seq_secs]\n #obj[:mams]=0\n\n objects << obj\n else\n obj[:ms]=0\n obj[:pe]=0\n obj[:ke]=0\n obj[:max]=obj[:x]\n obj[:may]=obj[:y]\n end\n\n save_obj=obj\n end\n end\n\n #\n objects.each_with_index do |object,index|\n\n avg_cnt=0\n objects[0..index].reverse_each {|item|\n break if item[:seq_secs] < object[:seq_secs]-40\n avg_cnt+=1\n\n # te = (object[:te] - save_obj[:te]) unless save_obj[:te].nil?\n # tt = (object[:seq_secs] - save_obj[:seq_secs]) unless save_obj[:seq_secs].nil?\n # dedt = te/tt - ()\n\n # max=max+item[:x]\n # may=may+item[:y]\n }\n\n # if avg_cnt > 0\n # obj[:max]=(max/avg_cnt).to_i\n # obj[:may]=(may/avg_cnt).to_i\n # obj[:mams] = (((obj[:max] - item[:max])**2 + (obj[:may] - item[:may])**2)**0.5)/(obj[:seq_secs] -item[:seq_secs]).to_i\n # else\n # obj[:mams]=0\n # #obj[:max]=obj[:x]\n # #obj[:may]=obj[:y]\n # end\n # the import bogs down if there are too many records so chop it up\n counter=counter+1\n # if counter > 100\n # Igcpoint.import(columns, objects, options)\n # objects=[]\n # counter=0\n # end\n end\n\n ary = []\n objects.each do |obj|\n ary << [ obj[:lat_lon], obj[:baro_alt], obj[:dedt], obj[:enl], obj[:seq_secs], obj[:igcfile_id], obj[:rlat], obj[:rlon], obj[:x], obj[:y]]\n #ary << [ obj[:lat_lon], obj[:baro_alt], obj[:gps_alt], obj[:enl], obj[:seq_secs], obj[:igcfile_id], obj[:rlat], obj[:rlon], obj[:x], obj[:y]]\n end\n\n Igcpoint.import(columns, ary, options) unless ary.length==0\n secs = Time.now - start\n puts file.to_s + ' ' + num_recs.to_s + ' ' + (num_recs/secs).to_i.to_s\n STDOUT.flush\n\n fp.close\n num_recs\n end",
"def load file='GOL.sav'\n self.state=File.open(file,'r') do |f|\n Marshal.load(f)\n end\n end",
"def code2file(_objects_file = nil)\n @filename = _objects_file\n if !@filename\n exit\n end\n\n File.open(_objects_file, \"w\") do |aFile|\n aFile.print @renderer.code\n end\n end",
"def load_data(filename)\n if File.exist? filename\n line_num = 0\n File.foreach (filename) do |line|\n line_num += 1\n line = line.chomp.to_i\n if line_num == 1\n @number_of_vertices = line \n else\n @weights << line\n end\n end\n end\n end",
"def lines; end",
"def lines; end",
"def loadArray\n clearScreen\n @boxGoalCoord=[]\n @levelArr=[]\n\n lineCount=0\n #open the file and make each line an element in the 2d array @levelArr\n File.readlines(\"./levels/level#{@levelNo}.xsb\").each do |line|\n #initialize the subarray 'charArr'\n charArr=[]\n\n xCount=1\n line.each_char do |char|\n #push new element to the array subarray 'charArr'\n if char=='.'\n @boxGoalCoord.push(\"#{xCount},#{lineCount}\")\n end\n charArr.push(char)\n xCount+=1\n end\n #add the sub array 'charArr' to the whole file array 'fileArr'\n @levelArr.push(charArr)\n lineCount+=1\n end\nend",
"def load_data(filename)\n if File.exist? filename\n File.foreach (filename) do |line|\n line = line.chomp.split(\" \").map(&:to_i)\n if line.length == 1\n @num_vertices = line[0]\n next\n else\n @edges << [line[2], line[0], line[1]]\n if !@groups[line[0]]\n @groups[line[0]] = [line[0]]\n @leader_pointers[line[0]] = line[0]\n end\n if !@groups[line[1]]\n @groups[line[1]] = [line[1]]\n @leader_pointers[line[1]] = line[1]\n end \n end\n end\n end\n # sort edges costs\n @edges.sort! { |a, b| a[0] <=> b[0] }\n end",
"def load_xy_file(filename)\n xy_data = Array.new\n File.open(filename, \"r\") do |xy_file|\n xy_file.each_line do |line|\n x, y = line.split(' ')\n xy_data << [ string_to_number(x), string_to_number(y) ]\n end\n end\n xy_data\n end",
"def read_geometry(geom_elem, id_elem_hash, material_symbol_hash, material_count_hash)\n mesh_elem = get_child_elem(geom_elem, 'mesh')\n meshes = []\n mesh_elem.elements.each('triangles') do |triangles_elem|\n meshes << read_triangles(triangles_elem, id_elem_hash, material_symbol_hash, material_count_hash)\n end\n meshes\nend",
"def read_instance(filename)\n File.open(filename) do | f |\n read_ukp_instance(f)\n end\nend",
"def export_obj faces, filename\n v = []\n v_index = {}\n f = []\n\n faces.each do |face|\n f << []\n face.each do |vert|\n if(v_index[vert.to_s].nil?)\n v << vert\n v_index[vert.to_s] = v.length-1\n f[f.length-1] << v.length\n else\n f[f.length-1] << v_index[vert.to_s] + 1\n end\n end\n end\n\n first_part = \"v \" + v.join(\"\\nv \")\n f_strings = f.map {|face| face.join(\" \")}\n second_part = \"\\nf \" + f_strings.join(\"\\nf \")\n\n File.write(\"#{filename}.obj\", first_part + second_part)\nend",
"def initialize(options = {})\n super(options)\n @obj_filename = options[:filename] || \"\"\n @texture_file = options[:texture] || @obj_filename # eventually will tie into the load module.\n @texture_debugging = TEXTURE_DEBUG || options[:debug_draw] # skip drawing texture, use defualt mat white.\n #---------------------------------------------------------\n @object_name = '' # Is there an object name provided from .obj file or one set to this Ruby Object?\n @face_count = 0 # how many faces the object has.\n @object_model = nil # container that holds onto the wavefront 3d object data.\n @texture_resource = nil # A string or array that contains the name of textures used when drawing the .obj\n # debug printing of information, time between update posts for string creation.\n @time_between_debug_prints = 0\n @hud_font = Gosu::Font.new(22) # Gosu::Font container\n @string = \"\" # container for HUD information\n # try loading a source .obj file\n success = load_obj_file() rescue nil\n if success.nil?\n # there was an issue that was reported that resulted in a fail loading.\n puts(\"issue with object loading (#{@obj_filename})\")\n puts(\"-\" * 70)\n self.destroy # mark for map clean up/ removal\n return nil\n else\n if @verbose\n puts(\"-\" * 70)\n puts(\"Initializing new OpenGL 3D object... #{self}\")\n end\n end\n # speak if asked.\n if @verbose\n puts(\"New 3D object created from: \\\"#{@object_name}.obj\\\"\")\n puts(\"-\" * 70)\n end\n #@scale = 1.0 # scale the whole object.\n end",
"def loop_over_asset_lines(file_name)\n puts \"Loading #{file_name}\"\n batch_size = 50_000\n File.open(file_name) do |file|\n file.each_slice(batch_size) do |lines|\n Parallel.each(lines, in_processes: 8) do |line|\n asset_json = FastJsonparser.parse(line, symbolize_keys: false)\n if (%w[account service region resource] - asset_json.keys).empty? || validate_schema(asset_json)\n AssetRouter.new(asset_json, @import_id, @db)\n end\n end\n end\n end\n puts ''\n puts \"Done loading #{file_name}\"\n end",
"def next_graph_lines\n return nil if @graph_file.closed?\n\n graph_lines = []\n 4.times{ graph_lines << @graph_file.readline.strip } \n \n @graph_file.close if @graph_file.eof?\n \n # First line is blank\n graph_lines[1..3]\n end",
"def read_file(filename, graph)\n File.foreach(filename) do |x|\n id, data, neighbors = vertex_creation(x)\n graph.add_vertex(id, data, neighbors)\n end\n graph\nend",
"def import(libfile, lib)\r\n\t#open the text file containing the booklist from the library\r\n\tf = File.open(libfile)\r\n\t#parse the incoming lines into arrays of data\r\n\twhile line = f.gets do\r\n\t\tparsed_line = line.split('*')\r\n\t\tadd_book(parsed_line, lib)\r\n\tend\r\n\tf.close\r\nend",
"def load(filename)\n @filename = filename.to_s\n mode = :in_header\n IO.readlines(@filename).each do |line|\n case mode\n when :in_header\n if line =~ %r{^\\s*gem\\.}\n mode = :in_dev_body\n case line\n when %r{^\\s*gem\\.add_development_dependency}\n @dev_dependencies << line\n when %r{^\\s*gem\\.add_dependency}\n @gem_dependencies << line\n else\n @body << line\n end\n else\n @header << line\n end\n when :in_dev_body\n if line =~ %r{^\\s*end}\n mode = :in_footer\n @footer << line\n else\n case line\n when %r{^\\s*gem\\.add_development_dependency}\n @dev_dependencies << line\n when %r{^\\s*gem\\.add_dependency}\n @gem_dependencies << line\n else\n @body << line\n end\n end\n when :in_footer\n @footer << line\n end\n end\n end",
"def read_data_file(path); end",
"def read_data(file_name)\n file = File.open(file_name,\"r\")\n object = eval(file.gets.untaint.encode('UTF-8', :invalid => :replace, :replace => '').gsub('\\n', \"\"))\n file.close()\n return object\nend",
"def read_lines\n File.read(@document_file).split(\"\\n\")\n end",
"def load_database(filename)\n \n handle = File.open(filename)\n uncompressed = Zlib::GzipReader.new(handle)\n records = DnaIO.new(uncompressed)\n records.to_a\nend",
"def readFile\n File.open(ARGV[0], \"r\") do |f|\n f.each_line do |line|\n if line != \" \" or line != \"\"\n auxData = line.split\n n = Operations.new(auxData[1],auxData[2],auxData[3])\n $data.push(n)\n end\n end\n end\nend",
"def obj_file source\n ext = @data['extensions'][@language]['source']\n obj, src = builddir(source.sub(/#{ext}$/, objext)), srcdir(source)\n d = File.dirname(obj)\n\n directory d\n file obj => [ d, src ] do\n make_object obj, src\n end\n CLEAN.include obj\n\n obj\n end",
"def read_file pn\n pn.readlines.map(&:chomp)\n .each do |line|\n @entries.add line, pn\n end\n end",
"def read\n x = nil\n File.open(@filename, 'r') {|f| x = f.readlines }\n x.each do |line|\n\n line = self.class.remove_comments(line)\n\n if line.present?\n @data << self.class.extract_data_from_line(line)\n # puts self.class.extract_data_from_line(line).to_yaml\n end\n end\n end",
"def read_from_file\n begin\n File.open(@file) do |file|\n file.each_line {|line| @data_for_output << line}\n end\n rescue Errno::ENOENT => e\n puts e\n exit\n end\n end",
"def read_vertices\n (0..num_vertices - 1).map do |v|\n adj_lists[v] = Vertex.new(graphfile[v + 2], nil)\n end\n end",
"def line_maker\n @lines = File.readlines(path, chomp: true)\n end",
"def read_source_parts\n @source_parts ||= begin\n chunked_source = ChunkedSource.new(@source_path.open(\"r\"))\n metadata_extractor = TinyGem::MetadataExtractor.new(chunked_source, 'name' => gem_name)\n {spec: metadata_extractor.as_gemspec, library: chunked_source.library,\n readme: chunked_source.readme, executable: metadata_extractor.executable_code}\n end\n end",
"def readSource\n if @source_in.nil?\n @source_in = open @dir+Pathname.new(@source)\n # fields titles\n head=@source_in.readline.strip\n @heads=head.split(/\\s*,\\s*/)\n @hoplang_cols_order = @heads.join ','\n end\n\n begin\n line=@source_in.readline.strip\n datas=line.split(/\\s*,\\s*/)\n\n i=0\n value={}\n @heads.each {|h|\n value[h]=datas[i]\n i+=1\n }\n value['__hoplang_cols_order'] = @hoplang_cols_order\n # now store variable!\n #varStore.set(@current_var, value)\n return value\n rescue EOFError\n hop_warn \"EOF.....\\n\"\n #varStore.set(@current_var, nil)\n return nil\n end\n line\n end",
"def initialize file\n EasyTranslate.api_key = 'AIzaSyDrbD0AfKHiMZTYoite-ec4byLNlPxoX8k'\n @file = file\n @properties = []\n \n File.open(file, \"r:UTF-8\").each do |line| \n @properties << line \n end\n end",
"def setup\n self.parse() # load file\n puts(\"+Constructing a total of (#{@groups.keys.size}) Groups:\") if @verbose\n @groups.each_value do |grp|\n grp.displaylist = glGenLists( 1 )\n glNewList(grp.displaylist, GL_COMPILE )\n puts(\" * \\\"#{grp.name}\\\" : Faces(#{grp.faces.size}) openGL draw list cached.\") if @verbose\n grp.gl_draw_list(self) # create precahced draw operation\n glEndList()\n end\n puts(\"+Total Count of Faces: [ #{self.get_face_count} ]\") if @verbose\n # display materials information\n puts(\"+Material Lib: \\\"#{material_lib}\\\" with (#{@current_materials.size}) Name Refrences.\") if @verbose\n end",
"def read_source(source_file)\n @source_lines = source_file.readlines()\n end",
"def read_file(fname=nil)\n return if fname.nil?\n # Array we use to store entries\n lines = Array.new\n ah_data = Array.new\n # Deal with DOS line endings by reading in file, then manually splitting on DOS line ending\n File.open(fname).each_line do |line|\n lines = line.split(/\\r\\n?/).map(&:chomp)\n end\n return lines\nend",
"def read\n @fileobj = File.open(@fname,\"r\")\n parse_header_line(@fileobj.readline) unless @fileobj.eof?\n\n while (!@fileobj.eof?)\n yield(parse_data_line(@fileobj.readline))\n end\n end",
"def read_lines\n lines = Array.new\n line = @file.gets\n tokens = line.scan(/[-+]?\\d*\\.?\\d+/)\n x1 = Integer(tokens[0])\n x2 = Integer(tokens[1])\n \n while not (x1==0 and x2==0)\n l = Line.new(x1,x2)\n lines.push(l)\n line = @file.gets\n tokens = line.scan(/[-+]?\\d*\\.?\\d+/)\n \n x1 = Integer(tokens[0])\n x2 = Integer(tokens[1])\n \n end\n \n return lines\n \n end",
"def readFile\r\n\t\tfile = File.open(fileName, \"r\")\r\n\r\n\t\t#Array for partial matches\t\t\r\n\t\t@dictionary = Array.new\r\n\t\tfile.each do |line|\r\n\t\t\tif line != \"\\n\"\r\n\t\t\t\t@dictionary << line.split(/[:;\\n]/)\r\n\t\t\tend\r\n\t\tend\r\n\t\tstartStrategies\r\n\tend",
"def potential_lines(filename); end",
"def readlines(*args, **kwd); end",
"def lines\n load_data unless @lines\n @lines\n end",
"def load(fn)\n return if ! File.exists?(fn)\n lines = File.read fn\n lines.gsub!(/\\\\ /, SPACE_MARK)\n lines.gsub!(/#[^\\n]*\\n/m, \"\")\n lines.gsub!(/\\\\\\n/, ' ')\n lines.each_line do |line|\n process_line(line)\n end\n end",
"def read_file(file, context); end",
"def compass_convert\n file = File.open('data_imu.txt', 'r')\n file.readlines.each do |line|\n next unless line =~ /compass:/\n array = line.split(', ')\n capture_raw(array)\n end # end of loop\n file.close\nend",
"def analyze_file()\n arrayLinAnaly=[]\n linenum=0\n File.foreach('test.txt') do |line|\n arrayLinAnaly << LineAnalyzer.new(line, linenum)\n linenum+=linenum\n end\n return arrayLinAnaly\n end",
"def process_compiled_file\n doc = Nokogiri::XML(File.open(@source))\n records = doc.xpath('//*[local-name()=\"mods\"]')\n records.each do |record|\n # record\n druid = record.parent['objectId']\n doc_node = Nokogiri::XML(record.to_s)\n mods_file = MODSFile.new(doc_node, @template_xml, @namespace)\n process_mods_file(mods_file, druid)\n end\n write_output if @analysis_only == false\n report_data_loss\n end",
"def read(diagram)\n # Try to read captured pieces information from gnugo output.\n black_captured = /Black \\(X\\) has captured (\\d) pieces/.match(diagram)\n white_captured = /White \\(O\\) has captured (\\d) pieces/.match(diagram)\n\n if black_captured\n self.black.captured += black_captured.captures.first.to_i\n end\n if white_captured\n self.white.captured += white_captured.captures.first.to_i\n end\n\n diagram.gsub!(/Black.*/, '')\n diagram.gsub!(/White.*/, '')\n diagram.gsub!(/N O P/, '')\n diagram.gsub!(/[A-NP-WYZa-z0-9]/, '')\n diagram.gsub!(/[-| ():]/, '')\n diagram.strip().split(\"\\n\").each_with_index do |line, i|\n line.split(\"\").each_with_index do |char, j|\n coords = @letters[j] + (self.size.split('x')[0].to_i-i).to_s\n if char == \"X\"\n self.add_stone(coords, :black)\n elsif char == \"O\"\n self.add_stone(coords, :white)\n end\n end\n end\n end",
"def readFromDB\n File.open('db.txt', 'r+') do |file|\n file.readlines\n end\nend",
"def gl_draw_list( model )\n @face_index.each do |fidx|\n # https://docs.microsoft.com/en-us/windows/desktop/opengl/glbegin\n # What do the faces look like?\n #glBegin( GL_TRIANGLES ) # triangles\n #glBegin( GL_QUADS ) # squares\n glBegin( GL_POLYGON ) # polygon shapes, (openGL figures it out...)\n face = @faces[fidx]\n # draw each texture face on the object mesh.\n for i in 0...face.vertex_count do\n # prep tri/quad/poly face section drawing vars\n vi = face.vtx_index[i]\n ni = face.nrm_index[0] != -1 ? face.nrm_index[i] : nil\n ti = face.tex_index[0] != -1 ? face.tex_index[i] : nil\n # vertext plane start location:\n glNormal3f( model.normal[ni][0], model.normal[ni][1], model.normal[ni][2] ) if ni\n if ti # if has texture.\n # Gosu has issues with inversion Y plane for texture maping.\n # for this we offset the text cord by bottom of image reading down instead of up.\n # OpenGL textures are read from the bottomRight of the image to the TopLeft.\n # Gosu loads images into IO stream TopLeft and would end up being read Upside down.\n # Hense a subtraction from fload 1.0 for text cord. - BestGuiGui\n glTexCoord2f( model.texcoord[ti][0], 1.0 - model.texcoord[ti][1] )\n end\n # plane texture corners to vertex points:\n glVertex3f( model.vertex[vi][0], model.vertex[vi][1], model.vertex[vi][2] )\n end\n glEnd()\n end\n end",
"def dofile(file,output)\r\n # we are using the fact that the path will be given by \\ in command line, so / is added by ruby\r\n filename=file[file.index(\"/\")+1..file.size]\r\n output.puts \"*** START: [\"+filename+\"] ***\\n\"\r\n IO.foreach(file) do |line|\r\n output.puts line.lstrip if (line=~/^\\s*import\\s+/ or line=~/from\\s+\\w+\\s+import\\s+/) and not (line=~/^\\s*#/)\r\n output.puts \"! Dynamic import !\\n\" if line=~/__import__/\r\n end\r\n output.puts \"*** END: [\"+filename+\"] ***\\n\"\r\nend",
"def readExtractors(file)\n ObjectInputStream stream_in = ObjectInputStream.new(file)\n @extractors = stream_in.readObject # (Extractors)\n @extractorsRare = stream_in.readObject # (Extractors)\n extractors.initTypes\n extractorsRare.initTypes\n\n left = extractors.leftContext\n left_u = extractorsRare.leftContext\n left = left_u if left_u > left\n @leftContext = left\n\n right = extractors.rightContext\n right_u = extractorsRare.rightContext\n right = right_u if right_u > right\n @rightContext = right\n\n setExtractorsGlobal\n end",
"def load(fn) # :nodoc:\n lines = File.read fn\n lines.gsub!(/\\\\ /, SPACE_MARK)\n lines.gsub!(/#[^\\n]*\\n/m, \"\")\n lines.gsub!(/\\\\\\n/, \" \")\n lines.each_line do |line|\n process_line(line)\n end\n end",
"def read_file filename\n\t\tbegin\t \n\t\t\tfile = File.new(filename, \"r\")\n\t\t\tline_number = 1\n\t\t file.each do |line|\t\t \t\n\t\t \tself.read_input_line line, line_number\n\t\t \tline_number += 1\n\t\t end\t \n\t\trescue => err\n\t\t puts \"File not loaded: #{err}\"\n\t\t err\n\t\tensure file.close if file end\n\tend",
"def source_lines; end",
"def source_lines; end",
"def source_lines; end",
"def source_lines; end",
"def reader; end",
"def pbRgssOpen(file,mode=nil)\n #File.open(\"debug.txt\",\"ab\"){|fw| fw.write([file,mode,Time.now.to_f].inspect+\"\\r\\n\") }\n if !safeExists?(\"./Game.rgssad\") && !safeExists?(\"./Game.rgss2a\")\n if block_given?\n File.open(file,mode){|f| yield f }\n return nil\n else\n return File.open(file,mode)\n end\n end\n file=canonicalize(file)\n Marshal.neverload=true\n begin\n str=load_data(file)\n ensure\n Marshal.neverload=false\n end\n if block_given?\n StringInput.open(str){|f| yield f }\n return nil\n else\n return StringInput.open(str)\n end\nend",
"def parse_points\n points = Array.new\n begin\n file = File.open(\"../data/data_points.txt\", \"r\") do |f|\n f.each do |line|\n arr = line.split(\",\")\n points.push(ChunkyPNG::Point.new(arr[0], arr[1]))\n end\n f.close\n File.delete(f)\n end\n rescue \n return nil\n end\n return points\n end",
"def processShapefile()\n\t#Create a new file object\n\t$shapefile = File.new($filePath,\"rb\")\n\t#Create a SketchUp model object\n\tmodel = Sketchup.active_model\n\n\t#Process Shapefile header information\n\t#Verify the file type\n\tfileCode = $shapefile.read(4).unpack(\"l>\")\n\t#Shapefile code is 9994. Checking for the match\n\tif fileCode[0]!=9994 then\n\t\tabort(\"The specified file is not a Shapefile.\")\n\tend\n\t#Ignore the next 20 bytes they are unused\n\t$shapefile.read(20)\n\t#Get the file length. Important for record processing.\n\tfileLength = $shapefile.read(4).unpack(\"l>\")\n\t#Next four bytes are the version. We won't be using this.\n\t$shapefile.read(4)\n\t#The next four bytes are the shape type. Important for record processing.\n\tshapeType = $shapefile.read(4).unpack(\"l<\")\n\t#Rule out certain shape types. More types will be added as time goes on.\n\tif shapeType[0]!=1 and shapeType[0]!=3 then\n\t\tabort(\"This type of shapefile is not supported.\")\n\tend\n\t#Read the next 64 bytes. They won't be used in our program for now.\n\t$shapefile.read(64)\n\t\n\t\n\t#Begin record procesing\n\t#Option for point shapefile\n\tif shapeType[0]==1 then\n\t\t#Try grabbing the first record\n\t\tbegin\n\t\t\trecordNumber = $shapefile.read(4).unpack(\"l>\")\n\t\trescue #Exit if the shapefile is empty\n\t\t\tabort(\"There are no records in this shapefile.\")\n\t\tend\n\t\t#Let the user know the process has begun\n\t\tputs(\"Processing shapefile...\")\n\t\t#Process all records until the end\n\t\twhile recordNumber!=nil\n\t\t\trecordLength = $shapefile.read(4).unpack(\"l>\")\n\t\t\trecordType = $shapefile.read(4).unpack(\"l<\")\n\t\t\t#If it is a null shape, we will ignore it\n\t\t\t#Process remaining record contents\n\t\t\tif recordType[0]==1\n\t\t\t\t#Read the coordinates\n\t\t\t\tpointX = $shapefile.read(8).unpack(\"E\")\n\t\t\t\tpointY = $shapefile.read(8).unpack(\"E\")\n\t\t\t\t#Add the point to the model\n\t\t\t\tmodel.entities.add_cpoint model.latlong_to_point([pointX[0],pointY[0]])\n\t\t\tend\n\t\t\t#Try reading the next record. Prepare for possible error.\n\t\t\tbegin\n\t\t\t\trecordNumber = $shapefile.read(4).unpack(\"l>\")\n\t\t\trescue #If we need to rescue, we are at the end of the shapefile.\n\t\t\t\tputs(\"Shapefile has been processed.\")\n\t\t\t\tbreak\n\t\t\tend\n\t\tend\n\t#Option for polyline shapefile\n\telsif shapeType[0]==3\n\t\t#Try grabbing the first record\n\t\tbegin\n\t\t\trecordNumber = $shapefile.read(4).unpack(\"l>\")\n\t\trescue\n\t\t\tabort(\"There are no records in the shapefile.\")\n\t\tend\n\t\tputs(\"Processing Shapefile...\")\n\t\t#Process each record\n\t\twhile recordNumber!=nil\n\t\t\trecordLength = $shapefile.read(4).unpack(\"l>\")\n\t\t\trecordType = $shapefile.read(4).unpack(\"l<\")\n\t\t\t#Process polyline shape types\n\t\t\tif recordType[0]==3\n\t\t\t\trecordBox = $shapefile.read(32) #We will read this, but we don't need it\n\t\t\t\t#Get part and point counts\n\t\t\t\trecordPartCount = $shapefile.read(4).unpack(\"l<\")\n\t\t\t\trecordPointCount = $shapefile.read(4).unpack(\"l<\")\n\t\t\t\t#Create an index array\n\t\t\t\tindex = []\n\t\t\t\t#Populate the index array\n\t\t\t\tfor recordPoint in (0..recordPartCount[0]-1) do\n\t\t\t\t\tindex.push($shapefile.read(4).unpack(\"l<\"))\n\t\t\t\tend\n\t\t\t\t#Loop through all parts for this record\n\t\t\t\tfor partNum in (0..recordPartCount[0]-1) do\n\t\t\t\t\t#Generate the loop count\n\t\t\t\t\tloopCount = nil\n\t\t\t\t\tif index[partNum+1]==nil #Figure out how many point to count\n\t\t\t\t\t\tloopCount = recordPointCount[0] - index[partNum][0]\n\t\t\t\t\telse\n\t\t\t\t\t\tloopCount = index[partNum+1][0]-index[partNum][0]\n\t\t\t\t\tend\n\t\t\t\t\t#Loop through all lat,long values for this part.\n\t\t\t\t\tpointsArray = []\n\t\t\t\t\t#Generate array of points\n\t\t\t\t\tfor i in (1..loopCount) do\n\t\t\t\t\t\tpointX = $shapefile.read(8).unpack(\"E\")\n\t\t\t\t\t\tpointY = $shapefile.read(8).unpack(\"E\")\n\t\t\t\t\t\tpointsArray.push(model.latlong_to_point([pointX[0],pointY[0]])) #Convert lon/lat to x,y and add to array\n\t\t\t\t\tend\n\t\t\t\t\t#Add line to the model\n\t\t\t\t\tmodel.entities.add_edges pointsArray\n\t\t\t\tend\n\t\t\t\t#Try and process next record. Prepare for possible error.\n\t\t\t\tbegin\n\t\t\t\t\trecordNumber = $shapefile.read(4).unpack(\"l>\")\n\t\t\t\trescue\n\t\t\t\t\tputs(\"Shapefile has been processed.\")\n\t\t\t\t\tbreak\n\t\t\t\tend\n\t\t\tend\n\t\tend\t\n\telse #Condition for shape types that are not able to be processed.\n\t\tputs(\"Shapefile type is currently not supported.\")\n\tend\nend",
"def fread\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 30 )\n\n begin\n # at line 928:5: 'fread' '(' ')'\n match( T__50, TOKENS_FOLLOWING_T__50_IN_fread_1546 )\n match( T__28, TOKENS_FOLLOWING_T__28_IN_fread_1553 )\n match( T__29, TOKENS_FOLLOWING_T__29_IN_fread_1555 )\n # --> action\n\n dir_const = get_avail_const\n generate('frd',nil,nil,dir_const)\n \t\t @stack_operands.push(dir_const)\n \t\t\t@stack_types.push('float')\n \n # <-- action\n\n rescue ANTLR3::Error::RecognitionError => re\n report_error(re)\n recover(re)\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 30 )\n\n end\n \n return \n end",
"def file_line=(_arg0); end",
"def pbRgssOpen(file,mode=nil)\n #File.open(\"debug.txt\",\"ab\") { |fw| fw.write([file,mode,Time.now.to_f].inspect+\"\\r\\n\") }\n if !safeExists?(\"./Game.rgssad\") && !safeExists?(\"./Game.rgss2a\")\n if block_given?\n File.open(file,mode) { |f| yield f }\n return nil\n else\n return File.open(file,mode)\n end\n end\n file = canonicalize(file)\n Marshal.neverload = true\n begin\n str = load_data(file)\n ensure\n Marshal.neverload = false\n end\n if block_given?\n StringInput.open(str) { |f| yield f }\n return nil\n else\n return StringInput.open(str)\n end\nend",
"def refresh!\n @lines = load_from_file\n end"
] |
[
"0.6420392",
"0.6225856",
"0.6061187",
"0.6059899",
"0.6020622",
"0.57642144",
"0.57232845",
"0.5711985",
"0.5678978",
"0.56769335",
"0.55477196",
"0.55265605",
"0.54853624",
"0.5438154",
"0.53964245",
"0.5357252",
"0.5342644",
"0.5332066",
"0.53283304",
"0.53227806",
"0.53205955",
"0.5307049",
"0.53022426",
"0.52881086",
"0.5288059",
"0.5277894",
"0.5259517",
"0.5231938",
"0.5189",
"0.51776224",
"0.5171789",
"0.5154718",
"0.51509607",
"0.5123442",
"0.511621",
"0.5110808",
"0.51107687",
"0.5108201",
"0.5104573",
"0.50893277",
"0.50893277",
"0.5085346",
"0.5083919",
"0.50795716",
"0.50786364",
"0.50728256",
"0.5070937",
"0.50694895",
"0.5039055",
"0.5031637",
"0.50209993",
"0.50206447",
"0.5013911",
"0.5003696",
"0.49777588",
"0.49654707",
"0.4963135",
"0.49539456",
"0.4934392",
"0.492989",
"0.49262542",
"0.4920805",
"0.49157375",
"0.49131253",
"0.49111414",
"0.49106348",
"0.49093956",
"0.49078482",
"0.49063066",
"0.49043512",
"0.48988795",
"0.48893392",
"0.4886167",
"0.48840475",
"0.487899",
"0.48758242",
"0.48665768",
"0.486583",
"0.4862509",
"0.48624486",
"0.48613888",
"0.4858903",
"0.48546574",
"0.48543668",
"0.48540458",
"0.48530015",
"0.4851711",
"0.48517105",
"0.4849932",
"0.4849932",
"0.4849932",
"0.4849932",
"0.48471493",
"0.48420924",
"0.48326018",
"0.48308554",
"0.48293862",
"0.4824005",
"0.48221785",
"0.48176906"
] |
0.5311559
|
21
|
Records when was the world seen into the world's coordinator record
|
def add_record(id, time = Time.now)
record = find_world id
@executor[id] ||= record.data[:class] == 'Dynflow::Coordinator::ExecutorWorld'
record.data[:meta].update(:last_seen => self.class.format_time(time))
@world.coordinator.update_record(record)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def last_seen_at() ; info_time(:last_seen) ; end",
"def just_saw\n\t\t\t@last_seen = Time.now\n\t\tend",
"def history_added; end",
"def stamp\n self.dateChanged = Time.now\n self.changedBy = ApplicationController.application_name\n end",
"def stamp\n self.dateChanged = Time.now\n self.changedBy = ApplicationController.application_name\n end",
"def stamp\n self.dateChanged = Time.now\n self.changedBy = ApplicationController.application_name\n end",
"def altered_world_event; end",
"def log_date\n self.well_info.date_logged\n end",
"def destroyed_at() ; info_time(:destroyed_datetime) ; end",
"def destroyed_at() ; info_time(:destroyed_datetime) ; end",
"def seen!\n @last_seen = Time.now\n end",
"def date() updated; end",
"def enter_created; end",
"def timestamp; end",
"def timestamp; end",
"def timestamp; end",
"def timestamp; end",
"def timestamp; end",
"def timestamp; end",
"def past_participle; end",
"def timestamp\n memoized_info[:local_timestamp]\n end",
"def add_identity_to_log\n RequestLocals.store[:identity] = { candidate_id: current_candidate&.id }\n end",
"def save\n\t\tDB.execute(\"insert into seen(who) values(:who)\", 'who' => who)\n\tend",
"def logged\n @from_time = Time.now\n end",
"def visited\n self.visited_at = Time.now\n self.save!\n end",
"def wf_launched_at; h.wf_launched_at; end",
"def last_seen_at\n @data[:last_seen_at]\n end",
"def info\n date = self.updated_at.to_s(:short)\n wrote = self.system_log? ? \"\" : \" wrote\"\n private = self.private? ? \" [private]\" : \"\"\n \"[#{date}] #{self.byline}#{wrote}#{private}\"\n end",
"def info\n date = self.updated_at.to_s(:short)\n wrote = self.system_log? ? \"\" : \" wrote\"\n private = self.private? ? \" [private]\" : \"\"\n \"[#{date}] #{self.byline}#{wrote}#{private}\"\n end",
"def recordOn()\n @record = true ;\n end",
"def history_added=(_arg0); end",
"def record_internal_interaction\n client&.touch(:last_internal_or_outgoing_interaction_at)\n end",
"def visible_history_start_date_time\n return @visible_history_start_date_time\n end",
"def worlds_visited\n\t\t@worlds_visited\n\n\tend",
"def log_changes(location,description,observation=nil,author=nil,description_patch=nil,\n former_type_ids=[],former_location=nil)\n c = Change.new\n c.location = location\n c.description = description\n c.remote_ip = request.headers['CF-Connecting-IP'] || request.remote_ip \n c.user = current_user if user_signed_in?\n c.observation = observation\n c.description_patch = description_patch\n c.former_type_ids = former_type_ids\n c.former_location = former_location\n # adding an observation\n if author.nil? and not observation.nil?\n c.author = observation.author\n # adding a location\n elsif author.nil? and observation.nil? and description == \"added\"\n c.author = location.author\n # editing a location\n elsif not author.nil?\n c.author = author\n end\n c.save\n end",
"def seen\n assign_attributes(last_seen_at: Time.current)\n increment(:seen_count)\n save(validate: false)\n end",
"def touch_when_logging\n self.log_updated_at = Time.zone.now\n save\n end",
"def store_interest_update\n self.last_interest_update = Time.now\n end",
"def stamp_changed\n return unless changed?\n\n self.dateChanged = Time.now\n self.changedBy = ApplicationController.application_name\n end",
"def doctors_visit(patient_id)\n patient = Patient.find(patient_id)\n patient.update(last_visited_on: DateTime.now)\nend",
"def zone; end",
"def was_seen!\n update_attribute(:last_seen_at, Time.now) if valid? && (last_seen_at.nil? || last_seen_at < 1.hour.ago)\n end",
"def was_seen!\n update_attribute(:last_seen_at, Time.now) if valid? && (last_seen_at.nil? || last_seen_at < 1.hour.ago)\n end",
"def time\n Time.now.localtime + self.time_offset\n end",
"def last_seen_date_time\n return @last_seen_date_time\n end",
"def last_seen_date_time\n return @last_seen_date_time\n end",
"def last_seen_date_time\n return @last_seen_date_time\n end",
"def entered_senedd\n representations.first.log_date\n end",
"def log_destruction\n if User.current &&\n (obs = observation)\n obs.log(:log_naming_destroyed, name: format_name)\n obs.calc_consensus\n end\n end",
"def observed_at_string\n observed_at ? observed_at.to_s : Time.zone.now\n end",
"def this_event_time\n @event[\"server_gmt\"].to_i\n end",
"def owner_id_line(obs)\n return unless obs.show_owner_id?\n capture do\n concat(:show_observation_owner_id.t + \": \")\n concat(obs.owner_favorite_or_explanation.t)\n end\n end",
"def record_timestamps\n doc \"When this record has been created.\"\n datetime \"created_at\"\n doc \"When this record has been updated lastly.\"\n datetime \"updated_at\"\n end",
"def fresh_record?(id)\n record = find_world(id)\n return false if record.nil?\n @executor[id] = record.data[:class] == 'Dynflow::Coordinator::ExecutorWorld'\n time = self.class.load_time(record.data[:meta][:last_seen])\n time >= Time.now - @max_age\n end",
"def seen(user)\n puts \"Should have updated last seen time for %s\" % user.to_s\n @add_seen.execute(user)\n end",
"def observed_utc_offset; end",
"def observed_utc_offset; end",
"def observed_utc_offset; end",
"def observed_utc_offset; end",
"def history_create\n # history_log('created', created_by_id)\n end",
"def record_meeting_details\n real_date = RealDate.find_or_create_by(profile_uuid: @current_profile.uuid, conversation_id: @conversation.id)\n\n tz_offset = ActiveSupport::TimeZone.new(real_date.profile.time_zone).utc_offset / 3600 rescue 0\n params[:data][:meeting_at] = Time.at((params[:data][:meeting_at]/1000).to_i)\n\n real_date.update!(real_date_parameters)\n\n render 'api/v1/shared/nodata', status: 200\n end",
"def record(player)\n count = losses[player]\n \"GHOST\".slice(0, count)\n end",
"def sub_wf_launched_at; h.sub_wf_launched_at; end",
"def log_tracking\n if Tracking.last.created_at.to_date != Time.now.utc.to_date\n track = Tracking.new(available_cars: available_cars.count, total_cars: Car.all.count, created_at: Time.now.utc.to_date)\n track.save!\n end\n end",
"def events_happening_at\n find_related_frbr_objects( :happens_at, :which_events?) \n end",
"def watched\n identifier(watched_db) \n end",
"def record_outgoing_interaction\n client&.update!(\n last_internal_or_outgoing_interaction_at: Time.now.to_datetime,\n response_needed_since: nil,\n first_unanswered_incoming_interaction_at: nil, # we've explicitly responded to them somehow, so we can clear this value.\n )\n end",
"def add_identity_to_log\n RequestLocals.store[:identity] = {\n vendor_api_token_id: @current_vendor_api_token&.id,\n provider_id: current_provider&.id,\n }\n end",
"def first_seen_date_time\n return @first_seen_date_time\n end",
"def first_seen_date_time\n return @first_seen_date_time\n end",
"def followers_history; counter_per_day(:followers); end",
"def state_changed_at\n if occurred_at\n now = Time.zone.now\n occurred_at + now.hour.hours + now.min.minutes\n else\n Time.zone.now\n end\n end",
"def date_added\n @ole.DateAdded\n end",
"def zone\n @zone\n end",
"def autolog_created\n autolog_event(:created)\n end",
"def last_seen(user)\n seen_when = @db.get_first_value(\"SELECT seen_at FROM last_seen WHERE user = ? COLLATE NOCASE\", user)\n puts \"Last time %s joined was last seen at timestamp \" % [user.to_s, time_ago_in_words(DateTime.parse(seen_when))]\n return \"Last time %s joined was %s ago\" % [user, time_ago_in_words(DateTime.parse(seen_when))]\n end",
"def localtime() end",
"def timestamp\n self[:timestamp]\n end",
"def sent_at\n Time.at(@changes['time'])\n end",
"def added; status[:added]; end",
"def master_last_seen_unix_timestamp()\n @master_last_seen_unix_timestamp ||= 0\n end",
"def record_userstamp\n !duplicating?\n end",
"def record_userstamp\n !duplicating?\n end",
"def recent_activity\n AccessAuditRecord.recent_activity :as => 'table'\n end",
"def shown_invite_friends!\n update_column(:invited_friends_at, Time.current)\n end",
"def state\n [@gid, @sid, @track_by, @count, @seconds, @new_action, @timeout, @apply_to]\n end",
"def is_onWorld; @onWorld \tend",
"def date; raw_changeset.time; end",
"def cluster_create_time\n data[:cluster_create_time]\n end",
"def timezone\n @history.objects.find { |o| o.name == \"tz\" }.val\n end",
"def deployed_at() ; info_time(:deployed_datetime) ; end",
"def deployed_at() ; info_time(:deployed_datetime) ; end",
"def update_login_timestamps\n if current_enrollment && current_enrollment.last_seen # when an enrollment is created, it's last_seen value is set\n \n if current_enrollment.last_seen < 4.hour.ago # 4 hours is somewhat arbitrary\n current_enrollment.events.new_session.create\n end\n\n # note that there is activity (since this before filter happens for any activity)\n current_enrollment.update_attribute(:last_seen, Time.now)\n end\n end",
"def sat_on_by object\n @sitting_on_me << object.goid\n end",
"def show\n @artists = Artist.all\n @venues = Venue.all\n gon.venue = set_concert.venue\n p ENV['TimeZone']\n gon.tz_key = ENV['TimeZone']\n @keep = Keep.new\n end",
"def zone() end",
"def coordinator? event\n self.user_events.where(event: event, role: 'coordinator').count >= 1\n end",
"def time_added?\n self.impact == 'Added'\n end",
"def record_userstamp\n !@duplicating\n end",
"def logall(user)\n self.changes.each do |key, value|\n if key != \"updated_at\" then\n name = self.class.name + \" #{key}\"\n \n logthis(user, name, self.id, value[0], value[1])\n end\n end\n end"
] |
[
"0.5985351",
"0.5702953",
"0.5644542",
"0.5639094",
"0.5639094",
"0.5639094",
"0.56062806",
"0.5555142",
"0.5473823",
"0.5473823",
"0.5377818",
"0.5344288",
"0.53417057",
"0.5312277",
"0.5312277",
"0.5312277",
"0.5312277",
"0.5312277",
"0.5312277",
"0.52680624",
"0.5266372",
"0.5258046",
"0.5222033",
"0.5210704",
"0.51913583",
"0.51831496",
"0.51777804",
"0.5156829",
"0.5156829",
"0.5155815",
"0.51521736",
"0.5149022",
"0.51434803",
"0.51195943",
"0.51189554",
"0.5099045",
"0.5095021",
"0.50907224",
"0.50881666",
"0.50815403",
"0.5056392",
"0.50476956",
"0.50476956",
"0.5042431",
"0.5039183",
"0.5039183",
"0.5039183",
"0.5035108",
"0.5029121",
"0.5014842",
"0.50130284",
"0.5012258",
"0.50106686",
"0.4978106",
"0.4971002",
"0.4965489",
"0.4965489",
"0.4965489",
"0.4965489",
"0.49583477",
"0.49570984",
"0.49346277",
"0.49307877",
"0.49240232",
"0.49166378",
"0.49084744",
"0.4908381",
"0.48975962",
"0.48936355",
"0.48936355",
"0.4887218",
"0.4876204",
"0.4866511",
"0.48603413",
"0.48565853",
"0.48520035",
"0.48510894",
"0.48421845",
"0.4827969",
"0.4827352",
"0.48259437",
"0.48255798",
"0.48255798",
"0.4815316",
"0.48147407",
"0.48144427",
"0.48109454",
"0.48039865",
"0.4798421",
"0.4797116",
"0.47909024",
"0.47909024",
"0.478919",
"0.47842893",
"0.4779035",
"0.47787178",
"0.4778077",
"0.47777224",
"0.47775865",
"0.47767526"
] |
0.58622915
|
1
|
Looks into the cache whether the world has an executor
|
def executor?(id)
@executor[id]
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def executing?(name)\n Threaded.executing?(name)\n end",
"def executable?\n \n # Return false if picked up by another WQ instance\n if id\n old_lock_version = lock_version\n self.reload\n return false if old_lock_version != lock_version\n end\n \n # Return true we can sill be executed\n return WorkerQueue.available_tasks.include?(self) && !completed? && !running? \n end",
"def cache?\n caching && true\n end",
"def is_executive?\n executive ? true : false\n end",
"def cached?(key)\n false\n end",
"def cache_topology?\n @cache_topology\n end",
"def executor!\n @executor = true\n end",
"def executor!\n @executor = true\n end",
"def executor!\n @executor = true\n end",
"def was_executed?\n execution_count > 0\n end",
"def cache?\n false\n end",
"def lut_cache_exists?(name)\n !lut_read_cache_item(name, 0).nil?\n end",
"def executed?\n @executed\n end",
"def executed?\r\n @executed\r\n end",
"def executing?(name)\n !stack(name).empty?\n end",
"def executed?\n @executed\n end",
"def sync_exec_required?\n Thread.current != DisplayProxy.thread\n end",
"def cached_write?\n !@used.any?\n end",
"def use_cache?\n super && !against_head?\n end",
"def use_cache?\n super && !against_head?\n end",
"def usable_in?(pool)\n true\n end",
"def cached?\n cache_path.exist?\n end",
"def cached?\n cache_path.exist?\n end",
"def job_status_needs_interpreter?\n if !self.has_interpreter_assigned? && !self.expired?\n return true\n else\n return false\n end\n end",
"def cached?\n !(!@cached)\n end",
"def should_cache?\n false\n end",
"def should_cache?\n ctrait = controller.trait\n\n [ Global.cache_all,\n ctrait[:cache_all],\n actions_cached.map{|k,v| k.to_s}.include?(method),\n ].any?\n end",
"def cacheable?\n true\n end",
"def cached?; end",
"def leaked_request?\n !CacheUpdater.executing?\n end",
"def cached?(key)\n not @memcache.get(key).nil?\n end",
"def is_running?\n # TODO: cache this maybe?\n fetch_is_running?\n end",
"def is_in_cache(var)\n Rails.cache.exist?(var)\nend",
"def cached_lookup_allowed?\n @klass.use_activerecord_cache && arel.where_sql.nil? && arel.join_sources.empty? && @limit_value.nil? && @offset_value.nil?\n end",
"def remove_repository_cache?\n !copy_cache\n end",
"def cached?\n Dir.exist?(cached_repo_path)\n end",
"def cacheable?\n @cacheable\n end",
"def cache_check(compiler)\n ok = Mom::Label.new(\"cache_ok_#{self.object_id}\")\n check = build_condition(ok, compiler) # if cached_type != current_type\n check << Mom::SlotLoad.new([dynamic_call.cache_entry, :cached_type] , receiver_type_definition(compiler))\n check << Mom::ResolveMethod.new( @name , dynamic_call.cache_entry )\n check << ok\n end",
"def executor\n @executor ||= create_executor\n end",
"def executor\n @executor ||= create_executor\n end",
"def _head?\n _execution_id == head_execution(reload: true).id\n end",
"def optimizable?(path)\n !!workers_for_image(path)\n end",
"def optimizable?(path)\n !!workers_for_image(path)\n end",
"def locked?\n if sha1 = @eval_is_locked\n 1 == eval_safe(sha1, @ns_names)\n else\n redis_pool.exists @ns_names.first\n end\n end",
"def fresh_record?(id)\n record = find_world(id)\n return false if record.nil?\n @executor[id] = record.data[:class] == 'Dynflow::Coordinator::ExecutorWorld'\n time = self.class.load_time(record.data[:meta][:last_seen])\n time >= Time.now - @max_age\n end",
"def cache_exist?\n File.exist?(@cache_file)\n end",
"def threads_key?(key)\n @pool.key?(key)\n end",
"def check_execute\n unless executed?\n execute\n end\n end",
"def cache_on?; end",
"def cache_on?; end",
"def cache?(key)\n auth_objects_cache.key? key\n end",
"def available?\n return true unless coliding_locks.any?\n end",
"def run_once?\n !!@run\n end",
"def cacheable?\n last.nil? || last.cacheable\n end",
"def cache_check(compiler)\n ok = SlotMachine::Label.new(self,\"send_cache_#{@name}_ok_#{self.object_id}\")\n check = build_condition(ok, compiler) # if cached_type != current_type\n check << SlotMachine::SlotLoad.new(self,[dynamic_call.cache_entry, :cached_type] , receiver_type_definition(compiler))\n check << SlotMachine::ResolveMethod.new(self, @name , dynamic_call.cache_entry )\n check << ok\n end",
"def running_here?\n !idle? && @self_started\n end",
"def matches?(block)\n block.call\n return ActionController::Base.cached?(@url)\n end",
"def has_key?(key)\n @cache.has_key?(key)\n end",
"def from_cache?\n @from_cache\n end",
"def cacheable?\n return false if method != :get && method != :head\n return false if cache_control.no_store?\n true\n end",
"def config_cached?(key)\n lock(:c) do\n @cache[:c].has_key?(key)\n end\n end",
"def cache_exists?\n File.exist?(cached_file)\n end",
"def runnable?\n tool_class.public_instance_methods(false).include?(:run)\n end",
"def cacheable_request?\n (request.get? || request.head?) && (request.params[:cache] != 'false')\n end",
"def executor\n @__context__.executor\n end",
"def remote?\n !::Rails.application.dynflow.executor? &&\n !rake_task_with_executor? &&\n @remote\n end",
"def torpedo_ready?\n\t\ttime_diff = Time.new - @torpedo_launched \n\t\t@torpedo_reload_time < time_diff\n\tend",
"def cacheable?(env)\n result = false\n if (url = request_url(env)).blank?\n log(\"NO URI for request #{env.inspect}\")\n elsif cacheable_paths&.none? { |path| url.include?(path) }\n log(\"NON-CACHEABLE URI: #{url}\")\n else\n result = true\n end\n result\n end",
"def cacheable?(env)\n result = false\n if (url = request_url(env)).blank?\n log(\"NO URI for request #{env.inspect}\")\n elsif cacheable_paths&.none? { |path| url.include?(path) }\n log(\"NON-CACHEABLE URI: #{url}\")\n else\n result = true\n end\n result\n end",
"def available_workers?\n true\n end",
"def running?\n !!managers\n end",
"def usable_repository?\n repository_cache.directory? &&\n run_and_output(\"#{git} remote -v | grep origin\").include?(uri)\n end",
"def cache_hit?\n @gapi.cache_hit\n end",
"def exists_with_identity_cache?(id)\n !!fetch_by_id(id)\n end",
"def cached?(name, *args)\n return false if Rails.env == 'development'\n cache = Cacheable.cache[self][name.to_sym]\n return false unless cache.key?(args)\n params = cache[args]\n !(params[:force] && (params[:time] < (Time.new - params[:ttl])))\n end",
"def existe_cache?(recurso)\n if Rails.cache.exist?(\"#{recurso}_#{id}\")\n cache = Rails.cache.read(\"#{recurso}_#{id}\")\n\n begin\n (cache[:created_at] + cache[:expires_in]) > Time.now.to_f\n rescue\n false\n end\n\n else\n false\n end\n end",
"def exists?(cache_key)\n @pg.exec_prepared(@exists_statement_name, [object_to_cache_key(cache_key)]).ntuples.eql?(1)\n end",
"def exist?\n with_script_compiler do |compiler|\n return !!compiler.plan_signature(@plan)\n end\n end",
"def performing_caching?\n @config ? @config.perform_caching : Rails.application.config.action_controller.perform_caching\n end",
"def read_from_cache?\n raise NotImplementedError, \"You must implement #{self.class}##{__method__}\"\n end",
"def exists?(allow_unchecked: false)\n begin\n allow_unchecked ? memoized_info : info\n rescue Nanook::NodeRpcError\n return false\n end\n\n true\n end",
"def update_cache?\n return @update_cache unless @update_cache.nil?\n @update_cache =\n begin\n File.stat(Gem.user_home).uid == Process.uid\n rescue Errno::ENOENT\n false\n end\n end",
"def executable?\n @executable || (@executable.nil? && !garbage? && plan && plan.executable?)\n end",
"def any_waiting_threads?\n @condition_variable.any_waiting_threads?\n end",
"def cache?\n self.inherited_groups.empty?\n end",
"def move_to_cache\r\n true\r\n end",
"def running?\n super && !@executor.isTerminating\n end",
"def waiting_registry?\n status == 'waiting_registry'\n end",
"def cached?\n options[:cache] == true\n end",
"def cached? *key\n @cache.has_key? key\n end",
"def cached?(uri)\n @filter.include?(uri)\n end",
"def is_concurrent?\n\n false\n end",
"def include?(entry)\n @cache.has_key?(key_for(entry))\n end",
"def execute_mode?\r\n @context[:mode] == :execute\r\n end",
"def is_cached_entity?\n # Set in initialize via marshal_load\n @loaded_from_cache\n end",
"def same_build_in_progress?\n !Rails.env.development? &&\n !Rails.cache.write(\"build-service-#{@build.id}\", true, unless_exist: true, expires_in: 10.seconds, raw: true)\n end",
"def workers_available?\n @worker.nil?\n end",
"def can_process_cmd?\n settings.queue.empty?\n end",
"def written_to_cache?\n raise NotImplementedError, \"You must implement #{self.class}##{__method__}\"\n end",
"def cache_found\n found = true\n\n Open3.popen3('klist') do |stdin, stdout, stderr|\n found = false unless stderr.gets.nil?\n end\n\n found\n end"
] |
[
"0.6265423",
"0.61224943",
"0.6103797",
"0.60713375",
"0.6040377",
"0.6039144",
"0.60386235",
"0.60386235",
"0.60386235",
"0.60244215",
"0.59997284",
"0.5996314",
"0.59745073",
"0.5966175",
"0.59192693",
"0.58917797",
"0.5882518",
"0.58809906",
"0.58665013",
"0.58665013",
"0.5850844",
"0.5848177",
"0.58221126",
"0.5820222",
"0.58007646",
"0.57627916",
"0.5757783",
"0.5745983",
"0.5744011",
"0.5743975",
"0.5715325",
"0.5711356",
"0.57094795",
"0.57014924",
"0.56895614",
"0.56773084",
"0.56740344",
"0.56578845",
"0.5651086",
"0.5651086",
"0.56465125",
"0.56460667",
"0.56460667",
"0.5639363",
"0.5636121",
"0.5631841",
"0.56310356",
"0.56198186",
"0.5610426",
"0.5610426",
"0.5610209",
"0.56053483",
"0.56041473",
"0.55978787",
"0.5594838",
"0.55907375",
"0.55856746",
"0.55483234",
"0.5540184",
"0.55249774",
"0.55240506",
"0.55140203",
"0.54912436",
"0.54896086",
"0.54872227",
"0.5476686",
"0.546731",
"0.5453666",
"0.5453666",
"0.54504037",
"0.5441385",
"0.5440216",
"0.54396826",
"0.54350364",
"0.5429533",
"0.54288906",
"0.5428592",
"0.54247916",
"0.54244804",
"0.5422949",
"0.54216695",
"0.54214084",
"0.54213077",
"0.54150546",
"0.5409985",
"0.5406789",
"0.5404639",
"0.539933",
"0.5394683",
"0.5391363",
"0.5386812",
"0.53835565",
"0.53778386",
"0.53738284",
"0.53736895",
"0.53707284",
"0.5365742",
"0.5361325",
"0.53595483",
"0.5357453"
] |
0.7203416
|
0
|
Loads the coordinator record from the database and checks whether the world was last seen within the time limit
|
def fresh_record?(id)
record = find_world(id)
return false if record.nil?
@executor[id] = record.data[:class] == 'Dynflow::Coordinator::ExecutorWorld'
time = self.class.load_time(record.data[:meta][:last_seen])
time >= Time.now - @max_age
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def data_is_recent_enough?\n # It's possible for a replica to not replay WAL data for a while,\n # despite being up to date. This can happen when a primary does not\n # receive any writes for a while.\n #\n # To prevent this from happening we check if the lag size (in bytes)\n # of the replica is small enough for the replica to be useful. We\n # only do this if we haven't replicated in a while so we only need\n # to connect to the primary when truly necessary.\n if (lag_size = replication_lag_size)\n lag_size <= load_balancer.configuration.max_replication_difference\n else\n false\n end\n end",
"def add_record(id, time = Time.now)\n record = find_world id\n @executor[id] ||= record.data[:class] == 'Dynflow::Coordinator::ExecutorWorld'\n record.data[:meta].update(:last_seen => self.class.format_time(time))\n @world.coordinator.update_record(record)\n end",
"def IsThereNewTrackers?(last_refresh, known_trackers, m_id, numMaxCoords, offset)\n trackers=[]\n attempts=Attempt.where(\"mission_id = ?\",m_id)\n #.order(tracker_id: :asc)\n # allTrackers=[]\n # attempts.each_cons(2) do |element, next_element|\n # if next_element.tracker_id != element.tracker_id\n # allTrackers.push(element.tracker_id.to_s)\n # end\n # allTrackers.push(element.tracker_id.to_s)\n # end\n # .where({ tracker_id: allTrackers})\n if (last_refresh != \"10000101\" && last_refresh != nil)#the map already contains coordinates\n datetime = last_refresh.to_datetime\n newCoords = (Coordinate.where(id: Coordinate.order(datetime: :desc).limit(numMaxCoords).where(\"datetime > ?\", datetime).where.not(tracker_id: known_trackers))).where(\"datetime > ?\", datetime).where.not(tracker_id: known_trackers).order(tracker_id: :asc)\n if (newCoords != [])\n newCoords.each_cons(2) do |element, next_element|\n if next_element.tracker_id != element.tracker_id\n if (attempts.find_by_tracker_id(element.tracker_id)!=nil) # && trackers.find(element.tracker_id.to_s) == nil)\n trackers.push(element.tracker_id.to_s)\n end\n end\n end\n if (attempts.find_by_tracker_id(newCoords.last.tracker_id)!=nil) # && trackers.find(newCoords.last.tracker_id.to_s) == nil)\n trackers.push(newCoords.last.tracker_id.to_s)\n end\n end\n return trackers\n else #the map does not have any coordinates\n if getMissionIds.size > 0 #if there is currently a mission\n if offset.to_i == 0\n start = Mission.find(m_id).start\n else\n start = (Time.now.utc-offset.to_f)\n end\n newCoords = (Coordinate.where(id: Coordinate.order(datetime: :desc).limit(numMaxCoords).where(\"datetime > ?\", start).where.not(tracker_id: known_trackers))).where(\"datetime > ?\", start).where.not(tracker_id: known_trackers).order(tracker_id: :asc)\n\n if (newCoords != [])\n \tif newCoords.size > 1\n\t\t newCoords.each_cons(2) do |element, next_element|\n\t\t if next_element.tracker_id != element.tracker_id\n if (attempts.find_by_tracker_id(element.tracker_id)!=nil) # && trackers.find(element.tracker_id.to_s) == nil)\n\t\t trackers.push(element.tracker_id.to_s)\n end\n\t\t end\n\t\t end\n if (attempts.find_by_tracker_id(newCoords.last.tracker_id)!=nil) # && trackers.find(newCoords.last.tracker_id.to_s) == nil)\n trackers.push(newCoords.last.tracker_id.to_s)\n end\n else\n if (attempts.find_by_tracker_id(newCoords.last.tracker_id)!=nil) # && trackers.find(newCoords.last.tracker_id.to_s) == nil)\n trackers.push(newCoords.last.tracker_id.to_s)\n end\n end\n end\n return trackers\n end\n end\n end",
"def movies_stale?\n Time.new - self.movies.last.updated_at >= 900\n end",
"def was_seen!\n update_attribute(:last_seen_at, Time.now) if valid? && (last_seen_at.nil? || last_seen_at < 1.hour.ago)\n end",
"def was_seen!\n update_attribute(:last_seen_at, Time.now) if valid? && (last_seen_at.nil? || last_seen_at < 1.hour.ago)\n end",
"def loaded?\n !! last_request_time\n end",
"def loaded?\n !! last_request_time\n end",
"def refresh_db_related\n return if @table_follows.empty?\n\n @first_db_entry = @table_follows.first\n @last_follow_time = @first_db_entry[:follow_time]\n end",
"def has_current_lifetime?\n if stat = self.stats.find(:first, :conditions => [\"kind = ?\",\"lifetime\"])\n return stat.current?\n else\n return false\n end\n end",
"def existed_at?(aTime)\n return @creation >= aTime\n end",
"def move_away_from_others\n \n if User.exists?(conditions: {loc: self.loc, :_id.ne => self.id, :updated_at.gt => 72.hours.ago})\n self.loc = User.move_away(self.loc)\n end\n end",
"def is_stale?\n frequency = dispatchable.frequency.name\n created_at < time_for_interval(frequency)\n end",
"def stale?\n @stale ||= Time.now.to_i - timestamp.to_i > MaximumAge\n end",
"def we_looked_up_blockchain_info_recently?\n return true if self.checkout_wallet.nil? # This condition, oddly, is met when something goes wrong during create_instant_sale and we wind up with Sales that are half made, but something went wrong creating the checkout_wallet\n lml = self.checkout_wallet.last_manual_lookup\n \n if (!lml.nil? and Time.zone.now - lml > 15.minutes) or lml.nil? or !(Time.zone.now - self.created_at < 15.minutes)\n false\n else\n true\n end\n \n end",
"def should_be_offline?\n time_ago = (update_frequency.seconds * 4.8).ago\n # Provides leeway for new stations\n if created_at > time_ago\n return false\n end\n observations.since(time_ago).order(created_at: :desc).count < 3\n end",
"def online?\n self.last_seen > 15.minutes.ago\n end",
"def check_timestamp\n @recent.save! if Time.now - @recent.updated_at >= 600\n end",
"def fetch_active_session\n Rails.logger.debug \"SessionService::fetch_active_session::BEGIN\" \n current_time = Time.now\n active_session = @company.active_sessions.where(:company_id => @company.id).where(\" ? > start_time and ? < end_time\", current_time, current_time).first\n end",
"def check_history_collision\n # puoi rientarre nello stesso momento in cui sei uscito\n # puoi uscire nello stesso momento in cui sei entrato\n if self.profile.punches\n .where('(punches.arrival <= ? AND punches.departure > ?) OR (punches.arrival < ? AND punches.departure >= ?)', self.arrival, self.arrival, self.departure, self.departure)\n .where('punches.id != ?', self.id || 0).any?\n self.errors.add(:base, \"Si interseca con altre entrate. Controllare le presenze incomplete dello studente.\")\n return false\n end\n true\n end",
"def fetch_needed?\n self.fetched_at.nil? or self.fetched_at < CONFIG[:page][:refetch_interval].seconds.ago\n end",
"def is_stale?\n remaining() > @lifetime\n end",
"def stale?\n forecasts.empty? || (Time.now - data_file.mtime) > 14_400\n end",
"def complete?\n #should probably be a boolean field 'complete' defaulting to false\n #return true if self.complete\n # self.complete = true if last mark is more than 2 hours old\n # return self.complete\n end",
"def should_index_this_document?(complete_path)\n last_itime=index_time_dbm_file[complete_path]\n @from_scratch || !last_itime || File.mtime(complete_path)> Time._load(last_itime) \n end",
"def register_last_activity_time_to_db\n return unless sorcery_config.register_last_activity_time\n return unless logged_in?\n\n current_user.set_last_activity_at(Time.current)\n end",
"def touch_via_cache(time=self.updated_at)\n time = time.utc\n #self.user.league_roles_last_updated_at = time unless self.user.nil?\n #self.league.league_roles_last_updated_at = time unless self.league.nil?\n return true\n end",
"def update_zone\n return false if @last_map_id == $game_map.map_id\n @last_map_id = map_id = $game_map.map_id\n last_zone = @zone\n # Searching for the current zone\n GameData::Zone.all.each_with_index do |data, index|\n next unless data\n if data.map_included?(map_id)\n load_zone_information(data, index)\n break\n end\n end\n return false if last_zone == @zone\n return @zone\n end",
"def update_locations_from_fireeagle\n User.transaction do\n # last_loc = self.profile.locations.current\n # self.fireeagle.user.locations.each do |loc|\n # if loc.located_at > last_loc.created_at\n # location = self.profile.locations.create!(\n # :title => loc.name,\n # :created_at => loc.located_at,\n # :latitude => loc.geo.upper_corner.x,\n # :longitude => loc.geo.upper_corner.y\n # )\n # end\n # end\n if self.settings.location and self.settings.location.located_at > self.profile.locations.current.created_at\n begin\n self.profile.locations.create!(\n :title => self.settings.location.name,\n :created_at => self.settings.location.located_at,\n :latitude => self.settings.location.geo.upper_corner.x,\n :longitude => self.settings.location.geo.upper_corner.y\n )\n rescue => e\n RAILS_DEFAULT_LOGGER.debug \"Error getting data from Fire Eagle: #{e}\"\n # notify_hoptoad(e)\n end\n end\n end\n end",
"def verify\n @cache[:last_accessed] = nil if\n @cache.has_key?(:last_accessed) &&\n @cache[:last_accessed].to_date != Date.today\n end",
"def active_at?(time)\n active_memberships.active_at(time).first\n end",
"def online?\n last_request_at && last_request_at > 20.minutes.ago\n end",
"def mobilisation_period_in_past?\n return false unless mobilisation_period_required\n\n mobilisation_start_date.to_date <= Time.now.in_time_zone('London').to_date\n end",
"def allowed_to_ship_data?\n return false if (Time.now.to_i - self.synced_at) < 43200\n return true\n end",
"def current_coordinator?(coordinator)\n coordinator == current_coordinator\n end",
"def synced?\n @mapping.database_model.exists?(@mapping.lookup_column => id)\n end",
"def seen!\n @last_seen = Time.now\n end",
"def open?\n return closetime && closetime > DateTime.now\n end",
"def fresh_at?(time)\n time >= updated_at\n end",
"def check_in(db)\n\tcurrentArr = Time.new.to_s.split(' ')\n\tdayArr = currentArr[0].split('-').join('').to_i\n\ttimeArr = currentArr[1].split(':').join('').to_i\n\tdb.execute(\"INSERT INTO log (day, time) \n\t\tVALUES (?, ?)\", [dayArr, timeArr])\n\tlog = db.execute(\"SELECT * FROM log\")\n\t# Return true if its the first check-in of the day\n\tlog.length==1 || !log[-1]['day'] == log[-2]['day']\nend",
"def ensure_zone!\n raise \"Must have active connection\" unless @zone\n end",
"def filled_by_internal_user?\n seat_reservation && time_sheet_entries.first.internal_user_start\n end",
"def access!\n today = Time.now\n if last_access.nil? || last_access < today\n update_attribute :last_access, today\n end\n end",
"def last?\n self.heat.competitors.all.size == self.place\n end",
"def db_alive?\n \t@db_alive == true\n end",
"def coordinator? event\n self.user_events.where(event: event, role: 'coordinator').count >= 1\n end",
"def is_late\n Time.current > object.deadline if object.deadline.present?\n end",
"def delete_loc_time\n delete_loc = user_choice_of_object_in_class(LocationTime)\n try_to_update_database{\n if LocationTime.delete_record(delete_loc.location_id, delete_loc.timeslot_id)\n puts \"Deleted.\"\n else\n puts \"Not deleted. This object id exists in another table.\"\n end\n }\n loc_time_menu\n end",
"def verify_recent_servers_date\n last_stored_date - date_offset\n end",
"def access!\n \n if self[:last_access].nil? || last_access < Time.now\n self[:prev_access] = self[:last_access] \n self[:last_access] = Time.now\n save\n end\n end",
"def test_loading_fresh_session_creates_record\n session = Harbor::Session.new(Harbor::Test::Request.new)\n session_from_db = get_raw_session(session[:session_id])\n \n assert_equal 1, session_records_count\n assert_equal session_from_db[:session_id], session[:session_id]\n end",
"def fresh_visit?\n visit = current_visit\n visit && visit.updated_at + Constants::Config::VISIT_STALE_AFTER > Time.now\n end",
"def ensure_activity_markers\n return if [:left, :right].any? { |db| session.configuration.send(db)[:mode] == :slave }\n\n table_name = \"#{options[:rep_prefix]}_running_flags\"\n [:left, :right].each do |database|\n connection = session.send(database)\n unless connection.tables.include? table_name\n silence_ddl_notices(database) do\n connection.create_table table_name\n connection.add_column table_name, :active, :integer\n connection.remove_column table_name, 'id'\n end\n end\n end\n end",
"def seen\n assign_attributes(last_seen_at: Time.current)\n increment(:seen_count)\n save(validate: false)\n end",
"def needed?\n !@data.exist? || out_of_date?(timestamp)\n end",
"def requires_update?\n\t\tif @twitter_account.new_record? || @twitter_account.name.nil?\n\t\t\treturn true\n\t\tend\n\n\t\treturn Time.now - @twitter_account.updated_at > 60 * CACHE_DURATION\n\tend",
"def required(login, hours: 4)\n max = @pgsql.exec(\n [\n 'SELECT MAX(teleping.updated) FROM teleping',\n 'JOIN task ON teleping.task = task.id',\n 'JOIN plan ON task.plan = plan.id',\n 'JOIN part ON plan.part = part.id',\n 'JOIN project ON project.id = part.project',\n 'WHERE project.login = $1'\n ],\n [login]\n )[0]['max']\n return true if max.nil?\n Time.parse(max) < Time.now - (hours * 60 * 60)\n end",
"def checkin_user\n\t entry_exist = time_entries.where(\"DATE(signin_time)=?\", Date.today)\n\t if entry_exist.blank?\n\t time_entries.create(signin_time: DateTime.now)\n\t end\n\tend",
"def active_session_present?\n Rails.logger.debug \"SessionService::active_session_present::BEGIN\"\n current_time = Time.now\n active_session = @company.active_sessions.where(:company_id => @company.id).where(\" ? > start_time and ? < end_time\", current_time, current_time)\n active_session.present?\n end",
"def open_at_this_time?\n now = timenow\n time_inside?(now, start_time.utc, end_time.utc)\n end",
"def loadTime()\n\t\treturn @rankedTimeDB.execute(\"SELECT idMap,name,time FROM rankedTime WHERE idMap = '#{@idMap}' ORDER BY time ASC\")\n\tend",
"def fully_fetched\n true\n end",
"def is_zone_empty?(zone_id)\n sleep 1\n records = get_zone_records(zone_id)\n # If there is any more than 2 records, the zone is not empty\n !(records.size > 2)\nend",
"def unique?\n existing_record = CONNECTION.execute(\"SELECT * FROM logs WHERE user_id = #{self.user_id} AND train_id = #{self.train_id}\")\n return existing_record == []\n end",
"def is_site_open?\n\t\tTime.use_zone(\"Mexico City\") do\n\t\t\tmex_time = Time.now.in_time_zone\n\t\t\tif AVAILABLE_TIME < 0 or mex_time.hour == AVAILABLE_TIME\n\t\t\t\treturn true\n\t\t\telse\n\t\t\t\treturn false\n\t\t\tend\n\t\tend\n\tend",
"def can_refresh?(other)\n mrrt? && (authority == other.authority) &&\n (user_info == other.user_info) && (client_id == other.client_id)\n end",
"def just_saw\n\t\t\t@last_seen = Time.now\n\t\tend",
"def valid?\n @stale == false\n end",
"def live?\n self.start_time < Time.now && Time.now < self.end_time\n end",
"def check_for_record(session, database, query, max_attempts, interval)\n found = false\n\n max_attempts.times do\n found = !!session.send(database).select_one(query)\n break if found\n sleep interval\n end\n \n found\n end",
"def existed_at?(aTime)\n return @date >= aTime\n end",
"def needs_refresh?(time)\n !refreshed_at || refreshed_at < time\n end",
"def load_cached\n if Cache.has?(@course_id)\n events = Cache.get(@course_id)\n init_calendar\n add_to_calendar(events)\n true\n else\n false\n end\n rescue\n false\n end",
"def stale?(time = Time.now)\n updated_at < time\n end",
"def check_for_record(session, database, query, max_attempts, interval)\n found = false\n\n max_attempts.times do\n found = !!session.send(database).select_one(query)\n break if found\n sleep interval\n end\n\n found\n end",
"def zone_load(serial_history, times = 0)\n pr = @predicate_factory\n predicate = pr.all(pr.qname(serial_history.zone), pr.zone_load)\n action = ActionFactory.new.zone_load(serial_history)\n ConditionalAction.new(predicate, action, times)\n end",
"def ensure_zone!\n fail \"Must have active connection\" unless @zone\n end",
"def ensure_cache_up_to_date\n self.last_update_timestamp = self.redis.get(\"bluster:last_update_timestamp\").to_i\n if self.last_update_timestamp.nil?\n update_object_cache\n elsif self.last_update_timestamp != File.new(self.objects_path).mtime.to_i\n update_object_cache\n end\n end",
"def update_login_timestamps\n if current_enrollment && current_enrollment.last_seen # when an enrollment is created, it's last_seen value is set\n \n if current_enrollment.last_seen < 4.hour.ago # 4 hours is somewhat arbitrary\n current_enrollment.events.new_session.create\n end\n\n # note that there is activity (since this before filter happens for any activity)\n current_enrollment.update_attribute(:last_seen, Time.now)\n end\n end",
"def refresh_if_near_expiration; end",
"def has_been_mandated?\n !!accessors.find(:first, :conditions => [\"accesses.requestor_id = ? AND mandated IN (?)\", person.id, ['1'] + MANDATED_STATES])\n end",
"def recent?\n Time.at(timestamp) >= 2.minutes.ago\n end",
"def new_record?\n !@exists && ldp_source.new?\n end",
"def outdated?\n Time.now - @last_used > MAX_CONN_AGE\n end",
"def last\n last_mgmt_query ||= MgmtQuery.find_by_device_id( device_id.to_i, :conditions => [\"id < ?\", id], :order => \"timestamp_server DESC\", :limit => 2) unless device_id.blank? || device_id.to_i.zero?\n end",
"def expired?\n if (self.last_retrieved == nil)\n return true\n elsif (self.time_to_live < 30.minutes)\n return (self.last_retrieved + 30.minutes) < Time.now.gmtime\n else\n return (self.last_retrieved + self.time_to_live) < Time.now.gmtime\n end\n end",
"def check_last_public_story\n return unless (user.last_public_story_id == id && !allowed_in_public_feed?) ||\n (user.last_public_story_id != id && allowed_in_public_feed?)\n\n # Get the next most recent public story that's allowed in the public feed, if there is one\n stories = NonFriendStoriesList.new(id: user.id).paginate_messages(limit: 20)\n story = stories.reverse.detect{ |story| story.allowed_in_public_feed? }\n user.update_last_public_story(story, true)\n end",
"def routing_table_aged?\n @mutex.with_read_lock { @routing_table.has_been_stale_for?(@routing_table_purge_delay) }\n end",
"def can_be_online\n date_in_one_hour = 1.hour.from_now\n if @contest.contestproblems.count == 0\n flash[:danger] = \"Un concours doit contenir au moins un problème !\"\n redirect_to @contest\n elsif @contest.contestproblems.first.start_time < date_in_one_hour\n if !Rails.env.development?\n flash[:danger] = \"Un concours ne peut être mis en ligne moins d'une heure avant le premier problème.\"\n redirect_to @contest\n else\n flash[:info] = \"Un concours ne peut être mis en ligne moins d'une heure avant le premier problème (en production).\"\n end\n end\n end",
"def moabs_eligible_for_replication\n MoabRecord.joins(:preserved_object).where(preserved_object: self, moab_records: { status: 'ok', version: current_version })\n end",
"def add_to_latest_list\n story = Story.find(self.id) \n \n if !story.lat.nil? && !story.longt.nil? && story.status == 1\n latest_list = LatestAdventure.add_to_list(story.id,'story',story.user_id)\n else\n delete_from_list = LatestAdventure.delete_from_list(story.id,'story',story.user_id) \n end \n \n end",
"def time_to_discover?\n if((@request_count%10 == 0) or (Time.now > (@last_polled_time + 10.seconds)))\n @last_polled_time = Time.now\n return true\n else\n return false\n end\n end",
"def read?(_user_id)\n conversation.conversation_members.where(user_id: _user_id).take.last_seen > created_at\n end",
"def load\n if params[:lastId].to_i > 0\n @events = Event.where(\"id > ? \", params[:lastId].to_i).order({ id: 'desc'})\n # There is no limit on this so technically\n # if a large amount of events came in, this would fail.\n else\n # returns nil if no records\n @events = Event.order({ id: 'desc'}).last(10)\n #render a view that can add on to the current home page.\n end\n render layout: false\n end",
"def add(is_full_flush)\n content_data = $local_content_data\n return if content_data.empty?\n\n # for the latest content data added to the DB\n latest_snapshot = nil\n # for instances that were added regarding latest_snapshot\n added_cd = nil\n # for insrances that were removed regarding latest_snapshot\n removed_cd = nil\n\n latest_index_time = nil\n content_data.each_instance do |_,_,_,_,_,_,index_time|\n if latest_index_time.nil? || latest_index_time < index_time.to_i\n latest_index_time = index_time.to_i\n end\n end\n\n # Checking time consistency\n content_data_timestamp = DateTime.from_epoch(latest_index_time)\n if !@latest_timestamp.nil? && (content_data_timestamp <= @latest_timestamp)\n # It is possible when instances added at @latest_timestamp\n # were removed and any new instances addded,\n # then latest indexed time in the new content data\n # is earlier then @latest_timestamp\n # Example:\n # ContentData for Date1 (noted as latest_snapshot):\n # Content1\n # location1\n # location2\n # Between Date1 and Date2 location2 was removed\n # and no other file operations were done.\n # ContentData for Date2 (noted as content_data):\n # Content1\n # location1\n # Then:\n # content_data.remove_instances(latest_snapshot) is empty.\n latest_snapshot = get(@latest_timestamp)\n added_cd = content_data.remove_instances(latest_snapshot)\n msg = \"latest index time of the content data: #{content_data_timestamp}\" +\n \"must be later then latest timestamp: #{latest_timestamp}\"\n if added_cd.empty?\n # In this case we do not know exactly when the indexation was\n # then the timestamp is fake\n # TODO better solution?\n latest_timestamp_epoch = @latest_timestamp.strftime('%s')\n content_data_timestamp = DateTime.from_epoch(latest_timestamp_epoch.to_i + 1)\n Log.warning msg\n else\n fail msg\n end\n end\n\n if is_full_flush\n save(content_data,\n DiffFile::SNAPSHOT_TYPE,\n nil, # 'from' param is not relevant for full flush\n content_data_timestamp)\n end\n\n # If it is not the first content data that we store,\n # i.e there are already stored content data,\n # then a diff files are relevant.\n # NOTE we save diff (added/removed) files even in the case of full flush\n # cause of data consistency. It is crucial for the diff operation.\n # Example (simple, without removed):\n # When:\n # date1-date2.added\n # date2-date3.added (added along with a snapshot)\n # date3.snapshot\n # date3-date4.added\n # Then:\n # ContentDataDb.diff(date2, date4) = date2-date3.added + date3-date4.added\n if @latest_timestamp.nil?\n earliest_index_time = nil\n content_data.each_instance do |_,_,_,_,_,_,index_time|\n if earliest_index_time.nil? || earliest_index_time > index_time\n earliest_index_time = index_time\n end\n end\n content_data_from = DateTime.from_epoch(earliest_index_time)\n save(content_data,\n DiffFile::ADDED_TYPE,\n content_data_from,\n content_data_timestamp)\n else\n latest_snapshot ||= get(@latest_timestamp)\n\n added_cd ||= content_data.remove_instances(latest_snapshot)\n unless added_cd.empty?\n save(added_cd,\n DiffFile::ADDED_TYPE,\n @latest_timestamp,\n content_data_timestamp)\n end\n\n removed_cd = latest_snapshot.remove_instances(content_data)\n unless removed_cd.empty?\n save(removed_cd,\n DiffFile::REMOVED_TYPE,\n @latest_timestamp,\n content_data_timestamp)\n end\n end\n\n @latest_timestamp = content_data_timestamp\n end",
"def fresh_by_time?\n return false unless env.key?(IF_MODIFIED_SINCE) && !last_modified.nil?\n Time.parse(last_modified) <= Time.parse(env.fetch(IF_MODIFIED_SINCE))\n end",
"def restaurant_in_db?(restaurant)\n restaurant.hostesses[0]\n end",
"def updateable?\n return true if @cursor == STOP\n now = Time.now\n @last_update ||= now\n now - @last_update > UPDATE_DELAY\n end",
"def editable?\n ((Time.now - self.created_at ) / 1.minute).round < MINUTES_UNTIL_UNEDITABLE\n end",
"def valid?\n return false if @last_update.nil?\n (@last_update + SecureRandom.random_number(9) + 1 <= Time.now.to_i)\n end"
] |
[
"0.54737556",
"0.5451",
"0.53868717",
"0.53526783",
"0.5323105",
"0.5323105",
"0.5298916",
"0.5298916",
"0.5277637",
"0.52180606",
"0.5167324",
"0.5094911",
"0.50887007",
"0.5088627",
"0.5065216",
"0.50643003",
"0.50152117",
"0.5013471",
"0.49971685",
"0.4965012",
"0.49443424",
"0.49387735",
"0.49089026",
"0.4897726",
"0.48870113",
"0.48839173",
"0.48804173",
"0.4876083",
"0.48708662",
"0.4870637",
"0.48676282",
"0.4862426",
"0.48566002",
"0.48382646",
"0.48286748",
"0.48233503",
"0.48167402",
"0.48088673",
"0.48002732",
"0.479873",
"0.47931775",
"0.4791893",
"0.4781894",
"0.47696942",
"0.47673059",
"0.47641864",
"0.4762486",
"0.47593346",
"0.47579384",
"0.47529334",
"0.4751113",
"0.47427246",
"0.47373742",
"0.47373694",
"0.47373122",
"0.47262836",
"0.47261012",
"0.4718505",
"0.4715679",
"0.4708126",
"0.47073793",
"0.47027788",
"0.4701143",
"0.4692872",
"0.46923345",
"0.4689349",
"0.4682151",
"0.4677944",
"0.46620813",
"0.46594298",
"0.46366802",
"0.46355858",
"0.46333036",
"0.46286276",
"0.46281677",
"0.4626085",
"0.46259058",
"0.46258414",
"0.4613238",
"0.46114805",
"0.46108952",
"0.46096423",
"0.46091124",
"0.46090156",
"0.4604402",
"0.46016502",
"0.45997423",
"0.45982617",
"0.45970455",
"0.459616",
"0.45954493",
"0.45906976",
"0.4588053",
"0.45826915",
"0.45797065",
"0.45779857",
"0.45741493",
"0.45736724",
"0.45721838",
"0.45672706"
] |
0.70421654
|
0
|
Records when was the world with provided id last seen using a PingCache
|
def add_ping_cache_record(id)
log Logger::DEBUG, "adding ping cache record for #{id}"
@ping_cache.add_record id
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def last_seen_at() ; info_time(:last_seen) ; end",
"def add_record(id, time = Time.now)\n record = find_world id\n @executor[id] ||= record.data[:class] == 'Dynflow::Coordinator::ExecutorWorld'\n record.data[:meta].update(:last_seen => self.class.format_time(time))\n @world.coordinator.update_record(record)\n end",
"def just_saw\n\t\t\t@last_seen = Time.now\n\t\tend",
"def cache_key(id); end",
"def fresh_record?(id)\n record = find_world(id)\n return false if record.nil?\n @executor[id] = record.data[:class] == 'Dynflow::Coordinator::ExecutorWorld'\n time = self.class.load_time(record.data[:meta][:last_seen])\n time >= Time.now - @max_age\n end",
"def track_user_id(id)\n key = current_key\n redis.sadd(key, id)\n #redis will reset ttl after modified\n redis.expire(key, 10.minutes)\n end",
"def ping\n self.last_ping = Time.now\n end",
"def location_name(id)\n @acpl_cache.fetch(id) { |id| fetch_new_acpl(id) || id }\n end",
"def log_activity(user_id)\n $redis.zadd(activity_key, Time.now.to_i, user_id)\n end",
"def last_visited\n\t Deck.find(params[:id]).update_attribute(:last_visited, DateTime.now)\n\tend",
"def seen!\n @last_seen = Time.now\n end",
"def seen(user)\n puts \"Should have updated last seen time for %s\" % user.to_s\n @add_seen.execute(user)\n end",
"def time(id)\n Time.at(((id >> Rubyflake::FLAKE_TIMESTAMP_SHIFT) / 1000) + @epoch)\n end",
"def now\n cache\n end",
"def last_seen(user)\n seen_when = @db.get_first_value(\"SELECT seen_at FROM last_seen WHERE user = ? COLLATE NOCASE\", user)\n puts \"Last time %s joined was last seen at timestamp \" % [user.to_s, time_ago_in_words(DateTime.parse(seen_when))]\n return \"Last time %s joined was %s ago\" % [user, time_ago_in_words(DateTime.parse(seen_when))]\n end",
"def cache_key\n \"me/#{object.id}-#{object.updated_at.utc.to_s(:number)}\"\n end",
"def filter_by_id( id )\n\t\tif @cache_for_id.include?( id )\n\t\t\tyield( @cache[@cache_for_id[ id ]] )\n\t\t\t@updated = true\n\t\telse\n\t\t\tret = Array.new()\n\t\t\t@cache_for_id.each_pair do |k,v|\n\t\t\t\tif k.index( id ) == 0\n\t\t\t\t\tyield( @cache[ v ] )\n\t\t\t\t\t@updated = true\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\t\tsave\n\tend",
"def was_seen!\n update_attribute(:last_seen_at, Time.now) if valid? && (last_seen_at.nil? || last_seen_at < 1.hour.ago)\n end",
"def was_seen!\n update_attribute(:last_seen_at, Time.now) if valid? && (last_seen_at.nil? || last_seen_at < 1.hour.ago)\n end",
"def cache_key(id)\n \"_session_id:#{id}\"\n end",
"def now\n cache\n end",
"def now\n cache\n end",
"def hit(timestamp)\n \n end",
"def ping\n @ping = Time.now\n end",
"def last_id(key, id = nil)\n ids = $configure[:twitter][:last_ids] || {}\n current_id = ids[key]\n # Save last id if id is passed\n ids[key] = id if id\n $configure[:twitter][:last_ids] = ids;\n current_id\nend",
"def last_seen_at\n @data[:last_seen_at]\n end",
"def local_ping(body)\n @var[:ping_request] = Time.now\n body = @var[:our_name] unless _user_keyhash(body)\n _remote_control(body, 'ping', 'empty')\nend",
"def connections_handler(id, ip)\n\t# show who connected\n\tputs \"[ID #{id}] connected from #{ip}\"\n\t# delete the hash entry if it already exists\n\t@clients.delete_if {|key, value| key == id }\n\t# add the new entry to the clients hash\n\t@clients[id] = { :ip => ip }\n\t#show how many clients we have\n\tputs \"Clients connected: #{@server.clients_count} of #{@server.max_clients}\"\nend",
"def on_any(r)\n prev_clock = @clock\n @clock = Time.now\n @world_time = r.time\n @message_times[r.command.to_sym] = r.time\n end",
"def time_entry(id)\n object_from_response(:get, \"time_entries/#{id}\", \"time-entry\")\n end",
"def fetch_followed\n cache(:expire_in => 2.hours).followed\n end",
"def doctors_visit(patient_id)\n patient = Patient.find(patient_id)\n patient.update(last_visited_on: DateTime.now)\nend",
"def check_cache(type, id)\n end",
"def check_cache(type, id)\n end",
"def last_edited_time\n begin\n $redis.hget 'last_edit:instrument', self.id\n rescue\n nil\n end\n end",
"def heartbeat\n not_found if be_attacking?\n \n @host.ip = request.remote_ip\n @host.updated_at = Time.now.to_time\n\n @ret = (@host.token == params[:token] && @host.save) ? @host.ip : 'false'\n end",
"def ping_time\n Time.zone.at(@packet.created_at.to_i + @device.interval_in_seconds.to_i)\n end",
"def since_id(id)\n @query[:since_id] = id\n self\n end",
"def on_pong nonce\n if @ping_nonce == nonce\n @latency_ms = (Time.now - @ping_time) * 1000.0\n end\n log.debug { \">> pong (#{nonce}), latency: #{@latency_ms.to_i}ms\" }\n end",
"def replay_hash(replay_id)\n @cache.fetch replay_hash_cache_key(replay_id) do\n replay_hash!(replay_id)\n end\n end",
"def view(obj)\n throw ArgumentError.new(\"That doesn't quack like a model!\") unless obj.respond_to?(:id)\n stores = Fatboy::Helpers.all_format(Time.now).map do |time|\n Fatboy::Helpers.format_store(obj.class.to_s, time)\n end\n @redis.pipelined do\n stores.each do |store|\n inc_member(store, obj.id)\n end\n end\n end",
"def update_cache(type, id, data)\n end",
"def update_cache(type, id, data)\n end",
"def check_cache(type, id)\n end",
"def last_seen\n recently_seen.limit(30)\n end",
"def update_cache(type, id, data)\n end",
"def record_cached?(id)\n _record_cache.has_key?(id.to_s)\n end",
"def get_heartbeat(id)\n Record.with(collection: \"#{self.class.name.demodulize.downcase}_heartbeat\") do |m|\n m.find(id)\n end\n end",
"def method_added(id)\n\t\t\t\treset_routing_cache\n\t\t\tend",
"def cache_event_xy(x,y,id)\n @exy_cache[[x,y]] ||= []\n @exy_cache[[x,y]].push(id) if !@exy_cache[[x,y]].include?(id)\n end",
"def status_from_cache ip\n clean_cache\n node['cloudflare']['threat_control']['status_cache'].fetch(ip)['status'].to_sym\nrescue KeyError\n # not found\n :none\nend",
"def loadTime()\n\t\treturn @rankedTimeDB.execute(\"SELECT idMap,name,time FROM rankedTime WHERE idMap = '#{@idMap}' ORDER BY time ASC\")\n\tend",
"def getid\n @dbtop+=1\n end",
"def last(m)\n\t\tnick = m.message.split(/\\W/)[2]\n\t\tuser = @users[nick]\n\t\tif Mailbox.exists? nick\n\t\t m.reply \"Last saw #{nick} [ #{\"%.2f\" % ((Time.now - user.last_seen) / 60 / 60)} hrs | #{user.missed_lines} lines ] ago\"\n\t end\n end",
"def created_at\n Time.at(EasyRedis.redis.zscore(prefix,@id).to_i)\n end",
"def get_unread_cache_key_for(_user_id)\n \"cache-count_pending_messages_for-#{id}-#{(last_activity || Time.current).to_i}-#{_user_id}\"\n end",
"def age(id)\n row = @pgsql.exec('SELECT executed FROM daemon WHERE id = $1', [id])[0]\n return 10_000_000_000 if row.nil?\n Time.now - Time.parse(row['executed'])\n end",
"def method_added(id)\n\t\t\t\t\treset_routing_cache\n\t\t\t\tend",
"def hourly_oneoff(response)\n auth_header = { 'Authorization': \"bearer #{config.api_key}\" }\n\n query = '\"translation--prod\" \"About to make to Endeca\"'\n uri = \"http://lululemon.loggly.com/apiv2/search?q=#{CGI::escape query}&from=-1h&until=now\"\n\n rsid_response = call_loggly(uri)\n rsid = rsid_response['rsid']['id']\n\n events = call_loggly(\"http://lululemon.loggly.com/apiv2/events?rsid=#{rsid}\")\n Lita.logger.debug \"Total requests count: #{events['total_events']}\"\n response.reply events['total_events'].to_s + ' Events'\n end",
"def get_timestamp(key, value)\n log(\"get :Deltas, #{key}, #{cache_name(value)}\")\n score = connection.get(:Deltas, key, cache_name(value))\n Time.at(score.to_f).utc\n end",
"def cache_key\n \"#{protocol}-universe\"\n end",
"def following_count(id, scope = Amico.default_scope_key)\n Amico.redis.zcard(\"#{Amico.namespace}:#{Amico.following_key}:#{scope}:#{id}\")\n end",
"def time_entry(id:)\n ::TimeEntry.find_by(id: id)\n end",
"def now_playing_user(m)\n\t\t\t\tnick = @backend.get(m.user)\n\t\t\t\tif nick\n\t\t\t\t\tartist, track = get_data(nick)\n\t\t\t\t\tm.reply(\"#{nick} has recently played: #{artist} - #{track}\")\n\t\t\t\tend\n\t\t\tend",
"def recent_latency\n Goliath::Plugin::Latency.recent_latency\n end",
"def last_seen\n return Time.now.to_date if match(/Last\\sseen\\s+:\\s(now)/)\n Date.parse(match(/Last\\sseen\\s+:\\s+(\\w+ [0-9]{2} [0-9(:?)]+ [0-9]{4})/)) rescue nil\n end",
"def log_request\n expiring_timestamp = current_timestamp + expires_in\n client.zadd(cache_key, expiring_timestamp, current_timestamp)\n end",
"def members_cache_key\n Member.cache_key_for_set(id)\n end",
"def followed_by?(id)\n self.update_cache_when_expired()\n return @idArray.include?(id)\n end",
"def update_last_edit_time\n begin\n if self.is_a? Instrument\n $redis.hset 'last_edit:instrument', self.id, self.updated_at\n elsif self.class.method_defined?(:instrument) && self.instrument.is_a?(Instrument)\n $redis.hset 'last_edit:instrument', self.instrument.id, self.updated_at\n end\n rescue\n Rails.logger.warn 'Cannot connect to Redis [update_last_edit_time]'\n end\n end",
"def cache_hit(response)\n response\n end",
"def add(id)\n redis.zadd(REDIS_KEY, new_score, id)\n end",
"def heartbeat_entry\n \"#{name} #{ip} #{Application.managed_services}\"\n end",
"def escribe_cache\n Rails.cache.write(\"cache_service_#{id}\", true, :expires_in => 1.week)\n end",
"def timestamp\n memoized_info[:local_timestamp]\n end",
"def ping_ds_name\n unless @ping_ds_name \n @ping_ds_name = all_stats((Time.now - 1).to_i, Time.now.to_i, 1)[:data][0]\n end\n @ping_ds_name \n end",
"def update_lastlyUsed(chall)\n $game_temp.lbchll_lastly_used = chall.id\n #for ch in @challenges\n # ch.lastly_used = false\n #end\n #chall.lastly_used = true\n end",
"def last_update_at\n connection.get_metric_last_update_at(@id)\n end",
"def notify(id)\n logger.info(\"Notifying snitch #{id}\")\n result = http.get('/' + id)\n logger.debug(\"Snitch notification result: #{result}\")\n result.is_a? Net::HTTPSuccess\n end",
"def record(pid, data = nil)\n pid_stats_map[pid] = Stat.new(pid, data) unless pid_stats_map[pid]\n pid_stats_map[pid].record\n end",
"def server_count(id = '__default__')\n @server_counts[id]\n end",
"def _mark name, timeout, msg = ''\n\t\treval = false\n\t\tds = Sdb[:_mark].filter(:name => name.to_s, :ip => _ip)\n\n\t\t# if no record, create one\n\t\tif ds.empty?\n\t\t\t_submit :_mark, :fkv => {:name => name.to_s}\n\t\telse\n\t\t\t# if timeout to the last log, update the changed time\n\t\t\tif _timeout?(ds.get(:changed), timeout)\n\t\t\t\tds.update(:changed => Time.now)\n\t\t\telse\n\t\t\t\treval = true\n\t\t\t\t_throw msg if msg != ''\n\t\t\tend\n\t\tend\n\n\t\treval\n\tend",
"def [](id)\n msgid = sprintf(\"%.6f\",Time.now.to_f).to_s.sub('.','-')\n msgid = @host + '-' + msgid + '-' + id.to_s\n end",
"def session_fromid(ip, idhash, meta)\n ip = \"bot\" if idhash == \"bot\"\n \n if !@sessions.key?(idhash)\n session = @ob.get_by(:Session, \"idhash\" => idhash)\n if !session\n session = @ob.add(:Session, {\n :idhash => idhash,\n :user_agent => meta[\"HTTP_USER_AGENT\"],\n :ip => ip,\n :date_lastused => Time.now\n })\n else\n session[:date_lastused] = Time.now\n end\n \n hash = {}\n @sessions[idhash] = {\n :dbobj => session,\n :hash => hash\n }\n else\n session = @sessions[idhash][:dbobj]\n hash = @sessions[idhash][:hash]\n end\n \n raise ArgumentError, \"Invalid IP.\" if ip != \"bot\" and !session.remember? and ip.to_s != session[:ip].to_s\n return [session, hash]\n end",
"def destroyed_at() ; info_time(:destroyed_datetime) ; end",
"def destroyed_at() ; info_time(:destroyed_datetime) ; end",
"def now_playing(m, nick)\n\t\t\t\tnick = CGI::escape(nick)\n\t\t\t\tartist, track = get_data(nick)\n\t\t\t\tm.reply(\"#{nick} has recently played: #{artist} - #{track}\")\n\t\t\tend",
"def get_time_of_last_game(id, region=nil)\n Time.at( Game.recent_games(id, region).first[\"createDate\"] / 1000 )\n end",
"def ping(req)\n Lynr.metrics.time('time.render:ping') do\n Rack::Response.new('PONG', 200, headers)\n end\n end",
"def counter_cache; end",
"def save_tracker_state(hash, state_ttl=@state_ttl)\n @redis.hmset(this_process_tracker_state_key, *hash.to_a.flatten)\n @redis.expireat(this_process_tracker_state_key, (hash[:state_as_of] + state_ttl).to_i)\n end",
"def cache_id\n \"#{self.class.name.underscore}:#{self.id}\"\n end",
"def seen\n assign_attributes(last_seen_at: Time.current)\n increment(:seen_count)\n save(validate: false)\n end",
"def record_project_ping_stash_time(project_name, ping_stash_time)\n record_metric(ping_stash_time, PROJECT_PROESSSING_STASH_TIME, project_name)\n end",
"def seconds_since_seen\n Time.now - (last_seen || Time.at(0))\n end",
"def cache_status(country, status)\n dump = PGconn.escape_bytea(Marshal.dump(status))\n @conn.query(\"DELETE FROM report_statuses WHERE country = '#{country}' AND road_ref = '#{status.road.ref_prefix}#{status.road.ref_number}'\")\n @conn.query(\"INSERT INTO report_statuses (road_ref, country, cached_date, status) VALUES\n ('#{status.road.ref_prefix}#{status.road.ref_number}', '#{country}', NOW(), '#{dump}')\")\n end",
"def last_updated_at\n if cache\n @last_updated_at ||= remote_last_updated_at\n else\n remote_last_updated_at\n end\n end",
"def add_to_cache\n redis.hset 'identifiers', self.typed_id, item.typed_id\n redis.sadd 'identifier:' + item.typed_id, self.typed_id\n end",
"def after_update(place)\n expire_cache_for(place)\n end",
"def record(player)\n count = losses[player]\n \"GHOST\".slice(0, count)\n end"
] |
[
"0.61532664",
"0.56334555",
"0.5567016",
"0.55406165",
"0.5500623",
"0.5338272",
"0.5311125",
"0.5244022",
"0.5236393",
"0.5226602",
"0.52120185",
"0.5211168",
"0.5197269",
"0.51751626",
"0.5146236",
"0.51421404",
"0.5099745",
"0.5097896",
"0.5097896",
"0.50839597",
"0.50773054",
"0.50773054",
"0.5069538",
"0.50188106",
"0.49902904",
"0.49829108",
"0.49779052",
"0.4951426",
"0.49347255",
"0.4885724",
"0.48788974",
"0.48705065",
"0.48663273",
"0.48663273",
"0.48653296",
"0.48605",
"0.48435766",
"0.4837247",
"0.48358363",
"0.48294973",
"0.48223323",
"0.482007",
"0.482007",
"0.48152775",
"0.48106545",
"0.480607",
"0.48017317",
"0.47936034",
"0.4791389",
"0.47744146",
"0.47714663",
"0.47674367",
"0.47673884",
"0.4761756",
"0.47542292",
"0.47534677",
"0.47419667",
"0.47399443",
"0.47284985",
"0.47265774",
"0.47257665",
"0.47252554",
"0.47180596",
"0.47076723",
"0.47046006",
"0.4689891",
"0.4685952",
"0.4683657",
"0.4682272",
"0.46814",
"0.46798202",
"0.46792525",
"0.46786743",
"0.46767932",
"0.4674616",
"0.46737707",
"0.4672137",
"0.46667913",
"0.46568826",
"0.46566245",
"0.46484613",
"0.46478608",
"0.46419948",
"0.46401814",
"0.4636843",
"0.4636843",
"0.46357316",
"0.46346125",
"0.46343938",
"0.4630777",
"0.4628408",
"0.46214738",
"0.46204498",
"0.46195906",
"0.46162918",
"0.46124342",
"0.46046582",
"0.46040252",
"0.4600075",
"0.45997986"
] |
0.6573504
|
0
|
Tries to reduce the number of sent Ping requests by first looking into a cache. If the destination world is an executor world, the result is resolved solely from the cache. For client worlds the Ping might be sent if the cache record is stale.
|
def with_ping_request_caching(request, future)
return yield unless request.is_a?(Dynflow::Dispatcher::Ping)
return yield unless request.use_cache
if @ping_cache.fresh_record?(request.receiver_id)
future.fulfill(true)
else
if @ping_cache.executor?(request.receiver_id)
future.reject false
else
yield
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def try_route_with_internal_cache(type, name)\n if host = self.cache[name]\n logger.debug \"Found '#{host}' for #{type} '#{name}' from Internal Cache.\"\n host\n else\n logger.warn \"No entry in Internal Cache...\"\n try_route_with_new_redis_connection(type, name)\n end\n end",
"def status_from_cache ip\n clean_cache\n node['cloudflare']['threat_control']['status_cache'].fetch(ip)['status'].to_sym\nrescue KeyError\n # not found\n :none\nend",
"def try_with_cache(obj, source, consume_all)\n beg = source.bytepos\n \n # Not in cache yet? Return early.\n unless entry = lookup(obj, beg)\n result = obj.try(source, self, consume_all)\n \n if obj.cached?\n set obj, beg, [result, source.bytepos-beg]\n end\n \n return result\n end\n\n # the condition in unless has returned true, so entry is not nil.\n result, advance = entry\n\n # The data we're skipping here has been read before. (since it is in \n # the cache) PLUS the actual contents are not interesting anymore since\n # we know obj matches at beg. So skip reading.\n source.bytepos = beg + advance\n return result\n end",
"def try_with_cache(obj, source, consume_all); end",
"def fetch\n @raw_result = opts_for_cache_proxy[:raw] == true\n\n result = if refresh_cache?\n execute_find(@raw_result)\n elsif cached.is_a?(AridCache::CacheProxy::Result)\n if cached.has_ids? && @raw_result\n self.cached # return it unmodified\n elsif cached.has_ids?\n fetch_from_cache # return a list of active records after applying options\n else # true if we have only calculated the count thus far\n execute_find(@raw_result)\n end\n else\n cached # some base type, return it unmodified\n end\n end",
"def geocoding_cache_lookup\n location = self.address\n puts self.address\n puts \"Problem related to redis might appear here, need to do more testing\"\n puts \"sidekiq running, reindex solr, then run server (fixed it on my end), maybe the redis version/Gemfile has an impact too\"\n begin\n redis = Redis.new\n #this was not finding a location but returning 0\n #so the condition was satistifed and it executed the code\n #weird\n if redis.exists(location)!=0 && !redis.get(location).nil?\n puts(redis.get(location))\n puts \"Seems like it can be Nil, should maybe put a condition to check if it's nil here (added)\"\n self.latitude, self.longitude = JSON.parse(redis.get(location))\n Rails.logger.info(\"Re-using: #{location}\")\n end\n rescue StandardError => e\n raise e unless Rails.env.production?\n puts \"Redis error: #{e.message}\"\n end\n end",
"def local_ping(body)\n @var[:ping_request] = Time.now\n body = @var[:our_name] unless _user_keyhash(body)\n _remote_control(body, 'ping', 'empty')\nend",
"def serve_from_cache!\n puts \"\\nServed from cache '#{request.uri}'\\n\\n\" if ::SETTINGS['debug']\n TinyProxy::Cache.get(request.uri)\n end",
"def sync\n caches = []\n from_scratch = false\n mapped = Service.nmap\n\n return if mapped.empty?\n\n # iterate through boxes, removing any who don't respond\n # so we do not waste time sending out updates to down boxes\n mapped.delete_if do |box|\n resp = Service.net_get(\"http://#{box}:3000\")\n if resp\n c = JSON.parse(resp)\n if c.empty?\n from_scratch = true\n else\n caches << [box,c]\n end\n false\n else\n true\n end\n end\n\n if from_scratch\n newest = [`hostname`.strip,Service.discovery]\n else\n newest = caches.sort{|a,b| a.last['timestamp'] <=> b.last['timestamp']}.last\n mapped.delete_if{|x| newest.first == x}\n end\n\n puts 'Sending to: ' + mapped.inspect\n\n # perform the POST, the URI is always required\n mapped.peach do |box|\n # do a post to services/set_cache\n post_uri = URI \"http://#{box}:3000/services/set_cache\"\n post = Net::HTTP::Post.new post_uri.path\n post.set_form_data 'newest' => newest.last.to_json\n if box == `hostname`.strip\n Rails.cache.write(Service.cache_key,newest.last)\n else\n http = Net::HTTP::Persistent.new box\n http.request post_uri, post\n end\n end\n render :text => \"Caches should be synced, with #{newest.first} as the winner!\"\n end",
"def preFetchFilter\n @filtered = Filter.new(@combinedWaypoints)\n debug \"Filter running cycle 1, #{caches(@filtered.totalWaypoints)} left.\"\n\n beforeFilterTotal = @filtered.totalWaypoints\n if @option['cacheType']\n # post-filter by cacheType\n @appliedFilters['-c'] = { 'f' => \"#{@option['cacheType']}\", 't' => \"type\" }\n # event+ is now all_event, unknown+ is now all_unknown\n if @option['cacheType'] !~ /\\+$/ and\n @option['cacheType'] !~ /^all_/\n # but only if there's no \"all xxx\" chosen\n # we must trust that the query returns correct data here...\n @filtered.cacheType(@option['cacheType'])\n else\n displayWarning \"Not filtering for cache type!\"\n end\n end\n excludedFilterTotal = beforeFilterTotal - @filtered.totalWaypoints\n showRemoved(excludedFilterTotal, \"Cache type\")\n\n # caches with warnings we choose not to include.\n beforeFilterTotal = @filtered.totalWaypoints\n if not @option['includeArchived']\n @filtered.removeByElement('archived')\n end\n excludedFilterTotal = beforeFilterTotal - @filtered.totalWaypoints\n showRemoved(excludedFilterTotal, \"Archived\")\n #\n beforeFilterTotal = @filtered.totalWaypoints\n if not @option['includeDisabled']\n @filtered.removeByElement('disabled')\n end\n excludedFilterTotal = beforeFilterTotal - @filtered.totalWaypoints\n showRemoved(excludedFilterTotal, \"Disabled\")\n\n # exclude Premium Member Only caches on request\n beforeFilterTotal = @filtered.totalWaypoints\n if @option['noPMO']\n @filtered.removeByElement('membersonly')\n end\n # may not be accurate before fetching details?\n if @option['onlyPMO']\n @filtered.removeByElement('membersonly', false)\n end\n excludedFilterTotal = beforeFilterTotal - @filtered.totalWaypoints\n showRemoved(excludedFilterTotal, \"PM-Only\")\n\n if $DTSFILTER\n #-------------------\n beforeFilterTotal = @filtered.totalWaypoints\n if @option['difficultyMin']\n @appliedFilters['-d'] = { 'f' => \"#{@option['difficultyMin']}\", 't' => \"difficulty min\" }\n @filtered.difficultyMin(@option['difficultyMin'].to_f)\n end\n if @option['difficultyMax']\n @appliedFilters['-D'] = { 'f' => \"#{@option['difficultyMax']}\", 't' => \"difficulty max\" }\n @filtered.difficultyMax(@option['difficultyMax'].to_f)\n end\n if @option['terrainMin']\n @appliedFilters['-t'] = { 'f' => \"#{@option['terrainMin']}\", 't' => \"terrain min\" }\n @filtered.terrainMin(@option['terrainMin'].to_f)\n end\n if @option['terrainMax']\n @appliedFilters['-T'] = { 'f' => \"#{@option['terrainMax']}\", 't' => \"terrain max\" }\n @filtered.terrainMax(@option['terrainMax'].to_f)\n end\n if @option['sizeMin']\n @appliedFilters['-s'] = { 'f' => \"#{@option['sizeMin']}\", 't' => \"size min\" }\n @filtered.sizeMin(@option['sizeMin'])\n end\n if @option['sizeMax']\n @appliedFilters['-S'] = { 'f' => \"#{@option['sizeMax']}\", 't' => \"size max\" }\n @filtered.sizeMax(@option['sizeMax'])\n end\n excludedFilterTotal = beforeFilterTotal - @filtered.totalWaypoints\n showRemoved(excludedFilterTotal, \"D/T/Size\")\n #-------------------\n end # $DTSFILTER\n\n debug \"Filter running cycle 2, #{caches(@filtered.totalWaypoints)} left.\"\n\n beforeFilterTotal = @filtered.totalWaypoints\n if @option['foundDateInclude']\n @appliedFilters['-r'] = { 'f' => \"#{@option['foundDateInclude']}\", 't' => \"found age max\" }\n @filtered.foundDateInclude(@option['foundDateInclude'].to_f)\n end\n if @option['foundDateExclude']\n @appliedFilters['-R'] = { 'f' => \"#{@option['foundDateExclude']}\", 't' => \"found age min\" }\n @filtered.foundDateExclude(@option['foundDateExclude'].to_f)\n end\n if @option['placeDateInclude']\n @appliedFilters['-j'] = { 'f' => \"#{@option['placeDateInclude']}\", 't' => \"cache age max\" }\n @filtered.placeDateInclude(@option['placeDateInclude'].to_f)\n end\n if @option['placeDateExclude']\n @appliedFilters['-J'] = { 'f' => \"#{@option['placeDateExclude']}\", 't' => \"cache age min\" }\n @filtered.placeDateExclude(@option['placeDateExclude'].to_f)\n end\n excludedFilterTotal = beforeFilterTotal - @filtered.totalWaypoints\n showRemoved(excludedFilterTotal, \"Date\")\n\n debug \"Filter running cycle 3, #{caches(@filtered.totalWaypoints)} left.\"\n\n beforeFilterTotal = @filtered.totalWaypoints\n if @option['notFound']\n @appliedFilters['-n'] = { 'f' => \"\", 't' => \"virgins\" }\n @filtered.notFound\n end\n excludedFilterTotal = beforeFilterTotal - @filtered.totalWaypoints\n showRemoved(excludedFilterTotal, \"Unfound\")\n\n beforeFilterTotal = @filtered.totalWaypoints\n if @option['travelBug']\n @appliedFilters['-b'] = { 'f' => \"\", 't' => \"trackables\" }\n @filtered.travelBug\n end\n excludedFilterTotal = beforeFilterTotal - @filtered.totalWaypoints\n showRemoved(excludedFilterTotal, \"Trackable\")\n\n beforeFilterTotal = @filtered.totalWaypoints\n if @option['ownerExclude']\n @appliedFilters['-I'] = { 'f' => \"#{@option['ownerExclude']}\", 't' => \"not owned by\" }\n @option['ownerExclude'].split($delimiters).each{ |owner|\n @filtered.ownerExclude(owner)\n }\n end\n if @option['ownerInclude']\n @appliedFilters['-i'] = { 'f' => \"#{@option['ownerInclude']}\", 't' => \"owned by\" }\n @option['ownerInclude'].split($delimiters).each{ |owner|\n @filtered.ownerInclude(owner)\n }\n end\n excludedFilterTotal = beforeFilterTotal - @filtered.totalWaypoints\n showRemoved(excludedFilterTotal, \"Owner\")\n\n beforeFilterTotal = @filtered.totalWaypoints\n if @option['userExclude']\n @appliedFilters['-E'] = { 'f' => \"#{@option['userExclude']}\", 't' => \"not done by\" }\n @option['userExclude'].split($delimiters).each{ |user|\n @filtered.userExclude(user)\n }\n end\n if @option['userInclude']\n @appliedFilters['-e'] = { 'f' => \"#{@option['userInclude']}\", 't' => \"done by\" }\n @option['userInclude'].split($delimiters).each{ |user|\n @filtered.userInclude(user)\n }\n end\n excludedFilterTotal = beforeFilterTotal - @filtered.totalWaypoints\n showRemoved(excludedFilterTotal, \"User\")\n\n beforeFilterTotal = @filtered.totalWaypoints\n if @option['titleKeyword']\n @appliedFilters['-k'] = { 'f' => \"#{@option['titleKeyword']}\", 't' => \"matching title keyword\" }\n @filtered.titleKeyword(@option['titleKeyword'])\n end\n excludedFilterTotal = beforeFilterTotal - @filtered.totalWaypoints\n showRemoved(excludedFilterTotal, \"Title\")\n\n displayMessage \"Pre-fetch filter complete, #{caches(@filtered.totalWaypoints)} left.\"\n end",
"def cache_online(mysql_conf:, ping_time:)\n query = <<~SQL\n SELECT hostname FROM lastping WHERE ping_time = '#{ping_time}'\n SQL\n online = {}\n WIKK::SQL.connect(mysql_conf) do |sql|\n sql.each_hash(query) do |row|\n online[row['hostname']] = true\n end\n end\n return online\nend",
"def _fetch\n cache_get(:_fetch) || @opts[:fetch]\n end",
"def cache_hit(response)\n response\n end",
"def do_get(request, response)\n request_path = request.unparsed_uri\n page_response = cache.get(request_path)\n\n if page_response.nil?\n destination = destination_resolver.get_destination_for_path(request_path)\n LOG.info \"cache miss, forwarding the request on to: #{destination}\"\n\n page_response = forward_request(destination)\n cache.put(request_path, page_response)\n end\n\n response.status, response.body = page_response\n end",
"def get_address(lat,lon)\n\n cached_location = nil\n\n unless DISABLE_REDIS\n begin\n uri = URI.parse(\"redis://teamfordiana:762434c9baa0934e21de1af5bf8c10c4@herring.redistogo.com:10078\")\n redis = Redis.new(:host => uri.host, :port => uri.port, :password => uri.password)\n # redis = Redis.new # err, should do this elsewhere?\n\n rescue Exception => e\n print \"redis-server is not running\\n\"\n # redis-server probabably isn't running\n end\n end\n\n coords = lat.to_s + \",\" + lon.to_s\n\n unless redis.nil?\n cached_result = redis.get(coords)\n unless cached_result.nil?\n begin\n cached_location = JSON.parse(cached_result)\n rescue\n # invalid json\n end\n end\n end\n\n if cached_location.nil?\n location = Geokit::Geocoders::GoogleGeocoder.reverse_geocode(coords).hash\n sleep(SLEEP_TIME)\n else\n location = cached_location\n end\n\n # If redis is initialized, cache google results\n unless redis.nil?\n redis.set(coords, location.to_json)\n end\n\n return location\n\nend",
"def lookup(request)\n resp = cache_entries_for(request)[request]\n return if resp.nil?\n\n resp.authoritative = false\n\n resp\n end",
"def clean_cache\n node.normal['cloudflare']['threat_control']['status_cache'].reject! { |ip, data| is_stale? data['datetime'] }\nend",
"def update!(**args)\n @cache_fill_bytes = args[:cache_fill_bytes] if args.key?(:cache_fill_bytes)\n @cache_hit = args[:cache_hit] if args.key?(:cache_hit)\n @cache_lookup = args[:cache_lookup] if args.key?(:cache_lookup)\n @cache_validated_with_origin_server = args[:cache_validated_with_origin_server] if args.key?(:cache_validated_with_origin_server)\n @latency = args[:latency] if args.key?(:latency)\n @protocol = args[:protocol] if args.key?(:protocol)\n @referer = args[:referer] if args.key?(:referer)\n @remote_ip = args[:remote_ip] if args.key?(:remote_ip)\n @request_method = args[:request_method] if args.key?(:request_method)\n @request_size = args[:request_size] if args.key?(:request_size)\n @request_url = args[:request_url] if args.key?(:request_url)\n @response_size = args[:response_size] if args.key?(:response_size)\n @server_ip = args[:server_ip] if args.key?(:server_ip)\n @status = args[:status] if args.key?(:status)\n @user_agent = args[:user_agent] if args.key?(:user_agent)\n end",
"def check_dns_cache dst_scheme, dst_host, dst_host_type, dst_port, dst_transport\n if dst_host_type == :domain and @conf[:use_dns_cache]\n dns_cache_key = \"#{dst_scheme}|#{dst_host}|#{dst_port}|#{dst_transport}\"\n if (result = @conf[:dns_cache][dns_cache_key])\n log_system_debug \"destination found in the DNS cache\" if $oversip_debug\n if result.is_a? ::Symbol\n rfc3263_failed result\n else\n rfc3263_succeeded result\n end\n return true\n else\n return dns_cache_key\n end\n else\n return nil\n end\n end",
"def define_cachedp_method\n # we don't expect this to be called more than once, but we're being\n # defensive.\n return if defined?(cached?)\n\n if defined?(::ActiveRecord) && ::ActiveRecord::VERSION::STRING >= '5.1.0'\n def cached?(payload)\n payload.fetch(:cached, false)\n end\n else\n def cached?(payload)\n payload[:name] == CACHED_QUERY_NAME\n end\n end\n end",
"def noncached_lookup(lng, lat)\n res = dstk.coordinates2politics([lat, lng])\n nbh = res[0]['politics'] ? res[0]['politics'].select { |r| r['friendly_type'] == 'neighborhood' } : nil\n nbh = nbh.first['name'] if nbh && !nbh.empty?\n nbh = 'N/A' if nbh.nil?\n {\n lng: lng,\n lat: lat,\n neighborhood: nbh\n }\n end",
"def move_to_cache\r\n true\r\n end",
"def resolve_ip_sites\n\t\tputs \"Resolve sites that contain an IP address. Update the site cache table once a hostname is found in the local host table.\" if @verbose\n\t\tupdates=Array.new\n\t\tsites=get_ip_sites\n\t\thost_tracker=Wmap::HostTracker.instance\n\t\thost_tracker.data_dir=@data_dir\n\t\thost_tracker.hosts_file = host_tracker.data_dir + \"/\" + \"hosts\"\n\t\thost_tracker.load_known_hosts_from_file\n\t\tsites.map do |site|\n\t\t\tputs \"Work on resolve the IP site: #{site}\" if @verbose\n\t\t\tip=url_2_host(site)\n\t\t\thostname=host_tracker.local_ip_2_host(ip)\n\t\t\tif hostname.nil?\n\t\t\t\tputs \"Can't resolve #{ip} from the local host store. Skip #{site}\" if @verbose\n\t\t\telse\n\t\t\t\tputs \"Host-name found for IP #{ip}: #{hostname}\" if @verbose\n\t\t\t\tupdates.push(site)\n\t\t\t\trefresh(site)\n\t\t\tend\n\t\tend\n\t\tupdates.sort!\n\t\tputs \"The following sites are now refreshed: #{updates}\" if @verbose\n\t\thost_tracker=nil\n\t\treturn updates\n\trescue Exception => ee\n\t\tputs \"Exception on method #{__method__}: #{ee}\" if @verbose\n\tend",
"def cache_look(src, dst)\n #p 'cache'\n res = @redis.get redis_key(src, dst)\n res.to_f if res\n end",
"def cache_get(target_class, *args)\n key = args.dup << target_class\n value_wrapper = @@cache[key]\n if value_wrapper.nil?\n #@@misses += 1\n #puts \"miss (#{@@hits}, #{@@misses}, #{(100.0 * @@hits / (@@hits + @@misses)).round(0)}%)\"\n return nil\n end\n #@@hits += 1\n #puts \"hit (#{@@hits}, #{@@misses}, #{(100.0 * @@hits / (@@hits + @@misses)).round(0)}%)\"\n value_wrapper[0]\n end",
"def cache\n IpFilter.cache\n end",
"def cache_or_fetch(url)\n cache_key = \"badge_host_urls/#{url}\"\n if (cache = $redis.get cache_key)\n cache\n else\n body = Curl.get(url).body_str\n $redis.set cache_key, body\n body\n end\n end",
"def cached_lookup(lng, lat)\n res = @db.execute \"SELECT * FROM coordinates where lng = #{lng.to_f} AND lat = #{lat.to_f}\"\n if res.empty?\n res = noncached_lookup(lng, lat)\n sql = \"INSERT INTO coordinates(lng, lat, neighborhood) VALUES(#{lng.to_f}, #{lat.to_f}, '#{res[:neighborhood]}')\"\n @db.execute sql\n return {\n lng: lng,\n lat: lat,\n neighborhood: res[:neighborhood]\n }\n else\n return {\n lng: lng,\n lat: lat,\n neighborhood: res[0][2]\n }\n end\n end",
"def fetch_count\n if refresh_cache?\n execute_count\n elsif cached.is_a?(AridCache::CacheProxy::Result)\n cached.has_count? ? cached.count : execute_count\n elsif cached.is_a?(Fixnum)\n cached\n elsif cached.respond_to?(:count)\n cached.count\n else\n cached # what else can we do? return it\n end\n end",
"def smart_fetch_from_cache(opts={}, &block)\n id = opts[:id]\n key = cache_key id\n force_write = opts[:force_write]\n expiration = self.expires_in\n Rails.logger.debug \"#{self.name} cache_key will be #{key}, expiration #{expiration}\"\n unless force_write\n entry = Rails.cache.read key\n if entry\n Rails.logger.debug \"#{self.name} Entry is already in cache: #{key}\"\n return (entry == NilClass) ? nil : entry\n end\n end\n wrapped_response = handling_exceptions(key, opts, &block)\n response = wrapped_response[:response]\n if wrapped_response[:exception]\n Rails.logger.debug \"#{self.name} Error occurred; writing entry to cache with short lifespan: #{key}\"\n expiration = Settings.cache.expiration.failure\n else\n Rails.logger.debug \"#{self.name} Writing entry to cache: #{key}\"\n end\n response = process_response_before_caching(response, opts)\n cached_entry = (response.nil?) ? NilClass : response\n Rails.cache.write(key,\n cached_entry,\n :expires_in => expiration,\n :force => true)\n response\n end",
"def routeChecker( target_id )\n Thread.new{\n pingMesg = { :type => \"PING\", :target_id => target_id, :sender_id => @guid, :ip_address => @localInetAddr.ip, \\\n :port => @localInetAddr.port }.to_json\n nh, m, n = nextCheckHop( target_id )\n if nh.ip != nil\n @s.send pingMesg, 0, nh.ip, nh.port\n t = Time.now.sec\n t2 = t + 10\n @checkAckWait[ nh.guid ] = 0\n while t < t2\n if @checkAckWait[ nh.guid ] == 2\n break\n end\n k = Time.now.sec\n if k != t\n t += 1\n end\n end\n end\n removeAddr( nh.guid )\n }\n end",
"def move_to_cache\n true\n end",
"def move_to_cache\n true\n end",
"def move_to_cache\n true\n end",
"def getProxy(url)\n eliteTable = []\n page = Nokogiri::HTML(RestClient.get(url))\n rawProxies = page.css('[id=\"tbl_proxy_list\"] tbody tr')\n rawProxies.each do |row|\n #ignore the table row with the ads in it :)\n if(!(row.css('td')[0].text.include? \"adsbygoogle\"))\n #select only Elite level servers (highest level of anonymity)\n if(row.css('td')[6].text.upcase.include? \"ELITE\")\n tempRow = []\n #extract ip and port vals\n for i in 0..1\n tempRow.push(row.css('td')[i].text.gsub(/\\s+/, \"\"))\n end\n #is it up?\n row.at('time.icon')['class'].include?(\"icon-check\") ? tempRow.push(true) : tempRow.push(false)\n #what's the relative speed?\n tempRow.push(row.at('div.progress-bar')['data-value'].to_f)\n #get the rest\n for i in 4..7\n tempRow.push(row.css('td')[i].text.gsub(/\\s+/, \"\"))\n end\n #re-format the up-time column into a useful integer\n #(strips the % value from the string and re-casts as int)\n tempRow[4] = (tempRow[4].split(\"%\"))[0].to_i\n #Row structure [\"IP-ADDR\",\"PORT\",BOOL UP/DOWN,FLOAT 0-100(%) relative speed,INT 0-100(%) uptime,\"COUNTRY\",\"ELITE\",\"YOUTUBE SCORE\"]\n eliteTable.push tempRow\n end #if\n end #if\n end #for\n #evaluate the 'best' proxy\n best=[\"\",\"\"] #[\"ip addr\",\"port\"]\n topScore = 0\n eliteTable.each do |row|\n if(row[2]) #if it's up\n #weight speed, then add it to uptime to produce score\n score = ((row[3] * 1.3) + row[4])\n # puts \"#{row[0]} #{row[1]} #{score}\"\n if(score > topScore)\n best[0] = row[0]\n best[1] = row[1]\n topScore = score\n end\n end\n end #each\n return best\nend",
"def ip_cycle\n if @total_proxies == 0\n @total_proxies = @current_proxy\n @current_proxy = 0\n end\n proxy_server = @proxies[@current_proxy]\n @current_proxy += 1\n @total_proxies -= 1\n proxy_server\n end",
"def otu_cached_map(otu, target, cached_map_type = 'CachedMapItem::WebLevel1', cache = true, force = false)\n r = nil\n if force\n r = aggregate_geo_json(otu, target, cached_map_type)\n else\n # Check for map\n\n # TODO: extend with synced check\n if a = CachedMap.where(project_id: sessions_current_project_id).where(otu_id: otu.id, cached_map_type: )\n end\n end\n end",
"def cache_on?; end",
"def cache_on?; end",
"def cached_lookup_allowed?\n @klass.use_activerecord_cache && arel.where_sql.nil? && arel.join_sources.empty? && @limit_value.nil? && @offset_value.nil?\n end",
"def fetch_local(new_dest, fetch_if_missing = true)\n if !File.exists? @repo.cache_path\n if fetch_if_missing\n fetch\n else\n raise \"Source cache #{@repo.cache_path} not readable.\"\n end\n end\n FileUtils.cp_r @repo.cache_path, new_dest\n end",
"def cached?; end",
"def filter_cache; end",
"def refetch_hosts?\n return false unless vima?\n return true if hosts_updated_at.nil?\n\n hosts_updated_at < Archiving.settings[:skip_host_fetch_time_period].ago\n end",
"def cache_request\n cache\n end",
"def get_cached(args)\n cache_key = gen_cache_key(args)\n\n begin\n cached_val = MongoMapper::Document.redis.get(cache_key)\n rescue Exception\n cached_val = nil\n end\n\n unless cached_val\n res = where(args)\n result_count = res.count\n if result_count == 0\n return nil\n elsif result_count == 1\n cached_val = Octo::Utils.serialize(res.first)\n MongoMapper::Document.redis.setex(cache_key, get_ttl, cached_val)\n elsif result_count > 1\n cached_val = Octo::Utils.serialize(res)\n MongoMapper::Document.redis.setex(cache_key, get_ttl, cached_val)\n end\n end\n begin\n Octo::Utils.deserialize(cached_val)\n rescue Exception => e\n Octo.logger.error e\n nil\n end\n end",
"def move_to_cache\n true\n end",
"def process\n # Do nothing if caching is off\n return nil unless data[:options][:cache]\n # There is nothing to cache if we stream things\n return nil if data[:response][:instance].is_io?\n\n cache_patterns = data[:options][:cache_patterns] || []\n opts = { :relative_path => data[:request][:relative_path],\n :request => data[:request][:instance],\n :response => data[:response][:instance],\n :verb => data[:request][:verb],\n :params => data[:request][:orig_params].dup }\n\n # Walk through all the cache patterns and find the first that matches\n cache_patterns.each do |pattern|\n # Try on the next pattern unless the current one matches.\n next unless Utils::pattern_matches?(pattern, opts)\n # Process the matching pattern.\n log(\"Request matches to cache pattern: #{pattern.inspect}\")\n # Build a cache key and get a text to be signed\n cache_key, text_to_sign = build_cache_key(pattern, opts)\n cache_record = {\n :timestamp => Time::now.utc,\n :md5 => Digest::MD5::hexdigest(text_to_sign).to_s,\n :hits => 0\n }\n log(\"Processing cache record: #{cache_key} => #{cache_record.inspect}\")\n # Save current cache key for later use (by other Routines)\n data[:vars][:cache] ||= {}\n data[:vars][:cache][:key] = cache_key\n data[:vars][:cache][:record] = cache_record\n # Get the cache storage\n storage = (data[:vars][:system][:storage][:cache] ||= {} )\n unless storage[cache_key]\n # Create a new record unless exists.\n storage[cache_key] = cache_record\n log(\"New cache record created\")\n else\n # If the record is already there but the response changed the replace the old record.\n unless storage[cache_key][:md5] == cache_record[:md5]\n storage[cache_key] = cache_record\n log(\"Missed. Record is replaced\")\n else\n # Raise if cache hits.\n storage[cache_key][:hits] += 1\n message = \"Cache hit: #{cache_key.inspect} has not changed since \" +\n \"#{storage[cache_key][:timestamp].strftime('%Y-%m-%d %H:%M:%S')}, \"+\n \"hits: #{storage[cache_key][:hits]}.\"\n log(message)\n fail CacheHit::new(\"CacheValidator: #{message}\")\n end\n end\n break\n end\n true\n end",
"def ping_responsive_except_dst?(dst)\n return false if @hops.empty?\n\n # first hop of the reverse traceroute is the destination\n for hop in @hops[1..-1]\n return false if !hop.ping_responsive && hop.historically_pingable?\n end\n\n return true\n end",
"def prefetch(reqs)\n return unless @remote\n names = reqs.map {|r| r.dependency.name }\n needed = names - @data.keys - @to_fetch\n\n @to_fetch += needed\n end",
"def download_or_update_local_cache\n # we have nothing to download if the source is a local directory\n return if source_is_local?\n # we need git for this purpose\n raise RequiredLibraryMissingError, \"git\" if `which git`.empty?\n\n # create the cache, and download or update as required\n FileUtils.mkdir_p @cache\n Dir.chdir(@cache) do\n if has_cache?\n show_info \"Repository exists in local cache..\"\n show_info \"Updating local cache..\"\n `git pull -q`\n else\n show_info \"Downloading repository to local cache..\"\n `git clone -q #{@source} .`\n end\n end\n end",
"def update_ping\n result = false\n 3.times do\n command =\n \"ping -c 1 -W #{PING_MIN_INTERVAL} #{@hostname} 2> /dev/null 1> /dev/null\"\n if system(command)\n result = true\n break\n end\n end\n\n write_cache(\"ping\", result)\n end",
"def try_route_with_redis(type, name)\n if host = self.client.get(\"gh.storage.#{type}.#{name}\")\n logger.debug \"Found host '#{host}' for #{type} '#{name}' from Router.\"\n self.cache[name] = host\n else\n self.cache.delete(name)\n end\n host\n rescue Errno::ECONNREFUSED\n logger.warn \"No connection to Router...\"\n try_route_with_internal_cache(type, name)\n end",
"def sync\n # TODO stop forcing a sync every time.\n @cache.sync\n\n if cloned?\n fetch\n else\n clone\n end\n reset\n end",
"def ping_responsive_except_dst?(dst=nil)\n return false if @hops.empty?\n\n for hop in @hops[0..-2]\n return false if !hop.ping_responsive && hop.historically_pingable?\n end\n\n # also filter out if there are a bunch of 0.0.0.0s before the\n # destination\n\n return false if @hops.size > 3 and @hops[-2].ip == \"0.0.0.0\" and @hops[-3].ip == \"0.0.0.0\"\n\n return true\n end",
"def test_ttl_eviction_on_access\n @cache.store(:a, 1)\n @cache.store(:b, 2)\n\n Timecop.freeze(Time.now + 330)\n\n @cache.store(:c, 3)\n\n assert_equal({ c: 3 }, @cache.raw[:cache])\n end",
"def get_cached_addresses(key)\n Rails.logger.debug \"PlaceSearchingController CACHE get for key #{get_cache_key(@traveler, key)}\"\n ret = Rails.cache.read(get_cache_key(@traveler, key))\n return ret.nil? ? [] : ret\n end",
"def resolve(adr)\n adr.ip = program.size\n end",
"def use_cache?\n super && !against_head?\n end",
"def use_cache?\n super && !against_head?\n end",
"def cache\n clone.tap { |crit| crit.options.merge!(:cache => true) }\n end",
"def fetch(name)\n load_cache(name)\n end",
"def without_cache(&block); end",
"def without_cache(&block); end",
"def update_node_info_cache()\n @all_stats = []\n @nodes.each { |node|\n ip = node.private_ip\n acc = AppControllerClient.new(ip, @@secret)\n\n begin\n @all_stats << acc.get_stats()\n rescue FailedNodeException\n Djinn.log_warn(\"Failed to get status update from node at #{ip}, so \" +\n \"not adding it to our cached info.\")\n end\n }\n end",
"def get_with_cache(uri)\n Scapeshift.configuration.cache.fetch [:gatherer_access, :get, uri] do\n connection.start unless connection.started?\n connection.get uri\n end\n end",
"def calculate_reactive_cache\n return unless enabled? && project && !project.pending_delete?\n\n # We may want to cache extra things in the future\n { pods: read_pods }\n end",
"def is_available_via_ssh?\n res = nil\n\n if @cache_timeout\n if @cache.has_key?(:is_available_via_ssh?)\n if (Time.now.to_i - @cache[:is_available_via_ssh?][:time]) < @cache_timeout\n @logger.debug(sprintf('using cached is_available_via_ssh?[%s] from [%s]', @cache[:is_available_via_ssh?][:status], @cache[:is_available_via_ssh?][:time]))\n return @cache[:is_available_via_ssh?][:status]\n end\n end\n end\n\n if @ssh.nil? or @ssh.closed?\n begin\n res = self.connect_ssh_tunnel()\n rescue Rouster::InternalError, Net::SSH::Disconnect, Errno::ECONNREFUSED, Errno::ECONNRESET => e\n res = false\n end\n\n end\n\n if res.nil? or res.is_a?(Net::SSH::Connection::Session)\n begin\n self.run('echo functional test of SSH tunnel')\n res = true\n rescue\n res = false\n end\n end\n\n if @cache_timeout\n @cache[:is_available_via_ssh?] = Hash.new unless @cache[:is_available_via_ssh?].class.eql?(Hash)\n @cache[:is_available_via_ssh?][:time] = Time.now.to_i\n @cache[:is_available_via_ssh?][:status] = res\n @logger.debug(sprintf('caching is_available_via_ssh?[%s] at [%s]', @cache[:is_available_via_ssh?][:status], @cache[:is_available_via_ssh?][:time]))\n end\n\n res\n end",
"def routeChecker(target_id)\n Thread.new {\n pingMsg = {:type => \"PING\", :target_id => target_id, :sender_id => @guid, :ip_address => @localInetAddr.ip, \\\n :port => @localInetAddr.port}.to_json\n nh, m, n = nextCheckHop(target_id)\n if nh.ip != nil\n @socket.send pingMsg, 0, nh.ip, nh.port\n t = Time.now.sec\n t2 = t + 10\n @checkAckWait[nh.guid] = 0\n while t < t2\n if @checkAckWait[nh.guid] == 2\n break\n end\n k = Time.now.sec\n if k != t\n t += 1\n end\n end\n end\n removeAddr(nh.guid)\n }\n end",
"def process_response_before_caching(response, opts)\n response\n end",
"def discovery_cache; end",
"def resolve_remote_head(pattern, remote = 'cache')\n super(pattern, remote)\n end",
"def resolve!\n Resolv.each_address(host) do |address|\n return @ip = address if address =~ pattern\n end\n end",
"def update_cache\n # Does nothing...up to subclasses to implement.\n end",
"def load_cached_results\n raise NotImplementedError unless workflow_by_class.respond_to?(:results)\n\n begin\n results = workflow_by_class.results(cacheable_only: true)\n update(cached_results: results.to_json)\n rescue ArgumentError\n raise NotImplementedError(\"Check that results support cacheable_only\")\n rescue StandardError => exception\n LogUtil.log_error(\n \"Error loading cached results\",\n exception: exception,\n workflow_run_id: id\n )\n return nil\n end\n end",
"def cache_query?\n false\nend",
"def cache_query?\n false\nend",
"def try_route_with_individual_storage_checks(type, name)\n self.hosts.each do |host|\n logger.debug \"Trying host '#{host}' via Smoke for existence of #{type} '#{name}'...\"\n\n svc = smoke(host)\n exist =\n case type\n when :user\n svc.user_dir_exist?(name)\n when :gist\n svc.gist_dir_exist?(name)\n else false\n end\n\n if exist\n self.cache[name] = host\n logger.debug \"Found host '#{host}' for #{type} '#{name}' from Smoke.\"\n return host\n end\n end\n logger.warn \"No host found for #{type} '#{name}'.\"\n nil\n rescue Object => e\n logger.error \"No host found for #{type} '#{name}' because of '#{e.message}'.\"\n nil\n end",
"def check_cache_validity(client)\n msg = @lookupserver.gets.chomp\n while msg.empty? do\n msg = @lookupserver.gets.chomp\n end\n accessTimeServer = Time.parse(msg)\n compare = accessTimeServer <=> @accessTimeCache\n if (compare <= 0) #Cache copy is valid\n cache_read(client)\n else\n puts @client_msg\n @lookupserver.puts(@client_msg)\n listen_fserver_read(client)\n end\n end",
"def serve_from_remote!\n uri = URI.parse(request.uri)\n\n req = Net::HTTP::Get.new(uri.path)\n req.initialize_http_header(request.options)\n http_response = Net::HTTP.new(uri.host, uri.port).start do |http|\n http.open_timeout = http.read_timeout = ::SETTINGS['http_timeout']\n http.request(req)\n end\n\n response = wrap_response(http_response)\n if response.cacheable?\n puts \"\\nCaching '#{request.uri}'\" if ::SETTINGS['debug']\n TinyProxy::Cache.add(request.uri, response)\n end\n response\n rescue Timeout::Error, Errno::EINVAL, Errno::ECONNRESET, EOFError, SocketError,\n Net::HTTPBadResponse, Net::HTTPHeaderSyntaxError, Net::ProtocolError => e\n puts \"NetHTTP Error occured\"\n error_response(e.message)\n end",
"def find_reusable_order\n return # FIXME: currently it may return address which is being used by other active order\n expired_orders = find_expired_orders_row\n if expired_orders.size >= Config.reuse_address_orders_threshold &&\n fetch_transactions_for(expired_orders.last.address).empty?\n return expired_orders.last\n end\n nil\n end",
"def location\n \t#@ip = request.remote_id\n \t@ip = '118.113.226.34'\n \t@location = Rails.cache.read(@ip)\n end",
"def using_local_cache?\n @use_local_cache == true\n end",
"def find_least_loaded_host(name)\n partition = partition_hex(name)\n self.hosts.select { |h| storage_server_online?(h) }.map do |host|\n [self.client.get(\"gh.storage.server.usage.percent.#{host}.#{partition}\").to_f, host]\n end.sort.first.last\n end",
"def unused_ip args = {}\n # first check if we already have a record for this host\n # if we do, we can simply reuse the same ip address.\n if args[:mac] and r=has_mac?(args[:mac], :all) and valid_range(args).include?(r.ip)\n logger.debug \"Found an existing dhcp record #{r}, reusing...\"\n return r.ip\n end\n\n free_ips = valid_range(args) - records.collect{|r| r.ip}\n if free_ips.empty?\n logger.warn \"No free IPs at #{to_s}\"\n return nil\n else\n @index = 0\n begin\n # Read and lock the storage file\n stored_index = get_index_and_lock(\"foreman-proxy_#{network}_#{cidr}.tmp\")\n\n free_ips.rotate(stored_index).each do |ip|\n logger.debug \"Searching for free IP - pinging #{ip}\"\n if tcp_pingable?(ip) or icmp_pingable?(ip)\n logger.info \"Found a pingable IP(#{ip}) address which does not have a Proxy::DHCP record\"\n else\n logger.debug \"Found free IP #{ip} out of a total of #{free_ips.size} free IPs\"\n @index = free_ips.index(ip)+1\n return ip\n end\n end\n logger.warn \"No free IPs at #{to_s}\"\n rescue Exception => e\n logger.debug e.message\n ensure\n # ensure we unlock the storage file\n set_index_and_unlock @index\n end\n nil\n end\n end",
"def cache_collect\n\t\tRepository.repo.get_from_cache(@template)\n\tend",
"def cached\n raise NotImplementedError\n end",
"def cache_topology?\n @cache_topology\n end",
"def check_website(url)\n check_number = 4 # Number of proxy that we will test the website with\n check_complete = false # Variable that define the status of a check\n responses = [] # Will be use to store response code for each proxy\n run_number = 0 # How many times we tried to get a return code from a proxies group\n entries_to_skip = 0 # Will be use to have uniq group of proxy\n proxies_location = [] # Location of proxies we used\n proxy_data = {}\n\n # Let's check if we are using cache for response code\n feature_flag = YAML.load_file(File.join(File.dirname(__FILE__), '../config/feature_flag.yml'))\n\n if feature_flag['cache_response_code']\n response_available = Redisdb.is_hash_cached(url)\n\n if response_available\n check_complete = true\n responses << response_available['response']\n proxy_data['cities'] = response_available['cities']\n @logger.debug \"Getting response code #{response_available} from the cache for #{url}\"\n end\n end\n\n entries_to_skip = 0\n\n while check_complete != true\n begin\n while responses.count != check_number\n proxy = Proxy.get(1, entries_to_skip)[0]\n response_code = Http.get_response_code(url, proxy['server_ip'], proxy['port'].to_i)\n @logger.debug \"Checked website #{url} got HTTP response code #{response_code} using proxy #{proxy['server_ip']}:#{proxy['port']}\"\n analyse_result = analyse_http_code(response_code)\n\n if analyse_result\n responses << analyse_result\n proxies_location << proxy['city']\n else\n Proxy.delete(proxy['server_ip'])\n end\n entries_to_skip += 1\n\n end\n\n # If after 4 valid return code, all are identical the process is complete\n # If not identical, we empty the array and start over\n if responses.uniq.length == 1\n check_complete = true\n\n if feature_flag['cache_response_code']\n # Caching the response code for 1 hour\n\n proxy_data['response'] = responses.uniq[0]\n proxy_data['cities'] = proxies_location.join(',')\n proxy_data['time'] = Time.now().utc.to_i\n @logger.debug proxy_data\n\n redis = Redisdb.new()\n redis.hmset(url, proxy_data, 3600)\n end\n else\n @logger.debug(\"[http]We did not get 4 identical responses code #{responses.inspect}\")\n responses = []\n proxy_data['cities'] = []\n proxies_location = []\n # We will use a different proxy group for each attempt\n # We will skeep N * number_proxy_to_use entries to have a new group every time\n run_number += 1\n @logger.debug \"entries_to_skip = run_number * check_number\"\n @logger.debug \"#{entries_to_skip} #{run_number} #{check_number}\"\n entries_to_skip = run_number * check_number\n end\n # If no proxy available\n rescue NotEnoughProxyAvailable => e\n @logger.error \"[#{self.class}]#{e.message}\"\n check_complete = true\n responses << 4444\n rescue StandardError => e\n @logger.error \"[#{self.class}]#{e.message}\"\n @logger.error e.backtrace\n check_complete = true\n responses << 5555\n end\n end # While check_complete\n\n if responses.uniq[0].to_i == 200 or responses.uniq[0].to_i == 302 or responses.uniq[0].to_i == 301\n answer = 'No'\n elsif responses.uniq[0].to_i == 4444\n answer = 'No proxies available, please try your test later'\n elsif responses.uniq[0].to_i == 5555\n answer = 'Oops, something went wrong'\n else\n answer = 'Yes'\n end\n\n return { 'response' => answer, 'cities' => proxy_data['cities']}\n end",
"def cache; end",
"def cache; end",
"def cache; end",
"def cache; end",
"def cache; end",
"def cache; end",
"def cache; end",
"def warm_cache\n return if @max_cache.zero?\n\n future = Concurrent::Future.new(args: [self, @performer], executor: executor) do |thr_scheduler, thr_performer|\n Rails.application.executor.wrap do\n thr_performer.next_at(\n limit: @max_cache,\n now_limit: @executor_options[:max_threads]\n ).each do |scheduled_at|\n thr_scheduler.create_thread({ scheduled_at: scheduled_at })\n end\n end\n end\n\n observer = lambda do |_time, _output, thread_error|\n GoodJob._on_thread_error(thread_error) if thread_error\n create_task # If cache-warming exhausts the threads, ensure there isn't an executable task remaining\n end\n future.add_observer(observer, :call)\n future.execute\n end",
"def calculate_solution\n Solve.it!(\n GraphBuilder.graph_from_cache(@cache, @options),\n resolver.constraints\n )\n end",
"def poll\n unless memcached_nodes.empty?\n memcached_nodes.each do | hostname_port |\n stats_text = issue_stats hostname_port \n if stats_text.present?\n @last_stats[hostname_port] = parse_and_report_stats hostname_port, stats_text\n else\n @last_stats[hostname_port] = {}\n end \n end\n\n aggregate_stats\n logger.debug \"Done with aggs\" \n end\n end",
"def fetch_historical_pingability!(outage)\n all_hop_sets = [outage.historical_tr, outage.spoofed_tr, outage.historical_revtr]\n\n for hop in outage.historical_tr\n if !(hop.reverse_path.nil?) && hop.reverse_path.valid?\n all_hop_sets << hop.reverse_path \n end\n end\n\n all_hop_sets << outage.spoofed_revtr if outage.spoofed_revtr.valid? # might contain a symbol. hmmm... XXX\n all_targets = Set.new\n all_hop_sets.each { |hops| all_targets |= (hops.map { |hop| hop.ip }) }\n\n ip2lastresponsive = @db.fetch_pingability(all_targets.to_a)\n\n @logger.debug { \"fetch_historical_pingability(), ip2lastresponsive #{ip2lastresponsive.inspect}\" }\n\n # update historical reachability\n all_hop_sets.each do |hop_set|\n hop_set.each { |hop| hop.last_responsive = ip2lastresponsive[hop.ip] }\n end\n end"
] |
[
"0.5506904",
"0.5448852",
"0.536698",
"0.5194941",
"0.5173094",
"0.51420766",
"0.5075313",
"0.5038279",
"0.49995124",
"0.49597052",
"0.49459925",
"0.49328312",
"0.48977798",
"0.48755512",
"0.48401",
"0.4835775",
"0.48188362",
"0.48129246",
"0.48111284",
"0.47891805",
"0.47847918",
"0.47822195",
"0.4779136",
"0.4753348",
"0.4725363",
"0.47226754",
"0.46936134",
"0.46893468",
"0.46828413",
"0.4678599",
"0.4676796",
"0.46743813",
"0.46743813",
"0.46743813",
"0.46733403",
"0.46724302",
"0.46491912",
"0.46483174",
"0.46483174",
"0.46279874",
"0.4617988",
"0.46050256",
"0.46016523",
"0.45985484",
"0.4596325",
"0.45951852",
"0.45814654",
"0.45740187",
"0.4572123",
"0.45655078",
"0.45642248",
"0.45494965",
"0.45460516",
"0.4545667",
"0.45435676",
"0.45421234",
"0.45414412",
"0.454125",
"0.45339608",
"0.45339608",
"0.45264518",
"0.45257705",
"0.4518482",
"0.4518482",
"0.45177743",
"0.4517341",
"0.45170414",
"0.45167604",
"0.45156282",
"0.45108968",
"0.45094183",
"0.45036626",
"0.4499742",
"0.44941923",
"0.44887096",
"0.44842526",
"0.44842526",
"0.44805658",
"0.44781852",
"0.4463004",
"0.4456473",
"0.44537202",
"0.44478783",
"0.4445589",
"0.4440486",
"0.44384748",
"0.44322425",
"0.44305605",
"0.44244727",
"0.44234648",
"0.44234648",
"0.44234648",
"0.44234648",
"0.44234648",
"0.44234648",
"0.44234648",
"0.44133574",
"0.44082332",
"0.43963867",
"0.4392081"
] |
0.58573693
|
0
|
GET /dor_masters GET /dor_masters.json
|
def index
@dor_masters = DorMaster.all
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def index\n @djrmasters = Djrmaster.all\n end",
"def index\n @masters = Master.all\n end",
"def index\n @masters = Master.all.paginate(page: params[:page], per_page: 200)\n end",
"def index\n @town_masters = TownMaster.all\n end",
"def index\n @masterservices = Masterservice.all\n end",
"def index\n @landmasters = Landmaster.all\n end",
"def show\n @deck = Deck.find(params[:id])\n @masters = @deck.masters\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @deck }\n end\n end",
"def index\n @source_masters = SourceMaster.all\n end",
"def index\n @distros = getmydata(\"Distro\")\n pagination\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @distros }\n end\n end",
"def index\n @ac_masters = AcMaster.all\n end",
"def index\n @document_masters = DocumentMaster.all\n end",
"def show\n @distro = Distro.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @distro }\n end\n end",
"def show\n @distro = Distro.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @distro }\n end\n end",
"def index\n @pagemasters = Pagemaster.all\n end",
"def show_domains\n render json: dme.show_domains\n end",
"def index\n @majors = majors\n respond_to do |format|\n format.json{\n return render json: ret\n }\n end\n end",
"def index\n @financer_masters = FinancerMaster.all\n end",
"def index\n @society_masters = SocietyMaster.all\n end",
"def index\n @mirrors = Mirror.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @mirrors }\n end\n end",
"def index\n @coasters = Coaster.all\n\n render json: @coasters\n end",
"def index\n @accident_masters = AccidentMaster.all\n end",
"def masters\n @masters ||= {}\n \n if @masters.empty?\n master_links.each do |master_link|\n master_class_name = master_link.master_type\n master_class = master_class_name.constantize\n @masters[master_class_name] ||= []\n @masters[master_class_name] << master_class.where(id: master_link.master_id).limit(1)\n end\n end\n\n return @masters\n end",
"def index\n if params[:q].present?\n @q = CelloMaster.ransack(params[:q])\n @cello_masters = @q.result.order('created_at')\n else\n @q = CelloMaster.ransack(params[:q])\n @cello_masters = CelloMaster.all.order('created_at').paginate(page: params[:page], per_page: 15)\n end\n end",
"def index\n @drugmasters = Drugmaster.all\n end",
"def index\n @service_master = ServiceMaster.new\n @service_masters = ServiceMaster.all\n end",
"def masters\n @master_configs ||= get_masters\n end",
"def index\n @mercado_meta = MercadoMetum.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @mercado_meta }\n end\n end",
"def masteries(summoner_ids)\n neated_param = neat_params(summoner_ids)\n masteries = get(resource_path_by_id('masteries', neated_param), @version)\n masteries.map do |mastery|\n RiotGamesApi::LOL::Model::Summoner::MasteryPageList.new(mastery.last)\n end\n# { masteries.keys.first.to_i => ) }\n end",
"def show\n @childmaster = Childmaster.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @childmaster }\n end\n end",
"def index\n @denuncia = Denuncium.all\n\n render json: @denuncia\n end",
"def index\n @terminal_masters = TerminalMaster.all\n end",
"def index\n @late_mark_masters = LateMarkMaster.all\n end",
"def index\n @service_type_masters = ServiceTypeMaster.all\n end",
"def index\n @movers = Mover.all\n\n render json: @movers\n end",
"def index\n @datacenters = Datacenter.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @datacenters }\n end\n end",
"def index\n find_organismos\n respond_to do |format|\n format.html # index.html.erb\n format.json {render json: @organismos }\n end\n end",
"def index\n @dnas = Dna.all\n\n render json: @dnas\n end",
"def index\n #@maker_masters = MakerMaster.all\n\t\n\t@q = MakerMaster.ransack(params[:q]) \n @maker_masters = @q.result(distinct: true)\n @maker_masters = @maker_masters.page(params[:page])\n\n end",
"def index\n @allocation_masters = AllocationMaster.all\n end",
"def show\n @conductor = Conductor.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @conductor }\n end\n end",
"def show\n @conductor = Conductor.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @conductor }\n end\n end",
"def show\n render json: @archdiocese\n end",
"def index\n @pharmaceutical_masters = PharmaceuticalMaster.page(params[:page])\n # @pharmaceutical_masters = PharmaceuticalMaster.all\n end",
"def set_dor_master\n @dor_master = DorMaster.find(params[:id])\n end",
"def index\n @division_syns = DivisionSyn.all\n\n render json: @division_syns\n end",
"def index\n # if we have plan to use paginate\n # @kinodoms = Kinodom.paginate :page => params[:page], :order => 'id DESC'\n @kinodoms = Kinodom.all\n @kinodom = Kinodom.new\n respond_with(@kinodoms, :location=>kinodoms_path )\n end",
"def index\n @dinos = Dino.where(query_params)\n render json: @dinos\n end",
"def movie_data\n response = RestClient.get(\"critics.api.mks.io/movie-genres\")\n JSON.parse(response)\nend",
"def index\n @builds = Build.all\n render json: @builds\n end",
"def index\n @setors = Setor.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @setors }\n end\n end",
"def index\n if @patron\n @patron_merges = @patron.patron_merges.order('patron_merges.id').page(params[:page])\n elsif @patron_merge_list\n @patron_merges = @patron_merge_list.patron_merges.order('patron_merges.id').includes(:patron).page(params[:page])\n else\n @patron_merges = PatronMerge.page(params[:page])\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @patron_merges }\n end\n end",
"def show\n @momsg = Momsg.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @momsg }\n end\n end",
"def index\n @hot_masters = HotMaster.page(params[:page])\n # @hot_masters = HotMaster.all\n end",
"def index\n @directorforms = Directorform.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @directorforms }\n end\n end",
"def index\n @servers = getmydata(\"Server\")\n\tpagination\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @servers }\n end\n end",
"def index\n respond_to do |format|\n format.html do \n @sites = Site.all\n end\n format.json do\n render json: Site.all\n end\n end\n end",
"def index\n @site_setups = SiteSetup.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @site_setups }\n end\n end",
"def index\n @delivery_men = DeliveryMan.all\n\n render json: @delivery_men, :each_serializer => ShortDeliveryManSerializer\n end",
"def index\n @relaciones_articulos_medida = RelacionArticuloMedida.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @relaciones_articulos_medida }\n end\n end",
"def index\n @groupons = Groupon.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @groupons }\n end\n end",
"def index\n @cargo_manifests = CargoManifest.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @cargo_manifests }\n end\n end",
"def index\n @payment_site_masters = PaymentSiteMaster.all\n end",
"def merms\n response = Merm.__elasticsearch__.search(\n query: {\n bool: {\n must: [\n {\n term: {owner_id: current_user.id}\n },\n {\n term: {expired: false}\n }\n ]\n }\n },\n _source: [\"id\", \"name\"],\n sort: { last_accessed: {order: \"desc\"}},\n size: 1000\n ).results\n\n render json: {\n results: response.results,\n total: response.total\n }\n end",
"def index\n @medical_camps = MedicalCamp.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @medical_camps }\n end\n end",
"def index\n\t\t@domains = Domain.all\n\t\trespond_to do |format|\n\t\t\tformat.json { render json: @domains }\n\t\tend\n\tend",
"def show\n @short_domain = ShortDomain.find(params[:id], :include => { :short_urls => :short_domain })\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @short_domain }\n end\n end",
"def show\n @gasto = Gasto.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @gasto }\n end\n end",
"def create\n @dor_master = DorMaster.new(dor_master_params)\n\n respond_to do |format|\n if @dor_master.save\n format.html { redirect_to @dor_master, notice: 'Dor master was successfully created.' }\n format.json { render :show, status: :created, location: @dor_master }\n else\n format.html { render :new }\n format.json { render json: @dor_master.errors, status: :unprocessable_entity }\n end\n end\n end",
"def servers\n endpoint = 'https://pcs.baidu.com/rest/2.0/pcs/manage?method=listhost'\n @res = @api.request_json( endpoint )\n end",
"def list_masterings_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: MasteringApi.list_masterings ...\"\n end\n # resource path\n local_var_path = \"/masterings\"\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['bearer']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'Array<Mastering>')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: MasteringApi#list_masterings\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def index\n @root_cause_masters = RootCauseMaster.all\n end",
"def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @prefix_group }\n end\n end",
"def index\n @unidade_medidas = UnidadeMedida.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @unidade_medidas }\n end\n end",
"def index\n @kouteimasters = Kouteimaster.all\n end",
"def show\n #@my_ministry = MyMinistry.find(params[:id])\n @coworker = Coworker.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @my_ministry }\n end\n end",
"def index\n @title = \"Doctor List\"\n @medics = Medic.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @medics }\n end\n end",
"def show\n @charge_master = ChargeMaster.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @charge_master }\n end\n end",
"def index\n @rembursmentmaster = Rembursmentmaster.new\n @rembursmentmasters = Rembursmentmaster.all\n end",
"def index\n @archdioceses = Archdiocese.all\n\n render json: @archdioceses\n end",
"def index\n @carbon_monoxides = CarbonMonoxide.all\n render json: @carbon_monoxides\n end",
"def masteries\n fetch('games.league_of_legends.masteries')\n end",
"def show\n @director = Director.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @director }\n end\n end",
"def show\n @museum = Museum.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @museum }\n end\n end",
"def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @patron_merge }\n end\n end",
"def show\n @agente = Agente.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @agente } \n end\n end",
"def index\n @mush_crawlers = MushCrawler.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @mush_crawlers }\n end\n end",
"def show\n @ministerio = Ministerio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ministerio }\n end\n end",
"def index\n @municipios = Municipio.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @municipios }\n end\n end",
"def index\n @region_masters = RegionMaster.all.order(created_at: :desc)\n end",
"def show\n render json: @dino\n end",
"def index\n @master_memorials = Master::Memorial.all\n end",
"def index\n @ordens = Orden.all\n render json: @ordens\n end",
"def index\n @mld_mates = MldMate.all\n end",
"def index\n @heroes = Hero.all\n\n render json: @heroes\n end",
"def index\n @servers = Server.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @servers.to_json(:include => { :websites => {:include => :plugins } }) }\n end\n end",
"def index\n @ordenes = Orden.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ordenes }\n end\n end",
"def index\n @sites = Site.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @sites }\n end\n end",
"def index\n @sites = Site.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @sites }\n end\n end",
"def show\n @domain_map = DomainMap.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @domain_map }\n end\n end",
"def index\n @mesasredondas = Mesasredonda.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @mesasredondas }\n end\n end"
] |
[
"0.6960988",
"0.68790364",
"0.64194214",
"0.64019245",
"0.63474435",
"0.62803537",
"0.6245516",
"0.62290746",
"0.6191616",
"0.6131362",
"0.61055446",
"0.60811263",
"0.60811263",
"0.60555166",
"0.6026892",
"0.6005102",
"0.6000466",
"0.5991465",
"0.5956027",
"0.59559053",
"0.5933713",
"0.5923911",
"0.59230083",
"0.59169495",
"0.59037936",
"0.5900088",
"0.5869605",
"0.5863379",
"0.5855061",
"0.5851531",
"0.5836698",
"0.58301544",
"0.58116",
"0.58036447",
"0.5793304",
"0.5787443",
"0.5761158",
"0.5738412",
"0.57310355",
"0.57205236",
"0.57205236",
"0.5714865",
"0.5709358",
"0.5688442",
"0.5686003",
"0.5670951",
"0.56668943",
"0.56646526",
"0.56569993",
"0.5652854",
"0.56393546",
"0.5631956",
"0.5605778",
"0.55852276",
"0.5575828",
"0.5574483",
"0.5570547",
"0.55610186",
"0.55602187",
"0.55563325",
"0.55532587",
"0.5545742",
"0.554518",
"0.55418456",
"0.5541742",
"0.5522",
"0.5521241",
"0.5518206",
"0.5517057",
"0.55118155",
"0.55096525",
"0.55083275",
"0.55069965",
"0.5499287",
"0.5499051",
"0.54975396",
"0.5486843",
"0.54859537",
"0.5484992",
"0.5483145",
"0.5480346",
"0.54803413",
"0.5475948",
"0.5471225",
"0.54708177",
"0.5470686",
"0.5467321",
"0.5467206",
"0.5464233",
"0.5461874",
"0.5461164",
"0.54564184",
"0.5456224",
"0.5454429",
"0.5450178",
"0.544974",
"0.5449094",
"0.5449094",
"0.5447793",
"0.5447059"
] |
0.728603
|
0
|
GET /dor_masters/1 GET /dor_masters/1.json
|
def show
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def index\n @dor_masters = DorMaster.all\n \n end",
"def index\n @masters = Master.all\n end",
"def index\n @djrmasters = Djrmaster.all\n end",
"def show\n @distro = Distro.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @distro }\n end\n end",
"def show\n @distro = Distro.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @distro }\n end\n end",
"def show\n @deck = Deck.find(params[:id])\n @masters = @deck.masters\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @deck }\n end\n end",
"def index\n @distros = getmydata(\"Distro\")\n pagination\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @distros }\n end\n end",
"def index\n @masters = Master.all.paginate(page: params[:page], per_page: 200)\n end",
"def show\n @childmaster = Childmaster.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @childmaster }\n end\n end",
"def index\n @town_masters = TownMaster.all\n end",
"def show\n @conductor = Conductor.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @conductor }\n end\n end",
"def show\n @conductor = Conductor.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @conductor }\n end\n end",
"def index\n @masterservices = Masterservice.all\n end",
"def index\n @landmasters = Landmaster.all\n end",
"def index\n @majors = majors\n respond_to do |format|\n format.json{\n return render json: ret\n }\n end\n end",
"def index\n @mirrors = Mirror.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @mirrors }\n end\n end",
"def index\n @source_masters = SourceMaster.all\n end",
"def set_dor_master\n @dor_master = DorMaster.find(params[:id])\n end",
"def index\n @coasters = Coaster.all\n\n render json: @coasters\n end",
"def index\n @ac_masters = AcMaster.all\n end",
"def index\n @service_master = ServiceMaster.new\n @service_masters = ServiceMaster.all\n end",
"def show\n @momsg = Momsg.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @momsg }\n end\n end",
"def show\n @charge_master = ChargeMaster.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @charge_master }\n end\n end",
"def index\n @mercado_meta = MercadoMetum.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @mercado_meta }\n end\n end",
"def index\n @society_masters = SocietyMaster.all\n end",
"def show\n #@my_ministry = MyMinistry.find(params[:id])\n @coworker = Coworker.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @my_ministry }\n end\n end",
"def index\n @document_masters = DocumentMaster.all\n end",
"def index\n @terminal_masters = TerminalMaster.all\n end",
"def show\n @missionmaker = Missionmaker.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @missionmaker }\n end\n end",
"def index\n @denuncia = Denuncium.all\n\n render json: @denuncia\n end",
"def show\n @ministerio = Ministerio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ministerio }\n end\n end",
"def index\n @financer_masters = FinancerMaster.all\n end",
"def show\n render json: @archdiocese\n end",
"def index\n @accident_masters = AccidentMaster.all\n end",
"def index\n find_organismos\n respond_to do |format|\n format.html # index.html.erb\n format.json {render json: @organismos }\n end\n end",
"def index\n @drugmasters = Drugmaster.all\n end",
"def masteries(summoner_ids)\n neated_param = neat_params(summoner_ids)\n masteries = get(resource_path_by_id('masteries', neated_param), @version)\n masteries.map do |mastery|\n RiotGamesApi::LOL::Model::Summoner::MasteryPageList.new(mastery.last)\n end\n# { masteries.keys.first.to_i => ) }\n end",
"def show\n @moresmallarmorinfo = Moresmallarmorinfo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @moresmallarmorinfo }\n end\n end",
"def index\n @datacenters = Datacenter.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @datacenters }\n end\n end",
"def show\n id = params[:id]\n @datacenter = Datacenter.any_of({_id: id}, {name: id.gsub('-', '.')}).first\n @schema = self.schema\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @datacenter }\n end\n end",
"def index\n @pagemasters = Pagemaster.all\n end",
"def index\n @division_syns = DivisionSyn.all\n\n render json: @division_syns\n end",
"def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @patron_merge }\n end\n end",
"def show_domains\n render json: dme.show_domains\n end",
"def show\n @mini_map_road = MiniMapRoad.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @mini_map_road }\n end\n end",
"def index\n if params[:q].present?\n @q = CelloMaster.ransack(params[:q])\n @cello_masters = @q.result.order('created_at')\n else\n @q = CelloMaster.ransack(params[:q])\n @cello_masters = CelloMaster.all.order('created_at').paginate(page: params[:page], per_page: 15)\n end\n end",
"def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @prefix_group }\n end\n end",
"def show\n @mercado_metum = MercadoMetum.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @mercado_metum }\n end\n end",
"def index\n @service_type_masters = ServiceTypeMaster.all\n end",
"def show\n @agente = Agente.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @agente } \n end\n end",
"def show\n @museum = Museum.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @museum }\n end\n end",
"def show\n @distraction = Distraction.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @distraction }\n end\n end",
"def show\n @short_domain = ShortDomain.find(params[:id], :include => { :short_urls => :short_domain })\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @short_domain }\n end\n end",
"def index\n @movers = Mover.all\n\n render json: @movers\n end",
"def show\n @relacion_articulo_medida = RelacionArticuloMedida.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @relacion_articulo_medida }\n end\n end",
"def show\n #@server_nodes = ServerNode.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @server_node }\n end\n end",
"def show\n @mostsmallroad = Mostsmallroad.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @mostsmallroad }\n end\n end",
"def index\n if @patron\n @patron_merges = @patron.patron_merges.order('patron_merges.id').page(params[:page])\n elsif @patron_merge_list\n @patron_merges = @patron_merge_list.patron_merges.order('patron_merges.id').includes(:patron).page(params[:page])\n else\n @patron_merges = PatronMerge.page(params[:page])\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @patron_merges }\n end\n end",
"def show\n @gasto = Gasto.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @gasto }\n end\n end",
"def show\n @moresmallmobsquad = Moresmallmobsquad.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @moresmallmobsquad }\n end\n end",
"def movie_data\n response = RestClient.get(\"critics.api.mks.io/movie-genres\")\n JSON.parse(response)\nend",
"def index\n # if we have plan to use paginate\n # @kinodoms = Kinodom.paginate :page => params[:page], :order => 'id DESC'\n @kinodoms = Kinodom.all\n @kinodom = Kinodom.new\n respond_with(@kinodoms, :location=>kinodoms_path )\n end",
"def index\n @allocation_masters = AllocationMaster.all\n end",
"def index\n @builds = Build.all\n render json: @builds\n end",
"def index\n @dinos = Dino.where(query_params)\n render json: @dinos\n end",
"def index\n @dnas = Dna.all\n\n render json: @dnas\n end",
"def show\n @municipio_dominio = MunicipioDominio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @municipio_dominio }\n end\n end",
"def index\n @servers = getmydata(\"Server\")\n\tpagination\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @servers }\n end\n end",
"def index\n @pharmaceutical_masters = PharmaceuticalMaster.page(params[:page])\n # @pharmaceutical_masters = PharmaceuticalMaster.all\n end",
"def show\n @major = Major.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @major }\n end\n end",
"def show\n @server1 = Server1.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @server1 }\n end\n end",
"def show\n @director = Director.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @director }\n end\n end",
"def show\n @groupon = Groupon.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @groupon }\n end\n end",
"def index\n @relaciones_articulos_medida = RelacionArticuloMedida.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @relaciones_articulos_medida }\n end\n end",
"def index\n @setors = Setor.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @setors }\n end\n end",
"def show\n render json: @dino\n end",
"def masters\n @master_configs ||= get_masters\n end",
"def masters\n @masters ||= {}\n \n if @masters.empty?\n master_links.each do |master_link|\n master_class_name = master_link.master_type\n master_class = master_class_name.constantize\n @masters[master_class_name] ||= []\n @masters[master_class_name] << master_class.where(id: master_link.master_id).limit(1)\n end\n end\n\n return @masters\n end",
"def show\n @corp_location = CorpLocation.get(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @corp_location }\n end\n end",
"def get_master_release(master_release_id)\n query_and_build \"masters/#{master_release_id}\"\n end",
"def show\n @brand = Brand.find(params[:id])\n @makers = @brand.makers\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @brand }\n end\n end",
"def create\n @dor_master = DorMaster.new(dor_master_params)\n\n respond_to do |format|\n if @dor_master.save\n format.html { redirect_to @dor_master, notice: 'Dor master was successfully created.' }\n format.json { render :show, status: :created, location: @dor_master }\n else\n format.html { render :new }\n format.json { render json: @dor_master.errors, status: :unprocessable_entity }\n end\n end\n end",
"def show\n @odontologo = Odontologo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @odontologo }\n end\n end",
"def show\n @dinosaur = Dinosaur.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @dinosaur }\n end\n end",
"def show\n @monnaie = Monnaie.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @monnaie }\n end\n end",
"def show\n @data_center = DataCenter.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @data_center }\n end\n end",
"def index\n @groupons = Groupon.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @groupons }\n end\n end",
"def show\n @commander = Commander.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @commander }\n end\n end",
"def show\n @mencion = Mencion.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @mencion }\n end\n end",
"def index\n @cargo_manifests = CargoManifest.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @cargo_manifests }\n end\n end",
"def index\n #@maker_masters = MakerMaster.all\n\t\n\t@q = MakerMaster.ransack(params[:q]) \n @maker_masters = @q.result(distinct: true)\n @maker_masters = @maker_masters.page(params[:page])\n\n end",
"def show\n @seguidore = Seguidore.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @seguidore }\n end\n end",
"def show\n @name_server = NameServer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @name_server }\n end\n end",
"def show\n @canon = Canon.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @canon }\n end\n end",
"def show\n render json: Server.where(name: params[:name]).first\n end",
"def index\n @medical_camps = MedicalCamp.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @medical_camps }\n end\n end",
"def show\n @domain_map = DomainMap.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @domain_map }\n end\n end",
"def show\n @governor = Governor.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @governor }\n end\n end",
"def show\n @organismo = Organismo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @organismo }\n end\n end",
"def show\n @crawl_request = CrawlRequest.find(params[:id])\n\n render json: @crawl_request\n end",
"def index\n @late_mark_masters = LateMarkMaster.all\n end"
] |
[
"0.70674694",
"0.6753521",
"0.6730584",
"0.6461148",
"0.6461148",
"0.6327087",
"0.6272245",
"0.6239664",
"0.62156254",
"0.61957324",
"0.61737627",
"0.61737627",
"0.6163546",
"0.61025316",
"0.60730755",
"0.60434246",
"0.6039213",
"0.6011654",
"0.60007054",
"0.59532195",
"0.59399736",
"0.59396863",
"0.59326893",
"0.5927622",
"0.58905977",
"0.5876424",
"0.5855279",
"0.5850223",
"0.58479124",
"0.58280075",
"0.58234006",
"0.58070934",
"0.57944745",
"0.5788146",
"0.578325",
"0.5783052",
"0.57782954",
"0.57696444",
"0.5766312",
"0.576543",
"0.57636523",
"0.57547575",
"0.57529837",
"0.57468927",
"0.5743053",
"0.5740011",
"0.5737825",
"0.5735391",
"0.57345694",
"0.57314116",
"0.5730251",
"0.57287365",
"0.57283825",
"0.5727725",
"0.5727429",
"0.5721894",
"0.57189316",
"0.5712531",
"0.5710843",
"0.5704351",
"0.5703897",
"0.5700202",
"0.5693214",
"0.56897444",
"0.56895304",
"0.56737304",
"0.5663163",
"0.5659152",
"0.56576544",
"0.56562185",
"0.56403846",
"0.5629023",
"0.56261367",
"0.5621291",
"0.5620756",
"0.5617419",
"0.56157786",
"0.56138325",
"0.56099516",
"0.560891",
"0.5602456",
"0.5600703",
"0.5598496",
"0.5596159",
"0.5594481",
"0.55923146",
"0.559229",
"0.5590179",
"0.55885786",
"0.558695",
"0.55842775",
"0.55770946",
"0.55755866",
"0.55715036",
"0.5571398",
"0.5569642",
"0.55662185",
"0.5564385",
"0.556382",
"0.5563358",
"0.55631536"
] |
0.0
|
-1
|
POST /dor_masters POST /dor_masters.json
|
def create
@dor_master = DorMaster.new(dor_master_params)
respond_to do |format|
if @dor_master.save
format.html { redirect_to @dor_master, notice: 'Dor master was successfully created.' }
format.json { render :show, status: :created, location: @dor_master }
else
format.html { render :new }
format.json { render json: @dor_master.errors, status: :unprocessable_entity }
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def create\n @master = Master.new(master_params)\n\n respond_to do |format|\n if @master.save\n format.html { redirect_to @master, notice: 'Master was successfully created.' }\n format.json { render :show, status: :created, location: @master }\n else\n format.html { render :new }\n format.json { render json: @master.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @maker_master = MakerMaster.new(maker_master_params)\n\n respond_to do |format|\n if @maker_master.save\n format.html { redirect_to @maker_master, notice: 'Maker master was successfully created.' }\n format.json { render :show, status: :created, location: @maker_master }\n else\n format.html { render :new }\n format.json { render json: @maker_master.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @djrmaster = Djrmaster.new(djrmaster_params)\n\n respond_to do |format|\n if @djrmaster.save\n format.html { redirect_to @djrmaster, notice: 'Djrmaster was successfully created.' }\n format.json { render :show, status: :created, location: @djrmaster }\n else\n format.html { render :new }\n format.json { render json: @djrmaster.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @regions = RegionMaster.all\n @districts = DistrictMaster.all\n\n @town_master = TownMaster.new(town_master_params)\n prefix = @town_master.name\n @town_master.town_id = TownMaster.gen_assigned_code(prefix)\n town_idd = @town_master.town_id\n\n respond_to do |format|\n if @town_master.save\n format.html { redirect_to @town_master, notice: \"Town master was successfully created.\" }\n format.json { render :show, status: :created, location: @town_master }\n else\n logger.info \"Here ===== #{@town_master.errors.messages.inspect}\"\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @town_master.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @dor_masters = DorMaster.all\n \n end",
"def create\n @childmaster = Childmaster.new(params[:childmaster])\n\n respond_to do |format|\n if @childmaster.save\n format.html { redirect_to @childmaster, notice: 'Childmaster was successfully created.' }\n format.json { render json: @childmaster, status: :created, location: @childmaster }\n else\n format.html { render action: \"new\" }\n format.json { render json: @childmaster.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_master\n @rider = Rider.new(rider_params)\n @rider.rider_type = 'master'\n\n respond_to do |format|\n if @rider.save\n format.html { redirect_to master_rider_path(@rider), notice: 'Rider was successfully created.' }\n format.json { render :show_master, status: :created, location: @rider }\n else\n format.html { render :new_master }\n format.json { render json: @rider.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @landmaster = Landmaster.new(landmaster_params)\n \n respond_to do |format|\n if @landmaster.save\n format.html { redirect_to landmasters_path, notice: 'Landmaster was successfully created.' }\n format.json { render :show, status: :created, location: @landmaster }\n else\n format.html { render :new }\n format.json { render json: @landmaster.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @pagemaster = Pagemaster.new(pagemaster_params)\n\n respond_to do |format|\n if @pagemaster.save\n format.html { redirect_to @pagemaster, notice: 'Pagemaster was successfully created.' }\n format.json { render :show, status: :created, location: @pagemaster }\n else\n format.html { render :new }\n format.json { render json: @pagemaster.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @master = Master.new(master_params)\n respond_to do |format|\n if @master.save\n session[:last_master_id] = @master.id\n format.html { redirect_to master_url(@master), notice: \"Master was successfully created.\" }\n format.json { render :show, status: :created, location: @master }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @master.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @society_master = SocietyMaster.new(society_master_params)\n\n respond_to do |format|\n if @society_master.save\n format.html { redirect_to @society_master, notice: 'Society master was successfully created.' }\n format.json { render :show, status: :created, location: @society_master }\n else\n format.html { render :new }\n format.json { render json: @society_master.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @djrmasters = Djrmaster.all\n end",
"def create\n @customermaster = Customermaster.new(customermaster_params)\n\n respond_to do |format|\n if @customermaster.save\n format.html { redirect_to customermasters_url, notice: 'Customermaster was successfully created.' }\n format.json { render :show, status: :created, location: @customermaster }\n else\n format.json { render json: @customermaster.errors, status: :unprocessable_entity }\n format.html { redirect_to customermasters_url, notice: 'Customermaster Not successfully created.' }\n\n end\n end\n end",
"def create\n @source_master = SourceMaster.new(source_master_params)\n\n respond_to do |format|\n if @source_master.save\n format.html { redirect_to @source_master, notice: \"Source master was successfully created.\" }\n format.json { render :show, status: :created, location: @source_master }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @source_master.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n TargetsForm.new(target_params).save\n\n respond_to do |format|\n format.html { redirect_to after_write_path, notice: 'Targets were successfully created.' }\n format.json { render :show, status: :created, location: @target }\n end\n end",
"def create\n @dino = Dino.new(dino_params)\n\n if @dino.save\n render json: @dino, status: :created, location: @dino\n else\n render json: @dino.errors, status: :unprocessable_entity\n end\n end",
"def create\n @cello_master = CelloMaster.new(cello_master_params)\n respond_to do |format|\n if @cello_master.save\n format.html { redirect_to @cello_master, notice: 'Cello master was successfully created.' }\n format.json { render :show, status: :created, location: @cello_master }\n else\n format.html { render :new }\n format.json { render json: @cello_master.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @employee_master = EmployeeMaster.new(employee_master_params)\n\n respond_to do |format|\n if @employee_master.save\n format.html { redirect_to @employee_master, notice: '社員情報が作成されました' }\n format.json { render action: 'show', status: :created, location: @employee_master }\n else\n set_masters;\n format.html { render 'new' }\n format.json { render json: @employee_master.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n megam_rest.post_node(to_hash)\n end",
"def create\n gen_code = \n @countries = CountryMaster.all\n\n @region_master = RegionMaster.new(region_master_params)\n c_code = @region_master.country_code\n prefix = @region_master.name\n @region_master.region_code = RegionMaster.get_special_code(prefix)\n @region_master.region_id = RegionMaster.gen_assigned_code(c_code,prefix)\n\n respond_to do |format|\n if @region_master.save\n format.html { redirect_to @region_master, notice: \"Region master was successfully created.\" }\n format.json { render :show, status: :created, location: @region_master }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @region_master.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @masters = Master.all\n end",
"def create\n @suburb_master = SuburbMaster.new(suburb_master_params)\n\n respond_to do |format|\n if @suburb_master.save\n @city_town_masters = CityTownMaster.all.paginate(:page => params[:page], :per_page => 5).order('id desc')\n format.js { flash.now[:notice] = \"Suburb was successfully created\"}\n format.html { redirect_to @suburb_master, notice: 'Suburb master was successfully created.' }\n format.json { render :show, status: :created, location: @suburb_master }\n else\n @city_town_masters = CityTownMaster.all\n format.js {render :new }\n format.html { render :new }\n format.json { render json: @suburb_master.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @payment_site_master = PaymentSiteMaster.new(payment_site_master_params)\n\n respond_to do |format|\n if @payment_site_master.save\n format.html { redirect_to @payment_site_master, notice: 'Payment site master was successfully created.' }\n format.json { render 'show', status: :created, location: @payment_site_master }\n else\n format.html { render 'new' }\n format.json { render json: @payment_site_master.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @masterservice = Masterservice.new(masterservice_params)\n\n respond_to do |format|\n if @masterservice.save\n format.html { redirect_to @masterservice, notice: 'Masterservice was successfully created.' }\n format.json { render :show, status: :created, location: @masterservice }\n else\n format.html { render :new }\n format.json { render json: @masterservice.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @onda = Onda.new(onda_params)\n\n respond_to do |format|\n if @onda.save\n format.html { redirect_to ondas_path, notice: 'Onda was successfully created.' }\n format.json { render :show, status: :created, location: @onda }\n else\n format.html { render :new }\n format.json { render json: @onda.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @wardmaster = Wardmaster.new(params[:wardmaster])\n\n respond_to do |format|\n if @wardmaster.save\n format.html { redirect_to(@wardmaster, :notice => 'Wardmaster was successfully created.') }\n format.xml { render :xml => @wardmaster, :status => :created, :location => @wardmaster }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @wardmaster.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @childmaster = Childmaster.new(params[:childmaster])\n\n respond_to do |format|\n if @childmaster.save\n format.html { redirect_to(@childmaster, :notice => 'Childmaster was successfully created.') }\n format.xml { render :xml => @childmaster, :status => :created, :location => @childmaster }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @childmaster.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @hot_master = HotMaster.new(hot_master_params)\n\n respond_to do |format|\n if @hot_master.save\n format.html { redirect_to @hot_master, notice: CREATE_NOTICE }\n format.json { render :show, status: :created, location: @hot_master }\n else\n format.html { render :new }\n format.json { render json: @hot_master.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @distro = Distro.new(distro_params)\n\n respond_to do |format|\n if @distro.save\n format.html { redirect_to @distro, notice: 'Distro was successfully created.' }\n format.json { render action: 'show', status: :created, location: @distro }\n else\n format.html { render action: 'new' }\n format.json { render json: @distro.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @ac_master = AcMaster.new(ac_master_params)\n\n respond_to do |format|\n if @ac_master.save\n format.html { redirect_to @ac_master, notice: 'Ac master was successfully created.' }\n format.json { render :show, status: :created, location: @ac_master }\n else\n format.html { render :new }\n format.json { render json: @ac_master.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @town_masters = TownMaster.all\n end",
"def create\n @mother_son = MotherSon.new(mother_son_params)\n\n respond_to do |format|\n if @mother_son.save\n format.html { redirect_to @mother_son, notice: \"Mother son was successfully created.\" }\n format.json { render :show, status: :created, location: @mother_son }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @mother_son.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @stone = Stone.new(stone_params)\n\n \n if @stone.save\n respond_with @stone\n else\n render json: @stone.errors, status: :unprocessable_entity \n end\n \n \n end",
"def create\n @pharmaceutical_master = PharmaceuticalMaster.new(pharmaceutical_master_params)\n\n respond_to do |format|\n if @pharmaceutical_master.save\n format.html { redirect_to @pharmaceutical_master, notice: CREATE_NOTICE }\n format.json { render :show, status: :created, location: @pharmaceutical_master }\n else\n format.html { render :new }\n format.json { render json: @pharmaceutical_master.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_dor_master\n @dor_master = DorMaster.find(params[:id])\n end",
"def create\n @nodo = Nodo.new(nodo_params)\n\n respond_to do |format|\n if @nodo.save\n #format.html { redirect_to @nodo, notice: 'Nodo was successfully created.' }\n #format.json { render action: 'show', status: :created, location: @nodo }\n format.html { redirect_to nodos_url }\n format.json { head :no_content }\n else\n format.html { render action: 'new' }\n format.json { render json: @nodo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @document_master = DocumentMaster.new(document_master_params)\n\n respond_to do |format|\n if @document_master.save\n format.html { redirect_to @document_master, notice: 'Document Master was successfully created.' }\n format.json { render :show, status: :created, location: @document_master }\n else\n format.html { render :new }\n format.json { render json: @document_master.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @ward_master = WardMaster.new(params[:ward_master])\n\t @session = Session.find(session[:id])\n @person = Person.find(@session.person_id)\n @org_code = @person.org_code\n @org_location = @person.org_location\n respond_to do |format|\n if @ward_master.save\n format.html { redirect_to(\"/ward_masters/new\", :notice => 'WardMaster was successfully created.') }\n format.xml { render :xml => @ward_master, :status => :created, :location => @ward_master }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @ward_master.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @service_type_master = ServiceTypeMaster.new(service_type_master_params)\n\n respond_to do |format|\n if @service_type_master.save\n format.html { redirect_to @service_type_master, notice: 'Service type master was successfully created.' }\n format.json { render action: 'show', status: :created, location: @service_type_master }\n else\n format.html { render action: 'new' }\n format.json { render json: @service_type_master.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @drugmaster = Drugmaster.new(drugmaster_params)\n\n respond_to do |format|\n if @drugmaster.save\n format.html { redirect_to @drugmaster, notice: 'Drugmaster was successfully created.' }\n format.json { render :show, status: :created, location: @drugmaster }\n else\n format.html { render :new }\n format.json { render json: @drugmaster.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n #@server_node = ServerNode.new(params[:server_node])\n #@server_node = ServerNode.create() do |n|\n # n.name = params[:node][:name]\n\t# n.region = params[:node][:region]\n\t# n.status = params[:node][:status]\n\n #end\n\n respond_to do |format|\n if @server_node.save\n format.html { redirect_to @server_node, notice: 'Server node was successfully created.' }\n format.json { render json: @server_node, status: :created, location: @server_node }\n else\n format.html { render action: \"new\" }\n format.json { render json: @server_node.errors, status: :unprocessable_entity }\n end\n end\n end",
"def dor_master_params\n params.require(:dor_master).permit(:date, :user_id)\n end",
"def create\n @master_memorial = Master::Memorial.new(master_memorial_params)\n\n respond_to do |format|\n if @master_memorial.save\n format.html { redirect_to master_memorials_path, notice: 'Memorial was successfully created.' }\n format.json { render :show, status: :created, location: @master_memorial }\n else\n format.html { render :new }\n format.json { render json: @master_memorial.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @dna = Dna.new(dna_params)\n\n if @dna.save\n render json: @dna, status: :created, location: @dna\n else\n render json: @dna.errors, status: :unprocessable_entity\n end\n end",
"def create\n @scout_master = ScoutMaster.new(params[:scout_master])\n\n respond_to do |format|\n if @scout_master.save\n format.html { redirect_to(@scout_master, :notice => 'Scout master was successfully created.') }\n format.xml { render :xml => @scout_master, :status => :created, :location => @scout_master }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @scout_master.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @onshore_yard = OnshoreYard.new(onshore_yard_params)\n\n respond_to do |format|\n if @onshore_yard.save\n format.html { redirect_to @onshore_yard, notice: 'Onshore yard was successfully created.' }\n format.json { render :show, status: :created, location: @onshore_yard }\n else\n format.html { render :new }\n format.json { render json: @onshore_yard.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @financer_master = FinancerMaster.new(financer_master_params)\n\n respond_to do |format|\n if @financer_master.save\n format.html { redirect_to @financer_master, notice: 'Financer Master was successfully created.' }\n format.json { render :show, status: :created, location: @financer_master }\n else\n format.html { render :new }\n format.json { render json: @financer_master.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @dino = Dino.new(dino_params)\n\n respond_to do |format|\n if @dino.save\n format.html { redirect_to @dino, notice: 'Post was successfully created.' }\n format.json { render :show, status: :created, location: @dino }\n else\n format.html { render :new }\n format.json{ render json: @dino.errors, status: :unprocessable_entity }\n end\n end\nend",
"def destroy\n @dor_master.destroy\n respond_to do |format|\n format.html { redirect_to dor_masters_url, notice: 'Dor master was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def create\n @molecule_synonym = MoleculeSynonym.new(molecule_synonym_params)\n\n respond_to do |format|\n if @molecule_synonym.save\n format.html { redirect_to @molecule_synonym, notice: 'Molecule synonym was successfully created.' }\n format.json { render :show, status: :created, location: @molecule_synonym }\n else\n format.html { render :new }\n format.json { render json: @molecule_synonym.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @childmaster = Childmaster.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @childmaster }\n end\n end",
"def maker_master_params\n params.require(:maker_master).permit(:maker_name)\n end",
"def create\n @master_ea = MasterEa.new(master_ea_params)\n\n respond_to do |format|\n if @master_ea.save\n format.html { redirect_to @master_ea, notice: 'Master ea was successfully created.' }\n format.json { render :show, status: :created, location: @master_ea }\n else\n format.html { render :new }\n format.json { render json: @master_ea.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n\t@bedmaster = Bedmaster.new(params[:bedmaster])\n\n respond_to do |format|\n if @bedmaster.save\n format.html { redirect_to(@bedmaster, :notice => 'Bedmaster was successfully created.') }\n format.xml { render :xml => @bedmaster, :status => :created, :location => @bedmaster }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @bedmaster.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @municipio_dominio = MunicipioDominio.new(params[:municipio_dominio])\n\n respond_to do |format|\n if @municipio_dominio.save\n format.html { redirect_to @municipio_dominio, :notice => 'Municipio dominio was successfully created.' }\n format.json { render :json => @municipio_dominio, :status => :created, :location => @municipio_dominio }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @municipio_dominio.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @agente = Agente.find(params[:agente_id])\n @hijo = @agente.hijos.build(hijo_params)\n\n respond_to do |format|\n if @hijo.save\n format.html { redirect_to agente_hijos_path(@agente), notice: 'El hijo fué creado exitosamente.' }\n format.json { render :show, status: :created, location: @hijo }\n else\n format.html { render :new }\n format.json { render json: @hijo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @citymaster = Citymaster.new(params[:citymaster])\n\t@state=Statemaster.find_by_name(@citymaster.state_name)\n\t@citymaster.statemaster_id=@state.id\n respond_to do |format|\n if @citymaster.save\n format.html { redirect_to(@citymaster, :notice => 'Citymaster was successfully created.') }\n format.xml { render :xml => @citymaster, :status => :created, :location => @citymaster }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @citymaster.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @hero = Hero.new(hero_params)\n\n if @hero.save\n render json: @hero, status: :created, location: @hero\n else\n render json: @hero.errors, status: :unprocessable_entity\n end\n end",
"def create\n megam_rest.post_promos(to_hash) #WONT BE USED AS OF NOW\n end",
"def create\n @usermaster = Usermaster.new(params[:usermaster])\n\n respond_to do |format|\n if @usermaster.save\n format.html { redirect_to(@usermaster, :notice => 'Usermaster was successfully created.') }\n format.xml { render :xml => @usermaster, :status => :created, :location => @usermaster }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @usermaster.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def add_tenant_circle(args = {}) \n post(\"/tenantcircles.json/\", args)\nend",
"def town_master_params\n params.require(:town_master).permit(:region_id, :town_id, :district_id, :name, :town_center_gps, :active_status, :del_status)\n end",
"def create\n @ministerio = Ministerio.new(params[:ministerio])\n\n respond_to do |format|\n if @ministerio.save\n format.html { redirect_to @ministerio, notice: 'Ministerio was successfully created.' }\n format.json { render json: @ministerio, status: :created, location: @ministerio }\n else\n format.html { render action: \"new\" }\n format.json { render json: @ministerio.errors, status: :unprocessable_entity }\n end\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 create\n @server = Server.new(server_params)\n @neo = Neography::Rest.new\n\n respond_to do |format|\n if @server.save && n = Neography::Node.create(\"name\" => server_params[:name])\n n.add_to_index('servers', 'name', server_params[:name])\n n.id = n.neo_id # this construct should be improved..\n format.html { redirect_to @server, notice: 'Server was successfully created.' }\n format.json { render :show, status: :created, location: @server }\n else\n format.html { render :new }\n format.json { render json: @server.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @homeroom = Homeroom.new(homeroom_params)\n\n respond_to do |format|\n if @homeroom.save\n format.html { redirect_to @homeroom, notice: 'Homeroom was successfully created.' }\n format.json { render :show, status: :created, location: @homeroom }\n else\n format.html { render :new }\n format.json { render json: @homeroom.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create \n cartoon_ad = CartoonAd.create(cartoon_ad_params)\n render json: cartoon_ad\n end",
"def create\n @map = CampaignMap.new(map_params)\n if is_dungeon_master?\n @map.campaign = @campaign\n if @map.save\n render json: @map, status: :created\n else\n render json: @map.errors, status: :unprocessable_entity\n end\n else\n render json: @map.errors, status: :forbidden\n end\n end",
"def create\n @conductor = Conductor.new(conductor_params)\n\n if @conductor.save\n render :show, status: :created, location: @conductor\n else\n render json: @conductor.errors, status: :unprocessable_entity\n end\n end",
"def create\n @archdiocese = Archdiocese.new(archdiocese_params)\n\n if @archdiocese.save\n render json: @archdiocese, status: :created, location: @archdiocese\n else\n render json: @archdiocese.errors, status: :unprocessable_entity\n end\n end",
"def create\n @short_domain = ShortDomain.new(params[:short_domain])\n puts @short_domain.inspect\n\n respond_to do |format|\n if @short_domain.save\n format.html { redirect_to @short_domain, notice: 'Short domain was successfully created.' }\n format.json { render json: @short_domain, status: :created, location: @short_domain }\n else\n format.html { render action: \"new\" }\n format.json { render json: @short_domain.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @maintainer = Maintainer.new(maintainer_params)\n\n respond_to do |format|\n if @maintainer.save\n format.html { redirect_to @maintainer, notice: 'Maintainer was successfully created.' }\n format.json { render :show, status: :created, location: @maintainer }\n else\n format.html { render :new }\n format.json { render json: @maintainer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @allocation_master = AllocationMaster.new(allocation_master_params)\n\n respond_to do |format|\n if @allocation_master.save\n format.html { redirect_to @allocation_master, notice: 'Allocation master was successfully created.' }\n format.json { render :show, status: :created, location: @allocation_master }\n else\n format.html { render :new }\n format.json { render json: @allocation_master.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @pagemasters = Pagemaster.all\n end",
"def create\n @ministry_child = MinistryChild.new(params[:ministry_child])\n\n respond_to do |format|\n if @ministry_child.save\n format.html { redirect_to ministry_path(@ministry_child.ministry.id), notice: 'Ministry child was successfully created.' }\n format.json { render json: @ministry_child, status: :created, location: @ministry_child }\n else\n format.html { render action: \"new\" }\n format.json { render json: @ministry_child.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @ministry_child = MinistryChild.new(ministry_child_params)\n\n respond_to do |format|\n if @ministry_child.save\n format.html { redirect_to @ministry_child, notice: 'Ministry child was successfully created.' }\n format.json { render :show, status: :created, location: @ministry_child }\n else\n format.html { render :new }\n format.json { render json: @ministry_child.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @agent = @business.agents.new(agent_params)\n\n respond_to do |format|\n if @agent.save\n format.html { redirect_to business_agent_path(@business, @agent), notice: 'Agent was successfully created.' }\n format.json { render json: @agent, status: :created, location: @agent }\n else\n format.html {\n \t@padma_users = @business.try(:padma).try(:users) \n \trender action: \"new\" \n }\n format.json { render json: @agent.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n\n respond_to do |format|\n if @target = current_user.targets.create(target_params)\n format.html { redirect_to index_home_path, notice: 'Target was successfully created.' }\n format.json { render :show, status: :created, location: @target }\n else\n format.html { render :new, alert: 'An error ocurred while creating the target.' }\n format.json { render json: @target.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @tree = Tree.new(params[:tree])\n @tree.synclatlon\n respond_to do |format|\n if @tree.save\n format.html { redirect_to @tree, notice: 'Tree was successfully created.' }\n format.json { render json: @tree, status: :created, location: @tree }\n else\n format.html { render 'new' }\n format.json { render json: @tree.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @samochod = Samochod.new(samochod_params)\n\n respond_to do |format|\n if @samochod.save\n format.html { redirect_to @samochod, notice: 'Samochod was successfully created.' }\n format.json { render :show, status: :created, location: @samochod }\n else\n format.html { render :new }\n format.json { render json: @samochod.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n response = post_request(URI.parse(\"http://\"+(sesh :donabe_ip)+\"/\"+(sesh :current_tenant)+\"/containers.json\"), params[:container].to_json, (sesh :current_token))\n json_respond response.body \n\n end",
"def index\n @service_master = ServiceMaster.new\n @service_masters = ServiceMaster.all\n end",
"def create\n @designationmaster = Designationmaster.new(params[:designationmaster])\n\n respond_to do |format|\n if @designationmaster.save\n format.html { redirect_to(@designationmaster, :notice => 'Designationmaster was successfully created.') }\n format.xml { render :xml => @designationmaster, :status => :created, :location => @designationmaster }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @designationmaster.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @motorista = Motorista.new(motorista_params)\n\n respond_to do |format|\n if @motorista.save\n format.html { redirect_to @motorista, notice: 'Motorista was successfully created.' }\n format.json { render :show, status: :created, location: @motorista }\n else\n format.html { render :new }\n format.json { render json: @motorista.errors, status: :unprocessable_entity }\n end\n end\n end",
"def masters\n @masters ||= {}\n \n if @masters.empty?\n master_links.each do |master_link|\n master_class_name = master_link.master_type\n master_class = master_class_name.constantize\n @masters[master_class_name] ||= []\n @masters[master_class_name] << master_class.where(id: master_link.master_id).limit(1)\n end\n end\n\n return @masters\n end",
"def create\n @testmaster = Testmaster.new(params[:testmaster])\n @session_id=session[:id]\n\t@session = Session.find(session[:id])\n\t@person = Person.find(@session.person_id)\n respond_to do |format|\n if @testmaster.save\n format.html { redirect_to(\"/testmasters/new\", :notice => 'Testmaster was successfully created.') }\n format.xml { render :xml => @testmaster, :status => :created, :location => @testmaster }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @testmaster.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def index\n @rembursmentmaster = Rembursmentmaster.new\n @rembursmentmasters = Rembursmentmaster.all\n end",
"def index\n @masters = Master.all.paginate(page: params[:page], per_page: 200)\n end",
"def createCharities\n\tcharity_list = [\"Direct Relief\", \"Catholic Medical Mission Board\", \"MAP International\", \"United Nations Foundation\", \"The Rotary Foundation of Rotary International\", \"Samaritan's Purse\", \"Institute of International Education\", \"International Rescue Committee\", \"Compassion International\", \"United States Fund for UNICEF\"]\n\tcharity_list.each do |charity|\n\t\tRestClient.post 'http://api.reimaginebanking.com/merchants?key=e0486a76005721ee6d86b140eaea2a40', { \"name\": \"#{charity}\"}.to_json, :content_type => :json, :accept => :json\n\tend\nend",
"def create\n # @doctor = Doctor.new(doctor_params)\n @centers = Center.all.order('name ASC')\n @doctor = current_user.doctors.build(doctor_params)\n\n respond_to do |format|\n if @doctor.save\n # format.html { redirect_to @doctor, notice: 'Doctor was successfully created.' }\n format.html { redirect_to doctors_path, notice: 'Doctor registrado exitosamente.'}\n format.json { render :show, status: :created, location: @doctor }\n else\n format.html { render :new }\n format.json { render json: @doctor.errors, status: :unprocessable_entity }\n end\n end\n end",
"def medieval_composers\n response = RestClient.get 'https://api.openopus.org/composer/list/epoch/Medieval.json'\n json = JSON.parse response\n puts json\n\n if !json.nil?\n json[\"composers\"].map do |composer|\n Composer.create(name: \"#{composer[\"complete_name\"]}\", birth: \"#{composer[\"birth\"]}\", death: \"#{composer[\"death\"]}\", portrait: \"#{composer[\"portrait\"]}\", period_id: 1)\n end\n else\n puts \"Error seeding composers\"\n end\nend",
"def djrmaster_params\n params.require(:djrmaster).permit(:subdate, :subnum, :subform, :subformver, :sectname, :projname, :djrdate, :weather, :foreman, :jobphase, :worktoday, :accdelay, :workschednextday)\n end",
"def create\n @mini_map_road = MiniMapRoad.new(params[:mini_map_road])\n\n respond_to do |format|\n if @mini_map_road.save\n format.html { redirect_to @mini_map_road, notice: 'Mini map road was successfully created.' }\n format.json { render json: @mini_map_road, status: :created, location: @mini_map_road }\n else\n format.html { render action: \"new\" }\n format.json { render json: @mini_map_road.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n neo = Neography::Rest.new\n city = neo.create_node(params[:city])\n redirect_to cities_path\n end",
"def create\n @test_meta_datum = TestMetaDatum.new(test_meta_datum_params)\n\n respond_to do |format|\n if @test_meta_datum.save\n format.html { redirect_to @test_meta_datum, notice: 'Test meta datum was successfully created.' }\n format.json { render action: 'show', status: :created, location: @test_meta_datum }\n else\n format.html { render action: 'new' }\n format.json { render json: @test_meta_datum.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @roommaster = Roommaster.new(params[:roommaster])\n\n respond_to do |format|\n if @roommaster.save\n format.html { redirect_to(@roommaster, :notice => 'Roommaster was successfully created.') }\n format.xml { render :xml => @roommaster, :status => :created, :location => @roommaster }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @roommaster.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n response = post_request(URI.parse(\"http://\"+Storage.find(cookies[:donabe_ip]).data+\"/\"+Storage.find(cookies[:current_tenant]).data+\"/containers.json\"), params[:container].to_json, Storage.find(cookies[:current_token]).data)\n json_respond response.body \n\n end",
"def create\n \n dns_entry_response = RestClient.post('https://api.cloudflare.com/client/v4/zones/:zone_identifier/dns_records',:content_type => :json, :accept => :json, :'x-auth-key' => session[:key] :'x-auth-email' => session[:email])\n\n if JSON.parse(dns_entry_response)[\"success\"]\n @dns_entry = DnsEntry.new(dns_entry_params)\n\n respond_to do |format|\n if @dns_entry.save\n format.html { redirect_to @dns_entry, notice: \"Dns entry was successfully created.\" }\n format.json { render :show, status: :created, location: @dns_entry }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @dns_entry.errors, status: :unprocessable_entity }\n end\n end \n\n end\n\n\n end",
"def create\n @consultant_master = ConsultantMaster.new(params[:consultant_master])\n\n respond_to do |format|\n \t format.js { render :content_type => 'text/javascript', :layout => false}\n \t end\n end"
] |
[
"0.62448233",
"0.61886626",
"0.6172584",
"0.6143834",
"0.60216755",
"0.59618944",
"0.5952",
"0.59434",
"0.59066623",
"0.5819302",
"0.57763493",
"0.57525057",
"0.57051605",
"0.568505",
"0.5588518",
"0.55665827",
"0.55290824",
"0.5518695",
"0.551768",
"0.55174637",
"0.55152285",
"0.55127347",
"0.5489836",
"0.5483467",
"0.5463945",
"0.5449063",
"0.5446062",
"0.5441842",
"0.54377586",
"0.5433925",
"0.541483",
"0.5405958",
"0.5399852",
"0.53836966",
"0.5379447",
"0.5370629",
"0.53636783",
"0.5363494",
"0.5359363",
"0.53429085",
"0.531179",
"0.53107876",
"0.5304203",
"0.5296975",
"0.5290615",
"0.52813655",
"0.527938",
"0.527524",
"0.5251215",
"0.52297163",
"0.52255535",
"0.5217547",
"0.52132684",
"0.5200937",
"0.5196406",
"0.5187544",
"0.51780504",
"0.5171922",
"0.51701534",
"0.51646876",
"0.5163484",
"0.5145727",
"0.51380557",
"0.5135558",
"0.5135558",
"0.5135494",
"0.513259",
"0.51254314",
"0.51195747",
"0.51187533",
"0.51132655",
"0.511298",
"0.510028",
"0.50998473",
"0.5097383",
"0.5071788",
"0.5069621",
"0.50630504",
"0.50629866",
"0.5057503",
"0.5057188",
"0.5056474",
"0.5054712",
"0.50536937",
"0.50532943",
"0.504976",
"0.5047504",
"0.5045827",
"0.504062",
"0.5040499",
"0.5039826",
"0.50397235",
"0.5038375",
"0.50375074",
"0.50321585",
"0.502992",
"0.5028156",
"0.50271356",
"0.50096995",
"0.50062567"
] |
0.6797411
|
0
|
PATCH/PUT /dor_masters/1 PATCH/PUT /dor_masters/1.json
|
def update
respond_to do |format|
if @dor_master.update(dor_master_params)
format.html { redirect_to @dor_master, notice: 'Dor master was successfully updated.' }
format.json { render :show, status: :ok, location: @dor_master }
else
format.html { render :edit }
format.json { render json: @dor_master.errors, status: :unprocessable_entity }
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def update\n respond_to do |format|\n if @master.update(master_params)\n format.html { redirect_to @master, notice: 'Master was successfully updated.' }\n format.json { render :show, status: :ok, location: @master }\n else\n format.html { render :edit }\n format.json { render json: @master.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @maker_master.update(maker_master_params)\n format.html { redirect_to @maker_master, notice: 'Maker master was successfully updated.' }\n format.json { render :show, status: :ok, location: @maker_master }\n else\n format.html { render :edit }\n format.json { render json: @maker_master.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @cello_master.update(cello_master_params)\n format.html { redirect_to @cello_master, notice: 'Cello master was successfully updated.' }\n format.json { render :show, status: :ok, location: @cello_master }\n else\n format.html { render :edit }\n format.json { render json: @cello_master.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_master\n respond_to do |format|\n if @rider.update(rider_params)\n format.html { redirect_to master_rider_path(@rider), notice: 'Rider was successfully updated.' }\n format.json { render :show_master, status: :ok, location: @rider }\n else\n format.html { render :edit_master }\n format.json { render json: @rider.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @master.update(master_params)\n session[:last_master_id] = @master.id\n format.html { redirect_to master_url(@master), notice: \"Master was successfully updated.\" }\n format.json { render :show, status: :ok, location: @master }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @master.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @childmaster = Childmaster.find(params[:id])\n\n respond_to do |format|\n if @childmaster.update_attributes(params[:childmaster])\n format.html { redirect_to @childmaster, notice: 'Childmaster was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @childmaster.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @djrmaster.update(djrmaster_params)\n format.html { redirect_to @djrmaster, notice: 'Djrmaster was successfully updated.' }\n format.json { render :show, status: :ok, location: @djrmaster }\n else\n format.html { render :edit }\n format.json { render json: @djrmaster.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @source_master.update(source_master_params)\n format.html { redirect_to @source_master, notice: \"Source master was successfully updated.\" }\n format.json { render :show, status: :ok, location: @source_master }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @source_master.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @consultant_master = ConsultantMaster.find(params[:id])\n\n respond_to do |format|\n if @consultant_master.update_attributes(params[:consultant_master])\n format.html { redirect_to @consultant_master, notice: 'Consultant master was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @consultant_master.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @service_type_master.update(service_type_master_params)\n format.html { redirect_to @service_type_master, notice: 'Service type master was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @service_type_master.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @masterservice.update(masterservice_params)\n format.html { redirect_to @masterservice, notice: 'Masterservice was successfully updated.' }\n format.json { render :show, status: :ok, location: @masterservice }\n else\n format.html { render :edit }\n format.json { render json: @masterservice.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_tenant_circle(args = {}) \n put(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend",
"def update\n @regions = RegionMaster.all\n @districts = DistrictMaster.all\n \n respond_to do |format|\n if @town_master.update(town_master_params)\n format.html { redirect_to @town_master, notice: \"Town master was successfully updated.\" }\n format.json { render :show, status: :ok, location: @town_master }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @town_master.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @ac_master.update(ac_master_params)\n format.html { redirect_to @ac_master, notice: 'Ac master was successfully updated.' }\n format.json { render :show, status: :ok, location: @ac_master }\n else\n format.html { render :edit }\n format.json { render json: @ac_master.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @hot_master.update(hot_master_params)\n format.html { redirect_to @hot_master, notice: UPDATE_NOTICE }\n format.json { render :show, status: :ok, location: @hot_master }\n else\n format.html { render :edit }\n format.json { render json: @hot_master.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @master_ea.update(master_ea_params)\n format.html { redirect_to @master_ea, notice: 'Master ea was successfully updated.' }\n format.json { render :show, status: :ok, location: @master_ea }\n else\n format.html { render :edit }\n format.json { render json: @master_ea.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @pharmaceutical_master.update(pharmaceutical_master_params)\n format.html { redirect_to @pharmaceutical_master, notice: UPDATE_NOTICE }\n format.json { render :show, status: :ok, location: @pharmaceutical_master }\n else\n format.html { render :edit }\n format.json { render json: @pharmaceutical_master.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @customermaster.update(customermaster_params)\n format.html { redirect_to customermasters_url, notice: 'Customermaster was successfully updated.' }\n format.json { render :show, status: :ok, location: @customermaster }\n else\n format.html { render :edit }\n format.json { render json: @customermaster.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @species = Species.find(params[:id])\n @species.update_attributes(params[:species])\n \n respond_with(@species, :location => admin_species_path(@species))\n end",
"def update\n respond_to do |format|\n if @society_master.update(society_master_params)\n format.html { redirect_to @society_master, notice: 'Society master was successfully updated.' }\n format.json { render :show, status: :ok, location: @society_master }\n else\n format.html { render :edit }\n format.json { render json: @society_master.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @service_master.update(service_master_params)\n @service_master = ServiceMaster.new\n @service_masters = ServiceMaster.all\n end",
"def update\n @conductor = Conductor.find(params[:id])\n\n respond_to do |format|\n if @conductor.update_attributes(params[:conductor])\n format.html { redirect_to @conductor, notice: 'Conductor was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @conductor.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @document_master.update(document_master_params)\n format.html { redirect_to @document_master, notice: 'Document Master was successfully updated.' }\n format.json { render :show, status: :ok, location: @document_master }\n else\n format.html { render :edit }\n format.json { render json: @document_master.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @charge_master = ChargeMaster.find(params[:id])\n\n respond_to do |format|\n if @charge_master.update_attributes(params[:charge_master])\n format.html { redirect_to @charge_master, notice: 'Charge master was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @charge_master.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @momsg = Momsg.find(params[:id])\n\n respond_to do |format|\n if @momsg.update_attributes(params[:momsg])\n format.html { redirect_to @momsg, notice: 'Momsg was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @momsg.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @master_spec = Master::Spec.find(params[:id])\n\n respond_to do |format|\n if @master_spec.update_attributes(params[:master_spec])\n format.html { redirect_to(@master_spec, :notice => 'Spec was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @master_spec.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @distro.update(distro_params)\n format.html { redirect_to @distro, notice: 'Distro was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @distro.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @scout_master = ScoutMaster.find(params[:id])\n\n respond_to do |format|\n if @scout_master.update_attributes(params[:scout_master])\n format.html { redirect_to(@scout_master, :notice => 'Scout master was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @scout_master.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @distro = Distro.find(params[:id])\n\n respond_to do |format|\n if @distro.update_attributes(params[:distro])\n format.html { redirect_to @distro, notice: 'Distro was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @distro.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @kota_stone.update(kota_stone_params)\n format.html { redirect_to kota_stones_url, notice: 'Kota stone was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @kota_stone.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @landmaster.update(landmaster_params)\n format.html { redirect_to @landmaster, notice: 'Landmaster was successfully updated.' }\n format.json { render :show, status: :ok, location: @landmaster }\n else\n format.html { render :edit }\n format.json { render json: @landmaster.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @master_role.update(master_role_params)\n format.html { redirect_to @master_role}\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @master_role.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n #Finding the specific chore where the id matches the one we pass in with the body\n @v1_chore = Chore.where(id: params[:id]).first\n #Here we're checking if we have user_id in our body, and if we do, we'll change the selected chore's properties\n #with the parameters of the body, we go through the specific group to our specific chore with the path\n if v1_chore_params[:user_id]\n @v1_chore.user_id = params[:user_id]\n @v1_chore.assigned = true\n if @v1_chore.save\n render :show, status: :ok\n end\n else\n render json: @v1_chore.errors, status: :unprocessable_entity\n end\n end",
"def update\n respond_to do |format|\n if @cephalopod.update(cephalopod_params)\n format.html { redirect_to @cephalopod, notice: 'Cephalopod was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @cephalopod.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @childmaster = Childmaster.find(params[:id])\n\n respond_to do |format|\n if @childmaster.update_attributes(params[:childmaster])\n format.html { redirect_to(@childmaster, :notice => 'Childmaster was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @childmaster.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @distro = Distro.find(params[:id])\n\n respond_to do |format|\n if @distro.update_attributes(params[:distro])\n format.html { redirect_to @distro, notice: 'Distro was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @distro.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if @conductor.update(conductor_params)\n render :show, status: :ok, location: @conductor\n else\n render json: @conductor.errors, status: :unprocessable_entity\n end\n end",
"def update\n @refferalmaster = Refferalmaster.find(params[:id])\n\n respond_to do |format|\n if @refferalmaster.update_attributes(params[:refferalmaster])\n format.html { redirect_to(@refferalmaster, :notice => 'Refferalmaster was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @refferalmaster.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @financer_master.update(financer_master_params)\n format.html { redirect_to @financer_master, notice: 'Financer Master was successfully updated.' }\n format.json { render :show, status: :ok, location: @financer_master }\n else\n format.html { render :edit }\n format.json { render json: @financer_master.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @ministry_child.update(ministry_child_params)\n format.html { redirect_to @ministry_child, notice: 'Ministry child was successfully updated.' }\n format.json { render :show, status: :ok, location: @ministry_child }\n else\n format.html { render :edit }\n format.json { render json: @ministry_child.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @my_ministry = MyMinistry.find(params[:id])\n\n respond_to do |format|\n if @my_ministry.update_attributes(params[:my_ministry])\n format.html { redirect_to @my_ministry, notice: 'My ministry was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @my_ministry.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @master_yarn.update(master_yarn_params)\n format.html { redirect_to @master_yarn, notice: 'Yarn was successfully updated.' }\n format.json { render :show, status: :ok, location: @master_yarn }\n else\n format.html { render :edit }\n format.json { render json: @master_yarn.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @onshore_yard.update(onshore_yard_params)\n format.html { redirect_to @onshore_yard, notice: 'Onshore yard was successfully updated.' }\n format.json { render :show, status: :ok, location: @onshore_yard }\n else\n format.html { render :edit }\n format.json { render json: @onshore_yard.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @mother_son.update(mother_son_params)\n format.html { redirect_to @mother_son, notice: \"Mother son was successfully updated.\" }\n format.json { render :show, status: :ok, location: @mother_son }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @mother_son.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @ministry_child = MinistryChild.find(params[:id])\n\n respond_to do |format|\n if @ministry_child.update_attributes(params[:ministry_child])\n format.html { redirect_to ministry_path(@ministry_child.ministry.id), notice: 'Ministry child was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @ministry_child.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @origin = OriginAddr.find(params[:id])\n\n respond_to do |format|\n if @origin.update_attributes(origin_params)\n format.html { redirect_to admin_origin_path(@origin), notice: '来源修改成功.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @origin.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @camp.update(camp_params)\n format.html { redirect_to @camp, notice: \"#{@camp.name} was revised in the system.\" }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.jdson { render json: @camp.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update options={}\n client.put(\"/#{id}\", options)\n end",
"def update\n respond_to do |format|\n if @molecule_synonym.update(molecule_synonym_params)\n format.html { redirect_to @molecule_synonym, notice: 'Molecule synonym was successfully updated.' }\n format.json { render :show, status: :ok, location: @molecule_synonym }\n else\n format.html { render :edit }\n format.json { render json: @molecule_synonym.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n puts \"update\"\n\tputs params\n\tputs \"controllo target\"\n\tputs params[:opera][:target]\n\tnew_opera_params = opera_params\n\tnew_opera_params.delete(\"target\")\n\tif params[:opera][:target] != nil \n\t if params[:opera][:target].length > 3\n\t puts \"modifico\"\n\t target_id = params[:opera][:target].split('-')[0].to_s\n\t target_type = params[:opera][:target].split('-')[1].to_s\n\t \n\t new_opera_params.merge({\"target_id\" => target_id})\n\t\tnew_opera_params.merge({\"target_type\" => target_type})\n\t\t\n\t\tputs new_opera_params\n\t end\n\tend\n\tputs new_opera_params\n respond_to do |format|\n if @opera.update(new_opera_params)\n format.html { redirect_to @opera, notice: 'Opera was successfully updated.' }\n format.json { render :show, status: :ok, location: @opera }\n else\n format.html { render :edit }\n format.json { render json: @opera.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @ministerio = Ministerio.find(params[:id])\n\n respond_to do |format|\n if @ministerio.update_attributes(params[:ministerio])\n format.html { redirect_to @ministerio, notice: 'Ministerio was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @ministerio.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @major = Major.find(params[:id])\n\n respond_to do |format|\n if @major.update_attributes(params[:major])\n format.html { redirect_to @major, notice: 'Major was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @major.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n keystone.update_tenant({:id=>params[:id],:name=>params[:name],:description=>params[:description],:enabled=>params[:enabled]})\n respond_to do |format|\n format.html { redirect_to tenants_path, :notice => 'Tenant was successfully updated.' }\n format.json { head :ok }\n end\n end",
"def update\n respond_to do |format|\n if @samochod.update(samochod_params)\n format.html { redirect_to @samochod, notice: 'Samochod was successfully updated.' }\n format.json { render :show, status: :ok, location: @samochod }\n else\n format.html { render :edit }\n format.json { render json: @samochod.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @master_memorial.update(master_memorial_params)\n format.html { redirect_to @master_memorial, notice: 'Memorial was successfully updated.' }\n format.json { render :show, status: :ok, location: @master_memorial }\n else\n format.html { render :edit }\n format.json { render json: @master_memorial.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @major.update(major_params)\n format.html { redirect_to @major, notice: 'Major was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @major.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @allocation_master.update(allocation_master_params)\n format.html { redirect_to @allocation_master, notice: 'Allocation master was successfully updated.' }\n format.json { render :show, status: :ok, location: @allocation_master }\n else\n format.html { render :edit }\n format.json { render json: @allocation_master.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @dino = Dino.find(params[:id])\n\n if @dino.update(dino_params)\n head :no_content\n else\n render json: @dino.errors, status: :unprocessable_entity\n end\n end",
"def update\n put :update\n end",
"def update\n # { clinic: {id: references, \"license_id\"=>nil, \"name\"=>string } }\n \n if @clinic.update_attributes(params[:clinic].except(:api_license_id))\n head :no_content\n else\n render json: clinic.errors.full_messages, status: :unprocessable_entity\n end\n end",
"def update\n respond_to do |format|\n name = Server.find(params[:id]).name\n n = Neography::Node.find('servers', 'name', name)\n n.name = server_params[:name]\n n.add_to_index('servers', 'name', server_params[:name]) #TODO: is this necessary?\n if @server.update(server_params)\n format.html { redirect_to @server, notice: 'Server was successfully updated.' }\n format.json { render :show, status: :ok, location: @server }\n else\n format.html { render :edit }\n format.json { render json: @server.errors, status: :unprocessable_entity }\n end\n end\n end",
"def patch\n headers = {\"If-Match\" => @version}\n response = @context.request :patch, \"#{@path}/#{@id}\", @data.to_json, headers\n @version += 1\n response\n # 'X-HTTP-Method-Override' => 'PATCH'\n end",
"def update\n @groupon = Groupon.find(params[:id])\n\n respond_to do |format|\n if @groupon.update_attributes(params[:groupon])\n format.html { redirect_to @groupon, notice: 'Groupon was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @groupon.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @master_size.update(master_size_params)\n format.html { redirect_to @master_size, notice: 'Size was successfully updated.' }\n format.json { render :show, status: :ok, location: @master_size }\n else\n format.html { render :edit }\n format.json { render json: @master_size.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\n respond_to do |format|\n if @order_info.update_attributes(order_info_params)\n format.html { redirect_to @order_info, notice: 'Order info was successfully updated.' }\n format.json { head :no_content }\n else\n set_order_masters\n format.html { render 'edit' }\n format.json { render json: @order_info.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @suburb_master.update(suburb_master_params)\n @suburb_masters = SuburbMaster.all.paginate(:page => params[:page], :per_page => 5).order('id desc')\n format.js { flash.now[:notice] = \"Suburb was successfully updated\"}\n format.html { redirect_to @suburb_master, notice: 'Suburb master was successfully updated.' }\n format.json { render :show, status: :ok, location: @suburb_master }\n else\n @city_town_masters = CityTownMaster.all\n format.js { render :edit }\n format.html { render :edit }\n format.json { render json: @suburb_master.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @countries = CountryMaster.all\n\n respond_to do |format|\n if @region_master.update(region_master_params)\n format.html { redirect_to @region_master, notice: \"Region master was successfully updated.\" }\n format.json { render :show, status: :ok, location: @region_master }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @region_master.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n client=Client.find_by_id params[:id]\n if client!= nil\n client.cedula=params[:cedula] ? params[:cedula]: client.cedula\n client.sector=params[:sector] ? params[:sector]: client.sector\n client.nombre=params[:nombre] ? params[:nombre]: client.nombre\n client.telefono=params[:telefono] ? params[:telefono]: client.telefono\n client.pagina=params[:pagina] ? params[:pagina]: client.pagina\n client.direccion=params[:direccion] ? params[:direccion]: client.direccion\n if client.save\n render(json: client, status: 201)\n end \n else\n render(json: client.errors, status: 404)\n end \n end",
"def update\n @mini_map_road = MiniMapRoad.find(params[:id])\n\n respond_to do |format|\n if @mini_map_road.update_attributes(params[:mini_map_road])\n format.html { redirect_to @mini_map_road, notice: 'Mini map road was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @mini_map_road.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update # PATCH\n raise NotImplementedError\n end",
"def update\n respond_to do |format|\n if @nodo.update(nodo_params)\n #format.html { redirect_to @nodo, notice: 'Nodo was successfully updated.' }\n #format.json { head :no_content }\n format.html { redirect_to nodos_url+'?lat=' + @nodo.lat + '&lng=' + @nodo.lng }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @nodo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @latstraps1.update(latstraps1_params)\n format.html { redirect_to \"/latstraps1s\"}\n format.json { render :show, status: :ok, location: @latstraps1 }\n else\n format.html { render :edit }\n format.json { render json: @latstraps1.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @server1 = Server1.find(params[:id])\n\n respond_to do |format|\n if @server1.update_attributes(params[:server1])\n format.html { redirect_to @server1, notice: 'Server was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @server1.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n official = Official.find(params[:id])\n if official.update(official_params)\n render json: official, status: 200, location: [:api, official]\n else\n failed_to_update(official, \"official\")\n end\n end",
"def update\n @citymaster = Citymaster.find(params[:id])\n\n respond_to do |format|\n if @citymaster.update_attributes(params[:citymaster])\n format.html { redirect_to(@citymaster, :notice => 'Citymaster was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @citymaster.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @payment_site_master.update(payment_site_master_params)\n format.html { redirect_to @payment_site_master, notice: 'Payment site master was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render 'edit' }\n format.json { render json: @payment_site_master.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @admin_geonode = Admin::Geonode.find(params[:id])\n\n respond_to do |format|\n if @admin_geonode.update_attributes(params[:admin_geonode])\n format.html { redirect_to @admin_geonode, notice: 'Geonode was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @admin_geonode.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @request_for_change.set_manager(force: true)\n @request_for_change.set_security_officer(force: true)\n\n respond_to do |format|\n if @request_for_change.update(request_for_change_params)\n format.html { redirect_to edit_request_for_change_path(@request_for_change), notice: 'Request for change was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @request_for_change.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @stone = Stone.find(params[:id])\n\n respond_to do |format|\n if @stone.update_attributes(params[:stone])\n format.html { redirect_to @stone, notice: 'Stone was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @stone.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @major.update(major_params)\n format.html { redirect_to @major, notice: 'Major was successfully updated.' }\n format.json { render :show, status: :ok, location: @major }\n else\n format.html { render :edit }\n format.json { render json: @major.errors, status: :unprocessable_entity }\n end\n end\n end",
"def patch!\n request! :patch\n end",
"def update\n @asagroupservobj = Asagroupservobj.find(params[:id])\n\n respond_to do |format|\n if @asagroupservobj.update_attributes(params[:asagroupservobj])\n format.html { redirect_to @asagroupservobj, notice: 'Asagroupservobj was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @asagroupservobj.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @account_master.update(account_master_params)\n format.html { redirect_to @account_master, notice: 'Account master was successfully updated.' }\n format.json { render :show, status: :ok, location: @account_master }\n else\n format.html { render :edit }\n format.json { render json: @account_master.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\r\n respond_to do |format|\r\n if @sivic_ministerio.update(sivic_ministerio_params)\r\n format.html { redirect_to @sivic_ministerio, notice: 'Registro alterado com sucesso.' }\r\n format.json { head :no_content }\r\n else\r\n format.html { render action: 'edit' }\r\n format.json { render json: @sivic_ministerio.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end",
"def update\n respond_to do |format|\n if @homeroom.update(homeroom_params)\n format.html { redirect_to @homeroom, notice: 'Homeroom was successfully updated.' }\n format.json { render :show, status: :ok, location: @homeroom }\n else\n format.html { render :edit }\n format.json { render json: @homeroom.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n render json: Company.update(params[\"id\"], params[\"company\"])\n end",
"def update\n respond_to do |format|\n if @sivic_discipulo.update(sivic_discipulo_params_netested)\n format.html { redirect_to @sivic_discipulo, notice: 'Registro alterado com sucesso.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @sivic_discipulo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @wardmaster = Wardmaster.find(params[:id])\n\n respond_to do |format|\n if @wardmaster.update_attributes(params[:wardmaster])\n format.html { redirect_to(@wardmaster, :notice => 'Wardmaster was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @wardmaster.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @patron_merge.update_attributes(params[:patron_merge])\n flash[:notice] = t('controller.successfully_updated', :model => t('activerecord.models.patron_merge'))\n format.html { redirect_to(@patron_merge) }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @patron_merge.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @minuman.update(minuman_params)\n format.html { redirect_to @minuman, notice: 'Minuman was successfully updated.' }\n format.json { render :show, status: :ok, location: @minuman }\n else\n format.html { render :edit }\n format.json { render json: @minuman.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @seguidore = Seguidore.find(params[:id])\n\n respond_to do |format|\n if @seguidore.update_attributes(params[:seguidore])\n format.html { redirect_to @seguidore, notice: 'Seguidore was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @seguidore.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @osoba = Osoba.find(params[:id])\n\n if @osoba.update(params[:osoba])\n head :no_content\n else\n render json: @osoba.errors, status: :unprocessable_entity\n end\n end",
"def rm_update path, data, msg\n\n re = rm_request path, data, 'PUT'\n puts re.body\n chk (re.code!='200'), msg + \"\\n#{re.code} #{re.msg}\\n\\n\"\n return true\n\nend",
"def update\n respond_to do |format|\n if @cord.update(cord_params)\n format.html { redirect_to @cord, notice: t('cords.update.success') }\n format.json { render :show, status: :ok, location: @cord }\n else\n format.html { render :edit }\n format.json { render json: @cord.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @mountain.update(mountain_params)\n format.html { redirect_to @mountain, notice: 'Mountain was successfully updated.' }\n format.json { render :show, status: :ok, location: @mountain }\n else\n format.html { render :edit }\n format.json { render json: @mountain.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_with []\n end",
"def update\n\n # update shops\n shops_edit = JSON.parse(params[:mall][:shops_in_mall])\n\n respond_to do |format|\n if @mall.update_with_shops(mall_params, shops_edit)\n format.html { redirect_to director_malls_path, notice: 'Mall was successfully updated.' }\n format.json { render :show, status: :ok, location: @mall }\n else\n format.html {\n @shops = Shop.to_options.to_json\n @shops_in_mall = @mall.shops.to_options.to_json\n render :edit\n }\n format.json { render json: @mall.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @moresmallarmorinfo = Moresmallarmorinfo.find(params[:id])\n\n respond_to do |format|\n if @moresmallarmorinfo.update_attributes(params[:moresmallarmorinfo])\n format.html { redirect_to @moresmallarmorinfo, notice: 'Moresmallarmorinfo was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @moresmallarmorinfo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @taxon.update(taxon_params)\n format.html { redirect_to taxons_path, notice: \"Species: '#{@taxon.common_name}' was successfully updated.\" }\n format.json { render :show, status: :ok, location: @taxon }\n else\n format.html { render :edit }\n format.json { render json: @taxon.errors, status: :unprocessable_entity }\n end\n end\n end"
] |
[
"0.6608503",
"0.6519024",
"0.64278144",
"0.64157003",
"0.62379485",
"0.62108123",
"0.61983496",
"0.61805767",
"0.6169099",
"0.61632514",
"0.61289513",
"0.61267215",
"0.6074874",
"0.60691965",
"0.60635203",
"0.6034237",
"0.60055965",
"0.6003266",
"0.596919",
"0.5958468",
"0.5956288",
"0.594419",
"0.5943268",
"0.5910437",
"0.5903959",
"0.58970046",
"0.5896814",
"0.58919615",
"0.58791375",
"0.58642626",
"0.5859425",
"0.5858231",
"0.58539027",
"0.58521533",
"0.5850487",
"0.5844566",
"0.58303136",
"0.58028156",
"0.58022636",
"0.580043",
"0.57942885",
"0.5794267",
"0.5790749",
"0.5787231",
"0.5787064",
"0.5778058",
"0.57706815",
"0.57690024",
"0.5759578",
"0.57534647",
"0.57492965",
"0.5734988",
"0.5730269",
"0.57298094",
"0.57294905",
"0.5726353",
"0.571556",
"0.57121575",
"0.5711882",
"0.56905633",
"0.569027",
"0.5688481",
"0.5662244",
"0.56588405",
"0.5658107",
"0.5658039",
"0.5657983",
"0.5657939",
"0.56443876",
"0.5640197",
"0.56326157",
"0.5627498",
"0.5616017",
"0.5596947",
"0.5596687",
"0.5593773",
"0.5593158",
"0.5592052",
"0.5589783",
"0.55878985",
"0.5584621",
"0.55801195",
"0.55774444",
"0.5574991",
"0.55741554",
"0.5566557",
"0.55651885",
"0.5558977",
"0.55583495",
"0.5555323",
"0.5551335",
"0.55500954",
"0.5548675",
"0.5546943",
"0.5545199",
"0.55439794",
"0.5534445",
"0.5533004",
"0.5531995",
"0.55317616"
] |
0.67960846
|
0
|
DELETE /dor_masters/1 DELETE /dor_masters/1.json
|
def destroy
@dor_master.destroy
respond_to do |format|
format.html { redirect_to dor_masters_url, notice: 'Dor master was successfully destroyed.' }
format.json { head :no_content }
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def destroy\n @hot_master.destroy\n respond_to do |format|\n format.html { redirect_to hot_masters_url, notice: DELETE_NOTICE }\n format.json { head :no_content }\n end\n end",
"def delete_tenant_circle(args = {}) \n delete(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend",
"def destroy\n @master.destroy\n\n respond_to do |format|\n format.html { redirect_to masters_url, notice: \"Master was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @childmaster = Childmaster.find(params[:id])\n @childmaster.destroy\n\n respond_to do |format|\n format.html { redirect_to childmasters_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @pharmaceutical_master.destroy\n respond_to do |format|\n format.html { redirect_to pharmaceutical_masters_url, notice: DELETE_NOTICE }\n format.json { head :no_content }\n end\n end",
"def destroy\n @master.destroy\n respond_to do |format|\n format.html { redirect_to masters_url, notice: 'Master was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete\n client.delete(\"/#{id}\")\n end",
"def delete_aos_version(args = {}) \n delete(\"/aosversions.json/#{args[:aosVersionId]}\", args)\nend",
"def destroy\n @djrmaster.destroy\n respond_to do |format|\n format.html { redirect_to djrmasters_url, notice: 'Djrmaster was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @consultant_master = ConsultantMaster.find(params[:id])\n @consultant_master.destroy\n\n respond_to do |format|\n format.html { redirect_to consultant_masters_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @nodo.destroy\n respond_to do |format|\n format.html { redirect_to nodos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @cephalopod.destroy\n respond_to do |format|\n format.html { redirect_to cephalopods_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @distro.destroy\n respond_to do |format|\n format.html { redirect_to distros_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @distro = Distro.find(params[:id])\n @distro.destroy\n\n respond_to do |format|\n format.html { redirect_to distros_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @cord.destroy\n respond_to do |format|\n format.html { redirect_to cords_url, notice: t('cords.destroy.success') }\n format.json { head :no_content }\n end\n end",
"def destroy\n @service_type_master.destroy\n respond_to do |format|\n format.html { redirect_to service_type_masters_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ac_master.destroy\n respond_to do |format|\n format.html { redirect_to ac_masters_url, notice: 'Ac master was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @charge_master = ChargeMaster.find(params[:id])\n @charge_master.destroy\n\n respond_to do |format|\n format.html { redirect_to charge_masters_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @maker_master.destroy\n respond_to do |format|\n format.html { redirect_to maker_masters_url, notice: 'Maker master was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @town_master.destroy\n respond_to do |format|\n format.html { redirect_to town_masters_url, notice: \"Town master was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy_master\n @rider.destroy\n respond_to do |format|\n format.html { redirect_to masters_riders_path, notice: 'Rider was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @landmaster.destroy\n respond_to do |format|\n format.html { redirect_to landmasters_url, notice: 'Landmaster was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @cello_master.destroy\n respond_to do |format|\n format.html { redirect_to cello_masters_url, notice: 'Cello master was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @region_master.destroy\n respond_to do |format|\n format.html { redirect_to region_masters_url, notice: \"Region master was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @suburb_master.destroy\n respond_to do |format|\n format.html { redirect_to suburb_masters_url, notice: 'Suburb master was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @kota_stone.destroy\n respond_to do |format|\n format.html { redirect_to kota_stones_url }\n format.json { head :no_content }\n end\n end",
"def delete(options={})\n connection.delete(\"/\", @name)\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 @childmaster = Childmaster.find(params[:id])\n @childmaster.destroy\n\n respond_to do |format|\n format.html { redirect_to(childmasters_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @source_master.destroy\n respond_to do |format|\n format.html { redirect_to source_masters_url, notice: \"Source master was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n client=Client.find_by_id(params[:id])\n if client != nil\n if client.destroy\n head 204\n end\n else\n head 404\n end\n end",
"def destroy\n id = params[:id]\n @datacenter = Datacenter.any_of({_id: id}, {name: id.gsub('-', '.')}).first\n @datacenter.destroy\n\n respond_to do |format|\n format.html { redirect_to datacenters_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @refferalmaster = Refferalmaster.find(params[:id])\n @refferalmaster.destroy\n\n respond_to do |format|\n format.html { redirect_to(refferalmasters_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @master_memorial.destroy\n respond_to do |format|\n format.html { redirect_to master_memorials_url, notice: 'Memorial was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @testmaster = Testmaster.find(params[:id])\n @testmaster.destroy\n\n respond_to do |format|\n format.html { redirect_to(testmasters_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @server = Server.find(params[:id])\n checkaccountobject(\"servers\",@server)\n @server.send_delete\n respond_to do |format|\n format.html { redirect_to servers_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @distro = Distro.find(params[:id])\n removefromaccount(\"distros\", @distro)\n @distro.destroy\n\n respond_to do |format|\n format.html { redirect_to distros_url }\n format.json { head :ok }\n end\n end",
"def destroy\n puts \"this is working\"\n @master_size.destroy\n respond_to do |format|\n format.html { redirect_to master_sizes_url, notice: 'Size was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @server1 = Server1.find(params[:id])\n @server1.destroy\n\n respond_to do |format|\n format.html { redirect_to server1s_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @masterservice.destroy\n respond_to do |format|\n format.html { redirect_to masterservices_url, notice: 'Masterservice was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @scout_master = ScoutMaster.find(params[:id])\n @scout_master.destroy\n\n respond_to do |format|\n format.html { redirect_to(scout_masters_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @v1_chore = Chore.where(id: params[:id])\n if @v1_chore.destroy\n head(:ok)\n else\n head(:unprocessable_entity)\n end\n end",
"def destroy\n @citymaster = Citymaster.find(params[:id])\n @citymaster.destroy\n\n respond_to do |format|\n format.html { redirect_to(citymasters_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @master_ea.destroy\n respond_to do |format|\n format.html { redirect_to master_eas_url, notice: 'Master ea was successfully destroyed.' }\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 destroy\n @customermaster.destroy\n respond_to do |format|\n format.html { redirect_to customermasters_url, notice: 'Customermaster was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @patron_merge.destroy\n\n respond_to do |format|\n format.html { redirect_to(patron_merges_url) }\n format.json { head :no_content }\n end\n end",
"def destroy\n @odist.destroy\n respond_to do |format|\n format.html { redirect_to odists_url, notice: 'Odist was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @document_master.destroy\n respond_to do |format|\n format.html { redirect_to document_masters_url, notice: 'Document Master was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @master_ea_no_match.destroy\n respond_to do |format|\n format.html { redirect_to master_ea_no_matches_url, notice: 'Master ea no match was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @admin_geonode = Admin::Geonode.find(params[:id])\n @admin_geonode.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_geonodes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @dinosaur.destroy\n head :no_content\n end",
"def destroy\n @conductor = Conductor.find(params[:id])\n @conductor.destroy\n\n respond_to do |format|\n format.html { redirect_to conductors_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @momsg = Momsg.find(params[:id])\n @momsg.destroy\n\n respond_to do |format|\n format.html { redirect_to momsgs_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @stone = Stone.find(params[:id])\n @stone.destroy\n\n respond_to do |format|\n format.html { redirect_to stones_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 @society_master.destroy\n respond_to do |format|\n format.html { redirect_to society_masters_url, notice: 'Society master was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end",
"def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end",
"def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end",
"def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end",
"def destroy\n @mob.destroy\n respond_to do |format|\n format.html { redirect_to mobs_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @major.destroy\n respond_to do |format|\n format.html { redirect_to majors_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @dino.destroy\n\n head :no_content\n end",
"def destroy\n @samochod.destroy\n respond_to do |format|\n format.html { redirect_to samochods_url, notice: 'Samochod was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @database = Database.find(params[:id])\n path = @database.path\n delete = %x[rm -R #{path}]\n @database.destroy\n\n respond_to do |format|\n format.html { redirect_to databases_url }\n format.json { head :no_content }\n end\n end",
"def delete\n client.delete(url)\n @deleted = true\nend",
"def destroy\n @trein_consul_comercial.destroy\n respond_to do |format|\n format.html { redirect_to trein_consul_comercials_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @terminal_master.destroy\n respond_to do |format|\n format.html { redirect_to terminal_masters_url }\n format.json { head :no_content }\n end\n end",
"def delete\n request(:delete)\n end",
"def delete(object)\n full_name = extract_full_name object\n post 'api/del', :id => full_name\n end",
"def destroy\n @financer_master.destroy\n respond_to do |format|\n format.html { redirect_to financer_masters_url, notice: 'Financer Master was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n dns_entry_response = RestClient.delete('https://api.cloudflare.com/client/v4/zones/:zone_identifier/dns_records/:identifier',:content_type => :json, :accept => :json, :'x-auth-key' => session[:key] :'x-auth-email' => session[:email])\n @dns_entry.destroy\n respond_to do |format|\n format.html { redirect_to dns_entries_url, notice: \"Dns entry was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @mou.destroy\n respond_to do |format|\n format.html { redirect_to mous_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @test_meta_datum.destroy\n respond_to do |format|\n format.html { redirect_to test_meta_data_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @admin_merge.destroy\n respond_to do |format|\n format.html { redirect_to admin_merges_url }\n format.json { head :no_content }\n end\n end",
"def delete\n url = prefix + \"delete\"\n return response(url)\n end",
"def delete\n url = prefix + \"delete\"\n return response(url)\n end",
"def destroy\n @pagemaster.destroy\n respond_to do |format|\n format.html { redirect_to pagemasters_url, notice: 'Pagemaster was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @target.destroy\n respond_to do |format|\n format.html { redirect_to after_write_path }\n format.json { head :no_content }\n end\n end",
"def destroy\n @bdm.destroy\n respond_to do |format|\n format.html { redirect_to bdms_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @moonwalk.destroy\n respond_to do |format|\n format.html { redirect_to moonwalks_url }\n format.json { head :no_content }\n end\n end",
"def delete\n urlMaster = Urlmaster.find(params[:id])\n urlMaster.destroy\n\n if urlMaster\n redirect_to crawler_path\n end\n end",
"def destroy\n @payment_site_master.destroy\n respond_to do |format|\n format.html { redirect_to payment_site_masters_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @cordinator.destroy\n respond_to do |format|\n format.html { redirect_to cordinators_url, notice: 'El cordinador se ha eliminado correctamente' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @node = Node.find_key(params[:id] || params[:name])\n @node.destroy\n respond_to do |format|\n format.html { redirect_to deployment_path(@node.deployment_id) }\n format.json { render api_delete @node }\n end\n end",
"def destroy\n orden@client.destroy\n end",
"def destroy\n @seguidore = Seguidore.find(params[:id])\n @seguidore.destroy\n\n respond_to do |format|\n format.html { redirect_to seguidores_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @adminmatrixgenu.destroy\n respond_to do |format|\n format.html { redirect_to adminmatrixgenus_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @datoscontacto = Datoscontacto.find(params[:id])\n @datoscontacto.destroy\n\n respond_to do |format|\n format.html { redirect_to datoscontactos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @dinosaur = Dinosaur.find(params[:id])\n @dinosaur.destroy\n\n respond_to do |format|\n format.html { redirect_to dinosaurs_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @wardmaster = Wardmaster.find(params[:id])\n @wardmaster.destroy\n\n respond_to do |format|\n format.html { redirect_to(wardmasters_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @ministerio = Ministerio.find(params[:id])\n @ministerio.destroy\n\n respond_to do |format|\n format.html { redirect_to ministerios_url }\n format.json { head :no_content }\n end\n end",
"def delete!\n\t\t\tClient.delete @root\n\t\tend",
"def destroy\n @magisterial_district.destroy\n respond_to do |format|\n format.html { redirect_to magisterial_districts_url, notice: 'Magisterial district was successfully destroyed.' }\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 @employee_master.destroy\n respond_to do |format|\n format.html { redirect_to employee_masters_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n\n @ministorage.destroy\n respond_to do |format|\n format.html { redirect_to admin_ministorages_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @mountain.destroy\n respond_to do |format|\n format.html { redirect_to mountains_url, notice: 'Mountain was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @usermaster = Usermaster.find(params[:id])\n @usermaster.destroy\n\n respond_to do |format|\n format.html { redirect_to(usermasters_url) }\n format.xml { head :ok }\n end\n end"
] |
[
"0.70097053",
"0.7001957",
"0.6980012",
"0.69762015",
"0.696791",
"0.69638145",
"0.692363",
"0.6921887",
"0.6910164",
"0.6890854",
"0.6880473",
"0.68403643",
"0.6836584",
"0.6821473",
"0.6800084",
"0.67787975",
"0.6775802",
"0.67735064",
"0.6769035",
"0.6743476",
"0.6716086",
"0.671233",
"0.6698007",
"0.6696207",
"0.6688622",
"0.66641265",
"0.6655794",
"0.6641826",
"0.6634227",
"0.6632767",
"0.66271555",
"0.6613837",
"0.6612666",
"0.65905917",
"0.65671664",
"0.65665877",
"0.65652466",
"0.65639025",
"0.6561373",
"0.65598375",
"0.6533435",
"0.65269274",
"0.65260834",
"0.6523911",
"0.65228564",
"0.6514803",
"0.65104246",
"0.65052056",
"0.6501888",
"0.6501154",
"0.64997834",
"0.64965636",
"0.6496283",
"0.64947724",
"0.6492831",
"0.64916277",
"0.6491437",
"0.6488727",
"0.6488727",
"0.6488727",
"0.6488727",
"0.64862335",
"0.64853716",
"0.648384",
"0.6474715",
"0.6473371",
"0.64710534",
"0.6467442",
"0.6467316",
"0.64624286",
"0.6461476",
"0.64575374",
"0.64526737",
"0.6451738",
"0.6450094",
"0.64433765",
"0.6440327",
"0.6440327",
"0.6440023",
"0.64384633",
"0.6438296",
"0.6438213",
"0.642829",
"0.6426497",
"0.64263",
"0.64214075",
"0.6420897",
"0.6420868",
"0.6420704",
"0.6411022",
"0.6409989",
"0.6406297",
"0.64030033",
"0.63990253",
"0.6395177",
"0.63938373",
"0.63918555",
"0.63903004",
"0.63898647",
"0.6387993"
] |
0.7358595
|
0
|
Use callbacks to share common setup or constraints between actions.
|
def set_dor_master
@dor_master = DorMaster.find(params[:id])
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_eval do\n define_method(:valid?) do |*args|\n self.class.state_machines.fire_event_attributes(self, :save, false) { super(*args) }\n end\n end\n end\n end",
"def add_actions; end",
"def callbacks; end",
"def callbacks; end",
"def setup *actions, &proc\n (@setup_procs ||= []) << [proc, actions.size > 0 ? actions : [:*]]\n end",
"def define_action_helpers; end",
"def post_setup\n end",
"def action_methods; end",
"def action_methods; end",
"def action_methods; end",
"def before_setup; end",
"def action_run\n end",
"def execute(setup)\n @action.call(setup)\n end",
"def define_action_helpers?; end",
"def set_actions\n actions :all\n end",
"def action_done(action)\n dispatch = { :migrate => :done_migrating, :map => :done_mapping, :reduce =>\n :done_reducing, :finalize => :done_finalizing } \n self.send dispatch[action[:action]], action\n end",
"def dependencies action, &block\n @actions.each do |other|\n if action[:requires].include? other[:provide]\n block.call other\n end\n end\n end",
"def setup!\n return unless @setup_procs\n http_actions = actions\n @setup_procs.each do |setup_proc|\n proc, actions = setup_proc\n @setup__actions = actions.map do |action|\n\n action.is_a?(Regexp) ?\n http_actions.select { |a| a.to_s =~ action } :\n action.is_a?(String) && action =~ /\\A\\./ ?\n http_actions.map { |a| a.to_s << action if format?(a).include?(action) }.compact :\n action\n\n end.flatten\n self.class_exec &proc\n @setup__actions = nil\n end\n @setup_procs = nil\n end",
"def before_actions(*logic)\n self.before_actions = logic\n end",
"def setup_handler\n end",
"def set_action(opts)\n opts = check_params(opts,[:actions])\n super(opts)\n end",
"def setup(action)\n @targets.clear\n unless action.item.target_filters.empty?\n @targets = SES::TargetManager.make_targets(action)\n else\n item = action.item\n if item.for_opponent?\n @targets = $game_troop.alive_members\n elsif item.for_dead_friend?\n @targets = $game_party.battle_members.select { |actor| actor.dead? }\n else\n $game_party.battle_members.select { |actor| actor.alive? }\n end\n end\n @item_max = @targets.size\n create_contents\n refresh\n show\n activate\n end",
"def action; end",
"def action; end",
"def action; end",
"def action; end",
"def action; end",
"def workflow\n end",
"def revisable_shared_setup(args, block)\n class << self\n attr_accessor :revisable_options\n end\n options = args.extract_options!\n self.revisable_options = Options.new(options, &block)\n \n self.send(:include, Common)\n self.send(:extend, Validations) unless self.revisable_options.no_validation_scoping?\n self.send(:include, WithoutScope::QuotedColumnConditions)\n end",
"def setup\n @action = SampleActionAndroid.new(os_name: 'android',\n app_name: APP_PATH)\n end",
"def before(action)\n invoke_callbacks *self.class.send(action).before\n end",
"def process_action(...)\n send_action(...)\n end",
"def before_dispatch(env); end",
"def after_actions(*logic)\n self.after_actions = logic\n end",
"def setup\n # override and do something appropriate\n end",
"def setup(client)\n return unless @setup\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n actions.each do |action|\n action.execute(client)\n end\n self\n end",
"def setup(_context)\n end",
"def setup(resources) ; end",
"def validate_actions\n errors.add(:base, :should_give_at_least_one_action) if !manage? && !forecasting? && !read? && !api?\n end",
"def setup\n @resource_config = {\n :callbacks => {\n :before_create => nil,\n :after_create => nil,\n :before_update => nil,\n :after_update => nil,\n :before_destroy => nil,\n :after_destroy => nil,\n },\n :child_assoc => nil,\n :model => nil,\n :parent => nil,\n :path => nil,\n :permission => {},\n :properties => {},\n :relation => {\n :create => nil,\n :delete => nil,\n },\n :roles => nil,\n }\n end",
"def determine_valid_action\n\n end",
"def process_shared\n handle_taxes\n handle_shippings\n create_adjustments_from_params\n handle_status\n handle_inventory_refunds\n handle_payment_transactions\n order.updater.update\n end",
"def startcompany(action)\n @done = true\n action.setup\n end",
"def init_actions\n am = action_manager()\n am.add_action(Action.new(\"&Disable selection\") { @selection_mode = :none; unbind_key(32); bind_key(32, :scroll_forward); } )\n am.add_action(Action.new(\"&Edit Toggle\") { @edit_toggle = !@edit_toggle; $status_message.value = \"Edit toggle is #{@edit_toggle}\" })\n end",
"def event_callbacks(event, metadata={})\n case event\n when :reset, :review\n if confirmed\n update_attributes(confirmed: false)\n end\n when :confirm\n confirm\n # trigger :order for all applicable items\n # NOTE: :order event is common to both physical and digital items\n items.each do |i|\n if i.event_permitted(:order)\n user_id = last_transition.user_id\n i.trigger!(:order, { order_id: id, user_id: user_id })\n end\n end\n when :complete_work\n request = metadata[:request]\n work_complete_notification(request)\n when :close\n close\n end\n if event != :close && !open\n reopen\n end\n end",
"def setup_action\n return unless PONY::ERRNO::check_sequence(current_act)\n new_sequence = @action_sequence[@sequence_index+1...@action_sequence.size]\n @sequence_index = 0\n new_sequence = DND::SkillSequence::ACTS[@acts[1]] + new_sequence\n execute_sequence\n end",
"def define_tasks\n define_weave_task\n connect_common_tasks\n end",
"def setup(&block)\n define_method(:setup, &block)\n end",
"def setup\n transition_to(:setup)\n end",
"def setup\n transition_to(:setup)\n end",
"def action\n end",
"def setup( *args )\n\t\t\tself.class.setupBlocks.each {|sblock|\n\t\t\t\tdebugMsg \"Calling setup block method #{sblock}\"\n\t\t\t\tself.send( sblock )\n\t\t\t}\n\t\t\tsuper( *args )\n\t\tend",
"def config(action, *args); end",
"def setup\n @setup_proc.call(self) if @setup_proc\n end",
"def before_action \n end",
"def setup_callbacks\n defined_callbacks.each do |meth|\n unless respond_to?(\"call_#{meth}_callbacks\".to_sym)\n self.class.module_eval <<-EOE\n def call_#{meth}_callbacks(*args)\n plugin_store.each {|a| a.call_#{meth}_callbacks(*args) } if respond_to?(:plugin_store) && plugin_store\n self.send :#{meth}, *args if respond_to?(:#{meth})\n end\n EOE\n end\n end\n end",
"def action\n end",
"def matt_custom_action_begin(label); end",
"def setup\n # override this if needed\n end",
"def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend",
"def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend",
"def action(options,&callback)\n new_action = Action===options ? options : Action.new(options,&callback)\n # replace any with (shared name/alias or both default) + same arity\n @actions.delete_if do |existing_action|\n ((existing_action.names & new_action.names).size > 0 ||\n existing_action.default? && new_action.default?) &&\n existing_action.required.size == new_action.required.size &&\n existing_action.optional.size <= new_action.optional.size\n end\n @actions = (@actions + [new_action]).sort\n new_action\n end",
"def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action\n end",
"def after(action)\n invoke_callbacks *options_for(action).after\n end",
"def pre_task\n end",
"def setup(server)\n server.on('beforeMethod', method(:before_method), 10)\n end",
"def add_actions\n attribute = machine.attribute\n name = self.name\n \n owner_class.class_eval do\n define_method(name) {self.class.state_machines[attribute].events[name].fire(self)}\n define_method(\"#{name}!\") {self.class.state_machines[attribute].events[name].fire!(self)}\n define_method(\"can_#{name}?\") {self.class.state_machines[attribute].events[name].can_fire?(self)}\n end\n end",
"def init_actions\n @select_action = SelectAction.new\n @endpoint_mouse_action = EndpointMouseAction.new\n @move_action = MoveAction.new\n end",
"def setup_signals; end",
"def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend",
"def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend",
"def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action.respond_to?('weak!') ? action.weak! : action\n end",
"def initialize(*args)\n super\n @action = :set\nend",
"def after_set_callback; end",
"def setup\n #implement in subclass;\n end",
"def lookup_action; end",
"def setup &block\n if block_given?\n @setup = block\n else\n @setup.call\n end\n end",
"def setup_action\n return TSBS.error(@acts[0], 1, @used_sequence) if @acts.size < 2\n actions = TSBS::AnimLoop[@acts[1]]\n if actions.nil?\n show_action_error(@acts[1])\n end\n @sequence_stack.push(@acts[1])\n @used_sequence = @acts[1]\n actions.each do |acts|\n @acts = acts\n execute_sequence\n break if @break_action\n end\n @sequence_stack.pop\n @used_sequence = @sequence_stack[-1]\n end",
"def release_actions; end",
"def around_hooks; end",
"def save_action; end",
"def setup(easy)\n super\n easy.customrequest = @verb\n end",
"def action_target()\n \n end",
"def setup\n callback(:setup) do\n notify(:setup)\n migration_check.last_deployed_commit\n end\n end",
"def setup\n return unless @setup\n\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n run_actions_and_retry(actions)\n self\n end",
"def before_setup\n # do nothing by default\n end",
"def my_actions(options)\n @setup = false\n get_template_part(\"custom_used\",\"action_users\",true)\n end",
"def default_action; end",
"def setup(&blk)\n @setup_block = blk\n end",
"def callback_phase\n super\n end",
"def advice\n end",
"def _handle_action_missing(*args); end",
"def duas1(action)\n action.call\n action.call\nend",
"def shared_action(name, &block)\n @controller.shared_actions[name] = block\n end",
"def before_action action, &block\n @audience[:before][action] ||= Set.new\n @audience[:before][action] << block\n end",
"def setup_initial_state\n\n state_a = State.new(\"a\", 0)\n state_b = State.new(\"b\", 0)\n state_c = State.new(\"c\", 10)\n\n move_to_b = Action.new(\"move_to_b\", 1, state_b)\n\n move_to_c = Action.new(\"move_to_c\", 1, state_c)\n\n state_a.actions = [move_to_b, move_to_c]\n\n return state_a\n \nend"
] |
[
"0.6163163",
"0.6045976",
"0.5946146",
"0.591683",
"0.5890051",
"0.58349305",
"0.5776858",
"0.5703237",
"0.5703237",
"0.5652805",
"0.5621621",
"0.54210985",
"0.5411113",
"0.5411113",
"0.5411113",
"0.5391541",
"0.53794575",
"0.5357573",
"0.53402257",
"0.53394014",
"0.53321576",
"0.53124547",
"0.529654",
"0.5296262",
"0.52952296",
"0.52600986",
"0.52442724",
"0.52385926",
"0.52385926",
"0.52385926",
"0.52385926",
"0.52385926",
"0.5232394",
"0.523231",
"0.5227454",
"0.52226824",
"0.52201617",
"0.5212327",
"0.52079266",
"0.52050185",
"0.51754695",
"0.51726824",
"0.51710224",
"0.5166172",
"0.5159343",
"0.51578903",
"0.51522785",
"0.5152022",
"0.51518047",
"0.51456624",
"0.51398855",
"0.5133759",
"0.5112076",
"0.5111866",
"0.5111866",
"0.5110294",
"0.5106169",
"0.509231",
"0.50873137",
"0.5081088",
"0.508059",
"0.50677156",
"0.50562143",
"0.5050554",
"0.50474834",
"0.50474834",
"0.5036181",
"0.5026331",
"0.5022976",
"0.5015441",
"0.50121695",
"0.5000944",
"0.5000019",
"0.4996878",
"0.4989888",
"0.4989888",
"0.49864885",
"0.49797225",
"0.49785787",
"0.4976161",
"0.49683493",
"0.4965126",
"0.4958034",
"0.49559742",
"0.4954353",
"0.49535993",
"0.4952725",
"0.49467874",
"0.49423352",
"0.49325448",
"0.49282882",
"0.49269363",
"0.49269104",
"0.49252945",
"0.4923091",
"0.49194667",
"0.49174926",
"0.49173003",
"0.49171105",
"0.4915879",
"0.49155936"
] |
0.0
|
-1
|
Only allow a list of trusted parameters through.
|
def dor_master_params
params.require(:dor_master).permit(:date, :user_id)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def allowed_params\n ALLOWED_PARAMS\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def parameters_list_params\n params.require(:parameters_list).permit(:name, :description, :is_user_specific)\n end",
"def param_whitelist\n [:role, :title]\n end",
"def param_whitelist\n whitelist = [\n :username, :name,\n :parent_id,\n :headline, :description, :video,\n :policy, :signup_mode, :category,\n :website, :facebook, :twitter, :linkedin,\n :founded_at,\n privacy: [\n :events,\n :resources\n ],\n permission: [\n :profile,\n :members,\n :children,\n :statistics,\n :posts,\n :listings,\n :resources,\n :events\n ],\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:parent_id)\n unless current_user.role_in(@community) === 'owner'\n whitelist.delete(:privacy)\n whitelist.delete(:permission)\n end\n end\n \n whitelist\n end",
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def param_whitelist\n if @user.present? && current_user != @user\n return [:followed]\n end\n \n whitelist = [\n :username, :email, :password,\n :first_name, :last_name,\n :birthday, :gender,\n :headline, :biography, :ask_about, :focus,\n :website, :facebook, :linkedin, :twitter, :github,\n roles: [],\n skills: [],\n interests: [],\n privacy: { contact: [] },\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:email)\n whitelist.delete(:password)\n end\n \n whitelist\n end",
"def allow_params_authentication!; end",
"def whitelisted_args\n args.select &:allowed\n end",
"def safe_list_sanitizer; end",
"def safe_list_sanitizer; end",
"def safe_list_sanitizer; end",
"def filtered_parameters; end",
"def sanitize_params_for user, params, allowed_params\n params.each do |key, val|\n #if allowed_params.include?(key)\n #sanitize!(user, params, key) if key =~ /_attributes|_ids$/\n #else\n #params.delete(key)\n #end\n params.delete(key) unless allowed_params.include?(key.to_sym)\n end\n end",
"def strong_params\n params.require(:team_member).permit(param_whitelist)\n end",
"def expected_permitted_parameter_names; end",
"def sanitize_parameters!(sanitizer, params)\n # replace :readwrite with :onlyif\n if params.has_key?(:readwrite)\n warn \":readwrite is deprecated. Replacing with :onlyif\"\n params[:onlyif] = params.delete(:readwrite)\n end\n\n # add default parameters\n bindata_default_parameters.each do |k,v|\n params[k] = v unless params.has_key?(k)\n end\n\n # ensure mandatory parameters exist\n bindata_mandatory_parameters.each do |prm|\n if not params.has_key?(prm)\n raise ArgumentError, \"parameter ':#{prm}' must be specified \" +\n \"in #{self}\"\n end\n end\n\n # ensure mutual exclusion\n bindata_mutually_exclusive_parameters.each do |param1, param2|\n if params.has_key?(param1) and params.has_key?(param2)\n raise ArgumentError, \"params #{param1} and #{param2} \" +\n \"are mutually exclusive\"\n end\n end\n end",
"def strong_params\n params.require(:education).permit(param_whitelist)\n end",
"def safe_list_sanitizer=(_arg0); end",
"def safe_list_sanitizer=(_arg0); end",
"def safe_list_sanitizer=(_arg0); end",
"def safe_params\n resurce_name = self.class.resource_name\n params_method_name = \"#{resurce_name}_params\".to_sym\n if params[resurce_name]\n if respond_to?(params_method_name) || private_methods.include?(params_method_name)\n send(params_method_name)\n else\n raise ActiveModel::ForbiddenAttributesError, \"Please, define the '#{params_method_name}' method in #{self.class.name}\"\n end\n end\n end",
"def param_whitelist\n [:rating, :review]\n end",
"def check_params; true; end",
"def strong_params\n params.require(:experience).permit(param_whitelist)\n end",
"def validate_search_inputs\n @whitelisted = params.fetch(:user, nil)\n if @whitelisted.blank?\n render_error(400, \"#{I18n.t('general_error.params_missing_key')}\": [I18n.t('general_error.params_missing_value', model: \"review\")])\n return\n else\n @whitelisted = @whitelisted.permit(:name, :uen, :description)\n end\n end",
"def allowed?(*_)\n true\n end",
"def param_whitelist\n [\n :title,\n :description,\n :organization,\n :team_id,\n :started_at,\n :finished_at,\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n end",
"def allowed_params(parameters)\n parameters.select do |name, values|\n values.location != \"path\"\n end\n end",
"def secure_params\n return @secure_params if @secure_params\n\n defn = implementation_class.definition\n field_list = [:master_id] + defn.field_list_array\n\n res = params.require(controller_name.singularize.to_sym).permit(field_list)\n res[implementation_class.external_id_attribute.to_sym] = nil if implementation_class.allow_to_generate_ids?\n @secure_params = res\n end",
"def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end",
"def permitir_parametros\n \t\tparams.permit!\n \tend",
"def strong_params\n params.require(:community).permit(param_whitelist)\n end",
"def permit( params, whitelist, name = nil )\n raise 'Parametrization not yet configured' unless @configured\n whitelist ||= []\n px = params.respond_to?( :permit ) ? params : ActionController::Parameters.new( params )\n px = dig(px, name)\n px.permit( *whitelist )\n end",
"def valid_params?; end",
"def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end",
"def url_allowlist=(_arg0); end",
"def param_whitelist\n whitelist = [\n :description,\n :progress,\n :kpi_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:kpi_id)\n end\n \n whitelist\n end",
"def restricted_params\n #params.require(self.controller_name.classify.underscore.to_sym).permit([])\n raise(\"No strong params set, override restricted_params method in your controller. E.g. params.require(:model).permit(:attribute1, :attribute2)\")\n end",
"def list_params\n params.permit(:list_name)\n end",
"def valid_params_request?; end",
"def safe_params\n params.permit(:id, :name, :origin, :emails => []); #emails is an array\n end",
"def param_list(param_type, name, type, required, description = nil, allowed_values = [], hash = {})\n hash.merge!({allowable_values: {value_type: \"LIST\", values: allowed_values}})\n param(param_type, name, type, required, description, hash)\n end",
"def safelists; end",
"def authorize_own_lists\n authorize_lists current_user.lists\n end",
"def listed_params\n params.permit(:listed, :list_id, :listable_id, :listable_type, :campsite_id)\n end",
"def lists_params\n params.require(:list).permit(:name)\n\n end",
"def list_params\n params.require(:list).permit(:name, :user_id)\n end",
"def list_params\n params.require(:list).permit(:name, :description, :type, :privacy, :allow_edit, :rating, :votes_count, :user_id)\n end",
"def check_params\n true\n end",
"def authorize_own_or_shared_lists\n authorize_lists current_user.all_lists\n end",
"def user_pref_list_params\n\t\tparams.require(:user).permit(:preference_list)\n\tend",
"def may_contain!(*keys)\n self.allow_only_permitted = true\n self.permitted_keys = [*permitted_keys, *keys].uniq\n end",
"def filter_parameters; end",
"def filter_parameters; end",
"def whitelist; end",
"def article_params_whitelist\n params.require(:article).permit(:title, :description, category_ids: [])\n end",
"def list_params\n params.require(:list).permit(:name)\n end",
"def list_params\n params.permit(:name)\n end",
"def recipient_list_params\n params.require(:recipient_list).permit(:name, :list, :references)\n end",
"def cancan_parameter_sanitizer\n resource = controller_name.singularize.to_sym\n method = \"#{resource}_params\"\n params[resource] &&= send(method) if respond_to?(method, true)\n end",
"def list_params\n params.require(:list).permit(:name).merge(user_id: current_user.id)\n end",
"def whitelist_place_params\n params.require(:place).permit(:place_name, :unlock, :auth, :is_deep_checked, :parent_ADM4, :parent_ADM3, :parent_ADM2, :parent_ADM1, :parent_country, feature_code: [], same_as: [], related_authority: [], altlabel: [], note: []) # Note - arrays need to go at the end or an error occurs!\n end",
"def list_params\n params.fetch(:list, {}).permit(:user_id, :name, :active)\n end",
"def permitted_strong_parameters\n :all #or an array of parameters, example: [:name, :email]\n end",
"def secure_params(require_param, permit_keys)\n params.require(require_param).permit(*permit_keys)\n end",
"def grant_params\n @whitelisted = params.require(:grant).permit(:name, :description, :agency_id, :acronym)\n end",
"def permitted_params\n []\n end",
"def price_list_params\n params.fetch(:price_list, {}).permit(:name, :valid_from, :valid_to, :active,\n :all_warehouses, :all_users, :all_contact_groups,\n warehouse_ids: [], price_lists_user_ids: [], contact_group_ids: [])\n end",
"def params(list)\n @declared_params = list\n end",
"def admin_review_params\n params.fetch(:review, {}).permit(whitelisted_params)\n end",
"def saved_list_params\n params.require(:saved_list).permit(:user_id)\n end",
"def allow(ids); end",
"def list_params\n params.require(:list).permit(:name)\n end",
"def list_params\n params.require(:list).permit(:name)\n end",
"def list_params\n params.require(:list).permit(:name)\n end",
"def filter_params(param_set, **kwargs)\r\n begin\r\n key = kwargs[:key]\r\n params.require(key).permit(*param_set)\r\n rescue Exception\r\n params.permit(*param_set)\r\n end\r\n end",
"def valid_parameters\n sort_symbols(@interface.allowed_parameters)\n end",
"def validate_paramified_params\n self.class.paramify_methods.each do |method|\n params = send(method)\n transfer_errors_from(params, TermMapper.scope(params.group)) if !params.valid?\n end\n end",
"def list_params\n params.require(:list).permit(:name)\n end",
"def secure_params\n return @secure_params if @secure_params\n\n @implementation_class = implementation_class\n resname = @implementation_class.name.ns_underscore.gsub('__', '_').singularize.to_sym\n @secure_params = params.require(resname).permit(*permitted_params)\n end",
"def refine_permitted_params(param_list)\n res = param_list.dup\n\n ms_keys = res.select { |a| columns_hash[a.to_s]&.array }\n ms_keys.each do |k|\n res.delete(k)\n res << { k => [] }\n end\n\n res\n end",
"def recipient_list_params\n params.require(:recipient_list).permit(:name, :description, recipient_id_array: [])\n end",
"def safelist; end",
"def sponsor_params\n params.require(:sponsor).permit(WHITE_LIST)\n end",
"def valid_for_params_auth?; end",
"def default_param_whitelist\n [\"mode\"]\n end",
"def devise_filter\r\n logger.debug(\"In devise_filter =>PARAMS: #{params.inspect}\")\r\n\r\n # White list for sign_up\r\n devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(user_whitelist) }\r\n\r\n # White list for account update\r\n devise_parameter_sanitizer.for(:account_update) { |u| u.permit(user_whitelist, :current_password) }\r\n\r\n # White list for Invitation creation\r\n devise_parameter_sanitizer.for(:invite) { |u| u.permit(:account_type, :email, :invitation_token)}\r\n\r\n # White list for accept invitation\r\n devise_parameter_sanitizer.for(:accept_invitation) { |u| u.permit(user_whitelist, :invitation_token)}\r\n\r\n end",
"def shopping_list_params\n params.require(:shopping_list).permit!\n end",
"def permitted_params\n declared(params, include_missing: false)\n end",
"def permitted_params\n declared(params, include_missing: false)\n end",
"def safe_params\n params.except(:host, :port, :protocol).permit!\n end",
"def permitters\n @_parametrizr_permitters || {}\n end",
"def allow_params(action, keys: nil, except: nil, &blk)\n keys &&= Array.wrap(keys)\n keys ||= User.field_names\n except &&= Array.wrap(except)\n except ||= %i[id email]\n devise_parameter_sanitizer.permit(action, keys: keys, except: except, &blk)\n end",
"def list_params\n if current_user && current_user.role == 'admin'\n params.require(:list).permit(:name, :url, :description, :user_id,\n ideas_attributes: [:id, :list_id, :body, :due_date, :completion_status, :_destroy])\n else\n params.require(:list).permit(:name, :description,\n ideas_attributes: [:body, :due_date, :completion_status]) \n end\n end",
"def whitelist(params)\n send_request_of_type(GlobalConstant::PrivateOpsApi.private_ops_api_type, 'post', '/token-sale/whitelist', params)\n end",
"def valid_access_params\n params.require(:valid_access).permit(:wish_list_id, :user_id)\n end",
"def url_allowlist; end",
"def ensure_redirected_params_are_safe!(passed_params)\n unless passed_params.is_a?(ActionController::Parameters) && passed_params.permitted?\n error_message = if passed_params.is_a?(ActionController::Parameters)\n unsafe_parameters = passed_params.send(:unpermitted_keys, params)\n \"[Rails::Prg] Error - Must use permitted strong parameters. Unsafe: #{unsafe_parameters.join(', ')}\"\n else\n \"[Rails::Prg] Error - Must pass strong parameters.\"\n end\n raise error_message\n end\n end",
"def data_collection_params\n allow = [:name,:description,:institution,:collection_name,:country_id,:province_id,:city_id]\n params.require(:data_collection).permit(allow)\n end",
"def quote_params\n params.permit!\n end"
] |
[
"0.69497335",
"0.6812623",
"0.6803639",
"0.6795365",
"0.67448795",
"0.67399913",
"0.6526815",
"0.6518771",
"0.64931697",
"0.6430388",
"0.6430388",
"0.6430388",
"0.63983387",
"0.6356042",
"0.63535863",
"0.63464934",
"0.63444513",
"0.6337208",
"0.6326454",
"0.6326454",
"0.6326454",
"0.63140553",
"0.6299814",
"0.62642586",
"0.626006",
"0.62578833",
"0.6236823",
"0.6227561",
"0.6221758",
"0.62200165",
"0.620879",
"0.61983657",
"0.6195055",
"0.6172993",
"0.6156856",
"0.61558664",
"0.61521494",
"0.6135789",
"0.6121145",
"0.61118174",
"0.60736513",
"0.6071645",
"0.60632104",
"0.60549796",
"0.6043906",
"0.6034662",
"0.60207325",
"0.6018568",
"0.6016575",
"0.60103434",
"0.60084206",
"0.600763",
"0.6007443",
"0.6003619",
"0.6003619",
"0.5995791",
"0.5993301",
"0.5993231",
"0.5984926",
"0.597122",
"0.5968121",
"0.5965808",
"0.59640145",
"0.59632224",
"0.59602356",
"0.59332967",
"0.5927556",
"0.5922805",
"0.5909745",
"0.5905083",
"0.5904304",
"0.5893434",
"0.58888215",
"0.58823985",
"0.58823985",
"0.58823985",
"0.5873434",
"0.58619875",
"0.58533794",
"0.5845531",
"0.58426666",
"0.58360124",
"0.583218",
"0.5828041",
"0.5827927",
"0.5816121",
"0.5814705",
"0.5812719",
"0.581121",
"0.5803423",
"0.5803423",
"0.57995003",
"0.5794207",
"0.5784923",
"0.5781365",
"0.5776385",
"0.5774859",
"0.57671493",
"0.5766998",
"0.57618684",
"0.5758038"
] |
0.0
|
-1
|
Export the word frequency data. This saves its data out as a CSV file to be downloaded by the user later. As of yet, we don't offer display in the browser; I think this data is so complex that you'll want to pull it up on a spreadsheet. Note that there are also parameters to be passed in to the `ComputeWordFrequencies` concern; see that concern's documentation for the specification of those arguments.
|
def perform
options.clean_options!
at(0, 100, t('common.progress_initializing'))
user = User.find(options[:user_id])
dataset = user.datasets.active.find(options[:dataset_id])
task = dataset.analysis_tasks.find(options[:task_id])
task.name = t('.short_desc')
task.save
# Do the analysis
analyzer = compute_word_frequencies(
dataset,
->(p) { at(p, 100, t('.progress_calculating')) },
options)
corpus_size = RLetters::Solr::CorpusStats.new.size
# Create some CSV
at(100, 100, t('common.progress_finished'))
csv_string = CSV.generate do |csv|
csv << [t('.csv_header', name: dataset.name)]
csv << ['']
# Output the block data
if analyzer.blocks.size > 1
csv << [t('.each_block')]
name_row = ['']
header_row = ['']
word_rows = []
analyzer.word_list.each do |w|
word_rows << [w]
end
types_row = [t('.types_header')]
tokens_row = [t('.tokens_header')]
ttr_row = [t('.ttr_header')]
analyzer.blocks.each_with_index do |b, i|
s = analyzer.block_stats[i]
name_row << s[:name] << '' << '' << ''
header_row << t('.freq_header') \
<< t('.prop_header') \
<< t('.tfidf_dataset_header') \
<< t('.tfidf_corpus_header')
word_rows.each do |r|
word = r[0]
r << (b[word] || 0).to_s
r << ((b[word] || 0).to_f / s[:tokens].to_f).to_s
r << Math.tfidf((b[word] || 0).to_f / s[:tokens].to_f,
analyzer.df_in_dataset[word],
dataset.entries.size)
if analyzer.df_in_corpus.present?
r << Math.tfidf((b[word] || 0).to_f / s[:tokens].to_f,
analyzer.df_in_corpus[word],
corpus_size)
else
r << ''
end
end
# Output the block stats at the end
types_row << s[:types].to_s << '' << '' << ''
tokens_row << s[:tokens].to_s << '' << '' << ''
ttr_row << (s[:types].to_f / s[:tokens].to_f).to_s << '' << '' << ''
end
csv << name_row
csv << header_row
word_rows.each do |r|
csv << r
end
csv << types_row
csv << tokens_row
csv << ttr_row
end
# Output the dataset data
csv << ['']
csv << [t('.whole_dataset')]
csv << ['', t('.freq_header'), t('.prop_header'),
t('.df_header'), t('.tfidf_corpus_header')]
analyzer.word_list.each do |w|
tf_in_dataset = analyzer.tf_in_dataset[w]
r = [w,
tf_in_dataset.to_s,
(tf_in_dataset.to_f / analyzer.num_dataset_tokens).to_s]
if analyzer.df_in_corpus.present?
r << analyzer.df_in_corpus[w].to_s
r << Math.tfidf(tf_in_dataset, analyzer.df_in_corpus[w],
corpus_size)
else
r << ''
r << ''
end
csv << r
end
csv << [t('.types_header'), analyzer.num_dataset_types.to_s]
csv << [t('.tokens_header'), analyzer.num_dataset_tokens.to_s]
csv << [t('.ttr_header'), (analyzer.num_dataset_types.to_f /
analyzer.num_dataset_tokens).to_s]
csv << ['']
end
# Write it out
ios = StringIO.new(csv_string)
file = Paperclip.io_adapters.for(ios)
file.original_filename = 'word_frequency.csv'
file.content_type = 'text/csv'
task.result = file
# We're done here
task.finish!
completed
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def to_csv\n CSV.generate do |csv|\n csv << %w[word count]\n sort_words.each do |word_count|\n csv << word_count\n end\n end\n end",
"def freqs_to_csv(frequencies, path)\n CSV.open(path, \"wb\") do |csv|\n frequencies.map { |k, v| csv << [k, v] }\n end\nend",
"def write_to_csv(opts = {})\n filename = opts.fetch(:filename) { 'twords_report.csv' }\n write_file(filename, :to_csv, opts)\n end",
"def document_frequency\n @corpus.each_with_object({}) do |doc, df|\n doc.bag_of_words.keys.each do |word|\n df[word] = (df.fetch(word) { 0.0 }) + 1.0\n end\n end\n end",
"def outputFreqTable(fT)\n open('frequencyTable.json', 'w') do |f|\n f.write JSON.dump(fT)\n end\n puts \"Frequency Table successfully saved as frequencyTable.json\\n\\n\"\nend",
"def write_counts(output)\n File.open(output, 'w') do |output_file|\n @count_array.each do |pair|\n key, value = pair\n output_file << \"#{key}\\t#{value}\\n\"\n end\n end\n end",
"def export_csv\n correct\n CSV.open('output.csv', 'a') do |csv|\n @suggestion.each_with_index{|(name,score), index|\n word = @typed_name.capitalize #typed name\n sugges = name.capitalize #suggestion name\n score = (@suggestion[name].round(3)).to_s #score of this suggestion\n years = @year #which years are inserted to dictionary\n ed = \"NA\" #which ED this name belongs to\n ed_count = \"NA\" #how many candidates fall in ED of this name\n\n # Check frequency for the words in suggestion list\n # Typed word, not in the dictionary has zero frequency\n if @working_dictionary.has_key?(name)\n freq = (@working_dictionary[name]).to_s \n else\n freq = 0\n end\n \n # Check which edit distance the word belongs to.\n\n # Check if the word is from @ed1\n if !@ed1.empty?\n if @ed1.include?(name)\n ed = 1.to_s\n ed_count = @count_ed1.to_s\n end\n end\n\n # Check if the word is from @ed2\n if !@ed2.empty?\n if @ed2.include?(name)\n ed = 2.to_s\n ed_count = @count_ed2.to_s\n end \n end\n\n # Build a string to insert in csv file\n if index == 0 # years are displayed only in first line for this @typed_name\n line = [word, sugges, score, freq, ed, ed_count, year] \n else\n line = [word, sugges, score, freq, ed, ed_count] \n end\n\n csv << line\n }\n csv << [] # insert blank line as last line\n end\n end",
"def export_data\r\n folder = \"\\data\"\r\n FileUtils.mkdir_p folder\r\n CSV.open(File.join(folder, @output_stats_name), 'wb') do |csv|\r\n csv << @global_bests\r\n csv << @average_global_bests\r\n @neighbourhoods_list[0].report_particles.each do |x|\r\n csv << x\r\n end\r\n end\r\n end",
"def word_frequency(params={})\n # Set default options\n options = {\n tweets: [@statuses_count, 1000].min,\n include_rts: true,\n exclude_replies: true\n }\n\n # Combine the options the user has set\n options.merge!(params)\n\n result = {}\n\n # Get the tweets which will be in @timeline\n get_timeline(options[:tweets])\n\n # Go through each tweet in the timeline and match words only\n # [key] word => [value] number of times it is used\n @timeline.each do |tweet|\n tweet.text.split.each do |t|\n\n # Some matches come out as null so skip if they are nil\n word = t.downcase.match(/\\w(?<!\\d)[\\w'-]*/)\n next unless word\n word = word[0]\n\n # Check if word has been added to the result, increment count\n if result.has_key?(word)\n result[word] += 1\n else\n result[word] = 1\n end\n end\n end\n\n result = result.sort_by { |key, value| value }.reverse\n print_word_frequency(result)\n end",
"def index\n @words = Word.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @words }\n format.csv { send_csv }\n end\n end",
"def export_csv\n # Find all Setup with the stored restrictions\n sorting :default => @@default_sort\n collection = @@model.find :all, :order => @sort, :conditions => session[:conditions]\n # Creation of the file\n file_name = \"#{@@param_name}_export_\" + current_user.id.to_s + \".csv\"\n \n csv_string = CSV.generate({:col_sep => ';', :encoding => \"ISO-8859-15\" }) do |csv|\n csv << @@name_print.map{|n| n.trn}\n collection.each do |element|\n csv << @@field_print.map{|f| element[f]}\n end\n end\n send_data Iconv.conv('iso-8859-1//IGNORE', 'utf-8', csv_string), :filename => file_name, :disposition => 'attachment', :type => 'text/csv; charset=iso-8859-1; header=present'\n end",
"def calculate_term_frequencies\n results = []\n\n @tokenized_documents.each do |tokens|\n document_result = {}\n tokens[:words].each do |term, count|\n document_result[term] = (count/tokens[:total_count].to_f).round(6)\n end\n\n results << document_result\n end\n\n results\n end",
"def export\n fn = current_user.name + \"'s blood glucose readings.csv\"\n respond_to do |format|\n format.csv { send_data(BgMeasurement.to_csv(current_user), :filename => fn) }\n end\n end",
"def word_frequency\n @word_use = Hash.new(0)\n words.each { |w| @word_use[w] += 1 }\n @word_use\n end",
"def output_to_csv\n if (@values[:result] != nil)\n @additions << calculate_worktime\n filename = get_entry(\"Specify output file: \")\n p = Menu.data_handler.find_person_by_id(@values[:id])\n CSVWriter.output(filename, p, @values[:result], @additions)\n else\n puts \"Nothing to write right now.\"\n end\n end",
"def frequencies\n analyzer = Frequency.call(\n dataset: dataset,\n stemming: stemming,\n block_size: window,\n last_block: :small_last,\n split_across: false,\n progress: ->(p) { progress&.call((p.to_f / 100.0 * 33.0).to_i) }\n )\n\n # Combine all the block hashes, summing the values\n total = analyzer.blocks.size.to_f\n\n base_frequencies = {}\n analyzer.blocks.each_with_index do |b, i|\n progress&.call((i.to_f / total * 16.0).to_i + 33)\n\n b.each_key do |k|\n base_frequencies[k] ||= 0\n base_frequencies[k] += 1\n end\n end\n\n # Get the frequencies of cooccurrence with the word in question\n joint_frequencies = {}\n pairs.each_with_index do |(word, word2_array), i|\n joint_frequencies[word] = {}\n\n analyzer.blocks.each_with_index do |b, j|\n if progress\n p = (i.to_f / pairs.size.to_f) +\n (1 / pairs.size.to_f) * (j.to_f / total.to_f)\n progress.call((p * 17.0).to_i + 49)\n end\n\n next unless b[word]&.>(0)\n\n if word2_array.empty?\n b.each_key do |k|\n joint_frequencies[word][k] ||= 0\n joint_frequencies[word][k] += 1\n end\n else\n word2_array.each do |w|\n if b.key?(w)\n joint_frequencies[word][w] ||= 0\n joint_frequencies[word][w] += 1\n end\n end\n end\n end\n end\n\n [base_frequencies, joint_frequencies, analyzer.blocks.size]\n end",
"def get_word_freq\n speech_links = get_links_to_speeches\n word_freq = Hash.new(0)\n \n speech_links.each do |link|\n speech_page = link.click\n if (speech_obj = speech_page.at SPEECH_DIV_IDENTIFIER)\n speech = speech_obj.text\n words = speech.split(' ')\n words.each{ |word| word_freq[clean_str(word)] += 1 }\n end\n end\n\n word_freq.sort_by{ |x,y| y }.reverse\n end",
"def create_csv\n title = [\"Typed Word\",\"Suggestion\", \"Score\", \"Frequency\", \"ED?\", \"Count ED\", \"Year\"]\n CSV.open('output.csv', 'a') do |csv|\n csv << title\n end\n end",
"def save_as_csv\n CSV.open(\"./db/#{@name}.csv\", \"wb\") {|csv| @result_scrap.to_a.each {|elem| csv << elem} }\n end",
"def compute_word_frequencies(dataset, progress = nil, args = {})\n convert_args!(args)\n\n # Quick-out for the FromTF analyzer if we can: only one block,\n # one-grams, no stemming\n if ((args[:num_blocks] && args[:num_blocks] == 1) ||\n (args[:num_blocks].nil? && args[:block_size].nil?)) &&\n (args[:ngrams].nil? || args[:ngrams] == 1) &&\n (args[:stemming].nil?)\n return RLetters::Analysis::Frequency::FromTF.new(\n dataset,\n progress,\n split_across: args.delete(:split_across),\n num_words: args.delete(:num_words),\n inclusion_list: args.delete(:inclusion_list),\n exclusion_list: args.delete(:exclusion_list),\n stop_list: args.delete(:stop_list)\n )\n end\n\n # Produce a word list generator\n word_lister_options = {\n ngrams: args.delete(:ngrams),\n stemming: args.delete(:stemming)\n }\n @word_lister = RLetters::Documents::WordList.new(word_lister_options)\n\n # Segment the dataset into text blocks\n doc_segmenter_options = {\n num_blocks: args.delete(:num_blocks),\n block_size: args.delete(:block_size),\n last_block: args.delete(:last_block)\n }\n @doc_segmenter = RLetters::Documents::Segments.new(@word_lister,\n doc_segmenter_options)\n\n set_segmenter_options = {\n split_across: args.delete(:split_across)\n }\n @set_segmenter = RLetters::Datasets::Segments.new(dataset,\n @doc_segmenter,\n set_segmenter_options)\n\n # Perform the position-based analysis (with the remaining args)\n RLetters::Analysis::Frequency::FromPosition.new(@set_segmenter, progress, args)\n end",
"def print_csv_results\n FileUtils.mkdir_p(\"data\")\n File.open(\"data/results.csv\", \"w\") do |f|\n @data.sort_by{|id, values| values[\"sum_dose\"]}.each do |id, values|\n f.puts \"%s\\t%d\\t%.4f\" % [id, values[\"ddays\"], dose_unit(values[\"sum_dose\"])]\n end\n end\n end",
"def frequency\n counts = Hash.new(0)\n self.words.each { |word| counts[word] += 1 }\n counts\n end",
"def writeData(filename = \"out.csv\")\n\t\tfile = File.new(filename, \"w\")\n\t\t\n\t\t@dataArray.each do |singleEntry|\n\t\t\tfile.puts \"#{singleEntry[0]},#{singleEntry[1]},#{singleEntry[2]}\"\n\t\tend\n\t\n\t\tfile.close\n\t\t\n\tend",
"def calculate_term_frequencies\n results = []\n \n @data.each do |document|\n document_result = {}\n \n document.each do |term|\n if document_result.key?(term)\n document_result[term] += 1.0\n else\n document_result[term] = 1.0\n end\n end\n \n # Normalize the count\n document_result.each_key do |term|\n document_result[term] /= document.size\n end\n \n results << document_result\n end\n \n results\n end",
"def compute_termfreq(options={})\n return @termfreq if @computed_termfreq\n\n @enum.each do |blob|\n # Skip binary file extensions\n next if blob.binary_mime_type?\n\n # Linguist::FileBlob#generated? can fail\n # with \"invalid byte sequence in UTF-8\"\n begin\n # Skip vendored or generated blobs\n next if blob.vendored? || blob.generated? || blob.language.nil?\n rescue\n next\n end\n\n # Only include programming languages\n if blob.language.type == :programming\n # Skip if lang option is on and this blob is not in the list of specified languages\n next if options[:lang] and not options[:lang].include? blob.language.name\n\n words = []\n\n # Linguist::FileBlob#safe_to_colorize? can similarly fail\n # with \"invalid byte sequence in UTF-8\"\n begin\n if blob.safe_to_colorize?\n words = @parser.parse(CGI.unescapeHTML(blob.colorize()))\n end\n rescue\n next\n end\n \n words.each do |word|\n tokens = @tokenizer.tokenize(word)\n tokens.each do |token|\n @termfreq[token] += 1\n end\n end\n end\n end\n\n @computed_termfreq = true\n\n @termfreq\n end",
"def save_words\n\t\t @word_weight.each do |word, weight|\n\t\t \t@db.update_or_create_word(word, @filename, weight, @word_frequency[word])\n\t\t end\n\t\tend",
"def process_words(freqs, n, word_counts)\n\t# per word calculations\n\tstats = Hash.new\n\tfreqs.each do |key,value|\t\t\t\t\t\t\t\t\t\t# <= for each word...\n\t\t(n - value.size).times { value << 0 } \t\t\t\t# <= \"fills up\" word frequency array with 0s\n\t\tfreqs[key] = value.each_with_index.map { |freq,index| freq.to_f/(word_counts[index]==0 ? 1 : word_counts[index])}\t\t# <= converts each absolute frequency to a relative frequency\n\t\tstats[key] = crunch_stats(freqs[key], n)\n\tend\n\tputs freqs\n\tputs stats\nend",
"def export_dictionary(filename)\n unless @data[:words].nil?\n File.open(filename, 'w') { |f| f.write(@data[:words].to_yaml) }\n end\n end",
"def data_write\n fd = File.new('fraze.dat',\"w\")\n $words.each_index do\n |iw|\n printf(fd,\"%s|%d|%d|%s|%s\\n\",\n $words[iw].fname,\n $words[iw].enlevel,\n $words[iw].czlevel,\n $words[iw].english,\n $words[iw].czech)\n end\n fd.close\n puts \"\\nDatabase stored\"\nend",
"def word_freq(text)\n frequency = {}\n unique_words(text).each do |word|\n frequency[word] = 0\n end\n split_normalise(text).each do |word|\n frequency[word] += 1\n end\n frequency\nend",
"def write(data)\n begin\n File.open(@filename, \"wb\") { |file| file.puts data.to_csv }\n rescue \n puts \"Error: \" + $!.to_s\n end \n end",
"def unique_words\n @frequencies.keys\n end",
"def to_csv\n FileOutputService.to_csv(result, file_options)\n end",
"def write(filename)\n ::File.write(filename, Helli::CSV.write(data, @type))\n end",
"def process(output)\n read_tokens\n count_tokens\n sort_counts\n write_counts(output)\n end",
"def export\n #@contacts = Contact.all\n send_data Contact.to_csv(@contacts),\n :filename => 'addressbook.csv',\n :type => 'text/csv; charset=utf-8',\n :disposition => 'attachment'\n end",
"def export_csv\n # Find all Setup with the stored restrictions\n sorting :default => \"name\"\n collection = PostitTask.find :all, :order => @sort, :conditions => session[:conditions]\n # Creation of the file\n file_name = \"postit_task_export_\" + current_user.id.to_s + \".csv\"\n \n csv_string = CSV.generate({:col_sep => ';', :encoding => \"ISO-8859-15\" }) do |csv|\n csv << [\"Nom\".trn,\"Description\".trn,\"Séquence\".trn]\n collection.each do |element|\n csv << [element.name,element.description,element.sequence]\n end\n end\n send_data Iconv.conv('iso-8859-1//IGNORE', 'utf-8', csv_string), :filename => file_name, :disposition => 'attachment', :type => 'text/csv; charset=iso-8859-1; header=present'\n end",
"def perform(task, options = {})\n standard_options(task, options)\n\n # Patch up the two strange arguments that don't come in the right format\n # from the web form\n options[:all] = true if options[:word_method] == 'all'\n options.delete(:stemming) if options[:stemming] == 'no'\n\n # Do the analysis\n analyzer = RLetters::Analysis::Frequency.call(\n options.merge(\n dataset: dataset,\n progress: ->(p) { task.at(p, 100, t('.progress_calculating')) }\n )\n )\n\n corpus_size = RLetters::Solr::CorpusStats.new.size\n dataset_size = dataset.document_count\n\n # Create some CSV\n csv_string = csv_with_header(header: t('.csv_header',\n name: dataset.name)) do |csv|\n # Output the block data\n if analyzer.blocks.size > 1\n csv << [t('.each_block')]\n\n name_row = ['']\n header_row = ['']\n word_rows = []\n analyzer.word_list.each do |w|\n word_rows << [w]\n end\n types_row = [t('.types_header')]\n tokens_row = [t('.tokens_header')]\n ttr_row = [t('.ttr_header')]\n\n analyzer.blocks.each_with_index do |b, i|\n s = analyzer.block_stats[i]\n\n name_row << s[:name] << '' << '' << ''\n header_row << t('.freq_header') << t('.prop_header')\n header_row << t('.tfidf_dataset_header')\n header_row << t('.tfidf_corpus_header')\n\n word_rows.each do |r|\n word = r[0]\n r << (b[word] || 0).to_s\n r << ((b[word] || 0).to_f / s[:tokens].to_f).to_s\n\n r << Math.tfidf((b[word] || 0).to_f / s[:tokens].to_f,\n analyzer.df_in_dataset[word],\n dataset_size)\n r << if analyzer.df_in_corpus.present?\n Math.tfidf((b[word] || 0).to_f / s[:tokens].to_f,\n analyzer.df_in_corpus[word],\n corpus_size)\n else\n ''\n end\n end\n\n # Output the block stats at the end\n types_row << s[:types].to_s << '' << '' << ''\n tokens_row << s[:tokens].to_s << '' << '' << ''\n ttr_row << (s[:types].to_f / s[:tokens].to_f).to_s << '' << '' << ''\n end\n\n csv << name_row\n csv << header_row\n word_rows.each do |r|\n csv << r\n end\n csv << types_row\n csv << tokens_row\n csv << ttr_row\n end\n\n # Output the dataset data\n csv << ['']\n csv << [t('.whole_dataset')]\n csv << ['', t('.freq_header'), t('.prop_header'),\n t('.df_header'), t('.tfidf_corpus_header')]\n analyzer.word_list.each do |w|\n tf_in_dataset = analyzer.tf_in_dataset[w]\n r = [w,\n tf_in_dataset.to_s,\n (tf_in_dataset.to_f / analyzer.num_dataset_tokens).to_s]\n if analyzer.df_in_corpus.present?\n r << analyzer.df_in_corpus[w].to_s\n r << Math.tfidf(tf_in_dataset, analyzer.df_in_corpus[w],\n corpus_size)\n else\n r << ''\n r << ''\n end\n csv << r\n end\n csv << [t('.types_header'), analyzer.num_dataset_types.to_s]\n csv << [t('.tokens_header'), analyzer.num_dataset_tokens.to_s]\n csv << [t('.ttr_header'), (analyzer.num_dataset_types.to_f /\n analyzer.num_dataset_tokens).to_s]\n end\n\n # Write out the CSV to a file\n task.files.create(description: 'Spreadsheet',\n short_description: 'CSV', downloadable: true) do |f|\n f.from_string(csv_string, filename: 'results.csv',\n content_type: 'text/csv')\n end\n\n # Save out JSON to make an interactive word cloud\n word_cloud_data = {\n word_cloud_words: analyzer.word_list.each_with_object({}) do |w, ret|\n ret[w] = analyzer.tf_in_dataset[w]\n end\n }\n\n task.files.create(description: 'JSON Data for Word Cloud',\n short_description: 'JSON') do |f|\n f.from_string(word_cloud_data.to_json, filename: 'word_cloud.json',\n content_type: 'application/json')\n end\n\n task.mark_completed\n end",
"def output_replaced_words\n replaced_words = @lemma_replacements.map { |e| e.join(\",\") }.join(\"\\n\")\n\n File.open(\"#{@output_directory}/replaced_words.csv\", \"w\") do |file|\n file << replaced_words\n end\n end",
"def index\n @search = Claim.order('claims.created_at desc').search(params[:q])\n @claims = @search.result(:distinct => true).paginate(:per_page => 50, :page => params[:page])\n respond_to do |format|\n format.html{}\n format.csv {\n send_data generate_csv, :type => 'text/csv; charset=iso-8859-1; header=present', :disposition => \"attachment; filename=claims_list.csv\" \n }\n end\n end",
"def calculate_inverse_document_frequency\n results = {}\n \n terms.each do |term|\n count = 0.0\n \n @data.each do |document|\n count += 1 if document.include?(term)\n end\n \n results[term] = Math.log10(total_documents / count)\n end\n \n results\n end",
"def write_champ_data(filename, data)\n CSV.open(filename, \"wb\") do |csv|\n csv << [\"ID\", \"Name\", \"Title\"]\n data.each do |data|\n csv << data\n end\n end\nend",
"def calculate_inverse_document_frequency\n results = {}\n\n tokenized_documents.each do |document|\n terms = document[:words]\n terms.each_key do |term|\n results[term] ||= 0\n results[term] += 1\n end\n end\n\n results.each_pair do |term, count|\n results[term] = 1 + Math.log(total_documents.to_f / (count + 1.0))\n end\n\n results\n end",
"def to_csv(options = {})\n if [\"html\", \"pdf\", \"xml\", \"combined\"].include? options[:format]\n view = \"counter_#{options[:format]}_views\"\n else\n view = \"counter\"\n end\n\n service_url = \"#{ENV['COUCHDB_URL']}/_design/reports/_view/#{view}\"\n\n result = get_result(service_url, options.merge(timeout: 1800))\n if result.blank? || result[\"rows\"].blank?\n Alert.create(exception: \"\", class_name: \"Faraday::ResourceNotFound\",\n message: \"CouchDB report for Counter could not be retrieved.\",\n source_id: id,\n status: 404,\n level: Alert::FATAL)\n return \"\"\n end\n\n if view == \"counter\"\n CSV.generate do |csv|\n csv << [\"pid_type\", \"pid\", \"html\", \"pdf\", \"total\"]\n result[\"rows\"].each { |row| csv << [\"doi\", row[\"key\"], row[\"value\"][\"html\"], row[\"value\"][\"pdf\"], row[\"value\"][\"total\"]] }\n end\n else\n dates = date_range(options).map { |date| \"#{date[:year]}-#{date[:month]}\" }\n\n CSV.generate do |csv|\n csv << [\"pid_type\", \"pid\"] + dates\n result[\"rows\"].each { |row| csv << [\"doi\", row[\"key\"]] + dates.map { |date| row[\"value\"][date] || 0 } }\n end\n end\n end",
"def print_as_csv\n file_data = []\n file_data << headers\n @case_data_by_date_map.each do |_, elements|\n file_data += elements.shuffle\n end\n\n file_data.each do |element|\n puts element.join(',')\n end\n end",
"def index\n @cautelas = Cautela.search(params[:search], params[:page])\n respond_to do |format|\n format.html\n #format.csv { send_data(@cautelas.to_csv) }\n format.csv {\n filename = \"CEPI_Cautelas-#{Time.now.strftime(\"%Y%m%d%H%M%S\")}.csv\"\n send_data(@cautelas.to_csv, :type => \"text/csv; charset=utf-8; header=present\", :filename => filename)\n }\n end\n end",
"def calculate\n document_frequency.each_with_object({}) do |(word, freq), idf|\n idf[word] = Math.log(@corpus.size/freq)\n end\n end",
"def save\n CSV.open('FoodDB.txt', 'w') do |csv|\n database.each_value do |v|\n csv << v.to_array\n end\n end\n end",
"def output_csv(datastore)\n CSV.open(OUTPUT_CSV, \"wb\") do |csv|\n csv << \t[\"Period\", \"First Use In\", \"Engaged Users\"]\n\n datastore.keys.sort.each do |date_key|\n pretty_date = Date.parse(date_key.split(\"_\")[0]).strftime(\"%Y-%m-%d\")\n datastore[date_key].keys.sort.each do |cohort_key|\n pretty_cohort= Date.parse(cohort_key.split(\"_\")[0]).strftime(\"%Y-%m-%d\")\n csv << [ pretty_date, pretty_cohort,\tdatastore[date_key][cohort_key]['total_users']]\n end\n end\n end\nend",
"def to_file(filename)\n CSV.open(filename,'w') do |w|\n w << %w{label name type unit per_unit default}\n values.each do |value|\n value.write_csv(w)\n end\n end\n end",
"def to_file(filename, hits, qvalues=[])\n File.open(filename,'w') do |out|\n out.puts HEADER.join(FILE_DELIMITER)\n hits.zip(qvalues) do |hit, qvalue|\n out.puts [hit.search_id, hit.id, hit.aaseq, hit.charge, qvalue || hit.qvalue].join(FILE_DELIMITER)\n end\n end\n filename\n end",
"def to_file(filename, hits, qvalues=[])\n File.open(filename,'w') do |out|\n out.puts HEADER.join(FILE_DELIMITER)\n hits.zip(qvalues) do |hit, qvalue|\n out.puts [hit.search.id, hit.id, hit.aaseq, hit.charge, qvalue || hit.qvalue].join(FILE_DELIMITER)\n end\n end\n filename\n end",
"def show\n @seo_search_term = Seo::SearchTerm.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.csv do\n send_data(@seo_search_term.search_term_queries.recent.first.to_csv,\n :type => 'text/csv; charset=utf-8; header=present',\n :filename => \"#{@seo_search_term.term}-results.csv\") and return\n end\n format.xml { render :xml => @seo_search_term }\n end\n end",
"def writeCSVFile(dataArray, fileName)\n\t# Create file handle\n\toutFile = File.new(fileName, 'w');\n\t\n\t# Loop through and output each piece of data\n\tdataArray.each_index do |i|\n\t\toutFile.print(\"#{dataArray[i]}\")\n\t\t\n\t\t# This check is so that we do not have an extra comma at the end\n\t\tif (i < dataArray.length() - 1)\n\t\t\toutFile.print(\", \");\n\t\tend\n\tend\n\toutFile.puts();\n\t\n\toutFile.close();\nend",
"def frequency(number_of_hours)\n word_count = Word.where(\"name = ? AND story_date > ?\", self, Time.now - number_of_hours.hours).count\n total_words = Word.where(\"story_date > ?\", Time.now - number_of_hours.hours).count\n return word_count.to_f / total_words.to_f\n end",
"def index\n @water_frequencies = WaterFrequency.all\n end",
"def count_danger_dave_faults\n danger_dave_es = '/Users/michael/Desktop/language_files/danger_dave_inflection_freqs/content/2016/es/es_full.txt'\n bw_count = File.new('./bw_count.txt', 'w+')\n not_found_count = File.new('./not_found_count.txt', 'w+')\n File.readlines(danger_dave_es).each do |word_n_freq|\n if $. == 100\n break\n end\n word_n_freq_arr = word_n_freq.split(' ')\n word = word_n_freq_arr[0]\n hit_count = word_n_freq_arr[1]\n bw_exists = BaseWord.find_by(base_word: word)\n # headers for bw_count file: base_word, hit_count, (inflection), base_word_id\n # headers for not_found_count file: inflection, hit_count\n if bw_exists\n bw_count.puts word + ' ' + hit_count + ' ' + '(' + word + ')' + ' ' + bw_exists.id\n else\n inflection_exists = Inflection.find_by(word: word)\n if inflection_exists\n bw_id = inflection_exists.base_word_id\n bw = BaseWord.find(bw_id).base_word\n bw_count.puts base_word + ' ' + hit_count + ' ' + '(' + word + ')' + ' ' + bw_id\n else\n not_found_count.puts word + ' ' + hit_count\n end\n end\n end\nend",
"def word_frequency(text)\n norm_array = normalize(text).to_a\n freq = { }\n norm_array.each_with_object(Hash.new(0)){|key,hash| hash[key] += 1}\nend",
"def viewMetrics\n @concurso = Concurso.find(params[:concurso_id])\n path = File.join(Rails.root, \"data/concursos\",\"contest-\"+@concurso.id.to_s,\"metrics\",\"df.pdf\")\n send_file( path,\n :filename => \"df.pdf\",\n :type => \"application/pdf\",\n :stream => \"false\",\n #:disposition =>'attachment') ##download\n :disposition =>\"inline\") #ver no browser\n end",
"def csv_print_to_file\n CSV.open(\"metadata_output.csv\", \"w\") do |csv|\n metadata.each do |key, value|\n if value.class == Hash\n csv << [key]\n print_hash_to_csv(value, csv)\n else\n csv << [key, value]\n end\n end\n end\n end",
"def export\n respond_to do |format|\n format.html \n format.csv do\n send_data(Product.to_csv, filename: \"products-#{DateTime.now}.csv\")\n end\n end\n end",
"def write_models_to_file\n Printer.new(models, @output_dir).tap do |p|\n p.write\n end\n end",
"def get_document_frequency(term)\n\t\t\t@term_hash[term]\n\t\tend",
"def export_csv\n # Find all Setup with the stored restrictions\n sorting :default => 'es_setups.path, es_setups.name'\n setups = EsSetup.find :all, :order => @sort, :conditions => session[:conditions_setup]\n # Creation of the file\n file_name = \"setups_export_\" + current_user.id.to_s + \".csv\"\n \n csv_string = CSV.generate({:col_sep => ';', :encoding => \"ISO-8859-15\" }) do |csv|\n csv << [\"Chemin\".trn,\"Nom\".trn,\"Valeur\".trn,\"Type\".trn, \"Lecture seule\".trn]\n setups.each do |t|\n csv << [t.path,t.name,t.value,t.type_data,(t.read_only=='Y' ? 'V' : '')]\n end\n end\n send_data Iconv.conv('iso-8859-1//IGNORE', 'utf-8', csv_string), :filename => file_name, :disposition => 'attachment', :type => 'text/csv; charset=iso-8859-1; header=present'\n end",
"def export_measurements\n 'Click <b>Export</b><br>' \\\n 'Select <b>Export All Data Sheets</b><br>' \\\n 'Export all sheets as CSV<br>' \\\n \"Save files to the #{params[:export_filepath]} directory\"\n end",
"def export_measurements\n 'Click <b>Export</b><br>' \\\n 'Select <b>Export All Data Sheets</b><br>' \\\n 'Export all sheets as CSV<br>' \\\n \"Save files to the #{params[:export_filepath]} directory\"\n end",
"def word_freq(categories, word)\n [*categories].inject(0){|sum, category|\n sum += self.counter.freq(category, word)\n }\n end",
"def get_word_frequency(word, *args)\n http_method = :get\n path = '/word/{word}/frequency'\n path.sub!('{word}', word.to_s)\n\n # Ruby turns all key-value arguments at the end into a single hash\n # e.g. Wordnik.word.get_examples('dingo', :limit => 10, :part_of_speech => 'verb')\n # becomes {:limit => 10, :part_of_speech => 'verb'}\n last_arg = args.pop if args.last.is_a?(Hash)\n last_arg = args.pop if args.last.is_a?(Array)\n last_arg ||= {}\n\n # Look for a kwarg called :request_only, whose presence indicates\n # that we want the request itself back, not the response body\n if last_arg.is_a?(Hash) && last_arg[:request_only].present?\n request_only = true\n last_arg.delete(:request_only)\n end\n\n params = last_arg\n body ||= {}\n request = Wordnik::Request.new(http_method, path, :params => params, :body => body)\n request_only ? request : request.response.body\n end",
"def frequency\n \n end",
"def calculate_word_frequency\n # not a class method, it is used to poulate what are essentially properties on an instance of the class\n #word_frequency = @content.split(\" \").each_with_object(Hash.new(0)) {|word,count| count[word] +=1}\n word_frequency = Hash.new(0)\n #puts word_frequency\n @content.split.each do |word|\n word_frequency[word] += 1\n end\n\n\n @highest_wf_count = word_frequency.values.max\n @highest_wf_words = word_frequency.select { |word, freq| freq == @highest_wf_count }.keys\n @highest_wf_words\n\n end",
"def csv_download\n @stats = Hyrax::WorkUsage.new(params[:id])\n filename = params[:id] + \"_stats.csv\"\n #This is an example that worked\n #send_data @stats.to_csv, :type => 'text/csv; charset=utf-8; header=present', :disposition => 'attachment; filename=payments.csv'\n target = \"attachment`; filename=#{filename}\"\n send_data @stats.to_csv, :type => 'text/csv; charset=utf-8; header=present', :disposition => target\n end",
"def get_frequency(*args)\n http_method = :get\n path = '/words/frequency'\n\n # Ruby turns all key-value arguments at the end into a single hash\n # e.g. Wordnik.word.get_examples('dingo', :limit => 10, :part_of_speech => 'verb')\n # becomes {:limit => 10, :part_of_speech => 'verb'}\n last_arg = args.pop if args.last.is_a?(Hash)\n last_arg = args.pop if args.last.is_a?(Array)\n last_arg ||= {}\n\n # Look for a kwarg called :request_only, whose presence indicates\n # that we want the request itself back, not the response body\n if last_arg.is_a?(Hash) && last_arg[:request_only].present?\n request_only = true\n last_arg.delete(:request_only)\n end\n\n params = last_arg\n body ||= {}\n request = Wordnik::Request.new(http_method, path, :params => params, :body => body)\n request_only ? request : request.response.body\n end",
"def index\n @finger_prints = FingerPrint.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @finger_prints }\n format.csv { send_data FingerPrint.scoped.to_csv, filename: \"fingerprints-#{Date.today}.csv\"}\n end\n end",
"def write_training_file\n file = File.open('./train.data', 'w')\n\n file.puts \"#{@training_headlines.count} #{@number_of_inputs} #{@number_of_outputs}\"\n @training_headlines.find_each do |headline|\n file.puts vectorize_headline(headline).join(' ')\n file.puts vectorized_signs(headline).join(' ')\n file.puts\n file.puts\n end\n\n file.close\n end",
"def write_to_file(weights)\r\n CSV.open(\"./weights.csv\", \"wb\") do |csv|\r\n csv << weights.to_a\r\n end\r\n true\r\n end",
"def saveListToFile()\n\t\t# f is going to equal data.txt with the 'write' capability:\n\t\tf = File.new('data.txt', 'w')\n\n\t\t# write searchSuggestionList to data.txt:\n\t\tf.write(\"#{@searchSuggestionList}\")\n\n\t\t# close data.txt/ end writing:\n\t\tf.close\n\tend",
"def calculate_frequencies(target_file)\n\tn_char=0.0\n\n\n\ttext=File.read(target_file)\n\n\t#creo l'hash delle lettere\n\thsh=Hash.new\n\tcode=97\n\twhile code<=122 do\n\t\thsh[code]=Occurrences.new(0,0.000)\n\t\tcode+=1\n\tend\n\t#conto le occorrenze delle lettere\n\ttext.each_byte {|c|\n\t\tif c>=97 and c<=122;\n\t\t\thsh[c].number+=1\n\t\t\tn_char+=1\n\t\tend\n\t}\n\t#creo le frequenze\n\thsh.each {|k, v|\n\t\tv[1]=v[0]/n_char\n\t\t#puts\"number:#{v[0]} - percentage:#{v[1]}\"\n\t}\n\t#print dei valori creati\n\t#i=0\n\t#hsh.each {|k, v| puts \"elemento #{i} ---> #{k} is #{v}\",\n\t#\ti+=1\n\t#}\n\treturn hsh;\nend",
"def write_csv filename, fields = nil\n\n # By default all fields present in every row of output_data will be incorporated.\n if fields.nil?\n # Transform each output struct into a list of its keys, then take the intersection of each Array of keys.\n # This ensures that only fields present for all rows will be incorporated.\n fields = output_data.map{|o| o.to_h.keys}.inject do |last_keys, this_keys|\n last_keys & this_keys\n end\n end\n\n CSV.open filename, \"wb\", row_sep: \"\\r\\n\" do |csv|\n # Header line\n csv << fields\n\n output_data.each do |out|\n output_row = []\n fields.each do |field|\n output_row << out[field]\n end\n csv << output_row\n end\n end\n end",
"def occurrences(word)\n @frequencies[word]\n end",
"def download_heat_tsv\n heat = params[:heat_number]\n exporter = Exporters::Competition::Swiss.new(@competition, heat)\n csv_string = TsvGenerator.new(exporter).generate\n\n filename = \"#{@competition.to_s.parameterize}_heat_#{heat}.txt\"\n send_data(csv_string,\n type: 'text/csv; charset=utf-8; header=present',\n filename: filename)\n end",
"def get_tweet_counts_per_frequency(freq, tweet_name, start_time, end_time)\n \n end",
"def fee_reciepts_export_csv\n parameters={:search => params[:search] ,:filename => filename}\n csv_export('finance_transaction', 'fee_reciepts_export', parameters) \n end",
"def print_highest_word_frequency_across_lines()\n puts @highest_count_across_lines\n @highest_count_words_across_lines.each do |lineanalyzer|\n lineanalyzer.highest_wf_words.each { |v| puts \"#{v}\" }\n end\n end",
"def file_reader file_name\n @words_count = {}\n File.read(file_name).each_line{ |line| count_words( line.split(',')[2] ) }\n hash_to_file(@words_count, file_name)\nend",
"def index\n @count = @attendance_entries.count\n\n respond_to do |format|\n format.html # index.html.erb\n format.csv { send_data @attendance_entries.to_csv }\n end\n end",
"def index\n @surveys = Survey.all\n\n respond_to do |format|\n format.html\n #format.csv { send_data @surveys.to_csv }\n end\n end",
"def save_as_csv\n temp = get_email_list.map{|hash| hash.map{|k, v| [k, v]}}\n temp = temp.map { |data| data.join(\",\") }.join(\"\\n\")\n File.open(\"db/emails.csv\", \"w\") do |csv|\n csv.write(temp)\n end\n end",
"def index\n authorize! :view, Measurement\n\n @measurements = Measurement.all\n\n @sites = Site.all\n @instruments = Instrument.all\n \n respond_to do |format|\n format.html\n format.csv { send_data @measurements.to_csv }\n end\n end",
"def report(output)\n output.title(options[:title]) if options[:title]\n\n if @categories.empty?\n output << \"None found.\\n\"\n else\n sorted_categories = output.slice_results(sorted_by_frequency)\n total_hits = overall_frequency\n\n output.table({:align => :left}, {:align => :right }, {:align => :right}, {:type => :ratio, :width => :rest}) do |rows|\n sorted_categories.each do |(cat, count)|\n rows << [cat, \"#{count} hits\", '%0.1f%%' % ((count.to_f / total_hits.to_f) * 100.0), (count.to_f / total_hits.to_f)]\n end\n end\n\n end\n end",
"def index\n @frequency_vocabularies = FrequencyVocabulary.all\n end",
"def perform(task, options)\n standard_options(task, options)\n\n # Get the counts\n dates = RLetters::Analysis::CountTermsByField.call(\n term: options[:term],\n field: :year,\n dataset: dataset,\n progress: ->(p) { task.at(p, 100, t('.progress_computing')) }\n )\n\n # Convert the years to integers and sort\n dates = dates.to_a\n dates.each do |d|\n begin\n # If the field is an integer, convert it to an integer, otherwise leave\n # it alone\n converted = Integer(d[0])\n d[0] = converted\n rescue ArgumentError\n end\n end\n\n dates.sort! do |a, b|\n # We don't want to fail out for bad data; rather, put weird non-numeric\n # data at year zero\n a_int = a[0].is_a?(Integer) ? a[0] : 0\n b_int = b[0].is_a?(Integer) ? b[0] : 0\n\n a_int <=> b_int\n end\n\n # Save out the data\n year_header = Document.human_attribute_name(:year)\n value_header = t('.number_column')\n\n csv_string = csv_with_header(header: t('.header', name: dataset.name),\n subheader: t('.subheader',\n term: options[:term])) do |csv|\n write_csv_data(csv: csv,\n data: dates,\n data_spec: {\n year_header => :first,\n value_header => :second\n })\n end\n\n output = {\n data: dates,\n term: options[:term],\n year_header: year_header,\n value_header: value_header\n }\n\n # Serialize out to JSON\n task.files.create(description: 'Raw JSON Data',\n short_description: 'JSON') do |f|\n f.from_string(output.to_json, filename: 'term_dates.json',\n content_type: 'application/json')\n end\n\n task.files.create(description: 'Spreadsheet',\n short_description: 'CSV', downloadable: true) do |f|\n f.from_string(csv_string, filename: 'results.csv',\n content_type: 'text/csv')\n end\n\n task.mark_completed\n end",
"def csv\n send_data(Map.to_csv, {:filename => \"maps.csv\" })\n end",
"def save_to_csv(filename = '/tmp/movies.csv')\n CSV.open(filename, 'w+', col_sep: '|') do |file|\n file << list.first.keys\n list.each do |m|\n file << m.values.map { |v| v.is_a?(Array) ? v.join(',') : v }\n end\n end\n filename\n end",
"def downloadResults\n @concurso = Concurso.find(params[:concurso_id])\n path = File.join(Rails.root, \"data/concursos\",\"contest-\"+@concurso.id.to_s,\"results\",\"results.pdf\")\n send_file( path,\n :filename => \"results.pdf\",\n :type => \"application/pdf\",\n :stream => \"false\",\n :disposition =>'attachment') ##download\n # :disposition =>\"inline\") #ver no browser\n end",
"def index\n @bestthesisawards = Bestthesisaward.all\n respond_to do |format|\n format.html\n format.csv { send_data @bestthesisawards.to_csv, \n filename: \"bestthesisawards-#{Date.today}.csv\" }\n end\n end",
"def write_to_csv_file(filename)\n CSV.open(filename, 'w') do |csv|\n csv << [@title]\n @items.each_with_index do |item, position|\n csv << [position + 1] + item.details\n end\n end\n end",
"def save_questions\n file_handler(\"questions.csv\", \"w\")\n RESPONSES.each do |key, value|\n @file.puts key + \" | \" + value\n end\n @file.close\n puts \"Questions have been saved to questions.csv!\"\nend",
"def export_csv(csv_data)\n\t\tFile.write(\"kfit_partners.csv\", csv_data.map(&:to_csv).join)\n\tend",
"def index\n @experiments = policy_scope Experiment.where(user_id: current_user.id).order(created_at: :desc).page(params[:page])\n respond_to do |format|\n format.html\n format.csv {\n send_data( @experiments.to_csv,\n filename: \"CO2_by_experiment_#{Time.zone.now}.csv\", \n disposition: 'inline', type: \"multipart/related\")\n }\n end\n end",
"def collection_info\n respond_to do |format|\n format.html { render layout: false }\n format.csv do\n filename = \"#{current_object.title_display.gsub(/[^\\w]/, '_')}.csv\"\n send_data collection_csv_report, type: \"text/csv\", filename: filename\n end\n end\n end",
"def export_advices\n @delim_type = params[:delim_type]\n filename, delimiter = find_delim_filename(@delim_type, params[:other_char])\n\n allowed_models = ['Question']\n advice_model = 'QuestionAdvice'\n\n csv_data = CSV.generate(col_sep: delimiter) do |csv|\n if allowed_models.include? params[:model]\n csv << Object.const_get(advice_model).export_fields(params[:options])\n Object.const_get(advice_model).export(csv, params[:id], params[:options])\n end\n end\n\n send_data csv_data,\n type: 'text/csv; charset=iso-8859-1; header=present',\n disposition: \"attachment; filename=#{filename}\"\n end"
] |
[
"0.70070314",
"0.6349633",
"0.59001243",
"0.57907706",
"0.5592818",
"0.55902904",
"0.5419103",
"0.5399358",
"0.5346235",
"0.530937",
"0.5235047",
"0.5232909",
"0.5226917",
"0.51887214",
"0.5182279",
"0.5138057",
"0.5129115",
"0.5110452",
"0.50978327",
"0.5093862",
"0.507107",
"0.50703114",
"0.50648504",
"0.5053388",
"0.5027102",
"0.4978287",
"0.49705407",
"0.49661696",
"0.49633297",
"0.49556983",
"0.49401805",
"0.49396682",
"0.49341652",
"0.49085724",
"0.49012187",
"0.4883677",
"0.48732647",
"0.4858276",
"0.48485762",
"0.48472947",
"0.48379093",
"0.48064703",
"0.48021844",
"0.4797177",
"0.47940895",
"0.479198",
"0.47796932",
"0.4770116",
"0.4769692",
"0.4756439",
"0.475594",
"0.47514647",
"0.47492918",
"0.474504",
"0.4742483",
"0.4741772",
"0.47386745",
"0.47381628",
"0.4734189",
"0.4733181",
"0.4727609",
"0.47228584",
"0.47146988",
"0.4710911",
"0.47031817",
"0.47031817",
"0.47028935",
"0.47027153",
"0.46752784",
"0.4674809",
"0.46737304",
"0.4673223",
"0.46708736",
"0.46703818",
"0.4668773",
"0.46686402",
"0.46685034",
"0.4667797",
"0.46632332",
"0.46614844",
"0.46584466",
"0.46471885",
"0.46438557",
"0.46432492",
"0.4641651",
"0.46278727",
"0.46266475",
"0.46167836",
"0.46146512",
"0.4608808",
"0.46071863",
"0.4605611",
"0.46026024",
"0.45944414",
"0.45920634",
"0.45899174",
"0.45872623",
"0.45848668",
"0.45797524",
"0.45782483",
"0.45761627"
] |
0.0
|
-1
|
What is the longest height based on width of dp[i][j]
|
def expand(dp, i, j)
height = 0
width = dp[i][j]
# Up
i.downto(0).each do |m|
break if dp[m][j] < width
height += 1
end
# Down
(i+1..dp.size-1).each do |m|
break if dp[m][j] < width
height += 1
end
height*width
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def max_area(height)\n max_area = 0\n seen = {}\n\n (0...height.length).each do |idx|\n next if seen[idx]\n seen[idx] = true\n\n (idx + 1...height.length).each do |idx2|\n h = [height[idx], height[idx2]].min\n area = h * (idx2 - idx)\n max_area = area > max_area ? area : max_area\n end\n end\n \n max_area\nend",
"def highest_height\n i = acc.reverse.find_index{|i|!i.nil?}\n i ||= 0\n acc.length - i\n end",
"def find_largest_width_for_columns(outer_array)\ncolumn_hash = {\"col1\" => 1, \"col2\" => 1, \"col3\" => 1, \"col4\" => 1 }\n\n\nouter_array.each do |nested_array|\ncolumn_hash[\"col1\"] = nested_array[0].length if nested_array[0].length > column_hash[\"col1\"]\ncolumn_hash[\"col2\"] = nested_array[1].length if nested_array[1].length > column_hash[\"col2\"]\ncolumn_hash[\"col3\"] = nested_array[2].length if nested_array[2].length > column_hash[\"col3\"]\ncolumn_hash[\"col4\"] = nested_array[3].length if nested_array[3].length > column_hash[\"col4\"]\nend\n# needed to add +1 to stop bugs when substracting string length from the space in column set as when string was maximum size it was equal to the column size which lead to introdcution of zero into a str * (strin)\n\ncolumn_hash\nend",
"def max_area_brute(heights)\n max_area = 0\n\n (0..heights.length - 1).each do |i|\n ((i + 1)..heights.length - 1).each do |j|\n min_height = [heights[i], heights[j]].min\n\n local_area = min_height * (j - i)\n max_area = [max_area, local_area].max\n end\n end\n\n max_area\nend",
"def max_area_improved(height)\n i = 0\n j = height.length - 1\n area = 0\n while(i < j)\n area = [area, (j-i) * [height[i], height[j]].min].max\n height[i] < height[j] ? (i+= 1) : (j-=1)\n end\n area\nend",
"def max_area(height)\n left = 0\n right = height.size - 1\n max_area = 0\n while left < right do \n max_area = [max_area, ([height[left], height[right]].min) * (right - left)].max\n if height[left] < height[right]\n left += 1\n else\n right -= 1\n end\n end\n max_area\nend",
"def largest_rectangle_area(heights)\n n, ans = heights.size, -Float::INFINITY\n (0..n-1).each do |i|\n min = heights[i]\n (i..n-1).each do |j|\n min = [min, heights[j]].min\n ans = [ans, min*(j-i+1)].max\n end\n end\n ans\nend",
"def max_area(height)\n left = 0\n right = height.length - 1\n max = 0\n while left < right\n current = [height[left], height[right]].min * (right - left)\n max = current if current > max\n if height[left] < height[right]\n left += 1\n else\n right -= 1\n end\n end\n max\nend",
"def find_largest_width_for_columns(outer_array)\ncolumn_hash = {\"col1\" => 1, \"col2\" => 1, \"col3\" => 1, \"col4\" => 1 }\n\nouter_array.each do |nested_array|\ncolumn_hash[\"col1\"] = nested_array[0].length if nested_array[0].length > column_hash[\"col1\"]\ncolumn_hash[\"col2\"] = nested_array[1].length if nested_array[1].length > column_hash[\"col2\"]\ncolumn_hash[\"col3\"] = nested_array[2].length if nested_array[2].length > column_hash[\"col3\"]\ncolumn_hash[\"col4\"] = nested_array[3].length if nested_array[3].length > column_hash[\"col4\"]\nend\n\ncolumn_hash\nend",
"def find_largest_width_for_columns(outer_array)\ncolumn_hash = {\"col1\" => 1, \"col2\" => 1, \"col3\" => 1, \"col4\" => 1 }\n\nouter_array.each do |nested_array|\ncolumn_hash[\"col1\"] = nested_array[0].length if nested_array[0].length > column_hash[\"col1\"]\ncolumn_hash[\"col2\"] = nested_array[1].length if nested_array[1].length > column_hash[\"col2\"]\ncolumn_hash[\"col3\"] = nested_array[2].length if nested_array[2].length > column_hash[\"col3\"]\ncolumn_hash[\"col4\"] = nested_array[3].length if nested_array[3].length > column_hash[\"col4\"]\nend\n\ncolumn_hash\nend",
"def find_largest_width_for_columns(outer_array)\ncolumn_hash = {\"col1\" => 1, \"col2\" => 1, \"col3\" => 1, \"col4\" => 1 }\n\nouter_array.each do |nested_array|\ncolumn_hash[\"col1\"] = nested_array[0].length if nested_array[0].length > column_hash[\"col1\"]\ncolumn_hash[\"col2\"] = nested_array[1].length if nested_array[1].length > column_hash[\"col2\"]\ncolumn_hash[\"col3\"] = nested_array[2].length if nested_array[2].length > column_hash[\"col3\"]\ncolumn_hash[\"col4\"] = nested_array[3].length if nested_array[3].length > column_hash[\"col4\"]\nend\n\ncolumn_hash\nend",
"def find_largest_width_for_columns(outer_array)\ncolumn_hash = {\"col1\" => 1, \"col2\" => 1, \"col3\" => 1, \"col4\" => 1 }\n\nouter_array.each do |nested_array|\ncolumn_hash[\"col1\"] = nested_array[0].length if nested_array[0].length > column_hash[\"col1\"]\ncolumn_hash[\"col2\"] = nested_array[1].length if nested_array[1].length > column_hash[\"col2\"]\ncolumn_hash[\"col3\"] = nested_array[2].length if nested_array[2].length > column_hash[\"col3\"]\ncolumn_hash[\"col4\"] = nested_array[3].length if nested_array[3].length > column_hash[\"col4\"]\nend\n\ncolumn_hash\nend",
"def find_largest_width_for_columns(outer_array)\ncolumn_hash = {\"col1\" => 1, \"col2\" => 1, \"col3\" => 1, \"col4\" => 1 }\n\nouter_array.each do |nested_array|\ncolumn_hash[\"col1\"] = nested_array[0].length if nested_array[0].length > column_hash[\"col1\"]\ncolumn_hash[\"col2\"] = nested_array[1].length if nested_array[1].length > column_hash[\"col2\"]\ncolumn_hash[\"col3\"] = nested_array[2].length if nested_array[2].length > column_hash[\"col3\"]\ncolumn_hash[\"col4\"] = nested_array[3].length if nested_array[3].length > column_hash[\"col4\"]\nend\n\ncolumn_hash\nend",
"def find_largest_width_for_columns(outer_array)\ncolumn_hash = {\"col1\" => 1, \"col2\" => 1, \"col3\" => 1, \"col4\" => 1 }\n\nouter_array.each do |nested_array|\ncolumn_hash[\"col1\"] = nested_array[0].length if nested_array[0].length > column_hash[\"col1\"]\ncolumn_hash[\"col2\"] = nested_array[1].length if nested_array[1].length > column_hash[\"col2\"]\ncolumn_hash[\"col3\"] = nested_array[2].length if nested_array[2].length > column_hash[\"col3\"]\ncolumn_hash[\"col4\"] = nested_array[3].length if nested_array[3].length > column_hash[\"col4\"]\nend\n\ncolumn_hash\nend",
"def height\n heights = [left_height, right_height].sort\n\n heights.last\n end",
"def find_longest(arr)\n arr.map(&:to_s).sort_by(&:length).find { |num| num.length == arr.map(&:to_s).sort_by(&:length).last.length }.to_i\nend",
"def maxArea(height)\n max = 0\n i = 0\n j = height.length - 1\n while i < j\n if height[i] < height[j]\n tmp = height[i] * (j - i)\n i += 1\n else\n tmp = height[j] * (j - i)\n j -= 1\n end\n if tmp > max\n max = tmp\n end\n end\n return max\nend",
"def find_largest_width_for_columns(outer_array)\ncolumn_hash = {\"col1\" => 1, \"col2\" => 1, \"col3\" => 1, \"col4\" => 1 }\nHash.new(1)\n\nouter_array.each do |nested_array|\ncolumn_hash[\"col1\"] = nested_array[0].length if nested_array[0].length > column_hash[\"col1\"]\ncolumn_hash[\"col2\"] = nested_array[1].length if nested_array[1].length > column_hash[\"col2\"]\ncolumn_hash[\"col3\"] = nested_array[2].length if nested_array[2].length > column_hash[\"col3\"]\ncolumn_hash[\"col4\"] = nested_array[3].length if nested_array[3].length > column_hash[\"col4\"]\nend\n\ncolumn_hash\nend",
"def find_largest_width_for_columns(outer_array)\ncolumn_hash = {\"col1\" => 1, \"col2\" => 1, \"col3\" => 1, \"col4\" => 1 }\nHash.new(1)\n\nouter_array.each do |nested_array|\ncolumn_hash[\"col1\"] = nested_array[0].length if nested_array[0].length > column_hash[\"col1\"]\ncolumn_hash[\"col2\"] = nested_array[1].length if nested_array[1].length > column_hash[\"col2\"]\ncolumn_hash[\"col3\"] = nested_array[2].length if nested_array[2].length > column_hash[\"col3\"]\ncolumn_hash[\"col4\"] = nested_array[3].length if nested_array[3].length > column_hash[\"col4\"]\nend\n\ncolumn_hash\nend",
"def solution(s)\n grid = s.split(/\\n/).map { |row| row.split(/\\s/).map(&:to_i) }\n \n search = ->(table) do\n table.map do |row|\n row.each_cons(4).map do |seg|\n seg.reduce(:*)\n end.max\n end.max\n end\n\n squeeze = ->(table, opts={inverse: false}) do\n table.map.with_index do |row,depth|\n row.rotate(opts[:inverse] ? -depth : depth)\n end.transpose\n end\n\n [\n search[grid], # horizontal\n search[grid.transpose], # vertical\n search[squeeze[grid]], # down_diagonals\n search[squeeze[grid, inverse: true]] # up_diagonals\n ].max\nend",
"def maximal_square(a)\n\treturn 0 if a.size == 0 || a == nil\n\trows = a.size\n\tcols = a[0].size\n\tlargest = 0\n\tdp = Array.new(rows+1) { Array.new(cols+1) }\n\tfor i in 0..rows do\n\t\tfor j in 0..cols do\n\t\t\t# Initialize first row and column of matrix with 0\n\t\t\tif i==0 || j==0\n\t\t\t\tdp[i][j] = 0 \n\t\t\t# If matrix cell value for specific row and cell is 1, take minimum of left, right, diagonal and add 1.\n\t\t\t# As all these 3 directions should be checked and must contain 1. Store it to dp corresponding cell.\n\t\t\t# Keep track of largest matrix by comparing with dp cell value.\n\t\t\telsif a[i-1][j-1] == '1'\n\t\t\t\tdp[i][j] = [ dp[i-1][j], dp[i][j-1], dp[i-1][j-1] ].min + 1\n\t\t\t\tlargest = dp[i][j] if dp[i][j] > largest\n\t\t\t# If element equals 0 then put 0 in dp corresponding cell\n\t\t\telse\n\t\t\t\tdp[i][j] = 0\n\t\t\tend\t\n\t\tend\t\n\tend\t\n\treturn (largest*largest) # Return area by multiplying largest element to itself.\nend",
"def container_with_most_water(height)\n max_area = 0\n left = 0\n right = height.length - 1\n \n until right - left == 0 do \n length = height[left] < height[right] ? height[left] : height[right]\n width = right - left\n area = length * width\n max_area = area if max_area < area\n \n if height[left] <= height[right]\n left += 1\n else\n right -= 1\n end\n end\n \n max_area\nend",
"def longest_palindrome_subseq(s)\n length = s.size\n dp = []\n\n length.times do |i|\n dp[i]= Array.new(length).fill(0);\n dp[i][i] = 1\n end\n puts \"dp #{dp}\"\n (2..length).each do |len|\n puts \"len #{len}\"\n (0..(length - len)).each do |i|\n j = i + len - 1\n # puts \"j #{j} => i:#{i} + len:#{len} - 1\"\n\n if s[i] == s[j]\n dp[i][j] = 2 + (len == 2 ? 0 : dp[i+1][j-1])\n else\n dp[i][j] = [dp[i+1][j], dp[i][j-1]].max\n end\n puts \"dp #{dp}\"\n end\n end\n\n dp[0][length - 1]\nend",
"def find_longest(arr)\n arr.max_by { |x| x.to_s.length }\nend",
"def diagonal_max(grid, rows, cols, length)\n max = 0\n # For each column\n ((length-1)...rows).each do |y|\n # Each entry in the column\n ((length-1)...cols).each do |x|\n # Multiply that entry and the length-1 entries before it and compare\n p = (0...length).inject(1) {|product, i| product * grid[y-i][x-i]}\n max = p if max < p\n end\n end\n (0...(rows-length)).each do |y|\n # Each entry in the column\n ((length-1)...cols).each do |x|\n # Multiply that entry and the length-1 entries before it and compare\n p = (0...length).inject(1) {|product, i| product * grid[y+i][x-i]}\n max = p if max < p\n end\n end\n max\n end",
"def max_area(height)\n max_area = 0\n left = 0\n right = height.length - 1\n while right > left\n min_height = [height[left], height[right]].min\n area = find_area(min_height, left, right)\n if area > max_area\n max_area = area\n end\n \n if height[left] >= height[right]\n right -= 1\n else\n left += 1\n end\n \n end\n \n max_area\n \n \nend",
"def max_area(height)\r\n max_area = 0\r\n height.each_with_index do |start, idx1|\r\n height.each_with_index do |finish, idx2|\r\n if idx2 > idx1\r\n area = [start, finish].min * (idx2 - idx1) \r\n max_area = area if area > max_area\r\n end\r\n end\r\n end\r\n max_area\r\nend",
"def longest_slide_down(pyramid)\n slide_sum = pyramid.reverse.each.inject(0) do |sum, n|\n n.map.with_index {|val, i| val + [sum[i], sum[i+1]].max}\n end\n slide_sum[0]\nend",
"def longest_slide_down(pyramid)\n pyramid.each_with_index do |row, ri|\n row.each_with_index do |elem, ei|\n next if ri < 1\n # set variables\n left = pyramid[ri - 1][ei - 1]\n right = pyramid[ri - 1][ei]\n left = left.nil? ? 0 : left\n right = right.nil? ? 0 : right\n pyramid[ri][ei] += left > right ? left : right\n end\n end\n return pyramid.last.max\nend",
"def vertical_max(grid, rows, cols, length)\n max = 0\n # For each column\n (0...cols).each do |x|\n # Each entry in the column\n ((length-1)...rows).each do |y|\n # Multiply that entry and the length-1 entries before it and compare\n p = ((y-length+1)..y).inject(1) {|product, i| product * grid[i][x]}\n max = p if max < p\n end\n end\n max\n end",
"def height\n longest_tree_path(@root)\n end",
"def top_to_bottom_approach\n largest_prod_of_all_cols = 0\n for each_row in (0..15)\n for each_col in (0..19)\n curr_prod_in_col = $grid_of_numbers[each_row][each_col] * $grid_of_numbers[each_row + 1][each_col] * $grid_of_numbers[each_row + 2][each_col] * $grid_of_numbers[each_row + 3][each_col]\n if curr_prod_in_col > largest_prod_of_all_cols\n largest_prod_of_all_cols = curr_prod_in_col\n end\n end\n end\n \n return largest_prod_of_all_cols\nend",
"def linear_longest_fish(fishes)\n biggest = fishes.first\n fishes.each do |fish|\n biggest = fish if fish.length > biggest.length\n end\n biggest\nend",
"def solve(input)\n left = 0 \n right = input.length - 1\n area = 0 \n while(left < right)\n if !input[left]\n left += 1\n next\n end\n if !input[right]\n right += 1\n next\n end\n height = [input[left], input[right]].min\n width = right - 1 - left\n area = [area, (height * width)].max\n if input[left] < input[right]\n left += 1\n else\n right += 1\n end\n end\n p area\nend",
"def linear_fish(arr)\n longest = nil\n arr.each_with_index do |fish, idx|\n longest = fish if longest.nil? || fish.length > longest.length\n end\n\n longest\nend",
"def quadratic_fish(arr)\n longest = nil\n arr[0...-1].each_with_index do |fish1, idx|\n (idx+1...arr.length).each do |idx2|\n fish2 = arr[idx2]\n longest = fish1.length > fish2.length ? fish1 : fish2\n end\n end\n\n longest\nend",
"def longest_slide_down(pyramid) # rubocop:disable Metrics/AbcSize\n (pyramid.size - 2).downto(0) do |row|\n 0.upto(pyramid[row].size - 1) do |col|\n pyramid[row][col] += [\n pyramid[row + 1][col] || 0,\n pyramid[row + 1][col + 1] || 0\n ].max\n end\n end\n pyramid[0][0]\nend",
"def sluggish_octopus(arr)\n longest = \"\"\n arr.each do |el1|\n arr.each do |el2|\n longest = el1 if el1.length > el2.length\n end\n end\n longest\nend",
"def longest(array)\n return array.max\nend",
"def horizontal_max(grid, rows, cols, length)\n max = 0\n # For each column\n (0...rows).each do |y|\n # Each entry in the column\n ((length-1)...cols).each do |x|\n # Multiply that entry and the length-1 entries before it and compare\n p = ((x-length+1)..x).inject(1) {|product, i| product * grid[y][i]}\n max = p if max < p\n end\n end\n max\n end",
"def longest (arr)\n arr.max_by {|str| str.length}\nend",
"def linear(arr)\n longest = arr.first\n\n arr.each do |ele|\n if ele.length > longest.length\n longest = ele\n end\n end\n\n longest\nend",
"def outer_height\n height + offsets.height + padding.height\n end",
"def dimensions\n height = count\n width = collect { |a| a.length }.max\n [width, height]\n end",
"def max_area_of_island(grid)\n return 0 if grid.empty?\n w, h = grid[0].length, grid.length\n max = 0\n (0...h).each do |i|\n (0...w).each do |j|\n if grid[i][j] == 1\n max = [max, search(grid, i, j)].max\n end\n end\n end\n max\nend",
"def height\n array.size\n end",
"def height\n max_height = 0\n each do |child|\n if child.kind_of? Tree\n max_height = [max_height, 1].max\n else\n max_height = [max_height, child.height].max\n end\n end\n max_height.succ\n end",
"def find_longest(arr)\n x = arr.map(&:to_s).sort_by { |x| x.length }.last.chars.length\n arr.map(&:to_s).find { |num| num.length == x }.to_i\nend",
"def height\n @rows * @block_size\n end",
"def linear_longest_word(arr)\n max_length=0\n max_str=arr[0]\n arr.each do |str| \n curr_length=str.length\n if curr_length>max_length\n max_length=curr_length\n max_str=str\n end\n end\n max_str\nend",
"def largestRectangle(h)\n stack = [0]; length = h.length; h << 0; area = 0; index = 1\n\n while index <= length do\n if stack.empty? || h[index] > h[stack[-1]]\n stack << index\n index += 1\n else\n element_index = stack.pop\n t_area = h[element_index] * (stack.empty? ? index : (index - stack[-1] -1))\n area = [area, t_area].max\n end\n end\n\n return area\nend",
"def widest_item\n widest = col_labels.map { |label| label.to_s.jlength }\n each_item {|item| widest << item_to_s(item).jlength }\n widest.max\n end",
"def largest_rectangle\n histogram = Histogram.new(Array.new(@matrix[0].length, 0))\n max_area = 0\n\n @matrix.each do |row|\n histogram.update!(row)\n largest_in_histogram = histogram.largest_area\n max_area = [max_area, largest_in_histogram].max\n end\n\n max_area\n end",
"def largest_area\n @heights = []\n @positions = []\n @max_size = 0\n\n @temp_pos = nil\n @temp_height = nil\n @temp_size = nil\n\n @store.each_with_index do |height, index|\n if @heights.empty? || height > @heights.last\n @heights.push(height)\n @positions.push(index)\n elsif height < @heights.last\n while !@heights.empty? && height < @heights.last\n pop_stacks(index)\n end\n\n @heights.push(height)\n @positions.push(@temp_pos)\n end\n end\n\n while !@heights.empty?\n pop_stacks(@store.length)\n end\n\n @max_size\n end",
"def find_longest(n)\n\tbinary = n.to_s(2)\n\n p binary\n a , b = 0\n\t# (0...binary.size).map do |i|\n\t\tbinary_copy = binary.dup\n\n\t\t# binary_copy[i] = \"1\"\n\n\t\t# puts binary_copy\n\n\t a = binary_copy.scan(/0+/).max.size \n\t b = binary_copy.scan(/1+/).max.size \n\t# end \n\ta > b ? a : b \nend",
"def largest_rectangle_area(heights)\n return 0 if heights.empty?\n largest(MinSpTable.new(heights), 0, heights.size-1)\nend",
"def water_area(heights)\n maxes = Array.new(heights.length, 0)\n\n left_max = 0\n (0...heights.length - 1).each do |i|\n height = heights[i]\n maxes[i] = left_max\n left_max = [left_max, height].max\n end\n\n right_max = 0\n (heights.length - 1...0).each do |i|\n height = heights[i]\n min_height = [right_max, maxes[i]].min\n maxes[i] = if height < min_height\n min_height - height\n else\n 0\n end\n right_max = [right_max, height].max\n end\n p maxes\n maxes.sum\nend",
"def max(com, w, h)\n font_from_height = h / com.count\n font_from_width = w / com.map(&:length).max\n font_from_height < font_from_width ? font_from_height : font_from_width\nend",
"def largestsize\n self.optimize\n sizes = Hash.new(0)\n @h.each { |_,v| sizes[v] += 1 }\n result = sizes.sort{ |a,b| a[1] <=> b[1] }.reverse\n s = \"\"\n result.each { |_,v| s += v.to_s + \" \" }\n s\n end",
"def quadratic_longest_fish(fishes)\n biggest = nil\n fishes.each_index do |i|\n fishes.each_index do |j|\n if fishes[i] > fishes[j] && i != j\n biggest = fishes[i]\n end\n end\n end\n return biggest\nend",
"def slugish_octopus(arr) # quadratic\n largest = []\n arr.each_with_index do |e1, i1|\n arr.each_with_index do |e2, i2|\n if e1.length > e2.length\n largest = e1\n else\n largest = e2\n end\n end\n end\n largest.to_s\nend",
"def diameter_and_height(root)\n return [0, 0] if root.nil?\n left_diameter, left_height = diameter_and_height(root.left)\n right_diameter, right_height = diameter_and_height(root.right)\n current_height = [left_height, right_height].max + 1\n max_diameter = [left_diameter, right_diameter, left_height + right_height + 1].max\n [max_diameter, current_height]\nend",
"def longest_string array\n array.max_by(&:length)\nend",
"def longest_path_1(edges)\nend",
"def maximal_square(matrix)\n return 0 if matrix.nil? || matrix.empty?\n n = matrix.size\n m = matrix[0].size\n dp = Array.new(n) {\n Array.new(m) {\n 0\n }\n }\n \n (0...n).to_a\n .product((0...m).to_a)\n .select { |i, j| matrix[i][j] != '0' }\n .map { |i, j|\n l = j == 0 ? 0 : dp[i][j - 1]\n u = i == 0 ? 0 : dp[i - 1][j]\n ul = i == 0 && j == 0 ? 0 : dp[i - 1][j - 1]\n dp[i][j] = [l, u, ul].min + 1\n dp[i][j] * dp[i][j]\n }\n .max || 0\nend",
"def length_of_lis(nums)\n return 0 if nums.empty?\n dp = [1]\n max = 1\n\n (1...nums.length).each do |i|\n current_max = 0\n (0...i).each do |j|\n if nums[i] > nums[j]\n current_max = [current_max, dp[j]].max\n end\n end\n dp[i] = current_max + 1\n max = [max, dp[i]].max\n end\n\n max\nend",
"def height\n return height_helper(@root, 0, 1)\n end",
"def height\n return height_helper(@root, 0, 1)\n end",
"def longest_bridges(input)\n components = Set.new(parse(input))\n starters = components.select { |c| c[0].zero? }\n longest = []\n max = 0\n starters.each do |starter|\n bridge_each(components, starter) do |bridge|\n longest = [] if bridge.length > max\n longest << bridge if bridge.length >= max\n max = bridge.length if bridge.length > max\n end\n end\n longest\nend",
"def find_longest(arr)\n\n arr.inject do |acc, el|\n if el.length < acc.length\n acc =acc\n else\n acc = el\n end\n end\nend",
"def longest2(collection)\n collection.max { |a, b| a.length <=> b.length }\nend",
"def longest_subarr(arr)\n max_len = 0\n sum = 0\n store = {}\n\n arr.each_with_index do |n, i|\n sum += n\n\n # special case if started at 0\n max_len = i + 1 if sum == 0\n\n if store[sum]\n max_len = [max_len, i - store[sum]].max\n else\n store[sum] = i\n end\n end\n max_len\nend",
"def max_sum_dp(matrix)\n return 0 if matrix.length < 1 || matrix[0].length < 1\n\n rows = matrix.length\n cols = matrix[0].length\n\n # start row,col end row, end col\n dp = Array.new(rows) { Array.new(cols) { Array.new(rows) { Array.new(cols, 0) } } }\n\n max = -Float::MAX\n rows.times do |sr|\n cols.times do |sc|\n sr.upto(rows - 1).each do |er|\n sc.upto(cols -1).each do |ec|\n dp[sr][sc][er][ec] = matrix[er][ec]\n # rect above\n if er > 0\n dp[sr][sc][er][ec] += dp[sr - 1][sc][er - 1][ec]\n end\n # rect left\n if ec > 0\n dp[sr][sc][er][ec] += dp[er][sc][er][ec - 1]\n end\n max = [max, dp[sr][sc][er][ec]].max\n end\n end\n end\n end\n\n max\nend",
"def longest_string array\n\tarray.max_by(&:length)\nend",
"def right_to_diagonal_left_approach\n largest_prod = 0\n\n for each_row in (0..15)\n for col in (0..19)\n each_col = 19 - col\n a = $grid_of_numbers[each_row][each_col]\n b = $grid_of_numbers[each_row+1][each_col-1]\n c = $grid_of_numbers[each_row+2][each_col-2]\n d = $grid_of_numbers[each_row+3][each_col-3]\n #puts \"#{a} #{b} #{c} #{d}\"\n curr_prod = a*b*c*d\n if curr_prod > largest_prod\n largest_prod = curr_prod\n end\n end\n end\n \n return largest_prod\nend",
"def longest_word(sen)\n tmp_arr = sen.split(\" \")\n tmp_longest = 0\n tmp_arr.each do |i|\n tmp_longest = i.size if i.size > tmp_longest\n end\n\n tmp_arr.select { |i| i.size == tmp_longest }.first\nend",
"def height\n dimensions.last\n end",
"def get_longest_string\n current_longest = {@data[0] => @data[0].length}\n longest_value = @data[0] # BUG should read @data[0].length\n @data.each do |word|\n if word.length > longest_value\n current_longest = {word => word.length}\n longest_value = word.length\n end\n end\n current_longest\n end",
"def find_longest(sorted_data, key)\n keys = sorted_data.map { |h| h[key].to_s }\n return keys.max_by(&:length).length\n end",
"def clever_octopus(arr)\n longest = nil\n\n arr.each do |fish|\n longest = fish if longest.nil? || fish.length > longest.length\n end\n\n longest\nend",
"def height_calc\n lines = [@data.length, page_row_max].min rescue page_row_max\n return lines * line_height + standard_padding * 2\n end",
"def height_calc\n lines = [@data.length, page_row_max].min rescue page_row_max\n return lines * line_height + standard_padding * 2\n end",
"def col_max\n [(self.width - padding * 2) / 96, 1].max\n end",
"def height\n rows\n end",
"def solution(a)\n # write your code in Ruby 2.2\n return 0 unless a[0]\n necklaces = create_necklaces(a)\n \n \n size = necklaces.length\n index = 0\n max = necklaces[index].length\n \n while index < size\n if necklaces[index].length > max\n max = necklaces[index].length\n end\n index += 1\n end\n \n return max\nend",
"def longest_dominos(string)\n i = 0\n j = 0\n result = 0\n\n return 0 if string.length < 2\n\n\tfor k in (0..(string.length) - 2) do\n\t\tleft = string[k][2]\n\t\trigth = string[k + 1][0]\n\n if (left == rigth)\n j += 1\n else\n i = j\n end\n\n\t\tresult = [result, j - i].max\n\tend\n\n\tresult\nend",
"def sq_area_max(coordinates, matrix_length)\n binding.pry\n area = matrix_length ** 2\n right = (matrix_length-1) - coordinates[0]\n left = (matrix_length - 1) - right\n top= (matrix_length-1) - coordinates[1]\n bottom= (matrix_length -1) - top\n return [top* right, top*left, bottom * right, bottom*left].max\nend",
"def clever_octopus(arr)\n longest = arr.first\n\n arr.each do |el|\n longest = el if el.length > longest.length\n end\n longest\nend",
"def wiggle_max_length(nums)\n return 0 if nums.empty?\n smaller, larger = Array.new(nums.size) { 1 }, Array.new(nums.size) { 1 }\n max = 1\n 1.upto(nums.size - 1).each { |i|\n 0.upto(i - 1).each { |j|\n if (nums[i] > nums[j])\n smaller[i] = [larger[j] + 1, smaller[i]].max\n elsif (nums[i] < nums[j])\n larger[i] = [smaller[j] + 1, larger[i]].max\n end\n }\n \n max = [max, smaller[i], larger[i]].max\n }\n \n return max\nend",
"def longest_string ar\n return ar.max_by(&:length)\nend",
"def calc_area(len, wid)\n\tarea = len * wid\n\treturn area\nend",
"def longest_string ar\n\tar.max_by(&:length)\nend",
"def longest_string(array)\n\tarray.max_by(&:length)\nend",
"def linear()\n longest = FISH[0]\n\n (1...FISH.length).each do |i|\n fish = FISH[i]\n longest = fish if longest.length < fish.length \n end\n\n return longest\n end",
"def longest\n @strings.max { |a,b| a.length <=> b.length}\n end",
"def maximumSquareSize(arr)\n rows = arr.length\n cols = arr[0].length\n # Create matrix Size and copy first row and first columns as it is from M[][] to S[][]\n size = Array.new(rows) { Array.new(cols, 0) }\n \tfor i in 0..rows-1\n \t\tsize[i, 0] = 0\n \tend\n \tfor i in 0..cols-1\n \t\tsize[0, i] = 0\n \tend\n \t# Find the max Square and set it at size matrix \n \tfor i in 1..rows-1\n \t\tfor j in 1..cols-1\n if (arr[i][j] == 1) then\n size[i][j] = [size[i][j-1], size[i-1][j], size[i-1][j-1]].min + 1\n else\n size[i][j] = 0 \t\t\n end\n \t\tend\n \tend\n # Find the maximum entry and\n # indices of maximum entry in S[][]\n max_of_s = size[0][0]\n max_i = 0\n max_j = 0\n for i in 0..rows-1\n for j in 0..cols-1\n if (max_of_s < size[i][j]) then\n max_of_s = size[i][j]\n max_i = i\n max_j = j \t\n end\n end\n end\n # puts \"max_of_s: #{max_of_s} max_i: #{max_i} max_j: #{max_j} \"\n \treturn [max_of_s, max_i, max_j]\n end",
"def longest_string(arr)\n arr.max_by { |word| word.length }\nend",
"def length_of_longest_substring_2(s)\r\n return 0 if s == \"\"\r\n result = 0\r\n chars = s.chars\r\n hash = Hash.new\r\n left, right = 0, 0\r\n hash[chars[right]] = right\r\n hash[chars[left]] = left\r\n\r\n while right < chars.size\r\n result = [right - left + 1, result].max\r\n\r\n if hash.has_key?(chars[right + 1]) && left != right\r\n # Process the window\r\n hash.delete(chars[left])\r\n left += 1\r\n elsif !hash.has_key?(chars[right + 1])\r\n # Expand the window\r\n right += 1\r\n else\r\n # Move the window\r\n right += 1\r\n left += 1\r\n end\r\n\r\n # Update hash\r\n hash[chars[right]] = right\r\n hash[chars[left]] = left\r\n end\r\n\r\n result\r\nend",
"def length_of_largest_cell_in_column n\n column_with_headings(n).map do |cell|\n if cell.is_a? Hash\n if cell[:colspan] && cell[:colspan] > 1\n if (cell[:value].to_s.length <= length_of_single_columns_where_multicolumn_is(cell[:start_index],cell[:colspan]))\n 0\n else\n spacing_length = (3 * (cell[:colspan] - 1))\n length_in_columns = (cell[:value].to_s.length - spacing_length)\n (length_in_columns.to_f / cell[:colspan]).ceil\n end\n else\n cell[:value].to_s.length\n end\n else\n cell.to_s.length\n end\n end.sort.last\n end",
"def clever_octopus(arr)\n i = 0\n j = arr.length-1\n\n max = arr[0]\n while i != j\n if arr[i].length < arr[j].length\n max = arr[j]\n i += 1\n elsif arr[j].length <= arr[i].length\n max = arr[i]\n j -= 1\n end\n end\n max \nend"
] |
[
"0.64059925",
"0.63923764",
"0.63339835",
"0.631743",
"0.631596",
"0.6270813",
"0.6242039",
"0.6204277",
"0.6183002",
"0.6183002",
"0.6183002",
"0.6183002",
"0.6183002",
"0.6183002",
"0.61391354",
"0.6133667",
"0.61227804",
"0.61004394",
"0.61004394",
"0.604049",
"0.60266834",
"0.6020959",
"0.6010115",
"0.6009129",
"0.59924173",
"0.5988845",
"0.5987095",
"0.5986265",
"0.5959383",
"0.593572",
"0.59240556",
"0.5902289",
"0.5882448",
"0.5854331",
"0.58387756",
"0.58205265",
"0.58052874",
"0.57612294",
"0.5755109",
"0.57550406",
"0.574385",
"0.57391304",
"0.57387763",
"0.573132",
"0.5730372",
"0.57274616",
"0.57265556",
"0.5721272",
"0.57143104",
"0.5696547",
"0.56964225",
"0.5682461",
"0.5679622",
"0.56772435",
"0.56769633",
"0.5666698",
"0.56651706",
"0.56640065",
"0.5652151",
"0.5646282",
"0.564563",
"0.56431955",
"0.56380856",
"0.56355864",
"0.56337386",
"0.5627387",
"0.56243604",
"0.56243604",
"0.5618858",
"0.56167257",
"0.56160766",
"0.56051546",
"0.56017935",
"0.5595746",
"0.55896467",
"0.5580691",
"0.55797935",
"0.5573206",
"0.55725026",
"0.55631155",
"0.556258",
"0.556258",
"0.5561623",
"0.5558975",
"0.5558623",
"0.5554698",
"0.5541838",
"0.552862",
"0.5527518",
"0.5526875",
"0.5523457",
"0.55193526",
"0.5518059",
"0.55138636",
"0.5509191",
"0.55059624",
"0.5502067",
"0.5500661",
"0.5496473",
"0.5493241"
] |
0.66691875
|
0
|
GET /announcements GET /announcements.xml
|
def index
@announcements = Announcement.find(:all, :order => 'starts_at desc')
respond_to do |format|
format.html # index.html.erb
format.xml { render :xml => @announcements }
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def index\n @announcements = Announcement.all\n end",
"def show\n @announcement = Announcement.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @announcement }\n end\n end",
"def index\n @announcements = Announcement.all\n end",
"def index\n @announcements = Announcement.all\n end",
"def show\n @announcement = Announcement.find(params[:id])\n\n respond_to do |format|\n format.html # show.haml\n format.xml { render :xml => @announcement }\n end\n end",
"def index\n @announcements = Announcement.all\n\n respond_to do |format|\n format.html { render html: '200' }\n format.json { render 'announcements/index', announcements: @announcements, status: :ok }\n end\n end",
"def index\n @announcements = Announcement.order(created_at: :desc).all\n render json: @announcements, each_serializer: AnnouncementsSerializer\n end",
"def announcements(&blk)\n if block_given?\n websocket.subscribe :getannouncements, &blk\n else\n http.get :getannouncements\n end\n end",
"def http_announce announcement\n announce announcement\n end",
"def index\n @announcements = current_group.announcements.paginate(:page => params[:page],\n :per_page => params[:per_page],\n :order => \"updated_at desc\")\n\n @announcement = Announcement.new\n\n respond_to do |format|\n format.html # index.html.haml\n format.json { render :json => @announcements }\n end\n end",
"def index\n @announcement_fors = AnnouncementFor.all\n end",
"def index\n @announcements = Announcement.all.order('created_at DESC').paginate(page: params[:page], per_page: 10)\n @title = 'Announcements'\n end",
"def show\n @announce = Announce.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @announce }\n end\n end",
"def show\n @announce = Announce.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @announce }\n end\n end",
"def new\n @announcement = Announcement.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @announcement }\n end\n end",
"def new\n @announcement = Announcement.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @announcement }\n end\n end",
"def show_announcements\n @announcements = @lecture.announcements.order(:created_at).reverse\n I18n.locale = @lecture.locale_with_inheritance\n render layout: 'application'\n end",
"def index\n @announcements = Announcement.for_today.visible_to(current_user)\n\n render\n end",
"def index\n @announcements = Announcement.visible.where(locale: I18n.locale || 'en').paginate(:page => params[:page], :per_page => 10)\n \n @announcements.first.increase_views unless @announcements.empty?\n\n @title = \"News\"\n\n logger.debug @announcement.inspect\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @announcements }\n end\n end",
"def new\n @announcement = Announcement.new\n\n respond_to do |format|\n format.html # new.haml\n format.xml { render :xml => @announcement }\n end\n end",
"def show\n @announcement = Announcement.find(params[:id])\n render json:@announcement\n end",
"def show\n @announcement = Announcement.find(params[:id])\n\n render\n end",
"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 index\n @announces = Announce.all\n end",
"def show\n @announcer = Announcer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @announcer }\n end\n end",
"def index\n @announcements = Announcement.all.order(\"created_at DESC\")\n end",
"def index\n @history_announcements = HistoryAnnouncement.all\n end",
"def url\n \"/announcements/#{self.year}/#{self.id}\"\n end",
"def find_announcement\n @announcement = Announcement.find(params[:id])\n end",
"def show\n @announcements = @cpd_event.announcements\n end",
"def show\n @announcement = Announcement.visible.find(params[:id])\n \n @announcement.increase_views\n \n @title = @announcement.title\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @announcement }\n end\n end",
"def index\n\n @deadlines = Deadline.all\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @deadlines }\n end \n end",
"def new_announcements(&blk)\n if block_given?\n websocket.subscribe :newannouncements, params: { auth: true }, &blk\n else\n http.get :newannouncements, auth: true\n end\n end",
"def show\n @announce_c = AnnounceC.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @announce_c }\n end\n end",
"def set_announce\n @announce = Announce.find(params[:id])\n end",
"def show\n @room_announcements = Announcement.where(room_id:@room.id)\n end",
"def list(filter, pager=KalturaNotImplemented)\n\t\t\tkparams = {}\n\t\t\tclient.add_param(kparams, 'filter', filter)\n\t\t\tclient.add_param(kparams, 'pager', pager)\n\t\t\tclient.queue_service_action_call('announcement', 'list', 'KalturaAnnouncementListResponse', kparams)\n\t\t\tif (client.is_multirequest)\n\t\t\t\treturn nil\n\t\t\tend\n\t\t\treturn client.do_queue()\n\t\tend",
"def index\n\t\t@people = Person.all\n\t\t# respond_to do |format|\n\t\t# \tformat.xml { send_data @entries.to_xml, :type => 'text/xml; charset=UTF-8;', :disposition => 'attachment; filename=entries.xml'}\n\t\t# end\n\tend",
"def index\n @articles = Article.published\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @articles }\n end\n end",
"def new\n @announce = Announce.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @announce }\n end\n end",
"def set_announcement\n @announcement = Announcement.find(params[:id])\n end",
"def set_announcement\n @announcement = Announcement.find(params[:id])\n end",
"def set_announcement\n @announcement = Announcement.find(params[:id])\n end",
"def set_announcement\n @announcement = Announcement.find(params[:id])\n end",
"def set_announcement\n @announcement = Announcement.find(params[:id])\n end",
"def announcements_list\n $tracer.trace(__method__)\n # unit_test_no_generate: announcements_list, section.className(\"/(^|\\s+)ats-announcements($|\\s+)/\"; ImpulseAnnouncementsList\n return ImpulseAnnouncementsList.new(ToolTag.new(section.className(\"/(^|\\s+)ats-announcements($|\\s+)/\"), __method__, self), self)\n end",
"def new\n @announcement = Announcement.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @announcement }\n end\n end",
"def create\n @announcement = Announcement.new(params[:announcement])\n\n respond_to do |format|\n if @announcement.save\n flash[:notice] = 'Announcement was successfully created.'\n format.html { redirect_to announcements_path }\n format.xml { render :xml => @announcement, :status => :created, :location => @announcement }\n else\n format.html do\n flash[:notice] = 'Announcement was not Successfully created'\n render :action => \"new\" \n end\n format.xml { render :xml => @announcement.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def set_announcement\n @announcement = Announcement.find(params[:id])\n end",
"def set_announcement\n @announcement = Announcement.find(params[:id])\n end",
"def set_announcement\n @announcement = Announcement.find(params[:id])\n end",
"def set_announcement\n @announcement = Announcement.find(params[:id])\n end",
"def set_announcement\n @announcement = Announcement.find(params[:id])\n end",
"def set_announcement\n @announcement = Announcement.find(params[:id])\n end",
"def set_announcement\n @announcement = Announcement.find(params[:id])\n end",
"def set_announcement\n @announcement = Announcement.find(params[:id])\n end",
"def set_announcement\n @announcement = Announcement.find(params[:id])\n end",
"def set_announcement\n @announcement = Announcement.find(params[:id])\n end",
"def index\n @articles = Article.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @articles }\n end\n end",
"def rss\n @headers[\"Content-Type\"] = \"application/xml\"\n @articles = Article.find(:all, \n :order => 'created_at DESC',\n :conditions => [\"articles.approved = ?\", true],\n :limit => 10\n )\n render :layout => false\n end",
"def new\n @announcer = Announcer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @announcer }\n end\n end",
"def retrieve_announces\n puts \"Retrieving announcements from the chef server and depositing them in '#{Settings[:announces_file]}'...\"\n Chef::Config.from_file(Settings[:knife_config])\n query = Chef::Search::Query.new\n nodes = {}\n query.search(:node,\"name:#{Settings[:node]}\") do |node|\n nodes[node.name] = node['announces'].to_hash unless node['announces'].nil?\n end\n File.open(Settings[:announces_file], 'w') {|f| f.write(nodes.to_json)}\nend",
"def index\n @received_issues = ReceivedIssue.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @received_issues }\n end\n end",
"def index\n @attendees = Attendee.paginate(:page => params[:page], :per_page => 40)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @attendees }\n end\n end",
"def destroy\n @announcement = Announcement.find(params[:id])\n @announcement.destroy\n\n respond_to do |format|\n format.html { redirect_to(announcements_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @announcement = Announcement.find(params[:id])\n @announcement.destroy\n\n respond_to do |format|\n format.html { redirect_to(announcements_url) }\n format.xml { head :ok }\n end\n end",
"def fetch_agenda_doc\n Nokogiri::HTML(open(agenda_url))\n end",
"def set_announcement\n @announcement = Announcement.find(params[:id])\n end",
"def set_announcement\n @announcement = Announcement.find_by(id: params[:id])\n end",
"def index\n @episodes = Episode.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @episodes }\n end\n end",
"def index\n @cohort = Cohort.find(params[:cohort_id])\n @announcements = @cohort.announcements\n end",
"def create\n @announcement = Announcement.new(announcement_params)\n\n respond_to do |format|\n if @announcement.save\n format.html { render html: '200' }\n format.json { render 'announcements/announcement', status: :created, announcement: @announcement }\n else\n format.html { render html: '500', status: :unprocessable_entity }\n format.json { render json: @announcement.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @discussions = Discussion.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @discussions }\n end\n end",
"def index\n @announcements = Announcement.all\n render json: @announcements, include: [:member => {only: [:first_name, :last_name, :id]}]\n end",
"def index\n @assignments = Assignment.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @assignments }\n end\n end",
"def index\n @attendances = Attendance.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @attendances }\n end\n end",
"def index\n @click_to_talks = ClickToTalk.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @click_to_talks }\n end\n end",
"def create\n @announce = Announce.new(params[:announce])\n\n respond_to do |format|\n if @announce.save\n format.html { redirect_to @announce, notice: 'Announce was successfully created.' }\n format.json { render json: @announce, status: :created, location: @announce }\n else\n format.html { render action: \"new\" }\n format.json { render json: @announce.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @announce = Announce.new(params[:announce])\n\n respond_to do |format|\n if @announce.save\n format.html { redirect_to @announce, notice: 'Announce was successfully created.' }\n format.json { render json: @announce, status: :created, location: @announce }\n else\n format.html { render action: \"new\" }\n format.json { render json: @announce.errors, status: :unprocessable_entity }\n end\n end\n end",
"def show\n @deadline = Deadline.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @deadline }\n end\n end",
"def index\n @latestinfos = Latestinfo.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @latestinfos }\n end\n end",
"def create\n @announcement = Announcement.new(params[:announcement])\n\n respond_to do |format|\n if @announcement.save\n flash[:notice] = I18n.t(\"{{value}} was successfully created.\", :default => \"{{value}} was successfully created.\", :value => I18n.t(\"Announcement\", :default => \"Announcement\"))\n format.html { redirect_to announcements_path }\n format.xml { render :xml => @announcement, :status => :created, :location => @announcement }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @announcement.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def get_listings_xml(url)\n @client.get_content(url)\n end",
"def index\n @article_lists = ArticleList.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @article_lists }\n end\n end",
"def announcements_read\n @attributes[:announcements_read]\n end",
"def index\n @passages = Passage.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @passages }\n end\n end",
"def index\n if params[:accepted] || session[:accepted] == true\n @announcements = Announcement.all\n session[:accepted] = true\n session[:updated_at] = Time.now\n else\n redirect_to wizard_path(:select_language)\n end\n end",
"def index\n @feed_entries = FeedEntry.all\n @title = \"Feeds List\"\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @feed_entries }\n end\n end",
"def destroy\n @announcement = Announcement.find(params[:id])\n @announcement.destroy\n\n respond_to do |format|\n format.html do\n flash[:notice] = 'Announcement has been successfully delected'\n redirect_to announcements_path \n end\n format.xml { head :ok }\n end\n end",
"def index\n @notifiers = Notifier.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @notifiers }\n end\n end",
"def show\n @analisis = Analisis.find(params[:id])\n\n respond_to do |format|\n format.xml { render :xml => @analisis }\n end\n end",
"def index\n @assignments = @user.assignments\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @assignments }\n end\n end",
"def index\n @annees = Annee.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @annees }\n end\n end",
"def index\n # This should never be called, just used for debugging\n @emergencies = Emergency.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @emergencies }\n end\n end",
"def set_announcement\n @announcement ||= Announcement.find(params[:id])\n end",
"def tournaments\n get('sports/en/tournaments.xml')\n end",
"def index\n @patient_encounters = PatientEncounter.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @patient_encounters }\n end\n end",
"def rss\n @events = Post.find(:all, {:conditions=> \"status=public\"},:order => \"id DESC\")\n render :layout => false\n headers[\"Content-Type\"] = \"application/xml; charset=utf-8\"\n end",
"def static_announce(params)\n assertion_fails = Array.new\n assertion_fails << \"params[:pool] must not be nil\" if params[:pool].nil?\n assertion_fails << \"params[:environment] must not be nil\" if params[:environment].nil?\n assertion_fails << \"params[:type] must not be nil\" if params[:type].nil?\n assertion_fails << \"params[:properties] must not be nil\" if params[:properties].nil?\n\n raise assertion_fails.join(\",\") if assertion_fails.size > 0\n\n announcement = {}\n announcement[\"pool\"] = params[:pool]\n announcement[\"environment\"] = params[:environment]\n announcement[\"type\"] = params[:type]\n announcement[\"properties\"] = params[:properties]\n announcement[\"location\"] = params[:location]\n\n @discovery_urls.each do |discovery_url|\n\n announce_uri = URI.parse(discovery_url).merge(\"/v1/announcement/static\")\n\n json = announcement.to_json\n @logger.debug(\"Announce Request: #{announce_uri.to_s}\")\n @logger.debug(\"Announce Body: #{json}\")\n\n begin\n response = @client.post(announce_uri.to_s, json, {'Content-Type' => 'application/json'})\n if response.status >= 200 && response.status <= 299\n data = JSON.parse(response.body)\n return data[\"id\"]\n end\n\n @logger.error(\"#{announce_uri.to_s}: Response Status #{response.status}\")\n @logger.error(response.body)\n\n rescue\n @logger.error(\"#{announce_uri.to_s}: #{$!}\")\n end\n end\n\n raise \"Failed to make static announcement on any of [ #{@discovery_urls.join(\",\")} ]\"\n\n end",
"def index\n @authorships = Authorship.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render xml: @authorships }\n end\n end"
] |
[
"0.7219041",
"0.7165205",
"0.7117977",
"0.7117977",
"0.70310444",
"0.68501073",
"0.6684618",
"0.668279",
"0.6629289",
"0.6588111",
"0.65563077",
"0.6494598",
"0.6453911",
"0.6453911",
"0.6436308",
"0.6436308",
"0.6394005",
"0.6350244",
"0.63181615",
"0.62904847",
"0.6275297",
"0.62682074",
"0.6249958",
"0.6246532",
"0.62457234",
"0.621628",
"0.61719996",
"0.617065",
"0.611891",
"0.6105086",
"0.60342014",
"0.59938455",
"0.5906049",
"0.59022605",
"0.58960295",
"0.5894371",
"0.58728296",
"0.58194655",
"0.58121955",
"0.5811687",
"0.5791832",
"0.5791832",
"0.5791832",
"0.5791832",
"0.5791832",
"0.5765534",
"0.57601666",
"0.57485783",
"0.5707285",
"0.5707285",
"0.5707285",
"0.5707285",
"0.5707285",
"0.5707285",
"0.5707285",
"0.5707285",
"0.5707285",
"0.5707285",
"0.5703626",
"0.56912464",
"0.5676753",
"0.565971",
"0.5647175",
"0.5644457",
"0.5633143",
"0.5633143",
"0.5628946",
"0.5617124",
"0.56127447",
"0.560715",
"0.55973303",
"0.55848664",
"0.55805564",
"0.5572708",
"0.5571636",
"0.5558353",
"0.5554121",
"0.5554111",
"0.5554111",
"0.5549409",
"0.5528822",
"0.55263793",
"0.5513248",
"0.55061865",
"0.5490365",
"0.54886305",
"0.5484821",
"0.54817593",
"0.5479253",
"0.54769355",
"0.547208",
"0.5470858",
"0.54670525",
"0.5460489",
"0.5455816",
"0.54463047",
"0.54458624",
"0.54452807",
"0.54440975",
"0.5442325"
] |
0.7142449
|
2
|
GET /announcements/new GET /announcements/new.xml
|
def new
@announcement = Announcement.new
respond_to do |format|
format.html # new.html.erb
format.xml { render :xml => @announcement }
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def new\n @announcement = Announcement.new\n\n respond_to do |format|\n format.html # new.haml\n format.xml { render :xml => @announcement }\n end\n end",
"def new\n @announce = Announce.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @announce }\n end\n end",
"def new\n @announcement = Announcement.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @announcement }\n end\n end",
"def new\n @announcer = Announcer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @announcer }\n end\n end",
"def new\n @announcement = Announcement.new\n @title = 'New announcement'\n end",
"def new\n @announce_c = AnnounceC.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @announce_c }\n end\n end",
"def new\n @announcement = Announcement.new\n end",
"def create\n @announcement = Announcement.new(params[:announcement])\n\n respond_to do |format|\n if @announcement.save\n flash[:notice] = 'Announcement was successfully created.'\n format.html { redirect_to announcements_path }\n format.xml { render :xml => @announcement, :status => :created, :location => @announcement }\n else\n format.html do\n flash[:notice] = 'Announcement was not Successfully created'\n render :action => \"new\" \n end\n format.xml { render :xml => @announcement.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def new\n if (params[:original_id])\n @original = Fundamental::Announcement.find_by_id(params[:original_id])\n raise NotFoundError.new \"Original not found.\" if @original.nil?\n @fundamental_announcement = @original.translations.build\n else\n @fundamental_announcement = Fundamental::Announcement.new({\n :locale => I18n.default_locale\n })\n end\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @fundamental_announcement }\n end\n end",
"def create\n @announcement = Announcement.new(params[:announcement])\n\n respond_to do |format|\n if @announcement.save\n flash[:notice] = I18n.t(\"{{value}} was successfully created.\", :default => \"{{value}} was successfully created.\", :value => I18n.t(\"Announcement\", :default => \"Announcement\"))\n format.html { redirect_to announcements_path }\n format.xml { render :xml => @announcement, :status => :created, :location => @announcement }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @announcement.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def new\n @lease = Lease.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @lease }\n end\n end",
"def new\n @noun = Noun.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @noun }\n end\n end",
"def new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => new_vurl }\n end\n end",
"def new\n @news_link = NewsLink.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @news_link }\n end\n end",
"def create\n @announce = Announce.new(params[:announce])\n\n respond_to do |format|\n if @announce.save\n format.html { redirect_to @announce, notice: 'Announce was successfully created.' }\n format.json { render json: @announce, status: :created, location: @announce }\n else\n format.html { render action: \"new\" }\n format.json { render json: @announce.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @announce = Announce.new(params[:announce])\n\n respond_to do |format|\n if @announce.save\n format.html { redirect_to @announce, notice: 'Announce was successfully created.' }\n format.json { render json: @announce, status: :created, location: @announce }\n else\n format.html { render action: \"new\" }\n format.json { render json: @announce.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @news = News.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @news }\n end\n end",
"def new\n @news = News.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @news }\n end\n end",
"def new\n @news = News.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @news }\n end\n end",
"def new\n @atom = Atom.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @atom }\n end\n end",
"def new\n @latestinfo = Latestinfo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @latestinfo }\n end\n end",
"def create\n @announcement = Announcement.new(announcement_params)\n\n respond_to do |format|\n action_message_for('new')\n if create_announcement\n format.html { redirect_to redirect_target(@announcement), flash: @feedback_flash }\n format.json { render :show, status: :created, location: @announcement }\n else\n format.html { render :new }\n format.json { render json: @announcement.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @journal = Journal.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @journal }\n end\n end",
"def new\n @news_update = NewsUpdate.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @news_update }\n end\n end",
"def new\n @changelog = Changelog.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @changelog }\n end\n end",
"def new\n @live_news = LiveNews.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @live_news }\n end\n end",
"def create\n @announcement = Announcement.new(params[:announcement])\n\n respond_to do |format|\n if @announcement.save\n format.html { redirect_to @announcement, notice: 'Announcement was successfully created.' }\n format.json { render json: @announcement, status: :created, location: @announcement }\n else\n format.html { render action: \"new\" }\n format.json { render json: @announcement.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @news_article = NewsArticle.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @news_article }\n end\n end",
"def new\n @article = Article.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @article }\n end\n end",
"def new\n @article = Article.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @article }\n end\n end",
"def new\n @article = Article.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @article }\n end\n end",
"def new\n @article = Article.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @article }\n end\n end",
"def new\n @article = Article.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @article }\n end\n end",
"def new\n @article = Article.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @article }\n end\n end",
"def new\n @article = Article.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @article }\n end\n end",
"def new\n @article = Article.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @article }\n end\n end",
"def new\n @news = News.new\n @title = \"New news\"\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @news }\n end\n end",
"def new\n @rssnew = Rssnews.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @rssnew }\n end\n end",
"def new\n @monkey = Monkey.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @monkey }\n end\n end",
"def new\n @attender = Attender.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @attender }\n end\n end",
"def new\n @listener = Listener.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @listener }\n end\n end",
"def new\n @journalentry = Journalentry.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @journalentry }\n end\n end",
"def create\n @announcement = Announcement.new(params[:announcement])\n if @announcement.save\n redirect_to admin_announcements_path, :notice => t('flash.admin.announcements.create')\n else\n render :action => \"new\"\n end\n end",
"def new\n @click_to_talk = ClickToTalk.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @click_to_talk }\n end\n end",
"def new\n @discovery = Discovery.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @discovery }\n end\n end",
"def new\n @newsletters_type = NewslettersType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @newsletters_type }\n end\n end",
"def new\n @tracker = Tracker.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @tracker }\n end\n end",
"def faq_new\n @article = Article.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @article }\n end\n end",
"def new\n @publication = Publication.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @publication }\n end\n end",
"def create\n @announcement = Announcement.new(permitted_params)\n\n respond_to do |format|\n if @announcement.save\n format.html { redirect_to announcements_path, notice: 'Announcement was successfully created.' }\n format.json { render action: 'show', status: :created, location: @announcement }\n else\n format.html { render action: 'new' }\n format.json { render json: @announcement.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @badge = Badge.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @badge }\n end\n end",
"def new\n @publication = Publication.new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @publication }\n end\n end",
"def new\n @journal_entry = JournalEntry.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @journal_entry }\n end\n end",
"def new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @notifier }\n end\n end",
"def new\n @today_activity = TodayActivity.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @today_activity }\n end\n end",
"def create\n @announcement = Announcement.new(announcement_params)\n\n respond_to do |format|\n if @announcement.save\n format.html { render html: '200' }\n format.json { render 'announcements/announcement', status: :created, announcement: @announcement }\n else\n format.html { render html: '500', status: :unprocessable_entity }\n format.json { render json: @announcement.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @activity = Activity.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @activity }\n end\n end",
"def new\n @activity = Activity.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @activity }\n end\n end",
"def new\n @activity = Activity.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @activity }\n end\n end",
"def new\n @url_migration = UrlMigration.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @url_migration }\n end\n end",
"def new\n @activity = Activity.new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @activity }\n end\n end",
"def new\n @evactivity = Evactivity.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @evactivity }\n end\n end",
"def new\n head :status => 405\n return\n \n @participant = Participant.new\n\n respond_to do |format|\n format.html # new.html.erb\n #format.xml { render :xml => @participant }\n end\n end",
"def new\n @note = Note.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @note }\n end\n end",
"def new\n @note = Note.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @note }\n end\n end",
"def new\n @note = Note.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @note }\n end\n end",
"def new\n @article ||= Article.new(:locale => I18n.default_locale)\n @title = t('label.article.creating')\n\n respond_to do |format|\n format.html { render :action => \"new\" }\n format.xml { render :xml => @article }\n end\n end",
"def new\n @episode = Episode.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @episode }\n end\n end",
"def new\n @episode = Episode.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @episode }\n end\n end",
"def new\n @ep = Ep.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @ep }\n end\n end",
"def new\n @attachment = Attachment.new\n @entries = Entry.find(:all, :order => \"updated_at DESC\").map { |e| [e.title, e.id] }\n\n respond_to do |format|\n format.html\n format.xml { render :xml => @attachment }\n end\n end",
"def show\n @announcement = Announcement.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @announcement }\n end\n end",
"def new\n @topic = Topic.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @topic }\n end\n end",
"def new\n @topic = Topic.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @topic }\n end\n end",
"def new\n @topic = Topic.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @topic }\n end\n end",
"def new\n @topic = Topic.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @topic }\n end\n end",
"def new\n @topic = Topic.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @topic }\n end\n end",
"def new\n @news_item = NewsItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @news_item }\n end\n end",
"def new\n @news_item = NewsItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @news_item }\n end\n end",
"def new\n @ref = Ref.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @ref }\n end\n end",
"def new\n @adjunto = Adjunto.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @adjunto }\n end\n end",
"def new\n @election = Election.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @election }\n end\n end",
"def new\n @notification = Notification.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @notification }\n end\n end",
"def new\n @approval = Approval.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @approval }\n end\n end",
"def new\n @newsletter = Newsletter.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @newsletter }\n end\n end",
"def new\n @add_on = AddOn.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @add_on }\n end\n end",
"def new\n @follower = Follower.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @follower }\n end\n end",
"def create\n @announcement = Course.find(params[:course_id]).announcements.build(params[:announcement])\n\n respond_to do |format|\n if @announcement.save\n format.html { redirect_to(@announcement.course, :notice => 'Announcement was successfully created.') }\n format.xml { render :xml => @announcement, :status => :created, :location => @announcement }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @announcement.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def new\n @docent = Docent.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @docent }\n end\n end",
"def new\n @topic = Topic.new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @topic }\n end\n end",
"def new\n @bookmark = Bookmark.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @bookmark }\n end\n end",
"def new\n @bookmark = Bookmark.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @bookmark }\n end\n end",
"def new\n @entry = Entry.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @entry }\n end\n end",
"def new\n \n @topic = Topic.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @topic }\n end\n end",
"def new\n @annee = Annee.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @annee }\n end\n end",
"def new\n @artifact_note = ArtifactNote.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @artifact_note }\n end\n end",
"def new\n @deadline = Deadline.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @deadline }\n end\n end",
"def new\n @feat = @person.feats.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @feat }\n end\n end",
"def new\n @node = Node.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @node }\n end\n end"
] |
[
"0.7923954",
"0.75682324",
"0.7436319",
"0.7276343",
"0.71831554",
"0.7018658",
"0.70069426",
"0.6921423",
"0.6859628",
"0.6828302",
"0.6828028",
"0.6810493",
"0.6788889",
"0.6767258",
"0.67655563",
"0.67655563",
"0.6735334",
"0.6735334",
"0.6735334",
"0.673487",
"0.6732698",
"0.6729342",
"0.6724734",
"0.67212576",
"0.6690042",
"0.66853684",
"0.6664212",
"0.66575193",
"0.66488284",
"0.66488284",
"0.66488284",
"0.66488284",
"0.66488284",
"0.66488284",
"0.66488284",
"0.66488284",
"0.6646187",
"0.6644574",
"0.663518",
"0.66262186",
"0.66249084",
"0.66241217",
"0.6605176",
"0.660227",
"0.65915906",
"0.6585125",
"0.6584648",
"0.6581919",
"0.65770745",
"0.6577015",
"0.65694624",
"0.65673053",
"0.6560783",
"0.65551347",
"0.6550946",
"0.65507394",
"0.6544169",
"0.6544169",
"0.6544169",
"0.6535822",
"0.652996",
"0.65198743",
"0.65190107",
"0.65169346",
"0.65169346",
"0.65169346",
"0.651145",
"0.65101284",
"0.65101284",
"0.65049154",
"0.64980185",
"0.64948",
"0.64937264",
"0.64937264",
"0.64937264",
"0.64937264",
"0.64937264",
"0.6491282",
"0.6491282",
"0.64879465",
"0.648542",
"0.6481115",
"0.64808095",
"0.6475446",
"0.6472014",
"0.64675885",
"0.64635503",
"0.6463509",
"0.6463462",
"0.6457643",
"0.6450591",
"0.6450591",
"0.64486825",
"0.6446174",
"0.6444003",
"0.6442901",
"0.64408976",
"0.6435499",
"0.6433474"
] |
0.7999204
|
1
|
POST /announcements POST /announcements.xml
|
def create
@announcement = Announcement.new(params[:announcement])
respond_to do |format|
if @announcement.save
flash[:notice] = 'Announcement was successfully created.'
format.html { redirect_to announcements_path }
format.xml { render :xml => @announcement, :status => :created, :location => @announcement }
else
format.html do
flash[:notice] = 'Announcement was not Successfully created'
render :action => "new"
end
format.xml { render :xml => @announcement.errors, :status => :unprocessable_entity }
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def create\n @announcement = Announcement.new(announcement_params)\n\n respond_to do |format|\n if @announcement.save\n format.html { render html: '200' }\n format.json { render 'announcements/announcement', status: :created, announcement: @announcement }\n else\n format.html { render html: '500', status: :unprocessable_entity }\n format.json { render json: @announcement.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @announce = Announce.new(params[:announce])\n\n respond_to do |format|\n if @announce.save\n format.html { redirect_to @announce, notice: 'Announce was successfully created.' }\n format.json { render json: @announce, status: :created, location: @announce }\n else\n format.html { render action: \"new\" }\n format.json { render json: @announce.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @announce = Announce.new(params[:announce])\n\n respond_to do |format|\n if @announce.save\n format.html { redirect_to @announce, notice: 'Announce was successfully created.' }\n format.json { render json: @announce, status: :created, location: @announce }\n else\n format.html { render action: \"new\" }\n format.json { render json: @announce.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @announcement = Announcement.new(params[:announcement])\n\n respond_to do |format|\n if @announcement.save\n flash[:notice] = I18n.t(\"{{value}} was successfully created.\", :default => \"{{value}} was successfully created.\", :value => I18n.t(\"Announcement\", :default => \"Announcement\"))\n format.html { redirect_to announcements_path }\n format.xml { render :xml => @announcement, :status => :created, :location => @announcement }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @announcement.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @announcement = Announcement.new(params[:announcement])\n\n respond_to do |format|\n if @announcement.save\n format.html { redirect_to @announcement, notice: 'Announcement was successfully created.' }\n format.json { render json: @announcement, status: :created, location: @announcement }\n else\n format.html { render action: \"new\" }\n format.json { render json: @announcement.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @announcement = Announcement.new(permitted_params)\n\n respond_to do |format|\n if @announcement.save\n format.html { redirect_to announcements_path, notice: 'Announcement was successfully created.' }\n format.json { render action: 'show', status: :created, location: @announcement }\n else\n format.html { render action: 'new' }\n format.json { render json: @announcement.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @announcement = Announcement.new(params[:announcement])\n if @announcement.save\n redirect_to admin_announcements_path, :notice => t('flash.admin.announcements.create')\n else\n render :action => \"new\"\n end\n end",
"def create\n @announcement = Announcement.new\n @announcement.safe_update(%w[message only_anonymous], params[:announcement])\n\n @announcement.starts_at = build_datetime(params[:announcement], \"starts_at\")\n @announcement.ends_at = build_datetime(params[:announcement], \"ends_at\")\n\n @announcement.group = current_group\n\n respond_to do |format|\n if @announcement.save\n flash[:notice] = I18n.t(\"announcements.create.success\")\n format.html { redirect_to announcements_url }\n format.json { render :json => @announcement, :status => :created, :location => @announcement }\n else\n format.html { render :action => \"index\" }\n format.json { render :json => @announcement.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @announcement = Announcement.new(announcement_params)\n @announcement.user = current_user\n respond_to do |format|\n if @announcement.save\n format.html { redirect_to @announcement, notice: 'Announcement was successfully created.' }\n format.json { render :show, status: :created, location: @announcement }\n else\n format.html { render :new }\n format.json { render json: @announcement.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @announcement = Announcement.new(announcement_params)\n @announcement.user_id = current_user.id\n\n respond_to do |format|\n if @announcement.save\n format.html { redirect_to @announcement, notice: 'Announcement was successfully created.' }\n format.json { render :show, status: :created, location: @announcement }\n else\n format.html { render :new }\n format.json { render json: @announcement.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @announcement = current_user.announcements.build(permitted_params.announcement)\n\n respond_to do |format|\n if @announcement.save\n format.html { redirect_to @announcement, notice: 'Announcement was successfully created.' }\n format.json { render action: 'show', status: :created, location: @announcement }\n else\n flash.now[:error] = @announcement.errors.full_messages\n format.html { render action: 'new' }\n format.json { render json: @announcement.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @announcement = Announcement.new(announcement_params)\n\n respond_to do |format|\n action_message_for('new')\n if create_announcement\n format.html { redirect_to redirect_target(@announcement), flash: @feedback_flash }\n format.json { render :show, status: :created, location: @announcement }\n else\n format.html { render :new }\n format.json { render json: @announcement.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @announcement = Announcement.new(announcement_params)\n @announcement.owner = current_user\n\n respond_to do |format|\n if @announcement.save\n format.html { redirect_to user_announcement_path(current_user, @announcement), notice: 'Announcement was successfully created.' }\n format.json { render :show, status: :created, location: user_announcement_path(current_user, @announcement) }\n else\n flash[:error] = 'Please provide correction values.'\n format.html { render :new }\n format.json { render json: @announcement.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @announcement_for = AnnouncementFor.new(announcement_for_params)\n\n respond_to do |format|\n if @announcement_for.save\n\n \n format.html { redirect_to @announcement_for, notice: 'Announcement for was successfully created.' }\n format.json { render :show, status: :created, location: @announcement_for }\n else\n format.html { render :new }\n format.json { render json: @announcement_for.errors, status: :unprocessable_entity }\n end\n end\n end",
"def http_announce announcement\n announce announcement\n end",
"def save_announcement\n @announcement = Announcement.new announcement_params\n @announcement.save\n end",
"def announcement_params\n params.require(:announcement).permit(:title, :description, :deadline, :tags)\n end",
"def create\n @announcement = Announcement.new(user_params)\n if @announcement.save\n flash[:success] = \"Announcement Saved\"\n redirect_to root_path\n else\n render 'new'\n end\n end",
"def create\n @announcement = Course.find(params[:course_id]).announcements.build(params[:announcement])\n\n respond_to do |format|\n if @announcement.save\n format.html { redirect_to(@announcement.course, :notice => 'Announcement was successfully created.') }\n format.xml { render :xml => @announcement, :status => :created, :location => @announcement }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @announcement.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n getFullNameEmployees\n @announcement = Announcement.new(announcement_params)\n if @announcement.global\n @announcement.employee_id=0\n end\n @announcement.accepted = false\n\n # @announcement.global = true\n respond_to do |format|\n\n if @announcement.save\n format.html { redirect_to @announcement, notice: 'Anuncio fue creado.' }\n format.json { render :show, status: :created, location: @announcement }\n else\n format.html { render :new }\n format.json { render json: @announcement.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @announcement = Announcement.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @announcement }\n end\n end",
"def new\n @announcement = Announcement.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @announcement }\n end\n end",
"def create\n @announcement = Announcement.new(announcement_params.merge(user: current_user))\n\n if @announcement.save\n render 'show'\n else\n render json: @announcement.errors, status: :unprocessable_entity\n end\n end",
"def new\n @announcement = Announcement.new\n\n respond_to do |format|\n format.html # new.haml\n format.xml { render :xml => @announcement }\n end\n end",
"def post_announcement\n @user = @receiver\n @notification = @user.notifications.find_by(path: \"/announcements/#{@announcement.id}\")\n mail to: @user.email, subject: \"[bootcamp] #{@announcement.user.login_name}さんからお知らせです。\"\n end",
"def announcement_params\n params.require(:announcement).permit(:title, :body, :link)\n end",
"def create\n @announcement = Announcement.new(announcement_params)\n @announcement.user = current_user\n\n if @announcement.save\n redirect_to root_path\n else\n @announcement_errors = {}\n @announcement.errors.each do |attr, msg|\n @announcement_errors[attr] = msg\n end\n render 'new'\n end\n end",
"def index\n @announcements = Announcement.all\n end",
"def index\n @announcements = Announcement.all\n end",
"def index\n @announcements = Announcement.all\n end",
"def create\n @announce_c = AnnounceC.new(params[:announce_c])\n\n respond_to do |format|\n if @announce_c.save\n format.html { redirect_to @announce_c, notice: 'Announce c was successfully created.' }\n format.json { render json: @announce_c, status: :created, location: @announce_c }\n else\n format.html { render action: \"new\" }\n format.json { render json: @announce_c.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @fundamental_announcement = Fundamental::Announcement.new(params[:fundamental_announcement])\n @fundamental_announcement.author = current_backend_user\n\n respond_to do |format|\n if @fundamental_announcement.save\n format.html { redirect_to @fundamental_announcement, notice: 'Announcement was successfully created.' }\n format.json { render json: @fundamental_announcement, status: :created, location: @fundamental_announcement }\n else\n format.html { render action: \"new\" }\n format.json { render json: @fundamental_announcement.errors, status: :unprocessable_entity }\n end\n end\n end",
"def announce_post(listname,domain,subject,message,name,options={})\n values = {\n \"listname\" => listname,\n \"domain\" => domain,\n \"subject\" => subject,\n \"message\" => message,\n \"name\" => name\n }.merge(options)\n doc = request(\"announcement_list-post_announcement\", values, true)\n api_error?(doc)\n true\n end",
"def announcement_params\n params.require(:announcement).permit(:description, :member_id)\n end",
"def create\n @history_announcement = HistoryAnnouncement.new(history_announcement_params)\n\n respond_to do |format|\n if @history_announcement.save\n format.html { redirect_to @history_announcement, notice: 'History announcement was successfully created.' }\n format.json { render :show, status: :created, location: @history_announcement }\n else\n format.html { render :new }\n format.json { render json: @history_announcement.errors, status: :unprocessable_entity }\n end\n end\n end",
"def announcement_params\n params.require(:announcement).permit(:title, :content, :accepted, :global, :employee_id)\n end",
"def create\n @announcer = Announcer.new(params[:announcer])\n\n respond_to do |format|\n if @announcer.save\n format.html { redirect_to(@announcer, :notice => 'Announcer was successfully created.') }\n format.xml { render :xml => @announcer, :status => :created, :location => @announcer }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @announcer.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def announcement_params\n params.require(:announcement).permit(:content)\n end",
"def announcement_params\n params.require(:announcement).permit(:body)\n end",
"def announcement_params\n params.require(:announcement).permit(:title, :image, :content, :date)\n end",
"def new\n @announcement = Announcement.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @announcement }\n end\n end",
"def new\n @announce = Announce.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @announce }\n end\n end",
"def index\n @announcements = Announcement.all\n\n respond_to do |format|\n format.html { render html: '200' }\n format.json { render 'announcements/index', announcements: @announcements, status: :ok }\n end\n end",
"def announcement_params\n params.require(:announcement).permit(:title, :txt, :start_announcing_at, :stop_announcing_at, :category_id, :concept, :role_names)\n \n end",
"def index\n @announcements = current_group.announcements.paginate(:page => params[:page],\n :per_page => params[:per_page],\n :order => \"updated_at desc\")\n\n @announcement = Announcement.new\n\n respond_to do |format|\n format.html # index.html.haml\n format.json { render :json => @announcements }\n end\n end",
"def announcement_params\n params.require(:announcement).permit(:title, :description, :pinned)\n end",
"def announcement_params\n params[:announcement]\n end",
"def announcement_params\n params.require(:announcement).permit(:title, :description, :time_from, :time_to, :lat, :lng)\n end",
"def set_announcement\n @announcement = Announcement.find(params[:id])\n end",
"def set_announcement\n @announcement = Announcement.find(params[:id])\n end",
"def set_announcement\n @announcement = Announcement.find(params[:id])\n end",
"def set_announcement\n @announcement = Announcement.find(params[:id])\n end",
"def set_announcement\n @announcement = Announcement.find(params[:id])\n end",
"def new\n @announcement = Announcement.new\n end",
"def create\n @announcement = Announcement.new(announcement_params)\n @degrees = params[:degrees]['degree']\n @charges = params[:charges]['charge']\n @announcement.degrees = @degrees.join(',')\n @annoCuncement.charges = @charges.join(',')\n @announcement.user = current_user\n @announcement.president_aproved = false\n @announcement.oficial_aproved = false\n respond_to do |format|\n if @announcement.save\n format.html { redirect_to @announcement, notice: 'El anuncio se creo correctamente.' }\n format.json { render :show, status: :created, location: @announcement }\n else\n format.html { render :new }\n format.json { render json: @announcement.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @announcement = Announcement.new\n @title = 'New announcement'\n end",
"def new_announcements(&blk)\n if block_given?\n websocket.subscribe :newannouncements, params: { auth: true }, &blk\n else\n http.get :newannouncements, auth: true\n end\n end",
"def static_announce(params)\n assertion_fails = Array.new\n assertion_fails << \"params[:pool] must not be nil\" if params[:pool].nil?\n assertion_fails << \"params[:environment] must not be nil\" if params[:environment].nil?\n assertion_fails << \"params[:type] must not be nil\" if params[:type].nil?\n assertion_fails << \"params[:properties] must not be nil\" if params[:properties].nil?\n\n raise assertion_fails.join(\",\") if assertion_fails.size > 0\n\n announcement = {}\n announcement[\"pool\"] = params[:pool]\n announcement[\"environment\"] = params[:environment]\n announcement[\"type\"] = params[:type]\n announcement[\"properties\"] = params[:properties]\n announcement[\"location\"] = params[:location]\n\n @discovery_urls.each do |discovery_url|\n\n announce_uri = URI.parse(discovery_url).merge(\"/v1/announcement/static\")\n\n json = announcement.to_json\n @logger.debug(\"Announce Request: #{announce_uri.to_s}\")\n @logger.debug(\"Announce Body: #{json}\")\n\n begin\n response = @client.post(announce_uri.to_s, json, {'Content-Type' => 'application/json'})\n if response.status >= 200 && response.status <= 299\n data = JSON.parse(response.body)\n return data[\"id\"]\n end\n\n @logger.error(\"#{announce_uri.to_s}: Response Status #{response.status}\")\n @logger.error(response.body)\n\n rescue\n @logger.error(\"#{announce_uri.to_s}: #{$!}\")\n end\n end\n\n raise \"Failed to make static announcement on any of [ #{@discovery_urls.join(\",\")} ]\"\n\n end",
"def set_announce\n @announce = Announce.find(params[:id])\n end",
"def index\n @announcements = Announcement.order(created_at: :desc).all\n render json: @announcements, each_serializer: AnnouncementsSerializer\n end",
"def create(params)\n\nxml =<<XML\n<entry xmlns=\"http://purl.org/atom/ns#\">\n <title>#{params[:title]}</title>\n <link rel=\"related\" type=\"text/html\" href=\"#{params[:url]}\" />\n <summary type=\"text/plain\">#{params[:comment]}</summary>\n</entry>\nXML\n\n post('/post', xml)\n end",
"def index\n @announcement_fors = AnnouncementFor.all\n end",
"def announcement_params\n params.require(:announcement).permit(:title, :user_id, :content, :cohort_id)\n end",
"def destroy\n @announcement = Announcement.find(params[:id])\n @announcement.destroy\n\n respond_to do |format|\n format.html { redirect_to(announcements_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @announcement = Announcement.find(params[:id])\n @announcement.destroy\n\n respond_to do |format|\n format.html { redirect_to(announcements_url) }\n format.xml { head :ok }\n end\n end",
"def set_announcement\n @announcement = Announcement.find(params[:id])\n end",
"def set_announcement\n @announcement = Announcement.find(params[:id])\n end",
"def set_announcement\n @announcement = Announcement.find(params[:id])\n end",
"def set_announcement\n @announcement = Announcement.find(params[:id])\n end",
"def set_announcement\n @announcement = Announcement.find(params[:id])\n end",
"def set_announcement\n @announcement = Announcement.find(params[:id])\n end",
"def set_announcement\n @announcement = Announcement.find(params[:id])\n end",
"def set_announcement\n @announcement = Announcement.find(params[:id])\n end",
"def set_announcement\n @announcement = Announcement.find(params[:id])\n end",
"def set_announcement\n @announcement = Announcement.find(params[:id])\n end",
"def announcement_for_params\n params.require(:announcement_for).permit(:announcement_id, :franchisee_id)\n end",
"def create\n @announcement = Announcement.new(announcement_params)\n @announcement.user = current_user\n @announcement.cohort = @cohort\n respond_to do |format|\n if @announcement.save\n @cohort.users.each do |user|\n user_announcement = UserAnnouncement.create!(user: user, cohort:@cohort, announcement:@announcement, read: false)\n end\n format.html { redirect_to @cohort, notice: 'Announcement was successfully created.' }\n format.json { render :show, status: :created, location: @announcement }\n else\n format.html { render :new }\n format.json { render json: @announcement.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_announcement\n @announcement = Announcement.find_by(id: params[:id])\n end",
"def index\n @announcements = Announcement.find(:all, :order => 'starts_at desc')\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @announcements }\n end\n end",
"def create\n @adjunto = Adjunto.new(params[:adjunto])\n\n respond_to do |format|\n if @adjunto.save\n format.html { redirect_to(@adjunto, :notice => 'Adjunto was successfully created.') }\n format.xml { render :xml => @adjunto, :status => :created, :location => @adjunto }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @adjunto.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def destroy\n @announcement = Announcement.find(params[:id])\n @announcement.destroy\n\n respond_to do |format|\n format.html do\n flash[:notice] = 'Announcement has been successfully delected'\n redirect_to announcements_path \n end\n format.xml { head :ok }\n end\n end",
"def create\n @announcement = Announcement.new({title: params[:title], description: params[:description], price: params[:price], photo: params[:photo], user_id: params[:user_id], latitude: params[:latitude], longitude: params[:longitude], subcategory_id: params[:subcategory_id], place: params[:place]})\n @announcement.save\n render json:@announcement\n end",
"def new\n @announcer = Announcer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @announcer }\n end\n end",
"def update\n respond_to do |format|\n if @announcement.update(announcement_params)\n format.html { render html: '200', status: :ok }\n format.json { render 'announcements/announcement', status: :ok, announcement: @announcement }\n else\n format.html { render html: '500', status: :unprocessable_entity }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def test_should_create_post_via_API_XML\r\n get \"/logout\"\r\n post \"/forum_posts.xml\", :api_key=>'testapikey',\r\n :forum_post => {:title=>'API Test Post',\r\n :body=>'Test Post desc',\r\n :user_id=>1}\r\n assert_response :created\r\n end",
"def create\n @classannounce = current_user.classannounces.build(classannounce_params)\n\n respond_to do |format|\n if @classannounce.save\n format.html { redirect_to @classannounce }\n format.json { render :show, status: :created, location: @classannounce }\n else\n format.html { render :new }\n format.json { render json: @classannounce.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_course_announcement(course, announcement)\n logger.info \"Creating announcement: #{announcement.title}\"\n navigate_to \"#{Utils.canvas_base_url}/courses/#{course.site_id}/discussion_topics/new?is_announcement=true\"\n enter_and_save_announcement announcement\n end",
"def show\n @announcement = Announcement.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @announcement }\n end\n end",
"def update\n @announcement = Announcement.find(params[:id])\n\n if @announcement.update(announcement_params)\n head :no_content\n else\n render json: @announcement.errors, status: :unprocessable_entity\n end\n end",
"def post(xmldoc)\n headers = {'Content-Type' => 'text/xml'}\n check_response( @httpcli.post(@endpoint, xmldoc, headers) )\n end",
"def permitted_params\n params.require(:announcement).permit(:title, :description, :document, :document_cache)\n end",
"def set_announcement\n @announcement = Announcement.find(params[:id])\n end",
"def create(name=\"Default Name\", age=\"50\")\r\n xml_req =\r\n \"<?xml version='1.0' encoding='UTF-8'?>\r\n <person>\r\n <name>#{name}</name>\r\n <age>#{age}</age>\r\n </person>\"\r\n \r\n request = Net::HTTP::Post.new(@url)\r\n request.add_field \"Content-Type\", \"application/xml\"\r\n request.body = xml_req\r\n \r\n http = Net::HTTP.new(@uri.host, @uri.port)\r\n response = http.request(request)\r\n response.body \r\n end",
"def announcement_params\n params.require(:announcement).permit(:subtype,\n :body_content,\n :featured_image,\n :featured_image_alt,\n :featured_image_caption,\n :object_title,\n :object_embed_code,\n :contact_name,\n :contact_email,\n :contact_phone,\n :call_to_action_type,\n :call_to_action_label,\n :call_to_action_content,\n :call_to_action_reason,\n content_item_attributes: [:id,\n :as_a,\n :i_need,\n :so_that,\n :title,\n :summary,\n :status,\n :organisation_id,\n associated_org_ids: [],\n label_ids: []]\n )\n end",
"def set_fdn_announcement\n @fdn_announcement = Fdn::Announcement.find(params[:id])\n end",
"def announcement_params\n params.require(:announcement).permit(:title, :description, :category_id, :price, :viewn, {avatars: []})\n end",
"def announcements(&blk)\n if block_given?\n websocket.subscribe :getannouncements, &blk\n else\n http.get :getannouncements\n end\n end",
"def announce; end",
"def new\n @announce_c = AnnounceC.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @announce_c }\n end\n end",
"def update\n @announcement = Announcement.find(params[:id])\n\n respond_to do |format|\n if @announcement.update_attributes(params[:announcement])\n format.html { redirect_to(@announcement, :notice => 'Announcement was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @announcement.errors, :status => :unprocessable_entity }\n end\n end\n end"
] |
[
"0.6889887",
"0.6874412",
"0.6874412",
"0.68625504",
"0.6846886",
"0.6703081",
"0.6667529",
"0.66169566",
"0.658104",
"0.6554651",
"0.6519784",
"0.6501138",
"0.64651704",
"0.64454",
"0.6397792",
"0.63735604",
"0.63589764",
"0.63033664",
"0.62843746",
"0.6250486",
"0.62473965",
"0.62473965",
"0.62256503",
"0.6112081",
"0.61083156",
"0.60470766",
"0.60443735",
"0.6041729",
"0.6041729",
"0.6026881",
"0.60224676",
"0.59767103",
"0.59766227",
"0.59402096",
"0.5932381",
"0.5920972",
"0.59193945",
"0.58609235",
"0.5860793",
"0.58574677",
"0.58518213",
"0.583222",
"0.5820188",
"0.5807101",
"0.58027357",
"0.5767114",
"0.5757272",
"0.57250667",
"0.57213813",
"0.57213813",
"0.57213813",
"0.57213813",
"0.57213813",
"0.5705315",
"0.56908566",
"0.5679328",
"0.566235",
"0.56621313",
"0.565567",
"0.5620689",
"0.561625",
"0.5595649",
"0.5589314",
"0.55759364",
"0.55759364",
"0.557179",
"0.557179",
"0.557179",
"0.557179",
"0.557179",
"0.557179",
"0.557179",
"0.557179",
"0.557179",
"0.557179",
"0.55659086",
"0.55551106",
"0.5554943",
"0.55329376",
"0.5532851",
"0.55284226",
"0.5527412",
"0.5500892",
"0.54987913",
"0.54964834",
"0.54924226",
"0.54830146",
"0.54500824",
"0.5441645",
"0.54123807",
"0.540856",
"0.5407879",
"0.53971183",
"0.5389508",
"0.5382642",
"0.53751224",
"0.5356986",
"0.5314411",
"0.5314106",
"0.53116584"
] |
0.6905966
|
0
|
PUT /announcements/1 PUT /announcements/1.xml
|
def update
@announcement = Announcement.find(params[:id])
respond_to do |format|
if @announcement.update_attributes(params[:announcement])
flash[:notice] = 'Announcement was successfully updated.'
format.html { redirect_to announcements_path }
format.xml { head :ok }
else
format.html do
flash[:notice] = 'Announcement was not successfully updated'
render :action => "edit"
end
format.xml { render :xml => @announcement.errors, :status => :unprocessable_entity }
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def update\n @announce = Announce.find(params[:id])\n\n respond_to do |format|\n if @announce.update_attributes(params[:announce])\n format.html { redirect_to @announce, notice: 'Announce was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @announce.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @announce = Announce.find(params[:id])\n\n respond_to do |format|\n if @announce.update_attributes(params[:announce])\n format.html { redirect_to @announce, notice: 'Announce was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @announce.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @announcement = Announcement.find(params[:id])\n\n respond_to do |format|\n if @announcement.update_attributes(params[:announcement])\n format.html { redirect_to(@announcement, :notice => 'Announcement was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @announcement.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @announcement = Announcement.find(params[:id])\n\n if @announcement.update(announcement_params)\n head :no_content\n else\n render json: @announcement.errors, status: :unprocessable_entity\n end\n end",
"def update\n @announcement = Announcement.find(params[:id])\n\n respond_to do |format|\n if @announcement.update_attributes(params[:announcement])\n format.html { redirect_to @announcement, notice: 'Announcement was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @announcement.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @announcement = Announcement.find(params[:id])\n\n respond_to do |format|\n if @announcement.update_attributes(params[:announcement])\n flash[:notice] = I18n.t(\"{{value}} was successfully updated.\", :default => \"{{value}} was successfully updated.\", :value => I18n.t(\"Announcement\", :default => \"Announcement\"))\n format.html { redirect_to(announcement_path(@announcement)) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @announcement.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def set_announce\n @announce = Announce.find(params[:id])\n end",
"def update\n respond_to do |format|\n if @announcement.update(announcement_params)\n format.html { render html: '200', status: :ok }\n format.json { render 'announcements/announcement', status: :ok, announcement: @announcement }\n else\n format.html { render html: '500', status: :unprocessable_entity }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update opts = {}\n opts[:headers] ||= {}\n opts[:headers]['Content-Type'] ||= 'text/xml'\n post 'update', opts\n end",
"def update\n respond_to do |format|\n if @announcement.update(announcement_params)\n format.html { redirect_to @announcement, notice: 'Announcement was successfully updated.' }\n format.json { render :show, status: :ok, location: @announcement }\n else\n format.html { render :edit }\n format.json { render json: @announcement.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @announcement.update(announcement_params)\n format.html { redirect_to @announcement, notice: 'Announcement was successfully updated.' }\n format.json { render :show, status: :ok, location: @announcement }\n else\n format.html { render :edit }\n format.json { render json: @announcement.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @announcement.update(announcement_params)\n format.html { redirect_to @announcement, notice: 'Announcement was successfully updated.' }\n format.json { render :show, status: :ok, location: @announcement }\n else\n format.html { render :edit }\n format.json { render json: @announcement.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @announcement.update(announcement_params)\n format.html { redirect_to @announcement, notice: 'Announcement was successfully updated.' }\n format.json { render :show, status: :ok, location: @announcement }\n else\n format.html { render :edit }\n format.json { render json: @announcement.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @fundamental_announcement = Fundamental::Announcement.find(params[:id])\n\n respond_to do |format|\n if @fundamental_announcement.update_attributes(params[:fundamental_announcement])\n format.html { redirect_to @fundamental_announcement, notice: 'Announcement was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @fundamental_announcement.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_announcement\n @announcement = Announcement.find(params[:id])\n end",
"def set_announcement\n @announcement = Announcement.find(params[:id])\n end",
"def set_announcement\n @announcement = Announcement.find(params[:id])\n end",
"def set_announcement\n @announcement = Announcement.find(params[:id])\n end",
"def set_announcement\n @announcement = Announcement.find(params[:id])\n end",
"def update\n respond_to do |format|\n if @announcement.update(announcement_params)\n format.html { redirect_to @announcement, notice: 'El anuncio se edito correctamente.' }\n format.json { render :show, status: :ok, location: @announcement }\n else\n format.html { render :edit }\n format.json { render json: @announcement.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @announcement.update(announcement_params)\n format.html { redirect_to @announcement, notice: 'Anuncio fue actualizado.' }\n format.json { render :show, status: :ok, location: @announcement }\n else\n format.html { render :edit }\n format.json { render json: @announcement.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_announcement\n @announcement = Announcement.find(params[:id])\n end",
"def set_announcement\n @announcement = Announcement.find(params[:id])\n end",
"def set_announcement\n @announcement = Announcement.find(params[:id])\n end",
"def set_announcement\n @announcement = Announcement.find(params[:id])\n end",
"def set_announcement\n @announcement = Announcement.find(params[:id])\n end",
"def set_announcement\n @announcement = Announcement.find(params[:id])\n end",
"def set_announcement\n @announcement = Announcement.find(params[:id])\n end",
"def set_announcement\n @announcement = Announcement.find(params[:id])\n end",
"def set_announcement\n @announcement = Announcement.find(params[:id])\n end",
"def set_announcement\n @announcement = Announcement.find(params[:id])\n end",
"def update\n respond_to do |format|\n if @announcement_for.update(announcement_for_params)\n format.html { redirect_to @announcement_for, notice: 'Announcement for was successfully updated.' }\n format.json { render :show, status: :ok, location: @announcement_for }\n else\n format.html { render :edit }\n format.json { render json: @announcement_for.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @announcement.update(permitted_params)\n format.html { redirect_to @announcement, notice: 'Announcement was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @announcement.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @announcement.update(permitted_params.announcement)\n format.html { redirect_to @announcement, notice: 'Announcement was successfully updated.' }\n format.json { head :no_content }\n else\n flash.now[:error] = @announcement.errors.full_messages\n format.html { render action: 'edit' }\n format.json { render json: @announcement.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @announce_c = AnnounceC.find(params[:id])\n\n respond_to do |format|\n if @announce_c.update_attributes(params[:announce_c])\n format.html { redirect_to @announce_c, notice: 'Announce c was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @announce_c.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_announcement\n @announcement = Announcement.find_by(id: params[:id])\n end",
"def update\n @announcer = Announcer.find(params[:id])\n\n respond_to do |format|\n if @announcer.update_attributes(params[:announcer])\n format.html { redirect_to(@announcer, :notice => 'Announcer was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @announcer.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @announce = Announce.new(params[:announce])\n\n respond_to do |format|\n if @announce.save\n format.html { redirect_to @announce, notice: 'Announce was successfully created.' }\n format.json { render json: @announce, status: :created, location: @announce }\n else\n format.html { render action: \"new\" }\n format.json { render json: @announce.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @announce = Announce.new(params[:announce])\n\n respond_to do |format|\n if @announce.save\n format.html { redirect_to @announce, notice: 'Announce was successfully created.' }\n format.json { render json: @announce, status: :created, location: @announce }\n else\n format.html { render action: \"new\" }\n format.json { render json: @announce.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @announcement = Announcement.find(params[:id])\n @announcement.title = params[:title]\n @announcement.description = params[:description]\n @announcement.price = params[:price]\n @announcement.photo = params[:photo]\n @announcement.latitude = params[:latitude]\n @announcement.longitude = params[:longitude]\n @announcement.subcategory_id = params[:subcategory_id]\n @announcement.place = params[:place]\n @announcement.save\n render json:@announcement\n end",
"def set_announcement\n @announcement = Announcement.find(params[:id])\n end",
"def update\n if @announcement.update_attributes(params[:announcement])\n redirect_to admin_announcements_path, :notice => t('flash.admin.announcements.update')\n else\n render :action => \"edit\"\n end\n end",
"def edit\n @announcement = Announcement.find(params[:id])\n end",
"def update\n @announcement = Announcement.find(params[:id])\n if @announcement.update(announcement_params)\n redirect_to root_path\n else\n @announcement_errors = {}\n @announcement.errors.each do |attr, msg|\n @announcement_errors[attr] = msg\n end\n render 'edit'\n end\n end",
"def destroy\n @announcement = Announcement.find(params[:id])\n @announcement.destroy\n\n respond_to do |format|\n format.html { redirect_to(announcements_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @announcement = Announcement.find(params[:id])\n @announcement.destroy\n\n respond_to do |format|\n format.html { redirect_to(announcements_url) }\n format.xml { head :ok }\n end\n end",
"def save_announcement\n @announcement = Announcement.new announcement_params\n @announcement.save\n end",
"def edit\n @announcement = Announcement.find(params[:id])\n @title = 'Edit ' + @announcement.title\n end",
"def create\n @announcement = Announcement.new(params[:announcement])\n\n respond_to do |format|\n if @announcement.save\n flash[:notice] = 'Announcement was successfully created.'\n format.html { redirect_to announcements_path }\n format.xml { render :xml => @announcement, :status => :created, :location => @announcement }\n else\n format.html do\n flash[:notice] = 'Announcement was not Successfully created'\n render :action => \"new\" \n end\n format.xml { render :xml => @announcement.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def http_announce announcement\n announce announcement\n end",
"def show\n @announcement = Announcement.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @announcement }\n end\n end",
"def set_announcement_for\n @announcement_for = AnnouncementFor.find(params[:id])\n end",
"def destroy\n @announce = Announce.find(params[:id])\n @announce.destroy\n\n respond_to do |format|\n format.html { redirect_to announces_url }\n format.json { head :no_content }\n end\n end",
"def update\n @announcement = Announcement.find(params[:id])\n if @announcement.update(user_params)\n flash[:success] = \"Announcement Updated\"\n redirect_to root_path\n else\n flash[:danger] = \"Uh oh, No joy. \"\n render 'edit'\n end\n end",
"def create\n @announcement = Announcement.new(params[:announcement])\n\n respond_to do |format|\n if @announcement.save\n flash[:notice] = I18n.t(\"{{value}} was successfully created.\", :default => \"{{value}} was successfully created.\", :value => I18n.t(\"Announcement\", :default => \"Announcement\"))\n format.html { redirect_to announcements_path }\n format.xml { render :xml => @announcement, :status => :created, :location => @announcement }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @announcement.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def set_fdn_announcement\n @fdn_announcement = Fdn::Announcement.find(params[:id])\n end",
"def update\n respond_to do |format|\n if @history_announcement.update(history_announcement_params)\n format.html { redirect_to @history_announcement, notice: 'History announcement was successfully updated.' }\n format.json { render :show, status: :ok, location: @history_announcement }\n else\n format.html { render :edit }\n format.json { render json: @history_announcement.errors, status: :unprocessable_entity }\n end\n end\n end",
"def show\n @announcement = Announcement.find(params[:id])\n\n respond_to do |format|\n format.html # show.haml\n format.xml { render :xml => @announcement }\n end\n end",
"def create\n @announcement = Announcement.new(announcement_params)\n\n respond_to do |format|\n if @announcement.save\n format.html { render html: '200' }\n format.json { render 'announcements/announcement', status: :created, announcement: @announcement }\n else\n format.html { render html: '500', status: :unprocessable_entity }\n format.json { render json: @announcement.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @announcement = Announcement.new(params[:announcement])\n\n respond_to do |format|\n if @announcement.save\n format.html { redirect_to @announcement, notice: 'Announcement was successfully created.' }\n format.json { render json: @announcement, status: :created, location: @announcement }\n else\n format.html { render action: \"new\" }\n format.json { render json: @announcement.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @announcements = args[:announcements] if args.key?(:announcements)\n @next_page_token = args[:next_page_token] if args.key?(:next_page_token)\n end",
"def set_announcement\n @announcement ||= Announcement.find(params[:id])\n end",
"def create\n @announcement = Announcement.new(announcement_params)\n @announcement.user_id = current_user.id\n\n respond_to do |format|\n if @announcement.save\n format.html { redirect_to @announcement, notice: 'Announcement was successfully created.' }\n format.json { render :show, status: :created, location: @announcement }\n else\n format.html { render :new }\n format.json { render json: @announcement.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @classannounce.update(classannounce_params)\n format.html { redirect_to @classannounce, notice: 'Classannounce was successfully updated.' }\n format.json { render :show, status: :ok, location: @classannounce }\n else\n format.html { render :edit }\n format.json { render json: @classannounce.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n expire_one(params[:id])\n @article = Article.find(params[:id])\n\n respond_to do |format|\n if @article.update_attributes(params[:article])\n format.html { redirect_to([:admin, @article], :notice => 'Article was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @article.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update(id, name=\"Updated Name\", age=\"55\")\r\n xml_req =\r\n \"<?xml version='1.0' encoding='UTF-8'?>\r\n <person>\r\n <id type='integer'>#{id}</id>\r\n <name>#{name}</name>\r\n <age>#{age}</age> \r\n </person>\"\r\n request = Net::HTTP::Put.new(\"#{@url}/#{id}.xml\")\r\n request.add_field \"Content-Type\", \"application/xml\"\r\n request.body = xml_req\r\n http = Net::HTTP.new(@uri.host, @uri.port)\r\n response = http.request(request)\r\n # no response body will be returned\r\n case response\r\n when Net::HTTPSuccess\r\n return \"#{response.code} OK\"\r\n else\r\n return \"#{response.code} ERROR\"\r\n end\r\n end",
"def create\n @announcement = Announcement.new(announcement_params)\n @announcement.user = current_user\n respond_to do |format|\n if @announcement.save\n format.html { redirect_to @announcement, notice: 'Announcement was successfully created.' }\n format.json { render :show, status: :created, location: @announcement }\n else\n format.html { render :new }\n format.json { render json: @announcement.errors, status: :unprocessable_entity }\n end\n end\n end",
"def put(uri, xml)\r\n req = Net::HTTP::Put.new(uri)\r\n req[\"content-type\"] = \"application/xml\"\r\n req.body = xml\r\n request(req)\r\n end",
"def test_should_update_invite_via_API_XML\r\n get \"/logout\"\r\n put \"/invites/1.xml\", :invite => {:message => 'API Invite 1',\r\n :accepted => false,\r\n :email => 'test@email.com',\r\n :user_id => 1 }\r\n assert_response 401\r\n end",
"def create\n @announcement = Announcement.new\n @announcement.safe_update(%w[message only_anonymous], params[:announcement])\n\n @announcement.starts_at = build_datetime(params[:announcement], \"starts_at\")\n @announcement.ends_at = build_datetime(params[:announcement], \"ends_at\")\n\n @announcement.group = current_group\n\n respond_to do |format|\n if @announcement.save\n flash[:notice] = I18n.t(\"announcements.create.success\")\n format.html { redirect_to announcements_url }\n format.json { render :json => @announcement, :status => :created, :location => @announcement }\n else\n format.html { render :action => \"index\" }\n format.json { render :json => @announcement.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def destroy\n @announcement = Announcement.find(params[:id])\n @announcement.destroy\n\n respond_to do |format|\n format.html do\n flash[:notice] = 'Announcement has been successfully delected'\n redirect_to announcements_path \n end\n format.xml { head :ok }\n end\n end",
"def update\n @article ||= Article.find(params[:id])\n @article.user_id = current_user.id\n @title = t('label.article.creating')\n\n respond_to do |format|\n if @article.update_attributes(params[:article])\n flash[:notice] = 'Article was successfully updated.'\n format.html { redirect_to(article_path(:id=>@article.id)) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @article.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def test_should_update_link_via_API_XML\r\n get \"/logout\"\r\n put \"/links/1.xml\", :link => {:user_id => 1,\r\n :title => 'API Link 1',\r\n :url => 'http://www.api.com'}\r\n assert_response 401\r\n end",
"def test_put_expenses_1_xml\n @parameters = {:expense => {:description => 'NewDescription'}}\n if ActiveRecord::VERSION::MAJOR < 4\n Redmine::ApiTest::Base.should_allow_api_authentication(:put,\n '/expenses/1.xml',\n {:expense => {:description => 'NewDescription'}},\n {:success_code => :ok})\n end\n\n assert_no_difference('Expense.count') do\n put '/expenses/1.xml', @parameters, credentials('admin')\n end\n\n expense = Expense.find(1)\n assert_equal \"NewDescription\", expense.description\n end",
"def show\n @announcement = Announcement.visible.find(params[:id])\n \n @announcement.increase_views\n \n @title = @announcement.title\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @announcement }\n end\n end",
"def update\n @atom = Atom.find(params[:id])\n\n respond_to do |format|\n if @atom.update_attributes(params[:atom])\n flash[:notice] = 'Atom was successfully updated.'\n format.html { redirect_to(@atom) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @atom.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def destroy\n @announcement = Announcement.find(params[:id])\n @announcement.destroy\n respond_to do |format|\n format.html { render html: '200', status: :ok }\n format.json { head :no_content }\n end\n end",
"def create\n @announcement = Announcement.new(announcement_params)\n @announcement.owner = current_user\n\n respond_to do |format|\n if @announcement.save\n format.html { redirect_to user_announcement_path(current_user, @announcement), notice: 'Announcement was successfully created.' }\n format.json { render :show, status: :created, location: user_announcement_path(current_user, @announcement) }\n else\n flash[:error] = 'Please provide correction values.'\n format.html { render :new }\n format.json { render json: @announcement.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @discussion = Discussion.find(params[:id])\n if @discussion.update_attributes(params[:discussion])\n head :ok\n else\n render :xml => @discussion.errors.to_xml\n end\n end",
"def create\n @announcement = Announcement.new(params[:announcement])\n if @announcement.save\n redirect_to admin_announcements_path, :notice => t('flash.admin.announcements.create')\n else\n render :action => \"new\"\n end\n end",
"def destroy\n @announcement = Announcement.find(params[:id])\n @announcement.destroy\n\n respond_to do |format|\n format.html { redirect_to announcements_url }\n format.json { head :ok }\n end\n end",
"def index\n @announcements = Announcement.all\n end",
"def index\n @announcements = Announcement.all\n end",
"def new\n @announcement = Announcement.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @announcement }\n end\n end",
"def new\n @announcement = Announcement.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @announcement }\n end\n end",
"def update!(**args)\n @advertised_id = args[:advertised_id] if args.key?(:advertised_id)\n @beacon_name = args[:beacon_name] if args.key?(:beacon_name)\n @attachments = args[:attachments] if args.key?(:attachments)\n end",
"def destroy\n @announcement = Announcement.find(params[:id])\n @announcement.destroy\n\n redirect_to root_path\n end",
"def update\n @announcement = Announcement.find(params[:id])\n @announcement.assign_attributes(params[:announcement])\n @json = @announcement.to_gmaps4rails\n @billboard = @announcement.billboard\n setdatetime @announcement\n @announcement.gmaps = true\n if(@announcement.user == current_user)\n respond_to do |format|\n if @announcement.save\n format.html { redirect_to @announcement, notice: 'Aktivität wurde erfolgreich geändert.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @announcement.errors, status: :unprocessable_entity }\n end\n end\n end\n end",
"def index\n @announcements = Announcement.all\n\n respond_to do |format|\n format.html { render html: '200' }\n format.json { render 'announcements/index', announcements: @announcements, status: :ok }\n end\n end",
"def update\n @article = Article.find(params[:id])\n\n respond_to do |format|\n if @article.update_attributes(params[:article])\n flash[:notice] = 'Article was successfully updated.'\n format.html { redirect_to(@article) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @article.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @announcement = Announcement.new(permitted_params)\n\n respond_to do |format|\n if @announcement.save\n format.html { redirect_to announcements_path, notice: 'Announcement was successfully created.' }\n format.json { render action: 'show', status: :created, location: @announcement }\n else\n format.html { render action: 'new' }\n format.json { render json: @announcement.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @draft_investment = DraftInvestment.find(params[:id])\n\n respond_to do |format|\n if @draft_investment.update_attributes(params[:investment])\n\n format.xml \n else\n\n format.xml { render :xml => @draft_investment.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 index\n @announcements = Announcement.all\n end",
"def set_classannounce\n @classannounce = Classannounce.find(params[:id])\n end",
"def update\n @article = Article.get(params[:id])\n\n respond_to do |format|\n if @article.update(params[:article])\n flash[:notice] = 'Article was successfully updated.'\n format.html { redirect_to(@article) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @article.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def destroy\n @announcement = Announcement.find(params[:id])\n @announcement.destroy\n\n head :no_content\n end",
"def update\n @article = Article.find(params[:id])\n \n respond_to do |format|\n if @article.update_attributes(params[:article])\n format.html { redirect_to article_url(@article) }\n format.xml { render :nothing => true }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @article.errors.to_xml } \n end\n end\n end",
"def UpdateArticle id,params = {}\n \n APICall(path: \"help_center/articles/#{id}.json\",method: 'PUT',payload: params.to_json)\n \n end",
"def destroy\n @fundamental_announcement = Fundamental::Announcement.find(params[:id])\n @fundamental_announcement.destroy\n\n respond_to do |format|\n format.html { redirect_to fundamental_announcements_url }\n format.json { head :ok }\n end\n end"
] |
[
"0.70501745",
"0.70501745",
"0.6947444",
"0.68963695",
"0.6712588",
"0.66069967",
"0.6593863",
"0.6541586",
"0.6496441",
"0.64277583",
"0.64277583",
"0.64277583",
"0.64277583",
"0.64251",
"0.64005053",
"0.64005053",
"0.64005053",
"0.64005053",
"0.64005053",
"0.63305634",
"0.62921894",
"0.62798786",
"0.62798786",
"0.62798786",
"0.62798786",
"0.62798786",
"0.62798786",
"0.62798786",
"0.62798786",
"0.62798786",
"0.62798786",
"0.6276859",
"0.6246125",
"0.62017506",
"0.6181979",
"0.61708575",
"0.61281055",
"0.6115086",
"0.6115086",
"0.6069708",
"0.60615474",
"0.6056661",
"0.59396106",
"0.5898954",
"0.5889021",
"0.5889021",
"0.5881383",
"0.58566713",
"0.5856441",
"0.5813735",
"0.5780226",
"0.5776861",
"0.5769295",
"0.5766099",
"0.57549745",
"0.57407546",
"0.57351595",
"0.57260686",
"0.571132",
"0.5689137",
"0.5685656",
"0.5684985",
"0.56734955",
"0.5672821",
"0.56622785",
"0.5637004",
"0.5629338",
"0.56058574",
"0.56044585",
"0.5596764",
"0.55947506",
"0.5568104",
"0.5568037",
"0.55496407",
"0.55464417",
"0.5540613",
"0.5533931",
"0.5533845",
"0.5530228",
"0.5520509",
"0.5516666",
"0.55024505",
"0.55024505",
"0.5491986",
"0.5491986",
"0.54906523",
"0.54871744",
"0.5486282",
"0.5486012",
"0.54819965",
"0.5476721",
"0.54721",
"0.5470098",
"0.54504234",
"0.5450357",
"0.5450312",
"0.5450281",
"0.54366446",
"0.5433668",
"0.5428916"
] |
0.67390853
|
4
|
DELETE /announcements/1 DELETE /announcements/1.xml
|
def destroy
@announcement = Announcement.find(params[:id])
@announcement.destroy
respond_to do |format|
format.html do
flash[:notice] = 'Announcement has been successfully delected'
redirect_to announcements_path
end
format.xml { head :ok }
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def destroy\n @announcement = Announcement.find(params[:id])\n @announcement.destroy\n\n respond_to do |format|\n format.html { redirect_to(announcements_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @announcement = Announcement.find(params[:id])\n @announcement.destroy\n\n respond_to do |format|\n format.html { redirect_to(announcements_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @announcement = Announcement.find(params[:id])\n @announcement.destroy\n\n head :no_content\n end",
"def destroy\n @announce = Announce.find(params[:id])\n @announce.destroy\n #AnnounceMailer.delete_mail(@announce).deliver\n\n respond_to do |format|\n format.html { redirect_to announces_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @announce = Announce.find(params[:id])\n @announce.destroy\n\n respond_to do |format|\n format.html { redirect_to announces_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @announcement = Announcement.find(params[:id])\n @announcement.destroy\n respond_to do |format|\n format.html { render html: '200', status: :ok }\n format.json { head :no_content }\n end\n end",
"def destroy\n @announcement = Announcement.find(params[:id])\n @announcement.destroy\n\n redirect_to root_path\n end",
"def destroy\n @announcement = Announcement.find(params[:id])\n @announcement.destroy\n\n respond_to do |format|\n format.html { redirect_to announcements_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @announcement = current_group.announcements.find(params[:id])\n @announcement.destroy\n\n respond_to do |format|\n format.html { redirect_to(announcements_url) }\n format.json { head :ok }\n end\n end",
"def destroy\n @announcement.destroy\n respond_to do |format|\n format.html { redirect_to announcements_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @announcement.destroy\n respond_to do |format|\n format.html { redirect_to announcements_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @announcement.destroy\n respond_to do |format|\n format.html { redirect_to announcements_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @fundamental_announcement = Fundamental::Announcement.find(params[:id])\n @fundamental_announcement.destroy\n\n respond_to do |format|\n format.html { redirect_to fundamental_announcements_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @announce_c = AnnounceC.find(params[:id])\n @announce_c.destroy\n\n respond_to do |format|\n format.html { redirect_to announce_cs_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @announcement.destroy\n respond_to do |format|\n format.html { redirect_to :delete, flash: { message: 'Announcement was successfully deleted.' } }\n format.json { head :no_content }\n end\n end",
"def destroy\n @announcement.destroy\n respond_to do |format|\n format.html { redirect_to announcements_url, notice: 'Anuncio fue eliminado.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @announcement.destroy\n respond_to do |format|\n format.html { redirect_to announcements_url, notice: 'Announcement was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @announcement.destroy\n respond_to do |format|\n format.html { redirect_to announcements_url, notice: 'Announcement was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @announcement.destroy\n respond_to do |format|\n format.html { redirect_to announcements_url, notice: 'Announcement was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @announcement = Announcement.find(params[:id])\n @announcement.destroy\n render json:@announcement\n\n end",
"def destroy\n @announcement_for.destroy\n respond_to do |format|\n format.html { redirect_to announcement_fors_url, notice: 'Announcement for was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @announcement.destroy\n respond_to do |format|\n format.html { redirect_to :back, notice: 'El anuncio se borro correctamente.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @announcer = Announcer.find(params[:id])\n @announcer.destroy\n\n respond_to do |format|\n format.html { redirect_to(announcers_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n RestClient.delete \"#{REST_API_URI}/contents/#{id}.xml\" \n self\n end",
"def destroy\n if(@announcement.user == current_user)\n @announcement = Announcement.find(params[:id])\n @announcement.destroy\n\n respond_to do |format|\n format.html { redirect_to Announcements_url }\n format.json { head :no_content }\n end\n end\n end",
"def destroy\n @absence_request = AbsenceRequest.find(params[:id])\n @absence_request.destroy\n\n respond_to do |format|\n format.html { redirect_to(absence_requests_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n client = Connection::MarkLogic.new.client\n client.send_corona_request(\"/v1/documents?uri=/amandments/amandment_#{@amandment.id}.xml\", :delete)\n @amandment.destroy\n respond_to do |format|\n format.html { redirect_to home_meeting_path, notice: 'Amandman was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @adjunto = Adjunto.find(params[:id])\n @adjunto.destroy\n\n respond_to do |format|\n format.html { redirect_to(adjuntos_url) }\n format.xml { head :ok }\n end\n end",
"def delete()\n response = send_post_request(@xml_api_delete_path)\n response.is_a?(Net::HTTPSuccess) or response.is_a?(Net::HTTPRedirection)\n end",
"def destroy\n @discovery = Discovery.find(params[:id])\n @discovery.destroy\n\n respond_to do |format|\n format.html { redirect_to(discoveries_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @evactivity = Evactivity.find(params[:id])\n @evactivity.destroy\n\n respond_to do |format|\n format.html { redirect_to(evactivities_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @news_update = NewsUpdate.find(params[:id])\n @news_update.destroy\n\n respond_to do |format|\n format.html { redirect_to(news_updates_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n #@activity = Activity.find(params[:id])\n @activity = Activity.find_by_permalink(params[:id])\n @activity.destroy\n\n respond_to do |format|\n format.html { redirect_to(activities_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @attend = Attend.find(params[:id])\n @attend.destroy\n\n respond_to do |format|\n format.html { redirect_to(attends_url) }\n format.xml { head :ok }\n end\n end",
"def delete\n client.delete(\"/#{id}\")\n end",
"def destroy\n @advertise = Advertise.find(params[:id])\n @advertise.destroy\n\n respond_to do |format|\n format.html { redirect_to(advertises_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @deadline = Deadline.find(params[:id])\n @deadline.destroy\n respond_to do |format|\n format.html { redirect_to(deadlines_url) }\n format.xml { head :ok }\n end\n end",
"def delete()\n response = send_post_request(@xml_api_delete_path)\n response.is_a?(Net::HTTPSuccess) or response.is_a?(Net::HTTPRedirection)\n end",
"def destroy\n @docent = Docent.find(params[:id])\n @docent.destroy\n\n respond_to do |format|\n format.html { redirect_to(docents_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @news_blast = NewsBlast.find(params[:id])\n @news_blast.destroy\n\n respond_to do |format|\n format.html { redirect_to(news_blasts_url) }\n format.xml { head :ok }\n end\n end",
"def delete(id)\n\t\t\tkparams = {}\n\t\t\tclient.add_param(kparams, 'id', id)\n\t\t\tclient.queue_service_action_call('announcement', 'delete', 'bool', 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 destroy\n @advert = Advert.find(params[:id])\n @advert.destroy\n\n respond_to do |format|\n format.html { redirect_to(admin_adverts_url, :notice => 'Advert was deleted') }\n format.xml { head :ok }\n end\n end",
"def destroy\n @advert = Advert.find(params[:id])\n @advert.destroy\n\n respond_to do |format|\n format.html { redirect_to(adverts_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @lease = Lease.find(params[:id])\n @lease.destroy\n\n respond_to do |format|\n format.html { redirect_to(leases_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @article = Article.find_by_sysname(params[:id])\n @article.destroy\n\n respond_to do |format|\n format.html { redirect_to(articles_url) }\n format.xml { head :ok }\n end\n end",
"def destroy1\n @todo = Todo.find(params[:id])\n @todo.destroy\n\n respond_to do |format|\n format.html { redirect_to(todos_url) }\n format.xml { head :ok }\n end\n end",
"def destroy \n Link.connection.execute(\"delete from links where id in (#{params[:id].join(',')})\") unless params[:id].blank?\n respond_to do |format|\n format.html { redirect_to(links_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @article = Article.find(params[:id])\n @article.destroy\n\n respond_to do |format|\n format.html { redirect_to(articles_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @article = Article.find(params[:id])\n @article.destroy\n\n respond_to do |format|\n format.html { redirect_to(articles_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @article = Article.find(params[:id])\n @article.destroy\n\n respond_to do |format|\n format.html { redirect_to(articles_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @article = Article.find(params[:id])\n @article.destroy\n\n respond_to do |format|\n format.html { redirect_to(articles_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @article = Article.find(params[:id])\n @article.destroy\n\n respond_to do |format|\n format.html { redirect_to(articles_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @history_announcement.destroy\n respond_to do |format|\n format.html { redirect_to history_announcements_url, notice: 'History announcement was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete_aos_version(args = {}) \n delete(\"/aosversions.json/#{args[:aosVersionId]}\", args)\nend",
"def destroy\n @today_activity = TodayActivity.find(params[:id])\n @today_activity.destroy\n\n respond_to do |format|\n format.html { redirect_to(today_activities_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @config_xml = ConfigXml.find(params[:id])\n @config_xml.destroy\n\n respond_to do |format|\n format.html { redirect_to(config_xmls_url) }\n format.xml { head :ok }\n end\n rescue ActiveRecord::RecordNotFound => e\n prevent_access(e)\n end",
"def destroy\n @news_link = NewsLink.find(params[:id])\n @news_link.destroy\n\n respond_to do |format|\n format.html { redirect_to(news_links_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @attachment = Attachment.find(params[:id])\n @attachment.destroy\n\n respond_to do |format|\n format.html { redirect_to(attachments_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @attachment = Attachment.find(params[:id])\n @attachment.destroy\n\n respond_to do |format|\n format.html { redirect_to(attachments_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @news_article = NewsArticle.find(params[:id])\n @news_article.destroy\n \n respond_to do |format|\n format.html { redirect_to(news_articles_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @journalentry = Journalentry.find(params[:id])\n @journalentry.destroy\n\n respond_to do |format|\n format.html { redirect_to(journalentries_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @journal_entry = JournalEntry.find(params[:id])\n @journal_entry.destroy\n\n respond_to do |format|\n format.html { redirect_to(journal_entries_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @article ||= Article.find(params[:id])\n @article.destroy\n\n respond_to do |format|\n format.html { redirect_to(articles_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @member.destroy\n respond_to do |format|\n format.html { redirect_to attends_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @atest = Atest.find(params[:id])\n @atest.destroy\n\n respond_to do |format|\n format.html { redirect_to(atests_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @advertisement = Advertisement.find(params[:id])\n #if File.exists?(\"#{Rails.root}/#{@advertisement.filename}\")\n #File.delete(\"#{@advertisement.filename}\")\n #end\n @advertisement.destroy\n\n respond_to do |format|\n format.html { redirect_to advertisements_url }\n format.json { head :no_content }\n end\n end",
"def delete_data(index_name)\n uri = @client.make_uri(\"/#{index_name}/update/\")\n req = HTTP::Post.new(uri)\n req.content_type = 'text/xml'\n req.body = '<delete><query>*:*</query></delete>'\n response = @client.send_http(req, true, ['200'])\n end",
"def destroy\n @artifact_note = ArtifactNote.find(params[:id])\n @artifact_note.destroy\n\n respond_to do |format|\n format.html { redirect_to(artifact_notes_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @article = Article.find(params[:id])\n @article.destroy\n\n respond_to do |format|\n format.html { redirect_to(admin_articles_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @article = Article.find(params[:id])\n @article.destroy\n\n respond_to do |format|\n format.html { redirect_to(admin_articles_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @attendance = Attendance.find(params[:id])\n @attendance.destroy\n\n respond_to do |format|\n format.html { redirect_to(attendances_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @aisle = Aisle.find(params[:id])\n @aisle.destroy\n\n respond_to do |format|\n format.html { redirect_to(aisles_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @monkey = Monkey.find(params[:id])\n @monkey.destroy\n\n respond_to do |format|\n format.html { redirect_to(monkeys_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @draft_investment = DraftInvestment.find(params[:id])\n @draft_investment.destroy\n\n respond_to do |format|\n\n format.xml { head :ok }\n end\n end",
"def destroy\n @discussion_post = DiscussionPost.find(params[:id])\n @discussion_post.destroy\n\n respond_to do |format|\n format.html { redirect_to(discussion_posts_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @changelog = Changelog.find(params[:id])\n @changelog.destroy\n\n respond_to do |format|\n format.html { redirect_to(changelogs_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @detour = Detour.find(params[:id])\n @detour.notifications.each do |n|\n logger.info(\"Deleteing notification \" + n.id.to_s + \" for detour \" + @detour.id.to_s + \"\\n\")\n n.destroy\n end\n @detour.destroy\n\n respond_to do |format|\n format.html { redirect_to(detours_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @activity = Activity.find(params[:id])\n @activity.destroy\n\n respond_to do |format|\n format.html { redirect_to(activities_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @activity = Activity.find(params[:id])\n @activity.destroy\n\n respond_to do |format|\n format.html { redirect_to(activities_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @activity = Activity.find(params[:id])\n @activity.destroy\n\n respond_to do |format|\n format.html { redirect_to(activities_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @activity = Activity.find(params[:id])\n @activity.destroy\n\n respond_to do |format|\n format.html { redirect_to(activities_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @correspondence = Correspondence.find(params[:id])\n @correspondence.destroy\n\n respond_to do |format|\n format.html { redirect_to(correspondences_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @attender = Attender.find(params[:id])\n @attender.destroy\n\n respond_to do |format|\n format.html { redirect_to(attenders_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @analisis = Analisis.find(params[:id])\n @analisis.destroy\n\n respond_to do |format|\n format.html { redirect_to(analisis_index_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @news = News.find(params[:id])\n @news.destroy\n\n respond_to do |format|\n format.html { redirect_to(admin_news_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @activity = Activity.find(params[:id])\n @activity.destroy\n respond_to do |format|\n format.html { redirect_to([:manage, activities_url]) }\n format.xml { head :ok }\n end\n end",
"def destroy\n official = Official.find(params[:id])\n official.destroy\n head 204\n end",
"def static_delete(nodeId)\n\n raise \"NodeId must not be nil\" if nodeId.nil?\n\n @discovery_urls.each do |discovery_url|\n\n delete_uri = URI.parse(discovery_url).merge(\"/v1/announcement/static/#{nodeId}\")\n\n @logger.debug(\"Delete Request: #{delete_uri.to_s}\")\n\n begin\n response = @client.delete(delete_uri.to_s)\n if response.status >= 200 && response.status <= 299\n return\n end\n\n @logger.error(\"#{delete_uri.to_s}: Response Status #{response.status}\")\n @logger.error(response.body)\n\n rescue\n @logger.error(\"#{delete_uri.to_s}: #{$!}\")\n end\n\n end\n\n raise \"Failed to delete static announcement #{nodeId} on any of [ #{@discovery_urls.join(\",\")} ]\"\n\n end",
"def destroy\n @abonne = Abonne.find(params[:id])\n @abonne.destroy\n\n respond_to do |format|\n format.html { redirect_to(abonnes_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @add_on = AddOn.find(params[:id])\n @add_on.destroy\n\n respond_to do |format|\n format.html { redirect_to(add_ons_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @click_to_talk = ClickToTalk.find(params[:id])\n @click_to_talk.destroy\n\n respond_to do |format|\n format.html { redirect_to(click_to_talks_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @noun = Noun.find(params[:id])\n @noun.destroy\n\n respond_to do |format|\n format.html { redirect_to(nouns_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @annex = Annex.find(params[:id])\n @annex.destroy\n\n respond_to do |format|\n format.html { redirect_to annexes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @passage = Passage.find(params[:id])\n @passage.destroy\n\n respond_to do |format|\n format.html { redirect_to(passages_url) }\n format.xml { head :ok }\n end\n end",
"def delete\n request(:delete)\n end",
"def delete(id)\n request = Net::HTTP::Delete.new(\"#{@url}/#{id}.xml\")\n http = Net::HTTP.new(@uri.host, @uri.port)\n response = http.request(request)\n\n # no response body will be returned\n case response\n when Net::HTTPSuccess\n return \"#{response.code} OK\"\n else\n return \"#{response.code} ERROR\"\n end\n end",
"def destroy\n @note = Note.find(params[:id])\n \n @note.destroy\n\n respond_to do |format|\n format.html { head :ok }\n format.xml { head :ok }\n end\n end",
"def destroy\n @classannounce.destroy\n respond_to do |format|\n format.html { redirect_to classannounces_url, notice: 'Classannounce was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @news = News.find(params[:id])\n @news.destroy\n\n respond_to do |format|\n format.html { redirect_to(news_item_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @news = News.find(params[:id])\n @news.destroy\n\n respond_to do |format|\n format.html { redirect_to(news_index_url) }\n format.xml { head :ok }\n end\n end"
] |
[
"0.76277906",
"0.76277906",
"0.72927845",
"0.7263305",
"0.72017324",
"0.7185462",
"0.7109124",
"0.70955485",
"0.7067623",
"0.69841677",
"0.69841677",
"0.69841677",
"0.69730854",
"0.69530404",
"0.69160426",
"0.6912065",
"0.6796883",
"0.6796883",
"0.6796883",
"0.6738845",
"0.6693531",
"0.66631013",
"0.66270363",
"0.66229266",
"0.6601528",
"0.6539073",
"0.6470661",
"0.6459304",
"0.64579576",
"0.6403845",
"0.6393422",
"0.63886994",
"0.6358157",
"0.63522786",
"0.634156",
"0.63388723",
"0.6330538",
"0.63304716",
"0.6317395",
"0.6296642",
"0.62945664",
"0.6286524",
"0.62760746",
"0.6268903",
"0.6225869",
"0.6219994",
"0.621753",
"0.62144434",
"0.62144434",
"0.62144434",
"0.62144434",
"0.62144434",
"0.62139285",
"0.62073433",
"0.619489",
"0.61931777",
"0.61925244",
"0.6188712",
"0.6188712",
"0.61873657",
"0.61834383",
"0.61794484",
"0.6178388",
"0.6178125",
"0.61779994",
"0.6176796",
"0.6172227",
"0.6169721",
"0.61643195",
"0.61643195",
"0.61638993",
"0.6162663",
"0.61619085",
"0.61571974",
"0.6154249",
"0.6153585",
"0.6153524",
"0.6153357",
"0.6153357",
"0.6153357",
"0.6153357",
"0.6152495",
"0.61473924",
"0.6143551",
"0.6139692",
"0.6139417",
"0.61386627",
"0.6130458",
"0.613025",
"0.6121082",
"0.61188215",
"0.6116374",
"0.6116066",
"0.61152524",
"0.6107897",
"0.61062324",
"0.6104145",
"0.6103421",
"0.60963833",
"0.6092379"
] |
0.73915064
|
2
|
Passes in data from scraper when recipe is created
|
def initialize(recipe_hash)
recipe_hash.each do |attribute, value|
self.send(("#{attribute}="), value)
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def add_attributes_to_recipes\n EasyVegan::Recipe.all.each do |recipe|\n recipe.add_recipe_attributes(EasyVegan::Scraper.scrape_recipe_page(recipe.url))\n #binding.pry\n end\n end",
"def scrap_recipe\n recipe = RecipeScraper::Recipe.new @marmiton_url\n # convert recipe object to hash and merge\n @recipe_hash.merge!(recipe.to_hash)\n # rename keys\n @recipe_hash[:servings] = @recipe_hash.delete :nb_of_persons\n @recipe_hash[:prep_time] = @recipe_hash.delete :preptime\n @recipe_hash[:cook_time] = @recipe_hash.delete :cooktime\n @recipe_hash[:image_url] = @recipe_hash.delete :image\n @recipe_hash[:ingredients_list] = @recipe_hash.delete :ingredients\n @recipe_hash[:marmiton_url] = @marmiton_url\n # format strings\n @recipe_hash[:ingredients_list].each { |ingredient| ingredient.gsub!(/\\d+/, ' \\0 ') }\n @recipe_hash[:title].delete!(\"\\n\").strip!\n end",
"def create\n name = @view.ask_user_for_info(\"name\")\n description = @view.ask_user_for_info(\"description\")\n prep_time = @view.ask_user_for_attribute(\"prep_time\")\n difficulty = @view.ask_user_for_attribute(\"difficulty\")\n recipe = Recipe.new(name: name, description: description, prep_time: prep_time, difficulty: difficulty)\n @cookbook.add_recipe(recipe)\n end",
"def run\n url = p params[:my_url]\n if url.include? \"damndelicious.net\"\n doc = Nokogiri::HTML(open(url))\n recipe = Recipe.create do |recipe|\n #TODO: I see a lot of recipe manipulation. Could you extract lines 15 to 19 and similar codebase below into a function? That would make this a lot smaller and easier to read.\n recipe.user_id = current_user.id\n recipe.title = doc.at_css(\"h1\").text\n recipe.description = doc.at_css(\"em\").text\n recipe.url = url\n recipe.image_url = doc.at('//img[@class=\"photo nopin pib-hover-img\"]/@src').to_s\n # recipe end\n end\n doc.css(\".ingredient\").each do |classes|\n Ingredient.create!(name: classes.text, recipe_id: Recipe.last.id)\n # instruction end\n end\n doc.css(\".instructions li\").each do |classes|\n Direction.create!(step: classes.text, recipe_id: Recipe.last.id)\n # direction end\n end\n redirect_to recipe, notice: \"Scraped Recipe, please check to verify everything looks correct\"\n elsif url.include? \"thepioneerwoman.com\"\n doc = Nokogiri::HTML(open(url))\n recipe = Recipe.create do |recipe|\n recipe.user_id = current_user.id\n recipe.title = doc.at_css(\".recipe-title\").text\n # recipe.description = doc.at_css(\".col-xs-7 p\").text\n recipe.image_url = doc.at('//img[@class=\"alignnone size-full wp-image-91195\"]/@src').to_s\n recipe.url = url\n # recipe end\n end\n doc.css(\".list-ingredients li\").each do |classes|\n Ingredient.create!(name: classes.text, recipe_id: Recipe.last.id)\n # instruction end\n end\n doc.css(\".panel+ .panel .panel-body\").each do |classes|\n Direction.create!(step: classes.text, recipe_id: Recipe.last.id)\n # direction end\n end\n redirect_to recipe, notice: \"Scraped Recipe, please check to verify everything looks correct\"\n elsif url.include? \"allrecipes.com\"\n doc = Nokogiri::HTML(open(url))\n recipe = Recipe.create do |recipe|\n recipe.user_id = current_user.id\n recipe.title = doc.at_css(\".recipe-summary__h1\").text\n recipe.description = doc.at_css(\".submitter__description\").text\n recipe.url = url\n recipe.image_url = doc.at('//img[@class=\"rec-photo\"]/@src').to_s\n\n # recipe end\n end\n doc.css(\".added\").each do |classes|\n Ingredient.create!(name: classes.text, recipe_id: Recipe.last.id)\n # instruction end\n end\n doc.css(\".step\").each do |classes|\n Direction.create!(step: classes.text, recipe_id: Recipe.last.id)\n # direction end\n end\n redirect_to recipe, notice: \"Scraped Recipe, please check to verify everything looks correct\"\n else\n redirect_to new_recipe_url, alert: \"the domain your trying to access is not yet supported\"\n # if statement end\n end\n # Def run end\n end",
"def createRecipeFromAPI(randRecipe)\n # make a recipe obj to create for our DB\n recipe = Recipe.create(title: randRecipe[\"title\"], cookbook: Cookbook.all.sample, instructions: randRecipe[\"instructions\"])\n photo = Photo.create(recipe: recipe, img_url: randRecipe[\"image\"], description: \"test photo\")\n ingredients = randRecipe[\"extendedIngredients\"].map do |ing| \n ingredient = Ingredient.find_or_create_by(name: ing[\"name\"].titlecase)\n ri = RecipeIngredient.create(recipe: recipe, ingredient: ingredient, quantity: \"#{ing[\"amount\"]} #{ing[\"unit\"]}\")\n end\nend",
"def scrape(url)\n recipe = RecipeScraper::Recipe.new url\n @scraped_urls << url\n @recipes << recipe\n if save recipe\n return recipe\n else\n raise SQLite3::Exception, 'cannot save recipe'\n end\n rescue OpenURI::HTTPError\n nil\n end",
"def create\n recipe_name = @view.ask_name\n recipe_description = @view.ask_description\n recipe = Recipe.new(recipe_name, recipe_description)\n @cookbook.add_recipe(recipe)\n @view.listing\n end",
"def setup_recipe url\n # In practice, grammar mods will get bound to the site\n # The selector will get associated with the recipe's site (as a 'Content' finder)\n # The trimmers will kept on the site as well, to remove extraneous elements\n # The grammar_mods will get applied to the parser's grammar for site-specific modification\n @recipe = load_recipe url, @selector, @trimmers, @grammar_mods\n @page_ref = @recipe.page_ref\n @recipe_page = @page_ref.recipe_page\nend",
"def load_recipes(recipes)\n # loads a placeholder recipe hash in event of empty recipes value hash\n if recipes[\"recipes\"].empty? \n placeholder_recipe = {\"Placeholder\"=>[{\"flour\"=>0.5}]}\n RecipeBook.new(placeholder_recipe)\n else\n recipes[\"recipes\"].each do | recipe_name,recipe_ingredients |\n recipe = {\"#{recipe_name}\" => recipe_ingredients}\n recipe_name = RecipeBook.new(recipe)\n end\n end\nend",
"def findings= findings\n self.title = findings.result_for('Title') if findings.result_for('Title').present?\n self.description = findings.result_for('Description') if findings.result_for('Description').present? && description.blank?\n ts = nil # TaggingService object\n if self.is_a? Recipe\n self.content = findings.result_for('Content') if findings.result_for('Content').present?\n self.prep_time = findings.result_for('Prep Time') if findings.result_for('Prep Time').present?\n self.cook_time = findings.result_for('Cooking Time') if findings.result_for('Cooking Time').present?\n if findings.result_for('Total Time').present?\n tt = Tag.assert (self.total_time = findings.result_for('Total Time')), :Time\n tt && ((ts ||= TaggingServices.new object).tag_with tt, User.super_id)\n end\n self.yield = findings.result_for('Yield') if findings.result_for('Yield').present?\n end\n if findings.result_for('Image').present? && self.image.blank?\n self.image = findings.result_for('Image')\n image_changed = image.present?\n end\n # save if id.nil? || changed? || image_changed # No other extractions need apply until saved\n ts = nil\n {\n 'Author' => 'Author',\n 'Course' => 'Course',\n 'Occasion' => 'Occasion',\n 'Dish' => 'Dish',\n 'Tag' => nil,\n 'Diet' => 'Diet',\n 'Genre' => 'Genre',\n 'List' => 'List',\n 'Ingredient' => 'Ingredient'\n }.each { |label, type|\n if tagstrings =\n if tagstring = findings.result_for(label)\n [ tagstring ]\n elsif tagstring = findings.result_for(label.pluralize)\n tagstring.split(',').map(&:strip)\n end\n ts ||= TaggingServices.new object\n tagstrings.each { |tagname|\n ts.tag_with tagname, User.super_id, {type: type}.compact\n }\n end\n }\n=begin\n if author = findings.result_for('Author')\n ts ||= TaggingServices.new object\n ts.tag_with author, User.super_id, type: 'Author'\n end\n if course = findings.result_for('Course')\n ts ||= TaggingServices.new object\n ts.tag_with course, User.super_id, type: 'Course'\n end\n if occasion = findings.result_for('Occasion')\n ts ||= TaggingServices.new object\n ts.tag_with occasion, User.super_id, type: 'Occasion'\n end\n if tagstring = findings.result_for('Tags')\n ts ||= TaggingServices.new object\n tagstring.split(',').map(&:strip).each { |tagname| ts.tag_with tagname, User.super_id }\n end\n if tagstring = findings.result_for('Diet')\n ts ||= TaggingServices.new object\n tagstring.split(',').map(&:strip).each { |tagname| ts.tag_with tagname, User.super_id, type: Tag.typenum(:Diet) }\n end\n if tagstring = findings.result_for('Ingredients')\n ts ||= TaggingServices.new object\n tagstring.split(',').map(&:strip).each { |tagname| ts.tag_with tagname, User.super_id, type: 'Ingredient' }\n end\n=end\n end",
"def create\n @recipe = Recipe.new(recipe_params)\n\n \n end",
"def setup_recipe(servings = nil)\n @prepsteps_list = []\n unless prepsteps.nil?\n @prepsteps_list = Skill.add_skill_links(prepsteps).split(\"\\n\").map {|line| line.chomp}\n end\n \n @cooksteps_list = []\n unless cooksteps.nil?\n @cooksteps_list = Skill.add_skill_links(cooksteps).split(\"\\n\").map {|line| line.chomp}\n end\n \n @new_servings = servings\n end",
"def to_recipe(external_recipe)\n return nil if external_recipe.blank?\n\n recipe = Recipe.new\n\n recipe.id = external_recipe.id\n recipe.title = external_recipe.title\n recipe.description = external_recipe.description\n # handling links through raw response, as they might not exist in all entries\n raw_fields = external_recipe.raw_with_links['fields']\n recipe.tags = raw_fields['tags']&.map(&:name)&.join('. ')\n recipe.chef_name = raw_fields['chef']&.name\n recipe.image = raw_fields['photo']&.url\n\n recipe\n end",
"def scrape_recipe(ingredient)\n @recipes_array = []\n @ingredient = ingredient\n url = \"https://www.allrecipes.com/search/results/?search=#{@ingredient}\"\n html_file = URI.open(url).read\n html_doc = Nokogiri::HTML(html_file)\n html_doc.search('.card__detailsContainer').each do |element|\n title = element.search('.card__title').first.text.strip\n description = element.search('.card__summary').first.text.strip\n rating = element.search('.review-star-text').text.strip.slice(/(\\d.?\\d*)/)\n url = element.search('.card__titleLink').first.attribute('href').value\n\n @recipes_array << {\n title: title,\n description: description,\n rating: rating,\n url: url\n }\n end\n @recipes_array\n end",
"def scrap(ingredient)\n scraper = ScraperMarmiton.new(ingredient)\n scraper.doc.search('m.search').each do |element|\n name = element.search('.m_search_titre_recette > a').inner_text\n rating = element.search('etoile1').size\n prep_time = 10 #element.search('m_search_result_part4').inner_text.match(/\\d+/)[1]\n cooking_time = 10 #\n create(name, rating, preparation_time, cooking_time)\n end\n end",
"def create\n \tset_tag_list\n\n @recipe = @current_user.recipes.build(params[:recipe])\n @recipe.status = @recipe.get_status\n item_client_ip(@recipe)\n # @recipe.is_draft = params[:is_draft]\n # @recipe.is_draft = @recipe.get_is_draft\n # @recipe.published_at = @recipe.get_published_at\n \n ActiveRecord::Base.transaction do \n\t\t\tif @recipe.save\n\t\t\t\t# @recipe.tag_list = params[:tags].strip if params[:tags] && !params[:tags].strip.blank?\n\t\t\t\treg_homepage(@recipe)\n\t\t\t\tafter_create_ok\n\t\t\telse\n\t\t\t\tafter_create_error\n\t\t\tend\n\t\tend\n end",
"def web_import(ingredient)\n doc = Nokogiri::HTML(File.open(open(\"http://www.marmiton.org/recettes/recherche.aspx?aqt=#{ingredient}\")))\n doc.search('.m_search_result').each do |element|\n recipe = Recipe.new\n recipe.name = \"#{element.search('.m_search_titre_recette > a').inner_text}, \"\n recipe.rating = \"Rating : #{element.search('.etoile1').size / 5}, \"\n recipe.votes = \"Nb votes: #{element.search('.m_search_nb_votes').inner_text.match(/\\d+/)}, \"\n recipe.prep_time = \"Prep time: #{element.search('.m_search_result_part4').inner_text.split(/\\D+/)[1].to_i} minutes,\"\n recipe.cooking_time = \"Cooking time: #{element.search('.m_search_result_part4').inner_text.split(/\\D+/)[2].to_i} minutes,\"\n recipe.summary = \"Summary: #{element.search('.m_search_result_part4').inner_text.squeeze(\" \").strip[37..186]}\"\n @recipes << recipe.to_s\n self.save\n end\n end",
"def get_from_npr(user_ingredients)\n raw_response=RestClient.get('http://api.npr.org/query?id=1139&fields=title,teaser,storyDate,byline,text&date&searchTerm=' + user_ingredients + '&dateType=story&output=JSON&apiKey=MDE5MDExNzc1MDE0MzA0MDE1NTViZDViOQ001')\n response = JSON.load(raw_response)\n\n if response[\"list\"][\"story\"] == nil\n puts \"Your search did not find any recipes...\"\n else\n recipes = response[\"list\"][\"story\"].map do |recipe|\n Recipe.new(\n title = recipe[\"title\"][\"$text\"],\n teaser = recipe[\"teaser\"][\"$text\"],\n link = recipe[\"link\"].first[\"$text\"],\n storyDate = recipe[\"storyDate\"][\"$text\"]\n )\n end\n end\n\nend",
"def insert_recipe_from_yummly_search(yummly_search_result)\n\n recipe_info = {\n yummly_id: yummly_search_result[\"id\"],\n name: yummly_search_result[\"recipeName\"],\n time: yummly_search_result[\"totalTimeInSeconds\"],\n small_img_url: yummly_search_result[\"imageUrlsBySize\"][\"90\"],\n is_data_complete: false\n }\n Recipe.create(recipe_info)\n end",
"def generate_shopping_list\n\n #pull out whichever recipe you are clicking on\n recipe = Yummly.find(params[:yummly_id])\n\n # create a recipe for the database for future use\n r = Recipe.find_or_create_by(name: recipe.name, thumbnail: recipe.thumbnail)\n\n #create new shopping list for each recipe\n s = ShoppingList.create(\n name: recipe.name, \n yummly_id: params[:yummly_id],\n user_id: current_user.id,\n recipe_id: r.id)\n\n #find recipe and ingredient name from yummly\n recipe.ingredients.each do |ingredient|\n ShoppingListItem.create(done: nil, shopping_list_id: s.id, ingredient_name: ingredient, ingredient_quantity: nil, ingredient_quantity_unit: nil)\n end\n\n redirect_to recipes_url, notice: \"Added recipe to your shopping lists\"\n\n end",
"def create\n @meal = Meal.find(params[:meal_id]) if params[:meal_id]\n @recipe = @meal ? @meal.recipes.create(params[:recipe]) : Recipe.new(params[:recipe])\n\n #@recipe.ingredients = params[:ingredients].map {|i| \n #Ingredient.new(:item => Food.find(i.delete(:item_id)), :quantity => i[:quantity]) unless i[:item_id].blank? \n #}.compact if params[:ingredients]\n\n @recipe.tags = params[:tags].split(/,/).map { |t|\n Tag.find_or_create_by_name(t.strip.downcase)\n }.compact if params[:tags]\n\n respond_to do |format|\n if @recipe.save\n format.html { redirect_to @recipe}\n format.json { render json: @recipe, status: :created, location: @recipe }\n else\n format.html { render action: \"new\" }\n format.json { render json: @recipe.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n \n if params[\"donor\"]\n @recipe = Recipe.find(params[\"donor\"]).clone_with_ingredients(params[\"recipe\"])\n @recipe.user = current_user\n\n else\n @recipe = Recipe.new(params[\"recipe\"])\n end\n\n @recipe.user = current_user\n\n respond_to do |format|\n if @recipe.save\n format.html { redirect_to @recipe, notice: 'Recipe was successfully created.' }\n format.json { render json: @recipe, status: :created, location: @recipe }\n else\n format.html { render action: \"new\" }\n format.json { render json: @recipe.errors, status: :unprocessable_entity }\n end\n end\n end",
"def setup_data\n user = create(:user)\n another_user = create(:user)\n recipe_type = create(:recipe_type)\n another_recipe_type = create(:recipe_type)\n cuisine = create(:cuisine)\n torta_morango = create(:recipe, title: 'Torta de Morango', difficulty: 'Médio',\n recipe_type: recipe_type, cuisine: cuisine, cook_time: 120,\n ingredients: 'Morango, farinha, ovos',\n cook_method: 'Misture tudo e coloque no forno',\n user: user)\n create(:recipe, title: 'Torta de Limão', difficulty: 'Médio',\n recipe_type: recipe_type, cuisine: cuisine, cook_time: 120,\n ingredients: 'Limão, farinha, ovos',\n cook_method: 'Misture tudo e coloque no forno',\n user: user)\n create(:recipe, title: 'Torta de Abacate', difficulty: 'Médio',\n recipe_type: another_recipe_type, cuisine: cuisine, cook_time: 120,\n ingredients: 'Abacate, farinha, ovos, decoracoes',\n cook_method: 'Misture tudo, coloque no forno, e apos retirar decore a torta',\n user: another_user)\n sobremesas = create(:list, name: 'Sobremesas', user: user)\n create(:list_recipe, list: sobremesas, recipe: torta_morango)\n login_as(user, scope: :user)\n end",
"def create_recipe(title, ingredients_array, steps)\n recipe = Recipe.find_or_create_by(title: title, steps: steps)\n recipe.ingredients = Ingredient.create_ingredients_from_array(ingredients_array)\n recipe\n end",
"def set_recipe\n @recipe = if params[:name]\n Recipe.find_by(name: params[:name])\n else\n Recipe.find_by(id: params[:id])\n end\n end",
"def set_recipe\n @recipe = Recipe.render(params[:id])\n end",
"def create_new_recipe3 user, params\n recipe = Recipe.new(name: params[\"recipe_name\"], create_time: Time.now.to_i, user_id: user.id, user_name: user.name)\n recipe.picture = params[\"recipe_url\"] if params[\"recipe_url\"] != nil\n raise Error::RecipeError, recipe.errors.messages.values[0][0] unless recipe.save\n\n ingredients = params[\"ingredients\"]\n ingredients.each { |ingredient| Ingredient.create(name: ingredient[\"name\"], amount: ingredient[\"amount\"], recipe_id: recipe.id)}\n\n steps = params[\"steps\"]\n steps.length.times { |i| Step.create(index: i+1, content: steps[i], recipe_id: recipe.id)}\n\n recipe\n end",
"def create\n user = current_user\n if params[:id]\n @recipe = Recipe.new(name: params[:name],\n description: params[:description],\n ingredients: params[:indredients],\n instructions: params[:instructions],\n servings: params[:servings],\n original_id: params[:id])\n else\n @recipe = Recipe.new(recipe_params)\n end\n user.recipes << @recipe\n if user.save\n render json: @recipe, status: :created\n else\n render json: {message: \"something went wrong\"}\n end\n end",
"def perform\n build_recipes # this returns array of recipes\n self # return the scrapper\n end",
"def recipe (recipe_id, name)\n if recipe_id\n this_recipe = Recipe.find(recipe_id.to_i)\n else\n this_recipe = Recipe.find_by(name)\n end\n\n creation = {\n :name => this_recipe[:name],\n :instructions => this_recipe.instructions.all,\n :ingredients => this_recipe.ingredients.all\n }\n # return the object\n creation\n end",
"def create(options = {})\n optional = [:description,\n \t\t\t :compatible_with,\n \t\t\t :script_type\n ]\n params.required(:label).accepts(optional).validate!(options)\n response = request(:post, \"/recipes.json\", default_params(options))\n response['recipe']\n end",
"def create\n name = params['name']\n description = params['description']\n instructions = params['instructions']\n cook_time = params['cook_time']\n quantity = params['quantity']\n serving_size = params['serving_size']\n uid = params['user_id']\n aws_params = Hash.new\n aws_params[:custom_fields] = {\n 'name' => name,\n 'description' => description,\n 'instructions' => instructions,\n 'cook_time' => cook_time,\n 'quantity' => quantity,\n 'serving_size' => serving_size,\n 'user_id' => uid\n }\n if Aws.save_recipe_to_db(aws_params)\n msg = {:notice => \"Recipe created!\"}\n render :json => msg\n else\n msg = {:notice => \"Error while save to DynamoDB!\"}\n render :json => msg\n end\n end",
"def set_recipe\n @recipe = Recipe.find(params[:id]) # Find the recipe\n end",
"def call\n url = \"https://www.allrecipes.com/search/results/?search=#{@keyword}\"\n html = URI.open(url).read\n doc = Nokogiri::HTML(html)\n\n doc.search('.card__detailsContainer').first(5).map do |element|\n name = element.search('.card__title').text.strip\n description = element.search('.card__summary').text.strip\n rating = element.search('.rating-star.active').count\n\n # prep time\n prep_time = parse_prep_time(element)\n\n Recipe.new({ name: name, description: description, rating: rating, prep_time: prep_time })\n end\n end",
"def addRecipe\n\n params['results'].each do |result|\n recipe = Recipe.new\n recipe.title = result[1]['name']\n if result[1]['images'] &&\n result[1]['images'].values.first[\"large_image_path\"] != '/photos/large/missing.png'\n # deal with ridiculous image nesting\n recipe.image_url = result[1]['images'].values.first[\"large_image_path\"]\n else\n recipe.image_url = nil # for recipes with no images\n end\n recipe.description = result[1]['description']\n recipe.method = result[1]['instructions']\n recipe.ingredients = result[1]['ingredients']\n recipe.cook_time = 15 + rand(26)\n recipe.nbr_times_cooked = 5 + rand(146)\n recipe.user_rating = 1 + rand(5)\n if recipe.image_url\n recipe.save\n else\n next\n end\n end\n\n redirect_to root_path # lol this don't work no good\n\n end",
"def set_recipe\n @recipe = RecipeApi.find(params[:id])\n end",
"def new\n @recipe = Recipe.new #we do not pass anything to the init..\n end",
"def add(data)\n recipe = Beerinhand::Recipe.new(data)\n if recipe.valid?\n recipe.save!\n print \"#{recipe.name} \"\n else\n puts \"#{recipe.name}: #{recipe.errors.messages.to_s}\"\n end\nend",
"def create # Take a URL, then either lookup or create the entity\n # return if need_login true\n # Find the recipe by URI (possibly correcting same), and bind it to the current user\n entity, modelparams = edittable_proxy\n @page_ref.save if (@page_ref != entity) && (!@page_ref.persisted? || @page_ref.changed?) # Trigger launch as nec.\n if @page_ref&.errors&.any?\n entity = @page_ref\n else\n params[entity.model_name.param_key] = modelparams.except :editable_misc_tag_tokens\n update_and_decorate entity,\n touch: :collect, # Add to user's collection\n needs: [ :title ], # Get title from page_ref\n update_attributes: true,\n skip_landing: true # Don't wait for background processing (i.e., parsing) to complete\n end\n if entity.errors.empty? # Success (valid recipe, either created or fetched)\n respond_to do |format|\n format.html { # This is for capturing a new recipe and tagging it using a new page.\n redirect_to default_next_path\n }\n format.json {\n @data = { onget: [ 'submit.submit_and_process', collection_user_url(current_user, layout: false) ] }\n response_service.mode = :modal\n flash[:popup] = \"'#{@decorator.title}' now appearing in your collection.\"\n render :action => 'collect_and_tag', :mode => :modal\n }\n end\n else # failure (not a valid collectible) => return to new\n # For a form where resource errors might be triggered by unavailable fields, add the errors to :base\n # Since only url errors will show up in the dialog, add other errors to the base\n (entity.errors.keys - [:base, :url]).each { |key|\n entity.errors[key].each { |error|\n entity.errors.add :base, \"#{key} #{error}\"\n }\n }\n base_errors_to_flash_now entity\n response_service.title = 'Cookmark a ' + entity.class.to_s\n @nav_current = :addcookmark\n pp = params[:page_ref]&.slice(:kind, :url) || {}\n pp[:kind] ||= response_service.controller_model_name\n @decorator = (@page_ref = PageRef.new pp.permit(:kind, :url)).decorate\n (entity.errors.keys - [:base]).each do |errkey|\n @page_ref.errors.add errkey, entity.errors[errkey]\n end\n smartrender :action => 'new', mode: :modal\n end\n end",
"def find_recipes_that_use_me_and_create_link\n my_recipes = Recipe.search_recipe_ingredient_lists_for_ingredient(self)\n my_recipes.each {|recipe| self.recipes << recipe}\n end",
"def add_recipe(recipe)\n @recipes << recipe\n # need to call save_to_csv\n save_to_csv\n end",
"def load_recipe url_or_recipe, selector, trimmers, grammar_mods={}\n recipe = url_or_recipe.is_a?(Recipe) ? url_or_recipe : Recipe.new(url: url_or_recipe)\n prep_site recipe.site, selector, trimmers, grammar_mods\n recipe.bkg_launch\n recipe.bkg_land # Perform all due diligence\n assert_equal grammar_mods, recipe.site.grammar_mods\n refute recipe.errors.any?, recipe.errors.full_messages\n assert recipe.good? # Should have loaded and settled down\n\n assert recipe.recipe_page\n refute recipe.recipe_page.errors.any?, recipe.recipe_page.errors.full_messages\n assert recipe.recipe_page.good?\n content = SiteServices.new(recipe.site).trim_recipe recipe.page_ref.content\n assert_equal content, recipe.recipe_page.content\n recipe\nend",
"def set_recipe\r\n @recipe = Recipe.find_by(id: params[:id])\r\n end",
"def recipe args=1\n self.summary.recipe args\n end",
"def add\r\n url = URI(\"https://spoonacular-recipe-food-nutrition-v1.p.rapidapi.com/recipes/#{params[:recipe_id]}/information\")\r\n\r\n http = Net::HTTP.new(url.host, url.port)\r\n http.use_ssl = true\r\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\r\n\r\n request = Net::HTTP::Get.new(url)\r\n request[\"x-rapidapi-key\"] = ENV[\"SPOONACULAR_API_KEY\"] #hidden API key\r\n request[\"x-rapidapi-host\"] = 'spoonacular-recipe-food-nutrition-v1.p.rapidapi.com'\r\n\r\n response = http.request(request)\r\n recipe_data = JSON.parse response.read_body\r\n recipe = Recipe.create :title => recipe_data[\"title\"], :image => recipe_data[\"image\"]\r\n @current_user.recipes << recipe # add recipe to My Recipes\r\n\r\n redirect_to my_recipes_path\r\n end",
"def create_recipe(row, db)\n name = row[0]\n ingredients= Array.new\n # function to run through row after index\n\n row[2..-1].each do |item|\n get_food = db[item]\n ingredients.push(get_food)\n end\n Recipe.new(name, ingredients)\n end",
"def recipe(name, description)\n @recipes[name] = description\n end",
"def create\n if recipe_ingredient_params[:ingredients_list]\n fill_form_from_ingredients_list\n elsif recipe_params[:url] && !ingredient_params[:product_name]\n fill_form_from_url\n else\n @recipe = Recipe.new(recipe_params)\n @recipe.country_consumption = Country.find_or_create(recipe_name_params[:country_consumption_name])\n @recipe.user = current_user\n \n if ingredient_params[:product_name]\n ingredients = ingredient_params.values.transpose.map { |s| Hash[ingredient_params.keys.zip(s)] }\n ingredients.each do |ingredient|\n weight, item_name = Ingredient.parse(ingredient[\"item_name\"])\n if ingredient[\"product_name\"].length > 0 and not ingredient[\"product_name\"] == \"None\"\n @ingredient = Ingredient.new({:weight => ingredient[\"weight\"]})\n @ingredient.description = ingredient[\"item_name\"]\n @ingredient.product = Product.find_or_create(ingredient[\"product_name\"])\n @ingredient.country_origin = Country.find_or_create(ingredient[\"country_origin_name\"])\n @recipe.ingredients << @ingredient\n \n @product_alias = ProductAlias.find_or_create(item_name)\n @product_alias.country = @recipe.country_consumption\n @product_alias.product = @ingredient.product\n if not @product_alias.save\n render :html => \"Could not save product alias\"\n return\n end\n elsif item_name.length > 0\n @product_alias = ProductAlias.find_or_create(item_name)\n @product_alias.country = @recipe.country_consumption\n @product_alias.product = Product.find_by(name: \"None\")\n if not @product_alias.save\n render :html => \"Could not save product alias\"\n return\n end\n end\n end\n end\n \n save\n end\n end",
"def set_recipe\n @recipe = Recipe.find(params[:id])\n \n end",
"def fillRecipeAssoc(a_recipe)\n # Setup for more automation w/faker gem later\n ingredients_name = \"A thing to put in it\"\n direction_step = \"Do this thing...\"\n # Do the thing\n a_recipe.ingredients.build(name: ingredients_name).save(validate: false)\n a_recipe.directions.build(step: direction_step).save(validate: false)\nend",
"def set_recipe\n @recipe = Recipe.find(params[:id])\nend",
"def findrecipes\n\t\t@hide_menu = true\n puts \"In Find Recipes\"\n #this is where the data for the searching of recipes gets routed into\n input = params['query'].inspect\n\n ingreds = input.split(',')\n\n input = ingreds.join(\"%2C\")\n #this is the api \n url = \"https://spoonacular-recipe-food-nutrition-v1.p.mashape.com/recipes/findByIngredients?fillIngredients=false&ingredients=\" + input + \"&limitLicense=false&number=5&ranking=1\"\n\n res = Unirest.get url,\n headers:{\n \"X-Mashape-Key\" => \"UpZLcnOR83mshtXvuIOPFXBkfhn5p1UWi1ejsnsTLWoVXrOppm\",\n \"Accept\" => \"application/json\"\n }\n\n recipes = res.body\n #for each recipe that gets returned, the following information is routed into the recipe results page\n recipes.each do |recipe|\n url2 = url2 = \"https://spoonacular-recipe-food-nutrition-v1.p.mashape.com/recipes/\" + recipe['id'].to_s + \"/information?includeNutrition=false\"\n\n res2 = Unirest.get url2,\n headers:{\n \"X-Mashape-Key\" => \"UpZLcnOR83mshtXvuIOPFXBkfhn5p1UWi1ejsnsTLWoVXrOppm\",\n \"Accept\" => \"application/json\"\n }\n\n price = (\"$\" + (0.01 * res2.body['pricePerServing']).to_s)[0..5]\n\n recipe['price'] = price\n #this is the price of a recipe per serving\n\n end\n\n @recipeData = recipes\n render template: \"recipes/data\"\n end",
"def set_recipe_item\n @recipe_item = RecipeItem.find(params[:id])\n end",
"def create\n\n @recipe = Recipe.new(recipe_params)\n @recipe.recipe_creator_id = current_user.id\n @recipe.allergies = get_allergies_from_params\n @recipe.ingredients = get_selected_ingredients\n\n #Shows an example on how to automatically check whether a recipe is suitable for a person with an intolerance\n laktoseintoleranz = Allergy.where(name: 'Laktoseintoleranz').first\n unless @recipe.allergies.include?(laktoseintoleranz)\n neo = Neography::Rest.new({:username => \"user\", :password => \"user\"})\n includes_laktose_ingredient = false\n\n @recipe.ingredients.each do |ingredient|\n node = neo.execute_query(\"MATCH (n)-[]->(i) WHERE n.name = 'Laktoseintoleranz' AND i.name = '#{ingredient.name}' RETURN i\")\n if node[\"data\"].present?\n includes_laktose_ingredient = true\n end\n end\n unless includes_laktose_ingredient\n @recipe.allergies << laktoseintoleranz\n end\n end\n\n respond_to do |format|\n if @recipe.save\n format.html { redirect_to @recipe, notice: 'Recipe was successfully created.' }\n format.json { render :show, status: :created, location: @recipe }\n else\n format.html { render :new }\n format.json { render json: @recipe.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_recipe\r\n @recipe = Recipe.friendly.find(params[:id])\r\n end",
"def add_recipe(recipe)\n @recipes << recipe\n save_csv\n end",
"def create_recipe(db,name,description,length,difficulty)\n # your code here\nend",
"def set_recipe\n @recipe = Recipe.find(params[:id])\n end",
"def set_recipe\n @recipe = Recipe.find(params[:id])\n end",
"def set_recipe\n @recipe = Recipe.find(params[:id])\n end",
"def set_recipe\n @recipe = Recipe.find(params[:id])\n end",
"def set_recipe\n @recipe = Recipe.find(params[:id])\n end",
"def set_recipe\n @recipe = Recipe.find params[:id]\n end",
"def set_recipes(fridge)\r\n # put recipes you want to puts manumally\r\n recipe_ingredients = {\"Teriyaki\" =>[\"chicken\",\"sugar\",\"mirin\",\"soy sauce\"],\r\n \"Curry rice\" => [\"rice\",\"curry mix\",\"potato\",\"onion\",\"beef\",\"carrot\"],\r\n \"Oyakodon\" => [\"chicken\",\"sugar\",\"mirin\",\"soy sauce\",\"rice\",\"egg\",\"onion\"],\r\n \"Takoyaki\" => [\"flour\",\"octopus\",\"ginger\",\"dashi\"],\r\n \"Nikujyaga\" => [\"beef\",\"sugar\",\"mirin\",\"soy sauce\",\"carrot\",\"onion\",\"potato\"],\r\n \"Octopus Sashimi\" => [\"octopus\",\"soy sauce\"],\r\n \"Miso soup\" => [\"miso\",\"dashi\"]}\r\n\r\n # set recipes_array to make new instence of Recipe\r\n recipes_array = {\"Teriyaki\" => [\"http://natashaskitchen.com/2015/12/11/easy-teriyaki-chicken/\",15],\r\n \"Curry rice\" => [\"http://www.japanesecooking101.com/curry-and-rice-recipe/\",40],\r\n \"Oyakodon\" => [\"http://www.justonecookbook.com/oyakodon/\",30],\r\n \"Takoyaki\" => [\"http://www.justonecookbook.com/takoyaki-recipe/\",20],\r\n \"Nikujyaga\" => [\"http://www.justonecookbook.com/nikujaga/\",30],\r\n \"Octopus Sashimi\" => [\"http://www.makesushi.com/sashimi/\",5],\r\n \"Miso soup\" =>[ \"http://steamykitchen.com/106-simple-10-minute-miso-soup.html\",5]}\r\n\r\n # make new instance and put to fridge.recipes\r\n recipes_array.each do |key,value|\r\n new_recipe = Recipe.new(key,value[0],value[1])\r\n new_recipe.ingredients = recipe_ingredients[\"#{key}\"]\r\n fridge.recipes << new_recipe\r\nend # recipes_array each end\r\nend",
"def new\n\t\t@recipe = Recipe.new\n\tend",
"def set_recipe\n @recipe = Recipe.friendly.find(params[:id])\n end",
"def set_recipe\n @recipe = Recipe.friendly.find(params[:id])\n end",
"def set_recipe\n @recipe = Recipe.find(params[:id])\n end",
"def create\n @recipe = current_user.recipes.build(recipe_params)\n @recipe.user = current_user\n @recipe.save\n @measurs = Array.new\n @ingrs = Array.new\n @tgs = Array.new\n #ovo bi trebalo unutar sebe prikupiti sastojke i mjere\n parse_ingredients\n parse_tags\n @recipe.measurements = @measurs\n @recipe.ingredients = @ingrs\n @recipe.recipe_tags = @tgs\n\n respond_to do |format|\n if @recipe.save\n format.html { redirect_to @recipe, notice: 'Recipe was successfully created.' }\n format.json { render :show, status: :created, location: @recipe }\n else\n format.html { render :new }\n format.json { render json: @recipe.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n new_recipe = Recipe.create(recipe_params)\n redirect_to user_recipes_path(new_recipe.user)\n end",
"def add_recipe(recipe)\n @recipes << recipe\n\n save_csv\n end",
"def get_recipe(id)\n recipe = Recipe.find(id)\n url = \"https://api2.bigoven.com/recipe/steps/#{recipe.id}?&api_key=#{ENV['API_KEY']}\"\n uri = URI(url)\n response = Net::HTTP.get(uri)\n # puts response\n\n JSON.parse(response)[\"Ingredients\"].each do |ingredient|\n # recipe.ingredients.create!(\n if (!Ingredient.exists?(ingredient[\"IngredientID\"])) \n Ingredient.create!(\n id: ingredient[\"IngredientID\"],\n name: ingredient[\"Name\"],\n html_name: ingredient[\"HTMLName\"]\n )\n end\n end\n\n if (recipe.recipe_ingredients.count > 0)\n recipe.recipe_ingredients.destroy_all\n recipe.save\n recipe.reload\n end\n\n JSON.parse(response)[\"Ingredients\"].each do |ingredient|\n \n # if (!recipe.recipe_ingredients.find_by(ingredient_id: ingredient[\"IngredientID\"]))\n recipe.recipe_ingredients.create!(\n ingredient_id: ingredient[\"IngredientID\"],\n quantity: ingredient[\"Quantity\"],\n display_quantity: ingredient[\"DisplayQuantity\"],\n unit: ingredient[\"Unit\"],\n metric_quantity: ingredient[\"MetricQuantity\"],\n metric_display_quantity: ingredient[\"MetricDisplayQuantity\"],\n metric_unit: ingredient[\"MetricUnit\"],\n preparation_notes: ingredient[\"PreparationNotes\"]\n )\n # end\n end\n \n recipe.steps = ''\n steps = JSON.parse(response)[\"Steps\"]\n steps.each do |step|\n step != steps.last ? recipe.steps += step[\"Text\"] + '$' : recipe.steps += step[\"Text\"]\n # recipe.steps += step[\"Text\"] + ','\n end\n \n recipe.save\n end",
"def create\n @recipe = Recipe.new(recipe_params)\n if params['ingredients']\n params['ingredients'].each do |ingredient_name|\n @recipe.ingredients << Ingredient.find_by(name: ingredient_name)\n end\n end\n\n @recipe.save \n redirect_to recipes_path\n end",
"def fetch_products_with_crawler\n crawler_items.each do |crawler_item|\n products.create_from_crawler crawler_item\n end\n end",
"def initialize\n @cook_id = 0\n @recipe_id = 0\n @hungry = true\n @recipes = []\n @cooking_shortcuts = []\n init_cooking_shortcuts\n end",
"def initialize(result)\r\n\t\t@result = result\r\n\t\t@recipehash = {}\r\n\tend",
"def externalRecipeSeed\n 20.times do\n api_recipe = get_random_recipe()\n createRecipeFromAPI(api_recipe)\n end\nend",
"def new\n @recipe = Recipe.new\n end",
"def new\n @recipe = Recipe.new\n end",
"def make_cards\n #14 restuarants\n scrape_cards.each do |res|\n binding.pry\n ResInfo::Restaurant.new_from_scraper(res)\n end\n end",
"def set_recipe\n @recipe = Recipe.friendly.find(params[:id])\n end",
"def url\n self.recipe_data.url\n end",
"def create\n @recipe = Recipe.new(recipe_params)\n params[:recipe][:ingredients].each do |ingredient_id|\n next if ingredient_id.to_i == 0\n ingredient = Ingredient.find(ingredient_id.to_i)\n @recipe.ingredients << ingredient\n end\n params[:recipe][:gadgets].each do |gadget_id|\n next if gadget_id.to_i == 0\n gadget = Gadget.find(gadget_id.to_i)\n @recipe.gadgets << gadget\n end\n respond_to do |format|\n if @recipe.save\n format.html { redirect_to @recipe, notice: 'Recipe was successfully created.' }\n format.json { render action: 'show', status: :created, location: @recipe }\n else\n format.html { render action: 'new' }\n format.json { render json: @recipe.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_recipe\n @recipe = Recipe.find(params[:id])\n end",
"def set_recipe\n @recipe = Recipe.find(params[:id])\n end",
"def set_recipe\n @recipe = Recipe.find(params[:id])\n end",
"def set_recipe\n @recipe = Recipe.find(params[:id])\n end",
"def set_recipe\n @recipe = Recipe.find(params[:id])\n end",
"def set_recipe\n @recipe = Recipe.find(params[:id])\n end",
"def set_recipe\n @recipe = Recipe.find(params[:id])\n end",
"def set_recipe\n @recipe = Recipe.find(params[:id])\n end",
"def set_recipe\n @recipe = Recipe.find(params[:id])\n end",
"def set_recipe\n @recipe = Recipe.find(params[:id])\n end",
"def set_recipe\n @recipe = Recipe.find(params[:id])\n end",
"def set_recipe\n @recipe = Recipe.find(params[:id])\n end",
"def set_recipe\n @recipe = Recipe.find(params[:id])\n end",
"def set_recipe\n @recipe = Recipe.find(params[:id])\n end",
"def set_recipe\n @recipe = Recipe.find(params[:id])\n end",
"def set_recipe\n @recipe = Recipe.find(params[:id])\n end",
"def set_recipe\n @recipe = Recipe.find(params[:id])\n end",
"def set_recipe\n @recipe = Recipe.find(params[:id])\n end"
] |
[
"0.7101345",
"0.6914661",
"0.6780243",
"0.66360384",
"0.66146755",
"0.6586129",
"0.65501857",
"0.6498371",
"0.64172715",
"0.6395194",
"0.634839",
"0.62956136",
"0.6275702",
"0.62426317",
"0.61983293",
"0.6165611",
"0.615139",
"0.6127436",
"0.6110336",
"0.6104298",
"0.60805494",
"0.60419315",
"0.6033414",
"0.603272",
"0.60269284",
"0.60244745",
"0.60216814",
"0.6021653",
"0.6020901",
"0.60203326",
"0.6013273",
"0.6010849",
"0.60060275",
"0.60014296",
"0.59957415",
"0.59808713",
"0.5973384",
"0.5944174",
"0.5935789",
"0.59303766",
"0.592975",
"0.59288675",
"0.5919336",
"0.59091055",
"0.590786",
"0.5902286",
"0.589359",
"0.5889322",
"0.5885855",
"0.5882869",
"0.58812135",
"0.5878965",
"0.5877351",
"0.5867882",
"0.586746",
"0.5865724",
"0.58626026",
"0.586242",
"0.586242",
"0.586242",
"0.586242",
"0.586242",
"0.5859873",
"0.5842765",
"0.58427227",
"0.5832361",
"0.5832361",
"0.58320445",
"0.5816267",
"0.58027583",
"0.57986104",
"0.5798235",
"0.5797945",
"0.57965577",
"0.57746154",
"0.57724255",
"0.57712275",
"0.5763159",
"0.5763159",
"0.57576627",
"0.57560635",
"0.57552457",
"0.57541424",
"0.57508755",
"0.5749998",
"0.5749998",
"0.5749998",
"0.5749998",
"0.5749998",
"0.5749998",
"0.5749998",
"0.5749998",
"0.5749998",
"0.5749998",
"0.5749998",
"0.5749998",
"0.5749998",
"0.5749998",
"0.5749998",
"0.5749998",
"0.5749998"
] |
0.0
|
-1
|
:nodoc: A utility method for escaping HTML tag characters. This method is also aliased as h. puts html_escape('is a > 0 & a is a > 0 & a < 10?
|
def html_escape(s) # rubocop:disable Lint/DuplicateMethods
unwrapped_html_escape(s).html_safe
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def html_escape(s)\n s.to_s.gsub(/&/, \"&\").gsub(/\\\"/, \""\").gsub(/>/, \">\").gsub(/</, \"<\")\n end",
"def html_escape(html)\n html.to_s.gsub(/[&\"><]/) { |special| HTML_ESCAPE[special] }\n end",
"def escape_html(html)\n html.to_s.gsub(/&/n, '&').gsub(/\\\"/n, '"').gsub(/>/n, '>').gsub(/</n, '<').gsub(/\\//, '/')\n end",
"def html_escape(s)\n s.to_s.gsub(/[&\"><]/) { |special| HTML_ESCAPE[special] }\n end",
"def html_escape(text)\n text.to_s.gsub(/[\\\"><&]/) { |s| HTML_ESCAPE[s] }\n end",
"def html_escape(s)\n CGI.escapeHTML(s.to_s)\n end",
"def html_escape(s)\n s = s.to_s\n if s.html_safe?\n s\n else\n s.to_s.gsub(/&/, \"&\").gsub(/\\\"/, \""\").gsub(/>/, \">\").gsub(/</, \"<\").html_safe\n end\n end",
"def html_escape(str)\r\n str.gsub('&', '&').str('<', '<').str('>', '>').str('\"', '"')\r\nend",
"def html_escape(clean_me)\n clean_me.to_s.gsub(/[&\"<>]/) do |special|\n { '&' => '&',\n '>' => '>',\n '<' => '<',\n '\"' => '"' }[special]\n end\n end",
"def escape_html(html)\n html.to_s.gsub(/[&\\\"<>\\/]/, ESCAPE_HTML)\n end",
"def escape_html(input)\n Utils::Escape.html(input)\n end",
"def htmlEscape(string)\n return string.gsub('&', '&').gsub('>', '>').gsub('<', '<')\nend",
"def html_escape(options={})\n except = options[:except] || %w()\n close_tags\n @modified_string.gsub!(/<\\/?(.*?)(\\s.*?)?\\/?>/) do |tag|\n if except.include?($1)\n # sanitize attributes\n tag.gsub(/\\s(.+?)=('|\").*?\\2(?=.*?>)/) do |a|\n [\"href\", \"src\", \"lang\"].include?($1) ? a : \"\"\n end\n else\n h(tag)\n end\n end\n # Convert all unclosed left tag brackets (<) into <\n @modified_string.gsub!(/<+([^>]*)\\Z/, '<\\1')\n # Convert all unopened right tag brackets (>) into >\n @modified_string.gsub!(/\\A([^<]*)>+/, '\\1>')\n self\n end",
"def html_escape(text)\n Rack::Utils.escape_html(text)\n end",
"def markup_escape(text)\n table_for_escape = {\n \"&\" => \"&\",\n \"<\" => \"<\",\n \">\" => \">\",\n }\n text.gsub(/[&<>]/, table_for_escape)\n end",
"def html_escape\n return to_s\n end",
"def html_escape\n return to_s\n end",
"def escape_html(value)\n CGI.escapeHTML(value)\n end",
"def escape(content)\n return content if content.html_safe?\n content.gsub(/[&><\"]/) { |char| ESCAPE_SEQUENCE[char] }\n end",
"def escape(text)\n if !text.kind_of?(String)\n if text.respond_to?(:to_str)\n text = text.to_str\n else\n text = test.to_s\n end\n end\n # TODO: Verify that this is sufficient, gut feeling says no.\n text.gsub(/\\</, \"<\")\n end",
"def html_escape(string)\n EscapeUtils.escape_html(string.to_s).html_safe\n end",
"def h(str)\n CGI.escapeHTML(str)\n end",
"def h(text)\n ::Rack::Utils.escape_html(text)\n end",
"def esc_ht str\n\t\treturn Escape.html str\n\tend",
"def h(content)\n content.html_escape\n end",
"def h(content)\n content.html_escape\n end",
"def h(text)\n Rack::Utils.escape_html(text)\n end",
"def h(text)\n Rack::Utils.escape_html(text)\n end",
"def h(text)\n Rack::Utils.escape_html(text)\n end",
"def escape_html( string )\n\t\t\treturn \"nil\" if string.nil?\n\t\t\tstring = string.inspect unless string.is_a?( String )\n\t\t\tstring.\n\t\t\t\tgsub(/&/, '&').\n\t\t\t\tgsub(/</, '<').\n\t\t\t\tgsub(/>/, '>').\n\t\t\t\tgsub(/\\n/, '↵').\n\t\t\t\tgsub(/\\t/, '→')\n\t\tend",
"def escape_html( string )\n\t\t\treturn \"nil\" if string.nil?\n\t\t\tstring = string.inspect unless string.is_a?( String )\n\t\t\tstring.\n\t\t\t\tgsub(/&/, '&').\n\t\t\t\tgsub(/</, '<').\n\t\t\t\tgsub(/>/, '>').\n\t\t\t\tgsub(/\\n/, '↵').\n\t\t\t\tgsub(/\\t/, '→')\n\t\tend",
"def h(str)\n CGI.escapeHTML(str.to_s)\n end",
"def h(s)\n Rack::Utils.escape_html(s.to_s)\n end",
"def encode_html( str )\n\t\t\t#str.gsub( /&(?!#?[x]?(?:[0-9a-f]+|\\w+);)/i, \"&\" ).\n\t\t\t\t#gsub( %r{<(?![a-z/?\\$!])}i, \"<\" )\n\t\t\t\treturn str\n\t\tend",
"def escape_html_safe(html)\n html.html_safe? ? html : escape_html(html)\n end",
"def h(string)\n Rack::Utils.escape_html(string)\n end",
"def escape_html(str)\n\t\t\t#table = HTML_ESC # optimize\n\t\t\t#str.gsub(/[&\"<>]/) {|s| table[s] }\n\t\t\treturn str\n\t\tend",
"def escape(s)\n s.gsub(/[&<>`]/, \"&\" => \"&\", \"<\" => \"<\", \">\" => \">\", \"`\" => \"`\")\n end",
"def escape_content\n content.to_s.gsub(/&/, \"&\").gsub(/\\\"/, \""\").gsub(/>/, \">\").gsub(/</, \"<\") \n end",
"def escape_html(str, type = T.unsafe(nil)); end",
"def esc(word)\n word.gsub(\"&\", \"&\").gsub(\"<\", \"<\")\n end",
"def encode(s)\n s.gsub!(\"<\",\"<\")\n s.gsub!(\">\",\">\")\n s.gsub!(\"& \",\"&\")\n s\n end",
"def escape_html\n Rack::Utils.escape_html self\n end",
"def h_(str)\n str.to_s.gsub(/['&\\\"<>]/, {\"'\"=>\"'\", \"&\"=>\"&\", '\"'=>\""\", \"<\"=>\"<\", \">\"=>\">\"})\n end",
"def html_safe(phrase)\n return h(phrase).gsub(/'/,''').gsub(/\\r\\n/,\"<br/>\")\n end",
"def haml_xss_html_escape(text)\n return text unless Hamlit::HamlUtil.rails_xss_safe? && haml_buffer.options[:escape_html]\n html_escape(text)\n end",
"def h(s)\n case s\n when Raw\n s\n when Tag\n s.to_s\n else\n escape_html(s)\n end\n end",
"def esc_html(text)\n \tsafe_text = wp_check_invalid_utf8(text)\n \tsafe_text = _wp_specialchars(safe_text, :ENT_QUOTES)\n \t# Filters a string cleaned and escaped for output in HTML.\n \tapply_filters('esc_html', safe_text, text)\n end",
"def escapeHTML(string)\n enc = string.encoding\n unless enc.ascii_compatible?\n if enc.dummy?\n origenc = enc\n enc = Encoding::Converter.asciicompat_encoding(enc)\n string = enc ? string.encode(enc) : string.b\n end\n table = Hash[TABLE_FOR_ESCAPE_HTML__.map {|pair|pair.map {|s|s.encode(enc)}}]\n string = string.gsub(/#{\"['&\\\"<>]\".encode(enc)}/, table)\n string.encode!(origenc) if origenc\n string\n else\n string = string.b\n string.gsub!(/['&\\\"<>]/, TABLE_FOR_ESCAPE_HTML__)\n string.force_encoding(enc)\n end\n end",
"def h(str)\n CGI.unescape_html(str.to_s)\n .gsub('&', '&')\n .gsub('\"', '"')\n .gsub('<', '<')\n .gsub('>', '>')\n end",
"def escape_html(string)\n string.to_s.gsub(ESCAPE_HTML_PATTERN){|c| ESCAPE_HTML[c] }\n end",
"def make_html_safe i_string\n\t\t\t# CGI::escapeHTML i_string.to_s\n\t\t\ti_string\n\t\tend",
"def conv_html(txt)\n txt.\n gsub(/>/, '>').\n gsub(/</, '<').\n gsub(/"/, '\"').\n gsub(/&/, '&')\n \n end",
"def html_escape_with_haml_xss(text)\n str = text.to_s\n return text if str.html_safe?\n Hamlit::HamlUtil.html_safe(html_escape_without_haml_xss(str))\n end",
"def xml_escape(input); end",
"def h(string)\n Rack::Utils.escape_html(string) # Escape any html code that appears on page e.g. <script>\nend",
"def page_meta_escape_value(val)\n val.to_s.gsub(\"<\", \"<\").gsub(\">\", \">\")\n end",
"def html_encode\n require 'htmlentities'\n \n coder = HTMLEntities.new\n \n ret = coder.encode(self, :named)\n \n return ret\n end",
"def html_safe(input)\n input.respond_to?(:html_safe) ? input.html_safe : input\n end",
"def esc(str)\n str = str.to_s.gsub(\"&\", \"&\")\n str = str.gsub(\"\\\"\", \"'\")\n str = str.gsub(\"\\\"\", \""\")\n str = str.gsub(\"<\", \"<\")\n str.gsub(\">\", \">\")\nend",
"def xml_attr_escape\n replacements = {\"<\" => \"<\", \">\" => \">\", \"&\" => \"&\", \"\\\"\" => \""\", \"'\" => \"'\"}\n gsub(/([<>&\\'\\\"])/) { replacements[$1] }\n end",
"def kss_h(text)\n Rack::Utils.escape_html(text)\n end",
"def escape_xml(xml_in) \n return xml_in.gsub(/&/,'&').gsub(/</,'<')\n end",
"def escape(str)\n ERB::Util.h(str).gsub('"', '\"').gsub(''', \"'\")\n end",
"def cgi_escape(input); end",
"def reverse_html_tags\n self.gsub('<', \"<\").gsub('>', \">\")\n end",
"def erb_escape(text)\n # Do not only replace '<%' ! or <r:t>min</r:t>% ==> <% ...\n text.gsub(SECURE_REGEXP) {|code| SAFE_CODE[code]}\n end",
"def html_text(str)\n str.gsub(/[&<>]/) {|ch| HTML_TEXT_ESCAPE_HASH[ch] }\n end",
"def e(value)\n CGI.escape(value)\n end",
"def escape_xml(string) \n string.gsub(/[&<>\\'\\\"]/) do | match |\n case match\n when '&' then '&'\n when '<' then '<'\n when '>' then '>'\n when '\"' then '"'\n when \"'\" then '''\n end\n end \n end",
"def html_safe\n self\n end",
"def hsc(str)\n str.gsub(/&/, \"&\")\n .gsub(/</, \"<\")\n .gsub(/>/, \">\")\n .gsub(/\"/, \""\")\n .gsub(/'/, \"'\")\n end",
"def _(data=\"\"); self.__ self.escape_html(data.to_s); end",
"def h(obj)\n CGI.escapeHTML(obj.to_s)\n end",
"def escaped_content\n content.gsub(/&/, '&').gsub(/</, '<').strip\n end",
"def to_html_entities\n unpack('U*').map! {|c| \"&##{c};\"}.join\n end",
"def convert_html_safe(str)\n return str.html_safe\n end",
"def HTMLEsc( str )\n\tstr.gsub!( /\\&/, \"&\" )\n\tstr.gsub!( /\\\"/, \""\" )\n\tstr.gsub!( /</, \"<\" )\n\tstr.gsub!( />/, \">\" )\n\tstr.gsub!( /\\n/, \"<br>\" )\n\tstr.gsub( /\\t/, \" \" )\nend",
"def escape(str)\n CGI.escape(str)\n end",
"def htmlify(text, markup = T.unsafe(nil)); end",
"def h(string)\n mapping = {\n \"&\" => \"&\",\n \"<\" => \"<\",\n \">\" => \">\",\n \"'\" => \"'\",\n '\"' => \""\"\n }\n pattern = /#{Regexp.union(*mapping.keys)}/n\n string.to_s.gsub(pattern){|c| mapping[c] }\n end",
"def correct_unncessarily_escaped_html_tags(element)\n statement = element.statement\n [:sup, :i].each do |tag|\n statement.gsub!(/<#{tag}>/,%Q{<#{tag}>})\n statement.gsub!(/<\\/#{tag}>/,%Q{</#{tag}>})\n end\n element.instance_variable_set(:@statement,statement)\n end",
"def convert_string(text)\n CGI.escapeHTML text\n end",
"def escape_entities(str)\n CGI.escapeHTML(str).gsub(/[\\n\\r]/) {|c| '&#x' + c.unpack('h').first + ';'}\n end",
"def write_html_on(op, value_hash)\n esc = proc { |str| CGI.escapeHTML(str) }\n op << write_common(value_hash, esc)\n end",
"def h obj; obj.to_s.html_escape end",
"def to_html opts={}\r\n value = self.gsub(/</, '<').gsub(/>/, '>').gsub(/&/,'&')\r\n value = value.gsub(/<script/,'<script') unless opts[:script]\r\n value = value.gsub(/<link/,'<link') unless opts[:link]\r\n value\r\n end",
"def to_html opts={}\r\n value = self.gsub(/</, '<').gsub(/>/, '>').gsub(/&/,'&')\r\n value = value.gsub(/<script/,'<script') unless opts[:script]\r\n value = value.gsub(/<link/,'<link') unless opts[:link]\r\n value\r\n end",
"def escape(str); end",
"def html raw_text\n EscapeUtils.escape_html(decode_html(raw_text))\n end",
"def escape_html(str, type = :all)\n str.gsub(ESCAPE_RE_FROM_TYPE[type]) {|m| ESCAPE_MAP[m] || m }\n end",
"def js_escape_html(html_content)\n return '' unless html_content\n javascript_mapping = { '\\\\' => '\\\\\\\\', '</' => '<\\/', \"\\r\\n\" => '\\n', \"\\n\" => '\\n', \"\\r\" => '\\n', '\"' => '\\\\\"', \"'\" => \"\\\\'\" }\n escaped_content = html_content.gsub(/(\\\\|<\\/|\\r\\n|[\\n\\r\"'])/){ |m| javascript_mapping[m] }\n escaped_content = escaped_content.html_safe if html_content.html_safe?\n escaped_content\n end",
"def dumpAsHTML\n\t\tvalue = dumpAsString\n\t\treturn CGI.escapeHTML(value)\n\tend",
"def ae_some_html(s)\n return '' if s.nil? \n \n # converting newlines\n s.gsub!(/\\r\\n?/, \"\\n\")\n \n # escaping HTML to entities\n s = s.to_s.gsub('&', '&').gsub('<', '<').gsub('>', '>')\n \n # blockquote tag support\n s.gsub!(/\\n?<blockquote>\\n*(.+?)\\n*<\\/blockquote>/im, \"<blockquote>\\\\1</blockquote>\")\n \n # other tags: b, i, em, strong, u\n %w(b i em strong u).each { |x|\n s.gsub!(Regexp.new('<(' + x + ')>(.+?)</('+x+')>',\n Regexp::MULTILINE|Regexp::IGNORECASE), \n \"<\\\\1>\\\\2</\\\\1>\")\n }\n \n # A tag support\n # href=\"\" attribute auto-adds http://\n s = s.gsub(/<a.+?href\\s*=\\s*['\"](.+?)[\"'].*?>(.+?)<\\/a>/im) { |x|\n '<a href=\"' + ($1.index('://') ? $1 : 'http://'+$1) + \"\\\">\" + $2 + \"</a>\"\n }\n \n # replacing newlines to <br> ans <p> tags\n # wrapping text into paragraph\n s = \"<p>\" + s.gsub(/\\n\\n+/, \"</p>\\n\\n<p>\").\n gsub(/([^\\n]\\n)(?=[^\\n])/, '\\1<br />') + \"</p>\"\n \n s \n end",
"def ae_some_html(s)\n return '' if s.nil? \n \n # converting newlines\n s.gsub!(/\\r\\n?/, \"\\n\")\n \n # escaping HTML to entities\n s = s.to_s.gsub('&', '&').gsub('<', '<').gsub('>', '>')\n \n # blockquote tag support\n s.gsub!(/\\n?<blockquote>\\n*(.+?)\\n*<\\/blockquote>/im, \"<blockquote>\\\\1</blockquote>\")\n \n # other tags: b, i, em, strong, u\n %w(b i em strong u).each { |x|\n s.gsub!(Regexp.new('<(' + x + ')>(.+?)</('+x+')>',\n Regexp::MULTILINE|Regexp::IGNORECASE), \n \"<\\\\1>\\\\2</\\\\1>\")\n }\n \n # A tag support\n # href=\"\" attribute auto-adds http://\n s = s.gsub(/<a.+?href\\s*=\\s*['\"](.+?)[\"'].*?>(.+?)<\\/a>/im) { |x|\n '<a href=\"' + ($1.index('://') ? $1 : 'http://'+$1) + \"\\\">\" + $2 + \"</a>\"\n }\n \n # replacing newlines to <br> ans <p> tags\n # wrapping text into paragraph\n s = \"<p>\" + s.gsub(/\\n\\n+/, \"</p>\\n\\n<p>\").\n gsub(/([^\\n]\\n)(?=[^\\n])/, '\\1<br />') + \"</p>\"\n \n s \n end",
"def escape(string); end",
"def escape(target)\n new(target.to_s.gsub(/[#{Entities}]/) {|m| \"&#{Encode[m]};\" })\n end",
"def escape_field( field )\n return html_escape( field ).gsub( \"\\\\\", \"\\" )\n end",
"def escape_xml(string)\n string.gsub!(\"&\", \"&\")\n string.gsub!(\"<\", \"<\")\n string.gsub!(\">\", \">\")\n string.gsub!(\"'\", \"'\")\n string.gsub!(\"\\\"\", \""\")\n\n return string\n end",
"def my_html_escape(org_value)\n '' if org_value.nil?\n ERB::Util.html_escape(org_value). # Standard-Escape kann kein NewLine-><BR>\n gsub(/\\n/, '<br>'). # Alle vorkommenden NewLine ersetzen\n gsub(/\\r/, '') # Alle vorkommenden CR ersetzen, führt sonst bei Javascript zu Error String not closed\n end"
] |
[
"0.7907655",
"0.7850751",
"0.7720355",
"0.76722777",
"0.76233643",
"0.7612577",
"0.75817907",
"0.753323",
"0.73845303",
"0.72401065",
"0.7226192",
"0.7224788",
"0.7222203",
"0.7201686",
"0.7168123",
"0.7160892",
"0.7160892",
"0.7147957",
"0.7109266",
"0.71079224",
"0.70828307",
"0.7071512",
"0.7053521",
"0.70166856",
"0.7005014",
"0.7005014",
"0.7003362",
"0.69877625",
"0.6987756",
"0.69615316",
"0.69615316",
"0.693327",
"0.6914454",
"0.6912678",
"0.6908905",
"0.68812364",
"0.6859432",
"0.68404365",
"0.6761897",
"0.6723436",
"0.6671057",
"0.6669234",
"0.6637375",
"0.661714",
"0.6609032",
"0.6584169",
"0.65698403",
"0.6553714",
"0.6505312",
"0.64822525",
"0.6464614",
"0.645173",
"0.644464",
"0.643193",
"0.6400465",
"0.6385731",
"0.6349943",
"0.63119364",
"0.63036454",
"0.62838477",
"0.62810075",
"0.6280505",
"0.6273283",
"0.6254458",
"0.6249399",
"0.6244903",
"0.6243796",
"0.62417597",
"0.6237356",
"0.62182057",
"0.62135696",
"0.6210309",
"0.61725444",
"0.61479634",
"0.6146985",
"0.61426944",
"0.614194",
"0.6119711",
"0.6113825",
"0.61078995",
"0.60886425",
"0.60795754",
"0.6044866",
"0.60385925",
"0.60024077",
"0.6000767",
"0.60004824",
"0.60004824",
"0.59965664",
"0.59784573",
"0.5977429",
"0.5945716",
"0.5938121",
"0.5911008",
"0.5911008",
"0.59043854",
"0.59014064",
"0.5897916",
"0.5881307",
"0.58793354"
] |
0.73188645
|
9
|
A utility method for escaping HTML without affecting existing escaped entities. html_escape_once('1 "1 < 2 & 3" html_escape_once('<< Accept & Checkout') => "<< Accept & Checkout"
|
def html_escape_once(s)
ActiveSupport::Multibyte::Unicode.tidy_bytes(s.to_s).gsub(HTML_ESCAPE_ONCE_REGEXP, HTML_ESCAPE).html_safe
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def escape_html(html)\n html.to_s.gsub(/&/n, '&').gsub(/\\\"/n, '"').gsub(/>/n, '>').gsub(/</n, '<').gsub(/\\//, '/')\n end",
"def html_escape(s)\n s.to_s.gsub(/&/, \"&\").gsub(/\\\"/, \""\").gsub(/>/, \">\").gsub(/</, \"<\")\n end",
"def html_escape(html)\n html.to_s.gsub(/[&\"><]/) { |special| HTML_ESCAPE[special] }\n end",
"def html_escape(s)\n s = s.to_s\n if s.html_safe?\n s\n else\n s.to_s.gsub(/&/, \"&\").gsub(/\\\"/, \""\").gsub(/>/, \">\").gsub(/</, \"<\").html_safe\n end\n end",
"def escape_once( html )\n html.to_s.gsub(/[\\\"><]|&(?!([a-zA-Z]+|(#\\d+));)/) { |special| ERB::Util::HTML_ESCAPE[special] }\n end",
"def html_escape(str)\r\n str.gsub('&', '&').str('<', '<').str('>', '>').str('\"', '"')\r\nend",
"def escape_once(html)\n fix_double_escape(html_escape(html.to_s))\n end",
"def escape_once(html)\n html.to_s.gsub(/[\\\"><]|&(?!([a-zA-Z]+|(#\\d+));)/) { |special| ERB::Util.html_escape(special) }\n end",
"def html_escape(s) # rubocop:disable Lint/DuplicateMethods\n unwrapped_html_escape(s).html_safe\n end",
"def escape_html(html)\n html.to_s.gsub(/[&\\\"<>\\/]/, ESCAPE_HTML)\n end",
"def html_escape(clean_me)\n clean_me.to_s.gsub(/[&\"<>]/) do |special|\n { '&' => '&',\n '>' => '>',\n '<' => '<',\n '\"' => '"' }[special]\n end\n end",
"def html_escape(text)\n text.to_s.gsub(/[\\\"><&]/) { |s| HTML_ESCAPE[s] }\n end",
"def html_escape(s)\n s.to_s.gsub(/[&\"><]/) { |special| HTML_ESCAPE[special] }\n end",
"def escape_once(html); end",
"def htmlEscape(string)\n return string.gsub('&', '&').gsub('>', '>').gsub('<', '<')\nend",
"def escape_html_safe(html)\n html.html_safe? ? html : escape_html(html)\n end",
"def html_escape(options={})\n except = options[:except] || %w()\n close_tags\n @modified_string.gsub!(/<\\/?(.*?)(\\s.*?)?\\/?>/) do |tag|\n if except.include?($1)\n # sanitize attributes\n tag.gsub(/\\s(.+?)=('|\").*?\\2(?=.*?>)/) do |a|\n [\"href\", \"src\", \"lang\"].include?($1) ? a : \"\"\n end\n else\n h(tag)\n end\n end\n # Convert all unclosed left tag brackets (<) into <\n @modified_string.gsub!(/<+([^>]*)\\Z/, '<\\1')\n # Convert all unopened right tag brackets (>) into >\n @modified_string.gsub!(/\\A([^<]*)>+/, '\\1>')\n self\n end",
"def html_escape(s)\n CGI.escapeHTML(s.to_s)\n end",
"def escape_once(html)\n html.to_s.gsub(/[\\\"><]|&(?!([a-zA-Z]+|(#\\d+));)/) { |special| MerbWheels::Util::HTML_ESCAPE[special] }\n end",
"def escape_html( string )\n\t\t\treturn \"nil\" if string.nil?\n\t\t\tstring = string.inspect unless string.is_a?( String )\n\t\t\tstring.\n\t\t\t\tgsub(/&/, '&').\n\t\t\t\tgsub(/</, '<').\n\t\t\t\tgsub(/>/, '>').\n\t\t\t\tgsub(/\\n/, '↵').\n\t\t\t\tgsub(/\\t/, '→')\n\t\tend",
"def escape_html( string )\n\t\t\treturn \"nil\" if string.nil?\n\t\t\tstring = string.inspect unless string.is_a?( String )\n\t\t\tstring.\n\t\t\t\tgsub(/&/, '&').\n\t\t\t\tgsub(/</, '<').\n\t\t\t\tgsub(/>/, '>').\n\t\t\t\tgsub(/\\n/, '↵').\n\t\t\t\tgsub(/\\t/, '→')\n\t\tend",
"def clean(text = nil, escape_ampersands_twice = false)\n text.gsub!(\" \", \" \")\n converted = convert_html(text)\n entity_converted = convert_entities(converted)\n # puts \"entity_converted: #{entity_converted}\"\n escaped = escape(entity_converted)\n # escaped = escaped.gsub(/&/, '\\\\\\\\&')\n escaped = escaped.gsub(\"&\", \"\\&\")\n escaped = escaped.gsub(/&/, '\\\\\\\\&') if escape_ampersands_twice\n # puts \"escaped: #{escaped}\"\n # puts \"\\n\"\n escaped\n end",
"def html_escape(string)\n EscapeUtils.escape_html(string.to_s).html_safe\n end",
"def html_escape\n return to_s\n end",
"def html_escape\n return to_s\n end",
"def escape_html(input)\n Utils::Escape.html(input)\n end",
"def escape_once(text)\n text.to_s.gsub(/[\\\"><]|&(?!([a-zA-Z]+|(#\\d+));)/) { |s| HTML_ESCAPE[s] }\n end",
"def encode_html( str )\n\t\t\t#str.gsub( /&(?!#?[x]?(?:[0-9a-f]+|\\w+);)/i, \"&\" ).\n\t\t\t\t#gsub( %r{<(?![a-z/?\\$!])}i, \"<\" )\n\t\t\t\treturn str\n\t\tend",
"def markup_escape(text)\n table_for_escape = {\n \"&\" => \"&\",\n \"<\" => \"<\",\n \">\" => \">\",\n }\n text.gsub(/[&<>]/, table_for_escape)\n end",
"def html_escape(text)\n Rack::Utils.escape_html(text)\n end",
"def escape_html(string)\n string.to_s.gsub(ESCAPE_HTML_PATTERN){|c| ESCAPE_HTML[c] }\n end",
"def esc_html(text)\n \tsafe_text = wp_check_invalid_utf8(text)\n \tsafe_text = _wp_specialchars(safe_text, :ENT_QUOTES)\n \t# Filters a string cleaned and escaped for output in HTML.\n \tapply_filters('esc_html', safe_text, text)\n end",
"def escape(content)\n return content if content.html_safe?\n content.gsub(/[&><\"]/) { |char| ESCAPE_SEQUENCE[char] }\n end",
"def escape_html(str, type = T.unsafe(nil)); end",
"def fix_double_escape(escaped)\n escaped.gsub(/&([a-z]+|(#\\d+));/i) { \"&#{$1};\" }\n end",
"def escape_html(str)\n\t\t\t#table = HTML_ESC # optimize\n\t\t\t#str.gsub(/[&\"<>]/) {|s| table[s] }\n\t\t\treturn str\n\t\tend",
"def haml_xss_html_escape(text)\n return text unless Hamlit::HamlUtil.rails_xss_safe? && haml_buffer.options[:escape_html]\n html_escape(text)\n end",
"def escape_html(value)\n CGI.escapeHTML(value)\n end",
"def escape(text)\n if !text.kind_of?(String)\n if text.respond_to?(:to_str)\n text = text.to_str\n else\n text = test.to_s\n end\n end\n # TODO: Verify that this is sufficient, gut feeling says no.\n text.gsub(/\\</, \"<\")\n end",
"def escapeHTML(string)\n enc = string.encoding\n unless enc.ascii_compatible?\n if enc.dummy?\n origenc = enc\n enc = Encoding::Converter.asciicompat_encoding(enc)\n string = enc ? string.encode(enc) : string.b\n end\n table = Hash[TABLE_FOR_ESCAPE_HTML__.map {|pair|pair.map {|s|s.encode(enc)}}]\n string = string.gsub(/#{\"['&\\\"<>]\".encode(enc)}/, table)\n string.encode!(origenc) if origenc\n string\n else\n string = string.b\n string.gsub!(/['&\\\"<>]/, TABLE_FOR_ESCAPE_HTML__)\n string.force_encoding(enc)\n end\n end",
"def esc(str)\n str = str.to_s.gsub(\"&\", \"&\")\n str = str.gsub(\"\\\"\", \"'\")\n str = str.gsub(\"\\\"\", \""\")\n str = str.gsub(\"<\", \"<\")\n str.gsub(\">\", \">\")\nend",
"def convert_html_safe(str)\n return str.html_safe\n end",
"def escape_xml(string) \n string.gsub(/[&<>\\'\\\"]/) do | match |\n case match\n when '&' then '&'\n when '<' then '<'\n when '>' then '>'\n when '\"' then '"'\n when \"'\" then '''\n end\n end \n end",
"def escape_content\n content.to_s.gsub(/&/, \"&\").gsub(/\\\"/, \""\").gsub(/>/, \">\").gsub(/</, \"<\") \n end",
"def escape_entities(str)\n CGI.escapeHTML(str).gsub(/[\\n\\r]/) {|c| '&#x' + c.unpack('h').first + ';'}\n end",
"def escape_once_with_haml_xss(*args)\n Hamlit::HamlUtil.html_safe(escape_once_without_haml_xss(*args))\n end",
"def _gestalt_escape_entities(s)\n s.to_s.gsub(/&/, '&').\n gsub(/\"/, '"').\n gsub(/'/, ''').\n gsub(/</, '<').\n gsub(/>/, '>')\n end",
"def esc_ht str\n\t\treturn Escape.html str\n\tend",
"def escape_html\n Rack::Utils.escape_html self\n end",
"def escape(s)\n s.gsub(/[&<>`]/, \"&\" => \"&\", \"<\" => \"<\", \">\" => \">\", \"`\" => \"`\")\n end",
"def to_html_entities\n unpack('U*').map! {|c| \"&##{c};\"}.join\n end",
"def escape_html(str, type = :all)\n str.gsub(ESCAPE_RE_FROM_TYPE[type]) {|m| ESCAPE_MAP[m] || m }\n end",
"def escape_xml(xml_in) \n return xml_in.gsub(/&/,'&').gsub(/</,'<')\n end",
"def smart_quote_entity(el); end",
"def html_escape_with_haml_xss(text)\n str = text.to_s\n return text if str.html_safe?\n Hamlit::HamlUtil.html_safe(html_escape_without_haml_xss(str))\n end",
"def escape_xml(string)\n string.gsub!(\"&\", \"&\")\n string.gsub!(\"<\", \"<\")\n string.gsub!(\">\", \">\")\n string.gsub!(\"'\", \"'\")\n string.gsub!(\"\\\"\", \""\")\n\n return string\n end",
"def html_safe(input)\n input.respond_to?(:html_safe) ? input.html_safe : input\n end",
"def HTMLEsc( str )\n\tstr.gsub!( /\\&/, \"&\" )\n\tstr.gsub!( /\\\"/, \""\" )\n\tstr.gsub!( /</, \"<\" )\n\tstr.gsub!( />/, \">\" )\n\tstr.gsub!( /\\n/, \"<br>\" )\n\tstr.gsub( /\\t/, \" \" )\nend",
"def unescapeHTML(string)\n enc = string.encoding\n unless enc.ascii_compatible?\n if enc.dummy?\n origenc = enc\n enc = Encoding::Converter.asciicompat_encoding(enc)\n string = enc ? string.encode(enc) : string.b\n end\n string = string.gsub(Regexp.new('&(apos|amp|quot|gt|lt|#[0-9]+|#x[0-9A-Fa-f]+);'.encode(enc))) do\n case $1.encode(Encoding::US_ASCII)\n when 'apos' then \"'\".encode(enc)\n when 'amp' then '&'.encode(enc)\n when 'quot' then '\"'.encode(enc)\n when 'gt' then '>'.encode(enc)\n when 'lt' then '<'.encode(enc)\n when /\\A#0*(\\d+)\\z/ then $1.to_i.chr(enc)\n when /\\A#x([0-9a-f]+)\\z/i then $1.hex.chr(enc)\n end\n end\n string.encode!(origenc) if origenc\n return string\n end\n return string unless string.include? '&'\n charlimit = case enc\n when Encoding::UTF_8; 0x10ffff\n when Encoding::ISO_8859_1; 256\n else 128\n end\n string = string.b\n string.gsub!(/&(apos|amp|quot|gt|lt|\\#[0-9]+|\\#[xX][0-9A-Fa-f]+);/) do\n match = $1.dup\n case match\n when 'apos' then \"'\"\n when 'amp' then '&'\n when 'quot' then '\"'\n when 'gt' then '>'\n when 'lt' then '<'\n when /\\A#0*(\\d+)\\z/\n n = $1.to_i\n if n < charlimit\n n.chr(enc)\n else\n \"&##{$1};\"\n end\n when /\\A#x([0-9a-f]+)\\z/i\n n = $1.hex\n if n < charlimit\n n.chr(enc)\n else\n \"&#x#{$1};\"\n end\n else\n \"&#{match};\"\n end\n end\n string.force_encoding enc\n end",
"def escape(str)\n ERB::Util.h(str).gsub('"', '\"').gsub(''', \"'\")\n end",
"def test_that_escape_html_works\n source = <<-HTML.strip_heredoc\n Through <em>NO</em> <script>DOUBLE NO</script>\n\n <script>BAD</script>\n\n <img src=\"/favicon.ico\" />\n HTML\n expected = <<-HTML.chomp.strip_heredoc\n <p>Through <em>NO</em> <script>DOUBLE NO</script></p>\n\n <p><script>BAD</script></p>\n\n <p><img src="/favicon.ico" /></p>\n HTML\n\n assert_equal expected, render(source, with: [:escape_html])\n end",
"def conv_html(txt)\n txt.\n gsub(/>/, '>').\n gsub(/</, '<').\n gsub(/"/, '\"').\n gsub(/&/, '&')\n \n end",
"def to_html\n __html__.dup.scrub!(:escape).to_html\n end",
"def _escape(text)\n ensure_mutable = text.is_a?(BuilderMutableString) ? text : BuilderMutableString.new(text)\n ensure_mutable.to_xs\n end",
"def encode(s)\n s.gsub!(\"<\",\"<\")\n s.gsub!(\">\",\">\")\n s.gsub!(\"& \",\"&\")\n s\n end",
"def escaped_content\n content.gsub(/&/, '&').gsub(/</, '<').strip\n end",
"def unescape_html(str)\n str.gsub(/&(.*?);/n) do\n match = $1.dup\n case match\n when /\\Aamp\\z/ni then '&'\n when /\\Aquot\\z/ni then '\"'\n when /\\Agt\\z/ni then '>'\n when /\\Alt\\z/ni then '<'\n when /\\A#0*(\\d+)\\z/n then\n if Integer($1) < 256\n Integer($1).chr\n else\n if Integer($1) < 65536 and ($KCODE[0] == ?u or $KCODE[0] == ?U)\n [Integer($1)].pack(\"U\")\n else\n \"&##{$1};\"\n end\n end\n when /\\A#x([0-9a-f]+)\\z/ni then\n if $1.hex < 256\n $1.hex.chr\n else\n if $1.hex < 65536 and ($KCODE[0] == ?u or $KCODE[0] == ?U)\n [$1.hex].pack(\"U\")\n else\n \"&#x#{$1};\"\n end\n end\n else\n \"&#{match};\"\n end\n end\n end",
"def html_safe\n self\n end",
"def safe(html = nil)\n output = html || raw\n output.respond_to?(:html_safe) ? output.html_safe : output\n end",
"def safe_xhtml_sanitize(html, options = {})\n sanitized = xhtml_sanitize(html.purify)\n doc = Nokogiri::XML::Document.parse(\"<div xmlns='http://www.w3.org/1999/xhtml'>#{sanitized}</div>\", nil, (options[:encoding] || 'UTF-8'), 0)\n sanitized = doc.root.children.to_xml(:indent => (options[:indent] || 2), :save_with => 2 )\n rescue Nokogiri::XML::SyntaxError\n sanitized = sanitized.escapeHTML\n end",
"def escape_content(content)\n # first, find any pre-escaped entities and \"mark\" them by replacing & with @@\n # so something like < becomes @@lt;\n # and Ӓ becomes @@#1234\n\n content.gsub!(/&\\w+;/) {|t| t.gsub('&', '@@')}\n content.gsub!(/&#\\d{4}/) {|t| t.gsub('&', '@@')}\n content.gsub!(/&#\\d{3}/) {|t| t.gsub('&', '@@')}\n\n # now we know that all & characters remaining are not part of some pre-escaped entity, and we can escape them safely\n content.gsub!('&', '&')\n\n # 'unmark' our pre-escaped entities\n content.gsub!(/@@\\w+;/) {|t| t.gsub('@@', '&')}\n content.gsub!(/@@#\\d{4}/) {|t| t.gsub('@@', '&')}\n content.gsub!(/@@#\\d{3}/) {|t| t.gsub('@@', '&')}\n\n return content\n end",
"def escape_single_quotes(str_to_escape)\n # Hash containing the required conversion\n conversions = {\n %r{'}=>'%26apos;'\n } \n escaped_str = str_to_escape\n conversions.each do |x,y|\n escaped_str = escaped_str.gsub(x,y)\n end \n return escaped_str\n end",
"def xml_escape(input); end",
"def html_encode\n require 'htmlentities'\n \n coder = HTMLEntities.new\n \n ret = coder.encode(self, :named)\n \n return ret\n end",
"def make_html_safe i_string\n\t\t\t# CGI::escapeHTML i_string.to_s\n\t\t\ti_string\n\t\tend",
"def esc(word)\n word.gsub(\"&\", \"&\").gsub(\"<\", \"<\")\n end",
"def decode_html()\n return self.gsub('<', '<').gsub('>', '>').gsub('&', '&')\n end",
"def h_(str)\n str.to_s.gsub(/['&\\\"<>]/, {\"'\"=>\"'\", \"&\"=>\"&\", '\"'=>\""\", \"<\"=>\"<\", \">\"=>\">\"})\n end",
"def normalize_entities(string)\n # Convert '&' to '&' only if it's not followed by an entity.\n string.gsub(/&(?!lt|gt|amp|quot|apos)/, '&')\n end",
"def html_safe(phrase)\n return h(phrase).gsub(/'/,''').gsub(/\\r\\n/,\"<br/>\")\n end",
"def html raw_text\n EscapeUtils.escape_html(decode_html(raw_text))\n end",
"def js_escape_html(html_content)\n return '' unless html_content\n javascript_mapping = { '\\\\' => '\\\\\\\\', '</' => '<\\/', \"\\r\\n\" => '\\n', \"\\n\" => '\\n', \"\\r\" => '\\n', '\"' => '\\\\\"', \"'\" => \"\\\\'\" }\n escaped_content = html_content.gsub(/(\\\\|<\\/|\\r\\n|[\\n\\r\"'])/){ |m| javascript_mapping[m] }\n escaped_content = escaped_content.html_safe if html_content.html_safe?\n escaped_content\n end",
"def my_html_escape(org_value)\n '' if org_value.nil?\n ERB::Util.html_escape(org_value). # Standard-Escape kann kein NewLine-><BR>\n gsub(/\\n/, '<br>'). # Alle vorkommenden NewLine ersetzen\n gsub(/\\r/, '') # Alle vorkommenden CR ersetzen, führt sonst bei Javascript zu Error String not closed\n end",
"def correct_unncessarily_escaped_html_tags(element)\n statement = element.statement\n [:sup, :i].each do |tag|\n statement.gsub!(/<#{tag}>/,%Q{<#{tag}>})\n statement.gsub!(/<\\/#{tag}>/,%Q{</#{tag}>})\n end\n element.instance_variable_set(:@statement,statement)\n end",
"def xml_attr_escape\n replacements = {\"<\" => \"<\", \">\" => \">\", \"&\" => \"&\", \"\\\"\" => \""\", \"'\" => \"'\"}\n gsub(/([<>&\\'\\\"])/) { replacements[$1] }\n end",
"def convert_string(text)\n CGI.escapeHTML text\n end",
"def escape_special_chars(data)\n data = data.dup\n data.gsub! /&/n , \"&\"\n data.gsub! /\\\"/n , \""\"\n data.gsub! />/n , \">\"\n data.gsub! /</n , \"<\"\n data.gsub! /'/ , \"'\"\n return data\n end",
"def unescapeHTML(string)\n str = string.dup\n str.gsub!(/&(.*?);/n) {\n match = $1.dup\n case match\n when /\\Aamp\\z/ni then '&'\n when /\\Aquot\\z/ni then '\"'\n when /\\Agt\\z/ni then '>'\n when /\\Alt\\z/ni then '<'\n when /\\A#(\\d+)\\z/n then Integer($1).chr\n when /\\A#x([0-9a-f]+)\\z/ni then $1.hex.chr\n end\n }\n str\nend",
"def ae_some_html(s)\n return '' if s.nil? \n \n # converting newlines\n s.gsub!(/\\r\\n?/, \"\\n\")\n \n # escaping HTML to entities\n s = s.to_s.gsub('&', '&').gsub('<', '<').gsub('>', '>')\n \n # blockquote tag support\n s.gsub!(/\\n?<blockquote>\\n*(.+?)\\n*<\\/blockquote>/im, \"<blockquote>\\\\1</blockquote>\")\n \n # other tags: b, i, em, strong, u\n %w(b i em strong u).each { |x|\n s.gsub!(Regexp.new('<(' + x + ')>(.+?)</('+x+')>',\n Regexp::MULTILINE|Regexp::IGNORECASE), \n \"<\\\\1>\\\\2</\\\\1>\")\n }\n \n # A tag support\n # href=\"\" attribute auto-adds http://\n s = s.gsub(/<a.+?href\\s*=\\s*['\"](.+?)[\"'].*?>(.+?)<\\/a>/im) { |x|\n '<a href=\"' + ($1.index('://') ? $1 : 'http://'+$1) + \"\\\">\" + $2 + \"</a>\"\n }\n \n # replacing newlines to <br> ans <p> tags\n # wrapping text into paragraph\n s = \"<p>\" + s.gsub(/\\n\\n+/, \"</p>\\n\\n<p>\").\n gsub(/([^\\n]\\n)(?=[^\\n])/, '\\1<br />') + \"</p>\"\n \n s \n end",
"def ae_some_html(s)\n return '' if s.nil? \n \n # converting newlines\n s.gsub!(/\\r\\n?/, \"\\n\")\n \n # escaping HTML to entities\n s = s.to_s.gsub('&', '&').gsub('<', '<').gsub('>', '>')\n \n # blockquote tag support\n s.gsub!(/\\n?<blockquote>\\n*(.+?)\\n*<\\/blockquote>/im, \"<blockquote>\\\\1</blockquote>\")\n \n # other tags: b, i, em, strong, u\n %w(b i em strong u).each { |x|\n s.gsub!(Regexp.new('<(' + x + ')>(.+?)</('+x+')>',\n Regexp::MULTILINE|Regexp::IGNORECASE), \n \"<\\\\1>\\\\2</\\\\1>\")\n }\n \n # A tag support\n # href=\"\" attribute auto-adds http://\n s = s.gsub(/<a.+?href\\s*=\\s*['\"](.+?)[\"'].*?>(.+?)<\\/a>/im) { |x|\n '<a href=\"' + ($1.index('://') ? $1 : 'http://'+$1) + \"\\\">\" + $2 + \"</a>\"\n }\n \n # replacing newlines to <br> ans <p> tags\n # wrapping text into paragraph\n s = \"<p>\" + s.gsub(/\\n\\n+/, \"</p>\\n\\n<p>\").\n gsub(/([^\\n]\\n)(?=[^\\n])/, '\\1<br />') + \"</p>\"\n \n s \n end",
"def escape_quotes(unfiltered)\n unfiltered.to_s.gsub(/'/, \"''\")\n end",
"def escape(str)\n str.to_s.gsub(/\\\\/, '\\&\\&').gsub(/'/, \"''\").force_encoding('US-ASCII')\n end",
"def escape_for_single_quotes(str)\n str.gsub \"'\", \"''\"\n end",
"def h(str)\n CGI.escapeHTML(str)\n end",
"def h(str)\n CGI.unescape_html(str.to_s)\n .gsub('&', '&')\n .gsub('\"', '"')\n .gsub('<', '<')\n .gsub('>', '>')\n end",
"def reverse_html_tags\n self.gsub('<', \"<\").gsub('>', \">\")\n end",
"def hsc(str)\n str.gsub(/&/, \"&\")\n .gsub(/</, \"<\")\n .gsub(/>/, \">\")\n .gsub(/\"/, \""\")\n .gsub(/'/, \"'\")\n end",
"def encode_if_text(item)\n if item.respond_to?(:gsub)\n CGI.escapeHTML(item)\n else\n item\n end\n end",
"def _wp_specialchars(string, quote_style = :ENT_NOQUOTES, charset = false, double_encode = false)\n string = string.to_s\n\n return '' if string == ''\n\n # Don't bother if there are no specialchars - saves some processing\n return string unless string =~ /[&<>\"']/\n\n \t# Account for the previous behaviour of the function when the $quote_style is not an accepted value\n if quote_style.blank?\n quote_style = :ENT_NOQUOTES\n elsif ![0, 2, 3, 'single', 'double' ].include? quote_style\n quote_style = :ENT_QUOTES\n end\n\n # TODO continue implement function _wp_specialchars\n\t # Store the site charset as a static to avoid multiple calls to wp_load_alloptions()\n\t unless charset\n\t \t# static $_charset = null;\n\t# \tif ( ! isset( $_charset ) ) {\n\t# \t\t$alloptions = wp_load_alloptions();\n\t# \t\t$_charset = isset( $alloptions['blog_charset'] ) ? $alloptions['blog_charset'] : '';\n\t# \t}\n\t# \t$charset = $_charset;\n charset = get_option('blog_charset')\n\t end\n\n charset = 'UTF-8' if ['utf8', 'utf-8', 'UTF8'].include?(charset)\n\n\t_quote_style = quote_style\n\n\tif quote_style == 'double'\n\t\tquote_style = :ENT_COMPAT\n\t\t_quote_style = :ENT_COMPAT\n\t elsif quote_style == 'single'\n\t\tquote_style = :ENT_NOQUOTES\n\tend\n\n\tunless double_encode\n\t\t# Guarantee every &entity; is valid, convert &garbage; into &garbage;\n\t\t# This is required for PHP < 5.4.0 because ENT_HTML401 flag is unavailable.\n\t\tstring = wp_kses_normalize_entities(string)\n\tend\n\n string = h(string)\n\t# TODO string = @htmlspecialchars( $string, $quote_style, $charset, $double_encode )\n\n\t# Back-compat.\n\tif 'single' == _quote_style\n\t\tstring = string.gsub(\"'\", ''')\n end\n\n string\n end",
"def html_text(str)\n str.gsub(/[&<>]/) {|ch| HTML_TEXT_ESCAPE_HASH[ch] }\n end"
] |
[
"0.7659324",
"0.7431817",
"0.7410545",
"0.73798484",
"0.72654486",
"0.7259068",
"0.72082597",
"0.7204409",
"0.7168063",
"0.71091866",
"0.7028644",
"0.7019925",
"0.69891906",
"0.69772464",
"0.697479",
"0.6972722",
"0.6940584",
"0.6871477",
"0.6854818",
"0.6830356",
"0.6830356",
"0.68164855",
"0.6752011",
"0.6728246",
"0.6728246",
"0.672755",
"0.67218256",
"0.66521966",
"0.66122",
"0.65831167",
"0.6507832",
"0.64465195",
"0.641422",
"0.63863575",
"0.63817036",
"0.6374266",
"0.6369992",
"0.6344445",
"0.63285273",
"0.6274101",
"0.6244985",
"0.6234577",
"0.6233948",
"0.62315065",
"0.62261564",
"0.62028867",
"0.6190217",
"0.61808395",
"0.61675346",
"0.6161383",
"0.6160872",
"0.6159289",
"0.61590207",
"0.61560816",
"0.61069834",
"0.6086335",
"0.6054935",
"0.60507685",
"0.60309976",
"0.6020934",
"0.60149175",
"0.60122925",
"0.59807605",
"0.5979338",
"0.59691775",
"0.595827",
"0.59402347",
"0.59325325",
"0.5918458",
"0.5909835",
"0.59020674",
"0.58691144",
"0.58622074",
"0.58449346",
"0.5829829",
"0.58277655",
"0.5824259",
"0.58064955",
"0.57981116",
"0.5792831",
"0.5776836",
"0.5768993",
"0.575541",
"0.57278013",
"0.57243115",
"0.57145315",
"0.5706437",
"0.5699344",
"0.5698005",
"0.5698005",
"0.5678099",
"0.56716406",
"0.5658822",
"0.5655131",
"0.5651785",
"0.56334126",
"0.5616916",
"0.5609371",
"0.5603773",
"0.55808896"
] |
0.7269618
|
4
|
A utility method for escaping XML names of tags and names of attributes. xml_name_escape('1 "1___2___3" It follows the requirements of the specification:
|
def xml_name_escape(name)
name = name.to_s
return "" if name.blank?
return name if name.match?(SAFE_XML_TAG_NAME_REGEXP)
starting_char = name[0]
starting_char.gsub!(INVALID_TAG_NAME_START_REGEXP, TAG_NAME_REPLACEMENT_CHAR)
return starting_char if name.size == 1
following_chars = name[1..-1]
following_chars.gsub!(INVALID_TAG_NAME_FOLLOWING_REGEXP, TAG_NAME_REPLACEMENT_CHAR)
starting_char << following_chars
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def xml_escape(input); end",
"def escape_name(name)\n escaped_name = \"\"\n name.each_char do |char|\n if (char =~ /[-A-Za-z0-9_]/) != nil\n escaped_name += char\n else\n converted_char = TAG_NAME_MAP[char]\n if not converted_char\n msg = \"Bad character '#{char}' in tag '#{name}'\"\n puts(\"*** #{msg}\")\n raise FatalException.new(msg)\n end\n escaped_name += converted_char\n end\n end\n return escaped_name\n end",
"def xml_attr_escape\n replacements = {\"<\" => \"<\", \">\" => \">\", \"&\" => \"&\", \"\\\"\" => \""\", \"'\" => \"'\"}\n gsub(/([<>&\\'\\\"])/) { replacements[$1] }\n end",
"def xml_escape(input)\n return input.to_s.to_xs\n end",
"def escape_xml(value)\n value.to_s.gsub(/[&<>\"']/) { |s| ESCAPE_TABLE[s] } # or /[&<>\"']/\n end",
"def escape_xml(xml_in) \n return xml_in.gsub(/&/,'&').gsub(/</,'<')\n end",
"def escape_xml(string)\n string.gsub!(\"&\", \"&\")\n string.gsub!(\"<\", \"<\")\n string.gsub!(\">\", \">\")\n string.gsub!(\"'\", \"'\")\n string.gsub!(\"\\\"\", \""\")\n\n return string\n end",
"def escape_xml(string) \n string.gsub(/[&<>\\'\\\"]/) do | match |\n case match\n when '&' then '&'\n when '<' then '<'\n when '>' then '>'\n when '\"' then '"'\n when \"'\" then '''\n end\n end \n end",
"def escape_xml(text)\n text.encode(xml: :text)\n end",
"def tagattr(name, expr, value=nil, escape=true)\n if !expr\n return ''\n elsif escape\n return \" #{name}=\\\"#{escape_xml((value || expr).to_s)}\\\"\"\n else\n return \" #{name}=\\\"#{value || expr}\\\"\"\n end\n end",
"def fix_node_name(name)\n# name.gsub(/[^a-zA-Z0-9]/, \"_\")\n \"\\\"#{name}\\\"\"\nend",
"def force_correct_attribute_escaping!(node)\n return unless Nokogiri::VersionInfo.instance.libxml2?\n\n node.attribute_nodes.each do |attr_node|\n next unless LibxmlWorkarounds::BROKEN_ESCAPING_ATTRIBUTES.include?(attr_node.name)\n\n tag_name = LibxmlWorkarounds::BROKEN_ESCAPING_ATTRIBUTES_QUALIFYING_TAG[attr_node.name]\n next unless tag_name.nil? || tag_name == node.name\n\n #\n # this block is just like CGI.escape in Ruby 2.4, but\n # only encodes space and double-quote, to mimic\n # pre-2.9.2 behavior\n #\n encoding = attr_node.value.encoding\n attr_node.value = attr_node.value.gsub(/[ \"]/) do |m|\n \"%\" + m.unpack(\"H2\" * m.bytesize).join(\"%\").upcase\n end.force_encoding(encoding)\n end\n end",
"def escape_attr input\n escape input, attr_regexp, attr_mapping\n end",
"def escape_xml_data(xml_data)\n xml_data = xml_data.gsub(\"\\n\", \"\")\n xml_data = xml_data.gsub(\"\\n\", \"\")\n xml_data = xml_data.gsub(/[\\>]([ ])*[\\<]/, \"><\")\n return xml_data\n\n end",
"def escape_spaces(name)\n name.gsub(' ', '\\ ')\n end",
"def xml_serialize_name_proc(opts=OPTS)\n pr = if opts[:name_proc]\n opts[:name_proc]\n elsif opts[:dasherize]\n DASHERIZE\n elsif opts[:camelize]\n CAMELIZE\n else\n IDENTITY\n end\n proc{|s| \"#{pr[s]}_\"}\n end",
"def escape(input); input.to_s.gsub('\"', '\\\\\"'); end",
"def to_XmlName\n s = to_String\n if s =~ /^[_@]/\n to_AttributeName( s.shift )\n else\n QName.new(s)\n end\n end",
"def uri_escape\n str = xml_escape.gsub(/\\+/, '+')\n str = str.gsub(/\\s/, '+')\n end",
"def encode_attr(name)\n \"a$\" + @attribute_name_generator.get(name.to_s)\n end",
"def _escape(text)\n ensure_mutable = text.is_a?(BuilderMutableString) ? text : BuilderMutableString.new(text)\n ensure_mutable.to_xs\n end",
"def to_valid_tag(name)\n name.gsub(/[^a-zA-Z_\\-\\:\\.\\d\\/]/, \"__\")\n end",
"def valid_xml_attribute(name, options={:level => :warning})\n\t\t\t\tvalidate(\"Invalid XML attribute '#{name}'\", options) { name.to_s.match(/^([^[:punct:]0-9<>]|_)[^<>\"']*/) }\n\t\t\tend",
"def escape(s)\n s.gsub(/[&<>`]/, \"&\" => \"&\", \"<\" => \"<\", \">\" => \">\", \"`\" => \"`\")\n end",
"def html_name\n require 'cgi'\n\n CGI.escape(@name.gsub('-', '-2D')).gsub('%','-').sub(/^-/, '')\n end",
"def uri_escape(input); end",
"def escape(text)\n text.gsub('\"', '\\\"')\nend",
"def sanitize(name)\n #name.gsub(\".\", \"_\").gsub(/<.+>/, \"\")\n name.gsub(\".\", \"_\").gsub(\"$\", \"_\")\nend",
"def valid_xml_element(name, options={:level => :error})\n\t\t\t\tvalidate(\"Invalid XML element '#{name}'\", options) { name.to_s.match(/^([^[:punct:]0-9<>]|_)[^<>\"']*/) }\n\t\t\tend",
"def to_xml(xml=Builder::XmlMarkup.new)\n attributes = {}\n attributes['Format'] = format unless format.nil?\n attributes['SPNameQualifier'] = sp_name_qualifier unless sp_name_qualifier.nil?\n attributes['AllowCreate'] = allow_create unless allow_create.nil?\n xml.tag!('samlp:NameIDPolicy', attributes)\n end",
"def name_to_param(name)\n # convert good words (wrapped in pipes) to dashes\n name.gsub!(/(_?)\\|(\\w+)\\|(_?)/) { \"#{Regexp.last_match[1]}#{Regexp.last_match[2].dasherize}#{Regexp.last_match[3]}\" }\n\n # split words on underscores, wrap in brackets, and convert good words back to underscores\n name = name.split('_').map.with_index do |word, index|\n word = word.gsub(/(?<!new)index/, '').underscore\n if index == 0\n word\n else\n \"[#{word}]\"\n end\n end\n\n # join wrapped words\n name.join\n end",
"def html_escape(s)\n s.to_s.gsub(/&/, \"&\").gsub(/\\\"/, \""\").gsub(/>/, \">\").gsub(/</, \"<\")\n end",
"def html_escape(text)\n text.to_s.gsub(/[\\\"><&]/) { |s| HTML_ESCAPE[s] }\n end",
"def _prepareName ( name )\n name.to_s.gsub /[\\W]/, ''\n end",
"def attribute_parse_naming\n XML_ATTRIBUTE_PARSE_NAMING\n end",
"def test_encoding\n\tassert_equal('x & x', NQXML.encode('x & x'))\n\tassert_equal('x ' x', NQXML.encode('x \\' x'))\n\tassert_equal('x <"> x', NQXML.encode('x <\"> x'))\n end",
"def sanitize_name(name)\n name.gsub!(' ', '_')\n name.downcase!\n name.gsub!('-', '_')\n name.gsub!('\\'', '_')\n name\n end",
"def xml_attr_rewrite(xml, name, value)\n xml.find(\"//osm/node\").first[name] = value.to_s\n xml\n end",
"def name_parse_special_characters(val)\n use_this = val.dup\n\n # Ensure that we don't have special characters at end of name\n while [\"!\",\"/\",\"*\"].include?(use_this.to_s[-1,1]) do\n # Will this node contain escaped XML?\n if use_this.to_s[-1,1] == '!'\n @escape_xml = false\n use_this.chop!\n end\n\n # Will this be a self closing node?\n if use_this.to_s[-1,1] == '/'\n @self_closing = true\n use_this.chop!\n end\n\n # Will this node contain a collection of sibling nodes?\n if use_this.to_s[-1,1] == '*'\n @content_type = \"collection\"\n use_this.chop!\n end\n end\n\n return use_this\n end",
"def escape(text)\n return text.gsub(/[\\`*_{}\\[\\]()#+\\-.!]/, \"\\\\\\\\\\\\0\")\n end",
"def escape(str); end",
"def escape(text)\n if !text.kind_of?(String)\n if text.respond_to?(:to_str)\n text = text.to_str\n else\n text = test.to_s\n end\n end\n # TODO: Verify that this is sufficient, gut feeling says no.\n text.gsub(/\\</, \"<\")\n end",
"def quoted_identifier(name)\n \"\\\"#{name.to_s.upcase}\\\"\"\n end",
"def escape(x)\n x = x.to_s\n x.gsub! @delimiter, @edelim if @delimiter\n x.gsub! @internal_delimiter, @eidelim\n x\n end",
"def escape(s)\n s.gsub('\"', '\\\"')\nend",
"def html_escape(s)\n s.to_s.gsub(/[&\"><]/) { |special| HTML_ESCAPE[special] }\n end",
"def clean_name(name)\n CGI.escape(name).gsub('.', '')\n end",
"def escape(s)\n s.to_s.gsub('\"', '"').gsub(\"'\", ''')\n end",
"def escape(value)\n $db.escape_identifier(value)\nend",
"def escape(string); end",
"def name=(val)\n write_attribute(:name, CGI.escapeHTML(val))\n end",
"def html_name\n CGI.escape(@new_name.gsub('-', '-2D')).gsub('%','-').sub(/^-/, '')\n end",
"def escape_quotes input\n\t\tinput.gsub!(/([\\'\\\"])/,\"\\\\\\1\") #single quote\n\t\t\n\t\treturn input\n\tend",
"def quoted_identifier(name)\n \"[#{name}]\"\n end",
"def clean_tag(name)\n name.gsub( /[^-.,_[:alnum:]]/, '_' )\n end",
"def escaped_title(title)\n title.gsub(/([\\[\\]\\(\\)])/){ '\\\\' + $1 }\n end",
"def _sanitize_name(name)\n name.to_s.tr_s('^a-zA-Z0-9', '_')\n end",
"def sanitize_attribute_name(name)\n name.gsub(/[^\\w\\-_]/, '').downcase\n end",
"def attribute_render_naming\n XML_ATTRIBUTE_RENDER_NAMING\n end",
"def write_xml(xml, value)\n xml.attributes[name] = value.to_s\n end",
"def safe_name(name)\n @@safe_names[name] || @@safe_names[name] = name.gsub(/[^a-zA-Z0-9_]/) do |s|\n \"__#{Character.getName(s[0].to_i).gsub(/[^a-zA-Z0-9_]/, '_').downcase!}\"\n end\n end",
"def esc(word)\n word.gsub(\"&\", \"&\").gsub(\"<\", \"<\")\n end",
"def format_attribute_name name\n return name if name !~ /_/ && name =~ /[A-Z]+.*/\n name.split('_').map{ |e| e.capitalize }.join \n end",
"def escape_quotes(unfiltered)\n unfiltered.to_s.gsub(/'/, \"''\")\n end",
"def xpath_sanitize(text)\n # If there's nothing to escape, just wrap text in single-quotes\n if !text.include?(\"'\")\n return \"'#{text}'\"\n else\n result = text.gsub(/'/, %{', \"'\", '})\n return \"concat('#{result}')\"\n end\n end",
"def html_escape(clean_me)\n clean_me.to_s.gsub(/[&\"<>]/) do |special|\n { '&' => '&',\n '>' => '>',\n '<' => '<',\n '\"' => '"' }[special]\n end\n end",
"def html_escape(html)\n html.to_s.gsub(/[&\"><]/) { |special| HTML_ESCAPE[special] }\n end",
"def quote_identifier(name)\n quote_identifiers? ? quoted_identifier(name) : name.to_s\n end",
"def sanitize_name\n self.name = Tag.sanitize_name(self.name)\n end",
"def begintag(name, attributes=[])\r\n\tattribs = \"\"\r\n\tif (!attributes.empty)\r\n\t\tattributes.each do |(key,value)| \r\n\t\t\tattribs = \" #{key.strip}=\\\"#{value.strip}\\\"\"\r\n\t\tend\r\n\tend\r\n\treturn \"<\" + name.strip + \" \" + attribs + \">\"\r\nend",
"def make_xml(item, separator: \"\\n\", name: nil, serializer: nil)\n if item.is_a?(Hash)\n serializer ||= Search::Api::Serializer::Xml.new\n make_opt = { separator: separator, serializer: serializer }\n # @type [Symbol] k\n # @type [Any] v\n item.map { |k, v|\n value = make_xml(v, **make_opt)\n next if value.nil? && !serializer.render_nil?\n name = serializer.element_render_name(k)\n value = \"#{separator}#{value}#{separator}\" if value.end_with?('>')\n \"<#{name}>#{value}</#{name}>\"\n }.compact.join(separator).presence\n\n elsif item.is_a?(Array)\n serializer ||= Search::Api::Serializer::Xml.new\n make_opt = { separator: separator, serializer: serializer }\n item.map { |v| make_xml(v, **make_opt) }.compact.join(separator).presence\n\n elsif item.respond_to?(:to_xml)\n return if item.blank?\n serializer ||= item.serializer(:xml)\n name ||= serializer.element_render_name(item)\n remove_xml_prolog(item.to_xml(wrap: name))\n\n elsif !item.nil?\n CGI.escape_html(item.to_s)\n end\n end",
"def esc_attr(text)\n\t safe_text = wp_check_invalid_utf8( text )\n\t safe_text = _wp_specialchars( safe_text, :ENT_QUOTES )\n # Filters a string cleaned and escaped for output in an HTML attribute.\n # Text passed to esc_attr() is stripped of invalid or special characters before output.\n Railspress::Plugin.apply_filters('attribute_escape', safe_text, text )\n end",
"def escape(s); s.to_s.gsub(/([^ a-zA-Z0-9_.-]+)/n){'%'+$1.unpack('H2'*$1.size).join('%').upcase}.tr(' ', '+') end",
"def xml_for(name, tags_and_values)\n xml = Builder::XmlMarkup.new\n xml.instruct!\n xml.tag!(javaize_key(name), 'xmlns' => XML_NAMESPACE, 'version' => API_VERSION) { xml_from_array(xml, tags_and_values) }\n xml.target!\n end",
"def uri_escape(uri)\n URI::DEFAULT_PARSER.escape(uri).gsub('[', '%5B').gsub(']', '%5D')\n end",
"def escape_filename(text)\n # NOTE: only leading [+>] are escaped (according to builtin :h fnameescape).\n # [-] is escaped when it's the only char in a name (to prevent confusion\n # with `cd -` argument)\n text\n .to_s\n .gsub(/([\\t\\n *%$'\"<{\\[\\\\])/, '\\\\\\\\\\1')\n .sub(/^([+>])/, '\\\\\\\\\\1')\n .sub(/^-$/, '\\\\-')\n end",
"def sanitize_name(str)\n str.gsub(' ','_').downcase.gsub(\"&\", \"and\")\n end",
"def escape(value)\n end",
"def likeEscape( str )\n str.gsub( \"\\\\\", \"\\\\\\\\\" ).gsub( \"%\", \"\\%\" ).gsub( \"_\", \"\\_\" )\n end",
"def cdata_escape(input)\n input.gsub(/<!\\[CDATA\\[/, '<![CDATA[').gsub(/\\]\\]>/, ']]>')\n end",
"def sanitize_sql_name(*name)\n name.join('_').presence&.gsub(/\\d/) { |d| DIGIT_TO_ALPHA[d] || '_' }\n end",
"def parameter_notations(name)\n escaped_name = Regexp.escape(name)\n type = /<[^>]+>/\n /(#{escaped_name}|#{escaped_name}#{type})/\n end",
"def html_escape(text)\n Rack::Utils.escape_html(text)\n end",
"def test_values_with_apostrophes\n doc = Document.new(%q#<tag h1=\"1'2'\" h2='1\"2'/>#)\n s = doc.to_s\n assert(s =~ /h1='1'2''/)\n assert(s =~ /h2='1\"2'/)\n end",
"def latex_escape(s)\n quote_count = 0\n s.to_s.\n gsub(/([{}_$&%#])/, \"__LATEX_HELPER_TEMPORARY_BACKSLASH_PLACEHOLDER__\\\\1\").\n gsub(/\\\\/, BACKSLASH).\n gsub(/__LATEX_HELPER_TEMPORARY_BACKSLASH_PLACEHOLDER__/, BS).\n gsub(/\\^/, HAT).\n gsub(/~/, TILDE).\n gsub(/\"/) do\n quote_count += 1\n quote_count.odd? ? %{\"`} : %{\"'}\n end\n end",
"def xml_deserialize_name_proc(opts=OPTS)\n if opts[:name_proc]\n opts[:name_proc]\n elsif opts[:underscore]\n UNDERSCORE\n else\n IDENTITY\n end\n end",
"def consume_name\n result = ''\n\n while true\n if match = @s.scan(RE_NAME)\n result << match\n next\n end\n\n char = @s.peek\n\n if char == '\\\\' && valid_escape?\n @s.consume\n result << consume_escaped\n\n # NON-STANDARD: IE * hack\n elsif @options[:preserve_hacks] && char == '*'\n result << @s.consume\n\n else\n return result\n end\n end\n end",
"def markup_escape(text)\n table_for_escape = {\n \"&\" => \"&\",\n \"<\" => \"<\",\n \">\" => \">\",\n }\n text.gsub(/[&<>]/, table_for_escape)\n end",
"def sanitize(name)\n name = name.force_encoding(Encoding::UTF_8)\n name = name.gsub(\"\\\\\", \"/\") # work-around for IE\n name = File.basename(name)\n name = name.gsub(sanitize_regexp, \"_\")\n name = \"_#{name}\" if name =~ /\\A\\.+\\z/\n name = \"unnamed\" if name.size == 0\n return name.mb_chars.to_s\n end",
"def xml_full_name(name, context_el)\n if name.start_with? '#'\n name = context_el.namespaces[\"xmlns\"] + name\n name.gsub!('##', '#') # remove '##' if ns also ends in '#'\n end\n name\n end",
"def _escape (addr)\n addr =~ /\\\\./ ? addr\n : addr =~ /\\.\\*/ ? addr.gsub(/\\*/, '\\d+').gsub(/\\./, '\\.')\n : Regexp.escape(addr)\nend",
"def escape_text(text)\n text\n end",
"def quote_and_escape(text, quote = '\"')\n \"#{quote}#{text.gsub(/#{quote}/) { |m| \"#{m}\\\\#{m}#{m}\" }}#{quote}\"\n end",
"def escape page_name\n page_name.gsub(/ /, \"-\").tr(\"A-ZÄÖÜ\", \"a-zäöü\")\nend",
"def escape_quotes(text)\n text.gsub(\"'\", \"''\")\n end",
"def html_escape(str)\r\n str.gsub('&', '&').str('<', '<').str('>', '>').str('\"', '"')\r\nend",
"def cdata_escape(input)\n input.gsub(/<!\\[CDATA\\[/, '<![CDATA[').gsub(/\\]\\]>/, ']]>')\n end",
"def unescape_xml(text)\n CGI.unescape_html text\n end",
"def escape(str)\n str.to_s.gsub(/\\\\/, '\\&\\&').gsub(/'/, \"''\").force_encoding('US-ASCII')\n end",
"def sanitize(name)\n name = name.scrub\n name = name.tr(\"\\\\\", \"/\") # work-around for IE\n name = File.basename(name)\n name = name.gsub(sanitize_regexp, \"_\")\n name = \"_#{name}\" if name =~ /\\A\\.+\\z/\n name = \"unnamed\" if name.size.zero?\n name.mb_chars.to_s\n end"
] |
[
"0.6893634",
"0.6816913",
"0.667457",
"0.6610737",
"0.62776357",
"0.6230387",
"0.6137847",
"0.6127742",
"0.6103563",
"0.59219015",
"0.5745236",
"0.57385474",
"0.56709146",
"0.5514325",
"0.5474733",
"0.5453317",
"0.53750974",
"0.5334463",
"0.52972114",
"0.51998824",
"0.519555",
"0.5184583",
"0.51435095",
"0.5104583",
"0.5100338",
"0.50981325",
"0.50525445",
"0.50448346",
"0.5041624",
"0.5032924",
"0.50048107",
"0.49871755",
"0.49793348",
"0.49774882",
"0.4972062",
"0.49660793",
"0.49636084",
"0.49515322",
"0.49496108",
"0.4944954",
"0.4942429",
"0.49387825",
"0.49338228",
"0.49241167",
"0.49211398",
"0.49190664",
"0.49109837",
"0.49086952",
"0.49049428",
"0.49024308",
"0.48916283",
"0.489038",
"0.4888754",
"0.48797035",
"0.48728287",
"0.4872148",
"0.48460364",
"0.48405075",
"0.48336414",
"0.4825115",
"0.48154467",
"0.4802262",
"0.47994587",
"0.47967616",
"0.47903624",
"0.47866458",
"0.4781196",
"0.47767463",
"0.4775943",
"0.47758144",
"0.47708052",
"0.47510248",
"0.47495323",
"0.4724432",
"0.47077703",
"0.46998197",
"0.4692615",
"0.4690828",
"0.46864638",
"0.46765754",
"0.4673887",
"0.46689457",
"0.46638677",
"0.46632925",
"0.4653659",
"0.464885",
"0.46482477",
"0.46478426",
"0.46457896",
"0.46367508",
"0.46361643",
"0.46351945",
"0.46270812",
"0.46234244",
"0.46056077",
"0.4594962",
"0.45912614",
"0.45846093",
"0.45638546",
"0.45626718"
] |
0.8096469
|
0
|
ps:dynos [QTY] DEPRECATED: use `heroku ps:scale dynos=N` scale to QTY web processes if QTY is not specified, display the number of web processes currently running Example: $ heroku ps:dynos 3 Scaling dynos... done, now running 3
|
def dynos
# deprecation notice added to v2.21.3 on 03/16/12
display("~ `heroku ps:dynos QTY` has been deprecated and replaced with `heroku ps:scale dynos=QTY`")
dynos = shift_argument
validate_arguments!
if dynos
action("Scaling dynos") do
new_dynos = api.put_dynos(app, dynos).body["dynos"]
status("now running #{new_dynos}")
end
else
app_data = api.get_app(app).body
if app_data["stack"] == "cedar"
raise(Heroku::Command::CommandFailed, "For Cedar apps, use `heroku ps`")
else
display("#{app} is running #{quantify("dyno", app_data["dynos"])}")
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def scale\n app = extract_app\n current_process = nil\n changes = args.inject({}) do |hash, process_amount|\n if process_amount =~ /^([a-zA-Z0-9_]+)([=+-]\\d+)$/\n hash[$1] = $2\n end\n hash\n end\n\n error \"Usage: heroku ps:scale web=2 worker+1\" if changes.empty?\n\n changes.each do |process, amount|\n display \"Scaling #{process} processes... \", false\n amount.gsub!(\"=\", \"\")\n new_qty = heroku.ps_scale(app, :type => process, :qty => amount)\n display \"done, now running #{new_qty}\"\n end\n end",
"def scale\n requires_preauth\n\n changes = args.map do |arg|\n if change = arg.scan(/^([a-zA-Z0-9_]+)([=+-]\\d+)(?::([\\w-]+))?$/).first\n formation, quantity, size = change\n quantity = quantity[1..-1].to_i if quantity[0] == \"=\"\n { \"type\" => formation, \"quantity\" => quantity, \"size\" => size}\n end\n end.compact\n\n if changes.empty?\n display_dyno_formation(get_formation)\n else\n action(\"Scaling dynos\") do\n new_scales = scale_dynos(get_formation, changes)\n .map {|p| \"#{p[\"type\"]} at #{p[\"quantity\"]}:#{p[\"size\"]}\" }\n status(\"now running \" + new_scales.join(\", \") + \".\")\n end\n end\n end",
"def scale\n release = options[:version]\n changes = {}\n args.each do |arg|\n if arg =~ /^([a-zA-Z0-9_]+)([=+-]\\d+)$/\n changes[$1] = $2\n end\n end\n\n if changes.empty?\n error(\"Usage: heroku ps:scale PROCESS1=AMOUNT1 [PROCESS2=AMOUNT2 ...]\\nMust specify PROCESS and AMOUNT to scale.\")\n end\n\n changes.keys.sort.each do |process|\n amount = changes[process]\n action(\"Scaling #{process} processes\") do\n amount.gsub!(\"=\", \"\")\n new_qty = api.request(\n :expects => 200,\n :method => :post,\n :path => \"/apps/#{app}/ps/scale\",\n :query => {\n 'type' => process,\n 'qty' => amount,\n 'release' => release\n }\n ).body\n status(\"now running #{new_qty}\")\n end\n end\n end",
"def workers\n # deprecation notice added to v2.21.3 on 03/16/12\n display(\"~ `heroku ps:workers QTY` has been deprecated and replaced with `heroku ps:scale workers=QTY`\")\n\n workers = shift_argument\n validate_arguments!\n\n if workers\n action(\"Scaling workers\") do\n new_workers = api.put_workers(app, workers).body[\"workers\"]\n status(\"now running #{new_workers}\")\n end\n else\n app_data = api.get_app(app).body\n if app_data[\"stack\"] == \"cedar\"\n raise(Heroku::Command::CommandFailed, \"For Cedar apps, use `heroku ps`\")\n else\n display(\"#{app} is running #{quantify(\"worker\", app_data[\"workers\"])}\")\n end\n end\n end",
"def scale_dynos_down(dyno_name, count, current_count)\n dynos_for_type(dyno_name).sort_by { |d| d['elapsed'] }.reverse.take(current_count - count).each do |dyno|\n run_heroku_api_command(:post_ps_stop, app, { 'ps' => dyno['process'] })\n end\n end",
"def dyno\n @dyno ||= @analytics[:dynos].max_by {|name, count| count }\n end",
"def set_dynos(app_name, qty)\n deprecate # 07/31/2012\n put(\"/apps/#{app_name}/dynos\", :dynos => qty).to_s\n end",
"def workers(amount = nil)\n heroku = ::Heroku::API.new(:api_key => ENV['HEROKU_API_KEY'])\n #\n # Returns the amount of Delayed Job\n # workers that are currently running on Heroku\n if amount.nil?\n processes = heroku.get_ps(ENV['APP_NAME']).body.select {|p| p['process'] =~ /worker.[0-9]+/}.length\n HireFire::Logger.message(\"Queried Heroku for processes - result: #{processes}\")\n return processes\n end\n\n ##\n # Sets the amount of Delayed Job\n # workers that need to be running on Heroku\n return heroku.post_ps_scale(ENV['APP_NAME'], \"worker\", amount) \n\n rescue Exception\n # Heroku library uses rest-client, currently, and it is quite\n # possible to receive RestClient exceptions through the client.\n HireFire::Logger.message(\"Worker query request failed with #{ $!.class.name } #{ $!.message }\")\n nil\n end",
"def index\n validate_arguments!\n quota_resp = api.request(\n :expects => [200, 404],\n :method => :post,\n :path => \"/apps/#{app}/actions/get-quota\",\n :headers => {\n \"Accept\" => \"application/vnd.heroku+json; version=3.app-quotas\",\n \"Content-Type\" => \"application/json\"\n }\n )\n\n if quota_resp.status = 200\n quota = quota_resp.body\n now = Time.now.getutc\n quota_message = if quota[\"allow_until\"]\n \"Free quota left:\"\n elsif quota[\"deny_until\"]\n \"Free quota exhausted. Unidle available in:\"\n end\n if quota_message\n quota_timestamp = (quota[\"allow_until\"] ? Time.parse(quota[\"allow_until\"]).getutc : Time.parse(quota[\"deny_until\"]).getutc)\n time_left = time_remaining(Time.now.getutc, quota_timestamp)\n display(\"#{quota_message} #{time_left}\")\n end\n end\n\n processes_resp = api.request(\n :expects => 200,\n :method => :get,\n :path => \"/apps/#{app}/dynos\",\n :headers => {\n \"Accept\" => \"application/vnd.heroku+json; version=3\",\n \"Content-Type\" => \"application/json\"\n }\n )\n processes = processes_resp.body\n\n processes_by_command = Hash.new {|hash,key| hash[key] = []}\n processes.each do |process|\n now = Time.now\n type = process[\"type\"]\n elapsed = now - Time.iso8601(process['updated_at'])\n since = time_ago(now - elapsed)\n size = process[\"size\"] || \"1X\"\n\n if type == \"run\"\n key = \"run: one-off processes\"\n item = \"%s (%s): %s %s: `%s`\" % [ process[\"name\"], size, process[\"state\"], since, process[\"command\"] ]\n else\n key = \"#{type} (#{size}): `#{process[\"command\"]}`\"\n item = \"%s: %s %s\" % [ process['name'], process['state'], since ]\n end\n\n processes_by_command[key] << item\n end\n\n extract_run_id = /\\.(\\d+).*:/\n processes_by_command.keys.each do |key|\n processes_by_command[key] = processes_by_command[key].sort do |x,y|\n x.match(extract_run_id).captures.first.to_i <=> y.match(extract_run_id).captures.first.to_i\n end\n end\n\n processes_by_command.keys.sort.each do |key|\n styled_header(key)\n styled_array(processes_by_command[key], :sort => false)\n end\n end",
"def dynos_maxed_out?\n return false if @dynos_in_use.nil?\n @dynos_in_use >= NimbleNodes::Dynos.max\n end",
"def usage_by_ps\n memory = cmd(\"ps -o rsz #{process}\").split(\"\\n\")[1].to_f / 1.kilobyte\n return nil if memory <= 0\n\n memory\n end",
"def workers(amount = nil)\n\n #\n # Returns the amount of Delayed Job\n # workers that are currently running on Heroku\n if amount.nil?\n return heroku.get_ps(ENV['APP_NAME']).body.select {|p| p['process'] =~ /worker.[0-9]+/}.length\n end\n\n ##\n # Sets the amount of Delayed Job\n # workers that need to be running on Heroku\n return heroku.post_ps_scale(ENV['APP_NAME'], \"worker\", amount)\n\n rescue ::Heroku::API::Errors::Error\n HireFire::Logger.message(\"Worker query request failed with #{ $!.class.name } #{ $!.message }\")\n nil\n end",
"def stop\n dyno = shift_argument\n validate_arguments!\n\n message, options = case dyno\n when NilClass\n error(\"Usage: heroku ps:stop DYNO\\nMust specify DYNO to stop.\")\n when /.+\\..+/\n ps = args.first\n [\"Stopping #{ps} dyno\", { :ps => ps }]\n else\n type = args.first\n [\"Stopping #{type} dynos\", { :type => type }]\n end\n\n action(message) do\n api.post_ps_stop(app, options)\n end\n end",
"def processes\n process_cmd = case RUBY_PLATFORM\n when /djgpp|(cyg|ms|bcc)win|mingw/ then 'tasklist /v'\n when /solaris/ then 'ps -ef'\n else\n 'ps aux'\n end\n `#{process_cmd}`\nend",
"def current_proc_used_mem\n #pid, size = `ps ax -o pid,rss | grep -E \"^[[:space:]]*#{$$}\"`.strip.split.map(&:to_i)\n #`ps -o rss -p #{$$}`.chomp.split(\"\\n\").last.to_i\n #`ps -o rss -p #{$$}`.strip.split.last.to_i * 1024\n `ps -o rss= -p #{Process.pid}`.to_i \nend",
"def ps\n `ps haxo pid,ppid,cmd`\n end",
"def domain_cpus\n config[:cpus] || 1\n end",
"def memory_usage \n\t`ps -o rss= -p #{Process.pid}`.to_i # in kilobytes \nend",
"def get_memory_usage\n `ps -o rss= -p #{Process.pid}`.to_i\nend",
"def get_memory_usage\n `ps -o rss= -p #{Process.pid}`.to_i\nend",
"def ps_cmd(pid)\n case RbConfig::CONFIG['arch']\n when /solaris|bsd/\n `ps -o comm,ppid -p #{pid}`\n when /linux/\n `ps -o cmd,ppid #{pid}`\n else\n raise 'UnknownOS'\n end.split(\"\\n\").last.split\nend",
"def workers=(n)\n if n != @workers || !known?\n p \"Scaling #{type} to #{n}\"\n heroku_set_workers(n)\n know n\n end\n end",
"def call\n `ps -o rss -p #{@pid}`.split(\"\\n\").last.to_i\n end",
"def determine_processes\n procs = @shell.query('PROCESSES', 'ps aux')\n @info[:processes] = procs.gsub(/\\r/, '').split(/\\n/)\n end",
"def workers\n app = extract_app\n if workers = args.shift\n current = heroku.set_workers(app, workers)\n display \"#{app} now running #{quantify(\"worker\", current)}\"\n else\n workers = heroku.workers(app)\n display \"#{app} is running #{quantify(\"worker\", workers)}\"\n end\n end",
"def boss_kill_dkp\n kills.size * 5\n end",
"def idle_dynos?\n return false if @dynos_in_use.nil?\n @dynos_in_use < NimbleNodes::Dynos.size\n end",
"def cpus\n flavor[2]\n end",
"def get_current_memory_usage\n `ps -o rss= -p #{Process.pid}`.to_i\nend",
"def virtual_cpus\n domain_info[:nrVirtCpu]\n end",
"def virtual_cpus\n domain_info[:nrVirtCpu]\n end",
"def get_children_process(pid)\n\t`ps --ppid #{pid} | grep -v PID | awk '{print $1}'`.split(\"\\n\")\n\t#Could not find a Ruby way to do this\nend",
"def processes\n request('getAllProcessInfo')\n end",
"def os_x_raw_ps\n\t\t`COLUMNS=9999 ps ax -o \"pid uid ppid rss cpu command\"`\n\tend",
"def os_x_raw_ps\n\t\t`COLUMNS=9999 ps ax -o \"pid uid ppid rss cpu command\"`\n\tend",
"def os_x_processes\n\t\traw = os_x_raw_ps.split(\"\\n\").slice(1, 99999)\n\t\traw.map do |line|\n\t\t\tparse_ps(line)\n\t\tend\n\tend",
"def os_x_processes\n\t\traw = os_x_raw_ps.split(\"\\n\").slice(1, 99999)\n\t\traw.map do |line|\n\t\t\tparse_ps(line)\n\t\tend\n\tend",
"def dynos\n return @dynos.data if @dynos && @dynos.expires_at > Time.now\n @dynos = CacheEntry.new(get_dynos_from_api, Time.now + 60)\n @dynos.data\n end",
"def memory_usage\n `ps -o rss= -p #{ $PID }`.to_i\n end",
"def index\n app = extract_app\n ps = heroku.ps(app)\n\n objects = ps.sort_by do |p|\n t,n = p['process'].split('.')\n [t, n.to_i]\n end.each do |p|\n p['state'] << ' for ' << time_ago(p['elapsed']).gsub(/ ago/, '')\n p['command'] = truncate(p['command'], 36)\n end\n\n display_table(\n objects,\n ['process', 'state', 'command'],\n ['Process', 'State', 'Command']\n )\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 sysload\n sysmem = 0\n # the pops here is to not include the two \"process\" found with ps the command itself which are gone by time pmap occurs\n pid_array = `ps -ef | grep java`.split(/\\n/)\n pid_array.each do |jproc|\n if jproc.match(/script\\/server/)\n pid = jproc.match(/.+?([0-9]+)/)[1].to_i #pid\n sysmem += (`pmap #{pid} | tail -1`[10,40].strip.gsub!(\"K\",\"\").to_f*100.0) / (1024* `free -mt`.match(/Mem:\\s*([0-9]+)/)[1].to_f)\n end\n end\n\n render :text => sysmem\n end",
"def ps\n sql = %q(\n select\n procpid,\n application_name as source,\n age(now(),query_start) as running_for,\n waiting,\n current_query as query\n from pg_stat_activity\n where\n current_query <> '<insufficient privilege>'\n AND current_query <> '<IDLE>'\n and procpid <> pg_backend_pid()\n order by 3 desc\n )\n\n exec_sql(sql, find_uri)\n end",
"def stop\n app = extract_app\n opt =\n if (args.first =~ /.+\\..+/)\n ps = args.first\n display \"Stopping #{ps} process... \", false\n {:ps => ps}\n elsif args.first\n type = args.first\n display \"Stopping #{type} processes... \", false\n {:type => type}\n else\n error \"Usage: heroku ps:stop PROCESS\"\n end\n\n heroku.ps_stop(app, opt)\n display \"done\"\n end",
"def cpus(arg=nil)\n set_or_return(:cpus, arg, :kind_of => Integer)\n end",
"def restart\n dyno = shift_argument\n validate_arguments!\n\n message, options = case dyno\n when NilClass\n [\"Restarting dynos\", {}]\n when /.+\\..+/\n ps = args.first\n [\"Restarting #{ps} dyno\", { :ps => ps }]\n else\n type = args.first\n [\"Restarting #{type} dynos\", { :type => type }]\n end\n\n action(message) do\n api.post_ps_restart(app, options)\n end\n end",
"def dynamic_scaling_instance_count(test_value=nil)\n # return current instance count unless we're dynamic\n # >>///====/WHOOOSH/===//DYNAMISM!//>\n #\n return self.instances unless self.scaling.get(:mode) == 'dynamic'\n\n begin\n check_type = self.scaling.get('config.type')\n raise LoadError.new if check_type.nil?\n require \"harbormaster/lib/autoscaling/#{check_type}\"\n klass = (Harbormaster::Autoscaling.const_get(check_type.camelize) rescue nil)\n raise LoadError.new unless klass\n\n rv = klass.instance_count(self, test_value)\n self.last_checked_at = Time.now\n\n return (rv.nil? ? self.instances : rv)\n\n rescue LoadError\n Onering::Logger.error(\"Unable to find dynamic scaling check for type #{check_type}\")\n return self.instances\n end\n end",
"def docker_ps_task(task_family)\n \"docker ps -n 1 -q --filter name=#{Shellwords.shellescape(task_family)}\"\n end",
"def ps_running\n cmd(\"ps\", \"-q\").lines.map(&:strip)\n end",
"def type\n requires_preauth\n app\n formation = get_formation\n changes = if args.any?{|arg| arg =~ /=/}\n args.map do |arg|\n if arg =~ /^([a-zA-Z0-9_]+)=([\\w-]+)$/\n type, new_size = $1, $2\n current_p = formation.find{|f| f[\"type\"] == type}\n if current_p.nil?\n error(\"Type '#{type}' not found in process formation.\")\n end\n p = current_p.clone\n p[\"size\"] = new_size\n p\n end\n end.compact\n elsif args.any?\n size = shift_argument.downcase\n validate_arguments!\n formation.map{|p| p[\"size\"] = size; p}\n end\n scale_dynos(formation, changes) if changes\n display_dyno_type_and_costs(get_formation)\n end",
"def processes()\n\t\t\t\tprocesses = ProcessList.new()\n\t\t\t\tprocesslist = `ps auxww`\n\t\t\t\tprocessregex = /^(\\S+)\\s+([0-9]+)\\s+(\\S+)\\s+(\\S+)\\s+(\\S+)\\s+(\\S+)\\s+(\\S+)\\s+(\\S+)\\s+(\\S+)\\s+(\\S+)\\s+(.*)$/\n\t\t\t\tprocesslist.each() { |line|\n\t\t\t\t\tline.strip!()\n\t\t\t\t\tmatch = processregex.match(line)\n\t\t\t\t\tif(match != nil)\n\t\t\t\t\t\tinfo = ProcessInfo.new()\n\t\t\t\t\t\tinfo.username = match[1]\n\t\t\t\t\t\tinfo.pid = match[2].to_i()\n\t\t\t\t\t\tinfo.flags = match[8]\n\t\t\t\t\t\tinfo.starttime = match[9]\n\t\t\t\t\t\tinfo.runtime = match[10]\n\t\t\t\t\t\tinfo.program = match[11]\n\t\t\t\t\t\tinfo.cpu = match[3].to_f()\n\t\t\t\t\t\tinfo.mem = match[4].to_f()\n\t\t\t\t\t\tif(processes.has_key?(info.pid))\n\t\t\t\t\t\t\traise(DuplicateProcessError, \"Process #{info.pid} appeared twice in the process listing\")\n\t\t\t\t\t\tend\n\t\t\t\t\t\tprocesses[info.pid] = info\n\t\t\t\t\tend\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\treturn(processes)\n\t\t\tend",
"def ncpus\n case os\n when 'darwin'\n Integer(`hwprefs cpu_count`)\n when 'linux'\n cores = File.read(\"/proc/cpuinfo\").scan(/core id\\s+: \\d+/).uniq.size\n cores > 0 ? cores : 1\n else raise \"don't know how to determine CPU count on #{os}\"\n end\n end",
"def running?\n processes = if node[\"platform_family\"] == \"windows\" then\n `powershell.exe -Command \\\"(Get-Process | Where-Object {$_.Name -eq \\'*aria*\\'}).count\\\"`.chop.to_i\n else \n cmd = Mixlib::ShellOut.new(\"pgrep -f #{new_resource.name}\")\n pgrep = cmd.run_command\n pgrep.stdout.length\n end\n processes > 0\nend",
"def get_process_memory(pid)\n case @platform ||= Gem::Platform.local.os\n when \"linux\"\n begin\n file = Pathname.new \"/proc/#{pid}/smaps\"\n return 0 unless file.exist?\n\n lines = file.each_line.select { |line| line.match(/^Pss/) }\n return 0 if lines.empty?\n\n lines.reduce(0) do |sum, line|\n line.match(/(?<value>(\\d*\\.{0,1}\\d+))\\s+(?<unit>\\w\\w)/) do |m|\n sum += m[:value].to_i\n end\n\n sum\n end\n rescue Errno::EACCES\n 0\n end\n when \"darwin\"\n mem = `ps -o rss= -p #{pid}`.strip\n mem.empty? ? 0 : mem.to_i\n else\n raise \"Can't check process memory, wrong type of platform: #{@platform}\"\n end\n end",
"def worker_display_scale_enabled?\n ENV.include?('VAGRANT_WORKER_SCALE')\nend",
"def processes\n\t\tif ::File.directory? \"C:/WINDOWS\"\n\t\t\twindows_processes\n\t\telse\n\t\t\tos = `uname -s`.chomp\n\t\t\tif os == \"Linux\"\n\t\t\t\tresolve_unix_uids(linux_processes)\n\t\t\telsif os == \"Darwin\" or os == \"FreeBSD\"\n\t\t\t\tos_x_processes\n\t\t\telse\n\t\t\t\t[]\n\t\t\tend\n\t\tend\n\tend",
"def srv_running\n return unless RUBY_PLATFORM =~ /linux/\n cmdobj = Mixlib::ShellOut.new(\"ps -ef | grep #{@new_resource.name} | grep java\")\n cmdobj.run_command.stdout.split(\"\\n\").reject { |e| e.include? \"sh -c\" }.size >= 1 # true or false\nend",
"def set_processes count\n @processes = count\n end",
"def worker_concurrency\n ENV.fetch('PUB_SUB_WORKER_CONCURRENCY', 4).to_i\n end",
"def compute_workers(ncpus)\n return 0 unless Process.respond_to?(:fork)\n\n compute_workers_from_env(LISTENER_WORKERS) ||\n compute_workers_from_env(PUMA_WORKERS) ||\n ncpus * PUMA_WORKERS_CPUMULT\n end",
"def rss_ps\n kb = `ps -o rss= #{Process.pid}`.strip.to_i\n\n return kb * 1024\n end",
"def pid\n pid = nil\n begin\n pid = capture :pgrep, \"-o -f resque-pool\"\n rescue SSHKit::Command::Failed\n end\n \n pid \n end",
"def cpu_usage\r\n # all usage\r\n total_used_cpu = IO.popen(\"ps aux\").read.split(\"\\n\").inject 0 do |a, i|\r\n a += i.split(' ')[2].to_f\r\n end\r\n # mysqld usage\r\n tread_desc = IO.popen(\"ps aux|grep mysqld\").read.split(\"\\n\")[0].split \" \" #get total info about mysql-process\r\n #form json\r\n return {\r\n rows: [{\r\n type: \"CPU free\",\r\n total: 100\r\n },{\r\n type: \"Mysql used\",\r\n total: tread_desc[2].to_f\r\n },{\r\n type: 'Other',\r\n total: total_used_cpu - tread_desc[2].to_f\r\n }]\r\n }.to_json\r\nend",
"def monitor\n log_opts = LogOpts.new.num(10000).tail\n log_opts = log_opts.ps(options[:ps]) if options[:ps]\n \n process_data = {}\n lines = 1\n \n heroku.read_logs(app, log_opts.to_opts) do |line|\n line.split(/\\n/).each do |real_line|\n merge_data_from_line(real_line, process_data)\n end\n metrics_table(process_data)\n end\n end",
"def restart\n app = extract_app\n\n opts = case args.first\n when NilClass then\n display \"Restarting processes... \", false\n {}\n when /.+\\..+/\n ps = args.first\n display \"Restarting #{ps} process... \", false\n { :ps => ps }\n else\n type = args.first\n display \"Restarting #{type} processes... \", false\n { :type => type }\n end\n heroku.ps_restart(app, opts)\n display \"done\"\n end",
"def _ps_browser(pat)\n x = `ps -ocomm,pcpu,rss -xwwc | grep -i #{pat}`\n\n if x.length > 0\n cpu = Float(/\\d+\\.\\d+/.match(x)[0])\n mem = Float(/\\d+$/.match(x)[0])*1024.0\n else\n cpu = -1.0\n mem = -1.0\n end\n \n return [cpu, mem]\n end",
"def scaleup(now, priority)\n if now == false \n # Job will be examined and run by scheduler later\n jid = $jobManager.register(-1, @envid, \"SCALEUP\", @name, \"READY\", priority)\n # Make a request to the global scheduler for capacity\n if $useGlobalScheduler == true\n template=ENVIRONMENT[@name][:slave_template]\n if template == nil\n $Logger.error \"scaleup: unable to find slave template for env #{@name} envid #{@envid}\"\n return\n end\n # Put a cap on number of requests sent to global scheduler\n # NOTE: For time based policy the throttling is done in \n # elastic_maanger/evaltimepolicy()\n if ENVIRONMENT[@name][:elasticity_policy] != nil &&\n ENVIRONMENT[@name][:elasticity_policy][:max] != nil \n maxVMs = ENVIRONMENT[@name][:elasticity_policy][:max] \n else\n maxVMs=16\n end\n if @vms.size + @gsOutStandingReqs > maxVMs\n $Logger.info \"scaleup: Too many outstanding requests to global schduler #{@name} envid #{@envid} outstanding #{@gsOutStandingReqs}\"\n return \"Too many scale up requests outstanding\"\n end\n \n vcpus = TEMPLATE[template][:cpu]\n mem = TEMPLATE[template][:memory]\n $gsProxy.request(@envid, @name, vcpus, mem, ENVIRONMENT[@name][:endpoint])\n @gsOutStandingReqs += 1\n end\n return jid\n end\n paramfile = $WORKDIR + \"/envconfig.\" + @name\n execString = $SVCBIN + \" -c \" + paramfile + \" -u \" + @envid\n childpid=Kernel.fork\n if childpid == nil\n Helper.closeFds()\n $stdout.reopen($ENVLOGFILE + \".#{@envid}\",'a+')\n $stderr.reopen($ENVLOGFILE + \".#{@envid}\",'a+')\n exec(execString)\n end\n jid = $jobManager.register(childpid, @envid, \"SCALEUP\", @name, \"RUNNING\", priority)\n return jid \n end",
"def plist(psname)\n counter = 0\n %x{ps h -o rss,size,vsize,pcpu -C #{psname}}.each do |ps|\n rss,size,vsize,cpu = ps.split\n counter += 1\n puts \"#{psname}_#{counter}.value #{rss}\"\n\n end\n return\nend",
"def ps(cmd)\n # used cached powershell runtime, this saves a TON of processing\n PuppetX::PowerCLI::Helper.instance.ps(cmd)\n end",
"def processes(agent_id, options = {})\n offset_request('get', \"/syscollector/#{agent_id}/processes\", options)\n end",
"def post?\n # return true\n dynos_maxed_out? or queue_depth_too_long? or queue_depth_too_short? or idle_dynos?\n end",
"def tunable_settings\n [\n 'puppet_enterprise::master::puppetserver::jruby_max_active_instances',\n 'puppet_enterprise::master::puppetserver::reserved_code_cache',\n 'puppet_enterprise::profile::amq::broker::heap_mb',\n 'puppet_enterprise::profile::console::java_args',\n 'puppet_enterprise::profile::database::shared_buffers',\n 'puppet_enterprise::profile::master::java_args',\n 'puppet_enterprise::profile::orchestrator::java_args',\n 'puppet_enterprise::profile::puppetdb::java_args',\n 'puppet_enterprise::puppetdb::command_processing_threads',\n ]\n end",
"def process_display(fields, interval)\n now = Time.now.strftime('%a %b %d %H:%M:%S %Y')\n cols = terminal_columns\n processes =\n `ps axww -o #{fields}`.grep(/mongrel_rails/).map do |line|\n line.strip!\n line.sub! /\\s+SHELL=.*$/, '' # weird MacOS X issue\n line.sub! /(?:ruby\\d*: )?mongrel_rails /, '' # remove $0 prefix\n line.sub! /\\(ruby\\d*\\)/, '' # remove (ruby) suffix\n line[0,cols].chomp\n end\n output = [\n (' ' * (cols - now.length)) + now + \"\\r\" +\n \"Mongrel Top (delay: #{interval})\",\n \"\",\n processes,\n \"\",\n \"#{processes.length} process(es)\"\n ]\n output.flatten.join(\"\\n\")\nend",
"def killall_cmd\n \"kill -9 `pgrep #{soffice_pname} #{unoconv_pname}`\"\n end",
"def host_memory\n case RbConfig::CONFIG['host_os']\n when /darwin/\n Integer(`sysctl -n hw.memsize`.to_i / 1024 / 1024)\n when /linux/\n Integer(`grep 'MemTotal' /proc/meminfo | sed -e 's/MemTotal://' -e 's/ kB//'`.to_i / 1024)\n else\n Integer(`wmic ComputerSystem get TotalPhysicalMemory`.split(\"\\n\")[2].to_i / 1024 / 1024)\n end\nend",
"def size\n case\n when @count < 1000 then 'tiny'\n when @count < 2000 then 'small'\n when @count < 3000 then 'medium'\n when @count < 4000 then 'large'\n when @count < 5000 then 'hefty'\n else 'massive'\n end\n end",
"def get_size(type)\n if type == :horizontal\n pane_size = Tmux.call \"list-panes | grep active | cut -dx -f1 | cut -d[ -f2\"\n else\n pane_size = Tmux.call \"list-panes | grep active | cut -dx -f2 | cut -d] -f1\"\n end\n pane_size.to_i\n end",
"def suspend_processes *processes\n client_opts = {}\n client_opts[:auto_scaling_group_name] = name\n client_opts[:scaling_processes] = processes.flatten\n client.suspend_processes(client_opts)\n nil\n end",
"def set_workers(app_name, qty)\n deprecate # 07/31/2012\n put(\"/apps/#{app_name}/workers\", :workers => qty).to_s\n end",
"def change_parallels_vm_cpu(options)\n message = \"Information:\\tSetting Parallels VM \"+options['name']+\" CPUs to \"+options['vcpus']\n command = \"prlctl set #{options['name']} --cpus #{options['vcpus']}\"\n execute_command(options,message,command)\n return\nend",
"def after_enqueue_scale_workers_up(*args)\n if HerokuScaler.heroku?\n scaler = HerokuScaler.new(@queue)\n scaler.workers = 1 if job_count > 0\n end\n end",
"def processes\n\t\tif ::File.directory? \"/proc\"\n\t\t\tresolve_unix_uids(linux_processes)\n\t\telsif ::File.directory? \"C:/WINDOWS\"\n\t\t\twindows_processes\n\t\telse\n\t\t\tos_x_processes\n\t\tend\n\tend",
"def kill_workers\n pids = %x{ps --ppid #{pid}}.split(/\\n+/).map {|line| line.sub(%r{^\\s*(\\d+)\\s+.*}, '\\\\1').to_i}\n pids.shift\n pids.each {|id| Process.kill('KILL', id) rescue nil}\n end",
"def CPU_max_number_of_cpu(value)\n if resource.class.name.ends_with?(\"Container\")\n numcpus = resource.vim_performance_states.last.state_data[:numvcpus]\n else\n numcpus = if resource.methods.include?(:cpu_total_cores) then resource.cpu_total_cores else 0 end\n end\n [value, numcpus].max.to_i\n end",
"def cpu_time_used\n domain_info[:cpuTime]\n end",
"def cpu_time_used\n domain_info[:cpuTime]\n end",
"def rolling\n process = shift_argument\n validate_arguments!\n processes = api.get_ps(app).body.map do |p|\n p.merge(\"process_type\" => p[\"process\"].split(\".\")[0],\n \"process_num\" => p[\"process\"].split(\".\")[1].to_i)\n end\n processes = processes.select do |p|\n process.nil? || p[\"process_type\"] == process\n end\n process_counts = processes.inject({}) do |counts, process|\n counts[process[\"process_type\"]] ||= 0\n counts[process[\"process_type\"]] += 1\n counts\n end\n processes = processes.sort_by do |p|\n (p[\"process_num\"].to_f / process_counts[p[\"process_type\"]].to_f)\n end\n\n message = process.nil? ? \"Deploying\" : \"Deploying #{process}\"\n start = Time.now\n deployed = 0\n total = processes.count\n width = total.to_s.length\n interval = 60\n (1..interval).each do |progress|\n ticker = [\"-\", \"\\\\\", \"|\", \"/\"][progress % 4]\n $stdout.print(\"\\r\")\n if processes.count <= 15\n $stdout.printf(\"#{message} processes... (%-#{width}s/%-#{width}s) %s\", deployed.to_s, total.to_s, ticker)\n else\n $stdout.printf(\"#{message} processes... (%-#{width}s/%-#{width}s)\", deployed.to_s, total.to_s)\n end\n $stdout.flush()\n processes.each_with_index do |process, index|\n if (((index / processes.size.to_f) * (interval -1).to_f).to_i + 1) == progress\n api.post_ps_restart(app, {:ps => process[\"process\"]})\n deployed += 1\n end\n end\n wait_til(start + progress) if (progress != interval)\n end\n $stdout.print(\"\\r\")\n $stdout.print(\"#{message} processes... done#{\" \" * 6}\\n\")\n $stdout.flush()\n end",
"def change_parallels_vm_mem(options)\n message = \"Information:\\tSetting Parallels VM \"+options['name']+\" RAM to \"+options['memory']\n command = \"prlctl set #{options['name']} --memsize #{options['memory']}\"\n execute_command(options,message,command)\n return\nend",
"def workers\n ::Resque.info[:workers].to_i\n end",
"def mem_usage\r\n # all usage\r\n total_used_memory = IO.popen(\"ps aux\").read.split(\"\\n\").inject 0 do |a, i|\r\n a += i.split(' ')[3].to_f\r\n end\r\n # mysql usage\r\n tread_desc = IO.popen(\"ps aux|grep mysqld\").read.split(\"\\n\")[0].split \" \" #get total info about mysql-process\r\n #form json\r\n return {\r\n rows: [{\r\n type: \"Memory free\",\r\n total: 100\r\n },{\r\n type: \"Mysql used\",\r\n total: tread_desc[3].to_f\r\n },{\r\n type: 'Other',\r\n total: total_used_memory-tread_desc[3].to_f\r\n }]\r\n }.to_json\r\nend",
"def are_too_many_instances_running?\n nodes(:status => \"running\").size > maximum_instances.to_i\n end",
"def pkill_action\n validate :signal, :shellsafe\n validate :pattern, String\n\n pids_to_kill = []\n\n get_proc_list(request[:pattern], false).each do |ps|\n pids_to_kill << ps[:pid]\n end\n\n # Sanity check \n if get_proc_list(\".\", false).size == pids_to_kill.size\n reply.fail \"Pattern matches all (#{pids_to_kill.size}) processes, refusing to kill\"\n return\n else\n reply[:killed] = 0\n\n pids_to_kill.each do |pid| \n system(\"logger -t mcolletive 'killing pid #{pid} based on pattern #{request[:pattern]}'\")\n\n killpid(request[:signal], pid)\n\n # bail out if something went wrong\n last if reply.statuscode > 0\n\n reply[:killed] += 1\n end\n end\n end",
"def kill_procs(options={})\n # Give it a good try to delete all processes.\n # This abuse is necessary to release locks on polyinstantiated\n # directories by pam_namespace.\n\n procfilter=\"-u #{uid}\"\n if options[:init_owned]\n procfilter << \" -P 1\"\n end\n\n # If the terminate delay is specified, try to terminate processes nicely\n # first and wait for them to die.\n if options[:term_delay]\n ::OpenShift::Runtime::Utils::oo_spawn(\"/usr/bin/pkill #{procfilter}\")\n etime = Time.now + options[:term_delay].to_i\n while (Time.now <= etime)\n out,err,rc = ::OpenShift::Runtime::Utils::oo_spawn(\"/usr/bin/pgrep #{procfilter}\")\n break unless rc == 0\n sleep 0.5\n end\n end\n\n oldproclist=\"\"\n stuckcount=0\n while stuckcount <= 10\n out,err,rc = ::OpenShift::Runtime::Utils::oo_spawn(\"/usr/bin/pkill -9 #{procfilter}\")\n break unless rc == 0\n\n sleep 0.5\n\n out,err,rc = ::OpenShift::Runtime::Utils::oo_spawn(\"/usr/bin/pgrep #{procfilter}\")\n if oldproclist == out\n stuckcount += 1\n else\n oldproclist = out\n stuckcount = 0\n end\n end\n\n out,err,rc = ::OpenShift::Runtime::Utils::oo_spawn(\"/usr/bin/pgrep #{procfilter}\")\n if rc == 0\n procset = out.split.join(' ')\n logger.error \"ERROR: failed to kill all processes for #{uid}: PIDs #{procset}\"\n end\n end",
"def scale_appservers_within_nodes\n if @creds[\"autoscale\"].downcase == \"true\"\n perform_scaling_for_appservers()\n end\n end",
"def get_proc_count\n procs = Facter.value('processors')\n if procs.key?('count') then\n procs['count'].to_i\n else\n 1\n end\nend",
"def ps(app_name)\n deprecate # 07/31/2012\n json_decode get(\"/apps/#{app_name}/ps\", :accept => 'application/json').to_s\n end",
"def unix_pids\n pids = []\n x = `ps auxw | grep -v grep | awk '{print $2, $11}' | grep #{app_name}`\n if x && x.chomp!\n processes = x.split(/\\n/).compact\n processes = processes.delete_if do |p|\n pid, name = p.split(/\\s/)\n # We want to make sure that the first part of the process name matches\n # so that app_name matches app_name_22\n app_name != name[0..(app_name.length - 1)]\n end\n pids = processes.map {|p| p.split(/\\s/)[0].to_i}\n end\n\n pids\n end",
"def unix_pids\n pids = []\n x = `ps auxw | grep -v grep | awk '{print $2, $11}' | grep #{app_name}`\n if x && x.chomp!\n processes = x.split(/\\n/).compact\n processes = processes.delete_if do |p|\n pid, name = p.split(/\\s/)\n # We want to make sure that the first part of the process name matches\n # so that app_name matches app_name_22\n app_name != name[0..(app_name.length - 1)]\n end\n pids = processes.map {|p| p.split(/\\s/)[0].to_i}\n end\n\n pids\n end",
"def get_queue_size\n if @number_of_processes\n @queueSize = @number_of_processes\n else\n @queueSize = DATSauce::PlatformUtils.processor_count * 2\n # get max threads from platform utils\n end\n @queueSize\n end",
"def domain_memory\n (config[:memory] || 512) * 1024\n end"
] |
[
"0.71599984",
"0.6719939",
"0.6648999",
"0.65706456",
"0.64959514",
"0.63000065",
"0.6083706",
"0.60714066",
"0.60307807",
"0.5999182",
"0.59672076",
"0.5902492",
"0.5813543",
"0.57681733",
"0.5696201",
"0.562424",
"0.56133723",
"0.5515396",
"0.5492279",
"0.54920906",
"0.54701877",
"0.54522073",
"0.54446673",
"0.5397226",
"0.5358602",
"0.5353367",
"0.53526163",
"0.5349366",
"0.52878004",
"0.5226325",
"0.5226325",
"0.520275",
"0.510888",
"0.51084906",
"0.51084906",
"0.5103613",
"0.5103613",
"0.507675",
"0.50733083",
"0.50666463",
"0.5064693",
"0.5052081",
"0.50228935",
"0.5019529",
"0.4998242",
"0.4983879",
"0.49617672",
"0.49583182",
"0.4949141",
"0.494293",
"0.49218133",
"0.491712",
"0.49105737",
"0.49038014",
"0.489179",
"0.48876366",
"0.48601502",
"0.48520046",
"0.48409104",
"0.48363578",
"0.48289892",
"0.48183656",
"0.48162267",
"0.48100916",
"0.48080745",
"0.48044807",
"0.4798616",
"0.47946092",
"0.47941118",
"0.47700676",
"0.47682008",
"0.4758537",
"0.4755624",
"0.47549656",
"0.4743805",
"0.47437385",
"0.4704496",
"0.47003448",
"0.46989042",
"0.469193",
"0.46901625",
"0.46796468",
"0.4678313",
"0.4675383",
"0.46716192",
"0.46716192",
"0.46604928",
"0.466047",
"0.4657113",
"0.4654291",
"0.46431005",
"0.4641988",
"0.46377757",
"0.4635167",
"0.46331787",
"0.46322697",
"0.46314925",
"0.46314925",
"0.4622779",
"0.461165"
] |
0.85126865
|
0
|
ps:workers [QTY] DEPRECATED: use `heroku ps:scale workers=N` scale to QTY background processes if QTY is not specified, display the number of background processes currently running Example: $ heroku ps:dynos 3 Scaling workers... done, now running 3
|
def workers
# deprecation notice added to v2.21.3 on 03/16/12
display("~ `heroku ps:workers QTY` has been deprecated and replaced with `heroku ps:scale workers=QTY`")
workers = shift_argument
validate_arguments!
if workers
action("Scaling workers") do
new_workers = api.put_workers(app, workers).body["workers"]
status("now running #{new_workers}")
end
else
app_data = api.get_app(app).body
if app_data["stack"] == "cedar"
raise(Heroku::Command::CommandFailed, "For Cedar apps, use `heroku ps`")
else
display("#{app} is running #{quantify("worker", app_data["workers"])}")
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def scale\n app = extract_app\n current_process = nil\n changes = args.inject({}) do |hash, process_amount|\n if process_amount =~ /^([a-zA-Z0-9_]+)([=+-]\\d+)$/\n hash[$1] = $2\n end\n hash\n end\n\n error \"Usage: heroku ps:scale web=2 worker+1\" if changes.empty?\n\n changes.each do |process, amount|\n display \"Scaling #{process} processes... \", false\n amount.gsub!(\"=\", \"\")\n new_qty = heroku.ps_scale(app, :type => process, :qty => amount)\n display \"done, now running #{new_qty}\"\n end\n end",
"def workers\n app = extract_app\n if workers = args.shift\n current = heroku.set_workers(app, workers)\n display \"#{app} now running #{quantify(\"worker\", current)}\"\n else\n workers = heroku.workers(app)\n display \"#{app} is running #{quantify(\"worker\", workers)}\"\n end\n end",
"def workers(amount = nil)\n heroku = ::Heroku::API.new(:api_key => ENV['HEROKU_API_KEY'])\n #\n # Returns the amount of Delayed Job\n # workers that are currently running on Heroku\n if amount.nil?\n processes = heroku.get_ps(ENV['APP_NAME']).body.select {|p| p['process'] =~ /worker.[0-9]+/}.length\n HireFire::Logger.message(\"Queried Heroku for processes - result: #{processes}\")\n return processes\n end\n\n ##\n # Sets the amount of Delayed Job\n # workers that need to be running on Heroku\n return heroku.post_ps_scale(ENV['APP_NAME'], \"worker\", amount) \n\n rescue Exception\n # Heroku library uses rest-client, currently, and it is quite\n # possible to receive RestClient exceptions through the client.\n HireFire::Logger.message(\"Worker query request failed with #{ $!.class.name } #{ $!.message }\")\n nil\n end",
"def workers(amount = nil)\n\n #\n # Returns the amount of Delayed Job\n # workers that are currently running on Heroku\n if amount.nil?\n return heroku.get_ps(ENV['APP_NAME']).body.select {|p| p['process'] =~ /worker.[0-9]+/}.length\n end\n\n ##\n # Sets the amount of Delayed Job\n # workers that need to be running on Heroku\n return heroku.post_ps_scale(ENV['APP_NAME'], \"worker\", amount)\n\n rescue ::Heroku::API::Errors::Error\n HireFire::Logger.message(\"Worker query request failed with #{ $!.class.name } #{ $!.message }\")\n nil\n end",
"def scale\n release = options[:version]\n changes = {}\n args.each do |arg|\n if arg =~ /^([a-zA-Z0-9_]+)([=+-]\\d+)$/\n changes[$1] = $2\n end\n end\n\n if changes.empty?\n error(\"Usage: heroku ps:scale PROCESS1=AMOUNT1 [PROCESS2=AMOUNT2 ...]\\nMust specify PROCESS and AMOUNT to scale.\")\n end\n\n changes.keys.sort.each do |process|\n amount = changes[process]\n action(\"Scaling #{process} processes\") do\n amount.gsub!(\"=\", \"\")\n new_qty = api.request(\n :expects => 200,\n :method => :post,\n :path => \"/apps/#{app}/ps/scale\",\n :query => {\n 'type' => process,\n 'qty' => amount,\n 'release' => release\n }\n ).body\n status(\"now running #{new_qty}\")\n end\n end\n end",
"def dynos\n # deprecation notice added to v2.21.3 on 03/16/12\n display(\"~ `heroku ps:dynos QTY` has been deprecated and replaced with `heroku ps:scale dynos=QTY`\")\n\n dynos = shift_argument\n validate_arguments!\n\n if dynos\n action(\"Scaling dynos\") do\n new_dynos = api.put_dynos(app, dynos).body[\"dynos\"]\n status(\"now running #{new_dynos}\")\n end\n else\n app_data = api.get_app(app).body\n if app_data[\"stack\"] == \"cedar\"\n raise(Heroku::Command::CommandFailed, \"For Cedar apps, use `heroku ps`\")\n else\n display(\"#{app} is running #{quantify(\"dyno\", app_data[\"dynos\"])}\")\n end\n end\n end",
"def kill_workers\n pids = %x{ps --ppid #{pid}}.split(/\\n+/).map {|line| line.sub(%r{^\\s*(\\d+)\\s+.*}, '\\\\1').to_i}\n pids.shift\n pids.each {|id| Process.kill('KILL', id) rescue nil}\n end",
"def workers=(n)\n if n != @workers || !known?\n p \"Scaling #{type} to #{n}\"\n heroku_set_workers(n)\n know n\n end\n end",
"def compute_workers(ncpus)\n return 0 unless Process.respond_to?(:fork)\n\n compute_workers_from_env(LISTENER_WORKERS) ||\n compute_workers_from_env(PUMA_WORKERS) ||\n ncpus * PUMA_WORKERS_CPUMULT\n end",
"def set_workers(app_name, qty)\n deprecate # 07/31/2012\n put(\"/apps/#{app_name}/workers\", :workers => qty).to_s\n end",
"def workers\n ::Resque.info[:workers].to_i\n end",
"def workers\n if known?\n @workers\n else\n know heroku_get_workers\n end\n end",
"def usage_by_ps\n memory = cmd(\"ps -o rsz #{process}\").split(\"\\n\")[1].to_f / 1.kilobyte\n return nil if memory <= 0\n\n memory\n end",
"def adjust_workers\n\t\tself.sample_queue_status\n\n\t\treturn nil if self.throttled?\n\n\t\tif self.needs_a_worker?\n\t\t\tself.log.info \"Too few workers for (%s); spinning one up.\" % [ self.task_class.name ]\n\t\t\tpid = self.start_worker( !self.workers.empty? )\n\t\t\treturn [ pid ]\n\t\tend\n\n\t\treturn nil\n\trescue Timeout::Error => err\n\t\tself.log.warn \"%p while adjusting workers: %s\" % [ err.class, err.message ]\n\t\treturn nil\n\tend",
"def after_enqueue_scale_workers_up(*args)\n if HerokuScaler.heroku?\n scaler = HerokuScaler.new(@queue)\n scaler.workers = 1 if job_count > 0\n end\n end",
"def processes\n process_cmd = case RUBY_PLATFORM\n when /djgpp|(cyg|ms|bcc)win|mingw/ then 'tasklist /v'\n when /solaris/ then 'ps -ef'\n else\n 'ps aux'\n end\n `#{process_cmd}`\nend",
"def worker_concurrency\n ENV.fetch('PUB_SUB_WORKER_CONCURRENCY', 4).to_i\n end",
"def current_proc_used_mem\n #pid, size = `ps ax -o pid,rss | grep -E \"^[[:space:]]*#{$$}\"`.strip.split.map(&:to_i)\n #`ps -o rss -p #{$$}`.chomp.split(\"\\n\").last.to_i\n #`ps -o rss -p #{$$}`.strip.split.last.to_i * 1024\n `ps -o rss= -p #{Process.pid}`.to_i \nend",
"def running_workers\n pool_manager.workers.fetch(queues, {})\n end",
"def worker_pids\n work_units.all(:select => 'worker_pid').map(&:worker_pid)\n end",
"def workers(count); end",
"def ps\n `ps haxo pid,ppid,cmd`\n end",
"def worker_count\n @action == 'run' ? 1 : workers\n end",
"def workers\r\n @workers ||= []\r\n end",
"def determine_processes\n procs = @shell.query('PROCESSES', 'ps aux')\n @info[:processes] = procs.gsub(/\\r/, '').split(/\\n/)\n end",
"def cpus(arg=nil)\n set_or_return(:cpus, arg, :kind_of => Integer)\n end",
"def spawn_and_monitor_workers\n daemon_log :msg => \"Spawning #{$daemon[:worker_count]} workers...\"\n\n while $daemon[:work]\n daemon_update_heartbeat\n\n # (Re)start workers\n while $daemon[:worker_pids].count < $daemon[:worker_count] do\n sp = Spawnling.new(:argv => $worker[:process_prefix]) do\n worker_runner\n end\n $daemon[:worker_pids] << sp.handle\n end\n\n sleep $daemon[:monitoring_sleep]\n\n # Delete PIDs from the array child_pids which don't exists anymore\n $daemon[:worker_pids].each do |ch_pid|\n begin\n ps = ProcTable.ps(ch_pid)\n rescue\n ps = nil\n daemon_log :msg => \"Error in ProcTable.ps: #{$!}\", :sev => :error\n end\n $daemon[:worker_pids].delete ch_pid unless ps && ps.comm == 'ruby'\n end\n end\nend",
"def workers=(workers_config)\n @workers = if workers_config.nil?\n DEFAULT_WORKERS\n else\n workers_config.slice(1, workers_config.length).to_i\n end\n end",
"def get_memory_usage\n `ps -o rss= -p #{Process.pid}`.to_i\nend",
"def cpus\n flavor[2]\n end",
"def get_memory_usage\n `ps -o rss= -p #{Process.pid}`.to_i\nend",
"def workers\n @@workers ||= []\n end",
"def worker_pool_size; end",
"def get_cpu_limit\n cpus = Parallel.processor_count\n env_cpus = ENV.fetch( 'SIMP_RAKE_LIMIT_CPUS', '-1' ).strip.to_i\n\n env_cpus = 1 if env_cpus == 0\n env_cpus += cpus if env_cpus < 0\n # sanitize huge numbers\n env_cpus = (cpus - 1) if env_cpus >= cpus\n env_cpus = 1 if env_cpus < 0\n\n env_cpus\n end",
"def memory_usage \n\t`ps -o rss= -p #{Process.pid}`.to_i # in kilobytes \nend",
"def worker_count()\n @workers.size\n end",
"def worker_count()\n @workers.size\n end",
"def get_current_memory_usage\n `ps -o rss= -p #{Process.pid}`.to_i\nend",
"def domain_cpus\n config[:cpus] || 1\n end",
"def missing_workers\n @options[:process_count] - @workers.length\n end",
"def list_workers\n Shuttle::Redis.smembers worker_set_key\n end",
"def create_workers(number_of_instances, options = {}, user_id = 'unknown_user')\n defaults = {\n instance_type: 'm2.4xlarge',\n security_groups: [],\n image_id: nil, # don't prescribe the image id so that it can determine later\n user_id: user_id,\n\n # optional -- will default later\n associate_public_ip_address: nil,\n subnet_id: nil,\n ebs_volume_id: nil,\n aws_key_pair_name: nil,\n private_key_file_name: nil, # required if using an existing \"aws_key_pair_name\",\n tags: []\n }\n options = defaults.merge(options)\n\n # for backwards compatibility, still allow security_group\n if options[:security_group]\n warn 'Pass security_groups as an array instead of security_group. security_group will be deprecated in 0.4.0'\n options[:security_groups] = [options[:security_group]]\n end\n\n # Get the right worker AMI ids based on the type of instance\n if options[:image_id].nil?\n options[:image_id] = determine_image_type(options[:instance_type])\n end\n\n raise \"Can't create workers without a server instance running\" if @os_aws.server.nil?\n\n user_data_file = @dockerized ? 'worker_script.sh.docker.template' : 'worker_script.sh.template'\n\n unless number_of_instances == 0\n worker_options = {\n user_id: options[:user_id],\n tags: options[:tags],\n subnet_id: options[:subnet_id],\n associate_public_ip_address: options[:associate_public_ip_address],\n user_data_file: user_data_file\n }\n\n # if options[:ebs_volume_size]\n # worker_options[:ebs_volume_size] = options[:ebs_volume_size]\n # end\n\n @os_aws.launch_workers(options[:image_id], options[:instance_type], number_of_instances, worker_options)\n end\n\n logger.info 'Waiting for server/worker configurations'\n\n begin\n if @dockerized\n @os_aws.configure_swarm_cluster(@save_directory)\n else\n @os_aws.configure_server_and_workers\n end\n rescue StandardError => e\n raise \"Configuring the cluster failed with error `#{e.message}` in:\\n#{e.backtrace.join('\\n')}\"\n end\n end",
"def min_workers\n HireFire.configuration.min_workers\n end",
"def max_workers\n Resque::Kubernetes.max_workers\n end",
"def restart\n app = extract_app\n\n opts = case args.first\n when NilClass then\n display \"Restarting processes... \", false\n {}\n when /.+\\..+/\n ps = args.first\n display \"Restarting #{ps} process... \", false\n { :ps => ps }\n else\n type = args.first\n display \"Restarting #{type} processes... \", false\n { :type => type }\n end\n heroku.ps_restart(app, opts)\n display \"done\"\n end",
"def cpu_cores\n `cat /proc/cpuinfo | grep bogomips | wc -l`.strip\n end",
"def ps_running\n cmd(\"ps\", \"-q\").lines.map(&:strip)\n end",
"def stop\n app = extract_app\n opt =\n if (args.first =~ /.+\\..+/)\n ps = args.first\n display \"Stopping #{ps} process... \", false\n {:ps => ps}\n elsif args.first\n type = args.first\n display \"Stopping #{type} processes... \", false\n {:type => type}\n else\n error \"Usage: heroku ps:stop PROCESS\"\n end\n\n heroku.ps_stop(app, opt)\n display \"done\"\n end",
"def worker_pool(count, *queues_and_options)\n end",
"def pid\n pid = nil\n begin\n pid = capture :pgrep, \"-o -f resque-pool\"\n rescue SSHKit::Command::Failed\n end\n \n pid \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 scale\n requires_preauth\n\n changes = args.map do |arg|\n if change = arg.scan(/^([a-zA-Z0-9_]+)([=+-]\\d+)(?::([\\w-]+))?$/).first\n formation, quantity, size = change\n quantity = quantity[1..-1].to_i if quantity[0] == \"=\"\n { \"type\" => formation, \"quantity\" => quantity, \"size\" => size}\n end\n end.compact\n\n if changes.empty?\n display_dyno_formation(get_formation)\n else\n action(\"Scaling dynos\") do\n new_scales = scale_dynos(get_formation, changes)\n .map {|p| \"#{p[\"type\"]} at #{p[\"quantity\"]}:#{p[\"size\"]}\" }\n status(\"now running \" + new_scales.join(\", \") + \".\")\n end\n end\n end",
"def worker\n\n @services['s_worker']\n end",
"def create_workers\n @workers.times do |id|\n pid = fork { Worker.new(@options.merge(id: id)).start }\n @forks << { id: id, pid: pid }\n end\n end",
"def calibrate_workers \n if !(stopped?)\n # Handle received signals\n @sig_queue.each { |signal| @sig_handlers[signal].call }\n @sig_queue = []\n # Check all channels for dead ones\n @workers.each_pair { |pid, worker|\n worker[:inactive] += 1\n if worker[:inactive] > @options[:timeout]\n running = ( Process.getpgid(pid) rescue false )\n if running \n if worker[:status] == :ALIVE \n @logger.log(Logger::Severity::WARN,\n \"Worker #{worker[:name]} with PID #{pid} timed out .. Terminating the worker process gracefully\", @options[:name])\n kill_worker(:TERM, pid)\n worker[:status] = :TERMINATING\n elsif worker[:status] == :TERMINATING && worker[:inactive] > @options[:timeout] + 60\n @logger.log(Logger::Severity::WARN, \n \"Timedout Worker #{worker[:name]} with PID #{pid} did not terminate gracefully .. Killing the worker process\", @options[:name])\n kill_worker(:KILL, pid)\n worker[:status] = :KILLED\n end\n end\n end\n }\n reap_workers\n if !(stopped?)\n # Fork new_workers if needed\n while @workers.length < @options[:workers]\n @logger.log(Logger::Severity::WARN, \"Missing workers .. Current workers: #{@workers.length} .. Forking new ones \", @options[:name])\n new_worker\n end\n end\n end\n end",
"def worker_display_scale_enabled?\n ENV.include?('VAGRANT_WORKER_SCALE')\nend",
"def available_workers?\n true\n end",
"def notify_process_running(max_memory=nil)\n if BackgroundQueue::Worker::Config.support_process_monitoring\n self.environment.set_process_name(max_memory)\n end\n end",
"def create_workers\n @forks = []\n @workers.times do |id|\n pid = fork { Worker.new(@options.merge(id: id)).start }\n @forks << { id: id, pid: pid }\n end\n end",
"def get_children_process(pid)\n\t`ps --ppid #{pid} | grep -v PID | awk '{print $1}'`.split(\"\\n\")\n\t#Could not find a Ruby way to do this\nend",
"def suspend_processes *processes\n client_opts = {}\n client_opts[:auto_scaling_group_name] = name\n client_opts[:scaling_processes] = processes.flatten\n client.suspend_processes(client_opts)\n nil\n end",
"def rss_ps\n kb = `ps -o rss= #{Process.pid}`.strip.to_i\n\n return kb * 1024\n end",
"def workers\n @worker_supervisor.actors\n end",
"def workers_to_start(workers_to_start)\n if not worker_pids.empty?\n worker_pids.each do |worker_pid|\n if worker_alive?(worker_pid)\n @number_of_workers += 1\n workers_to_start -= 1\n else\n mark_worker_as_stopped(worker_pid)\n end\n return 0 if workers_to_start < 1\n end\n end\n return workers_to_start\n end",
"def queue\n workers = %x[ps axe | grep delayed_job].split(\"delayed_job\").length\n j = { :workers => workers, :jobs => Delayed::Job.all }\n render :json=>j\n end",
"def processes()\n\t\t\t\tprocesses = ProcessList.new()\n\t\t\t\tprocesslist = `ps auxww`\n\t\t\t\tprocessregex = /^(\\S+)\\s+([0-9]+)\\s+(\\S+)\\s+(\\S+)\\s+(\\S+)\\s+(\\S+)\\s+(\\S+)\\s+(\\S+)\\s+(\\S+)\\s+(\\S+)\\s+(.*)$/\n\t\t\t\tprocesslist.each() { |line|\n\t\t\t\t\tline.strip!()\n\t\t\t\t\tmatch = processregex.match(line)\n\t\t\t\t\tif(match != nil)\n\t\t\t\t\t\tinfo = ProcessInfo.new()\n\t\t\t\t\t\tinfo.username = match[1]\n\t\t\t\t\t\tinfo.pid = match[2].to_i()\n\t\t\t\t\t\tinfo.flags = match[8]\n\t\t\t\t\t\tinfo.starttime = match[9]\n\t\t\t\t\t\tinfo.runtime = match[10]\n\t\t\t\t\t\tinfo.program = match[11]\n\t\t\t\t\t\tinfo.cpu = match[3].to_f()\n\t\t\t\t\t\tinfo.mem = match[4].to_f()\n\t\t\t\t\t\tif(processes.has_key?(info.pid))\n\t\t\t\t\t\t\traise(DuplicateProcessError, \"Process #{info.pid} appeared twice in the process listing\")\n\t\t\t\t\t\tend\n\t\t\t\t\t\tprocesses[info.pid] = info\n\t\t\t\t\tend\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\treturn(processes)\n\t\t\tend",
"def ncpus\n case os\n when 'darwin'\n Integer(`hwprefs cpu_count`)\n when 'linux'\n cores = File.read(\"/proc/cpuinfo\").scan(/core id\\s+: \\d+/).uniq.size\n cores > 0 ? cores : 1\n else raise \"don't know how to determine CPU count on #{os}\"\n end\n end",
"def call\n `ps -o rss -p #{@pid}`.split(\"\\n\").last.to_i\n end",
"def memory_usage\n `ps -o rss= -p #{ $PID }`.to_i\n end",
"def kill_procs(options={})\n # Give it a good try to delete all processes.\n # This abuse is necessary to release locks on polyinstantiated\n # directories by pam_namespace.\n\n procfilter=\"-u #{uid}\"\n if options[:init_owned]\n procfilter << \" -P 1\"\n end\n\n # If the terminate delay is specified, try to terminate processes nicely\n # first and wait for them to die.\n if options[:term_delay]\n ::OpenShift::Runtime::Utils::oo_spawn(\"/usr/bin/pkill #{procfilter}\")\n etime = Time.now + options[:term_delay].to_i\n while (Time.now <= etime)\n out,err,rc = ::OpenShift::Runtime::Utils::oo_spawn(\"/usr/bin/pgrep #{procfilter}\")\n break unless rc == 0\n sleep 0.5\n end\n end\n\n oldproclist=\"\"\n stuckcount=0\n while stuckcount <= 10\n out,err,rc = ::OpenShift::Runtime::Utils::oo_spawn(\"/usr/bin/pkill -9 #{procfilter}\")\n break unless rc == 0\n\n sleep 0.5\n\n out,err,rc = ::OpenShift::Runtime::Utils::oo_spawn(\"/usr/bin/pgrep #{procfilter}\")\n if oldproclist == out\n stuckcount += 1\n else\n oldproclist = out\n stuckcount = 0\n end\n end\n\n out,err,rc = ::OpenShift::Runtime::Utils::oo_spawn(\"/usr/bin/pgrep #{procfilter}\")\n if rc == 0\n procset = out.split.join(' ')\n logger.error \"ERROR: failed to kill all processes for #{uid}: PIDs #{procset}\"\n end\n end",
"def worker_memory(total_memory, reserved_memory = 1572864, per_worker_ram = 1048576)\n (total_memory - reserved_memory) / per_worker_ram\n end",
"def pause_key\n key = to_s.split(':')\n \"worker:#{key.first}:#{key.second}:all_workers:paused\"\n end",
"def pause_key\n key = to_s.split(':')\n \"worker:#{key.first}:#{key.second}:all_workers:paused\"\n end",
"def total_capacity_job_nodes_cpu\n cpus = job_nodes.map {|n| n['status']['capacity']['cpu'].to_i}\n cpus.inject {|sum,n| sum + n}\n end",
"def serverWorker_pods\nend",
"def os_x_processes\n\t\traw = os_x_raw_ps.split(\"\\n\").slice(1, 99999)\n\t\traw.map do |line|\n\t\t\tparse_ps(line)\n\t\tend\n\tend",
"def os_x_processes\n\t\traw = os_x_raw_ps.split(\"\\n\").slice(1, 99999)\n\t\traw.map do |line|\n\t\t\tparse_ps(line)\n\t\tend\n\tend",
"def docker_ps_task(task_family)\n \"docker ps -n 1 -q --filter name=#{Shellwords.shellescape(task_family)}\"\n end",
"def run_worker(server_name)\n if !server_name.empty?\n %x| #{app_root}/bin/goliath s -e production -s #{server_name}|\n else\n %x| #{app_root}/bin/goliath s -e production|\n end\n end",
"def workers\n @queues.keys\n end",
"def get_worker_spawn_timeout\n if timeout = ENV['WORKER_SPAWN_TIMEOUT']\n puts \"WORKER_SPAWN_TIMEOUT=#{timeout}\"\n timeout.to_i\n else\n 4\n end\nend",
"def notify_workers\n PgJob.connection.execute \"NOTIFY pg_jobs_#{queue_name}\"\n end",
"def tunable_settings\n [\n 'puppet_enterprise::master::puppetserver::jruby_max_active_instances',\n 'puppet_enterprise::master::puppetserver::reserved_code_cache',\n 'puppet_enterprise::profile::amq::broker::heap_mb',\n 'puppet_enterprise::profile::console::java_args',\n 'puppet_enterprise::profile::database::shared_buffers',\n 'puppet_enterprise::profile::master::java_args',\n 'puppet_enterprise::profile::orchestrator::java_args',\n 'puppet_enterprise::profile::puppetdb::java_args',\n 'puppet_enterprise::puppetdb::command_processing_threads',\n ]\n end",
"def scaleup(now, priority)\n if now == false \n # Job will be examined and run by scheduler later\n jid = $jobManager.register(-1, @envid, \"SCALEUP\", @name, \"READY\", priority)\n # Make a request to the global scheduler for capacity\n if $useGlobalScheduler == true\n template=ENVIRONMENT[@name][:slave_template]\n if template == nil\n $Logger.error \"scaleup: unable to find slave template for env #{@name} envid #{@envid}\"\n return\n end\n # Put a cap on number of requests sent to global scheduler\n # NOTE: For time based policy the throttling is done in \n # elastic_maanger/evaltimepolicy()\n if ENVIRONMENT[@name][:elasticity_policy] != nil &&\n ENVIRONMENT[@name][:elasticity_policy][:max] != nil \n maxVMs = ENVIRONMENT[@name][:elasticity_policy][:max] \n else\n maxVMs=16\n end\n if @vms.size + @gsOutStandingReqs > maxVMs\n $Logger.info \"scaleup: Too many outstanding requests to global schduler #{@name} envid #{@envid} outstanding #{@gsOutStandingReqs}\"\n return \"Too many scale up requests outstanding\"\n end\n \n vcpus = TEMPLATE[template][:cpu]\n mem = TEMPLATE[template][:memory]\n $gsProxy.request(@envid, @name, vcpus, mem, ENVIRONMENT[@name][:endpoint])\n @gsOutStandingReqs += 1\n end\n return jid\n end\n paramfile = $WORKDIR + \"/envconfig.\" + @name\n execString = $SVCBIN + \" -c \" + paramfile + \" -u \" + @envid\n childpid=Kernel.fork\n if childpid == nil\n Helper.closeFds()\n $stdout.reopen($ENVLOGFILE + \".#{@envid}\",'a+')\n $stderr.reopen($ENVLOGFILE + \".#{@envid}\",'a+')\n exec(execString)\n end\n jid = $jobManager.register(childpid, @envid, \"SCALEUP\", @name, \"RUNNING\", priority)\n return jid \n end",
"def resque_cpu_host_names\n if is_zz?\n return app_config[:resque_cpus]\n end\n\n return @resque_cpu_host_names if @resque_cpu_host_names != nil\n\n instances = ey['environment']['instances']\n # assume solo machine\n @resque_cpu_host_names = []\n\n # not solo so see if we are util which\n # is where we host resquecpujobs\n instances.each do |instance|\n if instance['role'] == 'util' && instance['name'] =~ /^resquecpujobs/\n @resque_cpu_host_names << instance['private_hostname']\n end\n end\n if (@node['instance_role'] != 'solo')\n if @resque_cpu_host_names.length == 0\n # no resque cpu hosts found\n end\n else\n # solo machine so run here\n @resque_cpu_host_names << this_host_name\n end\n @resque_cpu_host_names\n end",
"def procs_percent\n (procs_used.to_f / procs_avail.to_f) * 100\n end",
"def busy_workers\n if @threadsafe\n 0\n else\n @workers.size - @worker_queue.size\n end\n end",
"def suspend_processes(auto_scaling_group_name, options = {})\n if scaling_processes = options.delete('ScalingProcesses')\n options.merge!(AWS.indexed_param('ScalingProcesses.member.%d', [*scaling_processes]))\n end\n request({\n 'Action' => 'SuspendProcesses',\n 'AutoScalingGroupName' => auto_scaling_group_name,\n :parser => Fog::Parsers::AWS::AutoScaling::Basic.new\n }.merge!(options))\n end",
"def maxcpucount\n case RbConfig::CONFIG['host_os']\n when /darwin9/\n `hwprefs cpu_count`.to_i\n when /darwin/\n ((`which hwprefs` != '') ? `hwprefs thread_count` : `sysctl -n hw.ncpu`).to_i\n when /linux/\n `cat /proc/cpuinfo | grep processor | wc -l`.to_i\n when /freebsd/\n `sysctl -n hw.ncpu`.to_i\n when /mswin|mingw/\n require 'win32ole'\n wmi = WIN32OLE.connect(\"winmgmts://\")\n cpu = wmi.ExecQuery(\"select NumberOfLogicalProcessors from Win32_Processor\")\n cpu.to_enum.first.NumberOfLogicalProcessors\n end\nend",
"def scale_dynos_down(dyno_name, count, current_count)\n dynos_for_type(dyno_name).sort_by { |d| d['elapsed'] }.reverse.take(current_count - count).each do |dyno|\n run_heroku_api_command(:post_ps_stop, app, { 'ps' => dyno['process'] })\n end\n end",
"def create_worker(n)\n if pid = fork\n # parent process: updates the +workers+ data structure, with the\n # format\n #\n # { PID => <id> }\n workers[pid] = n\n else\n # children process:\n\n # store the identifier so that the process name can be easily updated\n # if needed later\n @identifier = n\n\n # 1. sets up signal handlers for the worker processes\n setup_worker_signals\n\n # 2. sets up the process name to +Worker N+\n setup_name \"Worker #{n}\"\n\n # 3. configures the database connection on the children process.\n setup_database\n\n # 4. cleans up the +workers+ data structure, inherited from the\n # parent, since a worker process does not manages other workers.\n workers.clear\n\n # 5. prepares the queue for polling for incoming messages\n prepare_queue\n\n # 6. initiates the worker loop\n worker_loop\n end\n end",
"def set_processes count\n @processes = count\n end",
"def check_for_available_workers\n workers >= working_count\n end",
"def os_x_raw_ps\n\t\t`COLUMNS=9999 ps ax -o \"pid uid ppid rss cpu command\"`\n\tend",
"def os_x_raw_ps\n\t\t`COLUMNS=9999 ps ax -o \"pid uid ppid rss cpu command\"`\n\tend",
"def number_of_cpu_cores\n case RbConfig::CONFIG['host_os']\n when /linux/\n Dir.glob('/sys/devices/system/cpu/cpu[0-9]*').count\n when /darwin|bsd/\n Integer(`sysctl -n hw.ncpu`)\n when /solaris/\n Integer(`kstat -m cpu_info | grep -w core_id | uniq | wc -l`)\n else\n 5\n end\n end",
"def ps\n sql = %q(\n select\n procpid,\n application_name as source,\n age(now(),query_start) as running_for,\n waiting,\n current_query as query\n from pg_stat_activity\n where\n current_query <> '<insufficient privilege>'\n AND current_query <> '<IDLE>'\n and procpid <> pg_backend_pid()\n order by 3 desc\n )\n\n exec_sql(sql, find_uri)\n end",
"def _ps_browser(pat)\n x = `ps -ocomm,pcpu,rss -xwwc | grep -i #{pat}`\n\n if x.length > 0\n cpu = Float(/\\d+\\.\\d+/.match(x)[0])\n mem = Float(/\\d+$/.match(x)[0])*1024.0\n else\n cpu = -1.0\n mem = -1.0\n end\n \n return [cpu, mem]\n end",
"def excess_task_workers\n @task_worker_lock.synchronize do\n @task_worker_size - @task_workers.size - @spawnings\n end\n end",
"def worker_config\n worker = JSON.parse(SideJob.redis.get(\"#{redis_key}:worker\"))\n SideJob::Worker.config(worker['queue'], worker['class']) || {}\n end"
] |
[
"0.75243735",
"0.7109988",
"0.7030956",
"0.68412995",
"0.6611573",
"0.65560544",
"0.6552528",
"0.6513395",
"0.64037216",
"0.6269072",
"0.6216943",
"0.62060666",
"0.6107998",
"0.60794353",
"0.60278094",
"0.5986876",
"0.5923211",
"0.59193754",
"0.58857477",
"0.5788496",
"0.57702494",
"0.5742223",
"0.56868315",
"0.5675325",
"0.5675226",
"0.56286865",
"0.5626265",
"0.5615583",
"0.56114054",
"0.56110686",
"0.5610464",
"0.55640674",
"0.5525793",
"0.55077",
"0.55021304",
"0.54986984",
"0.54986984",
"0.5493921",
"0.5483408",
"0.5482654",
"0.5474494",
"0.54418296",
"0.54393834",
"0.54267365",
"0.5390236",
"0.53890973",
"0.5383692",
"0.538207",
"0.537354",
"0.5373398",
"0.5367924",
"0.53577465",
"0.5348113",
"0.53428733",
"0.5334463",
"0.532122",
"0.53177845",
"0.53157705",
"0.5314962",
"0.53108704",
"0.52919936",
"0.52742463",
"0.52716583",
"0.52677184",
"0.52658486",
"0.5264628",
"0.5260897",
"0.52262026",
"0.5207903",
"0.51830024",
"0.51700234",
"0.51644045",
"0.51644045",
"0.51554966",
"0.5145171",
"0.5141165",
"0.5141165",
"0.51275235",
"0.5122619",
"0.51219237",
"0.5119616",
"0.51178616",
"0.5117641",
"0.51170635",
"0.51153636",
"0.5112714",
"0.511014",
"0.5109152",
"0.50989443",
"0.5097474",
"0.5085891",
"0.50853264",
"0.5070032",
"0.5059523",
"0.5059523",
"0.5058474",
"0.5057837",
"0.5054552",
"0.50500995",
"0.50443333"
] |
0.85246956
|
0
|
ps list dynos for an app Example: $ heroku ps === run: oneoff dyno run.1: up for 5m: `bash` === web: `bundle exec thin start p $PORT` web.1: created for 30s
|
def index
validate_arguments!
quota_resp = api.request(
:expects => [200, 404],
:method => :post,
:path => "/apps/#{app}/actions/get-quota",
:headers => {
"Accept" => "application/vnd.heroku+json; version=3.app-quotas",
"Content-Type" => "application/json"
}
)
if quota_resp.status = 200
quota = quota_resp.body
now = Time.now.getutc
quota_message = if quota["allow_until"]
"Free quota left:"
elsif quota["deny_until"]
"Free quota exhausted. Unidle available in:"
end
if quota_message
quota_timestamp = (quota["allow_until"] ? Time.parse(quota["allow_until"]).getutc : Time.parse(quota["deny_until"]).getutc)
time_left = time_remaining(Time.now.getutc, quota_timestamp)
display("#{quota_message} #{time_left}")
end
end
processes_resp = api.request(
:expects => 200,
:method => :get,
:path => "/apps/#{app}/dynos",
:headers => {
"Accept" => "application/vnd.heroku+json; version=3",
"Content-Type" => "application/json"
}
)
processes = processes_resp.body
processes_by_command = Hash.new {|hash,key| hash[key] = []}
processes.each do |process|
now = Time.now
type = process["type"]
elapsed = now - Time.iso8601(process['updated_at'])
since = time_ago(now - elapsed)
size = process["size"] || "1X"
if type == "run"
key = "run: one-off processes"
item = "%s (%s): %s %s: `%s`" % [ process["name"], size, process["state"], since, process["command"] ]
else
key = "#{type} (#{size}): `#{process["command"]}`"
item = "%s: %s %s" % [ process['name'], process['state'], since ]
end
processes_by_command[key] << item
end
extract_run_id = /\.(\d+).*:/
processes_by_command.keys.each do |key|
processes_by_command[key] = processes_by_command[key].sort do |x,y|
x.match(extract_run_id).captures.first.to_i <=> y.match(extract_run_id).captures.first.to_i
end
end
processes_by_command.keys.sort.each do |key|
styled_header(key)
styled_array(processes_by_command[key], :sort => false)
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def dynos\n # deprecation notice added to v2.21.3 on 03/16/12\n display(\"~ `heroku ps:dynos QTY` has been deprecated and replaced with `heroku ps:scale dynos=QTY`\")\n\n dynos = shift_argument\n validate_arguments!\n\n if dynos\n action(\"Scaling dynos\") do\n new_dynos = api.put_dynos(app, dynos).body[\"dynos\"]\n status(\"now running #{new_dynos}\")\n end\n else\n app_data = api.get_app(app).body\n if app_data[\"stack\"] == \"cedar\"\n raise(Heroku::Command::CommandFailed, \"For Cedar apps, use `heroku ps`\")\n else\n display(\"#{app} is running #{quantify(\"dyno\", app_data[\"dynos\"])}\")\n end\n end\n end",
"def ps\n `ps haxo pid,ppid,cmd`\n end",
"def processes\n process_cmd = case RUBY_PLATFORM\n when /djgpp|(cyg|ms|bcc)win|mingw/ then 'tasklist /v'\n when /solaris/ then 'ps -ef'\n else\n 'ps aux'\n end\n `#{process_cmd}`\nend",
"def index\n app = extract_app\n ps = heroku.ps(app)\n\n objects = ps.sort_by do |p|\n t,n = p['process'].split('.')\n [t, n.to_i]\n end.each do |p|\n p['state'] << ' for ' << time_ago(p['elapsed']).gsub(/ ago/, '')\n p['command'] = truncate(p['command'], 36)\n end\n\n display_table(\n objects,\n ['process', 'state', 'command'],\n ['Process', 'State', 'Command']\n )\n end",
"def ps(app_name)\n deprecate # 07/31/2012\n json_decode get(\"/apps/#{app_name}/ps\", :accept => 'application/json').to_s\n end",
"def ps_running\n cmd(\"ps\", \"-q\").lines.map(&:strip)\n end",
"def get_pids\n pids_ports = []\n pids = `pgrep -f thin`.split\n pids.each do |t|\n # only works for linux i'm affraid\n # using lsof (list open files) \n\n # removed by someara to address munin permissions issue\n ## port = `lsof -p #{t} | grep LISTEN`.split[8]\n ## port = port.split(\":\")[1]\n port = `ps -ef | grep #{t} | grep -v grep | grep thin | awk '{ print $10 }' | awk -F: '{ print $2 }' | tr --delete '()'`.chomp\n pids_ports << [t,port]\n end\n pids_ports\n end",
"def determine_processes\n procs = @shell.query('PROCESSES', 'ps aux')\n @info[:processes] = procs.gsub(/\\r/, '').split(/\\n/)\n end",
"def processes()\n\t\t\t\tprocesses = ProcessList.new()\n\t\t\t\tprocesslist = `ps auxww`\n\t\t\t\tprocessregex = /^(\\S+)\\s+([0-9]+)\\s+(\\S+)\\s+(\\S+)\\s+(\\S+)\\s+(\\S+)\\s+(\\S+)\\s+(\\S+)\\s+(\\S+)\\s+(\\S+)\\s+(.*)$/\n\t\t\t\tprocesslist.each() { |line|\n\t\t\t\t\tline.strip!()\n\t\t\t\t\tmatch = processregex.match(line)\n\t\t\t\t\tif(match != nil)\n\t\t\t\t\t\tinfo = ProcessInfo.new()\n\t\t\t\t\t\tinfo.username = match[1]\n\t\t\t\t\t\tinfo.pid = match[2].to_i()\n\t\t\t\t\t\tinfo.flags = match[8]\n\t\t\t\t\t\tinfo.starttime = match[9]\n\t\t\t\t\t\tinfo.runtime = match[10]\n\t\t\t\t\t\tinfo.program = match[11]\n\t\t\t\t\t\tinfo.cpu = match[3].to_f()\n\t\t\t\t\t\tinfo.mem = match[4].to_f()\n\t\t\t\t\t\tif(processes.has_key?(info.pid))\n\t\t\t\t\t\t\traise(DuplicateProcessError, \"Process #{info.pid} appeared twice in the process listing\")\n\t\t\t\t\t\tend\n\t\t\t\t\t\tprocesses[info.pid] = info\n\t\t\t\t\tend\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\treturn(processes)\n\t\t\tend",
"def processes\n request('getAllProcessInfo')\n end",
"def ps\n sql = %q(\n select\n procpid,\n application_name as source,\n age(now(),query_start) as running_for,\n waiting,\n current_query as query\n from pg_stat_activity\n where\n current_query <> '<insufficient privilege>'\n AND current_query <> '<IDLE>'\n and procpid <> pg_backend_pid()\n order by 3 desc\n )\n\n exec_sql(sql, find_uri)\n end",
"def workers\n app = extract_app\n if workers = args.shift\n current = heroku.set_workers(app, workers)\n display \"#{app} now running #{quantify(\"worker\", current)}\"\n else\n workers = heroku.workers(app)\n display \"#{app} is running #{quantify(\"worker\", workers)}\"\n end\n end",
"def ps_cmd(pid)\n case RbConfig::CONFIG['arch']\n when /solaris|bsd/\n `ps -o comm,ppid -p #{pid}`\n when /linux/\n `ps -o cmd,ppid #{pid}`\n else\n raise 'UnknownOS'\n end.split(\"\\n\").last.split\nend",
"def workers\n # deprecation notice added to v2.21.3 on 03/16/12\n display(\"~ `heroku ps:workers QTY` has been deprecated and replaced with `heroku ps:scale workers=QTY`\")\n\n workers = shift_argument\n validate_arguments!\n\n if workers\n action(\"Scaling workers\") do\n new_workers = api.put_workers(app, workers).body[\"workers\"]\n status(\"now running #{new_workers}\")\n end\n else\n app_data = api.get_app(app).body\n if app_data[\"stack\"] == \"cedar\"\n raise(Heroku::Command::CommandFailed, \"For Cedar apps, use `heroku ps`\")\n else\n display(\"#{app} is running #{quantify(\"worker\", app_data[\"workers\"])}\")\n end\n end\n end",
"def up_ids\n with_fig(%w(ps -q)) do |exec_obj|\n exec_obj.run\n\n # parse stdout..\n re = Regexp.new '^[0-9a-zA-Z]+'\n res = []\n\n exec_obj.stdout.split(\"\\n\").each do |line|\n next unless line.match(re)\n res << line.chomp.strip\n end\n\n return res\n end\n nil\n end",
"def ps(all:false, before:nil, latest:false, since:nil)\n out = run!('ps', all:all,before:before,latest:latest,since:since)\n lines = out.split(/[\\n\\r]+/)\n header = lines.shift\n ids = lines.map { |line| line.split(/\\s+/).first }\n inspect(ids)\n end",
"def daemon_pids\n prog_name = Log2mail::PROGNAME\n own_pid = Process.pid\n # FIXME: finding daemon pids by using pgrep is NOT 'optimal' :-)\n `pgrep -f #{prog_name}`.split.map(&:to_i) - [own_pid]\n end",
"def call\n `ps -o rss -p #{@pid}`.split(\"\\n\").last.to_i\n end",
"def workers(amount = nil)\n heroku = ::Heroku::API.new(:api_key => ENV['HEROKU_API_KEY'])\n #\n # Returns the amount of Delayed Job\n # workers that are currently running on Heroku\n if amount.nil?\n processes = heroku.get_ps(ENV['APP_NAME']).body.select {|p| p['process'] =~ /worker.[0-9]+/}.length\n HireFire::Logger.message(\"Queried Heroku for processes - result: #{processes}\")\n return processes\n end\n\n ##\n # Sets the amount of Delayed Job\n # workers that need to be running on Heroku\n return heroku.post_ps_scale(ENV['APP_NAME'], \"worker\", amount) \n\n rescue Exception\n # Heroku library uses rest-client, currently, and it is quite\n # possible to receive RestClient exceptions through the client.\n HireFire::Logger.message(\"Worker query request failed with #{ $!.class.name } #{ $!.message }\")\n nil\n end",
"def get_children_process(pid)\n\t`ps --ppid #{pid} | grep -v PID | awk '{print $1}'`.split(\"\\n\")\n\t#Could not find a Ruby way to do this\nend",
"def unix_pids\n pids = []\n x = `ps auxw | grep -v grep | awk '{print $2, $11}' | grep #{app_name}`\n if x && x.chomp!\n processes = x.split(/\\n/).compact\n processes = processes.delete_if do |p|\n pid, name = p.split(/\\s/)\n # We want to make sure that the first part of the process name matches\n # so that app_name matches app_name_22\n app_name != name[0..(app_name.length - 1)]\n end\n pids = processes.map {|p| p.split(/\\s/)[0].to_i}\n end\n\n pids\n end",
"def unix_pids\n pids = []\n x = `ps auxw | grep -v grep | awk '{print $2, $11}' | grep #{app_name}`\n if x && x.chomp!\n processes = x.split(/\\n/).compact\n processes = processes.delete_if do |p|\n pid, name = p.split(/\\s/)\n # We want to make sure that the first part of the process name matches\n # so that app_name matches app_name_22\n app_name != name[0..(app_name.length - 1)]\n end\n pids = processes.map {|p| p.split(/\\s/)[0].to_i}\n end\n\n pids\n end",
"def srv_running\n return unless RUBY_PLATFORM =~ /linux/\n cmdobj = Mixlib::ShellOut.new(\"ps -ef | grep #{@new_resource.name} | grep java\")\n cmdobj.run_command.stdout.split(\"\\n\").reject { |e| e.include? \"sh -c\" }.size >= 1 # true or false\nend",
"def server_pids\n `lsof -wni | grep ruby | grep IPv4 | awk '{print $2}'`\n end",
"def running?\n processes = if node[\"platform_family\"] == \"windows\" then\n `powershell.exe -Command \\\"(Get-Process | Where-Object {$_.Name -eq \\'*aria*\\'}).count\\\"`.chop.to_i\n else \n cmd = Mixlib::ShellOut.new(\"pgrep -f #{new_resource.name}\")\n pgrep = cmd.run_command\n pgrep.stdout.length\n end\n processes > 0\nend",
"def pid\n pid = nil\n begin\n pid = capture :pgrep, \"-o -f resque-pool\"\n rescue SSHKit::Command::Failed\n end\n \n pid \n end",
"def list_pids\n access_processes do |processes|\n processes.keys\n end\n end",
"def scale\n app = extract_app\n current_process = nil\n changes = args.inject({}) do |hash, process_amount|\n if process_amount =~ /^([a-zA-Z0-9_]+)([=+-]\\d+)$/\n hash[$1] = $2\n end\n hash\n end\n\n error \"Usage: heroku ps:scale web=2 worker+1\" if changes.empty?\n\n changes.each do |process, amount|\n display \"Scaling #{process} processes... \", false\n amount.gsub!(\"=\", \"\")\n new_qty = heroku.ps_scale(app, :type => process, :qty => amount)\n display \"done, now running #{new_qty}\"\n end\n end",
"def pgrep(uuid)\n command = %Q(/usr/bin/pgrep -u $(id -u #{uuid}))\n pids, _, rc = Utils.oo_spawn(command, quiet: true, timeout: 300)\n\n case rc\n when 0\n pids.split(\"\\n\")\n when 1\n Array.new\n else\n raise RuntimeError, %Q(watchman search for running processes failed: #{command} (#{rc}))\n end\n end",
"def scale_dynos_down(dyno_name, count, current_count)\n dynos_for_type(dyno_name).sort_by { |d| d['elapsed'] }.reverse.take(current_count - count).each do |dyno|\n run_heroku_api_command(:post_ps_stop, app, { 'ps' => dyno['process'] })\n end\n end",
"def ps(*what)\n self.execute(['--local', 'ps', *what]) do |line|\n yield *line.split()\n end\n end",
"def monitor\n log_opts = LogOpts.new.num(10000).tail\n log_opts = log_opts.ps(options[:ps]) if options[:ps]\n \n process_data = {}\n lines = 1\n \n heroku.read_logs(app, log_opts.to_opts) do |line|\n line.split(/\\n/).each do |real_line|\n merge_data_from_line(real_line, process_data)\n end\n metrics_table(process_data)\n end\n end",
"def os_x_processes\n\t\traw = os_x_raw_ps.split(\"\\n\").slice(1, 99999)\n\t\traw.map do |line|\n\t\t\tparse_ps(line)\n\t\tend\n\tend",
"def os_x_processes\n\t\traw = os_x_raw_ps.split(\"\\n\").slice(1, 99999)\n\t\traw.map do |line|\n\t\t\tparse_ps(line)\n\t\tend\n\tend",
"def stop_unicorn\n system(\"ps -aux | grep unicorn\")\n puts \"Stoping unicorn...\"\n for app in @apps\n if @env == :deployment\n pid_file = \"#{APP_PATH}/log/unicorn.pid\"\n puts \"=> Reading pid from #{pid_file}\" \n if File.exist?(pid_file)\n system(\"kill -QUIT `cat #{pid_file}`\")\n else\n puts \"ERROR => pid file doesn't exist\"\n end\n end\n break\n end\n sleep(1)\n system(\"ps -aux | grep unicorn\")\nend",
"def plist(psname)\n counter = 0\n %x{ps h -o rss,size,vsize,pcpu -C #{psname}}.each do |ps|\n rss,size,vsize,cpu = ps.split\n counter += 1\n puts \"#{psname}_#{counter}.value #{rss}\"\n\n end\n return\nend",
"def stop\n dyno = shift_argument\n validate_arguments!\n\n message, options = case dyno\n when NilClass\n error(\"Usage: heroku ps:stop DYNO\\nMust specify DYNO to stop.\")\n when /.+\\..+/\n ps = args.first\n [\"Stopping #{ps} dyno\", { :ps => ps }]\n else\n type = args.first\n [\"Stopping #{type} dynos\", { :type => type }]\n end\n\n action(message) do\n api.post_ps_stop(app, options)\n end\n end",
"def find_pids(name)\n\tproc_pid = []\n\t@client.sys.process.get_processes.each do |proc|\n\t\tif proc['name'].downcase == name.downcase\n\t\t\tproc_pid << proc['pid']\n\t\tend\n\tend\n\treturn proc_pid\nend",
"def workers(amount = nil)\n\n #\n # Returns the amount of Delayed Job\n # workers that are currently running on Heroku\n if amount.nil?\n return heroku.get_ps(ENV['APP_NAME']).body.select {|p| p['process'] =~ /worker.[0-9]+/}.length\n end\n\n ##\n # Sets the amount of Delayed Job\n # workers that need to be running on Heroku\n return heroku.post_ps_scale(ENV['APP_NAME'], \"worker\", amount)\n\n rescue ::Heroku::API::Errors::Error\n HireFire::Logger.message(\"Worker query request failed with #{ $!.class.name } #{ $!.message }\")\n nil\n end",
"def all_processes\n `ps -eo pid,ppid`.lines.reduce(Hash.new []) do |hash, line|\n pid, ppid = line.split.map(&:to_i)\n hash[ppid] = [] unless hash.key?(ppid)\n hash[ppid] << pid\n hash\n end\n end",
"def status(args)\n system(\"docker-compose ps\")\n end",
"def status(args)\n system(\"docker-compose ps\")\n end",
"def get_all_pid\n all_pid = Array.new\n Dir.foreach(\"/proc\") do |pid|\n if (File.exists?(\"/proc/#{pid}/status\"))\n all_pid.push(pid)\n end\n end\n return(all_pid)\n end",
"def usage_by_ps\n memory = cmd(\"ps -o rsz #{process}\").split(\"\\n\")[1].to_f / 1.kilobyte\n return nil if memory <= 0\n\n memory\n end",
"def processes\n\t\tif ::File.directory? \"C:/WINDOWS\"\n\t\t\twindows_processes\n\t\telse\n\t\t\tos = `uname -s`.chomp\n\t\t\tif os == \"Linux\"\n\t\t\t\tresolve_unix_uids(linux_processes)\n\t\t\telsif os == \"Darwin\" or os == \"FreeBSD\"\n\t\t\t\tos_x_processes\n\t\t\telse\n\t\t\t\t[]\n\t\t\tend\n\t\tend\n\tend",
"def dyno\n @dyno ||= @analytics[:dynos].max_by {|name, count| count }\n end",
"def system_pids\n pids = `ps -e -o pid`.split(\"\\n\")\n pids.delete_at(0) # PID (header)\n pids.each(&:'strip!')\n end",
"def stop\n app = extract_app\n opt =\n if (args.first =~ /.+\\..+/)\n ps = args.first\n display \"Stopping #{ps} process... \", false\n {:ps => ps}\n elsif args.first\n type = args.first\n display \"Stopping #{type} processes... \", false\n {:type => type}\n else\n error \"Usage: heroku ps:stop PROCESS\"\n end\n\n heroku.ps_stop(app, opt)\n display \"done\"\n end",
"def tomcat?\n system \"ps aux| grep tomcat | grep catalina\"\n end",
"def current_proc_used_mem\n #pid, size = `ps ax -o pid,rss | grep -E \"^[[:space:]]*#{$$}\"`.strip.split.map(&:to_i)\n #`ps -o rss -p #{$$}`.chomp.split(\"\\n\").last.to_i\n #`ps -o rss -p #{$$}`.strip.split.last.to_i * 1024\n `ps -o rss= -p #{Process.pid}`.to_i \nend",
"def remote_processes\n stdout = ''\n self.exec!(\"ps -o pid,ppid,cmd -u #{self.options[:user]}\") do |_channel, stream, data|\n stdout << data if stream == :stdout\n end\n # Sample output:\n # PID PPID CMD\n # 2202 1882 /bin/sh /usr/bin/startkde\n # 2297 2202 /usr/bin/ssh-agent /usr/bin/gpg-agent --daemon --sh --write-env-file=/home/sa\n # 2298 2202 /usr/bin/gpg-agent --daemon --sh --write-env-file=/home/sayantamd/.gnupg/gpg-\n # 2301 1 /usr/bin/dbus-launch --exit-with-session /usr/bin/startkde\n # 2302 1 /bin/dbus-daemon --fork --print-pid 5 --print-address 7 --session\n\n @remote_processes = []\n ps_line_rexp = Regexp.compile('^(\\d+)\\s+(\\d+)\\s+(.+?)$')\n stdout.split(\"\\n\").each do |line|\n line.strip!\n next if line.blank? || line.match(/^PID/i)\n matcher = ps_line_rexp.match(line)\n process = OpenStruct.new\n process.pid = matcher[1].to_i\n process.ppid = matcher[2].to_i\n process.cmd = matcher[3]\n @remote_processes.push(process.freeze)\n end\n\n @remote_processes\n end",
"def restart\n app = extract_app\n\n opts = case args.first\n when NilClass then\n display \"Restarting processes... \", false\n {}\n when /.+\\..+/\n ps = args.first\n display \"Restarting #{ps} process... \", false\n { :ps => ps }\n else\n type = args.first\n display \"Restarting #{type} processes... \", false\n { :type => type }\n end\n heroku.ps_restart(app, opts)\n display \"done\"\n end",
"def rss\n `ps -o rss= -p #{ppid}`.chomp.to_i\n end",
"def index\n validate_arguments!\n\n Heroku::Command::Status.new.index\n display(\"\")\n\n styled_header(\"Checking processes\")\n get_processes(app)\n\n check_domains(app)\n display(\"\")\n\n styled_header(\"Recent Releases\")\n get_releases(app)\n display \"\"\n\n styled_header(\"Analyzing recent log entries\")\n get_log_stats(app)\n display \"\"\n\n end",
"def ps(cmd)\n # used cached powershell runtime, this saves a TON of processing\n PuppetX::PowerCLI::Helper.instance.ps(cmd)\n end",
"def list_ps_isos()\n search_string = \"ubuntu\"\n list_linux_isos(search_string)\n return\nend",
"def get_process_pids(image_name)\n pid_array = Array.new\n command = 'tasklist /FI \"IMAGENAME eq ' + \"#{image_name}\"\"\"\n command_output = `#{command}`\n command_output.each_line do |line|\n if line =~ /^#{image_name}/\n pid_array << line.split(/ +/)[1]\n end\n end\n return pid_array\n end",
"def list_pokemons\n\n end",
"def docker_ps_task(task_family)\n \"docker ps -n 1 -q --filter name=#{Shellwords.shellescape(task_family)}\"\n end",
"def dynos\n return @dynos.data if @dynos && @dynos.expires_at > Time.now\n @dynos = CacheEntry.new(get_dynos_from_api, Time.now + 60)\n @dynos.data\n end",
"def foreman_pids\n `ps aux | grep \"[f]oreman: master\" | awk '{ print $2 }'`.split(\"\\n\")\n end",
"def rackup_on_ports(opts, ru, prefix='app', count=4, start_port=3000)\n listeners = pids_on_ports(start_port, count)\n raise \"processes already listening on target ports: pids: #{listeners.inspect}. Run: rake vm:kill!\" unless listeners.empty?\n\n count.to_i.times do |i|\n puts \"--- Running process #{i}\"\n port = start_port + i\n cmd = \"#{MAGLEV_HOME}/bin/rackup #{opts} --pid log/#{prefix}-#{port}.pid --port #{port} #{ru}\"\n out = \"log/#{prefix}-#{i}.out\"\n sh \"echo #{cmd} > #{out}\" # zeros output and lets us know command\n sh \"nohup #{cmd} >> #{out} 2>&1 &\"\n sleep 1\n end\nend",
"def ps(*args) = execute(args: args)",
"def existing_instances(filter=\"\")\r\n instances_raw = `ps xao pid,pgid,command | grep '#{process_name} #{name_grep_string} #{filter}' | grep -iv #{Process.pid} | awk '{print $1 \"\\t\" $2 \"\\t\" $3}'`\r\n instances_raw.split(\"\\n\").map do |row|\r\n pid, group, command = row.split(\"\\t\")\r\n ProcessInfo.new(pid.to_i, group.to_i, command)\r\n end\r\n end",
"def each_process name, &block\n Sys::ProcTable.ps do |process|\n if process.comm.strip == name.strip && process.state != 'zombie'\n yield process.pid.to_i, process.state.strip\n end\n end\nend",
"def processes\n\t\tRush::ProcessSet.new(\n\t\t\tconnection.processes.map do |ps|\n\t\t\t\tRush::Process.new(ps, self)\n\t\t\tend\n\t\t)\n\tend",
"def processes\n\t\tRush::ProcessSet.new(\n\t\t\tconnection.processes.map do |ps|\n\t\t\t\tRush::Process.new(ps, self)\n\t\t\tend\n\t\t)\n\tend",
"def workers\n if known?\n @workers\n else\n know heroku_get_workers\n end\n end",
"def __check_for_running_processes(pids)\n if `ps -p #{pids.join(' ')}`.split(\"\\n\").size < arguments[:number_of_nodes]+1\n __log \"\\n[!!!] Process failed to start (see output above)\".ansi(:red)\n exit(1)\n end\n end",
"def infoFor(regex)\n info = `ps -eo pcpu,pid,pmem,args | sort -k 1 -r | grep #{regex} | head -1`\n info.split\n end",
"def _ps_browser(pat)\n x = `ps -ocomm,pcpu,rss -xwwc | grep -i #{pat}`\n\n if x.length > 0\n cpu = Float(/\\d+\\.\\d+/.match(x)[0])\n mem = Float(/\\d+$/.match(x)[0])*1024.0\n else\n cpu = -1.0\n mem = -1.0\n end\n \n return [cpu, mem]\n end",
"def get_ps_pids(pids = [])\n current_pids = session.sys.process.get_processes.keep_if { |p| p['name'].casecmp('powershell.exe').zero? }.map { |p| p['pid'] }\n # Subtract previously known pids\n current_pids = (current_pids - pids).uniq\n current_pids\n end",
"def list_processes\n check_connection\n @fields = @protocol.process_info_command\n @result_exist = true\n store_result\n end",
"def procs\n @procs\n end",
"def get_ps_info args={}, &block\n return if OS.windows?\n\n pid = args[:pid]\n\n EM.system('sh', proc{ |process|\n process.send_data \"ps auxw | grep \" + pid.to_s + \" | grep -v 'grep'\\n\"\n process.send_data \"exit\\n\"\n }) { |output, status|\n if status.exitstatus == 0\n format args, output, &block\n else\n block.call status, nil if block\n end\n }\n end",
"def sysload\n sysmem = 0\n # the pops here is to not include the two \"process\" found with ps the command itself which are gone by time pmap occurs\n pid_array = `ps -ef | grep java`.split(/\\n/)\n pid_array.each do |jproc|\n if jproc.match(/script\\/server/)\n pid = jproc.match(/.+?([0-9]+)/)[1].to_i #pid\n sysmem += (`pmap #{pid} | tail -1`[10,40].strip.gsub!(\"K\",\"\").to_f*100.0) / (1024* `free -mt`.match(/Mem:\\s*([0-9]+)/)[1].to_f)\n end\n end\n\n render :text => sysmem\n end",
"def domains\n if args.empty?\n domain_list\n return\n end\n\n case args.shift\n when \"add\"\n url = args.shift\n create_dependency(url)\n puts \"Added #{url} to the monitoring list\"\n return\n when \"remove\"\n url = args.shift\n remove_url(url)\n return\n when \"clear\"\n clear_all_dependencies\n puts \"All domains removed from the monitoring list\"\n return\n end\n raise(CommandFailed, \"see: heroku help ranger\")\n end",
"def stop\n system(\"ps -aux | grep rackup\")\n puts \"Stoping clusters...\"\n for app in @apps\n if @env == :deployment\n pid_file = \"#{APP_PATH}/log/doozer.#{app[:port]}.pid\"\n puts \"=> Reading pid from #{pid_file}\" \n if File.exist?(pid_file)\n File.open(pid_file, 'r'){ | f | \n pid = f.gets.to_i\n puts \"=> Shutting down process #{pid}\"\n system(\"kill -9 #{pid}\")\n\n }\n File.delete(pid_file) \n else\n puts \"ERROR => pid file doesn't exist\"\n end\n end\n end\n sleep(1)\n system(\"ps -aux | grep rackup\")\nend",
"def scale\n release = options[:version]\n changes = {}\n args.each do |arg|\n if arg =~ /^([a-zA-Z0-9_]+)([=+-]\\d+)$/\n changes[$1] = $2\n end\n end\n\n if changes.empty?\n error(\"Usage: heroku ps:scale PROCESS1=AMOUNT1 [PROCESS2=AMOUNT2 ...]\\nMust specify PROCESS and AMOUNT to scale.\")\n end\n\n changes.keys.sort.each do |process|\n amount = changes[process]\n action(\"Scaling #{process} processes\") do\n amount.gsub!(\"=\", \"\")\n new_qty = api.request(\n :expects => 200,\n :method => :post,\n :path => \"/apps/#{app}/ps/scale\",\n :query => {\n 'type' => process,\n 'qty' => amount,\n 'release' => release\n }\n ).body\n status(\"now running #{new_qty}\")\n end\n end\n end",
"def os_x_raw_ps\n\t\t`COLUMNS=9999 ps ax -o \"pid uid ppid rss cpu command\"`\n\tend",
"def os_x_raw_ps\n\t\t`COLUMNS=9999 ps ax -o \"pid uid ppid rss cpu command\"`\n\tend",
"def rolling\n process = shift_argument\n validate_arguments!\n processes = api.get_ps(app).body.map do |p|\n p.merge(\"process_type\" => p[\"process\"].split(\".\")[0],\n \"process_num\" => p[\"process\"].split(\".\")[1].to_i)\n end\n processes = processes.select do |p|\n process.nil? || p[\"process_type\"] == process\n end\n process_counts = processes.inject({}) do |counts, process|\n counts[process[\"process_type\"]] ||= 0\n counts[process[\"process_type\"]] += 1\n counts\n end\n processes = processes.sort_by do |p|\n (p[\"process_num\"].to_f / process_counts[p[\"process_type\"]].to_f)\n end\n\n message = process.nil? ? \"Deploying\" : \"Deploying #{process}\"\n start = Time.now\n deployed = 0\n total = processes.count\n width = total.to_s.length\n interval = 60\n (1..interval).each do |progress|\n ticker = [\"-\", \"\\\\\", \"|\", \"/\"][progress % 4]\n $stdout.print(\"\\r\")\n if processes.count <= 15\n $stdout.printf(\"#{message} processes... (%-#{width}s/%-#{width}s) %s\", deployed.to_s, total.to_s, ticker)\n else\n $stdout.printf(\"#{message} processes... (%-#{width}s/%-#{width}s)\", deployed.to_s, total.to_s)\n end\n $stdout.flush()\n processes.each_with_index do |process, index|\n if (((index / processes.size.to_f) * (interval -1).to_f).to_i + 1) == progress\n api.post_ps_restart(app, {:ps => process[\"process\"]})\n deployed += 1\n end\n end\n wait_til(start + progress) if (progress != interval)\n end\n $stdout.print(\"\\r\")\n $stdout.print(\"#{message} processes... done#{\" \" * 6}\\n\")\n $stdout.flush()\n end",
"def start_unicorn\n puts \"Starting unicorn...\"\n for app in @apps\n # unicorn\n @config_file = \"-c #{@config_file}\" if @config_file != ''\n cmd = \"unicorn -p #{app[:port]} -E #{@env.to_s} -o #{app[:ip]} #{@daemonize} #{@config_file} #{@config}\"\n puts \"=> #{cmd}\"\n system(cmd)\n break\n end\n puts \"Did they start?\"\n system(\"ps -aux | grep unicorn\")\nend",
"def index\n @prd_m_host_apps = PrdMHostApp.all\n end",
"def statusService( serviceName,jps )\n\tif(serviceName == \"icebox\")\n\t\ttest = `ps aux|grep icebox|grep -v grep`.split.sort\n\t\treturn (test.size > 0 ? true : false )\n\tend\n\n\tfmtServiceName = serviceName.gsub( /_/,'' ).downcase\n\n\tif(fmtServiceName == \"platformplugin\")\n\t\trunning = jps.include?( \"ThePlatformMetadataProviderMain\" ) \n\telsif(fmtServiceName == \"usermediaupload\")\n\t\trunning = jps.include?( \"usermediauploadservice\" ) \n\telse\n\t\trunning = jps.include?( fmtServiceName )\n\tend\n\n\tif(running == true)\n\t\tif(Options[:format] == :human)\n\t\t\tputs LogFormat % [GREEN,\"%s\\t\\trunning\" % serviceName]\n\t\tend\n\telse\n\t\tif(Options[:format] == :human)\n\t\t\tputs LogFormat % [RED,\"%s\\t\\tnot running\" % serviceName]\n\t\t\tputs \"\\tLogs: %s/%s\" % [FSLogPath,serviceName]\n\t\t\tputs \"\\tStart: %s/phoenix.rb start %s\" % [FSBinPath,serviceName]\n\t\tend\n\tend\n\treturn running\nend",
"def listspiders(project=self.project)\n get('listspiders.json', project: project)['spiders']\n end",
"def servers(backend = nil)\n my_servers = []\n if backend.nil?\n # return all servers\n backend_instances.each_value do | backend|\n my_servers << backend.server_names\n end\n else\n begin\n my_servers = backend_instances[backend].server_names\n rescue KeyError => e\n \"The backend #{backend} is not a valid argument\"\n end\n end\n # return a list of serv\n my_servers.flatten.uniq\n end",
"def process_exists?(pid)\n run(\"ps -p #{pid}\").success?\n end",
"def services\n services = RingyDingy::RingServer.list_services\n return [] if services.empty?\n\n services = RingyDingy::RingServer.list_services.values.first.uniq\n\n rrc_servers = services.select do |_, klass,|\n klass == RailsRemoteControl::Server::RINGY_DINGY_SERVICE\n end\n\n rrc_servers.map do |_, _, server, name|\n host, pid, = name.split '_', 3\n Server.new host, pid.to_i, server\n end\n end",
"def get_app_node_ips(namespace, app, status = \"Running\")\n pod_ips get_running_app_pods(namespace, app)\nend",
"def is_process_alive(pid)\n ps_ret = `ps | grep #{pid} | grep -v 'grep'`\n #puts \"PS: [#{ps_ret}]\"\n ps_ret != \"\" ? true : false\n end",
"def is_running?\n result = \"\"\n result = `ps -p #{pid} -o cmd=`.gsub(\"\\n\", \"\") unless pid.empty?\n\n result.split.first == \"unicorn\" ? true : false\n end",
"def active_instances\n Egi::Fedcloud::Vmhound::Log.info \"[#{self.class}] Retrieving running instances\"\n fetch_instances ['ACTIVE']\n end",
"def apps\n collect\n end",
"def list\n apps = Hermes::Route.list(Hash[options.map{|(k,v)| [k.to_sym,v]}])\n if !apps.empty?\n puts \"Apps:\"\n apps.each do |app|\n puts \" - #{app}\"\n end\n else\n puts \"No apps routed\"\n end\n end",
"def find_applications_by_app_name(app_name)\n pids = []\n\n begin\n x = `ps auxw | grep -v grep | awk '{print $2, $11, $12}' | grep #{app_name}`\n if x && x.chomp!\n processes = x.split(/\\n/).compact\n processes = processes.delete_if do |p|\n _pid, name, add = p.split(/\\s/)\n # We want to make sure that the first part of the process name matches\n # so that app_name matches app_name_22\n\n app_name != name[0..(app_name.length - 1)] and not add.include?(app_name)\n end\n pids = processes.map { |p| p.split(/\\s/)[0].to_i }\n end\n rescue ::Exception\n end\n\n pids.map do |f|\n app = Application.new(self, {}, PidMem.existing(f))\n setup_app(app)\n app\n end\n end",
"def daemon_process\n pid = nil\n Sys::ProcTable.ps do |process|\n if process.cmdline =~ /#{__FILE__}/ and process.pid != Process.pid\n pid = process.pid\n break\n end\n end\n pid\nend",
"def sapi_list\n @sapi_list ||= if supports_php5query?\n `/usr/sbin/php5query -q -S`.split(\"\\n\")\n else Array.new\n end\n end",
"def get_proc_list(pattern, zombies)\n require 'sys/proctable'\n require 'etc'\n\n res = Sys::ProcTable.ps.map do |ps|\n ret = nil\n\n if ps[\"cmdline\"] =~ /#{pattern}/\n if zombies\n ret = ps_to_hash(ps) if ps[:state] == \"Z\"\n else\n ret = ps_to_hash(ps)\n end\n end\n\n ret\n end\n\n res.compact\n end",
"def all_app_servers\n if is_zz?\n return app_config[:app_servers]\n end\n\n return @all_app_servers if @all_app_servers != nil\n @app_server_types ||= Set.new [ 'solo', 'app', 'app_master' ].freeze\n\n instances = ey['environment']['instances']\n\n # collect all the app server hosts\n @all_app_servers = []\n instances.each do |instance|\n if @app_server_types.include?(instance['role'])\n @all_app_servers << instance['private_hostname']\n end\n end\n # add ourselves if we have no info, running on dev box\n @all_app_servers << this_host_name if @all_app_servers.empty?\n\n @all_app_servers\n end"
] |
[
"0.73928475",
"0.6466832",
"0.6284456",
"0.62837636",
"0.62009585",
"0.61865413",
"0.618166",
"0.5909264",
"0.5864595",
"0.582588",
"0.57914877",
"0.5757039",
"0.574483",
"0.5734405",
"0.57155836",
"0.57106364",
"0.57038933",
"0.56999964",
"0.56834555",
"0.5605254",
"0.5566201",
"0.5566201",
"0.5552577",
"0.554133",
"0.55239505",
"0.55004686",
"0.54992884",
"0.5446438",
"0.5436037",
"0.53776807",
"0.5359891",
"0.53539246",
"0.535322",
"0.535322",
"0.5324795",
"0.5317079",
"0.53075886",
"0.5305968",
"0.53002083",
"0.52929646",
"0.52874386",
"0.52874386",
"0.5274269",
"0.52639365",
"0.52416885",
"0.5236691",
"0.5235608",
"0.52041733",
"0.5184674",
"0.5171793",
"0.5164592",
"0.51603633",
"0.51464987",
"0.51461476",
"0.5145054",
"0.5139242",
"0.5138761",
"0.5138151",
"0.5124015",
"0.5123618",
"0.51201075",
"0.51187986",
"0.51139975",
"0.507432",
"0.50721246",
"0.50420266",
"0.50417197",
"0.50339943",
"0.5033612",
"0.49956104",
"0.49874583",
"0.49864838",
"0.49830648",
"0.49664196",
"0.49645358",
"0.49564418",
"0.49515176",
"0.49093053",
"0.48937082",
"0.48829833",
"0.48829833",
"0.4881174",
"0.48806083",
"0.48767993",
"0.48588517",
"0.48587412",
"0.48573762",
"0.48567337",
"0.4849803",
"0.4848835",
"0.48484597",
"0.48402005",
"0.48377463",
"0.4836055",
"0.4834887",
"0.48333305",
"0.48326367",
"0.4831906",
"0.48310587",
"0.48242027"
] |
0.5821393
|
10
|
ps:restart [DYNO] restart an app dyno if DYNO is not specified, restarts all dynos on the app Examples: $ heroku ps:restart web.1 Restarting web.1 dyno... done $ heroku ps:restart web Restarting web dyno... done $ heroku ps:restart Restarting dynos... done
|
def restart
dyno = shift_argument
validate_arguments!
message, options = case dyno
when NilClass
["Restarting dynos", {}]
when /.+\..+/
ps = args.first
["Restarting #{ps} dyno", { :ps => ps }]
else
type = args.first
["Restarting #{type} dynos", { :type => type }]
end
action(message) do
api.post_ps_restart(app, options)
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def restart\n app = extract_app\n\n opts = case args.first\n when NilClass then\n display \"Restarting processes... \", false\n {}\n when /.+\\..+/\n ps = args.first\n display \"Restarting #{ps} process... \", false\n { :ps => ps }\n else\n type = args.first\n display \"Restarting #{type} processes... \", false\n { :type => type }\n end\n heroku.ps_restart(app, opts)\n display \"done\"\n end",
"def stop\n dyno = shift_argument\n validate_arguments!\n\n message, options = case dyno\n when NilClass\n error(\"Usage: heroku ps:stop DYNO\\nMust specify DYNO to stop.\")\n when /.+\\..+/\n ps = args.first\n [\"Stopping #{ps} dyno\", { :ps => ps }]\n else\n type = args.first\n [\"Stopping #{type} dynos\", { :type => type }]\n end\n\n action(message) do\n api.post_ps_stop(app, options)\n end\n end",
"def dynos\n # deprecation notice added to v2.21.3 on 03/16/12\n display(\"~ `heroku ps:dynos QTY` has been deprecated and replaced with `heroku ps:scale dynos=QTY`\")\n\n dynos = shift_argument\n validate_arguments!\n\n if dynos\n action(\"Scaling dynos\") do\n new_dynos = api.put_dynos(app, dynos).body[\"dynos\"]\n status(\"now running #{new_dynos}\")\n end\n else\n app_data = api.get_app(app).body\n if app_data[\"stack\"] == \"cedar\"\n raise(Heroku::Command::CommandFailed, \"For Cedar apps, use `heroku ps`\")\n else\n display(\"#{app} is running #{quantify(\"dyno\", app_data[\"dynos\"])}\")\n end\n end\n end",
"def restart\n process = shift_argument\n validate_arguments!\n release = options[:version]\n\n message, options = case process\n when NilClass\n [\"Restarting processes\", { }]\n when /.+\\..+/\n ps = args.first\n [\"Restarting #{ps} process\", { :ps => ps }]\n else\n type = args.first\n [\"Restarting #{type} processes\", { :type => type }]\n end\n\n action(message) do\n api.post_ps_restart(app, options.merge(:release => release))\n end\n end",
"def app_restart\n return unless restart_required?\n callback(:app_restart) do\n notify(:app_restart)\n heroku.app_restart\n end\n end",
"def restart\n\trequire_relative '../../lib/falcon/command/supervisor'\n\t\n\tFalcon::Command::Supervisor[\"restart\"].call\nend",
"def restart\n request('restart')\n end",
"def stop\n app = extract_app\n opt =\n if (args.first =~ /.+\\..+/)\n ps = args.first\n display \"Stopping #{ps} process... \", false\n {:ps => ps}\n elsif args.first\n type = args.first\n display \"Stopping #{type} processes... \", false\n {:type => type}\n else\n error \"Usage: heroku ps:stop PROCESS\"\n end\n\n heroku.ps_stop(app, opt)\n display \"done\"\n end",
"def restart\n invoke :stop, :all => input[:all], :apps => input[:apps]\n\n line unless quiet?\n\n input[:apps].each do |app|\n unless input[:command].nil?\n app.command = input[:command]\n end\n app.update!\n end\n\n invoke :start, :all => input[:all], :apps => input[:apps],\n :debug_mode => input[:debug_mode]\n end",
"def restart_unicorn\n stop_unicorn\n start_unicorn\nend",
"def restart_service\n service 'consul-haproxy' do\n action :restart\n end\nend",
"def restart\n\t\treturn nil unless self.running?\n\t\tProcess.kill 'SIGHUP', @pid\n\tend",
"def restart\n\tcall 'falcon:supervisor:restart'\nend",
"def restart\n\tcall 'falcon:supervisor:restart'\nend",
"def restart\n\tcall 'falcon:supervisor:restart'\nend",
"def restart(pid)\n `kill -s USR2 #{pid}`\n end",
"def restart_monit\n return if ENV['TEST_KITCHEN'] # Don't like it, but we can't run multiple processes in Docker on travis\n\n pidfile = \"/var/run/lock/#{app['shortname']}/puma.pid\"\n context.execute \"monit restart #{adapter}_#{app['shortname']}\" do\n retries 3\n only_if { ::File.exist?(pidfile) }\n end\n end",
"def restart(app_name)\n\t\tdelete(\"/apps/#{app_name}/server\")\n\tend",
"def restart!\n CouchRest.post \"#{@uri}/_restart\"\n end",
"def hot_restart\n system \"kill -s USR2 #{pid} > /dev/null 2>&1\"\n end",
"def cmd_restart argv\n setup argv\n response = @api.restart\n msg response\n return response\n end",
"def restart_monit(pidfile = nil)\n return if ENV['TEST_KITCHEN'] # Don't like it, but we can't run multiple processes in Docker on travis\n\n @monit_hook = {\n restart: true,\n pidfile: pidfile,\n apps: [\"#{adapter}_#{app['shortname']}\"]\n }\n end",
"def restart(pid=nil)\n `cp #{APP_ROOT}/services/drb.log #{APP_ROOT}/services/drb.bak`\n `cp #{APP_ROOT}/services/dico.log #{APP_ROOT}/services/dico.bak`\n if !pid.nil?\n pid.each {|x| `kill -1 #{x}`}\n sleep(1)\n end\n `cd #{APP_ROOT};#{WHICH_RAKE} #{RAKE_FILE}[#{SHARD_ID},#{MAX_SHARD}] >#{APP_ROOT}/services/drb.log 2>&1 &`\n puts \"## Restarted\"\nend",
"def restart(app_name)\n deprecate # 07/31/2012\n delete(\"/apps/#{app_name}/server\").to_s\n end",
"def action_restart\n return if options['never_restart']\n action_stop\n action_start\n end",
"def run\n `#{@apachectl} restart`\n end",
"def restart(*services) = execute(services: services)",
"def restart!\n # Permissions are handled by the script, use: :sudo => false\n run_script! :restart, :sudo => false\n end",
"def restart\n if @restart_command\n run_command(@restart_command)\n else\n stop\n start\n end\n end",
"def restart_server(type, date)\n stop_server(type, date)\n start_server(type, date)\n end",
"def restart(params)\n services = services_from_params(params)\n if @environment.in_dry_run_mode\n services.each do |agent|\n notify(:msg => \"[#{@name}] Would restart #{agent.host} (#{agent.type})\",\n :tags => [:galaxy, :dryrun])\n end\n services\n else\n command = ::Galaxy::Commands::RestartCommand.new([], @galaxy_options)\n command.report = GalaxyGatheringReport.new(@environment,\n '[' + @name + '] Restarted #{agent.host} (#{agent.type})',\n [:galaxy, :trace])\n execute(command, services)\n command.report.results\n end\n end",
"def stop_unicorn\n system(\"ps -aux | grep unicorn\")\n puts \"Stoping unicorn...\"\n for app in @apps\n if @env == :deployment\n pid_file = \"#{APP_PATH}/log/unicorn.pid\"\n puts \"=> Reading pid from #{pid_file}\" \n if File.exist?(pid_file)\n system(\"kill -QUIT `cat #{pid_file}`\")\n else\n puts \"ERROR => pid file doesn't exist\"\n end\n end\n break\n end\n sleep(1)\n system(\"ps -aux | grep unicorn\")\nend",
"def restart_running_instances_services\n nodes.each do |node|\n node.restart_with_monit\n end\n end",
"def restart_container\n do_service_action :restart_container\n end",
"def restart_soon\n @restart = true\n @shutdown = true\n end",
"def scale\n app = extract_app\n current_process = nil\n changes = args.inject({}) do |hash, process_amount|\n if process_amount =~ /^([a-zA-Z0-9_]+)([=+-]\\d+)$/\n hash[$1] = $2\n end\n hash\n end\n\n error \"Usage: heroku ps:scale web=2 worker+1\" if changes.empty?\n\n changes.each do |process, amount|\n display \"Scaling #{process} processes... \", false\n amount.gsub!(\"=\", \"\")\n new_qty = heroku.ps_scale(app, :type => process, :qty => amount)\n display \"done, now running #{new_qty}\"\n end\n end",
"def restart(name)\n if proc = @processes[name]\n proc.on(:exit) do\n start(name)\n end\n proc.stop\n elsif @commands_by_name[name]\n start(name)\n else\n raise \"no process for #{name}\"\n end\n end",
"def restart\n # Permissions are handled by the script, use: :sudo => false\n run_script :stop, :sudo => false\n end",
"def restart_server\n stop_server\n sleep 1\n start_server\n end",
"def action_restart\n proxy_action(:restart)\n end",
"def restart_appengine_apps\n # use a copy of @apps_to_restart here since we delete from it in\n # setup_appengine_application\n apps = @apps_to_restart\n apps.each { |app_name|\n if !my_node.is_login? # this node has the new app - don't erase it here\n Djinn.log_info(\"Removing old version of app #{app_name}\")\n Djinn.log_run(\"rm -fv /opt/appscale/apps/#{app_name}.tar.gz\")\n end\n Djinn.log_info(\"About to restart app #{app_name}\")\n APPS_LOCK.synchronize {\n setup_appengine_application(app_name, is_new_app=false)\n }\n }\n end",
"def reload(pid)\n `kill -s HUP #{pid}`\n end",
"def scale_dynos_down(dyno_name, count, current_count)\n dynos_for_type(dyno_name).sort_by { |d| d['elapsed'] }.reverse.take(current_count - count).each do |dyno|\n run_heroku_api_command(:post_ps_stop, app, { 'ps' => dyno['process'] })\n end\n end",
"def reload(env, app)\n system \"ey ssh -e #{translate_env(env,app)} 'rm -rf /data/#{translate_app(env,app)}/current/tmp/cache/*'\" # clear out cache\n if env == 'production' # total hack to clear cache on app2\n system \"ssh deploy@ec2-50-18-83-188.us-west-1.compute.amazonaws.com 'rm -rf /data/#{translate_app(env,app)}/current/tmp/cache/*'\"\n end\n restart(env, app)\nend",
"def restart\n if @time < @next_restart\n log.info \"synapse: at time #{@time} waiting until #{@next_restart} to restart\"\n return\n end\n\n @next_restart = @time + @restart_interval\n @next_restart += rand(@restart_jitter * @restart_interval + 1)\n\n # do the actual restart\n res = `#{opts['reload_command']}`.chomp\n unless $?.success?\n log.error \"failed to reload haproxy via #{opts['reload_command']}: #{res}\"\n return\n end\n log.info \"synapse: restarted nginx\"\n\n @restart_required = false\n end",
"def set_apps_to_restart(app_names)\n make_call(NO_TIMEOUT, RETRY_ON_FAIL, \"set_apps_to_restart\") {\n @conn.set_apps_to_restart(app_names, @secret)\n }\n end",
"def flag_hard_restart\n redis_path = `which redis-cli`.chomp\n if redis_path.empty?\n $stderr.puts 'SKIP: Cannot mark this deployment as a hard restart because \"redis-cli\" not available. ',\n 'Once the deployment is complete you can do a manual hard restart with:',\n \" $ ttmscalr restart all -f #{@farm_id}\"\n return 'SKIP'\n end\n redis_url = URI.parse(Scalr::Caller.variable_value('TTM_REDIS_URL', farm_id: @farm_id))\n\n # hardcoded, ignore the value in the URL b/c that's only valid within EC2\n host = 'proxy2.openredis.com'\n\n port = redis_url.port\n password = redis_url.password\n\n command = \"-h #{host} -p #{port} -a #{password} SET SCALR-ADMIN:DEPLOY:HARD:#{@farm_id} TRUE EX 300\"\n @verbose && puts(\"Marking deployment as hard restart with: #{redis_path} #{command}...\")\n result = `#{redis_path} #{command}`\n @verbose && puts(\"...results: #{result}\")\n result # if it works this is 'OK'\n end",
"def restart_mon_daemon(agent)\n\n agent = get_model(agent, Agent)\n\n command = CommandSpec.new( :repo => \"vendor\", :bundle => \"system/monitoring\",\n :command => \"mon_daemon.rb\", :args => \"restart\" )\n\n return exec(agent, command)\n end",
"def restart!\n IbmCloudRest.post \"#{@uri}/_restart\"\n end",
"def restart_command(cmd); end",
"def restart\n if booted then\n kill\n end\n start\n end",
"def restart!\n start!\n end",
"def restart(services)\n generate_config if stale_config\n update_platform_env\n services.each do |service|\n kubectl(\"rollout restart deploy #{clean_kubernetes_name(service)}\")\n end\n # down(services)\n # up(services)\n # status\n end",
"def restart_process\n puts 'restarting'\n exec RbConfig.ruby, File.expand_path(__FILE__), *ARGV\nend",
"def restart # :nodoc:\n put :restart\n end",
"def restart_app(app_name)\n app_type = get_app_type(app_name)\n app_ver = \"\"\n app_dir = get_app_dir(app_name,app_ver)\n case app_type\n when /prefPane/\n %x[pkill \"System Preferences\"]\n %x[open \"/Applications/System Preferences.app\"]\n when /app|util/\n %x[pkill \"#{app_name}\"]\n %x[open \"#{app_dir}\"]\n end\n return\nend",
"def restart(*args)\n stop\n start\n end",
"def kill\n procpid = shift_argument\n output_with_bang \"procpid must be a procpid\" unless procpid && procpid.to_i != 0\n procpid = procpid.to_i\n\n cmd = options[:force] ? 'pg_terminate_backend' : 'pg_cancel_backend'\n sql = %Q(select #{cmd}(#{procpid});)\n\n exec_sql(sql, find_uri)\n end",
"def restart()\n shutdown()\n start()\n end",
"def index\n dir = Pathname.new(File.expand_path(shift_argument || \".\")).realpath.to_s\n app = options[:app] || error(\"Must specify a development app with -a\")\n validate_arguments!\n\n user = api.post_login(\"\", Heroku::Auth.password).body[\"email\"]\n\n Anvil.append_agent \"interface=start user=#{user} app=#{app}\"\n\n slug_url = Anvil::Engine.build(dir, :buildpack => options[:buildpack])\n\n action(\"Preparing development dyno on #{app}\") do\n heroku.release(app, \"Initial development dyno sync\", :slug_url => development_dyno_slug_url){\n print \".\"\n $stdout.flush\n }\n end\n\n build_env = {\n \"ANVIL_HOST\" => ENV[\"ANVIL_HOST\"] || \"https://api.anvilworks.org\",\n \"BUILDPACK_URL\" => prepare_buildpack(options[:buildpack]),\n \"SLUG_URL\" => slug_url\n }\n\n develop_options = build_env.inject({}) do |ax, (key, val)|\n ax.update(\"ps_env[#{key}]\" => val)\n end\n\n process = action(\"Starting development dyno\") do\n status \"http://localhost:9000\"\n run_attached app, \"bin/development-dyno\", develop_options\n end\n\n client_to_dyno = pipe\n dyno_to_client = pipe\n\n client = Distributor::Client.new(dyno_to_client.first, client_to_dyno.last)\n\n client.on_hello do\n client.run(\"/app/vendor/bundle/ruby/1.9.1/bin/foreman start -c -p 5000\") do |ch|\n client.hookup ch, $stdin.dup, $stdout.dup\n client.on_close(ch) { shutdown(app, process[\"process\"]) }\n end\n\n start_file_watcher client, dir\n start_console_server client, dir\n start_http_tunnel client, 5000, 9000\n end\n\n client.on_command do |command, data|\n case command\n when /file.*/\n # sync complete messages\n when \"error\"\n error data[\"message\"]\n end\n end\n\n Thread.abort_on_exception = true\n\n rendezvous = Heroku::Client::Rendezvous.new(\n :rendezvous_url => process[\"rendezvous_url\"],\n :connect_timeout => 120,\n :activity_timeout => nil,\n :input => client_to_dyno.first,\n :output => dyno_to_client.last\n )\n\n rendezvous.on_connect do\n Thread.new { client.start }\n end\n\n Signal.trap(\"INT\") do\n shutdown(app, process[\"process\"])\n end\n\n begin\n $stdin.sync = $stdout.sync = true\n set_buffer false\n rendezvous.start\n rescue Timeout::Error\n error \"\\nTimeout awaiting process\"\n rescue Errno::ECONNREFUSED, Errno::ECONNRESET, OpenSSL::SSL::SSLError\n error \"\\nError connecting to process\"\n rescue Interrupt\n ensure\n set_buffer true\n end\n end",
"def pkill_action\n validate :signal, :shellsafe\n validate :pattern, String\n\n pids_to_kill = []\n\n get_proc_list(request[:pattern], false).each do |ps|\n pids_to_kill << ps[:pid]\n end\n\n # Sanity check \n if get_proc_list(\".\", false).size == pids_to_kill.size\n reply.fail \"Pattern matches all (#{pids_to_kill.size}) processes, refusing to kill\"\n return\n else\n reply[:killed] = 0\n\n pids_to_kill.each do |pid| \n system(\"logger -t mcolletive 'killing pid #{pid} based on pattern #{request[:pattern]}'\")\n\n killpid(request[:signal], pid)\n\n # bail out if something went wrong\n last if reply.statuscode > 0\n\n reply[:killed] += 1\n end\n end\n end",
"def automatic_restart\n @automatic_restart = true if @automatic_restart.nil?\n @automatic_restart\n end",
"def restart\n stop\n start\nend",
"def perform\n server_has_new_pid_file? && pid and kill_pid\n end",
"def restart\n ensure_session\n ensure_cli\n IRB.irb_at_exit\n str = \"Restarting: `#{ENV['IRT_COMMAND']}`\"\n puts\n puts IRT.dye(\" #{str} \", \"*** #{str} ***\", :error_color, :bold, :reversed)\n puts\n exec ENV[\"IRT_COMMAND\"]\n end",
"def reload_server\n restart_server\n end",
"def restart\n synchronize {\n if @app\n update_click_config\n else\n start\n end\n }\n end",
"def restart\n if config.managed? && started?\n stop\n start\n end\n end",
"def restart\n raise _(\"Server restart is only supported on Linux\") unless MiqEnvironment::Command.is_linux?\n\n _log.info(\"Server restart initiating...\")\n update_attribute(:status, \"restarting\")\n\n shutdown_and_exit(RESTART_EXIT_STATUS)\n end",
"def start_or_restart\n if isup?\n restart()\n else\n up()\n end\n end",
"def restart; end",
"def action_reload\n return if options['never_reload']\n if !upstart_features[:reload_signal] && new_resource.reload_signal != 'HUP'\n if options[:reload_shim]\n Process.kill(new_resource.reload_signal, pid)\n else\n check_reload_signal!\n end\n else\n super\n end\n end",
"def action_reload\n return if options['never_reload']\n notify_if_service do\n service_resource.run_action(:hup)\n end\n end",
"def restart\n stop\n sleep 2\n start\n end",
"def reload\n Guard::Compat::UI.info \"[Guard::WebPacker] Restarting #{@bin} ...\"\n restart\n end",
"def restart\n init_ivars\n @pages.clear\n @scheduler.restart\n end",
"def drb_restart!\n Vedeu.bind(:_drb_restart_) { Vedeu::Distributed::Server.restart }\n end",
"def signal_restart_graceful\n @signal_operation_queue << :restart_graceful\n interrupt_server_polling_sleep\n nil\n end",
"def restart_worker(wpid)\n info \"RESTARTING WORKER #{wpid}\"\n @mutex.synchronize do\n Process.kill(\"HUP\",wpid)\n mark_worker_as_stopped(wpid)\n @workers_restarting += 1\n end\n sleep Skynet::CONFIG[:WORKER_CHECK_DELAY]\n end",
"def restart!\n stop!\n start!\n end",
"def restart\n stop\n start\n end",
"def stop\n system(\"ps -aux | grep rackup\")\n puts \"Stoping clusters...\"\n for app in @apps\n if @env == :deployment\n pid_file = \"#{APP_PATH}/log/doozer.#{app[:port]}.pid\"\n puts \"=> Reading pid from #{pid_file}\" \n if File.exist?(pid_file)\n File.open(pid_file, 'r'){ | f | \n pid = f.gets.to_i\n puts \"=> Shutting down process #{pid}\"\n system(\"kill -9 #{pid}\")\n\n }\n File.delete(pid_file) \n else\n puts \"ERROR => pid file doesn't exist\"\n end\n end\n end\n sleep(1)\n system(\"ps -aux | grep rackup\")\nend",
"def run_worker(server_name)\n if !server_name.empty?\n %x| #{app_root}/bin/goliath s -e production -s #{server_name}|\n else\n %x| #{app_root}/bin/goliath s -e production|\n end\n end",
"def action_reload\n return if options['never_reload']\n if running?\n converge_by(\"reload service #{new_resource}\") do\n Process.kill(new_resource.reload_signal, pid)\n Chef::Log.info(\"#{new_resource} reloaded\")\n end\n end\n end",
"def phased_restart; end",
"def restart_or_shutdown_node_restart(opts = {})\n restart_or_shutdown_node_restart_with_http_info(opts)\n return nil\n end",
"def killall_cmd\n \"kill -9 `pgrep #{soffice_pname} #{unoconv_pname}`\"\n end",
"def signal_restart_forced\n @signal_operation_queue << :restart_forced\n interrupt_server_polling_sleep\n nil\n end",
"def restart\n stop if is_running?\n start\n\n is_running?\n end",
"def ReloadOrRestart\n if IsActive()\n if Modified()\n # reload is not sufficient\n RunSystemCtl(\"network\", \"stop\")\n EnableDisableNow()\n RunSystemCtl(\"network\", \"start\")\n else\n # reload may be unsupported\n RunSystemCtl(\"network\", \"reload-or-try-restart\")\n end\n else\n # always stop, it does not hurt if the net was stopped.\n RunSystemCtl(\"network\", \"stop\")\n EnableDisableNow()\n RunSystemCtl(\"network\", \"start\")\n end\n\n nil\n end",
"def restart_apache\n FileUtils.touch \"#{config.get(:current_path)}/tmp/restart.txt\"\n monit_command \"restart apache2\"\n end",
"def workers\n # deprecation notice added to v2.21.3 on 03/16/12\n display(\"~ `heroku ps:workers QTY` has been deprecated and replaced with `heroku ps:scale workers=QTY`\")\n\n workers = shift_argument\n validate_arguments!\n\n if workers\n action(\"Scaling workers\") do\n new_workers = api.put_workers(app, workers).body[\"workers\"]\n status(\"now running #{new_workers}\")\n end\n else\n app_data = api.get_app(app).body\n if app_data[\"stack\"] == \"cedar\"\n raise(Heroku::Command::CommandFailed, \"For Cedar apps, use `heroku ps`\")\n else\n display(\"#{app} is running #{quantify(\"worker\", app_data[\"workers\"])}\")\n end\n end\n end",
"def redis_restart_on_change\n restart_on_change = configuration[:redis][:restart_on_change]\n restart_on_change = true if restart_on_change.nil? # nil is true so we have a default value.\n restart_on_change\n end",
"def scale\n requires_preauth\n\n changes = args.map do |arg|\n if change = arg.scan(/^([a-zA-Z0-9_]+)([=+-]\\d+)(?::([\\w-]+))?$/).first\n formation, quantity, size = change\n quantity = quantity[1..-1].to_i if quantity[0] == \"=\"\n { \"type\" => formation, \"quantity\" => quantity, \"size\" => size}\n end\n end.compact\n\n if changes.empty?\n display_dyno_formation(get_formation)\n else\n action(\"Scaling dynos\") do\n new_scales = scale_dynos(get_formation, changes)\n .map {|p| \"#{p[\"type\"]} at #{p[\"quantity\"]}:#{p[\"size\"]}\" }\n status(\"now running \" + new_scales.join(\", \") + \".\")\n end\n end\n end",
"def set_apps_to_restart(apps_to_restart, secret)\n if !valid_secret?(secret)\n return BAD_SECRET_MSG\n end\n\n APPS_LOCK.synchronize {\n @apps_to_restart += apps_to_restart\n @apps_to_restart.uniq!\n }\n Djinn.log_debug(\"Apps to restart is now [#{@apps_to_restart.join(', ')}]\")\n\n return \"OK\"\n end",
"def restart_hybris(startup_script)\n stop_hybris(startup_script)\n start_hybris(startup_script)\n end",
"def restart(config = nil)\n config ||= agent&.config\n stop if running?\n start(config)\n end",
"def must_restart?\n return @restart\n end",
"def scale\n release = options[:version]\n changes = {}\n args.each do |arg|\n if arg =~ /^([a-zA-Z0-9_]+)([=+-]\\d+)$/\n changes[$1] = $2\n end\n end\n\n if changes.empty?\n error(\"Usage: heroku ps:scale PROCESS1=AMOUNT1 [PROCESS2=AMOUNT2 ...]\\nMust specify PROCESS and AMOUNT to scale.\")\n end\n\n changes.keys.sort.each do |process|\n amount = changes[process]\n action(\"Scaling #{process} processes\") do\n amount.gsub!(\"=\", \"\")\n new_qty = api.request(\n :expects => 200,\n :method => :post,\n :path => \"/apps/#{app}/ps/scale\",\n :query => {\n 'type' => process,\n 'qty' => amount,\n 'release' => release\n }\n ).body\n status(\"now running #{new_qty}\")\n end\n end\n end",
"def restart(cart_name)\n cart_model.do_control(\"restart\", cart_name)\n end"
] |
[
"0.7808233",
"0.70183223",
"0.6879686",
"0.6516336",
"0.6363924",
"0.60094196",
"0.58866405",
"0.58373404",
"0.5832172",
"0.5785113",
"0.5772512",
"0.57717407",
"0.5747413",
"0.5747413",
"0.5747413",
"0.57333165",
"0.5728457",
"0.57136476",
"0.57011676",
"0.56873596",
"0.56751364",
"0.5651401",
"0.5625517",
"0.5614313",
"0.56107897",
"0.55560136",
"0.5555402",
"0.5532526",
"0.5482629",
"0.54606277",
"0.54351753",
"0.53687614",
"0.53651196",
"0.53509927",
"0.5333645",
"0.533312",
"0.53282076",
"0.5311961",
"0.53102833",
"0.52955675",
"0.52798986",
"0.527905",
"0.52713007",
"0.5251756",
"0.5247323",
"0.52461",
"0.5245377",
"0.52294743",
"0.5222032",
"0.517245",
"0.51576495",
"0.5135309",
"0.50993735",
"0.50904495",
"0.5079017",
"0.5073609",
"0.50703496",
"0.5069857",
"0.50642365",
"0.5061749",
"0.5060651",
"0.5059353",
"0.5041126",
"0.5006472",
"0.50063795",
"0.50044763",
"0.5002492",
"0.4992049",
"0.49841475",
"0.49836192",
"0.4981032",
"0.49733293",
"0.49676",
"0.49433333",
"0.49400988",
"0.49378377",
"0.4931565",
"0.49198732",
"0.4919279",
"0.49131808",
"0.49119526",
"0.4907166",
"0.49012622",
"0.48909122",
"0.48826325",
"0.4874803",
"0.48652768",
"0.48644972",
"0.48519564",
"0.4842798",
"0.48383915",
"0.48258105",
"0.4823185",
"0.48224482",
"0.4820984",
"0.4811487",
"0.48102883",
"0.4806889",
"0.48019117",
"0.47979733"
] |
0.8166115
|
0
|
ps:scale [DYNO1=AMOUNT1 [DYNO2=AMOUNT2 ...]] scale dynos by the given amount appending a size (eg. web=2:2X) allows simultaneous scaling and resizing omitting any arguments will display the app's current dyno formation, in a format suitable for passing back into ps:scale Examples: $ heroku ps:scale web=3:2X worker+1 Scaling dynos... done, now running web at 3:2X, worker at 1:1X. $ heroku ps:scale web=3:2X worker=1:1X
|
def scale
requires_preauth
changes = args.map do |arg|
if change = arg.scan(/^([a-zA-Z0-9_]+)([=+-]\d+)(?::([\w-]+))?$/).first
formation, quantity, size = change
quantity = quantity[1..-1].to_i if quantity[0] == "="
{ "type" => formation, "quantity" => quantity, "size" => size}
end
end.compact
if changes.empty?
display_dyno_formation(get_formation)
else
action("Scaling dynos") do
new_scales = scale_dynos(get_formation, changes)
.map {|p| "#{p["type"]} at #{p["quantity"]}:#{p["size"]}" }
status("now running " + new_scales.join(", ") + ".")
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def scale\n app = extract_app\n current_process = nil\n changes = args.inject({}) do |hash, process_amount|\n if process_amount =~ /^([a-zA-Z0-9_]+)([=+-]\\d+)$/\n hash[$1] = $2\n end\n hash\n end\n\n error \"Usage: heroku ps:scale web=2 worker+1\" if changes.empty?\n\n changes.each do |process, amount|\n display \"Scaling #{process} processes... \", false\n amount.gsub!(\"=\", \"\")\n new_qty = heroku.ps_scale(app, :type => process, :qty => amount)\n display \"done, now running #{new_qty}\"\n end\n end",
"def scale\n release = options[:version]\n changes = {}\n args.each do |arg|\n if arg =~ /^([a-zA-Z0-9_]+)([=+-]\\d+)$/\n changes[$1] = $2\n end\n end\n\n if changes.empty?\n error(\"Usage: heroku ps:scale PROCESS1=AMOUNT1 [PROCESS2=AMOUNT2 ...]\\nMust specify PROCESS and AMOUNT to scale.\")\n end\n\n changes.keys.sort.each do |process|\n amount = changes[process]\n action(\"Scaling #{process} processes\") do\n amount.gsub!(\"=\", \"\")\n new_qty = api.request(\n :expects => 200,\n :method => :post,\n :path => \"/apps/#{app}/ps/scale\",\n :query => {\n 'type' => process,\n 'qty' => amount,\n 'release' => release\n }\n ).body\n status(\"now running #{new_qty}\")\n end\n end\n end",
"def dynos\n # deprecation notice added to v2.21.3 on 03/16/12\n display(\"~ `heroku ps:dynos QTY` has been deprecated and replaced with `heroku ps:scale dynos=QTY`\")\n\n dynos = shift_argument\n validate_arguments!\n\n if dynos\n action(\"Scaling dynos\") do\n new_dynos = api.put_dynos(app, dynos).body[\"dynos\"]\n status(\"now running #{new_dynos}\")\n end\n else\n app_data = api.get_app(app).body\n if app_data[\"stack\"] == \"cedar\"\n raise(Heroku::Command::CommandFailed, \"For Cedar apps, use `heroku ps`\")\n else\n display(\"#{app} is running #{quantify(\"dyno\", app_data[\"dynos\"])}\")\n end\n end\n end",
"def scale!(type, size)\n @transforms << \"#{SCALE_TYPES[type]}#{size}\"\n self\n end",
"def workers\n # deprecation notice added to v2.21.3 on 03/16/12\n display(\"~ `heroku ps:workers QTY` has been deprecated and replaced with `heroku ps:scale workers=QTY`\")\n\n workers = shift_argument\n validate_arguments!\n\n if workers\n action(\"Scaling workers\") do\n new_workers = api.put_workers(app, workers).body[\"workers\"]\n status(\"now running #{new_workers}\")\n end\n else\n app_data = api.get_app(app).body\n if app_data[\"stack\"] == \"cedar\"\n raise(Heroku::Command::CommandFailed, \"For Cedar apps, use `heroku ps`\")\n else\n display(\"#{app} is running #{quantify(\"worker\", app_data[\"workers\"])}\")\n end\n end\n end",
"def scale(*amount)\n self.dup.scale! *amount\n end",
"def scale(app_env)\n name, env = app_env.split(SEPARATOR)\n scaling = self.settings['scale'] || {}\n all = scaling['all'] || {}\n\n app_scaling = (scaling[name] && scaling[name].reject { |k,v| v.class == Hash }) || {}\n # overwrite app scaling with the environment specific ones\n merged_environment_scaling = app_scaling.merge((scaling[name] && scaling[name][env]) || {})\n\n # overwrite all scaling with the environment specific ones\n all.merge(merged_environment_scaling)\n end",
"def scale(sx,sy)\n set RGhost::Scale.new(sx,sy)\n \n end",
"def scale_dynos_down(dyno_name, count, current_count)\n dynos_for_type(dyno_name).sort_by { |d| d['elapsed'] }.reverse.take(current_count - count).each do |dyno|\n run_heroku_api_command(:post_ps_stop, app, { 'ps' => dyno['process'] })\n end\n end",
"def scale(name)\n \n end",
"def scaleimage **opts\n Vips::Image.scale self, **opts\n end",
"def scale(*args)\n with_command %(-scale \"#{Geometry.new(*args)}\")\n end",
"def scale_to(pool_name, target_num_servers)\n current_server_count = current_pool_size(pool_name)\n if target_num_servers > current_server_count\n remove_servers(pool(pool_name)[target_num_servers..-1])\n else\n add_additional_servers(pool_name, target_num_servers - current_server_count)\n end\n end",
"def scale(*args, &block); end",
"def scale_appservers_within_nodes\n if @creds[\"autoscale\"].downcase == \"true\"\n perform_scaling_for_appservers()\n end\n end",
"def stop\n dyno = shift_argument\n validate_arguments!\n\n message, options = case dyno\n when NilClass\n error(\"Usage: heroku ps:stop DYNO\\nMust specify DYNO to stop.\")\n when /.+\\..+/\n ps = args.first\n [\"Stopping #{ps} dyno\", { :ps => ps }]\n else\n type = args.first\n [\"Stopping #{type} dynos\", { :type => type }]\n end\n\n action(message) do\n api.post_ps_stop(app, options)\n end\n end",
"def scale_to(new_size)\n scale_to(new_size, background:nil)\n end",
"def create_scale(*args)\n end",
"def scale= scale\n protected_use_method(MM::Scaling, :@scale, scale)\n end",
"def scale(scale_x, scale_y, center_x = nil, center_y = nil)\n args = [scale_x, scale_y, center_x, center_y].compact\n @canvas << js_method('scale', *args)\n return self\n end",
"def ctrlScale _args\n \"ctrlScale _args;\" \n end",
"def scale( scale_x, scale_y = scale_x )\n dup.scale!(scale_x, scale_y)\n end",
"def scales\n \n end",
"def scale(x, y)\n primitive 'scale ' + sprintf('%g,%g', x, y)\n end",
"def sub_scale _value, _abs=0\n send_cmd(\"sub_scale #{_value} #{_abs}\")\n end",
"def after_enqueue_scale_workers_up(*args)\n if HerokuScaler.heroku?\n scaler = HerokuScaler.new(@queue)\n scaler.workers = 1 if job_count > 0\n end\n end",
"def scaleup(now, priority)\n if now == false \n # Job will be examined and run by scheduler later\n jid = $jobManager.register(-1, @envid, \"SCALEUP\", @name, \"READY\", priority)\n # Make a request to the global scheduler for capacity\n if $useGlobalScheduler == true\n template=ENVIRONMENT[@name][:slave_template]\n if template == nil\n $Logger.error \"scaleup: unable to find slave template for env #{@name} envid #{@envid}\"\n return\n end\n # Put a cap on number of requests sent to global scheduler\n # NOTE: For time based policy the throttling is done in \n # elastic_maanger/evaltimepolicy()\n if ENVIRONMENT[@name][:elasticity_policy] != nil &&\n ENVIRONMENT[@name][:elasticity_policy][:max] != nil \n maxVMs = ENVIRONMENT[@name][:elasticity_policy][:max] \n else\n maxVMs=16\n end\n if @vms.size + @gsOutStandingReqs > maxVMs\n $Logger.info \"scaleup: Too many outstanding requests to global schduler #{@name} envid #{@envid} outstanding #{@gsOutStandingReqs}\"\n return \"Too many scale up requests outstanding\"\n end\n \n vcpus = TEMPLATE[template][:cpu]\n mem = TEMPLATE[template][:memory]\n $gsProxy.request(@envid, @name, vcpus, mem, ENVIRONMENT[@name][:endpoint])\n @gsOutStandingReqs += 1\n end\n return jid\n end\n paramfile = $WORKDIR + \"/envconfig.\" + @name\n execString = $SVCBIN + \" -c \" + paramfile + \" -u \" + @envid\n childpid=Kernel.fork\n if childpid == nil\n Helper.closeFds()\n $stdout.reopen($ENVLOGFILE + \".#{@envid}\",'a+')\n $stderr.reopen($ENVLOGFILE + \".#{@envid}\",'a+')\n exec(execString)\n end\n jid = $jobManager.register(childpid, @envid, \"SCALEUP\", @name, \"RUNNING\", priority)\n return jid \n end",
"def workers=(n)\n if n != @workers || !known?\n p \"Scaling #{type} to #{n}\"\n heroku_set_workers(n)\n know n\n end\n end",
"def scale_ratios\n @scales[@scale_id.to_s].map{|p| (p.is_a? String) ? eval(p) : p}\n end",
"def workers(amount = nil)\n heroku = ::Heroku::API.new(:api_key => ENV['HEROKU_API_KEY'])\n #\n # Returns the amount of Delayed Job\n # workers that are currently running on Heroku\n if amount.nil?\n processes = heroku.get_ps(ENV['APP_NAME']).body.select {|p| p['process'] =~ /worker.[0-9]+/}.length\n HireFire::Logger.message(\"Queried Heroku for processes - result: #{processes}\")\n return processes\n end\n\n ##\n # Sets the amount of Delayed Job\n # workers that need to be running on Heroku\n return heroku.post_ps_scale(ENV['APP_NAME'], \"worker\", amount) \n\n rescue Exception\n # Heroku library uses rest-client, currently, and it is quite\n # possible to receive RestClient exceptions through the client.\n HireFire::Logger.message(\"Worker query request failed with #{ $!.class.name } #{ $!.message }\")\n nil\n end",
"def scale\n @photo = Photo.find(params[:id])\n img = Magick::Image.read('public' + @photo.attachment_url).first\n img = img.scale(1.5)\n img.write('public' + @photo.attachment_url)\n end",
"def scale(*args)\n r = Rect.new x, y, w, h\n r.resolution = r.resolution * Vector2[args.singularize]\n r\n end",
"def scale(factor_x, factor_y=factor_x, &rendering_code); end",
"def restart\n dyno = shift_argument\n validate_arguments!\n\n message, options = case dyno\n when NilClass\n [\"Restarting dynos\", {}]\n when /.+\\..+/\n ps = args.first\n [\"Restarting #{ps} dyno\", { :ps => ps }]\n else\n type = args.first\n [\"Restarting #{type} dynos\", { :type => type }]\n end\n\n action(message) do\n api.post_ps_restart(app, options)\n end\n end",
"def scale_params\n params.require(:scale).permit(:date, :type_scale, :description, :hours, member_scales_attributes: [:id, :member_id, :_destroy])\n end",
"def workers(amount = nil)\n\n #\n # Returns the amount of Delayed Job\n # workers that are currently running on Heroku\n if amount.nil?\n return heroku.get_ps(ENV['APP_NAME']).body.select {|p| p['process'] =~ /worker.[0-9]+/}.length\n end\n\n ##\n # Sets the amount of Delayed Job\n # workers that need to be running on Heroku\n return heroku.post_ps_scale(ENV['APP_NAME'], \"worker\", amount)\n\n rescue ::Heroku::API::Errors::Error\n HireFire::Logger.message(\"Worker query request failed with #{ $!.class.name } #{ $!.message }\")\n nil\n end",
"def patch_namespaced_deployment_scale(name, namespace, body, opts = {})\n data, _status_code, _headers = patch_namespaced_deployment_scale_with_http_info(name, namespace, body, opts)\n return data\n end",
"def scale pairs\n @scale.call pairs\n end",
"def scale(max_size, desired_capacity)\n client.update_auto_scaling_group(auto_scaling_group_name: asg_name, max_size: max_size, desired_capacity: desired_capacity)\n end",
"def scale(value)\n scaled = case value\n when 0..1023\n [value, 'B']\n when 1024..1024**2 - 1\n [value / 1024, 'KB']\n when 1024^2..1024**3 - 1\n [value / 1024**2, 'MB']\n else\n [value / 1024**3, 'GB']\n end\n end",
"def setscale(*)\n super\n end",
"def scale\n raise NotImplementedError, \"Subclass responsibility\"\n end",
"def ctrlSetScale _obj, _args\n \"_obj ctrlSetScale _args;\" \n end",
"def scale_up(scale)\n self.side_length *= scale\n end",
"def autoscale_params\n params.require(:auto_scale).permit(:grow_cpu_thresh, :shrink_cpu_thresh, :grow_ratio_thresh, :shrink_ratio_thresh, :enabled, :max_instances, :cooldown_period_in_seconds)\n end",
"def scale=(val)\n self['scale'] = val\n end",
"def scale(xscale, yscale = xscale)\n current_transformation.scale(xscale, yscale)\n self[\"transform\"] = current_transformation.to_s\n end",
"def restart\n app = extract_app\n\n opts = case args.first\n when NilClass then\n display \"Restarting processes... \", false\n {}\n when /.+\\..+/\n ps = args.first\n display \"Restarting #{ps} process... \", false\n { :ps => ps }\n else\n type = args.first\n display \"Restarting #{type} processes... \", false\n { :type => type }\n end\n heroku.ps_restart(app, opts)\n display \"done\"\n end",
"def set_p_scale\n @p_scale = PScale.find(params[:id])\n end",
"def perform_scaling_for_appservers()\n APPS_LOCK.synchronize {\n @apps_loaded.each { |app_name|\n\n next if app_name == \"none\" \n initialize_scaling_info_for_app(app_name)\n\n # Always get scaling info, as that will send this info to the\n # AppDashboard for users to view.\n case get_scaling_info_for_app(app_name)\n when :scale_up\n Djinn.log_debug(\"Considering scaling up app #{app_name}.\")\n try_to_scale_up(app_name)\n when :scale_down\n Djinn.log_debug(\"Considering scaling down app #{app_name}.\")\n try_to_scale_down(app_name)\n else\n Djinn.log_debug(\"Not scaling app #{app_name} up or down right now.\")\n end\n }\n }\n end",
"def scale_variation(opts)\n vector_variation(opts.merge(:attribute => :scale))\n end",
"def large_process\n case [model.attachable_type, model.image_type]\n when ['User', 'avatar'] then\n resize_to_fill 1024, 683 # 3x2\n when ['User', 'inspiration'] then\n resize_to_fit 1024, 9999 # fixed width\n when ['Message', 'avatar'] then\n resize_to_fit 1024, 9999 # fixed width\n when ['Message', 'alternate'] then\n resize_to_fit 1024, 9999 # fixed width\n when ['Alternative', 'avatar'] then\n resize_to_fill 1024, 683 # 3x2\n else\n resize_to_fit 1024, 9999 # fixed width\n end\n # TODO: Test and implement this.\n # fix_exif_rotation\n quality 70\n end",
"def pause_scaling_events\n client.suspend_processes(auto_scaling_group_name: asg_name,\n scaling_processes:\n %w[ReplaceUnhealthy AlarmNotification ScheduledActions AZRebalance])\n end",
"def type\n requires_preauth\n app\n formation = get_formation\n changes = if args.any?{|arg| arg =~ /=/}\n args.map do |arg|\n if arg =~ /^([a-zA-Z0-9_]+)=([\\w-]+)$/\n type, new_size = $1, $2\n current_p = formation.find{|f| f[\"type\"] == type}\n if current_p.nil?\n error(\"Type '#{type}' not found in process formation.\")\n end\n p = current_p.clone\n p[\"size\"] = new_size\n p\n end\n end.compact\n elsif args.any?\n size = shift_argument.downcase\n validate_arguments!\n formation.map{|p| p[\"size\"] = size; p}\n end\n scale_dynos(formation, changes) if changes\n display_dyno_type_and_costs(get_formation)\n end",
"def ctrlMapScale _args\n \"ctrlMapScale _args;\" \n end",
"def insp_comm_scale_params\n params.require(:insp_comm_scale).permit(:inspector_id, :scaleStart, :scaleEnd, :rate)\n end",
"def scaled_to(destination)\n Scale.transform(self).to(destination)\n end",
"def scale_fontsize(value)\n value * @scale\n end",
"def scale(value)\r\n value * @height/2 + @height/4\r\n end",
"def p_scale_params\n params.require(:p_scale).permit(:name, :value)\n end",
"def scaled_using(source, destination)\n Scale.transform(self).using(source, destination)\n end",
"def set_scale\n @scale = Scale.find(params[:id])\n end",
"def correct_scale_to(current, min, max, scale_to)\n if current < min\n log_txt \"current replicas for deployment #{config.deploy_name} \" \\\n \"are less then min replicas, will scale to #{min} replicas\"\n return min\n elsif current > max\n log_txt \"current replicas for deployment #{config.deploy_name} \" \\\n \"are more then max replicas, will scale to #{max} replicas\"\n return max\n else\n return scale_to\n end\n end",
"def pay_scale\n payscale_pattern = salary[/(\\wPS\\d*)/, 1] || salary[/([MU]\\d+)/, 1]\n payscale = payscale_pattern.present? ? payscale_pattern.gsub(/\\W*(\\w{1})(\\d+)/, '\\1PS\\3') : nil\n payscale = 'MPS1' if payscale == 'MPS'\n payscale = 'UPS3' if payscale == 'UPS'\n return payscale if payscale.present? && PayScale.exists?(code: payscale)\n\n payscale = salary.scan(/(L)\\w*\\s*(P)\\w*\\s*(S)\\w*\\s*(\\d*)/)\n return payscale.join('') if payscale.present? && PayScale.exists?(code: payscale)\n\n pay_scale = PayScale.find_by(salary: min_salary)\n pay_scale.present? ? pay_scale.code : nil\n end",
"def replace_namespaced_deployment_scale(name, namespace, body, opts = {})\n data, _status_code, _headers = replace_namespaced_deployment_scale_with_http_info(name, namespace, body, opts)\n return data\n end",
"def set_joint_scale(scale, wrap_op = true)\n scale = AMS.clamp(scale.to_f, 0.01, 100.00)\n model = Sketchup.active_model\n if wrap_op\n op = 'MSPhysics - Scale Joints'\n Sketchup.version.to_i > 6 ? model.start_operation(op, true, false, false) : model.start_operation(op)\n end\n model.set_attribute('MSPhysics', 'Joint Scale', scale)\n count = scale_joints(scale)\n model.commit_operation if wrap_op\n count\n end",
"def scale!(rhs)\n scale rhs, self\n end",
"def scale\n self['scale']\n end",
"def scale(factor_x, factor_y, around_x, around_y, &rendering_code); end",
"def scale_cloud!\n add_instance_if_load_is_high\n terminate_instance_if_load_is_low\n end",
"def scale_to_fit_container( aspect, container_width, container_height )\n width, height = aspect.split( Optparser::ASPECT_CHOICE_CUSTOM_PREFIX ).last.split( 'x' ).collect{|x| x.to_f}\n factor = container_height / container_width > height / width ? container_width / width : container_height / height\n @logger.debug( \"Scaling factor to fit custom aspect ratio #{ width } x #{ height } in #{ @options.size } container: #{ factor }\" )\n width_scaled = width * factor\n height_scaled = height * factor\n return width_scaled.floor, height_scaled.floor\n end",
"def scale(x, y=x)\n CGContextScaleCTM(@ctx, x, y)\n end",
"def process_scale_input(input)\n process_boolean_input(input, :auto_scale)\n end",
"def scale(w, h, method = :bilinear)\n @image.send(\"resample_#{method}!\", w, h)\n self\n end",
"def setSize(szX,szY,scale,centerp=FALSE)\n @device.setSize(szX,szY,scale,centerp) ;\n end",
"def scale(factor=0.75, quality: nil)\n \n read() do |img|\n \n img2 = img.scale(factor) \n write img2, quality\n \n end\n \n end",
"def scale_by(width_factor, height_factor, &block)\n squish(width*width_factor, height*height_factor, &block)\n end",
"def scale(series, control, multiplier=1)\n map_over series, control, multiplier do |val,previous|\n [val * multiplier, val]\n end\n end",
"def scale(arr)\n arr.sum(0){ |e| e * e } if arr.is_a?(Array)\n end",
"def set_page_scale_factor(page_scale_factor:)\n {\n method: \"Emulation.setPageScaleFactor\",\n params: { pageScaleFactor: page_scale_factor }.compact\n }\n end",
"def workers\n app = extract_app\n if workers = args.shift\n current = heroku.set_workers(app, workers)\n display \"#{app} now running #{quantify(\"worker\", current)}\"\n else\n workers = heroku.workers(app)\n display \"#{app} is running #{quantify(\"worker\", workers)}\"\n end\n end",
"def get_scale\n runs = []\n 10.times do\n runs << measure(1, &@options[:fn])\n end\n runs.inject(:+) / 10\n end",
"def make_responsive(img,type,width)\n [\n [\"-resize 'x#{width}>'\", \".webp\"],\n [\"-resize 'x#{width * 2}>'\", \"@2x.webp\"],\n ].each do |i|\n convert(type, img, i.first, i.last)\n end\nend",
"def scale\n @data['scale']\n end",
"def run_worker(server_name)\n if !server_name.empty?\n %x| #{app_root}/bin/goliath s -e production -s #{server_name}|\n else\n %x| #{app_root}/bin/goliath s -e production|\n end\n end",
"def scale=(scaling)\n @scale.set(scaling)\n @transform_dirty = true\n scaling\n end",
"def replace_namespaced_deployment_scale_with_http_info(name, namespace, body, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: AppsV1Api.replace_namespaced_deployment_scale ...\"\n end\n # verify the required parameter 'name' is set\n if @api_client.config.client_side_validation && name.nil?\n fail ArgumentError, \"Missing the required parameter 'name' when calling AppsV1Api.replace_namespaced_deployment_scale\"\n end\n # verify the required parameter 'namespace' is set\n if @api_client.config.client_side_validation && namespace.nil?\n fail ArgumentError, \"Missing the required parameter 'namespace' when calling AppsV1Api.replace_namespaced_deployment_scale\"\n end\n # verify the required parameter 'body' is set\n if @api_client.config.client_side_validation && body.nil?\n fail ArgumentError, \"Missing the required parameter 'body' when calling AppsV1Api.replace_namespaced_deployment_scale\"\n end\n # resource path\n local_var_path = \"/apis/apps/v1/namespaces/{namespace}/deployments/{name}/scale\".sub('{' + 'name' + '}', name.to_s).sub('{' + 'namespace' + '}', namespace.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'pretty'] = opts[:'pretty'] if !opts[:'pretty'].nil?\n query_params[:'dryRun'] = opts[:'dry_run'] if !opts[:'dry_run'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json', 'application/yaml', 'application/vnd.kubernetes.protobuf'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['*/*'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(body)\n auth_names = ['BearerToken']\n data, status_code, headers = @api_client.call_api(:PUT, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'V1Scale')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: AppsV1Api#replace_namespaced_deployment_scale\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def handle_irc_set_scale(response)\n key = response.user.name + '-scale'\n persisted_scale = redis.hget(REDIS_KEY, key)\n\n if ['c','f','k'].include? response.matches[0][0].downcase\n scale_to_set = response.matches[0][0].downcase\n else\n # Toggle mode\n scale_to_set = get_other_scale(persisted_scale)\n end\n\n if persisted_scale == scale_to_set\n reply = \"Scale is already set to #{scale_to_set}!\"\n else\n redis.hset(REDIS_KEY, key, scale_to_set)\n reply = \"Scale set to #{scale_to_set}\"\n end\n response.reply reply\n end",
"def clamps_enabled?\n return false unless options[:scale]\n\n options[:scale][:num_nonroot_users] ||\n options[:scale][:daemonize] ||\n options[:scale][:static_files] ||\n options[:scale][:dynamic_files]\nend",
"def set_dynos(app_name, qty)\n deprecate # 07/31/2012\n put(\"/apps/#{app_name}/dynos\", :dynos => qty).to_s\n end",
"def scale\n root_degree, type = parse_chord @name\n scale_tonic = @key.scale[root_degree - 1]\n scale_mode = CHORDS_TO_SCALES[type]\n SCALES[scale_mode].map{|n| n + scale_tonic}\n end",
"def stop\n app = extract_app\n opt =\n if (args.first =~ /.+\\..+/)\n ps = args.first\n display \"Stopping #{ps} process... \", false\n {:ps => ps}\n elsif args.first\n type = args.first\n display \"Stopping #{type} processes... \", false\n {:type => type}\n else\n error \"Usage: heroku ps:stop PROCESS\"\n end\n\n heroku.ps_stop(app, opt)\n display \"done\"\n end",
"def scale_to_length(new_length)\n self.scale(new_length / length)\n end",
"def resizeImages\n # For each of the 9 images\n for counter in (1..9)\n pngName = \"./images/\" + counter.to_s() + \".png\"\n image = Magick::Image.read(pngName).first\n # Make the new image 25% larger\n thumb = image.scale(1.25)\n thumb.write(pngName)\n end\n end",
"def put_scaling_policy(adjustment_type, auto_scaling_group_name, policy_name, scaling_adjustment, options = {})\n request({\n 'Action' => 'PutScalingPolicy',\n 'AdjustmentType' => adjustment_type,\n 'AutoScalingGroupName' => auto_scaling_group_name,\n 'PolicyName' => policy_name,\n 'ScalingAdjustment' => scaling_adjustment,\n :parser => Fog::Parsers::AWS::AutoScaling::PutScalingPolicy.new\n }.merge!(options))\n end",
"def dynamic_resize_to_fit(size)\n resize_to_fit *(model.class::IMAGE_CONFIG[size])\n end",
"def update_controller_scaling(view)\n\n @scale_origin =\n if @path.empty?\n @ip.position\n else\n bb = Geom::BoundingBox.new\n bb.add @path\n bb.center\n end\n\n nil\n\n end",
"def SetImageScale(scale)\n\t\t@img_scale = scale;\n\tend",
"def create\n @p_scale = PScale.new(p_scale_params)\n\n respond_to do |format|\n if @p_scale.save\n format.html { redirect_to @p_scale, notice: 'P scale was successfully created.' }\n format.json { render :show, status: :created, location: @p_scale }\n else\n format.html { render :new }\n format.json { render json: @p_scale.errors, status: :unprocessable_entity }\n end\n end\n end",
"def make_responsive(img,width)\n [\n [\"-resize 'x#{width}>'\", \"-#{width}.webp\"],\n [\"-resize 'x#{width * 2}>'\", \"-#{width}@2x.webp\"],\n ].each do |i|\n convert(img, i.first, i.last)\n end\nend"
] |
[
"0.84337085",
"0.8178167",
"0.7227012",
"0.61763364",
"0.6095144",
"0.60669017",
"0.60046065",
"0.5976218",
"0.5916795",
"0.5891229",
"0.58905953",
"0.58272845",
"0.5774898",
"0.57496274",
"0.5703743",
"0.56961936",
"0.5634388",
"0.56343645",
"0.5618801",
"0.558516",
"0.5570722",
"0.55422527",
"0.55215853",
"0.55187285",
"0.5517662",
"0.55028117",
"0.5482457",
"0.5482354",
"0.5474893",
"0.54623",
"0.5460254",
"0.54395884",
"0.5394371",
"0.5365561",
"0.53610533",
"0.53573024",
"0.5336484",
"0.53310627",
"0.5327373",
"0.5278205",
"0.5266806",
"0.5247628",
"0.52460295",
"0.5240689",
"0.52369434",
"0.5230492",
"0.5211213",
"0.52037317",
"0.519954",
"0.51886064",
"0.51830906",
"0.5178716",
"0.5162667",
"0.51623887",
"0.51616645",
"0.5140795",
"0.51311797",
"0.5128895",
"0.5125689",
"0.5125159",
"0.51230824",
"0.50962293",
"0.506663",
"0.50364953",
"0.5029004",
"0.5009521",
"0.50041777",
"0.500088",
"0.49923468",
"0.49849",
"0.49816382",
"0.4980815",
"0.49319547",
"0.49200386",
"0.49036458",
"0.48864022",
"0.48710164",
"0.48634747",
"0.48578182",
"0.48567095",
"0.48339403",
"0.4819628",
"0.48122084",
"0.48094305",
"0.47915006",
"0.47902605",
"0.47875527",
"0.4781009",
"0.47803548",
"0.47599378",
"0.47531724",
"0.47473726",
"0.4740679",
"0.47177118",
"0.47173107",
"0.47145474",
"0.47144642",
"0.47099534",
"0.47091892",
"0.47058213"
] |
0.7968315
|
2
|
ps:stop DYNOS stop an app dyno Examples: $ heroku stop run.3 Stopping run.3 dyno... done $ heroku stop run Stopping run dynos... done
|
def stop
dyno = shift_argument
validate_arguments!
message, options = case dyno
when NilClass
error("Usage: heroku ps:stop DYNO\nMust specify DYNO to stop.")
when /.+\..+/
ps = args.first
["Stopping #{ps} dyno", { :ps => ps }]
else
type = args.first
["Stopping #{type} dynos", { :type => type }]
end
action(message) do
api.post_ps_stop(app, options)
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def stop\n app = extract_app\n opt =\n if (args.first =~ /.+\\..+/)\n ps = args.first\n display \"Stopping #{ps} process... \", false\n {:ps => ps}\n elsif args.first\n type = args.first\n display \"Stopping #{type} processes... \", false\n {:type => type}\n else\n error \"Usage: heroku ps:stop PROCESS\"\n end\n\n heroku.ps_stop(app, opt)\n display \"done\"\n end",
"def dynos\n # deprecation notice added to v2.21.3 on 03/16/12\n display(\"~ `heroku ps:dynos QTY` has been deprecated and replaced with `heroku ps:scale dynos=QTY`\")\n\n dynos = shift_argument\n validate_arguments!\n\n if dynos\n action(\"Scaling dynos\") do\n new_dynos = api.put_dynos(app, dynos).body[\"dynos\"]\n status(\"now running #{new_dynos}\")\n end\n else\n app_data = api.get_app(app).body\n if app_data[\"stack\"] == \"cedar\"\n raise(Heroku::Command::CommandFailed, \"For Cedar apps, use `heroku ps`\")\n else\n display(\"#{app} is running #{quantify(\"dyno\", app_data[\"dynos\"])}\")\n end\n end\n end",
"def scale_dynos_down(dyno_name, count, current_count)\n dynos_for_type(dyno_name).sort_by { |d| d['elapsed'] }.reverse.take(current_count - count).each do |dyno|\n run_heroku_api_command(:post_ps_stop, app, { 'ps' => dyno['process'] })\n end\n end",
"def stop\n system(\"pkill -f #{DAEMON}\")\n end",
"def stop\n system(\"ps -aux | grep rackup\")\n puts \"Stoping clusters...\"\n for app in @apps\n if @env == :deployment\n pid_file = \"#{APP_PATH}/log/doozer.#{app[:port]}.pid\"\n puts \"=> Reading pid from #{pid_file}\" \n if File.exist?(pid_file)\n File.open(pid_file, 'r'){ | f | \n pid = f.gets.to_i\n puts \"=> Shutting down process #{pid}\"\n system(\"kill -9 #{pid}\")\n\n }\n File.delete(pid_file) \n else\n puts \"ERROR => pid file doesn't exist\"\n end\n end\n end\n sleep(1)\n system(\"ps -aux | grep rackup\")\nend",
"def stop_unicorn\n system(\"ps -aux | grep unicorn\")\n puts \"Stoping unicorn...\"\n for app in @apps\n if @env == :deployment\n pid_file = \"#{APP_PATH}/log/unicorn.pid\"\n puts \"=> Reading pid from #{pid_file}\" \n if File.exist?(pid_file)\n system(\"kill -QUIT `cat #{pid_file}`\")\n else\n puts \"ERROR => pid file doesn't exist\"\n end\n end\n break\n end\n sleep(1)\n system(\"ps -aux | grep unicorn\")\nend",
"def stop_server\n FileUtils.rm_r \"#{ENV['TM_PROJECT_DIRECTORY']}/config/.event_server\"\n pid = params[:pid]\n `kill #{pid}`\n render \"_index\", :locals => { :running => false, :pid => \"\" } \n end",
"def restart\n dyno = shift_argument\n validate_arguments!\n\n message, options = case dyno\n when NilClass\n [\"Restarting dynos\", {}]\n when /.+\\..+/\n ps = args.first\n [\"Restarting #{ps} dyno\", { :ps => ps }]\n else\n type = args.first\n [\"Restarting #{type} dynos\", { :type => type }]\n end\n\n action(message) do\n api.post_ps_restart(app, options)\n end\n end",
"def stop\n system(\"start-stop-daemon --stop --pidfile #{pidfile}\")\n end",
"def stop; self.app.stop end",
"def stop!(sqajob)\n\t\t#Open3.popen3('#{Rails.root}/public/stop_test_script.sh')\n\t\t#@sqajob = sqajob\n #Open3.popen3(\"ps -ef | grep /nfs/sjorhqa128-1.data/qa/WEB_BIN/SQA/bin/build_CMD | awk \\'{print $2}\\' | xargs kill -9 \")\n #sleep 5\n #Open3.popen3(\"ps -ef | grep /nfs/sjorhqa128-1.data/qa/WEB_BIN/SQA/JOBS/#{@sqajob.jobname} | awk \\'{print $2}\\' | xargs kill -9 \")\n\tend",
"def terminate app\n app.perform :terminate\n end",
"def stop\n # use pid in controlling process, webrick in server process\n @webrick.shutdown if @webrick\n Process.kill('INT', @pid) if @pid\n end",
"def server_stop\n Process.kill 'INT', 0\n end",
"def stop_server(type, date)\n Shell.execute \"stop #{upstart_script_filename(type, date).gsub(/^#{script_directory}\\//, '').gsub(/\\.conf$/, '')}\"\n end",
"def stop\n if started?\n Process.kill('INT', @pid)\n cleanup\n puts \"postwhite daemon stopped\" if !$config[:quiet] \n else\n raise \"postwhite daemon not running\"\n end\n 0\n end",
"def stop\n Daemons.run(file_path, options.merge(ARGV: ['stop']))\n end",
"def stop\n unless File.file?(trait[:pidfile])\n abort(\"Oy! not running? (check #{trait[:pidfile]}).\")\n end\n\n puts \"Stopping Oy!.\"\n\n pid = File.read(trait[:pidfile], 20).strip\n FileUtils.rm(trait[:pidfile]) if File.exist?(trait[:pidfile])\n pid && Process.kill('SIGKILL', pid.to_i)\n end",
"def stop app, &block\n # stop and remove all running procfile processes\n tuple = [:ps, /#{app['name']}\\./, nil, nil ]\n while (self.class.space.read(tuple,0) rescue nil) do\n if host = (self.class.space.take(tuple,0)[2] rescue nil)\n host.remove app[\"name\"]\n end\n end\n end",
"def stop\n system \"kill #{pid} > /dev/null 2>&1\"\n sleep(0.1)\n not rails?\n end",
"def server_stop(cf, https = false)\n pid = get_pid(cf, https)\n Process.kill('INT', pid) if pid > 0\n end",
"def restart\n app = extract_app\n\n opts = case args.first\n when NilClass then\n display \"Restarting processes... \", false\n {}\n when /.+\\..+/\n ps = args.first\n display \"Restarting #{ps} process... \", false\n { :ps => ps }\n else\n type = args.first\n display \"Restarting #{type} processes... \", false\n { :type => type }\n end\n heroku.ps_restart(app, opts)\n display \"done\"\n end",
"def stop_server\n Thin::Server.kill(CloudCrowd.pid_path('server.pid'), 0)\n end",
"def stop\n ck_valid\n Process.kill 15, @pid if running?\n\n invalidate\n end",
"def stop!\n system \"pkill -f play\"\n end",
"def stop(force = true)\n return if ! active_instance_dir_exists?\n return if ! running?\n puts \"Stopping #{@resource[:name]}\"\n cmd = [command(:instance_manager)]\n cmd += [\"stop\"]\n cmd += [@resource[:name]]\n cmd += [\"force\"] if force\n run(cmd)\n end",
"def kill()\n System.run(\"kill\", \"-9\", @pid.to_s) if @pid\n end",
"def cmd_stop argv\n setup argv\n uuid = @hash['uuid']\n response = @api.stop(uuid)\n msg response\n return response\n end",
"def stopKill\n self.stop_d\n return\n end",
"def stop(params)\n services = services_from_params(params)\n if @environment.in_dry_run_mode\n services.each do |agent|\n notify(:msg => \"[#{@name}] Would stop #{agent.host} (#{agent.type})\",\n :tags => [:galaxy, :dryrun])\n end\n services\n else\n command = ::Galaxy::Commands::StopCommand.new([], @galaxy_options)\n command.report = GalaxyGatheringReport.new(@environment,\n '[' + @name + '] Stopped #{agent.host} (#{agent.type})',\n [:galaxy, :trace])\n execute(command, services)\n command.report.results\n end\n end",
"def on_app_stopping(_event)\n setproctitle('stopping')\n end",
"def kill\n procpid = shift_argument\n output_with_bang \"procpid must be a procpid\" unless procpid && procpid.to_i != 0\n procpid = procpid.to_i\n\n cmd = options[:force] ? 'pg_terminate_backend' : 'pg_cancel_backend'\n sql = %Q(select #{cmd}(#{procpid});)\n\n exec_sql(sql, find_uri)\n end",
"def stop_apps\n ps_out = []\n\tif !Has_Sys_ProcTable\n\t\tIO.popen(PS_command).each do |line|\n\t\t\tps_out.push line\n\t\tend\n\telse\n\t\tProcTable.ps do |ps|\n\t\t\tps_out.push ps\n\t\tend\n\tend\n\n File.open(Conf,'r').each do |filename|\n filename.chomp!\n next if (ARGV[1].to_s != '' and ARGV[1].to_s != filename)\n pid_to_kill = 0\n\n # First we check to see if we have mention of the app in the PID\n # database. Normally, we should. If we don't have mention of the\n # app in the PID database, then the process table must be searched\n # to attempt to find the app and it's PID so that we have something\n # to kill.\n\n if ((@pid_db[filename].to_i || 0) > 0)\n pid_to_kill = @pid_db[filename].to_i\n else\n\t\t\tif Has_Sys_ProcTable\n\t\t\t\tps_out.each do |ps|\n\t\t\t\t\tif (ps.cmdline =~ /ruby\\s+#{filename}\\s*$/)\n\t\t\t\t\t\t\tpid_to_kill = ps.pid.to_i\n\t\t\t\t\t\t\tbreak\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\telse\n ps_out.each do |line|\n if (line =~ /ruby\\s+#{filename}\\s*$/)\n line =~ /^\\S+\\s+(\\d+)/\n pid_to_kill = $1.to_i\n\t\t\t\t\t\tbreak\n end\n\t\t\t\tend\n\t\t\tend\n end\n\n # Make sure that a PID to kill was found. This is paranoia in case\n # the app were killed manually or died unexpectedly at some point.\n # it'd be a real bummer to kill someone's shell session just because\n # they had the dumb luck to inherit a PID number that used to belong\n # to an Iowa app.\n\n k = false\n if (pid_to_kill > 0)\n begin\n Process.kill('SIGTERM',pid_to_kill)\n k = true\n rescue Exception\n puts \"Error killing PID #{pid_to_kill} (#{filename})\"\n\t\t\tend\n puts \"Stopped PID #{pid_to_kill} (#{filename})\" if k\n else\n puts \"Warning: Can't find a PID for #{filename}\"\n\t\tend\n\n @pid_db.delete filename if k\n end\nend",
"def stop\n process.stop\n end",
"def stop\n control :kill\n self\n end",
"def stop\n puts \"== The Middleman is shutting down\"\n if !@options[:\"disable-watcher\"]\n Process.kill(::Middleman::WINDOWS ? :KILL : :TERM, @server_job)\n Process.wait @server_job\n @server_job = nil\n end\n end",
"def stop(klass, *args)\n stop_service(hals[hardcore_alias(klass, *args)])\n end",
"def stop\n # Permissions are handled by the script, use: :sudo => false\n run_script :stop, :sudo => false\n end",
"def kill\n server.kill\n end",
"def stop(appName)\n @put.normal \"Stopping thin for #{appName}\"\n command = @system.execute( \"#{@thinPath} stop -C /etc/thin/#{appName}.yml\" )\n if command.success?\n @put.confirm\n else\n @put.error \"Could not stop Thin\"\n exit\n end\n end",
"def stop\n log_debug \"[ #{@node}/#{@environment} ] - Stop Podman Container #{@container} ...\"\n @cmd_runner.run_cmd \"#{podman_cmd} container stop #{@container}\"\n end",
"def stop_music_service\n execute_system_cmd('/etc/init.d/music_daemon stop')\n end",
"def doStop _args\n \"doStop _args;\" \n end",
"def stop(options = {})\n # set :stopping\n info \"stopping job\"\n unsubscribe\n kill if options[:force]\n end",
"def stop\n DRb.stop_service\n end",
"def service_stop(name)\n\t\tif session_has_services_depend?\n\t\t\tmeterpreter_service_stop(name)\n\t\telse\n\t\t\tshell_service_stop(name)\n\t\tend\n\tend",
"def stop\n action('stop')\n end",
"def stop\n Cocaine::CommandLine.new(\n @opt.fetch(:command, 'bin/delayed_job'),\n 'stop'\n ).run\n end",
"def stop\n AwesomeSpawn.run(\"ansible-runner\", :params => [\"stop\", base_dir, :json, {:ident => \"result\"}])\n end",
"def stop(pid)\n access_processes do |processes|\n processes[pid] && processes[pid].stop\n end\n end",
"def default_stop_program\n _init_command('stop')\n end",
"def kill() end",
"def stop\n return nil if @stop_called\n @stop_called = true\n \n proc_stop = proc{\n STDOUT.print \"Stopping appserver.\\n\" if @debug\n @httpserv.stop if @httpserv and @httpserv.respond_to?(:stop)\n \n STDOUT.print \"Stopping threadpool.\\n\" if @debug\n @threadpool.stop if @threadpool\n \n #This should be done first to be sure it finishes (else we have a serious bug).\n STDOUT.print \"Flush out loaded sessions.\\n\" if @debug\n self.sessions_flush\n \n STDOUT.print \"Stopping done...\\n\" if @debug\n }\n \n #If we cant get a paused-execution in 5 secs - we just force the stop.\n begin\n Timeout.timeout(5) do\n self.paused_exec(&proc_stop)\n end\n rescue Timeout::Error, SystemExit, Interrupt\n STDOUT.print \"Forcing stop-appserver - couldnt get timing window.\\n\" if @debug\n proc_stop.call\n end\n end",
"def kill\n send(:kill)\n end",
"def stop\n if @pid\n kind_kill -@pid\n @pid = nil\n end\n end",
"def kill\n unless pid.nil?\n WITH_PBS ? `qdel #{pid}` : Process.kill(\"TERM\", -pid.to_i)\n set_status! :m\n end\n end",
"def stop\n unless File.file?(trait[:pidfile])\n abort(\"thoth not running? (check #{trait[:pidfile]}).\")\n end\n\n puts \"Stopping thoth.\"\n\n pid = File.read(trait[:pidfile], 20).strip\n FileUtils.rm(trait[:pidfile]) if File.exist?(trait[:pidfile])\n pid && Process.kill('TERM', pid.to_i)\n end",
"def stop\n if (pid = self.class.find_pid)\n puts \"Checking first if a deployment is already in progress\"\n ProcessManager::Log.info(\"Checking first if any deployment lifecycle event is in progress #{description(pid)}\")\n begin\n if(InstanceAgent::Plugins::CodeDeployPlugin::DeploymentCommandTracker.check_deployment_event_inprogress?)\n ProcessManager::Log.info(\"Master process (#{pid}) will not be shut down right now, as a deployment is already in progress\")\n raise \"A deployment is already in Progress\",DeploymentAlreadyInProgressException\n else\n puts \"Stopping #{description(pid)}\"\n ProcessManager::Log.info(\"Stopping #{description(pid)}\")\n end \n Process.kill('TERM', pid)\n rescue Errno::ESRCH\n end\n \n begin\n Timeout.timeout(ProcessManager::Config.config[:kill_agent_max_wait_time_seconds]) do \n loop do\n begin\n Process.kill(0, pid)\n sleep(1)\n rescue Errno::ESRCH\n break\n end\n end\n end\n rescue Timeout::Error\n puts \"Child processes still running. Master going down.\"\n ProcessManager::Log.warn(\"Master process (#{pid}) going down before terminating child\")\n end\n else\n puts \"Nothing running that could be stopped\"\n end\n end",
"def killall_cmd\n \"kill -9 `pgrep #{soffice_pname} #{unoconv_pname}`\"\n end",
"def stopcmd\n end",
"def stop!(kill=true)\n if exists?(pid)\n _pid = File.read(pid).to_i\n puts \"=> Found pid #{_pid}...\"\n FileUtils.rm_f(pid)\n begin\n puts \"=> Killing process #{_pid}...\"\n Process.kill(:KILL, _pid)\n rescue Errno::ESRCH => e\n puts \"=> #{e.message}\"\n end\n else\n puts \"=> Pid not found, process seems don't exist!\"\n end\n end",
"def stop!(kill=true)\n if exists?(pid)\n _pid = File.read(pid).to_i\n puts \"=> Found pid #{_pid}...\"\n FileUtils.rm_f(pid)\n begin\n puts \"=> Killing process #{_pid}...\"\n Process.kill(:KILL, _pid)\n rescue Errno::ESRCH => e\n puts \"=> #{e.message}\"\n end\n else\n puts \"=> Pid not found, process seems don't exist!\"\n end\n end",
"def service_stop; end",
"def stop\n EM.cancel_timer @notify_timer\n notify :byebye\n stop_ssdp_server\n\n sleep 2\n stop_http_server\n end",
"def stop(*args)\n logger.info('Stopping load generation and monitoring on targets...')\n wait = args.include?('wait')\n options = (args.include?('suspend') ? { suspend: true } : nil)\n current_project.stop(wait, options)\n\n show_load_agents\n show_target_hosts\n end",
"def kill\n ck_valid\n Process.kill 9, @pid if running?\n\n invalidate\n end",
"def stop_service\n DRb.stop_service\n end",
"def stop_local_server(rails_pid, dj_pids, mongod_pid, child_pids = [])\n successful = true\n windows = is_windows?\n dj_pids.reverse.each do |dj_pid|\n pid_kill_success = kill_pid(dj_pid, 'delayed-jobs', windows)\n successful = false unless pid_kill_success\n end\n\n pid_kill_success = kill_pid(rails_pid, 'rails', windows)\n successful = false unless pid_kill_success\n\n pid_kill_success = kill_pid(mongod_pid, 'mongod', windows)\n successful = false unless pid_kill_success\n\n child_pids.each do |child_pid|\n kill_pid(child_pid, 'child-process', windows)\n successful = false unless pid_kill_success\n end\n\n sleep 2 # Keep the return from beating the stdout text\n\n unless successful\n $logger.error 'Not all PID kills were successful. Please investigate the error logs.'\n return false\n end\n\n true\nend",
"def kill(pid)\n `kill -9 #{pid}`\n end",
"def kill(service)\n quiet_system launchctl, \"kill\", \"SIGTERM\", \"#{domain_target}/#{service.service_name}\"\n while service.loaded?\n sleep(5)\n break if service.loaded?\n\n quiet_system launchctl, \"kill\", \"SIGKILL\", \"#{domain_target}/#{service.service_name}\"\n end\n ohai \"Successfully stopped `#{service.name}` via #{service.service_name}\"\n end",
"def stop!\n logger.info \"stopping worker #{pid}\"\n process.stop(20) # Give worker some time to stop.\n # TODO: Move stop timeout to the config?\n end",
"def stop (bundleId)\n execute(:stop, bundleId)\n end",
"def stop\n @appserver.stop\n \n if @thread\n sleep 0.1 while @thread[:running]\n @thread.kill\n @thread = nil\n end\n end",
"def kill(labels = [])\n call_container_method(:kill, labels)\n end",
"def stop_server(pid = @pid, signal: :TERM)\n begin\n Process.kill signal, pid\n rescue Errno::ESRCH\n end\n begin\n Process.wait2 pid\n rescue Errno::ECHILD\n end\n end",
"def stop!\n log \">> Stopping ...\"\n\n @backend.stop!\n end",
"def kill!() end",
"def stop_testing_slapd( pid )\n\t\tif pid\n\t\t\ttrace \"Shutting down slapd at PID %p\" % [ pid ]\n\t\t\tbegin\n\t\t\t\tProcess.kill( :TERM, pid )\n\t\t\t\tProcess.waitpid2( pid )\n\t\t\trescue Errno::ESRCH\n\t\t\t\ttrace \" not running.\"\n\t\t\t\t# Not running\n\t\t\trescue Errno::EPERM\n\t\t\t\ttrace \" not allowed (not slapd?).\"\n\t\t\telse\n\t\t\t\ttrace \" killed.\"\n\t\t\tend\n\t\tend\n\tend",
"def shut_down\n end",
"def kill(signo)\n Process.kill(signo, pid)\n end",
"def kill(targets, verbose: false)\n targets.each do |service|\n if !service.pid?\n puts \"Service `#{service.name}` is not started.\"\n elsif service.keep_alive?\n puts \"Service `#{service.name}` is set to automatically restart and can't be killed.\"\n else\n puts \"Killing `#{service.name}`... (might take a while)\"\n if System.systemctl?\n quiet_system System.systemctl, System.systemctl_scope, \"stop\", service.service_name\n elsif System.launchctl?\n quiet_system System.launchctl, \"stop\", \"#{System.domain_target}/#{service.service_name}\"\n end\n\n if service.pid?\n opoo \"Unable to kill `#{service.name}` (label: #{service.service_name})\"\n else\n ohai \"Successfully killed `#{service.name}` (label: #{service.service_name})\"\n end\n end\n end\n end",
"def stop!\n # Permissions are handled by the script, use: :sudo => false\n run_script! :stop, :sudo => false\n end",
"def kill_action\n validate :signal, :shellsafe\n validate :pid, /^\\d+$/\n\n killpid(request[:signal], request[:pid].to_i)\n\n if reply.statuscode == 0\n reply[:killed] = 1\n else\n reply[:killed] = 0\n end\n end",
"def stop\n\n\t\tdebug \"Stopping domain %s\" % [resource[:name]]\n\n\t\tif !exists?\n\t\t\tinstall(false)\n\t\telsif status == \"running\"\n\t\t\tcase resource[:virt_type]\n \twhen :qemu then dom.destroy\n\t\t\t\telse dom.shutdown\n\t\t\tend\n\t\tend\n\n\tend",
"def terminate!\n DRb.stop_service\nend",
"def stop\n return if @status == :stopped\n begin\n Process::kill('-TERM', @pid)\n rescue Exception => e\n # nothing here\n ensure\n @status = :stopped\n end\n end",
"def kill_instruments(_=nil)\n instruments_pids.each do |pid|\n terminator = RunLoop::ProcessTerminator.new(pid, \"QUIT\", \"instruments\")\n unless terminator.kill_process\n terminator = RunLoop::ProcessTerminator.new(pid, \"KILL\", \"instruments\")\n terminator.kill_process\n end\n end\n end",
"def stop_app\n if @driver\n driver_quit\n @driver = nil\n end\n end",
"def pkill_action\n validate :signal, :shellsafe\n validate :pattern, String\n\n pids_to_kill = []\n\n get_proc_list(request[:pattern], false).each do |ps|\n pids_to_kill << ps[:pid]\n end\n\n # Sanity check \n if get_proc_list(\".\", false).size == pids_to_kill.size\n reply.fail \"Pattern matches all (#{pids_to_kill.size}) processes, refusing to kill\"\n return\n else\n reply[:killed] = 0\n\n pids_to_kill.each do |pid| \n system(\"logger -t mcolletive 'killing pid #{pid} based on pattern #{request[:pattern]}'\")\n\n killpid(request[:signal], pid)\n\n # bail out if something went wrong\n last if reply.statuscode > 0\n\n reply[:killed] += 1\n end\n end\n end",
"def stop(options)\n options = Utils.symbolize_keys(options)\n if File.exist?(options[:pid])\n pid = File.read(options[:pid]).to_i\n puts \"=> Sending INT to process with pid #{pid}\"\n begin\n Process.kill(2, pid)\n rescue Errno::ESRCH, RangeError => error\n puts error.message\n exit\n rescue Errno::EPERM => error\n puts error.message\n abort\n end\n else\n puts \"=> #{options[:pid]} not found!\"\n abort\n end\n end",
"def stop(*args)\n self.exec(\"lxc-stop\", *args)\n self.state\n end",
"def stop_instances\n @task.unsafe(\"Stopping #{@name} processes\") do\n autoscaling_group.suspend_all_processes\n end\n autoscaling_instances.each do |instance|\n @task.unsafe(\"Stopping instance #{instance.instance_id}\") do\n load_balancers.each do |elb|\n elb.instances.deregister(instance.instance_id)\n end\n instance.ec2_instance.stop\n end\n end\n end",
"def kill(port, sig = \"INT\")\n if sig.is_a?(Integer)\n sig = Signal.list.invert[sig]\n end\n \n Merb::BootLoader::BuildFramework.run\n\n # If we kill the master, then the workers should be reaped also.\n if %w(main master all).include?(port)\n # If a graceful exit is requested then send INT to the master process.\n #\n # Otherwise read pids from pid files and try to kill each process in turn.\n kill_pid(sig, pid_file(\"main\")) if sig == \"INT\"\n else\n kill_pid(sig, pid_file(port))\n end\n end",
"def stop(labels = [])\n call_container_method(:stop, labels)\n end",
"def kill(secret)\n if !valid_secret?(secret)\n return BAD_SECRET_MSG\n end\n @kill_sig_received = true\n \n if is_hybrid_cloud? \n Thread.new {\n Kernel.sleep(5)\n HelperFunctions.terminate_hybrid_vms(creds)\n }\n elsif is_cloud?\n Thread.new {\n Kernel.sleep(5)\n infrastructure = creds[\"infrastructure\"]\n keyname = creds[\"keyname\"]\n HelperFunctions.terminate_all_vms(infrastructure, keyname)\n }\n else\n # in xen/kvm deployments we actually want to keep the boxes\n # turned on since that was the state they started in\n\n if my_node.is_login?\n stop_ejabberd \n end\n\n if my_node.is_shadow? or my_node.is_appengine?\n ApiChecker.stop \n end\n\n maybe_stop_taskqueue_worker(\"apichecker\")\n maybe_stop_taskqueue_worker(AppDashboard::APP_NAME)\n\n jobs_to_run = my_node.jobs\n commands = {\n \"load_balancer\" => \"stop_app_dashboard\",\n \"appengine\" => \"stop_appengine\",\n \"db_master\" => \"stop_db_master\",\n \"db_slave\" => \"stop_db_slave\",\n \"zookeeper\" => \"stop_zookeeper\"\n }\n\n my_node.jobs.each { |job|\n if commands.include?(job)\n Djinn.log_info(\"About to run [#{commands[job]}]\")\n send(commands[job].to_sym)\n else\n Djinn.log_info(\"Unable to find command for job #{job}. Skipping it.\")\n end\n }\n\n if has_soap_server?(my_node)\n stop_soap_server\n stop_datastore_server\n end\n\n TaskQueue.stop if my_node.is_taskqueue_master?\n TaskQueue.stop if my_node.is_taskqueue_slave?\n TaskQueue.stop_flower if my_node.is_login?\n\n stop_app_manager_server\n stop_infrastructure_manager\n end\n\n MonitInterface.shutdown\n FileUtils.rm_rf(STATE_FILE)\n\n if @creds['alter_etc_resolv'].downcase == \"true\"\n HelperFunctions.restore_etc_resolv()\n end\n\n return \"OK\" \n end",
"def kill(*services, signal: 'KILL')\n o = opts(signal: [signal, 'KILL'])\n run!('kill', o, services)\n end",
"def stop_deploy(stack, stage)\n if deployname = get_deploy_process_title(stack,stage)\n return system(\"pkill -f '#{deployname}'\")\n end\n false\n end",
"def stop\n log_debug \"[ #{@node}/#{@environment} ] - Stop Proxmox LXC Container ...\"\n with_proxmox do |proxmox|\n run_proxmox_task(proxmox, :post, @lxc_details[:pve_node], \"lxc/#{@lxc_details[:vm_id]}/status/stop\")\n end\n end",
"def stop\n if @resource[:stop] or stopcmd\n ucommand(:stop)\n else\n pid = getpid\n unless pid\n self.info \"#{self.name} is not running\"\n return false\n end\n begin\n output = kill pid\n rescue Puppet::ExecutionFailure => detail\n @resource.fail \"Could not kill #{self.name}, PID #{pid}: #{output}\"\n end\n return true\n end\n end",
"def stop(targets, verbose: false)\n targets.each do |service|\n unless service.loaded?\n rm service.dest if service.dest.exist? # get rid of installed service file anyway, dude\n if service.service_file_present?\n odie <<~EOS\n Service `#{service.name}` is started as `#{service.owner}`. Try:\n #{\"sudo \" unless System.root?}#{bin} stop #{service.name}\n EOS\n else\n opoo \"Service `#{service.name}` is not started.\"\n end\n next\n end\n\n puts \"Stopping `#{service.name}`... (might take a while)\"\n if System.systemctl?\n quiet_system System.systemctl, System.systemctl_scope, \"disable\", \"--now\", service.service_name\n elsif System.launchctl?\n quiet_system System.launchctl, \"bootout\", \"#{System.domain_target}/#{service.service_name}\"\n while $CHILD_STATUS.to_i == 9216 || service.loaded?\n sleep(1)\n quiet_system System.launchctl, \"bootout\", \"#{System.domain_target}/#{service.service_name}\"\n end\n quiet_system System.launchctl, \"stop\", \"#{System.domain_target}/#{service.service_name}\" if service.pid?\n end\n\n rm service.dest if service.dest.exist?\n # Run daemon-reload on systemctl to finish unloading stopped and deleted service.\n safe_system System.systemctl, System.systemctl_scope, \"daemon-reload\" if System.systemctl?\n\n if service.pid? || service.loaded?\n opoo \"Unable to stop `#{service.name}` (label: #{service.service_name})\"\n else\n ohai \"Successfully stopped `#{service.name}` (label: #{service.service_name})\"\n end\n end\n end"
] |
[
"0.7689535",
"0.6727713",
"0.66109985",
"0.6512392",
"0.64470345",
"0.6379886",
"0.6272218",
"0.6232683",
"0.6217167",
"0.61890554",
"0.61530733",
"0.60952646",
"0.6041457",
"0.60395795",
"0.6026322",
"0.60040057",
"0.5992933",
"0.59891784",
"0.5984854",
"0.59835947",
"0.5983213",
"0.5928739",
"0.5920412",
"0.5886193",
"0.5872254",
"0.5865512",
"0.5855999",
"0.5853387",
"0.58274454",
"0.58200115",
"0.58052295",
"0.58023113",
"0.57938987",
"0.57862407",
"0.57672447",
"0.5743277",
"0.572738",
"0.57254905",
"0.5720153",
"0.57043046",
"0.5678217",
"0.5674934",
"0.5674365",
"0.56719196",
"0.56602615",
"0.56573886",
"0.5656977",
"0.56538916",
"0.5651268",
"0.5641417",
"0.56402814",
"0.56320924",
"0.5630633",
"0.5614599",
"0.5606252",
"0.56030095",
"0.5595837",
"0.5594462",
"0.5591006",
"0.55902904",
"0.55874026",
"0.55874026",
"0.558235",
"0.557589",
"0.5563495",
"0.55621445",
"0.55591214",
"0.5549071",
"0.55354613",
"0.5532322",
"0.552605",
"0.5518572",
"0.55170137",
"0.55166715",
"0.5503882",
"0.5499928",
"0.54980135",
"0.54939723",
"0.5491865",
"0.5490543",
"0.5489982",
"0.5489774",
"0.5483003",
"0.5482474",
"0.54722756",
"0.5469167",
"0.5466275",
"0.5461315",
"0.5456353",
"0.54488033",
"0.5448179",
"0.54436016",
"0.5442787",
"0.54426324",
"0.5441215",
"0.54407597",
"0.5438265",
"0.5436125",
"0.54348975",
"0.54348487"
] |
0.8608918
|
0
|
ps:type [TYPE | DYNO=TYPE [DYNO=TYPE ...]] manage dyno types called with no arguments shows the current dyno type called with one argument sets the type where type is one of free|hobby|standard1x|standard2x|performance called with 1..n DYNO=TYPE arguments sets the type per dyno
|
def type
requires_preauth
app
formation = get_formation
changes = if args.any?{|arg| arg =~ /=/}
args.map do |arg|
if arg =~ /^([a-zA-Z0-9_]+)=([\w-]+)$/
type, new_size = $1, $2
current_p = formation.find{|f| f["type"] == type}
if current_p.nil?
error("Type '#{type}' not found in process formation.")
end
p = current_p.clone
p["size"] = new_size
p
end
end.compact
elsif args.any?
size = shift_argument.downcase
validate_arguments!
formation.map{|p| p["size"] = size; p}
end
scale_dynos(formation, changes) if changes
display_dyno_type_and_costs(get_formation)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def dynos\n # deprecation notice added to v2.21.3 on 03/16/12\n display(\"~ `heroku ps:dynos QTY` has been deprecated and replaced with `heroku ps:scale dynos=QTY`\")\n\n dynos = shift_argument\n validate_arguments!\n\n if dynos\n action(\"Scaling dynos\") do\n new_dynos = api.put_dynos(app, dynos).body[\"dynos\"]\n status(\"now running #{new_dynos}\")\n end\n else\n app_data = api.get_app(app).body\n if app_data[\"stack\"] == \"cedar\"\n raise(Heroku::Command::CommandFailed, \"For Cedar apps, use `heroku ps`\")\n else\n display(\"#{app} is running #{quantify(\"dyno\", app_data[\"dynos\"])}\")\n end\n end\n end",
"def dyno\n @dyno ||= @analytics[:dynos].max_by {|name, count| count }\n end",
"def scale\n requires_preauth\n\n changes = args.map do |arg|\n if change = arg.scan(/^([a-zA-Z0-9_]+)([=+-]\\d+)(?::([\\w-]+))?$/).first\n formation, quantity, size = change\n quantity = quantity[1..-1].to_i if quantity[0] == \"=\"\n { \"type\" => formation, \"quantity\" => quantity, \"size\" => size}\n end\n end.compact\n\n if changes.empty?\n display_dyno_formation(get_formation)\n else\n action(\"Scaling dynos\") do\n new_scales = scale_dynos(get_formation, changes)\n .map {|p| \"#{p[\"type\"]} at #{p[\"quantity\"]}:#{p[\"size\"]}\" }\n status(\"now running \" + new_scales.join(\", \") + \".\")\n end\n end\n end",
"def type\n :puppet_type\n end",
"def set_type\n end",
"def stop\n dyno = shift_argument\n validate_arguments!\n\n message, options = case dyno\n when NilClass\n error(\"Usage: heroku ps:stop DYNO\\nMust specify DYNO to stop.\")\n when /.+\\..+/\n ps = args.first\n [\"Stopping #{ps} dyno\", { :ps => ps }]\n else\n type = args.first\n [\"Stopping #{type} dynos\", { :type => type }]\n end\n\n action(message) do\n api.post_ps_stop(app, options)\n end\n end",
"def cmd_types argv\n setup argv\n response = @api.types\n msg response\n return response\n end",
"def sc_type(type, text, *params)\n __remote_control_command(\"type\", [__locator(type, *params), text, ])\n end",
"def sproc_type=(type)\n @sproc_type = type\n @opts[:sql] = ''\n end",
"def dyno(name, &block)\n @dynos << { :name => name, :quantity => block }\n end",
"def create_types\n\t[Domain]\nend",
"def type(type = nil)\n @type = type if type\n @type || name.split('::').last.gsub(/Resource$/, '').underscore\n end",
"def type\n @types ||= strip(:type)\n end",
"def type(type)\n opts[:type] = type\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 object_update(type)\n raise 'you need to use -o option!' unless type\n\n type = type.downcase\n case type\n when 'datastores'\n @vobject = VOBJECT::DATASTORE\n when 'templates'\n @vobject = VOBJECT::TEMPLATE\n when 'networks'\n @vobject = VOBJECT::NETWORK\n when 'images'\n @vobject = VOBJECT::IMAGE\n when 'hosts'\n @vobject = VOBJECT::HOST\n else\n puts \"unknown #{type} type option\"\n puts ' -o options:'\n puts ' datastores'\n puts ' templates'\n puts ' networks'\n puts ' images'\n puts ' hosts'\n\n exit 0\n end\n end",
"def type(type); end",
"def type\n @type ||= \"#{as}_type\" if polymorphic?\n end",
"def post_type\n @type = params[:type].blank? ? \"Post\" : params[:type]\n @type.constantize\n end",
"def post_type\n @type = params[:type].blank? ? \"Post\" : params[:type]\n @type.constantize\n end",
"def types\n\t\t\t\tlist.reduce({}) { |h, x|\n\t\t\t\t\tbegin\n\t\t\t\t\t\th.merge!(x =>\n\t\t\t\t\t\t\tcase IO.read(File.join('/proc', x.to_s, 'stat')).split[2]\n\t\t\t\t\t\t\t\twhen ?S.freeze then :sleeping\n\t\t\t\t\t\t\t\twhen ?I.freeze then :idle\n\t\t\t\t\t\t\t\twhen ?Z.freeze then :zombie\n\t\t\t\t\t\t\t\twhen ?R.freeze then :running\n\t\t\t\t\t\t\t\telse :unknown\n\t\t\t\t\t\t\tend\n\t\t\t\t\t\t)\n\t\t\t\t\trescue Exception\n\t\t\t\t\t\th\n\t\t\t\t\tend\n\t\t\t\t}\n\t\t\tend",
"def type\n @type ||= options[:type] || Object\n end",
"def describe_type\n puts \"I am a #{type} of Bees Wax\"\n end",
"def type\n @props[:type]\n end",
"def prepare_type\n @type = params[:type]\n @klass = @type.constantize\n end",
"def set_type_counts\n vars = \"\"\n Repo::REPO_TYPES.each do |t|\n vars << \"@#{t}_count = #{t.camelize.constantize}.count;\"\n end\n eval(vars)\n end",
"def type_params\n params.require(:type).permit(:common_name, :botanical_name, :info_panel, :count)\n end",
"def index\n validate_arguments!\n quota_resp = api.request(\n :expects => [200, 404],\n :method => :post,\n :path => \"/apps/#{app}/actions/get-quota\",\n :headers => {\n \"Accept\" => \"application/vnd.heroku+json; version=3.app-quotas\",\n \"Content-Type\" => \"application/json\"\n }\n )\n\n if quota_resp.status = 200\n quota = quota_resp.body\n now = Time.now.getutc\n quota_message = if quota[\"allow_until\"]\n \"Free quota left:\"\n elsif quota[\"deny_until\"]\n \"Free quota exhausted. Unidle available in:\"\n end\n if quota_message\n quota_timestamp = (quota[\"allow_until\"] ? Time.parse(quota[\"allow_until\"]).getutc : Time.parse(quota[\"deny_until\"]).getutc)\n time_left = time_remaining(Time.now.getutc, quota_timestamp)\n display(\"#{quota_message} #{time_left}\")\n end\n end\n\n processes_resp = api.request(\n :expects => 200,\n :method => :get,\n :path => \"/apps/#{app}/dynos\",\n :headers => {\n \"Accept\" => \"application/vnd.heroku+json; version=3\",\n \"Content-Type\" => \"application/json\"\n }\n )\n processes = processes_resp.body\n\n processes_by_command = Hash.new {|hash,key| hash[key] = []}\n processes.each do |process|\n now = Time.now\n type = process[\"type\"]\n elapsed = now - Time.iso8601(process['updated_at'])\n since = time_ago(now - elapsed)\n size = process[\"size\"] || \"1X\"\n\n if type == \"run\"\n key = \"run: one-off processes\"\n item = \"%s (%s): %s %s: `%s`\" % [ process[\"name\"], size, process[\"state\"], since, process[\"command\"] ]\n else\n key = \"#{type} (#{size}): `#{process[\"command\"]}`\"\n item = \"%s: %s %s\" % [ process['name'], process['state'], since ]\n end\n\n processes_by_command[key] << item\n end\n\n extract_run_id = /\\.(\\d+).*:/\n processes_by_command.keys.each do |key|\n processes_by_command[key] = processes_by_command[key].sort do |x,y|\n x.match(extract_run_id).captures.first.to_i <=> y.match(extract_run_id).captures.first.to_i\n end\n end\n\n processes_by_command.keys.sort.each do |key|\n styled_header(key)\n styled_array(processes_by_command[key], :sort => false)\n end\n end",
"def set_type_if_empty\n self.type = 'Protonym' if self.type.nil?\n end",
"def set_type\n @type = controller_name.classify\n end",
"def set_type\n @type = controller_name.classify\n end",
"def type( type, *allowed_defaults )\n @@types ||= Hash.new\n @@types[type] = self\n Caty::OptionConstructor.register(type)\n @allowed_defaults = allowed_defaults\n end",
"def type ; metadata[:type] ; end",
"def type() end",
"def types\n configuration[:types]\n end",
"def type\n return @options[:type] || DEF_TYPE\n end",
"def type\n memoized_info[:type]\n end",
"def get_cli_type\n if ENV.include?(\"type\") && ENV['type']\n return ENV['type'].to_s\n else\n return \"\"\n end\n end",
"def types\n @title = 'Resource Type Listing A-Z'\n @objects_by_letter = objects_by_letter(:puppet_type)\n erb(:objects)\nend",
"def set_server_type(opts)\n opts = check_params(opts,[:types])\n super(opts)\n end",
"def describe_types\n [@options[:type]].flatten.join('/')\n end",
"def service_types\n { \n \"renderer\" => {\"start\" => \"ls\", \"stop\" => \"ls\"},\n \"smscd\" => {\"start\" => \"sudo /etc/init.d/smscd start\", \"stop\" => \"sudo /etc/init.d/smscd stop\", \"options\" => \"tunnel\"},\n \"ussd\" => {\"start\" => \"ls\", \"stop\" => \"ls\"}\n }\n end",
"def types; end",
"def types; end",
"def types; end",
"def types; end",
"def types; end",
"def type(*args); end",
"def instance_type\n get(\"instance_type\")\n end",
"def type=(type); end",
"def type\n end",
"def set_dynos(app_name, qty)\n deprecate # 07/31/2012\n put(\"/apps/#{app_name}/dynos\", :dynos => qty).to_s\n end",
"def type\r\n\t\t\t`#{BITS::BITSADMIN} /gettype {#{@id}}`\r\n\t\tend",
"def describe_type\n puts \"I am a #{type} type of Bees Wax\"\nend",
"def type\n @activities = Activity.tagged_with_on(:types,params[:type_name]).page params[:page]\n respond_with @activities\n end",
"def puppet_type\n return :agent\nend",
"def scale_dynos_down(dyno_name, count, current_count)\n dynos_for_type(dyno_name).sort_by { |d| d['elapsed'] }.reverse.take(current_count - count).each do |dyno|\n run_heroku_api_command(:post_ps_stop, app, { 'ps' => dyno['process'] })\n end\n end",
"def set_instance_type( type )\n self.instance_type = type\n end",
"def type; end",
"def type; end",
"def type; end",
"def type; end",
"def type; end",
"def type; end",
"def type; end",
"def type; end",
"def type; end",
"def type; end",
"def type; end",
"def type; end",
"def type; end",
"def type; end",
"def type; end",
"def type; end",
"def type; end",
"def type; end",
"def type; end",
"def type; end",
"def type; end",
"def type; end",
"def type; end",
"def type; end",
"def type; end",
"def type; end",
"def type; end",
"def type; end",
"def type; end",
"def type; end",
"def type; end",
"def type; end",
"def type; end",
"def type; end",
"def type; end",
"def type; end",
"def type; end",
"def type; end",
"def type; end",
"def type; end",
"def type; end",
"def type; end"
] |
[
"0.6452378",
"0.6076077",
"0.5816268",
"0.58134836",
"0.562134",
"0.5597749",
"0.55790997",
"0.5565822",
"0.55205387",
"0.5448634",
"0.54452974",
"0.5393754",
"0.5387079",
"0.53657347",
"0.5345301",
"0.5333334",
"0.5332284",
"0.53318477",
"0.5329026",
"0.5329026",
"0.5295395",
"0.5277043",
"0.52764976",
"0.5276069",
"0.5267244",
"0.5266223",
"0.5258259",
"0.5255077",
"0.5254063",
"0.52452564",
"0.52452564",
"0.52399534",
"0.52376145",
"0.52364004",
"0.52315223",
"0.51989824",
"0.51815856",
"0.5180132",
"0.51773316",
"0.5164991",
"0.51607066",
"0.51570255",
"0.5152074",
"0.5152074",
"0.5152074",
"0.5152074",
"0.5152074",
"0.5151038",
"0.51379347",
"0.5126657",
"0.5121066",
"0.5115691",
"0.51110107",
"0.51061267",
"0.5089028",
"0.5088312",
"0.5086989",
"0.5083585",
"0.50817513",
"0.50817513",
"0.50817513",
"0.50817513",
"0.50817513",
"0.50817513",
"0.50817513",
"0.50817513",
"0.50817513",
"0.50817513",
"0.50817513",
"0.50817513",
"0.50817513",
"0.50817513",
"0.50817513",
"0.50817513",
"0.50817513",
"0.50817513",
"0.50817513",
"0.50817513",
"0.50817513",
"0.50817513",
"0.50817513",
"0.50817513",
"0.50817513",
"0.50817513",
"0.50817513",
"0.50817513",
"0.50817513",
"0.50817513",
"0.50817513",
"0.50817513",
"0.50817513",
"0.50817513",
"0.50817513",
"0.50817513",
"0.50817513",
"0.50817513",
"0.50817513",
"0.50817513",
"0.50817513",
"0.50817513"
] |
0.6811966
|
0
|
Use for_model instead of instatiating a record directly.
|
def initialize(model_class)
@model_class = model_class
@records = []
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def from_record(record)\n end",
"def initialize_with_record(record)\n inst = self.new\n inst.send(:_record=, record)\n inst.send(:_id=, record.id)\n inst\n end",
"def build_new_record\n @record = record_class.new\n end",
"def build_new_record\n @record = record_class.new\n end",
"def new_record(model, *args)\n attributes = valid_attributes_for(model, *args)\n record = model.new(attributes)\n attributes.each {|attr, value| record.send(\"#{attr}=\", value) }\n record\n end",
"def new_record(model, *args)\n attributes = valid_attributes_for(model, *args)\n record = model.new(attributes)\n attributes.each {|attr, value| record.send(\"#{attr}=\", value) if model.accessible_attributes && !model.accessible_attributes.include?(attr) || model.protected_attributes && model.protected_attributes.include?(attr)}\n record\n end",
"def record\n @record ||= SomeModel.new\n end",
"def create_record(model, *args)\n record = new_record(model, *args)\n record.save!\n record.reload\n record\n end",
"def create_record(model, *args)\n record = new_record(model, *args)\n record.save!\n record.reload\n record\n end",
"def make_and_model; end",
"def row_for_record\n raise IdMissing.new(\"You must set an ID before save.\") if record.id.blank?\n\n MassiveRecord::Wrapper::Row.new({\n :id => record.id,\n :table => klass.table\n })\n end",
"def new_record(params = {})\n @model_class.new(params)\n end",
"def new_record(params = {})\n @model_class.new(params)\n end",
"def generate_model\n invoke \"active_record:model\", [name], :migration => false unless model_exists? && behavior == :invoke\n if store_in == 'active_record'\n invoke \"active_record:model\", [ACTIVE_RECORDABLE], :migration => false unless active_recordable_exists? && behavior == :invoke\n end\n end",
"def from_record(ref, record)\n obj = self.new(ref)\n\n # This smells, but we don't want to actually expose the internal record\n obj.instance_variable_set(\"@record\", record)\n obj\n end",
"def initialize_model\n end",
"def instantiate(record)\n object = record_with_type?(record) ? compute_type(record[inheritance_column]).allocate : allocate\n object.instance_variable_set(\"@attributes\", record)\n return object\n end",
"def instantiate(record)\n associated_record = sti_config[:type_class_name].constantize.find_by_id(record[sti_config[:foreign_key].to_s])\n type_name = associated_record.try(sti_config[:type_column])\n record[inheritance_column] = type_name\n\n super\n end",
"def generate_model\n invoke \"active_record:model\", [name], :migration => false unless model_exists? && behavior == :invoke\n end",
"def create_record!(record)\n @created += 1\n begin\n ar_record = target_class.new(record_attributes(record))\n ar_record.save!\n return ar_record\n rescue ActiveRecord::RecordInvalid => e \n ar_record.save!(:validate => false)\n @invalid_records += 1\n raise e\n end\n end",
"def construct_model(record, reflection, id, attributes, seen, model_cache)\n klass = if reflection.polymorphic?\n record.send(reflection.foreign_type).constantize\n else\n reflection.klass\n end\n\n model = model_cache[klass][id] ||= klass.instantiate(attributes)\n other = record.association(reflection.name)\n\n if reflection.collection?\n other.target.push(model)\n else\n other.target = model\n end\n\n other.set_inverse_instance(model)\n model\n end",
"def new_record(klass, &block)\n new_records(klass, 1, &block).first\n end",
"def initialize(model)\n @model = model\n end",
"def new(&block)\n assign_attributes if params[model_identifier]\n respond_with(entry, &block)\n end",
"def model\n __getobj__\n end",
"def model\n end",
"def initialize(model)\n @model = model\n end",
"def initialize(model)\n @model = model\n end",
"def initialize(model)\n @model = model\n end",
"def new_for(record_model, callee, method_name = :new, *args, &block)\n callee.send(method_name, *args, &block)\n end",
"def set_record\n @record = params[:id] ? Record.friendly.find(params[:id]) : Record.new(record_params)\n end",
"def create(model)\n data = model.attributes\n record = store.create(data, table: table_name)\n model.attributes = record\n end",
"def get_mobj(mname=nil) @model_class.instance; end",
"def new_model\n unless @model\n @model = create_model\n attach_model\n end\n @model\n end",
"def set_object\n set_model_instance(MODEL_CLASS.find(params[:id]))\n end",
"def initialize(record)\n @record = record\n end",
"def instantiate_record(record, prefix_options = {})\n super(record, prefix_options).tap do |r|\n prefix_options.each do |k, v|\n if r.respond_to?(\"#{k}=\")\n r.send(\"#{k}=\", v)\n end\n end\n # set the id field from [element_name]Id (e.g. userId)\n r.id = r.send(\"#{element_name}Id\") if r.respond_to?(\"#{element_name}Id\")\n end\n end",
"def create\n @record = model.new(record_params)\n # call before actions created in the DSL\n if resource.before_actions[:create]\n resource.before_actions[:create].call(@record)\n end\n if @record.save\n redirect_to polymorphic_path([app_kit, @record])\n else\n puts @record.errors.full_messages.inspect\n render 'new'\n end\n end",
"def model; end",
"def model; end",
"def model; end",
"def model; end",
"def model; end",
"def model; end",
"def model; end",
"def model; end",
"def model; end",
"def model; end",
"def initialize_model\n # let's create our new empty model\n @model = OpenStudio::Model::Model.new if @model.nil?\n end",
"def set_record(id = nil, pid = nil)\n unless id.to_i > 0 && self.record = resource_model.includes(includes).find(id.to_i)\n self.record = resource_model.where((pid && where) ? where.call(pid) : {}).new\n self.record.attributes = create_attributes\n end\n end",
"def do_new\n @record = new_model\n apply_constraints_to_record(@record)\n create_association_with_parent(@record) if nested?\n @record\n end",
"def create(params_or_record)\n object = self.new(params_or_record).save\n return(object)\n end",
"def set_record_object\n @record_object = RecordObject.find(params[:id])\n end",
"def find_model(record)\n raise_must_override\n end",
"def new\n @record = Record.new()\n end",
"def new\n @record = Umbra::Record.new\n respond_with(@record)\n end",
"def load_model(mid)\n url = Configuration::PROPERTIES.get_property :url\n url_get_records = Configuration::PROPERTIES.get_property :url_get_model_info\n\n url_get_records = url_get_records.gsub '{csk}', URI::encode(@credential[:csk])\n url_get_records = url_get_records.gsub '{aci}', URI::encode(@credential[:aci])\n url_get_records = url_get_records.gsub '{mid}', mid.to_s\n\n response = DynamicService::ServiceCaller.call_service url + url_get_records, {}, 'get'\n\n json = JSON.parse(response)\n unless json['status'] == 200\n raise json['message']\n end\n\n model = Dynamicloud::API::Model::RecordModel.new mid\n model.name = json['name']\n model.description = json['description']\n\n model\n end",
"def record\n\n end",
"def record; end",
"def record; end",
"def record; end",
"def load record\n end",
"def model\n @model ||= Model.new(self)\n end",
"def newInstance( params={} )\n model.new( params ).extend( InstanceMethods )\n end",
"def model\n end",
"def model\n end",
"def model\n end",
"def _default_wrap_model; end",
"def model(make_of_model: T.unsafe(nil)); end",
"def build_model(row)\n row[:id] = row[:id].to_i # Convert column to Integer\n new_instance = Employee.new(row)\n return new_instance\n end",
"def new_record?; end",
"def new_record?; end",
"def new\n @record = model.new\n # call before actions created in the DSL\n if resource.before_actions[:new]\n resource.before_actions[:new].call(@record)\n end\n end",
"def set_record\n @record = Record.find(params[:id])\n end",
"def set_record\n @record = Record.find(params[:id])\n end",
"def store(model)\n model\n end",
"def record()\n name = @name_source.record()\n Person.new( name,\n @address_source.record(),\n @phone_number_source.record(),\n @email_address_source.record_from_name(name) )\n end",
"def find_existing_record\n @record = record_class.find(@locator)\n end",
"def find_existing_record\n @record = record_class.find(@locator)\n end",
"def model_class=(_arg0); end",
"def set_model\n @model = Info\n end",
"def instantiate(raw_record)\n record = self.allocate\n record.deserialize(raw_record)\n record.preinitialize(raw_record)\n record.instance_variable_set(:@new_record, false)\n record.send(\"safe_attributes=\", raw_record, false)\n record\n end",
"def model\n @model ||= resource.model\n end",
"def set_model\n @model=Info\n end",
"def record_to_object(record)\n record\n end",
"def model=(_arg0); end",
"def model=(_arg0); end",
"def model=(_arg0); end",
"def model=(_arg0); end",
"def create(attributes={}, &block) # TODO: testme\n model = self.new(attributes)\n yield(model) if block_given?\n model.save\n model\n end",
"def initialize_template(record)\n\n end",
"def model!(options, params:)\n options['model'] = Event.find(params[:id])\n end",
"def create_referring_record\n return unless @ref_record_type\n\n @referring_record = find_referring_record\n ModelReference.create_with @referring_record, self if @referring_record\n end",
"def build_model(row)\n row[:id] = row[:id].to_i # Convert column to Integer\n new_instance = Customer.new(row)\n return new_instance\n end",
"def set_record\n @record = Record.find(params[:id])\n end",
"def set_record\n @record = Record.find(params[:id])\n end",
"def set_record\n @record = Record.find(params[:id])\n end",
"def set_record\n @record = Record.find(params[:id])\n end",
"def set_record\n @record = Record.find(params[:id])\n end",
"def set_record\n @record = Record.find(params[:id])\n end"
] |
[
"0.69229025",
"0.68515086",
"0.6688589",
"0.6688589",
"0.66503125",
"0.6616689",
"0.65591997",
"0.6530984",
"0.6530438",
"0.64464325",
"0.63948905",
"0.6371378",
"0.6371378",
"0.6361553",
"0.6353687",
"0.6325439",
"0.62255085",
"0.62229866",
"0.6217759",
"0.61888677",
"0.61802226",
"0.6166573",
"0.6133042",
"0.6111773",
"0.61109865",
"0.6101976",
"0.6080633",
"0.6080633",
"0.6080633",
"0.6073343",
"0.6066205",
"0.60535735",
"0.6039896",
"0.6039494",
"0.6022297",
"0.6022258",
"0.60193753",
"0.6016405",
"0.6016388",
"0.6016388",
"0.6016388",
"0.6016388",
"0.6016388",
"0.6016388",
"0.6016388",
"0.6016388",
"0.6016388",
"0.6016388",
"0.59958017",
"0.59838116",
"0.59609884",
"0.5949316",
"0.59449047",
"0.5934992",
"0.5920144",
"0.59160346",
"0.5912792",
"0.590119",
"0.5895701",
"0.5895701",
"0.5895701",
"0.5876746",
"0.58647275",
"0.58593816",
"0.5857745",
"0.5857745",
"0.5857745",
"0.58536166",
"0.58515745",
"0.5841804",
"0.58343065",
"0.58343065",
"0.58318424",
"0.5826333",
"0.5826333",
"0.57941675",
"0.5790515",
"0.57899964",
"0.57899964",
"0.5784875",
"0.5776177",
"0.5771623",
"0.57628554",
"0.57567793",
"0.5756246",
"0.5754884",
"0.5754884",
"0.5754884",
"0.5754884",
"0.5753359",
"0.5750562",
"0.5747018",
"0.57463014",
"0.57448834",
"0.5733797",
"0.5733797",
"0.5733797",
"0.5733797",
"0.5733797",
"0.5733797"
] |
0.5784329
|
80
|
Entry method for building records. Delegates to build_records after remember_depth.
|
def populate(amount, options = {}, &block)
self.class.remember_depth do
build_records(Populator.interpret_value(amount), options[:per_query] || DEFAULT_RECORDS_PER_QUERY, &block)
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def build_new_record\n @record = record_class.new\n end",
"def build_new_record\n @record = record_class.new\n end",
"def build_records(amount, per_query, &block)\n amount.times do\n record = Record.new(@model_class, last_id_in_database + @records.size + 1)\n @records << record\n block.call(record) if block\n save_records if @records.size >= per_query\n end\n end",
"def build_directories_records\n directories_records.each { |r| r.build }\n end",
"def build(attributes = {})\n Record.new(self, attributes)\n end",
"def run\r\n ridFieldName = @qbc.lookupFieldNameFromID( \"3\")\r\n records = Records.new\r\n @qbc.iterateRecords(@dbid,@qbc.getFieldNames(@dbid),nil,@id,nil,qyclst()){|qb_record|\r\n record = Record.new\r\n record.build(@qbc,ridFieldName, qb_record)\r\n records << record\r\n }\r\n records\r\n end",
"def build\n records = []\n date = start_date\n while date <= end_date\n record = {}\n record[:date] = date.strftime(\"%Y-%m-%d\")\n record[:month] = Date::MONTHNAMES[date.month].downcase\n record[:day_of_week] = Date::DAYNAMES[date.wday].downcase\n record[:day_of_week_as_number] = date.wday\n record[:year] = date.year.to_s\n record[:year_and_month] = record[:year] + \"-\" + date.month.to_s.rjust(2,'0')\n record[:sql_date_stamp] = date\n record[:week] = \"week #{date.to_date.cweek}\"\n # compute quarter ourselves - available in Time but not in Date - anything better ?\n quarter = 1 + (date.month-1) / 3\n record[:quarter] = \"Q#{quarter}\"\n record[:semester] = \"S#{(quarter+1)/2}\"\n records << record\n date = date.next\n end\n records\n end",
"def build_record\n record = MARC::Record.new\n data_field = nil\n control_field = nil\n subfield = nil\n text = \"\"\n attrs = nil\n if Module.constants.index(\"Nokogiri\") && @parser.is_a?(Nokogiri::XML::Reader)\n datafield = nil\n cursor = nil\n open_elements = []\n @parser.each do |node|\n if node.value? && cursor\n if cursor.is_a?(Symbol) && (cursor == :leader)\n record.leader = node.value\n else\n cursor.value = node.value\n end\n cursor = nil\n end\n next unless node.namespace_uri == @ns\n if open_elements.index(node.local_name.downcase)\n open_elements.delete(node.local_name.downcase)\n next\n else\n open_elements << node.local_name.downcase\n end\n case node.local_name.downcase\n when \"leader\"\n cursor = :leader\n when \"controlfield\"\n record << datafield if datafield\n datafield = nil\n control_field = MARC::ControlField.new(node.attribute(\"tag\"))\n record << control_field\n cursor = control_field\n when \"datafield\"\n record << datafield if datafield\n datafield = nil\n data_field = MARC::DataField.new(node.attribute(\"tag\"), node.attribute(IND1), node.attribute(IND2))\n datafield = data_field\n when \"subfield\"\n raise \"No datafield to add to\" unless datafield\n subfield = MARC::Subfield.new(node.attribute(CODE))\n datafield.append(subfield)\n cursor = subfield\n when \"record\"\n record << datafield if datafield\n return record\n end\n end\n\n else\n while @parser.has_next?\n event = @parser.pull\n\n if event.text?\n text += REXML::Text.unnormalize(event[0])\n next\n end\n\n if event.start_element?\n text = \"\"\n attrs = event[1]\n case strip_ns(event[0])\n when \"controlfield\"\n text = \"\"\n control_field = MARC::ControlField.new(attrs[TAG])\n when \"datafield\"\n text = \"\"\n data_field = MARC::DataField.new(attrs[TAG], attrs[IND1],\n attrs[IND2])\n when \"subfield\"\n text = \"\"\n subfield = MARC::Subfield.new(attrs[CODE])\n end\n end\n\n if event.end_element?\n case strip_ns(event[0])\n when \"leader\"\n record.leader = text\n when \"record\"\n return record\n when \"controlfield\"\n control_field.value = text\n record.append(control_field)\n when \"datafield\"\n record.append(data_field)\n when \"subfield\"\n subfield.value = text\n data_field.append(subfield)\n end\n end\n end\n end\n end",
"def create\n fail_on_type_mismatch(data_params[:type])\n\n record = queried_record_scope.build\n assign_record_attributes(record, permitted_params_for(:create), data_params)\n\n execute_after_initialize_callbacks(record)\n\n execute_before_create_callbacks(record)\n execute_before_save_callbacks(record)\n\n fail RecordInvalidError.new(record, engaged_field_aliases) if record.errors.any?\n\n record.save!\n\n persist_collection_relationships(record)\n\n execute_after_create_callbacks(record)\n execute_after_save_callbacks(record)\n\n render(\n json: record,\n status: :created,\n fields: query_params[:fields],\n include: query_params[:include]\n )\n end",
"def constructed_records(database_record, lookups, attributes)\n associated = cache.find(target_class(database_record), lookups)\n\n # If the association record already exists, we don't need to build out\n # associations any further.\n if associated\n database_record.association(name).send(construction_method, associated)\n return []\n end\n\n associated = database_record.association(name).build(lookups)\n cache << associated\n\n associated.assign_attributes(attributes)\n\n nested = yield associated if block_given?\n\n [associated, *nested]\n end",
"def build()\n HP.logger.debug(\"~ Build Mode: #{build_mode}\")\n HP.logger.debug(\"~ Source Root: #{source_root}\")\n HP.logger.debug(\"~ Build Root: #{build_root}\")\n build_entries(entries())\n end",
"def build_metadata\n raise StandardError, 'Record not found' if record.nil?\n raise StandardError, \"Missing required elements, missing element(s) are: #{importerexporter.parser.missing_elements(keys_without_numbers(record.keys)).join(', ')}\" unless importerexporter.parser.required_elements?(keys_without_numbers(record.keys))\n \n self.parsed_metadata = {}\n self.parsed_metadata[work_identifier] = [record[source_identifier]]\n add_work_type\n add_standard_metadata\n add_file\n add_visibility\n add_rights_statement\n add_admin_set_id\n add_collections\n add_local\n self.parsed_metadata\n end",
"def build(attributes)\n if @parent.persisted?\n parent_foreign_key = @parent.class.demodulized_name.foreign_key.to_sym\n attributes[parent_foreign_key] = @parent.id\n end\n\n record = client.adapter_for(@class_name).build(attributes)\n @target << record\n record\n end",
"def append_records\n # counter is a array type container hold numbers of AxOrder instance.\n # current AxOrder instance by manipulate is last member of container.\n counter = []\n begin\n if counter.empty?\n counter << new(:ax_order_number => next_ax_order_number)\n else\n counter << new(:ax_order_number => next_ax_order_number(counter.last.ax_order_number))\n end\n\n order, items = counter.last.fetch_data\n counter.last.attributes = order\n items.each do |item|\n counter.last.ax_order_line_items << AxOrderLineItem.new(item)\n end\n counter.each {|o| o.save }\n append_records # recursive invoke method self\n rescue => ex\n puts ex.message if AppConfig.DEBUG_MODE\n retry unless counter.size == MAX_COUNTER\n end\n end",
"def records_for_rebuild(batch_size = 1000)\n transaction do\n if use_fast_batches?\n offset = 0\n while (rows = find :all, :conditions => [ \"#{table_name}.id > ?\", offset ], :limit => batch_size).any?\n offset = rows.last.id\n yield rows, offset\n end\n else\n order = \"#{primary_key} ASC\" # fixes #212\n 0.step(self.count, batch_size) do |offset|\n yield find( :all, :limit => batch_size, :offset => offset, :order => order ), offset\n end\n end\n end\n end",
"def build()\n\t`rm -rf recordings/`\n\t`mkdir recordings`\n\t`rm -rf chapters/`\n\t`mkdir chapters`\n\t`rm -rf outputList.txt`\n\t`touch outputList.txt`\nend",
"def build\n # Create the offsets, if they are not provided\n current_offset = 0\n fields.each do |field_def|\n field_def[2] ||= current_offset\n current_offset = field_def[2] + field_def[1].size\n end\n registry.do_create_compound(name, fields, size)\n end",
"def build_test_case_records(question, auto_grading, evaluation_results)\n build_test_case_records_from_test_results(question, auto_grading, evaluation_results)\n\n # Build failed test case records for test cases which were not found in any evaluation result.\n build_failed_test_case_records(question, auto_grading)\n end",
"def build\n attributes = { contains: build_file_sets }\n attributes[:hasMemberOrders] = [{ viewingDirection: reading_order }] if reading_order\n\n cocina_dro.structural.new(attributes)\n end",
"def build\n end",
"def build\n builder_values = builder.build\n self.use_values(builder_values)\n end",
"def build(params); end",
"def build\n deferred_defaults\n validate\n Builder.new(self).build\n end",
"def build\r\n end",
"def build\r\n end",
"def build\n build_order_detail_journal_rows do |virtual_order_detail|\n validate_order_detail(virtual_order_detail)\n end\n\n order_details.each { |order_detail| update_product_recharges(order_detail) }\n add_journal_rows_from_product_recharges\n self\n end",
"def build_through_record(record)\n @through_records[record.object_id] ||= begin\n ensure_mutable\n\n through_record = through_association.build(*options_for_through_record)\n through_record.send(\"#{source_reflection.name}=\", record)\n through_record\n end\n end",
"def build_record?\n # We want to create a build record by default\n if @options[:build_record].nil?\n true\n else\n @options[:build_record]\n end\n end",
"def build\n records_size = TwitterUser.where(uid: previous_twitter_user.uid).size\n\n if records_size >= 2\n if record_created\n {start: previous_twitter_user.created_at, end: current_twitter_user.created_at}\n else\n {start: current_twitter_user.created_at, end: Time.zone.now}\n end\n elsif records_size == 1\n if record_created\n {start: current_twitter_user.created_at, end: current_twitter_user.created_at}\n else\n {start: current_twitter_user.created_at, end: Time.zone.now}\n end\n else\n raise \"There are no records.\"\n end\n end",
"def build opts = nil, &blk\n builder.build opts, &blk\n end",
"def construct_for(database_record, salesforce_instance)\n mapping = salesforce_instance.mapping\n lookups = { mapping.lookup_column => salesforce_instance.id }\n\n attributes = mapping.convert(\n mapping.database_model,\n salesforce_instance.attributes,\n )\n\n constructed_records(database_record, lookups, attributes) do |associated|\n nested_records(database_record, associated, salesforce_instance)\n end\n end",
"def setup\n t = Thread.new { build_directories_records }\n @adapter = initialize_adapter\n t.join\n end",
"def build\n yield self\n self\n end",
"def build; end",
"def build_recording(session_key)\n # Destroy last recording & associated content object if redoing\n if params[:redo]\n Recording.destroy(session[session_key]) rescue nil\n session[session_key] = nil\n end\n\n @recording = if session[session_key]\n begin \n Recording.find(session[session_key])\n rescue\n session[session_key] = nil\n end\n end\n @recording ||= Recording.new\n end",
"def build_doctors\n\t\tdocs = self.doctors.last(5).to_a\n\t\t(5 - self.doctors.count).times do\n\t\t\tdocs << self.doctors.build\n\t\tend\n\t\tdocs\n\tend",
"def create_temp_holdings_for_processing(rec)\n # init_holdings is a hash of the parameters needed to create a\n # HoldingsRecord object.\n # Initially we set the first 4, which come from 999 92s\n init_holdings = {}\n occ = 0\n Traject::MarcExtractor.cached(\"999|92|\").each_matching_line(rec) do |field, spec, extractor|\n id = field['a']\n loc = field['b']\n next if loc.start_with?('e')\n ct = field['c']\n occ = occ += 1\n\n init_holdings[id] = [id, loc, ct, occ]\n end\n\n if init_holdings.length > 0\n # field_hash\n # key = holdings record id\n # value = array of MARC::DataFields created from 999 93s determined to\n # be relevant to subsequent display/processing\n field_hash = {}\n \n Traject::MarcExtractor.cached(\"999|93|\").each_matching_line(rec) do |field, spec, extractor|\n recid = field['0']\n\n df = new_data_field(field) if \n ( field['2'] == '852' && field['3'] == 'c' ) ||\n ( field['2'] =~ /85[345]/ && field['3'] == 'y' ) ||\n ( field['2'] =~ /86./ && field['3'] == 'h' )\n\n if df\n if field_hash.has_key?(recid)\n field_hash[recid] << df\n else\n field_hash[recid] = [df]\n end\n end\n end\n\n # field_hash values are appended to the relevant parameter array of init_holdings\n field_hash.each { |k, v| init_holdings[k] << v if init_holdings[k] }\n\n # create new HoldingsRecord object \n holdings_array = []\n init_holdings.each_value do |hdata|\n # if there are no relevant variable fields, we don't need to output holdings data\n if hdata.size == 5\n holdings_array << HoldingsRecord.new(hdata[0], hdata[1], hdata[2],\n hdata[3], hdata[4]) \n end\n end\n\n # make sure they are in ILS order\n return holdings_array.sort_by { |h| h.occ }\n end\n end",
"def initialize\n @records = []\n end",
"def do_create\n#binding.pry\n#puts \"**** params[:record][:member]=#{params[:record][:member]}\"\n # Are we making travel record for a guest rather than an existing member?\n if params[:guest] || params[:record][:member] == UNSPECIFIED.to_s\n params[:record].delete(:member)\n end \n members = params[:record][:member] # Might be array, might be singleton\n if members.class == Array\n # For some reason we may get blanks from form -- have to remove them unless there are no members listed\n members.delete_if{|x| x.blank?} if members.size > 1\n else\n members = [members] # Convert to an array if it's a singleton\n end\n\n # Now iterate through the array of members and generate the same travel \n # record for each one\n saved_record_params = params[:record].clone # save parameters since we may alter them\n members.each do |member|\n params[:record][:member] = member # Set member for each iteration\n super # Active scaffold creates the record\n # This creates a return trip automatically\n if @record.return_date\n params[:record][:date] = @record.return_date\n params[:record][:time] = @record.return_time\n params[:record][:destination] = @record.origin\n params[:record][:origin] = @record.destination\n params[:record][:arrival] = !@record.arrival\n params[:record][:return_date] = nil\n params[:record][:return_time] = nil\n params[:record][:confirmed] = nil\n params[:record][:guesthouse] = nil\n params[:record][:baggage] = nil\n params[:record][:driver_accom] = nil\n params[:record][:own_arrangements] = false\n params[:record][:comments] = nil\n super # Active scaffold creates the return record\n flash[:notice] = 'Return trip also created'\n end # if @record.return_date, create return trip\n params[:record] = saved_record_params.clone\n end # members.each\n# puts \"do_create: @record=#{@record.attributes}\"\n end",
"def records(scope)\n scope = policy_scope(scope)\n @q = scope.ransack(ransack_params)\n # Reserved to use grouping search conditions\n # @q.build_grouping unless @q.groupings.any?\n @q.sorts = default_sort if @q.sorts.empty?\n @q.result\n .includes(records_includes)\n .page(params[:page])\n end",
"def load\n super\n slice_records!\n\n self\n end",
"def nested_records(parent_record, database_record, salesforce_instance)\n # We need to identify _this_ association to prevent backtracking.\n inverse = inverse_association_name(target_reflection(parent_record))\n nested = salesforce_instance.mapping.associations.flat_map do |a|\n next if a.name == inverse\n a.build(database_record, salesforce_instance.record, cache)\n end\n\n nested.compact\n end",
"def begin_build\n build_stack.push(true)\n end",
"def perform\n associated_records = parent_context.records.flat_map do |record|\n next if record.nil?\n\n reflection = reflection_cache[record.class]\n next if reflection.nil?\n\n record_association = record.association(association_name)\n reflection.collection? ? record_association.target : record_association.reader\n end\n\n Context.register(\n records: associated_records,\n association_tree: child_association_tree,\n auto_preload: parent_context.auto_preload?\n )\n end",
"def build\n set_action(:build)\n validate_account_type!\n new_account\n assign_params\n build_account_users\n set_affiliate\n set_created_by\n set_facility\n\n after_build\n account\n end",
"def initialize\n @index = {}\n @records = []\n @joins = []\n end",
"def create\n build\n if valid? && journal_rows.present?\n journal_rows.each(&:save!)\n set_journal_for_order_details(journal, order_details.map(&:id))\n end\n self\n end",
"def build\n criteria_fields.inject({}) do |criteria_hash, field|\n value = field_value field \n set_criteria(criteria_hash, field, value) unless skip?(field, value)\n criteria_hash\n end\n end",
"def records(options = {})\n records_base(options)\n end",
"def build_invoice\n # if status is nil then this is a new record and need to build out the invoice\n if self.id.blank?\n # pulls the fees and methods from the group / provider\n # fills in the invoice record with the provider specific information\n self.created_date ||= DateTime.now.strftime(\"%d/%m/%Y\")\n self.balance_owed_amount ||= 0\n\n #get the group or provider associated to the new record\n @object = self.invoiceable_type.classify.constantize.find(self.invoiceable_id)\n self.invoice_method = @object.invoice_method\n self.payment_terms = @object.payment_terms\n self.flat_fee = @object.flat_fee\n self.dos_fee = @object.dos_fee\n self.claim_percentage = @object.claim_percentage\n self.balance_percentage = @object.balance_percentage\n self.cob_fee = @object.cob_fee\n self.denied_fee = @object.denied_fee\n self.setup_fee = @object.setup_fee\n self.admin_fee = @object.admin_fee\n self.discovery_fee = @object.discovery_fee\n\n # build the detail records and calculate the invoice if the detail records dont exist\n # when create is called, the detail records exist and calculate invoice will be called with the before save callback\n if self.invoice_details.blank?\n build_detail_fee_based if self.invoice_method != PERCENT\n build_detail_claims\n build_detail_balance_bills\n build_detail_setup\n\n # calculate the charges for the invoice\n calculate_invoice\n end\n end\n end",
"def parse_tree_to_composite_record records, options={}\n depth = options.fetch( :depth, 0 )\n parent = options.fetch( :parent, :root )\n view = []\n\n records.each do |r|\n if r.parent == parent\n v = Tempo::Views::ViewRecords::Composite.new r, depth: depth\n view << v\n if not r.children.empty?\n child_opts = options.clone\n child_opts[:depth] = depth + 1\n child_opts[:parent] = r.id\n child_array = parse_tree_to_composite_record records, child_opts\n view.push *child_array\n end\n end\n end\n\n view\nend",
"def build\n end",
"def load\n records.load\n end",
"def records\n @records ||= Records.new(klass, self)\n end",
"def records_for_populate(options = {})\n records_base(options)\n end",
"def build_everything\n puts 'building posts'\n build_posts\n puts 'building tags'\n build_tags\n puts 'building index'\n build_index\n puts 'building feed'\n build_feed\n end",
"def build builder\n builder.send tag, @attributes do |builder|\n objects.each do |object|\n object.build builder\n end\n end\n end",
"def build_through_record(record)\n @through_records[record] ||= begin\n ensure_mutable\n\n attributes = through_scope_attributes\n attributes[source_reflection.name] = record\n\n through_association.build(attributes).tap do |new_record|\n new_record.send(\"#{source_reflection.foreign_type}=\", options[:source_type]) if options[:source_type]\n end\n end\n end",
"def build_entry\n model_scope.new\n end",
"def build!\n end",
"def each\n if block_given?\n while @parser.has_next?\n event = @parser.pull\n # if it's the start of a record element\n if event.start_element? && (strip_ns(event[0]) == \"record\")\n yield build_record\n end\n end\n else\n enum_for(:each)\n end\n end",
"def build_field\n return unless random_build\n (0..height).each do |row_id|\n build_row(row_id)\n end\n end",
"def add_records(records)\n records.each do |r|\n condensed_record = condense_record(r)\n load_atoms(condensed_record)\n add_occurences(condensed_record,r.id)\n @records_size += 1\n end\n end",
"def build_values\n @elements = Core::CommandWatcher.report(@list)\n @elements.each_with_index do |(level, _, age), col|\n build_column_for(col + 1, age, level)\n end\n end",
"def build(&block)\n if block\n @build = block\n else\n @build\n end\n end",
"def build\n if expand_document\n combine_layout\n combine_activity_metadata\n document.update! build_params\n else\n document.document_parts.delete_all\n document.update! document_params.merge(toc: template.toc, material_ids: template.toc.collect_material_ids)\n end\n end",
"def fill_out\n @build = {}\n descend(@schema, [])\n @build\n end",
"def <<(*records)\n result = true\n load_target if @owner.new_record?\n\n transaction do\n flatten_deeper(records).each do |record|\n raise_on_type_mismatch(record)\n add_record_to_target_with_callbacks(record) do |r|\n result &&= insert_record(record) unless @owner.new_record?\n end\n end\n end\n\n @owner.send(:cache_write, @reflection, self) if @reflection.options[:cached]\n\n result && self\n end",
"def each\n 0.upto(@record_count - 1) do |n|\n seek_to_record(n)\n yield ADT::Record.new(self)\n end\n end",
"def build_search(records, search)\n records = records.where(name: search.name) if search.name.present?\n records = records.where(profession: search.profession) if search.profession.present?\n records = records.where(grade: search.grade) if search.grade.present?\n\n records\n end",
"def initialize(records:, association_tree:)\n @association_tree = association_tree\n\n super(records: records)\n end",
"def build_test_case_records(test_report)\n test_cases = parse_test_report(test_report)\n test_cases.map do |test_case|\n @question.test_cases.build(identifier: test_case.identifier,\n test_case_type: infer_test_case_type(test_case.name),\n expression: test_case.expression,\n expected: test_case.expected,\n hint: test_case.hint)\n end\n end",
"def build\n { 'Shipper' => PartyBuilder.build(@model.shipper, :shipper => true),\n 'ShipTo' => PartyBuilder.build(@model.recipient),\n 'PaymentInformation' => build_payment_info,\n 'Service' => build_service,\n 'Package' => PackageBuilder.build(@model.package),\n :order! => ['Shipper', 'ShipTo', 'PaymentInformation', 'Service', 'Package'] }\n end",
"def build(attributes, parent)\n record = new(parent)\n attributes.each do | key, value |\n field_key = record.class.fields.find { |_, params| params[:api_name].to_s == key.to_s }\n attr = field_key.nil? ? key : field_key.last[:internal_name]\n record.send(\"#{attr}=\", value)\n end\n record\n end",
"def records\n fail 'Not yet implemented'\n end",
"def record; end",
"def record; end",
"def record; end",
"def build\n # use guard clauses to a) avoid nested ifs b) early identify invalid values\n raise ArgumentError, \"`a` must be a Fixnum\" unless dirty.fetch(:a).is_a? Fixnum\n\n # #tap will guarantee, that a hash is returned\n {}.tap do |h|\n h[:a] = dirty.fetch(:a) # a mandatory parameter, will raise a KeyError on violation\n h[:b] = dirty.fetch(:b, 2) # optional, with 2 as the default\n h[:c] = dirty.fetch(:c) if dirty.has_key? :c # optional, no default\n end\n end",
"def create_new_empty_record(initial_data = nil) #:nodoc:\r\n if @tables.size == 1\r\n @record = @tables.first[0].new(initial_data)\r\n else\r\n rec = @tables.first[0].find(@ids.first) # top most record\r\n 1.upto(@tables.size - 2) { |i| rec = rec.send(@tables[i][1].pluralize).find(@ids[i]) } # find embedded children by ids\r\n @record = rec.send(@tables.last[1].pluralize).new(initial_data) # new record\r\n end\r\nend",
"def build(attributes = {})\n @klass.build(attributes)\n end",
"def create_new_empty_record(initial_data=nil) #:nodoc:\r\n if @tables.size == 1\r\n @record = @tables.first[0].new(initial_data)\r\n else\r\n rec = @tables.first[0].find(@ids.first) # top most record\r\n 1.upto(@tables.size - 2) { |i| rec = rec.send(@tables[i][1].pluralize).find(@ids[i]) } # find embedded childrens by ids\r\n @record = rec.send(@tables.last[1].pluralize).new(initial_data) # new record\r\n end\r\nend",
"def build_usage_data(customer_level)\n root = params[:id].nil? ? account : account.all_descendants.find_by(id: params[:id])\n return if root.nil?\n\n if customer_level\n @accounts = root.all_descendants.where(type: \"Customer\").not_trial\n @devices = root.all_descendant_devices\n .where(\"last_connected_at > ? and last_connected_at < ?\", @start_date, @end_date)\n .group(:account_path).count\n @firewalls = root.all_descendant_billable_instances.firewall.group(:account_path).count\n @mailboxes = root.all_descendant_billable_instances.office_365_mailbox.group(:account_path).count\n # TODO: can I combine the above two with an extra clause in the group by?\n else\n @devices = {}\n @firewalls = {}\n @mailboxes = {}\n @accounts = root.all_descendants.where(type: \"Provider\").not_trial\n @accounts = nil if @accounts.blank?\n (@accounts&.all || [root]).each do |provider|\n next if provider.trial?\n\n @devices[provider.path] = provider.all_descendant_devices\n .where(\"last_connected_at > ? and last_connected_at < ?\", @start_date, @end_date).count\n @firewalls[provider.path] = provider.all_descendant_billable_instances.firewall.count\n @mailboxes[provider.path] = provider.all_descendant_billable_instances.office_365_mailbox.count\n end\n end\n end",
"def rec_build(level, direction, rotation, fractal_list)\r\n # At the lowest level, add an actual piece to the array\r\n if (level == 0)\r\n fractal_list.push((direction + rotation) % 360)\r\n return\r\n end\r\n \r\n # At higher levels, we need to define the shape of the fractal\r\n for piece_direction in @base_fractal\r\n rec_build(\r\n level - 1, # Drill down to the next level\r\n piece_direction, # Take direction from the base array\r\n (direction + rotation) % 360, # Rotate lower-level according to higher level structure\r\n fractal_list) # Append to the list\r\n end\r\n end",
"def build(attrs)\n # Implement #build \n end",
"def after_create_save(record)\n if nested? && nested.scope\n parent = nested_parent_record(:read)\n record.send(nested.scope.to_s).send(:<<, parent) unless parent.nil?\n end\n end",
"def build_current_children_and_evaluate! opts={}\n these_asserts\n @current.clear\n if (@start_offset > final_offset) # see :note3\n @done = true\n evaluate_ok!\n return nil\n end\n @ok = nil\n @done = false\n @children_productions = production.children\n @ctxt = parse_context\n (start_offset..@children.length-1).each do |idx|\n @current.push idx\n break unless build_this_child_and_keep_going?(idx, opts)\n end\n @children_productions = nil\n @ctxt = nil\n evaluate_ok!\n nil\n end",
"def build_self(build_once = true)\n self.result = @children.collect {|p| p.last.build }.uniq\n end",
"def records\n @records ||= []\n end",
"def build\n {'ShipTimestamp' => ship_timestamp,\n 'DropoffType' => DROPOFF_TYPES[@opts[:dropoff_type]],\n 'ServiceType' => SERVICE_TYPES[@opts[:service_type]],\n 'PackagingType' => PACKAGING_TYPES[@model.package.packaging_type],\n 'Shipper' => PartyBuilder.build(@model.shipper),\n 'Recipient' => PartyBuilder.build(@model.recipient),\n 'ShippingChargesPayment' => shipping_charges_payment,\n 'LabelSpecification' => label_specification,\n 'RateRequestTypes' => RATE_REQUEST_TYPE,\n 'PackageCount' => PACKAGE_COUNT,\n 'RequestedPackageLineItems' => PackageBuilder.build(@model.package),\n :order! => ['ShipTimestamp' , 'DropoffType' , 'ServiceType' , 'PackagingType',\n 'Shipper' , 'Recipient' , 'ShippingChargesPayment', 'LabelSpecification',\n 'RateRequestTypes', 'PackageCount' , 'RequestedPackageLineItems']\n }\n end",
"def after_create_save(record)\n if (nested? && nested.scope)\n parent = nested_parent_record(:read)\n record.send(\"#{nested.scope}\").send(:<<, parent) unless parent.nil?\n end\n end",
"def initialize(records:)\n @records = records.dup\n @records.compact!\n @records.uniq!\n @records.each { |record| record.lazy_preload_context = self }\n end",
"def build_all\n create_categories\n puts \"Built categories\"\n create_contacts\n puts \"Built contacts\"\n create_locations\n puts \"Built locations\"\n create_services\n puts \"Built services\"\n create_service_types\n puts \"Built service types\"\n create_comments\n puts \"Built comments\"\n create_costs\n puts \"Built costs\"\n create_service_locations\n puts \"Built service locations\"\n create_service_contacts\n puts \"Built service locations\" \n create_users\n puts \"Built users\" \n end",
"def build_report\n klass = model_class.constantize\n @cols = klass.columns.map { |c| c.name.to_sym }\n @assocs = klass.reflect_on_all_associations\n\n through = @assocs.each_with_object({}) { |x, hsh| hsh[x.options[:through]] = 1 }\n # through={} ; @assocs.each { |x| through[x.options[:through]] = 1 }\n @assocs = @assocs.select { |x| !through[x.name] }\n @tire_saved = klass.tire.mapping.keys\n end",
"def build_order_detail_journal_rows\n reset\n\n virtual_order_details = OrderDetailListTransformerFactory.instance(order_details).perform\n virtual_order_details.each do |virtual_order_detail|\n yield virtual_order_detail if block_given?\n # Each individual order detail may result in multiple journal rows (e.g. double-entry)\n @journal_rows.concat Array(order_detail_to_journal_row(virtual_order_detail))\n end\n\n journal_rows\n end",
"def collect_record_data(serializer, abilities)\n return unless serialize_record_data?\n record = serializer.object\n return if record.blank?\n keys = collect_only_keys.present? ? collect_only_keys : collect_keys\n collect_record_data_for_keys(serializer, keys, record, abilities)\n end",
"def create_record!(record)\n @created += 1\n begin\n ar_record = target_class.new(record_attributes(record))\n ar_record.save!\n return ar_record\n rescue ActiveRecord::RecordInvalid => e \n ar_record.save!(:validate => false)\n @invalid_records += 1\n raise e\n end\n end",
"def build(attrs = {})\n vacols_record = (attrs.delete(:vacols_record) || default_vacols_record).clone\n documents = attrs.delete(:documents)\n appeal = Appeal.new(default_attrs.merge(attrs))\n\n vacols_record[:vbms_id] = appeal.vbms_id\n\n Fakes::AppealRepository.records ||= {}\n Fakes::AppealRepository.records[appeal.vacols_id] = vacols_record\n\n Fakes::AppealRepository.document_records ||= {}\n Fakes::AppealRepository.document_records[appeal.vbms_id] = documents\n appeal\n end",
"def build\n fail \"Please provide a value for key, currently: #{key}\" if key.nil?\n\n if in_key\n { in_key.to_sym => { key => data } }\n else\n process_data\n transform_to_hash\n end\n end",
"def build(document)\n build_simple_attributes(document)\n build_complex_attributes(document)\n end",
"def build(attributes = {}, type = nil)\n Factory.execute_build(type || klass, attributes, execute_callbacks: false).tap do |doc|\n append(doc)\n doc.apply_post_processed_defaults\n yield doc if block_given?\n doc.run_pending_callbacks\n doc.run_callbacks(:build) { doc }\n end\n end"
] |
[
"0.6380753",
"0.6380753",
"0.6206229",
"0.6184977",
"0.608119",
"0.583847",
"0.58199894",
"0.57396543",
"0.56746197",
"0.5632309",
"0.5629587",
"0.5629191",
"0.5603841",
"0.5567505",
"0.55652845",
"0.55078983",
"0.54793346",
"0.5443821",
"0.5433214",
"0.53924257",
"0.53747195",
"0.53519773",
"0.5349546",
"0.53220254",
"0.53220254",
"0.53036964",
"0.52989125",
"0.5256538",
"0.52374524",
"0.52366036",
"0.52348685",
"0.5225434",
"0.52246875",
"0.5218881",
"0.52149045",
"0.5204603",
"0.5181538",
"0.5159782",
"0.515927",
"0.51592624",
"0.5147247",
"0.5147219",
"0.51417416",
"0.51348317",
"0.5133207",
"0.5125685",
"0.5120022",
"0.51077515",
"0.5104297",
"0.5104205",
"0.51035213",
"0.5074785",
"0.5058867",
"0.5057235",
"0.5056912",
"0.5054628",
"0.50513387",
"0.50506",
"0.5035379",
"0.5012477",
"0.50071883",
"0.500716",
"0.49942976",
"0.49814495",
"0.4972323",
"0.49688652",
"0.49658594",
"0.4963418",
"0.49628496",
"0.4958856",
"0.49550346",
"0.4953412",
"0.49445993",
"0.49441347",
"0.49342108",
"0.49290484",
"0.49290484",
"0.49290484",
"0.4922583",
"0.49164855",
"0.49152",
"0.49150345",
"0.4913004",
"0.49124876",
"0.49056715",
"0.49054396",
"0.49024293",
"0.48948097",
"0.4881473",
"0.48803017",
"0.48799667",
"0.48729903",
"0.48708144",
"0.48624736",
"0.48590118",
"0.48588544",
"0.4829399",
"0.48277497",
"0.48222923",
"0.48192766",
"0.4810409"
] |
0.0
|
-1
|
Builds multiple Populator::Record instances and calls save_records them when :per_query limit option is reached.
|
def build_records(amount, per_query, &block)
amount.times do
record = Record.new(@model_class, last_id_in_database + @records.size + 1)
@records << record
block.call(record) if block
save_records if @records.size >= per_query
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def records_for_populate(options = {})\n records_base(options)\n end",
"def batch_new\n @records = Array.new(BATCH_SIZE) { record_class.new }\n end",
"def populate(amount, options = {}, &block)\n self.class.remember_depth do\n build_records(Populator.interpret_value(amount), options[:per_query] || DEFAULT_RECORDS_PER_QUERY, &block)\n end\n end",
"def create_retrievals\n work_ids = Work.pluck(:id)\n existing_ids = RetrievalStatus.where(:source_id => id).pluck(:work_id)\n\n (0...work_ids.length).step(1000) do |offset|\n ids = work_ids[offset...offset + 1000] & existing_ids\n InsertRetrievalJob.perform_later(self, ids)\n end\n end",
"def append_records\n # counter is a array type container hold numbers of AxOrder instance.\n # current AxOrder instance by manipulate is last member of container.\n counter = []\n begin\n if counter.empty?\n counter << new(:ax_order_number => next_ax_order_number)\n else\n counter << new(:ax_order_number => next_ax_order_number(counter.last.ax_order_number))\n end\n\n order, items = counter.last.fetch_data\n counter.last.attributes = order\n items.each do |item|\n counter.last.ax_order_line_items << AxOrderLineItem.new(item)\n end\n counter.each {|o| o.save }\n append_records # recursive invoke method self\n rescue => ex\n puts ex.message if AppConfig.DEBUG_MODE\n retry unless counter.size == MAX_COUNTER\n end\n end",
"def records_for_rebuild(batch_size = 1000)\n transaction do\n if use_fast_batches?\n offset = 0\n while (rows = find :all, :conditions => [ \"#{table_name}.id > ?\", offset ], :limit => batch_size).any?\n offset = rows.last.id\n yield rows, offset\n end\n else\n order = \"#{primary_key} ASC\" # fixes #212\n 0.step(self.count, batch_size) do |offset|\n yield find( :all, :limit => batch_size, :offset => offset, :order => order ), offset\n end\n end\n end\n end",
"def save_records\n unless @records.empty?\n @model_class.connection.populate(@model_class.quoted_table_name, columns_sql, rows_sql_arr, \"#{@model_class.name} Populate\")\n @last_id_in_database = @records.last.id\n @records.clear\n end\n end",
"def run\r\n ridFieldName = @qbc.lookupFieldNameFromID( \"3\")\r\n records = Records.new\r\n @qbc.iterateRecords(@dbid,@qbc.getFieldNames(@dbid),nil,@id,nil,qyclst()){|qb_record|\r\n record = Record.new\r\n record.build(@qbc,ridFieldName, qb_record)\r\n records << record\r\n }\r\n records\r\n end",
"def records(options = {})\n records_base(options)\n end",
"def create_retrievals\n article_ids = RetrievalStatus.where(:source_id => id).pluck(:article_id)\n\n (0...article_ids.length).step(1000) do |offset|\n ids = article_ids[offset...offset + 1000]\n delay(priority: 2, queue: \"retrieval-status\").insert_retrievals(ids)\n end\n end",
"def randomize_records\n puts \"Due to the API throughput limitations, this may take some time...\\n\"\n\n execute_customer_record_create(10)\n\n execute_sales_order_create(25)\n\n execute_invoice_create(25)\n\n # 25.times do |t|\n # execute_payment_create(25)\n # end\n\n puts \"\\nFinished creating bulk records!\"\n exit\n end",
"def batch_create\n @values = record_batch_params.values.reject { |p| p.values.all?(&:blank?) }\n @records = record_class.create(@values)\n\n respond_to do |format|\n if @records.all?(&:valid?)\n format.html { redirect_to url_for(action: 'index'), notice: \"#{record_class.model_name.plural.humanize} were successfully created.\" }\n format.json { render :index, status: :created }\n else\n @records = @records.fill(@records.size..BATCH_SIZE) { record_class.new }\n\n format.html { render :batch_new }\n format.json { render json: @records.map(&:errors), status: :unprocessable_entity }\n end\n end\n end",
"def records( quantity = 1 )\n phone_numbers = []\n quantity.times do\n phone_numbers.push( self.record() )\n end\n phone_numbers\n end",
"def records( quantity = 1 )\n persons = []\n quantity.times do\n persons.push( self.record() )\n end\n persons\n end",
"def parallel_queries\n raise \"Model is missing id column\" if ar_class.columns.none? { |column| column.name == \"id\" }\n\n if ar_class.respond_to?(:scrubbable_scope)\n num_records = ar_class.send(:scrubbable_scope).count\n else\n num_records = ar_class.count\n end\n return [] if num_records == 0 # no records to import\n\n record_window_size, modulus = num_records.divmod(num_of_batches)\n if record_window_size < 1\n record_window_size = 1\n modulus = 0\n end\n\n start_id = next_id(ar_class: ar_class, offset: 0)\n queries = num_of_batches.times.each_with_object([]) do |_, queries|\n next unless start_id\n\n end_id = next_id(ar_class: ar_class, id: start_id, offset: record_window_size - 1)\n if modulus > 0\n end_id = next_id(ar_class: ar_class, id: end_id)\n modulus -= 1\n end\n queries << { id: start_id..end_id } if end_id\n start_id = next_id(ar_class: ar_class, id: end_id || start_id)\n end\n\n # just in case new records are added since we started, extend the end ID\n queries[-1] = [\"#{ar_class.quoted_table_name}.id >= ?\", queries[-1][:id].begin] if queries.any?\n\n queries\n end",
"def records( quantity = 1 )\n addresses = []\n quantity.times do\n addresses.push( self.record() )\n end\n addresses\n end",
"def create_records(klass, count)\n RecordCountChangeMatcher.new.for(klass).by(count)\n end",
"def records\n @records ||= Records.new(klass, self)\n end",
"def add_records(records)\n records.each do |r|\n condensed_record = condense_record(r)\n load_atoms(condensed_record)\n add_occurences(condensed_record,r.id)\n @records_size += 1\n end\n end",
"def create_raw_query\n\n recordings_search = AudioRecording.scoped\n\n if self.invalid?\n raise ArgumentError, \"SavedSearchStore has errors: #{self.errors.to_json}.\"\n end\n\n unless self.pre_params.blank?\n if self.pre_params.invalid?\n raise ArgumentError, \"SavedSearchStorePre has errors: #{self.pre_params.errors.to_json}.\"\n end\n end\n\n unless self.body_params.blank?\n\n if self.body_params.invalid?\n raise ArgumentError, \"SavedSearchStoreBody has errors: #{self.body_params.errors.to_json}.\"\n end\n\n # these are in a specific order, from the ones that will filter the most, to those that will filter the least.\n recordings_search = recordings_search.recording_ids(self.body_params.audio_recording_id) if self.body_params.audio_recording_id\n recordings_search = recordings_search.recording_uuids(self.body_params.audio_recording_uuid) if self.body_params.audio_recording_uuid\n\n recordings_search = recordings_search.recording_projects(self.body_params.project_id) if self.body_params.project_id\n recordings_search = recordings_search.recording_sites(self.body_params.site_id) if self.body_params.site_id\n\n if self.body_params.date_start && self.body_params.date_end\n recordings_search = recordings_search.recording_within_date(self.body_params.date_start, self.body_params.date_end)\n elsif self.body_params.date_start\n recordings_search = recordings_search.recording_within_date(self.body_params.date_start, self.body_params.date_start)\n elsif self.body_params.date_end\n recordings_search = recordings_search.recording_within_date(self.body_params.date_end, self.body_params.date_end)\n end\n\n if self.body_params.time_start && self.body_params.time_end\n recordings_search = recordings_search.recording_within_time(self.body_params.time_start, self.body_params.time_end)\n elsif self.body_params.time_start\n recordings_search = recordings_search.recording_within_time(self.body_params.time_start, self.body_params.time_start)\n elsif self.body_params.time_end\n recordings_search = recordings_search.recording_within_time(self.body_params.time_end, self.body_params.time_end)\n end\n\n recordings_search = recordings_search.recording_tags(self.body_params.tags) if self.body_params.tags\n end\n\n\n unless self.post_params.blank?\n if self.post_params.invalid?\n raise ArgumentError, \"SavedSearchStorePost has errors: #{self.post_params.errors}.\"\n end\n end\n\n recordings_search\n end",
"def build_params\n ids_sliced_by_ten.each_slice(2).map do |batch|\n build_params_from_batch(batch)\n end\n end",
"def batch_query\n render nothing: true\n\n # logger.info \"params: \" + params.inspect\n #\n # endpoints_all = Endpoint.all\n # logger.info \"List of all endpoints:\"\n # endpoints_all.each do |endpoint|\n # logger.info ' name: ' + endpoint[:name] + ', url: ' + endpoint[:base_url]\n # end\n\n # Select endpoints using array of endpoint names;\n # Unfortunately, they are not necessarily unique\n endpoint_names = params[:endpoint_names]\n logger.info 'param endpoint_names:' + endpoint_names.inspect\n selected_endpoints = []\n if endpoint_names\n parse_array(endpoint_names).each do |endpoint_name|\n match_ep = Endpoint.find_by_name(endpoint_name)\n if match_ep\n logger.info endpoint_name.to_s + ' matches: ' + match_ep[:name].inspect\n selected_endpoints.push(match_ep)\n else\n logger.info 'WARNING: ' + endpoint_name.to_s + ' has no match!'\n end\n end\n end\n # logger.info 'selected endpoings: ' + selected_endpoints.inspect\n\n\n # users = User.all\n # users.each do |user|\n # logger.info 'username: ' + user[:username]\n # end\n\n # queries_all = Query.all\n # logger.info \"List of all queries:\"\n # queries_all.each do |query|\n # logger.info ' title: ' + query[:title] + ', desc: ' + query[:description]\n # end\n\n # Select query using array of query descriptions;\n # Unfortunately, they are not necessarily unique\n #query_titles = params[:query_titles]\n username = params[:username]\n current_user = User.find_by_username(username)\n if current_user\n query_descriptions = params[:query_descriptions]\n # logger.info 'param query_descriptions:' + query_descriptions.inspect\n selected_queries = []\n if query_descriptions\n parse_array(query_descriptions).each do |query_desc|\n match_query = current_user.queries.find_by_description(query_desc)\n if match_query\n logger.info query_desc + ' matches: ' + match_query[:description].inspect\n selected_queries.push(match_query)\n else\n logger.info 'WARNING: ' + query_desc + ' has no match!'\n end\n end\n end\n end\n # logger.info 'selected queries: ' + selected_queries.inspect\n\n if selected_endpoints && !selected_endpoints.empty? &&\n selected_queries && !selected_queries.empty?\n notify = params[:notification]\n selected_queries.each do |eachQuery|\n #Parallel.each(selected_queries, :in_threads=>15) do |eachQuery|\n # execute the query, and pass in the endpoints and if the user should be notified by email when execution completes\n # logger.info 'title: ' + eachQuery[:title].inspect\n # logger.info 'desc: ' + eachQuery[:description].inspect\n # logger.info 'user_id: ' + eachQuery[:user_id].inspect\n eachQuery.execute(selected_endpoints, notify)\n end\n else\n flash[:alert] = 'Cannot execute a query if no endpoints are provided.'\n end\n end",
"def map_records_into_measure_groups\n qm = QualityMeasure.new(@measure_id, @sub_id)\n measure = Builder.new(get_db, qm.definition, @parameter_values)\n records = get_db.collection('records')\n records.map_reduce(measure.map_function, \"function(key, values){return values;}\",\n :out => {:reduce => 'patient_cache'}, \n :finalize => measure.finalize_function,\n :query => {:test_id => @parameter_values['test_id']})\n apply_manual_exclusions\n end",
"def build_data(id, range, mean, start_date, end_date,ch_id)\n cols=[:measure_id, :site_id, :channel_id, :dt, :value]\n batch_data=[]\n start_date.upto(end_date) { |dt|\n puts \"DATE #{dt}\"\n Site.find(:all).each { |site|\n r=rand*2-1\n #Instead of a pure random value we use a normal distribution to get the values to crowd around the mean.\n val=Statistics2.normaldist(r)*range+(mean-range/2)\n batch_data <<[id, site.id,ch_id,dt,val]\n #measrec=Measurement.create(:measure_id => id, :site_id => site.id, \n #:channel_id => ch.id, :dt => dt, :value => val)\n }\n }\n Measurement.import(cols, batch_data)#Mass importing of data. A lot faster than 1 insert at a time.\n #Put the limit writing code here.\nend",
"def each\n 0.upto(@record_count - 1) do |n|\n seek_to_record(n)\n yield ADT::Record.new(self)\n end\n end",
"def records( quantity = 1 )\n email_addresses = []\n quantity.times do\n email_addresses.push( self.record() )\n end\n email_addresses\n end",
"def aggregate_data number=1, unit=\"month\", create_page=false\n increment = instance_eval(\"#{number}.#{unit}\")\n end_of_today = DateTime.now.utc.end_of_day\n current_date = end_of_today\n my_arr = []\n @bulk_insert=[]\n @bulk_update={}\n while current_date > min_post_date do\n beginning_of_ = (current_date-increment+1.day).beginning_of_day.to_s(:db)\n end_of_ = current_date\n if end_of_ > end_of_today\n break\n end\n # puts \"DATE #{current_date} > #{min_post_date}\"\n end_of_ = end_of_.to_s(:db)\n data = select_aggregated_data beginning_of_, end_of_\n \n options = {:likes=>data.likes, \n :comments=>data.comments,\n :shares=>data.shares,\n :posts => data.post_count,\n :replies_to_comment => data.replies_to_comment\n }\n my_arr << { \"value\"=>options,\n \"start_date\"=>beginning_of_,\n \"end_time\"=>end_of_\n }\n if create_page\n # find_or_create_page(options)\n\n options[:post_created_time] = current_date\n created_time = options[:post_created_time]\n begin_date = created_time.beginning_of_day\n end_date = created_time.end_of_day\n rec = FbPage.where(account_id: self.id).\n where(post_created_time: (begin_date..end_date)).first\n attr = {:account_id => self.id, \n :post_created_time=>created_time.middle_of_day,\n :object_name => self.object_name}\n if rec\n @bulk_update[rec.id] = attr\n else\n @bulk_insert << attr\n end\n \n end\n # current_date = current_date - increment\n current_date = current_date - 1.day\n end\n if !@bulk_update.blank?\n FbPage.transaction do\n FbPage.update @bulk_update.keys, @bulk_update.values\n @bulk_update = {}\n end\n elsif !@bulk_insert.empty?\n FbPage.transaction do\n FbPage.import_bulk! @bulk_insert\n @bulk_insert = []\n end\n end\n my_arr.reverse\n end",
"def create_additional_records\n case params[:mx_type]\n when 'gmail'\n create_gmail_records\n when 'godaddy'\n create_godaddy_records\n when 'networksolutions'\n create_networksolutions_records\n else\n return\n end\n end",
"def populate(options={})\n # puts \"PipelinedRolapAggregate::populate #{options.inspect}\"\n @new_records_record = nil\n\n # we need 2 connections\n # one to read, one to write\n self.read_connection = options[:read_connection] if options[:read_connection]\n self.write_connection = options[:write_connection] if options[:write_connection]\n\n # see if the options mean to do new records only\n if(options[:new_records_only])\n # need to know the name of the dimension and field to use to find new only\n @new_records_only = true\n @new_records_dimension = options[:new_records_only][:dimension] || :date\n @new_records_offset = options[:new_records_only][:buffer] || 1\n else\n @new_records_only = false\n end\n\n create_and_populate_aggregate(options)\n end",
"def delay_save\n \n return if @all_fields_and_values.nil?\n \n # If there is a dynamo_field_value for one of this model's fields then there will be for all. Query for it here\n # and you'll only do it once, but move it into the loop and you'll count for each dynamo_field.\n first = @all_fields_and_values[0]\n count = DynamoFieldValue.count(:conditions=>\"model_id = #{self.id} AND dynamo_field_id=#{first[:dynamo_field].id}\")\n \n all_values = []\n @all_fields_and_values.each do |fv|\n # If count is 0 it means that no dynamo_field_values exist for this model so its brand new.\n if count == 0\n dfv = DynamoFieldValue.new(:dynamo_field_id=>fv[:dynamo_field].id, :model_id=>self.id, :created_at=>Time.now, :updated_at=>Time.now, \"#{fv[:dynamo_field].field_type}\".to_sym => fv[:value])\n all_values << build_insert_stmt(dfv)\n else\n # This is an existing set of values so we need to update.\n # Update is slower because we need to get the dynamo_field_values for this field so its extra queries\n dfv = fv[:dynamo_field].dynamo_field_values\n if dfv.blank?\n dfv = DynamoFieldValue.new(:dynamo_field_id=>fv[:dynamo_field].id, :model_id=>self.id, :created_at=>Time.now, :updated_at=>Time.now, \"#{fv[:dynamo_field].field_type}\".to_sym => fv[:value])\n all_values << build_insert_stmt(dfv)\n # If you don't clear the cache a second save on this instance won't see the newly created dynamo_field_value and it will insert it again.\n self.dynamo_cache=nil\n else\n # Find the dynamo_field_value we want to update.\n dfv = dfv.detect{|dyn_field_value| dyn_field_value.model_id == self.id}\n dfv.send(\"#{fv[:dynamo_field].field_type}=\", fv[:value])\n dfv.save!\n end\n end\n \n # Reset this now that we have processed all the insert / updates needed. If you don't \n # a double call to save could produce unexpected results.\n @all_fields_and_values = nil\n end\n \n return if all_values.empty?\n \n # improving performance by doing bulk inserts. The more dynamic fields the model has the more benefit this has over single inserts.\n bulk_insert_stmt = \"INSERT INTO `dynamo_field_values`(#{DynamoFieldValue.column_names.reject{ |field| field == 'id'}.join(',')}) VALUES #{all_values.join(',').gsub(/\"NULL\"/, 'NULL')}\"\n ActiveRecord::Base.connection.execute(bulk_insert_stmt)\n end",
"def serialize_records\n return nil unless last_response.respond_to?(:records)\n\n last_response.records.map do |remote_record|\n record = self.class.allocate\n record.instantiate(remote_record.to_hash)\n record\n end\n end",
"def add_records(records)\n atoms = {}\n\n records.each do |record|\n next unless @if_proc.call(record)\n\n condensed_record = condense_record(record)\n atoms = add_occurences(condensed_record, record.id, atoms)\n end\n\n @storage.add(atoms)\n end",
"def build\n records_size = TwitterUser.where(uid: previous_twitter_user.uid).size\n\n if records_size >= 2\n if record_created\n {start: previous_twitter_user.created_at, end: current_twitter_user.created_at}\n else\n {start: current_twitter_user.created_at, end: Time.zone.now}\n end\n elsif records_size == 1\n if record_created\n {start: current_twitter_user.created_at, end: current_twitter_user.created_at}\n else\n {start: current_twitter_user.created_at, end: Time.zone.now}\n end\n else\n raise \"There are no records.\"\n end\n end",
"def records_base(_options = {})\n _model_class.all\n end",
"def records=(records)\n clear\n concat(records)\n end",
"def records(opts = {})\n opts = opts.merge(@opts)\n client.list_records(opts).full.lazy.flat_map do |rec|\n @record_class.build(mint_id(rec.header.identifier),\n record_xml(rec))\n\n end\n end",
"def update_all records\n array = []\n records.each do |id, r|\n params = {}\n r.each do |k, v|\n params[k] = {value: v}\n end\n array.push({\n id: id,\n record: params\n })\n end\n puts \"update #{array.count} records...\"\n while array.present?\n a100 = array.shift(100)\n @api.records.update(@app_id, a100)\n end\n {}\n end",
"def save_records\n @job_condition = job_condition\n find_type\n prepare_batch\n\n if @batch\n @image_count = 1 if @job_condition\n @batch.inbound_file_information = @inbound_file_information if @inbound_file_information\n\n images = prepare_image\n images.each{|image| @batch.images_for_jobs << image}\n\n prepare_job\n @batch.jobs << @job if @job_condition\n images.each{|image| @job.images_for_jobs << image}\n\n if @job_condition\n check = prepare_cheque\n @job.check_number = '0' if check.check_amount == 0.0\n @job.check_informations << check\n @job.initial_image_name = @initial_image_name\n micr = prepare_micr\n if micr\n payer = micr.payer\n check.payer_id = micr.payer_id if micr.payer_id\n if !facility.payer_ids_to_exclude.blank?\n @job.job_status = JobStatus::EXCLUDED if payer && payer.excluded?(facility)\n elsif !facility.payer_ids_to_include.blank?\n @job.job_status = JobStatus::EXCLUDED if !facility.included_payers.include?(payer)\n end\n micr.check_informations << check\n end\n end\n \n if @batch.save\n if @job.save\n images.each do |image|\n if image.save\n InputBatch.log.debug \"Image #{image.filename} id #{image.id} batch id #{image.batch.id} job id #{image.jobs.first.id} successfully loaded\"\n puts \"Image #{image.filename} successfully loaded\"\n end\n end\n\n total_number_of_images = number_of_pages(@job)\n check_number = check.check_number if !check.blank?\n estimated_eob = @job.estimated_no_of_eobs(total_number_of_images, micr, check_number)\n @job.update_attributes(:estimated_eob => estimated_eob, :pages_to => total_number_of_images)\n\n if @job_condition and check.save\n InputBatch.log.debug \"Check id #{check.id}, check_number #{check.check_number}, Job id #{check.job.id}, batch id #{check.job.batch.id} successfully loaded\"\n if micr and micr.save\n InputBatch.log.debug \"Check #{check.id} associated to micr #{check.micr_line_information.id}\"\n @job.save_payer_group(micr)\n end\n end\n end\n end\n end\n end",
"def collect\n base_finder = @base_class.includes(@dependency_tree)\n # If there are dependencies to load, we reduce the the batch size to compensate for\n # the increased memory of loading all the associations at the same time.\n batch_size = @dependency_tree.blank? ? DEFAULT_BATCH_SIZE : DEFAULT_BATCH_SIZE / 10\n enumerable = Enumerator.new do |yielder|\n @ids.each_slice(batch_size).with_index do |batch_of_ids, batch_index|\n with_sql_subscription do\n base_finder.where(@base_class.primary_key => batch_of_ids).load\n end\n # Expose this batch of SELECTs to the enumerator\n yielder.yield(@selects)\n # Reset the accumulator for the next batch (don't hog memory!)\n @selects.clear\n end\n end\n # By using a lazy enumerator, we make it possible to garbage collect records\n # as we process a batch, so long as the end user accesses the data via #each\n # and does not maintain references to previous rows. Example:\n # Polo.explore(klass, ids, associations).each { |row| file.puts(row) }\n enumerable.to_enum.lazy\n end",
"def record_all\n puts \"****************** in record_all match, params: #{params}\"\n params.each do |match_params| \n record_results match_params\n end\n end",
"def store_data(params={}, options={})\n # Some can tell me that this method made two identical queries one for count one for paginate.\n # We don't use the select count because in some circumstances require much time than select *.\n params[:limit] ||= 50\n json = params.has_key?(:json) ? params.delete(:json) : true\n collection = @model.ext_search(params, options)\n result = { :results => store_data_from(collection.records), :count => collection.count }\n json ? result.to_json : result\n end",
"def build\n records = []\n date = start_date\n while date <= end_date\n record = {}\n record[:date] = date.strftime(\"%Y-%m-%d\")\n record[:month] = Date::MONTHNAMES[date.month].downcase\n record[:day_of_week] = Date::DAYNAMES[date.wday].downcase\n record[:day_of_week_as_number] = date.wday\n record[:year] = date.year.to_s\n record[:year_and_month] = record[:year] + \"-\" + date.month.to_s.rjust(2,'0')\n record[:sql_date_stamp] = date\n record[:week] = \"week #{date.to_date.cweek}\"\n # compute quarter ourselves - available in Time but not in Date - anything better ?\n quarter = 1 + (date.month-1) / 3\n record[:quarter] = \"Q#{quarter}\"\n record[:semester] = \"S#{(quarter+1)/2}\"\n records << record\n date = date.next\n end\n records\n end",
"def get_list_of_records(klass, options = {}, &block)\n items = klass.name.tableize\n self.current_page = options[:page] if options[:page]\n query = options[:query] if options[:query]\n category = options[:category] if options[:category]\n pagination = options[:pagination].nil? ? true : options[:pagination] \n date = options[:date] if options[:date]\n #date_range = options[:date_range] if options[:date_range]\n start_date = options[:start_date] if options[:start_date]\n end_date = options[:end_date] if options[:end_date]\n sort_fields = options[:sort] if options[:sort]\n sort_dir = options[:dir] || \"ASC\"\n per_page = options[:per_page] if options[:per_page]\n\n #self.current_query = options\n records = {\n :user => @current_user #,\n # :order => @current_user.pref[:\"#{items}_sort_by\"] || klass.sort_by\n }\n\n # Use default processing if no hooks are present. Note that comma-delimited\n # export includes deleted records, and the pagination is enabled only for\n # plain HTTP, Ajax and XML API requests.\n wants = request.format\n filter = session[options[:filter]].to_s.split(',') if options[:filter]\n scope = klass.scoped\n scope = scope.category(category) if category.present?\n scope = scope.state(filter) if filter.present?\n scope = scope.search(query) if query.present?\n scope = scope.at_date(date) if date.present?\n #scope = scope.between_dates(date_range) if date_range.present?\n scope = scope.between_dates(start_date, end_date) if (start_date.present? && end_date.present?)\n\n if sort_fields.present?\n words = sort_fields.split(\".\")\n if words.length > 1\n table = words.shift.tableize # popup first item\n field = words.join(\".\")\n sort_fields2 = \"#{table}.#{field}\" \n else\n sort_fields2 = \"#{items}.#{words.first}\"\n end\n scope = scope.order_by(sort_fields2, sort_dir)\n end\n\n scope = yield scope if block_given?\n scope = scope.unscoped if wants.csv?\n scope = scope.page(current_page).per(per_page)\n scope\n end",
"def build_report\n klass = model_class.constantize\n @cols = klass.columns.map { |c| c.name.to_sym }\n @assocs = klass.reflect_on_all_associations\n\n through = @assocs.each_with_object({}) { |x, hsh| hsh[x.options[:through]] = 1 }\n # through={} ; @assocs.each { |x| through[x.options[:through]] = 1 }\n @assocs = @assocs.select { |x| !through[x.name] }\n @tire_saved = klass.tire.mapping.keys\n end",
"def get_call_records(type=:standard, interval=:current, subset=:international)\n if subset == :international\n # Prefix the NPAs with \"1\" optionally (we're using regexp on the terms).\n search_list = VAUtil.config['intl_npa_list'].map { |m| \"1?\" << m }\n # for internationl do a search for anything prefixed 011\n search_list << \"011\"\n thresholds = VAUtil.config['threshold']\n if (interval == :past)\n data_range = \"1:05\" # hours and minutes\n end_interval = \"5\"\n else\n data_range = 1 # In hours\n end\n else\n search_list = VAUtil.config['dom_npa_list'].map { |m| \"1?\" << m }\n thresholds = VAUtil.config['dom_threshold']\n if (interval == :past)\n data_range = \"3:15\" # hours and minutes\n end_interval = \"15\"\n else\n data_range = 3 # In hours\n end\n end\n\n call_records = CallRecords.new(self, interval, thresholds)\n\n # Past or present?\n if (interval == :past)\n time_span = \"calldate > DATE_SUB(NOW(), INTERVAL '#{data_range}' HOUR_MINUTE) AND calldate <= DATE_SUB(NOW(), INTERVAL #{end_interval} MINUTE)\"\n else\n time_span = \"calldate > DATE_SUB(NOW(), INTERVAL '#{data_range}' HOUR)\"\n end\n \n # TODO: de-dup\n if (type == :fax)\n VAUtil.config['fax_dsn_list'].each do |fax|\n db_link = get_dblink(DBInfo.new(fax['host'], fax['user'], fax['pass'], fax['name']))\n\n search_list.each do |term|\n query = \"SELECT src, COUNT(src) FROM cdr WHERE dcontext LIKE '%faxout%' AND lastdata REGEXP '^SIP/9#{term}' AND #{time_span} GROUP BY src\"\n results = list_query(query, db_link)\n results.each do |r|\n src = r[0]\n count = r[1]\n\n # Get the branch of for this src. If that fails requery the gateway and find it with\n # call details.\n branch_id = get_branch_id_with_tn(src)\n if branch_id.nil?\n dst = run_select_query(\"SELECT dst FROM cdr WHERE dcontext LIKE '%faxout%' AND lastdata REGEXP '^SIP/9#{term}' AND #{time_span} AND src = '#{src}'\", db_link)\n branch_id = get_branch_id_with_call_example(fax['host'], src, dst)\n end\n # it's possible call example path will fail too, skip if necessary\n if !branch_id.nil?\n call_records.add(src, count, branch_id)\n end\n end\n end\n db_link.close\n end\n else\n VAUtil.config['agw_dsn_list'].each do |agw|\n db_link = get_dblink(DBInfo.new(agw['host'], agw['user'], agw['pass'], agw['name']))\n\n search_list.each do |term|\n query = \"SELECT src, COUNT(src), accountcode FROM cdr WHERE dst REGEXP '^#{term}' AND #{time_span} AND dcontext REGEXP '^sbc' GROUP BY src\"\n results = list_query(query, db_link)\n results.each do |r|\n src = r[0]\n count = r[1]\n fs = r[2]\n \n # Get the branch of for this src. If that fails requery the gateway and find it with\n # call details.\n branch_id = get_branch_id_with_tn(src)\n if branch_id.nil?\n dst = run_select_query(\"SELECT dst FROM cdr WHERE dst REGEXP '^#{term}' AND #{time_span} AND src = '#{src}' AND accountcode = '#{fs}'\", db_link)\n \n branch_id = get_branch_id_with_call_example(\"#{fs}.coredial.com\", src, dst)\n end \n # it's possible call example path will fail too, skip if necessary\n if !branch_id.nil?\n call_records.add(src, count, branch_id)\n end\n end\n end\n db_link.close\n end\n end\n call_records\n end",
"def parse_records(response, elements, paged_results, base_module, standalone_model = false)\n elements.each do | element |\n new_record = model_class.build_from_node(element, self, base_module, standalone_model)\n if element.attribute('status').try(:value) == 'ERROR'\n new_record.errors = []\n element.xpath('.//ValidationError').each do |err|\n new_record.errors << err.text.gsub(/^\\s+/, '').gsub(/\\s+$/, '')\n end\n end\n if standalone_model\n if response.response_items.count == 0\n response.response_items << new_record\n else\n # http://developer.xero.com/documentation/payroll-api/settings/\n # tracking categories have subcategories of timesheet categoires and employee groups\n # which we group together here as it's much easier to model\n fields_to_fill = model_class.fields.find_all do |f|\n new_record_field = new_record[f[0]]\n if new_record_field.respond_to?(:count)\n new_record_field.count > 0\n else\n !new_record_field.nil?\n end\n end\n fields_to_fill.each {|field| response.response_items.first[field[0]] = new_record[field[0]]}\n end\n else\n response.response_items << new_record\n end\n new_record.paged_record_downloaded = paged_results\n end\n response.response_items\n end",
"def records(_options = {})\n if defined?(_resource_klass.records)\n _resource_klass.records(_options)\n else\n _resource_klass._model_class.all\n end\n end",
"def all(options={})\n offset = nil\n results = []\n begin\n options.merge!(:limit => LIMIT_MAX, :offset => offset)\n response = records(options)\n results += response.records\n offset = response.offset\n end until offset.nil? || offset.empty? || results.empty?\n results\n end",
"def import\n records.each_slice(1000) do |slice|\n FieldContact.transaction do\n import_slice(slice)\n end\n end\n end",
"def addRecords(recs); recs.each { |r| addRecord r } end",
"def build_directories_records\n directories_records.each { |r| r.build }\n end",
"def populate_reports\n\t\tauthor_id \t\t= [*1..40].sample\n\t\tsummary \t\t= Faker::Lorem.sentences(3).join(' ')\n\t\treason \t\t\t= [*0..4].sample # enum\n\t\t\n\t\t# Report on other users\n\t\tusers = User.limit(5)\n\t\tusers.each do |u|\n\t\t\tu.reports_received.create!(author_id: author_id, reason: reason, summary: summary)\n\t\tend\n\n\t\t# Report on other services\n\t\tservices = Service.limit(5)\n\t\tservices.each do|s|\n\t\t\ts.reports_received.create!(author_id: author_id, reason: reason, summary: summary)\n\t\tend\n\tend",
"def add_batch\n result = RLetters::Solr::Connection.search(next_query)\n return false if result.num_hits == 0\n\n # Call the progress function\n @total ||= result.num_hits\n @progress.call((@start.to_f / @total.to_f * 100).to_i) if @progress\n\n # Import the dataset entries (quickly)\n ::Datasets::Entry.import([:uid, :dataset_id],\n result.documents.map do |d|\n [d.uid, @dataset_id]\n end,\n validate: false)\n\n # Check to see if there's any externally fetched documents here\n unless @dataset.fetch\n if result.documents.any? { |d| d.fulltext_url }\n @dataset.fetch = true\n @dataset.save\n end\n end\n\n # Tell the caller whether or not we should continue\n @start <= @total\n end",
"def limit_records(records)\n size = records.size\n\n if offset > size - 1\n []\n elsif (limit && limit != size) || offset > 0\n records[offset, limit || size] || []\n else\n records.dup\n end\n end",
"def multi_query_builder\n\n query = \"\n SELECT\n #{select_arr.join(\",\\n\\t\")}\n FROM \\t#{groups.first.parent_table}\n #{pk_join_arr.join(\"\\n\")}\n #{fk_join_arr.join(\"\\n\")};\"\n\n return query\n end",
"def each\n (0...record_count).each do |i|\n yield get_record(i)\n end\n end",
"def build_doctors\n\t\tdocs = self.doctors.last(5).to_a\n\t\t(5 - self.doctors.count).times do\n\t\t\tdocs << self.doctors.build\n\t\tend\n\t\tdocs\n\tend",
"def add_records(records)\n atoms = ActiveSupport::OrderedHash.new\n records_count = 0\n\n records.each do |record|\n next unless allow_indexing?(record)\n records_count += 1\n\n condensed_record = condense_record(record)\n atoms = add_occurences(condensed_record, record.id, atoms)\n end\n\n @storage.add(atoms, records_count)\n end",
"def <<(*records)\n load_target\n flatten_deeper(records).compact.each do |record|\n raise_on_type_mismatch(record)\n add_record_to_target_with_callbacks(record)\n end\n self\n end",
"def enhance_batch!(conn, record_batch)\n return record_batch if record_batch.nil? || record_batch.empty?\n\n copy_info = get_joined_table(\n conn, record_batch,\n :table_name => \"copy\",\n :column_map => settings['horizon.copy_map'],\n :join_clause => settings['horizon.copy_join_clause'],\n :public_only => (settings['horizon.public_only'].to_s == \"true\")\n ) if %w{all copies direct}.include? settings['horizon.include_holdings'].to_s\n\n\n\n item_info = get_joined_table(\n conn, record_batch,\n :table_name => \"item\",\n :column_map => settings['horizon.item_map'],\n :join_clause => settings['horizon.item_join_clause'],\n :public_only => (settings['horizon.public_only'].to_s == \"true\")\n ) if %w{all items direct}.include? settings['horizon.include_holdings'].to_s\n\n\n\n if item_info || copy_info\n record_batch.each do |record|\n id = record['001'].value.to_s\n record_copy_info = copy_info && copy_info[id]\n record_item_info = item_info && item_info[id]\n\n record_copy_info.each do |copy_row|\n field = MARC::DataField.new( settings[\"horizon.copy_tag\"] )\n copy_row.each_pair do |subfield, value|\n field.append MARC::Subfield.new(subfield, value)\n end\n record.append field\n end if record_copy_info\n\n record_item_info.each do |item_row|\n field = MARC::DataField.new( settings[\"horizon.item_tag\"] )\n item_row.each_pair do |subfield, value|\n field.append MARC::Subfield.new(subfield, value)\n end\n record.append field\n end if record_item_info && ((settings['horizon.include_holdings'].to_s != \"direct\") || record_copy_info.empty?)\n end\n end\n\n return record_batch\n end",
"def save_records\n return error_response unless is_save_records_request?\n if params[:changes]\n params[:changes].each_value do |changed|\n fields = changed.keys\n record = @record_class.find(changed[fields.delete('recid')])\n if record.present?\n fields.each do |field|\n table, column = get_table_and_column field\n obj = if table == @table_name\n record\n elsif record.respond_to?(table.to_sym)\n record.send(\"#{table}\")\n end\n obj.send(\"#{column}=\", changed[field]) if obj and obj.respond_to?(column.to_sym)\n end\n return error_response unless record.save\n end\n end\n end\n succes_response\n end",
"def seed_db\n @records.each do |row|\n $db.execute(\n \"INSERT INTO records\n (report_type, patient_name, service_from, service_thru, paid_date, hic_num, gross_reimb, cash_deduct, blood_deduct, coins, net_reimb)\n VALUES\n ('#{record.report_type}', '#{record.patient_name}', '#{record.service_from}', '#{record.service_thru}', '#{record.paid_date}', '#{record.hic_num}', '#{record.gross_reimb}', '#{record.cash}', '#{record.blood_deduct}', '#{record.coins}', '#{record.net_reimb}');\")\n end\n end",
"def record_sales_records(report_data_file)\n\n # In case there are no records for this processor\n return if @records.nil?\n\n @records.each do |source, source_list|\n puts \"Recording sales for #{source}\"\n\n source_list.each do |year, year_list|\n year_list.each do |month, month_list|\n month_list.each do |country, country_list|\n country_list.each do |project_id, list_prices|\n list_prices.each do |list_price, projects_list|\n projects_list.each do |kdp_transaction_type, kdp_transactions|\n kdp_transactions.each do |kdp_royalty_type, records|\n\n if (! defined? @monthly_sales) || (@monthly_sales.nil?)\n @monthly_sales = ReportDataMonthlySales.new\n end\n\n # These are all of records for the project\n records.each do |row|\n\n if ! @monthly_sales.nil? && @monthly_sales.is_valid.nil?\n @monthly_sales.is_valid = true\n @monthly_sales.report_data_file = report_data_file\n @monthly_sales.report_data_source = get_report_data_source_model(source)\n @monthly_sales.report_data_country = get_report_data_country_model(country) unless country.nil?\n @monthly_sales.year = year\n @monthly_sales.month = month\n @monthly_sales.project_id = project_id unless project_id == 0\n @monthly_sales.list_price = list_price || 0.0\n @monthly_sales.report_data_kdp_type = get_report_data_kdp_transaction_type_model(kdp_transaction_type, kdp_royalty_type)\n end\n\n ## Sum the totals here\n @monthly_sales.quantity += row.quantity unless row.quantity.nil?\n @monthly_sales.revenue += row.revenue_usd unless row.revenue_usd.nil?\n\n end\n # save the record after we've totaled everything up, then reset\n @monthly_sales.save\n @monthly_sales = nil\n\n end\n end\n end\n end\n end\n end\n end\n end\n # End of @records loop\n\n end",
"def <<(*records)\n save_records = proxy_owner.persisted?\n\n if records.flatten.all? &:valid?\n records.flatten.each do |record|\n unless include? record\n raise_if_type_mismatch(record)\n add_foreign_key_in_proxy_owner(record.id)\n proxy_target << record\n record.save if save_records\n end\n end\n\n proxy_owner.save if save_records\n\n self\n end\n end",
"def load_records\n native_instance(true)\n native_instance.top(limit) if limit.present?\n Array(service.native_instance.execute)\n end",
"def build_test_case_records(question, auto_grading, evaluation_results)\n build_test_case_records_from_test_results(question, auto_grading, evaluation_results)\n\n # Build failed test case records for test cases which were not found in any evaluation result.\n build_failed_test_case_records(question, auto_grading)\n end",
"def records(refresh = false)\n @config[:records] = nil if refresh\n @config[:records] ||= load_records\n end",
"def create_multiple_dns_records\n fail('method \"create_multiple_dns_records\" is not implemented')\n end",
"def generate_payer_bulk_data\n p \"There are no payer resources available to generate bulk data.\" if PAYERS.empty?\n\n PAYERS.each do |payer|\n NDOUTS.clear\n request = \"#{FHIR_SERVER}/fhir/InsurancePlan/#{payer[:id]}/$export\"\n output_directory = File.join(\"bulk_export\", payer[:id])\n FileUtils.mkdir_p(output_directory)\n related_formularies_id = []\n payer[:coverage].each do |coverage|\n formulary = coverage[:extension].find { |ext| ext[:url] == \"http://hl7.org/fhir/us/davinci-drug-formulary/StructureDefinition/usdf-FormularyReference-extension\" }\n unless formulary.nil?\n related_formularies_id << formulary[:valueReference][:reference].split(\"/\").last\n end\n end\n\n related_formularies = FORMULARIES.find_all { |formulary| related_formularies_id.include?(formulary[:id]) }\n related_formularies.prepend(payer)\n generate_ndjson(\"InsurancePlan\", related_formularies, output_directory)\n\n related_formularies_id.each { |id| get_related_basic_and_medicationknowledge(id, output_directory) }\n location_ids = extract_location_id_from_reference(payer[:coverageArea])\n get_related_locations(location_ids, output_directory)\n generate_export_json(output_directory, request, NDOUTS)\n end\nend",
"def associated_records(ids)\n max_ids_in_a_list = connection.ids_in_list_limit || ids.size\n records = []\n ids.each_slice(max_ids_in_a_list) do |some_ids|\n records += yield(some_ids)\n end\n records\n end",
"def query(recordings)\n @num += 1 if @num.zero?\n recordings.select! { |r| r[:user] == @user } unless @everyone\n limit = @all ? recordings.length : [@num, recordings.length].min\n recordings.reverse! unless @inorder\n recordings.take(limit)\n end",
"def batch_edit\n @records = record_class.all\n end",
"def record_all\n proc do |on|\n record_block\n record_callback(on, *on.callbacks)\n end\n end",
"def run_multiple(um)\n #debugger\n initial_data = []\n column_names = um[0].get_column_names\n num_rows = um.length\n\n c = 0\n 0.upto(num_rows - 1) do\n o = OpenStruct.new\n class << o\n attr_accessor :id\n end\n \n #turn the outgoing object into a VO if neccessary\n map = VoUtil.get_vo_definition_from_active_record(um[0].class.to_s)\n if map != nil\n o._explicitType = map[:outgoing]\n end\n \n #first write the primary \"attributes\" on this AR object\n column_names.each_with_index do |v,k|\n k = column_names[k]\n val = um[c].send(:\"#{k}\")\n eval(\"o.#{k}=val\")\n end\n\n \n associations = um[0].get_associates\n if(!associations.empty?)\n #now write the associated models with this AR\n associations.each do |associate|\n na = associate[1, associate.length]\n ar = um[c].send(:\"#{na}\")\n #if !ar.empty? && !ar.nil?\n\t #debugger \n\n\t ok = false;\n if (ar.instance_of? Array)\n if (!ar.empty? && !ar.nil?)\n ok=true;\n end\n else\n\t \tisArray = true\n\t end\n\n if (isArray && !ar.nil?) || ok\n\n\t if(use_single?(ar))\n initial_data_2 = run_single(ar) #recurse into single AR method for same data structure\n else\n initial_data_2 = run_multiple(ar) #recurse into multiple AR method for same data structure\n end\n eval(\"o.#{na}=initial_data_2\")\n end\n end\n end\n\n c += 1\n initial_data << o\n end\n initial_data\n end",
"def save_records\n @new_batch_flag = 0\n (@parser == 'wellsfargo' && type == \"CORRESP\") ? prepare_wellfargo_corresp_batch : prepare_batch\n if @bat\n if @inbound_file_information\n @bat.inbound_file_information = @inbound_file_information\n @bat.arrival_time = arr_time = @inbound_file_information.arrival_time\n set_batch_time @bat, arr_time\n end\n @job_condition = job_condition\n if @job_condition\n @img_count = 1\n do_bank_logics if type == 'PAYMENT' #Applying bank specific logic\n end\n images = call_parser_specific_method \"prepare_image\"\n images.each{|image| @bat.images_for_jobs << image}\n\n prepare_job\n @bat.jobs << @job if @job_condition\n images.each{|image| @job.images_for_jobs << image}\n @job.initial_image_name = @initial_image_name\n if @job_condition\n check = prepare_cheque\n if type == 'PAYMENT'\n micr = prepare_micr\n if micr\n payer = micr.payer\n check.payer_id = micr.payer_id if micr.payer_id\n if !facility.payer_ids_to_exclude.blank?\n @job.job_status = JobStatus::EXCLUDED if payer && payer.excluded?(facility)\n elsif !facility.payer_ids_to_include.blank?\n @job.job_status = JobStatus::EXCLUDED if !facility.included_payers.include?(payer)\n end\n micr.check_informations << check\n end\n end\n @job.check_informations << check\n end\n end\n\n if @bat.save\n @bat.update_attributes(:status => BatchStatus::NEW)\n if @job.save\n images.each do |image|\n# if image.save\n if image.image_file_name.upcase == @check_image.to_s.upcase\n save_image_types(\"CHK\",image)\n elsif ((image.image_file_name.upcase == @envelop_image.to_s.upcase) and (@job.job_status != JobStatus::EXCLUDED))\n save_image_types(\"ENV\",image)\n elsif ((@job.job_status == JobStatus::EXCLUDED) and (image.image_file_name.upcase != @check_image.to_s.upcase))\n save_image_types(\"OTH\",image)\n end\n total_number_of_images = number_of_pages(@job)\n check_number = check.check_number if !check.blank?\n estimated_eob = @job.estimated_no_of_eobs(total_number_of_images, micr, check_number)\n @job.update_attributes(:estimated_eob => estimated_eob, :pages_to => total_number_of_images)\n \n InputBatch::Log.status_log.info \"Image #{image.image_file_name}\n id #{image.id} batch id #{image.batch.id} job id #{image.jobs.first.id}\n successfully loaded\"\n puts \"Image #{image.image_file_name} successfully loaded\" if !image.size.blank?\n# else\n# raise \"Error on line #{@row_index} : Cannot load image #{image.image_file_name}\"\n# end\n end\n if @job_condition and check.save\n InputBatch::Log.status_log.info \"Check id #{check.id}, check_number\n #{check.check_number}, Job id #{check.job.id}, batch id #{check.job.batch.id}\n successfully loaded\"\n if micr and micr.save\n InputBatch::Log.status_log.info \"Check #{check.id} associated to micr\n #{check.micr_line_information.id}\"\n @job.save_payer_group(micr)\n end\n\n end\n else\n raise \"Error on line #{@row_index} : Cannot save job for batch #{@bat.batchid}\"\n end\n else\n raise \"Error on line #{@row_index} : Cannot save batch\"\n end\n \"#{@bat.date.strftime(\"%Y%m%d\")}_#{@bat.batchid}_SUPPLEMENTAL_OUTPUT\" rescue nil\n end",
"def upload_records(&block)\n count = input.upload_records(&block)\n self.record_count = (record_count || 0) + count\n count\n end",
"def <<(*records)\n flatten_deeper(records).each do |record|\n raise_on_type_mismatch(record)\n insert_record(record)\n @collection << record if loaded?\n end\n self\n end",
"def generate_results\n Result.destroy_all\n\n puts 'Generating results'\n\n (MULTIPLIER * 3).times do\n user_id = User.all.sample.id\n question_id = Question.all.sample.id\n result = ['true', 'false'].sample\n Result.create(user_id: user_id, question_id: question_id, result: result)\n end\nend",
"def records_for_bulk_index(ids, batch_size = 1000)\n transaction do\n offset = 0\n ids.each_slice(batch_size) do |id_slice|\n records = find( :all, :conditions => [\"id in (?)\", id_slice] )\n #yield records, offset\n yield find( :all, :conditions => [\"id in (?)\", id_slice] ), offset\n offset += batch_size\n end\n end\n end",
"def next_batch\n summoner = Summoner.by_name(params[:name])\n matches = $redis.get(\"#{summoner.id}#{params[:limit]}\")\n\n unless matches\n matches = Match.get(\n summoner,\n params[:offset].to_i,\n params[:limit].to_i\n ).to_json\n $redis.set(\"#{summoner.id}#{params[:limit]}\", matches)\n end\n @matches = JSON.parse matches\n\n data_ids = get_ids\n @champions = Champion.in_match(data_ids[:champions])\n @spells = Spell.in_match(data_ids[:spells])\n @items = Item.in_match(data_ids[:items])\n\n render :index\n end",
"def records(scope)\n scope = policy_scope(scope)\n @q = scope.ransack(ransack_params)\n # Reserved to use grouping search conditions\n # @q.build_grouping unless @q.groupings.any?\n @q.sorts = default_sort if @q.sorts.empty?\n @q.result\n .includes(records_includes)\n .page(params[:page])\n end",
"def initialize\n @records = []\n end",
"def create_gmail_records\n dme.create_mx_record(params[:domain], '', '1', 'aspmx.l.google.com.', {} )\n dme.create_mx_record(params[:domain], '', '5', 'alt1.aspmx.l.google.com.', {} )\n dme.create_mx_record(params[:domain], '', '5', 'alt2.aspmx.l.google.com.', {} )\n dme.create_mx_record(params[:domain], '', '10', 'aspmx2.l.google.com.', {} )\n dme.create_mx_record(params[:domain], '', '10', 'aspmx3.l.google.com.', {} )\n\n dme.create_record(params[:domain], 'calendar', 'CNAME', 'ghs.google.com.', {})\n dme.create_record(params[:domain], 'docs', 'CNAME', 'ghs.google.com.', {})\n dme.create_record(params[:domain], 'mail', 'CNAME', 'ghs.google.com.', {})\n dme.create_record(params[:domain], 'start', 'CNAME', 'ghs.google.com.', {})\n end",
"def concat(*records)\n records = records.flatten\n if owner.new_record?\n skip_strict_loading { load_target }\n concat_records(records)\n else\n transaction { concat_records(records) }\n end\n end",
"def process_queued_pubmed_records\n return if @records_queued_for_pubmed_retrieval.empty?\n begin\n pubmed_source_record = PubmedSourceRecord.new\n pub_med_records = @pubmed_client.fetch_records_for_pmid_list(@records_queued_for_pubmed_retrieval.keys)\n Nokogiri::XML(pub_med_records).xpath('//PubmedArticle').each do |pub_doc|\n pmid = pub_doc.xpath('MedlineCitation/PMID').text\n pubmed_source_record = PubmedSourceRecord.create_pubmed_source_record(pmid, pub_doc)\n @total_new_pubmed_source_count += 1 if pubmed_source_record\n pub_hash = @records_queued_for_pubmed_retrieval[pmid][:sw_hash]\n author_ids = @records_queued_for_pubmed_retrieval[pmid][:authors]\n pub = create_new_harvested_pub(pub_hash[:sw_id], pmid)\n abstract = pubmed_source_record.extract_abstract_from_pubmed_record(pub_doc)\n mesh = pubmed_source_record.extract_mesh_headings_from_pubmed_record(pub_doc)\n\n pub_hash[:mesh_headings] = mesh unless mesh.blank?\n pub_hash[:abstract] = abstract unless abstract.blank?\n\n create_contribs_for_author_ids_and_pub(author_ids, pub)\n pub.pub_hash = pub_hash\n pub.sync_publication_hash_and_db\n pub.save\n end\n rescue => e\n NotificationManager.error(e, 'PubMed harvesting failed', self)\n end\n @records_queued_for_pubmed_retrieval.clear\n end",
"def build_new_record\n @record = record_class.new\n end",
"def build_new_record\n @record = record_class.new\n end",
"def records( quantity = 1 )\r\n selected_values = []\r\n quantity.times do\r\n selected_values.push( record )\r\n end\r\n selected_values\r\n end",
"def build values, options\n adapter_class.new(values, options).execute\n end",
"def new_records(options = {}, &block)\n new_records_for(@association, @form, options) do |fields_for_association|\n render_association_partial(fields_for_association, options)\n end\n end",
"def run_single(us)\n #debugger\n initial_data = []\n column_names = us.get_column_names\n num_rows = 1\n \n c = 0\n 0.upto(num_rows - 1) do\n o = OpenStruct.new\n class << o\n attr_accessor :id\n end\n\n #turn the outgoing object into a VO if neccessary\n map = VoUtil.get_vo_definition_from_active_record(us.class.to_s)\n if map != nil\n o._explicitType = map[:outgoing]\n end\n \n #first write the primary \"attributes\" on this AR object\n column_names.each_with_index do |v,k|\n k = column_names[k]\n val = us.send(:\"#{k}\")\n eval(\"o.#{k}=val\")\n end\n \n associations = us.get_associates\n if(!associations.empty?)\n #debugger\n #now write the associated models with this AR\n associations.each do |associate|\n na = associate[1, associate.length]\n ar = us.send(:\"#{na}\")\n\t\n ok = false;\n if (ar.instance_of? Array)\n if (!ar.empty? && !ar.nil?)\n ok=true;\n end\n else\n isArray = true\n end\n\n if (isArray && !ar.nil?) || ok \n\n\t if(use_single?(ar))\n initial_data_2 = run_single(ar) #recurse into single AR method for same data structure\n else\n initial_data_2 = run_multiple(ar) #recurse into multiple AR method for same data structure\n end\n eval(\"o.#{na}=initial_data_2\")\n end\n end\n end\n #\tdebugger\n # if us.single? # apparenty this is not needed since it seems to always return nil :)\n initial_data = o \n # else\n # initial_data << o\n # end\n c += 1\n end\n initial_data\n end",
"def create_data\n @entities_total.times do |i|\n @data << entity_class.new(i, self)\n end\n end",
"def records_for(model)\n storage_name = model.storage_name(name)\n case storage_name.to_sym\n when :domains, :domain, :data_mapper_dh_api_models_domains\n @records[storage_name] ||= DataMapper::DhApi::Adapter.domains\n when :dnses, :dns, :data_mapper_dh_api_models_dns\n @records[storage_name] ||= DataMapper::DhApi::Adapter.dnses\n when :users, :user, :data_mapper_dh_api_models_users\n @records[storage_name] ||= DataMapper::DhApi::Adapter.users\n when :users_pw, :user_pw, :data_mapper_dh_api_models_users_pw\n @records[storage_name] ||= DataMapper::DhApi::Adapter.users_pw\n else\n raise NotImplementedError, \"Storage (#{storage_name}) not implemented\"\n end\n\n @records[storage_name] ||= []\n end",
"def instantiate(records, klass, owner = self)\n records = splat(records)\n records.map do |record|\n klass.new(owner, record)\n end\n end",
"def batch_new\n end",
"def all\n all_records = Array.new(self.real_size)\n\n self.each_with_index { |record, index| all_records[index] = record }\n\n all_records\n end",
"def each(&block)\n if @rows\n # we've been memoized\n @rows.each(&block)\n \n elsif start_record\n # we represent a single page\n # do the fetching and iterate\n @rows = fetch_rows\n\n @rows.each(&block)\n else\n # we represent the whole set of possible records\n # fetch repeatedly, in pages\n page_number = 1\n records_per_page = 100\n \n loop {\n # create a scope for this page\n inner_scope = page(page_number, records_per_page)\n \n # fetch the records as an array\n records = inner_scope.to_a\n \n # pass them to the caller\n records.each(&block)\n \n # is this the last page?\n if records.size < records_per_page\n # was this the first page?\n if page_number == 1\n # this is the only page\n # memoize\n @rows = records\n end\n \n # regardless, we're done\n break\n end\n \n page_number += 1\n }\n \n end\n \n self\n end",
"def find_records(filters, opts = {})\n return super(filters, opts) unless should_query?(filters)\n return [] if filters.values.any?(&:nil?)\n\n # Apply scopes and load\n load_query_records(apply_scopes(filters, opts), opts)\n end",
"def <<(*records)\n result = true\n load_target if @owner.new_record?\n\n transaction do\n flatten_deeper(records).each do |record|\n raise_on_type_mismatch(record)\n add_record_to_target_with_callbacks(record) do |r|\n result &&= insert_record(record) unless @owner.new_record?\n end\n end\n end\n\n @owner.send(:cache_write, @reflection, self) if @reflection.options[:cached]\n\n result && self\n end",
"def new_records(klass, count, &block)\n assert_difference \"#{klass}.count\", count do\n yield\n end\n klass.order(:id => :desc).limit(count).to_a.reverse\n end"
] |
[
"0.6347587",
"0.6280318",
"0.6273725",
"0.61053175",
"0.6043005",
"0.60100335",
"0.6005123",
"0.58896416",
"0.58104354",
"0.56245124",
"0.5624205",
"0.5618063",
"0.5584915",
"0.5576702",
"0.5422031",
"0.5382576",
"0.5377016",
"0.5369153",
"0.5334501",
"0.5328362",
"0.5290196",
"0.5290139",
"0.52849877",
"0.5268425",
"0.52548707",
"0.5252491",
"0.5235799",
"0.5214078",
"0.5207731",
"0.5199834",
"0.5185003",
"0.51820064",
"0.5181621",
"0.5174932",
"0.5162283",
"0.515808",
"0.51566994",
"0.5147964",
"0.5140139",
"0.51098275",
"0.5108205",
"0.5103807",
"0.5093896",
"0.50863904",
"0.50827974",
"0.5063501",
"0.50577384",
"0.50476646",
"0.5041432",
"0.503156",
"0.50251234",
"0.50211865",
"0.5015634",
"0.5002504",
"0.49963218",
"0.49941272",
"0.4993196",
"0.4987895",
"0.4985343",
"0.4978656",
"0.49719864",
"0.49663663",
"0.49629286",
"0.49626568",
"0.49564946",
"0.49521357",
"0.4945407",
"0.49340162",
"0.49313465",
"0.49270108",
"0.49206492",
"0.49184075",
"0.4916406",
"0.4912826",
"0.49094737",
"0.49064913",
"0.49037975",
"0.49009264",
"0.4898183",
"0.4894406",
"0.4890324",
"0.48790625",
"0.4878875",
"0.48714432",
"0.48675683",
"0.4865994",
"0.4865994",
"0.48652202",
"0.48579252",
"0.48529327",
"0.48526576",
"0.48503023",
"0.48443344",
"0.48411566",
"0.48400438",
"0.48383003",
"0.48338082",
"0.4819174",
"0.48176187",
"0.4809928"
] |
0.7806644
|
0
|
Saves the records to the database by calling populate on the current database adapter.
|
def save_records
unless @records.empty?
@model_class.connection.populate(@model_class.quoted_table_name, columns_sql, rows_sql_arr, "#{@model_class.name} Populate")
@last_id_in_database = @records.last.id
@records.clear
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def records_for_populate(options = {})\n records_base(options)\n end",
"def save; record.save; end",
"def seed_db\n @records.each do |row|\n $db.execute(\n \"INSERT INTO records\n (report_type, patient_name, service_from, service_thru, paid_date, hic_num, gross_reimb, cash_deduct, blood_deduct, coins, net_reimb)\n VALUES\n ('#{record.report_type}', '#{record.patient_name}', '#{record.service_from}', '#{record.service_thru}', '#{record.paid_date}', '#{record.hic_num}', '#{record.gross_reimb}', '#{record.cash}', '#{record.blood_deduct}', '#{record.coins}', '#{record.net_reimb}');\")\n end\n end",
"def save\n values.save\n end",
"def save\n self.new_record ? self.create : self.update\n end",
"def save\n record = self\n @table.instance_eval { save(record) }\n end",
"def save\n if new_record?\n create\n else\n update\n end\n end",
"def save\n @@all.push(self)\n end",
"def save\n @@all << self\n end",
"def populate\n end",
"def save\n update({})\n end",
"def save_collection_places\n CollectionPlace.delete_all :conditions => [\"collection_id = ?\", self.id]\n inserts = (what.query[:places].values.map { |place_id| \"('#{self.id}','#{place_id}')\" }).join(\",\")\n CollectionPlace.connection.insert(\"insert into collection_places (collection_id, place_id) values #{inserts}\")\n end",
"def save\n Ribs.with_handle(self.database) do |h|\n if self.class.persistent?(self.model)\n h.update_obj(self.model)\n else\n h.insert_obj(self.model)\n self.class.persistent(self.model)\n end\n end\n self.model\n end",
"def save\n @@all << self\n end",
"def populate\n\n end",
"def save\n connection.save_table(self)\n end",
"def autosave_associated_records_for_students\n if association = association_instance_get(:students)\n if records = associated_records_to_validate_or_save(association, @new_record_before_save, false)\n if records.any?\n begin\n values = records.map do |record|\n \"(#{record.id},#{id})\"\n end.join(',')\n Student.connection.execute(%(INSERT INTO export_data_students (\"student_id\", \"export_data_id\") VALUES #{values}))\n rescue\n raise ActiveRecord::Rollback\n end\n end\n end\n association.send(:reset_scope) if association.respond_to?(:reset_scope)\n end\n end",
"def save\r\n # raise error if schema is not same between from and to.\r\n # so , create sql from record map\r\n #keys = get_schema.map{|v| v[0]}\r\n keys = @__stored_map__.keys\r\n sql = \"insert into #{self.class.table_name} (#{keys.join(',')}) values( \"\r\n\r\n keys.each_with_index do |key , index|\r\n v = @__stored_map__[key]\r\n sql << ',' if index != 0\r\n sql << (v.kind_of?(String) ? \"'#{v}'\" : v.to_s)\r\n end\r\n sql << \")\"\r\n puts sql if $DEBUG\r\n self.class.execute_sql(sql)\r\n end",
"def save\n @data.map(&:save)\n end",
"def save_record(record)\n record.save\n end",
"def save_record(record)\n record.save\n end",
"def save\n perform_save\n end",
"def save\n schema.save(self)\n self\n end",
"def populate_sugar(records, type)\n module_type = get_sugarcrm_module_type(type)\n case @action\n when 'initial_run'\n @logger.info(\"Creating new records for #{type} type\")\n records.each do |record|\n create_sugar_record(module_type, record, type)\n end\n when 'update'\n records.each do |record|\n record = convert_string_to_datetime(record)\n existing_record = find_sugarcrm_object(type, 'sf_id', record['sf_id'])\n existing_record = existing_record.first if existing_record.is_a?(Array)\n if existing_record\n #TODO Nil values are not handled properly by SugarCRM in update_attributes, so we must transform them into blank values\n #remove this loop and use the main one!!\n record.each do |key, val|\n record[key] = \"\" if val.nil?\n end\n @logger.info(\"Updating record for #{type} #{record['name']}\")\n existing_record.update_attributes!(record)\n else\n @logger.info(\"Creating new record for #{type} #{record['name']}\")\n create_sugar_record(module_type, record, type)\n end\n end\n end\n end",
"def save\n perform_mapping\n unless self.errors[:data].present?\n save_nested_models\n self.record.save\n end\n end",
"def save\n self.class.all << self\n end",
"def save\n self.class.all << self\n end",
"def save\n self.class.all << self\n end",
"def save\n self.class.all << self\n end",
"def save\n self.class.all << self\n end",
"def save\n self.class.all << self\n end",
"def save\n self.class.all << self\n end",
"def save\n return if ENV['RACK_ENV'] == 'test' || @name.nil?\n\n Database.execute(COLLECTION) do |db|\n unless db.exists?(\"name\" => @name)\n db.insert(\n \"name\" => @name,\n \"course\" => @course,\n \"yoe\" => @yoe,\n \"ignored\" => @ignored\n )\n end\n end\n end",
"def save \n @@all << self\n end",
"def record_to_persist\n record\n end",
"def save\n end",
"def save\n end",
"def save\n self.class.save(self)\n end",
"def save(options = {})\n options.assert_valid_keys\n if new_record? then create\n else update\n end\n @new_record = false\n true\n end",
"def save\n @@all << self\n end",
"def save\n @@all << self\n end",
"def save\n @@all << self\n end",
"def save\n @@all << self\n end",
"def save\n @@all << self\n end",
"def save\n @@all << self\n end",
"def save\n @@all << self\n end",
"def save\n @@all << self\n end",
"def save\n @@all << self\n end",
"def save\n end",
"def save\n if new_record?\n overwrite @api.post(\"/meetings/#{meeting.shortcode_url}/items.json\",\n 'content' => content)\n else\n overwrite @api.put(\"/items/#{shortcode_url}.json\", 'content' => content)\n end\n end",
"def save\n result = nil\n # iterate over each instance variable and insert create row to table\n\t\t\t\t obj = self.inst_strip_braces(self.object)\n self.instance_variables.each do |method|\n method = method.to_s.gsub(/@/,\"\")\n # Don't save objects with braces to database\n val = self.send(method.to_sym)\n # add rows excluding object, source_id and update_type\n unless self.method_name_reserved?(method) or val.nil?\n result = Rhom::RhomDbAdapter::insert_into_table(Rhom::TABLE_NAME,\n {\"source_id\"=>self.get_inst_source_id,\n \"object\"=>obj,\n \"attrib\"=>method,\n \"value\"=>val,\n \"update_type\"=>'create'})\n end\n end\n # Create a temporary query record to display in the list\n Rho::RhoConfig::sources[self.class.name.to_s]['attribs'].each do |attrib|\n result = Rhom::RhomDbAdapter::insert_into_table(Rhom::TABLE_NAME,\n {\"source_id\"=>self.get_inst_source_id,\n \"object\"=>obj,\n \"attrib\"=>attrib['attrib'],\n \"value\"=>self.send(attrib['attrib'].to_sym),\n \"update_type\"=>'query'})\n end\n result\n end",
"def save\n @@data_store.insert(self)\n self\n end",
"def save!\n @fields.save\n self\n end",
"def save\n create_or_update\n end",
"def save\n create_or_update\n end",
"def save\n create_or_update\n end",
"def persist\n prepare do\n unless updates.empty?\n collection.find(selector).update(updates)\n conflicts.each_pair do |key, value|\n collection.find(selector).update({ key => value })\n end\n end\n end\n end",
"def create\n upsert do\n # NOTE: create!() is not used because assign to @record to draw form.\n # Otherwise, @record would be in nil so failure at edgarj/_form rendering.\n #\n # NOTE2: valid? after create() calls validate_on_update. This is not\n # an expected behavior. So, new, valid?, then save.\n @record = model.new(permitted_params(:create))\n @record_saved = @record # copy for possible later use\n on_upsert\n #upsert_files\n raise ActiveRecord::RecordNotSaved if !@record.valid?\n @record.save\n\n # clear @record values for next data-entry\n @record = model.new\n end\n end",
"def save_and_apply\n self.save\n self.apply\n end",
"def store_record_to_database(action, attribute_names_to_update = [])\n row = row_for_record\n row.values = attributes_to_row_values_hash(attribute_names_to_update)\n row.save\n end",
"def save\r\n @@items.push self\r\n end",
"def save_records\n return error_response unless is_save_records_request?\n if params[:changes]\n params[:changes].each_value do |changed|\n fields = changed.keys\n record = @record_class.find(changed[fields.delete('recid')])\n if record.present?\n fields.each do |field|\n table, column = get_table_and_column field\n obj = if table == @table_name\n record\n elsif record.respond_to?(table.to_sym)\n record.send(\"#{table}\")\n end\n obj.send(\"#{column}=\", changed[field]) if obj and obj.respond_to?(column.to_sym)\n end\n return error_response unless record.save\n end\n end\n end\n succes_response\n end",
"def save\n response = []\n \n if self.ownership.blank?\n self.ownership = Solve360::Config.config.default_ownership\n end\n \n if new_record?\n response = self.class.request(:post, \"/#{self.class.resource_name}\", to_request)\n \n if !response[\"response\"][\"errors\"]\n self.id = response[\"response\"][\"item\"][\"id\"]\n end\n else\n response = self.class.request(:put, \"/#{self.class.resource_name}/#{id}\", to_request)\n end\n \n if response[\"response\"][\"errors\"]\n message = response[\"response\"][\"errors\"].map {|k,v| \"#{k}: #{v}\" }.join(\"\\n\")\n raise Solve360::SaveFailure, message\n else\n related_items.concat(related_items_to_add)\n\n response\n end\n\n end",
"def save\n SAVE\n end",
"def save( defer=false )\n save_logic( defer ) \n end",
"def save\n\t\ttransfer_content from: if rid.rid?\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tdb.update self, attributes, version\n\t\t\t\t\t\t\t\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tdb.create_record self, attributes: attributes, cache: false \n\t\t\t\t\t\t\t\t\t\t\t\t\t\tend\n\t\tActiveOrient::Base.store_rid self\n\tend",
"def batch_edit\n @records = record_class.all\n end",
"def save\n end",
"def save\n end",
"def save\n\t\treturn false unless self.modified? || self.new?\n\t\tif self.new?\n\t\t\tself.insert\n\t\telse\n\t\t\tself.update\n\t\tend\n\tend",
"def save\n # Insert OR Update object values into DB\n # DB.execute(\"INSERT INTO .....\")\n # @id = DB.last_insert_row_id # get the last id from the DB\n # OR\n # DB.execute(\"UPDATE .....\")\n end",
"def to_new_record!\n store_before_to_new_record_values\n reset_persistence_values\n @new_record = true\n end",
"def save!\n end",
"def save\n\n end",
"def _save(opts)\n pk = nil\n called_save = false\n called_cu = false\n around_save do\n called_save = true\n before_save\n\n if new?\n around_create do\n called_cu = true\n before_create\n pk = _insert\n @this = nil\n @new = false\n @modified = false\n pk ? _save_refresh : changed_columns.clear\n after_create\n true\n end\n raise_hook_failure(:around_create) unless called_cu\n else\n around_update do\n called_cu = true\n before_update\n columns = opts[:columns]\n if columns.nil?\n columns_updated = if opts[:changed]\n @values.reject{|k,v| !changed_columns.include?(k)}\n else\n _save_update_all_columns_hash\n end\n changed_columns.clear\n else # update only the specified columns\n columns = Array(columns)\n columns_updated = @values.reject{|k, v| !columns.include?(k)}\n changed_columns.reject!{|c| columns.include?(c)}\n end\n _update_columns(columns_updated)\n @this = nil\n @modified = false\n after_update\n true\n end\n raise_hook_failure(:around_update) unless called_cu\n end\n after_save\n true\n end\n raise_hook_failure(:around_save) unless called_save\n self\n end",
"def save\n response = []\n \n if self.ownership.blank?\n self.ownership = Solve360::Config.config.default_ownership\n end\n \n if new_record?\n response = self.class.request(:post, \"/#{self.class.resource_name}\", to_request)\n \n if !response[\"response\"][\"errors\"]\n self.id = response[\"response\"][\"item\"][\"id\"]\n end\n else\n response = self.class.request(:put, \"/#{self.class.resource_name}/#{id}\", to_request)\n end\n \n if response[\"response\"][\"errors\"]\n message = response[\"response\"][\"errors\"].map {|k,v| \"#{k}: #{v}\" }.join(\"\\n\")\n raise Solve360::SaveFailure, message\n else\n related_items.concat(related_items_to_add)\n self.related_items_to_add = []\n\n categories.concat(categories_to_add)\n self.categories_to_add = []\n\n response\n end\n\n end",
"def persist\n if current_file.new_record?\n file_set.save\n else\n current_file.save\n end\n end",
"def save\n\t\tend",
"def persist\n prepare do\n raise Errors::NoParent.new(document.class.name) unless parent\n if parent.new_record?\n parent.insert\n else\n collection.find(parent.atomic_selector).update(inserts)\n end\n end\n end",
"def activerecord_persist\n record.save(validate: false)\n end",
"def save\n r = self.class.put(\"/domains/#{@@parent_id}/records/#{self.id}\", :query => { \"record[name]\" => self.name,\n \"record[ttl]\" => self.ttl,\n \"record[content]\" => self.content,\n \"record[prio]\" => self.prio,\n \"record[type]\" => self.type })\n r[\"errors\"] and raise StandardError, r[\"errors\"][\"error\"].to_a.join(\", \")\n if r.code == 200\n self.class.find(self.id)\n else\n raise StandardError, 'Could not update the record'\n end\n end",
"def seed_data\n delete_existing_records = 'DELETE FROM campaigns'\n @connection.execute(delete_existing_records)\n \n campaigns_records.each do |record|\n sql = %{\n INSERT INTO \n campaigns(job_id, status, external_reference, ad_description)\n VALUES(#{record[0]}, '#{record[1]}', '#{record[2]}', '#{record[3]}')\n }\n\n @connection.execute(sql)\n end\n end",
"def save\n end",
"def save_many(collection)\n collection.each do |data|\n save(data)\n end\n end",
"def save\n CONNECTION.execute(\"UPDATE assignments SET name = '#{self.name}', description = '#{self.description}', github = '#{self.github}', partner_id = #{self.partner_id} WHERE id = #{self.id};\")\n \n return self\n end",
"def save!(additions = [])\n additions.each do |contact|\n @ab.addRecord(contact.person)\n end\n\n @ab.save\n end",
"def insert\n @companies = Company.all\n @placement_news = PlacementNews.all\n end",
"def save\n collections = [participants, people,\n contacts, events, instruments,\n response_sets,\n question_response_sets\n ].map { |c| current_for(c).compact }\n\n ActiveRecord::Base.transaction do\n collections.map { |c| save_collection(c) }.all?.tap do |ok|\n if ok\n logger.debug { \"Re-saving response sets\" }\n current_for(response_sets).select { |rs| rs }.each { |rs| rs.target.reload.save }\n logger.info { 'Merge saved' }\n else\n logger.fatal { 'Errors raised during save; rolling back' }\n raise ActiveRecord::Rollback\n end\n end\n end\n end",
"def save!(*columns)\n opts = columns.extract_options!\n return save_failure(:save) if before_save == false\n if @new\n return save_failure(:create) if before_create == false\n ds = model.dataset\n if ds.respond_to?(:insert_select) and h = ds.insert_select(@values)\n @values = h\n @this = nil\n else\n iid = ds.insert(@values)\n # if we have a regular primary key and it's not set in @values,\n # we assume it's the last inserted id\n if (pk = primary_key) && !(Array === pk) && !@values[pk]\n @values[pk] = iid\n end\n if pk\n @this = nil # remove memoized this dataset\n refresh\n end\n end\n @new = false\n after_create\n else\n return save_failure(:update) if before_update == false\n if columns.empty?\n vals = opts[:changed] ? @values.reject{|k,v| !@changed_columns.include?(k)} : @values\n this.update(vals)\n @changed_columns = []\n else # update only the specified columns\n this.update(@values.reject {|k, v| !columns.include?(k)})\n @changed_columns.reject! {|c| columns.include?(c)}\n end\n after_update\n end\n after_save\n self\n end",
"def save(options) \n table = options[\"table\"] \n attributes = []\n item_id = options[\"item_id\"]\n \n instance_variables.each do |i| \n attributes << i.to_s.delete(\"@\") \n end \n \n query_components_array = [] \n \n attributes.each do |a| \n value = self.send(a) \n \n if value.is_a?(Integer) \n query_components_array << \"#{a} = #{value}\" \n else \n query_components_array << \"#{a} = '#{value}'\" \n end \n end \n \n query_components_array.shift \n \n query_string = query_components_array.join(\", \")\n\n\n DATABASE.execute(\"UPDATE #{table} SET #{query_string} WHERE id = #{item_id}\")\n \n end",
"def save; end",
"def save; end",
"def save; end",
"def save; end",
"def save; end",
"def save; end",
"def save; end",
"def save; end",
"def save\n unless @added.empty? && @deleted.empty?\n # We cannot reuse the allocated space, since the data\n # that is copied would be destroyed.\n if polymorphic?\n offset = @database.allocate_polymorphic_join_elements(@size)\n else\n offset = @database.allocate_join_elements(@size)\n end\n pairs =\n @size.times.map do |index|\n rod_id = id_for(index)\n if rod_id.is_a?(Model)\n object = rod_id\n if object.new?\n if polymorphic?\n object.reference_updaters <<\n ReferenceUpdater.for_plural(self,index,@database)\n else\n object.reference_updaters <<\n ReferenceUpdater.for_plural(self,index,@database)\n end\n next\n else\n rod_id = object.rod_id\n end\n end\n [rod_id,index]\n end.compact\n if polymorphic?\n pairs.each do |rod_id,index|\n class_id = (rod_id == 0 ? 0 : class_for(index).name_hash)\n @database.set_polymorphic_join_element_id(offset,index,rod_id,class_id)\n end\n else\n pairs.each do |rod_id,index|\n @database.set_join_element_id(offset,index,rod_id)\n end\n end\n @offset = offset\n @added.clear\n @deleted.clear\n @map.clear\n @original_size = @size\n end\n @offset\n end",
"def insert_records(items)\n\t\titems.each do |item|\n\t\t\t#Titles, years, publishers, codecs, comments & covers tables.\n\t\t\talbum_title_id = insert_if_not_exists(TITLES_TABLE,\n\t\t\t\tTITLE_COLUMN, item[:album_title])\n\t\t\ttrack_title_id = insert_if_not_exists(TITLES_TABLE,\n\t\t\t\tTITLE_COLUMN, item[:track_title])\n\t\t\tyear_id = insert_if_not_exists(YEARS_TABLE,\n\t\t\t\tYEAR_COLUMN, item[:year])\n\t\t\tpublisher_id = insert_if_not_exists(PUBLISHERS_TABLE,\n\t\t\t\tPUBLISHER_COLUMN, item[:publisher])\n\t\t\tcodec_id = insert_if_not_exists(CODECS_TABLE,\n\t\t\t\tCODEC_COLUMN, item[:codec])\n\t\t\tcomment_id = insert_if_not_exists(COMMENTS_TABLE,\n\t\t\t\tCOMMENT_COLUMN, item[:comment])\n\t\t\tcover_id = insert_if_not_exists(COVERS_TABLE,\n\t\t\t\tCOVER_COLUMN, item[:cover])\n\n\t\t\t#Styles table.\n\t\t\tstyles = item[:style].split(\", \")\n\t\t\tstyle_ids = []\n\t\t\tstyles.each do |style|\n\t\t\t\tstyle_ids << insert_if_not_exists(STYLES_TABLE,\n\t\t\t\t\tSTYLE_COLUMN, style)\n\t\t\tend\n\n\t\t\t#Composers table.\n\t\t\tcomposers = item[:composer].split(\", \")\n\t\t\tcomposer_ids = []\n\t\t\tcomposers.each do |composer|\n\t\t\t\tcomposer_ids << insert_if_not_exists(COMPOSERS_TABLE,\n\t\t\t\t\tCOMPOSER_COLUMN, composer)\n\t\t\tend\n\n\t\t\t#Artists table.\n\t\t\t#Album_artist.\n\t\t\talbum_artists = item[:album_artist].split(\", \")\n\t\t\talbum_artist_ids = []\n\t\t\talbum_artists.each do |album_artist|\n\t\t\t\talbum_artist_ids << insert_if_not_exists(ARTISTS_TABLE,\n\t\t\t\t\tARTIST_COLUMN, album_artist)\n\t\t\tend\n\n\t\t\t#Track_artist.\n\t\t\tif item[:track_artist] == item[:album_artist]\n\t\t\t\ttrack_artist_ids = album_artist_ids\n\t\t\telse\n\t\t\t\ttrack_artists = item[:track_artist].split(\", \")\n\t\t\t\ttrack_artist_ids = []\n\t\t\t\ttrack_artists.each do |track_artist|\n\t\t\t\t\ttrack_artist_ids << insert_if_not_exists(ARTISTS_TABLE,\n\t\t\t\t\t\tARTIST_COLUMN, track_artist)\n\t\t\t\tend\n\t\t\tend\n\n\t\t\t#Albums table.\n\t\t\tcheck_columns = [TITLE_ID_COLUMN]\n\t\t\tcheck_items = [album_title_id]\n\t\t\tinsert_items = [album_title_id, year_id, publisher_id,\n\t\t\t\tcodec_id, comment_id, cover_id]\n\t\t\talbum_id = insert_if_not_exists(ALBUMS_TABLE, check_columns,\n\t\t\t\tcheck_items, insert_items)\n\n\t\t\t#Tracks table.\n\t\t\tcheck_columns = [TRACK_NUMBER_COLUMN, DISC_NUMBER_COLUMN,\n\t\t\t\tALBUM_ID_COLUMN]\n\t\t\tcheck_items = [item[:track_number], item[:disc_number], album_id]\n\t\t\tinsert_items = [track_title_id, item[:track_number],\n\t\t\t\titem[:disc_number], album_id]\n\t\t\ttrack_id = insert_if_not_exists(TRACKS_TABLE, check_columns,\n\t\t\t\tcheck_items, insert_items)\n\t\t\t#puts \"Album: #{album_id}\\tDisc: #{disc_id}\\tTrack: #{track_id}\"\n\n\t\t\t#Albums_Artists table.\n\t\t\tcheck_columns = [ALBUM_ID_COLUMN, ARTIST_ID_COLUMN]\n\t\t\talbum_artist_ids.each_with_index do |album_artist_id, i|\n\t\t\t\tcheck_items = [album_id, album_artist_id]\n\t\t\t\tinsert_items = [album_id, album_artist_id, i.to_s]\n\t\t\t\tinsert_if_not_exists(ALBUMS_ARTISTS_TABLE, check_columns,\n\t\t\t\t\tcheck_items, insert_items)\n\t\t\tend\n\n\t\t\t#Albums_Styles table.\n\t\t\tcheck_columns = [ALBUM_ID_COLUMN, STYLE_ID_COLUMN]\n\t\t\tstyle_ids.each_with_index do |style_id, i|\n\t\t\t\tcheck_items = [album_id, style_id]\n\t\t\t\tinsert_items = [album_id, style_id, i.to_s]\n\t\t\t\tinsert_if_not_exists(ALBUMS_STYLES_TABLE, check_columns,\n\t\t\t\t\tcheck_items, insert_items)\n\t\t\tend\n\n\t\t\t#Tracks_Artists table.\n\t\t\tcheck_columns = [TRACK_ID_COLUMN, ARTIST_ID_COLUMN]\n\t\t\ttrack_artist_ids.each_with_index do |track_artist_id, i|\n\t\t\t\tcheck_items = [track_id, track_artist_id]\n\t\t\t\tinsert_items = [track_id, track_artist_id, i.to_s]\n\t\t\t\tinsert_if_not_exists(TRACKS_ARTISTS_TABLE, check_columns,\n\t\t\t\t\tcheck_items, insert_items)\n\t\t\tend\n\n\t\t\t#Tracks_Composers table.\n\t\t\tcheck_columns = [TRACK_ID_COLUMN, COMPOSER_ID_COLUMN]\n\t\t\tcomposer_ids.each_with_index do |composer_id, i|\n\t\t\t\tcheck_items = [track_id, composer_id]\n\t\t\t\tinsert_items = [track_id, composer_id, i.to_s]\n\t\t\t\tinsert_if_not_exists(TRACKS_COMPOSERS_TABLE, check_columns,\n\t\t\t\t\tcheck_items, insert_items)\n\t\t\tend\n\t\tend\n\tend"
] |
[
"0.6028996",
"0.5786327",
"0.5729236",
"0.5583682",
"0.5581483",
"0.5580849",
"0.5558667",
"0.55084544",
"0.5504932",
"0.55004543",
"0.55002517",
"0.5483511",
"0.5482774",
"0.5481345",
"0.54726607",
"0.5472178",
"0.54720837",
"0.5460149",
"0.5454292",
"0.5440043",
"0.5440043",
"0.54284245",
"0.541073",
"0.54079986",
"0.5392765",
"0.5366847",
"0.5366847",
"0.5366847",
"0.5366847",
"0.5366847",
"0.5366847",
"0.5366847",
"0.53656596",
"0.53625125",
"0.5349768",
"0.5344518",
"0.5344518",
"0.5340085",
"0.5333673",
"0.53213876",
"0.53176004",
"0.53176004",
"0.53176004",
"0.53176004",
"0.53176004",
"0.53176004",
"0.53176004",
"0.53176004",
"0.5305136",
"0.52892953",
"0.5271942",
"0.5270738",
"0.52598166",
"0.52401614",
"0.52401614",
"0.52401614",
"0.5238297",
"0.52354646",
"0.52331305",
"0.5220252",
"0.5218466",
"0.5215953",
"0.5209739",
"0.52050424",
"0.5194961",
"0.51724476",
"0.51724124",
"0.51634526",
"0.51634526",
"0.5162877",
"0.5162785",
"0.51614016",
"0.51609355",
"0.5157003",
"0.51549476",
"0.5154655",
"0.5153158",
"0.5151549",
"0.51500237",
"0.51466423",
"0.51444983",
"0.51432985",
"0.51425755",
"0.5137456",
"0.51205516",
"0.5120549",
"0.5116926",
"0.51136386",
"0.51128346",
"0.51122755",
"0.51085496",
"0.51085496",
"0.51085496",
"0.51085496",
"0.51085496",
"0.51085496",
"0.51085496",
"0.51085496",
"0.51040006",
"0.5103433"
] |
0.73466486
|
0
|
Splat argument: When we don't know how many arguments there are about to be, arguments preceded by a .
|
def whats_up (greeting, *friends)
friends.each {|friend| puts "#{greeting}, #{friend}."}
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def __splat(x) end",
"def splat_mth(*mult_arg)\n p mult_arg #it's array :) !\n p mult_arg.class\n p mult_arg.object_id\n mult_arg.map {|arg| }\n end",
"def not_just_splat(x, *args, y)\n puts x\n puts y\n puts args.inspect\nend",
"def parse_splat_args\n unless self.empty?\n args = self#.flatten\n case args.size\n when 1\n return args.first # if there was only one arg passed, return just that, without the array\n when 0\n return nil # if no args were passed return nil\n else\n return args # else return the array back, cause chances are that's what they passed you!\n end\n end\n end",
"def varargs(arg1,*rest)\n puts \"Got #{arg1} and #{rest.join(',')}\"\nend",
"def method_with_splat_parameter(*names)\n end",
"def varargs(arg1, *rest)\n \"arg1=#{arg1}. rest=#{rest.inspect}\"\nend",
"def function(argument1, argument2, *splat)\n puts argument1\n puts argument2\n #Is there a better way to detect an empty splat argument?\n if splat == []\n puts \"empty splat!\"\n else\n #Iterate over a variable number of arguments.\n splat.each { |splat_n| puts splat_n }\n end\nend",
"def varargs(arg1, *rest)\n puts \"Got #{arg1} and #{rest.join(', ')}\"\nend",
"def method_with_splat_parameter2(*names)\n end",
"def split_apart(first, *splat, last)\n puts \"First: #{first}, splat: #{splat}, last: #{last}\"\nend",
"def my_args(first, *args, last)\n # Use the splat (i.e. *) in front of an \n # argument to take in any number of args\n # into an array (like gather in JS i.e. ...).\n # Unlike gather, it can be placed at the beginning,\n # the middle, or the end of a list of args\n puts(\"first: #{first}\")\n puts(\"args: #{args}\")\n puts(\"last: #{last}\")\nend",
"def roster_splat(*players)\n # Gets treated as an array\n puts players\nend",
"def split_apart(first, *splat, last)\n puts \"First: #{first.inspect}, splat: #{splat.inspect}, \" +\n \"last: #{last.inspect}\"\nend",
"def split_apart(first, *splat, last)\n puts \"First: #{first.inspect}, splat: #{splat.inspect}, \" +\n \"last: #{last.inspect}\"\nend",
"def has_splat_args?\n !!(args && @args[-1] && @args[-1][0][/^\\*/])\n end",
"def squeeze!(*rest) end",
"def args_unleashed(a, b=1, *c, d, e)\n puts \"Arguments:\"\n p a,b,c,d,e\nend",
"def my_args(first, *args, last)\n # Use the splat '*' in front of an argument to take any number of args into\n # an array, just like gather (i.e. '...') in JavaScript. Unlike gather,\n # it can be placed at the beginning, middle, or end of a list of arguments.\n puts \"first: #{first}\"\n puts \"args: #{args}\"\n puts \"last: #{last}\"\nend",
"def extract_argument_lists(args, splittable_args); end",
"def mixed_args(a,b,*c,d)\n puts \"\\nArguments:\"\n p a,b,c,d\nend",
"def process_arglist(exp)\n return '' if exp.empty?\n return process_array(exp)\n end",
"def splat(thing)\n (thing.is_a?(Array) ? thing : [thing]).compact\n end",
"def p(*rest) end",
"def xargs *args\r\n m = args.shift\r\n args.slice!(-1).each {|a|\r\n method(m).call(*(args + [a]))\r\n }\r\nend",
"def varargs(arg1, *args)\n # \"arg1=#{arg1}, args=#{args.inspect}\"\n \"arg1 = #{arg1}, arg2 = #{args}\"\nend",
"def hello(name1, *name2)\n puts \"name1: #{name1}\"\n puts \"name2: #{name2.to_a}\"\nend",
"def variadic_method(first, *args, last)\n p first\n args.each { |arg| puts arg }\n p last\nend",
"def test_parallel_assignments_with_splat_operator\n first_name, *last_name = [\"John\", \"Smith\", \"III\"]\n assert_equal \"John\", first_name\n assert_equal [\"Smith\",\"III\"], last_name\n end",
"def *(arg0)\n end",
"def *(arg0)\n end",
"def splat(*numeros)\n\tnumeros.max #devuelve el maximo de muchos parametros, los almacena en un arreglo\nend",
"def preprocess_args(*a)\n a\n end",
"def arglist\n expect :call, :attrasgn, :safe_call, :safe_attrasgn, :super, :zsuper\n\n case self.node_type\n when :call, :attrasgn, :safe_call, :safe_attrasgn\n self[3..-1].unshift :arglist\n when :super, :zsuper\n if self[1]\n self[1..-1].unshift :arglist\n else\n Sexp.new(:arglist)\n end\n end\n end",
"def arglists\n if @call_seq then\n @call_seq\n elsif @params then\n \"#{name}#{param_seq}\"\n end\n end",
"def arglists\n if @call_seq then\n @call_seq\n elsif @params then\n \"#{name}#{param_seq}\"\n end\n end",
"def squeeze(*rest) end",
"def concat(*args)\n args.flatten\nend",
"def how_many_args(*arg)\n arg.length\nend",
"def foo2(arg1, arg2, *other_arg) \n print arg1 \n print other_arg \n p other_arg[0]\nend",
"def echo_at_least_two( first_arg, *middle_args, last_arg)\r\n pp \"The first argument is #{first_arg}\"\r\n middle_args.each { |arg| pp \"A middle argument is #{arg}\" }\r\n pp \"The last argument is #{last_arg}\"\r\nend",
"def how_many_args *args\n args.length\nend",
"def get_arg_list\n return nil if node_type != :call\n\n sons.each do |son|\n if son.node_type == :arglist\n return son.sons.map {|arg| arg.name}.join(', ')\n end\n end\n\n return nil\n end",
"def params(*); {}; end",
"def method_name_with_different_number_of_arguments(*arguments)\n puts(arguments)\nend",
"def positional_args\n result = required_args + optional_args\n result << remaining_arg if remaining_arg\n result\n end",
"def how_many_args (*input)\n input.count\n end",
"def extra_args; end",
"def multipleArgs(*args)\n args.each do | argument |\n puts argument\n end\nend",
"def how_many_args(*args)\n\targs.length\nend",
"def how_many_args(*args)\n args.length\nend",
"def my_function(argument_a, argument_b, *args)\n puts argument_a\n puts argument_b\n p args.class.name # this is now an array\n puts args\nend",
"def other_arguments(method)\n\n\n\n # 219:7: ',' argument[method]\n match(:COMMA)\n argument(method)\n\n\n\n\n end",
"def args(*) end",
"def greet time, name, *foo\n puts \"Good #{time}, #{name}!\"\nend",
"def strip_arguments\n []\n end",
"def **(arg0)\n end",
"def **(arg0)\n end",
"def all_remaining_arguments\n out = @remaining_arguments\n @remaining_arguments = [ ]\n out\n end",
"def arguments(method)\n\n\n\n # 211:7: first_argument[method] ( other_arguments[method] )*\n first_argument(method)\n\n # 211:30: ( other_arguments[method] )*\n while true\n alt30 = 2\n # ()* loopback of 211:30: ( other_arguments[method] )*\n look_ahead30_0 = look_ahead(1)\n if look_ahead30_0 == :COMMA \n alt30 = 1\n end\n case alt30\n when 1\n # 211:32: other_arguments[method]\n other_arguments(method)\n\n else\n break\n end\n end\n\n\n\n end",
"def generic_method(a, b, c, *d)\n p [a, b, c]\n p d\nend",
"def a(b:, **c)\nend",
"def lambdacall_args(sexp)\n__args_index(car(sexp)) + lambdacall_index(cadr(sexp), [])\n end",
"def extract_extras(*args)\n args.extract_options!\n args.shift\n args\n end",
"def ld(arg0, arg1, *rest)\n end",
"def %(*args); end",
"def %(*args); end",
"def method(*p1)\n\nend",
"def tricky_method!(a_string_param, an_array_param)\n a_string_param << \", rutabega\"\n an_array_param << \"rutabega\"\nend",
"def inflamed _args\n \"inflamed _args;\" \n end",
"def process_arglist exp\n exp = exp.dup\n exp.shift\n exp.map! do |e|\n process e\n end\n\n exp.unshift :arglist\n end",
"def arguments(required, *optional)\n puts \"required: #{required}\"\n puts \"optional: #{optional}\"\nend",
"def slice_args(out)\n out.shape.map {:*}\n end",
"def variable_length( *args )\n return args\nend",
"def method(arg_1, arg_2, *other_args)\n p arg_1 # \"a\"\n p arg_2 # \"b\"\n p other_args # [\"c\", \"d\", \"e\"]\nend",
"def multiple(*nums)\n nums.inject(:*)\nend",
"def method3(a,b ,c, *d)\n p d\nend",
"def how_many_args *args\n args.count\nend",
"def arglist (sexp, level)\n code, work = '', []\n\n until sexp.empty?\n splat = sexp.first.first == :splat\n arg = process sexp.shift, :expression\n\n if splat\n if work.empty?\n if code.empty?\n code += (arg[0] == \"[\" ? arg : \"#{arg}#{mid_to_jsid :to_a}()\")\n else\n code += \".concat(#{arg})\"\n end\n else\n join = \"[#{work.join ', '}]\"\n code += (code.empty? ? join : \".concat(#{join})\")\n code += \".concat(#{arg})\"\n end\n\n work = []\n else\n work.push arg\n end\n end\n\n unless work.empty?\n join = work.join ', '\n code += (code.empty? ? join : \".concat([#{work}])\")\n end\n\n code\n end",
"def sample(*a)\n a\nend",
"def mt(*p)\n puts p \nend",
"def m(foo: 1, **opts)\n [foo, opts]\nend",
"def hello(v1, *v2)\n p v1\n p v2 \nend",
"def func *args\n puts \"Argument's length is #{args.length}\"\n for arg in args\n puts \"arg: #{arg}\"\n end\nend",
"def any_args(first_arg, *mid_args, last_arg)\n puts \"First Argument: #{first_arg}, Last Argument: #{last_arg}\"\n end",
"def f(x,*y)\nend",
"def my_method3(*arguments)\n print \"Arguments class is \", arguments.class, \"\\n\"\n print \"#{arguments.join(' ')}\", \"\\n\" \n end",
"def how_many_args *args\n args.length\n # accepts any number of arguments without complaint\n # returns the total number of arguments passed to the function\n # Hint: google ruby *args\nend",
"def to_dotted_args args\n args.map do |k,v|\n if v.is_a?(Hash)\n to_dotted_args(v).map do |s|\n [k,s].join(\".\")\n end\n else\n \"#{k}=#{v}\"\n end\n end.flatten\n end",
"def method_call_args(args_sexp)\n return [] if args_sexp[1].nil?\n args_sexp = args_sexp.last[1]\n args_sexp.map(&method(:parse_one))\n end",
"def tokenize_args(args)\n args\n end",
"def third_method(*my_args)\n puts \"I have benn passed #{my_args.length} arguments in #{my_args}\"\n for arg in my_args\n puts \"Argument: #{arg}\"\n end\nend",
"def good_recipes(arg1, *rest)\n \"The deserts will be #{arg1} and #{rest.join(', ')}\" # the string has embedded two variables, the second variable 'rest' is defined by the 'join' method, which is basicly saying, join the rest of the strings with a comma and a space\nend",
"def how_many_args(*args)\n args.count\nend",
"def method(*a)\r\n\ta\r\nend",
"def variable_length(first, second=:default, *rest)\n [first, second, rest]\nend",
"def two_or_more(a,b,*c)\n puts \"I require two or more arguments!\"\n puts \"And sure enough, I got: \"\n p a, b, c\nend",
"def imprimir_nome(idade, *nomes) #splat operator, transforma argumentos em array\n nomes.each{|n| puts n}\n puts \"Idade: #{idade}\"\nend",
"def method(arg_1, arg_2, *other_args)\n p arg_1 # \"a\"\n p arg_2 # \"b\"\n p other_args # []\nend",
"def method(arg1, arg2, *other_args)\n p arg1 # 'a'\n p arg2 # 'b'\n p other_args # []\nend",
"def q1 *rest\n puts \"The number of parameters is #{rest.length}.\"\n puts rest\nend"
] |
[
"0.8149754",
"0.75178397",
"0.72043073",
"0.7155663",
"0.70270354",
"0.6963802",
"0.6958345",
"0.6917654",
"0.68903",
"0.6846986",
"0.6783576",
"0.6749449",
"0.67411035",
"0.6726766",
"0.67259175",
"0.65101284",
"0.6490654",
"0.6470298",
"0.6468138",
"0.639402",
"0.6375808",
"0.63672894",
"0.63634276",
"0.6349845",
"0.63001716",
"0.6275888",
"0.6275756",
"0.6271674",
"0.62490267",
"0.62341774",
"0.62341774",
"0.62290484",
"0.62062687",
"0.6165113",
"0.6135556",
"0.6135556",
"0.6097655",
"0.6086033",
"0.6081929",
"0.60792035",
"0.6041676",
"0.6035433",
"0.60175973",
"0.6002667",
"0.59976214",
"0.5990308",
"0.59637326",
"0.5961165",
"0.59519655",
"0.594695",
"0.59363246",
"0.5932556",
"0.59199464",
"0.58987904",
"0.5893897",
"0.5881243",
"0.587034",
"0.587034",
"0.58322525",
"0.5827361",
"0.58202755",
"0.5814092",
"0.5811915",
"0.5809605",
"0.58075404",
"0.5793545",
"0.5793545",
"0.579242",
"0.5777397",
"0.57757974",
"0.57746774",
"0.5773873",
"0.5770294",
"0.57686996",
"0.5767995",
"0.57665265",
"0.5749564",
"0.5742169",
"0.5741096",
"0.57373714",
"0.57344925",
"0.572576",
"0.5713748",
"0.5710019",
"0.57089055",
"0.57037973",
"0.56940114",
"0.5691539",
"0.56899995",
"0.56866145",
"0.5680248",
"0.56771696",
"0.56738585",
"0.5672329",
"0.56682366",
"0.5665019",
"0.56604797",
"0.5648191",
"0.5618923",
"0.5618596",
"0.5608524"
] |
0.0
|
-1
|
Methods names can end with ? , !(this has dangerous side effects though)
|
def can_divide_by?(number)
return false if number.zero?
true
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def despined?(*)\n end",
"def hungry?\n# Method names can end with \"?\".\n# Usually, we do this only if the method\n# returns true or false, like this:\n@stuff_in_belly <= 2\nend",
"def bang_method?\n method_name.to_s.end_with?('!')\n end",
"def name_safe?; end",
"def respond_to_missing?(method_name, include_private = false)\n name = method_name.to_s\n\n return true if name.chomp!('?')\n name.chomp!('!') && self.class.valid?(name)\n end",
"def method_missing(method,*args)\n # if the method ends in ?, then strip it off and see if we\n # respond to the method without the ?\n if (call_method = method.to_s.chomp!(\"?\")) && respond_to?(call_method)\n return send(call_method).nil? ? false : true\n else\n super(method,*args)\n end\n end",
"def hungry?\n # => Method names can end with \"?\".\n # => Usually, we do this only if the methods\n # => returns true or false, like this:\n @stuff_in_belly <= 2\n end",
"def hungry?\n\n# Method names can end with \"?\".\n\n# Usually, we do this only if the method\n\n# returns true or false, like this:\n\n@stuff_in_belly <= 2\n\nend",
"def method_name; end",
"def method_name; end",
"def method_name; end",
"def method_name; end",
"def method_name; end",
"def method_name; end",
"def method_name; end",
"def method_name; end",
"def method_name; end",
"def method_name; end",
"def method_name; end",
"def method_name; end",
"def method_missing(method_name, *arguments)\n name = method_name.to_s\n\n if name.chomp!('?')\n self == name\n elsif name.chomp!('!')\n replace(name) unless self == name\n else\n super\n end\n end",
"def mah_method!(method_param)\nend",
"def method_missing(method, *args, &block)\n method.to_s =~ /^(\\w+)\\?$/ ? !!self[$1] : super\n end",
"def hungry?\n # Method names can end with \"?\".\n # Usually, we do this only if the method\n # returns true or false, like this:\n @stuff_in_belly <= 2\n end",
"def hungry?\n # Method names can end with \"?\"\n # Usually, we only do this if the method\n # returns true or false, like this:\n @stuffInBelly <= 2\n end",
"def hungry?\r\n # Method names can end with \"?\".\r\n # Usually, we do this only if the method\r\n # returns true or false, like this:\r\n @stuff_in_belly <= 2\r\n end",
"def no? ; true ; end",
"def hungry?\n # Method names can end with \"?\".\n # Usually, we only do this if the method\n # returns true or false, like this:\n @stuffInBelly <= 2\n end",
"def hungry?\n # Method names can end with \"?\".\n # Usually, we only do this if the method\n # returns true or false, like this:\n @stuffInBelly <= 2\n end",
"def hungry?\n # Method names can end with \"?\".\n # Usually, we only do this if the method\n # returns true or false, like this:\n @stuffInBelly <= 2\n end",
"def method_name?(key)\n key.is_a?(Symbol) && /^__(?<name>.+)__$/ =~ key ? name.to_sym : nil\n end",
"def _not_here_\n 'not here'\nend",
"def no? ; false ; end",
"def hungry?\n # Method names can end with \"?\".\n # Usually, we only do this if the method\n # returns true or false, like this:\n @stuff_in_belly <= 2\n end",
"def hungry?\n\t\t# Method names can end with \"?\".\n\t\t# Usually, we do this only if the method\n\t\t# returns true or false, like this:\n\t\t@stuff_in_belly <= 2\n end",
"def respond_to_missing?( id, priv = false ) id != :call; end",
"def tagMethod?()\r\n\t\tlang = language()\r\n\t\treturn (@type == \"m\" || @type==\"f\") if (lang == \"java\")\r\n\t\treturn (@type == \"f\") if (lang == \"cpp\")\r\n\tend",
"def sanitized_method_name\n @name.to_s.sub(/\\?$/,\"\")\n end",
"def predicate_method?\n method_name.to_s.end_with?('?')\n end",
"def method_undefined(*) end",
"def method_defined?(arg0)\n end",
"def hungry?\r\n # Method names can end with \"?\".\r\n # Usually, we do this only if the method\r\n # returns true or false, like this:\r\n @stuff_in_belly <= 2\r\n end",
"def public_method_defined?(arg0)\n end",
"def method_name\n\n end",
"def method_name\n\n end",
"def method_name\n\n end",
"def action_method?(name); end",
"def hungry?\n # Method names can end with \"?\".\n # Usually, we do this only if the method\n # returns true or false, like this:\n @stuff_in_belly <= 2\n end",
"def method_defined?(p0) end",
"def respond_to_missing?(_method_name, _include_private = T.unsafe(nil)); end",
"def method_name=(_arg0); end",
"def method_name=(_arg0); end",
"def method_missing m, *args\n unless m.to_s[-3..-1] == 'bac'\n super\n else\n nil\n end\n end",
"def hungry?\n # Method names can end with \"?\"\n # Usually, we do this only if the\n # returns true or false, like this:\n @stuff_in_belly <= 2\n end",
"def hungry? # End with a ? for true/false only methods.\r\n @stuff_in_belly <= 2\r\n end",
"def internal?; end",
"def unknown?; false; end",
"def unknown?; false; end",
"def sos_piedra?() raise NotImplementedError end",
"def hungry?\n # Method names can end with \"?\".\n # Usually, we only do this if the method\n # returns true or false, like this:\n @stuffInBelly <= 2\n end",
"def hungry?\n # Method names can end with \"?\".\n # Usually, we only do this if the method\n # returns true or false, like this:\n @stuffInBelly <= 2\n end",
"def hungry?\n # Method names can end with \"?\".\n # Usually, we only do this if the method\n # returns true or false, like this:\n @stuffInBelly <= 2\n end",
"def who_is_it?(name=\"Bob\")\n name\nend",
"def none?; end",
"def none?; end",
"def none?; end",
"def method_name\n end",
"def qwerty\n\t\tfalse\n\tend",
"def is?(*what); end",
"def is?(*what); end",
"def is?(*what); end",
"def define_iffer(name)\n define_method(:\"#{name}?\") do\n send(name).present?\n end\n end",
"def missing?; end",
"def respond_to_missing?(*)\n true\n end",
"def missed?; end",
"def respond_to_missing?(*)\n true\n end",
"def hungry?\n\t#method names can endwith \"?\" usually, we only do this if the method returns true or false like this:\n\n\t@stuffInBelly <= 2\nend",
"def clean_method_name(name)\n cleaned = name.to_s.gsub(\"?\", \"__Q\") # FIXME: Needs to do more.\n cleaned = cleaned.to_s.gsub(\"[]\", \"__NDX\")\n cleaned = cleaned.to_s.gsub(\"!\", \"__X\")\n return cleaned\n end",
"def method; end",
"def method; end",
"def method; end",
"def method; end",
"def method; end",
"def method; end",
"def method; end",
"def method; end",
"def method; end",
"def method; end",
"def method; end",
"def method; end",
"def optional; end",
"def private_method_defined?(arg0)\n end",
"def check_only_methods\n end",
"def private_call?()\n #This is a stub, used for indexing\n end",
"def protected_method_defined?(arg0)\n end",
"def method_one; end",
"def method_symbol; end",
"def argument?; end",
"def respond_to_missing?(method, include_private = T.unsafe(nil)); end",
"def ordinary?\n raise \"Not implemented yet\"\n end",
"def method_missing(sym, *args, &block)\n return has(sym.to_s.gsub(/\\?/, '')) if sym.to_s =~ /^[a-z_]*\\?$/\n super(sym, *args, &block)\n end"
] |
[
"0.7289983",
"0.6941463",
"0.68825996",
"0.68788123",
"0.6870282",
"0.67922676",
"0.6762275",
"0.67344606",
"0.6635433",
"0.6635433",
"0.6635433",
"0.6635433",
"0.6635433",
"0.6635433",
"0.6635433",
"0.6635433",
"0.6635433",
"0.6635433",
"0.6635433",
"0.6635433",
"0.66312814",
"0.65777826",
"0.65775687",
"0.6576911",
"0.65540445",
"0.6527597",
"0.65270525",
"0.65260273",
"0.65260273",
"0.65260273",
"0.6506602",
"0.64954764",
"0.64823025",
"0.64798784",
"0.64652723",
"0.6446376",
"0.6441624",
"0.6424089",
"0.6418026",
"0.63971806",
"0.63624084",
"0.63490564",
"0.6346023",
"0.6345301",
"0.6345301",
"0.6345301",
"0.63315004",
"0.63305247",
"0.6327417",
"0.6311772",
"0.63049597",
"0.63049597",
"0.6303994",
"0.62972254",
"0.6291465",
"0.62897646",
"0.62852657",
"0.62852657",
"0.62812644",
"0.62794286",
"0.62794286",
"0.62794286",
"0.62717474",
"0.6268386",
"0.6268386",
"0.6268386",
"0.6260185",
"0.62599015",
"0.6245509",
"0.6245509",
"0.6245509",
"0.62148094",
"0.6193054",
"0.61892134",
"0.618689",
"0.6184554",
"0.61730665",
"0.6171457",
"0.6161127",
"0.6161127",
"0.6161127",
"0.6161127",
"0.6161127",
"0.6161127",
"0.6161127",
"0.6161127",
"0.6161127",
"0.6161127",
"0.6161127",
"0.6161127",
"0.6159543",
"0.61511207",
"0.61353457",
"0.61347985",
"0.6131615",
"0.6123828",
"0.6117937",
"0.6115755",
"0.6111185",
"0.60863525",
"0.60831773"
] |
0.0
|
-1
|
Factorial Method!!!! and Methods can have default argumenents
|
def factorial(n)
n==0? 1 : n*factorial(n-1) #if n equals to 0 return 1 otherwise return n*....
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def factorial(n)\nend",
"def factorial\n (1..self).inject(:*)\n end",
"def factorial_with_default(n = 4)\n\tn == 0? 1: n * factorial_with_default(n - 1)\nend",
"def factorial(int)\n (1..self).reduce(:*) || 1\nend",
"def factorials_rec(num)\n \nend",
"def factorials_rec(num)\n \nend",
"def factorials_rec(num)\n\nend",
"def factorial n\n if n == 0\n return 1\n end\n return (1..n).inject(:*)\nend",
"def factorial (n)\n\tn ==0? 1: n*factorial(n-1)\n\nend",
"def factorial(n)\n binding.pry\n SwingFactorial.new(n).result\n end",
"def factorial(num)\n # Your code goes here\n (1..num).inject(1) { |a , b| a * b }\nend",
"def factorial\n\t\t(1..self).reduce(:*)\n\tend",
"def factorial(n)\n (1..n).inject(:*) || 1\nend",
"def factorial(number)\n puts \"NOT IMPLEMENTED\"\n return number\nend",
"def factorial(n)\n SwingFactorial.new(n).result\n end",
"def factorial (n)\n\tn == 0? 1 : n * factorial(n-1)\nend",
"def factorial (n)\n \t\tn == 0? 1 : n * factorial(n-1);\n\t\tend",
"def iterative_factorial(number)\n\nend",
"def iterative_factorial(number)\n\nend",
"def factorial(x)\n # (1..x).inject(:*) || 1\n (1..x).inject(:*)\nend",
"def factorial(num)\n(1..num).reduce(:*)\nend",
"def factorial(number)\n raise ArgumentError if number == nil\n return 1 if number == 0 || number == 1\n # raise NotImplementedError\n product = number #set the product, which will be returned, as number\n x = number #set another var as same value as number to start\n until x == 1\n product *= (x-1) #multiply the prduct by itself minues 1\n x -= 1 #subtract one from x\n end\n return product\nend",
"def factorial\n yield\n end",
"def factorial(n, ans = 1)\n n <= 1 ? ans : factorial(n - 1, n * ans)\nend",
"def factorial(a)\n (1..a).inject(:*)||1\nend",
"def factorial(num)\n if num == 0\n 1\n else\n num * factorial(num - 1)\n end\nend",
"def factorial(number)\n (1..number).inject(:*) || 1\nend",
"def factorial(num)\n num == 1 ? num * 1 : num * factorial(num - 1)\nend",
"def factorial(n)\n # raise NotImplementedError, \"Method not implemented\"\n return 1 if n == 0\n raise ArgumentError if n < 0\n return n * factorial(n - 1)\nend",
"def factorial_n(num)\n result = 1\n num.times { |i| result *= i + 1 }\n result\nend",
"def factorial(n)\n if n == 0\n \t1\n else\n (1..n).inject {|product, n| product * n }\n end\nend",
"def factorial(number)\n if number <= 1\n 1\n else\n (1..number).each.reduce(:*)\n end\nend",
"def factorial(num)\n if num <= 1\n 1\n else\n num * factorial(num-1)\n end\nend",
"def factorial (n)\r\n\tn==0? 1: n * factorial(n-1)\r\nend",
"def factorial(factor)\n return 1 if factor == 1\n factor*factorial(factor-1)\nend",
"def factorial(n)\n if n != 0\n return n *= factorial(n-1)\nelse\n return 1\nend\nend",
"def recursive_factorial(number)\n\nend",
"def recursive_factorial(number)\n\nend",
"def factorial(num)\n if num == 1\n 1\n else\n num * factorial(num - 1)\n end\nend",
"def factorial(number)\n if number <= 1\n 1\n else\n number.downto(1).reduce(:*)\n end\nend",
"def factorial(n)\n\tn == 0 ? 1 : n * factorial(n - 1)\nend",
"def factorial(n)\n (1..n).reduce(:*) || 1\nend",
"def factorial(n)\n (1..n).reduce(:*) || 1\nend",
"def factorial(number)\n if number == 0 #(limit)\n 1\n else\n number * factorial(number-1) #first number * number - 1 but the factorial calls the same method on the number - 1\n end\nend",
"def factorial(n)\n return nil if n < 0\n n == 0 ? 1 : n*factorial(n-1)\nend",
"def factorial(n)\n if n <= 0\n 1\n else\n n * factorial(n - 1)\n end\nend",
"def factorial(n)\n (1..n).inject(:*)\nend",
"def factorial(n)\n if n == 0\n 1\n else\n n * factorial(n-1)\n end\nend",
"def factorial(n)\r\n return 1 if n <= 1\r\n return n*factorial(n-1)\r\nend",
"def factorial(n)\n\n raise ArgumentError unless n >= 0 \n return 1 if n == 1 || n == 0\n\n n * factorial(n - 1)\n\nend",
"def factorial(n)\n if n == 0 || n == 1 \n \treturn 1\n else\n numbers = []\n n.downto(1) { |x| numbers << x }\n numbers.inject(1) { |x,y| x * y }\n end\nend",
"def factorial(n)\n (1..n).inject(:*)\nend",
"def factorial(n)\n raise ArgumentError if n < 0\n \n return 1 if n == 0\n return n * factorial(n-1)\nend",
"def factorial(n)\n raise ArgumentError, 'Must provide a number greater than 1' unless n >= 0\n\n if n == 1 || n == 0\n return 1\n else\n return n * factorial(n - 1)\n end \n \nend",
"def factorial(num)\n\t(1..num).reduce(1,:*) \nend",
"def factorial(n)\n if n == 1\n return 1\n end\n \n return factorial(n-1)*n\n\n\nend",
"def factorial(num)\n (1..num).inject(1) {|a, b| a * b}\nend",
"def factorial(n)\n\tn == 0? 1: n * factorial(n - 1)\nend",
"def factorial(n)\r\n\tif n < 0\r\n\t\tnil\r\n\tend\r\n\r\n\tresult = 1\r\n\twhile n > 0\r\n\t\tresult = result * n\r\n\r\n\t\tn -= 1\r\n\tend\r\n\tresult\r\n\r\n\r\nend",
"def short_factorial(n)\r\n n <= 1 ? 1 : n * short_factorial(n - 1)\r\nend",
"def factorial(n) \r\n \r\n answer = 1\r\n \r\n for i in 2..n do\r\n answer *= i\r\n end\r\n\r\n return answer\r\n\r\nend",
"def factorial(n)\n if n <= 1\n 1\n else\n n * factorial(n - 1)\n end\nend",
"def factorial(n)\n if n <= 1\n 1\n else\n n * factorial(n - 1)\n end\nend",
"def factorial(number)\n number.downto(1).reduce(:*)\nend",
"def factorial(num)\n puts (1..(num.zero? ? 1 : num)).inject(:*)\nend",
"def factorial(n)\n n == 1 ? 1 : n * factorial(n - 1)\nend",
"def factorial(n)\n raise NotImplementedError, \"Method not implemented\"\nend",
"def factorial(n)\n if n == 1 || n == 0\n 1\n else\n n * factorial(n-1)\n end\nend",
"def factorial_iterative(n)\n #Creacion de la variable inicial\n f = 1\n #hacer un para recorrer los numeros desde el 1 hasta el numero dado\n for i in 1..n\n #Cada vez que entre cambiara el valor y lo multiplicara por el siguiente\n f *= i\n end\n #regresar el valor de f\n f\nend",
"def factorial(n)\r\n ret = 1\r\n for i in 1..n \r\n ret *= i\r\n end\r\n return ret\r\nend",
"def factorial(n)\n if n<=1\n return 1\n else\n return factorial(n-1)*n\n end\nend",
"def factorial(num)\n product = num\n (1...num).each{|n| product *= n}\n product\nend",
"def factorial_method(n)# define the method and argument\n factorial = n#the value of facotorial asiggned equal the value if n\n factorial = 1 if n < 2# if n < 2 then factorial is 1\n if n >= 2# if n is bigger o equal to 2 then...\n for i in 2..n-1#run i to n-1\n factorial = factorial * i#factorial assigned the product of factorial and i, each time the value of i grows\n end#end of for loop\n end#end of if condition\n factorial#implicit return\nend",
"def factorial(num)\np = 1\n(1..num).each { |c| p *= c }\np\nend",
"def factorial(n)\n n == 1 ? 1 : n * factorial(n-1)\nend",
"def factorial(num)\n return 1 if num.zero?\n\n num * factorial(num - 1)\nend",
"def factorial(n)\n if n == 0; return 1; end\n return (1..n).reduce(:*)\nend",
"def factorial(n)\n raise ArgumentError, \"Negative number\" if n < 0 \n return 1 if n == 1 || n == 0\n return n * factorial(n-1)\nend",
"def factorial(number)\n if number == 0\n return 1\n else\n final_factorial = 1\n\n for x in 1..number\n final_factorial = final_factorial * x\n end\n\n return final_factorial\n end\nend",
"def factorial(n)\n (1..n).inject(1) {|a,b| a*=b}\nend",
"def factorial(n)\n (1..n).reduce(:*)\nend",
"def factorial(n)\n raise ArgumentError.new if n < 0 \n return 1 if n == 1 || n == 0 \n return n * factorial(n-1)\nend",
"def factorial(n)\n if n == 0\n return 1\n elsif n.nil? || n < 0\n raise ArgumentError, \"This value is not valid.\"\n end\n\n return n * factorial(n-1)\n\nend",
"def factorial(number)\n raise 'Only postive numbers allowed' unless number >= 0\n if number == 0 then 1 else number * factorial(number-1) end\nend",
"def factorial(number)\n if number == 0\n return 1\n else\n number*factorial(number-1)\n end\n\nend",
"def factorial(num)\n fact = 1\n (1..num).each { |i| fact *= i }\n return fact\nend",
"def factorial((number))\nif number == 0\n return 1\n else\n result = 1\n while number > 1\n result = result * number\n number -= 1\n end\nend\n return result\nend",
"def factorial(n)\n return n if n == 1\n return 1 if n == 0\n raise ArgumentError if n < 0\n \n n = n * factorial(n-1)\n end",
"def factorial(n)\n raise ArgumentError, \"Number is less then 0\" if n < 0\n return 1 if n == 0\n\n return n * factorial(n - 1)\nend",
"def factorial(x)\n return (1..x).inject(:*) || 1\nend",
"def factorial(num)\n (1..num).to_a.reduce(:*)\nend",
"def factorial(n)\n raise ArgumentError, \"A number must be greater than or equal to 0\" if n < 0\n return 1 if n == 0\n\n return n * factorial(n - 1)\nend",
"def factorial (number)\n if number == 0\n return 1\n else\n\n total = 1\n for i in 1..number\n total *= i\n i += 1\n end\n return total\n end\nend",
"def getFactorial(num)\n if (num == 1)\n sum = 1\n else\n sum = getFactorial(num-1)*num\n end\n return sum\nend",
"def factorial(n)\n\tif n == 0\n\t\t1\n\telse\n\t\tn * factorial(n-1)\n\tend\nend",
"def factorial(number)\n (1..number).each do |n|\n total *= n\n end\nend",
"def factorial(number)\n # Your code goes here\n if number == 0\n 1\n else\n number * factorial(number-1)\n end\nend",
"def factorial(n)\n return n if n == 1\n n*factorial(n-1)\nend",
"def factorial(n)\n (1..n).inject(1) {|product, n| product * n }\nend",
"def factorial_of num \n\t(2..num).inject(1) {|product, x| product * x }\nend"
] |
[
"0.7867671",
"0.75926185",
"0.7582463",
"0.7560864",
"0.7535442",
"0.7535442",
"0.7518699",
"0.75105613",
"0.74762005",
"0.74726427",
"0.74584305",
"0.7455591",
"0.74438846",
"0.7437645",
"0.74359405",
"0.74328685",
"0.74316776",
"0.7431082",
"0.7431082",
"0.741955",
"0.7409496",
"0.74083847",
"0.73939043",
"0.73923844",
"0.7384518",
"0.7384279",
"0.73801005",
"0.7378685",
"0.73724234",
"0.73616505",
"0.73598945",
"0.73525524",
"0.7350005",
"0.7349809",
"0.7346926",
"0.7345519",
"0.73343605",
"0.73343605",
"0.7332203",
"0.7331417",
"0.7312051",
"0.7303211",
"0.7303211",
"0.7296817",
"0.7295851",
"0.72926664",
"0.72880465",
"0.72835344",
"0.72828805",
"0.72812045",
"0.72772455",
"0.72770023",
"0.7274433",
"0.7273839",
"0.72697544",
"0.72683483",
"0.7264154",
"0.72557616",
"0.7252882",
"0.7248174",
"0.7244804",
"0.7244689",
"0.7244689",
"0.7242546",
"0.72395897",
"0.7235525",
"0.72337556",
"0.72334796",
"0.7232433",
"0.7228777",
"0.72229046",
"0.72225535",
"0.7218014",
"0.72130066",
"0.7211789",
"0.72088385",
"0.7196942",
"0.71894264",
"0.7187911",
"0.71864223",
"0.7180687",
"0.71776086",
"0.71759784",
"0.717568",
"0.71705043",
"0.7169412",
"0.71690726",
"0.7168905",
"0.7165594",
"0.7160894",
"0.71608037",
"0.7160451",
"0.71596324",
"0.7159149",
"0.7158999",
"0.7158922",
"0.7157947",
"0.7156422",
"0.7153649",
"0.7149728"
] |
0.73814243
|
26
|
SPLAT prefixes paramater inside method definition...can apply to middle paramater
|
def max(one_param, *numbers, another)
#Variable length parameters passed in become an array
numbers.max
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def prefix=(_arg0); end",
"def prefixes; end",
"def prefixes; end",
"def name_prefix=(_arg0); end",
"def prefix(argument_1, argument_2)\n print argument_1\n print argument_2\nend",
"def _prefixes; end",
"def prefix=(_); end",
"def local_prefixes; end",
"def pha; sparam(3); end",
"def prefix; end",
"def prefix; end",
"def prefix; end",
"def prefix; end",
"def prefix; end",
"def prefix; end",
"def prefix; end",
"def prefix; end",
"def prefix; end",
"def prefix; end",
"def f(prefix, suffix)\r\n \r\n end",
"def _prefix_arg0(args, prefix)\n if args.size > 0 && !args[0].nil? && !args[0].include?(prefix)\n args[0] = prefix + args[0]\n end\n args\nend",
"def method_with_splat_parameter(*names)\n end",
"def prefix( *pf )\r\n tokens.unshift(*TokenString.linearize_tokens(pf))\r\n self\r\n end",
"def prefix!( *pf )\r\n clone.prefix(*pf)\r\n end",
"def wrap_prefix(prefix)\n prefix\n end",
"def name_with_middle; end",
"def method_missing(method, *args)\r\n str = method.to_s\r\n str = str.sub(/[\\!\\?]$/, '') # Strip trailing ? or !\r\n fn = @prefix + str[0,1].capitalize + str[1..-1] # Ruby 1.8 compatible\r\n if args.empty?\r\n fn # Emit bare function name\r\n elsif args.size == 1 && args.first == nil\r\n fn + '()' # Use sole nil argument to emit function call with no arguments\r\n else\r\n fn + '(' + args.join(',') + ')' # Emit normal function call with supplied arguments\r\n end\r\n end",
"def method_with_splat_parameter2(*names)\n end",
"def city_prefix; end",
"def SAC04=(arg)",
"def transformed_argname; end",
"def transformed_argname=(_); end",
"def rec; sparam(2); end",
"def prefix\n raise NotImplementedError\n end",
"def SAC02=(arg)",
"def __splat(x) end",
"def SAC03=(arg)",
"def prefix(str) # 'str' points to the same string, \"John\", as 'name' does (at he start of this method).\n \"Mr \" + str # Ruby Docs: \"str + other_str → new_str\".\nend",
"def prefix=(prefix) @prefix = prefix end",
"def words_with_prefix(prefix, words)\n raise NotImplementedError # TODO\nend",
"def PRF04=(arg)",
"def name_prefix; end",
"def markerAlpha _args\n \"markerAlpha _args;\" \n end",
"def SAC01=(arg)",
"def street_suffix; end",
"def SAC12=(arg)",
"def ctr; sparam(3); end",
"def prefix(*ps)\n set :prefixes, ps.map { |p| ::File.join(\"/\", p) }\n end",
"def to_param\n short_name.present? ? short_name : super\n end",
"def full_name_2(first_name: first_name, last_name: last_name)\n first_name + \" \" + last_name\nend",
"def PRF02=(arg)",
"def starts_with_vocal (str)\n return str + 'ay' \nend",
"def normalize_name(name, prefixes); end",
"def SAC07=(arg)",
"def selntran(*)\n super\n end",
"def SAC15=(arg)",
"def PRF03=(arg)",
"def SAC06=(arg)",
"def %(arg0)\n end",
"def %(arg0)\n end",
"def prefix=(value = '/')\n # Replace :placeholders with '#{embedded options[:lookups]}'\n prefix_call = value.gsub(/:\\w+/) { |key| \"\\#{options[#{key}]}\" }\n\n # Redefine the new methods.\n code = <<-end_code\n def prefix_source() \"#{value}\" end\n def prefix(options={}) \"#{prefix_call}\" end\n end_code\n silence_warnings { instance_eval code, __FILE__, __LINE__ }\n rescue\n logger.error \"Couldn't set prefix: #{$!}\\n #{code}\"\n raise\n end",
"def segments=(_arg0); end",
"def mdr; sparam(7); end",
"def tricky_method!(a_string_param, an_array_param)\n a_string_param << \", rutabega\"\n an_array_param << \"rutabega\"\nend",
"def SAC05=(arg)",
"def preproc=(_arg0); end",
"def SE02=(arg)",
"def insert_param_based_on_string(param_name)\n insert_param_method_generic(param_name,\"to_s\")\n end",
"def general_prefix\n parts = []\n parts << label\n parts << ttl if ttl\n parts << 'IN'\n parts << type\n parts\n end",
"def method_with_keyword_param(keyword: foo)\nend",
"def set_prefix\n if self.prefix.nil? && self.title.present?\n self.prefix = self.title.to_s.gsub(/\\W/, '').downcase\n end\n end",
"def set_si_prefix (prefix)\n @request.env[:siprefix] = prefix\n end",
"def tricky_method(a_string_param, an_array_param)\n a_string_param += \"rutabaga\"\n an_array_param << \"rutabaga\"\n end",
"def alias_method(sym1,sym2) end",
"def use_prefix\n prefix, @prefix = @prefix, nil\n @res << prefix if prefix\n\n prefix\n end",
"def in_kwarg; end",
"def cli_prefix=(_arg0); end",
"def PRF01=(arg)",
"def aref_prefix\n 'method'\n end",
"def prefix_method(file_path)\n ->(field_name) { apply_prefix(field_name, file_path) }\n end",
"def prefix_method_string prefix\n puts \"About to call PREFIX TABLE.to_full with #{prefix}\" if SY::DEBUG\n full_prefix = SY::PREFIX_TABLE.to_full( prefix )\n full_prefix == '' ? '' : \".#{full_prefix}\"\n end",
"def singular_siegler; end",
"def plugin_prefixes( *args )\n\t\t@plugin_prefixes.replace( args ) if !args.empty?\n\t\treturn @plugin_prefixes\n\tend",
"def aliases=(_arg0); end",
"def aliases=(_arg0); end",
"def half_wind_abbreviation; end",
"def CTT04=(arg)",
"def middle_name; end",
"def subparameter_name; end",
"def with_prefix(name_or_symbol)\n self.class.initialize_prefixed_version(name_or_symbol,self)\n end",
"def SE01=(arg)",
"def PO103=(arg)",
"def method_name=(_arg0); end",
"def method_name=(_arg0); end",
"def in_kwarg=(_arg0); end",
"def insert_prefix(code, operations, strings)\n if strings.empty?\n operations.reverse_each do |op|\n code.insert(op[:ends], \"line#{VM_PREFIX}\")\n end\n else\n operations.reverse_each do |op|\n code.insert(op[:ends], \"line#{VM_PREFIX}\") if is_not_in_string?(op[:starts], strings)\n end\n end\n code\nend",
"def tricky_method(a_string_param, an_array_param)\r\n a_string_param += \"rutabaga\"\r\n an_array_param << \"rutabaga\"\r\nend",
"def tricky_method(a_string_param, an_array_param)\r\n a_string_param += \"rutabaga\"\r\n an_array_param << \"rutabaga\"\r\nend",
"def tricky_method(param)\n param << 'rutabaga'\nend",
"def PO108=(arg)",
"def full_name2 first_name, last_name\n first_name + \" \" + last_name\nend"
] |
[
"0.7125027",
"0.67845947",
"0.67845947",
"0.66851884",
"0.65727156",
"0.65386015",
"0.6379095",
"0.6301147",
"0.62303406",
"0.6226857",
"0.6226857",
"0.6226857",
"0.6226857",
"0.6226857",
"0.6226857",
"0.6226857",
"0.6226857",
"0.6226857",
"0.6226857",
"0.6183735",
"0.6061737",
"0.5905192",
"0.59051406",
"0.5888354",
"0.58711034",
"0.5867334",
"0.585539",
"0.5835695",
"0.5832201",
"0.57891405",
"0.5785417",
"0.57653713",
"0.5744537",
"0.5731886",
"0.572517",
"0.57250965",
"0.571917",
"0.5690704",
"0.5690266",
"0.5686142",
"0.56709945",
"0.5670951",
"0.566594",
"0.56587076",
"0.5655535",
"0.5640208",
"0.5634099",
"0.56287205",
"0.56168646",
"0.56126046",
"0.56079865",
"0.5600497",
"0.55920213",
"0.5591326",
"0.55873495",
"0.5559692",
"0.5559395",
"0.5554024",
"0.5548755",
"0.5548755",
"0.55329245",
"0.5516297",
"0.551202",
"0.5501296",
"0.5484542",
"0.54720813",
"0.54702306",
"0.5467683",
"0.5458803",
"0.5453778",
"0.54500765",
"0.5449964",
"0.5448017",
"0.5446035",
"0.54339",
"0.54309064",
"0.5428583",
"0.54271144",
"0.54242724",
"0.5415022",
"0.5414732",
"0.5400939",
"0.53951037",
"0.5393488",
"0.5393488",
"0.5392462",
"0.53916305",
"0.5386367",
"0.5384727",
"0.5382196",
"0.53801024",
"0.53789467",
"0.5375151",
"0.5375151",
"0.536987",
"0.53563136",
"0.5351863",
"0.5351863",
"0.5341796",
"0.53388906",
"0.5316982"
] |
0.0
|
-1
|
output =>1 Explicit way to configure a block in a methodUse call method to call a blockway to configure a block in a method Use & in front of the last paramater
|
def two_times_explicit (&i_am_a_block)
return "No block" if i_am_a_block.nil?
i_am_a_block.call
i_am_a_block.call
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def method &block, a\r\n\t1\r\nend",
"def my_method(&my_block)\n\n puts \"hello method\"\n\n my_block.call\n\n return my_block\n\nend",
"def call_block(&block)\n block.call\nend",
"def callBlock\n yield\n yield\nend",
"def my_method(&my_block)\n puts 'from my_method : before calling call method on my_block'\n my_block.call # call method calls the block\n puts 'from my_method : after calling call method on my_block'\n my_block.call\nend",
"def method &block\r\n\t1\r\nend",
"def method &block\r\n\t1\r\nend",
"def BlocksAndMethods(&argumento)\n\targumento.call\nend",
"def my_method(&my_block)\n puts \"hello method\"\n my_block.call\n return my_block\nend",
"def meth1(&block)\n \"(meth1: #{block.call})\"\nend",
"def method &block \r\n\t1\r\nend",
"def give(&my_block)\n my_block.call(\"2 turtle doves\", \"1 partridge\")\nend",
"def callBlock\n yield ,\n end",
"def test(&block)\n puts \"&block is, #{block}\"\nend",
"def give(&my_block)\n my_block.call(\"2 turtle doves\", \"1 partridge\")\nend",
"def method_1 nombre, &bloque\n yield if block_given? # bloque.call if block_given? #llamamos a nuestro bloque\nend",
"def execute(block) # the syntax requires an & in the paramater name.\n \t block.call\n\tend",
"def use_block(obj, &method)\n\tmethod.call\nend",
"def method_that_takes_a_block(&blk)\n p blk.call(\"hello\")\n p blk.call(\"World!\")\nend",
"def m12a(p1,p2,p3, &blk)\n\tyield(p1,p2) # два параметра передаем в блок\n\tputs \"The third parameter is #{p3}\" # один параметр испоьзуем прямо тут\nend",
"def test(&block)\n puts \"What's &block? #{block}\"\nend",
"def test(&block)\n puts \"What's &block? #{block}\"\nend",
"def another_work(&another_block)\n ## Passing the parameters to the block\n puts(\"Hey I am in the function\")\n another_block.call(4, 2)\n puts(\"Hey I am back in the function\")\n another_block.call(5, 3)\nend",
"def method3(&block)\n if block\n \"The block evaluates to #{block.call}\"\n else\n \"No block.\"\n end\nend",
"def method3(&block)\n if block\n \"The block evaluates to #{block.call}\"\n else\n \"No block.\"\n end\nend",
"def met(&block)\n puts \"This is method\"\n block.call\nend",
"def hello(&block)\n puts block\n block.call\nend",
"def meth5(&block)\n p block_given?\nend",
"def get_block(*params); raise('Stub or mock required.') end",
"def my_method1(&the_proc) # Convert Block to Proc\n puts the_proc.call(\"Bill\") # Use as Proc, just drop \"&\" and you will receive the block\n puts yield(\"Bill\") # Use as Block\nend",
"def indirect &b\n call_block &b\nend",
"def indirect &b\n call_block &b\nend",
"def block_example(&block)\n does block\n end",
"def meth2(&block)\n \"#{meth1(&block)} (meth2: #{block.call})\"\nend",
"def wrapping_block(method_name, **defaults)\n proc do |*args, **values|\n send method_name, *args, **defaults, **values\n end\n end",
"def method a, *b, &block\r\n\t1\r\nend",
"def hello(&block)\n puts \"Hello #{block.call}\" if block_given?\nend",
"def hello(&block)\n puts \"Hello #{block.call}\" if block_given?\nend",
"def call_block2\n yield(\"hello\",4)\nend",
"def procasaurus( &block )\n\tputs \"I am a procasaurus.\"\n\tputs block.class\n\t# note the proc must be the last parameter and must start with ampersand\nend",
"def callBlock\n yield # Invokes block\n yield # Invokes block again\nend",
"def my_method(&my_block)\n\tputs \"We're in the method, about to invoke your block!\"\n\tmy_block.call\n\tputs \"We're back in the method!\"\nend",
"def block_method2(&block)\n block.call\nend",
"def block=(_arg0); end",
"def block=(_arg0); end",
"def foo3(&block)\n block.call(1) \nend",
"def method a, &block\r\n\t1\r\nend",
"def test(&block)\n block.call\nend",
"def test(&block)\n block.call\nend",
"def block; end",
"def block; end",
"def block; end",
"def block; end",
"def block; end",
"def block; end",
"def block; end",
"def block; end",
"def block; end",
"def block; end",
"def block; end",
"def block; end",
"def block; end",
"def block; end",
"def block; end",
"def block; end",
"def block; end",
"def block; end",
"def block; end",
"def block; end",
"def take_block(x,&provided_block)\n puts provided_block.class\n x.times {|i| provided_block [i,i*i]} #other syntax for call\nend",
"def test(&block) # converts the argument to a \"simple\" Proc object\n puts \"What's &block? It's #{block}\" # can be called anything\nend",
"def call_block2\n yield(\"hello\", 99)\nend",
"def method2 (&block)\n return \"ERROR Method2: no block given\" if block.nil?\n block.call\n block.call\n block.call\nend",
"def ejecutar2(&bloque)\r\n if block_given?\r\n bloque.call #same as yield\r\n else\r\n puts 'No tiene bloque asignado'\r\n end\r\nend",
"def test_4_mix_of_lambdas_and_blocks_can_call_each_other\n result = interpret <<EOC\nl1=->() {1}\nb1=:{%l1()}\nl2=->() {%b1}\nm2=:{%l2}\n%m2\nEOC\n assert_eq result, 1\n end",
"def call(&block)\n instance_eval(&block)\n end",
"def call(&block)\n instance_eval(&block)\n end",
"def call(&block)\n instance_eval(&block)\n end",
"def call_block \n yield('hello', 99) \nend",
"def call_block \n yield('hello', 99) \nend",
"def hello_world(&block)\n puts block.call\nend",
"def i_take_an_explicit_block &block\n puts block.inspect\nend",
"def use(*args, &block); end",
"def run(&block)\n end",
"def method a, &block, *c\r\n\t1\r\nend",
"def my_method(&block)\n block.call # .call to invoke the block\nend",
"def parse_block(*_arg0); end",
"def with_block(&block)\n end",
"def modify_prices(prices, &block)\n p block.inspect\nend",
"def call_block\n @_block.call(self) if @_block\n end",
"def call_block\n yield('hello', 99)\nend",
"def call_block\n yield('hello', 99)\nend",
"def call_block\n yield('hello', 99)\nend",
"def twice(&my_block)\n puts \"In the method, about to call the block!\"\n my_block.call #call the block\n puts \"Back in the method, about to call the block again!\"\n my_block.call #call the block again\n puts \"Back in the method, about to return!\"\nend",
"def showInfo(&block)\n block\nend",
"def call_this(&block)\n block.call\nend",
"def hola &block\n puts block.class.name #esta linea nos dice que esto es un proc\n block.call\nend",
"def block?; end",
"def test_basic_param\n block_ = proc do |t_|\n t_.set_value(:a, 1)\n t_.set_value_by_block(:b){ 2 }\n assert(!self.respond_to?(:set_value))\n assert(!self.respond_to?(:set_value_by_block))\n end\n target_ = SimpleTarget.new\n Blockenspiel.invoke(block_, target_)\n assert_equal(1, target_.get_value(:a))\n assert_equal(2, target_.get_value(:b))\n end",
"def call() end",
"def block_eg1(cutblock)\n puts \"this is the first message from 1 \"\n cutblock.call\n puts \"this is the middle message\"\n cutblock.call\n puts \"this is the last\\n\\n\"\nend"
] |
[
"0.7057743",
"0.6989624",
"0.69814533",
"0.693251",
"0.69140464",
"0.69092166",
"0.69092166",
"0.6906271",
"0.69022655",
"0.68904406",
"0.6887485",
"0.6871183",
"0.6868464",
"0.6868368",
"0.68581504",
"0.6840222",
"0.6697308",
"0.66582584",
"0.6637301",
"0.6610386",
"0.6609287",
"0.6609287",
"0.6578655",
"0.6576556",
"0.6576556",
"0.6559423",
"0.65521574",
"0.65185195",
"0.65021574",
"0.64944005",
"0.64931905",
"0.64931905",
"0.64856935",
"0.6473846",
"0.646227",
"0.64493495",
"0.64486575",
"0.64486575",
"0.64483565",
"0.6447798",
"0.6443861",
"0.64157116",
"0.6413544",
"0.64125955",
"0.64125955",
"0.6388685",
"0.6385019",
"0.6359569",
"0.6359569",
"0.6352138",
"0.6352138",
"0.6352138",
"0.6352138",
"0.6352138",
"0.6352138",
"0.6352138",
"0.6352138",
"0.6352138",
"0.6352138",
"0.6352138",
"0.6352138",
"0.6352138",
"0.6352138",
"0.6352138",
"0.6352138",
"0.6352138",
"0.6352138",
"0.6352138",
"0.6352138",
"0.63484967",
"0.6345765",
"0.634306",
"0.63234985",
"0.6312346",
"0.6309469",
"0.630734",
"0.630734",
"0.630734",
"0.6303527",
"0.6303527",
"0.629369",
"0.6290387",
"0.62900794",
"0.6278086",
"0.62677485",
"0.62642163",
"0.62588525",
"0.6238844",
"0.6234096",
"0.6232469",
"0.6226018",
"0.6226018",
"0.6226018",
"0.6215284",
"0.6210575",
"0.620978",
"0.6206395",
"0.6205565",
"0.62032235",
"0.61946034",
"0.6193527"
] |
0.0
|
-1
|
=> Hello => Hello Implicit way to configure a block in a methodUse yield to call block
|
def two_times_implicit
return "No block" unless block_given?
yield
yield
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def call_block \n yield('hello', 99) \nend",
"def call_block \n yield('hello', 99) \nend",
"def call_block\n yield('hello', 99)\nend",
"def call_block\n yield('hello', 99)\nend",
"def call_block\n yield('hello', 99)\nend",
"def hello(&block)\n puts block\n block.call\nend",
"def hello(&block)\n\tblock.call if block_given?\nend",
"def use_hello\n yield \"hello\"\nend",
"def hello(&block)\n puts \"Hello #{block.call}\" if block_given?\nend",
"def hello(&block)\n puts \"Hello #{block.call}\" if block_given?\nend",
"def hello\n\tyield\nend",
"def hello_world(&block)\n puts block.call\nend",
"def call_block2\n yield(\"hello\",4)\nend",
"def call_block2\n yield(\"hello\", 99)\nend",
"def say_hello(&block)\n puts \"Hello, world\"\n \n # One advantage of yield is that you can run that code\n # any number of times, so let's go ahead and put yield \n # again.\n yield\n yield\n puts \"I said hello\"\nend",
"def callBlock\n yield\n yield\nend",
"def greeting(&block)\n puts 'good morning'\n text = block.call('hello')\n puts text\n puts 'good evening'\nend",
"def greeting(&block)\n puts 'good morning'\n text = block.call('hello')\n puts text\n puts 'good evening'\nend",
"def hello\n puts \"I am inside the method\"\n yield\nend",
"def say_hello(&block)\n puts \"Hello world\"\n name = block.call\n puts \"You entered #{name} as your name\"\nend",
"def hello(&block)\n lambda do |record|\n yield record if block_given?\n end\nend",
"def greeter()\n yield\nend",
"def my_method(&my_block)\n puts \"hello method\"\n my_block.call\n return my_block\nend",
"def my_method(&my_block)\n\n puts \"hello method\"\n\n my_block.call\n\n return my_block\n\nend",
"def greeter\n yield\t\t# yields to block\nend",
"def method_with_block_arguments\n yield(\"Bob\")\nend",
"def method_that_takes_a_block(&blk)\n p blk.call(\"hello\")\n p blk.call(\"World!\")\nend",
"def block; end",
"def block; end",
"def block; end",
"def block; end",
"def block; end",
"def block; end",
"def block; end",
"def block; end",
"def block; end",
"def block; end",
"def block; end",
"def block; end",
"def block; end",
"def block; end",
"def block; end",
"def block; end",
"def block; end",
"def block; end",
"def block; end",
"def block; end",
"def callBlock\n yield ,\n end",
"def call_this_block\n yield \"tweet\"\nend",
"def call_this_block\n yield \"tweet\"\nend",
"def greeter\n yield\nend",
"def greeter\n yield\nend",
"def greeter\n yield\nend",
"def greeter\n yield\nend",
"def greeter\n yield\nend",
"def greeter\n yield\nend",
"def call_block\n puts \"start\"\n yield \"foobar\" if block_given?\n puts \"end\"\nend",
"def my_method\n puts \"hello\"\n yield if block_given?\n puts \"goodbye\"\nend",
"def call_block(&block)\n block.call\nend",
"def block_example(&block)\n does block\n end",
"def yield_block_example()\n puts \"Start of yield block example\"\n yield('example of param passing')\n puts \"End of yield block example\"\nend",
"def block_method\n yield(\"Brandon\",\"CS\")\n yield(\"Katie\",\"Econ\")\nend",
"def greeter\n puts \"in the method\"\n puts \"yielding to block\"\n yield\n puts \"back in method\"\nend",
"def met(&block)\n puts \"This is method\"\n block.call\nend",
"def with_block(&block)\n end",
"def say_hi(name)\r\n\tputs \"Hi #{name.capitalize}\"\r\n\tyield (name.capitalize, name.reverse.capitalize) if block_given?###only returns if block is true\r\nend",
"def callBlock\n yield # Invokes block\n yield # Invokes block again\nend",
"def method_1 nombre, &bloque\n yield if block_given? # bloque.call if block_given? #llamamos a nuestro bloque\nend",
"def call_block\r\n puts \"Start of method\"\r\n yield\r\n yield\r\n puts \"End of method\"\r\nend",
"def my_method1(&the_proc) # Convert Block to Proc\n puts the_proc.call(\"Bill\") # Use as Proc, just drop \"&\" and you will receive the block\n puts yield(\"Bill\") # Use as Block\nend",
"def block_method1\n yield\nend",
"def greet\n yield('Wake up', 'Neo')\nend",
"def block_test\n\n puts \"We're in the method!\"\n puts \"Yielding to the block...\"\n yield #this expression allows the method to receive and execute a block\n puts \"We're back in the method!\"\nend",
"def ice_cream\n yield(\"vanilla\", \"strawberry\")\nend",
"def i_take_a_block\n yield\nend",
"def sup_bro\n puts \"This is before a block!\"\n name = \"Katy\"\n yield(name)\n puts \"This is after a block!\"\nend",
"def yield; end",
"def speak_the_truth\n yield \"Boris\" if block_given?\nend",
"def test\n yield(1, 2) # passing 2 block args\nend",
"def block_method\n puts \"This is printing from the method.\"\n yield(\"Alice\", \"Bill\")\n yield(\"Dan\", \"Carlos\")\n yield\n puts \"This is printing from the method again.\"\nend",
"def call_block\n\tputs \"Start of method\"\n\tyield\n\tyield\n\tputs \"End of method\"\nend",
"def my_method\n\tx = \"Goodbye\" # the bindings of method, not visible in the block\n\tyield(\"cruel\")\nend",
"def who_says_what\r\n yield(\"Dave\", \"hello\")\r\n yield(\"Andy\", \"goodbye\")\r\nend",
"def do_something_with_an_arg\n yield(\"Hello world 3\") if block_given?\nend",
"def method\n\tputs \"This is our method\"\n\tyield(\"bob\", \"nancy\")\nend",
"def run_block\n yield\nend",
"def context(&block); end",
"def context(&block); end",
"def method_with_block_parameter &provided_block_proc\n puts provided_block_proc.class\n provided_block_proc.call(\"called from method\")\n yield \"called from method with yield\"\nend",
"def test\n yield(1, 2)\nend",
"def who_says_what\r\n\tyield( \"Dave\", \"hello\" )\r\n\tyield( \"Andy\", \"goodbye\" )\r\nend",
"def parse_yield(context, single, tk, method)\n return if method.block_params\n\n get_tkread\n method.block_params = parse_method_or_yield_parameters\n end",
"def test_procs_and_lambdas\n yield\n puts \"hello\"\nend",
"def block_method\n yield if block_given?\nend",
"def give(&my_block)\n my_block.call(\"2 turtle doves\", \"1 partridge\")\nend",
"def test_progs_and_lambdas\n yield \n puts \"Hello\"\nend",
"def give(&my_block)\n my_block.call(\"2 turtle doves\", \"1 partridge\")\nend",
"def test\n yield(1)\nend",
"def test\n yield(1)\nend",
"def test\n yield(1)\nend",
"def test\n yield(1)\nend"
] |
[
"0.83039707",
"0.83039707",
"0.8232341",
"0.8232341",
"0.8232341",
"0.813319",
"0.80806017",
"0.8061794",
"0.7985368",
"0.7985368",
"0.7903087",
"0.7893397",
"0.7860689",
"0.78492445",
"0.7847974",
"0.7779097",
"0.7774063",
"0.7774063",
"0.77500445",
"0.77141297",
"0.76782125",
"0.75864345",
"0.7545733",
"0.754512",
"0.74785244",
"0.744609",
"0.7431557",
"0.74291986",
"0.74291986",
"0.74291986",
"0.74291986",
"0.74291986",
"0.74291986",
"0.74291986",
"0.74291986",
"0.74291986",
"0.74291986",
"0.74291986",
"0.74291986",
"0.74291986",
"0.74291986",
"0.74291986",
"0.74291986",
"0.74291986",
"0.74291986",
"0.74291986",
"0.74291986",
"0.74002826",
"0.73929715",
"0.73929715",
"0.73822457",
"0.73822457",
"0.73822457",
"0.73469603",
"0.73469603",
"0.73469603",
"0.733785",
"0.7332599",
"0.7330635",
"0.73221976",
"0.73145026",
"0.72996247",
"0.72990817",
"0.72907114",
"0.72784513",
"0.7273452",
"0.7263818",
"0.7256475",
"0.7246075",
"0.7244394",
"0.72368574",
"0.7236041",
"0.7223317",
"0.72197855",
"0.7210085",
"0.7200893",
"0.7199187",
"0.71813816",
"0.7181172",
"0.71720475",
"0.71674687",
"0.71670234",
"0.71633995",
"0.7150733",
"0.71488786",
"0.713484",
"0.71260345",
"0.71260345",
"0.7112148",
"0.7077905",
"0.70755446",
"0.7071479",
"0.70368356",
"0.7036308",
"0.70359117",
"0.7034927",
"0.7032987",
"0.7030454",
"0.7030454",
"0.7030454",
"0.7030454"
] |
0.0
|
-1
|
=> No block method that capitalizes a word
|
def capitalize(string)
puts "#{string[0].upcase}#{string[1..-1]}" #"#{string.capitalize}"
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def capitalize!() end",
"def capitalize() end",
"def capitalize(word)\n\nend",
"def capitalize_each_word(phrase)\r\n\r\nend",
"def capitalized\n name.titleize.capitalize\n end",
"def capitalize\n \"Foo\"\n end",
"def snake_case(name); end",
"def capitalize(input); end",
"def downcase!() end",
"def camelcase(s)\n\n\nend",
"def camel_case\n gsub /(?:^|_)(.)/ do $1.upcase end\n end",
"def case_fix(name)\r\n fixed_name = name.split(' ')\r\n fixed_name.each do |word|\r\n word.capitalize!\r\n end\r\n fixed_name.join(' ')\r\nend",
"def downcase() end",
"def uppercase_name\n # self.name.upcase\n name.upcase #self is the implicit reciever\n end",
"def capitalize_name(name)\n name.call\nend",
"def method2(&block)\n block.call.upcase\nend",
"def method2(&block)\n block.call.upcase\nend",
"def upcase() end",
"def upcase!() end",
"def capsV2(word, &block)\n puts 'In capsV2 method'\n block.call(word)\nend",
"def capitalize\n (self.to_s.capitalize! || self).to_sym\n end",
"def capitalize\n\t\tcollect(&:capitalize)\n\tend",
"def caps(name)\n\tputs \"#{name.upcase}\"\nend",
"def downcase; end",
"def caps(word)\n puts 'In caps method'\n yield(word)\nend",
"def camel_case(str); end",
"def shout(word)\n upper_case = word.upcase\nend",
"def capitalize_description_if_needed(description)\n return description if description.match(/\\p{Lower}/) # Some lowercase in there, do nothing\n description = UnicodeUtils.downcase(description) # There's no capitalize method!?\n description[0] = UnicodeUtils.upcase(description[0])\n description\nend",
"def downcase_name\n name.downcase!\n end",
"def spy_name(real_name)\n capitalize(next_letter(swap(real_name)))\nend",
"def proper_name(name)\n return name if name =~ /[[:upper:]]/\n\n name.gsub(/\\b[[:alpha:]]+/) { |w| w =~ PARTICLE_REGEX ? w : w.capitalize }\n end",
"def say_goodnight(name)\r\n \"Dobranoc #{ name.capitalize }\"\r\nend",
"def titlecase()\r\n ignore_list = %w{of etc and by the for on is at to but nor or a via}\r\n capitalize_all_ex(ignore_list)\r\n end",
"def capitalize\n `return self.charAt(0).toUpperCase() + self.substr(1).toLowerCase();`\n end",
"def capitalize\n `return self.charAt(0).toUpperCase() + self.substr(1).toLowerCase();`\n end",
"def titlecase!\n replace(titlecase)\n end",
"def greet(name)\n capitalized_name = name.capitalize\n puts yield(capitalized_name)\nend",
"def capitalize(skip_prefixed_underscores: false)\n self.capital skip_prefixed_underscores: skip_prefixed_underscores\n end",
"def caps(string)\n return string.upcase\nend",
"def caps(string)\n return string.upcase\nend",
"def under_attack\n puts \"THE world is in danger due to the evil taking over!!!\".upcase\nend",
"def ucfirst\n self.sub(/^(\\w)/) { |s| s.capitalize }\n end",
"def capital(skip_prefixed_underscores: false)\n LuckyCase.capitalize self, skip_prefixed_underscores: skip_prefixed_underscores\n end",
"def underscorize!\n self.replace(self.scan(/[A-Z][a-z]*/).join(\"_\").downcase)\n end",
"def titlecase\n\t\tsplit(/(\\W)/).map(&:capitalize).join\n\tend",
"def LetterCapitalize(str)\n\n # code goes here\n str_parts = str.split(\" \")\n str_parts.each { |x| x.capitalize! }\n return str_parts.join(\" \")\n \nend",
"def name_case!\n self.gsub!(self, self.name_case)\n end",
"def swapcase!() end",
"def upper_case()\n LuckyCase.upper_case self\n end",
"def capitalize_name\n self.name = name.sub(/\\S/, &:upcase) unless name.nil?\n end",
"def humanize\n self.downcase.gsub(/_/, \" \").capitalize\n end",
"def camel_case(name)\n if name.include? '_'\n name.split('_').map{|e| e.capitalize}.join\n else\n unless name =~ (/^[A-Z]/)\n name.capitalize\n else\n name\n end\n end\nend",
"def caps_phrase(user_phrase)\n puts user_phrase.upcase\nend",
"def camel_case\n @word.split(' ').collect(&:capitalize).join\n end",
"def cap_it\n words = \"hello there, how are you?\"\n p words.split(' ').capitalize.join(' ')\nend",
"def shout (s)\n s.upcase\nend",
"def upcase; end",
"def capital_word_case(preserve_prefixed_underscores: true)\n LuckyCase.capital_word_case self, preserve_prefixed_underscores: preserve_prefixed_underscores\n end",
"def is_upper?(c)\n return c == c.capitalize\n end",
"def swapcase() end",
"def name_this_method(word)\n\tword[0] = word[0].upcase\nend",
"def normalize_name(name)\n CapitalizeNames.capitalize(name)\n end",
"def sentencize (text, change)\n\n\treturn change ? text.capitalize! : text\n\nend",
"def humanize\n self.gsub(/_/, \" \").capitalize\n end",
"def upcase\n @name.upcase\n end",
"def capitalize(name)\n secret_name = name.split(\" \").map do |word|\n word.capitalize\n end\n secret_name.join(\" \")\nend",
"def titlecase(input)\n input.titlecase\n end",
"def smart_capitalize(word, index, count)\n if word.match?(/^(\\w\\.)+$/) # initialisms\n word\n elsif NO_CAPS.include?(word.downcase) && index.between?(1, count - 2)\n word.downcase\n elsif ALL_CAPS.include?(word.downcase)\n word.upcase\n elsif word.match?(/^[A-Z0-9]+$/)\n word\n else\n word.capitalize\n end\n end",
"def is_uppercase?(word)\nend",
"def caps(str)\n str.upcase\n end",
"def camel_case\n return self if self !~ /_/ && self =~ /[A-Z]+.*/\n split('_').map{|e| e.capitalize}.join\n end",
"def camel_case\n return self if self !~ /_/ && self =~ /[A-Z]+.*/\n split('_').map{|e| e.capitalize}.join\n end",
"def shout(word)\n puts word.upcase\n end",
"def unusualCapitalization(*x); field('unusualCapitalization', *x) end",
"def capitalize_names!\n @artist_name = StringUtils.mixed_case(@artist_name)\n @name = StringUtils.mixed_case(@name)\n @subtitle = StringUtils.mixed_case(@subtitle)\n @genre = StringUtils.mixed_case(@genre)\n @mixer = StringUtils.mixed_case(@mixer)\n @version_name = StringUtils.mixed_case(@version_name)\n @version_name.gsub!(/(\\A|\\s)(Version|Release)\\b/) {|string| string.downcase} if @version_name\n end",
"def camelize_methodname\n self.titleize.gsub(' ', '').camelize(:lower)\n end",
"def capitalize_name!\n @fullname = @fullname.upcase\n return @fullname.upcase\n end",
"def uppercase_name\n self.name = name.split.map(&:capitalize).join(' ')\n self.location = location.split.map(&:capitalize).join(' ')\n end",
"def title_case\n\t\tself.split.collect{ |s| s.capitalize_first }.join(\" \")\n\tend",
"def is_capitalized?(word)\n return true if word == word.upcase\n return false\n end",
"def snakecase(string); end",
"def shout(text)\n text.upcase\nend",
"def downcase(input); end",
"def wordcap\n self.split(\" \").each{|word| word.capitalize!}.join(\" \")\n end",
"def titleize\n self.underscore.humanize.gsub(/\\b(?<!['’`])[a-z]/) { $&.capitalize }\n end",
"def greetings(name)\n puts \"Hello #{name.capitalize}\"\nend",
"def undercover_name(name)\n name.downcase.split(' ').map!{|name| name.split('').map! {|letter| next_letter(letter)}.join('').capitalize}.reverse.join(\" \")\nend",
"def capitalize_name\n self.name = self.name.split.collect(&:capitalize).join(' ') if self.name && !self.name.blank?\n end",
"def +@\n text.upcase\n end",
"def capitalize_title\n self.title.capitalize!\n end",
"def mixed_case_2(name)\n\tname.downcase.gsub(/\\b\\w/, &:upcase)\nend",
"def smart_titlecase\n small_words = %w(a an and as at but by en for if in of on or the to v v. via vs vs. von)\n\n x = split(\" \").map do |word|\n # note: word could contain non-word characters!\n # downcase all small_words, capitalize the rest\n small_words.include?(word.gsub(/\\W/, \"\").downcase) ? word.downcase! : word.smart_capitalize!\n word\n end\n # capitalize first and last words\n x.first.smart_capitalize!\n x.last.smart_capitalize!\n # small words after colons are capitalized\n x.join(\" \").gsub(/:\\s?(\\W*#{small_words.join(\"|\")}\\W*)\\s/) { \": #{$1.smart_capitalize} \" }\n end",
"def test_translates_capitalization_remains\n s = translate(\"My friend Jim is from Denver\")\n assert_equal \"Ymay iendfray Imjay isay omfray Enverday\", s\n end",
"def shout(word)\n\treturn word.upcase\nend",
"def camelize!\n self.titleize!\n self.replace(self[0, 1].downcase + self[1..-1])\n end",
"def capitalize!\n\t\teach_with_index do |element,index|\n\t\t\tself[index] = element.capitalize\n\t\tend\n\t\tself\n\tend",
"def shout(a)\n return a.upcase\nend",
"def mixed_case(name)\n name.downcase.gsub(/\\b\\w/, &:upcase)\nend",
"def name ; self[:name].downcase end",
"def shout(str)\n str.upcase\nend",
"def studly_caps(delimiter = '_')\n ((self.start_with?(delimiter) ? '' : delimiter) + self).camel_case(delimiter)\n end"
] |
[
"0.78011245",
"0.77305764",
"0.74313015",
"0.7295321",
"0.72289777",
"0.71878475",
"0.7178844",
"0.71226275",
"0.70924824",
"0.70476234",
"0.70318043",
"0.7026399",
"0.7023131",
"0.7005624",
"0.69891024",
"0.698248",
"0.698248",
"0.6948854",
"0.6936364",
"0.6930801",
"0.69057226",
"0.68957084",
"0.68930167",
"0.6892536",
"0.68882406",
"0.6885394",
"0.6865471",
"0.6861106",
"0.68433785",
"0.6840677",
"0.6839468",
"0.6827778",
"0.6819956",
"0.68176144",
"0.68176144",
"0.68167806",
"0.6804908",
"0.67956775",
"0.6783208",
"0.6783208",
"0.67827106",
"0.67799366",
"0.6752084",
"0.67448145",
"0.67446417",
"0.6732307",
"0.6731757",
"0.67258275",
"0.67081124",
"0.67069876",
"0.6700847",
"0.6693213",
"0.66854674",
"0.6672256",
"0.6662944",
"0.6658878",
"0.665361",
"0.66424763",
"0.66358376",
"0.6634589",
"0.6634275",
"0.6625204",
"0.66226196",
"0.66136044",
"0.6591358",
"0.6587705",
"0.6582787",
"0.6579017",
"0.65773016",
"0.65764064",
"0.65662533",
"0.65662533",
"0.6565835",
"0.65645087",
"0.6546346",
"0.65344745",
"0.65334",
"0.6532763",
"0.6523785",
"0.65227675",
"0.6522371",
"0.6518219",
"0.6508594",
"0.65081066",
"0.6507821",
"0.6507618",
"0.6505658",
"0.65022445",
"0.64864314",
"0.6482875",
"0.6466157",
"0.646547",
"0.64638394",
"0.6463628",
"0.64560354",
"0.6452652",
"0.6450264",
"0.6446878",
"0.64450234",
"0.6444823",
"0.64408547"
] |
0.0
|
-1
|
used to validate the information coming in from the form, if the validations pass, it inserts the record to the database and redirect the user to another page, else display the error messages telling the user why the form failed.
|
def create
@item = Item.new(item_params)
if @item.save
redirect_to items_path
else
render action: "new"
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def validate_and_save(success_message, failure_template)\n unless @form.valid?\n render failure_template\n return\n end\n\n @form.save\n\n redirect_to index_path, :notice => success_message\n end",
"def create\n #the params method = the content coming from the form\n\n #this creates a new DB entry\n @article = Article.new(article_params)\n \n #this saves the entry to the DB\n #the conditional is backup if the validation added in the model (app/models/article.rb) fails\n if @article.save\n redirect_to @article\n else\n render 'new'\n end\n end",
"def create\n # Create a new movie instance that will be used in the form:\n @movie = Movie.new(movie_params);\n\n if(@movie.save)\n # Present a 1-time flash message to the user after redirect:\n flash[:notice] = \"Movie created successfully.\";\n\n # If saved to DB successfully, go to show page:\n redirect_to @movie;\n else\n # If validations prevented save, reload form (with error message):\n render 'new';\n end\n end",
"def create\n # post = Post.new(title: params[:post][:title], url: params[:post][:title])\n post = current_user.posts.new(post_params)\n \n if post.save # this goes to the model and check all the validations before it gets saved\n # if validation passes, then it saves, and it returns true\n # otherwise, it returns false\n redirect_to posts_path\n else\n # if the record doesnt save because it didnt pass the validations\n # flash[:message] = post.errors.messages[:base]\n\n flash[:message] = post.errors.messages\n\n redirect_to :back\n end\n end",
"def create\n @phone = Phone.create!(user_params)\n if @phone.errors.empty?\n \n redirect_to phones_url\n else\n render \"new\"\n end\n end",
"def redirect_to_new_costume_form_if_required_fields_empty\n redirect_to new_dance_studio_costume_path(current_user.id), danger: 'Must fill out Dance Season & Song Name AND select at least 1 dancer w/ costume size & costume condition' if @dance_season_empty || @song_name_empty\n end",
"def validate_params\n if params[:location].empty? || params[:vintage].empty?\n flash[:error] = 'Please enter both a Location and a Vintage.'\n redirect_to discover_index_path\n end\n end",
"def create\n @student = Student.new( student_params )\n\n if @student.save # If the validations pass\n redirect_to @student # Redirect to show action for this student\n else # If the validations fail\n render :new # Render the view associated with the new action.\n end\n end",
"def create\n @book = Book.create(book_params)\n if @book.errors.empty?\n redirect_to book_path(@book)\n else\n render \"new\"\n end\n end",
"def create\n\n @location = Location.create(params[:new_location])\n\n if @location.errors.empty?\n flash['notice'] = \"Location #{@location.name} added\"\n redirect_to :action => 'list'\n else\n flash['notice'] = @location.errors.full_messages.pop\n redirect_to :action => 'add'\n end\n\n end",
"def valid_record?(record, message, ok_path, nok_layout)\n if record.valid?\n flash_redirect(message, ok_path)\n else\n render(nok_layout)\n end\n end",
"def create\n # Creating the patient with present surgeon\n params[:patient][:owner_id] = devise_current_user.id.to_s\n patient = current_user.patients.new(patient_params)\n # Condition for checking the saved or not\n if patient.save\n # Check the condition of which url is present\n if params[:patient][:prev_url].present?\n # If prev present then navigate to the patients case form\n redirect_to new_patient_case_path(patient)\n else\n # redirect to the patients if prev url not present\n redirect_to patients_path\n end\n else\n # redirect to the same page of the patient new page\n redirect_to :back\n # if the record is not save then navigate to the same page and showing the flash\n flash.notice = \"Need fill out the Essential Fields\"\n end\n end",
"def create\n @directorform = Directorform.new(params[:directorform])\n\n respond_to do |format|\n if @directorform.save\n format.html { redirect_to @directorform, notice: 'Thank you - your form was sucessfully submitted! You will be redirected to our homepage shortly.' }\n format.json { render json: @directorform, status: :created, location: @directorform }\n else\n format.html { render action: \"new\" }\n format.json { render json: @directorform.errors, status: :unprocessable_entity }\n end \n end\n end",
"def create\n @donor = Donor.new(donor_params)\n #if invalid, initialize respective flash errors, push specific errors into errors array to be displayed on page, redirect to root route\n valid_email_regex = /\\A([^@\\s]+)@((?:[-a-z0-9]+\\.)+[a-z]+)\\z/i\n flash[:errors_count] = 0\n\n if !@donor.valid?\n initialize_donorRegErrors_flash\n\n if (@donor.first_name == \"\")\n flash[:donor_reg_errors] << \"Enter your first name\"\n flash[:errors_count] += 1\n end\n\n if (@donor.last_name == \"\")\n flash[:donor_reg_errors] << \"Enter your last name\"\n flash[:errors_count] += 1\n end\n\n # checks if email entered matches regex pattern. If there is not a complete match, returns nil.\n if ((@donor.email =~ valid_email_regex) == nil)\n flash[:donor_reg_errors] << \"Enter a valid email address\"\n flash[:errors_count] += 1\n end\n\n if(Donor.find_by_email(@donor.email))\n flash[:donor_reg_errors] << \"Email already exists\"\n flash[:errors_count] += 1\n end\n\n if(@donor.password == nil)\n flash[:donor_reg_errors] << \"Enter your password\"\n flash[:errors_count] += 1\n end\n\n if(@donor.money_available == nil || @donor.money_available == 0)\n flash[:donor_reg_errors] << \"Enter donation amount ($25-$10,000)\"\n flash[:errors_count] += 1\n end\n\n redirect_to \"/\"\n\n #if user input for all fields in donor registration form are valid, save in db, redirect to user's page via routes\n else\n @donor.save\n session[:donor_id] = @donor.id\n redirect_to \"/donor/#{@donor.id}\"\n end\n end",
"def create\n @phone = Phone.create(phone_params)\n if @phone.valid?\n redirect_to phones_path\n else\n render plain: 'Please enter valid data'\n end\n end",
"def create_form\n new_form = Form.create_form(current_user[\"id\"])\n\n if new_form[:status] \n return redirect_to \"/f/#{new_form[:form_code]}/create\"\n end \n end",
"def show_errors\n # TODO: redirect to the member's book list?\n redirect_to books_path\n end",
"def create\n @user = User.create(user_params)\n if @user.valid?\n @user.save\n redirect_to @user\n else\n flash[:alert] = \"The information you entered was invalid.\" \n redirect_to signup_path\n end\n end",
"def validarSesion\n if session[:email].nil?\n flash[:error] = t('debesesion')\n redirect_to root_url\n end\n end",
"def create\n @product = Product.create( params[:product] )\n #this redirect only applies for when the product was successfully created! You'll have to modify this code with an if statement to RENDER the new view IF there are errors ELSE REDIRECT to the products view if there weren't errors.\n redirect_to '/products'\nend",
"def validate_form1\n errors = \"\"\n\n # First, clean up any malicious code.\n params[:form] = escape_html(params[:form])\n params[:dtop_id] = escape_html(params[:dtop_id])\n params[:ssn] = escape_html(params[:ssn])\n params[:passport] = escape_html(params[:passport])\n\n # Store the data so we can show it again in case of\n # errors, using the session.\n session[:form] = params[:form]\n session[:dtop_id] = params[:dtop_id]\n session[:ssn] = params[:ssn]\n session[:passport] = params[:passport]\n\n # perform server side validation of form1 data.\n # If the user selected to identify\n # using a dtop id or driver license:\n if(params[:form].to_s == \"dtop\" or params[:form].to_s == \"license\")\n if(params[:dtop_id].to_s.length == 0 or\n !validate_dtop_id(params[:dtop_id]))\n errors += \"&license=false\"\n end\n if(params[:ssn].to_s.length == 0 or\n !validate_ssn(params[:ssn]))\n errors += \"&ssn=false\"\n end\n # If the user selected to identify using\n # a passport:\n elsif(params[:form] == \"passport\")\n # if pass port number cannot be validated\n # later add password number validation\n # Normally passwords are 9 digits long, but\n # that could vary through countries. Let's\n # put a a limit on 20 for now.\n if(!validate_passport(params[:passport]))\n errors += \"&passport=false\"\n end\n # The user chose an unknown form type\n else\n errors += \"&invalid_form=true\"\n end\n\n # If any errors ocurred, do a redirect:\n redirect to (\"/form?errors=true#{errors}&form=#{params[:form]}\") if errors.length > 0\nend",
"def post_form\n @post = Post.new(post_params)\n unless @post.valid?\n render :new\n else\n redirect_to :action => \"create_confirm\", title: @post.title, description: @post.description\n end\n end",
"def validate\n if !new_record? && current?\n errors.add('contact_name', 'Please provide a contact name for your enquiry') unless contact_name.present?\n errors.add('contact_phone', 'Please provide a phone number where we may contact you at about your enquiry') unless contact_phone.present?\n end\n end",
"def create\n\t\tpre_new\n\t\t@page.save!\n\t\tflash[:notice] = 'New Page was successfully saved.'\n\t\tredirect_to @page.sitepath\n\t#rescue NoMethodError\n\t#\trender :action=>:new\n\trescue ActiveRecord::RecordInvalid\n\t\trender :action=>:new\n\trescue\n\t\tflash.now[:error] = 'An error occurred while trying to save your new Page.'\n\t\trender :action=>:new\n\tend",
"def redirect_to_assign_costume_form_if_required_fields_empty\n if @costume.costume_assignments.empty?\n redirect_to assign_costume_path(@costume), danger: 'Assignment failure: Must fill out Dance Season & Song Name AND select at least 1 dancer w/ costume size & costume condition' if @dance_season_empty || @song_name_empty\n else # if costume has been previously assigned\n redirect_to assign_costume_path(@costume, season: @costume.costume_assignments.last.dance_season), danger: 'Assignment failure: Must fill out Dance Season & Song Name AND select at least 1 dancer w/ costume size & costume condition' if @dance_season_empty || @song_name_empty\n end\n end",
"def save_and_continue\n\n logger.info 'Navigating past payment details confirmation screen '\n \"for ID: #{@funding_application.payment_details.id}\"\n\n @funding_application.payment_details.validate_evidence_file = true\n\n if @funding_application.payment_details.valid?\n\n logger.info 'Successfully validated payment details evidence file when '\n 'navigating past payment details confirmation screen for '\n \"ID: #{@funding_application.payment_details.id}\"\n\n redirect_to :funding_application_gp_project_payment_how_is_your_project_progressing\n\n else\n\n logger.info 'Validation failed when attempting to navigate past '\n \"payment details confirmation screen for ID: #{@funding_application.payment_details.id}\"\n\n log_errors(@funding_application.payment_details)\n\n render :show\n\n end\n\n end",
"def create_demonstrator\n # if empty form is submitted, it sets error message and redirects to add_demonstrator page\n if params[:practical_ids].nil?\n flash[:alert] = \"No selected practical submitted\"\n redirect_to add_demonstrator_path\n # if there is a student ID submitted, it proceeds with the rest of the validations \n else\n # the first element of the list is an empty string due to the implementation of the select field\n params[:practical_ids][:practical_ids].delete(\"\")\n # if no practical is selected and submitted, it sets error message and redirects to add_demonstrator page\n if params[:practical_ids][:practical_ids].empty?\n flash[:alert] = \"No selected practical submitted\"\n redirect_to add_demonstrator_path\n # if there are submitted practicals, it proceeds with the rest of the validations \n else\n # since it tries to add more than one new entries, \n # we need a boolean to set an alert notification when any of insertions were not successful\n failed = false\n # sam_id because it can be either sam_student_id or sam_staff_id\n sam_id = params[:sam_id]\n # checks whether the demonstrator is either an existing staff or an existing student\n if Student.exists?(sam_student_id: sam_id) || Staff.exists?(sam_staff_id: sam_id)\n create_demonstrator_params[:practical_ids].each do |practical_id|\n # only adds the demonstrator to a practical if they are not already there\n if !Demonstrator.exists?(sam_demonstrator_id: sam_id, practical_id: practical_id)\n demonstrator = Demonstrator.new\n demonstrator.sam_demonstrator_id = sam_id\n demonstrator.practical_id = practical_id.to_i\n if !demonstrator.save\n # indicates for the users if any of the insertion were not successful\n flash[:alert] = \"Failed to save\"\n failed = true\n # breaks the loop so the user can identify \n # where the demonstrator creation is failed\n break\n \n end\n \n # if the demonstrator is already added to a certain practical, the user is notified by a warning message\n else\n flash[:warning] = \"Student/Staff is already a demonstrator on one of the selected practicals\"\n end\n \n # if the whole demonstrator creation procedure was successful, \n # it sets a feedback message to notify the user about the success\n flash[:notice] = \"Demonstrator added to practical(s)!\" if !failed\n end\n redirect_to add_demonstrator_path #demonstrator_list_path\n \n # if the entered ID is not a valid student or staff ID, it sets an alert message and redirects the user to the add_demontrator page\n else\n flash[:alert] = \"Student/Staff (with ID: #{sam_id}) is not found\"\n redirect_to add_demonstrator_path\n end\n end\n end\n end",
"def create # post \"/authors\" route receives data submitted in form to create new author, and it's mapped to this #create action\n @author = Author.new(author_params) # instantiate author instance with attributes mass assigned from strong params\n # validations are run with #save (which interacts with DB). Instance is only successfully saved to DB if all its attributes are valid\n if @author.save # if the instance is valid b/c all of its attributes are valid, it's successfully saved to DB\n redirect_to author_path(@author) # redirect to show page to show author just created (we re-retrieve instance from DB with new instance variable in show action)\n else # otherwise, the instance is INVALID and is therefore populated with errors (ActiveModel::Errors object)\n render :new # render form to create new author, displaying errors from SAME instance and prefilling fields w/ invalid values submitted beforehand\n end\n end",
"def valid?\n validate_field_types\n # only do a database query if you have good enough data to check the database\n if @errors.length == 0\n if duplicate_user_assignment?\n @errors << \n {message: \n \"The database already has this user and assignment combination. It is record \n #{this_user_and_assignment.id}. Change this assignment or user or the assignment or user of that record.\", \n variabe: \"assignment_id, user_id\"}\n end\n end \n @errors.length == 0\n end",
"def create\n @maint_record = MaintRecord.new(record_params)\n if @maint_record.save\n\n\n redirect_to car_path(@maint_record.car_id) #user show page\n else\n\n render :new\n end\n end",
"def valid?\n @errors = []\n # check thename exists and is not empty\n if name.to_s.empty?\n @errors << {message: \"Name cannot be empty.\", variable: \"name\"}\n end\n \n # check the description exists and is not empty\n if description.to_s.empty?\n @errors << {message: \"Description cannot be empty.\", variable: \"description\"}\n end\n \n # check the description exists and is not empty\n # if studio_id.to_s.empty?\n # @errors << {message: \"Studio id cannot be empty.\", variable: \"studio_id\"}\n # elsif studio.blank?\n # @errors << {message: \"Studio id must be a member of the studios table.\", variable: \"studio_id\"}\n # end \n \n if !studio_id.valid?\n @errors += studio_id.errors\n end\n \n # check the description exists and is not empty\n # if rating_id.to_s.empty?\n # @errors << {message: \"Rating id cannot be empty.\", variable: \"rating_id\"}\n # elsif rating.blank?\n # @errors << {message: \"Rating id must be a member of the ratings table.\", variable: \"rating_id\"}\n # end\n \n if !rating_id.valid?\n @errors += rating_id.errors\n end\n # checks the number of time slots\n if length.to_s.empty?\n @errors << {message: \"Length cannot be empty.\", variable: \"length\"}\n elsif length.is_a? Integer\n if length < 1\n @errors << {message: \"Length must be greater than 0.\", variable: \"length\"}\n end\n else\n @errors << {message: \"Length must be a number.\", variable: \"length\"}\n end\n \n # returns whether @errors is empty\n @errors.empty?\n end",
"def create\n # raise \"hell\"\n @user = User.create(user_params)\n @errors = []\n if @user.email.include? \".\"\n\n if @user.first_name.length > 1 && @user.last_name.length > 1\n #true - check for no special characters and no numbers\n special = \"?<>',?[]}{=-)(*&^%$#`~{}\"\n regex = /[#{special.gsub(/./){|char| \"\\\\#{char}\"}}]/\n if @user.first_name =~ regex || @user.last_name =~ regex\n # contains special char\n @errors << \"Your name cannot contain special characters\"\n session[:errors] = @errors\n redirect_to root_path\n else\n\n def has_digits?(str)\n str.count(\"0-9\") > 0\n end\n\n if has_digits?(@user.first_name)\n @errors << \"Your first name cannot contain numbers\"\n session[:errors] = @errors\n redirect_to root_path\n else\n if has_digits?(@user.last_name)\n @errors << \"Your last name cannot contain numbers\"\n session[:errors] = @errors\n redirect_to root_path\n else\n @user.save\n session[:user] = @user.id\n clear_session(:errors)\n if params[:commit] == 'Sign me up'\n redirect_to success_path\n elsif params[:commit] == 'Build your own newsletter'\n redirect_to build_path\n end\n end\n end\n\n\n end\n else\n @errors << \"Both first and last name must at least be 2 characters long\"\n session[:errors] = @errors\n redirect_to root_path\n end\n else\n @errors << \"An email must contain at least one full stop (.)\"\n session[:errors] = @errors\n redirect_to root_path\n\n end\n end",
"def create\n @user = User.create(user_params)\n unless @user.errors\n redirect_to :signup_success\n else\n render :new\n end\n\n end",
"def validate_form2\n errors = \"\"\n residency_valid = true\n\n # puts \"WE BE VALIDATING #{params[:name]}\"\n # First, clean up any malicious code.\n params[:name] = escape_html(params[:name])\n params[:name_initial] = escape_html(params[:name_initial])\n params[:last_name] = escape_html(params[:last_name])\n params[:mother_last_name] = escape_html(params[:mother_last_name])\n params[:purpose] = escape_html(params[:purpose])\n # params[:birthdate] = escape_html(params[:birthdate])\n params[:birthdate] = params[:birthdate]\n params[:residency_country] = escape_html(params[:residency_country])\n params[:residency_city_state] = escape_html(params[:residency_city_state])\n\n # Store the data so we can show it again in case of\n # errors, using the session.\n session[:name] = params[:name]\n session[:name_initial] = params[:name_initial]\n session[:last_name] = params[:last_name]\n session[:mother_last_name] = params[:mother_last_name]\n session[:purpose] = params[:purpose]\n session[:birthdate] = params[:birthdate]\n session[:residency_country] = params[:residency_country]\n session[:residency_city] = params[:residency_city]\n session[:residency_state] = params[:residency_state]\n\n # Now let's start validation\n if(params[:name].to_s.length == 0 or\n !validate_name(params[\"name\"]))\n errors += \"&name=false\"\n end\n if(params[:name_initial].to_s.length > 0 and\n !validate_name(params[\"name_initial\"]))\n errors += \"&name_initial=false\"\n end\n if(params[:last_name].to_s.length == 0 or\n !validate_name(params[\"last_name\"]))\n errors += \"&last_name=false\"\n end\n # if(params[:mother_last_name].to_s.length == 0 or\n # !validate_name(params[\"mother_last_name\"]))\n # errors += \"&mother_last_name=false\"\n # end\n # maiden name is optional\n if(!validate_name(params[\"mother_last_name\"]))\n errors += \"&mother_last_name=false\"\n end\n if(params[:purpose].to_s.length == 0 or\n !validate_reason(params[\"purpose\"]))\n errors += \"&purpose=false\"\n end\n if(params[:birthdate].to_s.length == 0 or\n !validate_birthdate(params[\"birthdate\"]))\n errors += \"&birthdate=false\"\n end\n\n # check minimum age\n if(params[:birthdate].to_s.length == 0 or\n !validate_birthdate(params[\"birthdate\"], true))\n errors += \"&age=false\"\n end\n\n if(params[:residency_country].to_s.length == 0 or\n !validate_country(params[\"residency_country\"]))\n residency_valid = false\n errors += \"&residency_country=false\"\n end\n\n # if a PR is the country set we proceed\n # to check if we have a municipality set.\n if(residency_valid and params[:residency_country] == \"PR\" and\n !validate_territory(params[:residency_country], params[:residency_city]))\n errors += \"&residency_city=false\"\n end\n\n # if a US is the country set we proceed\n # to check if we have a state set.\n if(residency_valid and params[:residency_country] == \"US\" and\n !validate_territory(params[:residency_country], params[:residency_state]))\n errors += \"&residency_state=false\"\n end\n\n # make sure we deal with any intentional\n # misconfigurations, such as someone playing with\n # html/javascript to submit US as country with PR municipalities\n # etc.\n if(params[:residency_country] == \"US\")\n session[:residency_city] == \"\"\n elsif(params[:residency_country] == \"PR\")\n session[:residency_state] = \"\"\n else\n # otherwise clear it for everything else\n session[:residency_state] = \"\"\n session[:residency_city] = \"\"\n end\n\n # If any errors ocurred, do a redirect:\n if errors.length > 0\n redirect to (\"/form2?errors=true#{errors}\")\n else\n # otherwise, we're good to go on.\n territory = \"\"\n territory += \"#{session[:residency_city]}, \" if session[:residency_city].to_s.length > 0\n territory += \"#{session[:residency_state]}, \" if session[:residency_state].to_s.length > 0\n session[:residence] = \"#{territory}#{session[:residency_country]}\"\n end\nend",
"def create\n @post = Post.create(post_params)\n # byebug\n if @post.valid?\n redirect_to @post\n else \n render :new\n end\n end",
"def create\n #init object with params from form\n @record = Record.new(record_params)\n if @record.save\n redirect_to(records_path) #redirect back to index\n else\n render('new') #renders the form template for resubmission\n end\n end",
"def create\n @question = Question.new(question_params)\n # if the question is saved correctly, it will send a notice. If it is not, it just goes back to the form page.\n if @question.save\n flash[:notice] = \"Question was successfully created.\"\n redirect_to question_path(@question)\n else\n flash[:notice] = \"You messed up.\"\n render :new\n end\n end",
"def create\n @user=User.new(user_create_params)\n if @user.save\n flash[:notice] = [\"Registration Successful! Please Login to enter the Organizations Dashboard App!\"]\n redirect_to \"/\" #redirects to the login view, sessions controller\n else\n flash.now[:notice] = [\"User was not created. See errors below:\"]\n puts \"Errors to display to client for new user create\", @user.errors.full_messages\n flash.now[:errors] = @user.errors.full_messages\n render 'sessions/main'\n end\n end",
"def create\n\n @student = Student.new(student_params)\n #set foreign key to match session id\n @student.user_id = session[:user_id]\n\n if @student.save\n #Need a success flash notice here\n puts \"student was saved\"\n else\n #Need to create a flash error here\n puts \"not saved :(\"\n end\n\n redirect_to '/class-attendance/students'\n end",
"def create\n @employee = Employee.new(employee_params)\n if @employee.save\n flash[:success] = 'Employee was successfully created.'\n else\n flash[:error] = @employee.errors.messages.values.join('<br/>')\n end\n redirect_to employees_path\n end",
"def step_validation\n step_index = form_steps[:pages].index(form_step)\n\n if self.form_steps[:pages].index('title') <= step_index\n self.errors['name'] << 'You must enter a name for the dataset' if self.name.blank? || self.name.strip.blank?\n end\n\n if self.form_steps[:pages].index('connector') <= step_index\n self.errors['type'] << 'You must enter a connector type' unless CONNECTOR_TYPES.include? self.type\n self.errors['provider'] << 'You must enter a connector provider' unless CONNECTOR_PROVIDERS.include? self.provider\n self.errors['connector_url'] << 'You must enter a valid url' \\\n unless self.connector_url && !self.connector_url.blank? && valid_url?(self.connector_url)\n end\n\n if self.form_steps[:pages].index('labels') <= step_index\n unless self.legend && self.legend.is_a?(Hash)\n self.errors['legend'] << 'Labels not correctly defined'\n return\n end\n self.errors['legend'] << 'Latitude and Longitude have to be filled together' if\n self.legend[:lat].blank? ^ self.legend[:long].blank?\n self.errors['legend'] << 'Country and Region have to be filled together' if\n self.legend[:country].blank? ^ self.legend[:region].blank?\n end\n end",
"def create\n #render plain: params[:article].inspect #This line straight up shows the entry you submitted on the browser\n @article = Article.new(article_params) #This creates a new article with the parameters you passed thru the form\n #@article.save #This saves the new article to the database table\n #redirect_to article_path(@article) \n \n if @article.save\n flash[:success] = \"Article was successfully created\"\n redirect_to article_path(@article)\n #else is taken if the validations for article failed\n else\n render 'new'\n end\n end",
"def create_action\n if has_errors?\n render :new, options\n else\n redirect_to resource_location\n end\n end",
"def create\n create! do |success,failure|\n failure.html { redirect_to :back, flash: { :error => \"#{I18n.t(:error_saving)}\" } }\n end\n end",
"def create\n @author = Author.new(author_params)\n @author.save!\n redirect_to authors_path, notice: \"Author created successfully\"\n rescue\n render :new\n end",
"def create\n # render plain: params[:post].inspect #get the inspected parameters filled by the user in the form\n @post = Post.new(post_params) #Create a new post with the supplied post parameters\n if(@post.save) #Saves the post to the database\n redirect_to @post #Redirects to the show method\n else\n render 'new' #If got any errors while saving, render the new.html.erb page and show the error \n end\n end",
"def show_errors\n # TODO: redirect to the member's meeting list?\n redirect_to meetings_path\n end",
"def create\n \t#@person = Person.new(params[:person]) #create a new person\n \t@person = Person.new(post_params) #create a new person using security post\n \tif @person.save #save the person in database, but the rails' feature strong_parameteres doesn't allow to save without specify the fields those are accepted\n \t\tredirect_to @person\n\telse\n\t\tflash[:type] = \"warning\"\n \t\tflash[:message] = \"Please, complete the required fields\"\n\t\trender \"new\"\n\tend\n end",
"def submitTheForm\n user = User.find_by_email(params[:IdeaConsultantEmailAddress])\n if user.nil?\n redirect_to pitches_path, alert: \"you are not an ideator\"\n else\n redirect_to pitches_path, notice: \"The form has been submitted successfuly\"\n end\n end",
"def validate\n # add errors if not validate\n end",
"def create \n # the form displayed in \"new.html.erb\" is submitted to action='/allergens' \n # using verb method=\"post\" which is routed to allergens#create.\n # @allergen, is populated with values (params) submitted from the form\n @allergen = Allergen.new(allergen_params)\n\n if @allergen.save #returns \"false\" if it can't save\n flash[:success] = \"Allergen was successfully created. Products re-checked for new Allergen.\"\n # redirect must be a url, can't render a view template\n # (add '_path' to the prefix to get the url)\n redirect_to allergen_path(@allergen) # index\n else\n # validation error occured. We must render to have access to \n # \"allergens.error.full_messages\" array to display generated errors \n render :new, status: :unprocessable_entity\n #render 'new'\n end\n end",
"def validate\n super\n\n if server.nil?\n errors.add :over_capacity, 'We are currently at capacity, and cannot create your home page. We will fix this shortly. Please come back later and try again, our apologies.'\n end\n\n # TODO regex fails for usernames <= 2 chars, tempfix for now.\n if new? && values[:username].length > 2 && !values[:username].match(VALID_HOSTNAME)\n errors.add :username, 'A valid user/site name is required.'\n end\n\n if new? && values[:username].length > 32\n errors.add :username, 'User/site name cannot exceed 32 characters.'\n end\n\n # Check for existing user\n user = self.class.select(:id, :username).filter(username: values[:username]).first\n\n if user\n if user.id != values[:id]\n errors.add :username, 'This username is already taken. Try using another one.'\n end\n end\n\n if values[:password].nil? || (@password_length && @password_length < MINIMUM_PASSWORD_LENGTH)\n errors.add :password, \"Password must be at least #{MINIMUM_PASSWORD_LENGTH} characters.\"\n end\n\n if !values[:domain].nil? && !values[:domain].empty?\n if !(values[:domain] =~ /^[a-zA-Z0-9.-]+\\.[a-zA-Z0-9]+$/i) || values[:domain].length > 90\n errors.add :domain, \"Domain provided is not valid. Must take the form of domain.com\"\n end\n\n site = Site[domain: values[:domain]]\n if !site.nil? && site.id != self.id\n errors.add :domain, \"Domain provided is already being used by another site, please choose another.\"\n end\n end\n end",
"def create\n @supplier_payment = SupplierPayment.new(params[:supplier_payment])\n #if check_validation\n if @supplier_payment.save\n redirect_to(edit_supplier_payment_path(@supplier_payment), :notice => 'Supplier Payment was successfully created.')\n else\n render :action => \"new\"\n end\n end",
"def create\n @customer_payment = CustomerPayment.new(params[:customer_payment])\n #if check_validation\n if @customer_payment.save\n redirect_to(edit_customer_payment_path(@customer_payment), :notice => 'customer payment was successfully created.')\n else\n render :action => \"new\"\n end\n\n end",
"def create\n @booking = Booking.new(booking_params)\n if @booking.name.blank? \n redirect_to new_booking_path(@booking), :flash => { :warning => \"NOT BOOKED : Please enter Customer Name\" }\n else \n \n respond_to do |format|\n if @booking.save\n format.html { redirect_to @booking, notice: 'Booking was successfully created.' }\n format.json { render :show, status: :created, location: @booking }\n else\n format.html { render :new }\n format.json { render json: @booking.errors, status: :unprocessable_entity }\n end\n end\n end\n end",
"def create\n @supplier_debit_note = SupplierDebitNote.new(params[:supplier_debit_note])\n #if check_validation\n if @supplier_debit_note.save\n redirect_to(edit_supplier_debit_note_path(@supplier_debit_note), :notice => 'Receive From Supplier was successfully created.')\n else\n render :action => \"new\"\n end\n end",
"def create\n @quote = Quote.create(quote_params)\n if @quote.invalid?\n flash[:error] = '<strong>Could not save</strong> the data you entered is invalid.'\n end\n redirect_to root_path\n end",
"def post_processing\n if params['redirect_status'] == 'succeeded'\n flash[:success] =\n 'Payment submitted. Thank you! Please wait a moment and refresh to see your dues updated.'\n else\n flash[:error] =\n 'Payment could not be submitted. Please contact a director for further help.'\n end\n redirect_to(root_url)\n end",
"def new\n unless @student.status_application_form_submitted?\n flash[:error] = \"Invalid step\"\n redirect_to root_path\n return\n end\n end",
"def create\n @user = User.new(user_params)\n if @user.save\n flash[:notice] = \"Thank you for registering. Please check your inbox for confirmation email.\"\n redirect_to \"/login\"\n else\n puts @user.errors.full_messages\n flash[:alert] = @user.errors.full_messages\n puts flash[:alert]\n redirect_to \"/register\"\n end\n end",
"def create\n\t\t@bank_account = BankAccount.new(bank_account_params)\n\t\t@bank_account.last4 = @bank_account.account_number.to_s.split(//).last(4).join(\"\").to_s\n\t\t#Check if the user has entered a correct US postal code\n\t\tcheck_us_postal_code_and_create_bank_account\n\trescue\n\t \tflash[:error] = t('errors.messages.not_saved')\n\t \tredirect_to(:back)\t\t\n\tend",
"def create\n @lesson = Lesson.new(lesson_params)\n\n if @lesson.save\n redirect_to @lesson, notice: 'Lesson successfully logged.' \n else\n render :new\n end\nend",
"def create\n @dog =Dog.new(dog_params)\n# if it saves with the new dog info, send to index.\n if @dog.save\n redirect_to dogs_url, notice: 'successfully saved.'\n else\n# if it doesnt save, bring me back to form view (re-render new dog form)\n flash.now[:notice] = \"Something went wrong. We couldn't save your dog....\"\nrender :new\n\n\n end\n end",
"def create\n # Is email blank?\n if (params[:email].blank?) \n render :new\n flash[:notice] = \"You must enter an email address\"\n else\n \n if (params[:first_name].blank?) \n render :new\n flash[:notice] = \"What's your name pretty lady?\"\n else\n \n if (params[:password].blank?) \n render :new\n flash[:notice] = \"What's your password?\"\n else\n # If no, does user exist?\n \n if @user = User.find_by(email: params[:email])\n \n if @user.authenticate(params[:email], params[:password])\n # If authenticated, log in and redirect to /\n puts \"Redirecting to root url\"\n session[:user_id] = @user.id\n redirect_to user_orders_path(@user.id)\n else\n # If auth fails, render login page with error\n flash.now[:error] = \"This email is already in use.\"\n render :new\n end\n\n else\n # If no, create new user and redirect to account form\n \n @user=User.new\n @user.first_name = params[:first_name]\n @user.email = params[:email]\n @user.password = params[:password]\n @user.save\n session[:user_id] = @user.id\n redirect_to flowers_path\n \n end\n end\n end\nend \nend",
"def create\r\n @post = Post.new(params[:post])\r\n @post.save!\r\n redirect_to post_path(@post)\r\n rescue ActiveRecord::RecordInvalid\r\n render :action => 'new'\r\n end",
"def checkadduser\n \tfirstname = params[:firstname]\n lastname = params[:lastname]\n email = params[:email]\n password = params[:password]\n re_email = params[:retyped_email]\n if firstname.length == 0 or lastname.length == 0 or email.length == 0 or password.length == 0 or re_email.length == 0 \n \t@msg = \"Required fields cannot be empty\"\n \trender :adduser\n \treturn\n end\n if password.length < 8 or password.length > 10 \n\n @msg = \"Password length has to be min 8 chars max 10 chars\"\n render :adduser\n return\n end\n if re_email != email \n\n @msg = \"Both emails has to match\"\n render :adduser\n return\n end\n user_db = User.find_by(email: email)\n\n unless user_db.nil? \n\n @msg = \"Failed to add user email already exists\"\n render :adduser\n else \n User.create(firstname: firstname,lastname: lastname,email: email,password: password)\n\n @msg = \"Successfully added the user. Please login.\"\n render :adduser\n end\n end",
"def create\n @blogger = Blogger.create(blogger_params)\n if @blogger.valid?\n redirect_to @blogger\n else \n render :new\n end\n end",
"def create\n restaurant = Restaurant.new(restaurant_params)\n if restaurant.save\n flash[:notice] = 'Yay'\n# redirect_to root_path\n redirect_to '/'\n else\n flash[:notice] = restaurant.errors.full_messages.to_sentence\n render :action => 'new'\n end\n end",
"def create\n @purchase_requisition = PurchaseRequisition.new(params[:purchase_requisition])\n #if check_validation\n if @purchase_requisition.save\n #@purchase_requisition.add_item(params[:item])\n redirect_to(edit_purchase_requisition_path(@purchase_requisition), :notice => 'Purchase Requisition was successfully created.')\n else\n render :action => \"new\" \n end\n #else\n # initial_data\n # flash[:error] = \"Please fill in the item information\"\n # render :action => \"new\"\n #end\n \n end",
"def submitTheForm\n user = User.find_by_email(params[:IdeaConsultantEmailAddress])\n if user.nil?\n redirect_to pitches_path, alert: \"you are not an ideator\"\n else\n redirect_to pitches_path, notice: \"The form has been submitted successfuly\"\n end\nend",
"def create\n #binding.pry\n # saving the post w/the form values into the database\n @post = Post.new(post_params) #call a new method as params - post in memory\n if @post.save #making active record call to see if we saved in db\n redirect_to post_path(@post) #look at rake routes bundle exec rake routes read right left; rails is smart enough that u don't need @post.id\n else\n # unsuccessful create attempt\n render :new #render new page (most basic flow here)\n end\n end",
"def create\n review = Review.new(review_params)\n if review.save\n flash[:notice] = 'Yay'\n# redirect_to root_path\n redirect_to '/'\n else\n flash[:notice] = review.errors.full_messages.to_sentence\n render :action => 'new'\n end\n end",
"def extra_validations\n success\n end",
"def create\n @place = Place.new(place_params)\n \n #@place added for validates :name, presence: true ELSE error!\n @places = Place.all.order('name asc') \n \n if @place.save\n flash[:success]='New record added'\n redirect_to new_place_path\n else \n flash[:danger]='Denied. Record existed or spaces entered'\n render 'new'\n end\n end",
"def create\n @student = Student.new(params[:student])\n \n flash[:error] = Array.new\n if !@student.is_valid?(flash[:error]) then\n flash.now[:error]\n respond_to do |format|\n format.html { render \"new\" }\n end\n return\n end\n\n respond_to do |format|\n if @student.save\n flash[:notice] = 'Student was successfully created.'\n format.html { redirect_to(@student) }\n format.xml { render :xml => @student, :status => :created, :location => @student }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @student.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create \n @airport = Airport.new(airports_params) \n @airport.save \n flash[:notice] = 'Airport added!' \n redirect_to airports_path \n #else \n # flash[:error] = 'Failed to edit airport!' \n # render :new \n #end \n end",
"def valid?\n @errors = []\n # check thename exists and is not empty\n if name.to_s.empty?\n @errors << {message: \"Name cannot be empty.\", variable: \"name\"}\n end\n \n # check the description exists and is not empty\n if description.to_s.empty?\n @errors << {message: \"Description cannot be empty.\", variable: \"description\"}\n end\n \n # check the description exists and is not empty\n if studio_id.to_s.empty? \n @errors << {message: \"Studio id cannot be empty.\", variable: \"studio_id\"}\n elsif studio.blank?\n @errors << {message: \"Studio id must be a member of the studios table.\", variable: \"studio_id\"}\n end \n \n # check the description exists and is not empty\n if rating_id.to_s.empty?\n @errors << {message: \"Rating id cannot be empty.\", variable: \"rating_id\"}\n elsif rating.blank?\n @errors << {message: \"Rating id must be a member of the ratings table.\", variable: \"rating_id\"}\n end\n \n # checks the number of time slots\n if length.to_s.empty?\n @errors << {message: \"Length cannot be empty.\", variable: \"length\"}\n elsif length.is_a? Integer\n if length < 0\n @errors << {message: \"Length must be greater than 0.\", variable: \"length\"}\n end\n else\n @errors << {message: \"Length must be a number.\", variable: \"length\"}\n end\n \n # returns whether @errors is empty\n @errors.empty?\n end",
"def create\n @validform = Validform.new(validform_params)\n\n respond_to do |format|\n if @validform.save\n format.html { redirect_to @validform, notice: 'Validform was successfully created.' }\n format.json { render :show, status: :created, location: @validform }\n else\n format.html { render :new }\n format.json { render json: @validform.errors, status: :unprocessable_entity }\n end\n end\n end",
"def validate(variables)\n form\tif @_content.empty? # password fields might write hints to the validator...\n clear\n @form_errors = {}\n p = variables\n p.delete(@submit_name)\n \n if @model.new_record? then \n @disabled_on_create.each { |d| p.delete(d) }\n @hidden_on_create.each { |d| p.delete(d) }\n else \n @disabled_on_update.each { |d| p.delete(d) }\n @hidden_on_update.each { |d| p.delete(d) }\n end\n\n # don't save empty passwords!!\n @password_fields ||= []\n @password_fields.each do |pwf|\n p.delete(pwf) if p[pwf].chomp.empty?\n end\n\n # remove possible additional data that model doesn't support to\n# p.delete_if { |k,v| !@mode.respond_to?(\"#{k}=\") }\n\n column_names = @model.class.columns.map { |c| c.name }\n p.each do |k,v|\n @model.send(\"#{k}=\".intern, v) if (column_names.include?(k) && @model.respond_to?(\"#{k}=\")) || @save_attribs.include?(k)\n end\n # @model.attributes = p\n \n return true if @model.valid?\n\n @model.errors.each do |k,v|\n @form_errors[k] = v\n end\n end",
"def create\n\n @new_user = User.new\n\n new_user = @new_user.add(params['user_name'], params['pswd1'], params['email'], params['full_name'])\n\n if new_user.errors.any?\n redirect_to \"/\", :flash => { :error => 'User already exists'}\n else\n redirect_to \"/main\"\n end\n end",
"def create\n \t@micropost = current_user.microposts.build(params[:micropost])\n\n if @micropost.save\n \t\n # Here on success. Already saved in the DB. \n flash[:success] = \"New post accepted\"\n \n # Now, redirect back to the root page to allow more new posts...\n redirect_to root_url\n else\n # Bad data values. Back to home page with null feeds list\n @feed_items = []\n render 'static_pages/home'\n end\n end",
"def create\n # new instance of a card with parameters of card details\n @card = Card.create(card_params)\n # current user info gets associated with card?? ASK\n # if card is valid based on our criteria (validations)\n # then the card will be saved and added to list of all cards\n # and user will be redirected to list of all cards\n if @card.valid?\n @card.save!\n \n redirect_to cards_path\n # if card doesn't fit our criteria, then user will get an\n # error message\n else\n render :new\n flash[:alert] = \"There was an error with your submission\"\n end\n end",
"def create\n @usuario = Usuario.create(ad_params)\n @usuario.save\n\n if @usuario.save\n flash[:success] = \"Bienvenido, gracias por registrarse a Bestnid.!\"\n flash[:success] = \"Sus datos personales son:!\"\n redirect_to @usuario\n else \n render 'new'\n end \nend",
"def create_for\n @user = User.new(user_params)\n if @user.save\n redirect_to root_path\n else\n @errors = @user.errors\n puts @errors.messages\n redirect_to '/users/error'\n end\n end",
"def create\n @diet = Diet.new(diet_params_whitelist)\n if @diet.save\n flash[:success] = \"Diet was created successfully\"\n redirect_to recipes_path\n else\n # pass along the @diet.errors object to new.html.erb, it will flash errors at top of form \n render 'new'\n end\n end",
"def create\n @ingredient = Ingredient.new(ingredient_params_whitelist)\n if @ingredient.save\n flash[:success] = \"Ingredient was created successfully\"\n redirect_to recipes_path\n else\n # pass along the @ingredient.errors object to new.html.erb, it will flash errors at top of form \n render 'new'\n end\n end",
"def register\n\n if !User.find_by_name(params[:user_name]).nil?\n flash[:alert]= \"User Name already taken, please choose another one\"\n render 'index'\n else\n\n user = User.new\n\n if params[:user_name].strip.empty? || params[:password].strip.empty?\n # If user name and password, render index (ask user again)\n render 'index'\n else\n #its checks if the USER NAME has a key or is empty, and if it has a key, it converts to a string and saves it in the database through params\n user_name = params[:user_name].strip\n user.name = user_name\n password = params[:password].strip\n user.password = password\n\n if params.has_key?(:full_name) && !params[:full_name].strip.empty?\n full_name = params[:full_name].strip\n user.full_name = full_name\n end\n\n if params.has_key?(:address) && !params[:address].strip.empty?\n address = params[:address].strip\n user.address = address\n end\n\n if params.has_key?(:city) && !params[:city].strip.empty?\n city = params[:city].strip\n user.city = city\n end\n\n if params.has_key?(:postal) && !params[:postal].strip.empty?\n postal = params[:postal].strip\n user.postal = postal\n end\n\n if params.has_key?(:country) && !params[:country].strip.empty?\n country = params[:country].strip\n user.country = country\n end\n\n #email is linked to the migrate file\n #if nothing is inputed in the text box, then email = \"null\" and inputed into the database as null\n if params.has_key?(:email) && !params[:email].strip.empty?\n email = params[:email].strip\n user.email = email\n end\n\n # Saves user information to table users\n user.save\n\n\n\n if params.has_key?(:phone1) && !params[:phone1].strip.empty?\n phone1 = Phone.new\n phone1.number = params[:phone1].strip\n\n #we are shoveling the phone1 object we made into the merged table\n user.phones << phone1\n\n #we have to save it individually to the number column\n phone1.save\n end\n\n if params.has_key?(:phone2) && !params[:phone2].strip.empty?\n phone2 = Phone.new\n phone2.number = params[:phone2].strip\n user.phones << phone2\n\n phone2.save\n end\n\n if params.has_key?(:phone3) && !params[:phone3].strip.empty?\n phone3 = Phone.new\n phone3.number = params[:phone3].strip\n user.phones << phone3\n\n phone3.save\n end\n\n #we store the user name into a session so we can access it in the info controller\n session[:user_name] = user.name\n\n redirect_to \"/info/display\"\n # text: \"User name is \" + user.name\n\n\n #session[:user_id] = user.id.to_s\n end\n\n end\n\n end",
"def do_create\n begin\n raise 'Passwords do not match' unless request[:password] == request[:checkpass]\n user = Models::User.new\n user.username = request[:username]\n user.email = request[:email]\n user.name = request[:name]\n user.password = request[:password]\n user.save\n flash[:success] = 'New user has been added.'\n redirect('/admin')\n rescue Object => boom\n flash[:error] = \"Error encountered while saving: #{boom}\"\n redirect_referer\n end\n end",
"def create\n @user = User.new(user_params)\n if @user.valid?\n @user.save\n render 'admin_show'\n else\n redirect_to dashboard_new_path\n end\n end",
"def create\n @errors = validate(params[:user])\n if @errors.size < 1\n logged_in_user = LinkedData::Client::Models::User.authenticate(params[:user][:username], params[:user][:password])\n if logged_in_user && !logged_in_user.errors\n login(logged_in_user)\n redirect = \"/\"\n\n if session[:redirect]\n redirect = CGI.unescape(session[:redirect])\n end\n\n\n redirect_to redirect\n else\n @errors << \"Invalid account name/password combination\"\n render :action => 'index'\n end\n else\n render :action => 'index'\n end\n end",
"def create_quiz_questionnaire\n valid = valid_quiz\n if valid.eql?(\"valid\")\n create_questionnaire\n else\n flash[:error] = valid.to_s\n redirect_to :back\n end\n end",
"def create\n @category =Category.new(category_params)\n\n if @category.save\n flash[:success] = \"Category Created\"\n\n #go back to home page\n redirect_to root_path\n\n else\n #if category does not save we want to output some errors\n # we have already got a new.html.erb\n # we want a new form\n render \"new\"\n\n end\n \n \n end",
"def submit(params)\n preload_fields_with(params)\n\n if completely_valid?\n course.save!\n true\n else\n promote_errors(course.errors)\n false\n end\n end",
"def create\n @listing = current_user.listings.create(listing_params)\n if @listing.valid?\n @listing.save!\n redirect_to listing_path(@listing.id)\n else\n flash.now[:messages] = @listing.errors.full_messages\n render :new\n end\nend",
"def check_for_valid_user\n if logged_in? and !current_user.valid?\n flash[:warning] = \"Please create your administrator account\"\n redirect_to edit_user_url(:id => current_user)\n return false\n end\n end",
"def check_for_valid_user\n if logged_in? and !current_user.valid?\n flash[:warning] = \"Please create your administrator account\"\n redirect_to edit_user_url(:id => current_user)\n return false\n end\n end",
"def create\n @post = Post.new(post_params)\n \n if @post.save\n redirect_to admin_posts_path(@post)\n else\n render :new , errors: @post.errors.messages.slice\n\n end\n end",
"def return_safely_to_page(msg = nil, in_errors = nil)\n begin\n flash[:notice] = msg if msg\n flash[:errors] = in_errors if in_errors\n redirect_to(:action=>'index' )\n rescue\n flash[:errors] = \"Error in site navigation, the procedure was completed though\"\n redirect_to(:action=>'index' )\n end\n end",
"def create\n @book = Book.new(book_params)\n \n if @book.save\n flash[:notice] = \"Book successfully added to profile\"\n redirect_to '/'\n else\n if @book.errors[:title].include? 'has already been taken'\n flash[:notice] = \"Book was already in profile\"\n else\n flash[:alert] = \"Failed to add book to profile\"\n end\n redirect_to '/'\n end\n end",
"def create\nrespond_to do |format|\nif @result.save\nformat.html { redirect_to @result, notice: 'Dodano wyniki.' }\nformat.json { render :show, status: :created, location: @result }\nelse\nformat.html { render :new }\nformat.json { render json: @result.errors, status: :unprocessable_entity }\nend\nend\nend",
"def create\n @cat = Cat.new(cat_params)\n if @cat.save # this actually runs the cat.save function and then asks whether or not it is true or false\n redirect_to cat_path(@cat)\n else\n render :new\n end\n end"
] |
[
"0.7159191",
"0.6354729",
"0.6352355",
"0.63414425",
"0.62699723",
"0.6123094",
"0.60799",
"0.6058346",
"0.6008327",
"0.60071665",
"0.599789",
"0.59938365",
"0.5983699",
"0.59812415",
"0.597655",
"0.59649825",
"0.5943817",
"0.5934695",
"0.59044546",
"0.5898384",
"0.5882348",
"0.58752966",
"0.5870568",
"0.58310485",
"0.581699",
"0.5804931",
"0.58047056",
"0.5796907",
"0.57916296",
"0.57898265",
"0.5786525",
"0.57863766",
"0.57784563",
"0.5775206",
"0.57626003",
"0.5758802",
"0.5747503",
"0.57462287",
"0.57400113",
"0.57386225",
"0.573255",
"0.573078",
"0.57307076",
"0.57289577",
"0.57183146",
"0.57110184",
"0.5710614",
"0.57099944",
"0.57092047",
"0.5707322",
"0.5702087",
"0.5701825",
"0.5700727",
"0.5698795",
"0.56945986",
"0.5693348",
"0.56856793",
"0.5684492",
"0.56727093",
"0.566975",
"0.56629413",
"0.5658914",
"0.5655641",
"0.5654421",
"0.5646247",
"0.5645402",
"0.5644737",
"0.56382996",
"0.56295687",
"0.56153035",
"0.5613696",
"0.5610609",
"0.5597298",
"0.5595094",
"0.5585164",
"0.55827284",
"0.5580568",
"0.5576705",
"0.5575406",
"0.55545735",
"0.5553698",
"0.55332386",
"0.5525687",
"0.55249554",
"0.5521693",
"0.5517835",
"0.55150354",
"0.55144227",
"0.55136365",
"0.5511573",
"0.55101293",
"0.55088764",
"0.5508686",
"0.5506078",
"0.5503969",
"0.5503969",
"0.55007255",
"0.54972595",
"0.54955816",
"0.54936266",
"0.5491223"
] |
0.0
|
-1
|
is used to display a specific resource(data) along with the associated resources(data)
|
def show
@item = Item.find(params[:id])
@category = Category.find(@item.category_id)
@review = Review.new
@cart_line_item = CartLineItem.new
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def show_for_resource(identifier)\n styled_header(\"Resource Info\")\n\n resource = resolve_addon!(identifier)\n\n styled_hash({\n 'Name' => resource['name'],\n 'Plan' => resource['plan']['name'],\n 'Billing App' => resource['app']['name'],\n 'Price' => format_price(resource['plan']['price'])\n }, ['Name', 'Plan', 'Billing App', 'Price'])\n\n display(\"\") # separate sections\n\n styled_header(\"Attachments\")\n display_attachments(get_attachments(:resource => resource['id']), ['App', 'Name'])\n end",
"def show_resource_content\n resource_content\n end",
"def show\n @resources_data = ResourcesData.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @resources_data }\n end\n end",
"def show\n @resource = @lode.resource\n end",
"def show\n @resource = find_resource\n end",
"def display_resource(findingaid)\n \"#{findingaid.name}\"\n end",
"def display_resource(recipe)\n \"Recipe ##{recipe.id} - #{recipe.name}\"\n end",
"def ar_show_link resource= @resource\n link_to(controller.ardata.labels[:show], ar_resource_path('', resource))\n end",
"def display_resource(thesis)\n \"Thesis: #{thesis.title}\"\n end",
"def show\n @resource = Resource.find(params[:id])\n end",
"def resource\n\n end",
"def show\n @resource_info = ResourceInfo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @resource_info }\n end\n end",
"def show\n # resource = find_base_resource\n # instance_variable_set(\"@#{resource_name(resource)}\", resource)\n # if block_given?\n # yield(resource)\n # end\n instance_variable_set(\"@#{resource_name}\", find_resource)\n end",
"def show\n @resources_and_link = ResourcesAndLink.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @resources_and_link }\n end\n end",
"def display_resource(practice_content)\n \"PracticeContent ID:#{practice_content.id}\"\n end",
"def show\n self.resource = find_resource\n render :layout => false\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 display_resource(paper)\n paper.title\n end",
"def display_resource(recipe)\n recipe.name\n end",
"def display_resource(recipe)\n recipe.name\n end",
"def display_resource(building)\n \"#{building.name}\"\n end",
"def display_resource(deal)\n \"Deal ##{deal.id} #{deal.item.name}/#{deal.profile.name} #{deal.profile.phone}\"\n end",
"def display_resource(tutor)\n \"#{tutor.full_name} - #{tutor.id}\"\n end",
"def display_resource(product)\n \"#{product.english_title}\"\n end",
"def display_resource(opportunity)\n \"#{opportunity.title} (##{opportunity.id})\"\n end",
"def show\n resource = find_base_resource\n instance_variable_set(\"@#{resource_name(resource)}\", resource)\n if block_given?\n yield(resource)\n end\n end",
"def show_resources\r\n @resources_pages = Paginator.new self, \r\n Resource.count, \r\n Resource.get(\"resources_paginator_count\").to_i, \r\n params[:page] \r\n @resources = Resource.find :all, :order => 'name',\r\n :limit => @resources_pages.items_per_page,\r\n :offset => @resources_pages.current.offset \r\n end",
"def show\n @resource_fields = Field.where(\"resource_type_id = ?\", params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @resource_type }\n end\n end",
"def resource_info\n\n \"content_#{id}\"\n\n end",
"def display_resource(book)\n book.title\n end",
"def show\n @resource = Resource.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @resource }\n end\n end",
"def render_resources\n render :partial => resource_name, :collection => resources_instance_variable\n rescue ActionView::MissingTemplate\n render :partial => 'resource', :collection => resources_instance_variable\n end",
"def display_resource(section)\n section.name\n end",
"def show\n @resource_view = ResourceView.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @resource_view }\n end\n end",
"def display_resource(medium)\n medium.title || \"Medium ##{medium.id}\"\n end",
"def show\n @data_dictionary_field = find_resource(params[:id])\n end",
"def show\n @entry = @resource_finder.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @entry }\n end\n end",
"def show(context)\n set_resource(context)\n\n instance_variable_get(:\"@#{resource_name}\").to_json\n end",
"def resource\n resource_model.find(params[:id])\n end",
"def display_resource(portfolio_wordpress)\n \"#{portfolio_wordpress.post_title} - ##{portfolio_wordpress.ID}\"\n end",
"def render_resources\n render partial: resource_name, collection: resources_instance_variable\n rescue ActionView::MissingTemplate\n render partial: \"resource\", collection: resources_instance_variable\n end",
"def render_resource(r)\n data = {\n \"title\" => r[:title],\n \"content\" => r.html\n }\n\n populate(data)\n end",
"def show\n @engineer = Engineer.find(params[:id])\n @picture = get_resource(get_picture_label)\n @resume = get_resource(get_resume_label)\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @engineer }\n end\n end",
"def show\n @resource = Resource.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @resource }\n end\n end",
"def show\n @resource = Resource.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @resource }\n end\n end",
"def show\n @resource = Resource.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @resource }\n end\n end",
"def show\n @resource = Resource.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @resource }\n end\n end",
"def display_resource(expert)\n \"#{expert.first_name} #{expert.last_name}\"\n end",
"def show\n @resource = Resource.find(params[:id])\n @resource_type = ResourceType.find(@resource.resource_type_id)\n @values = ResourceValue.where(resource_id: params[:id])\n @field_types=[]\n @values.each do |value|\n @field_types << value.Field\n end\n \n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @resource }\n end\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 show\n @mostsmallresource = Mostsmallresource.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @mostsmallresource }\n end\n end",
"def show\n @resources = @incident.resources.order(:category, :order_number)\n @resource = Resource.new\n end",
"def resource\n @resource\n end",
"def resource_details\n @encounter = Encounter.find(params[:id])\n\t#render :layout => \"layouts/popup\"\n respond_to do |format|\n format.html # writeup.html.erb\n format.xml { render :xml => @encounter }\n end\n end",
"def show\n @resource = Resource.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @resource }\n end\n end",
"def show\n @resource = Resource.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @resource }\n end\n end",
"def show\n @resource_type = @resource.resource_type\n @values = ResourceValue.where(\"resource_id = ?\", params[:id])\n @field_types = []\n @values.each do |value|\n if value.field.resource_type_reference_id\n @field_types << Resource.find(value.resource_reference_id).resource_type\n else\n @field_types << value.field.field_type\n end\n end \n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @resource }\n end\n end",
"def detail(resource_id)\n @do_resource_mixin.detail(resource_id)\n end",
"def show\n show! {\n page[:title] = t(\"#{controller_catalog}.show.page_title\", {:name => resource.name})\n record_action!(:read, resource)\n }\n end",
"def show\n @data_object = DataObject.find(params[:id]) \n @data_fields = @data_object.data_type.data_fields\n @data_entries = @data_object.data_entries\n end",
"def show\n @resource = Resource.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @resource }\n end\n end",
"def display_resource(video)\n \"Video ##{video.id} #{video.title}\"\n end",
"def decorate_resource( rsrc )\n rsrc.label = self.channum\n rsrc.title = self.name\n end",
"def show\n @resource = Resource.find(params[:id])\n render json: @resource, status: 200\n end",
"def resource_title\n if resourceful? && resource\n resource.respond_to?(:name) ? resource.name.humanize : resource.id\n else\n 'show'\n end\n end",
"def show\n begin\n @resource = get_relation(params[:id], params[:entity_id])\n render :response => :GET\n rescue Exception => e\n @error = process_exception(e)\n render :response => @error\n end\n \n \n\n end",
"def display_resource(athlete)\n \"#{athlete.first_name} #{athlete.last_name}\"\n end",
"def resource; end",
"def display_resource(rainwork)\n \"RW \\\"#{rainwork.name}\\\"\"\n end",
"def show\n respond_with resource\n end",
"def show\n\n # Define cache headers that lets the content be cached in 350 days.\n # Cache busters in the path to the static resources will make sure they are\n # invalidating when chanced, since the URL will change.\n response.headers['Cache-Control'] = 'public, max-age=30240000'\n\n render :text => resource_data, :content_type => content_type\n\n end",
"def display_resource(team)\n team.name\n end",
"def show\n @resource_file = ResourceFile.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @resource_file }\n end\n end",
"def display_resource(offer)\n \"#{offer.offer_title} por #{offer.user.email}\"\n end",
"def show\n user_profile = UserProfile.new(current_user: current_user)\n\n valid_rn = params[:resource_name]\n if valid_rn.present?\n resource_info = user_profile.resource_info(valid_rn)\n resource = user_profile.current_user_resource_instance(resource_info: resource_info)\n if resource\n resource.current_user = current_user\n # resource_info[:resource_item_name]\n render json: { resource.resource_item_name => resource }\n else\n base_route_segments = resource_info[:base_route_segments]\n unless resource_info[:model].no_master_association\n use_temp_master = \"/masters/#{Master::TemporaryMasterIds.first}\"\n end\n new_path = \"#{use_temp_master}/#{base_route_segments}/new\"\n redirect_to new_path\n end\n\n elsif request.format == :html\n @panels = user_profile.current_user_resource_infos\n render :show\n else\n render json: { user_profile: user_profile.current_user_resource_instances }\n end\n end",
"def as_resource(options = {})\n links = self_link\n\n if is_collection?\n links[:web] = {\n :href => \"#{@@web_url}/#{pk}\"\n }\n end\n \n resource = {\n :id => pk,\n :accession => objectnumber,\n :sort_number => sortnumber,\n :sort_title => sort_title,\n :sort_name => sort_name,\n :constituents => constituents.map {\n |c| c.as_resource({'no_objects' => true, 'no_bio' => true})\n },\n :titles => titles.as_resource,\n :series => series == nil ? nil : series.as_resource,\n :dates => date_resource(datebegin, dateend, dated),\n :sites => sites.count > 0 ? sites.map {\n |s| s.as_resource({'no_objects' => true})} : nil,\n :movements => movements.count > 0 ? movements.map {\n |m| m.as_resource({'no_objects' => true})} : nil,\n :acquisition => acquisition != nil ? \n acquisition.as_resource({'no_objects' => true}) : nil,\n :exhibitions => exhibitions.count > 0 ? exhibitions.map {\n |e| {\n :location => location(e.pk) != nil ? location(e.pk).as_resource : nil,\n :exhibition => e.as_resource({'no_objects' => true})\n }\n } : nil,\n :edition => edition,\n :medium => medium,\n :dimensions => dimensions,\n :credit => creditline,\n :has_essay => has_essay?,\n :has_extended_label => has_essay?,\n :copyright => copyright,\n :current_location => current_location == nil ? \n nil : current_location.as_resource,\n :media => media.count > 0 ? media.map { |m|\n m.as_resource\n } : nil,\n :object_types => object_types.count > 0 ? object_types.map { |t|\n t.as_resource({'no_objects' => true})\n } : nil,\n :permanent_collection => permanent_collection?,\n :recent_acquisition => is_recent_acquisition?,\n :_links => links\n }\n\n if options['no_essay'] != 'true'\n resource[:essay] = essay\n resource[:extended_label] = extended_label\n end\n\n return resource\n end",
"def resource\n @resource\n end",
"def resource\n @resource\n end",
"def show\n render(:partial => 'product_image', :object => resource)\n end",
"def show\n @q_resource = QResource.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @q_resource }\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 @dataset = Dataset.find(params[:id])\n \n @title = @dataset.name + \" : \" + @title\n respond_to do |format|\n format.html # show.html.erb\n # format.xml { render :xml => @dataset.to_xml (:include => [:format_urls, :format_types] ) }\n format.xml { render }\n end\n end",
"def show\n instance_exec(&resource.before_actions[:show]) if resource.before_actions[:show]\n end",
"def show\n case params[:medium]\n when 'videos' then @resources = @user.resources.where(medium_type: %w(VideoUpload VideoLink))\n when 'images' then @resources = @user.resources.where(medium_type: 'Album')\n else\n @resources = @user.resources\n end\n\n @resources = @resources.where(status: 'active') unless @user.eql?(current_user)\n end",
"def display_resource(device)\n \"Device ##{device.to_param}\"\n end",
"def show\n render json: serialize(read_resource(resource), options), status: :ok\n end",
"def edit_resource_content\n resource_content\n end",
"def display_resource(monster)\n monster.name\n end",
"def display_resource(user)\n user.name\n end",
"def show\n @resource = Resource.find(params[:id])\n @terms = Term.all_iit_subjects\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @resource }\n end\n end",
"def show\n @asset = Resource.find(params[:id])\n \n respond_to do |format|\n format.html { render :xml => @asset }# index.html.erb\n format.xml { render :xml => @asset }# index.xml.builder\n format.json { render :json => @asset }# index.xml.builder\n end\n end",
"def display_resource(ticket_sla)\n \"TicketSla ##{ticket_sla.id}\"\n end",
"def show\n @id = params[:id]\n @resource = ActiveFedora::Base.find(@id)\n\n raise ActiveFedora::ObjectNotFoundError if not @resource\n\n authorize! :edit, @resource\n\n raise \"Resource doesn't support DOI functionality\" if not @resource.respond_to? :doi\n\n @metadata_errors = @resource.validate_doi_metadata\n\n if @resource.is_a? Collection\n @presenter = Sufia::CollectionPresenter.new @resource\n @model_class = \"collection\"\n else\n @presenter = Sufia::GenericFilePresenter.new @resource\n @model_class = \"generic_file\"\n end\n end",
"def display_resource(vendor)\n vendor.name\n end",
"def list_item_title resource, title=nil, url=nil\n if title.nil?\n title = get_object_title(resource)\n end\n name = resource.class.name.split(\"::\")[0]\n\n html = \"<div class=\\\"list_item_title\\\">\"\n case name\n when \"DataFile\",\"Model\",\"Sop\"\n image = image_tag(((name == \"Model\") ? icon_filename_for_key(\"model_avatar\"): (file_type_icon_url(resource))), :style => \"width: 24px; height: 24px; vertical-align: middle\")\n icon = link_to_draggable(image, show_resource_path(resource), :id=>model_to_drag_id(resource), :class=> \"asset\", :title=>tooltip_title_attrib(get_object_title(resource)))\n html << \"<p style=\\\"float:left;width:95%;\\\">#{icon} #{link_to title, (url.nil? ? show_resource_path(resource) : url)}</p>\"\n html << list_item_visibility(resource.asset.policy)\n html << \"<br style=\\\"clear:both\\\"/>\"\n when \"Assay\"\n image = image_tag((resource.is_modelling? ? icon_filename_for_key(\"assay_modelling_avatar\") : icon_filename_for_key(\"assay_experimental_avatar\")), :style => \"height: 24px; vertical-align: middle\")\n icon = link_to_draggable(image, show_resource_path(resource), :id=>model_to_drag_id(resource), :class=> \"asset\", :title=>tooltip_title_attrib(get_object_title(resource)))\n html << \"#{icon} #{link_to title, (url.nil? ? show_resource_path(resource) : url)}\"\n when \"Person\"\n html << \"#{link_to title, (url.nil? ? show_resource_path(resource) : url)} #{admin_icon(resource) + \" \" + pal_icon(resource)}\"\n else\n html << \"#{link_to title, (url.nil? ? show_resource_path(resource) : url)}\"\n end\n html << \"</div>\"\n return html\n end",
"def display_resources(document)\n\n resources_count = get_values_from_datastream(document, \"contentMetadata\", [:resource]).length\n resources = \"\"\n\n if resources_count > 0\n \n i = 0\n resources = <<-EOS\n <fieldset id=\"download_fields\">\n <legend>#{pluralize(resources_count,\"Download\")[2..-1]}</legend>\n <div id=\"downloads-list\">\n EOS\n\n resource_title = get_values_from_datastream(document, \"descMetadata\",[:title])\n display_label = get_values_from_datastream(document, \"contentMetadata\",[:resource, :display_label])\n object_id = get_values_from_datastream(document, \"contentMetadata\",[:resource, :resource_object_id])\n ds_id = get_values_from_datastream(document, \"contentMetadata\",[:resource, :resource_ds_id]) \n mime_type = get_values_from_datastream(document, \"contentMetadata\",[:resource, :file, :mime_type])\n format = get_values_from_datastream(document, \"contentMetadata\",[:resource, :file, :format])\n file_size = get_values_from_datastream(document, \"contentMetadata\",[:resource, :file, :size])\n \n sequence = get_values_from_datastream(document, \"contentMetadata\",[:resource,:sequence])\n\n sequence_hash = {}\n sequence.each_with_index{|v,i| sequence_hash[v.to_i] = i }\n \n sequence_hash.keys.sort.each do |seq| \n i = sequence_hash[seq]\n resources << <<-EOS\n <div id=\"download\"> \n\t <div id=\"download_image\" class=\"#{download_image_class_by_mime_type(mime_type[i])}\" ></div>\n <a href=\"/assets/#{object_id[i]}/#{ds_id[i]}\" onClick=\"_gaq.push(['_trackEvent','Downloads', '#{object_id[i]}/#{ds_id[i]}', '#{resource_title}']);\">#{display_label[i]}</a> \nEOS\n \n resources << <<-EOS\n <div id=\"file-size\">(#{get_friendly_file_size(file_size[i])} #{format[i]})\n EOS\n\n #If the content is a KMZ or a KML file and less then 3MB...\n if (mime_type[i].eql?(\"application/vnd.google-earth.kmz\") || mime_type[i].eql?(\"application/vnd.google-earth.kml+xml\"))\n if file_size[i].to_i > 0 && file_size[i].to_i < 3145728\n # And if the document is public readable... We display a link to the Google maps View of the map - Google maps need the KML/KMZ to be public accessible...\n if is_public_readable(document)\n resources << <<-EOS\n <div id=\"view-map-link\">\n <a href=\"/google_map.html?object_id=#{object_id[i]}&ds_id=#{ds_id[i]}\" target=\"_blank\">View as map<a></div>\n EOS\n end\n end\n end\n\n resources << <<-EOS\n </div>\n </div>\n EOS\n\n end\n resources << <<-EOS\n </div>\n </fieldset>\n EOS\n end\n resources.html_safe\n end",
"def display_resources(document)\n\n resources_count = get_values_from_datastream(document, \"contentMetadata\", [:resource]).length\n resources = \"\"\n\n if resources_count > 0\n \n i = 0\n resources = <<-EOS\n <fieldset id=\"download_fields\">\n <legend>#{pluralize(resources_count,\"Download\")[2..-1]}</legend>\n <div id=\"downloads-list\">\n EOS\n\n resource_title = get_values_from_datastream(document, \"descMetadata\",[:title])\n display_label = get_values_from_datastream(document, \"contentMetadata\",[:resource, :display_label])\n object_id = get_values_from_datastream(document, \"contentMetadata\",[:resource, :resource_object_id])\n ds_id = get_values_from_datastream(document, \"contentMetadata\",[:resource, :resource_ds_id]) \n mime_type = get_values_from_datastream(document, \"contentMetadata\",[:resource, :file, :mime_type])\n format = get_values_from_datastream(document, \"contentMetadata\",[:resource, :file, :format])\n file_size = get_values_from_datastream(document, \"contentMetadata\",[:resource, :file, :size])\n \n sequence = get_values_from_datastream(document, \"contentMetadata\",[:resource,:sequence])\n\n sequence_hash = {}\n sequence.each_with_index{|v,i| sequence_hash[v.to_i] = i }\n \n sequence_hash.keys.sort.each do |seq| \n i = sequence_hash[seq]\n resources << <<-EOS\n <div id=\"download\"> \n\t <div id=\"download_image\" class=\"#{download_image_class_by_mime_type(mime_type[i])}\" ></div>\n <a href=\"/assets/#{object_id[i]}/#{ds_id[i]}\" onClick=\"_gaq.push(['_trackEvent','Downloads', '#{object_id[i]}/#{ds_id[i]}', '#{resource_title}']);\">#{display_label[i]}</a> \nEOS\n \n resources << <<-EOS\n <div id=\"file-size\">(#{get_friendly_file_size(file_size[i])} #{format[i]})\n EOS\n\n #If the content is a KMZ or a KML file and less then 3MB...\n if (mime_type[i].eql?(\"application/vnd.google-earth.kmz\") || mime_type[i].eql?(\"application/vnd.google-earth.kml+xml\"))\n if file_size[i].to_i > 0 && file_size[i].to_i < 3145728\n # And if the document is public readable... We display a link to the Google maps View of the map - Google maps need the KML/KMZ to be public accessible...\n if is_public_readable(document)\n resources << <<-EOS\n <div id=\"view-map-link\">\n <a href=\"/google_map.html?object_id=#{object_id[i]}&ds_id=#{ds_id[i]}\" target=\"_blank\">View as map<a></div>\n EOS\n end\n end\n end\n\n resources << <<-EOS\n </div>\n </div>\n EOS\n\n end\n resources << <<-EOS\n </div>\n </fieldset>\n EOS\n end\n resources.html_safe\n end",
"def display_resource(project)\n project.name\n end",
"def display_resource(club)\n club.name\n end",
"def show\n begin\n @resource = Entity.find params[:id]\n render :response => :GET\n rescue Exception => e\n @error = process_exception(e)\n render :response => :error\n end\n end",
"def ar_label resource= @resource\n return controller.ardata.labels[:nil_value_in_field] unless resource\n if controller.ardata.links.include? :show\n link_to(resource.label || \"-\", ar_resource_path('', resource))\n else\n resource.label || \"-\"\n end\n end"
] |
[
"0.73300344",
"0.7196806",
"0.70932996",
"0.70901185",
"0.68900746",
"0.6803851",
"0.6753969",
"0.67305934",
"0.6683125",
"0.66748",
"0.66573083",
"0.66536033",
"0.66448855",
"0.66190106",
"0.65899",
"0.65740675",
"0.6519679",
"0.6482815",
"0.64824617",
"0.64824617",
"0.64624465",
"0.6445526",
"0.6436573",
"0.63879186",
"0.63839656",
"0.637953",
"0.63765556",
"0.6374307",
"0.6370503",
"0.63659555",
"0.6357982",
"0.6353117",
"0.63503575",
"0.63396776",
"0.63375545",
"0.6332406",
"0.63188875",
"0.6310636",
"0.6296629",
"0.62943953",
"0.6267743",
"0.62666005",
"0.62534815",
"0.6252041",
"0.6252041",
"0.6252041",
"0.6252041",
"0.6233315",
"0.6218861",
"0.6217382",
"0.62085676",
"0.6195798",
"0.61927956",
"0.6192557",
"0.6189395",
"0.6189395",
"0.6186072",
"0.617535",
"0.6170288",
"0.6169997",
"0.6166589",
"0.61654526",
"0.61582035",
"0.61537546",
"0.6144517",
"0.6144297",
"0.6144189",
"0.61385375",
"0.61343884",
"0.6131645",
"0.61221975",
"0.6117346",
"0.6114124",
"0.6111938",
"0.61098343",
"0.6106239",
"0.6104595",
"0.6104595",
"0.6101756",
"0.6098777",
"0.6096682",
"0.607854",
"0.6075919",
"0.6049689",
"0.6030924",
"0.60238266",
"0.6003024",
"0.6002024",
"0.5997977",
"0.5970219",
"0.59682477",
"0.5965101",
"0.59642655",
"0.59611374",
"0.59578425",
"0.5953213",
"0.5953213",
"0.5950557",
"0.5937626",
"0.59333247",
"0.5931964"
] |
0.0
|
-1
|
strong parameters used to prevent from mass assignment web attack
|
def item_params
params[:item].permit(:name,:price,:stock,:description,:category_id,:cod_available, :release_datetime, :image_url)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def student_params(*args) #is the helper method \n\n\t\tparams.require(:student).permit(*args)\n\t\t#uses .require and .permit methods as stronger params to prevent hacks through inspect element right click edit html \n\t\t#require restricts, permit allows, and *args is for the custom arguments\n\tend",
"def permitir_parametros\n \t\tparams.permit!\n \tend",
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def strong_params\n params.require(:education).permit(param_whitelist)\n end",
"def strong_params\n params.require(:experience).permit(param_whitelist)\n end",
"def paramunold_params\n params.require(:paramunold).permit!\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 strong_params\n params.require(:community).permit(param_whitelist)\n end",
"def safe_params\n params.permit(:id, :name, :origin, :emails => []); #emails is an array\n end",
"def strong_params\n params.require(:team_member).permit(param_whitelist)\n end",
"def secure_params(require_param, permit_keys)\n params.require(require_param).permit(*permit_keys)\n end",
"def safe_params\n params.require(:user).permit(:name)\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def safe_params\n safe_attributes = %i[name key]\n params.require(:role).permit(safe_attributes)\n end",
"def quote_params\n params.permit!\n end",
"def permitted=(_arg0); end",
"def pointless_params\n params.require(:pointless).permit(:title, :content)\n end",
"def user_params \n \tparams.require(:user).permit(:name, :email, :password, :password_confirmation)# preventing CSTR\n end",
"def safe_product_params\n\t\tparams.require(:product).permit(:name,:price)\n\t\t#don't permit ids\n\t\t#single :product\n\tend",
"def droptraining_params\n params.permit(:training_id,:user_id, :utf8, :authenticity_token, :commit)\n end",
"def good_params\n params.permit(:title)\n end",
"def secure_params\n return @secure_params if @secure_params\n\n defn = implementation_class.definition\n field_list = [:master_id] + defn.field_list_array\n\n res = params.require(controller_name.singularize.to_sym).permit(field_list)\n res[implementation_class.external_id_attribute.to_sym] = nil if implementation_class.allow_to_generate_ids?\n @secure_params = res\n end",
"def params=(_); end",
"def sensitive_params=(params)\n @sensitive_params = params\n end",
"def less_active_member_params\n clean_params = params.require(:less_active_member).permit(:surname, :given_name, :current_address, :new_address, :new_phone, :reference, :new_note, :resources, tag_list: [])\n clean_params.merge!({current_user_id: current_user.id}) unless current_user.nil?\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 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 specialty_params\n\t\tparams.require(:specialty).permit(*Specialty::DEFAULT_ACCESSIBLE_ATTRIBUTES)\n\tend",
"def some_thing_params\n params.require(:some_thing).permit(:val)\n end",
"def safe_params\n params.require(:safe).permit(:game_id, :sTime, :player_id)\n end",
"def strong_parameters\n\t\t\tattrs = self.attribute_names - [\"created_at\", \"updated_at\", \"id\"]\n\t\t\tattrs.push(:_color) if colored? # add the color attribute to the permitted attributes if the object is colorable\n\t\t\tif is_encrypted? # add the color attribute to the permitted attributes if the object is colorable\n\t\t\t\tattrs.push(:_inki_password) \n\t\t\t\tattrs.push(:_inki_password_confirmation) \n\t\t\tend\n\t\t\tattrs.collect do |a|\n\t\t\t\ta.to_sym\n\t\t\tend\n\t\tend",
"def ensure_redirected_params_are_safe!(passed_params)\n unless passed_params.is_a?(ActionController::Parameters) && passed_params.permitted?\n error_message = if passed_params.is_a?(ActionController::Parameters)\n unsafe_parameters = passed_params.send(:unpermitted_keys, params)\n \"[Rails::Prg] Error - Must use permitted strong parameters. Unsafe: #{unsafe_parameters.join(', ')}\"\n else\n \"[Rails::Prg] Error - Must pass strong parameters.\"\n end\n raise error_message\n end\n end",
"def valid_params?; end",
"def permitted_strong_parameters\n :all #or an array of parameters, example: [:name, :email]\n end",
"def hot_master_params\n params.require(:hot_master).permit(:a, :b, :c, :d, :e, :f, :g, :h, :i, :j, :aa, :ab, :ac, :ad, :ae, :af, :ag, :ah, :ai, :aj, :ba, :bb, :bc, :bd)\n end",
"def safe_params\n params.except(:host, :port, :protocol).permit!\n end",
"def user_strong_params\n html_safe(params[:user]).strip\n end",
"def unsolved_params\n \n end",
"def model_params\n \tparams.require(:school).permit(\n \t\t:school_name,\n \t\t:user_name,\n \t\t:password,\n \t\t:address_line_1,\n \t\t:address_line_2,\n \t\t:city,\n \t\t:state,\n \t\t:zip,\n \t\t:phone,\n \t\t:teachers_attending\n \t)\n end",
"def student_params\n params.require(:student).permit!\n end",
"def strong_params_keys\n [key]\n end",
"def sanitized_allowed_attributes=(attributes); end",
"def sanitized_allowed_attributes=(attributes); end",
"def reserved_params\n params.require(:reserved).permit(:name, :email, :pax, :address, :KTP, :title)\n end",
"def opp_params #Purpose of the opp params is for security purposes against hackers these are strong parameters\n\t\tparams.require(:opp).permit(:title, :text)\n\tend",
"def update_sanitized_params\n\t\t\tdevise_parameter_sanitizer.for(:sign_up) {|u| u.permit(:name, :email, :password, :password_confirmation)}\n\t\tend",
"def activity_params \n \n raw_parameters = { \n :activity_Name => \"#{params[:activity_name]}\",\n :active => \"#{params[:active]}\",\n :activity_description => \"#{params[:activity_description]}\",\n :is_page => \"#{params[:is_page]}\"\n }\n parameters = ActionController::Parameters.new(raw_parameters)\n parameters.permit( :activity_Name, :active, :activity_description, :is_page)\n \n end",
"def strong_params\n params.require(:applicant).permit(\n :first_name,\n :last_name,\n :email,\n :resume,\n :website_url,\n :linkedin_url,\n :phone_number\n )\n end",
"def sample_params\n\t\t params.permit(\n\t\t \t:user_id,\n\t\t \t:contact_id, \n\t\t \t:company_id, \n\t\t \t:inquiry_id, \n\t\t \t:quote_id, \n\t\t \t:product_id, \n\t\t \t:name, \n\t\t \t:status, \n\t\t \t:note_to_receiver, \n\t\t \t:note_to_sales, \n\t\t \t:price, \n\t\t \t:lead_time, \n\t\t \t:street, \n\t\t \t:suite,\n\t\t \t:city, \n\t\t \t:state, \n\t\t \t:zip_code, \n\t\t \t:shipping_method, \n\t\t \t:drop_ship, \n\t\t \t:custom_color, \n\t\t \t:custom_length, \n\t\t \t:custom_width, \n\t\t \t:custom_other, \n\t\t \t)\n\t\t 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 user_params #este metodo SE PUEDE LLAMAR COMO QUIERAS, pero es necesario para que al crear un objeto se autorice su creacion (porque si no nos podrían meter codigo malicioso)\n\t\tparams.require(:user).permit(:name, :email, :password)\n\tend",
"def <%= singular_name %>_params\n params.require(:<%= singular_name %>).permit(<%= attributes_allowed %>)\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 params_permit\n params.permit(:id)\n end",
"def permit_data # for filter data pass from client , can put any name\n params.require(:data).permit( # this :data is root passed from client (writer function in store)\n \"id\",\n \"code\",\n \"name\",\n \"khr_name\",\n \"start_date\",\n \"end_date\",\n \"academic_year_id\",\n \"description\"\n # \"campus_id\",\n # \"is_deleted\"\n\n )\n end",
"def engagement_params\n #params.require(:branch).permit(:name, :active, :user_id)\n\n raw_parameters = { :name => \"#{params[:name]}\", :active => \"#{params[:active]}\", :user_id => \"#{params[:user_id]}\", :description => \"#{params[:description]}\" }\n parameters = ActionController::Parameters.new(raw_parameters)\n parameters.permit(:name, :active, :description, :user_id)\n \n end",
"def permit(*permitted)\n hardened_params = params.dup\n\n hardened_params.keep_if { |k, _v| permitted.flatten.include?(k.to_sym) }\n\n hardened_params.symbolize_keys\n end",
"def sanitize_parameters!(sanitizer, params)\n # replace :readwrite with :onlyif\n if params.has_key?(:readwrite)\n warn \":readwrite is deprecated. Replacing with :onlyif\"\n params[:onlyif] = params.delete(:readwrite)\n end\n\n # add default parameters\n bindata_default_parameters.each do |k,v|\n params[k] = v unless params.has_key?(k)\n end\n\n # ensure mandatory parameters exist\n bindata_mandatory_parameters.each do |prm|\n if not params.has_key?(prm)\n raise ArgumentError, \"parameter ':#{prm}' must be specified \" +\n \"in #{self}\"\n end\n end\n\n # ensure mutual exclusion\n bindata_mutually_exclusive_parameters.each do |param1, param2|\n if params.has_key?(param1) and params.has_key?(param2)\n raise ArgumentError, \"params #{param1} and #{param2} \" +\n \"are mutually exclusive\"\n end\n end\n end",
"def sanitize_params_for user, params, allowed_params\n params.each do |key, val|\n #if allowed_params.include?(key)\n #sanitize!(user, params, key) if key =~ /_attributes|_ids$/\n #else\n #params.delete(key)\n #end\n params.delete(key) unless allowed_params.include?(key.to_sym)\n end\n end",
"def squeak_params\n # {controller=>\"squeaks\", action=>\"create\", id=>3, squeak=>{body=>\"this is the body\", author_id=>7}}\n params.require(:squeak).permit(:body, :author_id)#with authentification, you wouldn't put author_id here\n # what this means:\n # top level of key in the hash, pointing to antoher hash of key of body and author_id pointing to corresponding values\n # params:\n # <ActionController::Parameters {\"squeak\"=>{\"body\"=>\"I am a squeak\", \"author_id\"=>\"1\"}, \"controller\"=>\"squeaks\", \"action\"=>\"create\"} permitted: false>\n # squeak_params:\n # <ActionController::Parameters {\"body\"=>\"I am a squeak\", \"author_id\"=>\"1\"} permitted: true>\n # \n end",
"def expected_permitted_parameter_names; 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 registration_params\n hash = params.permit(:object_type, :admin_policy, :metadata_source, :rights,\n :collection, :other_id, tag: [])\n hash[:source_id] = params.require(:source_id)\n hash[:label] = params.require(:label)\n hash\n end",
"def check_params; true; end",
"def valid_params_request?; end",
"def model_params\n\t\tparams.require(:competitor).permit(\n \t\t:first_name,\n \t\t:last_name,\n \t\t:address_line_1,\n \t\t:address_line_2,\n \t\t:city,\n \t\t:state,\n \t\t:zip,\n \t\t:grade,\n \t\t:email,\n :school_id,\n :team_id\n \t\t\t)\n\tend",
"def special_params\n params.require(:special).permit(:info)\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 billable_params\n #params.require(:branch).permit(:name, :active, :user_id)\n\n raw_parameters = { :name => \"#{params[:name]}\", :description => \"#{params[:description]}\", :active => \"#{params[:active]}\" }\n parameters = ActionController::Parameters.new(raw_parameters)\n parameters.permit(:name, :description, :active)\n \n end",
"def player_strong_params\n params.require(:player_strong).permit(:presence, :project_strong_id, :name, :surname, :photopath, :group_type_id, :city, :country, :old, :weight, :height, :description)\n end",
"def secure_params\n return @secure_params if @secure_params\n\n @implementation_class = implementation_class\n resname = @implementation_class.name.ns_underscore.gsub('__', '_').singularize.to_sym\n @secure_params = params.require(resname).permit(*permitted_params)\n end",
"def messy_params\n #params.permit(:total_score, :mess, :smell, :user_id)\n params.fetch(:messy, {}).permit(:total_score, :mess, :smell, :dust, :user_id)\n end",
"def params=(hash); end",
"def params=(hash); end",
"def initialize( params )\n super( Parametrization.permit( params, whitelist, model_name ) )\n @params = @params.with_indifferent_access # After building the internal params hash, make it a little friendlier.\n end",
"def post_card_params\n params[:post_card].permit!\n end",
"def branch_params\n params[:branch].permit(:store_id,:branch_name,:branch_description,:email_address,:phone_number,:website_url,:addr_floor,:addr_unit,:addr_block,:addr_street,:addr_building,:city,:state,:zip, user_ids: [])\n end",
"def will_params\n wills = params.select { |k, _v| k.starts_with?(\"vault_entry_\") }\n permitted_params = {}\n wills.keys.each do |will|\n permitted_params[will] = [:id, :title, :executor_id, :notes, :agent_ids, :document_id, primary_beneficiary_ids: [], secondary_beneficiary_ids: [], share_ids: [], share_with_contact_ids: []]\n end\n wills.permit(permitted_params)\n end",
"def question_params\n params.require(:survey_question).permit(question_whitelist)\n end",
"def need_params\n params.require(:need).permit(Need.safe_attributes)\n end",
"def capsule_params #strong params\n params.require(:capsule).permit(:name) # param requires a key of capsule and within that key permit a key of name \n #permit a key of name\n end",
"def permitted_params\n params.permit user: [:email, :password, :password_confirmation, :remember_me, :barcode, :alt_barcodes, :first_name, \n :last_name, :alt_email, :school_id]\n end",
"def entry_params\n\t params.permit(:guid, :click_bait)\n\t end",
"def grant_params\n @whitelisted = params.require(:grant).permit(:name, :description, :agency_id, :acronym)\n end",
"def allowed_attributes=(_arg0); end",
"def allowed_attributes=(_arg0); end",
"def share_params\n# params.fetch(:share, {})\n params.fetch(:share).permit(:email, :view_perm, :analyze_perm, :export_perm, :download_perm)\n end",
"def strong_params\n params.require(:success_metric).permit(param_whitelist)\n end",
"def attr_params\n params[:attr].permit(:name, :type, :value, :foreign_key, :ordinal, :group, :visible, :editable, :required, :input)\n end",
"def parameters=(_); end",
"def analise_privacidade_params\n #params.require(:analise_privacidade).permit(:rede_social, :url_rede_social, :descricao_analise, tipo_coumunicacoes_attributes: [:id, :tipo_comunicacao, :observacao])\n \n \n params.require(:analise_privacidade).permit!\n \n \n \n \n \n end",
"def car_safe_params\n params.require(:car_safe).permit(:car_model_id, :airbagdrivingposition, :airbagfrontpassenger, :airbagfrontside, :airbagfronthead, :airbagknee, :airbagrearside, :airbagrearhead, :safetybeltprompt, :safetybeltlimiting, :safetybeltpretightening, :frontsafetybeltadjustment, :rearsafetybelt, :tirepressuremonitoring, :zeropressurecontinued, :centrallocking, :childlock, :remotekey, :keylessentry, :keylessstart, :engineantitheft)\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 student_params\n params.require(:student).permit(:fname, :lname, :email, :password, :isAdmin)\n end",
"def safe_movie_params\n\t\treturn params.require(:movie).permit(:title, :description, :year_released)\n\tend",
"def student_params\n params.require(:student).permit(:email, :name, :password, :edu_level, :book_limit, :university_id)\n end",
"def house_params\n params.fetch(:house, {}).permit!\n end",
"def role_master_params\n # params.require(:role_master).permit(:role_name)\n raw_parameters = { :role_name => \"#{params[:role_name]}\", :active => \"#{params[:active]}\", :description=> \"#{params[:description]}\" }\n parameters = ActionController::Parameters.new(raw_parameters)\n parameters.permit(:role_name, :active, :description)\n end",
"def personal_params\n params.require(:amount)\n params.permit(:amount)\n end",
"def social_account_params\n\t\t\tparams.require(:social_account).permit!\n\t\tend",
"def student_params\n params.require(:student).permit( :name,:father_name,:tracking_id, :session,:stream,:m_o_level_stream,:graduation_year,:matric_percentage,:o_level_grades,:DOB,:gender,:address1,:address2,:address3,:city,:district,:province,:mobile_number,:phone_number,:monthly_income,:income_range,:boarder, :email, :username, :password)\n end"
] |
[
"0.712205",
"0.7113655",
"0.70037556",
"0.6983433",
"0.6875035",
"0.6853846",
"0.6761016",
"0.67413783",
"0.67345095",
"0.6715525",
"0.6636251",
"0.66338116",
"0.6627648",
"0.6618234",
"0.6609441",
"0.6597091",
"0.65825504",
"0.6572082",
"0.65184814",
"0.65035963",
"0.6479663",
"0.6456327",
"0.6455745",
"0.6453703",
"0.6441873",
"0.64418364",
"0.639606",
"0.6372684",
"0.637046",
"0.6349834",
"0.63340276",
"0.63326967",
"0.63218313",
"0.63001543",
"0.6298953",
"0.6295469",
"0.6288979",
"0.6288436",
"0.6283407",
"0.62760156",
"0.6274758",
"0.62691885",
"0.62691885",
"0.62690324",
"0.626225",
"0.62590295",
"0.62524617",
"0.6242164",
"0.6240271",
"0.624012",
"0.62383956",
"0.6225791",
"0.6220988",
"0.6217757",
"0.62089664",
"0.62062037",
"0.62050855",
"0.62025106",
"0.62001336",
"0.61988485",
"0.6191364",
"0.6188511",
"0.6188299",
"0.6185719",
"0.6184801",
"0.61810404",
"0.6175952",
"0.61706936",
"0.6168851",
"0.6159275",
"0.6151749",
"0.61501116",
"0.61493784",
"0.61493784",
"0.61417574",
"0.61410844",
"0.61388797",
"0.6137573",
"0.61348665",
"0.61341286",
"0.6130406",
"0.6127377",
"0.6121525",
"0.6116651",
"0.61119574",
"0.61119574",
"0.6108648",
"0.61014014",
"0.60984313",
"0.6097431",
"0.6096867",
"0.6096701",
"0.60966235",
"0.60960513",
"0.60918707",
"0.6086369",
"0.6081987",
"0.60814595",
"0.6078946",
"0.60778207",
"0.6072222"
] |
0.0
|
-1
|
in the array. The array will never be empty and the numbers will always be positive integers. given an array of integer calculate the average of all numbers numbers are all > 0 iterate over array , sum them and divide by the size of the array
|
def average(array)
return 0 if array.empty?
array.sum / array.size
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def average(array)\n sum = 0\n\n if array.empty? || array.index {|x| x > 0} == 1\n puts \"Your array may be empty or contain negative intergers\"\n else\n array.each do |int|\n sum +=int\n end\n sum /= array.size\n end\nend",
"def average(array)\n if array.size <= 0\n return 0.0\n end\n return sum(array) / array.size\nend",
"def average (array)\n if array.empty? then\n 0\n else\n (sum(array)/array.size)\n end\nend",
"def average(array)\n sum = 0\n array.each do |int|\n sum += int\n end\n sum / array.length\nend",
"def non_zero_array_average(arr)\n debug_puts \"average of the entire array = #{arr.inject{ |sum, el| sum + el }.to_f / arr.size}\"\n arr.delete(0)\n debug_puts \"average of the non-zero numbers in the array = #{arr.inject{ |sum, el| sum + el }.to_f / arr.size}\"\n return arr.inject{ |sum, el| sum + el }.to_f / arr.size\n end",
"def average_array(array)\n array.each do |ele|\n raise \"All member must be numbers\" if !(ele.instance_of?(Integer))\n end\n\n array.sum / array.length.to_f\nend",
"def find_average \n result = array.sum(0.0)/array.size\n return result\n end",
"def average(array)\n total = 0\n array.each do |number|\n total = total + number\n end\n total / array.size\nend",
"def average(anArray)\n if anArray.empty? then\n return 0.0\n else\n return sum(anArray) / anArray.size\n end \nend",
"def average(anArray)\n avg = 0\n sum = sum(anArray)\n if (anArray.length > 0) then\n avg = sum / anArray.length\n else\n return 0\n end\nend",
"def average(num_array)\n sum = 0\n num_array.each { |num| sum += num }\n sum / num_array.length\nend",
"def average (anArray)\n if (anArray.length <= 0)\n return 0.0;\n else\n return sum(anArray) / anArray.length;\n end\nend",
"def mean(arr)\n return 0 if arr.empty?\n sum = 0\n\n arr.each do |num|\n sum = sum + num\n end\n \n sum / arr.count\nend",
"def average(array)\n total = 0\n array.each do |number|\n total += number\n end\n total / array.length\nend",
"def average(array)\n sum = 0\n array.each { |value| sum += value }\n sum / array.length\nend",
"def average(array)\n total = 0\n array.each do |num|\n total += num\n end\n total.to_f / array.size\nend",
"def average(integer_array)\n sum = integer_array.sum\n average = sum / integer_array.size\nend",
"def calc_mean(ary)\n if !ary.is_a?(Array)\n 0\n elsif ary.empty?\n 0\n else\n # Your code goes here \n\n #add the numbers \n #divide by the amount of numbers in array\n temp = 0\n ary.each do |index|\n temp = temp + index\n\n end\n\n mean = temp / ary.size\n\n return mean\n end\nend",
"def average(array)\n total = 0\n array.each { |num| total += num }\n total / array.length\nend",
"def average(array)\n if !array.is_a?(Array)\n return nil\n else \n sum = 0\n array.each do |i|\n sum += i\n end\n return sum / (array.length * 1.0)\n end\nend",
"def average_of_array(array)\n (1.0*array.inject{|sum, ele| sum + ele}/array.length).round(0)\nend",
"def average(array)\n i = 0\n sum = 0\n while i < array.length\n sum += array[i].to_int\n i += 1\n end\n return (sum.to_f / array.length.to_f)\nend",
"def average\n @array.inject(0.0) {|total, n| total + n} / @array.size\n end",
"def average arr\n sum = 0\n arr.each {|i| sum += i}\n average = sum/(arr.size) \nend",
"def average (anArray)\n\n\t#if the array is empty...\n\tif anArray.empty?\n\t\treturn 0.0\n\n\t# otherwise, return the sum divided by the number of values\n\telse\n\t\treturn sum(anArray) / anArray.size\n\tend\nend",
"def average(array)\n sum = 0\n array.each { |n| sum += n }\n average = sum / array.count\nend",
"def average(anArray)\n\tif anArray.size > 0 then\n\t\treturn sum(anArray) / anArray.size\n\telse\n\t\treturn 0.0\n\tend\nend",
"def average(input_array)\n sum = 0\n \n input_array.each {|num| sum += num}\n \n average = sum.to_f/input_array.length\nend",
"def average(array)\n return sum(array)/array.length \nend",
"def array_average arr\n arr_sum = 0.0\n\n arr.each do |num|\n arr_sum += num\n end\n\n arr_avg = arr_sum / arr.size\nend",
"def average_of_array(array)\n\tn = [10, 15, 25]\n\taverage = n.inject(0.0) { | total, num | total + num } / n.count\n\taverage.round\nend",
"def average_of_array(array)\n (array.sum).to_f / (array.length)\nend",
"def average(array)\n array.inject(&:+) / array.length\n end",
"def average(array)\n result = array.inject { |sum, n| sum + n }\n result / array.size\nend",
"def average_of_array(array)\n sum = 0\n array.each {|x|\n sum += x\n }\n (sum.round(2) / array.size).round\nend",
"def mean array\n length = array.length\n sum = 0 \n array.each do |x|\n sum += x\n end\n sum / length\nend",
"def average(array)\n sum = 0\n array.each { |x| sum += x }\n (sum / array.count).to_f\nend",
"def averages(array)\n return [] if !array.is_a? Array\n averages_array = []\n array.each_index do |index|\n unless array[index + 1].nil?\n sum = (array[index] + array[index + 1])\n sum % 2 == 0 ? averages_array << sum / 2 : averages_array << sum / 2.0\n end\n end\n averages_array\nend",
"def average(arry)\n sum = 0\n size = arry.size\n \n for num in arry \n sum += num\n end\n \n sum / size\nend",
"def average(array)\n array.inject(:+).to_f / array.size\nend",
"def average(arr)\n arr.sum / arr.size\nend",
"def average(input_array)\n i = 0\n sum = 0\n while i < input_array.length\n sum += input_array[i]\n i += 1\n end\n\n average = sum.to_f/input_array.length\nend",
"def average(arr)\n sum = arr.reduce(:+)\n sum / arr.size\nend",
"def average(array)\n sum = array.reduce(:+)\n sum.to_f / array.size.to_f\nend",
"def average(array)\n array.sum / array.size.to_f\nend",
"def average(arr)\ncounting_variable = 0\narr.each {|element| counting_variable += element }\ncounting_variable / arr.length\nend",
"def find_average(array)\n array.sum / array.size.to_f\nend",
"def average(array)\n result = array.inject(:+)\n result / array.count\nend",
"def average(array)\n average = array.sum / array.count\nend",
"def mean(array)\n total = 0.0\n array.each do |value|\n total += value\n end\n total / array.size\nend",
"def average_of_array(array)\n (array.inject(:+) / array.size.to_f).round\nend",
"def average(arr)\n int = 0\n arr.each { |num| int += num }\n int / arr.length.to_f\nend",
"def average(array)\n array.reduce(:+) / array.size\nend",
"def average(array)\n array.reduce(:+) / array.size\nend",
"def average(input_array)\n n = input_array.length\n sum = 0 \n\n input_array.each do |num|\n sum = sum + num\n end\n average_of_array = sum.to_f / n\nend",
"def average_of_array(array)\n sum_of_array = array.inject{ |x, y| x + y }.to_f\n (sum_of_array.to_f/array.length).round\nend",
"def average(array)\n \n sum = 0\n array.each do |element|\n sum = sum + element\n end\n puts \"The sum is #{sum}\"\n puts \"The array size is #{array.size}\"\n puts \"The average is #{(sum / array.size)}\"\n return (sum / array.size)\nend",
"def average(array)\n index = 0\n sum = 0\n while index < array.length\n sum += array[index]\n index += 1 \n end\n sum = sum / array.length.to_f\nend",
"def findAverage arr\n sum = 0\n for ocenka in arr do\n sum = sum + ocenka \n \n end\n average = sum / arr.length\n return average\nend",
"def average(array)\n array.sum / array.length\nend",
"def avg(input_array)\n n = input_array.size \n sum = 0 \n n.times{|x|\n sum = sum + input_array[x]\n }\n return ((sum/n).to_f)\n end",
"def average(arr)\n arr.reduce(:+).to_f / arr.size\nend",
"def mean(array)\n array.sum(0.0) / array.size\nend",
"def average_array(arr)\n\n i = 0\n sum = 0\n avg = 0.0\n\n while i < arr.length\n\n old = arr[i]\n\n sum += old \n\n i += 1\n end\n\n avg = sum / arr.length.to_f\n\n return avg\nend",
"def average(arr)\n sum = arr.reduce(:+).to_f \n sum / arr.size\nend",
"def average(arr)\n arr.sum / arr.length\nend",
"def average(arr)\n arr.sum / arr.length\nend",
"def average(arr)\n arr.sum / arr.length\nend",
"def mean(array)\n total = array.inject(0) {|sum, x| sum += x}\n # use to_f to avoid get integer result\n return total.to_f / array.length\nend",
"def average(array)\n array.reduce(:+) / array.length\nend",
"def mean(array)\n total = 0\n array.each { |i| total+= i.to_f }\n total / array.count\n puts total\nend",
"def mean( array )\n sum( array ) / array.size\nend",
"def average(arr)\n output = 0\n i = 0\n while i < arr.length\n output += arr[i]\n i += 1\n end\n output = output.to_f/arr.length\n return output\nend",
"def average(array)\n puts array.sum.to_f / array.length\nend",
"def average(arr)\n total = 0\n arr.select do |num|\n total += num\n end\n average = total / arr.length\nend",
"def average(arr)\n output = 0\n i = 0\n while i < arr.length\n output += arr[i].to_i\n i += 1\n end\n output = output/arr.length\n return output.to_f\nend",
"def is_avg_whole?(arr)\n arr.reduce(&:+) % arr.length == 0\nend",
"def mean array\n array.inject(:+).to_f / array.length.to_f\n end",
"def average(integer_array)\n sum = 0\n integer_array.each do |number|\n sum << sum += number\n end\n sum\nend",
"def average(arr)\n (arr.sum.to_f / arr.size).round(2)\nend",
"def calcAvg(numArray)\n\tresult = 0;\n\t\n\t# Check to see if our array is empty\n\tif (numArray.length() > 0)\n\t\tresult = calcTotal(numArray) / numArray.length().to_f();\n\tend\n\t\n\treturn result;\nend",
"def mean(array)\n\ttotal = 0\n\tarray.each do |x|\n\t\ttotal = total + x\n\tend\n\tmean = total.to_f / array.count\n\tputs mean\nend",
"def average(array)\n (array.reduce(&:+) / array.length.to_f).round(2)\nend",
"def average(arr)\n arr.inject(:+) / arr.length\nend",
"def averagefloat(array)\n totalval = 0\n array.each { |x| totalval += x }\n totalval / array.length.to_f\nend",
"def mean(array)\n array.inject(:+).to_f / array.size\nend",
"def average(num_arr)\n (num_arr.sum/num_arr.length).to_f\nend",
"def average (array_of_integers)\n\n # Establish default return value\n average_value = 0.0\n\n # If 2 or fewer elements, just return default value\n if array_of_integers.size > 2\n\n # Delete minimum\n array_of_integers.delete_at(array_of_integers.index(array_of_integers.min))\n\n # Delete maximum\n array_of_integers.delete_at(array_of_integers.index(array_of_integers.max))\n\n # Compute average of remaining elements\n sum_of_values = array_of_integers.inject(&:+)\n average_value = sum_of_values.to_f / array_of_integers.size\n\n end\n\n # Return\n return average_value\n\nend",
"def mean(arr)\n arr.reduce(:+) / arr.size\nend",
"def average(ary)\n ary.sum / ary.length\nend",
"def is_avg_whole?(arr)\n sum_of_arr = arr.inject(0) {|sum,x| sum + x }\n\treturn (sum_of_arr / arr.length.to_f)%1==0 ? true : false\nend",
"def mean(ary)\n ary.inject(0) { |sum, i| sum += i }/ary.length.to_f \nend",
"def average(arr)\n (arr.sum / arr.length.to_f).round(2)\nend",
"def average numbers\n\tb=[]\n\t\tsum = numbers.reduce [] do |total, number| \n\t\ttotal+number\n\t\tend \n\t\tb.push(sum/numbers.length)\n\t\treturn b\n\nend",
"def get_average(arr)\n\tputs arr.reduce(:+)/arr.length\nend",
"def mean(ary)\n # your implementation here\n avg = ary.reduce(0) {|item,acc| acc + item} / ary.length\n avg\nend",
"def average numbers\n sum = numbers.reduce 0.0 do |total, number| #im using 0.0 to go directly into floats\n total + number\n end\n sum / numbers.length\nend",
"def sum(array)\n\n raise 'array includes non integers' unless \n (array.empty? || array.all? { |x| x.integer?})\n \n array.reduce(0,:+)\n \nend",
"def average\n check_numeric_array!\n a = numerify\n a.sum / length.to_f\n end",
"def average numbers\n ave = numbers.reduce 0 do |total, number|\n sum = (total + number)\n end\n ave / numbers.length.to_f\nend"
] |
[
"0.8515971",
"0.80971307",
"0.8026708",
"0.7913091",
"0.78915274",
"0.7843364",
"0.78430045",
"0.78333044",
"0.7821757",
"0.78204864",
"0.776393",
"0.775869",
"0.7738436",
"0.77343947",
"0.7728443",
"0.7726349",
"0.77074075",
"0.7706711",
"0.77022445",
"0.76725954",
"0.76396215",
"0.7638419",
"0.7589011",
"0.7583975",
"0.7583863",
"0.7572226",
"0.75713223",
"0.7565306",
"0.7557203",
"0.7549168",
"0.75459814",
"0.7540381",
"0.7534868",
"0.7529971",
"0.7525055",
"0.7497877",
"0.7463387",
"0.7457331",
"0.74555254",
"0.74501956",
"0.74490523",
"0.7437654",
"0.74330616",
"0.74326134",
"0.7429331",
"0.74266344",
"0.74204296",
"0.7419573",
"0.74141294",
"0.74126697",
"0.7409902",
"0.7408734",
"0.7408177",
"0.7408177",
"0.7403",
"0.7391396",
"0.7377888",
"0.7369578",
"0.73622036",
"0.73552203",
"0.73429763",
"0.7337024",
"0.73320335",
"0.73152196",
"0.731252",
"0.7288811",
"0.7288811",
"0.7288811",
"0.7285522",
"0.72808504",
"0.72778744",
"0.7273462",
"0.7269671",
"0.72679037",
"0.7256428",
"0.72420526",
"0.72349864",
"0.721486",
"0.720822",
"0.71977925",
"0.71792537",
"0.71715736",
"0.71586126",
"0.7147034",
"0.7145848",
"0.71342885",
"0.71303535",
"0.71163327",
"0.70974886",
"0.7091844",
"0.70744586",
"0.706466",
"0.7056891",
"0.70540243",
"0.70485187",
"0.7025388",
"0.70159596",
"0.69873196",
"0.69701606",
"0.6970138"
] |
0.8112079
|
1
|
The average method is defined on line 10, it takes a parameter, array. Considering its name, we can assume the method aims to work with an array. It creates a new scope for the array parameter, which is now accessible as a local variable inside the method. On line 12, array.sum is divided by array.size array.sum is a method that sums every number in an array of integers. It returns that sum as an integer array.size is a method that counts the items in an array an returns the result as an integer. Considering the division operator, we must make sure the divisor is > 0. The average method returns the result of the operation on line 12, because in ruby, a method always returns the result of the last line inside the method definition. When invoked, the method uses the scope defined by the method definition. It takes the array used as param to perform the average operation and return it. It's a non destructive method as it does not mutate the caller.
|
def average(array)
array.sum / array.size.to_f
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def average(array)\n array.sum / array.length\nend",
"def average(array)\n average = array.sum / array.count\nend",
"def average(array)\n return sum(array)/array.length \nend",
"def average(arr)\n arr.sum / arr.length\nend",
"def average(arr)\n arr.sum / arr.length\nend",
"def average(arr)\n arr.sum / arr.length\nend",
"def average(arr)\n arr.sum / arr.size\nend",
"def average(array)\n total = 0\n array.each { |num| total += num }\n total / array.length\nend",
"def average\n @array.inject(0.0) {|total, n| total + n} / @array.size\n end",
"def average(array)\n \n sum = 0\n array.each do |element|\n sum = sum + element\n end\n puts \"The sum is #{sum}\"\n puts \"The array size is #{array.size}\"\n puts \"The average is #{(sum / array.size)}\"\n return (sum / array.size)\nend",
"def average(array)\n sum = 0\n array.each { |n| sum += n }\n average = sum / array.count\nend",
"def average(array)\n total = 0\n array.each do |number|\n total += number\n end\n total / array.length\nend",
"def average(array)\n array.reduce(:+) / array.size\nend",
"def average(array)\n array.reduce(:+) / array.size\nend",
"def average(array)\n sum = 0\n array.each { |value| sum += value }\n sum / array.length\nend",
"def average(array)\n sum = 0\n array.each do |int|\n sum += int\n end\n sum / array.length\nend",
"def average(array)\n array.inject(&:+) / array.length\n end",
"def average(array)\n total = 0\n array.each do |number|\n total = total + number\n end\n total / array.size\nend",
"def average arr\n sum = 0\n arr.each {|i| sum += i}\n average = sum/(arr.size) \nend",
"def average(array)\n result = array.inject(:+)\n result / array.count\nend",
"def average(array)\n puts array.sum.to_f / array.length\nend",
"def average(array)\n array.reduce(:+) / array.length\nend",
"def average(array)\n return 0 if array.empty?\n array.sum / array.size\nend",
"def array_average arr\n arr_sum = 0.0\n\n arr.each do |num|\n arr_sum += num\n end\n\n arr_avg = arr_sum / arr.size\nend",
"def average(array)\n result = array.inject { |sum, n| sum + n }\n result / array.size\nend",
"def average(array)\n array.inject(:+).to_f / array.size\nend",
"def average(ary)\n ary.sum / ary.length\nend",
"def average(array)\n if array.size <= 0\n return 0.0\n end\n return sum(array) / array.size\nend",
"def average(arr)\n sum = arr.reduce(:+)\n sum / arr.size\nend",
"def average(arr)\n arr.inject(:+) / arr.length\nend",
"def average (array)\n if array.empty? then\n 0\n else\n (sum(array)/array.size)\n end\nend",
"def average (anArray)\n if (anArray.length <= 0)\n return 0.0;\n else\n return sum(anArray) / anArray.length;\n end\nend",
"def mean( array )\n sum( array ) / array.size\nend",
"def average(array)\n total = 0\n array.each do |num|\n total += num\n end\n total.to_f / array.size\nend",
"def average(anArray)\n avg = 0\n sum = sum(anArray)\n if (anArray.length > 0) then\n avg = sum / anArray.length\n else\n return 0\n end\nend",
"def average(num_array)\n sum = 0\n num_array.each { |num| sum += num }\n sum / num_array.length\nend",
"def find_average \n result = array.sum(0.0)/array.size\n return result\n end",
"def average(array)\n if !array.is_a?(Array)\n return nil\n else \n sum = 0\n array.each do |i|\n sum += i\n end\n return sum / (array.length * 1.0)\n end\nend",
"def average(anArray)\n if anArray.empty? then\n return 0.0\n else\n return sum(anArray) / anArray.size\n end \nend",
"def average(array)\n sum = array.reduce(:+)\n sum.to_f / array.size.to_f\nend",
"def average_of_array(array)\n (array.sum).to_f / (array.length)\nend",
"def find_average(array)\n array.sum / array.size.to_f\nend",
"def average(array)\n sum = 0\n array.each { |x| sum += x }\n (sum / array.count).to_f\nend",
"def average(arr)\n arr.reduce(:+).to_f / arr.size\nend",
"def average(input_array)\n sum = 0\n \n input_array.each {|num| sum += num}\n \n average = sum.to_f/input_array.length\nend",
"def average(ary)\n ary.inject(&:+) / ary.size\nend",
"def mean array\n length = array.length\n sum = 0 \n array.each do |x|\n sum += x\n end\n sum / length\nend",
"def average(array)\n (array.reduce(&:+) / array.length.to_f).round(2)\nend",
"def average(arr)\n total = 0\n arr.select do |num|\n total += num\n end\n average = total / arr.length\nend",
"def average(array)\n index = 0\n sum = 0\n while index < array.length\n sum += array[index]\n index += 1 \n end\n sum = sum / array.length.to_f\nend",
"def average_of_array(array)\n\tn = [10, 15, 25]\n\taverage = n.inject(0.0) { | total, num | total + num } / n.count\n\taverage.round\nend",
"def average(arr)\n sum = arr.reduce(:+).to_f \n sum / arr.size\nend",
"def average(arr)\n (arr.sum.to_f / arr.size).round(2)\nend",
"def average_of_array(array)\n sum = 0\n array.each {|x|\n sum += x\n }\n (sum.round(2) / array.size).round\nend",
"def average(anArray)\n\tif anArray.size > 0 then\n\t\treturn sum(anArray) / anArray.size\n\telse\n\t\treturn 0.0\n\tend\nend",
"def average(arr)\ncounting_variable = 0\narr.each {|element| counting_variable += element }\ncounting_variable / arr.length\nend",
"def average(input_array)\n n = input_array.length\n sum = 0 \n\n input_array.each do |num|\n sum = sum + num\n end\n average_of_array = sum.to_f / n\nend",
"def average(integer_array)\n sum = integer_array.sum\n average = sum / integer_array.size\nend",
"def average\n check_numeric_array!\n a = numerify\n a.sum / length.to_f\n end",
"def average(arr)\n (arr.sum / arr.length.to_f).round(2)\nend",
"def mean(arr)\n arr.reduce(:+) / arr.size\nend",
"def average_of_array(array)\n (array.inject(:+) / array.size.to_f).round\nend",
"def average_of_array(array)\n (1.0*array.inject{|sum, ele| sum + ele}/array.length).round(0)\nend",
"def average (anArray)\n\n\t#if the array is empty...\n\tif anArray.empty?\n\t\treturn 0.0\n\n\t# otherwise, return the sum divided by the number of values\n\telse\n\t\treturn sum(anArray) / anArray.size\n\tend\nend",
"def mean(array)\n\ttotal = 0\n\tarray.each do |x|\n\t\ttotal = total + x\n\tend\n\tmean = total.to_f / array.count\n\tputs mean\nend",
"def averages(array)\n return [] if !array.is_a? Array\n averages_array = []\n array.each_index do |index|\n unless array[index + 1].nil?\n sum = (array[index] + array[index + 1])\n sum % 2 == 0 ? averages_array << sum / 2 : averages_array << sum / 2.0\n end\n end\n averages_array\nend",
"def mean(array)\n array.sum(0.0) / array.size\nend",
"def mean(array)\n total = 0.0\n array.each do |value|\n total += value\n end\n total / array.size\nend",
"def average(num_arr)\n (num_arr.sum/num_arr.length).to_f\nend",
"def average(array)\n i = 0\n sum = 0\n while i < array.length\n sum += array[i].to_int\n i += 1\n end\n return (sum.to_f / array.length.to_f)\nend",
"def average(input_array)\n i = 0\n sum = 0\n while i < input_array.length\n sum += input_array[i]\n i += 1\n end\n\n average = sum.to_f/input_array.length\nend",
"def calc_mean(ary)\n if !ary.is_a?(Array)\n 0\n elsif ary.empty?\n 0\n else\n # Your code goes here \n\n #add the numbers \n #divide by the amount of numbers in array\n temp = 0\n ary.each do |index|\n temp = temp + index\n\n end\n\n mean = temp / ary.size\n\n return mean\n end\nend",
"def average(arr)\n output = 0\n i = 0\n while i < arr.length\n output += arr[i]\n i += 1\n end\n output = output.to_f/arr.length\n return output\nend",
"def mean(ary)\n # your implementation here\n avg = ary.reduce(0) {|item,acc| acc + item} / ary.length\n avg\nend",
"def mean(array)\n array.inject(:+).to_f / array.size\nend",
"def average(arr)\n int = 0\n arr.each { |num| int += num }\n int / arr.length.to_f\nend",
"def get_average(arr)\n\tputs arr.reduce(:+)/arr.length\nend",
"def average_array(arr)\n\n i = 0\n sum = 0\n avg = 0.0\n\n while i < arr.length\n\n old = arr[i]\n\n sum += old \n\n i += 1\n end\n\n avg = sum / arr.length.to_f\n\n return avg\nend",
"def findAverage arr\n sum = 0\n for ocenka in arr do\n sum = sum + ocenka \n \n end\n average = sum / arr.length\n return average\nend",
"def average_f(arr)\n arr.inject(:+).fdiv(arr.size)\nend",
"def avg(input_array)\n n = input_array.size \n sum = 0 \n n.times{|x|\n sum = sum + input_array[x]\n }\n return ((sum/n).to_f)\n end",
"def mean(arr)\n return 0 if arr.empty?\n sum = 0\n\n arr.each do |num|\n sum = sum + num\n end\n \n sum / arr.count\nend",
"def average numbers\n\tsum = numbers.reduce do |total, number|\n\t\ttotal + number\n\tend\n\taverage = sum.to_f / numbers.length\nend",
"def average(numbers)\n sum = numbers.reduce(:+)\n sum / numbers.count\nend",
"def mean(array)\n total = 0\n array.each { |i| total+= i.to_f }\n total / array.count\n puts total\nend",
"def mean(array)\n total = array.inject(0) {|sum, x| sum += x}\n # use to_f to avoid get integer result\n return total.to_f / array.length\nend",
"def average\n return nil if empty?\n sum = n = 0\n if block_given?\n each { |x| n += 1; sum += (yield x) }\n else\n each { |x| n += 1; sum += x }\n end\n sum.to_f / n\n end",
"def average numbers\n\tb=[]\n\t\tsum = numbers.reduce [] do |total, number| \n\t\ttotal+number\n\t\tend \n\t\tb.push(sum/numbers.length)\n\t\treturn b\n\nend",
"def average_of_array(array)\n sum_of_array = array.inject{ |x, y| x + y }.to_f\n (sum_of_array.to_f/array.length).round\nend",
"def average(numbers)\n sum = numbers.reduce { |sum, number| sum + number }\n sum / numbers.count\nend",
"def average(numbers)\n sum = numbers.reduce { |sum, number| sum + number }\n sum / numbers.count\nend",
"def average(numbers)\n sum = numbers.reduce { |sum, number| sum + number }\n sum / numbers.count\nend",
"def average(numbers)\n sum = numbers.reduce { |sum, number| sum + number }\n sum / numbers.count\nend",
"def average(numbers)\n sum = numbers.reduce { |sum, number| sum + number }\n sum / numbers.count\nend",
"def average numbers\n average = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]\n average.inject{ |sum, el| sum + el }.to_f / average.size\nend",
"def average numbers\n\tnumbers.reduce(:+).to_f / numbers.length\n\t# total / numbers.length\nend",
"def average numbers\n\nend",
"def average()\n if(@countN > 0) then\n return @sum / @countN ;\n else\n return 0.0 ;\n end\n end",
"def average(arry)\n sum = 0\n size = arry.size\n \n for num in arry \n sum += num\n end\n \n sum / size\nend",
"def average_array(array)\n array.each do |ele|\n raise \"All member must be numbers\" if !(ele.instance_of?(Integer))\n end\n\n array.sum / array.length.to_f\nend"
] |
[
"0.83735883",
"0.8323118",
"0.8275525",
"0.82207704",
"0.82207704",
"0.82207704",
"0.82149005",
"0.81618404",
"0.814547",
"0.81379557",
"0.81353235",
"0.81244266",
"0.8108425",
"0.8108425",
"0.81068444",
"0.8092033",
"0.80911946",
"0.8087398",
"0.8066428",
"0.8054799",
"0.80457187",
"0.8040252",
"0.8016734",
"0.80154383",
"0.8006591",
"0.7993046",
"0.7977171",
"0.79551786",
"0.79474694",
"0.79408395",
"0.7938905",
"0.79329956",
"0.7932024",
"0.7922915",
"0.79048294",
"0.79044",
"0.7897156",
"0.7873344",
"0.784077",
"0.7833182",
"0.7827755",
"0.7784954",
"0.77847564",
"0.77345437",
"0.77311724",
"0.77223986",
"0.77124363",
"0.77075726",
"0.76883155",
"0.7670916",
"0.76694185",
"0.7663061",
"0.76369",
"0.76274776",
"0.76225924",
"0.7617948",
"0.7610393",
"0.75981796",
"0.7589782",
"0.7586204",
"0.7579805",
"0.75721055",
"0.7563089",
"0.755138",
"0.75508684",
"0.7543169",
"0.7541743",
"0.75328",
"0.752663",
"0.75181544",
"0.7493526",
"0.74891204",
"0.7482999",
"0.7482396",
"0.7458882",
"0.7443991",
"0.744018",
"0.7435789",
"0.74043405",
"0.7401078",
"0.7393285",
"0.73822814",
"0.7379133",
"0.7375038",
"0.7370548",
"0.7353422",
"0.7348447",
"0.73453254",
"0.73429066",
"0.7334673",
"0.7334673",
"0.7334673",
"0.7334673",
"0.7334673",
"0.73271334",
"0.73221123",
"0.7318207",
"0.7293941",
"0.7284211",
"0.72813857"
] |
0.803653
|
22
|
go on for all possible path
|
def follow_rules_for(configuration, character)
rules_for(configuration, character).map {|rule| rule.follow(configuration)}
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def all(path, type); end",
"def initial_paths; end",
"def explore\n while (target = search_unknown)\n # puts \"PATH: #{target.inspect}\"\n target.each do |dir|\n output = @vm.run(input: [dir]).first\n case output\n when 0 # droid hits wall\n @map.set(@droid.move(dir), Map::WALL)\n when 1 # droid moved into an empty space\n @droid = @droid.move(dir)\n @map.set(@droid, Map::NOTHING)\n when 2 # droid moved into a space containing oxygen\n @droid = @droid.move(dir)\n @map.set(@droid, Map::OXYGEN)\n end\n end\n end\n end",
"def goto_dir\n return\nend",
"def entrance(*path_or_paths)\n return if @skip_set_entrance\n @paths += path_or_paths\n end",
"def all?(*paths)\n !catch(:done){ traverse(*paths){|f| throw(:done, true) unless yield f }}\n end",
"def paths; end",
"def paths; end",
"def paths; end",
"def paths; end",
"def paths; end",
"def find_all_paths\n found_paths = []\n \n explore(found_paths, nil, @start_node)\n \n found_paths\n end",
"def find_path(goal) \n \n end",
"def calc_path\n endpoint = grid.target\n while endpoint\n search.path[endpoint] = true\n endpoint = search.came_from[endpoint]\n end\n end",
"def all_paths\n\t\t\t\treturn @all_paths if @all_paths.length > 0\n\n\t\t\t\t# Looks like we have to build a list of paths!\n\t\t\t\tputs \"[MacroDeck::TurkResponseTree::Tree] Getting all paths...\"\n\t\t\t\t@hash.each_path do |path, value|\n\t\t\t\t\tif !@all_paths.include?(path)\n\t\t\t\t\t\tputs \"[MacroDeck::TurkResponseTree::Tree] Adding path #{path}\"\n\t\t\t\t\t\t@all_paths << path\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\tend",
"def test_fun_forward_path\n\t@city = GoldRush::new\n\tassert_equal nil, @city.angels.forward_path4\n\tassert_equal nil, @city.sutter.forward_path3\n\tassert_equal nil, @city.nevada.forward_path2\n end",
"def reconstruct_path(came_from, current)\n while came_from.include?(current)\n current = came_from[current]\n current.path!\n end\n @start.start!\n @end.end!\n end",
"def assign_paths\n self.path = generate_path(self)\n end",
"def walk(path); end",
"def find_alternative_paths\n reset\n \n @pairs.reverse!\n find_paths\n @pairs.reverse!\n\n @pairs.map{|pair| pair.path}\n end",
"def all_paths_util(u, d)\n # Mark the current node as visited and store in path\n @visited[u] = true\n @path << u\n\n # If current vertex is same as destination, then store it\n # current path[]\n if u == d\n @all_paths << @path.dup\n else\n # If current vertex is not destination\n # Recur for all the vertices adjacent to this vertex\n @graph[u].each do |i|\n if @visited[i] == false\n all_paths_util(i, d)\n end\n end\n end\n # Remove current vertex from path[] and mark it as unvisited\n @path.pop()\n @visited[u]= false\n end",
"def next_paths\n Operations.list.map do |operation|\n new_value = Operations.send(operation, @current_value)\n operation_history = @operation_history + [operation]\n Path.new(new_value, @target_value, operation_history: operation_history)\n end\n end",
"def all_paths\n derivatives_for_reference\n rescue StandardError => e\n logger.error(e.message)\n raise e\n end",
"def finish(paths)\n if paths.empty?\n raise Plan::Advice.new('please drill down to a level to finish')\n end\n # descend and finish\n item = path_tree.descend(paths)\n item.finish!\n save_path_tree\n # print what happened here\n print_depth item\n end",
"def get_walk_path(goalx, goaly)\n current_track_address = hash_address(goalx,goaly)\n path = []\n path_address = []\n go_dir = []\n path.push(current_track_address)\n \n while @nodes_parent_id[current_track_address]\n path.unshift( @nodes_parent_id[current_track_address] )\n go_dir.unshift( @move_dir[current_track_address] )\n \n current_track_address = @nodes_parent_id[current_track_address]\n break if current_track_address == @nodes_parent_id[current_track_address]\n end\n \n path.each do |hash_value|\n _address = dehash_address(hash_value)\n path_address.push( Map_Address.new( _address[0], _address[1]) )\n end\n \n return get_route_command(path_address,go_dir)\n end",
"def set_walk from, to, lastpoint = nil, full_only = false, complete_path = false\n\t\treturn false if from == to\n\n\t\t$logger.info { \"entered #{ from }-#{to} => #{ lastpoint }\" }\n\t\tlastpoint = to if lastpoint.nil?\n\n\t\tif complete_path\n\t\t\t# Perhaps the path has been found in the meantime; check\n\t\t\ttmp = get from, lastpoint , true\n\t\t\tunless tmp.nil?\n\t\t\t\t$logger.info { \"walk #{from}-#{to} already found\" }\n\t\t\t\treturn false\n\t\t\tend\n\t\tend\n\n\t\twalk = Distance.get_walk from, to, complete_path\n\t\tif walk.nil? or walk.empty?\n\t\t\treturn false\n\t\tend\n\n\t\twalked_full_path = ( walk[-1][0] == lastpoint )\n\n\t\tif walked_full_path\n\t\t\t$logger.info { \"walked full path #{ from }-#{to}\" }\n\t\telse\n\t\t\t# TODO: Prob never reached any more; check\n\n\t\t\t$logger.info { \"Did not walk full path #{ from }-#{to}\" }\n\n\t\t\t# trigger complete search\n\t\t\tWalkFiber.add_list [ from, lastpoint ]\n\n\t\t\treturn false if full_only\n\t\tend\n\n\n\t\twalk.each do |w|\n\t\t\titem = nil\n\t\t\tdist = nil\n\n\t\t\tif walked_full_path\n\t\t\t\t# ignore regions altogether\n\t\t\t\titem = @zero_pathitem\n\t\t\t\tdist = w[2]\n\t\t\telse\n\t\t\t\tif w[0].region.nil?\n\t\t\t\t\t$logger.info \"#{w[0]} region nil; skipping\"\n\t\t\t\t\tnext\n\t\t\t\tend\n\n\t\t\t\titem = $region.get_path_basic w[0].region, to\n\n\t\t\t\tif item.nil?\n\t\t\t\t\t$logger.info \"#{w[0]} item nil; skipping\"\n\t\t\t\t\tnext\n\t\t\t\tend\n\n\t\t\t\tdist = Pathinfo.total_path_distance w[0], lastpoint, item[:path], item[:dist]\n\t\t\tend\n\n\n\t\t\t# Don't add last point if full path reached\n\t\t\tunless w[2] == 0\n\t\t\t\t#$logger.info \"Saving #{ w[0] }-#{lastpoint}\"\n\t\t\t\ttmp = get w[0], lastpoint, true \n\t\t\t\t#$logger.info \"tmp #{ tmp }\"\n\t\t\t\tif not is_direct_path tmp\n\t\t\t\t\tset w[0], lastpoint, dist , item, false, w[1]\n\t\t\t\telse\n\t\t\t\t\t# Item has already been added; so the rest of the path\n\t\t\t\t\t# has been added as well\n\t\t\t\t\t$logger.info \"rest of path is known\"\n\t\t\t\t\tbreak\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\n\t\twalked_full_path\n\tend",
"def map_paths(orig = @orig, dest = @dest, path = [])\n\n\t\t# we have to duplicate each path array to its own object\n\t\t# to ensure it isn't contaminated by another iteration\n\t\tpath = path.dup\n\t\tpath << orig\n\n\t\tif orig == dest\n\t\t\tif !@successful_paths.include?(path)\n\t\t\t\t@successful_paths << path\n\t\t\t\treturn\n\t\t\tend\n\t\telse\n\t\t\t# get connections\n\t\t\tconnections = orig.connected\n\t\t\t# remove previous stops from possible connections list\n\t\t\tconnections = connections - path\n\t\t\tconnections.each do |c|\n\t\t\t\tmap_paths(c, dest, path)\n\t\t\tend\n\t\tend\n\tend",
"def expand_all path\n real_path = VirtualLayer.realpath(path)\n elems = real_path.split('/'); elems.shift # throw away the first element which is empty for a FQ pathname\n if path[-1] == '/'\n filt_fn = ->(p) { VirtualLayer.directory?(p) }\n else\n filt_fn = ->(p) { p }\n end\n result = rejoin(walk_globs(elems)).flatten.select(&filt_fn).sort\n\n if path[0] == '/'\n result\n else\n cwd = VirtualLayer.pwd\n result.map {|p| p[(cwd.length+1)..] }\n end\nend",
"def set_path\n redirect_to_path = ''\n if @pergunta.topico.modelo.nome.to_s == \"Global Docente\" || @pergunta.topico.modelo.nome.to_s == \"Turma Docente\"\n return redirect_to_path = docente_questionario_modelos_path(@pergunta.topico.modelo.questionario.id) \n elsif @pergunta.topico.modelo.nome.to_s == \"Global Discente\" || @pergunta.topico.modelo.nome.to_s == \"Turma Dicente\"\n return redirect_to_path = discente_questionario_modelos_path(@pergunta.topico.modelo.questionario.id) \n elsif @pergunta.topico.modelo.nome.to_s == \"Global TAE\"\n return redirect_to_path = tae_questionario_modelos_path(@pergunta.topico.modelo.questionario.id)\n end\n end",
"def move_type_path\n return if @path == :pending\n return unless movable?\n while (command = @path[@move_route_index])\n # @move_route_index += 1\n break if move_type_custon_exec_command(command)\n end\n end",
"def whole_path(p, &blk)\n path(p) { complete(&blk) }\n end",
"def go(direction)\n return @paths[direction]\n end",
"def get_path(node, root)\r\n path = []\r\n until path.last == root.current_case\r\n path << node.current_case\r\n node = node.parent\r\n end\r\n\r\n puts \"You made it in #{path.size - 1} moves! Here's your path:\"\r\n path.reverse.each { |c| puts c.inspect }\r\n end",
"def all_paths_source_target(graph)\n current_path = []\n results = []\n\n dfs(graph, results, 0, current_path)\n return results\nend",
"def steps (x, y, path)\n if x == 0 && y == 0\n then puts (path)\n return\n end\n if x > 0\n then steps(x - 1, y, path + \"R\")\n steps(x - 1, y + 1, path + \"L\")\n end\n if y > 0\n then steps(x, y - 1, path + \"H\")\n end\nend",
"def fail!\n raise ChoicesExhausted.new if @paths.empty?\n cc = @paths.shift\n # if it quacks (or can be called) like a duck, call it -- it's either a Proc\n # from #mark or a Continuation from #choose\n cc.call\n end",
"def find_path(start, chargers, builtin)\n chargers = chargers.dup\n current_jolt = start\n chargers << builtin\n chargers.sort.each do |charger|\n difference = charger - current_jolt\n return false if difference > 3\n\n current_jolt = charger\n end\n true\n end",
"def test_all\n coords = all_combos\n coords.each do |c|\n find_route(c[0], c[1])\n end\nend",
"def update_or_stop(paths, cfgkey, what, acc=MrMurano::Account.new)\n crd = Dir.common_root(paths)\n acc.debug \"crd => #{crd}\"\n if crd.empty? then\n acc.error \"#{what.capitalize} in multiple directories! #{crd.join(', ')}\"\n acc.error \"Please move them manually into #{$cfg[cfgkey]}\"\n exit(1)\n else\n maxd = Dir.max_depth(paths) - crd.count\n if maxd > 2 then\n acc.error \"Some #{what} are in directories too deep.\"\n acc.error \"Please move them manually to #{$cfg[cfgkey]}\"\n exit(1)\n else\n crd = File.join(crd)\n acc.verbose \"For #{what} using #{crd}\"\n if $cfg[cfgkey] != crd then\n $cfg.set(cfgkey, crd)\n end\n end\n end\n end",
"def all_active_paths\n all_active_states.map(&:path)\n end",
"def paths(i,j)\n\t\t#decidir donde moverse\n \t\tpossible_path = []\n\t \tpath = false\n \t\t\n \t\t#arriba\n \t\tif i-1 > -1\n\t\t\tpath = can_move(i-1,j)\n \t\t\tif path == true\n \t\t\t\tpossible_path.push([i-1,j])\n \t\t\tend\n \t\tend\n \t\t#abajo\n\t\tif i+1 < @laberinto.column_count\n \t\t\tpath = can_move(i+1,j)\n\t\t\tif path == true\n\t\t\t\tpossible_path.push([i+1,j])\n\t\t\tend\n\t\tend \t\n\t\t#izquierda\n\t\tif j-1 > -1\n\t\t\tpath = can_move(i,j-1)\n \t\t\tif path == true\n \t\t\t\tpossible_path.push([i,j-1])\n \t\t\tend\n \t\tend \t\n \t\t#derecha\n\t \tif j+1 < @laberinto.column_count\n \t\t\tpath = can_move(i,j+1)\n \t\t\tif path == true\n \t\t\t\tpossible_path.push([i,j+1])\n\t \t\tend\n \t\tend \t\n\n \t\treturn possible_path\n\tend",
"def run_on_change(paths)\n restart_guard\n end",
"def calculate_path(actor)\n reset_baconator(actor)\n node_search do |current_node|\n process_single_node(current_node)\n end\n end",
"def each(&blk)\n Utils::Kernel.Array(self).each do |path|\n blk.call Utils::Kernel.Pathname(path).realpath\n end\n end",
"def test_create_all_paths\n\t\ttest_main = Main.new(3, 4, 6)\n\t\ttest_graph = Graph.new(10)\n\t\ttest_main.create_all_locations(test_graph)\n\t\ttest_main.create_all_paths(test_graph)\n\t\tassert_equal test_graph.get_loc(\"Matzburg\").paths.length, 4\n\tend",
"def path(start, goals, mode=:move_to, ignore={})\n start = start.map(&:to_i)\n goals = goals.flatten.size == 3 ? [goals.flatten] : goals\n\n if goals.reject { |goal| (start[0] - goal[0]).abs + (start[1] - goal[1]).abs + (start[2] - goal[2]).abs > MAX_PATH_SIZE }.empty?\n puts \"target too far away\"\n return nil\n elsif mode == :move_to && goals.select { |g| allowed?(*g) }.empty?\n puts \"can't go there...\"\n return nil\n # elsif mode == :next_to && goals.map { |g| available(*g, :next_to).any? { |l| allowed?(*l) } }.empty?\n # puts \"nothing to move next to anymore...\"\n # return nil\n end\n visited = {}\n next_to = {}\n examined = 0\n\n heap = Heap.new { |a, b| a.cost <=> b.cost }\n heap.add Path.new(start, goals, [])\n\n while !heap.empty?\n point = heap.next\n\n if point.path.size > MAX_PATH_SIZE\n puts \"examined #{examined} paths before giving up\"\n return nil\n end\n\n next if visited[point.point]\n visited[point.point] = point\n\n examined += 1\n\n case mode\n when :move_to\n if goals.include?(point.point)\n final_path = point.path + [point.point]\n final_path.shift # don't need the start point, we're already there\n # puts \"examined #{examined} paths\"\n return final_path\n end\n\n when :away_from\n above = point.point.dup\n above[1] += 1\n if !goals.include?(point.point) && !goals.include?(above)\n final_path = point.path + [point.point]\n return final_path\n end\n\n when :next_to\n next_to[point.point] ||= available(*point.point, :build)\n available_for_building = next_to[point.point]\n if available_for_building.any? { |a| goals.include? a }\n final_path = point.path + [point.point]\n final_path.shift # don't need the start point, we're already there\n # puts \"examined #{examined} paths\"\n return final_path\n end\n\n else\n raise \"unknown pathfinding mode: #{mode.inspect}\"\n end\n\n next_available = available(*point.point, :move, ignore).each do |test|\n next if visited[test]\n heap.add Path.new(test, goals, point.path + [point.point])\n end\n end\n nil\n end",
"def pull_to_path(*names)\n names.each { |name| pull_to_start name }\n end",
"def set_path\n redirect_to_path = ''\n if @topico.modelo.nome.to_s == \"Global Docente\" || @topico.modelo.nome.to_s == \"Turma Docente\"\n return redirect_to_path = docente_questionario_modelos_path(@topico.modelo.questionario.id) \n elsif @topico.modelo.nome.to_s == \"Global Discente\" || @topico.modelo.nome.to_s == \"Turma Dicente\"\n return redirect_to_path = discente_questionario_modelos_path(@topico.modelo.questionario.id) \n elsif @topico.modelo.nome.to_s == \"Global TAE\"\n return redirect_to_path = tae_questionario_modelos_path(@topico.modelo.questionario.id)\n end\n end",
"def back_paths!\n path_ids = session[:path_ids]\n new_path_ids = path_ids.split( \"|\" )\n new_path_ids.pop\n \n path_names = session[:path_names] \n new_path_names = path_names.split( \"|\" )\n new_path_names.pop\n \n update_paths!( new_path_ids.join( \"|\" ), new_path_names.join( \"|\" ) )\n end",
"def go(dir)\n put dir\n match = { :wait => [/\\.\\.\\.wait|you may only type ahead/],\n :retreat => [/You'll have better luck if you first retreat|You are engaged/],\n :continue => [/Roundtime/] }\n res = match_wait match\n\n case res\n when :wait\n pause 0.5\n go dir\n when :retreat\n put \"retreat\"\n put \"retreat\"\n go dir\n end\nend",
"def shortest_paths!(root)\n root = URI(root) if root.is_a?(String)\n raise \"Root node not found\" if !has_key?(root)\n\n q = Queue.new\n\n q.enq root\n root_page = Page[root]\n root_page.depth = 0\n root_page.visited = true\n root_page.save\n\n while !q.empty?\n page = Page[q.deq]\n page.links.each do |u|\n begin\n link = Page[u]\n next if link.nil? || !link.fetched? || link.visited\n\n q << u unless link.redirect?\n link.visited = true\n link.depth = page.depth + 1\n link.save\n\n if link.redirect?\n u = link.redirect_to\n redo\n end\n end\n end\n end\n\n self\n end",
"def skip_paths; end",
"def enum_paths(&block)\n @maze.connections_from(@at, @subset_mask, &block)\n end",
"def print_path\n @path.each{|x| puts x.inspect}\n end",
"def each_object_path (path=@basepath, &block)\n\n Find.find(path) do |p|\n\n next unless File.exist?(p)\n next if File.stat(p).directory?\n #next unless OpenWFE::ends_with(p, '.yaml')\n next if p[-5..-1] != '.yaml'\n\n #ldebug { \"each_object_path() considering #{p}\" }\n block.call(p)\n end\n end",
"def run_on_changes paths\n return run_all unless tracker.checks\n info \"\\n\\nrescanning #{paths}, running all checks\" unless options[:quiet]\n report = ::Brakeman::rescan(tracker, paths)\n print_changed(report)\n throw :task_has_failed if report.any_warnings?\n end",
"def run_on_change(paths = {})\n restart\n end",
"def paths\n {\n :homepage => '/',\n :people => '/people',\n :work => '/work',\n :labs => '/labs',\n :\"find-us\" => '/find-us',\n :\"pebbles-good-code\" => '/pebbles-good-code'\n }\nend",
"def findPaths (conf)\n puts aktTime()+' collecting files...'\n STDOUT.flush #write out immediately\n\tconf[:saveDirs].each do |d|\n\t\tif File.directory?(d)\n\t\t\tDir.chdir(d)\n\t\t\tgetFiles(conf)\n\t\telse\n\t\t\tputs \"\\nWarning: Directory: \\n\"+d+\" **not** found !\"\n\t\tend\n\tend\nend",
"def paths_for(controller=:_all,action=:_all)\n return files_for(:paths,controller,action)\n end",
"def run_on_changes(paths)\n restart\n end",
"def explore\n rover_bay.each do |r|\n if pass_path_check?(r)\n move(r)\n else\n raise \"There is a collision\\nin placement #{r.coordinate.inspect}, please revise instruction set #{r.command.inspect}\"\n end\n end\n end",
"def knight_path(from, to)\r\n\topen_queue = [PositionPath.new( from, [copy(from)] )]\r\n\tputs open_queue.inspect\r\n\tputs open_queue.empty?\r\n\tdiscovered = [from]\r\n\r\n\tuntil open_queue.empty?\r\n\t\tcurrent = open_queue.shift\r\n\t\tputs current.inspect\r\n\r\n\t\treturn current.path if current.position == to\r\n\t\tvalid_moves(current.position).each do |move|\r\n\t\t\tputs \"ruch #{move} jest ok\"\r\n\t\t\tunless discovered.include?(move)\r\n\t\t\t\tputs \"tego ruchu jeszce nie bylo = #{move}\"\r\n\t\t\t\tdiscovered << move\r\n\t\t\t\topen_queue.push(make_position_path(current, move)) \r\n\t\t\t\tputs \"open_queue = #{open_queue.size}\"\r\n\t\t\tend\r\n\t\tend\r\n\tend\r\n\t\r\nend",
"def run_on_change(paths)\n end",
"def all_steps\n\t#make calls to step here...\nend",
"def find_path(paths = [[@position]])\n if not @path and finished?(paths)\n return @path\n else\n new_paths = []\n change = false\n paths.each do |path|\n possible_positions?(path).each do |position|\n new_paths << path.dup.push(position)\n change = true\n end\n end\n find_path(new_paths) if change\n end\n end",
"def run_on_changes(paths)\n run_all()\n end",
"def unfinish(paths)\n if paths.empty?\n raise Plan::Advice.new('please drill down to a level to unfinish')\n end\n # go to the right depth and unfinish\n item = path_tree.descend(paths)\n item.unfinish!\n save_path_tree\n # print what happened here\n print_depth item\n end",
"def all_paths(source, target, graph)\n\n def search(source, target, graph, all_paths)\n return all_paths[source] if all_paths.key?(source)\n return [[target]] if source == target\n source_paths = []\n graph.each_adjacent(source) { |v| source_paths += search(v, target, graph, all_paths) }\n all_paths[source] = source_paths.map { |path| [source] + path }\n end\n\n search(source, target, graph, {})\n end",
"def run_on_change(paths)\n jammit\n end",
"def all_paths\n # memoize so we only calculate once\n @all_paths ||= platform_font_paths\n end",
"def get_allpaths(source, dest, visited, path)\n # mark visited\n visited[source] = 1\n path << source\n\n if source.eql? dest\n @paths << path.dup\n else\n # recurse for all neighboring nodes\n @nnmap[source].each do |n|\n get_allpaths(n, dest, visited, path) if visited[n].eql? 0\n end\n end\n\n path.pop\n visited[source] = 0\n end",
"def hit_path(root_url, repeat_global)\n @@repeat_global=repeat_global\n puts \"please enter root_url (example: http://localhost)\" and return unless root_url \n paths_to_hit = fetch_controller_parameters\n paths_to_hit.each do |path|\n begin\n generate_parameters_and_hit_path(root_url, path)\n rescue Exception => e\n puts ActsAsQA::Display.colorize(\"Wrong parameters for #{path}. Error: #{e}\", 31)\n end\n end # end of paths to hit\n show_result\n end",
"def mark \n @paths.unshift Proc.new {self.fail!}\n end",
"def paths(reload = T.unsafe(nil)); end",
"def finished?(paths)\n paths.each do |path|\n if path.last == @final_position\n @path = path[1..-1]\n end\n end\n @path\n end",
"def print_paths\n path, counter = [], 0\n puts '************************ Tree Paths ***********************************'\n puts\n print_tree_paths(self.root, path, counter)\n puts\n puts '***********************************************************************'\n end",
"def traverse_route_map(origin, destination, path, matches, &block)\n route_map[origin].each do |route|\n\n new_path = path ? path.dup : Path.new\n new_path << route\n\n action = yield(new_path)\n\n matches << new_path if action == :match\n\n if action == :continue || action == :match\n traverse_route_map(route.destination, destination, new_path, matches, &block)\n end\n\n end\n end",
"def chdir(pathset)\n raise ActionNotSupportedError.new(:each, self)\n end",
"def all_paths_source_target(graph, results=[], current_node=0, current_path=[])\n if current_node == graph.length - 1\n return results << (current_path + [current_node])\n end\n\n graph[current_node].each do |node|\n all_paths_source_target(graph, results, node, (current_path + [current_node]))\n end\n\n return results\nend",
"def walk\n \t\tputs \"Walking...\"\n \tend",
"def find_paths(&block)\n follow,kill,find,continue = SearchParams.process(&block)\n\n paths,path = [],[]\n search = lambda do |node|\n if find[node]\n paths << path.dup\n next if not continue[node]\n end\n next if kill[node]\n [*follow[node]].each do |n|\n next if path.include? n\n path.push(n)\n search[n]\n path.pop\n end\n end\n\n [*follow[self]].each do |n| \n path.push(n)\n search[n] \n path.pop\n end\n\n paths\n end",
"def possible_paths_for(mappings)\n root_mappings.map{|root|\n mappings.first.map{|inner|\n mappings.last.map{|outer|\n ::File.join(root, inner, outer, '/') }}}.flatten\n end",
"def next_step_from(paths)\n paths.map do |path|\n possible_neighbours(path.most_recent_step.coordinate, @max_x, @max_y) \n .map { |c| coord_to_step_on_path(c, path) }\n .reject { |p| p == nil }\n end\n .flatten\n end",
"def follow_symlinks; end",
"def update_path!\n update_path(:force => true)\n end",
"def display_path path\r\n\tif path.length <= 1\r\n\t\tputs \"You are already at your destination :-)\"\r\n return\r\n end\r\n\tputs \"You made it in #{path.length - 1} move#{path.length > 2 ? \"s\" : \"\"}! Here's your path:\"\r\n path_string = \"\"\r\n\tpath.each { |position| path_string += position.to_s + \"-->\" }\r\n\tpath_string[-3..-1] = \"\"\r\n\tputs path_string\r\nend",
"def knight_moves(initial, final)\n @board.check_impossible_move(initial, final)\n\n search_queue = [Vertex.new(initial)]\n\n until search_queue.empty?\n test_vertex = search_queue.shift\n\n return show_path(make_path(test_vertex)) if test_vertex.value == final\n \n @board.possible_moves(test_vertex.value).each do |move|\n new_vertex = Vertex.new(move)\n new_vertex.parent = test_vertex\n test_vertex.children << move\n search_queue << new_vertex\n end \n\n end\n \"No path was found :(\"\n end",
"def paths\n raise RuntimeError, 'Subclass responsibility'\n end",
"def path(*) end",
"def run_on_change(paths = {})\n restart_and_ping\n end",
"def verts_on_paths(current_vertex, t, current_path=[], paths=[])\n if current_vertex == t\n paths << current_path + [current_vertex]\n else\n adjacent_undirected(current_vertex).each do |v|\n # Don't recur if we're repeating vertices (i.e. reject non-simple paths)\n verts_on_paths(v, t, current_path + [current_vertex], paths) if current_path.count(current_vertex) == 0\n end\n end\n \n paths.flatten.uniq\n end",
"def lesstrips_dfs(start, finish, max_distance, distance, visited, path, paths, cycles)\n adj_vertices(visited.last, adj_lists).each do |vertex|\n print \"Visited stack: #{visited}, Next vertex: #{vertex}\\n\"\n totald = distance + dist(visited.last, vertex)\n\n if visited.last == finish && cycles != \"NO CYCLES EXIST\"\n\n # try adding cycles\n\n visited_before_cycles = visited\n # picks expanded cycles that begin with finish vertex\n ec = expanded_cycles(cycles).select{|c| c.first == finish}\n\n # keep adding cycles till we reach max distance\n ec.each do |cycle1|\n visited, paths, break_loop = try_cycles(visited, cycle1, paths, 0, max_distance)\n visited1 = visited\n\n ec.each do |cycle2|\n begin\n visited, paths, break_loop = try_cycles(visited, cycle2, paths, 0, max_distance)\n end until break_loop\n visited = visited1\n end\n\n visited = visited_before_cycles\n end\n\n elsif !visited.include?(vertex) && totald != \"NO SUCH ROUTE\" && totald < max_distance\n visited << vertex\n path = visited\n distance = totald\n\n if vertex == finish\n paths << path\n print \"\\n*** Path: #{path}, Length: #{path_length(path)}\\n\\n\"\n visited.pop\n break\n end\n\n lesstrips_dfs(start, finish, max_distance, distance, visited, path, paths, cycles)\n visited.pop\n visited.pop if visited.size.between?(2, 3)\n visited = [start] if visited == []\n end\n end\n paths.size\n end",
"def follow_symlinks=(_arg0); end",
"def paths\n @traversal_result = :paths\n @raw = true\n self\n end",
"def path() end",
"def path() end",
"def path() end",
"def render_path\n # If the star and target are disconnected there will only be one path\n # The path should not render in that case\n unless search.path.size == 1\n search.path.each_key do | cell |\n # Renders path on both grids\n outputs.solids << [scale_up(cell), path_color]\n end\n end\n end",
"def go_to_where_you_belong\n \n end",
"def candidate_paths(resolved_path)\n raise NotImplementedError.new\n end"
] |
[
"0.6163916",
"0.60427177",
"0.6012938",
"0.58966655",
"0.58792925",
"0.5869507",
"0.5804902",
"0.5804902",
"0.5804902",
"0.5804902",
"0.5804902",
"0.5674536",
"0.566665",
"0.5666097",
"0.56572413",
"0.56527025",
"0.5649057",
"0.56365585",
"0.56361127",
"0.56250316",
"0.5604851",
"0.55526435",
"0.5508249",
"0.5505035",
"0.5451288",
"0.54264516",
"0.53978103",
"0.5391132",
"0.53760004",
"0.53701437",
"0.53694147",
"0.53680634",
"0.5363803",
"0.5351652",
"0.53419435",
"0.53291947",
"0.5328244",
"0.5327769",
"0.53257555",
"0.5317976",
"0.5313139",
"0.53089356",
"0.5296259",
"0.5294991",
"0.5281893",
"0.52818483",
"0.52794725",
"0.52775365",
"0.527499",
"0.52731323",
"0.5265419",
"0.52564615",
"0.5242553",
"0.523694",
"0.52347845",
"0.52338356",
"0.52194625",
"0.5217188",
"0.52024436",
"0.5200868",
"0.51965004",
"0.5182095",
"0.5163466",
"0.51630014",
"0.51622343",
"0.5158745",
"0.5155696",
"0.51516426",
"0.51444",
"0.51353735",
"0.51351386",
"0.51337457",
"0.5120746",
"0.5113019",
"0.51115483",
"0.5106759",
"0.5106536",
"0.5097748",
"0.50962",
"0.5094516",
"0.5087245",
"0.508629",
"0.5076978",
"0.5073908",
"0.50726277",
"0.50619084",
"0.5058516",
"0.5058028",
"0.5057141",
"0.5057058",
"0.5054293",
"0.50504726",
"0.5046389",
"0.5044976",
"0.50445485",
"0.503691",
"0.503691",
"0.503691",
"0.50333905",
"0.502992",
"0.5028436"
] |
0.0
|
-1
|
find all posiible rules
|
def rules_for(configuration, character)
# note that it is select (filter), not detect (find)
rules.select {|rule| rule.applies_to?(configuration, character)}
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def rules; end",
"def rules; end",
"def rules; end",
"def rules; end",
"def rules; end",
"def rules; end",
"def rules; end",
"def rules_by_name; end",
"def rules\n @rules.map{|r| [r.name, r.rule]}.to_h\n end",
"def rules\n @rules ||= []\n end",
"def rules\n @rules ||= []\n end",
"def rules\n @rules ||= {}\n end",
"def rules\n @rules ||= {}\n end",
"def rules\n @rules ||= {}\n end",
"def rules\n @rules ||= {}\n end",
"def find_possibilities\n (0..@field_count-1).reduce({}) do |acc, i|\n acc[i] = @rules\n .select do |rule|\n ticket_values_at(i).all? { |v| rule.valid?(v) }\n end\n .map(&:name)\n\n acc\n end\n end",
"def search(*rules); end",
"def search(*rules); end",
"def patterns\n #@rules.every.pattern\n @rules.map {|r| r.pattern }\n end",
"def all\n @rules\n end",
"def get_candidates(rules)\n candidates = []\n rules.each { |rule| candidates << rule if rule.ever_matched? && rule.time_to_report? }\n candidates\n end",
"def get_relevant_rules\r\n @relevant_rules = Array.new\r\n @facts.each { |k,f| \r\n add_relevant_rules_for_fact f\r\n }\r\n sort_relevant_rules\r\n end",
"def rules_for(state, char)\n rules.select { |rule| rule.applies_to?(state, char) }\n end",
"def add_relevant_rules_for_fact fact\r\n @rules.values.select { |rule| \r\n if !@relevant_rules.include?( rule)\r\n if rule.parameters_match?(fact.value) \r\n @relevant_rules << rule \r\n logger.debug \"#{rule} is relevant\" if logger\r\n else\r\n logger.debug \"#{rule} is not relevant\" if logger \r\n end \r\n end\r\n } \r\n end",
"def rules\n self.class.rules\n end",
"def rules_with_epsilon()\n rules = []\n @rules.each do |rule|\n rules << rule if rule.epsilon?\n end\n rules\n end",
"def rules\n return @rules\n end",
"def rules\n #\n # This is called first in case any preable needs to be declared (chains, specifically)\n #\n _ruleset_rules = ruleset_rules\n\n [\n Asbestos.firewall.preamble(self),\n _ruleset_rules,\n Asbestos.firewall.postamble(self)\n ].flatten\n end",
"def rules_for(path)\n @rules.reverse.select do |rule| path.match(rule.pattern) end\n end",
"def rules\n return [] if @rules.empty?\n @rules.sort_by { |k| k['priority'] }.map { |h| h['rule_name'] }\n end",
"def rules\n @rules ||= begin\n @rules = []\n resolve_permissions\n @rules\n end\n end",
"def rule; end",
"def rule; end",
"def rule; end",
"def known_rules\n @table.keys\n end",
"def consume_rules(flags = {})\n rules = []\n\n while token = @tokens.consume\n case token[:node]\n when :comment, :whitespace\n rules << token\n\n when :cdc, :cdo\n unless flags[:top_level]\n @tokens.reconsume\n rule = consume_qualified_rule\n rules << rule if rule\n end\n\n when :at_keyword\n @tokens.reconsume\n rule = consume_at_rule\n rules << rule if rule\n\n else\n @tokens.reconsume\n rule = consume_qualified_rule\n rules << rule if rule\n end\n end\n\n rules\n end",
"def rules_for(table)\n by_string, ages = rules_by_string(table, [])\n by_regexp, ages = rules_by_regexp(table, ages)\n for_all, ages = rules_for_all(table, ages)\n\n valid_rules = by_string + by_regexp + for_all\n valid_rules.sort { |a, b| b[:age] <=> a[:age] }\n end",
"def extract_flags\n @flags.clear\n rules.each_with_index do |r, i|\n @flags << i unless r.alternatives.size == 1\n end\n end",
"def rules\n return @rules unless @rules.nil?\n\n # this initialization code runs only once\n @rules = {}\n 7.downto(0).each do |rule_key|\n key = rule_key.to_s(2).rjust(3, '0') # convert to binary, pad left with 0\n @rules[key.to_sym] = RULE_NAME >> rule_key & 1 # just the one bit\n end\n\n @rules\n end",
"def rules\n @rules.dup.freeze\n end",
"def rules_for(aNonTerm)\n rules.select { |a_rule| a_rule.lhs == aNonTerm }\n end",
"def get_rules\r\n @rules\r\n end",
"def construct_rules or_clauses_pos=nil, or_clauses_neg=nil\n \n or_clauses_pos = @or_clauses_pos unless or_clauses_pos.nil?\n or_clauses_neg = @or_clauses_neg unless or_clauses_neg.nil?\n\n #or_clauses_pos = translate_OR_clauses or_clauses_pos\n #or_clauses_neg = translate_OR_clauses or_clauses_neg\n \n\n puts \"Negation clauses: #{@or_clauses_neg.length}\"\n #Negations as PT ORed list.\n \n #Generate ORed negation string, surrounded by parentheses.\n negation_clauses = '\"snow inte\" OR \"snow nicht\" OR \"dj snow\" OR \"snow nights\" OR \"social snow\" OR \"snow repair\" OR snow dinner OR \"snow barista\"'\n puts \"Negations require #{negation_clauses.length} characters.\"\n\n puts \"Positive clauses: #{@or_clauses_pos.length}\"\n \n puts \"OK< build rules \"\n\n #Look at *negative* clauses first since they need to be in each rule.\n if !or_clauses_neg.nil? then\n\n if or_clauses_neg.length > @negative_limit and @negative_limit != -1 then\n puts 'More negation clauses then currently supported!'\n return\n end\n\n pt_clauses_neg = or_clauses_neg.join(' OR ')\n pt_clauses_neg = \"-(#{pt_clauses_neg})\"\n @negation_buffer = pt_clauses_neg.length\n if @negation_buffer > (0.9 * @length_limit) then\n puts 'Warning: only 10% of rule length available for positive clauses!'\n end\n end\n\n #Handle *positive* clauses.\n\n positive_length = @length_limit - @negation_buffer - 1 #Allocating a space inbetween pos/neg clauses.\n\n pt_rule_clauses = []\n pt_rules_pos = []\n clauses = 0\n pt_rule = ''\n\n or_clauses_pos.each do |clause|\n\n number_of_clauses = count_clauses(clause)\n #puts \"#{clause}: with #{number_of_clauses} clauses\"\n\n #TODO: this loop logic is likely orphaning the last few clauses...\n #And is hardcoded to standard rules.\n if clauses < (@positive_limit - number_of_clauses) and pt_rule.length < (positive_length - clause.length) then\n pt_rule_clauses << clause\n clauses = clauses + number_of_clauses\n pt_rule = pt_rule_clauses.join(' OR ')\n else #Reached a limit, so write positive portion of rule.\n pt_rule_clauses << clause\n pt_rule = pt_rule_clauses.join(' OR ')\n #puts pt_rule\n pt_rules_pos << pt_rule\n #Initialize.\n pt_rule_clauses = []\n pt_rule = ''\n clauses = 0\n end\n end\n\n pt_rules_pos.each do |pt_rule_pos|\n pt_rule = pt_rule_pos + ' ' + pt_clauses_neg\n @pt_rules << pt_rule\n puts pt_rule\n end\n\n end",
"def subsequent_rules(*args); end",
"def subsequent_rules(*args); end",
"def matching_rules(number, rules)\n result = []\n rules.each do |rule, ranges|\n ranges.each do |range|\n next if number < range[0] || number > range[1]\n\n result.append(rule)\n break\n end\n end\n result\nend",
"def rules\n @rules=get_endpoint('rule').keys\n end",
"def relevant_rules(action, subject)\n return [] unless @rules\n\n relevant = possible_relevant_rules(subject).select do |rule|\n rule.expanded_actions = expand_actions(rule.actions)\n rule.relevant? action, subject\n end\n relevant.reverse!.uniq!\n optimize_order! relevant\n relevant\n end",
"def all_defined_rules\n if @group\n @defined_rules.merge(@group.all_defined_rules)\n else\n @defined_rules\n end\n end",
"def parse_rules(rules)\n rules.split(\"\\n\").each_with_object({}) do |rule, rule_hsh|\n mdata = /\\s{3}(\\w+)\\s/.match(rule)\n case mdata.nil? ? nil : mdata[1]\n when 'match'\n rule_hsh[:match] = [] unless rule_hsh.include?(:match)\n rule_hsh[:match] << rule.sub('match', '').strip\n when 'set'\n rule_hsh[:set] = [] unless rule_hsh.include?(:set)\n rule_hsh[:set] << rule.sub('set', '').strip\n when 'continue'\n rule_hsh[:continue] = nil unless rule_hsh.include?(:continue)\n rule_hsh[:continue] = rule.sub('continue', '').strip.to_i\n when 'description'\n rule_hsh[:description] = nil unless rule_hsh.include?(:description)\n rule_hsh[:description] = rule.sub('description', '').strip\n end\n end\n end",
"def load_rules; end",
"def get_rules\n rules = Array.new\n\n RULE_TYPES.each do |reg|\n ebtables_exit = `#{CONF[:ebtables]} -L FORWARD`\n\n rules << ebtables_exit.split(\"\\n\")[3..-1].collect do |l|\n line = l.strip\n m = line.match(reg)\n\n if m\n interface=m[1]\n {\n :interface => interface, \n :rule => line\n }\n else\n nil\n end\n end.compact\n end\n\n rules.flatten\nend",
"def defined_rules\n @defined_rules ||= {}\n end",
"def matches(facts)\n rules.values.map {|rule|\n rule.matches(facts).map { |bindings| Match.new(rule,bindings) }\n }.reduce(:+).uniq\n end",
"def all\n rules = []\n\n raw.each do |type, details|\n # Add general rules\n Array(details['prefix']).each do |prefix|\n rules.push({\n prefix: prefix.to_s,\n length: details['length'],\n type: type\n })\n end\n\n # Process each country\n Array(details['countries']).each do |country, prefixes|\n # Add a rule for each prefix\n Array(prefixes).each do |prefix|\n rules.push({\n prefix: prefix.to_s,\n length: details['length'],\n type: type,\n country: country,\n })\n end\n end\n\n end\n\n # Sort by prefix length\n rules.sort { |x, y| y[:prefix].length <=> x[:prefix].length }\n end",
"def optimize_order!(rules)\n first_can_in_group = -1\n rules.each_with_index do |rule, i|\n (first_can_in_group = -1) && next unless rule.base_behavior\n (first_can_in_group = i) && next if first_can_in_group == -1\n next unless rule.subjects == [:all]\n\n rules[i] = rules[first_can_in_group]\n rules[first_can_in_group] = rule\n first_can_in_group += 1\n end\n end",
"def rules\n\t\tf = File.read(\"./rules.txt\")\n\t\tputs \"#{f}\"\n\t\tback_option = gets.chomp.to_i\n\t\trules_option(back_option)\n\tend",
"def rules( *new_values )\n\t\tself.rules = new_values unless new_values.empty?\n\t\treturn @rules\n\tend",
"def then_rules\n @then_rules ||= []\n end",
"def rules # :nodoc:\n # Rules should always be returned sorted with oldest first.\n @rules.sort! { |a, b| b[:age] <=> a[:age] }\n end",
"def process_rules\n @rules.each do |rule|\n rule.process(@commands, @vars)\n end\n\n @commands.uniq!\n end",
"def relevant_rules(action, subject)\n rules.reverse.select do |rule|\n rule.expanded_actions = expand_actions(rule.actions)\n rule.relevant? action, subject\n end\n end",
"def all\n @rules ||= raw.values.flatten.map { |rule| Accessibility::Rule.new(rule) }\n end",
"def find_rules(dir)\n if File.directory?(dir)\n Dir.entries(dir).grep(/_rule.rb$/)\n else\n @logger.debug(\"The argument %s is not a directory while looking for rules\" % dir)\n []\n end\n end",
"def rules\n rule_applier.rules\n end",
"def spellout_rules = rbnf(:spellout_rules)",
"def to_list\n rules.map do |rule|\n object = { actions: rule.actions, subject: rule.subjects.map{ |s| s.is_a?(Symbol) ? s : s.name } }\n object[:conditions] = rule.conditions unless rule.conditions.blank?\n object[:inverted] = true unless rule.base_behavior\n object\n end\n end",
"def dumpRules()\r\n 79.times {print \"=\"}\r\n puts\r\n puts \"RULE DUMP\".center(80)\r\n 79.times {print \"=\"}\r\n puts\r\n\r\n if(@rules.length > 0)\r\n rules = @rules.sort\r\n rules.each do |key, rule|\r\n puts \"#{rule.name}\\t(#{rule.alias})\"\r\n puts \"#{rule.xml}\"\r\n 40.times {print \"-\"}\r\n puts\r\n end\r\n\r\n else\r\n puts \"No rules to dump.\"\r\n end\r\n\r\n puts \"\"\r\n end",
"def load_parameter_rules(rules); end",
"def rules_at(keys, *rest)\n if defined?(keys.exclude_end?)\n return @rules[keys]\n end\n ([keys]+rest).flatten.map{ |i| rule_at(i) }\n end",
"def inspect\r\n @rules.each{|r|\r\n r[1].each{|d|\r\n print r[0].to_s + \" => \" + d[0].inspect + \" TXTO \" + d[1].inspect + \"\\n\"\r\n }\r\n }\r\n end",
"def check_all_rules_for_left_recursion\n @grammar.build_nfa # make sure we have NFAs\n @grammar.attr_left_recursive_rules = HashSet.new\n list_of_recursive_cycles = ArrayList.new\n i = 0\n while i < @grammar.attr_composite.attr_rule_index_to_rule_list.size\n r = @grammar.attr_composite.attr_rule_index_to_rule_list.element_at(i)\n if (!(r).nil?)\n @visited_during_recursion_check = HashSet.new\n @visited_during_recursion_check.add(r)\n visited_states = HashSet.new\n trace_states_looking_for_left_recursion(r.attr_start_state, visited_states, list_of_recursive_cycles)\n end\n i += 1\n end\n if (list_of_recursive_cycles.size > 0)\n ErrorManager.left_recursion_cycles(list_of_recursive_cycles)\n end\n return list_of_recursive_cycles\n end",
"def rules_containing(production)\n rules = []\n @rules.each do |rule|\n rules << rule if rule.productions.include?(production)\n end\n rules\n end",
"def rules\n \"Choose rock, paper, scissors, lizard, or spock.\"\n end",
"def printOutRules\n\tputs \"\"\n\tputs \"a. Social Security Number\"\n\tputs \"b. US Phone number\"\n\tputs \"c. E-mail address\"\n\tputs \"d. Name on a class roster, assuming one or more middle initials - Last name, First name, MI\"\n\tputs \"e. Date in MM-DD-YYYY format\"\n\tputs \"f. House address - Street number, street name, abbreviation for road, street, boulevard or avenue\"\n\tputs \"g. City followed by state followed by zip as it should appear on a letter\"\n\tputs \"h. Military time, including seconds\"\n\tputs \"i. US Currency down to the penny (ex: $123,456,789.23\"\n\tputs \"j. URL, including http://\"\n\tputs \"k. A password\"\n\tputs \"l. All words containing an odd number of alphabetic characters, ending in ion\"\n\tputs \"q. quit\"\n\tputs \"\"\nend",
"def each(&block)\n sort_if_needed\n @rules.each(&block)\n end",
"def check_rank_rules\n defined_rules.each do |scoped_model, level_and_rules|\n level_and_rules.sort.each do |level, rule|\n grant_when_applies(scoped_model, rule, level)\n end\n end\n end",
"def get_modifying_rules(agent, opponent)\n modified_by = Hash.new { [[],[]] }\n track = lambda do |set, index|\n set.each_with_index do |rule, rule_i|\n rule.alternatives.each do |alt|\n alt.modifiers.each do |mod|\n arr = modified_by[mod.predicate]\n arr[index] << [rule_i, mod.type]\n modified_by[mod.predicate] = arr\n end\n end\n end\n end\n track.call(agent.actions, 0)\n track.call(opponent.rules, 1)\n return modified_by\n end",
"def rules_check(name)\n @rules.map { |rule| rule.check(variable: name) }.join(' && ')\n end",
"def load_cop_rules(rules); end",
"def package_rules\n {\n 1 => %w( p1 p2 ),\n 2 => %w( p1 p2 ),\n 3 => %w( p1 ),\n }.fetch(level)\n end",
"def passing_rules\n @passing_rules ||= rules.dup.passing\n end",
"def print_rules(*names)\n names = nil if names.empty?\n puts \"(#{runner.root})\"\n runner.rulesets.each do |name, set|\n next unless names.member?(name.to_s) if names\n print \"#{name}\"\n print \" (#{set.chain.join(' ')})\" unless set.chain.empty?\n puts\n set.docs.each_with_index do |d, i|\n puts \" * #{d}\"\n end\n end\n\n #exit\n end",
"def closure(rules)\n\t\tj = rules.map{|x| x.clone};\n\t\tall_rules = [];\n\t\t@rules .each{ |x,y| y.each{ |z| all_rules += [[x, z, 0]] }}\n\t\tj .each{ | x| all_rules -= [ x ] }\n\t\t#p all_rules\n\t\tbegin\n\t\t\tis_added = false;\n\t\t\tj.each do |c_rule|\n\t\t\t\tif c_rule[1].size >= c_rule[2] then\n\t\t\t\t\tnonterm_to_add = c_rule[1][c_rule[2]]\n\t\t\t\t\t#p nonterm_to_add\n\t\t\t\t\tif nonterm_to_add.class == Symbol then\n\t\t\t\t\t\ttemp = [];\n\t\t\t\t\t\tall_rules.each do |rule_to_add|\n\t\t\t\t\t\t\t#p rule_to_add\n\t\t\t\t\t\t\tif nonterm_to_add == rule_to_add[0] then\n\t\t\t\t\t\t\t\ttemp += [rule_to_add];\n\t\t\t\t\t\t\t\tis_added = true;\n\t\t\t\t\t\t\tend\n\t\t\t\t\t\tend\n\t\t\t\t\t\tall_rules -= temp;\n\t\t\t\t\t\tj += temp;\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\tend\n\t\tend while is_added\n\t\treturn j;\n\tend",
"def rules\n cluster.configurationEx.rule\n end",
"def rules\n cluster.configurationEx.rule\n end",
"def rules\n @rules ||= Rules.new(path, logger)\n end",
"def failing_rules\n @failing_rules ||= rules.dup.failing\n end",
"def class_rules\n [\n Rule.new(:error, 4..6, \"Description Markdown\", \"Above your class you need documentation that covers the scope, and the usage of your plugin.\", proc do |json|\n json[:body_md] && json[:body_md].empty?\n end),\n Rule.new(:warning, 30, \"Tags\", \"This plugin does not include `@tags tag1, tag2` and thus will be harder to find in search.\", proc do |json|\n json[:tags] && json[:tags].empty?\n end),\n Rule.new(:warning, 29, \"References\", \"Ideally, you have a reference implementation of your plugin that you can show to people, add `@see org/repo` to have the site auto link it.\", proc do |json|\n json[:see] && json[:see].empty?\n end),\n Rule.new(:error, 8..27, \"Examples\", \"You should include some examples of common use-cases for your plugin.\", proc do |json|\n json[:example_code] && json[:example_code].empty?\n end)\n ]\n end",
"def setup_match_rules\n include_match << Regexp.new('.') if @include_match.flatten.size == 0\n $logger.debug \"include match rules:\"\n @include_match.each { |pm| $logger.debug \"+ #{pm.to_s}\" }\n $logger.debug \"exclude match rules:\"\n @exclude_match.each { |nm| $logger.debug \"+ #{nm.to_s}\" }\n end",
"def prioritize_rules()\n \n #\n # Process all :reorder_specs. The top row of each table form roots of the DAG.\n # We test for cycles as we go -- there can't be any. \n \n root_sets = []\n hierarchy = Util::DirectedAcyclicGraph.new( false )\n @reorder_specs.each do |spec|\n previous_level = []\n spec.reorder_levels.each do |level|\n \n #\n # Collect rule reference TO RULES IN THIS GRAMMAR ONLY. Rule priority is about\n # rule production. A grammar can use rules from other grammars, but can't PRODUCE\n # rules from other grammars, so local rules only need apply. This is only an issue\n # for groups, where we'll just skip anything that isn't a local Rule.\n \n current_level = []\n level.references.each do |name_token|\n name = name_token.text\n if @rule_defs.member?(name) then\n current_level << name\n elsif @group_defs.member?(name) then\n @group_defs[name].member_references.each do |reference|\n if reference.is_a?(RuleReference) then\n unless (reference.symbol_name.grammar.exists? and reference.symbol_name.grammar != @name)\n current_level << reference.symbol_name.name\n end\n end\n end\n end\n end\n \n #\n # Everything in the current_level is linked to everything in the previous_level. If \n # there is no previous_level, then we'll register the names as points.\n \n if previous_level.empty? then\n root_sets << current_level\n current_level.each do |name|\n hierarchy.register_point( name )\n end\n else\n previous_level.each do |parent_name|\n current_level.each do |child_name|\n if hierarchy.would_cycle?(parent_name, child_name) then\n nyi( \"error handling for precedence cycle [#{parent_name}] to [#{child_name}]\" )\n else\n hierarchy.register( parent_name, child_name )\n end\n end\n end\n end\n \n previous_level = current_level\n end\n end\n \n \n #\n # Now, we want to integrate the prioritized rules back into the overall hierarchy, and we\n # want to preserve as much of the original ordering as possible. We do this by looking\n # within the prioritized rules at each layer and picking the highest priority for each\n # subtree, then inserting that layer at that index, shifting all the unprioritized rules \n # down.\n #\n # I think some examples might help explain what I mean.\n #\n # Rules: a, b, c, d, e, f, g, h | Rules: a, b, c, d, e, f\n # Order: 1, 2, 3, 4, 5, 6, 7, 8 | Order: 1, 2, 3, 4, 5, 6\n # |\n # Prec table 1: | Prec table 1:\n # d | b c\n # e g | e f\n # Prec table 2: | \n # h | \n # d | \n # g | \n # |\n # DAG layers and original order: | DAG layers and original order:\n # h 8 | b c 2 3\n # d 4 | e f 5 6\n # e g 5 7 |\n #\n # So, with these two examples, we want to reinsert the DAG elements back into the order\n # so that the DAG's hierarchy is respected, while -- as much as possible -- not disturbing \n # the original order. At each layer of the DAG, we look down the tree and find the highest\n # priority original position, and that is where we insert that layer. So\n #\n # insertion_points: | insertion_points:\n # 4, 4, 5 | 2, 5\n #\n # Now, obviously we can't insert two layers at the same point, so for the left example,\n # we'll need to adjust the second layer down a level, which will then cascade to the third\n # layer. And as there is no room between those insertion points, any rules originally at\n # levels 4, 5, or 6 must be shifted down as well.\n #\n # For the right example, notice that rule 4 doesn't need to be disturbed by the\n # the prioritization of either layer, as there is space between insertion points 2 and 5.\n # So we leave it in that position.\n #\n # insertion_points: | insertion_points:\n # 4, 5, 6 | 2, 5\n #\n # Finally, after integrating the default and prioritized rules, we get:\n # 1: a | 1: a\n # 2: b | 2: b c\n # 3: c | 3: d\n # 4: h | 4: e f\n # 5: d |\n # 6: e g |\n # 7: f |\n \n all_rules = []\n default_rules = []\n \n @rule_defs.each do |name, element|\n name = name.to_s\n \n if element.is_a?(Rule) then\n all_rules << name\n default_rules << name unless hierarchy.node?(name)\n end\n end\n\n\n #\n # Next we collect the raw insertion point data for the precedence data. But there's another \n # wrinkle. Up top, we merged all the precedence tables into one DAG, so we could find loops\n # and inter-relationships between the precedence tables. However, if some elements don't link\n # up, we don't want to prioritize all the independent trees to the same level -- we want to\n # preserve as much of the original ordering as possible. So we have to process each tree separately,\n # then interleave the data back together.\n \n insertion_point_sets = []\n insertion_layer_sets = []\n \n hierarchy.independent_trees(root_sets).each do |tree|\n insertion_points = []\n insertion_layers = []\n \n tree.each_layer_reverse do |layer|\n insertion_point = all_rules.length\n layer.each do |name|\n insertion_point = min( insertion_point, all_rules.index(name) )\n end\n \n insertion_points.unshift min(insertion_point, insertion_points.empty? ? insertion_point : insertion_points[0])\n insertion_layers.unshift layer\n end\n \n insertion_point_sets << insertion_points\n insertion_layer_sets << insertion_layers\n end\n \n \n #\n # We interleave the data sets back together. We want to do the interleaving by insertion_point.\n \n insertion_points = []\n insertion_layers = []\n\n until insertion_point_sets.empty? \n tops = insertion_point_sets.collect{|set| set[0]}\n min = tops.inject(all_rules.length){|current, aggregate| min(current, aggregate)}\n index = tops.index( min )\n \n insertion_points << insertion_point_sets[index].shift\n insertion_layers << insertion_layer_sets[index].shift\n \n if insertion_point_sets[index].empty? then\n insertion_point_sets.delete_at(index)\n insertion_layer_sets.delete_at(index)\n end\n end\n \n \n #\n # Next, we need to adjust the insertion points so that every one is unique.\n \n last_insertion_point = -1\n insertion_points.each_index do |index|\n insertion_points[index] = last_insertion_point + 1 if insertion_points[index] <= last_insertion_point\n last_insertion_point = insertion_points[index]\n end\n \n \n #\n # Finally, we have to integrate the two systems by setting the priority on each Rule. \n # We proceed one priority level at a time: if it is in the insertion_points list, we set \n # the priority for all rules on that level to that number; otherwise, we shift a name off\n # the default_rules list and set its priority instead.\n \n (default_rules.length + insertion_layers.length).times do |i|\n if insertion_points.member?(i) then\n insertion_layers[insertion_points.index(i)].each do |name|\n @rule_defs[name].priority = i\n end\n else\n default_rules.shift.each do |rule_name|\n @rule_defs[rule_name].priority = i\n end\n end\n end\n end",
"def printRules\n\t\n\t@i = 1\n\t@@rulesArray.each do |rule|\n\t\tputs \"#{@i}-#{rule.fetch('src_ip')}/#{rule.fetch('src_netmask')}:#{rule.fetch('src_port')} #{rule.fetch('dest_ip')}/#{rule.fetch('dest_netmask')}:#{rule.fetch('dest_port')} #{rule.fetch('protocol')} #{rule.fetch('action')}\"\n\t\t@i += 1\n\tend\n\n\tif @i == 1\n\t\tputs \"No rules to print!\"\n\telse\n\t\tputs \"Rules Loaded!\"\n\tend\nend",
"def main\n input = File.read('19.txt')\n messages, rules = parse(input)\n debug messages.select { |m| ok?(rules, m) }.size # 178\nend",
"def check_rule(rule)\n\n\t if rule.include? 'twitter_lang'\n\t\t rule = handle_lang_operators rule\n\t end\n\n\t if rule.include? 'has:lang'\n\t\t rule = handle_has_lang rule\n\t end\n\n\t if rule.include? '_contains:'\n\t\t rule = handle_contains_operators rule\n\t end\n\n\n\t if rule.include? 'country_code:'\n\t\t rule = handle_country_code_operators rule\n\t end\n\n\t rule\n\n end",
"def external_rules\n @external_rules ||= rules.dup.external\n end",
"def available_rules\n\t\tif @rules.nil?\n\t\t\t@rules = []\n\t\t\tDir.glob(File.join(@rule_directory,\"**\",\"*.yar*\")).each do |yara_rule_file|\n\t\t\t\trule = YaraRule.new\n\t\t\t\trule.file_path = yara_rule_file.gsub(\"/\",\"\\\\\\\\\")\n\t\t\t\t@rules << rule\n\t\t\tend\n\t\tend\n\t\treturn @rules\n\tend",
"def apply_rules\n match_reduce(\n ->((rhs1, rhs1_s), (_, rhs2_s)) {\n rhs1.size >= 2 and rhs2_s.include? rhs1_s\n },\n ->(lhs1, lhs2, _) { @cfg.factor! lhs2, lhs1 }\n )\n end",
"def rules1\n @rules1\nend",
"def rules_by_regex(regex, section_id = @one_section_id)\n rules = []\n return rules unless section_id\n\n all_rules = rules(section_id)\n return rules unless all_rules\n\n all_rules['results'].each do |rule|\n rules << rule if rule['display_name'].match(regex)\n end\n rules\n end",
"def regexps; end"
] |
[
"0.725512",
"0.725512",
"0.725512",
"0.725512",
"0.725512",
"0.725512",
"0.725512",
"0.6940835",
"0.66957676",
"0.6689045",
"0.6689045",
"0.66325474",
"0.66325474",
"0.66325474",
"0.66182363",
"0.65997565",
"0.6530327",
"0.6530327",
"0.64696985",
"0.6368541",
"0.6315894",
"0.63108486",
"0.62053484",
"0.6181465",
"0.61788404",
"0.61736494",
"0.6158972",
"0.6150634",
"0.6077862",
"0.60342234",
"0.6029474",
"0.6013093",
"0.6013093",
"0.6013093",
"0.60109615",
"0.6002251",
"0.59920686",
"0.5990598",
"0.5985611",
"0.59851253",
"0.597072",
"0.5968884",
"0.5940563",
"0.5899611",
"0.5899611",
"0.58872336",
"0.5877649",
"0.5861302",
"0.58484656",
"0.58450264",
"0.58263665",
"0.5818871",
"0.58129644",
"0.58072793",
"0.5806787",
"0.5802558",
"0.5798502",
"0.5774048",
"0.57669264",
"0.5748472",
"0.57363504",
"0.57345617",
"0.5710425",
"0.5695259",
"0.5693906",
"0.5670036",
"0.5660914",
"0.5623173",
"0.56194395",
"0.55986404",
"0.5589011",
"0.55860907",
"0.55796534",
"0.55661845",
"0.5561061",
"0.5534592",
"0.55315745",
"0.55228096",
"0.55170137",
"0.55133617",
"0.55064267",
"0.5504164",
"0.55004156",
"0.54951054",
"0.5493105",
"0.5493105",
"0.54881436",
"0.54877335",
"0.5478172",
"0.5464478",
"0.5452783",
"0.5450379",
"0.54488397",
"0.5448334",
"0.5430069",
"0.5425611",
"0.5419772",
"0.54081815",
"0.5403039",
"0.5396981"
] |
0.6318903
|
20
|
Use callbacks to share common setup or constraints between actions.
|
def set_resource
@resource = Resource.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
|
GET /families GET /families.xml
|
def index
@families = Family.paginate(:per_page => 5, :page => params[:page])
respond_to do |format|
format.html # index.html.erb
format.xml { render :xml => @families }
format.js # index.js.erb
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def list_families\n http_get(:uri=>\"/plugins/families\", :fields=>x_cookie)\n end",
"def index\n @families = Family.all\n end",
"def index\n @families = Family.all\n end",
"def index\n @families = Family.all\n end",
"def index\r\n @families = Family.all\r\n end",
"def index\n @index_action = true\n @families = Family.all\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @families }\n end\n end",
"def index\n @family_members = @current_family.family_members\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @family_members }\n end\n end",
"def index\n @product_families = ProductFamily.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @product_families }\n end\n end",
"def index\n @families = Family.find(:all, :select => \"id, business_name\", :order => \"business_name ASC\")\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @families }\n end\n end",
"def show\n @family ||= Family.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @family }\n end\n end",
"def index\n @families = Family.all.paginate(page: params[:page])\n render json: @families\n end",
"def show\n @family = get_family(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @family }\n end\n end",
"def show\n @family = Family.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @family }\n end\n end",
"def show\n @family = Family.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @family }\n end\n end",
"def families\n response = @client.get('plugins/families')\n verify response,\n forbidden: 'You do not have permission to view plugin families',\n internal_server_error: 'Server failed to retrieve the plugin '\\\n 'family list.'\n end",
"def index\n @farmer_families = @farmer.farmer_families\n end",
"def index\n @families = current_church.families\n flash[:alert] = t('.not_found') if @families.blank?\n end",
"def index\n @sub_families = SubFamily.all\n end",
"def show\n @groups_happening = GroupsHappening.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @groups_happening }\n end\n end",
"def index\n @family_relationships = FamilyRelationship.all\n end",
"def index\n @family_members = FamilyMember.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @family_members }\n end\n end",
"def families\n @ks[:family].keys\n end",
"def index\n @os_families = OsFamily.all\n end",
"def index\n @family_groups = FamilyGroup.all\n end",
"def show\n @product_family = ProductFamily.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @product_family }\n end\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 index\n @product_families = ProductFamily.paginate(:page => params[:page], :order => \"name ASC\")\n @title = \"All Product Families\"\n end",
"def index\n @giving_groups = GivingGroup.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @giving_groups }\n end\n end",
"def show\n if current_user.is_family_reporter? && (params[:id] != current_user.family_id.to_s)\n flash[:error] = \"You do not have permission to access this page.\"\n redirect_to home_path\n else\n @family = Family.find(params[:id], :include => [:users])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @family }\n end\n end\n end",
"def index\n\t\t@people = Person.all\n\t\t# respond_to do |format|\n\t\t# \tformat.xml { send_data @entries.to_xml, :type => 'text/xml; charset=UTF-8;', :disposition => 'attachment; filename=entries.xml'}\n\t\t# end\n\tend",
"def index\n @relationships = Relationship.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @relationships }\n end\n end",
"def index\n @fgroups = Fgroup.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @fgroups }\n end\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 @family_background = FamilyBackground.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @family_background }\n end\n end",
"def list()\n\t\t\tkparams = {}\n\t\t\tclient.queue_service_action_call('devicefamily', 'list', 'KalturaDeviceFamilyListResponse', 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 jobfamily\n @jobfamilies = @company.jobfamilies\n respond_to do |format|\n format.json { render json: @jobfamilies}\n end\n end",
"def index\n @partyrelationships = Partyrelationship.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @partyrelationships }\n end\n end",
"def show\n family = current_family\n p current_family\n render json: family.as_json\n end",
"def show\n @family_history = FamilyHistory.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @family_history }\n end\n end",
"def friends(id)\n friends_data(request(\"users/friends/#{id}.xml\", :auth => true))\n end",
"def show\n @family_member = FamilyMember.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @family_member }\n end\n end",
"def show\n @family_member = FamilyMember.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @family_member }\n end\n end",
"def index\n\n @groups = Group.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @groups }\n end\n end",
"def index\n @lookup_sets = LookupSet.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @lookup_sets }\n end\n end",
"def show\n @discovery = Discovery.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @discovery }\n end\n end",
"def people\n Birdman::Requester.get(\"movies/#{id}/people\")\n end",
"def index\n @family_documents = FamilyDocument.all\n end",
"def list_employees(api_object)\n puts \"Current Employees:\"\n doc = Nokogiri::XML.parse api_object.read\n names = doc.xpath('employees/employee/name').collect {|e| e.text }\n puts names.join(\", \")\n puts \"\"\nend",
"def index\n @language_families = LanguageFamily.all\n end",
"def index\n @user_groups = UserGroup.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @user_groups }\n end\n end",
"def index\n @product_families = website.product_families\n @discontinued_products = website.discontinued_and_vintage_products\n respond_to do |format|\n format.html { render_template } # index.html.erb\n # format.xml { render xml: @product_families }\n end\n end",
"def index\n @people = Person.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @people }\n end\n end",
"def index\n @people = Person.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @people }\n end\n end",
"def index\n @people = Person.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @people }\n end\n end",
"def index\n @groups = Group.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @groups }\n end\n end",
"def index\n @groups = Group.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @groups }\n end\n end",
"def index\n @distributions = @foyer.distributions\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @distributions }\n end\n end",
"def index\n @species = Species.eager_load(:family, :species_locations, :images).order('families.name')\n respond_to do |format|\n format.html {\n not_found\n }\n format.xml { render :xml => @species }\n format.json {\n render :template => 'species/index.json'\n }\n end\n end",
"def visible_families\n # right now the count is the number of species\n TaxonName.find_by_sql(\n \"SELECT p.*, count(*) as count FROM \n (SELECT * FROM taxon_names t WHERE t.iczn_group = 'family' AND RIGHT(t.name,4) = 'idae') AS p\n LEFT JOIN \n (SELECT id, l, r FROM taxon_names t2 WHERE #{self.sql_for_taxon_names('t2', :public)} AND iczn_group = 'species') AS c \n ON p.l < c.l AND p.r > c.r\n WHERE c.id IS NOT NULL \n GROUP BY p.id ORDER BY name\") \n end",
"def show\n @fam = Fam.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @fam }\n end\n end",
"def index\n\n @group_definitions = GroupDefinition.find(:all)\n\n render :xml => @group_definitions\n end",
"def index\n @agents = @habitat.agents.find(:all)\n\n respond_to do |format|\n format.html # index.rhtml\n format.xml { render :xml => @agents.to_xml }\n end\n end",
"def show\n @family_member = FamilyMember.find(params[:id])\n \n unless @current_family.member?(@family_member)\n flash[:warning] = \"Requested family member is not a member of your family\"\n redirect_to show_family_members\n end\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @family_member }\n end\n end",
"def index\n respond_to do |format|\n format.html { @groups = Group.get_groups(current_user, params) }\n format.xml { render :xml => Group.get_groups(params.merge({:show => 'all'})) }\n end\n end",
"def index\n respond_to do |format|\n format.html { @groups = Group.get_groups(current_user, params) }\n format.xml { render :xml => Group.get_groups(params.merge({:show => 'all'})) }\n end\n end",
"def show\n @control_family = ControlFamily.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @control_family }\n end\n end",
"def show\n @group_list = GroupList.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @group_list }\n end\n end",
"def index\n @user_groups = UserGroup.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @user_groups }\n end\n end",
"def new\n @family = Family.new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @family }\n end\n end",
"def index\n @fdn_org_hierarchies = Fdn::OrgHierarchy.paginate(:page => params[:page]).order(\"created_by DESC\")\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @fdn_org_hierarchies }\n end\n end",
"def friendships_show(options = {})\n @req.get(\"/1.1/friendships/show.json\", options)\n end",
"def index\n @provider_groups = ProviderGroup.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @provider_groups }\n end\n end",
"def get_all(which=:groups, options={})\n resp = self.class.get(\"/#{which}\", { :query => options })\n check_errors resp\n rebuild_xml_array!(resp.parsed_response['Response'], 'Entries', 'Entry')\n res = resp.parsed_response['Response']['Entries']\n if which == :contacts\n res.each { |c| rebuild_groups! c }\n end\n res\n end",
"def show\n respond_to do |format|\n if current_user==nil\n render json: {error: 'No estas logeado'}, status: 401\n elsif @family==nil\n format.json { render json: {error: \"El familiar no existe\"}, status: :not_found }\n elsif current_user.families.include?(@family)==false\n format.json { render json: {error: 'No posees permisos para ver a esta persona'}, status: 401 }\n else\n format.json { render json: {family: @family, intolerances: @family.intolerances} }\n end\n format.html {}\n end\n end",
"def show\n @gtfs_agency = GtfsAgency.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @gtfs_agency }\n end\n end",
"def show\n @lookup_set = LookupSet.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @lookup_set }\n end\n end",
"def index\n\n @groups = Group.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @groups }\n format.json { render :json => @groups }\n end\n end",
"def get_xml\n response = @api.request(:get, @location, type: 'xml')\n response.body if response.status == 200\n end",
"def family_id\n @gapi.family_id\n end",
"def friends(options={})\n get('/friends', options)\n end",
"def getFamilyStatus\r\n\t\t@responseObject = OpenStruct.new({\r\n\t\t\tstatus: true,\r\n\t\t\terrors: [],\r\n code: API_CODE_ERRORS['Services']['Global']['success'],\r\n\t\t\tobjectData: FamilyGender.find(:all, :order => 'name DESC')\r\n\t\t})\r\n\t\trender :template => 'api/v1/users/members/familyStatus' ,:handlers => [:rabl],:formats => [:json]\r\n\tend",
"def show\n @family_id = @user.fam_id\n\t@login = @user.login\n\t@family = Fam.find(:all, :conditions => [\"id=?\", @family_id])\n #@calendar = @user.calendars.find(params[:id])\n\t@calendar = @family[0].users[0].calendars.find(params[:id])\n\t#@family = @calendar.families\n\t#@family = Family.find(:all, :conditions => [\"id=?\", \"1\"])\n\t@user = User.find(:all, :conditions => [\"id=?\", @calendar.user_id])\n\t@family = User.find(:all, :conditions => [\"fam_id=?\", @user[0].fam_id])\n\t@fam = Fam.find(:all)\n\t#@help = @fam[0].users[0].id\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @calendar }\n end\n end",
"def show\n @giving_group = GivingGroup.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @giving_group }\n end\n end",
"def index\n @hosts = Host.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @hosts }\n end\n end",
"def get_accounts\n response_xml = http_get(\"#{xero_url}/accounts\")\n parse_response(response_xml)\n end",
"def show\n @allergy = Allergy.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @allergy }\n end\n end",
"def index\n @organizations = Organization.find(:all, :order => 'name ASC')\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @organizations }\n end\n end",
"def show\n @countries = Countries.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @countries }\n end\n end",
"def index\n @hosts = Host.find(:all, :order => 'name ASC')\n\n respond_to do |format|\n format.html # index.rhtml\n format.xml { render :xml => @hosts.to_xml }\n end\n end",
"def show\n @family_crest = FamilyCrest.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @family_crest }\n end\n end",
"def index\n @friend_requests = FriendRequest.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @friend_requests }\n end\n end",
"def family(id)\n Family.find(id)\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 index\n @groups = Group.all\n @title = \"Groups\"\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @groups }\n end\n end",
"def show\n @partyrelationship = Partyrelationship.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @partyrelationship }\n end\n end",
"def index\n @family_bonds = FamilyBond.all\n end",
"def show\n @agent = @habitat.agents.find(params[:id])\n\n respond_to do |format|\n format.html # show.rhtml\n format.xml { render :xml => @agent.to_xml }\n end\n end",
"def show\n @agencies = Agency.find(params[:id])\n\n if @agencies \n respond_to do |format|\n format.json { render :json => @agencies }\n format.xml { render :xml => @agencies }\n end \n else\n head :not_found\n end\n end",
"def index\n @friend_requests = FriendRequest.all\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @friend_requests }\n end\n end",
"def show\n @agent = Agent.find(params[:id], query)\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @agent }\n end\n end"
] |
[
"0.69550765",
"0.67924446",
"0.67924446",
"0.67924446",
"0.669971",
"0.6692907",
"0.65623444",
"0.6510627",
"0.6505992",
"0.6369165",
"0.63567764",
"0.62196285",
"0.61817163",
"0.6140663",
"0.6099821",
"0.6084856",
"0.6009684",
"0.59886146",
"0.5938279",
"0.5931289",
"0.5891094",
"0.58245844",
"0.5786175",
"0.5763246",
"0.57368684",
"0.57147944",
"0.57044",
"0.5626758",
"0.56063765",
"0.5598058",
"0.558077",
"0.55787504",
"0.55468065",
"0.5508118",
"0.5504028",
"0.5502875",
"0.5497152",
"0.548489",
"0.5479744",
"0.54661554",
"0.5456732",
"0.5456732",
"0.5439914",
"0.542274",
"0.5412762",
"0.54075307",
"0.5406404",
"0.5405865",
"0.5402742",
"0.5396119",
"0.5396088",
"0.5384544",
"0.5384544",
"0.5384544",
"0.5381835",
"0.5381835",
"0.53664213",
"0.5365358",
"0.53589",
"0.5357814",
"0.53542536",
"0.53304714",
"0.5330467",
"0.5320055",
"0.5320055",
"0.5302802",
"0.5301843",
"0.5294634",
"0.5290897",
"0.5290232",
"0.52899355",
"0.52789783",
"0.5274746",
"0.5264843",
"0.5262829",
"0.52498305",
"0.5247348",
"0.5245044",
"0.5244214",
"0.5243244",
"0.5243162",
"0.5236417",
"0.5235408",
"0.52318686",
"0.5224855",
"0.5221772",
"0.52198166",
"0.5216069",
"0.5214569",
"0.521096",
"0.5210668",
"0.52078056",
"0.52067155",
"0.5199763",
"0.5199618",
"0.51984674",
"0.51950645",
"0.51945025",
"0.519246",
"0.5192392"
] |
0.6082653
|
16
|
GET /families/1 GET /families/1.xml
|
def show
@family ||= Family.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.xml { render :xml => @family }
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def index\n @families = Family.all\n end",
"def index\n @families = Family.all\n end",
"def index\n @families = Family.all\n end",
"def index\n @index_action = true\n @families = Family.all\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @families }\n end\n end",
"def index\r\n @families = Family.all\r\n end",
"def index\n @family_members = @current_family.family_members\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @family_members }\n end\n end",
"def index\n @families = Family.find(:all, :select => \"id, business_name\", :order => \"business_name ASC\")\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @families }\n end\n end",
"def index\n @product_families = ProductFamily.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @product_families }\n end\n end",
"def show\n @family = get_family(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @family }\n end\n end",
"def show\n @family = Family.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @family }\n end\n end",
"def show\n @family = Family.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @family }\n end\n end",
"def list_families\n http_get(:uri=>\"/plugins/families\", :fields=>x_cookie)\n end",
"def index\n @families = Family.all.paginate(page: params[:page])\n render json: @families\n end",
"def index\n\t\t@families = Family.paginate(:per_page => 5, :page => params[:page])\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @families }\n\t\t\tformat.js # index.js.erb\n end\n end",
"def show\n @product_family = ProductFamily.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @product_family }\n end\n end",
"def show\n @groups_happening = GroupsHappening.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @groups_happening }\n end\n end",
"def index\n @sub_families = SubFamily.all\n end",
"def index\n @family_relationships = FamilyRelationship.all\n end",
"def index\n @farmer_families = @farmer.farmer_families\n end",
"def show\n if current_user.is_family_reporter? && (params[:id] != current_user.family_id.to_s)\n flash[:error] = \"You do not have permission to access this page.\"\n redirect_to home_path\n else\n @family = Family.find(params[:id], :include => [:users])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @family }\n end\n end\n end",
"def index\n @family_members = FamilyMember.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @family_members }\n end\n end",
"def index\n @families = current_church.families\n flash[:alert] = t('.not_found') if @families.blank?\n end",
"def new\n @family = Family.new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @family }\n end\n end",
"def show\n @family_background = FamilyBackground.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @family_background }\n end\n end",
"def index\n\t\t@people = Person.all\n\t\t# respond_to do |format|\n\t\t# \tformat.xml { send_data @entries.to_xml, :type => 'text/xml; charset=UTF-8;', :disposition => 'attachment; filename=entries.xml'}\n\t\t# end\n\tend",
"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 friends(id)\n friends_data(request(\"users/friends/#{id}.xml\", :auth => true))\n end",
"def show\n @discovery = Discovery.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @discovery }\n end\n end",
"def show\n @family_member = FamilyMember.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @family_member }\n end\n end",
"def show\n @family_member = FamilyMember.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @family_member }\n end\n end",
"def index\n @fgroups = Fgroup.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @fgroups }\n end\n end",
"def index\n @relationships = Relationship.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @relationships }\n end\n end",
"def show\n @fam = Fam.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @fam }\n end\n end",
"def show\n @family_history = FamilyHistory.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @family_history }\n end\n end",
"def index\n @family_groups = FamilyGroup.all\n end",
"def index\n @product_families = ProductFamily.paginate(:page => params[:page], :order => \"name ASC\")\n @title = \"All Product Families\"\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 index\n @giving_groups = GivingGroup.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @giving_groups }\n end\n end",
"def show\n @allergy = Allergy.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @allergy }\n end\n end",
"def destroy\n\t\t@family ||= Family.find(params[:id])\n @family.destroy\n respond_to do |format|\n format.html { redirect_to(families_url) }\n format.xml { head :ok }\n end\n end",
"def family(id)\n Family.find(id)\n end",
"def index\n @distributions = @foyer.distributions\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @distributions }\n end\n end",
"def show\n @family_member = FamilyMember.find(params[:id])\n \n unless @current_family.member?(@family_member)\n flash[:warning] = \"Requested family member is not a member of your family\"\n redirect_to show_family_members\n end\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @family_member }\n end\n end",
"def index\n @partyrelationships = Partyrelationship.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @partyrelationships }\n end\n end",
"def index\n @os_families = OsFamily.all\n end",
"def show\n @gene = Gene.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @gene }\n end\n end",
"def index\n @family_documents = FamilyDocument.all\n end",
"def index\n @people = Person.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @people }\n end\n end",
"def index\n @people = Person.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @people }\n end\n end",
"def index\n @people = Person.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @people }\n end\n end",
"def show\n @fgroup = Fgroup.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @fgroup }\n end\n end",
"def show\n family = current_family\n p current_family\n render json: family.as_json\n end",
"def show\n @giving_group = GivingGroup.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @giving_group }\n end\n end",
"def show\n @gene_ontology = GeneOntology.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @gene_ontology }\n end\n end",
"def show\n @family_id = @user.fam_id\n\t@login = @user.login\n\t@family = Fam.find(:all, :conditions => [\"id=?\", @family_id])\n #@calendar = @user.calendars.find(params[:id])\n\t@calendar = @family[0].users[0].calendars.find(params[:id])\n\t#@family = @calendar.families\n\t#@family = Family.find(:all, :conditions => [\"id=?\", \"1\"])\n\t@user = User.find(:all, :conditions => [\"id=?\", @calendar.user_id])\n\t@family = User.find(:all, :conditions => [\"fam_id=?\", @user[0].fam_id])\n\t@fam = Fam.find(:all)\n\t#@help = @fam[0].users[0].id\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @calendar }\n end\n end",
"def show\n @distribution = @foyer.distributions.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @distribution }\n end\n end",
"def show\n @relationship = Relationship.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @relationship }\n end\n end",
"def show\n @lookup_set = LookupSet.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @lookup_set }\n end\n end",
"def show\n @agent = Agent.find(params[:id], query)\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @agent }\n end\n end",
"def show\n @gtfs_agency = GtfsAgency.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @gtfs_agency }\n end\n end",
"def family_id\n @gapi.family_id\n end",
"def index\n @product_families = website.product_families\n @discontinued_products = website.discontinued_and_vintage_products\n respond_to do |format|\n format.html { render_template } # index.html.erb\n # format.xml { render xml: @product_families }\n end\n end",
"def index\n @lookup_sets = LookupSet.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @lookup_sets }\n end\n end",
"def show\n @control_family = ControlFamily.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @control_family }\n end\n end",
"def show\n @agent = @habitat.agents.find(params[:id])\n\n respond_to do |format|\n format.html # show.rhtml\n format.xml { render :xml => @agent.to_xml }\n end\n end",
"def jobfamily\n @jobfamilies = @company.jobfamilies\n respond_to do |format|\n format.json { render json: @jobfamilies}\n end\n end",
"def show\n @partyrelationship = Partyrelationship.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @partyrelationship }\n end\n end",
"def index\n\n @groups = Group.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @groups }\n end\n end",
"def show\n @group_list = GroupList.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @group_list }\n end\n end",
"def families\n response = @client.get('plugins/families')\n verify response,\n forbidden: 'You do not have permission to view plugin families',\n internal_server_error: 'Server failed to retrieve the plugin '\\\n 'family list.'\n end",
"def index\n @species = Species.eager_load(:family, :species_locations, :images).order('families.name')\n respond_to do |format|\n format.html {\n not_found\n }\n format.xml { render :xml => @species }\n format.json {\n render :template => 'species/index.json'\n }\n end\n end",
"def show\n @brothers = Brother.all\n @brother = Brother.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @brother }\n end\n end",
"def set_family\n @family = Family.find(params[:id])\n end",
"def set_family\n @family = Family.find(params[:id])\n end",
"def index\n @groups = Group.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @groups }\n end\n end",
"def index\n @groups = Group.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @groups }\n end\n end",
"def show\n @gene_group = GeneGroup.find(params[:id], :include => :genes)\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @gene_group }\n format.text { render :text => @gene_group.json_query.to_s}\n end\n end",
"def show\n \n \n @people= Person.findByNameOrId(params[:id])\n \n if (@people.length == 1) \n @person = @people[0]\n else \n if(@people.length > 1)\n @name = params[:id].capitalize\n disambiguation\n return\n end\n end \n \n if(!@person)\n redirect_to '/search?q=' +params[:id].is_a?(Numeric) #+ params[:id].to_s + '&page=1'\n return\n end\n \n @max_depth = params[:family_tree_depth] || 3 \n @max_depth = @max_depth.to_i\n \n respond_to do |format|\n format.html { render :layout => \"main\" } # show.html.erb\n format.xml { render :xml => @person }\n end\n end",
"def show\n @allergen = Allergen.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @allergen }\n end\n end",
"def new\n @family_member = FamilyMember.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @family_member }\n end\n end",
"def show\n @family_crest = FamilyCrest.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @family_crest }\n end\n end",
"def index\n\n @group_definitions = GroupDefinition.find(:all)\n\n render :xml => @group_definitions\n end",
"def show\n @person = Person.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @person.to_xml}\n end\n end",
"def show\n @children = Children.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @children }\n end\n end",
"def set_family\n @family = Family.friendly.find(params[:id])\n end",
"def show\n @node = Node.find(params[:id])\n @title = \"Taxonomy node - organism relationships\"\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @node }\n end\n end",
"def set_family\r\n @family = Family.find(params[:id])\r\n end",
"def set_family\n @family = Family.find(params[:id])\n end",
"def set_family\n @family = Family.find(params[:id])\n end",
"def show\n @ganglia_graph = GangliaGraph.get(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @ganglia_graph }\n end\n end",
"def index\n @nodes = Node.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @nodes }\n end\n end",
"def index\n @nodes = Node.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @nodes }\n end\n end",
"def index\n @clusters = Cluster.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @clusters }\n end\n end",
"def show\n @feat = @person.feats.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @feat }\n end\n end",
"def show\n @node = Node.scopied.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @node }\n end\n end",
"def show\n @probe = Probe.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @probe }\n end\n end",
"def create\n @family = Family.new(params[:family])\n respond_to do |format|\n if @family.save\n flash[:notice] = 'Family was successfully created.'\n format.html { redirect_to(@family) }\n format.xml { render :xml => @family, :status => :created, :location => @family }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @family.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def show\n @grupo = Grupo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @grupo }\n end\n end",
"def index\n @agents = @habitat.agents.find(:all)\n\n respond_to do |format|\n format.html # index.rhtml\n format.xml { render :xml => @agents.to_xml }\n end\n end",
"def show\n @correspondence = Correspondence.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @correspondence }\n end\n end"
] |
[
"0.66391575",
"0.66391575",
"0.66391575",
"0.6602366",
"0.6556731",
"0.6552282",
"0.6541676",
"0.6533416",
"0.639149",
"0.63565314",
"0.63284785",
"0.6238541",
"0.6151105",
"0.60792756",
"0.60305876",
"0.6013372",
"0.6001987",
"0.5892585",
"0.5880879",
"0.5880842",
"0.5808232",
"0.57959837",
"0.5765471",
"0.5748626",
"0.5724997",
"0.5692005",
"0.56650573",
"0.5662156",
"0.56592613",
"0.56592613",
"0.5657037",
"0.5648939",
"0.56449664",
"0.56314766",
"0.56230015",
"0.5604138",
"0.56009007",
"0.5596697",
"0.55961573",
"0.55660254",
"0.5561375",
"0.5555642",
"0.5552195",
"0.55215454",
"0.55114233",
"0.55027735",
"0.54887253",
"0.5480432",
"0.5480432",
"0.5480432",
"0.547901",
"0.5468102",
"0.5467537",
"0.54656065",
"0.5462274",
"0.5458505",
"0.5456233",
"0.54495984",
"0.5448602",
"0.5442544",
"0.5441765",
"0.5437885",
"0.5437256",
"0.5429408",
"0.5428821",
"0.541383",
"0.54137224",
"0.5411343",
"0.54093784",
"0.5406842",
"0.53919435",
"0.53622913",
"0.5361495",
"0.5361495",
"0.535695",
"0.535695",
"0.53441525",
"0.53338253",
"0.53280455",
"0.5327236",
"0.5326768",
"0.5325104",
"0.53217894",
"0.53210175",
"0.5318847",
"0.53099537",
"0.53065395",
"0.5285917",
"0.5285917",
"0.52854013",
"0.52851534",
"0.52851534",
"0.5284387",
"0.52830166",
"0.52809024",
"0.5280856",
"0.5279699",
"0.5275518",
"0.52704257",
"0.52687746"
] |
0.6711528
|
0
|
GET /families/new GET /families/new.xml
|
def new
@family = Family.new
respond_to do |format|
format.html # new.html.erb
format.xml { render :xml => @family }
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def new\n @family = Family.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @family }\n end\n end",
"def new\n @family_member = FamilyMember.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @family_member }\n end\n end",
"def create\n @family = Family.new(params[:family])\n respond_to do |format|\n if @family.save\n flash[:notice] = 'Family was successfully created.'\n format.html { redirect_to(@family) }\n format.xml { render :xml => @family, :status => :created, :location => @family }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @family.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @family = Family.new(params[:family])\n\n respond_to do |format|\n if @family.save\n flash[:notice] = 'Family was successfully created.'\n format.html { redirect_to(@family) }\n format.xml { render :xml => @family, :status => :created, :location => @family }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @family.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def new\n @people = People.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @people }\n end\n end",
"def new\n @product_family = ProductFamily.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @product_family }\n end\n end",
"def new\n @groups_happening = GroupsHappening.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @groups_happening }\n end\n end",
"def new\n @lookup_set = LookupSet.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @lookup_set }\n end\n end",
"def new\n @partyrelationship = Partyrelationship.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @partyrelationship }\n end\n end",
"def new\n @relationship = Relationship.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @relationship }\n end\n end",
"def new\n @node = Node.scopied.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @node }\n end\n end",
"def new\n @fam = Fam.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @fam }\n end\n end",
"def new\n @breadcrumb = 'create'\n @product_family = ProductFamily.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @product_family }\n end\n end",
"def new\n @family_member = FamilyMember.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @family_member }\n end\n end",
"def new\n @family_member = FamilyMember.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @family_member }\n end\n end",
"def new\n @discovery = Discovery.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @discovery }\n end\n end",
"def new\n @family_background = FamilyBackground.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @family_background }\n end\n end",
"def new\n @family_history = FamilyHistory.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @family_history }\n end\n end",
"def new\n @family_crest = FamilyCrest.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @family_crest }\n end\n end",
"def new\n @feat = @person.feats.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @feat }\n end\n end",
"def new\n @groups = Group.all\n respond_to do |format|\n format.html # new.html.haml\n format.xml { render :xml => @person }\n format.json { render :json => @person }\n end\n end",
"def new\n @gene_ontology = GeneOntology.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @gene_ontology }\n end\n end",
"def new\n @person = Person.new\n @person.names.new\n \n respond_to do |format|\n format.html { render :layout => \"main\" } # new.html.erb\n format.xml { render :xml => @person }\n end\n end",
"def new\n @node = Node.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @node }\n end\n end",
"def new\n @node = Node.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @node }\n end\n end",
"def new\n @person = Person.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @person }\n end\n end",
"def new\n @person = Person.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @person }\n end\n end",
"def new\n @person = Person.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @person }\n end\n end",
"def new\n @person = Person.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @person }\n end\n end",
"def new\n @person = Person.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @person }\n end\n end",
"def new\n @person = Person.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @person }\n end\n end",
"def new\n @person = Person.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @person }\n end\n end",
"def new\n @person = Person.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @person }\n end\n end",
"def new\n @person = Person.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @person }\n end\n end",
"def new\n @person = Person.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @person }\n end\n end",
"def new\n @partytype = Partytype.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @partytype }\n end\n end",
"def create\n family_params\n f = params[:family]\n @family = Family.new\n @family.name = f[:name]\n\n respond_to do |format|\n if @family.save\n format.html { redirect_to @family, notice: 'Family was successfully created.' }\n format.json { render action: 'show', status: :created, location: @family }\n else\n format.html { render action: 'new' }\n format.json { render json: @family.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @neighborhood = Neighborhood.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @neighborhood }\n end\n end",
"def new\n @giving_group = GivingGroup.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @giving_group }\n end\n end",
"def new\n @brother = Brother.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @brother }\n end\n end",
"def new\n @boss = Boss.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @boss }\n end\n end",
"def new\n @lookup_source = LookupSource.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @lookup_source }\n end\n end",
"def new\n @party_type = PartyType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @party_type }\n end\n end",
"def new\n @pneighbour = Pneighbour.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @pneighbour }\n end\n end",
"def new\n respond_to do |format|\n format.html { render_template } # new.html.erb\n format.xml { render xml: @product_family_product }\n end\n end",
"def new\n @children = Children.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @children }\n end\n end",
"def new\n @person = Person.new\n @title = \"people\"\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @person }\n end\n end",
"def new\n @ref = Ref.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @ref }\n end\n end",
"def new\n @kennel = Kennel.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @kennel }\n end\n end",
"def new\n @belonging = Belonging.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @belonging }\n end\n end",
"def new\n @probe = Probe.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @probe }\n end\n end",
"def new\n @fgroup = Fgroup.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @fgroup }\n end\n end",
"def create\n @family = Family.new(family_params)\n addMembers\n respond_to do |format|\n if @family.save\n format.html { redirect_to @family, notice: 'Family was successfully created.' }\n format.json { render :show, status: :created, location: @family }\n else\n format.html { render :new }\n format.json { render json: @family.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @occupancy = Occupancy.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @occupancy }\n end\n end",
"def new\n @product = Product.new\n\n if params[:family_id]\n pfid = params[:family_id]\n if pfid\n @product_family = ProductFamily.find(pfid)\n @product.product_family = @product_family\n end\n admin_last_url\n else\n admin_store_url\n end\n\n @product_families = ProductFamily.all(:order => \"name ASC\")\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @product }\n end\n end",
"def new\n @geoname = Geoname.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @geoname }\n end\n end",
"def new\n @blueprint = Blueprint.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @blueprint }\n end\n end",
"def new\n @funder = Funder.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @funder }\n end\n end",
"def new\n @browsenodeid = Browsenodeid.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @browsenodeid }\n end\n end",
"def new\n @father = Father.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @father }\n end\n end",
"def new\n @countries = Countries.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @countries }\n end\n end",
"def new\n @persona = Persona.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @persona }\n end\n end",
"def new\n @lookup_ethnicity = LookupEthnicity.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @lookup_ethnicity }\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 @persona = Persona.new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @persona }\n end\n end",
"def new\n @cluster = Cluster.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @cluster }\n end\n end",
"def new\n @organization = Organization.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @organization }\n end\n end",
"def new\n @organization = Organization.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @organization }\n end\n end",
"def new\n @organization = Organization.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @organization }\n end\n end",
"def new\n @followership = Followership.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @followership }\n end\n end",
"def new\n @node = Node.new\n @title = \"Taxonomy node - organism relationships\"\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @node }\n end\n end",
"def new\n @person = @scope.build\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @person }\n end\n end",
"def new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => new_vurl }\n end\n end",
"def new\n @who_prefix = WhoPrefix.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @who_prefix }\n end\n end",
"def new\n @follower = Follower.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @follower }\n end\n end",
"def new\n @registry = @user.registries.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @registry }\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 @progre = Progre.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @progre }\n end\n end",
"def new\n @abonne = Abonne.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @abonne }\n end\n end",
"def new\n @package_relationship = PackageRelationship.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @package_relationship }\n end\n end",
"def new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @organization }\n end\n end",
"def new\n @friend = Friend.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @friend }\n end\n end",
"def new\n @house = House.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @house }\n end\n end",
"def new\n @gtfs_agency = GtfsAgency.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @gtfs_agency }\n end\n end",
"def new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @nomina }\n end\n end",
"def new\n @lookup_demographicrelativerelationship = LookupDemographicrelativerelationship.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @lookup_demographicrelativerelationship }\n end\n end",
"def new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @fund_request }\n end\n end",
"def new\n @fan = Fan.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @fan }\n end\n end",
"def new\n @friendship = Friendship.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @friendship }\n end\n end",
"def new\n @nickname = Nickname.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @nickname }\n end\n end",
"def new\n @food = Food.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @food }\n end\n end",
"def new\n head :status => 405\n return\n \n @participant = Participant.new\n\n respond_to do |format|\n format.html # new.html.erb\n #format.xml { render :xml => @participant }\n end\n end",
"def new\n @control_family = ControlFamily.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @control_family }\n end\n end",
"def new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @ontology }\n end\n end",
"def new\n @entidade = Entidade.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @entidade }\n end\n end",
"def new\n @add_to_group = AddToGroup.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @add_to_group }\n end\n end",
"def new\n @research = Research.new\n @page_title = \"Request research from White House 2 members\"\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @research.to_xml(:except => [:email]) }\n end\n end",
"def new\n @group = Group.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @group }\n end\n end",
"def new\n @group = Group.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @group }\n end\n end",
"def new\n @group = Group.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @group }\n end\n end"
] |
[
"0.69727224",
"0.6833814",
"0.66612226",
"0.6651011",
"0.6544284",
"0.65422297",
"0.64651847",
"0.6417502",
"0.6383113",
"0.637568",
"0.6369943",
"0.63574874",
"0.6318974",
"0.631751",
"0.631751",
"0.6314131",
"0.6285898",
"0.6262994",
"0.6224628",
"0.62236106",
"0.6202178",
"0.6193525",
"0.6191121",
"0.6176988",
"0.6176988",
"0.615113",
"0.615113",
"0.615113",
"0.615113",
"0.615113",
"0.615113",
"0.615113",
"0.615113",
"0.615113",
"0.615113",
"0.6147698",
"0.61471677",
"0.61401135",
"0.613515",
"0.6128319",
"0.6127844",
"0.61254627",
"0.6118021",
"0.6104981",
"0.6102996",
"0.6077964",
"0.6070622",
"0.60696954",
"0.6062928",
"0.60627735",
"0.6060515",
"0.606034",
"0.6052822",
"0.60443443",
"0.60425943",
"0.6035474",
"0.603223",
"0.602794",
"0.6024555",
"0.602369",
"0.6023607",
"0.60216635",
"0.60149854",
"0.6010607",
"0.60098803",
"0.60097164",
"0.59907496",
"0.59907496",
"0.59898895",
"0.59883136",
"0.5984828",
"0.59828264",
"0.5974835",
"0.59717745",
"0.596698",
"0.5965523",
"0.5963401",
"0.59515184",
"0.5935332",
"0.59314686",
"0.59311086",
"0.5930041",
"0.592341",
"0.59171385",
"0.5916517",
"0.59161854",
"0.5915868",
"0.59123003",
"0.590692",
"0.5906836",
"0.5903489",
"0.58962363",
"0.5894608",
"0.5881348",
"0.58771116",
"0.5874034",
"0.587212",
"0.58689964",
"0.58689964",
"0.58689964"
] |
0.7474895
|
0
|
POST /families POST /families.xml
|
def create
@family = Family.new(params[:family])
respond_to do |format|
if @family.save
flash[:notice] = 'Family was successfully created.'
format.html { redirect_to(@family) }
format.xml { render :xml => @family, :status => :created, :location => @family }
else
format.html { render :action => "new" }
format.xml { render :xml => @family.errors, :status => :unprocessable_entity }
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def create\n @family = Family.new(params[:family])\n\n respond_to do |format|\n if @family.save\n flash[:notice] = 'Family was successfully created.'\n format.html { redirect_to(@family) }\n format.xml { render :xml => @family, :status => :created, :location => @family }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @family.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @family = Family.new(family_params)\n addMembers\n respond_to do |format|\n if @family.save\n format.html { redirect_to @family, notice: 'Family was successfully created.' }\n format.json { render :show, status: :created, location: @family }\n else\n format.html { render :new }\n format.json { render json: @family.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n family_params\n f = params[:family]\n @family = Family.new\n @family.name = f[:name]\n\n respond_to do |format|\n if @family.save\n format.html { redirect_to @family, notice: 'Family was successfully created.' }\n format.json { render action: 'show', status: :created, location: @family }\n else\n format.html { render action: 'new' }\n format.json { render json: @family.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_jobfamily\n @jobfamily = @company.jobfamilies.create(name: params[:jobfamily][:name])\n respond_to do |format|\n format.json { render json: @jobfamily }\n end\n end",
"def create\n @family_relationship = FamilyRelationship.new(family_relationship_params)\n\n respond_to do |format|\n if @family_relationship.save\n format.html { redirect_to @family_relationship, notice: 'Family relationship was successfully created.' }\n format.json { render :show, status: :created, location: @family_relationship }\n else\n format.html { render :new }\n format.json { render json: @family_relationship.errors, status: :unprocessable_entity }\n end\n end\n end",
"def family_params\n params.require(:family).permit(:name, :status)\n end",
"def create\n @os_family = OsFamily.new(os_family_params)\n\n respond_to do |format|\n if @os_family.save\n format.html { redirect_to @os_family, notice: 'Os family was successfully created.' }\n format.json { render :show, status: :created, location: @os_family }\n else\n format.html { render :new }\n format.json { render json: @os_family.errors, status: :unprocessable_entity }\n end\n end\n end",
"def family_params\n params[:family].permit(:name)\n end",
"def family_params\r\n params.require(:family).permit(:name)\r\n end",
"def create(name=\"Default Name\", age=\"50\")\r\n xml_req =\r\n \"<?xml version='1.0' encoding='UTF-8'?>\r\n <person>\r\n <name>#{name}</name>\r\n <age>#{age}</age>\r\n </person>\"\r\n \r\n request = Net::HTTP::Post.new(@url)\r\n request.add_field \"Content-Type\", \"application/xml\"\r\n request.body = xml_req\r\n \r\n http = Net::HTTP.new(@uri.host, @uri.port)\r\n response = http.request(request)\r\n response.body \r\n end",
"def family_params\n params.require(:family).permit(:name)\n end",
"def family_params\n params.require(:family).permit(:name, :user_id)\n end",
"def create\n @family_member = FamilyMember.new(params[:family_member])\n @family_member.family = @current_family\n\n respond_to do |format|\n if @family_member.save\n format.html { redirect_to(family_family_member_url(@current_family, @family_member), :notice => 'A Family Member was successfully created.') }\n format.xml { render :xml => @family_member, :status => :created, :location => @family_member }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @family_member.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def index\n @index_action = true\n @families = Family.all\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @families }\n end\n end",
"def create\n @sub_family = SubFamily.new(sub_family_params)\n\n respond_to do |format|\n if @sub_family.save\n format.html { redirect_to @sub_family, notice: 'Sub familia foi criada.' }\n format.json { render :show, status: :created, location: @sub_family }\n else\n format.html { render :new }\n format.json { render json: @sub_family.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @families = Family.all\n end",
"def index\n @families = Family.all\n end",
"def index\n @families = Family.all\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 create\n params[:family][:user_id] = current_user.id if params[:family][:user_id]==nil\n params[:family][:name] = params[:family][:name].split(\" \").map{|a| a.capitalize}.join(\" \")\n @family = Family.new(family_params)\n # if current_user.families.count == 0\n # current_user.username = @family.name\n # current_user.save\n # end\n\n respond_to do |format|\n if @family.save\n format.json { render json: {created: @family} }\n format.html { redirect_to @family, notice: 'Family was successfully created.' }\n else\n format.json { render json: @family.errors, status: :unprocessable_entity }\n format.html { render :new }\n end\n end\n end",
"def create\n @control_family = ControlFamily.new(params[:control_family])\n\n respond_to do |format|\n if @control_family.save\n format.html { redirect_to @control_family, :notice => 'Control family was successfully created.' }\n format.json { render :json => @control_family, :status => :created, :location => @control_family }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @control_family.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @family = Family.find(params[:participant][:family]) rescue nil\n params[:participant][:family] = @family\n @participants = Participant.new(params[:participant])\n\n respond_to do |format|\n if @participants.save\n AuditTrail.audit(\"Participant #{@participants.fullname} created by #{current_user.login}\", edit_participant_url(@participants))\n flash[:notice] = 'Participants was successfully created.'\n format.html { params[:commit] == 'Save' ? redirect_to(participants_path) : redirect_to(new_participant_path) }\n format.xml { render :xml => @participants, :status => :created, :location => @participants }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @participants.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n puts :family\n @family = FamilyDecorator.decorate(Family.new(params[:family]))\n\n respond_to do |format|\n if @family.save\n format.html { redirect_to @family, notice: 'Family was successfully created.' }\n format.json { render json: @family, status: :created, location: @family }\n else\n format.html { render action: \"new\" }\n format.json { render json: @family.errors, status: :unprocessable_entity }\n end\n end\n end",
"def family_params\n params.require(:family).permit(:nombre_casa, :numero_casa, :telefono, :comunity_id,:direccion)\n end",
"def family_relationship_params\n params.require(:family_relationship).permit(:code, :name)\n end",
"def index\r\n @families = Family.all\r\n end",
"def family_params\n params.require(:family).permit(:home_address, :email_address, :phone_number, primary_family_member_attributes: %i[type first_name last_name age])\n end",
"def create\n @family_document = FamilyDocument.new(family_document_params)\n\n respond_to do |format|\n if @family_document.save\n format.html { redirect_to @family_document, notice: \"Family document was successfully created.\" }\n format.json { render :show, status: :created, location: @family_document }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @family_document.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @family_bond = FamilyBond.new(family_bond_params)\n\n respond_to do |format|\n if @family_bond.save\n format.html { redirect_to @family_bond, notice: 'Family bond was successfully created.' }\n format.json { render :show, status: :created, location: @family_bond }\n else\n format.html { render :new }\n format.json { render json: @family_bond.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @family_member = FamilyMember.new(family_member_params)\n\n respond_to do |format|\n if @family_member.save\n format.html { redirect_to @family_member, notice: 'Family member was successfully created.' }\n format.json { render :show, status: :created, location: @family_member }\n else\n format.html { render :new }\n format.json { render json: @family_member.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @family = Family.new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @family }\n end\n end",
"def create\n @product_family = ProductFamily.new(params[:product_family])\n\n respond_to do |format|\n if @product_family.save\n flash[:notice] = 'Família de produtos criada.'\n format.html { redirect_to(@product_family) }\n format.xml { render :xml => @product_family, :status => :created, :location => @product_family }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @product_family.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @groups_happening = GroupsHappening.new(params[:groups_happening])\n\n respond_to do |format|\n if @groups_happening.save\n flash[:notice] = 'GroupsHappening was successfully created.'\n format.html { redirect_to(groups_happenings_path) }\n format.xml { render :xml => @groups_happening, :status => :created, :location => @groups_happening }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @groups_happening.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @family_member = FamilyMember.new(params[:family_member])\n\n respond_to do |format|\n if @family_member.save\n format.html { redirect_to @family_member, notice: 'Family member was successfully created.' }\n format.json { render json: @family_member, status: :created, location: @family_member }\n else\n format.html { render action: \"new\" }\n format.json { render json: @family_member.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @family_member = FamilyMember.new(family_member_params)\n\n respond_to do |format|\n if @family_member.save\n format.html { redirect_to @family_member, notice: 'Family member was successfully created.' }\n format.json { render json: @family_member, status: :created, location: @family_member }\n else\n format.html { render action: \"new\" }\n format.json { render json: @family_member.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @family = Family.new(params[:family])\n if User.find_by_email(session[:user_email]).identity >= 3 #if user is at least manager+\n @family.approved_by = User.find_by_email(session[:user_email]).id\n @family.display = true\n end\n respond_to do |format|\n if @family.save\n format.html { redirect_to session[:redirect_path], notice: 'Family was successfully created.' }\n format.json { render json: @family, status: :created, location: @family }\n else\n flash[:error] = \"Sorry, one or more fields were not entered correctly. Please double-check that the information is correct.\"\n format.html { render action: \"new\" }\n format.json { render json: @family.errors, status: :unprocessable_entity }\n end\n end\n end",
"def family_params\n params.require(:family).permit(:name, :description, :position, :country_id, categories_attributes: [:id, :name, :description, :position, :_destroy])\n end",
"def index\n @product_families = ProductFamily.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @product_families }\n end\n end",
"def create\n megam_rest.post_node(to_hash)\n end",
"def index\n @families = Family.all.paginate(page: params[:page])\n render json: @families\n end",
"def create\n @farmer_family = @farmer.farmer_families.build(farmer_family_params)\n\n respond_to do |format|\n if @farmer_family.save\n SystemLog.create(description: \"Cadastraou uma novo membro da família para o agricultor #{@farmer.name}(#{@farmer.farmer_code}) chamado #{@farmer_family.name}\", author: name_and_type_of_logged_user)\n format.html { redirect_to [@group, @farmer_family.farmer, @farmer_family], notice: 'Integrante da familia adicionado com sucesso' }\n format.json { render :show, status: :created, location: @farmer_family }\n else\n format.html { render :new }\n format.json { render json: @farmer_family.errors, status: :unprocessable_entity }\n end\n end\n end",
"def destroy\n\t\t@family ||= Family.find(params[:id])\n @family.destroy\n respond_to do |format|\n format.html { redirect_to(families_url) }\n format.xml { head :ok }\n end\n end",
"def create\n @family = Family.new\n [:father, :mother].each do |p|\n pp = params[p].keep_if { |k,v| !v.blank? }\n\n @family.__send__ \"#{p}=\", (pp.blank? ? nil : get_user_from_params(pp))\n end\n\n respond_to do |format|\n if @family.save\n uninitialized_pw = User.initialize_without_password(\"\").password_digest\n [@family.father, @family.mother].select { |p| p }.each { |p|\n user_is_new = p.user.password_digest == uninitialized_pw\n EasyRailsAuthentication::AuthenticationHelper.SendPasswordInitializationEmailTo p.email if user_is_new\n }\n format.html { redirect_to (added_user_info? ? family_url(@family.id) : families_url), notice: 'Family was successfully created.' }\n format.json { render json: @family, status: :created, location: @family }\n else\n format.html { render action: \"new\" }\n format.json { render json: @family.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @language_family = LanguageFamily.new(language_family_params)\n\n respond_to do |format|\n if @language_family.save\n format.html { redirect_to @language_family, notice: 'Language family was successfully created.' }\n format.json { render action: 'show', status: :created, location: @language_family }\n else\n format.html { render action: 'new' }\n format.json { render json: @language_family.errors, status: :unprocessable_entity }\n end\n end\n end",
"def family_group_params\n params.require(:family_group).permit(:family_name, :family_description)\n end",
"def set_family\n @family = Family.find(params[:id])\n end",
"def set_family\n @family = Family.find(params[:id])\n end",
"def create\n @game = Game.find(params[:game_id])\n @game.authorships.create_from_names(params[:authorship])\n respond_to do |format|\n flash[:notice] = 'Les autheurs sont enregistres'\n format.html { redirect_to game_path(@game) }\n format.xml { head :created, :location => authorship_url(@authorship) }\n end\n end",
"def set_family\r\n @family = Family.find(params[:id])\r\n end",
"def sub_family_params\n params.require(:sub_family).permit(:name, :created_at, :updated_at)\n end",
"def set_family\n @family = Family.find(params[:id])\n end",
"def set_family\n @family = Family.find(params[:id])\n end",
"def jobfamily\n @jobfamilies = @company.jobfamilies\n respond_to do |format|\n format.json { render json: @jobfamilies}\n end\n end",
"def set_family\n @family = Family.find(params[:family_id])\n end",
"def new\n @family = Family.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @family }\n end\n end",
"def create\n doc = Nokogiri::XML(request.body.read)\n bNode = doc.xpath('elwak/benutzer')\n\n @benutzer = Benutzer.new(benutzer_params(bNode))\n if @benutzer.save\n if bNode.xpath('objekt_zuordnungs').length > 0\n objekt_ids = bNode.xpath('objekt_zuordnungs/objekt_id').map{|oz| oz.text.to_s.to_i}\n @benutzer.setze_objekt_zuordnungen(objekt_ids)\n end\n success(@benutzer.id)\n else\n error(@benutzer.errors)\n end\n end",
"def friendships_create(options = {})\n @req.post(\"/1.1/friendships/create.json\", options)\n end",
"def destroy\n @family.destroy\n respond_to do |format|\n format.html { redirect_to families_url }\n format.json { head :no_content }\n end\n end",
"def create(name=\"Default name\")\n xml_req =\n \"<?xml version='1.0' encoding='UTF-8'?>\n <customer>\n <name>#{name}</name>\n </customer>\"\n\n request = Net::HTTP::Post.new(@url)\n request.add_field \"Content-Type\", \"application/xml\"\n request.body = xml_req\n\n http = Net::HTTP.new(@uri.host, @uri.port)\n response = http.request(request)\n\n response.body\n end",
"def create\n @product_family = ProductFamily.new(params[:product_family])\n \n if @product_family.save\n flash[:success] = 'Product family was successfully created.'\n redirect_to(product_families_path)\n else\n @title = \"New Product Family\"\n render :action => \"new\" \n end\n end",
"def create\n @family = Family.new(family_params)\n @family.church = current_church\n\n if @family.save\n flash[:notice] = t('.success', name: @family.name)\n redirect_to action: :index\n else\n render :new\n end\n end",
"def create\n @discovery = Discovery.new(params[:discovery])\n\n respond_to do |format|\n if @discovery.save\n flash[:notice] = 'Discovery was successfully created.'\n format.html { redirect_to(@discovery) }\n format.xml { render :xml => @discovery, :status => :created, :location => @discovery }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @discovery.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def new\n if request.post?\n\n @last_name = params[:last_name]\n @first_name = params[:first_name]\n @login = params[:login]\n @email = params[:email]\n @business_name = params[:business_name]\n @mailing_address = params[:mailing_address]\n @city = params[:city]\n @state = params[:state]\n @zip_code = params[:zip_code]\n @phone_number = params[:phone_number]\n @num_users = params[:num_users]\n @num_generations = params[:num_generations]\n\n begin\n Family.transaction do\n family_reporter = FamilyReporter.new(:last_name => params[:last_name], :first_name => params[:first_name],\n :login => params[:login], :email => params[:email], :password => params[:password], :password_confirmation => params[:password_confirmation])\n family = Family.new(:business_name => @business_name, :mailing_address => @mailing_address, :city => @city, :state => @state, :zip_code => @zip_code, :phone_number => @phone_number, :num_users => @num_users, :num_generations => @num_generations)\n\n family_reporter.family = family\n family_reporter.save!\n family_reporter.register!\n family.save!\n end\n\n flash[:notice] = \"New family for #{@business_name} added!\"\n redirect_to :action => :index\n rescue Exception => e\n flash[:error] = \"Error #{e.message}\"\n end\n end\n end",
"def post_headers\n {\"Content-Type\" => 'text/xml; charset=utf-8'}\n end",
"def index\n @family_members = @current_family.family_members\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @family_members }\n end\n end",
"def post(xmldoc)\n headers = {'Content-Type' => 'text/xml'}\n check_response( @httpcli.post(@endpoint, xmldoc, headers) )\n end",
"def create\n @defendant = Defendant.new(defendant_params)\n\n respond_to do |format|\n if @defendant.save\n format.html { redirect_to @defendant, notice: \"Acusado creado con éxito.\" }\n format.json { render :show, status: :created, location: @defendant }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @defendant.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n doc = Nokogiri::XML(request.body.read)\n cvNode = doc.xpath('elwak/checklisten_vorlage')\n cv = ChecklistenVorlage.new({\n objekt_id: cvNode.xpath('objekt_id').text.to_s, \n bezeichner: cvNode.xpath('bezeichner').text.to_s, \n version: cvNode.xpath('version').text.to_s.to_i, \n inaktiv: cvNode.xpath('inaktiv').text.to_s.to_bool \n })\n cv.save\n\n cvNode.xpath('checklisten_eintrags/checklisten_eintrag').each do |ceNode|\n ce = ChecklistenEintrag.new({\n checklisten_vorlage_id: cv.id,\n bezeichner: ceNode.xpath('bezeichner').text.to_s,\n was: ceNode.xpath('was').text.to_s,\n wann: ceNode.xpath('wann').text.to_s,\n typ: ceNode.xpath('typ').text.to_s.to_i,\n position: ceNode.xpath('position').text.to_s.to_i\n })\n ce.save\n end\n\n respond_to do |format|\n format.xml {render :xml => '<?xml version=\"1.0\" encoding=\"UTF-8\"?><success />'}\n end\n end",
"def create\n #logger.info \"Post parameters: #{params}\"\n @group = Group.new(name: params[:group][:name], expiration: params[:group][:expiration])\n if @group.save\n params[:group][:users].each do |u|\n Membership.create(group: @group, user: User.where(\"id = ? OR email = ?\", u[:id], u[:email]).first, admin:u[:admin])\n end\n render json: @group, status: :created, location: @group\n else\n render json: @group.errors, status: :unprocessable_entity\n end\n end",
"def index\n @family_relationships = FamilyRelationship.all\n end",
"def index\n @families = Family.find(:all, :select => \"id, business_name\", :order => \"business_name ASC\")\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @families }\n end\n end",
"def create\n # process the request if the proper authorization key was given\n begin\n # parse the given XML document and retrieve the underlying food model\n @food = Food.new(Food.xmlfood_to_hash(request.body))\n respond_to do |format|\n if @food.save\n format.xml { render xml: @food, status: :created, location: @food }\n else # bad request: food could not be added to the database\n # check the entry could not be saved because it is already existing\n unique_error = false\n @food.errors.each do |_, err_mess|\n if err_mess == \"has already been taken\"\n unique_error = true\n break\n end\n end\n # send a 409 Conflict error if it is the case\n if unique_error\n format.xml { head :conflict }\n # else send a 422 Unprocessable entity error\n else\n format.xml { render text: @food.errors.map { |_, e| \"#{e}\" }.join(\"\\n\")+\"\\n\",\n status: :unprocessable_entity }\n end\n end\n end\n rescue ArgumentError => e\n # bad request: improper XML food\n respond_to do |format|\n format.xml { render text: \"#{e}\\n\", status: :unprocessable_entity}\n end\n end\n end",
"def create\n @family_unit = FamilyUnit.new(params[:family_unit])\n\n respond_to do |format|\n if @family_unit.save\n format.html { redirect_to @family_unit, notice: 'Family unit was successfully created.' }\n format.json { render json: @family_unit, status: :created, location: @family_unit }\n else\n format.html { render action: \"new\" }\n format.json { render json: @family_unit.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @sub_families = SubFamily.all\n end",
"def set_family\n @family = Family.find_by_id(params[:id])\n end",
"def new\n @family_member = FamilyMember.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @family_member }\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 list_families\n http_get(:uri=>\"/plugins/families\", :fields=>x_cookie)\n end",
"def add_family(fam, propagate = true)\n count = 0\n if leaf?\n [fam].flatten.each do |f|\n if product_families.where([\"product_family_id = ?\", f.id]).empty?\n product_families << f\n count += 1\n end\n end\n else\n errors.add(:base, \"Can't add product family to non-leaf category.\")\n end\n if (count > 0) && propagate\n propagate_families_up\n generate_attributes_up\n end\n count\n end",
"def create\n @node = Node.new(params[:node])\n @title = \"Taxonomy node - organism relationships\"\n\n respond_to do |format|\n if @node.save\n format.html { redirect_to(@node, :notice => 'Node was successfully created.') }\n format.xml { render :xml => @node, :status => :created, :location => @node }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @node.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @fam = Fam.new(params[:fam])\n\n respond_to do |format|\n if @fam.save\n flash[:notice] = 'Fam was successfully created.'\n format.html { redirect_to(@fam) }\n format.xml { render :xml => @fam, :status => :created, :location => @fam }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @fam.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @rental = Rental.find(params[:rental_id])\n @tenant_family_member = TenantFamilyMember.new(tenant_family_member_params)\n @tenant_family_member.rental = @rental\n\n respond_to do |format|\n if @tenant_family_member.save\n format.html { redirect_to @rental, notice: 'Tenant family member was successfully created.' }\n format.json { render :show, status: :created, location: @tenant_family_member }\n else\n format.html { render :new }\n format.json { render json: @tenant_family_member.errors, status: :unprocessable_entity }\n end\n end\n end",
"def add_tenant_circle(args = {}) \n post(\"/tenantcircles.json/\", args)\nend",
"def update\n addMembers\n respond_to do |format|\n if @family.update(family_params)\n format.html { redirect_to @family, notice: 'Family was successfully updated.' }\n format.json { render :show, status: :ok, location: @family }\n else\n format.html { render :edit }\n format.json { render json: @family.errors, status: :unprocessable_entity }\n end\n end\n end",
"def destroy\n# @family = Family.find(params[:id])\n# @family.destroy\n#\n# respond_to do |format|\n# format.html { redirect_to(families_url) }\n# format.xml { head :ok }\n# end\n end",
"def set_family\n @family = Family.friendly.find(params[:id])\n end",
"def index\n @family_groups = FamilyGroup.all\n end",
"def family_member_params\n params.require(:family_member).permit(:member, :relationship, :user_id)\n end",
"def create\n @breadcrumb = 'create'\n @product_family = ProductFamily.new(params[:product_family])\n @product_family.created_by = current_user.id if !current_user.nil?\n\n respond_to do |format|\n if @product_family.save\n format.html { redirect_to @product_family, notice: crud_notice('created', @product_family) }\n format.json { render json: @product_family, status: :created, location: @product_family }\n else\n format.html { render action: \"new\" }\n format.json { render json: @product_family.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n\t\trespond_with Species.create(species_params)\n\tend",
"def create\n @resultadoconsultum = Resultadoconsultum.new(resultadoconsultum_params)\n\t\n\n\trequire 'nokogiri'\n\t\n\t@doc = Nokogiri::XML(File.open(\"exemplos/emplo.xml\"))\n\n\tcar_tires = @doc.xpath(\"//firstname\")\n\t\n\tdoc = Nokogiri::XML(File.open(\"emplo.xml\"))\n\tdoc.xpath('firstname').each do\n\t\tcar_tires\n\tend\n\n\t \n respond_to do |format|\n if @resultadoconsultum.save\n format.html { redirect_to @resultadoconsultum, notice: car_tires }\n format.json { render :show, status: :created, location: @resultadoconsultum }\n else\n format.html { render :new }\n format.json { render json: @resultadoconsultum.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @belonging = Belonging.new(params[:belonging])\n\n respond_to do |format|\n if @belonging.save\n flash[:notice] = 'Belonging was successfully created.'\n format.html { redirect_to(@belonging) }\n format.xml { render :xml => @belonging, :status => :created, :location => @belonging }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @belonging.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @family_background = FamilyBackground.new(params[:family_background])\n\n respond_to do |format|\n if @family_background.save\n format.html { redirect_to(@family_background, :notice => 'Family background was successfully created.') }\n format.xml { render :xml => @family_background, :status => :created, :location => @family_background }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @family_background.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @node_config = NodeConfig.new(params[:node_config])\n\n respond_to do |format|\n if @node_config.save\n format.xml { render :xml => @node_config, :status => :created, :location => @node_config }\n format.any { render :json => @node_config, :status => :created, :location => @node_config }\n else\n format.xml { render :xml => @node_config.errors, :status => :unprocessable_entity }\n format.any { render :json => @node_config.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @partyrelationship = Partyrelationship.new(params[:partyrelationship])\n\n respond_to do |format|\n if @partyrelationship.save\n format.html { redirect_to(@partyrelationship, :notice => 'Partyrelationship was successfully created.') }\n format.xml { render :xml => @partyrelationship, :status => :created, :location => @partyrelationship }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @partyrelationship.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @family_crest = FamilyCrest.new(params[:family_crest])\n\n respond_to do |format|\n if @family_crest.save\n format.html { redirect_to @family_crest, notice: 'Family crest was successfully created.' }\n format.json { render json: @family_crest, status: :created, location: @family_crest }\n else\n format.html { render action: \"new\" }\n format.json { render json: @family_crest.errors, status: :unprocessable_entity }\n end\n end\n end",
"def add_family!(family_name)\n self.family = Family.where(name: family_name).first_or_create! \n self.save!\n end",
"def post(uri, xml)\r\n req = Net::HTTP::Post.new(uri)\r\n req[\"content-type\"] = \"application/xml\"\r\n req.body = xml\r\n request(req)\r\n end",
"def create\n @friendship = current_person.friendships.build(:granter_id => params[:granter_id], :accepted => params[:accepted])\n\n respond_to do |format|\n if @friendship.save\n format.html { redirect_to people_url, notice: 'A friend request has been sent to ' + Person.find(params[:granter_id]).name }\n format.json { render :show, status: :created, location: @friendship }\n else\n format.html { render :new }\n format.json { render json: @friendship.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @farmer_families = @farmer.farmer_families\n end"
] |
[
"0.60733354",
"0.6072399",
"0.58886254",
"0.58508116",
"0.5639434",
"0.5605569",
"0.5539265",
"0.5530745",
"0.5517634",
"0.5512985",
"0.5511537",
"0.54106337",
"0.53630924",
"0.5349675",
"0.534874",
"0.5343693",
"0.5343693",
"0.5343693",
"0.5334595",
"0.53041863",
"0.5255488",
"0.52407765",
"0.52248096",
"0.5216662",
"0.5212262",
"0.5205059",
"0.5201556",
"0.5201511",
"0.5200504",
"0.5197699",
"0.51921046",
"0.51327163",
"0.5121538",
"0.51188684",
"0.5117355",
"0.51139075",
"0.5094682",
"0.5089197",
"0.5083546",
"0.50487024",
"0.50463784",
"0.50212204",
"0.4995623",
"0.49916708",
"0.49800363",
"0.49741727",
"0.49741727",
"0.49481872",
"0.4945567",
"0.49316585",
"0.49212566",
"0.49212566",
"0.49111307",
"0.4902767",
"0.48975742",
"0.48942408",
"0.48922098",
"0.48640722",
"0.48538536",
"0.48515895",
"0.48484102",
"0.48451647",
"0.48226702",
"0.48218733",
"0.48152417",
"0.48075765",
"0.48027292",
"0.480095",
"0.48001432",
"0.47925147",
"0.47905612",
"0.47860515",
"0.47824124",
"0.47812957",
"0.47748607",
"0.47686344",
"0.47680682",
"0.4766307",
"0.47630963",
"0.47615823",
"0.47547647",
"0.47539765",
"0.47527507",
"0.47409275",
"0.47400954",
"0.47381684",
"0.473453",
"0.47264448",
"0.47263008",
"0.4713771",
"0.47130853",
"0.4709726",
"0.47032064",
"0.46985507",
"0.46950993",
"0.46901944",
"0.4687577",
"0.4680251",
"0.46788082",
"0.4669529"
] |
0.60738903
|
0
|
PUT /families/1 PUT /families/1.xml
|
def update
@family ||= Family.find(params[:id])
respond_to do |format|
if @family.update_attributes(params[:family])
flash[:notice] = 'Family was successfully updated.'
format.html { redirect_to(@family) }
format.xml { head :ok }
else
format.html { render :action => "edit" }
format.xml { render :xml => @family.errors, :status => :unprocessable_entity }
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def update\n @family = Family.find(params[:id])\n\n respond_to do |format|\n if @family.update_attributes(params[:family])\n flash[:notice] = \"Family #{@family.business_name} was successfully updated.\"\n format.html { redirect_to(@family) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @family.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n addMembers\n respond_to do |format|\n if @family.update(family_params)\n format.html { redirect_to @family, notice: 'Family was successfully updated.' }\n format.json { render :show, status: :ok, location: @family }\n else\n format.html { render :edit }\n format.json { render json: @family.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n params[:family][:name] = params[:family][:name].split(\" \").map{|a| a.capitalize}.join(\" \")\n if @family.update(family_params)\n format.json { render :show, status: :ok, location: @family }\n format.html { redirect_to @family, notice: 'Family was successfully updated.' }\n else\n format.json { render json: @family.errors, status: :unprocessable_entity }\n format.html { render :edit }\n end\n end\n end",
"def set_family\n @family = Family.find(params[:id])\n end",
"def set_family\n @family = Family.find(params[:id])\n end",
"def set_family\r\n @family = Family.find(params[:id])\r\n end",
"def update opts = {}\n opts[:headers] ||= {}\n opts[:headers]['Content-Type'] ||= 'text/xml'\n post 'update', opts\n end",
"def set_family\n @family = Family.find(params[:id])\n end",
"def set_family\n @family = Family.find(params[:id])\n end",
"def update\n # go to params hash and get the id\n the_id = params['id']\n\n # grab a single family based on the id\n family = Family.find_by(id: the_id)\n\n # update it\n if family.update!(\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 render json: family.as_json\n else\n render json: {errors: family.errors.full_messages}\n end\n end",
"def update\r\n respond_to do |format|\r\n if @family.update(family_params)\r\n format.html { redirect_to @family, notice: 'Family was successfully updated.' }\r\n format.json { render :show, status: :ok, location: @family }\r\n else\r\n format.html { render :edit }\r\n format.json { render json: @family.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end",
"def set_family\n @family = Family.find(params[:family_id])\n end",
"def set_family\n @family = Family.find_by_id(params[:id])\n end",
"def update(id, name=\"Updated Name\", age=\"55\")\r\n xml_req =\r\n \"<?xml version='1.0' encoding='UTF-8'?>\r\n <person>\r\n <id type='integer'>#{id}</id>\r\n <name>#{name}</name>\r\n <age>#{age}</age> \r\n </person>\"\r\n request = Net::HTTP::Put.new(\"#{@url}/#{id}.xml\")\r\n request.add_field \"Content-Type\", \"application/xml\"\r\n request.body = xml_req\r\n http = Net::HTTP.new(@uri.host, @uri.port)\r\n response = http.request(request)\r\n # no response body will be returned\r\n case response\r\n when Net::HTTPSuccess\r\n return \"#{response.code} OK\"\r\n else\r\n return \"#{response.code} ERROR\"\r\n end\r\n end",
"def update\n respond_to do |format|\n if @family.update(family_params)\n format.html { redirect_to @family, notice: 'Family was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @family.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 update\n respond_to do |format|\n if @os_family.update(os_family_params)\n format.html { redirect_to @os_family, notice: 'Os family was successfully updated.' }\n format.json { render :show, status: :ok, location: @os_family }\n else\n format.html { render :edit }\n format.json { render json: @os_family.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_family\n @family = Family.friendly.find(params[:id])\n end",
"def destroy\n\t\t@family ||= Family.find(params[:id])\n @family.destroy\n respond_to do |format|\n format.html { redirect_to(families_url) }\n format.xml { head :ok }\n end\n end",
"def put(uri, xml)\r\n req = Net::HTTP::Put.new(uri)\r\n req[\"content-type\"] = \"application/xml\"\r\n req.body = xml\r\n request(req)\r\n end",
"def set_family_document\n @family_document = FamilyDocument.find(params[:id])\n end",
"def update\n @family = Family.find(params[:id])\n @user = User.find_by_email(session[:user_email])\n if @user && @user.identity == 2\n\t@family.approved_by = nil\n end\n respond_to do |format|\n if @family.update_attributes(params[:family])\n format.html { redirect_to session[:redirect_path], notice: 'Family was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @family.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n @family.slug=nil\n if @family.update(family_params)\n format.html { redirect_to @family, notice: 'La familia fue actualizada exitosamente.' }\n format.json { render :show, status: :ok, location: @family }\n else\n format.html { render :edit }\n format.json { render json: @family.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @family_document.update(family_document_params)\n format.html { redirect_to @family_document, notice: \"Family document was successfully updated.\" }\n format.json { render :show, status: :ok, location: @family_document }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @family_document.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @sub_family.update(sub_family_params)\n format.html { redirect_to @sub_family, notice: 'Sub família foi atualizada.' }\n format.json { render :show, status: :ok, location: @sub_family }\n else\n format.html { render :edit }\n format.json { render json: @sub_family.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n name = Server.find(params[:id]).name\n n = Neography::Node.find('servers', 'name', name)\n n.name = server_params[:name]\n n.add_to_index('servers', 'name', server_params[:name]) #TODO: is this necessary?\n if @server.update(server_params)\n format.html { redirect_to @server, notice: 'Server was successfully updated.' }\n format.json { render :show, status: :ok, location: @server }\n else\n format.html { render :edit }\n format.json { render json: @server.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @family_relationship.update(family_relationship_params)\n format.html { redirect_to @family_relationship, notice: 'Family relationship was successfully updated.' }\n format.json { render :show, status: :ok, location: @family_relationship }\n else\n format.html { render :edit }\n format.json { render json: @family_relationship.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @control_family = ControlFamily.find(params[:id])\n\n respond_to do |format|\n if @control_family.update_attributes(params[:control_family])\n format.html { redirect_to @control_family, :notice => 'Control family was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @control_family.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @product_family = ProductFamily.find(params[:id])\n\n respond_to do |format|\n if @product_family.update_attributes(params[:product_family])\n flash[:notice] = 'Família de produtos atualizada.'\n format.html { redirect_to(@product_family) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @product_family.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @family_member = FamilyMember.find(params[:id])\n\n respond_to do |format|\n if @family_member.update_attributes(params[:family_member])\n format.html { redirect_to(family_family_member_url(@current_family, @family_member), :notice => 'A Family Member was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @family_member.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update(id, name= \"Updated Name\")\n xml_req =\n \"<?xml version='1.0' encoding='UTF-8'?>\n <customer>\n <id type='integer'>#{id}</id>\n <name>#{name}</name>\n </customer>\"\n\n request = Net::HTTP::Put.new(\"#{@url}/#{id}.xml\")\n request.add_field \"Content-Type\", \"application/xml\"\n request.body = xml_req\n\n http = Net::HTTP.new(@uri.host, @uri.port)\n response = http.request(request)\n\n # no response body will be returned\n case response\n when Net::HTTPSuccess\n return \"#{response.code} OK\"\n else\n return \"#{response.code} ERROR\"\n end\n end",
"def family_id= new_family_id\n frozen_check!\n @gapi.family_id = new_family_id\n end",
"def set_family_relationship\n @family_relationship = FamilyRelationship.find(params[:id])\n end",
"def create\n @family = Family.new(params[:family])\n respond_to do |format|\n if @family.save\n flash[:notice] = 'Family was successfully created.'\n format.html { redirect_to(@family) }\n format.xml { render :xml => @family, :status => :created, :location => @family }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @family.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @family = Family.new(params[:family])\n\n respond_to do |format|\n if @family.save\n flash[:notice] = 'Family was successfully created.'\n format.html { redirect_to(@family) }\n format.xml { render :xml => @family, :status => :created, :location => @family }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @family.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def set_family\n @family = Family.includes(members:[:contacts]).find(params[:id])\n end",
"def set_family_group\n @family_group = FamilyGroup.find(params[:id])\n end",
"def family_params\n params.require(:family).permit(:name, :status)\n end",
"def rest_update(uri, method: Net::HTTP::Put)\n request = Net::HTTP::Get.new uri\n request.add_field(\"Accept\",\"application/xml\")\n auth_admin(request)\n \n Net::HTTP.start(uri.host, uri.port) do |http|\n response = http.request request\n response.value\n\n doc = REXML::Document.new response.body\n \n doc = strip_class_attributes(yield doc)\n \n request2 = method.new uri\n request2.content_type = 'application/xml'\n auth_admin(request2)\n\n request2.body=doc.to_s\n \n response2 = http.request request2\n response.value\n\n end\n \nend",
"def update\n respond_to do |format|\n if @family_group.update(family_group_params)\n format.html { redirect_to @family_group, notice: 'Family group was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @family_group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n family_params\n f = params[:family]\n @family = Family.new\n @family.name = f[:name]\n\n respond_to do |format|\n if @family.save\n format.html { redirect_to @family, notice: 'Family was successfully created.' }\n format.json { render action: 'show', status: :created, location: @family }\n else\n format.html { render action: 'new' }\n format.json { render json: @family.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @tenant_family_member.update(tenant_family_member_params)\n format.html { redirect_to @tenant_family_member, notice: 'Tenant family member was successfully updated.' }\n format.json { render :show, status: :ok, location: @tenant_family_member }\n else\n format.html { render :edit }\n format.json { render json: @tenant_family_member.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @family_member = FamilyMember.find(params[:id])\n\n respond_to do |format|\n if @family_member.update_attributes(params[:family_member])\n format.html { redirect_to @family_member, notice: 'Family member was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @family_member.errors, status: :unprocessable_entity }\n end\n end\n end",
"def flush\n if exists?\n update_foreman_users('put', get_attribute_from_user('id'))\n else\n update_foreman_users('post')\n end\n end",
"def destroy\n# @family = Family.find(params[:id])\n# @family.destroy\n#\n# respond_to do |format|\n# format.html { redirect_to(families_url) }\n# format.xml { head :ok }\n# end\n end",
"def update\n @node = Node.find(params[:id])\n @title = \"Taxonomy node - organism relationships\"\n\n respond_to do |format|\n if @node.update_attributes(params[:node])\n format.html { redirect_to(@node, :notice => 'Node was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @node.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def set_family_member\n @family_member = FamilyMember.find(params[:id])\n end",
"def create_update_volumes(username, token, workset_name, volume_ids)\n\n #<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n #<volumes xmlns=\"http://registry.htrc.i3.illinois.edu/entities/workset\">\n # <volume>\n # <id>9999999</id>\n # </volume>\n # <volume>\n # <id>3333333</id>\n # </volume>\n # </volumes>\n volumes_xml =\n \"<?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"yes\\\"?>\" +\n \"<volumes xmlns=\\\"http://registry.htrc.i3.illinois.edu/entities/workset\\\">\";\n\n for id in volume_ids\n volumes_xml += \"<volume><id>#{id}</id></volume>\"\n end\n volumes_xml += \"</volumes>\"\n\n\n # curl -v --data @new_volumes.xml -X PUT \\\n # -H \"Content-Type: application/vnd.htrc-volume+xml\" \\\n # -H \"Accept: application/vnd.htrc-volume+xml\" \\\n # http://localhost:9763/ExtensionAPI-0.1.0/services/worksets/workset1/volumes?user=fred\n\n url = URI.parse(\"#{APP_CONFIG['registry_url']}/worksets/#{workset_name}\")\n http = Net::HTTP.new(url.host, url.port)\n if Rails.env.development?\n http.set_debug_output($stdout)\n end\n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n\n request = Net::HTTP::Put.new(url.path)\n request[\"Content-Type\"] = \"application/vnd.htrc-volume+xml\"\n request.add_field(\"Authorization\", \"Bearer #{token}\")\n\n request.body = volumes_xml\n response = http.request(request)\n\n #xml = response.body\n\n case response\n when Net::HTTPUnauthorized then\n raise Exceptions::SessionExpiredError.new(\"Session expired. Please login again\")\n when Net::HTTPSuccess then\n # Do nothing\n else\n raise Exceptions::SystemError.new(\"Error retrieving worksets (HTTP #{response.code})\")\n end\n end",
"def destroy\n @family = Family.find(params[:id])\n @family.destroy\n\n respond_to do |format|\n format.html { redirect_to families_url }\n format.json { head :no_content }\n end\n end",
"def save\n obj = JSON.parse(node.elements.first.content)\n fqdn = obj['fqdn'].downcase\n forbidden! unless from_system?(fqdn)\n\n id = \"system:#{fqdn}\"\n system = System.find(id) || System.new(id: id)\n system.ohai = obj\n system.save\n storage.index(system)\n System.notify_members(stream, node.from, [{'name' => fqdn}])\n send_result\n end",
"def _update(type, current_name, metadata={})\n type = type.to_s.camelize\n request :update do |soap|\n soap.body = {\n :metadata => {\n :current_name => current_name,\n :metadata => prepare(metadata),\n :attributes! => { :metadata => { 'xsi:type' => \"ins0:#{type}\" } }\n }\n }\n end\n end",
"def family_params\n params.require(:family).permit(:name, :user_id)\n end",
"def create\n @family = Family.new(family_params)\n addMembers\n respond_to do |format|\n if @family.save\n format.html { redirect_to @family, notice: 'Family was successfully created.' }\n format.json { render :show, status: :created, location: @family }\n else\n format.html { render :new }\n format.json { render json: @family.errors, status: :unprocessable_entity }\n end\n end\n end",
"def destroy\n @family.destroy\n respond_to do |format|\n format.html { redirect_to families_url }\n format.json { head :no_content }\n end\n end",
"def update\n @family_member = FamilyMember.find(params[:id])\n\n respond_to do |format|\n if @family_member.update_attributes(family_member_params)\n format.html { redirect_to @family_member, notice: 'Family member was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @family_member.errors, status: :unprocessable_entity }\n end\n end\n end",
"def add_family!(family_name)\n self.family = Family.where(name: family_name).first_or_create! \n self.save!\n end",
"def put_datastream(pid, dsID, xml)\n uri = URI.parse(@fedora + '/objects/' + pid + '/datastreams/' + dsID ) \n RestClient.put(uri.to_s, xml, :content_type => \"application/xml\")\n rescue => e\n e.response \n end",
"def update_volumes(username, token, workset_name, volume_ids)\n\n #<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n #<volumes xmlns=\"http://registry.htrc.i3.illinois.edu/entities/workset\">\n # <volume>\n # <id>9999999</id>\n # </volume>\n # <volume>\n # <id>3333333</id>\n # </volume>\n # </volumes>\n volumes_xml =\n \"<?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"yes\\\"?>\" +\n \"<volumes xmlns=\\\"http://registry.htrc.i3.illinois.edu/entities/workset\\\">\";\n\n for id in volume_ids\n volumes_xml += \"<volume><id>#{id}</id></volume>\"\n end\n volumes_xml += \"</volumes>\"\n\n\n # curl -v --data @new_volumes.xml -X PUT \\\n # -H \"Content-Type: application/vnd.htrc-volume+xml\" \\\n # -H \"Accept: application/vnd.htrc-volume+xml\" \\\n # http://localhost:9763/ExtensionAPI-0.1.0/services/worksets/workset1/volumes?user=fred\n\n url = URI.parse(\"#{APP_CONFIG['registry_url']}/worksets/#{workset_name}/volumes\")\n http = Net::HTTP.new(url.host, url.port)\n if Rails.env.development?\n http.set_debug_output($stdout)\n end\n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n\n request = Net::HTTP::Put.new(url.request_uri)\n request[\"Content-Type\"] = \"application/vnd.htrc-volume+xml\"\n request.add_field(\"Authorization\", \"Bearer #{token}\")\n\n request.body = volumes_xml\n response = http.request(request)\n\n #xml = response.body\n\n case response\n when Net::HTTPUnauthorized then\n raise Exceptions::SessionExpiredError.new(\"Session expired. Please login again\")\n when Net::HTTPSuccess then\n # Do nothing\n else\n raise Exceptions::SystemError.new(\"Error retrieving worksets (HTTP #{response.code})\")\n end\n\n end",
"def update\n @fam = Fam.find(params[:id])\n\n respond_to do |format|\n if @fam.update_attributes(params[:fam])\n flash[:notice] = 'Fam was successfully updated.'\n format.html { redirect_to(@fam) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @fam.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def family_params\n params[:family].permit(:name)\n end",
"def family_params\n params.require(:family).permit(:name)\n end",
"def family_params\r\n params.require(:family).permit(:name)\r\n end",
"def update_tenant_circle(args = {}) \n put(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend",
"def set_family_bond\n @family_bond = FamilyBond.find(params[:id])\n end",
"def update\n # returning connection.put(element_path(prefix_options), to_xml, self.class.headers) do |response|\n returning connection.put(element_path(prefix_options), to_ssj, self.class.headers) do |response|\n load_attributes_from_response(response)\n end\n end",
"def set_sub_family\n @sub_family = SubFamily.find(params[:id])\n end",
"def update\n respond_to do |format|\n if @family_bond.update(family_bond_params)\n format.html { redirect_to @family_bond, notice: 'Family bond was successfully updated.' }\n format.json { render :show, status: :ok, location: @family_bond }\n else\n format.html { render :edit }\n format.json { render json: @family_bond.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @families = Family.all\n end",
"def index\n @families = Family.all\n end",
"def index\n @families = Family.all\n end",
"def create_jobfamily\n @jobfamily = @company.jobfamilies.create(name: params[:jobfamily][:name])\n respond_to do |format|\n format.json { render json: @jobfamily }\n end\n end",
"def update\n @product_family = ProductFamily.find(params[:id])\n\n if @product_family.update_attributes(params[:product_family])\n flash[:success] = 'Product family was successfully updated.'\n redirect_to(product_families_path) \n else\n @title = \"Edit Product Family\"\n render :action => \"edit\"\n end\n end",
"def index\n @index_action = true\n @families = Family.all\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @families }\n end\n end",
"def update options={}\n client.put(\"/#{id}\", options)\n end",
"def put(*args)\n request :put, *args\n end",
"def set_tenant_family_member\n @tenant_family_member = TenantFamilyMember.find(params[:id])\n end",
"def update\n @family_image = FamilyImage.find(params[:id])\n\n if @family_image.update(family_image_params)\n head :no_content\n else\n render json: @family_image.errors, status: :unprocessable_entity\n end\n end",
"def put(obj, which=:groups)\n path = \"/#{which}\"\n path += \"/#{obj['ID']}\" unless obj['ID'].nil? \n resp = self.class.post(path, { :body => obj })\n check_errors resp\n res = resp.parsed_response['Response']['Entry']\n rebuild_groups! res\n res\n end",
"def set_os_family\n @os_family = OsFamily.find(params[:id])\n end",
"def update\n @node = Node.scopied.find(params[:id])\n\n respond_to do |format|\n if @node.update_attributes(params[:node])\n format.html { redirect_to(@node, :notice => 'Node was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @node.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def index\r\n @families = Family.all\r\n end",
"def update\n @family_unit = FamilyUnit.find(params[:id])\n\n respond_to do |format|\n if @family_unit.update_attributes(params[:family_unit])\n format.html { redirect_to @family_unit, notice: 'Family unit was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @family_unit.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 friendships_update(options = {})\n @req.post(\"/1.1/friendships/update.json\", options)\n end",
"def family_params\n params.require(:family).permit(:name, :description, :position, :country_id, categories_attributes: [:id, :name, :description, :position, :_destroy])\n end",
"def update\n connection.put(element_path, to_xml)\n end",
"def update!(**args)\n @family_name_spec = args[:family_name_spec] if args.key?(:family_name_spec)\n @given_name_spec = args[:given_name_spec] if args.key?(:given_name_spec)\n end",
"def set_family_member\n end",
"def update\n @breadcrumb = 'update'\n @product_family = ProductFamily.find(params[:id])\n @product_family.updated_by = current_user.id if !current_user.nil?\n\n respond_to do |format|\n if @product_family.update_attributes(params[:product_family])\n format.html { redirect_to @product_family,\n notice: (crud_notice('updated', @product_family) + \"#{undo_link(@product_family)}\").html_safe }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @product_family.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @os_family = OsFamily.new(os_family_params)\n\n respond_to do |format|\n if @os_family.save\n format.html { redirect_to @os_family, notice: 'Os family was successfully created.' }\n format.json { render :show, status: :created, location: @os_family }\n else\n format.html { render :new }\n format.json { render json: @os_family.errors, status: :unprocessable_entity }\n end\n end\n end",
"def test_edit_name_create_multiple_ancestors\n name = names(:two_ancestors)\n new_name = \"Neo#{name.text_name.downcase}\"\n new_species = new_name.sub(/(\\w* \\w*).*/, '\\1')\n new_genus = new_name.sub(/(\\w*).*/, '\\1')\n name_count = Name.count\n params = {\n id: name.id,\n name: {\n text_name: new_name,\n author: name.author,\n rank: name.rank\n }\n }\n login(name.user.login)\n put(:update, params: params)\n\n assert_equal(name_count + 2, Name.count)\n assert(Name.exists?(text_name: new_species), \"Failed to create new species\")\n assert(Name.exists?(text_name: new_genus), \"Failed to create new genus\")\n end",
"def destroy\n @family.destroy\n respond_to do |format|\n format.html { redirect_to families_url, notice: 'Family was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\r\n @family.destroy\r\n respond_to do |format|\r\n format.html { redirect_to families_url, notice: 'Family was successfully destroyed.' }\r\n format.json { head :no_content }\r\n end\r\n end",
"def update\n @father = Father.find(params[:id])\n\n respond_to do |format|\n if @father.update_attributes(params[:father])\n format.html { redirect_to @father, notice: 'Father was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @father.errors, status: :unprocessable_entity }\n end\n end\n end",
"def test_should_update_invite_via_API_XML\r\n get \"/logout\"\r\n put \"/invites/1.xml\", :invite => {:message => 'API Invite 1',\r\n :accepted => false,\r\n :email => 'test@email.com',\r\n :user_id => 1 }\r\n assert_response 401\r\n end",
"def update\n @species = Species.find(params[:id])\n @species.update_attributes(params[:species])\n \n respond_with(@species, :location => admin_species_path(@species))\n end",
"def update\n @groups_happening = GroupsHappening.find(params[:id])\n\n respond_to do |format|\n if @groups_happening.update_attributes(params[:groups_happening])\n flash[:notice] = 'GroupsHappening was successfully updated.'\n format.html { redirect_to(groups_happenings_path) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @groups_happening.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @discovery = Discovery.find(params[:id])\n\n respond_to do |format|\n if @discovery.update_attributes(params[:discovery])\n flash[:notice] = 'Discovery was successfully updated.'\n format.html { redirect_to(@discovery) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @discovery.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @family.church = current_church\n if @family.update(family_params)\n flash[:notice] = t('.success', name: @family.name)\n redirect_to action: :index\n else\n render :edit\n end\n end",
"def family_params\n params.require(:family).permit(:home_address, :email_address, :phone_number, primary_family_member_attributes: %i[type first_name last_name age])\n end"
] |
[
"0.61421263",
"0.59061885",
"0.5898075",
"0.58918715",
"0.58918715",
"0.5859121",
"0.5848183",
"0.58446854",
"0.58446854",
"0.5784108",
"0.5741172",
"0.5739658",
"0.57295436",
"0.56958514",
"0.56777835",
"0.5633969",
"0.56147975",
"0.5611409",
"0.558681",
"0.55664265",
"0.5516374",
"0.54380774",
"0.5392928",
"0.53882235",
"0.5385472",
"0.5379394",
"0.5325324",
"0.53076035",
"0.52913105",
"0.5275671",
"0.52509964",
"0.5239862",
"0.5239384",
"0.5228518",
"0.5225561",
"0.5211133",
"0.51951635",
"0.51936585",
"0.5181355",
"0.5167627",
"0.516263",
"0.51555395",
"0.51359606",
"0.5135666",
"0.51341546",
"0.51329833",
"0.5128801",
"0.511625",
"0.51059437",
"0.50993776",
"0.5082408",
"0.50738174",
"0.5068573",
"0.5067837",
"0.50669664",
"0.5063833",
"0.5050592",
"0.5050048",
"0.50484705",
"0.50446653",
"0.5041289",
"0.50378776",
"0.5036893",
"0.50365204",
"0.5016591",
"0.5000456",
"0.49900112",
"0.4988604",
"0.4988604",
"0.4988604",
"0.4981522",
"0.49506196",
"0.49399447",
"0.4939936",
"0.4936991",
"0.49192658",
"0.49034122",
"0.48984715",
"0.48912013",
"0.4890772",
"0.48877",
"0.48812094",
"0.4881062",
"0.48749617",
"0.4867011",
"0.4864466",
"0.48558888",
"0.48495623",
"0.48480064",
"0.48445174",
"0.48382413",
"0.48373395",
"0.48364267",
"0.48289877",
"0.48278648",
"0.48219055",
"0.48123124",
"0.47927698",
"0.47880295",
"0.47827187"
] |
0.621874
|
0
|
DELETE /families/1 DELETE /families/1.xml
|
def destroy
@family ||= Family.find(params[:id])
@family.destroy
respond_to do |format|
format.html { redirect_to(families_url) }
format.xml { head :ok }
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def destroy\n# @family = Family.find(params[:id])\n# @family.destroy\n#\n# respond_to do |format|\n# format.html { redirect_to(families_url) }\n# format.xml { head :ok }\n# end\n end",
"def destroy\n @family = Family.find(params[:id])\n @family.destroy\n\n respond_to do |format|\n format.html { redirect_to families_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @family.destroy\n respond_to do |format|\n format.html { redirect_to families_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n family = @child.family\n @child.destroy\n respond_to do |format|\n format.html { redirect_to family, notice: tr(\"child_deleted\") }\n end\n end",
"def destroy\n @os_family.destroy\n respond_to do |format|\n format.html { redirect_to os_families_url, notice: 'Os family was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n chef_server_rest.delete(\"nodes/#{name}\")\n end",
"def destroy\n @family.destroy\n respond_to do |format|\n format.html { redirect_to families_url, notice: 'La familia fue eliminada exitosamente.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @family.destroy\n respond_to do |format|\n format.html { redirect_to families_url, notice: 'Family was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n genus = Genu.all;\n genus.each do |genu|\n if(genu.sub_family_id == @sub_family.id)\n genu.destroy\n end\n end\n @sub_family.destroy\n respond_to do |format|\n format.html { redirect_to sub_families_url, notice: 'Sub família foi deletada.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @family = Family.find(params[:id])\n @family.destroy\n\n respond_to do |format|\n format.html { redirect_to session[:redirect_path] }\n format.json { head :ok }\n end\n end",
"def destroy\n @product_family = ProductFamily.find(params[:id])\n @product_family.destroy\n\n respond_to do |format|\n format.html { redirect_to(product_families_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\r\n @family.destroy\r\n respond_to do |format|\r\n format.html { redirect_to families_url, notice: 'Family was successfully destroyed.' }\r\n format.json { head :no_content }\r\n end\r\n end",
"def destroy\n @family.destroy\n redirect_to families_url, notice: 'Family was successfully destroyed.'\n end",
"def destroy\n @browsenodeid = Browsenodeid.find(params[:id])\n @browsenodeid.destroy\n\n respond_to do |format|\n format.html { redirect_to(browsenodeids_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @family_member = FamilyMember.find(params[:id])\n @family_member.destroy\n\n respond_to do |format|\n format.html { redirect_to(family_family_members_url(@current_family)) }\n format.xml { head :ok }\n end\n end",
"def test_set3_04b_delete_group()\n group = \"test_group\"\n user = \"test_user\"\n \n @test_acl.create_principal(user)\n @test_acl.create_group(group, [\"ALL\"], [user])\n \n query = \"doc(\\\"#{@col_path}Principals.xml\\\")//node()[@id=\\\"#{user}\\\"]/membership/mgroup[@idref=\\\"#{group}\\\"]\"\n #puts query\n handle = @db.execute_query(query)\n hits = @db.get_hits(handle)\n assert_equal(1, hits)\n \n @test_acl.delete_principal(group)\n \n query = \"doc(\\\"#{@col_path}Principals.xml\\\")//node()[@id=\\\"#{user}\\\"]/membership/mgroup[@idref=\\\"#{group}\\\"]\"\n handle = @db.execute_query(query)\n hits = @db.get_hits(handle)\n assert_equal(0, hits)\n end",
"def netdev_resxml_delete( xml )\n top = netdev_resxml_top( xml )\n par = top.instance_variable_get(:@parent)\n par['delete'] = 'delete'\n end",
"def delete(options={})\n connection.delete(\"/\", @name)\n end",
"def destroy\n @family_relationship.destroy\n respond_to do |format|\n format.html { redirect_to family_relationships_url, notice: 'Family relationship was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @family_group.destroy\n respond_to do |format|\n format.html { redirect_to family_groups_url }\n format.json { head :no_content }\n end\n end",
"def delete\n\t\tdb.execute{ \"delete edge #{ref_name} #{rrid}\" }\n\tend",
"def destroy\n @groups_happening = GroupsHappening.find(params[:id])\n @groups_happening.destroy\n\n respond_to do |format|\n format.html { redirect_to(groups_happenings_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @discovery = Discovery.find(params[:id])\n @discovery.destroy\n\n respond_to do |format|\n format.html { redirect_to(discoveries_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @control_family = ControlFamily.find(params[:id])\n @control_family.destroy\n\n respond_to do |format|\n format.html { redirect_to control_families_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @childmaster = Childmaster.find(params[:id])\n @childmaster.destroy\n\n respond_to do |format|\n format.html { redirect_to(childmasters_url) }\n format.xml { head :ok }\n end\n end",
"def delete()\n response = send_post_request(@xml_api_delete_path)\n response.is_a?(Net::HTTPSuccess) or response.is_a?(Net::HTTPRedirection)\n end",
"def deleteResource(doc, msg_from)\n \n \n begin\n\n puts \"Deleting\"\n\n path = \"\"\n params = {}\n headers = {}\n \n context, path = findContext(doc, path) \n \n # Deleting member from group\n if context == :user_group_member\n params = {}\n else\n raise Exception.new(\"No context given!\")\n end\n \n httpAndNotify(path, params, msg_from, :delete)\n \n rescue Exception => e\n puts \"Problem in parsing data (CREATE) from xml or sending http request to the VR server: \" + e\n puts \" -- line: #{e.backtrace[0].to_s}\"\n end\n \n end",
"def _delete(type, *args)\n type = type.to_s.camelize\n metadata = args.map { |full_name| {:full_name => full_name} }\n request :delete do |soap|\n soap.body = {\n :metadata => metadata\n }.merge(attributes!(type))\n end\n end",
"def destroy\n @attribute_group = AttributeGroup.find(params[:id])\n @attribute_group.destroy\n\n respond_to do |format|\n format.html { redirect_to(attribute_groups_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @absence_request = AbsenceRequest.find(params[:id])\n @absence_request.destroy\n\n respond_to do |format|\n format.html { redirect_to(absence_requests_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n relationship = Relationships.find(params[:id])\n relationship.destroy\n head 204\n end",
"def destroy\n Group.rebuild! if nil.|Group.find(:first).rgt\n\t @group = Group.find(params[:id])\n @group.destroy\n\n respond_to do |format|\n format.html { redirect_to(groups_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n RestClient.delete \"#{REST_API_URI}/contents/#{id}.xml\" \n self\n end",
"def destroy\n @relationship = Relationship.find(params[:id])\n @relationship.destroy\n\n respond_to do |format|\n format.html { redirect_to(relationships_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @person = Person.find(params[:id])\n pedigree = @person.pedigree\n @person.destroy\n\n respond_to do |format|\n format.html { redirect_to(pedigree_url(pedigree)) }\n format.xml { head :ok }\n end\n end",
"def deleteEntityFax( entity_id, gen_id)\n params = Hash.new\n params['entity_id'] = entity_id\n params['gen_id'] = gen_id\n return doCurl(\"delete\",\"/entity/fax\",params)\n end",
"def destroy\n @helibasis = Helibase.find(params[:id])\n @helibasis.destroy\n\n respond_to do |format|\n format.html { redirect_to(helibases_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @family_member = FamilyMember.find(params[:id])\n @family_member.destroy\n\n respond_to do |format|\n format.html { redirect_to family_members_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @family_member = FamilyMember.find(params[:id])\n @family_member.destroy\n\n respond_to do |format|\n format.html { redirect_to family_members_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @family_bond.destroy\n respond_to do |format|\n format.html { redirect_to family_bonds_url, notice: 'Family bond was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete(id:)\n id_check(:id, id)\n\n cf_delete(path: \"/organizations/#{org_id}/railguns/#{id}\")\n end",
"def destroy\n @fgroup = Fgroup.find(params[:id])\n @fgroup.destroy\n\n respond_to do |format|\n format.html { redirect_to(fgroups_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @child_dupa2 = ChildDupa2.find(params[:id])\n @child_dupa2.destroy\n\n respond_to do |format|\n format.html { redirect_to(child_dupa2s_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @language_family.destroy\n respond_to do |format|\n format.html { redirect_to language_families_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @probe = Probe.find(params[:id])\n @probe.destroy\n\n respond_to do |format|\n format.html { redirect_to(probes_url) }\n format.xml { head :ok }\n end\n end",
"def delete_from_family family_name\n options = { family_name: family_name }\n @mutations <<\n Google::Bigtable::V2::Mutation.new(delete_from_family: options)\n end",
"def destroy\n @helibase = Helibase.find(params[:id])\n @helibase.destroy\n\n respond_to do |format|\n format.html { redirect_to(helibases_url) }\n format.xml { head :ok }\n end\n end",
"def delete_data(index_name)\n uri = @client.make_uri(\"/#{index_name}/update/\")\n req = HTTP::Post.new(uri)\n req.content_type = 'text/xml'\n req.body = '<delete><query>*:*</query></delete>'\n response = @client.send_http(req, true, ['200'])\n end",
"def destroy\n\n @group_definition = GroupDefinition.find(params[:id])\n @group_definition.destroy\n\n respond_to do |format|\n format.html do\n if request.env['HTTP_REFERER']\n redirect_to(:back)\n else\n redirect_to(group_definitions_url)\n end\n end\n format.xml do\n head :ok\n end\n end\n end",
"def destroy\n @belonging = Belonging.find(params[:id])\n @belonging.destroy\n\n respond_to do |format|\n format.html { redirect_to(belongings_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @family_background = FamilyBackground.find(params[:id])\n @family_background.destroy\n\n respond_to do |format|\n format.html { redirect_to(family_backgrounds_url) }\n format.xml { head :ok }\n end\n end",
"def delete()\n response = send_post_request(@xml_api_delete_path)\n response.is_a?(Net::HTTPSuccess) or response.is_a?(Net::HTTPRedirection)\n end",
"def destroy\n @node_config = NodeConfig.destroy(params[:id])\n xml=@node_config.to_xml\n json=@node_config.to_json\n @node_config.destroy\n\n respond_to do |format|\n format.html { redirect_to(node_configs_url) }\n format.json { render :json => json}\n format.xml { render :xml => xml}\n end\n end",
"def destroy\n @fam = Fam.find(params[:id])\n @fam.destroy\n\n respond_to do |format|\n format.html { redirect_to(fams_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @partyrelationship = Partyrelationship.find(params[:id])\n @partyrelationship.destroy\n\n respond_to do |format|\n format.html { redirect_to(partyrelationships_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @node = Node.find(params[:id])\n @node.destroy\n\n respond_to do |format|\n format.html { redirect_to(nodes_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @node = Node.find(params[:id])\n @node.destroy\n\n respond_to do |format|\n format.html { redirect_to(nodes_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @node = Node.find(params[:id])\n @node.destroy\n\n respond_to do |format|\n format.html { redirect_to(nodes_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @node = Node.find(params[:id])\n @node.destroy\n\n respond_to do |format|\n format.html { redirect_to(nodes_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @node = Node.find(params[:id])\n @node.destroy\n\n respond_to do |format|\n format.html { redirect_to(nodes_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @children_centre = ChildrenCentre.find(params[:id])\n @children_centre.destroy\n\n respond_to do |format|\n format.html { redirect_to(children_centres_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @taxon_name_relationship.destroy\n respond_to do |format|\n format.html { redirect_to taxon_name_relationships_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @tenant_family_member.destroy\n respond_to do |format|\n format.html { redirect_to :back, notice: 'Tenant family member was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n node = @job.nodes.find(params[:id])\n @job.nodes.delete(node)\n\n respond_to do |format|\n format.html { redirect_to job_url(@job) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @add_to_group = AddToGroup.find(params[:id])\n @add_to_group.destroy\n\n respond_to do |format|\n format.html { redirect_to(add_to_groups_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @correspondence = Correspondence.find(params[:id])\n @correspondence.destroy\n\n respond_to do |format|\n format.html { redirect_to(correspondences_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @brother = Brother.find(params[:id])\n @brother.destroy\n\n respond_to do |format|\n format.html { redirect_to(brothers_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @children = Children.find(params[:id])\n @children.destroy\n\n respond_to do |format|\n format.html { redirect_to(childrens_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @hierarchy = Hierarchy.find(params[:id])\n @hierarchy.destroy\n\n redirect_to configs_hierarchies_url\n end",
"def destroy\n @helocagree = Helocagree.find(params[:id])\n @helocagree.destroy\n\n respond_to do |format|\n format.html { redirect_to(helocagrees_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @cluster = Cluster.find(params[:id])\n @cluster.destroy\n\n respond_to do |format|\n format.html { redirect_to(clusters_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @abonne = Abonne.find(params[:id])\n @abonne.destroy\n\n respond_to do |format|\n format.html { redirect_to(abonnes_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @defendant.destroy\n respond_to do |format|\n format.html { redirect_to defendants_url, notice: \"Acusado eliminado con éxito.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @allergy = Allergy.find(params[:id])\n @allergy.destroy\n\n respond_to do |format|\n format.html { redirect_to(allergies_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @node = Node.scopied.find(params[:id])\n @node.kill\n\n respond_to do |format|\n format.html { redirect_to(nodes_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @agent = Agent.find(params[:id])\n @agent.destroy\n \n respond_to do |format|\n format.html { redirect_to(agents_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @family_document.destroy\n respond_to do |format|\n format.html { redirect_to family_documents_url, notice: \"Family document was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @genbank_file.destroy\n\n respond_to do |format|\n format.xml { head :ok }\n format.json { head :ok }\n end\n end",
"def destroy\n @family_image.destroy\n\n head :no_content\n end",
"def destroy\n @child = Child.find(params[:id])\n @child.destroy\n\n respond_to do |format|\n format.html { redirect_to(children_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n Group.destroy(params[:id])\n\n respond_to do |format|\n format.html { redirect_to(groups_url) }\n format.xml { head :ok }\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(emple_path) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @config_xml = ConfigXml.find(params[:id])\n @config_xml.destroy\n\n respond_to do |format|\n format.html { redirect_to(config_xmls_url) }\n format.xml { head :ok }\n end\n rescue ActiveRecord::RecordNotFound => e\n prevent_access(e)\n end",
"def delete(name); end",
"def delete(name); end",
"def destroy\n @giving_group = GivingGroup.find(params[:id])\n @giving_group.destroy\n\n respond_to do |format|\n format.html { redirect_to(giving_groups_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @grupo = Grupo.find(params[:id])\n @grupo.destroy\n\n respond_to do |format|\n format.html { redirect_to(grupos_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @gtfs_agency = GtfsAgency.find(params[:id])\n @gtfs_agency.destroy\n\n respond_to do |format|\n format.html { redirect_to(gtfs_agencies_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @hospedagem = Hospedagem.find(params[:id])\n @hospedagem.destroy\n\n respond_to do |format|\n format.html { redirect_to(hospedagens_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @regiaos = Regiao.find(params[:id])\n @regiaos.destroy\n\n respond_to do |format|\n format.html { redirect_to(homes_path) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @agent = @habitat.agents.find(params[:id])\n @agent.destroy\n\n respond_to do |format|\n format.html { redirect_to habitat_agents_url }\n format.xml { head :ok }\n end\n end",
"def destroy\n @subrelation = Subrelation.find(params[:id])\n @subrelation.destroy\n\n respond_to do |format|\n format.html { redirect_to(subrelations_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @refferalmaster = Refferalmaster.find(params[:id])\n @refferalmaster.destroy\n\n respond_to do |format|\n format.html { redirect_to(refferalmasters_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @descendant.destroy\n respond_to do |format|\n format.html { redirect_to descendants_url, notice: 'Descendant was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete_tenant_circle(args = {}) \n delete(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend",
"def destroy\n @ail_group = AilGroup.find(params[:id])\n @ail_group.destroy\n\n respond_to do |format|\n format.html { redirect_to(ail_groups_url) }\n format.xml { head :ok }\n end\n end",
"def destroy; delete end",
"def delete\n client.delete(\"/#{id}\")\n end",
"def destroy\n @who_prefix = WhoPrefix.find(params[:id])\n @who_prefix.destroy\n\n respond_to do |format|\n format.html { redirect_to(who_prefixes_url) }\n format.xml { head :ok }\n format.json { head :ok }\n end\n end",
"def destroy\n @relatorios = Relatorio.find(params[:id])\n @relatorios.destroy\n\n respond_to do |format|\n format.html { redirect_to(homes_path) }\n format.xml { head :ok }\n end\n end"
] |
[
"0.6905691",
"0.6569807",
"0.64943194",
"0.64396614",
"0.6367237",
"0.6339901",
"0.6333035",
"0.6294966",
"0.6293467",
"0.6292798",
"0.6276343",
"0.62606055",
"0.62497",
"0.6212668",
"0.6197228",
"0.617815",
"0.6145188",
"0.6105732",
"0.61008066",
"0.60920554",
"0.6083808",
"0.608132",
"0.6055217",
"0.6030836",
"0.6022556",
"0.6018167",
"0.6006696",
"0.6000956",
"0.5979251",
"0.59724915",
"0.5961895",
"0.5933089",
"0.5932906",
"0.5932156",
"0.59102184",
"0.59084076",
"0.59069663",
"0.5902941",
"0.5902941",
"0.58999914",
"0.58921784",
"0.5889389",
"0.58862376",
"0.5884984",
"0.5867509",
"0.58660436",
"0.58580923",
"0.58571583",
"0.58567894",
"0.58522445",
"0.58516425",
"0.58513683",
"0.5845367",
"0.5844935",
"0.58397883",
"0.583946",
"0.583946",
"0.583946",
"0.583946",
"0.583946",
"0.58373296",
"0.58358",
"0.5832975",
"0.58222085",
"0.5818601",
"0.5817306",
"0.58141416",
"0.58124566",
"0.5808087",
"0.5802955",
"0.5801297",
"0.5795277",
"0.57862",
"0.57829845",
"0.57753354",
"0.57714",
"0.57713306",
"0.57696456",
"0.57689345",
"0.5761098",
"0.57601225",
"0.5759312",
"0.5752185",
"0.5751883",
"0.5751883",
"0.573983",
"0.5734854",
"0.57335716",
"0.5731872",
"0.5730755",
"0.57304466",
"0.57267743",
"0.57205033",
"0.5719844",
"0.5718888",
"0.5717681",
"0.5717359",
"0.5716853",
"0.5715537",
"0.571234"
] |
0.72651905
|
0
|
GET /contact_stores GET /contact_stores.json
|
def index
@contact_stores = ContactStore.all
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def index\n @stores = Store.all\n render json: @stores\n end",
"def index\n @api_v1_stores = Store.all\n json_response(@api_v1_stores)\n end",
"def index\n @stores = @commerce.stores\n end",
"def index\n @admin_stores = Admin::Store.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @admin_stores }\n end\n end",
"def index\n if current_user.admin?\n @stores = Store.all\n else\n @stores = current_user.stores\n end\n\n render json: @stores\n end",
"def index\n @stores = current_account.stores.find(:all)\t\n end",
"def show\n render json: @store\n end",
"def index\n @contacts = Contact.all\n render json: @contacts\n end",
"def create\n @contact_store = ContactStore.new(contact_store_params)\n\n respond_to do |format|\n if @contact_store.save\n format.html { redirect_to @contact_store, notice: 'Contact store was successfully created.' }\n format.json { render :show, status: :created, location: @contact_store }\n else\n format.html { render :new }\n format.json { render json: @contact_store.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @online_stores = OnlineStore.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @online_stores }\n end\n end",
"def index\n @contacts = Contact.all\n render json: {status: 200, contacts: @contacts}\n end",
"def index\n @cakestores = Cakestore.all\n end",
"def index\n @stores = Store.all\n prepFormVariables\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @stores }\n end\n end",
"def index\n @stores = Store.all.includes(:admin)\n\n respond_to do |format|\n format.html\n format.json\n end\n end",
"def show\n render json: @store\n end",
"def show\n render json: @contact\n end",
"def show\n render json: @contact\n end",
"def index\n\t\tbegin\n\t\t\tif params[:lat].present? && params[:lng].present?\n\t\t\t\t@address = Geokit::Geocoders::GoogleGeocoder.reverse_geocode \"#{params[:lat]},#{params[:lng]}\"\n\t\t\t\tparams[:postal_code] = @address.try(:zip) if @address.success\n\t\t\tend\n\t\t\t@search = Store.search do\n\t\t\t\tfulltext(params[:postal_code]) do\n\t\t\t\t\tfields(:postal_code)\n\t\t\t\tend\n\t\t\tend\n\t\t\tif @address.present?\n\t\t\t\t@stores = @search.results.sort_by{|s| s.distance_to([@address.lat,@address.lng])}\n\t\t\telse\n\t\t\t\t@stores = @search.results\n\t\t\tend\n\t\t\t\t@postal_code = params[:postal_code]\n\t\t\t\t@stores =\t@stores.first(5) if params[:type] == \"collection\"\n\t\t\trender :index, status: :ok\n\t\trescue Exception => e\n\t\t\terror_handling_bad_request(e)\n\t\tend\n\tend",
"def index\n @stores = Store.all\n end",
"def index\n @stores = Store.all\n end",
"def index\n @stores = Store.all\n end",
"def index\n @stores = Store.all\n end",
"def index\n @stores = Store.all\n end",
"def show\n respond_to do |format|\n format.html do\n gon.stores = [\"AppEstablishmentStore\"] \n gon.jbuilder \n end\n\n format.json { render :show }\n end \n end",
"def show\n\t\t\t\t @store = Spree::Store.find(params[:id])\n\t\t\t\t respond_to do |format|\n\t\t\t\t format.html # show.html.erb\n\t\t\t\t format.json { render json: @store }\n\t\t\t\t end\n\t\t\t\t end",
"def show\n render json: @contact.address\n end",
"def show\n @store = Store.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @store }\n end\n end",
"def show\n @store = Store.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @store }\n end\n end",
"def show\n @store = Store.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @store }\n end\n end",
"def show\n @store = Store.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @store }\n end\n end",
"def list_stores\n @stores = Store.where(\"level = ?\", 2)\n if @stores.present?\n render :index, status: :ok\n else\n @message = \"no store found\"\n render :error, status: :not_found\n end\n end",
"def show\n @store = Store.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @store }\n end\n end",
"def show\n @store = Store.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @store }\n end\n end",
"def stores\n unless @stores\n page = request(store_url)\n raise StoreRequestError unless page.code == \"200\"\n\n xml = Nokogiri::XML(page.body)\n \n @stores = {}\n \n xml.css('GotoURL SetFontStyle').each do |name_node|\n name = name_node.text\n url = name_node.parent.parent['url']\n store_id = url.match(/storeFrontId=([0-9]+)/)[1] rescue nil\n @stores[name] = store_id if store_id && name\n end\n end\n @stores\n end",
"def index\n @stores = @stores.page(params[:page]).per(10)\n end",
"def index\n\t\t@stores = Store.all\n\tend",
"def customers\n ShopifyAPI::Customer.all\n end",
"def set_contact_store\n @contact_store = ContactStore.find(params[:id])\n end",
"def index\n @service_locations = ServiceLocation.all\n render json: @service_locations\n end",
"def index\n @store = Store.find(params[:store_id])\n @menus = @store.menus\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @menus }\n end\n end",
"def show\n json_response(@api_v1_store)\n end",
"def index\n @customers_addresses = CustomersAddress.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @customers_addresses }\n end\n end",
"def new\n @store = Store.new\n @cities = City.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @store }\n end\n end",
"def index\n contacteds = @business.contacteds\n \n render json: contacteds\n end",
"def index\n @stores = @stores.full_text_search(params[:search]).with_pg_search_rank if params[:search].present?\n @stores = @stores.by_state(params[:state]) if params[:state].present?\n @stores = @stores.by_type(params[:type]) if params[:type].present?\n @stores = @stores.where(latitude: nil).or(Store.where(longitude: nil)) if params[:no_info]\n\n @stores = @stores.order(:name)\n\n respond_to do |format|\n format.html do\n @stores = @stores.page(params[:page])\n end\n format.json do\n @stores = @stores.limit(50)\n end\n format.csv do\n send_data @stores.to_csv, type: 'csv', filename: 'pins-export.csv'\n end\n end\n end",
"def index\n @contactable = find_contactable\n @contactos = @contactable.contactos\n\n respond_to do |format|\n format.html # index.html.erb\n #format.json { render json: @contactos }\n end\n end",
"def show\n @admin_store = Admin::Store.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @admin_store }\n end\n end",
"def show\n render json: @shop\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 index\n @library_contacts = @library_location.library_contacts.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @library_contacts }\n end\n end",
"def index\n @sales = Sale.all\n\n render json: @sales\n end",
"def index\n @shop = Shop.find(1)\n render :json => @shop\n return\n end",
"def index\n @shop_sections = ShopSection.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @shop_sections }\n end\n end",
"def show\n @site_contact = SiteContact.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @site_contact }\n end\n end",
"def show\n @contact = Contact.find(params[:id])\n\n render json: @contact\n end",
"def index\n @store = Store.find(params[:store_id])\n @dish_discounts = @store.dish_discounts\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @dish_discounts }\n end\n end",
"def show\n respond_to do |format|\n format.html\n format.json { render :json => @client_contact_hash }\n format.xml { render :xml => @client_contact_hash }\n end\n end",
"def show\n\t@store = current_account.stores.find(params[:id])\n end",
"def show\n @store_section = StoreSection.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @store_section }\n end\n end",
"def show\n @created_stores = @user.created_stores.search(params[:search])\n @created_stores = @created_stores.by_state(params[:state]) if params[:state].present?\n @created_stores = @created_stores.by_type(params[:type]) if params[:type].present?\n @created_stores = @created_stores.order(:name).page(params[:page])\n end",
"def index \n @sels = params[\"sels\"] || []\n @search = @customer.contacts.search(params[:search])\n @contacts = @search.paginate(page: params[:page], :per_page => 20)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json do\n #@content = render_to_string( :template => \"contacts/_list\", :locals => { items: @customer.contacts }, :formats => :html, :layout => false)\n #render :json => @content, :content_type => \"application/json\"\n render :partial => \"list\", :locals => { items: @contacts, :layout => false }, :formats => :html, :layout => false\n end\n end\n end",
"def index\n \tcustomers = Customer.all\n \trender json: customers\n \tend",
"def store_information\n get('store')\n end",
"def show\n @customer = Customer.find(params[:customer_id])\n @cust_contact = @customer.cust_contacts.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @cust_contact }\n end\n end",
"def show\n @data_store = DataStore.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @data_store }\n end\n end",
"def index\n @contacts = @client.contacts\n end",
"def index\n if params[:merchant_id].present?\n @point_of_contacts = @point_of_contacts.where(:merchant_id => params[:merchant_id])\n end\n\n render json: @point_of_contacts, callback: params[:callback]\n end",
"def show\n @online_store = OnlineStore.find(params[:id])\n @products = @online_store.products\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @online_store }\n end\n end",
"def index\n render json: Seller.all\n end",
"def index\n @user_contacts = UserContact.all\n render :json => user_contact_data(@user_contacts)\n end",
"def lookup\n respond_to do |format|\n format.json { render json: Crm::ContactLookup.new(view_context) }\n end\n end",
"def index\n @sales = @saleService.all_to_json().as_json;\n end",
"def show\n @stores_report = Stores::Report.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @stores_report }\n end\n end",
"def index\n @customers = @user.customers.all\n render json: @customers\n end",
"def index\n @shop_platinum_offers = Shop::PlatinumOffer.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @shop_platinum_offers }\n end\n end",
"def index\n suppliers = current_user.suppliers\n contacts = []\n purchase_orders = []\n reviews = []\n invoices = []\n if suppliers.length > 0\n suppliers.map do |supplier|\n contacts.push({ supplierName: supplier.name, contactName: supplier.contact_name,\n contactEmail: supplier.contact_email })\n next unless supplier.purchase_orders.length > 0\n\n supplier.purchase_orders.map do |po|\n purchase_orders.push(po)\n reviews.push(po.review) unless po.review.nil?\n invoices.push(po.invoice) unless po.invoice.nil?\n end\n end\n end\n render json: { suppliers: suppliers, contacts: contacts, purchase_orders: purchase_orders, reviews: reviews,\n invoices: invoices }\n end",
"def index\n @men_shop_collections = MenShopCollection.all\n end",
"def index\n @places = @site.places.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @places }\n end\n end",
"def get_contacts(options = {})\n send_request(\"get\", contacts_url, body: options.to_json)\n end",
"def index\n @stores = Store.by_id\n @categories = Category.all\n\n end",
"def index\n @cities = City.all\n\n render json: @cities\n end",
"def show\n @store = Store.find(params[:store_id])\n @menu = @store.menus.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @menu }\n end\n end",
"def index\n @shop_customers = ShopCustomer.all\n end",
"def index\n #@shares = Share.all\n @stores = Store.find_my_stores(session[:user_id])\n @sharedStores = Store.find_my_share_stores(session[:user_id])\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @shares }\n end\n end",
"def index\n @book_stores = BookStore.all\n end",
"def index\n #@site_contacts = SiteContact.all\n end",
"def show\n respond_to do |format|\n format.html\n format.json { render :json => @client_contact_sync_hash }\n format.xml { render :xml => @client_contact_sync_hash }\n end\n end",
"def index\n @contacts = current_company.contacts\n respond_to do |format|\n format.xml { render :xml => @contacts }\n format.json { render :json => @contacts }\n end\n end",
"def index\n @store_managers = StoreManager.all\n end",
"def show\n render json: @referral_contact\n end",
"def index\n @sale_orders = current_company.sale_orders.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @sale_orders }\n end\n end",
"def index\n @admin_stores = Store.all\n end",
"def show\n render json: @sale\n end",
"def index\n @company_authorities = CompanyAuthority.all\n\n render json: @company_authorities\n end",
"def index\n\n get_collections\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @deities }\n format.js {}\n end\n end",
"def show\n render json: @company\n end",
"def index\n @customers = Customer.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @customers }\n end\n end",
"def show\n @store = Store.find(params[:id])\n prepFormVariables\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @store }\n end\n end",
"def index\n @custom_collections = CustomCollection.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @custom_collections }\n end\n end",
"def index\n @shop_fb_credit_offers = Shop::FbCreditOffer.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @shop_fb_credit_offers }\n end\n end"
] |
[
"0.6989113",
"0.66856945",
"0.659619",
"0.6567925",
"0.65228313",
"0.64396065",
"0.6334135",
"0.6324183",
"0.6324067",
"0.63140893",
"0.62966347",
"0.62866545",
"0.6275036",
"0.6259201",
"0.6256949",
"0.6251011",
"0.6251011",
"0.62449163",
"0.6203063",
"0.6203063",
"0.6203063",
"0.6203063",
"0.6203063",
"0.62030625",
"0.6190827",
"0.61797154",
"0.617479",
"0.617479",
"0.617479",
"0.617479",
"0.6126924",
"0.6116414",
"0.6115906",
"0.60842127",
"0.6070395",
"0.60670906",
"0.6045484",
"0.6035907",
"0.6015022",
"0.60081047",
"0.59966046",
"0.5985338",
"0.5974725",
"0.5963172",
"0.5951912",
"0.5945664",
"0.5916843",
"0.5910421",
"0.59051305",
"0.5881017",
"0.58745795",
"0.5867574",
"0.58565754",
"0.5840306",
"0.5829167",
"0.5821382",
"0.5817658",
"0.58164",
"0.5814991",
"0.5810398",
"0.5805986",
"0.5803587",
"0.5803196",
"0.5791358",
"0.5790522",
"0.5776633",
"0.5773869",
"0.57699674",
"0.57694215",
"0.5761799",
"0.5755549",
"0.5752329",
"0.5743333",
"0.5741772",
"0.5740494",
"0.57367164",
"0.57293946",
"0.5727649",
"0.57269573",
"0.5718991",
"0.5711671",
"0.56762624",
"0.5675236",
"0.5674649",
"0.5674454",
"0.56629604",
"0.56600827",
"0.5659305",
"0.5653952",
"0.5650101",
"0.56461823",
"0.56439257",
"0.56342065",
"0.5632192",
"0.56314266",
"0.56308734",
"0.5626041",
"0.5621106",
"0.56094795",
"0.5607254"
] |
0.73882145
|
0
|
GET /contact_stores/1 GET /contact_stores/1.json
|
def show
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def index\n @contact_stores = ContactStore.all\n end",
"def index\n @api_v1_stores = Store.all\n json_response(@api_v1_stores)\n end",
"def index\n @stores = Store.all\n render json: @stores\n end",
"def index\n @admin_stores = Admin::Store.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @admin_stores }\n end\n end",
"def show\n @store = Store.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @store }\n end\n end",
"def show\n @store = Store.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @store }\n end\n end",
"def show\n @store = Store.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @store }\n end\n end",
"def show\n @store = Store.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @store }\n end\n end",
"def show\n @store = Store.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @store }\n end\n end",
"def show\n render json: @store\n end",
"def show\n @store = Store.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @store }\n end\n end",
"def show\n json_response(@api_v1_store)\n end",
"def index\n @stores = @commerce.stores\n end",
"def show\n render json: @store\n end",
"def show\n\t\t\t\t @store = Spree::Store.find(params[:id])\n\t\t\t\t respond_to do |format|\n\t\t\t\t format.html # show.html.erb\n\t\t\t\t format.json { render json: @store }\n\t\t\t\t end\n\t\t\t\t end",
"def show\n render json: @contact\n end",
"def show\n render json: @contact\n end",
"def index\n @contacts = Contact.all\n render json: @contacts\n end",
"def create\n @contact_store = ContactStore.new(contact_store_params)\n\n respond_to do |format|\n if @contact_store.save\n format.html { redirect_to @contact_store, notice: 'Contact store was successfully created.' }\n format.json { render :show, status: :created, location: @contact_store }\n else\n format.html { render :new }\n format.json { render json: @contact_store.errors, status: :unprocessable_entity }\n end\n end\n end",
"def show\n respond_to do |format|\n format.html do\n gon.stores = [\"AppEstablishmentStore\"] \n gon.jbuilder \n end\n\n format.json { render :show }\n end \n end",
"def index\n if current_user.admin?\n @stores = Store.all\n else\n @stores = current_user.stores\n end\n\n render json: @stores\n end",
"def index\n @online_stores = OnlineStore.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @online_stores }\n end\n end",
"def index\n @contacts = Contact.all\n render json: {status: 200, contacts: @contacts}\n end",
"def show\n render json: @contact.address\n end",
"def show\n @admin_store = Admin::Store.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @admin_store }\n end\n end",
"def index\n @stores = current_account.stores.find(:all)\t\n end",
"def index\n @stores = Store.all\n prepFormVariables\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @stores }\n end\n end",
"def index\n @stores = Store.all.includes(:admin)\n\n respond_to do |format|\n format.html\n format.json\n end\n end",
"def show\n @contact = Contact.find(params[:id])\n\n render json: @contact\n end",
"def show\n @data_store = DataStore.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @data_store }\n end\n end",
"def new\n @store = Store.new\n @cities = City.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @store }\n end\n end",
"def show\n @store_section = StoreSection.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @store_section }\n end\n end",
"def index\n @shop = Shop.find(1)\n render :json => @shop\n return\n end",
"def show\n @site_contact = SiteContact.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @site_contact }\n end\n end",
"def index\n @cakestores = Cakestore.all\n end",
"def index\n @stores = Store.all\n end",
"def index\n @stores = Store.all\n end",
"def index\n @stores = Store.all\n end",
"def index\n @stores = Store.all\n end",
"def index\n @stores = Store.all\n end",
"def show\n @stores_report = Stores::Report.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @stores_report }\n end\n end",
"def show\n render json: @shop\n end",
"def set_contact_store\n @contact_store = ContactStore.find(params[:id])\n end",
"def show\n @customer = Customer.find(params[:customer_id])\n @cust_contact = @customer.cust_contacts.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @cust_contact }\n end\n end",
"def index\n @store = Store.find(params[:store_id])\n @dish_discounts = @store.dish_discounts\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @dish_discounts }\n end\n end",
"def show\n\t@store = current_account.stores.find(params[:id])\n end",
"def show\n respond_to do |format|\n format.html\n format.json { render :json => @client_contact_hash }\n format.xml { render :xml => @client_contact_hash }\n end\n end",
"def index\n @customers_addresses = CustomersAddress.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @customers_addresses }\n end\n end",
"def index\n @stores = @stores.page(params[:page]).per(10)\n end",
"def index\n @contactable = find_contactable\n @contactos = @contactable.contactos\n\n respond_to do |format|\n format.html # index.html.erb\n #format.json { render json: @contactos }\n end\n end",
"def index\n @store = Store.find(params[:store_id])\n @menus = @store.menus\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @menus }\n end\n end",
"def show\n @datastore = Datastore.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @datastore }\n end\n end",
"def new\n @store = Store.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @store }\n end\n end",
"def new\n @store = Store.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @store }\n end\n end",
"def new\n @store = Store.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @store }\n end\n end",
"def new\n @store = Store.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @store }\n end\n end",
"def new\n @store = Store.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @store }\n end\n end",
"def show\n @online_store = OnlineStore.find(params[:id])\n @products = @online_store.products\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @online_store }\n end\n end",
"def show\n @store = Store.find(params[:id])\n prepFormVariables\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @store }\n end\n end",
"def new\n\t\t\t\t @store = Store.new\n\n\t\t\t\t respond_to do |format|\n\t\t\t\t format.html # new.html.erb\n\t\t\t\t format.json { render json: @store }\n\t\t\t\t end\n\t\t\t\t end",
"def show\n respond_to do |format|\n format.html\n format.json { render :json => @client_contact_sync_hash }\n format.xml { render :xml => @client_contact_sync_hash }\n end\n end",
"def customers\n ShopifyAPI::Customer.all\n end",
"def index\n @service_locations = ServiceLocation.all\n render json: @service_locations\n end",
"def show\n render json: @referral_contact\n end",
"def index\n\t\tbegin\n\t\t\tif params[:lat].present? && params[:lng].present?\n\t\t\t\t@address = Geokit::Geocoders::GoogleGeocoder.reverse_geocode \"#{params[:lat]},#{params[:lng]}\"\n\t\t\t\tparams[:postal_code] = @address.try(:zip) if @address.success\n\t\t\tend\n\t\t\t@search = Store.search do\n\t\t\t\tfulltext(params[:postal_code]) do\n\t\t\t\t\tfields(:postal_code)\n\t\t\t\tend\n\t\t\tend\n\t\t\tif @address.present?\n\t\t\t\t@stores = @search.results.sort_by{|s| s.distance_to([@address.lat,@address.lng])}\n\t\t\telse\n\t\t\t\t@stores = @search.results\n\t\t\tend\n\t\t\t\t@postal_code = params[:postal_code]\n\t\t\t\t@stores =\t@stores.first(5) if params[:type] == \"collection\"\n\t\t\trender :index, status: :ok\n\t\trescue Exception => e\n\t\t\terror_handling_bad_request(e)\n\t\tend\n\tend",
"def index\n\t\t@stores = Store.all\n\tend",
"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 new\n @invoice = Invoice.new\n @stores = Store.all\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @invoice }\n end\n end",
"def show\n @store2product = Store2product.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @store2product }\n end\n end",
"def index\n @shop_sections = ShopSection.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @shop_sections }\n end\n end",
"def list_stores\n @stores = Store.where(\"level = ?\", 2)\n if @stores.present?\n render :index, status: :ok\n else\n @message = \"no store found\"\n render :error, status: :not_found\n end\n end",
"def show\n @contact = Contact.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @contact }\n end\n end",
"def show\n @contact = Contact.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @contact }\n end\n end",
"def show\n @contact = Contact.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @contact }\n end\n end",
"def index\n @sales = Sale.all\n\n render json: @sales\n end",
"def index\n \tcustomers = Customer.all\n \trender json: customers\n \tend",
"def show\n @store = Store.find(params[:store_id])\n @menu = @store.menus.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @menu }\n end\n end",
"def show\n render json: @service\n end",
"def show\n #@contact = Contact.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @contact }\n end\n end",
"def new\n @store = Store.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @store }\n end\n end",
"def create\n @store = Store.new(store_params)\n\n @store.api_path = @store.name unless @store.api_path.present?\n\n # make sure the store can connect to shopify\n # will return 4xx code if shopify login is bad\n # 401 is bad api secret\n # 403 is bad api key\n # 404 implies bad store name\n\n # validate the return code\n adapter = @store.get_adapter\n return_data = adapter.validate_store(@store)\n if return_data[:return_code] != 200\n render json: return_data, :status => return_data[:return_code] and return\n end\n\n current_user.stores << @store\n\n if @store.save\n render json: @store, status: :created\n else\n render json: @store.errors, status: :unprocessable_entity\n end\n end",
"def show\n render json: @company\n end",
"def lookup\n respond_to do |format|\n format.json { render json: Crm::ContactLookup.new(view_context) }\n end\n end",
"def index\n @companies = Company.all\n @com_info = Company.last\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @companies }\n end\n end",
"def index\n contacteds = @business.contacteds\n \n render json: contacteds\n end",
"def index\n @library_contacts = @library_location.library_contacts.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @library_contacts }\n end\n end",
"def index\n @contacts = @client.contacts\n end",
"def show\n @library_contact = @library_location.library_contacts.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @library_contact }\n end\n end",
"def show\n @crm_contact_info = CrmContactInfo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @crm_contact_info }\n end\n end",
"def index\n @shop_platinum_offers = Shop::PlatinumOffer.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @shop_platinum_offers }\n end\n end",
"def new\n @admin_store = Admin::Store.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @admin_store }\n end\n end",
"def index\n if params[:merchant_id].present?\n @point_of_contacts = @point_of_contacts.where(:merchant_id => params[:merchant_id])\n end\n\n render json: @point_of_contacts, callback: params[:callback]\n end",
"def show\n render json: Company.find(params[\"id\"])\n end",
"def show\n @customer = Customer.find(params[:customer_id])\n @contact = @customer.contacts.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render \"show.html.erb\", :layout => false }\n end\n end",
"def show\n render json: @contact_group\n end",
"def show\n @contact_request = ContactRequest.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @contact_request }\n end\n end",
"def show\n @customers_address = CustomersAddress.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @customers_address }\n end\n end",
"def show\n @corp_location = CorpLocation.get(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @corp_location }\n end\n end",
"def index\n render json: Seller.all\n end",
"def index\n @store = Store.find(params[:store_id])\n @dish_choices = @store.dish_choices\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @dish_choices }\n end\n end",
"def show\n render json: @sale\n end"
] |
[
"0.7137191",
"0.692844",
"0.68865675",
"0.65734345",
"0.6569214",
"0.6569214",
"0.6569214",
"0.6569214",
"0.65103877",
"0.6505333",
"0.6484428",
"0.6450121",
"0.6430919",
"0.6428235",
"0.6423595",
"0.6364399",
"0.6364399",
"0.633674",
"0.63311",
"0.632712",
"0.6327116",
"0.63130563",
"0.6307738",
"0.6286506",
"0.6265519",
"0.6262526",
"0.6246703",
"0.62211645",
"0.6190772",
"0.61811495",
"0.61731136",
"0.61608356",
"0.61580306",
"0.6106461",
"0.6105595",
"0.607875",
"0.607875",
"0.607875",
"0.607875",
"0.607875",
"0.6063674",
"0.60635006",
"0.6055813",
"0.60413456",
"0.6040056",
"0.6027234",
"0.6005806",
"0.59890246",
"0.5980384",
"0.5980107",
"0.59725994",
"0.5970924",
"0.59671474",
"0.59671474",
"0.59671474",
"0.59671474",
"0.59671474",
"0.59577966",
"0.5957353",
"0.5936426",
"0.59178746",
"0.5914397",
"0.59112394",
"0.5905566",
"0.59038067",
"0.5902404",
"0.5891019",
"0.58831984",
"0.58655924",
"0.5848186",
"0.58382565",
"0.5834937",
"0.5834937",
"0.5834937",
"0.5832535",
"0.5828385",
"0.58221275",
"0.5818515",
"0.5813552",
"0.5806362",
"0.58044076",
"0.5802",
"0.5793588",
"0.57930535",
"0.57928616",
"0.5791844",
"0.57825154",
"0.5779208",
"0.57765406",
"0.57743347",
"0.5766078",
"0.57617843",
"0.57608944",
"0.5757489",
"0.57495177",
"0.57383555",
"0.5734786",
"0.5734516",
"0.5732401",
"0.57310575",
"0.5727948"
] |
0.0
|
-1
|
POST /contact_stores POST /contact_stores.json
|
def create
@contact_store = ContactStore.new(contact_store_params)
respond_to do |format|
if @contact_store.save
format.html { redirect_to @contact_store, notice: 'Contact store was successfully created.' }
format.json { render :show, status: :created, location: @contact_store }
else
format.html { render :new }
format.json { render json: @contact_store.errors, status: :unprocessable_entity }
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def create\n @cakestore = Cakestore.new(cakestore_params)\n\n respond_to do |format|\n if @cakestore.save\n format.html { redirect_to @cakestore, notice: 'Cakestore was successfully created.' }\n format.json { render :show, status: :created, location: @cakestore }\n else\n format.html { render :new }\n format.json { render json: @cakestore.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @store = Store.new(store_params)\n\n respond_to do |format|\n if @store.save\n format.html { redirect_to [:phone, @store], notice: 'Store was successfully created.' }\n format.json { render action: 'show', status: :created, location: @store }\n else\n format.html { render action: 'new' }\n format.json { render json: @store.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @store = Store.new(params.require(:store).permit(:break_even, :capacity, :city, :county_id, :manager_id,\n :name, :number, :number_of_lifts, :phone, :region_id,\n :state_id, :street_address, :zip))\n\n respond_to do |format|\n if @store.save\n format.html { redirect_to stores_url,\n notice: 'Store was successfully created.' }\n format.json { render json: @store, status: :created, location: @store }\n else\n prepFormVariables\n format.html { render action: \"new\" }\n format.json { render json: @store.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @store = Store.new(store_params)\n\n respond_to do |format|\n if @store.save\n format.html { redirect_to admin_partners_stores_url, notice: 'Store was successfully created.' }\n format.json { render action: 'show', status: :created, location: @store }\n else\n format.html { render action: 'new' }\n format.json { render json: @store.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @store = Store.new(params[:store])\n\n respond_to do |format|\n if @store.save\n format.html { redirect_to @store, :notice => 'Store was successfully created.' }\n format.json { render :json => @store, :status => :created, :location => @store }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @store.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @store = Store.new(params[:store])\n \n respond_to do |format|\n if @store.save\n format.html { redirect_to @store, notice: 'Store was successfully created.' }\n format.json { render json: @store, status: :created, location: @store }\n else\n format.html { render action: \"new\" }\n format.json { render json: @store.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @store = Store.new(store_params)\n\n respond_to do |format|\n if @store.save\n format.html { redirect_to @store, notice: 'Store was successfully created.' }\n format.json { render :show, status: :created, location: @store }\n else\n format.html { render :new }\n format.json { render json: @store.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @store = Store.new(store_params)\n\n respond_to do |format|\n if @store.save\n format.html { redirect_to @store, notice: 'Store was successfully created.' }\n format.json { render :show, status: :created, location: @store }\n else\n format.html { render :new }\n format.json { render json: @store.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @store = Store.new(params[:store])\n\n respond_to do |format|\n if @store.save\n format.html { redirect_to @store, notice: 'Store was successfully created.' }\n format.json { render json: @store, status: :created, location: @store }\n else\n format.html { render action: \"new\" }\n format.json { render json: @store.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @store = Store.new(store_params)\n\n respond_to do |format|\n if @store.save\n format.html { redirect_to account_stores_path(account_id: current_account.id), notice: 'Store was successfully created.' }\n format.json { render action: 'show', status: :created, location: @store }\n else\n format.html { render action: 'new' }\n format.json { render json: @store.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @store = Store.new(params[:store])\n\n respond_to do |format|\n if @store.save\n format.html { redirect_to '/stores/admin', notice: 'Store was successfully created.' }\n format.json { render json: @store, status: :created, location: @store }\n else\n format.html { render action: \"new\" }\n format.json { render json: @store.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @store = Store.new(store_params)\n\n respond_to do |format|\n if @store.save\n format.html { redirect_to @store, notice: 'Store was successfully created.' }\n format.json { render action: 'show', status: :created, location: @store }\n else\n format.html { render action: 'new' }\n format.json { render json: @store.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @store = Store.new(store_params)\n\n respond_to do |format|\n if @store.save\n format.html { redirect_to @store, notice: \"Loja cadastrada com sucesso!\" }\n format.json { render :show, status: :created, location: @store }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @store.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @store = Store.new(store_params)\n\n @store.api_path = @store.name unless @store.api_path.present?\n\n # make sure the store can connect to shopify\n # will return 4xx code if shopify login is bad\n # 401 is bad api secret\n # 403 is bad api key\n # 404 implies bad store name\n\n # validate the return code\n adapter = @store.get_adapter\n return_data = adapter.validate_store(@store)\n if return_data[:return_code] != 200\n render json: return_data, :status => return_data[:return_code] and return\n end\n\n current_user.stores << @store\n\n if @store.save\n render json: @store, status: :created\n else\n render json: @store.errors, status: :unprocessable_entity\n end\n end",
"def create\n\t\t\t\t @store = Store.new(params[:store])\n\n\t\t\t\t respond_to do |format|\n\t\t\t\t if @store.save\n\t\t\t\t\tformat.html { redirect_to @store, notice: 'Store was successfully created.' }\n\t\t\t\t\tformat.json { render json: @store, status: :created, location: @store }\n\t\t\t\t else\n\t\t\t\t\tformat.html { render action: \"new\" }\n\t\t\t\t\tformat.json { render json: @store.errors, status: :unprocessable_entity }\n\t\t\t\t end\n\t\t\t\t end\n\t\t\t\t end",
"def create\n @store = Store.new(params[:store])\n\n respond_to do |format|\n if @store.save\n format.html { redirect_to \"/admin/stores/\"+@store.id.to_s(), notice: 'Store was successfully created.' }\n format.json { render json: @store, status: :created, location: @store }\n else\n format.html { render action: \"new\" }\n format.json { render json: @store.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @contact = Contact.create!(contact_params)\n render json: Contact.all\n end",
"def create\n @store = Store.new(store_params)\n\n respond_to do |format|\n if @store.save\n format.html { redirect_to @store, notice: 'Store was successfully created.' }\n params[:books].each{\n |id|\n StoreBook.create(:store_id=>@store.id,:book_id=>id)\n }\n format.json { render :show, status: :created, location: @store }\n else\n format.html { render :new }\n format.json { render json: @store.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_contact\n @contact = Spree::Address.new(contact_params)\n # Currently for demo, I will leave the country id to be 1, later update will be noticed!\n hard_code_contact(contact_params)\n respond_to do |format|\n if @contact.save\n @seller.spree_addresses << @contact\n format.html { redirect_to contacts_admin_seller_path, notice: \"Contacts #{@contact.firstname} #{@contact.lastname} is successfully created!\" }\n else\n flash[:error] = @contact.errors.full_messages\n format.html { render :new_contact }\n format.json { render :new_contact, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @store_add = StoreAdd.new(store_add_params)\n\n respond_to do |format|\n if @store_add.save\n format.html { redirect_to @store_add, notice: 'Store add was successfully created.' }\n format.json { render :show, status: :created, location: @store_add }\n else\n format.html { render :new }\n format.json { render json: @store_add.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create(add_params = nil)\n params = {\n }\n api_call('/stores(.:format)',:post,params,add_params)\n end",
"def create\n @product = Product.new(product_params)\n\n if params[:product][:store_ids].present?\n params[:product][:store_ids].each do |store_id|\n unless store_id.empty?\n store = Store.find(store_id)\n @product.stores << store\n end\n end\n end\n\n respond_to do |format|\n if @product.save\n format.html { redirect_to @product, notice: \"Product was successfully created.\" }\n format.json { render :show, status: :created, location: @product }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @contact_stores = ContactStore.all\n end",
"def create\n @admin_store = current_user.stores.build(admin_store_params)\n respond_to do |format|\n if @admin_store.save\n format.html { redirect_to admin_store_path(@admin_store), notice: 'Store was successfully created.' }\n format.json { render :show, status: :created, location: @admin_store }\n else\n format.html { render :new }\n format.json { render json: @admin_store.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @store = Store.new(params[:store])\n @mapped_address = Address.find_by_id(params[:address_id])\n \n # if address is not found (nil), nothing was selected by the selectbox\n if @mapped_address.nil? \n # check if user want to assign the store with a new address\n if params[:street] != \"\"\n if params[:zipcode] != \"\"\n if params[:city] != \"\"\n @new_address = Address.new(:city => params[:city], :street => params[:street], :zipcode => params[:zipcode])\n @new_address.save\n @store.addresses << @new_address\n end\n end\n end\n else\n # can assign the selected address to store\n @store.addresses << @mapped_address\n end\n\n respond_to do |format|\n if @store.save\n format.html { redirect_to stores_path, notice: 'Store was successfully created.' }\n format.json { render json: @store, status: :created, location: @store }\n else\n format.html { render action: \"new\" }\n format.json { render json: @store.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @admin_store = Admin::Store.new(params[:admin_store])\n\n respond_to do |format|\n if @admin_store.save\n format.html { redirect_to @admin_store, notice: 'Store was successfully created.' }\n format.json { render json: @admin_store, status: :created, location: @admin_store }\n else\n format.html { render action: \"new\" }\n format.json { render json: @admin_store.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @store = Store.new(store_params)\n @store.user = current_user\n respond_to do |format|\n if @store.save\n format.html { redirect_to @store, notice: 'Store was successfully created.' }\n format.json { render :show, status: :created, location: @store }\n else\n format.html { render :new }\n format.json { render json: @store.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @store = current_owner.stores.build(store_params)\n @store.owner = current_owner\n\n # @store = Store.find(params[:id])\n @comment = @store.comments.build\n #tenemos que mostrar todos los comentarios del post y pasarlos a la vista\n @comments = @store.comments.includes(:user).all.reverse #muestra el arreglo de todos los comentarios\n\n\n respond_to do |format|\n if @store.save\n format.html { redirect_to @store}\n format.json { render :show, status: :created, store: @store }\n else\n format.html { render :new }\n format.json { render json: @store.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @store = Store.new(params[:store])\n @store.user_id = @user.id\n @store.categories = Category.find(params[:category_ids]) if params[:category_ids]\n respond_to do |format|\n if @store.save\n format.html { redirect_to(@store, :notice => 'Store was successfully created.') }\n format.xml { render :xml => @store, :status => :created, :location => @store }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @store.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @store = Store.new(params[:store])\n\n respond_to do |format|\n if @store.save\n format.html { redirect_to(@store, :notice => 'Store was successfully created.') }\n format.xml { render :xml => @store, :status => :created, :location => @store }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @store.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @contact = Contact.new(contact_params)\n\n if @contact.save\n render json: @contact, status: :created, location: @contact\n else\n render json: @contact.errors, status: :unprocessable_entity\n end\n end",
"def set_contact_store\n @contact_store = ContactStore.find(params[:id])\n end",
"def create\n if @point_of_contact.save\n render json: @point_of_contact, status: :created, location: @point_of_contact\n else\n render json: @point_of_contact.errors, status: :unprocessable_entity\n end\n end",
"def create\n @book_store = BookStore.new(book_store_params)\n\n respond_to do |format|\n if @book_store.save\n format.html { redirect_to @book_store, notice: 'Book store was successfully created.' }\n format.json { render :show, status: :created, location: @book_store }\n else\n format.html { render :new }\n format.json { render json: @book_store.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @customer = Customer.find(params[:customer_id])\n @cust_contact = @customer.cust_contacts.new(params[:cust_contact])\n\n respond_to do |format|\n if @cust_contact.save\n format.html { redirect_to @cust_contact.customer, :notice => 'Contact was successfully created.' }\n format.json { render :json => @cust_contact, :status => :created, :location => @cust_contact }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @cust_contact.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @store_to_visit = StoreToVisit.new(store_to_visit_params)\n\n respond_to do |format|\n if @store_to_visit.save\n format.html { redirect_to root_path, notice: 'Store to visit was successfully created.' }\n format.json { render :show, status: :created, location: @store_to_visit }\n else\n format.html { render :new }\n format.json { render json: @store_to_visit.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @mstore = Mstore.new(mstore_params)\n\n respond_to do |format|\n if @mstore.save\n format.html { redirect_to @mstore, notice: 'Mstore was successfully created.' }\n format.json { render :show, status: :created, location: @mstore }\n else\n format.html { render :new }\n format.json { render json: @mstore.errors, status: :unprocessable_entity }\n end\n end\n end",
"def store_params\n params.require(:store).permit(:code, :catalog, :name, :district, :city, :province, :country, :latitude, :longitude, :addr, :linkman, :contact_num)\n end",
"def contact_store_params\n params.require(:contact_store).permit(:name, :email, :tel, :message, :date_time, :nickname, :utf8, :authenticity_token, :commit)\n \n end",
"def create\n @electronics_store = ElectronicsStore.new(electronics_store_params)\n\n respond_to do |format|\n if @electronics_store.save\n format.html { redirect_to @electronics_store, notice: 'Electronics store was successfully created.' }\n format.json { render :show, status: :created, location: @electronics_store }\n else\n format.html { render :new }\n format.json { render json: @electronics_store.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @store = Store.new(store_params)\n @store.commerce = @commerce\n @seller = Seller.new\n respond_to do |format|\n if @store.save\n @seller.store=@store\n @seller.commerce = @commerce\n @seller.user_id=current_user.id\n @seller.slug=current_user.cedula\n puts \"DATOS DE VENDEDOR *******\"\n puts @seller.to_json\n @seller.save\n format.html { redirect_to owner_commerce_stores_path(@store.commerce.slug), notice: 'Tienda creada exitosamente.' }\n format.json { render :show, status: :created, location: @store }\n else\n format.html { render :new }\n format.json { render json: @store.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @promo = Promo.new(params[:promo])\n brand = @promo.brand\n @promo.stores = brand.stores\n respond_to do |format|\n if @promo.save\n format.html { redirect_to @promo, notice: 'Promo was successfully created.' }\n format.json { render json: @promo, status: :created, location: @promo }\n else\n format.html { render action: \"new\" }\n format.json { render json: @promo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @men_shop_collection = MenShopCollection.new(men_shop_collection_params)\n\n respond_to do |format|\n if @men_shop_collection.save\n format.html { redirect_to @men_shop_collection, notice: 'Men shop collection was successfully created.' }\n format.json { render :show, status: :created, location: @men_shop_collection }\n else\n format.html { render :new }\n format.json { render json: @men_shop_collection.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_store_with_http_info(request, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: StoresApi.create_store ...\"\n end\n # verify the required parameter 'request' is set\n fail ArgumentError, \"Missing the required parameter 'request' when calling StoresApi.create_store\" if request.nil?\n # resource path\n local_var_path = \"/v2/user/customer/stores\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(request)\n auth_names = ['api_key']\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 => 'LinksGetStoresLink')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: StoresApi#create_store\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def create\n begin\n @api_v1_store = Store.create!(api_v1_store_params)\n\n json_response @api_v1_store, :created\n rescue => ex\n json_response({error: ex.message}, :unprocessable_entity)\n end\n end",
"def create\n @store = Store.new(store_params)\n @store.city = City.find(params.fetch(:city_id).to_i)\n\n if @store.save\n render :show, status: :created\n else\n @message = @store.errors\n render :error, status: :unprocessable_entity\n end\n end",
"def create\n @store_section = StoreSection.new(params[:store_section])\n\n respond_to do |format|\n if @store_section.save\n format.html { redirect_to @store_section, notice: 'Store section was successfully created.' }\n format.json { render json: @store_section, status: :created, location: @store_section }\n else\n format.html { render action: \"new\" }\n format.json { render json: @store_section.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @itemstore = ItemStore.new(item_store_params)\n\n respond_to do |format|\n if @itemstore.save\n format.html { redirect_to @itemstore, notice: 'Item was successfully created.' }\n format.json { render :show, status: :created, location: @itemstore }\n else\n format.html { render :new }\n format.json { render json: @itemstore.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @store = Store.new\n @cities = City.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @store }\n end\n end",
"def create\n @store_order = StoreOrder.new(store_order_params)\n\n respond_to do |format|\n if @store_order.save\n format.html { redirect_to @store_order, notice: 'Store order was successfully created.' }\n format.json { render :show, status: :created, location: @store_order }\n else\n format.html { render :new }\n format.json { render json: @store_order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @site_contact = SiteContact.new(params[:site_contact])\n\n respond_to do |format|\n if @site_contact.save\n format.html { redirect_to @site_contact, notice: 'Site contact was successfully created.' }\n format.json { render json: @site_contact, status: :created, location: @site_contact }\n else\n format.html { render action: \"new\" }\n format.json { render json: @site_contact.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @article = Article.new(params[:article])\n if !params[:stores].nil?\n # prevent assignment of empty element to stores reference\n params[:stores].delete_if { |x| x == \"\"}\n end\n \n if @article.price.nil?\n # user don't know the price of the article yet\n @article.price = 0\n end\n \n respond_to do |format|\n if @article.save\n if !params[:stores].nil?\n @stores = Store.find(params[:stores])\n @stores.each { |s|\n @article.stores << s\n }\n end\n \n format.html { redirect_to articles_path, notice: 'Article was successfully created.' }\n format.json { render json: @article, status: :created, location: @article }\n else\n format.html { render action: \"new\" }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end",
"def store_params\n params.permit(:store_uid, :city_id, :name, :level, :phone, :address, :store_building, :email, :store_category, :store_owner)\n store_data = {\n city_id: params.fetch(:city_id, nil).to_i,\n store_uid: params.fetch(:store_uid, nil).to_s,\n name: params.fetch(:name, nil).to_s,\n level: params.fetch(:level, 0).to_i,\n phone: params.fetch(:phone, nil).to_s,\n address: params.fetch(:address, nil).to_s,\n email: params.fetch(:email, nil).to_s,\n store_building: params.fetch(:store_building, nil).to_s,\n store_category: params.fetch(:store_category, nil).to_i,\n store_owner: params.fetch(:store_owner, nil).to_s,\n }\n end",
"def index\n @stores = Store.all\n prepFormVariables\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @stores }\n end\n end",
"def create\n\n\t\tlocations = params[:contact][:locations] ? params[:contact][:locations].join(\", \"): \"\"\n\t\tnew_contact = contact_params\n\t\tnew_contact[:locations] = locations\n\t\t@contact = Contact.new(new_contact)\t\t\n\t\t\n\n ContactMailer.contact_email(@contact).deliver\n redirect_to contact_path, notice: 'Sent successfully'\n end",
"def create\n @sales_address = Sales::Address.new(sales_address_params)\n\n respond_to do |format|\n if @sales_address.save\n format.html { redirect_to sales_seller_address_path(@sales_seller, @sales_address), notice: \"Endereço adicionado com sucesso!\" }\n format.json { render :show, status: :created, location: @sales_address }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @sales_address.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @store_manager = StoreManager.new(store_manager_params)\n\n respond_to do |format|\n if @store_manager.save\n format.html { redirect_to @store_manager, notice: 'Store manager was successfully created.' }\n format.json { render :show, status: :created, location: @store_manager }\n else\n format.html { render :new }\n format.json { render json: @store_manager.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @store = Store.new(params[:admin_store])\n\n respond_to do |format|\n if @store.save\n format.html { redirect_to([:admin,@store], :notice => 'Store was successfully created.') }\n format.xml { render :xml => @store, :status => :created, :location => @store }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @store.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def store_params\n params.require(:store).permit(:name, :address, :email, :phone)\n end",
"def create\n @customers_address = CustomersAddress.new(params[:customers_address])\n\n respond_to do |format|\n if @customers_address.save\n format.html { redirect_to @customers_address, notice: 'Customers address was successfully created.' }\n format.json { render json: @customers_address, status: :created, location: @customers_address }\n else\n format.html { render action: \"new\" }\n format.json { render json: @customers_address.errors, status: :unprocessable_entity }\n end\n end\n end",
"def api_v1_store_params\n params.permit(:name, :address, :email, :phone)\n end",
"def create\n @contact = @business.contacts.new(contact_params)\n\n respond_to do |format|\n if @contact.save\n format.html { redirect_to business_contact_path(@business, @contact), notice: 'Contact was successfully created.' }\n format.json { render json: @contact, status: :created, location: business_contact_path(@business,@contact) }\n else\n format.html { render action: \"new\" }\n format.json { render json: @contact.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @contact = @current_user.contacts.new(contact_params)\n if @contact.save\n render json: {status: 201, contact: @contact}\n else\n render json: {status: 400}\n end\n end",
"def store_params\n params.require(:store).permit(:name, :address)\n end",
"def store_params\n params.require(:store).permit(:name, :street, :neighborhood, :city, :cep)\n end",
"def update\n respond_to do |format|\n if @contact_store.update(contact_store_params)\n format.html { redirect_to @contact_store, notice: 'Contact store was successfully updated.' }\n format.json { render :show, status: :ok, location: @contact_store }\n else\n format.html { render :edit }\n format.json { render json: @contact_store.errors, status: :unprocessable_entity }\n end\n end\n end",
"def store_params\n params.require(:store).permit(:name, :street, :city, :state, :zip, :phone, :active)\n end",
"def create\n @datastore = Datastore.new(params[:datastore])\n\n respond_to do |format|\n if @datastore.save\n format.html { redirect_to @datastore, notice: 'Datastore was successfully created.' }\n format.json { render json: @datastore, status: :created, location: @datastore }\n else\n format.html { render action: \"new\" }\n format.json { render json: @datastore.errors, status: :unprocessable_entity }\n end\n end\n end",
"def store_params\n params.require(:store).permit(:title, :address, :phone, :latitude, :longtitude)\n end",
"def create\n @addresstype = Addresstype.new(params[:addresstype])\n\n respond_to do |format|\n if @addresstype.save\n format.html { redirect_to @addresstype, notice: 'Addresstype was successfully created.' }\n format.json { render json: @addresstype, status: :created, location: @addresstype }\n else\n format.html { render action: \"new\" }\n format.json { render json: @addresstype.errors, status: :unprocessable_entity }\n end\n end\n end",
"def store_params\n params.require(:store).permit(:name, :contact_name, :contact_no, :address, :pin, :review, :rating, :active, :new_product_map => ['product_id', 'price'], :delete_product_map => ['product_id'])\n end",
"def create\n render json: Company.create(params[\"company\"])\n end",
"def create\n @store_book = StoreBook.new(store_book_params)\n\n respond_to do |format|\n if @store_book.save\n format.html { redirect_to @store_book, notice: 'Store book was successfully created.' }\n format.json { render :show, status: :created, location: @store_book }\n else\n format.html { render :new }\n format.json { render json: @store_book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def post_contact\n\t\tcontact = Contact.new\n\t\tcontact.first_name = params[:first_name]\n\t\tcontact.last_name = params[:last_name]\n\t\tcontact.phone_number = params[:phone_number]\n\t\tcontact.email = params[:email]\n\t\tcontact.save\n\t\tcurrent_agendify_user.contacts.push(contact)\n\t\tcurrent_agendify_user.save\n\t\tredirect_to root_path\n\tend",
"def destroy\n @contact_store.destroy\n respond_to do |format|\n format.html { redirect_to contact_stores_url, notice: 'Contact store was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def create\n collection = Collection.create(collection_params)\n\n render json: collection\n end",
"def create\n @customer_contact = CustomerContact.new(customer_contact_params)\n\n respond_to do |format|\n if @customer_contact.save\n format.html { redirect_to @customer_contact, notice: 'Customer contact was successfully created.' }\n format.json { render :show, status: :created, location: @customer_contact }\n else\n format.html { render :new }\n format.json { render json: @customer_contact.errors, status: :unprocessable_entity }\n end\n end\n end",
"def store_params\n params.require(:store).permit(:name, :address, :intro, :phone, :address, :country, :city, :district, :ophour, :latlng, :location_list , :service_list )\n end",
"def create\n @sale = Sale.new(sale_params)\n\n if @sale.save\n render json: @sale, status: :created, location: @sale\n else\n render json: @sale.errors, status: :unprocessable_entity\n end\n end",
"def store_params\n params.require(:store).permit(:name, :street, :city, :phone, :state, :zip, :active)\n end",
"def create\n @contact = Contact.new(contact_params)\n\n if @contact.save\n fresh_when(@contact)\n render json: @contact, status: :created, location: @contact\n else\n render json: { errors: @contact.errors.messages }, status: :unprocessable_entity\n end\n end",
"def createWithStaff\n created_location = Company.create(params[\"company\"])\n if params[\"id\"]\n updated_person = Person.setCompany(params[\"id\"], created_location)\n end\n render json: created_location\n end",
"def create\n @shop = Shop.new(shop_params)\n\n if @shop.save\n render :show, status: :created, location: @shop\n else\n render json: @shop.errors, status: :unprocessable_entity\n end\n end",
"def create\n @customer = Customer.find(params[:customer_id])\n @contact = @customer.contacts.build(params[:contact])\n\n respond_to do |format|\n if @contact.save\n format.html { redirect_to([@contact.customer, @contact], :notice => 'Contact was successfully created.') }\n format.json { render :json => @contact, :status => :created, :location => [@contact.customer, @contact] }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @contact.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @shop_customer = ShopCustomer.new(shop_customer_params)\n\n respond_to do |format|\n if @shop_customer.save\n format.html { redirect_to @shop_customer, notice: 'Shop customer was successfully created.' }\n format.json { render action: 'show', status: :created, location: @shop_customer }\n else\n format.html { render action: 'new' }\n format.json { render json: @shop_customer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @address_customer = AddressCustomer.new(params[:address_customer])\n\n respond_to do |format|\n if @address_customer.save\n format.html { redirect_to @address_customer, notice: 'Address customer was successfully created.' }\n format.json { render json: @address_customer, status: :created, location: @address_customer }\n else\n format.html { render action: \"new\" }\n format.json { render json: @address_customer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @contact = current_user.contacts.new(name:params[:name], email:params[:email])\n @contact = current_user.contacts.new(params[:contact])\n @server_id = params[:server_id].to_i\n @contact.save\n end",
"def create\n @entity_contact = EntityContact.new(params[:entity_contact])\n\n respond_to do |format|\n if @entity_contact.save\n format.html { redirect_to @entity_contact, notice: 'Entity contact was successfully created.' }\n format.json { render json: @entity_contact, status: :created, location: @entity_contact }\n else\n format.html { render action: \"new\" }\n format.json { render json: @entity_contact.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @contact = Contact.new(contact_params)\n\n respond_to do |format|\n\n if @contact.save\n\n format.html { redirect_to abouts_path, notice: 'Test was successfully created.' }\n format.json { render :show, status: :created, location: @about }\n\n end\nend\n end",
"def create\n contact = Contact.create(contact_params)\n\n if contact.new_record?\n render json: { errors: contact.errors.messages }, status: 422\n else\n render json: contact, status: 201\n end\n end",
"def create\n @contact = Contact.new(contact_params)\n respond_to do |format|\n if @contact.save\n format.html { redirect_to @contact, notice: 'Kontakten skapades, success.' }\n format.json { render action: 'show', status: :created, location: @contact }\n else\n format.html { render action: 'new' }\n format.json { render json: @contact.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create(payload)\n client.post(make_path('/customers'), payload)\n end",
"def create\n @employee_contact = EmployeeContact.new(employee_contact_params)\n\n respond_to do |format|\n if @employee_contact.save\n format.html { redirect_to @employee_contact, notice: 'Employee contact was successfully created.' }\n format.json { render :show, status: :created, location: @employee_contact }\n else\n format.html { render :new }\n format.json { render json: @employee_contact.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @store_transaction = StoreTransaction.new(store_transaction_params)\n\n respond_to do |format|\n if @store_transaction.save\n format.html { redirect_to @store_transaction, notice: 'Store transaction was successfully created.' }\n format.json { render :show, status: :created, location: @store_transaction }\n else\n format.html { render :new }\n format.json { render json: @store_transaction.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @storepromotion = Storepromotion.new(storepromotion_params)\n\n respond_to do |format|\n if @storepromotion.save\n format.html { redirect_to @storepromotion, notice: 'Storepromotion was successfully created.' }\n format.json { render :show, status: :created, location: @storepromotion }\n else\n format.html { render :new }\n format.json { render json: @storepromotion.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @data_source = DataSource.find(params[:data_source_id])\n\n @data_store = @data_source.data_stores.create(params[:data_store])\n\n redirect_to data_source_path(@data_source)\n end",
"def create\n @store_type = StoreType.new(params[:store_type])\n\n respond_to do |format|\n if @store_type.save\n flash[:notice] = 'Store Type was successfully created.'\n format.html { redirect_to(store_types_path) }\n format.xml { render :xml => @store_type, :status => :created, :location => @store_type }\n else\n @store_types = StoreType.active\n format.html { render :action => \"index\" }\n format.xml { render :xml => @store_type.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def index\n @stores = Store.all\n render json: @stores\n end",
"def new\n\t\t\t\t @store = Store.new\n\n\t\t\t\t respond_to do |format|\n\t\t\t\t format.html # new.html.erb\n\t\t\t\t format.json { render json: @store }\n\t\t\t\t end\n\t\t\t\t end",
"def create\n \n @contact = @customer.contacts.build(params[:contact])\n\n respond_to do |format|\n if @contact.save\n flash[:notice] = _('Contact was successfully created.')\n format.html { redirect_to(customer_contact_url(:customer_id => @customer.id, :id => @contact.id)) }\n format.js { render :text => \"contact added\", :layout => false }\n format.xml { render :xml => @contact, :status => :created, :location => @contact }\n else\n format.html { render :action => \"new\", :layout => request.xhr? }\n format.xml { render :xml => @contact.errors, :status => :unprocessable_entity }\n end\n end\n\n end"
] |
[
"0.6434339",
"0.6414449",
"0.636926",
"0.6366385",
"0.6327758",
"0.6300838",
"0.6299978",
"0.6299978",
"0.6260686",
"0.6242875",
"0.6241692",
"0.6225512",
"0.62102145",
"0.62017196",
"0.617447",
"0.61275536",
"0.610702",
"0.6085593",
"0.6042473",
"0.60225576",
"0.60078377",
"0.6004003",
"0.6000158",
"0.59812874",
"0.5980028",
"0.597937",
"0.5913022",
"0.5860124",
"0.58451355",
"0.5840294",
"0.583458",
"0.58273077",
"0.58165294",
"0.57998383",
"0.5786873",
"0.57841295",
"0.5770573",
"0.5756949",
"0.5749143",
"0.5732985",
"0.56998336",
"0.5699588",
"0.5699094",
"0.56819993",
"0.56645834",
"0.56001115",
"0.5599726",
"0.5590857",
"0.5587713",
"0.55692",
"0.55665416",
"0.55663145",
"0.5549466",
"0.5548018",
"0.55343026",
"0.5532832",
"0.55295193",
"0.55212146",
"0.55057096",
"0.5502971",
"0.549831",
"0.54933995",
"0.5489748",
"0.547683",
"0.5472259",
"0.5468853",
"0.546162",
"0.5460087",
"0.5459727",
"0.5456249",
"0.54488623",
"0.5447514",
"0.54458636",
"0.54368556",
"0.5435269",
"0.5431819",
"0.54132044",
"0.5411142",
"0.5403412",
"0.5399428",
"0.5380246",
"0.5378596",
"0.53759354",
"0.5374985",
"0.53634167",
"0.5361366",
"0.5349386",
"0.5349092",
"0.53445315",
"0.53407365",
"0.5339534",
"0.5338475",
"0.5328996",
"0.53289497",
"0.53286856",
"0.5323824",
"0.5322894",
"0.5322478",
"0.531723",
"0.53112507"
] |
0.73613364
|
0
|
PATCH/PUT /contact_stores/1 PATCH/PUT /contact_stores/1.json
|
def update
respond_to do |format|
if @contact_store.update(contact_store_params)
format.html { redirect_to @contact_store, notice: 'Contact store was successfully updated.' }
format.json { render :show, status: :ok, location: @contact_store }
else
format.html { render :edit }
format.json { render json: @contact_store.errors, status: :unprocessable_entity }
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def update\n respond_to do |format|\n if @store.update(store_params)\n format.html { redirect_to [:phone, @store], notice: 'Store was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @store.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if @store.update(store_params)\n render json: @store\n else\n render json: @store.errors, status: :unprocessable_entity\n end\n end",
"def update\n @contact.update(contact_params)\n if @contact.valid?\n render json: @contact\n end\n end",
"def update\n respond_to do |format|\n if @cakestore.update(cakestore_params)\n format.html { redirect_to @cakestore, notice: 'Cakestore was successfully updated.' }\n format.json { render :show, status: :ok, location: @cakestore }\n else\n format.html { render :edit }\n format.json { render json: @cakestore.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @store = Store.find(params[:id])\n\n respond_to do |format|\n if @store.update_attributes(params[:store])\n format.html { redirect_to stores_path, notice: 'Store was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @store.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if @contact.update(contact_params)\n fresh_when(@contact)\n render json: @contact, status: :ok, location: @contact\n else\n render json: { errors: @contact.errors.messages }, status: :unprocessable_entity\n end\n end",
"def update\n @store = Store.find(params[:id])\n\n respond_to do |format|\n if @store.update_attributes(params[:store])\n format.html { redirect_to @store, :notice => 'Store was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @store.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @store = Store.find(params[:id])\n\n respond_to do |format|\n if @store.update_attributes(params[:store])\n format.html { redirect_to @store, notice: 'Store was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @store.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @store = Store.find(params[:id])\n\n respond_to do |format|\n if @store.update_attributes(params[:store])\n format.html { redirect_to @store, notice: 'Store was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @store.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @store = Store.find(params[:id])\n\n respond_to do |format|\n if @store.update_attributes(params[:store])\n format.html { redirect_to @store, notice: 'Store was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @store.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @store = Store.find(params[:id])\n\n respond_to do |format|\n if @store.update_attributes(params[:store])\n format.html { redirect_to @store, notice: 'Store was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @store.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if @contact.update(contact_params)\n head :no_content\n else\n render json: @contact.errors, status: :unprocessable_entity\n end\n end",
"def update\n render json: Company.update(params[\"id\"], params[\"company\"])\n end",
"def update\n @contact = Contact.find(params[:id])\n\n if @contact.update(contact_params)\n head :no_content\n else\n render json: @contact.errors, status: :unprocessable_entity\n end\n end",
"def update\n @store = Store.find(params[:id])\n\n respond_to do |format|\n if @store.update_attributes(params.require(:store).permit(:break_even, :capacity, :city, :county_id, :manager_id,\n :name, :number, :number_of_lifts, :phone, :region_id,\n :state_id, :street_address, :zip))\n format.html { redirect_to stores_url,\n notice: 'Store was successfully updated.' }\n format.json { head :no_content }\n else\n prepFormVariables\n format.html { render action: \"edit\" }\n format.json { render json: @store.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n begin\n @api_v1_store.update!(api_v1_store_params)\n head :no_content\n rescue => ex\n json_response({error: ex.message}, :unprocessable_entity)\n end\n end",
"def update\n @store = Store.find(params[:id])\n\n respond_to do |format|\n if @store.update_attributes(params[:store])\n format.html { redirect_to '/stores/admin', notice: 'Store was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @store.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @customer = Customer.find(params[:customer_id])\n @cust_contact = @customer.cust_contacts.find(params[:id])\n\n respond_to do |format|\n if @cust_contact.update_attributes(params[:cust_contact])\n format.html { redirect_to customer_path(@customer), :notice => 'Contact was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @cust_contact.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @contact = Contact.find(params[:id])\n if params[:contact][:clientId] == \"\"\n params[:contact][:clientId] = nil\n end \n\n respond_to do |format|\n if @contact.update_attributes(params[:contact])\n format.html { redirect_to @contact, notice: 'Contato atualizado com sucesso.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @contact.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n\n params[:client][:contact_ids] ||= []\n @client = Client.find(params[:id])\n\n respond_to do |format|\n if @client.update_attributes(params[:client])\n format.html { redirect_to @client, notice: 'Client was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @client.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @store.update(store_params)\n format.html { redirect_to @store, notice: 'Store was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @store.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if @contact.address.update(address_params)\n render json: @contact.address\n else\n render json: @contact.errors, status: :unprocessable_entity\n end\n end",
"def update\n @contact = @business.contacts.find(params[:id])\n\n respond_to do |format|\n if @contact.update_attributes(contact_params || {})\n format.html { redirect_to business_contact_path(@business, @contact), notice: 'Contact was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @contact.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n\t\t\t\t @store = Store.find(params[:id])\n\n\t\t\t\t respond_to do |format|\n\t\t\t\t if @store.update_attributes(params[:store])\n\t\t\t\t\tformat.html { redirect_to @store, notice: 'Store was successfully updated.' }\n\t\t\t\t\tformat.json { head :no_content }\n\t\t\t\t else\n\t\t\t\t\tformat.html { render action: \"edit\" }\n\t\t\t\t\tformat.json { render json: @store.errors, status: :unprocessable_entity }\n\t\t\t\t end\n\t\t\t\t end\n\t\t\t\t end",
"def update\n respond_to do |format|\n if @store.update(store_params)\n format.html { redirect_to account_stores_path(account_id: current_account.id), notice: 'Store was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @store.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @store.update(store_params)\n format.html { redirect_to @store }\n format.json { render :show, status: :ok, store: @store }\n else\n format.html { render :edit }\n format.json { render json: @store.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_contact_store\n @contact_store = ContactStore.find(params[:id])\n end",
"def update_contact_in_salesforce\n \tsf = Salesforce::API.connect_to_salesforce\n \tcontact_id = self.sf_contact_id\n \tsf.update(\n \"Contact\",\n Id: \"#{contact_id}\",\n Name: \"#{self.first_name}\",\n Email: \"#{self.email}\",\n )\n end",
"def update\n respond_to do |format|\n if @contact.update(contact_params)\n format.html{redirect_to([@scenario, @contact], notice: 'Contact was successfully updated.')}\n format.json{render :show, status: :ok, location: @contact}\n else\n format.html{redirect_to :back, flash: {error: \"Error saving contact\"}}\n format.json{render json: @contact.errors, status: :unprocessable_entity}\n end\n end\n end",
"def update\n @contact = Contact.find(params[:id])\n\n # respond_to do |format|\n if @contact.update_attributes(params[:contact])\n # format.html { redirect_to(@contact, :notice => 'Contact was successfully updated.') }\n # format.xml { head :ok }\n render :json => { :success => true, :message => \"Created new client #{@contact.id}\", :contact => @contact }\n else\n render :json => { :success => false, :message => \"Failed to create contact\"}\n # format.html { render :action => \"edit\" }\n # format.xml { render :xml => @contact.errors, :status => :unprocessable_entity }\n end\n # end\n end",
"def update\n respond_to do |format|\n \n if @customer.update(customer_params.keep_if{|p,q| q.class != ActionController::Parameters}) \n @customer.address.update(customer_params[:address_attributes])\n @customer.contact.update(customer_params[:contact_attributes])\n format.html { redirect_to @customer, notice: 'Customer was successfully updated.' }\n format.json { render :show, status: :ok, location: @customer }\n else\n format.html { render :edit }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @store = Store.find(params[:id])\n @store.categories = Category.find(params[:category_ids]) if params[:category_ids]\n respond_to do |format|\n if @store.update_attributes(params[:store])\n format.html { redirect_to(@store, :notice => 'Store was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @store.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update_contact\n # hard_code_contact(contact_params)\n respond_to do |format|\n if @contact.update_attributes(contact_params)\n format.html { redirect_to contacts_admin_seller_path(@seller), notice: 'Contact has successfully been updated!' }\n else\n flash[:error] = @contact.errors.full_messages\n format.html { redirect_to contacts_admin_seller_path(@seller), notice: 'Contact failed to be saved!' }\n format.json { render :contacts, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n @job = Job.find_by(id: job_param[:job_id])\n if @address = Address.find_by(id: @contact.address_id)\n if @address.update(address_params)\n end\n else\n @address = Address.new(address_params)\n @address.save\n @contact.address_id = @address.id\n end\n if @contact.update(contact_params)\n @contact.phones.destroy_all\n phone_count = phone_params[\"type_ids\"].count\n\n phone_count.times do |index|\n unless phone_params[\"numbers\"][index] == \"\"\n @contact.phones.create(type_id: phone_params[\"type_ids\"][index], number: phone_params[\"numbers\"][index], extension: phone_params[\"extensions\"][index])\n end\n end\n format.html { redirect_to @contact, notice: 'Contact was successfully updated.' }\n format.json { render :show, status: :ok, location: @contact }\n else\n format.html { render :edit }\n format.json { render json: @contact.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n attributes = fulfillment_bill_params.clone\n puts attributes\n @store = Store.find(attributes[\"store_id\"])\n puts \"Found Store = #{@store.StoreName}\" if !@store.nil?\n attributes = attributes.merge(\"store_name\" => @store.StoreName)\n puts attributes\n respond_to do |format|\n if @fulfillment_bill.update(attributes)\n format.html { redirect_to @fulfillment_bill, notice: 'Fulfillment bill was successfully updated.' }\n format.json { render :show, status: :ok, location: @fulfillment_bill }\n else\n format.html { render :edit }\n format.json { render json: @fulfillment_bill.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @store.update(store_params)\n format.html { redirect_to @store, notice: 'Store was successfully updated.' }\n format.json { render :show, status: :ok, location: @store }\n else\n format.html { render :edit }\n format.json { render json: @store.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @store.update(store_params)\n format.html { redirect_to @store, notice: 'Store was successfully updated.' }\n format.json { render :show, status: :ok, location: @store }\n else\n format.html { render :edit }\n format.json { render json: @store.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @store.update(store_params)\n format.html { redirect_to action 'show', notice: 'Store was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @store.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if @point_of_contact.update(params[:point_of_contact])\n head :no_content\n else\n render json: @point_of_contact.errors, status: :unprocessable_entity\n end\n end",
"def update\n contact = Contact.find(params[:id])\n\n if contact.user_id == current_user.id\n contact.update_attributes(params[:contact])\n render json: contact\n else\n render text: \"That's not your contact!\"\n end\n end",
"def update\n stores = []\n if params[:product][:store_ids].present?\n params[:product][:store_ids].each do |store_id|\n unless store_id.empty?\n store = Store.find(store_id)\n stores << store\n end\n end\n end\n\n unless stores.empty?\n @product.stores = stores\n else\n @product.stores.clear\n end\n \n respond_to do |format|\n if @product.update(product_params)\n format.html { redirect_to @product, notice: \"Product was successfully updated.\" }\n format.json { render :show, status: :ok, location: @product }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end",
"def contact_updated(freshdesk_data,contact_id)\n\t\t#Rails.logger.info \"Update method id and data\"\n\t\t#Rails.logger.debug \"#{@api_domain}-#{contact_id}-#{@api_key}\"\n\t\t#Rails.logger.debug \"#{freshdesk_data.to_json}\"\n\t response = HTTParty.put(\n\t \"#{@api_domain}contacts/#{contact_id}\", \n\t\t basic_auth: { username: @api_key, password: \"password\" },\n\t\t headers: { 'Content-Type' => 'application/json' },\n\t\t body: freshdesk_data.to_json\n\t )\n\tend",
"def update\n respond_to do |format|\n if @contact.update(contact_params)\n format.html { redirect_to contacts_path, notice: 'Contact was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @contact.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @contact.update(contact_params)\n format.html { redirect_to contact_url @contact, notice: 'Contact was successfully updated.' }\n format.json { render :show, status: :ok, location: (contact_url @contact) }\n else\n format.html { render :edit }\n format.json { render json: @contact.errors, status: :unprocessable_entity }\n end\n end\n end",
"def put_update(options = {})\n options[:id] ||= @phone.id\n options[:phone] ||= @attributes\n\n # options[:email][@email.id.to_s] = @attributes\n put :update,options\n end",
"def update\n respond_to do |format|\n if @contact.update(contact_params)\n format.html { render :edit, notice: 'Contact was successfully updated.' }\n format.json { render :edit, status: :ok, location: @contact }\n else\n format.html { render :edit }\n format.json { render json: @contact.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @contact.update(contact_params)\n format.html { redirect_to @contact, notice: 'Contact was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @contact.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @contact_request = ContactRequest.find(params[:id])\n\n respond_to do |format|\n if @contact_request.update_attributes(params[:contact_request])\n format.html { redirect_to @contact_request, notice: 'Contact request was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @contact_request.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @customer = Customer.find(params[:customer_id])\n @contact = @customer.contacts.find(params[:id])\n\n respond_to do |format|\n if @contact.update_attributes(params[:contact])\n format.html { redirect_to([@contact.customer, @contact], :notice => t('forms.update.sucess')) }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @contact.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @admin_store = Admin::Store.find(params[:id])\n\n respond_to do |format|\n if @admin_store.update_attributes(params[:admin_store])\n format.html { redirect_to @admin_store, notice: 'Store was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @admin_store.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n client_id = params[:contact].delete(:client_id)\n @contact = Contact.find(params[:id])\n @contact.client = Client.find(client_id.to_i)\n\n respond_to do |format|\n if @contact.update_attributes(params[:contact])\n format.html { redirect_to @contact, notice: 'Contact was successfully updated.' }\n format.js\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.js { render action: \"edit\" }\n format.json { render json: @contact.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @contact = CompanyContact.find(params[:id])\n if @contact.update_attributes(params[:company_contact])\n head :no_content\n else\n respond_with @contact, status: :unprocessable_entity\n end\n end",
"def update\n respond_to do |format|\n if @customer_contact.update(customer_contact_params)\n format.html { redirect_to @customer_contact, notice: 'Customer contact was successfully updated.' }\n format.json { render :show, status: :ok, location: @customer_contact }\n else\n format.html { render :edit }\n format.json { render json: @customer_contact.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n #@contact = Contact.find(params[:id])\n respond_to do |format|\n if @contact.update_attributes(params[:contact])\n format.html { redirect_to(contacts_url, :notice => t('contacts.was_updated.')) }\n format.json { head :ok }\n format.js { render 'success' }\n else\n format.html { render :action => \"edit\" }\n format.json { render json: @contact.errors, status: :unprocessable_entity }\n format.js { render 'failure' }\n end\n end\n end",
"def update\n @crm_contact = CrmContact.find(params[:id])\n\n respond_to do |format|\n if @crm_contact.update_attributes(params[:crm_contact])\n format.html { redirect_to @crm_contact, notice: 'Crm contact was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @crm_contact.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @crm_contact_info = CrmContactInfo.find(params[:id])\n\n respond_to do |format|\n if @crm_contact_info.update_attributes(params[:crm_contact_info])\n format.html { redirect_to @crm_contact_info, notice: 'Crm contact info was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @crm_contact_info.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @contact.update(contact_params)\n format.html { redirect_to root_path, notice: 'Contact was successfully updated.' }\n format.json { render :show, status: :ok, location: @contact }\n else\n format.html { render :edit }\n format.json { render json: @contact.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @contact.update(contact_params)\n format.html { redirect_to after_save_path, notice: 'Contact was successfully updated.' }\n format.json { render :show, status: :ok, location: @contact }\n else\n format.html { render :edit }\n format.json { render json: @contact.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @contact.update(contact_params)\n format.html { redirect_to @contact, notice: 'Test was successfully updated.' }\n format.json { render :show, status: :ok, location: @contact }\n else\n format.html { render :edit }\n format.json { render json: @contact.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n # contact_params[:photo] = File.open(contact_params[:photo])\n # if contact_params[:phone_number]\n # contact_params[:phone_number] = @contact.phone_number\n # end\n if params[:photo]\n @contact.photo = File.open(params[:photo].tempfile)\n @contact.save!\n end\n if params[:contact][:estate_name] && contact_params[:estate_number]\n estate_id = Estate.find_or_create_by!(estate_name: params[:contact][:estate_name]).id\n @contact.estate_id = estate_id\n @contact.estate_number = params[:estate_number]\n @contact.save!\n end\n if @contact.update(contact_params.except(:phone_number).except(:photo))\n contact = {}\n contact[:id] = @contact.id\n contact[:name] = @contact.name\n contact[:phone_number] = @contact.phone_number\n contact[:group_id] = @contact.group_id\n contact[:contact_type] = @contact.contact_type\n contact[:member_since] = \"#{@contact.created_at.strftime(\"%d/%m/%Y\")} #{@contact.created_at.strftime(\"%I:%M%p\")}\"\n\n render json: contact\n else\n render json: { status: \"FAIL\"}\n end\n end",
"def update\n respond_to do |format|\n if @employee_contact.update(employee_contact_params)\n format.html { redirect_to @employee_contact, notice: 'Employee contact was successfully updated.' }\n format.json { render :show, status: :ok, location: @employee_contact }\n else\n format.html { render :edit }\n format.json { render json: @employee_contact.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @contact.update(contact_params)\n format.html { redirect_to contacts_path, notice: 'Contact was successfully updated.' }\n format.json { render :show, status: :ok, location: @contact }\n else\n format.html { render :edit }\n format.json { render json: @contact.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n \n @preference = get_preference()\n\n @preference.shop_url = session[:shopify].shop.domain\n\n respond_to do |format|\n @preference.attributes = params[:preference]\n @carrier_preference = get_carrier_preference(@preference.carrier)\n \n \n #get free shipping option\n if @preference.free_shipping_by_collection\n colls = ShopifyAPI::CustomCollection.find(:all)\n\n colls.each do |col|\n free_shipping = (params[\"#{col.title}\"] == \"1\")\n \n update_coll_metafield(col, free_shipping)\n end\n\n colls = ShopifyAPI::SmartCollection.find(:all)\n colls.each do |col|\n free_shipping = params[\"#{col.title}\"] == \"1\"\n \n update_coll_metafield(col, free_shipping)\n end\n end\n\n installer_class = carrier_installer_class_for(@preference.carrier)\n installer = installer_class.new( session[:shopify].shop, @preference)\n installer.port = request.port if Rails.env.development?\n installer.configure(params)\n\n if @preference.save\n #save carrier preference\n unless params[:carrier_preference].nil?\n @carrier_preference.attributes = params[:carrier_preference] \n @carrier_preference.shop_url = @preference.shop_url\n \n @carrier_preference.save\n end\n installer.install\n\n format.html { redirect_to preferences_url, notice: 'Preference was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @preference.errors, status: :unprocessable_entity }\n end\n end\n end",
"def ajax_update\n params[:contact][:contact_type_ids] ||= []\n \n respond_to do |format|\n if @contact.update(contact_params)\n format.html { render action: 'ajax_show', :layout => nil, :id => @contact.id }\n format.json { head :no_content }\n else\n format.html { render action: 'ajax_edit' }\n format.json { render json: @contact.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @contact_company.update(contact_company_params)\n format.html { redirect_to @contact_company, notice: 'Contact company was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @contact_company.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @addresstype = Addresstype.find(params[:id])\n\n respond_to do |format|\n if @addresstype.update_attributes(params[:addresstype])\n format.html { redirect_to @addresstype, notice: 'Addresstype was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @addresstype.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_contact(companyId, id, model) path = \"/api/v2/companies/#{companyId}/contacts/#{id}\"\n put(path, model, {}, AvaTax::VERSION) end",
"def update\n @store = Store.find(params[:id])\n\n respond_to do |format|\n if @store.update_attributes(params[:store])\n format.html { redirect_to(@store, :notice => 'Store was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @store.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @contact.update(contact_params)\n format.html { redirect_to @contact, notice: 'Contact was successfully updated.' }\n format.json { render :show, status: :ok, location: @contact }\n else\n format.html { render :edit }\n format.json { render json: @contact.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @contact.update(contact_params)\n format.html { redirect_to @contact, notice: 'Contact was successfully updated.' }\n format.json { render :show, status: :ok, location: @contact }\n else\n format.html { render :edit }\n format.json { render json: @contact.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @contact.update(contact_params)\n format.html { redirect_to @contact, notice: 'Contact was successfully updated.' }\n format.json { render :show, status: :ok, location: @contact }\n else\n format.html { render :edit }\n format.json { render json: @contact.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @contact.update(contact_params)\n format.html { redirect_to @contact, notice: 'Contact was successfully updated.' }\n format.json { render :show, status: :ok, location: @contact }\n else\n format.html { render :edit }\n format.json { render json: @contact.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @contact.update(contact_params)\n format.html { redirect_to @contact, notice: 'Contact was successfully updated.' }\n format.json { render :show, status: :ok, location: @contact }\n else\n format.html { render :edit }\n format.json { render json: @contact.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @contact.update(contact_params)\n format.html { redirect_to @contact, notice: 'Contact was successfully updated.' }\n format.json { render :show, status: :ok, location: @contact }\n else\n format.html { render :edit }\n format.json { render json: @contact.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @contact.update(contact_params)\n format.html { redirect_to @contact, notice: 'Contact was successfully updated.' }\n format.json { render :show, status: :ok, location: @contact }\n else\n format.html { render :edit }\n format.json { render json: @contact.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @contact.update(contact_params)\n format.html { redirect_to @contact, notice: 'Contact was successfully updated.' }\n format.json { render :show, status: :ok, location: @contact }\n else\n format.html { render :edit }\n format.json { render json: @contact.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @contact.update(contact_params)\n format.html { redirect_to @contact, notice: 'Contact was successfully updated.' }\n format.json { render :show, status: :ok, location: @contact }\n else\n format.html { render :edit }\n format.json { render json: @contact.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @contact.update(contact_params)\n format.html { redirect_to @contact, notice: 'Contact was successfully updated.' }\n format.json { render :show, status: :ok, location: @contact }\n else\n format.html { render :edit }\n format.json { render json: @contact.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @contact = Contact.find(params[:id])\n\n respond_to do |format|\n if @contact.update_attributes(params[:contact])\n format.html { redirect_to @contact, notice: 'Contact was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @contact.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @contact = Contact.find(params[:id])\n\n respond_to do |format|\n if @contact.update_attributes(params[:contact])\n format.html { redirect_to @contact, notice: 'Contact was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @contact.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @contact = Contact.find(params[:id])\n\n respond_to do |format|\n if @contact.update_attributes(params[:contact])\n format.html { redirect_to @contact, notice: 'Contact was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @contact.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @contact.update(contact_params)\n format.html { redirect_to edit_contact_path(@contact), notice: 'Contact was successfully updated.' }\n format.json { render :show, status: :ok, location: @contact }\n else\n format.html { render :edit }\n format.json { render json: @contact.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @store.update(store_params)\n format.html { redirect_to @store, notice: 'Store was successfully updated.' }\n params[:books].each{\n |id|\n StoreBook.create(:store_id=>@store.id,:book_id=>id)\n }\n format.json { render :show, status: :ok, location: @store }\n else\n format.html { render :edit }\n format.json { render json: @store.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @storeinfo.update(storeinfo_params)\n format.html { redirect_to @storeinfo, notice: 'Storeinfo was successfully updated.' }\n format.json { render :show, status: :ok, location: @storeinfo }\n else\n format.html { render :edit }\n format.json { render json: @storeinfo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_contact\n @contact = Contact.find(params[:id])\n @contact.update(params[:contact])\n redirect \"/contacts/#{@contact.id}\"\nend",
"def update\n respond_to do |format|\n if @contact_type.update(contact_type_params)\n format.html { redirect_to @contact_type, notice: 'Contact type was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @contact_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n authorize @store_detail, :update?\n respond_to do |format|\n if @store_detail.update(store_detail_params)\n format.html { redirect_to @store_detail, notice: 'Store detail was successfully updated.' }\n format.json { render :show, status: :ok, location: @store_detail }\n else\n format.html { render :edit }\n format.json { render json: @store_detail.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if params[:cros]=='y'\n #update from cros post. @xieyinghua\n new_contact_params=contact_params\n new_contact_params[:name]=params[:name]\n new_contact_params[:phone]=params[:phone]\n new_contact_params[:reason]=params[:reason]\n new_contact_params[:email]=params[:email]\n\n contact_params=new_contact_params\n end\n\n respond_to do |format|\n if @contact.update(contact_params)\n format.html { redirect_to @contact, notice: 'Contact was successfully updated.' }\n format.json { render :show, status: :ok, location: @contact }\n else\n format.html { render :edit }\n format.json { render json: @contact.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @store_section = StoreSection.find(params[:id])\n\n respond_to do |format|\n if @store_section.update_attributes(params[:store_section])\n format.html { redirect_to @store_section, notice: 'Store section was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @store_section.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n @store.slug=nil\n if @store.update(store_params)\n format.html { redirect_to owner_commerce_stores_path(@store.commerce.slug), notice: 'Tienda actualizado exitosamente.' }\n format.json { render :show, status: :ok, location: @store }\n else\n format.html { render :edit }\n format.json { render json: @store.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @site_contact = SiteContact.find(params[:id])\n\n respond_to do |format|\n if @site_contact.update_attributes(params[:site_contact])\n format.html { redirect_to @site_contact, notice: 'Site contact was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @site_contact.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @contact.update(contact_params)\n update_contact_category\n format.html { redirect_to contacts_url, notice: 'Contact was updated.' }\n format.json { render :index, status: :ok }\n else\n format.html { render :edit }\n format.json { render json: @contact.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @metapointofcontact.update(metapointofcontact_params)\n format.html { redirect_to @metapointofcontact, notice: 'Metapointofcontact was successfully updated.' }\n format.json { render :show, status: :ok, location: @metapointofcontact }\n else\n format.html { render :edit }\n format.json { render json: @metapointofcontact.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n @contact.contact_type_id = 12\n\n if @contact.update(contact_params)\n format.html { redirect_to team_path(@contact), notice: 'Contact was successfully updated.' }\n format.json { render :show, status: :ok, location: @contact }\n else\n flash[:error] = @contact.errors.full_messages\n format.html { render :edit }\n format.json { render json: @contact.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @contact.update(contact_params)\n format.html { render action: 'edit' , notice: 'Kontakten uppdaterades!' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @contact.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_contact\n if params[:action] == \"update\"\n @contact = Contact.find(params[:format]) \n else\n @contact = Contact.find(params[:id])\n end\n end",
"def update\n respond_to do |format|\n if @contact.update(contact_params)\n update_custom_field_values\n format.html { redirect_to @contact, notice: 'Contact was successfully updated.' }\n format.json { render :show, status: :ok, location: @contact }\n else\n format.html { render :edit }\n format.json { render json: @contact.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @contactos = Contactos.find(params[:id])\n\n respond_to do |format|\n if @contactos.update_attributes(params[:contactos])\n flash[:notice] = 'Contactos was successfully updated.'\n format.html { redirect_to(@contactos) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @contactos.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @datastore = Datastore.find(params[:id])\n\n respond_to do |format|\n if @datastore.update_attributes(params[:datastore])\n format.html { redirect_to @datastore, notice: 'Datastore was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @datastore.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if !params.has_key?(:ur_contact) then\n head :internal_server_error\n return\n end\n\n #really update the contacts\n contact = UrContact.find(params[:id])\n\n #can't dlete contact you don't own\n if contact.user_id != current_user.id then\n Rails.logger.error \"Attempt to update contact you don't own\"\n head :internal_server_error\n return\n end\n\n if contact.update_attributes(contact_params) then\n render json: contact\n else\n head :internal_server_error\n end\n end"
] |
[
"0.63273424",
"0.6290714",
"0.62886846",
"0.62306434",
"0.6179664",
"0.6154706",
"0.6137701",
"0.6125984",
"0.6125984",
"0.6125984",
"0.6125984",
"0.60858524",
"0.6080788",
"0.6072238",
"0.6065387",
"0.6054712",
"0.60390294",
"0.60240775",
"0.6008811",
"0.5950208",
"0.5942085",
"0.59188247",
"0.5916027",
"0.591144",
"0.5909704",
"0.5901821",
"0.5900658",
"0.5900005",
"0.58989114",
"0.5897209",
"0.5892058",
"0.58760434",
"0.5865849",
"0.585229",
"0.5848718",
"0.58429426",
"0.58429426",
"0.5836757",
"0.58361286",
"0.5835514",
"0.58292395",
"0.5819514",
"0.58193874",
"0.58191675",
"0.581317",
"0.5810357",
"0.58081585",
"0.58077866",
"0.57969683",
"0.57920545",
"0.57866216",
"0.57813424",
"0.5767154",
"0.57521504",
"0.57507044",
"0.57506436",
"0.57477087",
"0.57458574",
"0.57435167",
"0.57407826",
"0.57294434",
"0.5727538",
"0.5724144",
"0.5723844",
"0.57237667",
"0.57230484",
"0.57187563",
"0.5714322",
"0.5712451",
"0.5712451",
"0.5712451",
"0.5712451",
"0.5712451",
"0.5712451",
"0.5712451",
"0.5712451",
"0.5712451",
"0.57118154",
"0.57106245",
"0.57106245",
"0.57106245",
"0.5699493",
"0.5698601",
"0.56939554",
"0.5692967",
"0.56870115",
"0.56848997",
"0.568309",
"0.5669192",
"0.5663752",
"0.56626457",
"0.56609786",
"0.5658241",
"0.565183",
"0.56419957",
"0.56379074",
"0.56331",
"0.562828",
"0.5628147",
"0.5625487"
] |
0.69166386
|
0
|
DELETE /contact_stores/1 DELETE /contact_stores/1.json
|
def destroy
@contact_store.destroy
respond_to do |format|
format.html { redirect_to contact_stores_url, notice: 'Contact store was successfully destroyed.' }
format.json { head :no_content }
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def destroy\n @cakestore.destroy\n respond_to do |format|\n format.html { redirect_to cakestores_url, notice: 'Cakestore was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @store.destroy\n respond_to do |format|\n format.html { redirect_to phone_stores_url, notice: 'Store was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @store = Store.find(params[:id])\n @store.destroy\n\n respond_to do |format|\n format.html { redirect_to stores_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @store = Store.find(params[:id])\n @store.destroy\n\n respond_to do |format|\n format.html { redirect_to stores_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @store = Store.find(params[:id])\n @store.destroy\n\n respond_to do |format|\n format.html { redirect_to stores_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @store = Store.find(params[:id])\n @store.destroy\n\n respond_to do |format|\n format.html { redirect_to stores_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @store.destroy\n respond_to do |format|\n format.html { redirect_to stores_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @store.destroy\n respond_to do |format|\n format.html { redirect_to stores_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @store.destroy\n respond_to do |format|\n format.html { redirect_to stores_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @store.destroy\n respond_to do |format|\n format.html { redirect_to stores_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n\t\t\t\t @store = Store.find(params[:id])\n\t\t\t\t @store.destroy\n\n\t\t\t\t respond_to do |format|\n\t\t\t\t format.html { redirect_to stores_url }\n\t\t\t\t format.json { head :no_content }\n\t\t\t\t end\n\t\t\t\t end",
"def destroy\n\t@store = current_account.stores.find(params[:id])\n @store.destroy\n respond_to do |format|\n format.html { redirect_to account_stores_path(account_id: current_account.id) }\n format.json { head :no_content }\n end\n end",
"def destroy\n @store = Store.find(params[:id])\n @store.destroy\n\n respond_to do |format|\n format.html { redirect_to '/stores/admin' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @store = Store.find(params[:id])\n @store.destroy\n\n respond_to do |format|\n format.html { redirect_to stores_url notice: 'Store was successfully deleted.'}\n format.json { head :no_content }\n end\n end",
"def destroy\n @admin_store = Admin::Store.find(params[:id])\n @admin_store.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_stores_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @store.destroy\n\n render json: @store\n end",
"def destroy\n @datastore = Datastore.find(params[:id])\n @datastore.destroy\n\n respond_to do |format|\n format.html { redirect_to datastores_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @contact.destroy\n render json: {status: 204}\n end",
"def destroy\n @store.destroy\n respond_to do |format|\n format.html { redirect_to stores_url, notice: \"Loja deletada com sucesso!\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @store = Store.find(params[:id])\n @store.destroy\n\n respond_to do |format|\n format.html { redirect_to stores_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @store = Store.find(params[:id])\n @store.destroy\n\n respond_to do |format|\n format.html { redirect_to(stores_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @store = Store.find(params[:id])\n @store.destroy\n\n respond_to do |format|\n format.html { redirect_to(stores_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @store.destroy\n respond_to do |format|\n format.html { redirect_to stores_url, notice: 'Store was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @store.destroy\n respond_to do |format|\n format.html { redirect_to stores_url, notice: 'Store was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @store.destroy\n respond_to do |format|\n format.html { redirect_to stores_url, notice: 'Store was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @store.destroy\n respond_to do |format|\n format.html { redirect_to stores_url, notice: 'Store was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @store = Store.find(params[:id])\n #tib_res = Tibbr::ExternalResource.find_by_resource_key({:resource => {:key => \"ID_#{@store.id}\", :resource_type => \"ad:store\"}, :client_id => session[:app_id]})\n # tib_res.destroy\n @store.destroy\n \n \n\n respond_to do |format|\n format.html { redirect_to stores_url }\n format.json { head :no_content }\n end\n end",
"def delete(contactname)\n\n end",
"def destroy\n @store = Store.find(params[:id])\n @store.destroy\n\n respond_to do |format|\n format.html { redirect_to \"/admin/stores\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n begin\n @api_v1_store.destroy!\n head :no_content\n rescue => ex\n json_response({error: ex.message}, :unprocessable_entity)\n end\n end",
"def destroy\n @store_add.destroy\n respond_to do |format|\n format.html { redirect_to store_adds_url, notice: 'Store add was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @store_to_visit.destroy\n respond_to do |format|\n format.html { redirect_to root_path, notice: 'Store to visit was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @store_section = StoreSection.find(params[:id])\n @store_section.destroy\n\n respond_to do |format|\n format.html { redirect_to store_sections_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @storeinfo.destroy\n respond_to do |format|\n format.html { redirect_to storeinfos_url, notice: 'Storeinfo was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @bread_store.destroy\n respond_to do |format|\n format.html { redirect_to bread_store_managers_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n Conshejointable.where(:contact_id =>@contact.id).delete_all\n Description.where(:contact_id =>@contact.id).delete_all\n puts @contact.id.to_s + \": \" + @contact.name\n @contact.delete\n respond_to do |format|\n format.html { redirect_to contacts_path, notice: 'Contact was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @contact.destroy\n render json:Contact.all\n end",
"def destroy\n @contact.destroy\n #Contact.delete(@contact.id)\n respond_to do |format|\n format.html { redirect_to contacts_path }\n format.json { head :no_content }\n end\n end",
"def destroy\n @online_store = OnlineStore.find(params[:id])\n @online_store.destroy\n\n respond_to do |format|\n format.html { redirect_to online_stores_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @admin_store = Store.find(params[:id])\n @admin_store.destroy\n\n respond_to do |format|\n format.html { redirect_to(admin_stores_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @data_store = DataStore.find(params[:id])\n @data_store.destroy\n\n respond_to do |format|\n format.html { redirect_to data_sources_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @admin_store.destroy\n respond_to do |format|\n format.html { redirect_to admin_stores_url, notice: 'Store was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete\n render json: Company.delete(params[\"id\"])\n end",
"def destroy\n @contact.destroy\n respond_to do |format|\n format.html { redirect_to contacts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @contact.destroy\n respond_to do |format|\n format.html { redirect_to contacts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @contact.destroy\n respond_to do |format|\n format.html { redirect_to contacts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @mstore.destroy\n respond_to do |format|\n format.html { redirect_to mstores_url, notice: 'Mstore was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @contact.destroy\n respond_to do |format|\n format.html { redirect_to admin_contacts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @contact.destroy\n\n head :no_content\n end",
"def destroy\n @site_contact = SiteContact.find(params[:id])\n @site_contact.destroy\n\n respond_to do |format|\n format.html { redirect_to site_contacts_url }\n format.json { head :ok }\n end\n end",
"def destroy\n\n #也要處理相關tags的刪除?\n\n @store.destroy\n respond_to do |format|\n format.html { redirect_to admin_stores_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @store.destroy\n respond_to do |format|\n format.html { redirect_to stocks_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @contact_type.destroy\n respond_to do |format|\n format.html { redirect_to contact_types_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @glass_store_link.destroy\n respond_to do |format|\n format.html { redirect_to glass_store_links_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n #@phone.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"def delete\n client.delete(\"/#{id}\")\n end",
"def destroy\n @contact = Contact.find(params[:id])\n\n @contact.destroy\n #@contact.version\n\n respond_to do |format|\n format.html { redirect_to contacts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n authorize @store_detail, :destroy?\n @store_detail.destroy\n respond_to do |format|\n format.html { redirect_to store_details_url, notice: 'Store detail was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @contact_request = ContactRequest.find(params[:id])\n @contact_request.destroy\n\n respond_to do |format|\n format.html { redirect_to contact_requests_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @contactaction = Contactaction.find(params[:id])\n @contactaction.destroy\n\n respond_to do |format|\n format.html { redirect_to contactactions_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @shop_customer.destroy\n respond_to do |format|\n format.html { redirect_to shop_customers_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @electronics_store.destroy\n respond_to do |format|\n format.html { redirect_to electronics_stores_url, notice: 'Electronics store was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @contact_company.destroy\n respond_to do |format|\n format.html { redirect_to contact_companies_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @customer = Customer.find(params[:customer_id])\n @cust_contact = @customer.cust_contacts.find(params[:id])\n @cust_contact.destroy\n\n respond_to do |format|\n format.html { redirect_to customer_url(@customer) }\n format.json { head :no_content }\n end\n end",
"def delete(context, name)\n res = context.transport.delete_request(context, \"blobstores/#{name}\")\n\n context.err(res.body) unless res.success?\n end",
"def destroy\n @store_status.destroy\n respond_to do |format|\n format.html { redirect_to store_statuses_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @contactos = Contactos.find(params[:id])\n @contactos.destroy\n\n respond_to do |format|\n format.html { redirect_to(contactos_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @contact.destroy\n respond_to do |format|\n format.html { redirect_to contacts_path, notice: 'Test was successfully destroyed.' }\n format.json { head :no_contact }\n end\n end",
"def destroy\n @contact = Contact.find(params[:id])\n @contact.destroy\n render :json => { :success => true, :message => \"Delete product #{@client.id}\", :client => @client }\n # respond_to do |format|\n # format.html { redirect_to(contacts_url) }\n # format.xml { head :ok }\n # end\n end",
"def destroy\n @book_store.destroy\n respond_to do |format|\n format.html { redirect_to book_stores_url, notice: 'Book store was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @contact = @business.contacts.find(params[:id])\n @contact.destroy\n\n respond_to do |format|\n format.html { redirect_to business_contacts_url(@business) }\n format.json { head :no_content }\n end\n end",
"def destroy\n @point_of_contact.destroy\n\n head :no_content\n end",
"def destroy\n @tweet_store.destroy\n respond_to do |format|\n format.html { redirect_to tweet_stores_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @collection.destroy\n\n render json: @collection, status: :ok#, location: @collection\n end",
"def destroy\n @store_item.destroy\n respond_to do |format|\n format.html { redirect_to store_items_url, notice: 'Store item was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @contact = Contact.find(params[:id])\n @contact.destroy\n\n respond_to do |format|\n format.html { redirect_to contacts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @contact = Contact.find(params[:id])\n @contact.destroy\n\n respond_to do |format|\n format.html { redirect_to contacts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @contact = Contact.find(params[:id])\n @contact.destroy\n\n respond_to do |format|\n format.html { redirect_to contacts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @contact = Contact.find(params[:id])\n @contact.destroy\n\n respond_to do |format|\n format.html { redirect_to contacts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @shop.destroy\n respond_to do |format|\n format.html { redirect_to backend_shops_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @entity_contact = EntityContact.find(params[:id])\n @entity_contact.destroy\n\n respond_to do |format|\n format.html { redirect_to entity_contacts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @contactable = find_contactable\n @contactable.contactos.find(params[:id]).destroy\n respond_to do |format|\n format.html { head :ok}\n # format.html { redirect_to @contactable }\n #format.json { head :ok }\n end\n end",
"def destroy\n @contact.destroy\n respond_to do |format|\n format.html { redirect_to scenario_contacts_url(@scenario), notice: 'Contact was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @store = StoreProduct.find(params[:id])\n @store.destroy\n respond_to do |format|\n format.html { redirect_to store_products_url, notice: 'Store was successfully destroyed.' }\n format.json { head :no_content }\n end\nend",
"def destroy\n @addresstype = Addresstype.find(params[:id])\n @addresstype.destroy\n\n respond_to do |format|\n format.html { redirect_to addresstypes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @site_contact.destroy\n respond_to do |format|\n format.html { redirect_to site_contacts_url, notice: 'Site contact was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @contact = @detail.contact\n @detail.destroy\n respond_to do |format|\n format.html { redirect_to @contact, notice: 'Detail was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @contact.destroy\n respond_to do |format|\n format.html { redirect_to root_path, notice: 'Contact was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @store_detail = StoreDetail.find(params[:store_detail_id])\n @addon = Addon.find(params[:id])\n @addon.destroy\n respond_to do |format|\n format.html { redirect_to store_detail_addons_path(@store_detail), notice: 'addon detail was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @couch.destroy\n respond_to do |format|\n format.html { redirect_to couches_url, notice: 'Couch was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @crm_contact = CrmContact.find(params[:id])\n @crm_contact.destroy\n\n respond_to do |format|\n format.html { redirect_to crm_contacts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @glo_collection.destroy\n respond_to do |format|\n format.html { redirect_to glo_collections_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @contact.destroy\n respond_to do |format|\n format.html { redirect_to homes_url, notice: 'Contact was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @contact_action = ContactAction.find(params[:id])\n @contact_action.destroy\n\n respond_to do |format|\n format.html { redirect_to contact_actions_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @contact = CompanyContact.find(params[:id])\n @contact.destroy\n head :no_content\n end",
"def destroy\n @metapointofcontact.destroy\n respond_to do |format|\n format.html { redirect_to metapointofcontacts_url, notice: 'Metapointofcontact was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @prov_contact_updates = ProvContactUpdates.find(params[:id])\n @prov_contact_updates.destroy\n\n respond_to do |format|\n format.html { redirect_to prov_contact_updates_url }\n format.xml { head :ok }\n end\n end",
"def destroy\n @contacto.destroy\n respond_to do |format|\n format.html { redirect_to contactos_url, notice: 'Contacto was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @contact.destroy\n respond_to do |format|\n format.html { redirect_to contacts_url, notice: 'Contact was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @contact.destroy\n respond_to do |format|\n format.html { redirect_to contacts_url, notice: 'Contact was successfully destroyed.' }\n format.json { head :no_content }\n end\n end"
] |
[
"0.7212821",
"0.7168814",
"0.7154229",
"0.7154229",
"0.7154229",
"0.7154229",
"0.71260476",
"0.71260476",
"0.71260476",
"0.71260476",
"0.71050686",
"0.70846194",
"0.70506907",
"0.7039082",
"0.70173824",
"0.7004824",
"0.69737554",
"0.6938925",
"0.6929737",
"0.6913436",
"0.6903497",
"0.6899655",
"0.68923086",
"0.68923086",
"0.68923086",
"0.68923086",
"0.6854231",
"0.6840378",
"0.68189746",
"0.68156284",
"0.6808882",
"0.6778403",
"0.67772347",
"0.6765517",
"0.6749519",
"0.6743623",
"0.67397636",
"0.6728329",
"0.6722497",
"0.67116433",
"0.67058843",
"0.668747",
"0.66862893",
"0.6666812",
"0.6666812",
"0.6666812",
"0.6638758",
"0.66368955",
"0.6628219",
"0.6618837",
"0.6604893",
"0.6599383",
"0.65974283",
"0.65970993",
"0.6591113",
"0.6567344",
"0.65631694",
"0.65618116",
"0.65617263",
"0.65600365",
"0.65535456",
"0.6550061",
"0.6545304",
"0.6537757",
"0.6521303",
"0.65171283",
"0.6516014",
"0.6514855",
"0.65009636",
"0.64958453",
"0.6495107",
"0.649382",
"0.64875996",
"0.6470795",
"0.6469646",
"0.64631087",
"0.64631087",
"0.64631087",
"0.64631087",
"0.64614654",
"0.64594454",
"0.645179",
"0.6448862",
"0.6441748",
"0.64349854",
"0.64308345",
"0.6429762",
"0.6426768",
"0.64252263",
"0.642328",
"0.64164585",
"0.6409175",
"0.6406322",
"0.63948625",
"0.63913935",
"0.6384173",
"0.63824314",
"0.6381514",
"0.6377833",
"0.6377833"
] |
0.76097816
|
0
|
Use callbacks to share common setup or constraints between actions.
|
def set_contact_store
@contact_store = ContactStore.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 contact_store_params
params.require(:contact_store).permit(:name, :email, :tel, :message, :date_time, :nickname, :utf8, :authenticity_token, :commit)
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 filtering_params\n params.permit(:email)\n end",
"def active_code_params\n params[:active_code].permit\n end",
"def valid_params(params)\n params.permit(:user_id, :photo_id, :originX, :originY, :width, :height)\n end",
"def ip_address_params\n\t\t\tparams.require(:ip_address).permit!\n end",
"def 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 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 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 permit_request_params\n params.permit(:address)\n end",
"def sensitive_params=(params)\n @sensitive_params = params\n end",
"def user_params\n # Ensure a user can't give themselves admin priveleges\n params.delete(:admin) if current_user.admin?\n params.require(:user).permit(:name, :email, :admin, :image)\n end",
"def secure_params\n params.require(:location).permit(:name)\n end",
"def strong_params\n params.require( :setting ).\n permit( :global_scan_limit, :per_user_scan_limit,\n :target_whitelist_patterns, :target_blacklist_patterns )\n end",
"def question_params\n params.require(:survey_question).permit(question_whitelist)\n end",
"def case_insensitive_params\n params.require(:case_insensitive).permit(:name)\n end",
"def empire_master_no_match_params\n params.require(:empire_master_no_match).permit(:uid, :last_name, :list, :search_date, :double, :source)\n end",
"def maintenance_request_params\n params[:maintenance_request].permit! #allow all parameters for now\n end",
"def unwanted_params\n params.require(:unwanted).permit(:title, :description, :image)\n end",
"def url_params\n params[:url].permit(:full)\n end",
"def backend_user_params\n params.permit!\n end",
"def 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.69780594",
"0.678054",
"0.6742781",
"0.67387927",
"0.67346025",
"0.6590683",
"0.6501642",
"0.6495788",
"0.6479752",
"0.64763314",
"0.645457",
"0.6437739",
"0.6377168",
"0.6372484",
"0.6363871",
"0.63179374",
"0.62981373",
"0.6297456",
"0.62916917",
"0.6290227",
"0.628954",
"0.62877893",
"0.62814754",
"0.62416226",
"0.6237962",
"0.62168854",
"0.62127215",
"0.62084496",
"0.61927646",
"0.6176822",
"0.6174079",
"0.6171225",
"0.6161419",
"0.61507314",
"0.6150071",
"0.6145409",
"0.61204594",
"0.61135256",
"0.6105225",
"0.6103249",
"0.6088041",
"0.6079626",
"0.6070542",
"0.6060409",
"0.60198915",
"0.6016795",
"0.6010659",
"0.60103244",
"0.6005393",
"0.6005393",
"0.6000696",
"0.60000104",
"0.59931517",
"0.59916013",
"0.5991397",
"0.5990416",
"0.5979021",
"0.5965926",
"0.59582806",
"0.59579134",
"0.5957629",
"0.5956672",
"0.59518754",
"0.59510773",
"0.5942638",
"0.5937516",
"0.59361875",
"0.59361875",
"0.59336793",
"0.5928626",
"0.5925229",
"0.59243226",
"0.59174913",
"0.5907821",
"0.5907719",
"0.5906177",
"0.59056896",
"0.5897028",
"0.5896294",
"0.5895856",
"0.5893494",
"0.58926904",
"0.589066",
"0.58854234",
"0.58809334",
"0.5878489",
"0.58727074",
"0.5868653",
"0.5866631",
"0.58666086",
"0.5866305",
"0.586484",
"0.58631617",
"0.5861481",
"0.5861059",
"0.5859114",
"0.5858489",
"0.585326",
"0.58530635",
"0.5848788",
"0.58479697"
] |
0.0
|
-1
|
GET /tickets GET /tickets.json
|
def index
@sprint = params[:sprint].presence || Sprint.current!
@tickets = Ticket.for_sprint(@sprint).by_created_at_desc
@tickets = @tickets.for_project(params[:project]) if params[:project].present?
@tickets = @tickets.for_user(params[:user]) if params[:user].present?
@tickets = @tickets.search_name(params[:description]) if params[:description].present?
respond_to do |format|
format.html # index.html.erb
format.json { render json: @tickets }
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def GetTickets params = {}\n\n params = params.merge(path: 'tickets.json')\n APICall(params)\n\n end",
"def getUserTickets\n @user = User.find(params[:id])\n render json: @user.tickets\n end",
"def index\n @tickets = Ticket.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ticket }\n end\n end",
"def index\n @title = \"Tickets\"\n @tickets = Ticket.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @tickets }\n end\n end",
"def GetTicket id\n\n APICall(path: \"tickets/#{id}.json\")\n\n end",
"def index\n\t @tickets = Ticket.order('created_at DESC').page(params[:page])\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @tickets }\n end\n end",
"def index\n @tickets = current_user.tickets.last(15).reverse\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @tickets }\n end\n end",
"def index\n respond_with(@tickets)\n end",
"def index_all\n @tickets = Ticket.all_tickets\n render json: @tickets, status: 200\n end",
"def index\n if params[:tickets] == 'closed'\n @tickets = Helpdesk::Ticket.where(:requester_id => helpdesk_user.id).closed.page(params[:page])\n else\n @tickets = Helpdesk::Ticket.where(:requester_id => helpdesk_user.id).active.page(params[:page])\n end\n\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @tickets }\n end\n end",
"def show\n @ticket = Ticket.find(params[:id])\n respond_to do |format|\n format.html\n format.json { render json: @ticket }\n end\n end",
"def show\n render json: @ticket\n end",
"def my_tickets\n user = current_user.id if !current_user.nil?\n # OCO\n init_oco if !session[:organization]\n\n @search = Ticket.search do\n fulltext params[:search]\n if session[:organization] != '0'\n with :organization_id, session[:organization]\n end\n if !user.blank?\n with :created_by, user\n end\n with(:ticket_status_id).less_than(4)\n order_by :id, :desc\n paginate :page => params[:page] || 1, :per_page => per_page\n end\n\n @tickets = @search.results\n\n respond_to do |format|\n format.html # my_tickets.html.erb\n format.json { render json: @tickets }\n end\n end",
"def show\n @tickets_count = Helpdesk::Ticket.where(:requester_id => helpdesk_user.id).active.count\n @ticket = Helpdesk::Ticket.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ticket }\n end\n end",
"def show\n @ticket = Ticket.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ticket }\n end\n end",
"def show\n @ticket = Ticket.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ticket }\n end\n end",
"def show\n @ticket = Ticket.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ticket }\n end\n end",
"def show\n @ticket = Ticket.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ticket }\n end\n end",
"def show\n @ticket = Ticket.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ticket }\n end\n end",
"def show\n @ticket = Ticket.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ticket }\n end\n end",
"def index\n @tickets = Ticket.all\n end",
"def index\n @tickets = Ticket.all\n end",
"def index\n @tickets = Ticket.all\n end",
"def index\n @tickets = Ticket.all\n end",
"def index\n @tickets = Ticket.all\n end",
"def index\n @tickets = Ticket.all\n end",
"def index\n @tickets = Ticket.all\n end",
"def index\n @tickets = Ticket.all\n end",
"def index\n @tickets = Ticket.all\n end",
"def index\n @tickets = Ticket.all\n end",
"def index\n @tickets = Ticket.all\n end",
"def index\n @tickets = Ticket.all\n end",
"def index\n @tickets = Ticket.all\n end",
"def index_user\n @tickets = Ticket.all_for_user(current_user.id)\n render json: @tickets, status: 200\n end",
"def index\n @tickets = current_user.tickets.page(params[:page]||1)\n respond_to do |format|\n format.html\n format.xml { render :xml => @tickets }\n format.json { render :json => @tickets }\n end\n end",
"def tickets_for_project(project_id)\n tickets = send(:get , \"/api/v1/projects/#{project_id}/tickets.json\")\n\n process_list_response( tickets , Unfuddled::Ticket )\n end",
"def index\n # @tickets = policy_scope(Ticket)\n render json: @tickets\n end",
"def index\n @tickets = current_user.tickets\n end",
"def index\n @tickets = current_user.tickets\n end",
"def index\n if params[:status]\n @tickets = Ticket.where(status: params[:status])\n else\n @tickets = Ticket.all\n @tickets_waiting = Ticket.where(status:\"waiting\")\n @tickets_resolved = Ticket.where(status:\"resolved\")\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @tickets }\n end\n end",
"def index\n @support_tickets = SupportTicket.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @support_tickets }\n end\n end",
"def index\n @tickets = @event.tickets\n end",
"def index\n @tickets = get_current_user_ticket_list(@user)\n end",
"def index\n if current_user.is? :admin\n if params[:user_id]\n @tickets = User.find(params[:user_id]).tickets.paginate(:page => params[:page])\n elsif params[:team_id]\n @tickets = Team.find(params[:team_id]).tickets.paginate(:page => params[:page])\n else\n @tickets = Ticket.paginate(:page => params[:page])\n end\n else\n @tickets = current_user.tickets.paginate(:page => params[:page])\n end\n\n if params[:status] == \"closed\"\n @tickets = @tickets.closed\n else\n @tickets = @tickets.open\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @tickets }\n end\n end",
"def show\n @breadcrumb = 'read'\n @ticket = Ticket.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ticket }\n end\n end",
"def index\n @tickets = OTRS::Ticket.where(params[:q])\n\n respond_to do |wants|\n wants.html # index.html.erb\n wants.xml { render :xml => @tickets }\n wants.json { render :json => @tickets }\n end\n end",
"def list\r\n # the base uri for api requests\r\n _query_builder = Configuration.base_uri.dup\r\n\r\n # prepare query string for API call\r\n _query_builder << '/tickets'\r\n\r\n # validate and preprocess url\r\n _query_url = APIHelper.clean_url _query_builder\r\n\r\n # prepare headers\r\n _headers = {\r\n 'user-agent' => 'APIMATIC 2.0',\r\n 'accept' => 'application/json',\r\n 'X-API-TOKEN' => Configuration.x_api_token,\r\n 'X-API-EMAIL' => Configuration.x_api_email\r\n }\r\n\r\n # append custom auth authorization\r\n CustomAuthUtility.append_custom_auth_params _headers\r\n\r\n # invoke the API call request to fetch the response\r\n _response = Unirest.get _query_url, headers: _headers\r\n\r\n # Error handling using HTTP status codes\r\n if _response.code == 401\r\n raise APIException.new 'Your API key is incorrect', 401, _response.body\r\n elsif _response.code == 400\r\n raise APIException.new 'There is an error in the parameters you send', 400, _response.body\r\n elsif _response.code == 404\r\n raise APIException.new 'Cannot find the resource specified', 404, _response.body\r\n elsif !_response.code.between?(200, 206) # [200,206] = HTTP OK\r\n raise APIException.new 'HTTP Response Not OK', _response.code, _response.body\r\n end\r\n \r\n # Try to cast response to list of desired type\r\n if _response.body.instance_of? Array\r\n value = Array.new\r\n _response.body.each do |item|\r\n begin\r\n value << (Ticket.from_hash(item))\r\n rescue Exception\r\n raise APIException.new \"Invalid JSON returned.\", _response.code, _response.body\r\n end\r\n end\r\n value\r\n end\r\n end",
"def index\n @ticket_owners = TicketOwner.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ticket_owners }\n end\n end",
"def getUserTicketsByType\n @conditions = {user_id: params[:id], ticket_type: params[:ticket_type]}\n @tickets = Ticket.find(:all, :conditions => @conditions)\n\n # Handle empty results\n if @tickets.empty?\n raise(ActiveRecord::RecordNotFound)\n end\n\n render json: @tickets\n end",
"def find_tickets(res)\n if res.key?(\"tickets\")\n tickets_info = res[\"tickets\"]\n @tickets = []\n tickets_info.each do |ticket_info|\n ticket = Ticket.new(ticket_info) \n @tickets << ticket\n end\n @tickets\n elsif res.key?(\"error\")\n raise res[\"error\"]\n else\n raise \"unknown error from API\"\n end\n end",
"def show\n render json: @ticket.to_json(include: :conversations), status: 200\n end",
"def index\n @tickets = @project.tickets.desc.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @tickets }\n end\n end",
"def show\n # @tickets = @user.tickets\n @conditions = {user_id: @user.id, ticket_type: 1}\n @t1 = Ticket.find(:all, :conditions => @conditions, :limit => 10)\n @conditions = {user_id: @user.id, ticket_type: 2}\n @t2 = Ticket.find(:all, :conditions => @conditions, :limit => 10)\n @conditions = {user_id: @user.id, ticket_type: 3}\n @t3 = Ticket.find(:all, :conditions => @conditions, :limit => 10)\n @used_tickets = UsedTicket.where(user_id: @user.id).limit(10)\n render :json => \n {\n :status => 0,\n :user => {\n :id => @user.id,\n :name => @user.name,\n :email => @user.email,\n :tickets => {\n :t1 => @t1,\n :t2 => @t2,\n :t3 => @t3,\n :used => @used_tickets\n }\n }\n }\n end",
"def get(ticket_id)\r\n\r\n # Validate required parameters\r\n if ticket_id == nil\r\n raise ArgumentError.new \"Required parameter 'ticket_id' cannot be nil.\"\r\n end\r\n\r\n # the base uri for api requests\r\n _query_builder = Configuration.base_uri.dup\r\n\r\n # prepare query string for API call\r\n _query_builder << '/tickets/{ticket_id}'\r\n\r\n # process optional query parameters\r\n _query_builder = APIHelper.append_url_with_template_parameters _query_builder, {\r\n 'ticket_id' => ticket_id\r\n }\r\n\r\n # validate and preprocess url\r\n _query_url = APIHelper.clean_url _query_builder\r\n\r\n # prepare headers\r\n _headers = {\r\n 'user-agent' => 'APIMATIC 2.0',\r\n 'accept' => 'application/json',\r\n 'X-API-TOKEN' => Configuration.x_api_token,\r\n 'X-API-EMAIL' => Configuration.x_api_email\r\n }\r\n\r\n # append custom auth authorization\r\n CustomAuthUtility.append_custom_auth_params _headers\r\n\r\n # invoke the API call request to fetch the response\r\n _response = Unirest.get _query_url, headers: _headers\r\n\r\n # Error handling using HTTP status codes\r\n if _response.code == 401\r\n raise APIException.new 'Your API key is incorrect', 401, _response.body\r\n elsif _response.code == 400\r\n raise APIException.new 'There is an error in the parameters you send', 400, _response.body\r\n elsif _response.code == 404\r\n raise APIException.new 'Cannot find the resource specified', 404, _response.body\r\n elsif !_response.code.between?(200, 206) # [200,206] = HTTP OK\r\n raise APIException.new 'HTTP Response Not OK', _response.code, _response.body\r\n end\r\n\r\n # Try to cast response to desired type\r\n if _response.body.instance_of? Hash\r\n begin\r\n Ticket.from_hash(_response.body)\r\n rescue Exception\r\n raise APIException.new \"Invalid JSON returned.\", _response.code, _response.body\r\n end\r\n end\r\n end",
"def get_ticket(ticket_id:)\n ZendeskAPI::Ticket.find(client, id: ticket_id)\n end",
"def show\n @tickets = @event.tickets.find(params[:id])\n end",
"def index\n tickets = Ticket.all_relevant_tickets\n @pagy, @tickets = pagy(tickets)\n ticket_records_with_associations =\n TicketSerializer.new(@tickets, { params: { :ticketlist => true } }).hash_for_collection[:data].map { | ticket |\n ticket[:attributes]\n }\n # When we need pagination lets use the below\n #render json: { data: ticket_records_with_associations,\n # pagy: pagy_metadata(@pagy) }\n paginate json: ticket_records_with_associations\n end",
"def index\n @tickets = Ticket.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @tickets }\n end\n end",
"def show\n @admin_ticket = Ticket.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @admin_ticket }\n end\n end",
"def index\n @tickets = Ticket.where(user: current_user)\n end",
"def show\n @ticket = Ticket.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @home }\n end\n end",
"def index\n authorize @ticket\n render :json => @ticket.tags\n end",
"def new\n @ticket = Ticket.new(sprint: Sprint.current!)\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @ticket }\n end\n end",
"def index\n @tickets = Ticket.all\n render_default_format(@ticket, true)\n end",
"def show\n @ticket = Ticket.find(params[:id])\n @help_text = \"\"\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ticket }\n end\n end",
"def show\n @ticket_owner = TicketOwner.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ticket_owner }\n end\n end",
"def new\n @ticket = Ticket.new\n @event = Event.find params[:event_id]\n @tiers = @event.tiers\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @ticket }\n end\n end",
"def ticket\n @ticket ||= @api.get_ticket['ticket']\n end",
"def index\n @comments = Comment.paginate(:page => params[:page])\n @ticket = Ticket.find(params[:ticket_id])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @comments }\n end\n end",
"def tickets(filters = {})\n tickets = send(:get , '/api/v1/ticket_reports/dynamic.json', filters)\n\n tickets = tickets[:body][\"groups\"].first[\"tickets\"]\n\n process_list_response( tickets , Unfuddled::Ticket)\n end",
"def load_tickets(page_number)\n begin\n conn = Faraday.new\n conn.basic_auth(@credentials[:username], @credentials[:password])\n response = conn.get(\"https://jackiesun2.zendesk.com/api/v2/tickets.json?page=#{page_number}\")\n raise StandardError if response.status.to_i >= 400 \n @zendesk_tickets = JSON.parse(response.body, symbolize_names: true)\n rescue \n puts \"This path is incorrect, please check again\"\n exit\n end \n end",
"def get_trucker_tickets\n @tickets = Ticket.find_all_by_job_id_and_paid_to_trucker(params[:id], false, :order => \"number\")\n render \"get_tickets.html.erb\"\n end",
"def new\n @ticket = Ticket.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @ticket }\n end\n end",
"def new\n @ticket = Ticket.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @ticket }\n end\n end",
"def new\n @ticket = Ticket.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @ticket }\n end\n end",
"def new\n @ticket = Ticket.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @ticket }\n end\n end",
"def show\n ticket = Ticket.find(params[:address])\n\n render json: {\n address: ticket.address,\n salt: ticket.salt,\n status: ticket.status,\n event: ticket.event.name,\n event_id: ticket.event_id,\n }\n end",
"def tickets\n Ticket.find_all_by_project_id_and_milestone_id(project_id, id)\n end",
"def index\n @ticketings = Ticketing.all\n end",
"def index\n @ticket_codes = TicketCode.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ticket_codes }\n end\n end",
"def index\n if params[:event_id]\n @tickets = Ticket.find_all_by_event_id(params[:event_id])\n else\n @tickets = Ticket.find(:all)\n end\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @tickets }\n end\n end",
"def total_tickets\n respond_with json_response('total_tickets', Ticket.count)\n end",
"def show\n @tickets = Ticket.get_from_event @event\n end",
"def new\n @tickets_count = Helpdesk::Ticket.where(:requester_id => helpdesk_user.id).active.count\n @ticket = Helpdesk::Ticket.new\n @ticket.status = Helpdesk::Ticket::STATUSES[0][0]\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @ticket }\n end\n end",
"def show\n @ticket = Ticket.find(params[:id])\n end",
"def find(id)\n info(\"https://jrcodn.zendesk.com/api/v2/tickets/#{id}\")[:ticket]\n rescue\n @view.id_error\n end",
"def show\n @ticket = Ticket.find(params[:id].to_i) rescue nil\n respond_to do |format|\n unless @ticket.blank?\n format.xml { render :xml => ticket_presenter }\n format.json { render :json => ticket_presenter }\n else\n format.xml { head :not_found }\n format.json { head :not_found }\n end\n end\n end",
"def all_ticket_entries\n @ac = ApplicationController.new\n @tickets = Ticket.find(:all, :order => \"created_at\")[0..5000].reverse!\n @species = Specie.all\n @woodtypes = WoodType.all\n end",
"def get_logger_tickets\n @tickets = Ticket.find_all_by_job_id_and_paid_to_logger(params[:id], false, :order => \"number\")\n render \"get_tickets.html.erb\"\n end",
"def show\n @ticket = Ticket.find(params[:id])\n \n end",
"def get_hfi_tickets\n @tickets = Ticket.find_all_by_job_id_and_paid_to_hfi(params[:id], false, :order => \"number\")\n render \"get_tickets.html.erb\"\n end",
"def index\n @tickets = Ticket.order(id: :desc).all\n end",
"def show\n @ticket_code = TicketCode.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ticket_code }\n end\n end",
"def index\n if params[:status] \n status = params[:status].to_sym\n if Status.statuses.has_key? status\n status_id = Status.statuses[status] \n @tickets = Ticket.where(status_id: status_id)\n end\n elsif params[:search]\n search = Ticket.search{fulltext params[:search]}\n @tickets = search.results\n else\n @tickets = Ticket.all\n end\n end",
"def index\n respond_to do |format|\n format.json { render json: Api::V1::Datatables::TicketsDatatable.new(self.view_context) }\n end\n end",
"def index\n @ticket_items = TicketItem.all\n end",
"def index\n @tickets = Ticket.all\n @result = []\n @tickets.each do |ticket|\n @obj = {\n id: ticket.id,\n title: ticket.title,\n body: ticket.body,\n statu_id: ticket.statu_id,\n user_id: ticket.user_id,\n active: ticket.active,\n image: ticket.image.attached? ? url_for(ticket.image) : nil,\n media: ticket.image.attached? ? url_for(ticket.image) : nil,\n created_at: ticket.created_at,\n updated_at: ticket.updated_at\n }\n @result << @obj\n end\n render json: @result\n end",
"def show\n if @ticket\n if ProjectUser.verify_role(current_user.id, @ticket.project_id, 'client')\n render json: Ticket.build_ticket_object(@ticket, current_user.id), status: 200\n else\n render json: { error: 'You must be a member of a project to see its content' }, status: :unauthorized\n end\n else\n render json: { error: \"no ticket found with id of #{params[:project_id]}\" }, status: 404\n end\n end",
"def tickets()\n sql = \"SELECT * FROM tickets where customer_id = $1\"\n values = [@id]\n ticket_data = SqlRunner.run(sql, values)\n return ticket_data.map{|ticket| Ticket.new(ticket)}\n end",
"def index\n if @project\n if ProjectUser.verify_role(current_user.id, @project, 'client')\n @tickets = Ticket.all_for_project(@project)\n render json: @tickets, status: 200\n else\n render json: { error: 'You must be a member of a project to see its content' }, status: :unauthorized\n end\n else\n render json: { error: \"no project found with id of #{params[:project_id]}\" }, status: 404\n end\n end"
] |
[
"0.812432",
"0.7915244",
"0.76279",
"0.76198745",
"0.7595226",
"0.7439142",
"0.7317611",
"0.7301728",
"0.73013884",
"0.7277282",
"0.7274308",
"0.7272302",
"0.7221539",
"0.71765393",
"0.7116907",
"0.7116907",
"0.7116907",
"0.7116907",
"0.7116907",
"0.7116907",
"0.70597136",
"0.70597136",
"0.70597136",
"0.70597136",
"0.70597136",
"0.70597136",
"0.70597136",
"0.70597136",
"0.70597136",
"0.70597136",
"0.70597136",
"0.70597136",
"0.7059027",
"0.70448697",
"0.6963253",
"0.69538486",
"0.693455",
"0.69333595",
"0.69333595",
"0.6930567",
"0.6920131",
"0.69026566",
"0.68610364",
"0.68440115",
"0.67981356",
"0.6762969",
"0.6756395",
"0.66756487",
"0.6674713",
"0.66669565",
"0.66641426",
"0.66604596",
"0.6650193",
"0.66495144",
"0.6647248",
"0.66166365",
"0.6596757",
"0.65937644",
"0.658707",
"0.6577375",
"0.6547883",
"0.65350646",
"0.65208495",
"0.65142405",
"0.6509762",
"0.64759195",
"0.64643925",
"0.6456677",
"0.644489",
"0.64383787",
"0.6436595",
"0.6432851",
"0.64296776",
"0.64296776",
"0.64296776",
"0.64296776",
"0.6423045",
"0.6416854",
"0.64116496",
"0.64114094",
"0.64014053",
"0.63879246",
"0.63823366",
"0.6334986",
"0.63316983",
"0.6299465",
"0.6271112",
"0.62639266",
"0.6263105",
"0.62624973",
"0.6251863",
"0.62461483",
"0.6225275",
"0.6221005",
"0.62141854",
"0.62006205",
"0.6199752",
"0.61882377",
"0.6185131",
"0.6182493"
] |
0.7173541
|
14
|
GET /tickets/1 GET /tickets/1.json
|
def show
@ticket = Ticket.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.json { render json: @ticket }
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def GetTicket id\n\n APICall(path: \"tickets/#{id}.json\")\n\n end",
"def GetTickets params = {}\n\n params = params.merge(path: 'tickets.json')\n APICall(params)\n\n end",
"def getUserTickets\n @user = User.find(params[:id])\n render json: @user.tickets\n end",
"def show\n @ticket = Ticket.find(params[:id])\n respond_to do |format|\n format.html\n format.json { render json: @ticket }\n end\n end",
"def index\n @tickets = Ticket.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ticket }\n end\n end",
"def index\n @title = \"Tickets\"\n @tickets = Ticket.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @tickets }\n end\n end",
"def index\n @tickets = current_user.tickets.last(15).reverse\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @tickets }\n end\n end",
"def show\n render json: @ticket\n end",
"def index\n\t @tickets = Ticket.order('created_at DESC').page(params[:page])\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @tickets }\n end\n end",
"def show\n @tickets_count = Helpdesk::Ticket.where(:requester_id => helpdesk_user.id).active.count\n @ticket = Helpdesk::Ticket.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ticket }\n end\n end",
"def index\n respond_with(@tickets)\n end",
"def show\n @breadcrumb = 'read'\n @ticket = Ticket.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ticket }\n end\n end",
"def index_all\n @tickets = Ticket.all_tickets\n render json: @tickets, status: 200\n end",
"def get_ticket(ticket_id:)\n ZendeskAPI::Ticket.find(client, id: ticket_id)\n end",
"def index\n @sprint = params[:sprint].presence || Sprint.current!\n @tickets = Ticket.for_sprint(@sprint).by_created_at_desc\n @tickets = @tickets.for_project(params[:project]) if params[:project].present?\n @tickets = @tickets.for_user(params[:user]) if params[:user].present?\n @tickets = @tickets.search_name(params[:description]) if params[:description].present?\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @tickets }\n end\n end",
"def index\n if params[:tickets] == 'closed'\n @tickets = Helpdesk::Ticket.where(:requester_id => helpdesk_user.id).closed.page(params[:page])\n else\n @tickets = Helpdesk::Ticket.where(:requester_id => helpdesk_user.id).active.page(params[:page])\n end\n\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @tickets }\n end\n end",
"def index\n @tickets = Ticket.all\n end",
"def index\n @tickets = Ticket.all\n end",
"def index\n @tickets = Ticket.all\n end",
"def index\n @tickets = Ticket.all\n end",
"def index\n @tickets = Ticket.all\n end",
"def index\n @tickets = Ticket.all\n end",
"def index\n @tickets = Ticket.all\n end",
"def index\n @tickets = Ticket.all\n end",
"def index\n @tickets = Ticket.all\n end",
"def index\n @tickets = Ticket.all\n end",
"def index\n @tickets = Ticket.all\n end",
"def index\n @tickets = Ticket.all\n end",
"def index\n @tickets = Ticket.all\n end",
"def show\n @tickets = @event.tickets.find(params[:id])\n end",
"def index\n @tickets = current_user.tickets.page(params[:page]||1)\n respond_to do |format|\n format.html\n format.xml { render :xml => @tickets }\n format.json { render :json => @tickets }\n end\n end",
"def show\n @admin_ticket = Ticket.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @admin_ticket }\n end\n end",
"def index\n if params[:status]\n @tickets = Ticket.where(status: params[:status])\n else\n @tickets = Ticket.all\n @tickets_waiting = Ticket.where(status:\"waiting\")\n @tickets_resolved = Ticket.where(status:\"resolved\")\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @tickets }\n end\n end",
"def ticket\n @ticket ||= @api.get_ticket['ticket']\n end",
"def my_tickets\n user = current_user.id if !current_user.nil?\n # OCO\n init_oco if !session[:organization]\n\n @search = Ticket.search do\n fulltext params[:search]\n if session[:organization] != '0'\n with :organization_id, session[:organization]\n end\n if !user.blank?\n with :created_by, user\n end\n with(:ticket_status_id).less_than(4)\n order_by :id, :desc\n paginate :page => params[:page] || 1, :per_page => per_page\n end\n\n @tickets = @search.results\n\n respond_to do |format|\n format.html # my_tickets.html.erb\n format.json { render json: @tickets }\n end\n end",
"def index\n @tickets = @event.tickets\n end",
"def tickets_for_project(project_id)\n tickets = send(:get , \"/api/v1/projects/#{project_id}/tickets.json\")\n\n process_list_response( tickets , Unfuddled::Ticket )\n end",
"def show\n @ticket = Ticket.find(params[:id])\n end",
"def get(ticket_id)\r\n\r\n # Validate required parameters\r\n if ticket_id == nil\r\n raise ArgumentError.new \"Required parameter 'ticket_id' cannot be nil.\"\r\n end\r\n\r\n # the base uri for api requests\r\n _query_builder = Configuration.base_uri.dup\r\n\r\n # prepare query string for API call\r\n _query_builder << '/tickets/{ticket_id}'\r\n\r\n # process optional query parameters\r\n _query_builder = APIHelper.append_url_with_template_parameters _query_builder, {\r\n 'ticket_id' => ticket_id\r\n }\r\n\r\n # validate and preprocess url\r\n _query_url = APIHelper.clean_url _query_builder\r\n\r\n # prepare headers\r\n _headers = {\r\n 'user-agent' => 'APIMATIC 2.0',\r\n 'accept' => 'application/json',\r\n 'X-API-TOKEN' => Configuration.x_api_token,\r\n 'X-API-EMAIL' => Configuration.x_api_email\r\n }\r\n\r\n # append custom auth authorization\r\n CustomAuthUtility.append_custom_auth_params _headers\r\n\r\n # invoke the API call request to fetch the response\r\n _response = Unirest.get _query_url, headers: _headers\r\n\r\n # Error handling using HTTP status codes\r\n if _response.code == 401\r\n raise APIException.new 'Your API key is incorrect', 401, _response.body\r\n elsif _response.code == 400\r\n raise APIException.new 'There is an error in the parameters you send', 400, _response.body\r\n elsif _response.code == 404\r\n raise APIException.new 'Cannot find the resource specified', 404, _response.body\r\n elsif !_response.code.between?(200, 206) # [200,206] = HTTP OK\r\n raise APIException.new 'HTTP Response Not OK', _response.code, _response.body\r\n end\r\n\r\n # Try to cast response to desired type\r\n if _response.body.instance_of? Hash\r\n begin\r\n Ticket.from_hash(_response.body)\r\n rescue Exception\r\n raise APIException.new \"Invalid JSON returned.\", _response.code, _response.body\r\n end\r\n end\r\n end",
"def new\n @ticket = Ticket.new(sprint: Sprint.current!)\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @ticket }\n end\n end",
"def index_user\n @tickets = Ticket.all_for_user(current_user.id)\n render json: @tickets, status: 200\n end",
"def show\n @ticket_owner = TicketOwner.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ticket_owner }\n end\n end",
"def show\n @ticket = Ticket.find(params[:id])\n \n end",
"def new\n @ticket = Ticket.new\n @event = Event.find params[:event_id]\n @tiers = @event.tiers\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @ticket }\n end\n end",
"def index\n @tickets = current_user.tickets\n end",
"def index\n @tickets = current_user.tickets\n end",
"def show\n @ticket = Ticket.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @home }\n end\n end",
"def find(id)\n info(\"https://jrcodn.zendesk.com/api/v2/tickets/#{id}\")[:ticket]\n rescue\n @view.id_error\n end",
"def show\n @ticket = Ticket.find(params[:id])\n @help_text = \"\"\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ticket }\n end\n end",
"def index\n if current_user.is? :admin\n if params[:user_id]\n @tickets = User.find(params[:user_id]).tickets.paginate(:page => params[:page])\n elsif params[:team_id]\n @tickets = Team.find(params[:team_id]).tickets.paginate(:page => params[:page])\n else\n @tickets = Ticket.paginate(:page => params[:page])\n end\n else\n @tickets = current_user.tickets.paginate(:page => params[:page])\n end\n\n if params[:status] == \"closed\"\n @tickets = @tickets.closed\n else\n @tickets = @tickets.open\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @tickets }\n end\n end",
"def new\n @ticket = Ticket.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @ticket }\n end\n end",
"def new\n @ticket = Ticket.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @ticket }\n end\n end",
"def new\n @ticket = Ticket.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @ticket }\n end\n end",
"def new\n @ticket = Ticket.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @ticket }\n end\n end",
"def index\n @support_tickets = SupportTicket.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @support_tickets }\n end\n end",
"def show\n @ticket = Ticket.find(params[:id].to_i) rescue nil\n respond_to do |format|\n unless @ticket.blank?\n format.xml { render :xml => ticket_presenter }\n format.json { render :json => ticket_presenter }\n else\n format.xml { head :not_found }\n format.json { head :not_found }\n end\n end\n end",
"def index\n @tickets = @project.tickets.desc.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @tickets }\n end\n end",
"def index\n @tickets = OTRS::Ticket.where(params[:q])\n\n respond_to do |wants|\n wants.html # index.html.erb\n wants.xml { render :xml => @tickets }\n wants.json { render :json => @tickets }\n end\n end",
"def index\n # @tickets = policy_scope(Ticket)\n render json: @tickets\n end",
"def new\n @tickets_count = Helpdesk::Ticket.where(:requester_id => helpdesk_user.id).active.count\n @ticket = Helpdesk::Ticket.new\n @ticket.status = Helpdesk::Ticket::STATUSES[0][0]\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @ticket }\n end\n end",
"def show\n # @tickets = @user.tickets\n @conditions = {user_id: @user.id, ticket_type: 1}\n @t1 = Ticket.find(:all, :conditions => @conditions, :limit => 10)\n @conditions = {user_id: @user.id, ticket_type: 2}\n @t2 = Ticket.find(:all, :conditions => @conditions, :limit => 10)\n @conditions = {user_id: @user.id, ticket_type: 3}\n @t3 = Ticket.find(:all, :conditions => @conditions, :limit => 10)\n @used_tickets = UsedTicket.where(user_id: @user.id).limit(10)\n render :json => \n {\n :status => 0,\n :user => {\n :id => @user.id,\n :name => @user.name,\n :email => @user.email,\n :tickets => {\n :t1 => @t1,\n :t2 => @t2,\n :t3 => @t3,\n :used => @used_tickets\n }\n }\n }\n end",
"def show\n render json: @ticket.to_json(include: :conversations), status: 200\n end",
"def getUserTicketsByType\n @conditions = {user_id: params[:id], ticket_type: params[:ticket_type]}\n @tickets = Ticket.find(:all, :conditions => @conditions)\n\n # Handle empty results\n if @tickets.empty?\n raise(ActiveRecord::RecordNotFound)\n end\n\n render json: @tickets\n end",
"def index\n @ticket_owners = TicketOwner.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ticket_owners }\n end\n end",
"def show\n ticket = Ticket.find(params[:address])\n\n render json: {\n address: ticket.address,\n salt: ticket.salt,\n status: ticket.status,\n event: ticket.event.name,\n event_id: ticket.event_id,\n }\n end",
"def index\n @comments = Comment.paginate(:page => params[:page])\n @ticket = Ticket.find(params[:ticket_id])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @comments }\n end\n end",
"def get_trucker_tickets\n @tickets = Ticket.find_all_by_job_id_and_paid_to_trucker(params[:id], false, :order => \"number\")\n render \"get_tickets.html.erb\"\n end",
"def index\n @tickets = Ticket.all\n render_default_format(@ticket, true)\n end",
"def show\n @ticket_code = TicketCode.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ticket_code }\n end\n end",
"def index\n @tickets = Ticket.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @tickets }\n end\n end",
"def show\n @event = Event.find(params[:id])\n @ticket = @event.tickets.new\n end",
"def index\n @tickets = get_current_user_ticket_list(@user)\n end",
"def find_tickets(res)\n if res.key?(\"tickets\")\n tickets_info = res[\"tickets\"]\n @tickets = []\n tickets_info.each do |ticket_info|\n ticket = Ticket.new(ticket_info) \n @tickets << ticket\n end\n @tickets\n elsif res.key?(\"error\")\n raise res[\"error\"]\n else\n raise \"unknown error from API\"\n end\n end",
"def index\n if params[:event_id]\n @tickets = Ticket.find_all_by_event_id(params[:event_id])\n else\n @tickets = Ticket.find(:all)\n end\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @tickets }\n end\n end",
"def load_tickets(page_number)\n begin\n conn = Faraday.new\n conn.basic_auth(@credentials[:username], @credentials[:password])\n response = conn.get(\"https://jackiesun2.zendesk.com/api/v2/tickets.json?page=#{page_number}\")\n raise StandardError if response.status.to_i >= 400 \n @zendesk_tickets = JSON.parse(response.body, symbolize_names: true)\n rescue \n puts \"This path is incorrect, please check again\"\n exit\n end \n end",
"def show\n @tickets = Ticket.get_from_event @event\n end",
"def show\n @ticket = Ticket.find(params[:id])\n\n # get last five comments\n @comments_per_page = 5\n @comments = @ticket.comments.limit(@comments_per_page)\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ticket }\n end\n end",
"def index\n @tickets = Ticket.order(id: :desc).all\n end",
"def index\n @tickets = Ticket.where(user: current_user)\n end",
"def new\n #@matches = Match.all\n @title = \"New Ticket\"\n @ticket = Ticket.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @ticket }\n end\n end",
"def index\n tickets = Ticket.all_relevant_tickets\n @pagy, @tickets = pagy(tickets)\n ticket_records_with_associations =\n TicketSerializer.new(@tickets, { params: { :ticketlist => true } }).hash_for_collection[:data].map { | ticket |\n ticket[:attributes]\n }\n # When we need pagination lets use the below\n #render json: { data: ticket_records_with_associations,\n # pagy: pagy_metadata(@pagy) }\n paginate json: ticket_records_with_associations\n end",
"def index\n @ticketings = Ticketing.all\n end",
"def new\n @admin_ticket = Ticket.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @admin_ticket }\n end\n end",
"def show\n @ticket = Ticket.find_by_reference(params[:id])\n end",
"def get_logger_tickets\n @tickets = Ticket.find_all_by_job_id_and_paid_to_logger(params[:id], false, :order => \"number\")\n render \"get_tickets.html.erb\"\n end",
"def list\r\n # the base uri for api requests\r\n _query_builder = Configuration.base_uri.dup\r\n\r\n # prepare query string for API call\r\n _query_builder << '/tickets'\r\n\r\n # validate and preprocess url\r\n _query_url = APIHelper.clean_url _query_builder\r\n\r\n # prepare headers\r\n _headers = {\r\n 'user-agent' => 'APIMATIC 2.0',\r\n 'accept' => 'application/json',\r\n 'X-API-TOKEN' => Configuration.x_api_token,\r\n 'X-API-EMAIL' => Configuration.x_api_email\r\n }\r\n\r\n # append custom auth authorization\r\n CustomAuthUtility.append_custom_auth_params _headers\r\n\r\n # invoke the API call request to fetch the response\r\n _response = Unirest.get _query_url, headers: _headers\r\n\r\n # Error handling using HTTP status codes\r\n if _response.code == 401\r\n raise APIException.new 'Your API key is incorrect', 401, _response.body\r\n elsif _response.code == 400\r\n raise APIException.new 'There is an error in the parameters you send', 400, _response.body\r\n elsif _response.code == 404\r\n raise APIException.new 'Cannot find the resource specified', 404, _response.body\r\n elsif !_response.code.between?(200, 206) # [200,206] = HTTP OK\r\n raise APIException.new 'HTTP Response Not OK', _response.code, _response.body\r\n end\r\n \r\n # Try to cast response to list of desired type\r\n if _response.body.instance_of? Array\r\n value = Array.new\r\n _response.body.each do |item|\r\n begin\r\n value << (Ticket.from_hash(item))\r\n rescue Exception\r\n raise APIException.new \"Invalid JSON returned.\", _response.code, _response.body\r\n end\r\n end\r\n value\r\n end\r\n end",
"def show\n if @ticket\n if ProjectUser.verify_role(current_user.id, @ticket.project_id, 'client')\n render json: Ticket.build_ticket_object(@ticket, current_user.id), status: 200\n else\n render json: { error: 'You must be a member of a project to see its content' }, status: :unauthorized\n end\n else\n render json: { error: \"no ticket found with id of #{params[:project_id]}\" }, status: 404\n end\n end",
"def show\n @ticket = Ticket.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @ticket }\n end\n end",
"def show\n @ticket = Ticket.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @ticket }\n end\n end",
"def show\n @ticket = Ticket.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @ticket }\n end\n end",
"def show\n @ticket = Ticket.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @ticket }\n end\n end",
"def show\n @ticket = Ticket.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @ticket }\n end\n end",
"def show\n @ticket = Ticket.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @ticket }\n end\n end",
"def index\n if params[:status] \n status = params[:status].to_sym\n if Status.statuses.has_key? status\n status_id = Status.statuses[status] \n @tickets = Ticket.where(status_id: status_id)\n end\n elsif params[:search]\n search = Ticket.search{fulltext params[:search]}\n @tickets = search.results\n else\n @tickets = Ticket.all\n end\n end",
"def new\n @ticket_owner = TicketOwner.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @ticket_owner }\n end\n end"
] |
[
"0.7985267",
"0.7595772",
"0.7489845",
"0.7379687",
"0.7338592",
"0.7323581",
"0.72120136",
"0.7165008",
"0.7152847",
"0.71043557",
"0.69847274",
"0.69769794",
"0.6925518",
"0.6924985",
"0.6895925",
"0.68454385",
"0.6820753",
"0.6820753",
"0.6820753",
"0.6820753",
"0.6820753",
"0.6820753",
"0.6820753",
"0.6820753",
"0.6820753",
"0.6820753",
"0.6820753",
"0.6820753",
"0.6819969",
"0.6803507",
"0.6786731",
"0.6770085",
"0.6758251",
"0.6728392",
"0.67278594",
"0.67221534",
"0.6707925",
"0.6705077",
"0.6675053",
"0.66587937",
"0.665705",
"0.6646013",
"0.664556",
"0.6619805",
"0.66053593",
"0.66053593",
"0.6596825",
"0.6593929",
"0.6587406",
"0.65565187",
"0.65418804",
"0.65418804",
"0.65418804",
"0.65418804",
"0.6537555",
"0.65338004",
"0.65056676",
"0.6492034",
"0.64569646",
"0.64528793",
"0.64408356",
"0.6421813",
"0.6417637",
"0.6413183",
"0.6410984",
"0.63977444",
"0.63725173",
"0.6356848",
"0.63457686",
"0.6339857",
"0.6303939",
"0.63020647",
"0.62818646",
"0.6274211",
"0.62604445",
"0.6256492",
"0.6247362",
"0.6240095",
"0.6236477",
"0.62312233",
"0.6216787",
"0.6204831",
"0.61963296",
"0.6195538",
"0.6190567",
"0.6174477",
"0.61676437",
"0.61647534",
"0.61647534",
"0.61647534",
"0.61647534",
"0.61647534",
"0.61647534",
"0.6164237",
"0.61485195"
] |
0.7233424
|
9
|
GET /tickets/new GET /tickets/new.json
|
def new
@ticket = Ticket.new(sprint: Sprint.current!)
respond_to do |format|
format.html # new.html.erb
format.json { render json: @ticket }
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def new\n @ticket = Ticket.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @ticket }\n end\n end",
"def new\n @ticket = Ticket.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @ticket }\n end\n end",
"def new\n @ticket = Ticket.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @ticket }\n end\n end",
"def new\n @ticket = Ticket.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @ticket }\n end\n end",
"def new\n #@matches = Match.all\n @title = \"New Ticket\"\n @ticket = Ticket.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @ticket }\n end\n end",
"def new\n @tickets_count = Helpdesk::Ticket.where(:requester_id => helpdesk_user.id).active.count\n @ticket = Helpdesk::Ticket.new\n @ticket.status = Helpdesk::Ticket::STATUSES[0][0]\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @ticket }\n end\n end",
"def new\n @admin_ticket = Ticket.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @admin_ticket }\n end\n end",
"def new\n @ticket = Ticket.new\n @event = Event.find params[:event_id]\n @tiers = @event.tiers\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @ticket }\n end\n end",
"def new\n @ticket = Ticket.new\n @ticket.platform = Ticket::PLATFORMS[0]\n @ticket.application = Ticket::APPS[0]\n @ticket.priority = Ticket::PRIORITIES[0]\n @ticket.from_name = current_user.name\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @ticket }\n end\n end",
"def new\n @ticket_owner = TicketOwner.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @ticket_owner }\n end\n end",
"def new\n @ticket = Ticket.new\n end",
"def new\n @ticket = Ticket.new\n end",
"def getNew\n\t\t@tickets.read ['id', 'pid', 'title', 'tracker', 'created'], ['status', 'new']\n\tend",
"def new\n @ticket_code = TicketCode.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @ticket_code }\n end\n end",
"def new\n @breadcrumb = 'create'\n @ticket = Ticket.new\n $attachment = Attachment.new\n destroy_attachment\n @offices = offices_dropdown\n @technicians = technicians_dropdown\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @ticket }\n end\n end",
"def new\n @ticket = OTRS::Ticket.new\n\n respond_to do |wants|\n wants.html # new.html.erb\n wants.xml { render :xml => @ticket }\n wants.json { render :json => @ticket }\n end\n end",
"def new\n @ticket = Ticket.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @ticket }\n end\n end",
"def new\n @ticket = Ticket.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @ticket }\n end\n end",
"def new\n @ticket = Ticket.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @ticket }\n end\n end",
"def new\n @ticket = Ticket.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @ticket }\n end\n end",
"def new\n @ticket = Ticket::Ticket.create\n redirect_to ticket_path(@ticket)\n end",
"def new\n @breadcrumb = 'create'\n @ticket_priority = TicketPriority.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @ticket_priority }\n end\n end",
"def create\n @ticket = Ticket.new(ticket_params)\n respond_to do |format|\n if @ticket.save\n format.html { render json: @ticket.to_json }\n format.json { render :show, status: :created, location: @ticket }\n else\n format.html { render :new }\n format.json { render json: @ticket.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @t = T.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @t }\n end\n end",
"def create\n @ticket = Ticket.new(params[:ticket])\n\n respond_to do |format|\n if @ticket.save\n format.html { redirect_to @ticket, notice: 'Ticket was successfully created.' }\n format.json { render json: @ticket, status: :created, location: @ticket }\n else\n format.html { render action: \"new\" }\n format.json { render json: @ticket.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @ticket = Ticket.new(params[:ticket])\n\n respond_to do |format|\n if @ticket.save\n format.html { redirect_to @ticket, notice: 'Ticket was successfully created.' }\n format.json { render json: @ticket, status: :created, location: @ticket }\n else\n format.html { render action: 'new' }\n format.json { render json: @ticket.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n\n @ticket = Ticket.new(params[:ticket])\n\n respond_to do |format|\n if @ticket.save\n format.html { redirect_to @ticket, notice: 'Ticket was successfully created.' }\n format.json { render json: @ticket, status: :created, location: @ticket }\n else\n format.html { render action: \"new\" }\n format.json { render json: @ticket.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @issue = Issue.new\n\n @new = true\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @issue }\n end\n end",
"def new\n @support_ticket = SupportTicket.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @support_ticket }\n end\n end",
"def new\n @ticket = Ticket.new\n @page_title = \"New Ticket\"\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @ticket }\n end\n\n end",
"def new\n @ticket_type = TicketType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @ticket_type }\n end\n end",
"def new\n @events = Event.find(:all, :conditions => [\"user_id = ?\", self.current_user.id])\n @ticket = Ticket.new\n @ticket.event_id = params[:ticket][:event_id]\n\n respond_to do |format|\n if @events.length >= 1\n format.html # new.html.erb\n format.xml { render :xml => @ticket }\n else\n format.html { redirect_to new_event_path()}\n end\n end \n end",
"def create\n @ticket = Ticket.new(ticket_params)\n\n respond_to do |format|\n if @ticket.save\n format.html { redirect_to @ticket, notice: 'Ticket was successfully created.' }\n format.json { render action: 'show', status: :created, location: @ticket }\n else\n format.html { render action: 'new' }\n format.json { render json: @ticket.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @ticket = Ticket.new(ticket_params)\n\n respond_to do |format|\n if @ticket.save\n format.html { redirect_to @ticket, notice: 'Ticket was successfully created.' }\n format.json { render action: 'show', status: :created, location: @ticket }\n else\n format.html { render action: 'new' }\n format.json { render json: @ticket.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @lost = Lost.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @lost }\n end\n end",
"def new\n @add_phone_to_nouveau_ticket = AddPhoneToNouveauTicket.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @add_phone_to_nouveau_ticket }\n end\n end",
"def popup_new\n @breadcrumb = 'create'\n @ticket = Ticket.new(params[:ticket])\n @ticket.created_by = current_user.id if !current_user.nil?\n @ticket.source_ip = request.remote_ip\n @ticket.hd_email = mail_to\n @ticket.office_id = from_office\n @ticket.organization_id = from_organization\n\n respond_to do |format|\n if @ticket.save\n format.html { redirect_to params[:referrer] }\n format.json { render json: @ticket, status: :created, location: @ticket }\n else\n format.html { redirect_to params[:referrer], notice: I18n.t('activerecord.errors.ticket.popup') }\n format.json { render json: @ticket.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n ticket_id = params[:ticket_id]\n user_id = params[:user_id]\n \n @ticket_lock = TicketLock.new(:ticket_id => ticket_id, :user_id => user_id)\n \n if @ticket_lock.save\n render :json => {:status => 'ok', :time => 300 }\n else\n render :json => {:status => 'error', :message => 'This ticket is already locked.'}\n end\n end",
"def create\n @ticket = Ticket.new(ticket_params)\n\n respond_to do |format|\n if @ticket.save\n format.html { redirect_to @ticket, notice: 'Ticket was successfully created.' }\n format.json { render :show, status: :created, location: @ticket }\n else\n format.html { render :new }\n format.json { render json: @ticket.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @ticket = Ticket.new(ticket_params)\n\n respond_to do |format|\n if @ticket.save\n format.html { redirect_to @ticket, notice: 'Ticket was successfully created.' }\n format.json { render :show, status: :created, location: @ticket }\n else\n format.html { render :new }\n format.json { render json: @ticket.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @ticket = Ticket.new(ticket_params)\n\n respond_to do |format|\n if @ticket.save\n format.html { redirect_to @ticket, notice: 'Ticket was successfully created.' }\n format.json { render :show, status: :created, location: @ticket }\n else\n format.html { render :new }\n format.json { render json: @ticket.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @ticket = Ticket.new(ticket_params)\n\n respond_to do |format|\n if @ticket.save\n format.html { redirect_to @ticket, notice: 'Ticket was successfully created.' }\n format.json { render :show, status: :created, location: @ticket }\n else\n format.html { render :new }\n format.json { render json: @ticket.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @ticket = Ticket.new(ticket_params)\n\n respond_to do |format|\n if @ticket.save\n format.html { redirect_to @ticket, notice: 'Ticket was successfully created.' }\n format.json { render :show, status: :created, location: @ticket }\n else\n format.html { render :new }\n format.json { render json: @ticket.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @potluck = Potluck.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @potluck }\n end\n end",
"def new\n @patch = Patch.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @patch }\n end\n end",
"def new\n @get = Get.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @get }\n end\n end",
"def new\n @thing = Thing.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @thing }\n end\n end",
"def create\n @ticket = @current_user.tickets.build(ticket_params)\n respond_to do |format|\n if @ticket.save\n format.html { redirect_to @ticket, :notice => 'Ticket was successfully created.' }\n format.json { render :action => 'show', :status => :created, :location => @ticket }\n else\n format.html { render :action => 'new' }\n format.json { render :json => @ticket.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n \n @ticket = Ticket.new(ticket_params)\n\n respond_to do |format|\n if @ticket.save\n format.html { redirect_to @ticket, notice: 'Ticket was successfully created.' }\n format.json { render :show, status: :created, location: @ticket }\n else\n format.html { render :new }\n format.json { render json: @ticket.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @gitto = Gitto.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @gitto }\n end\n end",
"def new\n @entry = Entry.new\n\n render json: @entry\n end",
"def new\n @tktest = Tktest.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @tktest }\n end\n end",
"def new\n @todo = Todo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @todo }\n end\n end",
"def new\n @todo = Todo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @todo }\n end\n end",
"def new\n @todo = Todo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @todo }\n end\n end",
"def new\n @todo = Todo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @todo }\n end\n end",
"def new\n @todo = Todo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @todo }\n end\n end",
"def new\n @thing = Thing.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @thing }\n end\n end",
"def create\n @ticket = Ticket.new(ticket_params)\n\n respond_to do |format|\n if @ticket.save\n format.html { redirect_to @ticket, notice: \"Ticket was successfully created.\" }\n format.json { render :show, status: :created, location: @ticket }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @ticket.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @issue = Issue.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @issue }\n end\n end",
"def new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @tips_trick }\n end\n end",
"def new\n @press = Press.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @press }\n end\n end",
"def new\n @todo = @list.todos.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @todo }\n end\n end",
"def new\n @tip = Tip.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @tip }\n end\n end",
"def new\n @timetable = Timetable.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @timetable }\n end\n end",
"def new\n @trap = Trap.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @trap }\n end\n end",
"def new\n @holding = Holding.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @holding }\n end\n end",
"def new\n @holding = Holding.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @holding }\n end\n end",
"def new\n @po = Po.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @po }\n end\n end",
"def new\n @bug = Bug.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @bug }\n end\n end",
"def new\n @bug = Bug.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @bug }\n end\n end",
"def new\n @tweet = Tweet.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @tweet }\n end\n end",
"def new\n @tweet = Tweet.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @tweet }\n end\n end",
"def new\n @team = Team.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @team }\n end\n end",
"def new\n @team = Team.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @team }\n end\n end",
"def new\n @team = Team.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @team }\n end\n end",
"def new\n @team = Team.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @team }\n end\n end",
"def new\n @team = Team.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @team }\n end\n end",
"def new\n @team = Team.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @team }\n end\n end",
"def new\n @team = Team.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @team }\n end\n end",
"def new\n @team = Team.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @team }\n end\n end",
"def new\n @tech_id = TechId.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @tech_id }\n end\n end",
"def create\n @ticket = Ticket.new(params[:ticket])\n \n respond_to do |format|\n if @ticket.save\n format.html { redirect_to ticket_path( @ticket ), notice: '感謝您參與本次活動,我們將於 10 個工作日回覆您!' }\n format.json { render json: @ticket, status: :created, location: @ticket }\n else\n format.html { render action: \"new\" }\n format.json { render json: @ticket.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @journal = Journal.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json :@journal }\n end\n end",
"def new\n @todofuken = Todofuken.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @todofuken }\n end\n end",
"def new\n @gotcha = Gotcha.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @gotcha }\n end\n end",
"def new\n @topic = Topic.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @topic }\n end\n end",
"def new\n @topic = Topic.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @topic }\n end\n end",
"def new\n @topic = Topic.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @topic }\n end\n end",
"def new\n @topic = Topic.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @topic }\n end\n end",
"def new\n @topic = Topic.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @topic }\n end\n end",
"def new\n @topic = Topic.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @topic }\n end\n end",
"def new\n @taker = Taker.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @taker }\n end\n end",
"def new\n @newsletters_template = Newsletters::Template.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @newsletters_template }\n end\n end",
"def new\n @pot = Pot.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @pot }\n end\n end",
"def new\n @normal_issue = NormalIssue.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @normal_issue }\n end\n end",
"def create\n @tickets = []\n params[:quantity].to_i.times do\n @ticket = Ticket.new(params[:ticket])\n @ticket.viber = current_viber\n @tickets << @ticket\n end\n\n respond_to do |format|\n if @tickets.map(&:save)\n format.html { redirect_to @ticket, notice: 'Your ticket(s) are booked.' }\n format.json { render json: @ticket, status: :created, location: @ticket }\n else\n format.html { render action: \"new\" }\n format.json { render json: @ticket.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @todo = Todo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json=>@todo}\n end\n end",
"def new\n @tenure = Tenure.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @tenure }\n end\n end",
"def new\n @bug_list = BugList.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @bug_list }\n end\n end"
] |
[
"0.80568236",
"0.80568236",
"0.80568236",
"0.80568236",
"0.7853418",
"0.7546344",
"0.7528544",
"0.7509112",
"0.74955624",
"0.7435305",
"0.7317495",
"0.7317495",
"0.73148",
"0.73072803",
"0.72983253",
"0.7287808",
"0.7203171",
"0.7203171",
"0.7203171",
"0.7203171",
"0.7157161",
"0.7105255",
"0.70886606",
"0.70316356",
"0.70209247",
"0.7018116",
"0.6992728",
"0.69638807",
"0.6958306",
"0.6929286",
"0.6888337",
"0.68637604",
"0.6854973",
"0.6854973",
"0.685384",
"0.68185157",
"0.6810051",
"0.67978877",
"0.6791957",
"0.6791957",
"0.6791957",
"0.6791957",
"0.6791939",
"0.67916936",
"0.6778002",
"0.67636645",
"0.67629576",
"0.6760082",
"0.67534834",
"0.6746147",
"0.67258006",
"0.671833",
"0.6710782",
"0.6710782",
"0.6710782",
"0.6710782",
"0.6710782",
"0.6695588",
"0.66739416",
"0.66729957",
"0.66649866",
"0.66604316",
"0.6629166",
"0.6626203",
"0.6618296",
"0.66092634",
"0.66026163",
"0.66026163",
"0.6600721",
"0.65991735",
"0.65991735",
"0.6588766",
"0.6588766",
"0.65839624",
"0.65839624",
"0.65839624",
"0.65839624",
"0.65839624",
"0.65839624",
"0.65839624",
"0.6583741",
"0.65836805",
"0.6580619",
"0.657007",
"0.6565284",
"0.65637785",
"0.6554274",
"0.6552197",
"0.6552197",
"0.6552197",
"0.6552197",
"0.6552197",
"0.6547049",
"0.65422106",
"0.6540676",
"0.6537764",
"0.65375495",
"0.65374976",
"0.65357715",
"0.65297765"
] |
0.7991255
|
4
|
POST /tickets POST /tickets.json
|
def create
@ticket = Ticket.new(params[:ticket])
respond_to do |format|
if @ticket.save
format.html { redirect_to @ticket, notice: 'Ticket was successfully created.' }
format.json { render json: @ticket, status: :created, location: @ticket }
else
format.html { render action: 'new' }
format.json { render json: @ticket.errors, status: :unprocessable_entity }
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def CreateTicket params = {}\n\n APICall(path: 'tickets.json',method: 'POST',payload: {ticket: params}.to_json)\n \n end",
"def create\n @ticket = Ticket.new(ticket_params)\n respond_to do |format|\n if @ticket.save\n format.html { render json: @ticket.to_json }\n format.json { render :show, status: :created, location: @ticket }\n else\n format.html { render :new }\n format.json { render json: @ticket.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n\n @ticket = Ticket.new(params[:ticket])\n\n respond_to do |format|\n if @ticket.save\n format.html { redirect_to @ticket, notice: 'Ticket was successfully created.' }\n format.json { render json: @ticket, status: :created, location: @ticket }\n else\n format.html { render action: \"new\" }\n format.json { render json: @ticket.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @ticket = Ticket.new(params[:ticket])\n\n respond_to do |format|\n if @ticket.save\n format.html { redirect_to @ticket, notice: 'Ticket was successfully created.' }\n format.json { render json: @ticket, status: :created, location: @ticket }\n else\n format.html { render action: \"new\" }\n format.json { render json: @ticket.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n \n @ticket = Ticket.new(ticket_params)\n\n respond_to do |format|\n if @ticket.save\n format.html { redirect_to @ticket, notice: 'Ticket was successfully created.' }\n format.json { render :show, status: :created, location: @ticket }\n else\n format.html { render :new }\n format.json { render json: @ticket.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @ticket = @current_user.tickets.build(ticket_params)\n respond_to do |format|\n if @ticket.save\n format.html { redirect_to @ticket, :notice => 'Ticket was successfully created.' }\n format.json { render :action => 'show', :status => :created, :location => @ticket }\n else\n format.html { render :action => 'new' }\n format.json { render :json => @ticket.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @ticket = Ticket.new(ticket_params)\n\n respond_to do |format|\n if @ticket.save\n format.html { redirect_to @ticket, notice: 'Ticket was successfully created.' }\n format.json { render :show, status: :created, location: @ticket }\n else\n format.html { render :new }\n format.json { render json: @ticket.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @ticket = Ticket.new(ticket_params)\n\n respond_to do |format|\n if @ticket.save\n format.html { redirect_to @ticket, notice: 'Ticket was successfully created.' }\n format.json { render :show, status: :created, location: @ticket }\n else\n format.html { render :new }\n format.json { render json: @ticket.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @ticket = Ticket.new(ticket_params)\n\n respond_to do |format|\n if @ticket.save\n format.html { redirect_to @ticket, notice: 'Ticket was successfully created.' }\n format.json { render :show, status: :created, location: @ticket }\n else\n format.html { render :new }\n format.json { render json: @ticket.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @ticket = Ticket.new(ticket_params)\n\n respond_to do |format|\n if @ticket.save\n format.html { redirect_to @ticket, notice: 'Ticket was successfully created.' }\n format.json { render :show, status: :created, location: @ticket }\n else\n format.html { render :new }\n format.json { render json: @ticket.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @ticket = Ticket.new(ticket_params)\n\n respond_to do |format|\n if @ticket.save\n format.html { redirect_to @ticket, notice: 'Ticket was successfully created.' }\n format.json { render :show, status: :created, location: @ticket }\n else\n format.html { render :new }\n format.json { render json: @ticket.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @ticket = Ticket.new(ticket_params)\n\n respond_to do |format|\n if @ticket.save\n format.html { redirect_to @ticket, notice: \"Ticket was successfully created.\" }\n format.json { render :show, status: :created, location: @ticket }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @ticket.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @tickets = []\n params[:quantity].to_i.times do\n @ticket = Ticket.new(params[:ticket])\n @ticket.viber = current_viber\n @tickets << @ticket\n end\n\n respond_to do |format|\n if @tickets.map(&:save)\n format.html { redirect_to @ticket, notice: 'Your ticket(s) are booked.' }\n format.json { render json: @ticket, status: :created, location: @ticket }\n else\n format.html { render action: \"new\" }\n format.json { render json: @ticket.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @ticket = Ticket.new(ticket_params)\n\n respond_to do |format|\n if @ticket.save\n format.html { redirect_to @ticket, notice: 'Ticket was successfully created.' }\n format.json { render action: 'show', status: :created, location: @ticket }\n else\n format.html { render action: 'new' }\n format.json { render json: @ticket.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @ticket = Ticket.new(ticket_params)\n\n respond_to do |format|\n if @ticket.save\n format.html { redirect_to @ticket, notice: 'Ticket was successfully created.' }\n format.json { render action: 'show', status: :created, location: @ticket }\n else\n format.html { render action: 'new' }\n format.json { render json: @ticket.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @ticket = Ticket.new(ticket_params_create)\n\n respond_to do |format|\n if @ticket.save\n TicketMailer.send_ticket_status(@ticket).deliver_later\n format.html { redirect_to @ticket, notice: 'Ticket was successfully created.' }\n format.json { render :show, status: :created, location: @ticket }\n else\n format.html { render :new }\n format.json { render json: @ticket.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @ticket.save\n\n respond_with(@story, @ticket)\n end",
"def create\n obj = JSON[request.body.read]\n @ticket = Ticket.new()\n @ticket.description = obj[\"description\"]\n @ticket.address = obj[\"address\"]\n @ticket.status = obj[\"status\"]\n @ticket.priority = obj[\"priority\"]\n @ticket.category = obj[\"category\"]\n @ticket.private = obj[\"private\"]\n @ticket.lat = obj[\"lat\"].to_f\n @ticket.lon = obj[\"lon\"].to_f\n @ticket.image = obj[\"image\"]\n if @ticket.save\n @ticket.image = nil\n render json: @ticket.to_json()\n else\n render json: @ticket.errors\n end\n end",
"def create\n @ticket = Ticket.new(ticket_params)\n @ticket.user = current_user if current_user\n\n respond_to do |format|\n if @ticket.save\n format.html { redirect_to @ticket, notice: 'Ticket was successfully created.' }\n format.json { render json: {id: @ticket.id, status: :created}, status: :created }\n else\n format.html { render :new }\n format.json { render json: @ticket.errors, status: :unprocessable_entity }\n end\n end\n end",
"def post_ticket(params)\n ticket = Lighthouse::Ticket.new(:project_id => project_id)\n ticket.title = params[:title]\n ticket.body = params[:body]\n ticket.tags = params[:tags]\n ticket.save\n end",
"def create\n @ticket = Ticket.new(ticket_params)\n\n respond_to do |format|\n if @ticket.save\n format.html { redirect_to \"/pages/user_dashboard\", notice: 'Ticket was successfully created.' }\n format.json { render :show, status: :created, location: @ticket }\n else\n format.html { render :new }\n format.json { render json: @ticket.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @ticket = Ticket.add(ticket_params)\n\n respond_to do |format|\n if @ticket\n UserMailer.welcome(@ticket).deliver\n format.html { redirect_to @ticket, notice: 'Ticket was successfully created.' }\n format.json { render :show, status: :created, location: @ticket }\n else\n format.html { render :new }\n format.json { render json: @ticket.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @ticket = Ticket.new(ticket_params)\np \"ticket_params: #{ticket_params}\"\n respond_to do |format|\n if @ticket.errors.size == 0 && @ticket.save\n format.html { redirect_to @ticket, notice: 'Ticket was successfully created.' }\n format.json { render :show, status: :created, location: @ticket }\n else\n format.html { render :new }\n format.json { render json: @ticket.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n #@ticket = Ticket.new(ticket_params)\n @ticket = current_user.tickets.build(ticket_params)\n\n respond_to do |format|\n if @ticket.save\n format.html { redirect_to @ticket, notice: \"Your ticket has been submitted. We will get back to you ASAP\" }\n format.json { render :show, status: :created, location: @ticket }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @ticket.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @ticket = Ticket.new(ticket_params)\n @ticket.user_id = current_user.id\n\n respond_to do |format|\n if @ticket.save\n format.html { redirect_to @ticket, notice: 'Ticket was successfully created.' }\n format.json { render :show, status: :created, location: @ticket }\n else\n format.html { render :new }\n format.json { render json: @ticket.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @ticket = Ticket.new(params[:ticket])\n @ticket.from_email = current_user.email\n @ticket.user_id = current_user.id\n\n respond_to do |format|\n if @ticket.save\n zt = ZendeskTicket.new(@ticket.platform)\n zt.build(@ticket, request.base_url)\n zd_ticket = zt.create\n @ticket.zendesk_ticket_id = zd_ticket.id\n @ticket.save\n\n msg = 'Your ticket was successfully created'\n\n format.html { redirect_to @ticket, notice: msg}\n format.json { render json: @ticket, status: :created, location: @ticket }\n else\n format.html { render action: \"new\" }\n format.json { render json: @ticket.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @ticket = Ticket.new(ticket_params)\n @ticket.user = current_user\n respond_to do |format|\n if @ticket.save\n format.html { redirect_to edit_ticket_path(@ticket), notice: 'Ticket was successfully created.' }\n format.json { render :show, status: :created, location: @ticket }\n else\n format.html { render :new }\n format.json { render json: @ticket.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n ticket_params.inspect\n @ticket = Ticket.new(ticket_params)\n @ticket.user = nil\n @ticket.status = \"for_sale\"\n respond_to do |format|\n if @ticket.save\n format.html { redirect_to @ticket, notice: 'Ticket was successfully created.' }\n format.json { render :show, status: :created, location: @ticket }\n else\n format.html { render :new }\n format.json { render json: @ticket.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @ticket = Ticket.new(params[:ticket])\n \n respond_to do |format|\n if @ticket.save\n format.html { redirect_to ticket_path( @ticket ), notice: '感謝您參與本次活動,我們將於 10 個工作日回覆您!' }\n format.json { render json: @ticket, status: :created, location: @ticket }\n else\n format.html { render action: \"new\" }\n format.json { render json: @ticket.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @admin_ticket = Ticket.new(params[:ticket])\n\n respond_to do |format|\n if @admin_ticket.save\n format.html { redirect_to admin_ticket_path(@admin_ticket), notice: 'Ticket was successfully created.' }\n format.json { render json: @admin_ticket, status: :created, location: @admin_ticket }\n else\n format.html { render action: \"new\" }\n format.json { render json: @admin_ticket.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @ticket = OTRS::Ticket.new(params[:ticket])\n\n respond_to do |wants|\n if @ticket.save\n flash[:notice] = 'Ticket was successfully created.'\n wants.html { redirect_to(@ticket) }\n wants.xml { render :xml => @ticket, :status => :created, :location => @ticket }\n wants.json { render :json => @ticket, :status => :created, :location => @ticket }\n else\n wants.html { render :action => \"new\" }\n wants.xml { render :xml => @ticket.errors, :status => :unprocessable_entity }\n wants.json { render :json => @ticket.errors.full_messages, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @ticket = Ticket.new(ticket_params)\n set_default_data\n respond_to do |format|\n if @ticket.save\n Account::Tickets::TicketLogs.create(@ticket)\n format.html { redirect_to account_tickets_path, notice: 'Ticket was successfully created.' }\n format.json { render :show, status: :created, location: @ticket }\n else\n format.html { render :new }\n format.json { render json: @ticket.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @ticket = Ticket.new(ticket_params)\n\n respond_to do |format|\n if @ticket.save\n UserMailer.welcome_email(@ticket).deliver\n format.html { redirect_to @ticket, notice: 'We received your query and answer you as soon as possible.' }\n format.json { render action: 'show', status: :created, location: @ticket }\n else\n format.html { render action: 'new' }\n format.json { render json: @ticket.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n event = Event.find(params[:event_id])\n batch_id = params[:batch_id] # for when an event has multiple types of tickets\n amount = params[:amount] # amount of tickets\n user_info = { anonymous: SecureRandom::hex } # instead of a random string this could have user info\n price = event.price * amount\n address = TicketAddresses.create_ticket_address(event.id, batch_id)\n\n ticket = Ticket.create!(\n event: event,\n batch_id: batch_id,\n amount: amount,\n price: price,\n user_info: user_info,\n address: address,\n status: :unconfirmed\n )\n\n render json: {\n address: address,\n salt: ticket.salt,\n price: event.price * amount,\n }\n end",
"def create_ticket(ticket)\n if ticket.priority.nil? or ticket.project_id.nil? or ticket.summary.nil?\n raise Unfuddled::Error.new(\"Must have Priority (1..5), Project ID and Summary\")\n end\n\n begin\n url = \"/api/v1/projects/#{ticket.project_id}/tickets.json\"\n id = send(:post , url, ticket.to_h)[:body][:id]\n \n # Add the ID with to ticket\n ticket.id = id\n\n # Attach the client to the ticket\n ticket.client = self\n \n ticket\n rescue Unfuddled::HTTPErrorResponse => error\n raise error\n end\n\n end",
"def create\n @ticket = @project.tickets.new(ticket_params)\n @ticket.reporter = @current_user\n\n respond_to do |format|\n if @ticket.save\n # User should auto-subscribe to tickets they create\n begin\n Subscription.create(user: @current_user, ticket: @ticket).save!\n rescue\n end\n format.html { redirect_to @ticket }\n format.json { render :show, status: :created, location: @ticket }\n else\n logger.debug @ticket.errors.inspect\n format.html { render :new }\n format.json { render json: @ticket.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @ticket = @customer.tickets.create(ticket_params)\n\n respond_to do |format|\n if @ticket.save\n format.html { redirect_to edit_customer_path(@customer), notice: 'Ticket was successfully created.' }\n format.json { render :show, status: :created, location: @ticket }\n else\n format.html { render :new }\n format.json { render json: @ticket.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @ticket = current_user.user_tries.last.tickets.build(ticket_params)\n\n respond_to do |format|\n if @ticket.save\n current_user.user_tries.last.state_machine.transition_to(:recruit)\n format.html { redirect_to root_path, notice: 'Ticket was successfully created.' }\n format.json { render :show, status: :created, location: @ticket }\n else\n format.html { render :new }\n format.json { render json: @ticket.errors, status: :unprocessable_entity }\n end\n end\n end",
"def UpdateTicket params = {}\n \n APICall(path: 'tickets.json',method: 'PUT',payload: params.to_json)\n \n end",
"def create\n @ticket = Ticket.new(admin_ticket_params)\n\n respond_to do |format|\n if @ticket.save\n format.html { redirect_to admin_tickets_url, notice: 'Ticket was successfully created.' }\n format.json { render action: 'index', status: :created, location: @ticket }\n else\n format.html { render action: 'new' }\n format.json { render json: @ticket.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @ticket = Ticket.new(ticket_params)\n @ticket.ticket_status = 'Waiting for Staff Response'\n @ticket.ticket_interface = 'New unassigned tickets'\n @ticket.make_uniq_reference\n\n TicketConfirmingMailer.new_ticket_confirmation(@ticket).deliver\n\n respond_to do |format|\n if @ticket.save\n format.html { redirect_to @ticket, notice: 'Ticket was successfully created.' }\n format.json { render action: 'show', status: :created, location: @ticket }\n else\n format.html { render action: 'new' }\n format.json { render json: @ticket.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @ticket = Ticket.new(ticket_params)\n @ticket.ticket_date = Time.now\n @ticket.user_id = current_user.id\n\n respond_to do |format|\n if @ticket.save\n update_warehouse\n format.html { \n flash[:notice] = 'La boleta se creó satisfactoriamente.'\n redirect_to tickets_path\n }\n format.json { render :show, status: :created, location: @ticket }\n else\n format.html { render :new }\n format.json { render json: @ticket.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @tickets = []\n order_number = 1\n order_number = Ticket.last.order_number + 1 unless Ticket.all.count == 0\n number_of_tickets = params[:number_of_tickets].to_i\n\n number_of_tickets.times do |num|\n @tickets[num] = Ticket.new(ticket_params)\n @tickets[num].number_of_tickets = n = params[:number_of_tickets]\n @tickets[num].amount_paid = (n.to_i)*10 - 20*((n.to_i)/12)\n @tickets[num].order_number = order_number\n @tickets[num].location = current_admin.event.name if current_admin && current_admin.event\n unless @tickets[num].payment_type\n @tickets[num].payment_type = params[:payment_type]\n end\n end\n\n @ticket = @tickets.first\n if @ticket.save\n @tickets.each do |ticket|\n ticket.save\n end\n Recipt.ticket_recipt(@ticket).deliver\n redirect_to ticket_path(@ticket), notice: \"Thank you for buying #{pluralize(number_of_tickets, 'raffle ticket')} #{@ticket.first_name}\"\n else\n render :new if current_admin\n render :new_wepay if !current_admin\n end\n end",
"def create\n authorize @ticket\n if @ticket.update_attributes(tag_list: @tags)\n render :json => @ticket.reload.tags, :status => :created\n else\n error!(:invalid_resource, @ticket.errors, \"Tags have not been saved\")\n end\n end",
"def create\n #@matches = Match.all\n\n @ticket = current_fan.tickets.new(params[:ticket])\n\n respond_to do |format|\n if @ticket.save\n format.html { redirect_to @ticket, notice: 'Ticket was successfully created.' }\n format.json { render json: @ticket, status: :created, location: @ticket }\n else\n format.html { render action: \"new\" }\n format.json { render json: @ticket.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @ticket = current_user.tickets.new(ticket_params)\n\n if @ticket.save\n redirect_to @ticket, notice: 'Ticket was successfully created.'\n else\n render :new\n end\n end",
"def create\n @ticket = Ticket.new(params[:ticket])\n\n respond_to do |format|\n if @ticket.save\n format.html { redirect_to(@ticket, :notice => 'Bilet został pomyślnie utworzony.') }\n format.xml { render :xml => @ticket, :status => :created, :location => @ticket }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @ticket.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def GetTickets params = {}\n\n params = params.merge(path: 'tickets.json')\n APICall(params)\n\n end",
"def create\n # user_id = params[\"user_id\"]\n user_id = @user.id\n store_id = params[\"store_id\"]\n \n @ticket = Ticket.new\n @ticket.user_id = user_id\n @ticket.store_id = store_id\n @ticket.cnt = get_new_ticket_number (store_id)\n\n respond_to do |format|\n if @ticket.save\n @newTicket = TicketsHelper::Ticket.new\n @newTicket.store_id = @ticket.store.id\n @newTicket.store_name = @ticket.store.name\n @newTicket.reg_time = @ticket.created_at\n @newTicket.wait_number = @ticket.cnt\n @newTicket.wait_ahead_count = get_current_user_wait_ahead_count(@ticket)\n \n format.html { redirect_to @ticket, notice: 'Ticket was successfully created.' }\n format.json { render :show}\n else\n format.html { render :new }\n format.json { render json: @ticket.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @ticket = Ticket.new\n @event = Event.find params[:event_id]\n @tiers = @event.tiers\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @ticket }\n end\n end",
"def create\n @ticket = Ticket.new(params[:ticket])\n\n \n #Security check. You can only add a ticket for an event you also created!´\n \n respond_to do |format|\n if @ticket.save\n flash[:notice] = 'Ticket was successfully created.'\n format.html { redirect_to tickets_path() }\n format.xml { render :xml => @ticket, :status => :created, :location => @ticket }\n else\n flash[:notice_bad] = 'Please fill in all required fields.'\n format.html { render :action => \"new\" }\n format.xml { render :xml => @ticket.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def new\n @ticket = Ticket.new(sprint: Sprint.current!)\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @ticket }\n end\n end",
"def create\n @ticket = @event.tickets.create(ticket_params)\n #@ticket.event_id = params[:modal]\n respond_to do |format|\n if @ticket.save\n format.html { redirect_to [@ticket.event, @ticket], notice: 'Ticket was successfully created.' }\n format.json { render action: 'show', status: :created, location: @ticket }\n else\n format.html { render action: 'new' }\n format.json { render json: @ticket.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @ticket_event = TicketEvent.new(ticket_event_params)\n\n respond_to do |format|\n if @ticket_event.save\n format.html { redirect_to @ticket_event, notice: 'Ticket event was successfully created.' }\n format.json { render :show, status: :created, location: @ticket_event }\n else\n format.html { render :new }\n format.json { render json: @ticket_event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n name = params[:name]\n seat = params[:seat]\n desc = params[:desc]\n group_name = params[:group]\n group = Group.where(name:group_name).first\n\n new_ticket = group.tickets.new(name:name,seat:seat,description:desc)\n\n if new_ticket.save\n notice = {\"notice\"=>\"new ticket created successfully.\"}\n puts notice.to_json\n redirect_to \"http://hacked.io/almanac/get-help/submitted\"\n else\n alert = {\"alert\"=>\"ticket was not created. check your params.\"}\n puts alert.to_json\n redirect_to \"http://hacked.io/almanac/get-help/not-submitted\"\n end\n end",
"def create\n puts \"llego\"\n @ticket = Ticket.new(ticket_params)\n if @ticket.save\n render_success_format('ticket created correctly', @ticket)\n end\n rescue Exception => e\n render_default_error e, 401\n e.inspect\n end",
"def create\n @ticket_owner = TicketOwner.new(params[:ticket_owner])\n\n respond_to do |format|\n if @ticket_owner.save\n format.html { redirect_to @ticket_owner, notice: 'Ticket Owner was successfully created.' }\n format.json { render json: @ticket_owner, status: :created, location: @ticket_owner }\n else\n format.html { render action: \"new\" }\n format.json { render json: @ticket_owner.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @ticket = Ticket.new(ticket_params)\n @ticket.customer = current_user\n respond_to do |format|\n if @ticket.save\n format.html { redirect_to @ticket, notice: 'Ticket was successfully created.' }\n format.json { render :show, status: :created, location: @ticket }\n else\n format.html { render :new }\n format.json { render json: @ticket.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @ticket = Ticket.new(params[:ticket])\n\n respond_to do |format|\n if @ticket.save\n flash[:notice] = 'Ticket was successfully created.'\n format.html { redirect_to(@ticket) }\n format.xml { render :xml => @ticket, :status => :created, :location => @ticket }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @ticket.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def new\n @ticket = Ticket.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @ticket }\n end\n end",
"def new\n @ticket = Ticket.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @ticket }\n end\n end",
"def new\n @ticket = Ticket.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @ticket }\n end\n end",
"def new\n @ticket = Ticket.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @ticket }\n end\n end",
"def getUserTickets\n @user = User.find(params[:id])\n render json: @user.tickets\n end",
"def create\n case params[:ticket][:type]\n when \"one-day\"\n @ticket = ParttimeTicket.new\n @ticket.day_count = 1\n when \"five-day\"\n @ticket = ParttimeTicket.new()\n @ticket.day_count = 5\n when \"twelve-day\"\n @ticket = ParttimeTicket.new()\n @ticket.day_count = 12\n when \"month\"\n @ticket = FulltimeTicket.new()\n end\n \n @ticket.creator_id = current_user.id;\n @ticket.user_id = current_user.id;\n \n respond_to do |format|\n if @ticket.save\n format.html { redirect_to(tickets_path, :notice => 'Ticket was successfully created.') }\n format.xml { render :xml => @ticket, :status => :created, :location => @ticket }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @ticket.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n \n @ticket = Ticket.new(params[:ticket])\n @ticket.ticket_status_id = 1\n @ticket.requestor_id = current_user.id\n @ticket.account_id = current_user.company.account_id\n\n respond_to do |format|\n if @ticket.save\n format.html { redirect_to(@ticket, :notice => 'Ticket was successfully created.') }\n format.xml { render :xml => @ticket, :status => :created, :location => @ticket }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @ticket.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n\n\n @ticket_detalle = TicketDetalle.new(ticket_detalle_params)\n\n respond_to do |format|\n if @ticket_detalle.save\n format.html { redirect_to ticket_path(@ticket_detalle.ticket_id), notice: 'Ticket detalle was successfully created.' }\n format.json { render :show, status: :created, location: @ticket_detalle }\n else\n format.html { render :new }\n format.json { render json: @ticket_detalle.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n n = params[:number_of_tickets].to_i\n\n # make sure there are enough tickets\n\n @ticket = Ticket.new(ticket_params)\n\n respond_to do |format|\n if @ticket.save\n @ticket.qrcode = \"http://gnome2home.herokuapp.com/scan/ticket?ticket_id=#{@ticket.id}\"\n @ticket.van.seats_available -= 1\n @ticket.van.save\n @ticket.save\n Recipt.send_recipt(@ticket).deliver\n (n-1).times do\n ticket = Ticket.new(ticket_params)\n ticket.save\n ticket.qrcode = \"http://gnome2home.herokuapp.com/scan/ticket?ticket_id=#{ticket.id}\"\n ticket.van.seats_available -= 1\n ticket.van.save\n ticket.save\n Recipt.send_recipt(ticket).deliver\n end\n\n if n == 1\n format.html { redirect_to @ticket, notice: 'Thank you for riding Gnome2Home. You will receive an email shortly with your QR code and confirmation number' }\n format.json { render :show, status: :created, location: @ticket }\n else\n format.html { redirect_to edit_passenger_registration_path, notice: \"Thanks for buying #{n} tickets. You can view all of you purchased tickets below. You will receive #{n} separate emails, each with a unique QR code ticket. Please keep those emails to check in. \"}\n format.json { render :show, status: :created, location: @ticket }\n end\n\n else\n format.html { render :new }\n format.json { render json: @ticket.errors, status: :unprocessable_entity }\n end\n end\n\n\n end",
"def create_ticket(params = {})\n Ticket.create(self, params)\n end",
"def index\n respond_with(@tickets)\n end",
"def new\n @tickets_count = Helpdesk::Ticket.where(:requester_id => helpdesk_user.id).active.count\n @ticket = Helpdesk::Ticket.new\n @ticket.status = Helpdesk::Ticket::STATUSES[0][0]\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @ticket }\n end\n end",
"def create\n @ticketing = Ticketing.new(ticketing_params)\n\n respond_to do |format|\n if @ticketing.save\n format.html { redirect_to @ticketing, notice: \"Ticketing was successfully created.\" }\n format.json { render :show, status: :created, location: @ticketing }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @ticketing.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @ticket = Ticket.new(ticket_params)\n\n if @ticket.save\n @obj = {\n id: @ticket.id,\n title: @ticket.title,\n body: @ticket.body,\n statu_id: @ticket.statu_id,\n user_id: @ticket.user_id,\n active: @ticket.active,\n image: @ticket.image.attached? ? url_for(@ticket.image) : nil,\n media: @ticket.image.attached? ? url_for(@ticket.image) : nil\n }\n render json: @obj, status: :created, location: @obj\n # 'ticket was successfully created.'\n else\n render json: @ticket.errors, status: :unprocessable_entity\n end\n end",
"def create\n @ticket = Ticket.new(ticket_params)\n respond_to do |format|\n if @ticket.save\n if @ticket.table_id\n Table.find(@ticket.table_id).update(status: Table.statuses[:occupied])\n end\n if @ticket.customer_id\n Customer.find(@ticket.customer_id).update(status: Customer.statuses[:occupied])\n end\n format.html { redirect_to @ticket, notice: 'Ticket was successfully created.' }\n format.json { render :show, status: :created, location: @ticket }\n else\n format.html { render :new }\n format.json { render json: @ticket.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n #@matches = Match.all\n @title = \"New Ticket\"\n @ticket = Ticket.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @ticket }\n end\n end",
"def GetTicket id\n\n APICall(path: \"tickets/#{id}.json\")\n\n end",
"def save_ticket(ticket)\n stmt = \"INSERT INTO #{@@tickets_table} values(#{ticket.id}, '#{ticket.requester.to_json}', '#{ticket.status}', '#{ticket.subject}', '#{ticket.content}', '#{ticket.created_at}', '#{ticket.updated_at}', '#{ticket.comment}')\"\n execute_statement(stmt)\n end",
"def ticket_params\n params.require(:ticket).permit(:name, :seat_id_seq, :address, :price, :email_address, :event_id)\n end",
"def show\n render json: @ticket\n end",
"def create\n \n if @diagnostic.nil?\n @ticket = Ticket.new(ticket_params)\n #@expected_date = @ticket.due_date + 3.days\n \n else\n \n @diagnostic = @ticket.diagnostics.build(diagnostic_params)\n @ticket = Ticket.new(ticket_params)\n @ticket = @client.tickets.build(ticket_params)\n @ticket = @computer.tickets.build(ticket_params)\n \nend\n\n respond_to do |format|\n if @ticket.save\n \n format.html { redirect_to @ticket, notice: 'Ticket was successfully created.' }\n format.json { render :show, status: :created, location: @ticket }\n else\n format.html { render :new }\n format.json { render json: @ticket.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_ticket\n jiraPair = @defect.getJiraList\n mapping = jiraAPIMapping\n payload = {\n :fields =>\n {:project =>\n {:key => \"#{jiraPair['Project']}\"},\n :summary => jiraPair['Summary'] + \" (#{@defect.get_story})\",\n :description => Sanitize.clean(jiraPair['Description']),\n mapping['Release Milestone'] => {:value => jiraPair['Release Milestone']},\n :customfield_10143 => [{:value => jiraPair['Environment'],}],\n :issuetype => {:name => jiraPair['issuetype']},\n mapping['Functional Group'] => {:value => jiraPair['Functional Group']},\n mapping['Project Manager'] => {:value => jiraPair['Project Manager']},\n :versions => [{:name => \"#{jiraPair['Release']}\",}],\n },\n }\n\n response = self.class.post('/rest/api/latest/issue/',\n :body => payload.to_json,\n :headers => {'Content-Type' => 'application/json' },\n :verify => false)\n\n url = \"\"\n if response['key']\n url = $JIRA['base_uri'] + \"/browse/\" + response['key']\n @defect.setJiraLink(url)\n else\n errormsg = \"Error (#{@defect.get_story}): #{response}\"\n p errormsg\n @defect.setDefectError(errormsg)\n end\n\n return url\n end",
"def create\n respond_to do |format|\n if @support_ticket.save\n format.html { redirect_to @support_ticket, notice: 'Support ticket was successfully created.' }\n format.json { render json: @support_ticket, status: :created, location: @support_ticket }\n else\n format.html { render action: \"new\" }\n format.json { render json: @support_ticket.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @title = \"Tickets\"\n @tickets = Ticket.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @tickets }\n end\n end",
"def create\n @support_ticket = SupportTicket.new(support_ticket_params)\n\n respond_to do |format|\n if @support_ticket.save\n format.html { redirect_to @support_ticket, notice: 'Support ticket was successfully created.' }\n format.json { render :show, status: :created, location: @support_ticket }\n else\n format.html { render :new }\n format.json { render json: @support_ticket.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @tickets = Ticket.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ticket }\n end\n end",
"def create\n if ProjectUser.verify_role(current_user.id, @project, 'client')\n @ticket = Ticket.new(new_ticket_params)\n @ticket.user_id = current_user.id\n @ticket.project_id = @project # params[:project_id]\n\n if @ticket.save\n render json: @ticket, status: :created\n else\n render json: @ticket.errors, status: :unprocessable_entity\n end\n else\n render json: { error: 'YYou must be a member of a project to see its content' }, status: :unauthorized\n end\n end",
"def new\n @admin_ticket = Ticket.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @admin_ticket }\n end\n end",
"def ticket_params\n params.require(:ticket).permit(:data_entrada, :data_saida)\n end",
"def ticket_params\n params.require(:ticket).permit(:description, :quantity, :value, :email, :active, :profiles, :event_id)\n end",
"def ticket_params\n params.require(:ticket).permit(:id, :title, :description, :status, \n :first_name, :last_name, :address, :city, :province, :postalcode, :department_id,\n :address_confirm, :user_id, :date_in, :country, :phone_number, :reporter_id, :user_id)\n end",
"def ticket_params\n params.require(:ticket).permit(:title, :description, :owner_id)\n end",
"def ticket_params\n params.require(:ticket).permit(:name, :email, :feedback, :company,\n :attend_dinner, :attend_speakers_dinner, :dietary_info, :ticket_type_id, :reference)\n end",
"def ticket_params\n params.require(:ticket).permit(:name, :email, :feedback, :company,\n :attend_dinner, :attend_speakers_dinner, :dietary_info, :ticket_type_id, :reference)\n end",
"def ticket_params\n params.require(:ticket).permit(:title, :body, :status, :agent, :customer, :department, :priorety, :done_date)\n end",
"def ticket_params\n params.require(:ticket).permit(:name, :description, :price, :quantity, :sales_start_datetime, :sales_end_datetime, :event_id)\n end",
"def ticket_params\n params[:ticket] = params[:ticket].permit(:user_id, :email, :ticket_mode_id, :ticket, :ticket_key, :request_ip, :etc, :ticket_status_id)\n end",
"def ticket_params\n params.require(:ticket).permit(:title, :description)\n end",
"def ticket_params\n params.require(:ticket).permit(:title, :description, :priority, :customer_id, :agent_id, :status)\n end",
"def create\n @ticket = Ticket.new(params[:ticket])\n @ticket.previous_assignee_id = nil\n @ticket.updater_id = session[:user]\n \n respond_to do |format|\n if @ticket.save\n flash[:notice] = 'Ticket was successfully created.'\n format.html { redirect_to @coll_url }\n format.xml { head :created, :location => ticket_url(@ticket) }\n else\n @content_title = @title = @ticket.asset.nil? ? 'Editing new ticket' : \"Editing new ticket for #{a.title}\"\n @submit_value = 'Create'\n format.html { render :action => \"new\" }\n format.xml { render :xml => @ticket.errors.to_xml }\n end\n end\n end",
"def ticket_params\n params.require(:ticket).permit(:folio, :logo, :people, :total, :cupon_id, :ticket_type_id, :event_id)\n end"
] |
[
"0.78799874",
"0.72312945",
"0.70262116",
"0.7003522",
"0.69879574",
"0.6953623",
"0.6908814",
"0.6908814",
"0.6908814",
"0.6908814",
"0.6908253",
"0.6900516",
"0.6867757",
"0.68270665",
"0.68270665",
"0.6817758",
"0.6763566",
"0.67327195",
"0.6725813",
"0.67150265",
"0.66922444",
"0.6691442",
"0.66860586",
"0.6658263",
"0.6643318",
"0.6626259",
"0.66180515",
"0.66118246",
"0.6590673",
"0.6587429",
"0.65818816",
"0.6580587",
"0.6579579",
"0.6565412",
"0.6563857",
"0.6561437",
"0.6537606",
"0.65065867",
"0.6505216",
"0.650065",
"0.6493916",
"0.64936316",
"0.64883804",
"0.6471634",
"0.6461491",
"0.64524114",
"0.6417569",
"0.64086425",
"0.6382189",
"0.6374586",
"0.6374559",
"0.6355131",
"0.63503855",
"0.6320543",
"0.63148314",
"0.6313446",
"0.6308203",
"0.6255609",
"0.6255548",
"0.62480724",
"0.62480724",
"0.62480724",
"0.62480724",
"0.62342924",
"0.6227963",
"0.619242",
"0.6185397",
"0.61701834",
"0.6156673",
"0.6147328",
"0.61402583",
"0.6131311",
"0.61288697",
"0.6115781",
"0.6115233",
"0.6111845",
"0.60886896",
"0.6073091",
"0.6067848",
"0.60590523",
"0.6058015",
"0.6043905",
"0.60316056",
"0.6021358",
"0.6020451",
"0.6012875",
"0.6006479",
"0.5986378",
"0.5986318",
"0.59842694",
"0.5980928",
"0.59719753",
"0.59719753",
"0.59654796",
"0.5964137",
"0.5945812",
"0.59451646",
"0.5940931",
"0.59338033",
"0.59327936"
] |
0.70381755
|
2
|
PUT /tickets/1 PUT /tickets/1.json
|
def update
@ticket = Ticket.find(params[:id])
respond_to do |format|
if @ticket.update_attributes(params[:ticket])
format.html { redirect_to @ticket, notice: 'Ticket was successfully updated.' }
format.json { head :no_content }
else
format.html { render action: 'edit' }
format.json { render json: @ticket.errors, status: :unprocessable_entity }
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def UpdateTicket params = {}\n \n APICall(path: 'tickets.json',method: 'PUT',payload: params.to_json)\n \n end",
"def update\n @ticket.update_attributes(params[:ticket])\n\n respond_with(@story, @ticket)\n end",
"def update\n @ticket = @event.tickets.find(params[:id])\n respond_to do |format|\n if @ticket.update(ticket_params)\n format.html { redirect_to event_ticket_path(@event.ticket), notice: 'Ticket was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @ticket.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @ticket.update(ticket_params)\n\n end",
"def update\n @ticket = Ticket.find(params[:id])\n\n respond_to do |format|\n if @ticket.update_attributes(params[:ticket])\n format.html { redirect_to tickets_path, notice: 'Ticket was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @ticket.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @ticket = Ticket.find(params[:id])\n\n respond_to do |format|\n if @ticket.update_attributes(params[:ticket])\n format.html { redirect_to @ticket, notice: 'Ticket was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @ticket.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @ticket = Ticket.find(params[:id])\n\n respond_to do |format|\n if @ticket.update_attributes(params[:ticket])\n format.html { redirect_to @ticket, notice: 'Ticket was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @ticket.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @ticket = Ticket.find(params[:id])\n\n respond_to do |format|\n if @ticket.update_attributes(params[:ticket])\n format.html { redirect_to @ticket, notice: 'Ticket was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @ticket.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @ticket = Ticket.find(params[:id])\n\n respond_to do |format|\n if @ticket.update_attributes(params[:ticket])\n format.html { redirect_to @ticket, notice: 'Ticket was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @ticket.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @ticket = Ticket.find(params[:id])\n\n respond_to do |format|\n if @ticket.update_attributes(params[:ticket])\n format.html { redirect_to @ticket, notice: 'Ticket was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @ticket.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @ticket.update(ticket_params)\n format.html { redirect_to @ticket, notice: 'Ticket updated.' }\n format.json { render :show, status: :ok, location: @ticket }\n else\n format.html { render :edit }\n format.json { render json: @ticket.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n a = Ticket.find(params[:id])\n a.destroy()\n render json: \"success\"\n end",
"def update\n logger.info { \"PARAMS: #{params.inspect}\" }\n project_id, id = params[:id].split('-')\n ticket = Lighthouse::Ticket.find(id, :params => {:project_id => project_id})\n \n # insanely hacky. can't nest json, so don't want to do a willy-nilly merge.\n # move mergeable params to the [:ticket] hash to follow usual rails conventions\n # before merging\n params[:ticket] = {}\n %w(assigned_user_id state milestone_id).each do |field|\n params[:ticket].merge!( field => params.delete(field) ) if params[field]\n end\n logger.info { \"TICKET ATTRS TO UPDATE: #{params[:ticket].inspect}\"}\n \n ticket.attributes.merge!( params[:ticket] )\n ticket.save\n\n respond_to do |format|\n # if @ticket.update_attributes(params[:ticket])\n # flash[:notice] = 'Ticket was successfully updated.'\n # format.html { redirect_to(@ticket) }\n # format.xml { head :ok }\n # else\n # format.html { render :action => \"edit\" }\n # format.xml { render :xml => @ticket.errors, :status => :unprocessable_entity }\n # end\n end\n end",
"def update\n respond_to do |format|\n if @ticket.update(ticket_params)\n format.html { redirect_to @ticket, notice: 'Ticket was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :edit }\n format.json { render json: @ticket.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @ticket.update(ticket_params)\n format.html { redirect_to @ticket, notice: \"Ticket was successfully updated.\" }\n format.json { render :show, status: :ok, location: @ticket }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @ticket.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @ticket.update(ticket_params)\n format.html { redirect_to @ticket, notice: \"Ticket was successfully updated.\" }\n format.json { render :show, status: :ok, location: @ticket }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @ticket.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @ticket.update(ticket_params)\n format.html { redirect_to @ticket, notice: 'Ticket was successfully updated.' }\n format.json { render :show, status: :ok, location: @ticket }\n else\n format.html { render :edit }\n format.json { render json: @ticket.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @ticket.update(ticket_params)\n format.html { redirect_to @ticket, notice: 'Ticket was successfully updated.' }\n format.json { render :show, status: :ok, location: @ticket }\n else\n format.html { render :edit }\n format.json { render json: @ticket.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @ticket.update(ticket_params)\n format.html { redirect_to @ticket, notice: 'Ticket was successfully updated.' }\n format.json { render :show, status: :ok, location: @ticket }\n else\n format.html { render :edit }\n format.json { render json: @ticket.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @ticket.update(ticket_params)\n format.html { redirect_to @ticket, notice: 'Ticket was successfully updated.' }\n format.json { render :show, status: :ok, location: @ticket }\n else\n format.html { render :edit }\n format.json { render json: @ticket.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @ticket.update(ticket_params)\n format.html { redirect_to @ticket, notice: 'Ticket was successfully updated.' }\n format.json { render :show, status: :ok, location: @ticket }\n else\n format.html { render :edit }\n format.json { render json: @ticket.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @ticket.update(ticket_params)\n format.html { redirect_to @ticket, notice: 'Ticket was successfully updated.' }\n format.json { render :show, status: :ok, location: @ticket }\n else\n format.html { render :edit }\n format.json { render json: @ticket.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @ticket.update(ticket_params)\n format.html { redirect_to @ticket, notice: 'Ticket was successfully updated.' }\n format.json { render :show, status: :ok, location: @ticket }\n else\n format.html { render :edit }\n format.json { render json: @ticket.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @ticket.update(ticket_params)\n format.html { redirect_to @ticket, notice: 'Ticket was successfully updated.' }\n format.json { render :show, status: :ok, location: @ticket }\n else\n format.html { render :edit }\n format.json { render json: @ticket.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @ticket.update(ticket_params)\n format.html { redirect_to @ticket, notice: 'Ticket was successfully updated.' }\n format.json { render :show, status: :ok, location: @ticket }\n else\n format.html { render :edit }\n format.json { render json: @ticket.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @ticket.update(ticket_params)\n format.html { redirect_to @ticket, notice: 'Ticket was successfully updated.' }\n format.json { render :show, status: :ok, location: @ticket }\n else\n format.html { render :edit }\n format.json { render json: @ticket.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @ticket.update(ticket_params)\n format.html { redirect_to @ticket, notice: 'Ticket was successfully updated.' }\n format.json { render :show, status: :ok, location: @ticket }\n else\n format.html { render :edit }\n format.json { render json: @ticket.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @ticket.update(ticket_params)\n format.html { redirect_to @ticket, notice: 'Ticket was successfully updated.' }\n format.json { render :show, status: :ok, location: @ticket }\n else\n format.html { render :edit }\n format.json { render json: @ticket.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @ticket.update(ticket_params)\n format.html { redirect_to @ticket, notice: 'Ticket was successfully updated.' }\n format.json { render :show, status: :ok, location: @ticket }\n else\n format.html { render :edit }\n format.json { render json: @ticket.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @ticket.update(ticket_params)\n format.html { redirect_to @ticket, notice: 'Ticket was successfully updated.' }\n format.json { render :show, status: :ok, location: @ticket }\n else\n format.html { render :edit }\n format.json { render json: @ticket.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @ticket.update(ticket_params)\n format.html { redirect_to @ticket, notice: 'Ticket was successfully updated.' }\n format.json { render :show, status: :ok, location: @ticket }\n else\n format.html { render :edit }\n format.json { render json: @ticket.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @ticket.update(ticket_params)\n format.html { redirect_to @ticket, notice: 'Ticket was successfully updated.' }\n format.json { render :show, status: :ok, location: @ticket }\n else\n format.html { render :edit }\n format.json { render json: @ticket.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @ticket.update(ticket_params)\n format.html { redirect_to @ticket, notice: 'Ticket was successfully updated.' }\n format.json { render :show, status: :ok, location: @ticket }\n else\n format.html { render :edit }\n format.json { render json: @ticket.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @ticket.update(ticket_params)\n format.html { redirect_to @ticket, notice: 'Ticket was successfully updated.' }\n format.json { render :show, status: :ok, location: @ticket }\n else\n format.html { render :edit }\n format.json { render json: @ticket.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @ticket.update(ticket_params)\n format.html { redirect_to @ticket, notice: 'Ticket was successfully updated.' }\n format.json { render json: {status: :ok}, status: :ok }\n else\n format.html { render :edit }\n format.json { render json: @ticket.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @ticket.update(ticket_params)\n format.html { redirect_to @ticket, notice: 'Ticket was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @ticket.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @ticket.update(ticket_params)\n format.html { redirect_to @ticket, notice: 'Ticket was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @ticket.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @ticket.update(ticket_params)\n format.html { redirect_to @ticket, notice: 'Ticket was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @ticket.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @ticket.update(ticket_params)\n format.html { redirect_to edit_ticket_path(@ticket), notice: 'Ticket was successfully updated.' }\n format.json { render :show, status: :ok, location: @ticket }\n else\n format.html { render :edit }\n format.json { render json: @ticket.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @ticket = Ticket.find(params[:id])\n\n respond_to do |format|\n if @ticket.update_attributes(params[:ticket])\n format.html { redirect_to @ticket, notice: 'Home was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @ticket.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @ticket = Helpdesk::Ticket.find(params[:id])\n\n respond_to do |format|\n if @ticket.update_attributes(ticket_params)\n format.html { redirect_to @ticket, notice: 'Ticket was successfully updated.'}\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @ticket.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @ticket.update(ticket_params)\n format.html { \n flash[:notice] = 'La boleta se actualizó satisfactoriamente.'\n redirect_to tickets_path\n }\n format.json { render :show, status: :ok, location: @ticket }\n else\n format.html { render :edit }\n format.json { render json: @ticket.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if @ticket.update(@ticket_params)\n render_success_format('client created correctly', @ticket)\n end\n rescue StandardError => e\n Airbrake.notify(e)\n raise e\n end",
"def update\n @ticket = Ticket.find(params[:id])\n\n respond_to do |format|\n if @ticket.update_attributes(params[:ticket])\n flash[:notice] = 'Ticket was successfully updated.'\n format.html { redirect_to(@ticket) }\n format.xml { head :ok }\n else\n format.html { render :edit }\n format.xml { render :xml => @ticket.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @ticket = @project.tickets.find_by_scoped_id!(params[:id])\n\n respond_to do |format|\n if @ticket.update_attributes(params[:ticket])\n format.html { redirect_to([@project, @ticket], :notice => 'Ticket was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @ticket.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @ticket = Ticket.find(params[:id])\n\n respond_to do |format|\n if @ticket.update_attributes(params[:ticket])\n format.html { redirect_to(@ticket, :notice => 'Ticket was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @ticket.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @ticket = Ticket.find(params[:id])\n\n respond_to do |format|\n if @ticket.update_attributes(params[:ticket])\n flash[:notice] = 'Ticket was successfully updated.'\n format.html { redirect_to(@ticket) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @ticket.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @ticket = Ticket.find(params[:id])\n\n respond_to do |format|\n if @ticket.update_attributes(params[:ticket])\n flash[:notice] = 'Ticket was successfully updated.'\n format.html { redirect_to(@ticket) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @ticket.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @ticket_owner = TicketOwner.find(params[:id])\n\n respond_to do |format|\n if @ticket_owner.update_attributes(params[:ticket_owner])\n format.html { redirect_to @ticket_owner, notice: 'Ticket Owner was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @ticket_owner.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_ticket\n @ticket = Ticket.find(params[:id])\n end",
"def set_ticket\n @ticket = Ticket.find(params[:id])\n end",
"def set_ticket\n @ticket = Ticket.find(params[:id])\n end",
"def set_ticket\n @ticket = Ticket.find(params[:id])\n end",
"def set_ticket\n @ticket = Ticket.find(params[:id])\n end",
"def set_ticket\n @ticket = Ticket.find(params[:id])\n end",
"def set_ticket\n @ticket = Ticket.find(params[:id])\n end",
"def set_ticket\n @ticket = Ticket.find(params[:id])\n end",
"def set_ticket\n @ticket = Ticket.find(params[:id])\n end",
"def set_ticket\n @ticket = Ticket.find(params[:id])\n end",
"def set_ticket\n @ticket = Ticket.find(params[:id])\n end",
"def set_ticket\n @ticket = Ticket.find(params[:id])\n end",
"def set_ticket\n @ticket = Ticket.find(params[:id])\n end",
"def set_ticket\n @ticket = Ticket.find(params[:id])\n end",
"def set_ticket\n @ticket = Ticket.find(params[:id])\n end",
"def set_ticket\n @ticket = Ticket.find(params[:id])\n end",
"def set_ticket\n @ticket = Ticket.find(params[:id])\n end",
"def set_ticket\n @ticket = Ticket.find(params[:id])\n end",
"def set_ticket\n @ticket = Ticket.find(params[:id])\n end",
"def set_ticket\n @ticket = Ticket.find(params[:id])\n end",
"def set_ticket\n @ticket = Ticket.find(params[:id])\n end",
"def set_ticket\n @ticket = Ticket.find(params[:id])\n end",
"def set_ticket\n @ticket = Ticket.find(params[:id])\n end",
"def set_ticket\n @ticket = Ticket.find(params[:id])\n end",
"def set_ticket\n @ticket = Ticket.find(params[:id])\n end",
"def set_ticket\n @ticket = Ticket.find(params[:id])\n end",
"def set_ticket\n @ticket = Ticket.find(params[:id])\n end",
"def set_ticket\n @ticket = Ticket.find(params[:id])\n end",
"def set_ticket\n @ticket = Ticket.find(params[:id])\n end",
"def set_ticket\n @ticket = Ticket.find(params[:id])\n end",
"def set_ticket\n @ticket = Ticket.find(params[:id])\n end",
"def set_ticket\n @ticket = Ticket.find(params[:id])\n end",
"def set_ticket\n @ticket = Ticket.find(params[:id])\n end",
"def set_ticket\n @ticket = Ticket.find(params[:id])\n end",
"def set_ticket\n @ticket = Ticket.find(params[:id])\n end",
"def set_ticket\n @ticket = Ticket.find(params[:id])\n end",
"def set_ticket\n @ticket = Ticket.find(params[:id])\n end",
"def set_ticket\n @ticket = Ticket.find(params[:id])\n end",
"def set_ticket\n @ticket = Ticket.find(params[:id])\n end",
"def set_ticket\n @ticket = Ticket.find(params[:id])\n end",
"def set_ticket\n @ticket = Ticket.find(params[:id])\n end",
"def set_ticket\n @ticket = Ticket.find(params[:id])\n end",
"def set_ticket\n @ticket = Ticket.find(params[:id])\n end",
"def set_ticket\n @ticket = Ticket.find(params[:id])\n end",
"def set_ticket\n @ticket = Ticket.find(params[:id])\n end",
"def set_ticket\n @ticket = Ticket.find(params[:id])\n end",
"def set_ticket\n @ticket = Ticket.find(params[:id])\n end",
"def update\n @ticket = Ticket.find(params[:id])\n\n respond_to do |format|\n if @ticket.update_attributes(params[:ticket])\n format.html { redirect_to(@ticket, :notice => 'Bilet został pomyślnie zaktualizowany.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @ticket.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def set_ticket\n @ticket = Ticket.find(params[:id]) if params[:id]\n end",
"def GetTicket id\n\n APICall(path: \"tickets/#{id}.json\")\n\n end",
"def set_ticket\n @ticket = Ticket.find(params[:ticket_id])\n end"
] |
[
"0.7889341",
"0.69945663",
"0.6989293",
"0.6935721",
"0.6854655",
"0.68403566",
"0.68403566",
"0.68403566",
"0.68403566",
"0.68403566",
"0.68029016",
"0.6772724",
"0.67701954",
"0.6749982",
"0.6736265",
"0.6736265",
"0.67348725",
"0.6734714",
"0.6734714",
"0.6734714",
"0.6734714",
"0.6734714",
"0.6734714",
"0.6734714",
"0.6734714",
"0.6734714",
"0.6734714",
"0.6734714",
"0.6734714",
"0.6734714",
"0.6734714",
"0.6734714",
"0.6734714",
"0.6734714",
"0.67329395",
"0.66988254",
"0.66988254",
"0.66988254",
"0.6652051",
"0.66391903",
"0.6627831",
"0.65804374",
"0.6574883",
"0.6499381",
"0.64986265",
"0.64673764",
"0.6447304",
"0.6447304",
"0.64341503",
"0.6404371",
"0.6404371",
"0.6404371",
"0.6404371",
"0.6404371",
"0.6404371",
"0.6404371",
"0.6404371",
"0.63632286",
"0.63632286",
"0.63632286",
"0.63632286",
"0.63632286",
"0.63632286",
"0.63632286",
"0.63632286",
"0.63632286",
"0.63632286",
"0.63632286",
"0.63632286",
"0.63632286",
"0.63632286",
"0.63632286",
"0.63632286",
"0.63632286",
"0.63632286",
"0.63632286",
"0.63632286",
"0.63632286",
"0.63632286",
"0.63632286",
"0.63632286",
"0.63632286",
"0.63632286",
"0.63632286",
"0.63632286",
"0.63632286",
"0.63632286",
"0.63632286",
"0.63632286",
"0.63632286",
"0.63632286",
"0.63632286",
"0.63632286",
"0.63632286",
"0.63632286",
"0.63632286",
"0.6362377",
"0.6318456",
"0.63122934",
"0.6308638"
] |
0.6851879
|
5
|
DELETE /tickets/1 DELETE /tickets/1.json
|
def destroy
@ticket = Ticket.find(params[:id])
@ticket.destroy
if request.xhr?
render nothing: true
else
respond_to do |format|
format.html { redirect_to tickets_url(params.except(:action, :controller, :_method, :authenticity_token, :utf8, :id)) }
format.json { head :no_content }
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def DeleteTicket id\n \n APICall(path: \"tickets/#{id}.json\",method: 'DELETE')\n \n end",
"def destroy\n @ticket.destroy\n respond_to do |format|\n format.html { redirect_to tickets_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ticket.destroy\n respond_to do |format|\n format.html { redirect_to tickets_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ticket.destroy\n respond_to do |format|\n format.html { redirect_to tickets_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ticket.destroy\n respond_to do |format|\n format.html { redirect_to tickets_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ticket.destroy\n respond_to do |format|\n format.html { redirect_to tickets_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ticket.destroy\n respond_to do |format|\n format.html { redirect_to tickets_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ticket = Ticket.find(params[:id])\n @ticket.destroy\n\n respond_to do |format|\n format.html { redirect_to tickets_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ticket = Ticket.find(params[:id])\n @ticket.destroy\n\n respond_to do |format|\n format.html { redirect_to tickets_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ticket = Ticket.find(params[:id])\n @ticket.destroy\n\n respond_to do |format|\n format.html { redirect_to tickets_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ticket = Ticket.find(params[:id])\n @ticket.destroy\n\n respond_to do |format|\n format.html { redirect_to tickets_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ticket = Ticket.find(params[:id])\n @ticket.destroy\n\n respond_to do |format|\n format.html { redirect_to tickets_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ticket = Ticket.find(params[:id])\n @ticket.destroy\n\n respond_to do |format|\n format.html { redirect_to tickets_url }\n format.json { head :no_content }\n end\n end",
"def delete id\n\t\t@tickets.delete ['id', id]\n\tend",
"def destroy\n @ticket = @event.tickets.find(params[:id])\n @ticket.destroy\n respond_to do |format|\n format.html { redirect_to event_tickets_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ticket = Ticket.find(params[:id])\n @ticket.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_tickets_url }\n format.json { head :no_content }\n end\n end",
"def delete_ticket\n @ticket = Ticket.find(params[:id])\n @ticket.delete\n \n render :nothing => true\n end",
"def destroy\n @ticket.destroy\n respond_to do |format|\n format.html { redirect_to admin_tickets_url, notice: 'Ticket delete successfully.' }\n format.json { head :no_content }\n end\n end",
"def update\n a = Ticket.find(params[:id])\n a.destroy()\n render json: \"success\"\n end",
"def destroy\n @ticket.destroy\n respond_to do |format|\n format.html { redirect_to tickets_url, notice: 'Ticket was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ticket.destroy\n respond_to do |format|\n format.html { redirect_to tickets_url, notice: 'Ticket was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ticket.destroy\n respond_to do |format|\n format.html { redirect_to tickets_url, notice: 'Ticket was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ticket.destroy\n respond_to do |format|\n format.html { redirect_to tickets_url, notice: 'Ticket was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ticket.destroy\n respond_to do |format|\n format.html { redirect_to tickets_url, notice: 'Ticket was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ticket.destroy\n respond_to do |format|\n format.html { redirect_to tickets_url, notice: 'Ticket was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ticket.destroy\n respond_to do |format|\n format.html { redirect_to tickets_url, notice: 'Ticket was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ticket.destroy\n respond_to do |format|\n format.html { redirect_to tickets_url, notice: 'Ticket was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ticket.destroy\n respond_to do |format|\n format.html { redirect_to tickets_url, notice: 'Ticket was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ticket.destroy\n respond_to do |format|\n format.html { redirect_to tickets_url, notice: 'Ticket was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ticket.destroy\n respond_to do |format|\n format.html { redirect_to tickets_url, notice: 'Ticket was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ticket.destroy\n respond_to do |format|\n format.html { redirect_to tickets_url, notice: 'Ticket was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ticket.destroy\n respond_to do |format|\n format.html { redirect_to tickets_url, notice: 'Ticket was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ticket.destroy\n respond_to do |format|\n format.html { redirect_to tickets_url, notice: 'Ticket was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ticket.destroy\n respond_to do |format|\n format.html { redirect_to tickets_url, notice: 'Ticket was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ticket.destroy\n respond_to do |format|\n format.html { redirect_to tickets_url, notice: 'Ticket was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ticket.destroy\n respond_to do |format|\n format.html { redirect_to tickets_url, notice: 'Ticket was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ticket.destroy\n respond_to do |format|\n format.html { redirect_to tickets_url, notice: 'Ticket was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ticket.destroy\n respond_to do |format|\n format.html { redirect_to tickets_url, notice: 'Ticket was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ticket.destroy\n respond_to do |format|\n format.html { redirect_to tickets_url, notice: 'Ticket was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ticket.destroy\n respond_to do |format|\n format.html { redirect_to tickets_url, notice: 'Ticket was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ticket.destroy\n respond_to do |format|\n format.html { redirect_to @ticket.project, notice: 'Ticket deleted.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ticket.destroy\n respond_to do |format|\n format.html { redirect_to tickets_url, notice: \"Ticket was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ticket.destroy\n respond_to do |format|\n format.html { redirect_to tickets_url, notice: \"Ticket was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ticket.update_attribute(:status, 'deleted')\n respond_to do |format|\n format.html do\n flash[:notice] = \"Ticket was destroyed\"\n redirect_to tickets_url\n end\n format.json { head :no_content }\n end\n end",
"def destroy\n ticket.destroy!\n render status: :ok, nothing: true\n end",
"def destroy\n @ticket = Ticket.find(params[:id])\n @ticket.destroy\n\n respond_to do |format|\n format.html { redirect_to(tickets_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @ticket = Ticket.find(params[:id])\n @ticket.destroy\n\n respond_to do |format|\n format.html { redirect_to(tickets_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @ticket = Ticket.find(params[:id])\n @ticket.destroy\n\n respond_to do |format|\n format.html { redirect_to(tickets_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @ticket = Ticket.find(params[:id])\n @ticket.destroy\n\n respond_to do |format|\n format.html { redirect_to(tickets_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @ticket = Ticket.find(params[:id])\n @ticket.destroy\n\n respond_to do |format|\n format.html { redirect_to(tickets_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @ticket = Ticket.find(params[:id])\n @ticket.destroy\n\n respond_to do |format|\n format.html { redirect_to(tickets_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @ticket = Ticket.find(params[:id])\n @ticket.destroy\n\n respond_to do |format|\n format.html { redirect_to(tickets_url) }\n format.xml { head :ok }\n end\n end",
"def delete\n client.delete(\"/#{id}\")\n end",
"def destroy\n @ticket.destroy\n respond_to do |format|\n format.html { \n flash[:notice] = 'La boleta se eliminó satisfactoriamente.'\n redirect_to tickets_path\n }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ticket.destroy\n respond_to do |format|\n format.html { redirect_to tickets_url, notice: \"The tickey has been closed\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @admin_ticket = Ticket.find(params[:id])\n @admin_ticket.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_tickets_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ticket.destroy\n respond_to do |wants|\n wants.html { redirect_to(tickets_url) }\n wants.xml { head :ok }\n wants.json { head :ok }\n end\n end",
"def destroy\n @ticket.destroy\n\n respond_with(@story, @ticket)\n end",
"def destroy\n @ticket = Ticket.find(params[:id])\n @ticket.destroy\n\n respond_to do |format|\n flash[:notice] = 'Ticket was successfully deleted.'\n format.html { redirect_to @coll_url }\n format.xml { head :ok }\n end\n end",
"def destroy\n @ticket_item.destroy\n respond_to do |format|\n format.html { redirect_to ticket_items_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ticket.destroy\n end",
"def destroy\n @treq = Treq.find(params[:id])\n @treq.destroy\n\n respond_to do |format|\n format.html { redirect_to treqs_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ticket = @project.tickets.find_by_scoped_id!(params[:id])\n @ticket.destroy\n\n respond_to do |format|\n format.html { redirect_to(project_tickets_url(@project)) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @ticket = Ticket.find(params[:id])\n @ticket.destroy\n\n respond_to do |format|\n format.html { redirect_to tickets_url,\n notice: (crud_notice('destroyed', @ticket) + \"#{undo_link(@ticket)}\").html_safe }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ticket = Ticket.find(params[:id])\n authorize @ticket\n @ticket.destroy\n\n respond_to do |format|\n format.html { redirect_to tickets_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @sold_ticket.destroy\n respond_to do |format|\n format.html { redirect_to sold_tickets_url, notice: 'Sold ticket was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ticket_owner = TicketOwner.find(params[:id])\n @ticket_owner.destroy\n\n respond_to do |format|\n format.html { redirect_to ticket_owners_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @api_v1_todo.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"def destroy\n @ticket.destroy\n respond_to do |format|\n format.html { redirect_to customer_tickets_url(@ticket.customer), notice: 'Ticket was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @api_v1_exercise.destroy\n respond_to do |format|\n format.html { redirect_to api_v1_exercises_url, notice: 'Exercise was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ticket.destroy\n respond_to do |format|\n format.html { redirect_to @ticket.user, notice: \"Permanentka na #{get_ticket_therapies_string @ticket} úspěšně odstraněna\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n #@ticket = Ticket.find(params[:id])\n #@ticket.destroy\n\n #respond_to do |format|\n # format.html { redirect_to(tickets_url) }\n # format.xml { head :ok }\n #end\n\t\t\n\t\tredirect_to(tickets_url)\n end",
"def delete\n sql = \"DELETE FROM tickets WHERE id = $1\"\n values = [id]\n SqlRunner.run(sql, values)\n end",
"def destroy\n @bug_ticket.destroy\n respond_to do |format|\n format.html { redirect_to bug_tickets_url, notice: 'Bug ticket was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @labticket.destroy\n respond_to do |format|\n format.html { redirect_to labtickets_url, notice: 'Labticket was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ticket_detalle.destroy\n respond_to do |format|\n format.html { redirect_to ticket_detalles_url, notice: 'Ticket detalle was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete()\n sql = \"DELETE FROM tickets WHERE id=#{@id};\"\n SqlRunner.run(sql)\n end",
"def destroy\n @todo = Todo.find(params[:id])\n @todo.destroy\n render json: nil, status: :ok\n end",
"def destroy\n @ticket_time = TicketTime.find(params[:id])\n @ticket_time.destroy\n\n respond_to do |format|\n format.html { redirect_to(ticket_times_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @ticket_item.destroy\n respond_to do |format|\n format.html { redirect_to admin_ticket_items_url, notice: 'Ticket item was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ticket = Ticket.find_by(seat: @seat)\n @ticket.destroy\n @seat.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_seats_url, notice: 'Seat was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ticket_event.destroy\n respond_to do |format|\n format.html { redirect_to ticket_events_url, notice: 'Ticket event was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ticket_loop.destroy\n respond_to do |format|\n format.html { redirect_to ticket_loops_url, notice: 'Ticket loop was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ticket.destroy\n redirect_to tickets_url, notice: 'Ticket was successfully destroyed.'\n end",
"def destroy\n @troubleticket.destroy\n respond_to do |format|\n format.html do\n redirect_to troubletickets_url,\n notice: 'Trouble ticket was successfully destroyed.'\n end\n format.json { head :no_content }\n end\n end",
"def destroy\n @ticketnote.destroy\n respond_to do |format|\n format.html do\n redirect_to @ticketnote,\n notice: 'Ticket note was successfully destroyed.'\n end\n format.json { head :no_content }\n end\n end",
"def destroy\n @ticketing.destroy\n respond_to do |format|\n format.html { redirect_to ticketings_url, notice: \"Ticketing was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ticket_purchase.destroy\n respond_to do |format|\n format.html { redirect_to event_ticket_ticket_purchase_url(:id => @ticket_purchase.id, :ticket_id => @ticket_purchase.ticket_id), notice: 'Ticket purchase was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @gotcha = Gotcha.find(params[:id])\n @gotcha.destroy\n\n respond_to do |format|\n format.html { redirect_to gotchas_url, notice: 'Gotcha was successfully removed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ticket.destroy\n render_destroy_format(\"ticket removed\")\n end",
"def delete\n res = HTTParty.get URL, headers: HEADERS\n message = JSON.parse res.body, symbolize_names: true\n if res.code == 200\n numSubs = message[:data].count\n if numSubs > 0\n message[:data].each do |sub|\n id = sub[:id]\n delRes = HTTParty.delete \"#{URL}/#{id}\", headers: HEADERS\n #TODO handle status codes\n end\n end\n end\n end",
"def destroy\n @ticket_type = TicketType.find(params[:id])\n @ticket_type.destroy\n\n respond_to do |format|\n format.html { redirect_to(ticket_types_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n url = URI.parse('http://hes.zendesk.com/api/v2/tickets/' + self.id)\n http = Net::HTTP.new(url.host, url.port)\n auth = Base64.encode64(\"#{HesZendesk::AuthUser}:#{HesZendesk::AuthPwd}\")\n req = Net::HTTP::Delete.new(url.path, {\n 'Accept' => 'application/xml',\n 'Authorization' => \"Basic #{auth}\",\n 'Content-Type' => 'application/xml'\n })\n res = http.start { |h| h.request(req) }\n raise res.inspect\n case res\n when Net::HTTPSuccess\n location = res['location'].to_s\n puts location\n return t\n else\n return nil\n end\n end",
"def destroy\n @ticket = Ticket.find(params[:id].to_i) rescue nil\n respond_to do |format|\n if @ticket\n success = @ticket.destroy rescue false\n if success\n format.xml { head :accepted }\n format.json { head :accepted }\n else\n format.xml { render :xml => ticket_presenter, :status => :precondition_failed }\n format.json { render :json => ticket_presenter, :status => :precondition_failed }\n end\n else\n format.xml { head :not_found }\n format.json { head :not_found }\n end\n end\n end",
"def destroy\n @reqdifficulty.destroy\n respond_to do |format|\n format.html { redirect_to reqdifficulties_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @support_ticket = SupportTicket.find(params[:id])\n @support_ticket.destroy\n\n respond_to do |format|\n format.html { redirect_to support_tickets_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @intake.destroy\n respond_to do |format|\n format.html { redirect_to intakes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @exercise.destroy\n respond_to do |format|\n format.html { redirect_to exercises_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @exercise.destroy\n respond_to do |format|\n format.html { redirect_to exercises_url }\n format.json { head :no_content }\n end\n end",
"def delete\n request(:delete)\n end",
"def destroy\n @ticket_action = TicketAction.find(params[:id])\n @ticket_action.destroy\n\n respond_to do |format|\n format.html { redirect_to(ticket_actions_url) }\n format.xml { head :ok }\n end\n end"
] |
[
"0.8142457",
"0.7563549",
"0.7563228",
"0.7563228",
"0.7563228",
"0.7563228",
"0.7563228",
"0.75205696",
"0.75205696",
"0.75205696",
"0.75205696",
"0.75205696",
"0.75205696",
"0.7511588",
"0.7503354",
"0.7473698",
"0.7396861",
"0.7391147",
"0.73365825",
"0.7319954",
"0.7319954",
"0.7319954",
"0.7319954",
"0.7319954",
"0.7319954",
"0.7319954",
"0.7319954",
"0.7319954",
"0.7319954",
"0.7319954",
"0.7319954",
"0.7319954",
"0.7319954",
"0.7319954",
"0.7319954",
"0.7319954",
"0.7319954",
"0.7319954",
"0.7319954",
"0.7318831",
"0.7310917",
"0.73102593",
"0.73102593",
"0.72680146",
"0.72674143",
"0.72386426",
"0.72386426",
"0.72386426",
"0.72386426",
"0.72386426",
"0.72386426",
"0.72386426",
"0.72350836",
"0.7229295",
"0.72242653",
"0.7220349",
"0.7198519",
"0.7193282",
"0.71869373",
"0.7163964",
"0.7132671",
"0.71212906",
"0.70919853",
"0.7086109",
"0.7043129",
"0.7017936",
"0.7008004",
"0.70003414",
"0.699965",
"0.6998096",
"0.69874704",
"0.69851357",
"0.6951063",
"0.69420207",
"0.6938243",
"0.6935561",
"0.6931517",
"0.6930184",
"0.69240284",
"0.6896823",
"0.68751895",
"0.68667805",
"0.6866009",
"0.68396276",
"0.682791",
"0.68106127",
"0.6806835",
"0.68068177",
"0.6804859",
"0.67846674",
"0.6774868",
"0.6766644",
"0.6757592",
"0.67430395",
"0.6742196",
"0.67370945",
"0.67364085",
"0.67224085",
"0.67224085",
"0.67192584",
"0.67185324"
] |
0.0
|
-1
|
Notify that a new booking has been received
|
def send_new_booking_request_notifications
if pay_now
notify_manager_pay_now
notify_request_to_customer_pay_now
else
notify_manager
notify_request_to_customer
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def new_booking_notification(booking)\n @booking = booking\n mail(\n to: @booking.user_email,\n subject: 'Reserva realizada.')\n end",
"def statusChange(booking)\n @booking = booking\n\n mail to: booking.user.email, subject: \"Ta reservation pour #{@booking.location.name} a un nouveau statut\"\n end",
"def send_booking_confirmation_notifications\n\n notify_manager_confirmation\n notify_customer\n \n end",
"def send_update_booking(booking)\n # binding.pry\n @booking = booking\n mail to: @booking.guide.member.email,subject: \"Tabitomo! 予約変更通知\"\n end",
"def new_booking_created(user_id, booking_id)\n @company = Company.first\n\n @user = User.find(user_id)\n @booking = Booking.find booking_id\n\n mail(to: @company.email, subject: \"For admin: #{ @user.full_name} just created a booking\")\n end",
"def new_booking(booking)\n @booking = booking\n mail(to: booking.event.user.email, subject: \"#{booking.user.first_name} has signed up for #{booking.event.title}!\")\n end",
"def booking_complete\r\n\tend",
"def send_booking(book)\n @book = book\n mail( :to => \"pongsakorns@gmail.com\",\n :subject => 'New Booking' )\n end",
"def upcoming(booking)\n @booking = booking\n\n mail(to: @booking.user.email, subject: \"Votre entrainement approche !!\")\n end",
"def booking_confirmation(booking)\n @booking = booking\n mail to: booking.email, subject: \"Bunchungsanfrage\"\n end",
"def booking_created(booked_record)\n @booking = booked_record\n mail to: \"#{@booking.user.email}\", subject: \"Your Booking Status\"\n end",
"def booking_confirmed\n NotificationMailer.booking_confirmed\n end",
"def event_update(booking)\n @booking = booking\n mail(to: @booking.user.email, subject: \"#{@booking.event.title} details have been updated\")\n end",
"def reservation_notifier(reservation)\n @reservation = reservation\n mail( :to => @reservation.email,\n :subject => 'Your reservation has been confirmed. We can\\'t wait to dine with you!' )\n end",
"def notification\n BookingMailer.notification\n end",
"def booked_in\n message = I18n.t('notify.booking.booked_in', course_name: booking.course.name, booker: booking.booker.name)\n BookingMailer.delay.booking_confirmation_to_non_chalkler(booking)\n Chalkler.invite!({email: booking.pseudo_chalkler_email, name: booking.name}, booking.booker) if booking.invite_chalkler\n end",
"def new_booking_request(pid:, check_in:, check_out:)\n owner_uid = DatabaseConnection.query(\"SELECT * FROM properties WHERE pid = #{pid}\").first['uid']\n message(receiver_uid: owner_uid, content: \"New booking request for your space: #{pid} from #{@name}\\nCheck In Date: #{check_in}\\nCheck In Date: #{check_in}\\nClick the link below to confirm\")\n Booking.create(renter_uid: @uid, pid: pid, check_in: check_in, check_out: check_out)\n end",
"def create_new_booking_business_event!\n BusinessEvents::BusinessEvent.fire_event(:new_booking, \n {:booking_id => id})\n end",
"def send_booking_reminder(user, booking)\n @user = user\n @booking = booking\n\n mail( :to => @user.email,\n :subject => \"You have an upcoming booking in 24 hours\" )\n end",
"def response(booking)\n @booking = booking\n @greeting = \"Hello\"\n\n mail(to: \"rph.hung@gmail.com\", subject: \"Your Space has a new booking!\")\n # mail(to: @booking.space.user.email , subject: \"Your Space has a new booking!\")\n end",
"def hotel_notification(hotel, action, current_user)\n @user = current_user\n @action = action\n @hotel = hotel\n mail(to: \"zmb1391@gmail.com\", subject: \"Hotel created/updated/destroyed\")\n end",
"def send_booking_email(info)\n # Send email with booking confirmation\n MemberMailer.booking(self, info).deliver_now\n end",
"def new_booking_email(customer, host, reservation)\n @customer = customer\n @host = host\n @url = \"/listings/#{reservation.listing.id}/reservations\"\n mail(to: host.email, subject: 'New Reservation for your Property')\n end",
"def booking_email(reservation) #customer, host, reservtion_id\n @user = reservation.user #appoint reservation user id(email,name)\n @host = reservation.listing.user #appoint listing user(email,name)\n @listing = reservation.listing #appoint reservation. listing(which id)\n\n mail(to: @user.email, subject: \"Thank you for your booking.\") #after all info appointed, send an email to user(customer)\n end",
"def book(booking)\n @booking = booking\n\n mail(from: \"#{@booking.user.first_name} via Lovely Hood <contact@lovely-hood.com>\", to: @booking.offer.user.email, bcc: \"edward.schults@gmail.com\", subject: \"Félicitations ! Vous avez une demande de réservation ! \")\n end",
"def create\n @booking = Booking.new(booking_params)\n @booking.user_id=current_user.id\n binding.pry\n if (@booking.save)\n binding.pry\n NotificationMailer.notification_two(@booking).deliver!\n NotificationMailer.notification_three(@booking).deliver! \n redirect_to rooms_path,notice: \"the room was successfully booked and a mail has beeb sent sayinng that booking is confirmed and needs to be authorized\"\n else \n binding.pry\n render action: 'new'\n binding.pry\n end\n end",
"def statusChange\n BookingMailer.statusChange\n end",
"def send_user_booking_request_confirmation_email\n BookingMailer.user_booking_confirmation(self).deliver_now\n end",
"def booking_callback_refresh\n @booking.refresh!\n end",
"def notify_email_guest(reservation)\n @reservation = reservation\n mail( :to => @reservation.guest.email,\n :subject => 'Your reservations are done!' )\n end",
"def upcoming\n \tbooking = Booking.first\n BookingMailer.upcoming(booking)\n end",
"def notify(book)\n @book = book\n mail to: @book.author.email, subject: \"[Book Manager]_Notify\"\n end",
"def notify\n end",
"def booking_confirmed\n @greeting = \"Hi\"\n\n mail to: \"to@example.org\"\n end",
"def notify\n {\n }\n end",
"def notify\n {\n }\n end",
"def notify_new_findings\n # TODO: make the method avoid the creation of a Notification record\n end",
"def update\n @booking=Booking.find(params[:id])\n binding.pry\n @booking.update_attributes(booking_params)\n\n binding.pry\n redirect_to rooms_path, notice: 'Booking was successfully updated.' \n if(@booking.is_confirmed == true)\n NotificationMailer.notification_four(@booking).deliver! \n end\n \n end",
"def confirm(new_reservation)\n @reservation = new_reservation\n \n mail to: new_reservation.user.email,\n from: \"support@example.com\",\n subject: \"Thanks for your reservation\"\n end",
"def booking_email(customer, host, reservation_id)\n @host = host\n @customer = customer\n @reservation = Reservation.find(reservation_id)\n\n mail to: host.email, Subject: \"Congrats! You've got a new booking.\"\n\tend",
"def create\n @booking = Booking.new(booking_params)\n\n if @booking.job.type == \"Volunteering\" || @booking.job.type == \"Bootcamp\"\n @booking.update(acceptance: true)\n UserMailer.booking1_email(@booking).deliver_now\n end\n\n respond_to do |format|\n if @booking.save\n UserMailer.booking_email(@booking).deliver_now\n format.html { redirect_to jobs_path, notice: 'Application was successfully created.' }\n format.json { render :show, status: :created, location: jobs_path }\n else\n format.html { render :new }\n format.json { render json: @booking.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @booking = Booking.new(booking_params)\n \n unless params[:subject_id].empty?\n @subject = Subject.find(params[:subject_id])\n end\n # TODO date and time validation\n begin\n date = (params['date_part'] + \" \" + params['time_part']).to_datetime\n rescue ArgumentError\n @booking.errors.add(:date, \"is invalid\")\n date = Date.new\n end\n @booking.booking_date = date\n # TODO: Refactor for admin booking creation\n @booking.shared = params[\"shared\"]\n @booking.subject = @subject\n # Add this customer as owner. \n @booking.creator = current_user.customer\n @booking.customers << current_user.customer\n @booking.booked_customers.first.number_students = params[:booking][:booked_customers][:number_students]\n @booking.period = 2\n \n # Create closed booking if customer came from searching or enquiring.\n if params[:presenter_id].present?\n presenter = Presenter.find(params[:presenter_id])\n if presenter.available? @booking.booking_date, @booking.duration_minutes\n @booking.chosen_presenter = Presenter.find(params[:presenter_id])\n @booking.rate = presenter.rate\n @booking.creator = current_user.customer\n else\n @booking.errors.add(:presenter, \"is not available at this time\")\n end\n end \n \n if @booking.save\n # Only send messages to customers if booking is shared\n @message = \"A new #{@booking.subject.name} booking has been created that you may be interested in.\"\n if @booking.shared?\n Notification.notify_applicable_users(current_user, @booking, \"customer\", booking_path(@booking), @message, :interested_booking)\n end\n # Only send messages to presenters if booking is open\n if @booking.chosen_presenter.nil?\n Notification.notify_applicable_users(current_user, @booking, \"presenter\", booking_path(@booking), @message, :interested_booking)\n end\n Notification.notify_admin(\"A new booking has been created\", booking_path(@booking), :booking)\n\n # Add booking to booked customers\n current_user.customer.created_bookings << @booking\n\n #clear search session \n session[:search_params] = nil\n redirect_to @booking\n else\n @date_part = params['date_part']\n @time_part = params['time_part']\n render :new\n end\n\n end",
"def confirm_sale\n @booking = Booking.find(params[:id])\n @booking.status = \"Ticket receivd\"\n @booking.save\n redirect_to bookings_path\n end",
"def confirmation(booking)\n @booking = booking\n mail(to: booking.user.email, subject: \"You have been confirmed!\")\n end",
"def notify\n return if destroy_if_old\n\n increase_busy_counter\n\n create_push\n end",
"def notify_awaiting_request_to_host(reservation)\n @reservation = reservation\n @tenant = @reservation.user\n @cookoon = @reservation.cookoon\n @host = @cookoon.user\n mail(to: @host.full_email, subject: \"Rappel: #{@tenant.first_name} souhaite louer votre Cookoon !\")\n end",
"def received(ticket)\n @ticket = ticket\n @greeting = \"Hi \" + @ticket.name + ' !'\n\n mail to: @ticket.email, subject: 'Confirming your request with unique reference.'\n end",
"def refuse\n @api_v1_reservation.update(status: :refused)\n Api::V1::ReservationMailer.refused_reservation(@api_v1_reservation).deliver_now\n render json: { success: true }, status: 200\n rescue Exception => errors\n render json: errors, status: :unprocessable_entity\n end",
"def notify_business\n business.add_message_to_queue(\"Hey #{business.name}, we've just deposited #{amount} into your account! Thanks for being great!\")\n end",
"def appointment_pending(appoint_obj)\n @doctor = Doctor.find_by_id(appoint_obj.doctor_id)\n @patient = Patient.find_by_id(appoint_obj.patient_id)\n mail(:to => @doctor.email, :subject => \"New Appointment\")\n end",
"def confirm!\n if status == :pending_confirmation\n transaction do\n update(:status => :confirmed)\n # Assign available stock\n assign_available_stock if SystemConfiguration::Variable.get_value('booking.assignation.automatic_resource_assignation', 'false').to_bool\n # Create newsfeed\n ::Yito::Model::Newsfeed::Newsfeed.create(category: 'booking',\n action: 'confirm_booking',\n identifier: self.id.to_s,\n description: BookingDataSystem.r18n.t.confirmed_booking)\n end\n send_booking_confirmation_notifications\n end\n self\n end",
"def create\n\n checkIn = parse_datetime_params booking_params, \"check_in\", utc_or_local = \"AEST\"\n checkOut = parse_datetime_params booking_params, \"checkout\", utc_or_local = \"AEST\"\n @service_id = params[:booking][:service_id].to_i\n @consultant_id = Service.find(@service_id).user_id\n @consumer_id = current_user.id\n\n @booking = Booking.new({\n consultant_id: @consultant_id,\n consumer_id: @consumer_id,\n service_id: @service_id,\n status: \"Unconfirmed\",\n check_in: checkIn,\n checkout: checkOut\n })\n\n respond_to do |format|\n if @booking.save\n # ContactMailer.send_contact_email(message:\"Accepted\").deliver_now\n format.html { redirect_to @booking, notice: 'Booking was successfully created. This booking will not be confirmed until the consultant approves it.' }\n format.json { render :show, status: :created, location: @booking }\n else\n format.html { render :new }\n format.json { render json: @booking.errors, status: :unprocessable_entity }\n end\n end\n end",
"def request_approval\n reservation = Reservation.first\n ReservationMailer.request_approval(reservation)\n end",
"def buy_success_offerer(booking)\n @service_title = booking.service.title\n @booking_trnx_id = booking.transaction.FG_trnx_id\n @buyer_name = booking.user.profile.full_name\n @buyer_email = booking.user.email\n @nonprofit_name = booking.service.nonprofit.name\n @spots = booking.seats_booked\n @amount = booking.total_amount\n @email = booking.service.user.email\n subject = \"Someone purchased your service on GoodInKind\"\n setup_email(@email, subject)\n end",
"def confirm\n if status == :pending_confirmation and\n not charges.select { |charge| charge.status == :done }.empty?\n transaction do\n self.status = :confirmed\n self.save\n # Assign available stock\n assign_available_stock if SystemConfiguration::Variable.get_value('booking.assignation.automatic_resource_assignation', 'false').to_bool\n # Create newsfeed\n ::Yito::Model::Newsfeed::Newsfeed.create(category: 'booking',\n action: 'confirm_booking',\n identifier: self.id.to_s,\n description: BookingDataSystem.r18n.t.confirmed_booking)\n end\n send_booking_confirmation_notifications\n else\n p \"Could not confirm booking #{id} #{status}\"\n end\n \n self\n end",
"def availability\n # retrieve the book object\n @book = Book.friendly.find(params[:id])\n BookMailer.availability(book: @book, user: current_user).deliver_later unless @book.last_loan.nil?\n # redirect to book show page with a success message\n redirect_to store_show_path, notice: 'An email has been sent to you about the current state of this book'\n end",
"def invite_for_booking_process\n UserMailer.invite_for_booking_process(Booking.last)\n end",
"def notify\n if self.recruitment.first_notify.present?\n self.recruitment.unset(:first_notify)\n MemberMailerWorker.perform_async(member_id: self.recruitment.member.id.to_s, recruitment_application_id: self.id.to_s, perform: :send_new_recruitment_application)\n TeamMailerWorker.perform_async(recruitment_application_id: self.id.to_s, perform: :send_new_recruitment_application)\n end\n end",
"def notify\n #ensure that you own the reservation or club\n #send notifcation in the background\n reservation = UserReservation.find(params[:user_reservation_id])\n\n if(reservation.contact.nil?) then\n Rails.logger.error \"No Contact email\"\n render json: {message:'No contact info'}, status: :expectation_failed\n return\n end\n\n if(reservation.contact.email.nil?) then\n Rails.logger.error \"Contact has no email\"\n render json: {message:'Contact has no email'}, status: :expectation_failed\n end\n\n #contact has email, deliver the email\n UserReservationMailer.notify(reservation).deliver_later\n head :ok\n end",
"def send_request_notification_email\n ReservationMailer.request_notification(self).deliver_now\n end",
"def create_booking(day)\n new_booking = Booking.create(host_id: self.id,day: day)\n puts \"A new booking has been created for #{self.name} on #{day}.\"\n new_booking.assign_waiter\n puts \"#{new_booking.waiter.name} has been assigned to #{self.name}'s booking'.\"\n end",
"def request_confirmation\n reservation = Reservation.first\n ReservationMailer.request_confirmation(reservation)\n end",
"def notify\n {}\n end",
"def notify\n {}\n end",
"def notify\n {}\n end",
"def booked_not_confirmed\n NotificationMailer.booked_not_confirmed\n end",
"def exchange_request\n @order = Order.find(params[:id])\n if @order\n @exchangeable_books = params[:books]\n user = User.find(@order.seller_id)\n @order.notification_sent = true\n @order.save\n TasksController.send_notification( user,@current_user,\"Book exchange request\", \"https://www.google.com\")\n render json:{status: 'Success', message: \"Your request is sent to book owner (\"+user.name+\")\"},status: :ok\n end\n end",
"def book_added(email, book)\n @email = email\n @book = book\n\n mail to: @email, subject: \"Thanks for added book/\"\n end",
"def update_reservation(reservation)\n @reservation=reservation\n @reserver=@reservation.reserver\n mail to: @reserver.email_address, subject: \"Reservation at Les Arbres Paresseux updated\"\n end",
"def notify_new_finding\n # TODO: make the method avoid the creation of a Notification record\n end",
"def pickup_item\n if status == :confirmed \n transaction do\n update(:status => :in_progress)\n # Create newsfeed\n ::Yito::Model::Newsfeed::Newsfeed.create(category: 'booking',\n action: 'pickup_item',\n identifier: self.id.to_s,\n description: BookingDataSystem.r18n.t.picked_up_item)\n end \n end\n self\n end",
"def create\n\t\tbooking = Booking.new(booking_params)\n\n\t if booking.save\n\t \tPeekBooker.use_a_boat(booking.size, booking.timeslot_id)\n\t \tPeekBooker.delete_overlap_assignments(booking.timeslot_id)\n\t \tPeekBooker.upd_availability(booking.timeslot_id)\n\t \t\n\t \trender json: booking, status: 201\n\t end\n\tend",
"def create\n @reservation = @brewery.reservations.new(reservation_params)\n\n respond_to do |format|\n if @reservation.save\n format.html { notification }\n format.json { render :show, status: :created, location: @reservation }\n else\n format.html { render :new }\n format.json { render json: @reservation.errors, status: :unprocessable_entity }\n end\n end\n end",
"def send_email_changed_notification; end",
"def send_mail_on_creation(rent)\n RentMailer.success_rent_email(rent.id).deliver_later\n end",
"def create\n puts params[:date]\n @room = Room.find(params[:id])\n respond_to do |format|\n if @room.histories.create(user: current_user, created_at: Time.now, date: params[:date], slot: params[:slot])\n # @room.histories.update_attribute(date:, para)\n @room.update(status: \"Booked\")\n ###Send email functionality\n UserNotifierMailer.send_signup_email(current_user.email).deliver\n #@emails = params[\"booking\"][\"members\"].split(',')\n format.html { redirect_to @room, notice: 'Room Booked Successfully!!' }\n else\n format.html { render @room, notice: 'Unable to Room' }\n end\n end\n end",
"def notify_resource_added(resource, request)\n email = OrderMailer.create_resource_added(resource, request)\n Thread.new(email) do |e|\n OrderMailer.deliver(email)\n end\n end",
"def created_book(book)\n @book = book\n mail to: \"yossishalem@gmail.com\", subject: 'NerEzion - new book created'\n end",
"def notify\n ReminderMailer.notify\n end",
"def request_booking_proposed(sender, receiver)\n @url = booking_requests_path\n @sender_name = sender.username.titleize\n mail to: receiver.email,\n subject: \"fitafy Booking Request from #{sender.username}\",\n date: Time.now\n end",
"def update\n respond_to do |format|\n if @booking.update(booking_params)\n unless @booking.email ==\"adminhangfirebbq@gmail.com\"\n \n #ONLY SEND EMAIL TO CUSTOMER IF KEY FIELDS CHANGE, NOT FOR NOTES OR DEPOSIT\n if (@booking.previous_changes().key?(\"phone\") || @booking.previous_changes().key?(\"booking_date_time\") || @booking.previous_changes().key?(\"email\") || @booking.previous_changes().key?(\"name\") || @booking.previous_changes().key?(\"number_of_diners\") || @booking.previous_changes().key?(\"child_friendly\"))\n #aa = @booking.previous_changes() \n #Rails.logger.debug(\"in booking update: #{aa.inspect}\")\n if (@booking.number_of_diners >6 && @booking.booking_date_time> Date.new(2019,01,01))\n BookingMailer.booking_confirmation_with_deposit_customer(@booking).deliver_now\n #new change for Binki to set sent flag\n unless @booking.deposit_email_sent ==\"Sent\"\n @booking.update(deposit_email_sent: \"Sent\")\n end\n else\n BookingMailer.booking_confirmation_customer(@booking).deliver_now\n # BookingMailer.booking_confirmation_mgmt(@booking).deliver_now\n end\n end\n end\n \n #SEND DEPOSIT RECOVERY EMAIL TO STAFF WHEN BOOKING OF 8+ IS MADE\n #Change added for Binki - stop deposit emails to staff after inital\n unless @booking.deposit_email_sent ==\"Sent\"\n if @booking.number_of_diners >7 && @booking.booking_date_time> Date.new(2017,10,31) && @booking.deposit_amount.nil?\n BookingMailer.booking_deposit_mgmt(@booking).deliver_now \n end\n end\n \n #Customer.write_contact(@booking)\n format.html { redirect_to @booking }\n format.json { render :show, status: :ok, location: @booking }\n else\n format.html { redirect_to edit_booking_path(@booking), :flash => { :error => @booking.errors.full_messages.join(', ') }}\n \n format.json { render json: @booking.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @status = \"Booked\"\n @status_notice = 'booking was successfully created.'\n @bookings = Booking.where(:conference_room_id => params[:conference_room_id])\n @bookings.each do |booking| \n if (booking.start_time..booking.end_time).cover?(params[:booking][:start_time]) || (booking.start_time..booking.end_time).cover?(params[:booking][:end_time]) || (params[:booking][:start_time]..params[:booking][:end_time]).cover?(booking.start_time) || (params[:booking][:start_time]..params[:booking][:end_time]).cover?(booking.end_time)\n @status = \"Pending\"\n @status_notice = \"Sorry, Your requested slot is already Booked. so your requestis Pending state.\"\n end\n end\n\n respond_to do |format|\n if params[:booking][:start_time].to_date.wday == 0 || params[:booking][:end_time].to_date.wday == 0 || params[:booking][:start_time].to_date.wday == 6 || params[:booking][:end_time].to_date.wday == 6\n format.html { redirect_to portal_conference_room_bookings_url, alert: 'Sorry!, Bookings are not allowed on Weekend.' }\n else \n if Time.now < params[:booking][:start_time] && params[:booking][:start_time] < params[:booking][:end_time]\n @booking = Booking.new(:conference_room_id => params[:conference_room_id], :status => @status, :user_id => current_user.id, :start_time => params[:booking][:start_time], :end_time => params[:booking][:end_time], :created_at => Time.now)\n if @booking.save!\n \n @user = User.find(@booking.user_id)\n if @status == \"Booked\"\n ExampleMailer.booking_email(@user, @booking).deliver\n elsif @status == \"Pending\"\n ExampleMailer.pending_email(@user, @booking).deliver\n end\n\n format.html { redirect_to portal_conference_room_bookings_url, notice: @status_notice }\n format.json { render :show, status: :created, location: @booking }\n else\n format.html { render :new }\n format.json { render json: @booking.errors, status: :unprocessable_entity }\n end\n else\n format.html { redirect_to portal_conference_room_bookings_url, alert: 'Please Book Conference Room for future date.' }\n end \n end\n end\n end",
"def check_if_status_is_booked\n\t\tif booking_status == BookingStatus.find_by_status(\"Booked\")\n\t\t\t@trips = TripsToUser.find_all_by_post_id(self.id)\n\t\t\t@trips.each do |trip|\n\t\t\t\tNotification.create(\n\t\t user_id: trip.user_who_agreed_id,\n\t\t notification_type: NotificationType.find_by_name(\"trip_confirmed\").id,\n\t\t title: \"Trip has been confirmed.\",\n\t\t message: \"Your trip with #{self.user} is official, click the link below to view the trip details.\",\n\t\t related_id: self.id\n\t\t )\n\t\t\tend\n\t\tend\n\tend",
"def new_notification\n mail(to: \"rhammett@ycp.edu\", subject: 'New Notification', sent_on: Time.now)\n end",
"def create\n @listing = Listing.find(params[:reservation][:listing_id])\n @reservation = Reservation.new(reservation_params)\n @reservation.listing_id = @listing.id\n @reservation.user_id = current_user.id\n if @reservation.save\n # ReservationMailer.booking_email(@reservation, current_user).deliver_now\n ReservationJob.perform_later(@reservation, current_user)\n redirect_to listing_reservation_path(listing_id: @listing.id , id: @reservation.id)\n else\n flash[:message] = \"Reservation was not saved\"\n render 'new'\n end\nend",
"def send_pusher_event\n pusher_client.trigger(\"auctions\", \"new_bid_in_room_#{self.room_id}\", self.to_json)\n end",
"def reject_booking\n BookingstatusMailer.reject_booking\n end",
"def confirm(reservation)\n @reservation = reservation\n\n mail to: reservation.user.email, subject: \"Your Itinerary\"\n end",
"def create\n @booking = Booking.new(booking_params)\n room = Room.find(@booking.room_id) \n \n @booking.buyer_id = current_user.id if user_signed_in?\n @booking.seller_id = room.user_id\n @booking.room_name = room.name\n @booking.room_title = room.title\n @booking.booking_code = Booking.generate_booking_code\n if params[:payment_method].present?\n @booking.payment_method = params[:payment_method]\n else\n @booking.payment_method = \"Block\"\n end\n\n respond_to do |format|\n if @booking.save\n if @booking.payment_method == \"Bank Transfer\"\n #send_message(\"+15005550006\", \"[HB][##{@booking.id}] Brace yourself for RM#{@booking.service_fee} bank transfer from #{@booking.first_name}(#{@booking.phone}). Visit HourBeds.com for more info\")\n format.html { redirect_to payment_instruction_url(transfer: @booking.total) }\n elsif @booking.payment_method == \"Block\"\n format.html { redirect_to calendar_url(room, start_date: @booking.start_date) }\n else\n #format.html { redirect_to booking_url(@booking), notice: 'Booking was successfully created.' }\n #send_message(\"+15005550006\", \"You got a #{@booking.duration} hour reservation for #{@booking.room_name.truncate(20)} (#{@booking.check_in.strftime(\"%b %d, %Y - %l:%M %p\")}). Visit HourBeds.com for more info\")\n end\n format.json { render :show, status: :created, location: @booking }\n else\n format.html { render :new }\n format.json { render json: @booking.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @service_booking = ServiceBooking.find(params[:id])\n @control = BookingTimeControl.book_time_control_method(params)\n \n if @control == true\n if @service_booking.update(service_booking_params)\n render json: @service_booking, status: :ok, serializer: Website::V1::ServiceBookingSerializer\n @service_booking.delay.sevice_booking_notification(I18n.t('Notification.service_booking_updated'), I18n.t('Email.service_booking_updated_dealer'), I18n.t('Email.service_booking_updated_user'), params)\n else\n render json: @service_booking.errors, status: :unprocessable_entity\n end\n else\n render json: @control\n end \n end",
"def reminder_sent\n end",
"def send_to_preservation\n self.preservation_state = PRESERVATION_STATE_INITIATED.keys.first\n self.preservation_details = 'The preservation button has been pushed.'\n self.save\n Resque.enqueue(SendToPreservationJob,self.pid)\n end",
"def ice_request(info)\n\n # Formatter\n formatter = DateTimeFormatter.new\n\n # Get booking\n booking_id = info[:booking_id]\n booking = Booking.where({:id => booking_id})\n if (booking.length != 1)\n throw \"ERROR: booking_id not recognized in mailer\"\n end\n booking = booking.first\n\n # Get owner\n owner = booking.theatre.venue.owner\n\n # Booking info\n @date = formatter.shortToMidDateStr(booking.date) #daylight savings?\n @start_time = formatter.secondsToTimeStr(booking.start_time)\n @end_time = formatter.secondsToTimeStr(booking.start_time + booking.length)\n @venue = booking.theatre.venue.name\n @theatre = booking.theatre.name\n @activity = booking.activity_type\n @amount = info[:amount_paid]\n\n # Manager info\n @manager_name = owner.manager_name\n @manager_email = owner.manager_email\n\n # Customer info\n @customer_name = booking.name\n @customer_address = booking.customer_address\n @customer_city = booking.customer_city\n @customer_province = booking.customer_province\n @customer_country = booking.customer_country\n @customer_postal = booking.customer_postal\n @customer_email = booking.email\n @customer_phone = booking.phone\n @customer_notes = booking.notes\n\n # Booking id\n @booking_id = booking.id\n\n # Send\n mail(:to => @manager_email, :subject => 'Ice Booking')\n \n end",
"def candidate_updated\n @greeting = \"Hi\"\n\n mail to: \"to@example.org\"\n end",
"def notify_ready\n appointment = Appointment.find(params[:appointment_id])\n flash[:danger] = 'Patient has not checked in' unless appointment.checked_in?\n appointment.push_notify_ready\n redirect_to admin_appointments_path(@admin)\n end",
"def refresh!\n # if self.payment_preauthorized? || self.confirmed? || self.started? || self.archived?\n # LOG.info \"Not possible to refresh.\"\n # end\n\n if self.created?\n do_refresh_created!\n elsif self.confirmed?\n #do_refresh_confirmed!\n else\n LOG.info \"Not possible to refresh.\"\n LOG.info message: \"Nothing to do for this booking.\", booking_id: self.id, booking_status: self.status\n end\n end",
"def update\n @booking = Booking.find_by(id: params[:id])\n @booking.update(acceptance: true)\n UserMailer.confirm_email(@booking).deliver_now\n redirect_to job_bookings_path(params[:job_id]), notice: 'Application was successfully updated.' \n # respond_to do |format|\n # if @booking.update(booking_params)\n # format.html { redirect_to @booking, notice: 'Application was successfully updated.' }\n # format.json { render :show, status: :ok, location: @booking }\n # else\n # format.html { render :edit }\n # format.json { render json: @booking.errors, status: :unprocessable_entity }\n # end\n # end\n end",
"def notify_pusher\n Pusher.trigger('location', 'new', self.trip.as_json)\n end",
"def send_booking_mail_to_host(booking)\n @booking = booking\n @host_email_id = User.find(@booking.user_id).email\n #binding.pry\n mail to: \"#{@host_email_id}\", subject: \"A New booking request- #{@booking.room.name}\"\n end",
"def notify_pusher\n Pusher.trigger('location', 'new', self.trip.as_json)\n end"
] |
[
"0.78234166",
"0.69990104",
"0.6875808",
"0.68024135",
"0.67590994",
"0.6716075",
"0.6681293",
"0.6679437",
"0.6668682",
"0.6668348",
"0.66662496",
"0.66348267",
"0.66283137",
"0.66009",
"0.65918416",
"0.6589843",
"0.65460575",
"0.6536768",
"0.652677",
"0.6516068",
"0.6510334",
"0.64307743",
"0.6401942",
"0.6371105",
"0.63591063",
"0.635632",
"0.63544065",
"0.6348879",
"0.63427067",
"0.6336392",
"0.63359386",
"0.63092846",
"0.62915784",
"0.6290215",
"0.62510234",
"0.62510234",
"0.6247014",
"0.6232878",
"0.62035936",
"0.62027216",
"0.6194788",
"0.6187971",
"0.61616427",
"0.61604345",
"0.6151433",
"0.6137832",
"0.61311984",
"0.61000633",
"0.60652024",
"0.6034445",
"0.60200614",
"0.6015457",
"0.60022855",
"0.59929186",
"0.5988373",
"0.59854037",
"0.5972044",
"0.5965443",
"0.59525007",
"0.5941556",
"0.5939281",
"0.5934186",
"0.59330463",
"0.59330463",
"0.59330463",
"0.5931898",
"0.5915177",
"0.58917254",
"0.5874792",
"0.58721995",
"0.58627236",
"0.58529854",
"0.58485776",
"0.58480275",
"0.5845914",
"0.5841095",
"0.58392143",
"0.5838007",
"0.5837669",
"0.5834843",
"0.583247",
"0.5826115",
"0.58220035",
"0.5821398",
"0.58206767",
"0.58195907",
"0.5817228",
"0.58075404",
"0.5801126",
"0.57985675",
"0.57961667",
"0.5794508",
"0.5792066",
"0.57837373",
"0.577694",
"0.5772805",
"0.57709754",
"0.5767027",
"0.5765118",
"0.5764574"
] |
0.6955222
|
2
|
Notify that a booking has been confirmed
|
def send_booking_confirmation_notifications
notify_manager_confirmation
notify_customer
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def confirmation(booking)\n @booking = booking\n mail(to: booking.user.email, subject: \"You have been confirmed!\")\n end",
"def confirm\n if status == :pending_confirmation and\n not charges.select { |charge| charge.status == :done }.empty?\n transaction do\n self.status = :confirmed\n self.save\n # Assign available stock\n assign_available_stock if SystemConfiguration::Variable.get_value('booking.assignation.automatic_resource_assignation', 'false').to_bool\n # Create newsfeed\n ::Yito::Model::Newsfeed::Newsfeed.create(category: 'booking',\n action: 'confirm_booking',\n identifier: self.id.to_s,\n description: BookingDataSystem.r18n.t.confirmed_booking)\n end\n send_booking_confirmation_notifications\n else\n p \"Could not confirm booking #{id} #{status}\"\n end\n \n self\n end",
"def confirm!\n if status == :pending_confirmation\n transaction do\n update(:status => :confirmed)\n # Assign available stock\n assign_available_stock if SystemConfiguration::Variable.get_value('booking.assignation.automatic_resource_assignation', 'false').to_bool\n # Create newsfeed\n ::Yito::Model::Newsfeed::Newsfeed.create(category: 'booking',\n action: 'confirm_booking',\n identifier: self.id.to_s,\n description: BookingDataSystem.r18n.t.confirmed_booking)\n end\n send_booking_confirmation_notifications\n end\n self\n end",
"def booking_confirmed\n NotificationMailer.booking_confirmed\n end",
"def confirm!\n update(confirmed_at: Time.now.utc, status: :confirmed)\n end",
"def confirm_event\n @event.update(confirmed: true)\n end",
"def booking_confirmation(booking)\n @booking = booking\n mail to: booking.email, subject: \"Bunchungsanfrage\"\n end",
"def confirm(new_reservation)\n @reservation = new_reservation\n \n mail to: new_reservation.user.email,\n from: \"support@example.com\",\n subject: \"Thanks for your reservation\"\n end",
"def confirm!\n update!(confirmed_at: DateTime.now)\n end",
"def confirm(reservation)\n @reservation = reservation\n\n mail to: reservation.user.email, subject: \"Your Itinerary\"\n end",
"def request_confirmation\n reservation = Reservation.first\n ReservationMailer.request_confirmation(reservation)\n end",
"def booking_confirmed\n @greeting = \"Hi\"\n\n mail to: \"to@example.org\"\n end",
"def do_confirm\n if current_user.type == \"User\" || current_attendee.affiliate == current_user\n if registration = current_attendee.event_registrations.for_event(current_object).first\n registration.confirm!\n # log confirmation activity\n log_checkin_activity(\"Confirmed for '#{current_object.display_name}'\")\n \n @attendee_id = current_attendee.id\n @event_id = params[:id]\n end\n end\n\n render :text => \"Confirmed\"\n end",
"def reservation_confirmation(reservation)\n @reservation = reservation\n\n mail to: reservation.email, bcc: \"drillmenowsf@gmail.com\", subject: \"Reservation Confirmation\"\n end",
"def booked_not_confirmed\n NotificationMailer.booked_not_confirmed\n end",
"def send_user_booking_request_confirmation_email\n BookingMailer.user_booking_confirmation(self).deliver_now\n end",
"def statusChange(booking)\n @booking = booking\n\n mail to: booking.user.email, subject: \"Ta reservation pour #{@booking.location.name} a un nouveau statut\"\n end",
"def new_booking_notification(booking)\n @booking = booking\n mail(\n to: @booking.user_email,\n subject: 'Reserva realizada.')\n end",
"def reservation_notifier(reservation)\n @reservation = reservation\n mail( :to => @reservation.email,\n :subject => 'Your reservation has been confirmed. We can\\'t wait to dine with you!' )\n end",
"def confirm_from_email\n bookable_asset = BookableAsset.find_by_euid(params[:euid])\n booking_request = bookable_asset.booking_requests.find(params[:booking_request_id])\n redirect_path = current_user ? user_path(current_user) : login_path\n\n if bookable_asset.confirmed?\n flash[:warn] = \"You've already accepted this booking_request\"\n return redirect_to redirect_path\n end\n booking_request.accept!\n\n flash[:notice] = \"You've accepted this booking_request.\"\n redirect_to redirect_path\n end",
"def confirm!\n @@api.post(endpoint: self.endpoint + ['confirm'])\n end",
"def reservation_confirmation(reservation_id)\n @reservation = Reservation.find(reservation_id)\n # change this to guest email\n email = 'khun84@gmail.com'\n mail to: email, subject: \"Pairbnb: Reservation confirmation\"\n end",
"def email_confirm!\n update(email_confirmed_at: Time.zone.now)\n end",
"def confirm\n # can't confirma reservation in the past!\n render false && return unless @reservation.start_datetime > Time.current\n if @reservation.confirm && @reservation.save\n flash[:notice] = \"You are confirmed for #{@reservation.start_datetime_human}, with #{@reservation.user.name}.\"\n else\n flash[:alert] = 'Error'\n end\n respond_to do |format|\n format.html { redirect_to calendar_path(token: @visitor.token, reservation_id: @reservation.id) }\n format.js { render text: \"$('#reservationModal').modal('hide'); $('#calendar').fullCalendar( 'refetchEvents' );\" }\n end\n end",
"def appointment_confirmation(appoint_obj)\n @doctor = Doctor.find_by_id(appoint_obj.doctor_id)\n @patient = Patient.find_by_id(appoint_obj.patient_id)\n mail(:to => @patient.email, :subject => \"Appointment Approved\")\n end",
"def buyer_confirmed\n end",
"def update\n @booking=Booking.find(params[:id])\n binding.pry\n @booking.update_attributes(booking_params)\n\n binding.pry\n redirect_to rooms_path, notice: 'Booking was successfully updated.' \n if(@booking.is_confirmed == true)\n NotificationMailer.notification_four(@booking).deliver! \n end\n \n end",
"def confirm!\n self.pending = false\n self.save\n self.createDebts\n end",
"def mail_confirm(email, date)\n \t\t@date = date\n \t\tmail(to: email, subject: \"Appointment Confirmed!\")\n \tend",
"def notify_email_guest(reservation)\n @reservation = reservation\n mail( :to => @reservation.guest.email,\n :subject => 'Your reservations are done!' )\n end",
"def confirmed?; end",
"def send_confirmation\n ActiveRecord::Base.transaction do\n ride.update_attributes(status: :waiting_assignment) if ride.status == 'scheduled'\n update_attributes(ride_confirmed: true)\n\n body = I18n.t(:auto_confirmed_wait_for_driver, locale: user_language, time: ride.pickup_in_time_zone.strftime('%l:%M %P'))\n\n sms = Conversation.send_staff_sms(ride_zone, user, body, Rails.configuration.twilio_timeout)\n end\n return 'scheduled_ride_auto_confirm'\n end",
"def confirmed!\n @_confirmed = false\n self.confirmed = true\n save\n end",
"def confirm_sale\n @booking = Booking.find(params[:id])\n @booking.status = \"Ticket receivd\"\n @booking.save\n redirect_to bookings_path\n end",
"def confirm!\n self.confirmation_token = nil\n self.confirmed_at = Time.now.utc\n save(:validate => false)\n end",
"def upcoming(booking)\n @booking = booking\n\n mail(to: @booking.user.email, subject: \"Votre entrainement approche !!\")\n end",
"def verify\n update(confirmed_at: Time.current)\n end",
"def landlord_booking_confirmed_email(student_id, landlord_id, apartment)\n @student = find_user(student_id)\n @landlord = find_user(landlord_id)\n @apartment = apartment\n mail(to: @landlord&.email, subject: 'Booking Confirmation')\n end",
"def sell_confirmed\n end",
"def is_confirmed?\n return self.status == Erp::Reservations::Reservation::STATUS_CONFIRMED\n end",
"def confirm\n\n end",
"def notify_awaiting_request_to_host(reservation)\n @reservation = reservation\n @tenant = @reservation.user\n @cookoon = @reservation.cookoon\n @host = @cookoon.user\n mail(to: @host.full_email, subject: \"Rappel: #{@tenant.first_name} souhaite louer votre Cookoon !\")\n end",
"def mark_as_confirmed!\n self.confirmation_token = nil\n self.confirmed_at = Time.now.utc\n save\n end",
"def notify_ready\n appointment = Appointment.find(params[:appointment_id])\n flash[:danger] = 'Patient has not checked in' unless appointment.checked_in?\n appointment.push_notify_ready\n redirect_to admin_appointments_path(@admin)\n end",
"def appointment_confirmation_for_tutor(appointment_id)\n @appt = Appointment.find(appointment_id)\n set_appt_variables\n mail(to: @tutor.email, subject: \"You have a new appointment with Axon\")\n end",
"def set_confirmed_appointment\r\n @confirmed_appointment = ConfirmedAppointment.find(params[:id])\r\n end",
"def reservation_confirmation\n @greeting = \"Hi\"\n\n mail to: \"to@example.org\"\n end",
"def confirmation\n if @events_candidate.registered?\n @candidate.assign_to_batch(params[:event_id], @candidate, @events_candidate)\n @candidate.save\n else\n redirect_to(root_path , :notice => 'Thank You, You Have already confirmed your registration.')\n end\n end",
"def confirm\n @doctor = Doctor.find_by_confirmation_token(params[:confirmation_token])\n \n if @doctor.present?\n @doctor.update_attributes(confirmed_at: DateTime.now)\n render json: {message: \"Your account has been confirmed at #{@doctor.confirmed_at}.You can Sign in Now!\"}\n else \n render json: {alert: \"Confirmation Link has Expired.\"}\n end\n\n end",
"def booked_in\n message = I18n.t('notify.booking.booked_in', course_name: booking.course.name, booker: booking.booker.name)\n BookingMailer.delay.booking_confirmation_to_non_chalkler(booking)\n Chalkler.invite!({email: booking.pseudo_chalkler_email, name: booking.name}, booking.booker) if booking.invite_chalkler\n end",
"def user_event_confirmed(user, event)\n @user = user\n @event = event\n meeting = user.meetings.find_by(event: event)\n attachments.inline['prenotazione.ics'] = meeting.ical.to_ical if meeting.confirmed?\n mail(to: @user.email, subject: t('user_event_modified', scope: 'message.email.subjects') + ' ' + (l event.date_on)) if user.email.present?\n end",
"def book_request_accept_confirm\n booking_staff = BookingStaff.find_by_confirm_token(params[:id])\n\n if booking_staff\n staff_id = booking_staff.id\n confirmed_status = STATUS_CONFIRMED\n\n if self.book_request_response(staff_id, confirmed_status)\n\n #Start communication between agency and ambassador\n #agency sends thank you message to ambassador\n agency_id = booking_staff.booking.agency_id\n event_id = booking_staff.booking.event_id\n new_conversation = Conversation.create!(sender_id: agency_id, recipient_id: booking_staff.ambassador_id, event_id: event_id)\n Message.create!(content:\"Thanks for accepting booking request!\", user_id: agency_id, user_type: \"agency\", conversation_id: new_conversation.id)\n\n # NOTE - WE SHOULD REDIRECT HERE TO THE BOOKING CONFIRMED PAGE ?\n booking_staff.send_email_booking_accepted\n booking_staff.update(:confirm_token => nil)\n\n render 'request_accept_confirm'\n return\n end\n end\n\n # NOTE - IF FOR WHATEVER REASON GETTING THE BookingStaff MODEL FAILS\n # WE SHOULD TELL THE USER TO TRY AGAIN ?\n end",
"def reservation_confirmed user_reservations = []\n @reservations = user_reservations\n mail(to: @reservations.first.user.email, subject: \"Your Reservation(s) is Confirmed\") do |format|\n format.text\n format.mjml\n end\n end",
"def book_request_decline_confirm\n booking_staff = BookingStaff.find_by_confirm_token(params[:id])\n\n if booking_staff\n staff_id = booking_staff.id\n declined_status = STATUS_DECLINED\n\n if self.book_request_response(staff_id, declined_status)\n booking_staff.send_email_booking_declined\n booking_staff.update(:confirm_token => nil)\n render 'request_decline_confirm'\n return\n end\n end\n\n # NOTE - IF FOR WHATEVER REASON GETTING THE BookingStaff MODEL FAILS\n # WE SHOULD TELL THE USER TO TRY AGAIN ?\n end",
"def booked_not_confirmed\n @greeting = \"Hi\"\n\n mail to: \"to@example.org\"\n end",
"def confirmed(assignment)\n setup_user_email(assignment)\n @subject += I18n.translate 'assignment_mailer.accepted.subject', :event => assignment.event.code\n end",
"def event_update(booking)\n @booking = booking\n mail(to: @booking.user.email, subject: \"#{@booking.event.title} details have been updated\")\n end",
"def send_request_confirmation_email\n ReservationMailer.request_confirmation(self).deliver_now\n end",
"def notify_approaching_reservation_to_tenant(reservation)\n @reservation = reservation\n @tenant = @reservation.user\n @cookoon = @reservation.cookoon\n @host = @cookoon.user\n mail(to: @tenant.full_email, subject: 'Votre location Cookoon se rapproche !')\n end",
"def set_booking_confirmation\n @booking_confirmation = BookingConfirmation.find(params[:id])\n end",
"def request_approval\n reservation = Reservation.first\n ReservationMailer.request_approval(reservation)\n end",
"def check_schedule_confirmed\n\t\t# Picked a random 'check' user service and temporary set it's status to schedule_confirmed\n\t\tuser_service \t\t= UserService.find_by(relationship_type: 'check')\n\t\tuser_service.date \t= Time.now\n\t\tuser_service.status = 'schedule_confirmed'\n\t\tUserServicesMailer.check_updated(user_service)\n\tend",
"def send_booking_email(info)\n # Send email with booking confirmation\n MemberMailer.booking(self, info).deliver_now\n end",
"def send_confirmation_email\n\t\tRentersConfirmationJob.perform_later self\n OwnersConfirmationJob.perform_later self\n\tend",
"def appointment_pending(appoint_obj)\n @doctor = Doctor.find_by_id(appoint_obj.doctor_id)\n @patient = Patient.find_by_id(appoint_obj.patient_id)\n mail(:to => @doctor.email, :subject => \"New Appointment\")\n end",
"def update\n meeting = Meeting.find(@attending.meeting_id)\n notification_text = \"#{current_user.first_name} #{current_user.last_name} has accepted your invite to #{meeting.description}.\"\n Notification.create(user_id: meeting.organiser_id, message: notification_text)\n @attending.update(confirmed: true)\n redirect_to meetings_path\n end",
"def pending_any_confirmation; end",
"def send_update_booking(booking)\n # binding.pry\n @booking = booking\n mail to: @booking.guide.member.email,subject: \"Tabitomo! 予約変更通知\"\n end",
"def booking_email(reservation) #customer, host, reservtion_id\n @user = reservation.user #appoint reservation user id(email,name)\n @host = reservation.listing.user #appoint listing user(email,name)\n @listing = reservation.listing #appoint reservation. listing(which id)\n\n mail(to: @user.email, subject: \"Thank you for your booking.\") #after all info appointed, send an email to user(customer)\n end",
"def send_confirmation\n send_message(\"confirmation\")\n end",
"def after_confirmation\n if unconfirmed_wca_id.present?\n WcaIdClaimMailer.notify_delegate_of_wca_id_claim(self).deliver_later\n end\n end",
"def confirm!\n return false if purchased?\n confirmed!\n end",
"def confirm\n end",
"def confirm\n end",
"def check_if_status_is_booked\n\t\tif booking_status == BookingStatus.find_by_status(\"Booked\")\n\t\t\t@trips = TripsToUser.find_all_by_post_id(self.id)\n\t\t\t@trips.each do |trip|\n\t\t\t\tNotification.create(\n\t\t user_id: trip.user_who_agreed_id,\n\t\t notification_type: NotificationType.find_by_name(\"trip_confirmed\").id,\n\t\t title: \"Trip has been confirmed.\",\n\t\t message: \"Your trip with #{self.user} is official, click the link below to view the trip details.\",\n\t\t related_id: self.id\n\t\t )\n\t\t\tend\n\t\tend\n\tend",
"def send_new_booking_request_notifications\n\n if pay_now\n notify_manager_pay_now\n notify_request_to_customer_pay_now\n else\n notify_manager\n notify_request_to_customer\n end\n\n end",
"def bearstor_confirm\n to = params[:patron_email]\n from = \"Barnard Remote Request Service <#{params[:staff_email]}>\"\n title = params[:bib_record].title\n subject = \"BearStor Request Confirmation [#{title}]\"\n mail(to: to, from: from, subject: subject)\n end",
"def confirmation_vote(verifier)\n @event = Event.find(verifier.event_id)\n @url = verify_url(token: verifier.token)\n mail(to: verifier.email, subject: t(\"mails.notifier.tag\") + \" \" + t(\"mails.notifier.confirmation_vote.subject\"))\n end",
"def confirmation_params\n params.require(:booking).permit(:confirmation_status, :confirmation_message)\n end",
"def email_confirm\n end",
"def update\n if @booking.update(confirmation_params)\n redirect_to room_bookings_path(room_id: @booking.room.id), notice: \"Booking confirmation has been set\"\n else\n render :index\n end\n end",
"def email_confirmation_to_patient(choice)\n if choice == :approve\n PatientMailer.appointment_confirmation_email(self).deliver_later\n elsif choice == :deny\n PatientMailer.appointment_deny_email(self).deliver_later\n end\n\n end",
"def hotel_notification(hotel, action, current_user)\n @user = current_user\n @action = action\n @hotel = hotel\n mail(to: \"zmb1391@gmail.com\", subject: \"Hotel created/updated/destroyed\")\n end",
"def confirm\n approval = Approval.find_by(id: params[:id])\n approval.approval = true\n approval.save\n redirect_to users_path\n end",
"def confirming?\n self.status == 'confirming'\n end",
"def custConfirmation\n ContactMailer.custConfirmation\n end",
"def reservation_confirmation(res_id, total_price)\n @total_price = total_price\n @reservation = Reservation.find(res_id)\n # @reservation[:check_in_date] = unsanitize_date @reservation[:check_in_date].to_s\n # @reservation[:check_out_date] = unsanitize_date @reservation[:check_out_date].to_s\n @kennel = Kennel.find(@reservation[:kennel_id])\n @hours_of_operation = HoursOfOperation.where(kennel_id: @kennel[:id]).first\n mail(to: @reservation[:customer_email], subject: 'PawBookings Reservation Receipt', bcc: [\"pawbookings@gmail.com\"])\n end",
"def confirmation\n puts \"this is your information:\"\n puts \" name:#{@name}, date:#{@day_start} to #{@day_end}, phone:#{@phone}, email:#{@email}\".colorize(:color => :red)\n puts\n puts \"Congratulations! You have booked your dog boarding successfully. Looking foorward to see you soon!\"\n end",
"def food_partner_confirmation_notice(enquiry)\n @enquiry = enquiry\n @food_partner = @enquiry.food_partner\n @customer = @enquiry.customer\n mail(subject: \"[team] #{@food_partner.company_name} confirmed order #{@enquiry.id}\")\n end",
"def send_confirmation\n reply 'confirmation'\n end",
"def invite!\n #logger.debug 'invite called'\n self.confirm!\n super\n #self.confirmed_at = Time.now\n #self.save\n end",
"def confirmation\n @reservation = Reservation.find(params[:id])\n render action: \"show\"\n end",
"def application_confirmed(exam_candidate)\n @exam_candidate = exam_candidate\n \n using_locale @exam_candidate.language do\n mail :to => @exam_candidate.email_address_with_name\n end\n end",
"def confirm!\n UserMailer.new_registration(self).deliver_now\n super\n end",
"def confirmed_booking_params\n params.require(:booking).permit(:confirmed)\n end",
"def new_booking(booking)\n @booking = booking\n mail(to: booking.event.user.email, subject: \"#{booking.user.first_name} has signed up for #{booking.event.title}!\")\n end",
"def after_save(user)\n if user.confirmed_at_changed?\n Invitation.where(friend_id: user.id).each do |invitation|\n invitation.confirm!\n end\n end\n end",
"def confirmed?\n confirmation == 'Confirmed'\n end",
"def notify\n #ensure that you own the reservation or club\n #send notifcation in the background\n reservation = UserReservation.find(params[:user_reservation_id])\n\n if(reservation.contact.nil?) then\n Rails.logger.error \"No Contact email\"\n render json: {message:'No contact info'}, status: :expectation_failed\n return\n end\n\n if(reservation.contact.email.nil?) then\n Rails.logger.error \"Contact has no email\"\n render json: {message:'Contact has no email'}, status: :expectation_failed\n end\n\n #contact has email, deliver the email\n UserReservationMailer.notify(reservation).deliver_later\n head :ok\n end",
"def confirm_event(event)\n participant_event = get_participant_event(event)\n return false if participant_event.nil? or not events_in_period(event.start, event.finish).empty?\n\n relation_user_route(event)\n participant_event.confirmed = true\n participant_event.save\n end"
] |
[
"0.7824383",
"0.7661112",
"0.7630363",
"0.7590151",
"0.74990815",
"0.74844605",
"0.7454309",
"0.7424065",
"0.7356704",
"0.728971",
"0.725532",
"0.7187085",
"0.70948106",
"0.70543724",
"0.70438325",
"0.69897443",
"0.6925513",
"0.6871741",
"0.68680906",
"0.6831888",
"0.68303454",
"0.6823258",
"0.681526",
"0.68115777",
"0.6789872",
"0.67838347",
"0.67805505",
"0.6739747",
"0.6684595",
"0.66646874",
"0.6648019",
"0.6619502",
"0.6607407",
"0.66068035",
"0.6590607",
"0.6588731",
"0.65771",
"0.657053",
"0.65441066",
"0.652117",
"0.6520121",
"0.6506534",
"0.650407",
"0.6469172",
"0.64669824",
"0.6453561",
"0.6449523",
"0.6447559",
"0.644665",
"0.6446348",
"0.64327925",
"0.6428685",
"0.64241374",
"0.6423541",
"0.641711",
"0.6414006",
"0.6409742",
"0.6393383",
"0.6386919",
"0.6382841",
"0.6376408",
"0.63724613",
"0.63712156",
"0.6353384",
"0.63525975",
"0.6342283",
"0.6339344",
"0.63365895",
"0.6322429",
"0.63085157",
"0.6299633",
"0.6297138",
"0.6285867",
"0.6285867",
"0.6281764",
"0.6277631",
"0.62775064",
"0.6260795",
"0.62479603",
"0.6235443",
"0.6229091",
"0.62227863",
"0.62098616",
"0.620747",
"0.6199544",
"0.6195895",
"0.61904925",
"0.61807823",
"0.6178475",
"0.61738455",
"0.61733043",
"0.6172138",
"0.615256",
"0.6142545",
"0.6139806",
"0.6138687",
"0.6130357",
"0.6129462",
"0.61291957",
"0.6129059"
] |
0.73429084
|
9
|
SUPPLEMENTS SUMMARY Total summary
|
def total_summary
products = {}
products.store(:item_cost, item_cost)
products.store(:extras_cost, extras_cost)
supplements = {}
supplements.store(:pick_up_place, pickup_place_cost)
supplements.store(:return_place, return_place_cost)
supplements.store(:time_from_cost, time_from_cost)
supplements.store(:time_to_cost, time_to_cost)
supplements.store(:driver_age_cost, driver_age_cost)
supplements.store(:category_supplement_1, category_supplement_1_cost)
supplements.store(:category_supplement_2, category_supplement_2_cost)
supplements.store(:category_supplement_3, category_supplement_3_cost)
supplements.store(:supplement_1, supplement_1_cost)
supplements.store(:supplement_2, supplement_2_cost)
supplements.store(:supplement_3, supplement_3_cost)
deposit = {}
deposit.store(:product_deposit_cost, product_deposit_cost)
totals = {}
totals.store(:total_cost, total_cost)
totals.store(:total_paid, total_paid)
totals.store(:total_pending, total_pending)
summary = {products: products,
supplements: supplements,
deposit: deposit,
totals: totals }
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def summary\n \n end",
"def summary; end",
"def summary; end",
"def summary; end",
"def summary; end",
"def summary\n end",
"def summary\n end",
"def summary\n # TODO\n end",
"def product_summary\n cell(CardProduct::Cell::Summary, card_product)\n end",
"def summary\n {}\n end",
"def totals_pipeline\n Offer.totals_pipeline(self)\n end",
"def ppptotal\n pppquantity + pppquality + pppontime + pppeffective + \n pppknowledge + ppprules + pppcommunication +\n pppleader + pppmanage + pppdiscipline + pppproactive + ppprelate + \n pppparttwo\n end",
"def ppptotal\n pppquantity + pppquality + pppontime + pppeffective + \n pppknowledge + ppprules + pppcommunication +\n pppleader + pppmanage + pppdiscipline + pppproactive + ppprelate + \n pppparttwo\n end",
"def summary(param)\n extract_values_from_cart_summary[param]\n end",
"def summaries\n header = summarize_per.header\n summaries = default_summaries\n operand.each { |tuple| summaries.summarize_by(header, tuple) }\n summaries\n end",
"def total\n total = with_product_discounts\n total = with_basket_discounts(total)\n return \"£#{total}\"\n end",
"def total; end",
"def summary\n @items.map { |i| \"* #{i.title}\" }.join(\"\\n\")\n end",
"def count_total()\n self.regulatory_elements.count\n end",
"def pretotal\n total\n end",
"def totals_table\n strings = []\n strings << \"#{@labels[:subtotal]}:\"\n strings << @document.subtotal\n strings << \"#{@labels[:tax]}:\"\n strings << @document.tax\n strings << \"#{@labels[:tax2]}:\"\n strings << @document.tax2\n strings << \"#{@labels[:tax3]}:\"\n strings << @document.tax3\n strings << \"#{@labels[:total]}:\"\n strings << @document.total\n strings\n end",
"def wrt_total_purchs(count, options = {})\n format = options[:format] || 6\n $report_file.puts(\"Total Purchases:\" + \"%#{format}s\" % count.to_s)\nend",
"def sum_produits_used\n sum = 0\n self.protofactures.each { |p| sum += p.prix_unit * (p.quantite - p.stock) }\n sum\n end",
"def summary\n return @summary\n end",
"def summary\n return @summary\n end",
"def summary\n return @summary\n end",
"def get_total\n counts = convert_to_hash(@item_list)\n uniq_items = @item_list.uniq\n\n final = (@total - @sale.apply(uniq_items, counts)).round(2) # Used round for precision\n puts get_invoice + final.to_s\n final\n end",
"def total\n (@products.values.sum * 1.075).round(2)\n end",
"def spending_table(hash, total)\n puts \"\".center(80, \"_\")\n hash.each{ |item, value| puts tabled_format(item, value) }\n puts \"\".center(80, \"_\")\n total = hash.values.inject(:+)\n puts tabled_format(\"Total\", total)\n end",
"def total\n sum(:total)\n end",
"def print_summary\n puts \"\\n\\nScore : # Instances\\n\" << (\"=\" * 19)\n @summary_totals.each_with_index { |value, index| puts \" %5d:%8d\\n\" % [index, value] unless value.nil? }\n puts \"\\n** End of Report\"\n end",
"def overall_total\n puts \"Portfolio Total: $#{sprintf('%.2f', @all_totals)}\"\n end",
"def print_summary(products_with_errors)\n info_and_log(\"\\n--------\\nSUMMARY:\\n\")\n @products.sort.each do |product|\n result = products_with_errors.include?(product) ? '-' : '+'\n info_and_log(\" #{product}: #{result}\")\n end\n end",
"def total\n # TODO: implement total\n if products.length == 0\n return 0\n end\n ((@products.values.sum)*1.075).round(2)\n end",
"def total\n # Calculo el total sin descuentos\n self.total_prize = @products.map {|p| p.prize }.inject :+\n\n # Aplico todos los descuentos dinamicamente\n @discounts.each do |discount|\n discount.call self\n end\n\n self.total_prize # Retorno el precio final\n end",
"def summarize_suite(suite, tests); end",
"def summarize_suite(suite, tests); end",
"def pollen_totals\n totals(:pollen_id)\n end",
"def summary\n report = raw_summary\n\n ret = \"\"\n report.keys.sort_by(&:to_s).each do |key|\n ret += \"#{Puppet::Util::Metric.labelize(key)}:\\n\"\n\n report[key].keys.sort { |a,b|\n # sort by label\n if a == TOTAL\n 1\n elsif b == TOTAL\n -1\n else\n report[key][a].to_s <=> report[key][b].to_s\n end\n }.each do |label|\n value = report[key][label]\n next if value == 0\n value = \"%0.2f\" % value if value.is_a?(Float)\n ret += \" %15s %s\\n\" % [Puppet::Util::Metric.labelize(label) + \":\", value]\n end\n end\n ret\n end",
"def total_specials\n self.specials.displayable(Date.today).count\n end",
"def all_data\n total_amounts(:all) + electricity_usages(:all) + gas_usages(:all) + water_usages(:all)\n end",
"def sell_bonus\n features_sum(:sell_bonus)\n end",
"def product_total\n\t\ttotal = 0\n\t\tself.items.each do |item|\n\t\t\ttotal += item.amount\n\t\tend\n\t\ttotal\n\tend",
"def account_summary(account)\n [number_to_currency(account.opportunities.pipeline.map(&:weighted_amount).sum, precision: 0),\n t(:added_by, time_ago: time_ago_in_words(account.created_at), user: account.user_id_full_name),\n t('pluralize.contact', account.contacts_count),\n t('pluralize.opportunity', account.opportunities_count),\n t('pluralize.comment', account.comments.count)].join(', ')\n end",
"def render_summary\n summary = nil\n\n end",
"def item_bonus\n features_sum(:item_bonus)\n end",
"def total\n @total\n end",
"def summarize\n print \"# of asks: #{ask_count}\\n# of bids: #{bid_count}\\nAsk volume: #{ask_volume.to_s('F')}\\nBid volume: #{bid_volume.to_s('F')}\\n\"\n $stdout.flush\n end",
"def subscriptions_summary\n @subscription_summary ||= \n { :available => subscriptions.inject(0) do |quantity, sub|\n quantity += sub.quantity\n end,\n :used => subscriptions.inject(0) do |consumed, sub|\n consumed += sub.consumed\n end\n }\n end",
"def total_text\n 'Total: %d' % total\n end",
"def total\n @sum = @products.values.inject(0, :+)\n @total = @sum + (@sum * 0.075).round(2)\n return @total\n end",
"def transaction_summary()\n 'Adjustment ' + adjustment_type\n end",
"def total\n total = (@products.values.sum) * 1.075\n return total.round(2)\n end",
"def subtotal\n debt_claim_items.reject(&:marked_for_destruction?).sum(&:debt)\n end",
"def totalSimplificado\n @biblioteca.livrosComoLista.map(&:preco).inject(0){|total, preco| total += preco}\n end",
"def total\n count\n end",
"def summary_detail\n Classifieds::Listing.format_cols([@title, @mileage, @price], SUMMARY_COL_FORMATS)\n end",
"def total\n\t\tif @products == {}\n\t\t\treturn 0\n\t\telse\n\t\t\treturn (@products.sum {|product, cost| cost} * 1.075).round(2)\n\t\tend\n\tend",
"def total\n array = @products.values\n if array != []\n tally = array.reduce(:+)\n tally += (0.075 * tally)\n return tally.round(2)\n else\n return 0\n end\n end",
"def get_Total()\n \t return @outputs[\"Total\"]\n \tend",
"def item_total\n line_items.map(&:total).reduce(:+)\n end",
"def report_total_hours(all_entries)\n printf \"TOTAL %.2f\\n\", total(all_entries.flatten)\nend",
"def summary\n report = raw_summary\n\n ret = \"\"\n report.keys.sort { |a,b| a.to_s <=> b.to_s }.each do |key|\n ret += \"#{Puppet::Util::Metric.labelize(key)}:\\n\"\n\n report[key].keys.sort { |a,b|\n # sort by label\n if a == :total\n 1\n elsif b == :total\n -1\n else\n report[key][a].to_s <=> report[key][b].to_s\n end\n }.each do |label|\n value = report[key][label]\n next if value == 0\n value = \"%0.2f\" % value if value.is_a?(Float)\n ret += \" %15s %s\\n\" % [Puppet::Util::Metric.labelize(label) + \":\", value]\n end\n end\n ret\n end",
"def subtotal_amount\n $tracer.trace(format_method(__method__))\n return ToolTag.new(@tag.find.span.id(\"/_SubtotalLabel$/\"), format_method(__method__))\n end",
"def component_total(components, total = 0)\n components.each do |comp|\n total += impact_total(comp) if comp['impacts'].present?\n total += component_total(comp['components']) if comp['components'].present?\n end\n total\n end",
"def total\n add_products = 0\n @products.each_value do |cost|\n add_products += cost\n end\n total = (add_products + (add_products * 0.075)).round(2)\n return total\n end",
"def total\n return (@listOfItem.inject(0){|sum,e| sum += e.total}).round_to(2)\n end",
"def summary\n @recipes.map do |recipe|\n recipe.ingredients_required.sort_by do |ingredient, amt|\n ingredient.calories * amt\n end\n end\n end",
"def after_taxes\n printed_list = \"\"\n @total = 0\n @list.each do |item, quantity|\n item_total = quantity * item.price\n @total += item_total\n printed_list += \"#{quantity} #{item.name}: #{MONEY_FORMAT % item.price}\\n\"\n end\n return printed_list\n end",
"def total\n if @products.empty?\n return 0\n else\n total = (@products.values.sum * 1.075).round(2)\n end\n return total\n end",
"def summary\n result = []\n @subprocessors.each { |processor| result << processor.summary }\n result.flatten(1).compact\n end",
"def summary(include_item_specifics = false)\n string = []\n string << title.ljust(80)\n string << \"[#{status.to_s}]\".capitalize.rjust(15)\n\n if has_variations?\n string << \"\\n #{variations.count} Variations:\"\n variations.each do |variation|\n string << \"\\n #{variation[:sku]}: \"\n string << \"#{variation[:quantity_available].to_s.rjust(3)} @ #{(variation[:current_price].symbol + variation[:current_price].to_s).rjust(6)}\"\n string << \" #{variation[:quantity_listed].to_s.rjust(2)} listed, #{variation[:quantity_sold].to_s.rjust(2)} sold\"\n end\n else\n string << \"\\n \"\n string << \"#{quantity_available.to_s} @ \"\n string << \"#{current_price.symbol}#{current_price.to_s}\"\n if best_offer? # Cannot have best offer on variations\n string << ' with Best Offer'\n string << \" #{best_offer_auto_accept_price.symbol}#{best_offer_auto_accept_price}\" if best_offer_auto_accept_price\n string << \" | #{best_offer_minimum_accept_price.symbol}#{best_offer_minimum_accept_price}\" if best_offer_minimum_accept_price\n end\n end\n\n if promotional_sale?\n details = promotional_sale\n starts = details[:start_time]\n ends = details[:end_time]\n original_price = promotional_sale[:original_price]\n string << \"\\n \"\n string << 'ON SALE NOW!' if on_sale_now?\n string << 'was on sale' if Time.now.utc > ends\n string << 'sale scheduled' if Time.now.utc < starts\n string << \" original price #{original_price.symbol}#{original_price.to_s}\"\n string << \" #{starts.strftime('%H:%M %A')}\"\n string << \" until #{ends.strftime('%H:%M %A')}\"\n end\n string << \"\\n\"\n\n string << \"#{quantity_sold.to_s.rjust(4)} sold\"\n if quantity_sold > 0 && status == :completed\n days = (end_time - start_time).round.to_i\n if days > 1\n string << \" in #{days} days\"\n else\n hours = ((end_time.to_time - start_time.to_time) / 1.hour).round\n string << \" in #{hours} hours\"\n end\n end\n\n string << \", #{watch_count} watchers, #{hit_count} page views.\"\n string << \"\\n\"\n\n string << \" SKU: #{sku} Photos: #{photo_urls.count} eBay ID: \"\n string << \"#{relist_parent_id} <= \" unless relist_parent_id.nil?\n string << \"#{ebay_item_id}\"\n string << \" => #{relist_child_id}\" unless relist_child_id.nil?\n\n string << \"\\n \"\n if gtc?\n date_time = (Time.now.utc < end_time) ? Time.now.utc : end_time\n days = (date_time - start_time).round.to_i\n if days > 1\n string << \"GTC [#{days} days]\"\n else\n hours = ((date_time.to_time - start_time.to_time) / 1.hour).round\n string << \"GTC [#{hours} hours]\"\n end\n\n else\n string << \"#{duration} Day\"\n end\n string << \" #{category_1_path.join(' -> ')}\"\n\n string << \"\\n \"\n string << \"#{start_time.strftime('%l:%H%P %A %-d %b').strip} until #{end_time.strftime('%l:%H%P %A %-d %b').strip}\"\n\n if include_item_specifics\n item_specifics.each_pair do |key, value|\n string << \"\\n#{key.rjust(30)} : #{value}\"\n end\n end\n\n string.join\n end",
"def total\n @total\n end",
"def available_agent_summary\n @priorities.inject({}) do |summary, data|\n priority, agents = *data\n summary[:total] ||= 0\n summary[:total] += agents.count\n summary[:priorities] ||= {}\n summary[:priorities][priority] = agents.count\n summary\n end\n end",
"def totals\n @totals.map do |action, values|\n if values.is_a?(Array) && !values.empty?\n values.map do |value|\n \"#{action}[]=#{value}\"\n end\n end\n end.join('&')\n end",
"def item_total\n @promotion_attributed_line_items.map(&:amount).sum\n end",
"def total\n if @products == {}\n return 0 \n else\n m = 0\n @products.values.each do |v|\n m += v\n end\n\n sum = (m + (m * 0.075)).round(2)\n return sum\n end\n end",
"def total_tuition_cost\n tuition_cost = courses.inject(0) {|sum, c| sum + c.cost}\n tuition_cost = sprintf( \"%0.02f\", tuition_cost).to_s.reverse.gsub(/(\\d{3})(?=\\d)/, '\\\\1,').reverse\n puts \"\\nTotal tuition paid: $#{tuition_cost}\n \\n\"\n\n # puts tp self.courses,:subject,:cost\n tp self.courses,:subject, {\"Course Coste\" => {:display_method => lambda{|x| \"$\" + \"#{sprintf( \"%0.02f\", x.cost).to_s.reverse.gsub(/(\\d{3})(?=\\d)/, '\\\\1,').reverse}\"}}}\n\n end",
"def total\n @total = 0\n @ordered_items.each do |item|\n @total += item[1]\n end\n return @total\n end",
"def total_entries\n collection.total_count\n end",
"def total\n total = 0\n self.menu_items.each do |item|\n total += item.price\n end\n \"$#{total}\"\n end",
"def bee_totals\n totals(:bee_id)\n end",
"def summary\n summary =\n \" - Name: #{@name}\\n\"+\n \" - Color: #{@color}\\n\"+\n \" - Mass (in kg): #{@mass_kg}kg\\n\"+\n \" - Distance From Sun (in km): #{@distance_from_sun_km} million km.\\n\"+\n \" - Fun Fact: #{@fun_fact}\"\n return summary\n end",
"def collectives_report\n collectives = get_collectives\n\n puts \" %-30s %s\" % [ \"Collective\", \"Nodes\" ]\n puts \" %-30s %s\" % [ \"==========\", \"=====\" ]\n\n collectives[:collectives].sort_by {|key,count| count.size}.each do |collective|\n puts \" %-30s %d\" % [ collective[0], collective[1].size ]\n end\n\n puts\n puts \" %30s %d\" % [ \"Total nodes:\", collectives[:nodes] ]\n puts\n end",
"def total\n return 0 if @products.empty?\n total = (@products.sum { |name, price| price } * 1.075).round(2)\n return total\n end",
"def sum_overall\n @categories.inject(0.0) { |sum, (name, cat)| sum + cat[:sum] }\n end",
"def summary(db)\n\tif $table_exists\n\t\tall_items = db.execute(\"SELECT * FROM items\")\n\t\ttotal = 0\n\t\tall_items.each do |item|\n\t\t\tputs \"\\n#{item['id']}) #{item['name']} - #{item['calories']} calories\"\n\t\t\ttotal += item['calories']\n\t\tend\n\t\tputs \"You have consumed a total of #{total} calories so far\"\n\telse\n\t\tputs \"There are no items in your table.\"\n\tend\nend",
"def install_summary\n return @install_summary\n end",
"def summary\n summary = \"\n - Name: #{@name}\n - Color: #{@color}\n - Mass (in kg): #{@mass_kg}\n - Distance From Sun (in km): #{@distance_from_sun_km}\n - Fun Fact: #{@fun_facts}\"\n\n #returns summary as string\n return summary\n end",
"def total\n sub_total\n end",
"def summary\n @transmission.summary\n end",
"def total_impact\n component_total(components)\n end",
"def total_items\n line_items.sum(:quantity)\n end",
"def total_items\n line_items.sum(:quantity)\n end",
"def summary\n #render unless @output\n @summary\n end",
"def total_items\n\t\tline_items.sum(:quantity)\n\tend",
"def dessert_item_count\n desserts = @menu[:desserts]\n total = 0\n desserts.each { |k, v| total += v.size }\n total\n end",
"def addup_total\n\t\tget_total\n\t\tupdate_total = {}\n\t\tupdate_total[\"c_ExpScopingTotal\"] = @total\n\t\tif(@total>0)\n\t\t\trally = @query_result.get_rally_object\n\t\t\tupdate = rally.update(\"portfolioitem\",\"FormattedID|#{@feature_id}\",update_total)\n\t\t\tif(update)\n\t\t\t\t@logger.info(\"Total for #{@feature_id} is updated to #{@total}\")\n\t\t\telse\n\t\t\t\t@logger.info(\"Total could not be updated\")\n\t\t\tend\n\t\tend\n\tend",
"def total\n if @products.length == 0\n return 0\n else\n total = @products.values.reduce(:+)\n total*= 1.075 #Tax\n total = total.round(2)\n return total\n end\n end",
"def order_total_amount\n $tracer.trace(format_method(__method__))\n return ToolTag.new(@tag.find.span.id(\"/_lblTotal$/\"),\n format_method(__method__))\n end"
] |
[
"0.65217954",
"0.64695597",
"0.64695597",
"0.64695597",
"0.64695597",
"0.6441944",
"0.6441944",
"0.641073",
"0.62980616",
"0.62752295",
"0.62259245",
"0.6189717",
"0.6189717",
"0.6167211",
"0.6131053",
"0.61240464",
"0.60512584",
"0.60227007",
"0.6010383",
"0.5976836",
"0.5966664",
"0.5930532",
"0.5924711",
"0.5922077",
"0.5922077",
"0.5922077",
"0.5915713",
"0.5912951",
"0.58821094",
"0.5869118",
"0.5861041",
"0.58589906",
"0.58547336",
"0.5854319",
"0.58497787",
"0.5826769",
"0.5826769",
"0.582342",
"0.5816187",
"0.58152807",
"0.5814839",
"0.5806767",
"0.58009213",
"0.5799776",
"0.578648",
"0.5776186",
"0.577448",
"0.57729405",
"0.5771584",
"0.5760496",
"0.5752945",
"0.57527137",
"0.57521",
"0.5750146",
"0.5745393",
"0.57437974",
"0.57335913",
"0.57307935",
"0.57223654",
"0.57185245",
"0.57098615",
"0.570385",
"0.570158",
"0.5697778",
"0.5694504",
"0.56880695",
"0.5684639",
"0.56792307",
"0.5675069",
"0.56618714",
"0.56605273",
"0.56455165",
"0.56366295",
"0.56360227",
"0.56347096",
"0.56311506",
"0.56264144",
"0.56264025",
"0.56180257",
"0.5615002",
"0.5610204",
"0.56084126",
"0.5605984",
"0.56055975",
"0.560358",
"0.55950004",
"0.559066",
"0.55837417",
"0.5583231",
"0.55825025",
"0.5580463",
"0.5580411",
"0.5580048",
"0.5580048",
"0.5579965",
"0.5577747",
"0.5576546",
"0.5574688",
"0.5571484",
"0.55714476"
] |
0.7099747
|
0
|
BOOKING LINES Add a booking line to the reservation == Parameters:: item_id:: The item id quantity:: The quantity
|
def add_booking_line(item_id, quantity)
# Check if the booking includes the item_id
product_lines = self.booking_lines.select do |booking_line|
booking_line.item_id == item_id
end
if product_lines.empty?
if product = ::Yito::Model::Booking::BookingCategory.get(item_id)
product_customer_translation = product.translate(customer_language)
product_unit_cost = product_item_cost_base = product.unit_price(self.date_from, self.days, nil, self.sales_channel_code).round(0)
product_deposit_cost = product.deposit
## Apply promotion code and offers
rates_promotion_code = if !self.promotion_code.nil? and !self.promotion.code.empty?
::Yito::Model::Rates::PromotionCode.first(promotion_code: self.promotion_code)
else
nil
end
discount = ::Yito::Model::Booking::BookingCategory.discount(product_unit_cost, item_id, self.date_from, self.date_to, rates_promotion_code) || 0
product_unit_cost = (product_unit_cost - discount).round(0) if discount > 0
## End apply offers
## Category supplements
product_supplement_1_unit_cost = product.category_supplement_1_cost || 0
product_supplement_2_unit_cost = product.category_supplement_2_cost || 0
product_supplement_3_unit_cost = product.category_supplement_3_cost || 0
if sales_channel_code
if bcsc = Yito::Model::Booking::BookingCategoriesSalesChannel.first(conditions: {'sales_channel.code': sales_channel_code, booking_category_code: product.code })
product_supplement_1_unit_cost = bcsc.category_supplement_1_cost || 0
product_supplement_2_unit_cost = bcsc.category_supplement_2_cost || 0
product_supplement_3_unit_cost = bcsc.category_supplement_3_cost || 0
end
end
## End of category supplements
transaction do
# Create booking line
booking_line = BookingDataSystem::BookingLine.new
booking_line.booking = self
booking_line.item_id = item_id
booking_line.item_description = product.name
booking_line.item_description_customer_translation = (product_customer_translation.nil? ? product.name : product_customer_translation.name)
booking_line.item_unit_cost_base = product_item_cost_base
booking_line.item_unit_cost = product_unit_cost
booking_line.item_cost = product_unit_cost * quantity
booking_line.quantity = quantity
booking_line.product_deposit_unit_cost = product_deposit_cost
booking_line.product_deposit_cost = product_deposit_cost * quantity
booking_line.category_supplement_1_unit_cost = product_supplement_1_unit_cost
booking_line.category_supplement_1_cost = product_supplement_1_unit_cost * quantity
booking_line.category_supplement_2_unit_cost = product_supplement_2_unit_cost
booking_line.category_supplement_2_cost = product_supplement_2_unit_cost * quantity
booking_line.category_supplement_3_unit_cost = product_supplement_3_unit_cost
booking_line.category_supplement_3_cost = product_supplement_3_unit_cost * quantity
booking_line.save
# Create booking line resources
(1..quantity).each do |resource_number|
booking_line_resource = BookingDataSystem::BookingLineResource.new
booking_line_resource.booking_line = booking_line
booking_line_resource.save
end
# Update booking cost
self.item_cost += (product_unit_cost * quantity)
self.product_deposit_cost += (product_deposit_cost * quantity)
self.category_supplement_1_cost += (product_supplement_1_unit_cost * quantity)
self.category_supplement_2_cost += (product_supplement_2_unit_cost * quantity)
self.category_supplement_3_cost += (product_supplement_3_unit_cost * quantity)
self.calculate_cost(false, false)
self.save
# Assign available stock
if status == :pending_confirmation
if created_by_manager
assign_available_stock if SystemConfiguration::Variable.get_value('booking.assignation.automatic_resource_assignation_on_backoffice_request').to_bool
else
assign_available_stock if SystemConfiguration::Variable.get_value('booking.assignation.automatic_resource_assignation_on_web_request').to_bool
end
elsif status == :confirmed
if SystemConfiguration::Variable.get_value('booking.assignation.automatic_resource_assignation', 'false').to_bool
assign_available_stock
end
end
# Create newsfeed
::Yito::Model::Newsfeed::Newsfeed.create(category: 'booking',
action: 'add_booking_line',
identifier: self.id.to_s,
description: BookingDataSystem.r18n.t.booking_news_feed.created_booking_line(item_id, quantity),
attributes_updated: {item_id: item_id, quantity: quantity}.merge({booking: newsfeed_summary}).to_json)
end
self.reload
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def add_item(item_id)\n self.add_or_create_line_item(item_id)\n end",
"def add_or_create_line_item(item_id)\n if line_item = self.line_items.find_by(item_id: item_id)\n line_item.increment\n line_item\n else\n LineItem.new(cart_id: self.id, item_id: item_id)\n end\n end",
"def create_line_item\n\t\tset_sale\n\t\tpopulate_products\n\n\t\texisting_line_item = Item.where('product_id = ? AND sale_id = ?', params[:product_id], @sale.id).first\n\n\t\tif existing_line_item.blank?\n\t\t\tline_item = Item.new(product_id: params[:product_id], sale_id: params[:sale_id], quantity: params[:quantity])\n\t\t\tline_item.price = line_item.product.price\n\t\t\tline_item.save\n\n\t\t\tremove_item_from_stock(params[:product_id])\n\t\t\tupdate_line_item_totals(line_item)\n\t\telse\n\t\t\texisting_line_item.quantity += 1\n\t\t\texisting_line_item.save\n\n\t\t\tremove_item_from_stock(params[:product_id])\n\t\t\tupdate_line_item_totals(existing_line_item)\n\t\tend\n\n\t\tupdate_totals\n\n\t\trespond_to do |format|\n\t\t\tformat.js { ajax_refresh }\n\t\tend\n\tend",
"def add_item(item_id)\n line_item = self.line_items.find_by(item_id: item_id)\n if line_item\n line_item.quantity += 1\n else\n line_item=self.line_items.build(item_id: item_id)\n end\n line_item\n end",
"def create_line_item_from_inventory_item inventory_item, qty, payable_party, billable_party, include_price_in_expense, include_price_in_revenue, notes\n # Vendor\n l1 = LineItem.create!(\n :line_item_type => \"Goods\", :line_item_sub_type => \"Menu-Item\",\n :sku => inventory_item.sku, :name => inventory_item.name_vendor, :quantity => qty,\n :unit_price_expense => inventory_item.cogs,\n :tax_rate_expense => 0,\n :payable_party => payable_party,\n :include_price_in_expense => include_price_in_expense,\n :inventory_item => inventory_item, :notes => notes, :event => self)\n\n # Account\n l2 = LineItem.create!(\n :line_item_type => \"Goods\", :line_item_sub_type => \"Menu-Item\",\n :sku => inventory_item.sku, :name => inventory_item.name_public, :quantity => qty,\n :unit_price_revenue => calculate_sell_price_from_inventory_item(inventory_item),\n :billable_party => billable_party,\n :include_price_in_revenue => include_price_in_revenue,\n :inventory_item => inventory_item, :notes => notes, :event => self)\n\n l1.opposing_line_item = l2\n l2.opposing_line_item = l1\n l1.save\n l2.save\n\n [l1, l2]\n end",
"def add_item(item_id)\n if line_item = line_items.find_by(item_id: item_id)\n line_item.quantity += 1\n else\n line_item = line_items.build(item_id: item_id)\n end\n line_item\n end",
"def create_line_item_from_inventory_item_id inventory_item_id, qty, include_price_in_expense, include_price_in_revenue, notes\n # Inventory item\n inventory_item = InventoryItem.find(inventory_item_id)\n line_items.push(create_line_item_from_inventory_item(\n inventory_item, qty,\n inventory_item.vendor, account,\n include_price_in_expense, include_price_in_revenue, notes))\n end",
"def create_line_item_from_inventory_item_id inventory_item_id, qty, include_price_in_expense, include_price_in_revenue, notes\n # Inventory item\n inventory_item = InventoryItem.find(inventory_item_id)\n new_line_items = create_line_item_from_inventory_item(\n inventory_item, qty,\n inventory_item.vendor, account,\n include_price_in_expense, include_price_in_revenue, notes)\n line_items.push(new_line_items)\n new_line_items\n end",
"def create_line_item_for_per_person_charge qty, vendor_id, notes\n event_vendor = event_vendors.where(:vendor_id => vendor_id).first\n new_line_items = create_line_item_for_per_person_charge_2(event_vendor.participation, event_vendor, true, true, \"\")\n line_items.push(new_line_items)\n new_line_items\n end",
"def create_line_item_from_inventory_item inventory_item, qty, payable_party, billable_party, include_price_in_expense, include_price_in_revenue, notes\n\n [\n # Vendor\n LineItem.create(\n :line_item_type => \"Goods\", :line_item_sub_type => \"Menu-Item\",\n :sku => inventory_item.sku, :name => inventory_item.name_vendor, :quantity => qty,\n :unit_price_expense => inventory_item.cogs,\n :tax_rate_expense => 0,\n :payable_party => payable_party,\n :include_price_in_expense => include_price_in_expense,\n :inventory_item => inventory_item, :notes => notes),\n\n # Account\n LineItem.create(\n :line_item_type => \"Goods\", :line_item_sub_type => \"Menu-Item\",\n :sku => inventory_item.sku, :name => inventory_item.name_public, :quantity => qty,\n :unit_price_revenue => calculate_sell_price_from_inventory_item(inventory_item),\n :billable_party => billable_party,\n :include_price_in_revenue => include_price_in_revenue,\n :inventory_item => inventory_item, :notes => notes)\n ]\n end",
"def add_book(book)\n current_item = line_items.find_by(book_id: book.id)\n if current_item\n current_item.quantity +=1\n else\n current_item = line_items.build(book_id: book.id)\n end\n current_item\n end",
"def add_line_item(params)\r\n # Creates line items counter necessary for prefix.\r\n @LINE_ITEMS = 0 if !@LINE_ITEMS \r\n @LINE_ITEMS += 1 # VALUE REQUIRED IN:\r\n prefix = \"LV3_ITEM#{@LINE_ITEMS}_\" # USA | CANADA\r\n @PARAM_HASH[prefix + 'UNIT_COST'] = params[:unit_cost] # * *\r\n @PARAM_HASH[prefix + 'QUANTITY'] = params[:quantity] # * *\r\n @PARAM_HASH[prefix + 'ITEM_SKU'] = params[:item_sku] || '' # *\r\n @PARAM_HASH[prefix + 'ITEM_DESCRIPTOR'] = params[:descriptor] || '' # * *\r\n @PARAM_HASH[prefix + 'COMMODITY_CODE'] = params[:commodity_code] || '' # * *\r\n @PARAM_HASH[prefix + 'PRODUCT_CODE'] = params[:product_code] || '' # * \r\n @PARAM_HASH[prefix + 'MEASURE_UNITS'] = params[:measure_units] || '' # * *\r\n @PARAM_HASH[prefix + 'ITEM_DISCOUNT'] = params[:item_discount] || '' # *\r\n @PARAM_HASH[prefix + 'TAX_RATE'] = params[:tax_rate] || '' # * \r\n @PARAM_HASH[prefix + 'GOODS_TAX_RATE'] = params[:goods_tax_rate] || '' # *\r\n @PARAM_HASH[prefix + 'TAX_AMOUNT'] = params[:tax_amount] || '' # * \r\n @PARAM_HASH[prefix + 'GOODS_TAX_AMOUNT'] = params[:goods_tax_amount] || '' # *\r\n @PARAM_HASH[prefix + 'CITY_TAX_RATE'] = params[:city_tax_rate] || '' #\r\n @PARAM_HASH[prefix + 'CITY_TAX_AMOUNT'] = params[:city_tax_amount] || '' #\r\n @PARAM_HASH[prefix + 'COUNTY_TAX_RATE'] = params[:county_tax_rate] || '' #\r\n @PARAM_HASH[prefix + 'COUNTY_TAX_AMOUNT'] = params[:county_tax_amount] || '' #\r\n @PARAM_HASH[prefix + 'STATE_TAX_RATE'] = params[:state_tax_rate] || '' #\r\n @PARAM_HASH[prefix + 'STATE_TAX_AMOUNT'] = params[:state_tax_amount] || '' #\r\n @PARAM_HASH[prefix + 'CUST_SKU'] = params[:cust_sku] || '' #\r\n @PARAM_HASH[prefix + 'CUST_PO'] = params[:cust_po] || '' #\r\n @PARAM_HASH[prefix + 'SUPPLEMENTAL_DATA'] = params[:supplemental_data] || '' #\r\n @PARAM_HASH[prefix + 'GL_ACCOUNT_NUMBER'] = params[:gl_account_number] || '' #\r\n @PARAM_HASH[prefix + 'DIVISION_NUMBER'] = params[:division_number] || '' #\r\n @PARAM_HASH[prefix + 'PO_LINE_NUMBER'] = params[:po_line_number] || '' #\r\n @PARAM_HASH[prefix + 'LINE_ITEM_TOTAL'] = params[:line_item_total] || '' # * \r\n end",
"def add(product, qty)\n l = LineItem.new\n l.set_from_product(product, qty)\n @lines << l\n end",
"def lock_new_invoice_line_items party, document\n # Generate fixed-price post sub total line items from percentage based sub total line items\n subtotal = revenue_subtotal_by_party(party, false)\n line_items_after_subtotal_percentage_by_billable_party(party).each do |li|\n fixed_price = li.revenue_total_with_percentage subtotal\n line_items.create!(li.attributes.merge({unit_price_revenue: fixed_price, name: \"#{li.name} (#{li.unit_price_revenue}%)\", percentage_of_subtotal: false, parent_id: li.id}))\n end\n\n line_items_fixed_by_billable_party_including_add_ons(party, false).each do |li|\n li.document = document\n li.save\n end\n end",
"def lock_new_invoice_line_items party, document\n # Generate fixed-price post sub total line items from percentage based sub total line items\n subtotal = revenue_subtotal_by_party(party, false)\n line_items_after_subtotal_percentage_by_billable_party(party).each do |li|\n fixed_price = li.revenue_total_with_percentage subtotal\n line_items.create!(li.attributes.merge({unit_price_revenue: fixed_price, name: \"#{li.name} (#{li.unit_price_revenue}%)\", percentage_of_subtotal: false, parent_id: li.id}))\n end\n\n line_items_fixed_by_billable_party(party, false).each do |li|\n li.document = document\n li.save\n end\n end",
"def create\n @item_line = ItemLine.new(params[:item_line])\n\n respond_to do |format|\n if @item_line.save\n format.html { redirect_to @item_line, notice: 'Item line was successfully created.' }\n format.json { render json: @item_line, status: :created, location: @item_line }\n else\n format.html { render action: \"new\" }\n format.json { render json: @item_line.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_line_item(table)\r\n values = []\r\n if table_exists?(table)\r\n columns = get_column_names(table)[1..-1]\r\n insert = Array.new(columns).fill('?').join(\", \")\r\n get_data_types(table).each_with_index do |type, i|\r\n prefix = nil\r\n prefix = columns[i].split('_id').join if /[_id]$/.match(columns[i])\r\n if !get_tables.include? prefix\r\n values << get_number(columns[i]) if type == 'INTEGER' || type == 'INT'\r\n values << get_string(columns[i]) if type == 'VARCHAR(255)'\r\n values << get_boolean(columns[i]) if type == 'BOOLEAN'\r\n else\r\n puts \"#{columns[i]} references table #{prefix}\"\r\n puts \"would you like to see that table now?\"\r\n print_table(prefix) if get_response == 'yes'\r\n puts \"would you like to reference one of the available lines?\"\r\n response = get_response\r\n if response == 'no' || get_ids(prefix).empty?\r\n puts \"That table has no lines to reference. We'll have to make a new one.\" if response == 'yes'\r\n puts \"Alright! We will now create a new line for you to reference\"\r\n create_line_item(prefix)\r\n values << get_ids(prefix)[-1]\r\n else \r\n puts \"Alright! Please input the id of the line you'd like to reference\"\r\n values << get_valid_id(prefix)\r\n end\r\n end\r\n end\r\n @db.execute(\"INSERT INTO #{table} (#{columns.join(\", \")}) VALUES (#{insert})\", values)\r\n end\r\n end",
"def create\n @line_item = @order.line_items.new(line_item_params)\n\n if @line_item.save\n render json: @line_item, status: :created, location: [@order, @line_item]\n else\n render json: @line_item.errors, status: :unprocessable_entity\n end\n end",
"def create_line_item_for_per_person_charge_2 qty, event_vendor, include_price_in_expense, include_price_in_revenue, notes\n # Vendor\n l1 = LineItem.create!(\n :line_item_type => \"Goods\", :line_item_sub_type => \"Menu-Fee\",\n :sku => \"MT-\" + event_vendor.menu_template_id.to_s.rjust(7, '0'), :name => \"* Per Person Charge (\" + event_vendor.vendor.name + \")\", :quantity => qty,\n :unit_price_expense => event_vendor.calculate_menu_level_cogs,\n :tax_rate_expense => 0,\n :payable_party => event_vendor.vendor,\n :include_price_in_expense => include_price_in_expense,\n :menu_template => event_vendor.menu_template, :event => self)\n\n # Account\n l2 = LineItem.create!(\n :line_item_type => \"Goods\", :line_item_sub_type => \"Menu-Fee\",\n :sku => \"MT-\" + event_vendor.menu_template_id.to_s.rjust(7, '0'), :name => \"* Per Person Charge (\" + event_vendor.vendor.name + \")\", :quantity => qty,\n :unit_price_revenue => event_vendor.calculate_menu_level_sell_price,\n :billable_party => account,\n :include_price_in_revenue => include_price_in_revenue,\n :menu_template => event_vendor.menu_template, :event => self)\n\n l1.opposing_line_item = l2\n l2.opposing_line_item = l1\n l1.save\n l2.save\n \n [l1, l2]\n end",
"def create \n @line_item = LineItem.new(line_item_params)\n respond_to do |format|\n if @line_item.save\n format.html { redirect_to '/line_items', notice: \"Line item was successfully created.\" }\n format.json { render :show, status: :created, location: @line_item }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @line_item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_line_item_for_per_person_charge qty, vendor_id, include_price_in_expense, include_price_in_revenue, notes\n event_vendor = event_vendors.where(:vendor_id => vendor_id).first\n line_items.push(create_line_item_for_per_person_charge_2(event_vendor.participation, event_vendor, true, true, \"\"))\n end",
"def create_line_item_for_per_person_charge_2 qty, event_vendor, include_price_in_expense, include_price_in_revenue, notes\n\n [\n # Vendor\n LineItem.create(\n :line_item_type => \"Goods\", :line_item_sub_type => \"Menu-Fee\",\n :sku => \"MT-\" + event_vendor.menu_template_id.to_s.rjust(7, '0'), :name => \"* Per Person Charge (\" + event_vendor.vendor.name + \")\", :quantity => qty,\n :unit_price_expense => event_vendor.calculate_menu_level_cogs,\n :tax_rate_expense => 0,\n :payable_party => event_vendor.vendor,\n :include_price_in_expense => include_price_in_expense,\n :menu_template => event_vendor.menu_template),\n\n # Account\n LineItem.create(\n :line_item_type => \"Goods\", :line_item_sub_type => \"Menu-Fee\",\n :sku => \"MT-\" + event_vendor.menu_template_id.to_s.rjust(7, '0'), :name => \"* Per Person Charge (\" + event_vendor.vendor.name + \")\", :quantity => qty,\n :unit_price_revenue => event_vendor.calculate_menu_level_sell_price,\n :billable_party => account,\n :include_price_in_revenue => include_price_in_revenue,\n :menu_template => event_vendor.menu_template)\n ]\n end",
"def create\n parent_line_item = get_parent_line_item\n if parent_line_item\n @line_item = parent_line_item.dup\n @line_item.line_item = parent_line_item\n @line_item.searchable = false\n @line_item.admin_verified = false\n @line_item.section_id = line_item_params[\"section_id\"]\n else\n @line_item = LineItem.new(line_item_params);\n end\n\n if @line_item.save\n render json: @line_item, status: :created, location: @line_item\n else\n render nothing: true, status: :bad_request\n end\n end",
"def scan_serials_for_item( item_id )\r\n self.sales_lines.each do |line|\r\n \r\n # Skip to next unless the item id is matched and serial number is not blank\r\n # TODO:\r\n # Recognize changes of this serial number (RETURNED / CANCELED / BACKORDER / NONE)\r\n next unless (line.item_id == item_id) && (line.sales_item_reservation_number?)\r\n \r\n ERP::SerialNumber.find_or_create(\r\n :account_num => self.customer.account_num,\r\n :item_id => item_id,\r\n :sales_id => self.sales_id,\r\n :serial => line.sales_item_reservation_number\r\n )\r\n end\r\n end",
"def line_item_insert(h)\n\t\trows = @database.execute <<-SQL\n\t\tINSERT INTO invoice_lines\n\t\t\t\t(number\n\t\t\t\t, invoice_id\n\t\t\t\t, line_id\n\t\t\t\t, _order\n\t\t\t\t, description\n\t\t\t\t, amount\n\t\t\t\t, first_expense_id\n\t\t \t, first_time_entry_id\n\t\t\t\t, line_item_date\n\t\t\t\t, person\n\t\t\t\t, name\n\t\t\t\t, matter\n\t\t\t\t, unit_cost\n\t\t\t\t, quantity\n\t\t\t\t, type\n\t\t\t\t, updated\n\t\t\t\t)\n\t\tVALUES\n\t\t\t ('#{h['number']}'\n\t\t\t , '#{h['invoice_id']}'\n\t\t\t , '#{h['line_id']}'\n\t\t\t , '#{h['order']}'\n\t\t\t , '#{h['description']}'\n\t\t\t , '#{h['amount']}'\n\t\t\t , '#{h['first_expense_id']}'\n\t\t\t , '#{h['first_time_entry_id']}'\n\t\t\t , '#{h['line_item_date']}'\n\t\t , '#{h['person']}'\n\t\t\t , '#{h['name']}'\n\t\t\t , '#{h['matter']}'\n\t\t\t , '#{h['unit_cost']}'\n\t\t\t , '#{h['quantity']}'\n\t\t\t , '#{h['type']}'\n\t\t\t , '#{h['updated']}'\n\t\t\t )\n\t\tSQL\n\tend",
"def create\n @line_item = LineItem.new(params[:line_item])\n\n respond_to do |format|\n if @line_item.save\n format.html { redirect_to @line_item, notice: 'Line item was successfully created.' }\n format.json { render json: @line_item, status: :created, location: @line_item }\n else\n format.html { render action: \"new\" }\n format.json { render json: @line_item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_line_item\n @line_items = LineItem.find(params[:id])\n end",
"def add_item(line_item_from_cart)\n current_item = cart.line_items.find_by(line_item_id: line_item.id)\n\n if current_item\n current_item = cart.line_items.find_by(line_item_id: line_item.id)\n else\n current_item = cart.line_items.find_by(line_item_id: line_item.id)\n end\n\n current_item\n end",
"def create\n @cart = current_cart\n if params[:bow_id]\n bow = Bow.find(params[:bow_id])\n end\n \n if params[:crossbow_id]\n crossbow = Crossbow.find(params[:crossbow_id])\n end\n \n @line_item = @cart.line_items.build(:bow => bow, :crossbow => crossbow)\n\n\n respond_to do |format|\n if @line_item.save\n format.html { redirect_to @line_item, notice: 'Line item was successfully created.' }\n format.json { render action: 'show', status: :created, location: @line_item }\n else\n format.html { render action: 'new' }\n format.json { render json: @line_item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def add_to_line_item(line_item, variant, quantity, currency=nil, shipment=nil, price=nil)\n if line_item\n line_item.target_shipment = shipment\n line_item.quantity += quantity.to_i\n line_item.currency = currency unless currency.nil?\n line_item.save\n else\n line_item = order.line_items.new(quantity: quantity, variant: variant)\n # line_item = Spree::LineItem.new(quantity: quantity)\n line_item.target_shipment = shipment\n line_item.variant = variant\n if currency\n line_item.currency = currency unless currency.nil?\n line_item.price = price || variant.price_in(currency).amount\n else\n line_item.price = price || variant.price\n end\n # order.line_items << line_item\n # line_item\n end\n \n line_item.save\n order.reload\n line_item\n end",
"def add_item\n\t\tset_sale\n\t\tpopulate_products\n\n\t\tline_item = Item.where(sale_id: params[:sale_id], product_id: params[:product_id]).first\n\t\tline_item.quantity += 1\n\t\tline_item.save\n\n\t\t# Llama método que reduce cantidad de stock\n\t\tremove_item_from_stock(params[:product_id])\n\t\tupdate_line_item_totals(line_item)\n\n\t\tupdate_totals\n\n\t\trespond_to do |format|\n\t\t\tformat.js { ajax_refresh }\n\t\tend\n\tend",
"def set_line_item\n @line_item = LineItem.find(params[:id])\n end",
"def set_line_item\n @line_item = LineItem.find(params[:id])\n end",
"def set_line_item\n @line_item = LineItem.find(params[:id])\n end",
"def set_line_item\n @line_item = LineItem.find(params[:id])\n end",
"def set_line_item\n @line_item = LineItem.find(params[:id])\n end",
"def set_line_item\n @line_item = LineItem.find(params[:id])\n end",
"def set_line_item\n @line_item = LineItem.find(params[:id])\n end",
"def set_line_item\n @line_item = LineItem.find(params[:id])\n end",
"def add_line_item(args=nil)\n line_item = Wheretocard::LineItem.new(args)\n line_items << line_item\n return line_item\n end",
"def set_line_item\n @line_item = LineItem.find_by(params[:id])\n end",
"def add_line_items_link\n self.get_element(@browser, '//a[contains(@href, \"/line_items/create?insertion_orders.id=\")]')\n end",
"def add_reservation(start_date, end_date)\n @bookings << [start_date, end_date]\n end",
"def add_bookings!(bookings, user, date)\n grid.unfilled.each do |empty|\n grid.fill(empty.slot.from, empty.slot.court_id, select_booking(bookings, user, date, empty.slot))\n end\n end",
"def add_product(item_id,user_id,line_item_type)\n\tcurrent_item = line_items.where(:item_id => item_id,:user_id=>user_id,:line_item_type => line_item_type).first\n item = Item.find(item_id)\n if line_item_type.to_i!=0\n -1\n elsif current_item\n if(item.availability<=current_item.quantity && current_item.line_item_type.to_i==0)\n -1\n else\n current_item.quantity += 1\n current_item\n end\n else\n if(item.availability<=0 && line_item_type.to_i==0)\n -1\n else\n current_item = LineItem.new(:item_id=>item_id,:user_id=>user_id,:line_item_type => line_item_type)\n line_items << current_item\n current_item\n end\n end\n end",
"def add(new_line_items)\n new_line_items = Array.wrap(new_line_items).reject{ |li| li.product.supplier_id.nil? || li.product.supplier_id != self.supplier_id }\n new_line_items.each do |new_line_item|\n if line_item = self.drop_ship_line_items.find_by_line_item_id(new_line_item.id)\n else\n self.drop_ship_line_items.create({line_item_id: new_line_item.id}, without_protection: true)\n end\n end\n # TODO: remove any old line items?\n self.save ? self : nil\n end",
"def add_booking_extra(extra_id, quantity)\n\n booking_extras = self.booking_extras.select do |booking_extra|\n booking_extra.extra_id == extra_id\n end\n\n if booking_extras.empty?\n if extra = ::Yito::Model::Booking::BookingExtra.get(extra_id)\n extra_translation = extra.translate(customer_language)\n booking_deposit = SystemConfiguration::Variable.get_value('booking.deposit', 0).to_i\n extra_unit_cost = extra.unit_price(self.date_from, self.days)\n transaction do\n # Create the booking extra line\n booking_extra = BookingDataSystem::BookingExtra.new\n booking_extra.booking = self\n booking_extra.extra_id = extra_id\n booking_extra.extra_description = extra.name\n booking_extra.extra_description_customer_translation = extra_translation.nil? ? extra.name : extra_translation.name\n booking_extra.quantity = quantity\n booking_extra.extra_unit_cost = extra_unit_cost\n booking_extra.extra_cost = extra_unit_cost * quantity\n booking_extra.save\n # Updates the booking\n self.extras_cost += (extra_unit_cost * quantity)\n self.calculate_cost(false, false)\n self.save\n # Create newsfeed\n ::Yito::Model::Newsfeed::Newsfeed.create(category: 'booking',\n action: 'add_booking_extra',\n identifier: self.id.to_s,\n description: BookingDataSystem.r18n.t.booking_news_feed.created_booking_extra(extra_id, quantity),\n attributes_updated: {extra_id: extra_id, quantity: quantity}.merge({booking: newsfeed_summary}).to_json)\n end\n end\n end\n\n end",
"def add_item(product_id)\n item = line_items.where(product_id: product_id).first\n if item.present?\n item.quantity += 1\n item\n else\n line_items.new(product_id: product_id)\n end\n end",
"def set_line_item\n @line_item = order.line_items.find(params[:id])\n end",
"def set_line_item\n @line_item = LineItem.find(params[:id])\n end",
"def set_line_item\n @line_item = LineItem.find(params[:id])\n end",
"def set_line_item\n @line_item = LineItem.find(params[:id])\n end",
"def set_line_item\n @line_item = LineItem.find(params[:id])\n end",
"def set_line_item\n @line_item = LineItem.find(params[:id])\n end",
"def set_line_item\n @line_item = LineItem.find(params[:id])\n end",
"def set_line_item\n @line_item = LineItem.find(params[:id])\n end",
"def set_line_item\n @line_item = LineItem.find(params[:id])\n end",
"def set_line_item\n @line_item = LineItem.find(params[:id])\n end",
"def set_line_item\n @line_item = LineItem.find(params[:id])\n end",
"def set_line_item\n @line_item = LineItem.find(params[:id])\n end",
"def set_line_item\n @line_item = LineItem.find(params[:id])\n end",
"def set_line_item\n @line_item = LineItem.find(params[:id])\n end",
"def set_line_item\n @line_item = LineItem.find(params[:id])\n end",
"def set_line_item\n @line_item = LineItem.find(params[:id])\n end",
"def set_line_item\n @line_item = LineItem.find(params[:id])\n end",
"def set_line_item\n @line_item = LineItem.find(params[:id])\n end",
"def set_line_item\n @line_item = LineItem.find(params[:id])\n end",
"def set_line_item\n @line_item = LineItem.find(params[:id])\n end",
"def set_line_item\n @line_item = LineItem.find(params[:id])\n end",
"def set_line_item\n @line_item = LineItem.find(params[:id])\n end",
"def create\n\n lineItem_details = line_item_params\n item = Item.find_by(:id => lineItem_details['item_id'])\n\n \n if ( !session[:shopping_cart_id] || !ShoppingCart.find(session[:shopping_cart_id]).active )\n @shopping_cart = ShoppingCart.new(:user_id => @current_user.id, :active => true)\n @shopping_cart.save\n session[:shopping_cart_id] = @shopping_cart.id\n end\n\n @shopping_cart = ShoppingCart.find(session[:shopping_cart_id])\n lineItem_details[\"shopping_cart_id\"] = @shopping_cart.id\n lineItem_details[\"quantity_purchased\"] = params[:quantity]\n\n @line_item = LineItem.new lineItem_details\n\n # Update cart\n @cart = ShoppingCart.find(session[:shopping_cart_id])\n\n\n # @li = LineItem.find_by(:shopping_cart_id => session[:shopping_cart_id])\n \n # gon.address = []\n # gon.address << @li.item.user.address\n\n\n respond_to do |format|\n if @line_item.save\n format.html { redirect_to shopping_cart_path(session[:shopping_cart_id]), notice: 'Line item was successfully created.' }\n format.json { render :show, status: :created, location: @line_item }\n else\n format.html { render :new }\n format.json { render json: @line_item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def insert_line\n\t\t@first = params[:placement]['first'].to_f\n\t\t@second = params[:placement]['second'].to_f\n\t\t@new_order_number = @first + ( @second - @first ) / 2\n\t\t@lyric_id = params[:lyric_id]\n\t\t@lyric_line = LyricLine.new lyric_id: @lyric_id, order_number: @new_order_number\n\t\t@new = true\n\tend",
"def line_item_params\n params.require(:line_item).permit(:book_id, :cart_id, :quantity)\n end",
"def create\r\n @lineitem = Lineitem.new(params[:lineitem])\r\n\r\n respond_to do |format|\r\n if @lineitem.save\r\n flash[:notice] = 'Lineitem was successfully created.'\r\n format.html { redirect_to(@lineitem) }\r\n format.xml { render :xml => @lineitem, :status => :created, :location => @lineitem }\r\n else\r\n format.html { render :action => \"new\" }\r\n format.xml { render :xml => @lineitem.errors, :status => :unprocessable_entity }\r\n end\r\n end\r\n end",
"def add_item\n item = params[:item]\n image = Image.find(item[:image_id])\n\n order = current_user.init_cart.order\n line_item = order.line_items.where(\n image_id: image.id,\n product_id: item[:product_id],\n product_option_id: item[:product_option_id]\n ).first\n\n if line_item.present?\n line_item.quantity += item[:quantity].to_i\n else\n line_item = order.line_items.build(item)\n end\n\n line_item.price = Product.find(line_item.product_id).price_for_tier(image.tier_id, image.owner?(current_user))\n line_item.tax = line_item.price * PER_TAX\n\n if line_item.save\n render json: line_item, status: :created\n else\n render json: { msg: line_item.errors.full_messages.to_sentence }, status: :bad_request\n end\n end",
"def link_line_item(line_item)\n self.spree_line_item_id = line_item.id\n self.save!\n end",
"def add_line_item(line_item)\n raise(TypeError) unless line_item.is_a?(LineItem)\n @line_items << line_item if line_item.validate\n end",
"def create\n item = Item.find(params[:item_id])\n @line_item = @cart.line_items.find_by(item: item)\n if @line_item\n @line_item.quantity += 1\n else\n @line_item = @cart.line_items.new(item: item)\n end\n\n respond_to do |format|\n if @line_item.save\n format.html { redirect_to @line_item.cart, notice: 'Line item was successfully created.' }\n format.json { render :show, status: :created, location: @line_item }\n else\n format.html { render :new }\n format.json { render json: @line_item.errors, status: :unprocessable_entity }\n end\n end\nend",
"def add_item(item, price, quantity=1)\n @total += (price * quantity)\n @items.fill(item, @items.size, quantity)\n @last_transaction = {item => (price * quantity)}\n @last_qty = quantity\n end",
"def set_lineitem\n @lineitem = LineItem.find(params[:id])\n end",
"def add_line_item_from_string(input_line)\n parsed_line = /(?<quantity>\\d+) (?<item>.+) at (?<price>\\d*\\.\\d{2})?/.match(input_line)\n new_line_item = LineItem.new(parsed_line['quantity'],parsed_line['item'],parsed_line['price'])\n @line_items << new_line_item\n end",
"def create\n @equipment_move_buffer = current_equipment_buffer\n equipment = Equipment.find(params[:equipment_id])\n @equipment_line_item = @equipment_move_buffer.equipment_line_items.build(equipment_id: equipment.id)\n\n respond_to do |format|\n if @equipment_line_item.save\n format.html { redirect_to @equipment_line_item.equipment_move_buffer, notice: 'Equipment line item was successfully created.' }\n format.json { render action: 'show', status: :created, location: @equipment_line_item }\n else\n format.html { render action: 'new' }\n format.json { render json: @equipment_line_item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_lineitem\n @lineitem = Lineitem.find(params[:id])\n end",
"def destroy_booking_line(item_id)\n\n product_lines = self.booking_lines.select do |booking_line|\n booking_line.item_id == item_id\n end\n\n if booking_line = product_lines.first\n transaction do\n self.item_cost -= booking_line.item_cost\n self.product_deposit_cost -= booking_line.product_deposit_cost\n self.category_supplement_1_cost -= booking_line.category_supplement_1_cost\n self.category_supplement_2_cost -= booking_line.category_supplement_2_cost\n self.category_supplement_3_cost -= booking_line.category_supplement_3_cost \n self.calculate_cost(false, false)\n self.save\n booking_line.destroy\n # Create newsfeed\n ::Yito::Model::Newsfeed::Newsfeed.create(category: 'booking',\n action: 'destroy_booking_line',\n identifier: self.id.to_s,\n description: BookingDataSystem.r18n.t.booking_news_feed.destroyed_booking_line(item_id),\n attributes_updated: {item_id: item_id}.merge({booking: newsfeed_summary}).to_json)\n end\n self.reload\n end\n\n end",
"def line_items\n move_down 20\n data = line_item_data\n options = { width: bounds.width }\n header_styles = {\n border_width: 2,\n border_color: \"333333\"\n }\n table data, options do |table|\n table.rows(0).style(table_style.merge(header_styles))\n table.rows(1).style(table_style.merge(padding_top: 30))\n table.rows(2..data.length-1).style(table_style)\n end\n move_down 10\n stroke_color \"999999\"\n stroke_horizontal_rule\n end",
"def add_item(item, price, quantity = 1)\n @total += price * quantity\n @transactions << price * quantity\n i = quantity\n until i == 0 do\n @items << item\n i -= 1\n end\n end",
"def create\n @cart = current_cart\n item = Item.find(params[:item_id])\n quantity = params[:quantity] || 1\n @line_item = @cart.add_item(item.id,quantity.to_i)\n\n\n respond_to do |format|\n if @line_item.save\n # to come back not to the beginning of the page, but to the place where\n # the click was done\n env[\"HTTP_REFERER\"] += '#' + item.id.to_s\n format.html { redirect_to :back, notice: \"L'oggetto è stato aggiunto con successo\" }\n format.json { render json: @line_item, status: :created, location: @line_item }\n else\n format.html { render action: \"new\" }\n format.json { render json: @line_item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_line_item\n\t\t\t@line_item = LineItem.find(params[:id])\n\t\tend",
"def set_line_item\n @line_item = LineItem.find(params[:id])\nend",
"def line_item_params\n params.require(:line_item).permit(:bow_id, :crossbow_id, :cart_id)\n end",
"def add_reservation(room_selection, check_in, check_out)\n # self.add_block()\n # self.add_reservation_to_block()\n @reservations << Hotel::Reservation.new(room_selection, check_in, check_out)\n end",
"def add_item(item, quantity = 1)\n order_item = self.order_items.find_by item: item, price: item.price\n if order_item.is_a? OrderItem\n order_item.add quantity\n else\n self.order_items.create item: item, price: item.price, quantity: quantity\n end\n recalculate!\n end",
"def add_to_receipt(item)\n balance = item.is_a?(Array) ? item[2] ? item[2].to_i <=> 0 : 0 : 0\n if @marw_queue.empty? || @marw_queue.all? { |receipt| \n receipt.closed || balance != receipt.balance }\n label = (balance == 0 ? marw_label_default : (balance > 0 ? \n MARW_CONFIGURATION[:vocab_gain_label] : MARW_CONFIGURATION[:vocab_lose_label]))\n show_receipt_window(label, [], balance)\n end\n @marw_queue.reverse.each { |receipt| \n if !receipt.closed && receipt.balance == balance\n receipt.item_array.push(item) \n break\n end\n }\n end",
"def addItem\n begin\n ProgrammeItem.transaction do\n @assignment = nil\n if !params[:cancel]\n item = ProgrammeItem.find(params[:itemid])\n room = Room.find(params[:roomid])\n day = params[:day]\n time = params[:time].to_time # The start time\n\n @assignment = addItemToRoomAndTime(item, room, day, time)\n end\n\n render :layout => 'content'\n end\n rescue => ex\n render status: :bad_request, text: ex.message\n end\n end",
"def create\n @line_item = LineItem.new(params[:line_item])\n @line_item.price = @line_item.catalog_item.unit_price\n \n respond_to do |format|\n if @line_item.save\n \n flash[:notice] = 'LineItem was successfully created.'\n format.html { redirect_to(@line_item) }\n format.xml { render :xml => @line_item, :status => :created, :location => @line_item }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @line_item.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def add_line_item(name=nil)\n \n getElement_xpath(\"add_line_item\").click\n\n sleep(5)\n\n getElement_xpath(\"product_name_search\").click\n\n product_name = Keys_CONFIG[\"product_name\"]\n if(name!=nil)\n product_name = Keys_CONFIG[\"product_name\"]+name\n end\n\n getElement_placeholder(\"Search for product...\").send_keys product_name\n\n sleep(2)\n\n getElement_xpath(\"item_first\").click\n\n sleep(3)\n\n getElement_xpath(\"popup_save\").click\n\n sleep(5)\n end",
"def add_item(title, price, quantity=1) \n self.total += price * quantity\n quantity.times do\n items << title \n end\n self.last_transaction = price * quantity\n\n end",
"def create\n @invoice_line_item = InvoiceLineItem.new(params.require(:invoice_line_item).permit(:amount, :description, :invoice_id, :line_item_purpose_id, :service_visit_id, :vehicle_id))\n\n respond_to do |format|\n if @invoice_line_item.save\n format.html { redirect_to invoice_line_items_url,\n notice: 'InvoiceLineItem was successfully created.' }\n format.json { render json: @invoice_line_item, status: :created, location: @invoice_line_item }\n else\n prepFormVariables\n format.html { render action: \"new\" }\n format.json { render json: @invoice_line_item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def line_item_params\n params.permit(line_item: [:item_id, :quantity])\n end",
"def add_line_item_to_order( variant )\n duplicate_line_item = line_item_exists?( variant )\n duplicate_line_item.quantity += 1 and return duplicate_line_item if duplicate_line_item\n\n line_items.build :name => variant.good.name, \n :price => variant.price, \n :options => variant.option_values_to_s,\n :sku => variant.sku\n end"
] |
[
"0.70234257",
"0.6709108",
"0.6615346",
"0.6529793",
"0.652385",
"0.6486162",
"0.6461691",
"0.64134544",
"0.6339395",
"0.63042945",
"0.6229814",
"0.62192285",
"0.61691827",
"0.61633277",
"0.6157244",
"0.61517674",
"0.6099156",
"0.60345",
"0.59978914",
"0.5993501",
"0.59846437",
"0.5945777",
"0.5942709",
"0.59314877",
"0.59298533",
"0.5924821",
"0.5879378",
"0.5862965",
"0.58540964",
"0.5823691",
"0.5808077",
"0.58066446",
"0.58066446",
"0.58066446",
"0.58066446",
"0.58066446",
"0.58066446",
"0.58066446",
"0.58066446",
"0.5801733",
"0.58016133",
"0.57897377",
"0.5788063",
"0.5780955",
"0.5778685",
"0.577746",
"0.57749313",
"0.5755788",
"0.57517654",
"0.57497096",
"0.57497096",
"0.57497096",
"0.57497096",
"0.57497096",
"0.57497096",
"0.57497096",
"0.57497096",
"0.57497096",
"0.57497096",
"0.57497096",
"0.57497096",
"0.57497096",
"0.57497096",
"0.57497096",
"0.57497096",
"0.57497096",
"0.57497096",
"0.57497096",
"0.57497096",
"0.57497096",
"0.574474",
"0.57155305",
"0.5714058",
"0.5710937",
"0.57040495",
"0.5693477",
"0.5689095",
"0.5685374",
"0.56835204",
"0.56663585",
"0.56617665",
"0.56567556",
"0.5635537",
"0.5617828",
"0.5614342",
"0.5598347",
"0.5593322",
"0.55860037",
"0.5583052",
"0.5575229",
"0.55719304",
"0.55683416",
"0.5550479",
"0.5547533",
"0.5542435",
"0.5535296",
"0.5534997",
"0.55234486",
"0.55057335",
"0.5497582"
] |
0.69256365
|
1
|
Destroy a booking line == Parameters:: item_id:: The item line id
|
def destroy_booking_line(item_id)
product_lines = self.booking_lines.select do |booking_line|
booking_line.item_id == item_id
end
if booking_line = product_lines.first
transaction do
self.item_cost -= booking_line.item_cost
self.product_deposit_cost -= booking_line.product_deposit_cost
self.category_supplement_1_cost -= booking_line.category_supplement_1_cost
self.category_supplement_2_cost -= booking_line.category_supplement_2_cost
self.category_supplement_3_cost -= booking_line.category_supplement_3_cost
self.calculate_cost(false, false)
self.save
booking_line.destroy
# Create newsfeed
::Yito::Model::Newsfeed::Newsfeed.create(category: 'booking',
action: 'destroy_booking_line',
identifier: self.id.to_s,
description: BookingDataSystem.r18n.t.booking_news_feed.destroyed_booking_line(item_id),
attributes_updated: {item_id: item_id}.merge({booking: newsfeed_summary}).to_json)
end
self.reload
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def destroy\n @line_item.destroy\n destroy_line_item_response\n end",
"def destroy\n @line_item = line_items.find(params[:id])\n @line_item.destroy\n\n respond_to do |format|\n format.html { redirect_to line_items_url }\n end\n end",
"def destroy\n @item_line = ItemLine.find(params[:id])\n @item_line.destroy\n\n respond_to do |format|\n format.html { redirect_to item_lines_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @line_item.destroy\n respond_to do |format|\n format.html { redirect_to line_items_url, notice: 'Line item was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n\t\t@line_item.destroy\n\n\t\trespond_to do |format|\n\t\t\tformat.html { redirect_to line_items_url, notice: \"Req ID: #{@line_item.id} removed.\" }\n\t\t\tformat.json { head :no_content }\n\t\tend\n\tend",
"def destroy\n @line_item = LineItem.find(params[:id])\n @line_item.destroy\n\n respond_to do |format|\n format.html { redirect_to line_items_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @lineitem = Lineitem.find(params[:id])\n @lineitem.destroy\n\n respond_to do |format|\n format.html { redirect_to lineitems_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @line_item = LineItem.find(params[:id])\n @line_item.destroy\n\n respond_to do |format|\n format.html { redirect_to line_items_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @line_item = LineItem.find(params[:id])\n @line_item.destroy\n\n respond_to do |format|\n format.html { redirect_to line_items_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @line_item = LineItem.find(params[:id])\n @line_item.destroy\n\n respond_to do |format|\n format.html { redirect_to line_items_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @line_item = LineItem.find(params[:id])\n @line_item.destroy\n\n respond_to do |format|\n format.html { redirect_to line_items_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @line_item = current_member.seller.line_items.find(params[:id])\n @line_item.destroy\n \n respond_to do |format|\n format.html { redirect_to line_items_url }\n format.xml { render :nothing => true }\n end\n end",
"def destroy\r\n @lineitem = Lineitem.find(params[:id])\r\n @lineitem.destroy\r\n\r\n respond_to do |format|\r\n format.html { redirect_to(lineitems_url) }\r\n format.xml { head :ok }\r\n end\r\n end",
"def destroy\n @invoice_line_item = InvoiceLineItem.find(params[:id])\n @invoice_line_item.destroy\n\n respond_to do |format|\n format.html { redirect_to invoice_line_items_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @line_item.destroy\n respond_to do |format|\n format.html { redirect_to line_items_url, notice: 'Line item was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @line_item.destroy\n respond_to do |format|\n format.html { redirect_to line_items_url, notice: 'Line item was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @line_item.destroy\n respond_to do |format|\n format.html { redirect_to line_items_url, notice: 'Line item was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @line_item.destroy\n respond_to do |format|\n format.html { redirect_to line_items_url, notice: 'Line item was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @line_item.destroy\n respond_to do |format|\n format.html { redirect_to line_items_url, notice: 'Line item was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @line_item.destroy\n respond_to do |format|\n format.html { redirect_to line_items_url, notice: 'Line item was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @line_item.destroy\n respond_to do |format|\n format.html { redirect_to line_items_url, notice: \"Line item was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @invoice_line_item.destroy\n respond_to do |format|\n format.html { redirect_to invoice_line_items_url, notice: 'Invoice line item was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @purchase_order_item_line = PurchaseOrderItemLine.find(params[:id])\n @purchase_order_item_line.destroy\n\n respond_to do |format|\n format.html { redirect_to purchase_order_item_lines_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @line_item = @order.line_items.find(params[:id])\n @line_item.destroy\n\n head :no_content\n end",
"def destroy\n @line_item.destroy\n respond_to do |format|\n format.html { redirect_to line_items_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @line_item.destroy\n respond_to do |format|\n format.html { redirect_to line_items_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @line_item.destroy\n respond_to do |format|\n format.html { redirect_to line_items_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @lineitem.destroy\n respond_to do |format|\n format.html { redirect_to lineitems_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n line_item = LineItem.find params[:id]\n line_item.destroy\n\n redirect_to cart_path\n end",
"def destroyed(item)\n bowline.destroyed(\n name, \n item.id\n ).call\n end",
"def destroy\n @line_items.destroy\n respond_to do |format|\n format.html { redirect_to line_items_url, notice: 'Line item was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @line_item = @current_cart.line_items.where(:id => params[:id]).first\n unless @line_item.nil?\n @line_item.destroy\n end\n end",
"def destroy\n @batting_line = BattingLine.find(params[:id])\n @batting_line.destroy\n\n respond_to do |format|\n format.html { redirect_to batting_lines_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @equipment_line_item.destroy\n respond_to do |format|\n format.html { redirect_to equipment_line_items_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @billable_item = BillableItem.find(params[:id])\n\n respond_to do |format|\n if @billable_item.destroy\n format.html { redirect_to billable_items_url,\n notice: (crud_notice('destroyed', @billable_item) + \"#{undo_link(@billable_item)}\").html_safe }\n format.json { head :no_content }\n else\n format.html { redirect_to billable_items_url, alert: \"#{@billable_item.errors[:base].to_s}\".gsub('[\"', '').gsub('\"]', '') }\n format.json { render json: @billable_item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def destroy\n @line_item.destroy\n respond_to do |format|\n format.html { redirect_to line_items_url, notice: \"カートから商品が削除されました\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @estimate_line_item = EstimateLineItem.find(params[:id])\n @estimate_line_item.destroy\n\n respond_to do |format|\n format.html { redirect_to(estimate_line_items_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @liner_item.destroy\n respond_to do |format|\n format.html { redirect_to liner_items_url, notice: 'Liner item was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @line_item1 = LineItem1.find(params[:id])\n @line_item1.destroy\n\n respond_to do |format|\n format.html { redirect_to line_item1s_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @invoice_addon_line_item.destroy\n respond_to do |format|\n format.html { redirect_to invoice_addon_line_items_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @line_item.destroy\n respond_to do |format|\n format.html { redirect_to @line_item.cart, notice: t('line_items.destroy.lineDelete') }\n format.json { head :no_content }\n end\n end",
"def destroy\n if params[:line_item_id]\n @cart.line_items.find(params[:line_item_id]).destroy\n else\n @cart.destroy\n end\n end",
"def destroy\n @invoice_adjustment_line = InvoiceAdjustmentLine.find(params[:id])\n @invoice_adjustment_line.destroy\n\n respond_to do |format|\n format.html { redirect_to(invoice_adjustment_lines_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @line_item = LineItem.find(params[:id])\n @line_item.destroy\n\n respond_to do |format|\n format.html { redirect_to line_items_url }\n format.js\n format.json { head :no_content }\n end\n end",
"def destroy\n @service_booking.update_attribute(:status, 'Cancelled')\n #booking_slot_control = BookingSlotControl.where('category = ? AND dealer_location = ? AND booking_date = ?', \"Book Service\", @service_booking.service_station, @service_booking.service_date).first\n #booking_slot_control.update(available_slots: booking_slot_control.available_slots + 1) if booking_slot_control\n head :no_content\n @service_booking.sevice_booking_notification(I18n.t('Notification.service_booking_destroyed'), I18n.t('Email.service_booking_delete_dealer'), I18n.t('Email.service_booking_delete_user'), params)\n end",
"def destroy\n @rentable_item.destroy\n end",
"def destroy\n @lineitem = Lineitem.find(params[:id])\n @lineitem.destroy\n respond_to do |format|\n format.html { redirect_to 'http://localhost:3000/carts/show' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @line_item = LineItem.find(params[:id])\n @line_item.destroy\n respond_to do |format|\n format.html { redirect_to cart_path }\n format.json { head :no_content }\n end\n end",
"def destroy\n @popularty_line_item = PopulartyLineItem.find(params[:id])\n @popularty_line_item.destroy\n\n respond_to do |format|\n format.html { redirect_to popularty_line_items_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @match_form_lineitem.destroy\n respond_to do |format|\n format.html { redirect_to match_form_lineitems_url, notice: 'Match form lineitem was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @line_item.destroy\n respond_to do |format|\n format.html { redirect_to line_items_url, notice: 'Line item was successfully destroyed.' }\n format.json { head :no_content }\n end\nend",
"def destroy\n @line_item.destroy\n respond_to do |format|\n format.html { redirect_to cart_path(@current_cart), notice: 'Line item was successfully removed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @sub1_line_item.destroy\n respond_to do |format|\n format.html { redirect_to sub1_line_items_url, notice: 'Sub1 line item was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @line_item = LineItem.find(params[:id])\n @order = @line_item.order\n @line_item.destroy\n \n @order.total = @order.line_items.sum(:line_total)\n @order.update_attribute(:total, @order.total)\n\n respond_to do |format|\n format.html { redirect_to request.env[\"HTTP_REFERER\"] }\n format.xml { head :ok }\n end\n end",
"def destroy\n @line_item.destroy\n respond_to do |format|\n format.html { redirect_to line_items_url, notice: \"Line item was successfully destroyed.\" }\n format.json { head :no_content }\n end\nend",
"def remove_line_item(line_item)\n unless self.ordered?\n line_item.destroy\n end\n end",
"def delete_line_item(table)\r\n if table_exists?(table)\r\n print_table(table)\r\n puts \"please choose the id number of the line you'd like to delete.\"\r\n id = get_valid_id(table)\r\n delete = (\"DELETE FROM #{table} WHERE id = #{id}\")\r\n @db.execute(delete)\r\n end\r\n end",
"def destroy\n @line_property_item.destroy\n respond_to do |format|\n format.html { redirect_to line_property_items_url, notice: 'Line property item was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @line_item = LineItem.find(params[:id])\n product = Product.find_by_id(@line_item.product.id)\n product.update_attributes(:remaining_quantity => (product.remaining_quantity + @line_item.quantity))\n @line_item.destroy\n\n respond_to do |format|\n format.html { redirect_to(orders_path) }\n format.json { head :ok }\n end\n end",
"def destroy\n @effort_log_line_item = EffortLogLineItem.find(params[:id])\n @effort_log_line_item.destroy\n\n respond_to do |format|\n format.html { redirect_to(effort_log_line_items_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @pump_line = PumpLine.find(params[:id])\n @pump_line.destroy\n\n respond_to do |format|\n format.html { redirect_to(pump_lines_url) }\n format.xml { head :ok }\n end\n end",
"def remove_lineitem\n line_item = @sale.line_items.find_by_id(params[:line_item])\n respond_to do |format|\n if line_item.present?\n line_item.item.stock_amount = line_item.item.stock_amount + line_item.quantity\n line_item.item.save\n line_item.destroy\n end\n update_totals\n\n format.js { ajax_refresh }\n end\n end",
"def destroy\n @budget_line.destroy\n respond_to do |format|\n format.html { redirect_to budget_lines_url, notice: 'Budget line was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @line_of_business = LineOfBusiness.find(params[:id])\n @line_of_business.destroy\n\n respond_to do |format|\n format.html { redirect_to(line_of_businesses_url) }\n format.xml { head :ok }\n end\n rescue ActiveRecord::RecordNotFound => e\n prevent_access(e)\n end",
"def destroy\n @route_line = RouteLine.find(params[:id])\n @route_line.destroy\n\n respond_to do |format|\n format.html { redirect_to(route_lines_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @line = Line.find(params[:id])\n @line.destroy\n\n respond_to do |format|\n format.html { redirect_to budget_path(@line.budget) }\n format.json { head :no_content }\n end\n end",
"def destroy\n @order.line_items.clear\n respond_to do |format| \n format.html { redirect_to(edit_object_url) } \n end\n end",
"def destroy\n @cruise_line.destroy\n respond_to do |format|\n format.html { redirect_to cruise_lines_url, notice: 'Cruise line was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user_address_book_item = UserAddressBookItem.find(params[:id])\n @user_address_book_item.destroy\n end",
"def destroy\n @booking.destroy\n end",
"def destroy\n @ball_flight_item = BallFlightItem.find(params[:id])\n @ball_flight_item.destroy\n\n respond_to do |format|\n format.html { redirect_to ball_flight_items_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n\n @death_record_item= DeathRecordItem.find(params[:id])\n @death_record_item.destroy\n redirect_to death_record_book_path(@death_record_book)\n end",
"def destroy\n @test_ride.update_attribute(:status, 'Cancelled')\n # booking_slot_control = BookingSlotControl.where('category = ? AND dealer_location = ? AND booking_date = ?', \"Book Test Ride\", @test_ride.location, @test_ride.ride_date).first\n #booking_slot_control.update(available_slots: booking_slot_control.available_slots + 1) if booking_slot_control\n head :no_content\n @test_ride.delay.test_ride_booking_notification(I18n.t('Notification.test_ride_destroyed'), I18n.t('Email.test_ride_booking_delete_dealer'), I18n.t('Email.test_ride_booking_delete_user'), params)\n end",
"def destroy\n # @line_item = LineItem.find(params[:id])\n # @line_item.destroy\n @cart = current_cart\n# item = Item.find(params[:item_id])\n quantity = params[:quantity] || 1\n item_id=params[:item_id]\n @line_item = @cart.delete_item(item_id,quantity.to_i)\n\n respond_to do |format|\n format.html { redirect_to :back, notice: \"L'oggetto è stato rimosso dal carrello!\" }\n format.json { head :ok }\n end\n end",
"def destroy\n @line = Line.find_by_no(params[:id])\n @line.destroy\n\n respond_to do |format|\n format.html { redirect_to lines_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @service_line = ServiceLine.find(params[:id])\n @service_line.destroy\n\n respond_to do |format|\n format.html { redirect_to(service_lines_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @line.destroy\n respond_to do |format|\n format.html { redirect_to attachment_line_list_path(@line.attachment), notice: 'Line was successfully destroyed.' }\n end\n end",
"def destroy\n @dialogue_line = DialogueLine.find(params[:id])\n @dialogue_line.destroy\n\n respond_to do |format|\n format.html { redirect_to(section_room_dialogue_lines_path) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @line = Line.find(params[:id])\n @line.destroy\n\n respond_to do |format|\n format.html { redirect_to new_line_path }\n format.json { head :no_content }\n end\n end",
"def decrement_line_item_quantity(line_item_id)\n current_item = line_items.find(line_item_id)\n if current_item.quantity > 1\n current_item.quantity -= 1\n else\n current_item.destroy\n end\n current_item\n end",
"def destroy\n @businessline.destroy\n respond_to do |format|\n format.html { redirect_to businesslines_url, notice: 'Businessline was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @line_item.destroy\n respond_to do |format|\n format.js {}\n format.json { head :no_content }\n end\n end",
"def destroy\n if @item.destroy\n respond_to do |format|\n format.html { redirect_to items_url, notice: 'Item was successfully destroyed.' }\n format.json { head :no_content }\n end\n else\n respond_to do |format|\n format.html { redirect_to items_url, notice: 'Item can not be destroyed! Already has bids.' }\n format.json { head :no_content }\n end\n end\n end",
"def destroy\n @lineaedesal = Lineaedesal.find(params[:id])\n @lineaedesal.destroy\n\n respond_to do |format|\n format.html { redirect_to(lineaedesals_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @monthly_revenue_breakdown_item = MonthlyRevenueBreakdownItem.find(params[:id])\n @monthly_revenue_breakdown_item.destroy\n\n respond_to do |format|\n format.html { redirect_to monthly_revenue_breakdown_items_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @line_liver.destroy\n respond_to do |format|\n format.html { redirect_to line_livers_url, notice: 'Line liver was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @line_item.destroy\n respond_to do |format|\n format.html { redirect_to location_cart_path(@location = params[:location_id], @cart = session[:cart_id]), notice: 'Medicina elimnada de tu carrito' }\n format.json { head :no_content }\n end\n end",
"def brief_vendor_del_item\n brief = Brief.find(params[:brief_id])\n brief_vendor = brief.brief_vendors.find_by_org_id(params[:vendor_id])\n item = brief_vendor.items.find_by_parent_id(params[:item_id])\n\n item.destroy\n\n redirect_to(cheil_brief_vendor_items_url(params[:brief_id],params[:vendor_id])) \n end",
"def destroy\n @billitem = Billitem.find(params[:id])\n @billitem.destroy\n\n respond_to do |format|\n format.html { redirect_to(billitems_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @manufacturer_line = ManufacturerLine.find(params[:id])\n @manufacturer_line.destroy\n\n respond_to do |format|\n format.html { redirect_to(manufacturer_lines_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @cart = Cart.find(session[:cart_id])\n @line_item.destroy\n respond_to do |format|\n format.html { redirect_to cart_path(@cart), notice: 'Line item was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @address_book_item = AddressBookItem.find(params[:id])\n @address_book_item.destroy\n\n respond_to do |format|\n format.html { redirect_to(address_book_items_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @purchase_return_line_item = PurchaseReturnLineItem.find(params[:id])\n @purchase_return_line_item.destroy\n\n respond_to do |format|\n format.html { redirect_to purchase_return_line_items_url }\n format.json { head :ok }\n end\n end",
"def delete_program_by_id(item_id)\n item = get_program_by_id(item_id)\n item.destroy\n end",
"def destroy\n @line_item_product.destroy\n respond_to do |format|\n format.html { redirect_to line_item_products_url, notice: 'Line item product was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @shipping_line = ShippingLine.find(params[:id])\n @shipping_line.destroy\n\n respond_to do |format|\n format.html { redirect_to shipping_lines_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n record = InvoiceLineItem.find(params[:id])\n record.destroy\n\n respond_to do |format| \n format.json { head :no_content }\n end\n end",
"def destroy\n @item = @client.items.find(params[:id])\n @item.destroy\n respond_to do |format|\n format.html { redirect_to items_url, notice: 'Item was successfully removed from Inventory.' }\n format.json { head :no_content }\n end\n end",
"def remove_item\n\t\tset_sale\n\t\tpopulate_products\n\n\t\tline_item = Item.where(sale_id: params[:sale_id], product_id: params[:product_id]).first\n\t\tline_item.quantity -= 1\n\n\t\tif line_item.quantity == 0\n\t\t\tline_item.destroy\n\t\telse\n\t\t\tline_item.save\n\t\t\tupdate_line_item_totals(line_item)\n\t\tend\n\n\t\t# Llama método que devuelve cantidad al stock\n\t\treturn_item_to_stock(params[:product_id])\n\n\t\tupdate_totals\n\n\t\trespond_to do |format|\n\t\t\tformat.js { ajax_refresh }\n\t\tend\n\tend",
"def destroy\n @readied_item_slot.destroy\n respond_to do |format|\n format.html { redirect_to readied_item_slots_url, notice: 'Readied item slot was successfully destroyed.' }\n format.json { head :no_content }\n end\n end"
] |
[
"0.75655544",
"0.7203878",
"0.72035444",
"0.71088207",
"0.70940477",
"0.7078435",
"0.7065822",
"0.7036312",
"0.7036312",
"0.7036312",
"0.7036312",
"0.6995786",
"0.69885296",
"0.69773275",
"0.68693906",
"0.68693906",
"0.68693906",
"0.68693906",
"0.68693906",
"0.68693906",
"0.6842403",
"0.68294567",
"0.67873013",
"0.67745894",
"0.67662406",
"0.67662406",
"0.6765874",
"0.6751248",
"0.6728104",
"0.6675278",
"0.6639775",
"0.66190493",
"0.6614185",
"0.65812093",
"0.657538",
"0.65668523",
"0.65433496",
"0.6540585",
"0.6502915",
"0.6461589",
"0.644078",
"0.6440009",
"0.6427119",
"0.6416007",
"0.634505",
"0.63406026",
"0.63277286",
"0.63243115",
"0.6313083",
"0.630673",
"0.6277726",
"0.62776846",
"0.6257731",
"0.62544936",
"0.6242565",
"0.6241518",
"0.6233168",
"0.61510885",
"0.6138009",
"0.61377597",
"0.61292315",
"0.61283994",
"0.6127421",
"0.61235964",
"0.6123135",
"0.61103034",
"0.6101703",
"0.609387",
"0.6091599",
"0.60881585",
"0.60832584",
"0.6081121",
"0.6056885",
"0.6046934",
"0.6043548",
"0.60420716",
"0.6033352",
"0.6033219",
"0.60172796",
"0.60165274",
"0.60108423",
"0.6009714",
"0.60067135",
"0.6005583",
"0.5997117",
"0.59960437",
"0.5988574",
"0.59863",
"0.5982415",
"0.5981708",
"0.5975667",
"0.5967302",
"0.5962481",
"0.59461826",
"0.59284186",
"0.59272873",
"0.5917837",
"0.5912601",
"0.591226",
"0.5906635"
] |
0.7337309
|
1
|
EXTRAS Add a booking extra to the reservation
|
def add_booking_extra(extra_id, quantity)
booking_extras = self.booking_extras.select do |booking_extra|
booking_extra.extra_id == extra_id
end
if booking_extras.empty?
if extra = ::Yito::Model::Booking::BookingExtra.get(extra_id)
extra_translation = extra.translate(customer_language)
booking_deposit = SystemConfiguration::Variable.get_value('booking.deposit', 0).to_i
extra_unit_cost = extra.unit_price(self.date_from, self.days)
transaction do
# Create the booking extra line
booking_extra = BookingDataSystem::BookingExtra.new
booking_extra.booking = self
booking_extra.extra_id = extra_id
booking_extra.extra_description = extra.name
booking_extra.extra_description_customer_translation = extra_translation.nil? ? extra.name : extra_translation.name
booking_extra.quantity = quantity
booking_extra.extra_unit_cost = extra_unit_cost
booking_extra.extra_cost = extra_unit_cost * quantity
booking_extra.save
# Updates the booking
self.extras_cost += (extra_unit_cost * quantity)
self.calculate_cost(false, false)
self.save
# Create newsfeed
::Yito::Model::Newsfeed::Newsfeed.create(category: 'booking',
action: 'add_booking_extra',
identifier: self.id.to_s,
description: BookingDataSystem.r18n.t.booking_news_feed.created_booking_extra(extra_id, quantity),
attributes_updated: {extra_id: extra_id, quantity: quantity}.merge({booking: newsfeed_summary}).to_json)
end
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def add_extra(extra)\n @extras.merge!(extra)\n end",
"def add_extra(key, value)\n @extras[key] = value\n end",
"def add_reservation(start_date, end_date)\n @bookings << [start_date, end_date]\n end",
"def extra; @extra; end",
"def set_reservation\n @extra_reservation = ExtraReservation.find(params[:id])\n end",
"def reserve(*args)\n @reservations << Reservation.new(self, *args)\n end",
"def add_reservation_to_list(reservation)\n raise ArgumentError.new('Not a valid reservation.') if reservation.class != Hotel::Reservation\n @reservations << reservation\n end",
"def inject_reservation_book(reservation_book)\n @reservation_book = reservation_book\n end",
"def iamswer_extra_fields *extra_fields\n @iamswer_defined_extra_fields ||= []\n\n extra_fields.each do |extra_field|\n @iamswer_defined_extra_fields << extra_field.to_sym\n define_extra_field extra_field\n end\n end",
"def add_cont name,telephone,\n\t\t\t\t\t\t@agenda << {name: name, telephone: telephone}\n\t\t\t\t\tend",
"def addBook(book)\n\t\tinventories.create(book_id: book.id)\n\tend",
"def parse_extra_args(extra = {})\n raise NotImplementedError,\n \"This Rhizome Equipment Type (#{type}) does not have extra arguments\"\n end",
"def extra; end",
"def add_reservation(room_selection, check_in, check_out)\n # self.add_block()\n # self.add_reservation_to_block()\n @reservations << Hotel::Reservation.new(room_selection, check_in, check_out)\n end",
"def add(drink_name, drink_prices)\n # Feature to be added\n end",
"def add_book(book_title)\n @books << {\n title: book_title,\n rental_details: {\n student_name: \"\",\n date: \"\"\n }\n }\n end",
"def manual_add_entry\n address_book.add_entry(enter_name, enter_phone, enter_email)\n end",
"def extras\n @extras\n end",
"def set_extra\n @extra = Partextra.find(params[:id])\n end",
"def add_booking(gymclass)\n numofbookings = gymclass.count_num_of_bookings()\n if gymclass.check_space(numofbookings) == true\n save()\n else\n return \"We can't book it!\"\n end\n end",
"def extra_params\n\t\tparams.require(:extra).permit(:extraimg, :name, :description, :quantity, :price, :extracat_id)\n\tend",
"def set_extra\n\t\t@extra = Extra.find(params[:id])\n\tend",
"def add_book(book)\n @books << book\n puts \"Added \" + book.title + \" to the library.\"\n end",
"def set_extra\n @extra = Extra.find(params[:id])\n end",
"def add_ants(*args)\n end",
"def addVehicle _obj, _args\n \"_obj addVehicle _args;\" \n end",
"def reserved\n @book = Book.find(params[:book_id])\n @reservation = Reservation.new(\n user_id: current_user.id,\n book_id: @book.id,\n price: @book.price\n )\n @reservation.save!\n end",
"def additional_details\n\n end",
"def add_anniversary_item(item)\n @anniversary_list.push(item)\n end",
"def addIngredient(description, amount, unit=\"oz\")\n\n\t\t@ingredient << Ingredient.new(description, amount, unit)\n\tend",
"def add_ingredient(ingredient)\n\t\t@ingredients.push(ingredient)\n\tend",
"def add_ingredient(ingredient)\n @ingredients.push(ingredient)\n end",
"def addItemCargo _obj, _args\n \"_obj addItemCargo _args;\" \n end",
"def add(beer)\n \t$catalogue << beer\n end",
"def add_ingredients(ingre)\n ingre.each {|ingre| RecipeIngredient.new(self, ingre)}\n end",
"def add_book(book)\n @books << book\n end",
"def add_book(book)\n\t\t@books << book\n\t\t@book_status[book.title] = book.get_status\n\tend",
"def add_book(quantity)\n \n #increase the quantity and available for loaning\n self.quantity += quantity\n self.available += quantity\n\n #save the model\n self.save\n end",
"def add_a_e\n end",
"def adding\n shipping_manifest = {\"whale bone corsets\" => 5, \"porcelain vases\" => 2, \"oil paintings\" => 3}\n shipping_manifest[\"muskets\"] = 2\n shipping_manifest[\"gun powder\"] = 4\n\n shipping_manifest\nend",
"def set_Extras(value)\n set_input(\"Extras\", value)\n end",
"def set_Extras(value)\n set_input(\"Extras\", value)\n end",
"def set_Extras(value)\n set_input(\"Extras\", value)\n end",
"def set_Extras(value)\n set_input(\"Extras\", value)\n end",
"def set_Extras(value)\n set_input(\"Extras\", value)\n end",
"def set_Extras(value)\n set_input(\"Extras\", value)\n end",
"def set_Extras(value)\n set_input(\"Extras\", value)\n end",
"def set_Extras(value)\n set_input(\"Extras\", value)\n end",
"def set_Extras(value)\n set_input(\"Extras\", value)\n end",
"def set_Extras(value)\n set_input(\"Extras\", value)\n end",
"def set_Extras(value)\n set_input(\"Extras\", value)\n end",
"def set_Extras(value)\n set_input(\"Extras\", value)\n end",
"def set_Extras(value)\n set_input(\"Extras\", value)\n end",
"def set_Extras(value)\n set_input(\"Extras\", value)\n end",
"def set_Extras(value)\n set_input(\"Extras\", value)\n end",
"def set_Extras(value)\n set_input(\"Extras\", value)\n end",
"def set_Extras(value)\n set_input(\"Extras\", value)\n end",
"def set_Extras(value)\n set_input(\"Extras\", value)\n end",
"def add_extra_values!(obj:, sc:)\n attrs = fetch_attributes(obj: obj)\n attrs[:scanner] = sc if scanner.blank?\n update(attrs) unless attrs.empty?\n end",
"def add_ingredient_to_recipe quantity, measure, food_item_name, recipe \n food_item = FoodItem.new(:name => food_item_name, :price => nil)\n ingredient = Ingredient.new(:food_item => food_item, :quantity => quantity, :measure => measure, :recipe_id => recipe.id)\n recipe.ingredients << ingredient\n end",
"def extra\n @worked_hours = @worked_hours.extra\n\n respond_with(@worked_hours)\n end",
"def reservation_params\n params.key?(:reservation) ? \n params.require(:reservation).permit(:special_accommodations) : {}\n end",
"def add_my_books(book)\n\t\t@my_books << book.title\n\tend",
"def reservation_params\n params.require(:reservation).permit(:reserved_on, :book_id, :user_id)\n end",
"def add_ingredients(ing_array)\n ing_array.each {|ingredient| RecipeIngredient.new(self, ingredient)}\n end",
"def addRating _obj, _args\n \"_obj addRating _args;\" \n end",
"def booking_params\n params.require(:booking).permit(:book_name, :book_date, :tour_name, :book_price, :book_ticket_num,:book_amount,:package_id,:user_id,:status,:tax,:total_amount,:other)\n end",
"def reservation_params\n params.require(:reservation).permit(:lib_book_id, :user_id, :status, :checkoutstamp, :returnstamp, :requeststamp)\n end",
"def add_extra_files(*files); end",
"def addSharedWith(demand)\n @sharedWithList.push(demand) ;\n end",
"def initialize(ingr_name, dessert_instance, calorie_count)\n @ingr_name = ingr_name\n @dessert_instance = dessert_instance\n @calorie_count = calorie_count\n\n Ingredient.all << self\n end",
"def add_reservation(room, checkin_date, checkout_date)\n\n unless @all_rooms.include?(room)\n raise ArgumentError, \"There is no room #{room} available\"\n end\n\n unless check_availability(checkin_date, checkout_date).include?(room)\n raise ArgumentError, \"That room is already reserved\"\n end\n \n reservation = Hotel::Reservation.new(room, checkin_date, checkout_date, @room_rate)\n @all_reservations << reservation\n\n return reservation\n end",
"def booking_params\n params.require(:booking).permit(:user_id, :datareserva, :horareserva, :descricao).merge(user: current_user)\n end",
"def addWeaponCargo _obj, _args\n \"_obj addWeaponCargo _args;\" \n end",
"def add_book(book)\n current_item = line_items.find_by(book_id: book.id)\n if current_item\n current_item.quantity +=1\n else\n current_item = line_items.build(book_id: book.id)\n end\n current_item\n end",
"def add_ticket(ticket)\n @reservations[ticket.confirmation_number] = ticket\n end",
"def extras_to_tryton\n\n result = []\n\n booking_extras.each do |booking_extra|\n\n extra = ::Yito::Model::Booking::BookingExtra.get(booking_extra.extra_id)\n extra_price_definition = extra.price_definition\n\n if extra_price_definition.units_management == :unitary\n if tryton_product = ::ExternalIntegration::Data.first(source_system: 'mybooking',\n source_entity: 'product',\n source_id: booking_extra.extra_id,\n destination_system: 'tryton',\n destination_entity: 'product.template')\n result << {\n \"product\" => tryton_product.destination_id.to_i,\n \"description\" => booking_extra.extra_description,\n \"gross_unit_price_w_tax\" => {\n \"__class__\" => \"Decimal\",\n \"decimal\" => \"%.2f\" % booking_extra.extra_unit_cost\n },\n \"quantity\" => booking_extra.quantity\n }\n else\n # Tryton product not found\n end \n elsif extra_price_definition.units_management == :detailed\n if self.days < extra_price_definition.units_management_value #do not apply extra days\n if tryton_product = ::ExternalIntegration::Data.first(source_system: 'mybooking',\n source_entity: 'product',\n source_id: \"#{booking_extra.extra_id}-#{self.days}\",\n destination_system: 'tryton',\n destination_entity: 'product.template') \n result << {\n \"product\" => tryton_product.destination_id.to_i,\n \"description\" => build_extra_with_days_description(booking_extra.extra_description, self.days),\n \"gross_unit_price_w_tax\" => {\n \"__class__\" => \"Decimal\",\n \"decimal\" => \"%.2f\" % booking_extra.extra_unit_cost\n },\n \"quantity\" => booking_line.quantity\n } \n else\n # Tryton product not found\n end \n else # apply extra days\n max_days = extra_price_definition.units_management_value\n max_days_price = extra_price_definition.prices.select {|item| max_days == item.units}.first.price\n if tryton_product = ::ExternalIntegration::Data.first(source_system: 'mybooking',\n source_entity: 'product',\n source_id: \"#{booking_extra.extra_id}-#{max_days}\",\n destination_system: 'tryton',\n destination_entity: 'product.template') \n result << {\n \"product\" => tryton_product.destination_id.to_i,\n \"description\" => build_extra_with_days_description(booking_extra.extra_description, max_days),\n \"gross_unit_price_w_tax\" => {\n \"__class__\" => \"Decimal\",\n \"decimal\" => \"%.2f\" % max_days_price\n },\n \"quantity\" => booking_extra.quantity\n } \n else\n # Tryton product not found \n end \n extra_days = self.days - max_days\n extra_day_price = extra_price_definition.prices.select {|item| 0 == item.units}.first.price\n if tryton_product = ::ExternalIntegration::Data.first(source_system: 'mybooking',\n source_entity: 'product',\n source_id: \"#{booking_extra.extra_id}-EXTRA\",\n destination_system: 'tryton',\n destination_entity: 'product.template')\n result << {\n \"product\" => tryton_product.destination_id.to_i,\n \"description\" => build_extra_with_extra_days_description(booking_extra.extra_description),\n \"gross_unit_price_w_tax\" => {\n \"__class__\" => \"Decimal\",\n \"decimal\" => \"%.2f\" % extra_day_price\n },\n \"quantity\" => booking_extra.quantity * extra_days\n } \n\n else\n # Tryton product not found\n end\n end \n end \n\n end\n\n return result\n\n end",
"def add_ingredients(ingredient_arr)\n ingredient_arr.each do |ingredient|\n @ingredients << ingredient\n end\n @ingredients\n end",
"def needed_appointments(db, business_name, address)\n db.execute(\"INSERT INTO reminders (business_name, address) VALUES (?, ?)\", [business_name, address])\nend",
"def extract_extras(*args)\n args.extract_options!\n args.shift\n args\n end",
"def addMagazineCargo _obj, _args\n \"_obj addMagazineCargo _args;\" \n end",
"def addSecondaryWeaponItem _obj, _args\n \"_obj addSecondaryWeaponItem _args;\" \n end",
"def add(alerter)\n @alerters << alerter\n alerter\n end",
"def adding\n shipping_manifest = {\n \"whale bone corsets\" => 5, \n \"porcelain vases\" => 2, \n \"oil paintings\" => 3\n }\nshipping_manifest[\"muskets\"] = 2\nshipping_manifest[\"gun powder\"]= 4\nshipping_manifest\nend",
"def create\n # @reservation = Reservation.new(reservation_params)\n @reservation = current_user.reservations.create!(reservation_params)\n\n respond_to do |format|\n if @reservation.save\n format.html { redirect_to @reservation, notice: 'Reservation was successfully created.' }\n format.json { render :show, status: :created, location: @reservation }\n else\n format.html { render :new }\n format.json { render json: @reservation.errors, status: :unprocessable_entity }\n end\n end\n # current_user.book! @reservation\n end",
"def add_extra_field(extra_field)\n # Try to find an extra field with the same header ID already in the list\n # and merge the new one with that if one exists; otherwise, add the new\n # one to the list.\n existing_extra_field = @extra_fields.find do |ef|\n ef.header_id == extra_field.header_id\n end\n if existing_extra_field.nil? then\n @extra_fields << extra_field\n else\n extra_field = existing_extra_field.merge(extra_field)\n end\n\n # Set some attributes of this entry based on the settings in select types\n # of extra fields.\n if extra_field.kind_of?(ExtraField::ExtendedTimestamp) then\n self.mtime = extra_field.mtime unless extra_field.mtime.nil?\n self.atime = extra_field.atime unless extra_field.atime.nil?\n elsif extra_field.kind_of?(ExtraField::Unix) then\n self.mtime = extra_field.mtime unless extra_field.mtime.nil?\n self.atime = extra_field.atime unless extra_field.atime.nil?\n self.uid = extra_field.uid unless extra_field.uid.nil?\n self.gid = extra_field.gid unless extra_field.uid.nil?\n end\n self\n end",
"def reservation_params\n params.require(:reservation).permit(:expires_at, :fulfilled, :reserve_at, :book_id, :user_id)\n end",
"def details\n return @description + \" Extra cost: \" + \"#{@extra_cost}\" + \". \" + @basic_booking.details\n end",
"def add(book)\n\t\t @books << book\n\tend",
"def addIngredient(description, amount, unit=\"oz\")\n\n\t\t\t# this rather interesting looking line is creating\n\t\t\t# a new \"instance\" of an \"Ingredient object\" (that\n\t\t\t# is, creates a value of our Ingredient type),\n\t\t\t# and appends (that is the \"<<\" bit) the new value\n\t\t\t# on to the array \"@ingredient\"\n\t\t\t#\n\t\t\t# The values in \"description\", \"amount\", and \"unit\"\n\t\t\t# are passed into the \"initialize\" method of the \n\t\t\t# ingredient class defined just above\n\t\t@ingredient << Ingredient.new(description, amount, unit)\n\tend",
"def create_special_offer(rental, options = {})\n post(\"rentals/#{rental}/special_offers\", special_offers: [options]).pop\n end",
"def add_student(student, owner)\n @user = User.find(student)\n @owner = User.find(owner)\n @app = @user.appointments.create(:booking_id => eslf.id)\n if @app.save\n BookingMailer.booking_email(@user, @app.booking, @owner).deliver\n end\n end",
"def add_ingredients(ing_array)\n ing_array.each do |ing|\n RecipeIngredient.new(self, ing)\n end\n end",
"def <<(line)\n @extra << line\n end",
"def admin_selling_config_days_to_complete_params\n params.require(:admin_selling_config_days_to_complete).permit(:extra)\n end",
"def add_ingredients(ingredients)\n ingredients.each { |i| RecipeIngredient.new(self, i) }\n end",
"def append_order_note(order_num, discount_code)\nend",
"def add_ingredient bowl, ingredient, cups, servings\n bowl += ingredient + (cups*servings).to_s\nend",
"def add_ingredients(ingredients)\n RecipeIngredient.new(ingredients, self)\nend",
"def details\n return @description + \" extra cost: \" + \"#{@extra_cost}\" + \". \" + @basic_booking.details\n end"
] |
[
"0.6635611",
"0.59817415",
"0.59312916",
"0.54091024",
"0.5391078",
"0.5381175",
"0.537835",
"0.5361979",
"0.53195685",
"0.53176796",
"0.53095484",
"0.52653044",
"0.5236827",
"0.52123994",
"0.5208371",
"0.5140492",
"0.51366997",
"0.5130116",
"0.51078737",
"0.5099543",
"0.5073262",
"0.5051849",
"0.5040979",
"0.50299436",
"0.5025611",
"0.50252724",
"0.5005685",
"0.49961028",
"0.4992728",
"0.49844566",
"0.49585626",
"0.4951941",
"0.49511424",
"0.4932206",
"0.49263823",
"0.490579",
"0.48819828",
"0.4878455",
"0.48762232",
"0.4872195",
"0.48717827",
"0.48717827",
"0.48717827",
"0.48717827",
"0.48717827",
"0.48717827",
"0.48717827",
"0.48717827",
"0.48717827",
"0.48717827",
"0.48717827",
"0.48717827",
"0.48717827",
"0.48717827",
"0.48717827",
"0.48717827",
"0.48717827",
"0.48717827",
"0.48714915",
"0.48676613",
"0.48665458",
"0.48624685",
"0.48557281",
"0.48516184",
"0.48495388",
"0.48416328",
"0.48403335",
"0.48370337",
"0.4824082",
"0.4821327",
"0.48195365",
"0.48164356",
"0.4816406",
"0.48157164",
"0.48126936",
"0.48117435",
"0.48083454",
"0.4807302",
"0.48065317",
"0.4797997",
"0.4792047",
"0.47868204",
"0.47862798",
"0.4785162",
"0.47705767",
"0.4761805",
"0.47531852",
"0.475041",
"0.47501314",
"0.47490725",
"0.47484443",
"0.47468424",
"0.47450155",
"0.4743245",
"0.47396934",
"0.47389463",
"0.47387058",
"0.47382563",
"0.47371435",
"0.47308803"
] |
0.6530423
|
1
|
Destroy a booking extra
|
def destroy_booking_extra(extra_id)
booking_extras = self.booking_extras.select do |booking_extra|
booking_extra.extra_id == extra_id
end
if booking_extra = booking_extras.first
transaction do
self.extras_cost -= booking_extra.extra_cost
self.calculate_cost(false, false)
self.save
booking_extra.destroy
# Create newsfeed
::Yito::Model::Newsfeed::Newsfeed.create(category: 'booking',
action: 'destroy_booking_extra',
identifier: self.id.to_s,
description: BookingDataSystem.r18n.t.booking_news_feed.destroyed_booking_extra(extra_id),
attributes_updated: {extra_id: item_id}.merge({booking: newsfeed_summary}).to_json)
end
self.reload
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def destroy\n @booking.destroy\n end",
"def destroy\n @booking.destroy\n respond_to do |format|\n format.html { redirect_to bookings_url, notice: \"Booking was successfully destroyed.\" }\n format.json { head :no_content }\n end\n Booking.create(user_id: 1, datareserva: @booking.datareserva, horareserva: @booking.horareserva, descricao: '')\n end",
"def destroy\n @booking.destroy\n\n head :no_content\n end",
"def destroy\n @service_booking.update_attribute(:status, 'Cancelled')\n #booking_slot_control = BookingSlotControl.where('category = ? AND dealer_location = ? AND booking_date = ?', \"Book Service\", @service_booking.service_station, @service_booking.service_date).first\n #booking_slot_control.update(available_slots: booking_slot_control.available_slots + 1) if booking_slot_control\n head :no_content\n @service_booking.sevice_booking_notification(I18n.t('Notification.service_booking_destroyed'), I18n.t('Email.service_booking_delete_dealer'), I18n.t('Email.service_booking_delete_user'), params)\n end",
"def destroy\n @booking.destroy\n redirect_to root_path\n \n end",
"def destroy\n @booking.destroy\n redirect_to dashboard_path\n end",
"def destroy\n @booking.destroy\n redirect_to bookings_url, notice: 'Booking was successfully destroyed.'\n end",
"def destroy\n @booking.destroy\n respond_to do |format|\n format.html { redirect_to portal_bookings_url, notice: 'booking was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @booking = Booking.find(params[:id])\n @booking.destroy\n respond_with(@booking)\n end",
"def destroy\n @booking.destroy\n respond_to do |format|\n format.html { redirect_to admin_bookings_url, notice: 'Bookingen er nu slettet.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @booking.destroy\n respond_to do |format|\n format.html { redirect_to hairdresser_bookings_path(@hairdresser), notice: 'Booking was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @booking = @room.bookings.find(params[:id])\n @booking.destroy\n\n respond_to do |format|\n format.html { redirect_to property_room_bookings_url(@property, @room) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @booking_info.destroy\n respond_to do |format|\n format.html { redirect_to booking_infos_url, notice: 'Booking info was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @booking_detail.destroy\n @flat = Flat.find(@booking_detail.flat_id)\n @flat.update(:booking_status=> 0, :booking_date=> nil)\n respond_to do |format|\n format.html { redirect_to booking_details_url, notice: 'Booking detail was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @test_ride.update_attribute(:status, 'Cancelled')\n # booking_slot_control = BookingSlotControl.where('category = ? AND dealer_location = ? AND booking_date = ?', \"Book Test Ride\", @test_ride.location, @test_ride.ride_date).first\n #booking_slot_control.update(available_slots: booking_slot_control.available_slots + 1) if booking_slot_control\n head :no_content\n @test_ride.delay.test_ride_booking_notification(I18n.t('Notification.test_ride_destroyed'), I18n.t('Email.test_ride_booking_delete_dealer'), I18n.t('Email.test_ride_booking_delete_user'), params)\n end",
"def destroy\n booking = Booking.find(params[:id])\n\n # Check if user is the owner of the booking\n if current_user[:id] == booking[:user_id]\n if booking.destroy\n render json: { status: 'SUCCESS', message: 'Deleted booking', data: booking }, status: :ok\n else\n render json: { status: 'FAILURE', message: 'Something went wrong' }, status: :unprocessable_entity\n end\n end\n end",
"def destroy\n @booking.destroy\n respond_to do |format|\n format.html { redirect_to options_path, notice: 'Booking was successfully deleted.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @booking.destroy\n respond_to do |format|\n format.html { redirect_to static_pages_new_booking_enquiry_path }\n format.json { head :no_content }\n end\n end",
"def destroy\n @tour = Tour.find(@booking.tour_id)\n @tour.avail_seats = @tour.avail_seats + @booking.no_of_seats\n @tour.save\n @booking.destroy\n waitlist_handler(@tour.id)\n respond_to do |format|\n format.html { redirect_to bookings_url, notice: 'Booking was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @reservation.destroy\n end",
"def remove_accommodation\n @booking = current_booking\n @booking.update({:accommodation_id=>nil})\n @booking.update(:price=>total_price)\n end",
"def destroy\n @booking.destroy\n respond_to do |format|\n format.html { redirect_to profile_bookings_url, notice: 'Booking was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @booking_time.destroy\n respond_to do |format|\n if @booking_time.destroyed?\n #email de borrado\n format.html { redirect_to bookings_url, notice: I18n.t('text.general.successfully_destroyed', name: BookingTime.model_name.human) }\n format.json { head :no_content }\n else\n format.html { redirect_to bookings_url, notice: @booking_time.errors.full_message }\n format.json { render json: @booking_time.errors, status: :unprocessable_entity }\n end\n end\n end",
"def destroy\n @booking.destroy\n respond_to do |format|\n format.html { redirect_to user_bookings_url, notice: 'Application was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @booking.destroy\n respond_to do |format|\n format.html { redirect_to home_path, notice: 'Booking was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @booking.destroy\n respond_to do |format|\n format.html { redirect_to bookings_url, notice: 'Booking was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @booking.destroy\n respond_to do |format|\n format.html { redirect_to bookings_url, notice: 'Booking was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @booking.destroy\n respond_to do |format|\n format.html { redirect_to bookings_url, notice: 'Booking was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @booking.destroy\n respond_to do |format|\n format.html { redirect_to bookings_url, notice: 'Booking was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @booking.destroy\n respond_to do |format|\n format.html { redirect_to bookings_url, notice: 'Booking was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @booking.destroy\n respond_to do |format|\n format.html { redirect_to bookings_url, notice: 'Booking was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @booking.destroy\n respond_to do |format|\n format.html { redirect_to bookings_url, notice: 'Booking was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @booking.destroy\n respond_to do |format|\n format.html { redirect_to bookings_url, notice: 'Booking was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @booking.destroy\n respond_to do |format|\n format.html { redirect_to bookings_url, notice: 'Booking was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @booking.destroy\n respond_to do |format|\n format.html { redirect_to bookings_url, notice: 'Booking was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @booking.destroy\n respond_to do |format|\n format.html { redirect_to bookings_url, notice: 'Booking was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @booking.destroy\n respond_to do |format|\n format.html { redirect_to bookings_url, notice: 'Booking was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @booking.destroy\n respond_to do |format|\n format.html { redirect_to bookings_url, notice: 'Booking was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @booking.destroy\n respond_to do |format|\n format.html { redirect_to bookings_url, notice: 'Booking was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @booking.destroy\n respond_to do |format|\n format.html { redirect_to bookings_url, notice: 'Booking was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @booking.destroy\n respond_to do |format|\n format.html { redirect_to bookings_url, notice: 'Booking was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @booking.destroy\n respond_to do |format|\n format.html { redirect_to bookings_url, notice: 'Booking was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @booking.destroy\n respond_to do |format|\n format.html { redirect_to bookings_url, notice: 'Booking was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @booking.destroy\n respond_to do |format|\n format.html { redirect_to bookings_url, notice: 'Booking was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @booking.destroy\n respond_to do |format|\n format.html { redirect_to bookings_url, notice: 'Booking was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @booking.destroy\n respond_to do |format|\n format.html { redirect_to bookings_url, notice: 'Booking was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @tour_booking.destroy\n respond_to do |format|\n format.html { redirect_to tour_bookings_url, notice: 'Tour booking was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @fg_booking.destroy\n respond_to do |format|\n format.html { redirect_to fg_bookings_url, notice: 'Booking was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @booking = Booking.find(params[:id])\n @booking.destroy\n\n respond_to do |format|\n format.html { redirect_to bookings_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @booking = Booking.find(params[:id])\n @booking.destroy\n\n respond_to do |format|\n format.html { redirect_to bookings_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @booking = Booking.find(params[:id])\n @booking.destroy\n\n respond_to do |format|\n format.html { redirect_to bookings_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @booking = Booking.find(params[:id])\n @booking.destroy\n\n respond_to do |format|\n format.html { redirect_to bookings_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @seat_booking.destroy\n respond_to do |format|\n format.html { redirect_to seat_bookings_url, notice: 'Seat booking was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @booking.destroy\n respond_to do |format|\n format.html { redirect_to bookings_url }\n end\n end",
"def destroy\n @booking.destroy\n respond_to do |format|\n format.html { redirect_to bookings_url, notice: \"Booking was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @booking.destroy\n respond_to do |format|\n format.html { redirect_to bookings_url, notice: \"Booking was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @booking = Booking.find(params[:id])\n @booking.destroy\n\n respond_to do |format|\n format.html { redirect_to(bookings_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @booking = Booking.find(params[:id])\n @booking.destroy\n\n respond_to do |format|\n format.html { redirect_to(bookings_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @booking.destroy\n respond_to do |format|\n format.html { redirect_to bookings_url, notice: t('.success') }\n format.json { head :no_content }\n end\n end",
"def destroy\n @booking = Booking.find(params[:id])\n @booking.destroy\n\n respond_to do |format|\n format.html { redirect_to bookings_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @booking.destroy\n respond_to do |format|\n format.html { redirect_to bookings_index_url, notice: 'Booking was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n # @bonus.destroy\n end",
"def destroy\n @ninety_ten_booking.destroy\n respond_to do |format|\n format.html { redirect_to ninety_ten_bookings_url, notice: 'Ninety ten booking was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @booking.destroy\n respond_to do |format|\n format.html { redirect_to bookings_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @booking.destroy\n respond_to do |format|\n format.html { redirect_to bookings_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @customizebooking = Customizebooking.find(params[:id])\n @customizebooking.destroy\n\n respond_to do |format|\n format.html { redirect_to(admin_customizebookings_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n if @booking.destroy\n respond_to do |format|\n format.html { redirect_to grounds_url, notice: 'Booking was successfully destroyed.' }\n format.json { head :no_content }\n end\n end\n end",
"def destroy\n @customizebooking = Customizebooking.find(params[:id])\n @customizebooking.destroy\n\n respond_to do |format|\n format.html { redirect_to(customizebookings_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @patient = Patient.find(params[:patient_id])\n @booking = Booking.find(params[:id])\n@Booking.destroy\nrespond_to do |format|\nformat.html { redirect_to patient_booking_path(@patient) }\nformat.xml { head :ok }\nend\nend",
"def destroy\n @booking.destroy\n respond_to do |format|\n format.html do\n redirect_to bookings_url,\n notice: 'Booking was successfully destroyed.'\n end\n format.json { head :no_content }\n end\n end",
"def destroy\n @booking.destroy\n respond_to do |format|\n format.html { redirect_to '/bookings' }\n format.json { head :no_content }\n end\n end",
"def destroy\n book_id = @fee.book_id\n @fee.destroy\n redirect_to book_path(book_id)\n end",
"def destroy\n @reservation.destroy\n respond_to do |format|\n format.html { redirect_to apartment_reservations_url(@apartment), notice: 'Reserva Eliminada.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @calendar_event.destroy\n render json: {\n success: true,\n message: \"Booking successfully removed.\"\n }\n end",
"def destroy\n booking = @booking\n @booking.destroy\n respond_to do |format|\n flash[:success] = \"Your Booking was Cancelled Successfully\"\n format.html { redirect_to bookings_url}\n format.json { head :no_content }\n end\n end",
"def destroy\n @booking_clerk.destroy\n respond_to do |format|\n format.html { redirect_to booking_clerks_url, notice: 'Booking clerk was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n if current_user.present? && !current_user.isAdmin? #Si lo compro un usuario\n #Se procede a crear una reserva con los datos de la hotsale, actualiza la tabla de disponibilidad.\n @reservation = Reservation.new(residence: @hotsale.residence, user: current_user, year: @hotsale.availability.year, week: @hotsale.availability.week, price: @hotsale.price)\n Availability.where(:id => @hotsale.availability.id ).update_all(:is_available => false)\n @reservation.save\n current_user.update(credits: current_user.credits - 1)\n flash[:notice] = \"Se ha hecho la reserva de la residencia\"\n else\n flash[:notice] = \"¡Hotsale Terminada!\"\n end\n @hotsale.destroy\n redirect_to root_path\n end",
"def destroy\n @cancelbooking = Cancelbooking.find(params[:id])\n @cancelbooking.destroy\n\n respond_to do |format|\n format.html { redirect_to cancelbookings_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @room_booking.status = 'canceled'\n @room_booking.save\n respond_to do |format|\n format.html { redirect_to room_bookings_url, notice: 'Room booking was successfully canceled.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @bookkeeping.destroy\n\n head :no_content\n end",
"def destroy\n @booking_confirmation.destroy\n respond_to do |format|\n format.html { redirect_to booking_confirmations_url, notice: 'Booking confirmation was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @booking.destroy\n respond_to do |format|\n if @booking.payment_method == 'Block'\n format.html { redirect_to calendar_url(@booking.room_id) }\n format.json { head :no_content }\n else\n format.html { redirect_to bookings_url, notice: 'Booking was successfully destroyed.' }\n format.json { head :no_content }\n end\n end\n end",
"def destroy\n @test_booking = TestBooking.find(params[:id])\n @test_booking.destroy\n\n respond_to do |format|\n format.html { redirect_to(test_bookings_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @hotel.destroy\n end",
"def destroy\n @hotel.destroy\n end",
"def destroy\n @booking_tour.destroy\n respond_to do |format|\n format.html { redirect_to booking_tours_url, notice: 'Booking tour was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @tblbooking.destroy\n respond_to do |format|\n format.html { redirect_to tbl_bookings_url, notice: 'Booking was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @bookingfinal.destroy\n respond_to do |format|\n format.html { redirect_to bookingfinals_url, notice: 'Bookingfinal was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @book.destroy\n respond_to_destructive\n end",
"def destroy\n return if @name.nil?\n delete_rest \"extra/#{@name}\"\n end",
"def destroy\n @reservation = Reservation.find(params[:id])\n reservation_to_email_attach = @reservation\n # @reservation.destroy\n \n respond_to do |format|\n format.html { redirect_to(:back) } #redirect_to reservations_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @taxi_booking.destroy\n\n respond_to do |format|\n format.html { redirect_to :back, alert: @taxi_booking.errors[:base][0] }\n format.json { head :ok }\n end\n end",
"def destroy\n @reservation.destroy\n redirect_to reservations_url, notice: 'Reservation was successfully destroyed.'\n end",
"def destroy\n @reservation.destroy\n respond_to do |format|\n format.html { redirect_to [@user, @brewery, @reservation], notice: 'Reservation was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @extra.destroy\n\n head :no_content\n end",
"def destroy\n @bookalawn.destroy\n respond_to do |format|\n format.html { redirect_to bookalawns_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @booking_status.destroy\n respond_to do |format|\n format.html { redirect_to booking_statuses_url, notice: 'Booking status was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @course_booking.destroy\n respond_to do |format|\n format.html { redirect_to course_bookings_url, notice: 'Course booking was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @reservation = Reservation.find(params[:id])\n reservation_to_email_attach = @reservation\n @reservation.destroy\n\n \n respond_to do |format|\n format.html { redirect_to reservations_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @reservation = Reservation.find(params[:id])\n reservation_to_email_attach = @reservation\n @reservation.destroy\n\n UserMailer.booking_removed(current_user, reservation_to_email_attach).deliver\n OwnerMailer.booking_removed(reservation_to_email_attach).deliver\n\n respond_to do |format|\n format.html { redirect_to reservations_url }\n format.json { head :no_content }\n end\n end"
] |
[
"0.7617159",
"0.72829074",
"0.72303444",
"0.7117501",
"0.708527",
"0.70264083",
"0.6953831",
"0.69485754",
"0.6944781",
"0.6917499",
"0.68850356",
"0.6866629",
"0.6849843",
"0.6849694",
"0.6847072",
"0.6839478",
"0.68375856",
"0.6819433",
"0.6813726",
"0.67899597",
"0.67758125",
"0.6765811",
"0.6747419",
"0.667746",
"0.6677025",
"0.6671321",
"0.6670508",
"0.6670508",
"0.6670508",
"0.6670508",
"0.6670508",
"0.6670508",
"0.6670508",
"0.6670508",
"0.6670508",
"0.6670508",
"0.6670508",
"0.6670508",
"0.6670508",
"0.6670508",
"0.6670508",
"0.6670508",
"0.6670508",
"0.6670508",
"0.6670508",
"0.66703826",
"0.6666263",
"0.6659793",
"0.6657042",
"0.6657042",
"0.6657042",
"0.6657042",
"0.6649285",
"0.6643999",
"0.6643441",
"0.6643441",
"0.6638325",
"0.6638325",
"0.6636533",
"0.66307366",
"0.66157705",
"0.6603877",
"0.6603281",
"0.6602855",
"0.6602855",
"0.6575753",
"0.6572233",
"0.6539405",
"0.6538615",
"0.6531577",
"0.65309906",
"0.65238655",
"0.6523224",
"0.65138745",
"0.6507357",
"0.64945656",
"0.6489685",
"0.6481475",
"0.64701605",
"0.6459373",
"0.6456175",
"0.6451209",
"0.6432784",
"0.64099383",
"0.64099383",
"0.6407215",
"0.6405614",
"0.6404212",
"0.6385181",
"0.63827634",
"0.63822377",
"0.63703215",
"0.63699234",
"0.6363768",
"0.63544756",
"0.6335998",
"0.63318443",
"0.63317114",
"0.6328666",
"0.6326038"
] |
0.72223777
|
3
|
BOOKING CHARGE Add a booking charge
|
def add_booking_charge(date, amount, payment_method_id)
transaction do
charge = Payments::Charge.new
charge.date = date
charge.amount = amount
charge.payment_method_id = payment_method_id
charge.status = :pending
charge.currency = SystemConfiguration::Variable.get_value('payments.default_currency', 'EUR')
charge.save
booking_charge = BookingDataSystem::BookingCharge.new
booking_charge.booking = self
booking_charge.charge = charge
booking_charge.save
charge.update(:status => :done)
self.reload
# Create newsfeed
::Yito::Model::Newsfeed::Newsfeed.create(category: 'booking',
action: 'add_booking_charge',
identifier: self.id.to_s,
description: BookingDataSystem.r18n.t.booking_news_feed.added_booking_charge(".2f" % amount, payment_method_id),
attributes_updated: {date: date, amount: amount, payment_method_id: payment_method_id}.merge({booking: newsfeed_summary}).to_json)
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def add_charge(desc, bond)\n self[:charges] << {\n :desc => desc.to_s.strip,\n :bond => bond.to_s.gsub('$', '').strip.to_i\n \t}\n Log.d(\"Adding charge: #{self[:charges].last[:desc]}, #{self[:charges].last[:bond]}\")\n end",
"def book_hotel\r\n # prices in stripe are defined in cents, hence 500 => $5.00\r\n # TODO: change hard-coded price to price of specific hotel room\r\n @amount=500\r\n\r\n begin\r\n # for now, creates a new customer and (transparently) unique customer id per transaction\r\n # TODO: store customer.id in User model (this associates user with payment credentials stored by stripe)\r\n customer = Stripe::Customer.create(\r\n :email => params[:stripeEmail],\r\n :source => params[:stripeToken] # this token corresponds to the entered card details\r\n )\r\n\r\n # creates one-time charge for hotel booking\r\n charge = Stripe::Charge.create(\r\n :customer => customer.id,\r\n :amount => @amount,\r\n :description => 'Rails Stripe customer',\r\n :currency => 'usd'\r\n )\r\n redirect_to booking_complete_path\r\n\r\n rescue Stripe::CardError => e\r\n flash[:error] = e.message\r\n redirect_to hotel_booking_path\r\n end\r\n end",
"def new_charge\n end",
"def create_booking(params)\n credentials = Concierge::Credentials.for(supplier_name)\n RentalsUnited::Client.new(credentials).book(params)\n end",
"def charge_and_update_credits\n\t\tresponse = PaymentHelper.create_transaction(self.parker, self)\n\t\tself.leaver.add_credits\n\t\tunless response[:error]\n\t\t\tself.parker.charge_credits(response[:amount_charged] / 100)\n\t\tend\n\tend",
"def create_charge\n customer = Stripe::Customer.create(\n :email => params[:stripeEmail],\n :card => params[:stripeToken]\n )\n\n charge = Stripe::Charge.create(\n :customer => customer.id,\n :amount => Deal.find(current_consumer.orders.last[:deal_id]).price.to_i * 100,\n :description => 'Prlayvous Ticket',\n :currency => 'usd'\n )\n\n #After paying with Stripe, consumers are prompt to confirm their shipping address.\n redirect_to edit_consumer_order_path(current_consumer, @order)\n\n rescue Stripe::CardError => e\n flash[:error] = e.message\n redirect_to charges_path\n end",
"def create\n @booking = Booking.new(booking_params)\n @booking.client = current_user\n\n # Stripe\n #byebug\n rate_per_hour = @booking.rate_per_hour\n duration = @booking.duration\n @amount = rate_per_hour.to_i * duration.to_i\n \n customer = Stripe::Customer.create(\n :email => current_user.email,\n :source => params[:stripeToken]\n )\n \n charge = Stripe::Charge.create(\n :customer => customer.id,\n :amount => @amount,\n :description => \"Session with #{@booking.expert.profile.first_name}\",\n :currency => 'aud'\n )\n \n @booking.charge_identifier = charge.id\n @booking.save\n\n TransactionMailer.transaction_email(@booking).deliver_now\n\n redirect_to @booking, notice: 'Booking was successfully payed. An email confirmation has been sent'\n \n\n rescue Stripe::CardError => e\n flash[:error] = e.message\n redirect_to new_bookings_path(expert_id: booking_params[:expert_id])\n \n #Redirecting if saved or not saved\n # respond_to do |format|\n # if @booking.save\n # format.html { redirect_to @booking, notice: 'Booking was successfully created.' }\n # format.json { render :show, status: :created, location: @booking }\n # else\n # format.html { render :new }\n # format.json { render json: @booking.errors, status: :unprocessable_entity }\n # end\n # end\n\n end",
"def charge(customer_to_be_charged)\n payments.create(:customer => customer_to_be_charged)\n end",
"def create\n @booking = Booking.new(booking_params)\n @booking.profile = @profile\n @booking.user = current_user\n\n # Amount in cents\n @amount = @booking.profile.price * 100 * @booking.lesson_length\n\n respond_to do |format|\n @booking.update_time_date\n if @booking.save\n customer = Stripe::Customer.create(\n :email => current_user.email,\n :source => params[:stripeToken]\n )\n\n charge = Stripe::Charge.create(\n :customer => customer.id,\n :amount => @amount.to_i,\n :description => \"Lesson with \" + @booking.profile.user.first_name,\n :currency => 'aud'\n )\n\n # New conversation between the 2 users so that they can be added to the contacts page\n if Conversation.where(user1_id: current_user.id, user2_id: @booking.profile.user.id).empty?\n Conversation.create(user1_id: current_user.id, user2_id: @booking.profile.user.id)\n end\n\n @booking.charge_identifier = charge.id\n format.html { redirect_to profile_bookings_url(@profile), notice: 'Booking was successfully created.' }\n format.json { render :index, status: :ok, location: @booking }\n else\n format.html { render :new }\n format.json { render json: @booking.errors, status: :unprocessable_entity }\n end\n\n end\n end",
"def book(params)\n Ciirus::Commands::Booking.new(credentials).call(params)\n end",
"def create_booking(params)\n credentials = Concierge::Credentials.for(\"SAW\")\n SAW::Client.new(credentials).book(params)\n end",
"def add_booking(gymclass)\n numofbookings = gymclass.count_num_of_bookings()\n if gymclass.check_space(numofbookings) == true\n save()\n else\n return \"We can't book it!\"\n end\n end",
"def charge!(cents, idempotency_key)\n # we are not charging anything - customer pays via bank transfer\n { paymentmethod: payment_info }\n end",
"def new_charge!(charge_payment_method_id, charge_amount)\n\n charge_attributes = {:date => Time.now,\n :amount => charge_amount,\n :payment_method_id => charge_payment_method_id,\n :currency => SystemConfiguration::Variable.get_value('payments.default_currency', 'EUR')}\n charge_attributes.merge!({:sales_channel_code => self.sales_channel_code}) unless self.sales_channel_code.nil?\n\n charge = Payments::Charge.create(charge_attributes)\n self.charges << charge\n return charge\n end",
"def apply_freshbooks_credit!\n credit = [ self.organization.accounting_gateway.available_credits[:USD], self.invoice_balance ].min\n response = FreshBooks.account.payment.create({ payment: {\n invoice_id: self.freshbooks_invoice_id,\n client_id: self.organization.accounting_gateway.freshbooks_id,\n amount: credit,\n type: 'Credit'\n }})\n end",
"def create \n @start_time = DateTime.parse(params[\"booking\"][\"start_time(1i)\"].to_s + '-' + params[\"booking\"][\"start_time(2i)\"].to_s + '-' + params[\"booking\"][\"start_time(3i)\"].to_s + ' ' + params[\"booking\"][\"start_time(4i)\"].to_s + ':' + params[\"booking\"][\"start_time(5i)\"].to_s + ':' + '0')\n \n @end_time = DateTime.parse(params[\"booking\"][\"end_time(1i)\"].to_s + '-' + params[\"booking\"][\"end_time(2i)\"].to_s + '-' + params[\"booking\"][\"end_time(3i)\"].to_s + ' ' + params[\"booking\"][\"end_time(4i)\"].to_s + ':' + params[\"booking\"][\"end_time(5i)\"].to_s + ':' + '0')\n \n @booking = Booking.new(:price => params[:hiddenPrice], :parking_space_id => params[:parking_space_id], :user_id => current_user.id, :start_time => @start_time, :end_time => @end_time)\n \n @booking.save\n\n redirect_to new_charge_path(booking: @booking, price: params[:hiddenPrice])\n # after saving redirect to charges controller to make the charge. Example of how to link to a route with nested resources:\n # redirect_to parking_space_booking_path(@parking_space, @booking)\n end",
"def create\n @charge = Charge.new(params[:charge])\n @charge.charged_at = Date.today\n\n respond_to do |format|\n if @charge.save\n format.html { redirect_to @charge, notice: 'Charge was successfully created.' }\n format.json { render json: @charge, status: :created, location: @charge }\n else\n format.html { render action: \"new\" }\n format.json { render json: @charge.errors, status: :unprocessable_entity }\n end\n end\n end",
"def reserved\n @book = Book.find(params[:book_id])\n @reservation = Reservation.new(\n user_id: current_user.id,\n book_id: @book.id,\n price: @book.price\n )\n @reservation.save!\n end",
"def credit(postive_amount)\n Credit.create!(team: team,\n room_type: room_type,\n amount: postive_amount)\n end",
"def create\n @booking = Booking.new(booking_params)\n \n unless params[:subject_id].empty?\n @subject = Subject.find(params[:subject_id])\n end\n # TODO date and time validation\n begin\n date = (params['date_part'] + \" \" + params['time_part']).to_datetime\n rescue ArgumentError\n @booking.errors.add(:date, \"is invalid\")\n date = Date.new\n end\n @booking.booking_date = date\n # TODO: Refactor for admin booking creation\n @booking.shared = params[\"shared\"]\n @booking.subject = @subject\n # Add this customer as owner. \n @booking.creator = current_user.customer\n @booking.customers << current_user.customer\n @booking.booked_customers.first.number_students = params[:booking][:booked_customers][:number_students]\n @booking.period = 2\n \n # Create closed booking if customer came from searching or enquiring.\n if params[:presenter_id].present?\n presenter = Presenter.find(params[:presenter_id])\n if presenter.available? @booking.booking_date, @booking.duration_minutes\n @booking.chosen_presenter = Presenter.find(params[:presenter_id])\n @booking.rate = presenter.rate\n @booking.creator = current_user.customer\n else\n @booking.errors.add(:presenter, \"is not available at this time\")\n end\n end \n \n if @booking.save\n # Only send messages to customers if booking is shared\n @message = \"A new #{@booking.subject.name} booking has been created that you may be interested in.\"\n if @booking.shared?\n Notification.notify_applicable_users(current_user, @booking, \"customer\", booking_path(@booking), @message, :interested_booking)\n end\n # Only send messages to presenters if booking is open\n if @booking.chosen_presenter.nil?\n Notification.notify_applicable_users(current_user, @booking, \"presenter\", booking_path(@booking), @message, :interested_booking)\n end\n Notification.notify_admin(\"A new booking has been created\", booking_path(@booking), :booking)\n\n # Add booking to booked customers\n current_user.customer.created_bookings << @booking\n\n #clear search session \n session[:search_params] = nil\n redirect_to @booking\n else\n @date_part = params['date_part']\n @time_part = params['time_part']\n render :new\n end\n\n end",
"def create_new_booking_oct(customer, space)\n new_booking = Booking.new\n new_booking.user = customer\n new_booking.space = space\n new_booking.date_start = DateTime.strptime(\"10/14/2019\", \"%m/%d/%Y\")\n new_booking.date_end = DateTime.strptime(\"10/14/2019\", \"%m/%d/%Y\")\n return new_booking\nend",
"def create\n @accommodation_charge = @company.accommodation_charges.build(accommodation_charge_params)\n\n if @accommodation_charge.save\n redirect_to company_accommodation_charges_path( @company ), notice: t('notice.create', model_name: f(AccommodationCharge))\n else\n render :new\n end\n end",
"def create\n @deal = Deal.find(params[:deal_id])\n @order = Order.new\n @order.consumer_id = current_consumer.id\n @order.deal_id = params[:deal_id]\n @order.address = current_consumer.address\n if @order.save\n create_charge #This method must be called ONLY if an order has already been created, otherwise it will break.\n @consumer.total_points = (@consumer.total_points + 1)\n @consumer.save\n if @deal.has_exceeded_threshold?\n @deal.threshold_reached = true\n @deal.save\n end\n else\n flash[:notice] = 'You have already purchased a ticket for this item. Goodluck!'\n redirect_to :back\n end\n end",
"def charge_reservation (amount_fee, token, currency_type, stripe_user_id)\n charge = Stripe::Charge.create({\n amount: amount_fee,\n source: token,\n currency: currency_type\n },\n stripe_account: stripe_user_id\n )\n end",
"def booking_amount\n self.charges.booking.inject(0){|sum, charge| sum + charge.amount}\n end",
"def charge amount=0.0, method=\"pcc\", note=''\n\n invoice_item_category = InvoiceItemCategory.where(code:method).first\n\n #check the invoice category\n if invoice_item_category.nil? then\n raise \"Category not found\"\n return\n end\n\n #create a new invoice_item w/ the appropiate category\n Invoice.transaction do\n invoice_item = self.invoice_items.new({\n invoice_item_category_id:invoice_item_category.id,\n charges:amount,\n note:note\n })\n\n if invoice_item.save! then\n #update the total billing\n self.update_attribute(:total_billing, self.generate_total_billing)\n if self.total_billing.zero? then\n self.settled!\n end\n else\n raise \"failed to save transaction\"\n return\n end\n\n end\n end",
"def create_charge\n # Amount in cents\n @amount = 500\n\n customer = Stripe::Customer.create(\n :email => current_user.email,\n :card => params[:stripeToken]\n )\n\n charge = Stripe::Charge.create(\n :customer => customer.id,\n :amount => @amount,\n :description => 'Rails Stripe customer',\n :currency => 'usd'\n )\n\n rescue Stripe::CardError => e\n flash[:error] = e.message\n redirect_to root_path\n end",
"def register_booking\n return unless booked_at\n\n self.booked_at = ClockIn.new.recorded_as booked_time: booked_at.to_date,\n add_time: true\n credits.register_booking(self)\n end",
"def booking_params\n params.require(:booking).permit(:expert_id, :time, :duration, :rate_per_hour, :location, :charge_identifier)\n end",
"def book!(event_id)\n event = Event.find(event_id)\n become_customer_of(event.company_id)\n Booking.new(event: event, customer: self).save # validations on model and database will prevent customer booking same event twice\n end",
"def reward\n business.add_to_balance(amount)\n end",
"def create\n @spot = Spot.find(params[:spot_id])\n @booking = Booking.new(booking_params)\n @booking.spot = @spot\n @booking.user = current_user\n @booking.status = \"Pending confirmation\"\n if @booking.time_arrive && @booking.time_leave\n @booking.price = (@booking.time_leave - @booking.time_arrive).to_f * @booking.spot.price.to_f\n else @booking.value = 0\n end\n if @booking.save\n flash[:notice] = \"Thank your for booking. It has been forwarded to the owner\"\n\n redirect_to spot_path(@spot)\n else\n flash[:alert] = @booking.errors.full_messages\n\n redirect_to spot_path(@spot)\n\n end\n end",
"def add_reservation(start_date, end_date)\n @bookings << [start_date, end_date]\n end",
"def charge!\n assign_attributes payment_adapter.charge!(price, identifier)\n self.paymentdate = Date.today\n begin\n save!\n invoice!\n rescue\n # Don't allow Exceptions here\n Rails.logger.info \"Could not create invoice for #{identifier}\"\n end\n end",
"def create \n\t\t# amoutn in cents \n\t\t#@amount = 500 \n\n\t\tcustomer = Stripe::Customer.create(\n\t\t\t:email => 'example@stripe.com',\n\t\t\t:card => params[:stripeToken]\n\t\t\t)\t\n\n\t\tcharge = Stripe::Charge.create(\n\t\t\t:customer => customer.id,\n\t\t\t:amount => @amount,\n\t\t\t:description => 'Rails Stripe customer',\n\t\t\t:currency => 'usd'\n\t\t\t)\n\n\trescue Stripe::CardError => e\n\t\tflash[:error] = e.message\n\t\tredirect_to charges_path \n\tend",
"def create \n bparams = booking_params\n bparams[:created_by] = User.find_by_name(session[:user])\n bparams[:date] = Date.strptime(session[:date], \"%d.%m.%Y\")\n \n bparams[:accounting_number] = Booking.where(account_id: bparams[:account_id]).map {|b| b.accounting_number}.compact.max.to_i+1\n \n @booking = Booking.new(bparams)\n\n respond_to do |format|\n if @booking.save\n format.html { redirect_to :back, notice: 'Booking was successfully created.' }\n format.json { render :show, status: :created, location: @booking }\n else\n format.html { render :new }\n format.json { render json: @booking.errors, status: :unprocessable_entity }\n end\n end\n end",
"def charge(attrs = {})\n post :charges, {}, attrs.to_xml(:root => :charge)\n end",
"def booking_params\n params.require(:booking).permit(:driver_name, :license_plate_number, :space_number, :start_time, :finish_time, :cost)\n end",
"def create\n if @current_user.has_privilege?('charges', 'insert')\n @charge = Charge.new(params[:charge])\n if @charge.save\n redirect_to(charges_path, :notice => '新建收费项目成功.')\n else\n render :action => \"new\"\n\n end\n else\n flash[:notice] = \"你没有新建收费项目的权限,请联系管理员\"\n render_403\n end\n\n end",
"def charge(company_number, charge_id)\n client.get(\"company/#{company_number}/charges/#{charge_id}/\")\n end",
"def booking_params\n params.require(:booking).permit(:reference)\n end",
"def expire!\n successor = BillingPeriod.create! booking: booking,\n start_date: start_of_next_period\n successor.delay.charge!\n end",
"def create\n # @booking = Booking.new(booking_params)\n #@available_seats = Bus.find(:id Journey.find_by(id: booking_params[:journey_id]).bus_id).max_seats - Booking.where(journey_id: booking_params[:journey_id]).sum(:seats_count)\n #@available_seats\n p booking_params\n# booking_params[:status] = \"Pending\"\n @booking = current_user.bookings.build(booking_params)\n @booking.status =\"1\"\n respond_to do |format|\n if @booking.save\n flash[:success] = \"Booking Successful!!!\"\n format.html { redirect_to @booking}\n format.json { render :show, status: :created, location: @booking }\n else\n format.html { render :new }\n format.json { render json: @booking.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @accommodation_charge = AccommodationCharge.new(accommodation_charge_params)\n\n respond_to do |format|\n if @accommodation_charge.save\n format.html { redirect_to @accommodation_charge, notice: 'Accommodation charge was successfully created.' }\n format.json { render action: 'show', status: :created, location: @accommodation_charge }\n else\n format.html { render action: 'new' }\n format.json { render json: @accommodation_charge.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_online_charge!(charge_payment, charge_payment_method_id)\n \n if total_pending > 0 and \n charge_payment_method = Payments::PaymentMethod.get(charge_payment_method_id.to_sym) and\n not charge_payment_method.is_a?Payments::OfflinePaymentMethod and\n !([:deposit, :pending, :total].find_index(charge_payment.to_sym)).nil?\n\n amount = case charge_payment.to_sym\n when :deposit\n booking_deposit\n when :total\n total_cost\n when :pending\n total_pending\n end\n\n charge = new_charge!(charge_payment_method_id, amount) if amount > 0\n save\n return charge\n end \n\n end",
"def create\n\t@book=Book.find(params[:book_id])\n\tif @book.present?\n\t\t@amount = (100* @book.price).to_i\n\t\t@desc=@book.title\n\telse\n\t\tredirect_to pages_products_path, :flash => { :notice => \"book not found\" }\n\t\treturn\n\tend\n\n\tif current_user.stripe_id.present?\n\t\tcustomer_id=current_user.stripe_id\n\t\tcustomer = Stripe::Customer.retrieve(customer_id)\n\t\tcustomer.sources.create(:source => params[:stripeToken])\n\telse\n\t\tcustomer = Stripe::Customer.create(\n \t\t\t:email => params[:stripeEmail],\n \t\t\t:source => params[:stripeToken]\n \t\t)\n\n\t\tcustomer_id=customer.id\n\t\tcurrent_user.stripe_id=customer_id\n\t\tcurrent_user.save(validate: false)\n\tend\n\n\tcharge = Stripe::Charge.create(\n\t\t:customer => customer_id,\n\t\t:amount => @amount,\n\t\t:description => @desc,\n\t\t:currency => 'usd'\n\t)\n\n\t@book=BuyBook.new(:book_id => params[:book_id], :user_id => current_user.id, :price => @amount )\n\t@book.save\n\n\tredirect_to pages_page0_path, :flash => { :notice => \"purchase completed\" }\n\n\trescue Stripe::CardError => e\n\t\tflash[:error] = e.message\n\t\tredirect_to new_buy_book_path(:id => params[:book_id])\n end",
"def new\n @charge = Charge.new\n end",
"def create_new_booking_sep(customer, space)\n new_booking = Booking.new\n new_booking.user = customer\n new_booking.space = space\n new_booking.date_start = DateTime.strptime(\"09/01/2019\", \"%m/%d/%Y\")\n new_booking.date_end = DateTime.strptime(\"09/02/2019\", \"%m/%d/%Y\")\n return new_booking\nend",
"def create\n\t\tbooking = Booking.new(booking_params)\n\n\t if booking.save\n\t \tPeekBooker.use_a_boat(booking.size, booking.timeslot_id)\n\t \tPeekBooker.delete_overlap_assignments(booking.timeslot_id)\n\t \tPeekBooker.upd_availability(booking.timeslot_id)\n\t \t\n\t \trender json: booking, status: 201\n\t end\n\tend",
"def create\n @borrowed_book = BorrowedBook.new(borrowed_book_params)\n respond_to do |format|\n if @borrowed_book.save\n borrow(@borrowed_book)\n format.html { redirect_to @borrowed_book, notice: 'Borrowed book was successfully created.' }\n format.json { render :show, status: :created, location: @borrowed_book }\n else\n format.html { render :new }\n format.json { render json: @borrowed_book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def book(params)\n rate_plan = price_handler.best_rate_plan(params)\n\n return rate_plan unless rate_plan.success?\n\n u_id = JTB::UnitId.from_roomorama_unit_id(params[:unit_id])\n\n message = builder.build_booking(params, rate_plan.value, u_id.room_type_code)\n result = remote_call(message)\n return result unless result.success?\n\n result = response_parser.parse_booking(result.value)\n return result unless result.success?\n\n reference_number = ReferenceNumber.from_jtb_ids(result.value, rate_plan.value.rate_plan)\n\n Result.new(reference_number.reference_number)\n end",
"def get_booking(price,traveller_id,destination_id,transportation)\n booking = Booking.create(price:price,traveller_id:traveller_id,destination_id:destination_id,transport:transportation)\n return booking\nend",
"def create\n @booking = Booking.new(booking_params)\n room = Room.find(@booking.room_id) \n \n @booking.buyer_id = current_user.id if user_signed_in?\n @booking.seller_id = room.user_id\n @booking.room_name = room.name\n @booking.room_title = room.title\n @booking.booking_code = Booking.generate_booking_code\n if params[:payment_method].present?\n @booking.payment_method = params[:payment_method]\n else\n @booking.payment_method = \"Block\"\n end\n\n respond_to do |format|\n if @booking.save\n if @booking.payment_method == \"Bank Transfer\"\n #send_message(\"+15005550006\", \"[HB][##{@booking.id}] Brace yourself for RM#{@booking.service_fee} bank transfer from #{@booking.first_name}(#{@booking.phone}). Visit HourBeds.com for more info\")\n format.html { redirect_to payment_instruction_url(transfer: @booking.total) }\n elsif @booking.payment_method == \"Block\"\n format.html { redirect_to calendar_url(room, start_date: @booking.start_date) }\n else\n #format.html { redirect_to booking_url(@booking), notice: 'Booking was successfully created.' }\n #send_message(\"+15005550006\", \"You got a #{@booking.duration} hour reservation for #{@booking.room_name.truncate(20)} (#{@booking.check_in.strftime(\"%b %d, %Y - %l:%M %p\")}). Visit HourBeds.com for more info\")\n end\n format.json { render :show, status: :created, location: @booking }\n else\n format.html { render :new }\n format.json { render json: @booking.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @charge = Charge.new(params[:charge])\n if @charge.save\n redirect_to @charge, notice: 'Charge was successfully created.' \n else\n render action: \"new\"\n end\n end",
"def create\n \n @booking = Booking.new(params[:booking])\n params[:booking][:end_time] = @booking.end_time\n \n\n \n @booking = Booking.new(params[:booking])\n if @booking.weights == 1\n @booking.no_ergs = 0\n end\n \n respond_to do |format|\n if @booking.save\n flash[:notice] = 'Your booking was successfully created.'\n format.html { redirect_to bookings_path }\n format.xml { render :xml => @booking, :status => :created, :location => @booking }\n else\n format.html { render :action => \"index\" }\n format.xml { render :xml => @booking.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def add_to_allocation(supplier, demander, bid)\n @allocation[supplier.get_id][demander.get_id] = { :demander => demander, :bid => bid }\n @in_allocation[demander.get_id] = true\n end",
"def create\n @movie = Movie.find(params[:movie_id])\n @booking = @movie.bookings.create(booking_params)\n @booking.user_id = current_user.id\n @coupon = @booking.coupon_code\n @seat_count = @booking.seat_count\n @match = Coupon.find_by(code: @coupon)\n @screen_fee = @booking.movie.screen.fee\n @fee = @seat_count * @screen_fee\n if @match\n @percentage = @match.percentage\n @fee = @fee - ((@fee * @percentage)/100) \n # @match.coupon_count = @match.coupon_count - 1 \n end\n @booking.total_fee = @fee\n if @booking.save\n redirect_to root_path\n else\n # redirect_to root_path\n end\n end",
"def charge(ledger)\n return unless driver_id.present?\n participants.each_key do |driver_id|\n if driver_id == self.driver_id\n ledger[driver_id][:balance] += fare * (participants.size - 1)\n ledger[driver_id][:last_date_driven] = date\n else\n ledger[driver_id][:balance] -= fare\n end\n end\n nil\n end",
"def create\n @booking = Booking.new(booking_params)\n @booking.user_id=current_user.id\n @booking.tax=((@booking.book_amount)*10)/100\n @booking.other=350\n @booking.total_amount=(@booking.tax)+ (@booking.other) + (@booking.book_amount)\n \n @booking.status=0\n respond_to do |format|\n if @booking.save\n format.html { redirect_to bookings_path(:booking=>{:book_uname=>params[:booking][:book_uname]}), notice: 'Booking was successfully created.' }\n format.json { render :show, status: :created, location: @booking }\n else\n format.html { render :new }\n format.json { render json: @booking.errors, status: :unprocessable_entity }\n end\n end\n #@package=@booking.package.find(params[:id])\n #t=TourDetail.find_by(package_id: @package.id)\n \n end",
"def create\n puts \"------params create #{params.inspect}\"\n # @booking = current_user.bookings.create(booking_params)\n # redirect_to @booking.item, notice: \"Your booking has been created...\"\n @item = Item.find(params[:item_id])\n @booking = @item.bookings.build(booking_params)\n\n @booking.user = current_user\n\n if params[:commit] == 'Book'\n puts @booking.start_date.strftime(\"%Y-%m-%d\").inspect\n @start_date = @booking.start_date.strftime(\"%Y-%m-%d\")\n @end_date = @booking.end_date.strftime(\"%Y-%m-%d\")\n\n found = false\n @all_bookings = Booking.all\n\n @all_bookings.each do |booking|\n if booking.has_paid == TRUE\n start_date= booking.start_date.strftime(\"%Y-%m-%d\")\n end_date = booking.end_date.strftime(\"%Y-%m-%d\")\n if @start_date.between?(start_date, end_date) || @end_date.between?(start_date, end_date)\n if booking.item_id == @booking.item_id\n found = true\n end\n end\n end\n end\n\n if found == true\n redirect_to request.referrer, notice: \"This dress is already booked for this period.\"\n else\n @booking.save!\n redirect_to edit_item_booking_url(@item,@booking), notice: \"You have booked the dress successfully. Please contact owner to fix a time for trial or directly proceed with payment.\"\n end\n end\n\n if params[:commit] == 'Pay'\n respond_to do |format|\n if @booking.save && params[:commit] == 'Pay'\n format.html { redirect_to item_booking_url(@item,@booking), notice: 'Invoice' }\n format.json { render :show, status: :created, location: @booking }\n # f.json { render action: 'show', status: :created, location: @step }\n else\n format.html { render action: 'new' }\n format.json { render json: @booking.errors, status: :unprocessable_entity }\n end\n\n end\n end\n\n end",
"def add_a_record(user, book)\n\t\tnow = DateTime.now.to_date\n\t\tborrow_days = 60\n\t\tdue = now + borrow_days\n\t\t@records << Record.new(user.id, book.isbn, now, due)\n\t\tputs \"Successfully lend <#{book.title}> to #{user.name}. Due:#{due}\"\n\tend",
"def charge_params\n params[:charge].permit(:reward_id, :token)\n end",
"def charge_params\n params.require(:charge).permit(:amount, :paid, :refunded, :customer_id, :amount_currency)\n end",
"def new_booking_request(pid:, check_in:, check_out:)\n owner_uid = DatabaseConnection.query(\"SELECT * FROM properties WHERE pid = #{pid}\").first['uid']\n message(receiver_uid: owner_uid, content: \"New booking request for your space: #{pid} from #{@name}\\nCheck In Date: #{check_in}\\nCheck In Date: #{check_in}\\nClick the link below to confirm\")\n Booking.create(renter_uid: @uid, pid: pid, check_in: check_in, check_out: check_out)\n end",
"def create\n @booking = Booking.new\n @booking.ride = @ride\n @booking.user = current_user\n @booking.booking_status = 'pending'\n if @booking.save!\n redirect_to dashboard_path\n else\n render :new\n end\n end",
"def charge!\n # get the credit card details submitted by the form\n # create the charge on Stripe's servers - this will charge the user's card\n currency = Selfstarter::Application::CURRENCY\n\n charge = Stripe::Charge.create({\n :amount => @campaign_level.price_to_cents, # amount in cents\n :currency => currency,\n :card => @card_id,\n :description => @campaign_level.title,\n :application_fee => @campaign_level.application_fee_cents # amount in cents\n },\n @campaign_level.campaign.user.stripe_token # user's access token from the Stripe Connect flow\n )\n\n charge['id']\n end",
"def booking_params\n params.require(:booking).permit(:booking_reference, :institution, :ticket_type, :access_req, :catering, :certificate, :attended, :dietary_req, :conference_id, :user_id)\n end",
"def charge!(token = nil)\n return nil if !structure.can_receive_payments?\n\n customer = user.stripe_customer || user.create_stripe_customer(token)\n return nil if customer.nil?\n\n charge = Stripe::Charge.create({\n amount: amount.to_i * 100,\n currency: GiftCertificate::CURRENCY,\n customer: customer.id,\n destination: structure.stripe_managed_account\n })\n\n self.stripe_charge_id = charge.id\n self.save\n\n send_emails\n self.delay.retrieve_fees\n\n charge\n end",
"def booking_params\n params.require(:booking).permit(:start_day, :end_day, :hikers_nb, :user_id, :refuge_id, :status, :payment, :amount)\n end",
"def charge_params\n params.require(:charge).permit(:amount, :charged_id, :charged_type, :is_registration_fee, :is_donation, :stripeEmail, :stripeToken, :email)\n end",
"def create \n @booking = Booking.new(booking_params)\n\n @booking.price = @booking.calculate_price(params[:booking][:hours].to_i)\n @booking.save\n\n create_booking_job_instances_from_array(save_jobs, @booking)\n \n if user_signed_in? \n @user = User.find(current_user.id)\n @booking.user = @user\n Mailer.new_booking(@user, @booking).deliver\n else\n @user = @booking.build_user(user_params[:user])\n # stripe_user_object = User.create_stripe_user(params[:stripeToken], @user.name)\n # @user.stripe_id = stripe_user_object.id\n @user.password = Devise.friendly_token.first(8)\n @user.save\n Mailer.welcome(@user, @booking).deliver\n end\n\n # CHARGE THE CARD\n # begin\n # charge = Stripe::Charge.create(\n # :amount => @booking.price, # amount in cents, again\n # :currency => \"usd\",\n # :customer => @user.stripe_id,\n # )\n\n # rescue Stripe::CardError => e\n # # The card has been declined\n # end\n\n respond_to do |format|\n if @booking.save\n sign_in(:user, @user)\n format.html { redirect_to user_url, notice: 'Booking was saved! Check your email for confirmation.' }\n else\n format.html { render action: 'new' }\n end\n end\n end",
"def create_charge(stripe_customer)\n begin\n str = Stripe::Charge.create({\n customer: stripe_customer,\n amount: (amount*100).to_i,\n description: description,\n currency: 'inr',\n })\n rescue Stripe::InvalidRequestError => e\n self.errors.add(:base,e.message)\n e.message\n end\n end",
"def create\n customer = StripeTool.create_customer(email: params[:stripeEmail], stripe_token: params[:stripeToken])\n\n\tcharge = StripeTool.create_charge(customer_id: customer.id, amount: @amount, description: @description)\n\n current_user.stripe_id = customer.id\n\n\treceipt = Charge.new charge_stripe_token: charge.id, price: @amount, description: @description)\n\n\tif Charge.save\n\n\telse\n\n\tend",
"def create\n @Payment = Payment.new\n @Payment.user_id = current_user\n\n Stripe.api_key = ENV[\"STRIPE_API_KEY\"]\n token = params[:stripeToken]\n\n begin\n charge = Stripe::Charge.create(\n :amount => (25 * 100).floor,\n :currency => \"usd\",\n :card => token\n )\n flash[:notice] = \"Thanks for purchasing!\"\n rescue Stripe::CardError => e\n flash[:danger] = e.message\n end\n\n @Payment.stripe_id = charge.id\n @Payment.amount = charge.amount\n\n if current_user.subscribed != true\n current_user.subscribed = true\n current_user.credit = 25.00\n else\n current_user.credit = current_user.credit + 25.00\n end\n\n current_user.save\n redirect_to caves_path\n end",
"def pay_with_credits\n @reservation = current_user.reservations.new(params[:reservation])\n\n respond_to do |format|\n if @reservation.save\n current_user.update_attributes(credits: current_user.credits-@reservation.meal.price)\n format.html { redirect_to @reservation, notice: 'Reservation was successfully created.' }\n format.json { render \"reservations/show\", success: true, status: :created, location: @reservation }\n else\n format.html {\n @menu_items = MenuItem.of_the_next_seven_days.includes(:restaurant)\n @restaurants = @menu_items.collect { |menu_item| menu_item.restaurant }\n render action: \"new\"\n }\n format.json {\n render json: @reservation.errors, status: :unprocessable_entity\n }\n end\n end\n end",
"def credit(amount)\n\t\t@revenue += amount\n\tend",
"def create\n #Take amount from the right place\n\n if params[:amount_entry] == \"\"\n amount = params[:amount_select]\n else\n amount = params[:amount_entry]\n end\n\n #Charge Stripe fees to customer\n\n final_float = amount.to_i + (amount.to_i * 0.029) + 30\n final_amount = final_float.round\n\n @transaction = Transaction.new(user_id: current_user.id, event_id: params[:event_id], amount: final_amount, support: params[:support])\n\n #Create the charge with Stripe\n\n charge = Stripe::Charge.create({\n :amount => final_amount,\n :currency => \"usd\",\n :customer => get_stripe_customer_id,\n :description => \"Tally Contribution\",\n :application_fee => 100\n },\n Pac.find(params[:pac_id]).stripe_secret_key\n )\n\n respond_to do |format|\n if @transaction.save\n format.html { redirect_to @transaction, notice: 'Transaction was successfully created.' }\n format.json { render :show, status: :created, location: @transaction }\n else\n format.html { render :new }\n format.json { render json: @transaction.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_bid\n @booking = Booking.find(params[:id])\n @presenter = current_user.presenter\n \n if !@presenter.presenter_profile\n flash[:info] = \"You must create your profile before you can do this\"\n redirect_to edit_presenter_profile_path(@presenter) and return\n elsif @presenter.presenter_profile.bio.nil?\n flash[:info] = \"You must wait for your profile to be approved before you can do this\"\n redirect_to root_url and return\n end\n\n if @booking.presenters.include? @presenter\n flash[:info] = \"You have already expressed interest in this booking\"\n redirect_to root_url and return\n else\n @booking.presenters << @presenter\n @bid = @booking.bids.find_by(presenter: @presenter)\n @bid.bid_date = DateTime.now\n @bid.rate = params[:rate]\n @bid.save\n end\n\n Notification.send_message(@booking.creator.user, \"#{@presenter.first_name} has expressed an interest in this booking.\", booking_path(@booking), :bid)\n flash[:success] = \"You have successfully placed a bid on this booking.\"\n redirect_to root_url\n end",
"def booking_params\n params.require(:booking).permit(:cost, :inDate, :outDate, :numOfGuests)\n end",
"def booking_params\n params.require(:booking).permit(:time, :needs_supplies, :hours, :price)\n end",
"def add_book(quantity)\n \n #increase the quantity and available for loaning\n self.quantity += quantity\n self.available += quantity\n\n #save the model\n self.save\n end",
"def create\n # Amount in cents\n @amount = Car.deposit\n # ID of car\n @carID = params[:carID]\n\n customer = Stripe::Customer.create(\n :email => params[:stripeEmail],\n :source => params[:stripeToken]\n )\n\n charge = Stripe::Charge.create(\n :customer => customer.id,\n :amount => @amount,\n :description => 'Tesla Model 3 Custom Order',\n :currency => 'usd'\n )\n\n Car.update(@carID.to_i, paid: true)\n OrderConfirmationMailer.order_confirmation_email(User.find(session[:user_id]).email, Car.find(@carID)).deliver_now\n\n rescue Stripe::CardError => e\n flash[:error] = e.message\n puts \"Error occured #{new_charge_path}\"\n redirect_to new_charge_path\n end",
"def add_charge\n #if params[:charge][:room_list_id].to_s == \"\"\n # if params[:charge][:product_id].to_s != \"\"\n # pd_tmp = Product.find(params[:charge][:product_id]).config\n # if pd_tmp != '4' # not payment\n # respond_to do |format|\n # format.json { render json: {success: false} }\n # end\n # return \n # end\n # else\n # respond_to do |format|\n # format.json { render json: {success: false} }\n # end\n # return \n # end\n #end\n \n if params[:charge][:product_id].to_s == \"\"\n respond_to do |format|\n format.json { render json: {success: false} }\n end\n return\n end\n \n folio = Folio.where(input_type_id: params[:charge][:input_type_id]).order(:id).first \n expense = Expense.new(params[:charge])\n expense.folio_id = folio.id\n if expense.save\n respond_to do |format|\n format.json { render json: {success: true} }\n end\n else\n respond_to do |format|\n format.json { render json: {success: false} }\n end\n end\n end",
"def borrower\n end",
"def create_charge(idempotency_key, agreement_id, charge_request, opts = {})\n data, _status_code, _headers = create_charge_with_http_info(idempotency_key, agreement_id, charge_request, opts)\n data\n end",
"def booking\n @event = Event.find(params[:id])\n @event.decrement(:guest_capacity)\n @event.save\n\n render 'guests/guest'\n end",
"def new\n if @current_user.has_privilege?('charges', 'insert')\n @charge = Charge.new\n else\n flash[:notice] = \"你没有新建收费项目的权限,请联系管理员\"\n render_403\n end\n end",
"def booking_price\n time_price + distance_price\n end",
"def charge_type_params\n params.require(:charge_type).permit(:name, :default_amount, :description, :requires_booth_chair_approval)\n end",
"def charge(type, amount, opts = {}) # roster_id, contest_id, invitation_id, referred_id\n case type.to_sym\n when :balance\n self.customer_object.decrease_account_balance(amount, opts)\n when :monthly_entry\n self.customer_object.increase_monthly_contest_entries!(amount, opts)\n when :monthly_winnings\n self.customer_object.decrease_monthly_winnings(amount, opts)\n else\n raise \"Type must be one of [balance, monthly_entry, monthly_winnings]\" unless [:balance, :monthly_entry, :monthly_winnings].include?(type.to_sym)\n end\n end",
"def create\n @@param2 = params[:param2]\n @pending_booking = PendingBooking.find(@@param2)\n @booking = Booking.new(:total_price => @pending_booking.total_price,\n :date=>@pending_booking.date,\n :start_time=>@pending_booking.start_time,\n :doctor_id=>@pending_booking.doctor_id,\n :patient_id=>@pending_booking.patient_id,\n :bill => @pending_booking.bill) \n @bookings_doc = Booking.where('doctor_id=' + current_user.id.to_s)\n \n if @booking.save\n @pending_booking.destroy\n else\n flash[:notice] = \"Failed to confirm...\" \n end\n\n respond_to do |format|\n format.js\n end\n\n end",
"def create\n # Each shop can have only one recurring charge per app. When a new recurring application charge is activated for a shop\n # that already has one, the existing recurring charge is canceled and replaced by the new charge.\n # The new recurring charge is then activated.\n\n plan_info = @subscriptions_info[params[:subscription_type]]\n local_charge = @shop.charges.create\n\n shopify_charge = ShopifyAPI::RecurringApplicationCharge.new(\n name: plan_info[\"name\"],\n price: plan_info[\"price\"],\n return_url: \"#{ENV['APP_URL']}/charges/#{local_charge.id}/activate\",\n test: plan_info[\"test\"],\n capped_amount: plan_info[\"capped_amount\"],\n terms: plan_info[\"terms\"]\n )\n if shopify_charge.save\n fullpage_redirect_to shopify_charge.confirmation_url\n else\n # make sure this works\n local_charge.delete\n # recurring charge could not be created\n end\n end",
"def create\n @book = Book.find_by_id(params[:book_id])\n # check to see if there is enough copies of the book\n if @book.total_in_library > 0\n @reservation = @user.reservations.new\n @reservation.user_id = @user.id\n @reservation.book_id = @book.id\n if @reservation.save && @book.update(total_in_library: @book.total_in_library - 1)\n redirect_to reservations_path, notice: \"#{@book.title} has been reserved\"\n else\n redirect_to book_path(@book), notice: \"Problems reserving #{@book.title}\"\n end\n else # if not enough copies return back to the show page of the book\n redirect_to book_path(@book), notice: \"Not enough copies of #{@book.title} to reserve\"\n end\n end",
"def create\n @booking = Booking.new(params[:booking].except(:contact))\n logger.debug(@booking.id)\n @booking.amount = 0\n if @booking.save\n @contact = @booking.create_contact(params[:booking][:contact])\n if @contact.save\n redirect_to \"/bookings/#{@booking.id}/rooms/new?no_of_rooms=#{params[:rooms]}\"\n else\n @booking.destroy\n render action: 'new'\n end\n else\n render action: 'new'\n end\n end",
"def booking_params\n params.require(:booking).permit(:date, :account_id, :amount, :note1, :note2, :remarks, :created_by_id, :updated_by_id, :accounting_number, :sign, sub_bookings_attributes: [:id, :account_id, :amount, :note1, :note2, :sign, :date, :created_by, :accounting_number])\n end",
"def charge!\n unless charged || canceled\n return true unless order.price.cents > 50\n begin\n result = Stripe::Charge.create(\n customer: billing.customer_id,\n amount: order.price.cents,\n currency: order.price.currency\n )\n\n update charged: true, trans_id: result.id\n rescue Stripe::CardError => e\n e.message\n end\n end\n end",
"def create\n # checkin_date = session[:booking][:checkin]\n # checkout_date = session[:booking][:checkout]\n # room_type_id = session[:booking][:room_type_id]\n checkin_date = params[:booking][:checkin]\n checkout_date = params[:booking][:checkout]\n room_type_id = params[:booking][:room_type]\n\n days = (checkout_date.to_date - checkin_date.to_date).to_i\n \n #@room = Room.where(\"room_type_id = ? AND (id NOT IN (?))\", room_type_id, Booking.joins(:room_occupation).where(\"start_at >= ? OR end_at <= ?\", checkin_date, checkout_date).select(:room_id) ).first\n #@room = Room.where(\"room_type_id = ?\", room_type_id).first\n @room = Room.empty_rooms(checkin_date, checkout_date).where(:room_type_id => room_type_id).first\n \n if @room.nil?\n redirect_to :back, :alert => \"No room avalible\"\n return\n end\n \n Payment.transaction do\n visit_params = Hash.new()\n visit_params[:customer_id] = current_user.id\n visit_params[:should_checkin_at] = checkin_date\n visit_params[:should_checkout_at] = checkout_date\n visit_params[:rate] = @room.base_rate\n visit_params[:room_id] = @room.id\n visit_params[:days] = days\n\n @visit = Visit.new(visit_params)\n @visit.save\n\n date = checkin_date.to_date\n while(date < checkout_date.to_date)\n occupancy_params = Hash.new()\n occupancy_params[:date] = date\n occupancy_params[:room_id] = @room.id\n occupancy_params[:visit_id] = @visit.id\n @occupance = Occupancy.new(occupancy_params)\n @occupance.save\n date = date + 1.day\n end\n\n @payment = current_user.build_payment(payment_params)\n @payment.price = (@room.base_rate * days).to_f\n @payment.visit_id = @visit.id\n @payment.save\n \n end\n redirect_to payment_path(@payment)\n\n end",
"def charge_params\n params.require(:charge).permit(:order_id, :status)\n end",
"def bounces(options={})\n Resources::Bounces.new(self, options)\n end",
"def create\n @bond = Bond.new(bond_params)\n @bond.citizen = current_citizen\n\n respond_to do |format|\n if @bond.save\n format.html { redirect_to \"/citizens/#{@bond.citizen.id}?tab=finances\", notice: 'Bond bought.' }\n format.json { render :show, status: :created, location: @bond }\n else\n format.html { render :new }\n format.json { render json: @bond.errors, status: :unprocessable_entity }\n end\n end\n end"
] |
[
"0.6776659",
"0.6752922",
"0.6468963",
"0.6260624",
"0.6252942",
"0.6193788",
"0.6115227",
"0.6086412",
"0.6001376",
"0.5934734",
"0.59116423",
"0.59038943",
"0.5888044",
"0.58800834",
"0.5854628",
"0.58421224",
"0.5821806",
"0.57947856",
"0.5766759",
"0.5712016",
"0.57005435",
"0.5691257",
"0.5675489",
"0.566657",
"0.5647299",
"0.56445765",
"0.56389964",
"0.56200135",
"0.56016976",
"0.5584066",
"0.55800563",
"0.5573295",
"0.5570044",
"0.55576754",
"0.5551988",
"0.55514175",
"0.55483705",
"0.55458134",
"0.55339885",
"0.5519733",
"0.5517205",
"0.5512308",
"0.55111575",
"0.5500392",
"0.54982543",
"0.5497273",
"0.54921377",
"0.5486992",
"0.5486983",
"0.5480683",
"0.54789186",
"0.5464357",
"0.54604197",
"0.54557705",
"0.54547465",
"0.5454208",
"0.5452633",
"0.5445883",
"0.5444148",
"0.5443696",
"0.5443298",
"0.54405713",
"0.54369164",
"0.54336226",
"0.5430357",
"0.5425719",
"0.5417631",
"0.54122806",
"0.5407987",
"0.5404352",
"0.53986144",
"0.5394972",
"0.5394921",
"0.5392412",
"0.5391143",
"0.53896755",
"0.5382578",
"0.53806454",
"0.53771734",
"0.53749704",
"0.53739065",
"0.53715795",
"0.5369187",
"0.53637",
"0.53630877",
"0.5360894",
"0.5356038",
"0.535292",
"0.53528464",
"0.53509563",
"0.5335981",
"0.5333833",
"0.53317946",
"0.53317857",
"0.5330346",
"0.5328773",
"0.53268296",
"0.5322521",
"0.5314594",
"0.53133464"
] |
0.6776325
|
1
|
Destroy a booking charge
|
def destroy_booking_charge(charge_id)
if booking_charge = BookingDataSystem::BookingCharge.first(:booking_id => self.id,
:charge_id => charge_id)
charge = booking_charge.charge
transaction do
if charge.status == :done
self.total_paid -= charge.amount
self.total_pending += charge.amount
self.save
end
charge.destroy
booking_charge.destroy
# Create newsfeed
::Yito::Model::Newsfeed::Newsfeed.create(category: 'booking',
action: 'destroy_booking_charge',
identifier: self.id.to_s,
description: BookingDataSystem.r18n.t.booking_news_feed.destroyed_booking_charge(".2f" % charge.amount, charge.payment_method_id),
attributes_updated: {amount: charge.amount, payment_method_id: charge.payment_method_id}.to_json)
end
self.reload
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def destroy\n @booking.destroy\n end",
"def destroy\n @charge = Charge.find(params[:id])\n @charge.destroy\n redirect_to charges_url\n end",
"def destroy\n if @accommodation_charge.destroy\n redirect_to company_accommodation_charges_path( @company ), notice: t('notice.destroy', model_name: f(AccommodationCharge))\n else\n redirect_to company_accommodation_charges_path( @company ), notice: t('alert.cant_destroy', model_name: f(AccommodationCharge))\n end\n end",
"def destroy\n @booking.destroy\n redirect_to dashboard_path\n end",
"def destroy\n @booking.destroy\n\n head :no_content\n end",
"def destroy\n @service_booking.update_attribute(:status, 'Cancelled')\n #booking_slot_control = BookingSlotControl.where('category = ? AND dealer_location = ? AND booking_date = ?', \"Book Service\", @service_booking.service_station, @service_booking.service_date).first\n #booking_slot_control.update(available_slots: booking_slot_control.available_slots + 1) if booking_slot_control\n head :no_content\n @service_booking.sevice_booking_notification(I18n.t('Notification.service_booking_destroyed'), I18n.t('Email.service_booking_delete_dealer'), I18n.t('Email.service_booking_delete_user'), params)\n end",
"def destroy\n @charge = Charge.find(params[:id])\n @charge.destroy\n\n respond_to do |format|\n format.html { redirect_to charges_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @accommodation_charge.destroy\n respond_to do |format|\n format.html { redirect_to accommodation_charges_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @booking.destroy\n redirect_to root_path\n \n end",
"def destroy\n @charge.destroy\n respond_to do |format|\n format.html { redirect_to charges_url, notice: 'Charge was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @charge.destroy\n respond_to do |format|\n format.html { redirect_to charges_url, notice: 'Charge was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @charge.destroy\n respond_to do |format|\n format.html { redirect_to charges_url, notice: 'Charge was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @booking.destroy\n redirect_to bookings_url, notice: 'Booking was successfully destroyed.'\n end",
"def destroy\n @booking.destroy\n respond_to do |format|\n format.html { redirect_to portal_bookings_url, notice: 'booking was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @booking_clerk.destroy\n respond_to do |format|\n format.html { redirect_to booking_clerks_url, notice: 'Booking clerk was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @auto_bill_payment.destroy\n redirect_to account_auto_bill_payments_url, notice: 'Auto bill payment was successfully destroyed.'\n end",
"def destroy\n begin\n # Retrieve the charge from Stripe\n charge = Stripe::Charge.retrieve(params[:id])\n\n # Validate that the user should be able to view this charge\n check_destination(charge)\n\n # Refund the charge\n charge.refund(reverse_transfer: true, refund_application_fee: true)\n\n # Update the local charge\n local_charge = Charge.find_by charge_id: charge.id\n local_charge.amount_refunded = charge.amount\n local_charge.save\n\n # Update the amount raised for this campaign\n campaign = Campaign.find(local_charge.campaign_id)\n campaign.raised = campaign.raised.to_i - charge.amount\n campaign.save\n\n # Let the user know the refund was successful\n flash[:success] = \"The charge has been refunded.\"\n redirect_to dashboard_path\n\n # Handle Stripe exceptions\n rescue Stripe::StripeError => e\n flash.now[:error] = e.message\n redirect_to dashboard_path\n\n # Handle other failures\n rescue => e\n flash.now[:error] = e.message\n redirect_to dashboard_path\n end\n end",
"def destroy\n\t\t@shipping_charge = ShippingCharge.find(params[:id])\n\t\tauthorize @shipping_charge\n\t\tif @shipping_charge.destroy\n\t\t flash[:success] = \"Removed Successfully\"\n\t\t redirect_to request.referrer || root_path\n\t\telse\n\t\t\tflash[:danger] = \"Error While Removing\"\n\t\t\tredirect_to request.referrer || root_path\n\t\tend\t \n\tend",
"def destroy\n @booking.destroy\n respond_to do |format|\n format.html { redirect_to bookings_url, notice: \"Booking was successfully destroyed.\" }\n format.json { head :no_content }\n end\n Booking.create(user_id: 1, datareserva: @booking.datareserva, horareserva: @booking.horareserva, descricao: '')\n end",
"def destroy\n @consultationcharge = Consultationcharge.find(params[:id])\n @consultationcharge.destroy\n\n respond_to do |format|\n format.html { redirect_to(consultationcharges_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @booking.destroy\n respond_to do |format|\n if @booking.payment_method == 'Block'\n format.html { redirect_to calendar_url(@booking.room_id) }\n format.json { head :no_content }\n else\n format.html { redirect_to bookings_url, notice: 'Booking was successfully destroyed.' }\n format.json { head :no_content }\n end\n end\n end",
"def destroy\n @time_charge.destroy\n redirect_to (session[:return_to])\n\n end",
"def destroy\n @payment.destroy\n end",
"def destroy\n @payment.destroy\n end",
"def destroy\n @fg_booking.destroy\n respond_to do |format|\n format.html { redirect_to fg_bookings_url, notice: 'Booking was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @reservation.destroy\n end",
"def destroy\n @booking = Booking.find(params[:id])\n @booking.destroy\n respond_with(@booking)\n end",
"def destroy\n @booking.destroy\n respond_to do |format|\n format.html { redirect_to options_path, notice: 'Booking was successfully deleted.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @credit_card_charge.destroy\n respond_to do |format|\n format.html { redirect_to credit_card_charges_url, notice: 'Credit card charge was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @recharge.destroy\n respond_to do |format|\n format.html { redirect_to recharges_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n if @current_user.has_privilege?('charges', 'destroy')\n @charge = Charge.find(params[:id])\n if @charge\n @charge.destroy\n end\n\n redirect_to charges_path\n else\n flash[:notice] = \"你没有删除收费项目的权限,请联系管理员\"\n render_403\n end\n end",
"def destroy\n @gnc_charge.destroy\n respond_to do |format|\n format.html { redirect_to gnc_charges_url, notice: \"Gnc charge was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @booking.destroy\n respond_to do |format|\n format.html { redirect_to admin_bookings_url, notice: 'Bookingen er nu slettet.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @booking.destroy\n respond_to do |format|\n format.html { redirect_to hairdresser_bookings_path(@hairdresser), notice: 'Booking was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @booking.destroy\n respond_to do |format|\n format.html { redirect_to static_pages_new_booking_enquiry_path }\n format.json { head :no_content }\n end\n end",
"def destroy\n @payable_billing = PayableBilling.find(params[:id])\n @payable_billing.destroy\n\n respond_to do |format|\n format.html { redirect_to(payable_billings_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @referral_charge = ReferralCharge.find(params[:id])\n @referral_charge.destroy\n\n respond_to do |format|\n format.html { redirect_to(referral_charges_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @cancelbooking = Cancelbooking.find(params[:id])\n @cancelbooking.destroy\n\n respond_to do |format|\n format.html { redirect_to cancelbookings_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @bookkeeping.destroy\n\n head :no_content\n end",
"def destroy\n if @booking.destroy\n respond_to do |format|\n format.html { redirect_to grounds_url, notice: 'Booking was successfully destroyed.' }\n format.json { head :no_content }\n end\n end\n end",
"def destroy\n @customer = Customer.find(params[:id])\n @customer.loyalty_card.kill \n @customer.kill\n\n respond_to do |format|\n format.html { redirect_to(customers_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @billing.destroy\n respond_to do |format|\n format.html { redirect_to billings_url, notice: 'Billing was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @discharge = Discharge.find(params[:id])\n @discharge.destroy\n\n respond_to do |format|\n format.html { redirect_to(discharges_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @rechargeable_record.destroy\n respond_to do |format|\n format.html { redirect_to rechargeable_records_url, notice: 'Rechargeable record was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n #@appointment = Appointment.find(params[:id])\n free_credits(@appointment)\n @appointment.destroy\n\n respond_to do |format|\n format.html { redirect_to root_url, notice: \"Appointment canceled.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @billing.destroy\n respond_to do |format|\n format.html { redirect_to billings_url, notice: \"Billing was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @creaditcharge.destroy\n respond_to do |format|\n format.html { redirect_to creaditcharges_url, notice: 'Creaditcharge was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @car = Car.find(@booking.car_id)\n @booking.destroy\n @car.status = 'Available'\n @car.save\n if @car.email_register and !@car.user.empty?\n user = User.find_by_email(@car.user)\n ApplicationMailer.car_available_email_notification(user).deliver_now\n @car.user = nil\n @car.email_register = false\n @car.save!\n end\n respond_to do |format|\n format.html { redirect_to bookings_url, notice: 'Booking was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\r\n @cost.destroy\r\n end",
"def destroy\n @booking.destroy\n respond_to do |format|\n format.html { redirect_to bookings_url, notice: 'Booking was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @booking.destroy\n respond_to do |format|\n format.html { redirect_to bookings_url, notice: 'Booking was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @booking.destroy\n respond_to do |format|\n format.html { redirect_to bookings_url, notice: 'Booking was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @booking.destroy\n respond_to do |format|\n format.html { redirect_to bookings_url, notice: 'Booking was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @booking.destroy\n respond_to do |format|\n format.html { redirect_to bookings_url, notice: 'Booking was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @booking.destroy\n respond_to do |format|\n format.html { redirect_to bookings_url, notice: 'Booking was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @booking.destroy\n respond_to do |format|\n format.html { redirect_to bookings_url, notice: 'Booking was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @booking.destroy\n respond_to do |format|\n format.html { redirect_to bookings_url, notice: 'Booking was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @booking.destroy\n respond_to do |format|\n format.html { redirect_to bookings_url, notice: 'Booking was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @booking.destroy\n respond_to do |format|\n format.html { redirect_to bookings_url, notice: 'Booking was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @booking.destroy\n respond_to do |format|\n format.html { redirect_to bookings_url, notice: 'Booking was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @booking.destroy\n respond_to do |format|\n format.html { redirect_to bookings_url, notice: 'Booking was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @booking.destroy\n respond_to do |format|\n format.html { redirect_to bookings_url, notice: 'Booking was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @booking.destroy\n respond_to do |format|\n format.html { redirect_to bookings_url, notice: 'Booking was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @booking.destroy\n respond_to do |format|\n format.html { redirect_to bookings_url, notice: 'Booking was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @booking.destroy\n respond_to do |format|\n format.html { redirect_to bookings_url, notice: 'Booking was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @booking.destroy\n respond_to do |format|\n format.html { redirect_to bookings_url, notice: 'Booking was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @booking.destroy\n respond_to do |format|\n format.html { redirect_to bookings_url, notice: 'Booking was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @booking.destroy\n respond_to do |format|\n format.html { redirect_to bookings_url, notice: 'Booking was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @booking.destroy\n respond_to do |format|\n format.html { redirect_to bookings_url, notice: 'Booking was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @booking.destroy\n respond_to do |format|\n format.html { redirect_to bookings_url, notice: 'Booking was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @freight_bill.destroy\n respond_to do |format|\n format.html { redirect_to freight_bills_url, notice: 'Freight bill was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n booking = Booking.find(params[:id])\n\n # Check if user is the owner of the booking\n if current_user[:id] == booking[:user_id]\n if booking.destroy\n render json: { status: 'SUCCESS', message: 'Deleted booking', data: booking }, status: :ok\n else\n render json: { status: 'FAILURE', message: 'Something went wrong' }, status: :unprocessable_entity\n end\n end\n end",
"def destroy\n @booking_time.destroy\n respond_to do |format|\n if @booking_time.destroyed?\n #email de borrado\n format.html { redirect_to bookings_url, notice: I18n.t('text.general.successfully_destroyed', name: BookingTime.model_name.human) }\n format.json { head :no_content }\n else\n format.html { redirect_to bookings_url, notice: @booking_time.errors.full_message }\n format.json { render json: @booking_time.errors, status: :unprocessable_entity }\n end\n end\n end",
"def destroy\n @booking.destroy\n respond_to do |format|\n format.html { redirect_to bookings_url }\n end\n end",
"def destroy\n @cash_voucher.destroy\n render 'action'\n end",
"def destroy\n @booking.destroy\n respond_to do |format|\n format.html { redirect_to bookings_url, notice: \"Booking was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @booking.destroy\n respond_to do |format|\n format.html { redirect_to bookings_url, notice: \"Booking was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @booking.destroy\n respond_to do |format|\n format.html { redirect_to bookings_index_url, notice: 'Booking was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @charge_transaction = ChargeTransaction.find(params[:id])\n @charge_transaction.destroy\n\n respond_to do |format|\n format.html { redirect_to charge_transactions_url }\n format.xml { head :ok }\n end\n end",
"def destroy\n @bill = Bill.find(params[:id])\n # TODO: \"un-updateEnergyGoals\" related to this bill\n @bill.destroy\n\n respond_to do |format|\n format.html { redirect_to bills_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @booking.destroy\n respond_to do |format|\n format.html { redirect_to home_path, notice: 'Booking was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @booking.destroy\n respond_to do |format|\n format.html { redirect_to profile_bookings_url, notice: 'Booking was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @booking_confirmation.destroy\n respond_to do |format|\n format.html { redirect_to booking_confirmations_url, notice: 'Booking confirmation was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @electricity_bill.destroy\n respond_to do |format|\n format.html { redirect_to electricity_bills_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @seat_booking.destroy\n respond_to do |format|\n format.html { redirect_to seat_bookings_url, notice: 'Seat booking was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n bank_acount = BankAccount.new\n bank_acount.date = DateTime.now\n bank_acount.balance = - @garantor.value_tranfer\n bank_acount.save\n\n @garantor.destroy\n respond_to do |format|\n format.html { redirect_to garantors_url, notice: 'Garantor was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @booking.destroy\n respond_to do |format|\n format.html { redirect_to bookings_url, notice: t('.success') }\n format.json { head :no_content }\n end\n end",
"def destroy\n authorize! :destroy, Discharge\n @discharge.destroy\n respond_to do |format|\n format.html { redirect_to discharges_url, notice: 'Discharge was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n book_id = @fee.book_id\n @fee.destroy\n redirect_to book_path(book_id)\n end",
"def destroy\n booking = @booking\n @booking.destroy\n respond_to do |format|\n flash[:success] = \"Your Booking was Cancelled Successfully\"\n format.html { redirect_to bookings_url}\n format.json { head :no_content }\n end\n end",
"def destroy\n @booking_info.destroy\n respond_to do |format|\n format.html { redirect_to booking_infos_url, notice: 'Booking info was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @booking.destroy\n respond_to do |format|\n format.html do\n redirect_to bookings_url,\n notice: 'Booking was successfully destroyed.'\n end\n format.json { head :no_content }\n end\n end",
"def destroy\n @patient = Patient.find(params[:patient_id])\n @booking = Booking.find(params[:id])\n@Booking.destroy\nrespond_to do |format|\nformat.html { redirect_to patient_booking_path(@patient) }\nformat.xml { head :ok }\nend\nend",
"def destroy\n @admission.destroy\n end",
"def destroy\n @booking = Booking.find(params[:id])\n @booking.destroy\n\n respond_to do |format|\n format.html { redirect_to bookings_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @booking = Booking.find(params[:id])\n @booking.destroy\n\n respond_to do |format|\n format.html { redirect_to bookings_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @booking = Booking.find(params[:id])\n @booking.destroy\n\n respond_to do |format|\n format.html { redirect_to bookings_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @booking = Booking.find(params[:id])\n @booking.destroy\n\n respond_to do |format|\n format.html { redirect_to bookings_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @test_ride.update_attribute(:status, 'Cancelled')\n # booking_slot_control = BookingSlotControl.where('category = ? AND dealer_location = ? AND booking_date = ?', \"Book Test Ride\", @test_ride.location, @test_ride.ride_date).first\n #booking_slot_control.update(available_slots: booking_slot_control.available_slots + 1) if booking_slot_control\n head :no_content\n @test_ride.delay.test_ride_booking_notification(I18n.t('Notification.test_ride_destroyed'), I18n.t('Email.test_ride_booking_delete_dealer'), I18n.t('Email.test_ride_booking_delete_user'), params)\n end",
"def destroy\n @tour = Tour.find(@booking.tour_id)\n @tour.avail_seats = @tour.avail_seats + @booking.no_of_seats\n @tour.save\n @booking.destroy\n waitlist_handler(@tour.id)\n respond_to do |format|\n format.html { redirect_to bookings_url, notice: 'Booking was successfully destroyed.' }\n format.json { head :no_content }\n end\n end"
] |
[
"0.7612688",
"0.756157",
"0.73435915",
"0.73131484",
"0.73122597",
"0.725401",
"0.7248786",
"0.7183744",
"0.7160358",
"0.71502894",
"0.71502894",
"0.71502894",
"0.71302",
"0.7123444",
"0.70675886",
"0.7038702",
"0.70113933",
"0.7006071",
"0.7005511",
"0.69715285",
"0.6955649",
"0.6953276",
"0.69252944",
"0.69252944",
"0.69233066",
"0.69175893",
"0.6910341",
"0.6907621",
"0.6900572",
"0.6896273",
"0.6894794",
"0.68869567",
"0.68868834",
"0.6881233",
"0.6872637",
"0.687092",
"0.6866254",
"0.68635404",
"0.6863441",
"0.685983",
"0.68482226",
"0.6842715",
"0.6841778",
"0.6837264",
"0.6827734",
"0.6824322",
"0.68236905",
"0.6819205",
"0.68165004",
"0.68116796",
"0.6810854",
"0.68105024",
"0.68105024",
"0.68105024",
"0.68105024",
"0.68105024",
"0.68105024",
"0.68105024",
"0.68105024",
"0.68105024",
"0.68105024",
"0.68105024",
"0.68105024",
"0.68105024",
"0.68105024",
"0.68105024",
"0.68105024",
"0.68105024",
"0.68105024",
"0.68105024",
"0.6807357",
"0.6803394",
"0.6801621",
"0.67974466",
"0.67867374",
"0.67860067",
"0.67860067",
"0.6782339",
"0.67809784",
"0.6779117",
"0.67741305",
"0.67606044",
"0.6747336",
"0.6741406",
"0.67344904",
"0.67267853",
"0.6722804",
"0.67193455",
"0.67180544",
"0.6708037",
"0.6703909",
"0.6702715",
"0.66981506",
"0.6697727",
"0.6683572",
"0.6683572",
"0.6683572",
"0.6683572",
"0.6683289",
"0.66820884"
] |
0.7798823
|
0
|
Check if the reservation is confirmed
|
def confirmed?
[:confirmed, :in_progress, :done].include?(self.status)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def is_confirmed?\n return self.status == Erp::Reservations::Reservation::STATUS_CONFIRMED\n end",
"def confirm\n # can't confirma reservation in the past!\n render false && return unless @reservation.start_datetime > Time.current\n if @reservation.confirm && @reservation.save\n flash[:notice] = \"You are confirmed for #{@reservation.start_datetime_human}, with #{@reservation.user.name}.\"\n else\n flash[:alert] = 'Error'\n end\n respond_to do |format|\n format.html { redirect_to calendar_path(token: @visitor.token, reservation_id: @reservation.id) }\n format.js { render text: \"$('#reservationModal').modal('hide'); $('#calendar').fullCalendar( 'refetchEvents' );\" }\n end\n end",
"def request_confirmation\n reservation = Reservation.first\n ReservationMailer.request_confirmation(reservation)\n end",
"def confirm_members\n ur = UserReservation.find(params[:user_reservation_id])\n\n #need to check the current user owns the reservation\n\n if ur.check_outstanding.zero? then\n ur.reservation_confirmed!\n else\n ur.payment_attempted!\n end\n\n render json: {message:\"Members Verified for #{ur.id}\", user_reservation:ur}\n\n end",
"def confirmed?\n confirmation == 'Confirmed'\n end",
"def confirmed?\n !!confirmed_at\n end",
"def confirmed?\n !!confirmed_at\n end",
"def confirmed?\n ! confirmed_at.nil?\n end",
"def confirmed?\n confirmation == 'yes'\n end",
"def confirm(reservation)\n @reservation = reservation\n\n mail to: reservation.user.email, subject: \"Your Itinerary\"\n end",
"def is_confirmed?\n if self.confirmed == true\n return true\n else\n return false\n end\n end",
"def confirm(new_reservation)\n @reservation = new_reservation\n \n mail to: new_reservation.user.email,\n from: \"support@example.com\",\n subject: \"Thanks for your reservation\"\n end",
"def vacant?\n reservation ? false : true\n end",
"def reservation_confirmation(reservation)\n @reservation = reservation\n\n mail to: reservation.email, bcc: \"drillmenowsf@gmail.com\", subject: \"Reservation Confirmation\"\n end",
"def confirmed?\n state == 'confirmed'\n end",
"def confirmed?\n self.status >= 0\n end",
"def confirmed?; end",
"def confirmed?\n confirmation == 'yes'\n end",
"def confirmed\n confirmed_date.present?\n end",
"def confirmation\n @reservation = Reservation.find(params[:id])\n render action: \"show\"\n end",
"def confirm!\n return false if purchased?\n confirmed!\n end",
"def do_confirm\n if current_user.type == \"User\" || current_attendee.affiliate == current_user\n if registration = current_attendee.event_registrations.for_event(current_object).first\n registration.confirm!\n # log confirmation activity\n log_checkin_activity(\"Confirmed for '#{current_object.display_name}'\")\n \n @attendee_id = current_attendee.id\n @event_id = params[:id]\n end\n end\n\n render :text => \"Confirmed\"\n end",
"def reservation_confirmation(reservation_id)\n @reservation = Reservation.find(reservation_id)\n # change this to guest email\n email = 'khun84@gmail.com'\n mail to: email, subject: \"Pairbnb: Reservation confirmation\"\n end",
"def is_confirmed?\n return self.status == Erp::QuickOrders::Order::STATUS_CONFIRMED\n end",
"def is_reservation_and_has_conflicts?\n self.is_reservation? && self.has_conflicts?\n end",
"def is_confirmed?\n\t\t!(self.user.nil? or self.activated_at.blank?)\n\tend",
"def confirming?\n self.status == 'confirming'\n end",
"def account_confirmed?\n confirmed?\n end",
"def is_done?\n return self.status == Erp::Reservations::Reservation::STATUS_DONE\n end",
"def confirmation_required?\n #totally understand the line below is not needed and it might work if this functinoi was just removed\n self.confirmed_at.blank?\n end",
"def confirmation_required?\n !confirmed?\n end",
"def verify\n update(confirmed_at: Time.current)\n end",
"def confirm_from_email\n bookable_asset = BookableAsset.find_by_euid(params[:euid])\n booking_request = bookable_asset.booking_requests.find(params[:booking_request_id])\n redirect_path = current_user ? user_path(current_user) : login_path\n\n if bookable_asset.confirmed?\n flash[:warn] = \"You've already accepted this booking_request\"\n return redirect_to redirect_path\n end\n booking_request.accept!\n\n flash[:notice] = \"You've accepted this booking_request.\"\n redirect_to redirect_path\n end",
"def is_pending?\n return self.status == Erp::Reservations::Reservation::STATUS_PENDING\n end",
"def confirm_reservation\n reservation = available_rooms[0]\n \n if !reservation\n raise BlockFullError.new(\"There are no more available rooms from that block.\")\n end\n \n reservation.confirm_reservation\n return reservation\n end",
"def is_canceled?\n return self.status == Erp::Reservations::Reservation::STATUS_CANCELED\n end",
"def confirmed?\n live?\n end",
"def confirmation_required?\n !confirmed?\n end",
"def confirm!\n update(confirmed_at: Time.now.utc, status: :confirmed)\n end",
"def confirm\n if status == :pending_confirmation and\n not charges.select { |charge| charge.status == :done }.empty?\n transaction do\n self.status = :confirmed\n self.save\n # Assign available stock\n assign_available_stock if SystemConfiguration::Variable.get_value('booking.assignation.automatic_resource_assignation', 'false').to_bool\n # Create newsfeed\n ::Yito::Model::Newsfeed::Newsfeed.create(category: 'booking',\n action: 'confirm_booking',\n identifier: self.id.to_s,\n description: BookingDataSystem.r18n.t.confirmed_booking)\n end\n send_booking_confirmation_notifications\n else\n p \"Could not confirm booking #{id} #{status}\"\n end\n \n self\n end",
"def payment_completed\n reservation = Reservation.find(params[:id])\n return if reservation.payment_completed?\n\n flash[:danger] = \"Can't approve this incomplete booking request.\"\n redirect_to your_reservations_path\n end",
"def reservation_confirmed user_reservations = []\n @reservations = user_reservations\n mail(to: @reservations.first.user.email, subject: \"Your Reservation(s) is Confirmed\") do |format|\n format.text\n format.mjml\n end\n end",
"def confirmed?\n memoized_info[:confirmed]\n end",
"def confirmable?\n status.to_sym.in? [:done]\n end",
"def unconfirmed?\n !confirmed?\n end",
"def request_approval\n reservation = Reservation.first\n ReservationMailer.request_approval(reservation)\n end",
"def check_schedule_confirmed\n\t\t# Picked a random 'check' user service and temporary set it's status to schedule_confirmed\n\t\tuser_service \t\t= UserService.find_by(relationship_type: 'check')\n\t\tuser_service.date \t= Time.now\n\t\tuser_service.status = 'schedule_confirmed'\n\t\tUserServicesMailer.check_updated(user_service)\n\tend",
"def check_expiration\n reservation = Reservation.find(params[:id])\n return unless reservation.booking_request_expired?\n\n flash[:danger] = 'Booking request has expired.'\n redirect_to your_reservations_path\n end",
"def reservation_notifier(reservation)\n @reservation = reservation\n mail( :to => @reservation.email,\n :subject => 'Your reservation has been confirmed. We can\\'t wait to dine with you!' )\n end",
"def confirm_booking(time)\n if @time[time].nil?\n false\n else\n @time[time].click\n @browser.element(css: '#btnConfirm').click\n @browser.element(css: 'body > div.MessageBoxWindow > div.MessageBoxButtons.NoBorder > input:nth-child(1)').click\n @browser.element(css: 'input.MessageBoxButton:nth-child(1)').click\n true\n end\n end",
"def better_to_confirm\n ! (self.confirmed && (((Time.zone.now - self.confirmed).to_i / 86400) < 365))\n end",
"def confirm_event\n @event.update(confirmed: true)\n end",
"def confirm_event(event)\n participant_event = get_participant_event(event)\n return false if participant_event.nil? or not events_in_period(event.start, event.finish).empty?\n\n relation_user_route(event)\n participant_event.confirmed = true\n participant_event.save\n end",
"def confirm!\n if status == :pending_confirmation\n transaction do\n update(:status => :confirmed)\n # Assign available stock\n assign_available_stock if SystemConfiguration::Variable.get_value('booking.assignation.automatic_resource_assignation', 'false').to_bool\n # Create newsfeed\n ::Yito::Model::Newsfeed::Newsfeed.create(category: 'booking',\n action: 'confirm_booking',\n identifier: self.id.to_s,\n description: BookingDataSystem.r18n.t.confirmed_booking)\n end\n send_booking_confirmation_notifications\n end\n self\n end",
"def is_reservation?\n self.kind == \"Reservation\"\n end",
"def recently_confirmed?\n @recent_confirmation\n end",
"def confirm!\n update!(confirmed_at: DateTime.now)\n end",
"def has_reservation?(name)\n found_reservation = find_reservation_by_name(name)\n return false if found_reservation == nil\n return true\n end",
"def confirm\n @trip = Trip.find_by(confirmation_token: params[:id])\n if @trip\n if @trip.confirm!\n # do nothing, render confirm page\n else\n render :not_found # let's give no information on this error to the internet\n end\n else\n render :not_found # let's give no information on this error to the internet\n end\n end",
"def existing_reservations?\n !existing_reservations.empty?\n end",
"def recently_confirmed?\n @recently_confirmed\n end",
"def confirm\n @trip = Trip.find_by(confirmation_token: params[:token])\n if @trip\n if @trip.confirm!\n redirect_to @trip, notice: 'Votre annonce est publiée! Merci pour votre contribution à la communauté!'\n else\n render :not_found # let's give no information on this error to the internet\n end\n else\n render :not_found # let's give no information on this error to the internet\n end\n end",
"def accept_or_reject\n incoming = Santize.clean(params[:From]).gsub(/^\\+\\d/, '')\n sms_input = params[:Body].downcase\n begin\n @host = User.find_by(phone_number: incoming)\n @reservation = @host.pending_reservation\n\n if sms_input == \"accept\" || sms_input == \"yes\"\n @reservation.confirm!\n else\n @reservation.reject!\n end\n\n @host.check_for_reservations_pending\n\n sms_response = \"You have successfully #{@reservation.status} the reservation.\"\n respond(sms_response)\n rescue\n sms_response = \"Sorry, it looks like you don't have any reservations to respond to\"\n respond(sms_response)\n end\n end",
"def revokable?\n\t\tstatus == \"pending\" && created_at >= Donation.revoke_time.ago\n\tend",
"def confirmed?\n flash[:alert] = 'Check your email to confirm yourself.(You are not allowed to create posts)' unless current_user&.email_confirmed?\n end",
"def reservation_confirmation(res_id, total_price)\n @total_price = total_price\n @reservation = Reservation.find(res_id)\n # @reservation[:check_in_date] = unsanitize_date @reservation[:check_in_date].to_s\n # @reservation[:check_out_date] = unsanitize_date @reservation[:check_out_date].to_s\n @kennel = Kennel.find(@reservation[:kennel_id])\n @hours_of_operation = HoursOfOperation.where(kennel_id: @kennel[:id]).first\n mail(to: @reservation[:customer_email], subject: 'PawBookings Reservation Receipt', bcc: [\"pawbookings@gmail.com\"])\n end",
"def destroy\n @event = @reservation.event\n @reservation.update_attribute(:status, \"Cancelled\")\n \n begin\n if !@event.available_seats && @event.reservations.where(status: \"Waiting_List\").any?\n ReservationsMailer.send_waiting_list(@event).deliver\n end\n rescue => e\n logger.info(e)\n end\n\n @event.save\n flash[:notice] = \"Your reservation has been cancelled.\"\n redirect_to event_path @event\n end",
"def check_expiration\n return unless @reservation.booking_request_expired?\n\n flash[:danger] = 'Booking request has expired.'\n redirect_to your_reservations_path\n end",
"def active?\n super && (!confirmation_required? || confirmed? || confirmation_period_valid?)\n end",
"def confirm_invitation\n @teammate = Teammate.find(params[:teammate_id])\n return redirect_to forbidden_path unless @teammate.user_id == @current_user.id\n\n if params[:confirm] == 'accept'\n verified = @teammate.verify\n verified ? msg = 'Bem-vindo ao Time de Tripulantes!' : msg = 'Oops! Ocorreu um erro, tente novamente. Caso o erro persista peça para ser adicionado novamente ao time.'\n return redirect_to pitch_teammate_path(@pitch, @teammate), flash: { notice: msg }\n elsif params[:confirm] == 'decline'\n @teammate.destroy\n msg = \"Convite do time #{@teammate.pitch.name} Rejeitado com Sucesso.\"\n return redirect_to root_path, flash: { notice: msg }\n end\n end",
"def any_requested_booking_not_confirmed?\n count = 0\n index\n @requested_bookings.each do |booking|\n count += 1 if !booking.confirmed\n end\n true if count.positive?\n end",
"def confirmation_period_valid?; end",
"def confirmed!\n @_confirmed = false\n self.confirmed = true\n save\n end",
"def manual_partner_confirmed?\n visit customer_orders_path\n expect(page).to have_content('创建于')\n end",
"def can_be_unconfirmed? \n # the reverse adjustment will always increase ready item \n \n return true \n end",
"def available_for?(reservation)\n return false if staff_only? && !reservation.staff? # TODO handle staff reservations properly\n return false unless ready_for_checkout?\n return false if reservation.start_date.blank? || reservation.end_date.blank?\n if reservation.staff?\n reservation_start_date_with_buffer = reservation.start_date + 1.second\n reservation_end_date = reservation.end_date - 1.second\n else\n reservation_start_date_with_buffer = reservation.start_date - 1.day - (category.buffer_days_between_checkouts.to_i * 1.day)\n reservation_end_date = reservation.end_date\n end\n conditions = [['(start_date <= :start_date AND end_date >= :end_date)'],\n ['(start_date <= :end_date AND end_date >= :end_date)'],\n ['(start_date <= :start_date AND end_date >= :end_date)'],\n ['(start_date >= :start_date AND end_date <= :end_date)'],\n ['(start_date >= :start_date AND start_date <= :end_date)'],\n \t\t['(end_date >= :start_date AND end_date <= :end_date)']]\n reservations.find(:all, :conditions => [\"submitted = true\n AND equipment_reservation_id != #{reservation.id} \n AND (#{conditions.join(\" OR \")})\", \n { :start_date => reservation_start_date_with_buffer, :end_date => reservation_end_date }]).empty?\n end",
"def confirm(args={})\n pending_any_confirmation do\n if confirmation_period_expired?\n self.errors.add(:phone, :confirmation_period_expired,\n period: Devise::TimeInflector.time_ago_in_words(self.class.activate_within.ago))\n return false\n end\n\n self.confirmed_at = Time.now.utc\n\n saved = if self.class.reactivatable && unconfirmed_phone.present?\n skip_reactivation!\n self.phone = unconfirmed_phone\n self.unconfirmed_phone = nil\n\n # We need to validate in such cases to enforce e-mail uniqueness\n save(validate: true)\n else\n save(validate: args[:ensure_valid] == true)\n end\n\n after_confirmation if saved\n saved\n end\n end",
"def buyer_confirmed\n end",
"def booking_confirmed\n NotificationMailer.booking_confirmed\n end",
"def confirmation(booking)\n @booking = booking\n mail(to: booking.user.email, subject: \"You have been confirmed!\")\n end",
"def assign_confirmed_if_valid!\n return unless pending?\n\n assign_attributes(status: :confirmed)\n return true if valid?\n\n self.errors.clear\n assign_attributes(status: :pending)\n false\n end",
"def confirmed?\n request.cookies[cookie_name] && area.valid_code?(request.cookies[cookie_name])\n end",
"def confirmation_period_valid?\n self.class.allow_inactivated_access_for.nil? || (confirmation_sent_at && confirmation_sent_at.utc >= self.class.allow_inactivated_access_for.ago)\n end",
"def sell_confirmed\n end",
"def not_in_past?\n #return true if self.class == Reservation && self.status != 'reserved'\n if (start_date < Date.today) || (due_date < Date.today)\n errors.add(:base, \"Reservation cannot be made in the past.\\n\")\n return false\n end\n return true\n end",
"def approved?\n !self.pending\n end",
"def approve\n @reservation.is_approved = true\n @reservation.status = :approved\n @reservation.admin_response_time = Time.now\n respond_to do |format|\n if @reservation.save\n notify_approved\n format.html { redirect_to @reservation, flash: { success: 'Reservation has been approved' } }\n format.json { render :show, status: :ok, location: @reservation }\n else\n respond_to_errors :show, format\n end\n end\n end",
"def confirm!\n self.confirmation_token = nil\n self.confirmed_at = Time.now.utc\n save(:validate => false)\n end",
"def confirm\n @doctor = Doctor.find_by_confirmation_token(params[:confirmation_token])\n \n if @doctor.present?\n @doctor.update_attributes(confirmed_at: DateTime.now)\n render json: {message: \"Your account has been confirmed at #{@doctor.confirmed_at}.You can Sign in Now!\"}\n else \n render json: {alert: \"Confirmation Link has Expired.\"}\n end\n\n end",
"def confirmed?\n self.contributions.each do |contribution|\n return false if contribution.isPending?\n end\n return true\n end",
"def confirmation_required?\n !confirmed? && !@skip_confirmation_notification\n end",
"def book_request_decline_confirm\n booking_staff = BookingStaff.find_by_confirm_token(params[:id])\n\n if booking_staff\n staff_id = booking_staff.id\n declined_status = STATUS_DECLINED\n\n if self.book_request_response(staff_id, declined_status)\n booking_staff.send_email_booking_declined\n booking_staff.update(:confirm_token => nil)\n render 'request_decline_confirm'\n return\n end\n end\n\n # NOTE - IF FOR WHATEVER REASON GETTING THE BookingStaff MODEL FAILS\n # WE SHOULD TELL THE USER TO TRY AGAIN ?\n end",
"def confirmed_for_authentication?\n !confirmation_required? || confirmed? || confirmation_period_valid?\n end",
"def authorize_customer\n unless @reservation.customer == current_customer\n redirect_to reservations_url, notice: 'No touchy!'\n # edit this?\n end\n end",
"def has_confirmed_order?\n confirmed_order = false\n open_orders.each do |o|\n if o.confirmed\n confirmed_order = true\n break\n end\n end\n confirmed_order\n end",
"def confirm\n\n end",
"def is_confirmable?\n true\n end",
"def organization_membership_confirmed?\n system_confirmed? || manually_confirmed?\n end",
"def check_receipt_state\n\t\tunless account_movement.nil? || account_movement.receipt.nil?\n\t\t\terrors.add(\"Recibo confirmado\", \"Los pagos de un recibo confirmado no pueden ser modificados.\") unless account_movement.receipt.editable?\n\t\tend\n\tend",
"def activated?\n activation_token && activation_token.confirmed?\n end"
] |
[
"0.8291122",
"0.73338926",
"0.71549207",
"0.71349776",
"0.71134984",
"0.7082503",
"0.7082503",
"0.7059964",
"0.7027459",
"0.6999295",
"0.69947946",
"0.6984182",
"0.6947228",
"0.6938345",
"0.6937434",
"0.69253707",
"0.68681365",
"0.68465877",
"0.6824019",
"0.67967594",
"0.6773478",
"0.67453516",
"0.671875",
"0.67096025",
"0.66796905",
"0.66716975",
"0.6668748",
"0.662953",
"0.6626807",
"0.65882486",
"0.6574434",
"0.65671057",
"0.6540147",
"0.6510965",
"0.6501473",
"0.6500536",
"0.6498433",
"0.6453013",
"0.6447046",
"0.64459234",
"0.6435401",
"0.64240706",
"0.64123994",
"0.6378564",
"0.6377308",
"0.63664395",
"0.63580275",
"0.63510525",
"0.63503337",
"0.63470554",
"0.6338816",
"0.6327321",
"0.6300731",
"0.62727904",
"0.6272695",
"0.62704533",
"0.62618405",
"0.6251238",
"0.6249749",
"0.6236638",
"0.6220688",
"0.6213958",
"0.6210402",
"0.6205598",
"0.61988586",
"0.61907524",
"0.618748",
"0.61782455",
"0.6176849",
"0.61708874",
"0.61685103",
"0.6161975",
"0.615352",
"0.61428803",
"0.61385465",
"0.6122392",
"0.61192185",
"0.611726",
"0.6108304",
"0.6105195",
"0.61045796",
"0.6104183",
"0.61041033",
"0.6103514",
"0.60968983",
"0.60960096",
"0.6090595",
"0.60898554",
"0.6086794",
"0.6086052",
"0.6084172",
"0.6058684",
"0.6055052",
"0.60461855",
"0.6041962",
"0.6041458",
"0.60409814",
"0.6037952",
"0.6037425",
"0.602677"
] |
0.6851745
|
17
|
Get the category of the reserved items
|
def category
booking_lines and booking_lines.size > 0 ? ::Yito::Model::Booking::BookingCategory.get(booking_lines[0].item_id) : nil
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def category_string\n return Item::ITEM_CATEGORIES[self.category_id] if self.category_id\n return \"\"\n end",
"def categories_for(item)\n return [] unless @items[item]\n\n @items[item].categories\n end",
"def category()\n if (order_in_lines.length == 1)\n cat = order_in_lines[0].book_keeping_category\n if (cat)\n return cat.name\n else\n return \"?\"\n end\n else\n return \"?\"\n end\n end",
"def category\n self.item.category\n end",
"def categories_items\n all_items = self.all_active_items\n categories_given_items(all_items)\n end",
"def categories\n category\n end",
"def category_with_name(name)\n categorized_items = categories_items\n categorized_items.detect{ |sub_item_array| sub_item_array[0].name == name }\n end",
"def items_with_category(category, items=nil)\n items = @items if items.nil?\n items.select { |item| has_category?( item, category ) }\n end",
"def categories_items_without(user)\n all_items = self.all_active_items\n categories_given_without(all_items,user)\n end",
"def local_category\n CATEGORY_KEYS[product_category] || ['n/a']\n end",
"def category\n # {{{\n if !@category then\n @category = Category.find(1).with(:is_private.is('t') & \n :category_id.in(User_Category.select(User_Category.category_id) { |cid| \n cid.where(User_Category.user_group_id == user_group_id)\n })).entity\n @category = Category.unassigned_category unless @category\n end\n @category\n end",
"def category\n @data['category']\n end",
"def category\n client.categories.find(data[\"categoryId\"])\n end",
"def category\n # only returns first category currently\n if self.categories.empty?\n 1\n else\n self.categories[0] unless self.categories.empty?\n end\n end",
"def category\n category_id = self.category_id;\n\n if (category_id)\n puts(\"Category ID found in time_record: \" + category_id.to_s);\n\n category = Category.find_by_id(category_id);\n\n if (category)\n puts(\"Category OBJECT found in quota: category: \" + category.name);\n return category\n else\n puts(\"Category OBJECT NOT found in quota: category_id: \" + category_id.to_s);\n return nil\n end\n\n else\n return nil\n end\n end",
"def set_item_category\n @item_category = current_company.item_categories.friendly.find(params[:id]) || []\n end",
"def category\n @ole.Category\n end",
"def get_category\n json_response({ message: 'NOT IMPLEMENTED' })\n end",
"def special_category\n @special_category ||= if character and character.group\n group_special = character.group.special\n if group_special.blank?\n nil\n else\n Category.specials(group_special)\n end\n elsif links_character\n Category.special_role(:links)\n elsif rps_character\n Category.special_role(:rps)\n end\n end",
"def category\n return @category\n end",
"def category\n return @category\n end",
"def category\n return @category\n end",
"def category\n return @category\n end",
"def category\n return @category\n end",
"def category\n return @category\n end",
"def _category\n @_category ||= if category\n category\n elsif special_category\n special_category\n else\n nil\n end\n end",
"def items_with_category(category)\n warn \"[DEPRECATION] \"+caller[0]+\"`items_with_category` is deprecated. Please use `items_with` instead.\"\n @items.select { |i| (i[:category] == category) }\n end",
"def category(jid,node)\n info = get_info(jid,node)\n return info['category']\n end",
"def categories\n []\n end",
"def budget_categories_data\n # @budget.budget_items.collect { |budget_item| budget_item.category.name.to_s }.to_json\n categories = Category.for_budget.to_a\n categories << Category.find_by_name(\"Miscellaneous\")\n return categories.collect { |category| category.name.to_s }.to_json\n end",
"def category\n data['category']\n end",
"def categories\n rpg_shop.handled_categories\n end",
"def category\n case self.scorable_type\n when \"GovernmentScore\"\n return \"Government\"\n when \"ParkScore\"\n return \"Parks\"\n when \"SchoolScore\"\n return \"Schools\"\n when \"PoliceScore\"\n return \"Police\"\n when \"PublicScore\"\n return \"Public Works\"\n end\n end",
"def category\n @category ||= ''\n end",
"def get_custom_gradebook_items(course_id, custom_category_id)\r\n get(Path::COURSES_GRADEBOOK_CUSTOMCATEGORIES_CUSTOMITEMS % [course_id, custom_category_id])\r\n end",
"def client_category\n begin\n @client_category = self.sugar_accounts_cstm.client_category_c\n rescue\n @client_category = nil\n end\n end",
"def user_available_categories\n Category.select('name').\n where(\"user_id = ?\", current_user.id).\n pluck(:name)\n end",
"def getCategoryId\r\n\t\t\t\t\treturn @categoryId\r\n\t\t\t\tend",
"def rarety\n return @item_rarety\n end",
"def category15\n return @category15\n end",
"def category23\n return @category23\n end",
"def category18\n return @category18\n end",
"def adv_categories\n return ['AIR', 'BIKING', 'CULTURAL', 'CAMPING', 'MOTOR', 'CLIMBING', 'HIKING', 'SNOW', 'WATER', 'OTHER']\n end",
"def get_category(category)\n CATEGORIES[category.downcase]\n end",
"def category22\n return @category22\n end",
"def category20\n return @category20\n end",
"def set_reserved_category\n @reserved_category = ReservedCategory.find(params[:id])\n end",
"def category_selection(category)\n category = Public_apis.find_by_name(category)\n #goes over list item array . find method to find item\n\n \n end",
"def category_name\n object.category.name rescue \"\"\n end",
"def category; end",
"def category11\n return @category11\n end",
"def category\n @category ||=\n if category_param\n current_course.assessment_categories.find(category_param)\n else\n current_course.assessment_categories.first!\n end\n end",
"def category_in_icon_name\n case category\n when 0\n \"icon_clean\"\n when 1\n \"icon_nanny\"\n when 2\n \"icon_time\"\n when 3\n \"icon_fix\"\n else\n \"icon_clean\"\n end\n end",
"def category25\n return @category25\n end",
"def categories\n category_keys.collect(&:to_s)\n end",
"def categories_given_items(items)\n\n categorized_items = Array.new\n\n items.each{ |item|\n sub_array = categorized_items.detect{ |sub_item_array| sub_item_array[0].name == item.name }\n if sub_array != nil\n sub_array.push(item)\n else\n new_sub_array = Array.new\n new_sub_array.push(item)\n categorized_items.push(new_sub_array)\n end\n }\n categorized_items\n end",
"def category_name\n category.name if category\n end",
"def get_categories\n @redis.smembers category_collection_key\n end",
"def category\n adventure.category\n end",
"def ticket_category\n ticket.category if ticket\n end",
"def get_categories_except(except = nil)\n warn \"[DEPRECATION] \"+caller[0]+\"`get_categories_except` is deprecated. Please use `get_categories` instead.\"\n items = @items if items.nil?\n if except == nil\n items.map{|item| item[:category]}.compact.uniq.sort\n elsif\n items = items.map{|item| item[:category]}.compact.uniq.sort\n items.delete(except)\n return items\n end\n end",
"def category()\n sql = \"SELECT * FROM categories WHERE id = $1 ORDER BY name;\"\n values = [@category_id]\n sql_result = SqlRunner.run(sql, values)\n return Category.new(sql_result[0])\n end",
"def category21\n return @category21\n end",
"def category12\n return @category12\n end",
"def getCategories(_, _, _)\n @db.categories\n end",
"def subcontract_category; end",
"def categories_for(race)\n case race.name\n when \"Junior Men\", \"Junior Women\"\n [ Category.find_or_create_by(name: race.name) ]\n else\n super race\n end\n end",
"def category19\n return @category19\n end",
"def accessory_category_identifier\n @configuration.category_identifier\n end",
"def categories\n categories = []\n @deck.cards.map do |turn|\n categories << turn.category\n end\n categories.uniq!\n end",
"def category\n if self.channel.generator == 'Twitter'\n return self.categories.join(', ')\n end\n return '' if @item.categories.empty? \n @item.categories.collect{|c| c.content}.join(', ')\n end",
"def category_name\n category.try(:name)\n end",
"def awarded_categories\n awards.map do |award|\n award.meal.category\n end\n end",
"def category\n Asset.find_by(slug: slug)\n end",
"def category_1\n cat = item_hash.deep_find([:primary_category, :category_id])\n cat.nil? ? nil : cat.to_i\n end",
"def category_object\n task = Todo.find_by_id(self.todo_id)\n category = Categories.find_by_id(task.category_id)\n return category\n end",
"def category\n @services = Service.where(\"category = ?\", params[:category])\n @category = Service.categories.key(params[:category].to_i)\n end",
"def get_category_notice\n notice = \"\"\n if self.category == \"1\"\n notice = \"CATEGORY 1\"\n elsif self.category == \"2\"\n notice = \"CATEGORY 2\"\n elsif self.category == \"3\"\n notice = \"CATEGORY 3\"\n elsif self.category == \"4\"\n notice = \"CATEGORY 4\"\n elsif self.category == \"5\"\n notice = \"CATEGORY 5\"\n end\n\n return notice\n end",
"def get_categories\n @cards.each do |card|\n if !@categories.include?(card.category)\n @categories << card.category\n end\n end\n @categories\n end",
"def category24\n return @category24\n end",
"def ffck_categories_detailed()\n ['Pitchoun', 'Poussin 1', 'Poussin 2', 'Benjamin 1', 'Benjamin 2', 'Minime 1', 'Minime 2', 'Cadet 1', 'Cadet 2',\n 'Junior 1', 'Junior 2', 'Senior', 'Veteran 1', 'Veteran 2', 'Veteran 3', 'Veteran +', 'Inconnu']\n end",
"def get_category_newsgroup(category)\n case category\n when \"sell\"\n \"tori.myydaan\"\n when \"buy\"\n \"tori.ostetaan\"\n when \"give\"\n \"tori.myydaan\"\n when \"lost\"\n \"tori.kadonnut\"\n when \"rides\"\n \"tori.kyydit\"\n else\n nil \n end \n end",
"def category\n segments[0]\n end",
"def category_type\n object.category.main_cat\n end",
"def category(name)\n @categories.find { |c| c.name == name}\n end",
"def category_name\n category.name\n end",
"def category10\n return @category10\n end",
"def get_categories_in_cursor(cursor)\n categories = Set.new\n\n cursor.each { |item|\n if item['categories'].respond_to? 'each'\n categories |= item['categories']\n else\n categories.add item['categories']\n end\n }\n\n cursor.rewind!\n\n categories.subtract [nil, '']\n\n categories\n end",
"def category_info\n {\n categories: self.object.appointments.map{ |appt| \n appt.category\n }\n \n }\n end",
"def categories\n data['JobCategory'] || []\n end",
"def _item_price_in_category(which_category, capacity)\n item_prices_in_category = self.upgrade_options.select { |item_price| item_price[\"categories\"].find { |category| category[\"categoryCode\"] == which_category } }\n item_prices_in_category.find { |ram_item| ram_item[\"item\"][\"capacity\"].to_i == capacity}\n end",
"def index\n @available_categories = AvailableCategory.all\n end",
"def type\n self.category\n end",
"def product_category\n product_categories.first\n rescue\n nil\n end",
"def category\n return '' if self.categories.empty?\n self.categories.join(', ')\n end",
"def category_names\n categories.map {|category| CategoryCode[category]}\n end",
"def get_custom_gradebook_categories(course_id)\r\n relative_url = Path::COURSES_GRADEBOOK_CUSTOMCATEGORIES % [course_id]\r\n get(relative_url)\r\n end",
"def categories\n raw_categories.to_hashugar\n end",
"def category_options(reimbursement)\n {}\n end",
"def get_category(code)\n response = execute_get(\"/reference/category/\" + code)\n Category.from_hash(decode(response)[0])\n end"
] |
[
"0.6429407",
"0.6404427",
"0.6327857",
"0.62652206",
"0.6214743",
"0.60485834",
"0.6032046",
"0.59918",
"0.5979594",
"0.5950983",
"0.59153354",
"0.5911013",
"0.59006417",
"0.58686054",
"0.58564585",
"0.58378357",
"0.58368444",
"0.58351094",
"0.5823416",
"0.5814765",
"0.5814765",
"0.5814765",
"0.5814765",
"0.5814765",
"0.5814765",
"0.5809048",
"0.5799158",
"0.57976246",
"0.57858485",
"0.57848984",
"0.57823735",
"0.57699126",
"0.5758251",
"0.57438946",
"0.5738945",
"0.5719667",
"0.5705425",
"0.57012016",
"0.5687119",
"0.56842875",
"0.56842375",
"0.5682626",
"0.56416696",
"0.56366104",
"0.56331843",
"0.56317955",
"0.5623269",
"0.5622691",
"0.56000876",
"0.5591446",
"0.55773896",
"0.55758476",
"0.55552095",
"0.5553066",
"0.55526376",
"0.55483204",
"0.554798",
"0.554704",
"0.55465984",
"0.55423385",
"0.55336004",
"0.5528212",
"0.5510649",
"0.5495602",
"0.5484916",
"0.54804504",
"0.5470271",
"0.5465917",
"0.5464555",
"0.54623556",
"0.54504085",
"0.5446051",
"0.54437673",
"0.544228",
"0.5441732",
"0.54356885",
"0.5435525",
"0.5434679",
"0.5432766",
"0.54290897",
"0.5419731",
"0.54151225",
"0.5414749",
"0.5413274",
"0.54087174",
"0.54070634",
"0.5399894",
"0.53950834",
"0.5393437",
"0.5392464",
"0.5387885",
"0.5381424",
"0.5377932",
"0.53756964",
"0.5369907",
"0.5363998",
"0.5353897",
"0.5351255",
"0.5342275",
"0.5336545"
] |
0.6604788
|
0
|
Check if the reservation has expired
|
def expired?
conf_item_hold_time = SystemConfiguration::Variable.get_value('booking.item_hold_time', '0').to_i
hold_time_diff_in_hours = ((DateTime.now.to_time - self.creation_date.to_time).to_f * 24).to_i
expired = (hold_time_diff_in_hours > conf_item_hold_time)
expired && !force_allow_payment
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def check_expiration\n reservation = Reservation.find(params[:id])\n return unless reservation.booking_request_expired?\n\n flash[:danger] = 'Booking request has expired.'\n redirect_to your_reservations_path\n end",
"def check_expiration\n return unless @reservation.booking_request_expired?\n\n flash[:danger] = 'Booking request has expired.'\n redirect_to your_reservations_path\n end",
"def expired?\n Time.now > valid_until\n end",
"def booking_request_expired?\n created_at < 48.hours.ago\n end",
"def expired?\n not valid?\n end",
"def expired?\n expiration_date <= Time.now\n end",
"def expired?\n end",
"def expired?\n created_at < 14.days.ago && updated_at < 14.days.ago\n end",
"def expired?\n\n end",
"def expired?\n !expiration_date || expiration_date <= Date.today\n end",
"def expired?\n Time.now > vendors_expiration\n end",
"def expired?\n false\n end",
"def expired?\n Time.now > self.deadline\n end",
"def is_expired?\n self.end_date < DateTime.now\n end",
"def expired?\r\n return Time.now > self.created_on + @@validity_time\r\n end",
"def expired?\n Time.now > expiration if expiration\n end",
"def expired?; end",
"def expired?\n @expiry_time < Time.now\n end",
"def expired?\n expires_at && expires_at <= Time.now\n end",
"def not_in_past?\n #return true if self.class == Reservation && self.status != 'reserved'\n if (start_date < Date.today) || (due_date < Date.today)\n errors.add(:base, \"Reservation cannot be made in the past.\\n\")\n return false\n end\n return true\n end",
"def expired?\n overdue_days > 0\n end",
"def expired?\n self.expires_at && Time.now > self.expires_at\n end",
"def expired?\n Time.now > self.to_be_expired_at\n end",
"def schedule_expired\n return @schedule.end_date && @date > @schedule.end_date\n end",
"def expired?\n return if missing?\n\n validity < (reference_time - time)\n end",
"def expired?\n self.expires_at && Time.now.utc > self.expires_at\n end",
"def expired?\n exp < Time.now.to_i\n end",
"def expired?\n Time.current >= expires_at\n end",
"def expired?\n @expired\n end",
"def expired?\n remaining.zero?\n end",
"def expired?\n Date.today > self.expires_on\n end",
"def is_expired?\n (!end_time.nil? and end_time < Clock.time)\n end",
"def reservation_available\n if timeslot_contains_reservations?\n errors.add(:base, I18n.t('reservation.reservation_available'))\n end\n end",
"def expired?\n Time.now > @expiration if @expiration\n end",
"def expired?\n expires_at && Time.now > expires_at\n end",
"def expired?\n @expires_in && @created_at + @expires_in <= Time.now.to_f\n end",
"def expired?\n !converted_to_recipient? && months_remaining == 0\n end",
"def not_expired?\n self.expires_at && Time.now <= self.expires_at\n end",
"def expired?\n return self.expires_on < Date.today if self.expires_on\n true\n end",
"def expired?\n Time.zone.today > expires_at\n end",
"def expired?\n self.expiration.past? || self[:expired]\n end",
"def expired?\n self.expired = false unless self.deadline > DateTime.now\n end",
"def expired?\n @expires_at <= Time.now\n end",
"def expired?\n expires && expires < Time.now\n end",
"def is_expired?\n\t\tself.event_date < DateTime.now\n\tend",
"def expired?\n !respond_to?(:expires_at) || expires_at < Time.current\n end",
"def expired?\n !self.active?\n end",
"def expired?(now)\n @expires_at <= now\n end",
"def expired?(expiration_date)\n Date.today.beginning_of_day >= expiration_date.beginning_of_day\n end",
"def is_expired\n if self.status == \"none\" || self.status == \"pending\"\n return false\n else\n return true\n end\n end",
"def expired?\n Time.now > @expires\n end",
"def expired?\n age > ttl\n end",
"def expired?\n age > ttl\n end",
"def expired?\n self.expires_on? and self.expires_on < Time.now\n end",
"def expired?\n DateTime.now > @expires\n end",
"def expired?\n DateTime.now.utc >= self.expires_at\n end",
"def is_available\n return unless start_time.present? && end_time.present?\n\n reservation_hours = (end_time - start_time) / 1.hour\n day = start_time.wday\n st = start_time\n et = reservation_hours > 24 ? end_time.end_of_day : end_time\n while reservation_hours > 0 do\n unless available_at(st, et, day)\n errors.add(:start_time, I18n.t('activerecord.errors.models.reservation.attributes.date.available_hours'))\n return\n end\n if overnight?\n st = start_time.beginning_of_day\n end\n et = reservation_hours > 24 ? end_time.end_of_day : end_time\n day = (day + 1) % 7\n reservation_hours -= 24\n end\n end",
"def has_expired?(date)\n # The event will expires 2 hours after is date\n Time.parse(date).to_f < Time.now.to_f - 2.hours.to_i\n rescue TypeError\n true\n end",
"def time_expired?\n (Time.now - @duration) > @start_time\n end",
"def expired?\n Time.now.in_time_zone > expires_at\n end",
"def expired?\n return @expired\n end",
"def expired?(timeout)\n !@time_started.nil? && @time_completed.nil? && ((Time.now - @time_started) > timeout)\n end",
"def expired?\n expires_at.to_time <= Time.now.utc\n end",
"def expired?\n expires_at.to_time <= Time.now.utc\n end",
"def expired?\n Time.now - @created_time > @ttl\n end",
"def expired?\n can_expire? && @expiry < Time.now.to_i\n end",
"def expired?\n pledging_ends_on.past?\n end",
"def expired?\n return false unless expires_at\n expires_at < Time.now\n end",
"def expired?\n if (self.last_retrieved == nil)\n return true\n elsif (self.time_to_live < 30.minutes)\n return (self.last_retrieved + 30.minutes) < Time.now.gmtime\n else\n return (self.last_retrieved + self.time_to_live) < Time.now.gmtime\n end\n end",
"def expired?(range: :now)\n return false unless persisted?\n return false if cancelled? || archived? || complete?\n case range\n when :all\n !!(start_date <= Time.now && end_date <= Time.now)\n else\n !!(start_date <= Time.now)\n end\n end",
"def expired?\n can_expire? && (self.expires_in + self.time_created) < Time.now.to_i\n end",
"def has_expired?\n self.expires_at ? self.expires_at < Time.now.utc : false\n end",
"def has_expired?\n self.expires_at ? self.expires_at < Time.now.utc : false\n end",
"def expired?\n !expires_at.nil? && Time.now >= expires_at\n end",
"def check_expired \n\t\t@current_epoch_time = DateTime.now.strftime('%s').to_i\n\t\texpired_required_trips = []\n\t\texpired_listed_trips = []\n\n\t\t# Find the expired trips and add them to the expired arrays\n\t\tcurrent_user.trips_requested.each do |trip_index|\n\t\t\t@trip = Trip.find_by(_id: trip_index) \n\t\t\tif @trip.date < @current_epoch_time\n\t\t\t\texpired_required_trips << trip_index\n\t\t\tend\n\t\tend\n\t\tcurrent_user.trips_driving.each do |trip_index|\n\t\t\t@trip = Trip.find_by(_id: trip_index)\n\t\t\tif @trip.date < @current_epoch_time\n\t\t\t\texpired_listed_trips << trip_index\n\t\t\tend\n\t\tend\n\n\t\tcurrent_user.trips_requested = current_user.trips_requested - expired_required_trips\n\t\tcurrent_user.trips_driving = current_user.trips_driving - expired_listed_trips\n\n\t\tcurrent_user.past_trips_requested = current_user.past_trips_driven + expired_required_trips\n\t\tcurrent_user.past_trips_driven = current_user.past_trips_driven + expired_listed_trips\n\n\t\tcurrent_user.save!\n\n\t\trender json: {\n\t\t\tstatus: 'success',\n\t\t\tuser: current_user\n\t\t}\n\n\tend",
"def expired?\n lifetime_in_days = time_in_seconds(@lifetime)\n @born + lifetime_in_days < DateTime.now\n end",
"def expired?\n expires? && (expires_at < Time.now.to_i)\n end",
"def expired?\n if expires?\n Time.now >= expires_at\n else\n false\n end\n end",
"def check_if_plan_has_expired(expiry_date,plan_code)\n return \"ok\" if (Time.now < expiry_date - 5.days && plan_code == \"trial\") || (plan_code != \"trial\") #check if expiry time left to expire is more than 5 days\n return \"stop\" if Time.now > expiry_date #check if expiry time has passed\n return \"warning\"\n end",
"def is_valid?\n \tDateTime.now < self.expires_at\n end",
"def valid_reservation_time?(reservation_time)\n reservation_h = reservation_time.strftime(\"%H\").to_i\n start_h = start_time.strftime(\"%H\").to_i\n end_h = end_time.strftime(\"%H\").to_i\n if start_h < reservation_h && reservation_h < end_h\n return true\n else\n return false\n end\n end",
"def expired?\n if user.where(:username => current_user).where(:expiration_time) < Time.now\n\n end\n end",
"def expired?\n expires? && (Time.now > expires_at)\n end",
"def request_expired?\n parsed_timestamp < request_expires_at\n end",
"def expired?(now)\n @value.expired?(now: now)\n end",
"def is_valid?\n DateTime.now < self.expires_at\n end",
"def expired?(key)\n rec = @hash[key]\n !rec.nil? && rec[:start] < Time.now - rec[:lifetime]\n end",
"def access_expired? (time = Time.current)\n access_expires_at && time > access_expires_at\n end",
"def expired?\n return true if expires - Time.now <= 0\n return false\n end",
"def tgt_expired?\n return true if @last_updated.nil? or @ticket_granting_ticket.nil?\n (@last_updated + 5) < Time.now.to_i # TGTs have an 8 hour life\n end",
"def good?\n unlocked? && (self.expires_on ? DateTime.current < self.expires_on : true)\n end",
"def has_not_expired?\n self.expires_at ? self.expires_at > Time.now.utc : true\n end",
"def has_not_expired?\n self.expires_at ? self.expires_at > Time.now.utc : true\n end",
"def not_renewable?\n return true unless self.class == CartReservation || self.status == \"reserved\"\n reserver.reservations.each do |res|\n if res.equipment_model == self.equipment_model && res.due_date.to_date == self.start_date.to_date && res.is_eligible_for_renew?\n errors.add(:base, res.equipment_model.name + \" should be renewed instead of re-checked out.\\n\")\n return false\n end\n end\n return true\n end",
"def expired?\n (Time.now - created_at) > 1.week\n end",
"def lock_expired?\n if unlock_strategy_enabled?(:time)\n locked_at && locked_at < self.class.unlock_in.ago\n else\n false\n end\n end",
"def refresh_expired?\n can_refresh_expire? && @refresh_expiry < Time.now.to_i\n end",
"def expired?(key, timeout)\n if (created_at = created_at(key))\n Time.now - created_at > timeout\n else\n # If the created_at data is missing assume expired\n true\n end\n end",
"def expired?\n return false if @expires_in.nil?\n @start_time + Rational(@expires_in - @refresh_timeout, 86400) < DateTime.now\n end",
"def booking_deadline_has_passed?\n Date.current > deadline\n end"
] |
[
"0.777241",
"0.75869465",
"0.751782",
"0.741412",
"0.7363432",
"0.7353949",
"0.7293808",
"0.7286341",
"0.7278613",
"0.72442675",
"0.7242252",
"0.72048765",
"0.71852326",
"0.7176915",
"0.717167",
"0.7164792",
"0.71593654",
"0.7147379",
"0.71185625",
"0.71035016",
"0.70497924",
"0.7047623",
"0.7044454",
"0.7038199",
"0.7026063",
"0.7013289",
"0.70041096",
"0.6996288",
"0.69934845",
"0.69895935",
"0.698765",
"0.6986313",
"0.69736445",
"0.6972419",
"0.6963119",
"0.6962175",
"0.69582295",
"0.69562936",
"0.69421774",
"0.6932579",
"0.692764",
"0.69224864",
"0.6917175",
"0.69167614",
"0.69138974",
"0.689899",
"0.6892235",
"0.68909633",
"0.68800247",
"0.6877788",
"0.68771386",
"0.68741566",
"0.68741566",
"0.6863091",
"0.685378",
"0.68344927",
"0.68168193",
"0.67814225",
"0.6770766",
"0.6754225",
"0.6749135",
"0.6731757",
"0.672852",
"0.672852",
"0.67213416",
"0.6721227",
"0.67168874",
"0.67122513",
"0.6695236",
"0.66944873",
"0.66859466",
"0.6684985",
"0.6684985",
"0.66817003",
"0.6676164",
"0.66655236",
"0.6662129",
"0.66607",
"0.66181797",
"0.6601166",
"0.6587959",
"0.65798587",
"0.6575466",
"0.65723056",
"0.6565212",
"0.65427756",
"0.65408325",
"0.6535121",
"0.65315896",
"0.652383",
"0.65204793",
"0.65200025",
"0.65200025",
"0.65179634",
"0.6506727",
"0.6500208",
"0.6497489",
"0.64869386",
"0.64863855",
"0.648146"
] |
0.7438555
|
3
|
Check the payment cadence is allowed
|
def payment_cadence_allowed?
begin
config_payment_cadence = SystemConfiguration::Variable.get_value('booking.payment_cadence').to_i
_date_from_str = "#{self.date_from.strftime('%Y-%m-%d')}T#{self.time_from}:00#{self.date_from.strftime("%:z")}"
_date_from = DateTime.strptime(_date_from_str,'%Y-%m-%dT%H:%M:%S%:z')
diff_in_hours = ((_date_from.to_time - self.creation_date.to_time).to_f * 24).to_i
allowed = diff_in_hours > 0 && (diff_in_hours >= config_payment_cadence)
allowed || force_allow_payment
rescue => error
p "Error #{id} #{date_from} #{time_from} #{date_to} #{time_to} #{driver_date_of_birth} #{driver_driving_license_date}"
return false
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def charge_is_allowed?\n\t\tif not customer_has_authorized_payment?\n\t\t\terrors.add :base, I18n.t('views.customer_file.new_charge.you_are_not_authorized')\n\t\t\tfalse\n\t\telsif valid? and charge_amount.present? and authorized_amount and charge_amount.to_i <= authorized_amount\n\t\t\ttrue\n\t\telse\n\t\t\terrors.add :charge_amount, I18n.t('views.customer_file.new_charge.invalid', amount: charge_amount_usd) if errors.empty?\n\t\t\tfalse\n\t\tend\n\tend",
"def can_credit?(payment)\n payment.completed? && payment.credit_allowed > 0\n end",
"def can_credit?(payment)\n payment.completed? && payment.credit_allowed > 0\n end",
"def authorizable_cc_payment?\n adyen_cc_payment? && amount != 0\n end",
"def payment_allowed?(acct_no, amount)\n if DB[:Account].where(AcctNo: acct_no).first[:Balance].to_i <\n amount.to_i.fdiv(100)\n return false\n end\n true\n end",
"def can_supply?\n payment_received? || payment_on_account?\n end",
"def can_credit?(payment)\n return false unless payment.state == 'completed'\n return false unless payment.order.payment_state == 'credit_owed'\n payment.credit_allowed > 0\n end",
"def can_pay_deposit?\n\n conf_payment_enabled = SystemConfiguration::Variable.get_value('booking.payment', 'false').to_bool\n conf_payment_deposit = (['deposit','deposit_and_total'].include?(SystemConfiguration::Variable.get_value('booking.payment_amount_setup', 'deposit')))\n\n if self.status == :pending_confirmation\n (conf_payment_enabled or force_allow_payment) and conf_payment_deposit and self.total_paid == 0 and ((!expired? and payment_cadence_allowed?) or force_allow_payment)\n elsif self.status == :confirmed # Confirmed in the back-office without payment\n (conf_payment_enabled or force_allow_payment) and conf_payment_deposit and self.total_paid == 0 and self.total_pending > 0\n else\n return false\n end\n\n end",
"def can_credit?(payment)\n return false unless payment.completed?\n return false unless payment.order.payment_state == 'credit_owed'\n payment.credit_allowed > 0\n end",
"def can_credit?(payment)\n return false unless payment.completed?\n return false unless payment.order.payment_state == 'credit_owed'\n payment.credit_allowed > 0\n end",
"def valid?\n p = build_payment\n p.valid?\n end",
"def payment_possible_for?(listing)\n listing.price && listing.price > 0 && payments_in_use?\n end",
"def cc_pay?\n plan&.direct_pay && id != 3744\n end",
"def can_pay?\n\n can_pay_deposit? or can_pay_pending? or can_pay_total?\n\n end",
"def can_pay_pending?\n conf_payment_enabled = SystemConfiguration::Variable.get_value('booking.payment', 'false').to_bool\n conf_payment_deposit = (['deposit','deposit_and_total'].include?(SystemConfiguration::Variable.get_value('booking.payment_amount_setup', 'deposit')))\n conf_payment_pending = SystemConfiguration::Variable.get_value('booking.allow_pending_payment', 'false').to_bool\n if (conf_payment_enabled or force_allow_payment) and conf_payment_deposit and conf_payment_pending and self.status != :cancelled\n self.total_paid > 0\n else\n return false\n end\n end",
"def payment_possible_for?(listing)\n listing.price && listing.price > 0 && stripe_in_use?\n end",
"def amount_is_valid_for_outstanding_balance_or_credit\n end",
"def check(payment)\n retval\n end",
"def claim_amount_required?\n @full_repayment_of_ads != 'Y'\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 \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n allowed_values = [\"CENTRALIZADO\", \"PV\"]\n if @tipo_pagamento && !allowed_values.include?(@tipo_pagamento)\n return false\n end\n \n \n \n \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 credit_card_needed?\n credit_card_required?\n end",
"def valid_with_credit_card?\n self.valid?\n errors.add(:credit_card, \"can't be blank\") if self.credit_card == \"0\" || \n self.credit_card.blank?\n\n errors.add(:cvv, \"can't be blank\") if self.cvv == \"0\" || \n self.cvv.blank?\n\n self.expiration_date = DateTime.new(self.card_year.to_i, self.card_month.to_i).end_of_month\n\n errors.add(:expiration_date, \"can't be in past\") if self.expiration_date < Time.now\n\n end",
"def can_activate?\n self.authorize_payment\n end",
"def collect_payment?\n true\n end",
"def can_submit?\n # First check the state machine to see if it is Ok to submit based on the\n # current state\n b = super()\n if b\n # Now check that the CP has funding\n b = false unless total_cost > 0\n #b = false unless funding_difference <= 0\n end\n b\n end",
"def verify!\n raise \"Payment details not active anymore\" if active == false\n end",
"def payment_success?\n @fields['decision'] == 'ACCEPT'\n end",
"def valid?\n return false if @payment_amount.nil?\n return false if @payment_amount > 99999999.99\n return false if @payment_amount < 0\n return false if @payer.nil?\n payment_format_validator = EnumAttributeValidator.new('String', ['CCD', 'CCP', 'CTX', 'PPD', 'PPP', 'TEL', 'WEB'])\n return false unless payment_format_validator.valid?(@payment_format)\n return false if !@payment_currency.nil? && @payment_currency.to_s.length > 3\n return false if !@payment_currency.nil? && @payment_currency.to_s.length < 3\n return false if @payee.nil?\n return false if @payment_id.nil?\n return false if @payment_id.to_s.length > 15\n return false if @payment_id.to_s.length < 1\n return false if !@payment_description.nil? && @payment_description.to_s.length > 80\n return false if !@payment_description.nil? && @payment_description.to_s.length < 1\n return false if @debit_credit_indicator.nil?\n debit_credit_indicator_validator = EnumAttributeValidator.new('String', ['C', 'D'])\n return false unless debit_credit_indicator_validator.valid?(@debit_credit_indicator)\n return false if @payment_method.nil?\n return false if @payment_method.to_s.length > 35\n return false if @payment_method.to_s.length < 1\n true\n end",
"def credit?\n (payment_method == CREDIT)\n end",
"def can_cash?\n self.capture_and_cash\n end",
"def check_agreement\n if (!@customer.affiliate?)\n redirect_to(:action => :agreement)\n return false\n end\n end",
"def refund_is_allowed?\n\t\terrors.add :base, I18n.t('payment.contact_support') if api_charge_id.blank?\n\t\tvalid?(:create_refund) and errors.empty?\n\tend",
"def credit_unlimited?\n #if prepaid?\n # raise \"Prepaid users do not have credit\"\n credit == -1\n end",
"def accounts_payable?\n type == 'ACCPAYCREDIT'\n end",
"def valid_test_taking()\n if current_user.tenant.pricing_plan.plan_group == \"assessment_only_plan\" then\n if current_user.tenant.remaining_learner_credit > 0 then\n return true\n else\n return false\n end\n else\n return true\n end\n end",
"def can_pay_total?\n\n conf_payment_enabled = SystemConfiguration::Variable.get_value('booking.payment', 'false').to_bool\n conf_payment_total = (['total','deposit_and_total'].include?(SystemConfiguration::Variable.get_value('booking.payment_amount_setup', 'deposit')))\n\n if self.status == :pending_confirmation\n (conf_payment_enabled or force_allow_payment) and conf_payment_total and self.total_paid == 0 and ((!expired? and payment_cadence_allowed?) or force_allow_payment)\n elsif self.status == :confirmed # Confirmed in the back-office without payment\n (conf_payment_enabled or force_allow_payment) and conf_payment_total and self.total_paid == 0 and self.total_pending > 0\n else\n return false\n end\n\n end",
"def valid?\n return false if @plan.nil?\n return false if !@amount.nil? && @amount < 0\n return false if !@quantity.nil? && @quantity < 1\n return false if !@plan_version.nil? && @plan_version < 1\n return false if !@grace_duration.nil? && @grace_duration < 0\n return false if @signup_method.nil?\n return true\n end",
"def charge_credit_card(amount)\n true\n end",
"def charge_credit_card(amount)\n true\n end",
"def payment_data_valid?(payment_data)\n payment_data.map { |x| x.valid? }.all?\n end",
"def accounts_payable?\n type == 'ACCPAY'\n end",
"def payment_required?\n billing_total.to_f > 0.0\n end",
"def in_payment?\n @in_payment\n end",
"def valid_account(sports_centre) # pass in current_sports_centre\n if sports_centre != nil\n return true if Date.current <= sports_centre.nextPaymentDue\n else\n return false\n end\n end",
"def store_credit_card?\n paid?\n end",
"def can_capture?(payment)\n payment.pending? || payment.checkout?\n end",
"def can_capture?(payment)\n payment.pending? || payment.checkout?\n end",
"def can_capture?(payment)\n payment.pending? || payment.checkout?\n end",
"def can_capture?(payment)\n payment.pending? || payment.checkout?\n end",
"def can_capture?(payment)\n payment.pending? || payment.checkout?\n end",
"def currency_required? \n deposit_type?\n end",
"def authorize_payment\n if !self.pending_purchase_order && self.payment_object\n order, payment = self.purchase_and_authorize\n if payment && payment.success?\n# self.payment_object = nil # remove payment object so we can re-validate\n self.purchase_orders.reload\n return payment.success?\n end\n end\n false\n end",
"def customer_has_authorized_payment?\n\t\tauthorized and authorized_amount.try(:>, 0) and has_customer_account?\n\tend",
"def payment_confirmation_required?\n true\n end",
"def can_capture?(payment)\n (payment.pending? || payment.checkout?) && !payment.response_code.blank?\n end",
"def can_capture?(payment)\n (payment.pending? || payment.checkout?) && !payment.response_code.blank?\n end",
"def validate_driving_license_number?\n if !:driving_licence_number.nil? && :driving_license_state.nil?\n errors.add(\"You must provide the state of issue of your driving license\")\n end\n end",
"def paid_with_card?\n payment_type == \"card\"\n end",
"def applicable?\n mandatory || amount != 0\n end",
"def cheque_or_card_payment_not_excessive\n\t\t\n\t\tself.errors.add(:amount,\"payment is excessive\") if payment_excessive? && (is_cheque? || is_card?) && !refund\n\tend",
"def accepted_agreement?\n return license != DEFAULT_LICENSE\n end",
"def valid_operation\n if (wallet_origin && wallet_destiny ||\n wallet_origin && card_destiny && card_destiny.debit ||\n card_origin && wallet_destiny).nil?\n errors.add(:amount, 'invalid operation. Missing wallet(s) and/or card(s)')\n end\n end",
"def can_finish?\n self.payment_status == PTE::PaymentStatus.processing\n end",
"def valid?\n return false if @account.nil?\n return false if @currency.nil?\n return true\n end",
"def valid_to_process?\n #TODO\n # available money to transfer\n persisted? ? true : false\n end",
"def validate_can_purchase\n\n return error_with_data(\n 'um_ea_1',\n 'Sale is not active',\n 'Sale is not active',\n GlobalConstant::ErrorAction.default,\n {}\n ) if !@client_token_sale_details.is_token_sale_live?\n\n return error_with_data(\n 'um_ea_2',\n 'Invalid action',\n 'Invalid action',\n GlobalConstant::ErrorAction.default,\n {}\n ) if @client_token_sale_details.ethereum_deposit_address.blank?\n\n return error_with_data(\n 'um_ea_3',\n 'Unauthorized to purchase',\n 'Unauthorized to purchase',\n GlobalConstant::ErrorAction.default,\n {}\n ) if @user_kyc_detail.blank? || !@user_kyc_detail.kyc_approved? ||\n (@client.is_whitelist_setup_done? && !@user_kyc_detail.done_whitelist_status?)\n\n success\n end",
"def can_capture?(payment)\n ['pending'].include?(payment.state)\n end",
"def check_terms_and_cond(params, options, payment)\n # Make sure they agreed to the terms and conditions; do it here\n # rather than above so the credit card info they typed in is\n # preserved on the page for them (@credit_card is used for that)\n if (!params[:terms_and_conditions] && options[:suppress_terms_and_conds_check].nil?)\n payment.fail!\n return CHECKOUT_TERMS\n end\n nil\n end",
"def money_approved?\n true\n end",
"def check_for_promo_payment\n if !self.service_promo_id.nil? && !self.payed_booking_id.nil? && self.payed && self.trx_id != \"\"\n return true\n else\n return false\n end\n end",
"def valid? \n balance > 0 && status == 'open'\n end",
"def cms_voucher_request?\n false\n end",
"def validate_amount\n errors.add(:claiming_amount, :ads_amount) if claim_amount_required? && ads_amount.to_i < claiming_amount.to_i\n end",
"def can_rent_truck?\n !license.expired? && age >= 60 && license.to_drive_truck?\n end",
"def paid_with_card?\n order.payment_method == 'credit_card'\n end",
"def can_capture?(payment)\n ['pending'].include?(payment.state)\n end",
"def valid?\n if status != \"open\" || balance == 0\n false\n else\n true\n end\n end",
"def validate_for_card\n tt = self.transaction_type.to_i\n \n # mandatory: transaction_type must != (30, 31, 32, 34, 35)\n append_error(:cc_number, \"cc_number must not be set for tagged transactions\") if [30,31,32,34,35].include?(tt)\n \n # amount, cardholder_name always mandaory\n mandatory = [:amount, :cardholder_name]\n \n # card_number & expiry_date mandatory for all except 50, 54\n # pan mandatory for only 50, 54\n mandatory << ([50,54].include?(tt) ? :pan : [:cc_number, :cc_expiry])\n mandatory.flatten!\n\n # reference_no mandatory for 60\n mandatory << :reference_no if tt == 60\n \n # auth_number mandatory for (02, 03, 11, 12, 13)\n mandatory << :authorization_num if [02, 03, 11, 12, 13].include?(tt)\n \n check_mandatory(mandatory)\n end",
"def invoice_agreement_required?\n !self.billable? && !self.invoice_agreement_accepted?\n end",
"def charge_paypal_account(amount)\n true\n end",
"def charge_paypal_account(amount)\n true\n end",
"def can_void?(payment)\n !payment.failed? && !payment.void?\n end",
"def can_void?(payment)\n !payment.failed? && !payment.void?\n end",
"def valid?\n balance > 0 && status == \"open\"\n end",
"def free?\n cost == 0.0 || payment_not_required\n end",
"def payment_authorized?(payment_id)\n check_payment = get_payment_intent_info(payment_id)\n status = check_payment['status']\n puts \"Current Payment Status: #{status}\"\n case status\n when 'Authorized', 'Card Verified'\n puts 'Payment has been authorized'\n return true\n # when 'Declined'\n # puts \"Reason for Decline: #{check_payment['response_summary']}\"\n # abort 'Payment has been declined so exiting this program'\n end\n puts \"3DS Flow hasn't been completed\"\n false\n end",
"def can_capture?(payment)\n logger.debug \"\\n----------- #{self.invoice_number} -----------\\n\"\n ['checkout', 'pending', 'processing'].include?(payment.state) && !self.invoice_number.blank?\n end",
"def valid?\n return false if @merchant_id.nil?\n return false if @capacity.nil?\n return false if @date_time.nil?\n true\n end",
"def can_capture?(payment)\n ['checkout', 'pending'].include?(payment.state)\n end",
"def validate_bet_status\n return true if bet.pending?\n errors.add(:base, I18n.t(:cashout_not_eligible))\n end",
"def payment_failed?\n cancel_reason == PAYMENT_FAILED\n end",
"def input_valid?\n could_refund = @order.total_price - @order.refund_price\n @params[:refund_price].to_f.positive? && @params[:refund_price].to_f <= could_refund\n end",
"def technically_paid?\n unconfirmed_value_paid >= value_needed\n end",
"def can_charge_subscription?\n # * cannot charge subscription until trial period is running\n # * can only charge with a valid shipped_at or panic event\n !order.blank? && !subscription_deferred? && ( senior.any_panic_received? || !shipped_at.blank?)\n end",
"def allowed_to_pay_member_fee?\n return false if admin?\n\n if current_member? || in_grace_period?\n allowed_to_pay_renewal_member_fee?\n else\n allowed_to_pay_new_membership_fee?\n end\n end",
"def can_accept_showing?\n profile.valid? && valid_bank_token? && !blocked?\n end",
"def needs_handling_charge?\n true\n end",
"def payed?\n !payment_entry.nil?\n end",
"def user_must_pay?\n !journal&.will_pay? && !institution_will_pay? && !funder_will_pay?\n end",
"def can_capture?(payment)\n payment.state == 'pending' || payment.state == 'checkout'\n end"
] |
[
"0.75447243",
"0.7347513",
"0.7347513",
"0.73074293",
"0.71527463",
"0.71349007",
"0.7123488",
"0.7101144",
"0.70804197",
"0.70804197",
"0.68784773",
"0.6834908",
"0.68171525",
"0.68162286",
"0.6789596",
"0.6780398",
"0.67728525",
"0.67522043",
"0.67319894",
"0.66976804",
"0.66240615",
"0.66169274",
"0.6601936",
"0.6600463",
"0.65939695",
"0.6568596",
"0.6560745",
"0.6544033",
"0.65416235",
"0.65403384",
"0.65383947",
"0.6521161",
"0.65133077",
"0.6512175",
"0.6495932",
"0.64833015",
"0.6475056",
"0.6465251",
"0.6465251",
"0.64643866",
"0.64614266",
"0.6459638",
"0.6429323",
"0.64180744",
"0.6417406",
"0.6409448",
"0.6409448",
"0.6409448",
"0.6409448",
"0.6409448",
"0.6391046",
"0.63885343",
"0.63705295",
"0.6366499",
"0.6362223",
"0.6362223",
"0.6343113",
"0.6338229",
"0.63339525",
"0.63237596",
"0.6315209",
"0.6314877",
"0.63141984",
"0.6311587",
"0.6303347",
"0.6293736",
"0.6291302",
"0.6281581",
"0.62807024",
"0.62724036",
"0.6271918",
"0.62606156",
"0.62516665",
"0.62407357",
"0.62367594",
"0.62367004",
"0.6235624",
"0.6234029",
"0.62309784",
"0.6226501",
"0.6226501",
"0.6221884",
"0.6221884",
"0.621996",
"0.6214027",
"0.62084085",
"0.6204534",
"0.620379",
"0.6201856",
"0.61999",
"0.61974883",
"0.6197339",
"0.61905646",
"0.61896974",
"0.6189539",
"0.6188939",
"0.61799556",
"0.6176672",
"0.61735016",
"0.6171004"
] |
0.8120673
|
0
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.