query
stringlengths 7
9.55k
| document
stringlengths 10
363k
| metadata
dict | negatives
sequencelengths 0
101
| negative_scores
sequencelengths 0
101
| document_score
stringlengths 3
10
| document_rank
stringclasses 102
values |
---|---|---|---|---|---|---|
Return the average for the entire class. | def class_average(grade_hash)
averages(grade_hash).map{|k, v| v}.inject {|sum, n| sum + n } / grade_hash.length
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def class_average(data)\n ind_avgs = averages(data).values\n ind_avgs.sum/ind_avgs.length\nend",
"def class_average(grade_hash)\n averages(grade_hash).values.reduce(:+) / grade_hash.length\nend",
"def average_rating\n sum = 0\n self.ratings.each do |rating|\n sum += rating.score\n end\n avg = sum/self.ratings.length\n avg.to_f\n end",
"def class_average(grade_hash)\n scores = averages(grade_hash)\n result = 0\n scores.each {|k,v| result += v}\n result /= scores.length\nend",
"def class_average(grade_hash)\n averages(grade_hash).values.reduce(:+)/grade_hash.size\nend",
"def klass_average(k)\n assignments = self.assignments.select {|a| a.klasses.include?(k)}\n points_possible = assignments.map(&:value).compact.reduce(:+)\n points_earned = self.grades.select {|g| assignments.include?(g.assignment)}.map(&:value).compact.reduce(:+)\n \"#{points_earned.to_f / points_possible.to_f * 100}%\"\n end",
"def class_average(grade_hash)\n averages = averages(grade_hash)\n sum = 0\n\n averages.map do |key, value|\n sum += value\n end\n\n sum / averages.length\nend",
"def class_average(grade_hash)\n averages(grade_hash).map { |key, value| value }\n .reduce(:+) / grade_hash.length\nend",
"def class_average(grade_hash)\n averages(grade_hash)\n .map {|key, value| value}\n .reduce(:+) / grade_hash.length\nend",
"def average\n @grades.reduce(0,:+) / @grades.size.to_f\n end",
"def average\n return @@average_times.inject(:+).to_f / @@average_times.size\n end",
"def average\n @data['average']\n end",
"def average_rating\n total = 0\n self.reviews.each do |review|\n total += review.rating\n end\n average = total.to_f / self.reviews.count\n end",
"def mean\n\n end",
"def average\n\t\treturn self.sum / self.length.to_f\n\tend",
"def class_average(hashh)\n sum = 0.0\n hashh.each_value { |val| sum += val}\n average = sum / hashh.size\n hashh.empty? ? sum : average.round(2)\nend",
"def average_rating\n\n all_ratings = self.reviews.to_a.map do |review|\n review.rating\n end\n\n return 0 unless all_ratings.length > 0\n\n all_ratings.sum / all_ratings.length\n end",
"def average\n if self.critics.size>0\n begin\n self.critics.map{|i| i.score.to_f}.inject{ |sum, el| sum + el }.to_f / self.critics.size.to_f\n rescue\n nil\n end\n end\n end",
"def average_rating\n self.ratings.reduce(0.0) { |sum, score| sum += score } / self.ratings.length\n end",
"def mean\n get_mean\n end",
"def cal_mean\n sum = @data.inject(0) do |accu, hash|\n accu + hash[:prediction] - hash[:rating]\n end\n sum.to_f / @data.size\n end",
"def running_average; end",
"def team_average\n # This version is implemented as a database AVG operation,\n # but it cannot be eager loaded so it results in an extra\n # database query for each project:\n #\n # avg = students_projects.select(:points).average :points\n # avg ? avg.round : 0\n\n # This version programmatically finds the average of the points:\n #self.reload\n no_of_students = self.students_projects.length\n return 0 if no_of_students == 0\n total = 0\n self.students_projects.each { |s| total += s.points }\n (total / no_of_students).round\n end",
"def recalculate_average()\n\n #find total of all review ratings by iterating through them\n total = 0\n self.reviews.each do |review|\n total = total + review.rating\n end\n\n newAvg = total / self.reviews.size\n\n self.update_attribute(:avg_rating, newAvg)\n end",
"def mean\n @sum / @count\n end",
"def average\n total_sum = @person_array.inject(0){ |sum, p| sum += p.awesomeness } \n size = @person_array.size \n return (total_sum / size)\n end",
"def mean\n @mean\n end",
"def class_average(grade_hash)\n class_array = grade_hash.map do |k,v|\n averages v\n end\n averages class_array\nend",
"def average\n return self.sum / self.length.to_f\n end",
"def mean()\n\t\taverage = 0.0\n\t\[email protected] do |row|\n\t\t\taverage += (row[\"rating\"].to_f - row[\"predicted\"]).abs\n\t\tend\n\n\t\treturn average/results.length\n\tend",
"def mean\n get_errors\n sum = 0\n @errors.each {|e| sum += e}\n avg = sum / @total_predictions.to_f\n return avg\n end",
"def class_average(grade_hash)\n sum = 0\n grade_hash.values.each { |student| student.each {|grades| sum += grades }}\n average = sum/(grade_hash.length**2)\nend",
"def average()\n if(@countN > 0) then\n return @sum / @countN ;\n else\n return 0.0 ;\n end\n end",
"def get_mean\n end",
"def average\n @array.inject(0.0) {|total, n| total + n} / @array.size\n end",
"def average\n\t\tif self.length > 0\n\t\t\t#\tsum defined in activesupport/lib/active_support/core_ext/enumerable.rb\n\t\t\tself.digitize.sum.to_f / self.length\n\t\telse\n\t\t\tnil\n\t\tend\n\tend",
"def class_average(grade_hash) \n sum = 0\n students = grade_hash.keys.length\n scores = grade_hash.values.length\n total_scores = students * scores\n grade_hash.each do |key, value|\n sum += value.reduce(:+)\n end\n average = sum / total_scores\n average\nend",
"def average_rating\n reviews.average(:rating)\n end",
"def average\n return self.sum/self.length.to_f\n end",
"def average\n return self.sum/self.length.to_f\n end",
"def average\n return self.sum/self.length.to_f\n end",
"def average\n return self.sum/self.length.to_f\n end",
"def average\n return self.sum/self.length.to_f\n end",
"def average\n return self.sum/self.length.to_f\n end",
"def get_average\n @average ||= calculate_average\n end",
"def avg\n only_with('avg', 'DateTime', 'Numeric')\n itms = items.compact\n size = itms.size.to_d\n if type == 'DateTime'\n avg_jd = itms.map(&:jd).sum / size\n DateTime.jd(avg_jd)\n else\n itms.sum / size\n end\n end",
"def get_mean()\n end",
"def average_rating\n average = 0\n count = 0 \n self.trips.each do |trip|\n average += trip.rating.to_i\n count += 1\n end\n return average / count\n end",
"def average_rating\n \ttotal_score = 0\n \tnum_of_ratings = self.ratings.count\n \tself.ratings.each do |rating|\n \t\ttotal_score += rating.overall_rating\n \tend\n \tif num_of_ratings > 0\n \t\treturn total_score / num_of_ratings\n \telse\n \t\treturn 0\n \tend\n end",
"def calc_average!\n update!(avg_rating: ratings.average(:rating))\n end",
"def grade_average\n @grades.inject(:+) / @grades.size\n end",
"def avg_rating\n @avg = self.ratings.average(:rating) \n @avg ? @avg : 0\n end",
"def average_rating\n if events.any?\n scores =[]\n events.each do |e|\n valid_ratings = e.ratings.valid_only\n if valid_ratings.any?\n scores << valid_ratings.map {|r| r.score}.sum / valid_ratings.size\n end\n end\n scores.sum/scores.size.to_f\n else\n 0\n end\n end",
"def avg_rating\n stars_array = []\n ratings.each do |rating|\n stars_array << rating.stars\n end\n return stars_array.inject{ |sum, el| sum + el }.to_f / stars_array.size\n end",
"def avg\n array = []\n# this DO-loop will put all the star ratings into an array\n @reviews.each do |count|\n array.push(count.star.to_i)\n end\n# this line will calculate the actual average of all the star ratings\n outavg = array.inject(0.0) { |sum, el| sum + el } / array.size\n end",
"def average\n self.sum / self.length.to_f\n end",
"def average\n self.sum / self.length.to_f\n end",
"def average_ratings\n ratings.average(:int_value)\n end",
"def average_rating\n ratings.average(:value).to_f\n end",
"def average\n if self.length > 0\n return self.sum / (self.length * 1.0)\n else\n return nil\n end\n end",
"def average_review_rating\n self.reviews.all.average(:rating)\n end",
"def average_ratings\n ratings = 0\n self.ratings.each {|r| ratings += r.score}\n avg = votes == 0 ? 0 : ratings.to_f/votes.to_f\n \"%.1f\" % avg\n end",
"def average_ratings\n ratings = 0\n self.ratings.each {|r| ratings += r.score}\n avg = votes == 0 ? 0 : ratings.to_f/votes.to_f\n \"%.1f\" % avg\n end",
"def average_rating\n (ratings.sum(:rating).to_f / num_ratings).round(1)\nend",
"def reviews_avg\n number_with_precision(self.member_reviews.avg(:rating), precision: 1)\n end",
"def mean\n end",
"def avg_score\n reviews.average(:rating).round(2).to_f\n end",
"def average_rating\n return 0 if self.ratings.empty?\n (self.ratings.inject(0){|total, rating| total += rating.score }.to_f / self.ratings.size )\n end",
"def average_rating\n cal_average_rating(@products)\n end",
"def rating_average(obj)\n if obj.reviews.count >= 1\n array = []\n obj.reviews.each do |review|\n array.push(review.rating)\n end\n return (array.inject{ |sum, el| sum + el }.to_f / array.size).to_i\n else\n if obj.class.name == \"SharespaceVenue\"\n \"No reviews yet.\"\n else\n \"No reviews yet.\"\n end\n end\n\n\n\n end",
"def average_credit_score\n\n #Validation\n if @apt_tenants.size <= 0\n p \"No Tenants!\"\n else\n #Isolating credit Scores\n every_credit = self.apt_tenants.map { |i| i.credit_score }\n\n #Summing total, then dividing by arr size\n average_credit = every_credit.reduce(:+) / every_credit.size\n\n #passing to class instance\n @apt_avg_c = average_credit\n end\n end",
"def average_score\n grades.average(:score) || 0\n end",
"def average_rating\r\n comments.average(:rating).to_f\r\n end",
"def mean\n stats.mean\n end",
"def average_rating\n self.reviews.sum(:score) / reviews.size\n rescue ZeroDivisionError\n 0\n end",
"def mean\n variance =0\n count = 0.0\n @data.each do |line|\n true_rating = line[2]\n guess_rating = line[3]\n count = count + 1\n variance = (true_rating.to_i - guess_rating.to_i).abs + variance\n end\n return (variance/count.to_f)\n end",
"def average\n return ((@critics_score + @audience_score) / 2.0) #ultimate math skillz.\n end",
"def avg_rating\n @reviews = @product.reviews\n @avg_rating = nil\n\n if @reviews.size > 0\n @avg_rating = (@reviews.inject(0.0) { |sum, el| sum + el.rating }.to_f / @reviews.size).round(1)\n end\n end",
"def mean\n sum / count.to_f\n end",
"def avg_reviews\n @avg = self.reviews.average(:rating) \n @avg ? @avg : 0\nend",
"def average\nlift_Average = @@all.map do |lyft|\n lyft.lift_total\nend\nlift_Average.sum / lift_Average.size\nend",
"def rating\n average = 0.0\n ratings.each { |r|\n average = average + r.rating\n }\n if ratings.size != 0\n average = average / ratings.size\n end\n average\n end",
"def mean()\n sum = 0\n @difference.each do |item|\n sum += item\n end\n @mean = sum / @difference.length\n return @mean\n end",
"def mean\n return 0.0 if @count.zero?\n return @sum / @count\n end",
"def find_average \n result = array.sum(0.0)/array.size\n return result\n end",
"def average_out(ratings)\n ratings.sum(&:score).to_f / ratings.count\n end",
"def average_rating\n comments.average(:rating).to_f\n end",
"def average_rating\n comments.average(:rating).to_f\n end",
"def average_rating\n comments.average(:rating).to_f\n end",
"def average_rating\n comments.average(:rating).to_f\n end",
"def average_lift_total\n num_of_lifters = Lifter.all.length \n total_lifter_num = 0 \n Lifter.all.each do |lifter_instance|\n total_lifter_num += lifter_instance.lift_total\n end\n average = total_lifter_num/num_of_lifters \n average\n end",
"def average_reviews\n numerator = 0\n denominator = 0\n total = 0\n n = 0\n self.trainings.each do |training|\n unless training.average_reviews.nil?\n n += training.average_reviews[:number]\n numerator += training.average_reviews[:average_score] * training.average_reviews[:number]\n denominator += training.average_reviews[:number]\n end\n end\n if denominator != 0\n (total = numerator / denominator)\n total\n else\n \"No reviews\"\n end\n end",
"def average_rating\n\t\t\t\t\treturn 0 if rates.empty?\n\t\t\t\t\t( rates.inject(0){|total, rate| total += rate.score }.to_f / rates.size )\n\t\t\t\tend",
"def avg \n\t\t# prevent divide by zero\n\t\tif (self[:at_bats] != 0)\n\t\t\t(self[:hits].to_i / self[:at_bats].to_f).round(3)\n\t\telse\n\t\t\t0\n\t\tend\n\tend",
"def mean\n Statistics.mean @data\n end",
"def average_rating\n ratings.inject(0.0) {|sum, num| sum +=num} / ratings.length\n end",
"def avg_rating\n visits.avg_rating\n end",
"def mean\n\t\tsum = @error_list.inject{|sum, x| sum + x}\n\t\tsum / @predictions.size.to_f\n\tend",
"def average_score\n count = 0.0\n avrg = 0.0\n if self.cadets.empty?\n return 0.0\n else\n self.cadets.each do |cdt|\n unless cdt.discharged?\n avrg += cdt.average_score\n count += 1.0\n end\n end\n return count != 0.0 ? (avrg/count).round(1) : 0.0\n end\n end",
"def class_average(grade_hash)\n sum, n = 0, 0\n grade_hash.each do |k,array|\n array.each do |grade|\n n += 1\n sum += grade\n end\n end\n return sum/n\nend"
] | [
"0.82577485",
"0.76192003",
"0.7570708",
"0.7541172",
"0.7539687",
"0.75102514",
"0.7488115",
"0.7438756",
"0.7403346",
"0.7396515",
"0.73954564",
"0.7336673",
"0.73212093",
"0.72724485",
"0.72568274",
"0.7254238",
"0.7252965",
"0.724596",
"0.7242883",
"0.71528244",
"0.7150641",
"0.71379775",
"0.7135511",
"0.7119846",
"0.7110272",
"0.7108629",
"0.7104677",
"0.7093966",
"0.7068439",
"0.7064798",
"0.7063998",
"0.7063258",
"0.7061276",
"0.70603174",
"0.7058358",
"0.70511574",
"0.7039291",
"0.7035659",
"0.70253325",
"0.70253325",
"0.70253325",
"0.70253325",
"0.70253325",
"0.70253325",
"0.7023463",
"0.7022771",
"0.70087034",
"0.7003899",
"0.7002305",
"0.6995823",
"0.69905007",
"0.6987633",
"0.69816464",
"0.69797236",
"0.6978115",
"0.6976934",
"0.6976934",
"0.69740736",
"0.69720244",
"0.695816",
"0.6941626",
"0.69318545",
"0.69318545",
"0.6929793",
"0.6924947",
"0.6920958",
"0.69175553",
"0.6917355",
"0.69031924",
"0.68968546",
"0.68934",
"0.6879955",
"0.68756104",
"0.68738157",
"0.686173",
"0.6857818",
"0.6857006",
"0.6856146",
"0.6849849",
"0.684804",
"0.6845414",
"0.68444204",
"0.68361205",
"0.6819921",
"0.68153214",
"0.68056375",
"0.67974955",
"0.67974955",
"0.67974955",
"0.67974955",
"0.6789931",
"0.67797244",
"0.6779089",
"0.6765126",
"0.6756767",
"0.6755409",
"0.67534447",
"0.67500466",
"0.67492133",
"0.67450196"
] | 0.7168934 | 19 |
Return an array of the top `number_of_students` students. | def top_students(grade_hash, number_of_students)
averages(grade_hash).sort_by { |k, v| v}.reverse.map{ |k, v| k }.take(number_of_students)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def top_students(grade_hash, number_of_students)\n averages(grade_hash)\n .sort_by { |key, value| value }.reverse\n .map { |key, value| key}\n .take(number_of_students)\nend",
"def top_students(grade_hash, number_of_students)\n averages(grade_hash)\n .sort_by { |key, value| value}.reverse\n .map { |key, value| key }\n .take(number_of_students)\nend",
"def top_students(grade_hash, number_of_students)\n scores = averages(grade_hash)\n shortlist = scores.sort_by{|k,v| v}.reverse.take(number_of_students)\n names = shortlist.map{|k,v| k}\nend",
"def top_students(grade_hash, number_of_students)\nsorted_hash = averages(grade_hash).sort_by {|name, grade| grade}\nsorted_hash.reverse!\ntop_array = []\nsorted_hash.each do |k, v|\n top_array << k\nend\ntop_array.take(number_of_students)\nend",
"def top_students(grade_hash, number_of_students)\n sorted_hash = averages(grade_hash).sort_by {|name, grade| grade}\n #reverse! takes the items in an array and reverses them without making a new array\n sorted_hash.reverse!\n top_array = []\n sorted_hash.each do |key, value|\n top_array << key\n end\n top_array.take(number_of_students)\nend",
"def top_students(grade_hash, number_of_students)\n outArray = []\n grade_hash.each do |name, scores|\n sum, n = 0, 0\n scores.each do |x|\n n += 1\n sum += x\n end\n outArray.push([sum/n, name])\n end\n final_answer = []\n outArray.sort.reverse[0...number_of_students].each do |grade,name|\n final_answer.push(name)\n end\n return final_answer\nend",
"def top_students(grade_hash, number_of_students)\n averages = averages(grade_hash)\n\n result = averages.sort_by do |key, value|\n value\n end\n\n students = result.map do |key, value|\n key\n end\n\n non_reversed = students.last(number_of_students)\n\n reversed = non_reversed.reverse\nend",
"def top_students(grade_hash, number_of_students)\n grade_hash.transform_values{|score| score.reduce(0,:+)/(score.length)}.sort_by {|student,score| score}.reverse.to_h.keys.first(number_of_students)\nend",
"def top_students(grade_hash, number_of_students)\n # Loop through hash\n top_students_array = grade_hash.map do |key, value|\n # find average for each student\n average = value.sum / value.length\n # put into array of key, score\n [key, average]\n end\n puts top_students_array\n # turn into hash\n top_students_hash = top_students_array.to_h\n # sort hash\n top_students_sorted = top_students_hash.sort_by do |a, b| \n -b\n end\n # map keys\n sorted_student_array = top_students_sorted.map do |key, value|\n key\n end\n # return top student names in array\n result = sorted_student_array.take(number_of_students)\n result\nend",
"def top_students(grade_hash)\n averages(grade_hash)\n .to_a\n .sort_by { |student| -student[1] }\n .map { |student| student[0] }\nend",
"def top_schools(n)\n @leaderboard.take(n).each.with_index do |schoolresult, idx|\n yield [idx+1, schoolresult]\n end\n end",
"def top_ten\n sorted = @person_array.sort { |a, b| a.awesomeness <=> b.awesomeness }\n sorted.reverse!\n return sorted[0..9] if sorted.size >= 10\n return sorted\n end",
"def top(num = nil)\n temp = @user.scores.group(:sentence).sum(:val).sort_by{|_,v| -v}\n filter_by_num(temp, num)\n end",
"def most_blood_donors (students, blood_types)\n\tmax_donors = 0\n\tmost_donors = []\n\n\tstudents.each_with_index do |student_needing_blood, i|\n\t\tdonors = donors_for_student(students, blood_types, student_needing_blood)\n\t\tif donors.length > max_donors\n\t\t\tmax_donors = donors.length\n\t\tend\n\tend\n\tstudents.each_with_index do |student_needing_blood, i|\n\t\tdonors = donors_for_student(students, blood_types, student_needing_blood)\n\t\tif donors.length == max_donors\n\t\t\tmax_donors = donors.length\n\t\t\tmost_donors.push(students[i])\n\t\tend\n\tend\n\treturn most_donors\nend",
"def getTop10AwesomePeeps\n @persons.sort!\n return @persons[-10..-1]\n end",
"def count_people_ordered_most_popular_books(count_of_popular_books)\n most_popular_books = most_popular\n people = Array.new\n most_popular_books[0..count_of_popular_books].each do |book|\n @readers.each do |name, value|\n value.orders.detect do |order|\n# p \"order.book=\"+order.book.to_s\n# p \"book=\"+book.title.to_s\n p \"Book.class= \"+order.book.class.to_s\n people << value if book == order.book\n end\n end \n end\n return people.size #maybe a good idea return all people?\n end",
"def top_users(limit = 10)\n @users.sort_by{|user_id,user| -user.score}.first(limit).map do |t|\n {\n :id => t.first,\n :score => t.last.score,\n :common_tracks_count => t.last.common_tracks_count,\n :total_tracks_count => t.last.total_tracks_count\n }\n end\n end",
"def personal_top_three\n scores.max([scores.length, 3].min)\n end",
"def test_find_n_people_with_lowest_scores\n skip\n people = phone_book.n_lowest_scorers(2)\n names = people.map do |person|\n person.name\n end\n assert_equal [\"Adeline Wolff\", \"Lorenzo Lowe\"], names.sort\n end",
"def get_most_prolific_likers(num_users = 5)\n get_most_generic_for_users(DOCS[:most_prolific_likers], num_users)\n end",
"def get_most_radlibs_created(num_users = 5)\n get_most_generic_for_users(DOCS[:most_prolific], num_users)\n end",
"def get_most_popular_users(num_users = 5)\n get_most_generic_for_users(DOCS[:most_popular_users], num_users)\n end",
"def topMatches( prefs, person, n=5, scorefunc = :sim_pearson )\n scores = []\n for other in prefs.keys\n if scorefunc == :sim_pearson\n scores << [ sim_pearson(prefs,person,other), other] if other != person\n else\n scores << [sim_distance(prefs,person,other), other] if other != person\n end\n end\n return scores.sort.reverse.slice(0,n)\n end",
"def topMatches( prefs, person, n=5, scorefunc = :sim_pearson )\n scores = []\n for other in prefs.keys\n if scorefunc == :sim_pearson\n scores << [ sim_pearson(prefs,person,other), other] if other != person\n else\n scores << [ sim_distance(prefs,person,other), other] if other != person\n end\n end\n return scores.sort.reverse.slice(0,n)\n end",
"def top_ten_list(category)\n # Select all of category from work instances\n work_by_category = Work.all.select { |work| work.category.downcase == \"#{category}\" }\n # Return max by vote count for top 10\n return work_by_category.max_by(10) { |work| work.votes.length }\n end",
"def top_10_fans\n users_array = UserTeam.all.collect{|user| user.user_id}\n most_common_value = users_array.uniq.sort_by{ |i| users_array.count( i ) }.reverse\n biggest_fans = most_common_value.map {|user| User.find(user).name}[0..9]\n users_teams_count = most_common_value.map {|user| User.find(user).teams.count}[0..9]\n counter = 0\n return_hash = {}\n until counter == biggest_fans.length do\n return_hash[biggest_fans[counter].to_s] = users_teams_count[counter].to_s\n counter += 1\n end\n return_hash\nend",
"def how_many_most_often(n)\n a = count_most_often(n)\n lrj = a.join(',')\n c = 0\n [self.n1, self.n2, self.n3, self.n4, self.n5].each do |n|\n c += 1 if a.include?(n)\n end\n return [c, a.size]\n end",
"def findTopMovies(actor, top_number=100) \r\n movie_array = []\r\n\r\n actor.film_actor_hash.each_key {|key| movie_array.push(key)}\r\n\r\n return movie_array.take(top_number)\r\nend",
"def top_10_sorted\n\t\t\t\t\traw = notable_order_by_cvss_raw\n\t\t\t\t\tdata = Array.new\n\n\t\t\t\t\traw.each do |vuln|\n\t\t\t\t\t\trow = Array.new\n\t\t\t\t\t\tplugin_id = vuln[0]\n\t\t\t\t\t\tcount = vuln[1]\n\n\t\t\t\t\t\tname = scrub_plugin_name(Plugin.find_by_id(plugin_id).plugin_name)\n\n\t\t\t\t\t\trow.push(name)\n\t\t\t\t\t\trow.push(count)\n\t\t\t\t\t\tdata.push(row)\n\t\t\t\t\tend\n\n\t\t\t\t\tdata = data.sort do |a, b|\n\t\t\t\t\t\tb[1] <=> a[1]\n\t\t\t\t\tend\n\n\t\t\t\t\treturn data\n\t\t\t\tend",
"def get_most_prolific_users(num_users = 5)\n get_most_generic_for_users(DOCS[:most_prolific], num_users)\n end",
"def this_teams_top_players(number_of_players)\n \tnfl_players.order(:points).last(number_of_players)\n end",
"def top_ten_users\n # Get top 3 dank ranks total scores\n top_danks = DankRank.order('total_score DESC').limit(6)\n # For each top dank_rank, retrieve [lvl, points, id]\n top_users = top_danks.map { |dank| [User.find(dank.user_id).dank_rank.total_score, User.find(dank.user_id).dank_rank.rank_up_xp_progress, User.find(dank.user_id).id] }\n # Sort that array by level and then points\n top_users.sort!{|a, b| b <=> a}\n # Return the users\n return top_users.map { |array| User.find(array[2]) }\n end",
"def top_by n=1, &_blk\n return enum_for(:top_by, n) unless block_given?\n chain = {}\n each do |x|\n y = yield x\n chain[y] ||= []\n chain[y] << x\n end\n ary = []\n chain.keys.sort.reverse.each do |k|\n ary += chain[k]\n break if ary.length > n\n end\n ary[0...n]\n end",
"def top_5\n count = @sentence.blips.group(:body).distinct.count\n percent = count.each {|k, v| count[k] = v / @sentence.blips_count.to_f }\n statistics = percent.sort_by { |k, v| v }.reverse[0..4].flatten.each { |k, v| puts \"#{k}: #{v}\" }\n end",
"def top_matches(preferences, person, limit = 5)\n scores = preferences.map {|pref| [sim_pearson(preferences, person, pref[0]), pref[0]] unless pref[0] == person}.compact\n scores.sort! {|a,b| b[0] <=> a[0]}\n return scores[0...limit]\nend",
"def top_3\n freq_hash = each_with_object(Hash.new(0)) { |v, h| h[v] += 1 }\n freq_hash.sort_by { |k, v| -v }.first(3).map(&:first)\n end",
"def top_5_teams\n team_names = []\n teams = UserTeam.all.collect{|team| team.team_id}\n most_common_value = teams.uniq.sort_by{ |i| teams.count( i ) }.reverse[0..4]\n most_common_value.each do |team|\n team_names << get_team_name_by_id(Team.find(team).api_team_id)\n end\n team_names\nend",
"def top_ten\n reverse_sort = self.sort.reverse\n return reverse_sort[0, 10]\n end",
"def best_students(students)\n #creacion de un array vacio donde entraran los best_students\n best_students = []\n #Creacion de variables x,y de tipo integer\n #que se inicializan en 0\n x, y = 0, 0\n #ciclo while que correra siempre que la variable y\n #sea menor a la longitud del parametro students\n while y < students.length\n #creacion de un array que sera igual a \"y\" y \"x\"\n current_student = students[y][x]\n #Condicion if para comparar el segundo valor(calificacion)\n # de cada array dentro del array\n if current_student[1] == 10\n #Empuja el primer argumento de cada array dentro del array\n #(nombres de los estudiantes) cuya calificacion sea \n #igual a 10\n best_students.push(current_student[0])\n #Termina if\n end\n if x == (students[y].length - 1)\n x = 0\n y += 1\n else\n x += 1\n #end if\n end\n #End While\n end\n #Regresa el array de best students \n #ya con los estudiantes que cumplieron la condicion\n best_students\nend",
"def top_readers\n readers_with_duplicates = []\n self.articles.each { |article| readers_with_duplicates << article.readers }\n\n readers_with_duplicates.flatten!\n readers = readers_with_duplicates.uniq\n frequency = Hash.new(0)\n readers_with_duplicates.each { |r| frequency[r] += 1 }\n array = frequency.sort_by { |key, value| value }\n return [array[-1], array[-2], array[-3]]\n\n end",
"def top_expert_tags(number)\n ret = self.expertises.where(\"expert_score > 0\").order(expert_score: :desc)\n return ret if number.nil? || number < 1\n ret.limit number\n end",
"def top_matches(n=3)\n \n scores = Array.new\n \n @prefs.each_pair do |key,value|\n if key != @person\n scores << [@similarity.compute(key),key]\n end\n end\n \n (scores.sort!.reverse!)[0..n]\n \n end",
"def top_songs(n = 3)\n top_list = @tracks.sort_by {|s| s.play_count}.reverse\n return top_list[0..n-1].compact\n end",
"def top_copurchases(sku,n,counts)\n counts[sku].flatten.group_by(&:sku).sort{|a,b|b[1].length <=> a[1].length}[0..(n-1)].map{|a|[a[0],a[1].length]}\nend",
"def topn_by_downloads (keyinfo, n)\n topn_by_downloads = keyinfo.sort_by{ |x| x[:total_downloads] }.reverse.slice(0 .. n-1)\n top_table topn_by_downloads\nend",
"def top_five_schools(division, &block)\n leaderboard(division).top_schools(20, &block)\n end",
"def get_top_frequencies(frequencies, threshold = 5)\n frequencies.sort_by(&:last).last(threshold).reverse.to_h.deep_symbolize_keys\n end",
"def top_10 (matches)\n matches.sort_by! { |match| match['score'] }.reverse[:10]\nend",
"def top_books\n if orders.empty?\n puts \"There are not orders...\"\n else\n @orders.group_by(&:book).values.max_by(&:size).first.book\n end\n end",
"def top_three_recipes\n top_three = RecipeCard.all.select {|atr| atr.user == self}\n top_three.sort_by {|atr| atr.rating}.reverse\n top_three[0..2]\n end",
"def get_most_active_users(num_users = 5)\n get_most_generic_for_users(DOCS[:most_active_users], num_users)\n end",
"def top(num)\n @mut.synchronize{@array.sort!.reverse.take(num)}\n end",
"def get_most_comments_made(num_users = 5)\n get_most_generic_for_users(DOCS[:most_comments_made], num_users)\n end",
"def top_three_recipes\n recipe_cards.max_by(3) {|recipe_cards| recipe_cards.rating}\n end",
"def top_10_followers\n users_array = UserLeague.all.collect{|user| user.user_id}\n most_common_value = users_array.uniq.sort_by{ |i| users_array.count( i ) }.reverse\n biggest_followers = most_common_value.map {|user| User.find(user).name}[0..9]\n users_league_count = most_common_value.map {|user| User.find(user).leagues.count}[0..9]\n counter = 0\n return_hash = {}\n until counter == biggest_followers.length do\n return_hash[biggest_followers[counter].to_s] = users_league_count[counter].to_s\n counter += 1\n end\n return_hash\nend",
"def most_common_nationalities_list\n nationalities_hash = self.players.group_by{\n |player| player.nationality\n }\n count_hash={}\n nationalities_string = nationalities_hash.map do |nationality, players|\n # puts \"Number of players from \" + nationality + \": \" + players.count.to_s\n count_hash[nationality]=players.count\n end\n count_hash.sort_by {|nationality, num| num}.reverse\n end",
"def get_most_radlib_fillins_by_user(num_users = 5)\n get_most_generic_for_users(DOCS[:most_prolific], num_users)\n end",
"def print_student_list(students)\n\tstudents_by_cohort = students.sort_by {|a| a[:cohort]}\n\tstudents_by_cohort.each do |student|\n\t\tputs \"#{student[:name]} (#{student[:cohort]}) cohort\".center(@width)\n\tend\nend",
"def topTenBooks\n\t\t@requests = requests.order('count desc').limit(10)\n\tend",
"def popularity_list\n @popularity_list=@movie_index.sort_by { |x| -x[1].size }.col(0) if @popularity_list.nil?\n @popularity_list\n end",
"def top_k_frequent_elements(list, k)\n return [] if list.empty?\n \n element_count = {}\n \n list.each do |element|\n if element_count[element].nil?\n element_count[element] = 1\n else\n element_count[element] += 1\n end\n end\n \n sorted_elements = element_count.sort_by(&:first)\n \n i = 0\n max_nums = []\n k.times do\n max_nums << sorted_elements[i][0]\n i += 1\n end\n \n return max_nums\nend",
"def best(n)\n @score.sort{|a,b| b[1][0] <=> a[1][0]}[0..n-1]\n end",
"def max_donors(students, blood_types)\n\tdonor_lengths = []\n\n\tstudents.each_with_index do |student, i|\n\t\tstudent_blood_type = blood_type(students, blood_types, student)\n\t\tbloods_list = blood_type_accepted(students, student_blood_type, student)\n\t\tstudent_donor_list = donor_list(students, blood_types, bloods_list)\n\t\tdonor_lengths.push(student_donor_list.length)\n\n\tend\n\n\tindex = 0\n\tdonor_max = donor_lengths[0]\n\tmax_donor_list = []\n\tdonor_lengths.each_with_index do |count, i|\n\t\tif count > donor_max\n\t\t\tdonor_max = count\n\t\t\tindex = i\n\t\tend\n\tend\n\tdonor_lengths.each_with_index do |count, i|\n\t\tif count == donor_max\n\t\t\tmax_donor_list.push(students[i])\n\t\tend\n\tend\n\treturn max_donor_list, donor_max\nend",
"def groups\n @students.sort_by(&:fullname).each_slice((@students.count / 2.0).round).to_a\n end",
"def print_student_list\n @students.sort_by! { |hash| hash[:cohort] }\n @students.each.with_index(1) do |student, index|\n puts \"#{index}. #{student[:name]} (#{student[:cohort]} cohort)\".center(100)\n end\nend",
"def top_peaks(n)\n\t\treturn array_ranked_descending(intensities_array)[0..(n-1)]\n\tend",
"def get_num_students_per_grade(num_students)\n min = @scenarioYAML[\"MINIMUM_GRADE_PERCENTAGE\"]\n max = @scenarioYAML[\"MAXIMUM_GRADE_PERCENTAGE\"]\n\n if min.nil?\n @log.error \"MINIMUM_GRADE_PERCENTAGE must be set for a world to be created --> Exiting...\"\n abort\n end\n if max.nil?\n @log.error \"MAXIMUM_GRADE_PERCENTAGE must be set for a world to be created --> Exiting...\"\n abort\n end\n\n ((random_on_interval(min, max) / 100) * num_students).round\n end",
"def top_k_frequent_elements(list, k)\n # build hashmap\n num_hash = {}\n list.each do |num|\n if num_hash[num]\n num_hash[num] += 1\n else\n num_hash[num] = 1\n end\n end\n\n # convert hashmap to array\n array_num_hash = num_hash.to_a\n\n # sort by occurences\n sorted_array_num_hash = array_num_hash.sort_by {|num| -num[1]}\n\n # sorted elements only\n sorted_numbers = sorted_array_num_hash.map{|num| num[0]}\n\n # slice sorted array by k elements\n return sorted_numbers.slice(0, k)\nend",
"def top_10_sorted_raw\n\t\t\t\t\traw = notable_order_by_cvss_raw\n\n\t\t\t\t\tdata = Array.new\n\n\t\t\t\t\traw.each do |vuln|\n\t\t\t\t\t\trow = Array.new\n\t\t\t\t\t\tplugin_id = vuln[0]\n\t\t\t\t\t\tcount = vuln[1]\n\n\t\t\t\t\t\trow.push(plugin_id)\n\t\t\t\t\t\trow.push(count)\n\t\t\t\t\t\tdata.push(row)\n\t\t\t\t\tend\n\n\t\t\t\t\tdata = data.sort do |a, b|\n\t\t\t\t\t\tb[1] <=> a[1]\n\t\t\t\t\tend\n\n\t\t\t\t\treturn data\n\t\t\t\tend",
"def most_reviews\n @top_five = Taxi.most_review_answers(current_user, params)\n end",
"def top_three_recipes\n recipes_sorted_by_rating.reverse[0..2]\n end",
"def count_students\n students.size\n end",
"def count_students\n students.size\n end",
"def top_three_recipes\n top_three_cards = recipe_cards.sort_by { |card| card.rating}.reverse.slice(0, 3)\n top_three_cards.map { |c| c.recipe }\n end",
"def top_k_frequent_elements(list, k)\n return [] if list.empty?\n\n count_hash = Hash.new(0)\n result = []\n\n list.each do |element|\n count_hash[element] += 1\n end\n\n max_array = count_hash.sort_by { |k, v| -v }\n\n (0...k).each do |i|\n result << max_array[i][0]\n end\n\n return result\nend",
"def total_students\n students = 0\n self.booked_customers.each do |school|\n students += school.number_students\n end\n return students\n end",
"def top_three_recipes\n my_recipes = self.recipe_cards\n my_recipes.sort{|a, b| b.rating <=> a.rating }.slice(0,3)\n end",
"def top_k_frequent_elements(list, k)\n if list.length == 0 \n return []\n end \n nums = {}\n list.each do |num|\n if !nums[num]\n nums[num] = 1\n else\n nums[num] += 1\n end\n end \n\n sorted = nums.sort_by {|k, v| -v}\n top_k = []\n k.times do |k|\n top_k << sorted[k][0]\n end \n return top_k\nend",
"def rank_top_teams # DO NOT USE THIS METHOD, outdated, slow\n @top_teams = {}\n @top_teams = Score.in_challenge(self.id).teams_in_all_divisions.limit(5).\n order(\"sum_points DESC, MAX(#{Score.table_name}.\n earned_at) DESC\").sum(:points) \n return @top_teams\n end",
"def lineup_students(students)\n students.sort_by { |x| x.length }\nend",
"def count_most_often(c)\n numbers = {}\n sorted = []\n (1..42).to_a.each do |e|\n conditions = \"(n1 = #{e} OR n2 = #{e} OR n3 = #{e} OR n4 = #{e} OR n5 = #{e})\"\n conditions += \" AND (no >= #{no-100})\" #if !n.nil?\n r = Result.count(:conditions => conditions,\n :order =>'no DESC')\n numbers[e] = r\n end\n numbers.sort_by{|k,v| v}.reverse.each{|e| sorted << e[0]}\n while numbers[c] == numbers[c+1]\n c += 1\n end\n #p sorted\n return sorted[0..c-1]\n end",
"def top_k_frequent_elements(list, k)\n return list if list.empty?\n\n num_frequency = {}\n\n list.each do |num|\n num_frequency[num] ? num_frequency[num] += 1 : num_frequency[num] = 1\n end\n\n top_frequent_nums = []\n\n k.times do\n max_frequency = 0\n max_frequent_num = nil\n\n num_frequency.each do |key, value|\n if value > max_frequency\n max_frequency = value\n max_frequent_num = key\n end\n end\n\n top_frequent_nums << max_frequent_num\n num_frequency[max_frequent_num] = 0\n end\n\n return top_frequent_nums\nend",
"def top_k_frequent_elements(list, k)\n hash = {}\n \n list.each do |value|\n if hash[value]\n hash[value] += 1\n else\n hash[value] = 1\n end\n end\n \n top_elements = Array.new(k)\n return top_elements = hash.sort_by{ |key, value| value } \nend",
"def percentile_by_count(array,percentile)\n count = (array.length * (percentile)).floor\n verbose \"Array entry at 95th percentile: #{count-1}\"\n array.sort[count-1]\nend",
"def popularity_list\n averageRatingMoviesHash = {}\n @ratedMoviesHash.each {|movie, ratings| averageRatingMoviesHash[movie] = average(ratings) * (2 ** (@ratedMoviesHash[\"#{movie}\"].length / (@allUsersHash.keys.length).to_f)) - 1}\n ratedMoviesArray = averageRatingMoviesHash.sort_by { |movie, aveRating| -aveRating }\n popularityList = []\n ratedMoviesArray.each {|item| popularityList.push(item[0].to_i)} \n return popularityList\n\tend",
"def top_k_frequent_elements(list, k)\n # create a counter hash for the numbers\n counter = {}\n # go through the list of numbers\n # test the hash keys, if it is not there, add it with a number 1 value\n # otherwise increment the value by 1\n list.each do |num|\n if !counter[num]\n counter[num] = 1\n else\n counter[num] += 1\n end\n end\n\n # list.each do |element|\n # counts[element] ||= 0\n # counts[element] += 1\n # end\n\n # find the K max counts\n highest_counts = counter.values.max(k)\n # return the values of those keys\n most_frequent = []\n highest_counts.each do |n|\n most_frequent << counter.key(n)\n counter.delete(counter.key(n))\n end\n return most_frequent\nend",
"def top_three_recipes\n self.find_user_recipe_cards.sort_by{|rcard| rcard.rating}.reverse![0..2]\n end",
"def how_orders_of_three_most_popular_books\n books_count.each {|title, times| puts \"The most popular books, '#{title}', ordered #{times}\" if times == books_count.values.max }\n end",
"def print_students_under_length\n count = 0\n while count < @students.length\n if @students[count][:name].length < 12\n student_profile(count)\n end\n count += 1\n end\nend",
"def rank_by_size\n ranked_users = []\n for size in users_by_size.keys.sort.reverse\n ranked_users.push(users_by_size[size])\n end\n\n return ranked_users\nend",
"def calculate_team_ratings(roster)\n ratings = Array.new\n roster.each do|player|\n if (player && player.profile && player.profile.rating)\n ratings.push(player.profile.rating.total)\n end\n end\n \n top_ratings = ratings.sort.reverse.take(10)\n top_ratings.sum\n end",
"def closest_neighbours(person, number_of_users)\n\n\tfile = File.read('./json/user_data.json')\n\tdata_hash = JSON.parse(file)\n\n\tscores = Array.new\n\tperson_collection = Array.new\n\n\t# Returns the number of similar uses to a specific person\n\tdata_hash.each do |key,value|\n\t\tif key != person\n\t\t\tperson_collection.push(key)\n\t\t\tscores.push(pearson_correlation(person, key))\n\t\tend\n\tend\n\n\tfinal_score = scores.zip(person_collection)\n\n\t# Sort the highest similar person to lowest\n\tfinal_score.sort!{|x,y| y <=> x}\n\tfinal_score[0 .. number_of_users - 1]\nend",
"def sort_scores(unsorted_scores, highest_possible_score)\n\n # array of 0s at indices 0..highest_possible_score\n score_counts = [0] * (highest_possible_score+1)\n\n # populate score_counts\n unsorted_scores.each do |score|\n score_counts[score] += 1\n end\n\n # populate the final sorted array\n sorted_scores = []\n\n # for each item in score_counts\n score_counts.each_with_index do |count, score|\n\n # for the number of times the item occurs\n (0...count).each do |time|\n\n # add it to the sorted array\n sorted_scores.push(score)\n end\n end\n\n return sorted_scores\nend",
"def top_k_frequent_elements(list, k)\n return list if list.empty? || list.length == k\n count = {}\n \n list.each do |num|\n count[num] ? count[num] += 1 : count[num] = 1\n end\n \n sorted = count.sort_by { |k, v| -v }\n \n most_frequent = Array.new(k)\n k.times { |i| most_frequent[i] = sorted[i][0] } \n \n return most_frequent\nend",
"def get_keywords(top_n)\n @weighted_keywords.sort_by {|_key, value| value}.reverse[1..top_n]\n end",
"def top_drink_descriptors(how_many)\n # create empty array to hold top descriptors list for beer being rated\n @this_beer_descriptors = Array.new\n # find all descriptors for this drink\n @this_beer_all_descriptors = self.descriptors\n # Rails.logger.debug(\"this beer's descriptors: #{@this_beer_all_descriptors.inspect}\")\n @this_beer_all_descriptors.each do |descriptor|\n @descriptor = descriptor[\"name\"]\n @this_beer_descriptors << @descriptor\n end\n \n # attach count to each descriptor type to find the drink's most common descriptors\n @this_beer_descriptor_count = @this_beer_descriptors.each_with_object(Hash.new(0)) { |word,counts| counts[word] += 1 }\n # put descriptors in descending order of importance\n @this_beer_descriptor_count = Hash[@this_beer_descriptor_count.sort_by{ |_, v| -v }]\n # grab top 5 of most common descriptors for this drink\n @this_beer_descriptor_count.first(how_many)\n end",
"def get_most_radlib_fillins_by_others(num_users = 5)\n get_most_generic_for_users(DOCS[:most_prolific], num_users)\n end",
"def post_top_50\n top100 = {}\n list_of_people.each do |person|\n count = @platform.count_for(person)\n next if count < THRESHOLD\n puts \"#{person} had #{count} hits!\"\n top100[person] = count\n end\n\n top100aggregate = @other_aggregations.aggregate(top100)\n top50 = top_50_people(top100aggregate)\n\n post_100(top50)\n social_media_links(top50)\n end",
"def how_many_students\n number = roster.length\n \"There are #{number} students in our class\"\nend",
"def return_profiles_based_on_interests(profiles)\n profiles.sort_by do |profile|\n getMatchingInterests(profile).size\n end.reverse\n end"
] | [
"0.75698096",
"0.7545575",
"0.75126565",
"0.74994767",
"0.74357885",
"0.7402287",
"0.7275602",
"0.72337484",
"0.7097617",
"0.6574678",
"0.64220905",
"0.6365745",
"0.59663564",
"0.59427667",
"0.59349966",
"0.5889596",
"0.58893615",
"0.58598256",
"0.5789828",
"0.5715849",
"0.56845987",
"0.5657158",
"0.5631135",
"0.5626821",
"0.5622529",
"0.55888194",
"0.55689955",
"0.555565",
"0.55524266",
"0.55512255",
"0.555089",
"0.5548519",
"0.5515801",
"0.5499571",
"0.5458654",
"0.5453985",
"0.5448039",
"0.5431659",
"0.5392187",
"0.5375902",
"0.5351126",
"0.5336978",
"0.53295547",
"0.53281695",
"0.53255725",
"0.5315469",
"0.5300865",
"0.5295513",
"0.52899706",
"0.5265584",
"0.52513844",
"0.5248453",
"0.5236415",
"0.5223148",
"0.5222086",
"0.52089244",
"0.5208441",
"0.52040046",
"0.5195708",
"0.518622",
"0.51847035",
"0.5184482",
"0.5180688",
"0.5174475",
"0.51741797",
"0.5161077",
"0.51536876",
"0.5138892",
"0.51316607",
"0.51097447",
"0.50881284",
"0.5083821",
"0.5083821",
"0.50746465",
"0.5060325",
"0.5059165",
"0.50563025",
"0.50489414",
"0.50419307",
"0.50283515",
"0.502737",
"0.5025579",
"0.5021767",
"0.50143003",
"0.50065607",
"0.5000339",
"0.4989096",
"0.49800286",
"0.49788785",
"0.497441",
"0.49657148",
"0.49624178",
"0.49569806",
"0.4951593",
"0.49501535",
"0.49494392",
"0.49477854",
"0.49469525",
"0.49401572",
"0.49321246"
] | 0.74699235 | 4 |
If title is nil then list's name will be used | def initialize(rows, cols, row, col, title_prefix)
@win = Window.new(rows, cols, row, col)
@title_prefix = title_prefix
@max_contents_len = @win.maxx - 3 # 2 for borders
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"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 title_for_list(object)\n return \"List of \" + MyAdmin.prepare_title(object)\n end",
"def title\n @title ||= heirarchy.full_name\n end",
"def title_name; end",
"def list_title_for(text)\n I18n.t(\"backend.general.list\", :model => text.is_a?(String) ? text : text.send(:human_name))\n end",
"def title(title = nil)\n @title = title if title\n @title\n end",
"def initialize(list_title)\n @title = list_title\n @items = Array.new\n end",
"def name; title end",
"def title title = nil\n if title\n @title = title.to_s\n else\n @title ||= name[/([^:]+)$/, 1]\n end\n end",
"def initialize(list_title)\n @title = list_title\n @items = Array.new\n end",
"def title(title)\n @item.title = title\n self\n end",
"def with_title(items)\n return items if title.nil?\n return items.none if title.blank?\n\n items.where(title: title)\n end",
"def title\n super.first || \"\"\n end",
"def title\n super.first || \"\"\n end",
"def name\n method_missing(:title)\n end",
"def display_name\n title.present? && title || _('Untitled')\n end",
"def title\n super.first || ''\n end",
"def title\n super.first || ''\n end",
"def title\n super.first || ''\n end",
"def title\n name\n end",
"def title\n name\n end",
"def item_title item, title_attribute = nil\n if title_attribute\n item.send(title_attribute)\n else\n columns = item.class.column_names\n if columns.include?('name')\n item.send('name')\n elsif columns.include?('title')\n item.send('title')\n else\n \"Title not available\"\n end\n end\n end",
"def list_name\n @data['list_name']\n end",
"def list_name\n value = model_table_name.humanize\n return 'author-title headings' if value == 'Name titles'\n value\n end",
"def name\n [title,url].detect{|t| !t.blank?}\n end",
"def title\n nil\n end",
"def name\n\t\tself.title\n\tend",
"def title\n return nil\n end",
"def title\n if label.blank? then name else label end\n end",
"def frbr_list_title\n event_title\n end",
"def title\n base_title = \"Bibliocloud\"\n if @title.nil?\n base_title\n else\n \"#{base_title} | #{@title}\"\n end\n end",
"def frbr_list_title\n frbr_ui_desc\n end",
"def name\n title\n end",
"def name\n title\n end",
"def name\n title\n end",
"def name\n title\n end",
"def name() title; end",
"def name() title; end",
"def title\n base_title = \"Digital Library Management Tool\"\n if @title.nil?\n base_title\n else\n \"#{base_title}|#{@title}\"\n end\n end",
"def title_is(title = nil)\n title_is_empty if title.nil? || title.empty?\n @title = title\n end",
"def title(title = nil)\n raise TypeError, \"expecting a String or an Array\" unless [String,Array].include?(title.class) || title.nil?\n separator = \" ~ \"\n @page_title = title if title\n if @page_title\n title = @page_title.to_a.flatten\n [@page_title, site_name].flatten.reverse.join(separator)\n else\n site_name\n end\n end",
"def title(title=nil)\n title.nil? ? @title : @title = title\n end",
"def title?; end",
"def item_title(item)\n item.title\n end",
"def title\n end",
"def title\nbase_title = \"MatterMouth\"\nif @title.nil?\nbase_title\nelse\n\"#{base_title} | #{@title}\"\nend\nend",
"def title\n base_title = \"LoveALLogy\"\n if @title.nil?\n base_title\n else\n \"#{base_title} | #{@title}\"\n end\n end",
"def name_li(name)\n self.link(:title=>name).parent\n end",
"def navigation title = nil, title_tag = :h6, &block\n output = String.new()\n output << content_tag( title_tag, title ) unless title.nil?\n output << content_tag(:ul) do\n capture(&block)\n end\n concat output\n end",
"def full_title\n name\n end",
"def full_title\n name\n end",
"def full_title\n name\n end",
"def title(title)\n @title = title\n end",
"def title\n base_title = \"Soccer_League Manager\"\n if @title.nil?\n base_title\n else\n \"#{base_title} | #{@title}\"\n end\n end",
"def title\n ''\n end",
"def html_list_name list_type, open_tag\n ''\n end",
"def title\n [id, name].join(' ')\n end",
"def title(title)\n @title=title\n end",
"def title\n base_title = \"Let Me Sing Now, llc\"\n if @title.nil?\n base_title\n else\n \"#{base_title} | #{@title}\"\n end\n end",
"def title\n\t\tbase_title = \"Black Market Books\"\n\t\tif @title.nil?\n\t\t\tbase_title\n\t\telse\n\t\t\t\"#{base_title} | #{@title}\"\n\t\tend\n\tend",
"def title\n base_title = \"Railstwitterclone\"\n if @title.nil?\n base_title\n else\n \"#{base_title} - #{@title}\"\n end\n end",
"def title(title=\"\")\n self.tag('title', title)\n end",
"def title\n base_title = \"Operation Paws for Homes\"\n if @title.nil?\n base_title\n else\n \"#{base_title} | #{@title}\"\n end\n end",
"def complete_title\n if self.title.present?\n self.title\n else\n I18n.translate(\"bento_search.missing_title\")\n end\n end",
"def title\n \"\"\n end",
"def render_list(title, items, options = Hash.new)\n options, push_options = Kernel.filter_options options, :filter => false, :id => nil\n if options[:filter] && !options[:id]\n raise ArgumentError, \":filter is true, but no :id has been given\"\n end\n html = load_template(LIST_TEMPLATE).result(binding)\n push(title, html, push_options.merge(:id => options[:id]))\n end",
"def title\n base_title = \"S.Hukin ltd - Sheffield, UK. Speciality wholesale foods.\"\n if @title.nil?\n base_title\n else\n \"#{base_title} | #{@title}\"\n end\n end",
"def title; end",
"def title; end",
"def title; end",
"def title; end",
"def title; end",
"def title; end",
"def title; end",
"def title; end",
"def title; end",
"def title; end",
"def title; end",
"def title; end",
"def title; end",
"def title; end",
"def title; end",
"def title; end",
"def title; end",
"def title; end",
"def title= title\n @title = title\n end",
"def set_title\n if fund_editions.first && fund_editions.first.title?\n self.title ||= fund_editions.first.title\n elsif node\n self.title ||= node.name\n end\n end",
"def title=(value)\n\t\t\t@title = value\n\t\tend",
"def get_title\n @title\n end",
"def handle_title(name, attrs) \n \n end",
"def parameterize_title_for_name\n self.name = title.parameterize if title\n end",
"def display_name\n name.present? && name || title.present? && title || _('Untitled')\n end",
"def set_ListName(value)\n set_input(\"ListName\", value)\n end",
"def title\n\t\tbase_title = title_extend\n\t\tif @title.nil?\n\t\t\tbase_title\n\t\telse\n\t\t\t\"#{base_title} | #{@title}\"\n\t\tend\n\tend",
"def titles\n @title\n end",
"def title\n item_hash.deep_find(:title)\n end",
"def title(new_title = nil, options = {})\n self.titles_pool ||= {}\n screen_name = options[:screen]\n if new_title\n screen_name ? self.titles_pool[screen_name] = new_title : self.titles_pool[:_common] = new_title\n else\n self.titles_pool[screen_name] || self.titles_pool[:_common] || to_s.gsub(/Grid/, \"\")\n end\n end",
"def title\n @tagline unless name?\n end",
"def title=(value)\n @title = value\n end",
"def title=(value)\n @title = value\n end",
"def title=(value)\n @title = value\n end"
] | [
"0.7108575",
"0.6939402",
"0.6780712",
"0.67578566",
"0.6687497",
"0.6681466",
"0.66554624",
"0.66378325",
"0.6587936",
"0.6537159",
"0.65369594",
"0.65208983",
"0.6468742",
"0.6468742",
"0.6466663",
"0.6462387",
"0.64544976",
"0.64544976",
"0.64544976",
"0.6454359",
"0.6454359",
"0.6421004",
"0.63911104",
"0.6345843",
"0.633414",
"0.63249826",
"0.632486",
"0.63247925",
"0.6320873",
"0.6319928",
"0.6291045",
"0.6289577",
"0.6277352",
"0.6277352",
"0.6277352",
"0.6277352",
"0.6266435",
"0.6266435",
"0.62610906",
"0.62421304",
"0.62329316",
"0.6220061",
"0.6213136",
"0.6202488",
"0.619544",
"0.61798257",
"0.6179254",
"0.6176853",
"0.6155979",
"0.6149145",
"0.6149145",
"0.6149145",
"0.6147744",
"0.61136734",
"0.6111564",
"0.6105433",
"0.6087392",
"0.6086896",
"0.60787666",
"0.6078286",
"0.60698205",
"0.60692173",
"0.606643",
"0.6064136",
"0.60619223",
"0.60572094",
"0.6050239",
"0.6045468",
"0.6045468",
"0.6045468",
"0.6045468",
"0.6045468",
"0.6045468",
"0.6045468",
"0.6045468",
"0.6045468",
"0.6045468",
"0.6045468",
"0.6045468",
"0.6045468",
"0.6045468",
"0.6045468",
"0.6045468",
"0.6045468",
"0.6045468",
"0.6039647",
"0.60379165",
"0.6033589",
"0.6032681",
"0.60317373",
"0.60271174",
"0.6026783",
"0.6021823",
"0.6018351",
"0.60162926",
"0.60160595",
"0.6014529",
"0.6013403",
"0.6010844",
"0.6010844",
"0.6010844"
] | 0.0 | -1 |
TODO: Use a Pathname for all path operations instead of File. Add support for relative_to and relative_from to ContentList (find?) | def params=(value={})
@params.merge! value
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def by_path(path); end",
"def path() end",
"def path() end",
"def path() end",
"def find(path); end",
"def find(path); end",
"def relative_path(from, to); end",
"def find\n \"#{content_path}#{clean_path}\"\n end",
"def path\n [name]\n end",
"def paths; end",
"def paths; end",
"def paths; end",
"def paths; end",
"def paths; end",
"def at(path); end",
"def document(path); end",
"def path; end",
"def path; end",
"def path; end",
"def path; end",
"def path; end",
"def path; end",
"def path; end",
"def path; end",
"def path; end",
"def path; end",
"def path; end",
"def path; end",
"def path; end",
"def path; end",
"def path; end",
"def path; end",
"def path; end",
"def path; end",
"def path; end",
"def path; end",
"def path; end",
"def path; end",
"def path; end",
"def path; end",
"def path; end",
"def path; end",
"def path; end",
"def path; end",
"def path; end",
"def path; end",
"def path; end",
"def path; end",
"def path; end",
"def path; end",
"def path(*) end",
"def path\n \"/content/#{id}\"\n end",
"def /(path)\n ::File.join(self, path)\n end",
"def file_path; end",
"def path\n end",
"def path\n end",
"def path\n end",
"def path_expanded path\n end",
"def /(file)\n Tree.content_by_path(repo, id, file, commit_id, path)\n end",
"def path; super; end",
"def file_path\n end",
"def relative_path; end",
"def relative_path; end",
"def relative_path; end",
"def relative_path; end",
"def relative_path; end",
"def for(file_or_dir); end",
"def path\n raise NotImplementedError\n end",
"def relative_path_from(from); end",
"def path\n @path\n end",
"def path\n @path\n end",
"def path\n self.file.to_s\n end",
"def / aRelativePath\n access_child(aRelativePath)\n end",
"def path\n @file.path\n end",
"def path\n end",
"def path\n '/c/document_library/get_file?folderId=%i&name=%s' % [self.folderid, self.name]\n end",
"def file_list\n end",
"def expand_tree(path)\n names = path.split('/')\n names.pop\n parent = work_tree\n names.each do |name|\n object = parent[name]\n break if !object\n if object.type == :blob\n parent.move(name, name + CONTENT_EXT)\n break\n end\n parent = object\n end\n end",
"def generate_content_paths\n\n # This code for updating the uid field with the id (primary key)\n self.update_attributes(:uid => self.id)\n\n # The first entry with the self parent\n first = ContentPath.new\n first.ancestor = self.id\n first.descendant = self.id\n first.depth = 0\n first.save\n\n # Getting the parent id of the content\n parent_id = ContentData.get_parent_id(self.id)\n\n # If a parent is found then putting all the Content Path Entries\n if parent_id > 0\n\n # Getting the parent id data\n parent = Content.find(parent_id)\n # Getting all the parents of the parent (NOTE: This also contains the current parent id)\n parent_parents = parent.parents\n if(parent_parents.length > 0)\n parent_parents.each do |p|\n\n # Creating the new content paths\n path = ContentPath.new\n path.ancestor = p[\"ancestor\"]\n path.descendant = self.id\n path.depth = p[\"depth\"]+1\n path.save\n end\n end\n end\n\n end",
"def path\n raise NotImplementedError\n end",
"def relative_path\n name\n end",
"def path\n folder.path + name\n end",
"def path\n name + extension\n end",
"def content_paths\n if @content_paths.nil?\n paths = if filesystem_path.end_with?(\".content.xml\")\n Pathname(filesystem_path).parent.to_s\n elsif sling_initial_content? and filesystem_path.end_with?(\".json\")\n [filesystem_path, filesystem_path.gsub(/.json$/, \"\")].delete_if { |path| !File.exist?(path) }\n else\n filesystem_path\n end\n\n @content_paths = Array(paths)\n end\n\n @content_paths\n end",
"def find(path, type, setting); end",
"def add(path); end",
"def pathDocuments\n \"./documents/\"\nend",
"def path_without_name_and_ref(path); end",
"def fullpath; end",
"def relative_path(options = {})\n File.join(self.site.content_dir(options), sanitize_filename(self.name))\n end",
"def files; end",
"def files; end",
"def files; end",
"def files; end",
"def files; end",
"def files; end",
"def from_path; end",
"def from_path; end",
"def getFile(tree, name, path = '')\n blob = nil\n\n tree.each_blob do |file|\n blob = file if file[:name] == name[/[^\\/]*/]\n blob[:name] = path + blob[:name]\n end\n\n if blob.nil?\n tree.each_tree do |subtree|\n if subtree[:name] == name[/[^\\/]*/]\n path += name.slice! name[/[^\\/]*/]\n name[0] = ''\n return getFile($repo.lookup(subtree[:oid]), name, path + '/')\n end\n end\n end\n\n return blob\nend",
"def files_at_path(_path, with_attrs: true)\n raise NotImplementedError\n end",
"def static_content_work_file_set_find_by_title( work:, work_title:, file_set_title:, path: )\n ::Deepblue::LoggingHelper.bold_debug [ ::Deepblue::LoggingHelper.here,\n ::Deepblue::LoggingHelper.called_from,\n \"work_title=#{work_title}\",\n \"file_set_title=#{file_set_title}\",\n \"path=#{path}\",\n \"\" ] if static_content_controller_behavior_verbose\n return nil unless work\n return nil unless file_set_title\n if work_view_content_enable_cache\n id = StaticContentControllerBehavior.static_content_cache_get( key: path )\n return static_content_find_by_id( id: id ) if id.present?\n end\n ::Deepblue::LoggingHelper.bold_debug [ ::Deepblue::LoggingHelper.here,\n ::Deepblue::LoggingHelper.called_from,\n \"work.id=#{work.id}\",\n \"work.title=#{work.title}\",\n \"work.file_set_ids=#{work.file_set_ids}\",\n \"work.file_sets.size=#{work.file_sets.size}\",\n \"\" ] if static_content_controller_behavior_verbose\n work.file_sets.each do |fs|\n # TODO: verify\n ::Deepblue::LoggingHelper.bold_debug [ ::Deepblue::LoggingHelper.here,\n ::Deepblue::LoggingHelper.called_from,\n \"fs.title.join(#{fs.title.join}) ==? file_set_title(#{file_set_title})\",\n # \"file_set_title=#{file_set_title}\",\n \"\" ] if static_content_controller_behavior_verbose\n if fs.title.join == file_set_title\n id = fs.id\n if work_view_content_enable_cache\n StaticContentControllerBehavior.static_content_cache_id( key: path, id: id )\n end\n ::Deepblue::LoggingHelper.bold_debug [ ::Deepblue::LoggingHelper.here,\n ::Deepblue::LoggingHelper.called_from,\n \"fs.title.join(#{fs.title.join}) ==? file_set_title(#{file_set_title})\",\n \">>> Found <<<\",\n \"\" ] if static_content_controller_behavior_verbose\n return fs\n end\n end\n ::Deepblue::LoggingHelper.bold_debug [ ::Deepblue::LoggingHelper.here,\n ::Deepblue::LoggingHelper.called_from,\n \"file_set_title=#{file_set_title})\",\n \">>> Not found <<<\",\n \"\" ] if static_content_controller_behavior_verbose\n return nil\n end"
] | [
"0.6397883",
"0.62302995",
"0.62302995",
"0.62302995",
"0.6218775",
"0.6218775",
"0.61442447",
"0.6039749",
"0.60135907",
"0.598302",
"0.598302",
"0.598302",
"0.598302",
"0.598302",
"0.59793216",
"0.5971854",
"0.5967793",
"0.5967793",
"0.5967793",
"0.5967793",
"0.5967793",
"0.5967793",
"0.5967793",
"0.5967793",
"0.5967793",
"0.5967793",
"0.5967793",
"0.5967793",
"0.5967793",
"0.5967793",
"0.5967793",
"0.5967793",
"0.5967793",
"0.5967793",
"0.5967793",
"0.5967793",
"0.5967793",
"0.5967793",
"0.5967793",
"0.5967793",
"0.5967793",
"0.5967793",
"0.5967793",
"0.5967793",
"0.5967793",
"0.5967793",
"0.5967793",
"0.5967793",
"0.5967793",
"0.5967793",
"0.5889838",
"0.5858085",
"0.58446014",
"0.5839334",
"0.5817152",
"0.5817152",
"0.5817152",
"0.57825947",
"0.57789785",
"0.5758792",
"0.5756608",
"0.5743841",
"0.5743841",
"0.5743841",
"0.5743841",
"0.5743841",
"0.57220644",
"0.56904083",
"0.5672934",
"0.566085",
"0.566085",
"0.5647645",
"0.56351614",
"0.5630947",
"0.5630829",
"0.5629449",
"0.5622479",
"0.5588397",
"0.55665785",
"0.55568445",
"0.5547748",
"0.55441076",
"0.55387455",
"0.5537055",
"0.552903",
"0.55186945",
"0.55144197",
"0.54884094",
"0.54856545",
"0.5468027",
"0.5467242",
"0.5467242",
"0.5467242",
"0.5467242",
"0.5467242",
"0.5467242",
"0.5464955",
"0.5464955",
"0.5460583",
"0.5459372",
"0.54583395"
] | 0.0 | -1 |
Can I call body() ? | def exists?
has_block? or File.exists? @source_path
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def body; end",
"def body; end",
"def body; end",
"def body; end",
"def body; end",
"def body; end",
"def body; end",
"def body; end",
"def body; end",
"def body; end",
"def body; end",
"def body; end",
"def body; end",
"def body; end",
"def body; end",
"def body; end",
"def body(&block)\n call_once\n if block_given?\n yield body\n else\n @body\n end\n end",
"def body(*args)\n return @body if args.empty?\n @body = args.first\n end",
"def body\n raise NotImplementedError, \"#{self.class} must implement #body!\"\n end",
"def body()\n #This is a stub, used for indexing\n end",
"def body(value = nil, &block)\n __define__(:body, value, block)\n end",
"def body_content\n call_block\n end",
"def body(args = {}, &block)\n build_base_component :body, args, &block\n end",
"def body\n nil\n end",
"def body!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 4 )\n\n type = BODY\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 325:7: 'body'\n match( \"body\" )\n\n \n @state.type = type\n @state.channel = channel\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 4 )\n\n end",
"def body=(_arg0); end",
"def body=(_arg0); end",
"def body=(body); end",
"def body\n if !block_given?\n if @cached_body != nil\n return @cached_body\n end\n return @cached_body = ::Vertx::Util::Utils.from_object(@j_del.java_method(:body, []).call())\n end\n raise ArgumentError, \"Invalid arguments when calling body()\"\n end",
"def body\n if defined? @body\n @body\n else\n Null\n end\n end",
"def body_io; end",
"def body_io; end",
"def body\n \"\"\n end",
"def body\n \"\"\n end",
"def body\n ''\n end",
"def body\n part('body')\n end",
"def ouch(body_part)\n puts \"Im in the method\"\n puts \"Ouch my #{body_part} hurts\"\n yield(\"John\")\nend",
"def body(value = nil)\n if value\n @body = value\n else\n @body\n end\n end",
"def body(opts = {}, &block)\n build_main_component :body, opts, &block\n end",
"def render_body(context, options); end",
"def emit_body(body = body())\n unless body\n buffer.indent\n nl\n buffer.unindent\n return\n end\n visit_indented(body)\n end",
"def visitBody node\n puts \"body\"\n\n # for now, always inactive.\n if node.wrapperBody\n\n @code.newline\n node.stmts.each do |el|\n el.accept self unless el.nil?\n end\n @code.newline\n\n else\n\n @code << \"(\"\n node.stmts.each do |el|\n el.accept self unless el.nil?\n end\n @code << \")\"\n\n end\n\n end",
"def body\n return @body\n end",
"def new_body(node)\n return super unless its?(node)\n\n transform_its(node.body, node.send_node.arguments)\n end",
"def handle(body)\n process(:one, body)\n end",
"def body\n return \"\"\n end",
"def body(body)\n append(Body.new(body))\n end",
"def must_have_body?\n Methods[@method].must_have_body\n end",
"def finish\n\t\t\t\t\[email protected]\n\t\t\t\tend",
"def body\n source\n end",
"def transforming_body_expr; end",
"def body\n @funcT.body\n end",
"def render_body(params)\n render_custom(body, params)\n end",
"def body\n @body ||= process_text(@raw_body)\n end",
"def default_body_obj(*args)\n Body.new(*args)\n end",
"def init_body(&block)\n if block_given?\n @body = to_node(yield)\n else\n @body = Null\n end\n end",
"def body(value = (return @body unless defined?(yield); nil), &block)\n if block\n @body = DelayedBody.new(&block)\n else\n self.body = value\n end\n end",
"def body=(value)\n @body = value\n end",
"def initialize(body)\n @body = body\n end",
"def initialize(body)\n @body = body\n end",
"def initialize(body)\n @body = body\n end",
"def initialize(body)\n @body = body\n end",
"def close_body(body)\n end",
"def make_body(center)\n # Define a polygon (this is what we use for a rectangle)\n sd = PolygonShape.new\n vertices = []\n vertices << box2d.vector_to_world(Vec2.new(-15, 25))\n vertices << box2d.vector_to_world(Vec2.new(15, 0))\n vertices << box2d.vector_to_world(Vec2.new(20, -15))\n vertices << box2d.vector_to_world(Vec2.new(-10, -10))\n sd.set(vertices.to_java(Java::OrgJbox2dCommon::Vec2), vertices.length)\n # Define the body and make it from the shape\n bd = BodyDef.new\n bd.type = BodyType::DYNAMIC\n bd.position.set(box2d.processing_to_world(center))\n @body = box2d.create_body(bd)\n body.create_fixture(sd, 1.0)\n # Give it some initial random velocity\n body.set_linear_velocity(Vec2.new(rand(-5.0..5), rand(2.0..5)))\n body.set_angular_velocity(rand(-5.0..5))\n end",
"def default_body_obj(*args)\n BoundBody.new(*args)\n end",
"def method_missing(symbol,*args,&block)\n singleton_method(symbol,*args,&block) ||\n singleton_method(:body).send(symbol, *args, &block)\n end",
"def done body=''\n fulfill(body, 0, {})\n end",
"def finish\n super\n\n if _requires_no_body?\n @_body = nil\n end\n end",
"def body body=nil\n @response.body = body if body\n @response.body\n end",
"def body\n @body_io.read.tap { @body_io.rewind }\n end",
"def can_have_body?\n Methods[@method].can_have_body\n end",
"def body=(value)\n @body = value\n end",
"def body_content\n end",
"def body\n expect :defn, :defs, :class, :module\n\n case self.node_type\n when :defn, :class\n self[3..-1]\n when :defs\n self[4..-1]\n when :module\n self[2..-1]\n end\n end",
"def transforming_body_expr=(_); end",
"def body\n @body || \"\"\n end",
"def call(name, *params)\n self[name].body.call(*params)\n end",
"def getBody\n @body\n end",
"def finish\n\t\t\t\t\tif @body\n\t\t\t\t\t\tbody = @body.finish\n\t\t\t\t\t\t@body = nil\n\t\t\t\t\t\t\n\t\t\t\t\t\treturn body\n\t\t\t\t\tend\n\t\t\t\tend",
"def body=(value)\n @body = value\n end",
"def body=(value)\n @body = value\n end",
"def body=(value)\n @body = value\n end",
"def body=(value)\n @body = value\n end",
"def body\n @chunk\n end",
"def response_body=(_arg0); end",
"def has_body?\n @body\n end",
"def render_to_body(options); end",
"def body\n @raw\n end",
"def body\n Node::Block.new([return_operation])\n end",
"def display\n @body\n end",
"def body\n description\n end",
"def body?\n\t\t\t\t\t@body and [email protected]?\n\t\t\t\tend",
"def body(value = nil)\n\t\t\tvalue ? @body = value : @body ||= ''\n\t\tend",
"def body\n output = Renderer.render renderer_template, body_locals\n output = edit_body(output) if options[:editor]\n output\n end",
"def body(value = nil)\n if value\n self.body = value\n# add_encoding_to_body\n else\n process_body_raw if @body_raw\n @body\n end\n end",
"def body\n @output_buffer\n end",
"def body\n self['body']\n end",
"def body?\n !body.empty?\n end",
"def render_to_body(options = {})\n end",
"def body\n process_message_body if !@body\n @body\n end",
"def hideBody _args\n \"hideBody _args;\" \n end"
] | [
"0.8219701",
"0.8219701",
"0.8219701",
"0.8219701",
"0.8219701",
"0.8219701",
"0.8219701",
"0.8219701",
"0.8219701",
"0.8219701",
"0.8219701",
"0.8219701",
"0.8219701",
"0.8219701",
"0.8219701",
"0.8219701",
"0.7325007",
"0.72796917",
"0.72785705",
"0.7263836",
"0.7181263",
"0.714394",
"0.70718384",
"0.70235056",
"0.70007974",
"0.6932408",
"0.6932408",
"0.6840655",
"0.67415005",
"0.6706113",
"0.66840786",
"0.66840786",
"0.6618355",
"0.6618355",
"0.6585347",
"0.65007246",
"0.6475867",
"0.64757985",
"0.6472977",
"0.64695424",
"0.6469376",
"0.6462728",
"0.6461797",
"0.644569",
"0.6428643",
"0.6421145",
"0.64178646",
"0.63233393",
"0.6292158",
"0.6268549",
"0.6263209",
"0.62598777",
"0.62526846",
"0.6247413",
"0.62403685",
"0.62197286",
"0.62147593",
"0.620761",
"0.6194386",
"0.6194386",
"0.6194386",
"0.6194386",
"0.6187568",
"0.617281",
"0.6164251",
"0.6105161",
"0.610327",
"0.6094676",
"0.6069726",
"0.6043356",
"0.60426426",
"0.6005329",
"0.59989107",
"0.59903497",
"0.59817225",
"0.5981503",
"0.59780824",
"0.59770215",
"0.59676015",
"0.5960372",
"0.5960372",
"0.5960372",
"0.5960372",
"0.5960132",
"0.5926489",
"0.5923516",
"0.59177274",
"0.59163976",
"0.5914541",
"0.59096545",
"0.59073824",
"0.5901921",
"0.5891683",
"0.5871621",
"0.5870238",
"0.5867089",
"0.585181",
"0.58347666",
"0.583231",
"0.5805736",
"0.5803327"
] | 0.0 | -1 |
Returns Array of content objects | def all(pattern=nil)
pattern.nil? ? values : find(pattern)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def as_content_array\n as_array[1]\n end",
"def to_a\n @content.collect { |item| assemble(item) }\n end",
"def get_content\n @list \n end",
"def all_contents()\n contents = self.content.flatten.map do |c|\n case c\n when Eddy::Models::Loop::Repeat then c.all_contents()\n when Eddy::Models::Loop::Base then c.all_contents()\n when Eddy::Models::Segment then c\n else raise Eddy::Errors::RenderError\n end\n end\n return contents.flatten\n end",
"def content\n raise \"content is nil \" unless @list\n return @list\n end",
"def getAllContents() # BUG: camel_case.rb\r\n assert_exists\r\n #element.log \"There are #{@o.length} items\"\r\n returnArray = []\r\n @o.each { |thisItem| returnArray << thisItem.text }\r\n return returnArray \r\n end",
"def get_contents \n @contents = []\n\n sub_directory_names = Dir[CONTENT_ROOT_DIRECTORY + \"/*\"]\n\n sub_directory_names.each do |sub_directory_name|\n sub_directory_basename = File.basename(sub_directory_name)\n @contents.push(Content.new(sub_directory_basename))\n end\n end",
"def create_contents\n contents = []\n if description[\"contents\"].blank?\n log_warning \"Could not find any content descriptions for element: #{self.name}\"\n else\n description[\"contents\"].each do |content_hash|\n contents << Content.create_from_scratch(self, content_hash.symbolize_keys)\n end\n end\n end",
"def create_contents\n contents = []\n if definition[\"contents\"].blank?\n log_warning \"Could not find any content descriptions for element: #{self.name}\"\n else\n definition[\"contents\"].each do |content_hash|\n contents << Content.create_from_scratch(self, content_hash.symbolize_keys)\n end\n end\n end",
"def contents_from_html\n types_ids = []\n html = introduction + links\n page = Hpricot(html)\n as = page.search('//a')\n as.each do |a|\n href = a.attributes['href']\n ActiveRecord::Acts::Content.model_types.each do |t|\n underscore = t.underscore\n if href =~ /\\/#{underscore.pluralize}\\/(.+)/ # The URL must be in the form /plural/id\n id = $1.to_i\n types_ids << [t, id]\n end\n end\n end\n\n ret = []\n types_ids.uniq!\n types_ids.each do |t, id|\n klass = t.constantize\n content = klass.find_by_id(id)\n ret << content unless content.nil?\n end\n ret\n end",
"def items\n @items ||= fetch_items(contents)\n end",
"def create_contents\n contents = []\n if description[\"contents\"].blank?\n logger.warn \"\\n++++++\\nWARNING! Could not find any content descriptions for element: #{self.name}\\n++++++++\\n\"\n else\n description[\"contents\"].each do |content_hash|\n contents << Alchemy::Content.create_from_scratch(self, content_hash.symbolize_keys)\n end\n end\n end",
"def index\n @contents = Content.all\n\n respond_with @contents\n end",
"def get_content_items(params)\n query = query_string(params)\n get_json(\"#{endpoint}/v2/content#{query}\")\n end",
"def get_content_array(xpath_query)\n scraped_array = Array.new\n pos = 0\n @current_page.search(xpath_query).each do |var|\n scraped_array[pos] = var.content.strip\n pos += 1\n end\n scraped_array\n end",
"def getMembersAsArray() \n ret = []\n it = self.getIterator() \n while(it.hasMoreResources())\n ret << it.nextResource().getContentAsREXML()\n end\n \n return ret\n end",
"def to_a\n [ @content_type, @extensions, @encoding, @system, @obsolete, @docs,\n @url, registered? ]\n end",
"def index\n @contents = Content.all\n end",
"def index\n @contents = Content.all\n end",
"def index\n @specific_contents = SpecificContent.all\n end",
"def data_array\n completed_array = []\n slugs.each_with_index do |slug, index|\n completed_array << {slug: slug, content: contents[index]}\n end\n completed_array\n end",
"def index\n @contents = Content.all\n render json: @contents\n end",
"def array\n self.allObjects\n end",
"def get_content_objects(as = :models) \n query = \"is_part_of_ssim:#{full_pid}\"\n row_count = ActiveFedora::SolrService.count(query)\n results = ActiveFedora::SolrService.query(query, rows: row_count)\n parse_return_statement(as, results)\n end",
"def index\n # @contents = Content.all\n end",
"def index\n @content_urls = ContentUrl.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @content_urls }\n end\n end",
"def getObjects\n readObjects\n\n return @Objects\n end",
"def index\n\t\t# All Content tags\n\t\tcontents = ContentTag.all\n\t\trender json: contents\n\tend",
"def objects\n @objects ||= []\n end",
"def contents\n children.select { |child| child.is_a? DocumentContent }\n end",
"def index\n @contents = Content.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @contents }\n end\n end",
"def featured_content_list\n list = []\n self.div(:id=>\"featuredcontent_content_container\").links(:class=>/featuredcontent_content_title/).each do |link|\n list << link.text\n end\n return list\n end",
"def get\n @contents\n end",
"def content\n return @content if @content\n matches = class_const(:CONTENT_RE).match(page)\n if matches\n @content = class_const(:KILL_CHARS_RE).gsub(matches[1].to_s, '')\n content_processor\n @content.collect! { |p| decode_entities(p.strip) }\n @content.delete_if { |p| p == '' or p.nil? }\n end\n @content = [] if @content.nil?\n @content\n end",
"def content_to_render\n\t\t\tcontent_to_render = []\n\n\t\t\t@wiki_query.pages.each do |key, page|\n\t\t\t\tcontent_to_render << get_content_needed(key, page)\n\t\t\tend\n\n\t\t\tcontent_to_render\n\t\tend",
"def index\n\n @contents = Content.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @contents }\n end\n end",
"def index\n @contents = Content.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @contents }\n end\n end",
"def objects\n @objects ||= []\n end",
"def entries\n return Array(@entries)\n end",
"def content\n @content ||= parts.map(&:response).join(\"\\n\")\n end",
"def related_content\n list = []\n self.div(:class=>\"relatedcontent_list\").links.each do |link|\n list << link.title\n end\n return list\n end",
"def load_content(post_type)\n content = []\n q = @db.query(\"select distinct *\n from wp_posts as p\n where p.post_type = '#{post_type}' and p.post_status = 'publish'\n order by id desc\")\n\n q.each_hash do |p|\n post = OpenStruct.new(p)\n post.categories = self.post_categories(post.ID).map { |c| @categories[c] }\n post.comments = self.post_comments(post.ID)\n content.push post\n end\n\n return content\n end",
"def index\n @content = content_type_from_controller(self.class)\n .where(user_id: current_user.id)\n .order(:name)\n\n @content = @content.where(universe: @universe_scope) if @universe_scope.present? && @content.build.respond_to?(:universe)\n @content ||= []\n @questioned_content = @content.sample\n @question = @questioned_content.question unless @questioned_content.nil?\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @content }\n end\n end",
"def contents\n @content.clone.freeze\n end",
"def index\n @contents = Content.find(:all, :limit => 10, :order => \"created_at desc\")\n end",
"def getContent\r\n\t\t\t\t\treturn @content\r\n\t\t\t\tend",
"def getContent\r\n\t\t\t\t\treturn @content\r\n\t\t\t\tend",
"def index\n @order_contents = OrderContent.all\n end",
"def index\n @content_images = ContentImage.all\n end",
"def objects\n @objects ||= []\n end",
"def index\n @content_data = ContentDatum.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @content_data }\n end\n end",
"def items\n @items = []\n @data.each do |object_data|\n if object_data[\"type\"]\n @items << \"Skydrive::#{object_data[\"type\"].capitalize}\".constantize.new(client, object_data)\n elsif object_data[\"id\"].match /^comment\\..+/\n @items << Skydrive::Comment.new(client, object_data)\n end\n end\n @items\n end",
"def items\n parsed_contents['results'] if parsed_contents\n end",
"def get_objects\n return self.pageobjects\n end",
"def content_data\n return @content_data\n end",
"def content_data\n return @content_data\n end",
"def contents\n @contents ||= begin\n # First collect the localized content\n contents_data = localized_contents\n contents_data = [] if contents_data.blank?\n # Then grab the content that belongs directly to the page\n contents_data << non_localized_contents\n unless contents_data.blank?\n contents_data = contents_data.flatten.sort{|a,b| a.section_position <=> b.section_position}\n end\n end\n @contents\n end",
"def script_content\n puts \"pushing each_scene to Script.content\"\n #full_script = self.scenes.map #instead of below, just make script content same as scenes?!!?!?!??!\n full_script = self.scenes.map do |each_scene| #full_script is an array of strings\n each_scene #return array of objects, instead of array of text\n end\n end",
"def localized_contents\n @contents ||= begin\n Content.content_associations.inject([]) do |memo, assoc|\n memo += send(assoc).all_with_localization(:page_localization_id => current_localization.id)\n end\n end\n end",
"def content\n @content ||= parts.map(&:body).join(\"\\n\")\n end",
"def index\n @content_pages = ContentPage.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @content_pages }\n end\n end",
"def content_descriptions\n return nil if description.blank?\n description['contents']\n end",
"def entity_objects\n ProjectMedia.where(id: self.entities).to_a\n end",
"def content\n\t\treturn GridCreator.fromArray(self.contents, :horizontal => true)\n\tend",
"def render\n parts.map(&:content)\n end",
"def contentByType( type )\n\t\tcontent = nil\n\t\[email protected]_index { |i|\n\t\t\tif @content[i].type == type\n\t\t\t\tcontent = @content[i]\n\t\t\tend\n\t\t}\n\t\tcontent\n\tend",
"def items\n items = []\n iter = @obj.items\n\n while (i = iter.next)\n items << i\n end\n\n items\n end",
"def content\n @content ||= if valid_attrs?(:content_id, :content_type)\n Object.const_get(content_type).find_by_id(content_id)\n end\n end",
"def note_contents\n self.notes.each.map{|note| note.content}\n end",
"def contents_fields\n []\n end",
"def content\n @content \n end",
"def eContents\r\n if @_contained_elements\r\n @_contained_elements.dup\r\n else\r\n []\r\n end\r\n end",
"def index\n @content_providers = ContentProvider.find(:all, :order => \"name\")\n respond_to do |format|\n format.html # list.html.erb\n format.xml { render :layout => 'none' }\n format.json { render :json=> @content_providers }\n end\n end",
"def index\n @contents = Content.order('created_at DESC').paginate(:page => params[:page], :per_page => 20)\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @contents }\n end\n end",
"def index\n @contents = Content.site_text_items(@site.id)\n end",
"def index\n return @content.index\n end",
"def content_items\n edition.content_items.where(group_id: id)\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 note_contents\n self.notes.collect {|note| note.content}\n end",
"def list_container_content (container_uri)\n all_files =[]\n # Parse Webpage response and extracting files details\n doc = Nokogiri::XML(URI.open(\"#{container_uri}\"))\n doc.xpath(\"//Blob\").each do |item|\n # look at each item\n name = item.xpath(\"Name\").text\n url = item.xpath(\"Url\").text\n size = item.xpath(\"Size\").text.to_i\n # add to our array\n all_files << { :name=>\"#{name}\", :url => \"#{url}\", :size => \"#{size}\" }\n end\n return all_files\n end",
"def content_types\n return @content_types\n end",
"def objects\n @objects ||= begin\n raw_objects = @data['objects'] || []\n raw_objects.map do |object|\n if object.is_a?(Hash)\n # TODO: assumes it has the right keys.\n object\n else\n {\n item: object,\n description: nil\n }\n end\n end\n end\n end",
"def objects\n return @objects unless @objects.nil?\n objs = []\n dict = @instance.getDictionary\n (0 ... dict.getChildCount).each do |i|\n obj = dict.getChildAt(i)\n objs << {\n :name => obj.getName,\n :qual => obj.getQualification.toString.downcase.to_sym,\n :type => obj.getType.toString.downcase.to_sym,\n :object => obj,\n }\n end\n @objects = objs\n end",
"def serialized_content\n resources = ActiveModel::ArraySerializer.new(Post.published.sorted).as_json | ActiveModel::ArraySerializer.new(Tweet.published.sorted).as_json\n\n resources.sort_by { |i| i[:published_date] }.reverse\n end",
"def sub_content \n sub_contents = []\n\n if @is_post == false\n root_regexp = Regexp.new(@root, Regexp::IGNORECASE)\n sub_directories = Dir.glob(@absolute_path + '*');\n\n sub_directories.each do |sub_directory|\n begin\n # Remove the root from the path we pass to the new Content instance.\n # REVIEW: Should we be flexible and allow for the root dir to be present?\n content = Content.new(sub_directory.sub(root_regexp, ''))\n sub_contents.push(content)\n rescue ArgumentError\n next\n end\n end\n end\n\n sub_contents.reverse\n end",
"def next_contents(count=1)\n if @store.length < count\n content = content()\n @store += content.collect{|c| c.id}\n end\n return [] if @store.empty?\n content_ids = @store.shift(count)\n return Content.where(:id => content_ids)\n end",
"def related_content(options = {})\n api_url = \"/collections/#{self.collection.attributes[:token]}/pages/#{@attributes[:identifier]}/related\"\n response = @muddyit.send_request(api_url, :get, options, nil)\n results = []\n response.each { |result|\n # The return format needs sorting out here .......\n results.push :page => @attributes[:collection].pages.find(result['identifier']), :count => result['count']\n }\n return results\n end",
"def content_index\n @magissue = Magissue.find(params[:id])\n # Initiate the array of contents' links\n a = []\n\n # Insert the link to the cover first\n a << {\"url\" => cover_magissue_url, \"title\" => \"Cover\", \"hidden\" => true}\n\n\n # Insert the link to the toc\n a << {\"url\" => toc_magissue_url, \"title\" => \"TOC\", \"hidden\" => true}\n\n # Insert the links to all the magissues's articles\n @magissue.articles.each do |article|\n entry = {\"url\" => read_article_url(article), \"title\" => article.headline, \"byline\" => article.author,\n \"thumb\" => (article.assets.exists? ? article.assets[0].dynamic_asset_url(\"40x40>\") : \"\")}\n a << entry\n end\n\n # Create the \"contents\" object and and associate the links array to it.\n b = {\"contents\" => a}\n\n # Render the response as JSON\n respond_to do |format|\n format.json { render :json => b }\n end\n end",
"def contents\n self.content\n end",
"def content_types\n ContentTypes.new(self)\n end",
"def items\n result = []\n each_item { |item| result.push(item) }\n result\n end",
"def items\n return @items\n end",
"def items\n return @items\n end",
"def content\n return @content\n end",
"def content\n return @content\n end",
"def content\n return @content\n end",
"def content\n return @content\n end",
"def content\n return @content\n end",
"def content\n return @content\n end",
"def index\n @content_condos = ContentCondo.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @content_condos }\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"
] | [
"0.74823767",
"0.7383836",
"0.73720443",
"0.7314305",
"0.72937274",
"0.7222643",
"0.70200545",
"0.6971542",
"0.6869591",
"0.68611676",
"0.67865294",
"0.6771617",
"0.66984236",
"0.6658677",
"0.6644731",
"0.66279995",
"0.6610689",
"0.65894824",
"0.65894824",
"0.6584376",
"0.6573798",
"0.6546798",
"0.6540732",
"0.6534308",
"0.64921975",
"0.64847106",
"0.64563507",
"0.64541805",
"0.6450628",
"0.64363635",
"0.64156175",
"0.6398196",
"0.6383924",
"0.6373498",
"0.6373204",
"0.63644457",
"0.63618344",
"0.63460255",
"0.6307859",
"0.62723047",
"0.62716174",
"0.6263592",
"0.62542045",
"0.6218222",
"0.6216597",
"0.6211872",
"0.6211872",
"0.6204053",
"0.61934245",
"0.6193012",
"0.6182735",
"0.61807996",
"0.6180378",
"0.6170292",
"0.6150512",
"0.6150512",
"0.6135119",
"0.61257064",
"0.6113117",
"0.61105645",
"0.6110047",
"0.6102336",
"0.6093786",
"0.6068248",
"0.6066199",
"0.60656077",
"0.6063482",
"0.60569257",
"0.60568863",
"0.6052334",
"0.6051756",
"0.6047084",
"0.60461444",
"0.6041632",
"0.60348946",
"0.6033454",
"0.60327727",
"0.60297996",
"0.6028764",
"0.602721",
"0.60210866",
"0.6019259",
"0.6015513",
"0.6008404",
"0.6006103",
"0.6003171",
"0.59999514",
"0.59928924",
"0.5990646",
"0.5989792",
"0.5987168",
"0.5982689",
"0.5982689",
"0.5975795",
"0.5975795",
"0.5975795",
"0.5975795",
"0.5975795",
"0.5975795",
"0.59729505",
"0.5972331"
] | 0.0 | -1 |
Scans the filenames (keys) and uses fnmatch to find maches | def find(pattern)
patterns= [pattern].flatten
contents=[]
self.each_pair do |path, content|
patterns.each do |pattern|
contents << content if Content.path_match? path, pattern
end
end
contents
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def [] files\n # This stores all our matches\n match_hash = {}\n\n # Go through each file, check if the file basename matches the regexp.\n files.each do |f|\n path, file = File.split(f)\n\n if (m = match_against(file))\n replacement = populate_based_on(m)\n match_hash[f] = if path == '.'\n replacement\n else\n File.join(path, replacement)\n end\n end\n end\n match_hash\n end",
"def fnmatch( pattern, *args ) File.fnmatch( pattern, self, *args ) end",
"def fnmatch(pattern, *args) File.fnmatch(pattern, @path, *args) end",
"def fnmatch(pattern, *args) File.fnmatch(pattern, path, *args) end",
"def file_match(file)\n end",
"def glob_match (filenames, pattern)\n\t# Escape the '*', '?', and '.' characters\n\tpattern.gsub!(/[\\*\\?\\.]/, '*' => '.*', '?' => '.', '.' => '\\.') \t\n\tregex = Regexp.new(pattern)\n\t#select returns a new array\n\tfilenames.select do |filename|\n\t\tfilename =~ regex\n\tend\nend",
"def files_filtering files\n return files unless @file_regexp\n f = files.select do |file|\n test_name_by_date file\n end\n f\n end",
"def map_files\n file_map = {}\n entry_file = Pathname.new(map_entry)\n entry_found = false\n case @files\n when Hash\n @files.each do |path, file|\n file_map[path.to_s] = File.expand_path(file.to_s)\n entry_found = true if path.to_s==entry_file.to_s\n end\n else\n base_paths = @base_paths.collect {|path| Pathname.new(path).expand_path }\n @files.each do |fn|\n next unless fn\n relpath = strip_path(base_paths, fn) || fn\n file_map[relpath.to_s] = File.expand_path(fn.to_s)\n entry_found = true if relpath==entry_file\n end\n end\n file_map[entry_file.to_s] = File.expand_path(@entry_file.to_s) unless entry_found\n file_map\n end",
"def read_files\n Dir['*', '*/*'].group_by { |f| f.ext || :_dir }.to_symkey\n end",
"def glob_match(filenames, pattern)\n\t\n\tnewPattern = pattern.gsub( '*', '.*').gsub( '?', '.')\n\n\treturn filenames.select{|i| i.match(/#{newPattern}/)}\n\t\nend",
"def resolve_as_file_pattern name\n pattern = /(?:\\b|_)#{Regexp.escape name}(?:\\b|_)/\n all_matching_files.select {|p| p =~ pattern }\n end",
"def resolve_as_file_pattern name\n pattern = /(?:\\b|_)#{Regexp.escape name}(?:\\b|_)/\n all_matching_files.select {|p| p =~ pattern }\n end",
"def search\n Dir.glob(@config.target_file_pattern, File::FNM_CASEFOLD).each do |file_path|\n next if FileTest.directory?(file_path)\n\n extension = get_extension(file_path)\n tokens = get_tokens(file_path, extension)\n search_romaji(extension, tokens, file_path)\n end\n\n nil\n end",
"def check_globs(filename)\r\n basename = File.basename(filename)\r\n found = @globs.each_key.select { |pattern| File.fnmatch pattern, basename }\r\n\r\n if found.empty?\r\n downcase_basename = basename.downcase\r\n found = @globs.each_key.select { |pattern|\r\n File.fnmatch pattern, downcase_basename\r\n }\r\n end\r\n\r\n @globs[found.max]\r\n end",
"def extract_filenames(source, filepath, filelist)\n case source.class.to_s\n when 'String'\n filelist << filepath + source\n filepath = ''\n when 'Array'\n source.each do |item|\n extract_filenames(item, filepath, filelist)\n end\n when 'Hash'\n source.each do |key, value|\n filepath << key + '/'\n extract_filenames(value, filepath, filelist)\n end\n end\n filelist\n end",
"def glob_match(filenames, pattern)\n pattern = pattern.gsub(/[\\*\\?\\.]/, '*' => '.*', '.' => '\\.', '?' => '.')\n regex = Regexp.new(pattern)\n filenames.select do |filename|\n filename =~ regex\n end\nend",
"def edit_matched_files(*match, &block)\n match.each do |m|\n if Pathname.new(m).absolute?\n path = m\n else\n path = File.join(File.expand_path(TARGET_PATH), m)\n end\n puts \"path: #{path}\"\n\n Dir.glob(path).each do |file|\n block.call(Content.create(file))\n end\n end\nend",
"def find_metadata(*args)\n @files.select { |m| m.match?(*args) }\n end",
"def files_named(name_pattern, minimum_size)\n @top_level.select do |fso|\n fso['type'] == 'file' && fso['name'].match(name_pattern) &&\n fso['size'] >= minimum_size\n end\n end",
"def scan(dir,match=/\\.cha$/)\n files = []\n if not dir.split('/').pop =~ /^\\./ and File.directory?(dir)\n Dir.foreach(dir) do |file|\n path = File.join(dir,file)\n \n if File.directory?(path)\n# puts \"SCANNING #{path}\"\n scan(path,match).each { |pair| files.push pair }\n elsif file =~ match\n files.push path\n end\n end\n end\n\n return files\nend",
"def fnmatch?( pattern, *args ) File.fnmatch?( pattern, self, *args ) end",
"def get_local_files regexp\n Dir[File.join(dir, '*')].select do |path|\n name = File.basename path\n File.file?(path) and name =~ regexp\n end\n end",
"def getFilePattern(filePattern)\n return if filePattern.nil?\n File.split(filePattern).inject do |memo, obj| \n File.join(memo, obj.split(/\\./).join('*.'))\n end\nend",
"def find_files(search_pattern, opts = {})\n Dir.chdir(@top_dir)\n Dir.glob(\"**/*#{search_pattern}*\").map do |path|\n next if File.directory?(path)\n next unless File.readable?(path)\n begin\n mt = mime_type_for_file(path)\n {\n name: path,\n url: get_url_for_path(path),\n mime_type: mt,\n size: File.size(path)\n }\n rescue\n debug \"Can't seem to look at '#{path}'\"\n nil\n end\n end.compact\n end",
"def files() = files_path.glob('**/*')",
"def find_assembly_files\n start_dir = self.location\n #logger.debug(\"self is #{self.inspect}\")\n #logger.debug(\"checking in location #{start_dir}\")\n files = Hash.new\n if ! File.directory? start_dir then\n errors.add(:location, \"Directory #{start_dir} does not exist on the system.\")\n #abort(\"Directory #{start_dir} does not exist on the system for #{self.inspect}\")\n return []\n end\n #logger.error(\"start dir is #{start_dir}\")\n Find.find(start_dir) do |path|\n filename = File.basename(path).split(\"/\").last\n skip_flag = 0\n FILE_SKIPS.each { |filepart, filehash| \n type = filehash[\"type\"]\n category = filehash[\"category\"]\n if category == 'suffix' then\n if (filename.match(\"#{filepart}$\")) then\n skip_flag = 1\n end\n else \n if (filename.match(\"#{filepart}\")) then\n skip_flag = 1\n end\n end\n\n }\n if (skip_flag == 1) then\n logger.error(\"Skipping file #{filename} because it matches a file skip\")\n next\n end\n FILE_TYPES.each { |filepart, filehash| \n\t type = filehash[\"type\"]\n\t vendor = filehash[\"vendor\"]\n if filename.match(filepart) then \n #logger.error(\"filename is #{filename}\")\n files[type] = Hash.new\n\t files[type][\"path\"] = path\n\t files[type][\"vendor\"] = vendor\n end\n }\n end\n return files\n end",
"def expand_files map, config\n files = Array.new\n if config.has_key? map\n config[map].each do |v|\n m = /^\\/.*/.match v #starts with /, otherwise it's a group name\n if m\n files << m.to_s\n else\n files + (expand_files m.to_s, config)\n end\n end\n end\n return files\nend",
"def scan_file(path)\n keys = []\n File.open(path, 'rb') do |f|\n f.read.scan(pattern) do |match|\n key = extract_key_from_match(match, path)\n keys << key if valid_key?(key)\n end\n end\n keys\n end",
"def search_filenames\n # * => all files\n # r => search from its subdirectories\n # i => ignore cases\n # l => list file name\n # c => show word occurence count\n # w => words\n\n args = set_args\n # grep -ril '#keyword1' --include=\\*.rb *\n `grep -ril '#{args}' #{search_extension} *`\n end",
"def ls(pattern='**/*', _opts={})\n Enumerator.new do |y|\n @files.each_key do |key|\n y << key if File.fnmatch?(pattern, key, File::FNM_PATHNAME)\n end\n end\n end",
"def matches(ext); end",
"def regex_files(files, regex=nil)\n array = files.nil? ? [] : files\n if !files.nil? && !regex.nil?\n exp = Regexp.new(regex)\n array = files.select do |file|\n file_name = File.basename(file, \".*\")\n match = exp.match(file_name)\n !match.nil? # return this line\n end\n end\n return array\nend",
"def parse_files(files, opts = {})\n opts = { :extension => nil, :directory => nil }.merge opts\n files = [files] unless files.is_a?(Array)\n search_text = files.join(\" \")\n parsed_files = []\n while !files.empty?\n file = files.shift\n unless opts[:directory].nil?\n file = opts[:directory] + \"/\" + file\n end\n unless opts[:extension].nil?\n file = file.sub(/\\.[^\\\\\\/]*$/, \"\") + \".\" + opts[:extension].to_s.tr(\".\", \"\")\n end\n parsed_files += Dir.glob(File.expand_path(file))\n end\n puts I18n.t(:no_match) % search_text if parsed_files.empty?\n parsed_files.uniq\n end",
"def get_all_mediatype_files\n puts \"Searching for files in #{directory_tree}\"\n # Rewrote to use absolute search paths because FakeFS chokes on Dir.chdir\n matching_files = []\n @extensions.each do |ex|\n search_for = File.join(directory_tree, \"**\", '*' + ex) # example: \"/home/xavier/Tech/Docs/**/*.pdf\"\n matching_files.concat(Dir.glob(search_for))\n end\n #puts \"Found these files: \" + matching_files.to_s\n convert_to_pathnames(matching_files).delete_if { |file| file.dirname.to_s == mediatype_dirname.to_s }\n end",
"def find_files\n result = {}\n targets = ['app'] # start simple\n targets.each do |target|\n order = []\n Find.find(target) do |f|\n next if test ?d, f\n next if f =~ /(swp|~|rej|orig)$/ # temporary/patch files\n next if f =~ /(\\.svn|\\.git)$/ # subversion/git\n next if f =~ /\\/\\.?#/ # Emacs autosave/cvs merge files\n filename = f.sub(/^\\.\\//, '')\n\n result[filename] = File.stat(filename).mtime rescue next\n end\n end\n \n self.files = result\n end",
"def searchFile(articule, get_dir, out_dir)\n return_arr = []\n get_dir.each do |filename|\n if (articule == File.basename(filename).chomp.slice(/^\\w+/))\n FileUtils.cp(filename, out_dir + File.basename(filename))\n puts \"#{articule} is finded #{File.basename(filename)}\"\n return_arr[0] = true\n return_arr[1] = File.basename(filename)\n else\n return_arr[0] = false\n return_arr[1] = \"Sorry but image for art. #{articule} isn't finding\"\n end\n end\n return return_arr\nend",
"def matchFn(filename)\n\treturn [\".txt\", \".pdf\"].include? File.extname(filename)\nend",
"def find_files dir = test_dir\n glob file_pattern(dir)\n end",
"def find_files(pattern)\n Dir[File.join(folder, pattern, \"*.#{pattern}\")].sort{|f1, f2|\n File.basename(f1) <=> File.basename(f2)\n }.collect{|f|\n File.join(pattern, File.basename(f))\n }\n end",
"def match(glob, &block)\n yield @filename\n end",
"def do_stuff_with_files(extension=\".rb\")\n start_dir = START_PATH\n Dir.each_child(\"./\") do |file|\n if File.file?(file)\n keyword = find_keyword(file, extension)\n next unless keyword\n key = make_key(keyword)\n key_path = search_for_path(start_dir, key, keyword)\n next unless key_path\n unless key_location_exist?(key_path)\n FileUtils.mkdir(key_path)\n end\n FileUtils.mv file, key_path\n end\n end\nend",
"def process_globs(globs); end",
"def findFiles(mamaDirectory, fileExtension)\r\n\t$logger.debug { \": Looking for '\" + fileExtension + \"' in '\" +\r\n\t\tmamaDirectory + \"' ...\" }\r\n\t# Rather than get all recursive, just check a couple levels down.\r\n\t# If the files aren't within those levels, there's a problem.\r\n\textFiles = Dir.glob mamaDirectory + \"/*\" + fileExtension\r\n\textFiles += Dir.glob mamaDirectory + \"/*/*\" + fileExtension\r\n\textFiles += Dir.glob mamaDirectory + \"/*/*/*\" + fileExtension\r\n\tif (extFiles.size <= 0)\r\n\t\t$logger.debug { \" No files found!\" }\r\n\t\treturn nil;\r\n\tend\r\n\treturn extFiles\r\nend",
"def search_new_key(key)\n _key = key\n if get_file(key).present?\n (1..999).each do |i|\n _key = key.cama_add_postfix_file_name(\"_#{i}\")\n break unless get_file(_key).present?\n end\n end\n _key\n end",
"def fnmatch?(pattern, *args) File.fnmatch?(pattern, @path, *args) end",
"def findAttachmentFiles()\n @attachments = Array.new\n pngFiles = Dir[\"*.png\"]\n\n pngFiles.each do |file|\n# if !file.match(/DistributionOfN.png/)\n @attachments << file\n# end\n end\n end",
"def match_against filename\n @regexp.match(filename)\n end",
"def manifested_files\n manifest_files.inject([]) do |acc, mf|\n files = File.open(mf) { |io|\n io.readlines.map do |line|\n _digest, path = line.chomp.split(/\\s+/, 2)\n decode_filename(path)\n end\n }\n\n (acc + files).uniq\n end\n end",
"def matches(_ext); end",
"def matches(_ext); end",
"def filter_files(pattern)\n regexp=Regexp.new(pattern || '.*')\n @[email protected]([]) do |matches,file| \n file_without_basepath=file[@basepath.length .. -1]\n matches << file if file_without_basepath=~regexp\n matches\n end\n @table.reloadData\n end",
"def zip_entries_matching(zipfile, file_pattern)\n files = []\n Zip::File.open(zipfile) do |zip_file|\n zip_file.each do |entry|\n files << entry.name if entry.name.force_encoding(\"utf-8\").match file_pattern\n end\n end\n files\n end",
"def fnmatch?(pattern, *args) File.fnmatch?(pattern, path, *args) end",
"def match_parameters(fullpath)\n Dir.foreach(fullpath) do |parametername|\n\n filepath = \"#{fullpath}/#{parametername}\"\n next if File.basename(filepath) =~ /^\\./ # skip over dotfiles\n\n next unless File.directory?(filepath) and\n File.readable?(filepath) # skip over non-directories\n\n log(\"Considering contents of #{filepath}\")\n\n Dir.foreach(\"#{filepath}\") do |patternfile|\n secondlevel = \"#{filepath}/#{patternfile}\"\n log(\"Found parameters patternfile at #{secondlevel}\")\n next unless File.file?(secondlevel) and\n File.readable?(secondlevel)\n log(\"Attempting to match [#{@hostname}] in [#{secondlevel}]\")\n if matched_in_patternfile?(secondlevel, @hostname)\n @parameters[ parametername.to_s ] = patternfile.to_s\n log(\"Set @parameters[#{parametername}] = #{patternfile}\")\n end\n end\n end\n end",
"def addSrcFilesByRE(re)\n Dir.for_each(@srcDir) { |f|\n next if File.stat(f).dir?\n @files << f if re =~ f\n }\n end",
"def glob(match)\n paths = Array.new(match) # Force array-ness\n\n paths.map! do |spec|\n if spec.include?('*')\n files.select do |file, _|\n # Dir#glob like source matching\n File.fnmatch?(spec, file, File::FNM_PATHNAME | File::FNM_DOTMATCH)\n end.sort\n else\n [spec, files[spec]]\n end\n end\n\n Hash[*paths.flatten]\n end",
"def check_file\n @files.each do |file|\n case \n when file.fnmatch(\"*Verbale autorizzativo*\") then check_verbale(estrai_allegato(file))\n when file.fnmatch(\"*Prezzi_Offerte*\") then check_controllo_offerte(file)\n when file.fnmatch(\"*Validate_Eni*\") then check_offerte(file)\n when file.fnmatch(\"*Esitate_Eni*\") then check_offerte(file)\n when file.fnmatch(\"*ProgrFisica*\") then check_offerte_pce(file)\n when file.fnmatch(\"*Scheduling & Bilateral Program*\") then check_scheduling_bilateral(file)\n when file.fnmatch(\"*tool autorizzazione offerte belpex*\") then check_tool_belgio(file)\n when file.fnmatch(\"*Export E-prog46_ita.xls\") then check_tool_olanda(file) \n when file.fnmatch(\"*Validate_*_*.docx\") then check_validate_epex(file) \n when file.fnmatch(\"*Esitate_Francia_*.csv\") then check_esitate_epex(file)\n when file.fnmatch(\"*Esitate_Germania_*.csv\") then check_esitate_epex(file) \n when file.fnmatch(\"*Esitate_Svizzera_*.csv\") then check_esitate_epex(file) \n else\n\n end\n end\n end",
"def all_apf_finder( path_and_file = self.file_name_and_contents.path_and_file, all_apf_arr = [] )\n apf_files = find_apf( path_and_file )\n if apf_files.count > 0\n all_apf_arr << apf_files\n apf_files.each do |apf_file|\n if File.exists? apf_file\n path_and_file = apf_file\n all_apf_finder( path_and_file, all_apf_arr )\n else\n if self.hints_hash['file_does_not_exist']\n self.hints_hash['file_does_not_exist'] << apf_file\n else\n self.hints_hash = self.hints_hash.merge( 'file_does_not_exist' => [ apf_file ] )\n end\n end\n end\n end\n all_apf_arr\n end",
"def populate_list_of_files_from_file(file_list, entry)\n logger.debug \"\\\"#{entry}\\\" is a file. Processing...\"\n file_list << entry\n # Find images if any\n Find.find(File.dirname(entry)) do |file|\n file_list << file if (File.file?(file) && is_image?(file))\n end\n end",
"def getFileValue(rootDir, keyword, delegates=Array.new)\n files = Dir[\"#{rootDir}/*\".gsub(\"//\",\"/\")]\n\n files.each do |file|\n if File.directory? file\n delegates = getFileValue(file, keyword, delegates) \n else\n basename = File.basename(file)\n if basename.downcase.start_with? keyword.downcase\n delegates.push file \n end\n end\n end\n return delegates\nend",
"def find_file_named name\n @files_hash[name]\n end",
"def manifested_files\n\n manifest_files.inject([]) do |acc, mf|\n\n files = open(mf) do |io|\n\n io.readlines.map do |line|\n digest, path = line.chomp.split /\\s+/, 2\n path\n end\n\n end\n\n (acc + files).uniq\n end\n\n end",
"def lookup_map\n @lookup_map ||= begin\n gpath = directory.join(\"**/*.#{extension_name}\")\n\n Pathname.glob(gpath).each_with_object({}) do |path, map|\n map[ key_from_path(path) ] = path\n end\n end\n end",
"def run_find_missing_keys\n @key_hash = Hash.new\n @missing_keys = Array.new\n @white_list = Hash.new\n get_args\n get_files_directory(@file_to_check)\n check_missing_keys\nend",
"def find_apf( path_and_file = self.file_name_and_contents.path_and_file)\n match_apf = []\n regexp = /^t([^ \\#]+)( *$| )/\n File_name_and_contents.new( path_and_file ).contents.each do |line|\n if line.match(regexp) != nil\n if line.match(regexp)[1] != nil \n match_apf << ( self.file_name_and_contents.path_and_file.sub(/\\/.+/, '') + '/' + line.match(regexp)[1].chomp + '.apf' ) \n end\n end\n end\n match_apf\n end",
"def retrieve_files_in_main_dir\n ensure_file_open!\n @file.glob('*').map do |entry|\n next if entry.directory?\n\n entry_file_name = Pathname.new(entry.name)\n [entry_file_name, entry.get_input_stream(&:read)]\n end.compact.to_h\n end",
"def file_match(file)\n {:filename => file, :matched => file, :line => 1, :column => 1}\n end",
"def execute_files(files, terms, dir, i=0)\n key_terms = get_words(terms)\n if terms.size == 1\n puts terms\n files.select{|x| File.basename(x).start_with?(terms[0])}.each_with_index do |f, index|\n execute_file dir, files, f, index, terms\n end\n files.select{|x| !File.basename(x).start_with?(terms[0])}.each_with_index do |f, index|\n execute_file dir, files, f, index, terms\n end\n else\n files.each_with_index do |f, index|\n execute_file dir, files, f, index, terms\n end\n end \n end",
"def files\n @files ||= lambda {\n sorted_relevant_files = []\n\n file_globs.each do |glob|\n current_glob_files = Pathname.glob(glob)\n relevant_glob_files = relevant_files & current_glob_files\n\n relevant_glob_files.map! do |file|\n File.new(path: file,\n namespaces: namespaces,\n decryption_keys: decryption_keys,\n encryption_keys: encryption_keys,\n signature_name: signature_name)\n end\n\n sorted_relevant_files += relevant_glob_files\n end\n\n sorted_relevant_files.uniq\n }.call\n end",
"def takeFilesNames\nDir['result*.*'].each do |file_name|\n @files_names.push(file_name)\nend\nend",
"def all_matching_files\n @all_matching_files ||= find_files\n end",
"def all_matching_files\n @all_matching_files ||= find_files\n end",
"def files(match=nil)\n return @files unless @reload_files_cache\n\n # All\n # A buncha tuples\n tuples = @served.map { |prefix, local_path|\n path = File.expand_path(File.join(@app.root, local_path))\n spec = File.join(path, '**', '*')\n\n Dir[spec].map { |f|\n [ to_uri(f, prefix, path), f ] unless File.directory?(f)\n }\n }.flatten.compact\n\n @reload_files_cache = false\n @files = Hash[*tuples]\n end",
"def find_s3_files\n output = `s3cmd ls #{self.location}/`\n output.gsub!(/DIR/,\"\")\n output.gsub!(/ +/,\" \")\n dir_listing = output.split(/\\n/)\n logger.debug(\"dir_listing #{dir_listing.inspect}\")\n files = Hash.new\n dir_listing.each do |list|\n if (list.match(/^ /)) then\n # found a directory - not going to worry about going down the directory for now\n else\n # found a file\n (date, time, size, path) = list.split(/ /)\n filename = File.basename(path).split(\"/\").last\n FILE_TYPES.each { |filepart, filehash| \n type = filehash[\"type\"]\n vendor = filehash[\"vendor\"]\n if filename.match(filepart) then \n #logger.debug( \"filename is #{filename}\")\n files[type] = Hash.new\n files[type][\"path\"] = path\n files[type][\"vendor\"] = vendor\n end\n }\n end\n end\n logger.debug(\" files is #{files.inspect}\")\n return files\n end",
"def matchfile\n if search_image\n name_parts = search_image.filename.split('.')\n ext = name_parts.pop\n name = name_parts.join('.')\n return \"#{name}_match.#{ext}\"\n else\n return \"no_search_image.png\"\n end\n end",
"def read_pics_filenames(src_path)\n pics=[]\n files = Dir[src_path]\n files.each do |f| \n if $ty.include?(File.extname(f).to_s) # if correct extention\n pics << f\n end\n end\n return pics\nend",
"def find_matching_file_set(hash_key_for_file)\n filename = Array(params[hash_key_for_curation_concern][hash_key_for_file]).first.original_filename\n curation_concern.file_sets.select {|fs| fs.label == filename }.first\n end",
"def tests_for_file(filename)\n super.select { |f| @files.has_key? f }\n end",
"def images_for(brand, sku, type=\"jpg\")\n sku_images_path = File.expand_path(Pathname.new(@dir_path_map[brand]) + sku)\n if File.exist?(sku_images_path)\n Dir.glob(File.join(sku_images_path, \"*.#{type}\")).each do |f_path|\n #File.open(f_path)\n f_path\n end\n else\n puts \"[#{brand}] images SKU #{sku_images_path} directory not exist\"\n end\nend",
"def parse_filenames(path)\n\t\t#first if checks if it's a directory, a file or neither\n\t\tif File.directory?(path)\n\t\t\tdirname = path.chomp\n\t\t\t@files = File.join(path, \"*.vm\")\n\t\t\t@files = Dir.glob(@files)\n\t\t\t#if we have no files, there's nothing we can do, EXCEPTION\n\t\t\tif (@files.length == 0)\n\t\t\t\traise StandardError, \"No files to open\"\n\t\t\tend \n\t\t\tputs @files\n\t\t\tname = File.basename(dirname)\n\t\t\t@output = dirname + \"/\" + name + \".asm\"\n\t\telsif File.file?(path)\n\t\t\t#make sure the file is of the .vm type\n\t\t\tif (File.extname(path) == '.vm')\n\t\t\t\t#generate our output path\n\t\t\t\t@files = path\n\t\t\t\tf_path = File.split(path)[0]\n\t\t\t\tf_base = File.basename(path, '.vm')\n\t\t\t\tnFile = \"#{f_path}/#{f_base}.asm\"\n\t\t\t\t@output = nFile\n\t\t\telse\n\t\t\t\traise \"Error, cannot open this file!\"\n\t\t\tend\n\t\telse\n\t\t\traise \"ERROR, not a file or directory!\"\n\t\tend\n\t\t\n\t\t#return everything\n\t\treturn @files\n\tend",
"def fuzzy_file_match(name, limit = 'Assets', threshold = 3)\n @distances = []\n path = Pathname.new(name)\n\n # See if the file exists as specified\n if path.exist?\n @distances.push({'directory': path.parent, 'name': path.basename, 'distance': 0})\n return @distances\n end\n\n # Check if the folder that should hold 'name' exists\n # and if there is a close match to the name.\n scan_dirs(path.parent, path.basename, limit)\n @distances.sort_by! { |k| k[:distance] }\n # puts @distances\n return @distances if (@distances[0][:distance] <= threshold)\n\n # Nothing seems to match\n @distances = []\n @distances.push({'directory': nil, 'name': nil, 'distance': -1})\n return @distances\nend",
"def parse_filenames(path)\n\t\t#first if checks if it's a directory, a file or neither\n\t\tif File.directory?(path)\n\t\t\tdirname = path.chomp\n\t\t\t@files = File.join(path, \"*.vm\")\n\t\t\t@files = Dir.glob(@files)\n\t\t\t#if we have no files, there's nothing we can do, EXCEPTION\n\t\t\tif (@files.length == 0)\n\t\t\t\traise StandardError, \"No files to open\"\n\t\t\tend\n\t\t\tname = File.basename(dirname)\n\t\t\t@output = dirname + \"/\" + name + \".asm\"\n\t\telsif File.file?(path)\n\t\t\t#make sure the file is of the .vm type\n\t\t\tif (File.extname(path) == '.vm')\n\t\t\t\t#generate our output path\n\t\t\t\t@files = path\n\t\t\t\tf_path = File.split(path)[0]\n\t\t\t\tf_base = File.basename(path, '.vm')\n\t\t\t\tnFile = \"#{f_path}/#{f_base}.asm\"\n\t\t\t\t@output = nFile\n\t\t\telse\n\t\t\t\traise \"Error, cannot open this file!\"\n\t\t\tend\n\t\telse\n\t\t\traise \"ERROR, not a file or directory!\"\n\t\tend\n\n\t\t#return everything\n\t\treturn @files\n\tend",
"def processFile dir\n\tdir.each do |file|\n\t\tif File.directory?(file) then next;\n\t\t\telse \n\t\t\t\th = {File.basename(file) => getHash(file)}\n\t\t\t\[email protected]!(h)\n\t\tend\n\tend\n\t@hash\nend",
"def find_files(base_dir, flags); end",
"def find_file( *args )\n args.each {|fn| return fn if test(?f, fn)}\n args.first\n end",
"def find_file_by_text (start_dir, file_mask=\"*.*\", text_pattern='')\n match_files = Dir[ File.join(start_dir.split(/\\\\/), \"**\", file_mask)]\n if match_files.length > 0\n file_path = nil\n match_files.each do |file|\n matching_text = File.read(file).include?(text_pattern) rescue false\n if matching_text\n file_path = file\n break\n end\n end\n p \"#{file_path ? 'First searching file is: '+file_path : 'No files found'}\"\n else\n \"No files with mask '#{file_mask}' in directory '#{start_dir}'\"\n end\n end",
"def find_files(dir, pattern, &block)\n require 'find'\n\n Find.find(dir) do |p|\n if p =~ Regexp.compile(pattern)\n yield p\n end\n end\nend",
"def find_files(search_pattern, opts = {})\n raise \"Missing implementation\"\n end",
"def find_files(search_pattern, opts = {})\n raise \"Missing implementation\"\n end",
"def files( starts_with: )\n msg_handler.bold_debug [ msg_handler.here,\n msg_handler.called_from,\n \"starts_with=#{starts_with}\",\n \"\" ] if msg_handler.debug_verbose\n rv = Dir.glob( \"#{starts_with}*\", File::FNM_DOTMATCH )\n msg_handler.bold_debug [ msg_handler.here,\n msg_handler.called_from,\n \"files.size=#{rv.size}\",\n \"\" ] if msg_handler.debug_verbose\n return rv\n end",
"def files\n filename = Dir.entries(@path).find_all {|file| file.include?(\".mp3\")}\n # binding.pry\n # [[\"Thundercat - For Love I Come - dance.mp3\",\n # \"Real Estate - It's Real - hip-hop.mp3\",\n # \"Action Bronson - Larry Csonka - indie.mp3\",\n # \"Real Estate - Green Aisles - country.mp3\"]]\n\n #binding.pry\n end",
"def matches_filename?(filename)\r\n basename = File.basename(filename)\r\n @glob_patterns.any? {|pattern| File.fnmatch pattern, basename.downcase}\r\n end",
"def process_globs globs\n result = globs.flat_map do |glob|\n Dir[File.join directory, glob]\n .map{ |f| f.gsub(/\\\\/, '/') }\n .select { |f| File.file?(f) }\n end\n result\n end",
"def classify_key(data, filename); end",
"def matching_files(score_min = 0)\n if (score_min == 0)\n return @matching_files\n else\n return @matching_files.select do |matching_pointer, matching_pointer_info|\n next ((matching_pointer_info.score*100)/@score_max >= score_min)\n end\n end\n end",
"def paths\n f = File.open(@path)\n f.grep(FILE_NAME_PATTERN) { $1 }\n end",
"def for_files(*wildcards)\n wildcards.each do |wildcard|\n Dir[wildcard].each do |fn|\n yield(fn)\n end\n end\n end",
"def for_files(*wildcards)\n wildcards.each do |wildcard|\n Dir[wildcard].each do |fn|\n yield(fn)\n end\n end\n end",
"def filepaths_from *types, &block\n expr = last_option(types)[:matching]\n the_files = types.inject([]) do |files, type|\n method = :\"#{type}_files\"\n files_found = send(method, expr) if respond_to?(method)\n files_found = RailsAssist::Artifact::Files.send(method, expr) if RailsAssist::Artifact::Files.respond_to?(method)\n files + files_found\n end.compact\n yield the_files if block\n the_files\n end",
"def file_paths\n Dir.glob(@filepath_pattern).sort\n end",
"def find_files(query, extension=nil)\n search_key = \"#{query}.#{extension}\"\n $cached_findings ||= Hash.new([])\n if $cached_findings[search_key].size > 0\n return $cached_findings[search_key]\n end\n \n # TODO: Cache this method\n query = absolute_to_relative(query)\n query = query.gsub(\"../\", \"\")\n regex = regex_for(query, extension)\n\n matches = all_filenames.to_a.select { |filename|\n match = filename =~ regex\n (File.extname(filename) != \"\" || extension.nil?) && (match)\n }.sort_by {|filename|\n filename.to_s\n }.sort_by { |filename|\n\n basename = File.basename(filename)\n match = basename == [filename, extension].compact.join(\".\")\n partial_match = basename == [\"_\"+query, extension].compact.join(\".\")\n\n score = filename.split(query).join.length\n\n if match\n score\n elsif partial_match\n score + 10\n else\n score + 100\n end\n\n }\n $cached_findings[search_key] = matches\n # If we query with a *, return all results. Otherwise, first result only.\n query.include?('*') ? $cached_findings[search_key] : $cached_findings[search_key][0..0]\n end"
] | [
"0.71927226",
"0.68013054",
"0.66792953",
"0.6646147",
"0.66382146",
"0.6477008",
"0.63355696",
"0.63240385",
"0.63197905",
"0.6228209",
"0.6207012",
"0.6207012",
"0.61748576",
"0.61735636",
"0.61734897",
"0.61669827",
"0.61559474",
"0.6147952",
"0.61410373",
"0.6129819",
"0.6087329",
"0.601414",
"0.60041237",
"0.59924585",
"0.5988874",
"0.59793764",
"0.5943912",
"0.59400284",
"0.59222335",
"0.59203947",
"0.5911365",
"0.58826065",
"0.5867479",
"0.58581793",
"0.58499706",
"0.5846487",
"0.5834922",
"0.5831902",
"0.58260584",
"0.5819638",
"0.58173764",
"0.58138937",
"0.58089596",
"0.5797567",
"0.5792403",
"0.57829225",
"0.5771523",
"0.5771259",
"0.5769276",
"0.5769276",
"0.5763702",
"0.57481265",
"0.5747408",
"0.5744985",
"0.5744425",
"0.57291675",
"0.5726884",
"0.57256585",
"0.57196945",
"0.5719354",
"0.5715064",
"0.57142603",
"0.5706391",
"0.5704784",
"0.5683654",
"0.56833446",
"0.56830835",
"0.566264",
"0.56613076",
"0.5657852",
"0.5654641",
"0.5654641",
"0.5644868",
"0.5629697",
"0.56254447",
"0.56103516",
"0.56086564",
"0.56040186",
"0.5599335",
"0.55972356",
"0.55910575",
"0.55844504",
"0.55819666",
"0.557706",
"0.5572183",
"0.55714506",
"0.5569574",
"0.556682",
"0.556682",
"0.5559065",
"0.5554707",
"0.5536969",
"0.55332035",
"0.5532709",
"0.55267024",
"0.5523238",
"0.5514532",
"0.5514532",
"0.551376",
"0.5512433",
"0.55094695"
] | 0.0 | -1 |
Find isn't fuzzy for Special Content. It looks for full | def find(uri)
_try_variations_of(uri) do |path|
content= get path
return [content] unless content.nil?
end unless uri.nil?
[]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def find; end",
"def fuzzy\n find_all do |entry|\n entry.fuzzy?\n end\n end",
"def find(args, mode); end",
"def fuzzy_match_cutoff\n 0.3\n end",
"def search(word)\n \n end",
"def fuzzy_match( query )\n return self.keywords.fuzzy_match(query)\n end",
"def great_matches\n filtered_matches(partial_or_perfect: [:family_name, :first_name], perfect: [:street, :city])\n end",
"def search(word)\r\n \r\n end",
"def match_text_exact(match_string, reject = false)\n text = match_string.downcase || \"\"\n proc = Proc.new { |entry|\n title, summary, content = cleaned_content(entry)\n title.include?(text) ||\n summary.include?(text) ||\n content.include?(text)\n }\n reject ? self.entries.reject(&proc) : self.entries.find_all(&proc)\n end",
"def fuzzy_match\n return unless @keywords.any?\n\n @matches = fuzz_ball.load.find @keywords.join(\" \"), @options[:limit]\n @query = Ydl::Videos\n return if @matches.empty?\n\n # @matches.map! do |match|\n # match.push (match[1]/match[2].to_f * 100).to_i\n # end if @matches.any?\n\n @query = Ydl::Videos.with_pk_in(@matches.map(&:first))\n end",
"def find(input)\n end",
"def search(find_val)\n false\n end",
"def exact_match\n @solr_data[:exact_match]\n end",
"def search_expansions(str, pos= 0, len= -1, limit= 0)\n end",
"def search_content\n ''\n end",
"def wildcard_search_version\n 'lower(reference.citation) like ?'\n end",
"def find(items)\n query_array = query.gsub(/_/,\" \").downcase.split\n\n results = []\n items.each{ |item|\n match_all = true\n query_array.each{ |query|\n description = item.description.gsub(\"/,/\",\"~\")\n if !item.name.gsub(/_/,\" \").downcase.include?(query) and !description.gsub(/_/,\" \").downcase.include?(query)\n match_all = false\n else\n if description.gsub(/_/,\" \").downcase.include?(query)\n self.description_map[item] = map_description_part(description, query)\n else\n self.description_map[item] = if item.description.size>=30 then item.description[0..27] + \"...\" else item.description end\n end\n end\n }\n if match_all\n results.push(item)\n end\n }\n\n self.found_items = results\n if self.found_items.size == 0 and self.query.size >= 2\n suggest_other_query(items, query)\n end\n\n end",
"def found_exact?\n @found_exact\n end",
"def simple_find(text, schemes = nil)\n # if our housewife expressed a preference, use gruber\n if $uri_find_use_gruber then\n return gruber_find(text, schemes)\n end\n # else stick with the URI.extract that comes with ruby\n a = rule(text, schemes)\n return a.map { |o| o[0] }\nend",
"def article_match? (query, article_title)\n found = false\n return true if query.empty?\n temp_article = article_title.downcase\n query.each do |kw|\n pattern = Regexp.new /.*#{kw.downcase}.*/\n found = true if temp_article =~ pattern\n end\n found\nend",
"def texts_exact(value)\n complex_finds_exact TEXT_VIEW, value\n end",
"def find(any_verb_form)\n end",
"def test_strict_match_criteria\n entry = BigramEntry.new\n entry.parse_line(\"8\t工作\t18904\t6.89133239246\t213454\")\n cedict_entry = CEdictEntry.new\n cedict_entry.parse_line(\"工作 工作 [gong1 zuo4] /job/work/construction/task/CL:個|个[ge4],份[fen4],項|项[xiang4]/\")\n \n result = entry.default_match_criteria.call(cedict_entry,entry)\n assert(true,result)\n end",
"def pattern_find_with_like\n <<-EOT\n SendWithArguments<\n arguments = ActualArguments<\n array = [\n any+,\n HashLiteral<\n array = [\n any{even},\n SymbolLiteral<value = :limit | :conditions>,\n StringLiteral<string *= 'LIKE'>,\n any{even}\n ]\n >\n ]\n >,\n name *= /^find/\n >\n EOT\n end",
"def text_exact(value)\n complex_find_exact TEXT_VIEW, value\n end",
"def search_search_text\n query\n .where(\"decidim_opinions_opinions.title ILIKE ?\", \"%#{search_text}%\")\n .or(query.where(\"decidim_opinions_opinions.body ILIKE ?\", \"%#{search_text}%\"))\n end",
"def find(name); end",
"def best_match(name)\n matches = Name.with_correct_spelling.where(search_name: name)\n return matches.first if matches.any?\n\n matches = Name.with_correct_spelling.where(text_name: name)\n accepted = matches.reject(&:deprecated)\n matches = accepted if accepted.any?\n nonsensu = matches.reject { |match| match.author.start_with?(\"sensu \") }\n matches = nonsensu if nonsensu.any?\n matches.first\n end",
"def find_related(doc, max_nearest = 3, &block)\n carry =\n proximity_array_for_content(doc, &block).reject { |pair| pair[0].eql? doc }\n result = carry.collect { |x| x[0] }\n result[0..max_nearest - 1]\n end",
"def find_place(match)\n find = proc do |node|\n if node.text?\n formatted_text = node.text.strip\n unless formatted_text.empty?\n res = formatted_text.match?(\n /^[a-záàâãéèêíïóôõöúçñ\\-\\s]+ - [a-záàâãéèêíïóôõöúçñ\\s\\-]+ - [A-Z]{2}$/i\n )\n next formatted_text if res\n end\n end\n nil\n end\n\n depth_search(match, find)\n end",
"def full_card_search(search_term)\r\n # Takes a param and searches Title, Gametext, Lore in Cards for it\r\n # Returns a list of IDs of matching cards\r\n \r\n #horribly inefficient\r\n \r\n results_ids = []\r\n set_search_term(search_term)\r\n if search_term.nil?\r\n search_term = \"\"\r\n end\r\n \r\n (Card.find(:all, :select => \"id\",\r\n :conditions => [ 'LOWER(title) LIKE ? AND side = ?',\r\n '%' + search_term + '%', get_decklist_side ]) |\r\n Card.find(:all, :select => \"id\",\r\n :conditions => [ 'LOWER(gametext) LIKE ? AND side = ?',\r\n '%' + search_term + '%', get_decklist_side ]) |\r\n Card.find(:all, :select => \"id\",\r\n :conditions => [ 'LOWER(lore) LIKE ? AND side = ?',\r\n '%' + search_term + '%', get_decklist_side ])).each{ |card| results_ids << card.id }\r\n \r\n #If this doesnt work, try LIKE instead of =\r\n \r\n results_ids\r\n end",
"def find_like(chunk)\n results = find :all, :conditions => [ \"title like ? or body like ?\", \"%#{chunk}%\", \"%#{chunk}%\"],\n :limit => 20, :select => \"id, url_title, title, updated_at\", \n :order => sanitize_sql_array([\"INSTR(title, ?), INSTR(body, ?)\", \"%#{chunk}%\", \"%#{chunk}%\"])\n \n # sort by having a title with the closest match to the chunk\n results.sort_by { |wp| wp.title.gsub(chunk, '').size }\n end",
"def full_text_search\n @attributes[:full_text_search]\n end",
"def match_query(query); end",
"def search_content\n \"#{body}\"\n end",
"def special_find(names)\n results = @restaurants.find_all do |restaurant|\n names.detect { |name| name.casecmp(restaurant.name) == 0 }\n end\n # Add separators\n results.join(\"\\n\" + (\"-\" * 80) + \"\\n\")\n end",
"def search\n\t\t@articles = Article.where(\"text = ?\",params[:q])\n \n #Article.find_by_text(params[:q])\n \n #debug\n @articles.each do |article|\n puts article.title\n end\n \n \n\t\t#@articles = Article.where(:text => params[:q]) ' 1=1 -- '\n\n\t\t#@articles = Article.where(\"text = ?\", params[:q] )\n \n \n #TODO\n # add filter for other fields\n # Article.where(\"text = ? and title = ?\",params[:text],params[:title])\n \n # to add LIKE filter SQL : name like %aa%\n # \"name LIKE ? OR postal_code like ?\", \"%#{search}%\", \"%#{search}%\"\n \n end",
"def autocomplete_book_author\n# re = Regexp.new(\"^#{params[:user][:favorite_language]}\" , \"i\" )\n # @books= Book.find_all do |book|\n # book.title.match re\n # end\n # render :layout=>false\n end",
"def find!\n @total_found = 0\n @results = nil\n return results\n end",
"def test_match_case_sensitive_offset\r\n\t\t#content with exact match\r\n\t\tcontent = \"123MyMatch and some more\"\r\n\t\tsnort_rule_content = SnortRuleContent.new\r\n\t\tsnort_rule_content.unescaped_string = \"MyMatch\"\r\n\t\tsnort_rule_content.offset = 3\r\n\t\tsnort_rule_content.nocase = false\r\n\t\tmatch = snort_rule_content.match(content,0)\r\n\t\tassert_equal(3, match,\"no match on content with offset.\")\r\n\tend",
"def find_by()\n\n end",
"def search_full(pattern, succptr, getstr)\n _scan(pattern, succptr, getstr)\n end",
"def find_place_helper(match)\n find = proc do |element|\n if element.text?\n formatted_text = element.text.strip\n unless formatted_text.empty?\n res = formatted_text.match?(\n /^[a-záàâãéèêíïóôõöúçñ\\-\\s]+ - [a-záàâãéèêíïóôõöúçñ\\s\\-]+ - [A-Z]{2}$/i\n )\n next formatted_text if res\n end\n end\n nil\n end\n\n depth_search(match, find)\n end",
"def search; end",
"def find(path); end",
"def find(path); end",
"def perfect_match\n query = @query.downcase.as_wiki_link\n page = all_pages.detect { |name| name.downcase == query }\n SearchResult.new(page, 1) if page\n end",
"def search_on_filename\n needle = query.downcase.as_wiki_link\n all_pages.select { |name| name.downcase.include? needle }.map do |name|\n # unfreeze the String name by creating a \"new\" one\n SearchResult.new(name, 2 * @score, [0, name.tr('_', ' ')])\n end\n end",
"def finds_exact(value)\n eles_by_json_visible_exact '*', value\n end",
"def test_match_case_sensitive_distance\r\n\t\t#content with exact match\r\n\t\tcontent = \"123MyMatch123MyMatch\"\r\n\t\tsnort_rule_content = SnortRuleContent.new\r\n\t\tsnort_rule_content.unescaped_string = \"MyMatch\"\r\n\t\tsnort_rule_content.distance = 1\r\n\t\tsnort_rule_content.nocase = false\r\n\t\tmatch = snort_rule_content.match(content,4)\r\n\t\tassert_equal(13, match,\"no match on content with distance.\") #13 position of second MyMatch\r\n\tend",
"def search_substr( fullText, searchText, allowOverlap = true )\n if searchText == ''\n 0\n else\n fullText.scan(allowOverlap ? Regexp.new(\"(?=(#{searchText}))\") : searchText).size\n end\nend",
"def textField(textField, completions:somecompletions, forPartialWordRange:partialWordRange, indexOfSelectedItem:theIndexOfSelectedItem)\n matches = Entry.where(:title).contains(textField.stringValue,NSCaseInsensitivePredicateOption).map(&:title).uniq\n matches\n end",
"def search_search_text\n query\n .where(localized_search_text_in(:title), text: \"%#{search_text}%\")\n .or(query.where(localized_search_text_in(:description), text: \"%#{search_text}%\"))\n end",
"def search(term)\n # pattern = Regexp.new(pattern, case_insensitive=true)\n # pattern = Regexp.new(pattern, Regexp::EXTENDED | Regexp::IGNORECASE)\n # pattern = Regexp.new(pattern)\n pattern = Regexp.new(term)\n select do |tweet|\n tweet.full_text =~ pattern\n end\n end",
"def find_by_content\n user = User.current_user\n filtered_records = []\n user_groups = []\n tag = ActsAsTaggableOn::Tag.find_by_name('find')\n if tag\n # No need to bother without any find tags\n location_hashes = []\n \n # Omni is the default group even for non-logged in users\n user_groups << Group.find_by_name('_omni')\n \n if user\n Group.all.each do |group|\n user_groups << group if group.members.include?(user)\n end\n end\n\n # Retrieve all locations containing content where user's group(s) have find access\n user_groups.each do |user_group|\n sql = \"SELECT DISTINCT location_id FROM contents_locations WHERE content_id IN (SELECT taggable_id FROM taggings WHERE taggable_type='Content' AND tag_id=#{tag.id} AND context='access' AND tagger_type='Group' AND tagger_id=#{user_group.id})\"\n location_hashes += ActiveRecord::Base.connection.execute(sql)\n end\n\n if user\n # Retrieve all locations where user has find access\n sql = \"SELECT DISTINCT location_id FROM contents_locations WHERE content_id IN (SELECT taggable_id FROM taggings WHERE taggable_type='Content' AND tag_id=#{tag.id} AND context='access' AND tagger_type='User' AND tagger_id=#{user.id})\"\n location_hashes += ActiveRecord::Base.connection.execute(sql)\n end\n\n # No need to retrieve location object more than once\n location_hashes.uniq_by! {|hash| hash['location_id'] }\n\n locations = []\n location_hashes.each do |hash|\n locations << hash['location_id']\n end\n\n # All readable locations containing findable contents are OK\n all.each do |location|\n filtered_records << location if locations.include?(location.id)\n end\n end # No need to bother without any find tags\n filtered_records\n end",
"def myfind (str)\n if str.match(/^[[:graph:]]+$/)\n Provider.where(\"lower(name) like ?\", \"%#{str}%\")\n end\n end",
"def find\n fail NotImplementedError\n end",
"def index\n @entities = Entity.any_of( { :title => /.*#{params[:search]}.*/i } )\n end",
"def search_all_paths(word)\n\n\tsearch_project_paths(word)\n\tsearch_bundle_paths(word)\n\t\n\t$best_paths.uniq!\n\t$package_paths.uniq!\n\t\n\t{ :exact_matches => $best_paths, :partial_matches => $package_paths }\n\t\nend",
"def lookup_general(model, accepted = false)\n matches = []\n suggestions = []\n type = model.type_tag\n id = params[:id].to_s.gsub(/[+_]/, \" \").strip_squeeze\n begin\n if id.match(/^\\d+$/)\n obj = find_or_goto_index(model, id)\n return unless obj\n matches = [obj]\n else\n case model.to_s\n when \"Name\"\n if (parse = Name.parse_name(id))\n matches = Name.find_all_by_search_name(parse.search_name)\n if matches.empty?\n matches = Name.find_all_by_text_name(parse.text_name)\n end\n matches = fix_name_matches(matches, accepted)\n end\n if matches.empty?\n suggestions = Name.suggest_alternate_spellings(id)\n suggestions = fix_name_matches(suggestions, accepted)\n end\n when \"Location\"\n pattern = \"%#{id}%\"\n conditions = [\"name LIKE ? OR scientific_name LIKE ?\",\n pattern, pattern]\n matches = Location.find(:all,\n limit: 100,\n conditions: conditions)\n when \"Project\"\n pattern = \"%#{id}%\"\n matches = Project.find(:all,\n limit: 100,\n conditions: [\"title LIKE ?\", pattern])\n when \"SpeciesList\"\n pattern = \"%#{id}%\"\n matches = SpeciesList.find(:all,\n limit: 100,\n conditions: [\"title LIKE ?\", pattern])\n when \"User\"\n matches = User.find_all_by_login(id)\n matches = User.find_all_by_name(id) if matches.empty?\n end\n end\n rescue => e\n flash_error(e.to_s) unless Rails.env == \"production\"\n end\n\n if matches.empty? && suggestions.empty?\n flash_error(:runtime_object_no_match.t(match: id, type: type))\n action = model == User ? :index_rss_log : model.index_action\n redirect_to(controller: model.show_controller,\n action: action)\n elsif matches.length == 1 || suggestions.length == 1\n obj = matches.first || suggestions.first\n if suggestions.any?\n flash_warning(:runtime_suggest_one_alternate.t(match: id, type: type))\n end\n redirect_to(controller: obj.show_controller,\n action: obj.show_action,\n id: obj.id)\n else\n obj = matches.first || suggestions.first\n query = Query.lookup(model, :in_set, ids: matches + suggestions)\n if suggestions.any?\n flash_warning(:runtime_suggest_multiple_alternates.t(match: id,\n type: type))\n else\n flash_warning(:runtime_object_multiple_matches.t(match: id,\n type: type))\n end\n redirect_to(add_query_param({ controller: obj.show_controller,\n action: obj.index_action },\n query))\n end\n end",
"def search_full(pattern, advance_pointer, return_string)\n do_scan pattern, advance_pointer, return_string, false\n end",
"def search(target)\n end",
"def test_searching_for_single_letter_with_large_list_using_fuzzy_search\n use_large_artists_list if @@cached_artists.length < 100\n assert_equals(\n fuzzy_search(\"a\").length,\n 153728,\n \"Fuzzy searches large list for letter a\"\n )\n assert_equals(\n fuzzy_search(\"b\").length,\n 121276,\n \"Fuzzy searches large list for letter b\"\n )\n assert_equals(\n fuzzy_search(\"A\").length,\n 153728,\n \"Fuzzy searches large list for letter A\"\n )\n assert_equals(\n fuzzy_search(\"B\").length,\n 121276,\n \"Fuzzy searches large list for letter B\"\n )\n use_small_artists_list\n end",
"def parse_search; end",
"def find(value)\n end",
"def match(keyword); end",
"def case_insensitive_match; end",
"def find(query); end",
"def find(query); end",
"def find(prepostion)\n\t\tpartial_search_kb = string_to_internal(preposition)\n\t\tpartial_search_kb.each do |sentence|\n\t\t\tind = @kb.index(sentence)\n\t\tend\n\t\treturn ind\n\tend",
"def full_text_search(integer)\n select_size integer\n hit_enter\n end",
"def full_text_search(integer)\n select_size integer\n hit_enter\n end",
"def find_word(lexical_item)\n \n end",
"def search_text(query, text)\n text = pattern(text)\n query.where { title.ilike(text) | description.ilike(text) }\n end",
"def test_match_case_sensitive_depth\r\n\t\t#content with exact match\r\n\t\tcontent = \"123MyMatch and some more\"\r\n\t\tsnort_rule_content = SnortRuleContent.new\r\n\t\tsnort_rule_content.unescaped_string = \"MyMatch\"\r\n\t\tsnort_rule_content.depth = 10\r\n\t\tsnort_rule_content.nocase = false\r\n\t\tmatch = snort_rule_content.match(content,0)\r\n\t\tassert_equal(3, match,\"no match on content with depth.\")\r\n\tend",
"def query_fulltext_regexp( query )\n read_db do |dbm|\n dbm.each_value do |raw_val|\n val = RDictCcEntry.format_str(raw_val)\n match_line_found = false\n val.each_line do |line|\n if line =~ /^\\s+/\n if match_line_found\n puts line\n else\n # Skip lines starting with blanks, because these are already\n # translations and they don't belong to the matching line.\n next\n end\n else\n match_line_found = false\n end\n if line.downcase =~ /#{query}/\n puts line\n match_line_found = true\n end\n end\n end\n end\n end",
"def search_bool(query)\n ap \"!!!!!!!!!!!!!!!!!!! SEARCH BOOL CALLED WITH query \" + query.to_s\n terms = query.split(' ')\n\n articles_bool = []\n terms.each do |term|\n ap \"!!!!!! TERM !!!!\"\n ap term\n matches = Article.find(:all, conditions: ['summary LIKE ? and title LIKE ?', \"%#{term}%\", \"%#{term}%\"])\n ap \"!!!!!!!! MATCHES !!!!!\"\n ap matches\n matches.each do |article|\n if !articles_bool.include? article\n articles_bool << article\n end\n end\n end\n\n return articles_bool\n \n end",
"def test_match_case_sensitive_offset_no_match\r\n\t\t#content with exact match\r\n\t\tcontent = \"123MyMatch and some more\"\r\n\t\tsnort_rule_content = SnortRuleContent.new\r\n\t\tsnort_rule_content.unescaped_string = \"MyMatch\"\r\n\t\tsnort_rule_content.offset = 4\r\n\t\tsnort_rule_content.nocase = false\r\n\t\tassert(!snort_rule_content.match(content,0),\"incorrect match on content with offset.\")\r\n\tend",
"def find_eles_by_text_include tag, text\n find_eles_by_attr_include tag, :text, text\n end",
"def content_search(namespace)\n search_all_methods(namespace) do |meth|\n begin\n meth.source =~ pattern\n rescue RescuableException\n false\n end\n end\n end",
"def find_item_with_content(content)\n # TODO Stubbed - Requires definition and implementation\n end",
"def find\n \"#{content_path}#{clean_path}\"\n end",
"def pre_match() end",
"def find(search)\n all_contacts = ContactDatabase.read_from_file\n all_contacts.each do |contacts|\n if contacts[1] =~ /#{search}/i or contacts[2] =~ /#{search}/i\n p \" #{contacts[0]}: #{contacts[1]} (#{contacts[2]})\" \n end \n end\n end",
"def test_file_must_contain_fuzzy()\n\t\tCfruby::FileEdit.file_must_contain(@multilinefilename, \"\\tnew line\", :position => Cfruby::FileEdit::APPEND)\n\t\tFile.open(@multilinefilename, File::RDONLY) { |fp|\n\t\t\tlines = fp.readlines()\n\t\t\tassert_equal(\"\\tnew line\\n\", lines[-1])\n\t\t}\n\n\t\tadded = Cfruby::FileEdit.file_must_contain(@multilinefilename, \"new line\", :fuzzymatch => true, :position => Cfruby::FileEdit::APPEND)\n\t\tassert_equal(false, added, \"file_must_contain added the fuzzy match when it shouldn't have\")\n\n\t\tadded = Cfruby::FileEdit.file_must_contain(@multilinefilename, \"new line\", :fuzzymatch => false, :position => Cfruby::FileEdit::APPEND)\n\t\tassert_equal(true, added, \"file_must_contain didn't add the strict match when it should have\")\n\t\t\n\t\t# test regexp escaping with fuzzymatch\n\t\tassert_nothing_raised() {\n\t\t\tCfruby::FileEdit.file_must_contain(@multilinefilename, '0 0 * * 5 /usr/local/sbin/pkg_version -v -L =', :fuzzymatch=>true)\n\t\t}\n\t\t\n\t\t@resolvfile = Tempfile.new('test')\n\t\t@resolvefilecontents = <<FILEBLOCK\n# our servers\nnameserver 69.9.164.130\nnameserver 69.9.164.131\nFILEBLOCK\n\t\[email protected](@multilinefilecontents)\n\t\[email protected](false)\n\n\t\tCfruby::FileEdit.file_must_contain(@resolvfile.path, 'domain titanresearch.com', :fuzzymatch=>true)\n\t\tCfruby::FileEdit.file_must_contain(@resolvfile.path, 'nameserver 69.9.164.130', :fuzzymatch=>true)\n\t\tCfruby::FileEdit.file_must_contain(@resolvfile.path, 'nameserver 69.9.164.131', :fuzzymatch=>true)\n\t\tCfruby::FileEdit.file_must_contain(@resolvfile.path, 'nameserver 66.180.175.18', :fuzzymatch=>true)\n\t\tCfruby::FileEdit.file_must_contain(@resolvfile.path, 'nameserver 69.9.191.4', :fuzzymatch=>true)\n\t\tCfruby::FileEdit.file_must_contain(@resolvfile.path, 'nameserver 69.9.160.191', :fuzzymatch=>true)\n\t\t\n\t\tassert_equal(true, Cfruby::FileEdit.contains?(@resolvfile.path, 'domain titanresearch.com'))\n\t\tassert_equal(true, Cfruby::FileEdit.contains?(@resolvfile.path, 'nameserver 69.9.164.130'))\n\t\tassert_equal(true, Cfruby::FileEdit.contains?(@resolvfile.path, 'nameserver 69.9.164.131'))\n\t\tassert_equal(true, Cfruby::FileEdit.contains?(@resolvfile.path, 'nameserver 66.180.175.18'))\n\t\tassert_equal(true, Cfruby::FileEdit.contains?(@resolvfile.path, 'nameserver 69.9.191.4'))\n\t\tassert_equal(true, Cfruby::FileEdit.contains?(@resolvfile.path, 'nameserver 69.9.160.191'))\n\tend",
"def search\n @articles = Article.includes(:comments).order(date: :desc).where(\"title LIKE ? OR content LIKE ?\", \"%#{params[:keyword]}%\", \"%#{params[:keyword]}%\").take(20)\n end",
"def find( *args, &block )\n opts = Hash === args.last ? args.pop : {}\n \n limit = args.shift\n limit = opts.delete(:limit) if opts.has_key?(:limit)\n sort_by = opts.delete(:sort_by)\n reverse = opts.delete(:reverse)\n \n # figure out which collections to search through\n search = self\n # search = if (dir = opts.delete(:content_pat))\n # dir = dir.sub(%r/^\\//, '')\n # strategy = lambda { |key| key == dir }\n # matching_keys = @db.keys.select(&strategy)\n # raise RuntimeError, \"unknown collection '#{dir}'\" if matching_keys.empty?\n # matching_keys.map { |key| @db[key] }.flatten\n # else\n # self\n # end\n \n # construct a search block if one was not supplied by the user\n block ||= lambda do |content|\n found = true\n opts.each do |key, value|\n if key == :content_path\n found &&= content.__send__(key.to_sym).match( Regexp.new( value.gsub('*', '.*'), 'g' ) )\n else\n found &&= content.__send__(key.to_sym) == value\n end\n break if not found\n end\n found\n end\n \n # search through the collections for the desired content objects\n ary = []\n search.each do |content|\n ary << content if block.call(content)\n end\n \n # sort the search results if the user gave an attribute to sort by\n if sort_by\n m = sort_by.to_sym\n ary.delete_if {|p| p.__send__(m).nil?}\n reverse ? \n ary.sort! {|a,b| b.__send__(m) <=> a.__send__(m)} :\n ary.sort! {|a,b| a.__send__(m) <=> b.__send__(m)} \n end\n \n # limit the search results\n case limit\n when :all, 'all'\n ary\n when Integer\n ary.slice(0,limit)\n else\n ary.first\n end\n end",
"def text_search(search_text, limit, offset)\n query_strategy.text_search(search_text, limit, offset)\n end",
"def search(query); end",
"def search(string, max_nearest = 3)\n return [] if needs_rebuild?\n carry = proximity_norms_for_content(string)\n unless carry.nil?\n result = carry.collect { |x| x[0] }\n result[0..max_nearest - 1]\n end\n end",
"def noncanonical_tag_finder(tag_class, search_param)\n if search_param\n render_output(tag_class.by_popularity\n .where([\"canonical = 0 AND name LIKE ?\",\n '%' + search_param + '%']).limit(10).map(&:name))\n end\n end",
"def suggest_other_query(items, query)\n query = query.gsub(/_/,\" \").downcase\n\n distance_levenshtein = 100\n longest_subseq = 0\n word = \"\"\n\n matcher1 = Amatch::Levenshtein.new(query)\n matcher2 = Amatch::LongestSubsequence.new(query)\n\n items.each{ |item|\n name_array = item.name.downcase.split\n name_array.push(item.name.downcase)\n\n new_distance_array_levenshtein = matcher1.match(name_array).sort\n new_longest_subseq_array = matcher2.match(name_array).sort.reverse\n\n if new_distance_array_levenshtein[0] < distance_levenshtein and new_longest_subseq_array[0] >= longest_subseq\n word = item.name\n distance_levenshtein = new_distance_array_levenshtein[0]\n longest_subseq = new_longest_subseq_array[0]\n end\n\n }\n\n if distance_levenshtein <= 3 and longest_subseq >=2\n self.closest_string = word\n end\n\n end",
"def filter_findings\n findings\n end",
"def find_fulltext(query, options={}, with_mdate_desc_order=true)\n fulltext_option = {}\n fulltext_option[:order] = :updated_at if with_mdate_desc_order\n ids = matched_ids(query, fulltext_option)\n find_by_ids_scope(ids, options)\n end",
"def findorsuggest()\n \n end",
"def search_builder(file_added, word)\n\t\t file_data = File.read(file_added)\n\t\t file_2data = File.read(file_added).split(\"\\n\")\n\t\t\tper = \"#{word}: can not find\"\n\n\t\t\tif file_data.downcase.include?(word.downcase)\n\n\t\t\t\tfor j in 0..file_2data.length-1\n\t\t\t\t if file_2data[j].downcase.include?(word.downcase)\n\t\t\t\t\t\tper = file_2data[j].downcase\n\n\t\t\t\t\t\tif per.include?(\":\")\n\t\t\t\t\t\t per = per.capitalize\n\n\t\t\t\t\t\telsif per.downcase.include?(\"#{word.downcase}\")\n\t\t\t\t\t\t per = \"#{word}: found\"\n\t\t\t\t\t\tend\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\tend\n\t\t\treturn per\n\t\tend",
"def test_match_case_sensitive_distance_no_match\r\n\t\t#content with exact match\r\n\t\tcontent = \"123MyMatch123MyMatch\"\r\n\t\tsnort_rule_content = SnortRuleContent.new\r\n\t\tsnort_rule_content.unescaped_string = \"MyMatch\"\r\n\t\tsnort_rule_content.distance = 11\r\n\t\tsnort_rule_content.nocase = false\r\n\t\tassert(!snort_rule_content.match(content,4),\"incorrect match on content with distance.\")\r\n\tend",
"def bubble_up_exact_matches(affil_list:, term:)\n matches_at_beginning = []\n matches_within = []\n other_items = []\n match_term = term.downcase\n affil_list.each do |affil_item|\n name = affil_item[:name].downcase\n if name.start_with?(match_term)\n matches_at_beginning << affil_item\n elsif name.include?(match_term)\n matches_within << affil_item\n else\n other_items << affil_item\n end\n end\n matches_at_beginning + matches_within + other_items\n end",
"def test_truthy_finds(tests, method, options = {})\n tests.each do |test|\n matches = Ramparts.send(method, test[:text], options)\n test[:matches].each_with_index do |match_string, index|\n if matches[index].nil? || matches[index][:value].casecmp(match_string) != 0\n got_result = matches[index].nil? ? 'NIL' : matches[index][:value]\n raise \"Expected: #{match_string}\\nGot: #{got_result}\\nBlock '#{test[:text]}'\\nResult: #{matches}\"\n end\n end\n end\nend",
"def find\n\t\t#puts \"find, line \" + \"37\"\n\t\tclnt = JSONClient.new\n\t\theader = {'Cookie' => 'Summon-Two=true'}\n\t\turi = URI.parse(URI.encode(\"http://tufts.summon.serialssolutions.com/api/search?pn=1&ho=t&q=\" + params[:title]))\n\t\tresponse = clnt.get(uri, nil, header)\n\t\tjson_response = response.content\n\t\tif json_response.keys.include?(\"documents\")\n\t\t\t@result = response.content[\"documents\"]\n\n\t\t\t\n\t\telse\n\t\t\t@result = ''\n\t\tend\n\tend",
"def potential_matches\n @potential_matches ||= super.select do |license|\n if license.creative_commons? && file.potential_false_positive?\n false\n else\n license.wordset\n end\n end\n end"
] | [
"0.6190677",
"0.6162378",
"0.6019823",
"0.5992193",
"0.5988968",
"0.58333576",
"0.5829763",
"0.57963175",
"0.5771",
"0.5766586",
"0.575435",
"0.57537246",
"0.57297295",
"0.5687712",
"0.5685527",
"0.56648237",
"0.56595695",
"0.56316835",
"0.56194305",
"0.56108576",
"0.5606262",
"0.5601181",
"0.5598778",
"0.55987084",
"0.55467755",
"0.55274725",
"0.5500273",
"0.5485803",
"0.546301",
"0.54596144",
"0.5433313",
"0.54292274",
"0.54260415",
"0.5415667",
"0.5407892",
"0.53913677",
"0.53814286",
"0.5377511",
"0.53707093",
"0.53689706",
"0.53624356",
"0.5358614",
"0.5355979",
"0.53388137",
"0.533851",
"0.533851",
"0.5336105",
"0.5333405",
"0.5330162",
"0.5316258",
"0.531594",
"0.53085965",
"0.53020036",
"0.5301037",
"0.5294879",
"0.5285086",
"0.52843755",
"0.5282099",
"0.5277524",
"0.5272275",
"0.5263057",
"0.5249777",
"0.52483976",
"0.52439404",
"0.5242816",
"0.52426636",
"0.5230594",
"0.5225394",
"0.5225394",
"0.52228713",
"0.52221924",
"0.52221924",
"0.52193743",
"0.5218916",
"0.5218301",
"0.52106947",
"0.519211",
"0.518323",
"0.5181091",
"0.5177087",
"0.51711416",
"0.51710594",
"0.517087",
"0.5170806",
"0.5170681",
"0.516994",
"0.51689655",
"0.51570165",
"0.51563066",
"0.51556975",
"0.51536465",
"0.514873",
"0.5148269",
"0.5148219",
"0.514419",
"0.5142284",
"0.5141795",
"0.51410985",
"0.5138979",
"0.5136992",
"0.51270694"
] | 0.0 | -1 |
Never trust parameters from the scary internet, only allow the white list through. | def query_params
params.require(:query).permit(:name, :label, :description, :created_by, :sql, :conditions)
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 valid_params_request?; 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 strong_params\n params.require(:experience).permit(param_whitelist)\n end",
"def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end",
"def whitelist_url_params\n params.require(:whitelist_url).permit(:domain)\n end",
"def allowed_params\n params.require(:allowed).permit(:email)\n end",
"def permitted_params\n []\n end",
"def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end",
"def safe_params\n params.permit(:id, :name, :origin, :emails => []); #emails is an array\n end",
"def query_param\n\t\tparams.permit(:first_name, :last_name, :phone)\n\tend",
"def strong_params\n params.require(:success_metric).permit(param_whitelist)\n end",
"def devise_filter\r\n logger.debug(\"In devise_filter =>PARAMS: #{params.inspect}\")\r\n\r\n # White list for sign_up\r\n devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(user_whitelist) }\r\n\r\n # White list for account update\r\n devise_parameter_sanitizer.for(:account_update) { |u| u.permit(user_whitelist, :current_password) }\r\n\r\n # White list for Invitation creation\r\n devise_parameter_sanitizer.for(:invite) { |u| u.permit(:account_type, :email, :invitation_token)}\r\n\r\n # White list for accept invitation\r\n devise_parameter_sanitizer.for(:accept_invitation) { |u| u.permit(user_whitelist, :invitation_token)}\r\n\r\n end",
"def whitelisted_user_params\n params.require(:user).\n permit( :first_name, :last_name, :email,:password,:password_confirmation,:birthday,:gender)\n end",
"def user_params\n ActionController::Parameters.permit_all_parameters = true\n params.require(:user) #.permit(:name, :surname, :phone, :password, :email, :time_zone)\n end",
"def safe_params\n params.require(:user).permit(:name)\n end",
"def strong_params\n params.require(:metric_change).permit(param_whitelist)\n end",
"def get_params\n\t\treturn ActionController::Parameters.new(self.attributes).permit(\"account_id\", \"title\", \"category\", \"introduction\", \"tags\", \"segment_type\", \"visible\", \"status\", \"main_image\")\n\tend",
"def grant_params\n @whitelisted = params.require(:grant).permit(:name, :description, :agency_id, :acronym)\n end",
"def check_params; true; end",
"def param_whitelist\n whitelist = [\n :description,\n :progress,\n :kpi_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:kpi_id)\n end\n \n whitelist\n end",
"def quote_params\n params.permit!\n end",
"def valid_params?; end",
"def paramunold_params\n params.require(:paramunold).permit!\n end",
"def user_params\n\t\tparams.permit(:nickname, :avatar, :description, :password, :gender, :birthday, :email, :phone, :qq_id, :wechat_id)\n\tend",
"def filtered_parameters; end",
"def user_params\n params.permit(\n \t:id,\n \t:email, \n \t:first_name, \n \t:last_name, \n \t:password, \n \t:confirm_token, \n \t:phone_number,\n \t:facebook_link,\n \t:car_model,\n \t:license_plate)\n end",
"def filtering_params\n params.permit(:email, :name)\n end",
"def check_params\n true\n end",
"def wx_public_params\n params.require(:wx_public).permit(:nickname, :manager, :alias)\n end",
"def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end",
"def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end",
"def listing_params\n\t\tparams.permit(:address, :transit_info, :rules, :other_info, :lat, :lng)\n\tend",
"def social_account_params\n\t\t\tparams.require(:social_account).permit!\n\t\tend",
"def safe_params\n resurce_name = self.class.resource_name\n params_method_name = \"#{resurce_name}_params\".to_sym\n if params[resurce_name]\n if respond_to?(params_method_name) || private_methods.include?(params_method_name)\n send(params_method_name)\n else\n raise ActiveModel::ForbiddenAttributesError, \"Please, define the '#{params_method_name}' method in #{self.class.name}\"\n end\n end\n end",
"def user_params\n params.require(:user).permit(:uri, :username, :password, :realname, :email, :publicvisible)\n end",
"def model_params\n\t\tparams.require(:manager).permit(\n\t :user_name,\n :password,\n :email,\n \t\t\t)\n\tend",
"def url_params\n params.require(:url).permit(:short_url, :original_url, :clicks, :ip_addresses)\n end",
"def article_params_whitelist\n params.require(:article).permit(:title, :description, category_ids: [])\n end",
"def college_whitelist_params\n params.require(:college_whitelist).permit(:status)\n end",
"def active_code_params\n params[:active_code].permit\n end",
"def valid_params(params)\n params.permit(:user_id, :photo_id, :originX, :originY, :width, :height)\n end",
"def filtering_params\n params.permit(:email)\n end",
"def ip_address_params\n\t\t\tparams.require(:ip_address).permit!\n end",
"def reserved_params\n params.require(:reserved).permit(:name, :email, :pax, :address, :KTP, :title)\n end",
"def pull_request_params\n whitelist = [\n :url,\n :id,\n :html_url,\n :diff_url,\n :patch_url,\n :issue_url,\n :number,\n :state,\n :locked,\n :title\n ]\n params.require(:pull_request).permit(whitelist)\n end",
"def post_params\n if current_user.admin? \n params.permit(:title, :body, :city, :country, :gps_location, :privacy, :visible, :latitude, :longitude, images: [], files: [])\n else \n params.permit(:title, :body, :city, :country, :gps_location, :privacy,:latitude, :longitude, images: [], files: [])\n end \n end",
"def list_params\n params.permit(:name)\n end",
"def filter_parameters; end",
"def filter_parameters; end",
"def vineyard_params\n params.permit(:vineyard_name, :email, :website_url, :phone, :address, :city, :region, :postcode, :country, :specialty, :description, :pet_friendly, :holiday, :tours, :events, :family_friendly, :cover_image, :image_one, :image_two, :image_three, :image_four, :user_id, :base64)\n end",
"def available_activity_params\n # params.require(:available_activity).permit(:type,:geometry,:properties)\n whitelisted = ActionController::Parameters.new({\n type: params.require(:available_activity)[:type],\n geometry: params.require(:available_activity)[:geometry].try(:permit!).to_h,\n properties: params.require(:available_activity)[:properties].try(:permit!).to_h\n }).try(:permit!)\n end",
"def user_params\n params.permit(:name, :username, :email, :password, :img_url, :bg_url, :coinbank)\n end",
"def user_params_pub\n\t \tparams[:user].permit(:hruid)\n\t end",
"def user_params\n params.permit(:id, :email, :password, :nickname, :status, :avatar, :flat_picture, :flatsharing_id, :member,\n :user, :color, :solde)\n end",
"def validate_search_inputs\n @whitelisted = params.fetch(:user, nil)\n if @whitelisted.blank?\n render_error(400, \"#{I18n.t('general_error.params_missing_key')}\": [I18n.t('general_error.params_missing_value', model: \"review\")])\n return\n else\n @whitelisted = @whitelisted.permit(:name, :uen, :description)\n end\n end",
"def url_whitelist; end",
"def param_whitelist\n [\n :title,\n :description,\n :organization,\n :team_id,\n :started_at,\n :finished_at,\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n end",
"def admin_social_network_params\n params.require(:social_network).permit!\n end",
"def valid_params(params)\n params.permit(:login, :first_name, :last_name, \n :password, :password_confirmation)\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 sensitive_params=(params)\n @sensitive_params = params\n end",
"def permit_request_params\n params.permit(:address)\n end",
"def user_params\n # Ensure a user can't give themselves admin priveleges\n params.delete(:admin) if current_user.admin?\n params.require(:user).permit(:name, :email, :admin, :image)\n end",
"def secure_params\n params.require(:location).permit(:name)\n end",
"def strong_params\n params.require( :setting ).\n permit( :global_scan_limit, :per_user_scan_limit,\n :target_whitelist_patterns, :target_blacklist_patterns )\n end",
"def question_params\n params.require(:survey_question).permit(question_whitelist)\n end",
"def case_insensitive_params\n params.require(:case_insensitive).permit(:name)\n end",
"def maintenance_request_params\n params[:maintenance_request].permit! #allow all parameters for now\n end",
"def empire_master_no_match_params\n params.require(:empire_master_no_match).permit(:uid, :last_name, :list, :search_date, :double, :source)\n end",
"def url_params\n params[:url].permit(:full)\n end",
"def backend_user_params\n params.permit!\n end",
"def unwanted_params\n params.require(:unwanted).permit(:title, :description, :image)\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 droptraining_params\n params.permit(:training_id,:user_id, :utf8, :authenticity_token, :commit)\n end",
"def pass_params\n params[:pass].permit(:name, :price, :description, :colour, :events)\n end",
"def person_params\n # params whitelist does *not* include admin, sub, remember_token\n # TBD: share this whitelist with the list used by configuration_permitted_parameters\n # TBD: should current_password be on this list? -- for now, leaving off, since it seems to work without\n # NOTE: do not include 'admin' in this list!\n params.require(:person).permit(\n :name, \n :email, \n :description,\n :password, \n :password_confirmation\n )\n end",
"def parameter_params\n params.require(:parameter).permit(:name, :description, :param_code, :param_value, :active_from, :active_to)\n end"
] | [
"0.6980957",
"0.6783065",
"0.6747844",
"0.6741468",
"0.67356336",
"0.6592548",
"0.65036845",
"0.64978707",
"0.64825076",
"0.64795035",
"0.64560914",
"0.64397955",
"0.6379666",
"0.6376688",
"0.6366702",
"0.6319728",
"0.6300833",
"0.6300629",
"0.6294277",
"0.6293905",
"0.6291174",
"0.62905735",
"0.6283171",
"0.6242344",
"0.62403613",
"0.6218049",
"0.62143815",
"0.62104696",
"0.61949855",
"0.6178671",
"0.6176147",
"0.6173327",
"0.6163395",
"0.6153005",
"0.6151833",
"0.6147288",
"0.61224324",
"0.6118827",
"0.61075264",
"0.61054534",
"0.6092497",
"0.6080082",
"0.60710967",
"0.60627776",
"0.60219413",
"0.60175914",
"0.60153484",
"0.60107356",
"0.60081726",
"0.60081726",
"0.60013986",
"0.6000165",
"0.59978646",
"0.59936947",
"0.59925723",
"0.5992084",
"0.59796256",
"0.5967569",
"0.5960056",
"0.59589803",
"0.5958441",
"0.5958401",
"0.5952607",
"0.5952406",
"0.5944409",
"0.59391016",
"0.593842",
"0.593842",
"0.5933845",
"0.59312123",
"0.5926475",
"0.59248453",
"0.59179676",
"0.59109294",
"0.59101623",
"0.5908172",
"0.59058356",
"0.5899052",
"0.5897749",
"0.5896101",
"0.58942914",
"0.58939576",
"0.5892063",
"0.5887407",
"0.588292",
"0.58797663",
"0.587367",
"0.58681566",
"0.5868038",
"0.5866578",
"0.58665025",
"0.58655846",
"0.58640826",
"0.5863465",
"0.5862226",
"0.586065",
"0.58581287",
"0.5854443",
"0.5854172",
"0.58507544",
"0.5849934"
] | 0.0 | -1 |
Mimic processing a Message. | def initialize(params)
@success = verify_params(params)
@to = params['To']
@body = params['Body']
@sent = Time.now
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def process_message(message)\n end",
"def process(message)\n end",
"def message\n process_mess\n end",
"def process_msgs\n end",
"def process_message(message)\n # TODO: May want to ignore some messages (say, if the community string is wrong)\n message.respond(dispatch(message))\n end",
"def pre_process(message)\n end",
"def process_message(message)\n with_retries(max_tries: retries, handler: retry_handler) do\n handler.call(parse_message(message.value))\n end\n rescue StandardError => e\n handle_exception(e)\n stop\n else\n store_offset(offset)\n self\n end",
"def message(message)\n handler = handler_for_context\n return unless handler\n if handler.respond_to?(:call)\n instance_exec(message, &handler)\n else\n process(handler, *message['text'].split)\n end\n end",
"def processOtherMessage(line)\n #nothing to do with this message\nend",
"def process(message_instance)\n raise Errors::NotImplemented\n end",
"def processRegularUserMessage(message)\r\n return formatMessageText(message[:message])\r\n end",
"def process(message, recipient)\n Astrotrain.callback(:pre_processing, message, self)\n Transport.process(message, self, recipient)\n \n end",
"def call(message)\n @message = message\n if @processor\n @processor.call(message)\n else\n process\n end\n ensure\n @__handler_called__ = true\n end",
"def process_message(message, event_data={})\n log.debug(\"Processing #{message.inspect}, event=#{event_data}\")\n unless message_processor\n raise \"No message processor registered. Please call on_message on the adapter.\"\n end\n\n is_valid = verify(event_data)\n unless verify(event_data)\n log.warn(\"Not valid request ignored: event_data=#{event_data}, message=#{message.inspect}\")\n return nil\n end\n\n answer = message_processor.call(message, event_data)\n post_process(answer)\n end",
"def process_message(msg)\n if msg =~ /^<<</\n handle_commands(msg)\n elsif msg =~ /^@\\S+/\n handle_pm(msg)\n elsif msg =~ /^\\\\/\n @server.forward(msg, self)\n else\n handle_chat_msg(msg)\n end\n end",
"def parse_message(payload)\n @parsers.inject(payload) do |memo, parser|\n parser.call(memo)\n end\n end",
"def process_message(message)\n msg = message.to_s\n\n if msg =~ /[\\.\\?!;]/\n msg.split(/[\\.\\?!;]/)\n if msg.is_a? String\n process_sentence(msg)\n else\n msg.each do |m|\n process_sentence(m)\n end\n end\n else\n process_sentence(msg)\n end\n end",
"def handle(message)\n type, return_to, params = parse(message[:payload])\n begin\n m = handle_message(type, params)\n success(return_to, m)\n rescue Exception => e\n error(return_to, e)\n end\n end",
"def process_omf_message(message, topic)\n unless message.is_a? OmfCommon::Message\n raise \"Expected Message, but got '#{message.class}'\"\n #message = OmfCommon::Message.new(props.dup)\n end\n #puts \"PPP(#{topic.id}|#{uid})-> #{message}\"\n objects_by_topic(topic.id.to_s).each do |obj|\n #puts \"TTT(#{self})-> #{obj}\"\n if OmfCommon::Measure.enabled?\n OmfRc::ResourceProxy::MPReceived.inject(Time.now.to_f, self.uid, topic, message.msg_id) \n end\n execute_omf_operation(message, obj, topic)\n end\n end",
"def perform_transformation(msg)\n self.send(@transformation_block, msg)\n end",
"def process message\n op = message[\"opcode\"]\n data = message[\"data\"]\n\n case op\n when PUBLISH\n emit(\"message\", data)\n when SUBSCRIBE_GRANTED\n emit(\"subscribe\")\n when SUBSCRIBE_DENIED\n emit(\"subscribe_denied\")\n when PUBLISH_DENIED\n emit(\"publish_denied\")\n when PUBLISH_GRANTED\n emit(\"publish_granted\")\n when UNSUBSCRIBE_COMPLETE\n emit(\"unsubscribe\")\n @callbacks.clear\n when AUTHORIZE_DENIED\n emit(\"authorize_denied\")\n when AUTHORIZE_COMPLETE\n emit(\"authorize_complete\")\n end\n\n end",
"def message(message) end",
"def call(message)\n if message.command == 'MESSAGE'\n handler.call(JSON.parse(message.body, symbolize_names: true))\n end\n rescue => e\n log.error(e.message) { \"\\n#{e.backtrace.inspect}\" }\n ensure\n ack(message)\n log.info('Processed') { %(#{message.headers['message-id']} from \"#{message.headers['destination']}\") }\n end",
"def process_message(message)\n case message\n when Vertica::Protocol::ErrorResponse\n raise Vertica::Error::ConnectionError.new(message.error_message)\n when Vertica::Protocol::NoticeResponse\n @notice_handler.call(message) if @notice_handler\n when Vertica::Protocol::BackendKeyData\n @backend_pid = message.pid\n @backend_key = message.key\n when Vertica::Protocol::ParameterStatus\n @parameters[message.name] = message.value\n when Vertica::Protocol::ReadyForQuery\n @transaction_status = message.transaction_status\n @mutex.unlock\n else\n raise Vertica::Error::MessageError, \"Unhandled message: #{message.inspect}\"\n end\n end",
"def process_omf_message(message, topic)\n return unless check_guard(message)\n\n unless message.is_a? OmfCommon::Message\n raise ArgumentError, \"Expected OmfCommon::Message, but got '#{message.class}'\"\n end\n\n unless message.valid?\n raise StandardError, \"Invalid message received: #{pubsub_item_payload}. Please check protocol schema of version #{OmfCommon::PROTOCOL_VERSION}.\"\n end\n\n objects_by_topic(topic.id.to_s).each do |obj|\n if OmfCommon::Measure.enabled?\n OmfRc::ResourceProxy::MPReceived.inject(Time.now.to_f, self.uid, topic, message.mid)\n end\n execute_omf_operation(message, obj, topic)\n end\n end",
"def process\n return 'OK' if @email.to.first[:token] == 'example'\n return process_image if @email.to.first[:token] == 'flyers'\n\n token = ReplyToken.find(@email.to.first[:token])\n\n case token.reply_type\n when 'participation_request'\n process_participation_request(token)\n when 'conversation'\n process_conversation(token)\n when 'comment'\n process_comment(token)\n when 'community'\n process_community_reply(token)\n end\n\n track_reply(token)\n\n token.use!\n end",
"def process_message(msg)\n write_thread_var :wi, wi = WorkItem.new(msg) # Save workitem object for later\n turn_off_thinking_sphinx\n \n log_info \"Processing incoming workitem: #{workitem.to_s}\"\n begin\n run_backup_job(wi) do |job|\n # Start backup job & pass info in BackupSourceJob\n if backup(job) \n save_success_data\n end\n end\n rescue BackupSourceExecutionFlood => e\n # Too many jobs should not be an error\n save_success_data e.to_s\n log_info \"*** BackupSourceExecutionFlood error\"\n rescue BackupWorker::Base::BackupIncomplete => e\n workitem.reprocess!\n log_info \"*** Backup job requires reprocessing\"\n rescue Exception => e\n save_error \"#{e.to_s}\\n#{e.backtrace}\"\n log_info \"*** Unexpected error #{e.message}\"\n # Always set job finish flag\n if j = thread_job\n job_finished(j)\n end\n end\n log_info \"Done processing workitem\"\n\n workitem\n end",
"def transform(msg, extended: false)\n case msg\n when LookupService::Data, Lookup::Crossref::Api::Message\n # OK as is.\n else\n msg = Lookup::Crossref::Message::Work.new(msg)\n end\n super(msg, extended: extended)\n end",
"def process(message)\n output = run_worker(message)\n\n complete(message, output)\n end",
"def perform(msg)\n t_msg = perform_transformation msg\n dispatch t_msg\n end",
"def handle_message(data)\n if @encoding == :etf\n handle_etf_message(data)\n else\n handle_json_message(data)\n end\n end",
"def process(chunk, &block)\n @buffer.concat(chunk)\n @buffer.gsub!(MESSAGE_PATTERN) do |match|\n yield($1.to_s) if block_given?\n # erase the message\n ''\n end\n end",
"def process_message(raw_message, conn)\n\n\t\tputs \"<Debug> processing_message: #{raw_message.inspect} from \"\\\n\t\t\t\"#{conn.username}@#{conn.host}:#{conn.port}\" if $DEBUG\n\n\t\tmessage_words = raw_message.split\n\t\tcmd = message_words.shift.downcase\n\n\t\t# irb(main):02> raw_cmd=\"Unicast Katy I used to bite my tongue too\"\n\t\t# => \"Unicast Katy I used to bite my tongue too\"\n\t\t# irb(main):03> message_words=raw_cmd.split\n\t\t# => [\"Unicast\", \"Katy\", \"I\", \"used\", \"to\", \"bite\", \"my\", \"tongue\", \"too\"]\n\t\t# irb(main):04> cmd=message_words.shift.downcase\n\t\t# => \"unicast\"\n\t\t# irb(main):05> message_words\n\t\t# => [\"Katy\", \"I\", \"used\", \"to\", \"bite\", \"my\", \"tongue\", \"too\"]\n\t\t# irb(main):06> dest_username=message_words.shift.downcase\n\t\t# => \"katy\"\n\t\t# irb(main):07> message=message_words.join(\" \")\n\t\t# => \"I used to bite my tongue too\"\n\n\t\tcase cmd\n\n\t\twhen 'broadcast'\n\n\t\t\tbroadcast_message(message_words.join(' '), conn)\n\n\t\twhen 'unicast'\n\n\t\t\tsource_conn \t= conn\n\t\t\tdest_username \t= message_words.shift\n\t\t\tdest_username.downcase! unless dest_username.nil?\n\t\t\tmessage \t\t= message_words.join(\" \")\n\t\t\tdest_conn\t\t= get_connection_by_username(dest_username)\n\t\t\t\n\t\t\t# Set the source username based on whether the client wants full names shown\n\t\t\tsource_username = name_display(dest_conn, source_conn)\n\n\t\t\tif not dest_conn \n\t\t\t\tsource_conn.puts(\"250 Invalid username: \"\\\n\t\t\t\t\t\t\t\t \"#{dest_username.inspect} for unicast\")\n\t\t\telse\n\t\t\t\tdest_conn.puts(\"150 Message from #{source_username}:\")\n\t\t\t\tdest_conn.puts(\"150 #{message}\")\n\t\t\t\tdest_username \t= sprintf(\"%s@%s:%s\", dest_conn.username, \n\t\t\t\t\t\t\t\t\tdest_conn.host, dest_conn.port)\n\t\t\t\tsource_conn.puts(\"350 message sent to #{dest_username}\")\n\t\t\tend\n\n\t\twhen 'list'\n\t\t\t\n\t\t\tconnection_list = \"\"\n\t\t\t@connection_array.each do |connection|\n\t\t\t\tconnection_list << connection.username\n\t\t\t\tconnection_list << \" \"\n\t\t\tend\n\t\t\tconn.puts(\"370 List of connected users shown below:\")\n\t\t\tconn.puts connection_list\n\n\t\twhen 'show_full_names'\n\n\t\t\tconn.puts \"130 Show Full Username set to #{conn.show_full_names}\"\n\n\t\twhen 'toggle_full_names'\n\n\t\t\tif conn.show_full_names == false\n\n\t\t\t\tconn.show_full_names = true\n\t\t\t\tconn.puts \"330 Show Full Usernames now #{conn.show_full_names}\"\n\n\t\t\telse\n\n\t\t\t\tconn.show_full_names = false\n\t\t\t\tconn.puts \"331 Show Full Usernames now #{conn.show_full_names}\"\n\n\t\t\tend\n\t\t\t\n\t\twhen 'help'\n\n\t\t\thelp_subcommand=message_words.first\n\t\t\thelp_subcommand.downcase! unless help_subcommand.nil?\n\n\t\t\tcase help_subcommand\n\n\t\t\twhen nil\n\t\t\t\tconn.puts(\"390 Successful help command:\")\n\t\t\t\tconn.puts(\"\")\n\t\t\t\tconn.puts(\"190 Usage: help <command>, where <command> is:\")\n\t\t\t\tconn.puts(\"190 broadcast unicast list help\")\n\t\t\t\tconn.puts(\"190 show_full_names toggle_full_names\")\n\t\t\t\tconn.puts(\"\")\n\n\t\t\twhen 'unicast'\n\t\t\t\tconn.puts(\"390 Successful help command:\")\n\t\t\t\tconn.puts(\"\")\n\t\t\t\tconn.puts(\"190 unicast <username> message_text\")\n\t\t\t\tconn.puts(\"190 sends message_text to <username>\")\n\t\t\t\tconn.puts(\"\")\n\n\t\t\twhen 'broadcast'\n\t\t\t\tconn.puts(\"390 Successful help command:\")\n\t\t\t\tconn.puts(\"\")\n\t\t\t\tconn.puts(\"190 broadcast message_text\")\n\t\t\t\tconn.puts(\"190 sends message_text to all connected users\")\n\t\t\t\tconn.puts(\"\")\n\n\t\t\twhen 'list'\n\t\t\t\tconn.puts(\"390 Successful help command:\")\n\t\t\t\tconn.puts(\"\")\n\t\t\t\tconn.puts(\"190 list\")\n\t\t\t\tconn.puts(\"190 shows a list of currently connected users\")\n\t\t\t\tconn.puts(\"\")\n\n\t\t\twhen 'show_full_names'\n\t\t\t\tconn.puts(\"390 Successful help command:\")\n\t\t\t\tconn.puts(\"\")\n\t\t\t\tconn.puts(\"190 show_full_names\")\n\t\t\t\tconn.puts(\"190 displays the current show_full_names value\")\n\t\t\t\tconn.puts(\"190 used to control the format of usernames\")\n\t\t\t\tconn.puts(\"190 when 'true' uses username@host:port format\")\n\t\t\t\tconn.puts(\"190 when 'false' uses username format\")\n\t\t\t\tconn.puts(\"190 use help toggle_full_names for more information\")\n\t\t\t\tconn.puts(\"\")\n\n\t\t\twhen 'toggle_full_names'\n\t\t\t\tconn.puts(\"390 Successful help command:\")\n\t\t\t\tconn.puts(\"\")\n\t\t\t\tconn.puts(\"190 toggle_full_names\")\n\t\t\t\tconn.puts(\"190 switches the value of show_full_names\")\n\t\t\t\tconn.puts(\"190 use help show_full_names for more information\")\n\t\t\t\tconn.puts(\"\")\n\n\t\t\telse\n\t\t\t\tconn.puts(\"290 Invalid help subcommand\")\n\n\t\t\tend\n\t\telse\n\t\t\tconn.puts(\"200 Invalid command: #{cmd.inspect}\")\n\t\tend\n\t\t\n\n\tend",
"def proc_msg(m)\r\n message = nil\r\n\t\tbegin\r\n #TODO: spawn new thread here when through put needs to be higher\r\n\t\t\tMessage.transaction do\r\n\t\t\t\tmessage = @pop.process_email(m)\r\n\r\n\t\t\t\t@msg_proc.process(message) unless message.nil?\r\n\t\t\t\[email protected](m)\r\n\t\t\tend\r\n\t\trescue Exception => e\r\n\t\t\tif !message.nil? && !message.id.nil?\r\n\t\t\t\tlog.error(\"Exception processing message: #{message.id}\")\r\n\t\t\tend\r\n\t\t\tlog.error(\"#{e.class}: #{e.message}\")\r\n\t\t\tlog.error(e.backtrace.join(\"\\n\\t\"))\r\n\t\tend\r\n\tend",
"def parse(*args)\n Message.parse(*args)\n end",
"def process workflow_class, message\n @processed_messages << OpenStruct.new(workflow_class: workflow_class, message: message)\n end",
"def consume_message(message)\n create_inbound_batch\n handler = build_handler(message)\n process_message(handler)\n Inbound::Response.build_response(handler.message_id, @batch.inbound_batch_id, @errors)\n rescue => e\n handle_error(e, handler&.message_id)\n Inbound::Response.build_error_response(handler&.message_id, @batch&.inbound_batch_id, e)\n ensure\n @batch.save if @batch.present?\n end",
"def message(message)\n # message can be also accessed via instance method\n message == self.payload # true\n # store_message(message['text'])\n end",
"def process(message, output)\n puts \"Got message #{message.type} from peer: #{message.peer.id}\"\n case message.type\n when :piece\n piece_index, byte_offset, block_data = split_piece_payload(message.payload)\n block = Block.new(piece_index, byte_offset, block_data, message.peer, @piece_length)\n remove_from_pending(block)\n output.push(block)\n when :have\n message.peer.bitfield.have_piece(message.payload.unpack('N')[0])\n # A malicious peer might choose to advertise having pieces\n # that it knows the peer will never download.\n # TODO handle this case if possible\n else\n puts \"currently not processed or ignored message type - #{message.type}\"\n end\n end",
"def process(message)\n lines = send_message(\"PROCESS\", message)\n\n result = SaResult.new()\n\n\n if lines[0].chop =~ /(.+)\\/(.+) (.+) (.+)/\n result.response_version = $2\n result.response_code = $3\n result.response_message = $4\n end\n\n if lines[1].chop =~ /Content-length: (.+)/\n result.content_length = $1\n end\n\n result.report = lines[3..-1].join()\n\n return result\n end",
"def on_incoming_message(msg)\n type = msg.operation\n debug \"(#{id}) Deliver message '#{type}': #{msg.inspect}\"\n htypes = [type, :message]\n if type == :inform\n # TODO keep converting itype is painful, need to solve this.\n if (it = msg.itype(:ruby)) # format itype as lower case string\n case it\n when \"creation_ok\"\n htypes << :create_succeeded\n when 'status'\n htypes << :inform_status\n end\n\n htypes << it.to_sym\n end\n end\n\n debug \"(#{id}) Message type '#{htypes.inspect}' (#{msg.class}:#{msg.cid})\"\n hs = htypes.map { |ht| (@handlers[ht] || {}).values }.compact.flatten\n debug \"(#{id}) Distributing message to '#{hs.inspect}'\"\n hs.each do |block|\n block.call msg\n end\n if cbk = @context2cbk[msg.cid.to_s]\n debug \"(#{id}) Distributing message to '#{cbk.inspect}'\"\n cbk[:last_used] = Time.now\n cbk[:block].call(msg)\n end\n end",
"def message\n if not @message then\n [HTTPLogMessage, TCPLogMessage, StringLogMessage].each do |klass|\n @message = klass.parse(raw_message)\n break if @message\n end\n end\n return @message\n end",
"def execute\n logger.info('Processing message...')\n\n # Process message\n resp = execute_middleware_chain\n\n # Log processing completion and return result\n logger.info(\"Processing done after #{process_duration}s\") { { duration: process_duration } }\n resp\n rescue StandardError => e\n logger.info(\"Processing failed after #{process_duration}s\") { { duration: process_duration } }\n raise(e)\n end",
"def message_process(peer,data)\r\n\t\t\twarn(\"#{m} must be implemented in plugin!\")\t\t\t\r\n\t\tend",
"def process_job_msg(job_msg)\n msg = job_msg[\"msg\"]\n data = job_msg[\"data\"]\n\n if status == 'pending' && msg == 'begin'\n @status = 'running'\n @start_time = Time.now\n elsif (status == 'running' || status == 'unknown') && (msg == 'success' || msg == 'failure')\n @status = msg\n @result = data\n @duration = Time.now - @start_time\n elsif (status == 'running' || status == 'unknown') && msg == 'exception'\n @status = 'exception'\n @exception = data\n @duration = Time.now - @start_time\n elsif msg == \"info\"\n # Ignore client defined messages\n true\n elsif msg == \"arrhythmia\"\n @status = 'unknown'\n @duration = Time.now - @start_time\n else\n raise \"State machine Error #{job_msg}\"\n end\n end",
"def dispatch(message)\n Turntabler.run { @handler.call(message) } if @handler\n end",
"def call(message)\n raise NotImplementedError, \"Must implement this method in subclass\"\n end",
"def queue(message); end",
"def process!\n if processed_at.present? # Do not process if already processed!\n Communicator.logger.info \"InboundMessage #{id} has already been processed, not processing again!\"\n return false\n end\n source, content = message_content.first\n \n # We have to distinguish here between inbound messages that have an id and those that\n # don't since some databases (at least Postgres) will raise an error when the ID is set to nil on\n # the ActiveRecord instance because AR includes the id column and it's \"NULL\" value in the\n # INSERT statement\n if original_id and origin\n Communicator.receiver_for(source).find_for_mapping(:origin => origin, :original_id => original_id).process_message(content)\n else\n Communicator.receiver_for(source).new.process_message(content)\n end\n self.processed_at = Time.now\n self.save!\n Communicator.logger.info \"Processed inbound message ##{id} successfully\"\n \n rescue => err\n Communicator.logger.warn \"Failed to store inbound message ##{id}! Errors: #{self.errors.map{|k,v| \"#{k}: #{v}\"}.join(\", \")}\"\n\n # Add context to exception when using capita/exception_notification fork\n if err.respond_to?(:context)\n err.context[\"Validation Errors\"] = \"Errors: #{self.errors.map{|k,v| \"#{k}: #{v}\"}.join(\", \")}\"\n err.context[\"Inbound Message\"] = self.attributes.inspect\n err.context[\"JSON Content\"] = self.message_content.inspect\n end\n \n raise err\n end",
"def execute(message)\n data_payload = unpack(message)\n payload = new_payload(\n config.fetch(:name, :jackal_cfn),\n :cfn_resource => data_payload\n )\n if(config[:reprocess])\n debug \"Reprocessing received message! #{payload}\"\n Carnivore::Supervisor.supervisor[destination(:input, payload)].transmit(payload)\n message.confirm!\n else\n completed(payload, message)\n end\n end",
"def processMessage\n\n loop do\n\n input = @processMessageQueue.pop\n\n Log::debug \"#{__method__}: #{input}\"\n\n case input[:type]\n when :send\n\n id = input[:id]\n to = input[:to]\n from = input[:from]\n\n output = packMessage(to, input[:message])\n\n if output\n \n @processJobQueue.push({\n :type=>:notifyPacked,\n :id=>id,\n :time => Time.now,\n :counter => output[:counter],\n :message => {\n :to => to,\n :from => from,\n :message => output[:data],\n :ip => input[:ip],\n :port => input[:port]\n } \n })\n\n else\n\n @processJobQueue.push({\n :type=>:notifyNotSent,\n :id=>id,\n :time => Time.now\n })\n\n end\n\n when :receive\n\n id = input[:id]\n \n result = unpackMessage(input[:data])\n\n if result\n\n case result[:recipient]\n when :PR6_RECIPIENT_CLIENT\n\n @processJobQueue.push({\n :type => :processMessage,\n :from => result[:from],\n :to => result[:to],\n :message => result[:data] \n })\n\n when :PR6_RECIPIENT_SERVER\n\n association = AssociationRecord.read(result[:to], result[:to], result[:from])\n\n if association\n\n output = packMessage(result[:from], Server.new(association, @objects).input(result[:counter], result[:data]))\n \n if output.size > 0\n\n @outputQueue.push({\n :to => result[:from],\n :from => result[:to],\n :ip => input[:ip],\n :port => input[:port],\n :message => output[:data]\n })\n\n end\n\n else\n\n Log::warning \"#{__method__}: assocation record removed since last read\"\n \n end\n\n else\n raise\n end\n\n end\n\n else\n raise \"unknown message type\"\n end\n\n end\n\n end",
"def process_message(message, connection)\n discard = false\n if(message.is_a?(FrameType::Message))\n message.origin = current_actor\n message.connection = connection\n retried = false\n begin\n distribution.register_message(message, connection.identifier)\n rescue KeyError => e\n if(!retried && queue.scrub_duplicate_message(message))\n retried = true\n retry\n else\n error \"Received message is currently in flight and not in wait queue. Discarding! (#{message})\"\n discard = true\n end\n end\n end\n discard ? nil : message\n end",
"def handle_arbitrary(msg)\n\t@raw_data = msg.dup()\n\tarbitrary(msg)\n end",
"def process_message(msg)\n @current_from = nil\n @current_to = nil\n @current_msg = nil\n \n case msg\n when /^:(.+?)!(.+?)@(\\S+) PRIVMSG (\\S+) :(.+)$/\n @current_from = $1\n @current_to = $4\n @current_msg = $5.strip\n\n self.check_command_plugins(@current_msg)\n \n when /^PING (.+)$/\n @current_server.write(\"PONG #{$1}\")\n end\n end",
"def process_message(message, connection)\n if(message.is_a?(FrameType::Message))\n distribution.register_message(message, connection.identifier)\n message.origin = current_actor\n end\n message\n end",
"def processmessage(message)\n command = message.split(':')\n\n case command[0]\n when 'pin_assign'\n pin_assign(command[1])\n when 'pin_patternorder'\n pin_patternorder(command[1])\n when 'pin_cycle'\n pin_cycle(command[1])\n when 'pin_clear'\n pin_clear\n when 'pin_format'\n pin_format(command[1])\n when 'pin_timing'\n pin_timing(command[1])\n when 'pin_timingv2'\n pin_timingv2(command[1])\n when 'version'\n \"P:#{@version}\"\n else\n 'Error Invalid command: ' + command[0].to_s\n end\n end",
"def method_missing method, *args\n original_message.send method, *args\n end",
"def each\n while message = read_message\n yield message\n end\n end",
"def message( message )\n\tend",
"def process_message(headers, payload)\n return if throttled?\n return unless filtered?(payload)\n\n @throttle += 1\n display_message(payload)\n end",
"def before_processing_hook(msg, connection); end",
"def call\n begin\n @message.payload.constantize.new(@message, @user).call\n rescue\n ReadError.new().call\n end\n end",
"def process_omf_message(pubsub_item_payload, topic)\n message = OmfCommon::Message.parse(pubsub_item_payload)\n\n unless message.valid?\n raise StandardError, \"Invalid message received: #{pubsub_item_payload}. Please check protocol schema of version #{OmfCommon::PROTOCOL_VERSION}.\"\n end\n\n objects_by_topic(topic).each do |obj|\n OmfRc::ResourceProxy::MPReceived.inject(Time.now.to_f,\n self.uid, topic, message.msg_id) if OmfCommon::Measure.enabled?\n execute_omf_operation(message, obj)\n end\n end",
"def onMessage(message)\n begin\n if @message_count\n @message_count += 1\n @last_time = Time.now\n end\n @proc.call message\n rescue SyntaxError, NameError => boom\n HornetQ::logger.error \"Unhandled Exception processing Message. Doesn't compile: \" + boom\n HornetQ::logger.error \"Ignoring poison message:\\n#{message.inspect}\"\n HornetQ::logger.error boom.backtrace.join(\"\\n\")\n rescue StandardError => bang\n HornetQ::logger.error \"Unhandled Exception processing Message. Doesn't compile: \" + bang\n HornetQ::logger.error \"Ignoring poison message:\\n#{message.inspect}\"\n HornetQ::logger.error boom.backtrace.join(\"\\n\")\n rescue => exc\n HornetQ::logger.error \"Unhandled Exception processing Message. Exception occurred:\\n#{exc}\"\n HornetQ::logger.error \"Ignoring poison message:\\n#{message.inspect}\"\n HornetQ::logger.error exc.backtrace.join(\"\\n\")\n end\n end",
"def handle_item(msg)\n return nil unless @options['outgoing_token'].include? msg[:token] # ensure messages are for us from slack\n return nil if msg[:user_name] == 'slackbot' # do not reply to self\n return nil unless msg[:text].is_a?(String) # skip empty messages\n\n ## loop things to look for and collect immediate responses\n ## rescue everything here so the bot keeps running even with a broken script\n responses = @regexes.map do |regex, proc|\n if mdata = msg[:text].strip.match(regex)\n begin\n Slackbotsy::Message.new(self, msg).instance_exec(mdata, &proc)\n rescue => err\n err\n end\n end\n end\n\n ## format any replies for http response\n if responses\n { text: responses.compact.join(\"\\n\") }.to_json\n end\n end",
"def update_message(data); end",
"def update_message(data); end",
"def method_missing(method, *args, &block)\n message.send(method, *args, &block)\n end",
"def process_message(msg)\n launcher = @IA_Info[:launcher]\n case msg.first\n when :msg_fail, :unefficient_msg, :useless_msg\n @IA_Info[:failure] = true\n when :efficiency_sound\n @IA_Info[:failure] = true if msg.last == 0\n when :hp_down, :hp_down_proto\n if msg[1] == launcher\n @IA_Info[:recoil] += msg[2] if @IA_Info[:symbol] != :s_explosion\n else\n @IA_Info[:damage] += msg[2]\n end\n when :hp_up\n if msg.first == launcher\n @IA_Info[:recoil] -= msg[2]\n else\n @IA_Info[:damage] -= msg[2]\n end\n when :OHKO\n if msg[1] == launcher\n @IA_Info[:recoil] += msg[1].max_hp\n else\n @IA_Info[:damage] += msg[1].max_hp\n end\n when :rand_check\n @IA_Info[:randomness] = msg[1] ? msg[1].to_f / msg.last : msg.last / 100.0\n when :weather_change\n unless BattleEngine.state[:air_lock]\n @IA_Info[:other_factor] = get_weather_advantage_factor(msg[1]) if $env.current_weather == 0\n end\n when :attract_effect\n if msg[1] == launcher\n @IA_Info[:other_factor] = 0.1\n else\n @IA_Info[:other_factor] = get_attract_factor(msg[1])\n end\n when :effect_afraid\n @IA_Info[:status_factor] = rand\n when :status_confuse\n unless @IA_Info[:target].confused?\n @IA_Info[:status_factor] = rand * turn_status_factor(launcher) unless detect_protect_on_status(msg[1], false)\n end\n when :perish_song\n unless @IA_Info[:target].battle_effect.has_perish_song_effect? or launcher.battle_effect.has_perish_song_effect?\n @IA_Info[:other_factor] = get_basic_factor\n end\n when :future_skill\n @IA_Info[:other_factor] = get_basic_factor unless @IA_Info[:target].battle_effect.is_locked_by_future_skill? or launcher.battle_effect.has_future_skill?\n when :stat_reset_neg, :stat_reset\n @IA_Info[:other_factor] = get_basic_factor if launcher.battle_stage.sum < 0\n when :stat_set\n if msg[1] == launcher\n if msg.last > 0\n @IA_Info[:other_factor] = get_basic_factor if (launcher.battle_stage[msg[2]] - msg.last) < 0\n end\n else\n if msg.last < 0\n @IA_Info[:other_factor] = get_basic_factor if (@IA_Info[:target].battle_stage[msg[2]] - msg.last) > 0\n end\n end\n when :set_type\n @IA_Info[:other_factor] = get_basic_factor unless msg[1].type?(msg[2])\n when :set_ability\n @IA_Info[:other_factor] = get_basic_factor unless msg[1].ability_current == msg[2]\n when :switch_pokemon\n @IA_Info[:other_factor] = get_basic_factor if launcher.hp_rate < 0.5\n when :mimic\n @IA_Info[:other_factor] = get_basic_factor if $game_temp.battle_turn > 1 and msg[2].last_skill != 0\n when :entry_hazards_remove\n if BattleEngine.state[:enn_spikes] > 0 or\n BattleEngine.state[:enn_toxic_spikes] > 0 or\n BattleEngine.state[:enn_stealth_rock] or\n BattleEngine.state[:enn_sticky_web]\n @IA_Info[:other_factor] = get_basic_factor(0.8)\n end\n when :apply_out_of_reach\n @IA_Info[:other_factor] = get_basic_factor\n when :set_hp\n if msg[1] == launcher\n @IA_Info[:recoil] += launcher.hp - msg[2]\n else\n @IA_Info[:damage] += @IA_Info[:target] - msg[2]\n end\n when :berry_use\n @IA_Info[:other_factor] = 0.2\n when :after_you\n @IA_Info[:other_factor] = get_basic_factor\n when :change_atk, :change_dfe, :change_spd, :change_dfs, :change_ats, :change_eva, :change_acc\n if msg[1] == launcher\n if msg.last > 0\n @IA_Info[:other_factor] = get_basic_factor if (launcher.battle_stage.sum - msg.last) < 0\n end\n else\n if msg.last < 0\n @IA_Info[:other_factor] = get_basic_factor if (@IA_Info[:target].battle_stage.sum - msg.last) > 0\n end\n end\n when :status_sleep\n unless detect_protect_on_status(msg[1])\n if msg[1].can_be_asleep?\n @IA_Info[:status_factor] = get_basic_factor * turn_status_factor(launcher)\n end\n end\n when :status_frozen\n unless detect_protect_on_status(msg[1])\n if msg[1].can_be_frozen?(@IA_Info[:skill].type)\n @IA_Info[:status_factor] = get_basic_factor * 2\n end\n end\n when :status_poison\n unless detect_protect_on_status(msg[1])\n if msg[1].can_be_poisoned?\n @IA_Info[:status_factor] = get_basic_factor * turn_status_factor(launcher)\n end\n end\n when :status_toxic\n unless detect_protect_on_status(msg[1])\n if msg[1].can_be_poisoned?\n @IA_Info[:status_factor] = get_basic_factor * 2\n end\n end\n when :status_paralyze\n unless detect_protect_on_status(msg[1])\n if msg[1].can_be_paralyzed?\n @IA_Info[:status_factor] = get_basic_factor * turn_status_factor(launcher)\n end\n end\n when :status_burn\n unless detect_protect_on_status(msg[1])\n if msg[1].can_be_burn?\n @IA_Info[:status_factor] = get_basic_factor * 2\n end\n end\n when :status_cure\n if msg[1].status != 0 and msg[1] == launcher\n @IA_Info[:status_factor] = get_basic_factor\n end\n when :set_state\n @IA_Info[:other_factor] = get_basic_factor(0.8) if BattleEngine.state[msg[1]] != msg[2]\n when :send_state\n @IA_Info[:other_factor] = get_basic_factor(0.6)\n when :apply_effect\n @IA_Info[:other_factor] = get_basic_factor(0.3)\n when :status_chance\n @IA_Info[:status_chance] = msg.last / 100.0\n when :chance\n @IA_Info[:randomness] = msg.last / 100.0\n end\n end",
"def process\n data = JSON.parse(@message)\n Log.info data.ai\n end",
"def do_message_callback(message)\n topic = message.topic\n action = parse_action(topic)\n type = parse_type(topic)\n payload = message.payload\n token = nil\n new_version = -1\n @parser_mutex.synchronize() {\n @payload_parser.set_message(payload)\n new_version = @payload_parser.get_attribute_value(\"version\")\n token = @payload_parser.get_attribute_value(\"clientToken\")\n }\n if %w(get update delete).include?(action)\n if @token_pool.has_key?(token)\n @token_pool[token].cancel\n @token_pool.delete(token)\n if type.eql?(\"accepted\")\n do_accepted(message, action.to_sym, token, type, new_version)\n else\n do_rejected(token, action, new_version)\n end\n @task_count_mutex.synchronize {\n decresase_task_count(action.to_sym)\n }\n end\n elsif %w(delta).include?(action)\n do_delta(message, new_version)\n end\n end",
"def process_messages\n @messages.pop do |channel, message|\n Fiber.new do\n on_message(channel, message)\n process_messages\n end.resume\n end\n end",
"def handle_input(patch, json_message, &callback)\n message_hash = JSON.parse(json_message, :symbolize_names => true)\n message = Message.new(message_hash)\n @log.puts(\"Recieved message: #{message_hash.to_json}\") if @log\n yield(message) if block_given?\n message\n end",
"def process(data)\n end",
"def process_message(message)\n urls = []\n # Step 1: Extract all URLs and replace them with a placeholder.\n message = message.gsub(%r!(https?|ftps?|gopher|irc|xmpp|sip)://[[[:alnum:]]\\.,\\-_#\\+&%$/\\(\\)\\[\\]\\?=:@]+!) do\n urls.push($&)\n \"\\x1a\" # ASCII SUB, nobody is going to use this in IRC\n end\n\n # Step 2: Escape any HTML to prevent XSS and similar things.\n # This leaves the placeholders untouched. CGI.escape_html\n # would, if applied to the URLs, escape things like &, which\n # are valid in an URL.\n message = CGI.escape_html(message)\n\n # Step 3: Now re-replace the placeholders with the\n # extracted URLs converted to HTML.\n message = message.gsub(/\\x1a/) do\n if url = urls.shift # Single = intended\n %Q!<a class=\"msglink\" href=\"#{url}\">#{CGI.escape_html(url)}</a>!\n else # This happens if a user really did use an ASCII SUB.\n \"[parse error]\"\n end\n end\n\n message\n end",
"def receive_object message\n transition_on_recv message_name(message), message\n end",
"def process_response\n job = message.job\n job.data = message.data\n job.message = message.message\n\n if message.ok?\n job.proceed!\n else\n job.error!\n end\n end",
"def process(data)\n end",
"def receive_message(message)\n end",
"def parse_content\n parse_result = Postal::MessageParser.new(self)\n if parse_result.actioned?\n # Somethign was changed, update the raw message\n @database.update(self.raw_table, {:data => parse_result.new_body}, :where => {:id => self.raw_body_id})\n @raw = parse_result.new_body\n @raw_message = nil\n end\n update('parsed' => 1, 'tracked_links' => parse_result.tracked_links, 'tracked_images' => parse_result.tracked_images)\n end",
"def receive_object message\n message.exec self \n end",
"def method_missing(*args, &block)\n if block_given?\n @message.send(*args, &block)\n else\n @message.send(*args)\n end\n end",
"def process(message)\n return message unless good_message(message)\n\n text = message[:text]\n group = message[:group]\n attachments = message[:attachments]\n\n @client.create_message group.split('/').last, (text || ''),\n convert_attachments(attachments)\n\n message\n end",
"def receive\n begin\n message = save_message\n rescue => err\n render :text => err.message, :status => 400\n return\n end\n \n begin\n message.process! params\n rescue => err\n message.reply = err.message\n ensure\n if (message.reply != \"Invalid command\")\n collection_id = get_collection_id(params[:body])\n if collection_id and collection_id >0\n message[:collection_id] = collection_id\n end\n end\n message.save\n render :text => message.reply, :content_type => \"text/plain\"\n end\n end",
"def send_message(message); end",
"def send_message(message); end",
"def process_message(msg)\n if admin && authenticated?\n Socky::Message.process(self, msg)\n else\n self.send_message \"You are not authorized to post messages\"\n end\n end",
"def split(message)\n @block.call(message) if @block\n end",
"def personal_message(msg, cl, state)\n respond(msg, cl, \"Hi. Your message was: #{msg.inspect}\")\n respond(msg, cl, \"Body: #{msg.body.to_s}\")\nend",
"def send_message(msg); end",
"def process_message(message)\n case Jobber.config.role\n when :jobber then JobberWorkerUnit.new(message)\n when :participant then ParticipantWorkerUnit.new(message)\n when :listener then ListenerWorkerUnit.new(message)\n end\n end",
"def message_handler(&message_proc)\n @message_proc = message_proc\n end",
"def handle_message(request, message)\n #\n end",
"def next_message; end",
"def next_message; end",
"def parse_message(origin_client_id, message, &block)\n parse_message_internal(origin_client_id, message, false, &block)\n end",
"def process_mailbox\n handler.process\n end",
"def handle_message(message, sender)\n partition = message.split(/\\s+/) #parsing the message\n puts message\n message_type = partition[0]\n if message_type.upcase == \"EXEC\" #exec is used to execute commands from the ui\n func_name, *params = partition[1..-1]\n if EXEC_TABLE.include? func_name\n Thread.new{\n send(func_name, *params)\n }.run\n end\n else\n func_name = partition[0].downcase.sub('-', '_')\n if HANDLE_REQUEST_TABLE.include? \"handle_#{func_name}\"\n Thread.new {\n send(\"handle_#{func_name}\",message, sender)\n }.join\n end\n end\n end",
"def dispatch(message_payload)\n debug_me{[ :message_payload ]}\n raise ::SmartMessage::Errors::NotImplemented\n end",
"def execute(message)\n data_payload = unpack(message)\n payload = new_payload(\n config[:name],\n :cfn_event => data_payload\n )\n if(config[:reprocess])\n debug \"Reprocessing payload through current source (#{destination(:input, payload)})\"\n Carnivore::Supervisor.supervisor[destination(:input, payload)].transmit(payload)\n message.confirm!\n else\n job_completed(:jackal_cfn, payload, message)\n end\n end",
"def process(raw)\n params = self.class.parse(raw)\n if valid?(params)\n transform(params)\n else\n raise ForgedRequest\n end\n end"
] | [
"0.8461261",
"0.8082676",
"0.7521292",
"0.7445535",
"0.73384756",
"0.7263055",
"0.72422",
"0.71891767",
"0.7145564",
"0.7136363",
"0.69771695",
"0.68373334",
"0.67442685",
"0.6737987",
"0.6714277",
"0.6692327",
"0.6615596",
"0.6610975",
"0.65869033",
"0.65688455",
"0.6556698",
"0.6544822",
"0.649876",
"0.6463394",
"0.64530975",
"0.6449792",
"0.6431613",
"0.64108396",
"0.6396012",
"0.6381604",
"0.6381223",
"0.6359463",
"0.63560957",
"0.63407624",
"0.6339797",
"0.6301738",
"0.62908435",
"0.62857294",
"0.62770575",
"0.6266188",
"0.62594825",
"0.62433517",
"0.6242539",
"0.62289375",
"0.62152714",
"0.621456",
"0.6193767",
"0.61937666",
"0.61635345",
"0.6150316",
"0.61431444",
"0.6134851",
"0.6126535",
"0.6111045",
"0.61032724",
"0.6102573",
"0.60951954",
"0.609499",
"0.6093077",
"0.6089653",
"0.6075475",
"0.60688704",
"0.6062064",
"0.6061788",
"0.6048194",
"0.60330266",
"0.60330266",
"0.60249376",
"0.6021027",
"0.60181004",
"0.6016886",
"0.6014362",
"0.60137373",
"0.6000408",
"0.5995344",
"0.5988562",
"0.59840685",
"0.5981868",
"0.5956973",
"0.5950578",
"0.5947033",
"0.5937964",
"0.5936762",
"0.5935557",
"0.5928269",
"0.5928269",
"0.59176385",
"0.5915341",
"0.5912547",
"0.59101474",
"0.5908508",
"0.59074557",
"0.59017247",
"0.5900317",
"0.5900317",
"0.5896748",
"0.58897555",
"0.5875061",
"0.58742577",
"0.58727956",
"0.58707196"
] | 0.0 | -1 |
Produce output representing whether the SMS succeeded or failed. | def to_json
[status, price, date]
.reduce(&:merge)
.to_json
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def result_case\n if @succeeded\n color_print(\"Success\", :green)\n else\n color_print(\"Error\", :red)\n end\n end",
"def print_success_message\n puts \"You have that!\"\n true #why should this return true also? #see my comment on line 53, and look at how it's called on line 96.\n end",
"def succeeded?\n result == \"SUCCESS\"\n end",
"def success_message\n if nagios_mode?\n puts \"OK: All packages match checksums\"\n else\n msg \"metadata_check: ok\"\n end\n end",
"def info\n if @succeeded then 'Success' else \"Failure message='#{@message}'\" end\n end",
"def success?\n @succeeded\n end",
"def success?() end",
"def process \n if self.pending\n return \"Needs Signatures\"\n elsif self.filed \n return \"Filed & Sent\"\n elsif self.completed\n return \"Completed\"\n elsif self.failed\n return \"Failed\"\n else # Fail safe\n end \n end",
"def report_test_result success, msg\n if(success)\n print_success msg\n else\n print_error msg\n end\nend",
"def output_result(text)\n email_results ? (result_output << text) : RAILS_ENV!=\"test\"&&puts(text)\n end",
"def basic_status_and_output(messages); end",
"def successful_text\n 'Success: %d' % successful\n end",
"def successful?\n !output.kind_of?(Error)\n end",
"def process_result(msg, success)\n @results_string += \"%-70s\" % msg \n @results_string += \": \" + (success ? \"Success\" : \"Failed\") + \"\\n\"\n @results.push(success)\nend",
"def success(message)\n print(2, message)\n end",
"def success?\n hash[:smarter_u][:result] == 'Success'\n rescue\n false\n end",
"def success?\n terminal_flag == :success\n end",
"def success?\n reply_code == 0\n end",
"def succeeded?; state == 'succeeded'; end",
"def succeeded?; state == 'succeeded'; end",
"def success(input)\n puts \"[#{Time.now.strftime(\"%T\").purple} \" + \"SUCCESS\" + \"] \" + \"#{input.white}\"\n end",
"def sms number, message\n response = @connection.cmd \"String\" =>\"sms send #{number} #{message}\", \"Match\" => /OK|KO:(.*)/, \"Timeout\" => 5\n if response.chomp == \"OK\"\n true\n else\n raise response.chomp.sub \"KO:\",''\n end\n end",
"def success?; terminal_flag == :success end",
"def success?; terminal_flag == :success end",
"def _send_result state\n unless @one_way || state.message.one_way\n # $stderr.write \"\\n _send_result #{state.result_payload.inspect}\\n\\n\"\n _write(state.result_payload, state.out_stream, state)\n true\n end\n end",
"def processed?\n @processed_smser || @sms_message\n end",
"def success?\n @code.to_i == 0\n end",
"def success?\n result.success\n end",
"def successful?\n output_exists? && expected_output_path\n end",
"def success?\n exit_code == 0\n end",
"def success?\n end",
"def success?(*) end",
"def success(msg)\n tell \"#{✔} {g{#{msg}}}\"\n end",
"def success?\n true\n end",
"def success(message, options = {})\n options[:prefix] ||= \" + \"\n options[:color] ||= :green\n output message, options\n end",
"def send_sms_verification_code\n number_to_send_to = phone_number\n verification_code = phone_verification_code\n sms_message_body = I18n.t(\"devise.phone.message_body\", :verification_code => verification_code)\n\n sms = Sms.new\n sms.phone_number = number_to_send_to\n sms.message = sms_message_body\n return false unless sms.send!\n\n true\n end",
"def success?\n return @process.success? if @process\n return false\n end",
"def success?\n status( @params['txnid'], @params['amount'] ) == 'success'\n end",
"def success?\n stat = false\n if @data and @data['message'] == 'success'\n stat = true\n end\n return stat\n end",
"def is_valid?\n false if not @output.include? 'Generating' or @output.include? 'Failed'\n true\n end",
"def send_sms(*args)\n\t\tbegin\n\t\t\tsend_sms!(*args)\n\t\t\treturn true\n\t\t\n\t\t# something went wrong\n\t\trescue Gsm::Error\n\t\t\treturn false\n\t\tend\n\tend",
"def success?\n exit_status == 0\n end",
"def successful?\n exit_code == 0\n end",
"def success?\n return true\n end",
"def success\n is_successful?\n end",
"def success?\n return @process.success? if @process\n return false\n end",
"def pretty_result\n data['build']['result'] == 0 ? 'passes' : 'fails'\n end",
"def success?\n (@failures + @errors) == 0\n end",
"def analysis_succeeded(stdout)\n while (line = stdout.gets)\n puts line\n end\n end",
"def success?\n outcome == SUCCESS\n end",
"def mailout_status_display\n if self.mailout_status == 'n'\n return 'Not sent'\n end\n if self.mailout_status == 'r'\n return 'Send requested'\n end\n if self.mailout_status == 'i'\n return 'Send in progress'\n end\n if self.mailout_status == 's' \n return 'Sent'\n end\n end",
"def successful?\n @successful\n end",
"def successful?\n @code == 0\n end",
"def success?\n @success\n end",
"def success?\n @success\n end",
"def success?\n @success\n end",
"def success?\n @success\n end",
"def success?\n @success\n end",
"def success?\n @success\n end",
"def success?\n @success\n end",
"def status\n return \"Passed\" if self.passed?\n return \"Failed\" if self.failed?\n return \"Not Run\"\n end",
"def successful?\n @success\n end",
"def to_text\n passfail = success? ? \"passed\" : \"failed\"\n I18n.t(\"okcomputer.check.#{passfail}\", registrant_name: registrant_name, message: message, time: \"#{time ? sprintf('%.3f', time) : '?'}s\")\n end",
"def verify_output()\n STDERR.print \"Checking output \"\n expected = IO.popen(%W(ls -1UA #{TARGET_DIR})) {|c| c.read }\n\n [ true, false ].each do |with_std|\n cmd = [ BIN_PATH, \"-p\" ]\n cmd << \"-s\" if with_std\n cmd << TARGET_DIR\n\n output = IO.popen(%W(ls -1UA #{TARGET_DIR})) {|c| c.read }\n if expected != output\n STDERR.puts \" [failed] #{cmd * \" \"}\"\n exit 1\n end\n\n STDERR.print \".\"\n end\n\n STDERR.puts \" OK\"\nend",
"def success_from(response)\n response == 'SUCCESSFUL' || response =~ /^\\d+$/ || response == 'true'\n end",
"def result_msg\n msgs = []\n results.each { |re| msgs.push(re[:msg]) unless re[:passed]}\n msgs\n end",
"def all_pass_result_summary_msg\n if result_count < 1\n \"uhh...\"\n elsif result_count == 1\n \"pass\"\n else\n \"all pass\"\n end\n end",
"def output(msg = @message)\n @output ||= self.class.check_name + (msg ? \": #{msg}\" : '')\n end",
"def is_successful?\n status_code == '0'\n end",
"def success?\n\t\t\t@success\n\t\tend",
"def success?\n @success_value\n end",
"def success?\n false\n end",
"def success?\n false\n end",
"def successful?\n [\n Remit::PipelineStatusCode::SUCCESS_ABT,\n Remit::PipelineStatusCode::SUCCESS_ACH,\n Remit::PipelineStatusCode::SUCCESS_CC,\n Remit::PipelineStatusCode::SUCCESS_RECIPIENT_TOKEN_INSTALLED\n ].include?(request_query[:status])\n end",
"def successful?\n [\n Remit::PipelineStatusCode::SUCCESS_ABT,\n Remit::PipelineStatusCode::SUCCESS_ACH,\n Remit::PipelineStatusCode::SUCCESS_CC,\n Remit::PipelineStatusCode::SUCCESS_RECIPIENT_TOKEN_INSTALLED\n ].include?(request_query[:status])\n end",
"def success?\n !error\n end",
"def success?\n %w[1 2 3].include?(@status.to_s[0])\n end",
"def passed?\n counters\n .map { |c| c.ask!(:expected_messages_received?) }\n .reduce { |a, e| a && e }\n end",
"def run_and_success?(cmd)\n run(cmd).success?\n end",
"def success?\n got.equal?(true)\n end",
"def sends_sms?\n false\n end",
"def conversion_successful?\n scribd_document && scribd_document.conversion_status =~ /^DISPLAYABLE|DONE$/\n end",
"def successful?\n @progress == 'COMPLETED'\n end",
"def success(message, color = :green)\n return if quiet?\n say(message, color)\n end",
"def output? ; !!@output ; end",
"def success?\n @code.nil? && @error.nil?\n end",
"def success_message(activity)\n case activity\n when \"start_work\" then \"Work started on #{description(edition)}\"\n when \"skip_fact_check\" then \"The fact check has been skipped for this publication.\"\n else \"#{description(edition)} updated\"\n end\n end",
"def msg_sent?\n true\n end",
"def ok?\n @result.retval == 0\n end",
"def success?\n response.message == 'OK'\n end",
"def success?; end",
"def success?; end",
"def success?; end",
"def success?; end",
"def success?; end",
"def success?; end",
"def success?\n completed? && !error?\n end",
"def display_results\r\n if @errors.empty?\r\n if @test_diff.empty?\r\n @out.puts \"Output matches exactly\"\r\n else\r\n @out.puts \"Test diff:\"\r\n @out.puts @test_diff\r\n end\r\n else\r\n @errors.each {|error| @out.puts error }\r\n end\r\n end",
"def success?\n valid? && ack != 'Failure'\n end",
"def success?\n @success\n end",
"def success?\n @error == false\n end"
] | [
"0.6590119",
"0.65091443",
"0.6333734",
"0.62522495",
"0.6244143",
"0.6223656",
"0.620248",
"0.61982536",
"0.6186588",
"0.61556876",
"0.615144",
"0.61461496",
"0.6141668",
"0.612807",
"0.6064222",
"0.6017497",
"0.5996178",
"0.5984132",
"0.5977204",
"0.5977204",
"0.5969359",
"0.5958077",
"0.5954904",
"0.5954904",
"0.5949037",
"0.593918",
"0.59286577",
"0.59140646",
"0.59118557",
"0.5909602",
"0.59093505",
"0.59045494",
"0.5893137",
"0.5863111",
"0.5824735",
"0.5823702",
"0.58107483",
"0.5806952",
"0.580589",
"0.5803368",
"0.580209",
"0.58013767",
"0.5795588",
"0.5791248",
"0.5780717",
"0.5774355",
"0.5774059",
"0.5772024",
"0.57614195",
"0.575988",
"0.57541054",
"0.57495445",
"0.5746962",
"0.5746237",
"0.5746237",
"0.5746237",
"0.5746237",
"0.5746237",
"0.5746237",
"0.5746237",
"0.574484",
"0.5721726",
"0.5709994",
"0.5698465",
"0.56963205",
"0.56954056",
"0.5687013",
"0.56860876",
"0.5678431",
"0.56725645",
"0.5659925",
"0.56567854",
"0.56567854",
"0.5655266",
"0.5655266",
"0.5650933",
"0.5650926",
"0.5632807",
"0.56291455",
"0.5626108",
"0.5625684",
"0.56217664",
"0.5619346",
"0.5614853",
"0.56147903",
"0.5609305",
"0.5606453",
"0.56056285",
"0.5603",
"0.55976415",
"0.55966383",
"0.55966383",
"0.55966383",
"0.55966383",
"0.55966383",
"0.55966383",
"0.55928147",
"0.5592428",
"0.55892456",
"0.55880773",
"0.55851257"
] | 0.0 | -1 |
Represent the date sent. If the attempt to send an SMS failed, do not list the date. | def date
success ? { 'datesent' => sent } : {}
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sent_at\n # Use date it arrived (created_at) if mail itself doesn't have Date: header\n self.mail.date || self.created_at\n end",
"def date_sent\n (@date_sent ||= Time.now)\n end",
"def sent_date_time\n return @sent_date_time\n end",
"def rezm_sent_at(message)\n h(message.created_at.to_date.strftime('%m/%d/%Y') + \" \" + message.created_at.strftime('%I:%M %p').downcase)\n end",
"def sent_at(message)\n h(message.created_at.to_date.strftime('%m/%d/%Y') + \" \" + message.created_at.strftime('%I:%M %p').downcase)\n end",
"def ezm_sent_at(message)\r\n message.created_at.to_date.strftime('%m/%d/%Y') + \" \" + message.created_at.strftime('%I:%M %p').downcase\r\n end",
"def sender_date_time\n return @sender_date_time\n end",
"def date_time\n @message[:date_time]\n end",
"def sent_date_time=(value)\n @sent_date_time = value\n end",
"def message_date\n active_div.div(:id=>\"inbox_show_message\").div(:class=>\"inbox_date\").span.text\n end",
"def received_date\n @received_at.getlocal('-05:00').strftime('%Y-%m-%d-05:00')\n end",
"def email_date\n strftime(MO.email_time_format)\n end",
"def message_received_date_time\n return @message_received_date_time\n end",
"def received_date_time\n return @received_date_time\n end",
"def received_date_time\n return @received_date_time\n end",
"def email_date; strftime(EMAIL_TIME_FORMAT); end",
"def arrival_date; return \"\"; end",
"def message_received_date_time=(value)\n @message_received_date_time = value\n end",
"def sender_date_time=(value)\n @sender_date_time = value\n end",
"def due_date\n notice_date + RESPOND_BY_TIME if notice_date\n end",
"def due_date\n notice_date + RESPOND_BY_TIME if notice_date\n end",
"def message_for(params)\n date = params.has_key?(:date) ? params[:date] : Time.now\n message = <<END_OF_MESSAGE\nFrom: #{@smtp_username}\nTo: #{params[:address]}\nSubject: #{params[:subject]}\nDate: #{date.strftime(\"%a, %d %b %Y %H:%M:%S +0500\")}\n#{params[:body]}\nEND_OF_MESSAGE\n end",
"def invite_date_time\n return @invite_date_time\n end",
"def display\n {\n time: time_received_as_date,\n from: sender_name,\n message: message\n }\n end",
"def get_date_receipt\n unless date_receipt.blank?\n Format.a_short_datetime( date_receipt )\n else\n ''\n end\n end",
"def show\n # convert timestamp string to mmddyyyy\n date = @missed_connection.post_date\n yyyy = date[0..3]\n mm = date[5..6]\n dd = date[8..9]\n @display_date = mm+'/'+dd+'/'+yyyy\n end",
"def date_of_service(service)\n notification = Notification.find_by_name()\n vehicle = service.fleet\n setting = vehicle.truck_fleet.setting.email_notifications.find_by_notification_id(notification.id)\n emails = self.find_emails(vehicle, setting)\n \n if emails.present?\n mail :to => emails,\n :subject => \"Service is today. For #{vehicle.fleet_number}\"\n end\n end",
"def message_time\n created_at.strftime(\"%m/%d/%y\")\n end",
"def date_of_booking(service)\n notification = Notification.find_by_name(\"Overdue service\")\n vehicle = service.fleet\n setting = vehicle.truck_fleet.setting.email_notifications.find_by_notification_id(notification.id)\n emails = self.find_emails(vehicle, setting)\n if emails.present?\n mail :to => emails,\n :subject => \"Date of booking. For #{vehicle.fleet_number}\"\n end\n end",
"def date\n @date\n end",
"def date\n @date\n end",
"def received_at\n params['Process_date'] + params['Process_time']\n end",
"def sent_at\n updated_at_for_status \"sent\"\n end",
"def reminder_sent\n end",
"def date\n request Net::NNTP::Date.new\n end",
"def date; end",
"def date; end",
"def date; end",
"def date; end",
"def send_time\n\t\t self.created_at.strftime(\"%Y-%m-%d %H:%M:%d\")\n\t\tend",
"def get_date\n\t\t@date = Date.today.to_s\n\tend",
"def word_date()\n #Find date action was completed (from database using date_completed function)\n date_string = self.date_completed\n #Return if date does not exist\n return if date_string == nil\n date_string = self.date_completed\n #Parse date into DATETIME format\n date = DateTime.parse(date_string)\n #if the action has not been completed return string anouncing when the action\n #will occur. Logic needed to check if the date is upcoming or overdue.\n if @completed == 'f'\n if date.to_date > Date.today\n return \"DUE: #{date.strftime(\"%B %e, %Y\")}\"\n elsif date.to_date == Date.today\n return \"DUE Today\"\n elsif date.to_date < Date.today\n return \"OVERDUE: #{date.strftime(\"%B %e, %Y\")}\"\n end\n #if action has already been completed, return the date completed.\n else\n return \"#{date.strftime(\"%B %e, %Y\")}\"\n end\n end",
"def received_date_time=(value)\n @received_date_time = value\n end",
"def received_date_time=(value)\n @received_date_time = value\n end",
"def reminder_date_time\n return @reminder_date_time\n end",
"def date\n @date\n end",
"def date\n @date\n end",
"def log_date\n self.well_info.date_logged\n end",
"def received_at\n\tTime.parse params['payment_date']\n end",
"def last_delivered_date_time\n return @last_delivered_date_time\n end",
"def received_at\n params['date'] + params['time']\n end",
"def todo_msg_today; \"today\"; end",
"def send_sms_reminder\n return true # Disable sms sender\n if phone_number and sms_opt_in?\n _participation_requests = participation_requests.where(date: Date.tomorrow, state: 'accepted')\n return false if _participation_requests.empty?\n\n if _participation_requests.length > 1\n message = I18n.t('sms.users.day_before_reminder.multiple_course',\n nb_courses: _participation_requests.length,\n start_time: I18n.l(_participation_requests.first.start_time, format: :short))\n else\n message = _participation_requests.first.decorate.sms_reminder_message\n end\n\n self.delay.send_sms(message, phone_number)\n end\n end",
"def charge_item_detail\n \n \"#{date_from.strftime('%d/%m/%Y')} - #{date_to.strftime('%d/%m/%Y')}\" \n\n end",
"def warn_invalid_date; end",
"def record_sent(object)\n # It is a good idea to skip validation because we don't want to spam the\n # customer if there are any validation problems.\n # object.update_attribute(:my_email_sent_at, Time.zone.now)\n end",
"def get_date()\n @date\n end",
"def get_date()\n @date\n end",
"def date_str\n Util::Date.token_bill_date(created_at)\n end",
"def show_reset(showtime, prev_show, org)\n @org_send = org\n @altered_show2 = prev_show #showtime.show_datetime.strftime(\"%m/%d/%Y at %I:%M%p\") \n @greeting = \"Hi Debby\"\n @showtime = showtime\n if prev_show == showtime\n @new_time = \"canceled\"\n else \n @new_time = @showtime.show_datetime.strftime(\"%m/%d/%Y at %I:%M%p\")\n end \n mail(to: \"[email protected]\", subject: \"Show reset\")\n end",
"def completed_date\n nil\n end",
"def to_s\n \"#{@date.to_s}: #{@text}\"\n end",
"def message_time\n created_at.strftime(\" %d/%m/%y at %l:%M %p\")\n end",
"def due_date_string\n ::Util.date_to_string(self.due_date)\n end",
"def due_date_string\n ::Util.date_to_string(self.due_date)\n end",
"def received_at\n request_datetime\n end",
"def message_time\n created_at.strftime(\"%d/%m/%y at %l:%M %p\")\n end",
"def received_at\n nil\n end",
"def received_at\n nil\n end",
"def to_s\n missing_msg || future_msg || expired_msg || timestamp\n end",
"def date_to_s( date = object.meeting_date )\n Format.a_date( date )\n end",
"def trade_updates(date)\n @update_date = date\n mail to: \"[email protected]\", subject: \"Mise à jour des trades sur le serveur !\"\n end",
"def date\n set_function_and_argument(:date, nil)\n end",
"def message_time\n created_at.strftime(\"%m/%d/%y at %l:%M %p\")\n end",
"def date\n dreport.date_format\n end",
"def sendmessage\n @message = Message.find(params[:id])\n\n #get result path\n if @message.receive_flag\n result_path = inbox_path\n elsif @message.sent_flag\n result_path = archive_path\n else\n result_path = outbox_path\n end\n #check send date\n if @message.send_date > Date.today\n redirect_to result_path, alert: \"Send date is still in the future. Either change the send date or wait\"\n else\n MessageMailer.generic_email(@message).deliver\n #change the sent flag to true and update the sent date\n @message.sent_flag = true\n @message.sent_time = Time.now\n @message.save\n redirect_to result_path, notice: 'Message was successfully sent!'\n end\n end",
"def behandlungsdatum_str\n\t\t@behandlungsdatum_str || fmt_date( self.behandlungsdatum )\n\tend",
"def get_date_scraped\n\n return Date.today.to_s\n\nend",
"def get_date_scraped\n\n return Date.today.to_s\n\nend",
"def recieved\n LeadMailer.recieved\n end",
"def duedate\n @date\n end",
"def date \n\t\tI18n.l(moment, format: :date_long)\n\tend",
"def report_date\n order.completed_at.to_date\n end",
"def received_at\n nil\n end",
"def force_message m; send_message format_message(nil, Time.now, m) end",
"def get_inspection_date\n date.strftime(\"%B %d, %Y, %I:%M %p\")\n end",
"def production_date(*options)\n return (@check_level_details[:is_correspondent] ? @batch.date.strftime(\"%Y%m%d\") : @check.check_date.strftime(\"%Y%m%d\"))\n end",
"def human_readable_date\n d = self.date\n d.strftime(\"%B %d, %Y\")\n end",
"def date\n Time.now\n end",
"def display_date(date = nil)\n case date\n when :published\n date_obj = history[:published]\n when :archived\n date_obj = history[:archived]\n else\n date_obj = created_at\n end\n date_obj&.strftime('%B %-d, %Y')\n end",
"def entered_senedd\n representations.first.log_date\n end",
"def get_date_scraped\n return Date.today.to_s\nend",
"def get_date_scraped\n return Date.today.to_s\nend",
"def set_delivered_at\n self.delivered_at = Date.today\n end",
"def date\n @completed_date = created_at.strftime(\"%m/%d/%Y\")\n return @completed_date\n end",
"def mark_as_received(date = Date.today)\n self.quantity_received = self.quantity_ordered\n self.date_received = date\n end",
"def subscribed_at\n Time.parse params['subscr_date']\n end",
"def claim_from_date\n if @eob.claim_from_date.present? && can_print_service_date(@eob.claim_from_date.strftime(\"%Y%m%d\"))\n [ 'DTM', '232', @eob.claim_from_date.strftime(\"%Y%m%d\")].join(@element_seperator)\n end\n end",
"def loan_due_date_notification(transaction)\n @owner = transaction.owner\n @requester = transaction.requester\n @user_lacquer = transaction.user_lacquer\n @lacquer_name = @user_lacquer.lacquer.name\n @transaction = transaction\n @days_left = (transaction.due_date.to_date - Date.today).to_i\n\n mail(to: @requester.email, subject: \"#{@lacquer_name} is due back to #{@owner.name} on #{@transaction.due_date.strftime(\"%m/%d/%Y\")}.\")\n\n headers['X-MC-Track'] = \"opens, clicks_all\"\n end",
"def sms_recieved(contactnumber,storecode,usermessage,category,sydreferencenume)\n @contactnumber_controller = contactnumber\n @storecode_controller = storecode\n @usermessage_controller=usermessage\n @category_controller = category\n @syd_refnum_controller = sydreferencenume\n date= Time.now()\n @date_controller = date.strftime(\"%d-%m-%Y\")\n subject_controller = \"#{@category_controller}:#{@storecode_controller}\"\n mail to: '[email protected]',:subject => subject_controller\n\n end"
] | [
"0.711625",
"0.7098766",
"0.68883586",
"0.65229815",
"0.64769065",
"0.6459162",
"0.6444061",
"0.64272773",
"0.64107627",
"0.6361319",
"0.62694746",
"0.6267607",
"0.62067914",
"0.61887294",
"0.61887294",
"0.61657304",
"0.6086277",
"0.59660363",
"0.5945253",
"0.59290093",
"0.59290093",
"0.59097314",
"0.5898925",
"0.58727264",
"0.5833391",
"0.58132076",
"0.5813047",
"0.58127344",
"0.5804425",
"0.5782667",
"0.5782667",
"0.5745708",
"0.57247466",
"0.57184976",
"0.5703339",
"0.56883776",
"0.56883776",
"0.56883776",
"0.56883776",
"0.56852806",
"0.5683397",
"0.5682002",
"0.56577903",
"0.56577903",
"0.5590631",
"0.55841446",
"0.55841446",
"0.5567648",
"0.5559127",
"0.5555958",
"0.55364954",
"0.55162656",
"0.55010647",
"0.5496566",
"0.54694724",
"0.5467854",
"0.54645944",
"0.54645944",
"0.5461433",
"0.54608995",
"0.54533637",
"0.5450585",
"0.5445125",
"0.5433738",
"0.5433738",
"0.5421613",
"0.54125077",
"0.54072964",
"0.54072964",
"0.54028076",
"0.54000473",
"0.5396842",
"0.53966045",
"0.5394846",
"0.5394555",
"0.5393504",
"0.53920513",
"0.53863055",
"0.53863055",
"0.53848827",
"0.5380887",
"0.53762037",
"0.5375814",
"0.537159",
"0.53601867",
"0.53569984",
"0.5354551",
"0.5354477",
"0.53509974",
"0.5342973",
"0.53424823",
"0.53422326",
"0.53422326",
"0.5337615",
"0.533534",
"0.5333643",
"0.53283715",
"0.53283703",
"0.53167033",
"0.5313364"
] | 0.72233725 | 0 |
Represent the state of the message. Since no actual process exists, constrain possible statuses to success or failure. | def status
{ 'status' => success ? 'sent' : 'failed' }
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def status\n @message\n end",
"def status\n @status = valid? ? :ok : :unprocessable_entity\n end",
"def state\n case pipeline.status\n when 'scheduled', 'created', 'pending', 'preparing', 'waiting_for_resource' then 'pending'\n when 'running' then 'in_progress'\n when 'success' then 'successful'\n when 'failed' then 'failed'\n when 'canceled', 'skipped' then 'cancelled'\n else\n 'unknown'\n end\n end",
"def status\r\n case status_id\r\n when 1; \"Sending\"\r\n when 2; \"Sent\"\r\n when 3; \"Bounced\"\r\n when 4; \"Opened\"\r\n when 5; \"Downloaded\"\r\n when 6; \"Send Failed\"\r\n else; \"Processing\"\r\n end\r\n end",
"def notify message\n raise ArgumentError unless message\n raise RuntimeError.new(\"can't process message when status is :#{@status}, title: #{@title}, desc: #{describe}\") unless ready? || collecting?\n if perform_match message\n if done?\n complete\n else\n incomplete\n end\n end\n @status\n end",
"def state\n running_response = running?\n return running_response unless running_response.successful?\n\n response = Response.new :code => 0, :data => 'not running'\n\n if running_response.data\n response.data = 'running'\n else\n suspended_response = suspended?\n return suspended_response unless suspended_response.successful?\n\n response.data = 'suspended' if suspended_response.data\n end\n\n response\n end",
"def state\n running_response = running?\n return running_response unless running_response.successful?\n\n response = Response.new :code => 0, :data => 'not running'\n\n if running_response.data\n response.data = 'running'\n else\n suspended_response = suspended?\n return suspended_response unless suspended_response.successful?\n\n response.data = 'suspended' if suspended_response.data\n end\n\n response\n end",
"def display_status\n if is_incoming_message?\n status = self.calculated_state\n if !status.nil?\n if status == 'waiting_response'\n return \"Acknowledgement\"\n elsif status == 'waiting_clarification'\n return \"Clarification required\"\n elsif status == 'gone_postal'\n return \"Handled by post\"\n elsif status == 'not_held'\n return \"Information not held\"\n elsif status == 'rejected'\n return \"Rejection\"\n elsif status == 'partially_successful'\n return \"Some information sent\"\n elsif status == 'successful'\n return \"All information sent\"\n elsif status == 'internal_review'\n return \"Internal review acknowledgement\"\n elsif status == 'user_withdrawn'\n return \"Withdrawn by requester\"\n elsif status == 'error_message'\n return \"Delivery error\"\n elsif status == 'requires_admin'\n return \"Unusual response\"\n end\n raise \"unknown status \" + status\n end\n return \"Response\"\n end\n\n if is_outgoing_message?\n status = self.calculated_state\n if !status.nil?\n if status == 'internal_review'\n return \"Internal review request\"\n end\n if status == 'waiting_response'\n return \"Clarification\"\n end\n raise \"unknown status \" + status\n end\n return \"Follow up\"\n end\n\n raise \"display_status only works for incoming and outgoing messages right now\"\n end",
"def status\n return \"draft\" if self.draft?\n return \"sent\" if self.sent?\n return \"batch\" if self.batch_sent?\n end",
"def status\n if waiting?\n :waiting\n elsif running?\n :running\n elsif done?\n :done\n end\n end",
"def get_instance_state_message\n @status ||= 0\n @status %= 4\n {\n \"0\" => \"H\", \n \"1\" => \"O\", \n \"2\" => \"L\", \n \"3\" => \"A\"\n }[ ((@status+=1)-1).to_s ]\n end",
"def state\n case data['build']['result']\n when nil\n 'pending'\n when 0\n 'success'\n when 1\n 'failure'\n end\n end",
"def message\n read_content :status\n end",
"def status\n return :completed if completed?\n return :failed if failed?\n :pending\n end",
"def state\n if !self.completed?\n 'Incomplete'\n elsif self.completed? && !self.closed?\n 'Complete'\n else\n 'Closed'\n end\n end",
"def state\n if !self.completed?\n 'Incomplete'\n elsif self.completed? && !self.closed?\n 'Complete'\n else\n 'Closed'\n end\n end",
"def status_message\n data.status_message\n end",
"def processing_state\n return 'pending' if installments.empty?\n\n installments.last.fulfilled? ? 'success' : 'failed'\n end",
"def status\n return :code => info[:statuscode].to_i, :messages => info[:messages]\n end",
"def status\n complete? ? 'Completed' : 'Failed'\n end",
"def current_state\n if !self.failure_message.nil?\n { message: self.failure_message, status: :forced_failure }\n elsif temporary\n { message: 'Running Visual Tests', status: :pending }\n else\n unapproved_count = self.unapproved_diffs.count\n approved_count = self.approved_diffs.count\n new_count = self.new_tests.count\n message_components = []\n message_components.push(\"#{new_count} new tests\") if new_count > 0\n\n if unapproved_count > 0\n message_components.push(\"#{unapproved_count} unapproved diffs\")\n end\n\n if approved_count > 0\n message_components.push(\"#{approved_count} approved diffs\")\n end\n\n message = message_components.count > 0 ? message_components.join(', ') : '0 diffs'\n status = unapproved_count > 0 ? :failure : :success\n { message: message, status: status }\n end\n end",
"def status_text\n if skipped?\n 'skipped'\n elsif error?\n 'error'\n else\n 'success'\n end\n end",
"def state\n status[\"state\"]\n end",
"def status_message\n @data[:status_message]\n end",
"def states\n [\n 'CREATE_IN_PROGRESS',\n 'CREATE_IN_PROGRESS',\n 'CREATE_FAILED',\n 'CREATE_COMPLETE',\n 'ROLLBACK_IN_PROGRESS',\n 'ROLLBACK_FAILED',\n 'ROLLBACK_COMPLETE',\n 'DELETE_IN_PROGRESS',\n 'DELETE_FAILED',\n 'DELETE_COMPLETE',\n 'UPDATE_IN_PROGRESS',\n 'UPDATE_COMPLETE_CLEANUP_IN_PROGRESS',\n 'UPDATE_COMPLETE',\n 'UPDATE_ROLLBACK_IN_PROGRESS',\n 'UPDATE_ROLLBACK_FAILED',\n 'UPDATE_ROLLBACK_COMPLETE_CLEANUP_IN_PROGRESS',\n 'UPDATE_ROLLBACK_COMPLETE',\n 'REVIEW_IN_PROGRESS'\n ]\n end",
"def status_message\n if self.deleted_at\n return \"Cancelled\"\n else\n if self.chosen_presenter == nil\n if self.help_required\n return \"Help Required\"\n elsif self.presenters.present?\n return \"Bids Pending\"\n else\n return \"Awaiting Bids\"\n end\n else\n if self.booking_date < Time.now\n return \"Completed\"\n else\n return \"Locked in\"\n end\n end\n end\n end",
"def status_final_state\n return unless status_changed?\n return unless %w(denied missed returned archived).include?(status_was)\n errors.add(:base, \"Cannot change status of #{status_was}\"\\\n \" reservation.\\n\")\n end",
"def status_message; end",
"def state\n return \"not created\" unless self.exists?\n\n return \"suspend\" if self.suspended?\n\n return \"running\" if self.running?\n\n return \"not running\"\n end",
"def status_text\n return 'Unknown' if state.blank?\n\n return I18n.t(\"activerecord.attributes.export_job.status.#{state}\") unless in_progress?\n\n I18n.t('activerecord.attributes.export_job.status.in_progress') + progress_text\n end",
"def status\n return 'Appealed' if self.punishment.appealed?\n return 'Closed' if !self.open || self.locked\n return 'Escalated' if self.escalated\n return 'Open'\n end",
"def mailout_status_display\n if self.mailout_status == 'n'\n return 'Not sent'\n end\n if self.mailout_status == 'r'\n return 'Send requested'\n end\n if self.mailout_status == 'i'\n return 'Send in progress'\n end\n if self.mailout_status == 's' \n return 'Sent'\n end\n end",
"def display_status(item_status_code)\n case item_status_code\n when 'I' # Initiated (Assigned)\n 'incomplete'\n when 'A', 'R' # Active (Processing) / Received\n 'beingProcessed'\n when 'C', 'W' # Completed / Waived\n 'completed'\n when 'Z' # Incomplete\n 'furtherActionNeeded'\n else\n 'incomplete'\n end\n end",
"def status\n return \"Passed\" if self.passed?\n return \"Failed\" if self.failed?\n return \"Not Run\"\n end",
"def status\n if complete?\n \"PAID\"\n else\n \"PENDING\"\n end\n end",
"def process \n if self.pending\n return \"Needs Signatures\"\n elsif self.filed \n return \"Filed & Sent\"\n elsif self.completed\n return \"Completed\"\n elsif self.failed\n return \"Failed\"\n else # Fail safe\n end \n end",
"def status\n state = (active_instance.nil? ? 999 : active_instance.status)\n case state\n when 0 \n 'missing'\n when 1 \n 'none'\n when 2 \n 'pending'\n when 3 \n 'unready'\n when 4 \n 'failed'\n when 5 \n 'ready'\n when 666 \n 'deleted'\n when 999\n 'inactive'\n else \n 'hold'\n end\n end",
"def status\n case @result.retval\n when 0 ; \"ok\"\n when 1 ; \"warning\"\n when 2 ; \"critical\"\n end\n end",
"def state\n if completed?\n :complete\n elsif started\n :in_progress\n else\n :not_started\n end\n end",
"def state_s\n # return \"审核中\" if approving?\n return \"等待激活中\" if unapproved?\n return \"审核被拒绝\" if rejected?\n return \"展示中\" if opened? and available?\n return \"高亮展示中\" if highlighted? and opened? and available?\n return \"已过期\" if !available?\n return \"未展示\" if closed?\n end",
"def status\n :process #default\n end",
"def status\n\t\treturn \"Pending\" if !completed\n\t\t\"Completed\"\n\tend",
"def current_status\n if done?\n failed? ? 'Error' : 'Completed'\n else\n 'Running'\n end\n end",
"def status\n {\n name: name,\n state: state,\n grouped: false,\n prioritized: prioritized,\n pairwise: pairwise,\n subjects: subjects.size,\n users: users.length\n }\n end",
"def state\n status.state name\n end",
"def message\n params['StatusDetail']\n end",
"def basic_status_and_output(messages); end",
"def status_description\n return \"Cancelled\" if cancelled\n return \"Completed\" if has_ended?\n \"In Future\"\n end",
"def status\n value_for('status')\n end",
"def running_status\n return @running\n ahn_log.hammer.debug \"Status requested...sent as #{@running.to_s}...\"\n end",
"def success_states\n [\n 'CREATE_COMPLETE',\n 'DELETE_COMPLETE',\n 'UPDATE_COMPLETE'\n ]\n end",
"def status_code\n @status_code ||= if absolved?\n \"A\"\n elsif finished?\n \"Z\"\n elsif interrupted?\n \"P\"\n elsif final_exam_passed?\n \"S\"\n elsif continues?\n \"S\"\n elsif studying?\n \"S\"\n elsif before_admit?\n \"S\"\n else\n raise UnknownState\n end\n return @status_code\n end",
"def status_message\n DivaServicesApi::Algorithm.by_id(self.id, self) if @status_message == nil\n @status_message\n end",
"def status_string\n case status\n when APPROVED_STATUS\n \"approved\"\n when REJECTED_STATUS\n \"rejected\"\n when REMOVED_STATUS\n \"removed\"\n when PENDING_STATUS\n \"pending\"\n else\n \"error\"\n end\n end",
"def message\n status.last\n end",
"def main_state\n if start_step?\n return \"START\"\n elsif finish_step? && finished?\n return \"FINISH\"\n elsif state == \"ACTION\" && !params_hash[\"manual\"]\n return \"PROCESS\"\n elsif state == \"WAITFOR\"\n return \"PROCESS\"\n else\n return state\n end\n end",
"def status\n inspect\n end",
"def status\n STATUSES[code] || 'Unknown'\n end",
"def succeeded?; state == 'succeeded'; end",
"def succeeded?; state == 'succeeded'; end",
"def write_status(state, mesg = '')\n msg = \"#{state} #{mesg}\\n\"\n\n STDOUT.write(\"#{Process.pid} - #{Time.now} - #{msg}\")\n $RQ_IO.syswrite(msg)\nend",
"def message text\n $status_message.value = text # trying out 2011-10-9 \n end",
"def status\n \"#{@description} #{@status}\"\n end",
"def status\n status_async.value!\n end",
"def correctly_update_status\n\t\terrors.add(:base, 'La transaccion no fue exitosa') if self.invalid_status\n\tend",
"def status\n @status ||= STATUS[mapping_for(:status)]\n end",
"def status\n @status ||= STATUS[mapping_for(:status)]\n end",
"def status(*) end",
"def status_string\n case self.entry_status\n when 1: 'Draft'\n when 2: 'Publish'\n when 4: 'Scheduled'\n end\n end",
"def write_status(state, mesg = '')\n msg = \"#{state} #{mesg}\\n\"\n\n STDOUT.write(\"#{Process.pid} - #{Time.now} - #{msg}\")\n STDOUT.flush\n $RQ_IO.syswrite(msg)\nend",
"def status\n @status ||= status_line.split(/: /)\n end",
"def status\n if closed?\n return \"closed\"\n elsif submitted?\n return retrieved? ? \"retrieved\" : \"submitted\"\n else\n \"new\"\n end\n end",
"def status_desc\n case self.proposal_status\n when 0\n 'Pending'\n when 1\n 'Accepted'\n when 2\n 'Declined'\n end\n end",
"def status\n @status\n end",
"def status\n @status\n end",
"def status\n if params['fraud_status'] == 'pass' || params['credit_card_processed'] == 'Y'\n 'Completed'\n elsif params['fraud_status'] == 'wait'\n 'Pending'\n else\n 'Failed'\n end\n end",
"def status\n {\n 'body' => 'Service is up!'\n }\n end",
"def status\n 'unknown'\n end",
"def status_effect\n return data.status\n end",
"def status\n @__status\n end",
"def status\n Integer(@object.payload[:status]) rescue nil\n end",
"def state\n if completed\n \"complete\"\n else\n if complete_by < Time.now\n \"incomplete-late\"\n else\n \"incomplete-upcoming\"\n end\n end\n end",
"def status\n raise NotImplementedError\n end",
"def status=(value)\n value = value.to_s.to_sym\n fail Deployment::InvalidArgument, \"#{self}: Invalid task status: #{value}\" unless ALLOWED_STATUSES.include? value\n status_changes_concurrency @status, value\n @status = value\n reset_forward if DEPENDENCY_CHANGING_STATUSES.include? value\n @status\n end",
"def current_status\n case status\n when NOT_STARTED\n return 'Game not started yet'.freeze\n when RUNNING\n return 'Game is running'.freeze\n when WIN\n return 'Game is won'.freeze\n when DRAWN\n return 'Game is drawn'.freeze\n when ABANDONED\n return 'Game is abandoned'.freeze\n end\n end",
"def status\n original.status || nil\n end",
"def status\n original.status || nil\n end",
"def public_status_msg\n if !status.nil? && status.public?\n status.message\n else\n nil\n end\n end",
"def status_message\n (+'').tap do |ret|\n if task.progress\n ret << \"#{(task.progress * 100).to_i}%\"\n ret << ': ' if task.progress_message.present?\n end\n ret << task.progress_message if task.progress_message.present?\n end\n end",
"def status\n if not(exist?)\n return :init\n end\n\n if @ppg_filename.nil?\n return :unset\n end\n\n if Global.job_queue.active?(@id)\n return :processing\n end\n\n return :processable\n end",
"def sending_status\n case session_status\n when \"sending\", \"queued\"\n :pending\n when \"sent\"\n :sent\n when \"error during submit\", \"failed\"\n :failed\n else\n raise \"Could not determine status of response: #{inspect}\"\n end\n end",
"def status\n ActiveSupport::StringInquirer.new(self[:status] || \"\")\n end",
"def status\n raise \"Status not set for #{self.inspect}\" if @status == :nil\n raise \"Not allowed status: #{@status} for #{self.inspect}\" unless ALLOWED.include?(@status)\n @status\n end",
"def step_status(msg = '')\n\t\toutput.print_status(\"#{pos}: #{msg}\") if (msg and msg.length > 0)\n\tend",
"def status\n if @halted\n :halted\n elsif @needs_input\n :needs_input\n elsif @pc >= @mem.size\n :pc_range_err\n else\n :ok\n end\n end",
"def status\n return :cancelled if cancelled?\n return :closed if closed?\n return :active if active?\n\n # If the establishment is not active, closed, or cancelled it is pending\n :pending\n end",
"def state_string()\n ss = 'UNKNOWN'\n case @state\n when STARTING\n ss = 'STARTING'\n when STOPPED\n ss = 'STOPPED'\n when RUNNING\n ss = 'RUNNING'\n when CLOSING\n ss = 'CLOSING'\n when BLOCKED\n ss = 'BLOCKED'\n when STEP\n ss = 'STEP'\n end\n ss\n end",
"def status\n data[:status]\n end",
"def status_description\n\t\treturn case self.status\n\t\t\twhen 'M' then 'modified'\n\t\t\twhen 'A' then 'added'\n\t\t\twhen 'R' then 'removed'\n\t\t\twhen 'C' then 'clean'\n\t\t\twhen '!' then 'missing'\n\t\t\twhen '?' then 'not tracked'\n\t\t\twhen 'I' then 'ignored'\n\t\t\telse\n\t\t\t\traise \"unknown status %p\" % [ self.status ]\n\t\t\tend\n\tend",
"def status(state, body = nil)\n raise Halcyon::Exceptions.const_get(state.to_s.camel_case.to_sym).new(body)\n rescue NameError => e\n self.logger.error \"Invalid status #{state.inspect} specified.\"\n self.logger.error \"Backtrace:\\n\" << e.backtrace.join(\"\\n\\t\")\n raise Halcyon::Exceptions::ServiceUnavailable.new\n end"
] | [
"0.6846644",
"0.66293347",
"0.66269106",
"0.66153204",
"0.6553104",
"0.6549327",
"0.6549327",
"0.64767283",
"0.64706343",
"0.64233404",
"0.6397229",
"0.6392587",
"0.63582593",
"0.63575286",
"0.63084304",
"0.63084304",
"0.62993824",
"0.6264156",
"0.62407106",
"0.6214449",
"0.62103224",
"0.62013674",
"0.6191604",
"0.61886096",
"0.6181848",
"0.6180804",
"0.6144252",
"0.6130297",
"0.6124424",
"0.60914433",
"0.60671115",
"0.6061488",
"0.60601753",
"0.6038667",
"0.60356826",
"0.60056996",
"0.59992677",
"0.598217",
"0.59818363",
"0.5974955",
"0.5974677",
"0.5965147",
"0.5952287",
"0.5941548",
"0.5930509",
"0.59182006",
"0.59172815",
"0.58971524",
"0.58921844",
"0.5870275",
"0.586795",
"0.5866032",
"0.586602",
"0.58577484",
"0.5835506",
"0.5818115",
"0.5812454",
"0.5807352",
"0.579141",
"0.579141",
"0.5782811",
"0.57825375",
"0.5781529",
"0.5778271",
"0.5776747",
"0.57679343",
"0.57679343",
"0.5767456",
"0.57671034",
"0.5764878",
"0.576046",
"0.57497865",
"0.57426584",
"0.5739246",
"0.5739246",
"0.57246906",
"0.5724553",
"0.5721521",
"0.5712338",
"0.57118523",
"0.57072663",
"0.5705989",
"0.57050383",
"0.5702623",
"0.5701577",
"0.5695699",
"0.5695699",
"0.5687358",
"0.5668105",
"0.5663687",
"0.5662063",
"0.5652968",
"0.56506413",
"0.56478715",
"0.56410134",
"0.56349075",
"0.5632581",
"0.56228775",
"0.56220657",
"0.5616054"
] | 0.67070526 | 1 |
Represent the cost to send the message. Possibilities are constrained to 3 cents and nothing, predicated on success. | def price
{ 'price' => success ? '0.03' : '0.00' }
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cost \n return @extra_cost + @basic_transfer.cost\n end",
"def cost\n 0.99\n end",
"def cost\n 0.89\n end",
"def cost\n 1.99\n end",
"def cost\n deductible * RATE\n end",
"def cost \n return @extra_cost + @basic_prescription.cost\n end",
"def cost\n self[:cost].to_f\n end",
"def actual_cost\n self.cost/1000.to_f\n end",
"def required_cost\n return nil unless payment_for && (payment_for.is_a?(Invite) || payment_for.is_a?(UserKroog))\n return payment_for.amount_usd.to_f\n end",
"def cost\n\t\treturn @extra_cost + @real_donation.cost\n\tend",
"def cost\n @cost = 0.99\n end",
"def cost\n @cost = 0.89\n end",
"def cost\n # Todo pull this from the DB\n 1000\n end",
"def cost\n return @extra_cost + @basic_booking.cost\n end",
"def cost\n super + 0.15\n end",
"def cost\r\n 0\r\n end",
"def cost\r\n\t\treturn @extra_cost + @real_need.cost\r\n\tend",
"def cost\n @cost = 1.99\n end",
"def cost\n\t\treturn @extra_cost + @real_shake.cost\n\tend",
"def worth_at_cost\n worth= cost*quantity\n return worth\n end",
"def cost\n (@items_cost - @promotion_adjustment).round(2)\n end",
"def cost \n return @extra_cost + @basic_booking.cost\n end",
"def cost \n return @extra_cost + @basic_booking.cost\n end",
"def cost\n super + 0.20\n end",
"def cost()\n unless @cost\n @cost = @description.inject(0) do |val, el|\n val + ((el.nil? || el.to_s.end_with?('?')) ? 1 : 0.1)\n end\n end\n @cost\n end",
"def cost\n return @cost\n end",
"def cost\n return @cost\n end",
"def cost\n @cost ||= calibrate_cost\n end",
"def total_cost\n @cost + tip\n end",
"def cost \n return @extra_cost + @basic_tran.cost\n end",
"def cost\n super + 0.10\n end",
"def cost\n super + 0.10\n end",
"def total_cost\n # quantity * unit_cost_price\n unit_cost_price\n end",
"def total_cost\n @quantity * @price\n end",
"def cost\n @beverage.cost + 0.15\n end",
"def cost\n @cost ||= 10\n end",
"def total_cost\r\n self.qty * self.price\r\n end",
"def unit_cost_price\n self[:cost_price] || unit_price - application_fee\n end",
"def extra_cost\n if extra_cost_cents.present?\n read_attribute(:extra_cost_cents) / 100.0\n else\n 0\n end\n end",
"def calc_total_cost()\n\t\ttotal_cost = @cost.to_i * 0.9\n\tend",
"def cost\n @beverage.cost + 0.20\n end",
"def cost\n @beverage.cost + 0.10\n end",
"def cost\n @beverage.cost + 0.10\n end",
"def calculate_costs\n self.amount = self.transaction.shipping_cost + self.transaction.value\n self.shipping_cost = self.transaction.shipping_cost\n self.commission_rate = self.buyer.account.commission_rate || SiteVariable.get(\"global_commission_rate\").to_f # Calculate commission rate, if neither exist commission is set to 0\n self.commission = Money.new((commission_rate * self.transaction.value.cents).ceil) # Calculate commision as commission_rate * item value (without shipping), round up to nearest cent\n end",
"def cost \n return @extra_cost + @basic_inst.cost\n end",
"def total_cost\n ingredients_cost + components_cost\n end",
"def send_money(amount)\n fail unless amount >= 0\n self.credits += amount\n end",
"def cost_in_dollars\n self.cost / 100.to_f\n end",
"def direct_costs_for_one_time_fee\n # TODO: It's a little strange that per_unit_cost divides by\n # quantity, then here we multiply by quantity. It would arguably be\n # better to calculate total cost here in its own method, then\n # implement per_unit_cost to call that method.\n num = self.quantity || 0.0\n num * self.per_unit_cost\n end",
"def getcost()\n return @cost\n end",
"def opportunity_cost_or_offer_friendly(opportunity)\n if opportunity.cost_or_offer_option == 0\n 'Quiero poner un valor para el proyecto'\n else\n 'Quiero escuchar ofertas de los estudiantes'\n end\n end",
"def cost \n return @extra_cost + @basic_drug.cost\n end",
"def cost\n purchase_cost\n end",
"def cost\n purchase_cost\n end",
"def cost=(value)\n @cost = value\n end",
"def cost=(value)\n @cost = value\n end",
"def total_cost\n product.cost * quantity\n end",
"def cost_of_cable(length)\n\t\tmeter = length * 0.01\n\t\tdollar = [meter * 0.4079 + 0.5771, meter * 0.0919 + 7.2745].min * BANDWIDTH\n\t\t(dollar * 100).round.to_f / 100\n\tend",
"def tip\n (@cost * (@percent.to_f / 100)).round(2)\n end",
"def net_price\n if self.patient.is_a_firm?\n self.price\n else\n self.price + get_additional_cost_totals()[:negative]\n end\n end",
"def total_cost\n self.qty * self.unit_cost\n end",
"def cost\n total = 0.0\n not_covered.each do |n|\n total += n.cost\n end\n total\n end",
"def cf_purchase_transaction_cost\n cash_flow_builder(amt: -self.purchase_transaction_cost*1000, pos_arr: [0])\n end",
"def cost(meth)\n @costs[meth][\"cost_per_call\"] / 100.0 rescue 0.0\n end",
"def total_cost\n quantity * product.price\n end",
"def total_cost\n quantity * product.price\n end",
"def total_cost\n @meal_cost + @tip_amount\n end",
"def host_fee\n (total - net_rate).round(2)\n end",
"def total_cost\n \tingredients_cost + components_cost\n end",
"def total_costs\n fixed_costs + variable_costs\n end",
"def total_cost\n total_cost = 0\n trips.each do |trip|\n total_cost += trip.cost\n end\n return \"$ #{total_cost/100.round(2)}\"\n end",
"def calc_item_cost(skill)\n cost = skill.consume_item_n\n cost *= skill.target_number if skill.multiply_per_target\n cost /= 2 if half_mp_cost && cost > 1\n cost\n end",
"def cost_of_stay\n num_of_nights * 200.00\n end",
"def total_cost(distance, mpg, cpg)\n\tprice = (distance / mpg) * cpg \nend",
"def fuel_cost\n ((amount * 100) / (mileage - predecessor.mileage)).round(1) if predecessor\n end",
"def fixed_costs\n fixed_costs_per_unit * number_of_units\n end",
"def draw_item_cost\n return if item.consume_item == 0\n if item.multiply_per_target\n number_text = 'xN°bers.'\n else\n number_text = sprintf('x%d', item.consume_item_n)\n end\n draw_detail(Vocab::ITEM_CONSUME, number_text,\n $data_items[item.consume_item].icon_index,\n line_height, normal_color, :right)\n end",
"def fuel_costs\n fetch(:fuel_costs) do\n if typical_input && typical_input < 0\n raise IllegalNegativeError.new(self, :typical_input, typical_input)\n end\n\n typical_input * weighted_carrier_cost_per_mj\n end\n end",
"def total_cost\n self.ingredients.map{ | ing | ing.cost_per_unit * ing.quantity } .reduce(&:+).round(2)\n end",
"def usage_cost\n @attributes[:usage_cost]\n end",
"def shipping_cost(length, width, height)\n cost = (length * width * height) * 1.25\n end",
"def total_cost\n self.delivery_cost_price +\n order_items.inject(BigDecimal(0)) { |t, i| t + i.total_cost }\n end",
"def skill_tp_cost(skill)\n return 0\n end",
"def set_gojek_cost(line_items)\n\t\tline_items.any? ? 'Rp 15,000' : 'Rp 0'\n\tend",
"def error_not_enough_money\n puts \"\\n ERROR: THE AMOUNT YOU REQUESTED CANNOT BE COMPOSED NOT ENOUGH MONEY. PLEASE TRY AGAIN with DIFFERENT AMOUNT\"\n end",
"def production_cost\n price = use_vendor_price? ? item.price : self.price\n price * quantity\n end",
"def cost_difference\n cost - estimated_cost\n end",
"def total_costs\n fetch(:total_costs) do\n fixed_costs + variable_costs if fixed_costs && variable_costs\n end\n end",
"def production_cost\n reagent_reference.production_cost * quantity\n end",
"def draw_cost\n draw_header\n \n change_color(system_color)\n \n draw_text(5, 32, self.width, 24, \"Custo:\")\n \n cost = @item.enchant_cost(@symbol).to_i\n \n change_color(cost > $game_party.gold ? crisis_color : normal_color)\n draw_text(self.width - 96, 32, 96, 25, \"#{cost} #{Vocab.currency_unit}\")\n \n change_color(system_color)\n draw_text(5, 64, self.width, 24, \"Itens necessários:\")\n change_color(normal_color)\n \n @enchant[:items].each_with_index do |x, i|\n change_color(x[1] > $game_party.item_number($data_items[x[0]]) ? crisis_color : normal_color)\n draw_icon($data_items[x[0]].icon_index, 5, 88 + 24 * i)\n draw_text(32, 88 + 24 * i, self.width - 52, 24, $data_items[x[0]].name)\n draw_text(self.width - 64, 88 + 24 * i, 64, 24, sprintf(\":%02d\", x[1]))\n end\n \n draw_text(5, 88, self.width, 24, MBS::Equip_Enchantment::EMPTY_TEXT) if @enchant[:items].empty?\n \n end",
"def set_Cost(value)\n set_input(\"Cost\", value)\n end",
"def set_Cost(value)\n set_input(\"Cost\", value)\n end",
"def total_cost\n [executor_cost, team_lead_cost, account_manager_cost].compact.inject(&:+)\n end",
"def unit_cost\n @unit_cost ||= component ? component.cost : 0\n end",
"def suitable_halfs\n required_amount\n end",
"def product_cost\n product_with_unit_cost + product_without_unit_cost\n end",
"def capacity_costs\n fetch(:capacity_costs) do\n if fixed_costs_per_mw_input_capacity\n fixed_costs_per_mw_input_capacity * input_capacity\n else\n 0.0\n end\n end\n end",
"def total_cost\n order.delivery_cost_price +\n order_items.inject(BigDecimal(0)) { |t, i| t + i.total_cost }\n end",
"def draw_mp_cost\n values = []\n values.push(item.mp_cost) if item.mp_cost > 0\n values.push(sprintf('%d%%', item.mp_cost_per)) if item.mp_cost_per > 0\n return if values.empty?\n draw_detail(Vocab.attribute(:mp_cost), values.join('+'))\n end",
"def total_cost\n total_cost = (@price_night * @dates.nights)\n return Money.new(total_cost * 100, \"USD\").format\n end",
"def costable_energy_factor\n fetch(:costable_energy_factor) do\n costable, loss, total = costable_conversions\n\n if costable.nil?\n 1.0\n elsif (total - loss).positive?\n costable + loss * costable / (total - loss)\n else\n 0.0\n end\n end\n end"
] | [
"0.7053993",
"0.7001518",
"0.68387604",
"0.68177027",
"0.6712944",
"0.67117095",
"0.66972893",
"0.66611934",
"0.662616",
"0.66118824",
"0.6604087",
"0.6595827",
"0.6568853",
"0.6534658",
"0.65143603",
"0.6513975",
"0.65128374",
"0.648792",
"0.6480241",
"0.6462425",
"0.64418477",
"0.64380026",
"0.64380026",
"0.6432354",
"0.6407732",
"0.639887",
"0.639887",
"0.6391181",
"0.6357173",
"0.63436395",
"0.6332383",
"0.6332383",
"0.6326575",
"0.6324998",
"0.63048124",
"0.62937194",
"0.62871754",
"0.62636775",
"0.62339985",
"0.6216863",
"0.62157434",
"0.62056875",
"0.62056875",
"0.61874074",
"0.6182024",
"0.61718035",
"0.6163113",
"0.6130092",
"0.6121207",
"0.6110402",
"0.6092269",
"0.6071168",
"0.6068069",
"0.6068069",
"0.60512054",
"0.60512054",
"0.60385126",
"0.6033381",
"0.6027369",
"0.6017667",
"0.60174024",
"0.6014156",
"0.60010064",
"0.5998112",
"0.5990434",
"0.5990434",
"0.5964677",
"0.59489274",
"0.5945986",
"0.59431654",
"0.59307855",
"0.5930679",
"0.5930575",
"0.59169227",
"0.59165245",
"0.5914163",
"0.5903413",
"0.5898573",
"0.5888966",
"0.5880221",
"0.5872973",
"0.58586293",
"0.58481896",
"0.5840301",
"0.5838947",
"0.58371294",
"0.5819993",
"0.58109057",
"0.58029926",
"0.5802637",
"0.58011436",
"0.58011436",
"0.57980955",
"0.57956445",
"0.5778753",
"0.5774124",
"0.576679",
"0.5764289",
"0.57596046",
"0.5759138",
"0.5758317"
] | 0.0 | -1 |
Implement minimal checking for the parameters. The body must be between 1 and 1600 bytes and a recipient must be specified. | def verify_params(params)
return false if params['Body'].to_s.empty?
return false if params['Body'].to_s.bytes.size > 1600
return false unless /\+\d+$/.match(params['To'])
true
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def valid_contact_params?(params)\n r = false\n if !params[:sender_name].blank? and !params[:sender_address].blank? and !params[:message_title].blank? and !params[:message_content].blank? and ((params[:spamcode]).to_i==session[:spamcode])\n r = true\n end\n r\n end",
"def check_body\n return true if body.blank?\n\n limit = 1_500_000\n current_length = body.length\n return true if body.length <= limit\n\n raise Exceptions::UnprocessableEntity, \"body of article is too large, #{current_length} chars - only #{limit} allowed\" if !ApplicationHandleInfo.postmaster?\n\n logger.warn \"WARNING: cut string because of database length #{self.class}.body(#{limit} but is #{current_length})\"\n self.body = body[0, limit]\n end",
"def check_params\n params['message'].to_i > 30\n end",
"def validate_params\n if [email protected]? && [email protected]_numeric?\n add_error(code: 400, error: 'The parameter to, be must a number')\n elsif (@from.is_a? String) && [email protected]_numeric?\n add_error(code: 400, error: 'The parameter from, be must a number')\n end\n end",
"def check_params; true; end",
"def recipient_params\n params.require(:recipient).permit(:name, :phone_number, :got_yaa_id, :email, :message_sent, :has_responded)\n end",
"def validate\n raise \"Can only validate request messages\" unless type == :request\n\n raise(NotTargettedAtUs, \"Received message is not targetted to us\") unless PluginManager[\"security_plugin\"].validate_filter?(payload[:filter])\n end",
"def recipient_params\n params.require(:recipient).permit(:name, :shamei, :sec_name1, :sec_name2, :position, :post_code, :address1, :address2, :dolor, :honor, :note)\n end",
"def valid_params_request?; end",
"def validate_body_versus_content_length!\n unless header?(\"content-length\")\n puts \"Http2: No content length given - skipping length validation.\" if @debug\n return nil\n end\n\n content_length = header(\"content-length\").to_i\n body_length = @body.bytesize\n\n puts \"Http2: Body length: #{body_length}\" if @debug\n puts \"Http2: Content length: #{content_length}\" if @debug\n\n raise \"Body does not match the given content-length: '#{body_length}', '#{content_length}'.\" if body_length != content_length\n end",
"def error_check\n raise \"Subject is blank!\" if @message_config[:subject].strip.length == 0\n raise \"Subject is long!\" if @message_config[:subject].length > 120\n raise \"Body is blank!\" if @message_config[:body].strip.length == 0\n end",
"def valid?\n return false if [email protected]? && @message.to_s.length > 5000\n return false if [email protected]? && @type.to_s.length > 100\n true\n end",
"def validate_body_versus_content_length!\n unless self.header?(\"content-length\")\n puts \"Http2: No content length given - skipping length validation.\" if @debug\n return nil\n end\n\n content_length = header(\"content-length\").to_i\n body_length = @body.bytesize\n\n puts \"Http2: Body length: #{body_length}\" if @debug\n puts \"Http2: Content length: #{content_length}\" if @debug\n\n raise \"Body does not match the given content-length: '#{body_length}', '#{content_length}'.\" if body_length != content_length\n end",
"def recipient_params\n params.require(:recipient).permit(:sca_name, :mundane_name, :is_group, :also_known_as, :formerly_known_as, :title, :pronouns, :heraldry, :heraldry_blazon, :mundane_bio, :sca_bio, :activities, :food_prefs)\n end",
"def validate_transaction_creation_parameters(params, whitelist)\n\n # delets all non-whitelisted params, and returns a safe list.\n params = trim_whitelisted(params, whitelist)\n\n # Return proper errors if parameter is missing:\n raise MissingEmail if params[\"email\"].to_s.length == 0\n # raise MissingSSN if params[\"ssn\"].to_s.length == 0\n raise MissingPassportOrSSN if (params[\"ssn\"].to_s.length == 0 and\n params[\"passport\"].to_s.length == 0)\n raise MissingLicenseNumber if (params[\"license_number\"].to_s.length == 0 and\n params[\"passport\"].to_s.length == 0)\n raise MissingFirstName if params[\"first_name\"].to_s.length == 0\n raise MissingLastName if params[\"last_name\"].to_s.length == 0\n raise MissingResidency if params[\"residency\"].to_s.length == 0\n raise MissingBirthDate if params[\"birth_date\"].to_s.length == 0\n raise MissingClientIP if params[\"IP\"].to_s.length == 0\n raise MissingReason if params[\"reason\"].to_s.length == 0\n raise MissingLanguage if params[\"language\"].to_s.length == 0\n\n # Validate the Email\n raise InvalidEmail if !validate_email(params[\"email\"])\n\n # User must provide either passport or SSN. Let's check if\n # one or the other is invalid.\n\n # Validate the SSN\n # we eliminate any potential dashes in ssn\n params[\"ssn\"] = params[\"ssn\"].to_s.gsub(\"-\", \"\").strip\n # raise InvalidSSN if !validate_ssn(params[\"ssn\"])\n raise InvalidSSN if params[\"ssn\"].to_s.length > 0 and\n !validate_ssn(params[\"ssn\"])\n # Validate the Passport\n # we eliminate any potential dashes in the passport before validation\n params[\"passport\"] = params[\"passport\"].to_s.gsub(\"-\", \"\").strip\n raise InvalidPassport if params[\"passport\"].to_s.length > 0 and\n !validate_passport(params[\"passport\"])\n\n # Validate the DTOP id:\n raise InvalidLicenseNumber if !validate_dtop_id(params[\"license_number\"]) and\n params[\"passport\"].to_s.length == 0\n\n raise InvalidFirstName if !validate_name(params[\"first_name\"])\n raise InvalidMiddleName if !params[\"middle_name\"].nil? and\n !validate_name(params[\"middle_name\"])\n raise InvalidLastName if !validate_name(params[\"last_name\"])\n raise InvalidMotherLastName if !params[\"mother_last_name\"].nil? and\n !validate_name(params[\"mother_last_name\"])\n\n raise InvalidResidency if !validate_residency(params[\"residency\"])\n\n # This validates birthdate\n raise InvalidBirthDate if !validate_birthdate(params[\"birth_date\"])\n # This checks minimum age\n raise InvalidBirthDate if !validate_birthdate(params[\"birth_date\"], true)\n raise InvalidClientIP if !validate_ip(params[\"IP\"])\n raise InvalidReason if params[\"reason\"].to_s.strip.length > 255\n raise InvalidLanguage if !validate_language(params[\"language\"])\n\n return params\n end",
"def validate_transaction_creation_parameters(params, whitelist)\n\n # delets all non-whitelisted params, and returns a safe list.\n params = trim_whitelisted(params, whitelist)\n\n # Return proper errors if parameter is missing:\n raise MissingEmail if params[\"email\"].to_s.length == 0\n # raise MissingSSN if params[\"ssn\"].to_s.length == 0\n raise MissingPassportOrSSN if (params[\"ssn\"].to_s.length == 0 and\n params[\"passport\"].to_s.length == 0)\n raise MissingLicenseNumber if (params[\"license_number\"].to_s.length == 0 and\n params[\"passport\"].to_s.length == 0)\n raise MissingFirstName if params[\"first_name\"].to_s.length == 0\n raise MissingLastName if params[\"last_name\"].to_s.length == 0\n raise MissingResidency if params[\"residency\"].to_s.length == 0\n raise MissingBirthDate if params[\"birth_date\"].to_s.length == 0\n raise MissingClientIP if params[\"IP\"].to_s.length == 0\n raise MissingReason if params[\"reason\"].to_s.length == 0\n raise MissingLanguage if params[\"language\"].to_s.length == 0\n\n # Validate the Email\n raise InvalidEmail if !validate_email(params[\"email\"])\n\n # User must provide either passport or SSN. Let's check if\n # one or the other is invalid.\n\n # Validate the SSN\n # we eliminate any potential dashes in ssn\n params[\"ssn\"] = params[\"ssn\"].to_s.gsub(\"-\", \"\").strip\n # raise InvalidSSN if !validate_ssn(params[\"ssn\"])\n raise InvalidSSN if params[\"ssn\"].to_s.length > 0 and\n !validate_ssn(params[\"ssn\"])\n # Validate the Passport\n # we eliminate any potential dashes in the passport before validation\n params[\"passport\"] = params[\"passport\"].to_s.gsub(\"-\", \"\").strip\n raise InvalidPassport if params[\"passport\"].to_s.length > 0 and\n !validate_passport(params[\"passport\"])\n\n # Validate the DTOP id:\n raise InvalidLicenseNumber if !validate_dtop_id(params[\"license_number\"]) and\n params[\"passport\"].to_s.length == 0\n\n raise InvalidFirstName if !validate_name(params[\"first_name\"])\n raise InvalidMiddleName if !params[\"middle_name\"].nil? and\n !validate_name(params[\"middle_name\"])\n raise InvalidLastName if !validate_name(params[\"last_name\"])\n raise InvalidMotherLastName if !params[\"mother_last_name\"].nil? and\n !validate_name(params[\"mother_last_name\"])\n\n raise InvalidResidency if !validate_residency(params[\"residency\"])\n\n # This validates birthdate\n raise InvalidBirthDate if !validate_birthdate(params[\"birth_date\"])\n # This checks minimum age\n raise InvalidBirthDate if !validate_birthdate(params[\"birth_date\"], true)\n raise InvalidClientIP if !validate_ip(params[\"IP\"])\n raise InvalidReason if params[\"reason\"].to_s.strip.length > 255\n raise InvalidLanguage if !validate_language(params[\"language\"])\n\n return params\n end",
"def validate_sendtomultisig_inputs(data)\n response = {}\n response['status'] = false\n\n if data.length < 6\n response['err_msg'] = 'Insufficient number of parameters!'\n return response\n end\n\n begin\n data[1] = Integer(data[1])\n data[2] = btc_to_satoshi(Float(data[2]))\n data[3] = Integer(data[3])\n\n transaction = retrieve_transaction_from_utxo(data[0], data[1])\n\n if transaction.nil?\n response['err_msg'] =\n 'Either invalid, non-wallet or already spent Transaction ID,' \\\n 'or incorrect vout index'\n return response\n end\n\n if btc_to_satoshi(transaction['value']) < (data[2] + TRANSACTION_FEE)\n response['err_msg'] =\n 'Amount to transfer must be less than the transaction amount'\n return response\n end\n\n payee_addresses = data.slice(4..-1)\n\n if data[3] > payee_addresses.length\n response['err_msg'] =\n 'Minimum signatures required must be less than or equal to' \\\n 'the number of payee addresses provided'\n return response\n end\n\n payee_addresses.each { |address|\n next if valid_address? address\n response['err_msg'] =\n 'Either invalid or non-wallet payee address: ' + address\n return response\n }\n\n response['status'] = true\n return response\n rescue\n response['err_msg'] = 'Invalid parameter values!'\n return response\n end\nend",
"def validate_sms_params\n # raise\n if params[:to].blank?\n flash[:error] = I18n.t('blacklight.sms.errors.to.blank')\n elsif params[:carrier].blank?\n flash[:error] = I18n.t('blacklight.sms.errors.carrier.blank')\n elsif params[:to].gsub(/[^\\d]/, '').length != 10\n flash[:error] = I18n.t('blacklight.sms.errors.to.invalid', to: params[:to])\n elsif !sms_mappings.values.include?(params[:carrier])\n flash[:error] = I18n.t('blacklight.sms.errors.carrier.invalid')\n elsif current_user.blank? && !@user_characteristics[:on_campus] && !verify_recaptcha\n flash[:error] = 'reCAPTCHA verify error'\n end\n\n flash[:error].blank?\n end",
"def validate_sms_params\n # raise\n if params[:to].blank?\n flash[:error] = I18n.t('blacklight.sms.errors.to.blank')\n elsif params[:carrier].blank?\n flash[:error] = I18n.t('blacklight.sms.errors.carrier.blank')\n elsif params[:to].gsub(/[^\\d]/, '').length != 10\n flash[:error] = I18n.t('blacklight.sms.errors.to.invalid', to: params[:to])\n elsif !sms_mappings.values.include?(params[:carrier])\n flash[:error] = I18n.t('blacklight.sms.errors.carrier.invalid')\n elsif current_user.blank? && !@user_characteristics[:on_campus] && !verify_recaptcha\n flash[:error] = 'reCAPTCHA verify error'\n end\n\n flash[:error].blank?\n end",
"def valid?\n return false if @id.nil?\n return false if @id !~ Regexp.new(/^chk_[a-zA-Z0-9]+$/)\n return false if @to.nil?\n return false if [email protected]? && @description.to_s.length > 255\n mail_type_validator = EnumAttributeValidator.new('String', [\"usps_first_class\"])\n return false unless mail_type_validator.valid?(@mail_type)\n return false if [email protected]? && @memo.to_s.length > 40\n return false if !@check_number.nil? && @check_number > 500000000\n return false if !@check_number.nil? && @check_number < 1\n return false if [email protected]? && @message.to_s.length > 400\n return false if @amount.nil?\n return false if @amount > 999999.99\n return false if @bank_account.nil?\n return false if !@check_bottom_template_id.nil? && @check_bottom_template_id !~ Regexp.new(/^tmpl_[a-zA-Z0-9]+$/)\n return false if !@attachment_template_id.nil? && @attachment_template_id !~ Regexp.new(/^tmpl_[a-zA-Z0-9]+$/)\n return false if !@check_bottom_template_version_id.nil? && @check_bottom_template_version_id !~ Regexp.new(/^vrsn_[a-zA-Z0-9]+$/)\n return false if !@attachment_template_version_id.nil? && @attachment_template_version_id !~ Regexp.new(/^vrsn_[a-zA-Z0-9]+$/)\n return false if @url.nil?\n return false if @url !~ Regexp.new(/^https:\\/\\/(lob-assets|lob-assets-staging)\\.com\\/(letters|postcards|bank-accounts|checks|self-mailers|cards)\\/[a-z]{3,4}_[a-z0-9]{15,16}(\\.pdf|_thumb_[a-z]+_[0-9]+\\.png)\\?(version=[a-z0-9-]*&)?expires=[0-9]{10}&signature=[a-zA-Z0-9_-]+$/)\n return false if @carrier.nil?\n carrier_validator = EnumAttributeValidator.new('String', [\"USPS\"])\n return false unless carrier_validator.valid?(@carrier)\n return false if @object.nil?\n object_validator = EnumAttributeValidator.new('String', [\"check\"])\n return false unless object_validator.valid?(@object)\n return false if @date_created.nil?\n return false if @date_modified.nil?\n true\n end",
"def verify_parameters\n # TODO: rails 3 and activemodel validation\n parts = (params[:mask].to_s.split('@', 2) + [params[:nick], params[:url]])\n if parts.length != 4 || params.any?(&:blank?)\n render :text => \"Invalid submission\", :status => 400\n return false\n end\n end",
"def recipient_params\n params.require(:recipient).permit(:name, :email, :phone)\n end",
"def mail_params\n params.permit(:recipients, :body)\n end",
"def certifying_body_params\n params.require(:certifying_body).permit(:name, :mission, :url)\n end",
"def require_valid_params\n params\n .require(:share)\n .require(%i[document_id document_type recipient_id])\n end",
"def validate_params_present!\n raise ArgumentError, \"Please provide one or more of: #{ACCEPTED_PARAMS}\" if params.blank?\n end",
"def valid_params?; end",
"def body_allowed?\n @status.allows_body? && @request_method.allows_body?\n end",
"def valid_body?\n request.feedback.body && valid_json?(request.feedback.body)\n end",
"def request_body! body\n enum_of_body(body).each do |body_part|\n body_part = body_part.to_s\n rv = Wrapper.msc_append_request_body txn_ptr, (strptr body_part), body_part.bytesize\n rv == 1 or raise Error, \"msc_append_request_body failed for #{truncate_inspect body_part}\"\n end\n\n # This MUST be called, otherwise rules aren't triggered.\n rv = Wrapper.msc_process_request_body txn_ptr\n rv == 1 or raise Error, \"msc_process_request_body failed\"\n\n intervention!\n end",
"def sms_based_params\n params.require(:sms_based).permit(:body)\n end",
"def permited_params\n @params.permit(:to, :to_name, :from, :from_name, :subject, :body)\n end",
"def check_params\n true\n end",
"def initialize(params)\n @success = verify_params(params)\n @to = params['To']\n @body = params['Body']\n @sent = Time.now\n end",
"def _checkParams(node_number, port, slaveof)\n valid = node_number.is_a?(Fixnum) && port.is_a?(Fixnum) && ( slaveof.nil? || slaveof.is_a?(String))\n unless valid\n raise TypeError, \"Invalid Params\"\n end\n end",
"def validate_email_parameters(params, whitelist)\n # delets all non-whitelisted params, and returns a safe list.\n params = trim_whitelisted(params, whitelist)\n # Check for missing parameters\n raise MissingEmailFromAddress if params[\"from\"].to_s.length == 0\n raise MissingEmailToAddress if params[\"to\"].to_s.length == 0\n raise MissingEmailSubject if params[\"subject\"].to_s.length == 0\n raise MissingEmailText if params[\"text\"].to_s.length == 0\n # Perform validations\n # raise InvalidEmailSubject if <consider validations here>\n raise InvalidEmailFromAddress if !validate_email(params[\"from\"])\n raise InvalidEmailToAddress if !validate_email(params[\"to\"])\n\n return params\n end",
"def validrequest?(req)\n ssl = SSL.new(\"/home/rip/.mcollective.d/rip.pem\")\n\n ssl.verify_signature(req[:hash], SSL.md5(req[:body]), true)\n\n req[:callerid] = \"webuser=%s\" % ssl.rsa_decrypt_with_public(ssl.base64_decode(req[:callerid]))\n req[:body] = deserialize(req[:body])\n\n @stats.validated\n\n true\n rescue\n @stats.unvalidated\n raise(SecurityValidationFailed, \"Received an invalid signature in message\")\n end",
"def validate\n if self.body.empty? || self.body =~ /^\\s+$/\n errors.add(:body, \"^Please enter your annotation\")\n end\n if !MySociety::Validate.uses_mixed_capitals(self.body)\n errors.add(:body, '^Please write your annotation using a mixture of capital and lower case letters. This makes it easier for others to read.')\n end\n end",
"def recipient_params\n params.permit(:name)\n end",
"def message_params\n\n params.require(:message).permit(:user_id, :body, :sender_id, :sender, :recipient)\n\n end",
"def celestial_body_params\n params.require(:celestial_body).permit(:body_type, :volume, :mass)\n end",
"def validateParams \r\n\t \r\n\t \tif [email protected]? && [email protected]? && [email protected]?\r\n\t\t\treturn true\r\n\t \telse\r\n\t\t\treturn false \t\r\n\t \tend\r\n\t \t\r\n\t end",
"def validrequest?(req)\n digest = makehash(req[:body])\n \n if digest == req[:hash]\n @stats[:validated] += 1\n \n return true\n else\n @stats[:unvalidated] += 1\n \n raise(\"Received an invalid signature in message\")\n end\n end",
"def validate!\n REQUIRED_PARAMETERS.each do |name|\n if params[name].empty?\n raise(BuildRequestError, \"Vocalware: Parameter #{name} is required\")\n end\n end\n end",
"def body_parameters(params = {})\n nil if params.empty?\n end",
"def post_message_params\n params.require(:message).permit(:body, :recipient_user_id)\n end",
"def valid_params?(name, size)\n return raise TypeError.new(\"A 'name' should be a string\") if name.class != String\n return raise TypeError.new(\"A 'size' should be an integer\") if size.class != Integer\n\n true\n end",
"def create_valid_message hash\n attributes = { \n subject: 'A valid subject',\n body: 'A valid body should have at least 40 characters ' +\n \"*\"*40\n }\n Message.new( attributes.merge(hash) )\n end",
"def body_hash_required?\n false\n end",
"def test_required\n required = true\n if @subject.nil? || @subject.empty?\n WhoToWho.log.warn 'you need define a subject'\n required = false\n end\n\n if @content.nil? || @content.empty?\n WhoToWho.log.warn 'you need define a file or a file not empty for you mail template'\n required = false\n end\n\n if @list_link.nil? || @list_link.empty? || @list_link.size < 2\n WhoToWho.log.warn 'The list of data need define by a file. This file can\\'t be empty or only one data'\n required = false\n end\n\n if ActionMailer::Base.smtp_settings.empty?\n WhoToWho.log.warn 'The configuration of your SMTP account can\\'t be empty'\n required = false\n end\n\n if @from.nil? || @from.empty?\n WhoToWho.log.warn 'You need define a from in your mail settings.'\n required = false\n end\n\n unless required\n puts @full_print\n exit\n end\n end",
"def send_email( params )\n puts \"From: #{params[:from]}\"\n puts \"To: #{params[:to]}\"\n puts \"Email subject: #{params[:subject]}\"\n puts \"Email body: #{params[:body]}\" \n return true\n end",
"def validate_request req\n id, method, params = req.id, req.method.sub(/^block\\./,''), req.params\n\n case method\n when \"notify\"\n coin_code, password, hash = *params\n raise Rpc::InvalidParams.new( extra_msg: \"coin_code is invalid : #{coin_code}\" ) if ! coin_code =~ /^\\w{3,5}$/\n else\n raise JSON_RPC::MethodNotFound.new( method: \"block.#{method}\" )\n end\n\n emit( method, req )\n\n true\n end",
"def validate!\n puts \"Http2: Validating response length.\" if @debug\n validate_body_versus_content_length!\n end",
"def validate!\n puts \"Http2: Validating response length.\" if @debug\n validate_body_versus_content_length!\n end",
"def validate_parameters(sent_parameters)\n valid_parameters = nil\n if sent_parameters.is_a?(JamendoParameters)\n valid_parameters = sent_parameters.to_hash\n elsif sent_parameters.is_a?(Hash)\n valid_parameters = format_parameters(sent_parameters)\n elsif sent_parameters.is_a?(String)\n valid_parameters = Hash.new\n valid_parameters = { artist: sent_parameters }\n else\n raise JamendoError(\"Imposible to handle parameter you provided.\")\n end\n return valid_parameters\n #sent_parameters.select! { | param, value | valid_parameters.include?(param) }\n end",
"def validate_parameters\n if (latitude.to_f == 0.0) || (longitude.to_f == 0.0)\n render :status=>401,\n :json=>{:Message=>\"The latitude and longitude parameters should be float values.\",\n :Response => \"Fail\",\n :Data => nil} \n end\n if (location_lock != \"true\") || (location_lock != \"false\")\n render :status=>401,\n :json=>{:Message=>\"The location_lock should be either true or false.\",\n :Response => \"Fail\",\n :Data => nil} \n end\n if proximity.to_i == 0\n render :status=>401,\n :json=>{:Message=>\"The proximity should be an integer.\",\n :Response => \"Fail\",\n :Data => nil} \n end\n if page.to_i == 0\n render :status=>401,\n :json=>{:Message=>\"The page should be an integer.\",\n :Response => \"Fail\",\n :Data => nil} \n end\n end",
"def valid_input?\n size = 1\n permited_params.keys.each do |key|\n @errors << \"#{permited_params[key]} is blank\" if permited_params[key].empty?\n size += 1\n end\n @errors << 'to, to_name, from, from_name, subject, body params are required' if size == 6\n @errors << 'to is not a valid email' unless valid_email?(permited_params['to'])\n @errors << 'from is not a valid email' unless valid_email?(permited_params['from'])\n\n return @errors.blank?\n end",
"def message_params\n params.require(:message).permit(:title, :body, :signature, :send_to_all, :status, {function_ids: [], position_ids: [], employee_ids: [], organic_unit_ids:[]})\n end",
"def valid_post_body?(post_body, signature)\n hash = OpenSSL::HMAC.digest(OpenSSL::Digest.new('SHA256'), @channel.line_channel_secret, post_body)\n Base64.strict_encode64(hash) == signature\n end",
"def validate_params\n render_endpoint_request do\n erb = EndpointRequestBuilder.new(@endpoint)\n erb.validate(@arguments)\n render json: { success: 'Params look great!' }, status: 200\n end\n end",
"def valid_params_request?\n true\n end",
"def valid_params_request?\n true\n end",
"def validate_parameters\n r = validate_payment_nonce_uuid\n return r unless r.success?\n\n error_identifiers = []\n\n error_identifiers << 'invalid_first_name' if @first_name.present? &&\n (!Util::CommonValidateAndSanitize.is_string?(@first_name) || @first_name.length > 255)\n\n error_identifiers << 'invalid_last_name' if @last_name.present? &&\n (!Util::CommonValidateAndSanitize.is_string?(@last_name) || @last_name.length > 255)\n\n error_identifiers << 'invalid_company' if @company.present? &&\n (!Util::CommonValidateAndSanitize.is_string?(@company) || @company.length > 255)\n\n error_identifiers << 'invalid_email' if @email.present? &&\n (!Util::CommonValidateAndSanitize.is_valid_email?(@email))\n\n\n error_identifiers << 'invalid_phone' if @phone.present? &&\n (!Util::CommonValidateAndSanitize.is_string?(@phone) || @phone.length > 255)\n\n error_identifiers << 'invalid_fax' if @fax.present? &&\n (!Util::CommonValidateAndSanitize.is_string?(@fax) || @fax.length > 255)\n\n error_identifiers << 'invalid_website' if @website.present? &&\n (!Util::CommonValidateAndSanitize.is_valid_domain?(@website) || @website.length > 255)\n\n\n return error_with_identifier('invalid_api_params',\n 'ra_c_c_vp_1',\n error_identifiers\n ) if error_identifiers.present?\n\n @customer_details[:first_name] = @first_name if @first_name.present?\n @customer_details[:last_name] = @last_name if @last_name.present?\n @customer_details[:company] = @company if @company.present?\n @customer_details[:email] = @email if @email.present?\n @customer_details[:phone] = @phone if @phone.present?\n @customer_details[:fax] = @fax if @fax.present?\n @customer_details[:website] = @website if @website.present?\n\n success\n end",
"def message_params\n params.require(:message).permit(:body, :to)\n end",
"def recipient_required?\n transfer_type?\n end",
"def valid? headers, params\n timestamp = get_timestamp headers\n\n message = create_message params[\"token\"], params[\"trx_id\"], params[\"monto\"], timestamp\n authorization = Authorization.new(@env)\n signature = authorization.sign(message)\n signature == pp_signature(headers)\n\n end",
"def filtered_params\n params.permit(:to_email, :from_email, :body, :subject, :provider)\n end",
"def email_params\n begin\n params.require(:email).permit(:sender, :recipient, :subject, :body_html, :cc, :bcc)\n rescue\n params.permit(:sender, :recipient, :subject, 'body-plain', 'stripped-html', 'body-html')\n end\n end",
"def message_params\n\t\t\tparams.require(:message).permit(:name, :target_name, :target_email, :body, :ip, :status)\n\t\tend",
"def validate_recipient recipient\n raise ArgumentError.new(\"Recipient must be an Unloq::Author or Unloq::Recipient\") unless recipient.is_a?(Unloq::Entity)\n end",
"def valid_integrity?(body, headers)\n request_signature = headers['X-Hub-Signature']\n signature_parts = request_signature.split('sha1=')\n request_signature = signature_parts[1]\n calculated_signature = OpenSSL::HMAC.hexdigest('sha1', @secret, body)\n calculated_signature == request_signature\n end",
"def validate_params(params)\n # This will be implemented by Validators which take parameters\n end",
"def validate(args)\n if args.keys.sort == PARAMS.sort\n unless Float(args[:x]) && Float(args[:y]) && Float(args[:id])\n raise \"Wrong Customer params type: #{args}\"\n end\n else\n raise \"Illformed Customer params: #{args}\"\n end\n end",
"def recipient; end",
"def message_params\n params.require(:message).permit(:sender_id, :receiver_id, :body)\n end",
"def plausible? rest, size, hints = {}\n true\n end",
"def validate_params\n validate_size\n validate_mine_density\n validate_first_click\n type_specific_checks\n end",
"def check_eligibility(options = {})\n @client.call(:real_time_transaction, message: {\n 'PayloadType': 'X12_270_Request_005010X279A1',\n 'ProcessingMode': 'RealTime',\n 'PayloadID': SecureRandom.uuid,\n 'TimeStamp': Time.now.utc.xmlschema,\n 'SenderID': Trizetto::Api.configuration.username,\n 'ReceiverID': 'GATEWAY EDI',\n 'CORERuleVersion': '2.2.0',\n 'Payload': options[:payload]\n });\n end",
"def body_params\n params.require(:body).permit(:name, :default_votes)\n end",
"def msg_params\n params.require(:msg).permit(:room, :sender, :body)\n end",
"def validate_param\n render_endpoint_request do\n erb = EndpointRequestBuilder.new(@endpoint)\n erb.validate_param(@arguments.keys.first.to_s, @arguments.values.first)\n render json: { success: 'Param looks like the right data type! good job!' }, status: 200\n end\n end",
"def valid_guce_params?\n if @order_id == nil || @amount == nil || not_a_number?(@amount)\n return false\n else\n return true\n end\n end",
"def validrequest?(req)\n Log.info \"Caller id: #{req[:callerid]}\"\n Log.info \"Sender id: #{req[:senderid]}\"\n message = req[:body]\n\n #@log.info req.awesome_inspect\n identity = (req[:callerid] or req[:senderid])\n verifier = SSH::Key::Verifier.new(identity)\n\n Log.info \"Using name '#{identity}'\"\n\n # If no callerid, this is a 'response' message and we should\n # attempt to authenticate using the senderid (hostname, usually)\n # and that ssh key in known_hosts.\n if !req[:callerid]\n # Search known_hosts for the senderid hostname\n verifier.add_key_from_host(identity)\n verifier.use_agent = false\n verifier.use_authorized_keys = false\n end\n\n signatures = Marshal.load(req[:hash])\n if verifier.verify?(signatures, req[:body])\n @stats.validated\n return true\n else\n @stats.unvalidated\n raise(SecurityValidationFailed, \"Received an invalid signature in message\")\n end\n end",
"def message_params\n params.require(:message).permit(:title, :body, :signature)\n end",
"def validate_order params\n return false unless params[:email].present? && params[:email] =~ /[^@]+@[^@]+/\n # cheapo regex for email, not really trying to filter, just catch typos: missing or too many @s.\n return false if params[:tel].present? && params[:tel].gsub(/\\D/,'').length < 7\n # a lot of spam bots post phone numbers as random series of letters. this is a cheap way of\n # catching that without having to print a captcha or ask a question.\n return true\n end",
"def message_params\n params.require(:message).permit(:user_id, :ride_request_id, :body)\n end",
"def validate_paramters\n raise Scorekeeper::MissingParameterException if @income.nil? || @zipcode.nil? || @age.nil?\n end",
"def user_input\n input = params[:Body] || params[:Digits]\n if input.present?\n return input\n else\n return false\n end\n end",
"def recipient_params\n params.require(:recipient).permit(:name, :ref_recipient_id)\n end",
"def validate_body\n if @body && /\\b(?:html|xml)\\b/ =~ @type\n @body.scrub!\n end\n end",
"def contact_params\n params.fetch(:contact, {}).permit(:reason, :surname, :message, :email, :telephone, :name, :locale, :agreement_ids,\n :strategy, :squeeze_id, :title, :company, :address, :position, :country, :employee_count, :branch, :agreement_ids => [])\n end",
"def check_arguments arguments\n arguments.each_with_index do |argument, index|\n next if argument.is_a? Numeric\n next if argument.is_a? String\n next if argument.is_a? Symbol\n next if argument.is_a? Hash\n next if argument.is_a? NilClass\n next if argument.is_a? TrueClass\n next if argument.is_a? FalseClass\n\n raise ArgumentError, \"Cannot send complex data for block argument #{index + 1}: #{argument.class.name}\"\n end\n\n arguments\n end",
"def body?\n !body.empty?\n end",
"def read_and_validate_params\n if @name_args.length < 1\n show_usage\n exit 1\n end\n\n if config[:hostname].nil? ||\n config[:username].nil? ||\n config[:flavor].nil? ||\n config[:password].nil? ||\n config[:main_network_adapter].nil?\n show_usage\n exit 1\n end\n\n if config[:guest_dhcp].eql? false\n if config[:guest_ip].nil? ||\n config[:guest_gateway].nil? ||\n config[:guest_netmask].nil? ||\n config[:guest_nameserver].nil?\n ui.fatal \"When using a static IP, you must specify the IP, Gateway, Netmask, and Nameserver\"\n exit 1\n end\n end\n\n end",
"def validate(params)\n Request.new(params).validate(params)\n end",
"def valid?\n return false if @identifier.nil?\n return false if @identifier.to_s.length > 25\n return false if @name.nil?\n return false if @name.to_s.length > 50\n return false if @status.nil?\n return false if @type.nil?\n return false if @address_line1.nil?\n return false if @address_line1.to_s.length > 50\n return false if !@address_line2.nil? && @address_line2.to_s.length > 50\n return false if [email protected]? && @city.to_s.length > 50\n return false if [email protected]? && @state.to_s.length > 50\n return false if [email protected]? && @zip.to_s.length > 12\n return false if !@phone_number.nil? && @phone_number.to_s.length > 30\n return false if !@fax_number.nil? && @fax_number.to_s.length > 30\n return false if [email protected]? && @website.to_s.length > 255\n return false if !@account_number.nil? && @account_number.to_s.length > 100\n return false if !@lead_source.nil? && @lead_source.to_s.length > 50\n return false if !@user_defined_field1.nil? && @user_defined_field1.to_s.length > 50\n return false if !@user_defined_field2.nil? && @user_defined_field2.to_s.length > 50\n return false if !@user_defined_field3.nil? && @user_defined_field3.to_s.length > 50\n return false if !@user_defined_field4.nil? && @user_defined_field4.to_s.length > 50\n return false if !@user_defined_field5.nil? && @user_defined_field5.to_s.length > 50\n return false if !@user_defined_field6.nil? && @user_defined_field6.to_s.length > 50\n return false if !@user_defined_field7.nil? && @user_defined_field7.to_s.length > 50\n return false if !@user_defined_field8.nil? && @user_defined_field8.to_s.length > 50\n return false if !@user_defined_field9.nil? && @user_defined_field9.to_s.length > 50\n return false if !@user_defined_field10.nil? && @user_defined_field10.to_s.length > 50\n return true\n end",
"def validate_params!\n self.params ||= Hash.new\n self.class.instance_variable_get(:@__required_params).each do |e|\n raise ArgumentError, \"Insufficient parameters set (#{e} not supplied)\" if self.params[e].nil?\n end\n end",
"def validate_params?\n true # TODO: add validation\n end",
"def check_message(params)\n unless params[:message].blank?\n continue(params)\n else\n fail(:no_message_given)\n end\n end",
"def request_parameters\n {:email => @email, :receiverid => @receiverid, :amt => @amt,\n :uniqueid => @unique, :note => @note}.reject{|k,v| v.nil? }\n end"
] | [
"0.6257262",
"0.62062675",
"0.604068",
"0.59841824",
"0.59495634",
"0.59108865",
"0.5833521",
"0.5759481",
"0.5754569",
"0.56618327",
"0.5660789",
"0.56534964",
"0.56401455",
"0.56372935",
"0.56369144",
"0.56369144",
"0.56258637",
"0.5601738",
"0.5601738",
"0.5595988",
"0.55927014",
"0.55671865",
"0.5551644",
"0.5516372",
"0.55060214",
"0.5500143",
"0.54960835",
"0.54887456",
"0.5481108",
"0.5472158",
"0.54614556",
"0.54558283",
"0.544738",
"0.54274744",
"0.54248476",
"0.5424305",
"0.54231995",
"0.54012203",
"0.5400079",
"0.53984153",
"0.5394794",
"0.5388798",
"0.53752923",
"0.5374807",
"0.53445405",
"0.5342355",
"0.53389823",
"0.53389734",
"0.53377706",
"0.5326509",
"0.5324305",
"0.53238827",
"0.53167087",
"0.53167087",
"0.5301573",
"0.52900094",
"0.5288914",
"0.5277544",
"0.52732986",
"0.52654505",
"0.5258855",
"0.5258855",
"0.5254722",
"0.5242485",
"0.52287143",
"0.52212524",
"0.5215168",
"0.5213541",
"0.5212783",
"0.5184318",
"0.5181258",
"0.51792955",
"0.5177127",
"0.51768726",
"0.517282",
"0.5170976",
"0.5169907",
"0.5163398",
"0.5161921",
"0.51618123",
"0.5159152",
"0.51571655",
"0.5155178",
"0.51543516",
"0.51466775",
"0.5144603",
"0.5143871",
"0.51302224",
"0.51286554",
"0.5125234",
"0.5119063",
"0.51184684",
"0.51171607",
"0.5115967",
"0.51114684",
"0.5107122",
"0.51065826",
"0.51052797",
"0.5098379",
"0.50971895"
] | 0.74228776 | 0 |
Return self information as XML format. | def to_xml
xml = "<video>\n"
instance_variables.each do |attr|
value = instance_variable_get(attr).to_s
value.gsub!(/<br \/>/, "\n")
value.gsub!(/<.*?>/m, '')
value.gsub!(/&/m, '&')
value.gsub!(/'/m, ''')
value.gsub!(/"/m, '"')
value.gsub!(/</m, '<')
value.gsub!(/>/m, '>')
attr.sub!(/@/, '')
xml += "<#{attr}>#{value}</#{attr}>\n"
end
xml += "</video>\n"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_xml\n Builder.new(self).to_s\n end",
"def to_xml\n return self.to_s\n end",
"def to_s\n return self.xml\n end",
"def to_xml\n self.to_s\n end",
"def to_xml\n self.to_s\n end",
"def to_xml\n\t\tend",
"def to_xml\n\t\tend",
"def toxml\n\t\tend",
"def to_xml\n return to_s\n end",
"def to_xml\n return to_s\n end",
"def to_s\n @xml\n end",
"def to_xml(*)\n self\n end",
"def to_xml()\n XmlSimple.xml_out( { :address => self.to_hash() }, { :KeepRoot=>true, :NoAttr=>true } )\n end",
"def to_xml\n\t\t\t\"<#{@name} #{attributes_string} />\"\n\t\tend",
"def to_xml\n builder = Builder::XmlMarkup.new(:indent=>2)\n builder.instruct! :xml, version: '1.0', encoding: 'UTF-8'\n xml = builder.items{ self.each{|x| builder.item(x) } }\n xml\n end",
"def to_xml\n @xml ||= get_xml\n end",
"def to_xml(*args)\n super\n end",
"def to_xml\n Builder.new(owner, grants).to_s\n end",
"def to_xml\n to_xml_builder.to_xml\n end",
"def to_xml\n to_xml_builder.to_xml\n end",
"def to_xml\n IO::XMLExporter.new.to_xml(self)\n end",
"def to_xml\n render_xml\n end",
"def to_xml\n output=\"\"\n self.to_rexml.write output\n end",
"def to_xml()\n XmlSimple.xml_out( { :person => self.to_hash() }, { :KeepRoot=>true, :NoAttr=>true } )\n end",
"def to_xml!\n self.to_hash.to_xml({:root => 'whoisapi'})\n end",
"def to_xml\n Builder.new(permission, grantee).to_s\n end",
"def to_xml\n RAGE::XMLCodec.new.encode(self)\n end",
"def to_xml\n return @doc.to_s\n end",
"def to_xml(options = {})\r\n options.update :root => @root ||\r\n self.class.name.split('::').last.underscore\r\n attributes.to_xml options\r\n end",
"def to_xml()\n XmlSimple.xml_out( { :email => self.to_hash() },\n { :KeepRoot=>true, :NoAttr=>true } )\n end",
"def to_xml(xml)\n xml.Override(self.instance_values)\n end",
"def to_xml\n response\n end",
"def to_xml(xml)\n xml.Default(self.instance_values)\n end",
"def to_xml\n @xml.to_xml\n end",
"def to_s\n return self.xml_header + self.xml_docs.join + self.xml_footer\n end",
"def to_xml\n builder.target!\n end",
"def xml; end",
"def to_xml\n\t\tmsg_xml = ''\n\t\[email protected] do |info|\n\t\t\tmsg_xml += \"<#{info.key}>#{xml(info.value)}</#{info.key}>\\n\"\n\t\tend\n\t\tmsg_xml\n\tend",
"def to_xml options = {}\n properties.to_xml options\n end",
"def to_xml\n @node.flatten.map(&:to_s).join\n end",
"def to_xml(obj)\n obj.to_xml\n end",
"def to_xml(options={})\n attributes.to_xml({:root => self.class.element_name}.merge(options))\n end",
"def to_xml(options={})\n attributes.to_xml({:root => self.class.element_name}.merge(options))\n end",
"def to_xml\n if @xml_header.nil?\n xml = ''\n else\n xml = @xml_header.to_xml + \"\\n\"\n end\n self.document.__types.each do |t|\n xml += self.document.send(t).to_xml\n end\n return xml\n end",
"def to_str\n str = \"\"\n REXML::Formatters::Pretty.new(1).write(@xml,str)\n \n return str \n end",
"def to_s\r\n @xml = REXML::Document.new(SKELTON) if self.status == :new\r\n instance_to_xml\r\n @xml.to_s\r\n end",
"def to_xml options={}\n\n super(options) do |xml|\n\n xml.reqNumber self.reqNumber\n\n if ! self.category.nil?\n xml.category self.category.catName\n else\n xml.category \"Not defined\"\n end\n\n\n xml.industries do\n industries.each do |industry|\n xml.industry industry.indName\n end\n end\n\n end\n\n end",
"def to_xml(*args); end",
"def to_xml(*args); end",
"def to_xml(*args); end",
"def to_xml(*args); end",
"def to_xml(*args); end",
"def to_xml(*args); end",
"def xml\n @xml ||= begin\n builder = ::Builder::XmlMarkup.new(:indent => 4)\n\n authed_xml_as_string(builder) do\n builder.GetReceiptInfoCall do\n builder.ReceiptFilter do\n builder.ReceiptId(id)\n end\n end\n end\n end\n end",
"def to_xml\n @builder.to_xml\n end",
"def to_s\n return self.get_info()\n end",
"def to_str\n str = \"\"\n REXML::Formatters::Pretty.new(1).write(@xml,str)\n\n return str \n end",
"def to_xml\n find_correct_build.to_xml\n end",
"def xml\n @_node.asXml\n end",
"def to_xml\n self.xml ||= fetch({\"service\"=>self.service_type,\"metric\"=>self.metric,\"start\"=>self.sdate.to_s,\"end\"=>self.edate.to_s,\"artistID\"=>self.artist_id,\"apiKey\"=>$nbs_api_key,\"format\"=>\"xml\"})\n end",
"def to_s\n \"<#{@name}\" + @attrs.sort.map{|k,v| \" #{k}='#{v.xml_attr_escape}'\"}.join +\n if @contents.size == 0\n \"/>\"\n else\n \">\" + @contents.map{|x| if x.is_a? String then x.xml_escape else x.to_s end}.join + \"</#{name}>\"\n end\n end",
"def to_xml(b = Builder::XmlMarkup.new(:indent => 2))\n optional_root_tag(parent.class.optional_xml_root_name, b) do |c|\n c.tag!(model.class.xml_node_name || model.model_name) {\n attributes.each do | key, value |\n field = self.class.fields[key]\n value = self.send(key) if field[:calculated]\n xml_value_from_field(b, field, value) unless value.nil?\n end\n }\n end\n end",
"def to_xml\n xml = String.new\n builder = Builder::XmlMarkup.new(:target => xml, :indent => 2)\n \n # Xml instructions (version and charset)\n builder.instruct!\n \n builder.source(:primary => primary_source) do\n builder.id(id, :type => \"integer\")\n builder.uri(uri.to_s)\n end\n \n xml\n end",
"def to_xml\n Ox.to_xml document\n end",
"def to_xml\n http.body\n end",
"def to_xml\n @object.marshal_dump.to_xml(:root => :response)\n end",
"def to_xml(options = nil)\n all_attributes.to_xml(options || {})\n end",
"def to_xml\n if has_errors?\n controller.render xml: resource.errors\n else\n controller.render xml: resource\n end\n end",
"def to_xml\n xml = children.map(&:to_xml).join('')\n\n if doctype\n xml = doctype.to_xml + \"\\n\" + xml.strip\n end\n\n if xml_declaration\n xml = xml_declaration.to_xml + \"\\n\" + xml.strip\n end\n\n return xml\n end",
"def to_xml\n \n text = \"<node id=\\\"#{self.id}\\\" label=\\\"#{self.label}\\\">\\n\"\n \n unless self.attributes.nil?\n text << \"\\t<attvalues>\\n\"\n self.attributes.each do |key, value|\n text << \"\\t\\t<attvalue for=\\\"#{key}\\\" value=\\\"#{value}\\\"></attvalue>\\n\"\n end\n text << \"\\t</attvalues>\\n\"\n end\n \n unless self.viz_size.nil?\n text << \"\\t<viz:size value=\\\"#{self.viz_size}\\\"/>\\n\"\n end\n \n unless self.viz_color.nil?\n text << \"\\t<viz:color b=\\\"#{self.viz_color[:b]}\\\" g=\\\"#{self.viz_color[:g]}\\\" r=\\\"#{self.viz_color[:r]}\\\"/>\\n\"\n end\n \n unless self.viz_position.nil?\n text << \"\\t<viz:position x=\\\"#{self.viz_position[:x]}\\\" y=\\\"#{self.viz_position[:z]}\\\"/>\\n\"\n end\n \n text << \"</node>\\n\"\n text \n end",
"def to_s\n attributes = @attributes.map do |key, value|\n \"#{key}: \\\"#{value}\\\"\"\n end.join \" \"\n\n \"#<#{self.class} #{attributes}>\"\n end",
"def to_xml\r\n x = Builder::XmlMarkup.new(:target => (reply = ''))\r\n x.instruct!\r\n x.comment! \"#{@collection.size} entries\" \r\n x.strings(:each => @each) {\r\n @collection.each do |each|\r\n x.s(each)\r\n end\r\n }\r\n reply\r\n end",
"def inspect\n attributes_for_inspect = self.attributes.collect do |attr|\n \"#{attr}: \" + self.instance_variable_get(\"@#{attr}\").to_s\n end.join(\", \")\n return \"#<#{self.class} #{attributes_for_inspect}>\"\n end",
"def to_xml\n\t\t\ttext = \"\"\n\t\t\[email protected](text, 1)\n\t\t\treturn text\n\t\tend",
"def to_xml(options = {})\n to_xml_opts = {:skip_types => true} # no type information, not such a great idea!\n to_xml_opts.merge!(options.slice(:builder, :skip_instruct))\n # a builder instance is provided when to_xml is called on a collection,\n # in which case you would not want to have <?xml ...?> added to each item\n to_xml_opts[:root] ||= \"retailer\"\n self.attributes.to_xml(to_xml_opts)\n end",
"def to_s\n %(<#{ @name }#{attributes}>)\n end",
"def to_xml(options = {})\n options[:save_with] ||= SaveOptions::DEFAULT_XML\n serialize(options)\n end",
"def xml?; end",
"def xml?; end",
"def inspect\n \"<#{self.class.to_s} \" +\n self.elements.collect { |e| e.name.inspect }.join(' ') +\n \">\"\n end",
"def to_xml(xml=Builder::XmlMarkup.new)\n xml.tag!('samlp:Status') {\n xml << status_code.to_xml unless status_code.nil?\n xml.tag!('StatusMessage', status_message) unless status_message.nil?\n status_detail.each { |status_detail| xml << status_detail.to_xml }\n }\n end",
"def to_s\n\t\tstr = \"\\n<\" + @type\n\t\[email protected]{ |key,value|\n\t\t\tstr += \" \" + key.to_s + \" = \" + value.to_s\n\t\t}\n\t\tif @type == 'text'\n\t\t\tstr += \"> \" + @content[0] + \" </\" + @type + \">\"\n\t\telse\n\t\t\tstr += \"> \"\n\t\t\[email protected] { |c|\n\t\t\t\tstr += c.to_s\n\t\t\t}\n\t\t\tstr += \"\\n</\" + @type + \">\"\n\t\tend\n\t\tstr\n\tend",
"def export_as_xml\n super # TODO: XML export for non-MARC\n end",
"def to_s\n self.inspect\n end",
"def to_xml\n to_node.document.to_xml\n end",
"def to_s\n attrs = self.class.attributes.map do |attr|\n \"#{attr.name}=#{self.send(attr.name)}\"\n end.join(', ')\n\n \"[#{self.class.name.split('::').last}] #{attrs}\"\n end",
"def to_xml\n # Defer xml generation to the com.kd.ars.models.structure.ArsField object\n @ars_field.to_xml_string\n end",
"def inspect\n inspection = self.info.keys.map { |name|\n \"#{name}: #{attribute_for_inspect(name)}\"\n }.compact.join(\", \")\n \"#<#{self.class}:0x#{self.object_id.to_s(16)} #{inspection}>\"\n end",
"def dump\r\n super + to_s\r\n end",
"def inspect\n klass = self.class\n attrs = klass\n .attribute_names\n .reject { |key| key == :data }\n .map { |key| \" #{key}=#{@attributes[key].inspect}\" }\n .join\n \"#<#{klass.name || klass.inspect}#{attrs}>\"\n end",
"def to_s\n\t\treturn self.stringify_nodes( @output )\n\tend",
"def to_xml\n Nokogiri::XML::Builder.new do |xml|\n xml.network do\n xml.name name if name\n xml.uuid uuid if uuid\n\n bridge.to_xml(xml)\n ip.to_xml(xml)\n end\n end.to_xml\n end",
"def to_xml()\n @xml ||= Nokogiri::XML(cmark(\"--to\", \"xml\"))\n @xml\n end",
"def to_xml(opts = {})\n mapper.to_xml(self, opts)\n end",
"def xml_document\n @root_node.to_s\n end",
"def xml_document\n @root_node.to_s\n end",
"def to_xml\n xml = \"<status data=\\\"#{@data.to_s}\\\">\"\n xml += \"<local>#{@local}</local>\"\n xml += \"<situacao>#{@situacao}</situacao>\"\n xml += \"<detalhes>#{@detalhes}</detalhes>\"\n xml += \"</status>\"\n end",
"def dump\n\t\t\t\tflatten!\n\t\t\t\t\n\t\t\t\tMessagePack.dump(@attributes)\n\t\t\tend",
"def inspect\n attributes = [\"seqid=\\\"#{@seqid}\\\"\", \"source=\\\"#{@source}\\\"\", \"type=\\\"#{@type}\\\"\", \"strand=\\\"#{@strand}\\\"\"]\n attributes += @attributes.map { |(attribute, value)| \"#{attribute}=\\\"#{value}\\\"\" }\n \n \"#<#{self.class} #{attributes.join(', ')}>\"\n end",
"def to_xml \n return @_xml unless @_xml.empty?\n @_xml << \"<wddxPacket version='1.0'>\"\n if @comment.nil?\n @_xml << \"<header/>\"\n else\n @_xml << \"<header><comment>#{@comment}</comment></header>\"\n end\n @_xml << \"<data>\" \n if @data.size.eql?(1)\n @_xml << @data \n else \n @_xml << \"<array length='#{@data.size}'>\"\n @_xml << @data\n @_xml << \"</array>\"\n end \n @_xml << \"</data></wddxPacket>\"\n @_xml = @_xml.join('')\n @_xml\n end",
"def inspect\n to_s\n end"
] | [
"0.8245678",
"0.7968069",
"0.7896388",
"0.78679055",
"0.78679055",
"0.78621125",
"0.78621125",
"0.78136575",
"0.77696186",
"0.77696186",
"0.77483726",
"0.77027947",
"0.74953514",
"0.7491028",
"0.7374572",
"0.7369681",
"0.7342213",
"0.73354864",
"0.73279244",
"0.73279244",
"0.7301866",
"0.72656506",
"0.7264735",
"0.7245837",
"0.72015",
"0.7177752",
"0.71507025",
"0.71491224",
"0.7139716",
"0.7036297",
"0.7016799",
"0.69548345",
"0.6940519",
"0.69263",
"0.69204515",
"0.6906586",
"0.68699384",
"0.68675077",
"0.68547976",
"0.68267816",
"0.6824791",
"0.6821751",
"0.6821751",
"0.68199575",
"0.6807886",
"0.67988265",
"0.6781845",
"0.6770669",
"0.6770669",
"0.6770669",
"0.6770669",
"0.6770669",
"0.6770669",
"0.675983",
"0.6750905",
"0.67447186",
"0.6737965",
"0.67291903",
"0.6728172",
"0.67280203",
"0.67106277",
"0.6697824",
"0.66803885",
"0.6665691",
"0.66645736",
"0.6658559",
"0.6654437",
"0.6626427",
"0.6621639",
"0.6619487",
"0.6608026",
"0.66019726",
"0.65947104",
"0.65776765",
"0.6575385",
"0.65712196",
"0.65697306",
"0.65680337",
"0.65680337",
"0.65656805",
"0.6557588",
"0.65534985",
"0.65522236",
"0.6538611",
"0.65360546",
"0.6519662",
"0.65174866",
"0.6497251",
"0.6491293",
"0.64856946",
"0.64820695",
"0.64802146",
"0.6457267",
"0.6451277",
"0.644546",
"0.644546",
"0.6436492",
"0.6435382",
"0.6434962",
"0.642898",
"0.6427506"
] | 0.0 | -1 |
indicate which filters should be used for a taxon this method should be customized to your own site | def applicable_filters
fs = []
fs << Spree::ProductFilters.taxons_below(self)
## unless it's a root taxon? left open for demo purposes
fs << Spree::ProductFilters.price_filter if Spree::ProductFilters.respond_to?(:price_filter)
fs << Spree::ProductFilters.brand_filter if Spree::ProductFilters.respond_to?(:brand_filter)
#fs << Spree::ProductFilters.occasion_filter if Spree::ProductFilters.respond_to?(:occasion_filter)
#fs << Spree::ProductFilters.holiday_filter if Spree::ProductFilters.respond_to?(:holiday_filter)
fs << Spree::ProductFilters.selective_occasion_filter(self) if Spree::ProductFilters.respond_to?(:selective_occasion_filter)
fs << Spree::ProductFilters.selective_holiday_filter(self) if Spree::ProductFilters.respond_to?(:selective_holiday_filter)
fs
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def applicable_filters\n fs = []\n # fs << ProductFilters.taxons_below(self)\n ## unless it's a root taxon? left open for demo purposes\n\n fs << Spree::Core::ProductFilters.price_filter if Spree::Core::ProductFilters.respond_to?(:price_filter)\n fs << Spree::Core::ProductFilters.brand_filter if Spree::Core::ProductFilters.respond_to?(:brand_filter)\n fs\n end",
"def add_terms_filters\n add_work_type_filter\n add_user_filter\n add_pseud_filter\n add_collection_filter\n end",
"def applicable_filters\n fs = []\n products_searched = []\n\n if params[:search] \n if @products\n @products.each do |p|\n products_searched << p.id\n end\n end\n else\n products_searched = @taxon.products.all.pluck(:id)\n end\n\n fs << Spree::Core::ProductFilters.selective_filter('Quantity', :selective_quantity_any, products_searched) if Spree::Core::ProductFilters.respond_to?(:selective_filter)\n fs << Spree::Core::ProductFilters.selective_filter('Manufacturer', :selective_manufacturer_any, products_searched) if Spree::Core::ProductFilters.respond_to?(:selective_filter)\n fs << Spree::Core::ProductFilters.selective_filter('Use Type', :selective_use_type_any, products_searched) if Spree::Core::ProductFilters.respond_to?(:selective_filter)\n fs << Spree::Core::ProductFilters.selective_filter('Bullet Type', :selective_bullet_type_any, products_searched) if Spree::Core::ProductFilters.respond_to?(:selective_filter)\n fs << Spree::Core::ProductFilters.selective_filter('Bullet Weight', :selective_bullet_weight_any, products_searched) if Spree::Core::ProductFilters.respond_to?(:selective_filter)\n fs << Spree::Core::ProductFilters.selective_filter('Ammo Casing', :selective_ammo_casing_any, products_searched) if Spree::Core::ProductFilters.respond_to?(:selective_filter)\n fs << Spree::Core::ProductFilters.selective_filter('Ammo Caliber', :selective_ammo_caliber_any, products_searched) if Spree::Core::ProductFilters.respond_to?(:selective_filter)\n fs << Spree::Core::ProductFilters.selective_filter('Primer Type', :selective_primer_type_any, products_searched) if Spree::Core::ProductFilters.respond_to?(:selective_filter)\n fs << Spree::Core::ProductFilters.selective_filter('Condition', :selective_condition_any, products_searched) if Spree::Core::ProductFilters.respond_to?(:selective_filter)\n fs << Spree::Core::ProductFilters.price_filter(products_searched) if Spree::Core::ProductFilters.respond_to?(:price_filter)\n fs\n \n end",
"def set_filters\n filter_param_keys = [\n 'brand', 'color',\n 'size', 'department', 'keywords'\n ]\n @filters = []\n filter_param_keys.each do |key|\n if !params[key].blank?\n params[key].split(',').each do |val|\n @filters << {:key => key, :val => val}\n end\n end\n end\n \n \n if params[:price]\n params[:price].split(',').each_slice(2).to_a.each do |range|\n @filters << {:key => 'price', :val => range.join(',')}\n end\n end\n\n if @products\n @brands = @products.facet('brand_facet').rows.sort_by{ |brand| brand.value.capitalize}\n @departments = @products.facet('department_facet').rows\n end\n \n @colors = ['green', 'blue', 'purple', 'red', 'pink', 'beige', 'brown', 'yellow', 'orange', 'black', 'white', 'gray', 'teal', 'glowing', 'gold', 'silver']\n \n if [email protected]? && @taxon.has_size?\n sizes = (Spree::Product.sizes.sort_by{|size| size.position}.map(&:presentation) & @products.facet(\"size_facet\").rows.map(&:value))\n end\n end",
"def filters\n end",
"def filters; end",
"def filters; end",
"def add_filters\n add_term_filters\n add_terms_filters\n add_range_filters\n end",
"def ts_apply_filters\n # TODO: Make filters for Thinking Sphinx\n end",
"def filters\n mentos(:get_all_filters)\n end",
"def add_filters(filters); end",
"def add_term_filters\n body.filter(:term, posted: true)\n body.filter(:term, hidden_by_admin: false)\n body.filter(:term, restricted: false) unless include_restricted?\n body.filter(:term, unrevealed: false) unless include_unrevealed?\n body.filter(:term, anonymous: false) unless include_anon?\n body.filter(:term, chapter_count: 1) if options[:single_chapter]\n\n %i(complete language crossover).map do |field|\n value = options[field]\n body.filter(:term, field => value) unless value.nil?\n end\n add_tag_filters\n end",
"def gated_discovery_filters\n return super if @access != :deposit\n [\"{!terms f=id}#{admin_set_ids_for_deposit.join(',')}\"]\n end",
"def liquid_filters\n [\n StylesheetFilter,\n JavascriptFilter,\n AssignToFilter,\n LinkToFilter,\n GoogleAnalyticsFilter,\n GoogleWebmasterToolsFilter,\n GoogleJavascriptFilter,\n TextileFilter,\n DesignResourceFilter,\n AttributeFilter,\n ResourceFilter,\n NodeFilter,\n FormFilter\n ]\n end",
"def list_filters\n {\n track_end_date: 'TrkEndDate gt VALUE',\n track_first_submitted: 'TrkFirstSubmitted gt VALUE',\n app_no: 'AppNo eq VALUE',\n first_name: 'AppFirstName eq VALUE',\n last_name: 'AppLastName eq VALUE',\n email: 'AppEmailAddress eq VALUE'\n }\n end",
"def filtered_index(type)\n return unless (term = params.dig(:filter, :term).strip)\n\n case type\n when :clade\n clade_filter(term)\n when :region\n region_filter(term)\n # when :user\n # user_filter(term)\n end\n end",
"def global_filter; end",
"def tax_index\n\n end",
"def typus_defaults_for(filter)\n if self.respond_to?(\"admin_#{filter}\")\n self.send(\"admin_#{filter}\")\n else\n Typus::Configuration.config[self.name][filter.to_s].split(', ') rescue []\n end\n end",
"def set_filters\n @filters = ''\n @filters.concat(\"status:'Available'\")\n unless @manufacturer_or_publisher.blank?\n @filters.concat(\" AND (manufacturer:'#{@manufacturer_or_publisher}'\")\n @filters.concat(\" OR publisher:'#{@manufacturer_or_publisher}')\")\n end\n @filters.concat(\" AND category:'#{@category}'\") unless @category.blank?\n @filters.concat(\" AND seller_name:'#{@seller_name}'\") unless @seller_name.blank?\n end",
"def liquid_filters\n [\n DesignResourceFilter,\n AttributeFilter\n ]\n end",
"def filter\n filter_type = params[:filter][:type]\n case filter_type\n when \"last_seven\", \"weekly\"\n @filter = \"Weekly\"\n @filtered_runs = current_user.runs.in_the_last_week\n when \"last_thirty\", \"monthly\"\n @filter = \"Monthly\"\n @filtered_runs = current_user.runs.in_the_last_thirty_days\n when \"year\", \"yearly\"\n @filter = \"Yearly\"\n @filtered_runs = current_user.runs.in_the_last_year\n when \"lifetime\"\n @filter = \"Lifetime\"\n @filtered_runs = current_user.runs.most_recent_by_date\n end\n\n respond_to do |format|\n format.js\n end\n\n end",
"def fee_filter\n [\n ['Equal','equal'],\n ['Greater than','greater_than'],\n ['Less than','less_than']\n ]\n\n end",
"def usage_filters\n get('/1/reporting/filters').to_a\n end",
"def apply_filter\n end",
"def cost_filters\n get('/1/reporting/cost/filters').to_a\n end",
"def envia_taxones_query\n end",
"def typus_filters\n\n fields_with_type = ActiveSupport::OrderedHash.new\n\n if self.respond_to?('admin_filters')\n fields = self.admin_filters\n else\n return [] unless Typus::Configuration.config[self.name]['filters']\n fields = Typus::Configuration.config[self.name]['filters'].split(', ').collect { |i| i.to_sym }\n end\n\n fields.each do |field|\n attribute_type = self.model_fields[field.to_sym]\n if self.reflect_on_association(field.to_sym)\n attribute_type = self.reflect_on_association(field.to_sym).macro\n end\n fields_with_type[field.to_s] = attribute_type\n end\n\n return fields_with_type\n\n end",
"def typus_fields_for(filter); end",
"def uhook_filtered_search filters = {}\n create_scopes(filters) do |filter, value|\n case filter\n when :locale\n {:conditions => {:locale => value}}\n end\n end\n end",
"def filter\n\t\tchain(\n\t\t\tsuper, # Use automatic filter switching, i.e. use params[:filter] and #filter_options\n\t\t\t{:published => true}, # Only find published tags\n\t\t\tlambda { |tag| !tag.active_businesses_in_city(@city).empty? } # Only find tags with at least one active business\n\t\t)\n\tend",
"def set_filter(agent, filters, vars)\n agent.reset\n if filters[:discovery]\n agent.discover({:nodes => filters[:discovery]})\n else\n ['identity', 'fact', 'class', 'compound'].each do |kind|\n next unless filters[kind]\n add_filter = agent.method(\"#{kind}_filter\".to_sym)\n if filters[kind].is_a?(String)\n add_filter.call(interpolate(filters[kind], vars))\n else\n filters[kind].each do |filter|\n add_filter.call(interpolate(filter, vars))\n end\n end\n end\n end\n agent\nend",
"def index_filters\n {}\n end",
"def filter(name, function)\n filters = (self.model.design_doc['filters'] ||= {})\n filters[name.to_s] = function\n end",
"def add_tag_filters\n return if options[:filter_ids].blank?\n options[:filter_ids].each do |filter_id|\n body.filter(:term, filter_ids: filter_id)\n end\n end",
"def default_filters\n params[:filter].keys.map(&:to_sym) - @request.resource_klass._custom_filters\n end",
"def get_form_filter_types\n [\n [\"From..To\", \"from_to\"],\n [\"Equals\", \"equals\"],\n [\"Not Equal To\", \"not_equals\"],\n [\"Is Greater Than\", \"greater_than\"],\n [\"Is Greater Than Or Equal To\", \"greater_than_or_equal\"],\n [\"Is Less Than\", \"less_than\"],\n [\"Is Less Than Or Equal To\", \"less_than_or_equal\"]\n\n ]\n end",
"def filters=(_arg0); end",
"def filters=(_arg0); end",
"def set_brand_filter\n # return true if @products.nil?\n # return true if generic_results?\n # \n # @brands = @products.map(&:brand).compact.uniq.sort_by(&:name)\n # true\n end",
"def facets_of_filter_type(filter_type)\n return unless filter_class = available_filter_of_type(filter_type)\n proper_field = has_applied_filter_of_type?(filter_type) ? applied_filter_of_type(filter_type).field : filter_class.field\n self.facets.options.delete(:page)\n self.facets.options.delete(:per_page)\n self.facets[proper_field]\n end",
"def index \n\n ...\r\n \r\n #add/remove any selected filters\n selected_filter_conditions(Widget)\n\n @widgets = Widget.find(:all,{}, {:conditions => @conditions, :include => @included}) \n \n # This can be combined with any named scopes eg \n # @widgets = Widget.active.popular.find(:all,{}, {:conditions => @conditions, :include => @included}) \n\r\n \n #generate filters for results\n filter_headings(Widget, @widgets)\n\n ...\n\r\n end\n\n\n....\n\n\nend",
"def allowed_filters\n []\n end",
"def extra_search_actions(items, extra_filters = [], kind = nil)\n (extra_filters || []).each do |filter|\n case filter\n when 'my_country'\n case kind || params[:type]\n when 'people', 'counselors'\n items = items.where(country: current_user.country)\n when 'churches', 'groups'\n items = items.joins(:user).where(users:{ country: current_user.country })\n when 'contents'\n items = items.joins(:user).where(users:{ country: current_user.country })\n when 'events'\n items = items.joins('inner join user_groups on user_groups.id = events.eventable_id and events.eventable_type = \\'UserGroup\\' inner join users on users.id = user_groups.user_id').where('users.country = ?', current_user.country)\n \n # TODO\n end\n when 'my_groups'\n case kind || params[:type]\n when 'people', 'counselors'\n items = items.joins(:user_groups).where(user_groups: {id: current_user.user_groups.pluck(:id)})\n when 'churches', 'groups'\n items = items.where(id: current_user.user_groups.select(:id))\n when 'contents'\n items = items.where(user_id: current_user.user_groups_members.select(:id))\n when 'events'\n items = items.where(id: current_user.user_groups_events.select(:id))\n end\n end\n end\n items\n end",
"def especies_filtros\n return unless tiene_filtros?\n self.taxones = Especie.select(:id).select(\"#{Scat.attribute_alias(:catalogo_id)} AS catalogo_id\").joins(:scat).distinct\n por_especie_id\n por_nombre\n #estatus\n #solo_publicos\n estado_conservacion\n tipo_distribucion\n uso\n formas_crecimiento\n ambiente\n\n #return unless por_id_o_nombre\n #categoria_por_nivel\n end",
"def filters\n @filters ||= {}\n end",
"def filters\n @filters ||= {}\n end",
"def filters\n @filters ||= {}\n end",
"def filters\n self.class.filters\n end",
"def assign_filter_and_agency_type\n @filter = params[:filter] || 'broker'\n @agency_type = params[:agency_type] || 'new'\n end",
"def typus_actions_on(filter)\n actions = read_model_config['actions']\n actions && actions[filter.to_s] ? actions[filter.to_s].extract_settings : []\n end",
"def available_filters\n unless @available_filters\n initialize_available_filters\n @available_filters.each do |field, options|\n options[:name] ||= l(options[:label] || \"field_#{field}\".gsub(/_id$/, ''))\n end\n end\n @available_filters\n end",
"def filter_index\n filter\n end",
"def add_custom_search_filters(search); end",
"def filter\n @filter ||= if Platform.linux?\n linux_filter\n elsif Platform.os_x?\n os_x_filter\n else\n raise \"Only works on Linux or OS X\"\n end\n end",
"def set_filter_options\n @sort_modes = Organization.sort_modes\n @view_modes = Organization.view_modes\n\n @current_sort_mode = if @sort_modes.keys.include?(params[:sort_by])\n params[:sort_by]\n else\n @sort_modes.keys.first\n end\n\n @current_view_mode = if @view_modes.keys.include?(params[:view])\n params[:view]\n else\n @view_modes.keys.first\n end\n\n @query = params[:query]\n end",
"def aniade_taxones_query\n end",
"def custom_filters(scope)\n scope\n end",
"def config_filter(conf, filters=nil)\n\t\t\tconf = conf.clone\n\t\t\tfilters = (conf[:use].rfm_force_array | filters.rfm_force_array).compact\n\t\t\tfilters.each{|f| next unless conf[f]; conf.merge!(conf[f] || {})} if !filters.blank?\n\t\t\tconf.delete(:use)\n\t\t\tconf\n\t\tend",
"def filter\n end",
"def filters\n @filters ||= FiltersProvider.new\n end",
"def filter_params(_sub_object_attribute = nil)\n required = :returns_lbtt_tax\n attribute_list = Lbtt::Tax.attribute_list\n params.require(required).permit(attribute_list) if params[required]\n end",
"def whitelisted_filters_for_regions\n requested_parameters = as_array(@params[:regions])\n if requested_parameters.empty?\n []\n else\n regions = []\n requested_parameters.each do |slug|\n region = region_by_slug(slug)\n regions.push(region) if region.present?\n end\n regions\n end\n end",
"def filtertype_op\n\t\t\tFILTERTYPE_OP[ self.filtertype.to_sym ]\n\t\tend",
"def set_filters\n @filters = []\n section_ids = Section.pluck(:id)\n\n [:ministers, :departments].each do |filter_type|\n if params[filter_type].present?\n id_list = params[filter_type].map(&:to_i)\n\n id_list.reject! do |item|\n !section_ids.include? item\n end\n\n @filters += Section.where(id: id_list)\n end\n end\n end",
"def set_filters\n @filters ||= begin\n filters = []\n filters << { attribute: Gemgento::ProductAttribute.find_by!(code: 'color'), value: params[:color] } unless params[:color].blank?\n filters\n end\n end",
"def or_filters\n read_attribute('or_filters') || {}\n end",
"def filtro_particular(conscaso, params_filtro)\n return conscaso\n end",
"def file_filtering_conditions(resource_name)\n NfsStore::Filter::Filter.generate_filters_for resource_name, user: current_user\n end",
"def filter_parameters; end",
"def filter_parameters; end",
"def config_filters\n []\n end",
"def filter(filters=nil, options={})\n Filter.new(filters, options, self).nodes()\n end",
"def add_filter\n @filter = true \n end",
"def filters\n unless (@filters)\n @filters = {}\n return @filters unless @params[:f_inclusive]\n @params[:f_inclusive].each_pair do |field, value_hash|\n value_hash.each_pair do |value, type|\n @filters[field] ||= []\n @filters[field] << value\n end\n end \n end\n return @filters\n end",
"def filter\n super\n end",
"def selected_filter_option_names(filter)\n region_names = filter.regions(:name).sort\n country_names = filter.reduced_countries(:name).sort\n region_names.concat(country_names)\n end",
"def taxable?\n true\n end",
"def taxable?\n true\n end",
"def parse_filters(params)\n if params['filters'].blank?\n Utilities::Geo::REGEXP_COORD.keys\n else\n params.permit(filters: [])[:filters].map(&:to_sym)\n end\n end",
"def whitelisted_filters_for_countries\n country_slugs = @params[:countries] || []\n @regions.each do |region|\n country_slugs = country_slugs.concat(region[:countries])\n end\n if country_slugs.empty?\n []\n else\n Country.where(slug: country_slugs)\n end\n end",
"def filter\n do_authorize_class\n\n filter_response, opts = Settings.api_response.response_advanced(\n api_filter_params,\n Access::ByPermission.dataset_items(current_user, dataset_id: params[:dataset_id]),\n DatasetItem,\n DatasetItem.filter_settings(:reverse_order)\n )\n\n respond_filter(filter_response, opts)\n end",
"def filters\n\t\t@filters_array = Array(@profile[:filters]) unless(@filters_array)\n\t\t@filters_array.each do |filter|\n\n\t\t\tif respond_to?( \"filter_#{filter}\" )\n\t\t\t\[email protected] do |field|\n\t\t\t\t\t# If a key has multiple elements, apply filter to each element\n\t\t\t\t\t@field_array = Array( @form[field] )\n\n\t\t\t\t\tif @field_array.length > 1\n\t\t\t\t\t\t@field_array.each_index do |i|\n\t\t\t\t\t\t\telem = @field_array[i]\n\t\t\t\t\t\t\t@field_array[i] = self.send(\"filter_#{filter}\", elem)\n\t\t\t\t\t\tend\n\t\t\t\t\telse\n\t\t\t\t\t\tif not @form[field].to_s.empty?\n\t\t\t\t\t\t\t@form[field] = self.send(\"filter_#{filter}\", @form[field].to_s)\n\t\t\t\t\t\tend\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\t\t@form\n\tend",
"def initialize_url_filters\n # We use a hash which tells the domains to filter.\n # The hash value tells that if company name contains that string then don't filter\n @url_filter = Hash.new\n @url_filter[\"facebook.com\"] = \"facebook\"\n @url_filter[\"linkedin.com\"] = \"linkedin\"\n @url_filter[\"wikipedia.org\"] = \"wikipedia\"\n @url_filter[\"yahoo.com\"] = \"yahoo\"\n @url_filter[\"zdnet.com\"] = \"zdnet\"\n @url_filter[\"yelp.com\"] = \"yelp\"\n @url_filter[\"yellowpages.com\"] = \"yellowpages\"\n @url_filter[\"thefreelibrary.com\"] = \"thefreelibrary\"\n @url_filter[\"thefreedictionary.com\"] = \"thefreedictionary\"\n @url_filter[\"superpages.com\"] = \"superpages\"\n @url_filter[\"businessweek.com\"] = \"week\"\n @url_filter[\"indiamart.com\"] = \"mart\"\n @url_filter[\"naukri.com\"] = \"naukri\"\n @url_filter[\"monsterindia.com\"] = \"monster\"\n @url_filter[\"answers.com\"] = \"answers\"\n @url_filter[\"sulekha.com\"] = \"sulekha\"\n @url_filter[\"asklaila.com\"] = \"asklaila\"\n @url_filter[\"blogspot.com\"] = \"blogspot\"\n @url_filter[\"manta.com\"] = \"manta\"\n @url_filter[\"zoominfo.com\"] = \"zoom\"\n @url_filter[\"twitter.com\"] = \"twitter\"\n @url_filter[\"hotfrog.com\"] = \"hotfrog\"\n @url_filter[\"amazon.com\"] = \"amazon\"\n end",
"def call\n add_fields(leeds_taxi: true)\n end",
"def filter\n @filter\n end",
"def typus_actions_on(filter)\n Typus::Configuration.config[name]['actions'][filter.to_s].extract_settings\n rescue\n []\n end",
"def index\n @filter_methods = FilterMethod.all\n end",
"def set_filter(opts)\n opts = check_params(opts,[:filters])\n super(opts)\n end",
"def filter_data\n case params[:filter][:info]\n when 'Public'\n @tag = Tag.find_by(tag: 'Public')\n when 'Basketball Courts'\n @tag = Tag.find_by(tag: 'Basketball Courts')\n when 'Book Store'\n @tag = Tag.find_by(tag: 'Book Store')\n end\n\n @joins = Tagtoilet.where('tag_id = ?', @tag.id)\n @toilets = @joins.map{|join| Toilet.find(join.toilet_id)}\n @toilets.to_json\n end",
"def filter_for(shortcut)\n {\n attribute_filter: [:\"MundaneSearch::Filters::AttributeMatch\", {}],\n filter_greater_than: operator_filter(:>),\n filter_less_than: operator_filter(:<),\n filter_greater_than_or_equal_to: operator_filter(:>=),\n filter_less_than_or_equal_to: operator_filter(:<=),\n }[shortcut]\n end",
"def index\n @selected_filters = Hash.new\n @events = Event.all\n if params[:filter]\n if params[:filter][:my]\n @events = @events.user_events current_user\n @selected_filters[:my] = 1\n end\n if params[:filter][:all]\n @selected_filters[:all] = 1 \n else\n @selected_filters[:recent] = 1 \n @events = @events.after\n end \n else\n @events = @events.after\n end\n end",
"def get_filter_conditions(filters, applied_filters)\n return {} if applied_filters.empty?\n filter_conditions = {}\n applied_filters.each do |applied_filter_key, applied_filter_values|\n applied_filter_details = array_item_by_key_value(filters, :name, applied_filter_key)\n case applied_filter_details[:es_type]\n when 'keyword'\n filter_conditions[applied_filter_details[:name]] = { terms: { applied_filter_details[:options][:field] => applied_filter_values } }\n when 'bool'\n filter_conditions[applied_filter_details[:name]] = { term: { applied_filter_details[:options][:field] => applied_filter_values } }\n when 'integer'\n if applied_filter_details[:options][:field].is_a? Array\n filter_conditions[applied_filter_details[:options][:field][0]] = { range: { applied_filter_details[:options][:field][0] => { gte: applied_filter_values[0] } } }\n filter_conditions[applied_filter_details[:options][:field][1]] = { range: { applied_filter_details[:options][:field][1] => { lte: applied_filter_values[1] } } }\n else\n filter_conditions[applied_filter_details[:name]] = { range: { applied_filter_details[:name] => { gte: applied_filter_values[0], lte: applied_filter_values[1] } } }\n end\n when 'datetime'\n min = Time.parse(\"#{Time.parse(applied_filter_values[0]).strftime('%Y/%m/%d %H:%M:%S')} #{\"UTC\"}\").utc.strftime('%Y%m%dT%H%M%S%z')\n max = Time.parse(\"#{Time.parse(applied_filter_values[1]).strftime('%Y/%m/%d %H:%M:%S')} #{\"UTC\"}\").utc.strftime('%Y%m%dT%H%M%S%z')\n filter_conditions[applied_filter_details[:name]] = { range: { applied_filter_details[:name] => { gte: min, lte: max } } }\n end\n end\n filter_conditions\n end",
"def filters_class\n \"::Queries::CustomFilters::#{self.to_s}\".safe_constantize || \"::Queries::Filters\".safe_constantize\n end",
"def typus_options_for(filter)\n options = read_model_config['options']\n\n unless options.nil? || options[filter.to_s].nil?\n options[filter.to_s]\n else\n Typus::Resources.send(filter)\n end\n end",
"def filters(type=nil)\n unless(type)\n @filters.dup\n else\n const = Splib.find_const(type)\n type = const unless const.nil?\n @filters[type] ? @filters[type].dup : nil\n end\n end",
"def liquid_view_filters\n []\n end",
"def add_filters(filters)\n filters.each do |field, value|\n Array(value).each { |v| add_filter(field, v) }\n end\n end",
"def _filter_display\n @apotomo_emit_raw_view = true\n render :view => '_filters'\n end"
] | [
"0.78932637",
"0.7071814",
"0.69712204",
"0.685666",
"0.672113",
"0.6628986",
"0.6628986",
"0.6591011",
"0.6569453",
"0.6543019",
"0.641639",
"0.639161",
"0.6359569",
"0.63292855",
"0.62359864",
"0.6152389",
"0.6072267",
"0.60580826",
"0.6039936",
"0.6020098",
"0.6017978",
"0.6015218",
"0.60040927",
"0.5996457",
"0.59745955",
"0.59730077",
"0.59727204",
"0.59483075",
"0.5929686",
"0.5928237",
"0.5893667",
"0.58744085",
"0.58501804",
"0.5826098",
"0.58187693",
"0.579809",
"0.57916003",
"0.5782204",
"0.5782204",
"0.5776553",
"0.5747846",
"0.5747232",
"0.5743194",
"0.5740682",
"0.5740028",
"0.57384586",
"0.57384586",
"0.57340825",
"0.5724177",
"0.57169557",
"0.5711792",
"0.56914663",
"0.56895894",
"0.5686484",
"0.5672291",
"0.5649737",
"0.5647457",
"0.5645656",
"0.56409216",
"0.5640306",
"0.56390464",
"0.5634712",
"0.5629884",
"0.5625808",
"0.5624014",
"0.5614396",
"0.5610891",
"0.56085515",
"0.559831",
"0.5592932",
"0.5592932",
"0.5577788",
"0.5554999",
"0.55519974",
"0.5546012",
"0.5540844",
"0.55389506",
"0.55388093",
"0.55388093",
"0.55360687",
"0.5530879",
"0.5528781",
"0.5521888",
"0.5521169",
"0.5517564",
"0.55164886",
"0.550797",
"0.55077285",
"0.54991996",
"0.54765874",
"0.5475326",
"0.54732823",
"0.54694706",
"0.54627556",
"0.5461234",
"0.5461036",
"0.54595554",
"0.5451221",
"0.5443847"
] | 0.7828286 | 2 |
Maybe, we need to touch all parents to get this correct, so that if we have several levels all levels get purged. TODO: Check the above | def touch_parent
parent.touch unless self.root?
true
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def prune!\n return if root? #you cannot prune the root\n if normal?\n parent.normal_children.delete(self)\n else\n parent.fallback_child = nil\n end\n old_parent = parent\n @parent = nil\n old_parent.prune! if old_parent.useless?\n end",
"def prune\n @parent.gemset_prune\n end",
"def parentage\n get_parents unless @already_fetched_parents\n @already_fetched_parents = true\n super\n end",
"def destroy_ancestors\n parent = self.parent\n self.destroy\n if parent and parent.children.first.blank?\n parent.destroy_ancestors\n end\n end",
"def orphan_child_categories\n self.children.each do |child|\n child.parent_id = nil\n child.save\n end\n end",
"def destroy_tree_from_leaves\n self.subdirectories.each do |subdirectory|\n subdirectory.destroy_tree_from_leaves\n end\n self.subdirectories.reload\n self.cfs_files.each do |cfs_file|\n cfs_file.destroy!\n end\n self.cfs_files.reload\n self.destroy!\n end",
"def restore_parent\n Page.with_deleted\n .find(parent_id)\n .restore(recursive: true) if parent_id\n\n rebuild!\n end",
"def child_tree\n child_check\n child_tree = self.clone\n child_tree.removeFromParent!\n child_tree\n end",
"def remove_act\n # outdent children in case remove_act doesn't delete\n self.children.each do |child|\n child.outdent\n child.remove_act\n end\n \n # check if parent should update completeness\n old_parent = self.parent\n\n self.permissions.destroy_all\n self.destroy\n \n # refresh parent completeness\n if !old_parent.nil?\n old_parent.is_complete?\n end\n end",
"def eliminate_duplicate_parent_child_additions!\n parents_to_add.uniq!\n children_to_add.uniq!\n parents_to_remove.uniq!\n children_to_remove.uniq!\n end",
"def freshen_parent_and_child_indexes\n freshen_parent_and_child_indexes(0)\n end",
"def remove\n each { |x| x.parent.children.delete(x) }\n end",
"def rebuild_hierarchies!\n query(\"MATCH (:Page)-[parent:parent]->(:Page) DELETE parent\")\n query(\"MATCH (:Page)-[in_clade:in_clade]->(:Page) DELETE in_clade\")\n missing = {}\n related = {}\n # HACK HACK HACK HACK: We want to use Resource.native here, NOT ITIS!\n itis = Resource.where(name: \"Integrated Taxonomic Information System (ITIS)\").first\n raise \" I tried to use ITIS as the native node for the relationships, but it wasn't there.\" unless itis\n Node.where([\"resource_id = ? AND parent_id IS NOT NULL AND page_id IS NOT NULL\",\n itis.id]).\n includes(:parent).\n find_each do |node|\n page_id = node.page_id\n parent_id = node.parent.page_id\n next if missing.has_key?(page_id) || missing.has_key?(parent_id)\n page = page_exists?(page_id)\n page = page.first if page\n if page\n relate(\"in_clade\", page, page)\n end\n next if related.has_key?(page_id)\n parent = page_exists?(parent_id)\n parent = parent.first if parent\n if page && parent\n if page_id == parent_id\n puts \"** OOPS! Attempted to add #{page_id} as a parent of itself!\"\n else\n relate(\"parent\", page, parent)\n relate(\"in_clade\", page, parent)\n related[page_id] = parent_id\n # puts(\"#{page_id}-[:parent]->#{parent_id}\")\n end\n else\n missing[page_id] = true unless page\n missing[parent_id] = true unless parent\n end\n end\n related.each do |page, parent|\n puts(\"#{page}-[:in_clade*]->#{parent}\")\n end\n puts \"Missing pages in TraitBank: #{missing.keys.sort.join(\", \")}\"\n end",
"def rebalance\n order = self.level_order\n return build_tree(order)\n end",
"def _clear_cache\n @cache_parent.clear\n end",
"def rebalance\n @root = build_tree(self.level_order_traversal) if !self.balanced?\n end",
"def delete_branch\n #we'll get all descendants by level descending order. That way we'll make sure deletion will come from children to parents\n children_to_be_deleted = self.class.find(:all, :conditions => \"id_path like '#{self.id_path},%'\", :order => \"level desc\")\n children_to_be_deleted.each {|d| d.destroy}\n #now delete my self :)\n self.destroy\n end",
"def clear\n @parent = nil\n end",
"def update_self_and_descendants_depth\n if depth?\n scope_class.each_with_level(self_and_descendants) do |node, level|\n # node.with(:safe => true).set(:depth, level) unless node.depth == level\n node.set(depth: level) unless node.depth == level\n end\n self.reload\n end\n self\n end",
"def flatten( level = 1 )\n\n load_parent_state\n \n return super\n\n end",
"def orphan_self_and_parent_adopts_children\n self.class.transaction do\n parent_adopts_children\n orphan\n end\n end",
"def remove_from_parents\n ordered_by.each do |parent|\n parent.ordered_members.delete(self) # Delete the list node\n parent.members.delete(self) # Delete the indirect container Proxy\n parent.save! # record the changes to the ordered members\n end\n end",
"def remove_act\n # outdent children in case remove_act doesn't delete\n self.children.each do |child|\n if child.type != 'GoalTracker'\n child.outdent\n child.remove_act\n end\n end\n \n # check if parent should update completeness\n old_parent = self.parent\n\n self.state = Activity::ABANDONED\n self.save!\n \n # refresh parent completeness\n if !old_parent.nil?\n old_parent.is_complete?\n end\n end",
"def orphan_self_and_children\n self.class.transaction do\n orphan_children\n orphan\n end\n end",
"def delete_tree\n @root = nil # In ruby it will be taken care by garbage collector\n end",
"def recursively_destroy!\n children.each { |c| c.recursively_destroy! }\n destroy\n end",
"def destroy\n super\n\n @children.each do |_child_name, child_group|\n child_group.each(&:destroy)\n end\n\n @children = {}\n end",
"def clear_levels_cache!\n @_levels_cache = nil\n end",
"def roots\n self.find(:all, :conditions => \"(#{acts_as_nested_set_options[:scope]} AND #{acts_as_nested_set_options[:parent_column]} IS NULL)\", :order => \"#{acts_as_nested_set_options[:left_column]}\")\n end",
"def useful_parents\n ret_parents = self.parents\n if ret_parents[1].nil?\n if ret_parents[0].revision >= self.revision - 1\n ret_parents = []\n else\n ret_parents = [ret_parents[0]]\n end\n end\n ret_parents\n end",
"def update_tree(object, parent = nil)\n self.change_tree do\n self.clear unless parent\n self.fill_model(object, parent)\n end\n end",
"def exclusive_child(parent)\n\t\t\t\tparent.children = @children\n\t\t\t\t\n\t\t\t\t@children&.each_value do |child|\n\t\t\t\t\tchild.parent = parent\n\t\t\t\tend\n\t\t\t\t\n\t\t\t\tparent.clear_cache!\n\t\t\t\t\n\t\t\t\t@children = {parent.id => parent}\n\t\t\t\tself.clear_cache!\n\t\t\t\t\n\t\t\t\tparent.parent = self\n\t\t\tend",
"def before_destroy_rebuild_node_map\n survey.node_maps.select do |i|\n i.node == self\n end.each do |node_map|\n # Remap all of this nodes children to the parent\n node_map.children.each do |child|\n unless child.node.class.ancestors.include?(::ActiveRecordSurvey::Node::Answer)\n node_map.parent.children << child\n end\n end\n end\n\n true\n end",
"def unindexed_subdir_to_indexed_parent\n @unindexed_subdir_to_indexed_parent ||= {}\n end",
"def update_collection_parent\n old_parent = @collection.parent\n old_parent.delete_member_by_id(@collection.id)\n old_parent.save\n\n new_parent = find_new_parent\n new_parent.member_ids = [@collection.id] + new_parent.member_ids\n new_parent.save\n end",
"def clear_children!\n @children.clear\n end",
"def delete_tree_recursion(tree, node_group_id)\n tree[node_group_id].each do |childid|\n delete_tree_recursion(tree, childid)\n end\n #protect against trying to delete the Rootuuid\n delete_node_group(node_group_id) if node_group_id != Rootuuid\n end",
"def return_to_parent\n @current_node = @current_node.parent.parent\n # @current_node.depth = @current_node.depth - 1\n end",
"def orphan_children\n self.class.transaction do\n children(true).each{|child| child.orphan}\n end\n end",
"def parent_location_full_child_tree\n parent_location = self\n\n self.class.full_tree_location_ids = self.class.full_tree_location_ids + \"#{self.id}, \"\n \n parent_location.locations.each do |location|\n\n self.class.full_tree_location_ids = self.class.full_tree_location_ids + \"#{location.id}, \"\n logger.debug(\"XXXXXXXXXXXXXx #{self.class.full_tree_location_ids}\")\n \n unless location.locations.empty?\n location.parent_location_full_child_tree\n end\n end\n self.class.full_tree_location_ids[0..-3]\n end",
"def remove_parents(relation = nil)\n if !relation\n for rel in sorted_relations\n remove_parents(rel)\n end\n return\n end\n\n parents = parent_objects(relation).to_a\n for parent in parents\n remove_parent_object(relation, parent)\n end\n\tend",
"def orphan\n parent.disown self if parent\n @parent = nil\n end",
"def reset_daughters\n\t\t@daughters = Array.new @children\n\t\[email protected] do |child|\n\t\t\tchild.reset_daughters\n\t\tend\n\tend",
"def retrieve_all_children\n self.to_be_removed = false\n self.save\n\n self.tags.each do |i|\n i.to_be_removed = false\n i.save\n end\n end",
"def rebuild_depth_cache_sql!\n update_all(\"#{depth_cache_column} = #{ancestry_depth_sql}\")\n end",
"def children\n Product.unscoped.deleted.where(:parent_id=>self.id)\n end",
"def detach_from_parent\n return nil if parent.nil? # root\n oci = own_child_index\n parent.children.delete_at(oci) if oci\n self.parent = nil\n oci\n end",
"def parent_adopts_children\n if parent(true)\n self.class.transaction do\n children(true).each{|child| parent.children << child}\n end\n else\n orphan_children\n end\n end",
"def reset_ancestor_ids\n #puts 'ActsAsFamilyTree -> reset_ancestor_ids'\n find(:all).each {|r| r.update_ancestor_ids and r.update_descendant_ancestor_ids}\n end",
"def check_parent_ids\n # This should not be necesary as parent_ids should be included on reflections.\n #parent_resources.each { |res| parent_ids << \"#{res.singular}_id\" }\n\n # Model foreign keys \n resource.model.reflections.each do |key, refl|\n if refl.macro == :belongs_to || refl.macro == :has_and_belongs_to_many\n parent_ids << refl.primary_key_name\n foreing_models[refl.primary_key_name.to_s]= refl.class_name.constantize\n end\n end\n self.parent_ids= Set.new(self.parent_ids)\n end",
"def roots\n self.class.find(:all, :conditions => \"#{acts_as_nested_set_options[:scope]} AND (#{acts_as_nested_set_options[:parent_column]} IS NULL)\", :order => \"#{acts_as_nested_set_options[:left_column]}\")\n end",
"def trim_tree\n\t\t@corridor_seeds.each { |seed| check_branch(corridor_map[seed]) }\n\tend",
"def rebuild_depth_cache!\n raise Ancestry::AncestryException.new(I18n.t(\"ancestry.cannot_rebuild_depth_cache\")) unless respond_to? :depth_cache_column\n\n ancestry_base_class.transaction do\n unscoped_where do |scope|\n scope.find_each do |node|\n node.update_attribute depth_cache_column, node.depth\n end\n end\n end\n end",
"def before_create\n # Update the child object with its parents attrs\n unless self[:parent_id].to_i.zero?\n self[:depth] = parent[:depth].to_i + 1\n self[:root_id] = parent[:root_id].to_i\n end\n end",
"def refresh_cache_after_update\n # Parent didn't change, do nothing with cache\n return if @parent_id_before == self.read_attribute(parent_id_column)\n # If a subcategory has come from another branch, refresh that tree\n self.class.refresh_cache_of_branch_with(@parent_id_before) unless @parent_id_before.nil? || @parent_id_before == self.root.id\n # Refresh current branch in any case\n self.class.refresh_cache_of_branch_with(self.root)\n # Refresh all positions\n self.class.refresh_positions\n end",
"def children() []; end",
"def remove_parent\n # has to go from parent to child\n self.parent.remove_child(self)\n end",
"def ignore_parent_exclusion; end",
"def update_ancestors!(ancestors)\n ancestors.each do |post|\n post.touch\n post.increment(:descendants_depth).save!\n end\n end",
"def test_clear_without_autoloaded_singleton_parent\n mark_as_autoloaded do\n parent_instance = Parent.new\n parent_instance.singleton_class.descendants\n ActiveSupport::DescendantsTracker.clear\n assert_not ActiveSupport::DescendantsTracker.class_variable_get(:@@direct_descendants).key?(parent_instance.singleton_class)\n end\n end",
"def reload_relations\n relations.each_pair do |name, meta|\n if instance_variable_defined?(\"@#{name}\")\n if _parent.nil? || instance_variable_get(\"@#{name}\") != _parent\n remove_instance_variable(\"@#{name}\")\n end\n end\n end\n end",
"def process_tree_with_renew\n @process_tree = nil\n process_tree\n end",
"def clear_levels_cache!\n appenders.each(&:clear_levels_cache!)\n end",
"def parents\n check_commit\n @parents \n end",
"def remove_parent_placeholers\n self.key.split('/')[0..-2].inject(\"\") do |x,y|\n x << y + '/'\n asset = Asset.find_by_key(x)\n unless asset.nil?\n asset.destroy if asset.is_placeholder_directory?\n end\n x\n end\n end",
"def refresh!\n @roots.keys.each { |key| @roots[key].delete(:up_to_date) }\n end",
"def update_children\n self.children.each do |child|\n child.update_children\n unless child.new_record?\n child.save\n child.move_to_child_of(self) if child.parent_id != self.id\n end\n end if self.changed?\n end",
"def cleanup(paths)\n item = path_tree.descend(paths)\n item.cleanup \n save_path_tree\n # print what happened here\n print_depth item\n end",
"def update_children_with_new_parent\n if path_changed? and not new_record? then\n old_path = (path_was.blank? ? id.to_s : \"#{path_was}.#{id}\")\n self.class.where(\"path <@ ?\", old_path).update_all([ \"path = TEXT2LTREE(REPLACE(LTREE2TEXT(path), ?, ?))\", old_path, my_path ])\n end\n end",
"def prune_from_tree\n return if self.right.nil? || self.left.nil?\n diff = self.right - self.left + 1\n\n #TODO: implemente :dependent option\n # delete_method = acts_as_nested_set_options[:dependent] == :destroy ?\n # :destroy_all : :delete_all\n\n #TODO: implement prune method\n # self.class.base_class.transaction do\n # nested_set_scope.send(delete_method,\n # [\"#{quoted_left_column_name} > ? AND #{quoted_right_column_name} < ?\",\n # left, right]\n # )\n # nested_set_scope.update_all(\n # [\"#{quoted_left_column_name} = (#{quoted_left_column_name} - ?)\", diff],\n # [\"#{quoted_left_column_name} >= ?\", right]\n # )\n # nested_set_scope.update_all(\n # [\"#{quoted_right_column_name} = (#{quoted_right_column_name} - ?)\", diff],\n # [\"#{quoted_right_column_name} >= ?\", right]\n # )\n # end\n end",
"def renumber_full_tree\n indexes = []\n n = 1\n transaction do\n for r in roots # because we may have virtual roots\n n = 1 + r.calc_numbers(n, indexes)\n end\n for i in indexes\n base_set_class.update_all(\"#{left_col_name} = #{i[:lft]}, #{right_col_name} = #{i[:rgt]}\", \"#{self.class.primary_key} = #{i[:id]}\")\n end\n end\n ## reload?\n end",
"def clear_submodels\n children = self.submodels.find_all { |m| !m.permanent_model? }\n if !deregister_submodels(children)\n return\n end\n\n # This contains the permanent submodels\n #\n # We can call #clear_submodels while iterating here as it is a\n # constraint that all models in #submodels are permanent (and\n # will therefore not be removed)\n submodels.each { |m| m.clear_submodels }\n # And this the non-permanent ones\n children.each { |m| m.clear_submodels }\n true\n end",
"def update_hierarchy\n update_ancestor_ids and update_descendant_ancestor_ids\n end",
"def destroy\n @parent = nil\n @root = nil\n end",
"def find_pages_for_parents_list\n @pages_for_parents_list = []\n Page.find_all_by_parent_id(nil, :order => \"position ASC\").each do |page|\n @pages_for_parents_list << page\n @pages_for_parents_list += add_pages_branch_to_parents_list(page)\n end\n @pages_for_parents_list.flatten.compact!\n\n # We need to remove all references to the current page or any of its decendants or we get a nightmare.\n @pages_for_parents_list.reject! do |page|\n page.id == @page.id or @page.descendants.include?(page)\n end unless @page.nil? or @page.new_record?\n end",
"def stronger\n ancestors\n end",
"def update_descendants_with_new_ancestry\n # Skip this if callbacks are disabled\n unless ancestry_callbacks_disabled?\n # If node is not a new record and ancestry was updated and the new ancestry is sane ...\n if changed.include?(self.base_class.ancestry_column.to_s) && !new_record? && sane_ancestry?\n # ... for each descendant ...\n unscoped_descendants.each do |descendant|\n # ... replace old ancestry with new ancestry\n descendant.without_ancestry_callbacks do\n column = self.class.ancestry_column\n v = read_attribute(column)\n descendant.update_attribute(\n column,\n descendant.read_attribute(descendant.class.ancestry_column).gsub(\n /^#{self.child_ancestry}/,\n if v.blank? then\n id.to_s\n else\n \"#{v}/#{id}\"\n end\n )\n )\n end\n end\n end\n end\n end",
"def preserve_children?\n false\n end",
"def parent=(new_parent) \n parent.children.delete(self) if @parent #=> this is the old parent removing the child that is being adopted \n @parent = new_parent #=> I have a new mommy! \n new_parent.children << self unless @parent == nil || new_parent.children.include?(self) \n end",
"def unregister_parent( parent_array )\n \n if @parents.delete( parent_array )\n parent_array.reverse_each_range do |this_object, this_parent_index|\n update_for_parent_delete_at( parent_array, this_parent_index, this_object )\n end\n @cascade_controller.unregister_parent( parent_array )\n parent_array.unregister_child( self )\n end\n \n return self\n \n end",
"def children; []; end",
"def destroy_descendants\n return if right.nil? || left.nil? || skip_before_destroy\n\n if acts_as_nested_set_options[:dependent] == :destroy\n descendants.each do |model|\n model.skip_before_destroy = true\n model.destroy\n end\n else\n c = nested_set_scope.where(left_field_name.to_sym.gt => left, right_field_name.to_sym.lt => right)\n scope_class.where(c.selector).delete_all\n end\n\n # update lefts and rights for remaining nodes\n diff = right - left + 1\n\n # scope_class.with(:safe => true).where(\n scope_class.where(\n nested_set_scope.where(left_field_name.to_sym.gt => right).selector\n ).inc(left_field_name => -diff)\n\n # scope_class.with(:safe => true).where(\n scope_class.where(\n nested_set_scope.where(right_field_name.to_sym.gt => right).selector\n ).inc(right_field_name => -diff)\n\n # Don't allow multiple calls to destroy to corrupt the set\n self.skip_before_destroy = true\n end",
"def update_menu\n parent = self._parent\n while parent.class != DcManual do \n parent = parent._parent \n end\n parent.do_before_save\n parent.save\nend",
"def destroy_descendants\n return if right.nil? || left.nil? || skip_before_destroy\n \n if acts_as_nested_set_options[:dependent] == :destroy\n descendants.each do |model|\n model.skip_before_destroy = true\n model.destroy\n end\n else\n base_class.delete_all scoped(left_column_name => { '$gt' => left }, right_column_name => { '$lt' => right })\n end\n \n # update lefts and rights for remaining nodes\n diff = right - left + 1\n base_class.all(scoped(left_column_name => { '$gt' => right })).each do |node|\n node.update_attributes left_column_name => node.left - diff\n end\n base_class.all(scoped(right_column_name => { '$gt' => right })).each do |node|\n node.update_attributes right_column_name => node.right - diff\n end\n \n # Don't allow multiple calls to destroy to corrupt the set\n self.skip_before_destroy = true\n end",
"def cache_ancestry\n self.names_depth_cache = path.map(&:name).join('/')\n end",
"def renumber_full_tree\n indexes = []\n n = 1\n transaction do\n for r in roots # because we may have virtual roots\n n = r.calc_numbers(n, indexes)\n end\n for i in indexes\n base_set_class.update_all(\"#{left_col_name} = #{i[:lft]}, #{right_col_name} = #{i[:rgt]}\", \"#{self.class.primary_key} = #{i[:id]}\")\n end\n end\n ## reload?\n end",
"def mark_children_for_purging(children)\n children.each do |name, child|\n next if child[:source]\n child[:ensure] = :absent\n end\n end",
"def destroy\n super do\n graph.delete [source.to_term, nil, nil]\n parent.delete [parent, nil, source.to_term]\n end\n end",
"def remove_from_tree(item, node) \n return rebalance(super(item, node))\n end",
"def outdent\n old_parent = self.parent\n if old_parent.nil?\n # if no parent, it is already at highest level\n return false\n elsif old_parent.parent.nil?\n return self.make_root\n else\n return old_parent.parent.add_child(self)\n end\n end",
"def update_descendants_with_new_ancestry\n # Skip this if callbacks are disabled\n unless ancestry_callbacks_disabled?\n # If node is valid, not a new record and ancestry was updated ...\n if changed.include?(self.base_class.ancestry_column.to_s) && !new_record? && valid?\n # ... for each descendant ...\n descendants.each do |descendant|\n # ... replace old ancestry with new ancestry\n descendant.without_ancestry_callbacks do\n descendant.update_attributes(\n self.base_class.ancestry_column =>\n descendant.read_attribute(descendant.class.ancestry_column).gsub(\n /^#{self.child_ancestry}/, \n if read_attribute(self.class.ancestry_column).blank? then id.to_s else \"#{read_attribute self.class.ancestry_column }/#{id}\" end\n )\n )\n end\n end\n end\n end\n end",
"def update_and_delete user\n self.parents.each do |parent|\n parent.update_and_save\n end\n self.delete user\n end",
"def clean_tree(branch)\n\n branch.children = branch.children.inject(Children.new(branch)) do |r, c|\n cc = if c.name == 'sequence' and c.children.size == 1\n c.children.first\n else\n c\n end\n r << clean_tree(cc)\n end\n\n branch\n end",
"def delete_unwanted_children\n @children.keys.each do |key|\n if(@children[key][:value].class.name === \"Array\")\n if(@children[key][:value].empty?)\n @children.tap { |hs| hs.delete(key) }\n end\n else\n if(@children[key][:value].nil?)\n @children.tap { |hs| hs.delete(key) }\n end\n end\n end\n end",
"def update_nested_stack_relations\n Array(@data[:orchestration_stacks]).each do |stack|\n stack[:children].each do |child_stack_id|\n child_stack = @data_index.fetch_path(:orchestration_stacks, child_stack_id)\n child_stack[:parent] = stack if child_stack\n end\n stack.delete(:children)\n end\n end",
"def merge_into_parent(parent_id)\n parent = Product.find parent_id\n CollectionProduct.where(:product_id => self.id).update_all(:product_id => parent.id)\n ProjectProduct.where(:product_id => self.id).update_all(:product_id => parent.id)\n Star.where(:id => self.id, :starrable_type => \"Product\").update_all(:starrable_id => parent.id)\n #update parent with new info\n Product.where(:id => parent.id).update_all(:stars_count => (parent.stars_count + self.stars_count))\n collections_count = self.collections.count\n projects_count = self.projects.count\n #set the parent and \"delete\" the current product\n self.update_attributes :deleted_at => Time.now, :parent_id => parent.id, :projects_count => projects_count, :collection_products_count => collections_count\n self.save!\n end",
"def trim_tree\n @corridor_seeds.each { |seed| check_branch(corridor_map[seed]) }\n end",
"def clear\n @tree.clear\n return 0\n end",
"def reset\n merge_attributes(@parent) if @parent\n merge_attributes(@attributes)\n self\n end",
"def clear_relations\n each_event { |ev| ev.clear_relations }\n\t super()\n self\n\tend",
"def ignore_parent_exclusion?; end"
] | [
"0.6893962",
"0.6711634",
"0.6710706",
"0.6627064",
"0.65189135",
"0.64971334",
"0.6472203",
"0.64084005",
"0.63511866",
"0.63097423",
"0.6296388",
"0.62556016",
"0.62530047",
"0.6212412",
"0.6178907",
"0.6177991",
"0.6177724",
"0.6171208",
"0.6070927",
"0.6063836",
"0.60503525",
"0.604218",
"0.601767",
"0.6011722",
"0.5994152",
"0.59843665",
"0.5964517",
"0.59632665",
"0.59498954",
"0.59408545",
"0.5937064",
"0.5930698",
"0.59248585",
"0.59246504",
"0.59225875",
"0.590289",
"0.5895999",
"0.58956194",
"0.58815247",
"0.58662546",
"0.5853215",
"0.58504504",
"0.58485156",
"0.5841679",
"0.5823749",
"0.5821817",
"0.58202946",
"0.5820015",
"0.58189183",
"0.5816844",
"0.5815965",
"0.5812348",
"0.5797849",
"0.57945395",
"0.5783141",
"0.5778767",
"0.57770836",
"0.5774967",
"0.5771751",
"0.5756599",
"0.57531637",
"0.57475215",
"0.57389235",
"0.5721828",
"0.57215196",
"0.5719322",
"0.57178104",
"0.5714237",
"0.570987",
"0.5709221",
"0.57039267",
"0.5702208",
"0.5700899",
"0.5695101",
"0.5691836",
"0.56910884",
"0.5687782",
"0.56792176",
"0.5678369",
"0.5678278",
"0.56744754",
"0.56741863",
"0.5666757",
"0.56653225",
"0.566401",
"0.56562585",
"0.5654939",
"0.56394887",
"0.56293035",
"0.5624282",
"0.562299",
"0.5616266",
"0.5612036",
"0.56105757",
"0.56091344",
"0.5605224",
"0.5602438",
"0.55986476",
"0.55953014",
"0.55949914",
"0.5585859"
] | 0.0 | -1 |
GET /date_types GET /date_types.json | def index
@date_types = DateType.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def appointment_types(params = {})\n scope 'default'\n get('schedule/appointmenttypes/', params)\n end",
"def index\n @day_types = DayType.all\n end",
"def dates(options = {})\n response= handle_errors{ self.class.get('/dates', :query => options)}\n response[\"dates\"][\"date\"].collect{|i| Rubycious::PostDate.new(i)}\n end",
"def index\n @event_types = EventType.sorted\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @event_types }\n end\n end",
"def index\n @event_types = EventType.all\n respond_with @event_types\n end",
"def types\n @client.make_request :get, reports_path\n end",
"def index\n @calendar_types = CalendarType.all\n end",
"def index\n @os_types = OsType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @os_types, except: [:desc, :created_at, :updated_at] } \n end\n end",
"def index\n @reserved_dates = ReservedDate.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @reserved_dates }\n end\n end",
"def index\n @event_types = EventType.all.sort { |p1, p2| p1.name <=> p2.name }\n\n respond_to do |format|\n format.json { render json: @event_types }\n format.xml { render xml: @event_types.to_xml({ include: :categories }) }\n end\n end",
"def index\n @entry_types = EntryType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @entry_types }\n end\n end",
"def types\n if @@types.nil? || (@@last_type_check + (4 * 60 * 60)) < Time.now\n @@last_type_check = Time.now\n @@types = _make_request(:types)['results']\n end\n @@types\n end",
"def index\n @agendaitemtypes = Agendaitemtype.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @agendaitemtypes }\n end\n end",
"def index\n @language_types = LanguageType.all\n\n render json: @language_types\n end",
"def index\n @timerecord_types = TimerecordType.paginate(:page => params[:page], :per_page => per_page).order('id')\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @timerecord_types }\n end\n end",
"def types\n types = Question.distinct.pluck(:type)\n render json: types.to_a\n end",
"def index\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @resource_types }\n end\n end",
"def index\n @discipline_types = DisciplineType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @discipline_types }\n end\n end",
"def get_lesson_types\n get \"lessonTypes.json\"\n end",
"def index\n @observation_types = ObservationType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @observation_types }\n end\n end",
"def index\n @types = Type.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @types.lookup(params[:q]) }\n end\n end",
"def index\n respond_to do |format|\n format.html\n format.json {\n\n render :json => TimeOff.joins('LEFT OUTER JOIN request_types ON time_offs.request_type_id = request_types.id')\n .joins('INNER JOIN users ON time_offs.user_id = users.id')\n .select(\n 'time_offs.id,\n time_offs.request_start_date,\n time_offs.request_end_date,\n time_offs.status,\n time_offs.comments,\n users.name as users_name,\n request_types.name as request_type_name') }\n end\n end",
"def get_date_array\n # Prepare query url.\n _query_builder = config.get_base_uri\n _query_builder << '/response/date'\n _query_builder = APIHelper.append_url_with_query_parameters(\n _query_builder,\n 'array' => true\n )\n _query_url = APIHelper.clean_url _query_builder\n\n # Prepare headers.\n _headers = {\n 'accept' => 'application/json'\n }\n\n # Prepare and execute HttpRequest.\n _request = config.http_client.get(\n _query_url,\n headers: _headers\n )\n _response = execute_request(_request)\n\n # Validate response against endpoint and global error codes.\n return nil if _response.status_code == 404\n validate_response(_response)\n\n # Return appropriate response type.\n decoded = APIHelper.json_deserialize(_response.raw_body)\n decoded.map { |element| Date.iso8601(element) }\n end",
"def index\n @crate_types = CrateType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @crate_types }\n end\n end",
"def index\n # @properties = Property.all('date') ## Who put this in? What is ('date') intended to do ?\n @properties = Property.all\n respond_to do |format|\n format.html {} # do nothing - this is the default. display as normal html\n format.json {render :json => @properties}\n end\n end",
"def show\n @daytype = Daytype.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @daytype }\n end\n end",
"def index\n # @weekdays = Weekday.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: Oj.dump(@weekdays, mode: :compat) }\n end\n end",
"def view_types(for_select = true) # get the defined view type partials. e.g. views/views/list.html.erb\n fetch_array_for get_view_types, for_select\n end",
"def ride_types(args = {})\n make_request(\n http_method: :get,\n endpoint: path_for(:ride_types),\n access_token: args.delete(:access_token),\n options: { query: args }\n )\n end",
"def index\n @allocation_dates = AllocationDate.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @allocation_dates }\n end\n end",
"def index\n @log_types = LogType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @log_types }\n end\n end",
"def index\n @military_document_types = MilitaryDocumentType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @military_document_types }\n end\n end",
"def index\n @api_v1_user_types = Api::V1::UserType.all\n end",
"def index\n @act_types = ActType.order(:name).page(params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @act_types }\n end\n end",
"def index\n @event_types = EventType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render xml: @event_types }\n end\n end",
"def index\n @day_weeks = DayWeek.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @day_weeks }\n end\n end",
"def find_all_fedora_type(params, ftype)\n # ftype should be :collection or :apo (or other symbol if we added more since this was updated)\n date_range_q = get_date_solr_query(params)\n solrparams = {\n :q => \"#{Type_Field}:\\\"#{Fedora_Types[ftype]}\\\" #{date_range_q}\",\n :wt => :json,\n :fl => @@field_return_list\n }\n get_rows(solrparams, params)\n response = run_solr_query(solrparams)\n determine_proper_response(params, response)\n end",
"def date_type_params\n params.require(:date_type).permit(:name, :plainformat, :senml)\n end",
"def index\n respond_to do |format|\n format.html { @product_types = ProductType.all }\n format.json { @product_types = ProductType.order(:name) }\n end\n end",
"def find\n days = Day.where(fulldate: Date.parse(params[:startdate])..Date.parse(params[:enddate]))\n sorted_days = days.sort_by{ |day| day.fulldate }\n render json: sorted_days\n end",
"def index\n @event_types = EventType.paginate(page: params[:page])\n end",
"def index\n @dept_types = DeptType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @dept_types }\n end\n end",
"def dates\n render json: @standings\n end",
"def index\n if params[:date]\n redirect_date(params[:date])\n else\n @school_days = SchoolDay.all\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @school_days }\n end\n end\n end",
"def types\n aux = WorkOrderType.by_name\n render json: serialized_work_order_types(aux)\n end",
"def index\n authorize! :show, PointsEntryType\n load_active_points_entry_types\n\n respond_to do |format|\n format.html\n format.json { render json: @points_entry_types }\n end\n end",
"def show\n @event_types = EventType.find(params[:id])\n respond_with @event_type\n end",
"def set_date_type\n @date_type = DateType.find(params[:id])\n end",
"def index\n @bike_types = BikeType.all.order(\"updated_at DESC\").order(\"created_at DESC\")\n\n render json: @bike_types #each_serializer: Web::V1::BikeTypeSerializer\n end",
"def index \n respond_to do |format|\n format.html # index.html.erb\n format.json { \n asset_types = AssetType.all\n render json: asset_types \n }\n end\n end",
"def index\n @downtime_types = DowntimeType.all.paginate(:page=> params[:page])#.order(nr: :desc)\n end",
"def index\n @admission_types = AdmissionType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @admission_types }\n end\n end",
"def index\n @typegroups = Typegroup.all\n respond_to do |format|\n format.html\n format.json { render json: @typegroups }\n end\n end",
"def get_resource_types\n Occi::Log.debug(\"Getting resource types ...\")\n collection = @model.get Occi::Core::Resource.kind\n collection.kinds.collect { |kind| kind.term }\n end",
"def opportunity_date_ini_type_select\n [\n ['Indefinida', Opportunity::TYPE_UNDEFINED],\n ['Lo antes posible', Opportunity::TYPE_AS_SOON_AS_POSSIBLE],\n ['Fijar fecha', Opportunity::TYPE_SET_DATE_INI]\n ]\n end",
"def index\n @vehicle_types = VehicleType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @vehicle_types }\n end\n end",
"def index\n types = @user.tried_beer_ratings.last.beer_types.map do |type|\n {name: type.name, description: type.beg_description}\n end\n render json: types\n end",
"def date_classes\n [Date, defined?(FmRest::StringDate) && FmRest::StringDate].compact.freeze\n end",
"def index\n @task_types = TaskType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @task_types }\n end\n end",
"def index\n @specification_types = SpecificationType.all.order(\"display_order\")\n\n render json: @specification_types, each_serializer: Web::V1::SpecificationTypeSerializer\n end",
"def list(type)\n get(resource_path_for_entity_type(type) + \"?rows=all\")\n end",
"def index\n @techaxis_types = TechaxisType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @techaxis_types }\n end\n end",
"def index\n @ftypes = Ftype.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ftypes }\n end\n end",
"def dates\n end",
"def index\n @talk_types = TalkType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @talk_types }\n end\n end",
"def index\n @orientations = Orientation.all\n @orientation_by_date = @orientations.group_by(&:class_date)\n @date = params[:date] ? Date.parse(params[:date]) : Date.today\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @orientations }\n end\n end",
"def getMetadatatypes\n \n @queryparams = params\n \n # Get all metadatatypes\n @results = MetadataType.find(:all, :order => \"updated_at ASC\" )\n \n if params[:format] && params[:format]== \"json\" || params[:format] == \"yaml\"\n @yaml_results = {}\n @results.each do |result|\n @yaml_results.merge!({result.name => result.value_type})\n end\n \n end\n \n # host parameter, needed when creating atom-feed\n if request.ssl?\n @host = \"https://#{request.host}\"\n else\n @host = \"http://#{request.host}\"\n end\n\n if request.port != nil and request.port != 80\n @host += \":#{request.port}\"\n end \n \n # Create atom feed\n @host = @@http_host\n respond_to do |format|\n if @queryparams[:format] == nil\n format.html {render :getmetadatatypes, :layout=>true }\n else\n format.html {render :getmetadatatypes, :layout=>true }\n format.atom {render :getmetadatatypes, :layout=>false }\n format.yaml {render :text => YAML.dump(@yaml_results), :layout=>false }\n format.json {render :text => JSON.dump(@yaml_results), :layout=>false }\n end\n end\n end",
"def get_static_assests\n types = LocationType.all\n facilities = Facility.all\n type_array = []\n facility_array = []\n types.each do |type|\n type_array << type.name\n end\n facilities.each do |facility|\n facility_array << facility.name\n end\n render json: { location_types: type_array, location_facilities: facility_array }\n end",
"def index\n @tour_dates = TourDate.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @tour_dates }\n end\n end",
"def listing(type, **params)\n params[:t] = params.delete(:time) if params.key?(:time)\n @client.model(:get, \"/user/#{get_attribute(:name)}/#{type}.json\", params)\n end",
"def listing(type, **params)\n params[:t] = params.delete(:time) if params.key?(:time)\n @client.model(:get, \"/user/#{get_attribute(:name)}/#{type}.json\", params)\n end",
"def search\n authorize! :show, PointsEntryType\n search_points_entry_types\n\n respond_to do |format|\n #format.html # actually, no.\n format.json {\n render json: @points_entry_types.select([:id, :name, :default_points])\n }\n end\n end",
"def index\n @task_types = @project.task_types\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @task_types }\n end\n end",
"def index\n @student_types = StudentType.all\n\n render json: @student_types\n end",
"def index\n @types = Type.all\n end",
"def index\n @realty_types = RealtyType.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @realty_types }\n end\n end",
"def index\n respond_to do |format|\n if params[:search]\n format.html { @provider_provider_types = Provider::ProviderType.search(params[:search]).order(\"created_at DESC\")}\n format.json { @provider_provider_types = Provider::ProviderType.search(params[:search]).order(\"created_at DESC\")}\n else\n format.html { @provider_provider_types = Provider::ProviderType.all.order('created_at DESC')}\n format.json { @provider_provider_types = Provider::ProviderType.all.order('created_at DESC')}\n end\n end\n end",
"def show\n @api_v1_user_types = Api::V1::UserType.all\n end",
"def index\n @curriculum_comment_types = CurriculumCommentType.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @curriculum_comment_types }\n end\n end",
"def index\n @date_requests = DateRequest.all\n end",
"def dayIndex\n render json: Restaurant.restaurantsDay\n end",
"def get_1123_date_time_array\n # Prepare query url.\n _query_builder = config.get_base_uri\n _query_builder << '/response/1123datetime'\n _query_builder = APIHelper.append_url_with_query_parameters(\n _query_builder,\n 'array' => true\n )\n _query_url = APIHelper.clean_url _query_builder\n\n # Prepare headers.\n _headers = {\n 'accept' => 'application/json'\n }\n\n # Prepare and execute HttpRequest.\n _request = config.http_client.get(\n _query_url,\n headers: _headers\n )\n _response = execute_request(_request)\n\n # Validate response against endpoint and global error codes.\n return nil if _response.status_code == 404\n validate_response(_response)\n\n # Return appropriate response type.\n decoded = APIHelper.json_deserialize(_response.raw_body)\n decoded.map { |element| DateTimeHelper.from_rfc1123(element) }\n end",
"def index\n @identifier_types = IdentifierType.order(:position).page(params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @identifier_types }\n end\n end",
"def index\r\n @classdays = Classday.all\r\n\r\n render json: @classdays\r\n end",
"def get_3339_datetime_array\n # Prepare query url.\n _query_builder = config.get_base_uri\n _query_builder << '/response/3339datetime'\n _query_builder = APIHelper.append_url_with_query_parameters(\n _query_builder,\n 'array' => true\n )\n _query_url = APIHelper.clean_url _query_builder\n\n # Prepare headers.\n _headers = {\n 'accept' => 'application/json'\n }\n\n # Prepare and execute HttpRequest.\n _request = config.http_client.get(\n _query_url,\n headers: _headers\n )\n _response = execute_request(_request)\n\n # Validate response against endpoint and global error codes.\n return nil if _response.status_code == 404\n validate_response(_response)\n\n # Return appropriate response type.\n decoded = APIHelper.json_deserialize(_response.raw_body)\n decoded.map { |element| DateTimeHelper.from_rfc3339(element) }\n end",
"def get_issue_types(project_id_or_key)\n get(\"projects/#{project_id_or_key}/issueTypes\")\n end",
"def index\n @product_types = ProductType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @product_types }\n end\n end",
"def index\n @type_people = TypePerson.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @type_people }\n end\n end",
"def index\n @product_types = ProductType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @product_types }\n end\n end",
"def index\n @format_types = FormatType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @format_types }\n end\n end",
"def index\n @discipline_class_exam_types = DisciplineClassExamType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @discipline_class_exam_types }\n end\n end",
"def index\n respond_to do |format|\n format.html # index.html.erb (no data required)\n format.ext_json { render :json => find_contract_types.to_ext_json(:class => ContractType, :count => ContractType.count(options_from_search(ContractType))) }\n end\n end",
"def index\n @technotypes = Technotype.all\n\n respond_to do |format|\n format.json { render json: @technotypes, status: 200 }\n end\n end",
"def index\n @lunchplans = Lunchplan.all\n\t@lunchplans_by_date = @lunchplans.group_by(&:day)\n\t@date = params[:date] ? Date.parse(params[:date]) : Date.today\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @lunchplans }\n end\n end",
"def get_supported_file_types\n path = '/v3/miscellaneous/supported-file-types'\n\n headers = {\n 'Content-Type' => 'application/json',\n 'User-Agent' => Config.user_agent\n }\n\n request = Net::HTTP::Get.new(path, headers)\n handle_response(@api_client.request(request), 'get_supported_file_types')\n end",
"def show\n @all_type=Api::V1::AdminType.all\n render json: @all_type\n end",
"def get_date\n # Prepare query url.\n _query_builder = config.get_base_uri\n _query_builder << '/response/date'\n _query_url = APIHelper.clean_url _query_builder\n\n # Prepare and execute HttpRequest.\n _request = config.http_client.get(\n _query_url\n )\n _response = execute_request(_request)\n\n # Validate response against endpoint and global error codes.\n return nil if _response.status_code == 404\n validate_response(_response)\n\n # Return appropriate response type.\n Date.iso8601(_response.raw_body)\n end",
"def index\n @leavetypes = Leavetype.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @leavetypes }\n end\n end",
"def index\n @leavetypes = Leavetype.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @leavetypes }\n end\n end",
"def index\n @recipe_types = RecipeType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @recipe_types }\n end\n end"
] | [
"0.66776365",
"0.6325213",
"0.62087154",
"0.6102505",
"0.6034797",
"0.6030782",
"0.6030451",
"0.6009954",
"0.59701437",
"0.5924832",
"0.58510274",
"0.58478266",
"0.5820071",
"0.5819705",
"0.581955",
"0.58057934",
"0.579429",
"0.57843554",
"0.57743937",
"0.5768278",
"0.57553005",
"0.5749481",
"0.57370853",
"0.5730561",
"0.57073885",
"0.5657854",
"0.5645865",
"0.56437325",
"0.5582167",
"0.55750537",
"0.55633795",
"0.5561741",
"0.555173",
"0.5550458",
"0.5547913",
"0.5542073",
"0.55355495",
"0.55352896",
"0.55343944",
"0.55254567",
"0.552524",
"0.5514537",
"0.55120724",
"0.550486",
"0.5491821",
"0.5484657",
"0.5484367",
"0.5482787",
"0.5481642",
"0.54779",
"0.54653424",
"0.54642516",
"0.54633534",
"0.54600006",
"0.5457646",
"0.5452893",
"0.5450159",
"0.5448388",
"0.54472023",
"0.5442984",
"0.5428498",
"0.5423134",
"0.5414493",
"0.5414269",
"0.5398958",
"0.53891605",
"0.5386298",
"0.5382917",
"0.53822166",
"0.5374825",
"0.5374825",
"0.53684276",
"0.5361354",
"0.5360236",
"0.5360176",
"0.53580457",
"0.5355562",
"0.53521717",
"0.5346498",
"0.5342381",
"0.5337268",
"0.533681",
"0.53317183",
"0.5331672",
"0.53294307",
"0.5323996",
"0.5322385",
"0.5322182",
"0.53101754",
"0.53069",
"0.53051865",
"0.5301696",
"0.530059",
"0.52992547",
"0.52882564",
"0.5284105",
"0.528234",
"0.52808887",
"0.52808887",
"0.52772635"
] | 0.72657067 | 0 |
GET /date_types/1 GET /date_types/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @date_types = DateType.all\n end",
"def appointment_types(params = {})\n scope 'default'\n get('schedule/appointmenttypes/', params)\n end",
"def index\n @day_types = DayType.all\n end",
"def show\n @daytype = Daytype.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @daytype }\n end\n end",
"def set_date_type\n @date_type = DateType.find(params[:id])\n end",
"def index\n @calendar_types = CalendarType.all\n end",
"def index\n @os_types = OsType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @os_types, except: [:desc, :created_at, :updated_at] } \n end\n end",
"def index\n @event_types = EventType.sorted\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @event_types }\n end\n end",
"def dates(options = {})\n response= handle_errors{ self.class.get('/dates', :query => options)}\n response[\"dates\"][\"date\"].collect{|i| Rubycious::PostDate.new(i)}\n end",
"def index\n @reserved_dates = ReservedDate.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @reserved_dates }\n end\n end",
"def index\n @entry_types = EntryType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @entry_types }\n end\n end",
"def index\n @event_types = EventType.all\n respond_with @event_types\n end",
"def index\n # @properties = Property.all('date') ## Who put this in? What is ('date') intended to do ?\n @properties = Property.all\n respond_to do |format|\n format.html {} # do nothing - this is the default. display as normal html\n format.json {render :json => @properties}\n end\n end",
"def index\n @agendaitemtypes = Agendaitemtype.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @agendaitemtypes }\n end\n end",
"def index\n @types = Type.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @types.lookup(params[:q]) }\n end\n end",
"def index\n @timerecord_types = TimerecordType.paginate(:page => params[:page], :per_page => per_page).order('id')\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @timerecord_types }\n end\n end",
"def index\n @discipline_types = DisciplineType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @discipline_types }\n end\n end",
"def types\n @client.make_request :get, reports_path\n end",
"def index\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @resource_types }\n end\n end",
"def index\n @crate_types = CrateType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @crate_types }\n end\n end",
"def index\n @observation_types = ObservationType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @observation_types }\n end\n end",
"def types\n if @@types.nil? || (@@last_type_check + (4 * 60 * 60)) < Time.now\n @@last_type_check = Time.now\n @@types = _make_request(:types)['results']\n end\n @@types\n end",
"def index\n @event_types = EventType.all.sort { |p1, p2| p1.name <=> p2.name }\n\n respond_to do |format|\n format.json { render json: @event_types }\n format.xml { render xml: @event_types.to_xml({ include: :categories }) }\n end\n end",
"def index\n @language_types = LanguageType.all\n\n render json: @language_types\n end",
"def show\n @event_types = EventType.find(params[:id])\n respond_with @event_type\n end",
"def subtype\n self.datetime_type\n end",
"def parse_datetime_date(type, resource)\n year = resource[\"#{type}(1i)\"].to_i\n month = resource[\"#{type}(2i)\"].to_i\n day = resource[\"#{type}(3i)\"].to_i\n hour = resource[\"#{type}(4i)\"].to_i\n minute = resource[\"#{type}(5i)\"].to_i\n DateTime.new(year, month, day, hour, minute)\n end",
"def index\n respond_to do |format|\n format.html\n format.json {\n\n render :json => TimeOff.joins('LEFT OUTER JOIN request_types ON time_offs.request_type_id = request_types.id')\n .joins('INNER JOIN users ON time_offs.user_id = users.id')\n .select(\n 'time_offs.id,\n time_offs.request_start_date,\n time_offs.request_end_date,\n time_offs.status,\n time_offs.comments,\n users.name as users_name,\n request_types.name as request_type_name') }\n end\n end",
"def index\n # @weekdays = Weekday.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: Oj.dump(@weekdays, mode: :compat) }\n end\n end",
"def new\n @daytype = Daytype.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @daytype }\n end\n end",
"def index\n @api_v1_user_types = Api::V1::UserType.all\n end",
"def get_date\n # Prepare query url.\n _query_builder = config.get_base_uri\n _query_builder << '/response/date'\n _query_url = APIHelper.clean_url _query_builder\n\n # Prepare and execute HttpRequest.\n _request = config.http_client.get(\n _query_url\n )\n _response = execute_request(_request)\n\n # Validate response against endpoint and global error codes.\n return nil if _response.status_code == 404\n validate_response(_response)\n\n # Return appropriate response type.\n Date.iso8601(_response.raw_body)\n end",
"def index\n @allocation_dates = AllocationDate.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @allocation_dates }\n end\n end",
"def index\n @military_document_types = MilitaryDocumentType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @military_document_types }\n end\n end",
"def type_literal_generic_date(column)\n :date\n end",
"def date_type_params\n params.require(:date_type).permit(:name, :plainformat, :senml)\n end",
"def index\n if params[:date]\n redirect_date(params[:date])\n else\n @school_days = SchoolDay.all\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @school_days }\n end\n end\n end",
"def types\n types = Question.distinct.pluck(:type)\n render json: types.to_a\n end",
"def get_date_array\n # Prepare query url.\n _query_builder = config.get_base_uri\n _query_builder << '/response/date'\n _query_builder = APIHelper.append_url_with_query_parameters(\n _query_builder,\n 'array' => true\n )\n _query_url = APIHelper.clean_url _query_builder\n\n # Prepare headers.\n _headers = {\n 'accept' => 'application/json'\n }\n\n # Prepare and execute HttpRequest.\n _request = config.http_client.get(\n _query_url,\n headers: _headers\n )\n _response = execute_request(_request)\n\n # Validate response against endpoint and global error codes.\n return nil if _response.status_code == 404\n validate_response(_response)\n\n # Return appropriate response type.\n decoded = APIHelper.json_deserialize(_response.raw_body)\n decoded.map { |element| Date.iso8601(element) }\n end",
"def show\n @api_v1_user_types = Api::V1::UserType.all\n end",
"def index\n @day_weeks = DayWeek.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @day_weeks }\n end\n end",
"def create\n @date_type = DateType.new(date_type_params)\n\n respond_to do |format|\n if @date_type.save\n format.html { redirect_to @date_type, notice: 'Date type was successfully created.' }\n format.json { render :show, status: :created, location: @date_type }\n else\n format.html { render :new }\n format.json { render json: @date_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def show\n @holidaytype = Holidaytype.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @holidaytype }\n end\n end",
"def dayIndex\n render json: Restaurant.restaurantsDay\n end",
"def index\n @log_types = LogType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @log_types }\n end\n end",
"def index\n @dept_types = DeptType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @dept_types }\n end\n end",
"def show\n @agenda_type = AgendaType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @agenda_type }\n end\n end",
"def index\n @event_types = EventType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render xml: @event_types }\n end\n end",
"def appointment_type(params = {})\n appointment_type = params.delete :uuid\n\n response =\n default_scope.get(\"schedule/appointmenttypes/#{appointment_type}\") do |request|\n request.params = params\n end\n\n JSON.parse(response.body)\n end",
"def get_lesson_types\n get \"lessonTypes.json\"\n end",
"def show\n @event_type = EventType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event_type }\n end\n end",
"def index\n authorize! :show, PointsEntryType\n load_active_points_entry_types\n\n respond_to do |format|\n format.html\n format.json { render json: @points_entry_types }\n end\n end",
"def show\n @calendar_date = CalendarDate.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @calendar_date }\n end\n end",
"def index\n @act_types = ActType.order(:name).page(params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @act_types }\n end\n end",
"def index\n @techaxis_types = TechaxisType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @techaxis_types }\n end\n end",
"def index\n @sample_types = SampleType.all.sort_by(&:name)\n @first = if @sample_types.any?\n @sample_types[0].name\n else\n 'no sample types'\n end\n\n respond_to do |format|\n format.html { render layout: 'aq2' }\n format.json do\n render json: @sample_types\n .sort { |a, b| a.name <=> b.name }\n .to_json(methods: :field_types)\n end\n end\n end",
"def index\n @type_people = TypePerson.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @type_people }\n end\n end",
"def date_classes\n [Date, defined?(FmRest::StringDate) && FmRest::StringDate].compact.freeze\n end",
"def dates\n end",
"def get_1123_date_time\n # Prepare query url.\n _query_builder = config.get_base_uri\n _query_builder << '/response/1123datetime'\n _query_url = APIHelper.clean_url _query_builder\n\n # Prepare and execute HttpRequest.\n _request = config.http_client.get(\n _query_url\n )\n _response = execute_request(_request)\n\n # Validate response against endpoint and global error codes.\n return nil if _response.status_code == 404\n validate_response(_response)\n\n # Return appropriate response type.\n DateTimeHelper.from_rfc1123(_response.raw_body)\n end",
"def show\n @reserved_date = ReservedDate.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @reserved_date }\n end\n end",
"def index\n @types = Type.all\n end",
"def index\n @admission_types = AdmissionType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @admission_types }\n end\n end",
"def index\n respond_to do |format|\n format.html { @product_types = ProductType.all }\n format.json { @product_types = ProductType.order(:name) }\n end\n end",
"def listing(type, **params)\n params[:t] = params.delete(:time) if params.key?(:time)\n @client.model(:get, \"/user/#{get_attribute(:name)}/#{type}.json\", params)\n end",
"def listing(type, **params)\n params[:t] = params.delete(:time) if params.key?(:time)\n @client.model(:get, \"/user/#{get_attribute(:name)}/#{type}.json\", params)\n end",
"def index\n @publication_types = PublicationType.find(:all, :conditions => {:client_id => session[:client_id]})\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @publication_types }\n end\n end",
"def index\n @typegroups = Typegroup.all\n respond_to do |format|\n format.html\n format.json { render json: @typegroups }\n end\n end",
"def index\n @realty_types = RealtyType.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @realty_types }\n end\n end",
"def index\n @bike_types = BikeType.all.order(\"updated_at DESC\").order(\"created_at DESC\")\n\n render json: @bike_types #each_serializer: Web::V1::BikeTypeSerializer\n end",
"def index \n respond_to do |format|\n format.html # index.html.erb\n format.json { \n asset_types = AssetType.all\n render json: asset_types \n }\n end\n end",
"def getMetadatatypes\n \n @queryparams = params\n \n # Get all metadatatypes\n @results = MetadataType.find(:all, :order => \"updated_at ASC\" )\n \n if params[:format] && params[:format]== \"json\" || params[:format] == \"yaml\"\n @yaml_results = {}\n @results.each do |result|\n @yaml_results.merge!({result.name => result.value_type})\n end\n \n end\n \n # host parameter, needed when creating atom-feed\n if request.ssl?\n @host = \"https://#{request.host}\"\n else\n @host = \"http://#{request.host}\"\n end\n\n if request.port != nil and request.port != 80\n @host += \":#{request.port}\"\n end \n \n # Create atom feed\n @host = @@http_host\n respond_to do |format|\n if @queryparams[:format] == nil\n format.html {render :getmetadatatypes, :layout=>true }\n else\n format.html {render :getmetadatatypes, :layout=>true }\n format.atom {render :getmetadatatypes, :layout=>false }\n format.yaml {render :text => YAML.dump(@yaml_results), :layout=>false }\n format.json {render :text => JSON.dump(@yaml_results), :layout=>false }\n end\n end\n end",
"def get_1123_date_time_array\n # Prepare query url.\n _query_builder = config.get_base_uri\n _query_builder << '/response/1123datetime'\n _query_builder = APIHelper.append_url_with_query_parameters(\n _query_builder,\n 'array' => true\n )\n _query_url = APIHelper.clean_url _query_builder\n\n # Prepare headers.\n _headers = {\n 'accept' => 'application/json'\n }\n\n # Prepare and execute HttpRequest.\n _request = config.http_client.get(\n _query_url,\n headers: _headers\n )\n _response = execute_request(_request)\n\n # Validate response against endpoint and global error codes.\n return nil if _response.status_code == 404\n validate_response(_response)\n\n # Return appropriate response type.\n decoded = APIHelper.json_deserialize(_response.raw_body)\n decoded.map { |element| DateTimeHelper.from_rfc1123(element) }\n end",
"def index\n @ftypes = Ftype.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ftypes }\n end\n end",
"def index\n @talk_types = TalkType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @talk_types }\n end\n end",
"def type\n @json['type']\n end",
"def index\n @downtime_types = DowntimeType.all.paginate(:page=> params[:page])#.order(nr: :desc)\n end",
"def update\n respond_to do |format|\n if @date_type.update(date_type_params)\n format.html { redirect_to @date_type, notice: 'Date type was successfully updated.' }\n format.json { render :show, status: :ok, location: @date_type }\n else\n format.html { render :edit }\n format.json { render json: @date_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @task_types = TaskType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @task_types }\n end\n end",
"def find_all_fedora_type(params, ftype)\n # ftype should be :collection or :apo (or other symbol if we added more since this was updated)\n date_range_q = get_date_solr_query(params)\n solrparams = {\n :q => \"#{Type_Field}:\\\"#{Fedora_Types[ftype]}\\\" #{date_range_q}\",\n :wt => :json,\n :fl => @@field_return_list\n }\n get_rows(solrparams, params)\n response = run_solr_query(solrparams)\n determine_proper_response(params, response)\n end",
"def index\n @vehicle_types = VehicleType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @vehicle_types }\n end\n end",
"def by_date\n respond_to do |format| \n format.html {}\n format.json do\n day = Day.where(date: params[:date]).first \n @movements = Movement.permitted_for_user(@current_user).where(day_id: day.id) if day\n # @movements = Movement.where(day_id: day.id) if day\n\n end\n end\n \n end",
"def index\n @task_types = @project.task_types\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @task_types }\n end\n end",
"def index\n @az_simple_data_types = AzSimpleDataType.all\n @title = 'Простые типы данных'\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @az_simple_data_types }\n end\n end",
"def show\n @all_type=Api::V1::AdminType.all\n render json: @all_type\n end",
"def opportunity_date_ini_type_select\n [\n ['Indefinida', Opportunity::TYPE_UNDEFINED],\n ['Lo antes posible', Opportunity::TYPE_AS_SOON_AS_POSSIBLE],\n ['Fijar fecha', Opportunity::TYPE_SET_DATE_INI]\n ]\n end",
"def index\n @tour_dates = TourDate.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @tour_dates }\n end\n end",
"def index\n types = @user.tried_beer_ratings.last.beer_types.map do |type|\n {name: type.name, description: type.beg_description}\n end\n render json: types\n end",
"def index\n @event_types = EventType.paginate(page: params[:page])\n end",
"def index\n @format_types = FormatType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @format_types }\n end\n end",
"def type\n 'Edm.DateTime'\n end",
"def coercible_types(type1, type2)\n if DATE_TYPES.include?(type1) && DATE_TYPES.include?(type2)\n DATE_TYPES.first\n elsif NUMBER_TYPES.include?(type1) && NUMBER_TYPES.include?(type2)\n NUMBER_TYPES.first\n else\n nil\n end\n end",
"def show\n @agendaitemtype = Agendaitemtype.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @agendaitemtype }\n end\n end",
"def index\n @special_needs_types = SpecialNeedsType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @special_needs_types }\n end\n end",
"def index\n @recipe_types = RecipeType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @recipe_types }\n end\n end",
"def index\n @orientations = Orientation.all\n @orientation_by_date = @orientations.group_by(&:class_date)\n @date = params[:date] ? Date.parse(params[:date]) : Date.today\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @orientations }\n end\n end",
"def show\n respond_to do |format|\n format.html \n # format.json { render json: @day_availability }\n end\n end",
"def index\n @date_requests = DateRequest.all\n end",
"def index\n @stories = Story.where(date: Issue.last.date, summitted: true).all\n @stories = Story.where(date: Issue.last.date).all\n # @ko_date = Issue.last.pages.first.korean_date_string\n @ko_date = Issue.last.korean_date_string\n respond_to do |format|\n format.html\n format.json { render json: StoryDatatable.new(params) }\n end\n end",
"def index\n @product_types = ProductType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @product_types }\n end\n end",
"def index\n @run_types = RunType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @run_types }\n end\n end"
] | [
"0.71094894",
"0.6316097",
"0.6144529",
"0.60725075",
"0.6045335",
"0.58933055",
"0.5879858",
"0.5834459",
"0.58333653",
"0.5807335",
"0.5768128",
"0.57291234",
"0.5724598",
"0.57200366",
"0.5688002",
"0.5673136",
"0.5666195",
"0.56491745",
"0.5648382",
"0.564753",
"0.56443727",
"0.56390244",
"0.56380385",
"0.5625078",
"0.56127584",
"0.56121993",
"0.5575518",
"0.55682385",
"0.55545527",
"0.5548883",
"0.55230194",
"0.55181307",
"0.5513584",
"0.550317",
"0.5498367",
"0.54982615",
"0.5485235",
"0.5478866",
"0.5462239",
"0.5450383",
"0.54409724",
"0.54275274",
"0.5403988",
"0.5386111",
"0.538262",
"0.5378177",
"0.53720003",
"0.53687775",
"0.5364838",
"0.53636956",
"0.53583",
"0.5349752",
"0.5345994",
"0.5336443",
"0.5332577",
"0.53276557",
"0.5326187",
"0.53179866",
"0.5315046",
"0.5314949",
"0.53149235",
"0.5312091",
"0.5307781",
"0.5304781",
"0.5302336",
"0.5302336",
"0.5298566",
"0.5298413",
"0.52965903",
"0.52909887",
"0.5288487",
"0.5288162",
"0.5287806",
"0.5286468",
"0.5284176",
"0.52810746",
"0.5278878",
"0.52752346",
"0.5269933",
"0.5268661",
"0.5262057",
"0.52614427",
"0.5260043",
"0.5257336",
"0.525643",
"0.5253213",
"0.52512765",
"0.5250925",
"0.52484334",
"0.5239306",
"0.52368337",
"0.5236102",
"0.52356535",
"0.5233752",
"0.52278936",
"0.5226948",
"0.52233404",
"0.5223293",
"0.5218981",
"0.5211253",
"0.5210928"
] | 0.0 | -1 |
POST /date_types POST /date_types.json | def create
@date_type = DateType.new(date_type_params)
respond_to do |format|
if @date_type.save
format.html { redirect_to @date_type, notice: 'Date type was successfully created.' }
format.json { render :show, status: :created, location: @date_type }
else
format.html { render :new }
format.json { render json: @date_type.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def date_type_params\n params.require(:date_type).permit(:name, :plainformat, :senml)\n end",
"def day_type_params\n params.require(:day_type).permit(:regular, :date_created, :user_id)\n end",
"def index\n @date_types = DateType.all\n end",
"def set_date_type\n @date_type = DateType.find(params[:id])\n end",
"def create\n @day_type = DayType.new(day_type_params)\n\n respond_to do |format|\n if @day_type.save\n format.html { redirect_to @day_type, notice: 'Day type was successfully created.' }\n format.json { render :show, status: :created, location: @day_type }\n else\n format.html { render :new }\n format.json { render json: @day_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def exception_date_params\n params.require(:exception_date).permit(:name, :dates=>[])\n end",
"def create\n @daytype = Daytype.new(params[:daytype])\n\n respond_to do |format|\n if @daytype.save\n format.html { redirect_to @daytype, notice: 'Daytype was successfully created.' }\n format.json { render json: @daytype, status: :created, location: @daytype }\n else\n format.html { render action: \"new\" }\n format.json { render json: @daytype.errors, status: :unprocessable_entity }\n end\n end\n end",
"def evals_types\n call_path = \"evals/types\"\n data = build_post_data(\"\")\n perform_post(build_url(call_path), data)\n end",
"def appointment_types(params = {})\n scope 'default'\n get('schedule/appointmenttypes/', params)\n end",
"def update\n respond_to do |format|\n if @date_type.update(date_type_params)\n format.html { redirect_to @date_type, notice: 'Date type was successfully updated.' }\n format.json { render :show, status: :ok, location: @date_type }\n else\n format.html { render :edit }\n format.json { render json: @date_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def validate_date_attribute(date_type)\n value = send(\"#{date_type}_before_type_cast\")\n self[date_type] = value.is_a?(Date) || value.is_a?(Time) ? value : Time.zone.parse(value)\n if self[date_type].nil?\n errors.add(date_type, I18n.t('error.invalid_date', key: date_type.capitalize))\n end\n rescue ArgumentError, TypeError\n errors.add(date_type, I18n.t('error.invalid_date', key: date_type.capitalize))\n end",
"def calendar_date_params\n params.require(:calendar_date).permit(:service_identifier, :date, :exception_type)\n end",
"def dates(options = {})\n response= handle_errors{ self.class.get('/dates', :query => options)}\n response[\"dates\"][\"date\"].collect{|i| Rubycious::PostDate.new(i)}\n end",
"def postulation_date_params\n params.require(:postulation_date).permit(:name, :date_begin, :date_end, :user_type, :postulation_standard_id, :state, :region_id)\n end",
"def parse_datetime_date(type, resource)\n year = resource[\"#{type}(1i)\"].to_i\n month = resource[\"#{type}(2i)\"].to_i\n day = resource[\"#{type}(3i)\"].to_i\n hour = resource[\"#{type}(4i)\"].to_i\n minute = resource[\"#{type}(5i)\"].to_i\n DateTime.new(year, month, day, hour, minute)\n end",
"def user_date_params\n params.require(:user_date).permit(:user_id, :course_id, :date, :title, :kind, :relevant, :ressource_id_from_provider)\n end",
"def day_params\n params.require(:day).permit(:date)\n end",
"def datetime_params\n []\n end",
"def create_types\n\t[]\nend",
"def create_types\n\t[]\nend",
"def destroy\n @date_type.destroy\n respond_to do |format|\n format.html { redirect_to date_types_url, notice: 'Date type was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def create\n @downtime_type = DowntimeType.new(downtime_type_params)\n\n respond_to do |format|\n if @downtime_type.save\n format.html { redirect_to downtime_types_url, notice: '成功添加.' }\n format.json { render :show, status: :created, location: @downtime_type }\n else\n format.html { render :new }\n format.json { render json: @downtime_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def due_date_params\n params.require(:due_date).permit(\n :name, :description, :start, { :tags => [] },\n :day_of_month, :day_of_week, :frequency\n )\n end",
"def type_literal_generic_date(column)\n :date\n end",
"def e_date_params\n params.require(:e_date).permit(:pos_date)\n end",
"def create\n @agenda_type = AgendaType.new(params[:agenda_type])\n\n respond_to do |format|\n if @agenda_type.save\n format.html { redirect_to @agenda_type, :notice => 'Agenda type was successfully created.' }\n format.json { render :json => @agenda_type, :status => :created, :location => @agenda_type }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @agenda_type.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create_types\n\t\t[]\n\tend",
"def create_types\n\t\t[]\n\tend",
"def test_date_params\n params.require(:test_date).permit(:date, :deadline, :testing_id)\n end",
"def departuretype_params\n params.require(:departuretype).permit(:departureTypes)\n end",
"def event_date_params\n params.require(:event_date).permit(:date, :event_id)\n end",
"def calendar_type_params\n params.require(:calendar_type).permit(:name, :image)\n end",
"def subtype\n self.datetime_type\n end",
"def visit_date_time(binding_type)\n self.result = binding_type.to_ruby(input)\n end",
"def stringify_date(date, month_type, type = T.unsafe(nil), style = T.unsafe(nil)); end",
"def reports_tasks_project\n @initial_date = Date.strptime(params[:initial_date], \"%m/%d/%Y\")\n @final_date = Date.strptime(params[:final_date], \"%m/%d/%Y\")\n \n respond_to do |format|\n format.json\n end\n end",
"def add_dummy_type\n params[:data] ||= {}\n params[:data][:type] = resource_klass._type.to_s\n end",
"def day_params\n params.permit(:fulldate, :year, :month, :date)\n end",
"def dates\n end",
"def opportunity_date_ini_type_select\n [\n ['Indefinida', Opportunity::TYPE_UNDEFINED],\n ['Lo antes posible', Opportunity::TYPE_AS_SOON_AS_POSSIBLE],\n ['Fijar fecha', Opportunity::TYPE_SET_DATE_INI]\n ]\n end",
"def create_types\n @types.each do |type|\n create_type(type) unless Type.where(name: type['name']).first\n end\n end",
"def res_date_params\n params.require(:res_date).permit(:res_date)\n end",
"def test_send_rfc3339_date_time_array()\n # Parameters for the API call\n datetimes = APIHelper.json_deserialize(\n '[\"1994-02-13T14:01:54.9571247Z\",\"1994-02-13T14:01:54.9571247Z\"]'\n ).map { |element| DateTimeHelper.from_rfc3339(element) }\n\n # Perform the API call through the SDK function\n result = @controller.send_rfc3339_date_time_array(datetimes)\n\n # Test response code\n assert_equal(200, @response_catcher.response.status_code)\n\n # Test whether the captured response is as we expected\n refute_nil(result)\n expected_body = JSON.parse(\n '{\"passed\":true}'\n )\n received_body = JSON.parse(@response_catcher.response.raw_body)\n assert(TestHelper.match_body(expected_body, received_body, check_values: true))\n end",
"def test_send_rfc3339_date_time_array()\n # Parameters for the API call\n datetimes = APIHelper.json_deserialize(\n '[\"1994-02-13T14:01:54.9571247Z\",\"1994-02-13T14:01:54.9571247Z\"]'\n ).map { |element| DateTimeHelper.from_rfc3339(element) }\n\n # Perform the API call through the SDK function\n result = @controller.send_rfc3339_date_time_array(datetimes)\n\n # Test response code\n assert_equal(200, @response_catcher.response.status_code)\n\n # Test whether the captured response is as we expected\n refute_nil(result)\n expected_body = JSON.parse(\n '{\"passed\":true}'\n )\n received_body = JSON.parse(@response_catcher.response.raw_body)\n assert(TestHelper.match_body(expected_body, received_body, check_values: true))\n end",
"def test_send_date_array()\n # Parameters for the API call\n dates = APIHelper.json_deserialize(\n '[\"1994-02-13\",\"1994-02-13\"]'\n ).map { |element| Date.iso8601(element) }\n\n # Perform the API call through the SDK function\n result = @controller.send_date_array(dates)\n\n # Test response code\n assert_equal(200, @response_catcher.response.status_code)\n\n # Test whether the captured response is as we expected\n refute_nil(result)\n expected_body = JSON.parse(\n '{\"passed\":true}'\n )\n received_body = JSON.parse(@response_catcher.response.raw_body)\n assert(TestHelper.match_body(expected_body, received_body, check_values: true))\n end",
"def test_send_date_array()\n # Parameters for the API call\n dates = APIHelper.json_deserialize(\n '[\"1994-02-13\",\"1994-02-13\"]'\n ).map { |element| Date.iso8601(element) }\n\n # Perform the API call through the SDK function\n result = @controller.send_date_array(dates)\n\n # Test response code\n assert_equal(200, @response_catcher.response.status_code)\n\n # Test whether the captured response is as we expected\n refute_nil(result)\n expected_body = JSON.parse(\n '{\"passed\":true}'\n )\n received_body = JSON.parse(@response_catcher.response.raw_body)\n assert(TestHelper.match_body(expected_body, received_body, check_values: true))\n end",
"def is_date(*keys)\n keys.each do |key|\n matches(key, FORMATS[:date], \"#{key} must be a date in the form MM/DD/YYYY\")\n end\n end",
"def dated_resource_params\n params.require(:dated_resource).permit(:date, :name)\n end",
"def create\n @date_request = DateRequest.new(date_request_params)\n\n respond_to do |format|\n if @date_request.save\n format.html { redirect_to @date_request, notice: \"Date request was successfully created.\" }\n format.json { render :show, status: :created, location: @date_request }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @date_request.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @test_date = TestDate.new(test_date_params)\n\n respond_to do |format|\n if @test_date.save\n format.html { redirect_to @test_date, notice: 'Test date was successfully created.' }\n format.json { render :show, status: :created, location: @test_date }\n else\n format.html { render :new }\n format.json { render json: @test_date.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n if logged_out?\n redirect_to need_account_path\n end\n @convention = Convention.new(convention_params)\n @convention.user = current_user\n\n respond_to do |format|\n convert_dates\n if @convention.save\n format.html { redirect_to new_map_path(convention_id: @convention.id), notice: 'Convention was successfully created.' }\n format.json { render :quickview, status: :created, location: @convention }\n else\n @allTypes = Type.all\n format.html { render :new }\n format.json { render json: @convention.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @type = Type.new(type_params)\n\n unless @type.save\n render json: @type.errors, status: :unprocessable_entity\n end\n \n end",
"def dates\n # only convert fields whose name is date* or *_date*\n # lots of other things might be 8 digits, and we have to exclude eg 'candidate'\n t.convert :field => /(^|_)date/ do |value|\n unless value.nil?\n Date.parse(value) rescue value\n end\n end\n end",
"def day_params\n params.require(:day).permit(:date, :title, :status, :note)\n end",
"def weather_test_params\n params.require(:weather_test).permit(:date_a)\n end",
"def type_params\n params.from_jsonapi.require(:type).permit(:name)\n end",
"def downtime_type_params\n params.require(:downtime_type).permit(:nr, :name, :description)\n end",
"def event_date_params\n\t params.require(:event_date).permit(:event_id, :event_date)\n\tend",
"def date?\n type == \"DATE\"\n end",
"def dates(opts)\n if opts.is_a?(Hash)\n opts = { :datetype => 'pdate' }.merge(opts)\n @params.merge!(opts) \n end\n self\n end",
"def create\n @event = Event.new(params[:event])\n @client = Client.find(params[:event][:client_id])\n @event_type = EventType.find(params[:selected])\n if @event_type.node == false\n @event.event_type_id = params[:selected]\n end\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'Ereignis wurde erfolgreich angelegt' }\n format.json { render json: @event, status: :created, location: @event }\n else\n @root = EventType.find(2)\n\n #sämtliche EventTypen die dem Klienten zur Auswahl stehen\n @event_type_amount = Array.new\n @client.event_types.each do |node|\n node.descendants.each do |descendant|\n @event_type_amount << descendant\n end\n node.ancestors.each do |ancestor|\n @event_type_amount << ancestor\n end\n @event_type_amount << node\n end\n @event_type_amount = @event_type_amount.uniq\n format.html { render action: \"new\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def travel_date_params\n # params.fetch(:travel_date, {:date})\n params.require(:travel_date).permit(:date)\n end",
"def types(types); end",
"def parse_and_validate_date_if_necessary(value, type)\n # note: cannot use 'case type' as that expands to === which checks for instances of rather than type equality\n if type == Date\n expect(value).to match(/^\\d{4}-\\d{2}-\\d{2}$/)\n Date.strptime(value, \"%Y-%m-%d\")\n elsif type == DateTime\n expect(value).to match(/^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}Z$/)\n DateTime.strptime(value, \"%Y-%m-%dT%H:%M:%SZ\")\n else\n value\n end\n end",
"def create\n date_format = \"#{appointment_params[\"date(1i)\"]}-#{appointment_params[\"date(2i)\"]}-#{appointment_params[\"date(3i)\"]}\"\n @appointment = Appointment.new(type_appointment_id: appointment_params[:type_appointment_id], description: appointment_params[:description], date: date_format,\n user_id: appointment_params[:user_id], estate_id: appointment_params[:estate_id], doctor_id: appointment_params[:doctor_id])\n \n respond_to do |format|\n if @appointment.save\n format.html { redirect_to @appointment, notice: 'Appointment was successfully created.' }\n format.json { render :show, status: :created, location: @appointment }\n else\n format.html { render :new }\n format.json { render json: @appointment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @day_types = DayType.all\n end",
"def new\n @daytype = Daytype.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @daytype }\n end\n end",
"def visit_date_time(binding_type)\n dt_str = DateTimeConverter.convert_from_datetime(input)\n self.result = binding_type.definition.new_value(dt_str)\n end",
"def service_date_params\n params.require(:service_date).permit(:fecha_servicio, :emitida, :aplicada)\n end",
"def create\n @observation_type = ObservationType.new(params[:observation_type])\n\n respond_to do |format|\n if @observation_type.save\n format.html { redirect_to @observation_type, notice: 'Observation type was successfully created.' }\n format.json { render json: @observation_type, status: :created, location: @observation_type }\n else\n format.html { render action: \"new\" }\n format.json { render json: @observation_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @data_point = DataPoint.new data_point_params\n @data_point[:_type] = data_point_params[:type]\n\n if @data_point.save\n render json: @data_point, status: :created, location: @data_point\n else\n render json: @data_point.errors, status: :unprocessable_entity\n end\n end",
"def create\n @survey_data_type = SurveyDataType.new(survey_data_type_params)\n\n respond_to do |format|\n if @survey_data_type.save\n format.html { redirect_to @survey_data_type, notice: 'Survey data type was successfully created.' }\n format.json { render :show, status: :created, location: @survey_data_type }\n else\n format.html { render :new }\n format.json { render json: @survey_data_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def accepts_outcome_date?\n accepted_outcome_types.member?('date')\n end",
"def fill_classes_for_date(branch_ids = @my_ys, selected_date = Date.today, class_sel = 'VINYASA YOGA', sched_type_ids = 'Group Exercise Schedule', page_no = 0)\n post(URI(BASE_URL + 'fillclassesForDate'),\n {sched_type_ids: sched_type_ids,\n branch_ids: branch_ids.join(','),\n selectedDate: selected_date.strftime('%Y-%m-%d'),\n classSel: class_sel,\n page_no: page_no})\n end",
"def trip_date_params\n params.require(:trip_date).permit(:start_date, :end_date)\n end",
"def create\n @holidaytype = Holidaytype.new(params[:holidaytype])\n\n respond_to do |format|\n if @holidaytype.save\n format.html { redirect_to @holidaytype, notice: 'Holidaytype was successfully created.' }\n format.json { render json: @holidaytype, status: :created, location: @holidaytype }\n else\n format.html { render action: \"new\" }\n format.json { render json: @holidaytype.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @e_date = EDate.new(e_date_params)\n\n respond_to do |format|\n if @e_date.save\n format.html { redirect_to @e_date, notice: 'E date was successfully created.' }\n format.json { render :show, status: :created, location: @e_date }\n else\n format.html { render :new }\n format.json { render json: @e_date.errors, status: :unprocessable_entity }\n end\n end\n end",
"def cat_date_params\n params.permit(:affectionate)\n end",
"def create\n require 'time'\n str1 = params[:injury][:when]\n if(str1 == '')\n str1 = '01/01/2017'\n end\n params[:injury][:when] = Time.parse(str1).to_i\n\n\n str1 = params[:injury][:datetrain]\n if(str1 != '')\n params[:injury][:datetrain] = Time.parse(str1).to_i\n end\n\n str1 = params[:injury][:datematch]\n if(str1 != '')\n params[:injury][:datematch] = Time.parse(str1).to_i\n end\n\n str1 = params[:injury][:dateperf]\n if(str1 != '')\n params[:injury][:dateperf] = Time.parse(str1).to_i\n end\n\n @injury = Injury.new(injury_params)\n\n\n respond_to do |format|\n if @injury.save\n format.html { redirect_to user_path(@injury.user_id), notice: 'Injury was successfully created.' }\n format.json { render :show, status: :created, location: @injury }\n end\n end\n end",
"def create\n @postulation_date = PostulationDate.new(postulation_date_params)\n\n respond_to do |format|\n if @postulation_date.save\n format.html { redirect_to admin_postulations_path, notice: 'Postulation date was successfully created.' }\n format.json { render :show, status: :created, location: @postulation_date }\n else\n format.html { render :new }\n format.json { render json: @postulation_date.errors, status: :unprocessable_entity }\n end\n end\n end",
"def date_classes\n [Date, defined?(FmRest::StringDate) && FmRest::StringDate].compact.freeze\n end",
"def create\n intervention = Intervention.new(intervention_params)\n intervention.start_date = Time.zone.now.to_date\n if intervention_params[:end_date].present?\n intervention.end_date = Date.parse(intervention_params[:end_date])\n end\n\n if intervention.save\n render json: serialize_intervention(intervention)\n else\n render json: { errors: intervention.errors.full_messages }, status: 422\n end\n end",
"def service_date_params\n params.require(:service_date).permit(:date, :qty_avail, :service_id)\n end",
"def test_send_rfc1123_date_time_array()\n # Parameters for the API call\n datetimes = APIHelper.json_deserialize(\n '[\"Sun, 06 Nov 1994 08:49:37 GMT\",\"Sun, 06 Nov 1994 08:49:37 GMT\"]'\n ).map { |element| DateTimeHelper.from_rfc1123(element) }\n\n # Perform the API call through the SDK function\n result = @controller.send_rfc1123_date_time_array(datetimes)\n\n # Test response code\n assert_equal(200, @response_catcher.response.status_code)\n\n # Test whether the captured response is as we expected\n refute_nil(result)\n expected_body = JSON.parse(\n '{\"passed\":true}'\n )\n received_body = JSON.parse(@response_catcher.response.raw_body)\n assert(TestHelper.match_body(expected_body, received_body, check_values: true))\n end",
"def test_send_rfc1123_date_time_array()\n # Parameters for the API call\n datetimes = APIHelper.json_deserialize(\n '[\"Sun, 06 Nov 1994 08:49:37 GMT\",\"Sun, 06 Nov 1994 08:49:37 GMT\"]'\n ).map { |element| DateTimeHelper.from_rfc1123(element) }\n\n # Perform the API call through the SDK function\n result = @controller.send_rfc1123_date_time_array(datetimes)\n\n # Test response code\n assert_equal(200, @response_catcher.response.status_code)\n\n # Test whether the captured response is as we expected\n refute_nil(result)\n expected_body = JSON.parse(\n '{\"passed\":true}'\n )\n received_body = JSON.parse(@response_catcher.response.raw_body)\n assert(TestHelper.match_body(expected_body, received_body, check_values: true))\n end",
"def new_day_params\n params.require(:new_day).permit!\n end",
"def datebodydatum_params\n params.require(:datebodydatum).permit(\n :date, :weight, :pulse, :bodytemperature, :bloodpressure, :highbloodpressure, :date_search)\n end",
"def create\n @value_type = ValueType.new(params[:value_type])\n\n respond_to do |format|\n if @value_type.save\n format.html { redirect_to @value_type, notice: 'Value type was successfully created.' }\n format.json { render json: @value_type, status: :created, location: @value_type }\n else\n format.html { render action: \"new\" }\n format.json { render json: @value_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @doi_type = DoiType.new(doi_type_params)\n\n respond_to do |format|\n if @doi_type.save\n format.html { \n flash[:notice] = 'El tipo de documento de identidad se creó satisfactoriamente.'\n redirect_to doi_types_path\n }\n format.json { render :show, status: :created, location: @doi_type }\n else\n format.html { render :new }\n format.json { render json: @doi_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @event_types = EventType.all\n respond_with @event_types\n end",
"def create\n @duedate = Duedate.new(params[:duedate])\n @duedate.finalizado = false;\n respond_to do |format|\n if @duedate.save\n format.html { redirect_to duedates_path(), notice: 'Duedate was successfully created.' }\n format.json { render json: @duedate, status: :created, location: @duedate }\n else\n format.html { render action: \"new\" }\n format.json { render json: @duedate.errors, status: :unprocessable_entity }\n end\n end\n end",
"def add_internal_datum\n unless StashEngine::InternalDatum.allows_multiple(params[:data_type])\n render json: { error: params[:data_type] + ' does not allow multiple entries, use set_internal_datum' }.to_json, status: 404\n return\n end\n @datum = StashEngine::InternalDatum.create(data_type: params[:data_type], stash_identifier: @stash_identifier, value: params[:value])\n render json: @datum, status: 200\n end",
"def set_day_type\n @day_type = DayType.find(params[:id])\n end",
"def create\n attendance_params[:checkin] = attendance_params[:checkin].to_time\n attendance_params[:checkout] = attendance_params[:checkout].to_time\n attendance_params[:attendance_date] = attendance_params[:attendance_date].to_date\n\n r = @api.create_attendance(attendance_params)\n respond_to do |format|\n if r.code == 201\n format.html { redirect_to attendances_url, notice: 'Attendance was successfully created.' }\n else\n response = JSON.parse(r.body)\n format.html { redirect_to attendances_url, alert: response['message']}\n end\n end\n end",
"def create\n @due_date = DueDate.new(due_date_params)\n\n respond_to do |format|\n if @due_date.save\n format.html { redirect_to @due_date, notice: 'Due date was successfully created.' }\n format.json { render action: 'show', status: :created, location: @due_date }\n else\n format.html { render action: 'new' }\n format.json { render json: @due_date.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @admin_expense_type = Admin::ExpenseType.new(params[:admin_expense_type])\n\n respond_to do |format|\n if @admin_expense_type.save\n format.html { redirect_to admin_expense_types_url }\n format.json { render json: @admin_expense_type, status: :created, location: @admin_expense_type }\n else\n format.html { render action: \"new\" }\n format.json { render json: @admin_expense_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def report_date_params\n params.require(:report_date).permit(:date)\n end",
"def initialize_to_correct_date_type(field_info, field)\n initialize_integer(field_info, field)\n initialize_float(field_info, field)\n end",
"def encounters_type_params\n params.require(:encounters_type).permit(:name, :description, :creator, :date_created, :retired, :retired_by, :date_retired, :retire_reason, :uuid)\n end",
"def create\n @event_type = EventType.new(event_type_params)\n\n respond_to do |format|\n if @event_type.save\n format.html { \n flash[:success] = t(:event_type_created) \n redirect_to edit_event_type_path(@event_type)\n }\n format.json { render action: 'show', status: :created, location: @event_type }\n else\n format.html { render action: 'new' }\n format.json { render json: @event_type.errors, status: :unprocessable_entity }\n end\n end\n end"
] | [
"0.68476063",
"0.625859",
"0.6105931",
"0.5966543",
"0.5753207",
"0.57398176",
"0.5701953",
"0.5670615",
"0.553455",
"0.55009395",
"0.53920853",
"0.538366",
"0.53686196",
"0.53437",
"0.53318053",
"0.530309",
"0.5285749",
"0.5282978",
"0.52421695",
"0.52421695",
"0.5223831",
"0.52165264",
"0.52047884",
"0.5183503",
"0.5181203",
"0.5169796",
"0.51662844",
"0.51662844",
"0.51553947",
"0.5139944",
"0.51304996",
"0.5117168",
"0.5116227",
"0.5108784",
"0.51082534",
"0.51065505",
"0.5100031",
"0.5091104",
"0.5090059",
"0.5087744",
"0.50855196",
"0.508369",
"0.50782865",
"0.50782865",
"0.507249",
"0.507249",
"0.50722164",
"0.50688416",
"0.50685024",
"0.5053476",
"0.5051399",
"0.5042537",
"0.50347835",
"0.503005",
"0.5020448",
"0.5019558",
"0.50133085",
"0.50128007",
"0.50043255",
"0.50038975",
"0.4997871",
"0.49955437",
"0.49940324",
"0.49931622",
"0.4991581",
"0.49826074",
"0.49803472",
"0.49767977",
"0.49729905",
"0.49522203",
"0.49491024",
"0.49450096",
"0.49411038",
"0.49406245",
"0.49294415",
"0.4929259",
"0.49287763",
"0.4923543",
"0.49051765",
"0.49036208",
"0.490233",
"0.4892484",
"0.48877582",
"0.4885257",
"0.4885257",
"0.48652947",
"0.4864318",
"0.4862079",
"0.48513103",
"0.4849022",
"0.4842593",
"0.48414811",
"0.48381075",
"0.48372203",
"0.48359048",
"0.48321265",
"0.48285145",
"0.48250198",
"0.48248282",
"0.48239246"
] | 0.66282433 | 1 |
PATCH/PUT /date_types/1 PATCH/PUT /date_types/1.json | def update
respond_to do |format|
if @date_type.update(date_type_params)
format.html { redirect_to @date_type, notice: 'Date type was successfully updated.' }
format.json { render :show, status: :ok, location: @date_type }
else
format.html { render :edit }
format.json { render json: @date_type.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_date_type\n @date_type = DateType.find(params[:id])\n end",
"def update!(**args)\n @datetime_type = args[:datetime_type] if args.key?(:datetime_type)\n @relative_datetime_type = args[:relative_datetime_type] if args.key?(:relative_datetime_type)\n end",
"def update\n respond_to do |format|\n if @day_type.update(day_type_params)\n format.html { redirect_to @day_type, notice: 'Day type was successfully updated.' }\n format.json { render :show, status: :ok, location: @day_type }\n else\n format.html { render :edit }\n format.json { render json: @day_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if logged_out?\n redirect_to need_account_path\n end\n\n respond_to do |format|\n convert_dates\n if @convention.update(convention_params)\n format.html { redirect_to @convention, notice: 'Convention was successfully updated.' }\n format.json { render :show, status: :ok, location: @convention }\n else\n @allTypes = Type.all\n format.html { render :edit }\n format.json { render json: @convention.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @data_set_type.update(data_set_type_params)\n format.html { redirect_to @data_set_type, notice: 'Data set type was successfully updated.' }\n format.json { render :show, status: :ok, location: @data_set_type }\n else\n format.html { render :edit }\n format.json { render json: @data_set_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @daytype = Daytype.find(params[:id])\n\n respond_to do |format|\n if @daytype.update_attributes(params[:daytype])\n format.html { redirect_to @daytype, notice: 'Daytype was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @daytype.errors, status: :unprocessable_entity }\n end\n end\n end",
"def change_type\n\t\t\trender json: User.update_type_by_id(params[:id], params[:type], params[:is])\n\t\tend",
"def date_type_params\n params.require(:date_type).permit(:name, :plainformat, :senml)\n end",
"def update\n date_format = \"#{appointment_params[\"date(1i)\"]}-#{appointment_params[\"date(2i)\"]}-#{appointment_params[\"date(3i)\"]}\"\n @appointment = Appointment.new(type_appointment_id: appointment_params[:type_appointment_id], description: appointment_params[:description], date: date_format,\n user_id: appointment_params[:user_id], estate_id: appointment_params[:estate_id], doctor_id: appointment_params[:doctor_id])\n \n respond_to do |format|\n if @appointment.update\n format.html { redirect_to @appointment, notice: 'Appointment was successfully updated.' }\n format.json { render :show, status: :ok, location: @appointment }\n else\n format.html { render :edit }\n format.json { render json: @appointment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @downtime_type.update(downtime_type_params)\n format.html { redirect_to downtime_types_url, notice: '成功更新.' }\n format.json { render :show, status: :ok, location: @downtime_type }\n else\n format.html { render :edit }\n format.json { render json: @downtime_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @important_date.update(important_date_params)\n format.html { redirect_to @important_date, notice: 'Important date was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @important_date.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @intervention_type.update(intervention_type_params)\n format.html { redirect_to intervention_types_path, notice: 'O tipo de intervenção foi actualizado.' }\n format.json { render :show, status: :ok, location: @intervention_type }\n else\n format.html { render :edit }\n format.json { render json: @intervention_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @agenda_type = AgendaType.find(params[:id])\n\n respond_to do |format|\n if @agenda_type.update_attributes(params[:agenda_type])\n format.html { redirect_to @agenda_type, :notice => 'Agenda type was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @agenda_type.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @event_type.update(event_type_params)\n format.html { \n flash[:success] = t(:event_type_updated) \n redirect_to edit_event_type_path(@event_type) \n }\n \n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @event_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @event_type.update(event_type_params)\n format.html { redirect_to @event_type, notice: 'Event Type was successfully updated.' }\n format.json { render :show, status: :ok, location: @event_type }\n else\n format.html { render :edit }\n format.json { render json: @event_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @type_of_value.update(type_of_value_params)\n format.html { redirect_to @type_of_value, notice: 'Type of value was successfully updated.' }\n format.json { render :show, status: :ok, location: @type_of_value }\n else\n format.html { render :edit }\n format.json { render json: @type_of_value.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @type.update(type_params)\n end",
"def update\n respond_to do |format|\n if @date_request.update(date_request_params)\n format.html { redirect_to @date_request, notice: \"Date request was successfully updated.\" }\n format.json { render :show, status: :ok, location: @date_request }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @date_request.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @value_type = ValueType.find(params[:id])\n\n respond_to do |format|\n if @value_type.update_attributes(params[:value_type])\n format.html { redirect_to @value_type, notice: 'Value type was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @value_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @eventtype.update(eventtype_params)\n format.html { redirect_to @eventtype, notice: 'Eventtype was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @eventtype.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_question_type\n form_params = params.require(:form).permit(:question_id, :question_type)\n\n render json: Question.update_question_type(form_params)\n end",
"def update\n respond_to do |format|\n if @novelty_type.update(novelty_type_params)\n format.html { redirect_to @novelty_type, notice: 'Novelty type was successfully updated.' }\n format.json { render :show, status: :ok, location: @novelty_type }\n else\n format.html { render :edit }\n format.json { render json: @novelty_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @api_v1_user_type.update(api_v1_user_type_params)\n format.html { redirect_to @api_v1_user_type, notice: 'User type was successfully updated.' }\n format.json { render :show, status: :ok, location: @api_v1_user_type }\n else\n format.html { render :edit }\n format.json { render json: @api_v1_user_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @e_date.update(e_date_params)\n format.html { redirect_to @e_date, notice: 'E date was successfully updated.' }\n format.json { render :show, status: :ok, location: @e_date }\n else\n format.html { render :edit }\n format.json { render json: @e_date.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @entry_type = EntryType.find(params[:id])\n\n respond_to do |format|\n field_type_ids = params[:entry_type].delete(\"field_type_ids\")\n @entry_type.field_type_ids = field_type_ids if field_type_ids\n params[:entry_type].delete(\"form_code\")\n if @entry_type.update_attributes(params[:entry_type])\n format.html { redirect_to @entry_type, notice: 'Entry type was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @entry_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @model_type.update(model_type_params)\n format.html { redirect_to @model_type, notice: 'Model type was successfully updated.' }\n format.json { render :show, status: :ok, location: @model_type }\n else\n format.html { render :edit }\n format.json { render json: @model_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @breadcrumb = 'update'\n @contracting_request_document_type = ContractingRequestDocumentType.find(params[:id])\n @contracting_request_document_type.updated_by = current_user.id if !current_user.nil?\n\n respond_to do |format|\n if @contracting_request_document_type.update_attributes(params[:contracting_request_document_type])\n format.html { redirect_to @contracting_request_document_type,\n notice: (crud_notice('updated', @contracting_request_document_type) + \"#{undo_link(@contracting_request_document_type)}\").html_safe }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @contracting_request_document_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @incident_type.update(incident_type_params)\n format.html { redirect_to admin_incident_types_path, notice: 'Incident type was successfully updated.' }\n format.json { render :show, status: :ok, location: @incident_type }\n else\n format.html { render :edit }\n format.json { render json: @incident_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @event_date.update(event_date_params)\n EventDate.admin_edit(@event_date.id)\n format.html { redirect_to '/admin_calendar_global/display' }\n format.json { render :show, status: :ok, location: @event_date }\n else\n format.html { render :edit }\n format.json { render json: @event_date.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @valid_type.update(valid_type_params)\n format.html { redirect_to valid_types_path, notice: 'Entity Type was successfully updated.' }\n format.json { render :show, status: :ok, location: @valid_type }\n else\n format.html { render :edit }\n format.js { render :edit }\n format.json { render json: @valid_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update(type, _objects, _options = {})\n raise UndefinedUpdateStrategy, type\n end",
"def update\n @client_type = ClientType.find(params[:id])\n\n respond_to do |format|\n if @client_type.update_attributes(params[:client_type])\n format.html { redirect_to @client_type, notice: 'Client type was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @client_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @appointment_type.update(appointment_type_params)\n format.js { flash.now[:notice] = \"Appointment type was successfully updated.\" }\n format.html { redirect_to @appointment_type, notice: 'Appointment type was successfully updated.' }\n format.json { render :show, status: :ok, location: @appointment_type }\n else\n format.html { render :edit }\n format.json { render json: @appointment_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @doi_type.update(doi_type_params)\n format.html { \n flash[:notice] = 'El tipo de documento de identidad se actualizó satisfactoriamente.'\n redirect_to doi_types_path\n }\n format.json { render :show, status: :ok, location: @doi_type }\n else\n format.html { render :edit }\n format.json { render json: @doi_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @interview_type.update(interview_type_params)\n format.html { redirect_to @interview_type, notice: 'Interview type was successfully updated.' }\n format.json { render :show, status: :ok, location: @interview_type }\n else\n format.html { render :edit }\n format.json { render json: @interview_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @test_date.update(test_date_params)\n format.html { redirect_to @test_date, notice: 'Test date was successfully updated.' }\n format.json { render :show, status: :ok, location: @test_date }\n else\n format.html { render :edit }\n format.json { render json: @test_date.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @addtype.update(addtype_params)\n format.html { redirect_to @addtype, notice: '变动方式修改成功!' }\n format.json { render :show, status: :ok, location: @addtype }\n else\n format.html { render :edit }\n format.json { render json: @addtype.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @method_type.update(method_type_params)\n format.html { redirect_to @method_type, notice: \"Method type was successfully updated.\" }\n format.json { render :show, status: :ok, location: @method_type }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @method_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @meeting_type.update(meeting_type_params)\n format.html { redirect_to @meeting_type, notice: 'Meeting type was successfully updated.' }\n format.json { render :show, status: :ok, location: @meeting_type }\n else\n format.html { render :edit }\n format.json { render json: @meeting_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_types\n\t[]\nend",
"def update_types\n\t[]\nend",
"def update\n upload\n respond_to do |format|\n if @calendar_type.update(calendar_type_params)\n format.html { redirect_to @calendar_type, notice: 'Calendar type was successfully updated.' }\n else\n @errors=@calendar_type.errors\n format.html { render action: 'edit' }\n end\n end\n end",
"def update\n respond_to do |format|\n if @survey_data_type.update(survey_data_type_params)\n format.html { redirect_to @survey_data_type, notice: 'Survey data type was successfully updated.' }\n format.json { render :show, status: :ok, location: @survey_data_type }\n else\n format.html { render :edit }\n format.json { render json: @survey_data_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @api_v1_admin_type.update(api_v1_admin_type_params)\n format.html { redirect_to @api_v1_admin_type, notice: 'Admin type was successfully updated.' }\n format.json { render :show, status: :ok, location: @api_v1_admin_type }\n else\n format.html { render :edit }\n format.json { render json: @api_v1_admin_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_document_all_types client, s, types\n log.debug \"Will update document #{s} for types #{types}\"\n\n if types\n types.each do |type|\n log.debug \"Updating document #{s} for type #{type}\"\n indexes = Indexes.instance.get_indexes type\n indexes.each do |key, index|\n allowed_groups = index[:allowed_groups]\n log.debug \"Got allowed groups for updated_document_all_types #{allowed_groups}\"\n rdf_type = settings.type_definitions[type][\"rdf_type\"]\n log.debug \"Got RDF type for updated_document_all_types #{rdf_type}\"\n if is_authorized s, rdf_type, allowed_groups\n log.debug \"Our current index knows that #{s} is of type #{rdf_type} based on allowed groups #{allowed_groups}\"\n properties = settings.type_definitions[type][\"properties\"]\n document, attachment_pipeline =\n fetch_document_to_index uri: s, properties: properties,\n allowed_groups: index[:allowed_groups]\n\n document_for_reporting = document.clone\n document_for_reporting[\"data\"] = document_for_reporting[\"data\"] ? document_for_reporting[\"data\"].length : \"none\"\n\n log.debug \"Fetched document to index is #{document_for_reporting}\"\n\n # TODO what is uuid supposed to be here? We abstract its meaning to be get_uuid(s) but are not sure\n uuid = get_uuid(s)\n\n if attachment_pipeline\n log.debug \"Document to update has attachment pipeline\"\n begin\n # client.upload_attachment index, uuid, attachment_pipeline, document\n client.upload_attachment index[:index], uuid, attachment_pipeline, document\n log.debug \"Managed to upload attachment for #{s}\"\n rescue\n log.warn \"Could not upload attachment #{s}\"\n begin\n log.debug \"Trying to update document with id #{uuid}\"\n client.update_document index[:index], uuid, document\n log.debug \"Succeeded in updating document with id #{uuid}\"\n rescue\n log.debug \"Failed to update document, trying to put new document #{uuid}\"\n client.put_document index[:index], uuid, document\n log.debug \"Succeeded in putting new document #{uuid}\"\n end\n end\n else\n begin\n log.debug \"Trying to update document with id #{uuid}\"\n client.update_document index[:index], uuid, document\n log.debug \"Succeeded in updating document with id #{uuid}\"\n rescue\n log.debug \"Failed to update document, trying to put new document #{uuid}\"\n client.put_document index[:index], uuid, document\n log.debug \"Succeeded in putting new document #{uuid}\"\n end\n end\n else\n log.info \"Not Authorized.\"\n end\n end\n end\n end\nend",
"def update\n respond_to do |format|\n if @client_type.update(client_type_params)\n format.html { redirect_to @client_type, notice: 'Tipo de Cliente Atualizado!' }\n format.json { render :show, status: :ok, location: @client_type }\n else\n format.html { render :edit }\n format.json { render json: @client_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @default_task_type.update(default_task_type_params)\n format.html { redirect_to @default_task_type, notice: 'Default task type was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @default_task_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @entry = Entry.find(params[:id])\n \n unless params[:entry][:date].nil?\n params[:entry][:date] = Date.strptime(params[:entry][:date], '%m/%d/%Y')\n end\n\n unless params[:entry][:invoice_date].nil?\n puts \"date submitted\"\n params[:entry][:invoice_date] = Date.strptime(params[:entry][:invoice_date], '%m/%d/%Y')\n \n end\n\n\n\n respond_to do |format|\n if @entry.update_attributes(params[:entry])\n format.html { redirect_to manage_entry_path(@entry), notice: 'Entry was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @entry.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @realty_type = RealtyType.find(params[:id])\n\n respond_to do |format|\n if @realty_type.update_attributes(params[:realty_type])\n format.html { redirect_to @realty_type, notice: 'Realty type was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @realty_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @holidaytype = Holidaytype.find(params[:id])\n\n respond_to do |format|\n if @holidaytype.update_attributes(params[:holidaytype])\n format.html { redirect_to @holidaytype, notice: 'Holidaytype was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @holidaytype.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @recipe_type.update(recipe_type_params)\n format.html { redirect_to @recipe_type, notice: \"Recipe type was successfully updated.\" }\n format.json { render :show, status: :ok, location: @recipe_type }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @recipe_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @issue_type.update(issue_type_params)\n format.html { redirect_to @issue_type, notice: 'Issue type was successfully updated.' }\n format.json { render :show, status: :ok, location: @issue_type }\n else\n format.html { render :edit }\n format.json { render json: @issue_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @doc_type.update(doc_type_params)\n format.html { redirect_to @doc_type, notice: t('message.template.scaffold.update', model: t('activerecord.models.doc_type')) }\n format.json { render :show, status: :ok, location: @doc_type }\n else\n format.html { render :edit }\n format.json { render json: @doc_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @event_date.update(event_date_params)\n format.html { redirect_to [@event, @event_date], notice: \"Event date was successfully updated.\" }\n format.json { render :show, status: :ok, location: @event_date }\n else\n format.html { render :edit }\n format.json { render json: @event_date.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @event_type = EventType.find(params[:id])\n\n respond_to do |format|\n if @event_type.update_attributes(params[:event_type])\n\t\t\t\tmsg = I18n.t('app.msgs.success_updated', :obj => I18n.t('app.common.event_type'))\n\t\t\t\tsend_status_update(I18n.t('app.msgs.cache_cleared', :action => msg))\n format.html { redirect_to admin_event_type_path(@event_type), notice: msg }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @event_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @document_type.update(document_type_params)\n format.html { redirect_to edit_document_type_path(@document_type), notice: 'El tipo de documento ha sido actualizado satisfactoriamente.' }\n format.json { render :edit, status: :ok, location: @document_type }\n else\n format.html { render :edit }\n format.json { render json: @document_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @instance_type.update(instance_type_params)\n format.html { redirect_to @instance_type, notice: 'Instance type was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @instance_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @observation_type = ObservationType.find(params[:id])\n\n respond_to do |format|\n if @observation_type.update_attributes(params[:observation_type])\n format.html { redirect_to @observation_type, notice: 'Observation type was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @observation_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @task_type.update(task_type_params)\n format.html { redirect_to task_types_path, notice: 'Task type was successfully updated.' }\n format.json { render :show, status: :ok, location: @task_type }\n else\n format.html { render :edit }\n format.json { render json: @task_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @reference_type.update_attributes(params[:reference_type])\n flash[:notice] = 'Reference type was successfully updated.'\n @changed << @reference_type.id\n\n format.html { redirect_to reference_types_path }\n format.js { render 'shared/index'; flash.discard }\n format.json { head :no_content }\n else\n @edited << @reference_type.id\n @expanded << @reference_type.id\n\n format.html { render action: 'edit', template: 'shared/edit' }\n format.js { render 'reference_type' }\n format.json { render json: @reference_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n\n raw = params[:sample_type]\n st = SampleType.find(raw[:id])\n\n st.name = raw[:name]\n st.description = raw[:description]\n st.save\n st.save_field_types raw[:field_types]\n\n render json: { sample_type: st }\n\n end",
"def update\n attendance_params[:checkout] = DateTime.parse(attendance_params[:checkout]) if attendance_params[:checkout].present?\n attendance_params[:attendance_date] = attendance_params[:attendance_date].to_date if attendance_params[:attendance_date].present?\n\n r = @api.update_attendance(params[:id], attendance_params)\n respond_to do |format|\n if r.code == 204\n format.html { redirect_to attendances_url, notice: 'Attendance was successfully updated.' }\n else\n response = JSON.parse(r.body)\n format.html { redirect_to attendances_url, alert: response['message']}\n end\n end\n \n end",
"def update\n respond_to do |format|\n if @affected_type.update(affected_type_params)\n format.html { redirect_to @affected_type, notice: 'Affected type was successfully updated.' }\n format.json { render :show, status: :ok, location: @affected_type }\n else\n format.html { render :edit }\n format.json { render json: @affected_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @expense_type.update(expense_type_params)\n format.html { redirect_to @expense_type, notice: 'Expense type was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @expense_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @service_date.update(service_date_params)\n format.html { redirect_to @service_date, notice: 'Service date was successfully updated.' }\n format.json { render :show, status: :ok, location: @service_date }\n else\n format.html { render :edit }\n format.json { render json: @service_date.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_day_type\n @day_type = DayType.find(params[:id])\n end",
"def update_issue_type(project_id_or_key, type_id, params = {})\n patch(\"projects/#{project_id_or_key}/issueTypes/#{type_id}\", params)\n end",
"def update\n respond_to do |format|\n if @acquired_type.update(acquired_type_params)\n format.html { redirect_to @acquired_type, notice: 'Acquired type was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @acquired_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @office_type.update(office_type_params)\n format.html { redirect_to @office_type, notice: 'Office type was successfully updated.' }\n format.json { render :show, status: :ok, location: @office_type }\n else\n format.html { render :edit }\n format.json { render json: @office_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @default_line_calendar.update(default_line_calendar_params)\n format.html { redirect_to @default_line_calendar, notice: 'Default line calendar was successfully updated.' }\n format.json { render :show, status: :ok, location: @default_line_calendar }\n else\n format.html { render :edit }\n format.json { render json: @default_line_calendar.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @spec_type.update(spec_type_params)\n format.html { redirect_to @spec_type, notice: 'Spec type was successfully updated.' }\n format.json { render :show, status: :ok, location: @spec_type }\n else\n format.html { render :edit }\n format.json { render json: @spec_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @designation_type.update(designation_type_params)\n format.html { redirect_to @designation_type, notice: 'Designation type was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @designation_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @defect_type.update(defect_type_params)\n format.html { redirect_to @defect_type, notice: 'Defect type was successfully updated.' }\n format.json { render :show, status: :ok, location: @defect_type }\n else\n format.html { render :edit }\n format.json { render json: @defect_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def day_type_params\n params.require(:day_type).permit(:regular, :date_created, :user_id)\n end",
"def update\n @type_appointment = TypeAppointment.new(type_appointment_params)\n @type_appointment.id = params[:id]\n respond_to do |format|\n if @type_appointment.update\n format.html { redirect_to @type_appointment, notice: 'Type appointment was successfully updated.' }\n format.json { render :show, status: :ok, location: @type_appointment }\n else\n format.html { render :edit }\n format.json { render json: @type_appointment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_types\n\t\t[]\n\tend",
"def update_types\n\t\t[]\n\tend",
"def update!(**args)\n @date_type = args[:date_type] if args.key?(:date_type)\n @end_date = args[:end_date] if args.key?(:end_date)\n @end_time = args[:end_time] if args.key?(:end_time)\n @end_weekday = args[:end_weekday] if args.key?(:end_weekday)\n @raw_text = args[:raw_text] if args.key?(:raw_text)\n @start_date = args[:start_date] if args.key?(:start_date)\n @start_time = args[:start_time] if args.key?(:start_time)\n @start_weekday = args[:start_weekday] if args.key?(:start_weekday)\n @time_type = args[:time_type] if args.key?(:time_type)\n end",
"def update\n @event_type = EventType.find(params[:id])\n\n respond_to do |format|\n if @event_type.update_attributes(event_type_params)\n format.html { redirect_to(@event_type, notice: 'Event type was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render action: \"edit\" }\n format.xml { render xml: @event_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @crate_type = CrateType.find(params[:id])\n\n respond_to do |format|\n if @crate_type.update_attributes(params[:crate_type])\n format.html { redirect_to @crate_type, :notice => 'Crate type was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @crate_type.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @datesetting.update(datesetting_params)\n format.html { redirect_to @datesetting, notice: 'Datesetting was successfully updated.' }\n format.json { render :show, status: :ok, location: @datesetting }\n else\n format.html { render :edit }\n format.json { render json: @datesetting.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @reform_type = ReformType.find(params[:id])\n\n respond_to do |format|\n if @reform_type.update_attributes(params[:reform_type])\n format.html { redirect_to @reform_type, notice: 'Reform type was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @reform_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @jewelry_type = JewelryType.find(params[:id])\n\n respond_to do |format|\n if @jewelry_type.update_attributes(params[:jewelry_type])\n format.html { redirect_to @jewelry_type, notice: 'Jewelry type was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @jewelry_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @calendar = Calendar.find(params[:id])\n params[:calendar][:entry_date] = change_date_format(params[:calendar][:entry_date]) if !(params[:calendar][:entry_date]).blank?\n respond_to do |format|\n if @calendar.update_attributes(params[:calendar])\n format.html { redirect_to calendars_url, notice: 'Calendar was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @calendar.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @employee_type.update(employee_type_params)\n format.html {redirect_to \"/projects/#{@project.id}/employee_types\", notice: 'Employee type was successfully updated.'}\n format.json {render :show, status: :ok, location: @employee_type}\n else\n format.html {render :edit}\n format.json {render json: @employee_type.errors, status: :unprocessable_entity}\n end\n end\n end",
"def update\n #params[:client][:assigned_status_types] ||= [\"1\"=>{\"status_type_id\"}]\n \n @client = Client.find(params[:id])\n\n\t\tnew_types = params[:client][:new_status_type_ids]\n\t\tnew_types ||= []\n\t\t\n\t\tparams[:client].delete :new_status_type_ids\n\n respond_to do |format|\n if @client.update_attributes(params[:client])\n\t\t\t\tnew_types.each do |type_id|\n\t\t\t\t\tstatus = StatusType.find(type_id)\n\t\t\t\t\[email protected]_status_types << AssignedStatusType.new(:start_date => Time.now, :status_type=>status) unless @client.active_status_types.include?(status)\n\t\t\t\tend\n\t\t\t\t\n\t\t\t\[email protected]_status_types.each do |old_status_type|\n\t\t\t\t\tif old_status_type.end_date.nil?\n\t\t\t\t\t\told_status_type.deassign unless new_types.include?(old_status_type.status_type_id.to_s)\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\t\[email protected]\n\t\t\t\t\n flash[:notice] = 'Client was successfully updated.'\n format.html { redirect_to(@client) }\n format.xml { head :ok }\n format.js do\n render :update do |page|\n page.replace_html \"client-element\", :partial=>'/clients/show'\n\t\t\t\t\t\t#replace client header as well\n\t\t\t\t\t\tpage.replace 'client-header', :partial=>'/shared/banner_client'\n end\n end\n else\n\t\t\t\t@errors = @client.errors\n\t\t\t\terror_div = \"client-element-errors\"\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @client.errors, :status => :unprocessable_entity }\n\t\t\t\tformat.js do\n\t\t\t\t\trender :update do |page|\n\t\t\t\t\t\tpage.hide error_div\n\t\t\t\t\t\tpage.replace_html error_div, :partial=>'/shared/errors_index'\n\t\t\t\t\t\tpage.visual_effect :appear, error_div, :duration=>2\n\t\t\t\t\tend\n\t\t\t\tend\n end\n end\n end",
"def update!(**args)\n @supported_types = args[:supported_types] if args.key?(:supported_types)\n end",
"def update\n @collection = @entity_type.collection\n respond_to do |format|\n if @entity_type.update(entity_type_params)\n format.html { redirect_to collection_entity_types_path(@collection), notice: 'The entity type was successfully updated.' }\n format.json { render :show, status: :ok, location: @entity_type }\n else\n format.html { render :edit }\n format.json { render json: @entity_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @os_type.update(os_type_params)\n format.html { redirect_to @os_type, notice: 'Os type was successfully updated.' }\n format.json { render :show, status: :ok, location: @os_type }\n else\n format.html { render :edit }\n format.json { render json: @os_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @travel_date.update(travel_date_params)\n format.html { redirect_to @travel_date, notice: 'Travel date was successfully updated.' }\n format.json { render :show, status: :ok, location: @travel_date }\n else\n format.html { render :edit }\n format.json { render json: @travel_date.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\r\n @meeting_type = MeetingType.find(params[:id])\r\n\r\n respond_to do |format|\r\n if @meeting_type.update_attributes(params[:meeting_type])\r\n format.html { redirect_to @meeting_type, only_path: true, notice: 'Meeting type was successfully updated.' }\r\n format.json { head :no_content }\r\n else\r\n format.html { render action: \"edit\" }\r\n format.json { render json: @meeting_type.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end",
"def update_break_type(id:,\n body:)\n new_api_call_builder\n .request(new_request_builder(HttpMethodEnum::PUT,\n '/v2/labor/break-types/{id}',\n 'default')\n .template_param(new_parameter(id, key: 'id')\n .should_encode(true))\n .header_param(new_parameter('application/json', key: 'Content-Type'))\n .body_param(new_parameter(body))\n .header_param(new_parameter('application/json', key: 'accept'))\n .body_serializer(proc do |param| param.to_json unless param.nil? end)\n .auth(Single.new('global')))\n .response(new_response_handler\n .deserializer(APIHelper.method(:json_deserialize))\n .is_api_response(true)\n .convertor(ApiResponse.method(:create)))\n .execute\n end",
"def update\n @document_type = DocumentType.find(params[:id])\n\n respond_to do |format|\n if @document_type.update_attributes(params[:document_type])\n format.html { redirect_to @document_type, notice: 'Document type was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @document_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n\n # @event.month = @event.date.month.to_int\n # @event.year = @event.date.year.to_int\n respond_to do |format|\n if @event.update(params[:event])\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if @client_type.update(client_type_params)\n render :show, status: :ok, location: @client_type\n else\n render json: @client_type.errors, status: :unprocessable_entity\n end\n end",
"def update\n respond_to do |format|\n if @roof_type.update(roof_type_params)\n format.html { redirect_to roof_types_path, notice: 'Roof type was successfully updated.' }\n format.json { render :show, status: :ok, location: @roof_type }\n else\n format.html { render :edit }\n format.json { render json: @roof_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @calendar_date.update(calendar_date_params)\n format.html { redirect_to @calendar_date, notice: 'Calendar date was successfully updated.' }\n format.json { render :show, status: :ok, location: @calendar_date }\n else\n format.html { render :edit }\n format.json { render json: @calendar_date.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @title_obtaineds = TitleObtained.all\n respond_to do |format|\n if @type_of_meeting.update(type_of_meeting_params.merge(pre_attendance_meetings_attributes: pre_attendance_meeting_params))\n format.html {redirect_to @type_of_meeting, notice: 'Type of meeting was successfully updated.'}\n format.json {render :show, status: :ok, location: @type_of_meeting}\n else\n format.html {render :edit}\n format.json {render json: @type_of_meeting.errors, status: :unprocessable_entity}\n end\n end\n end",
"def update\n @os_type = OsType.find(params[:id])\n\n respond_to do |format|\n if @os_type.update_attributes(params[:os_type])\n format.html { redirect_to @os_type, notice: 'Os type was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @os_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @incident_type = IncidentType.find(params[:id])\n\n respond_to do |format|\n if @incident_type.update_attributes(params[:incident_type])\n format.html { redirect_to @incident_type, notice: 'Incident type was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @incident_type.errors, status: :unprocessable_entity }\n end\n end\n end"
] | [
"0.6116652",
"0.6111879",
"0.6074576",
"0.60144544",
"0.5822412",
"0.581994",
"0.57916695",
"0.57500225",
"0.5743233",
"0.5733215",
"0.57003224",
"0.5675863",
"0.565949",
"0.5617479",
"0.56149954",
"0.5588106",
"0.5571418",
"0.55656815",
"0.55635613",
"0.5543424",
"0.55303806",
"0.55172366",
"0.55151886",
"0.55098265",
"0.55068016",
"0.550195",
"0.5483861",
"0.5479415",
"0.54449105",
"0.5432313",
"0.54304904",
"0.54294074",
"0.5418271",
"0.5394835",
"0.53922665",
"0.53867036",
"0.53852916",
"0.5381516",
"0.5380816",
"0.53789765",
"0.53789765",
"0.5373109",
"0.5366978",
"0.53667104",
"0.5364801",
"0.53613853",
"0.5359906",
"0.53573287",
"0.53546923",
"0.53494537",
"0.53482884",
"0.53437304",
"0.5338392",
"0.5337777",
"0.53375226",
"0.5333148",
"0.5323475",
"0.53136075",
"0.53131443",
"0.53096396",
"0.53088236",
"0.5302789",
"0.5299127",
"0.5298985",
"0.5294717",
"0.5293206",
"0.5290333",
"0.5290301",
"0.5287211",
"0.5285142",
"0.5284663",
"0.52826035",
"0.5279761",
"0.5279474",
"0.5277227",
"0.52754325",
"0.52754325",
"0.5273724",
"0.52710617",
"0.52706",
"0.52636",
"0.5262275",
"0.52615714",
"0.5258644",
"0.5257031",
"0.5255764",
"0.52531713",
"0.52517074",
"0.52498084",
"0.52491057",
"0.52471614",
"0.5245106",
"0.524217",
"0.523984",
"0.5239744",
"0.5239458",
"0.52383626",
"0.52259284",
"0.52257454",
"0.5223084"
] | 0.6957204 | 0 |
DELETE /date_types/1 DELETE /date_types/1.json | def destroy
@date_type.destroy
respond_to do |format|
format.html { redirect_to date_types_url, notice: 'Date type was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @daytype = Daytype.find(params[:id])\n @daytype.destroy\n\n respond_to do |format|\n format.html { redirect_to daytypes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @important_date.destroy\n respond_to do |format|\n format.html { redirect_to important_dates_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @downtime_type.destroy\n respond_to do |format|\n format.html { redirect_to downtime_types_url, notice: '成功删除.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @agenda_type = AgendaType.find(params[:id])\n @agenda_type.destroy\n\n respond_to do |format|\n format.html { redirect_to agenda_types_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @event_date.destroy\n respond_to do |format|\n format.html { redirect_to event_dates_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @client_type = ClientType.find(params[:id])\n @client_type.destroy\n\n respond_to do |format|\n format.html { redirect_to client_types_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @data_set_type.destroy\n respond_to do |format|\n format.html { redirect_to data_set_types_url, notice: 'Data set type was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @type = Type.find(params[:id])\n @type.destroy\n\n respond_to do |format|\n format.html { redirect_to types_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @dash_type = DashType.find(params[:id])\n @dash_type.destroy\n\n respond_to do |format|\n format.html { redirect_to dash_types_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @holidaytype = Holidaytype.find(params[:id])\n @holidaytype.destroy\n\n respond_to do |format|\n format.html { redirect_to holidaytypes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @calendar_type.destroy\n respond_to do |format|\n format.html { redirect_to calendar_types_url }\n end\n end",
"def destroy\n @e_date.destroy\n respond_to do |format|\n format.html { redirect_to e_dates_url, notice: 'E date was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @addtype.destroy\n respond_to do |format|\n format.html { redirect_to addtypes_url, notice: '变动方式删除成功!.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @test_date.destroy\n respond_to do |format|\n format.html { redirect_to test_dates_url, notice: 'Test date was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @datebodydatum.destroy\n respond_to do |format|\n format.html { redirect_to datebodydata_url(:date_search => params[:date_search]) }\n format.json { head :no_content }\n end\n end",
"def destroy\n @type = Type.find(params[:type])\n @type.destroy\n\n respond_to do |format|\n format.html { redirect_to company_types_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @dishtype.destroy\n respond_to do |format|\n format.html { redirect_to dishtypes_url }\n format.json { head :no_content }\n end\n end",
"def delete_data(type, date, format)\n File.delete(\"#{data_directory}/ssdata-#{type}-#{date.strftime('%Y%m')}.#{format}\")\n end",
"def destroy\n @date_request.destroy\n respond_to do |format|\n format.html { redirect_to date_requests_url, notice: \"Date request was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @az_simple_data_type = AzSimpleDataType.find(params[:id])\n @az_simple_data_type.destroy\n\n respond_to do |format|\n format.html { redirect_to(az_simple_data_types_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @client_type.destroy\n respond_to do |format|\n format.html { redirect_to client_types_url, notice: 'Tipo de Cliente deletado.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @disaster_type = DisasterType.find(params[:id])\n @disaster_type.destroy\n\n respond_to do |format|\n format.html { redirect_to disaster_types_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @doi_type.destroy\n respond_to do |format|\n format.html { \n flash[:notice] = 'El tipo de documento de identidad se eliminó satisfactoriamente.'\n redirect_to doi_types_path\n }\n format.json { head :no_content }\n end\n end",
"def destroy\n @due_date.destroy\n respond_to do |format|\n format.html { redirect_to due_dates_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @appointment_type.destroy\n respond_to do |format|\n format.html { redirect_to appointment_types_url, notice: 'Appointment type was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n \n attendance = Attendance.all.where(day_type: @day_type.id)\n attendance.each do |a|\n a.destroy\n end\n\n @day_type.destroy\n respond_to do |format|\n format.html { redirect_to day_types_url, notice: 'Day type was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @diet_type.destroy\n respond_to do |format|\n format.html { redirect_to diet_types_url }\n format.json { head :no_content }\n end\n end",
"def delete_document_all_types client, s, types\n types.each do |type|\n uuid = get_uuid s\n if uuid\n Settings.instance.indexes[type].each do |key, index|\n begin\n client.delete_document index[:index], uuid\n rescue\n log.info \"Failed to delete document: #{uuid} in index: #{index[:index]}\"\n end\n end\n end\n end\nend",
"def destroy\n @datetime.destroy\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 cron_del(type)\n cmd = \"{\\\"id\\\":14,\\\"method\\\":\\\"cron_del\\\",\\\"params\\\":[#{type}]}\\r\\n\"\n request(cmd)\n end",
"def destroy\n @expense_type.destroy\n respond_to do |format|\n format.html { redirect_to expense_types_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @res_date.destroy\n respond_to do |format|\n format.html { redirect_to res_dates_url, notice: 'Res date was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @type_debit.destroy\n respond_to do |format|\n format.html { redirect_to type_debits_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @testtype.destroy\n respond_to do |format|\n format.html { redirect_to testtypes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @observation_type = ObservationType.find(params[:id])\n @observation_type.destroy\n\n respond_to do |format|\n format.html { redirect_to observation_types_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @all_field_type = AllFieldType.find(params[:id])\n @all_field_type.destroy\n\n respond_to do |format|\n format.html { redirect_to all_field_types_url }\n format.json { head :no_content }\n end\n end",
"def delete\n if params[:social_event_type_id]\n socialEventType = SocialEventType.where(id: params[:social_event_type_id]).first\n if socialEventType.delete \n render json: { message: \"deleted successfully.\" } , status: 200\n else \n render json: socialEventType.errors , status: 422\n end\n else\n render json: { message: \"send social event type id.\" } , status: 422 \n end \n end",
"def destroy\n @arc_type.destroy\n respond_to do |format|\n format.html { redirect_to arc_types_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @application_date.destroy\n respond_to do |format|\n format.html { redirect_to application_dates_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @incident_type = IncidentType.find(params[:id])\n @incident_type.destroy\n\n respond_to do |format|\n format.html { redirect_to incident_types_url }\n format.json { head :no_content }\n end\n end",
"def delete_dates(data) \n ['created_at', 'updated_at', 'timestamp', 'location'].each do |key|\n data.delete key if data[key]\n end\n data\nend",
"def destroy\n @designation_type.destroy\n respond_to do |format|\n format.html { redirect_to designation_types_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @datesetting.destroy\n respond_to do |format|\n format.html { redirect_to datesettings_url, notice: 'Datesetting was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @value_type = ValueType.find(params[:id])\n @value_type.destroy\n\n respond_to do |format|\n format.html { redirect_to value_types_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @entry_type = EntryType.find(params[:id])\n @entry_type.destroy\n\n respond_to do |format|\n format.html { redirect_to entry_types_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @api_v1_admin_type.destroy\n respond_to do |format|\n format.html { redirect_to api_v1_admin_types_url, notice: 'Admin type was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @os_type = OsType.find(params[:id])\n @os_type.destroy\n\n respond_to do |format|\n format.html { redirect_to os_types_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @awon_record_type.destroy\n respond_to do |format|\n format.html { redirect_to awon_record_types_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @travel_date.destroy\n respond_to do |format|\n format.html { redirect_to travel_dates_url, notice: 'Travel date was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @api_v1_user_type.destroy\n respond_to do |format|\n format.html { redirect_to api_v1_user_types_url, notice: 'User type was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @affected_type.destroy\n respond_to do |format|\n format.html { redirect_to affected_types_url, notice: 'Affected type was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @incident_type.destroy\n respond_to do |format|\n format.html { redirect_to admin_incident_types_path, notice: 'Incident type was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @document_type = DocumentType.find(params[:id])\n @document_type.destroy\n\n respond_to do |format|\n format.html { redirect_to document_types_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @intervention_type.destroy\n respond_to do |format|\n format.html { redirect_to intervention_types_url, notice: 'O tipo de intervenção foi eliminado.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @reform_type = ReformType.find(params[:id])\n @reform_type.destroy\n\n respond_to do |format|\n format.html { redirect_to reform_types_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @default_line_calendar.destroy\n respond_to do |format|\n format.html { redirect_to default_line_calendars_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @drum_type.destroy\n respond_to do |format|\n format.html { redirect_to drum_types_url, notice: 'Drum type was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @crate_type = CrateType.find(params[:id])\n @crate_type.destroy\n\n respond_to do |format|\n format.html { redirect_to crate_types_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @event_date.destroy\n respond_to do |format|\n format.html { redirect_to event_event_dates_path, notice: \"Event date was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @admin_expense_type = Admin::ExpenseType.find(params[:id])\n @admin_expense_type.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_expense_types_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @survey_data_type.destroy\n respond_to do |format|\n format.html { redirect_to survey_data_types_url, notice: 'Survey data type was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @novelty_type.destroy\n respond_to do |format|\n format.html { redirect_to novelty_types_url, notice: 'Novelty type was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @daytime = Daytime.find(params[:id])\n @daytime.destroy\n\n respond_to do |format|\n format.html { redirect_to daytimes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @fieldtype = Fieldtype.find(params[:id])\n @fieldtype.destroy\n\n respond_to do |format|\n format.html { redirect_to fieldtypes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @task_type.destroy\n respond_to do |format|\n format.html { redirect_to admin_task_types_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @dish_type.destroy\n respond_to do |format|\n format.html { redirect_to dish_types_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @energy_data_type = EnergyDataType.find(params[:id])\n @energy_data_type.destroy\n\n respond_to do |format|\n format.html { redirect_to energy_data_types_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @viewdate = Viewdate.find(params[:id])\n @viewdate.destroy\n\n respond_to do |format|\n format.html { redirect_to(viewdates_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @realty_type = RealtyType.find(params[:id])\n @realty_type.destroy\n\n respond_to do |format|\n format.html { redirect_to realty_types_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @duedate = Duedate.find(params[:id])\n @duedate.destroy\n\n respond_to do |format|\n format.html { redirect_to duedates_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @report_date.destroy\n respond_to do |format|\n format.html { redirect_to report_dates_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @eventtype.events.each do |e|\n e.destroy\n end\n @eventtype.destroy\n respond_to do |format|\n format.html { redirect_to eventtypes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @default_task_type.destroy\n respond_to do |format|\n format.html { redirect_to default_task_types_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @event_type = EventType.find(params[:id])\n @event_type.destroy\n\n respond_to do |format|\n format.html { redirect_to(event_types_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @calendar_date = CalendarDate.find(params[:id])\n @calendar_date.destroy\n\n respond_to do |format|\n format.html { redirect_to calendar_dates_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @event_type = EventType.find(params[:id])\n @event_type.destroy\n\n\t\tmsg = I18n.t('app.msgs.success_deleted', :obj => I18n.t('app.common.event_type'))\n\t\tsend_status_update(I18n.t('app.msgs.cache_cleared', :action => msg))\n respond_to do |format|\n format.html { redirect_to admin_event_types_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @instance_type.destroy\n respond_to do |format|\n format.html { redirect_to instance_types_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @data_source_type.destroy\n respond_to do |format|\n format.html { redirect_to data_source_types_url, notice: 'Data source type was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @jewelry_type = JewelryType.find(params[:id])\n @jewelry_type.destroy\n\n respond_to do |format|\n format.html { redirect_to jewelry_types_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @employee_events = EmployeeEvent.with_deleted.find(params[:id])\n if params[:type]=='normal'\n @employee_event.delete\n elsif params[:type]=='restore'\n @employee_event.restore\n @employee_event.update(deleted_at: nil)\n end\n\n @employee_event.destroy\n respond_to do |format|\n format.html { redirect_to :back, notice: 'Host was successfully removed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @identity_document_type.destroy\n respond_to do |format|\n format.html { redirect_to identity_document_types_url, notice: 'Tipo Documento excluído com sucesso.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @cdist_type = CdistType.find(params[:id])\n @cdist_type.destroy\n\n respond_to do |format|\n format.html { redirect_to cdist_types_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @type_appointment.destroy\n respond_to do |format|\n format.html { redirect_to type_appointments_url, notice: 'Type appointment was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @os_type.destroy\n respond_to do |format|\n format.html { redirect_to os_types_url, notice: 'Os type was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @service_date.destroy\n respond_to do |format|\n format.html { redirect_to service_dates_url, notice: 'Service date was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @hr_config_discipline_type.destroy\n respond_to do |format|\n format.html { redirect_to hr_config_discipline_types_url, notice: 'Discipline type was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @item_type.destroy\n respond_to do |format|\n format.html { redirect_to item_types_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @accessory_type.destroy\n respond_to do |format|\n format.html { redirect_to accessory_types_url, notice: 'Accessory type was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\r\n @meeting_type = MeetingType.find(params[:id])\r\n @meeting_type.destroy\r\n\r\n respond_to do |format|\r\n format.html { redirect_to meeting_types_url, only_path: true }\r\n format.json { head :no_content }\r\n end\r\n end",
"def destroy\n @day.destroy\n respond_to do |format|\n format.html { redirect_to days_url }\n format.json { head :no_content }\n end\n end",
"def delete_all(date = Date.today)\n delete(date.strftime(@request_path))\n end",
"def destroy\n @typeconge.destroy\n respond_to do |format|\n format.html { redirect_to typeconges_url, notice: 'Typeconge was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @series_type = SeriesType.find(params[:id])\n @series_type.destroy\n\n respond_to do |format|\n format.html { redirect_to series_types_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ad_type = AdType.find(params[:id])\n @ad_type.destroy\n\n respond_to do |format|\n format.html { redirect_to ad_types_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @identifier_type.destroy\n\n respond_to do |format|\n format.html { redirect_to identifier_types_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @tripdate = Tripdate.find(params[:id])\n @tripdate.destroy\n\n respond_to do |format|\n format.html { redirect_to tripdates_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @export_type.destroy\n respond_to do |format|\n format.html { redirect_to export_types_url, notice: 'Export type was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @admission_type = AdmissionType.find(params[:id])\n @admission_type.destroy\n\n respond_to do |format|\n format.html { redirect_to admission_types_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @model_type.destroy\n respond_to do |format|\n format.html { redirect_to model_types_url, notice: 'Model type was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @tasktype = Tasktype.find(params[:id])\n @tasktype.destroy\n\n respond_to do |format|\n format.html { redirect_to tasktypes_url }\n format.json { head :no_content }\n end\n end"
] | [
"0.69580823",
"0.67848355",
"0.661884",
"0.6575049",
"0.6469206",
"0.6463357",
"0.6452886",
"0.6434698",
"0.6407215",
"0.6403275",
"0.6400748",
"0.6393986",
"0.6391941",
"0.63683903",
"0.6365056",
"0.635072",
"0.6338716",
"0.63292414",
"0.6319649",
"0.631415",
"0.6312569",
"0.6309437",
"0.6302296",
"0.62982136",
"0.62978846",
"0.62869537",
"0.62753665",
"0.6273463",
"0.62672335",
"0.62633216",
"0.6259904",
"0.625236",
"0.6240808",
"0.62402064",
"0.622883",
"0.62262017",
"0.6223524",
"0.6222637",
"0.6221579",
"0.6219713",
"0.62171",
"0.62111837",
"0.620934",
"0.62067527",
"0.6203821",
"0.62010676",
"0.61949414",
"0.6193378",
"0.6180883",
"0.61779153",
"0.61765164",
"0.6175893",
"0.6173471",
"0.6171892",
"0.61688507",
"0.61600095",
"0.6159893",
"0.61585927",
"0.61577773",
"0.615776",
"0.61542267",
"0.6153457",
"0.61479706",
"0.61454636",
"0.61432046",
"0.6141447",
"0.6139979",
"0.61351144",
"0.61331236",
"0.6129832",
"0.61281955",
"0.61278546",
"0.6116204",
"0.6094451",
"0.6091018",
"0.60853",
"0.6081337",
"0.60811734",
"0.60770535",
"0.60752654",
"0.60742927",
"0.6073155",
"0.6070244",
"0.6064207",
"0.6063851",
"0.6062216",
"0.6054042",
"0.6053442",
"0.6050198",
"0.6049711",
"0.60462797",
"0.6042761",
"0.60424995",
"0.60337895",
"0.60262024",
"0.6024143",
"0.6022513",
"0.60223323",
"0.60214984",
"0.602012"
] | 0.75766355 | 0 |
Use callbacks to share common setup or constraints between actions. | def set_date_type
@date_type = DateType.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 date_type_params
params.require(:date_type).permit(:name, :plainformat, :senml)
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 valid_params_request?; 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 strong_params\n params.require(:experience).permit(param_whitelist)\n end",
"def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end",
"def whitelist_url_params\n params.require(:whitelist_url).permit(:domain)\n end",
"def allowed_params\n params.require(:allowed).permit(:email)\n end",
"def permitted_params\n []\n end",
"def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end",
"def safe_params\n params.permit(:id, :name, :origin, :emails => []); #emails is an array\n end",
"def query_param\n\t\tparams.permit(:first_name, :last_name, :phone)\n\tend",
"def strong_params\n params.require(:success_metric).permit(param_whitelist)\n end",
"def devise_filter\r\n logger.debug(\"In devise_filter =>PARAMS: #{params.inspect}\")\r\n\r\n # White list for sign_up\r\n devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(user_whitelist) }\r\n\r\n # White list for account update\r\n devise_parameter_sanitizer.for(:account_update) { |u| u.permit(user_whitelist, :current_password) }\r\n\r\n # White list for Invitation creation\r\n devise_parameter_sanitizer.for(:invite) { |u| u.permit(:account_type, :email, :invitation_token)}\r\n\r\n # White list for accept invitation\r\n devise_parameter_sanitizer.for(:accept_invitation) { |u| u.permit(user_whitelist, :invitation_token)}\r\n\r\n end",
"def whitelisted_user_params\n params.require(:user).\n permit( :first_name, :last_name, :email,:password,:password_confirmation,:birthday,:gender)\n end",
"def user_params\n ActionController::Parameters.permit_all_parameters = true\n params.require(:user) #.permit(:name, :surname, :phone, :password, :email, :time_zone)\n end",
"def safe_params\n params.require(:user).permit(:name)\n end",
"def strong_params\n params.require(:metric_change).permit(param_whitelist)\n end",
"def get_params\n\t\treturn ActionController::Parameters.new(self.attributes).permit(\"account_id\", \"title\", \"category\", \"introduction\", \"tags\", \"segment_type\", \"visible\", \"status\", \"main_image\")\n\tend",
"def grant_params\n @whitelisted = params.require(:grant).permit(:name, :description, :agency_id, :acronym)\n end",
"def check_params; true; end",
"def param_whitelist\n whitelist = [\n :description,\n :progress,\n :kpi_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:kpi_id)\n end\n \n whitelist\n end",
"def quote_params\n params.permit!\n end",
"def valid_params?; end",
"def paramunold_params\n params.require(:paramunold).permit!\n end",
"def user_params\n\t\tparams.permit(:nickname, :avatar, :description, :password, :gender, :birthday, :email, :phone, :qq_id, :wechat_id)\n\tend",
"def filtered_parameters; end",
"def user_params\n params.permit(\n \t:id,\n \t:email, \n \t:first_name, \n \t:last_name, \n \t:password, \n \t:confirm_token, \n \t:phone_number,\n \t:facebook_link,\n \t:car_model,\n \t:license_plate)\n end",
"def filtering_params\n params.permit(:email, :name)\n end",
"def check_params\n true\n end",
"def wx_public_params\n params.require(:wx_public).permit(:nickname, :manager, :alias)\n end",
"def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end",
"def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end",
"def listing_params\n\t\tparams.permit(:address, :transit_info, :rules, :other_info, :lat, :lng)\n\tend",
"def social_account_params\n\t\t\tparams.require(:social_account).permit!\n\t\tend",
"def safe_params\n resurce_name = self.class.resource_name\n params_method_name = \"#{resurce_name}_params\".to_sym\n if params[resurce_name]\n if respond_to?(params_method_name) || private_methods.include?(params_method_name)\n send(params_method_name)\n else\n raise ActiveModel::ForbiddenAttributesError, \"Please, define the '#{params_method_name}' method in #{self.class.name}\"\n end\n end\n end",
"def user_params\n params.require(:user).permit(:uri, :username, :password, :realname, :email, :publicvisible)\n end",
"def model_params\n\t\tparams.require(:manager).permit(\n\t :user_name,\n :password,\n :email,\n \t\t\t)\n\tend",
"def url_params\n params.require(:url).permit(:short_url, :original_url, :clicks, :ip_addresses)\n end",
"def article_params_whitelist\n params.require(:article).permit(:title, :description, category_ids: [])\n end",
"def college_whitelist_params\n params.require(:college_whitelist).permit(:status)\n end",
"def active_code_params\n params[:active_code].permit\n end",
"def valid_params(params)\n params.permit(:user_id, :photo_id, :originX, :originY, :width, :height)\n end",
"def filtering_params\n params.permit(:email)\n end",
"def ip_address_params\n\t\t\tparams.require(:ip_address).permit!\n end",
"def reserved_params\n params.require(:reserved).permit(:name, :email, :pax, :address, :KTP, :title)\n end",
"def pull_request_params\n whitelist = [\n :url,\n :id,\n :html_url,\n :diff_url,\n :patch_url,\n :issue_url,\n :number,\n :state,\n :locked,\n :title\n ]\n params.require(:pull_request).permit(whitelist)\n end",
"def post_params\n if current_user.admin? \n params.permit(:title, :body, :city, :country, :gps_location, :privacy, :visible, :latitude, :longitude, images: [], files: [])\n else \n params.permit(:title, :body, :city, :country, :gps_location, :privacy,:latitude, :longitude, images: [], files: [])\n end \n end",
"def list_params\n params.permit(:name)\n end",
"def filter_parameters; end",
"def filter_parameters; end",
"def vineyard_params\n params.permit(:vineyard_name, :email, :website_url, :phone, :address, :city, :region, :postcode, :country, :specialty, :description, :pet_friendly, :holiday, :tours, :events, :family_friendly, :cover_image, :image_one, :image_two, :image_three, :image_four, :user_id, :base64)\n end",
"def available_activity_params\n # params.require(:available_activity).permit(:type,:geometry,:properties)\n whitelisted = ActionController::Parameters.new({\n type: params.require(:available_activity)[:type],\n geometry: params.require(:available_activity)[:geometry].try(:permit!).to_h,\n properties: params.require(:available_activity)[:properties].try(:permit!).to_h\n }).try(:permit!)\n end",
"def user_params\n params.permit(:name, :username, :email, :password, :img_url, :bg_url, :coinbank)\n end",
"def user_params_pub\n\t \tparams[:user].permit(:hruid)\n\t end",
"def user_params\n params.permit(:id, :email, :password, :nickname, :status, :avatar, :flat_picture, :flatsharing_id, :member,\n :user, :color, :solde)\n end",
"def validate_search_inputs\n @whitelisted = params.fetch(:user, nil)\n if @whitelisted.blank?\n render_error(400, \"#{I18n.t('general_error.params_missing_key')}\": [I18n.t('general_error.params_missing_value', model: \"review\")])\n return\n else\n @whitelisted = @whitelisted.permit(:name, :uen, :description)\n end\n end",
"def url_whitelist; end",
"def param_whitelist\n [\n :title,\n :description,\n :organization,\n :team_id,\n :started_at,\n :finished_at,\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n end",
"def admin_social_network_params\n params.require(:social_network).permit!\n end",
"def valid_params(params)\n params.permit(:login, :first_name, :last_name, \n :password, :password_confirmation)\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 sensitive_params=(params)\n @sensitive_params = params\n end",
"def permit_request_params\n params.permit(:address)\n end",
"def user_params\n # Ensure a user can't give themselves admin priveleges\n params.delete(:admin) if current_user.admin?\n params.require(:user).permit(:name, :email, :admin, :image)\n end",
"def secure_params\n params.require(:location).permit(:name)\n end",
"def strong_params\n params.require( :setting ).\n permit( :global_scan_limit, :per_user_scan_limit,\n :target_whitelist_patterns, :target_blacklist_patterns )\n end",
"def question_params\n params.require(:survey_question).permit(question_whitelist)\n end",
"def case_insensitive_params\n params.require(:case_insensitive).permit(:name)\n end",
"def maintenance_request_params\n params[:maintenance_request].permit! #allow all parameters for now\n end",
"def empire_master_no_match_params\n params.require(:empire_master_no_match).permit(:uid, :last_name, :list, :search_date, :double, :source)\n end",
"def url_params\n params[:url].permit(:full)\n end",
"def backend_user_params\n params.permit!\n end",
"def unwanted_params\n params.require(:unwanted).permit(:title, :description, :image)\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 droptraining_params\n params.permit(:training_id,:user_id, :utf8, :authenticity_token, :commit)\n end",
"def pass_params\n params[:pass].permit(:name, :price, :description, :colour, :events)\n end",
"def person_params\n # params whitelist does *not* include admin, sub, remember_token\n # TBD: share this whitelist with the list used by configuration_permitted_parameters\n # TBD: should current_password be on this list? -- for now, leaving off, since it seems to work without\n # NOTE: do not include 'admin' in this list!\n params.require(:person).permit(\n :name, \n :email, \n :description,\n :password, \n :password_confirmation\n )\n end",
"def parameter_params\n params.require(:parameter).permit(:name, :description, :param_code, :param_value, :active_from, :active_to)\n end"
] | [
"0.6980957",
"0.6783065",
"0.6747844",
"0.6741468",
"0.67356336",
"0.6592548",
"0.65036845",
"0.64978707",
"0.64825076",
"0.64795035",
"0.64560914",
"0.64397955",
"0.6379666",
"0.6376688",
"0.6366702",
"0.6319728",
"0.6300833",
"0.6300629",
"0.6294277",
"0.6293905",
"0.6291174",
"0.62905735",
"0.6283171",
"0.6242344",
"0.62403613",
"0.6218049",
"0.62143815",
"0.62104696",
"0.61949855",
"0.6178671",
"0.6176147",
"0.6173327",
"0.6163395",
"0.6153005",
"0.6151833",
"0.6147288",
"0.61224324",
"0.6118827",
"0.61075264",
"0.61054534",
"0.6092497",
"0.6080082",
"0.60710967",
"0.60627776",
"0.60219413",
"0.60175914",
"0.60153484",
"0.60107356",
"0.60081726",
"0.60081726",
"0.60013986",
"0.6000165",
"0.59978646",
"0.59936947",
"0.59925723",
"0.5992084",
"0.59796256",
"0.5967569",
"0.5960056",
"0.59589803",
"0.5958441",
"0.5958401",
"0.5952607",
"0.5952406",
"0.5944409",
"0.59391016",
"0.593842",
"0.593842",
"0.5933845",
"0.59312123",
"0.5926475",
"0.59248453",
"0.59179676",
"0.59109294",
"0.59101623",
"0.5908172",
"0.59058356",
"0.5899052",
"0.5897749",
"0.5896101",
"0.58942914",
"0.58939576",
"0.5892063",
"0.5887407",
"0.588292",
"0.58797663",
"0.587367",
"0.58681566",
"0.5868038",
"0.5866578",
"0.58665025",
"0.58655846",
"0.58640826",
"0.5863465",
"0.5862226",
"0.586065",
"0.58581287",
"0.5854443",
"0.5854172",
"0.58507544",
"0.5849934"
] | 0.0 | -1 |
Synthesize a DNA sequence based on the protein structure. (This is the opposite of what is been generally done in all our cells). | def synthesize(protein)
adn = ''
for a in (0..protein.length-1)
aminoacido = protein[a,1]
entropy = rand(100-10) + 10
if (@aminoacidos.include?(aminoacido))
adn = adn + @codons[aminoacido][entropy % (@codons[aminoacido].length)]
end
end
@synthesize = adn
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def protein_seq\n return Bio::Sequence::NA.new(self.cds_seq).translate.seq\n end",
"def sequence\n return self.dna.sequence\n end",
"def getFtsSequences\n @gb.each_cds do |ft|\n ftH = ft.to_hash\n loc = ft.locations\n loc = \"c#{ft.locations[0].to_s}\" if ft.locations[0].strand == -1\n gene = []\n product = []\n gene = ftH[\"gene\"] if !ftH[\"gene\"].nil?\n product = ftH[\"product\"] if !ftH[\"product\"].nil?\n dna = getDna(ft,@gb.to_biosequence)\n seqout = dna.output_fasta(\"#{@accession}|#{loc}|#{ftH[\"protein_id\"][0]}|#{gene[0]}|#{product[0]}|#{@org}\",60)\n puts seqout\n end\nend",
"def generate_aasequences\n (0..self.sequence.length-1).each do |i|\n AAsequence.create(:seq_id=> self.seq_id,\n :amino_acid=>self.sequence[i],\n :original_position=>i)\n end\n end",
"def rna_to_amino_acid(rna)\n # Protein Translation Problem: Translate an RNA string into an amino acid string.\n # Input: An RNA string Pattern and the array GeneticCode.\n # Output: The translation of Pattern into an amino acid string Peptide. \n\n r_to_c_h = rna_to_codon_hash\n # puts r_to_c_h\n i = 0\n codon_length = 3\n amino_acid = \"\"\n while (codon = rna.slice(i, codon_length)) do\n # puts codon\n # puts r_to_c_h[codon.to_sym]\n break if codon.empty?\n amino_acid += r_to_c_h[codon.to_sym].to_s\n i += codon_length\n end\n return amino_acid\n end",
"def getFtsProtSequences\n @gbkObj.each_cds do |ft|\n ftH = ft.to_hash\n loc = ft.locations\n gene = []\n product = []\n protId = \"\"\n if ftH.has_key? \"pseudo\"\n next\n end\n gene = ftH[\"gene\"] if !ftH[\"gene\"].nil?\n product = ftH[\"product\"] if !ftH[\"product\"].nil?\n protId = ftH[\"protein_id\"][0] if !ftH[\"protein_id\"].nil?\n locustag = ftH[\"locus_tag\"][0] if !ftH[\"locus_tag\"].nil?\n dna = getDna(ft,@gbkObj.to_biosequence)\n pep = ftH[\"translation\"][0] if !ftH[\"translation\"].nil?\n pepBioSeq = Bio::Sequence.auto(pep)\n seqout = pepBioSeq.output_fasta(\"#{@accession}|#{loc}|#{protId}|#{locustag}|#{gene[0]}|#{product[0]}\",60)\n puts seqout\n end\n end",
"def aligned_sequence(start=0,stop = nil,noindent=false) \n self._get_aligned_sequence_from_original_sequence_and_cigar_line\n #seq = AlignSeq.new(self.get_slice.seq,self.cigar_line,start,stop).align\n #return Bio::FastaFormat.new(Bio::Sequence::NA.new(seq).to_fasta(\"#{self.find_organism}\"))\n end",
"def getDna (cds, seq)\n loc = cds.locations\n sbeg = loc[0].from.to_i\n send = loc[0].to.to_i\n fasta = Bio::Sequence::NA.new(seq.subseq(sbeg,send))\n position = \"#{sbeg}..#{send}\"\n if loc[0].strand == -1\n fasta.reverse_complement!\n end\n dna = Bio::Sequence.auto(fasta)\n return dna\nend",
"def DNA_strand(dna)\n\n new_dna = \"\"\n dna.each_char do |letter|\n\n if letter == \"A\"\n new_dna += \"T\"\n elsif letter == \"T\"\n \tnew_dna += \"A\"\n elsif letter == \"C\"\n \tnew_dna += \"G\"\n elsif letter == \"G\"\n \tnew_dna += \"C\"\n else\n \tnew_dna += letter\n end\n \n end\n return new_dna\nend",
"def translate(codon)\n x = Bio::Sequence::NA.new(codon)\n a = x.translate # or a = x.translate.codes \n return a\nend",
"def qseq; @mrna.seq; end",
"def getDna (cds, seq)\n loc = cds.locations\n sbeg = loc[0].from.to_i\n send = loc[0].to.to_i\n fasta = Bio::Sequence::NA.new(seq.subseq(sbeg,send))\n position = \"#{sbeg}..#{send}\"\n if loc[0].strand == -1\n fasta.reverse_complement!\n end\n dna = Bio::Sequence.auto(fasta)\n return dna\n end",
"def genomic_sequence\n genome_id = params[:genome][:id]\n reference_id = params[:reference]\n strand = params[:strand].presence || '+'\n\n ref = Reference.find(:first, :conditions => {:name => reference_id, :genome_id => genome_id})\n\n if ref.present?\n seq = Bio::Sequence::NA.new(\"#{ref.sequence.sequence.to_s}\")\n start = params[:start].presence || 1\n stop = params[:end].presence || seq.length\n @subseq = seq.subseq(start.to_i, stop.to_i)\n @subseq = @subseq.reverse_complement if strand == '-'\n end\n\n id = \"#{ref.name} #{start}..#{stop} #{strand}\"\n render :text => @subseq.to_fasta(id, 60), :content_type => 'text/plain'\n end",
"def dtmf_seq(sequence)\n sequence.map { |d| \"dtmf-#{d}\" }.join ' '\nend",
"def DNA_strand(dna)\n dna.tr('ATGC', 'TACG')\nend",
"def DNA_strand(dna)\n new_dna = ''\n dna.each_char do |x|\n case x\n when 'a'\n new_dna << 't'\n when 't'\n new_dna << 'a'\n when 'g'\n new_dna << 'c'\n when 'c'\n new_dna << 'g'\n end\nend\nputs new_dna\nend",
"def muscle_sequence(ref_seq = \"\", test_seq = \"\", temp_dir=File.dirname($0))\n temp_file = temp_dir + \"/temp\"\n temp_aln = temp_dir + \"/temp_aln\"\n name = \">test\"\n temp_in = File.open(temp_file,\"w\")\n temp_in.puts \">ref\"\n temp_in.puts ref_seq\n temp_in.puts name\n temp_in.puts test_seq\n temp_in.close\n print `muscle -in #{temp_file} -out #{temp_aln} -quiet`\n aln_seq = fasta_to_hash(temp_aln)[\">test\"]\n File.unlink(temp_file)\n File.unlink(temp_aln)\n return aln_seq\nend",
"def encode_peptide(genome, amino_acid)\n # We say that a DNA string Pattern encodes an amino acid string Peptide if the \n # RNA string transcribed from either Pattern or its reverse complement Pattern translates into Peptide. \n # For example, the DNA string GAAACT is transcribed into GAAACU and translated into ET. \n # The reverse complement of this DNA string, AGTTTC, is transcribed into AGUUUC and translated into SF. \n # Thus, GAAACT encodes both ET and SF.”\n\n # Peptide Encoding Problem: Find substrings of a genome encoding a given amino acid sequence.\n # Input: A DNA string Text, an amino acid string Peptide, and the array GeneticCode.\n # Output: All substrings of Text encoding Peptide (if any such substrings exist). \n\n match_dna = []\n codon_length = 3\n rna_seq_length = (amino_acid.length * codon_length)\n \n rna = dna_to_rna(genome)\n i = 0\n while (rna_seq = rna.slice(i, rna_seq_length )) do\n # puts rna_seq\n match_dna << rna_to_dna(rna_seq) if rna_peptide_match?(rna_seq, amino_acid)\n i += 1\n end\n\n rna = dna_to_rna(reverse_complement(genome))\n # puts rna\n i = 0\n while (rna_seq = rna.slice(i, rna_seq_length )) do\n # puts rna_seq\n match_dna << reverse_complement(rna_to_dna(rna_seq)) if rna_peptide_match?(rna_seq, amino_acid)\n i += 1\n end\n\n match_dna\n end",
"def hseq; @genomic.seq; end",
"def DNA_strand(dna)\n n = dna.split(\"\")\n mapping = {'T' => 'A', 'A' => 'T', 'C' => 'G', 'G' => 'C'}\n # n = n.map {|e| mapping[e] || e}\n n.map! {|e| mapping[e] || e}\n n = n.join(\"\")\n return n\nend",
"def genome(liszt)\n=begin\n[samopen] SAM header is present: 2 sequences\n7621912 reads; of these:\n 4009241 (52.60%) were paired; of these:\n 1983557 (49.47%) aligned concordantly 0 times\n 1818685 (45.36%) aligned concordantly exactly 1 time\n 206999 (5.16%) aligned concordantly >1 times\n ----\n 1983557 pairs aligned concordantly 0 times; of these:\n 409503 (20.64%) aligned discordantly 1 time\n ----\n 1574054 pairs aligned 0 times concordantly or discordantly; of these:\n 3148108 mates make up the pairs; of these:\n 1009275 (32.06%) aligned 0 times\n 35392 (1.12%) aligned exactly 1 time\n 2103441 (66.82%) aligned >1 times\n 3612671 (47.40%) were unpaired; of these:\n 498719 (13.80%) aligned 0 times\n 2246121 (62.17%) aligned exactly 1 time\n 867831 (24.02%) aligned >1 times\n=end\n #puts(liszt);exit\n dict={}; liszt.shift\n dict[\"total\"]=liszt.shift.split[0]; #liszt.shift\n dict[\"paired\"]=liszt.shift.split[0]; liszt.shift #conc 0\n dict[\"conc_once\"]=liszt.shift.split[0]\n dict[\"conc_mult\"]=liszt.shift.split[0]\n liszt.shift(2); dict[\"disc_once\"]=\"\"; dict[\"disc_mult\"]=\"\"\n line=liszt.shift\n line.include?(\">1 times\") ? dict[\"disc_mult\"]=line.split[0] : dict[\"disc_once\"]=line.split[0]\n liszt.shift\n dict[\"unaligned_pairs\"]=liszt.shift.split[0]\n liszt.shift\n dict[\"unmates\"]=liszt.shift.split[0] #unaligned mates\n dict[\"mate_once\"]=liszt.shift.split[0]\n dict[\"mate_mult\"]=liszt.shift.split[0]\n dict[\"unpaired\"]=liszt.shift.split[0]\n dict[\"unpair_unaligned\"]=liszt.shift.split[0]\n dict[\"unpair_once\"]=liszt.shift.split[0]\n dict[\"unpair_mult\"]=liszt.shift.split[0]\n dict\nend",
"def seq\n if @seq.nil?\n @seq = ''\n self.exons.each do |exon|\n @seq += exon.seq\n end\n end\n return @seq\n end",
"def aligned_sequence \n peptide_member = Ensembl::Compara::Member.find_by_member_id(self.peptide_member_id)\n seq = peptide_member.sequence.sequence\n return nil if seq.nil?\n aln = Ensembl::Compara::AlignSeq.new(seq,self.cigar_line).align\n return Bio::FastaFormat.new(Bio::Sequence::NA.new(aln).to_fasta(\"#{self.member.stable_id}|#{peptide_member.stable_id}\")) \n end",
"def sequence\n if !sequence?\n raise NotImplementedException, \"Attempted to get the sequence of a velvet node that is too short, such that the sequence info is not fully present in the node object\"\n end\n kmer_length = @parent_graph.hash_length\n\n # Sequence is the reverse complement of the ends_of_kmers_of_twin_node,\n # Then the ends_of_kmers_of_node after removing the first kmer_length - 1\n # nucleotides\n length_to_get_from_fwd = corresponding_contig_length - @ends_of_kmers_of_twin_node.length\n fwd_length = @ends_of_kmers_of_node.length\n raise \"Programming error\" if length_to_get_from_fwd > fwd_length\n revcom(@ends_of_kmers_of_twin_node)+\n @ends_of_kmers_of_node[-length_to_get_from_fwd...fwd_length]\n end",
"def muscle_sequence2(ref_seq = \"\", test_seq = \"\", temp_dir=File.dirname($0))\n temp_file = temp_dir + \"/temp\"\n temp_aln = temp_dir + \"/temp_aln\"\n name = \">test\"\n temp_in = File.open(temp_file,\"w\")\n temp_in.puts \">ref\"\n temp_in.puts ref_seq\n temp_in.puts name\n temp_in.puts test_seq\n temp_in.close\n print `muscle -in #{temp_file} -out #{temp_aln} -quiet`\n aln_seq = fasta_to_hash(temp_aln)[\">test\"]\n aln_ref = fasta_to_hash(temp_aln)[\">ref\"]\n File.unlink(temp_file)\n File.unlink(temp_aln)\n return [aln_ref, aln_seq]\nend",
"def phylipstring_to_fastastring(phystr)\n ph=Bio::Phylip::PhylipFormat.new(phystr)\n return ph.alignment.output(:fasta) #output_fasta\n\n end",
"def getSeq\n bioSeq = @gbkObj.to_biosequence\n sequence = Bio::Sequence.new(bioSeq)\n puts sequence.output_fasta(\"#{bioSeq.accessions[0]}\",60)\n end",
"def qseq; @seq1.seq; end",
"def mutate\n @dna[(([email protected]).to_a).sample] = @@dna_decoder.keys.sample\n end",
"def seq\r\n \t# If we already accessed the sequence, we can just\r\n \t# call the instance variable. Otherwise, we'll have\r\n # to get the sequence first and create a Bio::Sequence::NA\r\n \t# object.\r\n if @seq.nil?\r\n # First check if the slice is on the seqlevel coordinate\r\n \t # system, otherwise project coordinates.\r\n if self.seq_region.coord_system.seqlevel?\r\n @seq = Bio::Sequence::NA.new(self.seq_region.subseq(self.start, self.stop))\r\n else # we have to project coordinates\r\n seq_string = String.new\r\n \t @target_slices = self.project('seqlevel')\r\n\r\n @target_slices.each do |component|\r\n if component.class == Slice\r\n seq_string += component.seq # This fetches the seq recursively (see 10 lines up)\r\n else # it's a Gap\r\n seq_string += 'N' * (component.length)\r\n end\r\n\r\n end\r\n \t @seq = Bio::Sequence::NA.new(seq_string)\r\n\r\n end\r\n\r\n if self.strand == -1\r\n \t @seq.reverse_complement!\r\n end\r\n\r\n end\r\n \treturn @seq\r\n\r\n end",
"def DNA_strand(dna)\n arr = dna.split(//)\n another_arr = Array.new\n arr.each do |chr|\n case chr\n when \"A\"\n another_arr << \"T\"\n when \"T\"\n another_arr << \"A\"\n when \"C\"\n another_arr << \"G\"\n else\n another_arr << \"C\"\n end\n end\n \"String #{dna} is #{another_arr.join}\"\nend",
"def dnaSequence s\n hash, diff = Hash.new(0), Hash.new(0)\n diff[[0, 0, 0]] = 1\n\n sum = 0\n s.chars.each { |c|\n hash[c] += 1\n res = [hash['A'] - hash['C'], hash['C'] - hash['G'], hash['G'] - hash['T']]\n sum += diff[res]\n diff[res] += 1\n }\n sum\nend",
"def DNA_strand(dna)\n dna.tr(\"ACTG\", \"TGAC\")\nend",
"def getFtsNtSequences\n @gbkObj.each_cds do |ft|\n ftH = ft.to_hash\n loc = ft.locations\n gene = []\n product = []\n protId = \"\"\n gene = ftH[\"gene\"] if !ftH[\"gene\"].nil?\n product = ftH[\"product\"] if !ftH[\"product\"].nil?\n protId = ftH[\"protein_id\"][0] if !ftH[\"protein_id\"].nil?\n locustag = ftH[\"locus_tag\"][0] if !ftH[\"locus_tag\"].nil?\n dna = getDna(ft,@gbkObj.to_biosequence)\n seqout = dna.output_fasta(\"#{@accession}|#{loc}|#{protId}|#{locustag}|#{gene[0]}|#{product[0]}\",60)\n puts seqout\n end\n end",
"def DNA_strand(dna)\n dna.tr('ATCG', 'TAGC')\n new_strand = []\n dna.split('').each do |letter|\n if letter === 'A'\n new_strand.push('T')\n elsif letter === 'T'\n new_strand.push('A')\n elsif letter === 'C'\n new_strand.push('G')\n elsif letter === 'G'\n new_strand.push('C')\n end\n end\n return new_strand.join('')\nend",
"def to_rna\n @dna = @dna_type.tr('T', 'U')\n end",
"def cdna2genomic(pos)\n #FIXME: Still have to check for when pos is outside of scope of cDNA.\n # Identify the exon we're looking at.\n exon_with_target = self.exon_for_cdna_position(pos)\n \n accumulated_position = 0\n ex = self.exons.sort_by {|e| e.seq_region_start}\n ex.reverse! if self.strand == -1\n ex.each do |exon| \n if exon == exon_with_target\n length_to_be_taken_from_exon = pos - (accumulated_position + 1)\n if self.strand == -1\n return exon.seq_region_end - length_to_be_taken_from_exon\n else\n return exon.seq_region_start + length_to_be_taken_from_exon\n end\n else\n accumulated_position += exon.length \n end\n end\n end",
"def read_sequence (seq)\n g = 0\n a = 0\n t = 0\n c = 0\n # testen, ob uebergebenes Objekt einzelne Zeichen zurueckgeben kann\n if not seq.respond_to?(\"each_char\")\n return nil\n end\n # iteration ueber alle Symbole (in Großschreibweise) und Ermittlung\n # der absoluten Haeufigkeit der Basen\n seq.each_char do |base|\n base.upcase!\n if base == \"G\"\n g += 1\n elsif base == \"A\"\n a += 1\n elsif base == \"T\"\n t += 1\n elsif base == \"C\"\n c += 1\n else\n return nil\n end\n end\n return g,a,t,c\nend",
"def query_align(seqs)\n seqtype = nil\n unless seqs.is_a?(Bio::Alignment)\n seqs = Bio::Alignment.new(seqs)\n end\n seqs.each do |s|\n if s.is_a?(Bio::Sequence::AA) then\n seqtype = 'PROTEIN'\n elsif s.is_a?(Bio::Sequence::NA) then\n seqtype = 'DNA'\n end\n break if seqtype\n end\n query_string(seqs.to_fasta(70, :avoid_same_name => true), seqtype)\n end",
"def dna_to_rna(string)\n index = 0\n rna_strand = \"\"\n while index < string.length\n if string[index] == \"G\"\n rna_strand << \"C\"\n elsif string[index] == \"C\"\n rna_strand << \"G\"\n elsif string[index] == \"T\"\n rna_strand << \"A\"\n elsif string[index] == \"A\"\n rna_strand << \"U\"\n end\n index += 1\n end\n return rna_strand\nend",
"def amino_acid_number\n @seq.length\n end",
"def seq\n \t# If we already accessed the sequence, we can just\n \t# call the instance variable. Otherwise, we'll have\n # to get the sequence first and create a Bio::Sequence::NA\n \t# object.\n if @seq.nil?\n # First check if the slice is on the seqlevel coordinate\n \t # system, otherwise project coordinates.\n if ! Ensembl::SESSION.seqlevel_id.nil? and self.seq_region.coord_system_id == Ensembl::SESSION.seqlevel_id\n @seq = Bio::Sequence::NA.new(self.seq_region.subseq(self.start, self.stop))\n else # we have to project coordinates\n seq_string = String.new\n \t @target_slices = self.project('seqlevel')\n @target_slices.each do |component|\n if component.class == Slice\n seq_string += component.seq # This fetches the seq recursively\n else # it's a Gap\n seq_string += 'N' * (component.length)\n end\n end\n \t @seq = Bio::Sequence::NA.new(seq_string)\n\n end\n\n if self.strand == -1\n \t @seq.reverse_complement!\n end\n\n end\n \treturn @seq\n\n end",
"def DNAtoRNA(dna)\n dna.gsub(\"T\", \"U\")\nend",
"def generate(input, tempo, repeat)\n # check for valid tempo\n if tempo < 1\n raise RuntimeError, \"You might want to go a little faster.\"\n end\n seq = Sequence.new()\n # metadata track\n track = Track.new(seq)\n seq.tracks << track\n track.events << Tempo.new(Tempo.bpm_to_mpq(tempo))\n track.events << MetaEvent.new(META_SEQ_NAME, \"Vocal Percussion Assembly\")\n # percussion track\n track = Track.new(seq)\n seq.tracks << track\n track.name = 'Percussion'\n track.instrument = 'Drum Kit'\n\n code = parse(input)\n repeat.times do |iteration|\n code.each do |beat|\n # sound all the notes at this beat simultaneously...\n beat.each do |whack|\n track.events << whack.play\n end\n # ...then stop them all simultaneously\n beat.each do |whack|\n # note length doesn't directly apply to drum sounds, but the notes need \n # to have a definite end. we divide by beat.length so that all notes\n # end by then end of the beat (we are not rewinding, so note ends are\n # sequential)\n track.events << whack.stop(seq.note_to_delta('eighth') / beat.length)\n end\n end\n end\n seq\n end",
"def creation_sequencer(sequencetext)\n @sequencetext = sequencetext\n @sequencetext.extend Textual\n # puts \"at line 20 sequencetext is tainted ? \" + sequencetext.tainted?.to_s # => :false\n @sequencetextualed = @sequencetext.to_textual\n @sequencetextualed.extend Textual\n # puts \"at line 23 the result of sequencetext.to_textual : \" + \"#{@sequencetextualed}\"\n @sequencetextdecommaed = @sequencetextualed.de_comma\n @sequencetextdecommaed.extend Textual\n # puts \"at line 26 the result of sequencetext.to_textual.de_comma : \" + \"#{@sequencetextdecommaed}\"\n @sequencetextdespaced = @sequencetextdecommaed.de_space\n # puts \"at line 28 the result of @sequencetextdespace : \" + \"#{@sequencetextdespaced}\"\n @creation_sequence = \"\"\n @creation_sequence = @sequencetextdespaced\n # puts \"at line 35 the @ creation_sequence variable is : \" + \"#{@creation_sequence}\"\n if (@creation_sequence.to_s === \"\") then\n @creation_sequence = \"no letters remain after processing\"\n else\n @creation_sequence\n end\n end",
"def hseq; @seq2.seq; end",
"def save_success_sequence(aa_sequence, nt_sequence, header, accession_no, organism, group, reference, uploader_name, uploader_email)\n\n new_sequence = CustomizedProteinSequence.new\n new_sequence.header = header\n new_sequence.uploader = \"USER\"\n new_sequence.uploader_name = uploader_name\n new_sequence.uploader_email = uploader_email\n new_sequence.group = group\n new_sequence.accession_no = accession_no # result[:header] should be accession no OR manually extract accession number from local blast db\n new_sequence.chain = aa_sequence\n new_sequence.reference = reference\n new_sequence.save!\n\n\n # don't ask user for nt sequence yet. probably ask later through email\n new_nt_sequence = CustomizedNucleotideSequence.new\n new_nt_sequence.header = header\n new_nt_sequence.uploader = \"USER\"\n new_nt_sequence.uploader_name = uploader_name\n new_nt_sequence.uploader_email = uploader_email\n new_nt_sequence.group = group\n new_nt_sequence.accession_no = accession_no\n new_nt_sequence.chain = nt_sequence\n new_sequence.reference = reference\n new_nt_sequence.save!\n\n\n end",
"def add(sequence)\n # Obtains a quarter duration for this sequence\n quarter_note_length = sequence.note_to_delta('quarter')\n \n # Create the duration table based on the sequence's \"quarter\" value\n create_duration_table(quarter_note_length)\n \n # For each instrument on the sequence...\n sequence.each { |track|\n # Program change of the current track\n instrument = nil\n\n # Create a list of midi elements for an instrument\n elements = []\n\n # Iterates the track event list...\n track.each { |event|\n \n # Consider only \"NoteOn\" events since they represent the start of a note event (avoid duplication with \"NoteOff\").\n if event.kind_of?(MIDI::NoteOnEvent) then\n # From its correspondent \"NoteOff\" element, extract the duration of the note event.\n duration = event.off.time_from_start - event.time_from_start + 1\n \n # Maps the duration in ticks to a correspondent string on the duration table.\n duration_representation = @duration_table[duration]\n \n # In the case that the note do not correspond to anything in the table,\n # we just truncate it to the closest value.\n if duration_representation.nil? or duration_representation == \"unknow\" then\n new_duration = 0\n smallest_difference = Float::INFINITY\n @duration_table.each { |key, value|\n difference = (duration - key).abs\n if difference < smallest_difference then\n smallest_difference = difference\n new_duration = key\n end\n }\n duration_representation = @duration_table[new_duration]\n end\n\n # Create new markov chain state and put into the \"elements\" list\n elements << MidiElement.new(event.note_to_s, duration_representation)\n elsif event.kind_of?(MIDI::ProgramChange) then\n if (event.channel == 10) then\n instrument = MIDI::GM_DRUM_NOTE_NAMES[event.program]\n else\n instrument = MIDI::GM_PATCH_NAMES[event.program]\n end\n end\n }\n \n if instrument.nil? then\n instrument = MIDI::GM_PATCH_NAMES[1]\n end\n \n @value_chain[instrument] ||= elements unless elements.empty?\n }\n end",
"def fix_sequence(part)\n\n if part.sequence[-3..-1] == 'ATG'\n puts \"--skipped #{part.biofab_id}\"\n return part\n else\n part.sequence += 'ATG'\n part.save!\n puts \"--fixed #{part.biofab_id}\"\n return part\n end\n\nend",
"def add_sequence(seq)\n\n\t\t\t# Append false gi\n\t\t\tfasta = \">gi|00000|gb|00000.0|N/A\\n\" + seq\n\t\t\t\n\t\t\t@midi_format_array.push(Bio::MidiFormat.new(fasta))\n\n\t\t\t# Increment number of sequences\n\t\t\t@num_midi_seqs += 1\n\t\tend",
"def align_sequences_nm(sequence1, sequence2, scores)\n # Dynamic programming.\n dp = Array.new(sequence1.length + 1) { Array.new(sequence2.length + 1) }\n gap_score = scores['-']['-']\n dp[0][0] = [0, 0, 0, '|', '|']\n sequence1.chars.each_with_index do |c, i|\n dp[i + 1][0] = [(i + 1) * gap_score, 1, 0, c, '-']\n end\n sequence2.chars.each_with_index do |c, j|\n dp[0][j + 1] = [(j + 1) * gap_score, 0, 1, '-', c]\n end\n sequence1.chars.each_with_index do |base1, i|\n sequence2.chars.each_with_index do |base2, j|\n dp[i + 1][j + 1] = [[0, 1, '-', base2], [1, 0, '-', base1],\n [1, 1, base1, base2]].map { |i1, j1, match1, match2|\n [dp[i - i1 + 1][j - j1 + 1].first + scores[match1][match2],\n i1, j1, match1, match2]\n }.max\n end\n end\n \n # Solution reconstruction.\n i, j = *[sequence1, sequence2].map(&:length)\n match_score = dp[i][j].first\n align1, align2 = '', ''\n until i == 0 && j == 0\n score, i1, j1, base1, base2 = *dp[i][j]\n align1 << base1; i -= i1 \n align2 << base2; j -= j1\n end\n \n # Return values\n scores = dp.map { |line| line.map(&:first) }\n words = { [1, 0] => '$\\\\uparrow$', [0, 1] => '$\\\\leftarrow$',\n [1, 1] => '$\\\\nwarrow$', [0, 0] => '$\\\\cdot$'}\n parents = dp.map { |line| line.map { |item| words[item[1, 2]] } }\n { :scores => scores, :parents => parents, :match_score => match_score,\n :aligns => [align1, align2].map(&:reverse) }\nend",
"def generate_alignment\n raise ArgumentError, 'Missing genome FASTA file.' unless @genome_file\n raise ArgumentError, 'Missing transcripts FASTA file.' unless @transcripts_file\n \n # Prepare the BLAT alignment\n blat = Alignment::BLAT.new(@blat_options.merge({ out_format: :tab, database: @genome_file }))\n \n # Optionally set a permanent file to write the results to\n @alignment_file ||= \"#{@transcripts_file}.alignment\"\n blat.output_file = @alignment_file\n \n puts \"Running BLAT alignment...\" if @verbose\n \n # Run\n result_file = blat.run(@transcripts_file)\n result_file.path\n end",
"def on_process_sequence(seq_name,seq_fasta)\n # subclasses may override this method\n end",
"def refseq_sequence\n \"NC_0000\" + chrom.sub(/X/, \"23\").sub(/Y/, \"24\")\n end",
"def write_seq(seq_name,seq_fasta,seq_qual,comments='')\n name = \"\"\n\n @fastq_file.puts(\"@#{seq_name} #{comments}\")\n @fastq_file.puts(seq_fasta)\n @fastq_file.puts(\"+\")\n #@fastq_file.puts(\"+#{seq_name} #{comments}\")\n\n if seq_qual.is_a?(Array)\n @fastq_file.puts(seq_qual.map{|e| @from_phred.call(e)}.join)\n else\n @fastq_file.puts(seq_qual.split(/\\s+/).map{|e| @from_phred.call(e.to_i)}.join)\n end\n\n end",
"def run_align_assess\n filename = self.generate_fasta_alignment_file_for_all\n string = \"./lib/AlignAssess_wShorterID #{filename} P\"\n seq_array = Array.new\n if system(string)\n seq_id_array = self.sequences.map{|s| s.seq_id}\n new_filename = filename + \"_assess\"\n f = File.new(new_filename, \"r\")\n flag = false\n read_row= 999999999\n cur_row = 0\n while (line = f.gets)\n if cur_row > read_row && flag\n if line == \"\\n\"\n flag =false\n else\n seq_array << line.split(\"\\t\")\n end\n elsif line == \"Pair-wise %ID over shorter sequence:\\n\"\n flag=true\n read_row = cur_row + 2\n end\n cur_row +=1\n end\n range = seq_array.length - 1\n #seq_array.each do |row|\n for row_num in 0..range\n for i in 1..range#(row_num) \n PercentIdentity.first_or_create(:seq1_id=>seq_id_array[row_num],\n :seq2_id=>seq_id_array[i],\n :alignment_name => self.alignment_name,\n :percent_id=>seq_array[row_num][i])\n # print \"[#{row_num}:#{i-1}=>#{row[i]}],\"\n end\n #print \"\\n\"\n end\n end\n end",
"def generate_pid_fasta_file(dir=\"temp_data\")\n fasta_string=\"\"\n seq = Sequence.get(self.seq_id)\n pids = PercentIdentity.all(:seq1_id => self.seq_id, :percent_id.gte => 20, :order =>[:percent_id.desc],:unique=>true)\n fasta_string= Alignment.first(:alignment_name => self.alignment_name, :seq_id=>self.seq_id).fasta_alignment_string\n puts seq.abrev_name+\":\"+pids.count.to_s\n puts pids.map{|p| p.seq2_sequence.seq_name}.join(',')\n pids.each do |pid|\n if pid.seq2_id != seq.seq_id\n print Sequence.get(pid.seq2_id).abrev_name + \":\" + pid.percent_id.to_s + \",\"\n fasta_string = fasta_string + Alignment.first(:alignment_name=>pid.alignment_name, :seq_id=>pid.seq2_id).fasta_alignment_string(\"pid:#{pid.percent_id}\")\n end\n end\n puts \"\"\n filepath = \"#{dir}/\"+self.alignment_name+\"_\"+seq.abrev_name+\"_pid.fasta\"\n f = File.new(filepath, \"w+\")\n f.write(fasta_string)\n f.close\n filepath\n end",
"def proteinlist\n\n end",
"def rna_to_dna(rna)\n rna.gsub(\"U\", \"T\")\n end",
"def process_alignment\n # init vars\n @names = []\n @seqs = []\n \n @alignment = \"-B #{@basename}.aln\"\n\n # import alignment file\n @content = IO.readlines(@infile).map {|line| line.chomp}\n \n #check alignment for gap-only columns\n remove_inserts\n \n #write query-file\n File.open(@infile, \"w\") do |file|\n file.write(\">#{@names[0]}\\n\")\n file.write(\"#{@seqs[0]}\\n\")\n end\n \n #write aln-file\n File.open(@basename + \".aln\", \"w\") do |file|\n @names.each_index do |num|\n file.write(\"Sequence#{num} \")\n file.write(\" \") if (num < 10)\n file.write(\" \") if (num < 100)\n file.write(\"#{@seqs[num]}\\n\")\n end\n end\n end",
"def create_biosequence_from_feature(feature,rich_sequence_object, protein = false)\n location_string = location_string_from_feature(feature)\n cds_sequence = rich_sequence_object.seq.splice(location_string)\n cds_sequence = cds_sequence.translate(1,11) if protein\n query_sequence = Bio::Sequence.new(cds_sequence.to_s)\nend",
"def dna_to_rna(dna)\n dna.gsub(\"T\", \"U\")\n end",
"def remove_inserts\n\n currseq = \"\"\n currname = \"\"\n # TODO: extract this from all methods to a helper class \n @content.each do |line|\n # if name anchor is found start a new bin\n if (line =~ /^>(.*)/)\n # check if we found next bin\n if (currseq.length > 0)\n # push name and sequence to containers\n @names << currname\n @seqs << currseq\n end\n # name is found next to anchor\n currname = $1\n # no sequence data yet\n currseq = \"\"\n else\n # append sequence data\n currseq += line\n end \n end \n # collect the data from the last bin\n if (currseq.length > 0)\n @names << currname\n @seqs << currseq\n end\n \n match_cols = []\n \n # Determine which columns have a gap in first sequence (match_cols = false)\n residues = @seqs[0].unpack(\"C*\")\n residues.each_index do |num|\n if (residues[num] == 45 || residues[num] == 46)\n match_cols[num] = false\n else\n match_cols[num] = true\n end\n end\n \n # Delete insert columns\n @names.each_index do |i|\n # Unpack C : 8-bit unsigned integer , push -> Array\n residues = @seqs[i].unpack(\"C*\")\n seq = \"\"\n # traverse over Integer Representation\n residues.each_index do |num|\n # If the base Sequence has no gap then check current sequence \n if (match_cols[num])\n if (residues[num] == 45 || residues[num] == 46)\n # Add gap to Sequence\n seq += \"-\"\n else\n # Add the Residue to Sequence\n seq += residues[num].chr\n end \n end \n end\n # Remove anchoring String Characters\n seq.tr!('^a-zA-Z-','')\n # Push an Upper Case representation to the @seqs array\n @seqs[i] = seq.upcase\n # Check whether all sequences have same length as parent\n if (@seqs[i].length != @seqs[0].length)\n logger.debug \"ERROR! Sequences in alignment do not all have equal length!\"\n end\n end\n end",
"def gen_random_seqs(msa_file,noalign_random_file)\n\n #read simple fasta file\n puts `pwd`\n\n\n len_align = 0;\n\n #create new OriginalAlignment\n oa = Bio::Alignment::OriginalAlignment.new()\n #load sequences from file\n Bio::FlatFile.open(Bio::FastaFormat, msa_file) { |ff|\n #store sequence from file\n ff.each_entry { |x| oa.add_seq(x.seq,x.entry_id) }\n }\n\n #remove gaps\n oa.remove_all_gaps!\n #determine ungaped length\n #oa.each_seq { |seq| len_align=[len_align,seq.length].max }\n #show it\n len_align = oa.alignment_length\n\n #store random sequence\n oa = oa.alignment_collect {|key| key = gen_rand_dna_seq(len_align) }\n\n #puts oa.output(:fasta)\n\n #puts result on disk\n simple_seqs_file = File.new(noalign_random_file,\"w\")\n simple_seqs_file.puts(oa.output_fasta)\n simple_seqs_file.close;\n \n end",
"def guess_sequence_type(sequence_string)\n cleaned_sequence = sequence_string.gsub(/[^A-Z]/i, '') # removing non-letter characters\n cleaned_sequence.gsub!(/[NX]/i, '') # removing ambiguous characters\n\n return nil if cleaned_sequence.length < 10 # conservative\n\n composition = composition(cleaned_sequence) \n composition_NAs = composition.select { |character, count|character.match(/[ACGTU]/i) } # only putative NAs\n putative_NA_counts = composition_NAs.collect { |key_value_array| key_value_array[1] } # only count, not char\n putative_NA_sum = putative_NA_counts.inject { |sum, n| sum + n } # count of all putative NA\n putative_NA_sum = 0 if putative_NA_sum.nil?\n\n if putative_NA_sum > (0.9 * cleaned_sequence.length)\n return :nucleotide\n else\n return :protein\n end\n end",
"def cyclopeptide_sequencing(spectrum)\n # CYCLOPEPTIDESEQUENCING(Spectrum)\n # Peptides ← {empty peptide}\n # while Peptides is nonempty\n # Peptides ← Expand(Peptides)\n # for each peptide Peptide in Peptides\n # if Mass(Peptide) = ParentMass(Spectrum)\n # if Cyclospectrum(Peptide) = Spectrum\n # output Peptide\n # remove Peptide from Peptides\n # else if Peptide is not consistent with Spectrum\n # remove Peptide from Peptides\n\n # What about the branching step? Given the current collection of linear peptides Peptides, \n # define Expand(Peptides) as a new collection containing all possible extensions of peptides in \n # Peptides by a single amino acid mass\n peptides = []\n parent_mass = spectrum[-1]\n output_peptides = []\n loop do\n expanded_peptides = expand_peptides(peptides)\n # puts peptides\n delete_peptides = []\n expanded_peptides.each do |peptide|\n # puts peptide\n if peptide_mass(peptide) == parent_mass\n cyclic_spec_pep = cyclic_spectrum(peptide)\n # puts peptide\n # puts cyclic_spec_pep.join(\" \")\n if cyclic_spec_pep == spectrum \n # puts \"output: \" + peptide_to_mass(peptide)\n output_peptides << peptide_to_mass(peptide) \n end\n delete_peptides << peptide\n else\n unless peptide_consistency_with_spectrum?(peptide, spectrum)\n delete_peptides << peptide\n end\n end\n end\n delete_peptides.uniq.each {|p| expanded_peptides.delete(p) }\n\n break if expanded_peptides.empty?\n peptides = []\n expanded_peptides.each {|p| peptides << p}\n end\n\n output_peptides.uniq\n end",
"def amino_acid (bases)\n case bases\n when /^TT[TCY]$/\n return \"F\"\n when /^TT[AGR]$/\n return \"L\"\n when /^CT.$/\n return \"L\"\n when /^AT[TCAHYWM]$/\n return \"I\"\n when \"ATG\"\n return \"M\"\n when /^GT.$/\n return \"V\"\n when /^TC.$/\n return \"S\"\n when /^CC.$/\n return \"P\"\n when /^AC.$/\n return \"T\"\n when /^GC.$/\n return \"A\"\n when /^TA[TCY]$/\n return \"Y\"\n when /^TA[AGR]$/\n return \"*\"\n when /^T[GR]A$/\n return \"*\"\n when /^CA[TCY]$/\n return \"H\"\n when /^CA[AGR]$/\n return \"Q\"\n when /^AA[TCY]$/\n return \"N\"\n when /^AA[AGR]$/\n return \"K\"\n when /^GA[TCY]$/\n return \"D\"\n when /^GA[AGR]$/\n return \"E\"\n when /^TG[TCY]$/\n return \"C\"\n when \"TGG\"\n return \"W\"\n when /^CG.$/\n return \"R\"\n when /^AG[TCY]$/\n return \"S\"\n when /^[AM]G[AGR]$/\n return \"R\"\n when /^GG.$/\n return \"G\"\n when /^[ATW][CGS][CTY]$/\n return \"S\"\n when /^[TCY]T[AGR]$/\n return \"L\"\n else\n return \"#\"\n end\n end",
"def amino_acid_2 (bases)\n bases_to_aa = []\n aa_list = []\n base1 = bases[0].to_list\n base2 = bases[1].to_list\n base3 = bases[2].to_list\n l1 = base1.size - 1\n l2 = base2.size - 1\n l3 = base3.size - 1\n (0..l1).each do |n1|\n b1 = base1[n1]\n (0..l2).each do |n2|\n b2 = base2[n2]\n (0..l3).each do |n3|\n b3 = base3[n3]\n bases_all = b1 + b2 + b3\n bases_to_aa << bases_all\n end\n end\n end\n\n bases_to_aa.each do |base|\n case base\n when /^TT[TCY]$/\n aa = \"F\"\n when /^TT[AGR]$/\n aa = \"L\"\n when /^CT.$/\n aa = \"L\"\n when /^AT[TCAHYWM]$/\n aa = \"I\"\n when \"ATG\"\n aa = \"M\"\n when /^GT.$/\n aa = \"V\"\n when /^TC.$/\n aa = \"S\"\n when /^CC.$/\n aa = \"P\"\n when /^AC.$/\n aa = \"T\"\n when /^GC.$/\n aa = \"A\"\n when /^TA[TCY]$/\n aa = \"Y\"\n when /^TA[AGR]$/\n aa = \"*\"\n when /^T[GR]A$/\n aa = \"*\"\n when /^CA[TCY]$/\n aa = \"H\"\n when /^CA[AGR]$/\n aa = \"Q\"\n when /^AA[TCY]$/\n aa = \"N\"\n when /^AA[AGR]$/\n aa = \"K\"\n when /^GA[TCY]$/\n aa = \"D\"\n when /^GA[AGR]$/\n aa = \"E\"\n when /^TG[TCY]$/\n aa = \"C\"\n when \"TGG\"\n aa = \"W\"\n when /^CG.$/\n aa = \"R\"\n when /^AG[TCY]$/\n aa = \"S\"\n when /^[AM]G[AGR]$/\n aa = \"R\"\n when /^GG.$/\n aa = \"G\"\n when /^[ATW][CGS][CTY]$/\n aa = \"S\"\n when /^[TCY]T[AGR]$/\n aa = \"L\"\n else\n aa = \"-\"\n end\n aa_list << aa\n end\n aa_out = aa_list.uniq.join\n return aa_out\n end",
"def getFtProtID\n protein_id = ARGV[1]\n protId = \"\"\n @gbkObj.each_cds do |ft|\n ftH = ft.to_hash\n ftloc = ft.locations\n if ftH[\"protein_id\"][0].include? protein_id\n gene = []\n product = []\n gene = ftH[\"gene\"] if !ftH[\"gene\"].nil?\n product = ftH[\"product\"] if !ftH[\"product\"].nil?\n protId = ftH[\"protein_id\"][0] if !ftH[\"protein_id\"].nil?\n locustag = ftH[\"locus_tag\"][0] if !ftH[\"locus_tag\"].nil?\n if ftloc[0].strand == -1\n location = \"c#{ftloc[0].from}..#{ftloc[0].to}\"\n else\n location = \"#{ftloc[0].from}..#{ftloc[0].to}\"\n end\n dna = getDna(ft,@gbkObj.to_biosequence)\n seqout = dna.output_fasta(\"#{@accession}|#{location}|#{protId}|#{locustag}|#{gene[0]}|#{product[0]}\",60)\n puts seqout\n end\n end\n end",
"def dna_to_rna(dna)\n dna.tr('T', 'U')\nend",
"def sdrm_pr_bulk(sequences, cutoff = 0, temp_r_dir = File.dirname($0))\n region = \"PR\"\n rf_label = 0\n start_codon_number = 1\n n_seq = sequences.size\n mut = {}\n mut_com = []\n aa = {}\n point_mutation_list = []\n sequences.each do |name,seq|\n s = Sequence.new(name,seq)\n s.get_aa_array(rf_label)\n aa_seq = s.aa_array\n aa[name] = aa_seq.join(\"\")\n record = hiv_protease(aa_seq)\n mut_com << record\n record.each do |position,mutation|\n if mut[position]\n mut[position][1] << mutation[1]\n else\n mut[position] = [mutation[0],[]]\n mut[position][1] << mutation[1]\n end\n end\n end\n mut.each do |position,mutation|\n wt = mutation[0]\n mut_list = mutation[1]\n count_mut_list = count(mut_list)\n count_mut_list.each do |m,number|\n ci = r_binom_CI(number, n_seq, temp_r_dir)\n label = number < cutoff ? \"*\" : \"\"\n point_mutation_list << [region, n_seq, position, wt, m, number, (number/n_seq.to_f).round(5), ci[0], ci[1], label]\n end\n end\n point_mutation_list.sort_by! {|record| record[2]}\n\n link = count(mut_com)\n link2 = {}\n link.each do |k,v|\n pattern = []\n if k.size == 0\n pattern = ['WT']\n else\n k.each do |p,m|\n pattern << (m[0] + p.to_s + m[1])\n end\n end\n link2[pattern.join(\"+\")] = v\n end\n linkage_list = []\n link2.sort_by{|_key,value|value}.reverse.to_h.each do |k,v|\n ci = r_binom_CI(v, n_seq, temp_r_dir)\n label = v < cutoff ? \"*\" : \"\"\n linkage_list << [region, n_seq, k, v, (v/n_seq.to_f).round(5), ci[0], ci[1], label]\n end\n\n report_list = []\n\n div_aa = {}\n aa_start = start_codon_number\n\n aa_size = aa.values[0].size - 1\n\n (0..aa_size).to_a.each do |p|\n aas = []\n aa.values.each do |r1|\n aas << r1[p]\n end\n count_aas = count(aas)\n div_aa[aa_start] = count_aas.sort_by{|k,v|v}.reverse.to_h\n aa_start += 1\n end\n\n div_aa.each do |k,v|\n record = [region, k, n_seq]\n $amino_acid_list.each do |amino_acid|\n aa_count = v[amino_acid]\n record << (aa_count.to_f/n_seq*100).round(4)\n end\n report_list << record\n end\n\n return [point_mutation_list, linkage_list, report_list]\nend",
"def generate_sequence(comparison)\n identifier = []\n identifier << {\n \"system\" => \"https://precision.fda.gov/fhir/Sequence/\",\n \"value\" => comparison.uid,\n }\n\n coding = []\n %w(ref_vcf ref_bed).each do |role|\n input = comparison.input(role)\n next if input.blank?\n\n coding << {\n \"system\" => \"https://precision.fda.gov/files\",\n \"code\" => input.user_file.dxid,\n \"display\" => input.user_file.public? ? input.user_file.name : input.user_file.dxid,\n }\n end\n\n standard_sequence = { \"coding\" => coding }\n\n app = App.find_by(dxid: COMPARATOR_V1_APP_ID)\n coding = []\n\n if app\n coding << {\n \"system\" => \"https://precision.fda.gov/apps\",\n \"code\" => app.dxid,\n \"display\" => app.title,\n \"version\" => app.revision.to_s,\n }\n end\n\n method = {\n \"coding\" => coding,\n }\n\n quality_data = {\n \"type\" => \"unknown\",\n \"standardSequence\" => standard_sequence,\n \"method\" => method,\n \"truthTP\" => comparison.meta[\"true-pos\"].to_i,\n \"truthFN\" => comparison.meta[\"false-neg\"].to_i,\n \"queryFP\" => comparison.meta[\"false-pos\"].to_i,\n \"precision\" => comparison.meta[\"precision\"].to_f,\n \"recall\" => comparison.meta[\"recall\"].to_f,\n \"fMeasure\" => comparison.meta[\"f-measure\"].to_f,\n }\n\n # For ROC data points, convert them to floats before exporting\n meta_roc = comparison.meta[\"weighted_roc\"]\n\n headers_map = {\n \"score\" => \"score\",\n \"true_positives\" => \"numTP\",\n \"false_positives\" => \"numFP\",\n \"false_negatives\" => \"numFN\",\n \"precision\" => \"precision\",\n \"sensitivity\" => \"sensitivity\",\n \"f_measure\" => \"fMeasure\",\n }\n\n if meta_roc[\"data\"].present?\n headers = {}\n\n meta_roc[\"header\"].map.each_with_index do |h, i|\n new_key = headers_map[h]\n\n case h\n when \"score\", \"true_positives\", \"false_positives\", \"false_negatives\"\n headers[new_key] = meta_roc[\"data\"].map { |d| d[i].to_i }\n else\n headers[new_key] = meta_roc[\"data\"].map { |d| d[i].to_f }\n end\n end\n\n quality_data[\"roc\"] = headers\n end\n\n quality = []\n quality << quality_data\n repository = []\n\n %w(test_vcf test_bed).each do |role|\n input = comparison.input(role)\n next if input.blank?\n\n repository << {\n \"type\" => \"login\",\n \"url\" => \"https://precision.fda.gov#{pathify(input.user_file)}\",\n \"name\" => \"PrecisionFDA\",\n \"variantsetId\" => input.user_file.dxid,\n }\n end\n\n {\n \"resourceType\" => \"Sequence\",\n \"type\" => \"dna\",\n \"coordinateSystem\" => 1,\n \"identifier\" => identifier,\n \"quality\" => quality,\n \"repository\" => repository,\n }\n end",
"def genomic\n unless defined?(@genomic)\n @genomic = SeqDesc.parse(@d0.find { |x| /^Genomic\\:/ =~ x })\n end\n @genomic\n end",
"def ref_seq\n\n if _ref_seq\n _ref_seq\n else\n seq = Reference.ref_seq(chromosome, start, stop, strand)\n update_attributes(:_ref_seq => seq)\n seq\n end\n\n end",
"def start_seq(mode, bpm, sticking)\n new_session = Session.create(:sequence_id => self.id, :user_id => 1)\n\n if (mode == 5) # compose\n track1 = '[t:-1]'\n track2 = '[t:-1]'\n track3 = '[t:-1]'\n lengths = '[l:-1]'\n metadata = '[m:5,1,0]'\n else\n seq_length = self.notes.select('bar, beat').distinct.length\n\n # create tracks/lengths\n beats = []\n track1 = '[t:'\n track2 = '[t:'\n track3 = '[t:'\n lengths = '[l:'\n\n self.notes.select('bar, beat').distinct.each do |s|\n beats << self.notes.where(:bar => s.bar, :beat => s.beat)\n end\n\n if self.notes.first.hand.nil?\n for i in 0..(beats.length - 1)\n to_add = beats[i]\n\n (3 - beats[i].length).times do\n to_add << nil\n end\n\n if !to_add[0].nil?\n track1 << to_add[0].drum.to_s << ','\n else\n track1 << '-1,'\n end\n if !to_add[1].nil?\n track2 << to_add[1].drum.to_s << ','\n else\n track2 << '-1,'\n end\n if !to_add[2].nil?\n track3 << to_add[2].drum.to_s << ','\n else\n track3 << '-1,'\n end\n\n note1 = beats[i].first\n lengths << (note1.start.to_f / bpm * 60000).to_i.to_s << ','\n\n if i != beats.length - 1\n note2 = beats[i+1].first\n\n # add a rest to fill the gap between\n if beats[i+1].any? && note1.start + note1.duration < note2.start\n lengths << ((note1.start + note1.duration).to_f / bpm * 60000).to_i.to_s << ','\n track1 << '-1,'\n track2 << '-1,'\n track3 << '-1,'\n end\n end\n end\n end\n\n # else\n # for i in 0..seq_length - 1\n # if beats[i].where(:hand => 'left').any?\n # track1 << beats[i].where(:hand => 'left').drum.to_s << ','\n # else\n # track1 << '-1,'\n # end\n\n # if beats[i].where(:hand => 'right').any?\n # track2 << beats[i].where(:hand => 'right').drum.to_s << ','\n # else\n # track2 << '-1,'\n # end\n\n # if beats[i].where(:hand => 'foot').any?\n # track1 << beats[i].where(:hand => 'foot').drum.to_s << ','\n # else\n # track3 << '-1,'\n # end\n\n # if i == beats.length - 1\n # lengths << beats[i].first.duration.to_s << ','\n # else\n # note1 = beats[i].first\n # note2 = beats[i+1].first\n\n # if beats[i+1].empty?\n # lengths << note1.duration.to_s << ','\n # elsif note1.start + note1.duration >= note2.start\n # # truncate the note at the start of the next note\n # lengths << (note2.start - note1.start).to_s << ','\n # else\n # # add a rest to fill the gap\n # lengths << beats[i].first.duration.to_s << ',' << (note2.start - (note1.start + note1.duration)).to_s << ','\n # track1 << '-1,'\n # track2 << '-1,'\n # track3 << '-1,'\n # end\n # end\n # end\n # end\n\n metadata = '[m:' << mode.to_s << ',' << track1.count(',').to_s << ',' << sticking.to_s << ']'\n\n track1[-1], track2[-1], track3[-1], lengths[-1] = ']', ']', ']', ']'\n # lengths = '[l:' << ([1]*track1.count(',')).to_s.gsub!(/\\s+/,'')[1..-1]\n end\n seq = [metadata, track1, track2, track3, lengths]\n\n puts seq\n\n # write sequence to serial\n\n sp = SerialPort.new('/dev/tty.usbmodem586841', 115200, 8, 1, SerialPort::NONE)\n sp.sync = true\n\n seq.each do |i|\n puts 'app> ' + i.strip\n sp.write i.strip\n sleep 0.1\n end\n\n sp.flush\n\n buf = ''\n while true do\n # begin\n if (o = sp.gets)\n sp.flush\n buf << o\n if buf.include? ']'\n input = buf.slice!(buf.index('['), buf.index(']') + 1)\n puts 'mcu> '+ input\n if input.include? '[e'\n sp.close\n break\n elsif input.include? '[h'\n hit = input.strip[3..-2].split(',')\n message = {:drum => hit[0], :start => hit[1], :correct => hit[2]}\n $redis.publish('messages.create', message.to_json)\n end\n input = ''\n end\n end\n # rescue\n\n # end\n end\n\n sp.close\n\n return seq\n end",
"def genomic2cdna(pos)\n #FIXME: Still have to check for when pos is outside of scope of cDNA.\n # Identify the exon we're looking at.\n exon_with_target = self.exon_for_genomic_position(pos)\n \n accumulated_position = 0\n ex = self.exons.sort_by {|e| e.seq_region_start}\n ex.reverse! if self.strand == -1\n ex.each do |exon|\n if exon.stable_id == exon_with_target.stable_id\n if self.strand == 1\n accumulated_position += ( pos - exon.start) +1\n else\n accumulated_position += ( exon.stop - pos ) +1\n end \n return accumulated_position\n else\n accumulated_position += exon.length \n end\n end\n return RuntimeError, \"Position outside of cDNA scope\"\n end",
"def make_tnt_input(seq_arr)\n seq_arr_length = seq_arr[0][:seq].length()\n retstr = \"xread\\n#{seq_arr_length} 49\\n\"\n seq_arr.each { |sa| retstr << \"#{sa[:genus]} #{sa[:seq]}\\n\" }\n retstr << \";\\n\"\nend",
"def resequence\n if @numbers\n (0...@list_size).each do |j|\n target = @item[j]\n\n source = \"%4d. %s\" % [j + 1, \"\"]\n\n k = 0\n while k < source.size\n # handle deletions that change the length of number\n if source[k] == \".\" && target[k] != \".\"\n source = source[0...k] + source[k+1..-1]\n end\n\n target[k] &= Ncurses::A_ATTRIBUTES\n target[k] |= source[k].ord\n k += 1\n end\n end\n end\n end",
"def fasta\n chars = 60\n lines = (length / chars.to_f).ceil\n defline = \">#{accession} #{title}\"\n seqlines = (1..lines).map {|i| to_s[chars * (i - 1), chars]}\n [defline].concat(seqlines).join(\"\\n\")\n end",
"def sequence_locator(seq=\"\",temp_dir=File.dirname($0))\n hxb2_ref = \"TGGAAGGGCTAATTCACTCCCAACGAAGACAAGATATCCTTGATCTGTGGATCTACCACACACAAGGCTACTTCCCTGATTAGCAGAACTACACACCAGGGCCAGGGATCAGATATCCACTGACCTTTGGATGGTGCTACAAGCTAGTACCAGTTGAGCCAGAGAAGTTAGAAGAAGCCAACAAAGGAGAGAACACCAGCTTGTTACACCCTGTGAGCCTGCATGGAATGGATGACCCGGAGAGAGAAGTGTTAGAGTGGAGGTTTGACAGCCGCCTAGCATTTCATCACATGGCCCGAGAGCTGCATCCGGAGTACTTCAAGAACTGCTGACATCGAGCTTGCTACAAGGGACTTTCCGCTGGGGACTTTCCAGGGAGGCGTGGCCTGGGCGGGACTGGGGAGTGGCGAGCCCTCAGATCCTGCATATAAGCAGCTGCTTTTTGCCTGTACTGGGTCTCTCTGGTTAGACCAGATCTGAGCCTGGGAGCTCTCTGGCTAACTAGGGAACCCACTGCTTAAGCCTCAATAAAGCTTGCCTTGAGTGCTTCAAGTAGTGTGTGCCCGTCTGTTGTGTGACTCTGGTAACTAGAGATCCCTCAGACCCTTTTAGTCAGTGTGGAAAATCTCTAGCAGTGGCGCCCGAACAGGGACCTGAAAGCGAAAGGGAAACCAGAGGAGCTCTCTCGACGCAGGACTCGGCTTGCTGAAGCGCGCACGGCAAGAGGCGAGGGGCGGCGACTGGTGAGTACGCCAAAAATTTTGACTAGCGGAGGCTAGAAGGAGAGAGATGGGTGCGAGAGCGTCAGTATTAAGCGGGGGAGAATTAGATCGATGGGAAAAAATTCGGTTAAGGCCAGGGGGAAAGAAAAAATATAAATTAAAACATATAGTATGGGCAAGCAGGGAGCTAGAACGATTCGCAGTTAATCCTGGCCTGTTAGAAACATCAGAAGGCTGTAGACAAATACTGGGACAGCTACAACCATCCCTTCAGACAGGATCAGAAGAACTTAGATCATTATATAATACAGTAGCAACCCTCTATTGTGTGCATCAAAGGATAGAGATAAAAGACACCAAGGAAGCTTTAGACAAGATAGAGGAAGAGCAAAACAAAAGTAAGAAAAAAGCACAGCAAGCAGCAGCTGACACAGGACACAGCAATCAGGTCAGCCAAAATTACCCTATAGTGCAGAACATCCAGGGGCAAATGGTACATCAGGCCATATCACCTAGAACTTTAAATGCATGGGTAAAAGTAGTAGAAGAGAAGGCTTTCAGCCCAGAAGTGATACCCATGTTTTCAGCATTATCAGAAGGAGCCACCCCACAAGATTTAAACACCATGCTAAACACAGTGGGGGGACATCAAGCAGCCATGCAAATGTTAAAAGAGACCATCAATGAGGAAGCTGCAGAATGGGATAGAGTGCATCCAGTGCATGCAGGGCCTATTGCACCAGGCCAGATGAGAGAACCAAGGGGAAGTGACATAGCAGGAACTACTAGTACCCTTCAGGAACAAATAGGATGGATGACAAATAATCCACCTATCCCAGTAGGAGAAATTTATAAAAGATGGATAATCCTGGGATTAAATAAAATAGTAAGAATGTATAGCCCTACCAGCATTCTGGACATAAGACAAGGACCAAAGGAACCCTTTAGAGACTATGTAGACCGGTTCTATAAAACTCTAAGAGCCGAGCAAGCTTCACAGGAGGTAAAAAATTGGATGACAGAAACCTTGTTGGTCCAAAATGCGAACCCAGATTGTAAGACTATTTTAAAAGCATTGGGACCAGCGGCTACACTAGAAGAAATGATGACAGCATGTCAGGGAGTAGGAGGACCCGGCCATAAGGCAAGAGTTTTGGCTGAAGCAATGAGCCAAGTAACAAATTCAGCTACCATAATGATGCAGAGAGGCAATTTTAGGAACCAAAGAAAGATTGTTAAGTGTTTCAATTGTGGCAAAGAAGGGCACACAGCCAGAAATTGCAGGGCCCCTAGGAAAAAGGGCTGTTGGAAATGTGGAAAGGAAGGACACCAAATGAAAGATTGTACTGAGAGACAGGCTAATTTTTTAGGGAAGATCTGGCCTTCCTACAAGGGAAGGCCAGGGAATTTTCTTCAGAGCAGACCAGAGCCAACAGCCCCACCAGAAGAGAGCTTCAGGTCTGGGGTAGAGACAACAACTCCCCCTCAGAAGCAGGAGCCGATAGACAAGGAACTGTATCCTTTAACTTCCCTCAGGTCACTCTTTGGCAACGACCCCTCGTCACAATAAAGATAGGGGGGCAACTAAAGGAAGCTCTATTAGATACAGGAGCAGATGATACAGTATTAGAAGAAATGAGTTTGCCAGGAAGATGGAAACCAAAAATGATAGGGGGAATTGGAGGTTTTATCAAAGTAAGACAGTATGATCAGATACTCATAGAAATCTGTGGACATAAAGCTATAGGTACAGTATTAGTAGGACCTACACCTGTCAACATAATTGGAAGAAATCTGTTGACTCAGATTGGTTGCACTTTAAATTTTCCCATTAGCCCTATTGAGACTGTACCAGTAAAATTAAAGCCAGGAATGGATGGCCCAAAAGTTAAACAATGGCCATTGACAGAAGAAAAAATAAAAGCATTAGTAGAAATTTGTACAGAGATGGAAAAGGAAGGGAAAATTTCAAAAATTGGGCCTGAAAATCCATACAATACTCCAGTATTTGCCATAAAGAAAAAAGACAGTACTAAATGGAGAAAATTAGTAGATTTCAGAGAACTTAATAAGAGAACTCAAGACTTCTGGGAAGTTCAATTAGGAATACCACATCCCGCAGGGTTAAAAAAGAAAAAATCAGTAACAGTACTGGATGTGGGTGATGCATATTTTTCAGTTCCCTTAGATGAAGACTTCAGGAAGTATACTGCATTTACCATACCTAGTATAAACAATGAGACACCAGGGATTAGATATCAGTACAATGTGCTTCCACAGGGATGGAAAGGATCACCAGCAATATTCCAAAGTAGCATGACAAAAATCTTAGAGCCTTTTAGAAAACAAAATCCAGACATAGTTATCTATCAATACATGGATGATTTGTATGTAGGATCTGACTTAGAAATAGGGCAGCATAGAACAAAAATAGAGGAGCTGAGACAACATCTGTTGAGGTGGGGACTTACCACACCAGACAAAAAACATCAGAAAGAACCTCCATTCCTTTGGATGGGTTATGAACTCCATCCTGATAAATGGACAGTACAGCCTATAGTGCTGCCAGAAAAAGACAGCTGGACTGTCAATGACATACAGAAGTTAGTGGGGAAATTGAATTGGGCAAGTCAGATTTACCCAGGGATTAAAGTAAGGCAATTATGTAAACTCCTTAGAGGAACCAAAGCACTAACAGAAGTAATACCACTAACAGAAGAAGCAGAGCTAGAACTGGCAGAAAACAGAGAGATTCTAAAAGAACCAGTACATGGAGTGTATTATGACCCATCAAAAGACTTAATAGCAGAAATACAGAAGCAGGGGCAAGGCCAATGGACATATCAAATTTATCAAGAGCCATTTAAAAATCTGAAAACAGGAAAATATGCAAGAATGAGGGGTGCCCACACTAATGATGTAAAACAATTAACAGAGGCAGTGCAAAAAATAACCACAGAAAGCATAGTAATATGGGGAAAGACTCCTAAATTTAAACTGCCCATACAAAAGGAAACATGGGAAACATGGTGGACAGAGTATTGGCAAGCCACCTGGATTCCTGAGTGGGAGTTTGTTAATACCCCTCCCTTAGTGAAATTATGGTACCAGTTAGAGAAAGAACCCATAGTAGGAGCAGAAACCTTCTATGTAGATGGGGCAGCTAACAGGGAGACTAAATTAGGAAAAGCAGGATATGTTACTAATAGAGGAAGACAAAAAGTTGTCACCCTAACTGACACAACAAATCAGAAGACTGAGTTACAAGCAATTTATCTAGCTTTGCAGGATTCGGGATTAGAAGTAAACATAGTAACAGACTCACAATATGCATTAGGAATCATTCAAGCACAACCAGATCAAAGTGAATCAGAGTTAGTCAATCAAATAATAGAGCAGTTAATAAAAAAGGAAAAGGTCTATCTGGCATGGGTACCAGCACACAAAGGAATTGGAGGAAATGAACAAGTAGATAAATTAGTCAGTGCTGGAATCAGGAAAGTACTATTTTTAGATGGAATAGATAAGGCCCAAGATGAACATGAGAAATATCACAGTAATTGGAGAGCAATGGCTAGTGATTTTAACCTGCCACCTGTAGTAGCAAAAGAAATAGTAGCCAGCTGTGATAAATGTCAGCTAAAAGGAGAAGCCATGCATGGACAAGTAGACTGTAGTCCAGGAATATGGCAACTAGATTGTACACATTTAGAAGGAAAAGTTATCCTGGTAGCAGTTCATGTAGCCAGTGGATATATAGAAGCAGAAGTTATTCCAGCAGAAACAGGGCAGGAAACAGCATATTTTCTTTTAAAATTAGCAGGAAGATGGCCAGTAAAAACAATACATACTGACAATGGCAGCAATTTCACCGGTGCTACGGTTAGGGCCGCCTGTTGGTGGGCGGGAATCAAGCAGGAATTTGGAATTCCCTACAATCCCCAAAGTCAAGGAGTAGTAGAATCTATGAATAAAGAATTAAAGAAAATTATAGGACAGGTAAGAGATCAGGCTGAACATCTTAAGACAGCAGTACAAATGGCAGTATTCATCCACAATTTTAAAAGAAAAGGGGGGATTGGGGGGTACAGTGCAGGGGAAAGAATAGTAGACATAATAGCAACAGACATACAAACTAAAGAATTACAAAAACAAATTACAAAAATTCAAAATTTTCGGGTTTATTACAGGGACAGCAGAAATCCACTTTGGAAAGGACCAGCAAAGCTCCTCTGGAAAGGTGAAGGGGCAGTAGTAATACAAGATAATAGTGACATAAAAGTAGTGCCAAGAAGAAAAGCAAAGATCATTAGGGATTATGGAAAACAGATGGCAGGTGATGATTGTGTGGCAAGTAGACAGGATGAGGATTAGAACATGGAAAAGTTTAGTAAAACACCATATGTATGTTTCAGGGAAAGCTAGGGGATGGTTTTATAGACATCACTATGAAAGCCCTCATCCAAGAATAAGTTCAGAAGTACACATCCCACTAGGGGATGCTAGATTGGTAATAACAACATATTGGGGTCTGCATACAGGAGAAAGAGACTGGCATTTGGGTCAGGGAGTCTCCATAGAATGGAGGAAAAAGAGATATAGCACACAAGTAGACCCTGAACTAGCAGACCAACTAATTCATCTGTATTACTTTGACTGTTTTTCAGACTCTGCTATAAGAAAGGCCTTATTAGGACACATAGTTAGCCCTAGGTGTGAATATCAAGCAGGACATAACAAGGTAGGATCTCTACAATACTTGGCACTAGCAGCATTAATAACACCAAAAAAGATAAAGCCACCTTTGCCTAGTGTTACGAAACTGACAGAGGATAGATGGAACAAGCCCCAGAAGACCAAGGGCCACAGAGGGAGCCACACAATGAATGGACACTAGAGCTTTTAGAGGAGCTTAAGAATGAAGCTGTTAGACATTTTCCTAGGATTTGGCTCCATGGCTTAGGGCAACATATCTATGAAACTTATGGGGATACTTGGGCAGGAGTGGAAGCCATAATAAGAATTCTGCAACAACTGCTGTTTATCCATTTTCAGAATTGGGTGTCGACATAGCAGAATAGGCGTTACTCGACAGAGGAGAGCAAGAAATGGAGCCAGTAGATCCTAGACTAGAGCCCTGGAAGCATCCAGGAAGTCAGCCTAAAACTGCTTGTACCAATTGCTATTGTAAAAAGTGTTGCTTTCATTGCCAAGTTTGTTTCATAACAAAAGCCTTAGGCATCTCCTATGGCAGGAAGAAGCGGAGACAGCGACGAAGAGCTCATCAGAACAGTCAGACTCATCAAGCTTCTCTATCAAAGCAGTAAGTAGTACATGTAACGCAACCTATACCAATAGTAGCAATAGTAGCATTAGTAGTAGCAATAATAATAGCAATAGTTGTGTGGTCCATAGTAATCATAGAATATAGGAAAATATTAAGACAAAGAAAAATAGACAGGTTAATTGATAGACTAATAGAAAGAGCAGAAGACAGTGGCAATGAGAGTGAAGGAGAAATATCAGCACTTGTGGAGATGGGGGTGGAGATGGGGCACCATGCTCCTTGGGATGTTGATGATCTGTAGTGCTACAGAAAAATTGTGGGTCACAGTCTATTATGGGGTACCTGTGTGGAAGGAAGCAACCACCACTCTATTTTGTGCATCAGATGCTAAAGCATATGATACAGAGGTACATAATGTTTGGGCCACACATGCCTGTGTACCCACAGACCCCAACCCACAAGAAGTAGTATTGGTAAATGTGACAGAAAATTTTAACATGTGGAAAAATGACATGGTAGAACAGATGCATGAGGATATAATCAGTTTATGGGATCAAAGCCTAAAGCCATGTGTAAAATTAACCCCACTCTGTGTTAGTTTAAAGTGCACTGATTTGAAGAATGATACTAATACCAATAGTAGTAGCGGGAGAATGATAATGGAGAAAGGAGAGATAAAAAACTGCTCTTTCAATATCAGCACAAGCATAAGAGGTAAGGTGCAGAAAGAATATGCATTTTTTTATAAACTTGATATAATACCAATAGATAATGATACTACCAGCTATAAGTTGACAAGTTGTAACACCTCAGTCATTACACAGGCCTGTCCAAAGGTATCCTTTGAGCCAATTCCCATACATTATTGTGCCCCGGCTGGTTTTGCGATTCTAAAATGTAATAATAAGACGTTCAATGGAACAGGACCATGTACAAATGTCAGCACAGTACAATGTACACATGGAATTAGGCCAGTAGTATCAACTCAACTGCTGTTAAATGGCAGTCTAGCAGAAGAAGAGGTAGTAATTAGATCTGTCAATTTCACGGACAATGCTAAAACCATAATAGTACAGCTGAACACATCTGTAGAAATTAATTGTACAAGACCCAACAACAATACAAGAAAAAGAATCCGTATCCAGAGAGGACCAGGGAGAGCATTTGTTACAATAGGAAAAATAGGAAATATGAGACAAGCACATTGTAACATTAGTAGAGCAAAATGGAATAACACTTTAAAACAGATAGCTAGCAAATTAAGAGAACAATTTGGAAATAATAAAACAATAATCTTTAAGCAATCCTCAGGAGGGGACCCAGAAATTGTAACGCACAGTTTTAATTGTGGAGGGGAATTTTTCTACTGTAATTCAACACAACTGTTTAATAGTACTTGGTTTAATAGTACTTGGAGTACTGAAGGGTCAAATAACACTGAAGGAAGTGACACAATCACCCTCCCATGCAGAATAAAACAAATTATAAACATGTGGCAGAAAGTAGGAAAAGCAATGTATGCCCCTCCCATCAGTGGACAAATTAGATGTTCATCAAATATTACAGGGCTGCTATTAACAAGAGATGGTGGTAATAGCAACAATGAGTCCGAGATCTTCAGACCTGGAGGAGGAGATATGAGGGACAATTGGAGAAGTGAATTATATAAATATAAAGTAGTAAAAATTGAACCATTAGGAGTAGCACCCACCAAGGCAAAGAGAAGAGTGGTGCAGAGAGAAAAAAGAGCAGTGGGAATAGGAGCTTTGTTCCTTGGGTTCTTGGGAGCAGCAGGAAGCACTATGGGCGCAGCCTCAATGACGCTGACGGTACAGGCCAGACAATTATTGTCTGGTATAGTGCAGCAGCAGAACAATTTGCTGAGGGCTATTGAGGCGCAACAGCATCTGTTGCAACTCACAGTCTGGGGCATCAAGCAGCTCCAGGCAAGAATCCTGGCTGTGGAAAGATACCTAAAGGATCAACAGCTCCTGGGGATTTGGGGTTGCTCTGGAAAACTCATTTGCACCACTGCTGTGCCTTGGAATGCTAGTTGGAGTAATAAATCTCTGGAACAGATTTGGAATCACACGACCTGGATGGAGTGGGACAGAGAAATTAACAATTACACAAGCTTAATACACTCCTTAATTGAAGAATCGCAAAACCAGCAAGAAAAGAATGAACAAGAATTATTGGAATTAGATAAATGGGCAAGTTTGTGGAATTGGTTTAACATAACAAATTGGCTGTGGTATATAAAATTATTCATAATGATAGTAGGAGGCTTGGTAGGTTTAAGAATAGTTTTTGCTGTACTTTCTATAGTGAATAGAGTTAGGCAGGGATATTCACCATTATCGTTTCAGACCCACCTCCCAACCCCGAGGGGACCCGACAGGCCCGAAGGAATAGAAGAAGAAGGTGGAGAGAGAGACAGAGACAGATCCATTCGATTAGTGAACGGATCCTTGGCACTTATCTGGGACGATCTGCGGAGCCTGTGCCTCTTCAGCTACCACCGCTTGAGAGACTTACTCTTGATTGTAACGAGGATTGTGGAACTTCTGGGACGCAGGGGGTGGGAAGCCCTCAAATATTGGTGGAATCTCCTACAGTATTGGAGTCAGGAACTAAAGAATAGTGCTGTTAGCTTGCTCAATGCCACAGCCATAGCAGTAGCTGAGGGGACAGATAGGGTTATAGAAGTAGTACAAGGAGCTTGTAGAGCTATTCGCCACATACCTAGAAGAATAAGACAGGGCTTGGAAAGGATTTTGCTATAAGATGGGTGGCAAGTGGTCAAAAAGTAGTGTGATTGGATGGCCTACTGTAAGGGAAAGAATGAGACGAGCTGAGCCAGCAGCAGATAGGGTGGGAGCAGCATCTCGAGACCTGGAAAAACATGGAGCAATCACAAGTAGCAATACAGCAGCTACCAATGCTGCTTGTGCCTGGCTAGAAGCACAAGAGGAGGAGGAGGTGGGTTTTCCAGTCACACCTCAGGTACCTTTAAGACCAATGACTTACAAGGCAGCTGTAGATCTTAGCCACTTTTTAAAAGAAAAGGGGGGACTGGAAGGGCTAATTCACTCCCAAAGAAGACAAGATATCCTTGATCTGTGGATCTACCACACACAAGGCTACTTCCCTGATTAGCAGAACTACACACCAGGGCCAGGGGTCAGATATCCACTGACCTTTGGATGGTGCTACAAGCTAGTACCAGTTGAGCCAGATAAGATAGAAGAGGCCAATAAAGGAGAGAACACCAGCTTGTTACACCCTGTGAGCCTGCATGGGATGGATGACCCGGAGAGAGAAGTGTTAGAGTGGAGGTTTGACAGCCGCCTAGCATTTCATCACGTGGCCCGAGAGCTGCATCCGGAGTACTTCAAGAACTGCTGACATCGAGCTTGCTACAAGGGACTTTCCGCTGGGGACTTTCCAGGGAGGCGTGGCCTGGGCGGGACTGGGGAGTGGCGAGCCCTCAGATCCTGCATATAAGCAGCTGCTTTTTGCCTGTACTGGGTCTCTCTGGTTAGACCAGATCTGAGCCTGGGAGCTCTCTGGCTAACTAGGGAACCCACTGCTTAAGCCTCAATAAAGCTTGCCTTGAGTGCTTCAAGTAGTGTGTGCCCGTCTGTTGTGTGACTCTGGTAACTAGAGATCCCTCAGACCCTTTTAGTCAGTGTGGAAAATCTCTAGCA\"\n hxb2_l = hxb2_ref.size\n head = \"\"\n 8.times {head << (65 + rand(25)).chr}\n temp_file = temp_dir + \"/\" + head + \"_temp\"\n temp_aln = temp_dir + \"/\" + head + \"_temp_aln\"\n\n l1 = 0\n l2 = 0\n name = \">test\"\n temp_in = File.open(temp_file,\"w\")\n temp_in.puts \">ref\"\n temp_in.puts hxb2_ref\n temp_in.puts name\n temp_in.puts seq\n temp_in.close\n\n begin\n print `muscle -in #{temp_file} -out #{temp_aln} -quiet`\n aln_seq = fasta_to_hash(temp_aln)\n aln_test = aln_seq[name]\n aln_test =~ /^(\\-*)(\\w.*\\w)(\\-*)$/\n gap_begin = $1.size\n gap_end = $3.size\n aln_test2 = $2\n ref = aln_seq[\">ref\"]\n ref = ref[gap_begin..(-gap_end-1)]\n ref_size = ref.size\n if ref_size > 1.3*(seq.size)\n l1 = l1 + gap_begin\n l2 = l2 + gap_end\n max_seq = aln_test2.scan(/[ACGT]+/).max_by(&:length)\n aln_test2 =~ /#{max_seq}/\n before_aln_seq = $`\n before_aln = $`.size\n post_aln_seq = $'\n post_aln = $'.size\n before_aln_seq_size = before_aln_seq.scan(/[ACGT]+/).join(\"\").size\n b1 = (1.3 * before_aln_seq_size).to_i\n post_aln_seq_size = post_aln_seq.scan(/[ACGT]+/).join(\"\").size\n b2 = (1.3 * post_aln_seq_size).to_i\n if (before_aln > seq.size) and (post_aln <= seq.size)\n ref = ref[(before_aln - b1)..(ref_size - post_aln - 1)]\n l1 = l1 + (before_aln - b1)\n elsif (post_aln > seq.size) and (before_aln <= seq.size)\n ref = ref[before_aln..(ref_size - post_aln - 1 + b2)]\n l2 = l2 + post_aln - b2\n elsif (post_aln > seq.size) and (before_aln > seq.size)\n ref = ref[(before_aln - b1)..(ref_size - post_aln - 1 + b2)]\n l1 = l1 + (before_aln - b1)\n l2 = l2 + (post_aln - b2)\n end\n temp_in = File.open(temp_file,\"w\")\n temp_in.puts \">ref\"\n temp_in.puts ref\n temp_in.puts name\n temp_in.puts seq\n temp_in.close\n print `muscle -in #{temp_file} -out #{temp_aln} -quiet`\n aln_seq = fasta_to_hash(temp_aln)\n aln_test = aln_seq[name]\n aln_test =~ /^(\\-*)(\\w.*\\w)(\\-*)$/\n gap_begin = $1.size\n gap_end = $3.size\n aln_test2 = $2\n ref = aln_seq[\">ref\"]\n ref = ref[gap_begin..(-gap_end-1)]\n ref_size = ref.size\n end\n aln_seq = fasta_to_hash(temp_aln)\n aln_test = aln_seq[name]\n aln_test =~ /^(\\-*)(\\w.*\\w)(\\-*)$/\n gap_begin = $1.size\n gap_end = $3.size\n aln_test = $2\n aln_test =~ /^(\\w+)(\\-*)\\w/\n s1 = $1.size\n g1 = $2.size\n aln_test =~ /\\w(\\-*)(\\w+)$/\n s2 = $2.size\n g2 = $1.size\n ref = aln_seq[\">ref\"]\n ref = ref[gap_begin..(-gap_end-1)]\n\n l1 = l1 + gap_begin\n l2 = l2 + gap_end\n repeat = 0\n\n if g1 == g2 and (s1 + g1 + s2) == ref.size\n if s1 > s2 and g2 > 2*s2\n ref = ref[0..(-g2-1)]\n repeat = 1\n l2 = l2 + g2\n elsif s1 < s2 and g1 > 2*s1\n ref = ref[g1..-1]\n repeat = 1\n l1 = l1 + g1\n end\n else\n if g1 > 2*s1\n ref = ref[g1..-1]\n repeat = 1\n l1 = l1 + g1\n end\n if g2 > 2*s2\n ref = ref[0..(-g2 - 1)]\n repeat = 1\n l2 = l2 + g2\n end\n end\n\n while repeat == 1\n temp_in = File.open(temp_file,\"w\")\n temp_in.puts \">ref\"\n temp_in.puts ref\n temp_in.puts name\n temp_in.puts seq\n temp_in.close\n print `muscle -in #{temp_file} -out #{temp_aln} -quiet`\n aln_seq = fasta_to_hash(temp_aln)\n aln_test = aln_seq[name]\n aln_test =~ /^(\\-*)(\\w.*\\w)(\\-*)$/\n gap_begin = $1.size\n gap_end = $3.size\n aln_test = $2\n aln_test =~ /^(\\w+)(\\-*)\\w/\n s1 = $1.size\n g1 = $2.size\n aln_test =~ /\\w(\\-*)(\\w+)$/\n s2 = $2.size\n g2 = $1.size\n ref = aln_seq[\">ref\"]\n ref = ref[gap_begin..(-gap_end-1)]\n l1 = l1 + gap_begin\n l2 = l2 + gap_end\n repeat = 0\n if g1 > 2*s1\n ref = ref[g1..-1]\n repeat = 1\n l1 = l1 + g1\n end\n if g2 > 2*s2\n ref = ref[0..(-g2 - 1)]\n repeat = 1\n l2 = l2 + g2\n end\n end\n ref = hxb2_ref[l1..(hxb2_l - l2 - 1)]\n\n temp_in = File.open(temp_file,\"w\")\n temp_in.puts \">ref\"\n temp_in.puts ref\n temp_in.puts name\n temp_in.puts seq\n temp_in.close\n print `muscle -in #{temp_file} -out #{temp_aln} -quiet`\n aln_seq = fasta_to_hash(temp_aln)\n aln_test = aln_seq[name]\n ref = aln_seq[\">ref\"]\n\n #refine alignment\n\n if ref =~ /^(\\-+)/\n l1 = l1 - $1.size\n elsif ref =~ /(\\-+)$/\n l2 = l2 + $1.size\n end\n\n if (hxb2_l - l2 - 1) >= l1\n ref = hxb2_ref[l1..(hxb2_l - l2 - 1)]\n temp_in = File.open(temp_file,\"w\")\n temp_in.puts \">ref\"\n temp_in.puts ref\n temp_in.puts name\n temp_in.puts seq\n temp_in.close\n print `muscle -in #{temp_file} -out #{temp_aln} -quiet`\n aln_seq = fasta_to_hash(temp_aln)\n aln_test = aln_seq[name]\n ref = aln_seq[\">ref\"]\n\n ref_size = ref.size\n sim_count = 0\n (0..(ref_size-1)).each do |n|\n ref_base = ref[n]\n test_base = aln_test[n]\n sim_count += 1 if ref_base == test_base\n end\n similarity = (sim_count/ref_size.to_f*100).round(1)\n print `rm -f #{temp_file}`\n print `rm -f #{temp_aln}`\n loc_p1 = l1 + 1\n loc_p2 = hxb2_l - l2\n if seq.size != (loc_p2 - loc_p1 + 1)\n indel = true\n elsif aln_test.include?(\"-\")\n indel = true\n else\n indel = false\n end\n return [loc_p1,loc_p2,similarity,indel,aln_test,ref]\n else\n return [0,0,0,0,0,0,0]\n end\n rescue\n print `rm -f #{temp_file}`\n print `rm -f #{temp_aln}`\n return [0,0,0,0,0,0,0]\n end\nend",
"def start; @sequence[0]; end",
"def submit_dna(sequence)\n\n\n params = Hash.new\n params['email'] = '[email protected]'\n params['title'] = 'test_web_service'\n params['sequence'] = sequence\n #clustalw2 specific params\n params['format'] = 'fasta' #\n params['alignment'] = 'fast' #slow\n #params['quicktree'] = 0\n params['type'] = 'dna'\n params['output'] = 'phylip'\n\n\n #call inherited\n return run_params(params)\n\n\n end",
"def convert_alignment(args={})\n i, o = args[:in], args[:out]\n \n ff = Bio::FlatFile.auto(i).to_a\n aln = Bio::Alignment.new(ff)\n File.open(o, 'w') do |o|\n o.write aln.output :phylip\n end\n \nend",
"def calculate_sequence\n old_sequence.split('')[1..-1].each(&method(:fill_recurrence))\n\n apply_recurrence\n\n recurrences.flatten.join\n end",
"def seqshash_to_fastafile(seqs,filename)\n oa = Bio::Alignment::OriginalAlignment.new(seqs)\n string_to_file(oa.output(:fasta),filename)\n\n end",
"def mutations_effect(a_anno, a_gen)\n\n if $locus[a_anno[10]] && a_anno[3].length == a_anno[4].length\n $cdna.pos = $locus[a_anno[10]]\n transcript = original()\n exon_starts = a_gen[9].split(',')\n exon_ends = a_gen[10].split(',')\n mutation_position,exon_num = position_on_transcript(a_anno[1],a_gen[3],exon_starts,exon_ends,a_gen[6],a_gen[7])\n a_anno[12] = \"exon#{exon_num}\"\n start_triplet = (mutation_position/3 * 3) - 1\n if start_triplet >= 0\n code = transcript[start_triplet..start_triplet+2]\n pos_in_triplet = mutation_position%3\n original_aa = $codes[code]\n code[pos_in_triplet] = a_anno[4]\n mutated_aa = $codes[code[0..2]]\n if original_aa != mutated_aa\n a_anno[13] = pos_in_triplet + 1\n a_anno[14] = original_aa[:name]\n a_anno[15] = mutated_aa[:name]\n puts a_anno.join(\"\\t\")\n else\n a_anno[13] = \"same_AA\"\n STDERR.puts a_anno.join(\"\\t\")\n end\n end\n else\n if $locus_non_coding[a_anno[10]]\n a_anno[13] = \"ncrna\"\n STDERR.puts a_anno.join(\"\\t\")\n else\n if (a_anno[3].length > a_anno[4].length || a_anno[3].length < a_anno[4].length)\n a_anno[13] = \"indel\"\n puts a_anno.join(\"\\t\")\n else\n a_anno[13] = \"?\"\n STDERR.puts a_anno.join(\"\\t\")\n end\n end\n end\n\nend",
"def fetch_ancestral_sequence(start=0,stop=self.length)\n self.genomic_aligns.select{|c| c.find_organism == \"Ancestral sequences\"}.each do |contig|\n puts contig.find_organism\n #return contig.aligned_sequence[start..stop]\n end\n end",
"def generate_sentence\n # Splitting into an array is required for easily preventing duplicate vals\n sent = Drama::Constants::SENTENCES.sample.split(/\\s/)\n sent.each do |w|\n num = sent.index(w)\n sent[num] = w % {\n things: Drama::Constants::THINGS.sample,\n sites: Drama::Constants::SITES.sample,\n people: Drama::Constants::PEOPLE.sample,\n says: Drama::Constants::SAYS.sample,\n badsoft: Drama::Constants::BADSOFT.sample,\n function: Drama::Constants::FUNCTIONS.sample,\n adj: Drama::Constants::ADJECTIVES.sample,\n enormous: Drama::Constants::SIZES.sample,\n price: Drama::Constants::PRICES.sample,\n ac1: Drama::Constants::BADVERBS.sample,\n packs: Drama::Constants::PACKS.sample,\n drama: Drama::Constants::DRAMA.sample,\n code: Drama::Constants::CODE.sample,\n ban: Drama::Constants::BANS.sample,\n activates: Drama::Constants::ACTIVATES.sample\n }\n end\n\n # add_a_drama\n sent.join(' ')\n end",
"def perform_sequence(plateau)\n @sequence.each_char do |chr|\n case chr\n when 'L' then turn_left\n when 'R' then turn_right\n when 'M'\n move_forward\n unless plateau.location_is_safe?(@coords_x, @coords_y)\n life_death_toggle\n break\n end\n end\n end\n end",
"def pep2genomic(pos)\n raise NotImplementedError\n end",
"def asignar_proteinas(proteinas)\n @proteinas=proteinas\n end",
"def submit_protein(sequence)\n\n\n params = Hash.new\n params['email'] = '[email protected]'\n params['title'] = 'test_web_service'\n params['sequence'] = sequence\n #clustalw2 specific params\n params['format'] = 'fasta' #\n params['alignment'] = 'fast' #slow\n #params['quicktree'] = 0\n params['type'] = 'protein'\n params['output'] = 'phylip'\n\n\n #call inherited\n return run_params(params)\n\n end",
"def to_rsphylip\n seqs = self.dna_hash\n outline = \"\\s\" + seqs.size.to_s + \"\\s\" + seqs.values[0].size.to_s + \"\\n\"\n names = seqs.keys\n names.collect!{|n| n.tr(\">\", \"\")}\n max_name_l = names.max.size\n max_name_l > 10 ? name_block_l = max_name_l : name_block_l = 10\n seqs.each do |k,v|\n outline += k + \"\\s\" * (name_block_l - k.size + 2) + v.scan(/.{1,10}/).join(\"\\s\") + \"\\n\"\n end\n return outline\n end",
"def set_sequence\n if seq!= nil\n sequence=\"\"\n seq.each_with_index do |s,index|\n sequence = sequence + s +\",\"\n end\n if examquestion_ids.count > seq.count\n diff_count = examquestion_ids.count - seq.count\n 0.upto(diff_count-1) do |c|\n sequence = sequence + \"Select\"+\",\"\n end\n end \n self.sequ = sequence \n end\n end",
"def set_sequence\n if seq!= nil\n sequence=\"\"\n seq.each_with_index do |s,index|\n sequence = sequence + s +\",\"\n end\n if examquestion_ids.count > seq.count\n diff_count = examquestion_ids.count - seq.count\n 0.upto(diff_count-1) do |c|\n sequence = sequence + \"Select\"+\",\"\n end\n end \n self.sequ = sequence \n end\n end",
"def prepare_sequence(sequence)\n nv = remove_non_amino_acids(sequence)\n split_sequence(nv)\n end",
"def all_else_dna(dna)\n # Input: A\n # Output: C G T\n # Input: C\n # Output: A G T\n dna_a = [\"A\", \"C\", \"G\", \"T\"]\n # puts dna_a.join(\" \")\n dna_a.delete(dna)\n # puts dna_a.join(\" \")\n return dna_a\n end",
"def hiv_seq_qc(start_nt, end_nt, indel=true, ref_option = :HXB2, path_to_muscle = false)\n start_nt = start_nt..start_nt if start_nt.is_a?(Integer)\n end_nt = end_nt..end_nt if end_nt.is_a?(Integer)\n seq_hash = self.dna_hash.dup\n seq_hash_unique = seq_hash.values.uniq\n seq_hash_unique_pass = []\n\n seq_hash_unique.each do |seq|\n next if seq.nil?\n loc = ViralSeq::Sequence.new('', seq).locator(ref_option, path_to_muscle)\n next unless loc # if locator tool fails, skip this seq.\n if start_nt.include?(loc[0]) && end_nt.include?(loc[1])\n if indel\n seq_hash_unique_pass << seq\n elsif loc[3] == false\n seq_hash_unique_pass << seq\n end\n end\n end\n seq_pass = []\n seq_hash_unique_pass.each do |seq|\n seq_hash.each do |seq_name, orginal_seq|\n if orginal_seq == seq\n seq_pass << seq_name\n seq_hash.delete(seq_name)\n end\n end\n end\n self.sub(seq_pass)\n end",
"def fastq_to_fasta(fastq_file)\n count = 0\n sequence_a = []\n count_seq = 0\n\n File.open(fastq_file,'r') do |file|\n file.readlines.collect do |line|\n count +=1\n count_m = count % 4\n if count_m == 1\n line.tr!('@','>')\n sequence_a << line.chomp\n count_seq += 1\n elsif count_m == 2\n sequence_a << line.chomp\n end\n end\n end\n sequence_hash = Hash[*sequence_a]\nend",
"def rand_start\n @dna = [0] * @target.length\n @dna.map! { |i| @@dna_decoder.keys.sample }\n end"
] | [
"0.6554843",
"0.64947975",
"0.6158699",
"0.60337305",
"0.5968296",
"0.5963453",
"0.5910268",
"0.5885515",
"0.58660525",
"0.58171636",
"0.5802675",
"0.5797402",
"0.5782115",
"0.57353973",
"0.5722169",
"0.5709884",
"0.5706161",
"0.56867725",
"0.56834424",
"0.56555855",
"0.5643596",
"0.5623459",
"0.56029034",
"0.55984104",
"0.5597454",
"0.5594922",
"0.55920583",
"0.5591328",
"0.5550161",
"0.55268526",
"0.5509537",
"0.549017",
"0.5481651",
"0.5461755",
"0.5458883",
"0.5447371",
"0.5431262",
"0.5422851",
"0.53940105",
"0.53898",
"0.53886586",
"0.5382132",
"0.53739065",
"0.5367566",
"0.5366669",
"0.5361401",
"0.5361175",
"0.535558",
"0.53551435",
"0.5311132",
"0.5308478",
"0.5302759",
"0.5302337",
"0.5294442",
"0.52923185",
"0.5271244",
"0.52590764",
"0.52314186",
"0.52283794",
"0.5224023",
"0.5214861",
"0.5201779",
"0.5199262",
"0.5190617",
"0.51723903",
"0.5169793",
"0.5167649",
"0.51609814",
"0.5156935",
"0.5150105",
"0.5147671",
"0.5141268",
"0.51201415",
"0.51185346",
"0.5102227",
"0.5099501",
"0.5085347",
"0.50816166",
"0.507873",
"0.5076738",
"0.50750774",
"0.50716925",
"0.50648475",
"0.5061344",
"0.505653",
"0.5056063",
"0.5054017",
"0.5041478",
"0.50345296",
"0.5033691",
"0.502973",
"0.502005",
"0.50081426",
"0.5005533",
"0.5005533",
"0.5005318",
"0.50022846",
"0.50017375",
"0.49988586",
"0.49974543"
] | 0.77522105 | 0 |
True if enabled verbose mode, false otherwise | def verbose_mode?
@output_level == :verbose
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def verbose?\n @verbose ||= !!options[:verbose]\n end",
"def verbose?\n @verbose\n end",
"def verbose?\n @options[:verbose]\n end",
"def verbose?\n @verbose_output\n end",
"def verbose?\n ENV['VERBOSE']\n end",
"def verbose?\n options.verbose?\n end",
"def verbose?\n @verbose\n end",
"def verbose?\n @options.verbose\n end",
"def verbose?\n @options.verbose\n end",
"def verbose?\n verbose = ENV['VERBOSE']\n verbose && verbose =~ /^true$/i ? true : false\n end",
"def verbose?\n @options[:verbose]\n end",
"def verbose?\n @default_options[ :verbose ]\n end",
"def verbose?\n if @@verbose == true\n return \"Verbose output to console has been enabled.\"\n elsif @@verbose == false\n return \"Verbose output to console has not been enabled\"\n end\n\n end",
"def verbose?\n @run_verbose ||= nil\n end",
"def verbose?\n options[:verbose]\n end",
"def is_verbose?\n options.include?(\"-v\")\n end",
"def really_verbose\n case verbose\n when true, false, nil then\n false\n else\n true\n end\n end",
"def verbose?\n @config.verbose?\n end",
"def verbose?\n options && options[:verbosity] && options[:verbosity] > 0\n end",
"def verbose\n @verbose || false\n end",
"def verbose?() @opts.verbose?; end",
"def verbose\n false\n end",
"def verbose?\n !!ENV[\"DEBUG\"]\nend",
"def verbose_mode?\n if Rake.respond_to?(:verbose)\n # Rake 0.9.x\n Rake.verbose == true\n else\n # Rake 0.8.x\n RakeFileUtils.verbose_flag != :default\n end\n end",
"def verbose!\n @verbose = true\n end",
"def verbose; @config[:verbose]; end",
"def verbose(true_or_false = true)\n @_verbose = true_or_false\n EtherShell::ShellDsl.nothing\n end",
"def verbose=(value) @verbose = true; end",
"def verbose(tf=true)\n @verbose = tf\n end",
"def verbose(max_level = false)\n #logger.unknown \"Rack::Insight::Logging.verbosity: #{Rack::Insight::Logging.verbosity} <= max_level: #{VERBOSITY[max_level]}\" #for debugging the logger\n return false if (!verbosity) # false results in Exactly Zero output!\n return true if (verbosity == true) # Not checking truthy because need to check against max_level...\n # Example: if configured log spam level is high (1) logger should get all messages that are not :debug (0)\n # so, if a log statement has if verbose(:low) (:low is 3)\n # 1 <= 3 # true => Message sent to logger\n # then, if a log statement has if verbose(:debug) (:debug is 0)\n # 1 <= 0 # false => Nothing sent to logger\n return true if verbosity <= (Rack::Insight::Config::VERBOSITY[max_level]) # Integers!\n end",
"def verbose=(val)\n @verbose=val\n end",
"def verbose?\n if @verbose.nil?\n if @io.kind_of?(ReidlineInputMethod)\n false\n elsif defined?(ReadlineInputMethod) && @io.kind_of?(ReadlineInputMethod)\n false\n elsif !STDIN.tty? or @io.kind_of?(FileInputMethod)\n true\n else\n false\n end\n else\n @verbose\n end\n end",
"def verbose\n @commands_and_opts.push OPTIONAL_OPTS[:verbose]\n self\n end",
"def verbose(value = nil)\n configure(:verbose, value)\n end",
"def verbose_option\n !!jekyll_sass_configuration.fetch(\"verbose\", false)\n end",
"def verbose=(value)\n Curl.set_option(:verbose, value_for(value, :bool), handle)\n end",
"def run_verbose!\n @run_verbose = true\n end",
"def verbose=(v); @config[:verbose]=v; end",
"def verbose(string_to_output)\n puts string_to_output if $verbose\nend",
"def set_verbosity\n @@option_debug = (options[:debug]) ? true : false\n @@option_verbose = (options[:verbose] || options[:debug]) ? true : false\n end",
"def verbose\n variable(:scm_verbose) ? nil : \"-q\"\n end",
"def set_verbosity\n @@option_debug = options[:debug] ? true : false\n @@option_verbose = options[:verbose] || options[:debug] ? true : false\n end",
"def verbose_output=(flag)\n @verbose_output = flag\n end",
"def verbose\n \"-q\"\n end",
"def verbose(tf)\n @verbose = tf\n end",
"def verbose; datastore['VERBOSE']; end",
"def verbose\n nil#configuration[:scm_verbose] ? nil : \"-q\"\n end",
"def verbose(string)\n if $verbose\n puts string\n end\nend",
"def verbose(m)\n $stderr.puts(m) if $verbose\nend",
"def verbose=(flag)\r\n self.conf[:verbose] = flag\r\n $stdout.sync = flag\r\n end",
"def verbose\n return unless ENV['VER'] && !@hide_inside\n str = type?(yield, String)\n msg = __make_msg(str)\n return unless ___chk_ver(msg) || (@enclosed ||= []).any?\n __prt_lines(msg)\n true\n end",
"def show_log?\n @runopts[:show_log] ||= false\n end",
"def get_cli_debug\n if ENV.include?(\"debug\")\n if ENV[\"debug\"] == \"false\" || ENV[\"debug\"] == \"0\"\n $options[:verbose] = false\n else\n $options[:verbose] = true\n end\n else\n # default is on!\n $options[:verbose] = true\n end\n end",
"def verbosity\n options[:verbosity] || NONE\n end",
"def add_verbose(current_string, builder_mode)\n variable_override = if builder_mode == BuilderMode::EXECUTE\n true\n else\n @verbose_output\n end\n add_if_present(variable_override, current_string, \" -v \")\n end",
"def verbosity\n get_value :verbosity\n end",
"def verbose(&block)\n with_verbose(true, &block)\n end",
"def verbose(&block)\n with_verbose(true, &block)\n end",
"def puts_verbose(s = \"\")\n puts s if $VERBOSE\nend",
"def verbosity\n runopts(:verbosity) || 1\n end",
"def setVerbosity(v)\n @verbose = v\n end",
"def verbose text\n message(text) if @options[:verbose]\n end",
"def verbose text\n message(text) if @options[:verbose]\n end",
"def debug?\n\t\t!!@debuggable_status\n\tend",
"def debug_mode\n @@debug_mode == 1\n end",
"def debugging?\n Options[:debug]\n end",
"def verbose( text )\n $stderr.puts text if $params[ :verbose ]\nend",
"def verbose_logging; end",
"def trace?\n Options[:trace]\n end",
"def debug_mode?\n @@debug_mode\n end",
"def debug?\n self[:debug] == 'true'\n end",
"def verbose!\n @actor << 'VERBOSE'\n end",
"def debugging?\n\t\t(datastore['DEBUG'] || '') =~ /^(1|t|y)/i\n\tend",
"def quiet\n @verbosity.zero?\n end",
"def quiet\n @verbosity.zero?\n end",
"def debug?\n !!self.debug\n end",
"def debug?\n !!@debug\n end",
"def inspect?\n @inspect_mode.nil? or @inspect_mode\n end",
"def debug_through?\r\n return false\r\n end",
"def vlt_mode?\n !!iom_mode.match(/vlt/i)\n end",
"def debug?\n false\n end",
"def debug?\n instance.options[:debug]\n end",
"def debug?\n instance.options[:debug]\n end",
"def quiet= bool\n @verbosity = bool ? 0 : 1\n end",
"def debug?\n true\n end",
"def debug?\n true\n end",
"def debug?\n @@debug\n end",
"def debug?\n @@debug\n end",
"def show_command?\n ENV['DEBUG'] || ENV['SHOW_COMMAND']\n end",
"def verbose(msg = nil)\n say(clean_text(msg || yield)) if Gem.configuration.really_verbose\n end",
"def should_print?\n !@suppress_output\n end",
"def quiet_mode?\n @@quiet_mode\n end",
"def debug?; run_options[:debug]; end",
"def quiet?\n return false if verbose?\n \n quiet = ENV['QUIET']\n quiet.nil? || quiet =~ /^true$/i ? true : false\n end",
"def process_options\n @options.verbose = false if @options.quiet\n end",
"def verbose(*args)\n if @verbose\n $stderr.puts args\n end\n end",
"def logging_enabled?\n !!logging_enabled\n end",
"def dryrun?\n @default_options[ :dryrun ]\n end",
"def debug?\n !!@debug # rubocop:disable Style/DoubleNegation\n end",
"def debug?\n @level <= 0\n end"
] | [
"0.87371767",
"0.8724991",
"0.866884",
"0.8655055",
"0.8603056",
"0.8598856",
"0.85889673",
"0.85677564",
"0.85677564",
"0.8550767",
"0.85381067",
"0.85202295",
"0.84754527",
"0.8462254",
"0.8460945",
"0.84185976",
"0.8409885",
"0.8395572",
"0.82515574",
"0.82280624",
"0.82161325",
"0.8083826",
"0.79981476",
"0.7697491",
"0.75792396",
"0.7578157",
"0.73436403",
"0.7327488",
"0.7259261",
"0.7135678",
"0.70610744",
"0.7041284",
"0.70127016",
"0.6919328",
"0.68131435",
"0.6808095",
"0.6772605",
"0.6769411",
"0.67530894",
"0.6744787",
"0.67041147",
"0.66984963",
"0.6691983",
"0.6677771",
"0.66737294",
"0.6660518",
"0.6646169",
"0.65920573",
"0.65854305",
"0.6574715",
"0.65079916",
"0.6421812",
"0.6416058",
"0.6395551",
"0.6384309",
"0.63760835",
"0.6375345",
"0.6375345",
"0.6375281",
"0.63599527",
"0.6348347",
"0.6327525",
"0.6327525",
"0.62671417",
"0.6257211",
"0.6250762",
"0.62458867",
"0.6228331",
"0.6188097",
"0.6169533",
"0.6116179",
"0.60929155",
"0.6089659",
"0.6078444",
"0.6078444",
"0.60761887",
"0.606365",
"0.6045608",
"0.6037093",
"0.60305816",
"0.6027221",
"0.6016613",
"0.6016613",
"0.60139245",
"0.5967187",
"0.5967187",
"0.5940901",
"0.59383625",
"0.58758634",
"0.5861752",
"0.5859269",
"0.585409",
"0.5845115",
"0.58436906",
"0.58411956",
"0.5833195",
"0.58233875",
"0.58102924",
"0.5809084",
"0.5798253"
] | 0.87636286 | 0 |
True if enabled silence mode, false otherwise | def silence_mode?
@output_level == :silence
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def silentMode mode\r\n\t\t@silentMode = !mode\r\n\tend",
"def silence=(value)\n @silence = value\n end",
"def kiosk_mode_require_mono_audio\n return @kiosk_mode_require_mono_audio\n end",
"def quiet_mode?\n @@quiet_mode\n end",
"def suppressed?\n @suppressed\n end",
"def audio?\n !!audio_stream\n end",
"def audio_without_closed_captions?\n audio? && closed_captions.blank?\n end",
"def logging_enabled?\n !!logging_enabled\n end",
"def quiet?\n false\n end",
"def suppressed?\n status == 'suppressed'\n end",
"def muted?\n @mute\n end",
"def has_audio?\n return !!get_audio\n end",
"def sound_attack?\n return data.sound_attack\n end",
"def suppress?\n !!@suppress\n end",
"def recording_consent_required?\n @settings.get_value(\"Require Recording Consent\") == \"true\"\n end",
"def audio?\n has_stream_of :audio\n end",
"def audio?\n #or @volume == 0\n if @mute or @type == \"image\"\n #puts \"no audio\"\n return false\n else\n #puts \"has audio\"\n return true\n end\n end",
"def recording_events?\n false\n end",
"def protected\n match(/has\\s(enabled)\\snick\\sprotection/) ? true : false\n end",
"def enabled?\n !suspended\n end",
"def kiosk_mode_require_voice_over\n return @kiosk_mode_require_voice_over\n end",
"def quiet\n true\n end",
"def threshold_enabled?\n @enable_threshold\n end",
"def mono?\n @channels == 1\n end",
"def mono?\n @channels == 1\n end",
"def mute?\n @midi.output.mute?\n end",
"def suppressed? ; @suppressed ; end",
"def listen?\n @paused == false\n end",
"def kiosk_mode_allow_voice_over_settings\n return @kiosk_mode_allow_voice_over_settings\n end",
"def quiet?\n return @quiet\n end",
"def quiet?\n config.quiet\n end",
"def always_on?\n false\n end",
"def quiet?\n @quiet\n end",
"def listen?\n @paused == false && @stopping == false\n end",
"def autoplay_blocked_by_level?\n # Wrapped since we store our serialized booleans as strings.\n self.never_autoplay_video == 'true'\n end",
"def is_silence?( statement )\n statement =~ /\\A[[:space:]]*\\z/\n end",
"def audio?\n @descriptive_detail.audio?\n end",
"def audio?\n codec_type == 'audio'\n end",
"def media_bypass_enabled\n return @media_bypass_enabled\n end",
"def quiet?\n options[:quiet]\n end",
"def audio?\n self.sti_type == AUDIO_TYPE\n end",
"def no_recapture\n @recapture = false\n end",
"def threshold_disabled?\n !@enable_threshold\n end",
"def trace_disabled?(options)\n !(traced? || options[:force])\n end",
"def playable?\n false\n end",
"def speaker?\n !self.speaker_on.empty?\n end",
"def capturing?\n @capture_on ? true : false\n end",
"def regular?\n @capture_on ? false : true\n end",
"def silence!\n IO.console.raw!\n end",
"def off?\n return true if eql? :off\n false\n end",
"def enabled?\n !!PaperTrail.config.enabled\n end",
"def silence_warnings(silence = true)\n @silence_warnings = silence\n end",
"def enabled\n !false?(configuration[:enabled])\n end",
"def quiet\n @verbosity.zero?\n end",
"def quiet\n @verbosity.zero?\n end",
"def audio?\n not audio_formats.empty?\n end",
"def enabled?\n !@test_mode || @test_mode == :enabled\n end",
"def playing?\n connection.write(\"is_playing\", false) == \"1\"\n end",
"def playing?\n connection.write(\"is_playing\", false) == \"1\"\n end",
"def playing?\n connection.write(\"is_playing\", false) == \"1\"\n end",
"def kiosk_mode_require_mono_audio=(value)\n @kiosk_mode_require_mono_audio = value\n end",
"def turned_off?\n ENV['KNIFESWITCH']&.downcase == 'off'\n end",
"def write_enabled\n enabled = true\n TwitPic::Config.instance_methods.grep(/\\w=$/).each do |method|\n enabled = false unless @config.send(method.to_s.chop).strip.length > 0\n end\n end",
"def absorbent?\n @absorbent\n end",
"def off?\n @level >= ::Logging::LEVELS.length\n end",
"def kiosk_mode_allow_assistive_speak\n return @kiosk_mode_allow_assistive_speak\n end",
"def enabled?\n false\n end",
"def silence(&block)\n begin\n was_silenced = @silenced\n @silenced = true\n yield if block_given?\n ensure\n @silenced = was_silenced\n end\n end",
"def auto_instrument?\n false\n end",
"def auto_instrument?\n false\n end",
"def should_print?\n !@suppress_output\n end",
"def sound_volume_control_enabled\n @ole.SoundVolumeControlEnabled\n end",
"def audio?\n if mime_type == 'application/mxf'\n !ffprobe.codec_type.any? {|type| type == 'video'}\n else\n super\n end\n end",
"def enabled?\n [email protected]? || (active? && connection.is_experiment_enabled?(@id))\n end",
"def track?\n type == \"track\"\n end",
"def console_output?\n false\n end",
"def enabled?\n !!configuration.enabled\n end",
"def trace?\n Options[:trace]\n end",
"def silence context\n if context.respond_to? :silenced=\n old_silenced, context.silenced = context.silenced, true\n end\n\n yield\n ensure\n context.silenced = old_silenced if context.respond_to? :silenced=\n end",
"def tracking_enabled?\n Thread.current[track_history_flag] != false\n end",
"def has_sound?\n !!self.sound\n end",
"def muted?\n @args[:props][\"mute\"] == \"yes\"\n end",
"def noise?\n @cr[0xd][7] == 1\n end",
"def enabled?\n false\n end",
"def audio?\n !!( content_type =~ Transit.config.audio_regexp )\n end",
"def promiscuous?\n\t\t\treturn false\n\t\tend",
"def notification?\n false\n end",
"def pretend?\n options[:pretend] == true\n end",
"def toggable?\n return @switch != nil\n end",
"def should_log?\n return false if @skip_logging\n true\n end",
"def is_being_suppressed?\n\t\treturn false if !suppressed?\n\t\tif DateTime.now.to_f - suppressed.to_f > 30 * 60\n\t\t\tself.suppressed = nil\n\t\t\tself.save\n\t\t\treturn false\n\t\tend\n\t\ttrue\n\tend",
"def splayed?\n splayed\n end",
"def universal_psych_support?\n false || !syck_available?\n end",
"def quiet?\n return false if verbose?\n \n quiet = ENV['QUIET']\n quiet.nil? || quiet =~ /^true$/i ? true : false\n end",
"def recording?\n @decision != Decision::DROP\n end",
"def signal?\n @signal\n end",
"def suspended?\n (status == SUSPEND)\n end",
"def enabled\n @mutex.synchronize { !!@enabled }\n end",
"def enabled\n @mutex.synchronize { !!@enabled }\n end",
"def enabled\n @mutex.synchronize { !!@enabled }\n end"
] | [
"0.6956469",
"0.68906647",
"0.66498286",
"0.65987605",
"0.6543598",
"0.64025843",
"0.6348118",
"0.63417685",
"0.63307863",
"0.627814",
"0.62723184",
"0.6271102",
"0.6265686",
"0.62561756",
"0.62256557",
"0.62167805",
"0.61764544",
"0.61732996",
"0.6155254",
"0.6146577",
"0.6144631",
"0.61278135",
"0.6127779",
"0.61269027",
"0.61269027",
"0.6116969",
"0.6115121",
"0.60765535",
"0.60582405",
"0.6056147",
"0.6049393",
"0.6046402",
"0.60349816",
"0.6018871",
"0.6011355",
"0.5986575",
"0.5982889",
"0.59663546",
"0.5950191",
"0.5942592",
"0.5931869",
"0.5927829",
"0.5923202",
"0.5911122",
"0.5910846",
"0.58937097",
"0.587686",
"0.5852558",
"0.58461165",
"0.5845616",
"0.580355",
"0.58015805",
"0.5799242",
"0.5781713",
"0.5781713",
"0.57811844",
"0.57766336",
"0.5774643",
"0.5774643",
"0.5774643",
"0.57651573",
"0.57630914",
"0.5761598",
"0.57569563",
"0.5754641",
"0.57353187",
"0.5731574",
"0.5728733",
"0.5719704",
"0.5719704",
"0.57194954",
"0.5702629",
"0.56980866",
"0.56922",
"0.5680227",
"0.5679045",
"0.56704605",
"0.56537545",
"0.5650225",
"0.56452936",
"0.56356007",
"0.5635437",
"0.5634528",
"0.56285805",
"0.5622186",
"0.56182486",
"0.5612183",
"0.5611132",
"0.5610725",
"0.5597659",
"0.55921626",
"0.5590292",
"0.5585043",
"0.55763113",
"0.556983",
"0.5561532",
"0.5560455",
"0.55587184",
"0.55587184",
"0.55587184"
] | 0.8601792 | 0 |
allowed array as aggregator, show expenses and circumstances | def deep_extract
aggregator = ''
@source.each_char do |symbol|
if DEEP_SCRAB.match?(symbol)
aggregator.insert(-1, symbol)
else
next if aggregator.empty?
@storage << aggregator.to_i
aggregator.clear
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def expense_list\n\n end",
"def build_all_expenses\n expenses = Expense.includes(:financial_type).current.all\n loans = Loan.includes(:financial_type).current.all\n result = []\n\n expenses.each do |e|\n holder = {}\n holder[:expense_id] = e.id\n holder[:name] = e.name\n holder[:monthly_payment] = e.monthly_payment\n holder[:financial_type] = e.financial_type.name\n holder[:notes] = e.notes\n result << holder\n end\n\n loans.each do |l|\n holder = {}\n holder[:loan_id] = l.id\n holder[:name] = l.org_name\n holder[:monthly_payment] = l.monthly_payment\n holder[:financial_type] = l.financial_type.name\n holder[:notes] = l.notes\n result << holder\n end\n\n gon.totalExpenses = result\n end",
"def all_expense_items\n owing_expense_items + paid_expense_items\n end",
"def owing_expense_items\n registrant_expense_items.map{|eid| eid.expense_item}\n end",
"def other_business_expenses\n return forms(\"Unreimbursed Partnership Expense\") { |f|\n f.line[:ssn] == @ho_form.line[:ssn]\n }.lines(:amount, :sum)\n end",
"def travel_expenses\n expenses.select {|expense| expense.category == \"travel\"}\n end",
"def get_expense_details\n @total_expenses = 0.0\n @billed_expenses = 0.0\n @expense_entries = {}\n @expense_entries = @saved_expense_entries\n for time_entry in @saved_time_entries\n @expense_entries += time_entry.tne_invoice_expense_entries\n end\n unless @expense_entries.empty?\n @total_expenses = @expense_entries.map(&:expense_amount).inject(0) do |total,amount|\n total + amount\n end\n @billed_expenses = @expense_entries.map(&:final_expense_amount).inject(0) do |total,amount|\n total + amount\n end\n @billed_expenses = @billed_expenses.to_f.roundf2(2)\n end\n end",
"def offenses; end",
"def offenses; end",
"def offenses; end",
"def sum_array(expenses)\n total_expense = 0;\n expenses.each do |entry|\n total_expense += entry\n end\n return total_expense\nend",
"def index\n @q = Expense.ransack(params[:q])\n @expenses = @q.result(distinct: true).includes(:category, :subcategory, :tags).order(:date)\n end",
"def aggregates\n @aggregates\n end",
"def index\n @expenses = Expense.all\n @expenses_sum = Expense.sum(:amount)\n @insurances_sum = Insurance.includes(:expense).pluck(:amount).sum\n @breaks_sum = Break.includes(:expense).pluck(:amount).sum\n @damages_sum = Damage.includes(:expense).pluck(:amount).sum\n @owner_takes_sum = OwnerTake.includes(:expense).pluck(:amount).sum\n end",
"def show\n @q = Expense.where(category: @subcategory.category, subcategory: @subcategory).ransack(params[:q])\n @expenses = @q.result(distinct: true).includes(:category, :subcategory, :tags).order(:date)\n end",
"def show\n @expenses = @expenses_file.expenses.select(\"strftime('%m', date) as month, strftime('%Y', date) as year, SUM(tax_amount) + SUM(pre_tax_amount) AS total\").\n group('month, year').order('year, month').as_json\n end",
"def total_expenses\n self.expenses.sum(\"amount\")\n end",
"def order_expenses\n total_expenses_per_subsection = {}\n total_expenses_per_subsection.default = 0.0\n details = self.order_details\n details.each do |detail|\n total_expenses_per_subsection[detail.subsection] += detail.last_value.amount\n end\n total_expenses_per_subsection\n end",
"def income_list\n end",
"def index\n @utility_expenses = UtilityExpense.all\n end",
"def index\n @expenses = Expense.get_expenses(\n current_user[:id],\n session[:budget]['dateStart'],\n session[:budget]['dateEnd'],\n sort\n )\n\n get_tag_forms\n\n @expenses_sum = calculate_expenses_sum @expenses\n\n get_charts_and_tags @expenses\n end",
"def required_item_from_expense_groups(_registrant_age)\n []\n end",
"def index\n @expenses = Expense.all\n end",
"def index\n @expenses_props = Expense.all\n end",
"def expense_attributes\n {}\n end",
"def agency_chart\n if(params[ :year ].nil?)\n params[ :year ] = '2015'\n else\n # Nothing to do.\n end\n expenses_of_public_agency = HelperController.expenses_year( \n params[ :id ].to_i, params[ :year ] )\n expenses_list = change_type_list_expenses( \n expenses_of_public_agency, params[ :year ] )\n\n respond_to do |format|\n format.json { render json: expenses_list }\n end\n end",
"def index\n @bid_expenses = BidExpense.all\n end",
"def index\n @record_expenses = RecordExpense.all\n end",
"def index\n @monthly_expenses = MonthlyExpense.all\n end",
"def required_expense_items\n egs = ExpenseGroup.for_competitor_type(@registrant.competitor?)\n\n egs.select { |expense_group| expense_group.expense_items.count == 1 }\n .map{ |expense_group| expense_group.expense_items.first }\n end",
"def paid_expense_items\n paid_details.map{|pd| pd.expense_item }\n end",
"def index\n @marketing_expenses = MarketingExpense.all\n end",
"def index\n @expense_by_category_and_month = {}\n @expense_by_category = {}\n expenses_total_by_month = {}\n @expense_month = []\n @expense_total = []\n @expenses = current_user.expenses.all\n if @expenses.present?\n @start_date = @expenses[0].date\n end\n\n\n # hack to make sure it is not nil\n @expense_by_category_and_month['Bills & Utilities'] = []\n @expense_by_category_and_month['Food & Dining'] = []\n @expense_by_category_and_month['Auto & Transport'] = []\n @expense_by_category_and_month['Entertainment'] = []\n @expense_by_category_and_month['Health & Fitness'] = []\n @expense_by_category_and_month['Shopping'] = []\n @expense_by_category_and_month['Kids'] = []\n @expense_by_category_and_month['Pet'] = []\n @expense_by_category_and_month['Home'] = []\n @expense_by_category_and_month['Uncatagorized'] = []\n\n expense_by_month_by_category = {}\n\n current_user.expenses.select(\"to_char(expenses.date, 'YYYY-MM') as expense_month, expenses.category as expense_category, SUM(expenses.amount_cents) as total\").group(\"category, to_char(expenses.date, 'YYYY-MM')\").order(\"to_char(expenses.date, 'YYYY-MM'), category\").each do | exp |\n\n # Use for column\n if not expense_by_month_by_category.has_key?(exp.expense_month)\n expense_by_month_by_category[exp.expense_month] = {}\n end\n expense_by_month_by_category[exp.expense_month][exp.expense_category] = exp.total.to_i/100\n\n\n # Expense by category and month within category\n #if not @expense_by_category_and_month.has_key?(exp.expense_category)\n # @expense_by_category_and_month[exp.expense_category] = []\n #end\n #@expense_by_category_and_month[exp.expense_category] << exp.total.to_i/100\n\n # Use for pie chart\n if not @expense_by_category.has_key?(exp.expense_category)\n @expense_by_category[exp.expense_category] = exp.total.to_i/100\n else\n @expense_by_category[exp.expense_category] += exp.total.to_i/100\n end\n\n # Total expenses by month\n if expenses_total_by_month[exp.expense_month].present?\n expenses_total_by_month[exp.expense_month] += exp.total.to_i/100\n else\n expenses_total_by_month[exp.expense_month] = exp.total.to_i/100\n end\n end\n\n # Calculate the columns. Handle missing ones\n expense_by_month_by_category.keys.sort.each do | month |\n @expense_by_category_and_month.keys.each do | category |\n if expense_by_month_by_category[month][category].present?\n @expense_by_category_and_month[category] << expense_by_month_by_category[month][category]\n else\n @expense_by_category_and_month[category] << 0\n end\n end\n\n end\n\n\n #current_user.expenses.select(\"to_char(expenses.date, 'YYYY-MM') as expense_month, SUM(expenses.amount_cents) as total\").group(\"to_char(expenses.date, 'YYYY-MM')\").each do | exp |\n # expenses_total_by_month[exp.expense_month] = exp.total.to_i/100\n #end\n\n expenses_total_by_month.sort.map {|k,v| @expense_total << v}\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @expenses }\n end\n rescue\n puts \"#{$!}\"\n end",
"def index\n @rec_expenses = RecExpense.all\n end",
"def print_offenses(res)\n unless res[:C].empty?\n @options[:jenkins] ?\n puts('# Issues with convention:') :\n puts('# Issues with convention:'.red)\n res[:C].each do |item|\n puts \" - #{item}\"\n end\n end\n unless res[:E].empty?\n @options[:jenkins] ?\n puts('# Errors:') :\n puts('# Errors:'.red)\n res[:E].each do |item|\n puts \" - #{item}\"\n end\n end\n unless res[:F].empty?\n @options[:jenkins] ?\n puts('# Fatal errors:') :\n puts('# Fatal errors:'.red)\n res[:F].each do |item|\n puts \" - #{item}\"\n end\n end\n unless res[:W].empty?\n @options[:jenkins] ?\n puts('# Warnings:') :\n puts('# Warnings:'.red)\n res[:W].each do |item|\n puts \" - #{item}\"\n end\n end\n end",
"def index\n @api_v1_expenses = Api::V1::Expense.all\n end",
"def index\n @office_expenses = OfficeExpense.all\n end",
"def index\n @expensesbases = @post.expensesbasis.all\n end",
"def expenses(sum, expenses)\n if sum.zero?\n puts Rainbow(\"There are no expenses in this period\").salmon\n else\n # prints out all the expenses in the period\n print_expenses(expenses)\n end\nend",
"def commissioned_expressions\n find_related_frbr_objects( :has_commissioned, :which_expressions?) \n end",
"def calc_sum_of_exp(expenses)\n prices = []\n expenses.each do |num|\n prices << num['price'].to_f\n end\n return prices.inject(0, :+)\nend",
"def index\n @expense_types = ExpenseType.all\n end",
"def get_expense_by_type( id_public_agency, year = '2015' )\n all_expenses = HelperController\n .find_expenses_entity( year, id_public_agency,\n :type_expense, :description )\n\n list_type_expenses = [ ]\n total_expense = 0\n\n all_expenses.each do |type_expense|\n list_type_expenses << { name: type_expense[ 0 ], value: type_expense[ 1 ] }\n total_expense += type_expense[ 1 ]\n end\n\n define_color( total_expense, list_type_expenses )\n\n return list_type_expenses\n end",
"def expenses\n @expenses ||= Harvest::API::Expenses.new(credentials)\n end",
"def offense_counts; end",
"def offense_counts; end",
"def sum_expense(expenses)\n sum = expenses.sum\n return sum\nend",
"def index\n @filters = {}\n @expenses = Expense.all\n @subtotal = calculate_subtotal(@expenses)\n\n render :index\n end",
"def group_matter_accounting_rpt(tcol,ecol)\r\n conditions,data,total_data,total_expenses,matter_name = {},[],{},{},nil\r\n lookup_activities = current_company.company_activity_types\r\n activities = ReportsHelper.get_lookups(lookup_activities)\r\n lookup_activities = Physical::Timeandexpenses::ExpenseType.find(:all)\r\n exp_activities = ReportsHelper.get_lookups(lookup_activities)\r\n tcol.group_by(&:matter_id).each_value do|col|\r\n key,contact = nil,nil\r\n duration,billamount,discount,override,markup,finalamount = 0.00,0.00,0.00,0.00,0.00,0.00\r\n col.each do |obj|\r\n @dur_setng_is_one100th ? actual_duration = one_hundredth_timediffernce(obj.actual_duration) : actual_duration = one_tenth_timediffernce(obj.actual_duration)\r\n next unless obj.matter\r\n key = obj.matter.clipped_name unless key\r\n matter_name = obj.matter.name unless matter_name\r\n contact = (obj.matter.contact ? obj.matter.contact.name : nil) unless contact\r\n duration += actual_duration.to_f if actual_duration\r\n billamount = billamount + (obj.actual_activity_rate * actual_duration.to_f)\r\n discount += obj.billing_percent if obj.billing_percent\r\n override += obj.final_billed_amount if obj.billing_method_type == 3\r\n finalamount += obj.final_billed_amount if obj.final_billed_amount \r\n data << [obj.time_entry_date.to_s,obj.performer.try(:full_name).try(:titleize),rounding(actual_duration.to_f),activities[obj.activity_type],obj.is_billable ? \"Yes\" : \"No\",rounding(obj.actual_activity_rate),rounding(obj.actual_activity_rate * actual_duration.to_f),rounding(obj.billing_percent),obj.billing_method_type == 3 ? rounding(obj.final_billed_amount) : '',rounding(obj.final_billed_amount)]\r\n end\r\n next unless key\r\n \r\n total_data[key] = data\r\n conditions[key] = [contact,rounding(duration),rounding(billamount),rounding(discount),rounding(override),rounding(finalamount),matter_name]\r\n data = []\r\n end\r\n\r\n ecol.group_by(&:matter_id).each_value do|col| \r\n key,contact = nil,nil\r\n override,finalamount,markupamt,bill_amount,disc_sum = 0.00,0.00,0.00,0.00,0.00\r\n col.each do |obj|\r\n next unless obj.matter\r\n bill_amount += obj.expense_amount if obj.expense_amount\r\n disc_sum += obj.billing_percent if obj.billing_percent\r\n override += obj.final_expense_amount if obj.billing_method_type == 3\r\n markupamt += obj.markup if obj.markup\r\n finalamount += obj.final_expense_amount if obj.final_expense_amount\r\n key = obj.matter.clipped_name unless key\r\n contact = (obj.matter.contact ? obj.matter.contact.name : nil) unless contact\r\n data << [obj.expense_entry_date.to_s,obj.performer.try(:full_name).try(:titleize),exp_activities[obj.expense_type],obj.is_billable ? \"Yes\" : \"No\",rounding(obj.expense_amount),rounding(obj.billing_percent),obj.billing_method_type == 3 ? rounding(obj.final_expense_amount) : '',markupamt,rounding(obj.final_expense_amount)]\r\n end\r\n next unless key\r\n \r\n total_expenses[key] = [data,rounding(override),rounding(finalamount),rounding(bill_amount),rounding(disc_sum),rounding(markupamt)]\r\n unless conditions.has_key?(key)\r\n conditions[key] = [contact]\r\n end\r\n data = []\r\n end\r\n [total_data,total_expenses,conditions]\r\n \r\n end",
"def expense_total\n self.expenses.sum(:amount).to_f\n end",
"def owing_expense_items_with_details\n registrant_expense_items.map{|rei| [rei.expense_item, rei.details]}\n end",
"def index\n @shared_expenses = SharedExpense.all\n end",
"def decisions\n\t\t@empresa = getMyEnterpriseAPP\n\n\t\tif [email protected]?\n\t\t\t@dims = [DIM_DEC_1, DIM_DEC_2, DIM_DEC_3, DIM_DEC_4, DIM_DEC_5, DIM_DEC_6]\n\t\t\t# ES: Envia las genericas ordenadas por dimension, para realizar el agrupamiento:\n\t\t\t# EN: # Send the generic decisions, sorted by dimension, to perform a grouping:\n\t\t\t@genericas = GovernanceDecision.where(\"decision_type = ? AND enterprise_id = ?\", GENERIC_TYPE, @empresa.id).order(dimension: :asc)\n\t\t\t# ES: Envia las especificas ordenadas por su padre, para realizar el agrupamiento:\n\t\t\t# EN: # Send the generic decisions, sorted by its father, to perform a grouping\n\t\t @genericas.size == 0 ? @tieneDecisiones = false : @tieneDecisiones = true\n\t\t @especificas = GovernanceDecision.where(\"decision_type = ? AND enterprise_id = ?\", SPECIFIC_TYPE, @empresa.id).order(parent_id: :asc)\n\t\telse\n\t\t\tredirect_to main_app.root_url, :alert => 'ERROR: Enterprise not found. Select one from the initial menu'\n\t\tend\n\tend",
"def agency_abv; end",
"def rep_items(array, rep_bills)\n array << rep_bills.reject {|bill| bill.introduced_on.nil? }.size\n array << rep_bills.reject {|bill| bill.referred_to_committee_on.nil? }.size\n array << rep_bills.reject {|bill| bill.committee_hearing_held_on.nil? }.size\n array << rep_bills.reject {|bill| bill.committee_markup_held_on.nil? }.size\n array << rep_bills.reject {|bill| bill.reported_by_committee_on.nil? }.size\n array << rep_bills.reject {|bill| bill.referred_to_subcommittee_on.nil? }.size\n array << rep_bills.reject {|bill| bill.subcommittee_hearing_held_on.nil? }.size\n array << rep_bills.reject {|bill| bill.subcommittee_markup_held_on.nil? }.size\n array << rep_bills.reject {|bill| bill.forwarded_from_subcommittee_to_committee_on.nil? }.size\n array << rep_bills.reject {|bill| bill.committee_hearing_held_on.nil? and bill.committee_markup_held_on.nil? and bill.reported_by_committee_on.nil? and bill.subcommittee_hearing_held_on.nil? and bill.subcommittee_markup_held_on.nil? and bill.forwarded_from_subcommittee_to_committee_on.nil? }.size\n array << rep_bills.reject {|bill| bill.reported_by_committee_on.nil? and bill.rule_reported_on.nil? and bill.rules_suspended_on.nil? and bill.considered_by_unanimous_consent_on.nil? and bill.passed_house_on.nil? and bill.failed_house_on.nil? and bill.received_in_senate_on.nil? and bill.placed_on_union_calendar_on.nil? and bill.placed_on_house_calendar_on.nil? and bill.placed_on_private_calendar_on.nil? and bill.placed_on_corrections_calendar_on.nil? and bill.placed_on_discharge_calendar_on.nil? and bill.placed_on_consent_calendar_on.nil? and bill.placed_on_senate_legislative_calendar_on.nil? }.size\n array << rep_bills.reject {|bill| bill.placed_on_union_calendar_on.nil? }.size\n array << rep_bills.reject {|bill| bill.placed_on_house_calendar_on.nil? }.size\n array << rep_bills.reject {|bill| bill.placed_on_private_calendar_on.nil? }.size\n array << rep_bills.reject {|bill| bill.placed_on_corrections_calendar_on.nil? }.size\n array << rep_bills.reject {|bill| bill.placed_on_discharge_calendar_on.nil? }.size\n array << rep_bills.reject {|bill| bill.rule_reported_on.nil? }.size\n array << rep_bills.reject {|bill| bill.rule_passed_on.nil? }.size\n array << rep_bills.reject {|bill| bill.rules_suspended_on.nil? }.size\n array << rep_bills.reject {|bill| bill.considered_by_unanimous_consent_on.nil? }.size\n array << rep_bills.reject {|bill| bill.passed_house_on.nil? }.size\n array << rep_bills.reject {|bill| bill.failed_house_on.nil? }.size\n array << rep_bills.reject {|bill| bill.received_in_senate_on.nil? }.size\n array << rep_bills.reject {|bill| bill.passed_senate_on.nil? }.size\n array << rep_bills.reject {|bill| bill.failed_senate_on.nil? }.size\n array << rep_bills.reject {|bill| bill.sent_to_conference_committee_on.nil? }.size\n array << rep_bills.reject {|bill| bill.conference_committee_report_issued_on.nil? }.size\n array << rep_bills.reject {|bill| bill.conference_committee_passed_house_on.nil? }.size\n array << rep_bills.reject {|bill| bill.conference_committee_passed_senate_on.nil? }.size\n array << rep_bills.reject {|bill| bill.presented_to_president_on.nil? }.size\n array << rep_bills.reject {|bill| bill.signed_by_president_on.nil? }.size\n array << rep_bills.reject {|bill| bill.vetoed_by_president_on.nil? }.size\n array << rep_bills.reject {|bill| bill.house_veto_override_on.nil? }.size\n array << rep_bills.reject {|bill| bill.senate_veto_override_on.nil? }.size\n array << rep_bills.reject {|bill| bill.house_veto_override_failed_on.nil? }.size\n array << rep_bills.reject {|bill| bill.senate_veto_override_failed_on.nil? }.size\n array << rep_bills.reject {|bill| bill.passed == false }.size\n end",
"def get_overall_popular_deal_type\n all_active_past_deals = Deal.active_and_expired.where(:redeemable => true)\n unique_deal_type = all_active_past_deals.uniq.pluck(:type_of_deal)\n all_active_past_deals = all_active_past_deals.order(title: :asc)\n array = Array.new\n unique_deal_type.each do |udt|\n deal_type_array = Array.new\n deal_type_array << udt\n deal_type = all_active_past_deals.where(:type_of_deal => udt).pluck(:id)\n total_redemption_count = DealAnalytic.where(deal_id: deal_type).sum(:redemption_count)\n total_deals = deal_type.count\n deal_type_array << (total_redemption_count.to_f/total_deals.to_f).round(2)\n array << deal_type_array\n end\n array\n end",
"def index\n d = Date.today\n @expenses = @household.expenses.monthly_statement(d.month, d.year).order(spent_at: :desc)\n end",
"def index\n @expenses = Expense.includes(:author).where('author_id = ?',\n current_user.id).joins(:groups_expenses).most_recent\n end",
"def total_expenses\n expenses.sum(:amount) || 0.0\n end",
"def gas_expense\n { amount: 12.50 , comment: 'Gas at Chevron', when: '2013-09-09', expensetype_id: 1 }\n end",
"def overview\n case id\n when \"CDN-REALESTATE\"\n \"ETFs that provide exposure to the Canadian Real Estate market - broadly distributed across the country.\"\n when \"COMMODITIES\"\n \"ETFs that provide exposure to various commodities - generally considered as input to a growing economy.\"\n when \"US-LGCAP-STOCK\"\n \"ETFs that provide exposure to the equity of large, U.S. based companies.\"\n when \"US-LONG-GOV-BOND\"\n \"ETFs that provide exposure to U.S. Government debt, with long maturities.\"\n when \"INTL-REALESTATE\"\n \"ETFs that provide exposure to the International Real Estate market - broadly distributed across the globe.\"\n when \"US-REALESTATE\"\n \"ETFs that provide exposure to the U.S. Real Estate market - broadly distributed across the country.\"\n when \"US-SHORT-CORP-BOND\"\n \"ETFs that provide exposure to U.S. Corporate debt, with short maturities.\"\n when \"CDN-LONG-BOND\"\n \"ETFs that provide exposure to Canadian Corporate debt, with long maturities.\"\n when \"CDN-SHORT-BOND\"\n \"ETFs that provide exposure to Canadian Corporate debt, with short maturities.\"\n when \"US-SMCAP-STOCK\"\n \"ETFs that provide exposure to the equity of smaller U.S. based companies.\"\n when \"INTL-BOND\"\n \"ETFs that provide exposure to International Government & Corporate debt, with varying maturities.\"\n when \"US-SHORT-GOVT-BOND\"\n \"ETFs that provide exposure to U.S. Government debt, with shorter maturities.\"\n when \"US-MED-CORP-BOND\"\n \"ETFs that provide exposure to U.S. Corporate debt, with medium maturities.\"\n when \"CDN-STOCK\"\n \"ETFs that provide exposure to the equity of Canadian companies.\"\n when \"US-MED-GOV-BOND\"\n \"ETFs that provide exposure to U.S. Government debt, with medium maturities.\"\n when \"EMERG-STOCK\"\n \"ETFs that provide exposure to the equity of companies based in countries classified as Emerging Markets.\"\n when \"US-LONG-CORP-BOND\"\n \"ETFs that provide exposure to U.S. Corporate debt, with longer maturities.\"\n when \"INTL-STOCK\"\n \"ETFs that provide exposure to the equity of companies based in Europe, Asia and the Far East (EAFE).\"\n else\n raise \"Asset class overview not prepared.\"\n end\n end",
"def aggregate\n []\n end",
"def calories(combo)\n combo.map.with_index do |teaspoons, i|\n teaspoons * @ingredients[i][4]\n end.reduce(:+)\n end",
"def expense_by_party_and_line_item_subtype party, line_item_sub_type, invoiced=nil, document_id=nil\n sub_total = expense_subtotal_by_party(party)\n accum = Money.new(0)\n\n filter_invoiced(line_items, invoiced, document_id).select{|li| li.line_item_sub_type == line_item_sub_type}.each do |li|\n if li.after_subtotal\n\n if li.billable_party == party\n accum -= li.percentage_of_subtotal ? li.revenue_total_with_percentage(sub_total) : li.revenue_total\n end\n\n if li.payable_party == party\n accum += li.percentage_of_subtotal ? li.expense_total_with_percentage(sub_total) : li.expense_total\n end\n\n else\n\n if li.billable_party == party\n accum -= li.revenue_total\n end\n\n if li.payable_party == party\n accum += li.expense_total\n end\n \n end\n\n end\n accum\n end",
"def change_type_list_expenses( expenses_month, year )\n HelperController.int_to_month( expenses_month )\n temporary_expense = { year => expenses_month }\n\n return temporary_expense\n end",
"def multi_items(array, operation)\n if operation == \"total\" || operation == \"refund\"\n amount = 0\n end\n index = 0\n while index < array.length\n if operation == \"total\"\n amount += array[index]\n elsif operation == \"refund\"\n amount -= array[index]\n elsif operation == \"show discounts\"\n amount_off = array[index] / 3.0\n puts format(\"Your discount: $%0.2f\", amount_off)\n end\n index += 1\n end\n if operation == \"total\" || operation == \"refund\"\n puts amount\n end\nend",
"def offense_report(label = 'Attackers:')\n status_report(\n name: label,\n items: @attackers,\n item_text: lambda { |item| item.list_name num_id_cols: @attackers.size.to_s.size }\n )\nend",
"def index\n @expenses = Expense.all\n respond_with @expenses\n end",
"def index\n @expenses = Expense.includes(:place, :account, sub_category: :category).order('paid_at DESC').page(params[:page])\n end",
"def index\n @expenses = current_user.user_account.expenses\n #DZF get totals\n\t\tunless @expenses.blank?\n\t\t\t@expense_total_price = current_user.user_account.get_expenses_total_price\n\t\t\t@expense_total_payed_price = current_user.user_account.get_expenses_total_total_payed_price\n\t\t\t@expense_total_payed_percentage = @expense_total_payed_price / @expense_total_price * 100\n\t\t\t@expense_total_remaining_price = current_user.user_account.get_expenses_total_remaining_price\n\t\t\t#DZF get payers percentage\n\t\t\t@payer_types_totals = {}\n\t\t\tPayerType.all.each do |pt|\n\t\t\t\t@payer_types_totals.merge!({pt.name => (current_user.user_account.get_payer_total_price_by_id(pt.id) * 100 / @expense_total_price) } )\n\t\t\tend\n\t\tend\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @expenses }\n end\n end",
"def index\n @expenses = Expense.all\n # @assets = Asset.all\n @assets = current_user.assets\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @expenses }\n end\n end",
"def defense\n total_for(:defense)\n end",
"def index\n @exponats = Exponat.all\n end",
"def group_time_accounted_array(params,tcol)\r\n \r\n conditions,data,table_headers,duration = {},[],[],0\r\n \r\n \r\n lookup_activities = current_company.company_activity_types\r\n activities = ReportsHelper.get_lookups(lookup_activities)\r\n\r\n if params[:report][:selected] == \"all\"\r\n billamount,discount,override,finalamount,num_discount = 0,0,0,0,0\r\n tcol.each do |obj|\r\n @dur_setng_is_one100th ? actual_duration = one_hundredth_timediffernce(obj.actual_duration) : actual_duration = one_tenth_timediffernce(obj.actual_duration)\r\n\r\n duration += actual_duration.to_f if actual_duration\r\n unless obj.is_internal\r\n billamount = billamount + (obj.actual_activity_rate * actual_duration.to_f)\r\n# discount += obj.billing_percent if obj.billing_percent\r\n if obj.billing_percent\r\n discount += obj.billing_percent\r\n num_discount += 1\r\n end\r\n override += obj.final_billed_amount if obj.billing_method_type == 3\r\n finalamount += obj.final_billed_amount if obj.final_billed_amount\r\n end\r\n\r\n unless obj.is_internal #Not Internal\r\n data << [obj.time_entry_date,obj.performer.try(:full_name).try(:titleize),obj.contact ? obj.contact.name : \"\",obj.matter ? obj.matter.clipped_name : \"\",\"No\",actual_duration,activities[obj.activity_type],obj.is_billable ? \"Yes\" : \"No\",obj.actual_activity_rate,obj.actual_activity_rate * actual_duration.to_f,obj.billing_percent,obj.billing_method_type == 3 ? obj.final_billed_amount : '',obj.final_billed_amount]\r\n else\r\n data << [obj.time_entry_date,obj.performer.try(:full_name).try(:titleize), \"N.A\",\"N.A\",\"Yes\",actual_duration,activities[obj.activity_type],\"N.A\",\"N.A\",\"N.A\",\"N.A\",\"N.A\",\"N.A\"]\r\n end\r\n end\r\n # This condition applied to avoid 0/0 = (Not A Number) with ref to Bug -Bug #7108 Shows junk value in T&E PDF report --Rahul P.\r\n if (discount>0 and num_discount>0)\r\n discount = (discount.to_f/num_discount.to_f)\r\n else\r\n discount = 0\r\n end\r\n #raise discount.inspect\r\n conditions[:table_width] = 750\r\n conditions[:all_entries] = [duration,billamount,discount,override,finalamount]\r\n column_widths = { 0 => 60, 1 => 60, 2 => 60 , 3 => 60 , 4 => 40 , 5 => 70 , 6 => 60 ,7 => 40 , 8 => 60 , 9 => 60,10 => 60,11 => 60 , 12 => 60}\r\n table_headers = [t(:label_date),t(:text_lawyer),t(:label_client),t(:text_matter),t(:label_internal),t(:label_duration_hrs),t(:text_activity_type),t(:text_billable),\"#{t(:label_rate_hr)}\",\"#{t(:text_bill)} #{t(:text_amt)}\",t(:text_discount_p),\"#{t(:text_override)} #{t(:text_amt)}\",\"#{t(:label_final_bill)} #{t(:text_amt)}\"]\r\n alignment = { 0 => :center, 1 => :left,2 => :left, 3 => :left,4 => :center,6 => :left, 7 => :center,10=>:center} if params[:format] == \"pdf\"\r\n \r\n elsif params[:report][:selected] == \"internal\"\r\n \r\n \r\n tcol.each do |obj|\r\n @dur_setng_is_one100th ? actual_duration = one_hundredth_timediffernce(obj.actual_duration) : actual_duration = one_tenth_timediffernce(obj.actual_duration)\r\n duration += actual_duration.to_f if obj.actual_duration\r\n data << [obj.time_entry_date,obj.performer.try(:full_name).try(:titleize),actual_duration,activities[obj.activity_type]]\r\n end\r\n conditions[:internal_entries] = [duration]\r\n table_headers = [t(:label_date),t(:text_lawyer),t(:label_duration_hrs),t(:text_activity_type)]\r\n column_widths = { 0 => 100, 1 => 100, 2 => 100 , 3 => 100} \r\n end\r\n \r\n [data,conditions,table_headers,column_widths, alignment]\r\n \r\n end",
"def auto_complete_for_filter_expense_pending_envelope\r\n project_ids = (@current_user.supervised_projects.nil? || @current_user.supervised_projects.empty? ) ? '' : (@current_user.supervised_projects.collect {|p| p.id}.flatten)\r\n @items=BulkExpense.find(:all,:include=> [:user, :project] ,\r\n :conditions=>['expenses.envelope like ? and users.enterprise_id=? and (users.supervisor_id=? OR projects.id IN (?))',\"%#{params[:crt_envelope]}%\",@enterprise.id,@current_user.id, project_ids]) \r\n render :inline => '<%= auto_complete_result(@items, \"envelope\") %>'\r\n end",
"def aggregator_for user_or_attestation\n case user_or_attestation\n when User\n user = user_or_attestation\n aggregator_for_user user\n when Counsel, Promulgation\n attestation = user_or_attestation\n aggregator_for_attestation attestation\n end\n end",
"def index\n convert_date if (params[:search] && params[:search]['date_lte(1i)'])\n @search = current_user.expenses.order_by_date.search(params[:search]) \n @expenses = @search.all.uniq\n # TODO Count does not working in HEroku\n #@count = @expenses.count\n @sum = @expenses.inject(0){|sum, item| sum + item.amount}\n @categories = Category.all\n @tags = current_user.owned_tags\n @expense_types = ExpenseType.all\n @payment_method = PaymentMethod.all\n \n @description = t('menu.expenses.index.description') \n @single_column = true\n \n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @expenses }\n end\n end",
"def insurance_fields\n [\n :pension_personal,\n :unemployment_personal,\n :medical_personal,\n :house_accumulation_personal,\n\n :pension_company,\n :unemployment_company,\n :medical_company,\n :injury_company,\n :birth_company,\n :house_accumulation_company\n ]\n end",
"def you_are_owed\n detailed_expenses = self.expenses.includes(:expense_details)\n amount = 0\n more_details = Hash.new {|h,k| h[k] = k }\n detailed_expenses.each do |ex|\n id = Friend.includes(:profile).find(ex.payable_id)\n friend_id = self.id != id.profile_id ? id.profile_id : id.friend_id\n ex.expense_details.each do |ed|\n if ed.paid_by == self.id\n amount += (ed.amount_paid / 2.0)\n more_details[friend_id] ||= {}\n more_details[friend_id] += ed.amount_paid / 2.0\n end\n end\n end\n [amount, more_details]\n end",
"def required_item_from_expense_groups(registrant_age)\n ExpenseGroupOption.where(\n option: [ExpenseGroupOption::ONE_IN_GROUP_REQUIRED, ExpenseGroupOption::EXACTLY_ONE_IN_GROUP_REQUIRED]\n ).for(\"competitor\", registrant_age).map(&:expense_group)\n end",
"def big_investors\n self.investors.select {|vc| vc.tres_commas_club}\n end",
"def apply_to(expenses)\n matches = expenses.select { |e| e.description.match(/#{keyphrase}/)}\n\n Expense.update_all({\n :category_id => category_id,\n :creditor_id => creditor_id\n }, {\n :id => matches.map(&:id)\n }) unless matches.empty?\n\n return matches\n end",
"def electricity_usages(style=:solo)\n each_with_object([]) do |bill,memo|\n bill.electricity_usage.each do |usage|\n if style==:solo\n memo << [bill.invoice_month.to_s,usage[:kwh],usage[:rate],usage[:amount]]\n else\n memo << [bill.invoice_month.to_s,'electricity',usage[:kwh],nil,usage[:rate],usage[:amount]]\n end\n end\n end\n end",
"def index\n @expense_trackers = ExpenseTracker.all\n \n #Create a hash to keep track of total expenses per month\n #Keys for this hash will be \"Month- value specified from form\"\n @total_expense = Hash.new\n @savings = Hash.new\n \n #Loop through each row in expense tracker (per month)\n @expense_trackers.each do |expense_tracker|\n @total_expense[expense_tracker.month] = 0\n if(expense_tracker.grocery != NIL)\n @total_expense[expense_tracker.month] += expense_tracker.grocery\n end\n if(expense_tracker.mortgage != NIL)\n @total_expense[expense_tracker.month] += expense_tracker.mortgage\n end\n if(expense_tracker.gas != NIL)\n @total_expense[expense_tracker.month] += expense_tracker.gas\n end\n if(expense_tracker.shopping != NIL)\n @total_expense[expense_tracker.month] += expense_tracker.shopping\n end\n if(expense_tracker.restaurant != NIL)\n @total_expense[expense_tracker.month] += expense_tracker.restaurant\n end\n if(expense_tracker.utilities != NIL)\n @total_expense[expense_tracker.month] += expense_tracker.utilities\n end\n if(expense_tracker.other != NIL)\n @total_expense[expense_tracker.month] += expense_tracker.other\n end\n @savings[expense_tracker.month] = expense_tracker.income - @total_expense[expense_tracker.month]\n end\n \n end",
"def summarize_per_subset\n @having = ANY_ROWS\n end",
"def index\n @defenses = Defense.all\n end",
"def index\n @invens = Inven.all\n @collections = Collection.all\n \n @locations = Location.all\n @families = Family.all\n @collection_without_donations = @collections.where(\"collection_type !=?\", '2')\n @total = @collection_without_donations.group(:name).sum(:amount).to_a\n # @total = @collections.group(:name).sum(:amount).to_a\n \n @total_collections = @collection_without_donations.sum(:amount)\n @total_by_location = @collection_without_donations.group(:location).sum(:amount).to_a\n # @total_by_location = @collections.group(:location).sum(:amount).to_a\n \n @donations = @collections.group(:collection_type, :name).sum(:amount).to_a\n @total_donations = @collections.where(\"collection_type=?\", '2').sum(:amount)\n \n @location_count = Location.count\n @family_count = Family.count\n @expenses = Expense.all.group(:expense_type).sum(:amount).to_a\n @total_expenses = Expense.all.sum(:amount)\n @const_expenses = ConstructionExpense.all.group(:owner).sum(:amount).to_a\n @total_const_expenses = ConstructionExpense.all.sum(:amount)\n end",
"def product_tot_sales(array_item)\n\tprice_only = array_item[\"purchases\"].map {| my_price | my_price[\"price\"]}\n \tprice_only.inject(:+)\nend",
"def get_earnings\n get_historic_eps(1)\n end",
"def offenses_to_check; end",
"def index\n @audit = Audit.find(params[:audit])\n @areas = Area.for_audit(@audit.id)\n @landfill = Array.new\n @compost = Array.new\n @recycling = Array.new\n @reuse = Array.new\n @food_recovery = Array.new\n @all = Array.new\n for area in @areas\n @landfill += WasteInfo.area_waste(area.id).waste_category('landfill')\n @compost += WasteInfo.area_waste(area.id).waste_category('compost')\n @recycling += WasteInfo.area_waste(area.id).waste_category('recycling')\n @reuse += WasteInfo.area_waste(area.id).waste_category('reuse')\n @food_recovery += WasteInfo.area_waste(area.id).waste_category('food recovery')\n @all += WasteInfo.area_waste(area.id)\n end\n end",
"def expenses_for(m)\n d = Date.parse(m)\n exp = self.expenses.within_range(d, ((d + 1.month) - 1.day)).sum(:amount)\n exp.nil? ? 0 : exp\n end",
"def opportunity_summary(opportunity)\n summary = []\n amount = []\n summary << (opportunity.stage ? t(opportunity.stage) : t(:other))\n summary << number_to_currency(opportunity.weighted_amount, precision: 0)\n unless %w(won lost).include?(opportunity.stage)\n amount << number_to_currency(opportunity.amount || 0, precision: 0)\n amount << (opportunity.discount ? t(:discount_number, number_to_currency(opportunity.discount, precision: 0)) : t(:no_discount))\n amount << t(:probability_number, (opportunity.probability || 0).to_s + '%')\n summary << amount.join(' ')\n end\n if opportunity.closes_on\n summary << t(:closing_date, l(opportunity.closes_on, format: :mmddyy))\n else\n summary << t(:no_closing_date)\n end\n summary.compact.join(', ')\n end",
"def report\n @emotions.each do |feeling, value|\n# Each do goes through the array... the array is outside the class)\n if value == 3\n puts \"I am feeling a high amount of #{feeling}\"\n elsif value == 2\n puts \"I am feeling a medium amount of #{feeling}\"\n elsif value == 1\n puts \"I am feeling a low amount of #{feeling}\"\n end\n end\n end",
"def return_production()\n @values = {'upkeep' => 0, 'income' => 0, 'happiness' => 0, 'population' => 0}\n @map.each do |map|\n if map[1].show_type != \" \"\n @items = map[1].show_production()\n @items.each_key { |key| @values[key] = (@items[key] + @values[key]) } \n else\n next\n end\n end\n return @values\n end",
"def get_total_expense\n\t\tbills.pluck(:amount).inject(:+) rescue 0\n\tend",
"def grouping_array_or_grouping_element o, collector\n if o.expr.is_a? Array\n collector << \"( \"\n visit o.expr, collector\n collector << \" )\"\n else\n visit o.expr, collector\n end\n end",
"def all_winter_holiday_supplies(holiday_supplies)\n holiday_supplies[:winter].values.flatten\nend",
"def numerical_acc_select (acc_cats)\n text = \"\"\n acc_cats.sort_by{|cat,sales| sales[0]}.reverse.first(ACCESSORY_TYPES_PER_BESTSELLING).each do |product_type|\n unless product_type[0] == \"\" # Category in which unplaceable items are put (no other known category accepts them)\n cat_sales = product_type[1][0]\n acc_hash = product_type[1][1]\n Translation.select(:value).where(:key=>product_type[0]+\".name\").first.value =~ /--- (.+)/\n trans = $1\n text += \"%\"+trans+\"~\"+cat_sales.to_s+\"~\"\n acc_hash.sort_by{|sku,sales| sales}.reverse.first(ACCESSORIES_PER_PRODUCT_TYPE).each do |product|\n text += product[0]+\"~\"+product[1].to_s+\"~\"\n end\n end\n end\n text\nend",
"def expressions; end",
"def big_investors\n investors.select do |investor| \n investor.total_worth > 10000000000\n end\n end"
] | [
"0.66664606",
"0.59740484",
"0.5871034",
"0.5723415",
"0.5699931",
"0.56713086",
"0.5639887",
"0.56073034",
"0.56073034",
"0.56073034",
"0.56025136",
"0.55677676",
"0.55441064",
"0.5528225",
"0.55245876",
"0.5522593",
"0.5515859",
"0.5513813",
"0.5509823",
"0.5476721",
"0.54726917",
"0.5431369",
"0.54224",
"0.54080343",
"0.53991085",
"0.5353643",
"0.535303",
"0.5330736",
"0.5272543",
"0.5259409",
"0.5244642",
"0.5237438",
"0.52335423",
"0.5216786",
"0.52143514",
"0.521278",
"0.52075577",
"0.5186827",
"0.5176572",
"0.5170259",
"0.5169924",
"0.5149653",
"0.5147886",
"0.514499",
"0.51348144",
"0.51348144",
"0.5134333",
"0.5122613",
"0.511618",
"0.511232",
"0.51099056",
"0.5108524",
"0.5098585",
"0.50934774",
"0.5086468",
"0.508463",
"0.50550765",
"0.5054851",
"0.50378454",
"0.5033102",
"0.50242263",
"0.50206375",
"0.50195444",
"0.49887246",
"0.49872765",
"0.49851078",
"0.49827552",
"0.4982482",
"0.49808934",
"0.49756986",
"0.4972299",
"0.496512",
"0.49639982",
"0.49634513",
"0.49630713",
"0.49461225",
"0.4941514",
"0.49405035",
"0.49385074",
"0.4936861",
"0.49326432",
"0.49291006",
"0.49223182",
"0.4919349",
"0.49105167",
"0.4909356",
"0.49059469",
"0.48985097",
"0.48969173",
"0.48912916",
"0.48870742",
"0.4886795",
"0.48856845",
"0.48852766",
"0.48834458",
"0.48804653",
"0.4874655",
"0.48607853",
"0.48504734",
"0.48484233",
"0.4843357"
] | 0.0 | -1 |
key is the last element and should not include bad characters ... could be faster by not jumping through hash generation and parsing | def vault_path(key, direction = :encode)
parts = SecretStorage.parse_secret_key(key)
parts[:key] = convert_path(parts[:key], direction)
SecretStorage.generate_secret_key(parts)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def hashify(key)\n array = key.split('')\n count = array.count\n index = array.inject(0) do |object,char|\n object += char.ord ** count\n count -= 1\n object\n end\n index % 89\n end",
"def str_hash(key)\n key.bytes.inject(&:+)\n end",
"def hashify(key)\n array = key.split('')\n count = array.count\n array.inject(0) do |object,char|\n object += char.ord ** count\n count -= 1\n object\n end\n end",
"def keyslot(key)\n # Only hash what is inside {...} if there is such a pattern in the key.\n # Note that the specification requires the content that is between\n # the first { and the first } after the first {. If we found {} without\n # nothing In the middle, the whole key is hashed as usually.\n s = key.index \"{\"\n if s\n e = key.index \"}\",s+1\n if e && e != s+1\n key = key[s+1..e-1]\n end\n end\n RedisClusterCRC16.crc16(key) % RedisClusterHashSlots\n end",
"def keyslot(key)\n # Only hash what is inside {...} if there is such a pattern in the key.\n # Note that the specification requires the content that is between\n # the first { and the first } after the first {. If we found {} without\n # nothing In the middle, the whole key is hashed as usually.\n s = key.index \"{\"\n if s\n e = key.index \"}\",s+1\n if e && e != s+1\n key = key[s+1..e-1]\n end\n end\n RedisClusterCRC16.crc16(key) % RedisClusterHashSlots\n end",
"def hash(key)\n\t\tascii_keys = [] \n\t\tkey.to_s.each_byte { |el| ascii_keys << el }\n\t\tascii_keys.map { |el| el.to_s }.join('')\n\tend",
"def build_key(h)\n keys.inject('') {|acc, key| acc = \"#{acc}\\x01#{h[key]}\"}[1..-1]\n end",
"def test_hash_correct\n\t\n\t\tString test_array1 = '2|abb2|George>Amina(16):Henry>James(4):Henry>Cyrus(17):Henry>Kublai(4):George>Rana(1):SYSTEM>Wu(100)|1518892051.753197000|c72d'.split('|').map(&:chomp)\n\n\t\tx = test_array1[0].unpack('U*') + test_array1[1].unpack('U*') + test_array1[2].unpack('U*') + test_array1[3].unpack('U*')\n\t\tsum = 0\n\t\t# x.each { |i| puts x[i] }\n\t\t# x.delete(\"\")\n\t\tx.each { |i| sum += ((x[i].to_i ** 2000) * ((x[i].to_i + 2) ** 21) - ((x[i].to_i + 5) ** 3)) }\n\t\thash = (sum % 65536)\n\t\tputs hash.to_s(16)\n\t\t\n\t\ttest_array2 = '3|c72d|SYSTEM>Henry(100)|1518892051.764563000|7419'.split('|').map(&:chomp)\n\t\t\n\t\t# assert_equal test_str[2,2], '0|'\t\n\tend",
"def hash(key); end",
"def valid_key?(match_data)\n match_data[:key].to_i == (97 - match_data[1..-2].join.to_i) % 97\nend",
"def keyslot(key)\n # Only hash what is inside {...} if there is such a pattern in the key.\n # Note that the specification requires the content that is between\n # the first { and the first } after the first {. If we found {} without\n # nothing in the middle, the whole key is hashed as usually.\n s = key.index \"{\"\n if s\n e = key.index \"}\",s+1\n if e && e != s+1\n key = key[s+1..e-1]\n end\n end\n\n RedisClusterCRC16.crc16(key) % RedisClusterHashSlots\n end",
"def parse_key(key)\n end",
"def index(key, size)\n sum = 0\n\n key.split(\"\").each do |char|\n if char.ord == 0\n next\n end\n\n sum = sum + char.ord\n end\n\n\n sum % size\n\n end",
"def index(key, size)\n sum = 0\n\n key.split(\"\").each do |char|\n if char.ord == 0\n next\n end\n\n sum = sum + char.ord\n end\n\n\n sum % size\n end",
"def index(key, size)\n sum = 0\n\n key.split(\"\").each do |char|\n if char.ord == 0\n next\n end\n\n sum = sum + char.ord\n end\n\n\n sum % size\n end",
"def test_parse_hash_valid\n assert_equal 100000, parse_hash(\"186A0\")\n end",
"def parse_key(key)\n # key.scan(/[a-z]/)\n key.scan(/[^\\[\\]]+/)\n end",
"def strlen(key); end",
"def strlen(key); end",
"def last_key?(index, str)\n index+2 >= str.length and yield\n end",
"def create_key(p)\n key = \"\"\n len = 6 # this is the length of the key\n # txt = p.text.gsub(/[^a-z\\. ]+/i, '');\n txt = p.text.gsub(/[^a-z\\\\. ]+/i, '');\n # txt = (p.innerText || p.textContent || '').replace(/[^a-z\\. ]+/gi, '');\n if (txt && txt.length > 1)\n lines = get_sentences(txt)\n if (lines.size > 0)\n first = clean_array(lines[0].gsub(/[\\s\\s]+/i,' ').split(' ')).slice(0, (len/2))\n last = clean_array(lines[lines.size-1].gsub(/[\\s\\s]+/i,' ').split(' ')).slice(0, (len/2))\n k = first + last #first.concat(last)\n\n key = k.map{|el| el.slice(0,1)}.join\n end\n end\n return key\n end",
"def parse_key(key)\n key.split(/[\\[\\]]/).select { |str| !str.empty? }\n end",
"def parse_key(key)\n key.split(\"[\").each {|string| string.gsub!(\"]\",\"\")}\n end",
"def hashcode_with_internal_hashes(key)\n h, full_hs = phf_with_hashes(key)\n if @g[h] == @r\n return NON_KEY, full_hs # no key\n end\n a, b = h.divmod(RANK_SUPERBLOCKSIZE)\n if a == 0\n result = 0\n else\n result = @rs[a-1]\n end\n b, c = b.divmod(RANK_BLOCKSIZE)\n if b != 0\n result += @rb[a*(RANK_SUPERBLOCKSIZE/RANK_BLOCKSIZE-1)+b-1]\n end\n (h-c).upto(h-1) {|i|\n result += 1 if @g[i] != @r\n }\n return result, full_hs\n end",
"def parse_key(key)\n keys = key.scan(/\\w+\\b/)\n #.split(/[\\[\\]]/).reject { |key| key == \"\"}\n end",
"def test_incorrect_current_hash\n hash_string = '10|cb0f|281974>443914(6):SYSTEM>572872(100)|1553188611.607041000'\n assert_raises BlockFormatError do\n verify_current_hash(hash_string, 'd5e', 10, PreHash.new)\n end\n end",
"def get_lh_hash(key)\n res = 0\n key.upcase.bytes do |byte|\n res *= 37\n res += byte.ord\n end\n return res % 0x100000000\n end",
"def get_shakey \n {\"William Shakespeare\"=>{\"1\"=>{\"title\"=>\"The Two Gentlemen of Verona\", \"finished\"=>1591}, \"2\"=>{\"title\"=>\"The Taming of the Shrew\", \"finished\"=>1591}, \"3\"=>{\"title\"=>\"Henry VI, Part 2\", \"finished\"=>1591}, \"4\"=>{\"title\"=>\"Henry VI, Part 3\", \"finished\"=>1591}, \"5\"=>{\"title\"=>\"Henry VI, Part 1\", \"finished\"=>1592}, \"6\"=>{\"title\"=>\"Titus Andronicus\", \"finished\"=>1592}, \"7\"=>{\"title\"=>\"Richard III\", \"finished\"=>1593}, \"8\"=>{\"title\"=>\"Edward III\", \"finished\"=>1593}, \"9\"=>{\"title\"=>\"The Comedy of Errors\", \"finished\"=>1594}, \"10\"=>{\"title\"=>\"Love's Labour's Lost\", \"finished\"=>1595}, \"11\"=>{\"title\"=>\"Love's Labour's Won\", \"finished\"=>1596}, \"12\"=>{\"title\"=>\"Richard II\", \"finished\"=>1595}, \"13\"=>{\"title\"=>\"Romeo and Juliet\", \"finished\"=>1595}, \"14\"=>{\"title\"=>\"A Midsummer Night's Dream\", \"finished\"=>1595}, \"15\"=>{\"title\"=>\"King John\", \"finished\"=>1596}, \"16\"=>{\"title\"=>\"The Merchant of Venice\", \"finished\"=>1597}, \"17\"=>{\"title\"=>\"Henry IV, Part 1\", \"finished\"=>1597}, \"18\"=>{\"title\"=>\"The Merry Wives of Windsor\", \"finished\"=>1597}, \"19\"=>{\"title\"=>\"Henry IV, Part 2\", \"finished\"=>1598}, \"20\"=>{\"title\"=>\"Much Ado About Nothing\", \"finished\"=>1599}, \"21\"=>{\"title\"=>\"Henry V\", \"finished\"=>1599}, \"22\"=>{\"title\"=>\"Julius Caesar\", \"finished\"=>1599}, \"23\"=>{\"title\"=>\"As You Like It\", \"finished\"=>1600}, \"24\"=>{\"title\"=>\"Hamlet\", \"finished\"=>1601}, \"25\"=>{\"title\"=>\"Twelfth Night\", \"finished\"=>1601}, \"26\"=>{\"title\"=>\"Troilus and Cressida\", \"finished\"=>1602}, \"27\"=>{\"title\"=>\"Sir Thomas More\", \"finished\"=>1604}, \"28\"=>{\"title\"=>\"Measure for Measure\", \"finished\"=>1604}, \"29\"=>{\"title\"=>\"Othello\", \"finished\"=>1604}, \"30\"=>{\"title\"=>\"All's Well That Ends Well\", \"finished\"=>1605}, \"31\"=>{\"title\"=>\"King Lear\", \"finished\"=>1606}, \"32\"=>{\"title\"=>\"Timon of Athens\", \"finished\"=>1606}, \"33\"=>{\"title\"=>\"Macbeth\", \"finished\"=>1606}, \"34\"=>{\"title\"=>\"Antony and Cleopatra\", \"finished\"=>1606}, \"35\"=>{\"title\"=>\"Pericles, Prince of Tyre\", \"finished\"=>1608}, \"36\"=>{\"title\"=>\"Coriolanus\", \"finished\"=>1608}, \"37\"=>{\"title\"=>\"The Winter's Tale\", \"finished\"=>1611}, \"38\"=>{\"title\"=>\"Cymbeline\", \"finished\"=>1610}, \"39\"=>{\"title\"=>\"The Tempest\", \"finished\"=>1611}, \"40\"=>{\"title\"=>\"Cardenio\", \"finished\"=>1613}, \"41\"=>{\"title\"=>\"Henry VIII\", \"finished\"=>1613}, \"42\"=>{\"title\"=>\"The Two Noble Kinsmen\", \"finished\"=>1614}}}\nend",
"def parse_key(key)\n key.to_s.split(\"[\").map {|component|component.gsub(/]/,\"\")}\n end",
"def index(key, size)\n ascii_value = 0\n hash_key = 0\n\n key.split(\"\").each do |letter|\n ascii_value += letter.ord #Method to retrieve ascii\n end\n\n hash_key = ascii_value % size\n\n return hash_key\n end",
"def keygens; end",
"def parse_key(key)\n array = key.split(\"[\")\n array.map do |i| \n if i.include?(\"]\") \n i.chop\n else\n i\n end\n end\n end",
"def validate_key_bytes(key_bytes); end",
"def index(key, size)\n hash_code = 0\n array_of_characters = key.split('')\n array_of_characters.each do |letter|\n hash_code += letter.ord\n end\n hash_code % size\n end",
"def unlock(str)\n key = {\n 2 => ['a', 'b', 'c'],\n 3 => ['d', 'e', 'f'],\n 4 => ['g', 'h', 'i'],\n 5 => ['j', 'k', 'l'],\n 6 => ['m', 'n', 'o'],\n 7 => ['p', 'q','r', 's'],\n 8 => ['t', 'u', 'v'],\n 9 => ['w', 'x', 'y', 'z']\n }\n\n output = []\n str.downcase.chars.each {|x| key.any? {|k,v| output << k if v.include? x} }\n output.join\n\nend",
"def v_decode message, key\n message_array = alphabet_number(message.split(\"\"))\n key_array = alphabet_number(make_key_repeat(key.split(\"\"), message_array.length)).take(message_array.length)\n number_alphabet(message_array.map.with_index{ |m,i| (m.to_i - key_array[i].to_i + 1) % 26}).take(message_array.length).join(\"\")\nend",
"def hkeys(key); end",
"def hkeys(key); end",
"def get_first_key(hash)\n return \nend",
"def split_and_parse_key(key)\n key.split(/(?<!\\\\)\\./).reject(&:empty?).map do |key_part|\n case key_part\n when /^\\.\\$/ # For keys in the form of .$key\n key_part.gsub(/^\\./, '')\n when /\\A[-+]?[0-9]+\\z/\n key_part.to_i\n else\n key_part.gsub('\\\\', '')\n end\n end.reject { |k| k == '$body' }\n end",
"def parse_key(key)\n key.dup.split(/\\]\\[|\\[|\\]/)\n end",
"def gen_keys(str)\n split7(str).map{ |str7|\n bits = split7(str7.unpack(\"B*\")[0]).inject('')\\\n {|ret, tkn| ret += tkn + (tkn.gsub('1', '').size % 2).to_s }\n [bits].pack(\"B*\")\n }\n end",
"def bphash( key, len=key.length )\n state = 0\n \n len.times{ |i|\n state = state << 7 ^ key[i]\n }\n return state\nend",
"def get_minimal_key(line)\n compute_minimal_keys if not @minimal_keys\n \n str = \"\"\n minimal_keys.each{|k, size|\n str += line.field(k).to_s[0..size]\n }\n return str\n end",
"def handle_key(key); end",
"def post_key_check(key)\n if scan(/\\[\\]/) # a[b][] indicates that b is an array\n container(key, Array)\n nil\n elsif check(/\\[[^\\]]/) # a[b] indicates that a is a hash\n container(key, Hash)\n nil\n else # End of key? We do nothing.\n key\n end\n end",
"def parse_key(key)\n key.gsub(\"]\", \"\").split(\"[\")\n end",
"def normalize_key(key, options)\n key = super\n if key\n key = key.dup.force_encoding(Encoding::ASCII_8BIT)\n key = key.gsub(ESCAPE_KEY_CHARS) { |match| \"%#{match.getbyte(0).to_s(16).upcase}\" }\n\n if key.size > KEY_MAX_SIZE\n key_separator = \":hash:\"\n key_hash = ActiveSupport::Digest.hexdigest(key)\n key_trim_size = KEY_MAX_SIZE - key_separator.size - key_hash.size\n key = \"#{key[0, key_trim_size]}#{key_separator}#{key_hash}\"\n end\n end\n key\n end",
"def get_pre_keyed_hash(password)\n md = OpenSSL::Digest::SHA1.new\n passwd_bytes = []\n password.unpack('c*').each do |byte|\n passwd_bytes << (byte >> 8)\n passwd_bytes << byte\n end\n md << passwd_bytes.pack('c*')\n md << 'Mighty Aphrodite'.force_encoding('UTF-8')\n md\n end",
"def unmatched_keys; end",
"def index(key, size)\n #true_index = hash(key) % k\n code = 0\n key.split(%r{\\s*}).each do |letter|\n code += letter.ord \n end\n puts code\n return code % size\n\n end",
"def convert_key(key); end",
"def convert_key(key); end",
"def convert_key(key); end",
"def parse_key(key)\n key.split(/\\]\\[|\\[|\\]/).reject(&:empty?)\n end",
"def key_for_string str\n Digest::MD5.hexdigest(str).to_i(16) & KEY_MAX\n end",
"def index(key, size)\n sum = 0\n\n key.split(\"\").each do |char|\n if char.ord == 0\n next\n end\n\n sum = sum + char.ord\n end\n\n sum % size\n end",
"def get_hash(key)\n (Zlib.crc32(key).abs % 100).to_s(36)\n end",
"def generateKey(string)\r\n key = {}\r\n stringIterator = 0\r\n\r\n (string.length).times do\r\n charactersIterator = string[stringIterator] - 1\r\n divisorsIterator = 0\r\n divisors = {} # Possible divisors of the array's numbers\r\n\r\n # Check which numbers are possible divisors\r\n while charactersIterator > 0\r\n\r\n if string[stringIterator] % charactersIterator == 0\r\n divisors[divisorsIterator] = charactersIterator\r\n divisorsIterator += 1\r\n end\r\n charactersIterator -= 1\r\n end\r\n key[stringIterator] = divisors[rand(divisors.length)] # Choosing random divisor to be the primary key\r\n stringIterator += 1\r\n end\r\n\r\n return key\r\nend",
"def string_include_key?(string, key)\n return false if string.length < key.length\n key.each_char do |ele|\n return true if string.include?(ele)\n end\n\n \nend",
"def geohash(key, member); end",
"def hornerHash( key, tableSize)\n\tsize = key.length\n\th = 0\n\ti = 0\n\twhile (i < size)\n\t\th = (32 * h + key[i].ord) % tableSize\n\t\ti += 1\n\tend\n\treturn h\nend",
"def hash_correct(hash)\n \n Hash[hash.map {|k, v| [(k.to_s.ord + 1).chr.to_sym, v]}]\nend",
"def index(key, size)\n #sums up the ascii values of each char in a string\n code = key.sum\n return code % size\n end",
"def aphash( key, len=key.length )\n state = 0xAAAAAAAA\n len.times{ |i|\n if (i & 1) == 0\n state ^= (state << 7) ^ key[i] * (state >> 3)\n else\n state ^= ~( (state << 11) + key[i] ^ (state >> 5) )\n end\n }\n return state\nend",
"def unmd5(hash)\n # search one: lowercase search\n lower = \"a\"\n # search two: ascii brute force\n gen = all_ascii\n \n loop {\n break lower if md5(lower) == hash\n lower.next!\n \n cur = gen.next\n break cur if md5(cur) == hash\n }\nend",
"def gnu_hash(s)\n s.bytes.reduce(5381) { |acc, elem| (acc * 33 + elem) & 0xffffffff }\n end",
"def test_hash_end_and_start\n\t\ttest_array1 = '2|abb2|George>Amina(16):Henry>James(4):Henry>Cyrus(17):Henry>Kublai(4):George>Rana(1):SYSTEM>Wu(100)|1518892051.753197000|c72d'.split('|').map(&:chomp)\n\t\ttest_array2 = '3|c72d|SYSTEM>Henry(100)|1518892051.764563000|7419'.split('|').map(&:chomp)\n\t\tassert_equal test_array2[1], test_array1[4]\n\tend",
"def test_hash_empty_string\n knot = KnotHash.new\n assert_equal \"a2582a3a0e66e6e86e3812dcb672a272\", knot.hash('')\n end",
"def split_hash(h)\n _, v, c, mash = h.split('$')\n return v.to_str, c.to_i, h[0, 29].to_str, mash[-31, 31].to_str\n end",
"def _hash_digest(key)\n m = Digest::MD5.new\n m.update(key)\n\n # No need to ord each item since ordinary array access\n # of a string in Ruby converts to ordinal value\n return m.digest\n end",
"def xlen(key); end",
"def decode(numbers, key)\n result = \"\"\n numbers.each_with_index do |n, i|\n result += (n ^ key[i % 3].ord).chr\n end\n result\nend",
"def read_hash(lh)\n # lh => location hash\n # lh = decodeURI(location.hash);\n p = false\n hi = false\n h = []\n s = {}\n\n # Version 2 of Emphasis (I am ignoring v1 here because I have not used it on the client side anyways)\n # #h[tbsaoa,Sstaoo,2,4],p[FWaadw] -> p = \"FWaadw\", h = [ \"tbsaoa\", \"Sstaoo\" ], s = { \"Sstaoo\" : [ 2, 4 ] }\n\n # findp = lh.match(/p\\[([^[\\]]*)\\]/)\n # findh = lh.match(/h\\[([^[\\]]*)\\]/)\n # p = (findp && findp.length>0) ? findp[1] : false;\n # hi = (findh && findh.length>0) ? findh[1] : false;\n\n # SEB: strange. it looks like that there was an error in the javascript regexp here but it still works in js!!!\n if lh =~ /p\\[([^\\]]*)\\]/\n p = $1\n end\n if lh =~ /h\\[([^\\]]*)\\]/\n hi = $1\n end\n # puts p\n # puts hi\n\n # undef = nil\n # hi = nil\n\n highlightings = []\n\n if (hi)\n hi = hi.scan(/[a-zA-Z]+(?:,[0-9]+)*/)\n\n hi.each do |hi_element|\n a = hi_element.split(',');\n key = a[0];\n # pos = this.find_key(key)['index']\n\n highlightings.push(find_key(key))\n\n # puts key\n # paragraph_for_key = find_key(key)\n # puts paragraph_for_key['index']\n # puts paragraph_for_key['elm'].to_html\n\n # if (pos != false) {\n # h.push(parseInt(pos)+1);\n # var b = a;\n # b.shift();\n # if (b.length>0) {\n # for (var j=1; j<b.length; j++) {\n # b[j] = parseInt(b[j]);\n # }\n # }\n # s[h[h.length - 1]] = b;\n # }\n # break\n end\n end\n\n # @p = p;\n # @h = h;\n # @s = s;\n return highlightings\n end",
"def hvals(key); end",
"def hvals(key); end",
"def key_replace\n /[^a-z0-9?]+/\n end",
"def hash() end",
"def hash() end",
"def hash() end",
"def hash() end",
"def hash() end",
"def hash() end",
"def hash() end",
"def hash_key(name); end",
"def ebsin_decode(data, key)\n rc4 = RubyRc4.new(key)\n (Hash[ rc4.encrypt(Base64.decode64(data.gsub(/ /,'+'))).split('&').map { |x| x.split(\"=\") } ]).slice(* NECESSARY )\n end",
"def ebsin_decode(data, key)\n rc4 = RubyRc4.new(key)\n (Hash[ rc4.encrypt(Base64.decode64(data.gsub(/ /,'+'))).split('&').map { |x| x.split(\"=\") } ]).slice(* NECESSARY )\n end",
"def decode_keys_mb(unique_collection_id)\n encoded_composed_key = unique_collection_id.split('-').last\n fix_encoded_composed_key = encoded_composed_key.gsub('!', '-')\n decoded_data = REDACTED(fix_encoded_composed_key)\n\n owner_collection_id, owner_id = decoded_data.split('~')\n\n {\n 'owner_collection_id' => owner_collection_id,\n 'owner_id' => owner_id\n }\n end",
"def create_key_a\n @key_chars[0..1].join.to_i\n end",
"def rekey_as_needed; end",
"def possible_keys(key); end",
"def hard(string)\n hasher = KnotHash.new(256, string.bytes + [17, 31, 73, 47, 23])\n 64.times { hasher.round }\n hasher.hash\nend",
"def stringified_keys; end",
"def hexists(key, field); end",
"def hexists(key, field); end",
"def jshash( key, len=key.length )\n state = 1315423911\n len.times{ |i|\n state ^= ( ( state << 5 ) + key[i] + ( state >> 2 ) )\n }\n return state\nend",
"def sub_hash(hash, key); end",
"def reserve_key(key); end",
"def decode6(str)\n num = 0\n i = 0\n while i < str.length\n num += KEYS_HASH[str[i]] * (BASE ** (str.length - 1 - i))\n i += 1\n end\n return num\nend",
"def process_input_for_key(value = nil)\n return value unless is_blank?(value)\n make_md5\n end",
"def make_key(length, key)\n i = 0\n length.times do\n i = 0 if i == key.length\n break if key.length == length\n \n key << key[i]\n i += 1\n end\n \n key\n end"
] | [
"0.6784983",
"0.6477835",
"0.6450952",
"0.6109658",
"0.6081626",
"0.60426044",
"0.6031243",
"0.60230654",
"0.60202855",
"0.60048664",
"0.59856784",
"0.5916765",
"0.5916414",
"0.5888078",
"0.5888078",
"0.58744115",
"0.5871993",
"0.58299124",
"0.58299124",
"0.58153516",
"0.5782696",
"0.5772487",
"0.5747034",
"0.57141286",
"0.5711492",
"0.5703889",
"0.569988",
"0.569971",
"0.56801885",
"0.5670991",
"0.56675524",
"0.5655302",
"0.5648255",
"0.5611185",
"0.56105167",
"0.55939746",
"0.558826",
"0.558826",
"0.55457973",
"0.5535929",
"0.55317086",
"0.5527883",
"0.55237347",
"0.5517682",
"0.5510312",
"0.55070615",
"0.5504725",
"0.5501265",
"0.54988563",
"0.54921746",
"0.5486376",
"0.5471708",
"0.5471708",
"0.5471708",
"0.5465615",
"0.5462828",
"0.545394",
"0.5453358",
"0.5449772",
"0.5449225",
"0.54427147",
"0.54426146",
"0.54336184",
"0.54275495",
"0.5427343",
"0.5422958",
"0.54188013",
"0.5418426",
"0.5414472",
"0.5411377",
"0.5404428",
"0.53971386",
"0.5385765",
"0.53824186",
"0.53794914",
"0.53794914",
"0.5377629",
"0.5373931",
"0.5373931",
"0.5373931",
"0.5373931",
"0.5373931",
"0.5373931",
"0.5373931",
"0.5369915",
"0.5361878",
"0.5361878",
"0.5353268",
"0.5352102",
"0.53518504",
"0.5349937",
"0.5349458",
"0.5347183",
"0.5343628",
"0.5343628",
"0.5336085",
"0.5318763",
"0.5316759",
"0.5314675",
"0.53143734",
"0.5311298"
] | 0.0 | -1 |
convert from/to escaped characters | def convert_path(string, direction)
string = string.dup
if direction == :decode
ENCODINGS.each { |k, v| string.gsub!(v.to_s, k.to_s) }
elsif direction == :encode
ENCODINGS.each { |k, v| string.gsub!(k.to_s, v.to_s) }
else
raise ArgumentError, "direction is required"
end
string
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def parse_escaped_chars; end",
"def esc(inString)\n #2015-04-04 BN: gsub stumbles on apostrophes so I created a unique treatment for them\n # from http://stackoverflow.com/questions/8929218/how-to-replace-an-apostrophe-using-gsub\n inString = inString.gsub(/[']/, \"\\\\\\\\\\'\")\n\n #For each of the characters in the list of characters to be escaped\n $eChars.each do |thisChar|\n #Replace every instance of thisChar with thisChar appended to an\n #escape character. We have to escape the escape to use it\n inString = inString.gsub(thisChar, \"\\\\\"+thisChar)\n end\n return inString\nend",
"def escape(input); input.to_s.gsub('\"', '\\\\\"'); end",
"def convert_escape_characters(*args, &block)\n maatsf_convert_escape_characters(super(*args, &block))\n end",
"def escape(str); end",
"def escape(str)\n str.gsub(/\\t/, '\\t').gsub(/\\n/, '\\n').gsub(/\\\\/, \"\\\\\\\\\\\\\")\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 escape(str)\n str.to_s.gsub(/\\\\/, '\\&\\&').gsub(/'/, \"''\").force_encoding('US-ASCII')\n end",
"def escape(text)\n return text.gsub(/[\\`*_{}\\[\\]()#+\\-.!]/, \"\\\\\\\\\\\\0\")\n end",
"def escape(string); end",
"def character_escape(string)\n string.gsub(/^'/, '').gsub(/'$/, '').gsub(/\\\\'/, \"'\")\n end",
"def unescape( value )\n return value unless @escape\n\n value = value.to_s\n value.gsub!(%r/\\\\[0nrt\\\\]/) { |char|\n case char\n when '\\0'; \"\\0\"\n when '\\n'; \"\\n\"\n when '\\r'; \"\\r\"\n when '\\t'; \"\\t\"\n when '\\\\\\\\'; \"\\\\\"\n end\n }\n value\n end",
"def escape_double_quotes(str_to_escape)\n # Hash containing the required conversion\n conversions = {\n %r{\"}=>'"'\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 escape_value(value)\n value = value.to_s.dup\n value.gsub!(%r{\\\\([0nrt])}, '\\\\\\\\\\1')\n value.gsub!(%r{\\n}, '\\n')\n value.gsub!(%r{\\r}, '\\r')\n value.gsub!(%r{\\t}, '\\t')\n value.gsub!(%r{\\0}, '\\0')\n value\n end",
"def escape_characters(string)\n ['&','-','?','|','!',\"'\",'+'].each do |syn_char|\n string = string.gsub(syn_char,'\\\\\\\\' + \"#{syn_char}\")\n end\n return string\n end",
"def set_escaped(options={})\n self.split(//).map do |ch|\n res = ch.escaped\n res = \"\\\\x#{'%02X' % ch.ord}\" if options[:no_ctrl] && res=~/^\\\\\\w$/\n res.gsub(\"-\",'\\\\-')\n end.join\n end",
"def escape(text)\n text.gsub('\"', '\\\"')\nend",
"def escape(s)\n s.gsub(/[&<>`]/, \"&\" => \"&\", \"<\" => \"<\", \">\" => \">\", \"`\" => \"`\")\n end",
"def decode_escape(input)\n c = input.look_ahead(1)\n case c\n when \"a\" : result = \"\\a\"\n when \"b\" : result = \"\\b\"\n when \"f\" : result = \"\\f\"\n when \"n\" : result = \"\\n\"\n when \"r\" : result = \"\\r\"\n when \"t\" : result = \"\\t\"\n when \"v\" : result = \"\\v\"\n when \"\\\\\" : result = \"\\\\\"\n when /[01234567]/ : raise \"Escaped octal Unicode not supported\"\n when \"x\" : raise \"Escaped hex Unicode not supported\"\n when \"u\" : raise \"Escaped Unicode not supported\"\n else\n result = c\n end\n input.consume 2\n return result\n end",
"def consume_escaped; end",
"def shell_escape\n inspect.gsub(/\\\\(\\d{3})/) { $1.to_i(8).chr }\n end",
"def shell_escape(s)\n s = s.to_s\n if s !~ /^[0-9A-Za-z+,.\\/:=@_-]+$/\n s = s.gsub(\"'\") { \"'\\\\''\" }\n s = \"'#{s}'\"\n end\n s\n end",
"def likeEscape( str )\n str.gsub( \"\\\\\", \"\\\\\\\\\" ).gsub( \"%\", \"\\%\" ).gsub( \"_\", \"\\_\" )\n end",
"def e(str)\n str.to_s.gsub(/(?=[^a-zA-Z0-9_.\\/\\-\\x7F-\\xFF\\n])/n, '\\\\').\n gsub(/\\n/, \"'\\n'\").\n sub(/^$/, \"''\")\n end",
"def escape_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 escape_string(str)\n replacement = {\n ':)' => \"\\n\", ':>' => \"\\t\", ':o' => \"\\a\", ':\"' => '\"', '::' => ':'\n }\n str\n .gsub(/:[\\)>o\":]/, replacement)\n .gsub(/:\\(([0-9a-fA-F]+)\\)/) do |match|\n $1.to_i(16).chr(Encoding::UTF_8)\n end\n .gsub(/:\\[(.+?)\\]/) do |match|\n code = Unicode::DATA[$1]\n if code\n code.chr(Encoding::UTF_8)\n else\n $stderr.puts(\"Unknown Unicode normative name: #{$1}\")\n match\n end\n end\n end",
"def escaped_char(escape)\n if escape =~ /^\\\\([0-9a-fA-F]{1,6})[ \\t\\r\\n\\f]?/\n $1.to_i(16).chr(Encoding::UTF_8)\n else\n escape[1]\n end\n end",
"def shellescape(str)\n str = str.to_s\n\n # An empty argument will be skipped, so return empty quotes.\n return \"''\" if str.empty?\n\n str = str.dup\n\n # Treat multibyte characters as is. It is caller's responsibility\n # to encode the string in the right encoding for the shell\n # environment.\n str.gsub!(/([^A-Za-z0-9_\\-.,:\\/@\\n])/, \"\\\\\\\\\\\\1\")\n\n # A LF cannot be escaped with a backslash because a backslash + LF\n # combo is regarded as line continuation and simply ignored.\n str.gsub!(/\\n/, \"'\\n'\")\n\n return str\n end",
"def handle_special_characters(text)\n\n if text.include?(\"'\") then\n text.gsub!(\"'\",\"_\")\n end\n if text.include?(\"\\\\\") then\n text.gsub!(\"\\\\\",\"_\")\n end\n\n text\n end",
"def escape_string(str)\n str.gsub(/[\\0\\n\\r\\\\\\'\\\"\\x1a]/) do |s|\n case s\n when \"\\0\" then \"\\\\0\"\n when \"\\n\" then \"\\\\n\"\n when \"\\r\" then \"\\\\r\"\n when \"\\x1a\" then \"\\\\Z\"\n else \"\\\\#{s}\"\n end\n end\n end",
"def unescape_value(value)\n value = value.to_s\n value.gsub!(%r{\\\\[0nrt\\\\]}) do |char|\n case char\n when '\\0' then \"\\0\"\n when '\\n' then \"\\n\"\n when '\\r' then \"\\r\"\n when '\\t' then \"\\t\"\n when '\\\\\\\\' then '\\\\'\n end\n end\n value\n end",
"def escape_string(str)\n str.gsub(/[\\0\\n\\r\\\\\\'\\\"\\x1a]/) do |s|\n case s\n when \"\\0\" then \"\\\\0\"\n when \"\\n\" then \"\\\\n\"\n when \"\\r\" then \"\\\\r\"\n when \"\\x1a\" then \"\\\\Z\"\n else \"\\\\#{s}\"\n end\n end\n end",
"def escape(s)\n s.gsub('\"', '\\\"')\nend",
"def e_sh(str)\n str.to_s.gsub(/(?=[^a-zA-Z0-9_.\\/\\-\\x7F-\\xFF\\n])/n, '\\\\').gsub(/\\n/, \"'\\n'\").sub(/^$/, \"''\")\nend",
"def shellescape(str)\n str = str.to_s\n\n # An empty argument will be skipped, so return empty quotes.\n return \"''\" if str.empty?\n\n str = str.dup\n\n # Treat multibyte characters as is. It is caller's responsibility\n # to encode the string in the right encoding for the shell\n # environment.\n str.gsub!(/([^A-Za-z0-9_\\-.,:\\/@\\n])/, \"\\\\\\\\\\\\1\")\n\n # A LF cannot be escaped with a backslash because a backslash + LF\n # combo is regarded as line continuation and simply ignored.\n str.gsub!(/\\n/, \"'\\n'\")\n\n return str\nend",
"def latex_escape(source)\n source.chars.inject('') do |s, b|\n s << if b == '\\\\'\n '~'\n elsif SAFE_CHARS.include? b\n b\n else\n \"\\\\char%d\" % b[0].ord\n end\n end\n end",
"def convert_string(text)\n CGI.escapeHTML text\n end",
"def shellescape(str)\n # An empty argument will be skipped, so return empty quotes.\n return \"''\" if str.empty?\n\n str = str.dup\n\n # Treat multibyte characters as is. It is caller's responsibility\n # to encode the string in the right encoding for the shell\n # environment.\n str.gsub!(/([^A-Za-z0-9_\\-.,:\\/@\\n])/, \"\\\\\\\\\\\\1\")\n\n # A LF cannot be escaped with a backslash because a backslash + LF\n # combo is regarded as line continuation and simply ignored.\n str.gsub!(/\\n/, \"'\\n'\")\n\n return str\nend",
"def escape_string(str)\n return if str.nil?\n str.gsub(/[\\0\\n\\r\\\\\\'\\\"\\x1a]/) do |s|\n case s\n when \"\\0\" then \"\\\\0\"\n when \"\\n\" then \"\\\\n\"\n when \"\\r\" then \"\\\\r\"\n when \"\\x1a\" then \"\\\\Z\"\n else \"\\\\#{s}\"\n end\n end\nend",
"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 unescape_stringify(str)\n chars = {\n 'a' => \"\\x07\", 'b' => \"\\x08\", 't' => \"\\x09\", 'n' => \"\\x0a\", 'v' => \"\\x0b\", 'f' => \"\\x0c\",\n 'r' => \"\\x0d\", 'e' => \"\\x1b\", \"\\\\\\\\\" => \"\\x5c\", \"\\\"\" => \"\\x22\", \"'\" => \"\\x27\"\n }\n # Escape all the things\n str.gsub(/\\\\(?:([#{chars.keys.join}])|u([\\da-fA-F]{4}))|\\\\0?x([\\da-fA-F]{2})/) {\n if $1\n if $1 == '\\\\'\n then '\\\\'\n else\n chars[$1]\n end\n elsif $2\n [\"#$2\".hex].pack('U*')\n elsif $3\n [$3].pack('H2')\n end\n }\n end",
"def escape_string (string)\n string.gsub(/([\\x00-\\x1f\\x21-\\x2f\\x3a-\\x40\\x5b-\\x5e\\x60\\x7b-\\x7f])/, '\\\\\\\\\\\\1')\n end",
"def escape_text(text)\n text\n end",
"def ascii_quotes\n value = self.gsub(/'/, \"'\").gsub(/\"/, \""\")\n return value\n end",
"def shell_escape(string)\n return string.gsub(/\\\\/, \"\\\\\\\\\\\\\").gsub(/\\\"/, \"\\\\\\\"\").gsub(/\\$/, \"\\\\\\$\").gsub(/\\`/, \"\\\\\\\\\\`\")\n end",
"def unescape_component(x)\n # temporarily escape \\\\ as \\007f, which is disallowed in any text\n x.gsub(/\\\\\\\\/, \"\\u007f\").gsub(/\\\\;/, \";\").gsub(/\\\\,/, \",\").\n gsub(/\\\\[Nn]/, \"\\n\").tr(\"\\u007f\", \"\\\\\")\n end",
"def unescape(x)\n # temporarily escape \\\\ as \\007f, which is disallowed in any text\n x.gsub(/\\\\\\\\/, \"\\u007f\").gsub(/\\\\,/, \",\").gsub(/\\\\[Nn]/, \"\\n\").\n tr(\"\\u007f\", \"\\\\\")\n end",
"def _quoteString ( str )\n str.gsub( /\\\\/, '\\&\\&' ).gsub( /'/, \"''\" ) # ' (for ruby-mode)\n end",
"def escape_shell_string(str)\n str = str.gsub(/\\\\/, \"\\\\\\\\\\\\\")\n str = str.gsub(/\"/, \"\\\\\\\"\")\n str = str.gsub(/`/, \"\\\\`\")\n str = str.gsub(/;/, \"\\\\;\")\n str = str.gsub(/&/, \"\\\\&\")\n str = str.gsub(/\\|/, \"\\\\|\")\n str = str.gsub(/\\$/, \"\\\\$\")\n str = str.gsub(/ /, \"\\\\ \")\n str\n end",
"def escape_quotes input\n\t\tinput.gsub!(/([\\'\\\"])/,\"\\\\\\1\") #single quote\n\t\t\n\t\treturn input\n\tend",
"def escape(s)\n s.to_s.gsub('\"', '"').gsub(\"'\", ''')\n end",
"def convert_escape_characters(text)\n result = rm_extender_convert_escape_characters(text).to_s.clone\n result.gsub!(/\\eL\\[\\:(\\w+)\\]/i) { L[$1.to_sym] }\n result.gsub!(/\\eSL\\[\\:(\\w+)\\]/i) { SL[$game_message.call_event, $1.to_sym] }\n result.gsub!(/\\eSL\\[(\\d+)\\,\\s*\\:(\\w+)\\]/i) { SL[$1.to_i, $2.to_sym] }\n result.gsub!(/\\eSL\\[(\\d+)\\,\\s*(\\d+)\\,\\s*\\:(\\w+)\\]/i) { SL[$1.to_i, $2.to_i, $3.to_sym] }\n result.gsub!(/\\eSV\\[([^\\]]+)\\]/i) do\n numbers = $1.extract_numbers\n array = [*numbers]\n if numbers.length == 1\n array = [$game_message.call_event] + array\n end\n SV[*array]\n end\n return result\n end",
"def escape(*chars)\n gsub(/(?<!\\\\)(#{chars.join(\"|\")})/) do |char|\n \"\\\\\" + char\n end\n end",
"def escape_str(str)\n str.gsub!(/[`\\\\]/, '\\\\\\\\\\&')\n str.gsub!(/\\r\\n/, \"\\\\r\\r\\n\") if @newline == \"\\r\\n\"\n return str\n end",
"def decode_json_scrp\n self\n .gsub('\\u0022', '\"')\n .gsub('\\u00E0', \"à\")\n .gsub('\\u00E2', \"â\")\n .gsub('\\u00E8', \"è\")\n .gsub('\\u00E9', \"é\")\n .gsub('\\u00E7', \"ç\")\n .gsub('\\u00F9', \"ù\")\n .gsub('\\u0026', \"&\")\n .gsub('\\u20AC', \"€\")\n .gsub('\\u0027', \"'\")\n .gsub('\\u00A0', \"\")\n .gsub('\\u00C8', \"È\")\n .gsub('\\u00B2', \"²\")\n .gsub('\\u00C9', \"É\")\n .gsub('\\\\\"', '\"')\n end",
"def create_escape_value(value)\n if value.is_a?(String) || value.is_a?(Symbol)\n \"#{sanitize_escape_sequences(value.to_s)}\"\n else\n value\n end\n end",
"def convert_string_fancy(item)\n # convert ampersand before doing anything else\n item.gsub(/&/, '&').\n\n # convert -- to em-dash, (-- to en-dash)\n gsub(/---?/, '—'). #gsub(/--/, '–').\n\n # convert ... to elipsis (and make sure .... becomes .<elipsis>)\n gsub(/\\.\\.\\.\\./, '.…').gsub(/\\.\\.\\./, '…').\n\n # convert single closing quote\n gsub(%r{([^ \\t\\r\\n\\[\\{\\(])\\'}, '\\1’'). # }\n gsub(%r{\\'(?=\\W|s\\b)}, '’').\n\n # convert single opening quote\n gsub(/'/, '‘').\n\n # convert double closing quote\n gsub(%r{([^ \\t\\r\\n\\[\\{\\(])\\\"(?=\\W)}, '\\1”'). # }\n\n # convert double opening quote\n gsub(/\"/, '“').\n\n # convert copyright\n gsub(/\\(c\\)/, '©').\n\n # convert registered trademark\n gsub(/\\(r\\)/, '®')\n end",
"def escape_shell_special_chars(string)\n string.gsub(/([ ()])/, '\\\\\\\\\\1')\n end",
"def singleq2utf\n self.gsub(\"'\", '%EF%BC%87')\n end",
"def escape_for_double_quotes(str)\n str.gsub(/[\\\\\"`$]/) { |c| \"\\\\#{c}\" }\nend",
"def escape(string)\n string.gsub('\\\\', '\\\\\\\\').\n gsub(\"\\b\", '\\\\b').\n gsub(\"\\f\", '\\\\f').\n gsub(\"\\t\", '\\\\t').\n gsub(\"\\n\", '\\\\n').\n gsub(\"\\r\", '\\\\r').\n gsub('\"', '\\\\\"')\n end",
"def shellescape(str)\n # An empty argument will be skipped, so return empty quotes.\n return \"''\" if str.empty?\n\n str = str.dup\n\n # Process as a single byte sequence because not all shell\n # implementations are multibyte aware.\n str.gsub!(/([^A-Za-z0-9_\\-.,:\\/@\\n])/n, \"\\\\\\\\\\\\1\")\n\n # A LF cannot be escaped with a backslash because a backslash + LF\n # combo is regarded as line continuation and simply ignored.\n str.gsub!(/\\n/, \"'\\n'\")\n\n return str\n end",
"def escape(line)\n s = line.sub(/\\s+$/, '').\n gsub(/\\\\/, \"\\\\bs\\?C-q\").\n gsub(/([_\\${}&%#])/, '\\\\\\\\\\1').\n gsub(/\\?C-q/, \"{}\").\n gsub(/\\^/, \"\\\\up{}\").\n gsub(/~/, \"\\\\sd{}\").\n gsub(/\\*/, \"$*$\").\n gsub(/<</, \"<{}<\").\n gsub(/>>/, \">{}>\").\n gsub(/\\[\\]/, \"$[\\\\,]$\").\n gsub(/,,/, \",{},\").\n gsub(/`/, \"\\\\bq{}\")\n s\nend",
"def convert_slashes(path)\n path.gsub('/', '\\\\').gsub('\\\\', '\\\\\\\\\\\\\\\\') #eek\n end",
"def shellescape\n Shellwords.escape(self)\n end",
"def unicode_esc!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 9 )\n\n \n # - - - - main rule block - - - -\n # at line 309:9: '\\\\\\\\' 'u' HEX_DIGIT HEX_DIGIT HEX_DIGIT HEX_DIGIT\n match( 0x5c )\n match( 0x75 )\n hex_digit!\n hex_digit!\n hex_digit!\n hex_digit!\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 9 )\n\n end",
"def escape_text input\n escape input, text_regexp, text_mapping\n end",
"def escape_str(str)\n str.gsub!(/[\\\\`\\#]/, '\\\\\\\\\\&')\n str.gsub!(/\\r\\n/, \"\\\\r\\r\\n\") if @newline == \"\\r\\n\"\n return str\n end",
"def quote_transform(input)\n input.gsub(/\"/, '"')\n end",
"def quote_str(s)\n s.gsub(/\\\\/, '\\&\\&').gsub(/'/, \"''\")\n end",
"def shellescape(str)\n # An empty argument will be skipped, so return empty quotes.\n return \"''\" if str.empty?\n\n str = str.dup\n\n # Process as a single byte sequence because not all shell\n # implementations are multibyte aware.\n str.gsub!(/([^A-Za-z0-9_\\-.,:\\/@\\n])/n, \"\\\\\\\\\\\\1\")\n\n # A LF cannot be escaped with a backslash because a backslash + LF\n # combo is regarded as line continuation and simply ignored.\n str.gsub!(/\\n/, \"'\\n'\")\n\n return str\n end",
"def escape_string(str)\n str.gsub(/([\\0\\n\\r\\032\\'\\\"\\\\])/) do\n case $1\n when \"\\0\" then \"\\\\0\"\n when \"\\n\" then \"\\\\n\"\n when \"\\r\" then \"\\\\r\"\n when \"\\032\" then \"\\\\Z\"\n else \"\\\\\"+$1\n end\n end\n end",
"def qesc(s)\n s.gsub(\"'\", \"''\")\nend",
"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 convert_string(item)\n escape(item).\n\n # convert ... to elipsis (and make sure .... becomes .<elipsis>)\n gsub(/\\.\\.\\.\\./, '.\\ldots{}').gsub(/\\.\\.\\./, '\\ldots{}').\n\n # convert single closing quote\n gsub(%r{([^ \\t\\r\\n\\[\\{\\(])\\'}, '\\1\\'').\n gsub(%r{\\'(?=\\W|s\\b)}, \"'\" ).\n\n # convert single opening quote\n gsub(/'/, '`').\n\n # convert double closing quote\n gsub(%r{([^ \\t\\r\\n\\[\\{\\(])\\\"(?=\\W)}, \"\\\\1''\").\n\n # convert double opening quote\n gsub(/\"/, \"``\").\n\n # convert copyright\n gsub(/\\(c\\)/, '\\copyright{}')\n\n end",
"def escape_special_chars( str )\n\t\t\[email protected] \" Escaping special characters\"\n\t\t\ttext = ''\n\n\t\t\t# The original Markdown source has something called '$tags_to_skip'\n\t\t\t# declared here, but it's never used, so I don't define it.\n\n\t\t\ttokenize_html( str ) {|token, str|\n\t\t\t\[email protected] \" Adding %p token %p\" % [ token, str ]\n\t\t\t\tcase token\n\n\t\t\t\t# Within tags, encode * and _\n\t\t\t\twhen :tag\n\t\t\t\t\ttext += str.\n\t\t\t\t\t\tgsub( /\\*/, EscapeTable['*'][:md5] ).\n\t\t\t\t\t\tgsub( /_/, EscapeTable['_'][:md5] )\n\n\t\t\t\t# Encode backslashed stuff in regular text\n\t\t\t\twhen :text\n\t\t\t\t\ttext += encode_backslash_escapes( str )\n\t\t\t\telse\n\t\t\t\t\traise TypeError, \"Unknown token type %p\" % token\n\t\t\t\tend\n\t\t\t}\n\n\t\t\[email protected] \" Text with escapes is now: %p\" % text\n\t\t\treturn text\n\t\tend",
"def escape_string(string)\n string.to_s.gsub(/([\\\\()|\\-!@~\"&\\/\\^\\$=])/, '\\\\\\\\\\\\1')\n end",
"def escape_single_quotes(str)\n str.gsub(\"'\", '\\\\\\\\\\'')\nend",
"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(string)\r\n # Globally replace characters based on the ESCAPE_CHARACTERS constant\r\n string.to_s.gsub(/[&\"><]/) { |special| ESCAPE_CHARACTERS[special] } if string\r\n end",
"def escape(string)\r\n # Globally replace characters based on the ESCAPE_CHARACTERS constant\r\n string.to_s.gsub(/[&\"><]/) { |special| ESCAPE_CHARACTERS[special] } if string\r\n end",
"def escape(string)\r\n # Globally replace characters based on the ESCAPE_CHARACTERS constant\r\n string.to_s.gsub(/[&\"><]/) { |special| ESCAPE_CHARACTERS[special] } if string\r\n end",
"def escape(string)\r\n # Globally replace characters based on the ESCAPE_CHARACTERS constant\r\n string.to_s.gsub(/[&\"><]/) { |special| ESCAPE_CHARACTERS[special] } if string\r\n end",
"def escape(string)\r\n # Globally replace characters based on the ESCAPE_CHARACTERS constant\r\n string.to_s.gsub(/[&\"><]/) { |special| ESCAPE_CHARACTERS[special] } if string\r\n end",
"def escape(string)\r\n # Globally replace characters based on the ESCAPE_CHARACTERS constant\r\n string.to_s.gsub(/[&\"><]/) { |special| ESCAPE_CHARACTERS[special] } if string\r\n end",
"def escape(string)\r\n # Globally replace characters based on the ESCAPE_CHARACTERS constant\r\n string.to_s.gsub(/[&\"><]/) { |special| ESCAPE_CHARACTERS[special] } if string\r\n end",
"def escape(string)\r\n # Globally replace characters based on the ESCAPE_CHARACTERS constant\r\n string.to_s.gsub(/[&\"><]/) { |special| ESCAPE_CHARACTERS[special] } if string\r\n end",
"def escape(string)\r\n # Globally replace characters based on the ESCAPE_CHARACTERS constant\r\n string.to_s.gsub(/[&\"><]/) { |special| ESCAPE_CHARACTERS[special] } if string\r\n end",
"def escape(string)\r\n # Globally replace characters based on the ESCAPE_CHARACTERS constant\r\n string.to_s.gsub(/[&\"><]/) { |special| ESCAPE_CHARACTERS[special] } if string\r\n end",
"def escape(string)\r\n # Globally replace characters based on the ESCAPE_CHARACTERS constant\r\n string.to_s.gsub(/[&\"><]/) { |special| ESCAPE_CHARACTERS[special] } if string\r\n end",
"def escape(s); s.to_s.gsub(/([^ a-zA-Z0-9_.-]+)/n){'%'+$1.unpack('H2'*$1.size).join('%').upcase}.tr(' ', '+') end",
"def escape(str)\n ERB::Util.h(str).gsub('"', '\"').gsub(''', \"'\")\n end",
"def escape_literal(text)\n text\n end",
"def encode_backslash_escapes( str )\n\t\t\t# Make a copy with any double-escaped backslashes encoded\n\t\t\ttext = str.gsub( /\\\\\\\\/, EscapeTable['\\\\\\\\'][:md5] )\n\n\t\t\tEscapeTable.each_pair {|char, esc|\n\t\t\t\tnext if char == '\\\\\\\\'\n\t\t\t\tnext unless char =~ /\\\\./\n\t\t\t\ttext.gsub!( esc[:re], esc[:md5] )\n\t\t\t}\n\n\t\t\treturn text\n\t\tend",
"def json_escape_string(s)\n return s if s !~ /[\"\\\\\\b\\f\\n\\r\\t]/\n\n result = \"\"\n s.split(\"\").each do |c|\n case c\n when '\"', \"\\\\\"\n result << \"\\\\\" << c\n when \"\\n\" then result << \"\\\\n\"\n when \"\\t\" then result << \"\\\\t\"\n when \"\\r\" then result << \"\\\\r\"\n when \"\\f\" then result << \"\\\\f\"\n when \"\\b\" then result << \"\\\\b\"\n else\n result << c\n end\n end\n result\n end",
"def tex_escape(text)\n replacements = {\n '&' => '\\&',\n '%' => '\\%',\n '$' => '\\$',\n '#' => '\\#',\n '_' => '\\_',\n '{' => '\\{',\n '}' => '\\}',\n '~' => '\\textasciitilde{}',\n '^' => '\\^{}',\n '\\\\' => '\\textbackslash{}',\n '<' => '\\textless',\n '>' => '\\textgreater',\n }\n\n replacements.each do |search, escaped_replacement|\n text = text.gsub(search, escaped_replacement)\n end\n\n text\n end",
"def texescape(input)\n input.gsub(\"#\", \"\\\\#\")\n end",
"def parse_escaped_chars\n @src.pos += @src.matched_size\n add_text(@src[1])\n end",
"def escape_string(str)\n str.gsub(\"'\", \"''\")\n end",
"def escape_string_manually(phone_input)\n\n # escape backslashes first so we don't escape the\n # backslashes we'll add to escape other special characters\n phone_input = phone_input.gsub(\"\\\\\", \"\\\\\\\\\\\\\")\n\n char_to_replacement = {\n \"\\0\" => \"\\\\\\\\0\",\n \"\\n\" => \"\\\\n\",\n \"\\r\" => \"\\\\r\",\n \"'\" => \"\\\\\\\\'\",\n \"\\\"\" => \"\\\\\\\"\",\n }\n\n char_to_replacement.each do |char_to_replace, replacement|\n next if not phone_input.include? char_to_replace\n phone_input = phone_input.gsub(char_to_replace, replacement)\n end\n\n return phone_input\nend",
"def unencode_javascript_unicode_escape(str)\n if str.respond_to?(:gsub!)\n str.gsub!(/\\\\u([0-9a-fA-F]{4})/) do |s| \n int = $1.to_i(16)\n if int.zero? && s != \"0000\"\n s\n else\n [int].pack(\"U\")\n end\n end\n end\n str\n end"
] | [
"0.762698",
"0.749829",
"0.74687576",
"0.7393609",
"0.7189774",
"0.70227057",
"0.7012753",
"0.7010447",
"0.69984215",
"0.69752836",
"0.6856872",
"0.6843667",
"0.68365383",
"0.68054014",
"0.67955446",
"0.67667705",
"0.67494166",
"0.67342466",
"0.6729072",
"0.6718489",
"0.6707138",
"0.6699614",
"0.66807365",
"0.66799134",
"0.66773385",
"0.6651345",
"0.66440856",
"0.66434115",
"0.66341424",
"0.6614326",
"0.66053843",
"0.66047883",
"0.6601913",
"0.6594257",
"0.6577752",
"0.6573024",
"0.6563674",
"0.6560436",
"0.65596867",
"0.6559115",
"0.655614",
"0.65482944",
"0.6544768",
"0.65291744",
"0.6528544",
"0.6528193",
"0.6526135",
"0.6526032",
"0.65234613",
"0.6518525",
"0.65081453",
"0.649644",
"0.648928",
"0.64778847",
"0.64656067",
"0.6465175",
"0.64646554",
"0.64623463",
"0.64622825",
"0.6450103",
"0.6442373",
"0.6442263",
"0.6429566",
"0.6404479",
"0.63986284",
"0.6394968",
"0.6391131",
"0.63891023",
"0.63875276",
"0.6382303",
"0.6381591",
"0.6377084",
"0.6365962",
"0.63610893",
"0.63580775",
"0.63524973",
"0.6350559",
"0.63479114",
"0.6347086",
"0.63463825",
"0.63463825",
"0.63463825",
"0.63463825",
"0.63463825",
"0.63463825",
"0.63463825",
"0.63463825",
"0.63463825",
"0.63463825",
"0.63463825",
"0.63354707",
"0.6326708",
"0.6316405",
"0.6315784",
"0.63149935",
"0.63107234",
"0.63093567",
"0.6308697",
"0.6304897",
"0.6302655",
"0.629667"
] | 0.0 | -1 |
uncomment when you have Enumerable included | def to_s
pairs = inject([]) do |strs, (k, v)|
strs << "#{k.to_s} => #{v.to_s}"
end
"{\n" + pairs.join(",\n") + "\n}"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def inclusions; end",
"def through; end",
"def collect; end",
"def refute_includes(collection, obj, msg = T.unsafe(nil)); end",
"def includes\n []\n end",
"def exclude; end",
"def each_identity; end",
"def excluded; end",
"def inclusions=(_arg0); end",
"def includes() return @includes end",
"def yield_all\n include.yield_all do |i|\n yield i unless exclude.include?(i)\n end\n nil\n end",
"def each_set\n \n end",
"def included; end",
"def includes\n end",
"def includes\n end",
"def each(*) end",
"def possibly_include_hidden?; end",
"def whitelist; end",
"def iteration_associations\n [].freeze\n end",
"def get_iterator\n\t\tend",
"def each(&block); end",
"def each(&block); end",
"def each(&block); end",
"def each(&block); end",
"def each(&block); end",
"def each(&block); end",
"def select_all; end",
"def deep_each\n \n end",
"def ordered_list; end",
"def inclusions\n @inclusions ||= []\n end",
"def each\n raise 'Not implemented'\n end",
"def each; end",
"def each; end",
"def each; end",
"def each; end",
"def each; end",
"def each; end",
"def each; end",
"def each; end",
"def each; end",
"def each; end",
"def each; end",
"def ignore; end",
"def filter_generator; end",
"def enumerator ; end",
"def enumerator ; end",
"def filtered_entries; end",
"def without_unions\n raise ActionNotSupportedError.new(:each, self)\n end",
"def enumerator; end",
"def assert_includes(collection, obj, msg = T.unsafe(nil)); end",
"def iterator()\n raise NotImplementedError\n end",
"def normalize_includes!\n # TODO: normalize Array of Symbol, String, DM::Property 1-jump-away or DM::Query::Path\n end",
"def test_skips_all_elements\n stream = FromArray.new([1, 2, 3])\n collected = stream.skip(3).collect\n assert(\n collected == [],\n 'Expected ' + [].to_s + ' but got ' + collected.to_s\n )\n end",
"def available_includes\n []\n end",
"def collections; end",
"def each_include # :yields: include\n @includes.each do |i| yield i end\n end",
"def each_include # :yields: include\n @includes.each do |i| yield i end\n end",
"def default_includes\n []\n end",
"def allowed_includes\n []\n end",
"def offences_by; end",
"def ignores; end",
"def take_all; end",
"def filter; end",
"def filter; end",
"def filter; end",
"def find_all\n \n end",
"def each(&block)\n if use_eager_all?\n all(&block)\n else\n super\n end\n end",
"def set(enumerable); end",
"def _all; end",
"def dont_care\n each(&:dont_care)\n myself\n end",
"def includes_for_sorting\n []\n end",
"def collect\n end",
"def conclusions(&block)\n if block_given?\n # Invoke {#each} in the containing class:\n each_statement {|s| block.call(s) if s.inferred?}\n end\n enum_conclusions\n end",
"def skipped; end",
"def collection include_object_type=false, &block\n ASObj.generate :collection, !include_object_type, &block\n end",
"def expanded; end",
"def precedes; [] end",
"def anonymous_safelists; end",
"def included\n @included.uniq! if @included.respond_to?(:uniq!)\n @included\n end",
"def filter!; end",
"def collect!\n block_given? or return enum_for(__method__)\n set = self.class.new\n each { |o| set << yield(o) }\n replace(set)\n end",
"def unordered_list; end",
"def before_each\n super if defined?(super)\n end",
"def included(descendant); end",
"def included(descendant); end",
"def preview_includes\n []\n end",
"def list\n return @enumerable\n end",
"def unused_eager_loading_enable=(_arg0); end",
"def discard_results; end",
"def isolated; end",
"def isolated; end",
"def each(&a_proc); end",
"def each\n to_a.each\n end",
"def each\n to_a.each\n end",
"def each\n to_a.each\n end",
"def elements; end",
"def elements; end",
"def elements; end",
"def offences_by=(_arg0); end",
"def my_select(coll)\n # your code here!\n mod_coll = []\n i=0\n while i < coll.length\n if (yield(coll[i]))\n mod_coll.push(coll[i])\n end\n i = i+1\n end\n mod_coll\nend",
"def each(include_deleted = false)\n values(include_deleted).each do |v|\n yield v\n end\n end"
] | [
"0.59435934",
"0.5794355",
"0.5722233",
"0.5718117",
"0.569589",
"0.5684911",
"0.5664752",
"0.566228",
"0.5641536",
"0.5562596",
"0.55595744",
"0.5515245",
"0.5475617",
"0.5450039",
"0.5450039",
"0.54184806",
"0.53960466",
"0.53936493",
"0.53872144",
"0.5383926",
"0.53793705",
"0.53793705",
"0.53793705",
"0.53793705",
"0.53793705",
"0.53793705",
"0.5371046",
"0.53624374",
"0.53621054",
"0.53593624",
"0.53485185",
"0.53420144",
"0.53420144",
"0.53420144",
"0.53420144",
"0.53420144",
"0.53420144",
"0.53420144",
"0.53420144",
"0.53420144",
"0.53420144",
"0.53420144",
"0.53413385",
"0.53324723",
"0.53281343",
"0.53281343",
"0.53280157",
"0.531924",
"0.5310386",
"0.5298974",
"0.52901894",
"0.5277176",
"0.5272725",
"0.52518034",
"0.52495515",
"0.5246925",
"0.5246925",
"0.5234646",
"0.52303594",
"0.5223956",
"0.52172506",
"0.5217214",
"0.5216229",
"0.5216229",
"0.5216229",
"0.52015996",
"0.5201288",
"0.51619774",
"0.51589257",
"0.515669",
"0.5139058",
"0.51311517",
"0.5128511",
"0.5108543",
"0.5100557",
"0.50973856",
"0.5095881",
"0.5092179",
"0.5091713",
"0.5081354",
"0.50760096",
"0.50749415",
"0.5066324",
"0.5053365",
"0.5053365",
"0.5052689",
"0.5049896",
"0.50338376",
"0.5028048",
"0.50274676",
"0.50274676",
"0.50250345",
"0.50207627",
"0.50207627",
"0.50207627",
"0.5019888",
"0.5019888",
"0.5019888",
"0.5011826",
"0.5004402",
"0.4995867"
] | 0.0 | -1 |
PUBLIC METHODS Heading defines the main means of addressing the model | def heading
has_reverse? ? "#{left_name} & #{right_name}" : left_name.pluralize
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def model\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 model\n end",
"def model\n end",
"def model\n end",
"def make_and_model; end",
"def model\n @model\n end",
"def model\n @model\n end",
"def model\n @model\n end",
"def model\n @model\n end",
"def model=(_arg0); end",
"def model=(_arg0); end",
"def model=(_arg0); end",
"def model=(_arg0); end",
"def models\r\n\r\n end",
"def model\n __getobj__\n end",
"def model\n return @model\n end",
"def obj\n @model\n end",
"def model\n return @model\n end",
"def model\n return @model\n end",
"def model\n self\n end",
"def model\n @model ||= operation.run\n end",
"def model\n self::Model\n end",
"def private_model; @private_model = true end",
"def initialize_model\n end",
"def robot_model\n\t\t@robot_model\n\tend",
"def model\n bond.model\n end",
"def model\n self.class.model\n end",
"def model\n self.class.model\n end",
"def model\n nil\n end",
"def model\n nil\n end",
"def set_model\n @model=Info\n end",
"def model_class; end",
"def model()\n @props[:model]\n end",
"def model\r\n\t\t\t@model ||= json['model']\r\n\t\tend",
"def def_Model(mod)\n model = self\n mod.define_singleton_method(:Model) do |source|\n model.Model(source)\n end\n end",
"def def_Model(mod)\n model = self\n (class << mod; self; end).send(:define_method, :Model) do |source|\n model.Model(source)\n end\n end",
"def model_class=(_arg0); end",
"def model=(value)\n @model = value\n end",
"def initialize(model)\n @model = model\n end",
"def set_model\n @model = Info\n end",
"def model_name; end",
"def model_name; end",
"def model\n provider.model\n end",
"def model\n self.class.const_get(:MODEL)\n end",
"def main_instance\n send main_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 model\n self.public_send(self.class._attributes.first)\n end",
"def model\n @model ||= Model.new(self)\n end",
"def model\n @model ||= resource.model\n end",
"def initialize(model)\n\t\t\t@name = model.to_s\n\t\t\t@ar_model = ARModel.new(model)\n\t\t\t\n\n\n @api_model = APIModel.new(model, Hash[@ar_model.schema])\n\t\t\t@field_relationships = generate_field_relationships(@ar_model.schema)\n\t\t\tputs @field_relationships\n\t\tend",
"def get()\n \n end",
"def set_model\n\n # check credentials and handle OpenStack Keystone\n # TODO: check expiration dates on Keystone tokens\n raise \"You are not authorized to use this endpoint!\" unless check_authn\n\n #\n model = get('/-/')\n @model = Occi::Model.new(model)\n\n @mixins = {\n :os_tpl => [],\n :resource_tpl => []\n }\n\n #\n get_os_templates.each do |os_tpl|\n unless os_tpl.nil? || os_tpl.type_identifier.nil?\n tid = os_tpl.type_identifier.strip\n @mixins[:os_tpl] << tid unless tid.empty?\n end\n end\n\n #\n get_resource_templates.each do |res_tpl|\n unless res_tpl.nil? || res_tpl.type_identifier.nil?\n tid = res_tpl.type_identifier.strip\n @mixins[:resource_tpl] << tid unless tid.empty?\n end\n end\n\n model\n end",
"def lookup_model_names; end",
"def set_model\r\n @model = Model.find(params[:id])\r\n end",
"def create_model_design_doc_reader\n model.instance_eval \"def #{method}; @#{method}; end\"\n end",
"def model=(model)\n @model = model\n end",
"def model; eval model_name; end",
"def model; eval model_name; end",
"def model name, **params\n # <<- CLOSURE_SCOPE\n current = @current # closure scope\n params = @environs.merge params if @environs\n filled_or_maybe = optionality(params)\n params[:class] ||= name.to_s.gsub(/(?:\\A|_)./) { |m| m[-1].upcase }\n # CLOSURE_SCOPE\n\n schema do\n __send__(current, name).__send__(filled_or_maybe, model?: params[:class])\n end\n\n define_helper_methods name\n end",
"def get_mobj(mname=nil) @model_class.instance; end",
"def model=(value)\n @model = value\n end",
"def model=(value)\n @model = value\n end",
"def brand_with_model; end",
"def model\n @opts[:model]\n end",
"def private_model\n @private_model = true\n end",
"def model_attributes\n raise NotImplementedError\n end",
"def attributes\n end",
"def details; end",
"def set_model\n @model = Model.find(params[:id])\n end",
"def set_model\n @model = Model.find(params[:id])\n end",
"def set_model\n @model = Model.find(params[:id])\n end",
"def set_model\n @model = Model.find(params[:id])\n end",
"def set_model\n @model = Model.find(params[:id])\n end",
"def set_model\n @model = Model.find(params[:id])\n end",
"def set_model\n @model = ClientService.find(params[:id])\n end",
"def name\n model_name\n end",
"def name\n model_name\n end",
"def set_model\n @model = Model.find(params[:id])\n end",
"def set_model\n @model = Model.find(params[:id])\n end",
"def attributes; end",
"def attributes; end",
"def attributes; end",
"def attributes; end",
"def attributes; end",
"def attributes; end",
"def attributes; end",
"def attributes; end",
"def attributes; end",
"def attributes; end"
] | [
"0.7811159",
"0.77944857",
"0.77944857",
"0.77944857",
"0.77944857",
"0.77944857",
"0.77944857",
"0.77944857",
"0.77944857",
"0.77944857",
"0.77944857",
"0.75905144",
"0.75905144",
"0.75905144",
"0.73525065",
"0.7091324",
"0.7091324",
"0.7091324",
"0.7091324",
"0.69711334",
"0.69711334",
"0.69711334",
"0.69711334",
"0.6820886",
"0.6766305",
"0.67541426",
"0.67046773",
"0.6595925",
"0.6595925",
"0.6565006",
"0.65358716",
"0.65253854",
"0.65005594",
"0.64456815",
"0.6398921",
"0.6369139",
"0.6322639",
"0.6322639",
"0.6305945",
"0.6305945",
"0.6293226",
"0.6279133",
"0.62649304",
"0.6244553",
"0.6228322",
"0.6220969",
"0.62079227",
"0.6206263",
"0.619357",
"0.6192517",
"0.61832535",
"0.61832535",
"0.617532",
"0.6126718",
"0.61129105",
"0.6097953",
"0.6097953",
"0.6097953",
"0.60752916",
"0.60705703",
"0.6067194",
"0.6056387",
"0.60518104",
"0.6030354",
"0.60272396",
"0.60123825",
"0.60062206",
"0.599978",
"0.5997164",
"0.5997164",
"0.5984513",
"0.59796745",
"0.5968462",
"0.5968462",
"0.5958446",
"0.59560454",
"0.59286976",
"0.59210086",
"0.58964777",
"0.5888299",
"0.58865064",
"0.58865064",
"0.58865064",
"0.58865064",
"0.58865064",
"0.58865064",
"0.5885624",
"0.5884668",
"0.5884668",
"0.5881767",
"0.5881767",
"0.587887",
"0.587887",
"0.587887",
"0.587887",
"0.587887",
"0.587887",
"0.587887",
"0.587887",
"0.587887",
"0.587887"
] | 0.0 | -1 |
Convert a value to a string. :param value: A value to log. :type value: object :param max_chars: Optional maximum number of characters to return. :type max_chars: int :rtype: str | def value_to_log_string(value, max_chars=100000)
if value.nil?
output = 'NULL'
elsif (!!value == value)
output = value == true ? 'TRUE' : 'FALSE'
elsif (value.is_a? String)
output = value
elsif (value.is_a? Hash) || (value.is_a? Array)
output = serialize(value)
else
output = value.inspect
end
return output.length > max_chars ? output[0,max_chars] : output
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_str() @value.to_s end",
"def to_str\n value.to_s\n end",
"def to_str; value; end",
"def to_str()\n @value.to_s\n end",
"def to_str()\n @value.to_s\n end",
"def to_str\n @value.to_s\n end",
"def display_string(value)\n return nil unless value\n\n last_resort_string = lambda do\n warn \"AppMap encountered an error inspecting a #{value.class.name}: #{$!.message}\"\n '*Error inspecting variable*'\n end\n\n value_string = \\\n begin\n value.to_s\n rescue NoMethodError\n begin\n value.inspect\n rescue StandardError\n last_resort_string.call\n end\n rescue StandardError\n last_resort_string.call\n end\n\n value_string[0...LIMIT].encode('utf-8', invalid: :replace, undef: :replace, replace: '_')\n end",
"def format_str(value)\n value ||= '<none>'\n value = fmt ? (fmt % [value]) : value\n if max_length && (value.is_a? String) && value.length > max_length\n value = value[0..(max_length - 4)]\n value += ('.' * (max_length - value.length))\n end\n value\n end",
"def to_str\n @value\n end",
"def to_string\n puts @value.to_s\n end",
"def to_s\n value.to_s\n end",
"def to_s\n value.to_s\n end",
"def to_s\n value.to_s\n end",
"def to_s\n value.to_s\n end",
"def to_s\n return @value.to_s\n end",
"def to_s\n \"#{@value}\"\n end",
"def typecast_to_string(value)\n value.to_s\n end",
"def to_s\n \"#{@value}\"\n end",
"def to_s\n \"#{@value}\"\n end",
"def to_s()\n @value.to_s\n end",
"def to_s()\n @value.to_s\n end",
"def to_s\n val.to_s\n end",
"def to_s\n val.to_s\n end",
"def to_s\n value.to_s\n end",
"def to_s\n @value.to_s\n end",
"def to_s\n val.to_s\n end",
"def typecast_value_string(value)\n value.to_s\n end",
"def to_s\n @value.to_s\n end",
"def to_s\n \"#{@value}\"\n end",
"def display_string(value)\n return nil unless value\n\n value_string = custom_display_string(value) || default_display_string(value)\n\n (value_string||'')[0...LIMIT].encode('utf-8', invalid: :replace, undef: :replace, replace: '_')\n end",
"def convert_value(value)\n value.to_s\n end",
"def to_s\n @value.to_s\n end",
"def to_s\n @value.to_s\n end",
"def to_s () #to_s method to test\n\n puts(value)\n end",
"def to_s\n value\n end",
"def to_s\r\n @value.to_s\r\n end",
"def to_s()\n value.map {|v| v.to_s}.join(' ')\n end",
"def to_s()\n value.map {|v| v.to_s}.join(' ')\n end",
"def to_s\n value\n end",
"def inspect(max: 256)\n vars =\n instance_variables.map do |var|\n \"#{var}=%s\" % instance_variable_get(var).inspect.truncate(max)\n end\n \"#<#{self.class.name}:#{object_id} %s>\" % vars.join(' ')\n end",
"def to_s\n @value\n end",
"def to_s\n @value\n end",
"def to_s\n @value\n end",
"def format_value_to_string(value)\n value.dump\n end",
"def to_s\n (value.zero?) ? '' : \"#{value}#{symbol}\"\n end",
"def string(value, default_value=nil)\n s = value.to_s\n if s.empty?\n default_value\n else\n s\n end\n end",
"def to_s\r\n value.inspect\r\n end",
"def to_s\n @value\n end",
"def to_string(value)\n # indicate a nil\n if value.nil?\n 'nil'\n end\n\n # join arrays\n if value.class == Array\n return value.join(\", \")\n end\n\n # otherwise return to_s() instead of inspect()\n return value.to_s\n end",
"def to_s\n unknown? ? 'x' : @value.to_s\n end",
"def truncate(str, max=0)\n return '' if str.blank?\n\n if str.length <= 1\n t_string = str\n else\n t_string = str[0..[str.length, max].min]\n t_string = str.length > t_string.length ? \"#{t_string}...\" : t_string\n end\n\n t_string\n end",
"def to_s\n @chars.join\n end",
"def to_uncluttered_string_limited(limit)\n string = \"\"\n self.each_with_index do |value, index|\n unless index == 0\n string += \" \"\n end\n if value == nil\n string += \"---\"\n elsif\n string += value.to_s\n end\n unless index == self.length - 1\n string += \",\"\n end\n next_length = 0\n if self[index + 1]\n next_length = self[index +1].to_s.length\n end\n if string.length + next_length > limit - 9\n string += \" & #{self.length - (index + 1)} more\"\n break\n end\n end\n return string\n end",
"def stringify_value(value, **args)\n case value\n when String\n (value =~ /'/).present? ? %{\"#{value}\"} : \"'#{value}'\"\n when BigDecimal\n \"#{value}.to_d\"\n when Hash\n PrettifyHash.call(value, indent: current_indent + 1, preceding_chars: args[:preceding_chars])\n when Array\n PrettifyArray.call(value, indent: current_indent + 1, preceding_chars: args[:preceding_chars])\n when nil\n 'nil'\n else\n value.to_s\n end\n end",
"def to_s\n value.zero? ? '' : \"#{value}#{symbol}\"\n end",
"def s_str(value=nil)\n if value.nil? or value.size == 0\n return s(:nil)\n else\n return s(:str, value.to_s)\n end\n end",
"def to_s\n if value < 0\n sprintf(\"%0*.*o\", size + 3, size + 3, value).slice(3..-1)\n else\n sprintf(\"%0*.*o\", size, size, value)\n end\n end",
"def to_s\n value\n end",
"def to_s\n value\n end",
"def to_str() end",
"def to_str() end",
"def to_s\n @value\n end",
"def to_string(value)\n # If we have a number that has a zero decimal (e.g. 10.0) we want to\n # get rid of that decimal. For this we'll first convert the number to\n # an integer.\n if value.is_a?(Float) and value.modulo(1).zero?\n value = value.to_i\n end\n\n return value.to_s\n end",
"def string_value\n join(\"\\0\")\n end",
"def to_s(x=10) end",
"def to_strng(var)\r\n return var.to_s\r\nend",
"def to_s\n text_value\n end",
"def to_str\n 5\n end",
"def make_valuestring\n\t\treturn self.value\n\tend",
"def to_s\n (@value || call).to_s\n end",
"def to_s\n format_chars.join\n end",
"def value_to_s(v, _scope = nil)\n v.to_s\n end",
"def to_s\n @value ? ERB::Util::h(@value.to_s) : ''\n end",
"def to_s\n @value.to_f.to_s\n end",
"def max(_); '1000'; end",
"def dhcp_option_value_str(data, value)\r\n data << value.length.chr\r\n data << value\r\n end",
"def string\n Util.from_bytes :string, value\n end",
"def truncate(string, max)\n return string.size > max ? \"#{string[0...max]}...\" : string\nend",
"def should_to_s(value)\n value.inspect\n end",
"def should_to_s(value)\n value.inspect\n end",
"def should_to_s(value)\n value.inspect\n end",
"def should_to_s(value)\n value.inspect\n end",
"def should_to_s(value)\n value.inspect\n end",
"def should_to_s(value)\n value.inspect\n end",
"def to_s\n \"value: #{@value}\\n\"+\n \"options: #{@options.inspect}\\n\"+\n \"encodable: #{@encodable ? @encodable : '#encode not run yet'}\\n\"+\n \"code: #{@code}\\n\"\n end",
"def to_s\n @value\n end",
"def string(value = '')\n return '' unless present?(value)\n\n send(value)\n rescue NoMethodError\n ''\n end",
"def to_s\n string=\"\"\n each { |value| string+=value.to_s + \"\\n\" } # Funciona también entre do-end\n return string\n end",
"def shorten(text, chars=20)\n text.length > chars ? \"#{text[0..chars-3]}...\" : text\n end",
"def to_str; end",
"def to_str; end",
"def to_str; end",
"def to_str; end",
"def to_str; end",
"def to_str; end",
"def to_str; end",
"def to_str; end",
"def to_str; end",
"def val_s(val)\n emptyval?(val) ? EMPTYVAL : val.to_s\n end",
"def to_s\n @value.dup.force_encoding(Encoding.default_external)\n end"
] | [
"0.6354454",
"0.62859535",
"0.62643635",
"0.6206465",
"0.6206465",
"0.615024",
"0.6084755",
"0.6042674",
"0.591187",
"0.58266956",
"0.5817441",
"0.5817441",
"0.58111787",
"0.58111787",
"0.58097726",
"0.58094937",
"0.57605016",
"0.5751637",
"0.5751637",
"0.5729551",
"0.5729551",
"0.57281524",
"0.57281524",
"0.5691722",
"0.5674512",
"0.5642531",
"0.5608918",
"0.56056154",
"0.55915695",
"0.55728304",
"0.5556217",
"0.55240625",
"0.55240625",
"0.5502183",
"0.546647",
"0.54658973",
"0.54645276",
"0.54645276",
"0.5438124",
"0.54340863",
"0.54335165",
"0.54335165",
"0.54335165",
"0.54316026",
"0.53959024",
"0.5380988",
"0.53667355",
"0.5365306",
"0.53629184",
"0.53616536",
"0.5358583",
"0.5355204",
"0.5350855",
"0.5349272",
"0.5318136",
"0.531175",
"0.5303435",
"0.52959496",
"0.52959496",
"0.5292798",
"0.5292798",
"0.52501553",
"0.5246706",
"0.52465844",
"0.52464896",
"0.5236025",
"0.5229345",
"0.52275634",
"0.5214772",
"0.51974756",
"0.51922756",
"0.51902133",
"0.5177223",
"0.5169791",
"0.51614314",
"0.5160454",
"0.51558656",
"0.51451963",
"0.51376235",
"0.51376235",
"0.51376235",
"0.51376235",
"0.51376235",
"0.51376235",
"0.51315564",
"0.51152676",
"0.5112891",
"0.5110795",
"0.5100769",
"0.50922626",
"0.50922626",
"0.50922626",
"0.50922626",
"0.50922626",
"0.50922626",
"0.50922626",
"0.50922626",
"0.50922626",
"0.50872344",
"0.5076157"
] | 0.8212074 | 0 |
Given an unsorted array of integers, find the length of longest increasing subsequence. | def length_of_lis(nums)
len = []
(0...nums.size).map { |i|
len[i] = (0...i)
.select { |j| nums[j] < nums[i] }
.map { |j| len[j] + 1 }.max || 1
}.max || 0
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def longest_increasing_subseq(arr)\n n = arr.size\n lis = Array.new(n, 1)\n\n (0 ... n).each do |i|\n (0 ... i).each do |j|\n if arr[i] > arr[j] && lis[j] + 1 > lis[i]\n lis[i] = lis[j] + 1\n end\n end\n end\n\n max_len = 0\n\n (1 ... n).each do |k|\n max_len = lis[k] if max_len < lis[k]\n end\n\n max_len\nend",
"def longest_increasing_subseq(arr)\n longest_subseq_length = [1]\n\n i = 1\n while i < arr.length\n j = 0\n temp = 0\n while j < i\n if arr[i] > arr[j]\n temp = [temp, longest_subseq_length[j]].max\n end\n j += 1\n end\n\n longest_subseq_length << (temp + 1)\n i += 1\n end\n\n longest_subseq_length.max\nend",
"def longest_equal_subarray(array)\n return 0 if array == 0\n\n current_length, max_length, number = 0, 0, array.first\n\n array[1..-1].each do |x|\n if x == number\n current_length += 1\n else\n number = x\n current_length = 0\n end\n\n max_length = [max_length, current_length].max\n end\n\n max_length\nend",
"def find_longest(arr)\n arr.map(&:to_s).sort_by(&:length).find { |num| num.length == arr.map(&:to_s).sort_by(&:length).last.length }.to_i\nend",
"def longestIncreasingSubseq(nums)\n\tres = []\n\tnums.each { |x| \n\t\tindex = (0...res.size).bsearch { |i| \n\t\t\tres[i] >= x\n\t\t}\n\t\tres[index||res.size] = x\n\t}\n\tres.size\nend",
"def LongestIncreasingSequence(arr)\n size = arr.size\n \n while size > 1\n sub_seq = arr.combination(size).to_a\n sub_seq.each do |seq|\n inc_seq = true\n seq.each_cons(2) { |num1, num2| break inc_seq = false unless num2 > num1 }\n return seq.size if inc_seq\n end \n size -= 1\n end\n 1\nend",
"def longest_increasing_subsequence(seq)\n memo = []\n seq.each_with_index do |curr_num, curr_idx|\n longest = 0\n seq[0..curr_idx].each_with_index do |prev_num, prev_idx|\n if prev_num < curr_num && memo[prev_idx] > longest\n longest = memo[prev_idx]\n end\n end\n\n memo << longest + 1\n end\n\n memo.max\nend",
"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 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 longest_increasing_subsequence(nums) len = nums.length\n return len if len < 2\n\n# After calculating lis for each index, take a max by 1 value equal to max, go backwards on lis array, and every time we find an element equal to max, we add that element to result and decrement max by 1. Hereby we'll get the indexes array in reversed order.\n lis_array = find_lis_lengths(nums)\n\n result = []\n max = lis_array.max\n i = len - 1\n while i >= 0\n if lis_array[i] == max\n result.unshift(nums[i])\n max -= 1\n end\n i-= 1\n end\n result\n\nend",
"def longest_decreasing_subsequence(sequence)\n len = sequence.length\n\n # construct a temp array to store lenght of LDS at each index(default len: 1)\n temp = [1] * len # or Array.new(len, 1)\n\n (len - 2).downto(0) do |i|\n (len - 1).downto(i - 1) do |j|\n if sequence[i] > sequence[j] && temp[i] < temp[j] + 1\n temp[i] = temp[j] + 1\n end\n end\n end\n\n return temp.max\nend",
"def max_sequence(arr)\r\n return 0 if arr.all? { |el| el < 0 }\r\n return arr.sum if arr.all? { |el| el > 0 }\r\n return 0 if arr.empty?\r\n \r\n sub_arrs = []\r\n (0...arr.size).each do |start_index|\r\n # p \"start #{start_index}\"\r\n (1..arr.size - start_index).each do |length|\r\n # p \"length #{length}\"\r\n sub_arrs << arr[start_index, length]\r\n end\r\n end\r\n sub_arrs.map do |sub_arr|\r\n sub_arr.sum\r\n end.max\r\nend",
"def max_sequence(arr)\n sum = 0\n \n arr.each_with_index do |ele, i| \n l = arr.length\n\n while l >= i\n sub_arr = arr[i..l]\n sum = sub_arr.sum if sub_arr.sum > sum\n l -= 1\n end \n end\n \n sum\nend",
"def max_sub_arr(arr)\n max_so_far = 0\n max_ending_here = 0\n start_i = nil\n end_i = nil\n arr.each_with_index do |el, i|\n if max_ending_here == 0 && max_ending_here + el > 0\n start_i = i\n end\n\n max_ending_here = max_ending_here + el\n if max_ending_here < 0\n max_ending_here = 0\n end\n\n if max_so_far < max_ending_here\n max_so_far = max_ending_here\n end_i = i\n end\n end\n\n return [start_i, end_i], max_so_far\nend",
"def findLongestSubarrayBySum(s, arr)\n history = {0 => -1} \n sum = 0 \n max_length = 0 \n result = [-1]\n\n for idx in 0...arr.length \n sum += arr[idx]\n history[sum] = idx if history[sum].nil? \n\n if history[sum - s]\n length = idx - history[sum - s]\n if length > max_length \n max_length = length \n result = [history[sum - s]+2, idx+1]\n end \n end \n end \n\n result\nend",
"def longest_zig_zag(array)\n puts \"Given array: #{array}\"\n las_array = Array.new(array.size){Array.new}\n las_array[0][0] = array[0] # LIS of array of size 0 would be just that element\n for i in 1..array.size-1\n for j in 0..i-1\n \n if array[j] < array[i] && lis_array[i].size < lis_array[j].size + 1 # Have the longest matching subsequence from before.\n lis_array[i] = Array.new(lis_array[j])\n end\n end\n lis_array[i] << array[i]\n end\n i = 0\n max_seq_size = 0\n lis_array.each do |lis_row|\n max_seq_size = lis_row.size if lis_row.size > max_seq_size\n puts \"Longest substring until array position #{i}: #{lis_row}\"\n i += 1\n end\n puts \"longest increasing sequence size: #{max_seq_size}\"\nend",
"def lcount(arr)\n (1...arr.length).reduce(1) { |c, i| arr[i] > arr[0...i].max ? c + 1 : c }\nend",
"def find_max_length(a)\n\tmax = 0\t\n\tfor i in 0..a.size-2 do\n\t\tcount_0 = 0\n\t\tcount_1 = 0\n\t\tcurrent_max = 0\n\t\tfor j in i..a.size-1 do\n\t\t\tif a[j] == 0\n\t\t\t\tcount_0 = count_0+1\n\t\t\telsif a[j] == 1\n\t\t\t\tcount_1 = count_1+1\n\t\t\tend\n\t\t\tif count_0 == count_1\n\t\t\t\tcurrent_max = count_0+count_1\n\t\t\tend\n\t\tend\n\t\tif current_max > max\n\t\t\tmax = current_max\n\t\tend\n\tend\n\tmax\nend",
"def max_sequence(arr)\n return 0 if arr.empty?\n\n max_ending_here = max_so_far = 0\n \n arr.each do |n|\n max_ending_here = [n, max_ending_here + n].max\n max_so_far = [max_so_far, max_ending_here].max\n end\n \n max_so_far\nend",
"def max_sequence(arr)\n return 0 if arr.empty? || arr.all?(&:negative?)\n\n result = []\n 1.upto(arr.size) { |n| result << arr.each_cons(n).map(&:sum).max }\n result.max\nend",
"def clever_octopus(array)\n longest = array.first\n (1...array.length).each do |i|\n longest = array[i] if longest.length < array[i].length\n end\n longest\nend",
"def LongestConsecutive(arr)\n\n # get unique sorted array\n\n list = arr.uniq.sort\n # loop through each\n current = 0\n i = 0\n\n while i < list.length\n j = i + 1\n while j < list.length\n if list[i..j] == (list[i]..list[j]).to_a\n count = list[i..j].length\n if count > current\n current = count\n end\n end\n j += 1\n end\n i += 1\n end\n\n\n return current\n\n # see subsequent j count\n # have a most counter\n\nend",
"def find_longest(arr)\n arr.max_by { |x| x.to_s.length }\nend",
"def max_sub(a)\na[(0...(n=a.size)).inject([]){|r,i|(i...n).inject(r){|r,j|r<<(i..j)}}.sort_by{|r|a[r].inject{|i,j|i+j}}[-1]]\nend",
"def longest(array)\n array.sort_by {|x| x.length}.reverse\nend",
"def maximum_value_contiguous_subsequence_dp(array)\n len = array.length\n result = [array[0]]\n\n for i in (1...len)\n result[i] = maximum(array[i], array[i] + result[-1])\n end\n\n result.max\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 longest(array)\n return array.max\nend",
"def longest_sequence_in(string)\n arr = string.split(' ').map{|num| num.to_i}\n if arr.length < 3\n return arr.length\n end\n chain_tracker = [2]\n increment = arr[1] - arr[0]\n chain = 2\n arr.each_with_index do |num, idx|\n if idx != 0 and idx != arr.length - 1\n if arr[idx + 1] - arr[idx] == increment \n chain += 1\n chain_tracker << chain\n else \n chain = 2\n increment = arr[idx + 1] - arr[idx]\n end\n end\n end\n chain_tracker.max\nend",
"def max_subarray(numbers)\n max_current = 0\n max_end = 0\n\n for i in 0..numbers.length\n max_end += numbers[i].to_i\n\n if max_end < 0\n max_end = 0\n end\n\n if max_current < max_end\n max_current = max_end\n end\n end\n\n max_current\n end",
"def find_largest(array, length)\n largest_int = array[0]\n (length - 1).times do |i|\n if array[i + 1] > largest_int\n largest_int = array[i + 1]\n end\n end\n return largest_int\nend",
"def find_longest(arr)\n longest_num = 0 # current longest number\n most_digits = 0 # current most digits found in a number in the array\n\n arr.each do |num|\n digits_in_num = num.to_s.length\n if digits_in_num <= most_digits # if length of the current number is <= longest number yet - next\n next\n else # but if length is > than any other number we have seen yet -\n longest_num = num # set this num as new longest_num\n most_digits = digits_in_num # set the length of this num as the new standard to compare against\n end\n end\n longest_num\nend",
"def max_sub_array(nums)\n return if nums.empty?\n\n max_so_far = Array.new(nums.length)\n max_so_far[0] = nums[0]\n\n (1...nums.length).each do |i|\n max_so_far[i] = [nums[i], nums[i] + max_so_far[i-1]].max\n end\n\n return max_so_far.max\nend",
"def find_unsorted_subarray(nums)\n l = nums.length\n r = 0\n\n nums.each_with_index do |_num, i|\n (i + 1..nums.count - 1).each do |j|\n if nums[j] < nums[i]\n r = j if j > r\n l = i if l > i\n end\n end\n end\n\n r - l < 0 ? 0 : r - l + 1\nend",
"def max_sequence(arr)\r\n sums = [arr.first]\r\n\r\n arr.each_with_index do |num, num_i|\r\n (num...arr.size).each do |i|\r\n sums << arr[num_i..i].sum\r\n end\r\n end\r\n\r\n arr.empty? ? 0 : sums.max\r\nend",
"def min_sub_array_len(s, nums)\n # debugger\n nums.length.times do |window_size|\n (nums.length - window_size + 1).times do |window_start|\n window_arr = nums.slice(window_start,window_size + 1)\n return window_arr if window_arr.reduce(:+) == s\n end\n end\nend",
"def find_number_of_lis(nums)\n return 0 if nums.empty?\n lengths = Array.new(nums.size, 1)\n counts = Array.new(nums.size, 1)\n\n for i in 1...nums.size\n for j in 0...i\n if nums[i] > nums[j]\n if lengths[j] + 1 == lengths[i]\n counts[i] += counts[j]\n elsif lengths[j] + 1 > lengths[i]\n counts[i] = counts[j]\n lengths[i] = lengths[j] + 1\n end\n end\n end\n end\n\n max_length = lengths.max\n result = 0\n \n counts.each_with_index do |count, i|\n result += count if lengths[i] == max_length\n end\n \n result\nend",
"def longest_range_elements(arr)\n bubble_sort(arr)\n new_arr = []\n max_length = 1\n i = 0\n until i == arr.length\n if arr[i] - 1 == arr[i-1]\n if new_arr.length == 0\n new_arr << arr[i-1]\n end\n new_arr << arr[i]\n elsif arr[i] - 1 != arr[i-1]\n if new_arr.length > max_length\n max_length = new_arr.length\n longest_arr = new_arr\n end\n new_arr = []\n end\n i += 1\n end\n longest_arr\nend",
"def max_sequence(arr)\n puts arr\n index = 0\n numIndexes = 0\n highestSum = arr.min\n \n length = arr.count\n \n highestNum = arr.max\n\n if arr != [] && highestNum < 0 \n return 0\n elsif arr == []\n return 0\n end\n \n arr.map.with_index do |n,i|\n\n for c in 0..i\n \n sum = arr.slice(c,length-i).inject(:+)\n\n if sum > highestSum\n highestSum = sum\n index = i\n numIndexes = length-i\n end\n \n end\n \n end\n \n highestSum\n \nend",
"def max_sub_array(nums)\n return 0 if nums == nil\n return nil if nums.empty?\n \n max_by_here = nums[0]\n max_so_far = nums[0]\n \n nums.each_with_index do |num, index|\n unless index == 0\n if max_so_far < 0\n if num > max_so_far\n max_so_far = num\n end\n else\n max_by_here += num\n \n if max_by_here < 0\n max_by_here = 0\n elsif max_by_here > max_so_far\n max_so_far = max_by_here\n end\n end\n end\n end\n \n return max_so_far\nend",
"def minSubLength(arr, i)\n subs = find_sub_arrays(arr)\n correct = subs.select { |array| array.sum >= i }.min_by { |x| x.length }\n p correct\n correct == nil ? 0 : correct.size\nend",
"def lis(array)\n helper = Array.new(array.length, 1)\n (1..array.length - 1).each do |array_index|\n (0..array_index).each do |inner_value|\n if array[inner_value] < array[array_index]\n helper[array_index] = [helper[inner_value] + 1, helper[array_index]].max\n end\n end\n end\n helper.max\nend",
"def maximum_value_contiguous_subsequence(array)\n len = array.length\n return array.max if all_negatives?(array)\n\n max = array[0]\n for i in (0...len)\n current_sum = 0\n for j in (i...len)\n current_sum += array[j]\n max = maximum(max, current_sum)\n end\n end\n max\nend",
"def longest (arr)\n arr.max_by {|str| str.length}\nend",
"def largest_contiguous_subsum(arr) # n^2\n subs = []\n (0...arr.length).each do |start_i|\n (start_i...arr.length).each do |end_i|\n subs << arr[start_i..end_i]\n end\n end\n\n subs.map { |sub| sub.inject(:+) }.max\nend",
"def largest_contiguous_subsum(arr)\n subs = []\n l = arr.length\n (0...l).each do |i|\n (0...l).each do |j| \n subs << arr[i..j] if arr[i..j].length > 0 # n*n *( n) == n^3 + n\n end\n end\n subs.map(&:sum).max\nend",
"def get_length(array)\n return array.inject (0) { |length, el| length + 1 }\nend",
"def largest_contiguous_subsum(array)\n sub_arrays = []\n (0...array.length).each do |i|\n (0...array.length).each do |x|\n sub_arrays << array[i..x] unless array[i..x].empty?\n end\n end\n p sub_arrays.length\n max_array = sub_arrays.max_by { |sub| sub.sum }\n max_array.sum\n\nend",
"def lis array\n helper = Array.new(array.count, 1)\n for i in 1..(array.count - 1)\n for j in 0..i\n if array[j] < array[i]\n helper[i] = max((helper[j] + 1), helper[i])\n end\n end\n end \n return helper.max\nend",
"def solve(words)\n return 0 if words.length == 0\n\n longest_sublist = 1\n current_sublist = 1\n\n i = 0\n while i < words.length - 1\n if words[i][0] == words[i+1][0]\n current_sublist += 1\n if current_sublist > longest_sublist\n longest_sublist = current_sublist\n end\n else\n current_sublist = 1\n end\n i += 1\n end\n\n return longest_sublist\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 max_sub_array(nums)\n return 0 if nums.nil? \n return nil if nums.empty?\n \n max_so_far = nums[0]\n max_for_sub_array = 0\n\n nums.each do |num|\n max_for_sub_array = max_for_sub_array + num\n if num > max_for_sub_array\n max_for_sub_array = num\n end\n if max_for_sub_array > max_so_far\n max_so_far = max_for_sub_array\n end\n end\n return max_so_far\n\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 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 contiguous_sequence(array)\n max_sum = array.first\n array.each_with_index do |num, idx|\n current_sum = num\n array[(idx+1)..-1].each do |num|\n current_sum += num\n max_sum = current_sum if current_sum > max_sum\n end\n end\n\n max_sum\nend",
"def maximum_sub_array2(arr)\n current = []\n max_sum = cur_sum = 0\n max = (0...arr.size).inject([]) do |max, i|\n current << arr[i]\n cur_sum += arr[i]\n if cur_sum > max_sum\n max << i\n max_sum = cur_sum\n end\n max\n end\n arr[max[0]..max[-1]]\nend",
"def find_unsorted_subarray2(nums)\n sort_nums = nums.sort\n\n left = nums.length\n right = 0\n\n sort_nums.each_with_index do |num, index|\n if num != nums[index]\n left = [index, left].min\n right = [index, right].max\n end\n end\n\n right >= left ? right - left + 1 : 0\nend",
"def longest(stringArray)\n return stringArray.max_by(&:length)\nend",
"def find_max_consecutive_ones(nums)\n nums.join().split('0').map{|s| s.length}.max() || 0\nend",
"def longest_sequence(num, numbers)\n\tputs \"calculating for #{num}; #{100*num / 999983}% complete\"\n\tresults = [0]\n\tleft,right = 0,0\n\tsum = numbers[0]\n\twhile numbers[left] < num\n# \t\tputs \"sum=#{sum}\"\n# \t\tputs \"real sum=#{numbers[left..right].sum}\"\n\t\tcase sum <=> num\n\t\t\twhen -1: right += 1; sum += numbers[right]\n\t\t\twhen 0: results << (right - left + 1) ; sum-= numbers[left]; left+=1\n\t\t\twhen 1: sum-= numbers[left]; left+=1\n\t\tend\n\t\t\t\t\n\tend\n\treturn results.max\nend",
"def longest_string array\n array.max_by(&:length)\nend",
"def max_sequence(arr)\n return arr.first if arr.size == 1\n return 0 if arr.all? { |num| num < 0 } || arr.empty?\n current_sum = arr.first\n maximum = arr.first\n\n arr[1..-1].each do |num|\n current_sum = 0 if current_sum < 0\n current_sum += num\n maximum = current_sum if current_sum > maximum\n end\n\n maximum\nend",
"def longest_string array\n\tarray.max_by(&:length)\nend",
"def solution(a)\n min_index = nil\n max_index = nil\n\n a.each_with_index do |num, index|\n if index < a.length-1\n if num > a[index + 1]\n min_index = index\n break\n end\n end\n end\n\n reversed_array = a.reverse\n\n reversed_array.each_with_index do |num, index|\n if index < reversed_array.length-1\n if num < reversed_array[index + 1]\n max_index = a.length - index - 1\n break\n end\n end\n end\n\n if min_index.nil? && max_index.nil?\n return 0\n end\n\n until a.sort == a[0...min_index] + a[min_index..max_index].sort + a[max_index+1..-1]\n minimum_in_sub = a[min_index..max_index].sort.first\n maximum_in_sub = a[min_index..max_index].sort.last\n\n new_min_index = a[0...min_index].reverse.index(a[0...min_index].reverse.find{|n| n >= minimum_in_sub})\n\n if new_min_index\n min_index = min_index - new_min_index - 1\n end\n\n new_max_index = a[max_index+1..-1].index(a[max_index+1..-1].find{|n| n <= maximum_in_sub})\n\n if new_max_index\n max_index = max_index + new_max_index + 1\n end\n end\n\n max_index - min_index + 1\nend",
"def kadanes_algorithm(array)\n maxEndingHere = array[0]\n maxSoFar = array[0]\n array.slice(1..-1).each do |num|\n maxEndingHere = [num, maxEndingHere + num].max\n maxSoFar = [maxSoFar, maxEndingHere].max\n end\n return maxSoFar\nend",
"def length_of_longest_substring(arr, k)\n\n start_index, max_length, max_ones = 0, 0, 0\n\n for end_index in 0..(arr.length - 1)\n if arr[end_index] == 1\n max_ones += 1\n end\n\n if (end_index - start_index + 1 - max_ones) > k\n if arr[start_index] == 1\n max_ones -= 1\n end\n start_index += 1\n end\n\n max_length = [max_length, end_index - start_index + 1].max\n end\n\n return max_length\nend",
"def max_sub_array(nums)\n dp = [nums.first]\n max = dp[0]\n\n (1...nums.length).each do |i|\n prev_max = dp[i - 1] > 0 ? dp[i - 1] : 0\n dp[i] = nums[i] + prev_max\n max = [max, dp[i]].max\n end\n\n max\nend",
"def longest_palindrome(str)\n return 0 if str.empty?\n\n arr = str.chars\n substrings = []\n length = 1\n loop do\n arr.each_cons(length) { |set| substrings << set }\n length += 1\n break if length > arr.length\n end\n substrings.select { |set| set == set.reverse }.max_by(&:length).length\n p substrings\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 largest_contiguous_subsum(array)\n sub_arrays = []\n i = 1\n until i == array.length + 1\n array.each_cons(i) do |sub|\n sub_arrays << sub\n end\n i += 1\n end\n sub_arrays.map {|sub| sub.reduce(:+)}.max\nend",
"def longest_consecutive(nums)\n return 0 if nums.empty?\n\n hash = {}\n nums.each { |num| hash[num] = -1 }\n nums.each do |num|\n next unless hash[num] == -1\n\n longest_consec = 1\n loop do\n val = hash[num + longest_consec]\n case val\n when -1\n hash[num + longest_consec] = -2\n longest_consec += 1\n when nil\n hash[num] = longest_consec\n break\n else\n longest_consec += hash[num + longest_consec]\n hash[num] = longest_consec\n break\n end\n end\n end\n\n hash.max_by { |_k, v| v }[1]\nend",
"def longest_string(array)\n\tarray.max_by(&:length)\nend",
"def find_longest(arr)\n arr.detect { |i| i.to_s.length == arr.max.to_s.length }\nend",
"def max_sub_array(nums)\n max = -Float::INFINITY\n\n (0...nums.length) do |left_i|\n sub\n\n end",
"def min_subsequence(nums)\n sorted = nums.sort\n left = sorted.inject(:+)\n right = 0\n i = 0\n while i < nums.length\n left -= sorted[i]\n right += sorted[i]\n\n if left < right\n return sorted.drop(i-a1).sort.reverse\n end\n i += 1\n end\n return []\nend",
"def find_unsorted_subarray(nums)\n sum = 0\n index = 0\n sorted = nums.sort\n while index < nums.length\n if nums[index] == sorted[index]\n sum += 1\n else\n break\n end\n index += 1\n end\n return 0 if sum == nums.length\n index = nums.length - 1\n while index >= 0\n if nums[index] == sorted[index]\n sum += 1\n else\n break\n end\n index -= 1\n end\n nums.length - sum\nend",
"def max_sub_array(array)\n max_sum = current_val = array[0]\n array.each_with_index do |num, i|\n if (i > 0)\n sum = current_val + num\n if (sum > num)\n current_val = sum\n else\n current_val = num\n end\n if current_val > max_sum\n max_sum = current_val\n end\n end\n end\n max_sum\nend",
"def max_sub_array(nums)\n\tmax = count = nums.shift\n\n\tnums.each do |num|\n\t\tcount = num > count + num ? num : count + num\n\t\tmax = count if count > max\n\tend\n\n\tmax\nend",
"def largest_sub_sum(array)\n subsets = []\n i = 0\n while i < array.length\n j = i\n while j < array.length\n subsets << array[i..j]\n j += 1\n end\n i += 1\n end\n result = nil\n subsets.map {|subset| subset.inject(:+)}.each do |sum|\n result = sum if result.nil? || result < sum\n end\n result\nend",
"def max_sequence(arr)\n sum = arr.first ? arr.first : 0\n\n arr.each do |num|\n sum_to_here = [(num), (sum_to_here + num)].max\n sum = [sum, sum_to_here].max\n end\n\n sum\nend",
"def solve(nums)\n sorted = nums.sort\n largest = 0\n (0...sorted.length - 1).each do |i|\n if (sorted[i+1] - sorted[i]) > largest\n largest = (sorted[i+1] - sorted[i])\n end\n end\n return largest\n\nend",
"def lcs(array)\n current_sum = 0\n max = array[0] || 0\n\n array.each do |el|\n current_sum += el\n if current_sum > max\n max = current_sum\n end\n if current_sum < 0\n current_sum = 0\n end\n end\n\n return max\nend",
"def largest_contiguous_subsum(arr)\n max = arr[0]\n current = 0\n (0...arr.length).each do |i|\n current += arr[i]\n max = current if current > max\n current = 0 if current < 0\n end\n max\nend",
"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",
"def long_subarrays(arr)\n res =[]\n window = arr.length\n while window>=1\n idx = 0\n while idx+window<=arr.length\n sub_arr = arr.slice(idx, window)\n p sub_arr\n res << sub_arr\n idx += 1\n end\n window -= 1\n end\n res.map{|el| el.inject(0){|acc, el2| acc+el2}}.sort.last\nend",
"def largest_contiguous_subsum(arr)\n i = 0\n subs = []\n while i < arr.length\n j = i\n\n while j < arr.length\n subs << arr[i..j]\n\n j += 1\n end\n\n i += 1\n end\n\n\n return (subs.max {|a, b| a.sum <=> b.sum}).sum\n\nend",
"def find_largest(array, length)\n max = array[0]\n\n length.times do |index|\n if array[index] > max\n max = array[index]\n end\n end\n\n return max\nend",
"def lcs(array)\n current_sum = 0\n largest_subsum = array[0]\n \n array.each do |num|\n cur_sum += num\n largest_subsum = cur_sum if cur_sum > largest_subsum\n cur_sum = 0 if cur_sum < 0\n end\n\n largest_subsum\nend",
"def find_largest(array, length)\n largest_number = 0\n length.times do |index|\n if array[index] > largest_number\n largest_number = array[index]\n end\n end\n return largest_number\nend",
"def largest_sub_sum_linear(arr)\n largest = arr.first\n current = arr.first\n\n return arr.max if arr.all? { |num| num < 0 }\n i = 1\n\n while i < arr.length\n current = 0 if current < 0\n current += arr[i]\n largest = current if current > largest\n i+=1\n end\n\n largest\n end",
"def longest_word_in_array(array)\n array.sort_by(&:length).reverse[0]\nend",
"def fast_lcss(arr)\n i_arr = []\n biggest = 0\n max_sub_arr = []\n arr.length.times do |x|\n arr.map do |ele1|\n i_arr += [ele1]\n sum = i_arr.inject(0) do |a, b|\n a + b\n end\n max_sub_arr = i_arr if sum > biggest\n biggest = sum if sum > biggest \n end\n i_arr = []\n arr.shift\n end\n max_sub_arr\nend",
"def length_of_lis(nums)\n return 0 if !nums\n return 1 if nums.size == 1\n arr = [0] * nums.size\n max = 0\n for i in 0...nums.size do \n arr[i] = 1\n for j in 0...i do \n if nums[j] < nums[i]\n arr[i] = arr[i] > arr[j] + 1 ? arr[i] : arr[j] + 1 \n end\n end\n max = [max, arr[i]].max\n end\n max\nend",
"def lc_subsum(arr) #Runs linereally across the array, checking \n largest_sum = 0\n curr_sum = arr[0]\n return arr.max if arr.all? { |el| el < 0}\n (1...arr.length).each do |i|\n curr_sum < 0 ? curr_sum = arr[i] : curr_sum += arr[i]\n largest_sum = curr_sum if largest_sum < curr_sum\n end\n largest_sum\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 largest_contiguous_subsum(arr)\n max_sum = arr.first\n\n (0...arr.length).each do |start|\n (start...arr.length).each do |ending|\n sum = arr[start..ending].sum\n max_sum = sum if sum > max_sum\n end\n end\n\n max_sum\nend",
"def largest_contiguous_subsum(array)\n previous_sum = 0\n current_sum = 0\n array.each_with_index do |el, i|\n\n current_sum = previous_sum + el\n if previous_sum < 0\n if el < previous_sum\n current_sum = previous_sum\n else\n current_sum = el\n end\n end\n\n previous_sum = current_sum\n end\n\n current_sum\nend",
"def max_sub_array_len(nums, k)\n sum = 0\n max = 0\n map = {}\n\n nums.each.with_index do |num, ndx|\n sum += num\n if sum == k\n max = ndx + 1\n elsif map.key?(sum - k)\n max = [max, ndx - map[sum - k]].max\n end\n\n map[sum] ||= ndx\n end\n\n max\nend",
"def max_sub_array(nums)\n return 0 if nums.empty?\n return nums[0] if nums.size == 1\n dp = [0] * nums.size\n dp[0] = nums[0]\n max = dp[0]\n \n for i in 1...nums.size do\n dp[i] = nums[i] + (dp[i - 1] > 0 ? dp[i - 1] : 0)\n max = [max, dp[i]].max\n end\n max\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"
] | [
"0.831789",
"0.8275999",
"0.8068185",
"0.78885883",
"0.77659017",
"0.77349216",
"0.76564074",
"0.76090544",
"0.7581987",
"0.7537164",
"0.7443197",
"0.7394068",
"0.7334525",
"0.7297614",
"0.72319055",
"0.71900326",
"0.71841055",
"0.716932",
"0.715301",
"0.70578575",
"0.7048522",
"0.70474803",
"0.7016381",
"0.69827056",
"0.6973386",
"0.6933963",
"0.691528",
"0.68911266",
"0.6851046",
"0.6805205",
"0.6804453",
"0.67952937",
"0.678716",
"0.67714226",
"0.6771126",
"0.67684644",
"0.6740352",
"0.6719128",
"0.6707443",
"0.66966456",
"0.6692969",
"0.6666772",
"0.665044",
"0.66416824",
"0.6623453",
"0.66073406",
"0.65911496",
"0.65872455",
"0.6587129",
"0.6577598",
"0.6577318",
"0.65580165",
"0.65544367",
"0.6540026",
"0.6527126",
"0.6522341",
"0.65189356",
"0.6515494",
"0.65138924",
"0.6511397",
"0.6510858",
"0.6505221",
"0.648959",
"0.6483664",
"0.6483277",
"0.6473169",
"0.6468314",
"0.64636344",
"0.64577997",
"0.64489657",
"0.64358264",
"0.64323425",
"0.6430289",
"0.6428604",
"0.6428239",
"0.6427422",
"0.6421341",
"0.64152193",
"0.6412759",
"0.64114106",
"0.6409565",
"0.64031166",
"0.6402931",
"0.63762844",
"0.6367151",
"0.636689",
"0.63636523",
"0.6362733",
"0.6359806",
"0.63556105",
"0.6354308",
"0.63526446",
"0.63499683",
"0.63499135",
"0.6345893",
"0.6340727",
"0.6339135",
"0.6333724",
"0.6331865",
"0.6323367"
] | 0.6463361 | 68 |
GET /movies GET /movies.json | def index
if params[:query].blank?
@movies = Movie.all.includes(:roles => :artist)
else
@movies = Movie.all.includes(:roles => :artist).where('CONCAT(title, description) LIKE ?', "%#{params[:query]}%")
end
respond_to do |format|
format.html
format.json {response.headers["XXXXXXX"]="Test header value"; render :index; }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def movies\n get('Movies')\n end",
"def pull_movies(options = {})\n response = HTTParty.get(build_url('movie', options), headers: HEADERS, debug_output: $stdout)\n JSON.parse(response.body)\n end",
"def index\n @movies = @category.movies.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @movies }\n end\n end",
"def get_all_actors_for_movie(movie)\n url = \"http://movies.api.mks.io/actors\"\n response = RestClient.get(url, accept: 'application/json')\n\nend",
"def get_all_movies_for_actor(actor)\n url = \"http://movies.api.mks.io/movies\"\n response = RestClient.get(url, accept: 'application/json')\n\nend",
"def show\n @movie = Movie.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @movie }\n end\n end",
"def show\n @movie = Movie.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @movie }\n end\n end",
"def show\n @movie = Movie.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @movie }\n end\n end",
"def show\n @movie = Movie.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @movie }\n end\n end",
"def show\n @movie = Movie.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @movie }\n end\n end",
"def show\n @movie = Movie.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @movie }\n end\n end",
"def index\n\t\t@movies = Movie.all\n\t\trespond_with @movies\n\tend",
"def movie_data\n response = RestClient.get(\"critics.api.mks.io/movie-genres\")\n JSON.parse(response)\nend",
"def show\n if @movie\n render json: { data: @movie }, status: 200\n end\n end",
"def search_movie(title)\n headers = {\n accept: 'application/json',\n api_key: ENV['TMDB_API_KEY'],\n content_type: 'json',\n query: title,\n }\n\n response = RestClient.get \"https://api.themoviedb.org/3/search/movie/\", { params: headers }\n json_response = JSON.parse(response)\n\n return json_response\n end",
"def show\n @movie = @category.movies.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @movie }\n end\n end",
"def index\n page = 1\n request_url = MOVIE_DB_URL + \"&api_key=#{ENV[\"API_KEY\"]}\"\n request_url += \"&page=#{page}\"\n # if sort by release date\n # request_url += RELEASE_DATE_DESC_URL\n # if sort by title\n # request_url += RELEASE_DATE_DESC_URL;\n @movies = Unirest.get(request_url).body[\"results\"]\n end",
"def get_movies_from_api\n all_films = RestClient.get('http://www.swapi.co/api/films/')\n film_hash = JSON.parse(all_films) \nend",
"def show\n movie = Movie.find(params[:id])\n if movie.nil?\n render json: {message: \"movie not found\"}, status: :ok\n else\n render json: movie, status: :ok, serializer: Movies::Show::MovieSerializer\n end\n end",
"def control \n @movies = Movie.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @movies }\n end\n end",
"def index\n respond_with Movie.all\n end",
"def list\n movies = Movie.order(release_date: :desc)\n render :json => movies.to_json\n\tend",
"def index\n @title = 'Homepage'\n @all_movies = Movie.all.order(:title)\n # @movies = @all_movies.page(params[:page]).per(10)\n @movies = @all_movies\n\n respond_to do |format|\n format.html\n format.json do\n render json: @movies.as_json(methods: %i[genre num_ratings stars], include:\n { category: { only: %i[id name] },\n ratings: { only: %i[id user_id movie_id stars] } },\n except: :category_id)\n end\n end\n end",
"def show\n @classication = Classication.find(params[:id])\n @movies = @classication.movies\n\n respond_to do |format|\n format.html\n format.json {render :json => @classication}\n end\n end",
"def show\n @movie_info = MovieInfo.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @movie_info }\n end\n end",
"def index\n @movies = Movie.all\n @search = Movie.search(params[:search]) \n @movies = @search.all \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @movies }\n end\n end",
"def index\n @movies = Movie.all\n\t# @alloCineJson = JSON.parse(open(\"http://api.allocine.fr/rest/v3/movielist?partner=YW5kcm9pZC12M3M&count=25&filter=nowshowing&order=toprank&format=json\").read)[\"feed\"]\n\t@alloCineJson = JSON.parse(open(\"http://api.allocine.fr/rest/v3/movielist?partner=YW5kcm9pZC12M3M&count=40&filter=nowshowing&order=toprank&format=json&profile=small\").read)[\"feed\"]\n\tresponse = {}\n\tmovies = []\n\t@alloCineJson[\"movie\"].each{ |mv|\n\t\tmovie=Movie.where(:alloCineCode => mv[\"code\"]).first\n\t\tif !movie\n\t\t\tmovie = Movie.create(:alloCineCode => mv[\"code\"], :title=>mv[\"title\"])\n\t\tend\n\t\tmovieHash = {}\n\t\tmovieHash[\"id\"] = movie.id\n\t\tmovieHash[\"code\"] = movie[\"title\"]\n\t\tmovieHash[\"code\"] = mv[\"title\"]\n\t\tmovieHash[\"title\"] = mv[\"title\"]\n\t\tmovieHash[\"poster\"] = mv[\"poster\"][\"href\"]\n\t\tmovies << movieHash\n\t}\n\tresponse[\"movies\"] = movies\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: response }\n end\n end",
"def get_movies\n\t\t@movies = Movie.order(\"RANDOM()\").where(\"release_date > ?\", 3.years.ago).order('random()').joins(:critic_movies).group('movies.id').having(\"count(movie_id) >= #{CUTOFF}\")\n\t\t.limit(750).to_a\n\t\[email protected] do | movie | \n\t\t\tmovie.title = movie.title.split.map(&:capitalize).join(' ')\n\t\tend\n\t\t@movies = @movies.to_a.map(&:serializable_hash).to_json\n\t\trender :json => @movies\n\tend",
"def movie(id, details = nil)\n get(\"/catalog/titles/movies/#{id.to_s}#{details.nil? ? \"\" : \"/#{details}\"}\")\n end",
"def show\n @movie = @catalogue.movies.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @movie }\n format.json { render :json => @movie }\n end\n end",
"def show\n render json: [movie: @movie, review: @movie.ratings, avg_rating: @movie.avg_rating ]\n # render json: { movie: { name: 'IronMan' },\n # review: [{ rating: 4 }, coment: 'superhero movie'] }\n end",
"def index\n @movies = Movie.all\n end",
"def index\n @movies = Movie.all\n end",
"def index\n @movies = Movie.all\n end",
"def index\n @movies = Movie.all\n end",
"def index\n @movies = Movie.all\n end",
"def index\n @movies = Movie.all\n end",
"def index\n @movies = Movie.all\n end",
"def index\n @movies = Movie.all\n end",
"def index\n @movies = Movie.all\n end",
"def show\n\t\t@movie = Movie.find params[:id]\n\t\trespond_with @movie\n\tend",
"def show\n @watched_movie = WatchedMovie.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @watched_movie }\n end\n end",
"def show\n @movies = Genre.find(params[:id]).movies\n p @movies\n end",
"def show\n @unseen_movie = UnseenMovie.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @unseen_movie }\n end\n end",
"def index\n @movies = Movie.all \n end",
"def show\n respond_with Movie.search(params[:id])\n # respond_with movie: movie\n end",
"def index\n @movie = Movie.find(params[:movie_id])\n end",
"def get_popular_movies\n\t\t\tmovies = Array.new\n\t\t\tname = \"TmdbService#GetPopularMovies\"\n\t\t\tpath = \"/3/movie/popular\"\n\t\t\tparams = {\n api_key: @key\n\t\t\t}\n\t\t\[email protected]('X-Service-Name' => name)\n\t\t\tbegin\n \traw_response = @conn.get(path, params, @headers)\n\t\t\trescue\n\t\t\t\t#do something exceptional\n\t\t\tend\n\t\t\tmovies = @data_mapper.list_of_movies(raw_response)\n\t\tend",
"def movie\n @movie ||= parse_json\n end",
"def show\n @bollywood_movie = BollywoodMovie.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @bollywood_movie }\n end\n end",
"def print_movies(films)\n # some iteration magic and puts out the movies in a nice list\n films.each do |film|\n response_string = RestClient.get(film)\n response_hash = JSON.parse(response_string)\n puts response_hash[\"title\"]\n end\nend",
"def show\n @cinemas_movie = CinemasMovie.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @cinemas_movie }\n end\n end",
"def index\n @movies = current_user.movies.page(params[:page]).per(Movie::PER_PAGE)\n end",
"def index\n movie_params = params[:movies] || {}\n if movie_params[:page].blank?\n movie_params[:page] = 0\n end\n\n @movies = Movie.search movie_params[:word], 0, EACH_LIMIT_WHEN_SEARCH do |response|\n @movies_count = response['numFound']\n end\n\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @movies }\n end\n end",
"def movies\n @movies ||= parse_movie_infos\n end",
"def index\n page_number = params[:page] && params[:page][:number] ? params[:page][:number] : Rails.configuration.default_page\n page_size = params[:page] && params[:page][:size]? params[:page][:size] : Rails.configuration.default_per_page\n @movies = Movie.includes(:actors).all.page(page_number).per(page_size)\n end",
"def get_movies_by_film(title)\n all_movies = RestClient.get('http://www.swapi.co/api/films/')\n movies_hash = JSON.parse(all_movies)\n\n results = movies_hash[\"results\"].select {|movie| movie[\"title\"].downcase == title}\n # results is an array containing a hash\n\n if results[0].length > 0\n puts \"Title: #{results[0][\"title\"]}\"\n puts \"Director: #{results[0][\"director\"]}\"\n puts \"Release Date: #{results[0][\"release_date\"]}\"\n else\n puts \"Movie not found\"\n end\nend",
"def detail\n @movies = Movie.all\n render json: @movies , status: :ok, each_serializer: MovieDetailSerializer\n end",
"def get_movie (id)\n\t\taction = \"movie/\" + id\n\t\targument = \"&language=en-US\"\n\t\tresponse = call_api(action, argument)\n\t\tmovie = process_result(response)\n\tend",
"def all_movies\n # in case the file is empty or missing, return an empty collection\n JSON.parse(File.read('data.json')) rescue []\nend",
"def show\n @movie_list = MovieList.find(params[:id])\n @movies = Movie.search(params, current_user, @movie_list.movies)\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @movie_list }\n end\n end",
"def get_all_single_critic_movies\n\t\treviews_array = []\n\t\tcritic_id = params[:id]\n\t\treviews = Critic.find(critic_id).critic_movies\n\t\treviews_array.push(reviews)\n\t\treviews = reviews_array.to_json\n\t\trender :json => reviews\n\tend",
"def show\n @movie = Movie.find(params[:id])\n end",
"def show\n @movie = Movie.find(params[:id])\n end",
"def show\n @movie = Movie.find(params[:id])\n end",
"def show\n @park = Park.find(params[:id])\n @movies = @park.movies\n @movie = Movie.find(params[:id])\n @movie_events = MovieEvent.where(park_id: params[:id], movie_id: params[:id])\n\n \n require 'uri'\n require 'net/http'\n\n url = URI(\"https://api.themoviedb.org/3/configuration?api_key=feb440596767b82e73112b66f54d1c4d\")\n\n http = Net::HTTP.new(url.host, url.port)\n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n\n request = Net::HTTP::Get.new(url)\n request.body = \"{}\"\n\n response = http.request(request)\n puts response.read_body\n end",
"def show\n\t# require 'net/http'\n\trequire 'open-uri'\n\trequire 'json'\n\n @movie = Movie.find(params[:id])\n\tresponse = {}\n\t@alloCineJson = JSON.parse(open(\"http://api.allocine.fr/rest/v3/movie?partner=YW5kcm9pZC12M3M&format=json&filter=movie&profile=small&mediafmt=mp4&code=\"+ @movie.alloCineCode.to_s, :proxy => @@proxyUTC).read)[\"movie\"]\n\tresponse[\"title\"]=@alloCineJson[\"title\"]\n\tresponse[\"directors\"]=@alloCineJson[\"castingShort\"][\"directors\"]\n\tresponse[\"actors\"]=@alloCineJson[\"castingShort\"][\"actors\"]\n\tresponse[\"synopsisShort\"]=@alloCineJson[\"synopsisShort\"]\n\tresponse[\"releaseDate\"]=@alloCineJson[\"release\"][\"releaseDate\"]\n\tresponse[\"poster\"]=@alloCineJson[\"poster\"][\"href\"]\n\tresponse[\"runtime\"]=@alloCineJson[\"runtime\"]\n\t@trailerInfoJson = JSON.parse(open(\"http://api.allocine.fr/rest/v3/media?format=json&partner=aXBhZC12MQ&profile=small&mediafmt=mp4&code=\"+ @alloCineJson[\"trailer\"][\"code\"].to_s).read)[\"media\"]\n\tresponse[\"trailer\"]=@trailerInfoJson[\"rendition\"][0][\"href\"]\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: response }\n end\n end",
"def show_character_movies(character)\n films = get_character_movies_from_api(character)\n #print_movies(films)\nend",
"def index\n @movies = Movie.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @movies }\n end\n end",
"def index\n @videos = Video.all\n render json: @videos\n end",
"def film_api(url)\n film_response = RestClient.get(url)\n film_hash = JSON.parse(film_response)\nend",
"def index\n @movies = current_user.movies\n end",
"def index\n @movies = Movie.all.order('avg_rating DESC')\n # @movies.each do |movie|\n # movie.as_json.merge!(rating: movie.avg_rating)\n # end\n render json: @movies\n # render json: { movies: [{ name: 'IronMan' },\n # { name: 'hulk' },\n # { name: 'ironman2' },\n # { name: 'thor' },\n # { name: 'captain america' },\n # { name: 'avengers' }] }\n end",
"def index\n @movies = PlatformMovie.current.sort { |a, b| b.meta_score <=> a.meta_score }.collect do |movie|\n {\n image_url: movie.movie.image_url,\n platform_link: movie.platform_link,\n platform: (movie.type == 'HboMovie') ? 'hbo' : 'Showtime',\n meta_score: movie.meta_score,\n youtube: movie.movie.youtube,\n title: movie.movie.title,\n summary: movie.movie.summary,\n rating: movie.movie.rating,\n year: movie.movie.year,\n created_at: movie.started\n }\n end\n end",
"def get_character_movies_from_api(character)\n #make the web request\n all_characters = RestClient.get('http://www.swapi.co/api/people/')\n character_hash = JSON.parse(all_characters)\n film_urls = get_film_urls(character_hash, character)\n\n parse_character_movies(parse_films(film_urls))\nend",
"def show_character_movies(character)\n urls_of_films = get_character_movies_from_api(character)\n films_hash = add_film_urls(urls_of_films)\n parse_character_movies(films_hash)\nend",
"def new\n @movie = Movie.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @movie }\n end\n end",
"def new\n @movie = Movie.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @movie }\n end\n end",
"def new\n @movie = Movie.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @movie }\n end\n end",
"def new\n @movie = Movie.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @movie }\n end\n end",
"def new\n @movie = Movie.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @movie }\n end\n end",
"def new\n @movie = Movie.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @movie }\n end\n end",
"def new\n @movie = Movie.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @movie }\n end\n end",
"def new\n @movie = Movie.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @movie }\n end\n end",
"def new\n @movie = Movie.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @movie }\n end\n end",
"def print_movies(films)\n list = films.map do |film|\n response_string = RestClient.get(film)\n response_hash = JSON.parse(response_string)\n response_hash[\"title\"]\n end\n puts list\n # some iteration magic and puts out the movies in a nice list\nend",
"def show\n @movie = Movie.find(params[:id])\n @movie.set_kind_of_movie\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @movie }\n end\n end",
"def index\n @reviews = Review.includes(:movie).order('created_at Desc').all\n render json: @reviews, include: [:movie]\n end",
"def show\n @movie = Movie.find(params[:id])\n @vote = Vote.new\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @movie }\n end\n end",
"def search\n @movies = Movie.includes(:reviews).where(\"title ILIKE ?\", \"%#{params[:title]}%\")\n @reviews = @movies.map do |movie|\n movie.reviews\n end\n @reviews.flatten!\n render json: { movies: @movies, reviews: @reviews }\n end",
"def people\n Birdman::Requester.get(\"movies/#{id}/people\")\n end",
"def show_character_movies(character)\n films_hash = get_character_movies_from_api(character)\n parse_character_movies(films_hash)\nend",
"def show_character_movies(character)\n films_hash = get_character_movies_from_api(character) #returns films list/url\n parse_character_movies(films_hash)\nend",
"def show\n @movie = Movie.find(params[:id])\n @serie = Serie.where(movie_id: @movie)\n end",
"def index\n @actors_movies = ActorsMovie.all\n end",
"def index\n @theatre_movies = TheatreMovie.all\n end",
"def show_character_movies(character)\n films = get_character_movies_from_api(character)\n print_movies(films)\nend",
"def show_character_movies(character)\n films = get_character_movies_from_api(character)\n print_movies(films)\n\n\n\nend",
"def show\n id = params[:id]\n @movie = Movie.find(id)\n end",
"def show\n id = params[:id]\n @movie = Movie.find(id)\n end",
"def show\n @movie_item = MovieItem.find(params[:id])\n\t\tredirect_to root_path, :notice => \"You are not supposed to view this page.\"\n# respond_to do |format|\n# format.html # show.html.erb\n# format.json { render json: @movie_item }\n# end\n end"
] | [
"0.8227555",
"0.7484902",
"0.74789107",
"0.74730414",
"0.74474025",
"0.7354044",
"0.7354044",
"0.7354044",
"0.7354044",
"0.7354044",
"0.7354044",
"0.73434794",
"0.7283256",
"0.7214987",
"0.7197649",
"0.7150194",
"0.7128301",
"0.703391",
"0.70069593",
"0.70027626",
"0.69713336",
"0.6960787",
"0.6959025",
"0.6927098",
"0.6880148",
"0.6855929",
"0.684521",
"0.683455",
"0.6804383",
"0.6801787",
"0.68000895",
"0.67887545",
"0.67887545",
"0.67887545",
"0.67887545",
"0.67887545",
"0.67887545",
"0.67887545",
"0.67887545",
"0.67887545",
"0.6779411",
"0.67748207",
"0.67539525",
"0.67516565",
"0.673808",
"0.6710303",
"0.6708301",
"0.6684105",
"0.66609436",
"0.66594994",
"0.664244",
"0.66413397",
"0.6592391",
"0.65730995",
"0.6561985",
"0.6553322",
"0.65512466",
"0.65124756",
"0.65110886",
"0.6496289",
"0.64804554",
"0.6479911",
"0.6458419",
"0.6458419",
"0.6458419",
"0.6455564",
"0.64531815",
"0.6449013",
"0.64459234",
"0.644282",
"0.6428165",
"0.6421019",
"0.64048433",
"0.6401126",
"0.6396336",
"0.63954484",
"0.6386667",
"0.6386667",
"0.6386667",
"0.6386667",
"0.6386667",
"0.6386667",
"0.6386667",
"0.6386667",
"0.6386667",
"0.6365113",
"0.63643354",
"0.6362025",
"0.63608855",
"0.63486624",
"0.63203275",
"0.6303766",
"0.63025224",
"0.6295277",
"0.62839264",
"0.62834615",
"0.62783414",
"0.62720704",
"0.62645376",
"0.62645376",
"0.6263246"
] | 0.0 | -1 |
GET /movies/1 GET /movies/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def movies\n get('Movies')\n end",
"def show\n @movie = Movie.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @movie }\n end\n end",
"def show\n @movie = Movie.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @movie }\n end\n end",
"def show\n @movie = Movie.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @movie }\n end\n end",
"def show\n @movie = Movie.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @movie }\n end\n end",
"def show\n @movie = Movie.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @movie }\n end\n end",
"def show\n @movie = Movie.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @movie }\n end\n end",
"def get_all_movies_for_actor(actor)\n url = \"http://movies.api.mks.io/movies\"\n response = RestClient.get(url, accept: 'application/json')\n\nend",
"def index\n @movies = @category.movies.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @movies }\n end\n end",
"def get_all_actors_for_movie(movie)\n url = \"http://movies.api.mks.io/actors\"\n response = RestClient.get(url, accept: 'application/json')\n\nend",
"def show\n @movie = @category.movies.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @movie }\n end\n end",
"def movie(id, details = nil)\n get(\"/catalog/titles/movies/#{id.to_s}#{details.nil? ? \"\" : \"/#{details}\"}\")\n end",
"def index\n page = 1\n request_url = MOVIE_DB_URL + \"&api_key=#{ENV[\"API_KEY\"]}\"\n request_url += \"&page=#{page}\"\n # if sort by release date\n # request_url += RELEASE_DATE_DESC_URL\n # if sort by title\n # request_url += RELEASE_DATE_DESC_URL;\n @movies = Unirest.get(request_url).body[\"results\"]\n end",
"def index\n\t\t@movies = Movie.all\n\t\trespond_with @movies\n\tend",
"def show\n if @movie\n render json: { data: @movie }, status: 200\n end\n end",
"def movie_data\n response = RestClient.get(\"critics.api.mks.io/movie-genres\")\n JSON.parse(response)\nend",
"def search_movie(title)\n headers = {\n accept: 'application/json',\n api_key: ENV['TMDB_API_KEY'],\n content_type: 'json',\n query: title,\n }\n\n response = RestClient.get \"https://api.themoviedb.org/3/search/movie/\", { params: headers }\n json_response = JSON.parse(response)\n\n return json_response\n end",
"def show\n movie = Movie.find(params[:id])\n if movie.nil?\n render json: {message: \"movie not found\"}, status: :ok\n else\n render json: movie, status: :ok, serializer: Movies::Show::MovieSerializer\n end\n end",
"def index\n @movie = Movie.find(params[:movie_id])\n end",
"def pull_movies(options = {})\n response = HTTParty.get(build_url('movie', options), headers: HEADERS, debug_output: $stdout)\n JSON.parse(response.body)\n end",
"def show\n @movie_info = MovieInfo.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @movie_info }\n end\n end",
"def show\n\t\t@movie = Movie.find params[:id]\n\t\trespond_with @movie\n\tend",
"def show\n @classication = Classication.find(params[:id])\n @movies = @classication.movies\n\n respond_to do |format|\n format.html\n format.json {render :json => @classication}\n end\n end",
"def control \n @movies = Movie.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @movies }\n end\n end",
"def show\n @watched_movie = WatchedMovie.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @watched_movie }\n end\n end",
"def show\n @movie = @catalogue.movies.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @movie }\n format.json { render :json => @movie }\n end\n end",
"def show\n @movies = Genre.find(params[:id]).movies\n p @movies\n end",
"def show\n @unseen_movie = UnseenMovie.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @unseen_movie }\n end\n end",
"def index\n @title = 'Homepage'\n @all_movies = Movie.all.order(:title)\n # @movies = @all_movies.page(params[:page]).per(10)\n @movies = @all_movies\n\n respond_to do |format|\n format.html\n format.json do\n render json: @movies.as_json(methods: %i[genre num_ratings stars], include:\n { category: { only: %i[id name] },\n ratings: { only: %i[id user_id movie_id stars] } },\n except: :category_id)\n end\n end\n end",
"def get_movies_from_api\n all_films = RestClient.get('http://www.swapi.co/api/films/')\n film_hash = JSON.parse(all_films) \nend",
"def show\n respond_with Movie.search(params[:id])\n # respond_with movie: movie\n end",
"def show\n @movie = Movie.find(params[:id])\n end",
"def show\n @movie = Movie.find(params[:id])\n end",
"def show\n @movie = Movie.find(params[:id])\n end",
"def index\n respond_with Movie.all\n end",
"def show\n @bollywood_movie = BollywoodMovie.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @bollywood_movie }\n end\n end",
"def list\n movies = Movie.order(release_date: :desc)\n render :json => movies.to_json\n\tend",
"def print_movies(films)\n # some iteration magic and puts out the movies in a nice list\n films.each do |film|\n response_string = RestClient.get(film)\n response_hash = JSON.parse(response_string)\n puts response_hash[\"title\"]\n end\nend",
"def show\n id = params[:id]\n @movie = Movie.find(id)\n end",
"def show\n id = params[:id]\n @movie = Movie.find(id)\n end",
"def index\n @movies = Movie.all\n end",
"def index\n @movies = Movie.all\n end",
"def index\n @movies = Movie.all\n end",
"def index\n @movies = Movie.all\n end",
"def index\n @movies = Movie.all\n end",
"def index\n @movies = Movie.all\n end",
"def index\n @movies = Movie.all\n end",
"def index\n @movies = Movie.all\n end",
"def index\n @movies = Movie.all\n end",
"def index\n @movies = Movie.all \n end",
"def index\n @movies = Movie.all\n @search = Movie.search(params[:search]) \n @movies = @search.all \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @movies }\n end\n end",
"def get_movie (id)\n\t\taction = \"movie/\" + id\n\t\targument = \"&language=en-US\"\n\t\tresponse = call_api(action, argument)\n\t\tmovie = process_result(response)\n\tend",
"def show\n @cinemas_movie = CinemasMovie.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @cinemas_movie }\n end\n end",
"def index\n @movies = Movie.all\n\t# @alloCineJson = JSON.parse(open(\"http://api.allocine.fr/rest/v3/movielist?partner=YW5kcm9pZC12M3M&count=25&filter=nowshowing&order=toprank&format=json\").read)[\"feed\"]\n\t@alloCineJson = JSON.parse(open(\"http://api.allocine.fr/rest/v3/movielist?partner=YW5kcm9pZC12M3M&count=40&filter=nowshowing&order=toprank&format=json&profile=small\").read)[\"feed\"]\n\tresponse = {}\n\tmovies = []\n\t@alloCineJson[\"movie\"].each{ |mv|\n\t\tmovie=Movie.where(:alloCineCode => mv[\"code\"]).first\n\t\tif !movie\n\t\t\tmovie = Movie.create(:alloCineCode => mv[\"code\"], :title=>mv[\"title\"])\n\t\tend\n\t\tmovieHash = {}\n\t\tmovieHash[\"id\"] = movie.id\n\t\tmovieHash[\"code\"] = movie[\"title\"]\n\t\tmovieHash[\"code\"] = mv[\"title\"]\n\t\tmovieHash[\"title\"] = mv[\"title\"]\n\t\tmovieHash[\"poster\"] = mv[\"poster\"][\"href\"]\n\t\tmovies << movieHash\n\t}\n\tresponse[\"movies\"] = movies\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: response }\n end\n end",
"def movie\n Movie.find_by(:id => movie_id)\n end",
"def show\n render json: [movie: @movie, review: @movie.ratings, avg_rating: @movie.avg_rating ]\n # render json: { movie: { name: 'IronMan' },\n # review: [{ rating: 4 }, coment: 'superhero movie'] }\n end",
"def get_movies_by_film(title)\n all_movies = RestClient.get('http://www.swapi.co/api/films/')\n movies_hash = JSON.parse(all_movies)\n\n results = movies_hash[\"results\"].select {|movie| movie[\"title\"].downcase == title}\n # results is an array containing a hash\n\n if results[0].length > 0\n puts \"Title: #{results[0][\"title\"]}\"\n puts \"Director: #{results[0][\"director\"]}\"\n puts \"Release Date: #{results[0][\"release_date\"]}\"\n else\n puts \"Movie not found\"\n end\nend",
"def get_all_single_critic_movies\n\t\treviews_array = []\n\t\tcritic_id = params[:id]\n\t\treviews = Critic.find(critic_id).critic_movies\n\t\treviews_array.push(reviews)\n\t\treviews = reviews_array.to_json\n\t\trender :json => reviews\n\tend",
"def detail\n @movies = Movie.all\n render json: @movies , status: :ok, each_serializer: MovieDetailSerializer\n end",
"def show\n #render json: params\n #@movie = Movie.find(params[:id])\n render html:'ciao io sono index'[email protected]_s\n #render json: @movie\n end",
"def get_movies\n\t\t@movies = Movie.order(\"RANDOM()\").where(\"release_date > ?\", 3.years.ago).order('random()').joins(:critic_movies).group('movies.id').having(\"count(movie_id) >= #{CUTOFF}\")\n\t\t.limit(750).to_a\n\t\[email protected] do | movie | \n\t\t\tmovie.title = movie.title.split.map(&:capitalize).join(' ')\n\t\tend\n\t\t@movies = @movies.to_a.map(&:serializable_hash).to_json\n\t\trender :json => @movies\n\tend",
"def callAPI(name)\n unless name.nil?\n # I chose to use the title_popular option over the title_exact option since\n # we don't know the full title and over the title_substring since it seemed\n # to return videos related to our search term instead of movies\n json = JSON.parse(open(\"http://www.imdb.com/xml/find?json=1&nr=1&tt=on&q=#{name}\") { |x| x.read })\n # Should do more date validation but I will assume it's always the first 4 characters\n return \"Title: \" + json[\"title_popular\"][0][\"title\"] + \"\\nYear: \" + json[\"title_popular\"][0][\"title_description\"][0..3] unless json[\"title_popular\"].nil?\n \"No movie with the specified title\"\n else\n \"Please specify a movie title\"\n end\nend",
"def movie\n @movie ||= parse_json\n end",
"def show\n @movie = Movie.find(params[:id])\n @vote = Vote.new\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @movie }\n end\n end",
"def show\n @imdb_movie = Movie.find(params[:id])\n end",
"def show\n @movie = Movie.find(params[:id])\n @serie = Serie.where(movie_id: @movie)\n end",
"def show\n @movie = Movie.find(params[:id])\n @movie.set_kind_of_movie\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @movie }\n end\n end",
"def show\n\t# require 'net/http'\n\trequire 'open-uri'\n\trequire 'json'\n\n @movie = Movie.find(params[:id])\n\tresponse = {}\n\t@alloCineJson = JSON.parse(open(\"http://api.allocine.fr/rest/v3/movie?partner=YW5kcm9pZC12M3M&format=json&filter=movie&profile=small&mediafmt=mp4&code=\"+ @movie.alloCineCode.to_s, :proxy => @@proxyUTC).read)[\"movie\"]\n\tresponse[\"title\"]=@alloCineJson[\"title\"]\n\tresponse[\"directors\"]=@alloCineJson[\"castingShort\"][\"directors\"]\n\tresponse[\"actors\"]=@alloCineJson[\"castingShort\"][\"actors\"]\n\tresponse[\"synopsisShort\"]=@alloCineJson[\"synopsisShort\"]\n\tresponse[\"releaseDate\"]=@alloCineJson[\"release\"][\"releaseDate\"]\n\tresponse[\"poster\"]=@alloCineJson[\"poster\"][\"href\"]\n\tresponse[\"runtime\"]=@alloCineJson[\"runtime\"]\n\t@trailerInfoJson = JSON.parse(open(\"http://api.allocine.fr/rest/v3/media?format=json&partner=aXBhZC12MQ&profile=small&mediafmt=mp4&code=\"+ @alloCineJson[\"trailer\"][\"code\"].to_s).read)[\"media\"]\n\tresponse[\"trailer\"]=@trailerInfoJson[\"rendition\"][0][\"href\"]\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: response }\n end\n end",
"def get_first_movies\n\t\t@movies = Movie.where(\"release_date > ?\", 3.years.ago).order('random()').joins(:critic_movies).group('movies.id').having(\"count(movie_id) > #{CUTOFF}\")\n\t\t.limit(1).to_a\n\t\[email protected] do | movie | \n\t\t\tmovie.title = movie.title.split.map(&:capitalize).join(' ')\n\t\tend\n\t\t@movies = @movies.to_a.map(&:serializable_hash).to_json\n\t\trender :json => @movies\n\tend",
"def index\n @movies = current_user.movies.page(params[:page]).per(Movie::PER_PAGE)\n end",
"def new\n @movie = Movie.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @movie }\n end\n end",
"def new\n @movie = Movie.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @movie }\n end\n end",
"def new\n @movie = Movie.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @movie }\n end\n end",
"def new\n @movie = Movie.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @movie }\n end\n end",
"def new\n @movie = Movie.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @movie }\n end\n end",
"def new\n @movie = Movie.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @movie }\n end\n end",
"def new\n @movie = Movie.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @movie }\n end\n end",
"def new\n @movie = Movie.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @movie }\n end\n end",
"def new\n @movie = Movie.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @movie }\n end\n end",
"def show\n id = params[:id] # retrieve movie ID from URI route\n @movie = Movie.find(id) # look up movie by unique ID\n # will render app/views/movies/show.<extension> by default\n end",
"def show\n id = params[:id] # retrieve movie ID from URI route\n @movie = Movie.find(id) # look up movie by unique ID\n # will render app/views/movies/show.<extension> by default\n end",
"def show\n \t@movie = Tmdb::Movie.detail(params[:id])\n \t@images = Tmdb::Movie.images(params[:id])\n \t@cast = Tmdb::Movie.casts(params[:id])\n \t@trailers = Tmdb::Movie.trailers(params[:id])\n \t@similar_movies = Tmdb::Movie.similar_movies(params[:id])\n end",
"def index\n @movies = Movie.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @movies }\n end\n end",
"def show\n @movie_item = MovieItem.find(params[:id])\n\t\tredirect_to root_path, :notice => \"You are not supposed to view this page.\"\n# respond_to do |format|\n# format.html # show.html.erb\n# format.json { render json: @movie_item }\n# end\n end",
"def show\n @movie_list = MovieList.find(params[:id])\n @movies = Movie.search(params, current_user, @movie_list.movies)\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @movie_list }\n end\n end",
"def film_api(url)\n film_response = RestClient.get(url)\n film_hash = JSON.parse(film_response)\nend",
"def show\r\n @movie = session[:movies][params[:id].to_i]\r\n end",
"def index\n # # if page value a param, use that, else ...\n # page = 3\n # request_url = MOVIE_DB_URL + \"&api_key=#{ENV[\"API_KEY\"]}\"\n genre_request_url = GENRE_URL + \"&api_key=#{ENV[\"API_KEY\"]}\"\n # request_url += \"&page=#{page}\"\n # if sort by release date\n # request_url += RELEASE_DATE_DESC_URL\n # if sort by title\n # request_url += RELEASE_DATE_DESC_URL;\n # @movies = Unirest.get(request_url).body[\"results\"]\n @genres = Unirest.get(genre_request_url).body[\"genres\"]\n # puts @genres\n end",
"def people\n Birdman::Requester.get(\"movies/#{id}/people\")\n end",
"def index\n movie_params = params[:movies] || {}\n if movie_params[:page].blank?\n movie_params[:page] = 0\n end\n\n @movies = Movie.search movie_params[:word], 0, EACH_LIMIT_WHEN_SEARCH do |response|\n @movies_count = response['numFound']\n end\n\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @movies }\n end\n end",
"def find_movie_by_title(arg)\n query_response = RestClient.get(\"http://www.omdbapi.com/?t=#{arg}&apikey=a2d3299b\") #query the database\n parsed_response = JSON.parse(query_response) #parse the response into a useable hash\n movie_deets_hash = #extract relevant details from the hash\n {\"Title\" => parsed_response[\"Title\"],\n \"Released\" => parsed_response[\"Released\"].slice(-4..).to_i,\n \"Genre\" => parsed_response[\"Genre\"],\n \"Director\" => parsed_response[\"Director\"]}\n add_movie_to_database(movie_deets_hash) #create a movie_object for the selected movie, if it doesn't already exist\n end",
"def fetchMovieRatingAndYear(movieID)\n #Construct the URL used to access the API\n url = \"http://api.themoviedb.org/3/movie/#{movieID}/releases?api_key=#{$apiKey}\"\n #RESTful request\n data = JSON.parse(RestClient.get(url))\n #Pull out the list of releases from the parsed request\n countries = data[\"countries\"]\n #Get just the US release (including date and rating info) and return it\n us = countries.select{ |country| country[\"iso_3166_1\"]==\"US\"}\n return us[0]\nend",
"def show\n @park = Park.find(params[:id])\n @movies = @park.movies\n @movie = Movie.find(params[:id])\n @movie_events = MovieEvent.where(park_id: params[:id], movie_id: params[:id])\n\n \n require 'uri'\n require 'net/http'\n\n url = URI(\"https://api.themoviedb.org/3/configuration?api_key=feb440596767b82e73112b66f54d1c4d\")\n\n http = Net::HTTP.new(url.host, url.port)\n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n\n request = Net::HTTP::Get.new(url)\n request.body = \"{}\"\n\n response = http.request(request)\n puts response.read_body\n end",
"def index\n @videos = Video.all\n render json: @videos\n end",
"def show\n\t\tid = params[:id];\t\t\t\t#get the movie id\n\t\t@movie = Movie.find_by_id(id) \t#get the movie from the database\n\tend",
"def show\n\n # default to type = 'movie'\n type = params[:type] ? params[:type] : 'movie'\n\n # find polymorphic by indexed tmdb info\n # since primary key is reindexed for pagination, this key does not change\n watch = Watchable.find_by(tmdb_id: params[:id], tmdb_type: type)\n \n # grab all details including guidebox info.\n # this will affect API limits\n watch.full_details\n render json: watch\n end",
"def show\n @movie = Movie.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @movie }\n end\n end",
"def show\n @movie = Movie.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @movie }\n end\n end",
"def ratings\n Birdman::Requester.get(\"movies/#{id}/ratings\")\n end",
"def index\n page_number = params[:page] && params[:page][:number] ? params[:page][:number] : Rails.configuration.default_page\n page_size = params[:page] && params[:page][:size]? params[:page][:size] : Rails.configuration.default_per_page\n @movies = Movie.includes(:actors).all.page(page_number).per(page_size)\n end",
"def detail\n mv = Tmdb::Movie.detail(params[:id].to_i).to_h\n mv = mv.delete_if { |key, value| %w[production_companies spoken_languages production_countries genres].include?(key.to_s) }\n @movie = Movie.new(mv.to_h)\n respond_to do |format|\n if @movie\n format.json { render :show, status: :created }\n else\n format.json do\n render json: @movie.errors, status: :unprocessable_entity\n end\n end\n end\n end"
] | [
"0.7840408",
"0.7417043",
"0.7417043",
"0.7417043",
"0.7417043",
"0.7417043",
"0.7417043",
"0.7337925",
"0.7307941",
"0.7254705",
"0.7145913",
"0.712192",
"0.7111538",
"0.70936346",
"0.7092198",
"0.70896614",
"0.70844346",
"0.7034522",
"0.6987229",
"0.69613814",
"0.6960965",
"0.69298595",
"0.692781",
"0.69009906",
"0.68844986",
"0.6841898",
"0.6836183",
"0.683071",
"0.68168235",
"0.68109185",
"0.67870307",
"0.6740375",
"0.6740375",
"0.6740375",
"0.6727756",
"0.6721874",
"0.6711992",
"0.6710538",
"0.6678656",
"0.6678656",
"0.6678036",
"0.6678036",
"0.6678036",
"0.6678036",
"0.6678036",
"0.6678036",
"0.6678036",
"0.6678036",
"0.6678036",
"0.6636007",
"0.6631818",
"0.66241246",
"0.66222805",
"0.66066796",
"0.66000146",
"0.6596443",
"0.6569363",
"0.65634555",
"0.65068793",
"0.6500321",
"0.64989686",
"0.6497009",
"0.64884436",
"0.64796686",
"0.64726824",
"0.6466775",
"0.6457479",
"0.64506394",
"0.6447637",
"0.64272225",
"0.64230776",
"0.64230776",
"0.64230776",
"0.64230776",
"0.64230776",
"0.64230776",
"0.64230776",
"0.64230776",
"0.64230776",
"0.6421797",
"0.6421797",
"0.6403751",
"0.6394849",
"0.63898855",
"0.63863724",
"0.6382406",
"0.63805646",
"0.6373471",
"0.6370407",
"0.63635206",
"0.6363439",
"0.6359366",
"0.63492316",
"0.6338382",
"0.63354856",
"0.63324153",
"0.6290667",
"0.6290667",
"0.6288709",
"0.6273506",
"0.62709844"
] | 0.0 | -1 |
POST /movies POST /movies.json | def create
@movie = Movie.new(movie_params)
respond_to do |format|
if @movie.save
format.html { redirect_to @movie, notice: 'Movie was successfully created.' }
format.json { render :show, status: :created, location: @movie }
else
format.html { render :new }
format.json { render json: @movie.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @movie = Movie.new(params[:movie])\n\n respond_to do |format|\n if @movie.save\n format.html { redirect_to root_path, notice: 'Movie was successfully created.' }\n format.json { render json: @movie, status: :created, location: @movie }\n else\n format.html { render action: \"new\" }\n format.json { render json: @movie.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @movie = Movie.new(params[:movie])\n\n respond_to do |format|\n if @movie.save\n format.html { redirect_to @movie, notice: 'Movie was successfully created.' }\n format.json { render json: @movie, status: :created, location: @movie }\n else\n format.html { render action: \"new\" }\n format.json { render json: @movie.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @movie = Movie.new(params[:movie])\n\n respond_to do |format|\n if @movie.save\n format.html { redirect_to @movie, notice: 'Movie was successfully created.' }\n format.json { render json: @movie, status: :created, location: @movie }\n else\n format.html { render action: \"new\" }\n format.json { render json: @movie.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @movie = Movie.new(params[:movie])\n\n respond_to do |format|\n if @movie.save\n format.html { redirect_to @movie, notice: 'Movie was successfully created.' }\n format.json { render json: @movie, status: :created, location: @movie }\n else\n format.html { render action: \"new\" }\n format.json { render json: @movie.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @movie = Movie.new(params[:movie])\n\n respond_to do |format|\n if @movie.save\n format.html { redirect_to @movie, notice: 'Movie was successfully created.' }\n format.json { render json: @movie, status: :created, location: @movie }\n else\n format.html { render action: \"new\" }\n format.json { render json: @movie.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @movie = Movie.new(params[:movie])\n\n respond_to do |format|\n if @movie.save\n format.html { redirect_to @movie, notice: 'Movie was successfully created.' }\n format.json { render json: @movie, status: :created, location: @movie }\n else\n format.html { render action: \"new\" }\n format.json { render json: @movie.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @movie = Movie.new(movie_params_create)\n respond_to do |format|\n if @movie.save\n format.html { redirect_to user_list_movies_url, notice: 'Movie was successfully created.' }\n format.json { render :show, status: :created, location: @movie }\n else\n format.html { render :new }\n format.json { render json: @movie.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @movie = Movie.new(movie_params)\n\n respond_to do |format|\n if @movie.save\n format.html { redirect_to @movie, notice: 'Movie was successfully created.' }\n format.json { render :show, status: :created, location: @movie }\n else\n format.html { render :new }\n format.json { render json: @movie.errors, status: :unprocessable_entity }\n end\n end\n @movie\n end",
"def create\n @movie = Movie.new(movie_params)\n\n respond_to do |format|\n if @movie.save\n format.html { redirect_to @movie, notice: 'Movie was successfully created.' }\n format.json { render :show, status: :created, location: @movie }\n else\n format.html { render :new }\n format.json { render json: @movie.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @movie = Movie.new(movie_params)\n\n respond_to do |format|\n if @movie.save\n format.html { redirect_to @movie, notice: 'Movie was successfully created.' }\n format.json { render :show, status: :created, location: @movie }\n else\n format.html { render :new }\n format.json { render json: @movie.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @movie = Movie.new(movie_params)\n\n respond_to do |format|\n if @movie.save\n format.html { redirect_to @movie, notice: 'Movie was successfully created.' }\n format.json { render :show, status: :created, location: @movie }\n else\n format.html { render :new }\n format.json { render json: @movie.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @movie = Movie.new(movie_params)\n\n respond_to do |format|\n if @movie.save\n format.html { redirect_to @movie, notice: 'Movie was successfully created.' }\n format.json { render :show, status: :created, location: @movie }\n else\n format.html { render :new }\n format.json { render json: @movie.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @movie = Movie.new(movie_params)\n\n respond_to do |format|\n if @movie.save\n format.html { redirect_to @movie, notice: 'Movie was successfully created.' }\n format.json { render :show, status: :created, location: @movie }\n else\n format.html { render :new }\n format.json { render json: @movie.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @movie = Movie.new(movie_params)\n\n respond_to do |format|\n if @movie.save\n format.html { redirect_to @movie, notice: 'Movie was successfully created.' }\n format.json { render :show, status: :created, location: @movie }\n else\n format.html { render :new }\n format.json { render json: @movie.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @movie = Movie.new(movie_params)\n\n respond_to do |format|\n if @movie.save\n format.html { redirect_to @movie, notice: 'Movie was successfully created.' }\n format.json { render :show, status: :created, location: @movie }\n else\n format.html { render :new }\n format.json { render json: @movie.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @movie = Movie.new(movie_params)\n\n respond_to do |format|\n if @movie.save\n format.html { redirect_to @movie, notice: 'Movie was successfully created.' }\n format.json { render :show, status: :created, location: @movie }\n else\n format.html { render :new }\n format.json { render json: @movie.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @movie = Movie.new(movie_params)\n\n respond_to do |format|\n if @movie.save\n format.html { redirect_to @movie, notice: 'Movie was successfully created.' }\n format.json { render :show, status: :created, location: @movie }\n else\n format.html { render :new }\n format.json { render json: @movie.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @movie = Movie.new(movie_params)\n\n respond_to do |format|\n if @movie.save\n format.html { redirect_to @movie, notice: 'La pelicula ha sido creada correctamente.' }\n format.json { render json: @movie, status: :created, location: @movie }\n else\n format.html { render action: \"new\" }\n format.json { render json: @movie.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @movie = Movie.new(movie_params)\n\n respond_to do |format|\n if @movie.save\n format.html { redirect_to @movie, notice: 'Movie was successfully created.' }\n format.json { render action: 'show', status: :created, location: @movie }\n else\n format.html { render action: 'new' }\n format.json { render json: @movie.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @movie = Movie.new(movie_params)\n\n respond_to do |format|\n if @movie.save\n format.html { redirect_to @movie, notice: 'Movie was successfully created.' }\n format.json { render action: 'show', status: :created, location: @movie }\n else\n format.html { render action: 'new' }\n format.json { render json: @movie.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @movie = current_user.movies.new(movie_params)\n\n respond_to do |format|\n if @movie.save\n format.html { redirect_to @movie, notice: 'Movie was successfully created.' }\n format.json { render :show, status: :created, location: @movie }\n else\n format.html { render :new }\n format.json { render json: @movie.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @movie = Movie.new(movie_params)\n\n respond_to do |format|\n if @movie.save\n format.html {redirect_to @movie, notice: 'Movie was successfully created.'}\n format.json {render :show, status: :created, location: @movie}\n else\n format.html {render :new}\n format.json {render json: @movie.errors, status: :unprocessable_entity}\n end\n end\n end",
"def create\n @movie = Movie.new(movie_params)\n end",
"def create\n @movie = Movie.new(movie_params)\n end",
"def create\n prepare_movie(true)\n \n\n respond_to do |format|\n if @movie.save\n format.html { redirect_to @movie, notice: 'Movie was successfully created.' }\n format.json { render :show, status: :created, location: @movie }\n else\n format.html { render :new }\n format.json { render json: @movie.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @user = current_user\n @favorite_movie = @user.favorite_movies.build(favorite_movie_params)\n if @user.save\n render json: @favorite_movie\n end\n end",
"def create\n if params[:movie][:actors]\n params[:movie][:actors].map!{ |id|\n Actor.find(id)\n }\n else\n params[:movie][:actors] = []\n end\n if params[:movie][:genres]\n params[:movie][:genres].map!{ |id|\n Genre.find(id)\n }\n else\n params[:movie][:genres] = []\n end\n if params[:movie][:directors]\n params[:movie][:directors].map!{ |id|\n Director.find(id)\n }\n else\n params[:movie][:directors] = []\n end\n @movie = Movie.new(params[:movie])\n\n respond_to do |format|\n if @movie.save\n format.html { redirect_to @movie, notice: 'Movie was successfully created.' }\n format.json { render json: @movie, status: :created, location: @movie }\n else\n format.html { render action: \"new\" }\n format.json { render json: @movie.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @movie = Movie.new(movie_params)\n\n respond_to do |format|\n if @movie.save\n format.html { redirect_to movie_url(@movie), notice: \"Movie was successfully created.\" }\n else\n format.html { render :edit, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @movie = Movie.new(movie_params)\n @movie.user = current_user if current_user\n add_director\n add_actors\n respond_to do |format|\n if @movie.save\n format.html { redirect_to @movie, notice: 'Movie was successfully created.' }\n format.json { render :show, status: :created, location: @movie }\n else\n format.html { render :new }\n format.json { render json: @movie.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @movie = Movie.new({:name => params[:movie][:name], :rating => 0})\n\n respond_to do |format|\n if @movie.save\n format.html { redirect_to(@movie, :notice => 'Movie was successfully created.') }\n format.xml { render :xml => @movie, :status => :created, :location => @movie }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @movie.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @movie = Movie.new(movie_params)\n\n movie_id = Tmdb::Movie.find(@movie.title)[0].id\n\n title_info_2 = Tmdb::Movie.detail(movie_id)\n genre = title_info_2['genres'][0]['name']\n vote = title_info_2['vote_average']\n year = title_info_2['release_date'].byteslice(0,4)\n\n cast = Tmdb::Movie.casts(movie_id)\n cast_members = []\n\n cast.each do |member|\n cast_members << member['name']\n end\n\n @movie.actors = cast_members.join(', ')\n @movie.genre = genre\n @movie.year = year\n @movie.metascore = vote\n @movie.user_id = current_user.id\n\n respond_to do |format|\n if @movie.save\n format.html { redirect_to @movie, notice: 'Movie was successfully created.' }\n format.json { render :show, status: :created, location: @movie }\n else\n format.html { render :new }\n format.json { render json: @movie.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n parameters = movie_params.dup\n parameters.delete(:images)\n parameters.delete(:genres)\n parameters.delete(:videos)\n parameters.delete(:actors)\n\n @movie = Movie.new(parameters)\n\n respond_to do |format|\n if @movie.save\n @movie.save_attachments(movie_params)\n format.json { render :show, status: :created }\n else\n format.json do\n render json: @movie.errors, status: :unprocessable_entity\n end\n end\n end\n end",
"def create\n # binding.pry\n @movie = Movie.new(movie_params)\n tag_list = params[:movie][:tag_name].to_s.split('nil')\n respond_to do |format|\n if @movie.save\n @movie.save_movies(tag_list)\n format.html { redirect_to @movie, notice: '投稿が完了しました' }\n format.json { render :show, status: :created, location: @movie }\n else\n format.html { render :new }\n format.json { render json: @movie.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @actors_movie = ActorsMovie.new(actors_movie_params)\n\n respond_to do |format|\n if @actors_movie.save\n format.html { redirect_to @actors_movie, notice: 'Actors movie was successfully created.' }\n format.json { render :show, status: :created, location: @actors_movie }\n else\n format.html { render :new }\n format.json { render json: @actors_movie.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @tmdbmovie = Tmdbmovie.new(tmdbmovie_params)\n\n respond_to do |format|\n if @tmdbmovie.save\n format.html { redirect_to @tmdbmovie, notice: 'Tmdbmovie was successfully created.' }\n format.json { render :show, status: :created, location: @tmdbmovie }\n else\n format.html { render :new }\n format.json { render json: @tmdbmovie.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n new_movie = Movie.new\n\n new_movie.title = params[:title]\n new_movie.year = params[:year]\n new_movie.director = params[:director]\n new_movie.actors = params[:cast_members]\n new_movie.plot = params[:plot]\n new_movie.mpaa_rating = params[:mpaa_rating]\n new_movie.favorite = params[:favorite]\n new_movie.save\n\n redirect_to new_movie\n end",
"def create\n @watched_movie = WatchedMovie.new(params[:watched_movie])\n\n respond_to do |format|\n if @watched_movie.save\n format.html { redirect_to @watched_movie, notice: 'Watched movie was successfully created.' }\n format.json { render json: @watched_movie, status: :created, location: @watched_movie }\n else\n format.html { render action: \"new\" }\n format.json { render json: @watched_movie.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @movie = Movie.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @movie }\n end\n end",
"def new\n @movie = Movie.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @movie }\n end\n end",
"def new\n @movie = Movie.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @movie }\n end\n end",
"def new\n @movie = Movie.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @movie }\n end\n end",
"def new\n @movie = Movie.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @movie }\n end\n end",
"def new\n @movie = Movie.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @movie }\n end\n end",
"def new\n @movie = Movie.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @movie }\n end\n end",
"def new\n @movie = Movie.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @movie }\n end\n end",
"def new\n @movie = Movie.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @movie }\n end\n end",
"def create\n @movie = Movie.new(movie_params)\n\n respond_to do |format|\n if @movie.save\n format.html { redirect_to @movie, notice: \"Movie was successfully created.\" }\n format.json { render :show, status: :created, location: @movie }\n format.js\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @movie.errors, status: :unprocessable_entity }\n end\n end\n end",
"def movies\n get('Movies')\n end",
"def create\n @omdb_movie = OmdbMovie.new(omdb_movie_params)\n\n respond_to do |format|\n if @omdb_movie.save\n format.html { redirect_to @omdb_movie, notice: 'Omdb movie was successfully created.' }\n format.json { render action: 'show', status: :created, location: @omdb_movie }\n else\n format.html { render action: 'new' }\n format.json { render json: @omdb_movie.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @movie = Movie.new(movie_params)\n\n @movie.user_id = current_user.id # authenticated user\n\n respond_to do |format|\n if @movie.save\n format.html { redirect_to @movie, notice: 'Movie was successfully created.' }\n format.json { render :show, status: :created, location: @movie }\n else\n format.html { render :new }\n format.json { render json: @movie.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @type_movie = TypeMovie.new(type_movie_params)\n\n respond_to do |format|\n if @type_movie.save\n format.html { redirect_to @type_movie, notice: 'Type movie was successfully created.' }\n format.json { render :show, status: :created, location: @type_movie }\n else\n format.html { render :new }\n format.json { render json: @type_movie.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n\tdata = params[:movie]\n if(data.has_key?(\"genres\"))\n\t\tids = Genre.get_ids(data[:genres])\n\t\tdata.delete(\"genres\")\n\tend\n @movie = @catalogue.movies.build(data)\n unless ids == nil\n\t\[email protected]_ids = ids\n end\n\n respond_to do |format|\n if @movie.save\n format.html { redirect_to(@movie, :notice => 'Movie was successfully created.') }\n format.xml { render :xml => @movie, :status => :created, :location => @movie }\n format.json { render :json => {:success => true} }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @movie.errors, :status => :unprocessable_entity }\n format.json { render :json => {:success => false, :errors => @movie.errors} }\n end\n end\n end",
"def create\n @unseen_movie = UnseenMovie.new(params[:unseen_movie])\n\n respond_to do |format|\n if @unseen_movie.save\n format.html { redirect_to @unseen_movie, notice: 'Unseen movie was successfully created.' }\n format.json { render json: @unseen_movie, status: :created, location: @unseen_movie }\n else\n format.html { render action: \"new\" }\n format.json { render json: @unseen_movie.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @categories_movie = CategoriesMovie.new(categories_movie_params)\n\n respond_to do |format|\n if @categories_movie.save\n format.html { redirect_to @categories_movie, notice: 'Categories movie was successfully created.' }\n format.json { render :show, status: :created, location: @categories_movie }\n else\n format.html { render :new }\n format.json { render json: @categories_movie.errors, status: :unprocessable_entity }\n end\n end\n end",
"def movie_params\n params.require(:movie).permit(:api_id, :title, :vote_average, :release_date, :overview, :url, :poster_path)\n end",
"def create\n @movie = Movie.new(movie_params)\n @movie.address = @movie.city + \" \" + @movie.country\n @movie.thumnail_url = \"https://mood2travel.s3.amazonaws.com/thumnails/\" + @movie.videoId.to_s + \".png\"\n\n respond_to do |format|\n if @movie.save\n format.html { redirect_to @movie, notice: 'Movie was successfully created.' }\n format.json { render action: 'show', status: :created, location: @movie }\n else\n format.html { render action: 'new' }\n format.json { render json: @movie.errors, status: :unprocessable_entity }\n end\n end\n end",
"def api_movie_params\n params.require(:movie).permit(:title, :summary, :release_year, :stars, :rank, :genre, :director, :img_url, :file)\n end",
"def create\n @movies_ive_watched = MoviesIveWatched.new(movies_ive_watched_params)\n\n respond_to do |format|\n if @movies_ive_watched.save\n format.html { redirect_to @movies_ive_watched, notice: 'Movies ive watched was successfully created.' }\n format.json { render :show, status: :created, location: @movies_ive_watched }\n else\n format.html { render :new }\n format.json { render json: @movies_ive_watched.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @movie = Movie.new(params[:movie])\n\n respond_to do |format|\n if @movie.save\n format.html { redirect_to(@movie, :notice => 'Movie was successfully created.') }\n format.xml { render :xml => @movie, :status => :created, :location => @movie }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @movie.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @theatre_movie = TheatreMovie.new(theatre_movie_params)\n\n respond_to do |format|\n if @theatre_movie.save\n format.html { redirect_to @theatre_movie, notice: 'Theatre movie was successfully created.' }\n format.json { render :show, status: :created, location: @theatre_movie }\n else\n format.html { render :new }\n format.json { render json: @theatre_movie.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @movie_info = MovieInfo.new(params[:movie_info])\n \n respond_to do |format|\n if @movie_info.save\n format.html { redirect_to @movie_info, notice: 'Movie info was successfully created.' }\n format.json { render json: @movie_info, status: :created, location: @movie_info }\n else\n format.html { render action: \"new\" }\n format.json { render json: @movie_info.errors, status: :unprocessable_entity }\n end\n end\n end",
"def add_movie\n @movie = Tmdb::Movie.detail(params['id'])\n @movie_director = Tmdb::Movie.director(@movie.id)[0].name\n\n @new_movie = Movie.create(\n title: @movie.title,\n release_date: @movie.release_date,\n director: @movie_director,\n overview: @movie.overview,\n poster_url: \"https://image.tmdb.org/t/p/w640#{@movie.poster_path}\"\n )\n\n redirect_to movie_path(@new_movie), notice: \"#{@new_movie.title} was added.\"\n end",
"def create\n # check if we want to bypass the API\n if movie_params[:bypassapi] == \"Bypass API\"\n @movie_info = movie_params.delete_if{|k,v| k == \"bypassapi\"}\n\n else\n # use the API and get the movie title via form\n if movie_params[:title].present?\n @movie_title = movie_params[:title].gsub(\" \",\"-\")\n @content = open(\"http://www.omdbapi.com/?t=#{@movie_title}&y=&plot=short&r=json\").read\n @results = JSON.parse(@content, symbolize_names: true)\n\n else\n @imdbID = movie_params[:imdbID]\n @content = open(\"http://www.omdbapi.com/?i=#{@imdbID}&plot=short&r=json\").read\n @results = JSON.parse(@content, symbolize_names: true)\n end\n\n # check if API has an error. if so, use movie_params\n if @results[:Error] == \"Movie not found!\"\n redirect_to new_movie_path, :alert => \"Title not found in the API. If you still want to add it,\n select the 'bypass the API' option\" and return\n\n else\n # parse the date\n @parsed_date = Date.new(movie_params[\"date_watched(1i)\"].to_i,\n movie_params[\"date_watched(2i)\"].to_i, movie_params[\"date_watched(3i)\"].to_i) unless ! movie_params[\"date_watched(1i)\"].present?\n\n # create the hash for the movie params\n @movie_info = { title: @results[:Title],\n imdb_url: \"http://www.imdb.com/title/#{@results[:imdbID]}/\",\n watch_url: movie_params[:watch_url],\n date_watched: @parsed_date,\n location_watched: movie_params[:location_watched],\n category_id: movie_params[:category_id],\n watchlist_id: movie_params[:watchlist_id],\n our_rating: movie_params[:our_rating],\n preview_link: movie_params[:preview_link],\n been_watched: movie_params[:been_watched],\n notes: movie_params[:notes],\n #imdb_artwork: @results[:Poster].gsub(\"N/A\", \"\"),\n imdb_artwork: \"http://img.omdbapi.com/?i=#{@results[:imdbID]}&apikey=#{ENV['poster_api_key']}\".gsub('N/A', ''),\n imdb_plot_summary: @results[:Plot],\n imdb_rating: @results[:imdbRating],\n imdb_genre: @results[:Genre],\n runtime: @results[:Runtime],\n year_released: @results[:Year],\n imdb_actors: @results[:Actors]}\n end #end of if/else based on API error\n end #end of if/else on whether or not to bypass the API\n\n # assign hash to a new movie object\n @movie = Movie.new(@movie_info)\n\n # save new movie object to the database\n respond_to do |format|\n if @movie.save\n format.html { redirect_to movies_url, notice: 'Movie was successfully created.' }\n format.json { render :show, status: :created, location: @movie }\n else\n format.html { render :new }\n format.json { render json: @movie.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @theatre_movie = TheatreMovie.new(theatre_movie_params)\n\n respond_to do |format|\n if @theatre_movie.save\n format.html { redirect_to @theatre_movie, notice: 'Theatre movie was successfully created.' }\n format.json { render action: 'show', status: :created, location: @theatre_movie }\n else\n format.html { render action: 'new' }\n format.json { render json: @theatre_movie.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @movie = @category.movies.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @movie }\n end\n end",
"def create\n @event = Event.new(event_params)\n @event.user_id = current_user.id\n\n params[:movies].each do |item1|\n a = nil\n i = 0\n list = Movie.all\n while a == nil && i<(list).length-1\n if item1 == list[i].title\n a = list[i]\n end\n i = i + 1\n end\n\n if a == nil\n movie = Movie.create(title: item1)\n else\n movie = a\n end\n\n @event.movies.append(movie)\n end\n\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event }\n format.json { render :show, status: :created, location: @event }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def movie_data\n response = RestClient.get(\"critics.api.mks.io/movie-genres\")\n JSON.parse(response)\nend",
"def create\n @movie = @category.movies.new(params[:movie])\n\n respond_to do |format|\n if @movie.save\n flash[:notice] = 'Movie was successfully created.'\n format.html { redirect_to(category_movie_url(@category, @movie)) }#, notice: 'Movie was successfully created.' }\n format.json { render json: @movie, status: :created, location: @movie }\n else\n format.html { render action: \"new\" }\n format.json { render json: @movie.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @movie = Movie.new(movie_params)\n\n if @movie.save\n redirect_to movies_path, notice: \"#{@movie.title} was submitted successfully!\"\n else\n render :new\n end\n end",
"def create\n @cinemas_movie = CinemasMovie.new(params[:cinemas_movie])\n\n respond_to do |format|\n if @cinemas_movie.save\n format.html { redirect_to @cinemas_movie, :notice => 'Cinemas Movie was successfully created.' }\n format.json { render :json => @cinemas_movie, :status => :created, :location => @cinemas_movie }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @cinemas_movie.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def movie_params\n params.require(:movie).permit(:name, :release_date, :rating, :actor_ids => [])\n end",
"def movie_params\n params.require(:movie).permit(:title, :release_date, :plot, :cover, genre_ids: [], actor_ids: [], director_ids: [])\n end",
"def movie_params\n params.require(:movie).permit(:movie_id, :title, :poster_url)\n end",
"def create_movie(response)\n movie = Movie.new(title: response[\"title\"],\n release_date: response[\"release_date\"],\n description: response[\"overview\"],\n poster: response[\"poster_path\"])\n genres = response[\"genres\"]\n genres.each do |genre|\n movie_genre = Genre.find_or_create_by(genre: genre[\"name\"])\n movie.genres << movie_genre\n end\n movie.save!\n movie\n end",
"def movie_params\n params.require(:movie).permit(:name, :date, :director, :genre, :duration, :description, :poster)\n end",
"def control \n @movies = Movie.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @movies }\n end\n end",
"def movie_params\n params.require(:movie).permit(:name, :genre_id, :release_date, :minutes, :description, :actor_list)\n end",
"def get_all_actors_for_movie(movie)\n url = \"http://movies.api.mks.io/actors\"\n response = RestClient.get(url, accept: 'application/json')\n\nend",
"def create\n @genres_movie = GenresMovie.new(genres_movie_params)\n\n respond_to do |format|\n if @genres_movie.save\n format.html { redirect_to @genres_movie, notice: 'Genres movie was successfully created.' }\n format.json { render :show, status: :created, location: @genres_movie }\n else\n format.html { render :new }\n format.json { render json: @genres_movie.errors, status: :unprocessable_entity }\n end\n end\n end",
"def movie_params\n params.require(:movie).permit(:title, :rating, :description, :release_date)\n end",
"def movie_params\n params.require(:movie).permit(:title, :rating, :description, :release_date)\n end",
"def new\n @watched_movie = WatchedMovie.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @watched_movie }\n end\n end",
"def movie_params\n params.require(:movie).permit(:title, :rating, :director, :year, :duration, :synopsys, :url, :genre_id)\n end",
"def movie_params\n params.require(:movie).permit(:title, :year, :released, :url, :trailer, :runtime, :tagline, :certification, :imdb_id, :tmdb_id, :poster, :watchers)\n end",
"def movie_params\n params.require(:movie).permit(:title, :imdb_url, :watch_url, :date_watched, :location_watched,\n :category_id, :watchlist_id, :our_rating, :notes, :imdb_artwork, :imdb_plot_summary,\n :imdb_rating, :imdb_genre, :preview_link, :runtime, :been_watched, :year_released, :bypassapi, :imdbID, :imdb_actors)\n end",
"def create\n @bollywood_movie = BollywoodMovie.new(params[:bollywood_movie])\n\n respond_to do |format|\n if @bollywood_movie.save\n format.html { redirect_to @bollywood_movie, :notice => 'Bollywood movie was successfully created.' }\n format.json { render :json => @bollywood_movie, :status => :created, :location => @bollywood_movie }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @bollywood_movie.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def movie_params\n params.require(:movie).permit(:title, :genre, :list, :rating)\n end",
"def create\n @movie_model = MovieModel.new(movie_model_params)\n\n respond_to do |format|\n if @movie_model.save\n format.html { redirect_to @movie_model, notice: 'Movie model was successfully created.' }\n format.json { render action: 'show', status: :created, location: @movie_model }\n else\n format.html { render action: 'new' }\n format.json { render json: @movie_model.errors, status: :unprocessable_entity }\n end\n end\n end",
"def get_all_movies_for_actor(actor)\n url = \"http://movies.api.mks.io/movies\"\n response = RestClient.get(url, accept: 'application/json')\n\nend",
"def movie_params\n params.require(:movie).permit(:id, :imdb_id, :title, :overview, :poster_path, :runtime, :tagline, :tmdb_id, :homepage, :popularity, :vote_average, :adult)\n end",
"def create\r\n # session is a rails way of storing data temporarily in a cookie\r\n if session[:movies] == nil\r\n session[:movies] = []\r\n end\r\n\r\n session[:movies].push(params[:movie])\r\n puts \"session movie data\"\r\n puts session[:movies]\r\n\r\n redirect_to movie_path(session[:movies].length - 1) #pass the last movie we just added to the show page and redirect there\r\n # puts \"===================\"\r\n # puts params[:movie]\r\n # puts \"===================\"\r\n # @movies = []\r\n # @movies.push(params[:movie])\r\n end",
"def movie_params\n params.require(:movie).permit(:content, :imdb_id, :year, :filename, :imdb_rating, :name)\n end",
"def movie_params\n params.require(:movie).permit(:title, :desc, :image_url)\n end",
"def create\n respond_to do |format|\n if logged_in?\n @user = current_user\n @movie = Movie.find_or_create_by(id: params[:movie_id], title: params[:title])\n @rating = Rating.new(user_id: @user.id, movie_id: @movie.id, rating: params[:rating])\n\n if @rating.save\n format.json { render json: @rating }\n else\n format.json { render json: @rating.errors, status: :unprocessable_entity }\n end\n else \n format.json { head :no_content }\n end\n end\n end",
"def movie_params\n params.require(:movie).permit(:title, :poster, :rating, :overview)\n end",
"def create\n @movie_crew = MovieCrew.new(movie_crew_params)\n\n respond_to do |format|\n if @movie_crew.save\n format.html { redirect_to @movie_crew, notice: \"Movie crew was successfully created.\" }\n format.json { render :show, status: :created, location: @movie_crew }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @movie_crew.errors, status: :unprocessable_entity }\n end\n end\n end",
"def search_movie(title)\n headers = {\n accept: 'application/json',\n api_key: ENV['TMDB_API_KEY'],\n content_type: 'json',\n query: title,\n }\n\n response = RestClient.get \"https://api.themoviedb.org/3/search/movie/\", { params: headers }\n json_response = JSON.parse(response)\n\n return json_response\n end",
"def movie_params\n params.require(:movie).permit(:title, :synopsis, :release_date, :director)\n end",
"def movie_params\n params.require(:movie).permit(:title, :rating, :description, :release_date, :director)\n end",
"def movie_params\n params.require(:movie).permit(:title, :rating, :description, :release_date, :director)\n end"
] | [
"0.6940328",
"0.69084406",
"0.69084406",
"0.69084406",
"0.69084406",
"0.69084406",
"0.6874596",
"0.6850059",
"0.6839644",
"0.6839644",
"0.6839644",
"0.6839644",
"0.6839644",
"0.6839644",
"0.6839644",
"0.6839644",
"0.6839644",
"0.67754805",
"0.67748934",
"0.67748934",
"0.6767719",
"0.67088145",
"0.65911806",
"0.65911806",
"0.65888137",
"0.65296507",
"0.6470865",
"0.64298874",
"0.64173776",
"0.6409424",
"0.6391919",
"0.63849604",
"0.638236",
"0.63750464",
"0.635496",
"0.6352304",
"0.6350086",
"0.6345663",
"0.6345663",
"0.6345663",
"0.6345663",
"0.6345663",
"0.6345663",
"0.6345663",
"0.6345663",
"0.6345663",
"0.6343326",
"0.6320216",
"0.6314119",
"0.6307705",
"0.6290607",
"0.62857306",
"0.62850636",
"0.6275553",
"0.6261794",
"0.6256623",
"0.6243",
"0.6240867",
"0.6237185",
"0.6226416",
"0.6200084",
"0.61903363",
"0.6183991",
"0.6175112",
"0.6171925",
"0.61627704",
"0.6159633",
"0.6145779",
"0.6145685",
"0.6139205",
"0.6127544",
"0.6120742",
"0.6119434",
"0.6108917",
"0.6095895",
"0.60899204",
"0.6088451",
"0.60875505",
"0.608679",
"0.60802126",
"0.60802126",
"0.6071653",
"0.60614413",
"0.60544044",
"0.6050491",
"0.60441846",
"0.60386133",
"0.60378855",
"0.6035304",
"0.6034767",
"0.6022374",
"0.5999263",
"0.59963465",
"0.59956455",
"0.59903705",
"0.5985421",
"0.5981882",
"0.59789056",
"0.5967841",
"0.5967841"
] | 0.68476635 | 8 |
PATCH/PUT /movies/1 PATCH/PUT /movies/1.json | def update
respond_to do |format|
if @movie.update(movie_params)
format.html { redirect_to @movie, notice: 'Movie was successfully updated.' }
format.json { render :show, status: :ok, location: @movie }
else
format.html { render :edit }
format.json { render json: @movie.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @movie = Movie.find(params[:id])\n\n respond_to do |format|\n if @movie.update_attributes(params[:movie])\n format.html { redirect_to @movie, notice: 'Movie was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @movie.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @movie = Movie.find(params[:id])\n\n respond_to do |format|\n if @movie.update_attributes(params[:movie])\n format.html { redirect_to @movie, notice: 'Movie was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @movie.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @movie = Movie.find(params[:id])\n\n respond_to do |format|\n if @movie.update_attributes(params[:movie])\n format.html { redirect_to @movie, notice: 'Movie was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @movie.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @movie = Movie.find(params[:id])\n\n respond_to do |format|\n if @movie.update_attributes(params[:movie])\n format.html { redirect_to @movie, notice: 'Movie was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @movie.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @movie = Movie.find(params[:id])\n\n respond_to do |format|\n if @movie.update_attributes(params[:movie])\n format.html { redirect_to @movie, notice: 'Movie was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @movie.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @movie = Movie.find(params[:id])\n\n respond_to do |format|\n if @movie.update_attributes(params[:movie])\n format.html { redirect_to @movie, notice: 'Movie was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @movie.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @movie.update(movie_params)\n format.html { redirect_to @movie, notice: 'Movie was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @movie.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @movie.update(movie_params)\n format.html { redirect_to @movie, notice: 'Movie was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @movie.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @movie.update(movie_params)\n format.html { redirect_to @movie, notice: 'Movie was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @movie.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n #remove bypassapi from the params because it's not in the database\n newparams = movie_params.delete_if{|k,v| k == \"bypassapi\"}\n respond_to do |format|\n if @movie.update(newparams)\n format.html { redirect_to movies_url, notice: 'Movie was successfully updated.' }\n format.json { render :show, status: :ok, location: @movie }\n else\n format.html { render :edit }\n format.json { render json: @movie.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @movie.update(movie_params)\n format.html {redirect_to @movie, notice: 'Movie was successfully updated.'}\n format.json {render :show, status: :ok, location: @movie}\n else\n format.html {render :edit}\n format.json {render json: @movie.errors, status: :unprocessable_entity}\n end\n end\n end",
"def update\n @movie = Movie.find(params[:id])\n\n respond_to do |format|\n if @movie.update_attributes(movie_params)\n format.html { redirect_to @movie, notice: 'La pelicula ha sido actualizada correctamente.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @movie.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @movie.update(movie_params)\n format.json { render :show, status: :ok, location: @movie }\n else\n format.json do\n render json: @movie.errors, status: :unprocessable_entity\n end\n end\n end\n end",
"def update\n respond_to do |format|\n if @movie.update(movie_params_update)\n format.html { redirect_to user_list_movies_url, notice: 'Movie was successfully updated.' }\n format.json { render :show, status: :ok, location: @movie }\n else\n format.html { render :edit }\n format.json { render json: @movie.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @movie_model.update(movie_model_params)\n format.html { redirect_to @movie_model, notice: 'Movie model was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @movie_model.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n\n\n prepare_movie(false)\n\n respond_to do |format|\n if @movie.update(movie_params)\n format.html { redirect_to @movie, notice: 'Movie was successfully updated.' }\n format.json { render :show, status: :ok, location: @movie }\n else\n format.html { render :edit }\n format.json { render json: @movie.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n authorize! :update, @movie\n\n respond_to do |format|\n if @movie.update(movie_params)\n format.html { redirect_to @movie, notice: 'Movie was successfully updated.' }\n format.json { render :show, status: :ok, location: @movie }\n else\n format.html { render :edit }\n format.json { render json: @movie.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @movie = Movie.find(params[:id])\n if params[:movie][:actors]\n params[:movie][:actors].map!{ |id|\n Actor.find(id)\n }\n else\n params[:movie][:actors] = []\n end\n if params[:movie][:genres]\n params[:movie][:genres].map!{ |id|\n Genre.find(id)\n }\n else\n params[:movie][:genres] = []\n end\n if params[:movie][:directors]\n params[:movie][:directors].map!{ |id|\n Director.find(id)\n }\n else\n params[:movie][:directors] = []\n end\n\n respond_to do |format|\n if @movie.update_attributes(params[:movie])\n format.html { redirect_to @movie, notice: 'Movie was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @movie.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @omdb_movie.update(omdb_movie_params)\n format.html { redirect_to @omdb_movie, notice: 'Omdb movie was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @omdb_movie.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @movie.update(movie_params)\n format.html { redirect_to @movie, notice: '更新しました' }\n format.json { render :show, status: :ok, location: @movie }\n else\n format.html { render :edit }\n format.json { render json: @movie.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @movie = Movie.find(params[:id])\n\n respond_to do |format|\n if @movie.update_attributes(params[:movie])\n format.html { redirect_to(@movie, :notice => 'Movie was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @movie.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @movie = Movie.find(params[:id])\n\n respond_to do |format|\n if @movie.update_attributes(params[:movie])\n format.html { redirect_to(@movie, :notice => 'Movie was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @movie.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @movie = Movie.find(params[:id])\n\n respond_to do |format|\n if @movie.update_attributes(params[:movie])\n format.html { redirect_to(edit_movie_path(@movie), :notice => 'Movie was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @movie.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @user = current_user\n @review = Review.find(params[:id])\n @review.update_attributes(review_params)\n render json: @review, include: [:movie]\n end",
"def update\n @movie_info = MovieInfo.find(params[:id])\n \n respond_to do |format|\n if @movie_info.update_attributes(params[:movie_info])\n format.html { redirect_to @movie_info, notice: 'Movie info was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @movie_info.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @watched_movie = WatchedMovie.find(params[:id])\n\n respond_to do |format|\n if @watched_movie.update_attributes(params[:watched_movie])\n format.html { redirect_to @watched_movie, notice: 'Watched movie was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @watched_movie.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @movies_ive_watched.update(movies_ive_watched_params)\n format.html { redirect_to @movies_ive_watched, notice: 'Movies ive watched was successfully updated.' }\n format.json { render :show, status: :ok, location: @movies_ive_watched }\n else\n format.html { render :edit }\n format.json { render json: @movies_ive_watched.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 @movie = Movie.find(params[:id])\n\n respond_to do |format|\n if @movie.update(movie_params)\n format.html { redirect_to movie_url(@movie), notice: \"Movie was successfully updated.\" }\n else\n format.html { render :edit, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @theatre_movie.update(theatre_movie_params)\n format.html { redirect_to @theatre_movie, notice: 'Theatre movie was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @theatre_movie.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @movie_item = MovieItem.find(params[:id])\n\n respond_to do |format|\n if @movie_item.update_attributes(params[:movie_item])\n format.html { redirect_to @movie_item, notice: 'Movie item was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @movie_item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def put!\n request! :put\n end",
"def update\n respond_to do |format|\n if @movie.update(movie_params)\n format.html { redirect_to @movie, notice: \"Movie was successfully updated.\" }\n format.json { render :show, status: :ok, location: @movie }\n format.js\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @movie.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n add_director\n add_actors\n respond_to do |format|\n if @movie.update(movie_params)\n format.html { redirect_to @movie, notice: 'Movie was successfully updated.' }\n format.json { render :show, status: :ok, location: @movie }\n else\n format.html { render :edit }\n format.json { render json: @movie.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @moose = Moose.find(params[:id])\n\n respond_to do |format|\n if @moose.update_attributes(params[:moose])\n format.html { redirect_to @moose, notice: 'Moose was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @moose.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @movie = @catalogue.movies.find(params[:id])\n data = params[:movie]\n if(data.has_key?(\"genres\"))\n\t\tids = Genre.get_ids(data[:genres])\n\t\tdata.delete(\"genres\")\n\tend\n\[email protected]_dirty_associations do\n\t\tunless ids == nil\n\t\t\[email protected]_ids = ids\n\t end\n\n\t respond_to do |format|\n\t if @movie.update_attributes(data)\n\t format.html { redirect_to(@movie, :notice => 'Movie was successfully updated.') }\n\t format.xml { head :ok }\n\t format.json { render :json => {:success => true} }\n\t else\n\t format.html { render :action => \"edit\" }\n\t format.xml { render :xml => @movie.errors, :status => :unprocessable_entity }\n\t format.json { render :json => {:success => false, :errors => @movie.errors} }\n\t end\n\t end\n end\n end",
"def update\n respond_to do |format|\n if @actors_movie.update(actors_movie_params)\n format.html { redirect_to @actors_movie, notice: 'Actors movie was successfully updated.' }\n format.json { render :show, status: :ok, location: @actors_movie }\n else\n format.html { render :edit }\n format.json { render json: @actors_movie.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @movie = @category.movies.find(params[:id])\n\n respond_to do |format|\n if @movie.update_attributes(params[:movie])\n flash[:notice] = 'Movie was successfully updated.'\n format.html { redirect_to(category_movie_url(@category, @movie)) }#, notice: 'Movie was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @movie.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @bollywood_movie = BollywoodMovie.find(params[:id])\n\n respond_to do |format|\n if @bollywood_movie.update_attributes(params[:bollywood_movie])\n format.html { redirect_to @bollywood_movie, :notice => 'Bollywood movie was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @bollywood_movie.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @type_movie.update(type_movie_params)\n format.html { redirect_to @type_movie, notice: 'Type movie was successfully updated.' }\n format.json { render :show, status: :ok, location: @type_movie }\n else\n format.html { render :edit }\n format.json { render json: @type_movie.errors, status: :unprocessable_entity }\n end\n end\n end",
"def UpdateView params = {}\n \n APICall(path: 'views.json',method: 'PUT',payload: params.to_json)\n \n end",
"def update\n @video.update(video_params)\n render json: @video\n end",
"def update\n @role_in_a_movie = RoleInAMovie.find(params[:id])\n\n respond_to do |format|\n if @role_in_a_movie.update_attributes(params[:role_in_a_movie])\n format.html { redirect_to @role_in_a_movie, notice: 'Role in a movie was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @role_in_a_movie.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @movie_participant.update(movie_participant_params)\n format.html { redirect_to @movie_participant, notice: 'Movie participant was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @movie_participant.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @theatre_movie.update(theatre_movie_params)\n format.html { redirect_to @theatre_movie, notice: 'Theatre movie was successfully updated.' }\n format.json { render :show, status: :ok, location: @theatre_movie }\n else\n format.html { render :edit }\n format.json { render json: @theatre_movie.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n #@user = User.find(params[:id])\n \n if @film.update(film_params)\n render JSON: @film\n else\n render JSON: @film.errors, status: :unprocessable_entity\nend\nend",
"def update\n respond_to do |format|\n if @cinema_movie.update(cinema_movie_params)\n format.html { redirect_to @cinema_movie, notice: 'Cinema movie was successfully updated.' }\n format.json { render :show, status: :ok, location: @cinema_movie }\n else\n format.html { render :edit }\n format.json { render json: @cinema_movie.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @tmdbmovie.update(tmdbmovie_params)\n format.html { redirect_to @tmdbmovie, notice: 'Tmdbmovie was successfully updated.' }\n format.json { render :show, status: :ok, location: @tmdbmovie }\n else\n format.html { render :edit }\n format.json { render json: @tmdbmovie.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @film.update(film_params)\n format.html { redirect_to @film, notice: 'Film mis a jour.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @film.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @cinemas_movie = CinemasMovie.find(params[:id])\n\n respond_to do |format|\n if @cinemas_movie.update_attributes(params[:cinemas_movie])\n format.html { redirect_to @cinemas_movie, :notice => 'Cinemas Movie was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @cinemas_movie.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @movie = Movie.find(params[:id])\n\n respond_to do |format|\n @movie.reload\n if @movie.update_attributes(params[:movie])\n flash[:notice] = 'Movie was successfully updated.'\n format.html { render 'maintenance/index', :layout => 'maintenance' }\n format.js\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.js\n format.xml { render :xml => @movie.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @genres_movie.update(genres_movie_params)\n format.html { redirect_to @genres_movie, notice: 'Genres movie was successfully updated.' }\n format.json { render :show, status: :ok, location: @genres_movie }\n else\n format.html { render :edit }\n format.json { render json: @genres_movie.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update(url, data)\n RestClient.put url, data, :content_type => :json\nend",
"def update\n @review = Review.find(params[:id])\n @review.update(review_params)\n render json: @review\n end",
"def update\n respond_to do |format|\n if @movie_type.update(movie_type_params)\n format.html { redirect_to @movie_type, notice: 'Movie type was successfully updated.' }\n format.json { render :show, status: :ok, location: @movie_type }\n else\n format.html { render :edit }\n format.json { render json: @movie_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n actors = Actor.find movie_params[:actor_ids].reject! { |c| c.empty? }\n \n @movie.actors = actors\n photo = self.upload_album_photo\n @movie.photos << photo if photo\n\n data = movie_params\n data[:picture] = self.upload_photo\n\n\n if @movie.update(data)\n format.html { redirect_to @movie, notice: 'Movie was successfully updated.' }\n format.json { render :show, status: :ok, location: @movie }\n else\n format.html { render :edit }\n format.json { render json: @movie.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @todo = Todo.find(params[:id])\n @todo.update_attributes(params[:todo])\n render :json => @todo\n end",
"def rest_edit(path, options={}, &blk)\n callback = Proc.new { |*args|\n @object = yield(*args) or pass\n rest_params.each { |k, v| @object.send :\"#{k}=\", v unless k == 'id' }\n\n return 400, @object.errors.to_json unless @object.valid?\n\n @object.save\n rest_respond @object\n }\n\n # Make it work with `Backbone.emulateHTTP` on.\n put path, &callback\n post path, &callback\n end",
"def rest_edit(path, options={}, &blk)\n callback = Proc.new { |*args|\n @object = yield(*args) or pass\n rest_params.each { |k, v| @object.send :\"#{k}=\", v unless k == 'id' }\n\n return 400, @object.errors.to_json unless @object.valid?\n\n @object.save\n rest_respond @object\n }\n\n # Make it work with `Backbone.emulateHTTP` on.\n put path, &callback\n post path, &callback\n end",
"def update\n @movie = Movie.find params[:id]\n if @movie.update_attributes(movie_params)\n flash[:notice] = \"#{@movie.title} was successfully updated.\"\n redirect_to movie_path(@movie)\n else\n render 'edit'\n end\n end",
"def update\n @movie = Movie.find params[:id]\n if @movie.update_attributes(movie_params)\n flash[:notice] = \"#{@movie.title} was successfully updated.\"\n redirect_to movie_path(@movie)\n else\n render 'edit'\n end\n end",
"def update\n @todo = Todo.find(params[:id])\n if @todo.update_attributes(todo_params)\n render json: @todo, status: :ok\n else\n render json: @todo.errors, status: 422\n end\n end",
"def update options={}\n client.put(\"/#{id}\", options)\n end",
"def update\n animal = Animal.find(params[:id])\n\n if validate_params(animal_params)\n animal.update(animal_params)\n render json: animal, status: 200, location: [:api, animal]\n else\n render json: { errors: animal.errors }, status: 422\n end\n end",
"def update\n respond_to do |format|\n if @api_v1_todo.update(api_v1_todo_params)\n format.json { render json: @api_v1_todo, status: :ok }\n else\n format.json { render json: @api_v1_todo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @moviepost.update(moviepost_params)\n format.html { redirect_to @moviepost, notice: 'Moviepost was successfully updated.' }\n format.json { render :show, status: :ok, location: @moviepost }\n else\n format.html { render :edit }\n format.json { render json: @moviepost.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @moviie.update(moviie_params)\n format.html { redirect_to @moviie, notice: 'Moviie was successfully updated.' }\n format.json { render :show, status: :ok, location: @moviie }\n else\n format.html { render :edit }\n format.json { render json: @moviie.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n put :update\n end",
"def update\n respond_to do |format|\n if @categories_movie.update(categories_movie_params)\n format.html { redirect_to @categories_movie, notice: 'Categories movie was successfully updated.' }\n format.json { render :show, status: :ok, location: @categories_movie }\n else\n format.html { render :edit }\n format.json { render json: @categories_movie.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n dream = Dream.find params[:id]\n dream.update dream_params\n render json: {dream: dream}\n end",
"def update\n respond_to do |format|\n if @movie_crew.update(movie_crew_params)\n format.html { redirect_to @movie_crew, notice: \"Movie crew was successfully updated.\" }\n format.json { render :show, status: :ok, location: @movie_crew }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @movie_crew.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n movie = Movie.find(params[:movie_id])\n review = Review.find(params[:id])\n review.update(review_params)\n redirect_to '/movies/#{movies.id}/reviews/#{review.id}'\n end",
"def update\n @unseen_movie = UnseenMovie.find(params[:id])\n\n respond_to do |format|\n if @unseen_movie.update_attributes(params[:unseen_movie])\n format.html { redirect_to @unseen_movie, notice: 'Unseen movie was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @unseen_movie.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @film_actor.update(film_actor_params)\n format.html { redirect_to @film_actor, notice: 'Film actor was successfully updated.' }\n format.json { render :show, status: :ok, location: @film_actor }\n else\n format.html { render :edit }\n format.json { render json: @film_actor.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @movieupload.update(movieupload_params)\n format.html { redirect_to @movieupload, notice: 'Movieupload was successfully updated.' }\n format.json { render :show, status: :ok, location: @movieupload }\n else\n format.html { render :edit }\n format.json { render json: @movieupload.errors, status: :unprocessable_entity }\n end\n end\n end",
"def movie_params_update\n # params.fetch(:movie, {})\n params.require(:movie).permit(:title, :director, :synopsis, :year, :runtime, :rating)\n end",
"def update\n respond_to do |format|\n if @movie_event.update(movie_event_params)\n format.html { redirect_to @movie_event, notice: 'Movie event was successfully updated.' }\n format.json { render :show, status: :ok, location: @movie_event }\n else\n format.html { render :edit }\n format.json { render json: @movie_event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @film.update(film_params)\n format.html { redirect_to @film, notice: 'Filme atualizado com sucesso.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @film.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @movie_company.update(movie_company_params)\n format.html { redirect_to @movie_company, notice: 'Movie company was successfully updated.' }\n format.json { render :show, status: :ok, location: @movie_company }\n else\n format.html { render :edit }\n format.json { render json: @movie_company.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update # PATCH\n raise NotImplementedError\n end",
"def update\n\n if @movie.rating.nil?\n @movie.rating = 0\n end\n\n respond_to do |format|\n if @movie.update(movie_params)\n format.html { redirect_to @movie, notice: 'Movie was successfully updated.' }\n format.json { render :show, status: :ok, location: @movie }\n else\n #dev pro-tip: if update fails, it will rerender form but not call \n # edit controller method, so be sure to supply\n # any needed instance vars before re-rendering:\n @checkout_users = User.for_team(current_user.team_id)\n format.html { render :edit }\n format.json { render json: @movie.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @json.update(json_params)\n format.html { redirect_to @json, notice: 'Json was successfully updated.' }\n format.json { render :show, status: :ok, location: @json }\n else\n format.html { render :edit }\n format.json { render json: @json.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @json.update(json_params)\n format.html { redirect_to @json, notice: 'Json was successfully updated.' }\n format.json { render :show, status: :ok, location: @json }\n else\n format.html { render :edit }\n format.json { render json: @json.errors, status: :unprocessable_entity }\n end\n end\n end",
"def edit\n @movie = Movie.find params[:id]\n end"
] | [
"0.682313",
"0.682313",
"0.682313",
"0.682313",
"0.682313",
"0.682313",
"0.6808907",
"0.6808907",
"0.6808907",
"0.6738455",
"0.6642947",
"0.66350293",
"0.66241276",
"0.6600331",
"0.65768725",
"0.652991",
"0.6511667",
"0.64808124",
"0.64519566",
"0.6444685",
"0.64314324",
"0.64314324",
"0.6431189",
"0.64270073",
"0.642206",
"0.64117616",
"0.64054465",
"0.63948596",
"0.63424754",
"0.63289076",
"0.6300667",
"0.6266548",
"0.6235527",
"0.6227397",
"0.62140936",
"0.6213171",
"0.6207971",
"0.6187148",
"0.6183454",
"0.6164361",
"0.6149745",
"0.61419934",
"0.61396784",
"0.61392635",
"0.61385524",
"0.6125706",
"0.6103707",
"0.6089035",
"0.60688776",
"0.60646385",
"0.60642827",
"0.60630304",
"0.60160697",
"0.60046405",
"0.6002769",
"0.599903",
"0.59927684",
"0.59858453",
"0.59858453",
"0.5974339",
"0.5974339",
"0.595353",
"0.5944387",
"0.5941218",
"0.5941067",
"0.59378344",
"0.5931748",
"0.59277403",
"0.59268045",
"0.5924191",
"0.59205985",
"0.59132385",
"0.59091413",
"0.58969706",
"0.5852116",
"0.5843371",
"0.5842687",
"0.5811718",
"0.58092225",
"0.5805226",
"0.58000696",
"0.5772777",
"0.5772777",
"0.5766675"
] | 0.6672542 | 24 |
DELETE /movies/1 DELETE /movies/1.json | def destroy
@movie.destroy
respond_to do |format|
format.html { redirect_to movies_url, notice: 'Movie was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @movie = Movie.find(params[:id])\n @movie.destroy\n\n respond_to do |format|\n format.html { redirect_to movies_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @movie = Movie.find(params[:id])\n @movie.destroy\n\n respond_to do |format|\n format.html { redirect_to movies_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @movie = Movie.find(params[:id])\n @movie.destroy\n\n respond_to do |format|\n format.html { redirect_to movies_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @movie = Movie.find(params[:id])\n @movie.destroy\n\n respond_to do |format|\n format.html { redirect_to movies_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @movie = Movie.find(params[:id])\n @movie.destroy\n\n respond_to do |format|\n format.html { redirect_to movies_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @movie = Movie.find(params[:id])\n @movie.destroy\n\n respond_to do |format|\n format.html { redirect_to movies_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @movie = Movie.find(params[:id])\n @movie.destroy\n\n respond_to do |format|\n format.html { redirect_to movies_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @movie = Movie.find(params[:id])\n @movie.destroy\n\n respond_to do |format|\n format.html { redirect_to movies_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @movie = Movie.find(params[:id])\n @movie.destroy\n\n respond_to do |format|\n format.html { redirect_to movies_url}\n format.json { head :no_content }\n end\n end",
"def destroy\n @movie.destroy\n respond_to do |format|\n format.html { redirect_to movies_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @movie.destroy\n respond_to do |format|\n format.html { redirect_to movies_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @movie.destroy\n respond_to do |format|\n format.html { redirect_to movies_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @movie.destroy\n respond_to do |format|\n format.html { redirect_to movies_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @omdb_movie.destroy\n respond_to do |format|\n format.html { redirect_to omdb_movies_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n # Find the movie in the movies table using the id\n # passed in via the path.\n # @movie = Movie.find(params[:id])\n\n # Delete the row from the movies table.\n # using ActiveRecord#destroy method\n @movie.destroy\n\n\n respond_to do |format|\n # Show all the movies, index action\n format.html { redirect_to movies_url, notice: \"You deleted a Movie\"}\n format.json { head :no_content} # do nothing as a response.\n end\n end",
"def destroy\n @movie = Movie.find(params[:id])\n @movie.destroy\n\n respond_to do |format|\n format.html { redirect_to(movies_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @movie = Movie.find(params[:id])\n @movie.destroy\n\n respond_to do |format|\n format.html { redirect_to(movies_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @movie = Movie.find(params[:id])\n @movie.destroy\n\n respond_to do |format|\n format.html { redirect_to(movies_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @watched_movie = WatchedMovie.find(params[:id])\n @watched_movie.destroy\n\n respond_to do |format|\n format.html { redirect_to watched_movies_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @movie.destroy\n respond_to do |format|\n format.html { redirect_to movies_url, notice: '削除しました' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @movie.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"def destroy\n @movie.destroy\n respond_to do |format|\n format.html {redirect_to movies_url, notice: 'Movie was successfully destroyed.'}\n format.json {head :no_content}\n end\n end",
"def destroy\n @theatre_movie.destroy\n respond_to do |format|\n format.html { redirect_to theatre_movies_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @unseen_movie = UnseenMovie.find(params[:id])\n @unseen_movie.destroy\n\n respond_to do |format|\n format.html { redirect_to unseen_movies_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @movie = @category.movies.find(params[:id])\n @movie.destroy\n\n respond_to do |format|\n format.html { redirect_to(category_movies_url(@category)) }\n format.json { head :no_content }\n end\n end",
"def destroy\n @admin_movie = Movie.find(params[:id])\n @admin_movie.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_movies_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @movie.destroy\n respond_to do |format|\n format.html { redirect_to user_list_movies_path, notice: 'Movie was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @movie_model.destroy\n respond_to do |format|\n format.html { redirect_to movie_models_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @movies.each do |movie|\n #@movie = Movie.find(params[:id])\n movie.destroy\n end\n\n # respond_to do |format|\n \n # format.xml { head :ok }\n # end\n end",
"def destroy\n @movie_info = MovieInfo.find(params[:id])\n @movie_info.destroy\n \n respond_to do |format|\n format.html { redirect_to movie_infos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @movies_ive_watched.destroy\n respond_to do |format|\n format.html { redirect_to movies_ive_watcheds_url, notice: 'Movies ive watched was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @cinemas_movie = CinemasMovie.find(params[:id])\n @cinemas_movie.destroy\n\n respond_to do |format|\n format.html { redirect_to cinemas_movies_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @bollywood_movie = BollywoodMovie.find(params[:id])\n @bollywood_movie.destroy\n\n respond_to do |format|\n format.html { redirect_to bollywood_movies_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @tmdbmovie.destroy\n respond_to do |format|\n format.html { redirect_to tmdbmovies_url, notice: 'Tmdbmovie was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @type_movie.destroy\n respond_to do |format|\n format.html { redirect_to type_movies_url, notice: 'Type movie was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @movie = Movie.find(params[:id])\n @movie.destroy\n\n redirect_to root_path\n end",
"def destroy\n authorize! :destroy, @movie\n\n @movie.destroy\n respond_to do |format|\n format.html { redirect_to movies_url, notice: 'Movie was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete() #DELETE film1.delete (removes 1 film)\n sql = \"DELETE FROM films WHERE id = $1;\"\n values = [@id]\n SqlRunner.run(sql, values)\n end",
"def destroy\n @users_movie = UsersMovie.find(params[:id])\n @users_movie.destroy\n\n respond_to do |format|\n format.html { redirect_to(users_movies_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @film.destroy\n respond_to do |format|\n format.html { redirect_to films_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @film.destroy\n respond_to do |format|\n format.html { redirect_to films_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @role_in_a_movie = RoleInAMovie.find(params[:id])\n @role_in_a_movie.destroy\n\n respond_to do |format|\n format.html { redirect_to role_in_a_movies_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @user = current_user\n @FavoriteMovie = FavoriteMovie.find(params[:id]).delete\n render json: { msg: \"Delete Successful\" }\n end",
"def destroy\n @actors_movie.destroy\n respond_to do |format|\n format.html { redirect_to actors_movies_url, notice: 'Actors movie was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete\n client.delete(\"/#{id}\")\n end",
"def destroy\n @theatre_movie.destroy\n respond_to do |format|\n format.html { redirect_to theatre_movies_url, notice: 'Theatre movie was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @cinema_movie.destroy\n respond_to do |format|\n format.html { redirect_to cinema_movies_url, notice: 'Cinema movie was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n animal = Animal.find(params[:id])\n animal.destroy\n head 204\n end",
"def destroy\n @genres_movie.destroy\n respond_to do |format|\n format.html { redirect_to genres_movies_url, notice: 'Genres movie was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @moviie.destroy\n respond_to do |format|\n format.html { redirect_to moviies_url, notice: 'Moviie was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @movie = Movie.find params[:id]\n @movie.destroy\n flash[:notice] = \"Deleted '#{@movie.title}'.\"\n redirect_to movies_path\n end",
"def destroy\n @movie = Movie.find params[:id]\n @movie.destroy\n flash[:notice] = \"Deleted '#{@movie.title}'.\"\n redirect_to movies_path\n end",
"def delete path\n make_request(path, \"delete\", {})\n end",
"def destroy\n @movie_crew.destroy\n respond_to do |format|\n format.html { redirect_to movie_crews_url, notice: \"Movie crew was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def delete\n render json: Item.delete(params[\"id\"])\n end",
"def destroy\n @movie_type.destroy\n respond_to do |format|\n format.html { redirect_to movie_types_url, notice: 'Movie type was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n Movie.find(params[:id]).destroy \n flash[:success] = \"Movie was successfully deleted.\"\n redirect_to index_url\n end",
"def destroy\n @movie.destroy\n respond_to do |format|\n format.html { redirect_to movies_url, notice: \"Movie was successfully destroyed.\" }\n format.json { head :no_content }\n format.js\n end\n end",
"def destroy\n @categories_movie.destroy\n respond_to do |format|\n format.html { redirect_to categories_movies_url, notice: 'Categories movie was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @users_movie = UsersMovie.find(params[:id])\n @users_movie.destroy\n end",
"def destroy\n @movie = Movie.find(params[:id])\n @movie.destroy\n\n respond_to do |format|\n format.html { redirect_to movies_url }\n format.js\n end\n end",
"def destroy\n @movieupload.destroy\n respond_to do |format|\n format.html { redirect_to movieuploads_url, notice: 'Movieupload was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @movie_participant.destroy\n respond_to do |format|\n format.html { redirect_to movie_participants_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @retroaspecto = Retroaspecto.find(params[:id])\n @retroaspecto.destroy\n\n respond_to do |format|\n format.html { redirect_to retroaspectos_url }\n format.json { head :no_content }\n end\n end",
"def delete\n render json: Post.delete(params[\"id\"])\n end",
"def destroy\n @video.destroy\n render json: @video, :status => :ok\n end",
"def destroy\n @movie_show.destroy\n respond_to do |format|\n format.html { redirect_to movie_shows_url, notice: \"Movie show was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @moviepost.destroy\n respond_to do |format|\n format.html { redirect_to movieposts_url, notice: 'Moviepost was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @foo = Foo.find(params[:id])\n @foo.destroy\n\n respond_to do |format|\n format.html { redirect_to foos_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @adocao_animal = AdocaoAnimal.find(params[:id])\n @adocao_animal.destroy\n\n respond_to do |format|\n format.html { redirect_to adocao_animals_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @film_genre.destroy\n respond_to do |format|\n format.html { redirect_to film_genres_url, notice: 'Film genre was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete(path)\n request(:delete, path)\n end",
"def delete\n request(:delete)\n end",
"def destroy\n @microfilm_reel = MicrofilmReel.find(params[:id])\n @microfilm_reel.destroy\n\n respond_to do |format|\n format.html { redirect_to microfilm_reels_url }\n format.json { head :no_content }\n end\n end",
"def delete(path)\n RestClient.delete request_base+path\n end",
"def delete(path, params = {})\n post(path, params.merge(\"_method\" => \"delete\"))\n end",
"def delete_aos_version(args = {}) \n delete(\"/aosversions.json/#{args[:aosVersionId]}\", args)\nend",
"def destroy\n @remito = Remito.find(params[:id])\n @remito.destroy\n\n respond_to do |format|\n format.html { redirect_to remitos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @omdb_genre.destroy\n respond_to do |format|\n format.html { redirect_to omdb_genres_url }\n format.json { head :no_content }\n end\n end"
] | [
"0.75603294",
"0.7552992",
"0.7552992",
"0.7552992",
"0.7552992",
"0.7552992",
"0.7552992",
"0.7552992",
"0.7529331",
"0.7491699",
"0.7491699",
"0.7491699",
"0.7491699",
"0.7437082",
"0.731825",
"0.72664374",
"0.72664374",
"0.72664374",
"0.7200594",
"0.71660435",
"0.7161143",
"0.7152111",
"0.71434003",
"0.7139287",
"0.7137765",
"0.71156204",
"0.71123064",
"0.7086344",
"0.7082721",
"0.7071559",
"0.70696735",
"0.70407283",
"0.7020957",
"0.70199513",
"0.69926775",
"0.6979278",
"0.6974824",
"0.6940295",
"0.6936606",
"0.6899736",
"0.6899736",
"0.6892035",
"0.689038",
"0.6847417",
"0.684044",
"0.68397194",
"0.68347436",
"0.68342483",
"0.6800403",
"0.6791448",
"0.6786484",
"0.6786484",
"0.67787796",
"0.6772498",
"0.67692155",
"0.67420375",
"0.6730987",
"0.6730469",
"0.67295104",
"0.67288554",
"0.67196333",
"0.67140114",
"0.6684656",
"0.6681468",
"0.6680324",
"0.6651757",
"0.6651619",
"0.66442955",
"0.6639962",
"0.6623308",
"0.6621468",
"0.6618105",
"0.6603679",
"0.6602196",
"0.6585941",
"0.6584389",
"0.6584133",
"0.6583718",
"0.65760076"
] | 0.71991533 | 37 |
Use callbacks to share common setup or constraints between actions. | def set_movie
@movie = Movie.includes(:roles => :artist).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 movie_params
# binding.pry
params.require(:movie).permit(:title, :rating, :description, :image, :remote_image_url,
:new_role=>[:name,:artist_id], :deleted_roles=>[])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def allow_params_authentication!; end",
"def allowed_params\n ALLOWED_PARAMS\n end",
"def default_param_whitelist\n [\"mode\"]\n end",
"def param_whitelist\n [:role, :title]\n end",
"def expected_permitted_parameter_names; end",
"def safe_params\n params.except(:host, :port, :protocol).permit!\n end",
"def strong_params\n params.require(:team_member).permit(param_whitelist)\n end",
"def permitir_parametros\n \t\tparams.permit!\n \tend",
"def strong_params\n params.require(:community).permit(param_whitelist)\n end",
"def permitted_strong_parameters\n :all #or an array of parameters, example: [:name, :email]\n end",
"def strong_params\n params.require(:education).permit(param_whitelist)\n end",
"def restricted_params\n #params.require(self.controller_name.classify.underscore.to_sym).permit([])\n raise(\"No strong params set, override restricted_params method in your controller. E.g. params.require(:model).permit(:attribute1, :attribute2)\")\n end",
"def allowed_params\n params.require(:user).permit(:username, :email, :password, :password_confirmation)\n end",
"def param_whitelist\n [:rating, :review]\n end",
"def param_whitelist\n whitelist = [\n :username, :name,\n :parent_id,\n :headline, :description, :video,\n :policy, :signup_mode, :category,\n :website, :facebook, :twitter, :linkedin,\n :founded_at,\n privacy: [\n :events,\n :resources\n ],\n permission: [\n :profile,\n :members,\n :children,\n :statistics,\n :posts,\n :listings,\n :resources,\n :events\n ],\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:parent_id)\n unless current_user.role_in(@community) === 'owner'\n whitelist.delete(:privacy)\n whitelist.delete(:permission)\n end\n end\n \n whitelist\n end",
"def param_whitelist\n if @user.present? && current_user != @user\n return [:followed]\n end\n \n whitelist = [\n :username, :email, :password,\n :first_name, :last_name,\n :birthday, :gender,\n :headline, :biography, :ask_about, :focus,\n :website, :facebook, :linkedin, :twitter, :github,\n roles: [],\n skills: [],\n interests: [],\n privacy: { contact: [] },\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:email)\n whitelist.delete(:password)\n end\n \n whitelist\n end",
"def user_params \n \tparams.require(:user).permit(:name, :email, :password, :password_confirmation)# preventing CSTR\n end",
"def valid_params_request?; end",
"def user_params\n params.permit(:name, :phoneNumber, :address, :postalCode, :local, :link, :counter, :latitude, :longitude) \n end",
"def strong_params\n params.require(:experience).permit(param_whitelist)\n end",
"def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end",
"def whitelist_url_params\n params.require(:whitelist_url).permit(:domain)\n end",
"def allowed_params\n params.require(:allowed).permit(:email)\n end",
"def permitted_params\n []\n end",
"def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end",
"def safe_params\n params.permit(:id, :name, :origin, :emails => []); #emails is an array\n end",
"def query_param\n\t\tparams.permit(:first_name, :last_name, :phone)\n\tend",
"def strong_params\n params.require(:success_metric).permit(param_whitelist)\n end",
"def devise_filter\r\n logger.debug(\"In devise_filter =>PARAMS: #{params.inspect}\")\r\n\r\n # White list for sign_up\r\n devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(user_whitelist) }\r\n\r\n # White list for account update\r\n devise_parameter_sanitizer.for(:account_update) { |u| u.permit(user_whitelist, :current_password) }\r\n\r\n # White list for Invitation creation\r\n devise_parameter_sanitizer.for(:invite) { |u| u.permit(:account_type, :email, :invitation_token)}\r\n\r\n # White list for accept invitation\r\n devise_parameter_sanitizer.for(:accept_invitation) { |u| u.permit(user_whitelist, :invitation_token)}\r\n\r\n end",
"def whitelisted_user_params\n params.require(:user).\n permit( :first_name, :last_name, :email,:password,:password_confirmation,:birthday,:gender)\n end",
"def user_params\n ActionController::Parameters.permit_all_parameters = true\n params.require(:user) #.permit(:name, :surname, :phone, :password, :email, :time_zone)\n end",
"def safe_params\n params.require(:user).permit(:name)\n end",
"def strong_params\n params.require(:metric_change).permit(param_whitelist)\n end",
"def get_params\n\t\treturn ActionController::Parameters.new(self.attributes).permit(\"account_id\", \"title\", \"category\", \"introduction\", \"tags\", \"segment_type\", \"visible\", \"status\", \"main_image\")\n\tend",
"def grant_params\n @whitelisted = params.require(:grant).permit(:name, :description, :agency_id, :acronym)\n end",
"def check_params; true; end",
"def param_whitelist\n whitelist = [\n :description,\n :progress,\n :kpi_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:kpi_id)\n end\n \n whitelist\n end",
"def quote_params\n params.permit!\n end",
"def valid_params?; end",
"def paramunold_params\n params.require(:paramunold).permit!\n end",
"def user_params\n\t\tparams.permit(:nickname, :avatar, :description, :password, :gender, :birthday, :email, :phone, :qq_id, :wechat_id)\n\tend",
"def filtered_parameters; end",
"def user_params\n params.permit(\n \t:id,\n \t:email, \n \t:first_name, \n \t:last_name, \n \t:password, \n \t:confirm_token, \n \t:phone_number,\n \t:facebook_link,\n \t:car_model,\n \t:license_plate)\n end",
"def filtering_params\n params.permit(:email, :name)\n end",
"def check_params\n true\n end",
"def wx_public_params\n params.require(:wx_public).permit(:nickname, :manager, :alias)\n end",
"def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end",
"def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end",
"def listing_params\n\t\tparams.permit(:address, :transit_info, :rules, :other_info, :lat, :lng)\n\tend",
"def social_account_params\n\t\t\tparams.require(:social_account).permit!\n\t\tend",
"def safe_params\n resurce_name = self.class.resource_name\n params_method_name = \"#{resurce_name}_params\".to_sym\n if params[resurce_name]\n if respond_to?(params_method_name) || private_methods.include?(params_method_name)\n send(params_method_name)\n else\n raise ActiveModel::ForbiddenAttributesError, \"Please, define the '#{params_method_name}' method in #{self.class.name}\"\n end\n end\n end",
"def user_params\n params.require(:user).permit(:uri, :username, :password, :realname, :email, :publicvisible)\n end",
"def url_params\n params.require(:url).permit(:short_url, :original_url, :clicks, :ip_addresses)\n end",
"def model_params\n\t\tparams.require(:manager).permit(\n\t :user_name,\n :password,\n :email,\n \t\t\t)\n\tend",
"def article_params_whitelist\n params.require(:article).permit(:title, :description, category_ids: [])\n end",
"def college_whitelist_params\n params.require(:college_whitelist).permit(:status)\n end",
"def active_code_params\n params[:active_code].permit\n end",
"def filtering_params\n params.permit(:email)\n end",
"def ip_address_params\n\t\t\tparams.require(:ip_address).permit!\n end",
"def valid_params(params)\n params.permit(:user_id, :photo_id, :originX, :originY, :width, :height)\n end",
"def reserved_params\n params.require(:reserved).permit(:name, :email, :pax, :address, :KTP, :title)\n end",
"def pull_request_params\n whitelist = [\n :url,\n :id,\n :html_url,\n :diff_url,\n :patch_url,\n :issue_url,\n :number,\n :state,\n :locked,\n :title\n ]\n params.require(:pull_request).permit(whitelist)\n end",
"def post_params\n if current_user.admin? \n params.permit(:title, :body, :city, :country, :gps_location, :privacy, :visible, :latitude, :longitude, images: [], files: [])\n else \n params.permit(:title, :body, :city, :country, :gps_location, :privacy,:latitude, :longitude, images: [], files: [])\n end \n end",
"def list_params\n params.permit(:name)\n end",
"def filter_parameters; end",
"def filter_parameters; end",
"def vineyard_params\n params.permit(:vineyard_name, :email, :website_url, :phone, :address, :city, :region, :postcode, :country, :specialty, :description, :pet_friendly, :holiday, :tours, :events, :family_friendly, :cover_image, :image_one, :image_two, :image_three, :image_four, :user_id, :base64)\n end",
"def available_activity_params\n # params.require(:available_activity).permit(:type,:geometry,:properties)\n whitelisted = ActionController::Parameters.new({\n type: params.require(:available_activity)[:type],\n geometry: params.require(:available_activity)[:geometry].try(:permit!).to_h,\n properties: params.require(:available_activity)[:properties].try(:permit!).to_h\n }).try(:permit!)\n end",
"def user_params\n params.permit(:name, :username, :email, :password, :img_url, :bg_url, :coinbank)\n end",
"def user_params_pub\n\t \tparams[:user].permit(:hruid)\n\t end",
"def user_params\n params.permit(:id, :email, :password, :nickname, :status, :avatar, :flat_picture, :flatsharing_id, :member,\n :user, :color, :solde)\n end",
"def validate_search_inputs\n @whitelisted = params.fetch(:user, nil)\n if @whitelisted.blank?\n render_error(400, \"#{I18n.t('general_error.params_missing_key')}\": [I18n.t('general_error.params_missing_value', model: \"review\")])\n return\n else\n @whitelisted = @whitelisted.permit(:name, :uen, :description)\n end\n end",
"def url_whitelist; end",
"def param_whitelist\n [\n :title,\n :description,\n :organization,\n :team_id,\n :started_at,\n :finished_at,\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n end",
"def admin_social_network_params\n params.require(:social_network).permit!\n end",
"def filter_params\n params.require(:filters).permit(:letters)\n end",
"def valid_params(params)\n params.permit(:login, :first_name, :last_name, \n :password, :password_confirmation)\n end",
"def origin_params\n params.permit(:country, :state, :city, :postal_code, :address, :description)\n end",
"def permit_request_params\n params.permit(:address)\n end",
"def sensitive_params=(params)\n @sensitive_params = params\n end",
"def user_params\n # Ensure a user can't give themselves admin priveleges\n params.delete(:admin) if current_user.admin?\n params.require(:user).permit(:name, :email, :admin, :image)\n end",
"def secure_params\n params.require(:location).permit(:name)\n end",
"def strong_params\n params.require( :setting ).\n permit( :global_scan_limit, :per_user_scan_limit,\n :target_whitelist_patterns, :target_blacklist_patterns )\n end",
"def question_params\n params.require(:survey_question).permit(question_whitelist)\n end",
"def case_insensitive_params\n params.require(:case_insensitive).permit(:name)\n end",
"def empire_master_no_match_params\n params.require(:empire_master_no_match).permit(:uid, :last_name, :list, :search_date, :double, :source)\n end",
"def maintenance_request_params\n params[:maintenance_request].permit! #allow all parameters for now\n end",
"def unwanted_params\n params.require(:unwanted).permit(:title, :description, :image)\n end",
"def backend_user_params\n params.permit!\n end",
"def url_params\n params[:url].permit(:full)\n end",
"def filter_params\n\t\treturn params[:candidate].permit(:name_for_filter)\n\tend",
"def user_params\n params.permit(:name, :age, :username, :display_photo, :password)\n end",
"def speed_measurement_params\n\n #fuckit, to lazy to deal with permit crap right now\n ActionController::Parameters.permit_all_parameters = true\n\n params[:speed_measurement]\n end",
"def get_params\r\n #params.require(:article).permit(:title, :permalink, :content, :source_site, :introtext, :type_id, :order_by, :searchable, :created_by, :edited_by, :published_by, :published_on, :user_id)\r\n params.require(:article).permit!\r\n\r\n end",
"def pub_params\n params.require(:pub).permit(:name, :description, :phone, :email, :hidden, :city_id, :address)\n end",
"def pass_params\n params[:pass].permit(:name, :price, :description, :colour, :events)\n end",
"def droptraining_params\n params.permit(:training_id,:user_id, :utf8, :authenticity_token, :commit)\n end",
"def person_params\n # params whitelist does *not* include admin, sub, remember_token\n # TBD: share this whitelist with the list used by configuration_permitted_parameters\n # TBD: should current_password be on this list? -- for now, leaving off, since it seems to work without\n # NOTE: do not include 'admin' in this list!\n params.require(:person).permit(\n :name, \n :email, \n :description,\n :password, \n :password_confirmation\n )\n end",
"def parameter_params\n params.require(:parameter).permit(:name, :description, :param_code, :param_value, :active_from, :active_to)\n end"
] | [
"0.6981273",
"0.6783789",
"0.67460483",
"0.6742222",
"0.67354137",
"0.65934366",
"0.65028495",
"0.6497783",
"0.64826745",
"0.6479415",
"0.6456823",
"0.6440081",
"0.63800216",
"0.6376521",
"0.636652",
"0.6319898",
"0.6300256",
"0.62994003",
"0.6293621",
"0.6292629",
"0.6291586",
"0.629103",
"0.6282451",
"0.6243152",
"0.62413",
"0.6219024",
"0.6213724",
"0.62103724",
"0.61945",
"0.61786324",
"0.61755824",
"0.6173267",
"0.6163613",
"0.6153058",
"0.61521065",
"0.6147508",
"0.61234015",
"0.61168665",
"0.6107466",
"0.6106177",
"0.6091159",
"0.60817343",
"0.6071238",
"0.6062299",
"0.6021663",
"0.60182893",
"0.6014239",
"0.6011563",
"0.60080767",
"0.60080767",
"0.60028875",
"0.60005623",
"0.59964156",
"0.5993086",
"0.5992319",
"0.5992299",
"0.59801805",
"0.59676576",
"0.59606016",
"0.595966",
"0.59591126",
"0.59589803",
"0.5954058",
"0.5953234",
"0.5944434",
"0.5940526",
"0.59376484",
"0.59376484",
"0.5935253",
"0.5930846",
"0.5926387",
"0.59256274",
"0.5917907",
"0.5910841",
"0.590886",
"0.59086543",
"0.59060425",
"0.58981544",
"0.5898102",
"0.5896809",
"0.5895416",
"0.58947027",
"0.58923644",
"0.5887903",
"0.58830196",
"0.5880581",
"0.5873854",
"0.58697754",
"0.5869004",
"0.58669055",
"0.5866886",
"0.58664906",
"0.5864619",
"0.58630043",
"0.5862495",
"0.5861368",
"0.5859712",
"0.5855544",
"0.58551925",
"0.5851284",
"0.5850602"
] | 0.0 | -1 |
Returns true if the user has not liked/disliked this userpost. TODO refactor to use userpost likes so it can be eager loaded | def has_liked_userpost(feed_item)
@like = Like.where(user_id: current_user.id, userpost_id: feed_item.id).first
[email protected]?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def liked?(user_id)\n !StoryLike.where(story_id: self.id, user_id: user_id).empty?\n end",
"def liked_by_user?\n\t\tLike.where(user_id: current_user.id, post_id:\n\t \tparams[:post_id]).exists?\n\tend",
"def liked_by? user\n not likes.reject { |like| like.created_by != user }.blank?\n end",
"def already_liked?\n Like.where(user_id: current_user.id, post_id: params[:post_id]).exists?\n end",
"def is_liked user\n \tLike.find_by(user_id: user_id, post_id: id)\n end",
"def liked?(post_id)\n Like.where(post_id: post_id, user_id: self.id).exists?\n end",
"def user_can_like(user_id)\n\t\t# self makes an object of Post class and tells if a user with user_id: as passed in the function, has a like on this post(like.length == 1)\n\t\tif self.likes.where(user_id: user_id).length == 1\n\t\t\treturn false\n\t\tend\n\n\t\treturn true\n\tend",
"def liked?(post)\n logged_in? &&\n current_user.likes.where(post_id: post.id).any?\n end",
"def liked_by?(user)\n likes.find_by_user_id(user.id).present?\n end",
"def likes?(user)\n if likes.where(user_id: user.id).any?\n return true\n else\n return false\n end\n end",
"def liked?\n liked_ids = h.current_user.liked_replies.pluck(:id)\n liked_ids.include?(self.id)\n end",
"def already_liked_by?(current_user)\n return false unless current_user\n self.likes.where(:user_id => current_user.id).count > 0\n end",
"def rated?\n liked_by_count > 0 || disliked_by_count > 0\n end",
"def liked_by?(user)\n likes_by_user(user).any?\n end",
"def liked_post?(post)\n liked_posts.include? post\n end",
"def rated_anything?\n likes.count > 0 || dislikes.count > 0\n end",
"def hasLiked\n return @hasLiked.present? ? @hasLiked : false\n end",
"def post_liked?(post)\n find_like(post).any?\n end",
"def liked_by?(user)\n likers.exists?(user.id)\n end",
"def dislikes?(object)\n dislikes.exists?(:dislikeable_id => object.id, :dislikeable_type => object.class.to_s)\n end",
"def liked?(user_id)\n Like.where(user_id: user_id, dog_id: self.id).exists?\n end",
"def voted_on?(user)\n return !self.ratings.find_by_user_id(user.id).nil?\n end",
"def likable?\n if current_user\n !dog_has_owner? || dog_owner.id != current_user.id ? true : false\n else\n false\n end\n end",
"def user_likes_list?\n Like.exists?(:user_id => current_user, :list_id => @list)\n end",
"def like?(post)\n liked_posts.include?(post)\n end",
"def like?(post)\n self.likes.where(post_id: post.id.to_s)\n end",
"def likes?(tweet)\n \ttweet.likes.where(user_id: id).any?\n end",
"def user_is_not_owner\n unless @likeable_obj.present? && @likeable_obj.user_id != current_user.id\n redirect_to @likeable_obj, notice: \"You cannot like your own dog... How sad...\"\n end\n end",
"def unlike(obj)\n return unless likes?(obj)\n\n run_hook(:before_unlike, obj)\n Recommendable.redis.srem(Recommendable::Helpers::RedisKeyMapper.liked_set_for(obj.class, id), obj.id)\n Recommendable.redis.srem(Recommendable::Helpers::RedisKeyMapper.liked_by_set_for(obj.class, obj.id), id)\n run_hook(:after_unlike, obj)\n\n true\n end",
"def has_downvoted_for(user_id, post_id)\n\t\trelationship = Vote.find_by(user_id: user_id, post_id: post_id, vote_type: \"downvote\")\n \treturn true if relationship\n\tend",
"def goodcomments\n User.isliked(self)\n end",
"def already_liked?\n Vote.where(author_id: current_user.id, comment_id:\n params[:comment_id]).exists?\n end",
"def hasNotReviewed(id)\n email_address = current_user.email\n reviews = Review.where(user_email: email_address)\n\n if logged_in?\n reviews.each do |rv|\n if rv.user_id == id\n return false\n end\n end\n else\n return false\n end\n return true\n end",
"def can_bill? usr\n !posts.detect { |post| post.can_bill? usr }.nil?\n end",
"def i_dont_own?(object)\n if(current_user.present? and object.user.present? and object.user.id.present? and (current_user.id == object.user.id))\n false\n else\n true\n end\n end",
"def upvoted?(post)\n voted_up_on? post\n end",
"def user_voted?(user)\n !!users_vote(user)\n end",
"def blocked?\n !actor.likes?(activity_object)\n end",
"def blocked?\n actor.likes?(activity_object)\n end",
"def already_voted_by_user?(the_user)\n post_vote_array(the_user).present?\n end",
"def has_favourited_post?(post_id)\n Favourite.where(:post_id => post_id, :user_id => self.id).any?\n end",
"def liked?(likeable)\n if likeable.likes.loaded?\n if self.like_for(likeable)\n return true\n else\n return false\n end\n else\n Like.exists?(user_id: self.id, likeable_type: likeable.class.base_class.to_s, likeable_id: likeable.id)\n end\n end",
"def any_unread? usr\n @conv.posts.each do |post| \n if post.unread?(usr) && post.recipient_id == usr.id\n return true\n end\n end\n return false\n end",
"def already_liked?\n Like.where(user_id: current_user.id, gosssip_id: params[:gosssip_id]).exists?\n end",
"def unlike(model)\n if self.id != model.id && self.likes?(model)\n\n # this is necessary to handle mongodb caching on collection if unlike is following a like\n model.reload\n self.reload\n\n model.before_unliked_by(self) if model.respond_to?('before_unliked_by')\n model.likers_assoc.where(:like_type => self.class.name, :like_id => self.id).destroy\n model.inc(:liked_count_field, -1)\n model.after_unliked_by(self) if model.respond_to?('after_unliked_by')\n\n self.before_unlike(model) if self.respond_to?('before_unlike')\n self.likes_assoc.where(:like_type => model.class.name, :like_id => model.id).destroy\n self.inc(:likes_count_field, -1)\n self.after_unlike(model) if self.respond_to?('after_unlike')\n\n return true\n else\n return false\n end\n end",
"def liked?(obj)\n Recommendations.redis.sismember(Recommendations::Helpers::RedisKeyMapper.liked_set_for(obj.class, id), obj.id)\n end",
"def user_has_content(user)\n return (user.posts.count > 0 || user.comments.count > 0)\nend",
"def is_liked(comment)\n if Like.where(:likeable => comment ,:user_id => self.id).present?\n Like.where(:likeable => comment ,:user_id => self.id).last.like==true\n end\n end",
"def create\n @post =Post.find(params[:post_id])\n @liked_post = @post.liked_posts.build(liked_post_params)\n @liked_post.user_id = current_user.id\n if LikedPost.where(user_id:@liked_post.user_id,post_id:@liked_post.post_id,positive:true).count>0\n respond_to do |format|\n LikedPost.where(user_id:@liked_post.user_id,post_id:@liked_post.post_id,positive:true).take.destroy\n if @liked_post.positive==true\n format.html { redirect_to post_path(@post), notice: 'now you dont like it!' }\n else\n if @liked_post.save\n format.html { redirect_to post_path(@post), notice: 'You disliked this post!' }\n format.json { render :show, status: :created, location: post_path(@post) }\n end\n end\n end\n elsif LikedPost.where(user_id:@liked_post.user_id,post_id:@liked_post.post_id,positive:false).count>0\n respond_to do |format|\n LikedPost.where(user_id:@liked_post.user_id,post_id:@liked_post.post_id,positive:false).take.destroy\n if @liked_post.positive==false\n format.html { redirect_to post_path(@post), notice: 'now you dont dislike this post!' }\n else\n if @liked_post.save\n format.html { redirect_to post_path(@post), notice: 'now you like this post!' }\n format.json { render :show, status: :created, location: post_path(@post) }\n end\n end\n end\n else\n respond_to do |format|\n if @liked_post.positive==false\n if @liked_post.save\n format.html { redirect_to post_path(@post), notice: 'you dont like this post!' }\n format.json { render :show, status: :created, location: post_path(@post) }\n end\n else\n if @liked_post.save\n format.html { redirect_to post_path(@post), notice: 'you like this post!' }\n format.json { render :show, status: :created, location: post_path(@post) }\n end\n end\n end\n end\n end",
"def is_my_post?(userid)\n #if someone is logged in\n if @current_user\n #if the user id of the post is the user id of the person logged in => it is my post\n if @current_user.id == userid\n return true\n # it isn't my post\n else\n return false\n end\n #It isn't my post because I'm not logged in\n else\n return false\n end\n end",
"def voted_by?(user)\n !!vote_ups.find_by_user_id(user.id) if user\n end",
"def liked_by_user?(id)\n query = self.likes.where(user_id: id).first\n return false unless query.present?\n query.id\n end",
"def like\n post_id = params[:id]\n @post = Post.where(:id => post_id).first\n if current_user && @post\n if @post.is_like?(current_user.id)\n @post.unlike(current_user.id)\n render :text => \"<span class='badge badge-success'> #{@post.get_likes_count}</span> Like\" \n else\n @post.like(current_user.id)\n render :text => \"<span class='badge badge-success'> #{@post.get_likes_count}</span> UnLike\" \n end\n return\n end\n render :text => 'fail' and return\n end",
"def dislike\n @post = Post.find(params[:post_id])\n @comment = @post.comments.find(params[:id])\n\n\n if current_user.already_likes?(@comment,'Comment')\n like = current_user.likes.where(likeble_id: @comment.id ,\n user_id: current_user.id,likeble_type: 'Comment').first\n like.like_status = false\n like.save\n redirect_to new_post_comment_path(@post)\n else\n if current_user.already_dislikes?(@comment ,'Comment')\n redirect_to new_post_comment_path(@post)\n else\n like = @comment.likes.create()\n like.user_id = current_user.id\n like.like_status = false\n like.save\n redirect_to new_post_comment_path(@post) \n end\n end\n end",
"def completed?\n user.likes_count >= self.class.config.likes_needed_for_completion\n end",
"def deletable?\n votes.each do |v|\n return false if (v.user_id != user_id) && v.value.positive? && v.favorite\n end\n true\n end",
"def has_upvote_from(user)\n votes.find_by(user_id: user.id).present?\n end",
"def canManagePost(user)\n\t \t\t\t\n\t \t\t\tif user.nil? \n\t \t\t\t\treturn false\n\t \t\t\tend\n\n\t \t\t\tif user.has_role?(:admin)\n\t \t\t\t\treturn true\n\t \t\t\telse\n\t \t\t\t\treturn false\n\t \t\t\tend\n\t \t\tend",
"def bookmarked?(user_id)\n !Bookmark.where(story_id: self.id, user_id: user_id).empty?\n end",
"def dislike\n @comment.disliked_by current_user\n end",
"def liked_post(post)\n if current_user.voted_for? post\n return link_to '', unlike_post_path(post), remote: true, id: \"like_#{post.id}\", \n class: \"glyphicon glyphicon-heart liked_post_heart\"\n else\n link_to '', like_post_path(post), remote: true, id: \"like_#{post.id}\", \n class: \"glyphicon glyphicon-heart-empty\" \n end\n end",
"def likes?(obj)\n Recommendable.redis.sismember(Recommendable::Helpers::RedisKeyMapper.liked_set_for(obj.class, id), obj.id)\n end",
"def dislike?\n response[\"dislike\"]\n end",
"def rated_by?(user)\n rating && rating.user_ratings.exists?(:user_id => user)\n end",
"def like_status(user)\n if !liking?(user)\n return \"like\"\n else\n return \"unlike\"\n end\n end",
"def show\n @user = User.where(id: @post.user_id)[0]\n @likes = UserLike.where(post_id: @post.id)\n end",
"def is_bookmarked user\n Bookmark.find_by(user_id: user_id, post_id: id)\n end",
"def sender_can_bill?\n !posts.detect { |post| post.can_bill? user }.nil?\n end",
"def user_has_voted(post)\n if (current_user)\n if (post.voted_by?(current_user))\n 1\n else\n 0\n end\n else\n 2\n end\nend",
"def retweeted?\n retweeted_ids = h.current_user.retweeted_replies.pluck(:id)\n retweeted_ids.include?(self.id)\n end",
"def like_status(post_id)\n post = Post.where(:id => post_id).first\n count = \"<span class='badge badge-success'> #{post.get_likes_count}  </span>\".html_safe\n post.is_like?(current_user.id) ? count+\" UnLike\" : count+\" Like\" if current_user.present?\n end",
"def is_fav?(user)\n user.favs.find_by(post_id: self.id)\n end",
"def liked_comment?(comment)\n liked_comments.include? comment\n end",
"def unliked_by(user)\n self.send(self.class.like_label.tableize.to_sym).find_by_user_id(user.id).destroy rescue false\n end",
"def hasReviewed(u, e)\n return Event.find_by(id: e).reviews.find_by(user_id: u) != nil\n end",
"def upped_by_user?(user)\n up = self.comment_up_downs.find_by_user_id_and_action(user.id,1) # get the up that a user gave to this comment before \"if exists\"\n !up.nil? # if up is nil then return false if not then return true\n end",
"def following?(user)\n !can_follow?(user)\n end",
"def show\n @favorite_exists = Favorite.where(post: @post, user: current_user) == [] ? false : true\n\n end",
"def preview_only?(user)\n !listed && !author?(user)\n end",
"def like\n @topic = Topic.find(params[:topic_id])\n @post = @topic.posts.find(params[:id])\n if @post.not_liked_already?(current_user)\n @post.likes.create(user: current_user)\n redirect_to [@post.topic, @post]\n else\n @post.likes.where(user: current_user).destroy_all\n redirect_to [@post.topic, @post]\n end\n end",
"def has_rated? post\n # post.pos_voter_ids.include?(self.id)||post.neg_voter_ids.include?(self.id)\n ratings.where(:post_id => post.id.to_s).select('score').first.try(:score)\n end",
"def inactive_reviewers?\n self.inactive_reviewers unless @results_with_inactive_users\n @results_with_inactive_users.size > 0\n end",
"def replied_conv? usr\n if @conv.posts.count > 1 && @conv.posts.last.user_id != usr.id\n @conv.posts.each do |post|\n return true if post.user_id == usr.id\n end\n end\n false\n end",
"def user_has_not_verified_other_discord_users?(user, discord_user)\n user.discord_user.nil? || !user.discord_user.verified? || user.discord_user == discord_user\n end",
"def like(params,userid)\r\n db = connect_non_hash()\r\n likedposts=db.execute(\"SELECT likes.postid FROM likes WHERE userid=(?)\", userid)\r\n likedposts = likedposts.flatten\r\n if likedposts.include? params[\"postid\"].to_i\r\n redirect('/cantliketwice')\r\n else\r\n db.execute(\"INSERT INTO likes(userid, postid) VALUES (?, ?)\", userid, params[\"postid\"])\r\n redirect('/posts')\r\n end\r\n end",
"def has_user?\n !user.nil?\n end",
"def like\n @micropost = Micropost.find(params[:postid])\n if current_user.nil?\n render text: \"no_login\"\n else\n @micropost.like(current_user.id,@micropost.user.id)\n render text: \"liked\"\n end\n \n end",
"def already_commented_by_user?(the_user)\n !self.comments.where([\"user_id = ?\", the_user.id]).empty?\n end",
"def liked?(snapspot)\n self.likes.find_by(snapspot_id: snapspot.id) ? true : false\n end",
"def ever_reviewed_by?(user_id)\n\t\tself.reviews.any?{|review| review.user_id == user_id}\n\tend",
"def set_user_post_like\n @user_post_like = UserPostLike.find(params[:id])\n end",
"def like\n @post = Post.find(params[:post_id])\n @comment = @post.comments.find(params[:id])\n\n if current_user.already_dislikes?(@comment,'Comment')\n like = current_user.likes.where(likeble_id: @comment.id ,\n user_id: current_user.id ,likeble_type: 'Comment').first\n like.like_status = true\n like.save\n redirect_to new_post_comment_path(@post)\n else\n if current_user.already_likes?(@comment ,'Comment')\n redirect_to new_post_comment_path(@post)\n else\n like = @comment.likes.create()\n like.user_id = current_user.id\n like.like_status = true\n like.save\n redirect_to new_post_comment_path(@post) \n end\n end\n end",
"def user_defined?\n [email protected]? || !@user['userId'].nil?\n end",
"def has_pet?\n current_user_pet && current_user_pet != nil\n end",
"def following?(post)\n posts.include?(post)\n end",
"def index\n @user_post_likes = UserPostLike.all\n end",
"def delete_likes\n # Delete user's own likes.\n Like.where(user_id: user.id).delete_all\n # Delete likes on user's posts.\n Like.where('post_id IN (SELECT id FROM posts WHERE user_id = ?)', user.id).delete_all\n end",
"def liked_by\n\t\tcomment = Comment.includes(:liked_by).find_by(id: params[:id])\n\t\t@users = comment.has_been_liked_by\t\t\t\t\t\t\t\t\t\n\tend",
"def can_request?(post)\n post[:post_id] != posts\n end",
"def viewable?(user)\n !deleted && !hidden?\n end"
] | [
"0.7740143",
"0.76276106",
"0.74901193",
"0.74237555",
"0.73891246",
"0.73232496",
"0.72884035",
"0.72400546",
"0.6986224",
"0.69815326",
"0.6885913",
"0.68716097",
"0.6849016",
"0.68221384",
"0.68069357",
"0.6805849",
"0.6777121",
"0.6776313",
"0.672645",
"0.67037654",
"0.670004",
"0.6682486",
"0.6679406",
"0.66114396",
"0.659088",
"0.65267813",
"0.6521473",
"0.64951104",
"0.648728",
"0.6428533",
"0.64154965",
"0.6398375",
"0.6372845",
"0.6354251",
"0.6330607",
"0.6309782",
"0.6307178",
"0.62744313",
"0.6204161",
"0.6202853",
"0.6194963",
"0.6149372",
"0.6143881",
"0.6091709",
"0.60750467",
"0.60709625",
"0.60553664",
"0.6044417",
"0.6038624",
"0.602252",
"0.60194874",
"0.6006846",
"0.5995658",
"0.59895396",
"0.5988852",
"0.59832907",
"0.59670305",
"0.5940392",
"0.5938028",
"0.59257823",
"0.5924702",
"0.5923679",
"0.59151256",
"0.59128153",
"0.59053916",
"0.5904136",
"0.5899108",
"0.58897114",
"0.5888012",
"0.5877429",
"0.5874575",
"0.5872859",
"0.58573055",
"0.58430886",
"0.58382446",
"0.5830637",
"0.58186054",
"0.58164585",
"0.5812579",
"0.579649",
"0.57964605",
"0.5790936",
"0.5780357",
"0.57768655",
"0.5769122",
"0.57635903",
"0.57563144",
"0.57437325",
"0.5738586",
"0.57334924",
"0.5730273",
"0.57294226",
"0.5723947",
"0.5722721",
"0.5719657",
"0.57133514",
"0.5710605",
"0.57072544",
"0.56967694",
"0.56964093"
] | 0.7471337 | 3 |
load_and_authorize_resource before_filter :load_permissions GET /service_fee_masters GET /service_fee_masters.json | def index
@ref_id = params[:ref_id]
if @ref_id.present?
@service_fee_masters = ServiceFeeMaster.where(appt_type_id: @ref_id).paginate(:page => params[:page], :per_page => 8).order('created_at desc')
else
@service_fee_masters = ServiceFeeMaster.all.paginate(:page => params[:page], :per_page => 8).order('created_at desc')
end
respond_to do |format|
format.html
format.csv { send_data @service_fee_masters.to_csv }
format.xls { send_data @service_fee_masters.to_csv(options={col_sep: "\t"}) }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load_permissions\n authorize! :manage, :all\n end",
"def show\n #@admission_category = AdmissionCategory.find(params[:id])\n #load_and_authorize_resource will load the object\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @admission_category }\n end\n end",
"def show\n authorize @staff_request\n end",
"def show\n authorize @service_template\n end",
"def load_permissions \n @current_permissions = current_user.role.permissions.collect{|i| [i.subject_class, i.action]} \n end",
"def check_permissions\n authorize! :create, CargoManifest\n end",
"def authorize_resource(*args); end",
"def show\n #@cost_setup = CostSetup.find(params[:id])\n authorize User\n end",
"def service_object\n Roles::PermissionsActionDispatcher.new(consul_scope)\n end",
"def show\n @permission_resource = PermissionResource.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @permission_resource }\n end\n end",
"def load_permissions\n @current_permissions = current_user.role.permissions.collect{|i| [i.subject_class, i.action]}\n end",
"def load_permissions\n \n @current_permissions = current_user.role.permissions.collect{|i| [i.subject_class, i.action]}\n end",
"def resource\n set_cors_headers\n render :text => \"OK here is your restricted resource!\"\n end",
"def show\n authorize RoleCutoff\n end",
"def check_permissions\n authorize! :create, RoutingSheet\n end",
"def show\n authorize @career\n end",
"def check_permissions\n authorize! :create, Employee\n end",
"def get_permissions\n \t@permissions = Permission.where(\"resource_id = #{params[:resource_id]} AND resource_type = '#{params[:resource_type]}' AND status = 1\") \t\n \trespond_to do |format| \t\n format.js\n end\n end",
"def show\n authorize :resquest_type, :show?\n end",
"def show\n authorize @labor_request\n end",
"def authorize\n end",
"def authorize\n end",
"def index\n @activist_fronts = ActivistFront.all\n authorize ActivistFront\n end",
"def show\n authorize :question_resquest_criminal, :show?\n end",
"def show\n #@service is already loaded and authorized\n\n respond_to do |format|\n format.html # show.html.haml\n format.json { render json: @service }\n end\n end",
"def whitelist\n if cannot_access_api?\n render json: [], status: :unauthorized\n end\n end",
"def show\n authorize!\n end",
"def show\n authorize!\n end",
"def show\n authorize!\n end",
"def show\n authorize User\n end",
"def show\n authorize User\n end",
"def show \n #if current_user.company_id == @user.company_id \n authorize @user \n end",
"def show\n # authorize Admin\n end",
"def show\n respond_to do |format|\n format.html { \n authorize! :index, @club\n }\n format.json { \n \n }\n end\n end",
"def index\n # @users = User.all\n # authorize @users \n @users = policy_scope(User)\n authorize @users\n end",
"def authorization; end",
"def show\n @role_permission = RolePermission.find(params[:id])\n #authorize! :show, @role_permission\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @role_permission }\n end\n end",
"def show\n authorize @formation\n end",
"def load_resources\n @user = current_user\n @gf_travel_request = GrantFundedTravelRequest.find(params[:id])\n if current_ability.can?(params[:action].to_sym, @gf_travel_request) && current_user.id != @gf_travel_request.user_id\n @back_path = user_approvals_path(current_user)\n else\n @back_path = user_forms_path(current_user)\n end\n end",
"def has_permission?\n return true if administrator?\n \n # Load the Model based on the controller name\n klass = self.controller_name.classify.constantize\n \n # Load the possible parent requested\n @parents = (klass.has_parent?) ? get_parents_from_request_params(klass, params) : nil\n \n # Load the resource requested\n if params[:id]\n if [\"index\", \"destroy\", \"update\"].include?(params[:action]) && klass.respond_to?(:in_set)\n @resource = klass.in_set(params[:id])\n @resource = @resource.first if @resource.size == 1\n else\n @resource = klass.find(params[:id])\n end\n end\n \n # Let's let the Model decide what is acceptable\n # NOTE: It is still the concrete controller's job to filter inaccessible resources (accessed via the index)!\n # This presumably happens in the with_parent named scope\n \n authorized = case params[:action]\n when \"edit\", \"update\"\n if [email protected]_a?(Array)\n return @resource.updatable_by?(current_user, @parents) # this is 'returned' to authorized\n end\n \n verify_set_accessablility(@resource, :updatable_by?) do |unauthorized_ids|\n permission_denied(\n :status => :conflict,\n :message => \"#{unauthorized_ids.to_a.join(',')} is not available for update.\"\n ) if unauthorized_ids.size > 0\n end\n true # if it gets past verification, authorized is true\n \n when \"destroy\" \n if [email protected]_a?(Array)\n return @resource.deletable_by?(current_user, @parents)\n end\n \n verify_set_accessablility(@resource, :deletable_by?) do |unauthorized_ids|\n permission_denied(\n :status => :conflict,\n :message => \"#{unauthorized_ids.to_a.join(',')} is not available for deletion.\"\n ) if unauthorized_ids.size > 0\n end\n true # if it gets past verification, authorized is true\n \n when \"index\" then klass.indexable_by?(current_user, @parents)\n when \"new\", \"create\" then klass.creatable_by?(current_user, @parents)\n when \"show\" then @resource.readable_by?(current_user, @parents)\n else check_non_restful_route(current_user, klass, @resource, @parents)\n end\n \n permission_denied unless authorized\n \n #rescue NoMethodError => e\n # Misconfiguration: A RESTful_ACL specific method is missing.\n #raise_error(klass, e)\n #rescue\n # Failsafe: If any funny business is going on, log and redirect\n #routing_error\n #end\n end",
"def show\n authorize! :show, HoursRegistration\n end",
"def show\n authorize @fee_transaction\n end",
"def authorize_access\r\n # authorize!(action_name.to_sym, \"#{controller_name}_controller\".camelcase.constantize)\r\n end",
"def authorize_users\n authorize :user\n end",
"def custom_permissions\n # Limits deleting objects to a the admin user\n #\n # if current_user.admin?\n # can [:destroy], ActiveFedora::Base\n # end\nif current_user.admin?\n\t can [:create, :show, :add_user, :remove_user, :index], Role\n\t end\n # Limits creating new objects to a specific group\n #\n # if user_groups.include? 'special_group'\n # can [:create], ActiveFedora::Base\n # end\n\n\n\n end",
"def index\n @fee_transactions = policy_scope(FeeTransaction)\n authorize FeeTransaction\n end",
"def show\n authorize @loan_manager_profile\n end",
"def authorize_resource\n authorize!(:disburse, @disbursement)\n @disbursement.experience_points_records.each do |record|\n authorize!(:create, record)\n end\n end",
"def check_permissions\n authorize! :create, Invoice\n end",
"def permission_required(*permissions)\n # if no permissions passed use controller level permissions (filter)\n if permissions.size > 0\n return true if user_permitted?(*permissions)\n # redirect to desired location when user does not have permission\n redirect_to :controller => 'main', :action => 'main' \n return\n\tend\n end",
"def pre_authorize_cb; end",
"def show\n @admin_authoring_site = Admin::AuthoringSite.find(params[:id])\n authorize @admin_authoring_site\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @admin_authoring_site }\n end\n end",
"def custom_permissions\n if current_user.admin?\n can [:create, :show, :add_user, :remove_user, :index, :edit, :update, :destroy], Role\n can [:create], Collection\n can [:discover], Hydra::AccessControls::Embargo\n can [:discover], Hydra::AccessControls::Lease\n can [:create], [ CurationConcerns.config.curation_concerns ]\n can [:destroy], ActiveFedora::Base\n can [:permissions], [ CurationConcerns.config.curation_concerns ]\n end\n\n # Limits deleting objects to a the admin user\n #\n #if current_user.admin?\n # can [:destroy], ActiveFedora::Base\n #end\n\n if current_user.has_role?('collection.manager')\n # can [:create, :show, :index, :edit, :update, :destroy], Collection\n can [:create], Collection\n end\n\n if current_user.has_role?('collection.depositor') or current_user.has_group_role?('collection.depositor')\n # can [:create, :show, :index, :edit, :update, :destroy], [ CurationConcerns.configuration.curation_concerns ]\n can [:create], [ CurationConcerns.config.curation_concerns ]\n # can [:show], Collection\n end\n\n # Limits creating new objects to a specific group\n #\n # if user_groups.include? 'special_group'\n # can [:create], ActiveFedora::Base\n # end\n end",
"def show\n @lab_permissions_role = LabPermissionsRole.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @lab_permissions_role }\n end\n end",
"def show\n authorize @info_practice\n end",
"def access_control\n \n end",
"def custom_permissions\n # Limits deleting objects to a the admin user\n #\n # if current_user.admin?\n # can [:destroy], ActiveFedora::Base\n # end\n\n # Limits creating new objects to a specific group\n #\n # if user_groups.include? 'special_group'\n # can [:create], ActiveFedora::Base\n # end\n can [:create, :show, :add_user, :remove_user, :index, :edit, :update, :destroy], Role if current_user.admin?\n\n can [:fa_overview], ActiveFedora::Base\n can [:advanced], ActiveFedora::Base\n can [:streets], ActiveFedora::Base\n can [:pdf_page], ActiveFedora::Base\n can [:pdf_page_metadata], ActiveFedora::Base\n can [:bookreader], ActiveFedora::Base\n can [:imageviewer], ActiveFedora::Base\n can [:streetsviewer], ActiveFedora::Base\n can [:fa_series], ActiveFedora::Base\n can [:audio_transcriptonly], ActiveFedora::Base\n can [:video_transcriptonly], ActiveFedora::Base\n end",
"def set_menu\n @food_cart = FoodCart.find(params[:id])\n @menu = @food_cart.menu\n # @menu = Menu.find(params[:id])\n authorize @menu\n end",
"def permission_resources\n %w{roles sites employees classrooms students gapps_org_units}\n end",
"def acl_services\n authorize!(:view_service_acl)\n\n validate_params({\n :client_id => [:required]\n })\n\n client = get_client(params[:client_id])\n\n services = {}\n client.wsdl.each do |wsdl|\n wsdl.service.each do |service|\n services[service.serviceCode] = {\n :service_code => service.serviceCode,\n :title => service.title\n }\n end\n end\n\n services_sorted = services.values.sort do |x, y|\n x[:service_code] <=> y[:service_code]\n end\n\n render_json(services_sorted)\n end",
"def load_resource(*args)\n ControllerApe.add_before_filter(self, :load_resource, *args)\n end",
"def index\n @samples = policy_scope(Sample.all)\n authorize Sample\n end",
"def request_authorization!\n respond_to do |format|\n format.html do\n if request.xhr?\n request_authorization_for_xhr!\n elsif BookingSync::Engine.embedded\n request_authorization_for_embedded!\n else\n request_authorization_for_standalone!\n end\n end\n\n format.json do\n head :unauthorized\n end\n\n format.api_json do\n head :unauthorized\n end\n end\n end",
"def permissions = {}",
"def volunteer_portal\n authorize! :volunteer_portal, :Reservation\n end",
"def index\n @loan_manager_profiles = LoanManagerProfile.all\n authorize LoanManagerProfile\n end",
"def custom_permissions\n # Limits deleting objects to a the admin user\n #\n # if current_user.admin?\n # can [:destroy], ActiveFedora::Base\n # end\n\n # Limits creating new objects to a specific group\n #\n # if user_groups.include? 'special_group'\n # can [:create], ActiveFedora::Base\n # end\n\n # TODO: This area looks like it needs to be refactored.\n\n if current_user.admin?\n editor_abilities\n upload_abilities\n publish_abilities\n roles_abilities\n hard_delete_abilities\n import_admin_abilities\n user_abilities\n group_abilities\n can [:create, :destroy, :update], FeaturedWork\n can [:manage], Hydra::Admin::Collection\n\n can :create, TinymceAsset\n can [:create, :update], ContentBlock\n can :read, ContentBlock\n can :characterize, GenericFile\n end\n\n\n if current_user.manager?\n upload_abilities\n publish_abilities\n roles_abilities\n import_user_abilities\n can [:manage], Hydra::Admin::Collection do |admin_set|\n # Can manage admin sets within their assigned unit.\n current_user.osul_groups.include? admin_set.unit_group\n end\n can [:manage], Osul::Group do |group|\n # Can manage the groups the user is in or the groups of the units a user is assigned to.\n current_user.osul_groups.include? group or current_user.osul_groups.include? group.unit\n end\n can [:create], Osul::Group\n can [:create, :destroy, :update], FeaturedWork\n end\n\n if current_user.data_entry?\n upload_abilities\n publish_abilities\n no_admin_set_abilities\n end\n\n if current_user.data_entry_student?\n upload_abilities\n no_admin_set_abilities\n end\n\n unless current_user.public?\n can :view_full, GenericFile\n end\n\n if current_user.role.nil?\n no_file_abilities\n no_admin_set_abilities\n end\n end",
"def show\n authorize @activist_front\n end",
"def load_permissions_from_solr(id=params[:asset_id], extra_controller_params={})\n unless !@permissions_solr_document.nil? && !@permissions_solr_response.nil?\n @permissions_solr_response, @permissions_solr_document = get_permissions_solr_response_for_doc_id(id, extra_controller_params)\n end\n end",
"def load_permissions_from_solr(id=params[:asset_id], extra_controller_params={})\n unless !@permissions_solr_document.nil? && !@permissions_solr_response.nil?\n @permissions_solr_response, @permissions_solr_document = get_permissions_solr_response_for_doc_id(id, extra_controller_params)\n end\n end",
"def verify_permission\n return if action_permitted?\n\n render(json: format_error(request.path, 'Permiso denegado'), status: 401)\n end",
"def show\n authorize! :create, Administrator\n end",
"def index\n @clubs = Club.all \n respond_to do |format|\n format.html { \n authorize! :index, @clubs\n }\n format.json { \n \n }\n end\n end",
"def show\n authorize EmployeeType\n end",
"def show\n authorize @system_news, :show?\n end",
"def custom_permissions\n if admin?\n can [:confirm_delete], ActiveFedora::Base\n can [:allow_downloads, :prevent_downloads], AdminSet\n\n can :manage, Spotlight::HomePage\n can :manage, Spotlight::Exhibit\n end\n\n can :read, Spotlight::HomePage\n can :read, Spotlight::Exhibit\n\n # Limits creating new objects to a specific group\n #\n # if user_groups.include? 'special_group'\n # can [:create], ActiveFedora::Base\n # end\n end",
"def show\n\t\tauthorize! :show, HistorialEstadoPresupuesto\n end",
"def index\n authorize!(:view_configuration_management)\n end",
"def index\n @permission_policies = PermissionPolicy.all\n end",
"def run_filters\n set_user\n authorize\n end",
"def authorize (permission_name)\n self.allowances.detect {|a| a.permission.name == permission_name.to_s}\n end",
"def show\n authorize Section\n end",
"def index\n @fuel_supplies ||= policy_scope(FuelSupply.all)\n authorize FuelSupply\n end",
"def user_action_on_resource_authorized\n end",
"def index\n #authorize! :index, @login, :message => 'Not authorized as an administrator.'\n #É preciso ir buscar a clinica do gestor atual para carregar a informação\n manager = Manager.first(:conditions => \"login_id = #{current_login.id}\")\n @clinic = manager.clinic\n\n @managers = Manager.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @managers }\n end\n end",
"def index\n @bookings = policy_scope(current_user.bookings)\n authorize @bookings\n @experiences = policy_scope(current_user.experiences)\n authorize @experiences\n end",
"def restrict_access \n \t# Não sei o porque, mas é precisa instanciar esse objeto\n \tresponse = nil\n \t\n \t# Verifica se o TOKEN existe\n \t# TODO: Fazer uma validação do TOKEN quando for chamá-lo\n \t# ao invés de fazer isso aqui, pois economiza uma chamada\n \tif params[:token].nil?\n \t\t# bloqueia o acesso\n \t\thead :unauthorized # retirar no futuro quando melhorar a analise do token\n \telse\n \t\t# Faz a chamada pro API da Arich mediante parâmetros no CONFIG da aplicação Rails\n\t\tNet::HTTP.start(Rails.application.config.authentication_location, Rails.application.config.authentication_port) {|http|\n\t\t\t\tresponse = http.head(Rails.application.config.authentication_complement + params[:token])\n\t\t}\n\n\t\t# Analisa o retorno da chamada da API, se algo diferente de\n\t\t# 200 ele rejeita a autenticação\n\t\tif response.code != \"200\"\n\t\t\thead :unauthorized\n\t\tend \n\tend\n end",
"def user_permissions\n if user_signed_in? && (current_user.is_logistics? || current_user.is_clerical? || current_user.is_vendor? || current_user.is_customer?)\n authorize! :edit, Element\n end\n end",
"def new_load_voyage\n return if authorise_for_web(program_name?,'create')== false\n render_new_load_voyage\n end",
"def show\n authorize @work_category\n end",
"def has_permissions?(resource_permissions)\n fetch_permissions! resource_permissions.keys unless @fetched_all\n super\n end",
"def authorize_admin_profiles\n authorize convention, :view_attendees?\n end",
"def set_request\n @request = Request.find(params[:id])\n authorize @request\n end",
"def create\n @permission = Permission.new(\n permissions_params.merge(\n service: @service,\n created_by_user: @current_user\n )\n )\n\n begin\n team = find_or_create_team!\n @permission.team_id = team.id\n\n authorize(@permission)\n @permission.save!\n flash[:success] = I18n.t('services.permissions.create.success' )\n redirect_to action: :index, service_id: @service\n\n rescue StandardError => e\n permissions_error_message(e)\n redirect_to action: :index, service_id: @service\n end\n end",
"def show\n @contrato = Contrato.find(params[:id])\n authorize @contrato\n respond_to do |format|\n format.html\n end\n end",
"def check_permissions\n authorize! :create, Product\n end",
"def show\n\n authorize Article\n end",
"def custom_permissions\n # Limits deleting objects to a the admin user\n #\n # if current_user.admin?\n # can [:destroy], ActiveFedora::Base\n # end\n\n # Limits creating new objects to a specific group\n #\n # if user_groups.include? 'special_group'\n # can [:create], ActiveFedora::Base\n # end\n end",
"def load_and_authorize(name, options={})\n @_through_stack ||= []\n\n # only touch can can if the instance variable is nil\n resource = instance_variable_get(\"@#{name}\") || instance_variable_get(\"@#{name.to_s.pluralize}\")\n\n if resource.nil?\n # apply if, only and except behaviours just is if this was done by before_filter\n proceed = true\n proceed &&= [*options[:only]].include?(action_name.to_sym) if options[:only]\n proceed &&= ![*options[:except]].include?(action_name.to_sym) if options[:except]\n proceed &&= case options[:if]\n when Symbol\n send(options[:if])\n when Proc\n options[:if].call\n when nil\n true\n end\n\n if proceed\n # automatically load this resource through a nested one unless manually specified\n options[:through] = @_through_stack.last unless @_through_stack.empty? || options.include?(:through)\n # create the can can resource class\n cancan = self.class.cancan_resource_class.new(self, name, options.except(:if, :only, :except, :param))\n resource = cancan.load_resource\n cancan.authorize_resource unless options[:skip_authorize]\n\n if resource\n # If the resource was a scope (query/collection-proxy) simply add the result class into the loaded_resources\n loaded_resources << ((resource.is_a? ActiveRecord::Relation) ? resource.klass : resource)\n end\n\n if resource && block_given?\n # only call block if we got an instance variable set\n begin\n @_through_stack.push(name)\n yield\n ensure\n @_through_stack.pop\n end\n end\n end\n end\n resource\n end",
"def show\n\t\tauthorize! :show, DetalleRestriccion\n end",
"def show\n authorize @fuel_supply\n end"
] | [
"0.692439",
"0.64561164",
"0.6223231",
"0.62064433",
"0.6175169",
"0.60592353",
"0.6048326",
"0.60462195",
"0.5926586",
"0.59210706",
"0.59180725",
"0.59042186",
"0.58937514",
"0.58688277",
"0.58581007",
"0.5849994",
"0.5842349",
"0.58324313",
"0.5831767",
"0.5826162",
"0.58238614",
"0.58238614",
"0.58219755",
"0.5814584",
"0.5808464",
"0.57893276",
"0.576307",
"0.576307",
"0.576307",
"0.57558286",
"0.57558286",
"0.57461745",
"0.5737263",
"0.5725509",
"0.5720363",
"0.57163906",
"0.570391",
"0.57030535",
"0.5701694",
"0.5701153",
"0.57002586",
"0.5699548",
"0.56985736",
"0.5695786",
"0.569402",
"0.5693464",
"0.5692868",
"0.56915146",
"0.5685792",
"0.5680734",
"0.567144",
"0.5669037",
"0.5667395",
"0.56666857",
"0.56637365",
"0.5660564",
"0.56521523",
"0.56443197",
"0.56398505",
"0.5638439",
"0.5635268",
"0.56350523",
"0.56329405",
"0.5630905",
"0.5620117",
"0.5618215",
"0.5617893",
"0.5615581",
"0.5609485",
"0.5609485",
"0.56044245",
"0.56019425",
"0.5594383",
"0.55925244",
"0.55922985",
"0.55916643",
"0.5591359",
"0.5588788",
"0.55872536",
"0.5577636",
"0.5570489",
"0.5568367",
"0.5564971",
"0.5564963",
"0.5560967",
"0.55566394",
"0.55505913",
"0.5549684",
"0.5545226",
"0.5544795",
"0.5543052",
"0.5539401",
"0.5538201",
"0.55381995",
"0.5529475",
"0.55270463",
"0.55257875",
"0.552498",
"0.55234814",
"0.5517629",
"0.55064446"
] | 0.0 | -1 |
GET /service_fee_masters/1 GET /service_fee_masters/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_service_fee_master\n @service_fee_master = ServiceFeeMaster.find(params[:id])\n end",
"def index\n @masterservices = Masterservice.all\n end",
"def index\n @service_master = ServiceMaster.new\n @service_masters = ServiceMaster.all\n end",
"def show\n #@klass_fee = KlassFee.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @klass_fee }\n end\n end",
"def index\n @service_type_masters = ServiceTypeMaster.all\n end",
"def show\n @service = Service.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @service }\n end\n end",
"def show\n @service = Service.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @service }\n end\n end",
"def show\n @service = Service.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @service }\n end\n end",
"def index\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @service_development_costs }\n end\n end",
"def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @service }\n end\n end",
"def show\n @monthly_finance = MonthlyFinance.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @monthly_finance }\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 show\n @service = Service.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @service }\n end\n end",
"def show\n render json: @service\n end",
"def show\n respond_to do |format|\n format.json { render json: @service_call }\n end\n end",
"def index\n @monthly_finances = MonthlyFinance.all\n # respond_to do |format|\n # format.html # index.html.erb\n # format.json { render json: @monthly_finances }\n # end\n end",
"def new\n @service = Service.new\n @vendors = Vendor.all\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @service }\n end\n end",
"def set_masterservice\n @masterservice = Masterservice.find(params[:id])\n end",
"def index\n @financer_masters = FinancerMaster.all\n end",
"def show\n @online_service = OnlineService.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @online_service }\n end\n end",
"def show\n @calificacion_servicio = CalificacionServicio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @calificacion_servicio }\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 @service_requests = ServiceRequest.all\n end",
"def index\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @service_demand_breakdowns }\n end\n end",
"def show\n @additional_service = AdditionalService.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @additional_service }\n end\n end",
"def show\n render json: @service_booking\n end",
"def service_fee_master_params\n params.require(:service_fee_master).permit(:appt_type_id, :service_id, :req_urgency, :fee, :fee, :comment, :user_id, :active_status, :del_status)\n end",
"def index\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @service_pricing_schemes }\n end\n end",
"def show\n @scheduled_service = ScheduledService.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @scheduled_service }\n end\n end",
"def index\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @service_features }\n end\n end",
"def show\n @service_email = ServiceEmail.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @service_email }\n end\n end",
"def new\n @service = Service.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @service }\n end\n end",
"def new\n @service = Service.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @service }\n end\n end",
"def new\n @service = Service.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @service }\n end\n end",
"def new\n @service = Service.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @service }\n end\n end",
"def new\n #@klass_fee = KlassFee.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @klass_fee }\n end\n end",
"def index\n @per_page_options = %w{ 21 51 99 }\n respond_to do |format|\n format.html # index.html.erb\n format.xml # index.xml.builder\n format.atom # index.atom.builder\n format.json { render :json => ServiceCatalographer::Api::Json.index(\"services\", json_api_params, @services).to_json }\n format.bljson { render :json => ServiceCatalographer::Api::Bljson.index(\"services\", @services).to_json }\n end\n end",
"def show\n @latest_version = @service.latest_version\n @latest_version_instance = @latest_version.service_versionified\n @latest_deployment = @service.latest_deployment\n\n @all_service_version_instances = @service.service_version_instances\n @all_service_types = @service.service_types\n\n @soaplab_server = @service.soaplab_server\n\n @pending_responsibility_requests = @service.pending_responsibility_requests\n unless is_api_request?\n @service_tests = @service.service_tests\n @test_script_service_tests = @service.service_tests_by_type(\"TestScript\")\n @url_monitor_service_tests = @service.service_tests_by_type(\"UrlMonitor\")\n end\n if @latest_version_instance.is_a?(RestService)\n @grouped_rest_methods = @latest_version_instance.group_all_rest_methods_from_rest_resources\n end\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml # show.xml.builder\n format.json { render :json => @service.to_json }\n end\n end",
"def index\n @service_bookings = ServiceBooking.all\n\n render json: @service_bookings\n end",
"def show\n @channel_shipping_service = ChannelShippingService.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @channel_shipping_service }\n end\n end",
"def new\n @charge_master = ChargeMaster.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @charge_master }\n end\n end",
"def show\n @serviceorg = Serviceorg.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @serviceorg }\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 #@service is already loaded and authorized\n\n respond_to do |format|\n format.html # show.html.haml\n format.json { render json: @service }\n end\n end",
"def index\n duration_hash = {}\n \n sub_sub_category = OneclickRefernet::SubSubCategory.find_by(code: params[:sub_sub_category])\n sub_sub_category_services = sub_sub_category.try(:services) || []\n\n # Base service queries on a collection of UNIQUE services\n services = OneclickRefernet::Service.confirmed.where(id: sub_sub_category_services.pluck(:id).uniq)\n \n lat, lng = params[:lat], params[:lng]\n meters = params[:meters].to_f\n limit = params[:limit] || 10\n \n if lat && lng\n meters = meters > 0.0 ? meters : (30 * 1609.34) # Default to 30 miles\n \n services = services.closest(lat, lng)\n .within_x_meters(lat, lng, meters)\n .limit(limit) \n duration_hash = build_duration_hash(params, services)\n else\n services = services.limit(limit)\n end\n \n render json: services.map { |svc| service_hash(svc, duration_hash) }\n\n end",
"def show\n @servicetype = Servicetype.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @servicetype }\n end\n end",
"def show\n @service = Service.find(params[:id])\n build_service_content\n \n respond_to do |format|\n format.html # show.html.erb\n end\n end",
"def set_service_master\n @service_master = ServiceMaster.find(params[:id])\n end",
"def index\n @flights = Flight.all\n render json: @flights\n end",
"def destroy\n @service_fee_master.destroy\n respond_to do |format|\n format.html { redirect_to service_fee_masters_url, notice: 'Service fee master was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def show\n @college_fee = CollegeFee.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @college_fee }\n end\n end",
"def show\n respond_to do |format|\n format.html # show.html.erb\n format.xml # show.xml.builder\n format.json { render :json => @service_provider.to_json }\n end\n end",
"def show\n @servicetype = Servicetype.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @servicetype }\n end\n end",
"def show\n @value_added_service = ValueAddedService.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @value_added_service }\n end\n end",
"def show\n @service = current_user.pro.services.find(params[:id])#Service.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @service }\n end\n end",
"def show\n @solicitud_servicio = SolicitudServicio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @solicitud_servicio }\n end\n end",
"def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @service_order }\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 index\n @medical_services = MedicalService.all\n end",
"def create\n @service_fee_master = ServiceFeeMaster.new(service_fee_master_params)\n\n @lab_services = LabService.order(:title).where(\"title ilike ?\", \"%#{params[:service_id]}\")\n\n @lab_list = @lab_services.map { |a|[a.title+\" \",a.id] }\n\n respond_to do |format|\n if @service_fee_master.save\n format.js {flash[:notice] = \"Service Price set successfully\"}\n render js: \"window.location='#{service_fee_masters_path}'\"\n # format.html { redirect_to @service_fee_master, notice: 'Service fee master was successfully created.' }\n format.json { render :show, status: :created, location: @service_fee_master }\n else\n format.js {render :new }\n # format.html { render :new }\n format.json { render json: @service_fee_master.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n endpoint(get(services_url).body)\n end",
"def index\n @businesses = Business.all.offset(offset).limit(limit)\n render json: @businesses\n end",
"def index\n @ref_id = params[:ref_id]\n\n if @ref_id.present?\n @service_fee_masters = ServiceFeeMaster.where(appt_type_id: @ref_id).paginate(:page => params[:page], :per_page => 8).order('created_at desc')\n else\n @service_fee_masters = ServiceFeeMaster.all.paginate(:page => params[:page], :per_page => 8).order('created_at desc')\n end\n\n respond_to do |format|\n format.html\n format.csv { send_data @service_fee_masters.to_csv }\n format.xls { send_data @service_fee_masters.to_csv(options={col_sep: \"\\t\"}) }\n end\n end",
"def show\n render json: @service_history\n end",
"def show_fee_with_http_info(id, item_amount, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: FeesApi.show_fee ...'\n end\n # verify the required parameter 'id' is set\n if @api_client.config.client_side_validation && id.nil?\n fail ArgumentError, \"Missing the required parameter 'id' when calling FeesApi.show_fee\"\n end\n # verify the required parameter 'item_amount' is set\n if @api_client.config.client_side_validation && item_amount.nil?\n fail ArgumentError, \"Missing the required parameter 'item_amount' when calling FeesApi.show_fee\"\n end\n # resource path\n local_var_path = '/fees/{id}'.sub('{' + 'id' + '}', CGI.escape(id.to_s))\n\n # query parameters\n query_params = opts[:query_params] || {}\n query_params[:'item_amount'] = item_amount\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type] || 'SingleFee'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['basicAuth', 'oAuth2ClientCredentials']\n\n new_options = opts.merge(\n :operation => :\"FeesApi.show_fee\",\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: FeesApi#show_fee\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def index\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @financials }\n end\n end",
"def show\n @empresa_servicio = EmpresaServicio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @empresa_servicio }\n end\n end",
"def service(id)\n request :get, \"/services/#{id}\"\n end",
"def new\n @online_service = OnlineService.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @online_service }\n end\n end",
"def index\n @shipping_fees = ShippingFee.all\n end",
"def create\n\n @calais = Calaisservice.new\n\n respond_to do |format|\n format.json { render :json => @calais.json_query( params[:query] ) }\n format.all { render_501 }\n end\n end",
"def index\n @facility_totals = FacilityTotal.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @facility_totals }\n end\n end",
"def index\n @service_emails = ServiceEmail.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @service_emails }\n end\n end",
"def new\n @scheduled_service = ScheduledService.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @scheduled_service }\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 render json: @referral_contact\n end",
"def show\n @service_type = ServiceType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @service_type }\n end\n end",
"def show\n @membership_fee = MembershipFee.find(params[:id])\n @member = Member.find(@membership_fee.member_id)\n @school_year = SchoolYear.find(@membership_fee.school_year_id)\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @membership_fee }\n end\n end",
"def index\n @provider_services = ProviderService.all\n # @provider_masters = ProviderMaster.all\n @service_masters = ServiceMaster.all\n end",
"def new\n @additional_service = AdditionalService.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @additional_service }\n end\n end",
"def show\n @delivery_man = DeliveryMan.find(params[:id])\n\n render json: @delivery_man\n end",
"def show\n @federal1870_census_entry = Federal1870CensusEntry.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @federal1870_census_entry }\n end\n end",
"def show\n @monthlybill = Monthlybill.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @monthlybill }\n end\n end",
"def requested\n requested_params = {\n external_code: params[:id],\n company_id: params[:company][:id],\n company_name: params[:company][:name],\n recruiter_id: params[:recruiter][:id],\n recruiter_name: params[:recruiter][:name],\n applicant_id: params[:applicant][:id],\n applicant_name: params[:applicant][:name],\n job_id: params[:job][:id],\n job_title: params[:job][:title],\n status: params[:status]\n }\n\n @service = Service.new(requested_params)\n\n if @service.save\n render json: { status: :created }, status: :created\n else\n render json: @service.errors, status: :unprocessable_entity\n end\n end",
"def show\n @referral = Referral.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @referral }\n end\n end",
"def show\n @service_record = ServiceRecord.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @service_record }\n end\n end",
"def index\n @service_centers = ServiceCenter.all\n\n\n end",
"def show\n respond_to do |format|\n format.json { render json: @newsletter}\n end\n end",
"def index\n @admin_pricing_fabrics = Admin::Pricing::Fabric.all.paginate(page: params[:page])\n\n respond_to do |format|\n format.html\n format.json { render json: @admin_pricing_fabrics.map { |i| { value: i.id, text: i.to_s } }, status: :ok }\n end\n end",
"def index\n @service_schedules = ServiceSchedule.all\n\n render json: @service_schedules\n end",
"def show\n #@service_request = ServiceRequest.find(params[:id])\n @the_creator = User.find_by_id(@service_request.user_id)\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @service_request }\n end\n end",
"def show\n @fabric = Fabric.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @fabric }\n end\n end",
"def index\n @servicemen = Serviceman.all\n end",
"def index\n @referral_contacts = @user.referralContact.page(params[:page]).per(params[:per])\n\n render json: @referral_contacts\n end",
"def index\n @charges = Charge.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @charges }\n end\n end",
"def index\n @finance_leads = FinanceLead.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @finance_leads }\n end\n end",
"def show\n @finance_lead = FinanceLead.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @finance_lead }\n end\n end",
"def show\n @newsletter_frequency = NewsletterFrequency.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @newsletter_frequency }\n end\n end",
"def show\n @service = Service.find(params[:id])\n end",
"def show\n @business = Business.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @business }\n end\n end",
"def show\n @business = Business.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @business }\n end\n end"
] | [
"0.65771776",
"0.619064",
"0.61666965",
"0.59563553",
"0.59007967",
"0.58653265",
"0.58653265",
"0.58653265",
"0.58424574",
"0.5839547",
"0.5768863",
"0.5759841",
"0.5727925",
"0.57160187",
"0.5711347",
"0.5703594",
"0.566025",
"0.56498694",
"0.56169856",
"0.5613496",
"0.5613374",
"0.56114215",
"0.5607671",
"0.56049466",
"0.5580409",
"0.55752563",
"0.5569886",
"0.5565476",
"0.5540771",
"0.5538785",
"0.55315876",
"0.5509706",
"0.5509706",
"0.5509706",
"0.5509706",
"0.5504843",
"0.5503297",
"0.55022997",
"0.54990566",
"0.54975957",
"0.54667246",
"0.5454634",
"0.54504895",
"0.54457486",
"0.5443025",
"0.543506",
"0.5422147",
"0.54200166",
"0.5416973",
"0.5413672",
"0.5411252",
"0.54111415",
"0.54094857",
"0.5407014",
"0.54034597",
"0.5402935",
"0.5389637",
"0.5384591",
"0.5378489",
"0.5377176",
"0.5372361",
"0.5367023",
"0.5359247",
"0.5350846",
"0.5350103",
"0.53487927",
"0.53487164",
"0.53483874",
"0.53467613",
"0.533816",
"0.53378105",
"0.5337188",
"0.5335084",
"0.5331006",
"0.53297526",
"0.53243744",
"0.5318563",
"0.5313218",
"0.53108853",
"0.5308222",
"0.530546",
"0.5304024",
"0.53038293",
"0.5302034",
"0.5301245",
"0.53004646",
"0.5299456",
"0.52976096",
"0.5296856",
"0.52936345",
"0.5291569",
"0.52884156",
"0.52828115",
"0.52777123",
"0.5275303",
"0.5274221",
"0.526894",
"0.5264182",
"0.5260121",
"0.52586067",
"0.52586067"
] | 0.0 | -1 |
POST /service_fee_masters POST /service_fee_masters.json | def create
@service_fee_master = ServiceFeeMaster.new(service_fee_master_params)
@lab_services = LabService.order(:title).where("title ilike ?", "%#{params[:service_id]}")
@lab_list = @lab_services.map { |a|[a.title+" ",a.id] }
respond_to do |format|
if @service_fee_master.save
format.js {flash[:notice] = "Service Price set successfully"}
render js: "window.location='#{service_fee_masters_path}'"
# format.html { redirect_to @service_fee_master, notice: 'Service fee master was successfully created.' }
format.json { render :show, status: :created, location: @service_fee_master }
else
format.js {render :new }
# format.html { render :new }
format.json { render json: @service_fee_master.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"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 service_fee_master_params\n params.require(:service_fee_master).permit(:appt_type_id, :service_id, :req_urgency, :fee, :fee, :comment, :user_id, :active_status, :del_status)\n end",
"def set_service_fee_master\n @service_fee_master = ServiceFeeMaster.find(params[:id])\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 @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 @provider_service = ProviderService.new(provider_service_params)\n \n\n respond_to do |format|\n if @provider_service.save\n format.js { flash.now[:notice] = \"Provider Service was successfully created.\" }\n format.html { redirect_to @provider_service, notice: 'Provider service was successfully created.' }\n format.json { render :show, status: :created, location: @provider_service }\n else\n @provider_masters = ProviderMaster.all\n @service_masters = ServiceMaster.all\n format.js { render :new }\n format.html { render :new }\n format.json { render json: @provider_service.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @sender = params[:sender]\n @destination = params[:destination]\n @package = params[:package]\n @notification = params[:notification]\n @preferences = params[:preferences]\n @settlement_info = params[:settlement_info]\n @request = {\n sender: @sender,\n destination: @destination,\n package: @package,\n notification: @notification,\n preferences: @preferences,\n settlement_info: @settlement_info,\n group_id: '5241556',\n mailing_date: Date.today,\n contract_number: '0042956527',\n service_code: params[:service_code],\n mobo: {\n customer_number: params[:mobo],\n username: 'bc02d6bd3733555c',\n password: '111d1a0d29fc00aa47b66a',\n contract_number: '0042956527'\n }\n }\n puts \"**** #{@request}\"\n\n @response = CANADA_POST_SERVICE.create(\n sender: @sender,\n destination: @destination,\n package: @package,\n notification: @notification,\n preferences: @preferences,\n settlement_info: @settlement_info,\n group_id: '5241556',\n mailing_date: Date.today,\n contract_id: '0042956527',\n service_code: params[:service_code],\n mobo: {\n customer_number: params[:mobo],\n username: 'bc02d6bd3733555c',\n password: '111d1a0d29fc00aa47b66a',\n contract_number: '0042956527'\n }\n )\n puts \"Full Response: #{@response}\"\n unless @response[:create_shipping][:errors].present?\n Shipping.track_shipping(@response)\n end\n respond_to do |format|\n format.js {}\n end\n end",
"def create\n @service = Service.new(service_params)\n\n respond_to do |format|\n if @service.save\n #create line_up\n @lineup = Lineup.create(service: @service, mc: \"MC\")\n format.html { redirect_to services_url, notice: \"Service was successfully created. #{@lineup.id}\" }\n format.json { render :show, status: :created, location: @service }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @service.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @customer = Customer.find(params[:customer_id])\n @service = @customer.service.new(service_params)\n\n respond_to do |format|\n if @service.save\n \n else\n format.html { render :new }\n format.json { render json: @service.errors, status: :unprocessable_entity }\n end\n end\n\n end",
"def create\n @incoming_service_tax = IncomingServiceTax.new(incoming_service_tax_params)\n\n respond_to do |format|\n if @incoming_service_tax.save\n format.html { redirect_to @incoming_service_tax, notice: 'Incoming service tax was successfully created.' }\n format.json { render action: 'show', status: :created, location: @incoming_service_tax }\n else\n format.html { render action: 'new' }\n format.json { render json: @incoming_service_tax.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @fee = Fee.new(params[:fee])\n\n respond_to do |format|\n if @fee.save\n format.html { redirect_to fees_path, notice: 'Fee was successfully created.' }\n format.json { render json: @fee, status: :created, location: @fee }\n else\n format.html { render action: \"new\" }\n format.json { render json: @fee.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 params_map = ActiveSupport::HashWithIndifferentAccess.new(params[:services])\n @service = Service.new(params_map)\n @tenant = Tenant.find(session[:user_id])\n @property = Property.find(@tenant.property_id)\n @manager = Manager.find(@property.manager_id)\n @service.manager_id = @manager.id\n @service.property_id = @property.id\n @service.tenant_id = @tenant.id\n #sets resolved to false, only tenants have the ability to set these to completed\n @service.resolved = false\n if @service.save\n ServiceMailer.reminder(@service).deliver_now\n redirect_to '/tenants/show'\n else\n render \"new\"\n end\n end",
"def create\n @service_master = ServiceMaster.new(service_master_params)\n @service_masters = ServiceMaster.all\n respond_to do |format|\n if @service_master.save\n @service_master = ServiceMaster.new\n format.js { @flag = true }\n else\n flash.now[:alert] = 'About Already Exist.'\n format.js { @flag = false }\n end\n end\n end",
"def create\n @shipping_fee = ShippingFee.new(shipping_fee_params)\n\n respond_to do |format|\n if @shipping_fee.save\n format.html { redirect_to action: :index, notice: 'Create Success.' }\n format.json { render action: :index, status: :created }\n else\n format.html { render action: :new }\n format.json { render json: @shipping_fee.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @terms_of_service = TermsOfService.new(terms_of_service_params)\n\n respond_to do |format|\n if @terms_of_service.save\n format.html { redirect_to @terms_of_service, notice: 'Terms of service was successfully created.' }\n format.json { render :show, status: :created, location: @terms_of_service }\n else\n format.html { render :new }\n format.json { render json: @terms_of_service.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @membership_fee = MembershipFee.new(params[:membership_fee])\n\n respond_to do |format|\n if @membership_fee.save\n format.html { redirect_to @membership_fee, notice: 'Membership fee was successfully created.' }\n format.json { render json: @membership_fee, status: :created, location: @membership_fee }\n else\n format.html { render action: \"new\" }\n format.json { render json: @membership_fee.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @serviceordemservice = Serviceordemservice.new(serviceordemservice_params)\n\n respond_to do |format|\n if @serviceordemservice.save\n format.html { redirect_to @serviceordemservice, notice: 'Serviceordemservice was successfully created.' }\n format.json { render :show, status: :created, location: @serviceordemservice }\n else\n format.html { render :new }\n format.json { render json: @serviceordemservice.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @service = Service.new(service_params)\n if @service.save\n render json: @service, status: :created, location: @service\n else\n render json: @service.errors, status: :unprocessable_entity\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 @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 @pay_fee = PayFee.new(pay_fee_params)\n\n respond_to do |format|\n if @pay_fee.save\n format.html { redirect_to @pay_fee, notice: 'Pay fee was successfully created.' }\n format.json { render :show, status: :created, location: @pay_fee }\n else\n format.html { render :new }\n format.json { render json: @pay_fee.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @supplier = Supplier.find(params[:supplier_id])\n @service = @supplier.services.create(service_params)\n\n respond_to do |format|\n if @service.save\n format.html { redirect_to supplier_path(@supplier), notice: 'Service was successfully created.' }\n format.json { render action: 'show', status: :created, location: @service }\n else\n format.html { render action: 'new' }\n format.json { render json: @service.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n failed = false\n params[:service][:done].each{ |member_id,one|\n unless one.to_i != 1\n params[:service][:hours][member_id] = Setting.first.workshare_hours_per_month\n end\n } unless params[:service][:done].nil?\n params[:service][:hours].each{ |member_id,amt|\n next if amt.nil? or (amt.kind_of? String and amt.strip == \"\")\n task = params[:service][:task][member_id]\n did_at = Date.new(params[:service][\"did_at(1i)\"].to_i,params[:service][\"did_at(2i)\"].to_i,params[:service][\"did_at(3i)\"].to_i)\n service = Service.new({:member_id => member_id, :hours => amt, :task => task, \n :observed_by => current_member, :did_at => did_at})\n unless service.save\n failed = true\n break\n end\n } unless params[:service][:hours].nil?\n \n respond_to do |format|\n unless failed\n format.html { redirect_to(services_url, :notice => 'Service was successfully created.') }\n format.xml { render :xml => @service, :status => :created, :location => @service }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @service.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def requested\n requested_params = {\n external_code: params[:id],\n company_id: params[:company][:id],\n company_name: params[:company][:name],\n recruiter_id: params[:recruiter][:id],\n recruiter_name: params[:recruiter][:name],\n applicant_id: params[:applicant][:id],\n applicant_name: params[:applicant][:name],\n job_id: params[:job][:id],\n job_title: params[:job][:title],\n status: params[:status]\n }\n\n @service = Service.new(requested_params)\n\n if @service.save\n render json: { status: :created }, status: :created\n else\n render json: @service.errors, status: :unprocessable_entity\n end\n end",
"def add_tenant_circle(args = {}) \n post(\"/tenantcircles.json/\", args)\nend",
"def create\n @scheduled_service = ScheduledService.new(params.require(:scheduled_service).permit(:mileage, :sdate, :service_schedule_id))\n\n respond_to do |format|\n if @scheduled_service.save\n format.html { redirect_to scheduled_services_url,\n notice: 'ScheduledService was successfully created.' }\n format.json { render json: @scheduled_service, status: :created, location: @scheduled_service }\n else\n format.html { render action: \"new\" }\n format.json { render json: @scheduled_service.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @service_request = ServiceRequest.new(service_request_params)\n\n respond_to do |format|\n if @service_request.save\n\n format.html { redirect_to tank_information_path(@service_request.id), notice: 'Service request was successfully created.' }\n format.json { render :show, status: :created, location: @service_request }\n else\n format.html { render :new }\n format.json { render json: @service_request.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @customer_service = CustomerService.new(customer_service_params)\n\n respond_to do |format|\n if @customer_service.save\n format.html { redirect_to @customer_service, notice: 'Customer service was successfully created.' }\n format.json { render :show, status: :created, location: @customer_service }\n else\n format.html { render :new }\n format.json { render json: @customer_service.errors, status: :unprocessable_entity }\n end\n end\n end",
"def add_service(service={})\n request :post, '/services', service\n end",
"def index\n @service_master = ServiceMaster.new\n @service_masters = ServiceMaster.all\n end",
"def service_master_params\n params.require(:service_master).permit(:code, :name, :description, :status)\n end",
"def create\r\n @service = Service.new(service_params)\r\n respond_to do |format|\r\n if @service.save #/enter/companies/:company_id/services/:id/add_stack\r\n format.html { redirect_to \"/enter/companies/#{@service.company_id}/services/#{@service.id}/add_stack\", notice: 'Service was successfully created.' }\r\n format.json { render :add_stack, status: :created, location: @service }\r\n else\r\n format.html { render :new }\r\n format.json { render json: @service.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end",
"def create\r\n @service = Service.new(service_params)\r\n @service.user_id = current_user.id\r\n @service.create_nanny(nanny_params)\r\n\r\n respond_to do |format|\r\n if @service.save\r\n format.html { redirect_to @service, notice: 'Service was successfully created.' }\r\n format.json { render :show, status: :created, location: @service }\r\n else\r\n format.html { render :new }\r\n format.json { render json: @service.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end",
"def create\n fax_request = FaxRequest.new(fax_params)\n fax_request.client_receipt_date = Time.now\n fax_request.save!\n response = send_fax(fax_params)\n update_fax_request(fax_request,response)\n end",
"def create\n submenu_item 'services-new'\n @service = Service.new(params[:service])\n @service_type = @service.type\n service_param\n\n @service.tenant_id = current_user.tenant_id\n\n # service_params = Service.extract_params(params[:service])\n # service_params = Service.extract_thresholds(service_params)\n # @service = Service.new(service_params)\n\n respond_to do |format|\n if @service.save\n flash[:notice] = \"#{@service.name}创建成功\"\n format.html { redirect_to(@service) }\n else\n dictionary\n format.html { render :action => \"new\" }\n end\n end\n end",
"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 @medical_service = MedicalService.new(medical_service_params)\n\n respond_to do |format|\n if @medical_service.save\n format.html { redirect_to @medical_service, notice: 'Medical service was successfully created.' }\n format.json { render :show, status: :created, location: @medical_service }\n else\n format.html { render :new }\n format.json { render json: @medical_service.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_masterservice\n @masterservice = Masterservice.find(params[:id])\n end",
"def create\n @home_care_service = HomeCareService.new(home_care_service_params)\n\n respond_to do |format|\n if @home_care_service.save\n format.html { redirect_to @home_care_service, notice: 'Home care service was successfully created.' }\n format.json { render :show, status: :created, location: @home_care_service }\n else\n format.html { render :new }\n format.json { render json: @home_care_service.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n\n @service = Service.new(service_params)\n \n params[:service][:shipments_attributes].each do |k,ship|\n ship.each do |k,device|\n if k.to_s[/device_ids.*/]\n device.each{|d| d.blank? ? d:Device.find(d).update(:assigned=>true)}\n end\n end\n end\n\n respond_to do |format|\n if @service.save\n format.html { redirect_to @service, notice: 'Service was successfully created.' }\n format.json { render action: 'show', status: :created, location: @service }\n else\n format.html { render action: 'new' }\n format.json { render json: @service.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @taxfree = Taxfree.new(taxfree_params)\n\n respond_to do |format|\n if @taxfree.save\n format.html { redirect_to @taxfree, notice: 'Taxfree was successfully created.' }\n format.json { render :show, status: :created, location: @taxfree }\n else\n format.html { render :new }\n format.json { render json: @taxfree.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @request_service = RequestService.new(request_service_params)\n\n respond_to do |format|\n if @request_service.save\n format.html { redirect_to requests_path, notice: 'Request service was successfully created.' }\n format.json { render :show, status: :created, location: @request_service }\n else\n format.html { render :new }\n format.json { render json: @request_service.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_service_request\n # Geocode the address\n lat, long = Geocoder.coordinates(\"#{self.restaurant_address} , Chicago, IL\") \n\n HTTParty.post('http://311api.cityofchicago.org/open311/v2/requests.json', :body => { \n :api_key => SETTINGS[\"OPEN_311_KEY\"],\n :service_code => '4fd6e4ece750840569000019',\n :attribute => {\n :PLEASESE => 'FOODPOIS',\n :WHATISTH => self.restaurant_name,\n :ONWHATDA => self.date\n },\n :address_string => self.restaurant_address,\n :description => self.description,\n :lat => lat, \n :long => long, \n :first_name => self.first_name,\n :last_name => self.last_name,\n :email => self.email,\n :phone => self.phone\n })\n end",
"def create\n @service = Service.new(params[:service])\n\n respond_to do |format|\n if @service.save\n format.html { redirect_to @service, notice: 'Service was successfully created.' }\n format.json { render json: @service, status: :created, location: @service }\n else\n format.html { render action: \"new\" }\n format.json { render json: @service.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @service = Service.new(params[:service])\n\n respond_to do |format|\n if @service.save\n format.html { redirect_to @service, notice: 'Service was successfully created.' }\n format.json { render json: @service, status: :created, location: @service }\n else\n format.html { render action: \"new\" }\n format.json { render json: @service.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @service = Service.new(service_params)\n\n respond_to do |format|\n if @service.save\n format.html { redirect_to @service, notice: 'Service was successfully created.' }\n format.json { render :show, status: :created, location: @service }\n else\n format.html { render :new }\n format.json { render json: @service.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @service = Service.new(service_params)\n\n respond_to do |format|\n if @service.save\n format.html { redirect_to @service, notice: 'Service was successfully created.' }\n format.json { render :show, status: :created, location: @service }\n else\n format.html { render :new }\n format.json { render json: @service.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @service = Service.new(service_params)\n\n respond_to do |format|\n if @service.save\n format.html { redirect_to @service, notice: 'Service was successfully created.' }\n format.json { render :show, status: :created, location: @service }\n else\n format.html { render :new }\n format.json { render json: @service.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @service = Service.new(service_params)\n\n respond_to do |format|\n if @service.save\n format.html { redirect_to @service, notice: 'Service was successfully created.' }\n format.json { render :show, status: :created, location: @service }\n else\n format.html { render :new }\n format.json { render json: @service.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @service = Service.new(service_params)\n\n respond_to do |format|\n if @service.save\n format.html { redirect_to @service, notice: 'Service was successfully created.' }\n format.json { render :show, status: :created, location: @service }\n else\n format.html { render :new }\n format.json { render json: @service.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @service = Service.new(service_params)\n\n respond_to do |format|\n if @service.save\n format.html { redirect_to @service, notice: 'Service was successfully created.' }\n format.json { render :show, status: :created, location: @service }\n else\n format.html { render :new }\n format.json { render json: @service.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @additional_service = AdditionalService.new(params[:additional_service])\n\n respond_to do |format|\n if @additional_service.save\n format.html { redirect_to @additional_service, notice: 'Additional service was successfully created.' }\n format.json { render json: @additional_service, status: :created, location: @additional_service }\n else\n format.html { render action: \"new\" }\n format.json { render json: @additional_service.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n #@klass_fee = KlassFee.new(params[:klass_fee])\n ap params[:fee]\n begin\n params[:fee].each do |fee_type_id, amount|\n puts \"=======xx==========\"\n ap KlassFee.create({klass_id: @klass.id, fee_type_id: fee_type_id, amount: amount[:amount]})\n end\n \n redirect_to klass_klass_fees_path(@klass), notice: 'Klass fee was successfully created.'\n #rescue Exception => e\n # render action: \"new\" \n end\n end",
"def create\n params[:fee][:amount].gsub!(/[$,]/, '')\n params[:fee][:amount] = (params[:fee][:amount].to_f * 100).to_i\n\n @fee = Fee.new(fee_params)\n @fee.booth = Booth.find(params[:booth_id])\n\n respond_to do |format|\n if @fee.save\n format.html { redirect_to @fee.booth, notice: 'Fee was successfully created.' }\n format.json { render :show, status: :created, location: @fee }\n else\n format.html { render :new }\n format.json { render json: @fee.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @additional_service = AdditionalService.new(additional_service_params)\n\n respond_to do |format|\n if @additional_service.save\n format.html { redirect_to @additional_service, notice: 'Additional service was successfully created.' }\n format.json { render :show, status: :created, location: @additional_service }\n else\n format.html { render :new }\n format.json { render json: @additional_service.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @taxi_sevice = TaxiSevice.new(taxi_sevice_params)\n\n respond_to do |format|\n if @taxi_sevice.save\n format.html { redirect_to action: \"index\" }\n else\n format.html { render :new }\n format.json { render json: @taxi_sevice.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @service = Service.new(service_params)\n\n respond_to do |format|\n if @service.save\n format.html { redirect_to services_url, notice: 'Service was successfully created.' }\n format.json { render :show, status: :created, location: @service }\n else\n format.html { render :new }\n format.json { render json: @service.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @service_particular = ServiceParticular.new(service_particular_params)\n\n respond_to do |format|\n if @service_particular.save\n format.html { redirect_to service_particulars_url, notice: 'Service particular was successfully created.' }\n format.json { render :show, status: :created, location: @service_particular }\n else\n format.html { render :new }\n format.json { render json: @service_particular.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @fee_structure = FeeStructure.new(fee_structure_params)\n\n respond_to do |format|\n if @fee_structure.save\n format.html { redirect_to fee_structures_path, notice: 'Fee structure was successfully created.' }\n format.json { render :show, status: :created, location: @fee_structure }\n else\n format.html { render :new }\n format.json { render json: @fee_structure.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @additionalservice = Additionalservice.new(additionalservice_params)\n\n respond_to do |format|\n if @additionalservice.save\n format.html { redirect_to @additionalservice, notice: 'Additionalservice was successfully created.' }\n format.json { render :show, status: :created, location: @additionalservice }\n else\n format.html { render :new }\n format.json { render json: @additionalservice.errors, status: :unprocessable_entity }\n end\n end\n end",
"def destroy\n @service_fee_master.destroy\n respond_to do |format|\n format.html { redirect_to service_fee_masters_url, notice: 'Service fee master was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def create\n @fabricsofaset = Fabricsofaset.new(fabricsofaset_params)\n\n respond_to do |format|\n if @fabricsofaset.save\n format.html { redirect_to @fabricsofaset, notice: 'Fabricsofaset was successfully created.' }\n format.json { render :show, status: :created, location: @fabricsofaset }\n else\n format.html { render :new }\n format.json { render json: @fabricsofaset.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @freind = Freind.new(freind_params)\n\n respond_to do |format|\n if @freind.save\n format.html { redirect_to @freind, notice: \"Freind was successfully created.\" }\n format.json { render :show, status: :created, location: @freind }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @freind.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @service = @enterprise.services.new(service_params)\n\n respond_to do |format|\n if @service.save\n format.html { redirect_to edit_service_path(@service), notice: 'El servicio ha sido creado satisfactoriamente.' }\n format.json { render :edit, status: :created, location: @service }\n else\n format.html { render :new }\n format.json { render json: @service.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @master_finance = MasterFinance.new(master_finance_params)\n last_master_finance = MasterFinance.last\n\n if last_master_finance\n @master_finance.initial_balance = last_master_finance.final_balance\n end\n\n respond_to do |format|\n if @master_finance.save\n format.html { redirect_to accounting_master_finance_path(@master_finance), notice: \"Finanças Diárias '#{l(@master_finance.date, format: :short)}' foi criada com sucesso!\" }\n format.json { render :show, status: :created, location: @master_finance }\n else\n format.html { render :new }\n format.json { render json: @master_finance.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @customerservice = Customerservice.new(customerservice_params)\n\n respond_to do |format|\n if @customerservice.save\n format.html { redirect_to @customerservice, notice: 'Customerservice was successfully created.' }\n format.json { render :show, status: :created, location: @customerservice }\n else\n format.html { render :new }\n format.json { render json: @customerservice.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @service = Service.new(service_params)\n drivers_for_select\n clients_for_select\n vehicles_for_select\n\n respond_to do |format|\n \n if @service.save\n format.html { redirect_to @service, notice: 'Service was successfully created.' }\n format.json { render :show, status: :created, location: @service }\n else\n @service.build_address\n format.html { render :new }\n format.json { render json: @service.errors, status: :unprocessable_entity }\n end\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 @service_fault = ServiceFault.new(service_fault_params)\n\n respond_to do |format|\n if @service_fault.save\n format.html { redirect_to @service_fault, notice: 'Service fault was successfully created.' }\n format.json { render :show, status: :created, location: @service_fault }\n else\n format.html { render :new }\n format.json { render json: @service_fault.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n sub_cluster = params[\"dtcstaff\"][\"sub_cluster\"]\n @dtc_staff = DtcStaff.new(params[:dtc_staff])\n @dtc_staff.subcluster(sub_cluster)\n respond_to do |format|\n if @dtc_staff.save\n\n format.html { redirect_to dtc_staffs_url, notice: 'Route Associated' }\n format.json { render action: 'show', status: :created, location: @dtc_staff }\n else\n format.html { render action: 'new' }\n format.json { render json: @dtc_staff.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @contract_service = ContractService.new(contract_service_params)\n\n respond_to do |format|\n if @contract_service.save\n format.html { redirect_to @contract_service, notice: 'Contract service was successfully created.' }\n format.json { render :show, status: :created, location: @contract_service }\n else\n format.html { render :new }\n format.json { render json: @contract_service.errors, status: :unprocessable_entity }\n end\n end\n end",
"def referral_service_params\n params.require(:referral_service).permit(:content_creator_id, :campaign_id, :employee_name)\n end",
"def create\n @service_mechanic = ServiceMechanic.new(service_mechanic_params)\n\n respond_to do |format|\n if @service_mechanic.save\n format.html { redirect_to service_mechanics_url, notice: 'Service mechanic was successfully created.' }\n format.json { render :index, status: :created, location: @service_mechanic }\n else\n format.html { render :new }\n format.json { render json: @service_mechanic.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @fee = Fee.new(fee_params)\n @fee.user_id = current_user.id\n\n respond_to do |format|\n if @fee.save\n format.html { redirect_to @fee, notice: 'Fee was successfully created.' }\n format.json { render :show, status: :created, location: @fee }\n else\n format.html { render :new }\n format.json { render json: @fee.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @admin_service = Admin::Service.new(admin_service_regex_params)\n\n respond_to do |format|\n if @admin_service.save\n format.html { redirect_to @admin_service, notice: 'Platform was successfully created.' }\n format.json { render :show, status: :created, location: @admin_service }\n else\n format.html { render :new }\n format.json { render json: @admin_service.errors, status: :unprocessable_entity }\n end\n end\n end",
"def masterservice_params\n params.require(:masterservice).permit(:name, :description)\n end",
"def service_params\n params.require(:service).permit(:code, :name, :cost, :price, :tax1_name, :tax1, :quantity, :description, :comments, :company_id, :discount, :currtotal,:cuenta)\n end",
"def create\n @service = Service.new(service_params)\n @service.user_id = @user.id\n @service.co_confirmacion = @service.get_cod_confirmacion\n @service.status_id = 1\n\n respond_to do |format|\n if @service.save\n format.html { redirect_to [@user,@service], notice: 'Service was successfully created.' }\n format.json { render :show, status: :created, location: @service }\n else\n format.html { render :new }\n format.json { render json: @service.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @referral_sale = ReferralSale.new(referral_sale_params)\n\n respond_to do |format|\n if @referral_sale.save\n format.html { redirect_to @referral_sale, notice: I18n.t(:referral_sale_create_suces) }\n format.json { render :show, status: :created, location: @referral_sale }\n else\n format.html { render :new }\n format.json { render json: @referral_sale.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n passenger = Passenger.new(:name => params[:name], :contact_number => params[:contact_number], :nationality => params[:nationality], :meal_pref => params[:meal_pref])\n passenger.save\n render :json => passenger\n end",
"def create\n Rails.logger.debug \"Creating a FAX\"\n @fax_job = FaxJob.new(fax_job_params)\n\n respond_to do |format|\n if @fax_job.save\n\t@fax_job.send_fax\n format.html { redirect_to @fax_job, notice: 'Fax job was successfully created.' }\n format.json { render :show, status: :created, location: @fax_job }\n else\n format.html { render :new }\n format.json { render json: @fax_job.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n # service = params[:service]\n # @service = Service.new(description: service[:description], availablity: service[:availability], more_information: service[:more_information])\n @service = Service.new(service_params)\n @service.user = current_user \n @service.save\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 gateway = SMSGateway.new\n @delivery = Delivery.new(delivery_params)\n @delivery.commodity_id = params[:delivery][:commodity]\n @delivery.farmer_id = params[:delivery][:farmer]\n @delivery.price = Commodity.find(@delivery.commodity_id).latest_price\n @delivery.total = delivery_params[:quantity].to_i * @delivery.price\n @delivery.user_id = current_user.id\n @delivery.paid_for = delivery_params[:paid_for] == \"1\"\n\n respond_to do |format|\n if @delivery.save\n gateway.send(@delivery.farmer.phone_number, \"Hi, #{@delivery.delivered_by}. We have taken note of your delivery of #{@delivery.quantity} litres of milk and you will be dully compensated. Thanks.\")\n if @delivery.paid_for\n create_payment(@delivery)\n end\n format.html { redirect_to deliveries_path, notice: 'Delivery was successfully created.' }\n format.json { render :show, status: :created, location: @delivery }\n else\n format.html { render :new }\n format.json { render json: @delivery.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @serviceman = Serviceman.new(serviceman_params)\n\n respond_to do |format|\n if @serviceman.save\n format.html { redirect_to @serviceman, notice: 'Serviceman was successfully created.' }\n format.json { render :show, status: :created, location: @serviceman }\n else\n format.html { render :new }\n format.json { render json: @serviceman.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @delivery_man = DeliveryMan.new(delivery_man_params)\n\n if @delivery_man.save\n render json: @delivery_man, status: :created, location: @delivery_man\n else\n render json: @delivery_man.errors, status: :unprocessable_entity\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 postContractCreate( entity_id, user_id, payment_provider, basket, billing_period, source, channel, campaign, referrer_domain, referrer_name, flatpack_id)\n params = Hash.new\n params['entity_id'] = entity_id\n params['user_id'] = user_id\n params['payment_provider'] = payment_provider\n params['basket'] = basket\n params['billing_period'] = billing_period\n params['source'] = source\n params['channel'] = channel\n params['campaign'] = campaign\n params['referrer_domain'] = referrer_domain\n params['referrer_name'] = referrer_name\n params['flatpack_id'] = flatpack_id\n return doCurl(\"post\",\"/contract/create\",params)\n end",
"def create\n @service = Service.new(params[:service])\n\n respond_to do |format|\n if @service.save\n format.html { redirect_to(admin_service_path(@service), :notice => 'Service was successfully created.') }\n format.xml { render :xml => @service, :status => :created, :location => @service }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @service.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def financer_master_params\n params.require(:financer_master).permit(:code, :name, :description, :pin_code, :place, :address, :contact_no, :email, :contact_person, :status)\n end",
"def create\n @service = Service.new(service_params)\n @service.published = false\n\n respond_to do |format|\n if @service.save\n format.html { redirect_to [:admin,@service], notice: 'Feito! Empresa criada' }\n format.json { render :show, status: :created, location: @service }\n else\n format.html { render :new }\n format.json { render json: @service.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @service_center = ServiceCenter.new(service_center_params)\n\n respond_to do |format|\n if @service_center.save\n format.html { redirect_to @service_center, notice: 'Service center was successfully created.' }\n format.json { render :show, status: :created, location: @service_center }\n else\n format.html { render :new }\n format.json { render json: @service_center.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @service = Service.create(service_params)\n end",
"def create\n @service = current_user.services.build(service_params)\n respond_to do |format|\n if @service.save\n format.html { redirect_to dashboard_path, notice: 'Service was successfully created.' }\n format.json { render :show, status: :created, location: @service }\n else\n format.html { render :new }\n format.json { render json: @service.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @suggested_business = SuggestedBusiness.new(suggested_business_params)\n\n respond_to do |format|\n if @suggested_business.save\n format.html { redirect_to root_path, notice: 'The Busienss entry has succesfully been sent.' }\n else\n format.html { render :new }\n format.json { render json: @suggested_business.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 @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 @final_service = FinalService.new(params[:final_service])\n\n respond_to do |format|\n if @final_service.save\n format.html { redirect_to(@final_service, :notice => 'FinalService was successfully created.') }\n format.xml { render :xml => @final_service, :status => :created, :location => @final_service }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @final_service.errors, :status => :unprocessable_entity }\n end\n end\n end"
] | [
"0.6352072",
"0.6292741",
"0.6271491",
"0.60904247",
"0.59160525",
"0.5911744",
"0.587214",
"0.58307415",
"0.5817307",
"0.57919586",
"0.5708881",
"0.5687162",
"0.56744826",
"0.5671503",
"0.5668393",
"0.5658906",
"0.5593016",
"0.5574562",
"0.5570478",
"0.5556146",
"0.553897",
"0.5511509",
"0.5500954",
"0.54742235",
"0.54726905",
"0.546519",
"0.54643613",
"0.54540336",
"0.54502827",
"0.54411125",
"0.54284596",
"0.54250693",
"0.5417651",
"0.5412562",
"0.5405326",
"0.54036254",
"0.5398662",
"0.5391439",
"0.5386004",
"0.5378046",
"0.5375664",
"0.5372874",
"0.5368498",
"0.5367233",
"0.53642446",
"0.5360449",
"0.5360449",
"0.53584445",
"0.53584445",
"0.53584445",
"0.53584445",
"0.53584445",
"0.53584445",
"0.53527325",
"0.5352393",
"0.5346807",
"0.53457516",
"0.53437877",
"0.5341186",
"0.53386015",
"0.53365564",
"0.5330804",
"0.5324947",
"0.52995765",
"0.5292062",
"0.5291911",
"0.5288594",
"0.5283517",
"0.5275231",
"0.5274777",
"0.52742684",
"0.52724624",
"0.52687335",
"0.5257966",
"0.52549565",
"0.52526736",
"0.5246193",
"0.52382296",
"0.52381766",
"0.5235561",
"0.52323496",
"0.522912",
"0.5227388",
"0.5224744",
"0.5224413",
"0.5224018",
"0.5219482",
"0.5218259",
"0.5217907",
"0.5213778",
"0.5207432",
"0.520483",
"0.5203866",
"0.5194851",
"0.5194731",
"0.51928806",
"0.5192719",
"0.51914215",
"0.51838756",
"0.5181116"
] | 0.5768649 | 10 |
PATCH/PUT /service_fee_masters/1 PATCH/PUT /service_fee_masters/1.json | def update
respond_to do |format|
@lab_services = LabService.order(:title).where("title ilike ?", "%#{params[:service_id]}")
@lab_list = @lab_services.map { |a|[a.title+" ",a.id] }
if @service_fee_master.update(service_fee_master_params)
format.js {flash[:notice] = "Service Price updated successfully"}
render js: "window.location='#{service_fee_masters_path}'"
# format.html { redirect_to @service_fee_master, notice: 'Service fee master was successfully updated.' }
format.json { render :show, status: :ok, location: @service_fee_master }
else
format.js { render :edit }
# format.html { render :edit }
format.json { render json: @service_fee_master.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_service_fee_master\n @service_fee_master = ServiceFeeMaster.find(params[:id])\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 respond_to do |format|\n if @tenant_fee.update(tenant_fee_params)\n format.html { redirect_to @tenant_fee, notice: 'Tenant fee was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :edit }\n format.json { render json: @tenant_fee.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\n @service = Service.find(params[:id])\n respond_to do |format|\n if @service.update_attributes(service_params)\n format.html { redirect_to @customer, success: 'Service was successfully updated.' }\n format.json { respond_with_bip(@service) }\n else\n format.html { render action: 'edit'}\n format.json { respond_with_bip(@service) }\n end\n end\n end",
"def service_fee_master_params\n params.require(:service_fee_master).permit(:appt_type_id, :service_id, :req_urgency, :fee, :fee, :comment, :user_id, :active_status, :del_status)\n end",
"def update\n #@service_request = ServiceRequest.find(params[:id])\n\n respond_to do |format|\n if @service_request.update_attributes(service_request_params)\n format.html { redirect_to @service_request, notice: 'Service request was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @service_request.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @fee = Fee.find(params[:id])\n\n respond_to do |format|\n if @fee.update_attributes(params[:fee])\n format.html { redirect_to fees_path, notice: 'Fee was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @fee.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @fee.update(fee_params)\n format.html { redirect_to @fee, notice: 'Fee was successfully updated.' }\n format.json { render :show, status: :ok, location: @fee }\n else\n format.html { render :edit }\n format.json { render json: @fee.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @fee.update(fee_params)\n format.html { redirect_to @fee, notice: 'Fee was successfully updated.' }\n format.json { render :show, status: :ok, location: @fee }\n else\n format.html { render :edit }\n format.json { render json: @fee.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @appraisal_fee.update(appraisal_fee_params)\n format.html { redirect_to appraisal_fees_path, notice: 'Appraisal fee was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @appraisal_fee.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 remove_extra_value_from_hash(request.params,params[:service][:ccs_service_id])\n respond_to do |format|\n if @service.update(service_params)\n format.html { redirect_to services_path, notice: 'Service was successfully updated.' }\n format.json { render :show, status: :ok, location: @service }\n else\n format.html { render :edit }\n format.json { render json: @service.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 @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 respond_to do |format|\n if @shipping_fee.update_attributes(shipping_fee_params)\n format.html { redirect_to action: :index, notice: 'Update Success.' }\n format.json { render action: :index, status: :accepted }\n else\n format.html { render action: :edit }\n format.json { render json: @shipping_fee.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @commission_fixing = CommissionFixing.find(params[:id])\n if @commission_fixing.update_attributes(params[:commission_fixing])\n render :json=>{:response=>\"success\"}\n else\n render :json=>failure1(@commission_fixing.errors)\n end \n end",
"def update\n service.update_attributes(service_params)\n\n respond_with(service)\n end",
"def update\n service.update(service_params)\n\n respond_with(service)\n end",
"def update\n @food_coupan_master.update(food_coupan_master_params)\n @food_coupan_masters = FoodCoupanMaster.all\n @food_coupan_master = FoodCoupanMaster.new\n end",
"def update\n @service_email = ServiceEmail.first\n\n respond_to do |format|\n if @service_email.update_attributes(params[:service_email])\n format.html { redirect_to admin_experiences_path, notice: 'Service email was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @service_email.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n authorize @incoming_service_tax\n\n respond_to do |format|\n if @incoming_service_tax.update(incoming_service_tax_params)\n format.html { redirect_to @incoming_service_tax, notice: 'Incoming service tax was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @incoming_service_tax.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n #@klass_fee = KlassFee.find(params[:id])\n\n respond_to do |format|\n if @klass_fee.update_attributes(params[:klass_fee])\n format.html { redirect_to klass_klass_fees_path(@klass), notice: 'Klass fee was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @klass_fee.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @service_fault.update(service_fault_params)\n format.html { redirect_to @service_fault, notice: 'Service fault was successfully updated.' }\n format.json { render :show, status: :ok, location: @service_fault }\n else\n format.html { render :edit }\n format.json { render json: @service_fault.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 @request_service.update(request_service_params)\n format.html { redirect_to @request_service, notice: 'Request service was successfully updated.' }\n format.json { render :show, status: :ok, location: @request_service }\n else\n format.html { render :edit }\n format.json { render json: @request_service.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n sub_cluster = params[\"dtcstaff\"][\"sub_cluster\"]\n @dtc_staff.subcluster(sub_cluster) \n respond_to do |format|\n if @dtc_staff.update(params[:dtc_staff])\n format.html { redirect_to dtc_staffs_url, notice: 'Route Updated' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @dtc_staff.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\n @membership_fee = MembershipFee.find(params[:id])\n\n respond_to do |format|\n if @membership_fee.update_attributes(params[:membership_fee])\n format.html { redirect_to @membership_fee, notice: 'Membership fee was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @membership_fee.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if @service.update(service_params)\n render json: @service, status: :ok, location: @service\n else\n render json: @service.errors, status: :unprocessable_entity\n end\n end",
"def update\n respond_to do |format|\n if @pay_fee.update(pay_fee_params)\n format.html { redirect_to @pay_fee, notice: 'Pay fee was successfully updated.' }\n format.json { render :show, status: :ok, location: @pay_fee }\n else\n format.html { render :edit }\n format.json { render json: @pay_fee.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @scheduled_service = ScheduledService.find(params[:id])\n\n respond_to do |format|\n if @scheduled_service.update_attributes(params.require(:scheduled_service).permit(:mileage, :sdate, :service_schedule_id))\n format.html { redirect_to scheduled_services_url,\n notice: 'ScheduledService was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @scheduled_service.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update \n staff = Staff.find(params[:id])\n #assign new attributes\n staff.assign_attributes(staff_params)\n ## check for any validations \n if staff.valid?\n staff.save \n render json: staff\n else \n reder json: staff.errors.full_messages\n end \n\n end",
"def update\n respond_to do |format|\n if @service.update(service_params)\n format.html { redirect_to supplier_service_path(@supplier, @service), notice: 'Service was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @service.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @service = Service.find(params[:id])\n\n respond_to do |format|\n if @service.update_attributes(params[:service])\n format.html { redirect_to @service, notice: 'Service was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @service.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @service = Service.find(params[:id])\n\n respond_to do |format|\n if @service.update_attributes(params[:service])\n format.html { redirect_to @service, notice: 'Service was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @service.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 @fee.update(fee_params)\n format.html { redirect_to book_fee_path(@book,@fee), notice: '费项更新成功.' }\n format.json { render :show, status: :ok, location: @fee }\n else\n format.html { render :edit }\n format.json { render json: @fee.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @additional_service = AdditionalService.find(params[:id])\n\n respond_to do |format|\n if @additional_service.update_attributes(params[:additional_service])\n format.html { redirect_to @additional_service, notice: 'Additional service was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @additional_service.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 respond_to do |format|\n if @service_particular.update(service_particular_params)\n format.html { redirect_to @service_particular, notice: 'Service particular was successfully updated.' }\n format.json { render :show, status: :ok, location: @service_particular }\n else\n format.html { render :edit }\n format.json { render json: @service_particular.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @ressources = MaintenanceRessource.order(:service_id, :name);\n @maintenance.creator_id = current_user.utilisateur.id\n @maintenance.contact_id = @maintenance.creator_id if @maintenance.contact_id.nil?\n respond_to do |format|\n if @maintenance.update(maintenance_params)\n format.html { redirect_to maintenances_url, notice: \"Maintenance was successfully updated.\" }\n format.json { render :show, status: :ok, location: @maintenance }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @maintenance.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @terms_of_service.update(terms_of_service_params)\n format.html { redirect_to @terms_of_service, notice: 'Terms of service was successfully updated.' }\n format.json { render :show, status: :ok, location: @terms_of_service }\n else\n format.html { render :edit }\n format.json { render json: @terms_of_service.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @fabricsofaset.update(fabricsofaset_params)\n format.html { redirect_to @fabricsofaset, notice: 'Fabricsofaset was successfully updated.' }\n format.json { render :show, status: :ok, location: @fabricsofaset }\n else\n format.html { render :edit }\n format.json { render json: @fabricsofaset.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @contractor_feature = ContractorFeature.find(params[:id])\n\n respond_to do |format|\n if @contractor_feature.update_attributes(params[:contractor_feature])\n format.html { redirect_to @contractor_feature, notice: 'Contractor feature was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @contractor_feature.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @servicetype = Servicetype.find(params[:id])\n\n respond_to do |format|\n if @servicetype.update_attributes(params[:servicetype])\n format.html { redirect_to @servicetype, :notice => 'Servicetype was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @servicetype.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @contract_service.update(contract_service_params)\n format.html { redirect_to @contract_service, notice: 'Contract service was successfully updated.' }\n format.json { render :show, status: :ok, location: @contract_service }\n else\n format.html { render :edit }\n format.json { render json: @contract_service.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @service_request.update(service_request_params)\n format.html { redirect_to @service_request, notice: 'Service request was successfully updated.' }\n format.json { render :show, status: :ok, location: @service_request }\n else\n format.html { render :edit }\n format.json { render json: @service_request.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\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 @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 update\n respond_to do |format|\n if @claim.update(claim_params)\n format.html { redirect_to @claim, notice: 'Claim was successfully updated.' }\n format.js\n else\n format.html { render :edit }\n format.js { render 'addService' }\n end\n end\n end",
"def update\n @servicetype = Servicetype.find(params[:id])\n\n respond_to do |format|\n if @servicetype.update_attributes(params[:servicetype])\n format.html { redirect_to @servicetype, notice: 'Servicetype was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @servicetype.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @supermarket = Supermarket.find(params[:id]) \n respond_to do |format|\n if @supermarket.update(supermarket_params)\n format.json { render json: @supermarket, status: :ok }\n end\n end\n end",
"def update\n @service.update(service_params)\n end",
"def update\n @service.update(service_params)\n end",
"def update\n @bonus_master.update(bonus_master_params)\n @bonus_masters = BonusMaster.all\n @bonus_master = BonusMaster.new\n end",
"def update\r\n respond_to do |format|\r\n if @service.update(service_params)\r\n format.html { redirect_to \"/enter/companies/#{@service.company_id}/services/#{@service.id}\",method: :get, notice: 'Service was successfully updated.' }\r\n format.json { render :show, status: :ok, location: @service }\r\n else\r\n format.html { render :edit }\r\n format.json { render json: @service.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end",
"def patch\n headers = {\"If-Match\" => @version}\n response = @context.request :patch, \"#{@path}/#{@id}\", @data.to_json, headers\n @version += 1\n response\n # 'X-HTTP-Method-Override' => 'PATCH'\n end",
"def update\n respond_to do |format|\n if @fee_structure.update(fee_structure_params)\n format.html { redirect_to fee_structures_path, notice: 'Fee structure was successfully updated.' }\n format.json { render :show, status: :ok, location: @fee_structure }\n else\n format.html { render :edit }\n format.json { render json: @fee_structure.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @service_request = ServiceRequest.find(params[:id])\n\n respond_to do |format|\n if @service_request.update_attributes(params[:service_request])\n format.html { redirect_to(@service_request, :notice => 'Service request was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @service_request.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @service.update(service_params)\n format.html { redirect_to @service, notice: 'Service was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @service.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @calificacion_servicio = CalificacionServicio.find(params[:id])\n\n respond_to do |format|\n if @calificacion_servicio.update_attributes(params[:calificacion_servicio])\n format.html { redirect_to @calificacion_servicio, notice: 'Calificacion servicio was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @calificacion_servicio.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @agency = Agency.find(params[:id])\n\n if @agency.update(agency_params)\n #head :no_content\n render json: @agency, status: :accepted, location: @agency #sera? status accepted? \n else\n render json: @agency.errors, status: :unprocessable_entity\n end\n end",
"def update\n @service = Service.find(params[:id])\n\n respond_to do |format|\n if @service.update_attributes(params[:service])\n @service.add_parts(params[:parts])\n format.html { redirect_to(admin_service_path(@service), :notice => 'Service was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @service.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n budgets = update_budgets(params[:budgets])\n\n render json: budgets, status: :ok\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 respond_to do |format|\n if @service_request.update(service_request_params)\n format.html { redirect_to user_service_requests, flash[:success] = 'Service request was successfully updated.' }\n format.json { render :show, status: :ok, location: @service_request }\n else\n format.html { render :edit }\n format.json { render json: @service_request.errors, status: :unprocessable_entity }\n end\n end\n end",
"def patch!\n request! :patch\n end",
"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 @shipping_fee = ShippingFee.find(params[:id])\n\n respond_to do |format|\n if @shipping_fee.update_attributes(params[:shipping_fee])\n format.html { redirect_to(@shipping_fee, :notice => '更新成功!') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @shipping_fee.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 @servicerequest.update(servicerequest_params)\n @servicerequest.seccion = @servicerequest.seccion.upcase\n @servicerequest.contacto_int = @servicerequest.contacto_int.upcase\n @servicerequest.correo_int = @servicerequest.correo_int.upcase\n @servicerequest.observacion = @servicerequest.observacion.upcase\n respond_to do |format|\n if @servicerequest.save\n format.html { redirect_to servicerequests_url, notice: 'Service request was successfully updated.' }\n format.json { render :show, status: :ok, location: @servicerequest }\n else\n format.html { render :edit }\n format.json { render json: @servicerequest.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @spoofer = Spoofer.find(params[:id])\n\n respond_to do |format|\n if @spoofer.update_attributes(params[:spoofer])\n format.html { redirect_to @spoofer, notice: 'Spoofer was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @spoofer.errors, status: :unprocessable_entity }\n end\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 @customer_service.update(customer_service_params)\n format.html { redirect_to @customer_service, notice: 'Customer service was successfully updated.' }\n format.json { render :show, status: :ok, location: @customer_service }\n else\n format.html { render :edit }\n format.json { render json: @customer_service.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @fabric = Fabric.find(params[:id])\n\n respond_to do |format|\n if @fabric.update_attributes(params[:fabric])\n format.html { redirect_to @fabric, notice: 'Fabric was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @fabric.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @service.update(service_params) \n format.js { }\n else\n format.html { render :edit }\n format.json { render json: @service.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 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 @service_level_agreement = current_user.company.service_level_agreements.find(params[:id])\n\n if @service_level_agreement.update_attributes(params[:service_level_agreement])\n render :json => {:success => true}\n else\n render :json => {:success => false, :message => @service_level_agreement.errors.full_messages.join(\". \") }\n end\n end",
"def update\n @bus_service = BusService.find(params[:id],:include => :students)\n\n respond_to do |format|\n if @bus_service.update_attributes(params[:bus_service])\n format.html { redirect_to(@bus_service, :notice => 'BusService was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @bus_service.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @branch.update(branch_params.map{|k,v| {k.to_sym => v.to_s}.except!(:contact_attributes,:address_attributes) }.reduce({}, :merge)) && @branch.address.update(branch_params[:address_attributes]) && @branch.contact.update(branch_params[:contact_attributes])\n format.html { redirect_to @branch, notice: 'Branch was successfully updated.' }\n format.json { render :show, status: :ok, location: @branch }\n else\n format.html { render :edit }\n format.json { render json: @branch.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @master_plan = MasterPlan.find(params[:id])\n\n respond_to do |format|\n if @master_plan.update_attributes(params[:master_plan])\n format.html { redirect_to master_plan_path(@master_plan), notice: 'Master plan was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @master_plan.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @additional_service.update(additional_service_params)\n format.html { redirect_to @additional_service, notice: 'Additional service was successfully updated.' }\n format.json { render :show, status: :ok, location: @additional_service }\n else\n format.html { render :edit }\n format.json { render json: @additional_service.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @complex_service = ComplexService.find(params[:id])\n\n respond_to do |format|\n if @complex_service.update_attributes(params[:complex_service])\n format.html { redirect_to(@complex_service, :notice => 'ComplexService was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @complex_service.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update # PATCH\n raise NotImplementedError\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 @demand = Demand.find(params[:id])\n @demand.user_id = current_user.id\n @user = User.find(@demand.user_id)\n\n respond_to do |format|\n if @demand.update_attributes(params[:demand])\n Notifier.processed_demands(@demand,@user).deliver if Rails.env.production?\n format.html { redirect_to services_path, notice: '申し込みは正常に処理されました' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @demand.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @additionalservice.update(additionalservice_params)\n format.html { redirect_to @additionalservice, notice: 'Additionalservice was successfully updated.' }\n format.json { render :show, status: :ok, location: @additionalservice }\n else\n format.html { render :edit }\n format.json { render json: @additionalservice.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 @taxi_sevice.update(taxi_sevice_params)\n format.html { redirect_to action: \"index\" }\n format.json { render :show, status: :ok, location: @taxi_sevice }\n else\n format.html { render :edit }\n format.json { render json: @taxi_sevice.errors, status: :unprocessable_entity }\n end\n end\n end",
"def 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 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 respond_to do |format|\n if @service.update(service_params)\n format.html { redirect_to services_url, notice: \"Service was successfully updated.\" }\n format.json { render :show, status: :ok, location: @service }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @service.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @service.update(service_params)\n format.html { redirect_to edit_service_path(@service), notice: 'El servicio ha sido actualizado satisfactoriamente.' }\n format.json { render :edit, status: :ok, location: @service }\n else\n format.html { render :edit }\n format.json { render json: @service.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @flight = Flight.find(params[:id])\n\n if @flight.update(params[:flight])\n head :no_content\n else\n render json: @flight.errors, status: :unprocessable_entity\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 @college_fee = CollegeFee.find(params[:id])\n\n respond_to do |format|\n if @college_fee.update_attributes(params[:college_fee])\n format.html { redirect_to @college_fee, notice: 'College fee was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @college_fee.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_service_master\n @service_master = ServiceMaster.find(params[:id])\n end"
] | [
"0.66956145",
"0.62606007",
"0.6223662",
"0.6200142",
"0.618547",
"0.60530746",
"0.60413677",
"0.59918755",
"0.59916294",
"0.59193003",
"0.59193003",
"0.5904678",
"0.59031504",
"0.58763945",
"0.5853103",
"0.5849413",
"0.5844674",
"0.5827796",
"0.58174866",
"0.58031285",
"0.5792868",
"0.5790609",
"0.5781791",
"0.57787126",
"0.5741983",
"0.5737317",
"0.5733365",
"0.5697652",
"0.5683357",
"0.568145",
"0.5677415",
"0.56635875",
"0.56623477",
"0.5651286",
"0.56489474",
"0.56431705",
"0.56431705",
"0.56429654",
"0.5636548",
"0.5625898",
"0.56254566",
"0.56236464",
"0.56132764",
"0.56028354",
"0.55988204",
"0.55935276",
"0.55895305",
"0.5580456",
"0.55780417",
"0.5572759",
"0.5568811",
"0.55654275",
"0.55609876",
"0.55533034",
"0.5545456",
"0.5545456",
"0.5545124",
"0.55428815",
"0.5533876",
"0.55318516",
"0.55216396",
"0.5519303",
"0.5517448",
"0.5517164",
"0.5513599",
"0.5513264",
"0.5512983",
"0.55129206",
"0.54971915",
"0.5496311",
"0.54957575",
"0.54938334",
"0.5483892",
"0.5482314",
"0.54795253",
"0.5474006",
"0.5460778",
"0.54579276",
"0.54508215",
"0.5450471",
"0.5450194",
"0.5445756",
"0.5444987",
"0.5442501",
"0.5440347",
"0.5436179",
"0.5431139",
"0.5429258",
"0.5404916",
"0.54015785",
"0.54000187",
"0.53996426",
"0.5398782",
"0.53972393",
"0.5395426",
"0.53910714",
"0.53863674",
"0.5384083",
"0.5382031",
"0.5379432"
] | 0.59294426 | 9 |
DELETE /service_fee_masters/1 DELETE /service_fee_masters/1.json | def destroy
@service_fee_master.destroy
respond_to do |format|
format.html { redirect_to service_fee_masters_url, notice: 'Service fee master was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete_tenant_circle(args = {}) \n delete(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend",
"def destroy\n #@service_request = ServiceRequest.find(params[:id])\n @service_request.destroy\n\n respond_to do |format|\n format.html { redirect_to service_requests_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @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 @service_dependance = ServiceDependance.find(params[:id])\n @service_dependance.destroy\n\n respond_to do |format|\n format.html { redirect_to service_dependances_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @multi_agent_service.destroy\n respond_to do |format|\n format.html { redirect_to multi_agent_services_url, notice: 'Entry was successfully destroyed.' }\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 delete_aos_version(args = {}) \n delete(\"/aosversions.json/#{args[:aosVersionId]}\", args)\nend",
"def destroy\n authorize @incoming_service_tax\n\n @incoming_service_tax.destroy\n respond_to do |format|\n format.html { redirect_to incoming_service_taxes_url }\n format.json { head :no_content }\n end\n end",
"def delete\n svc = Service.find_by_label(params[:label])\n raise CloudError.new(CloudError::SERVICE_NOT_FOUND) unless svc\n raise CloudError.new(CloudError::FORBIDDEN) unless svc.verify_auth_token(@service_auth_token)\n\n svc.destroy\n\n render :json => {}\n end",
"def destroy\n @tenant_fee.destroy\n respond_to do |format|\n format.html { redirect_to tenant_fees_url, notice: 'Tenant fee was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @fee = Fee.find(params[:id])\n @fee.destroy\n\n respond_to do |format|\n format.html { redirect_to fees_url }\n format.json { head :no_content }\n end\n end",
"def delete\n client.delete(\"/#{id}\")\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 #@klass_fee = KlassFee.find(params[:id])\n #@klass_fee.destroy\n\n respond_to do |format|\n format.html { redirect_to klass_fees_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @taxi_sevice.destroy\n respond_to do |format|\n format.html { redirect_to taxi_sevices_url, notice: 'Taxi sevice was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @service = Service.find(params[:id])\n @service.destroy\n\n respond_to do |format|\n format.html { redirect_to manage_services_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @service.destroy\n respond_to do |format|\n format.html { redirect_to admin_services_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @fee.destroy\n respond_to do |format|\n format.html { redirect_to @fee.booth, flash: { warning: 'Fee was deleted.' } }\n format.json { head :no_content }\n end\n end",
"def destroy\n @service_fault.destroy\n respond_to do |format|\n format.html { redirect_to service_faults_url, notice: 'Service fault was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @fee.destroy\n respond_to do |format|\n format.html { redirect_to fees_url, notice: 'Fee was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @fee.destroy\n respond_to do |format|\n format.html { redirect_to fees_url, notice: 'Fee 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 incident_delete(statuspage_id, incident_id)\n data = {}\n data['statuspage_id'] = statuspage_id\n data['incident_id'] = incident_id\n\n request :method => :post,\n :url => @url + 'incident/delete',\n :payload => data\n end",
"def destroy\n @additional_service = AdditionalService.find(params[:id])\n @additional_service.destroy\n\n respond_to do |format|\n format.html { redirect_to additional_services_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @consensu = Consensu.find(params[:id])\n @consensu.destroy\n\n respond_to do |format|\n format.html { redirect_to consensus_url }\n format.json { head :no_content }\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 @service = Service.find(params[:id])\n @service.destroy\n\n respond_to do |format|\n format.html { redirect_to services_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @service = Service.find(params[:id])\n @service.destroy\n\n respond_to do |format|\n format.html { redirect_to services_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @service = Service.find(params[:id])\n @service.destroy\n\n respond_to do |format|\n format.html { redirect_to services_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @service = Service.find(params[:id])\n @service.destroy\n\n respond_to do |format|\n format.html { redirect_to services_url }\n format.json { head :ok }\n end\n end",
"def service_group_delete(a10, name)\n a10.send(:axapi, 'slb.service_group.delete', 'post', {name: name, format: 'json'})\nend",
"def destroy\n @appraisal_fee.destroy\n respond_to do |format|\n format.html { redirect_to appraisal_fees_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @service_level_agreement = current_user.company.service_level_agreements.find(params[:id])\n @service_level_agreement.destroy\n\n render :json => {:success => true}\n end",
"def delete\n supprimer = SondageService.instance.supprimerSondage(params[:id])\n (supprimer) ? (render json: true, status: :ok) : (render json: false, status: :not_found)\nend",
"def destroy\n @service.update_column(:deleted, true)\n respond_to do |format|\n format.html { redirect_to admin_services_url, notice: 'Service was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def deletef\n url = prefix + \"deletef\" + id_param\n return response(url)\n end",
"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 @pay_fee.destroy\n respond_to do |format|\n format.html { redirect_to pay_fees_url, notice: 'Pay fee was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete endpoint\n do_request :delete, endpoint\n end",
"def cfa_delete\n Rails.logger.info_log.info \" I,[#{Time.now.strftime(\"%Y-%m-%d %H:%M:%S %Z\")}]\" \"INFO -- : Entered in cfa titles cfa_delete method\"\n begin\n id=params[\"format\"] \n cfa=RestClient.delete $api_service+'/cfa_titles/'+id\n rescue =>e\n Rails.logger.custom_log.error { \"#{e} Cfa controller delete method\" }\n end\n redirect_to action: \"index\"\n end",
"def destroy\n @serviceordemservice.destroy\n respond_to do |format|\n format.html { redirect_to serviceordemservices_url, notice: 'Serviceordemservice was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def maintenance_delete(statuspage_id, maintenance_id)\n data = {}\n data['statuspage_id'] = statuspage_id\n data['maintenance_id'] = maintenance_id\n\n request :method => :post,\n :url => @url + 'maintenance/delete',\n :payload => data\n end",
"def destroy\n @service = Service.find(params[:id])\n @service.destroy\n\n respond_to do |format|\n format.html { redirect_to(admin_services_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @membership_fee = MembershipFee.find(params[:id])\n @membership_fee.destroy\n\n respond_to do |format|\n format.html { redirect_to membership_fees_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @additional_service.destroy\n respond_to do |format|\n format.html { redirect_to additional_services_url, notice: 'Additional service was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @service.destroy\n respond_to do |format|\n format.html { redirect_to services_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @service_request.destroy\n respond_to do |format|\n format.html { redirect_to service_requests_url, notice: 'Service request was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @service_request.destroy\n respond_to do |format|\n format.html { redirect_to service_requests_url, notice: 'Service request was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @service_request.destroy\n respond_to do |format|\n format.html { redirect_to service_requests_url, notice: 'Service request was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @fee_structure.destroy\n respond_to do |format|\n format.html { redirect_to fee_structures_url, notice: 'Fee structure was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @fabric = Fabric.find(params[:id])\n @fabric.destroy\n\n respond_to do |format|\n format.html { redirect_to fabrics_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n record = TaxRule.find(params[:id])\n record.trash\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"def destroy\n @additionalservice.destroy\n respond_to do |format|\n format.html { redirect_to additionalservices_url, notice: 'Additionalservice was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @service_particular.destroy\n respond_to do |format|\n format.html { redirect_to service_particulars_url, notice: 'Service particular was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete\n response = WebPay.client.delete(path)\n response['deleted']\n end",
"def destroy\n @service_request = ServiceRequest.find(params[:id])\n @service_request.destroy\n\n respond_to do |format|\n format.html { redirect_to(service_requests_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @fabrica.destroy\n respond_to do |format|\n format.html { redirect_to fabricas_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @servicerequest.destroy\n respond_to do |format|\n format.html { redirect_to servicerequests_url, notice: 'Service request was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @taxirequest = Taxirequest.find(params[:id])\n @taxirequest.destroy\n\n respond_to do |format|\n format.html { redirect_to taxirequests_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @terms_of_service.destroy\n respond_to do |format|\n format.html { redirect_to terms_of_services_url, notice: 'Terms of service was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @loadbalancer = Loadbalancer.find(params[:id])\n checkaccountobject(\"loadbalancers\",@loadbalancer)\n @loadbalancer.send_delete\n\n respond_to do |format|\n format.html { redirect_to loadbalancers_url }\n format.json { head :ok }\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 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 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 @customer_service.destroy\n respond_to do |format|\n format.html { redirect_to customer_services_url, notice: 'Customer service was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @customer_segment.destroy\n respond_to do |format|\n format.html { redirect_to @business_model_canvase }\n format.json { head :no_content }\n end\n end",
"def destroy\n @complex_service = ComplexService.find(params[:id])\n @complex_service.destroy\n\n respond_to do |format|\n format.html { redirect_to(complex_services_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @contract_service.destroy\n respond_to do |format|\n format.html { redirect_to contract_services_url, notice: 'Contract service was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete\n client.delete(url)\n @deleted = true\nend",
"def destroy\n #@service is already loaded and authorized\n @service.destroy\n\n respond_to do |format|\n format.html { redirect_to services_url }\n format.json { head :ok }\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\r\n @service.destroy\r\n respond_to do |format|\r\n format.html { redirect_to request.referer, notice: 'Service was successfully destroyed.' }\r\n format.json { head :no_content }\r\n end\r\n end",
"def destroy\n @service.destroy\n respond_to do |format|\n format.html { redirect_to services_url, notice: 'El servicio ha sido eliminado.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @invoice_service.destroy\n respond_to do |format|\n format.html { redirect_to invoice_services_url, notice: 'Invoice service was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @request_service.destroy\n respond_to do |format|\n format.html { redirect_to request_services_url, notice: 'Request service was successfully destroyed.' }\n format.json { head :no_content }\n end\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 @service.destroy\n respond_to do |format|\n format.html { redirect_to request.referer, notice: 'Service was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n \n keystone.delete_tenant(keystone.get_tenant(params[:id])[:id])\n\n respond_to do |format|\n format.html { redirect_to tenants_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @ssd.destroy\n respond_to do |format|\n format.html { redirect_to ssds_url }\n format.json { head :no_content }\n end\n end",
"def delete\n request(:delete)\n end",
"def destroy\n @servicetype = Servicetype.find(params[:id])\n @servicetype.destroy\n\n respond_to do |format|\n format.html { redirect_to servicetypes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @servicetype = Servicetype.find(params[:id])\n @servicetype.destroy\n\n respond_to do |format|\n format.html { redirect_to servicetypes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @contract_service_line.destroy\n respond_to do |format|\n format.html { redirect_to contract_service_lines_url, notice: 'Contract service line was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete(path)\n RestClient.delete request_base+path\n end",
"def destroy\n @fee_category.destroy\n respond_to do |format|\n format.html { redirect_to fee_categories_url }\n format.json { head :no_content }\n end\n end",
"def deleteRequest\n\n end",
"def destroy\n @scaff = Scaff.find(params[:id])\n @scaff.destroy\n\n respond_to do |format|\n format.html { redirect_to scaffs_url }\n format.json { head :ok }\n end\n end",
"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 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 @medical_service.destroy\n respond_to do |format|\n format.html { redirect_to medical_services_url, notice: 'Medical service was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @service_check_detail = ServiceCheckDetail.find(params[:id])\n @service_check_detail.destroy\n\n respond_to do |format|\n format.html { redirect_to(service_check_details_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @fabricsofaset.destroy\n respond_to do |format|\n format.html { redirect_to fabricsofasets_url, notice: 'Fabricsofaset was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @taxon_determination.destroy\n respond_to do |format|\n format.html { redirect_to taxon_determinations_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @solicitud_servicio = SolicitudServicio.find(params[:id])\n @solicitud_servicio.destroy\n\n respond_to do |format|\n format.html { redirect_to solicitudes_servicios_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 @taxfree.destroy\n respond_to do |format|\n format.html { redirect_to taxfrees_url, notice: 'Taxfree was successfully destroyed.' }\n format.json { head :no_content }\n end\n end"
] | [
"0.70563775",
"0.68811965",
"0.6873279",
"0.68265927",
"0.6809721",
"0.6780554",
"0.6771565",
"0.67550975",
"0.675444",
"0.67267853",
"0.6705528",
"0.6690599",
"0.66415983",
"0.6618945",
"0.6616808",
"0.6603041",
"0.6580283",
"0.6576496",
"0.65674555",
"0.6561558",
"0.6561558",
"0.6559932",
"0.6552577",
"0.65521115",
"0.65488434",
"0.6545111",
"0.6545026",
"0.6545026",
"0.6545026",
"0.65445065",
"0.65345407",
"0.6516153",
"0.6512837",
"0.6498016",
"0.6493637",
"0.64919615",
"0.6490349",
"0.6478001",
"0.64755046",
"0.6473579",
"0.64658743",
"0.6460406",
"0.64524627",
"0.6450333",
"0.6443995",
"0.64414066",
"0.6431908",
"0.6431908",
"0.6431908",
"0.6431662",
"0.6428242",
"0.64262956",
"0.64220387",
"0.6421339",
"0.641902",
"0.64098626",
"0.6405385",
"0.64039296",
"0.64009815",
"0.6398885",
"0.6394577",
"0.6392939",
"0.6392939",
"0.6392939",
"0.6392939",
"0.6391402",
"0.63911605",
"0.63899183",
"0.63887036",
"0.6385164",
"0.63849616",
"0.63842463",
"0.637081",
"0.63665956",
"0.6363956",
"0.6363726",
"0.63634336",
"0.6362787",
"0.63596004",
"0.6359496",
"0.63552207",
"0.6354128",
"0.63540024",
"0.63495904",
"0.63495904",
"0.63467324",
"0.63465077",
"0.634087",
"0.633795",
"0.6336671",
"0.6333238",
"0.63312876",
"0.63280904",
"0.63279074",
"0.632775",
"0.6327713",
"0.632762",
"0.6327542",
"0.6327542",
"0.63271016"
] | 0.7525406 | 0 |
Use callbacks to share common setup or constraints between actions. | def set_service_fee_master
@service_fee_master = ServiceFeeMaster.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 service_fee_master_params
params.require(:service_fee_master).permit(:appt_type_id, :service_id, :req_urgency, :fee, :fee, :comment, :user_id, :active_status, :del_status)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def allow_params_authentication!; end",
"def allowed_params\n ALLOWED_PARAMS\n end",
"def default_param_whitelist\n [\"mode\"]\n end",
"def param_whitelist\n [:role, :title]\n end",
"def expected_permitted_parameter_names; end",
"def safe_params\n params.except(:host, :port, :protocol).permit!\n end",
"def strong_params\n params.require(:team_member).permit(param_whitelist)\n end",
"def permitir_parametros\n \t\tparams.permit!\n \tend",
"def strong_params\n params.require(:community).permit(param_whitelist)\n end",
"def permitted_strong_parameters\n :all #or an array of parameters, example: [:name, :email]\n end",
"def strong_params\n params.require(:education).permit(param_whitelist)\n end",
"def restricted_params\n #params.require(self.controller_name.classify.underscore.to_sym).permit([])\n raise(\"No strong params set, override restricted_params method in your controller. E.g. params.require(:model).permit(:attribute1, :attribute2)\")\n end",
"def allowed_params\n params.require(:user).permit(:username, :email, :password, :password_confirmation)\n end",
"def param_whitelist\n [:rating, :review]\n end",
"def param_whitelist\n whitelist = [\n :username, :name,\n :parent_id,\n :headline, :description, :video,\n :policy, :signup_mode, :category,\n :website, :facebook, :twitter, :linkedin,\n :founded_at,\n privacy: [\n :events,\n :resources\n ],\n permission: [\n :profile,\n :members,\n :children,\n :statistics,\n :posts,\n :listings,\n :resources,\n :events\n ],\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:parent_id)\n unless current_user.role_in(@community) === 'owner'\n whitelist.delete(:privacy)\n whitelist.delete(:permission)\n end\n end\n \n whitelist\n end",
"def param_whitelist\n if @user.present? && current_user != @user\n return [:followed]\n end\n \n whitelist = [\n :username, :email, :password,\n :first_name, :last_name,\n :birthday, :gender,\n :headline, :biography, :ask_about, :focus,\n :website, :facebook, :linkedin, :twitter, :github,\n roles: [],\n skills: [],\n interests: [],\n privacy: { contact: [] },\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:email)\n whitelist.delete(:password)\n end\n \n whitelist\n end",
"def user_params \n \tparams.require(:user).permit(:name, :email, :password, :password_confirmation)# preventing CSTR\n end",
"def valid_params_request?; end",
"def user_params\n params.permit(:name, :phoneNumber, :address, :postalCode, :local, :link, :counter, :latitude, :longitude) \n end",
"def strong_params\n params.require(:experience).permit(param_whitelist)\n end",
"def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end",
"def whitelist_url_params\n params.require(:whitelist_url).permit(:domain)\n end",
"def allowed_params\n params.require(:allowed).permit(:email)\n end",
"def permitted_params\n []\n end",
"def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end",
"def safe_params\n params.permit(:id, :name, :origin, :emails => []); #emails is an array\n end",
"def query_param\n\t\tparams.permit(:first_name, :last_name, :phone)\n\tend",
"def strong_params\n params.require(:success_metric).permit(param_whitelist)\n end",
"def devise_filter\r\n logger.debug(\"In devise_filter =>PARAMS: #{params.inspect}\")\r\n\r\n # White list for sign_up\r\n devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(user_whitelist) }\r\n\r\n # White list for account update\r\n devise_parameter_sanitizer.for(:account_update) { |u| u.permit(user_whitelist, :current_password) }\r\n\r\n # White list for Invitation creation\r\n devise_parameter_sanitizer.for(:invite) { |u| u.permit(:account_type, :email, :invitation_token)}\r\n\r\n # White list for accept invitation\r\n devise_parameter_sanitizer.for(:accept_invitation) { |u| u.permit(user_whitelist, :invitation_token)}\r\n\r\n end",
"def whitelisted_user_params\n params.require(:user).\n permit( :first_name, :last_name, :email,:password,:password_confirmation,:birthday,:gender)\n end",
"def user_params\n ActionController::Parameters.permit_all_parameters = true\n params.require(:user) #.permit(:name, :surname, :phone, :password, :email, :time_zone)\n end",
"def safe_params\n params.require(:user).permit(:name)\n end",
"def strong_params\n params.require(:metric_change).permit(param_whitelist)\n end",
"def get_params\n\t\treturn ActionController::Parameters.new(self.attributes).permit(\"account_id\", \"title\", \"category\", \"introduction\", \"tags\", \"segment_type\", \"visible\", \"status\", \"main_image\")\n\tend",
"def grant_params\n @whitelisted = params.require(:grant).permit(:name, :description, :agency_id, :acronym)\n end",
"def check_params; true; end",
"def param_whitelist\n whitelist = [\n :description,\n :progress,\n :kpi_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:kpi_id)\n end\n \n whitelist\n end",
"def quote_params\n params.permit!\n end",
"def valid_params?; end",
"def paramunold_params\n params.require(:paramunold).permit!\n end",
"def user_params\n\t\tparams.permit(:nickname, :avatar, :description, :password, :gender, :birthday, :email, :phone, :qq_id, :wechat_id)\n\tend",
"def filtered_parameters; end",
"def user_params\n params.permit(\n \t:id,\n \t:email, \n \t:first_name, \n \t:last_name, \n \t:password, \n \t:confirm_token, \n \t:phone_number,\n \t:facebook_link,\n \t:car_model,\n \t:license_plate)\n end",
"def filtering_params\n params.permit(:email, :name)\n end",
"def check_params\n true\n end",
"def wx_public_params\n params.require(:wx_public).permit(:nickname, :manager, :alias)\n end",
"def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end",
"def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end",
"def listing_params\n\t\tparams.permit(:address, :transit_info, :rules, :other_info, :lat, :lng)\n\tend",
"def social_account_params\n\t\t\tparams.require(:social_account).permit!\n\t\tend",
"def safe_params\n resurce_name = self.class.resource_name\n params_method_name = \"#{resurce_name}_params\".to_sym\n if params[resurce_name]\n if respond_to?(params_method_name) || private_methods.include?(params_method_name)\n send(params_method_name)\n else\n raise ActiveModel::ForbiddenAttributesError, \"Please, define the '#{params_method_name}' method in #{self.class.name}\"\n end\n end\n end",
"def user_params\n params.require(:user).permit(:uri, :username, :password, :realname, :email, :publicvisible)\n end",
"def url_params\n params.require(:url).permit(:short_url, :original_url, :clicks, :ip_addresses)\n end",
"def model_params\n\t\tparams.require(:manager).permit(\n\t :user_name,\n :password,\n :email,\n \t\t\t)\n\tend",
"def article_params_whitelist\n params.require(:article).permit(:title, :description, category_ids: [])\n end",
"def college_whitelist_params\n params.require(:college_whitelist).permit(:status)\n end",
"def active_code_params\n params[:active_code].permit\n end",
"def filtering_params\n params.permit(:email)\n end",
"def ip_address_params\n\t\t\tparams.require(:ip_address).permit!\n end",
"def valid_params(params)\n params.permit(:user_id, :photo_id, :originX, :originY, :width, :height)\n end",
"def reserved_params\n params.require(:reserved).permit(:name, :email, :pax, :address, :KTP, :title)\n end",
"def pull_request_params\n whitelist = [\n :url,\n :id,\n :html_url,\n :diff_url,\n :patch_url,\n :issue_url,\n :number,\n :state,\n :locked,\n :title\n ]\n params.require(:pull_request).permit(whitelist)\n end",
"def post_params\n if current_user.admin? \n params.permit(:title, :body, :city, :country, :gps_location, :privacy, :visible, :latitude, :longitude, images: [], files: [])\n else \n params.permit(:title, :body, :city, :country, :gps_location, :privacy,:latitude, :longitude, images: [], files: [])\n end \n end",
"def list_params\n params.permit(:name)\n end",
"def filter_parameters; end",
"def filter_parameters; end",
"def vineyard_params\n params.permit(:vineyard_name, :email, :website_url, :phone, :address, :city, :region, :postcode, :country, :specialty, :description, :pet_friendly, :holiday, :tours, :events, :family_friendly, :cover_image, :image_one, :image_two, :image_three, :image_four, :user_id, :base64)\n end",
"def available_activity_params\n # params.require(:available_activity).permit(:type,:geometry,:properties)\n whitelisted = ActionController::Parameters.new({\n type: params.require(:available_activity)[:type],\n geometry: params.require(:available_activity)[:geometry].try(:permit!).to_h,\n properties: params.require(:available_activity)[:properties].try(:permit!).to_h\n }).try(:permit!)\n end",
"def user_params\n params.permit(:name, :username, :email, :password, :img_url, :bg_url, :coinbank)\n end",
"def user_params_pub\n\t \tparams[:user].permit(:hruid)\n\t end",
"def user_params\n params.permit(:id, :email, :password, :nickname, :status, :avatar, :flat_picture, :flatsharing_id, :member,\n :user, :color, :solde)\n end",
"def validate_search_inputs\n @whitelisted = params.fetch(:user, nil)\n if @whitelisted.blank?\n render_error(400, \"#{I18n.t('general_error.params_missing_key')}\": [I18n.t('general_error.params_missing_value', model: \"review\")])\n return\n else\n @whitelisted = @whitelisted.permit(:name, :uen, :description)\n end\n end",
"def url_whitelist; end",
"def param_whitelist\n [\n :title,\n :description,\n :organization,\n :team_id,\n :started_at,\n :finished_at,\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n end",
"def admin_social_network_params\n params.require(:social_network).permit!\n end",
"def filter_params\n params.require(:filters).permit(:letters)\n end",
"def valid_params(params)\n params.permit(:login, :first_name, :last_name, \n :password, :password_confirmation)\n end",
"def origin_params\n params.permit(:country, :state, :city, :postal_code, :address, :description)\n end",
"def permit_request_params\n params.permit(:address)\n end",
"def sensitive_params=(params)\n @sensitive_params = params\n end",
"def user_params\n # Ensure a user can't give themselves admin priveleges\n params.delete(:admin) if current_user.admin?\n params.require(:user).permit(:name, :email, :admin, :image)\n end",
"def secure_params\n params.require(:location).permit(:name)\n end",
"def strong_params\n params.require( :setting ).\n permit( :global_scan_limit, :per_user_scan_limit,\n :target_whitelist_patterns, :target_blacklist_patterns )\n end",
"def question_params\n params.require(:survey_question).permit(question_whitelist)\n end",
"def case_insensitive_params\n params.require(:case_insensitive).permit(:name)\n end",
"def empire_master_no_match_params\n params.require(:empire_master_no_match).permit(:uid, :last_name, :list, :search_date, :double, :source)\n end",
"def maintenance_request_params\n params[:maintenance_request].permit! #allow all parameters for now\n end",
"def unwanted_params\n params.require(:unwanted).permit(:title, :description, :image)\n end",
"def backend_user_params\n params.permit!\n end",
"def url_params\n params[:url].permit(:full)\n end",
"def filter_params\n\t\treturn params[:candidate].permit(:name_for_filter)\n\tend",
"def user_params\n params.permit(:name, :age, :username, :display_photo, :password)\n end",
"def speed_measurement_params\n\n #fuckit, to lazy to deal with permit crap right now\n ActionController::Parameters.permit_all_parameters = true\n\n params[:speed_measurement]\n end",
"def get_params\r\n #params.require(:article).permit(:title, :permalink, :content, :source_site, :introtext, :type_id, :order_by, :searchable, :created_by, :edited_by, :published_by, :published_on, :user_id)\r\n params.require(:article).permit!\r\n\r\n end",
"def pub_params\n params.require(:pub).permit(:name, :description, :phone, :email, :hidden, :city_id, :address)\n end",
"def pass_params\n params[:pass].permit(:name, :price, :description, :colour, :events)\n end",
"def droptraining_params\n params.permit(:training_id,:user_id, :utf8, :authenticity_token, :commit)\n end",
"def person_params\n # params whitelist does *not* include admin, sub, remember_token\n # TBD: share this whitelist with the list used by configuration_permitted_parameters\n # TBD: should current_password be on this list? -- for now, leaving off, since it seems to work without\n # NOTE: do not include 'admin' in this list!\n params.require(:person).permit(\n :name, \n :email, \n :description,\n :password, \n :password_confirmation\n )\n end",
"def parameter_params\n params.require(:parameter).permit(:name, :description, :param_code, :param_value, :active_from, :active_to)\n end"
] | [
"0.6981273",
"0.6783789",
"0.67460483",
"0.6742222",
"0.67354137",
"0.65934366",
"0.65028495",
"0.6497783",
"0.64826745",
"0.6479415",
"0.6456823",
"0.6440081",
"0.63800216",
"0.6376521",
"0.636652",
"0.6319898",
"0.6300256",
"0.62994003",
"0.6293621",
"0.6292629",
"0.6291586",
"0.629103",
"0.6282451",
"0.6243152",
"0.62413",
"0.6219024",
"0.6213724",
"0.62103724",
"0.61945",
"0.61786324",
"0.61755824",
"0.6173267",
"0.6163613",
"0.6153058",
"0.61521065",
"0.6147508",
"0.61234015",
"0.61168665",
"0.6107466",
"0.6106177",
"0.6091159",
"0.60817343",
"0.6071238",
"0.6062299",
"0.6021663",
"0.60182893",
"0.6014239",
"0.6011563",
"0.60080767",
"0.60080767",
"0.60028875",
"0.60005623",
"0.59964156",
"0.5993086",
"0.5992319",
"0.5992299",
"0.59801805",
"0.59676576",
"0.59606016",
"0.595966",
"0.59591126",
"0.59589803",
"0.5954058",
"0.5953234",
"0.5944434",
"0.5940526",
"0.59376484",
"0.59376484",
"0.5935253",
"0.5930846",
"0.5926387",
"0.59256274",
"0.5917907",
"0.5910841",
"0.590886",
"0.59086543",
"0.59060425",
"0.58981544",
"0.5898102",
"0.5896809",
"0.5895416",
"0.58947027",
"0.58923644",
"0.5887903",
"0.58830196",
"0.5880581",
"0.5873854",
"0.58697754",
"0.5869004",
"0.58669055",
"0.5866886",
"0.58664906",
"0.5864619",
"0.58630043",
"0.5862495",
"0.5861368",
"0.5859712",
"0.5855544",
"0.58551925",
"0.5851284",
"0.5850602"
] | 0.0 | -1 |
Write a program that finds the summation of every number from 1 to num. The number will always be a positive integer greater than 0. For example: summation(2) > 3 1 + 2 summation(8) > 36 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 | def summation(num)
sum = (0..num).inject(:+)
return sum
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def summation(num)\n sum = 0\n (0..num).each do |v|\n sum += v\n end\n return sum\nend",
"def summation(num)\n (1..num).reduce(:+)\nend",
"def sum_nums(num)\n\t\n\tnumbers = []\n\tnum_sum = num\n\t\nuntil numbers.length == num_sum\n\tnumbers.push(num)\n\tnum = num - 1\nend\n return\tnumbers.inject(:+)\nend",
"def sum_nums(num)\n\n value = 0\n i = 0\n while i < num\n value = value + (num - i) \n i += 1\n end\n\n return value\nend",
"def summation(num)\r\n puts 1.upto(num).reduce(0, :+)\r\nend",
"def sum_nums(num)\r\n sum = 0\r\n while num >= 0\r\n sum = num + sum\r\n num = num-1\r\n end\r\n return sum\r\nend",
"def sum_to(num)\n sum = 0\n i = 0\n while i <= num\n sum += i\n i += 1\n end\n return sum\nend",
"def sum_to(num)\n i = 0\n sum = 0\n while i < num\n i += 1\n sum += i\n end\n return sum\nend",
"def summation(n)\n #iterate through numbers less than or equal to n and add them up\n sum = 0\n\n (1..n).each { |num| sum += num }\n return sum\nend",
"def summation(n)\n sum = 0\n (1..n).each { |num| sum += num }\n return sum\nend",
"def summation(n)\n sum = 0\n (1..n).each { |num| sum += num }\n return sum\nend",
"def sum_nums(num)\n (1..num).inject(&:+)\nend",
"def sum_to(num)\n if num<0\n return \"number is negative, wont work!\"\n end\n\n i=0\n sum = 0\n while i <= num\n sum += i\n i += 1\n end\n return sum\nend",
"def summation(num)\n num * (num + 1) / 2\nend",
"def adding(num)\n\tsum = 0\n\t(1..num).each do |x|\n\t\tsum += x\n\tend\n\treturn sum\nend",
"def sumto(num)\n i = 0\n output = 0\n while i < num + 1\n output += i\n i += 1\n end\n return output\nend",
"def sum_to(number)\n sum = 0\n i = 1\n while i <= number\n sum += i\n i += 1\n end\n return sum\nend",
"def sum_nums(max)\n sum = 0\n i = 1\n while i <= max\n sum += i #sum increments by the value of i\n i += 1\n end\nreturn sum\nend",
"def sum_recursive(num)\n # can also compute sum with symbol (1..5).inject(:+)\n (1..num).inject { |sum, n| sum + n }\nend",
"def sum_of_all_integers(num)\n (0..num).sum\nend",
"def sum_nums(max)\n sum = 0 \n\n i = 1\n while i <= max\n sum += i\n \n i += 1\n end \n\n return sum\nend",
"def compute_sum(number)\n (1..number).reduce(:+)\nend",
"def sum_nums(max)\n sum = 0\n i = 1\n\n while i <= max\n sum += i \n i += 1\n end\n return sum\nend",
"def SimpleAdding(num)\n sum = 0\n (1..num).each do |number|\n sum += number\n end\n sum\nend",
"def compute_sum(number)\n (1..number).inject(:+)\nend",
"def sum_nums(max)\n sum = 0\n\n i = 1\n while i <= max\n sum += i\n\n i += 1\n end\n\n return sum\nend",
"def sum_to(num)\n i = num\n output = 0\n while i > 0\n output += i\n i -= 1\n end\n return output\nend",
"def sum_nums(max) # Defines method\n\n\ti = 1 # i starts at one because thats where the numbers start\n\tsum = 0 # sum starts at zero because we increment += 1 into sum\n\n\twhile i <= max # i has to be <= max cause we are adding up to max\n\t\t\n\t\tsum += i # sum increments by i; first time is one, second time is two\n\t\ti += 1 # here we set the rate of which i increments at, we do this after += i because if we did it before we would get an entirely different result and our aim is to return 10 and 15\n\tend # end while loop\n\treturn sum # return sum here and not in while loop because it exits method after return\nend",
"def sum_nums(max)\n sum = 0\n i = 0\n\n while i <= max\n sum += i\n i += 1\n end\n\n return sum\nend",
"def sums num\n\tsum_of_squares = 0\n\tsum = 0\n\t1.upto num do |n|\n\t\tsum_of_squares += n*n\n\t\tsum += n\n\tend\n\tsum**2 - sum_of_squares \nend",
"def sum_nums(max)\n\ti = 1\n sum = 0\n while i <= max\n sum = i + sum\n i += 1\n end\n return sum\nend",
"def sum_nums(max)\n \n total = 0\n i = 1\n while i <= max \n total += i\n i = i+1\n end\n return total\nend",
"def sum_range(num)\n if num == 1\n 1\n else\n num + sum_range(num - 1)\n end\nend",
"def sum(number)\n sum = 0\n\n while number != 0\n sum += number\n number -= 1\n end\n\n sum\nend",
"def simple_adding (num)\n the_sum = 0\n i = 0\n while i <= num do\n puts the_sum += i\n i += 1\n end\n return the_sum\nend",
"def sum_nums2(num)\n\ncount = 0\nresult = 0\n\n while num >= count\n result += count\n count += 1\n end\n #puts( result )\n return result\nend",
"def sum(number)\n n = number\n array = []\n answer = []\n while n > 1 do\n array << (n -= 1)\n end\n num = array.reduce(:*)\n num.to_s.split(\"\").each do |i|\n answer << i.to_i\n end\n return answer.reduce(:+)\nend",
"def compute_sum(number)\n total = 0\n 1.upto(number) { |value| total += value }\n total\nend",
"def compute_sum(n)\n i = 1\n num = 0\n\n loop do\n num += i\n i += 1\n break if i > n\n end\n num\nend",
"def sum_of_sums(numbers)\n 1.upto(numbers.size) do |num|\n num += 1\n end\n # num\nend",
"def sum_nums(max)\n\t# create a variable to store sum\n \t# loop until max\n \t# sum += iterator\n idx = 0\n sum = 0\n while(idx <= max)\n sum+= idx\n idx+=1\n end\n return sum\nend",
"def sum(num)\na_num = []\nnum_split_string = num.to_s.split('')\n \n while a_num.count < num do\n a_num.push(num_split_string)\n a_num.count\n break\n end\n a_num.flatten!.map! do |e|\n e.to_i\n end\n a_num.sum\nend",
"def sum_nums(max)\n\tsum = 0\n\t\n\ti = 1\t\n \twhile i <= max\n \t\tsum = max + (max + 1)\n \tsum += 1\n\n \tputs i\n \ti += 1\n end\n \t\n\treturn sum\nend",
"def sum(n)\n result = 0\n n.each do |number|\n result = result + number\n end\n return result\n end",
"def total(num)\n sum = 0\n num.each do |x|\n sum = sum + x\n end\n return sum\nend",
"def total(num)\n sum = 0\n num.each do |int|\n sum = sum + int\n end\n return sum\nend",
"def sum_num\n\t#ask for number\n\tputs \"gimme dat number: make sure its more than 1?\"\n\tnum = gets.chomp.to_i\n\t\n\n\tif num < 1\n\t\tputs \"I told you to put a number greater than 1\"\n\t\tsum_num\n\telse\n\t\t# prints number 1 to num\n\t\tcounter = (1..num)\n\t\tnew_num = 0\n\t\tcounter.each do |num|\n\t\t\tnew_num = new_num + num\n\n\n\t\tend\n\n\tend\n\tputs new_num \nend",
"def add_up(num)\n\tsum = 0;\n\t(1..num).each { |x| sum += x }\n\tsum\nend",
"def multisum(num)\n ary = []\n\n num.times do\n ary << num if num % 5 == 0 || num % 3 == 0\n num -= 1\n end\n\n sum = 0\n ary.each { |n| sum += n }\n sum\nend",
"def summation(max)\n\tsum = 0\n\tcounter = 2\n\twhile counter < max\n\t\tp \"counter is #{counter}\"\n\t\tif isprime?(counter)\n\t\t\tsum += counter\n\t\tend\n\t\tcounter += 1\n\tend\n\treturn sum\nend",
"def SimpleAdding(num)\nsum=0\n 1.upto(num) do |x|\n\tsum+=x\n\tend\n\t\nreturn sum\nend",
"def summation_of_primes(num)\n\n\tsum = 2 # sum of all the primes\n\tctr = 3 # current number counter, increase by 1 for each loop through the while clause\n\n\twhile ctr < num\n\t\tis_prime = true\n\t\tfor i in 2..(ctr-1)\n\t\t\t# puts \"CTR: #{ctr}\"\n\t\t\t# puts \"I: #{i}\"\n\t\t\tis_prime = false if ctr % i == 0\n\t\tend\n\t\tif is_prime\n\t\t\tsum += ctr\n\t\t\t# puts \"The current sum is #{sum}\"\n\t\tend\n\t\tctr += 1\n\tend\t\n\n\t\"The sum is #{sum}\"\n\nend",
"def GetSum(num, sum)\n if num == 0\n return sum\n else\n return GetSum((num - 1), (sum + num))\n end\nend",
"def aliquot_sum(num)\n return 0 if num <= 1\n factors = []\n (1...num).each do |n|\n factors << n if num % n == 0\n end\n factors.reduce(:+)\nend",
"def sum(n, m)\n if n > m\n return 0\n else\n return sum(n+1, m) + n\n end\nend",
"def multisum(number) # number 1..10 determines which numbers are divisible by 3 and 5\n sum = 0\n 1.upto(number) do |num|\n if num % 3 == 0 || num % 5 == 0\n sum += num # this adds the numbers from 1..num that either are multiples of 3 or 5\n end\n end\n sum # returns sum, need this here to run program successfully\nend",
"def sum(number)\n a = (1..number).to_a\n puts a.inject(:+)\nend",
"def SimpleAdding(num)\n\ti = 0\n\ttotal = 0\n\twhile i <= num\n\t\ttotal += i\n\t\ti += 1\n\tend\n\tprint total\nend",
"def divisorSum(num)\n\tarr = [1]\n\t(2..num ** 0.5).each do |n| \n\t\tif (num % n == 0) then\n\t\t\tarr << n \n\t\t\tarr << num/n \n\t\tend\n\tend\n\tarr.reduce(:+)\nend",
"def sum(number)\n total = 0\n 1.upto(number) {|v| total += v }\n total\nend",
"def sum_of_sums(numbers)\n sum_total = 0\n accumulator = 0\n\n numbers.each do |num|\n accumulator += num\n sum_total += accumulator\n end\n sum_total\nend",
"def sum_to(number)\n i = 0\n output = 0\n while i < number\n i +=1\n output += i\n end\n return output\nend",
"def sum_nums(num)\n\ncount = num\n\nif( num == 0 )\n return num\nend\n\n while count > 0\n num += count - 1\n #puts \"Num: #{num}\"\n count -= 1\n #puts \"Count: #{count}\"\n end\n\n return num\nend",
"def multisum(num)\n sum = 0\n 1.upto(num) {|number| sum += number if (number % 3 == 0 || number % 5 == 0)}\n sum\nend",
"def sum_of_sums(numbers)\n sum_total = 0\n accumulator = 0\n\n numbers.each do |num|\n accumulator += num\n sum_total += accumulator\n end\n\n sum_total\nend",
"def sum_of_sums(numbers)\n sum_total = 0\n accumulator = 0\n\n numbers.each do |num|\n accumulator += num\n sum_total += accumulator\n end\n\n sum_total\nend",
"def sum_of_sums(numbers)\n sum = 0\n numbers.size.times do |idx|\n sum += numbers[0..idx].inject(:+)\n end\n \n sum\nend",
"def sum_num(first_num, last_num)\n # Your code goes here\n sum = 0\n first_num = first_num - 1\n num_count = (last_num - first_num)\n num_count.times do\n first_num += 1\n sum += first_num \n end\n return sum\nend",
"def multisum(num)\n arr = []\n (1..num).map do |n|\n if n % 3 == 0 || n % 5 == 0\n arr << n\n end\n end\n arr.inject { |n, sum| n + sum }\nend",
"def SimpleAdding(num)\n\n # code goes here\n range_sum = *(1..num)\n return range_sum.inject(:+)\n \nend",
"def sum(x)\n solution = 0\n x.each do |num|\n solution += num\n end\n solution\nend",
"def sum_multiples(num)\n collect_multiples(num).inject(0, :+)\nend",
"def sum(num)\n num.zero? ? num : num + sum(num - 1)\nend",
"def sum_square_difference(num)\n sum = 0\n square_sum = 0\n\n 1.upto(num) do |n|\n sum += n\n square_sum += n**2\n end\n\n sum**2 - square_sum\nend",
"def sum_of_sums(numbers)\n (0...numbers.size).reduce(0) { |sum, idx| sum += numbers[0..idx].reduce(:+) }\nend",
"def compute_sum(int)\n sum = 0\n 1.upto(int) { |i| sum += i }\n sum\nend",
"def multisum(num)\n\n\t# extract multiples into an array\n\n\tmultiples_found = []\n\n\t(1..num).each do |number|\n\t\tmultiples_found << number if (number%3 == 0) || (number%5 == 0)\n\tend\n\n\t# sum all the values in the array\n\ttotal = multiples_found.reduce(:+)\nend",
"def sum_int(num)\n (1..num).inject(0, :+)\n #block form\n (1..num).inject { |sum, n| sum + n }\nend",
"def sum_of_sums(numbers)\n sum = 0\n numbers.size.times { |counter| sum += numbers[0..counter].sum }\n sum\nend",
"def rec_sum(num)\n return num if num <= 1\n num + rec_sum(num - 1)\nend",
"def sum_to(number)\n i = 0\n output = number\n while i != number\n output += i\n i += 1\n end\n return output \nend",
"def sum_to_one_digit(num)\n if num < 1 or not num.is_a? Integer\n puts \"Num must be positive integer\"\n return false;\n end\n\n get_sum = ->(intgr) {\n digit_sum = 0\n intgr = intgr.to_s.split('')\n intgr.each do |i|\n digit_sum += i.to_i\n end\n return digit_sum\n }\n\n sum = get_sum.call(num)\n while sum.to_s.length > 1 do\n sum = get_sum.call(sum)\n end\n\n puts sum\n return sum\nend",
"def sum_to(min=1, n)\n if n > 0\n return min if min == n \n min + sum_to(min + 1, n)\n end\nend",
"def sumn(n)\n result = 0\n 1.upto(n) { |e| result += e }\n puts \"Sum of #{n} numbers is #{result}\"\nend",
"def sequence_sum(begin_number, end_number, step)\n return 0 if end_number < begin_number\n \n x = begin_number\n sum = 0\n \n while x <= end_number\n sum += x\n x += step\n end\n \n sum\nend",
"def sum_recursively(num)\n return num if num == 0\n sum_recursively(num-1) + num\nend",
"def solution(num)\n sum_of_squares = 0\n\n (1..num).each do |number|\n sum_of_squares += number**2\n end\n\n square_of_sums = (1..num).inject(:+) ** 2\n\n p (square_of_sums - sum_of_squares).abs\nend",
"def sum_of_sums1(numbers)\n result = 0\n index_end = 1\n loop do\n numbers[0, index_end].each { |number| result += number }\n break if index_end >= numbers.size\n\n index_end += 1\n end\n result\nend",
"def sum_of_sums(numbers)\n numbers_to_add = Array.new\n numbers.each_index do |index|\n numbers_to_add += numbers[0..index]\n end\n numbers_to_add.reduce(:+)\nend",
"def multisum(num)\n 1.upto(num).inject(0) {|sum, num| num % 3 == 0 || num % 5 == 0 ? sum += num : sum}\nend",
"def solution(number)\n number -=1 and sum = 0 and for x in number.downto(0) do x%5 == 0 ? (sum = sum+x) : if(x%3 == 0) then sum = sum+x \n end end and return sum \nend",
"def findSum()\n\tnumbers.inject(0) { |sum, number| sum + number }\nend",
"def sum_of_sums(numbers)\n sum_total = 0\n 1.upto(numbers.size) do |count|\n sum_total += numbers.slice(0, count).inject(:+)\n end\n sum_total\nend",
"def SimpleAdding(num\n total = 1.upto(num).reduce(&:+)\n total \nend",
"def sum_sq(n)\n cnt = 1\n sum = 0\n while cnt <= n\n sum += cnt * cnt\n cnt += 1\n end \n puts sum\nend",
"def sum_to(number)\n i = number\n output = number\n while i > 0\n output += number-1\n number-=1\n i-=1\n end\n return output\nend",
"def minuend(num)\n num_arr = []\n\n 1.upto(num) { |n| num_arr << n }\n (num_arr.reduce(:+)) ** 2\nend",
"def sum_of_sums(numbers)\n numbers.each_with_index.inject(0) do |result, (_, index)|\n result += numbers[0..index].sum\n result\n end\nend",
"def sum(n)\n end",
"def natural_sum(num)\n sum = 0\n index = 0\n while index < num\n if index % 3 == 0 || index % 5 == 0\n sum += index\n end\n index += 1\n end\n p sum\nend"
] | [
"0.8285817",
"0.8111951",
"0.79816926",
"0.7883295",
"0.78497005",
"0.78097075",
"0.77513206",
"0.7672171",
"0.765522",
"0.7603721",
"0.75755507",
"0.7544605",
"0.74838483",
"0.74794173",
"0.7444679",
"0.7411247",
"0.73807675",
"0.7358488",
"0.7338669",
"0.7331674",
"0.73199207",
"0.7307708",
"0.7305754",
"0.73005414",
"0.7287351",
"0.72692704",
"0.72682786",
"0.72324604",
"0.7224177",
"0.7221074",
"0.721832",
"0.72129583",
"0.7188018",
"0.71205866",
"0.7117704",
"0.7101779",
"0.7099817",
"0.70913064",
"0.70847166",
"0.70577425",
"0.704851",
"0.70436364",
"0.7028322",
"0.70246106",
"0.70243603",
"0.70058155",
"0.70022994",
"0.6997496",
"0.6992428",
"0.6990745",
"0.6989503",
"0.69869107",
"0.697149",
"0.69491684",
"0.69395524",
"0.6939222",
"0.6939219",
"0.6932454",
"0.69281375",
"0.6923907",
"0.69224614",
"0.6918428",
"0.6916369",
"0.6913751",
"0.6910277",
"0.6910277",
"0.6895067",
"0.68855715",
"0.6874141",
"0.68715465",
"0.68702334",
"0.68688166",
"0.6857693",
"0.6854887",
"0.6849251",
"0.68258995",
"0.68166757",
"0.6807447",
"0.6786105",
"0.6778386",
"0.6766869",
"0.6766567",
"0.6763801",
"0.67624646",
"0.67608345",
"0.67538565",
"0.6750317",
"0.67343736",
"0.67298347",
"0.6729157",
"0.6726321",
"0.6708405",
"0.67069393",
"0.6698897",
"0.66949916",
"0.6693666",
"0.66895854",
"0.66892666",
"0.6685355",
"0.6683684"
] | 0.8223749 | 1 |
This sets a default url for img_url | def img_url(url= "https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcR7G9JTqB8z1AVU-Lq7xLy1fQ3RMO-Tt6PRplyhaw75XCAnYvAYxg")
self[:img_url] || url
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def default_url\n \"http://placehold.it/330&text=pic\"\n end",
"def default_url\n \"/images/fallback/\" + [thumb, \"images.jpeg\"].compact.join('_')\n end",
"def image_url=(value)\n @image_url = value\n end",
"def default_url\n file_path = [\n 'fallbacks',\n ([model.class.to_s.underscore, mounted_as, version_name].compact.join('_') + '.png')\n ].join '/'\n\n 'http://' + ENV['HOST'] + ActionController::Base.helpers.image_path(file_path)\n end",
"def set_url\n @url = DEFAULT_URL\n end",
"def default_url\n \"/images/user/avatar/\" + [version_name, \"default.png\"].compact.join('_')\n end",
"def default_url\n \"https://s3.amazonaws.com/whisprdev/uploads/default_avatar.png\"\n end",
"def image_remote_url=(url_value)\n self.image = URI.parse(url_value) unless url_value.blank?\n super\n end",
"def default_url\n ActionController::Base.helpers.asset_path(\"integral/defaults/post_image.jpg\")\n end",
"def default_url\n \"photo/#{version_name}.jpg\"\n end",
"def default_url\n version = version_name.downcase if version_name\n du = \"/images/fallback/\" + [version, \"empty_deal_image.png\"].compact.join('_')\n # puts \"default_url=>#{du}\"\n du\n end",
"def url() processed_image.try(:url) || fallback_url end",
"def default_url\n \"/images/fallback/\" + [version_name, \"default.png\"].compact.join('_')\n end",
"def default_url\n # For Rails 3.1+ asset pipeline compatibility:\n # ActionController::Base.helpers.asset_path(\"fallback/\" + [version_name, \"default.png\"].compact.join('_'))\n\n \"http://res.cloudinary.com/djjs4pnpf/image/upload/v1528878490/jpsez3ep8okeusjdqinz.jpg\"\n end",
"def default_url\n asset_path(\"fallback/\" + [version_name, \"default-photo.png\"].compact.join('_'))\n end",
"def default_url\n asset_path(\"fallback/\" + [version_name, \"default-photo.png\"].compact.join('_'))\n end",
"def default_url\n asset_path(\"fallback/\" + [version_name, \"default-photo.png\"].compact.join('_'))\n end",
"def default_url\n \"/images/fallback/\" + [version_name, \"network-thumb-default.png\"].compact.join(\"_\")\n end",
"def default_url\n \"/images/fallback/\" + [version_name, \"base-default.png\"].compact.join(\"_\")\n end",
"def default_url\n Settings.image.default_avatar\n end",
"def default_url\n Settings.image.default_avatar\n end",
"def default_url\n Settings.image.default_avatar\n end",
"def default_url\n \"/images/fallback/\" + [version_name, \"default.png\"].compact.join('_')\n end",
"def default_url(*args)\n \"/site_assets/_shared/avatars/\" + [\"empty_avatar\", version_name].compact.join('_') + '.png'\n end",
"def default_url\n ActionController::Base.helpers.asset_path(\"missing_avatar_thumb.png\")\n end",
"def image_url(options = {})\n base_url = options[:base_url] || self.base_url || Configuration.DEFAULT_BASE_URL\n base_url << \"/\" if base_url[-1,1] != \"/\"\n base_url << image_path(options)\n end",
"def default_url\n # # For Rails 3.1+ asset pipeline compatibility:\n #asset_path([version_name, \"default.png\"].compact.join('_'))\n #\n [version_name, \"logono.gif\"].compact.join('_')\n end",
"def default_url\n ActionController::Base.helpers.asset_path(\"placeholders/\" + [\"default\", version_name].compact.join('_')) + \".png\"\n return \"/images/placeholders/\" + [\"default\", version_name].compact.join('_') + \".png\"\n end",
"def default_url\n '/images/blank_card.png'\n end",
"def default_image\n end",
"def default_url\n ActionController::Base.helpers.asset_path(\"images/\" + [version_name, \"missing.png\"].compact.join('/'))\n end",
"def default_url\n # For Rails 3.1+ asset pipeline compatibility:\n # asset_path(\"fallback/\" + [version_name, \"default.png\"].compact.join('_'))\n asset_path \"#{DEFAULT_AVATAR_NAME}.png\"\n end",
"def imgurl\n picref.imgurl if picref\n end",
"def default_url\n # For Rails 3.1+ asset pipeline compatibility:\n ([version_name, \"default.png\"].compact.join('_'))\n \n #\"/images/fallback/\" + [version_name, \"default.png\"].compact.join('_')\n end",
"def blank_url\n asset_host = Rails.configuration.action_controller[:asset_host]\n if asset_host\n \"http://#{asset_host}/assets/default/#{blank_image}\"\n else\n \"/assets/default/#{blank_image}\"\n end\n end",
"def default_url\n # For Rails 3.1+ asset pipeline compatibility:\n # ActionController::Base.helpers.asset_path(\"fallback/\" + [version_name, \"default.png\"].compact.join('_'))\n asset_path('gray_blank.gif')\n # Settings.assets.gray_image\n end",
"def default_url\n # ActionController::Base.helpers.asset_path(\"fallback/\" + [version_name, \"anonymous_avatar.gif\"].compact.join('_'))\n\n 'anonymous_avatar.gif'\n #\"/images/\" + [version_name, \"anonymous.jpg\"].compact.join('_')\n end",
"def default_url\n ActionController::Base.helpers.asset_path(\"logos/\" + [version_name, \"missing.png\"].compact.join('/'))\n end",
"def default_url\n # For Rails 3.1+ asset pipeline compatibility:\n # asset_path(\"fallback/\" + [version_name, \"default.png\"].compact.join('_'))\n\n \"/images/fallback/\" + [version_name, \"default.png\"].compact.join('_')\n end",
"def set_defaults\n self.main_image ||= Placeholder.image_generator(height: '600', width: '400')\n self.thumb_image ||= Placeholder.image_generator(height: '350', width: '200')\n end",
"def set_defaults\n self.main_image ||= Placeholder.image_generator(height: '600', width: '400')\n self.thumb_image ||= Placeholder.image_generator(height: '350', width: '200')\n end",
"def set_defaults\n self.main_image ||= Placeholder.image_generator(height: '600', width: '400')\n self.thumb_image ||= Placeholder.image_generator(height: '350', width: '200')\n end",
"def default_url\n ActionController::Base.helpers.asset_path(\"default/\" + [version_name, \"standard.jpg\"].compact.join('_'))\n end",
"def image_url(source, options = T.unsafe(nil)); end",
"def default_url\n ActionController::Base.helpers.asset_path(\"fallback/#{model.class.to_s.underscore}_#{mounted_as}/\" + [version_name, \"default.jpg\"].compact.join('_'))\n end",
"def set_defaults\n self.main_image ||= Placeholder.image_generator(height: '600', width: '400')\n self.thumb_image ||= Placeholder.image_generator(height: '350', width: '200')\n end",
"def default_url(*_args)\n ActionController::Base\n .helpers\n .asset_path('fallback/' + [version_name, 'missing_avatar1.png'].compact.join('_'))\n end",
"def default_url\n # # For Rails 3.1+ asset pipeline compatibility:\n # # ActionController::Base.helpers.asset_path(\"fallback/\" + [version_name, \"default.png\"].compact.join('_'))\n #\n # \"/images/fallback/\" + [version_name, \"default.png\"].compact.join('_')\n \"/placeholder.png\"\n end",
"def url\n if self.empty?\n \"/img/blank.gif\"\n else\n @url\n end\n end",
"def default_url\n # For Rails 3.1+ asset pipeline compatibility:\n # ActionController::Base.helpers.asset_path(\"fallback/\" + [version_name, \"default.png\"].compact.join('_'))\n\n # \"/images/fallback/\" + [version_name, \"default.png\"].compact.join('_')\n # 'default_avatar.png' #rails will look at 'app/assets/images/default_avatar.png'\n end",
"def default_url\n nil\n end",
"def default_url\n # For Rails 3.1+ asset pipeline compatibility:\n \"/assets/\" + [version_name, \"default.gif\"].compact.join('_')\n end",
"def set_defaults\n\t\tself.main_image ||= Placeholder.image_generator(height: '200', width: '200')\n\t\tself.thumb_image ||= Placeholder.image_generator(height: '300', width: '300')\n\tend",
"def default_url\r\n ActionController::Base.helpers.asset_path(\"fallback/\" + [version_name, \"default.png\"].compact.join('_'))\r\n #ActionController::Base.helpers.asset_path(\"fallback/\" + \"default.gif\")\r\n end",
"def default_url\n return '' #ActionController::Base.helpers.asset_path('common/no-image.png')\n end",
"def default_url\n ActionController::Base.helpers.image_path('user.png')\n end",
"def default_url\n #\"/assets/fallback/\" + [version_name, \"default.jpg\"].compact.join('_')\n ActionController::Base.helpers.asset_path(\"fallback/\" + [version_name, \"default.jpg\"].compact.join('_'))\n #\"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end",
"def set_defaults\n\t\tself.main_image ||= Placeholder.image_generator(height: '600', width: '400')\n\t\tself.thumb_image ||= Placeholder.image_generator(height: '350', width: '200')\n\tend",
"def image_url\n image.present? ? image.url : ''\n end",
"def default_url\n \"http://placehold.it/450x300&text=BandPhoto\"\n end",
"def default_url\n ActionController::Base.helpers.asset_path('mails/bigimage.jpg', type: :image).to_s\n end",
"def set_img\n\n end",
"def default_url\n \"\" + [version_name, \"default_cat_icon.png\"].compact.join('_')\n end",
"def default_url\n # # For Rails 3.1+ asset pipeline compatibility:\n ActionController::Base.helpers.asset_path('fallback/' + [version_name, 'default.png'].compact.join('_'))\n #\n # \"/images/fallback/\" + [version_name, \"default.png\"].compact.join('_')\n end",
"def image_url\n model.image_url.presence || h.asset_path('face.jpg')\n end",
"def picture_url(options = {})\n return if picture.nil?\n\n picture.url(picture_url_options.merge(options)) || \"missing-image.png\"\n end",
"def default_url\n # For Rails 3.1+ asset pipeline compatibility: ActionController::Base.helpers.asset_path(\"fallback/\" + [version_name, \"default.png\"].compact.join('_'))\n \"/assets/fallback/\" + [version_name, \"default.png\"].compact.join('_')\n end",
"def set_defaults\n self.main_image ||= Placeholder.image_generator(height: 600, width: 400) # go to concern folder\n self.thumb_image ||= Placeholder.image_generator(height: 350, width: 200) # go to concern folder\n end",
"def safe_default_image\n if default_image.try(:filename).present? \n default_image\n elsif self.images.present?\n self.images.first\n else\n Product::generic_default_image\n end\n\n # To populate run task: assets::populate_default_image\n #default_image.presence || Product::generic_default_image\n end",
"def image_url(style='original')\n ENV[\"domain\"] + self.picture.image.url(:original) if self.picture.present?\n end",
"def default_url\n # For Rails 3.1+ asset pipeline compatibility:\n # ActionController::Base.helpers.asset_path(\"fallback/\" + [version_name, \"default.png\"].compact.join('_'))\n\n ActionController::Base.helpers.asset_path(super)\n end",
"def image_location\n src || ''\n end",
"def set_defaults\n self.imagepath ||= Rails.application.config.missing_sign_image\n end",
"def default_image_path\n \"default_interest_images/#{name.gsub(/\\s/,'').gsub(/\\W/,'_').downcase}\"\n end",
"def default_url\n # For Rails 3.1+ asset pipeline compatibility:\n # ActionController::Base.helpers.asset_path(\"fallback/\" + [version_name, \"default.png\"].compact.join('_'))\n \"fallback/\"+[version_name, \"default_#{mounted_as}.jpg\"].compact.join('_')\n end",
"def defaults!\n self.url = nil\n end",
"def default_url\n end",
"def imgdata fallback_to_url=true\n if picref && (href = picref.imgdata || (fallback_to_url && picref.url)).present?\n href\n end\n end",
"def default_photo_url\n self.dig_for_string(\"agentSummary\", \"defaultPhotoURL\")\n end",
"def default_url\n PLACEHOLDER_URL\n end",
"def url(size = default_style)\n image_id = instance.send(\"#{name}_#{:file_name}\")\n\n return @url_generator.for(size, {}) if image_id.nil? || image_id.empty? # Show Paperclip's default missing image path\n\n Imgurapi::Image.new(id: image_id).url(size: size, use_ssl: imgur_session.use_ssl?)\n end",
"def url_with_default *args\n unless file_name.nil?\n url_without_default *args\n else\n nil\n end\n end",
"def picurl= pu\n self.picture = ImageReferenceServices.find_or_initialize site_service&.resolve(pu)\n end",
"def src\n options.fetch(:src, image)\n end",
"def default_url\n # # For Rails 3.1+ asset pipeline compatibility:\n ActionController::Base.helpers.asset_path(\"fallback/\" + [version_name, \"default.png\"].compact.join('_'))\n \"/assets/fallback/\" + [version_name, \"default.png\"].compact.join('_')\n end",
"def preview_image_url\n nil\n end",
"def image_url\n if image.present?\n image\n else\n \"http://loremflickr.com/320/240/#{CGI.escape name}\"\n end\n end",
"def image_url\n image.presence or (email.present? and gravatar_url) or Guest::IMAGE_URL\n end",
"def set_defaults\n\t\t#when ever you are creating a new portfolio item (nothing else)\n\t\t#||= means if nil, replace with this:\n\t\tself.main_image ||= Placeholder.image_generator(height: '600', width: '400')\n\t\tself.thumb_image ||= Placeholder.image_generator(height: '350', width: '200')\n\tend",
"def pic_one_url\n \tpic_one.url(:medium)\n end",
"def default_url\n url 'default'\n end",
"def image_url\n self.data['image_url'] || nil\n end",
"def update_image_src img, options = {}\n if FedenaSetting.s3_enabled? #and options[:s3].present? and options[:s3]) \n image_url = options[:style].present? ? img.url(options[:style].to_sym,false):img.url(:original,false)\n image_url = image_url.gsub('&','&') if image_url.present? \n image_url\n # return (verify_http_https_file image_url) ? (image_tag image_url).gsub('&','&') : ''\n else\n image_path = img.path\n return \"file://#{Rails.root.join(image_path)}\"\n # return image_tag \"file://#{Rails.root.join(image_path)}\", options\n end\n end",
"def default_photo\n default_photo = image_tag(\"default-avatar.png\", :alt => \"Photo\", :size => \"180x200\")\n end",
"def avatar_url\n return image_url if image_url\n return DEFAULT_AVATAR if email.nil?\n\n gravatar_url\n end",
"def url(*args)\n if present?\n style = args.first.is_a?(Symbol) ? args.first : default_style\n options = args.last.is_a?(Hash) ? args.last : {}\n if style == :custom_thumb && is_valid_for_custom_thumb?\n custom_width = options[:width] || 220\n file_name = filename_from(default_style)\n public_url_custom_thumbnail_from(file_name, custom_width)\n else\n file_name = filename_from(style)\n public_url_for(file_name)\n end\n else\n default_image\n end\n end",
"def set_defaults\n\t\tself.main_image ||= PlaceholderConcern.image_generator(height: '200', width: '300')\n self.sport_icon ||= PlaceholderConcern.image_generator(height: '40', width: '40')\n\tend",
"def default_url\n # For Rails 3.1+ asset pipeline compatibility:\n # asset_path(\"fallback/\" + [version_name, \"default.png\"].compact.join('_'))\n puts YAML::dump(model)\n puts YAML::dump(model.respond_to?('imageable_type'))\n #raise \"very confusing ... model.class = \" + model.class.to_s + \" version = \" + version_name\n if model.respond_to?('imageable_type')\n \"/images/fallback/#{model.imageable_type.to_s}_\" + [version_name, \"default.png\"].compact.join('_')\n else\n \"/images/fallback/#{model.class.to_s}_\" + [version_name, \"default.png\"].compact.join('_')\n end\n end",
"def default_url(*args)\n \"default_document_icon.png\"\n end",
"def image(page_image = '')\n default_image = asset_url \"/images/main/main.jpg\"\n if page_image.empty?\n default_image\n else\n asset_url \"#{page_image}\"\n end\n end"
] | [
"0.7641445",
"0.7637398",
"0.75667113",
"0.75113946",
"0.7481265",
"0.7475889",
"0.7445678",
"0.7438472",
"0.74116886",
"0.74017924",
"0.7334999",
"0.7323653",
"0.7316799",
"0.7315881",
"0.7311957",
"0.7311957",
"0.7311957",
"0.7310905",
"0.73030686",
"0.72964346",
"0.72964346",
"0.72964346",
"0.72884595",
"0.7272317",
"0.72600543",
"0.7258992",
"0.7241904",
"0.72396374",
"0.7220835",
"0.71559185",
"0.71542895",
"0.7135702",
"0.7128366",
"0.7113808",
"0.71013427",
"0.7081062",
"0.7062484",
"0.7036446",
"0.70331347",
"0.6996938",
"0.6996938",
"0.6996938",
"0.6984898",
"0.6976043",
"0.6970309",
"0.69662243",
"0.6966159",
"0.69485134",
"0.69464713",
"0.69392526",
"0.6922462",
"0.69168735",
"0.6910032",
"0.68823236",
"0.6882059",
"0.68773615",
"0.6876157",
"0.68562424",
"0.68558216",
"0.6851527",
"0.6848212",
"0.68381804",
"0.6831308",
"0.68187237",
"0.6815709",
"0.68093127",
"0.6782867",
"0.678066",
"0.676593",
"0.6743395",
"0.67330056",
"0.6711554",
"0.67107797",
"0.67074966",
"0.66899717",
"0.66877306",
"0.6687483",
"0.66814744",
"0.6679577",
"0.6649625",
"0.66338307",
"0.6627962",
"0.6613522",
"0.6600887",
"0.6596979",
"0.65935075",
"0.6591493",
"0.65611875",
"0.6558779",
"0.6557681",
"0.6545296",
"0.6543388",
"0.6527198",
"0.6494083",
"0.6493189",
"0.6484731",
"0.6482685",
"0.64784145",
"0.64744216",
"0.6459927"
] | 0.8146946 | 0 |
This adds up all votes on a Post instance | def score
votes.sum(:vote)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def up_votes\n # we find the up votes for a post by passing value: 1 to where. This fetches a collection of votes with a value of 1. \n # We then call count on the collection to get a total of all up votes.\n votes.where(value: 1).count\n end",
"def vote_sum\n sum = 0.0\n votes.each do |v|\n sum += v.value\n end\n sum\n end",
"def post_votes\n []\n end",
"def total_votes\n self.reload\n self.votes.count\n end",
"def total_votes\n self.reload\n self.votes.count\n end",
"def count_votes\n votes = 0\n QuestionVote.where(question_id: self.id).each do |question|\n votes += question.vote\n end\n votes\n end",
"def voted\n new_total = self.votes + 1\n return self.update(votes: new_total)\n end",
"def add_vote\n self.increment!(:votes, 1)\n end",
"def total_votes\n self.votes.sum(:value)\n end",
"def uppost\n post = Post.find_by_id(params[:id])\n if !post.nil?\n post.vote(current_user, true)\n end\n end",
"def create_vote\n user.votes.create(value: 1, post: self)\n end",
"def update_votes(count)\n update votes: @data[:votes] + count do |data|\n self.data = data\n end\n end",
"def create_vote\r\n\t\tuser.votes.create(value: 1, post: self)\r\n\tend",
"def upvotes\n votes.sum(:upvote)\n end",
"def create_vote\n self.user.votes.create(value: 1, post: self)\n end",
"def create_vote\n self.user.votes.create(value: 1, post: self)\n end",
"def upvote_post(params)\n db = SQLite3::Database.new(\"db/database.db\")\n db.results_as_hash = true\n\n current_upvotes = db.execute(\"SELECT posts.Upvotes FROM posts WHERE postId = ?\", params[\"post_id\"])\n\n new_upvotes = current_upvotes[0][\"Upvotes\"].to_i + 1\n\n db.execute(\"UPDATE posts SET Upvotes = ? WHERE postId = ?\", new_upvotes, params[\"post_id\"])\n end",
"def get_votes_for_post(postid)\n return Vote.select(:user_id).where(:post_id => postid).count\n end",
"def create_vote\n user.votes.create(value: 1, post: self)\n end",
"def votes\n total_votes = 0\n self.options.each do |vote_val|\n #todo: this is probably wrong\n total_votes += vote_val.to_i\n end\n total_votes += (REDIS_VOTES.get('YES:' + self.id).to_i + REDIS_VOTES.get('NO:' + self.id).to_i)\n end",
"def create_vote\n\t\tuser.votes.create(value: 1, post: self)\n\tend",
"def points\n votes.sum(:value)\n end",
"def points\n votes.sum(:value)\n end",
"def total_votes\n up_votes + down_votes\n end",
"def total_up_votes\n self.reload\n self.votes.are(:up).count\n end",
"def total_up_votes\n self.reload\n self.votes.are(:up).count\n end",
"def rate\n votes = answers.inject(0) do |sum, a| \n sum + a.votes.count \n end\n \n # Return a count of votes and answers\n answers.count + votes\n end",
"def upvote\n self.votes += 1\n save\n end",
"def total_votes\n answers.sum(&:votes_count)\n end",
"def total_votes\n self.get_upvotes.size - self.get_downvotes.size\n end",
"def total\n votes.sum(:value)\n end",
"def up_votes\n\t#\tself.votes.where(value: 1).count\n\t\tvotes.where(value: 1).count\n\tend",
"def votes_count\n upvotes + downvotes\n end",
"def increment_votes\n Article.increment_vote_cache(article_id)\n end",
"def upvote_question\n self.update(votes_count: self.votes_count + 1)\n end",
"def add_vote(vote)\n self.score = self.score + vote.value\n self.votes_count = self.votes_count + 1\n end",
"def upvote_post_i(params)\n db = SQLite3::Database.new(\"db/database.db\")\n db.results_as_hash = true\n\n current_upvotes = db.execute(\"SELECT posts.Upvotes FROM posts WHERE postId = ?\", params[\"postId\"])\n\n new_upvotes = current_upvotes[0][\"Upvotes\"].to_i + 1\n\n db.execute(\"UPDATE posts SET Upvotes = ? WHERE postId = ?\", new_upvotes, params[\"postId\"])\n end",
"def upvote\n @post = Post.find(params[:id])\n @post_count = Post.count\n @vote = Vote.new(user_id: session[:id], post_id: @post.id, score: 1)\n if @vote.save\n @post.update_attribute(:respect, @post.respect + 1)\n flash[:notice] = 'Post upvoted successfully'\n end\n redirect_to(action: 'index', topic_id: @topic.id)\n end",
"def get_votes\n @votes = Vote.all\n end",
"def upvote\n\t\tif vote_once\n\t\t\t@vote = @post.votes.create(user_id: current_user.id)\n\t\telse\n\t\t\t@vote = false\n\t\tend\n\t\tbyebug\n\t\trespond_to do |format|\n\t\t\tformat.js\n\t\tend\n\tend",
"def upvote\n\t@post = Post.find(params[:id])\n\[email protected] = @post.votes + 1\n puts @post.votes\n\n\n\n\trespond_to do |format|\n if @post.update(post_par2)\n\t\tformat.html { redirect_to @post, notice: 'Post was successfully upvoted.' }\n\t\tformat.json { render :show, status: :ok, location: @post }\n end\n\tend\n end",
"def set_vote_tally!\n self.vote_tally = self.get_upvotes.size - self.get_downvotes.size\n end",
"def points\n self.votes.inject(0) { |points, vote| points + vote.value }\n end",
"def points\n self.votes.inject(0) { |points, vote| points + vote.value }\n end",
"def vote_count\n self.votes.count\n end",
"def get_votes\n ids = @posts.map(&:id)\n votes = Vote.where(\"post_id in (:ids) and ((user_id IS NOT null and user_id = :user_id) or (ip_address = :ip))\", {:ids => ids, :user_id => current_user, :ip => request.remote_ip})\n votes.map{|vote| {:id => vote.post_id.to_s, :positive => (vote.rating > 0) ? true : false } }\n end",
"def increase_vote_count\n \tcount = voteable.votes_count\n \tcount = count + 1\n \tvoteable.update_attributes(votes_count: count)\n end",
"def upvote\n @post = Post.find_by(id: params[:id])\n # raise 'hell'\n\n # the following line to be uncommented when we go live to allow for 1 vote per user\n # Vote.find_or_create_by(post: @post, user: @current_user)\n # Vote.find_or_create_by(upvote: 1, post: @post, user: @current_user)\n Vote.create(upvote: 1, post: @post, user: @current_user)\n check_score()\n make_request()\n end",
"def vote\n value = params[:type] == \"up\" ? 1 : -1\n @mypost = Mypost.find(params[:id])\n @mypost.add_or_update_evaluation(:votes, value, current_user)\n redirect_to :back, notice: \"Thank you for voting!\"\nend",
"def get_votes\n\t\[email protected]{ |voter| @votes << voter.vote(@candidates) }\n\tend",
"def create_vote\n \t\t#self.votes.create(value: 1, user: self.user )\n \t#\tvotes.create(value: 1, user: user )\n\t \tuser.votes.create(value: 1, post: self)\n \tend",
"def total_votes\n votes.sum(:weight)\n end",
"def up_votes\n votes.where(value: 1).count\n end",
"def up_votes\n votes.where(value: 1).count\n end",
"def up_votes\n votes.where(value: 1).count\n end",
"def up_votes\n votes.where(value: 1).count\n end",
"def vote\n value = params[:type] == \"up\" ? 1 : -1\n @post.add_or_update_evaluation(:votes, value, current_user)\n redirect_to :back\n end",
"def upvotes_count\n topic_votes.where(value: 1).sum(:value)\n end",
"def destroy_votes\n Vote.where(post_id: self.id).destroy_all\n end",
"def vote_up\n update_votes(1)\n end",
"def upvote\n\t @post = Post.find(params[:id])\n\t @post.upvote_by current_user\n\t redirect_to root_path\n\n\tend",
"def upvote_count\n self.get_upvotes.size\n end",
"def votes_count\n votes.size\n end",
"def total_votes\n num_of_votes = self.votes.count\n return num_of_votes\n end",
"def upvote(answer)\n upvoted_answers << answer\n end",
"def points\n self.answer_votes.sum(:value).to_i\n end",
"def vote_total\n if self.votes.length > 0\n self.votes.reduce(0){|sum, vote| sum + vote.value}\n else\n self.votes.length\n end\n end",
"def total_upvotes\n\t\tself.get_upvotes.sum(:vote_weight)\n\tend",
"def create\n @post = Post.find(params[:postID])\n if (@post.checkIfVoted(@post.id.to_s, session[:user_id].to_s)[0]!=nil )\n redirect_to @post, notice: 'You have already voted for this post.'\n elsif @post.postUserID.to_s == session[:user_id].to_s\n redirect_to @post, notice: 'You can not vote for yourself'\n else\n @vote = Vote.new(params[:vote])\n @vote.postID = params[:postID]\n @vote.userID = session[:user_id]\n\n @post.increment(:votes)\n @post.save\n # @post.voted((@post.votes+1).to_s,@post.id.to_s)\n #@post.increment(votes)\n\n respond_to do |format|\n if @vote.save\n format.html { redirect_to @post, notice: 'Vote successfully.' }\n format.json { render json: @vote, status: :created, location: @vote }\n else\n format.html { render action: \"new\" }\n format.json { render json: @vote.errors, status: :unprocessable_entity }\n end\n end\n end\n end",
"def vote_count\n votes.sum('direction')\n end",
"def add_review_votes_to_review\n # increment the count of votes regardless of stance\n if self.review.helpful_count.nil?\n self.review.helpful_count = 1\n else\n self.review.helpful_count += 1\n end\n\n # adjust the score to incorporate the up-vote, if it's an up-vote\n if self.helpful?\n if self.review.helpful_score.nil?\n self.review.helpful_score = 1\n else\n self.review.helpful_score += 1\n end\n end\n \n self.review.save!\n end",
"def total_down_votes\n self.reload\n self.votes.are(:down).count\n end",
"def total_down_votes\n self.reload\n self.votes.are(:down).count\n end",
"def upvote_count\n self.up_retweet_count\n end",
"def total_votes\n\t\tself.votes.where(vote: true).size - self.votes.where(vote: false).size\n\tend",
"def viewPostsByVotes\n @results = Array.new\n @results = Post.find_by_sql('SELECT title, content, COUNT(post_id) FROM posts INNER JOIN votes ON posts.id = votes.post_id GROUP BY posts.id ORDER BY COUNT(post_id) DESC') #query for getting the number of votes per post\n end",
"def update_rating!\n # not using count because lates some votes might be something other than +/- 1\n self.positive_vote_count = votes.positive.sum(:value).abs\n self.negative_vote_count = votes.negative.sum(:value).abs\n self.rating = votes.sum(:value)\n save!\n end",
"def votes_left\n vote_total = 10\n # @submissions = Submission.find_all_by_story_id(params[:id])\n @submissions.each do |submission|\n vote_total -= submission.vote\n end\n vote_total\nend",
"def score\n # add score caching\n total = 0\n self.votes.each do |vote|\n total += vote.value\n end\n total\n end",
"def after_create\n election.vote_count = election.vote_count + 1\n election.save\n end",
"def post_count\n self.interests_posts.count\n end",
"def set_votes\n \n @upvote = []\n @downvote = []\n\n if logged_in?\n votes = Vote.where(:user_id => session[:user_id]).to_a\n votes.each do |vote|\n @upvote << vote[:comment_id].to_i if vote[:upvote].to_i == 1\n @downvote << vote[:comment_id].to_i if vote[:downvote].to_i == 1\n end\n end\n end",
"def index\n @board_post_upvotes = BoardPostUpvote.all\n end",
"def upvote\n\t\tvotes = self.nov\n\t\tupdate(nov: votes +1)\n\tend",
"def get_vote_count(postid_array)\n values = Array.new\n postid_array.each do |x|\n values << get_votes_for_post(x)\n end\n values.inject{|sum,y| sum + y }\n end",
"def upvote\n @post.likes.create(user_id: current_user.id)\n\n respond_to do |format|\n format.html { redirect_to posts_path }\n format.js\n end\n end",
"def load_post_and_vote\n @post = Post.find(params[:post_id])\n @vote = @post.votes.where(user_id: current_user.id).first\n end",
"def upvotes\n votes.where(Vote.arel_table[:weight].gt(0)).sum(:weight)\n end",
"def likes\n self.cached_votes_total\n end",
"def upvote\n\t\t# the post is set to the params\n\t\tpost = Post.find(params[:post_id])\n\t\t# set comment to the that comment's params\n\t\tcomment = post.comments.find(params[:id])\n\t\t# increment that comment's upvotes\n\t\tcomment.increment!(:upvotes)\n\t\trespond_with post, comment\n\tend",
"def up_vote\n @post = Post.not_published.find(params[:id])\n vote = @post.moderator_votes.new(:up_vote => true)\n vote.user = current_user if logged_in?\n vote.session_id = session[:session_id]\n vote.save\n flash[:notice] = \"Thanks for your help moderating upcoming posts.\"\n redirect_to moderators_path\n end",
"def total_votes\n \tself.shout_votes.count\n end",
"def calculate_tallied_votes\n self.tallied_votes = upvotes - downvotes\n self.save\n end",
"def setup_posts(posts, user)\n @posts_with_votes = []\n #\\33t h6x\n if !posts.nil?\n posts.each do |post|\n vote = nil\n share = nil\n if !user.nil?\n vote = Vote.find_by_user_id_and_post_id(user.id, post.id)\n end\n @posts_with_votes.push(OpenStruct.new(post.attributes.merge({current_user_vote: parse_vote(vote), watch_stat: post.watch_stat, ignore_stat: post.ignore_stat, user: post.user})))\n end\n end\n end",
"def vote_count\n options.values.reduce(:+)\n end",
"def upvote(user)\n unless self.voters.any? {|id| id.to_s == user.uid.to_s}\n self.voters << user.uid\n self.votes += 1\n self.relevance = calculate_relevance unless new_record?\n self.save\n end\n end",
"def index\n \t@posts = Post.all.sort_by{|x| x.total_votes}.reverse\n end",
"def votes\n @votes ||= ArkEcosystem::Client::API::Votes.new(@client)\n end",
"def get_vote_tally\n return self.get_upvotes.size - self.get_downvotes.size\n end",
"def number_of_votes\n self.votes.size\n end"
] | [
"0.7320817",
"0.67779607",
"0.67779",
"0.6758999",
"0.6758999",
"0.67505",
"0.66547763",
"0.6654599",
"0.66474044",
"0.6647028",
"0.66211236",
"0.6620512",
"0.6609348",
"0.66054505",
"0.6598206",
"0.6598206",
"0.659603",
"0.6586943",
"0.65743285",
"0.65593696",
"0.6553084",
"0.65464973",
"0.65464973",
"0.6525919",
"0.6514089",
"0.6514089",
"0.6508227",
"0.6440268",
"0.64287144",
"0.6423945",
"0.6419071",
"0.6417469",
"0.64160204",
"0.6402834",
"0.6384208",
"0.6374509",
"0.63693273",
"0.6366381",
"0.6365558",
"0.6359893",
"0.6353306",
"0.63527244",
"0.6342585",
"0.6342585",
"0.63198286",
"0.6314598",
"0.6306834",
"0.6305761",
"0.6285561",
"0.62570107",
"0.6242434",
"0.6216962",
"0.6212167",
"0.6212167",
"0.6212167",
"0.6212167",
"0.6209545",
"0.62079877",
"0.6204878",
"0.61778426",
"0.616351",
"0.61496156",
"0.6147979",
"0.61286163",
"0.61072534",
"0.61024934",
"0.60661685",
"0.60649353",
"0.6061916",
"0.60575306",
"0.60568255",
"0.60543895",
"0.60543895",
"0.60358024",
"0.6026079",
"0.6023818",
"0.6021887",
"0.60184616",
"0.6018267",
"0.60076356",
"0.5997157",
"0.5995348",
"0.5991664",
"0.59866756",
"0.5979023",
"0.59565294",
"0.59532183",
"0.59492666",
"0.5948666",
"0.5930735",
"0.5925765",
"0.59214056",
"0.5917913",
"0.5904352",
"0.58883315",
"0.58815706",
"0.5874309",
"0.58641416",
"0.5837364",
"0.5837054"
] | 0.5846956 | 98 |
test initialization of scm_config model. | def test_ut_scm_config_11
scmconfig=ScmConfig.new(
:tool => "SVN",
:tool_ids => "2",
:repo_path => "http://a.b.c/x/y/z/fred.gif",
:master_name => "yyy",
:interval => "1 2 3 4 5"
)
assert_equal("SVN",scmconfig.tool)
assert_equal(2,scmconfig.tool_ids)
assert_equal("http://a.b.c/x/y/z/fred.gif",scmconfig.repo_path)
assert_equal("yyy",scmconfig.master_name)
assert_equal("1 2 3 4 5",scmconfig.interval)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initialize\n set_config\n end",
"def run_init\n run(\n result:\n ::Kitchen::Terraform::Client::Command\n .init(\n options:\n ::Kitchen::Terraform::Client::Options\n .new\n .disable_input\n .enable_lock\n .lock_timeout(duration: config_lock_timeout)\n .maybe_no_color(toggle: !config_color)\n .upgrade\n .from_module(source: config_directory)\n .enable_backend\n .force_copy\n .backend_configs(keys_and_values: config_backend_configurations)\n .enable_get\n .maybe_plugin_dir(path: config_plugin_directory)\n .verify_plugins(toggle: config_verify_plugins),\n working_directory: instance_directory\n )\n )\n end",
"def test_initialize\n test = @type.provide(:test)\n\n inst = @type.new :name => \"boo\"\n prov = nil\n assert_nothing_raised(\"Could not init with a resource\") do\n prov = test.new(inst)\n end\n assert_equal(prov.resource, inst, \"did not set resource correctly\")\n assert_equal(inst.name, prov.name, \"did not get resource name\")\n\n params = {:name => :one, :ensure => :present}\n assert_nothing_raised(\"Could not init with a hash\") do\n prov = test.new(params)\n end\n assert_equal(params, prov.send(:instance_variable_get, \"@property_hash\"), \"did not set resource correctly\")\n assert_equal(:one, prov.name, \"did not get name from hash\")\n\n assert_nothing_raised(\"Could not init with no argument\") do\n prov = test.new\n end\n\n assert_raise(Puppet::DevError, \"did not fail when no name is present\") do\n prov.name\n end\n end",
"def initialize(config)\n\t\tend",
"def _init_configuration\n\t\t# Set defaults\n\t\t@setup = { \"create\" => false, \"environment\" => false, \"test\" => true, \"destroy\" => false }\n\t\t@config = false\n\tend",
"def initialize(config)\n end",
"def initialize(config)\n end",
"def init!\n # check if configuration file is already created\n puts \"=> [MoIP] Sandbox mode enabled\" if sandbox?\n unless File.exist?(CONFIG_FILE)\n puts \"=> [Moip] The configuration could not be found at #{CONFIG_FILE.inspect}\"\n return\n end\n end",
"def initialize(config)\n @config = config\n setup\n end",
"def init_core_config(the_config)\n if the_config.nil?\n @config = Lorj::Config.new\n Lorj.debug(2, 'Using an internal Lorj::Config object.')\n else\n @config = the_config\n end\n end",
"def init_compile_config\n end",
"def test_default_version_is_set_if_no_version_is_provided_in_constructor\n Crd::Spec.new 'Testing' do |s|\n assert_equal( Crd::Spec::UNVERSIONED, s.version )\n end\n end",
"def init_compile_config\n # TODO\n end",
"def init_compile_config\n # TODO\n end",
"def bootstrap_init\n end",
"def test_ppmtogdlcfg_ctor\r\n target = PpmToGdlCfg.new(@dataDir)\r\n \r\n assert(nil != target)\r\n end",
"def test_initialize_hash\n assert_nothing_raised do\n dfp_api = DfpApi::Api.new(DEFAULT_CONFIG_HASH)\n check_config_data(dfp_api.config)\n end\n end",
"def initialize\n @config = DebMaker::Config.new\n yield @config\n @config.validate\n end",
"def init\n if @args.first.nil?\n @ui.error('Please specify the node')\n return ARGUMENT_ERROR_RESULT\n end\n @mdbci_config = Configuration.new(@args.first, @env.labels)\n result = NetworkSettings.from_file(@mdbci_config.network_settings_file)\n if result.error?\n @ui.error(result.error)\n return ARGUMENT_ERROR_RESULT\n end\n\n @network_settings = result.value\n @product = @env.nodeProduct\n @product_version = @env.productVersion\n if @product.nil? || @product_version.nil?\n @ui.error('You must specify the name and version of the product')\n return ARGUMENT_ERROR_RESULT\n end\n\n @machine_configurator = MachineConfigurator.new(@ui)\n\n SUCCESS_RESULT\n end",
"def test_initialize_with_settings\n assert_nothing_raised do\n klass.new(settings)\n end\n end",
"def init_repo\n Repository::Config.new(@repo, @log, @process, @type).status(3) {\n init_cmd = 'codeclimate init'\n init_result = `#{init_cmd}`\n }\n end",
"def initialize(config = nil)\n @config = config\n setup\n end",
"def initialize(config)\n @config = config\n @config.symbolize_keys!\n @check_all = true\n end",
"def init\n end",
"def init\n end",
"def init\n end",
"def test_initialize_filename\n assert_nothing_raised do\n dfp_api = DfpApi::Api.new(DEFAULT_CONFIG_FILENAME)\n check_config_data(dfp_api.config)\n end\n end",
"def init\n if @args.first.nil?\n @ui.error('Please specify the configuration')\n return ARGUMENT_ERROR_RESULT\n end\n\n @mdbci_config = Configuration.new(@args.first, @env.labels)\n @keyfile = @env.keyFile.to_s\n unless File.exist?(@keyfile)\n @ui.error('Please specify the key file to put to nodes')\n return ARGUMENT_ERROR_RESULT\n end\n result = NetworkSettings.from_file(@mdbci_config.network_settings_file)\n if result.error?\n @ui.error(result.error)\n return ARGUMENT_ERROR_RESULT\n end\n\n @network_settings = result.value\n SUCCESS_RESULT\n end",
"def test_scm_st_031\n printf \"\\n Test 031\"\n open_periodical_analysis_setting_tab\n fill_scm_form(\"SVN\",\n nil,\n nil,\n URL_SVN_RIGHT_KEYWORD,\n LOGIN_RIGHT_KEYWORD,\n PASSWORD_RIGHT_KEYWORD,\n nil,\n MASTER_BASE_NAME_RIGHT_KEYWORD,\n 0,\n 1\n )\n click $display_scm_xpath[\"save_button\"]\n sleep SLEEP_TIME\n begin\n assert(is_text_present($display_scm[\"success_message\"]))\n open \"/devgroup/pj_index/1/1\"\n wait_for_page_to_load LOAD_TIME\n @selenium.click $display_scm_xpath[\"menu_link\"]\n sleep SLEEP_TIME\n @selenium.click $display_scm_xpath[\"scm_tab\"]\n sleep SLEEP_TIME\n assert !is_checked($display_scm_xpath[\"qac\"])\n assert is_checked($display_scm_xpath[\"qacpp\"])\n rescue Test::Unit::AssertionFailedError\n @verification_errors << $!\n end\n logout\n ScmConfig.destroy_all\n end",
"def init\n\n end",
"def test_scm_st_030\n printf \"\\n Test 030\"\n open_periodical_analysis_setting_tab\n fill_scm_form(\"SVN\",\n nil,\n nil,\n URL_SVN_RIGHT_KEYWORD,\n LOGIN_RIGHT_KEYWORD,\n PASSWORD_RIGHT_KEYWORD,\n nil,\n MASTER_BASE_NAME_RIGHT_KEYWORD,\n 1,\n 0\n )\n click $display_scm_xpath[\"save_button\"]\n sleep SLEEP_TIME\n begin\n assert(is_text_present($display_scm[\"success_message\"]))\n open \"/devgroup/pj_index/1/1\"\n wait_for_page_to_load LOAD_TIME\n @selenium.click $display_scm_xpath[\"menu_link\"]\n sleep SLEEP_TIME\n @selenium.click $display_scm_xpath[\"scm_tab\"]\n sleep SLEEP_TIME\n assert is_checked($display_scm_xpath[\"qac\"])\n assert !is_checked($display_scm_xpath[\"qacpp\"])\n rescue Test::Unit::AssertionFailedError\n @verification_errors << $!\n end\n logout\n ScmConfig.destroy_all\n end",
"def initialize_valid_environment\n require_box(\"default\")\n\n assert_execute(\"vagrant\", \"box\", \"add\", \"base\", box_path(\"default\"))\n assert_execute(\"vagrant\", \"init\")\n end",
"def initialize(config)\n @config = config\n end",
"def initialize(config)\n @config = config\n end",
"def test_init\n \tassert_equal(UI.parseCommand('init', InitCmd1*\" \"),UI.main(InitCmd1))\n \tassert_equal(UI.parseCommand('init', InitCmd2*\" \"),UI.main(InitCmd2))\n \tassert_equal(UI.parseCommand('init', InitCmdInv*\" \"),UI.main(InitCmdInv))\n end",
"def test_accepts_version_through_constructor\n Crd::Spec.new 'Testing', '1.0.4' do |s|\n assert_equal( '1.0.4', s.version )\n end\n end",
"def pre_initialize\n end",
"def at_init\n\n\t\tend",
"def test_scm_st_032\n printf \"\\n Test 032\"\n open_periodical_analysis_setting_tab\n fill_scm_form(\"SVN\",\n nil,\n nil,\n URL_SVN_RIGHT_KEYWORD,\n LOGIN_RIGHT_KEYWORD,\n PASSWORD_RIGHT_KEYWORD,\n nil,\n MASTER_BASE_NAME_RIGHT_KEYWORD,\n 1,\n 1\n )\n click $display_scm_xpath[\"save_button\"]\n sleep SLEEP_TIME\n begin\n assert(is_text_present($display_scm[\"success_message\"]))\n open \"/devgroup/pj_index/1/1\"\n wait_for_page_to_load LOAD_TIME\n @selenium.click $display_scm_xpath[\"menu_link\"]\n sleep SLEEP_TIME\n @selenium.click $display_scm_xpath[\"scm_tab\"]\n sleep SLEEP_TIME\n assert is_checked($display_scm_xpath[\"qac\"])\n assert is_checked($display_scm_xpath[\"qacpp\"])\n rescue Test::Unit::AssertionFailedError\n @verification_errors << $!\n end\n logout\n ScmConfig.destroy_all\n end",
"def pre_initialize; end",
"def init; end",
"def init; end",
"def init; end",
"def init; end",
"def setup_initial_config!\n application.config do\n attribute :praxis do\n attribute :validate_responses, Attributor::Boolean, default: false\n attribute :validate_response_bodies, Attributor::Boolean, default: false\n\n attribute :show_exceptions, Attributor::Boolean, default: false\n attribute :x_cascade, Attributor::Boolean, default: true\n end\n end\n end",
"def initialize(machine, config)\n @machine = machine\n @config = config\n end",
"def initialize(machine, config)\n @machine = machine\n @config = config\n end",
"def initialize(data_source_config)\n end",
"def before_configure_rspec\n validate_created_org(test_org) if validate_org\n end",
"def test_configure\n Moodle.configure({\n :username => 'test_username',\n :password => 'test_password'\n })\n\n assert_equal 'test_username', Moodle.config[:username]\n assert_equal 'test_password', Moodle.config[:password]\n end",
"def test_initialize\n request = OIDC::Request.new(@params)\n assert_equal @params[:response_type], request.response_type\n assert_equal @params[:client_id], request.client_id\n assert_equal @params[:redirect_uri], request.redirect_uri\n assert_equal @params[:scope], request.scope\n assert_equal @params[:state], request.state\n assert_equal @params[:nonce], request.nonce\n end",
"def test_scm_st_041\n printf \"\\n Test 041\"\n open_periodical_analysis_setting_tab\n fill_scm_form(\"SVN\",\n nil,\n nil,\n URL_SVN_RIGHT_KEYWORD,\n LOGIN_RIGHT_KEYWORD,\n PASSWORD_RIGHT_KEYWORD,\n nil,\n MASTER_BASE_NAME_RIGHT_KEYWORD,\n 1,\n 1\n )\n click $display_scm_xpath[\"save_button\"]\n sleep SLEEP_TIME\n begin\n assert(is_text_present($display_scm[\"success_message\"]))\n type($display_scm_xpath[\"password_field\"], PASSWORD_RIGHT_KEYWORD)\n click $display_scm_xpath[\"save_button\"]\n sleep SLEEP_TIME\n assert(is_text_present($display_scm[\"update_message\"]))\n rescue Test::Unit::AssertionFailedError\n @verification_errors << $!\n end\n logout\n ScmConfig.destroy_all\n end",
"def init!\n # check if configuration file is already created\n unless File.exist?(CONFIG_FILE)\n puts \"=> [PagSeguro] The configuration could not be found at #{CONFIG_FILE.inspect}\"\n return\n end\n \n # The developer mode is enabled? So install it!\n developer_mode_install! if developer?\n end",
"def test_initialize\n assert_equal(2, @TwoCardHand.max_hand, 'Expected max hand size: 2 for <TwoCardHand>')\n assert_equal(2, @TwoCardHand.cards_in_hand, 'Expected hand size: 2 on initialization')\n\n assert_equal(5, @FiveCardHand.max_hand, 'Expected max hand size: 5 for <FiveCardHand>')\n assert_equal(5, @FiveCardHand.cards_in_hand, 'Expected hand size: 5 on initialization')\n end",
"def initialize(config)\n @config = config\n end",
"def initialize(config)\n @config = config\n end",
"def initialize(config)\n @config = config\n end",
"def initialize(config = nil)\n self.config = config || Cartage::Config.load(:default)\n end",
"def before_initialize(&block); end",
"def initialize(config = {})\n @config = OpenStruct.new(config)\n validate_config!\n end",
"def initialize config\n connect config\n create_table_if_not_exists!\n end",
"def initialize_model\n end",
"def test_config\n load_config\n assert(@config.key?('user'))\n assert(@config.key?('pass'))\n assert(@config.key?('port'))\n assert(@config.key?('uri'))\n assert(@config.key?('callback_host'))\n assert(@config.key?('autopwn_url'))\n end",
"def initialize(_config)\n raise NotImplementedError, \"must implement ##{__method__}\"\n end",
"def initialize\n @config = OpenStruct.new\n end",
"def initialize(config = {})\n init_config(config)\n end",
"def initialize(config = {})\n init_config(config)\n end",
"def initialize(config = {})\n init_config(config)\n end",
"def load_config()\n self.config = Kitchenplan::Config.new().config\n end",
"def initialize(config)\n run_hook(:before_initialize, config)\n\n @config = config\n raise ::SORM::NotConfigured, \"You should configure database path\" unless has_config?\n\n @db = SDBM.open config[:database]\n\n run_hook(:after_initialize, db)\n end",
"def init!\n @defaults = {\n :@refresh_token => ENV[\"STC_REFRESH_TOKEN\"],\n :@client_id => ENV[\"STC_CLIENT_ID\"],\n :@client_secret => ENV[\"STC_CLIENT_SECRET\"],\n :@language_code => \"nl-NL\",\n :@environment => 'test',\n :@version => 1,\n :@verbose => false,\n }\n end",
"def initialize(config:, connection:, logger:, version_requirement:, workspace_name:)\n self.complete_config = config.to_hash.merge upgrade_during_init: true, workspace_name: workspace_name\n self.connection = connection\n self.client_version = ::Gem::Version.new \"0.0.0\"\n self.logger = logger\n self.workspace_name = workspace_name\n self.workspace_new = ::Kitchen::Terraform::Command::WorkspaceNew.new config: complete_config\n self.workspace_select = ::Kitchen::Terraform::Command::WorkspaceSelect.new config: complete_config\n self.verify_version = ::Kitchen::Terraform::VerifyVersion.new(\n config: complete_config,\n logger: logger,\n version_requirement: version_requirement,\n )\n self.version = ::Kitchen::Terraform::Command::Version.new\n end",
"def initialize(config)\n super\n # stupid, kinda, but wanted to test plugin-specific options\n @seed = config[\"seed\"].to_i # not even using it really\n @unit = \"randoms\"\n end",
"def init(config)\n config.each{|k, v|\n @config[k] = v\n }\n end",
"def test_scm_st_015\n printf \"\\n Test 015\"\n open_periodical_analysis_setting_tab\n fill_scm_form(\"SVN\",\n nil,\n nil,\n URL_SVN_RIGHT_KEYWORD,\n LOGIN_RIGHT_KEYWORD,\n PASSWORD_RIGHT_KEYWORD,\n nil,\n MASTER_BASE_NAME_RIGHT_KEYWORD,\n 1,\n 0\n )\n click $display_scm_xpath[\"save_button\"]\n sleep SLEEP_TIME\n begin\n assert(is_text_present($display_scm[\"success_message\"]))\n open \"/devgroup/pj_index/1/1\"\n wait_for_page_to_load LOAD_TIME\n @selenium.click $display_scm_xpath[\"menu_link\"]\n sleep SLEEP_TIME\n @selenium.click $display_scm_xpath[\"scm_tab\"]\n sleep SLEEP_TIME\n assert_equal \"SVN\",get_selected_value($display_scm_xpath[\"scm_select_field\"])\n# rescue Test::Unit::AssertionFailedError\n# @verification_errors << $!\n end\n logout\n ScmConfig.destroy_all\n end",
"def setup(state) ; end",
"def init; end",
"def test_prospector_initializer\n test_prospector = Prospector.new(nil, nil)\n assert_nil(test_prospector.id)\n assert_nil(test_prospector.cur_location)\n assert_equal(0, test_prospector.silver)\n assert_equal(0, test_prospector.gold)\n end",
"def test_scm_st_023\n printf \"\\n Test 023\"\n open_periodical_analysis_setting_tab\n fill_scm_form(\"SVN\",\n nil,\n nil,\n URL_SVN_RIGHT_KEYWORD,\n LOGIN_RIGHT_KEYWORD,\n PASSWORD_RIGHT_KEYWORD,\n nil,\n MASTER_BASE_NAME_RIGHT_KEYWORD,\n 1,\n 0\n )\n click $display_scm_xpath[\"save_button\"]\n sleep SLEEP_TIME\n begin\n assert(is_text_present($display_scm[\"success_message\"]))\n rescue Test::Unit::AssertionFailedError\n @verification_errors << $!\n end\n logout\n ScmConfig.destroy_all\n end",
"def initialize\n puts INITIALIZER_MESSAGE\n end",
"def setup_config\n # To be Extended\n end",
"def initialize()\r\n buildProperties = parse([BUILD_PROPERTIES, LOCAL_PROPERTIES]);\r\n testProperties = parse([TEST_PROPERTIES, LOCAL_PROPERTIES]);\r\n @app_host = testProperties[\"config_appHost\"]\r\n @module_html = buildProperties[\"config_appStartupUrl\"]\r\n @base_url = self.app_host + \"/\" + self.module_html\r\n @admin_user = testProperties[\"config_credentialsAdmin\"]\r\n @normal_user = testProperties[\"config_credentialsUser\"]\r\n @browser = testProperties[\"config_capybaraSeleniumBrowser\"]\r\n @browserPath = testProperties[\"config_capybaraSeleniumBrowserPath\"]\r\n @defaultAjaxWaitTime = testProperties[\"config_defaultAjaxWaitTime\"]\r\n end",
"def initialize(config = nil)\n @config = config\n end",
"def config_load(config); end",
"def test_scm_st_019\n printf \"\\n Test 019\"\n open_periodical_analysis_setting_tab\n fill_scm_form(\"SVN\",\n nil,\n nil,\n URL_SVN_RIGHT_KEYWORD,\n LOGIN_RIGHT_KEYWORD,\n PASSWORD_RIGHT_KEYWORD,\n nil,\n MASTER_BASE_NAME_RIGHT_KEYWORD,\n 1,\n 0\n )\n click $display_scm_xpath[\"save_button\"]\n sleep SLEEP_TIME\n begin\n assert(is_text_present($display_scm[\"success_message\"]))\n open \"/devgroup/pj_index/1/1\"\n wait_for_page_to_load LOAD_TIME\n @selenium.click $display_scm_xpath[\"menu_link\"]\n sleep SLEEP_TIME\n @selenium.click $display_scm_xpath[\"scm_tab\"]\n sleep SLEEP_TIME\n assert_equal URL_SVN_RIGHT_KEYWORD,get_value($display_scm_xpath[\"url_field\"])\n# rescue Test::Unit::AssertionFailedError\n# @verification_errors << $!\n end\n logout\n ScmConfig.destroy_all\n end",
"def test_scm_st_021\n printf \"\\n Test 021\"\n open_periodical_analysis_setting_tab\n fill_scm_form(\"SVN\",\n nil,\n nil,\n URL_SVN_RIGHT_KEYWORD,\n LOGIN_RIGHT_KEYWORD,\n PASSWORD_RIGHT_KEYWORD,\n nil,\n MASTER_BASE_NAME_RIGHT_KEYWORD,\n 1,\n 0\n )\n click $display_scm_xpath[\"save_button\"]\n sleep SLEEP_TIME\n begin\n assert(is_text_present($display_scm[\"success_message\"]))\n open \"/devgroup/pj_index/1/1\"\n wait_for_page_to_load LOAD_TIME\n @selenium.click $display_scm_xpath[\"menu_link\"]\n sleep SLEEP_TIME\n @selenium.click $display_scm_xpath[\"scm_tab\"]\n sleep SLEEP_TIME\n assert_equal LOGIN_RIGHT_KEYWORD,get_value($display_scm_xpath[\"user_field\"])\n rescue Test::Unit::AssertionFailedError\n @verification_errors << $!\n end\n logout\n ScmConfig.destroy_all\n end",
"def pre_setup_suite()\n @cfg['pre_setup'] =\"defined\"\n return true\n end",
"def initialize(config)\n case config\n when String\n @config = Snooper::Config.load config\n else\n @config = config\n end\n end",
"def init\n\nend",
"def load_repo_config; end",
"def test_scm_st_024\n printf \"\\n Test 024\"\n open_periodical_analysis_setting_tab\n fill_scm_form(\"SVN\",\n nil,\n nil,\n URL_SVN_RIGHT_KEYWORD,\n LOGIN_RIGHT_KEYWORD,\n PASSWORD_RIGHT_KEYWORD,\n 1,\n MASTER_BASE_NAME_RIGHT_KEYWORD,\n 1,\n 0\n )\n click $display_scm_xpath[\"save_button\"]\n sleep SLEEP_TIME\n begin\n assert(is_text_present($display_scm[\"success_message\"]))\n open \"/devgroup/pj_index/1/1\"\n wait_for_page_to_load LOAD_TIME\n @selenium.click $display_scm_xpath[\"menu_link\"]\n sleep SLEEP_TIME\n @selenium.click $display_scm_xpath[\"scm_tab\"]\n sleep SLEEP_TIME\n assert_equal \"1\",get_value($display_scm_xpath[\"revision_field\"])\n rescue Test::Unit::AssertionFailedError\n @verification_errors << $!\n end\n logout\n ScmConfig.destroy_all\n end",
"def define_state_initializer; end",
"def test_library_constructor_set_up\n books_from_file = @lib.book_collection\n puts ''\n puts 'Initial library book collection:'\n books_from_file.each do |print_book|\n puts print_book.to_s()\n end\n assert_equal(1,@lib.calendar.get_date())\n assert([email protected]_hash.empty?)\n end",
"def initialize(config = {})\n\t\tsuper # check syntax\n\tend",
"def initialize(config = {})\n\t\tsuper # check syntax\n\tend",
"def initialize!\n\t\t\t\tunless @modules_config = YAML::load(File.open(Rails.root.join('config', 'modules.yml'))) rescue false\n\t\t\t\t\t$stderr.puts %Q(This app requires a valid modules config file. Please check `modules.yml` in the config folder.)\n\t\t\t\t\texit 1\n\t\t\t\tend\n\t\t\t\tload_applications\n\t\t\t\treturn true\n\t\t\tend",
"def initialize\n init\n end",
"def gitlab_init\n\tcfg = YAML.load(File.read(File.join(ENV['HOME'], \".privcfg.yml\")))\n\tcfg_gitlab = cfg['gitlab']\n\tGitlab.endpoint = cfg_gitlab['endpoint']\n\tGitlab.private_token = cfg_gitlab['private_token']\nend",
"def test_scm_st_044\n printf \"\\n Test 044\"\n open_periodical_analysis_setting_tab\n fill_scm_form(\"SVN\",\n nil,\n nil,\n URL_SVN_RIGHT_KEYWORD,\n LOGIN_RIGHT_KEYWORD,\n PASSWORD_RIGHT_KEYWORD,\n nil,\n MASTER_BASE_NAME_RIGHT_KEYWORD,\n 1,\n 1\n )\n click $display_scm_xpath[\"save_all_button\"]\n sleep SLEEP_TIME\n begin\n assert(is_text_present($display_scm[\"save_all_success\"]))\n rescue Test::Unit::AssertionFailedError\n @verification_errors << $!\n end\n logout\n ScmConfig.destroy_all\n end",
"def test_config\n PuppetServerExtensions.config\n end"
] | [
"0.63181204",
"0.59727895",
"0.590677",
"0.5834351",
"0.58281654",
"0.58216506",
"0.58216506",
"0.5799086",
"0.5766356",
"0.57654744",
"0.57353806",
"0.5708215",
"0.56972647",
"0.56972647",
"0.5692014",
"0.5646665",
"0.56405616",
"0.5638941",
"0.5631678",
"0.56181866",
"0.5613261",
"0.5600887",
"0.5586292",
"0.5560916",
"0.5560916",
"0.5560916",
"0.55360246",
"0.5530944",
"0.55286837",
"0.5506145",
"0.54964626",
"0.54670686",
"0.5446732",
"0.5446732",
"0.54429215",
"0.54324937",
"0.5425853",
"0.542199",
"0.5419924",
"0.5419754",
"0.54189324",
"0.54189324",
"0.54189324",
"0.54189324",
"0.5405096",
"0.5390291",
"0.5390291",
"0.5390264",
"0.5382849",
"0.5366276",
"0.535729",
"0.53558475",
"0.5350305",
"0.5349516",
"0.53481025",
"0.53481025",
"0.53481025",
"0.53449416",
"0.5337016",
"0.53166044",
"0.531546",
"0.5310069",
"0.5305196",
"0.530045",
"0.52981794",
"0.5293588",
"0.5293588",
"0.5293588",
"0.52872324",
"0.52836794",
"0.5283568",
"0.5276064",
"0.5274545",
"0.52632123",
"0.52544945",
"0.52542156",
"0.5249637",
"0.5247738",
"0.52476853",
"0.5237007",
"0.5222106",
"0.5221847",
"0.521621",
"0.52162004",
"0.5208646",
"0.5208078",
"0.5206594",
"0.52029264",
"0.52020663",
"0.52002764",
"0.5200001",
"0.5198736",
"0.5195806",
"0.5187014",
"0.5187014",
"0.51857567",
"0.51837456",
"0.5182527",
"0.51817614",
"0.51789606"
] | 0.6953844 | 0 |
The notification sections to query (i.e. some combination of 'alert' and 'message'). | def sections(*values)
values.inject(self) { |res, val| res._sections(val) or fail ArgumentError, "Unknown value for sections: #{val}" }
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def notifications\n return notification_data_source.notifications\n end",
"def get_informations\n infos = []\n @config.keys.each do |key|\n section = get_section(key) \n infos << section unless section[SECTION].empty?\n end\n\n infos\n end",
"def notification_query_options\n return @notification_query_options\n end",
"def email_message_sections\n if email_message\n errors.add(:value, 'email_message missing sections') if JSON.parse(@email_message.to_json).keys.size.eql?(0)\n end\n end",
"def get_notifications notifiable_type\n n = Notification.where(user_id:current_user, notifiable_type: notifiable_type)\n events_id = Array.new\n n.each do |v|\n events_id << v.notifiable_id\n end\n events = Event.where(id:events_id)\n\n end",
"def sections\n result = @nsx_client.get(@url_sections)\n result['results']\n end",
"def getEventNotifications(u, e)\n @result = []\n @ns = Notification.all\n @ns.each do |n|\n if u == nil\n if (n.notification_type == 3 || n.notification_type == 4) && n.sender_id == e.to_i\n @result.push(n)\n end\n else\n if (n.notification_type == 3 || n.notification_type == 4) && n.sender_id == e.to_i && n.user_id == u.to_i\n @result.push(n)\n end\n end\n end\n return @result\n end",
"def notifications\n query_api_object Notification, \"/rest/notifications\", nil, \"GET\", \"notifications\"\n end",
"def notifications\n\t\tif signed_in?\n\t\t\tn = current_user.extra.notifications\n\t\t\tif n > 0\n\t\t\t\t\"(\" + n.to_s + \")\"\n\t\t\tend\n\t\tend\n\tend",
"def notifications\n @other_user = @login_user\n @notifications = DiscussionGroupUser.where(['user_id =? AND is_member=?', @login_user.id, false])\n @disc_notifications = NonSiteUser.where([\"email=? AND invitable_type=? and invitation_type=?\",@login_user.email,\"Discussion\",\"Invited\"])\n respond_to do |format|\n format.html\n end\n end",
"def messages\n Client.get(EVENTS_PATH, {\n recipient: @email_address\n })\n end",
"def notification_metadata\n data.notification_metadata\n end",
"def sections\n @sections ||= context\n .public_methods\n .grep(/\\A(?!wait_)\\w+_section$\\z/)\n .map { |el| Meta::Section.new(el.to_s.gsub('_section', ''), context) }\n end",
"def notifications(params={})\n Endpoints::Notifications.new(self).get(params)\n end",
"def get_notifications\n begin\n response = notifications_api.get\n [parse_json(response), nil]\n rescue RestClient::Unauthorized\n [{}, Unauthorized]\n end\n end",
"def sections\n @sections || [:backtrace, :request, :session, :environment]\n end",
"def event_messages\n events.map { |event| event['description'] }\n end",
"def notifications(time = nil, filter = nil)\n parse_xml(*notifications_xml(time, filter))\n end",
"def notification_menu_item_details(notification)\n notifiable = notification.notifiable\n return medium_notification_item_details(notifiable) if notification.medium?\n return course_notification_item_details(notifiable) if notification.course?\n if notification.lecture?\n return lecture_notification_item_details(notifiable)\n end\n ''\n end",
"def messages\n if content\n # get array of sections which are delimited by a row of ******\n sections = content.split(/^\\*+$/).map(&:strip).select { |x| ! x.empty? }\n return sections.map { |s| Message.from(s) }.compact.sort_by {|s| s.date }.reverse\n else\n []\n end\n end",
"def curate_text\n notification_type = get_nagios_var('NAGIOS_NOTIFICATIONTYPE')\n if notification_type.eql?('ACKNOWLEDGEMENT')\n @text += self.content[:short_text][:ack_info] unless self.content[:short_text][:ack_info].empty?\n else\n [:host_info, :state_info, :additional_info, :additional_details].each do |info|\n @text += self.content[:short_text][info] unless self.content[:short_text][info].empty?\n end\n end\n end",
"def all_notifications\n self.notifications.all\n end",
"def notification_params\n params.require(\"notification\").\n permit( :message, :dcm_topic_id, :sse_channel)\n end",
"def notification_values(type, key)\n config = notifications[type]\n # Notification type config can be a string, an array of values,\n # or a hash containing a key for these values.\n Array(config.is_a?(Hash) ? config[key] : config)\n end",
"def show_notifications # :norobots:\n pass_query_params\n data = []\n @observation = find_or_goto_index(Observation, params[:id].to_s)\n return unless @observation\n name_tracking_emails(@user.id).each do |q|\n fields = [:naming, :notification, :shown]\n naming_id, notification_id, shown = q.get_integers(fields)\n next unless shown.nil?\n notification = Notification.find(notification_id)\n if notification.note_template\n data.push([notification, Naming.find(naming_id)])\n end\n q.add_integer(:shown, 1)\n end\n @data = data.sort_by { rand }\n end",
"def notifications\n ::Syncano::QueryBuilder.new(self, ::Syncano::Resources::Notifications::Base)\n end",
"def notifications(options = {})\n scope = MessageCenter::Notification.recipient(messageable).order(:created_at => :desc)\n if options[:read] == false || options[:unread]\n scope = scope.unread\n end\n\n scope\n end",
"def message\n notifications = current_user.notifications\n has_message = false\n has_request = false\n notifications.each do |notification|\n if notification.classification == 'message'\n has_message = true\n end\n if notification.classification == 'request'\n has_request = true\n end\n end\n if has_request && has_message\n return \"You have some friend requests and new messages. #{link_to 'Requests', profile_path} #{link_to 'Dialogs', dialogs_user_path(current_user.id)}\"\n\n elsif has_request\n return \"You have some friend #{link_to 'Requests', profile_path}.\"\n elsif has_message\n return \"You have some new messages #{link_to 'Dialogs', dialogs_user_path(current_user.id)}\"\n end\n end",
"def group_notifications\n @attributes[:group_notifications]\n end",
"def alert_content\n message = String.new\n #only send informatio for which the user is interested\n if (self.update_about_northeast)\n message += \"Northeast fields are \" + \n ((self.current_northeast_state == self.previous_northeast_state) ? \"still\" : \"now\") + \" \" +\n ((self.current_northeast_state) ? \"open.\" : \"closed.\") + \"\\n\"\n \n end\n if (self.update_about_northwest)\n message += \"Northwest fields are \" + \n ((self.current_northwest_state == self.previous_northwest_state) ? \"still\" : \"now\") + \" \" +\n ((self.current_northwest_state) ? \"open.\" : \"closed.\") + \"\\n\"\n \n end\n if (self.update_about_southside)\n message += \"Southside fields are \" + \n ((self.current_southside_state == self.previous_southside_state) ? \"still\" : \"now\") + \" \" +\n ((self.current_southside_state) ? \"open.\" : \"closed.\") + \"\\n\"\n \n end\n \n end",
"def notifications\n response = self.class.get('/notifications.xml')\n notifications_array = []\n response['notifications'].each do |note|\n new_note = Notification.new(:body => note[\"body\"],\n :subject => note[\"subject\"],\n :send_at => note[\"send_at\"],\n :id => note[\"id\"],\n :escalation => note[\"escalation\"])\n note[\"recipients\"].each do |rcpt|\n new_note.add_recipient(Recipient.new(:id => rcpt[\"id\"],\n :channel => rcpt[\"channel\"],\n :address => rcpt[\"address\"],\n :status => rcpt[\"status\"],\n :send_at => rcpt[\"send_at\"]))\n end\n notifications_array << new_note \n end\n notifications_array\n end",
"def alerts\n return @alerts\n end",
"def sections\n @data.keys\n end",
"def notification_arns\n data[:notification_arns]\n end",
"def sections\n @sections.values\n end",
"def notifications\n response = query_api(\"/rest/notifications\")\n return response[\"notifications\"].map {|notification| Notification.new(self, notification)}\n end",
"def elements_for_notification(notification)\n obj = notification.attachable\n return [nil, notification.message, nil] if obj.blank? or notification.action.blank?\n case notification.action.to_sym\n when :new_checkin then [obj.startup.logo_url(:small), \"<span class='entity'>#{obj.startup.name}</span> posted their weekly progress update\", url_for(obj)]\n when :relationship_request then [obj.entity.is_a?(Startup) ? obj.entity.logo_url(:small) : obj.entity.pic_url(:small), \"<span class='entity'>#{obj.entity.name}</span> would like to connect with you\", url_for(obj.entity)]\n when :relationship_approved then [obj.connected_with.is_a?(Startup) ? obj.connected_with.logo_url(:small) : obj.connected_with.pic_url(:small), \"<span class='entity'>#{obj.connected_with.name}</span> is now connected to you\", url_for(obj.connected_with)]\n when :new_comment_for_checkin then [obj.user.pic_url(:small), \"<span class='entity'>#{obj.user.name}</span> commented on your #{obj.checkin.time_label} checkin\", checkin_path(obj.checkin) + \"#c#{obj.id}\"]\n when :new_nudge then [obj.from.pic_url(:small), \"<span class='entity'>#{obj.from.name}</span> nudged you to complete your check-in\", url_for(obj.from)]\n when :new_comment_for_post then [obj.user.pic_url(:small), \"<span class='entity'>#{obj.user.name}</span> commented on your post\", post_path(:id => obj.root_id)]\n when :new_like then [obj.user.pic_url(:small), \"<span class='entity'>#{obj.user.name}</span> likes your post\", post_path(obj)]\n when :new_team_joined then [obj.logo_url(:small), \"<span class='entity'>#{obj.name}</span> joined nReduce\", url_for(obj)]\n when :new_awesome then [obj.user.pic_url(:small), \"<span class='entity'>#{obj.user.name}</span> thinks you made some awesome progress!\", url_for(obj.awsm)]\n when :response_completed then [obj.user.pic_url(:small), \"<span class='entity'>#{obj.user.name}</span> completed your help request!\", url_for(obj.user)]\n else [nil, notification.message, nil]\n end\n end",
"def section_metadata\n [section_metadata_one, section_metadata_two, section_metadata_three]\n end",
"def sections\n return @sections\n end",
"def unread_notifications\n notifications_received.where('activities.created_at > ?', notifications_checked_at)\n end",
"def notifications(options = {})\n #:type => nil is a hack not to give Messages as Notifications\n notifs = Mailboxer::Notification.recipient(messageable).where(:type => nil).order(\"mailboxer_notifications.created_at DESC\")\n if options[:read] == false || options[:unread]\n notifs = notifs.unread\n end\n\n notifs\n end",
"def notification_params\n params[:notification]\n end",
"def index\n #Notifications\n @allNotifications = Notification.where(\"notify_app = true AND triggered = true\").order(start_time: :desc).limit(3)\n @triggeredNotifications = Notification.where(\"notify_app = true AND triggered = true\").count\n\n #Paneles\n @clients = Client.all\n end",
"def get_notifications\n @notifications = Broadcast.joins(:feeds).where(feeds: {name: \"notification\"}).order(created_at: :desc).limit(20)\n end",
"def slack_message\n [\n {\n type: 'section',\n text: {\n type: 'mrkdwn',\n text: \"Performed #{@item_count} fixity #{'check'.pluralize(@item_count)} \" \\\n \"in #{@job_time} seconds on #{fixity_host}\"\n },\n fields: [\n { type: 'mrkdwn', text: ':white_check_mark: *Successes*' },\n { type: 'mrkdwn', text: ':warning: *Failures*' },\n { type: 'plain_text', text: (@item_count - @errors).to_s },\n { type: 'plain_text', text: @errors.to_s }\n ]\n }\n ]\n end",
"def list_notifications # :norobots:\n @notifications = Notification.find_all_by_user_id(@user.id, order: :flavor)\n end",
"def get_notifications\n \t\n \t@notifs = []\n\n \tif current_user\n @notifs = Notification.where(:user_id => current_user.id, :seen => false)\n \tend\n end",
"def get_message_specifications\n\t\tend",
"def sections\n parsed {\n @sections\n }\n end",
"def notifications(page = 1)\n\t\t\toptions = {\"page\" => page}\n\t\t\tdata = oauth_request(\"/notifications.xml\", options)\n\t\t\tHashie::Mash.new(data)\n\t\tend",
"def alert_counts\n nots = self.alerts.where(:unread => true)\n counts = {}\n counts[:all] = nots.count(\"DISTINCT read_link\")\n counts[:availabilities] = nots.where(:target_type => \"Availability\").count(\"DISTINCT read_link\")\n counts[:feedbacks] = nots.where([\"target_type = ? OR target_type = ?\", \"Feedback\", \"FeedbackRequest\"]).count(\"DISTINCT read_link\")\n counts[:messages] = nots.where(:target_type => \"Message\").count(\"DISTINCT read_link\")\n\n {alertCounts: counts}\n end",
"def sections\n @ini.keys\n end",
"def sections\n @ini.keys\n end",
"def sections\n reply = @index.byte_num.keys\n if @index.has_queries?\n reply.push('queries')\n end\n reply.map(&:to_sym)\n end",
"def notify\n {\n \"log_group_name\" => @config[\"log_group_name\"],\n \"log_stream_name\" => @config[\"log_stream_name\"]\n }\n end",
"def payload\n msg = {\n data: {\n alert: alert,\n badge: badge || \"Increment\",\n },\n }\n msg[:data][:sound] = sound if sound.present?\n msg[:data][:title] = title if title.present?\n msg[:data].merge! @data if @data.is_a?(Hash)\n\n if @expiration_time.present?\n msg[:expiration_time] = @expiration_time.respond_to?(:iso8601) ? @expiration_time.iso8601(3) : @expiration_time\n end\n if @push_time.present?\n msg[:push_time] = @push_time.respond_to?(:iso8601) ? @push_time.iso8601(3) : @push_time\n end\n\n if @expiration_interval.is_a?(Numeric)\n msg[:expiration_interval] = @expiration_interval.to_i\n end\n\n if query.where.present?\n q = @query.dup\n if @channels.is_a?(Array) && @channels.empty? == false\n q.where :channels.in => @channels\n end\n msg[:where] = q.compile_where unless q.where.empty?\n elsif @channels.is_a?(Array) && @channels.empty? == false\n msg[:channels] = @channels\n end\n msg\n end",
"def notification_params\n params.fetch(:notification, {})\n end",
"def notifications_for_principal(principal_uri)\n @notifications[principal_uri] || []\n end",
"def sections( opts = nil )\n sections = Marshal::load( Marshal::dump( @sections ) )\n observes = !sections.values.detect { |s| s['observe'] }\n storage.sections.each do |s|\n sections[s] ||= {}\n sections[s]['observe'] ||= sections[s].has_key?( 'ignore' ) ? !sections[s]['ignore'] : observes\n sections[s]['ignore'] ||= !sections[s]['observe']\n end\n sections\n end",
"def notification_methods(notification_type)\n return [] unless notification_type.is_a?(Alerter::NotificationType)\n prefs = alerter_preferences.find_by(notification_type: notification_type).try(:alert_methods)\n prefs ||= []\n end",
"def show\n # Title of the webpage\n @title = 'Notifications'\n\n # Getting all of the user's notifications, then those that are unread\n @all_notifications = Notification.where([\"user_id = :id\", { id: current_user.id }]).order(created_at: :desc)\n @notification_content = {}\n @unread_notification_ids = []\n\n @all_notifications.each do |notification|\n if notification.unread?\n # Mark all of the unread notifications as read, since they have now been opened\n @unread_notification_ids << notification.id\n notification.unread = false\n notification.save\n end\n\n # Get the pieces of the body of the notification\n if notification.body\n @notification_content[notification.id] = notification.body.split(/\\n/)\n end\n\n end\n\n # Clear the number of unread notifications for the user\n current_user.update_attribute(:unread_notifications, 0)\n end",
"def broadcast_report_data(period)\n unread_msg = all_unread_broadcast_messages(period)\n read_msg = all_read_broadcast_messages(period)\n count_sms = count_broadcast_sms(period)\n res = [[period.to_s.report_period_to_title, 'Unread Messages', 'Read Messages', 'SMS Sent']]\n unread_msg.each{|k, v| res << [k, v, read_msg[k], count_sms[k]] }\n res\n end",
"def notifications\n ::Users::Notification.where(related_model_type: self.class.to_s, related_model_id: self.id)\n end",
"def messages\n message_div.text\n end",
"def messages\n message_div.text\n end",
"def messages\n message_div.text\n end",
"def messages\n message_div.text\n end",
"def get_notices\n @Noticias = Notice.all(:conditions => ['published = 1'], :order => \"id desc\", :limit => \"6\")\n end",
"def message_notifications\n notifications = Message.where(receiver_id: @current_user.id, read_status: 0)\n if notifications\n render json: {\n status: 'success',\n message: 'Your notifications',\n data: notifications.length()\n },\n status: :ok\n end\n end",
"def informational_severity_events(&block)\n unless @informational_events\n @informational_events = []\n\n @host.xpath(\"ReportItem\").each do |event|\n next if event['severity'].to_i != 0\n @informational_events << Event.new(event)\n end\n\n end\n\n @informational_events.each(&block)\n end",
"def get_filtered_notifications(filter, time)\n notifications(time, filter)\n end",
"def messages\n @queue.messages.select { |m| m.claim == self }\n end",
"def notification_arns\n @stack.notification_arns\n end",
"def list_notifications\n BrickFTP::API::Notification.all\n end",
"def list_notifications\n BrickFTP::API::Notification.all\n end",
"def received\n @notifications = Notification.where('receiver_id = ? ' +\n 'OR receiver_id IS NULL ' +\n 'OR topic IN (?)',\n @current_user.id, @current_user.get_subscribed_topic_ids)\n .order({created_at: :desc})\n .page(page_params[:page])\n .per(page_params[:page_size])\n render_multiple\n end",
"def show\n @notifications = current_user.notifications.limit(3)\n end",
"def notifications_to_show_user\n notifications ||= UserEvent.where('user_id = ? AND error_during_render = ? AND event_type != ?', self.id, false, UserEvent.event_type_value(:video_play))\n end",
"def metadata\n msg['metadata']||{}\n end",
"def notifications\n end",
"def display_notifications_in_tab(object)\n\t\tif current_petsitter\n\n\t\t\tif object.notificationforpetsitters.where('read_status = ? ' , false ).present?\n\n\t\t\t\treturn_html =\"<span style='color:#ff6666 ; font-weight:bolder;'>\" + \" <i class='fa fa-exclamation-circle' aria-hidden='true' ></i>\" + \" (\" + object.notificationforpetsitters.where('read_status = ? ' , false ).count.to_s + \")\" + \"</span>\"\n\t\t\t\treturn return_html.html_safe\n\n\t\t\tend\n\t\t\t\n\t\telsif current_petowner\n\n\t\t\tif object.notificationforpetowners.where('read_status = ? ' , false ).present?\n\n\t\t\t\treturn_html =\"<span style='color:#ff6666 ; font-weight:bolder;'>\" + \" <i class='fa fa-exclamation-circle' aria-hidden='true' ></i>\" + \" (\" + object.notificationforpetowners.where('read_status = ? ' , false ).count.to_s + \")\" + \"</span>\"\n\t\t\t\treturn return_html.html_safe\n\n\t\t\tend\n\n\t\tend\n\n\t\t\n\t\n\tend",
"def notification_cmt\n @notifications = current_user.notifications.where(notification_type: \"comment\").order(\"created_at desc\")\n\n\n\n # evidence_id_slot_owner = @notifications.where(obj_type: \"evidence_id_slot_owner\").group_by(&:obj_id)\n # evidence_id_slot = @notifications.where(obj_type: \"evidence_id_slot\").group_by(&:obj_id)\n # evidence_id_other_subject_owner = @notifications.where(obj_type: \"evidence_id_other_subject_owner\").group_by(&:obj_id)\n # evidence_id_other_subject = @notifications.where(obj_type: \"evidence_id_other_subject\").group_by(&:obj_id)\n # short_term_objective_id_owner = @notifications.where(obj_type: \"short_term_objective_id_owner\").group_by(&:obj_id)\n # short_term_objective_id = @notifications.where(obj_type: \"short_term_objective_id\").group_by(&:obj_id)\n # current_title_id_short_term_owner = @notifications.where(obj_type: \"current_title_id_short_term_owner\").group_by(&:obj_id)\n # current_title_id_short_term = @notifications.where(obj_type: \"current_title_id_short_term\").group_by(&:obj_id)\n # current_title_id_long_term_owner = @notifications.where(obj_type: \"current_title_id_long_term_owner\").group_by(&:obj_id)\n # current_title_id_long_term = @notifications.where(obj_type: \"current_title_id_long_term\").group_by(&:obj_id)\n\n\n render :layout => false\n end",
"def message(message_notification)\n doc = {\n 'type' => 'note',\n 'text' => message_notification.message\n }\n return doc\n end",
"def sections\n self.entries.select { |e| e.is_a?(ListSection) }\n end",
"def rules(options={})\n get('getNotificationRules', options)\n end",
"def message_notification\n fetch(:hipchat_announce, false)\n end",
"def sections\n temp_sections = []\n if @section_ids.count > 0\n @section_ids.each do |section_id|\n temp_sections.push @client.section(@org_id, section_id)\n end\n end\n return temp_sections\n end",
"def alerts(query)\n get_json(\"#{api_url}/alerts/#{url_settings}/q/#{parse_query(query)}.#{@options[:format]}\")\n end",
"def display_flash_notifications\n html = nil\n\n if session[:notification] and session[:notification].is_a?(Array)\n type = session[:notification][0]\n text = session[:notification][1]\n html = \"<div class=\\\"alert alert-#{type}\\\">#{text}<div class=\\\"close\\\"></div></div>\"\n end\n\n # Clear the session so as to not display the message again.\n session[:notification] = nil\n\n return html\nend",
"def alert_params\n {\n description: description&.truncate(::AlertManagement::Alert::DESCRIPTION_MAX_LENGTH),\n ended_at: ends_at,\n environment: environment,\n fingerprint: gitlab_fingerprint,\n hosts: truncate_hosts(Array(hosts).flatten),\n monitoring_tool: monitoring_tool&.truncate(::AlertManagement::Alert::TOOL_MAX_LENGTH),\n payload: payload,\n project_id: project.id,\n prometheus_alert: gitlab_alert,\n service: service&.truncate(::AlertManagement::Alert::SERVICE_MAX_LENGTH),\n severity: severity,\n started_at: starts_at,\n title: title&.truncate(::AlertManagement::Alert::TITLE_MAX_LENGTH)\n }.transform_values(&:presence).compact\n end",
"def message_params\n m = params.require(:message)\n js = JSON.parse(m).with_indifferent_access\n res = js.slice(:context, :topic, :body, :begun_at, :success_at, :failed_at)\n res\n end",
"def messages\n all_messages = []\n @all.each do |e|\n all_messages += e[:messages]\n end\n all_messages\n end",
"def messages\n wait_until_bus_section_load\n wait_until {message_div.visible?}\n message_div.text\n end",
"def alerts\n @alerts ||= []\n end",
"def sections\n [\n \"Expected: #{@signature.signature}\\n Was: #{@signature.request.signature}\",\n format_hash(@signature.request.request.env),\n @signature.request.request.body.read,\n \"Consumer Secret:\\nServer: #{@consumer.secret}\\nRequest: #{@signature.consumer_secret}\",\n \"Token Secret:\\nServer: #{@access_token.secret}\\nRequest: #{@signature.token_secret}\"\n ]\n end",
"def all_sections\n [ header_section ] + sections\n end",
"def properties; @message_impl.getProperties; end",
"def load_notifications\n \t\tif current_user\n \t\t\t@notifications = current_user.notifications.limit 5\n \t\t\t@unseen_notifications_count = current_user.notifications.unseen.count\n \t\tend\n \tend",
"def sections\n @body.xpath('.//a:section', a: NS)\n end",
"def section_contents\n used_sections = {}\n\n each_method do |method|\n next unless method.display?\n\n used_sections[method.section] = true\n end\n\n # order found sections\n sections = sort_sections.select do |section|\n used_sections[section]\n end\n\n # only the default section is used\n return [] if\n sections.length == 1 and not sections.first.title\n\n sections\n end",
"def msgs\n d = data\n if d != nil\n return d.fetch('msgs', [])\n end\n return []\n end"
] | [
"0.6209621",
"0.61607766",
"0.58959293",
"0.58232737",
"0.57313263",
"0.57070625",
"0.56588477",
"0.5648819",
"0.5601814",
"0.5579196",
"0.55764675",
"0.5562135",
"0.5533302",
"0.55194706",
"0.5508215",
"0.5496175",
"0.54874396",
"0.5476777",
"0.54582846",
"0.5457401",
"0.5441986",
"0.54355437",
"0.5433517",
"0.5397985",
"0.5390678",
"0.53899974",
"0.5379656",
"0.5368962",
"0.5366758",
"0.5364984",
"0.5364705",
"0.5350026",
"0.53431934",
"0.5333896",
"0.5332661",
"0.5307538",
"0.5295991",
"0.5289037",
"0.52776444",
"0.52758044",
"0.52639407",
"0.52571267",
"0.5234508",
"0.5200876",
"0.51939744",
"0.51933575",
"0.5185151",
"0.5182631",
"0.5180497",
"0.5172101",
"0.5170493",
"0.5163733",
"0.5163733",
"0.515324",
"0.5146803",
"0.5139951",
"0.5121217",
"0.51208264",
"0.5120811",
"0.5093472",
"0.50811166",
"0.50777113",
"0.50606763",
"0.5056872",
"0.5056872",
"0.5056872",
"0.5056872",
"0.5056149",
"0.50459313",
"0.5035918",
"0.50125027",
"0.50027835",
"0.49920103",
"0.49860597",
"0.49860597",
"0.49793282",
"0.49750876",
"0.49750242",
"0.49742338",
"0.4965217",
"0.4962285",
"0.49604928",
"0.49542642",
"0.4953171",
"0.49482003",
"0.49465197",
"0.49438402",
"0.4943221",
"0.4936942",
"0.4934866",
"0.49318653",
"0.4927192",
"0.4905498",
"0.48987645",
"0.48940697",
"0.48860204",
"0.48846278",
"0.4874193",
"0.4872217",
"0.48681873",
"0.4866537"
] | 0.0 | -1 |
Whether to group the result by section. Each section is fetched separately if set. | def groupbysection()
merge(notgroupbysection: 'true')
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def section_groupings(section)\n groupings.select do |grouping|\n grouping.inviter.present? &&\n grouping.inviter.has_section? &&\n grouping.inviter.section.id == section.id\n end\n end",
"def sectionless_groupings\n groupings.select do |grouping|\n grouping.inviter.present? &&\n !grouping.inviter.has_section?\n end\n end",
"def section_groups\n return @section_groups\n end",
"def group_by?; @group_by; end",
"def section_contents\n used_sections = {}\n\n each_method do |method|\n next unless method.display?\n\n used_sections[method.section] = true\n end\n\n # order found sections\n sections = sort_sections.select do |section|\n used_sections[section]\n end\n\n # only the default section is used\n return [] if\n sections.length == 1 and not sections.first.title\n\n sections\n end",
"def sections_sorts\n @sections.inject( {} ) do |sorts, set|\n k, v = set\n sorts[k] = v['sort_by'] if v['sort_by']\n sorts\n end\n end",
"def render_grouped_response? response = @response\n response.grouped?\n end",
"def results_for_division(division)\n if division == :all\n @results\n else\n sections = @festival_info.sections(division)\n @results.select { |section, result| sections.include? section }\n end\n end",
"def sections\n temp_sections = []\n if @section_ids.count > 0\n @section_ids.each do |section_id|\n temp_sections.push @client.section(@org_id, section_id)\n end\n end\n return temp_sections\n end",
"def sections\n parsed {\n @sections\n }\n end",
"def merge_sections cm # :nodoc:\n my_sections = sections.group_by { |section| section.title }\n other_sections = cm.sections.group_by { |section| section.title }\n\n other_files = cm.in_files\n\n remove_things my_sections, other_files do |_, section|\n @sections.delete section.title\n end\n\n other_sections.each do |group, sections|\n if my_sections.include? group\n my_sections[group].each do |my_section|\n other_section = cm.sections_hash[group]\n\n my_comments = my_section.comments\n other_comments = other_section.comments\n\n other_files = other_section.in_files\n\n merge_collections my_comments, other_comments, other_files do |add, comment|\n if add then\n my_section.add_comment comment\n else\n my_section.remove_comment comment\n end\n end\n end\n else\n sections.each do |section|\n add_section group, section.comments\n end\n end\n end\n end",
"def grouped_names(section)\n BASE_CONFIG[section].group_by { |_, v| v[:group] }.transform_values { |v| v.map(&:first) }\n end",
"def grouped?\n !group_by_column.nil?\n end",
"def grouped?\n !group_by_column.nil?\n end",
"def latest_by_section\n unless @latest_articles_for_sections\n @latest_articles_for_sections = {}\n for article in latest_articles_for_sections\n if @latest_articles_for_sections[article.section]\n @latest_articles_for_sections[article.section] << article\n else\n @latest_articles_for_sections[article.section] = [article]\n end\n end\n end\n @latest_articles_for_sections\n end",
"def section_by_name(section_name)\n result = nil\n all_sections = sections\n return result unless all_sections\n\n all_sections.each do |section|\n result = section if section['display_name'] == section_name\n end\n result\n end",
"def sections?\n false\n end",
"def fetch_section(section)\n if guardian_sections.include? section\n response = $redis.get(\"news_#{section}\")\n if response.nil?\n @section = \"§ion=\" + section.to_s\n base_uri = \"http://content.guardianapis.com/search?order-by=newest&type=article\"\n response = JSON.generate(HTTParty.get(base_uri + @section + \"&api-key=\" + ENV['GUARDIAN_API_KEY'])[\"response\"][\"results\"])\n $redis.set(\"news_#{section}\", response)\n $redis.expire(\"news_#{section}\", 1.hours.to_i)\n end\n @response = JSON.load(response)\n else\n fetch_articles\n end\n end",
"def sections\n @blocks.inject([]) {|collector, block|\n collector << block if block.is_a?(Section)\n collector\n }\n end",
"def group_by_used!(feed)\n # prepare details of existing course site\n course_term_year = feed[:canvas_course][:term][:term_yr]\n course_term_code = feed[:canvas_course][:term][:term_cd]\n course_ccns = []\n feed[:canvas_course][:officialSections].each do |official_section|\n section_term_match = (official_section[:term_cd] == course_term_code) && (official_section[:term_yr] == course_term_year)\n raise RuntimeError, \"Invalid term specified for official section with CCN '#{official_section[:ccn]}'\" unless section_term_match\n course_ccns << official_section[:ccn]\n end\n\n associatedCourses = []\n unassociatedCourses = []\n\n feed[:teachingSemesters].each do |semester|\n course_semester_match = (semester[:termCode] == course_term_code) && (semester[:termYear] == course_term_year)\n if course_semester_match\n semester[:classes].each do |course|\n # either iterate and count the matches\n # or loop through and return the matches, then count that\n course[:containsCourseSections] = false\n course[:sections].each do |section|\n if course_ccns.include?(section[:ccn])\n course[:containsCourseSections] = true\n section[:isCourseSection] = true\n else\n section[:isCourseSection] = false\n end\n end\n if course[:containsCourseSections]\n associatedCourses << course\n else\n unassociatedCourses << course\n end\n end\n semester[:classes] = associatedCourses + unassociatedCourses\n else\n semester[:classes].each do |course|\n course[:containsCourseSections] = false\n end\n end\n end\n feed\n end",
"def all_sections\n [ header_section ] + sections\n end",
"def each_section # :yields: section, constants, attributes\n return enum_for __method__ unless block_given?\n\n constants = @constants.group_by do |constant| constant.section end\n attributes = @attributes.group_by do |attribute| attribute.section end\n\n constants.default = []\n attributes.default = []\n\n sort_sections.each do |section|\n yield section, constants[section].select(&:display?).sort, attributes[section].select(&:display?).sort\n end\n end",
"def section_groups=(value)\n @section_groups = value\n end",
"def has_sections\n\t\tversions = self.versions.where('published = ?', true).order('updated_at DESC')\n\t\tif versions.any? then\n\t\t\tversion = versions.first\n\t\t\tif !version.sections.empty? then\n\t\t\t\thas_section = true\n\t\t\telse\n\t\t\t\thas_section = false\n\t\t\tend\n\t\telse\n\t\t\tversion = self.versions.order('updated_at DESC').first \n\t\t\tif !version.sections.empty? then\n\t\t\t\thas_section = true\n\t\t\telse\n\t\t\t\thas_section = false\n\t\t\tend\n\t\tend\n\t\treturn has_section\n\tend",
"def flatten_course_sections_expand section_coll, courses\n # flatten sections\n section_ids = []\n courses.each do |course|\n course['sections'] = flatten_sections course['sections']\n section_ids.concat course['sections']\n end\n\n # expand sections if ?expand=sections\n if params[:expand] == 'sections'\n sections = find_sections section_coll, section_ids\n sections = [sections] if not sections.kind_of?(Array) # hacky, maybe modify find_sections?\n\n # map sections to course hash & replace section data\n if not sections.empty?\n course_sections = sections.group_by { |e| e['course'] }\n courses.each { |course| course['sections'] = course_sections[course['course_id']] }\n end\n end\n\n return courses\n end",
"def sections\n result = @nsx_client.get(@url_sections)\n result['results']\n end",
"def sections(*values)\n values.inject(self) { |res, val| res._sections(val) or fail ArgumentError, \"Unknown value for sections: #{val}\" }\n end",
"def sections(*values)\n values.inject(self) { |res, val| res._sections(val) or fail ArgumentError, \"Unknown value for sections: #{val}\" }\n end",
"def create_section_response\n response = Hash.new\n response[:is_searchable] = DocumentPlatform.searchable?\n response[:has_description] = DocumentPlatform.has_description?\n response[:has_metadata] = DocumentPlatform.has_metadata?\n response[:supports_permissions] = DocumentPlatform.supports_permissions?\n response[:sections] = []\n return response\n end",
"def group\n field = options[:fields].first\n documents.group_by { |doc| doc.send(field) }\n end",
"def section_columns_hash(sections)\n section_property_filter = [:instruction_format, :is_primary, :section_number]\n columns_hash = {}\n primary_groups = sections.group_by { |section| section.try(:[], :is_primary) ? :primary : :secondary }\n primary_groups.keys.each do |primary_group_key|\n columns_hash[primary_group_key] = {}\n primary_group = primary_groups[primary_group_key]\n instructional_format_groups = primary_group.group_by { |sec| sec[:instruction_format] }\n instructional_format_groups.keys.each do |instruction_format_code|\n if_sections = instructional_format_groups[instruction_format_code]\n columns_hash[primary_group_key][instruction_format_code] = if_sections.collect {|sec| sec.slice(*section_property_filter)}\n end\n end\n columns_hash\n end",
"def _section_fields\n {\n 'article' => ['r:Title', 'o:Author', 'o:DOI'],\n 'journal' => ['r:Title', 'o:ISSN', 'r:Volume', 'o:Issue', 'r:Year', 'r:Pages'],\n 'host' => ['o:Title', 'o:ISSN or ISBN', 'o:Volume', 'o:Issue', 'r:Year', 'o:Pages'],\n 'auto-cancel' => ['o:Automatic cancellation'],\n 'notes' => ['o:Notes'],\n 'conference' => ['r:Title', 'o:Location', 'r:Year', 'o:ISSN or ISBN', 'r:Pages'],\n 'book' => ['r:Title', 'o:Author', 'o:Edition', 'o:DOI', 'o:ISBN', 'r:Year', 'o:Publisher'],\n 'thesis' => ['r:Title', 'r:Author', 'o:Affiliation', 'o:Publisher', 'o:Type', 'r:Year', 'o:Pages'],\n 'report' => ['r:Title', 'o:Author', 'o:Publisher', 'o:DOI', 'o:Report Number'],\n 'standard' => ['r:Title', 'o:Subtitle', 'o:Publisher', 'o:DOI', 'o:Standard Number', 'o:ISBN', 'r:Year', 'o:Pages'],\n 'patent' => ['r:Title', 'o:Inventor', 'o:Patent Number', 'r:Year', 'o:Country'],\n 'other' => ['r:Title', 'o:Author', 'o:Publisher', 'o:DOI']\n }\nend",
"def group_by\n @group_by ||= (defaults[:group_by] || [])\n end",
"def section_list_for record\n tags_for_context_and_taggable(context: :sections, taggable: record)\n end",
"def is_section_complete(type)\n total = data.pages.select { |p| p.type == type }.count\n complete = data.pages.select { |p| p.type == type && p.status == 'success' }.count\n\n total == complete ? true : false\n end",
"def group_by\n end",
"def sections\n respond_with @page.sections\n end",
"def sections\n respond_with @page.sections\n end",
"def aggregate_after_grouping?; @aggregate_after_grouping; end",
"def valid_section?(section)\n values(section).compact.sort == options[:values].sort\n end",
"def sections_ordered(&block)\n return to_enum(:sections_ordered) if ! block_given?\n @sections.values.sort { |a,b| a.offset <=> b.offset \n }.each { |sec| yield sec if block_given? }\n end",
"def group\n return if record.respond_to?(:where)\n record.group\n end",
"def groupable?\n return false if multiple?\n\n human_readable?\n end",
"def preprocess\n if group_by?\n build_headers\n group_rows\n else\n enumerator.next\n end\n end",
"def set_result_statistic_section\n @result_statistic_section = ResultStatisticSection\n .includes(subgroup: { extractions_extraction_forms_projects_sections_type1_row: { extractions_extraction_forms_projects_sections_type1: [:type1, extractions_extraction_forms_projects_section: [:extraction, extraction_forms_projects_section: :extraction_forms_project]] } })\n .includes(:result_statistic_section_type)\n .find(params[:id])\n end",
"def sections\n self.entries.select { |e| e.is_a?(ListSection) }\n end",
"def summarize_per_subset\n @having = ANY_ROWS\n end",
"def group_by\n\n end",
"def sort_sections\n titles = @sections.map { |title, _| title }\n\n if titles.length > 1 and\n TOMDOC_TITLES_SORT ==\n (titles | TOMDOC_TITLES).sort_by { |title| title.to_s } then\n @sections.values_at(*TOMDOC_TITLES).compact\n else\n @sections.sort_by { |title, _|\n title.to_s\n }.map { |_, section|\n section\n }\n end\n end",
"def list_by_sections\n\n @list_options = Section.find_alpha\n\n if params[:key] then\n @viewing_by = params[:key]\n elsif session[:last_content_list_view] then\n @viewing_by = session[:last_content_list_view]\n else\n @viewing_by = @list_options[0].id\n end\n\n @section = Section.find(:first, :conditions => [\"#{Section.connection.quote_column_name(\"id\")}=?\", @viewing_by])\n if @section == nil then\n\t\t\tredirect_to :action => 'list'\n\t\t\treturn\n end\n\n @title = \"Content List For Section - '#{@section.name}'\"\n\n conditions = nil\n\n session[:last_content_list_view] = @viewing_by\n\n # Paginate that will work with will_paginate...yee!\n per_page = 30\n list = @section.content_nodes\n pager = Paginator.new(list, list.size, per_page, params[:page])\n @content_nodes = WillPaginate::Collection.new(params[:page] || 1, per_page, list.size) do |p|\n p.replace list[pager.current.offset, pager.items_per_page]\n end\n \n render :action => 'list'\n end",
"def group_data_from_results(res, groupname, key)\n groups = res['groups']\n groups.each do |group|\n return group[key] if group['group_name'] == groupname\n end\n nil\n end",
"def section(section)\n query_filters << \"section_name:#{section}\"\n self\n end",
"def render_sections(options = {})\n \n # find render key\n render_key = song_key\n render_key = song_key.transpose(options[:modulation]) if options[:modulation]\n if options[:alt_key]\n if options[:alt_key].class == SongKey\n render_key = options[:alt_key]\n else\n render_key = SongKey.KEY( options[:alt_key] )\n end\n end\n \n # should be rendered fully?\n render_full = options[:full] || false\n \n # should all sections be rendered\n render_all_sections = options[:render_all_sections] || false\n \n # should lyrics be forced?\n force_lyrics = options[:force_Lyrics] || false\n \n expanded_structure = structure.map { |s| Song.structure_interpreter(s) }\n \n sections_so_far = Hash.new\n \n return expanded_structure.map do |sec|\n \n section_fingerprint = { :type => sec[:type],\n :variation => sec[:variation],\n :modulation => sec[:modulation],\n :lyric_variation => sec[:lyric_variation] }\n \n if render_all_sections || !sections_so_far.keys.include?(section_fingerprint)\n \n section = sections.all.select { |s| s.type == sec[:type] }.find { |s| s.variation == sec[:variation] }\n \n raise \"There is no section #{sec[:type]} with variation #{sec[:variation]} in this song.\" unless section\n \n section_tag = sec[:render_section_number] ? \" #{sec[:lyric_variation]}\" : \"\"\n title = \"#{section.title}#{section_tag}\"\n \n section_lines = Array.new\n \n section_lines += section.render_lines( :variation => sec[:lyric_variation],\n :modulation => sec[:modulation],\n :full => render_full,\n :force_lyrics => force_lyrics )\n \n section_data = { :title => title,\n :lines => section_lines,\n :instrumental => section_lines[-1][:instrumental],\n :repeats => sec[:repeat],\n :is_repeat => false }\n \n sections_so_far[section_fingerprint] = section_data\n \n next section_data\n \n else\n \n prev_repeat = sections_so_far[section_fingerprint]\n \n next { :title => prev_repeat[:title],\n :instrumental => prev_repeat[:instrumental],\n :repeats => sec[:repeat],\n :is_repeat => true }\n \n end\n end\n \n end",
"def sections_sorted(&block)\n return to_enum(:sections_sorted) if ! block_given?\n @sections.values.sort { |a,b| \n # Tricky sort: ident is often an index but can be an abritrary string\n # depending on what the :parse_file plugin decided.\n # If a.to_i == b.to_i and a != b, to_i failed (use string)\n (a.ident.to_i == b.ident.to_i && a.ident != b.ident) ?\n a.ident <=> b.ident : a.ident.to_i <=> b.ident.to_i \n }.each { |sec| yield sec if block_given? }\n end",
"def sub_section_empty?(section)\n result = false\n 5.times do |index|\n result ||= self.send(\"#{section}#{index + 1}\".to_sym)\n end\n !result\n end",
"def grouped_by_access_feature!\n groups = {'audio_described_performance' => [], 'captioned_performance' => [], 'signed_performance' => [], 'touch_tour' => [], 'relaxed_performance' => [], 'talk_back' => []}\n\n @instances.each do |instance|\n instance_types = instance.meta_attributes.select{|attr_key, attr_value| groups.keys.include?(attr_key) && attr_value==\"true\"}.keys\n\n if instance_types.any?\n instance_types.each do |type|\n groups[type].push(instance)\n end\n end\n end\n\n groups.each do |type, instances|\n groups[type] = slice_instances_by_date(instances.reverse)\n end\n\n groups\n end",
"def stacked_grouping_query?\n @summary.query_group.group_count == 2\n end",
"def section?\n type == \"Section\"\n end",
"def section\n return @section if @section\n\n resp = HTTP\n .headers(authorization: \"Bearer #{access_token[:access_token]}\")\n .get(LIST_SECTIONS_ENDPOINT % notebook[:id], params: {\n select: 'id,name',\n filter: \"name eq '#{Config[:section]}'\"\n })\n if resp.code.to_s.start_with? '2'\n json = response_body(resp)\n @section = JSON.parse(json, symbolize_names: true)[:value].first\n end\n return @section\n end",
"def content_api_has_root_sections(slugs_or_sections)\n content_api_has_root_tags(\"section\", slugs_or_sections)\n end",
"def section_for_script(script)\n sections_as_student.find {|section| section.script_id == script.id} ||\n sections.find {|section| section.script_id == script.id}\n end",
"def by_section(tasks)\n current_section = nil\n by_section = { nil => [] }\n tasks.each do |task|\n current_section, by_section = file_task_by_section(current_section,\n by_section, task)\n end\n by_section\n end",
"def group_rows(group, col_count, group_text = nil)\n mri = options.mri\n grp_output = \"\"\n if mri.extras[:grouping] && mri.extras[:grouping][group] # See if group key exists\n if mri.group == \"c\" # Show counts row\n if group == :_total_\n grp_output << \"<tr><td class='group' colspan='#{col_count}'>Count for All Rows: #{mri.extras[:grouping][group][:count]}</td></tr>\"\n else\n g = group_text ? group_text : group\n grp_output << \"<tr><td class='group' colspan='#{col_count}'>Count for #{g.blank? ? \"<blank>\" : g}: #{mri.extras[:grouping][group][:count]}</td></tr>\"\n end\n else\n if group == :_total_\n grp_output << \"<tr><td class='group' colspan='#{col_count}'>All Rows</td></tr>\"\n else\n g = group_text ? group_text : group\n grp_output << \"<tr><td class='group' colspan='#{col_count}'>#{g.blank? ? \"<blank>\" : g} </td></tr>\"\n end\n end\n MiqReport::GROUPINGS.each do |calc| # Add an output row for each group calculation\n if mri.extras[:grouping][group].key?(calc.first) # Only add a row if there are calcs of this type for this group value\n grp_output << \"<tr>\"\n grp_output << \"<td class='group'>#{calc.last.pluralize}:</td>\"\n mri.col_order.each_with_index do |c, c_idx| # Go through the columns\n next if c_idx == 0 # Skip first column\n grp_output << \"<td class='group' style='text-align:right'>\"\n grp_output << CGI.escapeHTML(mri.format(c.split(\"__\").first,\n mri.extras[:grouping][group][calc.first][c],\n :format => mri.col_formats[c_idx] ? mri.col_formats[c_idx] : :_default_\n )\n ) if mri.extras[:grouping][group].key?(calc.first)\n grp_output << \"</td>\"\n end\n grp_output << \"</tr>\"\n end\n end\n end\n grp_output << \"<tr><td class='group' colspan='#{col_count}'> </td></tr>\" unless group == :_total_\n grp_output\n end",
"def grouping\n @grouping ||= :clustered\n end",
"def section(section_name, parent_id = nil)\n html = \"\"\n parent_id = get_parent_id(parent_id)\n objects_to_render = {}\n Base.where(:'connections.parent_id' => parent_id, :'connections.section' => section_name, :'connections.file'.ne => nil).each do |record|\n connection = record.connections.where(:parent_id => parent_id, :section => section_name, :file.ne => nil).first\n\n if objects_to_render[connection.order_id] == nil\n number = connection.order_id\n else\n number = get_unique_number(objects_to_render, connection.order_id)\n end\n objects_to_render[number] = {:record => record, :connection => connection}\n end\n Hash[objects_to_render.sort].each do |k, object|\n html += show object[:connection].file, {views: [\"app/views/#{object[:record]._type}\", \"app/views/#{object[:record]._type.downcase}\"]}, {record: object[:record]}\n end\n return html\n end",
"def section_filter citems\n filtered_citems = citems.map do |citem|\n citem.section == @section && !citem.hidden? ? citem : nil\n end\n filtered_citems.compact\n end",
"def sections(layout, parent_section = nil, first_object: false, object_index: nil)\n layout_print = send(layout)\n\n section_list = []\n\n # loop around each section rendering it in turn\n layout_print.each_with_index do |section, i|\n next if section.nil?\n\n Rails.logger.debug { \"Section #{section[:code]} Type #{section[:type]} Object Index: #{object_index}\" }\n next if skip_section(section, parent_section, object_index: object_index)\n\n section_list += process_section(layout, section, parent_section,\n (first_object && i.zero?), object_index: object_index)\n end\n section_list # return the section list\n end",
"def each_section(&block)\n while (section = next_section)\n block.call(section) if block\n end\n\n return self\n end",
"def sections\n return @sections\n end",
"def result\n query_group.with_context do\n if primary.summarise?\n summary_result\n else\n simple_result\n end\n end\n end",
"def supports_grouping_sets?\n server_version >= 90500\n end",
"def group_lines\n @lines.rewind\n\n in_list = false\n wanted_type = wanted_level = nil\n\n block = LineCollection.new\n group = nil\n\n while line = @lines.next\n if line.level == wanted_level and line.type == wanted_type\n group.add_text(line.text)\n else\n group = block.fragment_for(line)\n block.add(group)\n\n if line.type == :LIST\n wanted_type = :PARAGRAPH\n else\n wanted_type = line.type\n end\n\n wanted_level = line.type == :HEADING ? line.param : line.level\n end\n end\n\n block.normalize\n block\n end",
"def group_holdings(document)\n holdings = JSON.parse(document['holdings_json'])\n Rails.logger.info \"es287_debug #{__FILE__}:#{__LINE__}:#{__method__} holdings = #{holdings.inspect}\"\n circulating_items = []\n rare_items = []\n online_items = []\n # handle separate sets\n holdings.each do |k,holding|\n if holding[\"location\"].present?\n if holding[\"location\"][\"name\"].include?('Rare') \n rare_items << holding \n else \n circulating_items << holding \n end \n elsif holding[\"online\"].present? \n online_items << holding \n end \n end \n [circulating_items,online_items,rare_items]\n end",
"def sections\n @sections.values\n end",
"def sections\n @pages.collect { |p| p.sections }.flatten\n end",
"def each_section\n @sections.each_value do | section |\n yield( section )\n end\n end",
"def get_single_submission_sections(section_id,assignment_id,user_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 \"section_id is required\" if section_id.nil?\n raise \"assignment_id is required\" if assignment_id.nil?\n raise \"user_id is required\" if user_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 :section_id => section_id,\n :assignment_id => assignment_id,\n :user_id => user_id,\n :include => include\n )\n\n # resource path\n path = path_replace(\"/v1/sections/{section_id}/assignments/{assignment_id}/submissions/{user_id}\",\n :section_id => section_id,\n :assignment_id => assignment_id,\n :user_id => user_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 response\n \n end",
"def test_grouping\n make_dummy_source(\"http://groupme/source1\", N::FOAFX.Goat, N::FOAFX.Bee)\n make_dummy_source(\"http://groupme/source2\", N::FOAFX.Goat)\n make_dummy_source(\"http://groupme/source3\", N::FOAFX.Bee)\n results = Source.groups_by_property(:type, [ N::FOAFX.Goat, N::FOAFX.Bee ])\n assert_equal(2, results.size)\n assert_equal(2, results[N::FOAFX.Goat].size)\n assert_equal(2, results[N::FOAFX.Bee].size)\n end",
"def section_metadata\n [section_metadata_one, section_metadata_two, section_metadata_three]\n end",
"def sections\n @sections ||= context\n .public_methods\n .grep(/\\A(?!wait_)\\w+_section$\\z/)\n .map { |el| Meta::Section.new(el.to_s.gsub('_section', ''), context) }\n end",
"def sections=(value)\n @sections = value\n end",
"def group_items\n @group_items ||= Product.includes(:pictures)\n .where(group: group.presence || '_ZZZZ_', active: true, hidden: false)\n .order(:option_sort, :option_title)\n end",
"def add_group_config_to_solr solr_parameters\n solr_parameters[:group] = false if search_state.filter(grouped_key_for_results).any?\n end",
"def section?\n [email protected]?\n end",
"def sections(ident_only=false, &block)\n return to_enum(:sections, ident_only) if ! block_given?\n @sections.values.each do |sec|\n yield(ident_only ? sec.ident : sec)\n end\n end",
"def cases_grouped_by_status(options = {}) \n options.delete_if { |key,value| value.blank? }\n options = {:sort => 'sfcase.last_modified_date', :order => 'DESC', :all_at_company => false}.merge(options)\n sort_sql = options[:sort] + ' ' + options[:order]\n \n if options[:all_at_company] and company\n # owner sort is handled thru Ruby...could be \n # either a Sfgroup or a Sfuser\n if options[:sort] == 'sfuser.last_name'\n cases = Sfcase.find(:all, :include => [:contact], \n :conditions => [\"sfcase.contact_id IN (?)\",company.associated_contacts.map { |c| c.id }])\n cases = sort_cases_by_owner(cases,options)\n else \n cases = Sfcase.find(:all, :include => [:contact], \n :conditions => [\"sfcase.contact_id IN (?)\",company.associated_contacts.map { |c| c.id }], \n :order => sort_sql).group_by(&:status)\n end\n else\n if options[:sort] == 'sfuser.last_name'\n cases = Sfcase.find(:all, \n :include => [:contact], \n :conditions => \"sfcase.contact_id = '#{id}'\")\n cases = sort_cases_by_owner(cases,options)\n else\n cases = Sfcase.find(:all, \n :include => [:contact], \n :conditions => \"sfcase.contact_id = '#{id}'\", \n :order => sort_sql).group_by(&:status)\n end\n end\n # cases = self.cases.find(:all, :order => sort_sql ).group_by(&:status)\n # cases = cases.group_by(&:status)\n ordered_cases = []\n AppConstants::CASE_SORT_ORDER.each do |status|\n cases.keys.each do |key|\n if key == status\n ordered_cases << [key,cases[key]]\n cases.delete(key)\n end\n end\n end\n # add in cases that aren't of any of the specified groups\n ordered_cases\n # now add in other case statuses\n cases.keys.each do |key|\n ordered_cases << [key, cases[key]]\n end\n ordered_cases\n end",
"def section_by_name(section_name); end",
"def set_section_multiple(enumerable_obj)\n enumerable_obj.each do |keyed_obj|\n set_section(keyed_obj)\n append_section\n end\n return true\n end",
"def section_selection\n sections.map { |s| [s.to_label, s.id] }\n end",
"def grouped_key_for_results\n blacklight_config.view_config(action_name: :index).group\n end",
"def grouped_key_for_results\n blacklight_config.view_config(action_name: :index).group\n end",
"def grouped_order_details\n sorted_order_details = order_details.sort_by(&:safe_group_id)\n sorted_order_details.slice_when do |before, after|\n before.group_id.nil? || before.group_id != after.group_id\n end\n end",
"def process_section(layout, section_options, parent_section_options, use_parent_title, object_index: nil)\n # for table and object types get the list of objects\n # skip if there are none\n if %i[object table].include?(section_options[:type])\n objects = make_sure_array(send(section_options[:code]))\n\n return [] if objects.nil? || objects.count < 1 # we need to return an empty array not nil\n end\n\n if %i[list table].include?(section_options[:type])\n # always return an array so wrap this in an array\n parent_section_options[:use_parent_title] = use_parent_title unless parent_section_options.nil?\n [SectionData.new(self, section_options, objects, parent_section_options, object_index: object_index)]\n else # object\n process_objects_section(replace_section_name(section_options), layout, objects)\n end\n end",
"def find_group_results(group, offset, limit)\n #place solution here\n @coll.find(:group => group).skip(offset).limit(limit).sort({:secs => 1}).projection(group: false, _id: false)\n end",
"def sections\n @data.keys\n end",
"def group?\n proprieties[:group]\n end",
"def each_section(&block)\n @files.each do |file, list|\n list.each do |entry|\n yield(entry) if entry.is_a?(Section)\n end\n end\n end",
"def group?\n true\n end",
"def use_section_planes?\n end",
"def include?(group_name)\n \t\[email protected]?(group_name)\n \tend"
] | [
"0.6653073",
"0.6242842",
"0.5973519",
"0.5877339",
"0.58506346",
"0.57811224",
"0.573271",
"0.5702878",
"0.558101",
"0.5554483",
"0.55435246",
"0.54614896",
"0.5451912",
"0.5451912",
"0.54374576",
"0.54325724",
"0.5421929",
"0.5419253",
"0.54154307",
"0.5411119",
"0.53864753",
"0.537853",
"0.5369021",
"0.5354205",
"0.53504544",
"0.5304792",
"0.5302503",
"0.5302503",
"0.52491796",
"0.5173149",
"0.5153296",
"0.51475126",
"0.51459116",
"0.51386285",
"0.5120221",
"0.51143306",
"0.51048446",
"0.51048446",
"0.51023585",
"0.5096828",
"0.50949466",
"0.50937635",
"0.50715226",
"0.50565344",
"0.5055163",
"0.50541794",
"0.50488394",
"0.5048839",
"0.50349",
"0.5033335",
"0.5030864",
"0.502822",
"0.5019772",
"0.5017283",
"0.49963325",
"0.49860886",
"0.49449483",
"0.49278748",
"0.4926495",
"0.4915121",
"0.49142525",
"0.4912503",
"0.48952004",
"0.4895047",
"0.48938006",
"0.48899105",
"0.48865747",
"0.48830032",
"0.48803648",
"0.48779348",
"0.48772153",
"0.48767543",
"0.48740038",
"0.48664546",
"0.48640895",
"0.48631075",
"0.48605317",
"0.48584318",
"0.4848479",
"0.48345822",
"0.48341745",
"0.48329443",
"0.48237234",
"0.4822152",
"0.4814285",
"0.48118547",
"0.4808777",
"0.4799584",
"0.47967994",
"0.4789872",
"0.4789872",
"0.478672",
"0.47799498",
"0.47789717",
"0.47709465",
"0.4762235",
"0.47609574",
"0.4737936",
"0.4735469",
"0.47342795"
] | 0.75516576 | 0 |
If specified, notifications will be returned formatted this way. | def format(value)
_format(value) or fail ArgumentError, "Unknown value for format: #{value}"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def notifications\n\t\tif signed_in?\n\t\t\tn = current_user.extra.notifications\n\t\t\tif n > 0\n\t\t\t\t\"(\" + n.to_s + \")\"\n\t\t\tend\n\t\tend\n\tend",
"def implements()\n return Formatter::AllNotifications\n end",
"def notifications\n return notification_data_source.notifications\n end",
"def notifications(params={})\n Endpoints::Notifications.new(self).get(params)\n end",
"def notifications\n response = self.class.get('/notifications.xml')\n notifications_array = []\n response['notifications'].each do |note|\n new_note = Notification.new(:body => note[\"body\"],\n :subject => note[\"subject\"],\n :send_at => note[\"send_at\"],\n :id => note[\"id\"],\n :escalation => note[\"escalation\"])\n note[\"recipients\"].each do |rcpt|\n new_note.add_recipient(Recipient.new(:id => rcpt[\"id\"],\n :channel => rcpt[\"channel\"],\n :address => rcpt[\"address\"],\n :status => rcpt[\"status\"],\n :send_at => rcpt[\"send_at\"]))\n end\n notifications_array << new_note \n end\n notifications_array\n end",
"def to_s\n '#<Twilio.Notify.V1.NotificationList>'\n end",
"def notifications\n response = query_api(\"/rest/notifications\")\n return response[\"notifications\"].map {|notification| Notification.new(self, notification)}\n end",
"def notifications\n end",
"def list_notifications\n BrickFTP::API::Notification.all\n end",
"def list_notifications\n BrickFTP::API::Notification.all\n end",
"def notifications\n query_api_object Notification, \"/rest/notifications\", nil, \"GET\", \"notifications\"\n end",
"def format_backtrace( notification )\n\t\tlines = notification.formatted_backtrace\n\t\treturn lines.map do |line|\n\t\t\tlink_backtrace_line( line )\n\t\tend\n\tend",
"def list_notifications # :norobots:\n @notifications = Notification.find_all_by_user_id(@user.id, order: :flavor)\n end",
"def notifications\n ::Syncano::QueryBuilder.new(self, ::Syncano::Resources::Notifications::Base)\n end",
"def notifications\n @user = current_user\n @notifications.update_all(updated_at: Time.zone.now)\n respond_to do |format|\n format.html\n format.json\n end\n end",
"def all\n for_user_id = @authenticated_user.id\n notifications = Notification.where(for_user_id: for_user_id, notification_type: [0,1,2,3,4])\n .order(created_at: :desc)\n notifications.each do |n|\n if (n.sent_at == nil)\n n.sent_at = Time.now\n n.save\n end\n end\n render json: Notification.render_json_full(notifications)\n end",
"def changes_notification\n NotifierMailer.changes_notification(User.limit(2), {\n title: 'Email test title',\n content: 'Email test content',\n body: 'Email test body'\n })\n end",
"def get_notifications\n begin\n response = notifications_api.get\n [parse_json(response), nil]\n rescue RestClient::Unauthorized\n [{}, Unauthorized]\n end\n end",
"def generate_notifications\n\t\t@notifications = Notification.find(:all, :order => \"created_at DESC\")\n\tend",
"def notification_cmt\n @notifications = current_user.notifications.where(notification_type: \"comment\").order(\"created_at desc\")\n\n\n\n # evidence_id_slot_owner = @notifications.where(obj_type: \"evidence_id_slot_owner\").group_by(&:obj_id)\n # evidence_id_slot = @notifications.where(obj_type: \"evidence_id_slot\").group_by(&:obj_id)\n # evidence_id_other_subject_owner = @notifications.where(obj_type: \"evidence_id_other_subject_owner\").group_by(&:obj_id)\n # evidence_id_other_subject = @notifications.where(obj_type: \"evidence_id_other_subject\").group_by(&:obj_id)\n # short_term_objective_id_owner = @notifications.where(obj_type: \"short_term_objective_id_owner\").group_by(&:obj_id)\n # short_term_objective_id = @notifications.where(obj_type: \"short_term_objective_id\").group_by(&:obj_id)\n # current_title_id_short_term_owner = @notifications.where(obj_type: \"current_title_id_short_term_owner\").group_by(&:obj_id)\n # current_title_id_short_term = @notifications.where(obj_type: \"current_title_id_short_term\").group_by(&:obj_id)\n # current_title_id_long_term_owner = @notifications.where(obj_type: \"current_title_id_long_term_owner\").group_by(&:obj_id)\n # current_title_id_long_term = @notifications.where(obj_type: \"current_title_id_long_term\").group_by(&:obj_id)\n\n\n render :layout => false\n end",
"def parse_all(registration_ids, title, body, options = {})\n {\n registration_ids: registration_ids,\n notification: {\n title: title,\n body: body,\n icon: options[:icon],\n badge: options[:badge],\n sound: options[:sound]\n },\n priority: options[:priority]\n }.to_json\n end",
"def all_notifications\n self.notifications.all\n end",
"def to_s\n '#<Twilio.Conversations.V1.NotificationList>'\n end",
"def to_s\n '#<Twilio.Conversations.V1.NotificationList>'\n end",
"def get_notifications notifiable_type\n n = Notification.where(user_id:current_user, notifiable_type: notifiable_type)\n events_id = Array.new\n n.each do |v|\n events_id << v.notifiable_id\n end\n events = Event.where(id:events_id)\n\n end",
"def notifications\n @current_user ||= User.find(session[:user_id]) if session[:user_id]\n @client = Octokit::Client.new(:access_token => @current_user.token)\n\n # get first 50 notifications (github paginates at 50)\n notifications = @client.notifications({all: true, per_page: 50})\n\n # if there are more pages, get page 2\n more_pages = @client.last_response.rels[:next]\n if more_pages\n notifications.concat more_pages.get.data\n end\n\n # Consider how to get more pages...\n # page_count = 0\n # while more_pages and page_count < 10\n # notifications.concat more_pages.get.data\n # page_count++\n # more_pages = @client.last_response.rels[:next]\n # end\n\n # iterate over notifications to:\n # add score value\n # add notification_url value\n @json = notifications.map do |notification|\n add_score_url_to_notification(notification, {favRepos: @current_user.UserPreference.repos})\n end\n\n respond_to do |format|\n format.json {\n render json: @json.to_json, status: 200\n }\n end\n end",
"def send_notifications\n end",
"def notifications(options = {})\n #:type => nil is a hack not to give Messages as Notifications\n notifs = Mailboxer::Notification.recipient(messageable).where(:type => nil).order(\"mailboxer_notifications.created_at DESC\")\n if options[:read] == false || options[:unread]\n notifs = notifs.unread\n end\n\n notifs\n end",
"def notifications(options = {})\n scope = MessageCenter::Notification.recipient(messageable).order(:created_at => :desc)\n if options[:read] == false || options[:unread]\n scope = scope.unread\n end\n\n scope\n end",
"def notificable(notificable_params = {})\n @notification = {\n :emails => notificable_params[:emails].join(';'),\n :message => notificable_params[:message]\n }\n end",
"def set_notifications\n\t\t@notifications = Notification.where(reciever_id: current_user).order(\"created_at DESC\")\n\tend",
"def growl_notify\n\t\t\toptions = { :title => @application,\n\t\t\t\t\t\t\t\t\t:description => @message.gsub(/[\\n]+/, \"\"),\n\t\t\t\t\t\t\t\t\t:application_name => @application,\n\t\t\t\t\t\t\t\t\t:image_from_location => @icon,\n\t\t\t\t\t\t\t\t\t:sticky => false,\n\t\t\t\t\t\t\t\t\t:priority => 0,\n\t\t\t\t\t\t\t\t\t:with_name => notifications.first }\n @growl.notify options\t\t\t\n\t\tend",
"def show_notifications # :norobots:\n pass_query_params\n data = []\n @observation = find_or_goto_index(Observation, params[:id].to_s)\n return unless @observation\n name_tracking_emails(@user.id).each do |q|\n fields = [:naming, :notification, :shown]\n naming_id, notification_id, shown = q.get_integers(fields)\n next unless shown.nil?\n notification = Notification.find(notification_id)\n if notification.note_template\n data.push([notification, Naming.find(naming_id)])\n end\n q.add_integer(:shown, 1)\n end\n @data = data.sort_by { rand }\n end",
"def notification_text(notification)\n notifiable = notification.notifiable\n text = if notification.medium?\n t('notifications.new_medium')\n elsif notification.course?\n course_notification_card_text(notifiable)\n elsif notification.lecture?\n lecture_notification_card_text(notifiable)\n else\n t('notifications.new_announcement')\n end\n text.html_safe\n end",
"def groups_notification_email\n @data = last_notification\n # Only send if there's something to send\n return unless @data.any?\n rails_secrets = Rails.application.secrets\n send_to = rails_secrets.user_default_email\n send_from = 'notifications@' + rails_secrets.domain_name\n mail(from: send_from, to: send_to,\n subject: 'Competitor-Monitor Changes Notification')\n end",
"def parse_all(registration_ids, title, body, options = {})\n options[:priority] = @priority if options[:priority].nil?\n\n {\n registration_ids: registration_ids,\n notification: {\n title: title,\n body: body,\n icon: options[:icon],\n badge: options[:badge],\n sound: options[:sound],\n click_action: options[:click_action],\n },\n data: options[:data],\n priority: options[:priority]\n }.to_json\n end",
"def all_notifications(options = {})\n reverse = options[:reverse] || false\n with_group_members = options[:with_group_members] || false\n as_latest_group_member = options[:as_latest_group_member] || false\n target_notifications = Notification.filtered_by_target_type(self.name)\n .all_index!(reverse, with_group_members)\n .filtered_by_options(options)\n .with_target\n case options[:filtered_by_status]\n when :opened, 'opened'\n target_notifications = target_notifications.opened_only!\n when :unopened, 'unopened'\n target_notifications = target_notifications.unopened_only\n end\n target_notifications = target_notifications.limit(options[:limit]) if options[:limit].present?\n as_latest_group_member ?\n target_notifications.latest_order!(reverse).map{ |n| n.latest_group_member } :\n target_notifications.latest_order!(reverse).to_a\n end",
"def notifications\n @other_user = @login_user\n @notifications = DiscussionGroupUser.where(['user_id =? AND is_member=?', @login_user.id, false])\n @disc_notifications = NonSiteUser.where([\"email=? AND invitable_type=? and invitation_type=?\",@login_user.email,\"Discussion\",\"Invited\"])\n respond_to do |format|\n format.html\n end\n end",
"def group_notifications\n @attributes[:group_notifications]\n end",
"def generate_notifications\n notification = \"New Reply to '#{@post.content}'\"\n Notification.create(content: notification, \n user_id: @post.sender.id, \n user_type: @post.sender.class.name,\n origin_type: 'Message',\n origin_id: @message.id) unless @post.sender == @message.sender\n users = []\n @post.messages.each do |message|\n users << message.sender unless users.include?(message.sender) || @post.sender == message.sender\n end\n users.each do |user|\n Notification.create(content: notification,\n user_id: user.id,\n user_type: user.class.name,\n origin_type: 'Message',\n origin_id: @message.id) unless user == @message.sender\n end\n end",
"def create_notification(notification)\n \"<div class='alert alert-primary notification-body' role='alert'><%= #{notification.body} %></div>\"\n end",
"def message_notifications\n notifications = Message.where(receiver_id: @current_user.id, read_status: 0)\n if notifications\n render json: {\n status: 'success',\n message: 'Your notifications',\n data: notifications.length()\n },\n status: :ok\n end\n end",
"def notifications(blog_name, options = {})\n validate_options([:before, :types], options)\n get(blog_path(blog_name, 'notifications'), options)\n end",
"def notification_badge\n if current_user.notifications.any?\n mi.notifications\n else\n mi.notifications_none\n end\n end",
"def get_notifications\n \t\n \t@notifs = []\n\n \tif current_user\n @notifs = Notification.where(:user_id => current_user.id, :seen => false)\n \tend\n end",
"def append_delivery_notes\n self.message += \"\\n----\\nFrom: #{self.user.email} #{Time.now}\\n\" + I18n.translate(:delivered_to)+\" \"\n if( all_users = (@recipients.count == User.count))\n self.message += I18n.translate(:all_users, count: @recipients.count)\n else\n self.message += @recipients.all.map { |recipient|\n recipient.name + \" (#{recipient.email})\"\n }.join(\", \")\n end\n end",
"def notifications(receiver=current_user, limit=9)\n @notifications = receiver.received_notifications.limit(limit)\n end",
"def show\n # Title of the webpage\n @title = 'Notifications'\n\n # Getting all of the user's notifications, then those that are unread\n @all_notifications = Notification.where([\"user_id = :id\", { id: current_user.id }]).order(created_at: :desc)\n @notification_content = {}\n @unread_notification_ids = []\n\n @all_notifications.each do |notification|\n if notification.unread?\n # Mark all of the unread notifications as read, since they have now been opened\n @unread_notification_ids << notification.id\n notification.unread = false\n notification.save\n end\n\n # Get the pieces of the body of the notification\n if notification.body\n @notification_content[notification.id] = notification.body.split(/\\n/)\n end\n\n end\n\n # Clear the number of unread notifications for the user\n current_user.update_attribute(:unread_notifications, 0)\n end",
"def notification_msg\n author_name = author.firstname\n \"An issue has been reported by #{author_name}\"\n end",
"def notifications(page = 1)\n\t\t\toptions = {\"page\" => page}\n\t\t\tdata = oauth_request(\"/notifications.xml\", options)\n\t\t\tHashie::Mash.new(data)\n\t\tend",
"def getNotificationSm(n)\n @ntype = n.notification_type\n @html = '<div class=\"col-xs-12 col-md-4\">' +\n '<div class=\"notification-sm\">' +\n '<p class=\"name\">' + n.title + '</p>' +\n '<p>' + n.desc + '</p>' +\n '<p class=\"buttons\">'\n @html += (@ntype == 1 || @ntype == 2) ? '<a class=\"btn btn-info\" href=\"/users/' + n.sender_id.to_s + '\">User</a>' : \"\"\n @html += (@ntype == 3 || @ntype == 4) ? '<a class=\"btn btn-info\" href=\"/events/' + n.sender_id.to_s + '\">Event</a>' : \"\"\n @html += (@ntype == 1 || @ntype == 3) ? '<a class=\"btn btn-success\" href=\"/notifications/' + n.id.to_s + '/' + @ntype.to_s + '\">Accept</a>' : \"\"\n @html += link_to 'Delete', n, method: :delete, data: { confirm: 'Are you sure?' }, class: \"btn btn-danger\"\n @html += (@ntype == 3 || @ntype == 4) ? (link_to 'Delete all notifications for this event', '/notifications/' + n.sender_id.to_s + \"/8\", data: { confirm: 'Are you sure?' }, class: \"btn btn-danger\") : \"\"\n @html += '</p>' +\n '</div>' +\n '</div>'\n return @html.html_safe\n end",
"def email_status_change_notices\n return if previously_published?\n\n case status\n when 'published', 'embargoed'\n StashEngine::UserMailer.status_change(resource, status).deliver_now\n StashEngine::UserMailer.journal_published_notice(resource, status).deliver_now\n when 'peer_review'\n StashEngine::UserMailer.status_change(resource, status).deliver_now\n StashEngine::UserMailer.journal_review_notice(resource, status).deliver_now\n when 'submitted'\n\n # Don't send multiple emails for the same resource, or for submission made by curator\n return if previously_submitted?\n\n StashEngine::UserMailer.status_change(resource, status).deliver_now\n when 'withdrawn'\n return if note.include?('final action required reminder') # this has already gotten a special withdrawal email\n\n if user_id == 0\n StashEngine::UserMailer.user_journal_withdrawn(resource, status).deliver_now\n else\n StashEngine::UserMailer.status_change(resource, status).deliver_now\n end\n end\n end",
"def notification_color(notification)\n return 'bg-post-it-blue' if notification.generic_announcement?\n return 'bg-post-it-red' if notification.announcement?\n return 'bg-post-it-orange' if notification.course? || notification.lecture?\n 'bg-post-it-yellow'\n end",
"def display_notifications_in_tab(object)\n\t\tif current_petsitter\n\n\t\t\tif object.notificationforpetsitters.where('read_status = ? ' , false ).present?\n\n\t\t\t\treturn_html =\"<span style='color:#ff6666 ; font-weight:bolder;'>\" + \" <i class='fa fa-exclamation-circle' aria-hidden='true' ></i>\" + \" (\" + object.notificationforpetsitters.where('read_status = ? ' , false ).count.to_s + \")\" + \"</span>\"\n\t\t\t\treturn return_html.html_safe\n\n\t\t\tend\n\t\t\t\n\t\telsif current_petowner\n\n\t\t\tif object.notificationforpetowners.where('read_status = ? ' , false ).present?\n\n\t\t\t\treturn_html =\"<span style='color:#ff6666 ; font-weight:bolder;'>\" + \" <i class='fa fa-exclamation-circle' aria-hidden='true' ></i>\" + \" (\" + object.notificationforpetowners.where('read_status = ? ' , false ).count.to_s + \")\" + \"</span>\"\n\t\t\t\treturn return_html.html_safe\n\n\t\t\tend\n\n\t\tend\n\n\t\t\n\t\n\tend",
"def formatted\n update_headers\n\n [encode_message(body), publish_opts]\n end",
"def index\n respond_with @notifications = Notification.latest.paginate(:page => params[:page], :per_page => 100)\n end",
"def message\n \"You have a new notification!\"\n end",
"def index\n @page_title = @menu_title = 'Message Board'\n\n @user = auth_user\n\n if params[:list_type].to_s == 'archive'\n @notifications = ::Users::Notification.sent_to(@user.id).already_viewed.includes(:sender)\n elsif params[:list_type].to_s == 'waiting'\n @notifications = ::Users::Notification.sent_to(@user.id).in_wait.includes(:sender)\n else\n @notifications = ::Users::Notification.sent_to(@user.id).not_deleted.includes(:sender).order('status DESC, id DESC')\n end\n # Web-only\n @notifications = @notifications.parent_required if auth_user.is_a?(Parent) && request.format == 'text/html'\n @notifications = @notifications.paginate(page: [1, params[:page].to_i].max, per_page: ::Users::Notification.per_page)\n\n if (order = normalized_order).present?\n @notifications = @notifications.order(order == 'ASC' ? 'id ASC' : 'id DESC')\n end\n\n #puts request.headers['X-App-Name'].eql? 'kidstrade-ios'\n\n @sorted_notifications = @notifications.to_a.sort do|x, y|\n x.compares_with(y)\n end\n ::Users::Notification.set_related_models( @sorted_notifications )\n\n respond_to do |format|\n format.html { render layout:'landing_25' }\n format.json do\n result = reject_notes(@sorted_notifications);\n render json: (result.collect{|n| n.as_json(relationship_to_user: @user) } )\n end\n end\n end",
"def notify_emails_on_newlines(task)\n emails = (task.notify_emails || \"\").strip.split(\",\")\n return emails.join(\"\\n\")\n end",
"def fNotificationListFrom (email)\n @users.notificationListFrom(email)\n end",
"def notifications(time = nil, filter = nil)\n parse_xml(*notifications_xml(time, filter))\n end",
"def to_s\n context = @solution.map{|k, v| \"#{k}: #{v}\"}.join(',')\n \"#<Twilio.Conversations.V1.NotificationContext #{context}>\"\n end",
"def to_s\n \"<Twilio.Notify.V1.NotificationInstance>\"\n end",
"def to_s\n context = @solution.map {|k, v| \"#{k}: #{v}\"}.join(',')\n \"#<Twilio.Conversations.V1.NotificationContext #{context}>\"\n end",
"def index\n @notifications = Notification.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @notifications }\n end\n end",
"def unread_notifications\n notifications_received.where('activities.created_at > ?', notifications_checked_at)\n end",
"def notification_link(notification)\n notifiable = notification.notifiable\n return '' unless notifiable\n text = if notification.medium?\n medium_notification_card_link(notifiable)\n elsif notification.course?\n course_notification_card_link\n elsif notification.lecture?\n lecture_notification_card_link\n else\n notifiable.details\n end\n text.html_safe\n end",
"def badges_to_html(only: [:status, :warning])\n filtered = notices.select { |notice| Array(only).include?(notice.severity) }\n\n safe_join(filtered.map(&:badge_to_html))\n end",
"def index\n @notifications = current_user.notifications.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @notifications }\n end\n end",
"def process_notification(notification)\n @logger.debug (\"Processing notification: #{notification.inspect}\")\n\n timestamp = Time.now\n event_id = notification.event_id\n entity_check = Flapjack::Data::EntityCheck.for_event_id(event_id,\n :redis => @redis, :logger => @logger)\n contacts = entity_check.contacts\n\n if contacts.empty?\n @logger.debug(\"No contacts for #{event_id}\")\n @notifylog.info(\"#{event_id} | #{notification.type} | NO CONTACTS\")\n return\n end\n\n messages = notification.messages(contacts,\n :default_timezone => @default_contact_timezone, :logger => @logger)\n\n notification_contents = notification.contents\n\n messages.each do |message|\n media_type = message.medium\n address = message.address\n contents = message.contents.merge(notification_contents)\n\n if message.rollup\n rollup_alerts = message.contact.alerting_checks_for_media(media_type).inject({}) do |memo, alert|\n ec = Flapjack::Data::EntityCheck.for_event_id(alert, :redis => @redis)\n last_change = ec.last_change\n memo[alert] = {\n 'duration' => last_change ? (Time.now.to_i - last_change) : nil,\n 'state' => ec.state\n }\n memo\n end\n contents['rollup_alerts'] = rollup_alerts\n contents['rollup_threshold'] = message.contact.rollup_threshold_for_media(media_type)\n end\n\n @notifylog.info(\"#{event_id} | \" +\n \"#{notification.type} | #{message.contact.id} | #{media_type} | #{address}\")\n\n if @queues[media_type.to_s].nil?\n @logger.error(\"no queue for media type: #{media_type}\")\n return\n end\n\n @logger.info(\"Enqueueing #{media_type} alert for #{event_id} to #{address} type: #{notification.type} rollup: #{message.rollup || '-'}\")\n\n contact = message.contact\n\n if notification.ok? || (notification.state == 'acknowledgement')\n ['warning', 'critical', 'unknown'].each do |alert_state|\n contact.update_sent_alert_keys(\n :media => media_type,\n :check => event_id,\n :state => alert_state,\n :delete => true)\n end\n else\n contact.update_sent_alert_keys(\n :media => media_type,\n :check => event_id,\n :state => notification.state)\n end\n\n contents_tags = contents['tags']\n contents['tags'] = contents_tags.is_a?(Set) ? contents_tags.to_a : contents_tags\n\n Flapjack::Data::Alert.add(@queues[media_type.to_s], contents, :redis => @redis)\n end\n end",
"def notification_metadata\n data.notification_metadata\n end",
"def inspect\n values = @properties.map{|k, v| \"#{k}: #{v}\"}.join(\" \")\n \"<Twilio.Conversations.V1.NotificationInstance #{values}>\"\n end",
"def notification(id)\n response = self.class.get(\"/notifications/\" + id.to_s + \".xml\")\n note = response[\"notification\"]\n new_note = Notification.new( :body => note[\"body\"],\n :subject => note[\"subject\"],\n :id => note[\"id\"],\n :send_at => note[\"send_at\"],\n :escalation => note[\"escalation\"])\n note[\"recipients\"].each do |rcpt|\n new_note.add_recipient(Recipient.new(:id => rcpt[\"id\"],\n :channel => rcpt[\"channel\"],\n :address => rcpt[\"address\"],\n :status => rcpt[\"status\"],\n :send_at => rcpt[\"send_at\"]))\n end\n new_note \n end",
"def created()\n pending = @@server.pending\n messages = []\n\n # common format for message lines\n append = proc do |title, list|\n next unless list\n if list.length > 0 and list.length < 6\n titles = []\n Agenda.index.each do |item|\n titles << item.title if list.include? item.attach\n end\n messages << \"#{title} #{titles.join(', ')}\"\n elsif list.length > 1\n messages << \"#{title} #{list.length} reports\"\n end\n end\n\n append 'Approve', pending.approved\n append 'Unapprove', pending.unapproved\n append 'Flag', pending.flagged\n append 'Unflag', pending.unflagged\n\n # list (or number) of comments made with this commit\n comments = pending.comments.keys().length\n if comments > 0 and comments < 6\n titles = []\n Agenda.index.each do |item|\n titles << item.title if pending.comments[item.attach]\n end\n messages << \"Comment on #{titles.join(', ')}\"\n elsif comments > 1\n messages << \"Comment on #{comments} reports\"\n end\n\n # identify (or number) action item(s) updated with this commit\n if pending.status\n if pending.status.length == 1\n item = pending.status.first\n text = item.text\n if item.pmc or item.date\n text += ' ['\n text += \" #{item.pmc}\" if item.pmc\n text += \" #{item.date}\" if item.date\n text += ' ]'\n end\n\n messages << \"Update AI: #{text}\"\n elsif pending.status.length > 1\n messages << \"Update #{pending.status.length} action items\"\n end\n end\n\n @message = messages.join(\"\\n\")\n end",
"def notifications_for_principal(principal_uri)\n @notifications[principal_uri] || []\n end",
"def elements_for_notification(notification)\n obj = notification.attachable\n return [nil, notification.message, nil] if obj.blank? or notification.action.blank?\n case notification.action.to_sym\n when :new_checkin then [obj.startup.logo_url(:small), \"<span class='entity'>#{obj.startup.name}</span> posted their weekly progress update\", url_for(obj)]\n when :relationship_request then [obj.entity.is_a?(Startup) ? obj.entity.logo_url(:small) : obj.entity.pic_url(:small), \"<span class='entity'>#{obj.entity.name}</span> would like to connect with you\", url_for(obj.entity)]\n when :relationship_approved then [obj.connected_with.is_a?(Startup) ? obj.connected_with.logo_url(:small) : obj.connected_with.pic_url(:small), \"<span class='entity'>#{obj.connected_with.name}</span> is now connected to you\", url_for(obj.connected_with)]\n when :new_comment_for_checkin then [obj.user.pic_url(:small), \"<span class='entity'>#{obj.user.name}</span> commented on your #{obj.checkin.time_label} checkin\", checkin_path(obj.checkin) + \"#c#{obj.id}\"]\n when :new_nudge then [obj.from.pic_url(:small), \"<span class='entity'>#{obj.from.name}</span> nudged you to complete your check-in\", url_for(obj.from)]\n when :new_comment_for_post then [obj.user.pic_url(:small), \"<span class='entity'>#{obj.user.name}</span> commented on your post\", post_path(:id => obj.root_id)]\n when :new_like then [obj.user.pic_url(:small), \"<span class='entity'>#{obj.user.name}</span> likes your post\", post_path(obj)]\n when :new_team_joined then [obj.logo_url(:small), \"<span class='entity'>#{obj.name}</span> joined nReduce\", url_for(obj)]\n when :new_awesome then [obj.user.pic_url(:small), \"<span class='entity'>#{obj.user.name}</span> thinks you made some awesome progress!\", url_for(obj.awsm)]\n when :response_completed then [obj.user.pic_url(:small), \"<span class='entity'>#{obj.user.name}</span> completed your help request!\", url_for(obj.user)]\n else [nil, notification.message, nil]\n end\n end",
"def create_notification; end",
"def flash_notifications_replacement\n\t [ \"div.flash_notifications\", flash_notifications_div ]\n\tend",
"def inspect\n values = @properties.map{|k, v| \"#{k}: #{v}\"}.join(\" \")\n \"<Twilio.Conversations.V1.NotificationInstance #{values}>\"\n end",
"def push(notif)\n\n end",
"def index\n notifications = params[:unread].nil? || params[:unread] == 0 ? current_user.notifications : Notification.where(user: current_user, status: :unread).all\n\n render json: {\n status: 'Success',\n message: '',\n notifications: notifications.as_json(except: [\n :created_at,\n :updated_at\n ])\n }, status: 200\n end",
"def index\n @notifications = Notification.includes(:contextable).where(notifiable: @context)\n render json: paginated_json(@notifications) { |notifications| notifications_json(notifications) }\n end",
"def push_notifications\n pending = find_pending\n to_send = pending.map do |notification|\n notification_type.new notification.destinations, notification.data\n end\n pusher = build_pusher\n pusher.push to_send\n pending.each_with_index do |p, i|\n p.update_attributes! results: to_send[i].results\n end\n end",
"def get_notifications\n @notifications = Broadcast.joins(:feeds).where(feeds: {name: \"notification\"}).order(created_at: :desc).limit(20)\n end",
"def getEventNotifications(u, e)\n @result = []\n @ns = Notification.all\n @ns.each do |n|\n if u == nil\n if (n.notification_type == 3 || n.notification_type == 4) && n.sender_id == e.to_i\n @result.push(n)\n end\n else\n if (n.notification_type == 3 || n.notification_type == 4) && n.sender_id == e.to_i && n.user_id == u.to_i\n @result.push(n)\n end\n end\n end\n return @result\n end",
"def notify\n notification = @notification_queue.shift\n return if notification.nil?\n num_of_lines, formatted_body = calculate_num_of_lines notification.body\n dzen = \"dzen2 -p #{notification.timeout}\"\n display_settings = \" -geometry -500+0 -w 500 -l #{5} -ta l -sa c\"\n actions = \" -e 'onstart=uncollapse,scrollhome;button1=exit;button4=scrollup;button5=scrolldown;'\"\n font = \" -fn 'Terminus-8'\"\n IO.popen dzen + display_settings + actions + font, \"w\" do |pipe|\n pipe.puts notification.title\n pipe.puts formatted_body\n pipe.close\n end\n self.notify\n end",
"def firecloud_api_notification(current_status, requester=nil)\n unless Rails.application.config.disable_admin_notifications == true\n @admins = User.where(admin: true).map(&:email)\n @requester = requester.nil? ? '[email protected]' : requester\n @current_status = current_status\n unless @admins.empty?\n mail(to: @admins, reply_to: @requester, subject: \"[Unity Admin Notification#{Rails.env != 'production' ? \" (#{Rails.env})\" : nil}]: ALERT: FIRECLOUD API SERVICE INTERRUPTION\") do |format|\n format.html\n end\n end\n end\n end",
"def notifications\n ::Users::Notification.where(related_model_type: self.class.to_s, related_model_id: self.id)\n end",
"def default_notification_payload\n {:user => try_spree_current_user, :order => current_order}\n end",
"def curate_text\n notification_type = get_nagios_var('NAGIOS_NOTIFICATIONTYPE')\n if notification_type.eql?('ACKNOWLEDGEMENT')\n @text += self.content[:short_text][:ack_info] unless self.content[:short_text][:ack_info].empty?\n else\n [:host_info, :state_info, :additional_info, :additional_details].each do |info|\n @text += self.content[:short_text][info] unless self.content[:short_text][info].empty?\n end\n end\n end",
"def notification_arns\n @stack.notification_arns\n end",
"def sent\n @notifications = Notification.where(sender: @current_user)\n .order({created_at: :desc})\n .page(page_params[:page])\n .per(page_params[:page_size])\n render_multiple\n end",
"def notify *args # :nodoc:\n printf \"%8s %s\\n\", *args\n end",
"def index\n if current_user.status == \"admin\" || current_user.status == \"staff\"\n @notifications = Notification.all.sort_by { |obj| obj.created_at }.reverse\n elsif current_user.student\n @notifications = []\n Notification.all.each do |notification|\n @notifications << notification if notification.target == \"all\" || notification.target == \"students\"\n end\n @notifications = @notifications.sort_by { |obj| obj.created_at }.reverse\n elsif current_user.company\n @notifications = []\n Notification.all.each do |notification|\n @notifications << notification if notification.target == \"all\" || notification.target == \"companies\"\n end\n @notifications = @notifications.sort_by { |obj| obj.created_at }.reverse \n end\n # @notifications = unreaded_notifications\n respond_to do |format|\n format.html {render template: \"/notifications/index\"}\n format.js\n end\n end",
"def show\n @emails = JSON.parse(@notification.fetch_emails)\n end",
"def index\n #@notifications = Notification.all\n @notifications = Notification.order('updated_at').page(params[:page]).per_page(10)\n end",
"def set_notifications\n @notifications = Notification.all\n end",
"def to_s\n values = @params.map{|k, v| \"#{k}: #{v}\"}.join(\" \")\n \"<Twilio.Conversations.V1.NotificationInstance #{values}>\"\n end",
"def notifications_update\n @notifications = current_user.sk.followed_submissions.includes(:user, :problem).where(\"status > 0\").order(\"lastcomment DESC\").paginate(page: params[:page]).to_a\n @new = false\n render :notifications\n end",
"def notify_by_push\n PushNotification.new(user: context.user,\n message: context.message,\n n_type: context.n_type,\n data: { from_id: context.user_from.try(:id), from_name: context.user_from.try(:name),\n donation_id: context.donation.try(:id) })\n .simple_notification\n end",
"def index\n\t\t@notifications = Notification.all\n\tend"
] | [
"0.73642445",
"0.7050159",
"0.65640235",
"0.6540165",
"0.65398955",
"0.6452714",
"0.63602924",
"0.63456655",
"0.63105524",
"0.63105524",
"0.63039947",
"0.6252113",
"0.6235196",
"0.62245494",
"0.62135285",
"0.61572766",
"0.61407244",
"0.61347324",
"0.6118244",
"0.609483",
"0.6070508",
"0.6068621",
"0.60626936",
"0.6061503",
"0.60520476",
"0.6040306",
"0.60096925",
"0.59828246",
"0.5974028",
"0.5948176",
"0.5926025",
"0.58738106",
"0.58725554",
"0.58488154",
"0.5820943",
"0.5813352",
"0.57938015",
"0.5792168",
"0.57813674",
"0.57784975",
"0.5762515",
"0.57494235",
"0.5704535",
"0.5690479",
"0.5686688",
"0.56638455",
"0.5654795",
"0.5645845",
"0.5638998",
"0.5620973",
"0.56207675",
"0.5618028",
"0.5618011",
"0.5617941",
"0.56175345",
"0.5600639",
"0.55832887",
"0.5582998",
"0.5580392",
"0.5576243",
"0.55564463",
"0.55531764",
"0.5547195",
"0.55428296",
"0.55341727",
"0.5531562",
"0.55314535",
"0.55292785",
"0.5526906",
"0.5525055",
"0.5522913",
"0.5509989",
"0.55089676",
"0.54977006",
"0.5494996",
"0.5494773",
"0.5493823",
"0.5484805",
"0.5472123",
"0.5468895",
"0.5465877",
"0.5464763",
"0.54618394",
"0.5457627",
"0.54570127",
"0.54419225",
"0.5434075",
"0.5431961",
"0.54224235",
"0.5418327",
"0.54089546",
"0.5404318",
"0.5395379",
"0.53937835",
"0.538792",
"0.5380764",
"0.5379204",
"0.5378373",
"0.5375358",
"0.5374106",
"0.5368222"
] | 0.0 | -1 |
The maximum number of notifications to return. | def limit(value)
merge(notlimit: value.to_s)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def max_queue_count()\n @max_queue_count\n end",
"def notification_count\n @notifications.size\n end",
"def maximum_number_of_subscriptions\n to_i description['MaximumNumberOfSubscriptions']\n end",
"def maximum_limit\n 100\n end",
"def max_size()\n ACCOUNTING_REPLY_MAX_SIZE\n end",
"def max_listeners\n @max_listeners ||= DEFAULT_MAX_LISTENERS\n end",
"def max_items\n main.max_items\n end",
"def doGetMaxCountPerRequest()\n return MAX_COUNT_PER_REQUEST\n end",
"def max_size()\n AUTHENTICATION_CONTINUE_MAX_SIZE\n end",
"def get_max_interactions\n return @snps.length-1\n end",
"def max_count\n multiple? ? (@schema['max_count'] || :unlimited) : nil\n end",
"def maximum_size\n @ids.size\n end",
"def max_workers\n HireFire.configuration.max_workers\n end",
"def max_workers\n HireFire.configuration.max_workers\n end",
"def max_tag_subscriptions\n 5\n end",
"def max_failed_count\n MAX_FAILED_COUNT\n end",
"def max_size()\n AUTHENTICATION_REPLY_MAX_SIZE\n end",
"def notifications(receiver=current_user, limit=9)\n @notifications = receiver.received_notifications.limit(limit)\n end",
"def doGetMaxCountPerRequest()\n end",
"def max_listeners= max\n @max_listeners = max\n end",
"def size\n @max_entries\n end",
"def item_max\r\n @list.size\r\n end",
"def max_history\n @agent.history.max_size\n end",
"def unread_notification_count\n unread_notifications.count\n end",
"def maximum_requests\n super\n end",
"def recent_notifications(lower_limit=10, upper_limit=25)\n if unviewed_notifications.count < lower_limit\n notifications.limit(lower_limit)\n else\n unviewed_notifications.limit(upper_limit)\n end\n end",
"def default_limit\n 10\n end",
"def limited_merge_requests_count\n @limited_merge_requests_count ||= merge_requests.limit(count_limit).count\n end",
"def last_peer_count\n\t\t\t@last_peer_count ||= 50\n\t\tend",
"def opened_group_member_notifier_count(limit = ActivityNotification.config.opened_index_limit)\n limit == 0 and return 0\n group_members.opened_only(limit)\n .filtered_by_association_type(\"notifier\", notifier)\n .where(\"notifier_key.ne\": notifier_key)\n .to_a\n .collect {|n| n.notifier_key }.compact.uniq\n .length\n end",
"def max_packets; end",
"def limit; end",
"def limit; end",
"def limit; end",
"def max_length\n @executor.getMaximumPoolSize\n end",
"def max_size\n 1\n end",
"def doGetMaxObtainableTweets()\n return MAX_OBTAINABLE_TWEETS\n end",
"def max_history; end",
"def max_history; end",
"def limit\n 7\n end",
"def max_size()\n AUTHENTICATION_START_MAX_SIZE\n end",
"def events_notification_number\n @notifications = Notification.number_of_notifications_for_events current_user\n end",
"def max_size()\n ACCOUNTING_REQUEST_MAX_SIZE\n end",
"def get_max_results\n @max_results\n end",
"def max_threads\n\t\t\t@max_threads ||= 30\n\t\tend",
"def reduce_max_times_if_no_more_registrations\n errors.add(:max_times, 'already has more registrations') if max_times_changed? && max_times < registrations.count && max_times != 0\n end",
"def notification_number\n @notifications = Notification.get_number_of_notifications current_user\n end",
"def maximum_concurrency\n self.class.maximum_concurrency self\n end",
"def item_max\n return @data.size\n end",
"def item_max\n return @data.size\n end",
"def max_size; end",
"def max_queue_threads\n 1\n end",
"def limited_users_count\n @limited_users_count ||= users.limit(count_limit).count\n end",
"def max_attempts_count\n @options[:max_attempts_count]\n end",
"def size\n @max\n end",
"def shutdown_more_emails_sent_than_defined_in_user_profile?\n notifications_delivered > notifications_for_shutdown\n end",
"def max_delivery_count\n to_i description['MaxDeliveryCount']\n end",
"def max_size\n @group.max_size\n end",
"def limit\n meta.fetch('limit', nil)\n end",
"def max_clients\n errors.add(:clients, \"has more than #{MAX_WAYPOINT} clients.\") if clients.size > MAX_WAYPOINT\n end",
"def max\n start_addr + size - 1\n end",
"def maxjobs\n runopts(:maxjobs)\n end",
"def limit_reached?\n @count >= @max\n end",
"def limit count\n count.zero? ? none : super\n end",
"def max_consumption\n @max_consumption ||= begin\n augment = max_repeats == Float::INFINITY ? 10 : max_repeats\n self.next&.max_consumption.to_i + augment\n end\n end",
"def notification_count\n return NotificationReader.where(user: current_user, read_at: nil).count\n end",
"def remote_maximum_window_size; end",
"def max_retry\n 5\n end",
"def user_notification_threshold\n 1024 * (NOTIFICATION_THRESHOLD_OFFSET_GB + NOTIFICATION_USER_AFTER_EXCEEDED_GB * server.exceed_bw_user_notif)\n end",
"def max_history= length\n @agent.history.max_size = length\n end",
"def max_args\n @max_args || -1\n end",
"def log_max_prune_count\n @max_prunes += 1\n end",
"def max_files\n raw_data['max_files']\n end",
"def max_matches\n @max_matches || 1000\n end",
"def notifications_count\n notifications_count ||= self.notifications_to_show_user.where(:seen_by_user => false).count\n end",
"def limit\n components.fetch(:size)\n end",
"def max\n array.length - 1\n end",
"def item_max; 64; end",
"def opened_group_member_notifier_count(limit = ActivityNotification.config.opened_index_limit)\n limit == 0 and return 0\n group_members.opened_only(limit)\n .where(notifier_type: notifier_type)\n .where(:notifier_id.ne => notifier_id)\n .distinct(:notifier_id)\n .to_a.length #.count(true)\n end",
"def limit\n @timeout\n end",
"def limited_milestones_count\n @limited_milestones_count ||= milestones.limit(count_limit).count\n end",
"def poll_max_retries\n 3\n end",
"def number_requests\r\n return @requests.length\r\n end",
"def item_max\n return @enumeration.length\n end",
"def get_number_of_publishers\n @connections.length\n end",
"def max_interval\n MAX_INTERVAL\n end",
"def max_bad_records\n @gapi.max_bad_records\n end",
"def number_of_events\n self.events.length\n end",
"def largest_length\n @executor.getLargestPoolSize\n end",
"def item_max\n @data ? @data.size : 1\n end",
"def item_max\n @data ? @data.size : 1\n end",
"def item_max\n @data ? @data.size : 1\n end",
"def item_max\n @data ? @data.size : 1\n end",
"def item_max\n @data ? @data.size : 1\n end",
"def item_max\n @data ? @data.size : 1\n end",
"def default_count\n 1\n end",
"def item_max\n @data ? @data.size : 1;\n end",
"def max_concurrency\n -1\n end",
"def next_interval_index\n unread_notifications_since_last_read.count\n end",
"def event_most_attendees\n self.events.max_by do |event|\n event.attendees.length\n end\n end",
"def max_items\n items_node[:max_items].to_i if items_node[:max_items]\n end"
] | [
"0.7090089",
"0.7000239",
"0.6928119",
"0.6872609",
"0.6661234",
"0.6627118",
"0.66134554",
"0.65881795",
"0.65714866",
"0.6563829",
"0.65515566",
"0.65440553",
"0.65402323",
"0.65402323",
"0.6520012",
"0.64886814",
"0.646381",
"0.6418118",
"0.63793105",
"0.6371775",
"0.63534516",
"0.6348264",
"0.6334388",
"0.63251567",
"0.6324136",
"0.6315189",
"0.6302288",
"0.629745",
"0.62289995",
"0.6210448",
"0.6209448",
"0.62008303",
"0.62008303",
"0.62008303",
"0.61780405",
"0.61749",
"0.61666316",
"0.6161042",
"0.6161042",
"0.6160477",
"0.61518645",
"0.6134218",
"0.61336225",
"0.6133253",
"0.61286485",
"0.6100323",
"0.60867256",
"0.60863316",
"0.6057023",
"0.6057023",
"0.605467",
"0.6042354",
"0.6034526",
"0.6034371",
"0.6034336",
"0.6031267",
"0.60306",
"0.60269254",
"0.60223085",
"0.60201293",
"0.60110813",
"0.60108477",
"0.6003446",
"0.59994674",
"0.5977959",
"0.5975027",
"0.5972409",
"0.5965684",
"0.59647137",
"0.59593475",
"0.5952749",
"0.59445065",
"0.5938862",
"0.5937675",
"0.59375805",
"0.593457",
"0.59339684",
"0.5931438",
"0.5930665",
"0.5929252",
"0.59232354",
"0.59217817",
"0.5909892",
"0.590954",
"0.5906027",
"0.5898303",
"0.5895351",
"0.588866",
"0.5883137",
"0.588238",
"0.588238",
"0.588238",
"0.588238",
"0.588238",
"0.588238",
"0.5878732",
"0.58672595",
"0.5861321",
"0.58527595",
"0.58413017",
"0.58357626"
] | 0.0 | -1 |
When more results are available, use this to continue. | def continue(value)
merge(notcontinue: value.to_s)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def more_results?()\n #This is a stub, used for indexing\n end",
"def nextResults\n # Update results\n updateResults(@nextURI)\n\n # Update nextURI\n updateNextURI\n end",
"def collect_results\n while collect_next_line; end\n end",
"def next\n @offset = get_current_offset + get_count\n get_results @current_projection\n end",
"def while_results(&block)\n loop do\n results = get![:results]\n break if results.nil? || results.empty?\n results.each(&block)\n end\n end",
"def complete_result?\n @result_count < 1000\n end",
"def results\n fetch unless @results\n @results\n end",
"def get_results\n\n # An internal counter to get the next\n # set of results from the API\n @result_count = 0\n\n # An array into which the API results can\n # be collected\n @results = []\n\n # Get the first set of results from the API\n json_response = self.query\n\n while true\n\n # Exit the loop if the API doesn't return\n # any results and set the \"skip\" attribute\n # to nil\n if json_response['result_count'] == 0\n self.skip= nil\n break\n end\n\n # Add the count of the returned results to the\n # internal result counter's current value\n @result_count += json_response['result_count']\n\n # Append the current results to the results\n # array\n @results << json_response['results']\n\n # Set the \"skip\" attribute to the value\n # on the internal result counter\n self.skip= @result_count\n\n # Get the next set of results from the API\n json_response = self.query\n\n # A simple progress bar\n print \"#\"\n\n end\n\n # Print the total result count to the console\n puts \"\\nFound #{@result_count} results.\"\n\n return @results\n\n end",
"def next_result()\n #This is a stub, used for indexing\n end",
"def load\n return self if @entity[:next].nil? || @entity[:results].length == @entity[:total]\n\n np = self\n until np.next.nil?\n np = np.next_page\n @entity[:results].concat(np.results.map(&:to_h))\n end\n @entity[:next] = nil\n @entity[:per_page] = @entity[:total]\n self\n end",
"def pump_results!\n loop do\n distribute_results!\n end\n end",
"def next\n return nil unless next?\n ensure_service!\n gapi = service.job_query_results job_id, token: token\n QueryData.from_gapi gapi, service\n end",
"def load_more_search_result\n @users=[]\n @users = @login_user.search_query(session[:search_opt],params[:page].to_i)\n render :partial => \"search_user_result\"\n #render :text => \"yes\"\n end",
"def each\n current_result = self\n begin \n last_result = current_result\n current_result.elements[:results].each do |result|\n\t# The collection of refs we are holding onto could grow without bounds, so dup\n\t# the ref\n\tyield result.dup\n end\n current_result = current_result.next_page if current_result.more_pages?\n end while !last_result.equal? current_result\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 results_limit\n # max number of search results to display\n 10\n end",
"def get_more\n @reserve = get_chain\n last_link = @reserve\n count = @page_size / 100\n count = 15 if count < 15\n while(count > 0)\n last_link = get_next_for(last_link)\n count -= 1\n end\n @next_object = get_next_for(last_link)\n set_next_for( last_link , nil )\n self\n end",
"def fetch_more?(options, resp)\n page_size = options[:_pageSize] || options['_pageSize']\n\n return unless page_size && resp.is_a?(Array)\n resp.pop while resp.length > page_size\n\n resp.length < page_size\n end",
"def results\n populate\n @results\n end",
"def next_query\n @start += 1000\n\n {\n start: @start - 1000,\n rows: 1000,\n q: @q,\n fq: @fq,\n def_type: @def_type,\n fl: 'uid,fulltext_url',\n facet: false\n }\n end",
"def continue?(previous_response)\n return false unless previous_response.last_evaluated_key\n\n if @options[:limit]\n if @options[:limit] > previous_response.count\n @options[:limit] = @options[:limit] - previous_response.count\n\n true\n else\n false\n end\n else\n true\n end\n end",
"def numberOfResults\n @@numberOfResults\n end",
"def load_next_page\n @browser.pluggable_parser.html = SearchPaginationParser\n\n @pagination.next\n previous_length = @results.size\n\n page = @browser.get(ajax_url)\n\n @results += page.search('.match_row').collect do |node|\n OKCupid::Profile.from_search_result(node)\n end\n\n @browser.pluggable_parser.html = Mechanize::Page\n\n previous_length != @results.size\n end",
"def each(&block)\n process_results unless @processed\n @results.each(&block)\n end",
"def wait_for_results\n wait_until(Config.medium_wait) { elements(result_rows).any? }\n end",
"def abandon_results!()\n #This is a stub, used for indexing\n end",
"def no_more?\n more_results == :NO_MORE_RESULTS\n end",
"def more_after_limit?\n more_results == :MORE_RESULTS_AFTER_LIMIT\n end",
"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 wait_for_results\n wait_until(Config.long_wait) { elements(result_rows).any? }\n end",
"def next\n\t\t@skip = (@skip || 0) + get_resultcount\n\t\t@result = nil\n\t\treturn self\n\tend",
"def get_results\n \titems = self.possessions.find(:all, :limit => 20, :order => 'wants_count DESC')\n #reset data just for testing\n Possession.all.each do |item|\n item.new_owner = nil\n item.save\n end\n \t# items = prune(items)\n \tif items.count > 1\n \t\tfind_some_trades(items)\n \tend\n end",
"def each(&block)\n current_page = self\n while current_page\n current_page.results.each(&block)\n current_page = current_page.next_page\n end\n end",
"def results\n send_query\n end",
"def results_complete?(max_results)\n return @snp_list.results_complete?(max_results)\n end",
"def retrieved_records\n results.count\n end",
"def next?\n unless self.rows\n # Try to load some records\n \n if options[:query] and last_row != nil\n # A query was directly specified and all it's rows were returned\n # ==> Finished.\n return false\n end\n\n if options[:query]\n # If a query has been directly specified, just directly execute it\n query = options[:query]\n else\n # Otherwise build the query\n if last_row\n # There was a previous batch.\n # Next batch will start after the last returned row\n options.merge! :from => last_row, :exclude_starting_row => true\n end\n\n query = connection.table_select_query(options[:table], options)\n\n if options[:row_buffer_size]\n # Set the batch size\n query += \" limit #{options[:row_buffer_size]}\"\n end\n end\n\n self.rows = connection.select_all query\n self.current_row_index = 0\n end\n self.current_row_index < self.rows.size\n end",
"def fetch_with_limit\n start_result = 10\n start_result.step(RESULTS_LIMIT, 10) do |number|\n response = get_subdomains!(number)\n break unless response.items_present?\n end\n end",
"def paginated(result, params, with = API::Entities::Notification)\n env['auc_pagination_meta'] = params.to_hash\n if result.respond_to?(:count) && result.count > params[:limit]\n env['auc_pagination_meta'][:has_more] = true\n result = result[0, params[:limit]]\n end\n present result, with: with\n end",
"def next_page?\n return (@query[:startPage] * (@query[:count] + 1)) < @total_results\n end",
"def finalize_response(resp)\n resp.tap do |r|\n r.response[:limit] = r.response.items.size - 1\n r.response[:moreItems] = false\n end\n end",
"def results\n send_query\n end",
"def more_pages?\n return false if start_index == 0\n (self.start_index + self.page_length) -1 < self.total_result_count\n end",
"def results_complete?(max_results)\n complete = true\n @included_snps.each do |snp|\n if max_results != @snps[snp].results.length\n complete = false\n break\n end\n end\n return complete\n end",
"def retry_query\n Rails.logger.info('Retrying EDS Search')\n @attempts += 1\n search(@query[:term], @query[:profile], @query[:facets],\n @query[:page], @query[:per_page])\n end",
"def more_results\n @server_status & SERVER_MORE_RESULTS_EXISTS != 0\n end",
"def handle_pagination(query, ts_params, result)\n # Tablesorter submits row count or simply 'all'. If user requests more rows\n # than available do nothing.\n return query if (ts_params[:size] == 'all') || (ts_params[:size].to_i >= result[:total_rows])\n\n query.limit(ts_params[:size].to_i).offset(ts_params[:size].to_i * ts_params[:page].to_i)\n end",
"def get_more_items\n @items = Item.page(2)\n\tend",
"def has_results?\n true\n end",
"def more_messages\n log \"Getting more_messages\"\n log \"Old start_index: #@start_index\"\n max = @start_index - 1\n @start_index = [(max + 1 - @limit), 1].max\n log \"New start_index: #@start_index\"\n fetch_ids = search_query? ? @ids[@start_index..max] : (@start_index..max).to_a\n log fetch_ids.inspect\n message_ids = fetch_and_cache_headers(fetch_ids)\n res = get_message_headers message_ids\n with_more_message_line(res)\n end",
"def more_songs\n get_songs\n return @page_size && @songs.count == @page_size\n end",
"def fetch_search_results\n response = twitter_account.client.search(query, search_options)\n statuses = response.statuses\n tweets = TweetMaker.many_from_twitter(statuses, project: project, twitter_account: twitter_account, state: state)\n update_max_twitter_id(tweets.map(&:twitter_id).max)\n tweets\n # If there's an error, just skip execution\n rescue Twitter::Error\n false\n end",
"def get_more\n @category = params[:category]\n\n # Query new objects\n if params[:category] == 'music'\n if $loaded[:music]>0\n loaded = $loaded[:music]\n else\n loaded = 4\n end\n @songs = Music.where(user_id: get_current_user.id).offset(loaded).limit(4)\n if((Music.where(user_id: get_current_user.id).offset(loaded).count - @songs.count) > 0)\n @hasMore = true\n $loaded[:music] = loaded + @songs.count\n else\n @hasMore = false\n $loaded[:music] = 0\n end\n elsif params[:category]=='movies'\n if $loaded[:movies]>0\n loaded = $loaded[:movies]\n else\n loaded = 4\n end\n @movies = Movie.where(user_id: get_current_user.id).offset(loaded).limit(4)\n if((Movie.where(user_id: get_current_user.id).offset(loaded).count - @movies.count) > 0)\n @hasMore = true\n $loaded[:movies] = loaded + @movies.count\n else\n @hasMore = false\n $loaded[:movies] = 0\n end\n elsif params[:category]=='games'\n if $loaded[:games]>0\n loaded = $loaded[:games]\n else\n loaded = 4\n end\n @games = Game.where(user_id: get_current_user.id).offset(loaded).limit(4)\n if((Game.where(user_id: get_current_user.id).offset(loaded).count - @games.count) > 0)\n @hasMore = true\n $loaded[:games] = loaded + @games.count\n else\n @hasMore = false\n $loaded[:games] = 0\n end\n elsif params[:category]=='documents'\n if $loaded[:documents]>0\n loaded = $loaded[:documents]\n else\n loaded = 4\n end\n @documents = Document.where(user_id: get_current_user.id).offset(loaded).limit(4)\n if((Document.where(user_id: get_current_user.id).offset(loaded).count - @documents.count) > 0)\n @hasMore = true\n $loaded[:documents] = loaded + @documents.count\n else\n @hasMore = false\n $loaded[:documents] = 0\n end\n else \n end\n end",
"def next_result\n return false unless more_results\n check_connection\n @fields = nil\n nfields = @protocol.get_result\n if nfields\n @fields = @protocol.retr_fields nfields\n @result_exist = true\n end\n return true\n end",
"def after_pagination\n end",
"def next_search_result_page(params = {}, opts = {})\n return self.class.empty_search_result(opts) unless has_more\n\n params = filters.merge(page: next_page).merge(params)\n\n _search(url, params, opts)\n end",
"def length; return @results.length; end",
"def refresh_execution_results\n if (@query.last_execution)\n @incomplete_results = @query.last_execution.unfinished_results.count > 0\n @incomplete_results ||= @query.last_execution.results.where(aggregated: false).count > 0\n else\n @incomplete_results = false\n end\n @query.reload\n respond_to do |format|\n format.js { render :layout => false }\n end\n end",
"def each\n response = run\n\n entities = @collection.deserialize(response.entities)\n entities.each { |x| yield(x) }\n\n while continue?(response)\n response.entities = []\n\n @options[:exclusive_start_key] = response.last_evaluated_key\n response = run(response)\n\n entities = @collection.deserialize(response.entities)\n entities.each { |x| yield(x) }\n end\n\n response.count\n end",
"def fetch_billing_results\n previous_response = nil\n begin\n page = get_page_number\n\n response = Select.fetch_billing_results(@start_timestamp, @end_timestamp,\n page, @page_size)\n unless !response.is_a?(Array)\n process_response(response)\n previous_response = response\n end\n end until !response.is_a?(Array)\n reset_page_number\n\n set_empty_last_fetch_soap_id(response, previous_response)\n end",
"def nextResult\n result = nil\n @mutex.synchronize do\n result = @results.shift\n @progressMutex.synchronize{ @requestProgress.delete result.requestId } if result\n end\n result\n end",
"def next\n perform_request(next_page_uri) if next?\n end",
"def next_self(res)\r\n self.video_set = res.video_set\r\n self.channel_set = res.channel_set\r\n self.category_set = res.category_set\r\n self.tag_set = res.tag_set\r\n self.user_set = res.user_set\r\n\r\n self.query_suggestion = res.query_suggestion\r\n self.total_results_available = res.total_results_available\r\n self.total_results_returned = res.total_results_returned\r\n self.first_result_position = res.first_result_position\r\n self.rss_url = res.rss_url\r\n self.video_set_title = res.video_set_title\r\n\r\n self.channel_results_returned = res.channel_results_returned\r\n self.category_results_returned = res.category_results_returned\r\n self.tag_results_returned = res.tag_results_returned\r\n self.user_results_returned = res.user_results_returned\r\n\r\n self.sphinxquery = res.sphinxquery\r\n self.sphinxfilters = res.sphinxfilters\r\n end",
"def current_results_first\n offset + 1\n end",
"def end_paginate! results\n # set the link headers\n link = \"\"\n link += \"<#{@next_page}>; rel=\\\"next\\\"\" unless results.empty? or results.count < @limit\n headers['X-Next-Page'] = @next_page unless results.empty? or results.count < @limit\n if not results.empty? and @page > 1\n link += \", \"\n end\n link += \"<#{@prev_page}>; rel=\\\"prev\\\"\" unless @page == 1\n headers['X-Prev-Page'] = @prev_page unless @page == 1\n headers['Link'] = link\n headers['X-Total-Count'] = @count.to_s\n end",
"def fetch_all(qps=DEFAULT_QUERIES_PER_SECOND)\n response = execute\n items = response['items']\n\n while response['current_page'] < response['total_pages']\n self.page = response['current_page'] + 1\n response = execute\n items = items + response['items']\n \n sleep(1.0/DEFAULT_QUERIES_PER_SECOND)\n end\n\n return items\n end",
"def results; end",
"def results; end",
"def results; end",
"def refresh\n return data.length if data.length > 0\n if next_page\n @doc = get next_page\n elsif last_page?\n return 0\n else\n @doc = get(collection, params={:count => per_page, :start => start}.update(@opts['extra_args']))\n end\n return data.length\n end",
"def next_page\n if next_page?\n @query[:startPage] += 1\n fetch\n end\n end",
"def search()\n @query_status = Query.for_queue(@queue)\n unless @query && @query_status\n return\n end\n\n total = 0\n results = []\n page = 1\n\n @last_twid = @query_status.last_twid\n\n loop do\n # App.log.info(\"last_twid: \" + @last_twid.to_s)\n results = fetch_page(page).select{|result| result.id.to_i > @last_twid }\n results.each{|result| add_to_queue(result)}\n total += results.size\n # unless results.size > 0\n update_query_status(total)\n break\n # end\n # page += 1\n end \n end",
"def total_results\n numberOfRecords\n end",
"def total_results\n numberOfRecords\n end",
"def needs_another_request? more_pages, remaining\n update_requests_remaining(remaining)\n more_pages\n end",
"def distribute_results!\n response = JSON.parse(@socket.readline)\n\n if response[\"event\"]\n @event_queue << response\n else\n @result_queue << response\n end\n rescue StandardError\n @alive = false\n Thread.exit\n end",
"def populate_results(json)\n # page = json[\"page\"]\n # results = json[\"results\"].map{|r| SearchResult.new(r)}\n # start = (page - 1) * 10\n # @results[start, results.length] = results\n @results = json[\"results\"].map{|r| SearchResult.new(r)}\n end",
"def get_more\n @options = { :includeFirst => false , :limit => 5, :persona => 0..Persona.last.id , \n :featured => [true,false], :viewType => 'normal' }\n \n @options[:includeFirst] = params[:includeFirst] == 'true' ? true : false \n\n if params.has_key? :persona then\n @options[:persona] = params[:persona].to_i\n end\n\n if params.has_key? :limit then\n @options[:limit] = params[:limit].to_i\n end\n\n if params.has_key? :featured then\n if params[:featured] == 'true' then\n @options[:featured] = true\n elsif params[:featured] == 'false' then\n @options[:featured] = false\n end\n end\n\n if params.has_key? :viewType then\n if params[:viewType] == 'tracked' then\n @options[:viewType] = params[:viewType]\n @tracked_persona = current_persona.followers.where(:tracked_object_type => 'persona')\n elsif params[:viewType] == 'trending' then\n @options[:viewType] = params[:viewType]\n end\n end\n\n if @options[:viewType] == 'trending' then\n upper = @options[:includeFirst] ? params[:last_id].to_i : params[:last_id].to_i + 1\n else\n upper = @options[:includeFirst] ? params[:last_id].to_i : params[:last_id].to_i - 1\n end\n\n if @options[:viewType] == 'trending' then\n puts 'getting trendy'\n @next_mediasets = Mediaset.joins{ votings }.order(\" votings.created_at desc\").\n limit(@options[:limit]).offset(params[:last_id]).select('mediasets.*, votings.created_at').uniq\n elsif @options[:viewType] == 'normal' then \n @next_mediasets = Mediaset.find(:all, :conditions => { \n :id => 0..upper, :persona_id => @options[:persona], :featured => @options[:featured], :system_visible => true }, \n :limit => @options[:limit], :order => 'id desc' )\n elsif @options[:viewType] == 'tracked' then\n @next_mediasets = Mediaset.find(:all, :conditions => { \n :id => 0..upper, :persona_id => @tracked_persona.pluck(:tracked_object_id), :system_visible => true,\n :featured => @options[:featured] }, \n :limit => @options[:limit], :order => 'id desc' )\n end\n\n respond_to do |format|\n format.js\n format.html\n end\n end",
"def fully_fetched\n true\n end",
"def get_more\n @options = {\n :includeFirst => false, :limit => 10, :fetch_mode => 'normal', :fetch_focus_id => 0,\n :handle => \".endless_scroll_inner_wrap\" \n }\n\n if params.has_key? :includeFirst then\n @options[:includeFirst] = params[:includeFirst] == 'true' ? true : false \n end\n\n if params.has_key? :fetch_mode then\n if params[:fetch_mode] == 'following' then\n @options[:fetch_mode] = 'following'\n elsif params[:fetch_mode] == 'followers' then\n @options[:fetch_mode] = 'followers'\n end\n end\n\n if params.has_key? :fetch_focus_id then\n @options[:fetch_focus_id] = params[:fetch_focus_id].to_i\n end\n\n if params.has_key? :handle then\n @options[:handle] = params[:handle]\n end\n\n upper = @options[:includeFirst] ? 0..params[:last_id].to_i : 0..(params[:last_id].to_i - 1)\n\n if @options[:fetch_mode] == 'normal' then\n @next_personas = Persona.where( :id => upper).order('id desc').limit(@options[:limit])\n elsif @options[:fetch_mode] == 'following' then\n persona = Persona.find(@options[:fetch_focus_id])\n @next_personas = Persona.where(\n :id => persona.followers.where(:tracked_object_type => 'persona', \n :tracked_object_id => upper ).pluck(:tracked_object_id) \n ).order('id desc').limit(@options[:limit])\n elsif @options[:fetch_mode] == 'followers' then\n persona = Persona.find(@options[:fetch_focus_id])\n @next_personas = Persona.where(:id => Follower.where(\n :tracked_object_id => persona.id, :tracked_object_type => 'persona').pluck(:persona_id)\n ).order('id desc').group(:id).having(:id => upper)\n end\n end",
"def hasResults?\n ! @results.empty?\n end",
"def read_more( connection ); end",
"def discard_results; end",
"def run\n self.prominence!\n return self.send_results if @query.any?\n\n self.fuzzy_match\n self.apply_narrowing_filters\n self.apply_limit\n self.load_and_sort_by_matches\n self.send_results\n end",
"def selected_results\n \t\n \t@contacts = session[SELECTED_CONTACTS]\n\t\n \tpaginated_selected_results\n\t\n\trender :layout => false\n end",
"def landing_page\n @products = Product.limit(3) \n end",
"def results_with_rows\n load_from_rows(@dataset.all, true)\n end",
"def paginate_all_data(url:, more_params: nil)\n query_params = \"since=#{@start_date}&until=#{@end_date}#{more_params ? \"&#{more_params}\" : ''}\"\n total_count = parse_json_from_api(\"#{url}?#{query_params}\")['page']['total_elements']\n puts \"[#{Time.new.strftime('%k:%M')}] total count for #{url}?#{query_params}: #{total_count}\"\n idx = 0\n result = []\n while idx * PER_PAGE < total_count\n result += parse_json_from_api(\"#{url}?page=#{idx}&per_page=#{PER_PAGE}&#{query_params}\")['data']\n idx += 1\n end\n puts \"[#{Time.new.strftime('%k:%M')}] ERROR: result.length #{result.length} != total_count #{total_count}\" if result.length != total_count\n result\nrescue MyApiError\n []\nend",
"def total_results\n totalItems\n end",
"def each_row(q, options = {}, &block)\n current_row = 0\n # repeatedly fetch results, starting from current_row\n # invoke the block on each one, then grab next page if there is one\n # it'll terminate when res has no 'rows' key or when we've done enough rows\n # perform query...\n res = query(q, options)\n job_id = res['jobReference']['jobId']\n # call the block on the first page of results\n if( res && res['rows'] )\n res['rows'].each(&block)\n current_row += res['rows'].size\n end\n # keep grabbing pages from the API and calling the block on each row\n while( current_row < res['totalRows'].to_i && ( res = get_query_results(job_id, :startIndex => current_row) ) && res['rows'] ) do\n res['rows'].each(&block)\n current_row += res['rows'].size\n end\n end",
"def get_max_results\n @max_results\n end",
"def pagination_needed?\n # Using #to_a stops active record trying to be clever\n # by converting queries to select count(*)s which then need to be repeated.\n @pagination_needed ||= primary_records.to_a.size > API_PAGE_SIZE\n end",
"def next\n return nil unless next?\n return nil if end_cursor.nil?\n ensure_service!\n query.start_cursor = cursor.to_grpc # should always be a Cursor...\n query.offset = 0 # Never carry an offset across batches\n unless query.limit.nil?\n # Reduce the limit by the number of entities returned in the current batch\n query.limit.value -= count\n end\n query_res = service.run_query query, namespace, read_time: read_time\n self.class.from_grpc query_res, service, namespace, query, read_time\n end",
"def fetch_more\n $limit += 5\n $offset_counter = ($offset_counter >= 5? $offset_counter - 5: 0)\n @room_messages = (@room.room_messages.includes(:user).order(:id).limit($limit).offset($offset_counter)).to_a.reverse()\n end",
"def index_new\n @items = Item.includes([:user, :loan, :borrower]).all.order(updated_at: :desc)\n # @items = Item.most_hit\n @items = @items.select { |item| privilege(item.user_id) }\n @items = Kaminari.paginate_array(@items)\n\n #paginating in either case, uses params[:page] if present otherwise uses page 1 of results.\n #option to change the numOfresults shown perpage also available \n @items = @items.page(page).per(per_page)\n @per_page = per_page.to_i\n render :index\n end",
"def execute(con, table, country)\n offset = 0\n total_results = nil\n begin\n res_xml = get_product_feed(country, offset)\n if total_results.nil?\n total_results = res_xml.at_xpath('//Paging/TotalResults').text.to_i\n end\n import(con, table, res_xml)\n offset = offset + 100\n end while offset<=total_results\n end",
"def get_all_results\n\t\tresult_array = []\n\t\tskip = 0\n\t\ttake = 1000\n\t\tloop do\n\t\t\tcurrent_result = get_data_from_result(execute_request(take, skip)[1])\n\t\t\tresult_array.concat(current_result)\n\t\t\tskip = skip + take\n\t\t\tbreak if current_result.size != take\n\t\tend\n\t\treturn result_array\n\tend",
"def results\n with_monitoring do\n response = perform(:get, results_url, query_params)\n Search::ResultsResponse.from(response)\n end\n rescue => e\n handle_error(e)\n end",
"def handle_results(results:)\n if results.empty?\n puts \"No results for: \\\"#{@query}\\\"\".bold.red\n else\n results.each do |key, result|\n puts \"\\n\\\"#{@query}\\\", found in: \\\"#{key}\\\"\".bold.green\n ap result\n end\n end\n end",
"def reset_results\n @loaded = false\n @results = ResultSet.new\n @solr_response = nil\n end",
"def paginated_selected_results\n \tif ! @contacts.blank?\n\t number_of_contacts_per_page = 25\n\t @selected_contacts_pages = Paginator.new self, @contacts.length, number_of_contacts_per_page, params[:page]\n\t from = @selected_contacts_pages.current.offset.to_i\n\t to = (from + @selected_contacts_pages.items_per_page.to_i) - 1\n\t \n\t @selected_contacts = @contacts[from..to] unless @contacts.blank?\n\tend\t\n end"
] | [
"0.6856364",
"0.6659899",
"0.6610145",
"0.65927607",
"0.64521414",
"0.6300242",
"0.62713784",
"0.6229127",
"0.6226629",
"0.6225181",
"0.6166342",
"0.6166259",
"0.61467385",
"0.613649",
"0.6115628",
"0.609281",
"0.6053826",
"0.60190403",
"0.59856635",
"0.59817326",
"0.5966061",
"0.59343565",
"0.59097517",
"0.58919734",
"0.58891577",
"0.5878723",
"0.5872008",
"0.58707905",
"0.5864651",
"0.5864144",
"0.5853997",
"0.58474624",
"0.5808276",
"0.57848275",
"0.5776647",
"0.57673407",
"0.57584405",
"0.5752694",
"0.5748674",
"0.5740636",
"0.5731348",
"0.57106143",
"0.5701021",
"0.5696537",
"0.56961584",
"0.56874186",
"0.5680553",
"0.5672409",
"0.5671313",
"0.5654048",
"0.5651288",
"0.5625635",
"0.5624434",
"0.5622678",
"0.56216043",
"0.5599993",
"0.559721",
"0.55899405",
"0.5582912",
"0.5579324",
"0.5576183",
"0.55757433",
"0.5567771",
"0.5567354",
"0.5562452",
"0.5561299",
"0.5553688",
"0.5553688",
"0.5553688",
"0.55377245",
"0.5530631",
"0.5527245",
"0.55202264",
"0.55202264",
"0.5516869",
"0.55069417",
"0.55021536",
"0.54943746",
"0.54860884",
"0.54850036",
"0.54742765",
"0.5472223",
"0.5468843",
"0.5467395",
"0.546428",
"0.54623085",
"0.54578584",
"0.54566276",
"0.5439239",
"0.543166",
"0.54313475",
"0.5430571",
"0.541873",
"0.5415577",
"0.5404934",
"0.54019374",
"0.5387214",
"0.5385341",
"0.53828746",
"0.5380339",
"0.5379968"
] | 0.0 | -1 |
Whether to show unread notifications first (only used if groupbysection is not set). | def unreadfirst()
merge(notunreadfirst: 'true')
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def alertunreadfirst()\n merge(notalertunreadfirst: 'true')\n end",
"def messageunreadfirst()\n merge(notmessageunreadfirst: 'true')\n end",
"def unread_unsent_notifications_for_group\n @unread_unsent_notifications_for_group ||= unread_unsent_notifications.where('notify_user_notifications.group_id = ?', notification.group_id)\n end",
"def first_unread_message\n gmail.inbox.find(:unread).find do |email|\n email.to[0].mailbox.include? 'performance_group'\n end\n end",
"def unread_by(user)\n self.includes(:chat_participations, :messages).where([\n \"(chat_participations.read_at < messages.created_at OR chat_participations.read_at IS NULL)\\\n AND chat_participations.user_id = :user_id AND messages.user_id <> :user_id\",\n {user_id: user.id}]).order(\"messages.created_at DESC\")\n end",
"def unread\n @notifications = Notification.where(user_id: current_user.uid).where(is_read: false).page(params[:page]).order(created_at: :desc)\n end",
"def sort_unpinned\n if @guardian.current_user && @all_topics.present?\n @categories.each do |c|\n next if c.displayable_topics.blank? || c.displayable_topics.size <= c.num_featured_topics\n unpinned = []\n c.displayable_topics.each do |t|\n unpinned << t if t.pinned_at && PinnedCheck.unpinned?(t, t.user_data)\n end\n unless unpinned.empty?\n c.displayable_topics = (c.displayable_topics - unpinned) + unpinned\n end\n end\n end\n end",
"def groupbysection()\n merge(notgroupbysection: 'true')\n end",
"def unread_notifications\n notifications_received.where('activities.created_at > ?', notifications_checked_at)\n end",
"def unread?\n read_at.nil?\n end",
"def set_unread\n render :text => \"\", :layout => false\n end",
"def load_notifications\n \t\tif current_user\n \t\t\t@notifications = current_user.notifications.limit 5\n \t\t\t@unseen_notifications_count = current_user.notifications.unseen.count\n \t\tend\n \tend",
"def unread_notifications_since_last_read\n notification.class.for_target(notification.target)\n .where(group_id: notification.group_id)\n .where(read_at: nil)\n .where('notify_user_notifications.created_at >= ?', last_read_notification.try(:read_at) || 24.hours.ago)\n .where.not(id: notification.id)\n .order(created_at: :desc)\n end",
"def retrieve_notifications\n\tunread = self.notifications.where(\"read = ?\", false).order(\"created_at DESC\")\n\t\n\tif unread.count < 10\n\t\tread = self.notifications.where(\"read = ?\", true).order(\"created_at DESC\").limit(10 - unread.count)\n\t\t\n\t\tunread = unread.concat(read)\n\tend\n\t\n\treturn unread\n end",
"def unread_items (options = {})\n order = options[:order] || :hottest\n raise \"Invalid ordering '#{order.to_s}' on unread items\" if !SORTING_STRATEGIES.key?(order)\n items.sort_by { |i| SORTING_STRATEGIES[order].call(i, self) }\n end",
"def unread_discussions\n discussions.find_unread_by(self)\n end",
"def is_unread?\n !is_read\n end",
"def is_unread?\n !is_read\n end",
"def is_unread?\n !is_read\n end",
"def unread_unsent_notifications\n @unread_unsent_notifications ||= notification.class.for_target(notification.target)\n .joins(:deliveries)\n .where.not(id: notification.id)\n .where('notify_user_notifications.read_at IS NULL AND notify_user_deliveries.sent_at IS NULL')\n end",
"def unread\n @notifications = current_user.notifications.unread.page(params[:page]).per(5)\n end",
"def unread_by?(user)\n received_message.try(:unread?) || replies.map { |r|\n r.received_message if r.recipient == user\n }.compact.any?(&:unread?)\n end",
"def unread_conversations\n my_conversations.joins(:messages).where('messages.created_at > COALESCE(conversation_members.last_seen, conversation_members.created_at)').uniq\n end",
"def load_unread_comments\n @unread_comments = Comment.unread_by(current_user)\n if current_user.student?\n @unread_comments = @unread_comments.select do |comment| \n comment_parent = comment.commentable_type.classify.constantize.find(comment.commentable_id)\n comment_parent_type = comment.commentable_type.underscore\n if comment_parent_type == \"school_day\"\n comment_parent.calendar_date <= Date.today\n else\n comment_parent.school_days.order(\"calendar_date\")[0].calendar_date <= Date.today if !comment_parent.school_days.empty?\n end\n end\n end\n @unread_comments.sort_by!(&:created_at).reverse!\n end",
"def topics_unread_comments(group_id, viewed = 0, page = 1, sort = 'updated_at', order = 'a')\n\t\t\tif ['comments_count', 'title', 'updated_at', 'views'].include?(sort) && ['a', 'd'].include?(order)\n\t\t\t\toptions = {\"viewed\" => viewed, \"page\" => page, \"sort\" => sort, \"order\" => order}\n\t\t\telse\n\t\t\t\tputs \"NOTICE: invalid sorting parameters entered. reverting to defults.\"\n\t\t\t\toptions = {\"viewed\" => viewed, \"page\" => page}\n\t\t\tend\n\t\t\tdata = oauth_request(\"/topic/unread_group/#{group_id}\", options)\n\t\t\tHashie::Mash.new(data)\n\t\tend",
"def unread\n all(UNREAD)\n end",
"def unread?\n self.status == 'unread'\n end",
"def notify_daily_summary\n settings.fetch('notifications',{}).fetch('daily_summary', true)\n end",
"def unread?\n return (self.status == Email::STATUS_UNREAD)\n end",
"def any_unread? usr\n ConversationProcessor.new(self).any_unread? usr\n end",
"def unread?\n !read?\n end",
"def notifications_count\n notifications_count ||= self.notifications_to_show_user.where(:seen_by_user => false).count\n end",
"def unread?\n !read?\n end",
"def load_notifications\n # reload user data\n user = User.find current_user.id\n @notifications = user.notifications.order(\"updated_at DESC\")\n\n new_feeds = user.notification_readers.select {|feed| !feed.isRead?}\n new_feeds.each do |feed|\n feed.read_at = Time.zone.now\n feed.save!\n end\n end",
"def index\n @all_notifications = Notification.order(from_type: \"asc\", readed: \"asc\")\n end",
"def unread? user_id\n !unread_messages(user_id).blank?\n end",
"def load_notifications\n if user_signed_in?\n @all_notifications = current_user.get_notifications\n @notifications = @all_notifications.first(10)\n @count = current_user.unread_notifications_count\n end\n end",
"def fetch_unread_items(folder)\n item_view = ItemView.new(10) # FIXME: some huge number like 5000, but the JS app is too slow for that\n item_view.property_set = EMAIL_SUMMARY_PROPERTY_SET\n folder.find_items(SearchFilter::IsEqualTo.new(EmailMessageSchema::IsRead, false), item_view).items.to_a\n end",
"def unread?\n (status == UNREAD)\n end",
"def unread?\n !read?\nend",
"def notifications(options = {})\n #:type => nil is a hack not to give Messages as Notifications\n notifs = Mailboxer::Notification.recipient(messageable).where(:type => nil).order(\"mailboxer_notifications.created_at DESC\")\n if options[:read] == false || options[:unread]\n notifs = notifs.unread\n end\n\n notifs\n end",
"def load_all_unread\n @all_unread = []\n material_type_list.each do |material_hash|\n material_type = material_hash[:name]\n if material_type != \"school_day\"\n unread_materials = material_type.classify.constantize.unread_by(current_user)\n if current_user.admin?\n filtered_unread_materials = unread_materials\n else\n filtered_unread_materials = unread_materials.select do |material| \n !material.school_days.empty? && !material.school_days.nil? && material.school_days.order(\"calendar_date\")[0].calendar_date <= Date.today\n end\n end\n @all_unread += filtered_unread_materials\n end\n end\n @all_unread.sort_by!(&:updated_at).reverse!\n end",
"def get_notifications\n \t\n \t@notifs = []\n\n \tif current_user\n @notifs = Notification.where(:user_id => current_user.id, :seen => false)\n \tend\n end",
"def index\n @notifications = Notification.where(user_id: current_user.uid).page(params[:page]).order(created_at: :desc)\n # @notifications = Notification.all\n @notifications_sort = {}\n @notifications.each do |n|\n date = n.created_at.strftime('%Y-%m-%d')\n if @notifications_sort[date].nil?\n @notifications_sort[date] = []\n end\n @notifications_sort[date] << n\n end\n end",
"def unread\n un_read(false, \"non lue\")\n end",
"def seen\n if @ok\n @ok = @notification.has_been_seen\n end\n @new_notifications = current_user.number_notifications_not_seen\n end",
"def mark_unread!\n update_is_read_status false\n end",
"def status_sort\n user_id_giver and user_id_receiver ? 1 : 2\n end",
"def mark_notifications_read\n return if params[:notification_id].blank? or !user_signed_in?\n n = Notification.find(params[:notification_id])\n current_subject.mark_as_read n\n end",
"def arrange_single_notification_index(loading_index_method, options = {})\n as_latest_group_member = options[:as_latest_group_member] || false\n as_latest_group_member ?\n loading_index_method.call(options).map{ |n| n.latest_group_member } :\n loading_index_method.call(options).to_a\n end",
"def index\n @notifications = current_user.notifications.unread.page(params[:page]).per(20)\n end",
"def notifications(options = {})\n scope = MessageCenter::Notification.recipient(messageable).order(:created_at => :desc)\n if options[:read] == false || options[:unread]\n scope = scope.unread\n end\n\n scope\n end",
"def inbox\n user_sent = Message.where(user_id: current_user, group_id: nil, show_user: true)\n user_received = Message.where(recipient_id: current_user, show_recipient: true)\n @messages = (user_sent + user_received).sort{|a,b| a.created_at <=> b.created_at }\n end",
"def only_show_summary?\n\t\tcount = 0\t\n\t\t[\"payable_from_organization_id\",\"payable_to_organization_id\",\"payable_from_patient_id\"].each do |k|\n\t\t\tcount+=1 unless self.send(k.to_sym).blank?\n\t\tend\n\t\tcount <= 1\n\tend",
"def toponly()\n merge(grctoponly: 'true')\n end",
"def group_notifications\n @attributes[:group_notifications]\n end",
"def mark_all_readed\n doctor.notifications.update_all unreaded: false\n send_json doctor.notifications, true\n end",
"def is_unread?(participant)\n return false if participant.nil?\n !receipt_for(participant).first.is_read\n end",
"def any_unread? usr\n @conv.posts.each do |post| \n if post.unread?(usr) && post.recipient_id == usr.id\n return true\n end\n end\n return false\n end",
"def display_notif_unseen(usr_id)\n num = PublicActivity::Activity.where(is_seen: false, owner_id: usr_id, owner_type: \"User\").count\n return num if num > 0\n return \"\" # Else return blank string\n end",
"def notification_groups_mark_all_as_read(opts = {})\n data, _status_code, _headers = notification_groups_mark_all_as_read_with_http_info(opts)\n data\n end",
"def sectionless_groupings\n groupings.select do |grouping|\n grouping.inviter.present? &&\n !grouping.inviter.has_section?\n end\n end",
"def has_notify?(forum)\n current_forum = Forum.find(forum)\n if current_forum.messages.count > this.current_length\n this.display = true\n end\n end",
"def index\n\t\t@notifications = Notification.where(recipient_id: current_user.id).unread\n\tend",
"def mark_as_unread()\n update_attribute('read', false)\n end",
"def multi_message?\n return notify_on == \"always\"\n end",
"def unread\n read_attribute(:unread)\n end",
"def index\n @users = User.all.order(already_notified: :asc)\n end",
"def responding_messages_delivery_with_no_responses(channel = nil, channel_group = nil)\n delivery_notices = DeliveryNotice.includes(:message)\n delivery_notices = delivery_notices.where(channel: channel) if channel\n delivery_notices = delivery_notices.where(channel_group: channel_group) if channel_group\n delivery_notices.where(subscriber_id: potential_subscriber_ids)\n .where(tparty_identifier: to_phone)\n .where(\"messages.type\" => Message.responding_message_types)\n .order(:created_at)\n .select { |dn|\n last_sr = dn.message.subscriber_responses.order(:created_at).last\n last_sr.nil? || last_sr.created_at < dn.created_at\n }\n end",
"def unread_topics user\r\n topics.find_all{|topic| topic.unread_comment?(user) }\r\n end",
"def get_notices\n @Noticias = Notice.all(:conditions => ['published = 1'], :order => \"id desc\", :limit => \"6\")\n end",
"def non_archived_notes\n notes.select { |n| n.archived.blank? }.sort_by!(&:created_at)\n end",
"def unread_tasks\n notifications = current_user.notifications.unread\n notifications += current_user.task_owners.unread\n \n tasks = notifications.map { |n| n.task }\n tasks = tasks.uniq\n # only get open / in progress tasks\n tasks = tasks.select { |t| (t.status == 0 or t.status == 1) }\n\n return tasks\n end",
"def unread_messages\n @user_wise_unread_messages = current_user.user_messages\n .where(is_read: false)\n .joins(:message)\n .group('messages.user_id').count\n end",
"def has_unread?\n Message.any_in(conversation_id: conversations.map(&:id)).ne(read_by: id).present?\n end",
"def toponly()\n merge(uctoponly: 'true')\n end",
"def has_unread_messages?(user)\n latest_message = self.last_message\n if latest_message\n chat_participation = self.chat_participations.where(user_id: user.id).first\n chat_participation.try(:unread_message?, latest_message)\n end\n end",
"def next_notification\n result = user.notifications.where(\"id > #{id} AND viewed IS FALSE\")\n if result.blank?\n return false\n else\n return result[0]\n end\n end",
"def show\n # Title of the webpage\n @title = 'Notifications'\n\n # Getting all of the user's notifications, then those that are unread\n @all_notifications = Notification.where([\"user_id = :id\", { id: current_user.id }]).order(created_at: :desc)\n @notification_content = {}\n @unread_notification_ids = []\n\n @all_notifications.each do |notification|\n if notification.unread?\n # Mark all of the unread notifications as read, since they have now been opened\n @unread_notification_ids << notification.id\n notification.unread = false\n notification.save\n end\n\n # Get the pieces of the body of the notification\n if notification.body\n @notification_content[notification.id] = notification.body.split(/\\n/)\n end\n\n end\n\n # Clear the number of unread notifications for the user\n current_user.update_attribute(:unread_notifications, 0)\n end",
"def unopened_group_member_notifier_count\n group_members.unopened_only\n .filtered_by_association_type(\"notifier\", notifier)\n .where(\"notifier_key.ne\": notifier_key)\n .to_a\n .collect {|n| n.notifier_key }.compact.uniq\n .length\n end",
"def read?(_user_id)\n conversation.conversation_members.where(user_id: _user_id).take.last_seen > created_at\n end",
"def may_read_group_announcements?(group)\n\t\t\tmay_administrate? || is_group_reader?(group)\n\t\tend",
"def show_section_appraisal_moderated?\n subject.lead?(record) ||\n (\n record.assessor_assignments.moderated.submitted? &&\n (\n subject.primary?(record) ||\n (assessor? && record.from_previous_years?)\n )\n )\n end",
"def mark_as_unread(participant)\n return if participant.nil?\n return self.receipts_for(participant).mark_as_unread\n end",
"def prev_notification\n result = user.notifications.where(\"id < #{id} AND viewed IS FALSE\")\n if result.blank?\n return false\n else\n return result[0]\n end\n end",
"def call\n all_private_conversations = Private::Conversation.all_by_user(@user.id)\n .includes(:messages)\n all_group_conversations = @user.group_conversations.includes(:messages)\n all_conversations = all_private_conversations + all_group_conversations\n\n ##filtered_conversations = []\n\n ##all_conversations.each do |conv|\n ## empty_conversations << conv if conv.messages.last\n ##end\n\n ##filtered_conversations = filtered_conversations.sort{ |a, b|\n ## b.messages.last.created_at <=> a.messages.last.created_at\n ##}\n\n return all_conversations\n end",
"def show_not_completed_by_date_first\n @not_done_date = not_complete_by_date\n @not_done = show_not_completed_items\n return @not_done_date + @not_done\n end",
"def mark_read_messages(conversation)\n time = Time.current\n conversation = Conversation.find(conversation) if conversation.is_a?(Integer)\n conversation_members.where(conversation_id: conversation).update_all(last_seen: time)\n Rails.cache.delete(conversation.get_unread_cache_key_for(id))\n Rails.cache.delete(\"user-unread_messages_count-#{id}\")\n PubSub::Publisher.new.publish_for(conversation.user_participants.where.not(id: id), 'read_messages', {id: conversation.id, seen_at: time.to_i, user_id: id}, {foreground: true})\n end",
"def is_unread?(participant)\n return false if participant.nil?\n return self.receipts_for(participant).not_trash.is_unread.count!=0\n end",
"def mark_all_entries_as_unread_groups(group_id,topic_id,opts={})\n query_param_keys = [\n :forced_read_state\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 \"topic_id is required\" if topic_id.nil?\n # set default values and merge with input\n options = underscored_merge_opts(opts,\n :group_id => group_id,\n :topic_id => topic_id\n )\n\n # resource path\n path = path_replace(\"/v1/groups/{group_id}/discussion_topics/{topic_id}/read_all\",\n :group_id => group_id,\n :topic_id => topic_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(:delete, path)\n query_params.merge! pagination_params if pagination_params\n end\n response = mixed_request(:delete, path, query_params, form_params, headers)\n page_params_store(:delete, path)\n response\n \n end",
"def is_there_notification\n current_user.notifications\n end",
"def mark_as_unread\n @client.post('/api/mod/conversations/unread', conversationIds: [get_attribute(:id)])\n end",
"def unopened_group_member_notifier_count\n # Cache group by query result to avoid N+1 call\n unopened_group_member_notifier_counts = target.notifications\n .unopened_index_group_members_only\n .includes(:group_owner)\n .where(\"group_owners_#{self.class.table_name}.notifier_type = #{self.class.table_name}.notifier_type\")\n .where.not(\"group_owners_#{self.class.table_name}.notifier_id = #{self.class.table_name}.notifier_id\")\n .references(:group_owner)\n .group(:group_owner_id, :notifier_type)\n .count(\"distinct #{self.class.table_name}.notifier_id\")\n unopened_group_member_notifier_counts[[id, notifier_type]] || 0\n end",
"def all_notifications(options = {})\n reverse = options[:reverse] || false\n with_group_members = options[:with_group_members] || false\n as_latest_group_member = options[:as_latest_group_member] || false\n target_notifications = Notification.filtered_by_target_type(self.name)\n .all_index!(reverse, with_group_members)\n .filtered_by_options(options)\n .with_target\n case options[:filtered_by_status]\n when :opened, 'opened'\n target_notifications = target_notifications.opened_only!\n when :unopened, 'unopened'\n target_notifications = target_notifications.unopened_only\n end\n target_notifications = target_notifications.limit(options[:limit]) if options[:limit].present?\n as_latest_group_member ?\n target_notifications.latest_order!(reverse).map{ |n| n.latest_group_member } :\n target_notifications.latest_order!(reverse).to_a\n end",
"def mark_notifications_as_read(options = {})\n boolean_from_response :put, 'notifications', options\n end",
"def default_sort_hint_for_task(task)\n if task.unread?(current_user)\n return 10\n elsif task.linked_users.empty?\n return 9\n elsif task.linked_users.include?(current_user)\n return 8\n else\n return 1\n end\n end",
"def set_unread_message_count\n self.unread_messages = 1\n end",
"def mark_all_as_read\n @notifications = Notification.unread.for_user(current_api_v1_user)\n @notifications.update_all(read_at: Time.now) unless @notifications.blank?\n @notifications = Notification.where(recipient_id: current_api_v1_user.id)\n \n render json: @notifications\n end",
"def is_unread?(participant)\n return false unless participant\n receipts_for(participant).not_trash.is_unread.count != 0\n end",
"def mark_as_unread(participant)\n return if participant.nil?\n receipt_for(participant).mark_as_unread\n end"
] | [
"0.66753554",
"0.6600046",
"0.59955627",
"0.5908684",
"0.5637081",
"0.56228733",
"0.5591421",
"0.54860646",
"0.54667956",
"0.5426075",
"0.53889394",
"0.5369551",
"0.5282837",
"0.5277263",
"0.52666",
"0.52404803",
"0.52293825",
"0.52293825",
"0.52293825",
"0.52086717",
"0.5206875",
"0.52064556",
"0.5195456",
"0.51812464",
"0.5179791",
"0.5157096",
"0.5156194",
"0.515118",
"0.5143255",
"0.51202047",
"0.50849193",
"0.50820726",
"0.50646865",
"0.5036625",
"0.5021585",
"0.50208676",
"0.5020282",
"0.500785",
"0.49968067",
"0.49595386",
"0.49430534",
"0.49319407",
"0.493093",
"0.49277052",
"0.4920218",
"0.4918617",
"0.49111086",
"0.49043182",
"0.49039027",
"0.48765433",
"0.4859561",
"0.48545027",
"0.48523176",
"0.484689",
"0.48464224",
"0.48432717",
"0.48323524",
"0.48123103",
"0.4806048",
"0.47874555",
"0.47845167",
"0.47834438",
"0.47720936",
"0.47665638",
"0.4755724",
"0.4754879",
"0.47525287",
"0.47435525",
"0.4739051",
"0.4733643",
"0.47326106",
"0.47251773",
"0.47111955",
"0.47075748",
"0.47028416",
"0.46846238",
"0.46775344",
"0.46692243",
"0.4669025",
"0.46535534",
"0.46526912",
"0.46516448",
"0.4641499",
"0.4639257",
"0.4630117",
"0.4629236",
"0.4628653",
"0.46266687",
"0.46227834",
"0.46196085",
"0.46121702",
"0.46112588",
"0.46066448",
"0.46030438",
"0.4602827",
"0.46004638",
"0.4596116",
"0.45806935",
"0.45805874",
"0.45784768"
] | 0.67506945 | 0 |
Only return notifications for these pages. To get notifications not associated with any page, use [] as a title. | def titles(*values)
values.inject(self) { |res, val| res._titles(val) }
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def notifications(page = 1)\n\t\t\toptions = {\"page\" => page}\n\t\t\tdata = oauth_request(\"/notifications.xml\", options)\n\t\t\tHashie::Mash.new(data)\n\t\tend",
"def notifications\n query_api_object Notification, \"/rest/notifications\", nil, \"GET\", \"notifications\"\n end",
"def unread\n @notifications = Notification.where(user_id: current_user.uid).where(is_read: false).page(params[:page]).order(created_at: :desc)\n end",
"def index\n @notifications = current_user.notifications.unread.page(params[:page]).per(20)\n end",
"def index\n authorize(Notification)\n render(:index, locals: { notifications: @notifications.page(1) })\n end",
"def index\n @notifications = Notification.where(app_id: @app.id).order('scheduled_for DESC, updated_at DESC').page params[:page]\n end",
"def unread_notifications\n notifications_received.where('activities.created_at > ?', notifications_checked_at)\n end",
"def unread\n @notifications = current_user.notifications.unread.page(params[:page]).per(5)\n end",
"def notifications\n @current_user ||= User.find(session[:user_id]) if session[:user_id]\n @client = Octokit::Client.new(:access_token => @current_user.token)\n\n # get first 50 notifications (github paginates at 50)\n notifications = @client.notifications({all: true, per_page: 50})\n\n # if there are more pages, get page 2\n more_pages = @client.last_response.rels[:next]\n if more_pages\n notifications.concat more_pages.get.data\n end\n\n # Consider how to get more pages...\n # page_count = 0\n # while more_pages and page_count < 10\n # notifications.concat more_pages.get.data\n # page_count++\n # more_pages = @client.last_response.rels[:next]\n # end\n\n # iterate over notifications to:\n # add score value\n # add notification_url value\n @json = notifications.map do |notification|\n add_score_url_to_notification(notification, {favRepos: @current_user.UserPreference.repos})\n end\n\n respond_to do |format|\n format.json {\n render json: @json.to_json, status: 200\n }\n end\n end",
"def get_notifications\n @notifications = Broadcast.joins(:feeds).where(feeds: {name: \"notification\"}).order(created_at: :desc).limit(20)\n end",
"def index\n @front_page_notifications = FrontPageNotification.all\n end",
"def notifications(blog_name, options = {})\n validate_options([:before, :types], options)\n get(blog_path(blog_name, 'notifications'), options)\n end",
"def all_notifications\n self.notifications.all\n end",
"def notifications\n response = query_api(\"/rest/notifications\")\n return response[\"notifications\"].map {|notification| Notification.new(self, notification)}\n end",
"def index\n respond_with @notifications = Notification.latest.paginate(:page => params[:page], :per_page => 100)\n end",
"def notifications(params={})\n Endpoints::Notifications.new(self).get(params)\n end",
"def get_notifications\n begin\n response = notifications_api.get\n [parse_json(response), nil]\n rescue RestClient::Unauthorized\n [{}, Unauthorized]\n end\n end",
"def show\n # Title of the webpage\n @title = 'Notifications'\n\n # Getting all of the user's notifications, then those that are unread\n @all_notifications = Notification.where([\"user_id = :id\", { id: current_user.id }]).order(created_at: :desc)\n @notification_content = {}\n @unread_notification_ids = []\n\n @all_notifications.each do |notification|\n if notification.unread?\n # Mark all of the unread notifications as read, since they have now been opened\n @unread_notification_ids << notification.id\n notification.unread = false\n notification.save\n end\n\n # Get the pieces of the body of the notification\n if notification.body\n @notification_content[notification.id] = notification.body.split(/\\n/)\n end\n\n end\n\n # Clear the number of unread notifications for the user\n current_user.update_attribute(:unread_notifications, 0)\n end",
"def sent\n @notifications = Notification.where(sender: @current_user)\n .order({created_at: :desc})\n .page(page_params[:page])\n .per(page_params[:page_size])\n render_multiple\n end",
"def show_notifications # :norobots:\n pass_query_params\n data = []\n @observation = find_or_goto_index(Observation, params[:id].to_s)\n return unless @observation\n name_tracking_emails(@user.id).each do |q|\n fields = [:naming, :notification, :shown]\n naming_id, notification_id, shown = q.get_integers(fields)\n next unless shown.nil?\n notification = Notification.find(notification_id)\n if notification.note_template\n data.push([notification, Naming.find(naming_id)])\n end\n q.add_integer(:shown, 1)\n end\n @data = data.sort_by { rand }\n end",
"def get_notifications\n \t\n \t@notifs = []\n\n \tif current_user\n @notifs = Notification.where(:user_id => current_user.id, :seen => false)\n \tend\n end",
"def index\n #@notifications = Notification.all\n @notifications = Notification.order('updated_at').page(params[:page]).per_page(10)\n end",
"def index\n @notifications = Notification.where(user_id: current_user.uid).page(params[:page]).order(created_at: :desc)\n # @notifications = Notification.all\n @notifications_sort = {}\n @notifications.each do |n|\n date = n.created_at.strftime('%Y-%m-%d')\n if @notifications_sort[date].nil?\n @notifications_sort[date] = []\n end\n @notifications_sort[date] << n\n end\n end",
"def retrieve_notifications\n\tunread = self.notifications.where(\"read = ?\", false).order(\"created_at DESC\")\n\t\n\tif unread.count < 10\n\t\tread = self.notifications.where(\"read = ?\", true).order(\"created_at DESC\").limit(10 - unread.count)\n\t\t\n\t\tunread = unread.concat(read)\n\tend\n\t\n\treturn unread\n end",
"def index\n @notifications = Notification.where(recipient: current_user).limit(10).order(created_at: :desc)\n end",
"def index\n @page_header = \"通知\"\n unless params[:include_read]\n @notifications = Notification.where(read: false, user: current_user).page(params[:page]).per(10).order(\"id desc\")\n else\n @notifications = Notification.where(user: current_user).page(params[:page]).per(10).order(\"id desc\")\n end\n\n respond_to do |format|\n format.html\n format.js\n end\n\n end",
"def received\n @notifications = Notification.where('receiver_id = ? ' +\n 'OR receiver_id IS NULL ' +\n 'OR topic IN (?)',\n @current_user.id, @current_user.get_subscribed_topic_ids)\n .order({created_at: :desc})\n .page(page_params[:page])\n .per(page_params[:page_size])\n render_multiple\n end",
"def get_notifications notifiable_type\n n = Notification.where(user_id:current_user, notifiable_type: notifiable_type)\n events_id = Array.new\n n.each do |v|\n events_id << v.notifiable_id\n end\n events = Event.where(id:events_id)\n\n end",
"def index\n @notifications = Notification.includes(:contextable).where(notifiable: @context)\n render json: paginated_json(@notifications) { |notifications| notifications_json(notifications) }\n end",
"def list_notifications # :norobots:\n @notifications = Notification.find_all_by_user_id(@user.id, order: :flavor)\n end",
"def index\n add_breadcrumb \"Index\"\n\n @alerts = AlarmNotification.not_archieved.order(\"created_at DESC\").page(params[:page])\n\n respond_with(@alerts)\n end",
"def list_notifications\n BrickFTP::API::Notification.all\n end",
"def list_notifications\n BrickFTP::API::Notification.all\n end",
"def index\n @title += \" | #{t('activerecord.models.notification')}\"\n if params[:notification]\n @notifications = Notification.joins(:car).where([\"cars.name LIKE ? OR text LIKE ?\",\n \"%#{params[:notification][:text]}%\",\n \"%#{params[:notification][:text]}%\"\n ]).order(\"created_at DESC\")\n else\n @notifications = Notification.where([\"user_id = ?\", current_user.id]).order(\"created_at DESC\").page params[:page]\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.js # index.js.erb\n format.json { render json: @notification }\n end\n end",
"def index \n response.headers['X-Total-Count'] = @admin_notifications.count.to_s\n response.headers['X-Unread-Count'] = @admin_notifications.unread.count.to_s\n @admin_notifications = @admin_notifications.page(params[:page] || 1)\n @admin_notifications = @admin_notifications.per(params[:per] || 8)\n \n _render collection: @admin_notifications\n end",
"def notifications(options = {})\n #:type => nil is a hack not to give Messages as Notifications\n notifs = Mailboxer::Notification.recipient(messageable).where(:type => nil).order(\"mailboxer_notifications.created_at DESC\")\n if options[:read] == false || options[:unread]\n notifs = notifs.unread\n end\n\n notifs\n end",
"def index\n #@notifications = Notification.all\n\t\t@notifications = Notification.paginate :order => \"created_at DESC\",\n\t\t\t:page => params[:page], :per_page => 15\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @notifications }\n end\n end",
"def index\n @page_title = @menu_title = 'Message Board'\n\n @user = auth_user\n\n if params[:list_type].to_s == 'archive'\n @notifications = ::Users::Notification.sent_to(@user.id).already_viewed.includes(:sender)\n elsif params[:list_type].to_s == 'waiting'\n @notifications = ::Users::Notification.sent_to(@user.id).in_wait.includes(:sender)\n else\n @notifications = ::Users::Notification.sent_to(@user.id).not_deleted.includes(:sender).order('status DESC, id DESC')\n end\n # Web-only\n @notifications = @notifications.parent_required if auth_user.is_a?(Parent) && request.format == 'text/html'\n @notifications = @notifications.paginate(page: [1, params[:page].to_i].max, per_page: ::Users::Notification.per_page)\n\n if (order = normalized_order).present?\n @notifications = @notifications.order(order == 'ASC' ? 'id ASC' : 'id DESC')\n end\n\n #puts request.headers['X-App-Name'].eql? 'kidstrade-ios'\n\n @sorted_notifications = @notifications.to_a.sort do|x, y|\n x.compares_with(y)\n end\n ::Users::Notification.set_related_models( @sorted_notifications )\n\n respond_to do |format|\n format.html { render layout:'landing_25' }\n format.json do\n result = reject_notes(@sorted_notifications);\n render json: (result.collect{|n| n.as_json(relationship_to_user: @user) } )\n end\n end\n end",
"def index\n @all_notifications = Notification.order(from_type: \"asc\", readed: \"asc\")\n end",
"def notifications\n response = self.class.get('/notifications.xml')\n notifications_array = []\n response['notifications'].each do |note|\n new_note = Notification.new(:body => note[\"body\"],\n :subject => note[\"subject\"],\n :send_at => note[\"send_at\"],\n :id => note[\"id\"],\n :escalation => note[\"escalation\"])\n note[\"recipients\"].each do |rcpt|\n new_note.add_recipient(Recipient.new(:id => rcpt[\"id\"],\n :channel => rcpt[\"channel\"],\n :address => rcpt[\"address\"],\n :status => rcpt[\"status\"],\n :send_at => rcpt[\"send_at\"]))\n end\n notifications_array << new_note \n end\n notifications_array\n end",
"def generate_notifications\n\t\t@notifications = Notification.find(:all, :order => \"created_at DESC\")\n\tend",
"def recent_notifications(lower_limit=10, upper_limit=25)\n if unviewed_notifications.count < lower_limit\n notifications.limit(lower_limit)\n else\n unviewed_notifications.limit(upper_limit)\n end\n end",
"def load_notifications\n \t\tif current_user\n \t\t\t@notifications = current_user.notifications.limit 5\n \t\t\t@unseen_notifications_count = current_user.notifications.unseen.count\n \t\tend\n \tend",
"def index\n @notifications = Notification.where(user: current_user)\n end",
"def index\n\t\t@notifications = Notification.where(recipient_id: current_user.id).unread\n\tend",
"def user_repo_notifications(repo, options = {})\n paginate \"#{Repository.path repo}/notifications\", options\n end",
"def unread_unsent_notifications\n @unread_unsent_notifications ||= notification.class.for_target(notification.target)\n .joins(:deliveries)\n .where.not(id: notification.id)\n .where('notify_user_notifications.read_at IS NULL AND notify_user_deliveries.sent_at IS NULL')\n end",
"def notifications\n @other_user = @login_user\n @notifications = DiscussionGroupUser.where(['user_id =? AND is_member=?', @login_user.id, false])\n @disc_notifications = NonSiteUser.where([\"email=? AND invitable_type=? and invitation_type=?\",@login_user.email,\"Discussion\",\"Invited\"])\n respond_to do |format|\n format.html\n end\n end",
"def notifications\n ::Syncano::QueryBuilder.new(self, ::Syncano::Resources::Notifications::Base)\n end",
"def index\n if current_user.status == \"admin\" || current_user.status == \"staff\"\n @notifications = Notification.all.sort_by { |obj| obj.created_at }.reverse\n elsif current_user.student\n @notifications = []\n Notification.all.each do |notification|\n @notifications << notification if notification.target == \"all\" || notification.target == \"students\"\n end\n @notifications = @notifications.sort_by { |obj| obj.created_at }.reverse\n elsif current_user.company\n @notifications = []\n Notification.all.each do |notification|\n @notifications << notification if notification.target == \"all\" || notification.target == \"companies\"\n end\n @notifications = @notifications.sort_by { |obj| obj.created_at }.reverse \n end\n # @notifications = unreaded_notifications\n respond_to do |format|\n format.html {render template: \"/notifications/index\"}\n format.js\n end\n end",
"def notifications\n return notification_data_source.notifications\n end",
"def notifications_new\n @notifications = Submission.includes(:user, :problem, followings: :user).where(visible: true).order(\"lastcomment DESC\").paginate(page: params[:page]).to_a\n @new = true\n render :notifications\n end",
"def index\n\t\t@notifications = Notification.all\n\tend",
"def get_notices\n @Noticias = Notice.all(:conditions => ['published = 1'], :order => \"id desc\", :limit => \"6\")\n end",
"def index\n @notification_contents = current_account.notification_contents.all\n end",
"def index\n @notices = current_user.notices.page params[:page]\n end",
"def notifications(receiver=current_user, limit=9)\n @notifications = receiver.received_notifications.limit(limit)\n end",
"def index\n # @notifications = current_user.notifications\n @notifications = @notifications.order(\"id desc\")\n\n if !params[:search].blank?\n @notifications = @notifications&.search(params[:search])\n end\n\n total = @notifications&.count\n\n @notifications = @notifications&.paginate(per_page: params[:per_page], page: params[:page])\n\n render json: {\n data: @notifications.collect{|n| NotificationSerializer.new(n).attributes},\n meta: {\n current_page: params[:page],\n per_page: params[:per_page],\n total: total\n }\n }\n end",
"def notifications\n end",
"def index\n @notifications = current_user.notifications.reverse\n\n @notifications = Kaminari.paginate_array(@notifications).page(params[:page]).per(10)\n respond_to do |format|\n format.html\n end\n end",
"def index\n @notifications = Notification.all\n end",
"def index\n @notifications = Notification.all\n end",
"def index\n @notifications = Notification.all\n end",
"def index\n @notifications = Notification.all\n end",
"def index\n @notifications = Notification.all\n end",
"def index\n @notifications = Notification.all\n end",
"def index\n @notify_messages = NotifyMessage.all\n end",
"def index\n @notifies = Notify.where(:course_id => @course.id).order('created_at DESC').page(params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @course.notifies }\n end\n end",
"def load_notifications\n if user_signed_in?\n @all_notifications = current_user.get_notifications\n @notifications = @all_notifications.first(10)\n @count = current_user.unread_notifications_count\n end\n end",
"def index\n @notifications = current_user ? current_user.user_notifications.unopened : []\n\n respond_to do |format|\n format.js { render :partial => \"shared/notifications_list\", locals: { :notifications => @notifications } }\n end\n\n end",
"def index\n notifications = params[:unread].nil? || params[:unread] == 0 ? current_user.notifications : Notification.where(user: current_user, status: :unread).all\n\n render json: {\n status: 'Success',\n message: '',\n notifications: notifications.as_json(except: [\n :created_at,\n :updated_at\n ])\n }, status: 200\n end",
"def notifications(options = {})\n scope = MessageCenter::Notification.recipient(messageable).order(:created_at => :desc)\n if options[:read] == false || options[:unread]\n scope = scope.unread\n end\n\n scope\n end",
"def unpublished\n respond_with(published_query(false) + Page.where(:published_on.exists => false).all)\n end",
"def notifications\n ::Users::Notification.where(related_model_type: self.class.to_s, related_model_id: self.id)\n end",
"def index\n @site_notices = SiteNotice.most_recent_first.paginate(page: params[:page], per_page: 20)\n end",
"def index\n @notifications = Notification.with_deleted.all\n end",
"def get_mails\n gmail = Gmail.connect @current_user.login, @current_user.password\n return nil unless gmail.logged_in?\n\n mails = gmail.inbox.find :unread, after: @filter_date + 1\n sent_mails = gmail.label(\"[Gmail]/Sent Mail\").find(afetr: @filter_date + 1)\n sent_mails.each { |e| mails << e }\n mails.sort_by!(&:date)\n\n end",
"def index\r\n @notifications = current_user.alerts.paginate(page: params[:page])\r\n current_user.reset_alerts\r\n end",
"def notifications(time = nil, filter = nil)\n parse_xml(*notifications_xml(time, filter))\n end",
"def index\n @parent_to_teacher_notifications = ParentToTeacherNotification.all\n end",
"def index\n #Notifications\n @allNotifications = Notification.where(\"notify_app = true AND triggered = true\").order(start_time: :desc).limit(3)\n @triggeredNotifications = Notification.where(\"notify_app = true AND triggered = true\").count\n\n #Paneles\n @clients = Client.all\n end",
"def set_notifications\n\t\t@notifications = Notification.where(reciever_id: current_user).order(\"created_at DESC\")\n\tend",
"def collect_new_messages(start_page = 1, page_count = 1)\n gotten_new_links = get_new_links(start_page, page_count)\n \n non_existing_links = remove_existing_links(gotten_new_links)\n \n non_existing_links.to_a.collect { |link_info| get_info_obj(link_info[0], link_info[1]) }.compact\n end",
"def remove_from_notifications\n notifications.find_all { |n| n.noti_read == 'N' }.each do |n|\n remove_from_notification(n)\n end # each n\n end",
"def find_pending\n notifications.where sent: false\n end",
"def notified_urls\n @notified_urls ||= {}\n end",
"def index\n @users = User.all\n @notifications = Notification.where(recipient: current_user).unread\n end",
"def show\n @notifications = current_user.notifications.limit(3)\n end",
"def index\n @notifications = current_user.notifications.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @notifications }\n end\n end",
"def show\n @notification = current_user.notifications.find(params[:id])\n @receipients = @notification.receipients.paginate(:page => params[:page] || 1, :per_page => 10) \n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @notification }\n end\n end",
"def index\n puts \"==========================\"\n puts \"INDEX\"\n @notifications = Notification.where({user: current_user})\n end",
"def notifications_for_principal(principal_uri)\n @notifications[principal_uri] || []\n end",
"def send_notification\n ::Refinery::Inquiries::InquiryMailer.published_notification(self).deliver if (self.page_status_id_changed? and self.page_status_id == 2)\n end",
"def notifications\n\t\tif signed_in?\n\t\t\tn = current_user.extra.notifications\n\t\t\tif n > 0\n\t\t\t\t\"(\" + n.to_s + \")\"\n\t\t\tend\n\t\tend\n\tend",
"def set_notifications\n @notifications = Notification.all\n end",
"def received_messages(page = 1)\n _received_messages.paginate(:page => page, :per_page => MESSAGES_PER_PAGE)\n end",
"def all\n for_user_id = @authenticated_user.id\n notifications = Notification.where(for_user_id: for_user_id, notification_type: [0,1,2,3,4])\n .order(created_at: :desc)\n notifications.each do |n|\n if (n.sent_at == nil)\n n.sent_at = Time.now\n n.save\n end\n end\n render json: Notification.render_json_full(notifications)\n end",
"def index\n @email_notifications = EmailNotification.all\n end",
"def index\n @b1 = isadmin\n @ns = @b1 ? Notification.all : current_user.notifications\n end",
"def index\n @notifications = Notification.all.order(:id)\n end",
"def getEventNotifications(u, e)\n @result = []\n @ns = Notification.all\n @ns.each do |n|\n if u == nil\n if (n.notification_type == 3 || n.notification_type == 4) && n.sender_id == e.to_i\n @result.push(n)\n end\n else\n if (n.notification_type == 3 || n.notification_type == 4) && n.sender_id == e.to_i && n.user_id == u.to_i\n @result.push(n)\n end\n end\n end\n return @result\n end"
] | [
"0.7350555",
"0.6858124",
"0.6816594",
"0.6766858",
"0.6652018",
"0.655177",
"0.65412754",
"0.6513629",
"0.64992",
"0.6464262",
"0.64615136",
"0.64535964",
"0.64499205",
"0.6448492",
"0.6446471",
"0.64436567",
"0.6392558",
"0.63788307",
"0.6375476",
"0.6360596",
"0.63553476",
"0.6353653",
"0.6340031",
"0.63182086",
"0.6298882",
"0.62852424",
"0.6267399",
"0.6266682",
"0.6246621",
"0.6228132",
"0.62185663",
"0.621025",
"0.621025",
"0.61784196",
"0.61549073",
"0.6124502",
"0.6118891",
"0.6111771",
"0.61047685",
"0.60969627",
"0.60910326",
"0.6062984",
"0.6057273",
"0.602406",
"0.6009016",
"0.5996242",
"0.5982413",
"0.59815216",
"0.5975438",
"0.59747773",
"0.59648854",
"0.59401816",
"0.59397894",
"0.5939091",
"0.5934418",
"0.59186053",
"0.5915045",
"0.5912752",
"0.58980095",
"0.58850753",
"0.5883246",
"0.5883246",
"0.5883246",
"0.5883246",
"0.5883246",
"0.5883246",
"0.587633",
"0.58585083",
"0.58496726",
"0.58454937",
"0.5810072",
"0.5785787",
"0.5767281",
"0.5758466",
"0.57215714",
"0.5717752",
"0.57153755",
"0.5705412",
"0.57026374",
"0.5701827",
"0.5697293",
"0.56851673",
"0.5685022",
"0.56741834",
"0.56726927",
"0.5654807",
"0.5651761",
"0.5639924",
"0.5636494",
"0.5635704",
"0.563492",
"0.56310016",
"0.5610857",
"0.56085706",
"0.5596817",
"0.5594894",
"0.5592389",
"0.5584912",
"0.55802935",
"0.5567925",
"0.556183"
] | 0.0 | -1 |
Whether to show bundle compatible unread notifications according to notification types bundling rules. | def bundle()
merge(notbundle: 'true')
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def notifications(options = {})\n #:type => nil is a hack not to give Messages as Notifications\n notifs = Mailboxer::Notification.recipient(messageable).where(:type => nil).order(\"mailboxer_notifications.created_at DESC\")\n if options[:read] == false || options[:unread]\n notifs = notifs.unread\n end\n\n notifs\n end",
"def notification?\n kind == 'notification'\n end",
"def unread?\n self.status == 'unread'\n end",
"def mark_notifications_as_read(options = {})\n boolean_from_response :put, 'notifications', options\n end",
"def notification?\n false\n end",
"def mark_as_unread(options={})\n update_receipts({:is_read => false}, options)\n end",
"def mark_as_unread(options={})\n update_receipts({:is_read => false}, options)\n end",
"def mark_as_unread(options = {})\n update_receipts({ is_read: false }, options)\n end",
"def any_unread? usr\n ConversationProcessor.new(self).any_unread? usr\n end",
"def unread?\n return (self.status == Email::STATUS_UNREAD)\n end",
"def unread?\n (status == UNREAD)\n end",
"def is_unread?\n !is_read\n end",
"def is_unread?\n !is_read\n end",
"def is_unread?\n !is_read\n end",
"def match_bundle_type\n self.original_file_types & BUNDLE_TYPES\n end",
"def multi_message?\n return notify_on == \"always\"\n end",
"def allow_notification?\n true\n end",
"def mark_as_unread\n Notifyer::Notification.all.each do |n|\n n.update(is_read: false)\n end\n redirect_to :back\n end",
"def mark_as_unread(options = {})\n default_options = {:conditions => [\"mail_items.mailbox != ?\",@user.mailbox_types[:sent].to_s]}\n add_mailbox_condition!(default_options, @type)\n return update_mail(\"mail_items.read = false\", default_options, options)\n end",
"def notification_badge\n if current_user.notifications.any?\n mi.notifications\n else\n mi.notifications_none\n end\n end",
"def unread_notifications\n notifications_received.where('activities.created_at > ?', notifications_checked_at)\n end",
"def mark_unread!\n update_is_read_status false\n end",
"def unread\n all(UNREAD)\n end",
"def unread?\n !read?\n end",
"def unread?\n !read?\n end",
"def mark_repo_notifications_as_read(repo, options = {})\n boolean_from_response :put, \"#{Repository.path repo}/notifications\", options\n end",
"def set_unread\n render :text => \"\", :layout => false\n end",
"def mark_as_unread\n update_attributes(is_read: false)\n end",
"def notifications(options = {})\n scope = MessageCenter::Notification.recipient(messageable).order(:created_at => :desc)\n if options[:read] == false || options[:unread]\n scope = scope.unread\n end\n\n scope\n end",
"def unread\n @notifications = Notification.where(user_id: current_user.uid).where(is_read: false).page(params[:page]).order(created_at: :desc)\n end",
"def mark_as_unread()\n update_attribute('read', false)\n end",
"def mark_all_as_read\n @notifications = Notification.unread.for_user(current_api_v1_user)\n @notifications.update_all(read_at: Time.now) unless @notifications.blank?\n @notifications = Notification.where(recipient_id: current_api_v1_user.id)\n \n render json: @notifications\n end",
"def notifications\n\t\tif signed_in?\n\t\t\tn = current_user.extra.notifications\n\t\t\tif n > 0\n\t\t\t\t\"(\" + n.to_s + \")\"\n\t\t\tend\n\t\tend\n\tend",
"def bundles_changes(notification)\n if notification.userInfo[:changed_bundle].productIdentifier == @productIdentifier\n @installed = notification.userInfo[:status] == :added\n NSNotificationCenter.defaultCenter.postNotificationName('ShopBundleStatusChanged',\n object:nil)\n\n end\n end",
"def mark_as_unread(obj)\n case obj\n when Mailboxer::Receipt\n obj.mark_as_unread if obj.receiver == self\n when Mailboxer::Message, Mailboxer::Notification\n obj.mark_as_unread(self)\n when Mailboxer::Conversation\n obj.mark_as_unread(self)\n when Array\n obj.map{ |sub_obj| mark_as_unread(sub_obj) }\n end\n end",
"def unread?\n read_at.nil?\n end",
"def mark_as_read\n if Notification.mark_as_read\n return_message(200, :ok)\n else\n return_message(200, :fail)\n end\n end",
"def unread_unsent_notifications\n @unread_unsent_notifications ||= notification.class.for_target(notification.target)\n .joins(:deliveries)\n .where.not(id: notification.id)\n .where('notify_user_notifications.read_at IS NULL AND notify_user_deliveries.sent_at IS NULL')\n end",
"def has_unopened_notifications?(options = {})\n _unopened_notification_index(options).exists?\n end",
"def alertunreadfirst()\n merge(notalertunreadfirst: 'true')\n end",
"def mark_as_unread(obj, details = nil)\n case obj\n when Alerter::Receipt\n obj.mark_as_unread if obj.receiver == self\n when Alerter::Message\n obj.mark_as_unread(self)\n when Array\n obj.map{ |sub_obj| mark_as_unread(sub_obj) }\n end\n end",
"def unread?\n !read?\nend",
"def has_notifications?\n current_user and GroupManager.instance.resolver.is_ad_admin?(current_user) and\n Workflow::AccrualJob.awaiting_admin.present?\n end",
"def unread_by?(user)\n received_message.try(:unread?) || replies.map { |r|\n r.received_message if r.recipient == user\n }.compact.any?(&:unread?)\n end",
"def mark_notification_as_read!\n notification = User.find(@userid).notifications\n @received_msg.each do |notify|\n notification.update(notify['id'], :checked => true);\n end\n end",
"def is_unread?(participant)\n return false if participant.nil?\n return self.receipts_for(participant).not_trash.is_unread.count!=0\n end",
"def has_unread_messages?\n received_messages.count > 0\n end",
"def friendship_notifications?\n notification_friendship\n end",
"def mark_as_unread(obj, details = nil)\n case obj\n when Alerter::Receipt\n obj.mark_as_unread if obj.receiver == self\n when Alerter::Message\n obj.mark_as_unread(self, details)\n when Array\n obj.map{ |sub_obj| mark_as_unread(sub_obj, details) }\n end\n end",
"def has_notifications?\n !notification_queue.empty?\n end",
"def is_unread?(participant)\n return false if participant.nil?\n !receipt_for(participant).first.is_read\n end",
"def is_unread?(participant)\n return false unless participant\n receipts_for(participant).not_trash.is_unread.count != 0\n end",
"def mark_as_read\n @notifications = Notification.where(recipient: current_user).unread\n @notifications.update_all(read_at: Time.zone.now)\n render json: {success: true}\n end",
"def mark_notifications_as_read!(user)\n self.notifications.where(read: false, user_id: user.id).update_all(read: true)\n end",
"def unread? user_id\n !unread_messages(user_id).blank?\n end",
"def mark_as_unread\n update_attributes(:is_read => false)\n end",
"def mark_as_unread\n update_attributes(:is_read => false)\n end",
"def notification_email_allowed?(notifiable, key)\n resolve_value(_notification_email_allowed, notifiable, key)\n end",
"def should_update_inbox_unread_count!\n i = mailbox.inbox.unread(self).pluck(\"distinct conversations.id\").size\n update_attributes(inbox_unread_count: i) if i != inbox_unread_count\n end",
"def index\n\t\t@notifications = Notification.where(recipient_id: current_user.id).unread\n\tend",
"def mark_all_messages_as_read(options={})\n RecipientsFor::ReaderInfo.where(\n reciveable_type: options[:reciveable].class.name,\n reciveable_id: options[:reciveable].id,\n ).update_all(read: true)\n end",
"def mark_notifications_read\n return if params[:notification_id].blank? or !user_signed_in?\n n = Notification.find(params[:notification_id])\n current_subject.mark_as_read n\n end",
"def not_priced?\n bundle? || has_variants?\n end",
"def unread\n un_read(false, \"non lue\")\n end",
"def notify_about?(object)\n case mail_notification\n when 'all'\n true\n when 'selected'\n # user receives notifications for created/assigned issues on unselected projects\n if object.is_a?(Issue) && (object.author == self || is_or_belongs_to?(object.assigned_to))\n true\n else\n false\n end\n when 'none'\n false\n when 'only_my_events'\n if object.is_a?(Issue) && (object.author == self || is_or_belongs_to?(object.assigned_to))\n true\n else\n false\n end\n when 'only_assigned'\n if object.is_a?(Issue) && is_or_belongs_to?(object.assigned_to)\n true\n else\n false\n end\n when 'only_owner'\n if object.is_a?(Issue) && object.author == self\n true\n else\n false\n end\n else\n false\n end\n end",
"def subscribe_notifications\n @subscribe_notifications ||= true\n end",
"def mark_as_read(options = {})\n default_options = {}\n add_mailbox_condition!(default_options, @type)\n return update_mail(\"mail_items.read = true\", default_options, options)\n end",
"def mark_as_unread\n @client.post('/api/mod/conversations/unread', conversationIds: [get_attribute(:id)])\n end",
"def has_unread?\n Message.any_in(conversation_id: conversations.map(&:id)).ne(read_by: id).present?\n end",
"def read_notifications\n # Update post notification\n post_notification = @message.sender\n .notifications_unread\n .where(\"origin_type = ? AND origin_id = ?\", 'Post', @post.id)\n .first\n post_notification.update_attributes(read: true) unless post_notification.nil?\n\n # Update post's messages notifications\n @post.messages.each do |message|\n message_notification = @message.sender\n .notifications_unread\n .where(\"origin_type = ? AND origin_id = ?\", 'Message', message.id)\n .first\n message_notification.update_attributes(read: true) unless message_notification.nil?\n end\n end",
"def can_notify? user\n return false if self.id == user.id\n not notification_exists? user\n end",
"def is_there_notification\n current_user.notifications\n end",
"def notification?\n !Notification.where(product_id: self.id).empty?\n end",
"def check_notification\n referral = self\n admin = referral.job.admin\n\n if referral.is_interested == true && referral.is_admin_notified == false\n # binding.pry\n if referral.update_attribute(:is_admin_notified, true)\n ReferralMailer.deliver_admin_notification(referral, admin)\n referral.save\n else\n render 'edit', error: \"We had an issue with your referral request. Please try again.\"\n end\n end\n end",
"def send_notifications?\n self.notification_emails.present?\n end",
"def bundle?\n @descriptive_detail.bundle?\n end",
"def check_for_messages\n @message_unviewed = Message.all(:recipient_id => current_user.id, :viewed => false, :opportunity => Opportunity.all(:active => true))\n if @message_unviewed != []\n flash.now[:warning] = 'You have unread messages'\n end\n end",
"def load_types\n ObjectSpace.enum_for(:each_object, class << NotificationSystem::Notification; self; end).to_a - [NotificationSystem::Notification]\n end",
"def check\n\n\t\t@unseenNotifications = {notifications: current_user.notifications.unseen.count}\n\t\trespond_to do |format|\n\n\t\t\tformat.json { render json: @unseenNotifications }\n\n\t\tend\n\n\tend",
"def is_bundle\n return @is_bundle\n end",
"def transferable?\n !bundle? && !part_of_bundle? && unreserved? or\n bundle? && bundled_vouchers.all?(&:unreserved?)\n end",
"def mark_as_read\n DeterLab.mark_notifications(current_user_id, [ params[:id] ], [ { isSet: true, tag: Notification::READ } ])\n render text: 'ok'\n end",
"def already_notified_for_attached_by_notifier?\n user.notifications.where(attached: attached, notifier: notifier).exists?\n end",
"def allow_easy_notifiaction?\n this_and_closer_members_count <= self.user.max_easy_notification_count\n end",
"def unread_unsent_notifications_for_group\n @unread_unsent_notifications_for_group ||= unread_unsent_notifications.where('notify_user_notifications.group_id = ?', notification.group_id)\n end",
"def implements()\n return Formatter::AllNotifications\n end",
"def unread\n read_attribute(:unread)\n end",
"def bundle?\n @product_composition.human == \"MultipleComponentRetailProduct\"\n end",
"def mark_all_user_notifications_notified(user)\n user.notifications.each do |n|\n n.notified = true\n n.save\n end\n end",
"def unverifiable_packages_message\n if nagios_mode?\n puts \"CRIT: available metadata ok, but #{unverifiable_package_count} packages cannot be verified\"\n else\n msg \"unverifiable_packages: #{unverifiable_package_count}\"\n unverifiable_packages.each do |pkg|\n msg \"* #{pkg}\"\n end\n end\n end",
"def message_notification\n fetch(:hipchat_announce, false)\n end",
"def mark_as_unread(participant)\n return unless participant\n receipts_for(participant).mark_as_unread\n end",
"def unread\n @notifications = current_user.notifications.unread.page(params[:page]).per(5)\n end",
"def unread_count\n @status = Messenger.inbox_status(current_user)\n return_message(200, :ok, :count => @status[:unread])\n end",
"def warning?\n messages && messages.length > 0\n end",
"def message_notifications\n notifications = Message.where(receiver_id: @current_user.id, read_status: 0)\n if notifications\n render json: {\n status: 'success',\n message: 'Your notifications',\n data: notifications.length()\n },\n status: :ok\n end\n end",
"def mark_as_unread(participant)\n return if participant.nil?\n return self.receipts_for(participant).mark_as_unread\n end",
"def is_bundle=(value)\n @is_bundle = value\n end",
"def unread_items(params = {})\n @unread_items ||= filtered_items_list('reading-list', params.merge(:exclude => 'user/-/state/com.google/read'))\n end",
"def installable?\n uninstallable_reasons.empty?\n end",
"def mark_as_unread(participant)\n return unless participant\n self.receipts.recipient(participant).mark_as_unread\n end"
] | [
"0.60254747",
"0.60046065",
"0.5750039",
"0.5735491",
"0.5693279",
"0.567705",
"0.567705",
"0.565127",
"0.5643616",
"0.56188816",
"0.56040865",
"0.5576926",
"0.5576926",
"0.5576926",
"0.55723315",
"0.55688816",
"0.5545965",
"0.5506293",
"0.54885525",
"0.5474304",
"0.5463058",
"0.5459493",
"0.5450026",
"0.54442114",
"0.5440456",
"0.54385644",
"0.542771",
"0.54005456",
"0.5396369",
"0.53454703",
"0.5344825",
"0.5341155",
"0.5332343",
"0.5306285",
"0.53024966",
"0.52875966",
"0.52791977",
"0.5247975",
"0.5226593",
"0.52197003",
"0.5217767",
"0.5214921",
"0.52148086",
"0.5204161",
"0.5203059",
"0.5199798",
"0.5194687",
"0.5192319",
"0.51812756",
"0.5172162",
"0.51635665",
"0.5151155",
"0.5150284",
"0.51487464",
"0.51453334",
"0.51429296",
"0.51429296",
"0.51405126",
"0.51336384",
"0.5132795",
"0.5120313",
"0.51061743",
"0.5089257",
"0.5088361",
"0.50820315",
"0.50690895",
"0.5067636",
"0.50615406",
"0.5053656",
"0.504262",
"0.5039953",
"0.5023883",
"0.50034916",
"0.49798992",
"0.4979432",
"0.497868",
"0.49769115",
"0.4974739",
"0.49745765",
"0.49739832",
"0.49672097",
"0.49514246",
"0.4944078",
"0.49301493",
"0.49253625",
"0.49248052",
"0.49231726",
"0.49092093",
"0.49073923",
"0.48923817",
"0.48743445",
"0.48703548",
"0.48590976",
"0.48577753",
"0.48520193",
"0.4833189",
"0.48308945",
"0.4826867",
"0.48231342",
"0.48202634",
"0.48199025"
] | 0.0 | -1 |
When more alert results are available, use this to continue. | def alertcontinue(value)
merge(notalertcontinue: value.to_s)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def processNewAlerts\n @session.alerts.each{ |alert|\n if alert.is_a? Libtorrent::TorrentAlert\n if alert.handle.valid? && alert.handle.has_metadata\n addToHashList @torrentAlerts, alert.handle.name, alert\n end\n else\n @globalAlerts.push alert\n # For now since nothing is reading the alerts, just store a max of \n # 5.\n @globalAlerts.shift if @globalAlerts.length > 5\n end\n }\n end",
"def results\n # Load the service from the database\n load_service\n return if (@service.blank?)\n\n # Alert records of this service\n @alert_records = AlertRecord.where(:service_id => @service.id).desc(:open).desc(:updated_at).limit(8)\n\n respond_to do |format|\n format.html\n format.js\n end\n end",
"def wait_for_results\n wait_until(Config.medium_wait) { elements(result_rows).any? }\n end",
"def collect_results\n while collect_next_line; end\n end",
"def while_results(&block)\n loop do\n results = get![:results]\n break if results.nil? || results.empty?\n results.each(&block)\n end\n end",
"def wait_for_results\n wait_until(Config.long_wait) { elements(result_rows).any? }\n end",
"def process_monitor_results(result_array_of_hashes)\n result_array_of_hashes = result_array_of_hashes[\n 0..Settings.result_limit.to_i\n ]\n Delayed::Worker.logger.debug \"Processing #{@asq.name}\"\n Delayed::Worker.logger.debug \"Evaluating if #{@asq.alert_result_type}\n #{@asq.alert_operator} #{@asq.alert_value}\"\n\n if @asq.alert_result_type == 'rows_count'\n Delayed::Worker.logger.debug \"Row length: #{result_array_of_hashes.length}\n // Error value: #{@asq.alert_value.to_i}\"\n process_row_count(result_array_of_hashes)\n elsif @asq.alert_result_type == 'result_value'\n # Should break if we get multiple rows back\n return unless single_row?(result_array_of_hashes)\n Delayed::Worker.logger.debug 'Result to evaluate: ' \\\n \"#{result_array_of_hashes[0].values[0]} \" \\\n \"(#{result_array_of_hashes[0].values[0].class}) // \\n\" \\\n \"Error value: #{@asq.alert_value} (#{@asq.alert_value.class})\"\n\n if invalid_non_numeric_comparison?(result_array_of_hashes[0].values[0])\n @asq.operational_error([{\n 'error_source' => 'Asq',\n 'error_text' => 'Error processing results: This Asq is ' \\\n 'using a less-than or greater-than operator against a ' \\\n 'non-numeric expected result. For non-numeric results, ' \\\n 'only the == and != operators are valid.'\n }].to_json)\n else\n compare_result_value(result_array_of_hashes)\n end\n else\n @asq.operational_error([{\n 'error_source' => 'Asq',\n 'error_text' => 'Error processing results: ' \\\n 'I tried to evaluate if this Asq was in error but I ' \\\n 'couldn\\'t understand if I was supposed to look at the ' \\\n 'row count or result set.'\n }].to_json)\n end\n @asq.finish_refresh\n rescue StadardError => e\n @asq.operational_error([{\n 'error_source' => 'Asq',\n 'error_text' => \"Error when processing results: #{e}\"\n }].to_json)\n end",
"def more_results?()\n #This is a stub, used for indexing\n end",
"def complete_result?\n @result_count < 1000\n end",
"def host_results\n # Load the service from the database\n load_service\n return if (@service.blank?)\n\n # Find the host between the service's associated\n @host = Host.where(:_id => params[:host_id], :service_ids => @service.id).first\n\n if (@host.blank?)\n # If not found, show an error and redirect\n flash[:error] = t(\"services.error.host_service_not_found\")\n redirect_to services_path()\n return\n end\n\n # Alert records of this service and host\n @alert_records = AlertRecord.where(:service_id => @service.id, :host_ids => @host.id).desc(:open).desc(:updated_at).limit(8)\n\n respond_to do |format|\n format.html\n format.js\n end\n end",
"def check_alerts\n hits = @queue.size\n\n if hits >= @hits_alert_threshold && (@alerts.empty? || @alerts.last.kind_of?(EndHighTrafficAlert))\n @alerts << HighTrafficAlert.new(hits: hits)\n elsif hits < @hits_alert_threshold && @alerts.last.kind_of?(HighTrafficAlert)\n @alerts << EndHighTrafficAlert.new\n end\n end",
"def process_monitor_results(result_array_of_hashes, asq)\n result_array_of_hashes =\n result_array_of_hashes[0..Settings.result_limit.to_i]\n\n Delayed::Worker.logger.debug \"Processing #{asq.name}\"\n Delayed::Worker.logger.debug \"Evaluating if #{asq.alert_result_type} ' \\\n #{asq.alert_operator} #{asq.alert_value}\"\n\n if asq.alert_result_type == 'rows_count'\n Delayed::Worker.logger.debug \"Row length: \" \\\n \"#{result_array_of_hashes.length} // Error value: #{asq.alert_value.to_i}\"\n if result_array_of_hashes.length.send(alert_operator,\n asq.alert_value.to_i)\n then asq.alert(result_array_of_hashes.to_json)\n else asq.clear\n end\n elsif asq.alert_result_type == 'result_value'\n if result_array_of_hashes.length != 1\n asq.operational_error([{\n 'error_source' => 'Asq', 'error_text' =>\n 'Error processing results:'\\\n 'Expected query result with a single value.'\n }].to_json)\n asq.finish_refresh\n return\n end\n Delayed::Worker.logger.debug 'Result to evaluate: ' \\\n \"#{result_array_of_hashes[0].values[0]} \" \\\n \"(#{result_array_of_hashes[0].values[0].class}) // \\n\" \\\n \"Error value: #{asq.alert_value} (#{asq.alert_value.class})\"\n if (['<', '<=', '>', '>='].include? asq.alert_operator) &&\n (asq.alert_value =~ /\\D/)\n asq.operational_error([{\n 'error_source' => 'Asq',\n 'error_text' => 'Error processing results: This Asq is ' \\\n 'using a less than or greater than operator against a non-numeric ' \\\n 'expected result. For non-numeric results, only the == and != ' \\\n 'operators are valid.'\n }].to_json)\n else\n result = result_array_of_hashes[0].values[0]\n alert_value = asq.alert_value\n if result != ~ /[a-zA-Z]/\n result = result.to_f\n alert_value = alert_value.to_f\n else\n result = result.to_s\n alert_value = alert_value.to_s\n end\n\n if result.send(alert_operator, alert_value)\n then asq.alert(result_array_of_hashes.to_json)\n else asq.clear\n end\n end\n else\n asq.operational_error([{\n 'error_source' => 'Asq',\n 'error_text' => 'Error processing results: ' \\\n 'I tried to evaluate if this Asq was in error but I ' \\\n 'couldn\\'t understand if I was supposed to look at the row count or ' \\\n 'result set.'\n }].to_json)\n end\n asq.finish_refresh\n rescue StandardError => e\n asq.operational_error([{\n 'error_source' => 'Asq',\n 'error_text' => \"Error when processing results: #{e}\"\n }].to_json)\n end",
"def index\n @email_alerts = EmailAlert.order(\"id desc\").limit(300)\n end",
"def pump_results!\n loop do\n distribute_results!\n end\n end",
"def distribute_results!\n response = JSON.parse(@socket.readline)\n\n if response[\"event\"]\n @event_queue << response\n else\n @result_queue << response\n end\n rescue StandardError\n @alive = false\n Thread.exit\n end",
"def max_results\n $testCaseID = \"VT229-0012\"\n con_remove\n createContact 20\n \n @count = Rho::RhoContact.find(:count,:max_results)\n puts @count\n Alert.show_status('Contacts',@count,'hide')\n redirect :action => :index\n end",
"def poll!\n find_and_process_next_available(messages)\n end",
"def alert(message)\n Delayed::Worker.logger.debug \"Setting Asq #{id} to be in alert.\"\n\n if in_alert?\n self.status = 'alert_still'\n else\n self.status = 'alert_new'\n log('warn', 'Asq is in alert')\n end\n\n store_results(message)\n check_for_related_tickets(self) if Settings.related_tickets\n finish_refresh\n end",
"def execute_alerts\n #iterate through all alerts, filtering out ones that don't match; with each of the remaining alerts, call Alert#notify_user\n # ad_options = self.options.includes(:option_value) #.includes(:option_class)\n ad_options = self.combined_options\n matching_alerts = []\n \n self.candidate_alerts.each do |alert|\n matching_alert = true\n \n unless(matches_date_or_integer_options?(alert.alert_integer_options, ad_options) &&\n matches_date_or_integer_options?(alert.alert_date_options, ad_options) && \n matches_string_or_boolean_options?(alert.alert_string_options, ad_options) &&\n matches_string_or_boolean_options?(alert.alert_boolean_options, ad_options))\n \n matching_alert = false \n end\n #debugger\n matching_alerts << alert if(matching_alert) \n end\n \n matching_alerts.each do |alert|\n alert.notify_user(self)\n end \n end",
"def index_records\n # If there is an ID passed, try to load the alert\n if (!params[:id].blank?) && (params[:id] != \"all\")\n load_alert\n return if (@alert.blank?)\n end\n\n # if there is an alert loaded, filter the results\n if ([email protected]?)\n @alert_records = AlertRecord.where(:alert_id => @alert.id)\n else\n @alert_records = AlertRecord.all\n end\n\n # Ordering results\n @alert_records = @alert_records.desc(:open).desc(:updated_at)\n\n # If a page number is received, save it (if not, the page is the first)\n if (!params[:page].blank?)\n page = params[:page].to_i\n page = 1 if (page < 1)\n else\n page = 1\n end\n \n # Paginate!\n @alert_records = @alert_records.page(page)\n\n respond_to do |format|\n format.html\n end\n end",
"def get_all_report\n limit = 15\n begin\n if params.has_key? :last_iso_timestamp\n from_time = DateTime.iso8601 params[:last_iso_timestamp]\n\n items = Item.active_items.order('updated_at DESC').where(\"updated_at < ?\",from_time).limit(limit)\n else \n items = Item.active_items.order('updated_at DESC').limit(limit)\n end\n #return\n render json:{success:true, lost_and_found: items.take(limit)} \n rescue Exception => e\n render json:{success:false, message: e.to_s}\n end\n end",
"def nextResults\n # Update results\n updateResults(@nextURI)\n\n # Update nextURI\n updateNextURI\n end",
"def results\n send_query\n end",
"def index\n @alerts = Alert.all\n\n # If an activation status is passed, get the specified alerts\n check_active_param\n @alerts = @alerts.where(:active => @active) if (@active != nil)\n\n # If a search query is received, filter the results\n if (!params[:q].blank?)\n # Do the search\n @query = params[:q]\n @alerts = @alerts.where(\"$or\" => [{:name => /#{@query}/i}, {:description => /#{@query}/i}])\n end\n\n # If a page number is received, save it (if not, the page is the first)\n if (!params[:page].blank?)\n page = params[:page].to_i\n page = 1 if (page < 1)\n else\n page = 1\n end\n \n # Paginate!\n @alerts = @alerts.page(page)\n\n respond_to do |format|\n format.html\n end\n end",
"def results\n fetch unless @results\n @results\n end",
"def refresh_execution_results\n if (@query.last_execution)\n @incomplete_results = @query.last_execution.unfinished_results.count > 0\n @incomplete_results ||= @query.last_execution.results.where(aggregated: false).count > 0\n else\n @incomplete_results = false\n end\n @query.reload\n respond_to do |format|\n format.js { render :layout => false }\n end\n end",
"def results\n send_query\n end",
"def next_result()\n #This is a stub, used for indexing\n end",
"def process_report_results(result_array_of_hashes)\n Delayed::Worker.logger.debug \"Processing #{@asq.name}\"\n @asq.store_results(result_array_of_hashes.to_json)\n # if asq was previously in operational error, now's the time to clear it:\n @asq.clear\n @asq.finish_refresh\n end",
"def process_result tweet\n @total_results += 1\n \n begin\n # return right away if we have already processed this tweet\n return if Vote.find_by_tweet_id( tweet.tweet_id )\n vote = create_vote_from_tweet(tweet)\n send_vote_reply( vote )\n send_poll_results( vote ) if results_reply\n @new_results += 1\n @voter_ids << tweet.from_user\n rescue InvalidVoteError\n send_error_reply( tweet, $!.to_s )\n # The users vote is invalid. TODO: send a tweet back to them indicating the error.\n logger.info \"** Invalid Vote: #{$!.inspect}\"\n logger.info \"** Vote Contents: #{tweet.inspect}\"\n rescue ActiveRecord::StatementInvalid\n if $!.to_s =~ /Mysql::Error: Duplicate entry/\n begin\n Mailer.deliver_exception_notification $!, \"Vote must have been created by another thread.\"\n rescue Errno::ECONNREFUSED\n logger.error( \"Could not connect to mail server.\")\n end \n end\n end\n end",
"def check_records_limit\n if current_user.records_limit_reached?\n flash[:alert] = 'Sorry, you have reached the maximum number of records.'\n redirect_to records_path and return\n end\n end",
"def results\n populate\n @results\n end",
"def abandon_results!()\n #This is a stub, used for indexing\n end",
"def finalize_response(resp)\n resp.tap do |r|\n r.response[:limit] = r.response.items.size - 1\n r.response[:moreItems] = false\n end\n end",
"def paginated(result, params, with = API::Entities::Notification)\n env['auc_pagination_meta'] = params.to_hash\n if result.respond_to?(:count) && result.count > params[:limit]\n env['auc_pagination_meta'][:has_more] = true\n result = result[0, params[:limit]]\n end\n present result, with: with\n end",
"def load_more_search_result\n @users=[]\n @users = @login_user.search_query(session[:search_opt],params[:page].to_i)\n render :partial => \"search_user_result\"\n #render :text => \"yes\"\n end",
"def check_for_failures\n failed_queries = Alert.where(\"source_id = ? AND level > 1 AND updated_at > ?\", id, Time.zone.now - max_failed_query_time_interval).count\n failed_queries > max_failed_queries\n end",
"def check_for_failures\n failed_queries = Alert.where(\"source_id = ? AND level > 1 AND updated_at > ?\", id, Time.zone.now - max_failed_query_time_interval).count\n failed_queries > max_failed_queries\n end",
"def results_complete?(max_results)\n return @snp_list.results_complete?(max_results)\n end",
"def process_report_results(result_array_of_hashes, asq)\n Delayed::Worker.logger.debug \"Processing #{asq.name}\"\n asq.store_results(result_array_of_hashes.to_json)\n # if asq was previously in operational error, now's the time to clear it:\n asq.clear\n asq.finish_refresh\n end",
"def index\n @resolved = params[:resolved].eql?(\"true\") ? true : false\n @q = @current_event.alerts.includes(:subject).where(resolved: @resolved).order(priority: :desc, event_id: :asc, created_at: :desc).ransack(params[:q])\n @alerts = @q.result\n\n authorize(@alerts)\n @pokes = @current_event.pokes.where(operation_id: @alerts.where(subject_type: 'Transaction').uniq(&:subject_id).pluck(:subject_id))\n @alerts = @alerts.group_by(&:priority)\n end",
"def enter_result(test_data)\n hide_notifications_bar\n wait_for_element_and_type(result_text_area, test_data[UseOfCollections::RESULT.name])\n end",
"def handle_results(results:)\n if results.empty?\n puts \"No results for: \\\"#{@query}\\\"\".bold.red\n else\n results.each do |key, result|\n puts \"\\n\\\"#{@query}\\\", found in: \\\"#{key}\\\"\".bold.green\n ap result\n end\n end\n end",
"def has_alert?(results)\n results_format = @query_options['results_format']\n alert_condition = @query_options['alert_condition']\n\n alert = false\n if results_format.eql?(\"count\")\n count_value = results.first.map{|key,value| value}.first\n alert = eval(\"#{count_value} #{alert_condition}\")\n elsif results_format.eql?(\"size\")\n alert = eval(\"#{results.size} #{alert_condition}\")\n elsif results_format.eql?(\"xls\")\n alert = true\n end\n\n return alert\n end",
"def process_alert\n alert.persisted? ? process_existing_alert : process_new_alert\n end",
"def fetch\n @start_time ||= (Time.current - 1.minute).to_i * 1000\n $mw_log.debug \"Catching Events since [#{@start_time}]\"\n\n new_events = @alerts_client.list_events(\"startTime\" => @start_time, \"tags\" => \"miq.event_type|*\", \"thin\" => true)\n @start_time = new_events.max_by(&:ctime).ctime + 1 unless new_events.empty? # add 1 ms to avoid dups with GTE filter\n new_events\n rescue => err\n $mw_log.info \"Error capturing events #{err}\"\n []\n end",
"def continue?(previous_response)\n return false unless previous_response.last_evaluated_key\n\n if @options[:limit]\n if @options[:limit] > previous_response.count\n @options[:limit] = @options[:limit] - previous_response.count\n\n true\n else\n false\n end\n else\n true\n end\n end",
"def truncate_alert\n return unless self.alert\n while self.alert.length > 1\n begin\n self.message_for_sending\n break\n rescue APN::Errors::ExceededMessageSizeError => e\n self.alert = truncate(self.alert, :length => self.alert.mb_chars.length - 1)\n end\n end\n end",
"def check_number_of_results(li_arr)\n puts \"#{@@info_indicate} start checking if displaying correct number of results\"\n if result_more_then_ten\n assert_true(li_arr.size == 10, 'display 10 results')\n else\n #result_more\n assert_true(li_arr.size == get_data_total_results, 'display all results')\n end\n end",
"def each(&block)\n process_results unless @processed\n @results.each(&block)\n end",
"def more_results\n @server_status & SERVER_MORE_RESULTS_EXISTS != 0\n end",
"def results_limit\n # max number of search results to display\n 10\n end",
"def retry_query\n Rails.logger.info('Retrying EDS Search')\n @attempts += 1\n search(@query[:term], @query[:profile], @query[:facets],\n @query[:page], @query[:per_page])\n end",
"def results; end",
"def results; end",
"def results; end",
"def see_all_result\r\n see_all_result_lnk.click if has_see_all_result_lnk?\r\n end",
"def get_results\n\n # An internal counter to get the next\n # set of results from the API\n @result_count = 0\n\n # An array into which the API results can\n # be collected\n @results = []\n\n # Get the first set of results from the API\n json_response = self.query\n\n while true\n\n # Exit the loop if the API doesn't return\n # any results and set the \"skip\" attribute\n # to nil\n if json_response['result_count'] == 0\n self.skip= nil\n break\n end\n\n # Add the count of the returned results to the\n # internal result counter's current value\n @result_count += json_response['result_count']\n\n # Append the current results to the results\n # array\n @results << json_response['results']\n\n # Set the \"skip\" attribute to the value\n # on the internal result counter\n self.skip= @result_count\n\n # Get the next set of results from the API\n json_response = self.query\n\n # A simple progress bar\n print \"#\"\n\n end\n\n # Print the total result count to the console\n puts \"\\nFound #{@result_count} results.\"\n\n return @results\n\n end",
"def results_complete?(max_results)\n complete = true\n @included_snps.each do |snp|\n if max_results != @snps[snp].results.length\n complete = false\n break\n end\n end\n return complete\n end",
"def get_results\n \titems = self.possessions.find(:all, :limit => 20, :order => 'wants_count DESC')\n #reset data just for testing\n Possession.all.each do |item|\n item.new_owner = nil\n item.save\n end\n \t# items = prune(items)\n \tif items.count > 1\n \t\tfind_some_trades(items)\n \tend\n end",
"def check_for_no_results(hash_of_results)\n if hash_of_results[JSON_NUMBER_OF_RESULTS] == 0\n puts 'No results, try again'\n go\n end\n end",
"def no_more?\n more_results == :NO_MORE_RESULTS\n end",
"def alert( call_site )\n if call_site.invocation_count <= ::Deprecatable.options.alert_frequency then\n ::Deprecatable.alerter.alert( self, call_site )\n end\n end",
"def discard_results; end",
"def showResults() \n\n end",
"def end_of_feed?\n load_result.videos.length < 25\n end",
"def next_alert_time\n false\n end",
"def more_messages\n log \"Getting more_messages\"\n log \"Old start_index: #@start_index\"\n max = @start_index - 1\n @start_index = [(max + 1 - @limit), 1].max\n log \"New start_index: #@start_index\"\n fetch_ids = search_query? ? @ids[@start_index..max] : (@start_index..max).to_a\n log fetch_ids.inspect\n message_ids = fetch_and_cache_headers(fetch_ids)\n res = get_message_headers message_ids\n with_more_message_line(res)\n end",
"def inspector_successfully_received_report(report, _)\n report.issues[0..2].each { |issue| print_issue_full(issue) }\n\n if report.issues.count > 3\n UI.puts \"and #{report.total_results - 3} more at:\"\n UI.puts report.url\n end\n end",
"def fetch_with_limit\n start_result = 10\n start_result.step(RESULTS_LIMIT, 10) do |number|\n response = get_subdomains!(number)\n break unless response.items_present?\n end\n end",
"def all_eps(query, offset)\n episodes_arr = []\n results = 10\n num = offset\n\n while results == 10\n\n response = HTTParty.get \"https://listennotes.p.mashape.com/api/v1/search?len_min=10&offset=#{num}&only_in=title&published_after=0&q=#{query}&sort_by_date=0&type=episode\",\n headers:{\n 'X-Mashape-Key' => ENV['MASHAPE_KEY'],\n \"Accept\" => \"application/json\"\n }\n #episodes_arr << response[\"results\"] #adds the current results to the array. Nope..\n response[\"results\"].each { |r| episodes_arr << r}\n num += response[\"count\"].to_i #increases the offset by the number of results that we just found\n \n count = episodes_arr.count\n puts \"There are now #{count} in the array\"\n results = response[\"count\"]\n puts \"The latest lookup has #{results} results in there. \"\n\n end\n return episodes_arr\n end",
"def selected_results\n \t\n \t@contacts = session[SELECTED_CONTACTS]\n\t\n \tpaginated_selected_results\n\t\n\trender :layout => false\n end",
"def fetch_search_results\n response = twitter_account.client.search(query, search_options)\n statuses = response.statuses\n tweets = TweetMaker.many_from_twitter(statuses, project: project, twitter_account: twitter_account, state: state)\n update_max_twitter_id(tweets.map(&:twitter_id).max)\n tweets\n # If there's an error, just skip execution\n rescue Twitter::Error\n false\n end",
"def numberOfResults\n @@numberOfResults\n end",
"def more_after_limit?\n more_results == :MORE_RESULTS_AFTER_LIMIT\n end",
"def multi_page_response\n @multi_page_reponse ||= events_builder.multi_page_response\n rescue => e\n Rails.logger.error(e)\n Array.new\n end",
"def end_accepting\n @res.join\n end",
"def end_accepting\n @res.join\n end",
"def index\n @alerts = Alert.all\n end",
"def index\n @alerts = Alert.all\n end",
"def index\n @alerts = Alert.all\n end",
"def show\n @alert = Alert.new\n @denich_id = params[:query] || params[:id]\n @product = Product.includes(offers: :prices).includes(offers: :retailer).find_by(denich_id: @denich_id)\n unless @product.present? && @product.updated_at.to_date == Time.zone.today\n @product = ScrapeProductService.new(@denich_id).call\n end\n @offers = @product.is_a?(Product) ? @product.offers.includes(:prices, :retailer) : []\n if @offers.empty?\n flash[:alert] = \"Sorry,this product is not on sales at the moment\"\n redirect_to root_path\n end\n filter\n end",
"def handle_results(env, request = nil)\n # override me!\n end",
"def results\n numOfSearches = numEvents / @OFFSET #the number of searches we must make to return all values\n result = Array.new\n if (complete?)\n for i in 0..numOfSearches\n result.push( @client.get_request(\"/services/search/jobs/#{@sid}/results\", {'output_mode' => @OUTPUT_MODE, 'count' => @OFFSET, 'offset' => (@OFFSET * i)}))\n end\n end\n result\n end",
"def results\n with_monitoring do\n response = perform(:get, results_url, query_params)\n Search::ResultsResponse.from(response)\n end\n rescue => e\n handle_error(e)\n end",
"def gather_offers_per_page(doc, indeed_offers)\n # Gathers all the cards on the page and collects info from each owne of them\n puts \"Pulling information from each card offer per page\"\n doc.search('.jobsearch-SerpJobCard').each do |job_card|\n # If offer already exists none will be created\n unless Offer.where(external_id: job_card['data-jk']).present?\n\n puts \"Getting information from offer #{job_card['data-jk']}, #{job_card.search('h2').text}\"\n new_offer_hash = {\n external_id: job_card['data-jk'],\n company: job_card.search('.company').text,\n title: job_card.search('h2').text,\n salary: \"\", # unrefined text, not suited for ranges yet\n category: \"Software Development\",\n position: '',\n job_type: \"\",\n tags: [],\n location: job_card.search('.location').text,\n listing_url: \"https://www.indeed.com.mx/ver-empleo?jk=#{job_card['data-jk']}\",\n candidate_required_location: \"Mexico\",\n source: 'indeed'\n }\n collect_salary(job_card, new_offer_hash)\n scrape_individual_offer(new_offer_hash, \"ver-empleo?jk=#{job_card['data-jk']}\")\n # Save each job with complete information into a list of all the offers from indeed\n\n puts 'create a new offer test'\n\n new_offer = Offer.where(external_id: new_offer_hash['id'].to_s, source: 'indeed').first_or_initialize\n copy_offer_variables(new_offer, new_offer_hash)\n new_offer.source = 'indeed'\n new_offer_hash[:tags].each do |tag_name|\n new_offer.tags << Tag.find_by(name: tag_name)\n end\n new_offer.save!\n end\n end\n end",
"def has_results?\n true\n end",
"def index\n current_user.havemessage = 0\n current_user.save\n @alerts = current_user.alerts.order(\"created_at DESC\").page(params[:page]).per(15)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @alerts }\n end\n end",
"def index\n @sleep_alerts = SleepAlert.all\n end",
"def action_list_more(input)\n # check whether last five mins search product or promotion success\n utoken = input[:FromUserName]\n lastrequest = UserRequest.where(\"utoken=:token AND updated_at>:validatetime AND lastaction IN (:product_ft_search,:promotion_ft_search)\",{\n :token=>utoken,\n :validatetime => Time.now-5.minutes,\n :product_ft_search => RequestAction::ACTION_PROD_LIST_FT,\n :promotion_ft_search => RequestAction::ACTION_PRO_LIST_FT\n }).first\n return build_response_text_temp {|msg|\n msg.Content=t :noproductsearchhistory\n } if lastrequest.nil?\n lastpage = lastrequest[:lastpage]\n lastmsg = JSON.parse(lastrequest[:msg])\n if lastrequest[:lastaction] == RequestAction::ACTION_PROD_LIST_FT\n # do more search for product\n response = do_list_product(lastmsg[\"Content\"],lastpage+1)\n else\n # do more search for promotion\n response = do_list_promotion lastmsg,lastpage+1\n end\n #persist user request\n lastrequest.lastpage = lastpage % 1000+1\n lastrequest.save\n response\n end",
"def retrieved_records\n results.count\n end",
"def complete\n @result_handler.call(*result) while @jobcount > 0\n end",
"def querytest_failing_common\n wait_for_hitcount(\"query=test&streaming.selection=true\", 28, 10)\n end",
"def confirm_harvest_done(harvester_id, harvester_title, waitmax)\n begin\n puts \"Info: Max wait time to harvest current profile is set to #{waitmax} seconds\"\n Timeout::timeout(waitmax.to_i) do\n harvest_request_is_done(harvester_id.to_s, harvester_title)\n end\n rescue Timeout::Error\n puts \"Warning: Harvest timed out after #{waitmax} seconds, reusing the previous harvest results.\"\n end\n end",
"def run\n self.report_type = :daily_tasks\n self.failures = []\n\n EmailSubmission.where(\n created_at: Date.yesterday...Date.current\n ).joins(:c100_application).find_each(batch_size: 25) do |record|\n reference_code = record.c100_application.reference_code\n\n find_failures(record, reference_code, COURT_EMAIL_TYPE)\n\n # Only if the applicant chose to receive a confirmation, otherwise\n # these emails are not sent and there is no need to do any check.\n find_failures(record, reference_code, USER_EMAIL_TYPE) if record.c100_application.receipt_email?\n end\n\n send_email_report if failures.any?\n end",
"def load_next_page\n @browser.pluggable_parser.html = SearchPaginationParser\n\n @pagination.next\n previous_length = @results.size\n\n page = @browser.get(ajax_url)\n\n @results += page.search('.match_row').collect do |node|\n OKCupid::Profile.from_search_result(node)\n end\n\n @browser.pluggable_parser.html = Mechanize::Page\n\n previous_length != @results.size\n end",
"def handle_append_entries(payload)\n response = super(payload)\n\n if response[:success]\n timeout.reset\n end\n\n response\n end",
"def process_results(results)\n\n if results.length > 5\n return \"More than 5 results, please be more specific.\"\n elsif results.length == 0\n return \"No runs found.\"\n end\n return make_reply(results)\n\nend",
"def switch_alert_event\n # TODO: clean out selected item details\n display_items\n end",
"def fetch_more?(options, resp)\n page_size = options[:_pageSize] || options['_pageSize']\n\n return unless page_size && resp.is_a?(Array)\n resp.pop while resp.length > page_size\n\n resp.length < page_size\n end",
"def display_alerts\n @queue.alerts.each do |alert|\n clear_line\n\n message = alert.kind_of?(HighTrafficAlert) ? alert.message.red : alert.message.green\n print \"[ALERT]\\t#{message}\\n\"\n end\n end"
] | [
"0.6236559",
"0.62298495",
"0.59650147",
"0.5909893",
"0.5829572",
"0.57904965",
"0.57714844",
"0.5761191",
"0.575035",
"0.5750261",
"0.57377535",
"0.5633875",
"0.5598365",
"0.55437165",
"0.55178237",
"0.55099726",
"0.5477545",
"0.547445",
"0.5454355",
"0.5425227",
"0.5419196",
"0.5409375",
"0.53668725",
"0.5362561",
"0.53436285",
"0.5309298",
"0.5299825",
"0.5297779",
"0.5270791",
"0.52643365",
"0.52591354",
"0.52261686",
"0.5207114",
"0.51756626",
"0.5172908",
"0.51616377",
"0.51429355",
"0.51429355",
"0.5131358",
"0.5131303",
"0.5088848",
"0.5084736",
"0.50682235",
"0.5065427",
"0.5060552",
"0.5059718",
"0.505799",
"0.504499",
"0.5038422",
"0.50365365",
"0.5036408",
"0.5034968",
"0.5019654",
"0.501196",
"0.501196",
"0.501196",
"0.5009063",
"0.5007442",
"0.49969476",
"0.49884552",
"0.49779248",
"0.49736434",
"0.49664348",
"0.49658012",
"0.49464047",
"0.4940143",
"0.49398488",
"0.49322382",
"0.49297264",
"0.4929407",
"0.49279135",
"0.49217024",
"0.49047402",
"0.49045223",
"0.49033663",
"0.4900909",
"0.4899405",
"0.4899405",
"0.48991257",
"0.48991257",
"0.48991257",
"0.4899105",
"0.48963314",
"0.4888184",
"0.4876506",
"0.48760042",
"0.48718074",
"0.48711544",
"0.48649934",
"0.48582903",
"0.4857413",
"0.4850589",
"0.4850355",
"0.48493862",
"0.4840358",
"0.4830088",
"0.48097447",
"0.48059037",
"0.48028976",
"0.48027876",
"0.48025185"
] | 0.0 | -1 |
Whether to show unread message notifications first (only used if groupbysection is set). | def alertunreadfirst()
merge(notalertunreadfirst: 'true')
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def messageunreadfirst()\n merge(notmessageunreadfirst: 'true')\n end",
"def unreadfirst()\n merge(notunreadfirst: 'true')\n end",
"def first_unread_message\n gmail.inbox.find(:unread).find do |email|\n email.to[0].mailbox.include? 'performance_group'\n end\n end",
"def unread_unsent_notifications_for_group\n @unread_unsent_notifications_for_group ||= unread_unsent_notifications.where('notify_user_notifications.group_id = ?', notification.group_id)\n end",
"def unread_by(user)\n self.includes(:chat_participations, :messages).where([\n \"(chat_participations.read_at < messages.created_at OR chat_participations.read_at IS NULL)\\\n AND chat_participations.user_id = :user_id AND messages.user_id <> :user_id\",\n {user_id: user.id}]).order(\"messages.created_at DESC\")\n end",
"def set_unread\n render :text => \"\", :layout => false\n end",
"def unread\n @notifications = Notification.where(user_id: current_user.uid).where(is_read: false).page(params[:page]).order(created_at: :desc)\n end",
"def unread_by?(user)\n received_message.try(:unread?) || replies.map { |r|\n r.received_message if r.recipient == user\n }.compact.any?(&:unread?)\n end",
"def unread?\n read_at.nil?\n end",
"def sort_unpinned\n if @guardian.current_user && @all_topics.present?\n @categories.each do |c|\n next if c.displayable_topics.blank? || c.displayable_topics.size <= c.num_featured_topics\n unpinned = []\n c.displayable_topics.each do |t|\n unpinned << t if t.pinned_at && PinnedCheck.unpinned?(t, t.user_data)\n end\n unless unpinned.empty?\n c.displayable_topics = (c.displayable_topics - unpinned) + unpinned\n end\n end\n end\n end",
"def unread_notifications\n notifications_received.where('activities.created_at > ?', notifications_checked_at)\n end",
"def unread_conversations\n my_conversations.joins(:messages).where('messages.created_at > COALESCE(conversation_members.last_seen, conversation_members.created_at)').uniq\n end",
"def any_unread? usr\n ConversationProcessor.new(self).any_unread? usr\n end",
"def multi_message?\n return notify_on == \"always\"\n end",
"def unread_items (options = {})\n order = options[:order] || :hottest\n raise \"Invalid ordering '#{order.to_s}' on unread items\" if !SORTING_STRATEGIES.key?(order)\n items.sort_by { |i| SORTING_STRATEGIES[order].call(i, self) }\n end",
"def inbox\n user_sent = Message.where(user_id: current_user, group_id: nil, show_user: true)\n user_received = Message.where(recipient_id: current_user, show_recipient: true)\n @messages = (user_sent + user_received).sort{|a,b| a.created_at <=> b.created_at }\n end",
"def topics_unread_comments(group_id, viewed = 0, page = 1, sort = 'updated_at', order = 'a')\n\t\t\tif ['comments_count', 'title', 'updated_at', 'views'].include?(sort) && ['a', 'd'].include?(order)\n\t\t\t\toptions = {\"viewed\" => viewed, \"page\" => page, \"sort\" => sort, \"order\" => order}\n\t\t\telse\n\t\t\t\tputs \"NOTICE: invalid sorting parameters entered. reverting to defults.\"\n\t\t\t\toptions = {\"viewed\" => viewed, \"page\" => page}\n\t\t\tend\n\t\t\tdata = oauth_request(\"/topic/unread_group/#{group_id}\", options)\n\t\t\tHashie::Mash.new(data)\n\t\tend",
"def unread_discussions\n discussions.find_unread_by(self)\n end",
"def unread?\n return (self.status == Email::STATUS_UNREAD)\n end",
"def unread? user_id\n !unread_messages(user_id).blank?\n end",
"def is_unread?\n !is_read\n end",
"def is_unread?\n !is_read\n end",
"def is_unread?\n !is_read\n end",
"def load_notifications\n \t\tif current_user\n \t\t\t@notifications = current_user.notifications.limit 5\n \t\t\t@unseen_notifications_count = current_user.notifications.unseen.count\n \t\tend\n \tend",
"def unread\n all(UNREAD)\n end",
"def unread_notifications_since_last_read\n notification.class.for_target(notification.target)\n .where(group_id: notification.group_id)\n .where(read_at: nil)\n .where('notify_user_notifications.created_at >= ?', last_read_notification.try(:read_at) || 24.hours.ago)\n .where.not(id: notification.id)\n .order(created_at: :desc)\n end",
"def set_unread_message_count\n self.unread_messages = 1\n end",
"def unread_unsent_notifications\n @unread_unsent_notifications ||= notification.class.for_target(notification.target)\n .joins(:deliveries)\n .where.not(id: notification.id)\n .where('notify_user_notifications.read_at IS NULL AND notify_user_deliveries.sent_at IS NULL')\n end",
"def has_unread_messages?(user)\n latest_message = self.last_message\n if latest_message\n chat_participation = self.chat_participations.where(user_id: user.id).first\n chat_participation.try(:unread_message?, latest_message)\n end\n end",
"def unread?\n self.status == 'unread'\n end",
"def unread?\n !read?\n end",
"def unread?\n !read?\n end",
"def mark_read_messages(conversation)\n time = Time.current\n conversation = Conversation.find(conversation) if conversation.is_a?(Integer)\n conversation_members.where(conversation_id: conversation).update_all(last_seen: time)\n Rails.cache.delete(conversation.get_unread_cache_key_for(id))\n Rails.cache.delete(\"user-unread_messages_count-#{id}\")\n PubSub::Publisher.new.publish_for(conversation.user_participants.where.not(id: id), 'read_messages', {id: conversation.id, seen_at: time.to_i, user_id: id}, {foreground: true})\n end",
"def load_unread_comments\n @unread_comments = Comment.unread_by(current_user)\n if current_user.student?\n @unread_comments = @unread_comments.select do |comment| \n comment_parent = comment.commentable_type.classify.constantize.find(comment.commentable_id)\n comment_parent_type = comment.commentable_type.underscore\n if comment_parent_type == \"school_day\"\n comment_parent.calendar_date <= Date.today\n else\n comment_parent.school_days.order(\"calendar_date\")[0].calendar_date <= Date.today if !comment_parent.school_days.empty?\n end\n end\n end\n @unread_comments.sort_by!(&:created_at).reverse!\n end",
"def has_notify?(forum)\n current_forum = Forum.find(forum)\n if current_forum.messages.count > this.current_length\n this.display = true\n end\n end",
"def unread\n @notifications = current_user.notifications.unread.page(params[:page]).per(5)\n end",
"def unread_messages\n @user_wise_unread_messages = current_user.user_messages\n .where(is_read: false)\n .joins(:message)\n .group('messages.user_id').count\n end",
"def retrieve_notifications\n\tunread = self.notifications.where(\"read = ?\", false).order(\"created_at DESC\")\n\t\n\tif unread.count < 10\n\t\tread = self.notifications.where(\"read = ?\", true).order(\"created_at DESC\").limit(10 - unread.count)\n\t\t\n\t\tunread = unread.concat(read)\n\tend\n\t\n\treturn unread\n end",
"def fetch_unread_items(folder)\n item_view = ItemView.new(10) # FIXME: some huge number like 5000, but the JS app is too slow for that\n item_view.property_set = EMAIL_SUMMARY_PROPERTY_SET\n folder.find_items(SearchFilter::IsEqualTo.new(EmailMessageSchema::IsRead, false), item_view).items.to_a\n end",
"def unread\n un_read(false, \"non lue\")\n end",
"def groupbysection()\n merge(notgroupbysection: 'true')\n end",
"def message_notification\n fetch(:hipchat_announce, false)\n end",
"def notifications(options = {})\n #:type => nil is a hack not to give Messages as Notifications\n notifs = Mailboxer::Notification.recipient(messageable).where(:type => nil).order(\"mailboxer_notifications.created_at DESC\")\n if options[:read] == false || options[:unread]\n notifs = notifs.unread\n end\n\n notifs\n end",
"def unread?\n (status == UNREAD)\n end",
"def unread?\n !read?\nend",
"def mark_unread!\n update_is_read_status false\n end",
"def notifications_count\n notifications_count ||= self.notifications_to_show_user.where(:seen_by_user => false).count\n end",
"def notify_daily_summary\n settings.fetch('notifications',{}).fetch('daily_summary', true)\n end",
"def notifications(options = {})\n scope = MessageCenter::Notification.recipient(messageable).order(:created_at => :desc)\n if options[:read] == false || options[:unread]\n scope = scope.unread\n end\n\n scope\n end",
"def has_unread?\n Message.any_in(conversation_id: conversations.map(&:id)).ne(read_by: id).present?\n end",
"def status_sort\n user_id_giver and user_id_receiver ? 1 : 2\n end",
"def responding_messages_delivery_with_no_responses(channel = nil, channel_group = nil)\n delivery_notices = DeliveryNotice.includes(:message)\n delivery_notices = delivery_notices.where(channel: channel) if channel\n delivery_notices = delivery_notices.where(channel_group: channel_group) if channel_group\n delivery_notices.where(subscriber_id: potential_subscriber_ids)\n .where(tparty_identifier: to_phone)\n .where(\"messages.type\" => Message.responding_message_types)\n .order(:created_at)\n .select { |dn|\n last_sr = dn.message.subscriber_responses.order(:created_at).last\n last_sr.nil? || last_sr.created_at < dn.created_at\n }\n end",
"def has_unread_messages?\n received_messages.count > 0\n end",
"def unread_messages\n current_user.messages_in.where(read: false).count\n end",
"def load_notifications\n # reload user data\n user = User.find current_user.id\n @notifications = user.notifications.order(\"updated_at DESC\")\n\n new_feeds = user.notification_readers.select {|feed| !feed.isRead?}\n new_feeds.each do |feed|\n feed.read_at = Time.zone.now\n feed.save!\n end\n end",
"def seen\n if @ok\n @ok = @notification.has_been_seen\n end\n @new_notifications = current_user.number_notifications_not_seen\n end",
"def read_messages!(user)\n if has_unread_messages?(user)\n user.reset_unread_chats_count\n self.chat_participations.where(user_id: user.id).first.try(:read_messages!)\n end\n end",
"def mark_as_unread\n @client.post('/api/mod/conversations/unread', conversationIds: [get_attribute(:id)])\n end",
"def new_message_check\n if(!current_user.nil?)\n ids = Message.where(user_received_id: current_user.id, read: false).pluck(:user_sent_id).uniq\n if ids.count > 0\n ids = Message.where(user_received_id: current_user.id, read: false).pluck(:user_sent_id).uniq\n render text: '{\"unread\":\"true\", \"ids\":[' + ids.join(',') + ']}'\n else\n render text: '{\"unread\":\"false\"}'\n end\n else \n render text: '{\"unread\":\"false\"}'\n end\n end",
"def unread_topics user\r\n topics.find_all{|topic| topic.unread_comment?(user) }\r\n end",
"def load_notifications\n if user_signed_in?\n @all_notifications = current_user.get_notifications\n @notifications = @all_notifications.first(10)\n @count = current_user.unread_notifications_count\n end\n end",
"def check_for_messages\n @message_unviewed = Message.all(:recipient_id => current_user.id, :viewed => false, :opportunity => Opportunity.all(:active => true))\n if @message_unviewed != []\n flash.now[:warning] = 'You have unread messages'\n end\n end",
"def index\n @all_notifications = Notification.order(from_type: \"asc\", readed: \"asc\")\n end",
"def mark_notifications_read\n return if params[:notification_id].blank? or !user_signed_in?\n n = Notification.find(params[:notification_id])\n current_subject.mark_as_read n\n end",
"def index\n\n @users_with_conversation = []\n @messages = Message.where(receiver_id: params[:user_id]).reverse_order\n @new_messages = @messages.where(unread: true)\n @messages.each do |message|\n unless @users_with_conversation.include?(message.sender)\n @users_with_conversation.push(message.sender)\n end\n end\n @messages = Message.all\n end",
"def is_unread?(participant)\n return false if participant.nil?\n !receipt_for(participant).first.is_read\n end",
"def any_unread? usr\n @conv.posts.each do |post| \n if post.unread?(usr) && post.recipient_id == usr.id\n return true\n end\n end\n return false\n end",
"def arrange_single_notification_index(loading_index_method, options = {})\n as_latest_group_member = options[:as_latest_group_member] || false\n as_latest_group_member ?\n loading_index_method.call(options).map{ |n| n.latest_group_member } :\n loading_index_method.call(options).to_a\n end",
"def mark_as_unread()\n update_attribute('read', false)\n end",
"def load_all_unread\n @all_unread = []\n material_type_list.each do |material_hash|\n material_type = material_hash[:name]\n if material_type != \"school_day\"\n unread_materials = material_type.classify.constantize.unread_by(current_user)\n if current_user.admin?\n filtered_unread_materials = unread_materials\n else\n filtered_unread_materials = unread_materials.select do |material| \n !material.school_days.empty? && !material.school_days.nil? && material.school_days.order(\"calendar_date\")[0].calendar_date <= Date.today\n end\n end\n @all_unread += filtered_unread_materials\n end\n end\n @all_unread.sort_by!(&:updated_at).reverse!\n end",
"def mark_as_unread(options = {})\n default_options = {:conditions => [\"mail_items.mailbox != ?\",@user.mailbox_types[:sent].to_s]}\n add_mailbox_condition!(default_options, @type)\n return update_mail(\"mail_items.read = false\", default_options, options)\n end",
"def show_messages(uids)\n return if uids.nil? or (Array === uids and uids.empty?)\n\n fetch_data = 'BODY.PEEK[HEADER.FIELDS (DATE SUBJECT MESSAGE-ID)]'\n messages = imap.fetch uids, fetch_data\n fetch_data.sub! '.PEEK', '' # stripped by server\n\n messages.each do |res|\n puts res.attr[fetch_data].delete(\"\\r\")\n end\n end",
"def unread_messages\n @attributes[\"unread_messages\"]\n end",
"def unread\n read_attribute(:unread)\n end",
"def read?(_user_id)\n conversation.conversation_members.where(user_id: _user_id).take.last_seen > created_at\n end",
"def unread_message_count(current_user)\n \tself.messages.where(\"user_id != ? AND read = ?\", current_user.id, false).count\n \tend",
"def unread_messages user_id\n messages.unread(user_id)\n end",
"def mark_all_readed\n doctor.notifications.update_all unreaded: false\n send_json doctor.notifications, true\n end",
"def call\n all_private_conversations = Private::Conversation.all_by_user(@user.id)\n .includes(:messages)\n all_group_conversations = @user.group_conversations.includes(:messages)\n all_conversations = all_private_conversations + all_group_conversations\n\n ##filtered_conversations = []\n\n ##all_conversations.each do |conv|\n ## empty_conversations << conv if conv.messages.last\n ##end\n\n ##filtered_conversations = filtered_conversations.sort{ |a, b|\n ## b.messages.last.created_at <=> a.messages.last.created_at\n ##}\n\n return all_conversations\n end",
"def display_notif_unseen(usr_id)\n num = PublicActivity::Activity.where(is_seen: false, owner_id: usr_id, owner_type: \"User\").count\n return num if num > 0\n return \"\" # Else return blank string\n end",
"def read_messages\n @useConversations = Message.where(\"user_id = (?)\", current_user.id).pluck(:conversation_id)\n if @useConversations.count > 0\n @useConversations = @useConversations.uniq # Unique\n @useConversations = @useConversations.map(&:inspect).join(', ')\n #@updatemsg = Message.where(\"user_id != (?) and conversation_id IN (?)\", current_user.id, @useConversations).update_all(:mark_as_read => true)\n @updatemsg = Message.where(\"user_id != #{current_user.id} and conversation_id in (#{@useConversations})\").update_all(:mark_as_read => true)\n session[:mark_messages] = 0 # Mark as read messages\n end\n end",
"def index\n @messages = current_user.is_support? ? Message.where(message_id: nil).order(\"support_call desc, updated_at desc\").includes(:replies).all : Message.where(user_id: current_user.id, message_id: nil).order(\"user_call desc, updated_at desc\").includes(:replies).all\n end",
"def show\n @message = current_user.messages.find(params[:id])\n @message.mark_as_unread\n end",
"def index\n\t\t@notifications = Notification.where(recipient_id: current_user.id).unread\n\tend",
"def read_notifications\n # Update post notification\n post_notification = @message.sender\n .notifications_unread\n .where(\"origin_type = ? AND origin_id = ?\", 'Post', @post.id)\n .first\n post_notification.update_attributes(read: true) unless post_notification.nil?\n\n # Update post's messages notifications\n @post.messages.each do |message|\n message_notification = @message.sender\n .notifications_unread\n .where(\"origin_type = ? AND origin_id = ?\", 'Message', message.id)\n .first\n message_notification.update_attributes(read: true) unless message_notification.nil?\n end\n end",
"def update_message_state!(line)\r\n if line[/^\\s*Notifications-Count\\s*:\\s*(\\d+)/i]\r\n @sections_left += $1.to_i\r\n end\r\n if line[/^.+:\\s*x-growl-resource:/i]\r\n @sections_left += 1\r\n end\r\n if line.empty?\r\n @sections_left -= 1\r\n end\r\n #puts line\r\n #puts \"Note: #{@sections_left} more sections\"\r\n end",
"def all_unread_broadcast_messages(period_data = nil)\n res = across_messages.joins(:conversation)\n .joins('LEFT JOIN \"conversation_members\" ON \"conversations\".\"id\" = \"conversation_members\".\"conversation_id\"')\n .where('messages.created_at > COALESCE(conversation_members.last_seen, conversation_members.created_at)')\n .where('conversation_members.user_id != broadcast_messages.user_id')\n .uniq\n return res unless period_data\n range, daily_report = period_data.to_s.report_period_to_range\n range.map{|d| [d.strftime(daily_report ? '%d' : '%Y-%m'), res.where(broadcast_messages: {created_at: d.beginning_of_day..(daily_report ? d.end_of_day : d.end_of_month.end_of_day)}).count('messages.id')] }.to_h\n end",
"def notification_groups_mark_all_as_read(opts = {})\n data, _status_code, _headers = notification_groups_mark_all_as_read_with_http_info(opts)\n data\n end",
"def mark_as_unread(participant)\n return if participant.nil?\n return self.receipts_for(participant).mark_as_unread\n end",
"def unread_messages_count\n @unread_messages_count ||= messages.unread.count\n end",
"def show\n @messages = @conversation.messages.sort_by(&:updated_at)\n @messages.each do |m|\n (m[:viewed] = true) && m.save if m.viewed == false && @current_user.id != m.author\n end\n end",
"def get_notifications\n \t\n \t@notifs = []\n\n \tif current_user\n @notifs = Notification.where(:user_id => current_user.id, :seen => false)\n \tend\n end",
"def should_update_inbox_unread_count!\n i = mailbox.inbox.unread(self).pluck(\"distinct conversations.id\").size\n update_attributes(inbox_unread_count: i) if i != inbox_unread_count\n end",
"def index\n @notifications = current_user.notifications.unread.page(params[:page]).per(20)\n end",
"def unread\n home\n #@dirmesg = TDirmessage.select(\"m_users.user_name,t_dirmessages.dir_message,t_dirmessages.created_at\")\n #.joins(\"join m_users on m_users.user_id=t_dirmessages.sender_user_id\")\n #.where(\"dirworkspace_id=? and ((receiver_user_id=? and sender_user_id=?)||(t_dirmessages.receiver_user_id=? and t_dirmessages.sender_user_id=?))\", session[:workspace_id], session[:user_id], params[:clickuserid], params[:clickuserid], session[:user_id]).order(\"t_dirmessages.created_at ASC\")\n @clickchannel = MChannel.find_by(\"channel_id=?\", session[:clickchannel_id])\n\n @m_clickchuser = MUser.joins(\"join m_channels on m_channels.user_id=m_users.user_id\")\n .where(\"m_channels.channel_name=? and m_channels.workspace_id=?\", session[:clickchannel_name], session[:workspace_id])\n\n @dirmsg = TDirmessage.select(\"m_users.user_name,t_dirmessages.dir_message,t_dirmessages.created_at\")\n .joins(\"join m_users on m_users.user_id=t_dirmessages.sender_user_id\")\n .where(\"dirworkspace_id=? and receiver_user_id=? and is_read=true\", session[:workspace_id], session[:user_id])\n @chmesg = TChannelMessage.select(\"m_channels.channel_name ,m_users.user_name ,t_channel_messages.chmessage,t_channel_messages.created_at\")\n .joins(\"join m_users on t_channel_messages.chsender_id=m_users.user_id join t_chunread_messages on t_chunread_messages.chmsg_id=t_channel_messages.chmsg_id join m_channels on m_channels.channel_id=t_channel_messages.channel_id\")\n .where(\"t_chunread_messages.is_read =true and t_chunread_messages.chuser_id=? and m_channels.user_id=? and m_channels.workspace_id=? \", session[:user_id], session[:user_id], session[:workspace_id])\n end",
"def group_notifications\n @attributes[:group_notifications]\n end",
"def unread_messages(user)\n Rails.cache.fetch(\"#{cache_key_with_version}/unread_messages/#{user.id}\") do\n Message.unread_by(user).where(chat_room: self).where.not(user: user).to_a\n end\n end",
"def mark_as_unread(participant)\n return if participant.nil?\n receipt_for(participant).mark_as_unread\n end",
"def get_mails\n gmail = Gmail.connect @current_user.login, @current_user.password\n return nil unless gmail.logged_in?\n\n mails = gmail.inbox.find :unread, after: @filter_date + 1\n sent_mails = gmail.label(\"[Gmail]/Sent Mail\").find(afetr: @filter_date + 1)\n sent_mails.each { |e| mails << e }\n mails.sort_by!(&:date)\n\n end",
"def only_show_summary?\n\t\tcount = 0\t\n\t\t[\"payable_from_organization_id\",\"payable_to_organization_id\",\"payable_from_patient_id\"].each do |k|\n\t\t\tcount+=1 unless self.send(k.to_sym).blank?\n\t\tend\n\t\tcount <= 1\n\tend"
] | [
"0.71720797",
"0.6777947",
"0.63756937",
"0.60128605",
"0.58948237",
"0.55301636",
"0.55196303",
"0.55063695",
"0.54435074",
"0.53889734",
"0.5360408",
"0.5358087",
"0.53355694",
"0.5327617",
"0.5326357",
"0.5317087",
"0.53119147",
"0.5297274",
"0.52712506",
"0.52646446",
"0.52566755",
"0.52566755",
"0.52566755",
"0.5255261",
"0.52478415",
"0.52053934",
"0.51747745",
"0.5174747",
"0.5171256",
"0.51649356",
"0.51605916",
"0.5151486",
"0.5141629",
"0.5121727",
"0.51180863",
"0.51160073",
"0.51119226",
"0.51022404",
"0.50961876",
"0.50549483",
"0.5039934",
"0.5032574",
"0.5027832",
"0.5026411",
"0.5021087",
"0.50036526",
"0.49982435",
"0.4989796",
"0.49865022",
"0.4982887",
"0.4962995",
"0.49547702",
"0.4951323",
"0.49337825",
"0.4923017",
"0.49030134",
"0.48987532",
"0.4898723",
"0.48894233",
"0.48890343",
"0.4888557",
"0.488685",
"0.4886325",
"0.4885109",
"0.48801664",
"0.48568767",
"0.48419598",
"0.48299628",
"0.48290527",
"0.4808899",
"0.4808342",
"0.48016357",
"0.48012328",
"0.4797462",
"0.47920612",
"0.4772564",
"0.47701314",
"0.47692186",
"0.47669688",
"0.47617066",
"0.47537634",
"0.47478718",
"0.47465476",
"0.4746072",
"0.47460172",
"0.4724801",
"0.4724303",
"0.47219273",
"0.47173575",
"0.47167328",
"0.47146577",
"0.47096658",
"0.47064856",
"0.47025594",
"0.4698826",
"0.46980742",
"0.46957383",
"0.46933293",
"0.46756616",
"0.46706498"
] | 0.68281925 | 1 |
When more message results are available, use this to continue. | def messagecontinue(value)
merge(notmessagecontinue: value.to_s)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def more_messages\n log \"Getting more_messages\"\n log \"Old start_index: #@start_index\"\n max = @start_index - 1\n @start_index = [(max + 1 - @limit), 1].max\n log \"New start_index: #@start_index\"\n fetch_ids = search_query? ? @ids[@start_index..max] : (@start_index..max).to_a\n log fetch_ids.inspect\n message_ids = fetch_and_cache_headers(fetch_ids)\n res = get_message_headers message_ids\n with_more_message_line(res)\n end",
"def poll!\n find_and_process_next_available(messages)\n end",
"def message_results\n @message_results\n end",
"def next_message; end",
"def next_message; end",
"def collect_results\n while collect_next_line; end\n end",
"def more_messages(message_id, limit=100)\n log \"More_messages: message_id #{message_id}\"\n message_id = message_id.to_i\n if @all_search \n x = [(message_id - limit), 0].max\n y = [message_id - 1, 0].max\n\n res = fetch_row_text((x..y))\n add_more_message_line(res, x)\n else # filter search query\n log \"@start_index #@start_index\"\n x = [(@start_index - limit), 0].max\n y = [@start_index - 1, 0].max\n @start_index = x\n res = fetch_row_text(@ids[x..y]) \n add_more_message_line(res, @ids[x])\n end\n end",
"def fetch_more\n $limit += 5\n $offset_counter = ($offset_counter >= 5? $offset_counter - 5: 0)\n @room_messages = (@room.room_messages.includes(:user).order(:id).limit($limit).offset($offset_counter)).to_a.reverse()\n end",
"def on_message_complete\n @currently_reading.finish_reading! if @currently_reading.is_a?(Request)\n\n if @currently_responding\n @pending_responses << @currently_reading\n else\n @currently_responding = @currently_reading\n end\n\n @currently_reading = @pending_reads.shift\n end",
"def pump_results!\n loop do\n distribute_results!\n end\n end",
"def load(number_of_messages)\n loaded_messages = count_loaded_messages\n while loaded_messages < number_of_messages\n message_thread = find_message_thread\n item = check_and_find_first(message_thread, message_thread_elements_css, wait: 5)\n scroll_up_to(item)\n sleep(4)\n return loaded_messages if loaded_messages == count_loaded_messages\n\n loaded_messages = count_loaded_messages\n end\n loaded_messages\n end",
"def done?\n @options[:num] && @messages.size >= @options[:num]\n end",
"def distribute_results!\n response = JSON.parse(@socket.readline)\n\n if response[\"event\"]\n @event_queue << response\n else\n @result_queue << response\n end\n rescue StandardError\n @alive = false\n Thread.exit\n end",
"def process_msgs\n end",
"def complete_result?\n @result_count < 1000\n end",
"def while_results(&block)\n loop do\n results = get![:results]\n break if results.nil? || results.empty?\n results.each(&block)\n end\n end",
"def process_results(results)\n\n if results.length > 5\n return \"More than 5 results, please be more specific.\"\n elsif results.length == 0\n return \"No runs found.\"\n end\n return make_reply(results)\n\nend",
"def fetch\n messages = @connection.uid_search(['ALL'])\n RAILS_DEFAULT_LOGGER.info \"MESSAGES Found? [#{messages.size}]\"\n RAILS_DEFAULT_LOGGER.info \"MESSAGE UIDS #{messages.inspect}\"\n\n if messages.size > @index\n RAILS_DEFAULT_LOGGER.info \".. Fetching INDEX [#{@index}] ...\"\n @index += 1\n result = process_upload(messages[@index - 1])\n return result\n else\n return nil end\n end",
"def check_for_new_messages\n messages = twitter.direct_messages(:since_id => last_message_retrieved)\n @num_messages = messages.length\n end",
"def batch_messages_for_page messages, filter, request_format\n logger.info \"Getting a new page of messages\"\n\n messages.each do |message|\n filter.add(api_method: $gmail_api.users.messages.get,\n parameters: {userId: 'me', id: message.id, format: request_format})\n end\n\n begin\n filtered_message_list(filter) unless messages.empty?\n rescue StandardError => error\n puts \"*** Error : #{error.message}\"\n puts \"*** #{error.backtrace.join(\"\\n\")}\"\n\n retry if retry_it?\n end\n end",
"def process_messages\n @messages.pop do |channel, message|\n Fiber.new do\n on_message(channel, message)\n process_messages\n end.resume\n end\n end",
"def more_results?()\n #This is a stub, used for indexing\n end",
"def enquiries\n messages = CustomMessage.includes(:sent_messageable, :documentable).where(received_messageable: @user, ancestry:nil)\n messages = messages.limit(params[:limit])\n\n if messages\n @message_parents = messages\n else\n @object = \"Message\"\n render \"api/v1/errors/404\", status: 404\n end\n end",
"def buffered_messages; end",
"def get_messages\n @connection.search(@filter).each do |message|\n body = @connection.fetch(message, \"RFC822\")[0].attr[\"RFC822\"]\n begin\n @processor.process(body)\n rescue StandardError => error\n Mailman.logger.error \"Error encountered processing message: #{message.inspect}\\n #{error.class.to_s}: #{error.message}\\n #{error.backtrace.join(\"\\n\")}\"\n next\n end\n @connection.store(message, \"+FLAGS\", @done_flags)\n end\n # Clears messages that have the Deleted flag set\n @connection.expunge\n end",
"def process_next_message\n @subscriptions.each_pair do |channel, session|\n queue = session[:queue]\n message = next_message_from(queue)\n\n process(channel, message) if message\n end\n end",
"def on_message_complete\n @finished = true\n end",
"def nextResults\n # Update results\n updateResults(@nextURI)\n\n # Update nextURI\n updateNextURI\n end",
"def fetch_loop\n send(\n consumer_group.batch_consuming ? :consume_each_batch : :consume_each_message\n ) { |messages| yield(messages) }\n rescue Kafka::ProcessingError => e\n # If there was an error during processing, we have to log it, pause current partition\n # and process other things\n Karafka.monitor.notice_error(self.class, e.cause)\n pause(e.topic, e.partition)\n retry\n # This is on purpose - see the notes for this method\n # rubocop:disable RescueException\n rescue Exception => e\n # rubocop:enable RescueException\n Karafka.monitor.notice_error(self.class, e)\n retry\n end",
"def get_next_message\n return @mailer.get_next_message\n end",
"def new_messages\n kafka_client.fetch.tap do |messages|\n log_message_stats(messages)\n end\n rescue Poseidon::Errors::UnknownTopicOrPartition\n log \"Unknown Topic: #{topic}. Trying again in 1 second.\", :warn\n sleep(1)\n return [] if stopping?\n retry\n rescue Poseidon::Connection::ConnectionFailedError\n log \"Can not connect to Kafka at #{host}:#{port}. Trying again in 1 second.\", :warn\n sleep(1)\n return [] if stopping?\n retry\n end",
"def work(message)\n if message.is_a?(Message)\n self.count = count + 1\n\n Concurrent::IVar.new(:ok)\n else\n expected_messages_received?\n end\n end",
"def results\n send_query\n end",
"def process_messages\n sleep 0.05\nend",
"def process_messages\n # Check status for all streams, reopen as necessary\n @streams.each { |_, stream| try { stream.keep_alive } }\n\n # Actual processing of incoming messages happens in event callbacks\n # Oбрабатываем пришедшее сообщение в интерфейсах обратного вызова\n @conn.ProcessMessage2(100)\n end",
"def results\n send_query\n end",
"def replies\n options = {}\n if params[:per_page]\n options[:limit] = params[:per_page].to_i\n if params[:page] && params[:page].to_i >= 1\n options[:offset] = params[:per_page].to_i * (params[:page].to_i-1)\n end\n end\n options[:conditions] = {:channel_id => @channel.id, :reference_to => @message.id }\n sort_order = 'DESC'\n if params[:sort_order]\n if params[:sort_order] == 'ascending'\n sort_order = 'ASC'\n elsif params[:sort_order] == 'descending'\n sort_order = 'DESC'\n end\n end\n options[:order] = 'updated_at ' + sort_order\n @messages = Message.all(options)\n size = Message.count(:conditions => options[:conditions])\n\n render_json :entry => @messages, :size => size and return\n end",
"def wait_for_results\n wait_until(Config.medium_wait) { elements(result_rows).any? }\n end",
"def show_new_messages\r\n @topics = Topic.paginate :conditions => [\"last_post > ?\", @usr.last_visit], :page => params[:page], :per_page => Configs.get_config('topperpage'), :order => 'last_post DESC'\r\n if @topics.empty?\r\n redirect_to_info_page t(:redir)\r\n return \r\n end\r\n end",
"def received_messages(page = 1)\n _received_messages.paginate(:page => page, :per_page => MESSAGES_PER_PAGE)\n end",
"def handle_ack_msg( their_msg )\r\n begin\r\n if their_msg.startup_ack\r\n super\r\n send_next_case\r\n warn \"Started, shouldn't see this again...\" if self.class.debug\r\n return\r\n end\r\n if their_msg.result\r\n self.class.lookup[:results][their_msg.result]||=0\r\n self.class.lookup[:results][their_msg.result]+=1\r\n if their_msg.result=='crash' and their_msg.crashdetail\r\n crashdetail=their_msg.crashdetail\r\n self.class.lookup[:buckets][DetailParser.hash( crashdetail )]=true\r\n # You might want to clear this when outputting status info.\r\n self.class.queue[:bugs] << DetailParser.long_desc( crashdetail )\r\n # Just initials - NOT EXPLOITABLE -> NE etc\r\n classification=DetailParser.classification( crashdetail).split.map {|e| e[0]}.join\r\n self.class.lookup[:classifications][classification]||=0\r\n self.class.lookup[:classifications][classification]+=1\r\n end\r\n else\r\n # Don't cancel the ack timeout here - this is the first ack\r\n # We wait to get the full result, post delivery.\r\n super\r\n send_next_case\r\n end\r\n rescue\r\n raise RuntimeError, \"#{COMPONENT}: Unknown error. #{$!}\"\r\n end\r\n end",
"def fetch_messages(opts = {}, &block)\n tweets = if opts[:search]\n @client.search(\"#{opts[:search]} -rt\")\n else\n @client.mentions_timeline\n end\n\n tweets.each do |tweet|\n message_data = {\n :id => tweet[:id],\n :source => 'twitter',\n :title => tweet[:text],\n :body => tweet[:text],\n :sender_name => tweet[:user][:name],\n :sender => tweet[:user][:screen_name]\n }\n\n block.call Message.build(message_data)\n end\n end",
"def process\n caption = response_text\n channel = channel_by_keyword\n channel_group = channel_group_by_keyword\n\n if channel || channel_group\n tmp = response_text.split\n tmp.shift\n caption = tmp.join(\" \")\n end\n\n delivery_notice = nil\n dn_responding_message_unconfigured = nil\n responding_messages_delivery = responding_messages_delivery_with_no_responses(channel, channel_group)\n\n responding_messages_delivery.each do |dn|\n unless dn.message.check_subscriber_response(response_text)\n dn_responding_message_unconfigured = dn\n next\n end\n delivery_notice = dn\n break\n end\n\n delivery_notice ||= dn_responding_message_unconfigured\n delivery_notice ||= last_sent_relevant_delivery(channel, channel_group)\n\n process_delivery_notice(\n delivery_notice,\n caption: caption,\n channel: channel,\n channel_group: channel_group,\n )\n end",
"def process_result tweet\n @total_results += 1\n \n begin\n # return right away if we have already processed this tweet\n return if Vote.find_by_tweet_id( tweet.tweet_id )\n vote = create_vote_from_tweet(tweet)\n send_vote_reply( vote )\n send_poll_results( vote ) if results_reply\n @new_results += 1\n @voter_ids << tweet.from_user\n rescue InvalidVoteError\n send_error_reply( tweet, $!.to_s )\n # The users vote is invalid. TODO: send a tweet back to them indicating the error.\n logger.info \"** Invalid Vote: #{$!.inspect}\"\n logger.info \"** Vote Contents: #{tweet.inspect}\"\n rescue ActiveRecord::StatementInvalid\n if $!.to_s =~ /Mysql::Error: Duplicate entry/\n begin\n Mailer.deliver_exception_notification $!, \"Vote must have been created by another thread.\"\n rescue Errno::ECONNREFUSED\n logger.error( \"Could not connect to mail server.\")\n end \n end\n end\n end",
"def wait_for_message\r\n Fiber.yield while $game_message.busy?\r\n end",
"def new_message\n @new_message = false\n @message_num = 0\n @new_requests = Array.new\n if !current_user.nil?\n @current_user_profile = UserProfile.find(current_user.id)\n @user_name = @current_user_profile.username\n # checking if there are importance request message?\n @current_user_profile.items.each do |it|\n it.borrow_requests.each do |req|\n if !req.read_status\n @new_message = true\n @message_num = @message_num + 1\n @new_requests << req.id\n #flash[:notice] = \"You have new requset\"\n elsif req.return_status == 0 && req.borrow_date <= Date.today && req.approval\n @new_message = true\n @message_num = @message_num + 1\n @new_requests << req.id\n #flash[:notice] = \"have items need to be deliverd today\"\n elsif req.return_status == 1\n @new_message = true\n @message_num = @message_num + 1\n @new_requests << req.id\n #flash[:notice] = \"You item returned\"\n end\n end\n end\n @current_user_profile.borrow_requests.each do |req|\n if ((req.approval && req.return_status == 3) || (!req.borrower_read_status))\n @new_message = true\n @message_num = @message_num + 1\n @new_requests << req.id\n #flash[:notice] = \"deliverd check received?\"\n elsif req.return_status == 4 && req.return_date <= Date.today\n @new_message = true\n @message_num = @message_num + 1\n @new_requests << req.id\n #flash[:notice] = \"Return!!!\"\n end\n end\n end\n end",
"def resume_read\n messages = []\n rc = read_message_part messages\n #puts \"resume_read: rc1 [#{rc}], more_parts? [#{@raw_socket.more_parts?}]\"\n\n while 0 == rc && @raw_socket.more_parts?\n #puts \"get next part\"\n rc = read_message_part messages\n #puts \"resume_read: rc2 [#{rc}]\"\n end\n #puts \"no more parts, ready to deliver\"\n\n # only deliver the messages when rc is 0; otherwise, we\n # may have gotten EAGAIN and no message was read;\n # don't deliver empty messages\n deliver messages, rc if 0 == rc\n end",
"def perform_match message\n return false if reject_not_ack(message)\n return false unless type_match?(message)\n #@notifier.log \"#{identifier}: Looking at #{message.type} #{message.m_id_short}\", level: :collect\n if @block\n status = [@block.call(message)].flatten\n return unless collecting?\n keep message if status.include?(:keep)\n else\n keep message\n end\n end",
"def index\n # @qx_messages = Qx::Message.all\n \n per_page = params[:per_page] || 100\n @q = Qx::Message.ransack(params[:q])\n @qx_messages = @q.result().paginate(:page => params[:page], :per_page => per_page)\n end",
"def next_result()\n #This is a stub, used for indexing\n end",
"def no_more?\n more_results == :NO_MORE_RESULTS\n end",
"def feedback_loop(msg)\n\n fbl = msg.parts.find { |x| x.content_type == \"message/feedback-report\" }\n unless fbl.nil?\n\n line = msg.to_s.split(\"\\n\").find { |x| x.start_with?(\"X-Rhombus-Subscriber-UUID:\") }\n unless line.nil?\n uuid = line.split(\":\")[1].strip\n s = EmailSubscriber.find_by(uuid: uuid)\n unless s.nil?\n s.update_attributes(reported_spam: true, last_error: fbl.body.to_s) unless @dry_run\n @logger.info s.email + \" reported spam\"\n return true\n end\n end\n\n end\n\n false\n end",
"def index\n @q = @current_shop.message_threads.order('last_update_time').search(params[:q])\n @message_threads = @q.result(distinct: true).paginate(:page => params[:page], :per_page => 25)\n end",
"def continue\n @queue << \"continue\"\n end",
"def message_results=(value)\n @message_results = Array.new\n\n unless value.nil? || value.empty?\n value.each do |v1|\n if v1.instance_of? MessageResultDto\n @message_results.push(v1)\n end\n end\n\n end\n end",
"def next_result\n return false unless more_results\n check_connection\n @fields = nil\n nfields = @protocol.get_result\n if nfields\n @fields = @protocol.retr_fields nfields\n @result_exist = true\n end\n return true\n end",
"def scrapeMessages(searchTime = Time.now.to_i, group_id)\n database = SQLite3::Database.new( @database ) \n\n id = 0\n t = Time.now.to_i\n \n scraped_messages = Hash.new \n scraped_likes = Array.new\n\n t1 = Time.new\n\n while (Time.now.to_i - t.to_i) < (searchTime + 604800) do\n\n if id == 0\n messages = $gm.get(\"/groups/#{group_id}/messages\", @token, \"limit=100\")['response']\n else\n messages = $gm.get(\"/groups/#{group_id}/messages\", @token, \"limit=100&before_id=#{id}\")['response']\n end\n\n if messages.nil?\n break\n return false\n end\n\n messages['messages'].each do | message |\n t = Time.at(message['created_at'])\n if ((Time.now.to_i - t.to_i) < searchTime)\n if database.execute( \"SELECT * FROM messages WHERE message_id='#{message['id']}'\").empty?\n image = \"none\"\n liked_users = \"\"\n num_likes = 0\n if !message['attachments'].empty?\n if message['attachments'][0]['type'] == \"image\"\n image = message['attachments'][0]['url'] \n end\n end\n if !message['favorited_by'].nil?\n if message['favorited_by'].length != 0\n message['favorited_by'].each do | user |\n scraped_likes.push([message['id'], user])\n end\n end \n end\n if !message['text'].nil?\n scraped_messages[ message['id'] ] = [ message['created_at'], message['user_id'], message['name'], message['group_id'], message['avatar_url'], message['text'], image ]\n else\n scraped_messages[ message['id'] ] = [ message['created_at'], message['user_id'], message['name'], message['group_id'], message['avatar_url'], '', image ]\n end\n end\n end \n #For likes, we want to scan all posts a week back from the search time\n if ((Time.now.to_i - t.to_i) < (searchTime.to_i + 604800) )\n message['favorited_by'].each do | likedMembers |\n if (database.execute(\"SELECT count(user_id) FROM likes WHERE message_id=#{message['id']} AND user_id=#{likedMembers}\")[0][0] == 0 && database.execute(\"SELECT updated_at FROM groups WHERE group_id=#{message['group_id']}\").empty?)\n scraped_likes.push([message['id'], likedMembers])\n end \n end\n end\n end\n\n t = messages['messages'].last['created_at']\n id = messages['messages'].last['id'] \n end\n\n database.transaction\n scraped_messages.each do | key, value |\n database.execute( \"INSERT INTO messages(message_id, created_at, user_id, name, group_id, avatar_url, text, image) VALUES (?, datetime('#{value[0]}', 'unixepoch'), ?, ?, ?, ?, ?, ?)\",\n key,\n value[1],\n value[2],\n value[3],\n value[4],\n value[5],\n value[6] )\n end \n scraped_likes.each do | likes |\n database.execute(\"INSERT INTO likes(message_id, user_id) VALUES (?, ?)\",\n likes[0],\n likes[1] )\n end \n database.commit\n \n t2 = Time.new\n $logger.info \"Scrape time for group id #{group_id} was: #{(t2-t1).to_s} seconds\"\n end",
"def get_messages\n @connection.uid_search(@filter).each do |message|\n puts \"PROCESSING MESSAGE #{message}\"\n [email protected]_fetch(message,\"RFC822\")[0].attr[\"RFC822\"]\n @processor.process(body, @options)\n @connection.uid_copy(message, 'Processed')\n\n @connection.uid_store(message,\"+FLAGS\",[:Deleted])\n end\n @connection.expunge\n #@connection.delete_all\n end",
"def results\n fetch unless @results\n @results\n end",
"def get_messages( page=0 )\n\t result = []\n\t if page > 0\n\t response = self.class.get( '/message_threads', body: { page: page }, headers: {'authorization' => @auth_token} )\n\t JSON.parse( response.body )\n\t else\n\t response = self.class.get( '/message_threads', body: { page: 1 }, headers: {'authorization' => @auth_token} )\n for page in 1..(response[\"count\"]/10 + 1)\n response = self.class.get( '/message_threads', body: { page: page }, headers: {'authorization' => @auth_token} )\n result << JSON.parse(response.body)\n end\n result\n\t end\n\tend",
"def 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 more_results\n @server_status & SERVER_MORE_RESULTS_EXISTS != 0\n end",
"def scan\n @@scanning = true\n if AppVariable.exists?(name: 'latest_message_epoch_time')\n thr = Thread.new do\n GmailReader.read_bank_notices(AppVariable.find(1).value)\n @@scanning = false\n end\n else\n @@scanning = false\n end\n head :no_content\n end",
"def limit_replies\n conversation = Conversation.find(params[:message][:conversation_id])\n if conversation.messages.count > 4\n spam_filter = true\n conversation.messages[-5..-1].each do |m|\n if m.sender_id != current_user.id\n spam_filter = false\n break\n end\n end\n spam_filter\n else\n false\n end\n end",
"def continue?(previous_response)\n return false unless previous_response.last_evaluated_key\n\n if @options[:limit]\n if @options[:limit] > previous_response.count\n @options[:limit] = @options[:limit] - previous_response.count\n\n true\n else\n false\n end\n else\n true\n end\n end",
"def read_more( connection ); end",
"def collect! &block\n collect(&block)\n ok!\n @messages\n end",
"def wait_for_message(msg_url)\n msg_uri = URI.parse(msg_url)\n result = {}\n 20.times do |i|\n sleep 0.2\n res = Net::HTTP.get_response(msg_uri)\n assert_equal(\"200\", res.code)\n result = JSON.parse(res.body)\n next if [\"prep\", \"que\", \"run\"].include? result['state']\n break\n end\n result\n end",
"def wait_for_results\n wait_until(Config.long_wait) { elements(result_rows).any? }\n end",
"def search_messages(options = {})\n raise ArgumentError, 'Required arguments :query missing' if options[:query].nil?\n if block_given?\n Pagination::Cursor.new(self, :search_messages, options).each do |page|\n yield page\n end\n else\n post('search.messages', options)\n end\n end",
"def result_msg\n msgs = []\n results.each { |re| msgs.push(re[:msg]) unless re[:passed]}\n msgs\n end",
"def process_result\n end",
"def load_more_search_result\n @users=[]\n @users = @login_user.search_query(session[:search_opt],params[:page].to_i)\n render :partial => \"search_user_result\"\n #render :text => \"yes\"\n end",
"def max_results\n $testCaseID = \"VT229-0012\"\n con_remove\n createContact 20\n \n @count = Rho::RhoContact.find(:count,:max_results)\n puts @count\n Alert.show_status('Contacts',@count,'hide')\n redirect :action => :index\n end",
"def handle_messages\n messages = *disque.fetch(from: queue_name,timeout: 100,count: batch_size)\n messages.each do |queue,id,data|\n Chore.logger.debug \"Received #{id.inspect} from #{queue.inspect} with #{data.inspect}\"\n yield(id, queue, nil, data, 0)\n Chore.run_hooks_for(:on_fetch, id, data)\n end\n messages\n end",
"def wait_until_all_messages_sent\n @sender.wait_until_all_messages_sent\n end",
"def each\n while message = read_message\n yield message\n end\n end",
"def fetch_more?(options, resp)\n page_size = options[:_pageSize] || options['_pageSize']\n\n return unless page_size && resp.is_a?(Array)\n resp.pop while resp.length > page_size\n\n resp.length < page_size\n end",
"def run()\r\n\t\twhile 0\r\n\t\t\tbegin \r\n\t\t\t\tlog.info 'Connecting to email server...'\r\n\t\t\t\tif @pop.connect() \r\n\t\t\t\t\t#make the db connection\r\n log.info \"Processing #{@pop.message_count} messages...\"\r\n\r\n\t\t\t\t\tActiveRecord::Base.establish_connection(@config[@db_env])\r\n @pop.each_mail do |m| \r\n proc_msg(m)\t\t\t\t\t\t\t\r\n end\r\n\t\t\t\t\tActiveRecord::Base.connection.disconnect!\r\n\r\n\t\t\t\t\[email protected]()\r\n\t\t\t\t\tlog.info \"Processing complete.\"\r\n\t\t\t\t\tlog.info(\"\")\r\n\t\t\t\telse\r\n\t\t\t\t\tlog.error \"Could not connect to mail server!\\n\"\r\n\t\t\t\t\tlog.info(\"\")\r\n\t\t\t\tend\r\n\t\t\trescue Exception => e\r\n\t\t\t\tlog_exception(e)\r\n\t\t\t\tMessage.send_error_email(\"Error processing an SMS message.\", e)\r\n\t\t\t\[email protected]()\r\n\t\t\t\tsleep(30)\r\n\t\t\tend\r\n\t\t\tsleep(15)\r\n\t\tend\t\r\n\t\tlog.close\r\n\tend",
"def update_messages(pages = 15)\n most_recent_message = self.messages.first(:order => 'DESC', :by => :message_id) \n since_id = most_recent_message.nil? ? 0 : most_recent_message.message_id\n\n search_messages = []\n pages.times do |page|\n s = search(self.query, since_id, SEARCH_PER_PAGE_LIMIT, page+1)\n break if s.results.nil?\n search_messages += s.results\n break if s.results.size < 99 \n end\n \n search_messages.each do |message| \n m = Message.find_or_create(:message_id, message.id)\n \n m.update(\n :message_id => message.id, \n :favorited => message.favorited, \n :photos_parsed => '0',\n :links_parsed => '0', \n :created_at => Time.now.utc.to_s, \n :sent_at => message.created_at,\n :text => message.text, \n :from_screen_name => message.from_user) # we explicitly don't include the user_id provided by search since it's bullshit: http://code.google.com/p/twitter-api/issues/detail?id=214\n \n next if !m.valid?\n \n # create the user for this message\n u = User.find_or_create(:screen_name, message.from_user)\n u.update(\n :user_id => message.from_user_id,\n :profile_image_url => message.profile_image_url)\n\n self.messages << m unless self.messages.include?(m)\n end\n \n search_messages.flatten\n end",
"def end_of_feed?\n load_result.videos.length < 25\n end",
"def wait!\n wait\n raise @error if timeout?\n @messages\n end",
"def do_for_all_messages(&block) \n raise ArgumentError, \"FileHandler#do_for_all_messages expects a code block\" unless block_given? \n @messages_as_text.shuffle!\n @messages_as_text.each_slice(@limit) do |set|\n messages = get_messages(set)\n messages.each { |message| yield(message) }\n end\n end",
"def paginated(result, params, with = API::Entities::Notification)\n env['auc_pagination_meta'] = params.to_hash\n if result.respond_to?(:count) && result.count > params[:limit]\n env['auc_pagination_meta'][:has_more] = true\n result = result[0, params[:limit]]\n end\n present result, with: with\n end",
"def call\n advance until done?\n end",
"def consume\n loop do\n work_unit = @queue.pop\n send_requests(work_unit)\n @queue.synchronize do\n @results_unprocessed -= 1\n @all_processed_condition.broadcast\n end\n end\n end",
"def check_for_messages\n @message_unviewed = Message.all(:recipient_id => current_user.id, :viewed => false, :opportunity => Opportunity.all(:active => true))\n if @message_unviewed != []\n flash.now[:warning] = 'You have unread messages'\n end\n end",
"def end_accepting\n @res.join\n end",
"def end_accepting\n @res.join\n end",
"def dashboard\n \n # Get the last 10 messages from the db\n @messages = Message.find(:all, :order => 'id desc', :limit => 20)\n\n end",
"def messages\n @monitor.synchronize {\n if @buffer[@next_index] == nil\n @buffer[0...@next_index]\n else\n @buffer[@next_index...@limit] + @buffer[0...@next_index]\n end\n }\n end",
"def batch_poll\n time_poll = TimeTrackers::Poll.new(@subscription_group.max_wait_time)\n\n @buffer.clear\n @rebalance_manager.clear\n\n loop do\n time_poll.start\n\n # Don't fetch more messages if we do not have any time left\n break if time_poll.exceeded?\n # Don't fetch more messages if we've fetched max as we've wanted\n break if @buffer.size >= @subscription_group.max_messages\n\n # Fetch message within our time boundaries\n message = poll(time_poll.remaining)\n\n # Put a message to the buffer if there is one\n @buffer << message if message\n\n # Upon polling rebalance manager might have been updated.\n # If partition revocation happens, we need to remove messages from revoked partitions\n # as well as ensure we do not have duplicated due to the offset reset for partitions\n # that we got assigned\n # We also do early break, so the information about rebalance is used as soon as possible\n if @rebalance_manager.changed?\n remove_revoked_and_duplicated_messages\n break\n end\n\n # Track time spent on all of the processing and polling\n time_poll.checkpoint\n\n # Finally once we've (potentially) removed revoked, etc, if no messages were returned\n # we can break.\n # Worth keeping in mind, that the rebalance manager might have been updated despite no\n # messages being returned during a poll\n break unless message\n end\n\n @buffer\n end",
"def more_after_limit?\n more_results == :MORE_RESULTS_AFTER_LIMIT\n end",
"def fetch_loop\n # @note What happens here is a delegation of processing to a proper processor based\n # on the incoming messages characteristics\n client.fetch_loop do |raw_data, type|\n Karafka.monitor.instrument('connection.listener.fetch_loop')\n\n case type\n when :message\n MessageDelegator.call(@consumer_group.id, raw_data)\n when :batch\n BatchDelegator.call(@consumer_group.id, raw_data)\n end\n end\n # This is on purpose - see the notes for this method\n # rubocop:disable Lint/RescueException\n rescue Exception => e\n Karafka.monitor.instrument('connection.listener.fetch_loop.error', caller: self, error: e)\n # rubocop:enable Lint/RescueException\n # We can stop client without a problem, as it will reinitialize itself when running the\n # `fetch_loop` again\n @client.stop\n # We need to clear the consumers cache for current connection when fatal error happens and\n # we reset the connection. Otherwise for consumers with manual offset management, the\n # persistence might have stored some data that would be reprocessed\n Karafka::Persistence::Consumers.clear\n sleep(@consumer_group.reconnect_timeout) && retry\n end",
"def hook_result(messages); end",
"def each(params={}, &block)\n raise(ArgumentError, 'Destination::each requires a code block to be executed for each message received') unless block\n\n message_count = nil\n start_time = nil\n\n if params[:statistics]\n message_count = 0\n start_time = Time.now\n end\n\n # Receive messages according to timeout\n while message = self.get(params) do\n block.call(message)\n message_count += 1 if message_count\n end\n\n unless message_count.nil?\n duration = Time.now - start_time\n {\n messages: message_count,\n duration: duration,\n messages_per_second: duration > 0 ? (message_count/duration).to_i : 0,\n ms_per_msg: message_count > 0 ? (duration*1000.0)/message_count : 0\n }\n end\n end",
"def old_messages\r\n self.read_messages\r\n end",
"def old_messages\r\n self.read_messages\r\n end",
"def process_response(entry)\n entry.messagings.each do |messaging|\n # Set global variable Messenger Sender\n set_sender(messaging.sender_id)\n # Check if user is available to talk with bot or human.\n if bot_service_active?\n if messaging.callback.message?\n receive_message(messaging.callback)\n elsif messaging.callback.delivery?\n puts messaging.callback\n elsif messaging.callback.postback?\n receive_postback(messaging.callback)\n elsif messaging.callback.optin?\n puts messaging.callback\n elsif messaging.callback.account_linking?\n login_or_log_out(messaging.callback)\n end\n # puts Messenger::Client.get_user_profile(messaging.sender_id)\n else\n send_directly_message_without_boot(messaging)\n end\n end\n end",
"def check_for_big_messages\n if message_size > user_thread.options[:max_email_size]\n Log.librato(:count, \"system.process_uid.big_message\", 1)\n user_thread.update_user(:last_uid => uid)\n return false\n else\n return true\n end\n end",
"def continue\n fail 'This is the last page' unless continue?\n\n action = @action.merge(@metadata.fetch('continue'))\n\n self.class.new(action, merge_responses(JSON.parse(action.perform)))\n end"
] | [
"0.6732006",
"0.6601795",
"0.6452948",
"0.63930404",
"0.63930404",
"0.61950535",
"0.6094057",
"0.60731316",
"0.5949222",
"0.5941145",
"0.5919673",
"0.58985794",
"0.5880351",
"0.58434576",
"0.5819928",
"0.58031005",
"0.5787979",
"0.5755168",
"0.57054293",
"0.56794137",
"0.56631577",
"0.56446713",
"0.5636802",
"0.5635433",
"0.56338626",
"0.5628119",
"0.56247556",
"0.5612973",
"0.5602637",
"0.5568125",
"0.5553911",
"0.5553773",
"0.5546367",
"0.5516926",
"0.5510365",
"0.549651",
"0.54846215",
"0.5464541",
"0.54456604",
"0.54406697",
"0.5431181",
"0.5422881",
"0.5414214",
"0.5411973",
"0.5401851",
"0.5401775",
"0.53948754",
"0.53897625",
"0.53673804",
"0.53653646",
"0.5360479",
"0.5348745",
"0.53467464",
"0.53453743",
"0.53445643",
"0.53337616",
"0.5332412",
"0.5326742",
"0.53220206",
"0.53182256",
"0.5312635",
"0.531261",
"0.5310275",
"0.53052485",
"0.53026384",
"0.5301227",
"0.5299356",
"0.52952754",
"0.5292798",
"0.5285404",
"0.52763927",
"0.527343",
"0.5272393",
"0.5269045",
"0.5257655",
"0.52508336",
"0.52456105",
"0.5233221",
"0.52271897",
"0.52228075",
"0.52115005",
"0.51955366",
"0.51943153",
"0.5192099",
"0.51713413",
"0.5167894",
"0.5167599",
"0.5153937",
"0.5153937",
"0.5152022",
"0.51511747",
"0.5141269",
"0.5136731",
"0.5127869",
"0.5125312",
"0.51209205",
"0.51207536",
"0.51207536",
"0.51206946",
"0.51204795",
"0.51135284"
] | 0.0 | -1 |
Whether to show unread alert notifications first (only used if groupbysection is set). | def messageunreadfirst()
merge(notmessageunreadfirst: 'true')
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def alertunreadfirst()\n merge(notalertunreadfirst: 'true')\n end",
"def unreadfirst()\n merge(notunreadfirst: 'true')\n end",
"def unread_unsent_notifications_for_group\n @unread_unsent_notifications_for_group ||= unread_unsent_notifications.where('notify_user_notifications.group_id = ?', notification.group_id)\n end",
"def first_unread_message\n gmail.inbox.find(:unread).find do |email|\n email.to[0].mailbox.include? 'performance_group'\n end\n end",
"def notify_daily_summary\n settings.fetch('notifications',{}).fetch('daily_summary', true)\n end",
"def load_notifications\n \t\tif current_user\n \t\t\t@notifications = current_user.notifications.limit 5\n \t\t\t@unseen_notifications_count = current_user.notifications.unseen.count\n \t\tend\n \tend",
"def unread_notifications\n notifications_received.where('activities.created_at > ?', notifications_checked_at)\n end",
"def set_unread\n render :text => \"\", :layout => false\n end",
"def unread\n @notifications = Notification.where(user_id: current_user.uid).where(is_read: false).page(params[:page]).order(created_at: :desc)\n end",
"def unread_by(user)\n self.includes(:chat_participations, :messages).where([\n \"(chat_participations.read_at < messages.created_at OR chat_participations.read_at IS NULL)\\\n AND chat_participations.user_id = :user_id AND messages.user_id <> :user_id\",\n {user_id: user.id}]).order(\"messages.created_at DESC\")\n end",
"def unread_unsent_notifications\n @unread_unsent_notifications ||= notification.class.for_target(notification.target)\n .joins(:deliveries)\n .where.not(id: notification.id)\n .where('notify_user_notifications.read_at IS NULL AND notify_user_deliveries.sent_at IS NULL')\n end",
"def unread?\n read_at.nil?\n end",
"def groupbysection()\n merge(notgroupbysection: 'true')\n end",
"def should_suppress?(level, with_notification_at = nil, now = Time.now)\n\n self.suppress_notifications_after.any? do |period, number|\n #\n # When testing if the next alert will suppress, we know that if only\n # one alert is needed to suppress, then this function should always\n # return true.\n #\n return true if with_notification_at and number <= 1\n\n #\n # Here are the previous notifications set to this person in the last period.\n #\n previous_notifications = History.all(\n :user => self.username, :type => \"notification\", \n :created_at.gte => now - period, :created_at.lte => now,\n :event.like => '% succeeded',\n :order => :created_at.desc)\n\n #\n # Defintely not suppressed if no notifications have been found.\n #\n return false if previous_notifications.count == 0\n\n #\n # If we're suppressed already, we need to check the time of the last alert sent\n #\n if @suppressed\n\n if with_notification_at.is_a?(Time)\n latest = with_notification_at\n else\n latest = previous_notifications.first.created_at\n end\n \n #\n # We should not suppress this alert if the last one was sent ages ago\n #\n if (now - latest) >= period\n return false\n end \n\n else\n #\n # We do not suppress if we can't find a sufficient number of previous alerts\n #\n if previous_notifications.count < (with_notification_at.nil? ? number : number - 1)\n return false\n end\n\n end\n\n #\n # If we're at the lowest level, return true now.\n #\n return true if !AlertGroup::LEVELS.include?(level) or AlertGroup::LEVELS.index(level) == 0\n\n #\n # Suppress this notification if all the last N of the preceeding\n # notifications were of a equal or higher level.\n #\n return previous_notifications.first(number).alerts.to_a.all? do |a|\n AlertGroup::LEVELS.index(a.level) >= AlertGroup::LEVELS.index(level)\n end\n\n end\n end",
"def unread_notifications_since_last_read\n notification.class.for_target(notification.target)\n .where(group_id: notification.group_id)\n .where(read_at: nil)\n .where('notify_user_notifications.created_at >= ?', last_read_notification.try(:read_at) || 24.hours.ago)\n .where.not(id: notification.id)\n .order(created_at: :desc)\n end",
"def multi_message?\n return notify_on == \"always\"\n end",
"def notifications_count\n notifications_count ||= self.notifications_to_show_user.where(:seen_by_user => false).count\n end",
"def sort_unpinned\n if @guardian.current_user && @all_topics.present?\n @categories.each do |c|\n next if c.displayable_topics.blank? || c.displayable_topics.size <= c.num_featured_topics\n unpinned = []\n c.displayable_topics.each do |t|\n unpinned << t if t.pinned_at && PinnedCheck.unpinned?(t, t.user_data)\n end\n unless unpinned.empty?\n c.displayable_topics = (c.displayable_topics - unpinned) + unpinned\n end\n end\n end\n end",
"def retrieve_notifications\n\tunread = self.notifications.where(\"read = ?\", false).order(\"created_at DESC\")\n\t\n\tif unread.count < 10\n\t\tread = self.notifications.where(\"read = ?\", true).order(\"created_at DESC\").limit(10 - unread.count)\n\t\t\n\t\tunread = unread.concat(read)\n\tend\n\t\n\treturn unread\n end",
"def load_notifications\n if user_signed_in?\n @all_notifications = current_user.get_notifications\n @notifications = @all_notifications.first(10)\n @count = current_user.unread_notifications_count\n end\n end",
"def seen\n if @ok\n @ok = @notification.has_been_seen\n end\n @new_notifications = current_user.number_notifications_not_seen\n end",
"def any_unread? usr\n ConversationProcessor.new(self).any_unread? usr\n end",
"def unread?\n return (self.status == Email::STATUS_UNREAD)\n end",
"def load_notifications\n # reload user data\n user = User.find current_user.id\n @notifications = user.notifications.order(\"updated_at DESC\")\n\n new_feeds = user.notification_readers.select {|feed| !feed.isRead?}\n new_feeds.each do |feed|\n feed.read_at = Time.zone.now\n feed.save!\n end\n end",
"def unread_by?(user)\n received_message.try(:unread?) || replies.map { |r|\n r.received_message if r.recipient == user\n }.compact.any?(&:unread?)\n end",
"def unread_items (options = {})\n order = options[:order] || :hottest\n raise \"Invalid ordering '#{order.to_s}' on unread items\" if !SORTING_STRATEGIES.key?(order)\n items.sort_by { |i| SORTING_STRATEGIES[order].call(i, self) }\n end",
"def is_unread?\n !is_read\n end",
"def is_unread?\n !is_read\n end",
"def is_unread?\n !is_read\n end",
"def unread\n @notifications = current_user.notifications.unread.page(params[:page]).per(5)\n end",
"def only_show_summary?\n\t\tcount = 0\t\n\t\t[\"payable_from_organization_id\",\"payable_to_organization_id\",\"payable_from_patient_id\"].each do |k|\n\t\t\tcount+=1 unless self.send(k.to_sym).blank?\n\t\tend\n\t\tcount <= 1\n\tend",
"def unread\n all(UNREAD)\n end",
"def fetch_unread_items(folder)\n item_view = ItemView.new(10) # FIXME: some huge number like 5000, but the JS app is too slow for that\n item_view.property_set = EMAIL_SUMMARY_PROPERTY_SET\n folder.find_items(SearchFilter::IsEqualTo.new(EmailMessageSchema::IsRead, false), item_view).items.to_a\n end",
"def unread?\n self.status == 'unread'\n end",
"def get_notifications\n \t\n \t@notifs = []\n\n \tif current_user\n @notifs = Notification.where(:user_id => current_user.id, :seen => false)\n \tend\n end",
"def load_all_unread\n @all_unread = []\n material_type_list.each do |material_hash|\n material_type = material_hash[:name]\n if material_type != \"school_day\"\n unread_materials = material_type.classify.constantize.unread_by(current_user)\n if current_user.admin?\n filtered_unread_materials = unread_materials\n else\n filtered_unread_materials = unread_materials.select do |material| \n !material.school_days.empty? && !material.school_days.nil? && material.school_days.order(\"calendar_date\")[0].calendar_date <= Date.today\n end\n end\n @all_unread += filtered_unread_materials\n end\n end\n @all_unread.sort_by!(&:updated_at).reverse!\n end",
"def mark_notifications_read\n return if params[:notification_id].blank? or !user_signed_in?\n n = Notification.find(params[:notification_id])\n current_subject.mark_as_read n\n end",
"def show_section_appraisal_moderated?\n subject.lead?(record) ||\n (\n record.assessor_assignments.moderated.submitted? &&\n (\n subject.primary?(record) ||\n (assessor? && record.from_previous_years?)\n )\n )\n end",
"def load_unread_comments\n @unread_comments = Comment.unread_by(current_user)\n if current_user.student?\n @unread_comments = @unread_comments.select do |comment| \n comment_parent = comment.commentable_type.classify.constantize.find(comment.commentable_id)\n comment_parent_type = comment.commentable_type.underscore\n if comment_parent_type == \"school_day\"\n comment_parent.calendar_date <= Date.today\n else\n comment_parent.school_days.order(\"calendar_date\")[0].calendar_date <= Date.today if !comment_parent.school_days.empty?\n end\n end\n end\n @unread_comments.sort_by!(&:created_at).reverse!\n end",
"def mark_all_readed\n doctor.notifications.update_all unreaded: false\n send_json doctor.notifications, true\n end",
"def unread_discussions\n discussions.find_unread_by(self)\n end",
"def group_notifications\n @attributes[:group_notifications]\n end",
"def may_read_group_announcements?(group)\n\t\t\tmay_administrate? || is_group_reader?(group)\n\t\tend",
"def notification_groups_mark_all_as_read(opts = {})\n data, _status_code, _headers = notification_groups_mark_all_as_read_with_http_info(opts)\n data\n end",
"def display_notif_unseen(usr_id)\n num = PublicActivity::Activity.where(is_seen: false, owner_id: usr_id, owner_type: \"User\").count\n return num if num > 0\n return \"\" # Else return blank string\n end",
"def trying_to_hide_by_changing_slacking_off_selector?\n will_save_change_to_notify_progress_report_recipient_id_if_i_miss_more_than_3_weeks? && notify_progress_report_recipient_id_if_i_miss_more_than_3_weeks_was.present?\n end",
"def notifications(options = {})\n #:type => nil is a hack not to give Messages as Notifications\n notifs = Mailboxer::Notification.recipient(messageable).where(:type => nil).order(\"mailboxer_notifications.created_at DESC\")\n if options[:read] == false || options[:unread]\n notifs = notifs.unread\n end\n\n notifs\n end",
"def unread?\n !read?\n end",
"def mark_unread!\n update_is_read_status false\n end",
"def unread?\n !read?\n end",
"def topics_unread_comments(group_id, viewed = 0, page = 1, sort = 'updated_at', order = 'a')\n\t\t\tif ['comments_count', 'title', 'updated_at', 'views'].include?(sort) && ['a', 'd'].include?(order)\n\t\t\t\toptions = {\"viewed\" => viewed, \"page\" => page, \"sort\" => sort, \"order\" => order}\n\t\t\telse\n\t\t\t\tputs \"NOTICE: invalid sorting parameters entered. reverting to defults.\"\n\t\t\t\toptions = {\"viewed\" => viewed, \"page\" => page}\n\t\t\tend\n\t\t\tdata = oauth_request(\"/topic/unread_group/#{group_id}\", options)\n\t\t\tHashie::Mash.new(data)\n\t\tend",
"def unread? user_id\n !unread_messages(user_id).blank?\n end",
"def unread\n un_read(false, \"non lue\")\n end",
"def index\n @all_notifications = Notification.order(from_type: \"asc\", readed: \"asc\")\n end",
"def arrange_single_notification_index(loading_index_method, options = {})\n as_latest_group_member = options[:as_latest_group_member] || false\n as_latest_group_member ?\n loading_index_method.call(options).map{ |n| n.latest_group_member } :\n loading_index_method.call(options).to_a\n end",
"def unread_conversations\n my_conversations.joins(:messages).where('messages.created_at > COALESCE(conversation_members.last_seen, conversation_members.created_at)').uniq\n end",
"def shutdown_less_emails_sent_than_defined_in_user_profile?\n notifications_delivered < notifications_for_shutdown\n end",
"def has_notify?(forum)\n current_forum = Forum.find(forum)\n if current_forum.messages.count > this.current_length\n this.display = true\n end\n end",
"def notified_watchers\n notified = (watcher_users.active + watcher_users_through_groups.active).uniq\n notified.reject! {|user| user.mail.blank? || user.mail_notification == 'none'}\n if respond_to?(:visible?)\n notified.reject! {|user| !visible?(user)}\n end\n notified\n end",
"def has_unopened_notifications?(options = {})\n _unopened_notification_index(options).exists?\n end",
"def responding_messages_delivery_with_no_responses(channel = nil, channel_group = nil)\n delivery_notices = DeliveryNotice.includes(:message)\n delivery_notices = delivery_notices.where(channel: channel) if channel\n delivery_notices = delivery_notices.where(channel_group: channel_group) if channel_group\n delivery_notices.where(subscriber_id: potential_subscriber_ids)\n .where(tparty_identifier: to_phone)\n .where(\"messages.type\" => Message.responding_message_types)\n .order(:created_at)\n .select { |dn|\n last_sr = dn.message.subscriber_responses.order(:created_at).last\n last_sr.nil? || last_sr.created_at < dn.created_at\n }\n end",
"def low_severity_events(&block)\n\n unless @low_severity_events\n @low_severity_events = []\n\n @host.xpath(\"ReportItem\").each do |event|\n next if event['severity'].to_i != 1\n @low_severity_events << Event.new(event)\n end\n\n end\n\n @low_severity_events.each(&block)\n end",
"def mark_notifications_as_read(options = {})\n boolean_from_response :put, 'notifications', options\n end",
"def message_notification\n fetch(:hipchat_announce, false)\n end",
"def status_sort\n user_id_giver and user_id_receiver ? 1 : 2\n end",
"def is_unread?(participant)\n return false if participant.nil?\n !receipt_for(participant).first.is_read\n end",
"def inbox\n user_sent = Message.where(user_id: current_user, group_id: nil, show_user: true)\n user_received = Message.where(recipient_id: current_user, show_recipient: true)\n @messages = (user_sent + user_received).sort{|a,b| a.created_at <=> b.created_at }\n end",
"def notifications(options = {})\n scope = MessageCenter::Notification.recipient(messageable).order(:created_at => :desc)\n if options[:read] == false || options[:unread]\n scope = scope.unread\n end\n\n scope\n end",
"def unread?\n !read?\nend",
"def unread?\n (status == UNREAD)\n end",
"def show\n usergroups = @notice.usergroups\n found = false\n\n usergroups.each do |usergroup|\n unless usergroup.users.where(user_id: current_user.id).nil?\n found = true\n end\n end\n\n if @notice.creator == current_user || found\n\n else\n respond_to do |format|\n format.html { redirect_to notices_url, alert: 'You have no right to view this notice.' }\n format.json { head :no_content }\n end\n end\n end",
"def get_notices\n @Noticias = Notice.all(:conditions => ['published = 1'], :order => \"id desc\", :limit => \"6\")\n end",
"def notification?\n false\n end",
"def mark_all_as_read\n @notifications = Notification.unread.for_user(current_api_v1_user)\n @notifications.update_all(read_at: Time.now) unless @notifications.blank?\n @notifications = Notification.where(recipient_id: current_api_v1_user.id)\n \n render json: @notifications\n end",
"def index\n\t\t@notifications = Notification.where(recipient_id: current_user.id).unread\n\tend",
"def is_there_notification\n current_user.notifications\n end",
"def mark_notification_as_read!\n notification = User.find(@userid).notifications\n @received_msg.each do |notify|\n notification.update(notify['id'], :checked => true);\n end\n end",
"def index\n @notifications = Notification.where(user_id: current_user.uid).page(params[:page]).order(created_at: :desc)\n # @notifications = Notification.all\n @notifications_sort = {}\n @notifications.each do |n|\n date = n.created_at.strftime('%Y-%m-%d')\n if @notifications_sort[date].nil?\n @notifications_sort[date] = []\n end\n @notifications_sort[date] << n\n end\n end",
"def any_unread? usr\n @conv.posts.each do |post| \n if post.unread?(usr) && post.recipient_id == usr.id\n return true\n end\n end\n return false\n end",
"def unopened_group_member_notifier_count\n group_members.unopened_only\n .filtered_by_association_type(\"notifier\", notifier)\n .where(\"notifier_key.ne\": notifier_key)\n .to_a\n .collect {|n| n.notifier_key }.compact.uniq\n .length\n end",
"def shutdown_more_emails_sent_than_defined_in_user_profile?\n notifications_delivered > notifications_for_shutdown\n end",
"def show\n # Title of the webpage\n @title = 'Notifications'\n\n # Getting all of the user's notifications, then those that are unread\n @all_notifications = Notification.where([\"user_id = :id\", { id: current_user.id }]).order(created_at: :desc)\n @notification_content = {}\n @unread_notification_ids = []\n\n @all_notifications.each do |notification|\n if notification.unread?\n # Mark all of the unread notifications as read, since they have now been opened\n @unread_notification_ids << notification.id\n notification.unread = false\n notification.save\n end\n\n # Get the pieces of the body of the notification\n if notification.body\n @notification_content[notification.id] = notification.body.split(/\\n/)\n end\n\n end\n\n # Clear the number of unread notifications for the user\n current_user.update_attribute(:unread_notifications, 0)\n end",
"def has_unread_messages?(user)\n latest_message = self.last_message\n if latest_message\n chat_participation = self.chat_participations.where(user_id: user.id).first\n chat_participation.try(:unread_message?, latest_message)\n end\n end",
"def mark_as_unread\n Notifyer::Notification.all.each do |n|\n n.update(is_read: false)\n end\n redirect_to :back\n end",
"def check_for_messages\n @message_unviewed = Message.all(:recipient_id => current_user.id, :viewed => false, :opportunity => Opportunity.all(:active => true))\n if @message_unviewed != []\n flash.now[:warning] = 'You have unread messages'\n end\n end",
"def set_unread_message_count\n self.unread_messages = 1\n end",
"def unread_messages\n @user_wise_unread_messages = current_user.user_messages\n .where(is_read: false)\n .joins(:message)\n .group('messages.user_id').count\n end",
"def index\n @notifications = current_user.notifications.unread.page(params[:page]).per(20)\n end",
"def reset_unread_notification_count\n post('notifications/markAsRead')\n end",
"def show_notifications # :norobots:\n pass_query_params\n data = []\n @observation = find_or_goto_index(Observation, params[:id].to_s)\n return unless @observation\n name_tracking_emails(@user.id).each do |q|\n fields = [:naming, :notification, :shown]\n naming_id, notification_id, shown = q.get_integers(fields)\n next unless shown.nil?\n notification = Notification.find(notification_id)\n if notification.note_template\n data.push([notification, Naming.find(naming_id)])\n end\n q.add_integer(:shown, 1)\n end\n @data = data.sort_by { rand }\n end",
"def show_report\n Notifications::Registry.show_missed_notifications\n end",
"def notify_all\n if @size > 0\n @report << \"#{@size} abonnement(s) à notifier\"\n do_notify_all\n @report << Registry.report_missed_notifications\n else\n @report << 'Pas de notification à faire'\n end\n @report\n end",
"def unopened_group_member_notifier_count\n group_members.unopened_only\n .where(notifier_type: notifier_type)\n .where(:notifier_id.ne => notifier_id)\n .distinct(:notifier_id)\n .count\n end",
"def all_notifications(options = {})\n reverse = options[:reverse] || false\n with_group_members = options[:with_group_members] || false\n as_latest_group_member = options[:as_latest_group_member] || false\n target_notifications = Notification.filtered_by_target_type(self.name)\n .all_index!(reverse, with_group_members)\n .filtered_by_options(options)\n .with_target\n case options[:filtered_by_status]\n when :opened, 'opened'\n target_notifications = target_notifications.opened_only!\n when :unopened, 'unopened'\n target_notifications = target_notifications.unopened_only\n end\n target_notifications = target_notifications.limit(options[:limit]) if options[:limit].present?\n as_latest_group_member ?\n target_notifications.latest_order!(reverse).map{ |n| n.latest_group_member } :\n target_notifications.latest_order!(reverse).to_a\n end",
"def unread\n read_attribute(:unread)\n end",
"def mark_all_entries_as_unread_groups(group_id,topic_id,opts={})\n query_param_keys = [\n :forced_read_state\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 \"topic_id is required\" if topic_id.nil?\n # set default values and merge with input\n options = underscored_merge_opts(opts,\n :group_id => group_id,\n :topic_id => topic_id\n )\n\n # resource path\n path = path_replace(\"/v1/groups/{group_id}/discussion_topics/{topic_id}/read_all\",\n :group_id => group_id,\n :topic_id => topic_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(:delete, path)\n query_params.merge! pagination_params if pagination_params\n end\n response = mixed_request(:delete, path, query_params, form_params, headers)\n page_params_store(:delete, path)\n response\n \n end",
"def unopened_group_member_notifier_count\n # Cache group by query result to avoid N+1 call\n unopened_group_member_notifier_counts = target.notifications\n .unopened_index_group_members_only\n .includes(:group_owner)\n .where(\"group_owners_#{self.class.table_name}.notifier_type = #{self.class.table_name}.notifier_type\")\n .where.not(\"group_owners_#{self.class.table_name}.notifier_id = #{self.class.table_name}.notifier_id\")\n .references(:group_owner)\n .group(:group_owner_id, :notifier_type)\n .count(\"distinct #{self.class.table_name}.notifier_id\")\n unopened_group_member_notifier_counts[[id, notifier_type]] || 0\n end",
"def unread_topics user\r\n topics.find_all{|topic| topic.unread_comment?(user) }\r\n end",
"def index\n @users = User.all.order(already_notified: :asc)\n end",
"def show_summary\n Log.add_info(request, params.inspect)\n\n mail_account_id = params[:id]\n\n begin\n @mail_account = MailAccount.find(mail_account_id)\n rescue => evar\n Log.add_error(request, evar)\n redirect_to(:controller => 'login', :action => 'logout')\n return\n end\n\n @folder_tree = MailFolder.get_tree_for(@login_user, [mail_account_id])\n mail_folders = @folder_tree.values.flatten.uniq\n mail_folder_ids = mail_folders.collect{|rec| rec.id}\n @unread_emails_h = {}\n unless mail_folder_ids.nil? or mail_folder_ids.empty?\n unread_emails = Email.find(:all, :conditions => \"user_id=#{@login_user.id} and status='#{Email::STATUS_UNREAD}' and mail_folder_id in (#{mail_folder_ids.join(',')})\")\n unread_emails.each do |email|\n mail_folder = mail_folders.find{|rec| rec.id == email.mail_folder_id}\n unless mail_folder.nil?\n @unread_emails_h[mail_folder] ||= 0\n @unread_emails_h[mail_folder] += 1\n end\n end\n end\n @folder_obj_cache ||= MailFolder.build_cache(mail_folders)\n\n render(:layout => (!request.xhr?))\n end"
] | [
"0.73922783",
"0.64193135",
"0.60340273",
"0.5913231",
"0.55172455",
"0.5419864",
"0.5388397",
"0.5372058",
"0.5277307",
"0.5254512",
"0.52172506",
"0.51779145",
"0.51201063",
"0.5119448",
"0.5119257",
"0.51112986",
"0.5104817",
"0.5090765",
"0.50587803",
"0.5055235",
"0.5046916",
"0.50361836",
"0.502127",
"0.49941143",
"0.49835292",
"0.49778837",
"0.49627024",
"0.49627024",
"0.49627024",
"0.49603269",
"0.49518937",
"0.49426177",
"0.49330115",
"0.49208233",
"0.49092695",
"0.48995173",
"0.48855212",
"0.48852304",
"0.48755625",
"0.4869315",
"0.48606467",
"0.48569077",
"0.48503342",
"0.48345703",
"0.48340908",
"0.48266912",
"0.48145872",
"0.4806689",
"0.48037162",
"0.48014224",
"0.47922862",
"0.4791223",
"0.47883856",
"0.47849247",
"0.4784587",
"0.4773234",
"0.47710225",
"0.47516507",
"0.4749235",
"0.47267735",
"0.47239113",
"0.47139293",
"0.4713003",
"0.47127396",
"0.4711141",
"0.4709909",
"0.47079414",
"0.470448",
"0.4695367",
"0.46803203",
"0.46787083",
"0.46773133",
"0.46693453",
"0.4666259",
"0.4662246",
"0.46572518",
"0.46457782",
"0.4643925",
"0.4611932",
"0.4611677",
"0.46108487",
"0.46055576",
"0.46021253",
"0.45976847",
"0.45953646",
"0.45948437",
"0.45924258",
"0.4589471",
"0.45848066",
"0.45829874",
"0.4579804",
"0.45673564",
"0.4551716",
"0.4541406",
"0.45402297",
"0.45385504",
"0.45341963",
"0.45318398",
"0.4528666",
"0.45079416"
] | 0.6516782 | 1 |
True to opt in to a summary notification of notifications on foreign wikis. | def crosswikisummary()
merge(notcrosswikisummary: 'true')
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def notification?\n false\n end",
"def notification?\n kind == 'notification'\n end",
"def friendship_notifications?\n notification_friendship\n end",
"def allow_notification?\n true\n end",
"def notify_about?(object)\n case mail_notification\n when 'all'\n true\n when 'selected'\n # user receives notifications for created/assigned issues on unselected projects\n if object.is_a?(Issue) && (object.author == self || is_or_belongs_to?(object.assigned_to))\n true\n else\n false\n end\n when 'none'\n false\n when 'only_my_events'\n if object.is_a?(Issue) && (object.author == self || is_or_belongs_to?(object.assigned_to))\n true\n else\n false\n end\n when 'only_assigned'\n if object.is_a?(Issue) && is_or_belongs_to?(object.assigned_to)\n true\n else\n false\n end\n when 'only_owner'\n if object.is_a?(Issue) && object.author == self\n true\n else\n false\n end\n else\n false\n end\n end",
"def check_notification\n referral = self\n admin = referral.job.admin\n\n if referral.is_interested == true && referral.is_admin_notified == false\n # binding.pry\n if referral.update_attribute(:is_admin_notified, true)\n ReferralMailer.deliver_admin_notification(referral, admin)\n referral.save\n else\n render 'edit', error: \"We had an issue with your referral request. Please try again.\"\n end\n end\n end",
"def notifies_commenter? # ...of direct responses to this comment\n wants_notifications?\n end",
"def multi_message?\n return notify_on == \"always\"\n end",
"def display?\n @document_self and not @ignored and\n (documented? or not @suppressed)\n end",
"def trying_to_hide_by_changing_slacking_off_selector?\n will_save_change_to_notify_progress_report_recipient_id_if_i_miss_more_than_3_weeks? && notify_progress_report_recipient_id_if_i_miss_more_than_3_weeks_was.present?\n end",
"def status_is_informational?\n\t\treturn self.status_category == 1\n\tend",
"def wifsignaled? \n DRMAA.wifsignaled(@stat) \n end",
"def published_work?\n true\n end",
"def representative_email_sent_flag\n should_send_email = updates_requiring_email? ||\n representative_email.present? ||\n representative_timezone.present?\n\n # Note: Don't set flag if hearing disposition is cancelled, postponed, or scheduled in error\n !should_send_email || hearing.postponed_or_cancelled_or_scheduled_in_error?\n end",
"def emails_sent_as_in_profile_for_shutdown?\n notifications_delivered == notifications_for_shutdown\n end",
"def allow_easy_notifiaction?\n this_and_closer_members_count <= self.user.max_easy_notification_count\n end",
"def notify_daily_summary\n settings.fetch('notifications',{}).fetch('daily_summary', true)\n end",
"def already_welcomed?(user)\n notification = Notification.welcomed_by(self.id, user.id)\n !notification.empty?\n end",
"def trackable?\n published?\n end",
"def has_notifications?\n current_user and GroupManager.instance.resolver.is_ad_admin?(current_user) and\n Workflow::AccrualJob.awaiting_admin.present?\n end",
"def notification_due?\n notification_due = false\n if hw_coverage_end_date.present?\n planned_notification_dates.each do |planned_notice|\n if in_the_past(planned_notice) and last_notice_before(planned_notice)\n notification_due = true\n break\n end\n end\n end\n notification_due\n end",
"def notification_due?\n notification_due = false\n if hw_coverage_end_date.present?\n planned_notification_dates.each do |planned_notice|\n if in_the_past(planned_notice) and last_notice_before(planned_notice)\n notification_due = true\n break\n end\n end\n end\n notification_due\n end",
"def notify?\n @notify == true\n end",
"def handle_notify_event(event, is_being_published)\n event.users.each do |user|\n I18n.with_locale(user.get_locale) do\n status = EventStatus.find_by(user_id: user.id, event_id: event.id)\n if !status.blank? && !status.not_attending?\n if is_being_published\n send_publish_event_notification(event, user, status)\n else\n send_delete_event_notification(event, user)\n end\n end\n end\n end\n end",
"def notify\n @attributes.fetch('notify', false)\n end",
"def send_notification\n ::Refinery::Inquiries::InquiryMailer.published_notification(self).deliver if (self.page_status_id_changed? and self.page_status_id == 2)\n end",
"def mentioning?\n # Skip send notification if Doc not in publishing\n if instance_of?(Doc)\n publishing?\n else\n true\n end\n end",
"def suscription_on?\n is_subscribed == true\n end",
"def shutdown_less_emails_sent_than_defined_in_user_profile?\n notifications_delivered < notifications_for_shutdown\n end",
"def is_there_notification\n current_user.notifications\n end",
"def publish?\n false\n end",
"def informational?\n severity == 0\n end",
"def notify?; params_for_save[:Notify] == true end",
"def notify?; params_for_save[:Notify] == true end",
"def notify?; params_for_save[:Notify] == true end",
"def notify?\n false\n end",
"def notify?\n true\n end",
"def should_send_email?\n self.published? && !self.email_sent?\n end",
"def general\n @week == 0 ? true : false\n end",
"def can_notify? user\n return false if self.id == user.id\n not notification_exists? user\n end",
"def notify?\n true\n end",
"def send_document_review_notification\n if value == 'verified'\n EventAPI.notify('system.document.verified', record: as_json_for_event_api)\n elsif value == 'rejected'\n EventAPI.notify('system.document.rejected', record: as_json_for_event_api)\n end\n end",
"def message_notification\n fetch(:hipchat_announce, false)\n end",
"def publishable?\n self.status == STATUS_PENDING\n end",
"def newly_published?\n !!@newly_published\n end",
"def publishable?\n [ UNPUBLISHED, OUT_OF_DATE ].include? flickr_status\n end",
"def verify_notification\n wait_for_css(input_elements[:entries])\n entries = get_entries\n entries.each do |entry|\n if entry[\"data-mention-id\"].eql?(@stream_post_id)\n user_icon = entry.all(input_elements[:notification_icon]).first\n return true if user_icon[\"data-original-title\"].include?(\"Assigned to \")\n return false\n end\n end\n return false\n end",
"def send_urgent?; preference == EmailSetting::OPTIONS[:'All Urgent Requests'] || preference.nil?; end",
"def medium?\n severity == 2\n end",
"def unpublishable?\n [ UP_TO_DATE, OUT_OF_DATE ].include? flickr_status\n end",
"def notify\n notify_unmentioned_reviewers\n notify_mentioned_event_staff if mention_names.any?\n end",
"def published?; end",
"def published?; end",
"def should_notify?\n return false if notified\n expiration = default_expiration\n return false unless expiration\n expiration.in_notification_interval?\n end",
"def system_notificaton?\n @system_notificaton\n end",
"def subscribe_notifications\n @subscribe_notifications ||= true\n end",
"def toggle_notification(visible)\n @notification_visible = visible\n end",
"def may_note?\n false\n end",
"def is_about\n downcased_noteable_type = self.noteable_type.downcase\n if downcased_noteable_type == \"comment\" \n if Comment.find(self.noteable_id).sentence == nil\n self.destroy\n \"Notification Removed\"\n elsif Comment.find(self.noteable_id).sentence.paragraph.story\n Comment.find(self.noteable_id).sentence.paragraph.story.title\n else\n \"Notification Removed\"\n end\n else\n Course.find(Enrollment.find(self.noteable_id).course_id).name\n end\n end",
"def published?\n # He I don't use the static attr because a finished tip is also published\n !!self.published_at\n end",
"def send_notifications?\n self.notification_emails.present?\n end",
"def observer_detail_info\n observer_detail == 'true'\n end",
"def notify?\n update?\n end",
"def notify_on_mention?; true; end",
"def has_contributed_to\n self.contributed_non_profits\n end",
"def can_reply_to_forem_topic? topic\n true\n end",
"def show_nag?\n @show_nag\n end",
"def fully_documented?\n @fully_documented\n end",
"def require_push_notification?\n if action =~ /up_vote/ && subject.respond_to?(:votes)\n first_notification = !similar_notifications.exists?\n first_notification || subject.votes.count % PUSH_VOTES_INTERVAL == 0\n elsif action =~ /subscription\\.create/\n false\n else\n true\n end\n end",
"def mark_all_user_notifications_notified(user)\n user.notifications.each do |n|\n n.notified = true\n n.save\n end\n end",
"def notify_on_errs\n !(self[:notify_on_errs] == false)\n end",
"def send_status_notification\n message = case @state\n when :hungry then \"I'm hungry!!!\"\n when :sick then \"I'm not feeling so well... :(\"\n when :playful then 'Come play with me!'\n end\n\n DesktopNotifications.notify(message) unless message.nil?\n end",
"def hide_warnings?(work)\n current_user.is_a?(User) && current_user.preference && current_user.preference.hide_warnings? && !current_user.is_author_of?(work)\n end",
"def notifications\n end",
"def publish_opts\n options = {}\n options[:in_reply_to_status_id] = in_reply_to_status_id if reply?\n options\n end",
"def has_notify?(forum)\n current_forum = Forum.find(forum)\n if current_forum.messages.count > this.current_length\n this.display = true\n end\n end",
"def change_status\n @is_published ? false : true\n end",
"def wikilink_available?\n wikilink && !wikilink.empty?\n end",
"def published?\n if self.status == \"live\"\n true\n else\n false\n end\n end",
"def publishable?\n false\n end",
"def send_reply\n if self.response_changed?\n @notifiable = self\n @tutor = User.find(self.user_id)\n @student = User.find(self.pupil_id)\n\n if self.response == \"Declined\"\n @description = self.pupil.title + \" has sadly declined your offer\"\n @notifiable.notifications.create(:user => @tutor ,:receiver_id => @student.id, :message => 'You hve declined the offer by ' + @tutor.title)\n else\n @description = self.pupil.title + \" is now a student at your school\"\n @notifiable.notifications.create(:user => @tutor ,:receiver_id => @student.id, :message => 'You are now a student of ' + @tutor.title)\n end\n @notifiable.notifications.create(:user => @student, :receiver_id => @tutor.id, :message => @description)\n end\n end",
"def founder?\n @badges.key? 'founder'\n end",
"def published?\n if self.publish_at < Time.now.utc\n true\n else\n false\n end\n end",
"def unpublished?\n self.status == \"Unpublished\"\n end",
"def can_publish?\n\t\ttrue\n\tend",
"def unread?\n self.status == 'unread'\n end",
"def displayed?\n return (self.d_publish <= Time.zone.today) && (self.d_remove > Time.zone.today)\n end",
"def notify_user(ad)\n #create notification for the user\n notification = self.notifications.unviewed.event(:new_relevant_ad).new\n notification.user = self.user\n notification.ad = ad\n notification.save!\n end",
"def notify?\n recent? || (aging? && rand(5) < 3) || rand(5) == 0\n end",
"def published_or_not\n self.published = (self.published_at <= Time.now and self.unpublished_at >= Time.now) ? 1 : 0\n end",
"def new_statistics_page?\n self.newforstats == 'YES'\n end",
"def send_confirmation_notification?\n false\n end",
"def can_publish_results\n if [email protected]_correction?\n flash[:danger] = \"Une erreur est survenue.\"\n redirect_to @contestproblem and return\n end\n if @contestproblem.contestsolutions.where(:corrected => false).count > 0\n flash[:danger] = \"Les solutions ne sont pas toutes corrigées.\"\n redirect_to @contestproblem and return\n end\n if @contestproblem.contestsolutions.where(:star => true).count == 0\n flash[:danger] = \"Il faut au minimum une solution étoilée pour publier les résultats.\"\n redirect_to @contestproblem and return\n end\n end",
"def people_for_mailing\n self.people.select(&:ok_conf_mails?)\n end",
"def only_show_summary?\n\t\tcount = 0\t\n\t\t[\"payable_from_organization_id\",\"payable_to_organization_id\",\"payable_from_patient_id\"].each do |k|\n\t\t\tcount+=1 unless self.send(k.to_sym).blank?\n\t\tend\n\t\tcount <= 1\n\tend",
"def program_announcement_view?\n return false if User.current_user.is? :any, :in_group => [:geography], :center_id => self.center_id\n return false if User.current_user.is? :any, :in_group => [:pcc], :center_id => self.center_id\n return true if User.current_user.is? :program_announcement, :center_id => self.center_id and ANNOUNCED_STATES.include?(self.state)\n end",
"def notified? \n \titem = Item.find(item_id)\n \tif(item.expired? == true && notifiy == false)\n \t\treturn false\n \telse\n \t\treturn true\n \tend\n end",
"def should_notify?\n expiration = default_expiration\n return false unless expiration\n return false if notified == expiration.time.to_i\n expiration.in_notification_interval?\n end",
"def needs_permission_badge?\n solr_document.visibility != Hydra::AccessControls::AccessRight::VISIBILITY_TEXT_VALUE_PUBLIC\n end",
"def is_published?\n return false if self.published_on.nil?\n return true if self.published_on <= Time.now.beginning_of_day\n return false\n end",
"def published?\n (status == PUBLISHED)\n end"
] | [
"0.6594851",
"0.65313923",
"0.62009525",
"0.6191261",
"0.61354214",
"0.6061729",
"0.58664525",
"0.58542126",
"0.58359814",
"0.5816598",
"0.58139724",
"0.5789417",
"0.5789104",
"0.5744822",
"0.57379067",
"0.5737229",
"0.5686071",
"0.56637776",
"0.56433636",
"0.56124765",
"0.5608344",
"0.5608344",
"0.5588563",
"0.5571967",
"0.556333",
"0.5540536",
"0.5534655",
"0.5522986",
"0.55173707",
"0.55139863",
"0.5510391",
"0.55039024",
"0.54962957",
"0.54962957",
"0.54962957",
"0.54945534",
"0.54872125",
"0.5465395",
"0.5459345",
"0.5453295",
"0.5451772",
"0.54357195",
"0.54323405",
"0.5426055",
"0.54252386",
"0.5423576",
"0.54170483",
"0.54135066",
"0.5404055",
"0.5402759",
"0.53986365",
"0.5388411",
"0.5388411",
"0.53738606",
"0.53528714",
"0.53223276",
"0.531984",
"0.53088856",
"0.5302113",
"0.5290517",
"0.52877206",
"0.52635896",
"0.52524847",
"0.5250932",
"0.5250716",
"0.5248264",
"0.52408016",
"0.52383846",
"0.5237663",
"0.5236654",
"0.52321416",
"0.5231089",
"0.5229541",
"0.5227724",
"0.52218866",
"0.5219739",
"0.52084136",
"0.5207744",
"0.5203869",
"0.51994985",
"0.51909894",
"0.51896363",
"0.5182429",
"0.51747596",
"0.51726896",
"0.5167441",
"0.51623696",
"0.5151669",
"0.5146151",
"0.5142377",
"0.51379126",
"0.5136931",
"0.51288724",
"0.51242507",
"0.51217085",
"0.5118823",
"0.5116966",
"0.5111147",
"0.51081",
"0.5103115",
"0.5102747"
] | 0.0 | -1 |
human readable description of modeling approach | def modeler_description
return "The difference between actual spaces and effective spaces takes into account the zone multipliers. The goal was to get average floor area assuming that each space represents a room vs. a collection of rooms. This was used to help determine average space sizes of different space types from the prototype buildings. In some cases I had to manaually adjust for where a space didn't map to a single room."
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def modeler_description\n return 'Gather orientation and story specific construction, fenestration (including overhang) specific information'\n end",
"def modeler_description\n return \"Example use case is adding special loads like an elevator to a model as part of an analysis workflow\"\n end",
"def modeler_description\n return 'Currently this is just setup for design level calculation method, but it could be extended as needed..'\n end",
"def modeler_description\n return 'shift or/and adjust heaing and cooling setpoint'\n end",
"def modeler_description\n return 'This model replaces the existing HVAC system with a VRF + DOAS system.'\n end",
"def modeler_description\n return \"This uses the OpenStudio::Model::Space::fromFloorPrint method, and is very much like the Create Spaaces From Diagram tool in the OpenStudio SketchUp plugin, but lets you draw teh diagram in the tool of your choice, and then imports it into the OpenStudio application via a measure.\"\n end",
"def modeler_description\n return 'This can be used in apply measure now, or can be used in a parametric workflow to load in any custom user profiles or floor/ceiling values.'\n end",
"def modeler_description\r\n return \"objective function\"\r\n end",
"def modeler_description\r\n return \"objective function\"\r\n end",
"def modeler_description\n return \"Any generators and electric load center distribution objects are removed. An electric load center distribution object is added with a track schedule equal to the hourly output from SAM. A micro turbine generator object is add to the electric load center distribution object. The fuel used to make the electricity is zeroed out.\"\n end",
"def modeler_description\r\n return \"For each model, find every DX cooling and heating coil and increase the COP to 6. Since very little information about this technology is available, do not change performance curves or upper/lower operating temperature limits.\"\r\n end",
"def modeler_description\n return 'Modify the cooling setpoint of the HVAC system during a DR event'\n end",
"def modeler_description\n return 'This a test measure in relation with https://github.com/NREL/OpenStudio/issues/4156'\n end",
"def modeler_description\n return \"When have existing OSM wanted to be able to grab geometry from model vs. trying to enter on website. This is useful when there is no built structures yet to use as reference on the website.\"\n end",
"def modeler_description\n return \"Grey water tank overflow will be dirrected to drainage. \"\n end",
"def modeler_description\n return \"NOTE: This will load and respond slowly in the OS app, especially if you select * on a variable with many possible keys or you select timestep data. Suggest you open it in a web browser like Chrome instead.\"\n end",
"def modeler_description\n return 'HVAC system creation logic uses [openstudio-standards](https://github.com/NREL/openstudio-standards) and efficiency values are defined in the openstudio-standards Standards spreadsheet under the *NREL ZNE Ready 2017* template.'\n end",
"def description()\n\t\tself.namespaced_class(:ModelDescriptor).goal(self)\n\tend",
"def modeler_description\n 'NOTE: This will load and respond slowly in the OS app, especially if you select * on a variable with many possible keys or you select timestep data. Suggest you open it in a web browser like Chrome instead.'\n end",
"def modeler_description\n return 'Not sure how I will handle arguments. Maybe lump together all spaces on same sotry that have the same multilier value. This will have variable number of arguments basd on the model pased in. Alternative is to either only allo w one group to be chosen at at time, or allow a comlex string that describes everything. Also need to see how to define shirting. There is an offset but it may be above and below and may not be equal. In Some cases a mid floor is halfway betwen floors which makes just copying the base surfaces as shading multiple times probemeatic, since there is overlap. It coudl be nice to stretch one surface over many stories. If I check for vertial adn orthogonal surface that may work fine. '\n end",
"def modeler_description\n return \"It does not even send anything related to the model. It just sends a simple pagkage at the end of every run, just to test if things really work.\"\n end",
"def modeler_description\n return ['Adds', 'the', 'properties', 'for', 'the', 'MoisturePenetrationDepthConductionTransferFunction', 'or', 'effective', 'moisture', 'penetration', 'depth', '(EMPD)', 'Heat', 'Balance', 'Model', 'with', 'inputs', 'for', 'penetration', 'depths.', \"\\n\\n\", 'Leaving', 'Change', 'heat', 'balance', 'algorithm?', 'blank', 'will', 'use', 'the', 'current', 'OpenStudio', 'heat', 'balance', 'algorithm', 'setting.', \"\\n\\n\", 'At', 'least', '1', 'interior', 'material', 'needs', 'to', 'have', 'moisture', 'penetration', 'depth', 'properties', 'set', 'to', 'use', 'the', 'EMPD', 'heat', 'balance', 'algorithm.'].join(' ')\n end",
"def modeler_description\n return \"Change water heater efficiency and fuel type.\"\n end",
"def modeler_description\n return \"Assume that the starting point technology is primarily 90.1-2013 T8 lighting, with an efficacy of 90 lm/W. According to Table 5.2, LED Efficacy Improvement, in (1), 2015 LED luminaire efficacy is 145 lm/W. Calculate the total lighting power of the model and divide by this initial efficacy to determine the total number of lumens needed. Assuming that this same number of lumens should be provided by LED lighting, divide by the LED efficacy to determine the total wattage of LEDs that would be necessary to achieve the same lighting. Reduce the overall building lighting power by the resulting multiplier. IE new LPD = old LPD * (1 - 90 lm/W /145 lm/W). This is a very crude estimate of the impact of current LED technology. In order to perform a more nuanced analysis, lighting in the prototype buildings should be broken down by use type (general space lighting, task lighting, etc.) and by currently assumed technology (T12, T8, metal halide, etc.). If this breakdown were available, each type of lighting could be modified according to its own efficacy characteristics. Additionally, this measure does not account for the impact of LEDs on outdoor lighting.\"\n end",
"def modeler_description\n return 'For each model, find every DX cooling and heating coil and increase the COP to 6. Since very little information about this technology is available, do not change performance curves or upper/lower operating temperature limits.'\n end",
"def modeler_description\n return \"This measure will replicate the functionality described in the EnergyPlus Energy Management System Application Guide, Example 2., based on user input.\"\n end",
"def modeler_description\n return 'This measure assigns load and flow information to a selected plant loop load profile.'\n end",
"def modeler_description\n return \"This is intended to run on an empty model. It will create the proper model associate it with the proper weather file, and add in necessary output requests. Internally to the measure the test case argument will be mapped to the proper inputs needed to assemble the model. The measure will make some objects on the fly, other objects will be pulled from existing data resources. This measure creates cases described all of section 5.3.\"\n end",
"def modeler_description\n return \"Each DX cooling coil in the model is replaced by a membrane heat pump. To represent the membrane heat pump, the DX cooling coil COP is increased to 7.62 (26 EER). Additionally, add a water use equipment object to account for the 3 gallons of water used per ton*hr of sensible cooling process.\"\n end",
"def modeler_description\n 'For the most part consumption data comes from the tabular EnergyPlus results, however there are a few requests added for time series results. Space type and loop details come from the OpenStudio model. The code for this is modular, making it easy to use as a template for your own custom reports. The structure of the report uses bootstrap, and the graphs use dimple js.'\n end",
"def modeler_description\n return 'Adds typical refrigeration equipment to a building'\n end",
"def modeler_description\r\n return \"\"\r\n end",
"def modeler_description\n return \"E+ RESNET\"\n end",
"def modeler_description\n return \"Reads the model and sql file to pull out the necessary information and run the model checks. The check results show up as warning messages in the measure's output on the PAT run tab.\"\n end",
"def modeler_description\n return \"\"\n end",
"def modeler_description\n return \"\"\n end",
"def modeler_description\n return \"\"\n end",
"def modeler_description\n return \"\"\n end",
"def modeler_description\n return \"\"\n end",
"def modeler_description\n return \"\"\n end",
"def modeler_description\n return \"\"\n end",
"def modeler_description\n return \"A measure that will take Annual Building Utilty Performance tables, Demand End use Components summary table, Source Energy End Use Components Summary and produce an output Json\"\n end",
"def modeler_description\n return \"Reads the model and sql file to pull out the necessary information and run the model checks. The check results show up as Warning messages in the measure's output on the PAT run tab.\"\n end",
"def modeler_description\n return 'The goal of this measure is to create a single space type that represents the loads and schedules of a collection of space types in a model. When possible the measure will create mulitple load instances of a specific type in the resulting blended space type. This allows the original schedules to be used, and can allow for down stream EE measures on specific internal loads. Design Ventilation Outdoor Air objects will have to be merged into a single object. Will try to maintain the load design type (power, per area, per person) when possible. Need to account for zone multipliers when createding blended internal loads. Also address what happens to daylighting control objets. Original space types will be left in the model, some may still be assigned to spaces not included in the building area.'\n end",
"def modeler_description\n 'It will be used for calibration maximum flow rate, efficiency, pressure rise and motor efficiency. User can choose between a SINGLE Fan or ALL the Fans.'\n end",
"def modeler_description\n return ''\n end",
"def modeler_description\n return ''\n end",
"def modeler_description\n return ''\n end",
"def modeler_description\n return ''\n end",
"def modeler_description\n return ''\n end",
"def modeler_description\n return ''\n end",
"def modeler_description\n return ''\n end",
"def modeler_description\n return 'This measure has optional arguments to apply recommendations from different sections of the Zero Energy Multifamily Design Guide.'\n end",
"def modeler_description\n 'It will be used for calibration of WaterHeaterMixed. User can choose between a SINGLE WaterHeaterMixed or ALL the WaterHeaterMixed objects.'\n end",
"def modeler_description\n return \"It will be used for calibration of inlet water temperatures, inlet and outlet air temperatures and design flowrates. User can choose between a SINGLE coil or ALL the Coils.\"\n end",
"def modeler_description\n return 'Find the exterior lighting template for the building, and assume the existing efficiency level in the model (low, medium, high). Find the desing level and multiplier for each category of the exterior lighting definition. Apply the lighting upgrades by reducing the design level associated with each outdoor lighting category by a percent (depends on starting and target efficiency levels).'\n end",
"def modeler_description\n return 'Change UrbanOpt Scenario CSV'\n end",
"def modeler_description\n return 'Calculate thermal capacitance and UA for surfaces, furniture, and spaces.'\n end",
"def modeler_description\n return 'Reports resilience metric(s) of interest.'\n end",
"def modeler_description\n return \"The default space types in the measure inputs are automatically filled by the spaces' standard space types. User can overwrite the default assumptions in the library.csv file in the measure's resources folder.\"\n end",
"def modeler_description\n return 'Find the interior lighting template for the building, and assume the existing efficiency level in the model (low, medium, high, very high). Find the LPD and LPD fractions for each space type. Apply the lighting upgrades by reducing the LPD associated with compact lighting by a percent (depends on starting and target efficiency levels).'\n end",
"def modeler_description\n 'Run a simulation to autosize HVAC equipment and then apply these autosized values back to the model.'\n end",
"def modeler_description\r\n return \"E+ measure to popolate the Kiva settings values\"\r\n end",
"def modeler_description\n return 'This method calculates the annualized coefficient of performance (Btu out / Btu in) of equipment in the model from the annual simulation. This is used in Scout as the equipment efficiency for the technology competition categories.'\n end",
"def modeler_description\n return 'This will only impact schedule rulesets. It will use methods in openstudio-standards to infer hours of operation, develop a parametric formula for all of the ruleset schedules, alter the hours of operation inputs to that formula and then re-apply the schedules. Input is expose to set ramp frequency of the resulting schedules. If inputs are such that no changes are requested, bypass the measure with NA so that it will not be parameterized. An advanced option for this measure would be bool to use hours of operation from OSM schedule ruleset hours of operation instead of inferring from standards. This should allow different parts of the building to have different hours of operation in the seed model.'\n end",
"def modeler_description\n return \"Replace this text with an explanation for the energy modeler specifically. It should explain how the measure is modeled, including any requirements about how the baseline model must be set up, major assumptions, citations of references to applicable modeling resources, etc. The energy modeler should be able to read this description and understand what changes the measure is making to the model and why these changes are being made. Because the Modeler Description is written for an expert audience, using common abbreviations for brevity is good practice.\"\n end",
"def modeler_description\n return \"Any supply components or baseboard convective electrics/waters are removed from any existing air/plant loops or zones. Any existing air/plant loops are also removed. A heating DX coil, cooling DX coil, electric supplemental heating coil, and an on/off supply fan are added to a unitary air loop. The unitary air loop is added to the supply inlet node of the air loop. This air loop is added to a branch for the living zone. A diffuser is added to the branch for the living zone as well as for the finished basement if it exists.\"\n end",
"def modeler_description\r\n return 'modify simulation timestep'\r\n end",
"def modeler_description\n return 'Will add the necessary UtilityCost objects and associated schedule into the model.'\n end",
"def modeler_description\n return 'Replace this text with an explanation for the energy modeler specifically. It should explain how the measure is modeled, including any requirements about how the baseline model must be set up, major assumptions, citations of references to applicable modeling resources, etc. The energy modeler should be able to read this description and understand what changes the measure is making to the model and why these changes are being made. Because the Modeler Description is written for an expert audience, using common abbreviations for brevity is good practice.'\n end",
"def modeler_description\n return 'Replace this text with an explanation for the energy modeler specifically. It should explain how the measure is modeled, including any requirements about how the baseline model must be set up, major assumptions, citations of references to applicable modeling resources, etc. The energy modeler should be able to read this description and understand what changes the measure is making to the model and why these changes are being made. Because the Modeler Description is written for an expert audience, using common abbreviations for brevity is good practice.'\n end",
"def modeler_description\n return 'Passes in all arguments from the options lookup, processes them, and then registers values to the runner to be used by other measures.'\n end",
"def modeler_description\n return 'Daylighting controls will physically add in daylighting controls to spaces in the building, while occupancy control will reduce lighting schedules by 10%.'\n end",
"def modeler_description\n return 'This measure is used to calibrate the BRICR baseline model.'\n end",
"def modeler_description\n return \"This measure will demonstrate how an OpenStudio measure calling EMS functions can be used to model the performance of HVAC equipment that cannot be represented well by using single “standard” performance curve objects (cubic, quadratic, biquadratic, etc.) For example, properly characterizing some HVAC equipment objects requires using different performance curves that cover operation of different parts of the performance regime. This measure will alter (overwrite) the Coil Cooling DX Single Speed Cooling Capacity as a function of temperature performance curve object and attributes used by the simulation if the outdoor air temperature falls below a user defined threshold. This measure allows the user to define the biquadratic curve coefficients associated with the Coil Cooling DX Single Speed Cooling Capacity.\"\n end",
"def modeler_description\n return \"This EEM adds EMS logic to the model that actuates the infiltration, HVAC operation, cooling set point, and heating set point schedules. The measure first identifies the schedule HVAC stopping point by day of week (Saturday, Sunday, and Weekdays). Early HVAC system shutoff is determined entirely by the outdoor air temperature (OAT). If the OAT is less than or equal to 2C or greater than or equal to 18C, then no action is taken. The HVAC system is shut off one hour early when the OAT is between 12C and 18C. The HVAC system shut off time varies linearly with OAT from one hour to zero hours between 12C and 2C, and between 18C and 28C. AvailabilityManager:OptimumStart objects are inserted for each HVAC system in the model and use the AdaptiveASHRAE algorithm to dynamically adjust HVAC startup time each day.\"\n end",
"def modeler_description\n return \"Multipliers for LPD, EPD, and people densities.\"\n end",
"def modeler_description\n return \"This measure takes the user selected standards space type and sets the interior lighting and equipment load definitions subcategory to match the space type name. \"\n end",
"def modeler_description\n return 'Will add the necessary UtilityCost objects into the model.'\n end",
"def modeler_description\n return \"This measure will demonstrate how an OpenStudio measure calling EMS functions can be used to override specified thermostat control logic and set alternate modes of operation. This EMS measure sets a specific (user defined) indoor VRF terminal unit to operate at a specific (user-defined) part load ratio, constrained by operate minimum and maximum outdoor temperature limits of the paired condenser unit. The main input objects that implement this example are the variable refrigerant flow actuators that control the VRF system and specific terminal unit. Note that the terminal unit PLR can be controlled without controlling the mode of the VRF condenser, however, the specific terminal unit will operate in whatever mode the existing operation control scheme chooses. This example program simply “sets” the operating mode and PLR, other more complex control algorithms can be developed by the user as needed\"\n end",
"def modeler_description\n return 'This measure swaps old cases with 2017 code compliant cases and more efficient ones.'\n end",
"def modeler_description\n return \"The example demonstrates the use of a thermostat schedule object as and EMS actuator object. The EMS program alters the scheduled values as a function of hour of day and day of week.\"\n end",
"def modeler_description\n 'This measure changes the Layer 0 properties of Thickness, Density, Thermal Absorptance, Solar Absorptance, Visible Absoptance, Thermal Conductivity, Specific Heat.'\n end",
"def modeler_description\n return \"The measure loops through the AirLoops associated with the model, and determines an occupancy weighted schedule with values of 1 or 0 based on the percent of peak occupancy at the timestep being above or below a set threshold value of 5 percent. The resulting occupancy schedule is applied to the airloop attribute for the availability schedule. The measure then loops through all thermal zones, examining if there are zone equipment objects attached. If there are one or more zone equipment object attached to the zone, a thermal zone occupancy weighted schedule with values of 1 or 0 based on the percent of peak occupancy at the timestep being above or below a set threshold value of 5 percent is generated. The schedule is then assigned to the availability schedule of the associated zone equipment. To prevent energy use by any corresponding plant loops, the pump control type attribute of Constant or Variable speed pump objects in the model are set to intermittent. The measure them adds heating and cooling unmet hours and Simplified ASHRAE Standard 55 warning reporting variable to each thermal zone. \"\n end",
"def modeler_description\r\n return \"This measure loops through the existing airloops, looking for loops that have a constant speed fan. (Note that if an object such as an AirloopHVAC:UnitarySystem is present in the model, that the measure will NOT identify that loop as either constant- or variable-speed, since the fan is located inside the UnitarySystem object.) The user can designate which constant-speed airloop they'd like to apply the measure to, or opt to apply the measure to all airloops. The measure then replaces the supply components on the airloop with an AirloopHVAC:UnitarySystem object. Any DX coils added to the UnitarySystem object are of the type CoilCoolingDXMultiSpeed / CoilHeatingDXMultiSpeed, with the number of stages set to either two or four, depending on user input. If the user opts for a gas furnace, an 80% efficient CoilHeatingGas object is added. Fan properties (pressure rise and total efficiency) are transferred automatically from the existing (but deleted) constant speed fan to the new variable-speed fan. Currently, this measure is only applicable to the Standalone Retail DOE Prototype building model, but it has been structured to facilitate expansion to other models with a minimum of effort.\"\r\n end",
"def modeler_description\n return \"The measure loops through the heating and cooling thermostat schedules associated each thermal zone. The existing heating and cooling schedules are cloned, and the all run period profiles are then modified by adding a +1.5 deg F shift to the all values of the cooling thermostat schedule and a -1.5 degree F shift to all values of the heating thermostat schedule. Design Day profiles are not modified. The modified thermostat schedules are then assigned to the thermal zone. For each Thermal Zone, ASHRAE 55 Thermal Comfort Warnings is also enabled. Zone Thermal Comfort ASHRAE 55 Adaptive Model 90% Acceptability Status output variables is also added to the model.\"\n end",
"def modeler_description\r\n return \"The Measure adds a Schedule Availability Manager to the Selected Plant Loop\"\r\n end",
"def modeler_description\n return 'Converts the OpenStudio model to vA3C JSON format and renders using Three.js, simulation data is applied to surfaces of the model'\n end",
"def modeler_description\n return 'This energy efficiency measure (EEM) replaces all cooling tower objects in a model of the following types: (OS:CoolingTowerPerformanceCoolTools, OS:CoolingTowerPerformanceYorkCalc, OS:CoolingTowerSingleSpeed, OS:CoolingTowerTwoSpeed, or OS:CoolingTowerVariableSpeed) with a new OS:CoolingTower:VariableSpeed object. If an existing cooling tower is already configured for variable speed, the measure will inform the user. When replacing an existing tower object, the following values from the existing tower configuration will be reused: Design Inlet Air Wet Bulb Temp, Design Approach Temperature, Design Range Temperature, Design Water Flow Rate, Design Air Flow Rate, Design Fan Power, Fraction of Tower Capacity in the Free Convection Regime, Basin Heater Capacity, Basin Heater Setpoint Temperature, Basin Heater Operating Schedule, Number of Cells, Cell Control, Cell Minimum and Maximum Water Flow Rate Fractions and Sizing Factor. A performance curve relating fan power to tower airflow rates is used. The curve assumes the fan power ratio is directly proportional to the air flow rate ratio cubed. A Minimum Air Flow Rate Ratio of 20% will be set. To model minimal but realistic water consumption, the Evaporation Loss Mode for new Tower objects will be set to ?Saturated Exit? and Drift Loss Percent will be set to a value of 0.05% of the Design Water Flow. Blowdown water usage will be based on maintaining a Concentration Ratio of 3.0.'\n end",
"def make_and_model; end",
"def modeler_description\n return 'Replaces exterior window constructions with a different construction from the model.'\n end",
"def modeler_description\n return \"This measure will demonstrate how an OpenStudio measure calling EMS functions can be used to investigate dynamic envelope technologies such as emulating thermochromic window performance using EMS actuators and control types. This measure will replace the construction description of a user-selected window based on the outside surface temperature of that window, evaluated at each timestep\"\n end",
"def modeler_description\n return \"This measure will demonstrate how EMS functions can be used to demonstrate how information from a sizing run can be used to select HVAC equipment from nominal product sizes where unit total capacity is directly related to the unit supply airflow (1 ton = 1200 cfm, 1.5 ton = 1600 cfm, etc.) of commercial packaged single-zone HVAC air systems. This measure is designed to work on AirLoops with packaged DX cooling equipment only. EMS functions will be used to extract the design supply airflow generated from system auto-sizing calculations. An interval variable is used to override the Sizing:System - 'Intermediate Air System Main Supply Volume Flow Rate' value variable. This measure approximates the manner that appropriate ‘real world’ equipment selections are made by HVAC design engineers. The table below will be used to map to the Maximum Flow rate of the packaged unit Fan:ConstantVolume object.\"\n end",
"def modeler_description\n return \"This measure adds active or passive chilled beam units to selected conditioned thermal zones. In addition the user can select an existing air loop to serve active beams, or create a new Dual Wheel DOAS. Users can also select an existing chilled water loop to provide chilled water to beams, or create a new high temperature chiller water loop. Users are highly encouraged to review and modify the control strategies that this measure creates, such that it reflects their modeling scenario of interest.\"\n end",
"def modeler_description\n return \"Any heating components or baseboard convective electrics/waters are removed from any existing air/plant loops or zones. A boiler along with constant speed pump and water baseboard coils are added to a hot water plant loop.\"\n end",
"def modeler_description\n return 'Thermal zones will be named after the spac with a prefix added'\n end",
"def inspect\n \"#<#{self.class.name} @model=#{model.name} @relation_name=#{relation_name} @repository=#{self.class.repository}>\"\n end",
"def inspect\n \"#<#{self.class.name} @model=#{model.inspect} @name=#{name.inspect}>\"\n end",
"def modeler_description\n return \"Reduces runtime fraction of lights by user-specified amount during the user-specified time period (typically daytime). This is an attempt to represent the impact of using the light collected on the roof instead of electric lighting. This modeling approach does not capture the impact of using a PV cell to turn the IR spectrum of the captured light into electricity.\"\n end",
"def modeler_description\n return 'This measure receives the AntiSweat heater Control from the user. Then it looks for refrigerated display cases; it loops through them; it checks the current AntiSweat heater Control of each case and it substitute it with the one chosen by the user.'\n end"
] | [
"0.7710149",
"0.76145315",
"0.75934714",
"0.74018747",
"0.7299891",
"0.7296635",
"0.727943",
"0.71912926",
"0.71912926",
"0.7191264",
"0.7100944",
"0.70977926",
"0.70629936",
"0.7045383",
"0.7044268",
"0.70413125",
"0.7040473",
"0.7032938",
"0.70267737",
"0.70182866",
"0.69875926",
"0.6980763",
"0.69496983",
"0.69420075",
"0.6936087",
"0.6927004",
"0.6908837",
"0.6901907",
"0.6893215",
"0.6888214",
"0.68663764",
"0.6865241",
"0.68641704",
"0.68588334",
"0.6852012",
"0.6852012",
"0.6852012",
"0.6852012",
"0.6852012",
"0.6852012",
"0.6852012",
"0.6833133",
"0.68219167",
"0.68055475",
"0.6791062",
"0.67879057",
"0.67879057",
"0.67879057",
"0.67879057",
"0.67879057",
"0.67879057",
"0.67879057",
"0.67796487",
"0.6773994",
"0.6751447",
"0.67244256",
"0.6720888",
"0.6716974",
"0.6708703",
"0.67021894",
"0.668961",
"0.66878057",
"0.6672712",
"0.6662903",
"0.6649447",
"0.6643762",
"0.6634445",
"0.66330194",
"0.662195",
"0.6616422",
"0.6616422",
"0.66100585",
"0.659982",
"0.6589568",
"0.6588373",
"0.65865505",
"0.6584234",
"0.65638506",
"0.6560483",
"0.6554784",
"0.65097153",
"0.64903986",
"0.64771026",
"0.6466807",
"0.6462787",
"0.6450267",
"0.6443914",
"0.64391804",
"0.6431919",
"0.6429849",
"0.6426015",
"0.6422519",
"0.6421918",
"0.64181775",
"0.6409096",
"0.64074343",
"0.64067763",
"0.6405944",
"0.64003026",
"0.6370144"
] | 0.6415888 | 94 |
define the arguments that the user will input | def arguments(model)
args = OpenStudio::Ruleset::OSArgumentVector.new
return args
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def arguments; end",
"def arguments; end",
"def arguments; end",
"def arguments\n \"\"\n end",
"def args; end",
"def args; end",
"def args; end",
"def args; end",
"def args; end",
"def args; end",
"def args; end",
"def args; end",
"def args; end",
"def args; end",
"def args; end",
"def args; end",
"def args; end",
"def args; end",
"def args; end",
"def args; end",
"def args; end",
"def args; end",
"def args; end",
"def args; end",
"def get_input \n puts \"to save this game, input 's,filename'\"\n puts \"to load a game, input 'l,filename'\"\n puts \"input a coordinate to access. prefix with r for reveal or f for flag\"\n puts \"example 'f,1,2' places a flag at 1,2\"\n input = gets.chomp\n \n args = input.split(',')\n end",
"def args(*) end",
"def arguments(required, *optional)\n puts \"required: #{required}\"\n puts \"optional: #{optional}\"\nend",
"def args()\n #This is a stub, used for indexing\n end",
"def arguments()\n args = OpenStudio::Ruleset::OSArgumentVector.new\n\n #make an argument for the variable name\n variable_name = OpenStudio::Ruleset::OSArgument::makeStringArgument(\"variable_name\",true)\n variable_name.setDisplayName(\"Enter Variable Name.\")\n variable_name.setDescription(\"Valid values can be found in the eplusout.rdd file after a simulation is run.\")\n args << variable_name\n \n #make an argument for the electric tariff\n reporting_frequency_chs = OpenStudio::StringVector.new\n reporting_frequency_chs << \"Detailed\"\n reporting_frequency_chs << \"Timestep\"\n reporting_frequency_chs << \"Zone Timestep\"\n reporting_frequency_chs << \"Hourly\"\n reporting_frequency_chs << \"Daily\"\n reporting_frequency_chs << \"Monthly\"\n reporting_frequency_chs << \"Runperiod\"\n reporting_frequency = OpenStudio::Ruleset::OSArgument::makeChoiceArgument('reporting_frequency', reporting_frequency_chs, true)\n reporting_frequency.setDisplayName(\"Reporting Frequency.\")\n reporting_frequency.setDefaultValue(\"Hourly\")\n args << reporting_frequency\n\n #make an argument for the key_value\n key_value = OpenStudio::Ruleset::OSArgument::makeStringArgument(\"key_value\",true)\n key_value.setDisplayName(\"Enter Key Name.\")\n key_value.setDescription(\"Enter * for all objects or the full name of a specific object to.\")\n key_value.setDefaultValue(\"*\")\n args << key_value\n \n env = OpenStudio::Ruleset::OSArgument.makeStringArgument(\"env\", true)\n env.setDisplayName(\"availableEnvPeriods\")\n env.setDescription(\"availableEnvPeriods\")\n env.setDefaultValue(\"RUN PERIOD 1\")\n args << env\n \n return args\n end",
"def set_arguments (args)\n end",
"def arguments\n args = OpenStudio::Measure::OSArgumentVector.new\n\n # make an argument for the variable name\n variable_name = OpenStudio::Measure::OSArgument.makeStringArgument('variable_name', true)\n variable_name.setDisplayName('Enter Variable Name.')\n variable_name.setDescription('Valid values can be found in the eplusout.rdd file after a simulation is run.')\n args << variable_name\n\n # make an argument for the electric tariff\n reporting_frequency_chs = OpenStudio::StringVector.new\n reporting_frequency_chs << 'Detailed'\n reporting_frequency_chs << 'Timestep'\n reporting_frequency_chs << 'Zone Timestep'\n reporting_frequency_chs << 'Hourly'\n reporting_frequency_chs << 'Daily'\n reporting_frequency_chs << 'Monthly'\n reporting_frequency_chs << 'Runperiod'\n reporting_frequency = OpenStudio::Measure::OSArgument.makeChoiceArgument('reporting_frequency', reporting_frequency_chs, true)\n reporting_frequency.setDisplayName('Reporting Frequency.')\n reporting_frequency.setDefaultValue('Hourly')\n args << reporting_frequency\n\n # make an argument for the key_value\n key_value = OpenStudio::Measure::OSArgument.makeStringArgument('key_value', true)\n key_value.setDisplayName('Enter Key Name.')\n key_value.setDescription('Enter * for all objects or the full name of a specific object to.')\n key_value.setDefaultValue('*')\n args << key_value\n\n env = OpenStudio::Measure::OSArgument.makeStringArgument('env', true)\n env.setDisplayName('availableEnvPeriods')\n env.setDescription('availableEnvPeriods')\n env.setDefaultValue('RUN PERIOD 1')\n args << env\n\n args\n end",
"def handle_arguments(args)\n if input_file.nil?\n print_usage\n true\n else\n args.help || args.version\n end\n end",
"def arguments=(_arg0); end",
"def command_line\r\n ARGV.each do |arg|\r\n if arg == \"instructions\"\r\n instructions\r\n elsif arg == \"calculator\"\r\n ask_for_digits\r\n else\r\n \r\n end\r\n end\r\n \r\n end",
"def prescreen_input(args)\n if ((args.nil?) || (args.empty?))\n ['-eq', Date.today.strftime('%Y-%m-%d')]\n elsif ((args.length == 1) && (args[0].is_date?))\n ['-eq', args[0]]\n else\n args\n end\nend",
"def varios_args(*args)\n puts \"Tamanho de args: #{args.size}\"\n args.each { |x| p x}\n end",
"def process_arguments\n @e_addr = @options.email\n @r_name = @options.run_names\n @m_name = @options.machine_names\n @action = @options.action\n @snfs = @options.snfs\n end",
"def arguments\n args = OpenStudio::Measure::OSArgumentVector.new\n\n # url of the city database\n city_db_url = OpenStudio::Measure::OSArgument.makeStringArgument('city_db_url', true)\n city_db_url.setDisplayName('City Database Url')\n city_db_url.setDescription('Url of the City Database')\n city_db_url.setDefaultValue('')\n args << city_db_url\n\n # project id to update\n project_id = OpenStudio::Measure::OSArgument.makeStringArgument('project_id', true)\n project_id.setDisplayName('Project ID')\n project_id.setDescription('Project ID to generate reports for.')\n project_id.setDefaultValue('0')\n args << project_id\n\n # datapoint id to update\n datapoint_id = OpenStudio::Measure::OSArgument.makeStringArgument('datapoint_id', true)\n datapoint_id.setDisplayName('Datapoint ID')\n datapoint_id.setDescription('Datapoint ID to generate reports for.')\n datapoint_id.setDefaultValue('0')\n args << datapoint_id\n\n return args\n end",
"def validate_args (args)\n\t# todo\nend",
"def args() return @args end",
"def input=(_arg0); end",
"def process_inputs(args)\n @input = ((name = args[:in_file]) && (IO.read(name, mode: \"rb\"))) ||\n args[:in_str] ||\n fail(\"An input must be specified.\")\n\n @generator = args[:generator] ||\n ((key = args[:key]) && Generator.new(key)) ||\n fail(\"A key or generator must be specified.\")\n\n @window = args[:window] || 16\n\n #The filler value is for testing purposes only. It should\n #not be specified when secure operation is desired.\n @fill_value = args[:filler]\n end",
"def parse_args\r\n if(cmd.args =~ /\\=/)\r\n self.names = InputFormatter.titlecase_arg(cmd.args.before(\"=\"))\r\n self.action_args = cmd.args.after(\"=\")\r\n elseif (cmd.args && one_word_command)\r\n self.names = InputFormatter.titlecase_arg(cmd.args)\r\n self.action_args = \"\"\r\n else\r\n self.names = enactor.name\r\n self.action_args = cmd.args\r\n end\r\n\r\n self.names = self.names ? self.names.split(/[ ,]/) : nil\r\n\r\n self.combat_command = cmd.switch ? cmd.switch.downcase : nil\r\n end",
"def manage_args(*args)\n end",
"def arguments(model)\n args = OpenStudio::Ruleset::OSArgumentVector.new\n \n #make an argument for your name\n user_name = OpenStudio::Ruleset::OSArgument::makeStringArgument(\"user_name\",true)\n user_name.setDisplayName(\"What is your name?\")\n args << user_name\n\n #make an argument to add new space true/false\n add_space = OpenStudio::Ruleset::OSArgument::makeBoolArgument(\"add_space\",true)\n add_space.setDisplayName(\"Add a space to your model?\")\n add_space.setDefaultValue(true)\n args << add_space\n \n return args\n end",
"def greeting\n puts \"Hello, MTA rider! How can we help?\"\n puts \"please enter one of the following commands:\"\n puts \"lines / stops the_line / calculate Departing_Line Departing_Stop Arriving_Line Arriving_Stop\"\n user_call, *user_args = gets.chomp\n user_args.to_s\n # user_args.split(\" \")\n # puts user_input\n\n if user_call == lines\n show_lines()\n elsif user_call == stops\n show_stops(user_args[0])\n elsif user_call == calculate\n if user_args.length < 4\n puts 'please enter \"Departing_Line Departing_Stop Arriving_Line Arriving_Stop\"'\n puts 'or enter \"exit\" to return to the home screen' \n user_input = gets.chomp\n if user_input == \"exit\"\n greeting()\n end \n user_input = user_input.split(\" \")\n calculate(user_input[0], user_input[1], user_input[2], user_input[3])\n else\n calculate(user_args[0], user_args[1], user_args[2], user_args[3])\n end\n else\n \n end\nend",
"def arguments(model)\n args = OpenStudio::Measure::OSArgumentVector.new\n\n\n\n # Make an argument for evap effectiveness\n input_csv_path = OpenStudio::Measure::OSArgument::makeStringArgument(\"input_csv_folder_path\",true)\n input_csv_path.setDisplayName(\"raw_data_input_folder_path\")\n input_csv_path.setDefaultValue(\"data_file\")\n args << input_csv_path\n\n test_numbers = OpenStudio::StringVector.new\n test_numbers << 'Test_3'\n test_numbers << 'Test_6'\n test_numbers << 'Test_8'\n \n test_names = OpenStudio::StringVector.new\n test_names << 'UA_test'\n test_names << 'Cooling_test'\n test_names << 'Plenum_test'\n\n test_selections = OpenStudio::Ruleset::OSArgument::makeChoiceArgument('test_data',test_numbers,test_names,true)\n\n \n test_selections.setDisplayName(\"Experiment\")\n test_selections.setDefaultValue(\"Test_3\")\n args << test_selections\n\n \n return args\n end",
"def arguments\n args = OpenStudio::Ruleset::OSArgumentVector.new\n\n # URL of the DEnCity server that will be posted to\n hostname = OpenStudio::Ruleset::OSArgument::makeStringArgument('hostname', true)\n hostname.setDisplayName('URL of the DEnCity Server')\n hostname.setDefaultValue('http://www.dencity.org')\n args << hostname\n\n # DEnCity server user id at hostname\n user_id = OpenStudio::Ruleset::OSArgument::makeStringArgument('user_id',true)\n user_id.setDisplayName('User ID for DEnCity Server')\n args << user_id\n\n # DEnCIty server user id's password\n auth_code = OpenStudio::Ruleset::OSArgument::makeStringArgument('auth_code', true)\n auth_code.setDisplayName('Authentication code for User ID on DEnCity server')\n args << auth_code\n\n # Building type for DEnCity's metadata\n building_type = OpenStudio::Ruleset::OSArgument::makeStringArgument('building_type', false)\n building_type.setDisplayName('Building type')\n args << building_type\n\n # HVAC system for DEnCity's metadata\n primary_hvac = OpenStudio::Ruleset::OSArgument::makeStringArgument('primary_hvac', false)\n primary_hvac.setDisplayName('Primary HVAC system in building')\n args << primary_hvac\n\n args\n\n end",
"def arguments\r\n args = OpenStudio::Ruleset::OSArgumentVector.new\r\n\r\n #make choice argument for facade\r\n choices = OpenStudio::StringVector.new\r\n choices << \"MessagePack\"\r\n choices << \"CSV\"\r\n choices << \"Both\"\r\n output_format = OpenStudio::Ruleset::OSArgument::makeChoiceArgument(\"output_format\", choices)\r\n output_format.setDisplayName(\"Output Format\")\r\n output_format.setDefaultValue(\"Both\")\r\n args << output_format\r\n\r\n args\r\n end",
"def arguments(model)\n args = OpenStudio::Measure::OSArgumentVector.new\n\t\n #make an argument for entering furnace installed afue\n afue = OpenStudio::Measure::OSArgument::makeDoubleArgument(\"afue\",true)\n afue.setDisplayName(\"Installed AFUE\")\n afue.setUnits(\"Btu/Btu\")\n afue.setDescription(\"The installed Annual Fuel Utilization Efficiency (AFUE) of the furnace, which can be used to account for performance derating or degradation relative to the rated value.\")\n afue.setDefaultValue(1.0)\n args << afue\n\n #make an argument for entering furnace installed supply fan power\n fanpower = OpenStudio::Measure::OSArgument::makeDoubleArgument(\"fan_power_installed\",true)\n fanpower.setDisplayName(\"Installed Supply Fan Power\")\n fanpower.setUnits(\"W/cfm\")\n fanpower.setDescription(\"Fan power (in W) per delivered airflow rate (in cfm) of the indoor fan for the maximum fan speed under actual operating conditions.\")\n fanpower.setDefaultValue(0.5)\n args << fanpower\t\n\t\n #make a string argument for furnace heating output capacity\n furnacecap = OpenStudio::Measure::OSArgument::makeStringArgument(\"capacity\", true)\n furnacecap.setDisplayName(\"Heating Capacity\")\n furnacecap.setDescription(\"The output heating capacity of the furnace. If using '#{Constants.SizingAuto}', the autosizing algorithm will use ACCA Manual S to set the capacity.\")\n furnacecap.setUnits(\"kBtu/hr\")\n furnacecap.setDefaultValue(Constants.SizingAuto)\n args << furnacecap\n \n return args\n end",
"def greeting(args)\r\n greet = args[:greet] || \"Hi\"\r\n title = args[:title] || \"Citizen\"\r\n name = args[:name] \r\n puts \"#{greet} #{title} #{name}\"\r\nend",
"def parse_args\n\t\t@args = @args_a.each_slice(2).to_a.inject({}) { |h, k| h[k[0]] = k[1]; h }\n\t\tkeys = @skeys + @lkeys\n\t\[email protected] do |k, v|\n\t\t\tif !keys.include?(k)\n\t\t\t\tputs \"Unknown option `#{k}'\"\n\t\t\t\texit\n\t\t\tend\n\n\t\t\tif keys.include?(v)\n\t\t\t\tputs \"Missing values for `#{k}' and `#{v}'\"\n\t\t\t\texit\n\t\t\tend\n\n\t\t\tif v != nil\n\t\t\t\tif v.start_with?('-')\n\t\t\t\t\tputs \"Warning: Value of `#{k}' appears to be a flag\"\n\t\t\t\tend\n\n\t\t\t\tif @static.has_key?(k)\n\t\t\t\t\tif !@static[k].include?(v)\n\t\t\t\t\t\tputs \"Unknown option `#{v}' for `#{k}'\"\n\t\t\t\t\t\texit\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\t\t\n\t\tif remove_keys(@no_vals).has_blank?\n\t\t\tputs \"Missing argument(s)\"\n\t\t\texit\n\t\tend\t\t\t\n\tend",
"def command_line_arguments(array)\n array.size.times do\n if array.include?('-nc')\n colour_changer(:white)\n array.delete('-nc')\n elsif array.any? { |x| ['-d1', '-d2', '-d3', '-d4'].include? x }\n key = (array[0])[1, 2].to_sym\n @difficulty = DIFFICULTY[key]\n @promptarr = prompt_select(key)\n @intro = false\n end\n end\n end",
"def arguments()\n args = OpenStudio::Measure::OSArgumentVector.new\n \n #make an argument for the frequency\n reporting_frequency_chs = OpenStudio::StringVector.new\n reporting_frequency_chs << \"Detailed\"\n reporting_frequency_chs << \"Timestep\"\n reporting_frequency_chs << \"Hourly\"\n reporting_frequency_chs << \"Daily\"\n reporting_frequency_chs << \"Monthly\"\n reporting_frequency_chs << \"Runperiod\"\n reporting_frequency = OpenStudio::Ruleset::OSArgument::makeChoiceArgument('reporting_frequency', reporting_frequency_chs, true)\n reporting_frequency.setDisplayName(\"Reporting Frequency\")\n reporting_frequency.setDefaultValue(\"Hourly\")\n args << reporting_frequency\n \n # TODO: argument for subset of output meters\n \n return args\n end",
"def arguments()\n args = OpenStudio::Measure::OSArgumentVector.new\n\n #make an argument for the frequency\n reporting_frequency_chs = OpenStudio::StringVector.new\n reporting_frequency_chs << \"Timestep\"\n reporting_frequency_chs << \"Hourly\"\n reporting_frequency_chs << \"Daily\"\n reporting_frequency_chs << \"Monthly\"\n reporting_frequency_chs << \"RunPeriod\"\n arg = OpenStudio::Measure::OSArgument::makeChoiceArgument('reporting_frequency', reporting_frequency_chs, true)\n arg.setDisplayName(\"Reporting Frequency\")\n arg.setDefaultValue(\"Hourly\")\n args << arg\n\n #make an argument for including optional output variables\n arg = OpenStudio::Measure::OSArgument::makeBoolArgument(\"inc_output_variables\", true)\n arg.setDisplayName(\"Include Output Variables\")\n arg.setDefaultValue(false)\n args << arg\n\n return args\n end",
"def arguments(model)\n args = OpenStudio::Ruleset::OSArgumentVector.new\n\n #make an argument for entering furnace installed afue\n userdefined_eff = OpenStudio::Ruleset::OSArgument::makeDoubleArgument(\"userdefinedeff\",true)\n userdefined_eff.setDisplayName(\"Efficiency\")\n\tuserdefined_eff.setUnits(\"Btu/Btu\")\n\tuserdefined_eff.setDescription(\"The efficiency of the electric baseboard.\")\n userdefined_eff.setDefaultValue(1.0)\n args << userdefined_eff\n\n #make a choice argument for furnace heating output capacity\n cap_display_names = OpenStudio::StringVector.new\n cap_display_names << Constants.SizingAuto\n (5..150).step(5) do |kbtu|\n cap_display_names << \"#{kbtu} kBtu/hr\"\n end\n\n #make a string argument for furnace heating output capacity\n selected_baseboardcap = OpenStudio::Ruleset::OSArgument::makeChoiceArgument(\"selectedbaseboardcap\", cap_display_names, true)\n selected_baseboardcap.setDisplayName(\"Heating Output Capacity\")\n selected_baseboardcap.setDefaultValue(Constants.SizingAuto)\n args << selected_baseboardcap\n\t\n return args\n end",
"def arguments(model)\n args = OpenStudio::Measure::OSArgumentVector.new\n\n #make an argument for entering baseboard efficiency\n baseboardeff = OpenStudio::Measure::OSArgument::makeDoubleArgument(\"efficiency\",true)\n baseboardeff.setDisplayName(\"Efficiency\")\n baseboardeff.setUnits(\"Btu/Btu\")\n baseboardeff.setDescription(\"The efficiency of the electric baseboard.\")\n baseboardeff.setDefaultValue(1.0)\n args << baseboardeff\n\n #make a string argument for baseboard heating output capacity\n baseboardcap = OpenStudio::Measure::OSArgument::makeStringArgument(\"capacity\", true)\n baseboardcap.setDisplayName(\"Heating Capacity\")\n baseboardcap.setDescription(\"The output heating capacity of the electric baseboard. If using '#{Constants.SizingAuto}', the autosizing algorithm will use ACCA Manual S to set the capacity.\")\n baseboardcap.setUnits(\"kBtu/hr\")\n baseboardcap.setDefaultValue(Constants.SizingAuto)\n args << baseboardcap\n\t\n return args\n end",
"def user_input_command_line_menu\n\tcommand_line_input = gets.strip.to_i\n\tcommand_line_input_logic(command_line_input)\nend",
"def cmdarg; end",
"def cmdarg; end",
"def cmdarg; end",
"def check_inputs_g(args)\n raise TypeError, Ajaila::Messager.warning(\"Nothing to generate...\") if args == []\n raise TypeError, Ajaila::Messager.warning(\"Only miners, selectors, presenters supported\\n(ex. miner SomeMiner, selector SomeSelector,\\n presenter SomePresenter, table SomeTable)\") if KNOWN_INSTANCES.include?(args[0]) == false\n raise TypeError, Ajaila::Messager.warning(\"Your #{args[0]} needs a name!\") if args[1] == nil\n raise TypeError, Ajaila::Messager.warning(\"Wrong format of the #{args[0]} name (use only A-Z and a-z symbols)\") if args[1][/^[A-Z]+$/i] == nil\n return 0\n end",
"def arguments\n parser.arguments\n end",
"def valid_args(type)\n case type\n when 'search' then %i[q format addressdetails extratags namedetails viewbox bounded exclude_place_ids limit accept-language email]\n when 'reverse' then %i[format lat lon zoom addressdetails extratags namedetails accept-language email]\n else []\n end\n end",
"def arguments\n args = OpenStudio::Measure::OSArgumentVector.new\n\n id = OpenStudio::Measure::OSArgument.makeStringArgument('feature_id', false)\n id.setDisplayName('Feature unique identifier')\n id.setDefaultValue('1')\n args << id\n\n name = OpenStudio::Measure::OSArgument.makeStringArgument('feature_name', false)\n name.setDisplayName('Feature scenario specific name')\n name.setDefaultValue('name')\n args << name\n\n feature_type = OpenStudio::Measure::OSArgument.makeStringArgument('feature_type', false)\n feature_type.setDisplayName('URBANopt Feature Type')\n feature_type.setDefaultValue('Building')\n args << feature_type\n\n feature_location = OpenStudio::Measure::OSArgument.makeStringArgument('feature_location', false)\n feature_location.setDisplayName('URBANopt Feature Location')\n feature_location.setDefaultValue('0')\n args << feature_location\n\n # make an argument for the frequency\n reporting_frequency_chs = OpenStudio::StringVector.new\n reporting_frequency_chs << 'Detailed'\n reporting_frequency_chs << 'Timestep'\n reporting_frequency_chs << 'Hourly'\n reporting_frequency_chs << 'Daily'\n # reporting_frequency_chs << 'Zone Timestep'\n reporting_frequency_chs << 'BillingPeriod' # match it to utility bill object\n ## Utility report here to report the start and end for each fueltype\n reporting_frequency_chs << 'Monthly'\n reporting_frequency_chs << 'Runperiod'\n\n reporting_frequency = OpenStudio::Measure::OSArgument.makeChoiceArgument('reporting_frequency', reporting_frequency_chs, true)\n reporting_frequency.setDisplayName('Reporting Frequency')\n reporting_frequency.setDescription('The frequency at which to report timeseries output data.')\n reporting_frequency.setDefaultValue('Timestep')\n args << reporting_frequency\n\n return args\n end",
"def madlib_inputs\n print \"Enter a noun: \" \n noun = gets.chomp\n print \"Enter a verb: \" \n verb = gets.chomp\n print \"Enter an adjective: \" \n adjective = gets.chomp\n print \"Enter an adverb: \" \n adverb = gets.chomp\n madlib_line(noun, verb, adjective, adverb)\nend",
"def arguments(model)\n args = OpenStudio::Ruleset::OSArgumentVector.new\n \n #make a start date argument\n start_date = OpenStudio::Ruleset::OSArgument::makeStringArgument(\"start_date\",true)\n start_date.setDisplayName(\"Start date\")\n args << start_date\n \n #make an end date argument\n end_date = OpenStudio::Ruleset::OSArgument::makeStringArgument(\"end_date\",true)\n end_date.setDisplayName(\"End date\")\n args << end_date\n \n return args\n end",
"def check_arguments\n convert_boolean_strings\n check_output\n check_log_level\n check_input_entry\n check_input_types\n end",
"def process_arguments\n # clean unsupport symbols, e.g. JieFang;\n # or error argument due to option typo, e.g. '-list' will put 'ist' into the array in this src.\n @support_newspapers = Array.new #TODO: move to elsewhere\n @support_newspapers << :XM\n @support_newspapers << :WHB\n @support_newspapers << :YZ\n # ATTENTION: command line input is an array of string, to be consistent, internally I use only symbol when using this symbol\n @options.newspapers = @options.newspapers.collect { | item | item.to_sym } & @support_newspapers\n \n if @options.newspapers.size == 0\n @support_newspapers.each do | sym |\n @options.newspapers << sym\n end\n end\n end",
"def args\n raw_args\n end",
"def argv; end",
"def arguments(model)\n args = OpenStudio::Ruleset::OSArgumentVector.new\n \n #make an argument for your name\n code_choices = OpenStudio::StringVector.new \n code_choices << \"ASHRAE 90.1-2007\" \n code_choices << \"ASHRAE 90.1-2010\" \n energy_code = OpenStudio::Ruleset::OSArgument::makeChoiceArgument('energy_code', code_choices, true)\n energy_code.setDisplayName(\"Code baseline\")\n energy_code.setDefaultValue(\"ASHRAE 90.1-2010\")\n args << energy_code\n \n #make an argument to add new space true/false\n leed_check = OpenStudio::Ruleset::OSArgument::makeBoolArgument(\"leed_check\",true)\n leed_check.setDisplayName(\"Perform typical LEED checks?\")\n leed_check.setDefaultValue(true)\n args << leed_check\n \n return args\n end",
"def arguments(model)\n #list of arguments as they will appear in the interface. They are available in the run command as\n @argument_array_of_arrays = [\n [ \"variable_name\", \"type\", \"required\", \"model_dependant\", \"display_name\", \"default_value\", \"min_value\", \"max_value\", \"string_choice_array\", \t\"os_object_type\"\t],\n [ \"weather_file_name\", \"STRING\", true, false, \"Weather File Name\", nil, nil, nil, nil, \t nil\t\t\t\t\t],\n #Default set for server weather folder.\n [ \"weather_directory\", \"STRING\", true, false, \"Weather Directory\", \"../../weather\", nil, nil, nil,\t nil\t\t\t\t\t]\n \n ]\n #set up arguments. \n args = OpenStudio::Ruleset::OSArgumentVector.new\n self.argument_setter(args)\n return args\n end",
"def inflamed _args\n \"inflamed _args;\" \n end",
"def more_options\n puts Rainbow(\"Specify your additional options for your search: 'release date', 'search history', or go back\").yellow.underline\n input = gets.chomp.downcase\n \n if input == \"release date\"\n option_release_date\n \n elsif input == \"search history\"\n game_history\n\n elsif input == \"go back\"\n continue_or_exit\n \n else \n puts \"Input not recognized please try again\"\n more_options\n end\n end",
"def cmd(options={})\n arguments\n end",
"def arguments()\n args = OpenStudio::Ruleset::OSArgumentVector.new\n\n # this measure will require arguments, but at this time, they are not known\n geometry_profile = OpenStudio::Ruleset::OSArgument::makeStringArgument('geometry_profile', true)\n geometry_profile.setDefaultValue(\"{}\")\n os_model = OpenStudio::Ruleset::OSArgument::makeStringArgument('os_model', true)\n os_model.setDefaultValue('multi-model mode')\n user_id = OpenStudio::Ruleset::OSArgument::makeStringArgument('user_id', true)\n user_id.setDefaultValue(\"00000000-0000-0000-0000-000000000000\")\n job_id = OpenStudio::Ruleset::OSArgument::makeStringArgument('job_id', true)\n #job_id.setDefaultValue(SecureRandom.uuid.to_s)\n ashrae_climate_zone = OpenStudio::Ruleset::OSArgument::makeStringArgument('ashrae_climate_zone', false)\n ashrae_climate_zone.setDefaultValue(\"-1\")\n building_type = OpenStudio::Ruleset::OSArgument::makeStringArgument('building_type', false)\n building_type.setDefaultValue(\"BadDefaultType\")\n\n args << geometry_profile\n args << os_model\n args << user_id\n args << job_id\n args << ashrae_climate_zone\n args << building_type\n\n return args\n end",
"def user_input\n\tgets\nend",
"def input\n @input ||= args.dig(:input)\n end",
"def parse_args\n require 'optimist'\n opts = Optimist.options do\n opt :source, \"Inventory Source UID\", :type => :string, :required => ENV[\"SOURCE_UID\"].nil?, :default => ENV[\"SOURCE_UID\"]\n opt :ingress_api, \"Hostname of the ingress-api route\", :type => :string, :default => ENV[\"INGRESS_API\"] || \"http://localhost:9292\"\n opt :config, \"Configuration file name\", :type => :string, :default => ENV[\"CONFIG\"] || \"default\"\n opt :data, \"Amount & custom values of generated items\", :type => :string, :default => ENV[\"DATA\"] || \"default\"\n end\n\n opts\nend",
"def arguments(model)\n args = OpenStudio::Ruleset::OSArgumentVector.new\n\n # lat arg\n lat = OpenStudio::Ruleset::OSArgument.makeDoubleArgument(\"lat\", true)\n lat.setDisplayName(\"Latitude\")\n lat.setDefaultValue(39.7392000000)\n args << lat\n\n # long arg\n lon = OpenStudio::Ruleset::OSArgument.makeDoubleArgument(\"lon\", true)\n lon.setDisplayName(\"Longitude\")\n lon.setDefaultValue(-104.9903000000)\n args << lon\n\n return args\n end",
"def add args\n db = get_db\n if args.empty?\n print \"Enter a short summary: \"\n STDOUT.flush\n text = gets.chomp\n if text.empty?\n exit ERRCODE\n end\n else\n # if you add last arg as P1..P5, I'll update priority automatically\n if args.last =~ /P[1-5]/\n $default_priority = args.pop\n end\n text = args.join \" \"\n end\n # convert actual newline to C-a. slash n's are escapes so echo -e does not muck up.\n #atitle=$( echo \"$atitle\" | tr -cd '\\40-\\176' )\n text.tr! \"\\n\", '\u0001'\n title = text\n desc = nil\n if $prompt_desc\n # choice of vim or this XXX also how to store in case of error or abandon\n # and allow user to edit, so no retyping. This could be for mult fields\n message \"Enter a detailed description (. to exit): \"\n desc = Cmdapp.get_lines\n #message \"You entered #{desc}\"\n end\n type = $default_type || \"bug\"\n severity = $default_severity || \"normal\"\n status = $default_status || \"open\"\n priority = $default_priority || \"P3\"\n if $prompt_type\n type = Cmdapp._choice(\"Select type:\", %w[bug enhancement feature task] )\n #message \"You selected #{type}\"\n end\n if $prompt_priority\n #priority = Cmdapp._choice(\"Select priority:\", %w[normal critical moderate] )\n priority = ask_priority\n #message \"You selected #{severity}\"\n end\n if $prompt_severity\n severity = Cmdapp._choice(\"Select severity:\", %w[normal critical moderate] )\n #message \"You selected #{severity}\"\n end\n if $prompt_status\n status = Cmdapp._choice(\"Select status:\", %w[open started closed stopped canceled] )\n #message \"You selected #{status}\"\n end\n assigned_to = $default_assigned_to\n if $prompt_assigned_to\n message \"Assign to:\"\n #assigned_to = $stdin.gets.chomp\n assigned_to = Cmdapp._gets \"assigned_to\", \"assigned_to\", $default_assigned_to\n #message \"You selected #{assigned_to}\"\n end\n project = component = version = nil\n # project\n if $use_project\n project = Cmdapp.user_input('project', $prompt_project, nil, $valid_project, $default_project)\n end\n if $use_component\n component = Cmdapp.user_input('component', $prompt_component, nil, $valid_component, $default_component)\n end\n if $use_version\n version = Cmdapp.user_input('version', $prompt_version, nil, $valid_version, $default_version)\n end\n\n start_date = @now\n due_date = default_due_date\n comment_count = 0\n priority ||= \"P3\" \n description = desc\n fix = nil #\"Some long text\" \n #date_created = @now\n #date_modified = @now\n body = {}\n body[\"title\"]=title\n body[\"description\"]=description\n body[\"type\"]=type\n body[\"status\"]=status\n body[\"start_date\"]=start_date.to_s\n body[\"due_date\"]=due_date.to_s\n body[\"priority\"]=priority\n body[\"severity\"]=severity\n body[\"assigned_to\"]=assigned_to\n body[\"created_by\"] = $default_user\n # only insert if its wanted by user\n body[\"project\"]=project if $use_project\n body[\"component\"]=component if $use_component\n body[\"version\"]=version if $use_version\n\n rowid = db.table_insert_hash(\"bugs\", body)\n puts \"Issue #{rowid} created\"\n logid = db.sql_logs_insert rowid, \"create\", \"#{rowid} #{type}: #{title}\"\n body[\"id\"] = rowid\n mail_issue nil, body\n \n 0\n end",
"def arguments(model)\n #list of arguments as they will appear in the interface. They are available in the run command as\n @argument_array_of_arrays = [\n [ \"variable_name\", \"type\", \"required\", \"model_dependant\", \"display_name\", \"default_value\", \"min_value\", \"max_value\", \"string_choice_array\", \"os_object_type\"\t ],\n [ \"alternativeModel\", \"STRING\", true, false, \"Alternative Model\", 'FullServiceRestaurant.osm', nil, nil, nil, \t nil\t\t\t\t\t],\n [ \"osm_directory\", \"STRING\", true, false, \"OSM Directory\", \"../../lib/btap/resources/models/smart_archetypes\", nil, nil, nil,\t nil\t\t\t\t\t] \n ]\n #set up arguments. \n args = OpenStudio::Ruleset::OSArgumentVector.new\n self.argument_setter(args)\n return args\n end",
"def arguments(model)\n #list of arguments as they will appear in the interface. They are available in the run command as\n @argument_array_of_arrays = [\n [ \"variable_name\", \"type\", \"required\", \"model_dependant\", \"display_name\", \"default_value\", \"min_value\", \"max_value\", \"string_choice_array\", \"os_object_type\"\t ],\n [ \"alternativeModel\", \"STRING\", true, false, \"Alternative Model\", 'FullServiceRestaurant.osm', nil, nil, nil, \t nil\t\t\t\t\t],\n [ \"osm_directory\", \"STRING\", true, false, \"OSM Directory\", \"../../lib/btap/resources/models/smart_archetypes\", nil, nil, nil,\t nil\t\t\t\t\t] \n ]\n #set up arguments. \n args = OpenStudio::Ruleset::OSArgumentVector.new\n self.argument_setter(args)\n return args\n end",
"def arguments()\r\n args = OpenStudio::Ruleset::OSArgumentVector.new\r\n\r\n # the name of the sql file\r\n csv_name = OpenStudio::Ruleset::OSArgument.makeStringArgument(\"csv_name\", true)\r\n csv_name.setDisplayName(\"CSV file name\")\r\n csv_name.setDescription(\"CSV file name.\")\r\n csv_name.setDefaultValue(\"mtr.csv\")\r\n args << csv_name\r\n \r\n csv_time_header = OpenStudio::Ruleset::OSArgument.makeStringArgument(\"csv_time_header\", true)\r\n csv_time_header.setDisplayName(\"CSV Time Header\")\r\n csv_time_header.setDescription(\"CSV Time Header Value.\")\r\n csv_time_header.setDefaultValue(\"Date/Time\")\r\n args << csv_time_header\r\n \r\n csv_var = OpenStudio::Ruleset::OSArgument.makeStringArgument(\"csv_var\", true)\r\n csv_var.setDisplayName(\"CSV variable name\")\r\n csv_var.setDescription(\"CSV variable name\")\r\n csv_var.setDefaultValue(\"Whole Building:Facility Total Electric Demand Power [W](TimeStep)\")\r\n args << csv_var\r\n \r\n csv_var_dn = OpenStudio::Ruleset::OSArgument.makeStringArgument(\"csv_var_dn\", true)\r\n csv_var_dn.setDisplayName(\"CSV variable display name\")\r\n csv_var_dn.setDescription(\"CSV variable display name\")\r\n csv_var_dn.setDefaultValue(\"\")\r\n args << csv_var_dn\r\n \r\n years = OpenStudio::Ruleset::OSArgument.makeBoolArgument(\"year\", true)\r\n years.setDisplayName(\"Year in csv data\")\r\n years.setDescription(\"Year in csv data => mm:dd:yy or mm:dd\")\r\n years.setDefaultValue(true)\r\n args << years\r\n \r\n seconds = OpenStudio::Ruleset::OSArgument.makeBoolArgument(\"seconds\", true)\r\n seconds.setDisplayName(\"Seconds in csv data\")\r\n seconds.setDescription(\"Seconds in csv data => hh:mm:ss or hh:mm\")\r\n seconds.setDefaultValue(true)\r\n args << seconds\r\n \r\n sql_key = OpenStudio::Ruleset::OSArgument.makeStringArgument(\"sql_key\", true)\r\n sql_key.setDisplayName(\"SQL key\")\r\n sql_key.setDescription(\"SQL key\")\r\n sql_key.setDefaultValue(\"Whole Building\")\r\n args << sql_key \r\n\r\n sql_var = OpenStudio::Ruleset::OSArgument.makeStringArgument(\"sql_var\", true)\r\n sql_var.setDisplayName(\"SQL var\")\r\n sql_var.setDescription(\"SQL var\")\r\n sql_var.setDefaultValue(\"Facility Total Electric Demand Power\")\r\n args << sql_var \r\n \r\n norm = OpenStudio::Ruleset::OSArgument.makeDoubleArgument(\"norm\", true)\r\n norm.setDisplayName(\"norm of the difference of csv and sql\")\r\n norm.setDescription(\"norm of the difference of csv and sql\")\r\n norm.setDefaultValue(1)\r\n args << norm \r\n\r\n find_avail = OpenStudio::Ruleset::OSArgument.makeBoolArgument(\"find_avail\", true)\r\n find_avail.setDisplayName(\"find_avail\")\r\n find_avail.setDescription(\"find_avail\")\r\n find_avail.setDefaultValue(true)\r\n args << find_avail \r\n\r\n compute_diff = OpenStudio::Ruleset::OSArgument.makeBoolArgument(\"compute_diff\", true)\r\n compute_diff.setDisplayName(\"compute_diff\")\r\n compute_diff.setDescription(\"compute_diff\")\r\n compute_diff.setDefaultValue(true)\r\n args << compute_diff\r\n \r\n verbose_messages = OpenStudio::Ruleset::OSArgument.makeBoolArgument(\"verbose_messages\", true)\r\n verbose_messages.setDisplayName(\"verbose_messages\")\r\n verbose_messages.setDescription(\"verbose_messages\")\r\n verbose_messages.setDefaultValue(true)\r\n args << verbose_messages \r\n\r\n return args\r\n end",
"def arguments(model)\n args = OpenStudio::Measure::OSArgumentVector.new\t\t\n\n #Make a string argument for occupants (auto or number)\n num_occ = OpenStudio::Measure::OSArgument::makeStringArgument(\"num_occ\", false)\n num_occ.setDisplayName(\"Number of Occupants\")\n num_occ.setDescription(\"Specify the number of occupants. For a multifamily building, specify one value for all units or a comma-separated set of values (in the correct order) for each unit. A value of '#{Constants.Auto}' will calculate the average number of occupants from the number of bedrooms. Used to specify the internal gains from people only.\")\n num_occ.setDefaultValue(Constants.Auto)\n args << num_occ\n\n #Make a string argument for 24 weekday schedule values\n weekday_sch = OpenStudio::Measure::OSArgument::makeStringArgument(\"weekday_sch\", true)\n weekday_sch.setDisplayName(\"Weekday schedule\")\n weekday_sch.setDescription(\"Specify the 24-hour weekday schedule.\")\n weekday_sch.setDefaultValue(\"1.00000, 1.00000, 1.00000, 1.00000, 1.00000, 1.00000, 1.00000, 0.88310, 0.40861, 0.24189, 0.24189, 0.24189, 0.24189, 0.24189, 0.24189, 0.24189, 0.29498, 0.55310, 0.89693, 0.89693, 0.89693, 1.00000, 1.00000, 1.00000\")\n args << weekday_sch\n \n #Make a string argument for 24 weekend schedule values\n weekend_sch = OpenStudio::Measure::OSArgument::makeStringArgument(\"weekend_sch\", true)\n weekend_sch.setDisplayName(\"Weekend schedule\")\n weekend_sch.setDescription(\"Specify the 24-hour weekend schedule.\")\n weekend_sch.setDefaultValue(\"1.00000, 1.00000, 1.00000, 1.00000, 1.00000, 1.00000, 1.00000, 0.88310, 0.40861, 0.24189, 0.24189, 0.24189, 0.24189, 0.24189, 0.24189, 0.24189, 0.29498, 0.55310, 0.89693, 0.89693, 0.89693, 1.00000, 1.00000, 1.00000\")\n args << weekend_sch\n\n #Make a string argument for 12 monthly schedule values\n monthly_sch = OpenStudio::Measure::OSArgument::makeStringArgument(\"monthly_sch\", true)\n monthly_sch.setDisplayName(\"Month schedule\")\n monthly_sch.setDescription(\"Specify the 12-month schedule.\")\n monthly_sch.setDefaultValue(\"1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0\")\n args << monthly_sch\n\n return args\n end",
"def validate_arguments()\n usage unless ARGV.count > 0\nend",
"def input args\n if args.state.inputlist.length > 5\n args.state.inputlist.pop\n end\n\n should_process_special_move = (args.inputs.keyboard.key_down.j) ||\n (args.inputs.keyboard.key_down.k) ||\n (args.inputs.keyboard.key_down.a) ||\n (args.inputs.keyboard.key_down.d) ||\n (args.inputs.controller_one.key_down.y) ||\n (args.inputs.controller_one.key_down.x) ||\n (args.inputs.controller_one.key_down.left) ||\n (args.inputs.controller_one.key_down.right)\n\n if (should_process_special_move)\n if (args.inputs.keyboard.key_down.j && args.inputs.keyboard.key_down.k) ||\n (args.inputs.controller_one.key_down.x && args.inputs.controller_one.key_down.y)\n args.state.inputlist.unshift(\"shield\")\n elsif (args.inputs.keyboard.key_down.k || args.inputs.controller_one.key_down.y) &&\n (args.state.inputlist[0] == \"forward-attack\") && ((args.state.tick_count - args.state.lastpush) <= 15)\n args.state.inputlist.unshift(\"dash-attack\")\n args.state.player.dx = 20\n elsif (args.inputs.keyboard.key_down.j && args.inputs.keyboard.a) ||\n (args.inputs.controller_one.key_down.x && args.inputs.controller_one.key_down.left)\n args.state.inputlist.unshift(\"back-attack\")\n elsif ( args.inputs.controller_one.key_down.x || args.inputs.keyboard.key_down.j)\n args.state.inputlist.unshift(\"forward-attack\")\n elsif (args.inputs.keyboard.key_down.k || args.inputs.controller_one.key_down.y) &&\n (args.state.player.y > 128)\n args.state.inputlist.unshift(\"dair\")\n elsif (args.inputs.keyboard.key_down.k || args.inputs.controller_one.key_down.y)\n args.state.inputlist.unshift(\"up-attack\")\n elsif (args.inputs.controller_one.key_down.left || args.inputs.keyboard.key_down.a) &&\n (args.state.inputlist[0] == \"<\") &&\n ((args.state.tick_count - args.state.lastpush) <= 10)\n args.state.inputlist.unshift(\"<<\")\n args.state.player.dx = -15\n elsif (args.inputs.controller_one.key_down.left || args.inputs.keyboard.key_down.a)\n args.state.inputlist.unshift(\"<\")\n args.state.timeleft = args.state.tick_count\n elsif (args.inputs.controller_one.key_down.right || args.inputs.keyboard.key_down.d)\n args.state.inputlist.unshift(\">\")\n end\n\n args.state.lastpush = args.state.tick_count\n end\n\n if args.inputs.keyboard.space || args.inputs.controller_one.r2 # if the user presses the space bar\n args.state.player.jumped_at ||= args.state.tick_count # jumped_at is set to current frame\n\n # if the time that has passed since the jump is less than the player's jump duration and\n # the player is not falling\n if args.state.player.jumped_at.elapsed_time < args.state.player_jump_power_duration && !args.state.player.falling\n args.state.player.dy = args.state.player_jump_power # change in y is set to power of player's jump\n end\n end\n\n # if the space bar is in the \"up\" state (or not being pressed down)\n if args.inputs.keyboard.key_up.space || args.inputs.controller_one.key_up.r2\n args.state.player.jumped_at = nil # jumped_at is empty\n args.state.player.falling = true # the player is falling\n end\n\n if args.inputs.left # if left key is pressed\n if args.state.player.dx < -5\n args.state.player.dx = args.state.player.dx\n else\n args.state.player.dx = -5\n end\n\n elsif args.inputs.right # if right key is pressed\n if args.state.player.dx > 5\n args.state.player.dx = args.state.player.dx\n else\n args.state.player.dx = 5\n end\n else\n args.state.player.dx *= args.state.player_speed_slowdown_rate # dx is scaled down\n end\n\n if ((args.state.player.dx).abs > 5) #&& ((args.state.tick_count - args.state.lastpush) <= 10)\n args.state.player.dx *= 0.95\n end\nend",
"def arguments(model = nil)\n args = OpenStudio::Ruleset::OSArgumentVector.new\n\n chs = OpenStudio::StringVector.new\n chs << 'Last OSM'\n chs << 'Last IDF'\n file_source = OpenStudio::Ruleset::OSArgument.makeChoiceArgument('file_source', chs, true)\n file_source.setDisplayName('Model Source')\n file_source.setDefaultValue('Last OSM')\n args << file_source\n\n chs = OpenStudio::StringVector.new\n chs << 'Timestep'\n chs << 'Hourly'\n reporting_frequency = OpenStudio::Ruleset::OSArgument.makeChoiceArgument('reporting_frequency', chs, true)\n reporting_frequency.setDisplayName('Reporting Frequency')\n reporting_frequency.setDefaultValue('Hourly')\n args << reporting_frequency\n\n variable1_name = OpenStudio::Ruleset::OSArgument.makeStringArgument('variable1_name', true)\n variable1_name.setDisplayName('Variable 1 Name')\n variable1_name.setDefaultValue('Surface Outside Face Temperature')\n args << variable1_name\n\n variable2_name = OpenStudio::Ruleset::OSArgument.makeStringArgument('variable2_name', true)\n variable2_name.setDisplayName('Variable 2 Name')\n variable2_name.setDefaultValue('Surface Inside Face Temperature')\n args << variable2_name\n\n variable3_name = OpenStudio::Ruleset::OSArgument.makeStringArgument('variable3_name', true)\n variable3_name.setDisplayName('Variable 3 Name')\n variable3_name.setDefaultValue('Zone Mean Radiant Temperature')\n args << variable3_name\n\n return args\n end",
"def arguments(model)\n args = OpenStudio::Ruleset::OSArgumentVector.new\n\n # Create a list of the names and handles of space types\n # used in the building.\n used_space_type_handles = OpenStudio::StringVector.new\n used_space_type_names = OpenStudio::StringVector.new\n model.getSpaceTypes.sort.each do |space_type|\n if space_type.spaces.size > 0 # only show space types used in the building\n used_space_type_handles << space_type.handle.to_s\n used_space_type_names << space_type.name.to_s\n end\n end\n\t\n # Make an argument for plenum space type\n ceiling_return_plenum_space_type = OpenStudio::Ruleset::OSArgument::makeChoiceArgument(\"ceiling_return_plenum_space_type\", used_space_type_handles, used_space_type_names,false)\n ceiling_return_plenum_space_type.setDisplayName(\"This space type should be part of a ceiling return air plenum.\")\n args << ceiling_return_plenum_space_type\n\t\n # Make a bool argument to edit/not edit each space type\n\t\tmodel.getSpaceTypes.sort.each do |space_type|\n\t\t\tif space_type.spaces.size > 0 # only show space types used in the building\n\t\t\t\tspace_type_to_edit = OpenStudio::Ruleset::OSArgument::makeBoolArgument(space_type.name.get.to_s,false)\n\t\t\t\t# Make a bool argument for this space type\n\t\t\t\tspace_type_to_edit.setDisplayName(\"Add #{space_type.name.get} space type to GSHP system?\")\n\t\t\t\tspace_type_to_edit.setDefaultValue(false)\t\t\n\t\t\t\targs << space_type_to_edit\n\t\t\tend\n\t\tend\n\t \n\t\t# Heating COP of GSHP\n\t\tgshp_htg_cop = OpenStudio::Ruleset::OSArgument::makeDoubleArgument(\"gshp_htg_cop\",false)\n\t\tgshp_htg_cop.setDisplayName(\"GSHP DX Heating Coil Heating COP\")\n\t\tgshp_htg_cop.setDefaultValue(4.0)\n\t\targs << gshp_htg_cop\n\t\t\n\t\t# Cooling EER of GSHP\n\t\tgshp_clg_eer = OpenStudio::Ruleset::OSArgument::makeDoubleArgument(\"gshp_clg_eer\",false)\n\t\tgshp_clg_eer.setDisplayName(\"GSHP DX Cooling Coil Cooling EER\")\n\t\tgshp_clg_eer.setDefaultValue(14)\n\t\targs << gshp_clg_eer\n\t\t\n\t\t# GSHP Fan Type PSC or ECM\n\t\tfan_choices = OpenStudio::StringVector.new\n\t\tfan_choices << \"PSC\"\n\t\tfan_choices << \"ECM\"\n\t\tgshp_fan_type = OpenStudio::Ruleset::OSArgument::makeChoiceArgument(\"gshp_fan_type\",fan_choices,true) # note ECM fan type may correspond to different set of heat pump performance curves\n\t\tgshp_fan_type.setDisplayName(\"GSHP Fan Type: PSC or ECM?\")\n\t\tgshp_fan_type.setDefaultValue(\"PSC\")\n args << gshp_fan_type\n\t\t\n\t\t# Condenser Loop Cooling Temperature\n\t\t# condLoopCoolingTemp = OpenStudio::Ruleset::OSArgument::makeDoubleArgument(\"condLoopCoolingTemp\",false)\n\t\t# condLoopCoolingTemp.setDisplayName(\"Condenser Loop Cooling Temperature (F)\")\n\t\t# condLoopCoolingTemp.setDefaultValue(90)\n\t\t# args << condLoopCoolingTemp\n\t\t\n\t\t# Condenser Loop Heating Temperature\n\t\t# condLoopHeatingTemp = OpenStudio::Ruleset::OSArgument::makeDoubleArgument(\"condLoopHeatingTemp\",false)\n\t\t# condLoopHeatingTemp.setDisplayName(\"Condenser Loop Heating Temperature (F)\")\n\t\t# condLoopHeatingTemp.setDefaultValue(60)\t\n\t\t# args << condLoopHeatingTemp\n\t\t\n\t\t# Vertical Bore HX\n\t\tbuilding_area = model.getBuilding.floorArea \n\t\tbuilding_cool_ton = building_area*10.7639/500\t\t# 500sf/ton estimated\n\t\tbore_hole_no = OpenStudio::Ruleset::OSArgument::makeIntegerArgument(\"bore_hole_no\",false)\n\t\tbore_hole_no.setDisplayName(\"Number of Bore Holes\")\n\t\tbore_hole_no.setDefaultValue(building_cool_ton.to_i) \n\t\targs << bore_hole_no\n\n\t\t\n\t\tbore_hole_length = OpenStudio::Ruleset::OSArgument::makeDoubleArgument(\"bore_hole_length\",false)\n\t\tbore_hole_length.setDisplayName(\"Bore Hole Length (ft)\")\n\t\tbore_hole_length.setDefaultValue(200)\n\t\targs << bore_hole_length\n\n\t\tbore_hole_radius = OpenStudio::Ruleset::OSArgument::makeDoubleArgument(\"bore_hole_radius\",false)\n\t\tbore_hole_radius.setDisplayName(\"Bore Hole Radius (inch)\")\n\t\tbore_hole_radius.setDefaultValue(6.0)\n\t\targs << bore_hole_radius\n\t\t\n\t\tground_k_value = OpenStudio::Ruleset::OSArgument::makeDoubleArgument(\"ground_k_value\",false)\n\t\tground_k_value.setDisplayName(\"Ground Conductivity (Btu/hr.F.R\")\n\t\tground_k_value.setDefaultValue(0.75)\n\t\targs << ground_k_value\n\t\t\n\t\tgrout_k_value = OpenStudio::Ruleset::OSArgument::makeDoubleArgument(\"grout_k_value\",false)\n\t\tgrout_k_value.setDisplayName(\"Grout Conductivity (Btu/hr.F.R\")\n\t\tgrout_k_value.setDefaultValue(0.75)\n\t\targs << grout_k_value\n\t\t\n\t\tchs = OpenStudio::StringVector.new\n\t\tchs << \"Yes\"\n\t\tchs << \"No\"\n\t\tsupplemental_boiler = OpenStudio::Ruleset::OSArgument::makeChoiceArgument(\"supplemental_boiler\",chs, true)\n\t\tsupplemental_boiler.setDisplayName(\"Supplemental Heating Boiler?\")\n\t\tsupplemental_boiler.setDefaultValue(\"No\")\n\t\targs << supplemental_boiler\n\t\t\n\t\t# Boiler Capacity\n\t\tboiler_cap = OpenStudio::Ruleset::OSArgument::makeDoubleArgument(\"boiler_cap\",false)\n\t\tboiler_cap.setDisplayName(\"boiler normal capacity (MBtuh)\")\n\t\tboiler_cap.setDefaultValue(500.0)\n\t\targs << boiler_cap\n\t\t\t\t\n\t\t# Boiler Efficiency\n\t\tboiler_eff = OpenStudio::Ruleset::OSArgument::makeDoubleArgument(\"boiler_eff\",false)\n\t\tboiler_eff.setDisplayName(\"Boiler Thermal Efficiency\")\n\t\tboiler_eff.setDefaultValue(0.9)\n\t\targs << boiler_eff\n\t\t\n\t\t# Boiler fuel Type\n\t\tfuel_choices = OpenStudio::StringVector.new\n\t\tfuel_choices << \"NaturalGas\"\n\t\tfuel_choices << \"PropaneGas\"\n\t\tfuel_choices << \"FuelOil#1\"\n\t\tfuel_choices << \"FuelOil#2\"\n\t\tfuel_choices << \"Electricity\"\n\t\tboiler_fuel_type = OpenStudio::Ruleset::OSArgument::makeChoiceArgument(\"boiler_fuel_type\",fuel_choices,false) \n\t\tboiler_fuel_type.setDisplayName(\"Boiler Fuel Type\")\n\t\tboiler_fuel_type.setDefaultValue(\"NaturalGas\")\n\t\targs << boiler_fuel_type\n\t\t\n\t\t# boiler Hot water supply temperature\n\t\tboiler_hw_st = OpenStudio::Ruleset::OSArgument::makeDoubleArgument(\"boiler_hw_st\",false)\n\t\tboiler_hw_st.setDisplayName(\"Boiler Design Heating Water Outlet Temperature (F)\")\n\t\tboiler_hw_st.setDefaultValue(120)\t\n\t\targs << boiler_hw_st\n\t\t\n\t\t# DOAS Fan Type\n\t\tdoas_fan_choices = OpenStudio::StringVector.new\n\t\tdoas_fan_choices << \"Constant\"\n\t\tdoas_fan_choices << \"Variable\"\n\t\tdoas_fan_type = OpenStudio::Ruleset::OSArgument::makeChoiceArgument(\"doas_fan_type\",doas_fan_choices,true)\n\t\tdoas_fan_type.setDisplayName(\"DOAS Fan Flow Control - Variable means DCV controls\")\n\t\tdoas_fan_type.setDefaultValue(\"Variable\")\n\t\targs << doas_fan_type\n\t\t\n\t\t# DOAS Energy Recovery\n\t\terv_choices = OpenStudio::StringVector.new\n\t\terv_choices << \"plate w/o economizer lockout\"\n\t\terv_choices << \"plate w/ economizer lockout\"\n\t\terv_choices << \"rotary wheel w/o economizer lockout\"\n\t\terv_choices << \"rotary wheel w/ economizer lockout\"\n\t\terv_choices << \"none\"\n\t\tdoas_erv = OpenStudio::Ruleset::OSArgument::makeChoiceArgument(\"doas_erv\",erv_choices,true)\n\t\tdoas_erv.setDisplayName(\"DOAS Energy Recovery?\")\n\t\tdoas_erv.setDefaultValue(\"none\")\n\t\targs << doas_erv\n\t\t\n\t\t# DOAS Evaporative Cooling\n\t\tevap_choices = OpenStudio::StringVector.new\n\t\tevap_choices << \"Direct Evaporative Cooler\"\n\t\tevap_choices << \"none\"\n\t\tdoas_evap = OpenStudio::Ruleset::OSArgument::makeChoiceArgument(\"doas_evap\",evap_choices,true)\n\t\tdoas_evap.setDisplayName(\"DOAS Direct Evaporative Cooling?\")\n\t\tdoas_evap.setDefaultValue(\"none\")\n\t\targs << doas_evap\n\t\t\n\t\t# DOAS DX Cooling\n\t\tdoas_dx_eer = OpenStudio::Ruleset::OSArgument::makeDoubleArgument(\"doas_dx_eer\",false)\n\t\tdoas_dx_eer.setDisplayName(\"DOAS DX Cooling EER\")\n\t\tdoas_dx_eer.setDefaultValue(10.0)\n\t\targs << doas_dx_eer\n\t\n # make an argument for material and installation cost\n # todo - I would like to split the costing out to the air loops weighted by area of building served vs. just sticking it on the building\n cost_total_hvac_system = OpenStudio::Ruleset::OSArgument::makeDoubleArgument(\"cost_total_hvac_system\",true)\n cost_total_hvac_system.setDisplayName(\"Total Cost for HVAC System ($).\")\n cost_total_hvac_system.setDefaultValue(0.0)\n args << cost_total_hvac_system\n \n #make an argument to remove existing costs\n remake_schedules = OpenStudio::Ruleset::OSArgument::makeBoolArgument(\"remake_schedules\",true)\n remake_schedules.setDisplayName(\"Apply recommended availability and ventilation schedules for air handlers?\")\n remake_schedules.setDefaultValue(true)\n args << remake_schedules\n\n return args\n end",
"def arguments()\r\n args = OpenStudio::Ruleset::OSArgumentVector.new\r\n\r\n # the name of the sql file\r\n csv_name = OpenStudio::Ruleset::OSArgument.makeStringArgument(\"csv_name\", true)\r\n csv_name.setDisplayName(\"CSV file name\")\r\n csv_name.setDescription(\"CSV file name.\")\r\n csv_name.setDefaultValue(\"mtr.csv\")\r\n args << csv_name\r\n \r\n csv_time_header = OpenStudio::Ruleset::OSArgument.makeStringArgument(\"csv_time_header\", true)\r\n csv_time_header.setDisplayName(\"CSV Time Header\")\r\n csv_time_header.setDescription(\"CSV Time Header Value.\")\r\n csv_time_header.setDefaultValue(\"Date/Time\")\r\n args << csv_time_header\r\n \r\n csv_var = OpenStudio::Ruleset::OSArgument.makeStringArgument(\"csv_var\", true)\r\n csv_var.setDisplayName(\"CSV variable name\")\r\n csv_var.setDescription(\"CSV variable name\")\r\n csv_var.setDefaultValue(\"Whole Building:Facility Total Electric Demand Power [W](TimeStep)\")\r\n args << csv_var\r\n \r\n csv_var_dn = OpenStudio::Ruleset::OSArgument.makeStringArgument(\"csv_var_dn\", true)\r\n csv_var_dn.setDisplayName(\"CSV variable display name\")\r\n csv_var_dn.setDescription(\"CSV variable display name\")\r\n csv_var_dn.setDefaultValue(\"\")\r\n args << csv_var_dn\r\n \r\n years = OpenStudio::Ruleset::OSArgument.makeBoolArgument(\"year\", true)\r\n years.setDisplayName(\"Year in csv data\")\r\n years.setDescription(\"Year in csv data => mm:dd:yy or mm:dd\")\r\n years.setDefaultValue(true)\r\n args << years\r\n \r\n seconds = OpenStudio::Ruleset::OSArgument.makeBoolArgument(\"seconds\", true)\r\n seconds.setDisplayName(\"Seconds in csv data\")\r\n seconds.setDescription(\"Seconds in csv data => hh:mm:ss or hh:mm\")\r\n seconds.setDefaultValue(true)\r\n args << seconds\r\n \r\n sql_key = OpenStudio::Ruleset::OSArgument.makeStringArgument(\"sql_key\", true)\r\n sql_key.setDisplayName(\"SQL key\")\r\n sql_key.setDescription(\"SQL key\")\r\n sql_key.setDefaultValue(\"\")\r\n args << sql_key \r\n\r\n sql_var = OpenStudio::Ruleset::OSArgument.makeStringArgument(\"sql_var\", true)\r\n sql_var.setDisplayName(\"SQL var\")\r\n sql_var.setDescription(\"SQL var\")\r\n sql_var.setDefaultValue(\"Facility Total Electric Demand Power\")\r\n args << sql_var \r\n \r\n stp = OpenStudio::Ruleset::OSArgument.makeStringArgument(\"stp\", true)\r\n stp.setDisplayName(\"Timeseries Timestep\")\r\n stp.setDescription(\"Timeseries Timestep\")\r\n stp.setDefaultValue(\"Zone Timestep\")\r\n args << stp\r\n \r\n env = OpenStudio::Ruleset::OSArgument.makeStringArgument(\"env\", true)\r\n env.setDisplayName(\"availableEnvPeriods\")\r\n env.setDescription(\"availableEnvPeriods\")\r\n env.setDefaultValue(\"RUN PERIOD 1\")\r\n args << env\r\n \r\n norm = OpenStudio::Ruleset::OSArgument.makeDoubleArgument(\"norm\", true)\r\n norm.setDisplayName(\"norm of the difference of csv and sql\")\r\n norm.setDescription(\"norm of the difference of csv and sql\")\r\n norm.setDefaultValue(1)\r\n args << norm \r\n\r\n scale = OpenStudio::Ruleset::OSArgument.makeDoubleArgument(\"scale\", true)\r\n scale.setDisplayName(\"scale factor to apply to the difference\")\r\n scale.setDescription(\"scale factor to apply to the difference\")\r\n scale.setDefaultValue(1)\r\n args << scale \r\n\r\n find_avail = OpenStudio::Ruleset::OSArgument.makeBoolArgument(\"find_avail\", true)\r\n find_avail.setDisplayName(\"find_avail\")\r\n find_avail.setDescription(\"find_avail\")\r\n find_avail.setDefaultValue(true)\r\n args << find_avail \r\n\r\n compute_diff = OpenStudio::Ruleset::OSArgument.makeBoolArgument(\"compute_diff\", true)\r\n compute_diff.setDisplayName(\"compute_diff\")\r\n compute_diff.setDescription(\"compute_diff\")\r\n compute_diff.setDefaultValue(true)\r\n args << compute_diff\r\n \r\n verbose_messages = OpenStudio::Ruleset::OSArgument.makeBoolArgument(\"verbose_messages\", true)\r\n verbose_messages.setDisplayName(\"verbose_messages\")\r\n verbose_messages.setDescription(\"verbose_messages\")\r\n verbose_messages.setDefaultValue(true)\r\n args << verbose_messages \r\n \r\n algorithm_download = OpenStudio::Ruleset::OSArgument.makeBoolArgument(\"algorithm_download\", true)\r\n algorithm_download.setDisplayName(\"algorithm_download\")\r\n algorithm_download.setDescription(\"algorithm_download\")\r\n algorithm_download.setDefaultValue(false)\r\n args << algorithm_download \r\n \r\n plot_flag = OpenStudio::Ruleset::OSArgument.makeBoolArgument(\"plot_flag\", true)\r\n plot_flag.setDisplayName(\"plot_flag timeseries data\")\r\n plot_flag.setDescription(\"plot_flag timeseries data\")\r\n plot_flag.setDefaultValue(true)\r\n args << plot_flag\r\n \r\n plot_name = OpenStudio::Ruleset::OSArgument.makeStringArgument(\"plot_name\", true)\r\n plot_name.setDisplayName(\"Plot name\")\r\n plot_name.setDescription(\"Plot name\")\r\n plot_name.setDefaultValue(\"\")\r\n args << plot_name\r\n \r\n warning_messages = OpenStudio::Ruleset::OSArgument.makeBoolArgument(\"warning_messages\", true)\r\n warning_messages.setDisplayName(\"warning_messages\")\r\n warning_messages.setDescription(\"warning_messages\")\r\n warning_messages.setDefaultValue(false)\r\n args << warning_messages\r\n\r\n return args\r\n end",
"def arguments(model)\n args = OpenStudio::Ruleset::OSArgumentVector.new\n\n # the name of the space to add to the model\n setpoint = OpenStudio::Ruleset::OSArgument.makeDoubleArgument(\"setpoint_temperature\", true)\n setpoint.setUnits(\"Degrees Celsius\")\n setpoint.setDisplayName(\"Ambient Loop Temperature\")\n setpoint.setDefaultValue(20)\n setpoint.setDescription(\"Temperature setpoint for the ambient loop\")\n args << setpoint\n\n delta = OpenStudio::Ruleset::OSArgument.makeDoubleArgument(\"design_delta\", true)\n delta.setUnits(\"Delta Temperature\")\n delta.setDefaultValue(5.55) # 10 Deg F default delta\n delta.setDisplayName(\"Delta Design Loop Temperature\")\n delta.setDescription(\"Delta design temperature for the ambient loop\")\n args << delta\n\n return args\n end",
"def arguments\n args = OpenStudio::Ruleset::OSArgumentVector.new\n\n return args\n end",
"def print_two_again(arg1, arg2) # Non-variable list of inputs it will accept\n puts \"arg1: #{arg1}, arg2: #{arg2}\"\nend",
"def commander _args\n \"commander _args;\" \n end",
"def arguments(model)\n args = OpenStudio::Measure::OSArgumentVector.new\n\n # make a string argument for furnace fuel type\n fuel_display_names = OpenStudio::StringVector.new\n fuel_display_names << Constants.FuelTypeGas\n fuel_display_names << Constants.FuelTypeOil\n fuel_display_names << Constants.FuelTypePropane\n fuel_display_names << Constants.FuelTypeElectric\n fuel_type = OpenStudio::Measure::OSArgument::makeChoiceArgument('fuel_type', fuel_display_names, true)\n fuel_type.setDisplayName('Fuel Type')\n fuel_type.setDescription('Type of fuel used for heating.')\n fuel_type.setDefaultValue(Constants.FuelTypeGas)\n args << fuel_type\n\n # make an argument for entering furnace installed afue\n afue = OpenStudio::Measure::OSArgument::makeDoubleArgument('afue', true)\n afue.setDisplayName('Installed AFUE')\n afue.setUnits('Btu/Btu')\n afue.setDescription('The installed Annual Fuel Utilization Efficiency (AFUE) of the furnace, which can be used to account for performance derating or degradation relative to the rated value.')\n afue.setDefaultValue(0.78)\n args << afue\n\n # make an argument for entering furnace installed supply fan power\n fan_power_installed = OpenStudio::Measure::OSArgument::makeDoubleArgument('fan_power_installed', true)\n fan_power_installed.setDisplayName('Installed Supply Fan Power')\n fan_power_installed.setUnits('W/cfm')\n fan_power_installed.setDescription('Fan power (in W) per delivered airflow rate (in cfm) of the indoor fan for the maximum fan speed under actual operating conditions.')\n fan_power_installed.setDefaultValue(0.5)\n args << fan_power_installed\n\n # make a string argument for furnace heating output capacity\n capacity = OpenStudio::Measure::OSArgument::makeStringArgument('capacity', true)\n capacity.setDisplayName('Heating Capacity')\n capacity.setDescription(\"The output heating capacity of the furnace. If using '#{Constants.SizingAuto}', the autosizing algorithm will use ACCA Manual S to set the capacity.\")\n capacity.setUnits('kBtu/hr')\n capacity.setDefaultValue(Constants.SizingAuto)\n args << capacity\n\n # make a string argument for distribution system efficiency\n dse = OpenStudio::Measure::OSArgument::makeStringArgument('dse', true)\n dse.setDisplayName('Distribution System Efficiency')\n dse.setDescription('Defines the energy losses associated with the delivery of energy from the equipment to the source of the load.')\n dse.setDefaultValue('NA')\n args << dse\n\n # make a bool argument for open hvac flue\n has_hvac_flue = OpenStudio::Measure::OSArgument::makeBoolArgument('has_hvac_flue', true)\n has_hvac_flue.setDisplayName('Air Leakage: Has Open HVAC Flue')\n has_hvac_flue.setDescription('Specifies whether the building has an open flue associated with the HVAC system.')\n has_hvac_flue.setDefaultValue(true)\n args << has_hvac_flue\n\n return args\n end",
"def args\n @args\n end",
"def arguments\n args = OpenStudio::Measure::OSArgumentVector.new\n\n return args\n end",
"def default_args(a,b,c=1)\n puts \"\\nValues of variables: \",a,b,c\nend",
"def arguments(model)\n args = OpenStudio::Measure::OSArgumentVector.new\n \n \t#Make a string argument for 24 weekday cooling set point values\n clg_wkdy = OpenStudio::Measure::OSArgument::makeStringArgument(\"clg_wkdy\", false)\n clg_wkdy.setDisplayName(\"Weekday Setpoint\")\n clg_wkdy.setDescription(\"Specify a single cooling setpoint or a 24-hour comma-separated cooling schedule for the weekdays.\")\n clg_wkdy.setUnits(\"degrees F\")\n clg_wkdy.setDefaultValue(\"76\")\n args << clg_wkdy \n \n \t#Make a string argument for 24 weekend cooling set point values\n clg_wked = OpenStudio::Measure::OSArgument::makeStringArgument(\"clg_wked\", false)\n clg_wked.setDisplayName(\"Weekend Setpoint\")\n clg_wked.setDescription(\"Specify a single cooling setpoint or a 24-hour comma-separated cooling schedule for the weekend.\")\n clg_wked.setUnits(\"degrees F\")\n clg_wked.setDefaultValue(\"76\")\n args << clg_wked\t\n\t\n return args\n end",
"def arguments\n args = OpenStudio::Measure::OSArgumentVector.new\n # this measure does not require any user arguments, return an empty list\n return args\n end"
] | [
"0.73753476",
"0.73753476",
"0.73753476",
"0.70890766",
"0.7008301",
"0.7008301",
"0.7008301",
"0.7008301",
"0.7008301",
"0.7008301",
"0.7008301",
"0.7008301",
"0.7008301",
"0.7008301",
"0.7008301",
"0.7008301",
"0.7008301",
"0.7008301",
"0.7008301",
"0.7008301",
"0.7008301",
"0.7008301",
"0.7008301",
"0.7008301",
"0.68296087",
"0.6826596",
"0.67602986",
"0.67480284",
"0.6589929",
"0.6581451",
"0.6579882",
"0.65468127",
"0.6503042",
"0.647451",
"0.64706385",
"0.64699155",
"0.6469245",
"0.64641875",
"0.64103556",
"0.6389132",
"0.637863",
"0.6374086",
"0.6373223",
"0.63639134",
"0.6358853",
"0.6347805",
"0.63475585",
"0.63470906",
"0.6329135",
"0.63280094",
"0.62932867",
"0.6289945",
"0.6271416",
"0.6257277",
"0.6257238",
"0.6239814",
"0.6235555",
"0.62354916",
"0.6221531",
"0.6221531",
"0.6221531",
"0.62026656",
"0.61958784",
"0.61795026",
"0.61696565",
"0.6168981",
"0.6167551",
"0.6165484",
"0.6161183",
"0.6146112",
"0.6128867",
"0.611614",
"0.6099537",
"0.609091",
"0.608763",
"0.6082464",
"0.60754794",
"0.6075173",
"0.60703015",
"0.6069249",
"0.6053929",
"0.60461015",
"0.6037139",
"0.6037139",
"0.603555",
"0.6028014",
"0.60276234",
"0.6026254",
"0.6021278",
"0.6006005",
"0.60050625",
"0.60002536",
"0.5998068",
"0.5990844",
"0.5986098",
"0.59826887",
"0.59739846",
"0.59692407",
"0.59684443",
"0.5966365",
"0.59595567"
] | 0.0 | -1 |
define what happens when the measure is run | def run(model, runner, user_arguments)
super(model, runner, user_arguments)
# report initial condition of model
runner.registerInitialCondition("The building started with #{model.getSpaces.size} spaces.")
model.getSpaceTypes.each do |space_type|
count = 0
space_type.spaces.each do |space|
count += space.multiplier
end
avg_si = space_type.floorArea/count.to_f
avg_ip = OpenStudio::convert(avg_si,'m^2','ft^2').get.round(2)
total_ip = OpenStudio::convert(space_type.floorArea,'m^2','ft^2').get.round(2)
runner.registerInfo("#{space_type.name} has #{count} spaces, with average area of #{avg_ip} ft^2. Total is #{total_ip}")
end
# report final condition of model
runner.registerFinalCondition("The building finished with #{model.getSpaces.size} spaces.")
return true
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def measure; end",
"def measure=(_arg0); end",
"def measure\n\t\t1\n\tend",
"def measure(*args, &b)\n end",
"def communicate_measure_result(_ = nil, _ = nil); end",
"def communicate_measure_result(_ = nil, _ = nil); end",
"def called\n self.measurement.called\n end",
"def measure\n start = Time.now\n yield\n Time.now - start\n end",
"def measure\n start = Time.now\n yield\n Time.now - start\n end",
"def measure\n Measure.new(1, self)\n end",
"def measurement(n)\n @options[:before_hook].call(n)\n measure = measure(n, &@options[:fn])\n @options[:after_hook].call(n)\n measure\n end",
"def measure\n Measure.new(@counter+=1)\n end",
"def communicate_measure_result(_ = nil, _ = nil)\r\n end",
"def benchmark\nend",
"def calculated; end",
"def setup_metrics\n end",
"def setup_metrics\n end",
"def setup_metrics\n end",
"def run()\n\t\tputs \"#{@name} ran for #{@meters} meters in #{self.getTimeLapse} seconds\"\n\t\t# chiama funzione per stampare quante volte ha respirato\n\t\tself.breathe\n\tend",
"def runs; end",
"def statistics; end",
"def medical_use; end",
"def measure\n start_real = System.monotonic_time\n start_cpu = System.cpu_time\n retval = yield\n\n real_time = System.monotonic_time - start_real\n cpu_time = System.cpu_time - start_cpu\n\n @real_time += real_time\n @cpu_time += cpu_time\n @call_count += 1\n\n if call_measurement_enabled? && above_threshold?\n self.class.call_duration_histogram.observe(@transaction.labels.merge(labels), real_time / 1000.0)\n end\n\n retval\n end",
"def stats; end",
"def stats; end",
"def run(model, runner, user_arguments)\n super(model, runner, user_arguments)\n\n # use the built-in error checking\n if !runner.validateUserArguments(arguments(model), user_arguments)\n return false\n end\n\n # Return N/A if not selected to run\n run_measure = runner.getIntegerArgumentValue(\"run_measure\",user_arguments)\n if run_measure == 0\n runner.registerAsNotApplicable(\"Run Measure set to #{run_measure}.\")\n return true \n end \n \n\n percent_runtime_reduction = runner.getDoubleArgumentValue(\"percent_runtime_reduction\",user_arguments)\n\n \n \n # Check arguments for reasonableness\n if percent_runtime_reduction >= 100\n runner.registerError(\"Percent runtime reduction must be less than 100.\")\n return false\n end\n\n # Find all the original schedules (before occ sensors installed)\n original_lts_schedules = []\n model.getLightss.each do |light_fixture|\n if light_fixture.schedule.is_initialized\n original_lts_schedules << light_fixture.schedule.get\n end\n end \n\n # Make copies of all the original lights schedules, reduced to include occ sensor impact\n original_schs_new_schs = {}\n original_lts_schedules.uniq.each do |orig_sch|\n # Copy the original schedule\n new_sch = orig_sch.clone.to_ScheduleRuleset.get\n new_sch.setName(\"#{new_sch.name.get} with occ sensor\")\n # Reduce each value in each profile (except the design days) by the specified amount\n runner.registerInfo(\"Reducing values in '#{orig_sch.name}' schedule by #{percent_runtime_reduction}% to represent occ sensor installation.\")\n day_profiles = []\n day_profiles << new_sch.defaultDaySchedule\n new_sch.scheduleRules.each do |rule|\n day_profiles << rule.daySchedule\n end\n multiplier = (100 - percent_runtime_reduction)/100\n day_profiles.each do |day_profile|\n #runner.registerInfo(\"#{day_profile.name}\")\n times_vals = day_profile.times.zip(day_profile.values)\n #runner.registerInfo(\"original time/values = #{times_vals}\")\n times_vals.each do |time,val|\n day_profile.addValue(time, val * multiplier)\n end\n #runner.registerInfo(\"new time/values = #{day_profile.times.zip(day_profile.values)}\")\n end \n #log the relationship between the old sch and the new, reduced sch\n original_schs_new_schs[orig_sch] = new_sch\n end\n \n # Replace the old schedules with the new, reduced schedules\n spaces_sensors_added_to = []\n model.getLightss.each do |light_fixture|\n next if light_fixture.schedule.empty?\n lights_sch = light_fixture.schedule.get\n new_sch = original_schs_new_schs[lights_sch]\n if new_sch\n runner.registerInfo(\"Added occupancy sensor for '#{light_fixture.name}'\")\n light_fixture.setSchedule(new_sch)\n spaces_sensors_added_to << light_fixture.space\n end\n end\n \n # Report if the measure is not applicable\n num_sensors_added = spaces_sensors_added_to.uniq.size\n if spaces_sensors_added_to.size == 0\n runner.registerAsNotApplicable(\"This measure is not applicable because there were no lights in the building.\")\n return true\n end \n \n # Report final condition\n runner.registerFinalCondition(\"Added occupancy sensors to #{num_sensors_added} spaces in the building.\")\n\n return true\n\n end",
"def run\n\t\t\tsummary\n\t\tend",
"def quick_stats\n\tend",
"def stats\n \n end",
"def benchmark(reporter); end",
"def stats\n end",
"def stats\n end",
"def measure(name, &block)\n if self.running? name\n yield\n else\n result = nil\n self.results[name] ||= 0\n self.running << name\n self.results[name] += Benchmark.measure{result = yield}.real\n self.running.delete(name)\n result\n end\n end",
"def measure\n start_real = System.monotonic_time\n start_cpu = System.cpu_time\n retval = yield\n\n real_time = System.monotonic_time - start_real\n cpu_time = System.cpu_time - start_cpu\n\n @real_time += real_time\n @cpu_time += cpu_time\n @call_count += 1\n\n if above_threshold?\n self.class.gitlab_method_call_duration_seconds.observe(@transaction.labels.merge(labels), real_time)\n end\n\n retval\n end",
"def measure_code(model,runner)\n measure_folder = \"#{File.dirname(__FILE__)}/\"\n baseline_spreadsheet = \"#{File.dirname(__FILE__)}/baseline.csv\"\n #Note: place output folder locally to run faster! (e.g. your C drive)\n output_folder = \"#{File.dirname(__FILE__)}/tests/output\"\n create_models = true\n simulate_models = true\n create_annual_outputs = true\n create_hourly_outputs = true\n #This creates the measures object and collects all the csv information for the\n # measure_id variant.\n csv_measures = BTAP::Measures::CSV_OS_Measures.new(\n baseline_spreadsheet,\n measure_folder#script root folder where all the csv relative paths are used.\n )\n csv_measures.create_cold_lake_vintages(output_folder) unless create_models == false\n BTAP::SimManager::simulate_all_files_in_folder(output_folder) unless simulate_models == false\n BTAP::Reporting::get_all_annual_results_from_runmanger(output_folder) unless create_annual_outputs == false\n #convert eso to csv then create terminus file.\n BTAP::FileIO::convert_all_eso_to_csv(output_folder, output_folder).each {|csvfile| BTAP::FileIO::terminus_hourly_output(csvfile)} unless create_hourly_outputs == false\n\n end",
"def cpu_metrics\n super\n end",
"def instrument; end",
"def profiler; end",
"def profiler; end",
"def setup\n\t\n # create an instance of the measure\n @measure = VentilationQAQC.new\n \n #create an instance of the runner\n @runner = OpenStudio::Ruleset::OSRunner.new\t\n\t\n # get arguments \n @arguments = @measure.arguments()\n\n # make argument map\n make_argument_map\n\t\n # Make an empty model\n @model = OpenStudio::Model::Model.new\n\[email protected](@model)\n\t\n\t# Create a fake sql file - our measure will crash if @runner has no sql file set.\n\t# We don't get data from this file because we get data from our patched SqlFile class instead (see above)\n\tsqlFile = OpenStudio::SqlFile.new(OpenStudio::Path.new(sqlPath))\n\[email protected](OpenStudio::Path.new(sqlPath))\n\t\n\t$serieses[\"Zone Mechanical Ventilation Mass Flow Rate|ZONE1\"] = OpenStudio::TimeSeries.new(OpenStudio::Date.new, OpenStudio::Time.new(1.0), (0..364).to_a.to_vector, \"m^3/s\")\n end",
"def monitor(*args, &bl)\n result = nil\n took = Benchmark.realtime {\n result = bl.call\n }\n Tools.info(args, op_took: took)\n result\n end",
"def measure_code(model,runner)\n ################ Start Measure code here ################################\n \n #Check weather directory Weather File\n unless (Pathname.new @lib_directory).absolute?\n @lib_directory = File.expand_path(File.join(File.dirname(__FILE__), @lib_directory))\n end\n lib_file = File.join(@lib_directory, @lib_file_name)\n if File.exists?(lib_file) and @lib_file_name.downcase.include? \".osm\"\n BTAP::runner_register(\"Info\",\"#{@lib_file_name} Found!.\", runner)\n else\n BTAP::runner_register(\"Error\",\"#{lib_file} does not exist or is not an .osm file.\", runner)\n return false\n end\n \n #load model and test.\n construction_set = BTAP::Resources::Envelope::ConstructionSets::get_construction_set_from_library( lib_file, @construction_set_name )\n #Set Construction Set.\n unless model.building.get.setDefaultConstructionSet( construction_set.clone( model ).to_DefaultConstructionSet.get )\n BTAP::runner_register(\"Error\",\"Could not set Default Construction #{@construction_set_name} \", runner)\n return false\n end\n BTAP::runner_register(\"FinalCondition\",\"Default Construction set to #{@construction_set_name} from #{lib_file}\",runner)\n ##########################################################################\n return true\n end",
"def run(workspace, runner, user_arguments)\n super(workspace, runner, user_arguments)\n\n # use the built-in error checking \n if !runner.validateUserArguments(arguments(workspace), user_arguments)\n return false\n end\n \n # Report that this is an anti-measure\n runner.registerValue('anti_measure',true) \n \n # Return N/A if not selected to run\n run_measure = runner.getIntegerArgumentValue(\"run_measure\",user_arguments)\n if run_measure == 0\n runner.registerAsNotApplicable(\"Run Measure set to #{run_measure}.\")\n return true \n end\n \n\t# Initialize counter variables\n\tno_economizer = 0\n\tfixed_dry_bulb = 0\n\tdifferential_dry_bulb = 0\t\n\tfixed_enthalpy = 0\n\tdifferential_enthalpy = 0\n\tfixed_dew_point_and_dry_bulb = 0\n\telectronic_enthalpy = 0\n\tdifferential_dry_bulb_and_enthalpy = 0\n\t\n\t# Retrieve all Controller:Outdoor air objects in the idf \t\n\toa_controllers = workspace.getObjectsByType(\"Controller:OutdoorAir\".to_IddObjectType)\n\t\n\t# Get the names of each Controller:Outdoor Air object\n\toa_controllers.each do |oa_controller|\n\n\t\toa_controller_name = oa_controller.getString(0).to_s #(0) is field Name\n\t\toa_controller_economizer_control_type = oa_controller.getString(7).to_s #(7) is field Economizer Control Type\n\t\n\t\t# test for presence No economizer controller setting \n\t\tif oa_controller_economizer_control_type == \"NoEconomizer\" # or empty\n\t\t\trunner.registerInfo(\"The Controller:Outdoor air object named #{oa_controller_name} has a disabled airside economizer. Economizer sensor faults will not be added.\")\n\t\t\tno_economizer = no_economizer + 1\n\t\tend\n\t\t\n\t\t# test for presence of differential dry bulb economizer controller setting \n\t\tif oa_controller_economizer_control_type == \"DifferentialDryBulb\"\n\t\t\t# Initialize array to hold new IDF objects\n\t\t\tstring_object = []\n\t\t\t# Create IDF object text for FaultModel:TemperatureSensorOffset:OutdoorAir \n\t\t\tstring_object = \"\n\t\t\t\tFaultModel:TemperatureSensorOffset:OutdoorAir,\n\t\t\t\t#{oa_controller_name}_Outdoor Air Temp Sensor Bias, !- Name\n\t\t\t\tAlways On Discrete, \t\t\t\t\t\t\t!- Availability Schedule Name\n\t\t\t\t, \t\t\t\t\t\t\t\t\t\t\t\t!- Severity Schedule Name\n\t\t\t\tController:OutdoorAir, \t\t\t\t\t\t\t!- Controller Object Type\n\t\t\t\t#{oa_controller_name}, \t\t\t\t\t\t\t!- Controller Object Name\n\t\t\t\t1.11; \t\t\t\t\t\t\t\t\t\t\t!- Temperature Sensor Offset \n\t\t\t\t\"\n\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t# Add string object to workspace to create idf object\n\t\t\tidfObject = OpenStudio::IdfObject::load(string_object)\n\t\t\tobject = idfObject.get\n\t\t\tworkspace.addObject(object)\n\n\t\t\t# Create IDF object text for FaultModel:TemperatureSensorOffset:ReturnAir\n\t\t\tstring_object = \"\n\t\t\t\tFaultModel:TemperatureSensorOffset:ReturnAir,\n\t\t\t\t#{oa_controller_name}_Return Air Temp Sensor Bias, !- Name\n\t\t\t\tAlways On Discrete, \t\t\t\t\t\t\t!- Availability Schedule Name\n\t\t\t\t, \t\t\t\t\t\t\t\t\t\t\t\t!- Severity Schedule Name\n\t\t\t\tController:OutdoorAir, \t\t\t\t\t\t\t!- Controller Object Type\n\t\t\t\t#{oa_controller_name}, \t\t\t\t\t\t\t!- Controller Object Name\n\t\t\t\t-1.11; \t\t\t\t\t\t\t\t\t\t\t!- Temperature Sensor Offset \n\t\t\t\t\"\n\t\t\t\n\t\t\t# Add string object to workspace to create idf object\n\t\t\tidfObject = OpenStudio::IdfObject::load(string_object)\n\t\t\tobject = idfObject.get\n\t\t\tworkspace.addObject(object)\n\t\t\t\n\t\t\tdifferential_dry_bulb = differential_dry_bulb + 1\n\t\t\t# info message\n\t\t\trunner.registerInfo(\"To model dry bulb sensor drift, a FaultModel:TemperatureSensorOffset:ReturnAir object with an offset of -2 deg F and a FaultModel:TemperatureSensorOffset:OutdoorAir object with an offset of +2 deg F has been added to the #{oa_controller_economizer_control_type} controlled airside economizer associated with the Controller:Outdoor air object named #{oa_controller_name}. The fault availability is scheduled using the 'Always On Discrete' schedule.\")\n\t\t\t\n\n\t\tend # OA Controller Type DifferentialDryBulb\n\n\t\t# test for presence of fixed dry bulb economizer controller setting \n\t\tif oa_controller_economizer_control_type == \"FixedDryBulb\"\n\t\t\t# Initialize array to hold new IDF objects\n\t\t\tstring_object = []\n\t\t\t# Create IDF object text for FaultModel:TemperatureSensorOffset:OutdoorAir\n\t\t\tstring_object = \"\n\t\t\t\tFaultModel:TemperatureSensorOffset:OutdoorAir,\n\t\t\t\t#{oa_controller_name}_Outdoor Air Temp Sensor Bias, !- Name\n\t\t\t\tAlways On Discrete, \t\t\t\t\t\t\t!- Availability Schedule Name\n\t\t\t\t, \t\t\t\t\t\t\t\t\t\t\t\t!- Severity Schedule Name\n\t\t\t\tController:OutdoorAir, \t\t\t\t\t\t\t!- Controller Object Type\n\t\t\t\t#{oa_controller_name}, \t\t\t\t\t\t\t!- Controller Object Name\n\t\t\t\t1.11; \t\t\t\t\t\t\t\t\t\t\t!- Temperature Sensor Offset \n\t\t\t\t\"\n\t\t\t# Add string object to workspace to create idf object\n\t\t\tidfObject = OpenStudio::IdfObject::load(string_object)\n\t\t\tobject = idfObject.get\n\t\t\tworkspace.addObject(object)\n\t\t\t\n\t\t\t# Create IDF object text for FaultModel:TemperatureSensorOffset:ReturnAir\n\t\t\tstring_object = \"\n\t\t\t\tFaultModel:TemperatureSensorOffset:ReturnAir,\n\t\t\t\t#{oa_controller_name}_Return Air Temp Sensor Bias, !- Name\n\t\t\t\tAlways On Discrete, \t\t\t\t\t\t\t!- Availability Schedule Name\n\t\t\t\t, \t\t\t\t\t\t\t\t\t\t\t\t!- Severity Schedule Name\n\t\t\t\tController:OutdoorAir, \t\t\t\t\t\t\t!- Controller Object Type\n\t\t\t\t#{oa_controller_name}, \t\t\t\t\t\t\t!- Controller Object Name\n\t\t\t\t-1.11; \t\t\t\t\t\t\t\t\t\t\t!- Temperature Sensor Offset \n\t\t\t\t\"\n\t\t\t# Add string object to workspace to create idf object\n\t\t\tidfObject = OpenStudio::IdfObject::load(string_object)\n\t\t\tobject = idfObject.get\n\t\t\tworkspace.addObject(object)\n\t\t\t\n\t\t\trunner.registerInfo(\"To model dry bulb sensor drift, a FaultModel:TemperatureSensorOffset:ReturnAir object with an offset of -2 deg F and a FaultModel:TemperatureSensorOffset:OutdoorAir object with an offset of +2 deg F has been added to the #{oa_controller_economizer_control_type} controlled airside economizer associated with the Controller:Outdoor air object named #{oa_controller_name}. The fault availability is scheduled using the 'Always On Discrete' schedule.\")\n\t\t\tfixed_dry_bulb = fixed_dry_bulb + 1\n\t\t\t\n\t\tend # OA Controller Type = FixedDryBulb \t\t\n\t\t\n\t\t# test for presence of fixed enthalpy economizer controller setting \t\t\t\t\n\t\tif oa_controller_economizer_control_type == \"FixedEnthalpy\"\n\t\t\t# Initialze array to hold new IDF objects\n\t\t\tstring_object = []\n\t\t\t# Create IDF object text for FaultModel:EnthalpySensorOffset:OutdoorAir\n\t\t\tstring_object = \"\n\t\t\t\tFaultModel:EnthalpySensorOffset:OutdoorAir,\n\t\t\t\t#{oa_controller_name}_Outdoor Air Enthalpy Sensor Bias, !- Name\n\t\t\t\tAlways On Discrete, \t\t\t\t\t\t\t!- Availability Schedule Name\n\t\t\t\t, \t\t\t\t\t\t\t\t\t\t\t\t!- Severity Schedule Name\n\t\t\t\tController:OutdoorAir, \t\t\t\t\t\t\t!- Controller Object Type\n\t\t\t\t#{oa_controller_name}, \t\t\t\t\t\t\t!- Controller Object Name\n\t\t\t\t5; \t\t\t\t\t\t\t\t\t\t\t!- Temperature Sensor Offset \n\t\t\t\t\"\n\t\t\t# Add string object to workspace to create idf object\n\t\t\tidfObject = OpenStudio::IdfObject::load(string_object)\n\t\t\tobject = idfObject.get\n\t\t\tworkspace.addObject(object)\n\t\t\t\n\t\t\t# Create IDF object text for FaultModel:EnthalpySensorOffset:ReturnAir\n\t\t\tstring_object = \"\n\t\t\t\tFaultModel:EnthalpySensorOffset:ReturnAir,\n\t\t\t\t#{oa_controller_name}_Return Air Enthalpy Sensor Bias, !- Name\n\t\t\t\tAlways On Discrete, \t\t\t\t\t\t\t!- Availability Schedule Name\n\t\t\t\t, \t\t\t\t\t\t\t\t\t\t\t\t!- Severity Schedule Name\n\t\t\t\tController:OutdoorAir, \t\t\t\t\t\t\t!- Controller Object Type\n\t\t\t\t#{oa_controller_name}, \t\t\t\t\t\t\t!- Controller Object Name\n\t\t\t\t-5; \t\t\t\t\t\t\t\t\t\t\t!- Temperature Sensor Offset \n\t\t\t\t\"\n\t\t\t# Add string object to workspace to create idf object\n\t\t\tidfObject = OpenStudio::IdfObject::load(string_object)\n\t\t\tobject = idfObject.get\n\t\t\twworkspace.addObject(object)\n\n\t\t\trunner.registerInfo(\"To model enthalpy sensor drift, a FaultModel:EnthalpySensorOffset:ReturnAir object with an offset of -2 Btu/lb and a FaultModel:EnthalpySensorOffset:OutdoorAir object with an offset of +2 Btu/lb have been added to the #{oa_controller_economizer_control_type} controlled airside economizer associated with the Controller:Outdoor air object named #{oa_controller_name}. The fault availability is scheduled using the 'Always On Discrete' schedule.\")\n\t\t\tfixed_enthalpy = fixed_enthalpy + 1\n\t\tend # OA Controller Type = FixedEnthalpy \n\t\t\n\t\t# test for presence of differential enthalpy economizer controller setting \t\t\n\t\tif oa_controller_economizer_control_type == \"DifferentialEnthalpy\"\n\t\t\t# Initialze array to hold new IDF objects\n\t\t\tstring_object = []\n\t\t\t# Create IDF object text for FaultModel:EnthalpySensorOffset:OutdoorAir\n\t\t\tstring_object = \"\n\t\t\t\tFaultModel:EnthalpySensorOffset:OutdoorAir,\n\t\t\t\t#{oa_controller_name}_Outdoor Air Enthalpy Sensor Bias, !- Name\n\t\t\t\tAlways On Discrete, \t\t\t\t\t\t\t!- Availability Schedule Name\n\t\t\t\t, \t\t\t\t\t\t\t\t\t\t\t\t!- Severity Schedule Name\n\t\t\t\tController:OutdoorAir, \t\t\t\t\t\t\t!- Controller Object Type\n\t\t\t\t#{oa_controller_name}, \t\t\t\t\t\t\t!- Controller Object Name\n\t\t\t\t5; \t\t\t\t\t\t\t\t\t\t\t!- Temperature Sensor Offset \n\t\t\t\t\"\n\t\t\t# Add string object to workspace to create idf object\n\t\t\tidfObject = OpenStudio::IdfObject::load(string_object)\n\t\t\tobject = idfObject.get\n\t\t\tworkspace.addObject(object)\n\t\t\t\n\t\t\t# Create IDF object text for FaultModel:EnthalpySensorOffset:ReturnAir\n\t\t\tstring_object = \"\n\t\t\t\tFaultModel:EnthalpySensorOffset:ReturnAir,\n\t\t\t\t#{oa_controller_name}_Return Air Enthalpy Sensor Bias, !- Name\n\t\t\t\tAlways On Discrete, \t\t\t\t\t\t\t!- Availability Schedule Name\n\t\t\t\t, \t\t\t\t\t\t\t\t\t\t\t\t!- Severity Schedule Name\n\t\t\t\tController:OutdoorAir, \t\t\t\t\t\t\t!- Controller Object Type\n\t\t\t\t#{oa_controller_name}, \t\t\t\t\t\t\t!- Controller Object Name\n\t\t\t\t-5; \t\t\t\t\t\t\t\t\t\t\t!- Temperature Sensor Offset \n\t\t\t\t\"\n\t\t\t# Add string object to workspace to create idf object\n\t\t\tidfObject = OpenStudio::IdfObject::load(string_object)\n\t\t\tobject = idfObject.get\n\t\t\tworkspace.addObject(object)\n\n\t\t\trunner.registerInfo(\"To model enthalpy sensor drift, a FaultModel:EnthalpySensorOffset:ReturnAir object with an offset of -2 Btu/lb and a FaultModel:EnthalpySensorOffset:OutdoorAir object with an offset of +2 Btu/lb have been added to the #{oa_controller_economizer_control_type} controlled airside economizer associated with the Controller:Outdoor air object named #{oa_controller_name}. The fault availability is scheduled using the 'Always On Discrete' schedule.\")\n\t\t\tdifferential_enthalpy = differential_enthalpy + 1\n\t\t\t\n\t\tend # OA Controller Type =\"Differential Enthalpy\"\t\t\n\t\t\n\t\n\t\t# test for presence of electronic enthalpy economizer controller setting \n\t\tif oa_controller_economizer_control_type == \"ElectronicEnthalpy\"\n\t\t\t# Initialze array to hold new IDF objects\n\t\t\tstring_object = []\n\t\t\t# Create IDF object text for FaultModel:EnthalpySensorOffset:OutdoorAir\n\t\t\tstring_object = \"\n\t\t\t\tFaultModel:EnthalpySensorOffset:OutdoorAir,\n\t\t\t\t#{oa_controller_name}_Outdoor Air Enthalpy Sensor Bias, !- Name\n\t\t\t\tAlways On Discrete, \t\t\t\t\t\t\t!- Availability Schedule Name\n\t\t\t\t, \t\t\t\t\t\t\t\t\t\t\t\t!- Severity Schedule Name\n\t\t\t\tController:OutdoorAir, \t\t\t\t\t\t\t!- Controller Object Type\n\t\t\t\t#{oa_controller_name}, \t\t\t\t\t\t\t!- Controller Object Name\n\t\t\t\t5; \t\t\t\t\t\t\t\t\t\t\t\t!- Temperature Sensor Offset \n\t\t\t\t\"\n\t\t\t# Add string object to workspace to create idf object\n\t\t\tidfObject = OpenStudio::IdfObject::load(string_object)\n\t\t\tobject = idfObject.get\n\t\t\tworkspace.addObject(object)\n\t\t\t\n\t\t\t# Create IDF object text for FaultModel:EnthalpySensorOffset:ReturnAir\n\t\t\tstring_object = \"\n\t\t\t\tFaultModel:EnthalpySensorOffset:ReturnAir,\n\t\t\t\t#{oa_controller_name}_Return Air Enthalpy Sensor Bias, !- Name\n\t\t\t\tAlways On Discrete, \t\t\t\t\t\t\t!- Availability Schedule Name\n\t\t\t\t, \t\t\t\t\t\t\t\t\t\t\t\t!- Severity Schedule Name\n\t\t\t\tController:OutdoorAir, \t\t\t\t\t\t\t!- Controller Object Type\n\t\t\t\t#{oa_controller_name}, \t\t\t\t\t\t\t!- Controller Object Name\n\t\t\t\t-5; \t\t\t\t\t\t\t\t\t\t\t!- Temperature Sensor Offset \n\t\t\t\t\"\n\t\t\t# Add string object to workspace to create idf object\n\t\t\tidfObject = OpenStudio::IdfObject::load(string_object)\n\t\t\tobject = idfObject.get\n\t\t\tworkspace.addObject(object)\n\n\t\t\trunner.registerInfo(\"To model enthalpy sensor drift, a FaultModel:EnthalpySensorOffset:ReturnAir object with an offset of -2 Btu/lb and a FaultModel:EnthalpySensorOffset:OutdoorAir object with an offset of +2 Btu/lb have been added to the #{oa_controller_economizer_control_type} controlled airside economizer associated with the Controller:Outdoor air object named #{oa_controller_name}. The fault availability is scheduled using the 'Always On Discrete' schedule.\")\n\t\t\telectronic_enthalpy = electronic_enthalpy + 1\n\n\t\tend # OA Controller Type = \"ElectronicEnthalpy\" \t\t\n\t\t\n\t\t# test for presence of fixed dew point and dry bulb economizer controller setting \n\t\tif oa_controller_economizer_control_type == \"FixedDewPointAndDryBulb\" \n\t\t\t# Initialze array to hold new IDF objects\n\t\t\tstring_object = []\n\t\t\t# Create IDF object text for FaultModel:EnthalpySensorOffset:OutdoorAir\n\t\t\tstring_object = \"\n\t\t\t\tFaultModel:EnthalpySensorOffset:OutdoorAir,\n\t\t\t\t#{oa_controller_name}_Outdoor Air Enthalpy Sensor Bias, !- Name\n\t\t\t\tAlways On Discrete, \t\t\t\t\t\t\t!- Availability Schedule Name\n\t\t\t\t, \t\t\t\t\t\t\t\t\t\t\t\t!- Severity Schedule Name\n\t\t\t\tController:OutdoorAir, \t\t\t\t\t\t\t!- Controller Object Type\n\t\t\t\t#{oa_controller_name}, \t\t\t\t\t\t\t!- Controller Object Name\n\t\t\t\t5; \t\t\t\t\t\t\t\t\t\t\t\t!- Temperature Sensor Offset \n\t\t\t\t\"\n\t\t\t# Add string object to workspace to create idf object\n\t\t\tidfObject = OpenStudio::IdfObject::load(string_object)\n\t\t\tobject = idfObject.get\n\t\t\tworkspace.addObject(object)\n\t\t\t\n\t\t\t# Create IDF object text for FaultModel:EnthalpySensorOffset:ReturnAir\n\t\t\tstring_object = \"\n\t\t\t\tFaultModel:EnthalpySensorOffset:ReturnAir,\n\t\t\t\t#{oa_controller_name}_Return Air Enthalpy Sensor Bias, !- Name\n\t\t\t\tAlways On Discrete, \t\t\t\t\t\t\t!- Availability Schedule Name\n\t\t\t\t, \t\t\t\t\t\t\t\t\t\t\t\t!- Severity Schedule Name\n\t\t\t\tController:OutdoorAir, \t\t\t\t\t\t\t!- Controller Object Type\n\t\t\t\t#{oa_controller_name}, \t\t\t\t\t\t\t!- Controller Object Name\n\t\t\t\t-5; \t\t\t\t\t\t\t\t\t\t\t!- Temperature Sensor Offset \n\t\t\t\t\"\n\t\t\t# Add string object to workspace to create idf object\n\t\t\tidfObject = OpenStudio::IdfObject::load(string_object)\n\t\t\tobject = idfObject.get\n\t\t\tworkspace.addObject(object)\n\t\t\t\n\t\t\t# Initialize array to hold new IDF objects\n\t\t\tstring_object = []\n\t\t\t# Create IDF object text for FaultModel:TemperatureSensorOffset:OutdoorAir\n\t\t\tstring_object = \"\n\t\t\t\tFaultModel:TemperatureSensorOffset:OutdoorAir,\n\t\t\t\t#{oa_controller_name}_Outdoor Air Temp Sensor Bias, !- Name\n\t\t\t\tAlways On Discrete, \t\t\t\t\t\t\t!- Availability Schedule Name\n\t\t\t\t, \t\t\t\t\t\t\t\t\t\t\t\t!- Severity Schedule Name\n\t\t\t\tController:OutdoorAir, \t\t\t\t\t\t\t!- Controller Object Type\n\t\t\t\t#{oa_controller_name}, \t\t\t\t\t\t\t!- Controller Object Name\n\t\t\t\t1.11; \t\t\t\t\t\t\t\t\t\t\t!- Temperature Sensor Offset \n\t\t\t\t\"\n\t\t\t# Add string object to workspace to create idf object\n\t\t\tidfObject = OpenStudio::IdfObject::load(string_object)\n\t\t\tobject = idfObject.get\n\t\t\tworkspace.addObject(object)\n\t\t\t\n\t\t\t# Create IDF object text for FaultModel:TemperatureSensorOffset:ReturnAir\n\t\t\tstring_object = \"\n\t\t\t\tFaultModel:TemperatureSensorOffset:ReturnAir,\n\t\t\t\t#{oa_controller_name}_Return Air Temp Sensor Bias, !- Name\n\t\t\t\tAlways On Discrete, \t\t\t\t\t\t\t!- Availability Schedule Name\n\t\t\t\t, \t\t\t\t\t\t\t\t\t\t\t\t!- Severity Schedule Name\n\t\t\t\tController:OutdoorAir, \t\t\t\t\t\t\t!- Controller Object Type\n\t\t\t\t#{oa_controller_name}, \t\t\t\t\t\t\t!- Controller Object Name\n\t\t\t\t-1.11; \t\t\t\t\t\t\t\t\t\t\t!- Temperature Sensor Offset \n\t\t\t\t\"\n\t\t\t# Add string object to workspace to create idf object\n\t\t\tidfObject = OpenStudio::IdfObject::load(string_object)\n\t\t\tobject = idfObject.get\n\t\t\tworkspace.addObject(object)\n\n\t\t\trunner.registerInfo(\"To model both enthalpy and dry bulb sensor drift, a FaultModel:EnthalpySensorOffset:ReturnAir object with an offset of -2 Btu/lb and a FaultModel:EnthalpySensorOffset:OutdoorAir object with an offset of +2 Btu/lb and a FaultModel:TemperatureSensorOffset:ReturnAir object with an offset of -2 deg F and a FaultModel:TemperatureSensorOffset:OutdoorAir object with an offset of +2 deg have been added to the #{oa_controller_economizer_control_type} controlled airside economizer associated with the Controller:Outdoor air object named #{oa_controller_name}. The fault availability is scheduled using the 'Always On Discrete' schedule.\")\n\t\t\tfixed_dew_point_and_dry_bulb = fixed_dew_point_and_dry_bulb + 1\n\n\t\tend # OA Controller Type = \"FixedDewPointAndDryBulb\" \n\t\n\t\t# test for presence of differential dry bulb and enthalpy economizer controller setting \t\t\n\t\tif oa_controller_economizer_control_type == \"DifferentialDryBulbAndEnthalpy\"\n\t\t\t# Initialze array to hold new IDF objects\n\t\t\tstring_object = []\n\t\t\t# Create IDF object text for FaultModel:EnthalpySensorOffset:OutdoorAir\n\t\t\tstring_object = \"\n\t\t\t\tFaultModel:EnthalpySensorOffset:OutdoorAir,\n\t\t\t\t#{oa_controller_name}_Outdoor Air Enthalpy Sensor Bias, !- Name\n\t\t\t\tAlways On Discrete, \t\t\t\t\t\t\t!- Availability Schedule Name\n\t\t\t\t, \t\t\t\t\t\t\t\t\t\t\t\t!- Severity Schedule Name\n\t\t\t\tController:OutdoorAir, \t\t\t\t\t\t\t!- Controller Object Type\n\t\t\t\t#{oa_controller_name}, \t\t\t\t\t\t\t!- Controller Object Name\n\t\t\t\t5; \t\t\t\t\t\t\t\t\t\t\t\t!- Temperature Sensor Offset \n\t\t\t\t\"\n\t\t\t# Add string object to workspace to create idf object\n\t\t\tidfObject = OpenStudio::IdfObject::load(string_object)\n\t\t\tobject = idfObject.get\n\t\t\tworkspace.addObject(object)\n\t\t\n\t\t\t# Create IDF object text for FaultModel:EnthalpySensorOffset:ReturnAir\n\t\t\tstring_object = \"\n\t\t\t\tFaultModel:EnthalpySensorOffset:ReturnAir,\n\t\t\t\t#{oa_controller_name}_Return Air Enthalpy Sensor Bias, !- Name\n\t\t\t\tAlways On Discrete, \t\t\t\t\t\t\t!- Availability Schedule Name\n\t\t\t\t, \t\t\t\t\t\t\t\t\t\t\t\t!- Severity Schedule Name\n\t\t\t\tController:OutdoorAir, \t\t\t\t\t\t\t!- Controller Object Type\n\t\t\t\t#{oa_controller_name}, \t\t\t\t\t\t\t!- Controller Object Name\n\t\t\t\t-5; \t\t\t\t\t\t\t\t\t\t\t!- Temperature Sensor Offset \n\t\t\t\t\"\n\t\t\t# Add string object to workspace to create idf object\n\t\t\tidfObject = OpenStudio::IdfObject::load(string_object)\n\t\t\tobject = idfObject.get\n\t\t\tworkspace.addObject(object)\n\t\t\t\n\t\t\t# Initialize array to hold new IDF objects\n\t\t\tstring_object = []\n\t\t\t# Create IDF object text for FaultModel:TemperatureSensorOffset:OutdoorAir\n\t\t\tstring_object = \"\n\t\t\t\tFaultModel:TemperatureSensorOffset:OutdoorAir,\n\t\t\t\t#{oa_controller_name}_Outdoor Air Temp Sensor Bias, !- Name\n\t\t\t\tAlways On Discrete, \t\t\t\t\t\t\t!- Availability Schedule Name\n\t\t\t\t, \t\t\t\t\t\t\t\t\t\t\t\t!- Severity Schedule Name\n\t\t\t\tController:OutdoorAir, \t\t\t\t\t\t\t!- Controller Object Type\n\t\t\t\t#{oa_controller_name}, \t\t\t\t\t\t\t!- Controller Object Name\n\t\t\t\t1.11; \t\t\t\t\t\t\t\t\t\t\t!- Temperature Sensor Offset \n\t\t\t\t\"\n\t\t\t# Add string object to workspace to create idf object\n\t\t\tidfObject = OpenStudio::IdfObject::load(string_object)\n\t\t\tobject = idfObject.get\n\t\t\tworkspace.addObject(object)\n\t\t\t\t\t\t\n\t\t\t# Create IDF object text for FaultModel:TemperatureSensorOffset:ReturnAir\n\t\t\tstring_object = \"\n\t\t\t\tFaultModel:TemperatureSensorOffset:ReturnAir,\n\t\t\t\t#{oa_controller_name}_Return Air Temp Sensor Bias, !- Name\n\t\t\t\tAlways On Discrete, \t\t\t\t\t\t\t!- Availability Schedule Name\n\t\t\t\t, \t\t\t\t\t\t\t\t\t\t\t\t!- Severity Schedule Name\n\t\t\t\tController:OutdoorAir, \t\t\t\t\t\t\t!- Controller Object Type\n\t\t\t\t#{oa_controller_name}, \t\t\t\t\t\t\t!- Controller Object Name\n\t\t\t\t-1.11; \t\t\t\t\t\t\t\t\t\t\t!- Temperature Sensor Offset \n\t\t\t\t\"\n\t\t\t# Add string object to workspace to create idf object\n\t\t\tidfObject = OpenStudio::IdfObject::load(string_object)\n\t\t\tobject = idfObject.get\n\t\t\tworkspace.addObject(object)\n\n\t\t\trunner.registerInfo(\"To model both enthalpy and dry bulb sensor drift, a FaultModel:EnthalpySensorOffset:ReturnAir object with an offset of -2 Btu/lb and a FaultModel:EnthalpySensorOffset:OutdoorAir object with an offset of +2 Btu/lb and a FaultModel:TemperatureSensorOffset:ReturnAir object with an offset of -2 deg F and a FaultModel:TemperatureSensorOffset:OutdoorAir object with an offset of +2 deg have been added to the #{oa_controller_economizer_control_type} controlled airside economizer associated with the Controller:Outdoor air object named #{oa_controller_name}. The fault availability is scheduled using the 'Always On Discrete' schedule.\")\n\t\t\tdifferential_dry_bulb_and_enthalpy = differential_dry_bulb_and_enthalpy + 1\n\t\tend # OA Controller Type \"DifferentialDryBulbAndEnthalpy\"\n\t\t\n\t\t\t\t\n\tend # end loop through oa controller objects\n\n\t# reporting when N/A condition is appropriate\n\tif fixed_dry_bulb +\tdifferential_dry_bulb + fixed_enthalpy + differential_enthalpy + fixed_dew_point_and_dry_bulb +\telectronic_enthalpy + differential_dry_bulb_and_enthalpy == 0\n\t\trunner.registerAsNotApplicable(\"Measure not applicable because the model contains no OutdoorAir:Controller objects with operable economizers.\")\n\tend \n\t\n\ttotal = fixed_dry_bulb + differential_dry_bulb + fixed_enthalpy + differential_enthalpy + fixed_dew_point_and_dry_bulb + electronic_enthalpy + differential_dry_bulb_and_enthalpy\n\t\n\t# reporting initial condition of model\n\trunner.registerInitialCondition(\"The measure started with #{total} Outdoor Air Controllers configured for operational airside economizers. #{no_economizer} Outdoor Air Controller had the Economizer Contrrol Type set to 'NoEconomizer'.\")\n\t# reporting final condition of model\n\trunner.registerFinalCondition(\"The measure finished by adding outdoor and return air temperature and enthalpy sensor faults to #{total} economizer configurations.\")\n \n return true\n \n end",
"def calculation\n end",
"def monitor; end",
"def run(model, runner, user_arguments)\n super(model, runner, user_arguments)\n\n # Return N/A if not selected to run\n run_measure = runner.getIntegerArgumentValue(\"run_measure\",user_arguments)\n if run_measure == 0\n runner.registerAsNotApplicable(\"Run Measure set to #{run_measure}.\")\n return true \n end \n \n # initialize variables\n affected_space_types = []\n affected_flag = false\n power_tot = 0\n power_tot_new = 0\n control_factor = 0.05 #90.1-2010 Table 9.6.2\n\n # standards space types\n affected_space_types << \"BreakRoom\"\n affected_space_types << \"Conference\"\n affected_space_types << \"Office\"\n affected_space_types << \"Restroom\"\n affected_space_types << \"Stair\"\n\n # get model objects\n space_types = model.getSpaceTypes\n\n # DO STUFF\n #TODO account for zone multipliers?\n space_types.each do |st|\n\n std_spc_typ = st.standardsSpaceType.to_s\n area = st.floorArea\n people = st.getNumberOfPeople(area)\n power = st.getLightingPower(area, people)\n power_tot += power\n\n #calcualte LPD\n lpd_area = power / area\n lpd_people = power / people\n\n affected_space_types.each do |ast|\n\n if ast == std_spc_typ\n\n #calculate adjustment and new power\n power_adj = power * control_factor\n power_new = power - power_adj\n\n lpd_area_new = power_new / area\n lpd_people_new = power_new / people\n\n #set new power\n if st.lightingPowerPerFloorArea.is_initialized\n\n runner.registerInfo(\"Adjusting interior lighting power for space type: #{st.name}\")\n st.setLightingPowerPerFloorArea(lpd_area_new)\n\n lpd_area_ip = OpenStudio.convert(lpd_area,\"ft^2\",\"m^2\").get\n lpd_area_new_ip = OpenStudio.convert(lpd_area_new,\"ft^2\",\"m^2\").get\n lpd_area_change = (1 - (lpd_area_new / lpd_area)) * 100\n\n runner.registerInfo(\"=> Initial interior lighting power = #{lpd_area_ip.round(2)} W/ft2\")\n runner.registerInfo(\"=> Final interior lighting power = #{lpd_area_new_ip.round(2)} W/ft2\")\n runner.registerInfo(\"=> Interior lighting power reduction = #{lpd_area_change.round(0)}%\")\n\n elsif st.lightingPowerPerPerson.is_initialized\n\n runner.registerInfo(\"Adjusting interior lighting power for space type: #{st.name}\")\n st.setLightingPowerPerPerson(lpd_people_new)\n\n lpd_people_change = (1 - (lpd_people_new / lpd_people)) * 100\n\n runner.registerInfo(\"=> Initial interior lighting power = #{lpd_people} W/person\")\n runner.registerInfo(\"=> Final interior lighting power = #{lpd_people_new} W/person\")\n runner.registerInfo(\"=> Interior lighting power reduction = #{lpd_people_change.round(0)}%\")\n\n else\n\n runner.registerWarning(\"Lighting power is specified using Lighting Level (W) for affected space type: #{st.name}\")\n\n end #set new power\n\n affected_flag = true\n\n end\n\n end #affected space types\n\n # calculate new total lighting power\n power = st.getLightingPower(area, people)\n power_tot_new += power\n\n end #space types\n\n # report not applicable\n if affected_flag == false\n runner.registerAsNotApplicable(\"No affected space types found\")\n end\n\n # report initial condition\n runner.registerInitialCondition(\"Total interior lighting power = #{power_tot.round(0)} W\")\n\n # report final condition\n runner.registerFinalCondition(\"Total interior lighting power = #{power_tot_new.round(0)} W\")\n\n return true\n\n end",
"def measure key,value\n @context= {}\n @path = \"#{key}\" \n @context[:callcount] = 1\n @context[:firsttimestampoffset] = Time.now.to_f*1000 - value\n @context[:name] = @path\n @context[:responsetime] = value\n @context_list << @context\n end",
"def total_time=(_arg0); end",
"def run(workspace, runner, user_arguments)\n super(workspace, runner, user_arguments)\n\n #use the built-in error checking \n if not runner.validateUserArguments(arguments(workspace), user_arguments)\n return false\n end\n \n run_measure = runner.getIntegerArgumentValue(\"run_measure\",user_arguments)\n if run_measure == 0\n runner.registerAsNotApplicable(\"Run Measure set to #{run_measure}.\")\n return true \n end\n \n require 'json'\n \n # Get the last openstudio model\n model = runner.lastOpenStudioModel\n if model.empty?\n runner.registerError(\"Could not load last OpenStudio model, cannot apply measure.\")\n return false\n end\n model = model.get\n \n results = {}\n \n #get all DX coils in model\n dx_single = workspace.getObjectsByType(\"Coil:Cooling:DX:SingleSpeed\".to_IddObjectType)\n dx_two = workspace.getObjectsByType(\"Coil:Cooling:DX:TwoSpeed\".to_IddObjectType)\n \n dx_single.each do |dx|\n dx_name = {}\n coil_name = dx.getString(0).get\n runner.registerInfo(\"DX coil: #{coil_name} Initial COP: #{dx.getDouble(4).get}\")\n dx.setDouble(4,7.62)\n runner.registerInfo(\"DX coil: #{coil_name} Final COP: #{dx.getDouble(4).get}\")\n dx_name[:dxname] = \"#{coil_name}\"\n results[\"#{coil_name}\"] = dx_name\n end\n\n dx_two.each do |dx|\n dx_name = {}\n coil_name = dx.getString(0).get\n runner.registerInfo(\"DX coil: #{coil_name} Initial High COP: #{dx.getDouble(4).get}, Initial Low COP: #{dx.getDouble(16).get}\")\n dx.setDouble(4,7.62)\n dx.setDouble(16,7.62)\n runner.registerInfo(\"DX coil: #{coil_name} Final High COP: #{dx.getDouble(4).get}, Final Low COP: #{dx.getDouble(16).get}\")\n dx_name[:dxname] = \"#{coil_name}\"\n results[\"#{coil_name}\"] = dx_name\n end\n \n if results.empty?\n runner.registerWarning(\"No DX coils are appropriate for this measure\")\n runner.registerAsNotApplicable(\"No DX coils are appropriate for this measure\")\n end\n \n #save airloop parsing results to ems_results.json\n runner.registerInfo(\"Saving ems_results.json\")\n FileUtils.mkdir_p(File.dirname(\"ems_results.json\")) unless Dir.exist?(File.dirname(\"ems_results.json\"))\n File.open(\"ems_results.json\", 'w') {|f| f << JSON.pretty_generate(results)}\n \n if results.empty?\n runner.registerWarning(\"No DX coils are appropriate for this measure\")\n runner.registerAsNotApplicable(\"No DX coils are appropriate for this measure\")\n #save blank ems_membrane_heat_pump_cooling_only.ems file so Eplus measure does not crash\n ems_string = \"\"\n runner.registerInfo(\"Saving blank ems_membrane_heat_pump_cooling_only file\")\n FileUtils.mkdir_p(File.dirname(\"ems_membrane_heat_pump_cooling_only.ems\")) unless Dir.exist?(File.dirname(\"ems_membrane_heat_pump_cooling_only.ems\"))\n File.open(\"ems_membrane_heat_pump_cooling_only.ems\", \"w\") do |f|\n f.write(ems_string)\n end\n return true\n end\n \n timeStep = model.getTimestep.numberOfTimestepsPerHour\n \n runner.registerInfo(\"Making EMS string for Membrane Heat Pump Cooling Only\")\n #start making the EMS code\n ems_string = \"\" #clear out the ems_string\n ems_string << \"\\n\" \n ems_string << \"Output:Variable,*,Cooling Coil Sensible Cooling Energy,timestep; !- HVAC Sum [J]\" + \"\\n\"\n ems_string << \"\\n\" \n \n results.each_with_index do |(key, value), i| \n ems_string << \"EnergyManagementSystem:Sensor,\" + \"\\n\"\n ems_string << \" MembraneHP#{i+1}SensibleClgJ,\" + \"\\n\"\n ems_string << \" #{value[:dxname]},\" + \"\\n\"\n ems_string << \" Cooling Coil Sensible Cooling Energy;\" + \"\\n\"\n ems_string << \"\\n\" \n ems_string << \"WaterUse:Equipment,\" + \"\\n\"\n ems_string << \" MembraneHP#{i+1}WaterUse, !- Name\" + \"\\n\"\n ems_string << \" Membrane HP Cooling, !- End-Use Subcategory\" + \"\\n\"\n ems_string << \" 0.003155, !- Peak Flow Rate {m3/s} = 3000 gal/hr\" + \"\\n\"\n ems_string << \" MembraneHP#{i+1}WaterUseSchedule; !- Flow Rate Fraction Schedule Name\" + \"\\n\"\n ems_string << \"\\n\" \n ems_string << \"Schedule:Constant,\" + \"\\n\"\n ems_string << \" MembraneHP#{i+1}WaterUseSchedule, !- Name\" + \"\\n\"\n ems_string << \" , !- Schedule Type Limits Name\" + \"\\n\"\n ems_string << \" 1; !- Hourly Value\" + \"\\n\"\n ems_string << \"\\n\" \n ems_string << \"EnergyManagementSystem:Actuator,\" + \"\\n\"\n ems_string << \" MembraneHP#{i+1}WaterUseCtrl,\" + \"\\n\"\n ems_string << \" MembraneHP#{i+1}WaterUseSchedule,\" + \"\\n\"\n ems_string << \" Schedule:Constant,\" + \"\\n\"\n ems_string << \" Schedule Value;\" + \"\\n\"\n ems_string << \"\\n\" \n end\n ems_string << \"EnergyManagementSystem:ProgramCallingManager,\" + \"\\n\"\n ems_string << \" MembraneHPWaterUseProgramControl, !- Name\" + \"\\n\"\n ems_string << \" AfterPredictorBeforeHVACManagers, !- EnergyPlus Model Calling Point\" + \"\\n\"\n ems_string << \" MembraneHPWaterUseProgram; !- Program Name 1\" + \"\\n\"\n ems_string << \"\\n\"\n ems_string << \"EnergyManagementSystem:Program,\" + \"\\n\"\n ems_string << \" MembraneHPWaterUseProgram, !- Name\" + \"\\n\"\n ems_string << \" SET TimeStepsPerHr = #{timeStep}\" + \"\\n\"\n results.each_with_index do |(key, value), i|\n ems_string << \" SET MembraneHP#{i+1}SensibleClgTonHr = MembraneHP#{i+1}SensibleClgJ * 0.0000007898,\" + \"\\n\"\n ems_string << \" SET MembraneHP#{i+1}SensibleWtrGal = MembraneHP#{i+1}SensibleClgTonHr * 3.0,\" + \"\\n\"\n ems_string << \" SET MembraneHP#{i+1}SensibleWtrGalPerHr = MembraneHP#{i+1}SensibleWtrGal * TimeStepsPerHr,\" + \"\\n\"\n ems_string << \" SET MembraneHP#{i+1}WaterUseCtrl = MembraneHP#{i+1}SensibleWtrGalPerHr / 3000.0,\" + \"\\n\"\n end \n ems_string << \" SET UnusedLine = 0;\" + \"\\n\"\n \n #save EMS snippet\n runner.registerInfo(\"Saving ems_membrane_heat_pump_cooling_only file\")\n FileUtils.mkdir_p(File.dirname(\"ems_membrane_heat_pump_cooling_only.ems\")) unless Dir.exist?(File.dirname(\"ems_membrane_heat_pump_cooling_only.ems\"))\n File.open(\"ems_membrane_heat_pump_cooling_only.ems\", \"w\") do |f|\n f.write(ems_string)\n end\n \n #unique initial conditions based on\n runner.registerInitialCondition(\"The building has #{results.size} DX coils for which this measure is applicable.\")\n\n #reporting final condition of model\n runner.registerFinalCondition(\"The efficiency of the following coils was increased to SEER 26 to reflect the replacement of these coils with membrane heatpumps: #{results.keys}\")\n \n ems_path = '../MembraneHeatPumpCoolingOnly/ems_membrane_heat_pump_cooling_only.ems'\n json_path = '../MembraneHeatPumpCoolingOnly/ems_results.json'\n if File.exist? ems_path\n ems_string = File.read(ems_path)\n if File.exist? json_path\n json = JSON.parse(File.read(json_path))\n end\n else\n ems_path2 = Dir.glob('../../**/ems_membrane_heat_pump_cooling_only.ems')\n ems_path1 = ems_path2[0]\n json_path2 = Dir.glob('../../**/ems_results.json')\n json_path1 = json_path2[0]\n if ems_path2.size > 1\n runner.registerWarning(\"more than one ems_membrane_heat_pump_cooling_only.ems file found. Using first one found.\")\n end\n if !ems_path1.nil? \n if File.exist? ems_path1\n ems_string = File.read(ems_path1)\n if File.exist? json_path1\n json = JSON.parse(File.read(json_path1))\n else\n runner.registerError(\"ems_results.json file not located\") \n end \n else\n runner.registerError(\"ems_membrane_heat_pump_cooling_only.ems file not located\")\n end \n else\n runner.registerError(\"ems_membrane_heat_pump_cooling_only.ems file not located\") \n end\n end\n if json.nil?\n runner.registerError(\"ems_results.json file not located\")\n return false\n end\n \n if json.empty?\n runner.registerWarning(\"No DX coils are appropriate for this measure\")\n return true\n end\n \n idf_file = OpenStudio::IdfFile::load(ems_string, 'EnergyPlus'.to_IddFileType).get\n runner.registerInfo(\"Adding EMS code to workspace\")\n workspace.addObjects(idf_file.objects)\n \n return true\n\n end",
"def apply_measure_to_model(test_name, args, model_name = nil, result_value = 'Success', warnings_count = 0, info_count = nil)\n # create an instance of the measure\n measure = ChangeBuildingLocation.new\n\n # create an instance of a runner with OSW\n osw_path = OpenStudio::Path.new(File.dirname(__FILE__) + '/test.osw')\n osw = OpenStudio::WorkflowJSON.load(osw_path).get\n runner = OpenStudio::Measure::OSRunner.new(osw)\n\n # get model\n if model_name.nil?\n # make an empty model\n model = OpenStudio::Model::Model.new\n else\n # load the test model\n translator = OpenStudio::OSVersion::VersionTranslator.new\n path = OpenStudio::Path.new(File.dirname(__FILE__) + '/' + model_name)\n model = translator.loadModel(path)\n assert(!model.empty?)\n model = model.get\n end\n\n # get arguments\n arguments = measure.arguments(model)\n argument_map = OpenStudio::Measure.convertOSArgumentVectorToMap(arguments)\n\n # populate argument with specified hash value if specified\n arguments.each do |arg|\n temp_arg_var = arg.clone\n if args.key?(arg.name)\n assert(temp_arg_var.setValue(args[arg.name]))\n end\n argument_map[arg.name] = temp_arg_var\n end\n\n # temporarily change directory to the run directory and run the measure (because of sizing run)\n start_dir = Dir.pwd\n begin\n unless Dir.exist?(run_dir(test_name))\n Dir.mkdir(run_dir(test_name))\n end\n Dir.chdir(run_dir(test_name))\n\n # run the measure\n measure.run(model, runner, argument_map)\n result = runner.result\n ensure\n Dir.chdir(start_dir)\n\n # delete sizing run dir\n FileUtils.rm_rf(run_dir(test_name))\n end\n\n # show the output\n puts \"measure results for #{test_name}\"\n show_output(result)\n\n # assert that it ran correctly\n if result_value.nil? then result_value = 'Success' end\n assert_equal(result_value, result.value.valueName)\n\n # check count of warning and info messages\n unless info_count.nil? then assert(result.info.size == info_count) end\n unless warnings_count.nil? then assert(result.warnings.size == warnings_count) end\n\n # if 'Fail' passed in make sure at least one error message (while not typical there may be more than one message)\n if result_value == 'Fail' then assert(result.errors.size >= 1) end\n\n # save the model to test output directory\n output_file_path = OpenStudio::Path.new(File.dirname(__FILE__) + \"/output/#{test_name}_test_output.osm\")\n model.save(output_file_path, true)\n end",
"def measure_code(model,runner)\n ################ Start Measure code here ################################\n # Argument will be passed as instance variable. So if your argument was height, your can access it using @height. \n\n # report initial condition\n site = model.getSite\n initial_design_days = model.getDesignDays\n if site.weatherFile.is_initialized\n weather = site.weatherFile.get\n runner.registerInitialCondition(\"The initial weather file path was '#{weather.path.get}' and the model had #{initial_design_days.size} design days.\")\n else\n runner.registerInitialCondition(\"The initial weather file has not been set and the model had #{initial_design_days.size} design days.\")\n end\n\n\n #Check form weather directory Weather File\n unless (Pathname.new @weather_directory).absolute?\n @weather_directory = File.expand_path(File.join(File.dirname(__FILE__), @weather_directory))\n end\n weather_file = File.join(@weather_directory, @weather_file_name)\n if File.exists?(weather_file) and @weather_file_name.downcase.include? \".epw\"\n BTAP::runner_register(\"Info\", \"The epw weather file #{weather_file} was found!\", runner)\n else\n BTAP::runner_register(\"Error\",\"'#{weather_file}' does not exist or is not an .epw file.\", runner)\n return false\n end\n\n begin\n weather = BTAP::Environment::WeatherFile.new(weather_file)\n #Set Weather file to model.\n weather.set_weather_file(model)\n #Store information about this run in the runner for output. This will be in the csv and R dumps.\n runner.registerValue( 'city',weather.city )\n runner.registerValue( 'state_province_region ',weather.state_province_region )\n runner.registerValue( 'country',weather.country )\n runner.registerValue( 'hdd18',weather.hdd18 )\n runner.registerValue( 'cdd18',weather.cdd18 )\n runner.registerValue( 'necb_climate_zone',BTAP::Compliance::NECB2011::get_climate_zone_name(weather.hdd18).to_s)\n runner.registerFinalCondition( \"Model ended with weatherfile of #{model.getSite.weatherFile.get.path.get}\" )\n rescue\n BTAP::runner_register(\"Error\",\"'#{weather_file}' could not be loaded into model.\", runner)\n\n return false\n end\n BTAP::runner_register(\"FinalCondition\",\"Weather file set to #{weather_file}\",runner)\n return true\n end",
"def run(workspace, runner, user_arguments)\r\n super(workspace, runner, user_arguments)\r\n\r\n #use the built-in error checking \r\n if not runner.validateUserArguments(arguments(workspace), user_arguments)\r\n return false\r\n end\r\n \r\n run_measure = runner.getIntegerArgumentValue(\"run_measure\",user_arguments)\r\n if run_measure == 0\r\n runner.registerAsNotApplicable(\"Run Measure set to #{run_measure}.\")\r\n return true \r\n end\r\n \r\n require 'json'\r\n \r\n # Get the last openstudio model\r\n model = runner.lastOpenStudioModel\r\n if model.empty?\r\n runner.registerError(\"Could not load last OpenStudio model, cannot apply measure.\")\r\n return false\r\n end\r\n model = model.get\r\n \r\n results = {}\r\n #get all DX coils in model\r\n dx_single = model.getCoilCoolingDXSingleSpeeds \r\n dx_two = model.getCoilCoolingDXTwoSpeeds\r\n \r\n if !dx_single.empty?\r\n dx_single.each do |dx|\r\n dx_name = {}\r\n runner.registerInfo(\"DX coil: #{dx.name.get} Initial COP: #{dx.ratedCOP.get}\")\r\n dx.setRatedCOP(OpenStudio::OptionalDouble.new(7.62))\r\n runner.registerInfo(\"DX coil: #{dx.name.get} Final COP: #{dx.ratedCOP.get}\")\r\n dx_name[:dxname] = \"#{dx.name.get}\"\r\n results[\"#{dx.name.get}\"] = dx_name\r\n end\r\n end\r\n if !dx_two.empty?\r\n dx_two.each do |dx|\r\n dx_name = {}\r\n runner.registerInfo(\"DX coil: #{dx.name.get} Initial High COP: #{dx.ratedHighSpeedCOP.get} Low COP: #{dx.ratedLowSpeedCOP.get}\")\r\n dx.setRatedHighSpeedCOP(7.62)\r\n dx.setRatedLowSpeedCOP(7.62)\r\n runner.registerInfo(\"DX coil: #{dx.name.get} Final High COP: #{dx.ratedHighSpeedCOP.get} Final COP: #{dx.ratedLowSpeedCOP.get}\")\r\n dx_name[:dxname] = \"#{dx.name.get}\"\r\n results[\"#{dx.name.get}\"] = dx_name\r\n end\r\n end\r\n \r\n if results.empty?\r\n runner.registerWarning(\"No DX coils are appropriate for this measure\")\r\n runner.registerAsNotApplicable(\"No DX coils are appropriate for this measure\")\r\n end\r\n \r\n #save airloop parsing results to ems_results.json\r\n runner.registerInfo(\"Saving ems_results.json\")\r\n FileUtils.mkdir_p(File.dirname(\"ems_results.json\")) unless Dir.exist?(File.dirname(\"ems_results.json\"))\r\n File.open(\"ems_results.json\", 'w') {|f| f << JSON.pretty_generate(results)}\r\n \r\n if results.empty?\r\n runner.registerWarning(\"No DX coils are appropriate for this measure\")\r\n runner.registerAsNotApplicable(\"No DX coils are appropriate for this measure\")\r\n #save blank ems_membrane_heat_pump_cooling_only.ems file so Eplus measure does not crash\r\n ems_string = \"\"\r\n runner.registerInfo(\"Saving blank ems_membrane_heat_pump_cooling_only file\")\r\n FileUtils.mkdir_p(File.dirname(\"ems_membrane_heat_pump_cooling_only.ems\")) unless Dir.exist?(File.dirname(\"ems_membrane_heat_pump_cooling_only.ems\"))\r\n File.open(\"ems_membrane_heat_pump_cooling_only.ems\", \"w\") do |f|\r\n f.write(ems_string)\r\n end\r\n return true\r\n end\r\n \r\n timeStep = model.getTimestep.numberOfTimestepsPerHour\r\n \r\n runner.registerInfo(\"Making EMS string for Membrane Heat Pump Cooling Only\")\r\n #start making the EMS code\r\n ems_string = \"\" #clear out the ems_string\r\n ems_string << \"\\n\" \r\n ems_string << \"Output:Variable,*,Cooling Coil Sensible Cooling Energy,timestep; !- HVAC Sum [J]\" + \"\\n\"\r\n ems_string << \"\\n\" \r\n \r\n results.each_with_index do |(key, value), i| \r\n ems_string << \"EnergyManagementSystem:Sensor,\" + \"\\n\"\r\n ems_string << \" MembraneHP#{i+1}SensibleClgJ,\" + \"\\n\"\r\n ems_string << \" #{value[:dxname]},\" + \"\\n\"\r\n ems_string << \" Cooling Coil Sensible Cooling Energy;\" + \"\\n\"\r\n ems_string << \"\\n\" \r\n ems_string << \"WaterUse:Equipment,\" + \"\\n\"\r\n ems_string << \" MembraneHP#{i+1}WaterUse, !- Name\" + \"\\n\"\r\n ems_string << \" Membrane HP Cooling, !- End-Use Subcategory\" + \"\\n\"\r\n ems_string << \" 0.003155, !- Peak Flow Rate {m3/s} = 3000 gal/hr\" + \"\\n\"\r\n ems_string << \" MembraneHP#{i+1}WaterUseSchedule; !- Flow Rate Fraction Schedule Name\" + \"\\n\"\r\n ems_string << \"\\n\" \r\n ems_string << \"Schedule:Constant,\" + \"\\n\"\r\n ems_string << \" MembraneHP#{i+1}WaterUseSchedule, !- Name\" + \"\\n\"\r\n ems_string << \" , !- Schedule Type Limits Name\" + \"\\n\"\r\n ems_string << \" 1; !- Hourly Value\" + \"\\n\"\r\n ems_string << \"\\n\" \r\n ems_string << \"EnergyManagementSystem:Actuator,\" + \"\\n\"\r\n ems_string << \" MembraneHP#{i+1}WaterUseCtrl,\" + \"\\n\"\r\n ems_string << \" MembraneHP#{i+1}WaterUseSchedule,\" + \"\\n\"\r\n ems_string << \" Schedule:Constant,\" + \"\\n\"\r\n ems_string << \" Schedule Value;\" + \"\\n\"\r\n ems_string << \"\\n\" \r\n end\r\n ems_string << \"EnergyManagementSystem:ProgramCallingManager,\" + \"\\n\"\r\n ems_string << \" MembraneHPWaterUseProgramControl, !- Name\" + \"\\n\"\r\n ems_string << \" AfterPredictorBeforeHVACManagers, !- EnergyPlus Model Calling Point\" + \"\\n\"\r\n ems_string << \" MembraneHPWaterUseProgram; !- Program Name 1\" + \"\\n\"\r\n ems_string << \"\\n\"\r\n ems_string << \"EnergyManagementSystem:Program,\" + \"\\n\"\r\n ems_string << \" MembraneHPWaterUseProgram, !- Name\" + \"\\n\"\r\n ems_string << \" SET TimeStepsPerHr = #{timeStep}\" + \"\\n\"\r\n results.each_with_index do |(key, value), i|\r\n ems_string << \" SET MembraneHP#{i+1}SensibleClgTonHr = MembraneHP#{i+1}SensibleClgJ * 0.0000007898,\" + \"\\n\"\r\n ems_string << \" SET MembraneHP#{i+1}SensibleWtrGal = MembraneHP#{i+1}SensibleClgTonHr * 3.0,\" + \"\\n\"\r\n ems_string << \" SET MembraneHP#{i+1}SensibleWtrGalPerHr = MembraneHP#{i+1}SensibleWtrGal * TimeStepsPerHr,\" + \"\\n\"\r\n ems_string << \" SET MembraneHP#{i+1}WaterUseCtrl = MembraneHP#{i+1}SensibleWtrGalPerHr / 3000.0,\" + \"\\n\"\r\n end \r\n ems_string << \" SET UnusedLine = 0;\" + \"\\n\"\r\n \r\n #save EMS snippet\r\n runner.registerInfo(\"Saving ems_membrane_heat_pump_cooling_only file\")\r\n FileUtils.mkdir_p(File.dirname(\"ems_membrane_heat_pump_cooling_only.ems\")) unless Dir.exist?(File.dirname(\"ems_membrane_heat_pump_cooling_only.ems\"))\r\n File.open(\"ems_membrane_heat_pump_cooling_only.ems\", \"w\") do |f|\r\n f.write(ems_string)\r\n end\r\n \r\n #unique initial conditions based on\r\n runner.registerInitialCondition(\"The building has #{results.size} DX coils for which this measure is applicable.\")\r\n\r\n #reporting final condition of model\r\n runner.registerFinalCondition(\"The efficiency of the following coils was increased to SEER 26 to reflect the replacement of these coils with membrane heatpumps: #{results.keys}\")\r\n \r\n ems_path = '../MembraneHeatPumpCoolingOnlyEms/ems_membrane_heat_pump_cooling_only.ems'\r\n json_path = '../MembraneHeatPumpCoolingOnlyEms/ems_results.json'\r\n if File.exist? ems_path\r\n ems_string = File.read(ems_path)\r\n if File.exist? json_path\r\n json = JSON.parse(File.read(json_path))\r\n end\r\n else\r\n ems_path2 = Dir.glob('../../**/ems_membrane_heat_pump_cooling_only.ems')\r\n ems_path1 = ems_path2[0]\r\n json_path2 = Dir.glob('../../**/ems_results.json')\r\n json_path1 = json_path2[0]\r\n if ems_path2.size > 1\r\n runner.registerWarning(\"more than one ems_membrane_heat_pump_cooling_only.ems file found. Using first one found.\")\r\n end\r\n if !ems_path1.nil? \r\n if File.exist? ems_path1\r\n ems_string = File.read(ems_path1)\r\n if File.exist? json_path1\r\n json = JSON.parse(File.read(json_path1))\r\n else\r\n runner.registerError(\"ems_results.json file not located\") \r\n end \r\n else\r\n runner.registerError(\"ems_membrane_heat_pump_cooling_only.ems file not located\")\r\n end \r\n else\r\n runner.registerError(\"ems_membrane_heat_pump_cooling_only.ems file not located\") \r\n end\r\n end\r\n if json.nil?\r\n runner.registerError(\"ems_results.json file not located\")\r\n return false\r\n end\r\n \r\n if json.empty?\r\n runner.registerWarning(\"No DX coils are appropriate for this measure\")\r\n return true\r\n end\r\n \r\n idf_file = OpenStudio::IdfFile::load(ems_string, 'EnergyPlus'.to_IddFileType).get\r\n runner.registerInfo(\"Adding EMS code to workspace\")\r\n workspace.addObjects(idf_file.objects)\r\n \r\n return true\r\n\r\n end",
"def modeler_description\n return 'The measure performs the following functions: (1) IDs all chillers, (2) Locates their performance curves and outputs the data, (3) Adds reporting variables for chiller-related data.'\n end",
"def build_timing; end",
"def measure_gc\n return unless enabled?\n\n @raw_data << { fake: true }\n @total_time += 1.1\n\n end",
"def run(model, runner, user_arguments)\n super(model, runner, user_arguments)\n\n # use the built-in error checking\n if !runner.validateUserArguments(arguments(model), user_arguments)\n return false\n end\n\n # define if the measure should run to a specific time period or whole day\n apply_to_time = true\n\n # assign the user inputs to variables\n object = runner.getOptionalWorkspaceObjectChoiceValue('space_type', user_arguments, model)\n single_space_type = runner.getDoubleArgumentValue('single_space_type', user_arguments)\n occupied_space_type = runner.getDoubleArgumentValue('occupied_space_type', user_arguments)\n unoccupied_space_type = runner.getDoubleArgumentValue('unoccupied_space_type', user_arguments)\n starttime_winter2 = runner.getStringArgumentValue('starttime_winter2', user_arguments)\n endtime_winter2 = runner.getStringArgumentValue('endtime_winter2', user_arguments)\n starttime_winter1 = runner.getStringArgumentValue('starttime_winter1', user_arguments)\n endtime_winter1 = runner.getStringArgumentValue('endtime_winter1', user_arguments)\n starttime_summer = runner.getStringArgumentValue('starttime_summer', user_arguments)\n endtime_summer = runner.getStringArgumentValue('endtime_summer', user_arguments)\n auto_date = runner.getBoolArgumentValue('auto_date', user_arguments)\n alt_periods = runner.getBoolArgumentValue('alt_periods', user_arguments)\n demo_cost_initial_const=false\n\n winter_start_month1 = 1\n winter_end_month1 = 5\n summer_start_month = 6\n summer_end_month = 9\n winter_start_month2 = 10\n winter_end_month2 = 12\n\n######### GET CLIMATE ZONES ################\n if auto_date\n ashraeClimateZone = ''\n #climateZoneNUmber = ''\n climateZones = model.getClimateZones\n climateZones.climateZones.each do |climateZone|\n if climateZone.institution == 'ASHRAE'\n ashraeClimateZone = climateZone.value\n runner.registerInfo(\"Using ASHRAE Climate zone #{ashraeClimateZone}.\")\n end\n end\n\n if ashraeClimateZone == '' # should this be not applicable or error?\n runner.registerError(\"Please assign an ASHRAE Climate Zone to your model using the site tab in the OpenStudio application. The measure can't make AEDG recommendations without this information.\")\n return false # note - for this to work need to check for false in measure.rb and add return false there as well.\n # else\n # climateZoneNumber = ashraeClimateZone.split(//).first\n end\n # #runner.registerInfo(\"CLIMATE ZONE #{ashraeClimateZone}. Right now does not do anything.\")\n # if !['1', '2', '3', '4', '5', '6', '7', '8'].include? climateZoneNumber\n # runner.registerError('ASHRAE climate zone number is not within expected range of 1 to 8.')\n # return false # note - for this to work need to check for false in measure.rb and add return false there as well.\n # end\n\n if alt_periods\n if ashraeClimateZone == '3A'\n starttime_summer = '18:01:00'\n endtime_summer = '21:59:00'\n starttime_winter1 = '17:01:00'\n endtime_winter1 = '20:59:00'\n starttime_winter2 = '17:01:00'\n endtime_winter2 = '20:59:00'\n elsif ashraeClimateZone == '4A'\n starttime_summer = '18:01:00'\n endtime_summer = '21:59:00'\n starttime_winter1 = '17:01:00'\n endtime_winter1 = '20:59:00'\n starttime_winter2 = '17:01:00'\n endtime_winter2 = '20:59:00'\n elsif ashraeClimateZone == '5A'\n starttime_summer = '14:01:00'\n endtime_summer = '17:59:00'\n starttime_winter1 = '18:01:00'\n endtime_winter1 = '21:59:00'\n starttime_winter2 = '18:01:00'\n endtime_winter2 = '21:59:00'\n elsif ashraeClimateZone == '6A'\n starttime_summer = '13:01:00'\n endtime_summer = '16:59:00'\n starttime_winter1 = '17:01:00'\n endtime_winter1 = '20:59:00'\n starttime_winter2 = '17:01:00'\n endtime_winter2 = '20:59:00'\n end\n else\n if ashraeClimateZone == '2A'\n starttime_summer = '17:01:00'\n endtime_summer = '20:59:00'\n starttime_winter1 = '17:01:00'\n endtime_winter1 = '20:59:00'\n starttime_winter2 = '17:01:00'\n endtime_winter2 = '20:59:00'\n elsif ashraeClimateZone == '2B'\n starttime_summer = '17:01:00'\n endtime_summer = '20:59:00'\n starttime_winter1 = '17:01:00'\n endtime_winter1 = '20:59:00'\n starttime_winter2 = '17:01:00'\n endtime_winter2 = '20:59:00'\n elsif ashraeClimateZone == '3A'\n starttime_summer = '19:01:00'\n endtime_summer = '22:59:00'\n starttime_winter1 = '17:01:00'\n endtime_winter1 = '20:59:00'\n starttime_winter2 = '17:01:00'\n endtime_winter2 = '20:59:00'\n elsif ashraeClimateZone == '3B'\n starttime_summer = '18:01:00'\n endtime_summer = '21:59:00'\n starttime_winter1 = '19:01:00'\n endtime_winter1 = '22:59:00'\n starttime_winter2 = '19:01:00'\n endtime_winter2 = '22:59:00'\n elsif ashraeClimateZone == '3C'\n starttime_summer = '19:01:00'\n endtime_summer = '22:59:00'\n starttime_winter1 = '17:01:00'\n endtime_winter1 = '20:59:00'\n starttime_winter2 = '17:01:00'\n endtime_winter2 = '20:59:00'\n elsif ashraeClimateZone == '4A'\n starttime_summer = '12:01:00'\n endtime_summer = '15:59:00'\n starttime_winter1 = '16:01:00'\n endtime_winter1 = '19:59:00'\n starttime_winter2 = '16:01:00'\n endtime_winter2 = '19:59:00'\n elsif ashraeClimateZone == '4B'\n starttime_summer = '17:01:00'\n endtime_summer = '20:59:00'\n starttime_winter1 = '17:01:00'\n endtime_winter1 = '20:59:00'\n starttime_winter2 = '17:01:00'\n endtime_winter2 = '20:59:00'\n elsif ashraeClimateZone == '4C'\n starttime_summer = '17:01:00'\n endtime_summer = '20:59:00'\n starttime_winter1 = '17:01:00'\n endtime_winter1 = '20:59:00'\n starttime_winter2 = '17:01:00'\n endtime_winter2 = '20:59:00'\n elsif ashraeClimateZone == '5A'\n starttime_summer = '20:01:00'\n endtime_summer = '23:59:00'\n starttime_winter1 = '17:01:00'\n endtime_winter1 = '20:59:00'\n starttime_winter2 = '17:01:00'\n endtime_winter2 = '20:59:00'\n elsif ashraeClimateZone == '5B'\n starttime_summer = '17:01:00'\n endtime_summer = '20:59:00'\n starttime_winter1 = '17:01:00'\n endtime_winter1 = '20:59:00'\n starttime_winter2 = '17:01:00'\n endtime_winter2 = '20:59:00'\n elsif ashraeClimateZone == '5C'\n starttime_summer = '17:01:00'\n endtime_summer = '20:59:00'\n starttime_winter1 = '17:01:00'\n endtime_winter1 = '20:59:00'\n starttime_winter2 = '17:01:00'\n endtime_winter2 = '20:59:00'\n elsif ashraeClimateZone == '6A'\n starttime_summer = '16:01:00'\n endtime_summer = '19:59:00'\n starttime_winter1 = '18:01:00'\n endtime_winter1 = '21:59:00'\n starttime_winter2 = '18:01:00'\n endtime_winter2 = '21:59:00'\n elsif ashraeClimateZone == '6B'\n starttime_summer = '17:01:00'\n endtime_summer = '20:59:00'\n starttime_winter1 = '17:01:00'\n endtime_winter1 = '20:59:00'\n starttime_winter2 = '17:01:00'\n endtime_winter2 = '20:59:00'\n elsif ashraeClimateZone == '7A'\n starttime_summer = '16:01:00'\n endtime_summer = '19:59:00'\n starttime_winter1 = '18:01:00'\n endtime_winter1 = '21:59:00'\n starttime_winter2 = '18:01:00'\n endtime_winter2 = '21:59:00'\n end\n end\n end \n\n # check the lighting power reduction percentages and for reasonableness\n if occupied_space_type > 100\n runner.registerError('Please Enter a Value less than or equal to 100 for the Electric Equipment Power Reduction Percentage.')\n return false\n elsif occupied_space_type == 0\n runner.registerInfo('No Electric Equipment power adjustment requested, but some life cycle costs may still be affected.')\n elsif (occupied_space_type < 1) && (occupied_space_type > -1)\n runner.registerWarning(\"A Electric Equipment Power Reduction Percentage of #{occupied_space_type} percent is abnormally low.\")\n elsif occupied_space_type > 90\n runner.registerWarning(\"A Electric Equipment Power Reduction Percentage of #{occupied_space_type} percent is abnormally high.\")\n elsif occupied_space_type < 0\n runner.registerInfo('The requested value for Electric Equipment power reduction percentage was negative. This will result in an increase in Electric Equipment power.')\n end\n\n # check the equipment_power_reduction_percent and for reasonableness\n if unoccupied_space_type > 100\n runner.registerError('Please Enter a Value less than or equal to 100 for the Electric Equipment Power Reduction Percentage.')\n return false\n elsif unoccupied_space_type == 0\n runner.registerInfo('No Electric Equipment power adjustment requested, but some life cycle costs may still be affected.')\n elsif (unoccupied_space_type < 1) && (unoccupied_space_type > -1)\n runner.registerWarning(\"A Electric Equipment Power Reduction Percentage of #{unoccupied_space_type} percent is abnormally low.\")\n elsif unoccupied_space_type > 90\n runner.registerWarning(\"A Electric Equipment Power Reduction Percentage of #{unoccupied_space_type} percent is abnormally high.\")\n elsif unoccupied_space_type < 0\n runner.registerInfo('The requested value for Electric Equipment power reduction percentage was negative. This will result in an increase in Electric Equipment power.')\n end\n\n # check the equipment_power_reduction_percent and for reasonableness\n if single_space_type > 100\n runner.registerError('Please Enter a Value less than or equal to 100 for the Electric Equipment Power Reduction Percentage.')\n return false\n elsif single_space_type == 0\n runner.registerInfo('No Electric Equipment power adjustment requested, but some life cycle costs may still be affected.')\n elsif (single_space_type < 1) && (single_space_type > -1)\n runner.registerWarning(\"A Electric Equipment Power Reduction Percentage of #{single_space_type} percent is abnormally low.\")\n elsif single_space_type > 90\n runner.registerWarning(\"A Electric Equipment Power Reduction Percentage of #{single_space_type} percent is abnormally high.\")\n elsif single_space_type < 0\n runner.registerInfo('The requested value for Electric Equipment power reduction percentage was negative. This will result in an increase in Electric Equipment power.')\n end\n\n # check the time periods for reasonableness\n if (starttime_winter1.to_f > endtime_winter1.to_f) && (starttime_winter2.to_f > endtime_winter2.to_f) && (starttime_summer.to_f > endtime_summer.to_f)\n runner.registerError('The end time should be larger than the start time.')\n return false\n end\n\n # check the space_type for reasonableness\n space_type = nil\n if object.empty?\n handle = runner.getStringArgumentValue('space_type', user_arguments)\n if handle.empty?\n runner.registerError('No space type was chosen.')\n else\n runner.registerError(\"The selected space type with handle '#{handle}' was not found in the model. It may have been removed by another measure.\")\n end\n return false\n else\n if !object.get.to_SpaceType.empty?\n space_type = object.get.to_SpaceType.get\n elsif !object.get.to_Building.empty?\n apply_to_building = true\n else\n runner.registerError('Script Error - argument not showing up as space type or building.')\n return false\n end\n end\n\n\n ############################################\n\n # assign the time duration when DR strategy is applied, from shift_time1 to shift_time2, only applied when apply_to_time is ture\n shift_time1 = OpenStudio::Time.new(starttime_winter1)\n shift_time2 = OpenStudio::Time.new(endtime_winter1)\n shift_time3 = OpenStudio::Time.new(0, 24, 0, 0)\n shift_time4 = OpenStudio::Time.new(starttime_summer)\n shift_time5 = OpenStudio::Time.new(endtime_summer)\n shift_time6 = OpenStudio::Time.new(starttime_winter2)\n shift_time7 = OpenStudio::Time.new(endtime_winter2)\n \n \n # get space types in model\n if apply_to_building\n space_types = model.getSpaceTypes\n else\n space_types = []\n space_types << space_type # only run on a single space type\n end\n\n # make a hash of old defs and new equipments and luminaire defs\n cloned_equi_defs = {}\n # loop through space types\n space_types.each do |space_type|\n\n equi_set_schs = {}\n if apply_to_building # measure will be applied differently to space types, based on whether the space type is occupied\n if !space_type.people.empty?\n equipment_power_reduction_percent = 1 - (occupied_space_type/100)\n else\n equipment_power_reduction_percent = 1 - (unoccupied_space_type/100)\n end\n runner.registerInitialCondition(\"Equipment power will be reduced by #{occupied_space_type}% in occupied spaces, and reduced by #{unoccupied_space_type}% in unoccupied spaces\")\n\n else\n equipment_power_reduction_percent = 1 - (single_space_type/100) # measure will be applied evenly to all zones\n runner.registerInitialCondition(\"Equipment power will be reduced by #{single_space_type}% to '#{space_type.name}'.\")\n end\n\n space_type_equipments = space_type.electricEquipment\n space_type_equipments.each do |space_type_equipment|\n #clone of not already in hash\n equi_set_sch = space_type_equipment.schedule\n if !equi_set_sch.empty?\n # clone of not already in hash\n if equi_set_schs.key?(equi_set_sch.get.name.to_s)\n new_equi_set_sch = equi_set_schs[equi_set_sch.get.name.to_s]\n else\n new_equi_set_sch = equi_set_sch.get.clone(model)\n new_equi_set_sch = new_equi_set_sch.to_Schedule.get\n new_equi_set_sch_name = new_equi_set_sch.setName(\"#{new_equi_set_sch.name} adjusted #{equipment_power_reduction_percent}\")\n # add to the hash\n equi_set_schs[new_equi_set_sch.name.to_s] = new_equi_set_sch\n end\n # hook up clone to equipment\n \n if space_type_equipment.name.to_s != \"OfficeLarge Data Center Elec Equip\" && space_type_equipment.name.to_s != \"OfficeLarge Main Data Center Elec Equip\"\n space_type_equipment.setSchedule(new_equi_set_sch)\n runner.registerInfo(\"#{space_type_equipment.name} has a new electric equipment schedule\")\n end\n else\n runner.registerWarning(\"#{space_type.equipments.name} doesn't have a schedule.\")\n end\n end\n \n if apply_to_time\n runner.registerFinalCondition(\" equipment power is reduced from #{shift_time1} to #{shift_time2}.\")\n runner.registerFinalCondition(\" equipment power is reduced from #{shift_time4} to #{shift_time5} during special between month #{summer_start_month} and #{summer_end_month}\")\n else\n runner.registerFinalCondition(\" equipment power is reduced all day.\")\n end\n\n \n # make equipment schedule adjustments and rename.\n equi_set_schs.each do |k, v| # old name and new object for schedule\n if !v.to_ScheduleRuleset.empty?\n\n schedule = v.to_ScheduleRuleset.get\n default_rule = schedule.defaultDaySchedule\n rules = schedule.scheduleRules\n\n days_covered = Array.new(7, false)\n\n if rules.length > 0\n rules.each do |rule|\n summerStartMonth = OpenStudio::MonthOfYear.new(summer_start_month)\n summerEndMonth = OpenStudio::MonthOfYear.new(summer_end_month)\n summerStartDate = OpenStudio::Date.new(summerStartMonth, 1)\n summerEndDate = OpenStudio::Date.new(summerEndMonth, 30)\n \n summer_rule = rule.clone(model).to_ScheduleRule.get\n summer_rule.setStartDate(summerStartDate)\n summer_rule.setEndDate(summerEndDate)\n\n allDaysCovered(summer_rule, days_covered)\n\n cloned_day_summer = rule.daySchedule.clone(model)\n cloned_day_summer.setParent(summer_rule)\n\n summer_day = summer_rule.daySchedule\n day_time_vector = summer_day.times\n day_value_vector = summer_day.values\n summer_day.clearValues\n \n summer_day = createDaySchedule(summer_day, day_time_vector, day_value_vector, shift_time4, shift_time5, equipment_power_reduction_percent)\n \n ##############################################\n winterStartMonth1 = OpenStudio::MonthOfYear.new(winter_start_month1)\n winterEndMonth1 = OpenStudio::MonthOfYear.new(winter_end_month1)\n winterStartDate1 = OpenStudio::Date.new(winterStartMonth1, 1)\n winterEndDate1 = OpenStudio::Date.new(winterEndMonth1, 31)\n \n winter_rule1 = rule #rule.clone(model).to_ScheduleRule.get\n winter_rule1.setStartDate(winterStartDate1)\n winter_rule1.setEndDate(winterEndDate1)\n\n\n cloned_day_winter = rule.daySchedule.clone(model)\n cloned_day_winter.setParent(winter_rule1)\n\n winter_day1 = winter_rule1.daySchedule\n day_time_vector = winter_day1.times\n day_value_vector = winter_day1.values\n winter_day1.clearValues\n \n winter_day1 = createDaySchedule(winter_day1, day_time_vector, day_value_vector, shift_time6, shift_time7, equipment_power_reduction_percent)\n if shift_time1 != shift_time6 \n winter_day1 = createDaySchedule(winter_day1, day_time_vector, day_value_vector, shift_time1, shift_time2, equipment_power_reduction_percent)\n end\n ###################################################\n winterStartMonth2 = OpenStudio::MonthOfYear.new(winter_start_month2)\n winterEndMonth2 = OpenStudio::MonthOfYear.new(winter_end_month2)\n winterStartDate2 = OpenStudio::Date.new(winterStartMonth2, 1)\n winterEndDate2 = OpenStudio::Date.new(winterEndMonth2, 31)\n \n winter_rule2 = winter_rule1.clone(model).to_ScheduleRule.get\n winter_rule2.setStartDate(winterStartDate2)\n winter_rule2.setEndDate(winterEndDate2)\n \n cloned_day_winter2 = winter_day1.clone(model)\n cloned_day_winter2.setParent(winter_rule2)\n end\n end\n #runner.registerInfo(\"BEFORE #{days_covered}\")\n if days_covered.include?(false)\n summerStartMonth = OpenStudio::MonthOfYear.new(summer_start_month)\n summerEndMonth = OpenStudio::MonthOfYear.new(summer_end_month)\n summerStartDate = OpenStudio::Date.new(summerStartMonth, 1)\n summerEndDate = OpenStudio::Date.new(summerEndMonth, 30)\n \n summer_rule = OpenStudio::Model::ScheduleRule.new(schedule)\n summer_rule.setStartDate(summerStartDate)\n summer_rule.setEndDate(summerEndDate)\n coverSomeDays(summer_rule, days_covered)\n allDaysCovered(summer_rule, days_covered)\n\n cloned_day_summer = default_rule.clone(model)\n cloned_day_summer.setParent(summer_rule)\n\n summer_day = summer_rule.daySchedule\n day_time_vector = summer_day.times\n day_value_vector = summer_day.values\n summer_day.clearValues\n \n summer_day = createDaySchedule(summer_day, day_time_vector, day_value_vector, shift_time4, shift_time5, equipment_power_reduction_percent)\n \n ##############################################\n winterStartMonth1 = OpenStudio::MonthOfYear.new(winter_start_month1)\n winterEndMonth1 = OpenStudio::MonthOfYear.new(winter_end_month1)\n winterStartDate1 = OpenStudio::Date.new(winterStartMonth1, 1)\n winterEndDate1 = OpenStudio::Date.new(winterEndMonth1, 31)\n \n winter_rule1 = summer_rule.clone(model).to_ScheduleRule.get #OpenStudio::Model::ScheduleRule.new(schedule)\n winter_rule1.setStartDate(winterStartDate1)\n winter_rule1.setEndDate(winterEndDate1)\n\n #coverSomeDays(winter_rule1, days_covered)\n #allDaysCovered(summer_rule, days_covered)\n\n cloned_day_winter = default_rule.clone(model)\n cloned_day_winter.setParent(winter_rule1)\n\n winter_day1 = winter_rule1.daySchedule\n day_time_vector = winter_day1.times\n day_value_vector = winter_day1.values\n winter_day1.clearValues\n \n\n\n winter_day1 = createDaySchedule(winter_day1, day_time_vector, day_value_vector, shift_time6, shift_time7, equipment_power_reduction_percent)\n if shift_time1 != shift_time6 \n winter_day1 = createDaySchedule(winter_day1, day_time_vector, day_value_vector, shift_time1, shift_time2, equipment_power_reduction_percent)\n end\n ###################################################\n winterStartMonth2 = OpenStudio::MonthOfYear.new(winter_start_month2)\n winterEndMonth2 = OpenStudio::MonthOfYear.new(winter_end_month2)\n winterStartDate2 = OpenStudio::Date.new(winterStartMonth2, 1)\n winterEndDate2 = OpenStudio::Date.new(winterEndMonth2, 31)\n \n winter_rule2 = winter_rule1.clone(model).to_ScheduleRule.get #OpenStudio::Model::ScheduleRule.new(schedule)\n winter_rule2.setStartDate(winterStartDate2)\n winter_rule2.setEndDate(winterEndDate2)\n \n cloned_day_winter2 = winter_day1.clone(model)\n cloned_day_winter2.setParent(winter_rule2)\n end\n #runner.registerInfo(\"AFTER Summer #{days_covered}\")\n else\n runner.registerWarning(\"Schedule '#{k}' isn't a ScheduleRuleset object and won't be altered by this measure.\")\n v.remove # remove un-used clone\n end\n end\n\n end\n return true\n end",
"def run(model, runner, user_arguments)\n super(model, runner, user_arguments)\n\n #use the built-in error checking\n if not runner.validateUserArguments(arguments(model), user_arguments)\n return false\n end\n\n #assume the occ sensors will last the full analysis\n expected_life = 25\n \n #assign the user inputs to variables\n space_type_object = runner.getOptionalWorkspaceObjectChoiceValue(\"space_type\",user_arguments,model)\n percent_runtime_reduction = runner.getDoubleArgumentValue(\"percent_runtime_reduction\",user_arguments)\n material_and_installation_cost_per_space = runner.getDoubleArgumentValue(\"material_and_installation_cost_per_space\",user_arguments)\n\n #check the space_type for reasonableness and see if measure should run on space type or on the entire building\n apply_to_building = false\n space_type = nil\n if space_type_object.empty?\n handle = runner.getStringArgumentValue(\"space_type\",user_arguments)\n if handle.empty?\n runner.registerError(\"No space type was chosen.\")\n else\n runner.registerError(\"The selected space type with handle '#{handle}' was not found in the model. It may have been removed by another measure.\")\n end\n return false\n else\n if not space_type_object.get.to_SpaceType.empty?\n space_type = space_type_object.get.to_SpaceType.get\n elsif not space_type_object.get.to_Building.empty?\n apply_to_building = true\n else\n runner.registerError(\"Script Error - argument not showing up as space type or building.\")\n return false\n end\n end\n \n #check arguments for reasonableness\n if percent_runtime_reduction >= 100\n runner.registerError(\"Percent runtime reduction must be less than 100.\")\n return false\n end\n\n #find all the original schedules (before occ sensors installed)\n original_lts_schedules = []\n if apply_to_building #apply to the whole building\n \n model.getLightss.each do |light_fixture|\n if light_fixture.schedule.is_initialized\n original_lts_schedules << light_fixture.schedule.get\n end\n end\n else #apply to the a specific space type\n #do the lights assigned to the space type itself\n space_type.lights.each do |light_fixture|\n if light_fixture.schedule.is_initialized\n original_lts_schedules << light_fixture.schedule.get\n end\n end\n #do the lights in each space of the selected space type\n space_type.spaces.each do |space|\n space.lights.each do |light_fixture|\n if light_fixture.schedule.is_initialized\n original_lts_schedules << light_fixture.schedule.get\n end\n end \n end\n end\n \n #make copies of all the original lights schedules, reduced to include occ sensor impact\n original_schs_new_schs = {}\n original_lts_schedules.uniq.each do |orig_sch|\n #TODO skip non-schedule-ruleset schedules\n \n #copy the original schedule\n new_sch = orig_sch.clone.to_ScheduleRuleset.get\n #reduce each value in each profile (except the design days) by the specified amount\n runner.registerInfo(\"Reducing values in '#{orig_sch.name}' schedule by #{percent_runtime_reduction}% to represent occ sensor installation.\")\n day_profiles = []\n day_profiles << new_sch.defaultDaySchedule\n new_sch.scheduleRules.each do |rule|\n day_profiles << rule.daySchedule\n end\n multiplier = (100 - percent_runtime_reduction)/100\n day_profiles.each do |day_profile|\n #runner.registerInfo(\"#{day_profile.name}\")\n times_vals = day_profile.times.zip(day_profile.values)\n #runner.registerInfo(\"original time/values = #{times_vals}\")\n times_vals.each do |time,val|\n day_profile.addValue(time, val * multiplier)\n end\n #runner.registerInfo(\"new time/values = #{day_profile.times.zip(day_profile.values)}\")\n end \n #log the relationship between the old sch and the new, reduced sch\n original_schs_new_schs[orig_sch] = new_sch\n #runner.registerInfo(\"***\")\n end\n \n #replace the old schedules with the new schedules\n spaces_sensors_added_to = []\n if apply_to_building #apply to the whole building\n runner.registerInfo(\"Adding occupancy sensors to whole building\")\n model.getLightss.each do |light_fixture|\n next if light_fixture.schedule.empty?\n lights_sch = light_fixture.schedule.get\n new_sch = original_schs_new_schs[lights_sch]\n if new_sch\n runner.registerInfo(\"Added occupancy sensor for '#{light_fixture.name}'\")\n light_fixture.setSchedule(new_sch)\n spaces_sensors_added_to << light_fixture.space\n end\n end\n else #apply to the a specific space type\n #do the lights assigned to the space type itself\n runner.registerInfo(\"Adding occupancy sensors to space type '#{space_type.name}'\")\n space_type.lights.each do |light_fixture|\n next if light_fixture.schedule.empty?\n lights_sch = light_fixture.schedule.get\n new_sch = original_schs_new_schs[lights_sch]\n if new_sch\n runner.registerInfo(\"Added occupancy sensor for '#{light_fixture.name}'\")\n light_fixture.setSchedule(new_sch)\n spaces_sensors_added_to << light_fixture.space\n end\n end\n #do the lights in each space of the selected space type\n space_type.spaces.each do |space|\n runner.registerInfo(\"Adding occupancy sensors to space '#{space.name}\")\n space.lights.each do |light_fixture|\n next if light_fixture.schedule.empty?\n lights_sch = light_fixture.schedule.get\n new_sch = original_schs_new_schs[lights_sch]\n if new_sch\n runner.registerInfo(\"Added occupancy sensor for '#{light_fixture.name}'\")\n light_fixture.setSchedule(new_sch)\n spaces_sensors_added_to << light_fixture.space\n end\n end \n end\n end \n \n #report if the measure is not applicable\n num_sensors_added = spaces_sensors_added_to.uniq.size\n if spaces_sensors_added_to.size == 0\n runner.registerAsNotApplicable(\"This measure is not applicable because there were no lights in the specified areas of the building.\")\n return true\n end\n \n #report initial condition\n runner.registerInitialCondition(\"The building has several areas where occupancy sensors could be used to reduce lighting energy by turning off the lights while no occupants are present.\") \n \n #add cost of adding occ sensors\n if material_and_installation_cost_per_space != 0\n cost = OpenStudio::Model::LifeCycleCost.createLifeCycleCost(\"Add #{material_and_installation_cost_per_space} Occ Sensors to the Building\", model.getBuilding, material_and_installation_cost_per_space * num_sensors_added, \"CostPerEach\", \"Construction\", expected_life, 0)\n if cost.empty?\n runner.registerError(\"Failed to add costs.\")\n end\n end \n \n #report final condition\n if apply_to_building\n runner.registerFinalCondition(\"Add occupancy sensors to #{num_sensors_added} spaces in the building. The total cost to perform this is $#{material_and_installation_cost_per_space.round} per space, for a total cost of $#{(material_and_installation_cost_per_space * num_sensors_added).round}\")\n else\n runner.registerFinalCondition(\"Add occupancy sensors to #{num_sensors_added} #{space_type.name} spaces in the building. The total cost to perform this is $#{material_and_installation_cost_per_space.round} per space, for a total cost of $#{(material_and_installation_cost_per_space * num_sensors_added).round}\")\n end\n \n return true\n \n end",
"def run(model, runner, user_arguments)\r\n super(model, runner, user_arguments)\r\n\r\n #use the built-in error checking \r\n if not runner.validateUserArguments(arguments(model), user_arguments)\r\n return false\r\n end\r\n run_measure = runner.getIntegerArgumentValue(\"run_measure\",user_arguments)\r\n if run_measure == 0\r\n runner.registerAsNotApplicable(\"Run Measure set to #{run_measure}.\")\r\n return true \r\n end\r\n \r\n require 'json'\r\n \r\n results = {}\r\n dx_name = []\r\n #get all DX coils in model\r\n dx_single = model.getCoilCoolingDXSingleSpeeds \r\n dx_two = model.getCoilCoolingDXTwoSpeeds\r\n dx_heat = model.getCoilHeatingDXSingleSpeeds\r\n \r\n if !dx_single.empty?\r\n dx_single.each do |dx|\r\n runner.registerInfo(\"DX coil: #{dx.name.get} Initial COP: #{dx.ratedCOP.get}\")\r\n dx.setRatedCOP(OpenStudio::OptionalDouble.new(6.0))\r\n runner.registerInfo(\"DX coil: #{dx.name.get} Final COP: #{dx.ratedCOP.get}\")\r\n dx_name << dx.name.get\r\n end\r\n end\r\n if !dx_two.empty?\r\n dx_two.each do |dx|\r\n runner.registerInfo(\"DX coil: #{dx.name.get} Initial High COP: #{dx.ratedHighSpeedCOP.get} Low COP: #{dx.ratedLowSpeedCOP.get}\")\r\n dx.setRatedHighSpeedCOP(6.0)\r\n dx.setRatedLowSpeedCOP(6.0)\r\n runner.registerInfo(\"DX coil: #{dx.name.get} Final High COP: #{dx.ratedHighSpeedCOP.get} Final COP: #{dx.ratedLowSpeedCOP.get}\")\r\n dx_name << dx.name.get\r\n end\r\n end\r\n if !dx_heat.empty?\r\n dx_heat.each do |dx|\r\n runner.registerInfo(\"DX coil: #{dx.name.get} Initial COP: #{dx.ratedCOP}\")\r\n dx.setRatedCOP(6.0)\r\n runner.registerInfo(\"DX coil: #{dx.name.get} Final COP: #{dx.ratedCOP}\")\r\n dx_name << dx.name.get\r\n end\r\n end\r\n \r\n if dx_name.empty?\r\n runner.registerWarning(\"No DX coils are appropriate for this measure\")\r\n runner.registerAsNotApplicable(\"No DX coils are appropriate for this measure\")\r\n end\r\n \r\n #unique initial conditions based on\r\n runner.registerInitialCondition(\"The building has #{dx_name.size} DX coils for which this measure is applicable.\")\r\n\r\n #reporting final condition of model\r\n runner.registerFinalCondition(\"The COP of the following coils was increased to 6: #{dx_name}\")\r\n return true\r\n\r\n end",
"def around_perform_stats(*args)\n start = Time.now\n yield\n time_taken = Time.now - start\n statsd.timing(\"duration:#{self}\", time_taken)\n statsd.increment(\"total_successful:#{self}\")\n statsd.increment(\"total_successful\")\n run_hooks(:duration, :duration, args) {|key| statsd.timing(key, time_taken)}\n end",
"def defMeasurement(name,&block)\n mp = {:mp => name, :fields => []}\n @fields = []\n # call the block with ourserlves to process its 'defMetric' statements\n block.call(self) if block\n @fields.each { |f| mp[:fields] << f }\n define_measurement_point(mp)\n end",
"def measure(heading)\n start_time = Time.now\n print heading\n result = yield\n end_time = Time.now - start_time\n puts \" (#{end_time} s)\"\n result\nend",
"def measure() @measure ||= (nb_weight == 0.0 ? 0.0 : sum_weight / nb_weight) end",
"def update\n if @clock1_measure.nil?\n discipline_freq\n else\n elapsed = @clock1.time - @clock1_measure.local_time\n discipline_freq if elapsed > @frequency_discipline_interval\n end\n if @clock2_measure.nil?\n discipline_phase\n else\n elapsed = @clock2.time - @clock2_measure.local_time\n discipline_phase if elapsed > @phase_discipline_interval\n end\n end",
"def record_measure(label)\n $logger.debug(\n tms = Benchmark.measure(label) do\n yield\n end.format(\"%n: %10.6rreal %10.6u user %10.6y sys\")\n )\nend",
"def run_examination\n true\n end",
"def benchmark!\n @benchmark = true\n end",
"def run(model, runner, user_arguments)\n super(model, runner, user_arguments)\n\n # use the built-in error checking\n if !runner.validateUserArguments(arguments(model), user_arguments)\n return false\n end\n\n # Return N/A if not selected to run\n run_measure = runner.getIntegerArgumentValue(\"run_measure\",user_arguments)\n if run_measure == 0\n runner.registerAsNotApplicable(\"Run Measure set to #{run_measure}.\")\n return true \n end \n \n\n pct_red = runner.getDoubleArgumentValue(\"pct_red\",user_arguments)\n start_hr = runner.getDoubleArgumentValue(\"start_hr\",user_arguments)\n end_hr = runner.getDoubleArgumentValue(\"end_hr\",user_arguments)\n \n\n\n #check the fraction for reasonableness\n if not 0 <= pct_red and pct_red <= 100\n runner.registerError(\"Percent reduction value needs to be between 0 and 100.\")\n return false\n end\n\n #check start_hr for reasonableness and round to 15 minutes\n start_red_hr = nil\n start_red_min = nil\n if not 0 <= start_hr and start_hr <= 24\n runner.registerError(\"Time in hours needs to be between or equal to 0 and 24\")\n return false\n else\n rounded_start_hr = ((start_hr*4).round)/4.0\n if not start_hr == rounded_start_hr\n runner.registerInfo(\"Start time rounded to nearest 15 minutes: #{rounded_start_hr}\")\n end\n start_red_hr = rounded_start_hr.truncate\n start_red_min = (rounded_start_hr - start_red_hr)*60\n start_red_min = start_red_min.to_i\n end\n\n #check end_hr for reasonableness and round to 15 minutes\n end_red_hr = nil\n end_red_min = nil \n if not 0 <= end_hr and end_hr <= 24\n runner.registerError(\"Time in hours needs to be between or equal to 0 and 24.\")\n return false\n elsif end_hr > end_hr\n runner.registerError(\"Please enter an end time later in the day than end time.\")\n return false\n else\n rounded_end_hr = ((end_hr*4).round)/4.0\n if not end_hr == rounded_end_hr\n runner.registerInfo(\"End time rounded to nearest 15 minutes: #{rounded_end_hr}\")\n end\n end_red_hr = rounded_end_hr.truncate\n end_red_min = (rounded_end_hr - end_red_hr)*60\n end_red_min = end_red_min.to_i\n end\n\n # Translate the percent reduction into a multiplier\n red_mult = pct_red/100\n\n # Get schedules from all lights.\n original_lights_schs = []\n model.getLightss.each do |lights|\n if lights.schedule.is_initialized\n lights_sch = lights.schedule.get\n original_lights_schs << lights_sch\n end\n end\n\n # loop through the unique list of lights schedules, cloning\n # and reducing schedule fraction during the specified time range.\n original_lights_schs_new_schs = {}\n original_lights_schs.uniq.each do |lights_sch|\n if lights_sch.to_ScheduleRuleset.is_initialized\n new_lights_sch = lights_sch.clone(model).to_ScheduleRuleset.get\n new_lights_sch.setName(\"#{lights_sch.name} with Solar Cogeneration and Daylighting\")\n original_lights_schs_new_schs[lights_sch] = new_lights_sch\n new_lights_sch = new_lights_sch.to_ScheduleRuleset.get\n \n # method to adjust the values in a day schedule by a \n # specified percentage during a range of hours.\n def reduce_schedule(day_sch, red_mult, start_red_hr, start_red_min, end_red_hr, end_red_min)\n start_time = OpenStudio::Time.new(0, start_red_hr, start_red_min, 0)\n end_time = OpenStudio::Time.new(0, end_red_hr, end_red_min, 0)\n\n # Get the original values at the desired start and end times\n # and put points into the schedule at those times.\n day_sch.addValue(start_time, day_sch.getValue(start_time))\n day_sch.addValue(end_time, day_sch.getValue(end_time))\n \n # Store the original time/values then clear the schedule\n times = day_sch.times\n values = day_sch.values\n day_sch.clearValues\n\n # Modify the time/values and add back to the schedule\n for i in 0..(values.length - 1)\n if times[i] > start_time and times[i] <= end_time # Inside range\n day_sch.addValue(times[i], values[i] * red_mult)\n else\n day_sch.addValue(times[i], values[i])\n end\n end\n\n end #end reduce schedule\n\n # Reduce default day schedule\n if new_lights_sch.scheduleRules.size == 0\n runner.registerWarning(\"Schedule '#{new_lights_sch.name}' applies to all days. It has been treated as a Weekday schedule.\")\n end\n reduce_schedule(new_lights_sch.defaultDaySchedule, red_mult, start_red_hr, start_red_min, end_red_hr, end_red_min)\n \n # Reduce all other schedule rules\n new_lights_sch.scheduleRules.each do |sch_rule|\n reduce_schedule(sch_rule.daySchedule, red_mult, start_red_hr, start_red_min, end_red_hr, end_red_min)\n end\n \n end \n end #end of original_lights_schs.uniq.each do\n\n #loop through all lights instances, replacing old lights schedules with the reduced schedules\n model.getLightss.each do |lights|\n if lights.schedule.empty?\n runner.registerWarning(\"There was no schedule assigned for the lights object named '#{lights.name}. No schedule was added.'\")\n else\n old_lights_sch = lights.schedule.get\n lights.setSchedule(original_lights_schs_new_schs[old_lights_sch])\n runner.registerInfo(\"Schedule for the lights object named '#{lights.name}' was reduced to simulate the application of Solar Cogeneration and Daylighting.\")\n end\n end\n\n # NA if the model has no lights\n if model.getLightss.size == 0\n runner.registerNotAsApplicable(\"Not Applicable - There are no lights in the model.\")\n end\n\n # Reporting final condition of model\n runner.registerFinalCondition(\"#{original_lights_schs.uniq.size} schedule(s) were edited to reflect the addition of Solar Cogeneration and Daylighting to the building.\")\n \n return true\n\n end",
"def run(model, runner, user_arguments)\n super(model, runner, user_arguments)\n\n # use the built-in error checking\n if !runner.validateUserArguments(arguments(model), user_arguments)\n return false\n end\n \n # Return N/A if not selected to run\n run_measure = runner.getIntegerArgumentValue(\"run_measure\",user_arguments)\n if run_measure == 0\n runner.registerAsNotApplicable(\"Run Measure set to #{run_measure}.\")\n return true \n end\n\n\t#initialize variables\n\ttz_count = 0\n\tclg_tstat_schedule = []\n\tthermal_zone_array = []\n\t\t\n\t# get the thermal zones and loop through them \n\tmodel.getThermalZones.each do |thermal_zone|\n\t\n\t\tthermal_zone_array << thermal_zone\n\t\t\n\t\t# test to see if thermal zone has a thermostat object assigned or is unconditioned. \n\t\tif thermal_zone.thermostatSetpointDualSetpoint.is_initialized\n\t\t\tzone_thermostat = thermal_zone.thermostatSetpointDualSetpoint.get\n\t\t\ttz_count += 1\n\t\t\t\n\t\t\tif zone_thermostat.coolingSetpointTemperatureSchedule.is_initialized\n\t\t\t\tclg_tstat_schedule = zone_thermostat.coolingSetpointTemperatureSchedule.get\n\t\t\t\t\n\t\t\t\t# clone the existing cooling T-stat schedule in case it is used somewhere else in the model\n\t\t\t\tcloned_clg_tstat_schedule = clg_tstat_schedule.clone\n\t\t\t\t@new_clg_tstat_schedule_name = (\"#{clg_tstat_schedule.name}+1.5F\")\n\t\t\t\n\t\t\t\tif cloned_clg_tstat_schedule.to_ScheduleRuleset.is_initialized\n\t\t\t\t\tschedule = cloned_clg_tstat_schedule.to_ScheduleRuleset.get\n\t\t\t\t\t# gather profiles of cloned schedule\n\t\t\t\t\tprofiles = []\n\t\t\t\t\tcooling_thermostat_array = []\n\t\t\t\t\tdefaultProfile = schedule.to_ScheduleRuleset.get.defaultDaySchedule\n\t\t\t\t\n\t\t\t\t\tprofiles << defaultProfile\n\t\t\t\t\trules = schedule.scheduleRules\n\t\t\t\t\n\t\t\t\t\trules.each do |rule|\n\t\t\t\t\t\tprofiles << rule.daySchedule\n\t\t\t\t\tend # end the do loop through the rulesetsdo\n\n\t\t\t\t\t#adjust profiles of temperature schedule of cloned schedule by + 1.5 deg F delta (0.833 C)\n\t\t\t\t\tprofiles.each do |profile|\n\t\t\t\t\t\ttime = profile.times\n\t\t\t\t\t\ti = 0\n\t\t\t\t\t\t#TODO - name new profile\n\t\t\t\t\t\tprofile.values.each do |value|\n\t\t\t\t\t\t\tdelta = 0.8333\n\t\t\t\t\t\t\tnew_value = value + delta # Note this is where the cooling setpoint is raised\n\t\t\t\t\t\t\tprofile.addValue(time[i], new_value)\n\t\t\t\t\t\t\ti += 1\n\t\t\t\t\t\t\tcloned_clg_tstat_schedule.setName(@new_clg_tstat_schedule_name)\n\t\t\t\t\t\t\tcooling_thermostat_array << cloned_clg_tstat_schedule\n\t\t\t\t\t\tend # end loop through each profile values\n\t\t\t\t\tend # end loop through each profile\n\t\t\t\t\t\n\t\t\t\t\tzone_thermostat.setCoolingSetpointTemperatureSchedule(cloned_clg_tstat_schedule.to_ScheduleRuleset.get)\n\t\t\t\t\trunner.registerInfo(\"The existing cooling thermostat '#{clg_tstat_schedule.name}' has been changed to #{cloned_clg_tstat_schedule.name}. Inspect the new schedule values using the OS App.\")\n\t\t\t\tend # end if statement for cloning and modifying cooling tstat schedule object\n\t\t\telse\n\t\t\t\trunner.registerInfo(\"The dual setpoint thermostat object named #{zone_thermostat.name} serving thermal zone #{thermal_zone.name} did not have a cooling setpoint temperature schedule associated with it. The measure will not alter this thermostat object\")\n\t\t\tend # end if statement for cooling Setpoint Temperature is initialized\n\t\t\t\n\t\t\tif zone_thermostat.heatingSetpointTemperatureSchedule.is_initialized\n\t\t\t\thtg_tstat_schedule = zone_thermostat.heatingSetpointTemperatureSchedule.get\n\t\t\t\t\t\t\n\t\t\t\t# clone the existing heating T-stat schedule in case it is used somewhere else\n\t\t\t\tcloned_htg_tstat_schedule = htg_tstat_schedule.clone\n\t\t\t\t\n\t\t\t\t#name cloned heating t-stat schedule\n\t\t\t\tcloned_htg_tstat_schedule.setName(\"#{htg_tstat_schedule.name}-1.5F\")\n\n\t\t\t\tif cloned_htg_tstat_schedule.to_ScheduleRuleset.is_initialized\n\t\t\t\t\tschedule = cloned_htg_tstat_schedule.to_ScheduleRuleset.get\n\t\t\t\t\n\t\t\t\t\t# gather profiles of cloned schedule\n\t\t\t\t\tprofiles_h = []\n\t\t\t\t\tdefaultProfile = schedule.to_ScheduleRuleset.get.defaultDaySchedule\n\t\t\t\t\t\n\t\t\t\t\tprofiles_h << defaultProfile\n\t\t\t\t\trules_h = schedule.scheduleRules\n\t\t\t\t\trules_h.each do |rule_h|\n\t\t\t\t\t\tprofiles_h << rule_h.daySchedule\n\t\t\t\t\tend # end the rule_h do\n\n\t\t\t\t\t#adjust profiles_h of temperature schedule of cloned schedule by + 1.5 deg F delta (0.833 C)\n\t\t\t\t\tprofiles_h.each do |profile_h|\n\t\t\t\t\t\ttime_h = profile_h.times\n\t\t\t\t\t\ti = 0\n\t\t\t\t\t\t#TODO - name new profile\n\t\t\t\t\t\tprofile_h.values.each do |value_h|\n\t\t\t\t\t\t\tdelta_h = 0.8333\n\t\t\t\t\t\t\tnew_value_h = value_h - delta_h # Note this is where the heating setpoint is lowered \n\t\t\t\t\t\t\tprofile_h.addValue(time_h[i], new_value_h)\n\t\t\t\t\t\t\ti += 1\n\t\t\t\t\t\tend # end loop through each profile values\n\t\t\t\t\tend # end loop through each profile_h\n\t\t\t\t\t\n\t\t\t\t\tzone_thermostat.setHeatingSetpointTemperatureSchedule(cloned_htg_tstat_schedule.to_ScheduleRuleset.get)\n\t\t\t\t\trunner.registerInfo(\"The existing heating thermostat '#{htg_tstat_schedule.name}' has been changed to #{cloned_htg_tstat_schedule.name}. Inspect the new schedule values using the OS App.\")\n\t\t\t\tend # end if statement for cloning and modifying heating tstat schedule object\t\n\t\t\telse\n\t\t\t\trunner.registerInfo(\"The dual setpoint thermostat object named #{zone_thermostat.name} serving thermal zone #{thermal_zone.name} did not have a heating setpoint temperature schedule associated with it. The measure will not alter this thermostat object\")\n\t\t\tend # end if statement for heating Setpoint Temperature is initialized\n\t\tend\t# end if statement for zone_thermstat cooling schedule\n\t\t\n\tend # end loop through thermal zones\t\t\t\n\t\t\t\n\t# Add ASHRAE 55 Comfort Warnings are applied to people objects\n\t# get people objects and people definitions in model\n\tpeople_defs = model.getPeopleDefinitions\n\tpeople_instances = model.getPeoples\n\n\t# loop through people objects\n\tpeople_def_counter = 0\n\tpeople_defs.sort.each do |people_def|\n\t next if not people_def.instances.size > 0\n\t people_def_counter += 1\n\t people_def.setEnableASHRAE55ComfortWarnings(true)\n\tend\n\t\t\t\n\treporting_frequency = \"Timestep\"\n\toutputVariable = OpenStudio::Model::OutputVariable.new(\"Zone Thermal Comfort ASHRAE 55 Adaptive Model 90% Acceptability Status []\",model)\n\toutputVariable.setReportingFrequency(reporting_frequency)\n\trunner.registerInfo(\"Adding output variable for 'Zone Thermal Comfort ASHRAE 55 Adaptive Model 90% Acceptability Status' reporting '#{reporting_frequency}'\")\n\n\t# write As Not Applicable message\n\tif tz_count == 0\n\t\trunner.registerAsNotApplicable(\"Measure is not applicable. There are no conditioned thermal zones in the model.\")\n\t\treturn true\n\tend\n\n\t# report initial condition of model\n\trunner.registerInitialCondition(\"The initial model contained #{tz_count} thermal zones with #{thermal_zone_array.length} 'Cooling Thermostat Schedule' and #{thermal_zone_array.length} 'Heating Thermostat Schedule' objects for which this measure is applicable.\")\n\n\t# report final condition of model\n\trunner.registerFinalCondition(\"The #{thermal_zone_array.length} Heating and #{thermal_zone_array.length} Cooling Thermostats schedules for #{thermal_zone_array.length} Thermal Zones were altered to reflect a additional deadband width of 3 Deg F . \")\n\treturn true\n\n end",
"def stat(*args)\n @recorder.call(*args) if @recorder\n end",
"def measure (n=1)\n cnt=0\nelapsed_time=Time.now\n\nn.times {\n cnt+=1\n yield} \nelapsed_time=(Time.now-elapsed_time)/cnt\n\nend",
"def run() end",
"def running_test_step; end",
"def stat() end",
"def measure(msg)\n start = Time.now\n yield\n printf \"%<msg>s in %<elapsed>.2f seconds\\n\", msg: msg, elapsed: Time.now - start\nend",
"def measure(msg)\n start = Time.now\n yield\n printf \"%<msg>s in %<elapsed>.2f seconds\\n\", msg: msg, elapsed: Time.now - start\nend",
"def run(model, runner, user_arguments)\n super(model, runner, user_arguments)\n\n # use the built-in error checking\n if !runner.validateUserArguments(arguments(model), user_arguments)\n return false\n end\n\n # Return N/A if not selected to run\n run_measure = runner.getIntegerArgumentValue(\"run_measure\",user_arguments)\n if run_measure == 0\n runner.registerAsNotApplicable(\"Run Measure set to #{run_measure}.\")\n return true \n end \n \n #initialize variables\n zone_hvac_count = 0\n pump_count = 0\n air_loop_count = 0\n \n #loop through each air loop in the model\n model.getAirLoopHVACs.sort.each do |air_loop|\n\n # call the method to generate a new occupancy schedule based on a 5% threshold\n occ_sch = air_loop.get_occupancy_schedule(0.15)\n old_sch = air_loop.availabilitySchedule\n next unless compare_eflh(runner, old_sch, occ_sch)\n # set the availability schedule of the airloop to the newly generated schedule\n air_loop.setAvailabilitySchedule(occ_sch)\n runner.registerInfo(\"The availability schedule named #{old_sch.name} for #{air_loop.name} was replaced with a new schedule named #{occ_sch.name} which tracks the occupancy profile of the thermal zones on this airloop.\")\n air_loop_count +=1\n \n end\n\n #loop through each thermal zone\n model.getThermalZones.sort.each do |thermal_zone|\n \n # zone equipments assigned to thermal zones\n thermal_zone_equipment = thermal_zone.equipment \n \n if thermal_zone_equipment.size >= 1\n # run schedule method to create a new schedule ruleset, routines \n occ_sch = thermal_zone.get_occupancy_schedule(0.15)\n \n #loop through Zone HVAC Equipment\n thermal_zone_equipment.each do |equip|\n \n # getting the fan exhaust object & getting relevant information for it. \n if equip.to_FanZoneExhaust.is_initialized\n zone_equip = equip.to_FanZoneExhaust.get\n old_schedule = zone_equip.availabilitySchedule.get\n next unless compare_eflh(runner, old_schedule, occ_sch)\n #assign the 'occ_sch' here as exhaust's availability schedule\n zone_equip.setAvailabilitySchedule(occ_sch)\n runner.registerInfo(\"The availability schedule named #{old_schedule.name} for the OS_Fan_ZoneExhaust named #{zone_equip.name} was replaced with a new schedule named #{occ_sch.name} representing the occupancy profile of the thermal zone named #{thermal_zone.name}.\")\n zone_hvac_count += 1 \t\n elsif equip.to_RefrigerationAirChiller.is_initialized\n zone_equip = equip.to_RefrigerationAirChiller.get\n zone_hvac_count += 1 if set_equip_availability_schedule(runner, thermal_zone, occ_sch, zone_equip)\n elsif equip.to_WaterHeaterHeatPump.is_initialized\n zone_equip = equip.to_WaterHeaterHeatPump.get\n zone_hvac_count += 1 if set_equip_availability_schedule(runner, thermal_zone, occ_sch, zone_equip)\n elsif equip.to_ZoneHVACBaseboardConvectiveElectric.is_initialized\n zone_equip = equip.to_ZoneHVACBaseboardConvectiveElectric.get\n zone_hvac_count += 1 if set_equip_availability_schedule(runner, thermal_zone, occ_sch, zone_equip)\n elsif equip.to_ZoneHVACBaseboardConvectiveWater.is_initialized\n zone_equip = equip.to_ZoneHVACBaseboardConvectiveWater.get\n zone_hvac_count += 1 if set_equip_availability_schedule(runner, thermal_zone, occ_sch, zone_equip)\n elsif equip.to_ZoneHVACBaseboardRadiantConvectiveElectric.is_initialized\n zone_equip = equip.to_ZoneHVACBaseboardRadiantConvectiveElectric.get\n zone_hvac_count += 1 if set_equip_availability_schedule(runner, thermal_zone, occ_sch, zone_equip)\n elsif equip.to_ZoneHVACBaseboardRadiantConvectiveWater.is_initialized\n zone_equip = equip.to_ZoneHVACBaseboardRadiantConvectiveWater.get\n zone_hvac_count += 1 if set_equip_availability_schedule(runner, thermal_zone, occ_sch, zone_equip)\n elsif equip.to_ZoneHVACDehumidifierDX.is_initialized\n zone_equip = equip.to_ZoneHVACDehumidifierDX.get\n zone_hvac_count += 1 if set_equip_availability_schedule(runner, thermal_zone, occ_sch, zone_equip)\n elsif equip.to_ZoneHVACEnergyRecoveryVentilator.is_initialized\n zone_equip = equip.to_ZoneHVACEnergyRecoveryVentilator.get\n zone_hvac_count += 1 if set_equip_availability_schedule(runner, thermal_zone, occ_sch, zone_equip)\t\t\t\t\n elsif equip.to_ZoneHVACFourPipeFanCoil.is_initialized\n zone_equip = equip.to_ZoneHVACFourPipeFanCoil.get\n zone_hvac_count += 1 if set_equip_availability_schedule(runner, thermal_zone, occ_sch, zone_equip)\t\t\t\t\t\n elsif equip.to_ZoneHVACHighTemperatureRadiant.is_initialized\n zone_equip = equip.to_ZoneHVACHighTemperatureRadiant.get\n zone_hvac_count += 1 if set_equip_availability_schedule(runner, thermal_zone, occ_sch, zone_equip)\t\t\t\t\n elsif equip.to_ZoneHVACIdealLoadsAirSystem.is_initialized\n zone_equip = equip.to_ZoneHVACIdealLoadsAirSystem.get\n zone_hvac_count += 1 if set_equip_availability_schedule(runner, thermal_zone, occ_sch, zone_equip)\t\t\t\t \n elsif equip.to_ZoneHVACLowTemperatureRadiantElectric.is_initialized\n zone_equip = equip.to_ZoneHVACLowTemperatureRadiantElectric.get\n zone_hvac_count += 1 if set_equip_availability_schedule(runner, thermal_zone, occ_sch, zone_equip)\t\t\t\t\t\n elsif equip.to_ZoneHVACLowTempRadiantConstFlow.is_initialized\n zone_equip = equip.to_ZoneHVACLowTempRadiantConstFlow.get\n zone_hvac_count += 1 if set_equip_availability_schedule(runner, thermal_zone, occ_sch, zone_equip)\t\t\t\t\t \t\n elsif equip.to_ZoneHVACLowTempRadiantVarFlow.is_initialized\n zone_equip = equip.to_ZoneHVACLowTempRadiantVarFlow.get\n zone_hvac_count += 1 if set_equip_availability_schedule(runner, thermal_zone, occ_sch, zone_equip)\t\t\t\t\t\n elsif equip.to_ZoneHVACPackagedTerminalAirConditioner.is_initialized\n zone_equip = equip.to_ZoneHVACPackagedTerminalAirConditioner.get\n zone_hvac_count += 1 if set_equip_availability_schedule(runner, thermal_zone, occ_sch, zone_equip)\n elsif equip.to_ZoneHVACPackagedTerminalHeatPump.is_initialized\n zone_equip = equip.to_ZoneHVACPackagedTerminalHeatPump.get\n zone_hvac_count += 1 if set_equip_availability_schedule(runner, thermal_zone, occ_sch, zone_equip)\n elsif equip.to_ZoneHVACTerminalUnitVariableRefrigerantFlow.is_initialized\n next unless compare_eflh(runner, old_schedule, occ_sch) \n equip.to_ZoneHVACTerminalUnitVariableRefrigerantFlow.get.setTerminalUnitAvailabilityschedule(occ_sch)\n runner.registerInfo(\"The availability schedule for the Zone HVAC Terminal Unit Variable Refrigerant Flow Object has been replaced with a new schedule named #{occ_sch.name} representing the occupancy profile of the thermal zone named #{thermal_zone.name}.\")\t\t\t\t\t\n zone_hvac_count += 1 \n elsif equip.to_ZoneHVACUnitHeater.is_initialized\n zone_equip = equip.to_ZoneHVACUnitHeater.get\n zone_hvac_count += 1 if set_equip_availability_schedule(runner, thermal_zone, occ_sch, zone_equip)\t\t\t\n elsif equip.to_ZoneHVACUnitVentilator.is_initialized\n zone_equip = equip.to_ZoneHVACUnitVentilator.get\n zone_hvac_count += 1 if set_equip_availability_schedule(runner, thermal_zone, occ_sch, zone_equip)\t\t\t\t\t\n elsif equip.to_ZoneVentilationDesignFlowRate.is_initialized\n runner.registerInfo(\"Thermal Zone named #{thermal_zone.name} has a Zone Ventilation Design Flow Rate object attacjhed as a ZoneHVACEquipment object. No modification were made to this object.\")\t\t\n end \t\n \n end # end loop through Zone HVAC Equipment\n \n else\n runner.registerInfo(\"Thermal Zone named #{thermal_zone.name} has no Zone HVAC Equipment objects attached - therefore no schedule objects have been altered.\")\t\n end # end of if statement\n \n end # end loop through thermal zones\n\n # Change pump control status if any airloops or\n # zone equipment were changed.\n if air_loop_count > 0 || zone_hvac_count > 0\n model.getPlantLoops.each do |plantLoop|\n #Loop through each plant loop demand component\n plantLoop.demandComponents.each do |dc|\n if dc.to_PumpConstantSpeed.is_initialized\n cs_pump = dc.to_PumpConstantSpeed.get\n if cs_pump.pumpControlType == (\"Intermittent\")\n runner.registerInfo(\"Demand side Constant Speed Pump object named #{cs_pump.name} on the plant loop named #{dc.name} had a pump control type attribute already set to intermittent. No changes will be made to this object.\")\n else \n cs_pump.setPumpControlType(\"Intermittent\")\n runner.registerInfo(\"Pump Control Type attribute of Demand side Constant Speed Pump object named #{cs_pump.name} on the plant loop named #{dc.name} was changed from continuous to intermittent.\")\n pump_count +=1\n end\n end\n \n if dc.to_PumpVariableSpeed.is_initialized\n vs_pump = dc.to_PumpVariableSpeed.get\n if vs_pump.pumpControlType == (\"Intermittent\")\n runner.registerInfo(\"Demand side Variable Speed Pump named #{vs_pump.name} on the plant loop named #{dc.name} had a pump control type attribute already set to intermittent. No changes will be made to this object.\")\n else \n cs_pump.setPumpControlType(\"Intermittent\")\n runner.registerInfo(\"Demand side Pump Control Type attribute of Variable Speed Pump named #{vs_pump.name} on the plant loop named #{dc.name} was changed from continuous to intermittent.\")\n pump_count +=1\n end\n end\n end\n \n #Loop through each plant loop supply component\n plantLoop.supplyComponents.each do |sc|\n if sc.to_PumpConstantSpeed.is_initialized\n cs_pump = sc.to_PumpConstantSpeed.get\n if cs_pump.pumpControlType == (\"Intermittent\")\n runner.registerInfo(\"Supply side Constant Speed Pump object named #{cs_pump.name} on the plant loop named #{sc.name} had a pump control type attribute already set to intermittent. No changes will be made to this object.\")\n else \n cs_pump.setPumpControlType(\"Intermittent\")\n runner.registerInfo(\"Supply Side Pump Control Type atteribute of Constant Speed Pump named #{cs_pump.name} on the plant loop named #{sc.name} was changed from continuous to intermittent.\")\n pump_count +=1\n end #end if statement\t\n end #end if statement for changing supply component constant speed pump objects\n \n if sc.to_PumpVariableSpeed.is_initialized\n vs_pump = sc.to_PumpVariableSpeed.get\n if vs_pump.pumpControlType == (\"Intermittent\")\n runner.registerInfo(\"Supply side Variable Speed Pump object named #{vs_pump.name} on the plant loop named #{sc.name} had a pump control type attribute already set to intermittent. No changes will be made to this object.\")\n else \n cs_pump.setPumpControlType(\"Intermittent\")\n runner.registerInfo(\"Pump Control Type attribute of Supply Side Variable Speed Pump named #{vs_pump.name} on the plant loop named #{sc.name} was changed from continuous to intermittent.\")\n pump_count +=1\n end #end if statement\t\n end #end if statement for changing supply component variable speed pump objects\n \n end # end loop throught plant loop supply side components\n \n end # end loop through plant loops\n end\n \n #Write N/A message\n if air_loop_count == 0 && zone_hvac_count == 0 && pump_count == 0 \n runner.registerAsNotApplicable(\"The model did not contain any Airloops, Thermal Zones having ZoneHVACEquipment objects or associated plant loop pump objects to act upon. The measure is not applicable.\")\n return true\n end\t\n \n #report initial condition of model\n runner.registerInitialCondition(\"The model started with #{air_loop_count} AirLoops, #{zone_hvac_count} Zone HVAC Equipment Object and #{pump_count} pump objects subject to modifications.\")\n \n # report final condition of model\n runner.registerFinalCondition(\"The measure modified the availability schedules of #{air_loop_count} AirLoops and #{zone_hvac_count} Zone HVAC Equipment objects. #{pump_count} pump objects had control settings modified.\")\n \n # Add ASHRAE Standard 55 warnings\n reporting_frequency = \"Timestep\"\n outputVariable = OpenStudio::Model::OutputVariable.new(\"Zone Thermal Comfort ASHRAE 55 Adaptive Model 90% Acceptability Status []\",model)\n outputVariable.setReportingFrequency(reporting_frequency)\n runner.registerInfo(\"Adding output variable for 'Zone Thermal Comfort ASHRAE 55 Adaptive Model 90% Acceptability Status' reporting at the model timestep.\")\n \n return true\n\t\n end",
"def calc_next_run\n nil\n end",
"def calc_next_run\n nil\n end",
"def estimate\n # (native code) \n end",
"def running_test_case; end",
"def run; end",
"def run; end",
"def run; end",
"def run; end",
"def run; end",
"def run; end",
"def run; end",
"def run; end",
"def run; end",
"def tick; end",
"def tick; end",
"def tick; end",
"def run(model, runner, user_arguments)\n super(model, runner, user_arguments)\n\n # use the built-in error checking\n if !runner.validateUserArguments(arguments(model), user_arguments)\n return false\n end\n\n # assign the user inputs to variables\n verbose_info_statements = runner.getBoolArgumentValue(\"verbose_info_statements\",user_arguments)\n fixed_window_subsurface = runner.getOptionalWorkspaceObjectChoiceValue('fixed_window_subsurface', user_arguments, model) # model is passed in because of argument type\n internal_variable_availability_dictionary_reporting = runner.getStringArgumentValue('internal_variable_availability_dictionary_reporting', user_arguments)\n ems_runtime_language_debug_output_level = runner.getStringArgumentValue('ems_runtime_language_debug_output_level', user_arguments) \n actuator_availability_dictionary_reporting = runner.getStringArgumentValue('actuator_availability_dictionary_reporting', user_arguments) \n \n runner.registerInitialCondition(\"Measure began with #{model.getEnergyManagementSystemSensors.count} EMS sensors, #{model.getEnergyManagementSystemActuators.count} EMS Actuators, #{model.getEnergyManagementSystemPrograms.count} EMS Programs, #{model.getEnergyManagementSystemSubroutines.count} EMS Subroutines, #{model.getEnergyManagementSystemProgramCallingManagers.count} EMS Program Calling Manager objects\")\n \n # declare arrys for scope\n array_of_21_sets = []\n material_property_glazing_spectral_data_vector = []\n standard_glazing_layer_array = []\n construction_array = []\n ems_window_construction_array = []\n \n # load idf into workspace\n workspace = OpenStudio::Workspace::load(OpenStudio::Path.new(\"#{File.dirname(__FILE__)}/resources/EMSThermochromicWindow.idf\")).get\n \n # get all MaterialPropertyGlazingSpectralData objects from within the idf\n # material_property_glazing_spectral_datas = source_idf.getObjectsByType(\"MaterialProperty:GlazingSpectralData\".to_IddObjectType)\n material_property_glazing_spectral_datas = workspace.getObjectsByType(\"MaterialProperty:GlazingSpectralData\".to_IddObjectType)\n if verbose_info_statements == true\n runner.registerInfo(\"The model has #{material_property_glazing_spectral_datas.size} material_property_glazing_spectral_datas objects.\")\n end\n \n material_property_glazing_spectral_datas.each do |material_property_glazing_spectral_data|\n \n spectral_data = {\"name\" => \"\",\"properties\" => []}\n spectral_data[\"name\"] = material_property_glazing_spectral_data.getString(0).to_s\n \n # Note: EnergyPlus file MaterialProperty:GlazingSpectralData objects have 1764 /4 = 441 sets of 4 values each \n n = material_property_glazing_spectral_data.numFields\n (1..n).each do |i| \n spectral_data[\"properties\"] << material_property_glazing_spectral_data.getString(i).to_s \n end\n array_of_21_sets << spectral_data\n end\n \n array_of_21_sets.each do |set|\n \n props = set[\"properties\"]\n material_property_glazing_spectral_data = OpenStudio::Model::MaterialPropertyGlazingSpectralData.new(model)\n material_property_glazing_spectral_data.setName(\"#{set[\"name\"]}\")\n \n k = (props.length / 4) - 1\n (0..k).each do |i| # note 440 uniques (a, b, c, d) pairs of attributes for each spectral data field object\n material_property_glazing_spectral_data.addSpectralDataField(props[(i*4)+0].to_f, props[(i*4)+1].to_f, props[(i*4)+2].to_f, props[(i*4)+3].to_f)\t\n end\n \n material_property_glazing_spectral_data_vector << material_property_glazing_spectral_data\n end \n \n # create (2) required new air gas materials to used by all EMS window constructions \n air_gas_3mm_material = OpenStudio::Model::Gas.new(model, \"Air\", 0.003) \n air_gas_3mm_material.setName(\"AIR 3MM\")\n \n air_gas_8mm_material = OpenStudio::Model::Gas.new(model, \"Air\", 0.008) \n air_gas_8mm_material.setName(\"AIR 8MM\")\n \n # loop through array of OS MaterialPropertyGlazingSpectralData objects and create 21 new Standard Glazing objects \n material_property_glazing_spectral_data_vector.each do |spec_data_obj|\n spec_data_obj_name = spec_data_obj.name\n layer_name = spec_data_obj_name.to_s.slice(\"sp\")\n if ((spec_data_obj_name == \"WO18RT25SP\") || (spec_data_obj_name == \"Clear3PPGSP\"))\n layer = OpenStudio::Model::StandardGlazing.new(model, 'Spectral', 0.0075)\n else\n layer = OpenStudio::Model::StandardGlazing.new(model, 'Spectral', 0.003276)\n end\n layer.setName(\"#{layer_name}\")\n layer.setWindowGlassSpectralDataSet(spec_data_obj)\n layer.setInfraredTransmittanceatNormalIncidence(0) # same for all 21 constructions\n layer.setFrontSideInfraredHemisphericalEmissivity(0.84) # same for all 21 constructions\n layer.setBackSideInfraredHemisphericalEmissivity(0.84) # same for all 21 constructions\n if ((spec_data_obj_name == \"WO18RT25SP\") || (spec_data_obj_name == \"Clear3PPGSP\"))\n layer.setConductivity(1.0) \n else\n layer.setConductivity(0.6) \n end\n layer.setDirtCorrectionFactorforSolarandVisibleTransmittance(1) # same for all 21 constructions\n layer.setSolarDiffusing(false)\n standard_glazing_layer_array << layer\n end\n\n # Create (2) unique standard glazing layers not used for Thermochromatic performance \n sb60_clear_3_ppg_layer = standard_glazing_layer_array[0]\n clear_3ppg_layer = standard_glazing_layer_array[1]\n remaining_standard_glazing_layer_array = standard_glazing_layer_array.drop(2)\n \n # create (19) new arrays of layered constructions representing thermochromatic layers\n remaining_standard_glazing_layer_array.each do |remaining_standard_glazing_layer|\n construction = [sb60_clear_3_ppg_layer, air_gas_3mm_material, remaining_standard_glazing_layer, air_gas_8mm_material, sb60_clear_3_ppg_layer]\n construction_array << construction\n end\n \n # create 19 new OS:Construction objects representing EMS thermochromatic windows\n name_index_array = [25, 27, 29, 31, 33, 35, 37, 39, 41, 43, 45, 50, 55, 60, 65, 70, 75, 80, 85]\n index = 0\n \n construction_array.each do |const|\n ems_window_construction = OpenStudio::Model::Construction.new(const)\n ems_window_construction.setName(\"TCwindow_#{name_index_array[index]}\")\n if verbose_info_statements == true\n runner.registerInfo(\"Created a new Construction named #{ems_window_construction.name} representing a thermochromatic window construction.\")\n end\n ems_window_construction_array << ems_window_construction\n index +=1\n end\n\n # check the user argument of the fixed window subsurface for reasonableness\n if fixed_window_subsurface.empty?\n handle = runner.getStringArgumentValue('fixed_window_subsurface', user_arguments)\n if handle.empty?\n runner.registerError('No fixed window subsurface was chosen.')\n else\n runner.registerError(\"The selected fixed window subsurface with handle '#{handle}' was not found in the model. It may have been removed by another measure.\")\n end\n return false\n else\n if !fixed_window_subsurface.get.to_SubSurface.empty?\n fixed_window_subsurface = fixed_window_subsurface.get.to_SubSurface.get\n else\n runner.registerError('Script Error - argument not showing up as construction.')\n return false\n end\n end\n \n # Create a new EnergyManagementSystem:Sensor object representing the Surface Outside Face temp of the EMS thermochromatic window subsurface\n ems_win_Tout_sensor = OpenStudio::Model::EnergyManagementSystemSensor.new(model, \"Surface Outside Face Temperature\")\n ems_win_Tout_sensor.setName(\"Win1_Tout\")\n ems_win_Tout_sensor.setKeyName(\"#{fixed_window_subsurface.name}\")\n if verbose_info_statements == true\n runner.registerInfo(\"An EMS Sensor object named '#{ems_win_Tout_sensor.name}' representing the Surface Outside Face temp of the EMS thermochromatic window subsurface was added to the model.\") \n end\n \n # Create a new EMS Actuator Object representing the construction state of the EMS generated thermochromatic window \n ems_win_construct_actuator = OpenStudio::Model::EnergyManagementSystemActuator.new(fixed_window_subsurface, \"Surface\", \"Construction State\")\n ems_win_construct_actuator.setName(\"Win1_Construct\")\n if verbose_info_statements == true\n runner.registerInfo(\"An EMS Actuator object named '#{ems_win_construct_actuator.name}' representing construction state of the EMS generated thermochromatic window was added to the model.\") \n end\n \n # Create 19 EnergyManagementSystem:ConstructionIndexVariable objects for each unique thermochromatic construction\n ems_window_construction_array.each do |ems_window_construction|\n ems_constr_index_var = OpenStudio::Model::EnergyManagementSystemConstructionIndexVariable.new(model, ems_window_construction ) \n ems_constr_index_var.setName(\"#{ems_window_construction.name}\")\n if verbose_info_statements == true\n runner.registerInfo(\"An EMS SystemConstructionIndexVariable object named '#{ems_constr_index_var.name}' representing the the EMS construction state of the thermochromatic window was added to the model.\") \n end\n end\n \n # Create new EnergyManagementSystem:Program object for assigning different window constructions by dynamically evaluating the exterior surface temp of the fixed window subsurface \n ems_apply_thermochromatic_constructions_prgm = OpenStudio::Model::EnergyManagementSystemProgram.new(model)\n ems_apply_thermochromatic_constructions_prgm.setName(\"#{fixed_window_subsurface.name}_Control\")\n ems_apply_thermochromatic_constructions_prgm.addLine(\"IF #{ems_win_Tout_sensor.name} <= 26.0\")\n ems_apply_thermochromatic_constructions_prgm.addLine(\"SET #{ems_win_construct_actuator.name} = TCwindow_25\")\n ems_apply_thermochromatic_constructions_prgm.addLine(\"ELSEIF #{ems_win_Tout_sensor.name} <= 28.0\")\n ems_apply_thermochromatic_constructions_prgm.addLine(\"SET #{ems_win_construct_actuator.name} = TCwindow_27\")\n ems_apply_thermochromatic_constructions_prgm.addLine(\"ELSEIF #{ems_win_Tout_sensor.name} <= 30.0\")\n ems_apply_thermochromatic_constructions_prgm.addLine(\"SET #{ems_win_construct_actuator.name} = TCwindow_29\")\n ems_apply_thermochromatic_constructions_prgm.addLine(\"ELSEIF #{ems_win_Tout_sensor.name} <= 32.0\")\n ems_apply_thermochromatic_constructions_prgm.addLine(\"SET #{ems_win_construct_actuator.name} = TCwindow_31\")\n ems_apply_thermochromatic_constructions_prgm.addLine(\"ELSEIF #{ems_win_Tout_sensor.name} <= 34.0\")\n ems_apply_thermochromatic_constructions_prgm.addLine(\"SET #{ems_win_construct_actuator.name} = TCwindow_33\")\n ems_apply_thermochromatic_constructions_prgm.addLine(\"ELSEIF #{ems_win_Tout_sensor.name} <= 36.0\")\n ems_apply_thermochromatic_constructions_prgm.addLine(\"SET #{ems_win_construct_actuator.name} = TCwindow_35\")\n ems_apply_thermochromatic_constructions_prgm.addLine(\"ELSEIF #{ems_win_Tout_sensor.name} <= 38.0\")\n ems_apply_thermochromatic_constructions_prgm.addLine(\"SET #{ems_win_construct_actuator.name} = TCwindow_37\")\n ems_apply_thermochromatic_constructions_prgm.addLine(\"ELSEIF #{ems_win_Tout_sensor.name} <= 40.0\")\n ems_apply_thermochromatic_constructions_prgm.addLine(\"SET #{ems_win_construct_actuator.name} = TCwindow_39\")\n ems_apply_thermochromatic_constructions_prgm.addLine(\"ELSEIF #{ems_win_Tout_sensor.name} <= 42.0\")\n ems_apply_thermochromatic_constructions_prgm.addLine(\"SET #{ems_win_construct_actuator.name} = TCwindow_41\")\n ems_apply_thermochromatic_constructions_prgm.addLine(\"ELSEIF #{ems_win_Tout_sensor.name} <= 44.0\")\n ems_apply_thermochromatic_constructions_prgm.addLine(\"SET #{ems_win_construct_actuator.name} = TCwindow_43\")\n ems_apply_thermochromatic_constructions_prgm.addLine(\"ELSEIF #{ems_win_Tout_sensor.name} <= 47.5\")\n ems_apply_thermochromatic_constructions_prgm.addLine(\"SET #{ems_win_construct_actuator.name} = TCwindow_45\")\n ems_apply_thermochromatic_constructions_prgm.addLine(\"ELSEIF #{ems_win_Tout_sensor.name} <= 52.5\")\n ems_apply_thermochromatic_constructions_prgm.addLine(\"SET #{ems_win_construct_actuator.name} = TCwindow_50\")\n ems_apply_thermochromatic_constructions_prgm.addLine(\"ELSEIF #{ems_win_Tout_sensor.name} <= 57.5\")\n ems_apply_thermochromatic_constructions_prgm.addLine(\"SET #{ems_win_construct_actuator.name} = TCwindow_55\")\n ems_apply_thermochromatic_constructions_prgm.addLine(\"ELSEIF #{ems_win_Tout_sensor.name} <= 62.5\")\n ems_apply_thermochromatic_constructions_prgm.addLine(\"SET #{ems_win_construct_actuator.name} = TCwindow_60\")\n ems_apply_thermochromatic_constructions_prgm.addLine(\"ELSEIF #{ems_win_Tout_sensor.name} <= 67.5\")\n ems_apply_thermochromatic_constructions_prgm.addLine(\"SET #{ems_win_construct_actuator.name} = TCwindow_65\")\n ems_apply_thermochromatic_constructions_prgm.addLine(\"ELSEIF #{ems_win_Tout_sensor.name} <= 72.5\")\n ems_apply_thermochromatic_constructions_prgm.addLine(\"SET #{ems_win_construct_actuator.name} = TCwindow_70\")\n ems_apply_thermochromatic_constructions_prgm.addLine(\"ELSEIF #{ems_win_Tout_sensor.name} <= 77.5\")\n ems_apply_thermochromatic_constructions_prgm.addLine(\"SET #{ems_win_construct_actuator.name} = TCwindow_75\")\n ems_apply_thermochromatic_constructions_prgm.addLine(\"ELSEIF #{ems_win_Tout_sensor.name} <= 82.5\")\n ems_apply_thermochromatic_constructions_prgm.addLine(\"SET #{ems_win_construct_actuator.name} = TCwindow_80\")\n ems_apply_thermochromatic_constructions_prgm.addLine(\"ELSE\")\n ems_apply_thermochromatic_constructions_prgm.addLine(\"SET #{ems_win_construct_actuator.name} = TCwindow_85\")\n ems_apply_thermochromatic_constructions_prgm.addLine(\"ENDIF\")\n if verbose_info_statements == true\n runner.registerInfo(\"An EMS Program Object named '#{ems_apply_thermochromatic_constructions_prgm.name}' for dynamically assigning different window constructions based on the exterior surface temp was added to the model.\") \n end\n \n # Create a new EnergyManagementSystem:ProgramCallingManager object configured to call the EMS programs\n ems_prgm_calling_mngr = OpenStudio::Model::EnergyManagementSystemProgramCallingManager.new(model)\n ems_prgm_calling_mngr.setName(\"My thermochromic window emulator\")\n ems_prgm_calling_mngr.setCallingPoint(\"BeginTimestepBeforePredictor\")\n ems_prgm_calling_mngr.addProgram(ems_apply_thermochromatic_constructions_prgm)\n if verbose_info_statements == true\n runner.registerInfo(\"EMS Program Calling Manager object named '#{ems_prgm_calling_mngr.name}' added to call EMS program for dynamically applying a thermochromatic window.\") \n end\n \n # create unique object for OutputEnergyManagementSystems and configure to allow EMS reporting\n outputEMS = model.getOutputEnergyManagementSystem\n outputEMS.setInternalVariableAvailabilityDictionaryReporting(\"internal_variable_availability_dictionary_reporting\")\n outputEMS.setEMSRuntimeLanguageDebugOutputLevel(\"ems_runtime_language_debug_output_level\")\n outputEMS.setActuatorAvailabilityDictionaryReporting(\"actuator_availability_dictionary_reporting\")\n if verbose_info_statements == true\n runner.registerInfo(\"EMS OutputEnergyManagementSystem object configured per user arguments.\") \n end\n \n runner.registerFinalCondition(\"Measure finished with #{model.getEnergyManagementSystemSensors.count} EMS sensors, #{model.getEnergyManagementSystemActuators.count} EMS Actuators, #{model.getEnergyManagementSystemPrograms.count} EMS Programs, #{model.getEnergyManagementSystemSubroutines.count} EMS Subroutines, #{model.getEnergyManagementSystemProgramCallingManagers.count} EMS Program Calling Manager objects\")\n\n end",
"def bench(action, msg = nil)\n @t ||= Time.now\n @total ||= 0\n @step ||= 0\n case action\n when :start\n @step = 0\n @total = 0\n @t = Time.now\n when :step\n @step += 1\n int = Time.now - @t\n @total += int\n @t = Time.now\n dbg(\"Benchmark #{msg.nil? ? (\"%02d\" % @step) : msg}: #{\"%8.3fms\" % (int * 1000)} (Total: #{\"%8.3fms\" % (@total * 1000)}).\")\n end\nend",
"def apply_measure_and_run(test_name, measure, argument_map, osm_path, epw_path, run_model: false)\n assert(File.exist?(osm_path))\n assert(File.exist?(epw_path))\n\n # create run directory if it does not exist\n if !File.exist?(run_dir(test_name))\n FileUtils.mkdir_p(run_dir(test_name))\n end\n assert(File.exist?(run_dir(test_name)))\n\n # change into run directory for tests\n start_dir = Dir.pwd\n Dir.chdir run_dir(test_name)\n\n # remove prior runs if they exist\n if File.exist?(model_output_path(test_name))\n FileUtils.rm(model_output_path(test_name))\n end\n if File.exist?(report_path(test_name))\n FileUtils.rm(report_path(test_name))\n end\n\n # copy the osm and epw to the test directory\n new_osm_path = \"#{run_dir(test_name)}/#{File.basename(osm_path)}\"\n FileUtils.cp(osm_path, new_osm_path)\n new_epw_path = \"#{run_dir(test_name)}/#{File.basename(epw_path)}\"\n FileUtils.cp(epw_path, new_epw_path)\n # create an instance of a runner\n runner = OpenStudio::Measure::OSRunner.new(OpenStudio::WorkflowJSON.new)\n\n # load the test model\n model = load_model(new_osm_path)\n\n # set model weather file\n epw_file = OpenStudio::EpwFile.new(OpenStudio::Path.new(new_epw_path))\n OpenStudio::Model::WeatherFile.setWeatherFile(model, epw_file)\n assert(model.weatherFile.is_initialized)\n\n # run the measure\n puts \"\\nAPPLYING MEASURE...\"\n measure.run(model, runner, argument_map)\n result = runner.result\n\n # show the output\n show_output(result)\n\n # save model\n model.save(model_output_path(test_name), true)\n\n errs = []\n if run_model && (result.value.valueName == 'Success')\n puts \"\\nRUNNING ANNUAL SIMULATION...\"\n\n std = Standard.build('NREL ZNE Ready 2017')\n std.model_run_simulation_and_log_errors(model, run_dir(test_name))\n\n # check that the model ran successfully and generated a report\n assert(File.exist?(model_output_path(test_name)))\n assert(File.exist?(sql_path(test_name)))\n assert(File.exist?(report_path(test_name)))\n\n # set runner variables\n runner.setLastEpwFilePath(epw_path)\n runner.setLastOpenStudioModelPath(OpenStudio::Path.new(model_output_path(test_name)))\n runner.setLastEnergyPlusSqlFilePath(OpenStudio::Path.new(sql_path(test_name)))\n sql = runner.lastEnergyPlusSqlFile.get\n model.setSqlFile(sql)\n\n # test for unmet hours\n unmet_heating_hrs = std.model_annual_occupied_unmet_heating_hours(model)\n unmet_cooling_hrs = std.model_annual_occupied_unmet_cooling_hours(model)\n unmet_hrs = std.model_annual_occupied_unmet_hours(model)\n max_unmet_hrs = 550\n if unmet_hrs\n if unmet_hrs > 550\n errs << \"For #{test_name} there were #{unmet_heating_hrs.round(1)} unmet occupied heating hours and #{unmet_cooling_hrs.round(1)} unmet occupied cooling hours (total: #{unmet_hrs.round(1)}), more than the limit of #{max_unmet_hrs}.\" if unmet_hrs > max_unmet_hrs\n else\n puts \"There were #{unmet_heating_hrs.round(1)} unmet occupied heating hours and #{unmet_cooling_hrs.round(1)} unmet occupied cooling hours (total: #{unmet_hrs.round(1)}).\"\n end\n else\n errs << \"For #{test_name} could not determine unmet hours; simulation may have failed.\"\n end\n end\n\n # change back directory\n Dir.chdir(start_dir)\n\n assert(errs.empty?, errs.join(\"\\n\"))\n\n return result\n end",
"def after_assumption(name); end",
"def call\n result = while_measuring_memory_usage { action.call }\n\n Measurement.from_result(result)\n end",
"def run(model, runner, user_arguments)\n super(model, runner, user_arguments)\n\n # use the built-in error checking\n if !runner.validateUserArguments(arguments(model), user_arguments)\n return false\n end\n\n # assign the user inputs to variables\n retrofit_month = runner.getStringArgumentValue('retrofit_month', user_arguments).to_i\n retrofit_day = runner.getStringArgumentValue('retrofit_day', user_arguments).to_i\n\n # report initial condition of model\n runner.registerInitialCondition(\"Measure started successfully.\")\n\n # TODO: check the month and day for reasonableness\n runner.registerInfo(\"User entered retrofit month: #{retrofit_month}\")\n runner.registerInfo(\"User entered retrofit day: #{retrofit_day}\")\n\n prog_calling_manager = OpenStudio::Model::EnergyManagementSystemProgramCallingManager.new(model)\n prog_calling_manager.setCallingPoint('BeginTimestepBeforePredictor')\n\n # Remove old and add new equip with EMS by spaces\n hash_space_epd = Hash.new\n v_spaces = model.getSpaces\n v_spaces.each do |space|\n current_space_equip = space.electricEquipment[0]\n unless current_space_equip.nil?\n\n # Get equipment power density for each space type\n new_space_epd = runner.getOptionalDoubleArgumentValue(\"new_#{space.name.to_s}_epd\", user_arguments)\n if new_space_epd.is_initialized\n hash_space_epd[\"new_#{space.name.to_s}_epd\"] = new_space_epd\n runner.registerInfo(\"User entered new electric equipment power density for #{space.name.to_s} is #{new_space_epd} W/m2\")\n # Set ems\n current_space_equip_def = current_space_equip.electricEquipmentDefinition\n equip_sch_name = current_space_equip.schedule.get.nameString\n equip_sch_ems_sensor = OpenStudio::Model::EnergyManagementSystemSensor.new(model, 'Schedule Value')\n equip_sch_ems_sensor.setKeyName(equip_sch_name)\n runner.registerInfo(\"Delete old equip object for #{space.name}\")\n current_space_equip.remove\n\n new_equip = add_equip_space(space, current_space_equip_def)\n equip_level_w = new_space_epd.to_f * space.floorArea.to_f\n ems_equip_program = add_equip_ems(model, new_equip, equip_level_w, equip_sch_ems_sensor, retrofit_month, retrofit_day)\n prog_calling_manager.addProgram(ems_equip_program)\n runner.registerInfo(\"Add ems equipment control for #{space.name} succeeded.\")\n else\n # Get equipment power ratio for each space type\n new_space_ratio = runner.getDoubleArgumentValue(\"new_#{space.name.to_s}_ratio\", user_arguments)\n\n old_equip_sch = current_space_equip.schedule.get\n ems_equip_program = add_equip_ems_w_occ_var(model, current_space_equip, old_equip_sch, new_space_ratio, retrofit_month, retrofit_day)\n prog_calling_manager.addProgram(ems_equip_program)\n runner.registerInfo(\"Add ems equipment control for #{space.name} succeeded.\")\n # runner.registerInfo(\"Delete old equip object for #{space.name}\")\n # current_space_equip.remove\n end\n\n end\n end\n\n # Remove old and add new equip with EMS by space types\n hash_space_type_epd = Hash.new\n v_space_types = model.getSpaceTypes\n v_space_types.each do |space_type|\n current_spaces = space_type.spaces\n current_space_type_equip = space_type.electricEquipment[0]\n unless current_space_type_equip.nil?\n # Get equipment power density for each space type\n current_space_type_epd = runner.getStringArgumentValue(\"new_#{space_type.name.to_s}_epd\", user_arguments)\n hash_space_type_epd[\"new_#{space_type.name.to_s}_epd\"] = current_space_type_epd\n runner.registerInfo(\"User entered new electric equipment power density for #{space_type.name.to_s} is #{current_space_type_epd} W/m2\")\n\n # Set ems\n current_space_type_equip_def = current_space_type_equip.electricEquipmentDefinition\n current_space_type_sch_set = space_type.defaultScheduleSet.get\n current_space_type_equip_sch_set = current_space_type_sch_set.electricEquipmentSchedule.get\n\n equip_sch_name = current_space_type_equip_sch_set.nameString\n equip_sch_ems_sensor = OpenStudio::Model::EnergyManagementSystemSensor.new(model, 'Schedule Value')\n equip_sch_ems_sensor.setKeyName(equip_sch_name)\n\n puts \"Delete old equip object for #{space_type.name}\"\n current_space_type_equip.remove\n\n current_spaces.each do |space|\n # Calculate equipemtn electric power for each space\n new_equip = add_equip_space_type(model, space, space_type, current_space_type_equip_def)\n equip_level_w = current_space_type_epd.to_f * space.floorArea.to_f\n ems_equip_program = add_equip_ems(model, new_equip, equip_level_w, equip_sch_ems_sensor, retrofit_month, retrofit_day)\n prog_calling_manager.addProgram(ems_equip_program)\n runner.registerInfo(\"Add ems equipment control for #{space.name} succeeded.\")\n end\n end\n end\n\n # echo the model updates back to the user\n runner.registerInfo(\"The electric equipment retrofit measure is applied.\")\n\n # report final condition of model\n runner.registerFinalCondition(\"Measure ended successfully.\")\n\n return true\n end",
"def run(model, runner, user_arguments)\n super(model, runner, user_arguments)\n\n # use the built-in error checking\n if !runner.validateUserArguments(arguments(model), user_arguments)\n return false\n end\n\n runner.registerInfo(\"Start to create lighting measure from occupant schedule\")\n\n ### Get user selected lighting space assumptions for each space\n v_space_types = model.getSpaceTypes\n i = 1\n lght_space_type_arg_vals = {}\n # Loop through all space types, group spaces by their types\n v_space_types.each do |space_type|\n # Loop through all spaces of current space type\n v_current_spaces = space_type.spaces\n next if not v_current_spaces.size > 0\n v_current_spaces.each do |current_space|\n lght_space_type_val = runner.getStringArgumentValue(@@v_space_args[current_space.nameString], user_arguments)\n lght_space_type_arg_vals[current_space.nameString] = lght_space_type_val\n i += 1\n end\n end\n\n puts lght_space_type_arg_vals\n\n ### Start creating new lighting schedules based on occupancy schedule\n occ_schedule_dir = runner.getStringArgumentValue('occ_schedule_dir', user_arguments)\n model_temp_run_path = Dir.pwd + '/'\n measure_root_path = File.dirname(__FILE__)\n\n puts '=' * 80\n puts measure_root_path\n\n if File.file?(occ_schedule_dir)\n # Check if user provided a occupancy schedule CSV file\n csv_file = occ_schedule_dir\n puts 'Use user provided occupancy schedule file at: ' + csv_file.to_s\n runner.registerInitialCondition('Location check:' + File.expand_path(\"../..\", measure_root_path))\n # runner.registerInitialCondition('Use user provided occupancy schedule file at: ' + csv_file.to_s)\n else\n # Check if schedule file at several places\n # 1. Default fils path when run with OSW in CLI\n csv_path_lookup_1 = File.expand_path(\"../..\", measure_root_path) + \"/files/#{@@default_occupant_schedule_filename}\"\n puts '#' * 80\n puts \"First lookup location: \" + csv_path_lookup_1\n runner.registerInfo(\"First lookup location: \" + csv_path_lookup_1)\n # 2. Default path when run with OpenStudio CLI\n csv_path_lookup_2 = File.expand_path(\"../..\", model_temp_run_path) + \"/files/#{@@default_occupant_schedule_filename}\"\n puts '#' * 80\n puts \"Second lookup location: \" + csv_path_lookup_2\n runner.registerInfo(\"Second lookup location: \" + csv_path_lookup_2)\n # 3. Default path when run with OpenStudio GUI\n csv_path_lookup_3 = File.expand_path(\"../../..\", model_temp_run_path) + \"/resources/files/#{@@default_occupant_schedule_filename}\"\n puts '#' * 80\n puts \"Third lookup location: \" + csv_path_lookup_3\n runner.registerInfo(\"Third lookup location: \" + csv_path_lookup_3)\n # 4. Generated files folder when run with rspec\n csv_path_lookup_4 = File.expand_path(\"..\", model_temp_run_path) + \"/generated_files/#{@@default_occupant_schedule_filename}\"\n puts '#' * 80\n puts \"Forth lookup location: \" + csv_path_lookup_4\n runner.registerInfo(\"Forth lookup location: \" + csv_path_lookup_4)\n # 5. Generated files folder with OpenStudio V2.9.0+\n csv_path_lookup_5 = File.join(File.expand_path(\"../..\", model_temp_run_path), 'generated_files', @@default_occupant_schedule_filename)\n puts '#' * 80\n puts \"Fifth lookup location: \" + csv_path_lookup_5\n runner.registerInfo(\"Fifth lookup location: \" + csv_path_lookup_5)\n\n if File.file?(csv_path_lookup_1)\n csv_file = csv_path_lookup_1\n elsif File.file?(csv_path_lookup_2)\n csv_file = csv_path_lookup_2\n elsif File.file?(csv_path_lookup_3)\n csv_file = csv_path_lookup_3\n elsif File.file?(csv_path_lookup_4)\n csv_file = csv_path_lookup_4 \n elsif File.file?(csv_path_lookup_5)\n csv_file = csv_path_lookup_5\n else\n csv_file = ''\n end\n puts 'Use default occupancy schedule file at: ' + csv_file.to_s\n runner.registerInfo('Use default occupancy schedule file at: ' + csv_file.to_s)\n end\n\n # Get the spaces with occupancy count schedule available\n v_spaces_occ_sch = File.readlines(csv_file)[3].split(',') # Room ID is saved in 4th row of the occ_sch file\n v_headers = Array.new\n v_spaces_occ_sch.each do |space_occ_sch|\n if !['Room ID', 'Outdoor', 'Outside building'].include? space_occ_sch and !space_occ_sch.strip.empty?\n v_headers << space_occ_sch\n end\n end\n v_headers = [\"Time\"] + v_headers\n\n # report initial condition of model\n runner.registerInfo(\"The building has #{v_headers.length - 1} spaces with available occupant schedule file.\")\n\n # Read the occupant count schedule file and clean it\n clean_csv = File.readlines(csv_file).drop(6).join\n csv_table_sch = CSV.parse(clean_csv, headers: true)\n new_csv_table = csv_table_sch.by_col!.delete_if do |column_name, column_values|\n !v_headers.include? column_name\n end\n\n runner.registerInfo(\"Successfully read occupant count schedule from CSV file.\")\n runner.registerInfo(\"Creating new lighting schedules...\")\n\n # Create lighting schedule based on the occupant count schedule\n v_cols = Array.new\n v_ts = new_csv_table.by_col!['Time']\n v_headers.each do |header|\n if header != 'Time'\n space_name = header\n v_occ_n = new_csv_table.by_col![space_name]\n v_light = create_lighting_sch_from_occupancy_count(space_name, v_ts, v_occ_n, @@off_delay)\n v_cols << v_light\n end\n end\n\n runner.registerInfo(\"Writing new lighting schedules to CSV file.\")\n # Write new lighting schedule file to CSV\n file_name_light_sch = \"#{model_temp_run_path}/#{@@lighting_schedule_CSV_name}\"\n vcols_to_csv(v_cols, file_name_light_sch)\n\n # Add new lighting schedule from the CSV file created\n runner.registerInfo(\"Removing old OS:Lights and OS:Lights:Definition for office and conference rooms.\")\n # Remove old lights definition objects for office and conference rooms\n v_space_types.each do |space_type|\n space_type.spaces.each do |space|\n selected_space_type = lght_space_type_arg_vals[space.name.to_s]\n if (@@office_type_names.include? selected_space_type) || (@@conference_room_type_names.include? selected_space_type)\n space_type.lights.each do |lght|\n puts 'Remove old lights definition object: ' + lght.lightsDefinition.name.to_s\n lght.lightsDefinition.remove\n end\n end\n end\n end\n\n # Remove old lights objects for office and conference rooms\n # Caution: the order of deletion matters\n v_space_types.each do |space_type|\n space_type.spaces.each do |space|\n selected_space_type = lght_space_type_arg_vals[space.name.to_s]\n if (@@office_type_names.include? selected_space_type) || (@@conference_room_type_names.include? selected_space_type)\n space_type.lights.each do |lght|\n puts 'Remove old lights object: ' + lght.name.to_s\n lght.remove\n end\n end\n end\n end\n\n puts '---> Create new lighting schedules from CSV.'\n\n runner.registerInfo(\"Adding new OS:Schedule:File objects to the model....\")\n v_spaces = model.getSpaces\n v_spaces.each do |space|\n v_headers.each_with_index do |s_space_name, i|\n if s_space_name == space.name.to_s\n col = i\n temp_file_path = file_name_light_sch\n sch_file_name = space.name.to_s + ' lght sch'\n schedule_file = get_os_schedule_from_csv(model, temp_file_path, sch_file_name, col, skip_row = 1)\n schedule_file.setMinutesperItem(@@minute_per_item.to_s)\n model = add_light(model, space, schedule_file)\n end\n end\n end\n\n # report final condition of model\n runner.registerFinalCondition(\"Finished creating and adding new lighting schedules for #{v_headers.length - 1} spaces.\")\n\n return true\n end",
"def span\n measure\n @span\n end",
"def run(model, runner, user_arguments)\n super(model, runner, user_arguments)\n \n #use the built-in error checking \n if not runner.validateUserArguments(arguments(model), user_arguments)\n return false\n end\n\n # System Type 2: PTHP, Residential\n # This measure creates:\n # a constant volume packaged terminal heat pump unit with DX heating \n # and cooling for each zone in the building\n \n always_on = model.alwaysOnDiscreteSchedule\n\n # Make a PTHP for each zone\n model.getThermalZones.each do |zone|\n \n fan = OpenStudio::Model::FanConstantVolume.new(model,always_on)\n fan.setPressureRise(300)\n\n supplemental_htg_coil = OpenStudio::Model::CoilHeatingElectric.new(model,always_on)\n\n clg_cap_f_of_temp = OpenStudio::Model::CurveBiquadratic.new(model)\n clg_cap_f_of_temp.setCoefficient1Constant(0.942587793)\n clg_cap_f_of_temp.setCoefficient2x(0.009543347)\n clg_cap_f_of_temp.setCoefficient3xPOW2(0.0018423)\n clg_cap_f_of_temp.setCoefficient4y(-0.011042676)\n clg_cap_f_of_temp.setCoefficient5yPOW2(0.000005249)\n clg_cap_f_of_temp.setCoefficient6xTIMESY(-0.000009720)\n clg_cap_f_of_temp.setMinimumValueofx(17.0)\n clg_cap_f_of_temp.setMaximumValueofx(22.0)\n clg_cap_f_of_temp.setMinimumValueofy(13.0)\n clg_cap_f_of_temp.setMaximumValueofy(46.0)\n\n clg_cap_f_of_flow = OpenStudio::Model::CurveQuadratic.new(model)\n clg_cap_f_of_flow.setCoefficient1Constant(0.718954)\n clg_cap_f_of_flow.setCoefficient2x(0.435436)\n clg_cap_f_of_flow.setCoefficient3xPOW2(-0.154193)\n clg_cap_f_of_flow.setMinimumValueofx(0.75)\n clg_cap_f_of_flow.setMaximumValueofx(1.25)\n\n clg_energy_input_ratio_f_of_temp = OpenStudio::Model::CurveBiquadratic.new(model)\n clg_energy_input_ratio_f_of_temp.setCoefficient1Constant(0.342414409)\n clg_energy_input_ratio_f_of_temp.setCoefficient2x(0.034885008)\n clg_energy_input_ratio_f_of_temp.setCoefficient3xPOW2(-0.000623700)\n clg_energy_input_ratio_f_of_temp.setCoefficient4y(0.004977216)\n clg_energy_input_ratio_f_of_temp.setCoefficient5yPOW2(0.000437951)\n clg_energy_input_ratio_f_of_temp.setCoefficient6xTIMESY(-0.000728028)\n clg_energy_input_ratio_f_of_temp.setMinimumValueofx(17.0)\n clg_energy_input_ratio_f_of_temp.setMaximumValueofx(22.0)\n clg_energy_input_ratio_f_of_temp.setMinimumValueofy(13.0)\n clg_energy_input_ratio_f_of_temp.setMaximumValueofy(46.0)\n\n clg_energy_input_ratio_f_of_flow = OpenStudio::Model::CurveQuadratic.new(model)\n clg_energy_input_ratio_f_of_flow.setCoefficient1Constant(1.1552)\n clg_energy_input_ratio_f_of_flow.setCoefficient2x(-0.1808)\n clg_energy_input_ratio_f_of_flow.setCoefficient3xPOW2(0.0256)\n clg_energy_input_ratio_f_of_flow.setMinimumValueofx(0.5)\n clg_energy_input_ratio_f_of_flow.setMaximumValueofx(1.5)\n\n clg_part_load_fraction = OpenStudio::Model::CurveQuadratic.new(model)\n clg_part_load_fraction.setCoefficient1Constant(0.75)\n clg_part_load_fraction.setCoefficient2x(0.25)\n clg_part_load_fraction.setCoefficient3xPOW2(0.0)\n clg_part_load_fraction.setMinimumValueofx(0.0)\n clg_part_load_fraction.setMaximumValueofx(1.0)\n\n clg_coil = OpenStudio::Model::CoilCoolingDXSingleSpeed.new(model,\n always_on,\n clg_cap_f_of_temp,\n clg_cap_f_of_flow,\n clg_energy_input_ratio_f_of_temp,\n clg_energy_input_ratio_f_of_flow,\n clg_part_load_fraction)\n\n htg_cap_f_of_temp = OpenStudio::Model::CurveCubic.new(model)\n htg_cap_f_of_temp.setCoefficient1Constant(0.758746)\n htg_cap_f_of_temp.setCoefficient2x(0.027626)\n htg_cap_f_of_temp.setCoefficient3xPOW2(0.000148716)\n htg_cap_f_of_temp.setCoefficient4xPOW3(0.0000034992)\n htg_cap_f_of_temp.setMinimumValueofx(-20.0)\n htg_cap_f_of_temp.setMaximumValueofx(20.0)\n\n htg_cap_f_of_flow = OpenStudio::Model::CurveCubic.new(model)\n htg_cap_f_of_flow.setCoefficient1Constant(0.84)\n htg_cap_f_of_flow.setCoefficient2x(0.16)\n htg_cap_f_of_flow.setCoefficient3xPOW2(0.0)\n htg_cap_f_of_flow.setCoefficient4xPOW3(0.0)\n htg_cap_f_of_flow.setMinimumValueofx(0.5)\n htg_cap_f_of_flow.setMaximumValueofx(1.5)\n\n htg_energy_input_ratio_f_of_temp = OpenStudio::Model::CurveCubic.new(model)\n htg_energy_input_ratio_f_of_temp.setCoefficient1Constant(1.19248)\n htg_energy_input_ratio_f_of_temp.setCoefficient2x(-0.0300438)\n htg_energy_input_ratio_f_of_temp.setCoefficient3xPOW2(0.00103745)\n htg_energy_input_ratio_f_of_temp.setCoefficient4xPOW3(-0.000023328)\n htg_energy_input_ratio_f_of_temp.setMinimumValueofx(-20.0)\n htg_energy_input_ratio_f_of_temp.setMaximumValueofx(20.0)\n\n htg_energy_input_ratio_f_of_flow = OpenStudio::Model::CurveQuadratic.new(model)\n htg_energy_input_ratio_f_of_flow.setCoefficient1Constant(1.3824)\n htg_energy_input_ratio_f_of_flow.setCoefficient2x(-0.4336)\n htg_energy_input_ratio_f_of_flow.setCoefficient3xPOW2(0.0512)\n htg_energy_input_ratio_f_of_flow.setMinimumValueofx(0.0)\n htg_energy_input_ratio_f_of_flow.setMaximumValueofx(1.0)\n\n htg_part_load_fraction = OpenStudio::Model::CurveQuadratic.new(model)\n htg_part_load_fraction.setCoefficient1Constant(0.75)\n htg_part_load_fraction.setCoefficient2x(0.25)\n htg_part_load_fraction.setCoefficient3xPOW2(0.0)\n htg_part_load_fraction.setMinimumValueofx(0.0)\n htg_part_load_fraction.setMaximumValueofx(1.0)\n\n htg_coil = OpenStudio::Model::CoilHeatingDXSingleSpeed.new( model,\n always_on,\n htg_cap_f_of_temp,\n htg_cap_f_of_flow,\n htg_energy_input_ratio_f_of_temp,\n htg_energy_input_ratio_f_of_flow,\n htg_part_load_fraction ) \n\n pthp = OpenStudio::Model::ZoneHVACPackagedTerminalHeatPump.new(model,\n always_on, \n fan,\n htg_coil,\n clg_coil,\n supplemental_htg_coil)\n\n pthp.setName(\"#{zone.name} PTHP\")\n pthp.addToThermalZone(zone)\n\n end\n\n \n return true\n \n end"
] | [
"0.79848707",
"0.7639643",
"0.7635365",
"0.7170765",
"0.6692624",
"0.6692624",
"0.66722536",
"0.6630833",
"0.6598638",
"0.65878135",
"0.6532798",
"0.6481993",
"0.64055425",
"0.640108",
"0.6332412",
"0.6283968",
"0.6283968",
"0.6283968",
"0.6279644",
"0.62679017",
"0.6242105",
"0.62202066",
"0.61980915",
"0.6195886",
"0.6195886",
"0.61309284",
"0.61059004",
"0.6070076",
"0.6051064",
"0.6016831",
"0.60080576",
"0.60080576",
"0.60006225",
"0.5976293",
"0.59637207",
"0.5962259",
"0.5957652",
"0.5956347",
"0.5956347",
"0.5944376",
"0.5933917",
"0.5927584",
"0.59206617",
"0.59156656",
"0.59121865",
"0.59120184",
"0.5902343",
"0.5870242",
"0.58659685",
"0.58648014",
"0.5846782",
"0.58384365",
"0.5837281",
"0.5787776",
"0.57736224",
"0.5768679",
"0.5755739",
"0.5744854",
"0.57406056",
"0.57249373",
"0.57172024",
"0.5714056",
"0.57001287",
"0.56982994",
"0.56961256",
"0.5687501",
"0.5687487",
"0.5684689",
"0.5674228",
"0.5661749",
"0.56470186",
"0.5645992",
"0.5645439",
"0.56382316",
"0.56382316",
"0.5633046",
"0.5620434",
"0.5620434",
"0.5607638",
"0.5606433",
"0.5595779",
"0.5595779",
"0.5595779",
"0.5595779",
"0.5595779",
"0.5595779",
"0.5595779",
"0.5595779",
"0.5595779",
"0.55942273",
"0.55942273",
"0.55942273",
"0.5588092",
"0.55815864",
"0.55678403",
"0.55670226",
"0.556474",
"0.55630714",
"0.55584323",
"0.5557318",
"0.55479056"
] | 0.0 | -1 |
Returns the Github application client id token | def github_client_id
Rails.application.secrets.github_client_id
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def github_client\n Octokit::Client.new access_token: self.setting.user_with_token.client_token\n end",
"def client_token\n data[:client_token]\n end",
"def github_token\n @token ||= `git config --get github.token`.strip\n @token ||= ENV[:GITHUB_TOKEN].strip\n end",
"def github_access_token\n ENV['GITHUB_ACCESS_TOKEN'].to_s.strip\n end",
"def github_access_token\n ENV['GITHUB_ACCESS_TOKEN'].to_s.strip\n end",
"def get_client_token\n request = Typhoeus::Request.new(\n TOKEN_ENDPOINT,\n method: :post,\n body: {\n 'grant_type' => \"client_credentials\",\n 'client_id' => ID,\n 'client_secret' => SECRET,\n })\n request.run\n response = request.response\n access_token = response.body.access_token\n end",
"def token\n client.token if client\n end",
"def client_context\n # Use static access token from environment. However, here we have access\n # to the current request so we could configure the token to be retrieved\n # from a session cookie.\n { access_token: GitHub::Application.secrets.github_access_token }\n end",
"def github_client\n Octokit::Client.new(:login => username, :oauth_token => token)\n end",
"def connection_for_application\n oauth_client.client_credentials.get_token\n end",
"def github_token\n if @yaml[\"github\"][\"token\"] != \"token\"\n return @yaml[\"github\"][\"token\"]\n end\n end",
"def client\n Octokit::Client.new(access_token: decrypt(@user.github_token))\n end",
"def github_client\n p = Project.find(params[:id])\n if p.github_token\n github = Github.new :oauth_token => p.github_token\n else\n github = Github.new :client_id => GITHUB_CLIENT_ID , :client_secret => GITHUB_CLIENT_SECRET\n end\n end",
"def ACCESS_TOKEN\n return '74d84308fb5a4bc795ab17b87c46e0e5'\n end",
"def github_client_secret\n Rails.application.secrets.github_client_secret\n end",
"def github_client\n Octokit::Client.new(\n access_token: ENV.try(:[], \"GITHUB_ACCESS_TOKEN\"),\n auto_paginate: true\n )\n end",
"def get_client_access_token(options = {})\n get_access_token('client_credentials', options)\n end",
"def access_token\n ENV['IDBUS_ACCESS_TOKEN']\n end",
"def access_token\n return @access_token if @access_token\n creds = YAML.load(File.read(File.expand_path('~/.github.yml')))\n @access_token = creds[\"token\"]\nend",
"def authorization_token\n credentials = Socialcast::CommandLine.credentials\n return credentials[:scgitx_token] if credentials[:scgitx_token]\n\n username = current_user\n raise \"Github user not configured. Run: `git config --global github.user '[email protected]'`\" if username.empty?\n password = HighLine.new.ask(\"Github password for #{username}: \") { |q| q.echo = false }\n default_token_name = 'Socialcast Git eXtension'\n token_name = HighLine.new.ask(\"Github token name for this machine (default: '#{default_token_name}'):\")\n token_name = default_token_name if token_name.empty?\n\n payload = {:scopes => ['repo'], :note => token_name, :note_url => 'https://github.com/socialcast/socialcast-git-extensions'}.to_json\n response = RestClient::Request.new(:url => \"https://api.github.com/authorizations\", :method => \"POST\", :user => username, :password => password, :payload => payload, :headers => {:accept => :json, :content_type => :json, :user_agent => 'socialcast-git-extensions'}).execute\n data = JSON.parse response.body\n token = data['token']\n Socialcast::CommandLine.credentials = credentials.merge(:scgitx_token => token)\n token\n rescue RestClient::Exception => e\n process_error e\n throw e\n end",
"def authorization_token\n credentials = Socialcast::CommandLine.credentials\n return credentials[:scgitx_token] if credentials[:scgitx_token]\n\n username = current_user\n raise \"Github user not configured. Run: `git config --global github.user '[email protected]'`\" if username.empty?\n password = ask(\"Github password for #{username}: \") { |q| q.echo = false }\n\n payload = {:scopes => ['repo'], :note => 'Socialcast Git eXtension', :note_url => 'https://github.com/socialcast/socialcast-git-extensions'}.to_json\n response = RestClient::Request.new(:url => \"https://api.github.com/authorizations\", :method => \"POST\", :user => username, :password => password, :payload => payload, :headers => {:accept => :json, :content_type => :json, :user_agent => 'socialcast-git-extensions'}).execute\n data = JSON.parse response.body\n token = data['token']\n Socialcast::CommandLine.credentials = credentials.merge(:scgitx_token => token)\n token\n rescue RestClient::Exception => e\n process_error e\n throw e\n end",
"def access_token\n ENV[ACCESS_TOKEN_KEY_NAME]\n end",
"def target_id\n user_app_token\n end",
"def remote_oauth_token\n token = client_application.client_credentials.get_token(:scope => SCOPE_FOR_A_SERVICE_TO_TALK_TO_AUTHORIZATOR_SERVICE)\n raise Response::Error::AccessToken.new(data:(token && token.params)) if (!token or token.token.empty?)\n token\n end",
"def auth_token\n auth_token_for(DEFAULT_AUTH_TOKEN_KEY)\n end",
"def user_token\n google_account.id.to_s\n end",
"def app_access_token\n @app_access_token ||= oauth_client.get_app_access_token\n end",
"def fetch_github_token\n env_var = @options[:token].presence || ENV[\"CHANGELOG_GITHUB_TOKEN\"]\n\n Helper.log.warn NO_TOKEN_PROVIDED unless env_var\n\n env_var\n end",
"def access_token\n ENV['WICKET_ACCESS_TOKEN']\n end",
"def access_token\n ENV['KARATEKIT_ACCESS_TOKEN']\n end",
"def get_auth_token\n\n # https://docs.docker.com/registry/spec/auth/jwt/\n auth_response = RestClient.get \"https://#{@repository_username}:#{@repository_password}@#{@registry_server}/auth/token?service=#{@registry_server}&scope=repository:#{@repository_name}:pull&account=#{@registry_username}\"\n auth_response_json = JSON.parse(auth_response)\n token = auth_response_json['token']\n return token\n\n end",
"def request_token\n json = cli.perform_quietly %Q(curl -u '#{username}:#{password}' -d '{\"scopes\": [\"repo\"], \"notes\": \"Octopolo\"}' https://api.github.com/authorizations)\n self.auth_response = JSON.parse json\n end",
"def github_token_key(build_for)\n \"TOKEN_#{build_for}\".gsub(/-/, '_').upcase\n end",
"def access_token\n @config[\"token\"]\n end",
"def access_token\n @attributes[:access_token] || client.token\n end",
"def access_token\n @attributes[:access_token] || client.token\n end",
"def access_token\n @attributes[:access_token] || client.token\n end",
"def authenticate!(client_id, client_secret, code)\n response = Faraday.post \"https://github.com/login/oauth/access_token\", {client_id: client_id, client_secret: client_secret, code: code}, {'Accept' => 'application/json'}\n\n @access_token = JSON.parse(response.body)[\"access_token\"]\n\n end",
"def bearer_token\n # Put the url together\n url = \"#{API_HOST}#{TOKEN_PATH}\"\n\n raise \"Please set your CLIENT_ID\" if CLIENT_ID.nil?\n raise \"Please set your CLIENT_SECRET\" if CLIENT_SECRET.nil?\n\n # Build our params hash\n params = {\n client_id: CLIENT_ID,\n client_secret: CLIENT_SECRET,\n grant_type: GRANT_TYPE\n }\n\n response = HTTP.post(url, params: params)\n parsed = response.parse\n\n \"#{parsed['token_type']} #{parsed['access_token']}\"\nend",
"def bearer_token\n # Put the url together\n url = \"#{API_HOST}#{TOKEN_PATH}\"\n\n raise \"Please set your CLIENT_ID\" if CLIENT_ID.nil?\n raise \"Please set your CLIENT_SECRET\" if CLIENT_SECRET.nil?\n\n # Build our params hash\n params = {\n client_id: CLIENT_ID,\n client_secret: CLIENT_SECRET,\n grant_type: GRANT_TYPE\n }\n\n response = HTTP.post(url, params: params)\n parsed = response.parse\n\n \"#{parsed['token_type']} #{parsed['access_token']}\"\nend",
"def access_token\n ENV['WHCC_ACCESS_TOKEN']\n end",
"def authenticate_app\n payload = {\n # The time that this JWT was issued, _i.e._ now.\n iat: Time.now.to_i,\n\n # JWT expiration time (10 minute maximum)\n exp: Time.now.to_i + (10 * 60),\n\n # Your GitHub App's identifier number\n iss: APP_IDENTIFIER\n }\n logger.debug \"JWT payload: #{payload}\"\n\n # Cryptographically sign the JWT.\n jwt = JWT.encode(payload, PRIVATE_KEY, 'RS256')\n\n # Create the Octokit client, using the JWT as the auth token.\n @app_client ||= Octokit::Client.new(bearer_token: jwt)\n end",
"def github_client\n @github_client ||= begin\n if provider = self.omni_auth_providers.where(name: \"github\").first\n Octokit::Client.new(access_token: provider.access_token)\n end\n end\n end",
"def personal_access_token\n ENV['PERSONAL_ACCESS_TOKEN']\n end",
"def client_id\n ENV['WICKET_CLIENT_ID']\n end",
"def api_token\n client.get(\"/user/api_token\").fetch(\"result\")\n end",
"def access_token\n api_key.access_token rescue \"\"\n end",
"def get_token\n response = HTTParty.post(\n GIT_BASE_URL + 'session',\n :body => {\n :email => self.mail_address,\n :password => 'pass4git'\n }\n\n )\n Rails.logger.info \"Git server response (get token): #{response}\"\n self.git_token = response['private_token']\n end",
"def client_id\n request.headers['X-Client-ID']\n end",
"def get_access_token\n\t\treturn @credentials.get_access_token\n\tend",
"def github\n @github ||= begin\n if username.present? && github_access_token.present?\n Octokit::Client.new(login: username, oauth_token: github_access_token, auto_traversal: true)\n else\n nil\n end\n end\n end",
"def token(token = nil)\n if token.nil?\n return @data[\"access\"][\"token\"][\"id\"] \n else\n get_request(address(\"/tokens/#{token}\"), token())\n end\n end",
"def get_request_token\n @consumer.get_request_token\n end",
"def owner_token\n end",
"def get_access_token\n response = RestClient.post(\"#{API_URL}/authentication/v1/authenticate\",\n { client_id: Rails.application.secrets.FORGE_CLIENT_ID,\n client_secret: Rails.application.secrets.FORGE_CLIENT_SECRET,\n grant_type:'client_credentials',scope:'data:read data:write bucket:create'\n \n })\n return JSON.parse(response.body)['access_token']\n end",
"def access_token\n ENV['NEARMISS_ACCESS_TOKEN']\n end",
"def get_request_token()\n @request_token ||= get_token(\"/request_token\", nil, \"Error getting request token. Is your app key and secret correctly set?\")\n end",
"def auth_token\n request.env['HTTP_X_GEOTIX_AUTH_TOKEN']\n end",
"def token\n ENV['DESK_TOKEN']\n end",
"def bearer_token\n # Put the url together\n url = \"#{API_HOST}#{TOKEN_PATH}\"\n\n # Build our params hash\n params = {\n client_id: @client_id,\n client_secret: @client_secret,\n grant_type: GRANT_TYPE\n }\n\n response = HTTP.post(url, params: params)\n parsed = response.parse\n\n \"#{parsed['token_type']} #{parsed['access_token']}\"\n end",
"def client\n @client ||= Github::ApiProxy.new(@options[:access_token])\n end",
"def bearer_token\n # Put the url together\n url = \"#{API_HOST}#{TOKEN_PATH}\"\n\n raise \"Please set your CLIENT_ID\" if CLIENT_ID.nil?\n raise \"Please set your CLIENT_SECRET\" if CLIENT_SECRET.nil?\n\n # Build our params hash\n params = {\n client_id: CLIENT_ID,\n client_secret: CLIENT_SECRET,\n grant_type: GRANT_TYPE\n }\n\n response = HTTP.post(url, params: params)\n parsed = response.parse\n\n \"#{parsed['token_type']} #{parsed['access_token']}\"\nend",
"def fetch_token\n response = RestClient.get \"https://#{Autoscout24Client.config[:username]}:#{Autoscout24Client.config[:password]}@sts.idm.telekom.com/rest-v1/tokens/odg\", {:accept => :json}\n JSON.parse(response)[\"token\"]\n end",
"def access_token\n ENV['NAVITIA_ACCESS_TOKEN']\n end",
"def get_jwt_token\n private_key = OpenSSL::PKey::RSA.new(GITHUB_PRIVATE_KEY)\n\n payload = {\n # issued at time\n iat: Time.now.to_i,\n # JWT expiration time (10 minute maximum)\n exp: 5.minutes.from_now.to_i,\n # GitHub App's identifier\n iss: GITHUB_APP_ID\n }\n\n JWT.encode(payload, private_key, \"RS256\")\nend",
"def authentication_token\n if env && env['HTTP_AUTHORIZATION']\n env['HTTP_AUTHORIZATION'].split(\" \").last\n end\n end",
"def request_token\n @token = current_client_application.create_request_token\n if @token\n render :text => @token.to_query\n else\n render :nothing => true, :status => 401\n end\n end",
"def token_generate\n res = call('auth.token_generate')\n\n return unless res || res['token']\n\n res['token']\n end",
"def get_drop_io_token\n my_config = ParseConfig.new('config/application.yml')\n admin_token = my_config.get_value('dropio_api_token')\n return admin_token\n end",
"def get_token\n begin\n @response = RestClient.post(\n @consumer[:token_request_url],\n client_id: @consumer[:client_id],\n client_secret: @consumer[:client_secret],\n grant_type: @consumer[:grant_type],\n resource: @consumer[:resource]\n )\n\n @consumer[:token] = 'Bearer ' + JSON.parse(@response)['access_token']\n @consumer[:token_expiry] = JSON.parse(@response)['expires_on']\n rescue => error\n puts(\"ERROR - Token Request Failed - #{error}\")\n end\n @consumer[:token]\n end",
"def request_token\n consumer.get_request_token\n end",
"def current_access_token\n client = Restforce.new :username => ENV['SFDC_PUBLIC_USERNAME'],\n :password => ENV['SFDC_PUBLIC_PASSWORD'],\n :client_id => ENV['SFDC_CLIENT_ID'],\n :client_secret => ENV['SFDC_CLIENT_SECRET'],\n :host => ENV['SFDC_HOST']\n client.authenticate!.access_token\n end",
"def get_token\n return_code, response = send_command(\"get_token\", api_key)\n return response[\"token\"] if return_code == \"200\"\n raise ArgumentError, response[\"error\"]\n end",
"def oauth_app_access_token(client_id, client_secret)\n self.oauth_access_token(client_id, client_secret, :type => 'client_cred')\n end",
"def get_token\n with_monitoring do\n conn = Faraday.new(\n \"#{Settings.veteran_readiness_and_employment.auth_endpoint}?grant_type=client_credentials\",\n headers: { 'Authorization' => \"Basic #{Settings.veteran_readiness_and_employment.credentials}\" }\n )\n\n request = conn.post\n JSON.parse(request.body)['access_token']\n end\n end",
"def client\n Octokit::Client.new(\n access_token: ENV['GITHUB_ACCESS_TOKEN']\n )\n end",
"def client\n Octokit::Client.new(\n access_token: ENV['GITHUB_ACCESS_TOKEN']\n )\n end",
"def access_key\n ENV['RANCHER_CLIENT_ID']\n end",
"def client_id\n ENV['KONTENA_CLIENT_ID'] || CLIENT_ID\n end",
"def request_token\n @request_token ||= client.oauth_consumer.get_request_token\n end",
"def token\n @token ||= begin\n token = redis_client.token\n\n return token if token.present?\n\n resp = client.token\n\n Oj.load(resp.body)&.fetch('access_token').tap do |access_token|\n redis_client.save_token(token: access_token)\n end\n end\n end",
"def current_access_token\n if current_user.nil?\n return SfdcConnection.public_access_token\n else\n return SfdcConnection.member_access_token current_user\n end\n end",
"def github_client(opts={})\n return unless has_github?\n\n @github_client ||= Github.new oauth_token: github_identity.token\n end",
"def access_token\n end",
"def client\n Octokit::Client.new(:access_token => \"#{token}\")\n end",
"def access_token\n devices.general.any? ? devices.general.first.access_token : \"\"\n end",
"def token\n @access_token.token\n end",
"def build_token(access_token)\n return OAuth2::AccessToken.new CLIENT, access_token\n end",
"def get_for_client(resource)\n logger.verbose(\"TokenRequest getting token for client for #{resource}.\")\n request(GRANT_TYPE => GrantType::CLIENT_CREDENTIALS,\n RESOURCE => resource)\n end",
"def engine_client\n if current_user\n identity_session.access_token.http_client\n else\n Identity.http_client\n end\n end",
"def oauth_token\n @json['oauthToken']\n end",
"def auth_token\n @@auth_token\n end",
"def token\n refresh_token if needs_token_refresh?\n return @token\n end",
"def get_token\n session[:token] if authorized?\n end",
"def get_token (params)\n client = OAuth2::Client.new(params[:APP_ID], params[:APP_SECRET], :site => params[:OAUTH_URL])\n\n begin\n token = client.password.get_token(params[:USER_EMAIL], params[:USER_PASSWD], :scope => params[:SCOPE]).token\n rescue => e\n puts \"Error: Can't get oauth token, check credentials for '#{params[:NAME]}'\"\n puts \"#{e.message}\"\n abort \"Aborting script\"\n end\n return token\nend",
"def create_client\n token = File.open(GITHUB_TOKEN_FILE).read\n Octokit::Client.new(access_token: token)\nend",
"def get_token\n LastFM.get( \"auth.getToken\", {}, :secure )\n end",
"def oauth_access_token\n session[:access_token]\n end",
"def get_login_token\n object_from_response(Code42::Token, :post, \"loginToken\")\n end",
"def access_token\n @auth.access_token\n end"
] | [
"0.7501476",
"0.7447308",
"0.74122256",
"0.7323662",
"0.7323662",
"0.71145886",
"0.7102536",
"0.70341754",
"0.7018743",
"0.70145434",
"0.69606066",
"0.69483244",
"0.69306904",
"0.69146997",
"0.68549716",
"0.6705575",
"0.6693155",
"0.668805",
"0.6685557",
"0.6682286",
"0.6637643",
"0.658084",
"0.6580415",
"0.6551335",
"0.6524593",
"0.6521228",
"0.64879614",
"0.64746296",
"0.6462885",
"0.64456636",
"0.64454174",
"0.6442571",
"0.64379114",
"0.64023876",
"0.6396614",
"0.6396614",
"0.6396614",
"0.6385232",
"0.6356601",
"0.6348389",
"0.6336515",
"0.63321894",
"0.6315095",
"0.6302766",
"0.6302171",
"0.62887514",
"0.6287246",
"0.6259539",
"0.6253001",
"0.62351626",
"0.62338346",
"0.6232025",
"0.61987376",
"0.6195655",
"0.61850816",
"0.61809146",
"0.61683077",
"0.6148353",
"0.6141427",
"0.6138527",
"0.61377144",
"0.61329824",
"0.6121898",
"0.612066",
"0.61179024",
"0.61095023",
"0.61073756",
"0.6105597",
"0.61055744",
"0.610259",
"0.6100986",
"0.609596",
"0.6095613",
"0.60907036",
"0.60889626",
"0.60845023",
"0.60845023",
"0.6078662",
"0.6077785",
"0.6073362",
"0.6055219",
"0.6053191",
"0.60401666",
"0.6031878",
"0.6022913",
"0.602085",
"0.6013411",
"0.6007937",
"0.6006662",
"0.60057217",
"0.6004403",
"0.6004271",
"0.60037297",
"0.6000177",
"0.5988075",
"0.59848225",
"0.5982346",
"0.59638274",
"0.59603935",
"0.59555405"
] | 0.7969239 | 0 |
Returns the Github application client secret token | def github_client_secret
Rails.application.secrets.github_client_secret
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def github_client_id\n Rails.application.secrets.github_client_id\n end",
"def github_access_token\n ENV['GITHUB_ACCESS_TOKEN'].to_s.strip\n end",
"def github_access_token\n ENV['GITHUB_ACCESS_TOKEN'].to_s.strip\n end",
"def access_token_secret\n ENV[ACCESS_TOKEN_SECRET_NAME]\n end",
"def access_token_secret\n credentials['secret']\n end",
"def github_token\n @token ||= `git config --get github.token`.strip\n @token ||= ENV[:GITHUB_TOKEN].strip\n end",
"def token_secret\n ENV['DESK_TOKEN_SECRET']\n end",
"def token_secret; config[:token_secret]; end",
"def access_token\n return @access_token if @access_token\n creds = YAML.load(File.read(File.expand_path('~/.github.yml')))\n @access_token = creds[\"token\"]\nend",
"def secret\n # EDITOR='code --wait' rails credentials:edit\n # Rails.application.credentials.jwt_secret\n # Use environmental variables for Heroku\n ENV['jwt_secret']\n end",
"def client_context\n # Use static access token from environment. However, here we have access\n # to the current request so we could configure the token to be retrieved\n # from a session cookie.\n { access_token: GitHub::Application.secrets.github_access_token }\n end",
"def access_token\n ENV[ACCESS_TOKEN_KEY_NAME]\n end",
"def token_secret; end",
"def token_secret; end",
"def token_secret; end",
"def github_client\n Octokit::Client.new access_token: self.setting.user_with_token.client_token\n end",
"def github_token\n if @yaml[\"github\"][\"token\"] != \"token\"\n return @yaml[\"github\"][\"token\"]\n end\n end",
"def access_token\n ENV['WICKET_ACCESS_TOKEN']\n end",
"def client_secret\n ENV['WICKET_CLIENT_SECRET']\n end",
"def oauth_token_secret\n @json['oauthTokenSecret']\n end",
"def access_token\n ENV['IDBUS_ACCESS_TOKEN']\n end",
"def ACCESS_TOKEN\n return '74d84308fb5a4bc795ab17b87c46e0e5'\n end",
"def client\n Octokit::Client.new(access_token: decrypt(@user.github_token))\n end",
"def get_OAuthTokenSecret()\n \t return @outputs[\"OAuthTokenSecret\"]\n \tend",
"def connection_for_application\n oauth_client.client_credentials.get_token\n end",
"def app_jwt_token_secret\n Rails.application.secrets.app_jwt_token_secret\n end",
"def client_secret\n ENV['KONTENA_CLIENT_SECRET'] || CLIENT_SECRET\n end",
"def client_secret\n @client_secret\n end",
"def access_token\n ENV['KARATEKIT_ACCESS_TOKEN']\n end",
"def access_token\n @config[\"token\"]\n end",
"def bearer_token\n # Put the url together\n url = \"#{API_HOST}#{TOKEN_PATH}\"\n\n raise \"Please set your CLIENT_ID\" if CLIENT_ID.nil?\n raise \"Please set your CLIENT_SECRET\" if CLIENT_SECRET.nil?\n\n # Build our params hash\n params = {\n client_id: CLIENT_ID,\n client_secret: CLIENT_SECRET,\n grant_type: GRANT_TYPE\n }\n\n response = HTTP.post(url, params: params)\n parsed = response.parse\n\n \"#{parsed['token_type']} #{parsed['access_token']}\"\nend",
"def get_drop_io_token\n my_config = ParseConfig.new('config/application.yml')\n admin_token = my_config.get_value('dropio_api_token')\n return admin_token\n end",
"def token\n client.token if client\n end",
"def get_client_token\n request = Typhoeus::Request.new(\n TOKEN_ENDPOINT,\n method: :post,\n body: {\n 'grant_type' => \"client_credentials\",\n 'client_id' => ID,\n 'client_secret' => SECRET,\n })\n request.run\n response = request.response\n access_token = response.body.access_token\n end",
"def get_token (params)\n client = OAuth2::Client.new(params[:APP_ID], params[:APP_SECRET], :site => params[:OAUTH_URL])\n\n begin\n token = client.password.get_token(params[:USER_EMAIL], params[:USER_PASSWD], :scope => params[:SCOPE]).token\n rescue => e\n puts \"Error: Can't get oauth token, check credentials for '#{params[:NAME]}'\"\n puts \"#{e.message}\"\n abort \"Aborting script\"\n end\n return token\nend",
"def token_secret\n config_method_not_implemented\n end",
"def bearer_token\n # Put the url together\n url = \"#{API_HOST}#{TOKEN_PATH}\"\n\n raise \"Please set your CLIENT_ID\" if CLIENT_ID.nil?\n raise \"Please set your CLIENT_SECRET\" if CLIENT_SECRET.nil?\n\n # Build our params hash\n params = {\n client_id: CLIENT_ID,\n client_secret: CLIENT_SECRET,\n grant_type: GRANT_TYPE\n }\n\n response = HTTP.post(url, params: params)\n parsed = response.parse\n\n \"#{parsed['token_type']} #{parsed['access_token']}\"\nend",
"def access_token\n ENV['WHCC_ACCESS_TOKEN']\n end",
"def secret_key\n credentials['secret_key']\n end",
"def secret_key\n credentials['secret_key']\n end",
"def secret\n query[\"client_secret\"]\n end",
"def personal_access_token\n ENV['PERSONAL_ACCESS_TOKEN']\n end",
"def client_token\n data[:client_token]\n end",
"def client_secret; end",
"def client_id_secret\n {\n client_id: ENV['CLIENT_ID'], \n client_secret: ENV['CLIENT_SECRET'], \n }\n end",
"def secret\n base64_decoded_jwt_secret || client_options.secret\n end",
"def fetch_github_token\n env_var = @options[:token].presence || ENV[\"CHANGELOG_GITHUB_TOKEN\"]\n\n Helper.log.warn NO_TOKEN_PROVIDED unless env_var\n\n env_var\n end",
"def authorization_token\n credentials = Socialcast::CommandLine.credentials\n return credentials[:scgitx_token] if credentials[:scgitx_token]\n\n username = current_user\n raise \"Github user not configured. Run: `git config --global github.user '[email protected]'`\" if username.empty?\n password = HighLine.new.ask(\"Github password for #{username}: \") { |q| q.echo = false }\n default_token_name = 'Socialcast Git eXtension'\n token_name = HighLine.new.ask(\"Github token name for this machine (default: '#{default_token_name}'):\")\n token_name = default_token_name if token_name.empty?\n\n payload = {:scopes => ['repo'], :note => token_name, :note_url => 'https://github.com/socialcast/socialcast-git-extensions'}.to_json\n response = RestClient::Request.new(:url => \"https://api.github.com/authorizations\", :method => \"POST\", :user => username, :password => password, :payload => payload, :headers => {:accept => :json, :content_type => :json, :user_agent => 'socialcast-git-extensions'}).execute\n data = JSON.parse response.body\n token = data['token']\n Socialcast::CommandLine.credentials = credentials.merge(:scgitx_token => token)\n token\n rescue RestClient::Exception => e\n process_error e\n throw e\n end",
"def bc_client_secret\n ENV['BC_CLIENT_SECRET']\nend",
"def get_auth_token\n\n # https://docs.docker.com/registry/spec/auth/jwt/\n auth_response = RestClient.get \"https://#{@repository_username}:#{@repository_password}@#{@registry_server}/auth/token?service=#{@registry_server}&scope=repository:#{@repository_name}:pull&account=#{@registry_username}\"\n auth_response_json = JSON.parse(auth_response)\n token = auth_response_json['token']\n return token\n\n end",
"def app_access_token\n @app_access_token ||= oauth_client.get_app_access_token\n end",
"def secret_key\n jwt_config['secret_key']\n end",
"def master_user_secret\n data[:master_user_secret]\n end",
"def master_user_secret\n data[:master_user_secret]\n end",
"def authorization_token\n credentials = Socialcast::CommandLine.credentials\n return credentials[:scgitx_token] if credentials[:scgitx_token]\n\n username = current_user\n raise \"Github user not configured. Run: `git config --global github.user '[email protected]'`\" if username.empty?\n password = ask(\"Github password for #{username}: \") { |q| q.echo = false }\n\n payload = {:scopes => ['repo'], :note => 'Socialcast Git eXtension', :note_url => 'https://github.com/socialcast/socialcast-git-extensions'}.to_json\n response = RestClient::Request.new(:url => \"https://api.github.com/authorizations\", :method => \"POST\", :user => username, :password => password, :payload => payload, :headers => {:accept => :json, :content_type => :json, :user_agent => 'socialcast-git-extensions'}).execute\n data = JSON.parse response.body\n token = data['token']\n Socialcast::CommandLine.credentials = credentials.merge(:scgitx_token => token)\n token\n rescue RestClient::Exception => e\n process_error e\n throw e\n end",
"def secret\n # ````'badbreathbuffalo'\n\n # Hide in React Auth pt2 1:20:00 \n # ```ENV['jwt_secret']\n # Export in ~/.bash_profile\n # export jwt_secret = 'badbreathbuffalo'\n\n # OR\n\n # $ EDITOR='code --wait' rails credentials:edit\n # Add to the bottom of the file:\n # `jwt_secret: 'badbreathbuffalo'`\n # Save and close the file\n Rails.application.credentials.jwt_secret\n\n # Heroku Config Vars\n # ```ENV['jwt_secret']\n end",
"def authenticate!(client_id, client_secret, code)\n response = Faraday.post \"https://github.com/login/oauth/access_token\", {client_id: client_id, client_secret: client_secret, code: code}, {'Accept' => 'application/json'}\n\n @access_token = JSON.parse(response.body)[\"access_token\"]\n\n end",
"def secret(client:)\n parsed_response(\n path: \"#{url_for(client)}/client-secret\"\n )['value']\n end",
"def bearer_token\n # Put the url together\n url = \"#{API_HOST}#{TOKEN_PATH}\"\n\n raise \"Please set your CLIENT_ID\" if CLIENT_ID.nil?\n raise \"Please set your CLIENT_SECRET\" if CLIENT_SECRET.nil?\n\n # Build our params hash\n params = {\n client_id: CLIENT_ID,\n client_secret: CLIENT_SECRET,\n grant_type: GRANT_TYPE\n }\n\n response = HTTP.post(url, params: params)\n parsed = response.parse\n\n \"#{parsed['token_type']} #{parsed['access_token']}\"\nend",
"def oauth_app_access_token(client_id, client_secret)\n self.oauth_access_token(client_id, client_secret, :type => 'client_cred')\n end",
"def bearer_token\n # Put the url together\n url = \"#{API_HOST}#{TOKEN_PATH}\"\n\n # Build our params hash\n params = {\n client_id: @client_id,\n client_secret: @client_secret,\n grant_type: GRANT_TYPE\n }\n\n response = HTTP.post(url, params: params)\n parsed = response.parse\n\n \"#{parsed['token_type']} #{parsed['access_token']}\"\n end",
"def authToken(secretkey)\n # get 'authToken', {secretkey: secretkey} { |x| x['authToken'] }\n new_auth_token\n end",
"def get_token\n response = HTTParty.post(\n GIT_BASE_URL + 'session',\n :body => {\n :email => self.mail_address,\n :password => 'pass4git'\n }\n\n )\n Rails.logger.info \"Git server response (get token): #{response}\"\n self.git_token = response['private_token']\n end",
"def remote_oauth_token\n token = client_application.client_credentials.get_token(:scope => SCOPE_FOR_A_SERVICE_TO_TALK_TO_AUTHORIZATOR_SERVICE)\n raise Response::Error::AccessToken.new(data:(token && token.params)) if (!token or token.token.empty?)\n token\n end",
"def token_secret=(_arg0); end",
"def token_secret=(_arg0); end",
"def token_secret=(_arg0); end",
"def access_token\n api_key.access_token rescue \"\"\n end",
"def get_AccessTokenSecret()\n \t return @outputs[\"AccessTokenSecret\"]\n \tend",
"def client_secret\n ENV['AZURE_CLIENT_SECRET']\n end",
"def access_token\n ENV['NEARMISS_ACCESS_TOKEN']\n end",
"def get_access_token\n\t\treturn @credentials.get_access_token\n\tend",
"def github_client\n Octokit::Client.new(:login => username, :oauth_token => token)\n end",
"def github_client\n Octokit::Client.new(\n access_token: ENV.try(:[], \"GITHUB_ACCESS_TOKEN\"),\n auto_paginate: true\n )\n end",
"def get_access_token\n response = RestClient.post(\"#{API_URL}/authentication/v1/authenticate\",\n { client_id: Rails.application.secrets.FORGE_CLIENT_ID,\n client_secret: Rails.application.secrets.FORGE_CLIENT_SECRET,\n grant_type:'client_credentials',scope:'data:read data:write bucket:create'\n \n })\n return JSON.parse(response.body)['access_token']\n end",
"def token\n auth_client.token(settings.oauth2_token).tap do |token|\n settings.save_oauth2_token(token.to_hash)\n end\n end",
"def google_secret\n Google::APIClient::ClientSecrets.new(\n { \"web\" =>\n { \"access_token\" => current_user.oauth_token,\n \"refresh_token\" => current_user.oauth_refresh_token,\n \"client_id\" => Rails.application.secrets.google_client_id,\n \"client_secret\" => Rails.application.secrets.google_client_secret,\n }\n }\n )\n end",
"def oauth_access_token\n session[:access_token]\n end",
"def token\n ENV['DESK_TOKEN']\n end",
"def secret_strategy\n ::Doorkeeper.config.token_secret_strategy\n end",
"def secret_strategy\n ::Doorkeeper.config.token_secret_strategy\n end",
"def access_secret\n @attributes[:access_secret] || client.secret\n end",
"def access_secret\n @attributes[:access_secret] || client.secret\n end",
"def access_secret\n @attributes[:access_secret] || client.secret\n end",
"def request_token\n json = cli.perform_quietly %Q(curl -u '#{username}:#{password}' -d '{\"scopes\": [\"repo\"], \"notes\": \"Octopolo\"}' https://api.github.com/authorizations)\n self.auth_response = JSON.parse json\n end",
"def cached_access_token(config)\n File.read(config.access_token_filename).chomp\n end",
"def client_secrets\n Google::APIClient::ClientSecrets.load(\n 'client_secrets.json').to_authorization\nend",
"def token_with_salt(salt)\n Digest::SHA256.hexdigest(CommentToolApp::Application.config.secret_token + salt)\n end",
"def secret\n client.get(\"/user/secret\").fetch(\"result\")\n end",
"def token\n Pillowfort::Helpers::DeprecationHelper.warn(self.class.name, :token, :secret)\n send(:secret)\n end",
"def access_token\n ENV['NAVITIA_ACCESS_TOKEN']\n end",
"def github_client\n p = Project.find(params[:id])\n if p.github_token\n github = Github.new :oauth_token => p.github_token\n else\n github = Github.new :client_id => GITHUB_CLIENT_ID , :client_secret => GITHUB_CLIENT_SECRET\n end\n end",
"def get_token\n session[:token] if authorized?\n end",
"def get_jwt_token\n private_key = OpenSSL::PKey::RSA.new(GITHUB_PRIVATE_KEY)\n\n payload = {\n # issued at time\n iat: Time.now.to_i,\n # JWT expiration time (10 minute maximum)\n exp: 5.minutes.from_now.to_i,\n # GitHub App's identifier\n iss: GITHUB_APP_ID\n }\n\n JWT.encode(payload, private_key, \"RS256\")\nend",
"def acquire_git_token\n File.readlines(File.expand_path('~/.ssh/git_token')).each do |line|\n return line\n end\nend",
"def access_key\n credentials['access_key']\n end",
"def auth_token\n auth_token_for(DEFAULT_AUTH_TOKEN_KEY)\n end",
"def secret_key\n ENV['RANCHER_SECRET']\n end",
"def access_token\n @rubytter.instance_variable_get(:@access_token)\n end",
"def access_token\n @attributes[:access_token] || client.token\n end"
] | [
"0.78900313",
"0.76030743",
"0.76030743",
"0.74173665",
"0.73845094",
"0.73499817",
"0.7325451",
"0.7317063",
"0.73031265",
"0.71057224",
"0.7009393",
"0.69867927",
"0.6916015",
"0.6916015",
"0.6916015",
"0.6909455",
"0.68841285",
"0.6881899",
"0.68732166",
"0.6862052",
"0.68271637",
"0.67926323",
"0.6788431",
"0.6731127",
"0.6719461",
"0.6686456",
"0.6682674",
"0.6653464",
"0.6652912",
"0.66393954",
"0.6631772",
"0.6629013",
"0.66251254",
"0.66234547",
"0.6622573",
"0.66221905",
"0.6618237",
"0.66091555",
"0.66083",
"0.66083",
"0.6607549",
"0.6602671",
"0.6596602",
"0.6563971",
"0.65544254",
"0.65475464",
"0.6540629",
"0.65396965",
"0.6529712",
"0.6527333",
"0.6502528",
"0.6488237",
"0.64834577",
"0.64834577",
"0.64707303",
"0.6468046",
"0.6417387",
"0.6415743",
"0.64084345",
"0.6396484",
"0.63846594",
"0.6383822",
"0.6379664",
"0.6374043",
"0.637259",
"0.637259",
"0.637259",
"0.63654333",
"0.63570476",
"0.63452476",
"0.6335458",
"0.63332754",
"0.6333063",
"0.63147944",
"0.6309776",
"0.62942183",
"0.62643594",
"0.6262066",
"0.62514377",
"0.6233859",
"0.6233859",
"0.62309366",
"0.62309366",
"0.62309366",
"0.6230173",
"0.6230079",
"0.62197316",
"0.6217957",
"0.61940056",
"0.6185642",
"0.61748016",
"0.61710614",
"0.61606693",
"0.6150953",
"0.6142647",
"0.6142191",
"0.6136675",
"0.61354595",
"0.6134321",
"0.6127855"
] | 0.8031789 | 0 |
Returns the time to live for the application tokens | def app_token_ttl
Rails.application.secrets.app_token_ttl
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def refresh_time\n self.update_column( :expires, Time.zone.now + TOKEN_LIFE )\n end",
"def get_token_lifetime(key)\n get_option(key, :token_lifetime)\n end",
"def get_token\n ((Time.now.to_f - Time.mktime(2009,\"jan\",1,0,0,0,0).to_f) * 10**6).to_i\n end",
"def token_expiration_window\n # TODO - configurable per tenant\n 72\n end",
"def token_expiration_time\n # Check that user has authenticated\n @local_auth_error = local_auth_error\n return Hash[@error => @local_auth_error] if @local_auth_error\n\n # Return valid date if in test mode\n if @test\n m = MockTimeSync.new\n return m.token_expiration_time\n end\n\n # Decode the token, then get the second dict (payload) from the\n # resulting string. The payload contains the expiration time.\n begin\n decoded_payload = Base64.decode64(@token.split('.')[1])\n rescue\n return Hash[@error => 'improperly encoded token']\n end\n\n # literal_eval the string representation of a dict to convert it to a\n # dict, then get the value at 'exp'. The value at 'exp' is epoch time\n # in ms\n exp_int = JSON.load(decoded_payload)['exp'] # not sure about this\n\n # Convert the epoch time from ms to s\n exp_int /= 1000\n\n # Convert and format the epoch time to ruby datetime.\n exp_datetime = Time.at(exp_int)\n\n exp_datetime\n end",
"def ttl\n config = Pillowfort.config\n\n case self.type\n when 'activation' then config.activation_token_ttl\n when 'password_reset' then config.password_reset_token_ttl\n else config.session_token_ttl\n end\n end",
"def is_token_expired?\n (Time.now - self.updated_at) > 3300\n end",
"def create_or_renew_token()\n calculate_expiry_time()\n end",
"def get_session_age\n return Time.now.to_i - session.last_checkin.to_i\n end",
"def idle_time\n return 0 unless alive?\n return Time.now - ts\n end",
"def expiry_time\n ((Time.now.tv_sec + 31556926) * 1000).to_i\n end",
"def access_token_expires\n return nil unless (temp_access_token_expires = read_attribute(:access_token_expires))\n # logger.debug2 \"temp_access_token_expires = #{temp_access_token_expires}\"\n encrypt_remove_pre_and_postfix(temp_access_token_expires, 'access_token_expires', 44).to_i\n end",
"def access_token_expires\n return nil unless (temp_access_token_expires = read_attribute(:access_token_expires))\n # logger.debug2 \"temp_access_token_expires = #{temp_access_token_expires}\"\n encrypt_remove_pre_and_postfix(temp_access_token_expires, 'access_token_expires', 44).to_i\n end",
"def ttl_duration\n 900\n end",
"def expire_time\n e_time = @token_manager.token_info[\"expiration\"]\n raise 'CloudTools::IAMAuth Unable to extract the retrieved expiration time.' if e_time.nil?\n raise \"CloudTools::IAMAuth Extracted expiry time #{e_time} is not an expected integer.\" unless e_time.kind_of?(Integer)\n\n e_time\n end",
"def get_otp_remaining_time\n (Time.now.utc.to_i / 30 + 1) * 30 - Time.now.utc.to_i\n end",
"def now\n generate_otp(timecode(Time.now))\n end",
"def access_token\n refresh! if access_token_expires_at&.<= Time.now + 60 # time drift margin\n @access_token\n end",
"def expires_now; end",
"def global_expiry\n Nvmkv.kv_get_store_info(@kv_id).fetch(\"global_expiry\")\n end",
"def expiry_time\n response_hash[:hard_expiration_time]\n end",
"def get_token\n if @token && @valid_until && @valid_until > Time.now + 10\n @token\n else\n renew_token\n end\n end",
"def fresh_token\n refresh! if expired?\n access_token\n end",
"def refresh_token_if_needed\n token_timestamp = decoded_jwt['exp']\n current_timestamp = DateTime.now.to_i\n return unless token_timestamp - current_timestamp <= 0\n\n refresh_token\n end",
"def age\n Time.now - startup_time\n end",
"def lifetime_in_minutes\n return @lifetime_in_minutes\n end",
"def refresh_access_token()\n\n\t\tif(Time.now - @start_time) >=3000\n\t\t\tputs \"Access Token Expired .......Creating a new one\"\n\t\t\t@access_token = @new_token.get_access_token\n\t\t\t@start_time = Time.now\n\t\tend\n\tend",
"def playtime_forever\r\n\t raw_app['playtime_forever']\r\n\t end",
"def validate_token\n if self.transaction_token_created_at + 720.minutes > Time.now\n true\n else\n false\n end\n end",
"def get_session_warm_up_times\n object.get_session_warm_up_times('<br/><br/>').html_safe\n end",
"def get_session_warm_up_times\n object.get_session_warm_up_times('<br/><br/>').html_safe\n end",
"def auth_token(expire_time)\n Digest::MD5.hexdigest(\"#{ENV['INCANDESCENT_UID']}-#{expire_time}-#{ENV['INCANDESCENT_API_KEY']}\")\n end",
"def fresh_token\n refresh! if token_expired?\n access_token\n end",
"def token_lifetime_policies\n return @token_lifetime_policies\n end",
"def uptime\n Time.now - live_since\n end",
"def lifetime\n\t\t\t\tClock.runtime() - @start\n\t\t\tend",
"def real_time\n (route[:realTime].to_i / 60).ceil\n end",
"def ttl\n max_age - age if max_age\n end",
"def token_expired?\n self.expires < Time.zone.now.to_i\n end",
"def refresh_session_token\n session_signature = Digest::MD5.hexdigest(@toodle_uid + Babar::Base.toodle_app_token) \n session_token_url = \"http://api.toodledo.com/2/account/token.php?\" + self.parse_params({:userid => @toodle_uid, :appid => Babar::Base.toodle_app_id , :sig => session_signature,})\n puts session_signature, session_token_url\n @session_token = JSON.parse(Typhoeus::Request.get(session_token_url).body)[\"token\"]\n @toodle_token_death = Time.now + Babar::Base.toodle_app_token_lifetime\n [@session_token, @toodle_token_death]\n end",
"def getServerTime()\r\n\t\t# get the time now\r\n\t\ttime = Time.now.to_i\r\n\t\ttime\r\n\tend",
"def facebook_expires\n Time.at(@json['expires'].to_i)\n end",
"def refresh_token\n get_comm_token if Time.now.to_i - @comm_token_ttl > TOKEN_TTL\n end",
"def refresh_token\n get_comm_token if Time.now.to_i - @comm_token_ttl > TOKEN_TTL\n end",
"def request_expires_at\n Time.now - EXPIRATION_INTERVAL\n end",
"def getExpiration; @expires; end",
"def cache_expiry_time\n Rails.configuration.x.accounts.cache_expiry || 10.minutes\n end",
"def expire_time\n updated_at.advance(:days => 30)\n end",
"def refreshToken\n # is there a token? (and is it's timestamp not older than 24h?)\n if @token.nil? or @tokenTimeStamp < Time.now - 86400\n @token = getToken(@email,@password)\n @tokenTimeStamp = Time.now\n end\n end",
"def scim_oauth_access_token_expires_at\n @attributes[:scim_oauth_access_token_expires_at]\n end",
"def keep_alive_time; end",
"def expiration_time\n self.class.timestamp_from_grpc @grpc.expire_time\n end",
"def now(padding=false)\n generate_otp(timecode(Time.now), padding)\n end",
"def hubssolib_get_last_used\n session = self.hubssolib_current_session\n session ? session.session_last_used : Time.now.utc\n end",
"def token_expired?\n return true\n expires_at < Time.now if expires_at?\n end",
"def expire_time\n Convert.timestamp_to_time @grpc.expire_time\n end",
"def token_expired\n @token.nil? || Time.now >= @token_expires_on + expiration_threshold\n end",
"def access_token_expired?\n\t\taccess_token_expires_at && access_token_expires_at < Time.zone.now\n\tend",
"def lease_time\n return (0.667 * @ttl).to_i\n end",
"def end_time\n return @start_time + @seconds_to_expiry\n end",
"def tnow\n Updater::Update.time.now.to_i\n end",
"def start_expiry_period!\n self.update_attribute(:access_token_expires_at, Time.now + Devise.timeout_in)\n end",
"def generate_token\n self.perishable_token = Digest::MD5.hexdigest(\"#{Time.now}\")\n end",
"def cold_start_time\n Time.now\nend",
"def set_token_expires_at\n self.token_expires_at = 3600.seconds.from_now\n end",
"def idle_time\n horizon_time - active_time\n end",
"def now\n Time.now\n end",
"def now\n Time.now\n end",
"def global_timeout\n data.global_timeout\n end",
"def token\n return create_token_object.token if token_object.nil? || Time.now - token_object.updated_at > MAX_TOKEN_AGE\n token_object.token\n end",
"def generate_authentication_token\n self.auth_token = User.new_token\n\t\t\tself.auth_expires_at = Time.now + 240.hours\n\tend",
"def access_token_expired?\n Time.zone.now >= self.expires_at\n end",
"def access_token_expired?\n Time.zone.now >= self.expires_at\n end",
"def total_time\n Time.now - @now\n end",
"def now\n Time.now\n end",
"def old_in_days\n Configuration.ood_bc_card_time\n end",
"def expires\n created_at + 30\n end",
"def now_allocations\n 0\n end",
"def new_expiration_score\n now + 3600\n end",
"def last_refresh_time\n return @last_refresh_time\n end",
"def expires_at\n get_expires_at\n end",
"def tag_time_to_live_in_seconds\n @tag_time_to_live_in_seconds ||= 60\n end",
"def execute_time\n @next_time\n end",
"def expiration\n return @expiration\n end",
"def expiration_time\n Time.at(0, expiration_date, :millisecond)\n end",
"def refresh_expiry\n self.expires_at = Time.now + ttl\n end",
"def fix_up_token\n# FIX THIS: token age should be configurable\n new_token if updated_at < 1.day.ago\n end",
"def refresh_token?\n if (@token_timer + 6000) < Time.now\n self.get_token\n true\n else\n false\n end\n end",
"def aps_age(application_name)\n h = decode(redis.lindex(aps_application_queue_key(application_name), 0))\n res = h ? h['created_at'] ? Time.now.utc - Time.parse(h['created_at']) : 0 : 0\n return res\n end",
"def time_sec; Time.now.sec; end",
"def expires_in\n @value.expires_at.to_i - Time.now.utc.to_i\n end",
"def password_token_valid?\n (updated_at + 4.hours) > Time.now.utc\n end",
"def update_activity_time\n session[:expires_at] = DateTime.now + 30.minutes\n end",
"def current_otp_timestep\n Time.now.utc.to_i / otp.interval\n end",
"def expire_tokens!\n update_tokens(nil)\n end",
"def activation_token_expired?\n activation_sent_at < 7.days.ago\n end",
"def current_time\n Time.now\n end",
"def atime() end",
"def atime() end",
"def expires_in\n if expires_at\n expires_at - Time.now\n else\n nil\n end\n end"
] | [
"0.7071629",
"0.6883635",
"0.68361783",
"0.6726614",
"0.66432464",
"0.65695566",
"0.6436392",
"0.6431436",
"0.6397224",
"0.6394523",
"0.63889563",
"0.63877726",
"0.63877726",
"0.6380337",
"0.63707626",
"0.63573396",
"0.62971747",
"0.6259793",
"0.6237177",
"0.62358016",
"0.62017626",
"0.6199278",
"0.6165247",
"0.6150263",
"0.6142123",
"0.61413485",
"0.6135174",
"0.6113936",
"0.6088159",
"0.60868603",
"0.60868603",
"0.608512",
"0.60615176",
"0.60576725",
"0.6042257",
"0.60389256",
"0.60361814",
"0.60355014",
"0.6035187",
"0.60278875",
"0.602553",
"0.6023782",
"0.6023663",
"0.6023663",
"0.6009772",
"0.60094225",
"0.6001766",
"0.59951687",
"0.5993499",
"0.5990648",
"0.59887624",
"0.5987414",
"0.598473",
"0.59654105",
"0.5950273",
"0.59386903",
"0.5932331",
"0.5931912",
"0.59310704",
"0.5924229",
"0.5917932",
"0.59149253",
"0.5911527",
"0.5907529",
"0.59042865",
"0.5886101",
"0.5867808",
"0.5867808",
"0.58478945",
"0.58472997",
"0.5825821",
"0.5825745",
"0.5825745",
"0.58255124",
"0.58192056",
"0.5816817",
"0.5813998",
"0.5811993",
"0.5807229",
"0.57932585",
"0.5792502",
"0.57909304",
"0.5788136",
"0.57844305",
"0.5778551",
"0.57759345",
"0.5766975",
"0.57649904",
"0.5762513",
"0.5758191",
"0.5758143",
"0.5755593",
"0.57487065",
"0.57415056",
"0.57405216",
"0.5736052",
"0.57351613",
"0.5733326",
"0.5733326",
"0.57325983"
] | 0.7367036 | 0 |
Returns the JWT secret token | def app_jwt_token_secret
Rails.application.secrets.app_jwt_token_secret
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def secret_key\n jwt_config['secret_key']\n end",
"def token\n @token ||= JWT.decode(jwt_string, secret_key, true, verify_expiration: false)\n end",
"def jwt_auth_token( secret )\n\n # expire in 5 minutes\n exp = Time.now.to_i + 5 * 60\n\n # just a standard claim\n exp_payload = { exp: exp }\n\n return JWT.encode exp_payload, secret, 'HS256'\n\n end",
"def token(secret, claims={})\n payload = {}\n payload.merge!(claims)\n puts secret\n JWT.encode payload, [secret].pack('H*').bytes.to_a.pack('c*'), 'HS256'\nend",
"def get_jwt_token\n payload = { data: {user: {id: self.id, email: self.email}} }\n payload[:exp] = (Time.now + Settings.jwt_token_expiry.days).to_i\n\n JWT.encode payload, ENV[\"HMAC_SECRET\"], 'HS256'\n end",
"def generate_jwt\n JWT.encode({ id: id,\n exp: 60.days.from_now.to_i },\n Rails.application.secrets.secret_key_base)\n end",
"def secret\n # EDITOR='code --wait' rails credentials:edit\n # Rails.application.credentials.jwt_secret\n # Use environmental variables for Heroku\n ENV['jwt_secret']\n end",
"def generate_jwt\n JWT.encode({\n id: id, \n exp: 60.days.from_now.to_i\n }, \n Rails.application.secrets.secret_key_base\n )\n end",
"def dev_jwt_token\n JWT.encode(\n {user_id: id},\n Rails.application.secrets.json_web_token_key,\n 'HS256'\n )\n end",
"def decoded_token\n bearer, token = request.authorization.to_s.split\n\n if bearer == \"Bearer\"\n JWT.decode(token, Rails.application.secrets.secret_key_base, true, { algorithm: 'HS256' }).first\n else\n {}\n end\n end",
"def token\n @token ||= HashWithIndifferentAccess.new(\n JWT.decode(authentication_token, secret, true, decode_options).first\n )\n rescue JWT::DecodeError, JWT::ExpiredSignature, JWT::InvalidIatError\n nil\n end",
"def token\n HVCrypto::JWT.encode(self[:token], audience)\n end",
"def token_secret; end",
"def token_secret; end",
"def token_secret; end",
"def verification_token\n JWT.encode({ iat: Time.now.to_i }, config.secret, JWT_ALG)\n end",
"def token_secret; config[:token_secret]; end",
"def secret\n base64_decoded_jwt_secret || client_options.secret\n end",
"def decoded_jwt\n JwtWrapper.decode(\n Base64.decode64(\n Oj.load(\n Base64.decode64(params[\"token\"].split(\"--\").first)\n )[\"_rails\"][\"message\"]\n ).delete_prefix('\"').delete_suffix('\"')\n )[\"value\"]\n rescue\n nil\n end",
"def issue_token(payload)\n JWT.encode(payload, Rails.application.credentials.secret_key_base)\n # JWT.encode(payload, ENV[\"SOME_SECRET\"], ENV[\"SOME_SUPER_SECRET\"])\nend",
"def token\n JWT.encode(claims, rsa_key, 'RS512')\n end",
"def encode_token(payload)\n # Secret environment variable is found in config/application.yml\n JWT.encode(payload, ENV[\"SECRET\"])\n end",
"def generateJWT( email )\n return ({:token => (email + @@secret)}.to_json)\n end",
"def new_jwt\n Knock::AuthToken.new(payload: { sub: current_user.id }).token\n end",
"def get_jwt_token(data)\n payload = {data: data}\n secret_key = GlobalConstant::ExplorerApi.secret_key\n\n JWT.encode(payload, secret_key, 'HS256')\n end",
"def get_token(timestamp = nil)\n self.class.get_token(@secret, timestamp)\n end",
"def get_token\n session[:token] if authorized?\n end",
"def encode_token(payload)\n JWT.encode(payload, 'SECRET')\n end",
"def auth_token \n JWT.encode({id: self.id}, \"9885ea7895518eaf88c4a8a2e8f62c82\")\n end",
"def auth_bypass_token\n JWT.encode(\n {\n \"sub\" => auth_bypass_id,\n \"content_id\" => content_id,\n \"iat\" => Time.zone.now.to_i,\n \"exp\" => 1.month.from_now.to_i,\n },\n Rails.application.secrets.jwt_auth_secret,\n \"HS256\",\n )\n end",
"def auth_bypass_token\n JWT.encode(\n {\n \"sub\" => auth_bypass_id,\n \"content_id\" => content_id,\n \"iat\" => Time.zone.now.to_i,\n \"exp\" => 1.month.from_now.to_i,\n },\n Rails.application.secrets.jwt_auth_secret,\n \"HS256\",\n )\n end",
"def decoded_token\n if auth_header\n # Removed token = auth_header.split(' ')[1] here\n begin\n JWT.decode(auth_header, ENV[\"SECRET\"], true, algorithm: 'HS256')\n rescue JWT::DecodeError\n nil\n end\n end\n end",
"def authToken(secretkey)\n # get 'authToken', {secretkey: secretkey} { |x| x['authToken'] }\n new_auth_token\n end",
"def jwt_key\n 'ec6a8b69ae22049f900af9bd9f14ffb4dc6937f69575ab49b4df2d28364055b8'\n end",
"def decoded_token\n if auth_header\n token = auth_header.split(' ')[1]\n begin\n JWT.decode(token, 'yourSecret', true, algorithm: 'HS256')\n rescue JWT::DecodeError\n nil\n end\n end\n end",
"def auth_token\n JWT.encode({ id: self.id }, '65bc368fbc69306')\n end",
"def get_token\n # Get the user by email\n user = User.find_by_email(params[:email])\n \n # return unauthorized if the user was not found\n if !user \n render json: { error: 'unauthorized' }, status: :unauthorized\n return\n end\n \n # if the user is not authenticated via the authenticate method\n # then return unauthorized\n if !user.authenticate( params[:password] )\n render json: { error: 'unauthorized' }, status: :unauthorized\n return\n end\n \n # if our code gets here, we can generate a token and response.\n # JWT's include an expiry, we will expire the token in 24 hours\n token = jwt_encode({user_id: user.id}, 24.hours.from_now)\n render json: {token: token, exp: 24, username: user.email, userId: user.id},\n status: :ok\n \n end",
"def jwt\n return nil if params.format_version.zero?\n SimpleJWT.new(jwt_data, :mac => mac, :key => key, :key_id => key_id)\n end",
"def token_generate\n res = call('auth.token_generate')\n\n return unless res || res['token']\n\n res['token']\n end",
"def decoded_token\n if token_from_cookie\n token= token_from_cookie\n # byebug\n begin\n JWT.decode(token, Rails.application.credentials.jwt_token, true, algorithm: \"HS256\")\n # JWT.decode => [{ \"user_id\"=>\"2\" }, { \"alg\"=>\"HS256\" }]\n rescue JWT::DecodeError\n nil\n end\n end\n end",
"def get_jwt_token\n private_key = OpenSSL::PKey::RSA.new(GITHUB_PRIVATE_KEY)\n\n payload = {\n # issued at time\n iat: Time.now.to_i,\n # JWT expiration time (10 minute maximum)\n exp: 5.minutes.from_now.to_i,\n # GitHub App's identifier\n iss: GITHUB_APP_ID\n }\n\n JWT.encode(payload, private_key, \"RS256\")\nend",
"def decoded_token\n if auth_header\n # label token from the header of the request, the first word will be Bearer by convention\n # If you send in JUST the token as your Authorization you won't need the split\n token = auth_header.split(' ')[1]\n begin\n # decode the token with your secret password/phrase\n # This sequence is important to have the true and, for now, this algorithm\n # You can look into what they mean on your own, but just know they help JWT stuff work.\n JWT.decode(token, \"put your secret password here\", true, algorithm: 'HS256')\n rescue JWT::DecodeError\n nil\n end\n end\n end",
"def decode(token)\n #return which user is this token???\n JWT.decode(token, secret_key, true, { algorithm: 'HS256' })[0]\n end",
"def encode_token(payload)\n JWT.encode(payload, 'yourSecret')\n end",
"def encode_token(payload) #encodes your username\n JWT.encode(payload, ENV['SECRET'])\n end",
"def oauth_token_secret\n @json['oauthTokenSecret']\n end",
"def token_secret\n config_method_not_implemented\n end",
"def decoded_token\n if token\n begin\n JWT.decode(token, secret, true, {algorithm: algorithm})\n rescue JWT::DecodeError\n return [{}]\n end\n else\n [{}]\n end\n end",
"def decode_token(token_input)\n JWT.decode(token_input, ENV[\"JWT_SECRET\"], true)\n rescue\n render json: {message: \"Unauthorized\"}, status: 401\n end",
"def encode_token(payload) \n # this method takes in a payload (a hash of key/values you want to save in the token) and signs a token using a secret key. (in production this should an ENV variable.)\n JWT.encode(payload, 'yourSecret') \n end",
"def decode(token)\n JWT.decode(token, secret_key, true, { algorithm: 'HS256' })[0]\n end",
"def encode_token(payload)\n JWT.encode(payload, Rails.application.secrets.secret_key_base, 'HS256')\n end",
"def secret\n # ````'badbreathbuffalo'\n\n # Hide in React Auth pt2 1:20:00 \n # ```ENV['jwt_secret']\n # Export in ~/.bash_profile\n # export jwt_secret = 'badbreathbuffalo'\n\n # OR\n\n # $ EDITOR='code --wait' rails credentials:edit\n # Add to the bottom of the file:\n # `jwt_secret: 'badbreathbuffalo'`\n # Save and close the file\n Rails.application.credentials.jwt_secret\n\n # Heroku Config Vars\n # ```ENV['jwt_secret']\n end",
"def token_secret\n ENV['DESK_TOKEN_SECRET']\n end",
"def encode_token(payload)\n JWT.encode(payload, 'secret')\n end",
"def encode_token(payload)\n JWT.encode(payload, \"secret\")\n end",
"def access_token_secret\n credentials['secret']\n end",
"def token\n Pillowfort::Helpers::DeprecationHelper.warn(self.class.name, :token, :secret)\n send(:secret)\n end",
"def current_jwt_token\n @jwt_auth ||= session[:jwt_auth] ? JwtToken.where(id: session[:jwt_auth]).first : nil\n end",
"def decode(token)\n JWT.decode(token, secret_key, true, {algorithm: 'HS256'})[0]\n end",
"def decode(token)\n JWT.decode(token, secret_key, true, {algorithm: \"HS256\"})[0]\n end",
"def decoded_token\n if auth_header\n token = auth_header.split(' ')[1]\n begin\n token = JWT.decode token, Rails.application.credentials.jwt_secret,\n true,\n { algorithm: 'HS256' }\n token&.first['jti']\n rescue JWT::DecodeError\n nil\n end\n end\n end",
"def authentication_token\n @authentication_token ||= JWT.encode(payload, secret, algorithm)\n end",
"def token\n if request.headers[\"Authorization\"].present?\n if !login_from_authorization(request.headers['Authorization'].split(\" \")[1])\n response.set_header('WWW-Authenticate', \"Basic realm=\\\"red\\\"\")\n render json: {\"errors\":[{\"code\":\"UNAUTHORIZED\"}]} , status: 401\n return\n end\n else\n render json: {}, status: 401\n return\n end\n\n token = Portus::JwtToken.new(params[:account], params[:service], authorize_scopes)\n logger.tagged(\"jwt_token\", \"claim\") { logger.debug token.claim }\n render json: token.encoded_hash\n end",
"def decode(token)\n body = JWT.decode(token, Rails.application.secrets.secret_key_base)[0]\n HashWithIndifferentAccess.new body\n rescue\n nil\n end",
"def decode(token)\n JWT.decode(token, secret_key, true, { algorithm: 'HS256' })[0]\n end",
"def token\n bearer = request.headers[\"HTTP_AUTHORIZATION\"]\n\n # allows our tests to pass\n bearer ||= request.headers[\"rack.session\"].try(:[], 'Authorization')\n\n if bearer.present?\n bearer.split.last\n else\n nil\n end\n end",
"def token\n bearer = request.headers[\"HTTP_AUTHORIZATION\"]\n\n # allows our tests to pass\n bearer ||= request.headers[\"rack.session\"].try(:[], 'Authorization')\n\n if bearer.present?\n bearer.split.last\n else\n nil\n end\n end",
"def to_token_payload\n payload = {}\n # std jwt claims\n payload['sub'] = id.to_s\n payload['iat'] = Time.now.utc.to_i\n payload['iss'] = Rails.application.secrets.jwt_issuer\n # sombra claims\n payload['role'] = role\n payload['name'] = name\n payload\n end",
"def token\n @token ||= begin\n token = redis_client.get\n\n return token if token.present?\n\n resp = chip_client.token\n\n Oj.load(resp.body)&.fetch('token').tap do |jwt_token|\n redis_client.save(token: jwt_token)\n end\n end\n end",
"def decode(token)\n JWT.decode(token, secret_key, true, {algorithm: \"HS512\"})[0]\n end",
"def decodeJWT(token)\n# puts token\n payload = JWT.decode(token, Rails.application.secrets.secret_key_base, \"HS512\")\n# puts payload\n if payload[0]['exp'] >= Time.now.to_i\n payload\n else\n puts 'time expired on login'\n false\n end\n# catch the error if token is wrong\n rescue => error\n puts error\n nil\n end",
"def token\r\n bearer = request.headers[\"HTTP_AUTHORIZATION\"]\r\n\r\n # allows our tests to pass\r\n bearer ||= request.headers[\"rack.session\"].try(:[], 'Authorization')\r\n\r\n if bearer.present?\r\n bearer.split.last\r\n else\r\n nil\r\n end\r\n end",
"def get_OAuthTokenSecret()\n \t return @outputs[\"OAuthTokenSecret\"]\n \tend",
"def decode(token)\n JWT.decode(token, HMAC_SECRET)\n end",
"def payload\n auth_header = request.headers['Authorization']\n token = auth_header.split(' ').last\n JwtTokenLib.decode(token)\n rescue StandardError => _\n nil\n end",
"def decode(token)\n body = JWT.decode(\n token,\n Rails.application.secrets.secret_key_base,\n true,\n algorithm: 'HS256'\n )[0]\n HashWithIndifferentAccess.new body\n rescue\n nil\n end",
"def token_secret=(_arg0); end",
"def token_secret=(_arg0); end",
"def token_secret=(_arg0); end",
"def jwt_payload\n jwt_token.match(/\\.(\\w+\\.\\w+)/)[1]\n end",
"def generate_token\n jwt_secret = CLIENT_SECRET\n header = {\n typ: \"JWT\",\n alg: TOKEN_ALG\n }\n current_timestamp = DateTime.now.strftime(\"%Q\").to_i / 1000.floor\n data = {\n iss: SERVICE_ID,\n iat: current_timestamp\n }\n stringified_header = header.to_json.encode(\"UTF-8\")\n encoded_header = base64url(stringified_header)\n stringified_data = data.to_json.encode(\"UTF-8\")\n encoded_data = base64url(stringified_data)\n token = \"#{encoded_header}.#{encoded_data}\"\n signature = OpenSSL::HMAC.digest(\"SHA256\", jwt_secret, token)\n signature = base64url(signature)\n signed_token = \"#{token}.#{signature}\"\n signed_token\n end",
"def decode_token\n #token in header\n if auth_header\n #JWT as a string \n token = auth_header.split(' ')[1]\n #header: { 'Authorization': 'Bearer <token>' }\n #begin/rescue allows us to rescue out of an exception in Ruby \n begin\n #JWT as a string, app secret, and hashing algorithm\n JWT.decode(token, 'my_s3cr3t', true, algorithm: 'HS256')\n rescue JWT::DecodeError\n nil\n end\n end\n end",
"def issue_token payload\n JWT.encode(payload, secret, algorithm)\n end",
"def secret_key\n credentials['secret_key']\n end",
"def secret_key\n credentials['secret_key']\n end",
"def token\n authenticated\n end",
"def generate_jwt(expires_in: nil)\n SolidusJwt.encode(payload: as_jwt_payload, expires_in: expires_in)\n end",
"def jwt_payload\n @jwt_payload ||= request.env['JWT_PAYLOAD']\n end",
"def original_request_jwt\n env['grape_jwt_auth.original_token']\n end",
"def decode(token)\n body = JWT.decode(token, Rails.application.secrets.secret_key_base)[0]\n HashWithIndifferentAccess.new body\n rescue\n nil\n end",
"def make_jwt\n token_payload = {\n 'tmcusr' => @username,\n 'tmctok' => @tmc_token,\n 'tmcuid' => @tmc_user_id,\n 'tmcadm' => @is_tmc_admin,\n 'exp' => @expires.to_i\n }\n jwt_string = JWT.encode(token_payload, @@jwt_secret, JWT_HASH_ALGO)\n jwt_string\n end",
"def token(expiration=nil)\n expiration ||= 1\n payload = {\n data: {\n id: id,\n discriminator: password_digest\n # discriminator used to detect password changes after token generation\n },\n exp: Time.now.to_i + expiration * 60 * 60\n }\n # HMAC using SHA-512 algorithm\n JWT.encode payload, User.hmac_key, 'HS512'\n end",
"def encode_token(payload)\n # I expect something like payload => { userid: int }\n JWT.encode(payload, Rails.application.secrets.secret_key_base)\n end",
"def encode_token(payload)\n #PAYLOAD => {salad: 'tomatoes'}\n JWT.encode(payload, ENV[\"JWT_SECRET\"])\n #jwt string: 'hdjgjdkgjgjsetc...'\n end",
"def decodeJWT(token)\n payload = JWT.decode(token, Rails.application.secrets.secret_key_base, \"HS512\")\n #Kontrollerar tiden på token\n if payload[0][\"exp\"] >= Time.now.to_i\n payload\n else\n puts \"The token has expired, please log in again to get a new one\"\n false\n end\n #Fångar felet om token var fel\n rescue => error\n puts error\n nil\n end",
"def wtk\n MnoEnterprise.jwt(user_id: current_user.uid)\n end",
"def token\n @api.get(\"#{Paths::TOKENS}\")\n end",
"def payload\n auth_header = request.headers['Authorization']\n token = auth_header.split(' ').last\n JsonWebToken.decode(token)\n rescue\n nil\n end",
"def payload\n auth_header = request.headers['Authorization']\n token = auth_header.split(' ').last\n JsonWebToken.decode(token)\n rescue\n nil\n end"
] | [
"0.8322586",
"0.82596344",
"0.8209815",
"0.81041306",
"0.7801555",
"0.7672593",
"0.76580507",
"0.7597972",
"0.7572802",
"0.75662464",
"0.7505271",
"0.750182",
"0.74904364",
"0.74904364",
"0.74904364",
"0.74458724",
"0.7396309",
"0.73956704",
"0.7382424",
"0.7374001",
"0.7368634",
"0.73684186",
"0.736482",
"0.7362658",
"0.73305655",
"0.7326433",
"0.73069847",
"0.72983944",
"0.72958934",
"0.72685325",
"0.72685325",
"0.7243971",
"0.7229312",
"0.7222645",
"0.7203589",
"0.720294",
"0.72025985",
"0.71896416",
"0.7181457",
"0.7171336",
"0.7128539",
"0.712825",
"0.7108652",
"0.70999795",
"0.70871645",
"0.70612675",
"0.7060639",
"0.7053653",
"0.70384103",
"0.7031518",
"0.7025527",
"0.7017651",
"0.70138925",
"0.69944674",
"0.69880414",
"0.6986167",
"0.6981091",
"0.69787395",
"0.6967527",
"0.6955214",
"0.6932192",
"0.69288504",
"0.69261533",
"0.692333",
"0.692089",
"0.69021684",
"0.69018626",
"0.69018626",
"0.6887977",
"0.68837446",
"0.6873704",
"0.6872083",
"0.68568313",
"0.6853096",
"0.685214",
"0.68478155",
"0.6834741",
"0.68302214",
"0.68302214",
"0.68302214",
"0.6825638",
"0.6824087",
"0.68003845",
"0.6747776",
"0.6741221",
"0.6741221",
"0.67406315",
"0.67289263",
"0.6728836",
"0.67196167",
"0.67190844",
"0.6705808",
"0.66765076",
"0.66694933",
"0.6668344",
"0.6664472",
"0.6634838",
"0.6634497",
"0.6616475",
"0.6616475"
] | 0.7923671 | 4 |
=begin rdoc Fork and start a Webrick instance running the LocalHttpd::WebApp application. =end | def start
@pid = Process.fork do
if (@options.rack)
# NOTE: This does not support command-line setting of repo!
opts = { :server => :webrick, :host => @host, :port => @port}
PlanR::Application::LocalHttpd::WebApp.run!( repo, opts )
else
# rack doesn't do the one thing we need it to:
# pass WebApp instantiation arguments to Webrick.mount
opts = { :BindAddress => @host, :Port => @port}
@webrick = ::WEBrick::HTTPServer.new(opts)
@webrick.mount "/", Servlet,
[ PlanR::Application::LocalHttpd::WebApp,
@options ]
@webrick.start
end
end
trap('INT') { Process.kill 'INT', @pid }
trap('TERM') { Process.kill 'INT', @pid }
self
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def start\n UI.info \"Starting up WEBrick...\"\n if running?\n UI.error \"Another instance of WEBrick::HTTPServer is running.\"\n false\n else\n @pid = Spoon.spawnp('ruby',\n File.expand_path(File.join(File.dirname(__FILE__), %w{webrick server.rb})),\n @options[:host],\n @options[:port].to_s,\n @options[:ssl].to_s,\n @options[:docroot]\n )\n wait_for_port\n if @options[:launchy]\n scheme = options[:ssl] ? \"https\" : \"http\"\n Launchy.open(\"#{scheme}://#{@options[:host]}:#{@options[:port]}\")\n @options[:launchy] = false # only run once\n end\n @pid\n end\n end",
"def run_webrick(config = {})\n config.update :Port => 8080\n server = HTTPServer.new config\n yield server if block_given?\n [\"INT\", \"TERM\"].each { |signal| trap(signal) { server.shutdown } }\n server.start\nend",
"def start_webrick(config = {})\n config.update(:Port => 8080) \n server = HTTPServer.new(config)\n yield server if block_given?\n ['INT', 'TERM'].each {|signal| \n trap(signal) {server.shutdown}\n }\n server.start\n\nend",
"def start_webserver\n stop_webserver\n Webserver.run!\n end",
"def start\n # we trap CTRL+C in the console and kill the server\n trap(\"INT\") { BeEF::Core::Server.instance.stop }\n \n # starts the web server\n @http_server.start\n end",
"def start_app\nend",
"def run_app\n http_config = config.http\n\n @server_thread = Thread.new do\n @server = Puma::Server.new(app)\n begin\n @server.add_tcp_listener(http_config.host, http_config.port.to_i)\n rescue Errno::EADDRINUSE, Errno::EACCES => e\n logger.fatal I18n.t(\n \"lita.http.exception\",\n message: e.message,\n backtrace: e.backtrace.join(\"\\n\")\n )\n abort\n end\n @server.min_threads = http_config.min_threads\n @server.max_threads = http_config.max_threads\n @server.run\n end\n\n @server_thread.abort_on_exception = true\n end",
"def run_application\n if Souffle::Config[:daemonize]\n Souffle::Config[:server] = true\n Souffle::Daemon.daemonize(\"souffle\")\n end\n @app.run\n end",
"def start(foreground = false)\n server_class = RailsInstaller::WebServer.servers[config['web-server']]\n if not server_class\n message \"** warning: web-server #{config['web-server']} unknown. Use 'web-server=external' to disable.\"\n end\n \n server_class.start(self,foreground)\n end",
"def start\n raise ArgumentError, 'app required' unless @app\n\n log \">> Aspen web server (#{::Aspen::SERVER})\"\n debug \">> Debugging ON\"\n trace \">> Tracing ON\"\n\n log \">> Listening on #{@host}:#{@port}, CTRL+C to stop\"\n\n @backend.start\n end",
"def run_server\n EM.synchrony do\n @app = Rack::Builder.new do\n use Rack::Lint\n use Rack::ShowExceptions\n run Rack::Cascade.new([Souffle::Http])\n end.to_app\n\n Rack::Handler.get(:thin).run(@app, rack_options)\n end\n end",
"def start_server\n begin\n require 'webrick'\n rescue LoadError\n abort \"webrick is not found. You may need to `gem install webrick` to install webrick.\"\n end\n\n server = WEBrick::HTTPServer.new :Port => @server\n\n extra_doc_dirs = @stores.map {|s| s.type == :extra ? s.path : nil}.compact\n\n server.mount '/', RDoc::Servlet, nil, extra_doc_dirs\n\n trap 'INT' do server.shutdown end\n trap 'TERM' do server.shutdown end\n\n server.start\n end",
"def start!(port = 8080)\n $app = HttpApp.new do |app|\n app.torrent_manager = @torrent_manager\n app.tv = TorrentView.new(@torrent_manager)\n end\n Thin::Server.start('127.0.0.1', port) do\n map '/' do\n run $app\n end\n end\n end",
"def start\n #Start the appserver.\n print \"Spawning appserver.\\n\" if @debug\n @httpserv = Knjappserver::Httpserver.new(self)\n \n \n #Start Leakproxy-module if defined in config.\n if @config[:leakproxy]\n require \"#{File.dirname(__FILE__)}/class_knjappserver_leakproxy_server.rb\"\n @leakproxy_server = Knjappserver::Leakproxy_server.new(:kas => self)\n end\n \n \n STDOUT.print \"Starting appserver.\\n\" if @debug\n Thread.current[:knjappserver] = {:kas => self} if !Thread.current[:knjappserver]\n \n if @config[:autoload]\n STDOUT.print \"Autoloading #{@config[:autoload]}\\n\" if @debug\n require @config[:autoload]\n end\n \n begin\n @threadpool.start if @threadpool\n STDOUT.print \"Threadpool startet.\\n\" if @debug\n @httpserv.start\n STDOUT.print \"Appserver startet.\\n\" if @debug\n rescue Interrupt => e\n STDOUT.print \"Got interrupt - trying to stop appserver.\\n\" if @debug\n self.stop\n raise e\n end\n end",
"def start\n\tcase @server\n\twhen 'agoo'\n\t require 'wab/impl/agoo'\n\t WAB::Impl::Agoo::Server::start(self)\n\twhen 'sinatra'\n\t require 'wab/impl/sinatra'\n\t WAB::Impl::Sinatra::Server::start(self)\n\telse\n\t require 'wab/impl/webrick'\n\t WAB::Impl::WEBrick::Server::start(self)\n\tend\n end",
"def start\n if @options[:\"disable-watcher\"]\n bootup\n else\n @server_job = fork {\n Signal.trap(::Middleman::WINDOWS ? :KILL : :TERM) { exit! }\n bootup\n }\n end\n end",
"def start_web\n pid = fork { Play::Library.monitor }\n Process.detach(pid)\n\n puts \"play is running on http://localhost:5050\"\n system(\"unicorn -c #{File.dirname(__FILE__)}/../config/unicorn.rb\")\nend",
"def start!\n http_server.start\n self\n end",
"def start(controller = Stream::StreamController.instance)\n # make sure all the keys are set\n validate_keys\n\n options = update_config_options\n\n # create a new server\n @server = WEBrick::HTTPServer.new(Port: options[:port])\n\n # start singleton stream controller\n @controller = controller.start\n\n # mount the REST server on webrick\n @server.mount '/', Http::HttpEndpoint\n\n trap_signals\n\n logger.info(\"Server starting with PID #{Process.pid}\")\n\n @server.start\n end",
"def start\n config = { :Port => @port }\n @server = WEBrick::HTTPServer.new(config)\n @server.mount(\"/\", SimplerDB::RESTServlet)\n \n ['INT', 'TERM'].each do |signal| \n trap(signal) { @server.shutdown }\n end\n \n @server.start\n end",
"def run opts = {}\n server = opts.delete(:server)\n (server && Rack::Handler.const_defined?(server)) || (server = HTTP__DEFAULT_SERVER)\n\n port = opts.delete(:port)\n opts[:Port] ||= port || HTTP__DEFAULT_PORT\n\n host = opts.delete(:host) || opts.delete(:bind)\n opts[:Host] = host if host\n\n Rack::Handler.const_get(server).run app, opts\n end",
"def run opts = {}\n boot!\n\n handler = opts.delete(:server)\n (handler && Rack::Handler.const_defined?(handler)) || (handler = HTTP__DEFAULT_SERVER)\n\n port = opts.delete(:port)\n opts[:Port] ||= port || HTTP__DEFAULT_PORT\n\n host = opts.delete(:host) || opts.delete(:bind)\n opts[:Host] = host if host\n\n $stderr.puts \"\\n--- Starting Espresso for %s on %s port backed by %s server ---\\n\\n\" % [\n environment, opts[:Port], handler\n ]\n Rack::Handler.const_get(handler).run app, opts do |server|\n %w[INT TERM].each do |sig|\n Signal.trap(sig) do\n $stderr.puts \"\\n--- Stopping Espresso... ---\\n\\n\"\n server.respond_to?(:stop!) ? server.stop! : server.stop\n end\n end\n server.threaded = opts[:threaded] if server.respond_to? :threaded=\n yield server if block_given?\n end\n end",
"def start( configuration = {}, &block )\n this = self\n debug = !!configuration.fetch(:debug, true)\n root = configuration.fetch(:root, \"/\" )\n type = configuration.fetch(:type, debug ? \"webrick\" : \"fcgi\")\n port = configuration.fetch(:port, debug ? 8989 : nil )\n host = configuration.fetch(:host, debug ? \"localhost\" : nil )\n \n desc = Rack::Builder.new do\n use Rack::CommonLogger\n use Rack::ContentLength\n if debug then\n use Rack::ShowExceptions\n end\n \n instance_eval(&block) if block\n\n map root do\n run this\n end\n end\n \n Rack::Server.start(:app => desc.to_app, :server => type, :Port => port, :Host => host)\n end",
"def runserver!(host: '127.0.0.1', port: '3456')\n configure!(mode: :server, target: :development)\n status = 0 # running: 0, reload: 1, exit: 2\n # spawn a thread to watch the status flag and trigger a reload or exit\n monitor = Thread.new do\n sleep 0.1 while status.zero?\n # Shutdown the server, wait for it to finish and then wait a tick\n Rack::Handler::WEBrick.shutdown\n sleep 0.1\n # Use ps to get the command that the user executed, and use Kernel.exec\n # to execute the command, replacing the current process.\n # Basically restart everything.\n Kernel.exec(`ps #{$PID} -o command`.split(\"\\n\").last) if status == 1\n end\n\n # trap ctrl-c and set status flag\n trap('SIGINT') do\n if status == 1\n status = 2 # ctrl-c hit twice or more, set status to exit\n elsif status.zero?\n # ctrl-c hit once, notify user and set status to reload\n puts \"\\nReloading the server, hit ctrl-c twice to exit\\n\"\n status = 1\n end\n end\n\n puts \"\\nStarting Dev server, hit ctrl-c once to reload, twice to exit\\n\"\n require 'webrick/accesslog'\n access_log = [[$stderr, WEBrick::AccessLog::COMMON_LOG_FORMAT]]\n Rack::Handler::WEBrick.run(self, Host: host, Port: port, AccessLog: access_log)\n monitor.join # let the monitor thread finish its work\n end",
"def start\n api = @settings[:api] || {}\n bind = api[:bind] || \"0.0.0.0\"\n port = api[:port] || 4567\n start_http_server(bind, port)\n super\n end",
"def start_httpd( config_file )\n\t\t#$stderr.close\n\t\t#$stderr.reopen( $stdout )\n\n\t\tconfig_file = File.expand_path( config_file )\n\n\t\tcommand = [ @exe, '-F', '-f', config_file ]\n\t\t$stderr.puts \"Starting server with: #{command.join(' ')}\" if $DEBUG\n\t\texec( *command )\n\tend",
"def start()\n mime_types = WEBrick::HTTPUtils::DefaultMimeTypes\n mime_types['es6'] = 'application/javascript'\n server = WEBrick::HTTPServer.new(Port: @http_port,\n DocumentRoot: @http_dir,\n MimeTypes: mime_types)\n server.logger.level = 5 - @logger.level unless @logger.nil?\n server.mount(@pre_path, Handler, self)\n server.mount('/', ExportProxy, @http_dir) if @export_proxy\n\n trap 'INT' do server.shutdown end\n server.start\n end",
"def startServer(params)\n @@server = HTTPServer.new(\n :Port => params[:webPort] || DEF_WEB_PORT,\n :Logger => Log4r::Logger.new(\"#{MObject.logger.fullname}::web\"),\n :RequestHandler => lambda {|req, resp|\n beforeRequestHook(req, resp)\n }\n )\n trap(\"INT\") { @@server.shutdown }\n\n path = File.dirname(params[:configDir]) + \"/favicon.ico\"\n @@server.mount(\"/favicon.ico\", HTTPServlet::FileHandler, path) {\n raise HTTPStatus::NotFound, \"#{path} not found.\"\n }\n @@server.mount_proc('/') {|req, res|\n res['Content-Type'] = \"text/xml\"\n body = [%{<?xml version='1.0'?><serviceGroups>}]\n @@registeredServices.each {|path, service|\n info = service.info\n name = service.serviceName\n body << \"<serviceGroup path='#{path}' name='#{name}'><info>#{info}</info></serviceGroup>\"\n }\n body << \"</serviceGroups>\"\n res.body = body.to_s\n }\nend",
"def bootup\n env = (@options[:environment] || \"development\").to_sym\n is_logging = @options.has_key?(:debug) && (@options[:debug] == \"true\")\n app = ::Middleman.server.inst do\n set :environment, env\n set :logging, is_logging\n end\n \n app_rack = app.class.to_rack_app\n \n opts = @options.dup\n opts[:app] = app_rack\n opts[:logging] = is_logging\n puts \"== The Middleman is standing watch on port #{opts[:port]||4567}\"\n ::Middleman.start_server(opts)\n end",
"def run\n start\n jetty.join\n end",
"def start\n if running?\n stop\n else\n File.unlink(\"#{@server_root}/httpd.pid\") rescue nil\n end\n\n if @codesigning_identity\n system \"codesign\", \"-s\", @codesigning_identity, \"--keychain\", File.expand_path(\"~/Library/Keychains/login.keychain-db\"), @mod_passenger\n end\n\n if File.exist?(@server_root)\n FileUtils.rm_r(@server_root)\n end\n FileUtils.mkdir_p(@server_root)\n write_config_file\n FileUtils.cp(\"#{STUB_DIR}/mime.types\", @server_root)\n\n command = [PlatformInfo.httpd, \"-f\", \"#{@server_root}/httpd.conf\", \"-k\", \"start\"]\n if boolean_option('VALGRIND')\n command = ['valgrind', '--dsymutil=yes', '--vgdb=yes',\n '--vgdb-error=1', '--trace-children=no'] + command\n end\n\n if !system(*command)\n raise \"Could not start an Apache server.\"\n end\n\n begin\n # Wait until the PID file has been created.\n Timeout::timeout(20) do\n while !File.exist?(\"#{@server_root}/httpd.pid\")\n sleep(0.1)\n end\n end\n # Wait until Apache is listening on the server port.\n Timeout::timeout(7) do\n done = false\n while !done\n begin\n socket = TCPSocket.new('localhost', @port)\n socket.close\n done = true\n rescue Errno::ECONNREFUSED\n sleep(0.1)\n end\n end\n end\n rescue Timeout::Error\n raise \"Could not start an Apache server.\"\n end\n Dir[\"#{@server_root}/*\"].each do |filename|\n if File.file?(filename)\n File.chmod(0666, filename)\n end\n end\n end",
"def start_server!\n httpd_root = \"#{__dir__}/fixtures/httpd\"\n\n # The command to start the server must reset the BUNDLE_GEMFILE environment\n # setting.\n # command = \"cd ../simple-httpd/ && BUNDLE_GEMFILE= PORT=12345 bin/simple-httpd start #{httpd_root} -q\" \n command = \"PORT=12345 bundle exec simple-httpd start #{httpd_root}\" \n command = \"#{command} -q 2> log/simple-httpd.log\" \n\n ::RSpec::Httpd::Server.start! port: PORT, command: command\n end",
"def start_server(port)\n root = Dir.getwd\n server = WEBrick::HTTPServer.new :Port => port, :DocumentRoot => root\n trap 'INT' do server.shutdown end\n server.start\n end",
"def launch_web\n if !File.exist? 'build/app.html'\n puts \"No web app built!\"\n exit\n end\n open_cmd = 'open'\n case RUBY_PLATFORM\n when /linux/\n open_cmd = \"xdg-#{open_cmd}\"\n when /mingw/\n open_cmd = \"start\"\n end\n system \"#{open_cmd} build/app.html\"\nend",
"def run opts = {}\n server = opts.delete(:server)\n server && ::Rack::Handler.const_defined?(server) || server = :WEBrick\n ::Rack::Handler.const_get(server).run builder, opts\n end",
"def start_apps\n check_apps\n remove_sockets\n _start_apps(ARGV[1])\nend",
"def start\n puts 'Booting BubBot'\n Thread.new do\n loop do\n #puts \"Checking for servers to shutdown\"\n # TODO: actually do that ^\n sleep 10# * 60\n end\n end\n\n app = Rack::Builder.new do\n # if development (TODO)\n use Rack::Reloader\n # end\n run BubBot\n end.to_app\n\n Rack::Handler::Thin.run(app, BubBot.configuration.rack_options_hash)\n end",
"def launch_web\n if !File.exists? 'build/app.html'\n puts \"No web app built!\"\n exit\n end\n open_cmd = 'open'\n case RUBY_PLATFORM\n when /linux/\n open_cmd = \"xdg-#{open_cmd}\"\n when /mingw/\n open_cmd = \"start\"\n end\n system \"#{open_cmd} build/app.html\"\nend",
"def runFileServer\n @@servlet = FileServlet.new(@@self_port)\n \n Thread.start {\n @@servlet.start() \n }\n \nend",
"def start(app, app_id = nil)\n defer = @web.defer\n app_id = app_id || AppStore.lookup(app)\n\n if app_id != nil && @status == :running\n @web.schedule do\n bindings = @bindings[app_id] ||= []\n starting = []\n\n bindings.each do |binding|\n starting << binding.bind\n end\n defer.resolve(::Libuv::Q.all(@web, *starting))\n end\n elsif app_id.nil?\n defer.reject('application not loaded')\n else\n defer.reject('server not running')\n end\n\n defer.promise\n end",
"def run\n configure_middleware(rack_builder = Rack::Builder.new)\n rack_builder.run(rack_app)\n\n # Choose and start a Rack handler\n @context.running_server = available_server\n @context.running_server.run rack_builder.to_app, :Host => @context.host, :Port => @context.port do |server|\n [:INT, :TERM].each {|sig| trap(sig) { (server.respond_to? :stop!) ? server.stop! : server.stop } }\n puts \"A#{'n' if @environment =~ /\\A[aeiou]/} #{@environment} Tanuki appears! Press Ctrl-C to set it free.\",\n \"You used #{@context.running_server.name.gsub(/.*::/, '')} at #{@context.host}:#{@context.port}.\"\n end\n end",
"def start_server\n if ENV['RACK_ENV'] == 'production'\n run APP\n else\n Rack::Server.start(\n app: APP,\n Port: $PORT\n )\n end\nend",
"def start_with_tork\n load_tork\n\n if fork\n start_loop\n else\n # Run tork in main process to keep stdin\n Torkify.logger.info { \"Starting tork\" }\n Tork::CLIApp.new.loop\n end\n end",
"def run_default_server(app, port, &block)\n begin\n require 'rack/handler/thin'\n Thin::Logging.silent = true\n Rack::Handler::Thin.run(app, :Port => port, &block)\n rescue LoadError\n require 'rack/handler/webrick'\n Rack::Handler::WEBrick.run(app, :Port => port, :AccessLog => [], :Logger => WEBrick::Log::new(nil, 0), &block)\n end\n end",
"def setup_server\n ENV[\"RAILS_ENV\"] = \"test\"\n require \"rails\"\n fork do\n exec \"cd test/rails#{Rails::VERSION::MAJOR}_dummy && COVERBAND_TEST=test bundle exec rackup config.ru -p 9999 --pid /tmp/testrack.pid\"\n end\n end",
"def start\n [:INT, :TERM, :ABRT].each{|signal|Signal.trap(signal, ->{stop})}\n\n connector = SelectChannelConnector.new\n connector.port = http_port\n connector.confidential_port = https_port if https_port\n\n jetty.add_connector connector\n jetty.start\n end",
"def call(env)\n (@web_server ||= WebServer.new).call(env)\n end",
"def rackup(app); return @@rack.call(app); end",
"def load_server(app = T.unsafe(nil)); end",
"def load_server(app = T.unsafe(nil)); end",
"def run\n trap('INT') { http_server.shutdown }\n http_server.start\n end",
"def start(*mounts, environment: \"development\", services: nil)\n host = ENV[\"HOST\"] || \"127.0.0.1\"\n port = Integer(ENV[\"PORT\"] || 8181)\n\n prepare_environment!(environment: environment)\n\n app = build_app!(mounts: mounts, services: services)\n logger.info \"start to listen on #{mounts.inspect}\"\n ::Simple::Httpd.listen!(app, environment: environment,\n host: host,\n port: port)\n end",
"def server(port = 9319)\r\n puts \"- Starting server on port: #{port}\"\r\n\r\n $servers[port] = WEBrick::HTTPServer.new(:Port => port) if $servers[port].nil?\r\n server = $servers[port]\r\n $mounts.keys.each{|url|\r\n server.unmount(url)\r\n server.mount(url, $mounts[url][0], *$mounts[url][1])\r\n }\r\n $mounts.clear\r\n\r\n Thread.new { server.start unless server.status == :Running }\r\nend",
"def start\n raise \"ferret_server not configured for #{RAILS_ENV}\" unless (@cfg.uri rescue nil)\n platform_daemon { run_drb_service }\n end",
"def setup_application\n Souffle::Daemon.change_privilege\n Souffle::Config[:server] = true if Souffle::Config[:daemonize]\n @app = Souffle::Server.new\n end",
"def start_server_at( screen_name, port = \"\" )\n %x( screen -S #{screen_name} -X python -m SimpleHTTPServer #{port} )\nend",
"def start_app_manager_server\n @state = \"Starting up AppManager\"\n env_vars = {}\n start_cmd = [\"/usr/bin/python #{APPSCALE_HOME}/AppManager/app_manager_server.py\"]\n stop_cmd = \"/usr/bin/pkill -9 app_manager_server\"\n port = [AppManagerClient::SERVER_PORT]\n MonitInterface.start(:appmanagerserver, start_cmd, stop_cmd, port, env_vars)\n end",
"def hot_restart\n fork do\n # Let the new server know where to find the file descriptor server\n ENV[FILE_DESCRIPTOR_SERVER_VAR] = file_descriptor_server.socket_path\n\n Dir.chdir(ENV['APP_ROOT']) if ENV['APP_ROOT']\n ENV.delete('BUNDLE_GEMFILE') # Ensure a fresh bundle is used\n\n exec(\"bundle exec #{server_configuration.start_command}\")\n end\n end",
"def start\n # the above only accepts 1 requiest. it will stop after receiving a request\n # in order to enable the server to accept more than 1 request, you need to create a loop\n loop do\n # this is an infinite loop.. this can now accept multiple vars and it will ahve separate objects per request\n # once the server socket is ready..\n # we need to tell the server socket that we're ready to accept a connection\n # the #accept method accepts the next incoming connection or it will block if there are no incoming connections at teh moment\n # it will #accept once it arrives\n # this is the socket / connetiont at we have to teh remote browser\n socket = @server.accept # THIS IS THE CLIENT SOCKET\n puts \"this is the socket var: \" + @socket.inspect\n # let's start the new conneciton inside a thread\n # NOTE: there's a big performance and memory penalty for creating a new thread => needs to put a bunch of memory\n # to increase the performance, they initialize threads and then store those threads in a $\"thread pool\" => ie. instead of initializign new threads, it leverages existing threads\n # doing what you did below slows down the server significantly\n # apache, nginx, unicorn => prefork model\n # => fork meaning it will fork right afte rthe server socket initialization (see above in TCPServer) => 2 parts: main server socket in the master process and we will make child processes by calling a method called fork. it copies the the main process and it will $share the sockets from the master process\n # to the child proceess\n Thread.new do\n # create a new isntance of the connneciton class\n connection = Connection.new(socket, @app) # now we have access to the rack application instance inside our Connection \n connection.process\n end\n end\n end",
"def app; end",
"def app; end",
"def app; end",
"def app; end",
"def app; end",
"def app; end",
"def app; end",
"def app; end",
"def app; end",
"def app; end",
"def start\n flags = \"--config config/puma.rb --pidfile #{PID_FILE}\"\n system \"puma #{flags} > /dev/null 2>&1\"\n sleep(0.1)\n rails?\n end",
"def start_server\n erl = CliRunner.open 'skirmish_server', 'erl', /\\d>/, /Eshell/\n erl << \"code:add_path(\\\"#{server_dir}/ebin\\\").\" >> /true/\n erl << \"application:start(skirmish_server).\" >> /ok/\n @automation_server = erl\n log.info(\"Automation#start_server\") { \"server started\" }\n end",
"def start\n\n # load config files\n @httpd_conf.load \n @mimes.load\n # initialze logger \n logger = Logger.new(@httpd_conf.logfile) \n Thread.abort_on_exception=true\n \n loop do\n puts \"Opening server socket to listen for connections\"\n\n # handle incoming request\n Thread.start(server.accept) do |client|\n worker = Worker.new(client,@httpd_conf,@mimes,logger) \n worker.handle_request\n end\n end\n\n end",
"def add_appserver_process(app_id, secret)\n if !valid_secret?(secret)\n return BAD_SECRET_MSG\n end\n\n # Starting a appserver instance on request to scale the application \n app = app_id\n @state = \"Adding an AppServer for #{app}\"\n\n uac = UserAppClient.new(@userappserver_private_ip, @@secret)\n app_manager = AppManagerClient.new(my_node.private_ip)\n\n warmup_url = \"/\"\n\n app_data = uac.get_app_data(app)\n \n Djinn.log_debug(\"Get app data for #{app} said [#{app_data}]\")\n\n loop {\n Djinn.log_info(\"Waiting for app data to have instance info for app named #{app}: #{app_data}\")\n\n app_data = uac.get_app_data(app)\n if app_data[0..4] != \"Error\"\n break\n end\n Kernel.sleep(5)\n }\n \n app_language = app_data.scan(/language:(\\w+)/).flatten.to_s\n my_public = my_node.public_ip\n my_private = my_node.private_ip\n\n app_is_enabled = uac.does_app_exist?(app)\n Djinn.log_debug(\"is app #{app} enabled? #{app_is_enabled}\")\n if app_is_enabled == \"false\"\n return \n end\n\n appengine_port = find_lowest_free_port(STARTING_APPENGINE_PORT)\n Djinn.log_debug(\"Adding #{app_language} app #{app} on \" +\n \"#{HelperFunctions.local_ip}:#{appengine_port} \")\n\n xmpp_ip = get_login.public_ip\n\n result = app_manager.start_app(app, appengine_port, get_load_balancer_ip(),\n app_language, xmpp_ip, [Djinn.get_nearest_db_ip()],\n HelperFunctions.get_app_env_vars(app))\n\n if result == -1\n Djinn.log_error(\"ERROR: Unable to start application #{app} on port \" +\n \"#{appengine_port}.\")\n end\n\n # Tell the AppController at the login node (which runs HAProxy) that a new\n # AppServer is running.\n acc = AppControllerClient.new(get_login.private_ip, @@secret)\n acc.add_appserver_to_haproxy(app, my_node.private_ip, appengine_port)\n end",
"def start(port=nil)\n if port == nil\n port = $*.first()\n end\n @httpServer.start(port) { |client|\n\n # Remove the first slash and split the url by slash\n urls = client.url[1..-1].split('/')\n\n # Extract url data and defaults (the default should be configurable?)\n # Remember that its case-sensitive\n packageName = urls[0] || 'index'\n controllerName = urls[1] || 'Index'\n methodName = urls[2] || 'index'\n # The remaining url data were the arguments\n args = urls[3..-1]\n\n begin\n # Remember that the filename is all lowercase, while class name are WordCase\n unless File.exists?(\"#{$root}framework/xmvc/controllers/#{packageName.downcase()}/#{controllerName.downcase()}.rb\")\n # This should be configurable?\n client.writeHead(404, {'Content-type' => 'text/html'})\n client.write('Not Found')\n client.end()\n else\n # Require controller definition (all file/folder must be in lowercase)\n require(\"#{$root}framework/xmvc/controllers/#{packageName.downcase()}/#{controllerName.downcase()}.rb\")\n # Titania url is case sensitive\n ctrl = eval(\"#{controllerName}.new()\")\n method = ctrl.method(methodName)\n method.call(client, args)\n end\n ensure\n puts $!\n end\n }\n end",
"def run\n @pid = fork do \n initialize_sandbox\n exec(@app)\n end\n\n _, @exit_status = Process.wait2(@pid)\n @pid\n end",
"def run(err, out)\n begin\n DRb.start_service(\"druby://localhost:0\")\n rescue SocketError, Errno::EADDRNOTAVAIL\n DRb.start_service(\"druby://:0\")\n end\n spec_server = DRbObject.new_with_uri(\"druby://127.0.0.1:#{drb_port}\")\n spec_server.run(@options.drb_argv, err, out)\n end",
"def prepare\n if not @http_server\n config = {}\n config[:BindAddress] = @configuration.get('beef.http.host')\n config[:Port] = @configuration.get('beef.http.port')\n config[:Logger] = WEBrick::Log.new($stdout, WEBrick::Log::ERROR)\n config[:ServerName] = \"BeEF \" + VERSION\n config[:ServerSoftware] = \"BeEF \" + VERSION\n \n @http_server = WEBrick::HTTPServer.new(config)\n \n # Create http handler for the javascript hook file\n mount(\"#{@configuration.get(\"beef.http.hook_file\")}\", true, BeEF::Core::Handlers::HookedBrowsers)\n \n # Create http handlers for all commands in the framework\n BeEF::Modules.get_loaded.each { |k,v|\n mount(\"/command/#{k}.js\", false, BeEF::Core::Handlers::Commands, k)\n }\n \n #\n # We dynamically get the list of all http handler using the API and register them\n #\n BeEF::API.fire(BeEF::API::Server::Handler, 'mount_handlers', self)\n end\n end",
"def run_app(app, env)\n setup_rack(app).call(env)\nend",
"def run\n reconfigure\n setup_application\n run_application\n end",
"def rackup(path); end",
"def start\n UI.info \"Starting up Rack...\"\n if running?\n UI.error \"Another instance of Rack is running.\"\n false\n else\n @pid = Spoon.spawnp 'rackup', *(options_array << (config_file if config_file)).reject(&:nil?)\n end\n wait_for_port\n if running?\n Notifier.notify(@reloaded ? 'reloaded' : 'up') unless @options[:hide_success]\n @reloaded = false\n else\n UI.info \"Rack failed to start.\"\n Notifier.notify('failed')\n end\n end",
"def main\n @app.main\n end",
"def call_rails\n @status, @headers, @response = @app.call(@env)\n end",
"def start_drb_server\r\n drb_server = DRb.start_service(\r\n \"druby://#{@drb_server_host}:#{@drb_server_port}\")\r\n @drb_server_uri = drb_server.uri\r\n @log.info(\"Watir Grid started on : #{@drb_server_uri}\")\r\n end",
"def start(host, port); end",
"def bootstrap_server\n bootstrap_config\n\n bootstrap_init\n bootstrap_run\n bootstrap_cleanup\n rescue Hazetug::Exception => e\n ui.error(e.message); 1\n ensure \n knife and knife.ui.stdout.close\n end",
"def boot params={}\n Server.node = Server.start! params\n Server.semaphore = Mutex.new\n Server.workers = []; true\n end",
"def start_server\n init \"Postview starting #{@server} on #{@options[:Host]}:#{@options[:Port]}\" do\n @postview = Rack::Builder.new do |application|\n use Rack::CommonLogger, STDOUT\n use Rack::ShowExceptions\n run Postview::Application::Blog\n end.to_app\n end\n @server.run(@postview, @options)\n end",
"def app; @app; end",
"def start\n inherit_listeners!\n # this pipe is used to wake us up from select(2) in #join when signals\n # are trapped. See trap_deferred.\n SELF_PIPE.replace(Unicorn.pipe)\n @master_pid = $$\n\n # setup signal handlers before writing pid file in case people get\n # trigger happy and send signals as soon as the pid file exists.\n # Note that signals don't actually get handled until the #join method\n QUEUE_SIGS.each { |sig| trap(sig) { SIG_QUEUE << sig; awaken_master } }\n trap(:CHLD) { awaken_master }\n\n # write pid early for Mongrel compatibility if we're not inheriting sockets\n # This is needed for compatibility some Monit setups at least.\n # This unfortunately has the side effect of clobbering valid PID if\n # we upgrade and the upgrade breaks during preload_app==true && build_app!\n self.pid = config[:pid]\n\n build_app! if preload_app\n bind_new_listeners!\n\n spawn_missing_workers\n self\n end",
"def configure(params = {})\n felix_server = self.instance\n felix_server.reset_process!\n felix_server.quiet = params[:quiet].nil? ? true : params[:quiet]\n if defined?(Rails.root)\n base_path = Rails.root\n elsif defined?(APP_ROOT)\n base_path = APP_ROOT\n else\n raise \"You must set either Rails.root, APP_ROOT or pass :felix_home as a parameter so I know where felix is\" unless params[:felix_home]\n end\n felix_server.felix_home = params[:felix_home] || File.expand_path(File.join(base_path, 'felix'))\n ENV['FELIX_HOME'] = felix_server.felix_home\n felix_server.port = params[:felix_port] || 8080\n felix_server.startup_wait = params[:startup_wait] || 60\n felix_server.java_opts = params[:java_opts] || []\n return felix_server\n end",
"def serve\n require 'tipsy/server'\n require 'tipsy/view'\n require 'rack'\n \n conf = Tipsy::Site.config\n missing_legacy_message = \"Rack::Legacy could not be loaded. Add it to your gemfile or set 'enable_php' to false in config.rb\"\n missing_rewrite_message = \"Rack::Rewrite could not be loaded. Add it to your gemfile or remove 'rewrite_rules' from config.rb\"\n if conf.enable_php\n begin\n require 'rack-legacy'\n require 'tipsy/handler/php' \n rescue LoadError\n puts missing_legacy_message\n end\n end\n \n app = Rack::Builder.new {\n use Rack::Reloader\n use Rack::ShowStatus\n \n unless conf.rewrite_rules.empty?\n begin\n require 'rack-rewrite'\n puts \"Enabling Rack Rewrite\"\n use Rack::Rewrite do\n conf.rewrite_rules.each do |pair|\n rewrite pair.first, pair.last\n end\n end\n rescue LoadError\n puts missing_rewrite_message\n end\n end\n \n if conf.enable_php\n begin\n puts \"PHP Enabled\"\n use Rack::Legacy::Php, conf.public_path\n rescue\n end\n end\n use Rack::ShowExceptions\n use Tipsy::Handler::StaticHandler, :root => conf.public_path, :urls => %w[/]\n run Rack::Cascade.new([\n \tRack::URLMap.new(Tipsy::Handler::AssetHandler.map!),\n \tTipsy::Server.new\n ])\n }.to_app\n \n conf = Tipsy::Site.config\n options = {\n :Host => conf.address,\n :Port => conf.port\n }\n \n Tipsy::Server.run!(app, options)\n end",
"def start(params)\n Felixwrapper.configure(params)\n Felixwrapper.instance.start\n return Felixwrapper.instance\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 start\n\t\tself.log.debug \"Starting.\"\n\t\tself.spawn_server\n\t\tself.read_hello\n\tend",
"def start(env=ENV, stdin=$stdin, stdout=$stdout)\n sock = WEBrick::CGI::Socket.new(@config, env, stdin, stdout)\n req = HTTPRequest.new(@config)\n res = HTTPResponse.new(@config)\n unless @config[:NPH] or defined?(MOD_RUBY)\n def res.setup_header\n unless @header[\"status\"]\n phrase = HTTPStatus::reason_phrase(@status)\n @header[\"status\"] = \"#{@status} #{phrase}\"\n end\n super\n end\n def res.status_line\n \"\"\n end\n end\n\n begin\n req.parse(sock)\n req.script_name = (env[\"SCRIPT_NAME\"] || File.expand_path($0)).dup\n req.path_info = (env[\"PATH_INFO\"] || \"\").dup\n req.query_string = env[\"QUERY_STRING\"]\n req.user = env[\"REMOTE_USER\"]\n res.request_method = req.request_method\n res.request_uri = req.request_uri\n res.request_http_version = req.http_version\n res.keep_alive = req.keep_alive?\n self.service(req, res)\n rescue HTTPStatus::Error => ex\n res.set_error(ex)\n rescue HTTPStatus::Status => ex\n res.status = ex.code\n rescue Exception => ex\n @logger.error(ex)\n res.set_error(ex, true)\n ensure\n req.fixup\n if defined?(MOD_RUBY)\n res.setup_header\n Apache.request.status_line = \"#{res.status} #{res.reason_phrase}\"\n Apache.request.status = res.status\n table = Apache.request.headers_out\n res.header.each{|key, val|\n case key\n when /^content-encoding$/i\n Apache::request.content_encoding = val\n when /^content-type$/i\n Apache::request.content_type = val\n else\n table[key] = val.to_s\n end\n }\n res.cookies.each{|cookie|\n table.add(\"Set-Cookie\", cookie.to_s)\n }\n Apache.request.send_http_header\n res.send_body(sock)\n else\n res.send_response(sock)\n end\n end\n end",
"def start\n _bootstrap!\n self.started = true\n end",
"def start(appName)\n @put.normal \"Starting thin for #{appName}\"\n command = @system.execute( \"#{@thinPath} start -C /etc/thin/#{appName}.yml\" )\n if command.success?\n @put.confirm\n else\n @put.error \"Could not start Thin\"\n exit\n end\n end",
"def start_server(host = T.unsafe(nil), port = T.unsafe(nil)); end",
"def start_server\n init \"Postview starting #{@server} on #{@options[:Host]}:#{@options[:Port]}\" do\n ENV['RACK_ENV'] = \"production\"\n config = @config.to_s\n @postview = eval(\"Rack::Builder.new{(\\n#{@source}\\n)}.to_app\", nil, config)\n @application = Rack::Builder.new do |application|\n use Rack::CommonLogger, STDOUT\n use Rack::ShowExceptions\n run application\n end.to_app\n end\n @server.run(@postview, @options)\n end"
] | [
"0.7510591",
"0.730642",
"0.71709186",
"0.6983111",
"0.68436265",
"0.68065315",
"0.67875445",
"0.67814744",
"0.67613155",
"0.6760062",
"0.6728673",
"0.67258686",
"0.67251605",
"0.67126906",
"0.66903764",
"0.6665408",
"0.66606337",
"0.66182804",
"0.65731376",
"0.6565935",
"0.6543138",
"0.6535747",
"0.65112185",
"0.64647186",
"0.6448408",
"0.6434827",
"0.64260983",
"0.6424649",
"0.6413981",
"0.64040464",
"0.6375984",
"0.63214904",
"0.6273325",
"0.62699926",
"0.6261478",
"0.6247196",
"0.62411124",
"0.6239896",
"0.6229438",
"0.62145746",
"0.6193071",
"0.61857283",
"0.6184156",
"0.6161525",
"0.615284",
"0.6118993",
"0.61125165",
"0.60891664",
"0.6078033",
"0.6078033",
"0.6047654",
"0.60417116",
"0.6033345",
"0.60074866",
"0.60010684",
"0.59470904",
"0.59269273",
"0.5920123",
"0.59119755",
"0.58983314",
"0.58983314",
"0.58983314",
"0.58983314",
"0.58983314",
"0.58983314",
"0.58983314",
"0.58983314",
"0.58983314",
"0.58983314",
"0.58892584",
"0.5881345",
"0.5875968",
"0.5867838",
"0.58648413",
"0.5860677",
"0.58587086",
"0.58568",
"0.5845187",
"0.5825891",
"0.5817274",
"0.5808297",
"0.5803538",
"0.58009297",
"0.5790122",
"0.5776552",
"0.5752907",
"0.57417333",
"0.57305825",
"0.5722846",
"0.5721163",
"0.57205886",
"0.57184064",
"0.5714142",
"0.568697",
"0.5676231",
"0.567613",
"0.56703186",
"0.5669797",
"0.56610805",
"0.56554735"
] | 0.82225764 | 0 |
=begin rdoc Stop the Server process. In the controlling process, this kills the server PID. In the server process, this invokes Webrickshutdown. =end | def stop
# use pid in controlling process, webrick in server process
@webrick.shutdown if @webrick
Process.kill('INT', @pid) if @pid
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def server_stop\n Process.kill 'INT', 0\n end",
"def stop_server\n Thin::Server.kill(CloudCrowd.pid_path('server.pid'), 0)\n end",
"def stop\n @server.stop if @server.running?\n end",
"def stop_server\n if ! @wbthread.nil? && @wbthread.alive?\n # signal server thread to quit\n Process.kill('USR1', Process.pid)\n # wait for it to actually quit\n # note: Sometimes it appears to hang here at this join, when there's something wrong with the server or client\n # when that happens just comment out to see more debug info what's wrong\n # you'll also get some spurious concurrency errors of course, but at least the problem will show up too\n @wbthread.join\n end\n end",
"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 stop_server\n @server_handler.stop_server\n end",
"def kill\n server.kill\n end",
"def stop\n @server.shutdown if @server\n end",
"def stop\n @server.close\n end",
"def stop_server\n if @server\n @server.shutdown\n @server_thread.join\n @server\n end\n end",
"def stop\n return if not running?\n @running = false\n @server.shutdown\n end",
"def kill_server\n if Lsof.running?(7125)\n Lsof.kill(7125)\n end\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 stop_server\n\t\tif self.pid\n\t\t\tself.log.debug \"Stopping command server at PID %d\" % [ self.pid ]\n\t\t\tProcess.kill( :TERM, self.pid )\n\t\t\tProcess.wait( self.pid, Process::WNOHANG )\n\t\t\tself.pid = nil\n\t\tend\n\tend",
"def stop\n server = Communist.servers.delete(app.object_id) { |s| NullServer.new }\n if Communist.server.respond_to?(:shutdown)\n server.shutdown\n elsif Communist.server.respond_to?(:stop!)\n server.stop!\n else\n server.stop\n end\n @server_thread.join\n end",
"def stop\n UI.info \"Shutting down WEBrick...\"\n Process.kill(\"TERM\", @pid)\n Process.wait(@pid)\n @pid = nil\n true\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 pid_file = \"#{@server_root}/httpd.pid\"\n if File.exist?(pid_file)\n begin\n pid = File.read(pid_file).strip.to_i\n Process.kill('SIGTERM', pid)\n rescue Errno::ESRCH\n # Looks like a stale pid file.\n FileUtils.rm_r(@server_root)\n return\n end\n end\n begin\n # Wait until the PID file is removed.\n Timeout::timeout(17) do\n while File.exist?(pid_file)\n sleep(0.1)\n end\n end\n # Wait until the server socket is closed.\n Timeout::timeout(7) do\n done = false\n while !done\n begin\n socket = TCPSocket.new('localhost', @port)\n socket.close\n sleep(0.1)\n rescue SystemCallError\n done = true\n end\n end\n end\n rescue Timeout::Error\n raise \"Unable to stop Apache.\"\n end\n if File.exist?(@server_root)\n FileUtils.chmod_R(0777, @server_root)\n FileUtils.rm_r(@server_root)\n end\n end",
"def stop_server(server)\n server.stop\n end",
"def shutdown\n @server.shutdown\n end",
"def stop_server\n case status_server\n when 1\n puts 'server is not running'\n return 1\n when -1\n puts \"pid file doesn't exist.\"\n return 1\n end\n\n Process.kill(:TERM, server_pid)\n sleep 1\n if FileTest.exist?(\"/proc/#{server_pid}\")\n begin\n timeout(90) do\n print_flush 'waiting the server to stop'\n loop do\n unless FileTest.exist?(\"/proc/#{server_pid}\")\n break\n else\n sleep 2; print_flush '.'\n end\n end\n end\n rescue Timeout::Error\n puts 'Timeout reached.'\n Process.kill(:KILL, server_pid)\n end\n end\n FileUtils.rm(PID_FILE)\n\n return 0\nend",
"def stop_server\n raise RuntimeError, 'call find_server first' unless @server_uri\n\n services = DRbObject.new_with_uri @server_uri\n controller = services.get_server_control_service\n controller.stop_server\n\n reset_params_when_stop\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 shutdown\n @server_active = false\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 Net::HTTP.get('localhost', '/selenium-server/driver/?cmd=shutDown', @port_number)\n end",
"def drb_stop!\n Vedeu.bind(:_drb_stop_) { Vedeu::Distributed::Server.stop }\n end",
"def stop\n @virtual_machine_state = 'SHUTOFF'\n Profitbricks.request :stop_server, server_id: self.id\n return true\n end",
"def stop_server\n unless @servsocket.closed?\n detach\n @servsocket.close\n end\n end",
"def stop\n if @http_server\n # shuts down the server\n @http_server.shutdown\n \n # print goodbye message\n puts\n print_info 'BeEF server stopped'\n end\n end",
"def shutdown\n request('shutdown')\n end",
"def shutdown\n if PushmiPullyu.server_running?\n # using stderr instead of logger as it uses an underlying mutex which is not allowed inside trap contexts.\n warn 'Exiting... Interrupt again to force quit.'\n PushmiPullyu.server_running = false\n else\n exit!(1)\n end\n end",
"def stop\n UI.info \"Shutting down Rack...\"\n ::Process.kill(\"TERM\", @pid)\n ::Process.wait(@pid)\n @pid = nil\n true\n end",
"def kill\n shutdown\n end",
"def stop\n $stdout.puts \"Stopping the pow server...\"\n %x{launchctl unload \"$HOME/Library/LaunchAgents/cx.pow.powd.plist\" 2>/dev/null}\n %x{sudo launchctl unload \"/Library/LaunchDaemons/cx.pow.firewall.plist\" 2>/dev/null}\n $stdout.puts \"Done!\"\n end",
"def stop(*args)\n unless stopped?\n get '/invoke/wm.server.admin/shutdown?bounce=no&timeout=0&option=force'\n wait_until(\"Stopping\") do\n stopped?\n end\n end\n end",
"def close #:nodoc:\n @server.shutdown\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\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\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_node\n Thin::Server.kill CloudCrowd.pid_path('node.pid')\n end",
"def stop\n server.synchronize do\n File.unlink(service_link) if File.symlink?(service_link)\n sleep(1) until !server.running?\n end\n 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 shutdown(options={})\n param = { :uniq_id => @uniq_id }.merge options\n param[:force] = param[:force] ? 1 : 0\n data = Storm::Base::SODServer.remote_call '/Server/shutdown', param\n data[:shutdown]\n end",
"def shutdown_server(which = nil)\n which = if which.nil?\n @servers.keys\n else\n [which]\n end\n which.each do |id|\n @server_threads[id].raise LogCourier::ShutdownSignal\n @server_threads[id].join\n @server_threads.delete id\n @server_counts.delete id\n @servers.delete id\n end\n nil\n end",
"def stop\n @builder.terminate\n @server.terminate\n end",
"def shutdown!\n _shutdown 'SIGKILL' unless dead?\n end",
"def shutdown_server(which = nil)\n which = if which.nil?\n @servers.keys\n else\n [which]\n end\n shutdown_multiple_servers(which)\n end",
"def shutdown\n Bj.submit \"#{XEN_CMD_RUNNER} shutdown_instance #{name} true\", :tag => \"#{name}.shutdown_instance\"\n end",
"def stop\n if running?\n @acceptor.raise(StopServer.new)\n @handlers = Array.new(@handlers)\n @options = Hash.new(@options)\n sleep(0.5) while @acceptor.alive?\n end\n end",
"def ServerShutDown(arg0)\r\n ret = @dispatch._invoke(1, [arg0], [VT_BSTR])\r\n @lastargs = WIN32OLE::ARGV\r\n ret\r\n end",
"def shutdown(exit_code = 0)\n if server.respond_to?(:shutdown)\n server.shutdown\n elsif respond_to? :exit\n exit(exit_code)\n end\n end",
"def shutdown\n @stopped = false\n end",
"def stop!(signature)\n EM.stop_server(signature)\n end",
"def stop\n @pid ? Process.kill('TERM', @pid) : close_connection\n end",
"def shutdown!; end",
"def shutdown!; end",
"def shutdown!; end",
"def stop\n @shutdown = true\n end",
"def stop\n connection.write(\"stop\")\n end",
"def stop\n connection.write(\"stop\")\n end",
"def stop\n connection.write(\"stop\")\n end",
"def stop\n system(\"pkill -f #{DAEMON}\")\n end",
"def stop!\n self.class.cleanup!(:pid => @sudo_pid, :socket => @socket)\n @proxy = nil\n end",
"def shut_down\n end",
"def stop\n # Permissions are handled by the script, use: :sudo => false\n run_script :stop, :sudo => false\n end",
"def stop!\n return unless running?\n @logger.info 'Stopping WebSocket server'\n @client_mutex.synchronize do\n @clients.each do |socket, client|\n client.stop!\n end\n end\n @server_thread.kill if @server_thread\n @server.close\n end",
"def stop(suppress_not_running_message = false)\n load_config\n\n DRb.start_service\n\n begin\n DRbObject.new_with_uri(@server_uri).stopServer\n puts 'netuitived stopped'\n rescue\n puts \"netuitived isn't running\" unless suppress_not_running_message\n end\n end",
"def stop\n logger.debug \"stopping server\"\n @status = :stopping\n EM.stop_server @sig\n done if @connections.empty?\n sleep 0.1 while @status != :stopped unless EM.reactor_thread?\n end",
"def closeServer()\n com = Sumo::Traci::Command_Close.new() ;\n execCommands(com) ;\n close() ;\n end",
"def stop_server\n if @automation_server\n # in case of error, does not affect next tests\n server = @automation_server\n @automation_server = nil\n\n server.close \"q().\"\n else\n trace = Helper.get_backtrace\n log.warn(\"Automation#stop_client\") { \"Client was not started\\n\" \\\n \"in #{trace[0, 5].join(\"\\n\")}\" }\n end\n log.info(\"Automation#stop_server\") { \"server stopped\" }\n end",
"def stop\n stopper = Thread.new { @acceptor.raise(StopServer.new) }\n stopper.priority = Thread.current.priority + 10\n end",
"def shutdown\n run \"#{try_sudo} /sbin/service httpd stop\"\n end",
"def shut_down\n trigger(:shut_down_started)\n @server.stop(true) if @server\n @server_thread.join if @server_thread\n adapter.shut_down\n trigger(:shut_down_complete)\n end",
"def shutdown\n execute_system_cmd('shutdown -h now')\n end",
"def stop \n logger.debug \"Instance stop method called for pid '#{pid}'\"\n if pid\n if @process\n @process.stop\n else\n Process.kill(\"KILL\", pid) rescue nil\n end\n\n Dir.chdir(@felix_home) do\n begin\n stop_process.start\n rescue\n\t#Forget about exceptions here because it is probably just the spec tests\n\t#FIXME actually handle this\n end\n end\n\n begin\n File.delete(pid_path)\n rescue\n end\n end\n end",
"def shutdown\n runcmd 'shutdown'\n end",
"def kill()\n System.run(\"kill\", \"-9\", @pid.to_s) if @pid\n end",
"def stop\n jetty.stop\n end",
"def ServerShutDown(arg0)\r\n ret = _invoke(1, [arg0], [VT_BSTR])\r\n @lastargs = WIN32OLE::ARGV\r\n ret\r\n end",
"def shutdown\n @manager.shutdow_service_server(self)\n end",
"def stop!\n # Permissions are handled by the script, use: :sudo => false\n run_script! :stop, :sudo => false\n end",
"def shutdown\n @running = false\n end",
"def stop\n info \"STOP!\"\n @worker.shutdown! if @worker\n end",
"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 shutdown\n @socket = nil\n @thr.join if @thr\n @thr = nil\n end",
"def stop\n if managed? && started?\n\n exec('stop', p: port)\n # Wait for solr to stop\n while status\n sleep 1\n end\n end\n\n @pid = nil\n end",
"def stop\n system(\"start-stop-daemon --stop --pidfile #{pidfile}\")\n end",
"def shutdown; end",
"def shutdown; end",
"def shutdown; end",
"def shutdown; end",
"def shutdown; end",
"def shutdown; end",
"def shutdown; end",
"def stop_command\n '<%= @jmeter_home %>/bin/shutdown.sh'\n end",
"def shutdown!\n shutdown\n end",
"def stop\n return unless running\n\n $logger.trace(\"Appium:#{@pid}\") { 'Stopping appium server' }\n Process.kill('INT', @pid)\n @pid = nil\n @appium_thread.join\n @appium_thread = nil\n end",
"def stop\n yield self if block_given?\n http.post('/__admin/shutdown', '')\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"
] | [
"0.82698625",
"0.800173",
"0.7851701",
"0.7813708",
"0.7780696",
"0.77486914",
"0.7745027",
"0.7737806",
"0.76892287",
"0.7641148",
"0.7619365",
"0.7592064",
"0.7574186",
"0.75473267",
"0.7530517",
"0.7472893",
"0.7460063",
"0.74366367",
"0.7433465",
"0.73848146",
"0.73754734",
"0.7351098",
"0.7318105",
"0.73179555",
"0.73066235",
"0.725311",
"0.7238488",
"0.72016567",
"0.7184604",
"0.71721935",
"0.71646565",
"0.7119521",
"0.70725775",
"0.70720655",
"0.7067194",
"0.70133436",
"0.69960403",
"0.6932789",
"0.6922757",
"0.6915935",
"0.69137305",
"0.6892034",
"0.6886659",
"0.6854505",
"0.685016",
"0.68499297",
"0.6836463",
"0.6836094",
"0.68211985",
"0.68105096",
"0.6774046",
"0.6767144",
"0.67621785",
"0.6759661",
"0.6748232",
"0.67469126",
"0.67469126",
"0.67469126",
"0.6737899",
"0.67343533",
"0.67343533",
"0.67343533",
"0.6731319",
"0.67264557",
"0.6725388",
"0.6714823",
"0.6710815",
"0.67069745",
"0.6698163",
"0.6688409",
"0.66803586",
"0.66783506",
"0.6677416",
"0.66766024",
"0.66761994",
"0.66748875",
"0.66689616",
"0.6663243",
"0.6663116",
"0.6658366",
"0.6657664",
"0.66539997",
"0.66427386",
"0.6636798",
"0.6630675",
"0.6607864",
"0.66067684",
"0.6600934",
"0.65850997",
"0.65850997",
"0.65850997",
"0.65850997",
"0.65850997",
"0.65850997",
"0.65850997",
"0.6580462",
"0.65742666",
"0.656636",
"0.65433896",
"0.6540598"
] | 0.85341537 | 0 |
return next available port for webrick to listen on | def get_avail_port(host)
host ||= (Socket::gethostbyname('')||['localhost'])[0]
infos = Socket::getaddrinfo(host, nil, Socket::AF_UNSPEC,
Socket::SOCK_STREAM, 0,
Socket::AI_PASSIVE)
fam = infos.inject({}) { |h, arr| h[arr[0]]= arr[2]; h }
sock_host = fam['AF_INET'] || fam['AF_INET6']
sock = sock_host ? TCPServer.open(sock_host, 0) : TCPServer.open(0)
port = sock.addr[1]
sock.close
port
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def find_available_port\n server = TCPServer.new(\"127.0.0.1\", 0)\n server.addr[1]\n ensure\n server.close if server\n end",
"def find_port(port)\n port += 1 while port_bound?('127.0.0.1', port)\n port\nend",
"def find_open_port\n server = TCPServer.new('127.0.0.1', 0)\n port = server.addr[1]\n server.close\n port\n end",
"def find_available_port\n server = TCPServer.new(FIND_AVAILABLE_PORT)\n server.addr[1]\n ensure\n server.close if server\n end",
"def available_port\n server = TCPServer.new('0.0.0.0', 0)\n server.addr[1].tap do\n server.close\n end\n end",
"def port\n @hash[\"Listen\"].to_i\n end",
"def obtain_port\n server = TCPServer.new(\"127.0.0.1\", 0)\n port = server.addr[1]\n server.close\n port\n end",
"def findPort()\n # this is REALLY ugly\n port = @config['startPort']\n while true\n good = true\n #self.class.each { |v|\n # if (v.port == port)\n # good = false\n # break\n # end\n #}\n # Retrieve the list of all Daemons running\n if (@@inst[self.class] != nil)\n @@inst[self.class].each_value { |value|\n # For each Daemon, check its used port compared to our candidate one\n if (value.port == port)\n good = false\n break\n end\n }\n end\n if (good)\n begin\n info \"Checking port TCP:#{port}...\"\n serv = TCPServer.new(port)\n rescue\n good = false\n info \"Port TCP:#{port} is in use!\"\n else\n serv.close\n info \"Port TCP:#{port} is free!\"\n begin\n info \"Checking port UDP:#{port}...\"\n serv = UDPSocket.new\n\t serv.bind(nil,port)\n rescue\n good = false\n info \"Port UDP:#{port} is in use!\"\n else\n serv.close\n info \"Port UDP:#{port} is free!\"\n\t end\n end\n end\n return port if (good)\n # The candidate port is already used, increase it and loop again...\n port += 1\n end\n end",
"def get_open_port\n socket = Socket.new(:INET, :STREAM, 0)\n socket.bind(Addrinfo.tcp(\"127.0.0.1\", 0))\n port = socket.local_address.ip_port\n socket.close\n port\n end",
"def port\n connect_address.ip_port\n rescue SocketError\n # Not bound to any local port\n rescue IOError\n # Socket has been closed\n end",
"def port\n @socket.connect_address.ip_port\n rescue SocketError\n # Not bound to any local port\n rescue IOError\n # Socket has been closed\n end",
"def port\n raise \"Http-server not spawned yet. Call Hayabusa#start to spawn it.\" if !@httpserv\n return @httpserv.server.addr[1]\n end",
"def socket_port; end",
"def local_port\n get('beef.http.port') || '3000'\n end",
"def listening_port\n @dbi.endpoint.port\n end",
"def listening_port\n @dbi.endpoint.port\n end",
"def port\n return @port if @port\n\n @server = TCPServer.new('127.0.0.1', 0)\n @port = @server.addr[1].to_i\n @server.close\n\n return @port\n end",
"def server_port(id = '__default__')\n @servers[id].port\n end",
"def actual_port; end",
"def actual_port; end",
"def local_port\n socket = Socket.new(:INET, :STREAM, 0)\n socket.bind(Addrinfo.tcp(\"127.0.0.1\", 0))\n port = socket.local_address.ip_port\n socket.close\n port\n end",
"def next_port\n @port_mutex.synchronize do\n port = @next_port\n @next_port -= 1\n @next_port = MAX_PORT if @next_port < MIN_PORT\n port\n end\n end",
"def port\n return @forwarded_port || @port\n end",
"def beef_port\n public_port || local_port\n end",
"def get_socket\n sock = UDPSocket.new\n sock.setsockopt(Socket::SOL_SOCKET, Socket::SO_REUSEADDR, true)\n\n count = 0\n bound = false\n begin\n port = rand(2 ** 16 - 1024) + 1024\n debug \"Attempting to bind to #{@listen_ip}:#{port}\"\n sock.bind(@listen_ip, port)\n bound = true\n rescue \n warn \"Failed to bind to #{@listen_ip}:#{port}\"\n if count < MaxBindAttempts\n count += 1\n redo\n end\n end\n\n if bound\n info \"Handler #{@key} bound to #{@listen_ip} on port #{port}\"\n else\n raise TftpError, \"Can't seem to find a spare port to bind to.\"\n end\n\n return sock\n end",
"def server_port ; @env['SERVER_PORT' ].to_i ; end",
"def start!\n ports = ports_to_try\n Log.debug \"Trying ports #{ports.inspect}...\"\n until port || !(try_port = ports.shift)\n begin\n Log.debug \"Trying to listen on port #{try_port}...\"\n @socket.bind('0.0.0.0', try_port)\n Log.info \"Successfully listening on port #{try_port}...\"\n rescue Errno::EADDRINUSE, Errno::EINVAL\n Log.warn \"Port #{try_port} occupied, trying another...\"\n end\n end\n Log.error \"Could not find any port to listen on...\" unless port\n end",
"def random_port\n # NOTE: the BOB protocol unfortunately requires us to pick the port\n # that the BOB bridge will then proceed to bind; this introduces an\n # inherent and unavoidable race condition.\n TCPServer.open('127.0.0.1', 0) { |server| server.addr[1] }\n end",
"def port\n @port ||= target.split(':',2).last.to_i\n end",
"def port\n 20000 + ($$ % 40000)\n end",
"def server_port; end",
"def base_port\n (options[:port] || env[\"PORT\"] || ENV[\"PORT\"] || 5000).to_i\n end",
"def default_httpd_port\n if monit_version && UNIXSOCKET_VERSION.satisfied_by?(monit_version)\n monit_name_path('/var/run/%{name}.sock')\n else\n 2812\n end\n end",
"def true_port\r\n port = servlet_response.getLocalPort\r\n $log.debug(\"True port is #{port}\")\r\n port\r\n end",
"def get_available_port(host)\n (7000..7100).each do |port|\n status = `nmap -Pn -p #{port} #{host} | grep #{port} | awk '{print $2}'`.chomp(\"\\n\")\n return port if status.eql? 'closed'\n end\n nil\n end",
"def server_port\n AgileProxy.config.server_port\n end",
"def port\n @manager.primary_pool.port\n end",
"def available_endpoint\n \"0.0.0.0:#{available_port}\"\n end",
"def port\n return @port.to_i\n end",
"def port(opts={})\n # Check if port was specified in options hash\n pnum = opts[:port]\n return pnum if pnum\n\n # Check if we have an SSH forwarded port\n pnum = nil\n env.vm.vm.network_adapters.each do |na|\n pnum = na.nat_driver.forwarded_ports.detect do |fp|\n fp.name == env.config.ssh.forwarded_port_key\n end\n\n break if pnum\n end\n\n return pnum.hostport if pnum\n\n # This should NEVER happen.\n raise Errors::SSHPortNotDetected\n end",
"def port\n conf['port'] || '80'\n end",
"def port\n @port ||= use_ssl ? 636 : 389\n end",
"def optional_port; end",
"def port; config[:port]; end",
"def socket_port(uri)\n secure_uri?(uri) ? 443 : 80\n end",
"def getPort()\n return @uri.port\n end",
"def next_port(current_port)\n port_idx = $starport.index(current_port)\n if !port_idx\n puts \"Error: next_port missing #{current_port}\"\n $stdout.flush\n return $starport.first\n end\n port_idx += 1\n port_idx = 0 if (port_idx >= $starport.length)\n $starport[port_idx]\nend",
"def host_with_port; end",
"def local_port\n return @local_port\n end",
"def default_port\n @default_port ||= 1234\n end",
"def port\n @port || (secure ? 443 : 80)\n end",
"def find_lowest_free_port(starting_port)\n possibly_free_port = starting_port\n loop {\n actually_available = Djinn.log_run(\"lsof -i:#{possibly_free_port}\")\n if actually_available.empty?\n Djinn.log_debug(\"Port #{possibly_free_port} is available for use.\")\n return possibly_free_port\n else\n Djinn.log_warn(\"Port #{possibly_free_port} is in use, so skipping it.\")\n possibly_free_port += 1\n end\n }\n end",
"def standard_port; end",
"def guess_free_port(min_port,max_port)\n ui.info \"Received port hint - #{min_port}\"\n\n guessed_port=nil\n\n for port in (min_port..max_port)\n unless is_tcp_port_open?(get_local_ip, port)\n guessed_port=port\n break\n end\n end\n\n if guessed_port.nil?\n ui.error \"No free port available: tried #{min_port}..#{max_port}\"\n raise Veewee::Error, \"No free port available: tried #{min_port}..#{max_port}\"\n else\n ui.info \"Found port #{guessed_port} available\"\n end\n\n return guessed_port\n end",
"def port; end",
"def port; end",
"def port; end",
"def port; end",
"def port; end",
"def port; end",
"def port; end",
"def port; end",
"def port\n @port ||= Port.new(@event.at('@port'), @event.at('@svc_name'), @event.at('@protocol'))\n end",
"def default_port\n data.default_port\n end",
"def port_available? port\n server = TCPServer.open port\n server.close\n true\n rescue Errno::EADDRINUSE\n false\n end",
"def webserver_port\n AgileProxy.config.webserver_port\n end",
"def port\n @port ||= opts.fetch(:port, parsed_uri.port)\n end",
"def port\n request.port\n end",
"def port\n 7779\n end",
"def port\n configuration.port\n end",
"def port\n configuration.port\n end",
"def port_for(process, instance, base=nil)\n if base\n base + (@processes.index(process.process) * 100) + (instance - 1)\n else\n base_port + (@processes.index(process) * 100) + (instance - 1)\n end\n end",
"def port\n conf['api']['port'].to_s\n end",
"def searchkick_port\n return nil unless @@url.is_valid_searchkick_url?\n\n port = @@url[/:([0-9]{0,5}$)/, 1]\n return port.to_i if port.present?\n nil\n end",
"def port\n @request_spec_server.port\n end",
"def newPort()\n \"Return the next port number to allocate.\"\n if @ports.length > 0\n return @ports.values.max + 1\n end \n return @@portBase\n end",
"def next_src_port\n 1024 + rand(65535 - 1024)\n end",
"def standard_port?; end",
"def port\n @port\n end",
"def port\n @port\n end",
"def port\n @port\n end",
"def port\n if !block_given?\n return @j_del.java_method(:port, []).call()\n end\n raise ArgumentError, \"Invalid arguments when calling port()\"\n end",
"def port\n get_value :port\n end",
"def main\n # Check that there was an argument supplied to the application\n if ARGV.length > 0\n # Convert the argument to an integer to be used as a port number\n port = ARGV[0].to_i\n if port < 1024 || port > 49151\n puts \"illegal port #{ARGV[0].to_i}: Choose one in range 1024-49151\"\n exit\n end\n else\n # If no port was specified, create a random port number\n port = Random.new.rand(48128) + 1024\n end\n serve port\nend",
"def port\n @connection.port\n end",
"def probe_port\n options[:probe_port] ||\n env['GOOD_JOB_PROBE_PORT']\n end",
"def port\n nodes[0][1].to_i\n end",
"def port=(_arg0); end",
"def remote_port\n return @remote_port\n end",
"def listening_thread(local_port)\n LOG.info(\"%06d\"%Process::pid) {\"listening on port #{local_port}...\"}\n \n # check the parameter to see if it's valid\n m = /^(([0-9a-fA-F]{0,4}:{0,1}){1,8})\\/([0-9]{1,5})|(([0-9]{1,3}\\.{0,1}){4}):([0-9]{1,5})|([0-9]{1,5})$/.match(local_port)\n #<MatchData \"2001:4800:7817:104:be76:4eff:fe05:3b18/2000\" 1:\"2001:4800:7817:104:be76:4eff:fe05:3b18\" 2:\"3b18\" 3:\"2000\" 4:nil 5:nil 6:nil 7:nil>\n #<MatchData \"23.253.107.107:2000\" 1:nil 2:nil 3:nil 4:\"23.253.107.107\" 5:\"107\" 6:\"2000\" 7:nil>\n #<MatchData \"2000\" 1:nil 2:nil 3:nil 4:nil 5:nil 6:nil 7:\"2000\">\n case\n when !m[1].nil? # its AF_INET6\n socket = bind_socket(AF_INET6,m[3],m[1])\n when !m[4].nil? # its AF_INET\n socket = bind_socket(AF_INET,m[6],m[4])\n when !m[7].nil?\n socket = bind_socket(AF_INET6,m[7],\"0:0:0:0:0:0:0:0\")\n else\n raise ArgumentError.new(local_port)\n end\n ssl_server = OpenSSL::SSL::SSLServer.new(socket, $ctx);\n\n # main listening loop starts in non-encrypted mode\n ssl_server.start_immediately = false\n loop do\n # we can't use threads because if we drop root privileges on any thread,\n # they will be dropped for all threads in the process--so we have to fork\n # a process here in order that the reception be able to drop root privileges\n # and run at a user level--this is a security precaution\n connection = ssl_server.accept\n Process::fork do\n begin\n drop_root_privileges if !UserName.nil?\n begin\n remote_hostname, remote_service = connection.io.remote_address.getnameinfo\n rescue SocketError => e\n LOG.info(\"%06d\"%Process::pid) { e.to_s }\n remote_hostname, remote_service = \"(none)\", nil\n end\n remote_ip, remote_port = connection.io.remote_address.ip_unpack\n process_call(connection, local_port, remote_port.to_s, remote_ip, remote_hostname, remote_service)\n LOG.info(\"%06d\"%Process::pid) {\"Connection closed on port #{local_port} by #{ServerName}\"}\n rescue Errno::ENOTCONN => e\n LOG.info(\"%06d\"%Process::pid) {\"Remote Port scan on port #{local_port}\"}\n ensure\n # here we close the child's copy of the connection --\n # since the parent already closed it's copy, this\n # one will send a FIN to the client, so the client\n # can terminate gracefully\n connection.close\n # and finally, close the child's link to the log\n LOG.close\n end\n end\n # here we close the parent's copy of the connection --\n # the child (created by the Process::fork above) has another copy --\n # if this one is not closed, when the child closes it's copy,\n # the child's copy won't send a FIN to the client -- the FIN\n # is only sent when the last process holding a copy to the\n # socket closes it's copy\n connection.close\n end\n end",
"def port=(_); end",
"def port\n end",
"def port(p)\n @config[:port] = p\n end",
"def port(port, host = T.unsafe(nil)); end",
"def default_port\n transport.default_port\n end",
"def start_server!; @server = TCPServer.open($port) end",
"def port\n @uri.port\n end",
"def port\n @options[:port]\n end",
"def port\n self.port\n end",
"def open(host, port, local_port=nil)\n ensure_open!\n\n actual_local_port = local_port || next_port\n\n @session_mutex.synchronize do\n @session.forward.local(actual_local_port, host, port)\n end\n\n if block_given?\n begin\n yield actual_local_port\n ensure\n close(actual_local_port)\n end\n else\n return actual_local_port\n end\n rescue Errno::EADDRINUSE\n raise if local_port # if a local port was explicitly requested, bubble the error up\n retry\n end"
] | [
"0.7473285",
"0.74472576",
"0.7336912",
"0.73342365",
"0.71801054",
"0.7119723",
"0.70559543",
"0.7030518",
"0.691836",
"0.6826297",
"0.6766134",
"0.67562294",
"0.67159766",
"0.67068946",
"0.6651516",
"0.6651516",
"0.66267836",
"0.6593085",
"0.65703666",
"0.65703666",
"0.65215355",
"0.6480309",
"0.6471738",
"0.64672285",
"0.6461593",
"0.6443027",
"0.6439867",
"0.64391327",
"0.6435903",
"0.6364915",
"0.6345096",
"0.6330412",
"0.62746066",
"0.6259562",
"0.6234325",
"0.62259763",
"0.6222823",
"0.61955255",
"0.6169641",
"0.6125832",
"0.6099254",
"0.6094333",
"0.6079347",
"0.60767233",
"0.6073463",
"0.60667765",
"0.6066344",
"0.6006709",
"0.6004912",
"0.59938025",
"0.5982596",
"0.59713614",
"0.59681374",
"0.5956642",
"0.59507626",
"0.59507626",
"0.59507626",
"0.59507626",
"0.59507626",
"0.59507626",
"0.59507626",
"0.59507626",
"0.59471524",
"0.59467274",
"0.59412694",
"0.59306014",
"0.590415",
"0.59033567",
"0.5897362",
"0.5887914",
"0.5887914",
"0.5876106",
"0.5859196",
"0.58476496",
"0.58428437",
"0.5839534",
"0.5837198",
"0.5828442",
"0.5828357",
"0.5828357",
"0.5828357",
"0.5824372",
"0.5818997",
"0.58063567",
"0.5803912",
"0.57975805",
"0.5793451",
"0.57893634",
"0.5780601",
"0.5779397",
"0.57774115",
"0.57682544",
"0.57672906",
"0.57555157",
"0.5753409",
"0.57433796",
"0.5742534",
"0.57421845",
"0.57394505",
"0.5733017"
] | 0.6558905 | 20 |
Last session was within the last 7 days | def active_access?(count = 7)
last_access_at && last_access_at > count.days.ago
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def past_sport_sessions\n sport_sessions_confirmed.where('date < ?', Date.today).limit(3) #TODO: maybe we should use DateTime.now or Date.now\n end",
"def session_last_user_activity\n session[:last_activity]\n end",
"def login_time_last_30_days\n login_time_since(30.days.ago)\n end",
"def upcoming_sport_sessions\n sport_sessions_confirmed.where('date >= ?', Date.today).limit(3) #TODO: maybe we should use DateTime.now or Date.now\n end",
"def get_session_age\n return Time.now.to_i - session.last_checkin.to_i\n end",
"def training_sessions_remaining_this_month\n end",
"def last_session\n user_exams.order('updated_at DESC').first\n end",
"def last_workout_date\n workout_date_log = Hash.new\n date = self.exercise_instances.map do |workout|\n workout.date\n end.sort.last\n users = self.find_all_gym_users.last\n \"#{users} : #{date}\"\n\n\n end",
"def expiry_time\n session[:expires_at] || 3.days.from_now\n end",
"def expired?\n (Time.now - created_at) > 1.week\n end",
"def last_day_of_extended_grace_window\n (expiry_date + Rails.configuration.expires_after.years) - 1.day\n end",
"def last_7_day_kwh_usage_by_day\n usage_data = []\n Time.now.utc.to_date.downto(6.days.ago.utc.to_date).each do |date|\n usage_data << total_day_kwh_usage_on(date).round(2)\n end\n usage_data\n end",
"def last_week\n Date.week(Date.today - 7)\n end",
"def _since_last_visit(date)\n preferences = current_user.feed_preferences.where(feed_uid: params[:feed]).first_or_create(last_visited: date, previous_last_visited: date)\n\n if preferences.last_visited.end_of_day <= date.end_of_day - 1.day\n preferences.previous_last_visited = preferences.last_visited\n preferences.last_visited = date\n preferences.save!\n end\n\n since_last = date.end_of_day - preferences.previous_last_visited.end_of_day\n range = [1, (since_last / 1.day).round].max\n\n [range, since_last]\n end",
"def calc_expiry_time(seconds = 86400 * 7) # one week\n ((Time.now.utc + seconds).to_f * 1000).to_i\n end",
"def seven_days\n @transactions = where(\"created_at >= ?\", (Time.now - 7.days))\n end",
"def date_inside_grace_window(expires_on)\n (expires_on + Rails.configuration.registration_grace_window) - 1.day\n end",
"def todays_session\n deck = data.decks.first\n deck.todays_session\n end",
"def remember_me\n remember_me_for 2.weeks\n end",
"def remember_me\r\n remember_me_for 2.weeks\r\n end",
"def expired_on\n curr_company = Company.find(current_login.id)\n ((curr_company.created_at + 75.days).to_date - Date.today).round if curr_company.present?\n end",
"def session_expiry\n @session_expiry ||= 30 * 24 * 60 * 60\n end",
"def remember_me\n remember_me_for 2.weeks\n end",
"def remember_me\n remember_me_for 2.weeks\n end",
"def deleted_user_personal_site_retention_period_in_days\n return @deleted_user_personal_site_retention_period_in_days\n end",
"def get_jobs_last_7_days()\n @data = get_all()\n now = Time.now.to_date\n jobs = []\n for job in @data[\"jobs\"]\n parsed_date = Date.strptime(job[\"date\"], \"%d/%m/%Y\")\n days_difference = (parsed_date - now).to_i\n if days_difference <= 7 && days_difference >= 0\n jobs.push(job)\n end\n end\n return jobs\n end",
"def refresh_session\n update_session(30.days.from_now)\n update_last_session\n end",
"def remember_me\n remember_me_for 2.weeks\n end",
"def hubssolib_get_last_used\n session = self.hubssolib_current_session\n session ? session.session_last_used : Time.now.utc\n end",
"def session_timeout\n #return if Rails.env.test?\n #check session last_seen\n if session[:last_seen] < SESSION_TIMEOUT_MINUTES.minutes.ago\n reset_session\n else\n session[:last_seen] = Time.now.utc\n end unless session[:last_seen].nil?\n #check when session created\n if Session.first.created_at < SESSION_WIPEOUT_HOURS.hours.ago\n Session.sweep\n end unless Session.first.nil?\n end",
"def last_login_duration\n if self.last_session_id\n min = self.occurences.where(:session_id => self.last_session_id).minimum(\"created_at\")\n max = self.occurences.where(:session_id => self.last_session_id).maximum(\"created_at\")\n Time.diff(min, max, '%h:%m:%s')[:diff]\n else\n 0\n end\n end",
"def remember_me\n remember_me_until 2.weeks.from_now\n end",
"def get_last_seen\n last_seen = last_seen_at\n last_seen = current_sign_in_at if last_seen.blank?\n last_seen = last_sign_in_at if last_seen.blank?\n last_seen\n end",
"def new_requests_since_last_login(user)\n now = Time.now\n\n if !user.last_sign_in_at.blank?\n user_last_login = user.last_sign_in_at.to_datetime\n else\n user_last_login = Time.now.to_datetime\n end\n\n Request.pending.where(updated_at: (user_last_login)..now).count\n end",
"def session_timeout\n 86400 # 1.day\n end",
"def timeout_in\n\t if self.role=='admin'\n\t 7.days\n\t else\n\t 2.days\n\t end\n\tend",
"def get_session_time_left\n expire_time = if session[:expires_at].blank? then (DateTime.now + 30.minutes) else session[:expires_at] end\n @session_time_left = (expire_time.to_datetime - DateTime.now).to_f\n end",
"def last_seen\n recently_seen.limit(30)\n end",
"def update_last_user_activity\n now = session[:last_activity] = Time.now\n return if session_is_cloned?\n if ( current_user && (session[:last_activity_saved].nil? || (now - session[:last_activity_saved] > APP_CONFIG[:save_last_activity_granularity_in_seconds].to_i ) ) ) \n logger.info(\"Saved last activity date to #{now} for #{current_user.log_info}\")\n current_user.update_last_activity_date\n session[:last_activity_saved] = now\n end\n end",
"def update_activity_time\n session[:expires_at] = (configatron.session_time_out.to_i || 10).minutes.from_now\n end",
"def remember_me\n remember_me_for 2.weeks\n end",
"def remember_me\n remember_me_for 2.weeks\n end",
"def remember_me\n remember_me_for 2.weeks\n end",
"def remember_me\n remember_me_for 2.weeks\n end",
"def remember_me\n remember_me_for 2.weeks\n end",
"def remember_me\n remember_me_for 2.weeks\n end",
"def remember_me\n remember_me_for 2.weeks\n end",
"def remember_me\n remember_me_for 2.weeks\n end",
"def remember_me\n remember_me_for 2.weeks\n end",
"def remember_me\n remember_me_for 2.weeks\n end",
"def remember_me\n remember_me_for 2.weeks\n end",
"def remember_me\n remember_me_for 2.weeks\n end",
"def remember_me\n remember_me_for 2.weeks\n end",
"def remember_me\n remember_me_for 2.weeks\n end",
"def remember_me\n remember_me_for 2.weeks\n end",
"def remember_me\n remember_me_for 2.weeks\n end",
"def remember_me\n remember_me_for 2.weeks\n end",
"def remember_me\n remember_me_for 2.weeks\n end",
"def remember_me\n remember_me_for 2.weeks\n end",
"def remember_me\n remember_me_for 2.weeks\n end",
"def remember_me\n remember_me_for 2.weeks\n end",
"def remember_me\n remember_me_for 2.weeks\n end",
"def remember_me\n remember_me_for 2.weeks\n end",
"def remember_me\n remember_me_for 2.weeks\n end",
"def remember_me\n remember_me_for 2.weeks\n end",
"def remember_me\n remember_me_for 2.weeks\n end",
"def remember_me\n remember_me_for 2.weeks\n end",
"def remember_me\n remember_me_for 2.weeks\n end",
"def remember_me\n remember_me_for 2.weeks\n end",
"def remember_me\n remember_me_for 2.weeks\n end",
"def remember_me\n remember_me_for 2.weeks\n end",
"def remember_me\n remember_me_for 2.weeks\n end",
"def remember_me\n remember_me_for 2.weeks\n end",
"def remember_me\n remember_me_for 2.weeks\n end",
"def remember_me\n remember_me_for 2.weeks\n end",
"def remember_me\n remember_me_for 2.weeks\n end",
"def remember_me\n remember_me_for 2.weeks\n end",
"def remember_me\n remember_me_for 2.weeks\n end",
"def remember_me\n remember_me_for 2.weeks\n end",
"def remember_me\n remember_me_for 2.weeks\n end",
"def remember_me\n remember_me_for 2.weeks\n end",
"def remember_me\n remember_me_for 2.weeks\n end",
"def remember_me\n remember_me_for 2.weeks\n end",
"def remember_me\n remember_me_for 2.weeks\n end",
"def remember_me\n remember_me_for 2.weeks\n end",
"def remember_me\n remember_me_for 2.weeks\n end",
"def remember_me\n remember_me_for 2.weeks\n end",
"def remember_me\n remember_me_for 2.weeks\n end",
"def remember_me\n remember_me_for 2.weeks\n end",
"def remember_me\n remember_me_for 2.weeks\n end",
"def remember_me\n remember_me_for 2.weeks\n end",
"def remember_me\n remember_me_for 2.weeks\n end",
"def remember_me\n remember_me_for 2.weeks\n end",
"def remember_me\n remember_me_for 2.weeks\n end",
"def remember_me\n remember_me_for 2.weeks\n end",
"def remember_me\n remember_me_for 2.weeks\n end",
"def remember_me\n remember_me_for 2.weeks\n end",
"def remember_me\n remember_me_for 2.weeks\n end",
"def remember_me\n remember_me_for 2.weeks\n end",
"def last_count\n \tordered_count = self.ordered_year_count.where(\"dam_id = ? AND fish_id = ?\", self.dam_id, self.fish_id)\n \trange = ordered_count.where(:count_date => self.count_date.ago(1.week)..self.count_date)\n \tbegin\n \t\tcount = range[1].count\n \trescue\n \t\treturn false\n \tend\n end"
] | [
"0.6614078",
"0.6447288",
"0.62581825",
"0.62561285",
"0.6252952",
"0.6152374",
"0.6101172",
"0.6074486",
"0.60292363",
"0.6003135",
"0.60014",
"0.59913844",
"0.5986005",
"0.59738046",
"0.59658146",
"0.5957874",
"0.59527296",
"0.59514606",
"0.5950408",
"0.58968997",
"0.58748794",
"0.58730876",
"0.58654565",
"0.58654565",
"0.58519423",
"0.58505386",
"0.5846075",
"0.5845355",
"0.5834704",
"0.5834659",
"0.5825674",
"0.5794915",
"0.5781717",
"0.57696545",
"0.57641196",
"0.5763247",
"0.5752381",
"0.5740325",
"0.5718146",
"0.5712203",
"0.5686171",
"0.5686171",
"0.5686171",
"0.5686171",
"0.5686171",
"0.5686171",
"0.5686171",
"0.5686171",
"0.5686171",
"0.5686171",
"0.5686171",
"0.5686171",
"0.5686171",
"0.5686171",
"0.5686171",
"0.5686171",
"0.5686171",
"0.5686171",
"0.5686171",
"0.5686171",
"0.5686171",
"0.5686171",
"0.5686171",
"0.5686171",
"0.5686171",
"0.5686171",
"0.5686171",
"0.5686171",
"0.5686171",
"0.5686171",
"0.5686171",
"0.5686171",
"0.5686171",
"0.5686171",
"0.5686171",
"0.5686171",
"0.5686171",
"0.5686171",
"0.5686171",
"0.5686171",
"0.5686171",
"0.5686171",
"0.5686171",
"0.5686171",
"0.5686171",
"0.5686171",
"0.5686171",
"0.5686171",
"0.5686171",
"0.5686171",
"0.5686171",
"0.5686171",
"0.5686171",
"0.5686171",
"0.5686171",
"0.5686171",
"0.5686171",
"0.5686171",
"0.5686171",
"0.56778336"
] | 0.597615 | 13 |
Last session was more than 7 days ago | def inactive_access?(count = 7)
!active_access?(count)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def session_last_user_activity\n session[:last_activity]\n end",
"def login_time_last_30_days\n login_time_since(30.days.ago)\n end",
"def get_session_age\n return Time.now.to_i - session.last_checkin.to_i\n end",
"def past_sport_sessions\n sport_sessions_confirmed.where('date < ?', Date.today).limit(3) #TODO: maybe we should use DateTime.now or Date.now\n end",
"def expired?\n (Time.now - created_at) > 1.week\n end",
"def last_session\n user_exams.order('updated_at DESC').first\n end",
"def calc_expiry_time(seconds = 86400 * 7) # one week\n ((Time.now.utc + seconds).to_f * 1000).to_i\n end",
"def last_login_duration\n if self.last_session_id\n min = self.occurences.where(:session_id => self.last_session_id).minimum(\"created_at\")\n max = self.occurences.where(:session_id => self.last_session_id).maximum(\"created_at\")\n Time.diff(min, max, '%h:%m:%s')[:diff]\n else\n 0\n end\n end",
"def remember_me\n remember_me_for 2.weeks\n end",
"def training_sessions_remaining_this_month\n end",
"def update_last_user_activity\n now = session[:last_activity] = Time.now\n return if session_is_cloned?\n if ( current_user && (session[:last_activity_saved].nil? || (now - session[:last_activity_saved] > APP_CONFIG[:save_last_activity_granularity_in_seconds].to_i ) ) ) \n logger.info(\"Saved last activity date to #{now} for #{current_user.log_info}\")\n current_user.update_last_activity_date\n session[:last_activity_saved] = now\n end\n end",
"def remember_me\r\n remember_me_for 2.weeks\r\n end",
"def remember_me\n remember_me_for 2.weeks\n end",
"def remember_me\n remember_me_for 2.weeks\n end",
"def expired_on\n curr_company = Company.find(current_login.id)\n ((curr_company.created_at + 75.days).to_date - Date.today).round if curr_company.present?\n end",
"def expiry_time\n session[:expires_at] || 3.days.from_now\n end",
"def last_seen\n recently_seen.limit(30)\n end",
"def remember_me\n remember_me_for 2.weeks\n end",
"def last_workout_date\n workout_date_log = Hash.new\n date = self.exercise_instances.map do |workout|\n workout.date\n end.sort.last\n users = self.find_all_gym_users.last\n \"#{users} : #{date}\"\n\n\n end",
"def remember_me\n remember_me_until 2.weeks.from_now\n end",
"def recently_arrived\n (Time.now - self.created_at) <= 3.days\n end",
"def _since_last_visit(date)\n preferences = current_user.feed_preferences.where(feed_uid: params[:feed]).first_or_create(last_visited: date, previous_last_visited: date)\n\n if preferences.last_visited.end_of_day <= date.end_of_day - 1.day\n preferences.previous_last_visited = preferences.last_visited\n preferences.last_visited = date\n preferences.save!\n end\n\n since_last = date.end_of_day - preferences.previous_last_visited.end_of_day\n range = [1, (since_last / 1.day).round].max\n\n [range, since_last]\n end",
"def active_access?(count = 7)\n last_access_at && last_access_at > count.days.ago\n end",
"def get_session_time_left\n expire_time = if session[:expires_at].blank? then (DateTime.now + 30.minutes) else session[:expires_at] end\n @session_time_left = (expire_time.to_datetime - DateTime.now).to_f\n end",
"def hubssolib_get_last_used\n session = self.hubssolib_current_session\n session ? session.session_last_used : Time.now.utc\n end",
"def remember_me\n remember_me_for 2.weeks\n end",
"def remember_me\n remember_me_for 2.weeks\n end",
"def remember_me\n remember_me_for 2.weeks\n end",
"def remember_me\n remember_me_for 2.weeks\n end",
"def remember_me\n remember_me_for 2.weeks\n end",
"def remember_me\n remember_me_for 2.weeks\n end",
"def remember_me\n remember_me_for 2.weeks\n end",
"def remember_me\n remember_me_for 2.weeks\n end",
"def remember_me\n remember_me_for 2.weeks\n end",
"def remember_me\n remember_me_for 2.weeks\n end",
"def remember_me\n remember_me_for 2.weeks\n end",
"def remember_me\n remember_me_for 2.weeks\n end",
"def remember_me\n remember_me_for 2.weeks\n end",
"def remember_me\n remember_me_for 2.weeks\n end",
"def remember_me\n remember_me_for 2.weeks\n end",
"def remember_me\n remember_me_for 2.weeks\n end",
"def remember_me\n remember_me_for 2.weeks\n end",
"def remember_me\n remember_me_for 2.weeks\n end",
"def remember_me\n remember_me_for 2.weeks\n end",
"def remember_me\n remember_me_for 2.weeks\n end",
"def remember_me\n remember_me_for 2.weeks\n end",
"def remember_me\n remember_me_for 2.weeks\n end",
"def remember_me\n remember_me_for 2.weeks\n end",
"def remember_me\n remember_me_for 2.weeks\n end",
"def remember_me\n remember_me_for 2.weeks\n end",
"def remember_me\n remember_me_for 2.weeks\n end",
"def remember_me\n remember_me_for 2.weeks\n end",
"def remember_me\n remember_me_for 2.weeks\n end",
"def remember_me\n remember_me_for 2.weeks\n end",
"def remember_me\n remember_me_for 2.weeks\n end",
"def remember_me\n remember_me_for 2.weeks\n end",
"def remember_me\n remember_me_for 2.weeks\n end",
"def remember_me\n remember_me_for 2.weeks\n end",
"def remember_me\n remember_me_for 2.weeks\n end",
"def remember_me\n remember_me_for 2.weeks\n end",
"def remember_me\n remember_me_for 2.weeks\n end",
"def remember_me\n remember_me_for 2.weeks\n end",
"def remember_me\n remember_me_for 2.weeks\n end",
"def remember_me\n remember_me_for 2.weeks\n end",
"def remember_me\n remember_me_for 2.weeks\n end",
"def remember_me\n remember_me_for 2.weeks\n end",
"def remember_me\n remember_me_for 2.weeks\n end",
"def remember_me\n remember_me_for 2.weeks\n end",
"def remember_me\n remember_me_for 2.weeks\n end",
"def remember_me\n remember_me_for 2.weeks\n end",
"def remember_me\n remember_me_for 2.weeks\n end",
"def remember_me\n remember_me_for 2.weeks\n end",
"def remember_me\n remember_me_for 2.weeks\n end",
"def remember_me\n remember_me_for 2.weeks\n end",
"def remember_me\n remember_me_for 2.weeks\n end",
"def remember_me\n remember_me_for 2.weeks\n end",
"def remember_me\n remember_me_for 2.weeks\n end",
"def remember_me\n remember_me_for 2.weeks\n end",
"def remember_me\n remember_me_for 2.weeks\n end",
"def remember_me\n remember_me_for 2.weeks\n end",
"def remember_me\n remember_me_for 2.weeks\n end",
"def remember_me\n remember_me_for 2.weeks\n end",
"def remember_me\n remember_me_for 2.weeks\n end",
"def remember_me\n remember_me_for 2.weeks\n end",
"def last_week\n Date.week(Date.today - 7)\n end",
"def last_updates_viewed\n self.user.extend(Montage::User).last_login\n end",
"def new_requests_since_last_login(user)\n now = Time.now\n\n if !user.last_sign_in_at.blank?\n user_last_login = user.last_sign_in_at.to_datetime\n else\n user_last_login = Time.now.to_datetime\n end\n\n Request.pending.where(updated_at: (user_last_login)..now).count\n end",
"def update_activity_time\n session[:expires_at] = (configatron.session_time_out.to_i || 10).minutes.from_now\n end",
"def activation_token_expired?\n activation_sent_at < 7.days.ago\n end",
"def session_timeout\n #return if Rails.env.test?\n #check session last_seen\n if session[:last_seen] < SESSION_TIMEOUT_MINUTES.minutes.ago\n reset_session\n else\n session[:last_seen] = Time.now.utc\n end unless session[:last_seen].nil?\n #check when session created\n if Session.first.created_at < SESSION_WIPEOUT_HOURS.hours.ago\n Session.sweep\n end unless Session.first.nil?\n end",
"def get_last_seen\n last_seen = last_seen_at\n last_seen = current_sign_in_at if last_seen.blank?\n last_seen = last_sign_in_at if last_seen.blank?\n last_seen\n end",
"def session_expiry\n @session_expiry ||= 30 * 24 * 60 * 60\n end",
"def upcoming_sport_sessions\n sport_sessions_confirmed.where('date >= ?', Date.today).limit(3) #TODO: maybe we should use DateTime.now or Date.now\n end",
"def session_timeout\n 86400 # 1.day\n end",
"def refresh_session\n update_session(30.days.from_now)\n update_last_session\n end",
"def week_ago_timestamp\n (Time.now - 60 * 60 * 24 * 7).to_i\n end",
"def old_events_date\n # 86400 seconds == 1 day\n DateTime.now - @threshold / 86400.0\n end",
"def get_last_message_read(group)\n unless cookies[create_last_message_key(current_user, group)].nil?\n cookies[create_last_message_key(current_user, group)].to_datetime\n else\n DateTime.now - 1.day\n end\n end",
"def last_week(x = 1)\n\t\tself - (604800 * x)\n\tend",
"def last_login_date\n logins.last.created_at rescue logins.latest.created_at rescue Time.now\n end",
"def last_day_of_extended_grace_window\n (expiry_date + Rails.configuration.expires_after.years) - 1.day\n end"
] | [
"0.6567803",
"0.65608984",
"0.65503633",
"0.6289638",
"0.6248826",
"0.6241176",
"0.6206185",
"0.6200619",
"0.6173619",
"0.6169644",
"0.6154641",
"0.6126301",
"0.6087326",
"0.6087326",
"0.6084633",
"0.60753185",
"0.60572237",
"0.60571456",
"0.6014135",
"0.59815365",
"0.5977482",
"0.5973098",
"0.59722096",
"0.594417",
"0.59402746",
"0.58937943",
"0.58937943",
"0.58937943",
"0.58937943",
"0.58937943",
"0.58937943",
"0.58937943",
"0.58937943",
"0.58937943",
"0.58937943",
"0.58937943",
"0.58937943",
"0.58937943",
"0.58937943",
"0.58937943",
"0.58937943",
"0.58937943",
"0.58937943",
"0.58937943",
"0.58937943",
"0.58937943",
"0.58937943",
"0.58937943",
"0.58937943",
"0.58937943",
"0.58937943",
"0.58937943",
"0.58937943",
"0.58937943",
"0.58937943",
"0.58937943",
"0.58937943",
"0.58937943",
"0.58937943",
"0.58937943",
"0.58937943",
"0.58937943",
"0.58937943",
"0.58937943",
"0.58937943",
"0.58937943",
"0.58937943",
"0.58937943",
"0.58937943",
"0.58937943",
"0.58937943",
"0.58937943",
"0.58937943",
"0.58937943",
"0.58937943",
"0.58937943",
"0.58937943",
"0.58937943",
"0.58937943",
"0.58937943",
"0.58937943",
"0.58937943",
"0.58937943",
"0.58937943",
"0.5893197",
"0.5881687",
"0.5881386",
"0.58794034",
"0.5874004",
"0.58515275",
"0.5850329",
"0.58483654",
"0.58319336",
"0.5830469",
"0.58182526",
"0.58152795",
"0.5805365",
"0.5800549",
"0.5794008",
"0.57911927",
"0.578898"
] | 0.0 | -1 |
custom method with argument | def initialize(id, name, address)
@id = id
@name = name
@address = address
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def argue(argument)\n argument\nend",
"def method(arg0)\n end",
"def method(arg0)\n end",
"def arg; end",
"def meth(\n **\n ); end",
"def argue(argument)\n return argument\nend",
"def add_argument(arg); end",
"def add_argument(arg); end",
"def add_argument(arg); end",
"def meth(\n # this is important\n arg)\nend",
"def meth(*args)\n\n\n\nend",
"def method(param1, options = {})\n\tend",
"def meth **options\nend",
"def meth **options\nend",
"def PO110=(arg)",
"def method=(_arg0); end",
"def method=(_arg0); end",
"def method=(_arg0); end",
"def PO105=(arg)",
"def meth(arg1)\nend",
"def PO115=(arg)",
"def args(*) end",
"def PO104=(arg)",
"def meth(\n\n\n\n *args)\n\nend",
"def method(p0) end",
"def call(*args); end",
"def PO114=(arg)",
"def method_name=(_arg0); end",
"def method_name=(_arg0); end",
"def meth(arg1,arg2)\nend",
"def meth(arg1,arg2)\nend",
"def perform(*args); end",
"def PO109=(arg)",
"def PO108=(arg)",
"def PRF02=(arg)",
"def _perform(args); end",
"def ITD07=(arg)",
"def PO113=(arg)",
"def method_missing(method, *args, &block)\n if method.to_s =~ /^_(.+)$/\n arg = @in_args[$1.to_sym] || @out_args[$1.to_sym]\n return arg if !arg.nil?\n end\n\n super\n end",
"def PO101=(arg)",
"def PRF04=(arg)",
"def what_am_i arg arg2\n \nend",
"def PO103=(arg)",
"def PO111=(arg)",
"def param; end",
"def param; 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 extra_args; end",
"def put_var_arg\nend",
"def extra=(_arg0); end",
"def dispatch(*_arg0); end",
"def method ( a ,b ,c ) \nend",
"def call( *args )\n raise NotImplementedError\n end",
"def call(*) end",
"def call(*) end",
"def methodWithArgument(first, second = \"all\")\r\n\treturn \"Message: #{first} #{second}\"\r\nend",
"def a_method(arg1, arg2='default value')\n do_stuff\n end",
"def in_kwarg; end",
"def argue(argument)\n return \"#{argument}\"\nend",
"def ITD05=(arg)",
"def transformed_argname; end",
"def method(a, *b)\r\n\tb\r\nend",
"def meth(arg, *args)\n [arg, args]\nend",
"def meth(*args)\n args.shift\nend",
"def tricky_method(param)\n param << 'rutabaga'\nend",
"def PO107=(arg)",
"def PO106=(arg)",
"def call() end",
"def argument?; end",
"def invoke; end",
"def meth(**\n options)\nend",
"def wrapped_in=(_arg0); end",
"def PRF01=(arg)",
"def args; end",
"def args; end",
"def args; end",
"def args; end",
"def args; end",
"def args; end",
"def args; end",
"def args; end",
"def args; end",
"def args; end",
"def args; end",
"def args; end",
"def args; end",
"def args; end",
"def args; end",
"def args; end",
"def args; end"
] | [
"0.7025194",
"0.69801486",
"0.69801486",
"0.69365025",
"0.68236065",
"0.6809622",
"0.67950326",
"0.67950326",
"0.67950326",
"0.67503744",
"0.66862065",
"0.66191095",
"0.6570104",
"0.6570104",
"0.6551439",
"0.6543108",
"0.6543108",
"0.6543108",
"0.65203226",
"0.65169376",
"0.64927274",
"0.6481378",
"0.6457267",
"0.64518315",
"0.64415956",
"0.6433518",
"0.64271283",
"0.6407321",
"0.6407321",
"0.64012384",
"0.64012384",
"0.6388177",
"0.6363035",
"0.63507",
"0.6345401",
"0.63341886",
"0.63300645",
"0.6319383",
"0.63131493",
"0.6309545",
"0.62980723",
"0.6276218",
"0.62582827",
"0.62510985",
"0.62445176",
"0.62445176",
"0.6244075",
"0.6244075",
"0.6244075",
"0.6244075",
"0.6244075",
"0.6244075",
"0.6244075",
"0.6244075",
"0.6244075",
"0.6244075",
"0.6244075",
"0.6244075",
"0.6241786",
"0.62416303",
"0.6240502",
"0.62388426",
"0.62363154",
"0.62356937",
"0.6216405",
"0.6216405",
"0.62146556",
"0.62143964",
"0.6213163",
"0.62116987",
"0.62076616",
"0.62018776",
"0.61977714",
"0.6181575",
"0.61772996",
"0.617339",
"0.6167514",
"0.61611974",
"0.6156912",
"0.6143931",
"0.6136658",
"0.61332",
"0.61304414",
"0.6129389",
"0.6126623",
"0.6126623",
"0.6126623",
"0.6126623",
"0.6126623",
"0.6126623",
"0.6126623",
"0.6126623",
"0.6126623",
"0.6126623",
"0.6126623",
"0.6126623",
"0.6126623",
"0.6126623",
"0.6126623",
"0.6126623",
"0.6126623"
] | 0.0 | -1 |
Instance method with default argument | def display_details()
puts "Customer id is #{@id} "
puts "Customer name is #{@name} "
puts "Customer address is #{@address} "
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def method_missing(*args)\n default\n end",
"def default=(_arg0); end",
"def meth( x = nil)\nend",
"def default; end",
"def default; end",
"def default\n end",
"def a_method(arg1, arg2='default value')\n do_stuff\n end",
"def meth(\n # this is important\n important_arg,\n # a default, because we're not animals!\n default=nil)\nend",
"def foo(param = \"no\") #this is default param\n \"yes\"\nend",
"def method (number, default1 = 1, default2 = 2)\nend",
"def default(options = T.unsafe(nil)); end",
"def defaults!; end",
"def defaults!; end",
"def default=(_); end",
"def default_proc() end",
"def method(c=c)\r\nend",
"def set_default\n end",
"def meth(fallback: nil)\nend",
"def meth(fallback: nil)\nend",
"def safe_by_default=(_arg0); end",
"def method_with_optional_param(param = foo)\nend",
"def default _args\n \"default _args;\" \n end",
"def default(a = 10, b) # it's possible in ruby to have default value as first parameter\n return a, b\nend",
"def hello(name=\"World\") # Default parameter\n puts \"Hello #{ name }\"\nend",
"def default\n return nil unless default_value\n default_value.respond_to?(:call) ? default_value.call : default_value.dup\n end",
"def method (a=3, b)\r\nend",
"def default!\n @value = default\n end",
"def method(a=3)\r\n a\r\nend",
"def default(key) end",
"def two_arg_method_defaults(arg1=0, arg2=\"020202\")\n puts \"Here are my args: #{arg1}, #{arg2}\"\nend",
"def foo(param = 'no')\n 'yes'\nend",
"def foo(param = 'no')\n 'yes'\nend",
"def set_default(name, *args, &block)\n set(name, *args, &block) unless exists?(name)\nend",
"def set_default(name, *args, &block)\n set(name, *args, &block) unless exists?(name)\nend",
"def initialize_defaults(method_name)\n end",
"def one_parameter_method (argument=\"nothing\")\n return argument\nend",
"def default_bare=(_arg0); end",
"def foo(param = \"no\")\r\n \"yes\"\r\nend",
"def defaults; end",
"def defaults; end",
"def defaults; end",
"def defaults; end",
"def defaults; end",
"def defaults; end",
"def defaults; end",
"def defaults; end",
"def defaults; end",
"def defaults; end",
"def method_name(arguments = 'default parameters')\n #do something\n new_thing = arguments\n return new_thing\nend",
"def foo(param = \"no\")\n \"yes\"\nend",
"def foo(param = \"no\")\n \"yes\"\nend",
"def foo(param = \"no\")\n \"yes\"\nend",
"def foo(param = \"no\")\n \"yes\"\nend",
"def foo(param = \"no\")\n \"yes\"\nend",
"def foo(param = \"no\")\n \"yes\"\nend",
"def foo(param = \"no\")\n \"yes\"\nend",
"def foo(param = \"no\")\n \"yes\"\nend",
"def foo(param = \"no\")\n \"yes\"\nend",
"def foo(param = \"no\")\n \"yes\"\nend",
"def foo(param = \"no\")\n \"yes\"\nend",
"def default_object\n # XXX\n end",
"def default(key = nil) \n if key.is_a?(Symbol) && key?(key) \n self[key] \n else \n key ? super : super()\n end \n end",
"def define_default_method(object)\n object.__send__(:define_method, default_name, default_val)\n end",
"def default(value)\n @default = value\n @is_default_set = true\n class << self\n define_method :default do |*args|\n raise ArgumentError, \"default has already been set to #{@default.inspect}\" unless args.empty?\n\n alternative(@default)\n end\n end\n nil\n end",
"def default(a,b,c=2)\n puts \"c should equal 3 now: \"\n puts c\nend",
"def optional default_return_value = NoParameterMarker.instance\n if default_return_value == NoParameterMarker.instance\n repeat 0, 1 # default behaviour\n else\n repeat_with_default 0, 1, default_return_value\n end\n end",
"def default_url(*args); end",
"def method (a,\r\n\tb = 2)\r\nend",
"def f7(x=0, x: nil); end",
"def base=(_arg0); end",
"def default\n nil\n end",
"def default\n nil\n end",
"def method (a=3, b=4)\r\nend",
"def test_function(arg = 'hello')\n puts arg + ' world'\nend",
"def test(arg = nil)\n puts \"test\"\n end",
"def default=(value); end",
"def default *args\n @actor.gate.default( [ :object ] + args )\n end",
"def and_default_to(default_method, &block)\n raise(ArgumentError, 'Default method is nil!') unless default_method\n raise(ArgumentError, 'Default method has already been specified!') if @default_method\n\n @default_method = default_method\n attempt(block)\n end",
"def default_if_not_specified(opt,default_opt)\n opt ? opt : default_opt\nend",
"def param_default( param, value )\n param = value unless ( param && param.length > 0 )\n end",
"def initialize(default)\n @value = @default = default\n end",
"def overrides=(_arg0); end",
"def assign_name(default = 'Bob')\n default\nend",
"def default(id = T.unsafe(nil)); end",
"def method_missing( meth, *args, &block )\n if self.class.types.include?(meth) and args.length.between?(1,2)\n name = args[0]\n default = args.length == 2 ?\n args[1] : meth\n option = @klass.new(name, default)\n option.description, @description =\n @description, nil\n @options << option\n else\n super\n end\n end",
"def default(entity)\n case options[:default]\n when Proc\n entity.instance_eval options[:default]\n else\n options[:default]\n end\n end",
"def initialize(optional_arg = nil, *options)\n @optional_arg = optional_arg # handle it here, don't pass it on!\n end",
"def default\r\n @opts[:default]\r\n end",
"def method (a=3,\r\n\tb)\r\nend",
"def f2(x, x=0); end",
"def set_default(attr)\n return unless klass = self.class.attrclass(attr)\n return unless klass.method_defined?(:default)\n return if @parameters.include?(klass.name)\n\n return unless parameter = newattr(klass.name)\n\n if value = parameter.default and ! value.nil?\n parameter.value = value\n else\n @parameters.delete(parameter.name)\n end\n end",
"def default(locale, object, subject, options = T.unsafe(nil)); end",
"def initialize(*)\n super\n apply_defaults\n end",
"def func(my_data = \"defaultInput\")\n puts \"data is #{my_data}\" \nend",
"def f6(x, x: nil); end",
"def with_defaults(defaults); end",
"def greeting (msg = \"Hello World\")\n puts msg\nend",
"def method_missing(m,*a,&block)\n if Default.respond_to?(m)\n Default.send(m,*a,&block)\n else\n super\n end\n end",
"def add(first: 0, second: 1) \n # The argument first has a default of 0\n # second has a default of 1\n first + second\nend",
"def standalone=(_arg0); end",
"def method(arg0)\n end"
] | [
"0.79363966",
"0.7668559",
"0.7354355",
"0.7236202",
"0.7236202",
"0.7233034",
"0.7228414",
"0.71951133",
"0.7113134",
"0.6972962",
"0.6897148",
"0.68696153",
"0.68696153",
"0.6865064",
"0.6841292",
"0.68165755",
"0.6731259",
"0.6727561",
"0.6727561",
"0.6693945",
"0.6665807",
"0.6647061",
"0.6642211",
"0.66178864",
"0.6617468",
"0.6580433",
"0.6541451",
"0.6539458",
"0.65309906",
"0.6507244",
"0.64833826",
"0.64833826",
"0.6481265",
"0.6481265",
"0.646461",
"0.64644915",
"0.64517915",
"0.64456296",
"0.6434889",
"0.6434889",
"0.6434889",
"0.6434889",
"0.6434889",
"0.6434889",
"0.6434889",
"0.6434889",
"0.6434889",
"0.6434889",
"0.64210397",
"0.64135265",
"0.64135265",
"0.64135265",
"0.64135265",
"0.64135265",
"0.64135265",
"0.64135265",
"0.64135265",
"0.64135265",
"0.64135265",
"0.64135265",
"0.641227",
"0.64098275",
"0.6401471",
"0.6397699",
"0.6391024",
"0.63906884",
"0.63630164",
"0.6336342",
"0.63323987",
"0.631238",
"0.63123155",
"0.63123155",
"0.63007677",
"0.62997204",
"0.6291616",
"0.627665",
"0.6249028",
"0.62416697",
"0.6233184",
"0.6228726",
"0.62199455",
"0.6203495",
"0.6201403",
"0.619896",
"0.61971074",
"0.6192936",
"0.61917496",
"0.6190289",
"0.61901695",
"0.6183243",
"0.6182512",
"0.6181778",
"0.6180496",
"0.6176019",
"0.61683136",
"0.6157427",
"0.6143938",
"0.6138301",
"0.6136898",
"0.6134871",
"0.6133623"
] | 0.0 | -1 |
Instance method with default argument | def total_no_customer()
@@no_of_customer+=1
puts "The total number of customer is #{@@no_of_customer} "
puts " "
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def method_missing(*args)\n default\n end",
"def default=(_arg0); end",
"def meth( x = nil)\nend",
"def default; end",
"def default; end",
"def default\n end",
"def a_method(arg1, arg2='default value')\n do_stuff\n end",
"def meth(\n # this is important\n important_arg,\n # a default, because we're not animals!\n default=nil)\nend",
"def foo(param = \"no\") #this is default param\n \"yes\"\nend",
"def method (number, default1 = 1, default2 = 2)\nend",
"def default(options = T.unsafe(nil)); end",
"def defaults!; end",
"def defaults!; end",
"def default=(_); end",
"def default_proc() end",
"def method(c=c)\r\nend",
"def set_default\n end",
"def meth(fallback: nil)\nend",
"def meth(fallback: nil)\nend",
"def safe_by_default=(_arg0); end",
"def method_with_optional_param(param = foo)\nend",
"def default _args\n \"default _args;\" \n end",
"def default(a = 10, b) # it's possible in ruby to have default value as first parameter\n return a, b\nend",
"def default\n return nil unless default_value\n default_value.respond_to?(:call) ? default_value.call : default_value.dup\n end",
"def hello(name=\"World\") # Default parameter\n puts \"Hello #{ name }\"\nend",
"def method (a=3, b)\r\nend",
"def default!\n @value = default\n end",
"def method(a=3)\r\n a\r\nend",
"def default(key) end",
"def two_arg_method_defaults(arg1=0, arg2=\"020202\")\n puts \"Here are my args: #{arg1}, #{arg2}\"\nend",
"def foo(param = 'no')\n 'yes'\nend",
"def foo(param = 'no')\n 'yes'\nend",
"def set_default(name, *args, &block)\n set(name, *args, &block) unless exists?(name)\nend",
"def set_default(name, *args, &block)\n set(name, *args, &block) unless exists?(name)\nend",
"def one_parameter_method (argument=\"nothing\")\n return argument\nend",
"def initialize_defaults(method_name)\n end",
"def default_bare=(_arg0); end",
"def foo(param = \"no\")\r\n \"yes\"\r\nend",
"def defaults; end",
"def defaults; end",
"def defaults; end",
"def defaults; end",
"def defaults; end",
"def defaults; end",
"def defaults; end",
"def defaults; end",
"def defaults; end",
"def defaults; end",
"def method_name(arguments = 'default parameters')\n #do something\n new_thing = arguments\n return new_thing\nend",
"def foo(param = \"no\")\n \"yes\"\nend",
"def foo(param = \"no\")\n \"yes\"\nend",
"def foo(param = \"no\")\n \"yes\"\nend",
"def foo(param = \"no\")\n \"yes\"\nend",
"def foo(param = \"no\")\n \"yes\"\nend",
"def foo(param = \"no\")\n \"yes\"\nend",
"def foo(param = \"no\")\n \"yes\"\nend",
"def foo(param = \"no\")\n \"yes\"\nend",
"def foo(param = \"no\")\n \"yes\"\nend",
"def foo(param = \"no\")\n \"yes\"\nend",
"def foo(param = \"no\")\n \"yes\"\nend",
"def default_object\n # XXX\n end",
"def default(key = nil) \n if key.is_a?(Symbol) && key?(key) \n self[key] \n else \n key ? super : super()\n end \n end",
"def define_default_method(object)\n object.__send__(:define_method, default_name, default_val)\n end",
"def default(value)\n @default = value\n @is_default_set = true\n class << self\n define_method :default do |*args|\n raise ArgumentError, \"default has already been set to #{@default.inspect}\" unless args.empty?\n\n alternative(@default)\n end\n end\n nil\n end",
"def default(a,b,c=2)\n puts \"c should equal 3 now: \"\n puts c\nend",
"def optional default_return_value = NoParameterMarker.instance\n if default_return_value == NoParameterMarker.instance\n repeat 0, 1 # default behaviour\n else\n repeat_with_default 0, 1, default_return_value\n end\n end",
"def default_url(*args); end",
"def method (a,\r\n\tb = 2)\r\nend",
"def f7(x=0, x: nil); end",
"def default\n nil\n end",
"def default\n nil\n end",
"def base=(_arg0); end",
"def method (a=3, b=4)\r\nend",
"def test_function(arg = 'hello')\n puts arg + ' world'\nend",
"def test(arg = nil)\n puts \"test\"\n end",
"def default=(value); end",
"def default *args\n @actor.gate.default( [ :object ] + args )\n end",
"def and_default_to(default_method, &block)\n raise(ArgumentError, 'Default method is nil!') unless default_method\n raise(ArgumentError, 'Default method has already been specified!') if @default_method\n\n @default_method = default_method\n attempt(block)\n end",
"def default_if_not_specified(opt,default_opt)\n opt ? opt : default_opt\nend",
"def param_default( param, value )\n param = value unless ( param && param.length > 0 )\n end",
"def initialize(default)\n @value = @default = default\n end",
"def overrides=(_arg0); end",
"def assign_name(default = 'Bob')\n default\nend",
"def default(id = T.unsafe(nil)); end",
"def method_missing( meth, *args, &block )\n if self.class.types.include?(meth) and args.length.between?(1,2)\n name = args[0]\n default = args.length == 2 ?\n args[1] : meth\n option = @klass.new(name, default)\n option.description, @description =\n @description, nil\n @options << option\n else\n super\n end\n end",
"def default(entity)\n case options[:default]\n when Proc\n entity.instance_eval options[:default]\n else\n options[:default]\n end\n end",
"def default\r\n @opts[:default]\r\n end",
"def method (a=3,\r\n\tb)\r\nend",
"def initialize(optional_arg = nil, *options)\n @optional_arg = optional_arg # handle it here, don't pass it on!\n end",
"def f2(x, x=0); end",
"def set_default(attr)\n return unless klass = self.class.attrclass(attr)\n return unless klass.method_defined?(:default)\n return if @parameters.include?(klass.name)\n\n return unless parameter = newattr(klass.name)\n\n if value = parameter.default and ! value.nil?\n parameter.value = value\n else\n @parameters.delete(parameter.name)\n end\n end",
"def default(locale, object, subject, options = T.unsafe(nil)); end",
"def initialize(*)\n super\n apply_defaults\n end",
"def func(my_data = \"defaultInput\")\n puts \"data is #{my_data}\" \nend",
"def f6(x, x: nil); end",
"def with_defaults(defaults); end",
"def greeting (msg = \"Hello World\")\n puts msg\nend",
"def method_missing(m,*a,&block)\n if Default.respond_to?(m)\n Default.send(m,*a,&block)\n else\n super\n end\n end",
"def add(first: 0, second: 1) \n # The argument first has a default of 0\n # second has a default of 1\n first + second\nend",
"def standalone=(_arg0); end",
"def method(arg0)\n end"
] | [
"0.79370904",
"0.76697576",
"0.73546267",
"0.72378266",
"0.72378266",
"0.7234604",
"0.7228585",
"0.7195097",
"0.7113543",
"0.6973876",
"0.68984073",
"0.6870769",
"0.6870769",
"0.6866557",
"0.6842268",
"0.68171555",
"0.67325634",
"0.67280877",
"0.67280877",
"0.6694391",
"0.66653615",
"0.6647769",
"0.6643386",
"0.6618702",
"0.6618076",
"0.65806484",
"0.65427303",
"0.65401053",
"0.653265",
"0.65075254",
"0.6483483",
"0.6483483",
"0.64812917",
"0.64812917",
"0.6464508",
"0.6464384",
"0.64524233",
"0.64457726",
"0.64362514",
"0.64362514",
"0.64362514",
"0.64362514",
"0.64362514",
"0.64362514",
"0.64362514",
"0.64362514",
"0.64362514",
"0.64362514",
"0.64211404",
"0.6413575",
"0.6413575",
"0.6413575",
"0.6413575",
"0.6413575",
"0.6413575",
"0.6413575",
"0.6413575",
"0.6413575",
"0.6413575",
"0.6413575",
"0.6412971",
"0.64110035",
"0.64014894",
"0.6398726",
"0.6391905",
"0.63916034",
"0.63635737",
"0.63368964",
"0.63340974",
"0.6313638",
"0.6313638",
"0.6313191",
"0.6301097",
"0.62997323",
"0.62916994",
"0.6278029",
"0.62490964",
"0.62418413",
"0.6235007",
"0.62293756",
"0.6220309",
"0.6204008",
"0.62017846",
"0.62001723",
"0.61966753",
"0.6193164",
"0.61918193",
"0.6190509",
"0.6189737",
"0.6184624",
"0.6182653",
"0.6182606",
"0.6180262",
"0.6176484",
"0.6170105",
"0.6158134",
"0.61441815",
"0.6139192",
"0.6137633",
"0.6135141",
"0.61334234"
] | 0.0 | -1 |
TODO: Refactor, move to a separate controller. | def upload_image
if params[:item_image][:crop_x].to_i == 0 && params[:item_image][:crop_y].to_i == 0 \
&& params[:item_image][:crop_w].to_i == 0 && params[:item_image][:crop_h].to_i == 0
@item_image = ItemImage.where('item_token = ? AND item_id is ?', params[:item_image][:item_token], nil).first
else
@item_image_old = ItemImage.where('item_token = ?', params[:item_image][:item_token]).last
if @item_image_old.nil?
@item_image = @item_image_old
else
@item_image = @item_image_old.dup
@item_image.image = @item_image_old.image
@item_image.item_id = nil
end
end
if @item_image.nil?
@item_image = ItemImage.new
end
# item = Item.find_by_token(params[:item_image][:item_token])
# @item_image.item_id = item.id
if params[:item_image][:image]
array_item_image = params[:item_image][:image].original_filename.split('.').last
params[:item_image][:image].original_filename = "#{DateTime.now.strftime("%Y_%m_%d_%H_%M_%S")}" + "." + array_item_image.to_s
end
@item_image.image = params[:item_image][:image]
@item_image.item_token = params[:item_image][:item_token]
@item_image.crop_x = params[:item_image][:crop_x]
@item_image.crop_y = params[:item_image][:crop_y]
@item_image.crop_w = params[:item_image][:crop_w]
@item_image.crop_h = params[:item_image][:crop_h]
@item_image.rate = params[:item_image][:rate]
if @item_image.save
respond_to do |format|
format.js { render :upload_image_success }
end
else
respond_to do |format|
format.js { render :upload_image_error }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def controller; end",
"def controller; end",
"def controller; end",
"def controller; end",
"def controller; end",
"def controller; end",
"def controller; end",
"def controller; end",
"def controller; end",
"def controller; end",
"def controller\n end",
"def controller\n end",
"def private; end",
"def controller(controller); end",
"def request; end",
"def request; end",
"def request; end",
"def request; end",
"def request; end",
"def request; end",
"def request; end",
"def request; end",
"def request; end",
"def request; end",
"def request; end",
"def index\n \n end",
"def index\n \n end",
"def index\n \n end",
"def req\n \n end",
"def get; end",
"def get()\n \n end",
"def index\n \n end",
"def index\n \n end",
"def index\n \n end",
"def index\n \n end",
"def index\n \n end",
"def index\n \n end",
"def index\n \n end",
"def index\n \n end",
"def index\n \n end",
"def index\n \n end",
"def index\n \n end",
"def index\n \n end",
"def index\n \n end",
"def index\n \n end",
"def index\n \n end",
"def index\n \n end",
"def index\n \n end",
"def index\n \n end",
"def index\n \n end",
"def index\n \n end",
"def index\n \n end",
"def index\n \n end",
"def index\n \n end",
"def index\n \n end",
"def index\n \n end",
"def index\n \n end",
"def index\n \n end",
"def index; end",
"def index; end",
"def index; end",
"def index; end",
"def index; end",
"def index; end",
"def index; end",
"def index; end",
"def index; end",
"def index; end",
"def index; end",
"def index; end",
"def index; end",
"def index; end",
"def index; end",
"def index; end",
"def index; end",
"def index; end",
"def index; end",
"def index; end",
"def index; end",
"def index; end",
"def index; end",
"def index; end",
"def index; end",
"def index; end",
"def index; end",
"def index; end",
"def index; end",
"def index; end",
"def index; end",
"def index; end",
"def index; end",
"def handler; end",
"def handler; end",
"def action; end",
"def action; end",
"def action; end",
"def action; end",
"def action; end",
"def actions; end",
"def view; end",
"def index\n\n end"
] | [
"0.6420727",
"0.6420727",
"0.6420727",
"0.6420727",
"0.6420727",
"0.6420727",
"0.6420727",
"0.6420727",
"0.6420727",
"0.6420727",
"0.6345062",
"0.6345062",
"0.6316518",
"0.6276356",
"0.6247326",
"0.6247326",
"0.6247326",
"0.6247326",
"0.6247326",
"0.6247326",
"0.6247326",
"0.6247326",
"0.6247326",
"0.6247326",
"0.6247326",
"0.61257565",
"0.61257565",
"0.61257565",
"0.61178523",
"0.610694",
"0.6096491",
"0.60928464",
"0.6080508",
"0.6080508",
"0.6080508",
"0.6080508",
"0.6080508",
"0.6080508",
"0.6080508",
"0.6080508",
"0.6080508",
"0.6080508",
"0.6080508",
"0.6080508",
"0.6080508",
"0.6080508",
"0.6080508",
"0.6080508",
"0.6080508",
"0.6080508",
"0.6080508",
"0.6080508",
"0.6080508",
"0.6080508",
"0.6080508",
"0.6080508",
"0.6080508",
"0.6080508",
"0.6080462",
"0.607972",
"0.607972",
"0.607972",
"0.607972",
"0.607972",
"0.607972",
"0.607972",
"0.607972",
"0.607972",
"0.607972",
"0.607972",
"0.607972",
"0.607972",
"0.607972",
"0.607972",
"0.607972",
"0.607972",
"0.607972",
"0.607972",
"0.607972",
"0.607972",
"0.607972",
"0.607972",
"0.607972",
"0.607972",
"0.607972",
"0.607972",
"0.607972",
"0.607972",
"0.607972",
"0.607972",
"0.607972",
"0.59676427",
"0.59676427",
"0.5961474",
"0.5961474",
"0.5961474",
"0.5961474",
"0.5961474",
"0.5949462",
"0.5900191",
"0.5897622"
] | 0.0 | -1 |
Function for finding the name of a process given it's PID | def find_procname(pid)
name = nil
@client.sys.process.get_processes.each do |proc|
if proc['pid'] == pid.to_i
name = proc['name']
end
end
return name
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_process_name\n processes = client.sys.process.get_processes\n current_pid = session.sys.process.getpid\n processes.each do |proc|\n return proc['name'] if proc['pid'] == current_pid\n end\n return nil\n end",
"def find_process_id(process_name)\n process = remote_processes.find { |p| p.cmd.include?(process_name) }\n process ? process.pid : nil\n end",
"def process_name\r\n @process_name ||= $0.dup\r\n end",
"def name\n return @name unless @name.nil?\n \"#{@name_prefix}host:#{Socket.gethostname} pid:#{Process.pid}\" rescue \"#{@name_prefix}pid:#{Process.pid}\"\n end",
"def get_pid(proc_name)\n processes = client.sys.process.get_processes\n processes.each do |proc|\n if proc['name'] == proc_name && proc['user'] != \"\"\n return proc['pid']\n end\n end\n return nil\n end",
"def parent_pid(pid)\n\tstat = File.open(\"/proc/#{pid}/stat\") { |i| i.read }\n\tstat.gsub!(/^.*\\)\\s.\\s/, '')\n\tstat.split[0].to_i\nend",
"def process_name\n\n\t\t::Pantheios::Core.process_name\n\tend",
"def _pid_filename\n if respond_to?(:service_pid_filename)\n return service_pid_filename\n else\n return File.join(RAILS_ROOT, 'tmp', 'pids',\n \"#{_display_name.underscore.gsub(/\\s+/, '_')}.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 combined_process_name(process_name)\n process_name[PROCESS_NAME_REGEX,1]\n end",
"def combined_process_name(process_name)\n process_name[PROCESS_NAME_REGEX,1]\n end",
"def combined_process_name(process_name)\n process_name[PROCESS_NAME_REGEX,1]\n end",
"def pid\n $PROCESS_ID\n end",
"def get_shell_name\n psout = cmd_exec('ps -p $$').to_s\n psout.split(\"\\n\").last.split(' ')[3]\n rescue\n raise 'Unable to gather shell name'\n end",
"def parse_pid(pr)\n pr.split[1]\n end",
"def pidof(program)\n pids = []\n full = cmd_exec('ps -elf').to_s\n full.split(\"\\n\").each do |pid|\n pids << pid.split(' ')[3].to_i if pid.include? program\n end\n pids\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 pid\n @pid ||= Process.pid\n end",
"def find_soffice_pid\n %x(pgrep #{soffice_pname}).presence&.to_i\n end",
"def ppid\n Process.ppid\n end",
"def pid; ::Process.pid end",
"def process_username(pid)\n uid = File.stat(\"/proc/#{pid}\").uid\n File.foreach('/etc/passwd').each do |line|\n if line.split(':')[2] == \"#{uid}\"\n return line.split(':')[0]\n end\n end\n end",
"def pid_from_window(id)\n\tIO.popen(_net_wm(id)) { |p| p.readline.chomp }.split[2].to_i\nend",
"def pid\n `cat #{pid_file_path}`.gsub(\"\\n\", \"\")\n end",
"def getpid\n @resource.fail \"Either stop/status commands or a pattern must be specified\" unless @resource[:pattern]\n ps = Facter[\"ps\"].value\n @resource.fail \"You must upgrade Facter to a version that includes 'ps'\" unless ps and ps != \"\"\n regex = Regexp.new(@resource[:pattern])\n self.debug \"Executing '#{ps}'\"\n IO.popen(ps) { |table|\n table.each_line { |line|\n if regex.match(line)\n ary = line.sub(/^\\s+/, '').split(/\\s+/)\n return ary[1]\n end\n }\n }\n\n nil\n end",
"def pid\n File.open( pid_path ) { |f| return f.gets.to_i } if File.exist?(pid_path)\n end",
"def get_real_pid\n raise RuntimeError.new(\"Unsupported platform: get_real_pid\") unless @is_linux\n v = File.open(\"/proc/#{Process.pid}/sched\", &:readline)\n v.match(/\\d+/).to_s.to_i\n end",
"def pid() end",
"def pid() end",
"def pid() end",
"def pid()\n #This is a stub, used for indexing\n end",
"def process_id\n\n\t\t::Pantheios::Core.process_id\n\tend",
"def get_pid\n\t\tEventMachine::get_subprocess_pid @signature\n\tend",
"def service_pid\n _pid_file_pid\n end",
"def pid\n matched = exit_info.scan(/pid ([0-9]+)/).first\n matched.first.to_i if matched\n end",
"def pid\n @pid ||= Process.pid\n end",
"def pid\n @pid ||= Process.pid\n end",
"def find_parent_pid pid\n ppid = nil\n wmi.ExecQuery(\"SELECT * FROM Win32_Process WHERE ProcessID=#{pid}\").each{|i|\n ppid = i.ParentProcessID\n }\n return ppid\n end",
"def pid(params)\n Felixwrapper.configure(params)\n pid = Felixwrapper.instance.pid\n return nil unless pid\n pid\n end",
"def find_pids(name)\n\tproc_pid = []\n\[email protected]_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 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 task_for_pid(pid, target=nil)\n target ||= mach_task_self \n port = (\"\\x00\"*SIZEOFINT).to_ptr\n r = CALLS[\"libc!task_for_pid:IIP=I\"].call(target, pid, port).first\n raise KernelCallError.new(:task_for_pid, r) if r != 0\n return port.to_s(SIZEOFINT).unpack('i_').first\n end",
"def get_container_id(name)\n compose_execute(\"ps\", \"-q\", name).chomp\n end",
"def target2pid(target)\n target ? target[0..(@prefix_len - 1)] : Plezi.app_name\n end",
"def pgid_from_pid(pid)\n Process.getpgid(pid)\n rescue Errno::ESRCH\n nil\n end",
"def pid(*args)\n result = self.info(\"--pid\", *args).collect{ |str| str.scan(REGEX_PID) }\n result.flatten!.compact!\n\n result.first.strip.to_i\n end",
"def pid_path\n @pid_path.to_s\n end",
"def process_id\n return @process_id\n end",
"def get_real_pid\n raise RuntimeError.new(\"Unsupported platform: get_real_pid\") unless @is_linux\n\n sched_file = \"/proc/#{Process.pid}/sched\"\n pid = Process.pid\n\n if File.exist?(sched_file)\n v = File.open(sched_file, &:readline)\n pid = v.match(/\\d+/).to_s.to_i\n end\n pid\n end",
"def pid(*) 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 pid\n @pid\n end",
"def pid\n cmd = shell_out(%w{sv status} + [new_resource.service_name])\n if !cmd.error? && md = cmd.stdout.match(/run: #{new_resource.service_name}: \\(pid (\\d+)\\)/)\n md[1].to_i\n else\n nil\n end\n end",
"def pid_path\n pid_path ||= get_pid_path\n end",
"def proc_name\n data = read_cpuinfo.match(/model name\\s*:\\s*(.+)/)[1]\n\n return data.strip\n end",
"def report_pid\n @process[:report_pid]\n end",
"def get_pidfile(filename)\n \"#{PIDDIR}/#{File.basename(filename)}.pid\"\nend",
"def program_name\n File.basename($0)\n end",
"def cmd_from_pid(pid)\n\tcmd = File.open(\"/proc/#{pid}/cmdline\") { |i| i.read }.split(/\\0/)\nend",
"def param_from_pid( param )\n tuples = {}\n `ps -eo pid,#{param}`.split(\"\\n\").each_with_index() do |row, index|\n next unless index > 0\n cols = row.split(' ')\n tuples[cols[0]] = cols[1]\n end\n tuples\nend",
"def pid\n nil\n end",
"def pid\n @pid = python_p('gdb.selected_inferior().pid').to_i\n end",
"def pid\n end",
"def [](process_name)\n if process_name.include? '.'\n select { |process| process.type == process_name }\n else\n select { |process| process.process == process_name }.first\n end\n end",
"def pid\n @pid ||= metadata.fetch(@args.command, nil)\n end",
"def get_pid\n File.exists?(@pid_file) ? File.read(@pid_file).strip : 0\n end",
"def program_name\n @program_name || File.basename($0, '.*')\n end",
"def pid\n @pid ||= down? ? nil : @raw[2]\n end",
"def pid\n @__pid\n end",
"def get_full_ps_info(pid)\n ps_fullcmd = @ps_fullcmd_fmt % pid\n # p ps_fullcmd\n output = `#{ps_fullcmd}`\n return output\n end",
"def get_uid_of_pid(pid)\n IO.foreach(\"/proc/#{pid}/status\") do |line|\n case line\n when /Uid:\\s*?(\\d+)\\s*?(\\d+)/\n return($1.to_i)\n end\n end\n end",
"def report_pid\n @process[:report_pid]\n end",
"def getpid\n CALLS[\"libc!getpid:=I\"].call.first\n end",
"def dispatch_id\n local_ip + '/' + Process.pid.to_s\n end",
"def get_pid\n pid_file = File.join(PROXYFS_ROOT, \"tmp/proxyfs.pid\")\n\n return File.read(pid_file).to_i if File.exists?(pid_file)\n\n return nil\nend",
"def extract_pid(uri)\n URI(uri).path.split('/').last\n end",
"def pid\n raise \"pid() must be overridden\"\n end",
"def pid; end",
"def pid; end",
"def pid; end",
"def pid\n process_pid = ::Process.pid\n if @ppid != process_pid\n @pid = nil\n @ppid = process_pid\n end\n @pid ||= SecureRandom.urlsafe_base64.tap { |str| @prefix_len = str.length }\n end",
"def pid_file\n base_info_file + '.pid'\n end",
"def generate_name\r\n z = Time.now.getutc\r\n name = z.strftime(\"%Y%m%d.%H%M.%S.\") + sprintf(\"%03d\", (z.tv_usec / 1000))\r\n return name\r\n # Process.pid kddkd\r\n end",
"def _pid\n @@_pid ||= Process.pid\n end",
"def read_pid\n File.read(pid_path).to_i\n end",
"def read_pid\n File.read(pid_path).to_i\n end",
"def has_process?(processname)\n\t\t\t\tif(!processname.kind_of?(Regexp))\n\t\t\t\t\tprocessname = Regexp.new(Regexp.escape(processname))\n\t\t\t\tend\n\t\t\t\t\n\t\t\t\tprocesses().each_value() { |runningprocess|\n\t\t\t\t\tif(processname.match(runningprocess.program))\n\t\t\t\t\t\tCfruby.controller.inform('debug', \"\\\"#{processname.source}\\\" is running\")\n\t\t\t\t\t\treturn(runningprocess)\n\t\t\t\t\tend\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tCfruby.controller.inform('debug', \"\\\"#{processname.source}\\\" is not running\")\n\t\t\t\treturn(false)\n\t\t\tend",
"def pid\n return @pid unless @pid.nil?\n\n @pid = (open(pidpath, 'r').read.to_i if pidfile_exists?)\n end",
"def format_pid(pid)\n pid.gsub(\":\", \"_\")\n end",
"def pid\n @sock.cmd(\"String\" => \"pid\", \"Match\" => /(SUCCESS:.*\\n|ERROR:.*\\n|END.*\\n)/)\n end",
"def pid_to_fedora_id pid\n 'info:fedora/' + pid\n end",
"def get_pid(cf, https = false)\n pidfile = get_pidfile(cf, https)\n pid = nil\n if File.readable? pidfile\n File.open(pidfile, 'r') do |file|\n pid = file.readline\n end\n end\n pid.to_i\n end",
"def pid\n File.read(@pid_file).strip.to_i\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 get_window_name(win_id)\n @driver.getWindowName(win_id)\n end",
"def pid\n return @pid unless @pid.nil?\n\n if self.pidfile_exists?\n @pid = open(self.pidpath, 'r').read.to_i\n else\n @pid = nil\n end\n end",
"def pid=(_arg0); end",
"def _pid_file_pid\n /^(\\d*)$/ =~ _pid_file_content\n return $1.blank? ? nil : $1.to_i\n end",
"def pidfile(runclass = self.class)\n \"%s%s.pid\" % [ BASEDIR, runclass.to_s.sub(/.*::/,'') ]\n end",
"def game_name()\n if @handle.ptr == nil\n raise \"this is disposed\"\n end\n result = Native.Run_game_name(@handle.ptr)\n result\n end"
] | [
"0.83733445",
"0.7197474",
"0.70219266",
"0.68831986",
"0.6874601",
"0.67912555",
"0.6779756",
"0.67587376",
"0.6654644",
"0.6572169",
"0.65699637",
"0.65699637",
"0.6537542",
"0.6528335",
"0.6482057",
"0.64375377",
"0.643414",
"0.63666916",
"0.63474447",
"0.6315337",
"0.6308912",
"0.63075495",
"0.6265578",
"0.62573504",
"0.6237729",
"0.62332135",
"0.62329775",
"0.6232956",
"0.6232956",
"0.6232956",
"0.62084293",
"0.6204901",
"0.62022483",
"0.61887294",
"0.6186105",
"0.61695683",
"0.61695683",
"0.616506",
"0.6134731",
"0.6127086",
"0.6122245",
"0.612093",
"0.6119408",
"0.6118792",
"0.6092595",
"0.6088682",
"0.6084083",
"0.60450953",
"0.60435194",
"0.6029203",
"0.60153097",
"0.59991235",
"0.59942347",
"0.5982479",
"0.5968688",
"0.5958391",
"0.59574294",
"0.59561193",
"0.59409136",
"0.5934911",
"0.5921637",
"0.59215766",
"0.5907741",
"0.59033227",
"0.59019846",
"0.5893318",
"0.5888516",
"0.5885018",
"0.5880377",
"0.5876953",
"0.5856752",
"0.58381754",
"0.58339256",
"0.58249724",
"0.58013856",
"0.57906747",
"0.57642543",
"0.576007",
"0.576007",
"0.576007",
"0.5751065",
"0.57423466",
"0.5739977",
"0.57368153",
"0.57239944",
"0.57239944",
"0.57220423",
"0.5717339",
"0.56841034",
"0.56597555",
"0.56532425",
"0.56467944",
"0.5627124",
"0.5626008",
"0.56252855",
"0.5625284",
"0.5617835",
"0.56138676",
"0.56099373",
"0.56035835"
] | 0.8645071 | 0 |
Find all PID's for a given process name | def find_pids(name)
proc_pid = []
@client.sys.process.get_processes.each do |proc|
if proc['name'].downcase == name.downcase
proc_pid << proc['pid']
end
end
return proc_pid
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"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_pids\n access_processes do |processes|\n processes.keys\n end\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 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 child_pids(pid)\n\tkids = []\n\tDir.foreach('/proc') do |entry|\n\t\tnext unless entry =~ /^\\d+$/\n\t\tnext if parent_pid(entry) != pid\n\t\tkids << entry.to_i\n\tend\n\tkids\nend",
"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 get_procs_by_name(proc_name)\n raise 'No process name announced' if proc_name.to_s.empty?\n proc_strings = `ps auxww |grep #{proc_name[0...-1]}[#{proc_name[-1]}]`.split(\"\\n\")\n procs = []\n proc_strings.each do |proc_string|\n proc_columns = proc_string.split\n proc_hash = {}\n proc_hash[:owner] = proc_columns[USER_INDEX]\n proc_hash[:pid] = proc_columns[PID_INDEX]\n proc_hash[:name] = final_path_component(proc_columns[NAME_INDEX])\n proc_hash[:full_cmd_line] = proc_string\n next unless proc_hash[:name] == proc_name\n procs << proc_hash\n end\n return procs\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 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 search_by_name(process_name)\n if process_name =~ /^\\/.*\\/$/\n process_name.slice!(0)\n process_name = Regexp.new(/#{process_name.chop}/)\n find_all\n else\n find_by_name(process_name)\n end\n\n process_list = Array.new\n\n @proc_table.each do |process|\n if process_name.is_a? Regexp\n process_list << process if process.name =~ process_name || process.commandline =~ process_name\n else\n process_list << process if process.name.to_s.downcase == \"#{process_name.to_s.downcase}\" || process.commandline.to_s.downcase == \"#{process_name.to_s.downcase}\"\n end\n end\n\n process_list = nil if process_list.empty?\n\n return process_list\n end",
"def pidof(program)\n pids = []\n full = cmd_exec('ps -elf').to_s\n full.split(\"\\n\").each do |pid|\n pids << pid.split(' ')[3].to_i if pid.include? program\n end\n pids\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 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 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 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 find_process_id(process_name)\n process = remote_processes.find { |p| p.cmd.include?(process_name) }\n process ? process.pid : nil\n end",
"def get_child_pids(parent_pid)\n processes = Sys::ProcTable.ps.select{ |pe| pe.ppid == parent_pid }\n processes.map {|process| [process.pid, process.ppid]}.flatten - [parent_pid]\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 process_names\n @processes.map { |p| @names[p] }\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 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 get_child_pids(parent_pid)\n descendants = Hash.new{ |ht,k| ht[k] = [k] }\n Hash[*`ps -eo pid,ppid`.scan(/\\d+/).map{ |x| x.to_i }].each{ |pid, ppid|\n descendants[ppid] << descendants[pid]\n }\n descendants[parent_pid].flatten - [parent_pid]\n end",
"def get_children_pids(pid)\n pid = pid.to_i\n unless process_tree.key? pid\n log \"No such pid: #{pid}\"\n return []\n end\n process_tree[pid][:children].inject([pid]) do |all_children_pids, child_pid|\n all_children_pids + get_children_pids(child_pid)\n end\n end",
"def pids_by_regexp(regexp)\n matched = {}\n process_tree.each do |pid,process|\n matched[pid] = process if process[:cmd] =~ regexp\n end\n matched\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 determine_processes\n procs = @shell.query('PROCESSES', 'ps aux')\n @info[:processes] = procs.gsub(/\\r/, '').split(/\\n/)\n end",
"def find_by_pid(pid)\n @proc_table = Array.new\n ProcFetch.get_process(:processid => pid).each do |proc_attrs|\n @proc_table.push(ProcInfo.new(proc_attrs))\n end\n childs_tree\n end",
"def find_by_name(name)\n @proc_table = Array.new\n ProcFetch.get_process({:name => name}).each do |proc_attrs|\n @proc_table.push(ProcInfo.new(proc_attrs))\n end\n childs_tree\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 server_pids\n `lsof -wni | grep ruby | grep IPv4 | awk '{print $2}'`\n end",
"def pids\n @pids ||= {}\n end",
"def get_procs( symbol, name )\n return nil if @procs.size == 0\n @procs.find_all do |sym, match, block|\n (\n (sym.nil? or symbol == sym) and\n ((name.nil? and match.nil?) or match.nil? or (\n (name == match) or\n (match.kind_of? Regexp and name =~ match)\n )\n )\n )\n end.collect{|x| x[-1]}\n end",
"def get_process_array(wmi)\r\n # This looks clumsy, but the processes object doesn't support #map. :)\r\n processes=wmi.ExecQuery(\"select * from win32_process where name='WINWORD.EXE'\")\r\n ary=[]\r\n processes.each {|p|\r\n ary << p.ProcessId\r\n }\r\n processes=nil\r\n ary\r\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 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 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 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 list_processes\n check_connection\n @fields = @protocol.process_info_command\n @result_exist = true\n store_result\n end",
"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 processes_in_same_group(pgid)\n open_processes = `ps -eo pid,pgid,state,command | tail -n +2`.strip.split(\"\\n\").map { |x| x.strip }\n parsed_processes = open_processes.map { |x| /(?<pid>.*?)\\s+(?<pgid>.*?)\\s+(?<state>.*?)\\s+(?<command>.*)/.match(x) }\n .select { |x| x[\"pgid\"].to_i == pgid && x[\"state\"] !~ /Z/ }\n pid_commands = {}\n\n parsed_processes.each do |process|\n pid_commands[process[\"pid\"].to_i] = process[\"command\"]\n end\n\n return pid_commands\n end",
"def param_from_pid( param )\n tuples = {}\n `ps -eo pid,#{param}`.split(\"\\n\").each_with_index() do |row, index|\n next unless index > 0\n cols = row.split(' ')\n tuples[cols[0]] = cols[1]\n end\n tuples\nend",
"def get_pid(proc_name)\n processes = client.sys.process.get_processes\n processes.each do |proc|\n if proc['name'] == proc_name && proc['user'] != \"\"\n return proc['pid']\n end\n end\n return nil\n end",
"def collect_process_info\n process = {}\n cmdline_file = \"/proc/#{Process.pid}/cmdline\"\n\n # If there is a /proc filesystem, we read this manually so\n # we can split on embedded null bytes. Otherwise (e.g. OSX, Windows)\n # use ProcTable.\n if File.exist?(cmdline_file)\n cmdline = IO.read(cmdline_file).split(?\\x00)\n else\n cmdline = ProcTable.ps(Process.pid).cmdline.split(' ')\n end\n\n if RUBY_PLATFORM =~ /darwin/i\n cmdline.delete_if{ |e| e.include?('=') }\n process[:name] = cmdline.join(' ')\n else\n process[:name] = cmdline.shift\n process[:arguments] = cmdline\n end\n\n process[:pid] = Process.pid\n # This is usually Process.pid but in the case of containers, the host agent\n # will return to us the true host pid in which we use to report data.\n process[:report_pid] = nil\n process\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 foreman_pids\n `ps aux | grep \"[f]oreman: master\" | awk '{ print $2 }'`.split(\"\\n\")\n end",
"def processes\n request('getAllProcessInfo')\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 pid(*args)\n result = self.info(\"--pid\", *args).collect{ |str| str.scan(REGEX_PID) }\n result.flatten!.compact!\n\n result.first.strip.to_i\n end",
"def kill_pids_by_regexp(regexp)\n pids = pids_by_regexp(regexp).keys\n kill_pids pids\n end",
"def worker_pids\n work_units.all(:select => 'worker_pid').map(&:worker_pid)\n end",
"def process_walk\n\t\tprint_status('Enumerating Running Process.....')\n\t\tpsz=[] #process name\n\t\[email protected]('mib-2.25.4.2.1.2') { |x| psz << x.value }\n\t\tif psz.empty?\n\t\t\tprint_error(\"No Values Found!\")\n\t\telse\n\t\t\tps_present = [['PID', 'Process', 'Path']]\n\t\t\tpidz=[] #PID valud\n\t\t\[email protected]('mib-2.25.4.2.1.1') { |x| pidz << x.value }\n\n\t\t\tpathz=[] #Path of process\n\t\t\[email protected]('mib-2.25.4.2.1.4') do |path|\n\t\t\t\tif path.value.chomp != '' and not path.nil?\n\t\t\t\t\tpathz << path.value\n\t\t\t\telse\n\t\t\t\t\tpathz << \" - \"\n\t\t\t\tend\n\t\t\tend\n\t\t\tcount=0\n\t\t\twhile count.to_i < psz.size\n\t\t\t\tps_present << [[ \"#{pidz[count]}\", \"#{psz[count]}\", \"#{pathz[count]}\" ]]\n\t\t\t\tcount = count.to_i + 1\n\t\t\tend\n\n\t\t\ttable = ps_present.to_table(:first_row_is_head => true)\n\t\t\tputs table.to_s\n\t\tend\n\tend",
"def linux_processes\n\t\tlist = []\n\t\t::Dir[\"/proc/*/stat\"].select { |file| file =~ /\\/proc\\/\\d+\\// }.each do |file|\n\t\t\tbegin\n\t\t\t\tlist << read_proc_file(file)\n\t\t\trescue\n\t\t\t\t# process died between the dir listing and accessing the file\n\t\t\tend\n\t\tend\n\t\tlist\n\tend",
"def linux_processes\n\t\tlist = []\n\t\t::Dir[\"/proc/*/stat\"].select { |file| file =~ /\\/proc\\/\\d+\\// }.each do |file|\n\t\t\tbegin\n\t\t\t\tlist << read_proc_file(file)\n\t\t\trescue\n\t\t\t\t# process died between the dir listing and accessing the file\n\t\t\tend\n\t\tend\n\t\tlist\n\tend",
"def validate_pids(pids, allow_pid_0 = false, allow_session_pid = false)\n\n return [] if (pids.class != Array or pids.empty?)\n valid_pids = []\n # to minimize network traffic, we only get host processes once\n host_processes = client.sys.process.get_processes\n if host_processes.length < 1\n print_error \"No running processes found on the target host.\"\n return []\n end\n\n # get the current session pid so we don't suspend it later\n mypid = client.sys.process.getpid.to_i\n\n # remove nils & redundant pids, conver to int\n clean_pids = pids.compact.uniq.map{|x| x.to_i}\n # now we look up the pids & remove bad stuff if nec\n clean_pids.delete_if do |p|\n ( (p == 0 and not allow_pid_0) or (p == mypid and not allow_session_pid) )\n end\n clean_pids.each do |pid|\n # find the process with this pid\n theprocess = host_processes.find {|x| x[\"pid\"] == pid}\n if ( theprocess.nil? )\n next\n else\n valid_pids << pid\n end\n end\n valid_pids\n end",
"def instruments_pids(&block)\n pids = pids_from_ps_output\n if block_given?\n pids.each do |pid|\n block.call(pid)\n end\n else\n pids\n end\n end",
"def find_windows_pids(pid_json_path, recursion_limit = 6)\n pid_hash = ::JSON.parse(File.read(pid_json_path), symbolize_names: true)\n pid_array = []\n pid_array << pid_hash[:mongod_pid] if pid_hash[:mongod_pid]\n pid_array += pid_hash[:dj_pids] if pid_hash[:dj_pids]\n pid_array << pid_hash[:rails_pid] if pid_hash[:rails_pid]\n pid_list = pid_array.clone\n pid_str = `WMIC PROCESS get Caption,ProcessId,ParentProcessId`.split(\"\\n\\n\")\n pid_str.shift\n fully_recursed = false\n recursion_level = 0\n until fully_recursed\n recursion_level += 1\n prior_pid_list = pid_list\n pid_str.each do |p_desc|\n if pid_list.include? p_desc.gsub(/\\s+/, ' ').split(' ')[-2].to_i\n child_pid = p_desc.gsub(/\\s+/, ' ').split(' ')[-1].to_i\n pid_list << child_pid unless pid_list.include? child_pid\n end\n end\n fully_recursed = true if pid_list == prior_pid_list\n fully_recursed = true if recursion_level == recursion_limit\n end\n child_pids = pid_list - pid_array\n pid_hash[:child_pids] = child_pids\n ::File.open(pid_json_path, 'wb') { |f| f << ::JSON.pretty_generate(pid_hash) }\nend",
"def ps_running\n cmd(\"ps\", \"-q\").lines.map(&:strip)\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 find_procname(pid)\n\tname = nil\n\[email protected]_processes.each do |proc|\n\t\tif proc['pid'] == pid.to_i\n\t\t\tname = proc['name']\n\t\tend\n\tend\n\treturn name\nend",
"def windows_processes\n\t\trequire 'win32ole'\n\t\twmi = WIN32OLE.connect(\"winmgmts://\")\n\t\twmi.ExecQuery(\"select * from win32_process\").map do |proc_info|\n\t\t\tparse_oleprocinfo(proc_info)\n\t\tend\n\tend",
"def windows_processes\n\t\trequire 'win32ole'\n\t\twmi = WIN32OLE.connect(\"winmgmts://\")\n\t\twmi.ExecQuery(\"select * from win32_process\").map do |proc_info|\n\t\t\tparse_oleprocinfo(proc_info)\n\t\tend\n\tend",
"def [](pid)\n pid = pid.to_i\n @running_processes[pid] ||= find_by_pid(pid)\n end",
"def ps\n `ps haxo pid,ppid,cmd`\n end",
"def pids\n @pids ||= @lines.keys\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 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 infoFor(regex)\n info = `ps -eo pcpu,pid,pmem,args | sort -k 1 -r | grep #{regex} | head -1`\n info.split\n end",
"def pid_files\n if Merb::Config[:pid_file]\n if Merb::Config[:cluster]\n Dir[Merb::Config[:pid_file] % \"*\"]\n else\n [ Merb::Config[:pid_file] ]\n end\n else\n Dir[Merb.log_path / \"merb.*.pid\"]\n end\n end",
"def get_process_name\n processes = client.sys.process.get_processes\n current_pid = session.sys.process.getpid\n processes.each do |proc|\n return proc['name'] if proc['pid'] == current_pid\n end\n return nil\n end",
"def pids_for_type(type)\n pids_from(pid_file_for(type))\n end",
"def getpid\n @resource.fail \"Either stop/status commands or a pattern must be specified\" unless @resource[:pattern]\n ps = Facter[\"ps\"].value\n @resource.fail \"You must upgrade Facter to a version that includes 'ps'\" unless ps and ps != \"\"\n regex = Regexp.new(@resource[:pattern])\n self.debug \"Executing '#{ps}'\"\n IO.popen(ps) { |table|\n table.each_line { |line|\n if regex.match(line)\n ary = line.sub(/^\\s+/, '').split(/\\s+/)\n return ary[1]\n end\n }\n }\n\n nil\n end",
"def current_cart_pids\n pids = {}\n\n @gears.each do |gear|\n gear.carts.values.each do |cart|\n Dir.glob(\"#{$home_root}/#{gear.uuid}/#{cart.directory}/{run,pid}/*.pid\") do |pid_file|\n $logger.info(\"Reading pid file #{pid_file} for cart #{cart.name}\")\n pid = IO.read(pid_file).chomp\n proc_name = File.basename(pid_file, \".pid\")\n\n pids[proc_name] = pid\n end\n end\n end\n\n pids\n end",
"def report_pid\n @process[:report_pid]\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 grep_rsync_process\n ps = \"\"\n Net::SSH.start(@ip, \"pipeline\") do |ssh|\n ps = ssh.exec! \"ps -ef | grep rsync\"\n end\n ps.split(\"\\n\")\n end",
"def call\n `ps -o rss -p #{@pid}`.split(\"\\n\").last.to_i\n end",
"def reap\n out = []\n @children.each do |key,child|\n pid = child.waitpid\n out << child.info\n\n # dead or missing processes, forget about them\n if pid == -1 or pid == child.pid\n @children.delete(key)\n end\n end\n out\n end",
"def report_pid\n @process[:report_pid]\n end",
"def get_container_id(name)\n compose_execute(\"ps\", \"-q\", name).chomp\n end",
"def pid; ::Process.pid end",
"def get_hostids_by_group(name)\n hostids = []\n hosts = get_hosts_by_group(name)\n if hosts == nil\n return nil\n else\n hosts.each { |host| hostids.push(host[\"hostid\"].to_i) }\n return hostids\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 pmids \n @pmids ||= []\n end",
"def load_pid_from_file\n best_match = @options[:possible_pid_files].inject([]) do |matches, pid_file|\n begin\n log.debug(\"Considering reading PID from `#{pid_file}'\")\n possibility = [File.atime(pid_file), File.read(pid_file).to_i]\n log.debug(\" - created #{possibility[0]}, contains PID: #{possibility[1]}\")\n matches << possibility\n rescue Errno::EACCES, Errno::ENOENT\n end; matches\n end.compact.sort.last\n best_match[1] if best_match\n end",
"def waitpid(pid, opt=1)\n pstatus = (\"\\x00\"*SIZEOFINT).to_ptr\n r = CALLS[\"libc!waitpid:IPI=I\"].call(pid, pstatus, opt).first\n raise SystemCallError.new(\"waitpid\", DL.last_error) if r == -1\n return [r, pstatus.to_s(SIZEOFINT).unpack('i_').first]\n end",
"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 find_parent_process_with_hwnd pid\n while hwnd=pid_to_hwnd[pid].nil?\n pid = find_parent_pid(pid)\n return nil unless pid\n end\n return [pid,hwnd]\n end",
"def process_running?(process_name)\n names = []\n procs = WIN32OLE.connect(\"winmgmts:\\\\\\\\.\")\n procs.InstancesOf(\"win32_process\").each do |p|\n\t names.push(p.name.to_s.downcase)\n end\n return names.index(process_name) != nil\nend",
"def factory_instaces(pid)\n regex = pid.gsub(/\\./, '\\.') + '\\.'\\\n '[a-z0-9]{8}-[a-z0-9]{4}-[a-z0-9]{4}-[a-z0-9]{4}-[a-z0-9]{12}'\n config_list.scan(/#{regex}/)\n end",
"def pids_on_ports(first=3000, count=4)\n last = first + count - 1\n `lsof -Fp -i tcp:#{first}-#{last}`.split(\"\\n\").map { |el| el[1,el.length].to_i }\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 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 names\n\t\t\t\tlist.reduce({}) { |h, x|\n\t\t\t\t\tbegin\n\t\t\t\t\t\th.merge!( x => IO.foreach(File.join('/proc', x.to_s, 'status')).first.split[1] )\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 waitpid(pid, opt=1)\n pstatus = (\"\\x00\"*SIZEOFINT).to_ptr\n r = CALLS[\"libc!waitpid:IPI=I\"].call(pid, pstatus, opt).first\n raise SystemCallError.new(\"waitpid\", DL.last_error) if r== -1\n \n # maybe I should return a Hash?\n return [r, pstatus.to_s(SIZEOFINT).unpack('i_').first]\n end",
"def parent_pid(pid)\n\tstat = File.open(\"/proc/#{pid}/stat\") { |i| i.read }\n\tstat.gsub!(/^.*\\)\\s.\\s/, '')\n\tstat.split[0].to_i\nend",
"def parseNodePids(str)\n pidmap = {}\n str.split(',').each { |i|\n i.scan(/PID: (.+) Node: (.+) Experiment: (.+)/) { |match|\n pidmap[match[1]] = match[0]\n }\n }\n return pidmap\n end",
"def is_process_running?(image_name)\n puts \"Looking for instances of #{image_name}\"\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 return true\n end\n end\n return false\n end",
"def processors_in_use\n procs = []\n Dir.glob(\"/proc/*/stat\") do |filename|\n next if File.directory?(filename)\n this_proc = []\n File.open(filename) {|file| this_proc = file.gets.split.values_at(2,38)}\n procs << this_proc[1].to_i if this_proc[0] == \"R\"\n end\n procs.uniq.length\n end"
] | [
"0.78839636",
"0.773156",
"0.7584752",
"0.74315757",
"0.73934597",
"0.7349696",
"0.7264297",
"0.724404",
"0.7221079",
"0.7221079",
"0.71751213",
"0.7042624",
"0.70245075",
"0.70057946",
"0.691484",
"0.69085664",
"0.68566096",
"0.67504126",
"0.67255795",
"0.66665334",
"0.66398704",
"0.66285646",
"0.6562163",
"0.64730424",
"0.6455864",
"0.6437458",
"0.64159113",
"0.63832736",
"0.6351951",
"0.63332236",
"0.6321136",
"0.6291175",
"0.62686354",
"0.62521774",
"0.62151295",
"0.6208637",
"0.61995435",
"0.61753964",
"0.6158048",
"0.6135757",
"0.6126988",
"0.6081439",
"0.6048073",
"0.6047283",
"0.60356176",
"0.60356176",
"0.6006467",
"0.5984591",
"0.59757924",
"0.5960643",
"0.5954206",
"0.59307355",
"0.59169096",
"0.5916493",
"0.5916493",
"0.5908846",
"0.5894029",
"0.5882586",
"0.58189255",
"0.5818158",
"0.5809612",
"0.58081216",
"0.58081216",
"0.57784235",
"0.5768764",
"0.5712871",
"0.5702821",
"0.56730485",
"0.56554914",
"0.56464046",
"0.5583417",
"0.55824107",
"0.55765045",
"0.55239195",
"0.5485179",
"0.5483142",
"0.5467137",
"0.54595166",
"0.54593855",
"0.5435571",
"0.54015386",
"0.53957915",
"0.53890455",
"0.53851426",
"0.5382839",
"0.5382052",
"0.5372236",
"0.5365618",
"0.5345198",
"0.5331085",
"0.5325358",
"0.5322688",
"0.5321951",
"0.5321636",
"0.53207016",
"0.5311346",
"0.5303239",
"0.5299769",
"0.5291587",
"0.52861786"
] | 0.8596876 | 0 |
Dumps the memory for a given PID | def dump_mem(pid,name, toggle)
host,port = @client.tunnel_peer.split(':')
# Create Filename info to be appended to created files
filenameinfo = "_#{name}_#{pid}_" + ::Time.now.strftime("%Y%m%d.%M%S")
# Create a directory for the logs
logs = ::File.join(Msf::Config.log_directory, 'scripts', 'proc_memdump')
# Create the log directory
::FileUtils.mkdir_p(logs)
#Dump file name
dumpfile = logs + ::File::Separator + host + filenameinfo + ".dmp"
print_status("\tDumping Memory of #{name} with PID: #{pid.to_s}")
begin
dump_process = @client.sys.process.open(pid.to_i, PROCESS_READ)
rescue
print_error("Could not open process for reading memory!")
raise Rex::Script::Completed
end
# MaximumApplicationAddress for 32bit or close enough
maximumapplicationaddress = 2147418111
base_size = 0
while base_size < maximumapplicationaddress
mbi = dump_process.memory.query(base_size)
# Check if Allocated
if mbi["Available"].to_s == "false"
file_local_write(dumpfile,mbi.inspect) if toggle
file_local_write(dumpfile,dump_process.memory.read(mbi["BaseAddress"],mbi["RegionSize"]))
print_status("\tbase size = #{base_size/1024}")
end
base_size += mbi["RegionSize"]
end
print_status("Saving Dumped Memory to #{dumpfile}")
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def dump_memory(i, opts={}); get_memory(i, opts).hexdump; end",
"def pid_memory\n file_format.pids[self[:pid]] ||= { :last_memory_reading => -1, :current_memory_reading => -1 }\n end",
"def dump\n puts \"Memory dump:\"\n @content.each_index do |index|\n puts \"%0.5d: %0.4o\" % [index, @content[index]] unless @content[index].nil?\n end\n end",
"def memmap\n pid = $$\n f= File.open \"/proc/#{pid}/cmdline\"\n cmd= f.read.split \"\\0\" \n f= File.open \"/proc/#{pid}/maps\"\n\n stack = heap = nil\n data = Array.new\n f.each_line do |line|\n data << line.split(' ').first.split('-') if line.match cmd.first\n stack = line.split(' ').first.split('-') if line.match \"stack\"\n heap = line.split(' ').first.split('-') if line.match \"heap\"\n end\n\n unless data.empty?\n @data= data.map do |a|\n a= a.map do |e|\n e.to_i(16)\n end\n end\n end\n\n unless stack.nil?\n @stack= stack.map do |e|\n e.to_i(16)\n end\n end\n\n unless heap.nil?\n @heap= heap.map do |e|\n e.to_i(16)\n end\n end\n\n end",
"def dump_memory_list\r\n list_memory.each_with_index {|x,i| puts \"#{ i }. #{ x[0].to_s(16) }(#{ x[1] })\"}\r\n true\r\n end",
"def dump(*args)\n argv = to_pointer([\"dump\"] + args)\n rrd_dump(args.size+1, argv) == 0\n ensure\n free_pointers\n end",
"def dumpPpms()\r\n $LOG.debug \"PpmContext::dumpPpms()\"\r\n 79.times {print \"=\"}\r\n puts\r\n puts \"PPM DUMP\".center(80)\r\n 79.times {print \"=\"}\r\n puts\r\n\r\n if(@ppms.length > 0)\r\n ppms = @ppms.sort\r\n ppms.each do |key, ppm|\r\n puts \"#{ppm.name}\\t(#{ppm.alias})\"\r\n end\r\n\r\n else\r\n puts \"No PPM variables to dump.\"\r\n end\r\n\r\n puts \"\"\r\n end",
"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 dumpPpms()\r\n 79.times {print \"=\"}\r\n puts\r\n puts \"PPM DUMP\".center(80)\r\n 79.times {print \"=\"}\r\n puts\r\n\r\n if(@ppms.length > 0)\r\n ppms = @ppms.sort\r\n ppms.each do |key, ppm|\r\n puts \"#{ppm.name}\\t(#{ppm.alias})\"\r\n end\r\n\r\n else\r\n puts \"No PPM variables to dump.\"\r\n end\r\n\r\n puts \"\"\r\n\r\n end",
"def attach(pid)\n MemoryIO::Process.new(pid)\n end",
"def dumpDpms()\r\n 79.times {print \"=\"}\r\n puts\r\n puts \"DPM DUMP\".center(80)\r\n 79.times {print \"=\"}\r\n puts\r\n\r\n if(@dpms.length > 0)\r\n\r\n dpms = @dpms.sort\r\n dpms.each do |key, dpm|\r\n puts \"#{dpm.name}\\t(#{dpm.alias})\" unless dpm.varType == \"DSM\"\r\n end\r\n\r\n else\r\n puts \"No DPM variables to dump.\"\r\n end\r\n\r\n puts \"\"\r\n\r\n 79.times {print \"=\"}\r\n puts\r\n puts \"DSM DUMP\".center(80)\r\n 79.times {print \"=\"}\r\n puts\r\n\r\n if(@dpms.length > 0)\r\n dpms = @dpms.sort\r\n dpms.each do |key, dpm|\r\n puts \"#{dpm.name}\\t(#{dpm.alias})\" if dpm.varType == \"DSM\"\r\n end\r\n\r\n else\r\n puts \"No DSM variables to dump.\"\r\n end\r\n\r\n puts \"\"\r\n\r\n end",
"def dump\n do_dump(0)\n end",
"def write_pid; end",
"def dump() end",
"def memory()\n\n instructions = 'free -h'\n\n puts ('instructions: ' + instructions.inspect).debug if @debug\n r = @ssh ? @ssh.exec!(instructions) : `#{instructions}`\n puts ('memory: ' + r.inspect).debug if @debug\n a = r.lines\n total, used, avail = a[1].split.values_at(1,2,-1) \n @results[:memory] = {total: total, used: used, available: avail}\n\n end",
"def write_process_memory(h, dst, val)\r\n val = val.to_s if not val.kind_of? String\r\n r = CALLS[\"kernel32!WriteProcessMemory:LLPLL=L\"].call(h, dst.to_i, val, val.size, NULL)\r\n raise WinX.new(:write_process_memory) if r == 0\r\n return r\r\n end",
"def proc_meminfo\n\n unless defined?(@proc_meminfo)\n\n @proc_meminfo = {}\n\n meminfo = IO.readlines('/proc/meminfo')\n meminfo.each do |meminfo_line|\n\n pairs = meminfo_line.strip.split(':', 2)\n key = pairs[0].strip\n value = pairs[1].strip\n\n # Remove \"kB\" from the value and multiply it by 1024.\n value = value.to_i * 1024\n\n @proc_meminfo[key] = value\n\n end\n\n end\n @proc_meminfo\n\n end",
"def store_details(port = nil)\n file = pid_file(port)\n begin\n FileUtils.mkdir_p(File.dirname(file))\n rescue Errno::EACCES => e\n Merb.fatal! \"Failed to store Merb logs in #{File.dirname(file)}, \" \\\n \"permission denied. \", e\n end\n Merb.logger.warn! \"Storing pid #{Process.pid} file to #{file}...\" if Merb::Config[:verbose]\n begin\n File.open(file, 'w'){ |f| f.write(Process.pid.to_s) }\n rescue Errno::EACCES => e\n Merb.fatal! \"Failed to access #{file}, permission denied.\", e\n end\n end",
"def attach(pid)\n # all of a process's threads are in /proc/<pid>/task/<number>\n Dir.open(\"/proc/#{pid}/task\").each do |task|\n File.open(File.join(@path, 'tasks'), \"w\") do |f|\n f.puts(pid)\n end\n end\n end",
"def get_mem_usage( pid )\n\tp = @client.sys.process.open( pid.to_i, PROCESS_QUERY_INFORMATION | PROCESS_VM_READ )\n\tif( p )\n\t\tbegin\n\n\t\t\tif( not @client.railgun.get_dll( 'psapi' ) )\n\t\t\t\[email protected]_dll( 'psapi' )\n\t\t\tend\n\n\t\t\t# http://msdn.microsoft.com/en-us/library/ms683219%28v=VS.85%29.aspx\n\t\t\tif( not @client.railgun.psapi.functions['GetProcessMemoryInfo'] )\n\t\t\t\[email protected]_function( 'GetProcessMemoryInfo', 'BOOL', [\n\t\t\t\t\t[ \"HANDLE\", \"hProcess\", \"in\" ],\n\t\t\t\t\t[ \"PBLOB\", \"ProcessMemoryCounters\", \"out\" ],\n\t\t\t\t\t[ \"DWORD\", \"Size\", \"in\" ]\n\t\t\t\t\t]\n\t\t\t\t)\n\t\t\tend\n\n\t\t\tr = @client.railgun.psapi.GetProcessMemoryInfo( p.handle, 72, 72 )\n\t\t\tif( r['return'] )\n\t\t\t\tpmc = r['ProcessMemoryCounters']\n\t\t\t\t# unpack the PROCESS_MEMORY_COUNTERS structure (http://msdn.microsoft.com/en-us/library/ms684877%28v=VS.85%29.aspx)\n\t\t\t\t# Note: As we get the raw structure back from railgun we need to account\n\t\t\t\t# for SIZE_T variables being 32bit on x86 and 64bit on x64\n\t\t\t\tmem = nil\n\t\t\t\tif( @client.platform =~ /win32/ )\n\t\t\t\t\tmem = pmc[12..15].unpack('V').first\n\t\t\t\telsif( @client.platform =~ /win64/ )\n\t\t\t\t\tmem = pmc[16..23].unpack('Q').first\n\t\t\t\tend\n\t\t\t\treturn (mem/1024)\n\t\t\tend\n\t\trescue\n\t\t\tp \"Exception - #{$!}\"\n\t\tend\n\n\t\tp.close\n\tend\n\n\treturn nil\nend",
"def print_pointer_location(ptr, t)\n if t.respond_to? :get_area_memlocation\n page_number = (ptr.size.to_f / $page_size).ceil\n base_address = ptr.address - ( ptr.address % $page_size )\n ptrs = page_number.times.collect { |i|\n FFI::Pointer::new(base_address + i*$page_size).slice(0, $page_size)\n }\n ptrs.each { |ptr|\n p t.get_area_memlocation(ptr, :MEMBIND_BYNODESET)\n }\n else\n puts \"pagemap #{Process::pid} -n #{ptr.address.to_s(16)}-#{(ptr.address+ptr.size-1).to_s(16)}\"\n puts `pagemap #{Process::pid} -n #{ptr.address.to_s(16)}-#{(ptr.address+ptr.size-1).to_s(16)}`\n end\nend",
"def dump\n {\n :base_dir => base_dir,\n :debug => debug,\n :ident => ident\n }\n end",
"def start_dump\n end",
"def start_dump\n end",
"def dump\n\t\tprint_status(\"Dumping a bunch of info from the 'mgmt' OID......\")\n\t\tdumpz=[]\n\t\[email protected]('mgmt') { |x| dumpz << x }\n\t\tif dumpz.empty?\n\t\t\tprint_error(\"No Values Found!\")\n\t\telse\n\t\t\tputs \"[*] \".light_green + \"SNMP MGMT Dump\".light_yellow + \": \".white\n\t\t\tdumpz.each do |entry|\n\t\t\t\tprint_good(\"#{entry}\")\n\t\t\tend\n\t\tend\n\tend",
"def set_memory\n @memory = Memory.find(params[:id])\n end",
"def set_memory\n @memory = Memory.find(params[:id])\n end",
"def set_memory\n @memory = Memory.find(params[:id])\n end",
"def set_memory\n @memory = Memory.find(params[:id])\n end",
"def set_memory\n @memory = Memory.find(params[:id])\n end",
"def set_memory\n @memory = Memory.find(params[:id])\n end",
"def set_memory\n @memory = Memory.find(params[:id])\n end",
"def write_pid\n pid_file = File.join(RAILS_ROOT, 'log', 'reporter.pid')\n File.open(pid_file,\"w\") do |file|\n file.puts($$)\n end\n end",
"def _dump() end",
"def collect\n @this_mem[:rss_size] = ::GetProcessMem.new(Process.pid).kb\n @this_mem\n rescue => e\n ::Instana.logger.info \"#{__method__}:#{File.basename(__FILE__)}:#{__LINE__}: #{e.message}\"\n ::Instana.logger.debug e.backtrace.join(\"\\r\\n\")\n end",
"def report_mem\n self.report('mem_report')\n end",
"def write(base, data)\n request = Packet.create_request(COMMAND_ID_STDAPI_SYS_PROCESS_MEMORY_WRITE)\n\n request.add_tlv(TLV_TYPE_HANDLE, process.handle)\n request.add_tlv(TLV_TYPE_BASE_ADDRESS, base)\n request.add_tlv(TLV_TYPE_PROCESS_MEMORY, data)\n\n response = process.client.send_request(request)\n\n return response.get_tlv_value(TLV_TYPE_LENGTH)\n end",
"def dump\n super\n\n puts \"page header:\"\n pp page_header\n puts\n\n puts \"fseg header:\"\n pp fseg_header\n puts\n\n puts \"sizes:\"\n puts \" %-15s%5i\" % [\"header\", header_space]\n puts \" %-15s%5i\" % [\"trailer\", trailer_space]\n puts \" %-15s%5i\" % [\"directory\", directory_space]\n puts \" %-15s%5i\" % [\"free\", free_space]\n puts \" %-15s%5i\" % [\"used\", used_space]\n puts \" %-15s%5i\" % [\"record\", record_space]\n puts \" %-15s%5.2f\" % [\"per record\", space_per_record]\n puts\n\n puts \"page directory:\"\n pp directory\n puts\n\n puts \"system records:\"\n pp infimum.record\n pp supremum.record\n puts\n\n puts \"garbage records:\"\n each_garbage_record do |rec|\n pp rec.record\n puts\n end\n puts\n\n puts \"records:\"\n each_record do |rec|\n pp rec.record\n puts\n end\n puts\n end",
"def write_pid(pid)\n File.open(pid_path, \"w\") { |f| f.write(pid) }\n end",
"def write_pid(pid)\n File.open(pid_path, \"w\") { |f| f.write(pid) }\n end",
"def store_pid( pid )\n File.open( pid_path, 'w' ) do |f|\n f.puts pid\n end\n rescue => e\n $stderr.puts \"Unable to open #{pid_path} for writing:\\n\\t(#{e.class}) #{e.message}\"\n exit!\n end",
"def profile_memory\n memory_usage_before = `ps -o rss= -p #{Process.pid}`.to_i\n yield\n memory_usage_after = `ps -o rss= -p #{Process.pid}`.to_i\n\n used_memory = ((memory_usage_after - memory_usage_before) / 1024.0).round(2)\n puts \"Memory usage: #{used_memory} MB\"\n # print \";#{used_memory}\\n\"\n end",
"def psql_db_command__dump psql_db\n psql_db_command__program \"pg_dump\", psql_db\n end",
"def update_pids\n # memory isn't recorded with exceptions. need to set #last_memory_reading+ to -1 as\n # the memory used could have changed. for the next request the memory change will not be recorded.\n #\n # NOTE - the failure regex was not matching with a Rails Development log file.\n if has_line_type?(:failure) and processing = has_line_type?(:processing)\n pid_memory[:last_memory_reading] = -1\n elsif mem_line = has_line_type?(:memory_usage)\n memory_reading = mem_line[:memory]\n pid_memory[:current_memory_reading] = memory_reading\n # calcuate the change in memory\n unless pid_memory[:current_memory_reading] == -1 || pid_memory[:last_memory_reading] == -1\n # logged as kB, need to convert to bytes for the :traffic Tracker\n memory_diff = (pid_memory[:current_memory_reading] - pid_memory[:last_memory_reading])*1024\n if memory_diff > 0\n self.attributes[:memory_diff] = memory_diff\n end # if memory_diff > 0\n end # unless\n \n pid_memory[:last_memory_reading] = pid_memory[:current_memory_reading]\n pid_memory[:current_memory_reading] = -1\n end # if mem_line\n return true\n end",
"def store_pid(port)\n store_details(port)\n end",
"def dump\n @dump ||= Dump.new(dump_url)\n end",
"def save_memory(flags = :PAUSED)\n result = FFI::Domain.virDomainManagedSave(@dom_ptr, flags)\n raise Errors::LibError, \"Couldn't save domain memory\" if result.negative?\n end",
"def dump contents;\r\n # p contents\r\n @dumps = Array.new unless @dumps \r\n @dumps << contents \r\n end",
"def write(memory, address, process)\n memory[address, process.memory_blocks] = Concurrent::Array.new(process.memory_blocks, process.id)\n end",
"def memory\n @pagesize ||= Vmstat.pagesize\n has_available = false\n\n total = free = active = inactive = pageins = pageouts = available = 0\n procfs_file(\"meminfo\") do |file|\n content = file.read(2048) # the requested information is in the first bytes\n\n content.scan(/(\\w+):\\s+(\\d+) kB/) do |name, kbytes|\n pages = (kbytes.to_i * 1024) / @pagesize\n\n case name\n when \"MemTotal\" then total = pages\n when \"MemFree\" then free = pages\n when \"MemAvailable\"\n available = pages\n has_available = true\n when \"Active\" then active = pages\n when \"Inactive\" then inactive = pages\n end\n end\n end\n\n procfs_file(\"vmstat\") do |file|\n content = file.read\n\n if content =~ /pgpgin\\s+(\\d+)/\n pageins = $1.to_i\n end\n\n if content =~ /pgpgout\\s+(\\d+)/\n pageouts = $1.to_i\n end\n end\n\n mem_klass = has_available ? LinuxMemory : Memory\n mem_klass.new(@pagesize, total-free-active-inactive, active,\n inactive, free, pageins, pageouts).tap do |mem|\n mem.available = available if has_available\n end\n end",
"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 dump\n map(&:dump)\n end",
"def write_pid_file\n if RUBY_PLATFORM !~ /mswin/\n open(@pid_file,\"w\") {|f| f.write(Process.pid) }\n end\n end",
"def mem=(p0) end",
"def dump(path)\n infobase.designer do\n dumpDBCfg path\n end.run.wait.result.verify!\n path\n end",
"def save_pid_to_file(pid)\n @options[:possible_pid_files].each do |pid_file|\n begin\n File.open(pid_file, 'w') { |file| file.write(pid.to_s) }\n log.debug(\"Writing PID to `#{pid_file}'\")\n return pid_file\n rescue Errno::EACCES\n end\n end\n end",
"def dump(key)\n send_command([:dump, key])\n end",
"def dumpme(filename)\n raise \"#{filename} exists\" if File.exists?(filename)\n File.open(filename, \"w\") {|f| f << Marshal.dump(self)}\n end",
"def pids\n @pids ||= {}\n end",
"def crash_dumps\n @vm_record[\"crash_dumps\"]\n end",
"def system_profiler_plist\n tmp_path = \"/tmp/system_profiler_#{rand(1001)}.plist\"\n `/usr/sbin/system_profiler -xml SPHardwareDataType SPSoftwareDataType SPPrintersDataType > #{tmp_path}`\n tmp_path\nend",
"def _dump(limit)\n identifier\n end",
"def marshal_dump\n dump\n end",
"def _dump(*args)\n raise \"not implemented yet\"\n end",
"def write!\n ensure_mode(:privileged)\n exec('write memory')\n end",
"def report_pid\n @process[:report_pid]\n end",
"def _dump\n end",
"def save_current_process_pid\n File.write(pid_file_path, current_pid)\n rescue ::Exception => e\n $stderr.puts \"While writing the PID to file, unexpected #{e.class}: #{e}\"\n Kernel.exit\n end",
"def report_pid\n @process[:report_pid]\n end",
"def droby_dump(dest)\n DRoby.new(@op.droby_dump(dest))\n\tend",
"def droby_dump(dest)\n\t DRoby.new(controlable?, happened?, Distributed.format(task, dest), symbol)\n\tend",
"def set_memory_slot\n @memory_slot = MemorySlot.find(params[:id])\n end",
"def memory\n domain_info[:memory]\n end",
"def memory\n domain_info[:memory]\n end",
"def dump(path)\n infobase.designer do\n dumpCfg path\n end.run.wait.result.verify!\n path\n end",
"def set_pid(pid)\n File.open(@lock_file, 'w') { |file| file.write(pid) }\n end",
"def dump(path, backup_id)\n raise NotImplementedError\n end",
"def pid() end",
"def pid() end",
"def pid() end",
"def _dump(depth)\n Marshal.dump(to_hash)\n end",
"def get_full_ps_info(pid)\n ps_fullcmd = @ps_fullcmd_fmt % pid\n # p ps_fullcmd\n output = `#{ps_fullcmd}`\n return output\n end",
"def dump_prod id\n target_path = File.expand_path(\"../../fixtures/trunk-#{id}.dump\", __FILE__)\n puts \"Dumping production database from Heroku (works only if you have access to the database)\"\n command = \"curl -o #{target_path} \\`heroku pg:backups public-url #{id} -a cocoapods-trunk-service\\`\"\n puts \"Executing command:\"\n puts command\n result = system command\n if result\n puts \"Production database snapshot #{id} dumped into #{target_path}\"\n else\n raise \"Could not dump #{id} from production database.\"\n end\n end",
"def dump!\n @dump = true\n end",
"def get_memory_rasd_item(id)\n request(\n :expects => 200,\n :idempotent => true,\n :method => 'GET',\n :parser => Fog::ToHashDocument.new,\n :path => \"vApp/#{id}/virtualHardwareSection/memory\"\n )\n end",
"def determine_memory\n result = @info[:memory] = {}\n\n free_cmd = \"free -m|awk '$1 ~ /Mem/ {print $2, $2-$6-$7}; $1 ~ /Swap/ \" \\\n \"{print $3}'|xargs\"\n mem = @shell.query('MEMORY', free_cmd)\n total, used, swap = mem.split(/\\s+/)\n\n result[:total] = total.to_i\n result[:mem_used] = used.to_i\n result[:swap_used] = swap.to_i\n result[:swapping?] = swqp.to_i > 0\n end",
"def packet dump\n Capp.offline(dump).loop.first\n end",
"def marshal_dump\r\n [@depth, @map_id, @event_id, @list, @index + 1, @branch]\r\n end",
"def dump\n sync { devices.reject(&:inherited?).map { |dev| dev.dump } }\n end",
"def dumpFile(fname)\n\t\treturn writeFile(fname, self.dump())\n\tend",
"def list_pids\n access_processes do |processes|\n processes.keys\n end\n end",
"def write_pid_file\n if RUBY_PLATFORM !~ /mswin/\n log \"Writing PID file to #{@pid_file}\"\n open(@pid_file,\"w\") {|f| f.write(Process.pid) }\n end\n end",
"def dump!\n run(mongodump)\n end",
"def dump!\n run(mongodump)\n end",
"def get_memory(i, opts={})\r\n refresh opts\r\n read(@memlist[i][0], @memlist[i][1])\r\n end",
"def dump\n C.LLVMDumpValue(self)\n end",
"def dump(object)\n dumper(object).dump\n end",
"def get_current_memory_usage\n `ps -o rss= -p #{Process.pid}`.to_i\nend",
"def _dump(limit = -1)\n Marshal.dump(name, limit)\n end"
] | [
"0.7120959",
"0.6760381",
"0.65458465",
"0.63837844",
"0.62730616",
"0.6123218",
"0.6077946",
"0.60441667",
"0.59871006",
"0.5829059",
"0.57639396",
"0.5539883",
"0.55204976",
"0.549366",
"0.5461519",
"0.5439264",
"0.5406448",
"0.53775597",
"0.5373298",
"0.53700906",
"0.5360392",
"0.5341367",
"0.53307176",
"0.53307176",
"0.5325627",
"0.5317988",
"0.5317988",
"0.5317988",
"0.5317988",
"0.5317988",
"0.5317988",
"0.5317988",
"0.5308654",
"0.52913004",
"0.5286371",
"0.52816254",
"0.5274952",
"0.5256681",
"0.52402526",
"0.52402526",
"0.5227541",
"0.5224717",
"0.5212236",
"0.52116305",
"0.5198786",
"0.5179551",
"0.5166481",
"0.5140379",
"0.51171374",
"0.5111709",
"0.50927824",
"0.5091243",
"0.5072674",
"0.50671726",
"0.5065997",
"0.5065807",
"0.5061528",
"0.50581163",
"0.5054279",
"0.5051653",
"0.5051262",
"0.5051071",
"0.5044882",
"0.50420624",
"0.50344694",
"0.50313187",
"0.50206",
"0.50204873",
"0.50074697",
"0.49907228",
"0.49902213",
"0.49730858",
"0.49724767",
"0.49710894",
"0.49710894",
"0.49708134",
"0.49655113",
"0.49651095",
"0.49638408",
"0.49638408",
"0.49638408",
"0.49563998",
"0.49558786",
"0.4955493",
"0.49526834",
"0.4952071",
"0.49500307",
"0.49478254",
"0.4946729",
"0.49337113",
"0.4933047",
"0.4930568",
"0.4929538",
"0.4906952",
"0.4906952",
"0.49049336",
"0.490423",
"0.48995587",
"0.48938674",
"0.48936707"
] | 0.7830577 | 0 |
Function to query process Size | def get_mem_usage( pid )
p = @client.sys.process.open( pid.to_i, PROCESS_QUERY_INFORMATION | PROCESS_VM_READ )
if( p )
begin
if( not @client.railgun.get_dll( 'psapi' ) )
@client.railgun.add_dll( 'psapi' )
end
# http://msdn.microsoft.com/en-us/library/ms683219%28v=VS.85%29.aspx
if( not @client.railgun.psapi.functions['GetProcessMemoryInfo'] )
@client.railgun.psapi.add_function( 'GetProcessMemoryInfo', 'BOOL', [
[ "HANDLE", "hProcess", "in" ],
[ "PBLOB", "ProcessMemoryCounters", "out" ],
[ "DWORD", "Size", "in" ]
]
)
end
r = @client.railgun.psapi.GetProcessMemoryInfo( p.handle, 72, 72 )
if( r['return'] )
pmc = r['ProcessMemoryCounters']
# unpack the PROCESS_MEMORY_COUNTERS structure (http://msdn.microsoft.com/en-us/library/ms684877%28v=VS.85%29.aspx)
# Note: As we get the raw structure back from railgun we need to account
# for SIZE_T variables being 32bit on x86 and 64bit on x64
mem = nil
if( @client.platform =~ /win32/ )
mem = pmc[12..15].unpack('V').first
elsif( @client.platform =~ /win64/ )
mem = pmc[16..23].unpack('Q').first
end
return (mem/1024)
end
rescue
p "Exception - #{$!}"
end
p.close
end
return nil
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"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 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 memory_usage \n\t`ps -o rss= -p #{Process.pid}`.to_i # in kilobytes \nend",
"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 size\n size = popen(%W(du -s), full_path).first.strip.to_i\n (size.to_f / 1024).round(2)\n end",
"def get_current_memory_usage\n `ps -o rss= -p #{Process.pid}`.to_i\nend",
"def current_size(path)\n `du -shm #{path}`.match(/^[0-9]+/).to_s.to_i\n end",
"def size\n vm.hardware_profile.vm_size\n end",
"def size_mb \n return size / 1048576 # (1024 * 1024) \n end",
"def size\n\t\tstat[:size]\n\tend",
"def size\n\t\tstat[:size]\n\tend",
"def size\n execute_request(:get, '/size').body.to_i\n end",
"def size_used\n info[\"size-used\"]\n end",
"def size\n @info[:size]\n end",
"def rss_bytes\n if ENV['OS'] == 'Windows_NT'\n 0\n else\n `ps -o rss= -p #{Process.pid}`.to_i # in kilobytes\n end\n end",
"def memory_usage\n return File.read('/proc/self/status').match(/VmRSS:\\s+(\\d+)/)[1].to_i * 1024\nend",
"def check_queue_size_active\n `#{config[:path]} | /bin/egrep -c '^[0-9A-F]+\\\\*'`.to_i\n end",
"def check_queue_size_deferred\n `#{config[:path]} | /bin/grep -c '^ *(.*)$'`.to_i\n end",
"def memsize\n end",
"def check_queue_size_incoming\n `#{config[:path]} | /bin/egrep -c '^[0-9A-F]+ +'`.to_i - check_queue_size_deferred\n end",
"def usage_by_proc\n return nil unless File.exist? proc_status_file\n\n proc_status = File.open(proc_status_file, \"r\") { |f| f.read_nonblock(4096).strip }\n if (m = proc_status.match(/RSS:\\s*(\\d+) kB/i))\n m[1].to_f / 1.kilobyte\n end\n end",
"def size_from_stty\n return unless @output.tty? && command_exist?(\"stty\")\n\n out = run_command(\"stty\", \"size\")\n return unless out\n\n size = out.split.map(&:to_i)\n size if nonzero_column?(size[1])\n end",
"def size\n info[\"size\"]\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 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 bytes_processed\n Integer @gapi.statistics.query.total_bytes_processed\n rescue StandardError\n nil\n end",
"def queue_size\n _get(\"/system/queue-size\") { |json| json }\n end",
"def fetch_disk_size\n total_size = 0\n total_size = `lsblk -b --output SIZE -d -n | paste -s -d + - | bc`\n number_to_human_size total_size\n end",
"def rss_ps\n kb = `ps -o rss= #{Process.pid}`.strip.to_i\n\n return kb * 1024\n end",
"def get_size\n\t\tend",
"def memory_usage\n `ps -o rss= -p #{ $PID }`.to_i\n end",
"def fast_size\n c_size = 0\n ids = self.child_ids\n q = \"SELECT octet_length(data), octet_length(body) AS octet_length2 FROM ws_files WHERE id in (#{ ids.join(\", \")})\"\n request = $postgres.exec(q)\n request.each do |req|\n c_size += req.map{|k,v| v.to_i }.inject(:+)\n end\n c_size\n end",
"def size\n @size \n end",
"def size\n @size \n end",
"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 rss_proc\n kb = File.read('/proc/self/status').match(/VmRSS:\\s+(\\d+)/)[1].to_i\n\n return kb * 1024\n end",
"def list_size_nix_partitions # nelsongs\n\treturn `fdisk -l | grep /dev | grep -v Disk | awk '{if ($2==\"*\" && $6==\"83\") print $5;else {if ($5==\"83\") print $4}}' | sed s/+//g`.chomp.split\nend",
"def size(full_path)\n\t\t`du -s #{Rush.quote(full_path)}`.match(/(\\d+)/)[1].to_i\n\tend",
"def d_size\n @desc[:size].to_i\n end",
"def check_queue_size_hold\n `#{config[:path]} | /bin/egrep -c '^[0-9A-F]+!'`.to_i\n end",
"def size(full_path)\n\t\t`du -sb #{full_path}`.match(/(\\d+)/)[1].to_i\n\tend",
"def size\n @size.size\n end",
"def size\n @size ||= @request[FSIZE].to_i\n end",
"def path_size (path)\n if Dir.exist? path\n o, e, s = Open3.capture3('du', '-s', '-b', path)\n o.split('/')[0].to_i\n end\n end",
"def get_size\n @monitors.length\n end",
"def size(verbose: false)\n size_from_java(verbose: verbose) ||\n size_from_win_api(verbose: verbose) ||\n size_from_ioctl ||\n size_from_io_console(verbose: verbose) ||\n size_from_readline(verbose: verbose) ||\n size_from_tput ||\n size_from_stty ||\n size_from_env ||\n size_from_ansicon ||\n size_from_default\n end",
"def memory(in_gb=false)\n line = ssh_cmd 'cat /proc/meminfo | grep MemTotal'\n matches = line.match /(?<size>\\d+)\\s+(?<unit>kB|mB|gB|B)/\n size = matches[:size].to_i\n multipliers = {kB: 1024, mB: 1024**2, gB: 1024**3, B: 1}\n size *= multipliers[matches[:unit].to_sym]\n in_gb ? size / 1024**3 : size\n end",
"def get_page_size(title)\n page_info_get_val(title, 'length')\n end",
"def size\n @client.execute_udf(@key, @PACKAGE_NAME, 'size', [@bin_name], @policy)\n end",
"def disk_usage_mb \n return disk_usage \n end",
"def list_nix_partitions_with_size # nelsongs \n\treturn `fdisk -l | grep /dev | grep -v Disk | awk '{if ($2==\"*\" && $6==\"83\") print $1\":\"$5;else {if ($5==\"83\") print $1\":\"$4}}' | sed s/+//g`.chomp.split\nend",
"def size\n @info.size\n end",
"def size\n @info.size\n end",
"def size\n @info.size\n end",
"def extract_size(io)\n io.size\n end",
"def get_size\n\t\treturn @size\n\tend",
"def size_list_entry\n Innodb::List::NODE_SIZE\n end",
"def list_size_swap_partitions # nelsongs\n\treturn `fdisk -l | grep /dev | grep -v Disk | awk '{if ($2==\"*\" && $6==\"82\") print $5;else {if ($5==\"82\") print $4}}' | sed s/+//g`.chomp\nend",
"def size\r\n @browsers.size\r\n end",
"def getTorrentSize(infoHash)\n return @rpc.call('d.get_size_bytes', infoHash)\n end",
"def computeMemory()\n mem = `grep 'MemTotal' /proc/meminfo | sed -e 's/MemTotal://' -e 's/ kB//'`.to_i\n mem / 1024 / 4\n end",
"def size\n stats[:dataSize]\n end",
"def size\n stats[:dataSize]\n end",
"def sfdisk_get_size(dev_name)\n out = %x{sfdisk #{dev_name} -s}\n Chef::Log.info(\"updating geo using sfdisk: #{out}\")\n\n # sfdisk sees the world as 1k blocks\n @current.blocks(out.to_i)\nend",
"def size\n @gapi[\"size\"]\n end",
"def size\n\t\t7500\n\tend",
"def size\n return instance_get(:size)\n end",
"def processings\n @processings.size\n end",
"def freespace()\n #runs UNIX free space command\n readme = IO.popen(\"df #{VIDEO_PATH}\")\n space_raw = readme.read\n readme.close \n\n #get information from the command line as to how much space is available\n space_match = space_raw.match(/\\s(\\d+)\\s+(\\d+)\\s+(\\d+)/)\n space = Hash.new(0)\n unless space_match.nil?\n space['total'] = space_match[1]\n space['used'] = space_match[2]\n space['available'] = space_match[3]\n end\n\n return space\nend",
"def meminfo\n File.read(\"/proc/meminfo\").split(\"\\n\").map{ |f| f.split(':') }\n .map{ |name, value| [name, value.to_i / 1024.0] }.to_h\nrescue\n {}\nend",
"def d_size\n @diskObj.info[:capacity]\n end",
"def get_size(folder,hash)\n \n size_command = 'du -sh '+folder+' | cut -f 1'\n\n job_size = `#{size_command}`\n job_size = job_size.chomp\n\n hash['job_size']=job_size\n\n\nend",
"def size_in_bytes\n to_i description['SizeInBytes']\n end",
"def size\n @size\n end",
"def size\n @size\n end",
"def size\n @size\n end",
"def size\n @size\n end",
"def size\n @size\n end",
"def size\n @size\n end",
"def size\n @size\n end",
"def size\n @size\n end",
"def size\n @size\n end",
"def size\n @size\n end",
"def size\n @size\n end",
"def size\n @size\n end",
"def size\n @size\n end",
"def size\n @size\n end",
"def size\n @size\n end",
"def size\n @size\n end",
"def size\n @size\n end",
"def size\n @size\n end",
"def size\n @size\n end",
"def size\n @size\n end",
"def size\n @size\n end",
"def size\n @size\n end",
"def size\n @size\n end",
"def size\n @size\n end",
"def directory_size(path)\n\ta = get_dir_size(path)\n\tdisplay(a)\n\t@calls = 0\n\treturn a\nend",
"def size\n @db.get_first_value( \"SELECT COUNT(*) FROM #{TABLE_NAME};\" ).to_i\n end"
] | [
"0.73414606",
"0.734064",
"0.7326635",
"0.72384304",
"0.70804155",
"0.70088387",
"0.69960773",
"0.69369686",
"0.68792355",
"0.6877563",
"0.68744785",
"0.68744785",
"0.6847648",
"0.6839052",
"0.6816184",
"0.6803115",
"0.6793036",
"0.67754847",
"0.67159593",
"0.6699418",
"0.6676529",
"0.6660265",
"0.66442573",
"0.6627392",
"0.66172904",
"0.65998",
"0.6598243",
"0.6588399",
"0.65850717",
"0.6575695",
"0.6540501",
"0.65394014",
"0.65076065",
"0.64966726",
"0.64966726",
"0.6485024",
"0.6480664",
"0.64738333",
"0.6435072",
"0.6428311",
"0.6425804",
"0.64250374",
"0.6421824",
"0.6402479",
"0.6398858",
"0.6375228",
"0.6371673",
"0.63620913",
"0.6353645",
"0.6351224",
"0.6347741",
"0.63321334",
"0.63133824",
"0.63133824",
"0.63133824",
"0.6304824",
"0.6298546",
"0.628612",
"0.62767625",
"0.62682456",
"0.6254022",
"0.6245453",
"0.62362415",
"0.62362415",
"0.6232141",
"0.6211604",
"0.62087786",
"0.6190575",
"0.6186064",
"0.6170863",
"0.6169018",
"0.6148736",
"0.6144356",
"0.61414164",
"0.61411774",
"0.61411774",
"0.61411774",
"0.61411774",
"0.61411774",
"0.61411774",
"0.61411774",
"0.61411774",
"0.61411774",
"0.61411774",
"0.61411774",
"0.61411774",
"0.61411774",
"0.61411774",
"0.61411774",
"0.61411774",
"0.61411774",
"0.61411774",
"0.61411774",
"0.61411774",
"0.61411774",
"0.61411774",
"0.61411774",
"0.61411774",
"0.6137008",
"0.61309534"
] | 0.6745675 | 18 |
Base 64 decode, convert base 64 string to binary content Decodes / converts base 64 UTF8 text string to binary content | def edit_text_base64_decode(request, opts = {})
data, _status_code, _headers = edit_text_base64_decode_with_http_info(request, opts)
data
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def base64_decode(string)\n SSL.base64_decode(string)\n end",
"def base64_decode(string)\n SSL.base64_decode(string)\n end",
"def decode(string)\n Base64.decode64(string)\n end",
"def decode_base64\n #self.unpack(\"m*\").first\n # This should be the above line but due to a bug in the ruby base64 decoder\n # it will only decode base64 where the lines are in multiples of 4, this is\n # contrary to RFC2045 which says that all characters other than the 65 used\n # are to be ignored. Currently we remove all the other characters but it \n # might be better to use it's advice to only remove line breaks and white\n # space\n self.tr(\"^A-Za-z0-9+/=\", \"\").unpack(\"m*\").first\n end",
"def decode(b)\n Base64.decode64(b)\n end",
"def base64_decode\n unpack('m').first\n end",
"def base64\n binary = open { |io| io.read }\n result = Base64.encode64(binary).chomp\n binary.clear # deallocate string\n result\n end",
"def decoded\n Base64.decode64(@base64 || \"\")\n end",
"def decode_base64_string(filename, data)\n\n decoded_image = Base64.decode64(data)\n\nend",
"def decode_base64_string(filename, data)\n\n decoded_image = Base64.decode64(data)\n\nend",
"def base64\n binary = open { |io| io.read }\n result = Base64.strict_encode64(binary)\n binary.clear # deallocate string\n result\n end",
"def decode64\n Base64.strict_decode64(unwrap)\n end",
"def b64d(input)\n if input\n return helpers.base64Decode(input)\n end\n return \"\".to_java_bytes\n end",
"def hex_to_bin_to_base64(hex_encoded_string)\n bin = Lib.hex_to_bin(hex_encoded_string)\n Lib.bin_to_base64([bin])\nend",
"def decode(value)\n Base64.decode64 value\n end",
"def decode_bytes(encoded_bytes)\n Base64.urlsafe_decode64(encoded_bytes)\n end",
"def decode(base64)\n base64.to_s.unpack(\"m\").first\n end",
"def strict_decode64( str )\n \n if RUBY_VERSION >= \"1.9\"\n Base64.strict_decode64( str )\n else\n Base64.decode64( str )\n end\nend",
"def decode_base64!\n self.replace(self.decode_base64)\n end",
"def base64_url_decode(str)\n str += '=' * (4 - str.length.modulo(4))\n Base64.decode64(str.tr('-_', '+/'))\n end",
"def encode_base64(text)\n Base64.strict_encode64(text).strip\n end",
"def base64_url_decode(str)\n \"#{str}==\".tr(\"-_\", \"+/\").unpack(\"m\")[0]\n end",
"def raw_to_base_64(byte_array)\n return \"\" if byte_array == []\n ((3 - (byte_array.length % 3)) % 3).times { byte_array << 0 }\n c1 = BASE_64_CHARS[byte_array[0] >> 2]\n c2 = BASE_64_CHARS[(byte_array[0] % 4) * 16 + (byte_array[1] >> 4)]\n c3 = BASE_64_CHARS[(byte_array[1] % 16) * 4 + (byte_array[2] >> 6)]\n c4 = BASE_64_CHARS[byte_array[2] % 64]\n c1 + c2 + c3 + c4 + raw_to_base_64(byte_array[3..-1])\nend",
"def strict_decode64(str)\n return Base64.strict_decode64(str) if Base64.respond_to? :strict_decode64\n\n unless str.include?(\"\\n\")\n Base64.decode64(str)\n else\n raise(ArgumentError,\"invalid base64\")\n end\n end",
"def bin_to_base64(bin)\nreturn bin.scan(/....../).map { |x| $BASE64[x.to_i(2)] }.join\nend",
"def u64(s)\n return unless s\n Base64.decode64 CGI.unescape(s)\n end",
"def decode_body(body)\n body += '=' * (4 - body.length.modulo(4))\n Base64.decode64(body.tr('-_','+/'))\n end",
"def b64_e(data)\n Base64.encode64(data).chomp\n end",
"def hex_base64_convert(s)\n [[s].pack(\"H*\")].pack(\"M*\")\nend",
"def hex_to_base64(s)\n [[s].pack(\"H*\")].pack('m*')\nend",
"def from_base64\n unpack(\"m\").first\n end",
"def safe_string(str)\n b64str = Base64.strict_encode64(str)\n \"echo #{b64str} | base64 --decode\"\n end",
"def base64(stuff)\n Base64.encode64(stuff).delete(\"\\n\")\n end",
"def encode_str(str)\n require \"base64\"\n encoded_str=Base64.encode64(str)\n return encoded_str\nend",
"def decipher_base64(value_base64, key)\n if blank(value_base64)\n return nil\n else\n cipher_text = Base64.decode64(value_base64)\n return decipher(cipher_text, key)\n end\nend",
"def decode_aes256_cbc_base64 data\n if data.empty?\n ''\n else\n # TODO: Check for input validity!\n _decode_aes256 :cbc, decode_base64(data[1, 24]), decode_base64(data[26..-1])\n end\n end",
"def base64(text, charset=\"iso-2022-jp\", convert=true)\n if convert\n if charset == \"iso-2022-jp\"\n text = NKF.nkf('-j -m0', text)\n end\n end\n text = [text].pack('m').delete(\"\\r\\n\")\n \"=?#{charset}?B?#{text}?=\"\n end",
"def urlsafe_decode64(str)\n strict_decode64(str.tr(\"-_\", \"+/\"))\n end",
"def decode_blob blob\n if not String === blob\n raise ArgumentError, 'Blob should be a string'\n end\n\n if blob[0, 4] != 'TFBB'\n raise ArgumentError, 'Blob doesn\\'t seem to be base64 encoded'\n end\n\n decode_base64 blob\n end",
"def postgres_base64_data(data)\n [data].pack(\"m*\").gsub(/\\r?\\n/,\"\")\n end",
"def decode_b(str)\n str.gsub!(/=\\?ISO-2022-JP\\?B\\?([!->@-~]+)\\?=/i) {\n decode64($1)\n }\n str = Kconv::toeuc(str)\n str.gsub!(/=\\?SHIFT_JIS\\?B\\?([!->@-~]+)\\?=/i) {\n decode64($1)\n }\n str = Kconv::toeuc(str)\n str.gsub!(/\\n/, ' ') \n str.gsub!(/\\0/, '')\n str\n end",
"def base64\n content = storage.read(id)\n base64 = Base64.encode64(content)\n base64.chomp\n end",
"def decode_params_base64(s)\n parsed = CGI.parse(Base64.decode64(\"#{s}==\"))\n params = Hash[*parsed.entries.map { |k, v| [k, v[0]] }.flatten]\n params.with_indifferent_access\n end",
"def bytes\n Base64.decode64(data)\n end",
"def decrypt(base64_string)\r\n encrypted = Base64.decode64(base64_string)\r\n aes = decipher\r\n aes.update(encrypted) + aes.final\r\n end",
"def decrypt64(str)\n dec = ''\n str = Base64.decode64(str)\n while str.length != 0\n dec += self.private_decrypt(str[0..self.decrypt_block_size])\n str = str[self.decrypt_block_size+1..-1] if str.length > self.decrypt_block_size\n end\n dec\n end",
"def decode(data)\n case @encoding\n when nil, :none, :raw\n data\n when :base64\n Base64.decode64(data)\n else\n raise Cryptic::UnsupportedEncoding, @encoding\n end\n end",
"def encode_base64\n [self].pack(\"m*\")\n end",
"def base64digest\n DigestUtils.pack_base64digest(digest)\n end",
"def decode_string(str)\n\nend",
"def decode(text); end",
"def b64_encode(string)\n Base64.encode64(string).tr(\"\\n=\",'')\n end",
"def urlsafe_decode642(str)\n # NOTE: RFC 4648 does say nothing about unpadded input, but says that\n # \"the excess pad characters MAY also be ignored\", so it is inferred that\n # unpadded input is also acceptable.\n str = str.tr(\"-_\", \"+/\")\n if !str.end_with?(\"=\") && str.length % 4 != 0\n str = str.ljust((str.length + 3) & ~3, \"=\")\n end\n Base64.strict_decode64(str)\nend",
"def decode64(str)\n str.unpack(\"m\")[0]\n end",
"def test_hat\n assert_equal MyBase64.decode64(\"aGF0\"), \"hat\"\n end",
"def decode64(str)\n str.unpack(\"m\").first\n end",
"def write_base64(data_stream)\n write_with_children \"base64\" do\n while (buf = data_stream.read(WRITE_BUFFER_SIZE)) != nil do\n @io << [buf].pack('m').chop\n end\n end\n end",
"def to_base64\n base64 = [to_s].pack('m').delete(\"\\n\")\n base64.gsub!('/', '~')\n base64.gsub!('+', '-')\n base64\n end",
"def base64_encode(string)\n SSL.base64_encode(string)\n end",
"def base64_encode(string)\n SSL.base64_encode(string)\n end",
"def decode_image(data)\r\n\r\n data_index = data.index('base64') + 7\r\n filedata = data.slice(data_index, data.length)\r\n decoded_image = Base64.decode64(filedata)\r\n\r\n end",
"def base64(digits)\n string(BASE64_DIGITS, digits)\n end",
"def crypt_keeper_payload_parse(payload)\n payload.encode('UTF-8', 'binary',\n invalid: :replace, undef: :replace, replace: '')\n end",
"def base64_encode\n [self].pack('m').chop\n end",
"def encode(str)\n @base64 = Base64.encode64(str)\n end",
"def decode64_url(str)\n # add '=' padding\n str = case str.length % 4\n when 2 then str + '=='\n when 3 then str + '='\n else\n str\n end\n\n Base64.decode64(str.tr('-_', '+/'))\nend",
"def encode_base64!\n self.replace(self.encode_base64)\n end",
"def decode_bytes(str)\n dec_string = \"\"\n str.each_byte do |char|\n dec_string += (((char & 0x3) << 6) | char >> 2).chr\n end\n dec_string\n end",
"def test_binary\n base64_binary_xml = <<EOF\n <llsd>\n <binary>dGhlIHF1aWNrIGJyb3duIGZveA==</binary>\n </llsd>\nEOF\n\n # <binary/> should return blank binary blob... in ruby I guess this is just nil\n\n assert_equal 'dGhlIHF1aWNrIGJyb3duIGZveA==', LLSD.parse(base64_binary_xml)\n end",
"def base_decrypt(ciphertext)\n simple_box = RbNaCl::SimpleBox.from_secret_key(key)\n simple_box.decrypt(ciphertext).force_encoding('UTF-8')\n # For an unknown reason, the decrypted result is default\n # to be of 'ASCII-8BIT', so we have to transform it into\n # UTF-8 by ourself!!\n end",
"def binary(string)\n string.force_encoding(Encoding::ASCII_8BIT)\n end",
"def data\n Base64::decode64(@data)\n end",
"def encode\n ::Base64.encode64(@string)\n end",
"def encode64(bin)\n [bin].pack(\"m\")\n end",
"def encode64(bin)\n [bin].pack(\"m\")\n end",
"def decode_base64_image\n if self.image_data && self.content_type && self.original_filename\n # decoded_data = Base64.decode64(self.image_data)\n\n data = StringIO.new(image_data)\n data.class_eval do\n attr_accessor :content_type, :original_filename\n end\n\n data.content_type = self.content_type\n data.original_filename = File.basename(self.original_filename)\n\n self.avatar = data\n end\n end",
"def decode; end",
"def decode; end",
"def encode_bytes(raw_bytes)\n Base64.urlsafe_encode64(raw_bytes)\n end",
"def strict_encode64(bin)\n return Base64.strict_encode64(bin) if Base64.respond_to? :strict_encode64\n Base64.encode64(bin).tr(\"\\n\",'')\n end",
"def decode_attribute(attribute)\n ActiveSupport::Base64.decode64(attribute)\n end",
"def base64_encoded?(string)\n !!string.gsub(/[\\r\\n]|\\\\r|\\\\n/, \"\").match(BASE64_FORMAT)\n end",
"def base64_encoded?(string)\n !!string.gsub(/[\\r\\n]|\\\\r|\\\\n/, \"\").match(BASE64_FORMAT)\n end",
"def base64\n self[:data]\n end",
"def fake_base_64\n Base64.urlsafe_encode64(words(20).join)\nend",
"def test_b64_working\n\n ### token test\n key = \"0A3JhgnyQqmp0zTo1bEy1ZjqCG8aDFKJ\"\n secret = \"MdMZUgWdtyCIaaVC6qkY3143qysaMDMx\"\n ks = key +\":\"+ secret\n\n a = \"MEEzSmhnbnlRcW1wMHpUbzFiRXkxWmpxQ0c4YURGS0o6TWRNWlVnV2R0eUNJYWFWQzZxa1kzMTQzcXlzYU1ETXg=\"\n b = WAPI.base64_key_secret(key, secret)\n\n assert_equal a, b\n\n back_a = Base64.strict_decode64(a)\n back_b = Base64.strict_decode64(b)\n\n assert_equal back_a, back_b\n end",
"def hex_to_64(str)\n decoded_hex = hex_to_ascii(str) \n Base64.strict_encode64 decoded_hex\n end",
"def convert_to_base64(csv)\n Base64.encode64(csv)\n end",
"def to_base64\n [self].pack(\"m\")\n end",
"def decode_string(bytes)\n bytes.map(&:chr)\n .join\n .gsub(/#{0.chr}*$/, '')\n end",
"def base64_encode\n Base64.encode64(file_contents)\n end",
"def binary_string; end",
"def data; Marshal.load(Base64.decode64(read_attribute(:data))); end",
"def base64_encode value\n encoded_str = Base64.urlsafe_encode64 value, padding: false\nend",
"def urlsafe_encode64(bin)\n strict_encode64(bin).tr(\"+/\", \"-_\")\n end",
"def parse(params)\n Marshal.load(Base64.decode64(params))\n end",
"def pack_base64digest(bin)\n [bin].pack('m0')\n end",
"def pack_base64digest(bin)\n [bin].pack('m0')\n end",
"def strict_encode64(string)\n [string].pack('m0')\n end",
"def base64(length: T.unsafe(nil), padding: T.unsafe(nil), urlsafe: T.unsafe(nil)); end"
] | [
"0.77251726",
"0.77251726",
"0.75442106",
"0.7541767",
"0.74189585",
"0.7303875",
"0.72659075",
"0.7251851",
"0.71538424",
"0.71538424",
"0.71455646",
"0.7125728",
"0.70656073",
"0.6980052",
"0.69579655",
"0.6957261",
"0.6900413",
"0.6869287",
"0.68567014",
"0.6763753",
"0.67588717",
"0.6680498",
"0.666558",
"0.66655004",
"0.6660478",
"0.66034865",
"0.65655583",
"0.6547685",
"0.6542427",
"0.65276355",
"0.65245867",
"0.65036243",
"0.64956796",
"0.6485711",
"0.6479468",
"0.64531964",
"0.6437546",
"0.6409626",
"0.638652",
"0.6383717",
"0.63683116",
"0.6366303",
"0.6356818",
"0.6356328",
"0.63533",
"0.632586",
"0.6252798",
"0.6239712",
"0.6221319",
"0.62189907",
"0.6195386",
"0.6195066",
"0.6146907",
"0.6130923",
"0.6128111",
"0.60755485",
"0.6068418",
"0.6062127",
"0.6061037",
"0.6061037",
"0.60408366",
"0.6027824",
"0.60217905",
"0.5993832",
"0.59931535",
"0.59869385",
"0.5982714",
"0.59705585",
"0.59696114",
"0.59649664",
"0.59534585",
"0.5952393",
"0.5947255",
"0.59373",
"0.59373",
"0.59311455",
"0.59216833",
"0.59216833",
"0.5918359",
"0.58918947",
"0.5888863",
"0.5859246",
"0.5859246",
"0.58541375",
"0.5846513",
"0.5833509",
"0.5821984",
"0.58156383",
"0.5805061",
"0.5798999",
"0.57722914",
"0.57721084",
"0.57607204",
"0.57589984",
"0.57483476",
"0.5735997",
"0.5728636",
"0.5728636",
"0.57256407",
"0.57218975"
] | 0.6115034 | 55 |
Base 64 decode, convert base 64 string to binary content Decodes / converts base 64 UTF8 text string to binary content | def edit_text_base64_decode_with_http_info(request, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: EditTextApi.edit_text_base64_decode ...'
end
# verify the required parameter 'request' is set
if @api_client.config.client_side_validation && request.nil?
fail ArgumentError, "Missing the required parameter 'request' when calling EditTextApi.edit_text_base64_decode"
end
# resource path
local_var_path = '/convert/edit/text/encoding/base64/decode'
# query parameters
query_params = {}
# header parameters
header_params = {}
# HTTP header 'Accept' (if needed)
header_params['Accept'] = @api_client.select_header_accept(['application/json', 'text/json', 'application/xml', 'text/xml'])
# HTTP header 'Content-Type'
header_params['Content-Type'] = @api_client.select_header_content_type(['application/json', 'text/json', 'application/xml', 'text/xml', 'application/x-www-form-urlencoded'])
# form parameters
form_params = {}
# http body (model)
post_body = @api_client.object_to_http_body(request)
auth_names = ['Apikey']
data, status_code, headers = @api_client.call_api(:POST, local_var_path,
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,
:body => post_body,
:auth_names => auth_names,
:return_type => 'Base64DecodeResponse')
if @api_client.config.debugging
@api_client.config.logger.debug "API called: EditTextApi#edit_text_base64_decode\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def base64_decode(string)\n SSL.base64_decode(string)\n end",
"def base64_decode(string)\n SSL.base64_decode(string)\n end",
"def decode(string)\n Base64.decode64(string)\n end",
"def decode_base64\n #self.unpack(\"m*\").first\n # This should be the above line but due to a bug in the ruby base64 decoder\n # it will only decode base64 where the lines are in multiples of 4, this is\n # contrary to RFC2045 which says that all characters other than the 65 used\n # are to be ignored. Currently we remove all the other characters but it \n # might be better to use it's advice to only remove line breaks and white\n # space\n self.tr(\"^A-Za-z0-9+/=\", \"\").unpack(\"m*\").first\n end",
"def decode(b)\n Base64.decode64(b)\n end",
"def base64_decode\n unpack('m').first\n end",
"def base64\n binary = open { |io| io.read }\n result = Base64.encode64(binary).chomp\n binary.clear # deallocate string\n result\n end",
"def decoded\n Base64.decode64(@base64 || \"\")\n end",
"def decode_base64_string(filename, data)\n\n decoded_image = Base64.decode64(data)\n\nend",
"def decode_base64_string(filename, data)\n\n decoded_image = Base64.decode64(data)\n\nend",
"def base64\n binary = open { |io| io.read }\n result = Base64.strict_encode64(binary)\n binary.clear # deallocate string\n result\n end",
"def decode64\n Base64.strict_decode64(unwrap)\n end",
"def b64d(input)\n if input\n return helpers.base64Decode(input)\n end\n return \"\".to_java_bytes\n end",
"def hex_to_bin_to_base64(hex_encoded_string)\n bin = Lib.hex_to_bin(hex_encoded_string)\n Lib.bin_to_base64([bin])\nend",
"def decode(value)\n Base64.decode64 value\n end",
"def decode_bytes(encoded_bytes)\n Base64.urlsafe_decode64(encoded_bytes)\n end",
"def decode(base64)\n base64.to_s.unpack(\"m\").first\n end",
"def strict_decode64( str )\n \n if RUBY_VERSION >= \"1.9\"\n Base64.strict_decode64( str )\n else\n Base64.decode64( str )\n end\nend",
"def decode_base64!\n self.replace(self.decode_base64)\n end",
"def base64_url_decode(str)\n str += '=' * (4 - str.length.modulo(4))\n Base64.decode64(str.tr('-_', '+/'))\n end",
"def encode_base64(text)\n Base64.strict_encode64(text).strip\n end",
"def base64_url_decode(str)\n \"#{str}==\".tr(\"-_\", \"+/\").unpack(\"m\")[0]\n end",
"def strict_decode64(str)\n return Base64.strict_decode64(str) if Base64.respond_to? :strict_decode64\n\n unless str.include?(\"\\n\")\n Base64.decode64(str)\n else\n raise(ArgumentError,\"invalid base64\")\n end\n end",
"def raw_to_base_64(byte_array)\n return \"\" if byte_array == []\n ((3 - (byte_array.length % 3)) % 3).times { byte_array << 0 }\n c1 = BASE_64_CHARS[byte_array[0] >> 2]\n c2 = BASE_64_CHARS[(byte_array[0] % 4) * 16 + (byte_array[1] >> 4)]\n c3 = BASE_64_CHARS[(byte_array[1] % 16) * 4 + (byte_array[2] >> 6)]\n c4 = BASE_64_CHARS[byte_array[2] % 64]\n c1 + c2 + c3 + c4 + raw_to_base_64(byte_array[3..-1])\nend",
"def bin_to_base64(bin)\nreturn bin.scan(/....../).map { |x| $BASE64[x.to_i(2)] }.join\nend",
"def u64(s)\n return unless s\n Base64.decode64 CGI.unescape(s)\n end",
"def decode_body(body)\n body += '=' * (4 - body.length.modulo(4))\n Base64.decode64(body.tr('-_','+/'))\n end",
"def b64_e(data)\n Base64.encode64(data).chomp\n end",
"def hex_base64_convert(s)\n [[s].pack(\"H*\")].pack(\"M*\")\nend",
"def hex_to_base64(s)\n [[s].pack(\"H*\")].pack('m*')\nend",
"def from_base64\n unpack(\"m\").first\n end",
"def safe_string(str)\n b64str = Base64.strict_encode64(str)\n \"echo #{b64str} | base64 --decode\"\n end",
"def base64(stuff)\n Base64.encode64(stuff).delete(\"\\n\")\n end",
"def encode_str(str)\n require \"base64\"\n encoded_str=Base64.encode64(str)\n return encoded_str\nend",
"def decipher_base64(value_base64, key)\n if blank(value_base64)\n return nil\n else\n cipher_text = Base64.decode64(value_base64)\n return decipher(cipher_text, key)\n end\nend",
"def decode_aes256_cbc_base64 data\n if data.empty?\n ''\n else\n # TODO: Check for input validity!\n _decode_aes256 :cbc, decode_base64(data[1, 24]), decode_base64(data[26..-1])\n end\n end",
"def base64(text, charset=\"iso-2022-jp\", convert=true)\n if convert\n if charset == \"iso-2022-jp\"\n text = NKF.nkf('-j -m0', text)\n end\n end\n text = [text].pack('m').delete(\"\\r\\n\")\n \"=?#{charset}?B?#{text}?=\"\n end",
"def urlsafe_decode64(str)\n strict_decode64(str.tr(\"-_\", \"+/\"))\n end",
"def decode_blob blob\n if not String === blob\n raise ArgumentError, 'Blob should be a string'\n end\n\n if blob[0, 4] != 'TFBB'\n raise ArgumentError, 'Blob doesn\\'t seem to be base64 encoded'\n end\n\n decode_base64 blob\n end",
"def postgres_base64_data(data)\n [data].pack(\"m*\").gsub(/\\r?\\n/,\"\")\n end",
"def decode_b(str)\n str.gsub!(/=\\?ISO-2022-JP\\?B\\?([!->@-~]+)\\?=/i) {\n decode64($1)\n }\n str = Kconv::toeuc(str)\n str.gsub!(/=\\?SHIFT_JIS\\?B\\?([!->@-~]+)\\?=/i) {\n decode64($1)\n }\n str = Kconv::toeuc(str)\n str.gsub!(/\\n/, ' ') \n str.gsub!(/\\0/, '')\n str\n end",
"def base64\n content = storage.read(id)\n base64 = Base64.encode64(content)\n base64.chomp\n end",
"def decode_params_base64(s)\n parsed = CGI.parse(Base64.decode64(\"#{s}==\"))\n params = Hash[*parsed.entries.map { |k, v| [k, v[0]] }.flatten]\n params.with_indifferent_access\n end",
"def bytes\n Base64.decode64(data)\n end",
"def decrypt(base64_string)\r\n encrypted = Base64.decode64(base64_string)\r\n aes = decipher\r\n aes.update(encrypted) + aes.final\r\n end",
"def decrypt64(str)\n dec = ''\n str = Base64.decode64(str)\n while str.length != 0\n dec += self.private_decrypt(str[0..self.decrypt_block_size])\n str = str[self.decrypt_block_size+1..-1] if str.length > self.decrypt_block_size\n end\n dec\n end",
"def decode(data)\n case @encoding\n when nil, :none, :raw\n data\n when :base64\n Base64.decode64(data)\n else\n raise Cryptic::UnsupportedEncoding, @encoding\n end\n end",
"def encode_base64\n [self].pack(\"m*\")\n end",
"def base64digest\n DigestUtils.pack_base64digest(digest)\n end",
"def decode_string(str)\n\nend",
"def decode(text); end",
"def b64_encode(string)\n Base64.encode64(string).tr(\"\\n=\",'')\n end",
"def urlsafe_decode642(str)\n # NOTE: RFC 4648 does say nothing about unpadded input, but says that\n # \"the excess pad characters MAY also be ignored\", so it is inferred that\n # unpadded input is also acceptable.\n str = str.tr(\"-_\", \"+/\")\n if !str.end_with?(\"=\") && str.length % 4 != 0\n str = str.ljust((str.length + 3) & ~3, \"=\")\n end\n Base64.strict_decode64(str)\nend",
"def decode64(str)\n str.unpack(\"m\")[0]\n end",
"def test_hat\n assert_equal MyBase64.decode64(\"aGF0\"), \"hat\"\n end",
"def edit_text_base64_decode(request, opts = {})\n data, _status_code, _headers = edit_text_base64_decode_with_http_info(request, opts)\n data\n end",
"def decode64(str)\n str.unpack(\"m\").first\n end",
"def write_base64(data_stream)\n write_with_children \"base64\" do\n while (buf = data_stream.read(WRITE_BUFFER_SIZE)) != nil do\n @io << [buf].pack('m').chop\n end\n end\n end",
"def to_base64\n base64 = [to_s].pack('m').delete(\"\\n\")\n base64.gsub!('/', '~')\n base64.gsub!('+', '-')\n base64\n end",
"def base64_encode(string)\n SSL.base64_encode(string)\n end",
"def base64_encode(string)\n SSL.base64_encode(string)\n end",
"def decode_image(data)\r\n\r\n data_index = data.index('base64') + 7\r\n filedata = data.slice(data_index, data.length)\r\n decoded_image = Base64.decode64(filedata)\r\n\r\n end",
"def base64(digits)\n string(BASE64_DIGITS, digits)\n end",
"def crypt_keeper_payload_parse(payload)\n payload.encode('UTF-8', 'binary',\n invalid: :replace, undef: :replace, replace: '')\n end",
"def base64_encode\n [self].pack('m').chop\n end",
"def encode(str)\n @base64 = Base64.encode64(str)\n end",
"def decode64_url(str)\n # add '=' padding\n str = case str.length % 4\n when 2 then str + '=='\n when 3 then str + '='\n else\n str\n end\n\n Base64.decode64(str.tr('-_', '+/'))\nend",
"def encode_base64!\n self.replace(self.encode_base64)\n end",
"def decode_bytes(str)\n dec_string = \"\"\n str.each_byte do |char|\n dec_string += (((char & 0x3) << 6) | char >> 2).chr\n end\n dec_string\n end",
"def test_binary\n base64_binary_xml = <<EOF\n <llsd>\n <binary>dGhlIHF1aWNrIGJyb3duIGZveA==</binary>\n </llsd>\nEOF\n\n # <binary/> should return blank binary blob... in ruby I guess this is just nil\n\n assert_equal 'dGhlIHF1aWNrIGJyb3duIGZveA==', LLSD.parse(base64_binary_xml)\n end",
"def base_decrypt(ciphertext)\n simple_box = RbNaCl::SimpleBox.from_secret_key(key)\n simple_box.decrypt(ciphertext).force_encoding('UTF-8')\n # For an unknown reason, the decrypted result is default\n # to be of 'ASCII-8BIT', so we have to transform it into\n # UTF-8 by ourself!!\n end",
"def data\n Base64::decode64(@data)\n end",
"def binary(string)\n string.force_encoding(Encoding::ASCII_8BIT)\n end",
"def encode\n ::Base64.encode64(@string)\n end",
"def encode64(bin)\n [bin].pack(\"m\")\n end",
"def encode64(bin)\n [bin].pack(\"m\")\n end",
"def decode_base64_image\n if self.image_data && self.content_type && self.original_filename\n # decoded_data = Base64.decode64(self.image_data)\n\n data = StringIO.new(image_data)\n data.class_eval do\n attr_accessor :content_type, :original_filename\n end\n\n data.content_type = self.content_type\n data.original_filename = File.basename(self.original_filename)\n\n self.avatar = data\n end\n end",
"def decode; end",
"def decode; end",
"def encode_bytes(raw_bytes)\n Base64.urlsafe_encode64(raw_bytes)\n end",
"def strict_encode64(bin)\n return Base64.strict_encode64(bin) if Base64.respond_to? :strict_encode64\n Base64.encode64(bin).tr(\"\\n\",'')\n end",
"def decode_attribute(attribute)\n ActiveSupport::Base64.decode64(attribute)\n end",
"def base64_encoded?(string)\n !!string.gsub(/[\\r\\n]|\\\\r|\\\\n/, \"\").match(BASE64_FORMAT)\n end",
"def base64_encoded?(string)\n !!string.gsub(/[\\r\\n]|\\\\r|\\\\n/, \"\").match(BASE64_FORMAT)\n end",
"def base64\n self[:data]\n end",
"def fake_base_64\n Base64.urlsafe_encode64(words(20).join)\nend",
"def test_b64_working\n\n ### token test\n key = \"0A3JhgnyQqmp0zTo1bEy1ZjqCG8aDFKJ\"\n secret = \"MdMZUgWdtyCIaaVC6qkY3143qysaMDMx\"\n ks = key +\":\"+ secret\n\n a = \"MEEzSmhnbnlRcW1wMHpUbzFiRXkxWmpxQ0c4YURGS0o6TWRNWlVnV2R0eUNJYWFWQzZxa1kzMTQzcXlzYU1ETXg=\"\n b = WAPI.base64_key_secret(key, secret)\n\n assert_equal a, b\n\n back_a = Base64.strict_decode64(a)\n back_b = Base64.strict_decode64(b)\n\n assert_equal back_a, back_b\n end",
"def hex_to_64(str)\n decoded_hex = hex_to_ascii(str) \n Base64.strict_encode64 decoded_hex\n end",
"def convert_to_base64(csv)\n Base64.encode64(csv)\n end",
"def to_base64\n [self].pack(\"m\")\n end",
"def decode_string(bytes)\n bytes.map(&:chr)\n .join\n .gsub(/#{0.chr}*$/, '')\n end",
"def base64_encode\n Base64.encode64(file_contents)\n end",
"def binary_string; end",
"def data; Marshal.load(Base64.decode64(read_attribute(:data))); end",
"def base64_encode value\n encoded_str = Base64.urlsafe_encode64 value, padding: false\nend",
"def urlsafe_encode64(bin)\n strict_encode64(bin).tr(\"+/\", \"-_\")\n end",
"def parse(params)\n Marshal.load(Base64.decode64(params))\n end",
"def pack_base64digest(bin)\n [bin].pack('m0')\n end",
"def pack_base64digest(bin)\n [bin].pack('m0')\n end",
"def strict_encode64(string)\n [string].pack('m0')\n end",
"def base64(length: T.unsafe(nil), padding: T.unsafe(nil), urlsafe: T.unsafe(nil)); end"
] | [
"0.7725709",
"0.7725709",
"0.75449055",
"0.75424063",
"0.7419948",
"0.73043716",
"0.7265499",
"0.7252951",
"0.7154137",
"0.7154137",
"0.7144952",
"0.7126555",
"0.70659447",
"0.6979753",
"0.6958805",
"0.6957194",
"0.6901581",
"0.6869887",
"0.6857393",
"0.67643476",
"0.6758812",
"0.6680924",
"0.66663647",
"0.6664561",
"0.6660239",
"0.6603394",
"0.6566049",
"0.6547229",
"0.65420467",
"0.6527402",
"0.6525012",
"0.65034455",
"0.6495256",
"0.64853036",
"0.6480582",
"0.64536256",
"0.6437303",
"0.64098966",
"0.6386613",
"0.6381744",
"0.6368557",
"0.63662714",
"0.63575405",
"0.6355993",
"0.63542616",
"0.63266784",
"0.62528074",
"0.6239015",
"0.62209684",
"0.6218926",
"0.6195654",
"0.6194343",
"0.614763",
"0.6131308",
"0.6129206",
"0.611495",
"0.6075974",
"0.60678065",
"0.606184",
"0.6060435",
"0.6060435",
"0.60410196",
"0.6027916",
"0.6020915",
"0.5992992",
"0.5992591",
"0.5987632",
"0.5982498",
"0.59694326",
"0.5969194",
"0.5965299",
"0.5952525",
"0.5951507",
"0.5946719",
"0.5936722",
"0.5936722",
"0.5932224",
"0.59218544",
"0.59218544",
"0.5916879",
"0.58911973",
"0.58895934",
"0.58593005",
"0.58593005",
"0.58542395",
"0.58464885",
"0.5834939",
"0.58222854",
"0.58154714",
"0.5804982",
"0.5797656",
"0.57716477",
"0.5770362",
"0.5761075",
"0.57589006",
"0.57475656",
"0.57366455",
"0.5727754",
"0.5727754",
"0.57246596",
"0.57211715"
] | 0.0 | -1 |
Detect, check if text string is base 64 encoded Checks, detects if input string is base 64 encoded | def edit_text_base64_detect(request, opts = {})
data, _status_code, _headers = edit_text_base64_detect_with_http_info(request, opts)
data
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def base64_encoded?(string)\n !!string.gsub(/[\\r\\n]|\\\\r|\\\\n/, \"\").match(BASE64_FORMAT)\n end",
"def base64_encoded?(string)\n !!string.gsub(/[\\r\\n]|\\\\r|\\\\n/, \"\").match(BASE64_FORMAT)\n end",
"def valid_base64?(string)\n return false unless string.is_a?(String)\n return false unless string.start_with?('base64:')\n\n return true\n end",
"def encode_base64(text)\n Base64.strict_encode64(text).strip\n end",
"def safe_string(str)\n b64str = Base64.strict_encode64(str)\n \"echo #{b64str} | base64 --decode\"\n end",
"def test_hat\n assert_equal MyBase64.decode64(\"aGF0\"), \"hat\"\n end",
"def encode_str(str)\n require \"base64\"\n encoded_str=Base64.encode64(str)\n return encoded_str\nend",
"def fake_base_64\n Base64.urlsafe_encode64(words(20).join)\nend",
"def decode_base64\n #self.unpack(\"m*\").first\n # This should be the above line but due to a bug in the ruby base64 decoder\n # it will only decode base64 where the lines are in multiples of 4, this is\n # contrary to RFC2045 which says that all characters other than the 65 used\n # are to be ignored. Currently we remove all the other characters but it \n # might be better to use it's advice to only remove line breaks and white\n # space\n self.tr(\"^A-Za-z0-9+/=\", \"\").unpack(\"m*\").first\n end",
"def guess_mime_encoding\n # Grab the first line and have a guess?\n # A multiple of 4 and no characters that aren't in base64 ?\n # Need to allow for = at end of base64 string\n squashed = self.tr(\"\\r\\n\\s\", '').strip.sub(/=*\\Z/, '')\n if squashed.length.remainder(4) == 0 && squashed.count(\"^A-Za-z0-9+/\") == 0\n :base64\n else\n :quoted_printable\n end\n # or should we just try both and see what works?\n end",
"def base64_decode(string)\n SSL.base64_decode(string)\n end",
"def base64_decode(string)\n SSL.base64_decode(string)\n end",
"def base64(stuff)\n Base64.encode64(stuff).delete(\"\\n\")\n end",
"def strict_decode64( str )\n \n if RUBY_VERSION >= \"1.9\"\n Base64.strict_decode64( str )\n else\n Base64.decode64( str )\n end\nend",
"def u64(s)\n return unless s\n Base64.decode64 CGI.unescape(s)\n end",
"def binary?\n @encoding == 'base64'\n end",
"def b64d(input)\n if input\n return helpers.base64Decode(input)\n end\n return \"\".to_java_bytes\n end",
"def e64(s)\n return unless s\n CGI.escape Base64.encode64(s)\n end",
"def strict_decode64(str)\n return Base64.strict_decode64(str) if Base64.respond_to? :strict_decode64\n\n unless str.include?(\"\\n\")\n Base64.decode64(str)\n else\n raise(ArgumentError,\"invalid base64\")\n end\n end",
"def decode_base64_string(filename, data)\n\n decoded_image = Base64.decode64(data)\n\nend",
"def decode_base64_string(filename, data)\n\n decoded_image = Base64.decode64(data)\n\nend",
"def strict_encode64(bin)\n return Base64.strict_encode64(bin) if Base64.respond_to? :strict_encode64\n Base64.encode64(bin).tr(\"\\n\",'')\n end",
"def base64?\n !!@options[:base64]\n end",
"def password_encoded?(password)\n reg_ex_test = \"^([A-Za-z0-9+/]{4})*([A-Za-z0-9+/]{4}|[A-Za-z0-9+/]{3}=|[A-Za-z0-9+/]{2}==)$\"\n\n if password =~ /#{reg_ex_test}/ then\n return true\n else\n return false\n end\n end",
"def b64_e(data)\n Base64.encode64(data).chomp\n end",
"def sanitize_base64_string(base64_string)\n array_string = base64_string.split('//')\n array_string[-1] = array_string[-1].gsub('\\\\', '')\n array_string.join('//')\n end",
"def base64(text, charset=\"iso-2022-jp\", convert=true)\n if convert\n if charset == \"iso-2022-jp\"\n text = NKF.nkf('-j -m0', text)\n end\n end\n text = [text].pack('m').delete(\"\\r\\n\")\n \"=?#{charset}?B?#{text}?=\"\n end",
"def get_base64_image(image)\n image_base64 = Base64.encode64(open(image) { |io| io.read })\n filter_image = image_base64.gsub(/\\r/,\"\").gsub(/\\n/,\"\")\n end",
"def decode(string)\n Base64.decode64(string)\n end",
"def base64_url_decode(str)\n \"#{str}==\".tr(\"-_\", \"+/\").unpack(\"m\")[0]\n end",
"def urlsafe_encode64(bin)\n strict_encode64(bin).tr(\"+/\", \"-_\")\n end",
"def encode_string_ex; end",
"def b64_encode(string)\n Base64.encode64(string).tr(\"\\n=\",'')\n end",
"def base64_encode value\n encoded_str = Base64.urlsafe_encode64 value, padding: false\nend",
"def decipher_base64(value_base64, key)\n if blank(value_base64)\n return nil\n else\n cipher_text = Base64.decode64(value_base64)\n return decipher(cipher_text, key)\n end\nend",
"def bin_to_base64(bin)\nreturn bin.scan(/....../).map { |x| $BASE64[x.to_i(2)] }.join\nend",
"def base64_encode(string)\n SSL.base64_encode(string)\n end",
"def base64_encode(string)\n SSL.base64_encode(string)\n end",
"def base64_decode\n unpack('m').first\n end",
"def hex_to_bin_to_base64(hex_encoded_string)\n bin = Lib.hex_to_bin(hex_encoded_string)\n Lib.bin_to_base64([bin])\nend",
"def decode_params_base64(s)\n parsed = CGI.parse(Base64.decode64(\"#{s}==\"))\n params = Hash[*parsed.entries.map { |k, v| [k, v[0]] }.flatten]\n params.with_indifferent_access\n end",
"def decoded\n Base64.decode64(@base64 || \"\")\n end",
"def can_encode?(str, charset: BASIC_CHARSET)\n !str || !!(regex(charset) =~ str)\n end",
"def base64\n binary = open { |io| io.read }\n result = Base64.strict_encode64(binary)\n binary.clear # deallocate string\n result\n end",
"def base64\n binary = open { |io| io.read }\n result = Base64.encode64(binary).chomp\n binary.clear # deallocate string\n result\n end",
"def validate_certificate_base64(cert)\n return false if(cert.to_s.length <= 0 )\n # try to decode it by loading the entire decoded thing in memory\n begin\n # A tolerant verification\n # We'll use this only if SIJC's certificates fail in the\n # initial trials, else, we'll stick to the strict one.\n # Next line complies just with RC 2045:\n # decode = Base64.decode64(cert)\n\n # A strict verification:\n # Next line complies with RFC 4648:\n # try to decode, ArgumentErro is raised\n # if incorrectly padded or contains non-alphabet characters.\n decode = Base64.strict_decode64(cert)\n\n # Once decoded release it from memory\n decode = nil\n return true\n rescue Exception => e\n return false\n end\n end",
"def validate_certificate_base64(cert)\n return false if(cert.to_s.length <= 0 )\n # try to decode it by loading the entire decoded thing in memory\n begin\n # A tolerant verification\n # We'll use this only if SIJC's certificates fail in the\n # initial trials, else, we'll stick to the strict one.\n # Next line complies just with RC 2045:\n # decode = Base64.decode64(cert)\n\n # A strict verification:\n # Next line complies with RFC 4648:\n # try to decode, ArgumentErro is raised\n # if incorrectly padded or contains non-alphabet characters.\n decode = Base64.strict_decode64(cert)\n\n # Once decoded release it from memory\n decode = nil\n return true\n rescue Exception => e\n return false\n end\n end",
"def ensure_valid_encoding(string)\n sanitized = string.each_char.select { |c| c.bytes.count < 4 }.join\n if sanitized.length < string.length\n if removed = string.each_char.select { |c| c.bytes.count >= 4 }.join\n Rails.logger.debug(\"removed invalid encoded elements: #{removed}\")\n end\n end\n sanitized\n end",
"def encode(str)\n @base64 = Base64.encode64(str)\n end",
"def base64digest\n DigestUtils.pack_base64digest(digest)\n end",
"def encode\n ::Base64.encode64(@string)\n end",
"def can_encode?(str)\n str.nil? || !(GSM_REGEX =~ str).nil?\n end",
"def base64(length: T.unsafe(nil), padding: T.unsafe(nil), urlsafe: T.unsafe(nil)); end",
"def encript(text_to_encript)\n require 'base64'\n Base64.encode64(text_to_encript)\n\nend",
"def test_b64_working\n\n ### token test\n key = \"0A3JhgnyQqmp0zTo1bEy1ZjqCG8aDFKJ\"\n secret = \"MdMZUgWdtyCIaaVC6qkY3143qysaMDMx\"\n ks = key +\":\"+ secret\n\n a = \"MEEzSmhnbnlRcW1wMHpUbzFiRXkxWmpxQ0c4YURGS0o6TWRNWlVnV2R0eUNJYWFWQzZxa1kzMTQzcXlzYU1ETXg=\"\n b = WAPI.base64_key_secret(key, secret)\n\n assert_equal a, b\n\n back_a = Base64.strict_decode64(a)\n back_b = Base64.strict_decode64(b)\n\n assert_equal back_a, back_b\n end",
"def base64(digits)\n string(BASE64_DIGITS, digits)\n end",
"def pack_urlsafe_base64digest(bin)\n str = pack_base64digest(bin)\n str.tr!('+/'.freeze, '-_'.freeze)\n str.tr!('='.freeze, ''.freeze)\n str\n end",
"def pack_urlsafe_base64digest(bin)\n str = pack_base64digest(bin)\n str.tr!('+/'.freeze, '-_'.freeze)\n str.tr!('='.freeze, ''.freeze)\n str\n end",
"def reencode_string(input); end",
"def decode64\n Base64.strict_decode64(unwrap)\n end",
"def urlsafe_decode64(str)\n strict_decode64(str.tr(\"-_\", \"+/\"))\n end",
"def urlsafe_decode642(str)\n # NOTE: RFC 4648 does say nothing about unpadded input, but says that\n # \"the excess pad characters MAY also be ignored\", so it is inferred that\n # unpadded input is also acceptable.\n str = str.tr(\"-_\", \"+/\")\n if !str.end_with?(\"=\") && str.length % 4 != 0\n str = str.ljust((str.length + 3) & ~3, \"=\")\n end\n Base64.strict_decode64(str)\nend",
"def base64_url_decode(str)\n str += '=' * (4 - str.length.modulo(4))\n Base64.decode64(str.tr('-_', '+/'))\n end",
"def verify_check_string(data)\n # The documentation about how to calculate the hash was woefully\n # under-documented, however through some guessing I was able to\n # determine that it creates an MD5 from the values of the fields\n # starting with OrderID and ending with TranData, concatenated with\n # the Shop Password.\n fields = [\n 'OrderID',\n 'Forward',\n 'Method',\n 'PayTimes',\n 'Approve',\n 'TranID',\n 'TranDate'\n ]\n values_string = ''\n check_string = nil\n\n CGI.parse(data).each do |key, value|\n if value.length == 1\n value = value[0]\n end\n if fields.include?(key)\n values_string += value\n end\n if key == 'CheckString'\n check_string = value\n end\n end\n values_string += @options[:password]\n our_hash = Digest::MD5.hexdigest(values_string)\n check_string == our_hash\n end",
"def strict_encode64(string)\n [string].pack('m0')\n end",
"def decode_aes256_cbc_base64 data\n if data.empty?\n ''\n else\n # TODO: Check for input validity!\n _decode_aes256 :cbc, decode_base64(data[1, 24]), decode_base64(data[26..-1])\n end\n end",
"def encode(string); end",
"def encode64( png )\n return Base64.encode64(png)\n end",
"def base64(value)\n {\"Fn::Base64\" => value}\n end",
"def best_mime_encoding\n if self.is_ascii?\n :none\n elsif self.length > (self.mb_chars.length * 1.1)\n :base64\n else\n :quoted_printable\n end\n end",
"def postgres_base64_data(data)\n [data].pack(\"m*\").gsub(/\\r?\\n/,\"\")\n end",
"def decode64_url(str)\n # add '=' padding\n str = case str.length % 4\n when 2 then str + '=='\n when 3 then str + '='\n else\n str\n end\n\n Base64.decode64(str.tr('-_', '+/'))\nend",
"def clarify_id( text )\n begin\n self.obfuscatable_crypt.clarify( text, :block )\n rescue ArgumentError\n # invalid text passed in, causing a Base64 decode error, ignore.\n end\n end",
"def convert_to_base64(csv)\n Base64.encode64(csv)\n end",
"def csrf_token?( str )\n return false if !str\n\n # we could use regexps but i kinda like lcamtuf's (Michal's) way\n base16_len_min = 8\n base16_len_max = 45\n base16_digit_num = 2\n\n base64_len_min = 6\n base64_len_max = 32\n base64_digit_num = 1\n base64_case = 2\n base64_digit_num2 = 3\n base64_slash_cnt = 2\n\n len = str.size\n digit_cnt = str.scan( /[0-9]+/ ).join.size\n\n if len >= base16_len_min && len <= base16_len_max && digit_cnt >= base16_digit_num\n return true\n end\n\n upper_cnt = str.scan( /[A-Z]+/ ).join.size\n slash_cnt = str.scan( /\\/+/ ).join.size\n\n if len >= base64_len_min && len <= base64_len_max &&\n ((digit_cnt >= base64_digit_num && upper_cnt >= base64_case ) ||\n digit_cnt >= base64_digit_num2) && slash_cnt <= base64_slash_cnt\n return true\n end\n\n false\n end",
"def csrf_token?( str )\n return false if !str\n\n # we could use regexps but i kinda like lcamtuf's (Michal's) way\n base16_len_min = 8\n base16_len_max = 45\n base16_digit_num = 2\n\n base64_len_min = 6\n base64_len_max = 32\n base64_digit_num = 1\n base64_case = 2\n base64_digit_num2 = 3\n base64_slash_cnt = 2\n\n len = str.size\n digit_cnt = str.scan( /[0-9]+/ ).join.size\n\n if len >= base16_len_min && len <= base16_len_max && digit_cnt >= base16_digit_num\n return true\n end\n\n upper_cnt = str.scan( /[A-Z]+/ ).join.size\n slash_cnt = str.scan( /\\/+/ ).join.size\n\n if len >= base64_len_min && len <= base64_len_max &&\n ((digit_cnt >= base64_digit_num && upper_cnt >= base64_case ) ||\n digit_cnt >= base64_digit_num2) && slash_cnt <= base64_slash_cnt\n return true\n end\n\n false\n end",
"def encode(string)\n Base64.encode64(string).gsub(/\\n/, \"\")\n end",
"def test_canonical\n verify(\n 'bb7a81900001041200000001023332033139370234360332303707696e2d61646472046172706100000c0001c00c000c0001000008aa0017116270666f726772656174706c61696e733203636f6d00c00c000c0001000008aa00130e64657369676e6564666f7262696702636e00c00c000c0001000008aa000f0a6f66666963653230303702636800c00c000c0001000008aa000e0977696e646f77737870026b7a00c00c000c0001000008aa00150f77696e646f77733230303074657374036f726700c00c000c0001000008aa000e0b77696e646f77736e743938c0bfc00c000c0001000008aa0016117370726f7374616a77797a77616e696f6d02706c00c00c000c0001000008aa000f09697462727565636b65036e657400c00c000c0001000008aa001512626c7565796f6e6465726169726c696e6573c0bfc00c000c0001000008aa00140f6d73646e746563686e6574746f757202667200c00c000c0001000008aa000c0977696e646f77733938c085c00c000c0001000008aa00130a6f66666963653230303703636f6d026d7800c00c000c0001000008aa000906617a7572696bc116c00c000c0001000008aa00140f65756772616e747361647669736f7202697400c00c000c0001000008aa00171477696e646f7773787067616d6561647669736f72c0bfc00c000c0001000008aa000e09697462727565636b6502646500c00c000c0001000008aa00100b77696e646f77737275627902686b00c00c000c0001000008aa00120977696e646f7773787003636f6d02677400c00c000c0001000008aa000e0b77696e646f777332303037c0bfc00c000c0001000008aa00151268756d6f6e676f7573696e737572616e6365c04ac00c000c0001000008aa001411756b636f6d6d756e697479617761726473c116c00c000c0001000008aa00130a77696e64736f77737870036e657402646f00c00c000c0001000008aa001509646f776e6c6f616473086263656e7472616cc04ac00c000c0001000008aa000e09666f726566726f6e7402617400c00c000c0001000008aa00120d726573706f6e7365706f696e74026c7400c00c000c0001000008aa00130e65766572796f6e6567657473697402657500c00c000c0001000008aa000e09666f726566726f6e7402626500c00c000c0001000008aa00100977696e646f77737870036f7267c2b5c00c000c0001000008aa00120977696e646f777378700372656302726f00c00c000c0001000008aa00120d726573706f6e7365706f696e7402706800c00c000c0001000008aa0015126361707375726c6573756363657332303038c116c00c000c0001000008aa000e0977696e646f7773787002706e00c00c000c0001000008aa000e0b77696e646f777332303030c085c00c000c0001000008aa001815636f686f76696e6579617264616e6477696e657279c04ac00c000c0001000008aa00120977696e646f7773787003636f6d02746c00c00c000c0001000008aa00140f65756772616e747361647669736f72026c7600c00c000c0001000008aa00140f65756772616e747361647669736f7202636c00c00c000c0001000008aa00181164656679616c6c6368616c6c656e67657303636f6dc21dc00c000c0001000008aa00110e7374617274736f6d657468696e67c347c00c000c0001000008aa00100977696e646f77737870036f7267c23bc00c000c0001000008aa00100977696e646f77737870036f7267c0fcc00c000c0001000008aa0016136f666672652d65626c6f75697373616e746573c0bfc00c000c0001000008aa00140b77696e646f77737275627903636f6d02657300c00c000c0001000008aa000f0a6f66666963653230303702636100c00c000c0001000008aa000e0977696e646f7773787002616d00c00c000c0001000008aa001109626570636c6567616c02636f02756b00c00c000c0001000008aa000d0877696e646f77787002747600c00c000c0001000008aa00110977696e646f7773787004696e666fc381c00c000c0001000008aa001f1c786e2d2d66726465726d697474656c2d72617467656265722d333962c201c00c000c0001000008aa00110e65766572796f6e65676574736974c531c00c000c0001000008aa00151268756d6f6e676f7573696e737572616e6365c0bfc00c000c0001000008aa00110e696973646961676e6f7374696373c0bfc00c000c0001000008aa00160f65756772616e747361647669736f7203636f6dc0fcc00c000c0001000008aa000b06666c6578676f02696e00c00c000c0001000008aa00120f696e73696465647269766532303032c04ac00c000c0001000008aa00100d726573706f6e7365706f696e74c18bc00c000c0001000008aa001815636f6e736f6c6964617465646d657373656e676572c116c00c000c0001000008aa000c09666f726566726f6e74c678c00c000c0001000008aa00140b77696e646f77737275627903636f6d02766500c00c000c0001000008aa0017146761676e657a2d656e2d65666669636163697465c0bfc00c000c0001000008aa000f0c636f686f76696e6579617264c0bfc00c000c0001000008aa001714636f6e73756d6572676f6f647373656d696e6172c04ac00c000c0001000008aa001310666f726f706572737065637469766173c0bfc00c000c0001000008aa00120977696e646f7773787003636f6d02616900c00c000c0001000008aa00170e65766572796f6e6567657473697403636f6d02617500c00c000c0001000008aa00120977696e646f77737870036e657402766900c00c000c0001000008aa00120f77696e646f77733230303074657374c116c00c000c0001000008aa00180f65756772616e747361647669736f7203636f6d02707400c00c000c0001000008aa00100b77696e646f777332303030026e6c00c00c000c0001000008aa000c0977696e646f77733935c0bfc00c000c0001000008aa0014117365727665757273616e736c696d697465c116c00c000c0001000008aa0015126d6963726f736f6674666f726566726f6e74c2f0c00c000c0001000008aa000e0977696e646f7773787002736e00c00c000c0001000008aa000e0977696e646f7773787002736300c00c000c0001000008aa0017146d6963726f736f667474696d65657870656e7365c04ac00c000c0001000008aa001c19647269766572646576656c6f706572636f6e666572656e6365c0bfc00c000c0001000008aa000b0877696e646f777870c82bc00c000c0001000008aa000b0661786170746102727500c00c000c0001000008aa000f09666f726566726f6e7402636fc678c00c000c0001000008aa000b0877696e646f777870c436c00c000c0001000008aa000c09626570636c6567616cc04ac00c000c0001000008aa000b0877696e646f777870c456c00c000c0001000008aa000b06666c6578676f02746d00c00c000c0001000008aa0017146761676e657a2d656e2d65666669636163697465c116c00c000c0001000008aa0015126d6963726f736f6674666f726566726f6e74c158c00c000c0001000008aa00110e636c7562736d61727470686f6e65c116c00c000c0001000008aa000c09666f726566726f6e74c158c00c000c0001000008aa00100d726573706f6e7365706f696e74c347c00c000c0001000008aa0015126361707375726c6573756363657332303038c0bfc00c000c0001000008aa000c09666f726566726f6e74c52dc00c000c0001000008aa000906666c6578676fc84bc00c000c0001000008aa00100977696e646f77737870036f7267c39fc00c000c0001000008aa00151273747265616d6c696e6566696e616e636573c04ac00c000c0001000008aa00130d726573706f6e7365706f696e740362697a00c00c000c0001000008aa00120d726573706f6e7365706f696e7402646b00c00c000c0001000008aa000f0c6d6f6e6e6f7576656c616d69c158c00c000c0001000008aa00120f77696e646f77733230303074657374c04ac00c000c0001000008aa000f0c666f75727468636f66666565c04ac00c000c0001000008aa001310666f726f706572737065637469766173c116c00c000c0001000008aa00110e6272757465666f72636567616d65c04ac00c000c0001000008aa000c09696e73656775726f73c116c00c000c0001000008aa00100d726573706f6e7365706f696e74c381c00c000c0001000008aa000f0c647269766572646576636f6ec04ac00c000c0001000008aa001611666f727265746e696e677373797374656d026e6f00c00c000c0001000008aa00140f65756772616e747361647669736f72026c7500c00c000c0001000008aa00100977696e646f77737870036e6574c436c00c000c0001000008aa00120977696e646f7773787003636f6d02666a00c00c000c0001000008aa00140d726573706f6e7365706f696e7403636f6dc06ac00c000c0001000008aa00100d726573706f6e7365706f696e74c580c00c000c0001000008aa000c09666f726566726f6e74c085c00c000c0001000008aa000e0977696e646f7773787002686e00c00c000c0001000008aa00161370736f65786563757469766573656d696e6172c04ac00c000c0001000008aa000906656e6779726fc04ac00c000c0001000008aa00110e6361736866696e616e6369616c73c04ac00c000c0001000008aa00151268756d6f6e676f7573696e737572616e6365c116c00c000c0001000008aa001512636f6e666f726d6974656c6963656e636573c0bfc00c000c0001000008aa0019166c65732d646f696774732d64616e732d6c652d6e657ac158c00c000c0001000008aa000e0977696e646f7773787002616700c00c000c0001000008aa000d0a676f746f746563686564c04ac00c000c0001000008aa00110e667574757265706f73746d61696cc580c00c000c0001000008aa0019166c7574746572636f6e7472656c657069726174616765c0bfc00c000c0001000008aa0014116c756365726e657075626c697368696e67c04ac00c000c0001000008aa000c09666f726566726f6e74cb26c00c000c0001000008aa000e0977696e646f7773787002757a00c00c000c0001000008aa000d0a636f686f77696e657279c116c00c000c0001000008aa001310657870657269656e6365746563686564c04ac00c000c0001000008aa00191677696e646f7773647269766572646576656c6f706572c0bfc00c000c0001000008aa000b0877696e646f777870cac6c00c000c0001000008aa00100d726573706f6e7365706f696e74c70ac00c000c0001000008aa000e0977696e646f7773787002666d00c00c000c0001000008aa00100d726573706f6e7365706f696e74c951c00c000c0001000008aa00130a6f66666963653230303703636f6d02736700c00c000c0001000008aa00110e64657369676e6564666f72626967c116c00c000c0001000008aa000b086370616475766f6cc0bfc00c000c0001000008aa000d0877696e646f777870026d6e00c00c000c0001000008aa000c09666f726566726f6e74c201c00c000c0001000008aa000e0977696e646f77737870026d7500c00c000c0001000008aa000a07666f7269656e74c04ac00c000c0001000008aa000c0977696e646f77737870cfa3c00c000c0001000008aa00100d6c6573626f6e736f7574696c73c0bfc00c000c0001000008aa0014117365727665757273616e736c696d697465c04ac00c000c0001000008aa000e0b6f66666963657265616479cb26c00c000c0001000008aa00120d726573706f6e7365706f696e7402626f00c00c000c0001000008aa000b086d6f6e727562616ec04ac00c000c0001000008aa00100d726573706f6e7365706f696e74c085c00c000c0001000008aa00100d726573706f6e7365706f696e74c54cc00c000c0001000008aa00110e6a65646572686174736472617566c116c00c000c0001000008aa001e1b647269766572646576656c6f706d656e74636f6e666572656e6365c0bfc00c000c0001000008aa000e0b77696e646f777372756279c84bc00c000c0001000008aa001613636f6e666f726d6974652d6c6963656e636573c116c00c000c0001000008aa0015126361707375726c6573756363657332303038c04ac00c000c0001000008aa000d0877696e646f77787002677300c00c000c0001000008aa000d0a7374756f73626f726e65c116c00c000c0001000008aa000c09666f726566726f6e74c18bc00c000c0001000008aa0013106a656465722d686174732d6472617566c201c00c000c0001000008aa0014116d6f62696c657063646576656c6f706572c04ac00c000c0001000008aa00100977696e646f77737870036f7267c3dac00c000c0001000008aa00160d726573706f6e7365706f696e7403636f6d026d7900c00c000c0001000008aa000f0c636f686f76696e6579617264c04ac00c000c0001000008aa00120f73656d696e61697265732d6e617635c158c00c000c0001000008aa000f0c647269766572646576636f6ec116c00c000c0001000008aa000b0877696e646f777870c566c00c000c0001000008aa000f0c6469676974616c616e76696cc04ac00c000c0001000008aa00100d726573706f6e7365706f696e74c158c00c000c0001000008aa000c0977696e646f77733938c04ac00c000c0001000008aa0018156e61762d636f6d706c69616e636577656263617374c04ac00c000c0001000008aa00110e70726f6a656374657870656e7365c04ac00c000c0001000008aa000906666c6578676fc0bfc00c000c0001000008aa000f0877696e646f77787003636f6dc8d8c00c000c0001000008aa000b086c69666563616d73c04ac00c000c0001000008aa00120f696d6167696e657a6c617375697465c0bfc00c000c0001000008aa00171474616b65636f6e74726f6c6f66706179726f6c6cc04ac00c000c0001000008aa0019166772617068696364657369676e696e73746974757465c04ac00c000c0001000008aa00130d726573706f6e7365706f696e7402636fc2f0c00c000c0001000008aa000e0b77696e646f777372756279c498c00c000c0001000008aa000c09697462727565636b65c0bfc00c000c0001000008aa001a17636c756270617274656e61697265737365727669636573c116c00c000c0001000008aa000d0a696d6167696e65637570c580c00c000c0001000008aa000e0b77696e646f777372756279cf52c00c000c0001000008aa001714617a7572696b726973656f667065726174686961c0bfc00c000c0001000008aa00100d726573706f6e7365706f696e74c7cbc00c000c0001000008aa001c19647269766572646576656c6f706572636f6e666572656e6365c04ac00c000c0001000008aa000f0c6d6f6e6e6f7576656c616d69c04ac00c000c0001000008aa000c09626c6f6f6477616b65c04ac00c000c0001000008aa00110e6a65646572686174736472617566c201c00c000c0001000008aa00120d726573706f6e7365706f696e7402646d00c00c000c0001000008aa001613636f6e666f726d6974652d6c6963656e636573c0bfc00c000c0001000008aa00120f696d6167696e657a6c617375697465c158c00c000c0001000008aa000c09666f726566726f6e74c951c00c000c0001000008aa000c09666f726566726f6e74c531c00c000c0001000008aa000e0b77696e646f777332303037cb07c00c000c0001000008aa00110e6d6f62696c6574656368746f7572c116c00c000c0001000008aa000e0b77696e646f777332303036c116c00c000c0001000008aa00120f63656e747265646573757361676573c0bfc00c000c0001000008aa001e1b786e2d2d66726465726d697474656c72617467656265722d713662c201c00c000c0001000008aa000b06666c6578676f02757300c00c000c0001000008aa00120d726573706f6e7365706f696e7402736500c00c000c0001000008aa0007046f727063cb26c00c000c0001000008aa001512696e666f726d61736a6f6e7373797374656dcc27c00c000c0001000008aa001109666f726566726f6e7402636f026b7200c00c000c0001000008aa00130a6f66666963653230303703636f6d02627200c00c000c0001000008aa000e0977696e646f7773787002626900c00c000c0001000008aa00252277696e646f7773647269766572646576656c6f706d656e74636f6e666572656e6365c04ac00c000c0001000008aa001310666f726f706572737065637469766173c04ac00c000c0001000008aa000a077061726c616e6fc04ac00c000c0001000008aa00110e696973646961676e6f7374696373c116c00c000c0001000008aa000906617a7572696bc0bfc00c000c0001000008aa000c09696e73656775726f73c04ac00c000c0001000008aa000e0977696e646f77737870026b6700c00c000c0001000008aa000e0977696e646f7773787002636700c00c000c0001000008aa00150e65766572796f6e65676574736974036e6574c7cfc00c000c0001000008aa000d0a636f686f77696e657279c04ac00c000c0001000008aa00120f6d797374617274757063656e746572c04ac00c000c0001000008aa001714706c75736465343030646966666572656e636573c54cc00c000c0001000008aa00100d726573706f6e7365706f696e74c0bfc00c000c0001000008aa0015126c6573646f6967747364616e736c656e657ac158c00c000c0001000008aa000c0970726f736577617265c116c00c000c0001000008aa000e0b6374726f70656e6f726d65c04ac00c000c0001000008aa000c0970726f736577617265c04ac00c000c0001000008aa000f0c77696e646f77732d32303030c84bc00c000c0001000008aa00120f696d70726f7665616e616c79736973c04ac00c000c0001000008aa000c09666f726566726f6e74c1c4c00c000c0001000008aa00191664656375706c657a766f747265706f74656e7469656cc04ac00c000c0001000008aa001a17686572617573666f72646572756e67736d656973746572c201c00c000c0001000008aa001411627033666f726772656174706c61696e73c04ac00c000c0001000008aa00120f696d6167696e65726c617375697465c04ac00c000c0001000008aa00120f696d6167696e65726c617375697465c158c00c000c0001000008aa00100d726573706f6e7365706f696e74c59cc00c000c0001000008aa000d0a77696e7465726e616c73c04ac00c000c0001000008aa0009046575676102677200c00c000c0001000008aa000e0b6374726f70656e6f726d65c116c00c000c0001000008aa001411756b636f6d6d756e697479617761726473c0bfc00c000c0001000008aa0015126c6573646f6967747364616e736c656e657ac0bfc00c000c0001000008aa0009066f6666726573d967c00c000c0001000008aa00100d6f70656e74797065666f72756dc04ac00c000c0001000008aa00100d726573706f6e7365706f696e74da48c00c000c0001000008aa00150d726573706f6e7365706f696e7402636f02696c00c00c000c0001000008aa001916656e68616e6365796f757270656f706c656173736574c04ac00c000c0001000008aa0015126d6963726f736f6674666f726566726f6e74c951c00c000c0001000008aa0015126d6963726f736f6674666f726566726f6e74c21dc00c000c0001000008aa00100d63696f2d636f6d6d756e697479c085c00c000c0001000008aa0015126d6963726f736f6674666f726566726f6e74c580c00c000c0001000008aa0013106a656465722d686174732d6472617566c0bfc00c000c0001000008aa001815666f65726465726d697474656c7261746765626572c201c00c000c0001000008aa000c09626570636c6567616cc116c00c000c0001000008aa0019166d69677265727665727376697375616c73747564696fc0bfc00c000c0001000008aa000f0c6270666f72736f6c6f6d6f6ec04ac00c000c0001000008aa0019166f6666696365706f75726c65736574756469616e7473c0bfc00c000c0001000008aa00100d627033666f72736f6c6f6d6f6ec04ac00c000c0001000008aa00090669746865726fd6e4c00c000c0001000008aa0014116d6f62696c657063646576656c6f706572c0bfc00c000c0001000008aa000b08706f636b65747063c116c00c000c0001000008aa001512636f6e666f726d6974656c6963656e636573c116c00c000c0001000008aa000c096576726f706c616e6fda48c00c000c0001000008aa001a17636c756270617274656e61697265737365727669636573c0bfc00c000c0001000008aa001c19647269766572646576656c6f706572636f6e666572656e6365c116c00c000c0001000008aa00171467702d636f6d706c69616e636577656263617374c04ac00c000c0001000008aa000e0b7061636b746f7574656e31c0bfc00c000c0001000008aa0019166c65732d646f696774732d64616e732d6c652d6e657ac04ac00c000c0001000008aa001109686f77746f74656c6c02636f026e7a00c00c000c0001000008aa001e1b647269766572646576656c6f706d656e74636f6e666572656e6365c04ac00c000c0001000008aa0015126d6963726f736f6674666f726566726f6e74d696c00c000c0001000008aa000e0b7061636b746f7574656e31c116c00c000c0001000008aa001512636f6e666f726d6974656c6963656e636573c04ac00c000c0001000008aa000b0877696e646f777870c39fc00c000c0001000008aa0015126d6963726f736f6674666f726566726f6e74c531c00c000c0001000008aa001613736d61727470686f6e65636f6d6d756e697479c04ac00c000c0001000008aa001e1b647269766572646576656c6f706d656e74636f6e666572656e6365c116c00c000c0001000008aa000f0c6d6f6e6e6f7576656c616d69c116c00c000c0001000008aa000f0c7061636b746f7574656e756ec0bfc00c000c0001000008aa00110e65766572796f6e65676574736974c54cc00c000c0001000008aa00100d77696e646f77736d6f62696c65d696c00c000c0001000008aa001b126d6963726f736f6674666f726566726f6e7403636f6d02747700c00c000c0001000008aa00120f6d73646e746563686e6574746f7572c04ac00c000c0001000008aa00120977696e646f77737870036f726702747000c00c000c0001000008aa00120f6f6e6c696e6573706f746c69676874c0bfc00c000c0001000008aa00100d6c6573626f6e736f7574696c73c116c00c000c0001000008aa000a076f6e6d79776179cb26c00c000c0001000008aa000c09696f2d6d6f64656c6cc201c00c000c0001000008aa000a076f6e6563617265c04ac00c000c0001000008aa00110e726973656f667065726174686961c04ac00c000c0001000008aa000f0c636c7562706f636b65747063c04ac00c000c0001000008aa001a176d6963726f736f66742d6272616e6368656e766964656fc201c00c000c0001000008aa0009066370616e646cc04ac00c000c0001000008aa0015126d6963726f736f6674666f726566726f6e74c0bfc00c000c0001000008aa0013106a656465722d686174732d6472617566c116c00c000c0001000008aa000c096f6e6d79776179756bc04ac00c000c0001000008aa000a07636f6e746f736fc04ac00c000c0001000008aa000b086e61766973696f6ec085c00c000c0001000008aa0014116361702d7375722d6c652d737563636573c0bfc00c000c0001000008aa000c09696e73656775726f73c0bfc00c000c0001000008aa00141164656679616c6c6368616c6c656e676573c1c4c00c000c0001000008aa000c096c6561726e32617370c116c00c000c0001000008aa00100d66696e656172747363686f6f6cc116c00c000c0001000008aa00110e646f776e6c6f616467726f6f7665c04ac00c000c0001000008aa0015126d6963726f736f6674666f726566726f6e74d702c00c000c0001000008aa000f0c7061636b746f7574656e756ec04ac00c000c0001000008aa0009066370616e646cc0bfc00c000c0001000008aa0015126d6963726f736f6674666f726566726f6e74c52dc00c000c0001000008aa00120f646566726167636f6d6d616e646572c04ac00c000c0001000008aa0015126d6963726f736f6674666f726566726f6e74c39fc00c000c0001000008aa001a17636c756270617274656e61697265737365727669636573c04ac00c000c0001000008aa0023206d6f6465726e65722d76657277616c74756e677361726265697473706c61747ac201c00c000c0001000008aa0015126d6963726f736f6674666f726566726f6e74c085c00c000c0001000008aa000c09666f726566726f6e74c39fc00c000c0001000008aa0013106a656465722d686174732d6472617566c04ac00c000c0001000008aa00100d77696e646f77736d6f62696c65c531c00c000c0001000008aa00110e65766572796f6e65676574736974c580c00c000c0001000008aa00131074686570686f6e652d636f6d70616e79c04ac00c000c0001000008aa00110e646f776e6c6f616467726f6f7665c116c00c000c0001000008aa0015126c6573646f6967747364616e736c656e657ac116c00c000c0001000008aa0014116d616e6167656669786564617373657473c04ac00c000c0001000008aa000c09707261786973746167c085c00c000c0001000008aa00150e65766572796f6e65676574736974036f7267c583c00c000c0001000008aa0015126f666672652d65626c6f75697373616e7465c04ac00c000c0001000008aa000c09697462727565636b65c04ac00c000c0001000008aa0014116d616e6167656669786564617373657473c0bfc00c000c0001000008aa000f0c6d6963726f736f6674646f70c116c00c000c0001000008aa000e0b77696e646f777332303030c2f0c00c000c0001000008aa0015126d6963726f736f6674666f726566726f6e74cc27c00c000c0001000008aa0016136e6f74666f7270726f66697473656d696e6172c04ac00c000c0001000008aa00120f696d6167696e657a6c617375697465c116c00c000c0001000008aa00100d726573706f6e7365706f696e74d6e4c00c000c0001000008aa000c09666f726566726f6e74df83c00c000c0001000008aa0013106e6f72746877696e6474726164657273c04ac00c000c0001000008aa00100d77696e646f77736d6f62696c65c201c00c000c0001000008aa00131069697377656263617374736572696573c0bfc00c000c0001000008aa001815636f6e736f6c6964617465646d657373656e676572c04ac00c000c0001000008aa00120d726573706f6e7365706f696e7402636300c00c000c0001000008aa0014116d616e6167656669786564617373657473c116c00c000c0001000008aa000e0977696e646f7773787002766300c00c000c0001000008aa00100d646f746e657465787065727473c2f0c00c000c0001000008aa00110e6a65646572686174736472617566c0bfc00c000c0001000008aa000f0c6e636f6d706173736c616273c04ac00c000c0001000008aa00110e65766572796f6e65676574736974c201c00c000c0001000008aa000d0a6c697477617265696e63c116c00c000c0001000008aa0021066f666672657317656e7472657072656e6575722d73757065726865726f73c04ac00c000c0001000008aa0015126d6963726f736f6674666f726566726f6e74d6e4c00c000c0001000008aa00100d72656e636f6e7472652d333630c116c00c000c0001000008aa000e0b6d756e63686f6e74686973c0bfc00c000c0001000008aa0015126d6963726f736f6674666f726566726f6e74df83c00c000c0001000008aa00120f696d6167696e657a6c617375697465c04ac00c000c0001000008aa0015126d6963726f736f6674666f726566726f6e74c0fcc00c000c0001000008aa00100d77696e646f77736e7432303030c0bfc00c000c0001000008aa000f0c6d6f6e2d7061636b2d70726fc04ac00c000c0001000008aa00110e646f776e6c6f616467726f6f7665c0bfc00c000c0001000008aa000c09646f742d7472757468c04ac00c000c0001000008aa00100d6465667261676d616e61676572c04ac00c000c0001000008aa000c0965727073797374656dcc27c00c000c0001000008aa00161372656c65766572746f75736c65736465666973c04ac00c000c0001000008aa0015126d6963726f736f6674666f726566726f6e74c04ac00c000c0001000008aa0013106f66667265732d6d6963726f736f6674c0bfc00c000c0001000008aa000c076f6e6d7977617902666900c00c000c0001000008aa000f0c746563686461797332303038c0bfc00c000c0001000008aa000906637368617270c116c00c000c0001000008aa0015126f666672652d65626c6f75697373616e7465c116c00c000c0001000008aa000906666c6578676fc158c00c000c0001000008aa0015126d737368617265706f696e74666f72756d73c0bfc00c000c0001000008aa000e0b6c6f6f6b6f7574736f6674c04ac00c000c0001000008aa001b126d6963726f736f6674666f726566726f6e7403636f6d02617200c00c000c0001000008aa0009066370616e646cc116c00c000c0001000008aa00120f6d7977696e646f77736d6f62696c65df7fc00c000c0001000008aa000c09706f636b65746d736ec580c00c000c0001000008aa00120f6f6e6c696e6573706f746c69676874c04ac00c000c0001000008aa000d0a6f666669636532303037c96bc00c000c0001000008aa001815636f6e736f6c6964617465646d657373656e676572c0bfc00c000c0001000008aa001a1777696e646f77736d6f62696c65636f6d6d6d756e697479c0bfc00c000c0001000008aa00201d6f6666696365736d616c6c627573696e6573736163636f756e74696e67c04ac00c000c0001000008aa00120f696d6167696e65726c617375697465c0bfc00c000c0001000008aa000b086e636f6d70617373c04ac00c000c0001000008aa00181577696e646f7773616e7974696d6575706772616465c04ac00c000c0001000008aa000e0b77696e646f777332303036cb07c00c000c0001000008aa0015126d6963726f736f6674666f726566726f6e74dde0c00c000c0001000008aa001411657874656e646572736d6172746c697374c04ac00c000c0001000008aa00110e646973636f766572746563686564c04ac00c000c0001000008aa0017126d6963726f736f6674666f726566726f6e74026a7000c00c000c0001000008aa0014116c756365726e657075626c697368696e67c0bfc00c000c0001000008aa0015126d6963726f736f6674666f726566726f6e74d22dc00c000c0001000008aa000b0872656d69782d3038c04ac00c000c0001000008aa00232077696e646f7773647269766572646576656c6f706572636f6e666572656e6365c116c00c000c0001000008aa00100d6f666669636572656164797063cb26c00c000c0001000008aa00110e6d6963726f736f66746174636573c04ac00c000c0001000008aa0017126d6963726f736f6674666f726566726f6e7402696500c00c000c0001000008aa000c09666f726566726f6e74cf52c00c000c0001000008aa000f0c666f75727468636f66666565c116c00c000c0001000008aa00120f6d7977696e646f77736d6f62696c65c06ac00c000c0001000008aa00100d6c6573626f6e736f7574696c73c04ac00c000c0001000008aa0015126d6963726f736f6674666f726566726f6e74c1c4c00c000c0001000008aa00110e6d6963726f736f667468656c7073c04ac00c000c0001000008aa001c196d6963726f736f6674627573696e6573737365637572697479c085c00c000c0001000008aa00100d776f6f6467726f766562616e6bc0bfc00c000c0001000008aa0014116c756365726e657075626c697368696e67c116c00c000c0001000008aa000f0c666f75727468636f66666565c0bfc00c000c0001000008aa0015126d6963726f736f6674666f726566726f6e74c7cbc00c000c0001000008aa000f0c636f686f76696e6579617264c116c00c000c0001000008aa000f0c6d6963726f736f6674646f70c0bfc00c000c0001000008aa000e0b77696e646f777372756279d696c00c000c0001000008aa000f086d736d6f62696c6504696e666f00c00c000c0001000008aa0015126d6963726f736f6674666f726566726f6e74c54cc00c000c0001000008aa00140d6d6f62696c65326d61726b6574046d6f626900c00c000c0001000008aa0015126d6963726f736f6674666f726566726f6e74d678c00c000c0001000008aa000e0b6d756e63686f6e74686973c04ac00c000c0001000008aa000b086370616475766f6cc116c00c000c0001000008aa000e0b70726f746563746d797063dde0c00c000c0001000008aa00161372656c65766572746f75736c65736465666973c116c00c000c0001000008aa00191677696e646f77736d6f62696c65636f6d6d756e697479c0bfc00c000c0001000008aa00120f736572766572756e6c656173686564c0bfc00c000c0001000008aa000b08706f636b65747063c04ac00c000c0001000008aa000f0c746563686461797332303038c04ac00c000c0001000008aa000d0a64697265637462616e64c04ac00c000c0001000008aa001b1877696e646f7773647269766572646576656c6f706d656e74c04ac00c000c0001000008aa000f0c647269766572646576636f6ec0bfc00c000c0001000008aa00191672657461696c65786563757469766573656d696e6172c0bfc00c000c0001000008aa000d0a77696e7465726e616c73c0bfc00c000c0001000008aa0019166c7574746572636f6e7472656c657069726174616765c04ac00c000c0001000008aa000b0877696e646f777870c432c00c000c0001000008aa001613736d61727470686f6e65636f6d6d756e697479c116c00c000c0001000008aa000b086d6170706f696e74c116c00c000c0001000008aa000d0a6c697477617265696e63c0bfc00c000c0001000008aa0019166772617068696364657369676e696e73746974757465c116c00c000c0001000008aa000b086d6163746f706961c04ac00c000c0001000008aa0015126d6963726f736f6674666f726566726f6e74cf56c00c000c0001000008aa0015126d737368617265706f696e74666f72756d73c116c00c000c0001000008aa000e0b746f726b74686567616d65c04ac00c000c0001000008aa0019166c65732d646f696774732d64616e732d6c652d6e657ac0bfc00c000c0001000008aa0015126d737368617265706f696e74666f72756d73c04ac00c000c0001000008aa00100d70726f74656374796f75727063dde0c00c000c0001000008aa0015127465636e6f6c6f67696179656d7072657361c0bfc00c000c0001000008aa00120f6d73646e746563686e6574746f7572c116c00c000c0001000008aa00100d72657461696c77656263617374c04ac00c000c0001000008aa00120f736f7574687269646765766964656fc116c00c000c0001000008aa000e0b63616d70757367616d6573c54cc00c000c0001000008aa001613636f6e666f726d6974652d6c6963656e636573c04ac00c000c0001000008aa0015127465636e6f6c6f67696179656d7072657361c04ac00c000c0001000008aa0015126d6963726f736f6674666f726566726f6e74c347c00c000c0001000008aa001a1777696e646f77736d6f62696c65636f6d6d6d756e697479c116c00c000c0001000008aa000e0b77696e67746970746f7973c116c00c000c0001000008aa000d0a6f666669636532303037c04ac00c000c0001000008aa0019166c7574746572636f6e7472656c657069726174616765c116c00c000c0001000008aa00100d72656e636f6e74726573333630c0bfc00c000c0001000008aa001512746865736572766572756e6c656173686564c116c00c000c0001000008aa00120f6d6963726f736f66746d6f62696c65cb07c00c000c0001000008aa00120f6d73646e746563686e6574746f7572c0bfc00c000c0001000008aa00100d77696e646f77736d6f62696c65d6e4c00c000c0001000008aa000f0c7061636b746f7574656e756ec116c00c000c0001000008aa00150c77696e646f7773766973746103636f6d02747200c00c000c0001000008aa00100d6d6f62696c65326d61726b6574c04ac00c000c0001000008aa00120f63656e747265646573757361676573c04ac00c000c0001000008aa00100b77696e646f77733230303002736b00c00c000c0001000008aa00100d77696e646f77736d6f62696c65c580c00c000c0001000008aa000b087465636865643036c04ac00c000c0001000008aa001815636f686f76696e6579617264616e6477696e657279c0bfc00c000c0001000008aa000f0c657264636f6d6d616e646572c04ac00c000c0001000008aa0015127465636e6f6c6f67696179656d7072657361c116c00c000c0001000008aa000f0c747265797265736561726368c0bfc00c000c0001000008aa00181170696374757265697470726f6475637473036d736ec04ac00c000c0001000008aa00100d776f6f6467726f766562616e6bc116c00c000c0001000008aa000805776d766864c04ac00c000c0001000008aa0013106f66667265732d6d6963726f736f6674c116c00c000c0001000008aa00120f63656e747265646573757361676573c116c00c000c0001000008aa00100977696e646f77736e74046e616d6500c00c000c0001000008aa000a0777696e646f7773c116c00c000c0001000008aa001310746f646f736c6f656e7469656e64656ec04ac00c000c0001000008aa00161372656c6576657a746f75736c65736465666973c158c00c000c0001000008aa00141164656679616c6c6368616c6c656e676573c347c00c000c0001000008aa000e0b6374726f70656e6f726d65c0bfc00c000c0001000008aa00100977696e646f77736e740367656ec678c00c000c0001000008aa000d0a636f686f77696e657279c0bfc00c000c0001000008aa00120f6c6f67697374696b6b73797374656dcc27c00c000c0001000008aa00110977696e646f7773787002707002617a00c00c000c0001000008aa000c0970726f736577617265c0bfc00c000c0001000008aa00110e6a65646572686174736472617566c04ac00c000c0001000008aa000d0a6c696e7465726e616c73c04ac00c000c0001000008aa0014116d6f62696c657063646576656c6f706572c116c00c000c0001000008aa00151277696e646f7773656d6265646465646b6974c04ac00c000c0001000008aa000f0c76697375616c73747564696fc116c00c000c0001000008aa000e0b77696e646f77736c6f676fc116c00c000c0001000008aa000d0a77696e7465726e616c73cb07c00c000c0001000008aa00252272656e636f6e747265732d636f6c6c6563746976697465732d6d6963726f736f6674c04ac00c000c0001000008aa000a0769742d6865726fd6e4c00c000c0001000008aa000a0777696e646f7773cc27c00c000c0001000008aa000d0a6c697477617265696e63c04ac00c000c0001000008aa000b086370616475766f6cc04ac00c000c0001000008aa00120f6d7977696e646f77736d6f62696c65cc9fc00c000c0001000008aa001c196d6963726f736f66746c6963656e736573746174656d656e74c04ac00c000c0001000008aa000a0772656d69783038c0bfc00c000c0001000008aa000d0a77696e7465726e616c73c201c00c000c0001000008aa001310746563686e65746368616c6c656e6765c04ac00c000c0001000008aa000a076e746673646f73c04ac00c000c0001000008aa001310746f646f736c6f656e7469656e64656ec0bfc00c000c0001000008aa00130e73707261766e6f75636573746f7502637a00c00c000c0001000008aa0019166c65732d646f696774732d64616e732d6c652d6e657ac116c00c000c0001000008aa00100d6d6963726f736f6674686f6d65c54cc00c000c0001000008aa000e0b7061636b746f7574656e31c04ac00c000c0001000008aa001916666f65726465726d697474656c2d7261746765626572c201c00c000c0001000008aa000d0a77696e7465726e616c73c580c00c000c0001000008aa00161372656c6576657a746f75736c65736465666973c54cc00c000c0001000008aa00100d6d6f62696c65326d61726b6574c32dc00c000c0001000008aa00252277696e646f7773647269766572646576656c6f706d656e74636f6e666572656e6365c0bfc00c000c0001000008aa00120977696e646f77736e74036f726702627a00c00c000c0001000008aa00100d72656e636f6e7472652d333630c04ac00c000c0001000008aa00110e6d6963726f736f667468656c7073c54cc00c000c0001000008aa00232077696e646f7773647269766572646576656c6f706572636f6e666572656e6365c04ac00c000c0001000008aa0019166772617068696364657369676e696e73746974757465c0bfc00c000c0001000008aa0019166d69677265727665727376697375616c73747564696fc04ac00c000c0001000008aa000f0c6d736f666669636532303037c1c4c00c000c0001000008aa00120f63656e747265646573757361676573c158c00c000c0001000008aa00252277696e646f7773647269766572646576656c6f706d656e74636f6e666572656e6365c116c00c000c0001000008aa00110c77696e646f7773766973746102626700c00c000c0001000008aa000c0977696e646f77733938f3fac00c000c0001000008aa00120f6d6963726f736f66746d6f62696c65edf7c00c000c0001000008aa00120f736f7574687269646765766964656fc0bfc00c000c0001000008aa0016136f666672652d65626c6f75697373616e746573c04ac00c000c0001000008aa000f0c746564736c656d6f6e616964c04ac00c000c0001000008aa000e0b6e69676874636173746572c04ac00c000c0001000008aa00110e6d6f62696c6574656368746f7572c0bfc00c000c0001000008aa00100977696e646f77736e74036e6574c0fcc00c000c0001000008aa00100d6f70656e74797065666f72756dc116c00c000c0001000008aa000c09776861636b65647476c04ac00c000c0001000008aa000f0c6d6963726f736f6674646f70c04ac00c000c0001000008aa000c0977696e646f77736e74c4edc00c000c0001000008aa00100d77696e646f77736d6f62696c65c1c4c00c000c0001000008aa000c0977696e646f77737870c436c00c000c0001000008aa001b1877696e646f7773647269766572646576656c6f706d656e74c116c00c000c0001000008aa000b086263656e7472616cc54cc00c000c0001000008aa00151277696465776f726c64696d706f7274657273c04ac00c000c0001000008aa000c097374756f73626f726ec0bfc00c000c0001000008aa000f0c7461696c7370696e746f7973c04ac00c000c0001000008aa0013106d616b656f7665726d796f6666696365c04ac00c000c0001000008aa000d0a6d7366746d6f62696c65c116c00c000c0001000008aa0015126c6573646f6967747364616e736c656e657ac04ac00c000c0001000008aa0015126d6963726f736f6674666f726566726f6e74c06ac00c000c0001000008aa0015126d6963726f736f6674666f726566726f6e74c678c00c000c0001000008aa00161372656c6576657a746f75736c65736465666973c04ac00c000c0001000008aa00100d6d73646e6368616c6c656e6765c04ac00c000c0001000008aa0019166f6666696365706f75726c65736574756469616e7473c116c00c000c0001000008aa00120f736f7574687269646765766964656fc04ac00c000c0001000008aa00191672657461696c65786563757469766573656d696e6172c116c00c000c0001000008aa00110e6d6f62696c657365727669636573edf7c00c000c0001000008aa001307776562686f7374086e61766973696f6ec04ac00c000c0001000008aa00100d726573706f6e7365706f696e74f3a0c00c000c0001000008aa00120b7a65726f76697275736573036f7267dde3c00c000c0001000008aa00120f6d7977696e646f77736d6f62696c65c347c00c000c0001000008aa0016136f666672652d65626c6f75697373616e746573c116c00c000c0001000008aa00100d77696e646f77736d6f62696c65df83c00c000c0001000008aa0015126d6f62696c657063646576656c6f70657273c0bfc00c000c0001000008aa00100977696e646f77736e7403636f6df9cec00c000c0001000008aa000d0a77696e7465726e616c73c116c00c000c0001000008aa00100d747670686f746f766965776572c04ac00c000c0001000008aa00191677696e646f77736d6f62696c65636f6d6d756e697479c04ac00c000c0001000008aa00100b77696e646f77737275627902766e00c00c000c0001000008aa00100d6d6f62696c6564657669636573edf7c00c000c0001000008aa000f0c746563686564626f73746f6ec04ac00c000c0001000008aa00110e6d6f62696c6574656368746f7572c04ac00c000c0001000008aa00100d74617675746174726f6e636865c04ac00c000c0001000008aa00110e706179726f6c6c77656263617374c04ac00c000c0001000008aa00100d776577616e7474686562657374c04ac00c000c0001000008aa00151277696465776f726c64696d706f7274657273c0bfc00c000c0001000008aa001a1777696e646f77736d6f62696c65636f6d6d6d756e697479c04ac00c000c0001000008aa001c196d6963726f736f66746c6963656e736573746174656d656e74c54cc00c000c0001000008aa0015126d6963726f736f6674697461636164656d79c04ac00c000c0001000008aa00100d72656e636f6e7472652d333630c0bfc00c000c0001000008aa000c0977696e646f77737870c30ec00c000c0001000008aa000c0977696e646f77736e74c7a8c00c000c0001000008aa0015126d6963726f736f6674666f726566726f6e74cb26c00c000c0001000008aa000e0b77696e67746970746f7973c04ac00c000c0001000008aa001613737570706f727477696e646f77737669737461c158c00c000c0001000008aa0013106e6f72746877696e6474726164657273c0bfc00c000c0001000008aa00232077696e646f7773647269766572646576656c6f706572636f6e666572656e6365c0bfc00c000c0001000008aa000e0b76796b6b6572736c616273c04ac00c000c0001000008aa0015126d6963726f736f6674666f726566726f6e74c18bc00c000c0001000008aa000f0c747265797265736561726368c116c00c000c0001000008aa000c09746563686564766970c04ac00c000c0001000008aa00191677696e646f77736d6f62696c65636f6d6d756e697479c116c00c000c0001000008aa000e0b74696d6534746563686564c04ac00c000c0001000008aa000f0c72656e636f6e747265333630c0bfc00c000c0001000008aa0014116d6963726f736f6674736d616c6c62697ac04ac00c000c0001000008aa00191677696e646f7773647269766572646576656c6f706572c116c00c000c0001000008aa0014116d616e616765636f6c6c656374696f6e73c04ac00c000c0001000008aa000b086263656e7472616cc531c00c000c0001000008aa00100d706f776572746f676574686572c04ac00c000c0001000008aa00191677696e646f7773647269766572646576656c6f706572c04ac00c000c0001000008aa000a077265736b697473c04ac00c000c0001000008aa0015126d6963726f736f6674666f726566726f6e74c201c00c000c0001000008aa00161377696e7465726e616c737265736f7572636573c04ac00c000c0001000008aa000c0977696e646f77736e74f3fac00c000c0001000008aa00100977696e646f77736e74036f7267cc81c00c000c0001000008aa0015126d6963726f736f6674666f726566726f6e74e8acc00c000c0001000008aa00230e64657369676e6564666f726269670264650e64657369676e6564666f72626967c201c00c000c0001000008aa00141164656679616c6c6368616c6c656e676573c7cbc00c000c0001000008aa000e0977696e646f7773787002676d00c00c000c0001000008aa00151277696e7465726e616c73736f667477617265c04ac00c000c0001000008aa00151277696465776f726c64696d706f7274657273c116c00c000c0001000008aa000e0b77696e646f777372756279ec43c00c000c0001000008aa000a0772656d69783038c116c00c000c0001000008aa000f0c6d61696e66756e6374696f6ec04ac00c000c0001000008aa000d0a7374756f73626f726e65c04ac00c000c0001000008aa000f0c6f666669636573797374656ddde0c00c000c0001000008aa001e1b6d6963726f736f66742d627573696e6573732d7365637572697479c085c00c000c0001000008aa000e0b77696e646f777372756279c201c00c000c0001000008aa000b0872656d69782d3038c116c00c000c0001000008aa00120f7265616c6d656e74656772616e6465c04ac00c000c0001000008aa0008056d73657070c04ac00c000c0001000008aa00100d77696e646f77736d6f62696c65df7fc00c000c0001000008aa00110e72656e636f6e747265732d333630c116c00c000c0001000008aa00100977696e646f77736e74036e6574f656c00c000c0001000008aa00100d7374756f73626f726e73686f77c04ac00c000c0001000008aa0018156d6963726f736f66746269636f6e666572656e6365c04ac00c000c0001000008aa000b0877696e646f777870d804c00c000c0001000008aa000e0b696e6e6f766174652d756bc116c00c000c0001000008aa00141164656679616c6c6368616c6c656e676573d696c00c000c0001000008aa0015126d6963726f736f6674666f726566726f6e74c116c00c000c0001000008aa00100977696e646f77736e74036e6574f9cec00c000c0001000008aa00160f65756772616e747361647669736f7203636f6dda48c00c000c0001000008aa00120f696d6167696e65726c617375697465c116c00c000c0001000008aa00120f736572766572756e6c656173686564c116c00c000c0001000008aa00110e64657369676e6564666f72626967cc27c00c000c0001000008aa000e0b667278736f667477617265c04ac00c000c0001000008aa000f0c6d6f6e2d7061636b2d70726fc0bfc00c000c0001000008aa000d0a73686172656476696577c04ac00c000c0001000008aa00110977696e646f77736e7402636f02637200c00c000c0001000008aa000e0b77696e646f777372756279c085c00c000c0001000008aa00140c77696e646f7773766973746102636f02696400c00c000c0001000008aa00141164656679616c6c6368616c6c656e676573c2f0c00c000c0001000008aa00110e676174656b656570657274657374c2f0c00c000c0001000008aa000e0b77696e646f777372756279c18bc00c000c0001000008aa000e0b66616d696c797761766573c54cc00c000c0001000008aa00120f6f6e6c696e6573706f746c69676874c116c00c000c0001000008aa00120f65756772616e747361647669736f72f8a8c00c000c0001000008aa000b06666c6578676f026d7000c00c000c0001000008aa001613696d706f737369626c65637265617475726573c54cc00c000c0001000008aa00170f65756772616e747361647669736f7202636f02687500c00c000c0001000008aa000c0977696e646f77736e74c7e9c00c000c0001000008aa000906666c6578676fec43c00c000c0001000008aa00120f65756772616e747361647669736f72da48c00c000c0001000008aa000e0b77696e646f777372756279c951c00c000c0001000008aa00120f6d7977696e646f77736d6f62696c65c54cc00c000c0001000008aa00110e64657369676e6564666f72626967ec43c00c000c0001000008aa0015126f666672652d65626c6f75697373616e7465c0bfc00c000c0001000008aa00100977696e646f77737870036f7267c436c00c000c0001000008aa000b0872656d69782d3038c0bfc00c000c0001000008aa000e0977696e646f77737870026e6600c00c000c0001000008aa00191672657461696c65786563757469766573656d696e6172c04ac00c000c0001000008aa000b086d6163746f706961c116c00c000c0001000008aa00100d6d6f62696c6564657669636573cb07c00c000c0001000008aa000a0773776175646974f3fac00c000c0001000008aa00110e726973656f667065726174686961c0bfc00c000c0001000008aa00252272656e636f6e747265732d636f6c6c6563746976697465732d6d6963726f736f6674c116c00c000c0001000008aa00141177696e646f777373657276657232303038c0fcc00c000c0001000008aa000c096d73706172746e6572c04ac00c000c0001000008aa00110e6f66667265732d656e6f726d6573c04ac00c000c0001000008aa00100d74617675746174726f6e636865c0bfc00c000c0001000008aa00100d6d61726769657374726176656cc04ac00c000c0001000008aa00120f65756772616e747361647669736f72e429c00c000c0001000008aa00161372656c6576657a746f75736c65736465666973c0bfc00c000c0001000008aa000d0a74656368656474696d65c04ac00c000c0001000008aa0019166d6963726f736f667464656d616e64706c616e6e6572c04ac00c000c0001000008aa000e0b77696e646f77736c6f676fc04ac00c000c0001000008aa001a176d6963726f736f6674627573696e657373617761726473c04ac00c000c0001000008aa00130b77696e646f77737275627902636f027a6100c00c000c0001000008aa00110c77696e646f77737669737461026e7500c00c000c0001000008aa00171477696e646f7773787067616d6561647669736f72c04ac00c000c0001000008aa00100d747670686f746f766965776572c59cc00c000c0001000008aa00110e64657369676e6564666f72626967c32dc00c000c0001000008aa000f0c77696e7465726e616c736573c04ac00c000c0001000008aa0015126d6963726f736f6674666f726566726f6e74c84bc00c000c0001000008aa000f0c6e666c666576657232303032c04ac00c000c0001000008aa00100d726573706f6e7365706f696e74c65fc00c000c0001000008aa00140f65756772616e747361647669736f7202656500c00c000c0001000008aa000b086e636f6d70617373c54cc00c000c0001000008aa001512746865736572766572756e6c656173686564c04ac00c000c0001000008aa000b06666c6578676f02687400c00c000c0001000008aa00161372656c6576657a746f75736c65736465666973c116c00c000c0001000008aa00110e72657475726e746f746563686564c04ac00c000c0001000008aa00100977696e646f77736e7403636f6dc7edc00c000c0001000008aa000e0b77696e646f777372756279da48c00c000c0001000008aa000e0b77696e646f777372756279c82bc00c000c0001000008aa00130b77696e646f77737275627902636f02687500c00c000c0001000008aa000d0a65737469656d706f6465c0bfc00c000c0001000008aa00110e676174656b656570657274657374c085c00c000c0001000008aa00131074686570686f6e652d636f6d70616e79c0bfc00c000c0001000008aa00120f6865726f7368617070656e68657265dde0c00c000c0001000008aa00100b77696e646f77737275627902616500c00c000c0001000008aa00100977696e646f7773787003636f6dc456c00c000c0001000008aa00161372656c65766572746f75736c65736465666973c0bfc00c000c0001000008aa000f0c75732d6d6963726f736f6674c04ac00c000c0001000008aa0017147669737461666f72796f7572627573696e657373c04ac00c000c0001000008aa000f0c746563686d616b656f766572dde0c00c000c0001000008aa00100977696e646f777378700362697ac0fcc00c000c0001000008aa001b03777777146d6963726f736f6674737570706c79636861696ec04ac00c000c0001000008aa00120977696e646f777378700377656202746a00c00c000c0001000008aa000b0877696e646f777870cc61c00c000c0001000008aa00120f65756772616e747361647669736f72cc27c00c000c0001000008aa000906666c6578676fd6e4c00c000c0001000008aa00110e667574757265706f73746d61696cc116c00c000c0001000008aa000c097374756f73626f726ec116c00c000c0001000008aa0014116d6963726f736f667464796e616d696373c158c00c000c0001000008aa00110e72656e636f6e747265732d333630c0bfc00c000c0001000008aa00100d726973656f666e6174696f6e73c54cc00c000c0001000008aa0009067265736b6974c04ac00c000c0001000008aa00160e64657369676e6564666f7262696702636f027a6100c00c000c0001000008aa000a07737570706f7274e66dc00c000c0001000008aa000f0877696e646f777870036f7267c436c00c000c0001000008aa001a176d6963726f736f6674627573696e657373617761726473c116c00c000c0001000008aa00131074686570686f6e652d636f6d70616e79c116c00c000c0001000008aa0009066d7377776870c04ac00c000c0001000008aa000e0b77696e646f777372756279e429c00c000c0001000008aa00110e64657369676e6564666f72626967c085c00c000c0001000008aa000a0774656d70757269c0bfc00c000c0001000008aa00110e64657369676e6564666f72626967c347c00c000c0001000008aa000e0977696e646f77736e7402636600c00c000c0001000008aa001310746f646f736c6f656e7469656e64656ec531c00c000c0001000008aa000b06666c6578676f02706b00c00c000c0001000008aa0015126d6963726f736f6674666f726566726f6e74cf52c00c000c0001000008aa000e0b77696e646f777372756279c96bc00c000c0001000008aa00151277656273746f72616765706172746e657273c04ac00c000c0001000008aa00120f65756772616e747361647669736f72c347c00c000c0001000008aa000d0a77696e7465726e616c73edf7c00c000c0001000008aa00120977696e646f7773787003636f6d02746a00c00c000c0001000008aa001411726576656e7565616e64657870656e7365c04ac00c000c0001000008aa00110e64657369676e6564666f72626967c21dc00c000c0001000008aa001411636f6e636572746d6f62696c656c697665c54cc00c000c0001000008aa00100d72656e636f6e74726573333630c116c00c000c0001000008aa00110e766973696f696e666f776f636865c201c00c000c0001000008aa000e0977696e646f77737870026d6400c00c000c0001000008aa00140f65756772616e747361647669736f7202736900c00c000c0001000008aa000e0b77696e646f777372756279d3f7c00c000c0001000008aa000f0c77696e696e7465726e616c73c04ac00c000c0001000008aa00100d68617a6d6173766976656d6173c04ac00c000c0001000008aa000b086263656e7472616cc201c00c000c0001000008aa001512746865736572766572756e6c656173686564c0bfc00c000c0001000008aa0013106865726f657368617070656e68657265dde0c00c000c0001000008aa000a0772656d69783038c04ac00c000c0001000008aa001310746f646f736c6f656e7469656e64656ec116c00c000c0001000008aa00100977696e646f77736e74036f7267f656c00c000c0001000008aa0019166d69677265727665727376697375616c73747564696fc116c00c000c0001000008aa0015126d6963726f736f6674666f726566726f6e74c498c00c000c0001000008aa000c0977696e646f77737870cf52c00c000c0001000008aa000e0b696e6e6f766174652d756bc0bfc00c000c0001000008aa00100977696e646f7773787003636f6dc381c00c000c0001000008aa000c09766973696f32303033c201c00c000c0001000008aa000d0a796f7572746563686564c04ac00c000c0001000008aa00120b77696e646f77737275627903636f6dc951c00c000c0001000008aa00120977696e646f77736e7403636f6d026a6d00c00c000c0001000008aa00110e64657369676e6564666f72626967cb07c00c000c0001000008aa000e0b6d756e63686f6e74686973c116c00c000c0001000008aa00120f65756772616e747361647669736f72c531c00c000c0001000008aa00110e64657369676e6564666f72626967cb26c00c000c0001000008aa000d0a6d7366746d6f62696c65c0bfc00c000c0001000008aa000f0c746563686461797332303038c116c00c000c0001000008aa000906666c6578676fdb0ec00c000c0001000008aa00110e667574757265706f73746d61696cc04ac00c000c0001000008aa00171464657361666961746f646f736c6f737265746f73c04ac00c000c0001000008aa00120f65756772616e747361647669736f72c201c00c000c0001000008aa00100977696e646f7773787003636f6df656c00c000c0001000008aa001815636f686f76696e6579617264616e6477696e657279c116c00c000c0001000008aa00120b77696e646f77737275627903636f6dc39fc00c000c0001000008aa000d0877696e646f77787002686d00c00c000c0001000008aa00100d676f746f7779646f7072616379c0fcc00c000c0001000008aa000d0a6f666669636532303037c201c00c000c0001000008aa00110e64657369676e6564666f72626967c54cc00c000c0001000008aa000e0b77696e646f777372756279f8a8c00c000c0001000008aa000c09726166616574617469d702c00c000c0001000008aa00180f65756772616e747361647669736f7203636f6d02637900c00c000c0001000008aa00120f6d736163726f7373616d6572696361c04ac00c000c0001000008aa001613736d61727470686f6e65636f6d6d756e697479c0bfc00c000c0001000008aa000e0977696e646f7773787002727700c00c000c0001000008aa00120977696e646f777378700362697a02706b00c00c000c0001000008aa00110e64657369676e6564666f72626967c0bfc00c000c0001000008aa000d0a6672787265706f727473c04ac00c000c0001000008aa00110e72656e636f6e747265732d333630c04ac00c000c0001000008aa001411636f6e73756c746f72696f6f6666696365c531c00c000c0001000008aa000d06666c6578676f03636f6dffdec00c000c0001000008aa000e0b77696e646f777372756279dde0c00c000c0001000008aa00110c77696e646f7773766973746102697300c00c000c0001000008aa00141164656679616c6c6368616c6c656e676573c580c00c000c0001000008aa00100d7374756f73626f726e73686f77c116c00c000c0001000008aa00100d726573706f6e7365706f696e74c0fcc00c000c0001000008aa000e0b696e6e6f766174652d756bc04ac00c000c0001000008aa00120f65756772616e747361647669736f72c580c00c000c0001000008aa000d0a7369646577696e646572edf7c00c000c0001000008aa00120f6d6963726f73667473757266616365c04ac00c000c0001000008aa000e0b77696e646f777372756279c476c00c000c0001000008aa000e0977696e646f7773787002627300c00c000c0001000008aa00120f65756772616e747361647669736f72cb07c00c000c0001000008aa00110e64657369676e6564666f72626967d3f7c00c000c0001000008aa000d0877696e646f77787002746f00c00c000c0001000008aa00120f65756772616e747361647669736f72f3fac00c000c0001000008aa00120f65756772616e747361647669736f72d696c00c000c0001000008aa00110e7374756f73626f726e6573686f77c04ac00c000c0001000008aa00120f65756772616e747361647669736f72c2f0c00c000c0001000008aa000906747279696973c04ac00c000c0001000008aa00110e7374756f73626f726e6573686f77c116c00c000c0001000008aa00151273636174656e61696c74756f736572766572c1c4c00c000c0001000008aa00100d76697375616c2d73747564696fc04ac00c000c0001000008aa0016137072657373746865677265656e627574746f6ec116c00c000c0001000008aa000e0b77696e646f777372756279c2f0c00c000c0001000008aa000c0977696e646f77737870d35ac00c000c0001000008aa000b06666c6578676f02617300c00c000c0001000008aa000b086263656e7472616cc1c4c00c000c0001000008aa0015126e6261696e73696465647269766532303033c04ac00c000c0001000008aa00120977696e646f777378700362697a02746a00c00c000c0001000008aa00100977696e646f7773787003636f6dc2b5c00c000c0001000008aa00120f736572766572756e6c656173686564c04ac00c000c0001000008aa000c0977696e646f77737870c9c9c00c000c0001000008aa00221f6d6f6465726e657276657277616c74756e677361726265697473706c61747ac201c00c000c0001000008aa00090661747461696ecc27c00c000c0001000008aa00120977696e646f7773787003636f6d02627300c00c000c0001000008aa000906666c6578676fffdec00c000c0001000008aa000f0c77696e646f77737669737461f9cec00c000c0001000008aa00120f65756772616e747361647669736f72f3a0c00c000c0001000008aa000e0b77696e646f777332303030c04ac00c000c0001000008aa00120f65756772616e747361647669736f72c085c00c000c0001000008aa00110977696e646f7773787002636f02696d00c00c000c0001000008aa000c0977696e646f77737870fbe9c00c000c0001000008aa000e0977696e646f7773787002696f00c00c000c0001000008aa000906666c6578676fc96bc00c000c0001000008aa000d0a6f666669636532303037c158c00c000c0001000008aa001411636f6e73756c746f72696f6f6666696365c116c00c000c0001000008aa00120d726573706f6e7365706f696e7402616500c00c000c0001000008aa000e0b77696e646f777372756279c678c00c000c0001000008aa000e0b77696e646f777372756279c7cbc00c000c0001000008aa001512746f646f732d6c6f2d656e7469656e64656ec531c00c000c0001000008aa000e0b77696e646f777372756279c158c00c000c0001000008aa00110c77696e646f77737669737461026c6100c00c000c0001000008aa00100977696e646f77737870036f7267c456c00c000c0001000008aa00110e726973656f667065726174686961c116c00c000c0001000008aa001a176d6963726f736f6674627573696e657373617761726473c0bfc00c000c0001000008aa000f0977696e646f7773787002636fce71c00c000c0001000008aa000906666c6578676fd702c00c000c0001000008aa000e0b7265616c69747966616d65c54cc00c000c0001000008aa00120f65756772616e747361647669736f72c158c00c000c0001000008aa00120977696e646f77737870036f7267026a6500c00c000c0001000008aa000906617a7572696bc04ac00c000c0001000008aa00120f73657276657273636174656e61746fc1c4c00c000c0001000008aa000e0b6e61766973696f6e78616ccc27c00c000c0001000008aa000f0c74687265652d646567726565c04ac00c000c0001000008aa000e0977696e646f7773787002616300c00c000c0001000008aa00100977696e646f77737870036e6574c456c00c000c0001000008aa000f0977696e646f7773787002636fc3dac00c000c0001000008aa00100977696e646f77737870036f7267c7edc00c000c0001000008aa000c0977696e646f77737870c04ac00c000c0001000008aa00120d726573706f6e7365706f696e7402687500c00c000c0001000008aa000f0c646972656374616363657373c0bfc00c000c0001000008aa00100d726573706f6e7365706f696e74c32dc00c000c0001000008aa00100977696e646f77737870036e6574c3dac00c000c0001000008aa00100d6d6963726f736f667473706c61c04ac00c000c0001000008aa00100d76657374706f636b657463666fc116c00c000c0001000008aa00120f65756772616e747361647669736f72d3f7c00c000c0001000008aa00100977696e646f7773787003696e74f656c00c000c0001000008aa000d0a6f666669636532303037dde0c00c000c0001000008aa00100d7374756f73626f726e73686f77c0bfc00c000c0001000008aa00100977696e646f7773787003636f6dcfd5c00c000c0001000008aa00110e7374756f73626f726e6573686f77c0bfc00c000c0001000008aa00110e64657369676e6564666f72626967c498c00c000c0001000008aa00150d726573706f6e7365706f696e7402636f027a6100c00c000c0001000008aa000c0977696e646f77737870d183c00c000c0001000008aa0014116d6963726f736f66746d6f6d656e74756dc04ac00c000c0001000008aa00120d726573706f6e7365706f696e7402777300c00c000c0001000008aa000c0977696e646f77737870ff66c00c000c0001000008aa000e0977696e646f7773787002617300c00c000c0001000008aa001b1877696e646f7773647269766572646576656c6f706d656e74c0bfc00c000c0001000008aa00110977696e646f7773787002636f02636b00c00c000c0001000008aa00120f686f6d652d7075626c697368696e67c04ac00c000c0001000008aa001a176d6963726f736f6674627573696e657373617761726473c531c00c000c0001000008aa00110e64657369676e6564666f72626967c2f0c00c000c0001000008aa00100977696e646f77736e7403696e74f656c00c000c0001000008aa000e0b77696e646f777372756279d6e4c00c000c0001000008aa000d0877696e646f777870026e6600c00c000c0001000008aa00100977696e646f77737870036f6666c7acc00c000c0001000008aa000f0c6d6f6e2d7061636b2d70726fc116c00c000c0001000008aa00100d747670686f746f766965776572c116c00c000c0001000008aa000e0b77696e646f777372756279c65fc00c000c0001000008aa00100d74617675746174726f6e636865c116c00c000c0001000008aa00110977696e646f77737870046669726dc381c00c000c0001000008aa000d0a64616e69736372617a79c04ac00c000c0001000008aa00171477696e646f7773787067616d6561647669736f72c116c00c000c0001000008aa000b086263656e7472616cc7cbc00c000c0001000008aa001a176265737365727769737365722d77657474626577657262c201c00c000c0001000008aa000e0b77696e646f777332303030c116c00c000c0001000008aa0011096d6963726f736f667402636f026d7a00c00c000c0001000008aa000906666c6578676fc580c00c000c0001000008aa000e06666c6578676f02636f02637200c00c000c0001000008aa00120f65756772616e747361647669736f72c0fcc00c000c0001000008aa00120f65756772616e747361647669736f72c30ec00c000c0001000008aa000f0c72656e636f6e747265333630c116c00c000c0001000008aa000b0877696e646f777870dfbfc00c000c0001000008aa00110e676174656b656570657274657374c0fcc00c000c0001000008aa000c0977696e646f77737870f656c00c000c0001000008aa000e0877696e646f77787002636fce71c00c000c0001000008aa00100977696e646f77737870036f7267f656c00c000c0001000008aa00120977696e646f77737870036e657402706b00c00c000c0001000008aa000c09666f726566726f6e74e8acc00c000c0001000008aa00120977696e646f7773787003636f6d02656300c00c000c0001000008aa001714617a7572696b726973656f667065726174686961c04ac00c000c0001000008aa0019166d616e616765796f757270656f706c65617373657473c04ac00c000c0001000008aa000f0877696e646f777870036e6574dfbfc00c000c0001000008aa001512626c7565796f6e6465726169726c696e6573c116c00c000c0001000008aa000b086263656e7472616cc84bc00c000c0001000008aa000e0977696e646f77737870026c6b00c00c000c0001000008aa000e0b77696e646f777372756279d702c00c000c0001000008aa000906666c6578676fd696c00c000c0001000008aa00131077696e646f77737669737461626c6f67c158c00c000c0001000008aa000d0a65737469656d706f6465c04ac00c000c0001000008aa00100d726573706f6e7365706f696e74c201c00c000c0001000008aa00120f65756772616e747361647669736f72c84bc00c000c0001000008aa00141164656679616c6c6368616c6c656e676573e8acc00c000c0001000008aa00100d726573706f6e7365706f696e74ee38c00c000c0001000008aa000d0a65737469656d706f6465c116c00c000c0001000008aa00120977696e646f7773787003636f6d026e6600c00c000c0001000008aa00120977696e646f7773787003636f6d02756100c00c000c0001000008aa000f0977696e646f7773787002636fc7edc00c000c0001000008aa00100d737465776f73626f7273686f77c116c00c000c0001000008aa00120b77696e646f77737275627903636f6dc158c00c000c0001000008aa001714617a7572696b726973656f667065726174686961c116c00c000c0001000008aa00100977696e646f77737870036e6574dfbfc00c000c0001000008aa00100d737465776f73626f7273686f77c0bfc00c000c0001000008aa000c0977696e646f77737870f9cac00c000c0001000008aa00120977696e646f77737870036f726702706500c00c000c0001000008aa000c06666c6578676f02636fc7edc00c000c0001000008aa00100977696e646f77737870036f7267cc81c00c000c0001000008aa0013106865726f657368617070656e68657265c0fcc00c000c0001000008aa00100977696e646f77737870036e6574f9cec00c000c0001000008aa00100977696e646f7773787003636f6ddfbfc00c000c0001000008aa001411756b636f6d6d756e697479617761726473c04ac00c000c0001000008aa00252272656e636f6e747265732d636f6c6c6563746976697465732d6d6963726f736f6674c0bfc00c000c0001000008aa00100977696e646f77737870036e6574f656c00c000c0001000008aa00100977696e646f7773787003636f6dcdc4c00c000c0001000008aa00100d726573706f6e7365706f696e74c456c00c000c0001000008aa000d0a7374756f73626f726e65c0bfc00c000c0001000008aa000906666c6578676fcb26c00c000c0001000008aa00120d726573706f6e7365706f696e7402656300c00c000c0001000008aa000c09626570636c6567616cc0bfc00c000c0001000008aa000a0777696e32303030c84bc00c000c0001000008aa0014117365727665757273616e736c696d697465c0bfc00c000c0001000008aa000e037777770764657664617973dde0c00c000c0001000008aa000e0977696e646f77737870026c6900c00c000c0001000008aa000d0a6f666669636532303037c7cbc00c000c0001000008aa00100d726573706f6e7365706f696e74f8a8c00c000c0001000008aa00100977696e646f77737870036f7267cfd5c00c000c0001000008aa00160f65756772616e747361647669736f7203636f6dc381c00c000c0001000008aa00160d726573706f6e7365706f696e7403636f6d02706100c00c000c0001000008aa000e0977696e646f7773787002686d00c00c000c0001000008aa000e0977696e646f77737870026c6100c00c000c0001000008aa00120f65756772616e747361647669736f72ec43c00c000c0001000008aa000e0b77696e646f777372756279c0fcc00c000c0001000008aa000c097374756f73626f726ec04ac00c000c0001000008aa000e0977696e646f7773787002737400c00c000c0001000008aa00120f65756772616e747361647669736f72cb26c00c000c0001000008aa000b08676f6d656e74616cc54cc00c000c0001000008aa00100977696e646f77737870036e6574c23bc00c000c0001000008aa000b0877696e646f777870d720c00c000c0001000008aa00100d726573706f6e7365706f696e74edf7c00c000c0001000008aa00120977696e646f7773787003636f6d026a6d00c00c000c0001000008aa000f06666c6578676f03636f6d02756100c00c000c0001000008aa000b0877696e646f777870c8d8c00c000c0001000008aa0014116361702d7375722d6c652d737563636573c04ac00c000c0001000008aa000906666c6578676fc59cc00c000c0001000008aa000906617a7572696be429c00c000c0001000008aa000906666c6578676fc116c00c000c0001000008aa000f0c6d6f6e6e6f7576656c616d69c0bfc00c000c0001000008aa00120d726573706f6e7365706f696e7402627300c00c000c0001000008aa00160d726573706f6e7365706f696e7403636f6d02756100c00c000c0001000008aa00100977696e646f77737870036f7267c381c00c000c0001000008aa0014116361702d7375722d6c652d737563636573c116c00c000c0001000008aa00120b77696e646f77737275627903636f6dffdec00c000c0001000008aa00100d726573706f6e7365706f696e74c96bc00c000c0001000008aa00100977696e646f7773787003636f6dc7edc00c000c0001000008aa00110e64657369676e6564666f72626967cc9fc00c000c0001000008aa00110b77696e646f77737275627902636fc70ec00c000c0001000008aa000906666c6578676fdf83c00c000c0001000008aa00120977696e646f7773787003636f6d026e6900c00c000c0001000008aa000c096575726f706c616e6fda48c00c000c0001000008aa000f0977696e646f7773787002636fcfd5c00c000c0001000008aa000f06666c6578676f03636f6d02706b00c00c000c0001000008aa00120d726573706f6e7365706f696e7402656500c00c000c0001000008aa00120d726573706f6e7365706f696e74026d6100c00c000c0001000008aa000c0977696e646f77737870f9cec00c000c0001000008aa000e0b77696e646f777372756279eb60c00c000c0001000008aa00160f65756772616e747361647669736f7203636f6dc158c00c000c0001000008aa000c0977696e646f77737870dfbfc00c000c0001000008aa000c0977696e646f77737870c456c00c000c0001000008aa00100d726573706f6e7365706f696e74d678c00c000c0001000008aa000c0977696e646f77737870f3fac00c000c0001000008aa00100d726573706f6e7365706f696e74c06ac00c000c0001000008aa000e0b6270677765626361737433c04ac00c000c0001000008aa00100d726573706f6e7365706f696e74c2f0c00c000c0001000008aa000f0c66616d696c792d7761766573c54cc00c000c0001000008aa00120977696e646f77737870036e6574026a6500c00c000c0001000008aa00100b77696e646f77737275627902687500c00c000c0001000008aa000b06616d616c676102707300c00c000c0001000008aa00120977696e646f77737870036e657402706500c00c000c0001000008aa000f0c626c696e7874686567616d65c04ac00c000c0001000008aa00120977696e646f77737870036f726702687500c00c000c0001000008aa000d0a6f666669636532303037c84bc00c000c0001000008aa000f06616d616c676103636f6d02707300c00c000c0001000008aa000e0977696e646f7773787002736800c00c000c0001000008aa00120f77696e646f77737369646573686f77c04ac00c000c0001000008aa000b0877696e646f777870ce71c00c000c0001000008aa00070462657461f6f5c00c000c0001000008aa000e0b656169736f6c7574696f6ec085c00c000c0001000008aa0013106f66667265732d6d6963726f736f6674c04ac00c000c0001000008aa00100d726573706f6e7365706f696e74df7fc00c000c0001000008aa000d0a6f666669636532303037d3f7c00c000c0001000008aa00140d726573706f6e7365706f696e7403636f6dffdec00c000c0001000008aa00100d77696e646f77736e7432303030c116c00c000c0001000008aa00110e72657461696c7765626361737473c04ac00c000c0001000008aa000906666c6578676ff8a8c00c000c0001000008aa00120f65756772616e747361647669736f72c381c00c000c0001000008aa000c09666f726566726f6e74c0fcc00c000c0001000008aa00100977696e646f77737870036e6574cfd5c00c000c0001000008aa00120977696e646f777378700573746f7265c381c00c000c0001000008aa00110977696e646f77737870026d7902746a00c00c000c0001000008aa00120f65756772616e747361647669736f72c82fc00c000c0001000008aa00140d726573706f6e7365706f696e7403636f6dc456c00c000c0001000008aa00120977696e646f77737870036f726702706b00c00c000c0001000008aa00100977696e646f7773787003636f6dc09fc00c000c0001000008aa000d06666c6578676f03636f6dc158c00c000c0001000008aa00131069697377656263617374736572696573c116c00c000c0001000008aa000d0a756c74696d6174657063c04ac00c000c0001000008aa000e0b77696e646f777372756279e970c00c000c0001000008aa000b06616d616c676102707200c00c000c0001000008aa000e0977696e646f7773787002737200c00c000c0001000008aa00110e64657369676e6564666f72626967eb60c00c000c0001000008aa000b0866616272696b616dc04ac00c000c0001000008aa000c0977696e646f77737870f600c00c000c0001000008aa00110977696e646f7773787002636f02747400c00c000c0001000008aa000b0877696e646f777870dfbbc00c000c0001000008aa00110e667574757265706f73746d61696cc0bfc00c000c0001000008aa000d0a6f666669636532303037c580c00c000c0001000008aa00100d726573706f6e7365706f696e74dde0c00c000c0001000008aa000e0977696e646f7773787002676c00c00c000c0001000008aa00100d726573706f6e7365706f696e74d702c00c000c0001000008aa000906617a7572696bc580c00c000c0001000008aa0017146761676e657a2d656e2d65666669636163697465c04ac00c000c0001000008aa00120f686f6c6964617968656c70626f6f6bc04ac00c000c0001000008aa00100d726573706f6e7365706f696e74df83c00c000c0001000008aa00100d6469736b636f6d6d616e646572c04ac00c000c0001000008aa00100d72656164797365747368617265c54cc00c000c0001000008aa000b0877696e646f777870c237c00c000c0001000008aa00100d66696e656172747363686f6f6cc0bfc00c000c0001000008aa0014117461626c65747063646576656c6f706572c04a0000290200000080000000',\n true)\n end",
"def encode_params_base64(params)\n query = params.map { |(k, v)| \"#{uri_escape(k.to_s)}=#{uri_escape(v.to_s)}\" }.join('&')\n s = Base64.encode64(query)\n s.gsub!(/(\\s|==$)/, '')\n s\n end",
"def wicked_pdf_url_base64(url); end",
"def decode(base64)\n base64.to_s.unpack(\"m\").first\n end",
"def test_non_canonical\n verify(\n 'f8f681900001000200030005076578616d706c6503636f6d0000010001c00c0001000100014f0c00045db8d822c00c002e000100014f0c00a20001080200015180580ec93f57f38df906a8076578616d706c6503636f6d006ae1882b1536a15c44f5813671af57bf9cae0366cff2ec085d6dedfddff0c469fa827ceec953de7cc1eee634f4cf695dc2caa2074f95199a5582e51e63b336d8f091d18c0c1a307ae3f5508ec650c4085a95e54e2c2451d9fc9ae04b4e62f3d1a1689e9507c3692fb84817a70afd3e9cdf066f73cc4ac11ed080a30d2af31510b457b5c04b0002000100014f0c001401620c69616e612d73657276657273036e657400c04b0002000100014f0c00040161c0e9c04b002e000100014f0c00a2000208020001518058109f4c57f56c1906a8076578616d706c6503636f6d006d8dd0fdbd0a0b0bfe7e4306a4a001bb7a13df2faedb1702a329243c326b915191335e99e16a236de99360547efa96ec6ee547a6dcfab94b57de6f7891bcaf99a2ef5d3c72d5bc18d1bf05ff4473f527bd8f2e6621489ab531dfb6a973e37e0f0be52740a362599058b204097a04c96492e527bfca6a22338eb865b51156c2ab0e6940c10700010001000004940004c72b8735c107001c00010001e209001020010500008f00000000000000000053c0e700010001000004940004c72b8535c0e7001c00010001e209001020010500008d000000000000000000530000291000000080000000')\n end",
"def decode(value)\n Base64.decode64 value\n end",
"def encode_string; end",
"def from_base64\n unpack(\"m\").first\n end",
"def format_base64_images(text, id)\n\n matchString = /src=\"data:image\\/(\\w+?);base64,(.*?)\"/\n matches = text.scan(matchString)\n matches.each_with_index do |(mimetype, b64), ix|\n\n unless b64.nil?\n filename = 'post' + id.to_s + '-' + ix.to_s + '.' + mimetype\n fullfilespec = \"#{Rails.public_path}/#{filename}\"\n File.open(fullfilespec, 'wb') do |f|\n f.write(Base64.decode64(b64))\n end\n text.sub!(matchString, \"src='#{filename}'\")\n end\n\n end\n text\n end",
"def decode_and_parse_json(string)\n JSON.parse(string)\nrescue\n JSON.parse(Base64.decode64(string))\nend",
"def hex_to_base64(s)\n [[s].pack(\"H*\")].pack('m*')\nend",
"def encode_base64!\n self.replace(self.encode_base64)\n end",
"def hex_base64_convert(s)\n [[s].pack(\"H*\")].pack(\"M*\")\nend",
"def decode_string(str)\n\nend",
"def ensure_correct_encoding!(val)\n if @eval_string.empty? &&\n val.respond_to?(:encoding) &&\n val.encoding != @eval_string.encoding\n @eval_string.force_encoding(val.encoding)\n end\n end",
"def digest(string, algorithm)\n Base64.encode64 digester(algorithm).digest(string)\n end",
"def decode_base64!\n self.replace(self.decode_base64)\n end",
"def decode_body(body)\n body += '=' * (4 - body.length.modulo(4))\n Base64.decode64(body.tr('-_','+/'))\n end",
"def decode(b)\n Base64.decode64(b)\n end",
"def raw_to_base_64(byte_array)\n return \"\" if byte_array == []\n ((3 - (byte_array.length % 3)) % 3).times { byte_array << 0 }\n c1 = BASE_64_CHARS[byte_array[0] >> 2]\n c2 = BASE_64_CHARS[(byte_array[0] % 4) * 16 + (byte_array[1] >> 4)]\n c3 = BASE_64_CHARS[(byte_array[1] % 16) * 4 + (byte_array[2] >> 6)]\n c4 = BASE_64_CHARS[byte_array[2] % 64]\n c1 + c2 + c3 + c4 + raw_to_base_64(byte_array[3..-1])\nend",
"def base64_encode\n Base64.encode64(file_contents)\n end",
"def crypt_keeper_payload_parse(payload)\n payload.encode('UTF-8', 'binary',\n invalid: :replace, undef: :replace, replace: '')\n end",
"def parse_64(edata)\n return nil if @eject\n to_parse = ''\n \n # Check every single F'ing character. God, MIME is slow.\n edata.each_byte do |i| i = i.chr\n if MIME_CHARS.include?(i)\n @mime_block << i\n if @mime_block.length == 4\n to_parse << de_mime(@mime_block)\n @mime_block = ''\n end\n end\n end # of each_byte\n\n # Hand the decoded data to the parser\n parse(to_parse) unless to_parse.empty?\n end"
] | [
"0.77336544",
"0.77336544",
"0.74906963",
"0.6642859",
"0.65283483",
"0.64735115",
"0.6441664",
"0.63351643",
"0.63319427",
"0.6258758",
"0.6255561",
"0.6255561",
"0.62454295",
"0.61974543",
"0.6190941",
"0.6158988",
"0.6140333",
"0.611493",
"0.6114576",
"0.6087864",
"0.6087864",
"0.60208887",
"0.6020039",
"0.600945",
"0.5987523",
"0.5939844",
"0.58923066",
"0.5885468",
"0.5868347",
"0.5865094",
"0.5856005",
"0.5853495",
"0.58175176",
"0.5812542",
"0.5810735",
"0.581009",
"0.5808759",
"0.5808759",
"0.580132",
"0.57814264",
"0.57663304",
"0.5751394",
"0.5748215",
"0.5730055",
"0.5729101",
"0.572686",
"0.57212526",
"0.57192737",
"0.57067573",
"0.5699762",
"0.5690833",
"0.5689651",
"0.56754017",
"0.5654673",
"0.5646718",
"0.5622126",
"0.56212693",
"0.56212693",
"0.56203693",
"0.56167775",
"0.5610084",
"0.5608214",
"0.5599909",
"0.5594536",
"0.55485976",
"0.5533698",
"0.5527388",
"0.5527008",
"0.5520385",
"0.55107874",
"0.5497341",
"0.54827714",
"0.54802096",
"0.5469927",
"0.54680264",
"0.54680264",
"0.5446368",
"0.54046035",
"0.5391517",
"0.53852713",
"0.537772",
"0.5375139",
"0.537025",
"0.5367273",
"0.5361902",
"0.5356455",
"0.53415626",
"0.5337037",
"0.53297234",
"0.53165996",
"0.5310484",
"0.530765",
"0.53062755",
"0.5291288",
"0.5286544",
"0.5261052",
"0.5252663",
"0.5249226",
"0.52373946",
"0.52150667"
] | 0.63093257 | 9 |
Detect, check if text string is base 64 encoded Checks, detects if input string is base 64 encoded | def edit_text_base64_detect_with_http_info(request, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: EditTextApi.edit_text_base64_detect ...'
end
# verify the required parameter 'request' is set
if @api_client.config.client_side_validation && request.nil?
fail ArgumentError, "Missing the required parameter 'request' when calling EditTextApi.edit_text_base64_detect"
end
# resource path
local_var_path = '/convert/edit/text/encoding/base64/detect'
# query parameters
query_params = {}
# header parameters
header_params = {}
# HTTP header 'Accept' (if needed)
header_params['Accept'] = @api_client.select_header_accept(['application/json', 'text/json', 'application/xml', 'text/xml'])
# HTTP header 'Content-Type'
header_params['Content-Type'] = @api_client.select_header_content_type(['application/json', 'text/json', 'application/xml', 'text/xml', 'application/x-www-form-urlencoded'])
# form parameters
form_params = {}
# http body (model)
post_body = @api_client.object_to_http_body(request)
auth_names = ['Apikey']
data, status_code, headers = @api_client.call_api(:POST, local_var_path,
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,
:body => post_body,
:auth_names => auth_names,
:return_type => 'Base64DetectResponse')
if @api_client.config.debugging
@api_client.config.logger.debug "API called: EditTextApi#edit_text_base64_detect\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def base64_encoded?(string)\n !!string.gsub(/[\\r\\n]|\\\\r|\\\\n/, \"\").match(BASE64_FORMAT)\n end",
"def base64_encoded?(string)\n !!string.gsub(/[\\r\\n]|\\\\r|\\\\n/, \"\").match(BASE64_FORMAT)\n end",
"def valid_base64?(string)\n return false unless string.is_a?(String)\n return false unless string.start_with?('base64:')\n\n return true\n end",
"def encode_base64(text)\n Base64.strict_encode64(text).strip\n end",
"def safe_string(str)\n b64str = Base64.strict_encode64(str)\n \"echo #{b64str} | base64 --decode\"\n end",
"def test_hat\n assert_equal MyBase64.decode64(\"aGF0\"), \"hat\"\n end",
"def encode_str(str)\n require \"base64\"\n encoded_str=Base64.encode64(str)\n return encoded_str\nend",
"def fake_base_64\n Base64.urlsafe_encode64(words(20).join)\nend",
"def decode_base64\n #self.unpack(\"m*\").first\n # This should be the above line but due to a bug in the ruby base64 decoder\n # it will only decode base64 where the lines are in multiples of 4, this is\n # contrary to RFC2045 which says that all characters other than the 65 used\n # are to be ignored. Currently we remove all the other characters but it \n # might be better to use it's advice to only remove line breaks and white\n # space\n self.tr(\"^A-Za-z0-9+/=\", \"\").unpack(\"m*\").first\n end",
"def edit_text_base64_detect(request, opts = {})\n data, _status_code, _headers = edit_text_base64_detect_with_http_info(request, opts)\n data\n end",
"def guess_mime_encoding\n # Grab the first line and have a guess?\n # A multiple of 4 and no characters that aren't in base64 ?\n # Need to allow for = at end of base64 string\n squashed = self.tr(\"\\r\\n\\s\", '').strip.sub(/=*\\Z/, '')\n if squashed.length.remainder(4) == 0 && squashed.count(\"^A-Za-z0-9+/\") == 0\n :base64\n else\n :quoted_printable\n end\n # or should we just try both and see what works?\n end",
"def base64_decode(string)\n SSL.base64_decode(string)\n end",
"def base64_decode(string)\n SSL.base64_decode(string)\n end",
"def base64(stuff)\n Base64.encode64(stuff).delete(\"\\n\")\n end",
"def strict_decode64( str )\n \n if RUBY_VERSION >= \"1.9\"\n Base64.strict_decode64( str )\n else\n Base64.decode64( str )\n end\nend",
"def u64(s)\n return unless s\n Base64.decode64 CGI.unescape(s)\n end",
"def binary?\n @encoding == 'base64'\n end",
"def b64d(input)\n if input\n return helpers.base64Decode(input)\n end\n return \"\".to_java_bytes\n end",
"def e64(s)\n return unless s\n CGI.escape Base64.encode64(s)\n end",
"def strict_decode64(str)\n return Base64.strict_decode64(str) if Base64.respond_to? :strict_decode64\n\n unless str.include?(\"\\n\")\n Base64.decode64(str)\n else\n raise(ArgumentError,\"invalid base64\")\n end\n end",
"def decode_base64_string(filename, data)\n\n decoded_image = Base64.decode64(data)\n\nend",
"def decode_base64_string(filename, data)\n\n decoded_image = Base64.decode64(data)\n\nend",
"def strict_encode64(bin)\n return Base64.strict_encode64(bin) if Base64.respond_to? :strict_encode64\n Base64.encode64(bin).tr(\"\\n\",'')\n end",
"def base64?\n !!@options[:base64]\n end",
"def password_encoded?(password)\n reg_ex_test = \"^([A-Za-z0-9+/]{4})*([A-Za-z0-9+/]{4}|[A-Za-z0-9+/]{3}=|[A-Za-z0-9+/]{2}==)$\"\n\n if password =~ /#{reg_ex_test}/ then\n return true\n else\n return false\n end\n end",
"def b64_e(data)\n Base64.encode64(data).chomp\n end",
"def sanitize_base64_string(base64_string)\n array_string = base64_string.split('//')\n array_string[-1] = array_string[-1].gsub('\\\\', '')\n array_string.join('//')\n end",
"def base64(text, charset=\"iso-2022-jp\", convert=true)\n if convert\n if charset == \"iso-2022-jp\"\n text = NKF.nkf('-j -m0', text)\n end\n end\n text = [text].pack('m').delete(\"\\r\\n\")\n \"=?#{charset}?B?#{text}?=\"\n end",
"def get_base64_image(image)\n image_base64 = Base64.encode64(open(image) { |io| io.read })\n filter_image = image_base64.gsub(/\\r/,\"\").gsub(/\\n/,\"\")\n end",
"def decode(string)\n Base64.decode64(string)\n end",
"def base64_url_decode(str)\n \"#{str}==\".tr(\"-_\", \"+/\").unpack(\"m\")[0]\n end",
"def urlsafe_encode64(bin)\n strict_encode64(bin).tr(\"+/\", \"-_\")\n end",
"def encode_string_ex; end",
"def b64_encode(string)\n Base64.encode64(string).tr(\"\\n=\",'')\n end",
"def base64_encode value\n encoded_str = Base64.urlsafe_encode64 value, padding: false\nend",
"def bin_to_base64(bin)\nreturn bin.scan(/....../).map { |x| $BASE64[x.to_i(2)] }.join\nend",
"def decipher_base64(value_base64, key)\n if blank(value_base64)\n return nil\n else\n cipher_text = Base64.decode64(value_base64)\n return decipher(cipher_text, key)\n end\nend",
"def base64_encode(string)\n SSL.base64_encode(string)\n end",
"def base64_encode(string)\n SSL.base64_encode(string)\n end",
"def base64_decode\n unpack('m').first\n end",
"def hex_to_bin_to_base64(hex_encoded_string)\n bin = Lib.hex_to_bin(hex_encoded_string)\n Lib.bin_to_base64([bin])\nend",
"def decode_params_base64(s)\n parsed = CGI.parse(Base64.decode64(\"#{s}==\"))\n params = Hash[*parsed.entries.map { |k, v| [k, v[0]] }.flatten]\n params.with_indifferent_access\n end",
"def decoded\n Base64.decode64(@base64 || \"\")\n end",
"def can_encode?(str, charset: BASIC_CHARSET)\n !str || !!(regex(charset) =~ str)\n end",
"def base64\n binary = open { |io| io.read }\n result = Base64.strict_encode64(binary)\n binary.clear # deallocate string\n result\n end",
"def base64\n binary = open { |io| io.read }\n result = Base64.encode64(binary).chomp\n binary.clear # deallocate string\n result\n end",
"def validate_certificate_base64(cert)\n return false if(cert.to_s.length <= 0 )\n # try to decode it by loading the entire decoded thing in memory\n begin\n # A tolerant verification\n # We'll use this only if SIJC's certificates fail in the\n # initial trials, else, we'll stick to the strict one.\n # Next line complies just with RC 2045:\n # decode = Base64.decode64(cert)\n\n # A strict verification:\n # Next line complies with RFC 4648:\n # try to decode, ArgumentErro is raised\n # if incorrectly padded or contains non-alphabet characters.\n decode = Base64.strict_decode64(cert)\n\n # Once decoded release it from memory\n decode = nil\n return true\n rescue Exception => e\n return false\n end\n end",
"def validate_certificate_base64(cert)\n return false if(cert.to_s.length <= 0 )\n # try to decode it by loading the entire decoded thing in memory\n begin\n # A tolerant verification\n # We'll use this only if SIJC's certificates fail in the\n # initial trials, else, we'll stick to the strict one.\n # Next line complies just with RC 2045:\n # decode = Base64.decode64(cert)\n\n # A strict verification:\n # Next line complies with RFC 4648:\n # try to decode, ArgumentErro is raised\n # if incorrectly padded or contains non-alphabet characters.\n decode = Base64.strict_decode64(cert)\n\n # Once decoded release it from memory\n decode = nil\n return true\n rescue Exception => e\n return false\n end\n end",
"def ensure_valid_encoding(string)\n sanitized = string.each_char.select { |c| c.bytes.count < 4 }.join\n if sanitized.length < string.length\n if removed = string.each_char.select { |c| c.bytes.count >= 4 }.join\n Rails.logger.debug(\"removed invalid encoded elements: #{removed}\")\n end\n end\n sanitized\n end",
"def encode(str)\n @base64 = Base64.encode64(str)\n end",
"def base64digest\n DigestUtils.pack_base64digest(digest)\n end",
"def encode\n ::Base64.encode64(@string)\n end",
"def can_encode?(str)\n str.nil? || !(GSM_REGEX =~ str).nil?\n end",
"def base64(length: T.unsafe(nil), padding: T.unsafe(nil), urlsafe: T.unsafe(nil)); end",
"def encript(text_to_encript)\n require 'base64'\n Base64.encode64(text_to_encript)\n\nend",
"def test_b64_working\n\n ### token test\n key = \"0A3JhgnyQqmp0zTo1bEy1ZjqCG8aDFKJ\"\n secret = \"MdMZUgWdtyCIaaVC6qkY3143qysaMDMx\"\n ks = key +\":\"+ secret\n\n a = \"MEEzSmhnbnlRcW1wMHpUbzFiRXkxWmpxQ0c4YURGS0o6TWRNWlVnV2R0eUNJYWFWQzZxa1kzMTQzcXlzYU1ETXg=\"\n b = WAPI.base64_key_secret(key, secret)\n\n assert_equal a, b\n\n back_a = Base64.strict_decode64(a)\n back_b = Base64.strict_decode64(b)\n\n assert_equal back_a, back_b\n end",
"def pack_urlsafe_base64digest(bin)\n str = pack_base64digest(bin)\n str.tr!('+/'.freeze, '-_'.freeze)\n str.tr!('='.freeze, ''.freeze)\n str\n end",
"def pack_urlsafe_base64digest(bin)\n str = pack_base64digest(bin)\n str.tr!('+/'.freeze, '-_'.freeze)\n str.tr!('='.freeze, ''.freeze)\n str\n end",
"def base64(digits)\n string(BASE64_DIGITS, digits)\n end",
"def reencode_string(input); end",
"def decode64\n Base64.strict_decode64(unwrap)\n end",
"def urlsafe_decode64(str)\n strict_decode64(str.tr(\"-_\", \"+/\"))\n end",
"def urlsafe_decode642(str)\n # NOTE: RFC 4648 does say nothing about unpadded input, but says that\n # \"the excess pad characters MAY also be ignored\", so it is inferred that\n # unpadded input is also acceptable.\n str = str.tr(\"-_\", \"+/\")\n if !str.end_with?(\"=\") && str.length % 4 != 0\n str = str.ljust((str.length + 3) & ~3, \"=\")\n end\n Base64.strict_decode64(str)\nend",
"def base64_url_decode(str)\n str += '=' * (4 - str.length.modulo(4))\n Base64.decode64(str.tr('-_', '+/'))\n end",
"def verify_check_string(data)\n # The documentation about how to calculate the hash was woefully\n # under-documented, however through some guessing I was able to\n # determine that it creates an MD5 from the values of the fields\n # starting with OrderID and ending with TranData, concatenated with\n # the Shop Password.\n fields = [\n 'OrderID',\n 'Forward',\n 'Method',\n 'PayTimes',\n 'Approve',\n 'TranID',\n 'TranDate'\n ]\n values_string = ''\n check_string = nil\n\n CGI.parse(data).each do |key, value|\n if value.length == 1\n value = value[0]\n end\n if fields.include?(key)\n values_string += value\n end\n if key == 'CheckString'\n check_string = value\n end\n end\n values_string += @options[:password]\n our_hash = Digest::MD5.hexdigest(values_string)\n check_string == our_hash\n end",
"def strict_encode64(string)\n [string].pack('m0')\n end",
"def decode_aes256_cbc_base64 data\n if data.empty?\n ''\n else\n # TODO: Check for input validity!\n _decode_aes256 :cbc, decode_base64(data[1, 24]), decode_base64(data[26..-1])\n end\n end",
"def encode(string); end",
"def encode64( png )\n return Base64.encode64(png)\n end",
"def base64(value)\n {\"Fn::Base64\" => value}\n end",
"def best_mime_encoding\n if self.is_ascii?\n :none\n elsif self.length > (self.mb_chars.length * 1.1)\n :base64\n else\n :quoted_printable\n end\n end",
"def postgres_base64_data(data)\n [data].pack(\"m*\").gsub(/\\r?\\n/,\"\")\n end",
"def decode64_url(str)\n # add '=' padding\n str = case str.length % 4\n when 2 then str + '=='\n when 3 then str + '='\n else\n str\n end\n\n Base64.decode64(str.tr('-_', '+/'))\nend",
"def clarify_id( text )\n begin\n self.obfuscatable_crypt.clarify( text, :block )\n rescue ArgumentError\n # invalid text passed in, causing a Base64 decode error, ignore.\n end\n end",
"def convert_to_base64(csv)\n Base64.encode64(csv)\n end",
"def csrf_token?( str )\n return false if !str\n\n # we could use regexps but i kinda like lcamtuf's (Michal's) way\n base16_len_min = 8\n base16_len_max = 45\n base16_digit_num = 2\n\n base64_len_min = 6\n base64_len_max = 32\n base64_digit_num = 1\n base64_case = 2\n base64_digit_num2 = 3\n base64_slash_cnt = 2\n\n len = str.size\n digit_cnt = str.scan( /[0-9]+/ ).join.size\n\n if len >= base16_len_min && len <= base16_len_max && digit_cnt >= base16_digit_num\n return true\n end\n\n upper_cnt = str.scan( /[A-Z]+/ ).join.size\n slash_cnt = str.scan( /\\/+/ ).join.size\n\n if len >= base64_len_min && len <= base64_len_max &&\n ((digit_cnt >= base64_digit_num && upper_cnt >= base64_case ) ||\n digit_cnt >= base64_digit_num2) && slash_cnt <= base64_slash_cnt\n return true\n end\n\n false\n end",
"def csrf_token?( str )\n return false if !str\n\n # we could use regexps but i kinda like lcamtuf's (Michal's) way\n base16_len_min = 8\n base16_len_max = 45\n base16_digit_num = 2\n\n base64_len_min = 6\n base64_len_max = 32\n base64_digit_num = 1\n base64_case = 2\n base64_digit_num2 = 3\n base64_slash_cnt = 2\n\n len = str.size\n digit_cnt = str.scan( /[0-9]+/ ).join.size\n\n if len >= base16_len_min && len <= base16_len_max && digit_cnt >= base16_digit_num\n return true\n end\n\n upper_cnt = str.scan( /[A-Z]+/ ).join.size\n slash_cnt = str.scan( /\\/+/ ).join.size\n\n if len >= base64_len_min && len <= base64_len_max &&\n ((digit_cnt >= base64_digit_num && upper_cnt >= base64_case ) ||\n digit_cnt >= base64_digit_num2) && slash_cnt <= base64_slash_cnt\n return true\n end\n\n false\n end",
"def encode(string)\n Base64.encode64(string).gsub(/\\n/, \"\")\n end",
"def test_canonical\n verify(\n 'bb7a81900001041200000001023332033139370234360332303707696e2d61646472046172706100000c0001c00c000c0001000008aa0017116270666f726772656174706c61696e733203636f6d00c00c000c0001000008aa00130e64657369676e6564666f7262696702636e00c00c000c0001000008aa000f0a6f66666963653230303702636800c00c000c0001000008aa000e0977696e646f77737870026b7a00c00c000c0001000008aa00150f77696e646f77733230303074657374036f726700c00c000c0001000008aa000e0b77696e646f77736e743938c0bfc00c000c0001000008aa0016117370726f7374616a77797a77616e696f6d02706c00c00c000c0001000008aa000f09697462727565636b65036e657400c00c000c0001000008aa001512626c7565796f6e6465726169726c696e6573c0bfc00c000c0001000008aa00140f6d73646e746563686e6574746f757202667200c00c000c0001000008aa000c0977696e646f77733938c085c00c000c0001000008aa00130a6f66666963653230303703636f6d026d7800c00c000c0001000008aa000906617a7572696bc116c00c000c0001000008aa00140f65756772616e747361647669736f7202697400c00c000c0001000008aa00171477696e646f7773787067616d6561647669736f72c0bfc00c000c0001000008aa000e09697462727565636b6502646500c00c000c0001000008aa00100b77696e646f77737275627902686b00c00c000c0001000008aa00120977696e646f7773787003636f6d02677400c00c000c0001000008aa000e0b77696e646f777332303037c0bfc00c000c0001000008aa00151268756d6f6e676f7573696e737572616e6365c04ac00c000c0001000008aa001411756b636f6d6d756e697479617761726473c116c00c000c0001000008aa00130a77696e64736f77737870036e657402646f00c00c000c0001000008aa001509646f776e6c6f616473086263656e7472616cc04ac00c000c0001000008aa000e09666f726566726f6e7402617400c00c000c0001000008aa00120d726573706f6e7365706f696e74026c7400c00c000c0001000008aa00130e65766572796f6e6567657473697402657500c00c000c0001000008aa000e09666f726566726f6e7402626500c00c000c0001000008aa00100977696e646f77737870036f7267c2b5c00c000c0001000008aa00120977696e646f777378700372656302726f00c00c000c0001000008aa00120d726573706f6e7365706f696e7402706800c00c000c0001000008aa0015126361707375726c6573756363657332303038c116c00c000c0001000008aa000e0977696e646f7773787002706e00c00c000c0001000008aa000e0b77696e646f777332303030c085c00c000c0001000008aa001815636f686f76696e6579617264616e6477696e657279c04ac00c000c0001000008aa00120977696e646f7773787003636f6d02746c00c00c000c0001000008aa00140f65756772616e747361647669736f72026c7600c00c000c0001000008aa00140f65756772616e747361647669736f7202636c00c00c000c0001000008aa00181164656679616c6c6368616c6c656e67657303636f6dc21dc00c000c0001000008aa00110e7374617274736f6d657468696e67c347c00c000c0001000008aa00100977696e646f77737870036f7267c23bc00c000c0001000008aa00100977696e646f77737870036f7267c0fcc00c000c0001000008aa0016136f666672652d65626c6f75697373616e746573c0bfc00c000c0001000008aa00140b77696e646f77737275627903636f6d02657300c00c000c0001000008aa000f0a6f66666963653230303702636100c00c000c0001000008aa000e0977696e646f7773787002616d00c00c000c0001000008aa001109626570636c6567616c02636f02756b00c00c000c0001000008aa000d0877696e646f77787002747600c00c000c0001000008aa00110977696e646f7773787004696e666fc381c00c000c0001000008aa001f1c786e2d2d66726465726d697474656c2d72617467656265722d333962c201c00c000c0001000008aa00110e65766572796f6e65676574736974c531c00c000c0001000008aa00151268756d6f6e676f7573696e737572616e6365c0bfc00c000c0001000008aa00110e696973646961676e6f7374696373c0bfc00c000c0001000008aa00160f65756772616e747361647669736f7203636f6dc0fcc00c000c0001000008aa000b06666c6578676f02696e00c00c000c0001000008aa00120f696e73696465647269766532303032c04ac00c000c0001000008aa00100d726573706f6e7365706f696e74c18bc00c000c0001000008aa001815636f6e736f6c6964617465646d657373656e676572c116c00c000c0001000008aa000c09666f726566726f6e74c678c00c000c0001000008aa00140b77696e646f77737275627903636f6d02766500c00c000c0001000008aa0017146761676e657a2d656e2d65666669636163697465c0bfc00c000c0001000008aa000f0c636f686f76696e6579617264c0bfc00c000c0001000008aa001714636f6e73756d6572676f6f647373656d696e6172c04ac00c000c0001000008aa001310666f726f706572737065637469766173c0bfc00c000c0001000008aa00120977696e646f7773787003636f6d02616900c00c000c0001000008aa00170e65766572796f6e6567657473697403636f6d02617500c00c000c0001000008aa00120977696e646f77737870036e657402766900c00c000c0001000008aa00120f77696e646f77733230303074657374c116c00c000c0001000008aa00180f65756772616e747361647669736f7203636f6d02707400c00c000c0001000008aa00100b77696e646f777332303030026e6c00c00c000c0001000008aa000c0977696e646f77733935c0bfc00c000c0001000008aa0014117365727665757273616e736c696d697465c116c00c000c0001000008aa0015126d6963726f736f6674666f726566726f6e74c2f0c00c000c0001000008aa000e0977696e646f7773787002736e00c00c000c0001000008aa000e0977696e646f7773787002736300c00c000c0001000008aa0017146d6963726f736f667474696d65657870656e7365c04ac00c000c0001000008aa001c19647269766572646576656c6f706572636f6e666572656e6365c0bfc00c000c0001000008aa000b0877696e646f777870c82bc00c000c0001000008aa000b0661786170746102727500c00c000c0001000008aa000f09666f726566726f6e7402636fc678c00c000c0001000008aa000b0877696e646f777870c436c00c000c0001000008aa000c09626570636c6567616cc04ac00c000c0001000008aa000b0877696e646f777870c456c00c000c0001000008aa000b06666c6578676f02746d00c00c000c0001000008aa0017146761676e657a2d656e2d65666669636163697465c116c00c000c0001000008aa0015126d6963726f736f6674666f726566726f6e74c158c00c000c0001000008aa00110e636c7562736d61727470686f6e65c116c00c000c0001000008aa000c09666f726566726f6e74c158c00c000c0001000008aa00100d726573706f6e7365706f696e74c347c00c000c0001000008aa0015126361707375726c6573756363657332303038c0bfc00c000c0001000008aa000c09666f726566726f6e74c52dc00c000c0001000008aa000906666c6578676fc84bc00c000c0001000008aa00100977696e646f77737870036f7267c39fc00c000c0001000008aa00151273747265616d6c696e6566696e616e636573c04ac00c000c0001000008aa00130d726573706f6e7365706f696e740362697a00c00c000c0001000008aa00120d726573706f6e7365706f696e7402646b00c00c000c0001000008aa000f0c6d6f6e6e6f7576656c616d69c158c00c000c0001000008aa00120f77696e646f77733230303074657374c04ac00c000c0001000008aa000f0c666f75727468636f66666565c04ac00c000c0001000008aa001310666f726f706572737065637469766173c116c00c000c0001000008aa00110e6272757465666f72636567616d65c04ac00c000c0001000008aa000c09696e73656775726f73c116c00c000c0001000008aa00100d726573706f6e7365706f696e74c381c00c000c0001000008aa000f0c647269766572646576636f6ec04ac00c000c0001000008aa001611666f727265746e696e677373797374656d026e6f00c00c000c0001000008aa00140f65756772616e747361647669736f72026c7500c00c000c0001000008aa00100977696e646f77737870036e6574c436c00c000c0001000008aa00120977696e646f7773787003636f6d02666a00c00c000c0001000008aa00140d726573706f6e7365706f696e7403636f6dc06ac00c000c0001000008aa00100d726573706f6e7365706f696e74c580c00c000c0001000008aa000c09666f726566726f6e74c085c00c000c0001000008aa000e0977696e646f7773787002686e00c00c000c0001000008aa00161370736f65786563757469766573656d696e6172c04ac00c000c0001000008aa000906656e6779726fc04ac00c000c0001000008aa00110e6361736866696e616e6369616c73c04ac00c000c0001000008aa00151268756d6f6e676f7573696e737572616e6365c116c00c000c0001000008aa001512636f6e666f726d6974656c6963656e636573c0bfc00c000c0001000008aa0019166c65732d646f696774732d64616e732d6c652d6e657ac158c00c000c0001000008aa000e0977696e646f7773787002616700c00c000c0001000008aa000d0a676f746f746563686564c04ac00c000c0001000008aa00110e667574757265706f73746d61696cc580c00c000c0001000008aa0019166c7574746572636f6e7472656c657069726174616765c0bfc00c000c0001000008aa0014116c756365726e657075626c697368696e67c04ac00c000c0001000008aa000c09666f726566726f6e74cb26c00c000c0001000008aa000e0977696e646f7773787002757a00c00c000c0001000008aa000d0a636f686f77696e657279c116c00c000c0001000008aa001310657870657269656e6365746563686564c04ac00c000c0001000008aa00191677696e646f7773647269766572646576656c6f706572c0bfc00c000c0001000008aa000b0877696e646f777870cac6c00c000c0001000008aa00100d726573706f6e7365706f696e74c70ac00c000c0001000008aa000e0977696e646f7773787002666d00c00c000c0001000008aa00100d726573706f6e7365706f696e74c951c00c000c0001000008aa00130a6f66666963653230303703636f6d02736700c00c000c0001000008aa00110e64657369676e6564666f72626967c116c00c000c0001000008aa000b086370616475766f6cc0bfc00c000c0001000008aa000d0877696e646f777870026d6e00c00c000c0001000008aa000c09666f726566726f6e74c201c00c000c0001000008aa000e0977696e646f77737870026d7500c00c000c0001000008aa000a07666f7269656e74c04ac00c000c0001000008aa000c0977696e646f77737870cfa3c00c000c0001000008aa00100d6c6573626f6e736f7574696c73c0bfc00c000c0001000008aa0014117365727665757273616e736c696d697465c04ac00c000c0001000008aa000e0b6f66666963657265616479cb26c00c000c0001000008aa00120d726573706f6e7365706f696e7402626f00c00c000c0001000008aa000b086d6f6e727562616ec04ac00c000c0001000008aa00100d726573706f6e7365706f696e74c085c00c000c0001000008aa00100d726573706f6e7365706f696e74c54cc00c000c0001000008aa00110e6a65646572686174736472617566c116c00c000c0001000008aa001e1b647269766572646576656c6f706d656e74636f6e666572656e6365c0bfc00c000c0001000008aa000e0b77696e646f777372756279c84bc00c000c0001000008aa001613636f6e666f726d6974652d6c6963656e636573c116c00c000c0001000008aa0015126361707375726c6573756363657332303038c04ac00c000c0001000008aa000d0877696e646f77787002677300c00c000c0001000008aa000d0a7374756f73626f726e65c116c00c000c0001000008aa000c09666f726566726f6e74c18bc00c000c0001000008aa0013106a656465722d686174732d6472617566c201c00c000c0001000008aa0014116d6f62696c657063646576656c6f706572c04ac00c000c0001000008aa00100977696e646f77737870036f7267c3dac00c000c0001000008aa00160d726573706f6e7365706f696e7403636f6d026d7900c00c000c0001000008aa000f0c636f686f76696e6579617264c04ac00c000c0001000008aa00120f73656d696e61697265732d6e617635c158c00c000c0001000008aa000f0c647269766572646576636f6ec116c00c000c0001000008aa000b0877696e646f777870c566c00c000c0001000008aa000f0c6469676974616c616e76696cc04ac00c000c0001000008aa00100d726573706f6e7365706f696e74c158c00c000c0001000008aa000c0977696e646f77733938c04ac00c000c0001000008aa0018156e61762d636f6d706c69616e636577656263617374c04ac00c000c0001000008aa00110e70726f6a656374657870656e7365c04ac00c000c0001000008aa000906666c6578676fc0bfc00c000c0001000008aa000f0877696e646f77787003636f6dc8d8c00c000c0001000008aa000b086c69666563616d73c04ac00c000c0001000008aa00120f696d6167696e657a6c617375697465c0bfc00c000c0001000008aa00171474616b65636f6e74726f6c6f66706179726f6c6cc04ac00c000c0001000008aa0019166772617068696364657369676e696e73746974757465c04ac00c000c0001000008aa00130d726573706f6e7365706f696e7402636fc2f0c00c000c0001000008aa000e0b77696e646f777372756279c498c00c000c0001000008aa000c09697462727565636b65c0bfc00c000c0001000008aa001a17636c756270617274656e61697265737365727669636573c116c00c000c0001000008aa000d0a696d6167696e65637570c580c00c000c0001000008aa000e0b77696e646f777372756279cf52c00c000c0001000008aa001714617a7572696b726973656f667065726174686961c0bfc00c000c0001000008aa00100d726573706f6e7365706f696e74c7cbc00c000c0001000008aa001c19647269766572646576656c6f706572636f6e666572656e6365c04ac00c000c0001000008aa000f0c6d6f6e6e6f7576656c616d69c04ac00c000c0001000008aa000c09626c6f6f6477616b65c04ac00c000c0001000008aa00110e6a65646572686174736472617566c201c00c000c0001000008aa00120d726573706f6e7365706f696e7402646d00c00c000c0001000008aa001613636f6e666f726d6974652d6c6963656e636573c0bfc00c000c0001000008aa00120f696d6167696e657a6c617375697465c158c00c000c0001000008aa000c09666f726566726f6e74c951c00c000c0001000008aa000c09666f726566726f6e74c531c00c000c0001000008aa000e0b77696e646f777332303037cb07c00c000c0001000008aa00110e6d6f62696c6574656368746f7572c116c00c000c0001000008aa000e0b77696e646f777332303036c116c00c000c0001000008aa00120f63656e747265646573757361676573c0bfc00c000c0001000008aa001e1b786e2d2d66726465726d697474656c72617467656265722d713662c201c00c000c0001000008aa000b06666c6578676f02757300c00c000c0001000008aa00120d726573706f6e7365706f696e7402736500c00c000c0001000008aa0007046f727063cb26c00c000c0001000008aa001512696e666f726d61736a6f6e7373797374656dcc27c00c000c0001000008aa001109666f726566726f6e7402636f026b7200c00c000c0001000008aa00130a6f66666963653230303703636f6d02627200c00c000c0001000008aa000e0977696e646f7773787002626900c00c000c0001000008aa00252277696e646f7773647269766572646576656c6f706d656e74636f6e666572656e6365c04ac00c000c0001000008aa001310666f726f706572737065637469766173c04ac00c000c0001000008aa000a077061726c616e6fc04ac00c000c0001000008aa00110e696973646961676e6f7374696373c116c00c000c0001000008aa000906617a7572696bc0bfc00c000c0001000008aa000c09696e73656775726f73c04ac00c000c0001000008aa000e0977696e646f77737870026b6700c00c000c0001000008aa000e0977696e646f7773787002636700c00c000c0001000008aa00150e65766572796f6e65676574736974036e6574c7cfc00c000c0001000008aa000d0a636f686f77696e657279c04ac00c000c0001000008aa00120f6d797374617274757063656e746572c04ac00c000c0001000008aa001714706c75736465343030646966666572656e636573c54cc00c000c0001000008aa00100d726573706f6e7365706f696e74c0bfc00c000c0001000008aa0015126c6573646f6967747364616e736c656e657ac158c00c000c0001000008aa000c0970726f736577617265c116c00c000c0001000008aa000e0b6374726f70656e6f726d65c04ac00c000c0001000008aa000c0970726f736577617265c04ac00c000c0001000008aa000f0c77696e646f77732d32303030c84bc00c000c0001000008aa00120f696d70726f7665616e616c79736973c04ac00c000c0001000008aa000c09666f726566726f6e74c1c4c00c000c0001000008aa00191664656375706c657a766f747265706f74656e7469656cc04ac00c000c0001000008aa001a17686572617573666f72646572756e67736d656973746572c201c00c000c0001000008aa001411627033666f726772656174706c61696e73c04ac00c000c0001000008aa00120f696d6167696e65726c617375697465c04ac00c000c0001000008aa00120f696d6167696e65726c617375697465c158c00c000c0001000008aa00100d726573706f6e7365706f696e74c59cc00c000c0001000008aa000d0a77696e7465726e616c73c04ac00c000c0001000008aa0009046575676102677200c00c000c0001000008aa000e0b6374726f70656e6f726d65c116c00c000c0001000008aa001411756b636f6d6d756e697479617761726473c0bfc00c000c0001000008aa0015126c6573646f6967747364616e736c656e657ac0bfc00c000c0001000008aa0009066f6666726573d967c00c000c0001000008aa00100d6f70656e74797065666f72756dc04ac00c000c0001000008aa00100d726573706f6e7365706f696e74da48c00c000c0001000008aa00150d726573706f6e7365706f696e7402636f02696c00c00c000c0001000008aa001916656e68616e6365796f757270656f706c656173736574c04ac00c000c0001000008aa0015126d6963726f736f6674666f726566726f6e74c951c00c000c0001000008aa0015126d6963726f736f6674666f726566726f6e74c21dc00c000c0001000008aa00100d63696f2d636f6d6d756e697479c085c00c000c0001000008aa0015126d6963726f736f6674666f726566726f6e74c580c00c000c0001000008aa0013106a656465722d686174732d6472617566c0bfc00c000c0001000008aa001815666f65726465726d697474656c7261746765626572c201c00c000c0001000008aa000c09626570636c6567616cc116c00c000c0001000008aa0019166d69677265727665727376697375616c73747564696fc0bfc00c000c0001000008aa000f0c6270666f72736f6c6f6d6f6ec04ac00c000c0001000008aa0019166f6666696365706f75726c65736574756469616e7473c0bfc00c000c0001000008aa00100d627033666f72736f6c6f6d6f6ec04ac00c000c0001000008aa00090669746865726fd6e4c00c000c0001000008aa0014116d6f62696c657063646576656c6f706572c0bfc00c000c0001000008aa000b08706f636b65747063c116c00c000c0001000008aa001512636f6e666f726d6974656c6963656e636573c116c00c000c0001000008aa000c096576726f706c616e6fda48c00c000c0001000008aa001a17636c756270617274656e61697265737365727669636573c0bfc00c000c0001000008aa001c19647269766572646576656c6f706572636f6e666572656e6365c116c00c000c0001000008aa00171467702d636f6d706c69616e636577656263617374c04ac00c000c0001000008aa000e0b7061636b746f7574656e31c0bfc00c000c0001000008aa0019166c65732d646f696774732d64616e732d6c652d6e657ac04ac00c000c0001000008aa001109686f77746f74656c6c02636f026e7a00c00c000c0001000008aa001e1b647269766572646576656c6f706d656e74636f6e666572656e6365c04ac00c000c0001000008aa0015126d6963726f736f6674666f726566726f6e74d696c00c000c0001000008aa000e0b7061636b746f7574656e31c116c00c000c0001000008aa001512636f6e666f726d6974656c6963656e636573c04ac00c000c0001000008aa000b0877696e646f777870c39fc00c000c0001000008aa0015126d6963726f736f6674666f726566726f6e74c531c00c000c0001000008aa001613736d61727470686f6e65636f6d6d756e697479c04ac00c000c0001000008aa001e1b647269766572646576656c6f706d656e74636f6e666572656e6365c116c00c000c0001000008aa000f0c6d6f6e6e6f7576656c616d69c116c00c000c0001000008aa000f0c7061636b746f7574656e756ec0bfc00c000c0001000008aa00110e65766572796f6e65676574736974c54cc00c000c0001000008aa00100d77696e646f77736d6f62696c65d696c00c000c0001000008aa001b126d6963726f736f6674666f726566726f6e7403636f6d02747700c00c000c0001000008aa00120f6d73646e746563686e6574746f7572c04ac00c000c0001000008aa00120977696e646f77737870036f726702747000c00c000c0001000008aa00120f6f6e6c696e6573706f746c69676874c0bfc00c000c0001000008aa00100d6c6573626f6e736f7574696c73c116c00c000c0001000008aa000a076f6e6d79776179cb26c00c000c0001000008aa000c09696f2d6d6f64656c6cc201c00c000c0001000008aa000a076f6e6563617265c04ac00c000c0001000008aa00110e726973656f667065726174686961c04ac00c000c0001000008aa000f0c636c7562706f636b65747063c04ac00c000c0001000008aa001a176d6963726f736f66742d6272616e6368656e766964656fc201c00c000c0001000008aa0009066370616e646cc04ac00c000c0001000008aa0015126d6963726f736f6674666f726566726f6e74c0bfc00c000c0001000008aa0013106a656465722d686174732d6472617566c116c00c000c0001000008aa000c096f6e6d79776179756bc04ac00c000c0001000008aa000a07636f6e746f736fc04ac00c000c0001000008aa000b086e61766973696f6ec085c00c000c0001000008aa0014116361702d7375722d6c652d737563636573c0bfc00c000c0001000008aa000c09696e73656775726f73c0bfc00c000c0001000008aa00141164656679616c6c6368616c6c656e676573c1c4c00c000c0001000008aa000c096c6561726e32617370c116c00c000c0001000008aa00100d66696e656172747363686f6f6cc116c00c000c0001000008aa00110e646f776e6c6f616467726f6f7665c04ac00c000c0001000008aa0015126d6963726f736f6674666f726566726f6e74d702c00c000c0001000008aa000f0c7061636b746f7574656e756ec04ac00c000c0001000008aa0009066370616e646cc0bfc00c000c0001000008aa0015126d6963726f736f6674666f726566726f6e74c52dc00c000c0001000008aa00120f646566726167636f6d6d616e646572c04ac00c000c0001000008aa0015126d6963726f736f6674666f726566726f6e74c39fc00c000c0001000008aa001a17636c756270617274656e61697265737365727669636573c04ac00c000c0001000008aa0023206d6f6465726e65722d76657277616c74756e677361726265697473706c61747ac201c00c000c0001000008aa0015126d6963726f736f6674666f726566726f6e74c085c00c000c0001000008aa000c09666f726566726f6e74c39fc00c000c0001000008aa0013106a656465722d686174732d6472617566c04ac00c000c0001000008aa00100d77696e646f77736d6f62696c65c531c00c000c0001000008aa00110e65766572796f6e65676574736974c580c00c000c0001000008aa00131074686570686f6e652d636f6d70616e79c04ac00c000c0001000008aa00110e646f776e6c6f616467726f6f7665c116c00c000c0001000008aa0015126c6573646f6967747364616e736c656e657ac116c00c000c0001000008aa0014116d616e6167656669786564617373657473c04ac00c000c0001000008aa000c09707261786973746167c085c00c000c0001000008aa00150e65766572796f6e65676574736974036f7267c583c00c000c0001000008aa0015126f666672652d65626c6f75697373616e7465c04ac00c000c0001000008aa000c09697462727565636b65c04ac00c000c0001000008aa0014116d616e6167656669786564617373657473c0bfc00c000c0001000008aa000f0c6d6963726f736f6674646f70c116c00c000c0001000008aa000e0b77696e646f777332303030c2f0c00c000c0001000008aa0015126d6963726f736f6674666f726566726f6e74cc27c00c000c0001000008aa0016136e6f74666f7270726f66697473656d696e6172c04ac00c000c0001000008aa00120f696d6167696e657a6c617375697465c116c00c000c0001000008aa00100d726573706f6e7365706f696e74d6e4c00c000c0001000008aa000c09666f726566726f6e74df83c00c000c0001000008aa0013106e6f72746877696e6474726164657273c04ac00c000c0001000008aa00100d77696e646f77736d6f62696c65c201c00c000c0001000008aa00131069697377656263617374736572696573c0bfc00c000c0001000008aa001815636f6e736f6c6964617465646d657373656e676572c04ac00c000c0001000008aa00120d726573706f6e7365706f696e7402636300c00c000c0001000008aa0014116d616e6167656669786564617373657473c116c00c000c0001000008aa000e0977696e646f7773787002766300c00c000c0001000008aa00100d646f746e657465787065727473c2f0c00c000c0001000008aa00110e6a65646572686174736472617566c0bfc00c000c0001000008aa000f0c6e636f6d706173736c616273c04ac00c000c0001000008aa00110e65766572796f6e65676574736974c201c00c000c0001000008aa000d0a6c697477617265696e63c116c00c000c0001000008aa0021066f666672657317656e7472657072656e6575722d73757065726865726f73c04ac00c000c0001000008aa0015126d6963726f736f6674666f726566726f6e74d6e4c00c000c0001000008aa00100d72656e636f6e7472652d333630c116c00c000c0001000008aa000e0b6d756e63686f6e74686973c0bfc00c000c0001000008aa0015126d6963726f736f6674666f726566726f6e74df83c00c000c0001000008aa00120f696d6167696e657a6c617375697465c04ac00c000c0001000008aa0015126d6963726f736f6674666f726566726f6e74c0fcc00c000c0001000008aa00100d77696e646f77736e7432303030c0bfc00c000c0001000008aa000f0c6d6f6e2d7061636b2d70726fc04ac00c000c0001000008aa00110e646f776e6c6f616467726f6f7665c0bfc00c000c0001000008aa000c09646f742d7472757468c04ac00c000c0001000008aa00100d6465667261676d616e61676572c04ac00c000c0001000008aa000c0965727073797374656dcc27c00c000c0001000008aa00161372656c65766572746f75736c65736465666973c04ac00c000c0001000008aa0015126d6963726f736f6674666f726566726f6e74c04ac00c000c0001000008aa0013106f66667265732d6d6963726f736f6674c0bfc00c000c0001000008aa000c076f6e6d7977617902666900c00c000c0001000008aa000f0c746563686461797332303038c0bfc00c000c0001000008aa000906637368617270c116c00c000c0001000008aa0015126f666672652d65626c6f75697373616e7465c116c00c000c0001000008aa000906666c6578676fc158c00c000c0001000008aa0015126d737368617265706f696e74666f72756d73c0bfc00c000c0001000008aa000e0b6c6f6f6b6f7574736f6674c04ac00c000c0001000008aa001b126d6963726f736f6674666f726566726f6e7403636f6d02617200c00c000c0001000008aa0009066370616e646cc116c00c000c0001000008aa00120f6d7977696e646f77736d6f62696c65df7fc00c000c0001000008aa000c09706f636b65746d736ec580c00c000c0001000008aa00120f6f6e6c696e6573706f746c69676874c04ac00c000c0001000008aa000d0a6f666669636532303037c96bc00c000c0001000008aa001815636f6e736f6c6964617465646d657373656e676572c0bfc00c000c0001000008aa001a1777696e646f77736d6f62696c65636f6d6d6d756e697479c0bfc00c000c0001000008aa00201d6f6666696365736d616c6c627573696e6573736163636f756e74696e67c04ac00c000c0001000008aa00120f696d6167696e65726c617375697465c0bfc00c000c0001000008aa000b086e636f6d70617373c04ac00c000c0001000008aa00181577696e646f7773616e7974696d6575706772616465c04ac00c000c0001000008aa000e0b77696e646f777332303036cb07c00c000c0001000008aa0015126d6963726f736f6674666f726566726f6e74dde0c00c000c0001000008aa001411657874656e646572736d6172746c697374c04ac00c000c0001000008aa00110e646973636f766572746563686564c04ac00c000c0001000008aa0017126d6963726f736f6674666f726566726f6e74026a7000c00c000c0001000008aa0014116c756365726e657075626c697368696e67c0bfc00c000c0001000008aa0015126d6963726f736f6674666f726566726f6e74d22dc00c000c0001000008aa000b0872656d69782d3038c04ac00c000c0001000008aa00232077696e646f7773647269766572646576656c6f706572636f6e666572656e6365c116c00c000c0001000008aa00100d6f666669636572656164797063cb26c00c000c0001000008aa00110e6d6963726f736f66746174636573c04ac00c000c0001000008aa0017126d6963726f736f6674666f726566726f6e7402696500c00c000c0001000008aa000c09666f726566726f6e74cf52c00c000c0001000008aa000f0c666f75727468636f66666565c116c00c000c0001000008aa00120f6d7977696e646f77736d6f62696c65c06ac00c000c0001000008aa00100d6c6573626f6e736f7574696c73c04ac00c000c0001000008aa0015126d6963726f736f6674666f726566726f6e74c1c4c00c000c0001000008aa00110e6d6963726f736f667468656c7073c04ac00c000c0001000008aa001c196d6963726f736f6674627573696e6573737365637572697479c085c00c000c0001000008aa00100d776f6f6467726f766562616e6bc0bfc00c000c0001000008aa0014116c756365726e657075626c697368696e67c116c00c000c0001000008aa000f0c666f75727468636f66666565c0bfc00c000c0001000008aa0015126d6963726f736f6674666f726566726f6e74c7cbc00c000c0001000008aa000f0c636f686f76696e6579617264c116c00c000c0001000008aa000f0c6d6963726f736f6674646f70c0bfc00c000c0001000008aa000e0b77696e646f777372756279d696c00c000c0001000008aa000f086d736d6f62696c6504696e666f00c00c000c0001000008aa0015126d6963726f736f6674666f726566726f6e74c54cc00c000c0001000008aa00140d6d6f62696c65326d61726b6574046d6f626900c00c000c0001000008aa0015126d6963726f736f6674666f726566726f6e74d678c00c000c0001000008aa000e0b6d756e63686f6e74686973c04ac00c000c0001000008aa000b086370616475766f6cc116c00c000c0001000008aa000e0b70726f746563746d797063dde0c00c000c0001000008aa00161372656c65766572746f75736c65736465666973c116c00c000c0001000008aa00191677696e646f77736d6f62696c65636f6d6d756e697479c0bfc00c000c0001000008aa00120f736572766572756e6c656173686564c0bfc00c000c0001000008aa000b08706f636b65747063c04ac00c000c0001000008aa000f0c746563686461797332303038c04ac00c000c0001000008aa000d0a64697265637462616e64c04ac00c000c0001000008aa001b1877696e646f7773647269766572646576656c6f706d656e74c04ac00c000c0001000008aa000f0c647269766572646576636f6ec0bfc00c000c0001000008aa00191672657461696c65786563757469766573656d696e6172c0bfc00c000c0001000008aa000d0a77696e7465726e616c73c0bfc00c000c0001000008aa0019166c7574746572636f6e7472656c657069726174616765c04ac00c000c0001000008aa000b0877696e646f777870c432c00c000c0001000008aa001613736d61727470686f6e65636f6d6d756e697479c116c00c000c0001000008aa000b086d6170706f696e74c116c00c000c0001000008aa000d0a6c697477617265696e63c0bfc00c000c0001000008aa0019166772617068696364657369676e696e73746974757465c116c00c000c0001000008aa000b086d6163746f706961c04ac00c000c0001000008aa0015126d6963726f736f6674666f726566726f6e74cf56c00c000c0001000008aa0015126d737368617265706f696e74666f72756d73c116c00c000c0001000008aa000e0b746f726b74686567616d65c04ac00c000c0001000008aa0019166c65732d646f696774732d64616e732d6c652d6e657ac0bfc00c000c0001000008aa0015126d737368617265706f696e74666f72756d73c04ac00c000c0001000008aa00100d70726f74656374796f75727063dde0c00c000c0001000008aa0015127465636e6f6c6f67696179656d7072657361c0bfc00c000c0001000008aa00120f6d73646e746563686e6574746f7572c116c00c000c0001000008aa00100d72657461696c77656263617374c04ac00c000c0001000008aa00120f736f7574687269646765766964656fc116c00c000c0001000008aa000e0b63616d70757367616d6573c54cc00c000c0001000008aa001613636f6e666f726d6974652d6c6963656e636573c04ac00c000c0001000008aa0015127465636e6f6c6f67696179656d7072657361c04ac00c000c0001000008aa0015126d6963726f736f6674666f726566726f6e74c347c00c000c0001000008aa001a1777696e646f77736d6f62696c65636f6d6d6d756e697479c116c00c000c0001000008aa000e0b77696e67746970746f7973c116c00c000c0001000008aa000d0a6f666669636532303037c04ac00c000c0001000008aa0019166c7574746572636f6e7472656c657069726174616765c116c00c000c0001000008aa00100d72656e636f6e74726573333630c0bfc00c000c0001000008aa001512746865736572766572756e6c656173686564c116c00c000c0001000008aa00120f6d6963726f736f66746d6f62696c65cb07c00c000c0001000008aa00120f6d73646e746563686e6574746f7572c0bfc00c000c0001000008aa00100d77696e646f77736d6f62696c65d6e4c00c000c0001000008aa000f0c7061636b746f7574656e756ec116c00c000c0001000008aa00150c77696e646f7773766973746103636f6d02747200c00c000c0001000008aa00100d6d6f62696c65326d61726b6574c04ac00c000c0001000008aa00120f63656e747265646573757361676573c04ac00c000c0001000008aa00100b77696e646f77733230303002736b00c00c000c0001000008aa00100d77696e646f77736d6f62696c65c580c00c000c0001000008aa000b087465636865643036c04ac00c000c0001000008aa001815636f686f76696e6579617264616e6477696e657279c0bfc00c000c0001000008aa000f0c657264636f6d6d616e646572c04ac00c000c0001000008aa0015127465636e6f6c6f67696179656d7072657361c116c00c000c0001000008aa000f0c747265797265736561726368c0bfc00c000c0001000008aa00181170696374757265697470726f6475637473036d736ec04ac00c000c0001000008aa00100d776f6f6467726f766562616e6bc116c00c000c0001000008aa000805776d766864c04ac00c000c0001000008aa0013106f66667265732d6d6963726f736f6674c116c00c000c0001000008aa00120f63656e747265646573757361676573c116c00c000c0001000008aa00100977696e646f77736e74046e616d6500c00c000c0001000008aa000a0777696e646f7773c116c00c000c0001000008aa001310746f646f736c6f656e7469656e64656ec04ac00c000c0001000008aa00161372656c6576657a746f75736c65736465666973c158c00c000c0001000008aa00141164656679616c6c6368616c6c656e676573c347c00c000c0001000008aa000e0b6374726f70656e6f726d65c0bfc00c000c0001000008aa00100977696e646f77736e740367656ec678c00c000c0001000008aa000d0a636f686f77696e657279c0bfc00c000c0001000008aa00120f6c6f67697374696b6b73797374656dcc27c00c000c0001000008aa00110977696e646f7773787002707002617a00c00c000c0001000008aa000c0970726f736577617265c0bfc00c000c0001000008aa00110e6a65646572686174736472617566c04ac00c000c0001000008aa000d0a6c696e7465726e616c73c04ac00c000c0001000008aa0014116d6f62696c657063646576656c6f706572c116c00c000c0001000008aa00151277696e646f7773656d6265646465646b6974c04ac00c000c0001000008aa000f0c76697375616c73747564696fc116c00c000c0001000008aa000e0b77696e646f77736c6f676fc116c00c000c0001000008aa000d0a77696e7465726e616c73cb07c00c000c0001000008aa00252272656e636f6e747265732d636f6c6c6563746976697465732d6d6963726f736f6674c04ac00c000c0001000008aa000a0769742d6865726fd6e4c00c000c0001000008aa000a0777696e646f7773cc27c00c000c0001000008aa000d0a6c697477617265696e63c04ac00c000c0001000008aa000b086370616475766f6cc04ac00c000c0001000008aa00120f6d7977696e646f77736d6f62696c65cc9fc00c000c0001000008aa001c196d6963726f736f66746c6963656e736573746174656d656e74c04ac00c000c0001000008aa000a0772656d69783038c0bfc00c000c0001000008aa000d0a77696e7465726e616c73c201c00c000c0001000008aa001310746563686e65746368616c6c656e6765c04ac00c000c0001000008aa000a076e746673646f73c04ac00c000c0001000008aa001310746f646f736c6f656e7469656e64656ec0bfc00c000c0001000008aa00130e73707261766e6f75636573746f7502637a00c00c000c0001000008aa0019166c65732d646f696774732d64616e732d6c652d6e657ac116c00c000c0001000008aa00100d6d6963726f736f6674686f6d65c54cc00c000c0001000008aa000e0b7061636b746f7574656e31c04ac00c000c0001000008aa001916666f65726465726d697474656c2d7261746765626572c201c00c000c0001000008aa000d0a77696e7465726e616c73c580c00c000c0001000008aa00161372656c6576657a746f75736c65736465666973c54cc00c000c0001000008aa00100d6d6f62696c65326d61726b6574c32dc00c000c0001000008aa00252277696e646f7773647269766572646576656c6f706d656e74636f6e666572656e6365c0bfc00c000c0001000008aa00120977696e646f77736e74036f726702627a00c00c000c0001000008aa00100d72656e636f6e7472652d333630c04ac00c000c0001000008aa00110e6d6963726f736f667468656c7073c54cc00c000c0001000008aa00232077696e646f7773647269766572646576656c6f706572636f6e666572656e6365c04ac00c000c0001000008aa0019166772617068696364657369676e696e73746974757465c0bfc00c000c0001000008aa0019166d69677265727665727376697375616c73747564696fc04ac00c000c0001000008aa000f0c6d736f666669636532303037c1c4c00c000c0001000008aa00120f63656e747265646573757361676573c158c00c000c0001000008aa00252277696e646f7773647269766572646576656c6f706d656e74636f6e666572656e6365c116c00c000c0001000008aa00110c77696e646f7773766973746102626700c00c000c0001000008aa000c0977696e646f77733938f3fac00c000c0001000008aa00120f6d6963726f736f66746d6f62696c65edf7c00c000c0001000008aa00120f736f7574687269646765766964656fc0bfc00c000c0001000008aa0016136f666672652d65626c6f75697373616e746573c04ac00c000c0001000008aa000f0c746564736c656d6f6e616964c04ac00c000c0001000008aa000e0b6e69676874636173746572c04ac00c000c0001000008aa00110e6d6f62696c6574656368746f7572c0bfc00c000c0001000008aa00100977696e646f77736e74036e6574c0fcc00c000c0001000008aa00100d6f70656e74797065666f72756dc116c00c000c0001000008aa000c09776861636b65647476c04ac00c000c0001000008aa000f0c6d6963726f736f6674646f70c04ac00c000c0001000008aa000c0977696e646f77736e74c4edc00c000c0001000008aa00100d77696e646f77736d6f62696c65c1c4c00c000c0001000008aa000c0977696e646f77737870c436c00c000c0001000008aa001b1877696e646f7773647269766572646576656c6f706d656e74c116c00c000c0001000008aa000b086263656e7472616cc54cc00c000c0001000008aa00151277696465776f726c64696d706f7274657273c04ac00c000c0001000008aa000c097374756f73626f726ec0bfc00c000c0001000008aa000f0c7461696c7370696e746f7973c04ac00c000c0001000008aa0013106d616b656f7665726d796f6666696365c04ac00c000c0001000008aa000d0a6d7366746d6f62696c65c116c00c000c0001000008aa0015126c6573646f6967747364616e736c656e657ac04ac00c000c0001000008aa0015126d6963726f736f6674666f726566726f6e74c06ac00c000c0001000008aa0015126d6963726f736f6674666f726566726f6e74c678c00c000c0001000008aa00161372656c6576657a746f75736c65736465666973c04ac00c000c0001000008aa00100d6d73646e6368616c6c656e6765c04ac00c000c0001000008aa0019166f6666696365706f75726c65736574756469616e7473c116c00c000c0001000008aa00120f736f7574687269646765766964656fc04ac00c000c0001000008aa00191672657461696c65786563757469766573656d696e6172c116c00c000c0001000008aa00110e6d6f62696c657365727669636573edf7c00c000c0001000008aa001307776562686f7374086e61766973696f6ec04ac00c000c0001000008aa00100d726573706f6e7365706f696e74f3a0c00c000c0001000008aa00120b7a65726f76697275736573036f7267dde3c00c000c0001000008aa00120f6d7977696e646f77736d6f62696c65c347c00c000c0001000008aa0016136f666672652d65626c6f75697373616e746573c116c00c000c0001000008aa00100d77696e646f77736d6f62696c65df83c00c000c0001000008aa0015126d6f62696c657063646576656c6f70657273c0bfc00c000c0001000008aa00100977696e646f77736e7403636f6df9cec00c000c0001000008aa000d0a77696e7465726e616c73c116c00c000c0001000008aa00100d747670686f746f766965776572c04ac00c000c0001000008aa00191677696e646f77736d6f62696c65636f6d6d756e697479c04ac00c000c0001000008aa00100b77696e646f77737275627902766e00c00c000c0001000008aa00100d6d6f62696c6564657669636573edf7c00c000c0001000008aa000f0c746563686564626f73746f6ec04ac00c000c0001000008aa00110e6d6f62696c6574656368746f7572c04ac00c000c0001000008aa00100d74617675746174726f6e636865c04ac00c000c0001000008aa00110e706179726f6c6c77656263617374c04ac00c000c0001000008aa00100d776577616e7474686562657374c04ac00c000c0001000008aa00151277696465776f726c64696d706f7274657273c0bfc00c000c0001000008aa001a1777696e646f77736d6f62696c65636f6d6d6d756e697479c04ac00c000c0001000008aa001c196d6963726f736f66746c6963656e736573746174656d656e74c54cc00c000c0001000008aa0015126d6963726f736f6674697461636164656d79c04ac00c000c0001000008aa00100d72656e636f6e7472652d333630c0bfc00c000c0001000008aa000c0977696e646f77737870c30ec00c000c0001000008aa000c0977696e646f77736e74c7a8c00c000c0001000008aa0015126d6963726f736f6674666f726566726f6e74cb26c00c000c0001000008aa000e0b77696e67746970746f7973c04ac00c000c0001000008aa001613737570706f727477696e646f77737669737461c158c00c000c0001000008aa0013106e6f72746877696e6474726164657273c0bfc00c000c0001000008aa00232077696e646f7773647269766572646576656c6f706572636f6e666572656e6365c0bfc00c000c0001000008aa000e0b76796b6b6572736c616273c04ac00c000c0001000008aa0015126d6963726f736f6674666f726566726f6e74c18bc00c000c0001000008aa000f0c747265797265736561726368c116c00c000c0001000008aa000c09746563686564766970c04ac00c000c0001000008aa00191677696e646f77736d6f62696c65636f6d6d756e697479c116c00c000c0001000008aa000e0b74696d6534746563686564c04ac00c000c0001000008aa000f0c72656e636f6e747265333630c0bfc00c000c0001000008aa0014116d6963726f736f6674736d616c6c62697ac04ac00c000c0001000008aa00191677696e646f7773647269766572646576656c6f706572c116c00c000c0001000008aa0014116d616e616765636f6c6c656374696f6e73c04ac00c000c0001000008aa000b086263656e7472616cc531c00c000c0001000008aa00100d706f776572746f676574686572c04ac00c000c0001000008aa00191677696e646f7773647269766572646576656c6f706572c04ac00c000c0001000008aa000a077265736b697473c04ac00c000c0001000008aa0015126d6963726f736f6674666f726566726f6e74c201c00c000c0001000008aa00161377696e7465726e616c737265736f7572636573c04ac00c000c0001000008aa000c0977696e646f77736e74f3fac00c000c0001000008aa00100977696e646f77736e74036f7267cc81c00c000c0001000008aa0015126d6963726f736f6674666f726566726f6e74e8acc00c000c0001000008aa00230e64657369676e6564666f726269670264650e64657369676e6564666f72626967c201c00c000c0001000008aa00141164656679616c6c6368616c6c656e676573c7cbc00c000c0001000008aa000e0977696e646f7773787002676d00c00c000c0001000008aa00151277696e7465726e616c73736f667477617265c04ac00c000c0001000008aa00151277696465776f726c64696d706f7274657273c116c00c000c0001000008aa000e0b77696e646f777372756279ec43c00c000c0001000008aa000a0772656d69783038c116c00c000c0001000008aa000f0c6d61696e66756e6374696f6ec04ac00c000c0001000008aa000d0a7374756f73626f726e65c04ac00c000c0001000008aa000f0c6f666669636573797374656ddde0c00c000c0001000008aa001e1b6d6963726f736f66742d627573696e6573732d7365637572697479c085c00c000c0001000008aa000e0b77696e646f777372756279c201c00c000c0001000008aa000b0872656d69782d3038c116c00c000c0001000008aa00120f7265616c6d656e74656772616e6465c04ac00c000c0001000008aa0008056d73657070c04ac00c000c0001000008aa00100d77696e646f77736d6f62696c65df7fc00c000c0001000008aa00110e72656e636f6e747265732d333630c116c00c000c0001000008aa00100977696e646f77736e74036e6574f656c00c000c0001000008aa00100d7374756f73626f726e73686f77c04ac00c000c0001000008aa0018156d6963726f736f66746269636f6e666572656e6365c04ac00c000c0001000008aa000b0877696e646f777870d804c00c000c0001000008aa000e0b696e6e6f766174652d756bc116c00c000c0001000008aa00141164656679616c6c6368616c6c656e676573d696c00c000c0001000008aa0015126d6963726f736f6674666f726566726f6e74c116c00c000c0001000008aa00100977696e646f77736e74036e6574f9cec00c000c0001000008aa00160f65756772616e747361647669736f7203636f6dda48c00c000c0001000008aa00120f696d6167696e65726c617375697465c116c00c000c0001000008aa00120f736572766572756e6c656173686564c116c00c000c0001000008aa00110e64657369676e6564666f72626967cc27c00c000c0001000008aa000e0b667278736f667477617265c04ac00c000c0001000008aa000f0c6d6f6e2d7061636b2d70726fc0bfc00c000c0001000008aa000d0a73686172656476696577c04ac00c000c0001000008aa00110977696e646f77736e7402636f02637200c00c000c0001000008aa000e0b77696e646f777372756279c085c00c000c0001000008aa00140c77696e646f7773766973746102636f02696400c00c000c0001000008aa00141164656679616c6c6368616c6c656e676573c2f0c00c000c0001000008aa00110e676174656b656570657274657374c2f0c00c000c0001000008aa000e0b77696e646f777372756279c18bc00c000c0001000008aa000e0b66616d696c797761766573c54cc00c000c0001000008aa00120f6f6e6c696e6573706f746c69676874c116c00c000c0001000008aa00120f65756772616e747361647669736f72f8a8c00c000c0001000008aa000b06666c6578676f026d7000c00c000c0001000008aa001613696d706f737369626c65637265617475726573c54cc00c000c0001000008aa00170f65756772616e747361647669736f7202636f02687500c00c000c0001000008aa000c0977696e646f77736e74c7e9c00c000c0001000008aa000906666c6578676fec43c00c000c0001000008aa00120f65756772616e747361647669736f72da48c00c000c0001000008aa000e0b77696e646f777372756279c951c00c000c0001000008aa00120f6d7977696e646f77736d6f62696c65c54cc00c000c0001000008aa00110e64657369676e6564666f72626967ec43c00c000c0001000008aa0015126f666672652d65626c6f75697373616e7465c0bfc00c000c0001000008aa00100977696e646f77737870036f7267c436c00c000c0001000008aa000b0872656d69782d3038c0bfc00c000c0001000008aa000e0977696e646f77737870026e6600c00c000c0001000008aa00191672657461696c65786563757469766573656d696e6172c04ac00c000c0001000008aa000b086d6163746f706961c116c00c000c0001000008aa00100d6d6f62696c6564657669636573cb07c00c000c0001000008aa000a0773776175646974f3fac00c000c0001000008aa00110e726973656f667065726174686961c0bfc00c000c0001000008aa00252272656e636f6e747265732d636f6c6c6563746976697465732d6d6963726f736f6674c116c00c000c0001000008aa00141177696e646f777373657276657232303038c0fcc00c000c0001000008aa000c096d73706172746e6572c04ac00c000c0001000008aa00110e6f66667265732d656e6f726d6573c04ac00c000c0001000008aa00100d74617675746174726f6e636865c0bfc00c000c0001000008aa00100d6d61726769657374726176656cc04ac00c000c0001000008aa00120f65756772616e747361647669736f72e429c00c000c0001000008aa00161372656c6576657a746f75736c65736465666973c0bfc00c000c0001000008aa000d0a74656368656474696d65c04ac00c000c0001000008aa0019166d6963726f736f667464656d616e64706c616e6e6572c04ac00c000c0001000008aa000e0b77696e646f77736c6f676fc04ac00c000c0001000008aa001a176d6963726f736f6674627573696e657373617761726473c04ac00c000c0001000008aa00130b77696e646f77737275627902636f027a6100c00c000c0001000008aa00110c77696e646f77737669737461026e7500c00c000c0001000008aa00171477696e646f7773787067616d6561647669736f72c04ac00c000c0001000008aa00100d747670686f746f766965776572c59cc00c000c0001000008aa00110e64657369676e6564666f72626967c32dc00c000c0001000008aa000f0c77696e7465726e616c736573c04ac00c000c0001000008aa0015126d6963726f736f6674666f726566726f6e74c84bc00c000c0001000008aa000f0c6e666c666576657232303032c04ac00c000c0001000008aa00100d726573706f6e7365706f696e74c65fc00c000c0001000008aa00140f65756772616e747361647669736f7202656500c00c000c0001000008aa000b086e636f6d70617373c54cc00c000c0001000008aa001512746865736572766572756e6c656173686564c04ac00c000c0001000008aa000b06666c6578676f02687400c00c000c0001000008aa00161372656c6576657a746f75736c65736465666973c116c00c000c0001000008aa00110e72657475726e746f746563686564c04ac00c000c0001000008aa00100977696e646f77736e7403636f6dc7edc00c000c0001000008aa000e0b77696e646f777372756279da48c00c000c0001000008aa000e0b77696e646f777372756279c82bc00c000c0001000008aa00130b77696e646f77737275627902636f02687500c00c000c0001000008aa000d0a65737469656d706f6465c0bfc00c000c0001000008aa00110e676174656b656570657274657374c085c00c000c0001000008aa00131074686570686f6e652d636f6d70616e79c0bfc00c000c0001000008aa00120f6865726f7368617070656e68657265dde0c00c000c0001000008aa00100b77696e646f77737275627902616500c00c000c0001000008aa00100977696e646f7773787003636f6dc456c00c000c0001000008aa00161372656c65766572746f75736c65736465666973c0bfc00c000c0001000008aa000f0c75732d6d6963726f736f6674c04ac00c000c0001000008aa0017147669737461666f72796f7572627573696e657373c04ac00c000c0001000008aa000f0c746563686d616b656f766572dde0c00c000c0001000008aa00100977696e646f777378700362697ac0fcc00c000c0001000008aa001b03777777146d6963726f736f6674737570706c79636861696ec04ac00c000c0001000008aa00120977696e646f777378700377656202746a00c00c000c0001000008aa000b0877696e646f777870cc61c00c000c0001000008aa00120f65756772616e747361647669736f72cc27c00c000c0001000008aa000906666c6578676fd6e4c00c000c0001000008aa00110e667574757265706f73746d61696cc116c00c000c0001000008aa000c097374756f73626f726ec116c00c000c0001000008aa0014116d6963726f736f667464796e616d696373c158c00c000c0001000008aa00110e72656e636f6e747265732d333630c0bfc00c000c0001000008aa00100d726973656f666e6174696f6e73c54cc00c000c0001000008aa0009067265736b6974c04ac00c000c0001000008aa00160e64657369676e6564666f7262696702636f027a6100c00c000c0001000008aa000a07737570706f7274e66dc00c000c0001000008aa000f0877696e646f777870036f7267c436c00c000c0001000008aa001a176d6963726f736f6674627573696e657373617761726473c116c00c000c0001000008aa00131074686570686f6e652d636f6d70616e79c116c00c000c0001000008aa0009066d7377776870c04ac00c000c0001000008aa000e0b77696e646f777372756279e429c00c000c0001000008aa00110e64657369676e6564666f72626967c085c00c000c0001000008aa000a0774656d70757269c0bfc00c000c0001000008aa00110e64657369676e6564666f72626967c347c00c000c0001000008aa000e0977696e646f77736e7402636600c00c000c0001000008aa001310746f646f736c6f656e7469656e64656ec531c00c000c0001000008aa000b06666c6578676f02706b00c00c000c0001000008aa0015126d6963726f736f6674666f726566726f6e74cf52c00c000c0001000008aa000e0b77696e646f777372756279c96bc00c000c0001000008aa00151277656273746f72616765706172746e657273c04ac00c000c0001000008aa00120f65756772616e747361647669736f72c347c00c000c0001000008aa000d0a77696e7465726e616c73edf7c00c000c0001000008aa00120977696e646f7773787003636f6d02746a00c00c000c0001000008aa001411726576656e7565616e64657870656e7365c04ac00c000c0001000008aa00110e64657369676e6564666f72626967c21dc00c000c0001000008aa001411636f6e636572746d6f62696c656c697665c54cc00c000c0001000008aa00100d72656e636f6e74726573333630c116c00c000c0001000008aa00110e766973696f696e666f776f636865c201c00c000c0001000008aa000e0977696e646f77737870026d6400c00c000c0001000008aa00140f65756772616e747361647669736f7202736900c00c000c0001000008aa000e0b77696e646f777372756279d3f7c00c000c0001000008aa000f0c77696e696e7465726e616c73c04ac00c000c0001000008aa00100d68617a6d6173766976656d6173c04ac00c000c0001000008aa000b086263656e7472616cc201c00c000c0001000008aa001512746865736572766572756e6c656173686564c0bfc00c000c0001000008aa0013106865726f657368617070656e68657265dde0c00c000c0001000008aa000a0772656d69783038c04ac00c000c0001000008aa001310746f646f736c6f656e7469656e64656ec116c00c000c0001000008aa00100977696e646f77736e74036f7267f656c00c000c0001000008aa0019166d69677265727665727376697375616c73747564696fc116c00c000c0001000008aa0015126d6963726f736f6674666f726566726f6e74c498c00c000c0001000008aa000c0977696e646f77737870cf52c00c000c0001000008aa000e0b696e6e6f766174652d756bc0bfc00c000c0001000008aa00100977696e646f7773787003636f6dc381c00c000c0001000008aa000c09766973696f32303033c201c00c000c0001000008aa000d0a796f7572746563686564c04ac00c000c0001000008aa00120b77696e646f77737275627903636f6dc951c00c000c0001000008aa00120977696e646f77736e7403636f6d026a6d00c00c000c0001000008aa00110e64657369676e6564666f72626967cb07c00c000c0001000008aa000e0b6d756e63686f6e74686973c116c00c000c0001000008aa00120f65756772616e747361647669736f72c531c00c000c0001000008aa00110e64657369676e6564666f72626967cb26c00c000c0001000008aa000d0a6d7366746d6f62696c65c0bfc00c000c0001000008aa000f0c746563686461797332303038c116c00c000c0001000008aa000906666c6578676fdb0ec00c000c0001000008aa00110e667574757265706f73746d61696cc04ac00c000c0001000008aa00171464657361666961746f646f736c6f737265746f73c04ac00c000c0001000008aa00120f65756772616e747361647669736f72c201c00c000c0001000008aa00100977696e646f7773787003636f6df656c00c000c0001000008aa001815636f686f76696e6579617264616e6477696e657279c116c00c000c0001000008aa00120b77696e646f77737275627903636f6dc39fc00c000c0001000008aa000d0877696e646f77787002686d00c00c000c0001000008aa00100d676f746f7779646f7072616379c0fcc00c000c0001000008aa000d0a6f666669636532303037c201c00c000c0001000008aa00110e64657369676e6564666f72626967c54cc00c000c0001000008aa000e0b77696e646f777372756279f8a8c00c000c0001000008aa000c09726166616574617469d702c00c000c0001000008aa00180f65756772616e747361647669736f7203636f6d02637900c00c000c0001000008aa00120f6d736163726f7373616d6572696361c04ac00c000c0001000008aa001613736d61727470686f6e65636f6d6d756e697479c0bfc00c000c0001000008aa000e0977696e646f7773787002727700c00c000c0001000008aa00120977696e646f777378700362697a02706b00c00c000c0001000008aa00110e64657369676e6564666f72626967c0bfc00c000c0001000008aa000d0a6672787265706f727473c04ac00c000c0001000008aa00110e72656e636f6e747265732d333630c04ac00c000c0001000008aa001411636f6e73756c746f72696f6f6666696365c531c00c000c0001000008aa000d06666c6578676f03636f6dffdec00c000c0001000008aa000e0b77696e646f777372756279dde0c00c000c0001000008aa00110c77696e646f7773766973746102697300c00c000c0001000008aa00141164656679616c6c6368616c6c656e676573c580c00c000c0001000008aa00100d7374756f73626f726e73686f77c116c00c000c0001000008aa00100d726573706f6e7365706f696e74c0fcc00c000c0001000008aa000e0b696e6e6f766174652d756bc04ac00c000c0001000008aa00120f65756772616e747361647669736f72c580c00c000c0001000008aa000d0a7369646577696e646572edf7c00c000c0001000008aa00120f6d6963726f73667473757266616365c04ac00c000c0001000008aa000e0b77696e646f777372756279c476c00c000c0001000008aa000e0977696e646f7773787002627300c00c000c0001000008aa00120f65756772616e747361647669736f72cb07c00c000c0001000008aa00110e64657369676e6564666f72626967d3f7c00c000c0001000008aa000d0877696e646f77787002746f00c00c000c0001000008aa00120f65756772616e747361647669736f72f3fac00c000c0001000008aa00120f65756772616e747361647669736f72d696c00c000c0001000008aa00110e7374756f73626f726e6573686f77c04ac00c000c0001000008aa00120f65756772616e747361647669736f72c2f0c00c000c0001000008aa000906747279696973c04ac00c000c0001000008aa00110e7374756f73626f726e6573686f77c116c00c000c0001000008aa00151273636174656e61696c74756f736572766572c1c4c00c000c0001000008aa00100d76697375616c2d73747564696fc04ac00c000c0001000008aa0016137072657373746865677265656e627574746f6ec116c00c000c0001000008aa000e0b77696e646f777372756279c2f0c00c000c0001000008aa000c0977696e646f77737870d35ac00c000c0001000008aa000b06666c6578676f02617300c00c000c0001000008aa000b086263656e7472616cc1c4c00c000c0001000008aa0015126e6261696e73696465647269766532303033c04ac00c000c0001000008aa00120977696e646f777378700362697a02746a00c00c000c0001000008aa00100977696e646f7773787003636f6dc2b5c00c000c0001000008aa00120f736572766572756e6c656173686564c04ac00c000c0001000008aa000c0977696e646f77737870c9c9c00c000c0001000008aa00221f6d6f6465726e657276657277616c74756e677361726265697473706c61747ac201c00c000c0001000008aa00090661747461696ecc27c00c000c0001000008aa00120977696e646f7773787003636f6d02627300c00c000c0001000008aa000906666c6578676fffdec00c000c0001000008aa000f0c77696e646f77737669737461f9cec00c000c0001000008aa00120f65756772616e747361647669736f72f3a0c00c000c0001000008aa000e0b77696e646f777332303030c04ac00c000c0001000008aa00120f65756772616e747361647669736f72c085c00c000c0001000008aa00110977696e646f7773787002636f02696d00c00c000c0001000008aa000c0977696e646f77737870fbe9c00c000c0001000008aa000e0977696e646f7773787002696f00c00c000c0001000008aa000906666c6578676fc96bc00c000c0001000008aa000d0a6f666669636532303037c158c00c000c0001000008aa001411636f6e73756c746f72696f6f6666696365c116c00c000c0001000008aa00120d726573706f6e7365706f696e7402616500c00c000c0001000008aa000e0b77696e646f777372756279c678c00c000c0001000008aa000e0b77696e646f777372756279c7cbc00c000c0001000008aa001512746f646f732d6c6f2d656e7469656e64656ec531c00c000c0001000008aa000e0b77696e646f777372756279c158c00c000c0001000008aa00110c77696e646f77737669737461026c6100c00c000c0001000008aa00100977696e646f77737870036f7267c456c00c000c0001000008aa00110e726973656f667065726174686961c116c00c000c0001000008aa001a176d6963726f736f6674627573696e657373617761726473c0bfc00c000c0001000008aa000f0977696e646f7773787002636fce71c00c000c0001000008aa000906666c6578676fd702c00c000c0001000008aa000e0b7265616c69747966616d65c54cc00c000c0001000008aa00120f65756772616e747361647669736f72c158c00c000c0001000008aa00120977696e646f77737870036f7267026a6500c00c000c0001000008aa000906617a7572696bc04ac00c000c0001000008aa00120f73657276657273636174656e61746fc1c4c00c000c0001000008aa000e0b6e61766973696f6e78616ccc27c00c000c0001000008aa000f0c74687265652d646567726565c04ac00c000c0001000008aa000e0977696e646f7773787002616300c00c000c0001000008aa00100977696e646f77737870036e6574c456c00c000c0001000008aa000f0977696e646f7773787002636fc3dac00c000c0001000008aa00100977696e646f77737870036f7267c7edc00c000c0001000008aa000c0977696e646f77737870c04ac00c000c0001000008aa00120d726573706f6e7365706f696e7402687500c00c000c0001000008aa000f0c646972656374616363657373c0bfc00c000c0001000008aa00100d726573706f6e7365706f696e74c32dc00c000c0001000008aa00100977696e646f77737870036e6574c3dac00c000c0001000008aa00100d6d6963726f736f667473706c61c04ac00c000c0001000008aa00100d76657374706f636b657463666fc116c00c000c0001000008aa00120f65756772616e747361647669736f72d3f7c00c000c0001000008aa00100977696e646f7773787003696e74f656c00c000c0001000008aa000d0a6f666669636532303037dde0c00c000c0001000008aa00100d7374756f73626f726e73686f77c0bfc00c000c0001000008aa00100977696e646f7773787003636f6dcfd5c00c000c0001000008aa00110e7374756f73626f726e6573686f77c0bfc00c000c0001000008aa00110e64657369676e6564666f72626967c498c00c000c0001000008aa00150d726573706f6e7365706f696e7402636f027a6100c00c000c0001000008aa000c0977696e646f77737870d183c00c000c0001000008aa0014116d6963726f736f66746d6f6d656e74756dc04ac00c000c0001000008aa00120d726573706f6e7365706f696e7402777300c00c000c0001000008aa000c0977696e646f77737870ff66c00c000c0001000008aa000e0977696e646f7773787002617300c00c000c0001000008aa001b1877696e646f7773647269766572646576656c6f706d656e74c0bfc00c000c0001000008aa00110977696e646f7773787002636f02636b00c00c000c0001000008aa00120f686f6d652d7075626c697368696e67c04ac00c000c0001000008aa001a176d6963726f736f6674627573696e657373617761726473c531c00c000c0001000008aa00110e64657369676e6564666f72626967c2f0c00c000c0001000008aa00100977696e646f77736e7403696e74f656c00c000c0001000008aa000e0b77696e646f777372756279d6e4c00c000c0001000008aa000d0877696e646f777870026e6600c00c000c0001000008aa00100977696e646f77737870036f6666c7acc00c000c0001000008aa000f0c6d6f6e2d7061636b2d70726fc116c00c000c0001000008aa00100d747670686f746f766965776572c116c00c000c0001000008aa000e0b77696e646f777372756279c65fc00c000c0001000008aa00100d74617675746174726f6e636865c116c00c000c0001000008aa00110977696e646f77737870046669726dc381c00c000c0001000008aa000d0a64616e69736372617a79c04ac00c000c0001000008aa00171477696e646f7773787067616d6561647669736f72c116c00c000c0001000008aa000b086263656e7472616cc7cbc00c000c0001000008aa001a176265737365727769737365722d77657474626577657262c201c00c000c0001000008aa000e0b77696e646f777332303030c116c00c000c0001000008aa0011096d6963726f736f667402636f026d7a00c00c000c0001000008aa000906666c6578676fc580c00c000c0001000008aa000e06666c6578676f02636f02637200c00c000c0001000008aa00120f65756772616e747361647669736f72c0fcc00c000c0001000008aa00120f65756772616e747361647669736f72c30ec00c000c0001000008aa000f0c72656e636f6e747265333630c116c00c000c0001000008aa000b0877696e646f777870dfbfc00c000c0001000008aa00110e676174656b656570657274657374c0fcc00c000c0001000008aa000c0977696e646f77737870f656c00c000c0001000008aa000e0877696e646f77787002636fce71c00c000c0001000008aa00100977696e646f77737870036f7267f656c00c000c0001000008aa00120977696e646f77737870036e657402706b00c00c000c0001000008aa000c09666f726566726f6e74e8acc00c000c0001000008aa00120977696e646f7773787003636f6d02656300c00c000c0001000008aa001714617a7572696b726973656f667065726174686961c04ac00c000c0001000008aa0019166d616e616765796f757270656f706c65617373657473c04ac00c000c0001000008aa000f0877696e646f777870036e6574dfbfc00c000c0001000008aa001512626c7565796f6e6465726169726c696e6573c116c00c000c0001000008aa000b086263656e7472616cc84bc00c000c0001000008aa000e0977696e646f77737870026c6b00c00c000c0001000008aa000e0b77696e646f777372756279d702c00c000c0001000008aa000906666c6578676fd696c00c000c0001000008aa00131077696e646f77737669737461626c6f67c158c00c000c0001000008aa000d0a65737469656d706f6465c04ac00c000c0001000008aa00100d726573706f6e7365706f696e74c201c00c000c0001000008aa00120f65756772616e747361647669736f72c84bc00c000c0001000008aa00141164656679616c6c6368616c6c656e676573e8acc00c000c0001000008aa00100d726573706f6e7365706f696e74ee38c00c000c0001000008aa000d0a65737469656d706f6465c116c00c000c0001000008aa00120977696e646f7773787003636f6d026e6600c00c000c0001000008aa00120977696e646f7773787003636f6d02756100c00c000c0001000008aa000f0977696e646f7773787002636fc7edc00c000c0001000008aa00100d737465776f73626f7273686f77c116c00c000c0001000008aa00120b77696e646f77737275627903636f6dc158c00c000c0001000008aa001714617a7572696b726973656f667065726174686961c116c00c000c0001000008aa00100977696e646f77737870036e6574dfbfc00c000c0001000008aa00100d737465776f73626f7273686f77c0bfc00c000c0001000008aa000c0977696e646f77737870f9cac00c000c0001000008aa00120977696e646f77737870036f726702706500c00c000c0001000008aa000c06666c6578676f02636fc7edc00c000c0001000008aa00100977696e646f77737870036f7267cc81c00c000c0001000008aa0013106865726f657368617070656e68657265c0fcc00c000c0001000008aa00100977696e646f77737870036e6574f9cec00c000c0001000008aa00100977696e646f7773787003636f6ddfbfc00c000c0001000008aa001411756b636f6d6d756e697479617761726473c04ac00c000c0001000008aa00252272656e636f6e747265732d636f6c6c6563746976697465732d6d6963726f736f6674c0bfc00c000c0001000008aa00100977696e646f77737870036e6574f656c00c000c0001000008aa00100977696e646f7773787003636f6dcdc4c00c000c0001000008aa00100d726573706f6e7365706f696e74c456c00c000c0001000008aa000d0a7374756f73626f726e65c0bfc00c000c0001000008aa000906666c6578676fcb26c00c000c0001000008aa00120d726573706f6e7365706f696e7402656300c00c000c0001000008aa000c09626570636c6567616cc0bfc00c000c0001000008aa000a0777696e32303030c84bc00c000c0001000008aa0014117365727665757273616e736c696d697465c0bfc00c000c0001000008aa000e037777770764657664617973dde0c00c000c0001000008aa000e0977696e646f77737870026c6900c00c000c0001000008aa000d0a6f666669636532303037c7cbc00c000c0001000008aa00100d726573706f6e7365706f696e74f8a8c00c000c0001000008aa00100977696e646f77737870036f7267cfd5c00c000c0001000008aa00160f65756772616e747361647669736f7203636f6dc381c00c000c0001000008aa00160d726573706f6e7365706f696e7403636f6d02706100c00c000c0001000008aa000e0977696e646f7773787002686d00c00c000c0001000008aa000e0977696e646f77737870026c6100c00c000c0001000008aa00120f65756772616e747361647669736f72ec43c00c000c0001000008aa000e0b77696e646f777372756279c0fcc00c000c0001000008aa000c097374756f73626f726ec04ac00c000c0001000008aa000e0977696e646f7773787002737400c00c000c0001000008aa00120f65756772616e747361647669736f72cb26c00c000c0001000008aa000b08676f6d656e74616cc54cc00c000c0001000008aa00100977696e646f77737870036e6574c23bc00c000c0001000008aa000b0877696e646f777870d720c00c000c0001000008aa00100d726573706f6e7365706f696e74edf7c00c000c0001000008aa00120977696e646f7773787003636f6d026a6d00c00c000c0001000008aa000f06666c6578676f03636f6d02756100c00c000c0001000008aa000b0877696e646f777870c8d8c00c000c0001000008aa0014116361702d7375722d6c652d737563636573c04ac00c000c0001000008aa000906666c6578676fc59cc00c000c0001000008aa000906617a7572696be429c00c000c0001000008aa000906666c6578676fc116c00c000c0001000008aa000f0c6d6f6e6e6f7576656c616d69c0bfc00c000c0001000008aa00120d726573706f6e7365706f696e7402627300c00c000c0001000008aa00160d726573706f6e7365706f696e7403636f6d02756100c00c000c0001000008aa00100977696e646f77737870036f7267c381c00c000c0001000008aa0014116361702d7375722d6c652d737563636573c116c00c000c0001000008aa00120b77696e646f77737275627903636f6dffdec00c000c0001000008aa00100d726573706f6e7365706f696e74c96bc00c000c0001000008aa00100977696e646f7773787003636f6dc7edc00c000c0001000008aa00110e64657369676e6564666f72626967cc9fc00c000c0001000008aa00110b77696e646f77737275627902636fc70ec00c000c0001000008aa000906666c6578676fdf83c00c000c0001000008aa00120977696e646f7773787003636f6d026e6900c00c000c0001000008aa000c096575726f706c616e6fda48c00c000c0001000008aa000f0977696e646f7773787002636fcfd5c00c000c0001000008aa000f06666c6578676f03636f6d02706b00c00c000c0001000008aa00120d726573706f6e7365706f696e7402656500c00c000c0001000008aa00120d726573706f6e7365706f696e74026d6100c00c000c0001000008aa000c0977696e646f77737870f9cec00c000c0001000008aa000e0b77696e646f777372756279eb60c00c000c0001000008aa00160f65756772616e747361647669736f7203636f6dc158c00c000c0001000008aa000c0977696e646f77737870dfbfc00c000c0001000008aa000c0977696e646f77737870c456c00c000c0001000008aa00100d726573706f6e7365706f696e74d678c00c000c0001000008aa000c0977696e646f77737870f3fac00c000c0001000008aa00100d726573706f6e7365706f696e74c06ac00c000c0001000008aa000e0b6270677765626361737433c04ac00c000c0001000008aa00100d726573706f6e7365706f696e74c2f0c00c000c0001000008aa000f0c66616d696c792d7761766573c54cc00c000c0001000008aa00120977696e646f77737870036e6574026a6500c00c000c0001000008aa00100b77696e646f77737275627902687500c00c000c0001000008aa000b06616d616c676102707300c00c000c0001000008aa00120977696e646f77737870036e657402706500c00c000c0001000008aa000f0c626c696e7874686567616d65c04ac00c000c0001000008aa00120977696e646f77737870036f726702687500c00c000c0001000008aa000d0a6f666669636532303037c84bc00c000c0001000008aa000f06616d616c676103636f6d02707300c00c000c0001000008aa000e0977696e646f7773787002736800c00c000c0001000008aa00120f77696e646f77737369646573686f77c04ac00c000c0001000008aa000b0877696e646f777870ce71c00c000c0001000008aa00070462657461f6f5c00c000c0001000008aa000e0b656169736f6c7574696f6ec085c00c000c0001000008aa0013106f66667265732d6d6963726f736f6674c04ac00c000c0001000008aa00100d726573706f6e7365706f696e74df7fc00c000c0001000008aa000d0a6f666669636532303037d3f7c00c000c0001000008aa00140d726573706f6e7365706f696e7403636f6dffdec00c000c0001000008aa00100d77696e646f77736e7432303030c116c00c000c0001000008aa00110e72657461696c7765626361737473c04ac00c000c0001000008aa000906666c6578676ff8a8c00c000c0001000008aa00120f65756772616e747361647669736f72c381c00c000c0001000008aa000c09666f726566726f6e74c0fcc00c000c0001000008aa00100977696e646f77737870036e6574cfd5c00c000c0001000008aa00120977696e646f777378700573746f7265c381c00c000c0001000008aa00110977696e646f77737870026d7902746a00c00c000c0001000008aa00120f65756772616e747361647669736f72c82fc00c000c0001000008aa00140d726573706f6e7365706f696e7403636f6dc456c00c000c0001000008aa00120977696e646f77737870036f726702706b00c00c000c0001000008aa00100977696e646f7773787003636f6dc09fc00c000c0001000008aa000d06666c6578676f03636f6dc158c00c000c0001000008aa00131069697377656263617374736572696573c116c00c000c0001000008aa000d0a756c74696d6174657063c04ac00c000c0001000008aa000e0b77696e646f777372756279e970c00c000c0001000008aa000b06616d616c676102707200c00c000c0001000008aa000e0977696e646f7773787002737200c00c000c0001000008aa00110e64657369676e6564666f72626967eb60c00c000c0001000008aa000b0866616272696b616dc04ac00c000c0001000008aa000c0977696e646f77737870f600c00c000c0001000008aa00110977696e646f7773787002636f02747400c00c000c0001000008aa000b0877696e646f777870dfbbc00c000c0001000008aa00110e667574757265706f73746d61696cc0bfc00c000c0001000008aa000d0a6f666669636532303037c580c00c000c0001000008aa00100d726573706f6e7365706f696e74dde0c00c000c0001000008aa000e0977696e646f7773787002676c00c00c000c0001000008aa00100d726573706f6e7365706f696e74d702c00c000c0001000008aa000906617a7572696bc580c00c000c0001000008aa0017146761676e657a2d656e2d65666669636163697465c04ac00c000c0001000008aa00120f686f6c6964617968656c70626f6f6bc04ac00c000c0001000008aa00100d726573706f6e7365706f696e74df83c00c000c0001000008aa00100d6469736b636f6d6d616e646572c04ac00c000c0001000008aa00100d72656164797365747368617265c54cc00c000c0001000008aa000b0877696e646f777870c237c00c000c0001000008aa00100d66696e656172747363686f6f6cc0bfc00c000c0001000008aa0014117461626c65747063646576656c6f706572c04a0000290200000080000000',\n true)\n end",
"def encode_params_base64(params)\n query = params.map { |(k, v)| \"#{uri_escape(k.to_s)}=#{uri_escape(v.to_s)}\" }.join('&')\n s = Base64.encode64(query)\n s.gsub!(/(\\s|==$)/, '')\n s\n end",
"def wicked_pdf_url_base64(url); end",
"def decode(base64)\n base64.to_s.unpack(\"m\").first\n end",
"def test_non_canonical\n verify(\n 'f8f681900001000200030005076578616d706c6503636f6d0000010001c00c0001000100014f0c00045db8d822c00c002e000100014f0c00a20001080200015180580ec93f57f38df906a8076578616d706c6503636f6d006ae1882b1536a15c44f5813671af57bf9cae0366cff2ec085d6dedfddff0c469fa827ceec953de7cc1eee634f4cf695dc2caa2074f95199a5582e51e63b336d8f091d18c0c1a307ae3f5508ec650c4085a95e54e2c2451d9fc9ae04b4e62f3d1a1689e9507c3692fb84817a70afd3e9cdf066f73cc4ac11ed080a30d2af31510b457b5c04b0002000100014f0c001401620c69616e612d73657276657273036e657400c04b0002000100014f0c00040161c0e9c04b002e000100014f0c00a2000208020001518058109f4c57f56c1906a8076578616d706c6503636f6d006d8dd0fdbd0a0b0bfe7e4306a4a001bb7a13df2faedb1702a329243c326b915191335e99e16a236de99360547efa96ec6ee547a6dcfab94b57de6f7891bcaf99a2ef5d3c72d5bc18d1bf05ff4473f527bd8f2e6621489ab531dfb6a973e37e0f0be52740a362599058b204097a04c96492e527bfca6a22338eb865b51156c2ab0e6940c10700010001000004940004c72b8735c107001c00010001e209001020010500008f00000000000000000053c0e700010001000004940004c72b8535c0e7001c00010001e209001020010500008d000000000000000000530000291000000080000000')\n end",
"def decode(value)\n Base64.decode64 value\n end",
"def encode_string; end",
"def from_base64\n unpack(\"m\").first\n end",
"def format_base64_images(text, id)\n\n matchString = /src=\"data:image\\/(\\w+?);base64,(.*?)\"/\n matches = text.scan(matchString)\n matches.each_with_index do |(mimetype, b64), ix|\n\n unless b64.nil?\n filename = 'post' + id.to_s + '-' + ix.to_s + '.' + mimetype\n fullfilespec = \"#{Rails.public_path}/#{filename}\"\n File.open(fullfilespec, 'wb') do |f|\n f.write(Base64.decode64(b64))\n end\n text.sub!(matchString, \"src='#{filename}'\")\n end\n\n end\n text\n end",
"def decode_and_parse_json(string)\n JSON.parse(string)\nrescue\n JSON.parse(Base64.decode64(string))\nend",
"def hex_to_base64(s)\n [[s].pack(\"H*\")].pack('m*')\nend",
"def encode_base64!\n self.replace(self.encode_base64)\n end",
"def hex_base64_convert(s)\n [[s].pack(\"H*\")].pack(\"M*\")\nend",
"def decode_string(str)\n\nend",
"def digest(string, algorithm)\n Base64.encode64 digester(algorithm).digest(string)\n end",
"def ensure_correct_encoding!(val)\n if @eval_string.empty? &&\n val.respond_to?(:encoding) &&\n val.encoding != @eval_string.encoding\n @eval_string.force_encoding(val.encoding)\n end\n end",
"def decode_base64!\n self.replace(self.decode_base64)\n end",
"def decode_body(body)\n body += '=' * (4 - body.length.modulo(4))\n Base64.decode64(body.tr('-_','+/'))\n end",
"def decode(b)\n Base64.decode64(b)\n end",
"def raw_to_base_64(byte_array)\n return \"\" if byte_array == []\n ((3 - (byte_array.length % 3)) % 3).times { byte_array << 0 }\n c1 = BASE_64_CHARS[byte_array[0] >> 2]\n c2 = BASE_64_CHARS[(byte_array[0] % 4) * 16 + (byte_array[1] >> 4)]\n c3 = BASE_64_CHARS[(byte_array[1] % 16) * 4 + (byte_array[2] >> 6)]\n c4 = BASE_64_CHARS[byte_array[2] % 64]\n c1 + c2 + c3 + c4 + raw_to_base_64(byte_array[3..-1])\nend",
"def base64_encode\n Base64.encode64(file_contents)\n end",
"def crypt_keeper_payload_parse(payload)\n payload.encode('UTF-8', 'binary',\n invalid: :replace, undef: :replace, replace: '')\n end",
"def parse_64(edata)\n return nil if @eject\n to_parse = ''\n \n # Check every single F'ing character. God, MIME is slow.\n edata.each_byte do |i| i = i.chr\n if MIME_CHARS.include?(i)\n @mime_block << i\n if @mime_block.length == 4\n to_parse << de_mime(@mime_block)\n @mime_block = ''\n end\n end\n end # of each_byte\n\n # Hand the decoded data to the parser\n parse(to_parse) unless to_parse.empty?\n end"
] | [
"0.7734977",
"0.7734977",
"0.7492275",
"0.66429627",
"0.6529098",
"0.64741683",
"0.64426994",
"0.63358283",
"0.633199",
"0.63087136",
"0.6258804",
"0.6256823",
"0.6256823",
"0.62453866",
"0.6198839",
"0.61921984",
"0.61596966",
"0.6141271",
"0.61154413",
"0.61153513",
"0.60882485",
"0.60882485",
"0.60212827",
"0.6020969",
"0.6010431",
"0.5987562",
"0.5940525",
"0.58918655",
"0.5885612",
"0.5869699",
"0.58668613",
"0.58565897",
"0.5853504",
"0.5818587",
"0.58133054",
"0.5811192",
"0.5811045",
"0.58097225",
"0.58097225",
"0.5802235",
"0.5782608",
"0.57670444",
"0.5752035",
"0.5748467",
"0.5730526",
"0.572958",
"0.5727463",
"0.57218313",
"0.572026",
"0.5707777",
"0.5701525",
"0.56915385",
"0.56905806",
"0.56762",
"0.5653398",
"0.5647301",
"0.5622746",
"0.5622746",
"0.56224936",
"0.56203914",
"0.5617299",
"0.5611639",
"0.5609758",
"0.5601738",
"0.5595479",
"0.55500025",
"0.55341476",
"0.55278003",
"0.5527097",
"0.55207807",
"0.55109024",
"0.5497269",
"0.54847765",
"0.5479971",
"0.54701674",
"0.5469139",
"0.5469139",
"0.5447075",
"0.54054785",
"0.5391943",
"0.5385787",
"0.53784806",
"0.53757054",
"0.5370775",
"0.5367517",
"0.53623873",
"0.53559273",
"0.5341489",
"0.5338391",
"0.5329987",
"0.5317477",
"0.5311147",
"0.5308595",
"0.53070146",
"0.529155",
"0.5286637",
"0.5261287",
"0.5253593",
"0.52490926",
"0.5237174",
"0.521436"
] | 0.0 | -1 |
Base 64 encode, convert binary or file data to a text string Encodes / converts binary or file data to a text string | def edit_text_base64_encode(request, opts = {})
data, _status_code, _headers = edit_text_base64_encode_with_http_info(request, opts)
data
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def encode_base64(text)\n Base64.strict_encode64(text).strip\n end",
"def b64_e(data)\n Base64.encode64(data).chomp\n end",
"def base64\n binary = open { |io| io.read }\n result = Base64.strict_encode64(binary)\n binary.clear # deallocate string\n result\n end",
"def base64\n binary = open { |io| io.read }\n result = Base64.encode64(binary).chomp\n binary.clear # deallocate string\n result\n end",
"def base64_encode\n Base64.encode64(file_contents)\n end",
"def encode_str(str)\n require \"base64\"\n encoded_str=Base64.encode64(str)\n return encoded_str\nend",
"def base64(stuff)\n Base64.encode64(stuff).delete(\"\\n\")\n end",
"def raw_encode()\n return Base64.encode64(File.read @file_path).delete(\"\\n\") if RUBY_VERSION < \"1.9.0\"\n Base64.strict_encode64(File.read @file_path)\n end",
"def encode\n ::Base64.encode64(@string)\n end",
"def base64_encode(string)\n SSL.base64_encode(string)\n end",
"def base64_encode(string)\n SSL.base64_encode(string)\n end",
"def encript(text_to_encript)\n require 'base64'\n Base64.encode64(text_to_encript)\n\nend",
"def encode(string)\n Base64.encode64(string).gsub(/\\n/, \"\")\n end",
"def encode(data)\n case @encoding\n when nil, :none, :raw\n data\n when :base64\n Base64.encode64(data)\n else\n raise Cryptic::UnsupportedEncoding, @encoding\n end\n end",
"def base64(text, charset=\"iso-2022-jp\", convert=true)\n if convert\n if charset == \"iso-2022-jp\"\n text = NKF.nkf('-j -m0', text)\n end\n end\n text = [text].pack('m').delete(\"\\r\\n\")\n \"=?#{charset}?B?#{text}?=\"\n end",
"def b64_encode(string)\n Base64.encode64(string).tr(\"\\n=\",'')\n end",
"def encode(str)\n @base64 = Base64.encode64(str)\n end",
"def strict_encode64(bin)\n return Base64.strict_encode64(bin) if Base64.respond_to? :strict_encode64\n Base64.encode64(bin).tr(\"\\n\",'')\n end",
"def base64_encode\n [self].pack('m').chop\n end",
"def postgres_base64_data(data)\n [data].pack(\"m*\").gsub(/\\r?\\n/,\"\")\n end",
"def decode_base64_string(filename, data)\n\n decoded_image = Base64.decode64(data)\n\nend",
"def decode_base64_string(filename, data)\n\n decoded_image = Base64.decode64(data)\n\nend",
"def encode()\n \"data:#{self.filetype};base64,\" + self.raw_encode\n end",
"def base64_encode value\n encoded_str = Base64.urlsafe_encode64 value, padding: false\nend",
"def base64\n content = storage.read(id)\n base64 = Base64.encode64(content)\n base64.chomp\n end",
"def encode_base64\n [self].pack(\"m*\")\n end",
"def to_base64\n base64 = [to_s].pack('m').delete(\"\\n\")\n base64.gsub!('/', '~')\n base64.gsub!('+', '-')\n base64\n end",
"def encoded\n if @stream\n if @str.respond_to?(:rewind)\n @str.rewind\n end\n Base64.encode(@str.read)\n else\n Base64.encode(@str)\n end\n end",
"def to_base64\n Base64.strict_encode64 to_escp\n end",
"def urlsafe_encode64(bin)\n strict_encode64(bin).tr(\"+/\", \"-_\")\n end",
"def encode_string; end",
"def convert_to_base64(csv)\n Base64.encode64(csv)\n end",
"def safe_string(str)\n b64str = Base64.strict_encode64(str)\n \"echo #{b64str} | base64 --decode\"\n end",
"def bin_to_base64(bin)\nreturn bin.scan(/....../).map { |x| $BASE64[x.to_i(2)] }.join\nend",
"def encode(text); end",
"def encode(text); end",
"def encode(string); end",
"def convert_to_encoded_string(data_type, value)\r\n return KB_NIL if value.nil?\r\n\r\n case data_type\r\n when :YAML\r\n y = value.to_yaml\r\n if y =~ ENCODE_RE\r\n return y.gsub(\"&\", '&').gsub(\"\\n\", '&linefeed;').gsub(\r\n \"\\r\", '&carriage_return;').gsub(\"\\032\", '&substitute;'\r\n ).gsub(\"|\", '&pipe;')\r\n else\r\n return y\r\n end\r\n when :String\r\n if value =~ ENCODE_RE\r\n return value.gsub(\"&\", '&').gsub(\"\\n\", '&linefeed;'\r\n ).gsub(\"\\r\", '&carriage_return;').gsub(\"\\032\",\r\n '&substitute;').gsub(\"|\", '&pipe;')\r\n else\r\n return value\r\n end \r\n when :Memo\r\n return value.filepath\r\n when :Blob\r\n return value.filepath\r\n else\r\n return value.to_s\r\n end\r\n end",
"def encode_bytes(raw_bytes)\n Base64.urlsafe_encode64(raw_bytes)\n end",
"def encode64\n Base64.strict_encode64(compress)\n end",
"def encode64( png )\n return Base64.encode64(png)\n end",
"def raw_to_base_64(byte_array)\n return \"\" if byte_array == []\n ((3 - (byte_array.length % 3)) % 3).times { byte_array << 0 }\n c1 = BASE_64_CHARS[byte_array[0] >> 2]\n c2 = BASE_64_CHARS[(byte_array[0] % 4) * 16 + (byte_array[1] >> 4)]\n c3 = BASE_64_CHARS[(byte_array[1] % 16) * 4 + (byte_array[2] >> 6)]\n c4 = BASE_64_CHARS[byte_array[2] % 64]\n c1 + c2 + c3 + c4 + raw_to_base_64(byte_array[3..-1])\nend",
"def write_base64(data_stream)\n write_with_children \"base64\" do\n while (buf = data_stream.read(WRITE_BUFFER_SIZE)) != nil do\n @io << [buf].pack('m').chop\n end\n end\n end",
"def e64(s)\n return unless s\n CGI.escape Base64.encode64(s)\n end",
"def encoded_contents(image_path)\n Base64.encode64(File.read(image_path)).gsub(/\\n/, '')\n end",
"def img_encode_base64(data)\n content_type = data.content_type.split('/')\n return nil unless content_type[0] == 'image' &&\n ['jpeg', 'png', 'gif'].include?(content_type[1])\n\n \"data:image/#{content_type[1]};base64, #{Base64.encode64(data.read)}\"\n end",
"def fake_base_64\n Base64.urlsafe_encode64(words(20).join)\nend",
"def hex_to_bin_to_base64(hex_encoded_string)\n bin = Lib.hex_to_bin(hex_encoded_string)\n Lib.bin_to_base64([bin])\nend",
"def encode(value)\n Base64.encode64 value\n end",
"def base64_decode(string)\n SSL.base64_decode(string)\n end",
"def base64_decode(string)\n SSL.base64_decode(string)\n end",
"def to_encoded_str\n string_io = StringIO.new\n self.encode string_io\n string_io.string\n end",
"def encode_base64!\n self.replace(self.encode_base64)\n end",
"def b64d(input)\n if input\n return helpers.base64Decode(input)\n end\n return \"\".to_java_bytes\n end",
"def encode64(bin)\n [bin].pack(\"m\")\n end",
"def encode64(bin)\n [bin].pack(\"m\")\n end",
"def base64(digits)\n string(BASE64_DIGITS, digits)\n end",
"def encode_string_ex; end",
"def b64encode_it(contents = nil)\r\n\t\t\tunless contents.nil?\r\n\t\t\t\tx = Base64.encode64(contents)\r\n\t\t\t\treturn x\r\n\t\t\tend\r\n\t\tend",
"def decode_base64\n #self.unpack(\"m*\").first\n # This should be the above line but due to a bug in the ruby base64 decoder\n # it will only decode base64 where the lines are in multiples of 4, this is\n # contrary to RFC2045 which says that all characters other than the 65 used\n # are to be ignored. Currently we remove all the other characters but it \n # might be better to use it's advice to only remove line breaks and white\n # space\n self.tr(\"^A-Za-z0-9+/=\", \"\").unpack(\"m*\").first\n end",
"def auth_encoder(authentication)\n Base64.urlsafe_encode64(authentication.to_json.to_s).chomp\n end",
"def base64\n self[:data]\n end",
"def encode\n return @_data unless @_data.nil?\n @_data = [@bin_data].pack( 'm' ).chomp if @bin_data \n @_data\n end",
"def make_base64_file(fname)\n b64 = Base64.strict_encode64(File.read(fname))\n File.write(B64NAME, b64)\n B64NAME\nend",
"def base64_decode\n unpack('m').first\n end",
"def base64digest\n DigestUtils.pack_base64digest(digest)\n end",
"def strict_encode64(string)\n [string].pack('m0')\n end",
"def hex_to_base64(s)\n [[s].pack(\"H*\")].pack('m*')\nend",
"def strict_encode64(bin)\n [bin].pack(\"m0\")\n end",
"def encrypt(text_to_encrypt, base64_encode=true)\n encrytped = public_key.public_encrypt(text_to_encrypt)\n base64_encode ? Base64UrlSafe.encode(encrytped) : encrytped\n end",
"def u64(s)\n return unless s\n Base64.decode64 CGI.unescape(s)\n end",
"def binary_string; end",
"def decoded\n Base64.decode64(@base64 || \"\")\n end",
"def to_base64\n\t\treturn Base64.encode64(self)\n\tend",
"def reencode_string(input); end",
"def protect_encoding(x)\n x.encode('UTF-8', 'binary', invalid: :replace, undef: :replace, replace: '')\n end",
"def encode\n type_byte + encode_data\n end",
"def encode_attachment(file_path:, file_type: nil)\n # try to find file_type\n if file_type.nil?\n content_types = MIME::Types.type_for(file_path)\n file_type = content_types.first.content_type if content_types.any?\n end\n\n # if file_type not found in previous step\n if file_type.nil?\n raise('File type not found. Specify a file_type argument.')\n end\n\n file_contents = open(file_path) { |f| f.read }\n encoded = Base64.encode64(file_contents)\n mime_padding = \"data:#{file_type};base64,\"\n mime_padding + encoded\n end",
"def hex_base64_convert(s)\n [[s].pack(\"H*\")].pack(\"M*\")\nend",
"def strict_encode64(key)\n value = self[key]\n encoded = if Base64.respond_to?(:strict_encode64)\n Base64.strict_encode64(value)\n else\n [value].pack('m0')\n end\n self[key] = encoded.delete(\"\\n\\r\")\n end",
"def file_to_url_safe_base64(file)\n file_temp_path = file.tempfile.path\n Base64.urlsafe_encode64(File.open(file_temp_path, \"rb\").read)\n end",
"def encrypt64(str)\n enc = ''\n while str.length > self.encrypt_block_size\n enc += self.public_encrypt(str[0..self.encrypt_block_size])\n str = str[self.encrypt_block_size+1..-1] if str.length > self.encrypt_block_size\n end\n if str.length != 0 then\n enc += self.public_encrypt(str[0..self.encrypt_block_size])\n end\n Base64.encode64(enc)\n end",
"def to_base64\n [self].pack(\"m\")\n end",
"def encode!; end",
"def coda(x=@s)\n xb = Base64\n # => module\n enc = xb.encode64(x)\n # descodeia\n plain = xb.decode64(enc)\n # retorna\n return plain\n end",
"def file_to_base64 (photo)\n\t\tputs [photo].pack('m0')\n\t\t#Convierte de formato '/xFF' a Base64 para poder mostrar la foto en la vista\n\t\treturn [photo].pack('m0')\n\tend",
"def b64encode(bin, len = 60)\n encode64(bin).scan(/.{1,#{len}}/o) do\n print $&, \"\\n\"\n end\n end",
"def encode(data, passphrase)\n pack64(encrypt(data, passphrase))\n end",
"def base64_encoded?(string)\n !!string.gsub(/[\\r\\n]|\\\\r|\\\\n/, \"\").match(BASE64_FORMAT)\n end",
"def base64_encoded?(string)\n !!string.gsub(/[\\r\\n]|\\\\r|\\\\n/, \"\").match(BASE64_FORMAT)\n end",
"def to_binary; ''; end",
"def data\n Base64::decode64(@data)\n end",
"def get_mms_message_encode64\n #encoded=Base64.encode64(s)\n return Base64.encode64(self.get_mms_message)\n end",
"def encode(data)\n @encryptor.encrypt_and_sign(data)\n end",
"def get_stager_code\r\n b64_fname = \"/tmp/#{Rex::Text.rand_text_alpha(6)}.bin\"\r\n bin_fname = \"/tmp/#{Rex::Text.rand_text_alpha(5)}.bin\"\r\n register_file_for_cleanup(b64_fname, bin_fname)\r\n p = Rex::Text.encode_base64(generate_payload_exe)\r\n\r\n c = \"File.open('#{b64_fname}', 'wb') { |f| f.write('#{p}') }; \"\r\n c << \"%x(base64 --decode #{b64_fname} > #{bin_fname}); \"\r\n c << \"%x(chmod +x #{bin_fname}); \"\r\n c << \"%x(#{bin_fname})\"\r\n c\r\n end",
"def encode_field(text, method = nil, charset = 'UTF-8', line_length = 66)\n return '' if text.nil?\n method ||= text.best_mime_encoding\n method = method.downcase if method.kind_of?(String)\n case method\n when :none\n text\n when :base64, 'b', 'base64'\n encode_base64_field(text, charset, line_length)\n when :quoted_printable, 'q', 'quoted-printable'\n encode_quoted_printable_field(text, charset, line_length)\n else\n raise ArgumentError, \"Bad MIME encoding\"\n end\n end",
"def encoding(id, secret)\n #chercher a quoi correspond la methode .strict\n #.strict_encode64 sert a crypter les données dans un type particulier\n #appelé Base64\n #mettre un 'Basic espace' a l'interieur de la string\n return \"Basic \" + (Base64.strict_encode64(\"#{id}:#{secret}\"))\nend",
"def base64(length: T.unsafe(nil), padding: T.unsafe(nil), urlsafe: T.unsafe(nil)); end",
"def encrypt(string)\n CRYPTO.encrypt_string(string).to_64\nend",
"def binary_to_text(b)\n [b].pack(\"B*\")\nend"
] | [
"0.76493204",
"0.73975974",
"0.7248933",
"0.72290087",
"0.7072631",
"0.69880325",
"0.6906852",
"0.6890942",
"0.67682904",
"0.67168826",
"0.67168826",
"0.66970366",
"0.66615707",
"0.6649137",
"0.66388893",
"0.66282266",
"0.6616499",
"0.65718377",
"0.6554283",
"0.65180314",
"0.64436865",
"0.64436865",
"0.64250696",
"0.63892674",
"0.6342698",
"0.633834",
"0.63156545",
"0.63026875",
"0.6289386",
"0.6285786",
"0.62622356",
"0.62457275",
"0.62394404",
"0.6236753",
"0.62334234",
"0.62334234",
"0.6216891",
"0.6168551",
"0.6158231",
"0.6151137",
"0.61492854",
"0.6137059",
"0.6123915",
"0.612333",
"0.61163664",
"0.6110055",
"0.6105837",
"0.6097143",
"0.6094693",
"0.60749114",
"0.60749114",
"0.60338783",
"0.6005691",
"0.59927344",
"0.59820384",
"0.59820384",
"0.5981184",
"0.5944198",
"0.59380037",
"0.59376436",
"0.59308374",
"0.5915",
"0.5884036",
"0.5864372",
"0.5849535",
"0.5830713",
"0.58245295",
"0.5797514",
"0.57545793",
"0.5730932",
"0.5729304",
"0.5725239",
"0.57219845",
"0.572035",
"0.5719551",
"0.5713674",
"0.5697624",
"0.56883335",
"0.5685462",
"0.5658547",
"0.5655248",
"0.56468356",
"0.5632342",
"0.56213045",
"0.56121916",
"0.5604013",
"0.5602752",
"0.55903643",
"0.557883",
"0.557883",
"0.5538885",
"0.55360544",
"0.55302167",
"0.5527967",
"0.5526094",
"0.55182666",
"0.551339",
"0.55035734",
"0.5495727",
"0.54820216"
] | 0.57393616 | 69 |
Base 64 encode, convert binary or file data to a text string Encodes / converts binary or file data to a text string | def edit_text_base64_encode_with_http_info(request, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: EditTextApi.edit_text_base64_encode ...'
end
# verify the required parameter 'request' is set
if @api_client.config.client_side_validation && request.nil?
fail ArgumentError, "Missing the required parameter 'request' when calling EditTextApi.edit_text_base64_encode"
end
# resource path
local_var_path = '/convert/edit/text/encoding/base64/encode'
# query parameters
query_params = {}
# header parameters
header_params = {}
# HTTP header 'Accept' (if needed)
header_params['Accept'] = @api_client.select_header_accept(['application/json', 'text/json', 'application/xml', 'text/xml'])
# HTTP header 'Content-Type'
header_params['Content-Type'] = @api_client.select_header_content_type(['application/json', 'text/json', 'application/xml', 'text/xml', 'application/x-www-form-urlencoded'])
# form parameters
form_params = {}
# http body (model)
post_body = @api_client.object_to_http_body(request)
auth_names = ['Apikey']
data, status_code, headers = @api_client.call_api(:POST, local_var_path,
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,
:body => post_body,
:auth_names => auth_names,
:return_type => 'Base64EncodeResponse')
if @api_client.config.debugging
@api_client.config.logger.debug "API called: EditTextApi#edit_text_base64_encode\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def encode_base64(text)\n Base64.strict_encode64(text).strip\n end",
"def b64_e(data)\n Base64.encode64(data).chomp\n end",
"def base64\n binary = open { |io| io.read }\n result = Base64.strict_encode64(binary)\n binary.clear # deallocate string\n result\n end",
"def base64\n binary = open { |io| io.read }\n result = Base64.encode64(binary).chomp\n binary.clear # deallocate string\n result\n end",
"def base64_encode\n Base64.encode64(file_contents)\n end",
"def encode_str(str)\n require \"base64\"\n encoded_str=Base64.encode64(str)\n return encoded_str\nend",
"def base64(stuff)\n Base64.encode64(stuff).delete(\"\\n\")\n end",
"def raw_encode()\n return Base64.encode64(File.read @file_path).delete(\"\\n\") if RUBY_VERSION < \"1.9.0\"\n Base64.strict_encode64(File.read @file_path)\n end",
"def encode\n ::Base64.encode64(@string)\n end",
"def base64_encode(string)\n SSL.base64_encode(string)\n end",
"def base64_encode(string)\n SSL.base64_encode(string)\n end",
"def encript(text_to_encript)\n require 'base64'\n Base64.encode64(text_to_encript)\n\nend",
"def encode(string)\n Base64.encode64(string).gsub(/\\n/, \"\")\n end",
"def encode(data)\n case @encoding\n when nil, :none, :raw\n data\n when :base64\n Base64.encode64(data)\n else\n raise Cryptic::UnsupportedEncoding, @encoding\n end\n end",
"def base64(text, charset=\"iso-2022-jp\", convert=true)\n if convert\n if charset == \"iso-2022-jp\"\n text = NKF.nkf('-j -m0', text)\n end\n end\n text = [text].pack('m').delete(\"\\r\\n\")\n \"=?#{charset}?B?#{text}?=\"\n end",
"def b64_encode(string)\n Base64.encode64(string).tr(\"\\n=\",'')\n end",
"def encode(str)\n @base64 = Base64.encode64(str)\n end",
"def strict_encode64(bin)\n return Base64.strict_encode64(bin) if Base64.respond_to? :strict_encode64\n Base64.encode64(bin).tr(\"\\n\",'')\n end",
"def base64_encode\n [self].pack('m').chop\n end",
"def postgres_base64_data(data)\n [data].pack(\"m*\").gsub(/\\r?\\n/,\"\")\n end",
"def decode_base64_string(filename, data)\n\n decoded_image = Base64.decode64(data)\n\nend",
"def decode_base64_string(filename, data)\n\n decoded_image = Base64.decode64(data)\n\nend",
"def encode()\n \"data:#{self.filetype};base64,\" + self.raw_encode\n end",
"def base64_encode value\n encoded_str = Base64.urlsafe_encode64 value, padding: false\nend",
"def base64\n content = storage.read(id)\n base64 = Base64.encode64(content)\n base64.chomp\n end",
"def encode_base64\n [self].pack(\"m*\")\n end",
"def to_base64\n base64 = [to_s].pack('m').delete(\"\\n\")\n base64.gsub!('/', '~')\n base64.gsub!('+', '-')\n base64\n end",
"def encoded\n if @stream\n if @str.respond_to?(:rewind)\n @str.rewind\n end\n Base64.encode(@str.read)\n else\n Base64.encode(@str)\n end\n end",
"def to_base64\n Base64.strict_encode64 to_escp\n end",
"def urlsafe_encode64(bin)\n strict_encode64(bin).tr(\"+/\", \"-_\")\n end",
"def encode_string; end",
"def convert_to_base64(csv)\n Base64.encode64(csv)\n end",
"def safe_string(str)\n b64str = Base64.strict_encode64(str)\n \"echo #{b64str} | base64 --decode\"\n end",
"def encode(text); end",
"def encode(text); end",
"def bin_to_base64(bin)\nreturn bin.scan(/....../).map { |x| $BASE64[x.to_i(2)] }.join\nend",
"def encode(string); end",
"def convert_to_encoded_string(data_type, value)\r\n return KB_NIL if value.nil?\r\n\r\n case data_type\r\n when :YAML\r\n y = value.to_yaml\r\n if y =~ ENCODE_RE\r\n return y.gsub(\"&\", '&').gsub(\"\\n\", '&linefeed;').gsub(\r\n \"\\r\", '&carriage_return;').gsub(\"\\032\", '&substitute;'\r\n ).gsub(\"|\", '&pipe;')\r\n else\r\n return y\r\n end\r\n when :String\r\n if value =~ ENCODE_RE\r\n return value.gsub(\"&\", '&').gsub(\"\\n\", '&linefeed;'\r\n ).gsub(\"\\r\", '&carriage_return;').gsub(\"\\032\",\r\n '&substitute;').gsub(\"|\", '&pipe;')\r\n else\r\n return value\r\n end \r\n when :Memo\r\n return value.filepath\r\n when :Blob\r\n return value.filepath\r\n else\r\n return value.to_s\r\n end\r\n end",
"def encode_bytes(raw_bytes)\n Base64.urlsafe_encode64(raw_bytes)\n end",
"def encode64\n Base64.strict_encode64(compress)\n end",
"def encode64( png )\n return Base64.encode64(png)\n end",
"def raw_to_base_64(byte_array)\n return \"\" if byte_array == []\n ((3 - (byte_array.length % 3)) % 3).times { byte_array << 0 }\n c1 = BASE_64_CHARS[byte_array[0] >> 2]\n c2 = BASE_64_CHARS[(byte_array[0] % 4) * 16 + (byte_array[1] >> 4)]\n c3 = BASE_64_CHARS[(byte_array[1] % 16) * 4 + (byte_array[2] >> 6)]\n c4 = BASE_64_CHARS[byte_array[2] % 64]\n c1 + c2 + c3 + c4 + raw_to_base_64(byte_array[3..-1])\nend",
"def e64(s)\n return unless s\n CGI.escape Base64.encode64(s)\n end",
"def write_base64(data_stream)\n write_with_children \"base64\" do\n while (buf = data_stream.read(WRITE_BUFFER_SIZE)) != nil do\n @io << [buf].pack('m').chop\n end\n end\n end",
"def encoded_contents(image_path)\n Base64.encode64(File.read(image_path)).gsub(/\\n/, '')\n end",
"def img_encode_base64(data)\n content_type = data.content_type.split('/')\n return nil unless content_type[0] == 'image' &&\n ['jpeg', 'png', 'gif'].include?(content_type[1])\n\n \"data:image/#{content_type[1]};base64, #{Base64.encode64(data.read)}\"\n end",
"def fake_base_64\n Base64.urlsafe_encode64(words(20).join)\nend",
"def hex_to_bin_to_base64(hex_encoded_string)\n bin = Lib.hex_to_bin(hex_encoded_string)\n Lib.bin_to_base64([bin])\nend",
"def encode(value)\n Base64.encode64 value\n end",
"def base64_decode(string)\n SSL.base64_decode(string)\n end",
"def base64_decode(string)\n SSL.base64_decode(string)\n end",
"def to_encoded_str\n string_io = StringIO.new\n self.encode string_io\n string_io.string\n end",
"def encode_base64!\n self.replace(self.encode_base64)\n end",
"def b64d(input)\n if input\n return helpers.base64Decode(input)\n end\n return \"\".to_java_bytes\n end",
"def encode64(bin)\n [bin].pack(\"m\")\n end",
"def encode64(bin)\n [bin].pack(\"m\")\n end",
"def base64(digits)\n string(BASE64_DIGITS, digits)\n end",
"def encode_string_ex; end",
"def b64encode_it(contents = nil)\r\n\t\t\tunless contents.nil?\r\n\t\t\t\tx = Base64.encode64(contents)\r\n\t\t\t\treturn x\r\n\t\t\tend\r\n\t\tend",
"def decode_base64\n #self.unpack(\"m*\").first\n # This should be the above line but due to a bug in the ruby base64 decoder\n # it will only decode base64 where the lines are in multiples of 4, this is\n # contrary to RFC2045 which says that all characters other than the 65 used\n # are to be ignored. Currently we remove all the other characters but it \n # might be better to use it's advice to only remove line breaks and white\n # space\n self.tr(\"^A-Za-z0-9+/=\", \"\").unpack(\"m*\").first\n end",
"def auth_encoder(authentication)\n Base64.urlsafe_encode64(authentication.to_json.to_s).chomp\n end",
"def base64\n self[:data]\n end",
"def encode\n return @_data unless @_data.nil?\n @_data = [@bin_data].pack( 'm' ).chomp if @bin_data \n @_data\n end",
"def make_base64_file(fname)\n b64 = Base64.strict_encode64(File.read(fname))\n File.write(B64NAME, b64)\n B64NAME\nend",
"def base64_decode\n unpack('m').first\n end",
"def base64digest\n DigestUtils.pack_base64digest(digest)\n end",
"def strict_encode64(string)\n [string].pack('m0')\n end",
"def hex_to_base64(s)\n [[s].pack(\"H*\")].pack('m*')\nend",
"def strict_encode64(bin)\n [bin].pack(\"m0\")\n end",
"def edit_text_base64_encode(request, opts = {})\n data, _status_code, _headers = edit_text_base64_encode_with_http_info(request, opts)\n data\n end",
"def encrypt(text_to_encrypt, base64_encode=true)\n encrytped = public_key.public_encrypt(text_to_encrypt)\n base64_encode ? Base64UrlSafe.encode(encrytped) : encrytped\n end",
"def u64(s)\n return unless s\n Base64.decode64 CGI.unescape(s)\n end",
"def binary_string; end",
"def reencode_string(input); end",
"def to_base64\n\t\treturn Base64.encode64(self)\n\tend",
"def decoded\n Base64.decode64(@base64 || \"\")\n end",
"def protect_encoding(x)\n x.encode('UTF-8', 'binary', invalid: :replace, undef: :replace, replace: '')\n end",
"def encode\n type_byte + encode_data\n end",
"def encode_attachment(file_path:, file_type: nil)\n # try to find file_type\n if file_type.nil?\n content_types = MIME::Types.type_for(file_path)\n file_type = content_types.first.content_type if content_types.any?\n end\n\n # if file_type not found in previous step\n if file_type.nil?\n raise('File type not found. Specify a file_type argument.')\n end\n\n file_contents = open(file_path) { |f| f.read }\n encoded = Base64.encode64(file_contents)\n mime_padding = \"data:#{file_type};base64,\"\n mime_padding + encoded\n end",
"def hex_base64_convert(s)\n [[s].pack(\"H*\")].pack(\"M*\")\nend",
"def strict_encode64(key)\n value = self[key]\n encoded = if Base64.respond_to?(:strict_encode64)\n Base64.strict_encode64(value)\n else\n [value].pack('m0')\n end\n self[key] = encoded.delete(\"\\n\\r\")\n end",
"def file_to_url_safe_base64(file)\n file_temp_path = file.tempfile.path\n Base64.urlsafe_encode64(File.open(file_temp_path, \"rb\").read)\n end",
"def encrypt64(str)\n enc = ''\n while str.length > self.encrypt_block_size\n enc += self.public_encrypt(str[0..self.encrypt_block_size])\n str = str[self.encrypt_block_size+1..-1] if str.length > self.encrypt_block_size\n end\n if str.length != 0 then\n enc += self.public_encrypt(str[0..self.encrypt_block_size])\n end\n Base64.encode64(enc)\n end",
"def to_base64\n [self].pack(\"m\")\n end",
"def encode!; end",
"def coda(x=@s)\n xb = Base64\n # => module\n enc = xb.encode64(x)\n # descodeia\n plain = xb.decode64(enc)\n # retorna\n return plain\n end",
"def file_to_base64 (photo)\n\t\tputs [photo].pack('m0')\n\t\t#Convierte de formato '/xFF' a Base64 para poder mostrar la foto en la vista\n\t\treturn [photo].pack('m0')\n\tend",
"def b64encode(bin, len = 60)\n encode64(bin).scan(/.{1,#{len}}/o) do\n print $&, \"\\n\"\n end\n end",
"def encode(data, passphrase)\n pack64(encrypt(data, passphrase))\n end",
"def base64_encoded?(string)\n !!string.gsub(/[\\r\\n]|\\\\r|\\\\n/, \"\").match(BASE64_FORMAT)\n end",
"def base64_encoded?(string)\n !!string.gsub(/[\\r\\n]|\\\\r|\\\\n/, \"\").match(BASE64_FORMAT)\n end",
"def to_binary; ''; end",
"def data\n Base64::decode64(@data)\n end",
"def get_mms_message_encode64\n #encoded=Base64.encode64(s)\n return Base64.encode64(self.get_mms_message)\n end",
"def encode(data)\n @encryptor.encrypt_and_sign(data)\n end",
"def get_stager_code\r\n b64_fname = \"/tmp/#{Rex::Text.rand_text_alpha(6)}.bin\"\r\n bin_fname = \"/tmp/#{Rex::Text.rand_text_alpha(5)}.bin\"\r\n register_file_for_cleanup(b64_fname, bin_fname)\r\n p = Rex::Text.encode_base64(generate_payload_exe)\r\n\r\n c = \"File.open('#{b64_fname}', 'wb') { |f| f.write('#{p}') }; \"\r\n c << \"%x(base64 --decode #{b64_fname} > #{bin_fname}); \"\r\n c << \"%x(chmod +x #{bin_fname}); \"\r\n c << \"%x(#{bin_fname})\"\r\n c\r\n end",
"def encode_field(text, method = nil, charset = 'UTF-8', line_length = 66)\n return '' if text.nil?\n method ||= text.best_mime_encoding\n method = method.downcase if method.kind_of?(String)\n case method\n when :none\n text\n when :base64, 'b', 'base64'\n encode_base64_field(text, charset, line_length)\n when :quoted_printable, 'q', 'quoted-printable'\n encode_quoted_printable_field(text, charset, line_length)\n else\n raise ArgumentError, \"Bad MIME encoding\"\n end\n end",
"def encoding(id, secret)\n #chercher a quoi correspond la methode .strict\n #.strict_encode64 sert a crypter les données dans un type particulier\n #appelé Base64\n #mettre un 'Basic espace' a l'interieur de la string\n return \"Basic \" + (Base64.strict_encode64(\"#{id}:#{secret}\"))\nend",
"def base64(length: T.unsafe(nil), padding: T.unsafe(nil), urlsafe: T.unsafe(nil)); end",
"def encrypt(string)\n CRYPTO.encrypt_string(string).to_64\nend",
"def convert_encoding(content); end"
] | [
"0.7648406",
"0.73963034",
"0.7247658",
"0.7227718",
"0.70721227",
"0.6988505",
"0.69052285",
"0.6891448",
"0.6769234",
"0.6716464",
"0.6716464",
"0.66976434",
"0.6662091",
"0.66487396",
"0.6637941",
"0.6627886",
"0.66167414",
"0.657141",
"0.6552477",
"0.65162027",
"0.64410055",
"0.64410055",
"0.642537",
"0.6389445",
"0.63417464",
"0.6336042",
"0.63145053",
"0.63034344",
"0.6289753",
"0.6284982",
"0.6265278",
"0.62450725",
"0.6239077",
"0.62362576",
"0.62362576",
"0.62343717",
"0.621952",
"0.6171716",
"0.6157991",
"0.61504585",
"0.61480856",
"0.6134684",
"0.61236405",
"0.6121013",
"0.611592",
"0.61075807",
"0.61052155",
"0.6095395",
"0.60952306",
"0.6072556",
"0.6072556",
"0.60366833",
"0.60041666",
"0.5990019",
"0.59797686",
"0.59797686",
"0.5979479",
"0.59474725",
"0.5938101",
"0.59347594",
"0.5930598",
"0.5913303",
"0.5884452",
"0.5862987",
"0.58458096",
"0.5827982",
"0.5823194",
"0.5794682",
"0.5752549",
"0.5739487",
"0.57314014",
"0.57280314",
"0.57273483",
"0.5720992",
"0.57203186",
"0.57195365",
"0.571411",
"0.5698868",
"0.5688818",
"0.56830585",
"0.5658291",
"0.565398",
"0.56458014",
"0.56303483",
"0.56234044",
"0.5611182",
"0.5603231",
"0.5601051",
"0.5589336",
"0.55770636",
"0.55770636",
"0.55413425",
"0.5534345",
"0.5530452",
"0.55270576",
"0.55264145",
"0.55197066",
"0.55134517",
"0.5501515",
"0.5496006",
"0.54841214"
] | 0.0 | -1 |
Set, change line endings of a text file Sets the line ending type of a text file; set to Windows, Unix or Mac. | def edit_text_change_line_endings(line_ending_type, input_file, opts = {})
data, _status_code, _headers = edit_text_change_line_endings_with_http_info(line_ending_type, input_file, opts)
data
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def line_ending=(value)\n @line_ending = value || \"\\r\\n\"\n end",
"def setEol(eol)\n unless /(?i)^(unix|dos|mac)$/.match(eol)\n raise Error.new(Pdfcrowd.create_invalid_value_message(eol, \"setEol\", \"pdf-to-text\", \"Allowed values are unix, dos, mac.\", \"set_eol\"), 470);\n end\n \n @fields['eol'] = eol\n self\n end",
"def line_ending\n @line_ending ||= \"\\r\\n\"\n end",
"def win_line_endings( src, dst )\n case ::File.extname(src)\n when *%w[.png .gif .jpg .jpeg]\n FileUtils.cp src, dst\n else\n ::File.open(dst,'w') do |fd|\n ::File.foreach(src, \"\\n\") do |line|\n line.tr!(\"\\r\\n\",'')\n fd.puts line\n end\n end\n end\n end",
"def edit_text_change_line_endings_with_http_info(line_ending_type, input_file, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: EditTextApi.edit_text_change_line_endings ...'\n end\n # verify the required parameter 'line_ending_type' is set\n if @api_client.config.client_side_validation && line_ending_type.nil?\n fail ArgumentError, \"Missing the required parameter 'line_ending_type' when calling EditTextApi.edit_text_change_line_endings\"\n end\n # verify the required parameter 'input_file' is set\n if @api_client.config.client_side_validation && input_file.nil?\n fail ArgumentError, \"Missing the required parameter 'input_file' when calling EditTextApi.edit_text_change_line_endings\"\n end\n # resource path\n local_var_path = '/convert/edit/text/line-endings/change'\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', 'text/json', 'application/xml', 'text/xml'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['multipart/form-data'])\n header_params[:'lineEndingType'] = line_ending_type\n\n # form parameters\n form_params = {}\n form_params['inputFile'] = input_file\n\n # http body (model)\n post_body = nil\n auth_names = ['Apikey']\n data, status_code, headers = @api_client.call_api(:POST, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'ChangeLineEndingResponse')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: EditTextApi#edit_text_change_line_endings\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def end_line(kind); end",
"def convert_eol_to_unix!\n local_copy.in_place :perl, EOL_TO_UNIX\n end",
"def edit_text_detect_line_endings(input_file, opts = {})\n data, _status_code, _headers = edit_text_detect_line_endings_with_http_info(input_file, opts)\n data\n end",
"def ensure_trailing_newline(file_text)\n count_trailing_newlines(file_text) > 0 ? file_text : (file_text + \"\\n\")\n end",
"def clean_line_breaks(os_platform, script_file, contents = nil)\n return if os_platform =~ /win/\n contents = File.open(script_file).read if contents.nil?\n fil = File.open(script_file,\"w+\")\n fil.puts contents.gsub(\"\\r\", \"\")\n fil.flush\n fil.close\n script_file\nend",
"def swap_lines sep, linebreak\n lines = File.readlines(self).collect(&:chomp)\n result = lines.collect {|line| line.swap sep}\n return false if lines == result\n linebreak = {unix: \"\\n\", mac: \"\\r\", windows: \"\\r\\n\"}.fetch(linebreak) do |k|\n raise KeyError, k.to_s\n end\n File.open(self, 'w') {|file| file.puts result.join(linebreak)}\n true\n end",
"def end_of_line\n @suffixes = '$'\n end",
"def normalizes_line_endings\n attributes.fetch(:normalizesLineEndings)\n end",
"def end_line kind\n end",
"def overwrite c, text\n pos = text =~ /\\n/\n unless pos\n if text.size > @fileContent[c.line][c.column, @fileContent[c.line].size].size\n @fileContent[c.line] = @fileContent[c.line][0, c.column] + text\n else\n @fileContent[c.line] = @fileContent[c.line][0, c.column] +\n text + @fileContent[c.line][c.column + text.size,\n @fileContent[c.line].size]\n end\n c.moveToColumn c.column + text.size\n else\n if @fileContent[c.line][c.column, @fileContent[c.line].size].size > pos\n nbToDelete = text[pos, text.size].count \"^\\n\"\n insertText c, text\n deleteTextDelete c, nbToDelete\n else\n @fileContent[c.line] = @fileContent[c.line][0, c.column] + text[0, pos]\n c.moveToColumn c.column + pos\n insertText c, text[pos, text.size]\n end\n end\n end",
"def eol_pattern()\n return /\\r\\n?|\\n/ # Applicable to *nix, Mac, Windows eol conventions\n end",
"def getFileLineEndings(file)\n File.open(file, 'rb') do |f|\n return f.readline[/\\r?\\n$/]\n end\nend",
"def getFileLineEndings(file)\n File.open(file, 'rb') do |f|\n return f.readline[/\\r?\\n$/]\n end\nend",
"def convert_unix_2_dos(file_name)\n\n\ttext = \"\"\t\n\t\n\tputs file_name\n\n\tif !(File.directory? (file_name)) then \n\t\tFile.open(file_name,\"rb\") do |f|\n\t\t\ttext = f.read.gsub(\"\\n\",\"\\r\\n\")\n\t\tend\n\n\t\tFile.open(file_name,\"wb\") do |f|\n\t\t\tf.write(text)\n\t\tend\n\tend\nend",
"def append_to_file(file, eol: $/)\n file.to_pathname.append_lines(self, eol: eol)\n self\n end",
"def overwriteText cursor, text\n if cursor.isAtEOL? or cursor.isAtEOF?\n insertText cursor, text\n else\n overwrite cursor, text\n end\n end",
"def new_ending(sourcefile, type)\n #sourcefile.sub(/\\.[^.]+$/, \".#{type.to_s}\")\n \"#{sourcefile}.#{type.to_s}\"\nend",
"def edit_text_detect_line_endings_with_http_info(input_file, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: EditTextApi.edit_text_detect_line_endings ...'\n end\n # verify the required parameter 'input_file' is set\n if @api_client.config.client_side_validation && input_file.nil?\n fail ArgumentError, \"Missing the required parameter 'input_file' when calling EditTextApi.edit_text_detect_line_endings\"\n end\n # resource path\n local_var_path = '/convert/edit/text/line-endings/detect'\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', 'text/json', 'application/xml', 'text/xml'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['multipart/form-data'])\n\n # form parameters\n form_params = {}\n form_params['inputFile'] = input_file\n\n # http body (model)\n post_body = nil\n auth_names = ['Apikey']\n data, status_code, headers = @api_client.call_api(:POST, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'DetectLineEndingsResponse')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: EditTextApi#edit_text_detect_line_endings\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def lex_end line\n ends << line\n end",
"def _normalize_line_end(line)\n return line unless @usecrlf\n # p [ \"nleln\", line ]\n line_len = line.respond_to?(:bytesize) ? line.bytesize : line.length\n last2 = line[line_len-2...line_len]\n # p [ \"nlel2\", last2 ]\n return line unless last2 == \"\\r\\n\"\n return line[0...line_len-2] + \"\\n\"\n end",
"def end_of_line\n self.cursor = :end\n end",
"def change_line(file, lineno, new_line)\n lines = File.readlines(file).tap { |c| c[lineno - 1] = \"#{new_line}\\n\" }\n\n File.open(file, \"w\") { |f| f.write(lines.join) }\n end",
"def newline_check(file_name)\n # check if the file has no newline or multiple newlines\n lines = File.open(file_name, 'r').to_a\n # if the last character of the last line with code is a newline character AND there is additional text on that line, set hasSingleNewline to true; otherwise set it to false\n hasSingleNewline = lines.last[-1] == \"\\n\" && lines.last.length > 1\n # if there isn't already a single newline at the end of the file, call the process(text) method to add one in (or delete multiple ones and add a newline in)\n if !hasSingleNewline\n text = File.read(file_name)\n # re-write the file with the final file text returned by the process(text) method\n File.open(file_name, \"w\") { |file| file.puts process(text) }\n end\nend",
"def user_allows_overwrite?(file, opts = {})\n if File.exist?(File.expand_path(file)) && !opts[:force]\n print I18n.t(:overwrite) % file\n answer = HighLine::SystemExtensions.get_character.chr\n puts answer\n return answer =~ /^y/i\n else\n return true\n end\n end",
"def append_to_end_of_file(source, target_file, remove_last_line=false)\n t_file = IO.readlines(target_file)\n t_file.pop if remove_last_line == true\n new_file = []\n new_file << t_file << check_source_type(source)\n File.open(target_file, \"w\") do |x|\n x.puts new_file\n end\n end",
"def not_test_add_marks_to_a_file\r\n TextFormatter.add_para_marks_to_a_file(DIR_OF_NEW+File::SEPARATOR+\r\n \tFILE_7) \r\n end",
"def sub_line_ending_backslashes(file_text)\n backslash_replacement = '# TAILOR REMOVED BACKSLASH'\n file_text.gsub!(/\\\\\\s*\\n?$/, backslash_replacement)\n\n file_text\n end",
"def test_file_append()\n\t\t# test the empty file\n\t\tCfruby::FileEdit.file_append(@emptyfilename, \"new line\")\n\t\tlines = File.open(@emptyfilename, File::RDONLY).readlines()\n\t\tassert_equal(1, lines.length)\n\t\tassert_equal(\"new line\", lines[-1])\n\t\t\n\t\t# test the multiline file\n\t\tCfruby::FileEdit.file_append(@multilinefilename, \"new line\")\n\t\tlines = File.open(@multilinefilename, File::RDONLY).readlines()\n\t\tassert_equal(@multilinefilecontents.split(\"\\n\").length+1, lines.length)\n\t\tassert_equal(\"new line\", lines[-1])\t\t\n\tend",
"def line_rep_ending(theLineRep)\n theLineRep << EOLine.new(\"\\n\") # TODO: replace this line\n end",
"def set_end(t)\n @end_t = t\n end",
"def newline()\n @file.write(\"\\n\")\n end",
"def prePendText fileName, newTxt\n f = File.open(fileName, \"r+\")\n inLines = f.readlines\n f.close\n\n fileModDate = File.mtime(fileName)\n\n time = Time.new\n month = Date::MONTHNAMES[Date.today.month]\n dayName = Date.today.strftime(\"%A\")\n date = [\"#{dayName} #{time.year}-#{month}-#{time.day}\"]\n outLines = [\"#{date[0]}: #{newTxt}\\n\"]\n # If it is a new day, then insert a seperator.\n if fileModDate.year != time.year || fileModDate.month != time.month || fileModDate.day != time.day\n outLines += [\"***********************************************\\n\\n\"]\n end\n\n outLines += inLines\n output = File.new(fileName, \"w\")\n outLines.each { |line| output.write line }\n output.close\nend",
"def append_mode(line)\n File.open(\"#{file}\",\"a\") {|file| file.puts line}\n end",
"def guess_line_ending(filehandle, options)\n counts = {\"\\n\" => 0, \"\\r\" => 0, \"\\r\\n\" => 0}\n quoted_char = false\n\n # count how many of the pre-defined line-endings we find\n # ignoring those contained within quote characters\n last_char = nil\n lines = 0\n filehandle.each_char do |c|\n quoted_char = !quoted_char if c == options[:quote_char]\n next if quoted_char\n\n if last_char == \"\\r\"\n if c == \"\\n\"\n counts[\"\\r\\n\"] += 1\n else\n counts[\"\\r\"] += 1 # \\r are counted after they appeared\n end\n elsif c == \"\\n\"\n counts[\"\\n\"] += 1\n end\n last_char = c\n lines += 1\n break if options[:auto_row_sep_chars] && options[:auto_row_sep_chars] > 0 && lines >= options[:auto_row_sep_chars]\n end\n rewind(filehandle)\n\n counts[\"\\r\"] += 1 if last_char == \"\\r\"\n # find the most frequent key/value pair:\n k, _ = counts.max_by{|_, v| v}\n return k\n end",
"def endline\n\t\t@@bold = @@objs = false\n\tend",
"def update_line(line_text)\n updated_line_text = line_text\n # replace outlook list format with textile list format:\n updated_line_text.gsub!(/^[\\u00b7] /,\"* \") # middot - middle dot\n updated_line_text.gsub!(/^[\\u2022] /,\"* \") # bull - bullet\n updated_line_text.gsub!(/^o /,\"** \") # second level bullet\n updated_line_text.gsub!(/^[\\u00A7] /,\"*** \") # 3rd level bullet (section entity)\n \n updated_line_text.gsub!(/^[0-9]+\\. /, \"# \")\n \n updated_line_text\n end",
"def line_maker\n @lines = File.readlines(path, chomp: true)\n end",
"def rl_unix_filename_rubout(count, key)\r\n if (@rl_point == 0)\r\n rl_ding()\r\n else\r\n orig_point = @rl_point\r\n if (count <= 0)\r\n count = 1\r\n end\r\n\r\n while (count>0)\r\n\r\n c = @rl_line_buffer[@rl_point - 1,1]\r\n while (@rl_point>0 && (whitespace(c) || c == '/'))\r\n @rl_point-=1\r\n c = @rl_line_buffer[@rl_point - 1,1]\r\n end\r\n\r\n while (@rl_point>0 && !whitespace(c) && c != '/')\r\n @rl_point-=1\r\n c = @rl_line_buffer[@rl_point - 1,1]\r\n end\r\n count -= 1\r\n end\r\n\r\n rl_kill_text(orig_point, @rl_point)\r\n if (@rl_editing_mode == @emacs_mode)\r\n @rl_mark = @rl_point\r\n end\r\n end\r\n 0\r\n end",
"def to_unix\n gsub(\"\\r\\n\", \"\\n\")\n end",
"def fix_normalize_trailing_newlines(options)\n # This would use the input option, however that may not work since\n # we touch lots of directories as part of an import.\n # input_file_spec = options['input'] || 'rtfile_dir/repositext_files'\n # Repositext::Cli::Utils.change_files_in_place(\n # config.compute_glob_pattern(input_file_spec),\n # /.\\z/i,\n # \"Normalizing trailing newlines\",\n # options\n # ) do |contents, filename|\n # [Outcome.new(true, { contents: contents.gsub(/(?<!\\n)\\n*\\z/, \"\\n\") }, [])]\n # end\n\n which_files = :all # :content_at_only or :all\n case which_files\n when :content_at_only\n base_dirs = %w[content_dir]\n file_type = 'at_files'\n when :all\n # Process all subfolders of root. Don't touch files in root.\n base_dirs = %w[\n content_dir\n folio_import_dir\n idml_import_dir\n plain_kramdown_export_dir\n reports_dir\n subtitle_export_dir\n subtitle_import_dir\n subtitle_tagging_export_dir\n subtitle_tagging_import_dir\n ]\n file_type = 'repositext_files'\n else\n raise \"Invalid which_files: #{ which_files.inspect }\"\n end\n base_dirs.each do |base_dir_name|\n input_file_spec = \"#{ base_dir_name }/#{ file_type }\"\n Repositext::Cli::Utils.change_files_in_place(\n config.compute_glob_pattern(input_file_spec),\n /.\\z/i,\n \"Normalizing trailing newlines in #{ base_dir_name }/#{ file_type }\",\n options\n ) do |contents, filename|\n [Outcome.new(true, { contents: contents.gsub(/(?<!\\n)\\n*\\z/, \"\\n\") }, [])]\n end\n end\n end",
"def killtoeol\n char = @text[@cursor, 1]\n if char == \"\\n\"\n killto :killtoeol do movetoright end\n else\n killto :killtoeol do movetoeol end\n end\n end",
"def set_line_mode(data = \"\")\n @data_mode = :lines\n (@linebuffer ||= []).clear\n receive_data data.to_s\n end",
"def update_lib_path_file\r\n pathname = (@rootdir + '\\\\' + @libfile).downcase\r\n fw = File.new(pathname + '.new', 'w')\r\n f = File.new(pathname)\r\n f.each {|l|\r\n line = l.chomp.chomp(';')\r\n if File.basename(line.downcase, '.pbl') == @applpbl.downcase\r\n puts l\r\n fw.puts l\r\n else \r\n puts line.gsub(File.basename(line),File.basename(line,'.pbl')) + '\\\\' + File.basename(line) + ';'\r\n fw.puts line.gsub(File.basename(line),File.basename(line,'.pbl')) + '\\\\' + File.basename(line) + ';'\r\n #puts line =~ /\\\\([^\\\\])+$/\r\n #puts line[/\\\\([^\\\\])+$/]\r\n end \r\n }\r\nend",
"def update_line(y,line=nil)\n if !line\n line = AnsiTerm::String.new(buffer.lines(y))\n end\n if !line.is_a?(AnsiTerm::String)\n line = AnsiTerm::String.new(line)\n end\n\n if line.index(\"\\t\").nil?\n return line\n end\n \n pos = 0\n max = line.length\n col = 0\n nline = AnsiTerm::String.new\n first = true\n while (pos < max)\n ch = line.char_at(pos)\n if ch == \"\\t\"\n t = 4-(col%4)\n nline << TABS[4-t]\n col += t\n else\n nline << line[pos]\n col+= 1\n end\n pos+= 1\n end\n\n nline\n end",
"def end=(new_end)\n @end = new_end ? new_end.to_i : nil\n end",
"def end_of_file(arg)\n @offenses << error('At the end of file: Final newline missing') unless arg.readlines.last.match(/\\n/)\n end",
"def default_line_separator\n @def_line_sep ||= infer_line_separator\n end",
"def setLine (line)\n @line = line\n end",
"def update_line(old, ostart, new, current_line, omax, nmax, inv_botlin)\r\n # If we're at the right edge of a terminal that supports xn, we're\r\n # ready to wrap around, so do so. This fixes problems with knowing\r\n # the exact cursor position and cut-and-paste with certain terminal\r\n # emulators. In this calculation, TEMP is the physical screen\r\n # position of the cursor.\r\n if @encoding == 'X'\r\n old.force_encoding('ASCII-8BIT')\r\n new.force_encoding('ASCII-8BIT')\r\n end\r\n\r\n if !@rl_byte_oriented\r\n temp = @_rl_last_c_pos\r\n else\r\n temp = @_rl_last_c_pos - w_offset(@_rl_last_v_pos, @visible_wrap_offset)\r\n end\r\n if (temp == @_rl_screenwidth && @_rl_term_autowrap && !@_rl_horizontal_scroll_mode &&\r\n @_rl_last_v_pos == current_line - 1)\r\n\r\n if (!@rl_byte_oriented)\r\n # This fixes only double-column characters, but if the wrapped\r\n # character comsumes more than three columns, spaces will be\r\n # inserted in the string buffer.\r\n if (@_rl_wrapped_line[current_line] > 0)\r\n _rl_clear_to_eol(@_rl_wrapped_line[current_line])\r\n end\r\n\r\n if new[0,1] != 0.chr\r\n case @encoding\r\n when 'E'\r\n wc = new.scan(/./me)[0]\r\n ret = wc.length\r\n tempwidth = wc.length\r\n when 'S'\r\n wc = new.scan(/./ms)[0]\r\n ret = wc.length\r\n tempwidth = wc.length\r\n when 'U'\r\n wc = new.scan(/./mu)[0]\r\n ret = wc.length\r\n tempwidth = wc.unpack('U').first >= 0x1000 ? 2 : 1\r\n when 'X'\r\n wc = new[0..-1].force_encoding(@encoding_name)[0]\r\n ret = wc.bytesize\r\n tempwidth = wc.ord >= 0x1000 ? 2 : 1\r\n else\r\n ret = 1\r\n tempwidth = 1\r\n end\r\n else\r\n tempwidth = 0\r\n end\r\n\r\n if (tempwidth > 0)\r\n bytes = ret\r\n @rl_outstream.write(new[0,bytes])\r\n @_rl_last_c_pos = tempwidth\r\n @_rl_last_v_pos+=1\r\n\r\n if old[ostart,1] != 0.chr\r\n case @encoding\r\n when 'E'\r\n wc = old[ostart..-1].scan(/./me)[0]\r\n ret = wc.length\r\n when 'S'\r\n wc = old[ostart..-1].scan(/./ms)[0]\r\n ret = wc.length\r\n when 'U'\r\n wc = old[ostart..-1].scan(/./mu)[0]\r\n ret = wc.length\r\n when 'X'\r\n wc = old[ostart..-1].force_encoding(@encoding_name)[0]\r\n ret = wc.bytesize\r\n end\r\n else\r\n ret = 0\r\n end\r\n if (ret != 0 && bytes != 0)\r\n if ret != bytes\r\n len = old[ostart..-1].index(0.chr,ret)\r\n old[ostart+bytes,len-ret] = old[ostart+ret,len-ret]\r\n end\r\n old[ostart,bytes] = new[0,bytes]\r\n end\r\n else\r\n @rl_outstream.write(' ')\r\n @_rl_last_c_pos = 1\r\n @_rl_last_v_pos+=1\r\n if (old[ostart,1] != 0.chr && new[0,1] != 0.chr)\r\n old[ostart,1] = new[0,1]\r\n end\r\n end\r\n\r\n else\r\n if (new[0,1] != 0.chr)\r\n @rl_outstream.write(new[0,1])\r\n else\r\n @rl_outstream.write(' ')\r\n end\r\n @_rl_last_c_pos = 1\r\n @_rl_last_v_pos+=1\r\n if (old[ostart,1] != 0.chr && new[0,1] != 0.chr)\r\n old[ostart,1] = new[0,1]\r\n end\r\n end\r\n end\r\n\r\n # Find first difference.\r\n if (!@rl_byte_oriented)\r\n # See if the old line is a subset of the new line, so that the\r\n # only change is adding characters.\r\n temp = (omax < nmax) ? omax : nmax\r\n if old[ostart,temp]==new[0,temp]\r\n ofd = temp\r\n nfd = temp\r\n else\r\n if (omax == nmax && new[0,omax]==old[ostart,omax])\r\n ofd = omax\r\n nfd = nmax\r\n else\r\n new_offset = 0\r\n old_offset = ostart\r\n ofd = 0\r\n nfd = 0\r\n while(ofd < omax && old[ostart+ofd,1] != 0.chr &&\r\n _rl_compare_chars(old, old_offset, new, new_offset))\r\n\r\n old_offset = _rl_find_next_mbchar(old, old_offset, 1, MB_FIND_ANY)\r\n new_offset = _rl_find_next_mbchar(new, new_offset, 1, MB_FIND_ANY)\r\n ofd = old_offset - ostart\r\n nfd = new_offset\r\n end\r\n end\r\n end\r\n else\r\n ofd = 0\r\n nfd = 0\r\n while(ofd < omax && old[ostart+ofd,1] != 0.chr && old[ostart+ofd,1] == new[nfd,1])\r\n ofd += 1\r\n nfd += 1\r\n end\r\n end\r\n\r\n\r\n # Move to the end of the screen line. ND and OD are used to keep track\r\n # of the distance between ne and new and oe and old, respectively, to\r\n # move a subtraction out of each loop.\r\n oe = old.index(0.chr,ostart+ofd) - ostart\r\n if oe.nil? || oe>omax\r\n oe = omax\r\n end\r\n\r\n ne = new.index(0.chr,nfd)\r\n if ne.nil? || ne>omax\r\n ne = nmax\r\n end\r\n\r\n # If no difference, continue to next line.\r\n if (ofd == oe && nfd == ne)\r\n return\r\n end\r\n\r\n\r\n wsatend = true # flag for trailing whitespace\r\n\r\n if (!@rl_byte_oriented)\r\n\r\n ols = _rl_find_prev_mbchar(old, ostart+oe, MB_FIND_ANY) - ostart\r\n nls = _rl_find_prev_mbchar(new, ne, MB_FIND_ANY)\r\n while ((ols > ofd) && (nls > nfd))\r\n\r\n if (!_rl_compare_chars(old, ostart+ols, new, nls))\r\n break\r\n end\r\n if (old[ostart+ols,1] == \" \")\r\n wsatend = false\r\n end\r\n\r\n ols = _rl_find_prev_mbchar(old, ols+ostart, MB_FIND_ANY) - ostart\r\n nls = _rl_find_prev_mbchar(new, nls, MB_FIND_ANY)\r\n end\r\n else\r\n ols = oe - 1 # find last same\r\n nls = ne - 1\r\n while ((ols > ofd) && (nls > nfd) && old[ostart+ols,1] == new[nls,1])\r\n if (old[ostart+ols,1] != \" \")\r\n wsatend = false\r\n end\r\n ols-=1\r\n nls-=1\r\n end\r\n end\r\n\r\n if (wsatend)\r\n ols = oe\r\n nls = ne\r\n elsif (!_rl_compare_chars(old, ostart+ols, new, nls))\r\n if (old[ostart+ols,1] != 0.chr) # don't step past the NUL\r\n if !@rl_byte_oriented\r\n ols = _rl_find_next_mbchar(old, ostart+ols, 1, MB_FIND_ANY) - ostart\r\n else\r\n ols+=1\r\n end\r\n end\r\n if (new[nls,1] != 0.chr )\r\n if !@rl_byte_oriented\r\n nls = _rl_find_next_mbchar(new, nls, 1, MB_FIND_ANY)\r\n else\r\n nls+=1\r\n end\r\n end\r\n end\r\n\r\n # count of invisible characters in the current invisible line.\r\n current_invis_chars = w_offset(current_line, @wrap_offset)\r\n if (@_rl_last_v_pos != current_line)\r\n _rl_move_vert(current_line)\r\n if (@rl_byte_oriented && current_line == 0 && @visible_wrap_offset!=0)\r\n @_rl_last_c_pos += @visible_wrap_offset\r\n end\r\n end\r\n\r\n # If this is the first line and there are invisible characters in the\r\n # prompt string, and the prompt string has not changed, and the current\r\n # cursor position is before the last invisible character in the prompt,\r\n # and the index of the character to move to is past the end of the prompt\r\n # string, then redraw the entire prompt string. We can only do this\r\n # reliably if the terminal supports a `cr' capability.\r\n\r\n # This is not an efficiency hack -- there is a problem with redrawing\r\n # portions of the prompt string if they contain terminal escape\r\n # sequences (like drawing the `unbold' sequence without a corresponding\r\n # `bold') that manifests itself on certain terminals.\r\n\r\n lendiff = @local_prompt_len\r\n\r\n if (current_line == 0 && !@_rl_horizontal_scroll_mode &&\r\n @_rl_term_cr && lendiff > @prompt_visible_length && @_rl_last_c_pos > 0 &&\r\n ofd >= lendiff && @_rl_last_c_pos < prompt_ending_index())\r\n @rl_outstream.write(@_rl_term_cr)\r\n _rl_output_some_chars(@local_prompt,0,lendiff)\r\n if !@rl_byte_oriented\r\n # We take wrap_offset into account here so we can pass correct\r\n # information to _rl_move_cursor_relative.\r\n @_rl_last_c_pos = _rl_col_width(@local_prompt, 0, lendiff) - @wrap_offset\r\n @cpos_adjusted = true\r\n else\r\n @_rl_last_c_pos = lendiff\r\n end\r\n end\r\n\r\n o_cpos = @_rl_last_c_pos\r\n\r\n # When this function returns, _rl_last_c_pos is correct, and an absolute\r\n # cursor postion in multibyte mode, but a buffer index when not in a\r\n # multibyte locale.\r\n _rl_move_cursor_relative(ofd, old, ostart)\r\n\r\n # We need to indicate that the cursor position is correct in the presence\r\n # of invisible characters in the prompt string. Let's see if setting this\r\n # when we make sure we're at the end of the drawn prompt string works.\r\n if (current_line == 0 && !@rl_byte_oriented &&\r\n (@_rl_last_c_pos > 0 || o_cpos > 0) &&\r\n @_rl_last_c_pos == @prompt_physical_chars)\r\n @cpos_adjusted = true\r\n end\r\n\r\n # if (len (new) > len (old))\r\n # lendiff == difference in buffer\r\n # col_lendiff == difference on screen\r\n # When not using multibyte characters, these are equal\r\n lendiff = (nls - nfd) - (ols - ofd)\r\n if !@rl_byte_oriented\r\n col_lendiff = _rl_col_width(new, nfd, nls) - _rl_col_width(old, ostart+ofd, ostart+ols)\r\n else\r\n col_lendiff = lendiff\r\n end\r\n\r\n # If we are changing the number of invisible characters in a line, and\r\n # the spot of first difference is before the end of the invisible chars,\r\n # lendiff needs to be adjusted.\r\n if (current_line == 0 && !@_rl_horizontal_scroll_mode &&\r\n current_invis_chars != @visible_wrap_offset)\r\n if !@rl_byte_oriented\r\n lendiff += @visible_wrap_offset - current_invis_chars\r\n col_lendiff += @visible_wrap_offset - current_invis_chars\r\n else\r\n lendiff += @visible_wrap_offset - current_invis_chars\r\n col_lendiff = lendiff\r\n end\r\n end\r\n\r\n # Insert (diff (len (old), len (new)) ch.\r\n temp = ne - nfd\r\n if !@rl_byte_oriented\r\n col_temp = _rl_col_width(new,nfd,ne)\r\n else\r\n col_temp = temp\r\n end\r\n if (col_lendiff > 0) # XXX - was lendiff\r\n\r\n # Non-zero if we're increasing the number of lines.\r\n gl = current_line >= @_rl_vis_botlin && inv_botlin > @_rl_vis_botlin\r\n\r\n # If col_lendiff is > 0, implying that the new string takes up more\r\n # screen real estate than the old, but lendiff is < 0, meaning that it\r\n # takes fewer bytes, we need to just output the characters starting from\r\n # the first difference. These will overwrite what is on the display, so\r\n # there's no reason to do a smart update. This can really only happen in\r\n # a multibyte environment.\r\n if lendiff < 0\r\n _rl_output_some_chars(new, nfd, temp)\r\n @_rl_last_c_pos += _rl_col_width(new, nfd, nfd+temp)\r\n\r\n # If nfd begins before any invisible characters in the prompt, adjust\r\n # _rl_last_c_pos to account for wrap_offset and set cpos_adjusted to\r\n # let the caller know.\r\n if current_line == 0 && @wrap_offset && nfd <= @prompt_last_invisible\r\n @_rl_last_c_pos -= @wrap_offset\r\n @cpos_adjusted = true\r\n end\r\n return\r\n # Sometimes it is cheaper to print the characters rather than\r\n # use the terminal's capabilities. If we're growing the number\r\n # of lines, make sure we actually cause the new line to wrap\r\n # around on auto-wrapping terminals.\r\n elsif (@_rl_terminal_can_insert && ((2 * col_temp) >= col_lendiff || @_rl_term_IC) && (!@_rl_term_autowrap || !gl))\r\n\r\n # If lendiff > prompt_visible_length and _rl_last_c_pos == 0 and\r\n # _rl_horizontal_scroll_mode == 1, inserting the characters with\r\n # _rl_term_IC or _rl_term_ic will screw up the screen because of the\r\n # invisible characters. We need to just draw them.\r\n if (old[ostart+ols,1] != 0.chr && (!@_rl_horizontal_scroll_mode || @_rl_last_c_pos > 0 ||\r\n lendiff <= @prompt_visible_length || current_invis_chars==0))\r\n\r\n insert_some_chars(new[nfd..-1], lendiff, col_lendiff)\r\n @_rl_last_c_pos += col_lendiff\r\n elsif ((@rl_byte_oriented) && old[ostart+ols,1] == 0.chr && lendiff > 0)\r\n # At the end of a line the characters do not have to\r\n # be \"inserted\". They can just be placed on the screen.\r\n # However, this screws up the rest of this block, which\r\n # assumes you've done the insert because you can.\r\n _rl_output_some_chars(new,nfd, lendiff)\r\n @_rl_last_c_pos += col_lendiff\r\n else\r\n _rl_output_some_chars(new,nfd, temp)\r\n @_rl_last_c_pos += col_temp\r\n # If nfd begins before any invisible characters in the prompt, adjust\r\n # _rl_last_c_pos to account for wrap_offset and set cpos_adjusted to\r\n # let the caller know.\r\n if current_line == 0 && @wrap_offset && nfd <= @prompt_last_invisible\r\n @_rl_last_c_pos -= @wrap_offset\r\n @cpos_adjusted = true\r\n end\r\n return\r\n end\r\n # Copy (new) chars to screen from first diff to last match.\r\n temp = nls - nfd\r\n if ((temp - lendiff) > 0)\r\n _rl_output_some_chars(new,(nfd + lendiff),temp - lendiff)\r\n # XXX -- this bears closer inspection. Fixes a redisplay bug\r\n # reported against bash-3.0-alpha by Andreas Schwab involving\r\n # multibyte characters and prompt strings with invisible\r\n # characters, but was previously disabled.\r\n @_rl_last_c_pos += _rl_col_width(new,nfd+lendiff, nfd+lendiff+temp-col_lendiff)\r\n end\r\n else\r\n # cannot insert chars, write to EOL\r\n _rl_output_some_chars(new,nfd, temp)\r\n @_rl_last_c_pos += col_temp\r\n # If we're in a multibyte locale and were before the last invisible\r\n # char in the current line (which implies we just output some invisible\r\n # characters) we need to adjust _rl_last_c_pos, since it represents\r\n # a physical character position.\r\n end\r\n else # Delete characters from line.\r\n # If possible and inexpensive to use terminal deletion, then do so.\r\n if (@_rl_term_dc && (2 * col_temp) >= -col_lendiff)\r\n\r\n # If all we're doing is erasing the invisible characters in the\r\n # prompt string, don't bother. It screws up the assumptions\r\n # about what's on the screen.\r\n if (@_rl_horizontal_scroll_mode && @_rl_last_c_pos == 0 &&\r\n -lendiff == @visible_wrap_offset)\r\n col_lendiff = 0\r\n end\r\n\r\n if (col_lendiff!=0)\r\n delete_chars(-col_lendiff) # delete (diff) characters\r\n end\r\n\r\n # Copy (new) chars to screen from first diff to last match\r\n temp = nls - nfd\r\n if (temp > 0)\r\n # If nfd begins at the prompt, or before the invisible characters in\r\n # the prompt, we need to adjust _rl_last_c_pos in a multibyte locale\r\n # to account for the wrap offset and set cpos_adjusted accordingly.\r\n _rl_output_some_chars(new,nfd, temp)\r\n if !@rl_byte_oriented\r\n @_rl_last_c_pos += _rl_col_width(new,nfd,nfd+temp)\r\n if current_line == 0 && @wrap_offset && nfd <= @prompt_last_invisible\r\n @_rl_last_c_pos -= @wrap_offset\r\n @cpos_adjusted = true\r\n end\r\n else\r\n @_rl_last_c_pos += temp\r\n end\r\n end\r\n\r\n # Otherwise, print over the existing material.\r\n else\r\n if (temp > 0)\r\n # If nfd begins at the prompt, or before the invisible characters in\r\n # the prompt, we need to adjust _rl_last_c_pos in a multibyte locale\r\n # to account for the wrap offset and set cpos_adjusted accordingly.\r\n _rl_output_some_chars(new,nfd, temp)\r\n @_rl_last_c_pos += col_temp # XXX\r\n if !@rl_byte_oriented\r\n if current_line == 0 && @wrap_offset && nfd <= @prompt_last_invisible\r\n @_rl_last_c_pos -= @wrap_offset\r\n @cpos_adjusted = true\r\n end\r\n end\r\n end\r\n\r\n lendiff = (oe) - (ne)\r\n if !@rl_byte_oriented\r\n col_lendiff = _rl_col_width(old, ostart, ostart+oe) - _rl_col_width(new, 0, ne)\r\n else\r\n col_lendiff = lendiff\r\n end\r\n\r\n if (col_lendiff!=0)\r\n if (@_rl_term_autowrap && current_line < inv_botlin)\r\n space_to_eol(col_lendiff)\r\n else\r\n _rl_clear_to_eol(col_lendiff)\r\n end\r\n end\r\n end\r\n end\r\n end",
"def append_ext(str)\r\n unless String === str\r\n raise ArgumentError, \"argument musi byc typu String\"\r\n else\r\n str << \".txt\"\r\n end\r\nend",
"def add_after_or_append(filename, matching_text, text_to_add, before_text, after_text)\n content = File.read(filename)\n if content.include?(matching_text)\n add_after(filename, matching_text, text_to_add)\n else\n append_file(filename, [before_text, text_to_add, after_text].join(\"\\n\"))\n end\n end",
"def test_file_must_contain_append()\n\t\tCfruby::FileEdit.file_must_contain(@multilinefilename, \"new line\", :position => Cfruby::FileEdit::APPEND)\n\t\tFile.open(@multilinefilename, File::RDONLY) { |fp|\n\t\t\tlines = fp.readlines()\n\t\t\tassert_equal(\"new line\\n\", lines[-1])\n\t\t}\n\tend",
"def line_break=(char)\n @resource.line_break = char\n end",
"def rl_replace_line(text, clear_undo)\r\n len = text.delete(0.chr).length\r\n @rl_line_buffer = text.dup + 0.chr\r\n @rl_end = len\r\n if (clear_undo)\r\n rl_free_undo_list()\r\n end\r\n _rl_fix_point(true)\r\n end",
"def set_line_mode data=\"\"\n @lt2_mode = :lines\n (@lt2_linebuffer ||= []).clear\n receive_data data.to_s\n end",
"def set_EndsWith(value)\n set_input(\"EndsWith\", value)\n end",
"def set_EndsWith(value)\n set_input(\"EndsWith\", value)\n end",
"def set_EndsWith(value)\n set_input(\"EndsWith\", value)\n end",
"def set_EndsWith(value)\n set_input(\"EndsWith\", value)\n end",
"def set_EndsWith(value)\n set_input(\"EndsWith\", value)\n end",
"def rename_text_in_file(file, text1, text2)\n oldf = File.read(file)\n newf = oldf.gsub(text1, text2)\n File.open(file, \"w\") {|f| f.puts newf}\n end",
"def file_type\n\t\tline = @file_desc.gets\n\t\t@file_desc.pos = 0 # Reset our location within the file\n\t\t\t\t\n\t\ttype = case line[line.rindex(' ')-1].chr\n\t\t\twhen ',' then :comma\n\t\t\twhen '|' then :pipe\n\t\t\telse :space\n\t\tend\n\tend",
"def set_content_type(override=false)\n if override || file.content_type.blank?\n File.open(file.path) do |fd|\n data = fd.read(1024) || \"\"\n new_content_type = filemagic.buffer(data)\n if file.respond_to?(:content_type=)\n file.content_type = new_content_type\n else\n file.instance_variable_set(:@content_type, new_content_type)\n end\n end\n end\n end",
"def lex\n file_beg_changed\n notify_file_beg_observers(@file_name)\n\n super\n\n file_end_changed\n notify_file_end_observers(count_trailing_newlines(@original_file_text))\n end",
"def add_line_to_file(filename, new_value, line_number = nil)\n File.open(filename, 'r+') do |file|\n lines = file.each_line.to_a\n if line_number\n lines[line_number] = new_value + \"\\n\"\n else\n lines.push(new_value + \"\\n\")\n end\n file.rewind\n file.write(lines.join)\n file.close\n end\n end",
"def initialize(file, newline = LF)\n @file = file\n @newline = newline\n end",
"def write(text)\n return if text.nil? || text.empty?\n # lines cannot start with a '.'. insert zero-width character before.\n if text[0,2] == '\\.' &&\n (@buf.last && @buf.last[-1] == ?\\n)\n @buf << '\\&'\n end\n @buf << text\n end",
"def write_to_file file, *text\n text.flatten!\n\n File.open(File.expand_path(file), 'a+') do |file|\n full_text = (text * \"\\n\") + \"\\n\"\n\n unless file.read.include? full_text\n file.write full_text\n end\n end\n end",
"def append_line_to_file(filename, line)\n FileUtils.touch(filename)\n File.open(filename, 'a') do |f|\n f.puts line\n end\nend",
"def change_line(line_num, text) \n\t\traise \"no newlines here yet please\" if text =~ /\\n/\n\t\n\t\tix1, ix2 = line_index(line_num) + 1, line_index(line_num + 1)\n\t\t@text[ix1...ix2] = text\n\t\t(line_num...@line_indices.length).each { |i| @line_indices[i] += text.length - (ix2 - ix1) }\n\tend",
"def set_lines\n set_line(:line_item, OLE_QA::Framework::OLEFS::Line_Item)\n end",
"def normalize_line_endings(string)\n Decidim::ContentParsers::NewlineParser.new(string, context: {}).rewrite\n end",
"def test_file_prepend()\n\t\t# test the empty file\n\t\tCfruby::FileEdit.file_prepend(@emptyfilename, \"new line\")\n\t\tlines = File.open(@emptyfilename, File::RDONLY).readlines()\n\t\tassert_equal(1, lines.length)\n\t\tassert_equal(\"new line\\n\", lines[0])\n\t\t\n\t\t# test the multiline file\n\t\tCfruby::FileEdit.file_prepend(@multilinefilename, \"new line\")\n\t\tlines = File.open(@multilinefilename, File::RDONLY).readlines()\n\t\tassert_equal(@multilinefilecontents.split(\"\\n\").length+1, lines.length)\n\t\tassert_equal(\"new line\\n\", lines[0])\t\t\n\tend",
"def end_of_string\n @suffixes += '\\z'\n end",
"def file_end(file, output)\n end",
"def end_line\n attributes.fetch(:endLine)\n end",
"def add_file(file, line = T.unsafe(nil), has_comments = T.unsafe(nil)); end",
"def make line_to_change, phrase_we_have_now, phrase_we_want_to_have, file_path\n verbose = $conf[:verbose]\n if verbose\n puts \"\\e[39m-----------------------------\"\n puts \"I'm changing:\\n#{phrase_we_have_now}\"\n puts '-----------------------------'\n puts \"to:\\n#{phrase_we_want_to_have}\"\n puts '-----------------------------'\n end\n\n #Change every occurence\n puts \"in file:\\n#{file_path}\" if verbose\n data = File.read(file_path)\n puts \"\\n\\e[31m++Old version: \\e[30m\\n\" if verbose\n puts data + \"\\n\" if verbose\n\n line_changed = line_to_change.gsub(phrase_we_have_now, phrase_we_want_to_have)\n data.sub! line_to_change, line_changed\n\n puts \"\\n\\e[32m++New version: \\e[30m\\n\" if verbose\n puts data + \"\\n\" if verbose\n puts \"\\e[31mOld line:\\n #{line_to_change}\\e[32m\\nNew line:\\n#{line_changed}\\e[30m\" #Standard info. verbose = true -> shows all file\n #Write the file\n res = false\n res = File.open(file_path, \"w\") do |f|\n f.write(data)\n end\n if res\n return true\n end\n false\n end",
"def change_lines_in_file(file_path, &change)\n print \"Fixing #{file_path}...\\n\"\n\n contents = []\n\n file = File.open(file_path, 'r')\n file.each_line do | line |\n contents << line\n end\n file.close\n\n File.open(file_path, 'w') do |f|\n f.puts(change.call(contents))\n end\nend",
"def change_lines_in_file(file_path, &change)\n print \"Fixing #{file_path}...\\n\"\n\n contents = []\n\n file = File.open(file_path, 'r')\n file.each_line do |line|\n contents << line\n end\n file.close\n\n File.open(file_path, 'w') do |f|\n f.puts(change.call(contents))\n end\n end",
"def putData(data, filename, *carriage)\n if carriage == [nil] || carriage == [\"MAC\"]\n carriage = \"\\n\"\n elsif carriage == [\"WIN\"]\n carriage = \"\\r\\n\"\n end\n\n file = File.open(filename, 'w')\n file << \"#{data[0]}#{data[1]}\"\n data[2].row_vectors.each do |row|\n line = \"H\\t#{row[0]}\\t#{row[1]}\\t#{row[2]}#{carriage}\"\n file << line\n end\n\n file.close()\n end",
"def edit_text text\n # 2010-06-29 10:24 \n require 'fileutils'\n require 'tempfile'\n ed = ENV['EDITOR'] || \"vim\"\n temp = Tempfile.new \"tmp\"\n File.open(temp,\"w\"){ |f| f.write text }\n mtime = File.mtime(temp.path)\n #system(\"#{ed} #{temp.path}\")\n system(ed, temp.path)\n\n newmtime = File.mtime(temp.path)\n newstr = nil\n if mtime < newmtime\n # check timestamp, if updated ..\n newstr = File.read(temp)\n else\n #puts \"user quit without saving\"\n return nil\n end\n return newstr.chomp if newstr\n return nil\n end",
"def change_lines_in_file(file_path, &change)\n print \"Fixing #{file_path}...\\n\"\n \n contents = []\n \n file = File.open(file_path, 'r')\n file.each_line do | line |\n contents << line\n end\n file.close\n \n File.open(file_path, 'w') do |f|\n f.puts(change.call(contents))\n end\nend",
"def set_lines\n set_line(:receiving_line,OLE_QA::Framework::OLEFS::Receiving_Line)\n end",
"def _patch_part(text_part, text_orig, sline, eline)\n lines = text_orig.split(\"\\n\", -1)\n lines[(sline -1) ..(eline-1)] = text_part.split(\"\\n\", -1)\n lines.join(\"\\n\")\n end",
"def setEndDateFormat(endDateFormat)\r\n\t\t\t\t\t@endDateFormat = endDateFormat\r\n\t\t\t\tend",
"def last_line; end",
"def last_line; end",
"def last_line; end",
"def last_line; end",
"def last_line; end",
"def last_line; end",
"def last_line; end",
"def add_linebreaks(definition)\n definition.gsub(\"\\r\", '<br>')\nend",
"def replace_string_eol\n buffer.ask 'Replace selection with: ' do |answer, action|\n case action\n when :attempt\n if !answer.empty?\n replace_string_eol!(answer)\n :abort\n else\n buffer.warn 'replacement required'\n end\n end\n end\n end"
] | [
"0.634094",
"0.5782405",
"0.57073706",
"0.57019454",
"0.56270206",
"0.5606324",
"0.55476177",
"0.55101746",
"0.5403119",
"0.5399155",
"0.5396579",
"0.53315276",
"0.52787334",
"0.5249558",
"0.5242004",
"0.5239195",
"0.51631784",
"0.51631784",
"0.508451",
"0.5050614",
"0.48800075",
"0.4835151",
"0.48309565",
"0.48283368",
"0.47855967",
"0.47793558",
"0.475887",
"0.4748436",
"0.47452968",
"0.47310862",
"0.4715784",
"0.46975794",
"0.46922398",
"0.46881568",
"0.46867326",
"0.46854925",
"0.46846196",
"0.4674174",
"0.46431175",
"0.46350357",
"0.4631899",
"0.45852983",
"0.45836616",
"0.45798975",
"0.45575058",
"0.45240977",
"0.44963357",
"0.44861636",
"0.448062",
"0.44789657",
"0.44753456",
"0.4474764",
"0.44642827",
"0.4450221",
"0.44449896",
"0.44346708",
"0.44251207",
"0.4424306",
"0.44237968",
"0.44237158",
"0.44168356",
"0.44168356",
"0.44168356",
"0.44168356",
"0.44168356",
"0.44082758",
"0.44074923",
"0.44069415",
"0.4404495",
"0.4382152",
"0.4381049",
"0.43750823",
"0.43726596",
"0.4359913",
"0.43594682",
"0.43577534",
"0.43515176",
"0.43500444",
"0.43484622",
"0.43362367",
"0.43256405",
"0.4321991",
"0.43177313",
"0.43123037",
"0.43115914",
"0.4308184",
"0.42980692",
"0.42975596",
"0.42901337",
"0.42895722",
"0.4288307",
"0.4284405",
"0.4284405",
"0.4284405",
"0.4284405",
"0.4284405",
"0.4284405",
"0.4284405",
"0.42840117",
"0.4279807"
] | 0.68490213 | 0 |
Set, change line endings of a text file Sets the line ending type of a text file; set to Windows, Unix or Mac. | def edit_text_change_line_endings_with_http_info(line_ending_type, input_file, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: EditTextApi.edit_text_change_line_endings ...'
end
# verify the required parameter 'line_ending_type' is set
if @api_client.config.client_side_validation && line_ending_type.nil?
fail ArgumentError, "Missing the required parameter 'line_ending_type' when calling EditTextApi.edit_text_change_line_endings"
end
# verify the required parameter 'input_file' is set
if @api_client.config.client_side_validation && input_file.nil?
fail ArgumentError, "Missing the required parameter 'input_file' when calling EditTextApi.edit_text_change_line_endings"
end
# resource path
local_var_path = '/convert/edit/text/line-endings/change'
# query parameters
query_params = {}
# header parameters
header_params = {}
# HTTP header 'Accept' (if needed)
header_params['Accept'] = @api_client.select_header_accept(['application/json', 'text/json', 'application/xml', 'text/xml'])
# HTTP header 'Content-Type'
header_params['Content-Type'] = @api_client.select_header_content_type(['multipart/form-data'])
header_params[:'lineEndingType'] = line_ending_type
# form parameters
form_params = {}
form_params['inputFile'] = input_file
# http body (model)
post_body = nil
auth_names = ['Apikey']
data, status_code, headers = @api_client.call_api(:POST, local_var_path,
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,
:body => post_body,
:auth_names => auth_names,
:return_type => 'ChangeLineEndingResponse')
if @api_client.config.debugging
@api_client.config.logger.debug "API called: EditTextApi#edit_text_change_line_endings\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def edit_text_change_line_endings(line_ending_type, input_file, opts = {})\n data, _status_code, _headers = edit_text_change_line_endings_with_http_info(line_ending_type, input_file, opts)\n data\n end",
"def line_ending=(value)\n @line_ending = value || \"\\r\\n\"\n end",
"def setEol(eol)\n unless /(?i)^(unix|dos|mac)$/.match(eol)\n raise Error.new(Pdfcrowd.create_invalid_value_message(eol, \"setEol\", \"pdf-to-text\", \"Allowed values are unix, dos, mac.\", \"set_eol\"), 470);\n end\n \n @fields['eol'] = eol\n self\n end",
"def line_ending\n @line_ending ||= \"\\r\\n\"\n end",
"def win_line_endings( src, dst )\n case ::File.extname(src)\n when *%w[.png .gif .jpg .jpeg]\n FileUtils.cp src, dst\n else\n ::File.open(dst,'w') do |fd|\n ::File.foreach(src, \"\\n\") do |line|\n line.tr!(\"\\r\\n\",'')\n fd.puts line\n end\n end\n end\n end",
"def end_line(kind); end",
"def convert_eol_to_unix!\n local_copy.in_place :perl, EOL_TO_UNIX\n end",
"def edit_text_detect_line_endings(input_file, opts = {})\n data, _status_code, _headers = edit_text_detect_line_endings_with_http_info(input_file, opts)\n data\n end",
"def ensure_trailing_newline(file_text)\n count_trailing_newlines(file_text) > 0 ? file_text : (file_text + \"\\n\")\n end",
"def clean_line_breaks(os_platform, script_file, contents = nil)\n return if os_platform =~ /win/\n contents = File.open(script_file).read if contents.nil?\n fil = File.open(script_file,\"w+\")\n fil.puts contents.gsub(\"\\r\", \"\")\n fil.flush\n fil.close\n script_file\nend",
"def swap_lines sep, linebreak\n lines = File.readlines(self).collect(&:chomp)\n result = lines.collect {|line| line.swap sep}\n return false if lines == result\n linebreak = {unix: \"\\n\", mac: \"\\r\", windows: \"\\r\\n\"}.fetch(linebreak) do |k|\n raise KeyError, k.to_s\n end\n File.open(self, 'w') {|file| file.puts result.join(linebreak)}\n true\n end",
"def end_of_line\n @suffixes = '$'\n end",
"def normalizes_line_endings\n attributes.fetch(:normalizesLineEndings)\n end",
"def end_line kind\n end",
"def overwrite c, text\n pos = text =~ /\\n/\n unless pos\n if text.size > @fileContent[c.line][c.column, @fileContent[c.line].size].size\n @fileContent[c.line] = @fileContent[c.line][0, c.column] + text\n else\n @fileContent[c.line] = @fileContent[c.line][0, c.column] +\n text + @fileContent[c.line][c.column + text.size,\n @fileContent[c.line].size]\n end\n c.moveToColumn c.column + text.size\n else\n if @fileContent[c.line][c.column, @fileContent[c.line].size].size > pos\n nbToDelete = text[pos, text.size].count \"^\\n\"\n insertText c, text\n deleteTextDelete c, nbToDelete\n else\n @fileContent[c.line] = @fileContent[c.line][0, c.column] + text[0, pos]\n c.moveToColumn c.column + pos\n insertText c, text[pos, text.size]\n end\n end\n end",
"def eol_pattern()\n return /\\r\\n?|\\n/ # Applicable to *nix, Mac, Windows eol conventions\n end",
"def getFileLineEndings(file)\n File.open(file, 'rb') do |f|\n return f.readline[/\\r?\\n$/]\n end\nend",
"def getFileLineEndings(file)\n File.open(file, 'rb') do |f|\n return f.readline[/\\r?\\n$/]\n end\nend",
"def convert_unix_2_dos(file_name)\n\n\ttext = \"\"\t\n\t\n\tputs file_name\n\n\tif !(File.directory? (file_name)) then \n\t\tFile.open(file_name,\"rb\") do |f|\n\t\t\ttext = f.read.gsub(\"\\n\",\"\\r\\n\")\n\t\tend\n\n\t\tFile.open(file_name,\"wb\") do |f|\n\t\t\tf.write(text)\n\t\tend\n\tend\nend",
"def append_to_file(file, eol: $/)\n file.to_pathname.append_lines(self, eol: eol)\n self\n end",
"def overwriteText cursor, text\n if cursor.isAtEOL? or cursor.isAtEOF?\n insertText cursor, text\n else\n overwrite cursor, text\n end\n end",
"def new_ending(sourcefile, type)\n #sourcefile.sub(/\\.[^.]+$/, \".#{type.to_s}\")\n \"#{sourcefile}.#{type.to_s}\"\nend",
"def edit_text_detect_line_endings_with_http_info(input_file, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: EditTextApi.edit_text_detect_line_endings ...'\n end\n # verify the required parameter 'input_file' is set\n if @api_client.config.client_side_validation && input_file.nil?\n fail ArgumentError, \"Missing the required parameter 'input_file' when calling EditTextApi.edit_text_detect_line_endings\"\n end\n # resource path\n local_var_path = '/convert/edit/text/line-endings/detect'\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', 'text/json', 'application/xml', 'text/xml'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['multipart/form-data'])\n\n # form parameters\n form_params = {}\n form_params['inputFile'] = input_file\n\n # http body (model)\n post_body = nil\n auth_names = ['Apikey']\n data, status_code, headers = @api_client.call_api(:POST, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'DetectLineEndingsResponse')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: EditTextApi#edit_text_detect_line_endings\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def lex_end line\n ends << line\n end",
"def _normalize_line_end(line)\n return line unless @usecrlf\n # p [ \"nleln\", line ]\n line_len = line.respond_to?(:bytesize) ? line.bytesize : line.length\n last2 = line[line_len-2...line_len]\n # p [ \"nlel2\", last2 ]\n return line unless last2 == \"\\r\\n\"\n return line[0...line_len-2] + \"\\n\"\n end",
"def end_of_line\n self.cursor = :end\n end",
"def change_line(file, lineno, new_line)\n lines = File.readlines(file).tap { |c| c[lineno - 1] = \"#{new_line}\\n\" }\n\n File.open(file, \"w\") { |f| f.write(lines.join) }\n end",
"def newline_check(file_name)\n # check if the file has no newline or multiple newlines\n lines = File.open(file_name, 'r').to_a\n # if the last character of the last line with code is a newline character AND there is additional text on that line, set hasSingleNewline to true; otherwise set it to false\n hasSingleNewline = lines.last[-1] == \"\\n\" && lines.last.length > 1\n # if there isn't already a single newline at the end of the file, call the process(text) method to add one in (or delete multiple ones and add a newline in)\n if !hasSingleNewline\n text = File.read(file_name)\n # re-write the file with the final file text returned by the process(text) method\n File.open(file_name, \"w\") { |file| file.puts process(text) }\n end\nend",
"def user_allows_overwrite?(file, opts = {})\n if File.exist?(File.expand_path(file)) && !opts[:force]\n print I18n.t(:overwrite) % file\n answer = HighLine::SystemExtensions.get_character.chr\n puts answer\n return answer =~ /^y/i\n else\n return true\n end\n end",
"def append_to_end_of_file(source, target_file, remove_last_line=false)\n t_file = IO.readlines(target_file)\n t_file.pop if remove_last_line == true\n new_file = []\n new_file << t_file << check_source_type(source)\n File.open(target_file, \"w\") do |x|\n x.puts new_file\n end\n end",
"def not_test_add_marks_to_a_file\r\n TextFormatter.add_para_marks_to_a_file(DIR_OF_NEW+File::SEPARATOR+\r\n \tFILE_7) \r\n end",
"def sub_line_ending_backslashes(file_text)\n backslash_replacement = '# TAILOR REMOVED BACKSLASH'\n file_text.gsub!(/\\\\\\s*\\n?$/, backslash_replacement)\n\n file_text\n end",
"def test_file_append()\n\t\t# test the empty file\n\t\tCfruby::FileEdit.file_append(@emptyfilename, \"new line\")\n\t\tlines = File.open(@emptyfilename, File::RDONLY).readlines()\n\t\tassert_equal(1, lines.length)\n\t\tassert_equal(\"new line\", lines[-1])\n\t\t\n\t\t# test the multiline file\n\t\tCfruby::FileEdit.file_append(@multilinefilename, \"new line\")\n\t\tlines = File.open(@multilinefilename, File::RDONLY).readlines()\n\t\tassert_equal(@multilinefilecontents.split(\"\\n\").length+1, lines.length)\n\t\tassert_equal(\"new line\", lines[-1])\t\t\n\tend",
"def line_rep_ending(theLineRep)\n theLineRep << EOLine.new(\"\\n\") # TODO: replace this line\n end",
"def set_end(t)\n @end_t = t\n end",
"def newline()\n @file.write(\"\\n\")\n end",
"def prePendText fileName, newTxt\n f = File.open(fileName, \"r+\")\n inLines = f.readlines\n f.close\n\n fileModDate = File.mtime(fileName)\n\n time = Time.new\n month = Date::MONTHNAMES[Date.today.month]\n dayName = Date.today.strftime(\"%A\")\n date = [\"#{dayName} #{time.year}-#{month}-#{time.day}\"]\n outLines = [\"#{date[0]}: #{newTxt}\\n\"]\n # If it is a new day, then insert a seperator.\n if fileModDate.year != time.year || fileModDate.month != time.month || fileModDate.day != time.day\n outLines += [\"***********************************************\\n\\n\"]\n end\n\n outLines += inLines\n output = File.new(fileName, \"w\")\n outLines.each { |line| output.write line }\n output.close\nend",
"def append_mode(line)\n File.open(\"#{file}\",\"a\") {|file| file.puts line}\n end",
"def guess_line_ending(filehandle, options)\n counts = {\"\\n\" => 0, \"\\r\" => 0, \"\\r\\n\" => 0}\n quoted_char = false\n\n # count how many of the pre-defined line-endings we find\n # ignoring those contained within quote characters\n last_char = nil\n lines = 0\n filehandle.each_char do |c|\n quoted_char = !quoted_char if c == options[:quote_char]\n next if quoted_char\n\n if last_char == \"\\r\"\n if c == \"\\n\"\n counts[\"\\r\\n\"] += 1\n else\n counts[\"\\r\"] += 1 # \\r are counted after they appeared\n end\n elsif c == \"\\n\"\n counts[\"\\n\"] += 1\n end\n last_char = c\n lines += 1\n break if options[:auto_row_sep_chars] && options[:auto_row_sep_chars] > 0 && lines >= options[:auto_row_sep_chars]\n end\n rewind(filehandle)\n\n counts[\"\\r\"] += 1 if last_char == \"\\r\"\n # find the most frequent key/value pair:\n k, _ = counts.max_by{|_, v| v}\n return k\n end",
"def endline\n\t\t@@bold = @@objs = false\n\tend",
"def update_line(line_text)\n updated_line_text = line_text\n # replace outlook list format with textile list format:\n updated_line_text.gsub!(/^[\\u00b7] /,\"* \") # middot - middle dot\n updated_line_text.gsub!(/^[\\u2022] /,\"* \") # bull - bullet\n updated_line_text.gsub!(/^o /,\"** \") # second level bullet\n updated_line_text.gsub!(/^[\\u00A7] /,\"*** \") # 3rd level bullet (section entity)\n \n updated_line_text.gsub!(/^[0-9]+\\. /, \"# \")\n \n updated_line_text\n end",
"def line_maker\n @lines = File.readlines(path, chomp: true)\n end",
"def rl_unix_filename_rubout(count, key)\r\n if (@rl_point == 0)\r\n rl_ding()\r\n else\r\n orig_point = @rl_point\r\n if (count <= 0)\r\n count = 1\r\n end\r\n\r\n while (count>0)\r\n\r\n c = @rl_line_buffer[@rl_point - 1,1]\r\n while (@rl_point>0 && (whitespace(c) || c == '/'))\r\n @rl_point-=1\r\n c = @rl_line_buffer[@rl_point - 1,1]\r\n end\r\n\r\n while (@rl_point>0 && !whitespace(c) && c != '/')\r\n @rl_point-=1\r\n c = @rl_line_buffer[@rl_point - 1,1]\r\n end\r\n count -= 1\r\n end\r\n\r\n rl_kill_text(orig_point, @rl_point)\r\n if (@rl_editing_mode == @emacs_mode)\r\n @rl_mark = @rl_point\r\n end\r\n end\r\n 0\r\n end",
"def to_unix\n gsub(\"\\r\\n\", \"\\n\")\n end",
"def fix_normalize_trailing_newlines(options)\n # This would use the input option, however that may not work since\n # we touch lots of directories as part of an import.\n # input_file_spec = options['input'] || 'rtfile_dir/repositext_files'\n # Repositext::Cli::Utils.change_files_in_place(\n # config.compute_glob_pattern(input_file_spec),\n # /.\\z/i,\n # \"Normalizing trailing newlines\",\n # options\n # ) do |contents, filename|\n # [Outcome.new(true, { contents: contents.gsub(/(?<!\\n)\\n*\\z/, \"\\n\") }, [])]\n # end\n\n which_files = :all # :content_at_only or :all\n case which_files\n when :content_at_only\n base_dirs = %w[content_dir]\n file_type = 'at_files'\n when :all\n # Process all subfolders of root. Don't touch files in root.\n base_dirs = %w[\n content_dir\n folio_import_dir\n idml_import_dir\n plain_kramdown_export_dir\n reports_dir\n subtitle_export_dir\n subtitle_import_dir\n subtitle_tagging_export_dir\n subtitle_tagging_import_dir\n ]\n file_type = 'repositext_files'\n else\n raise \"Invalid which_files: #{ which_files.inspect }\"\n end\n base_dirs.each do |base_dir_name|\n input_file_spec = \"#{ base_dir_name }/#{ file_type }\"\n Repositext::Cli::Utils.change_files_in_place(\n config.compute_glob_pattern(input_file_spec),\n /.\\z/i,\n \"Normalizing trailing newlines in #{ base_dir_name }/#{ file_type }\",\n options\n ) do |contents, filename|\n [Outcome.new(true, { contents: contents.gsub(/(?<!\\n)\\n*\\z/, \"\\n\") }, [])]\n end\n end\n end",
"def killtoeol\n char = @text[@cursor, 1]\n if char == \"\\n\"\n killto :killtoeol do movetoright end\n else\n killto :killtoeol do movetoeol end\n end\n end",
"def set_line_mode(data = \"\")\n @data_mode = :lines\n (@linebuffer ||= []).clear\n receive_data data.to_s\n end",
"def update_lib_path_file\r\n pathname = (@rootdir + '\\\\' + @libfile).downcase\r\n fw = File.new(pathname + '.new', 'w')\r\n f = File.new(pathname)\r\n f.each {|l|\r\n line = l.chomp.chomp(';')\r\n if File.basename(line.downcase, '.pbl') == @applpbl.downcase\r\n puts l\r\n fw.puts l\r\n else \r\n puts line.gsub(File.basename(line),File.basename(line,'.pbl')) + '\\\\' + File.basename(line) + ';'\r\n fw.puts line.gsub(File.basename(line),File.basename(line,'.pbl')) + '\\\\' + File.basename(line) + ';'\r\n #puts line =~ /\\\\([^\\\\])+$/\r\n #puts line[/\\\\([^\\\\])+$/]\r\n end \r\n }\r\nend",
"def update_line(y,line=nil)\n if !line\n line = AnsiTerm::String.new(buffer.lines(y))\n end\n if !line.is_a?(AnsiTerm::String)\n line = AnsiTerm::String.new(line)\n end\n\n if line.index(\"\\t\").nil?\n return line\n end\n \n pos = 0\n max = line.length\n col = 0\n nline = AnsiTerm::String.new\n first = true\n while (pos < max)\n ch = line.char_at(pos)\n if ch == \"\\t\"\n t = 4-(col%4)\n nline << TABS[4-t]\n col += t\n else\n nline << line[pos]\n col+= 1\n end\n pos+= 1\n end\n\n nline\n end",
"def end=(new_end)\n @end = new_end ? new_end.to_i : nil\n end",
"def end_of_file(arg)\n @offenses << error('At the end of file: Final newline missing') unless arg.readlines.last.match(/\\n/)\n end",
"def default_line_separator\n @def_line_sep ||= infer_line_separator\n end",
"def setLine (line)\n @line = line\n end",
"def update_line(old, ostart, new, current_line, omax, nmax, inv_botlin)\r\n # If we're at the right edge of a terminal that supports xn, we're\r\n # ready to wrap around, so do so. This fixes problems with knowing\r\n # the exact cursor position and cut-and-paste with certain terminal\r\n # emulators. In this calculation, TEMP is the physical screen\r\n # position of the cursor.\r\n if @encoding == 'X'\r\n old.force_encoding('ASCII-8BIT')\r\n new.force_encoding('ASCII-8BIT')\r\n end\r\n\r\n if !@rl_byte_oriented\r\n temp = @_rl_last_c_pos\r\n else\r\n temp = @_rl_last_c_pos - w_offset(@_rl_last_v_pos, @visible_wrap_offset)\r\n end\r\n if (temp == @_rl_screenwidth && @_rl_term_autowrap && !@_rl_horizontal_scroll_mode &&\r\n @_rl_last_v_pos == current_line - 1)\r\n\r\n if (!@rl_byte_oriented)\r\n # This fixes only double-column characters, but if the wrapped\r\n # character comsumes more than three columns, spaces will be\r\n # inserted in the string buffer.\r\n if (@_rl_wrapped_line[current_line] > 0)\r\n _rl_clear_to_eol(@_rl_wrapped_line[current_line])\r\n end\r\n\r\n if new[0,1] != 0.chr\r\n case @encoding\r\n when 'E'\r\n wc = new.scan(/./me)[0]\r\n ret = wc.length\r\n tempwidth = wc.length\r\n when 'S'\r\n wc = new.scan(/./ms)[0]\r\n ret = wc.length\r\n tempwidth = wc.length\r\n when 'U'\r\n wc = new.scan(/./mu)[0]\r\n ret = wc.length\r\n tempwidth = wc.unpack('U').first >= 0x1000 ? 2 : 1\r\n when 'X'\r\n wc = new[0..-1].force_encoding(@encoding_name)[0]\r\n ret = wc.bytesize\r\n tempwidth = wc.ord >= 0x1000 ? 2 : 1\r\n else\r\n ret = 1\r\n tempwidth = 1\r\n end\r\n else\r\n tempwidth = 0\r\n end\r\n\r\n if (tempwidth > 0)\r\n bytes = ret\r\n @rl_outstream.write(new[0,bytes])\r\n @_rl_last_c_pos = tempwidth\r\n @_rl_last_v_pos+=1\r\n\r\n if old[ostart,1] != 0.chr\r\n case @encoding\r\n when 'E'\r\n wc = old[ostart..-1].scan(/./me)[0]\r\n ret = wc.length\r\n when 'S'\r\n wc = old[ostart..-1].scan(/./ms)[0]\r\n ret = wc.length\r\n when 'U'\r\n wc = old[ostart..-1].scan(/./mu)[0]\r\n ret = wc.length\r\n when 'X'\r\n wc = old[ostart..-1].force_encoding(@encoding_name)[0]\r\n ret = wc.bytesize\r\n end\r\n else\r\n ret = 0\r\n end\r\n if (ret != 0 && bytes != 0)\r\n if ret != bytes\r\n len = old[ostart..-1].index(0.chr,ret)\r\n old[ostart+bytes,len-ret] = old[ostart+ret,len-ret]\r\n end\r\n old[ostart,bytes] = new[0,bytes]\r\n end\r\n else\r\n @rl_outstream.write(' ')\r\n @_rl_last_c_pos = 1\r\n @_rl_last_v_pos+=1\r\n if (old[ostart,1] != 0.chr && new[0,1] != 0.chr)\r\n old[ostart,1] = new[0,1]\r\n end\r\n end\r\n\r\n else\r\n if (new[0,1] != 0.chr)\r\n @rl_outstream.write(new[0,1])\r\n else\r\n @rl_outstream.write(' ')\r\n end\r\n @_rl_last_c_pos = 1\r\n @_rl_last_v_pos+=1\r\n if (old[ostart,1] != 0.chr && new[0,1] != 0.chr)\r\n old[ostart,1] = new[0,1]\r\n end\r\n end\r\n end\r\n\r\n # Find first difference.\r\n if (!@rl_byte_oriented)\r\n # See if the old line is a subset of the new line, so that the\r\n # only change is adding characters.\r\n temp = (omax < nmax) ? omax : nmax\r\n if old[ostart,temp]==new[0,temp]\r\n ofd = temp\r\n nfd = temp\r\n else\r\n if (omax == nmax && new[0,omax]==old[ostart,omax])\r\n ofd = omax\r\n nfd = nmax\r\n else\r\n new_offset = 0\r\n old_offset = ostart\r\n ofd = 0\r\n nfd = 0\r\n while(ofd < omax && old[ostart+ofd,1] != 0.chr &&\r\n _rl_compare_chars(old, old_offset, new, new_offset))\r\n\r\n old_offset = _rl_find_next_mbchar(old, old_offset, 1, MB_FIND_ANY)\r\n new_offset = _rl_find_next_mbchar(new, new_offset, 1, MB_FIND_ANY)\r\n ofd = old_offset - ostart\r\n nfd = new_offset\r\n end\r\n end\r\n end\r\n else\r\n ofd = 0\r\n nfd = 0\r\n while(ofd < omax && old[ostart+ofd,1] != 0.chr && old[ostart+ofd,1] == new[nfd,1])\r\n ofd += 1\r\n nfd += 1\r\n end\r\n end\r\n\r\n\r\n # Move to the end of the screen line. ND and OD are used to keep track\r\n # of the distance between ne and new and oe and old, respectively, to\r\n # move a subtraction out of each loop.\r\n oe = old.index(0.chr,ostart+ofd) - ostart\r\n if oe.nil? || oe>omax\r\n oe = omax\r\n end\r\n\r\n ne = new.index(0.chr,nfd)\r\n if ne.nil? || ne>omax\r\n ne = nmax\r\n end\r\n\r\n # If no difference, continue to next line.\r\n if (ofd == oe && nfd == ne)\r\n return\r\n end\r\n\r\n\r\n wsatend = true # flag for trailing whitespace\r\n\r\n if (!@rl_byte_oriented)\r\n\r\n ols = _rl_find_prev_mbchar(old, ostart+oe, MB_FIND_ANY) - ostart\r\n nls = _rl_find_prev_mbchar(new, ne, MB_FIND_ANY)\r\n while ((ols > ofd) && (nls > nfd))\r\n\r\n if (!_rl_compare_chars(old, ostart+ols, new, nls))\r\n break\r\n end\r\n if (old[ostart+ols,1] == \" \")\r\n wsatend = false\r\n end\r\n\r\n ols = _rl_find_prev_mbchar(old, ols+ostart, MB_FIND_ANY) - ostart\r\n nls = _rl_find_prev_mbchar(new, nls, MB_FIND_ANY)\r\n end\r\n else\r\n ols = oe - 1 # find last same\r\n nls = ne - 1\r\n while ((ols > ofd) && (nls > nfd) && old[ostart+ols,1] == new[nls,1])\r\n if (old[ostart+ols,1] != \" \")\r\n wsatend = false\r\n end\r\n ols-=1\r\n nls-=1\r\n end\r\n end\r\n\r\n if (wsatend)\r\n ols = oe\r\n nls = ne\r\n elsif (!_rl_compare_chars(old, ostart+ols, new, nls))\r\n if (old[ostart+ols,1] != 0.chr) # don't step past the NUL\r\n if !@rl_byte_oriented\r\n ols = _rl_find_next_mbchar(old, ostart+ols, 1, MB_FIND_ANY) - ostart\r\n else\r\n ols+=1\r\n end\r\n end\r\n if (new[nls,1] != 0.chr )\r\n if !@rl_byte_oriented\r\n nls = _rl_find_next_mbchar(new, nls, 1, MB_FIND_ANY)\r\n else\r\n nls+=1\r\n end\r\n end\r\n end\r\n\r\n # count of invisible characters in the current invisible line.\r\n current_invis_chars = w_offset(current_line, @wrap_offset)\r\n if (@_rl_last_v_pos != current_line)\r\n _rl_move_vert(current_line)\r\n if (@rl_byte_oriented && current_line == 0 && @visible_wrap_offset!=0)\r\n @_rl_last_c_pos += @visible_wrap_offset\r\n end\r\n end\r\n\r\n # If this is the first line and there are invisible characters in the\r\n # prompt string, and the prompt string has not changed, and the current\r\n # cursor position is before the last invisible character in the prompt,\r\n # and the index of the character to move to is past the end of the prompt\r\n # string, then redraw the entire prompt string. We can only do this\r\n # reliably if the terminal supports a `cr' capability.\r\n\r\n # This is not an efficiency hack -- there is a problem with redrawing\r\n # portions of the prompt string if they contain terminal escape\r\n # sequences (like drawing the `unbold' sequence without a corresponding\r\n # `bold') that manifests itself on certain terminals.\r\n\r\n lendiff = @local_prompt_len\r\n\r\n if (current_line == 0 && !@_rl_horizontal_scroll_mode &&\r\n @_rl_term_cr && lendiff > @prompt_visible_length && @_rl_last_c_pos > 0 &&\r\n ofd >= lendiff && @_rl_last_c_pos < prompt_ending_index())\r\n @rl_outstream.write(@_rl_term_cr)\r\n _rl_output_some_chars(@local_prompt,0,lendiff)\r\n if !@rl_byte_oriented\r\n # We take wrap_offset into account here so we can pass correct\r\n # information to _rl_move_cursor_relative.\r\n @_rl_last_c_pos = _rl_col_width(@local_prompt, 0, lendiff) - @wrap_offset\r\n @cpos_adjusted = true\r\n else\r\n @_rl_last_c_pos = lendiff\r\n end\r\n end\r\n\r\n o_cpos = @_rl_last_c_pos\r\n\r\n # When this function returns, _rl_last_c_pos is correct, and an absolute\r\n # cursor postion in multibyte mode, but a buffer index when not in a\r\n # multibyte locale.\r\n _rl_move_cursor_relative(ofd, old, ostart)\r\n\r\n # We need to indicate that the cursor position is correct in the presence\r\n # of invisible characters in the prompt string. Let's see if setting this\r\n # when we make sure we're at the end of the drawn prompt string works.\r\n if (current_line == 0 && !@rl_byte_oriented &&\r\n (@_rl_last_c_pos > 0 || o_cpos > 0) &&\r\n @_rl_last_c_pos == @prompt_physical_chars)\r\n @cpos_adjusted = true\r\n end\r\n\r\n # if (len (new) > len (old))\r\n # lendiff == difference in buffer\r\n # col_lendiff == difference on screen\r\n # When not using multibyte characters, these are equal\r\n lendiff = (nls - nfd) - (ols - ofd)\r\n if !@rl_byte_oriented\r\n col_lendiff = _rl_col_width(new, nfd, nls) - _rl_col_width(old, ostart+ofd, ostart+ols)\r\n else\r\n col_lendiff = lendiff\r\n end\r\n\r\n # If we are changing the number of invisible characters in a line, and\r\n # the spot of first difference is before the end of the invisible chars,\r\n # lendiff needs to be adjusted.\r\n if (current_line == 0 && !@_rl_horizontal_scroll_mode &&\r\n current_invis_chars != @visible_wrap_offset)\r\n if !@rl_byte_oriented\r\n lendiff += @visible_wrap_offset - current_invis_chars\r\n col_lendiff += @visible_wrap_offset - current_invis_chars\r\n else\r\n lendiff += @visible_wrap_offset - current_invis_chars\r\n col_lendiff = lendiff\r\n end\r\n end\r\n\r\n # Insert (diff (len (old), len (new)) ch.\r\n temp = ne - nfd\r\n if !@rl_byte_oriented\r\n col_temp = _rl_col_width(new,nfd,ne)\r\n else\r\n col_temp = temp\r\n end\r\n if (col_lendiff > 0) # XXX - was lendiff\r\n\r\n # Non-zero if we're increasing the number of lines.\r\n gl = current_line >= @_rl_vis_botlin && inv_botlin > @_rl_vis_botlin\r\n\r\n # If col_lendiff is > 0, implying that the new string takes up more\r\n # screen real estate than the old, but lendiff is < 0, meaning that it\r\n # takes fewer bytes, we need to just output the characters starting from\r\n # the first difference. These will overwrite what is on the display, so\r\n # there's no reason to do a smart update. This can really only happen in\r\n # a multibyte environment.\r\n if lendiff < 0\r\n _rl_output_some_chars(new, nfd, temp)\r\n @_rl_last_c_pos += _rl_col_width(new, nfd, nfd+temp)\r\n\r\n # If nfd begins before any invisible characters in the prompt, adjust\r\n # _rl_last_c_pos to account for wrap_offset and set cpos_adjusted to\r\n # let the caller know.\r\n if current_line == 0 && @wrap_offset && nfd <= @prompt_last_invisible\r\n @_rl_last_c_pos -= @wrap_offset\r\n @cpos_adjusted = true\r\n end\r\n return\r\n # Sometimes it is cheaper to print the characters rather than\r\n # use the terminal's capabilities. If we're growing the number\r\n # of lines, make sure we actually cause the new line to wrap\r\n # around on auto-wrapping terminals.\r\n elsif (@_rl_terminal_can_insert && ((2 * col_temp) >= col_lendiff || @_rl_term_IC) && (!@_rl_term_autowrap || !gl))\r\n\r\n # If lendiff > prompt_visible_length and _rl_last_c_pos == 0 and\r\n # _rl_horizontal_scroll_mode == 1, inserting the characters with\r\n # _rl_term_IC or _rl_term_ic will screw up the screen because of the\r\n # invisible characters. We need to just draw them.\r\n if (old[ostart+ols,1] != 0.chr && (!@_rl_horizontal_scroll_mode || @_rl_last_c_pos > 0 ||\r\n lendiff <= @prompt_visible_length || current_invis_chars==0))\r\n\r\n insert_some_chars(new[nfd..-1], lendiff, col_lendiff)\r\n @_rl_last_c_pos += col_lendiff\r\n elsif ((@rl_byte_oriented) && old[ostart+ols,1] == 0.chr && lendiff > 0)\r\n # At the end of a line the characters do not have to\r\n # be \"inserted\". They can just be placed on the screen.\r\n # However, this screws up the rest of this block, which\r\n # assumes you've done the insert because you can.\r\n _rl_output_some_chars(new,nfd, lendiff)\r\n @_rl_last_c_pos += col_lendiff\r\n else\r\n _rl_output_some_chars(new,nfd, temp)\r\n @_rl_last_c_pos += col_temp\r\n # If nfd begins before any invisible characters in the prompt, adjust\r\n # _rl_last_c_pos to account for wrap_offset and set cpos_adjusted to\r\n # let the caller know.\r\n if current_line == 0 && @wrap_offset && nfd <= @prompt_last_invisible\r\n @_rl_last_c_pos -= @wrap_offset\r\n @cpos_adjusted = true\r\n end\r\n return\r\n end\r\n # Copy (new) chars to screen from first diff to last match.\r\n temp = nls - nfd\r\n if ((temp - lendiff) > 0)\r\n _rl_output_some_chars(new,(nfd + lendiff),temp - lendiff)\r\n # XXX -- this bears closer inspection. Fixes a redisplay bug\r\n # reported against bash-3.0-alpha by Andreas Schwab involving\r\n # multibyte characters and prompt strings with invisible\r\n # characters, but was previously disabled.\r\n @_rl_last_c_pos += _rl_col_width(new,nfd+lendiff, nfd+lendiff+temp-col_lendiff)\r\n end\r\n else\r\n # cannot insert chars, write to EOL\r\n _rl_output_some_chars(new,nfd, temp)\r\n @_rl_last_c_pos += col_temp\r\n # If we're in a multibyte locale and were before the last invisible\r\n # char in the current line (which implies we just output some invisible\r\n # characters) we need to adjust _rl_last_c_pos, since it represents\r\n # a physical character position.\r\n end\r\n else # Delete characters from line.\r\n # If possible and inexpensive to use terminal deletion, then do so.\r\n if (@_rl_term_dc && (2 * col_temp) >= -col_lendiff)\r\n\r\n # If all we're doing is erasing the invisible characters in the\r\n # prompt string, don't bother. It screws up the assumptions\r\n # about what's on the screen.\r\n if (@_rl_horizontal_scroll_mode && @_rl_last_c_pos == 0 &&\r\n -lendiff == @visible_wrap_offset)\r\n col_lendiff = 0\r\n end\r\n\r\n if (col_lendiff!=0)\r\n delete_chars(-col_lendiff) # delete (diff) characters\r\n end\r\n\r\n # Copy (new) chars to screen from first diff to last match\r\n temp = nls - nfd\r\n if (temp > 0)\r\n # If nfd begins at the prompt, or before the invisible characters in\r\n # the prompt, we need to adjust _rl_last_c_pos in a multibyte locale\r\n # to account for the wrap offset and set cpos_adjusted accordingly.\r\n _rl_output_some_chars(new,nfd, temp)\r\n if !@rl_byte_oriented\r\n @_rl_last_c_pos += _rl_col_width(new,nfd,nfd+temp)\r\n if current_line == 0 && @wrap_offset && nfd <= @prompt_last_invisible\r\n @_rl_last_c_pos -= @wrap_offset\r\n @cpos_adjusted = true\r\n end\r\n else\r\n @_rl_last_c_pos += temp\r\n end\r\n end\r\n\r\n # Otherwise, print over the existing material.\r\n else\r\n if (temp > 0)\r\n # If nfd begins at the prompt, or before the invisible characters in\r\n # the prompt, we need to adjust _rl_last_c_pos in a multibyte locale\r\n # to account for the wrap offset and set cpos_adjusted accordingly.\r\n _rl_output_some_chars(new,nfd, temp)\r\n @_rl_last_c_pos += col_temp # XXX\r\n if !@rl_byte_oriented\r\n if current_line == 0 && @wrap_offset && nfd <= @prompt_last_invisible\r\n @_rl_last_c_pos -= @wrap_offset\r\n @cpos_adjusted = true\r\n end\r\n end\r\n end\r\n\r\n lendiff = (oe) - (ne)\r\n if !@rl_byte_oriented\r\n col_lendiff = _rl_col_width(old, ostart, ostart+oe) - _rl_col_width(new, 0, ne)\r\n else\r\n col_lendiff = lendiff\r\n end\r\n\r\n if (col_lendiff!=0)\r\n if (@_rl_term_autowrap && current_line < inv_botlin)\r\n space_to_eol(col_lendiff)\r\n else\r\n _rl_clear_to_eol(col_lendiff)\r\n end\r\n end\r\n end\r\n end\r\n end",
"def append_ext(str)\r\n unless String === str\r\n raise ArgumentError, \"argument musi byc typu String\"\r\n else\r\n str << \".txt\"\r\n end\r\nend",
"def add_after_or_append(filename, matching_text, text_to_add, before_text, after_text)\n content = File.read(filename)\n if content.include?(matching_text)\n add_after(filename, matching_text, text_to_add)\n else\n append_file(filename, [before_text, text_to_add, after_text].join(\"\\n\"))\n end\n end",
"def test_file_must_contain_append()\n\t\tCfruby::FileEdit.file_must_contain(@multilinefilename, \"new line\", :position => Cfruby::FileEdit::APPEND)\n\t\tFile.open(@multilinefilename, File::RDONLY) { |fp|\n\t\t\tlines = fp.readlines()\n\t\t\tassert_equal(\"new line\\n\", lines[-1])\n\t\t}\n\tend",
"def line_break=(char)\n @resource.line_break = char\n end",
"def rl_replace_line(text, clear_undo)\r\n len = text.delete(0.chr).length\r\n @rl_line_buffer = text.dup + 0.chr\r\n @rl_end = len\r\n if (clear_undo)\r\n rl_free_undo_list()\r\n end\r\n _rl_fix_point(true)\r\n end",
"def set_line_mode data=\"\"\n @lt2_mode = :lines\n (@lt2_linebuffer ||= []).clear\n receive_data data.to_s\n end",
"def set_EndsWith(value)\n set_input(\"EndsWith\", value)\n end",
"def set_EndsWith(value)\n set_input(\"EndsWith\", value)\n end",
"def set_EndsWith(value)\n set_input(\"EndsWith\", value)\n end",
"def set_EndsWith(value)\n set_input(\"EndsWith\", value)\n end",
"def set_EndsWith(value)\n set_input(\"EndsWith\", value)\n end",
"def set_content_type(override=false)\n if override || file.content_type.blank?\n File.open(file.path) do |fd|\n data = fd.read(1024) || \"\"\n new_content_type = filemagic.buffer(data)\n if file.respond_to?(:content_type=)\n file.content_type = new_content_type\n else\n file.instance_variable_set(:@content_type, new_content_type)\n end\n end\n end\n end",
"def file_type\n\t\tline = @file_desc.gets\n\t\t@file_desc.pos = 0 # Reset our location within the file\n\t\t\t\t\n\t\ttype = case line[line.rindex(' ')-1].chr\n\t\t\twhen ',' then :comma\n\t\t\twhen '|' then :pipe\n\t\t\telse :space\n\t\tend\n\tend",
"def rename_text_in_file(file, text1, text2)\n oldf = File.read(file)\n newf = oldf.gsub(text1, text2)\n File.open(file, \"w\") {|f| f.puts newf}\n end",
"def lex\n file_beg_changed\n notify_file_beg_observers(@file_name)\n\n super\n\n file_end_changed\n notify_file_end_observers(count_trailing_newlines(@original_file_text))\n end",
"def add_line_to_file(filename, new_value, line_number = nil)\n File.open(filename, 'r+') do |file|\n lines = file.each_line.to_a\n if line_number\n lines[line_number] = new_value + \"\\n\"\n else\n lines.push(new_value + \"\\n\")\n end\n file.rewind\n file.write(lines.join)\n file.close\n end\n end",
"def initialize(file, newline = LF)\n @file = file\n @newline = newline\n end",
"def write(text)\n return if text.nil? || text.empty?\n # lines cannot start with a '.'. insert zero-width character before.\n if text[0,2] == '\\.' &&\n (@buf.last && @buf.last[-1] == ?\\n)\n @buf << '\\&'\n end\n @buf << text\n end",
"def write_to_file file, *text\n text.flatten!\n\n File.open(File.expand_path(file), 'a+') do |file|\n full_text = (text * \"\\n\") + \"\\n\"\n\n unless file.read.include? full_text\n file.write full_text\n end\n end\n end",
"def append_line_to_file(filename, line)\n FileUtils.touch(filename)\n File.open(filename, 'a') do |f|\n f.puts line\n end\nend",
"def change_line(line_num, text) \n\t\traise \"no newlines here yet please\" if text =~ /\\n/\n\t\n\t\tix1, ix2 = line_index(line_num) + 1, line_index(line_num + 1)\n\t\t@text[ix1...ix2] = text\n\t\t(line_num...@line_indices.length).each { |i| @line_indices[i] += text.length - (ix2 - ix1) }\n\tend",
"def set_lines\n set_line(:line_item, OLE_QA::Framework::OLEFS::Line_Item)\n end",
"def normalize_line_endings(string)\n Decidim::ContentParsers::NewlineParser.new(string, context: {}).rewrite\n end",
"def test_file_prepend()\n\t\t# test the empty file\n\t\tCfruby::FileEdit.file_prepend(@emptyfilename, \"new line\")\n\t\tlines = File.open(@emptyfilename, File::RDONLY).readlines()\n\t\tassert_equal(1, lines.length)\n\t\tassert_equal(\"new line\\n\", lines[0])\n\t\t\n\t\t# test the multiline file\n\t\tCfruby::FileEdit.file_prepend(@multilinefilename, \"new line\")\n\t\tlines = File.open(@multilinefilename, File::RDONLY).readlines()\n\t\tassert_equal(@multilinefilecontents.split(\"\\n\").length+1, lines.length)\n\t\tassert_equal(\"new line\\n\", lines[0])\t\t\n\tend",
"def end_of_string\n @suffixes += '\\z'\n end",
"def file_end(file, output)\n end",
"def end_line\n attributes.fetch(:endLine)\n end",
"def add_file(file, line = T.unsafe(nil), has_comments = T.unsafe(nil)); end",
"def make line_to_change, phrase_we_have_now, phrase_we_want_to_have, file_path\n verbose = $conf[:verbose]\n if verbose\n puts \"\\e[39m-----------------------------\"\n puts \"I'm changing:\\n#{phrase_we_have_now}\"\n puts '-----------------------------'\n puts \"to:\\n#{phrase_we_want_to_have}\"\n puts '-----------------------------'\n end\n\n #Change every occurence\n puts \"in file:\\n#{file_path}\" if verbose\n data = File.read(file_path)\n puts \"\\n\\e[31m++Old version: \\e[30m\\n\" if verbose\n puts data + \"\\n\" if verbose\n\n line_changed = line_to_change.gsub(phrase_we_have_now, phrase_we_want_to_have)\n data.sub! line_to_change, line_changed\n\n puts \"\\n\\e[32m++New version: \\e[30m\\n\" if verbose\n puts data + \"\\n\" if verbose\n puts \"\\e[31mOld line:\\n #{line_to_change}\\e[32m\\nNew line:\\n#{line_changed}\\e[30m\" #Standard info. verbose = true -> shows all file\n #Write the file\n res = false\n res = File.open(file_path, \"w\") do |f|\n f.write(data)\n end\n if res\n return true\n end\n false\n end",
"def change_lines_in_file(file_path, &change)\n print \"Fixing #{file_path}...\\n\"\n\n contents = []\n\n file = File.open(file_path, 'r')\n file.each_line do | line |\n contents << line\n end\n file.close\n\n File.open(file_path, 'w') do |f|\n f.puts(change.call(contents))\n end\nend",
"def change_lines_in_file(file_path, &change)\n print \"Fixing #{file_path}...\\n\"\n\n contents = []\n\n file = File.open(file_path, 'r')\n file.each_line do |line|\n contents << line\n end\n file.close\n\n File.open(file_path, 'w') do |f|\n f.puts(change.call(contents))\n end\n end",
"def putData(data, filename, *carriage)\n if carriage == [nil] || carriage == [\"MAC\"]\n carriage = \"\\n\"\n elsif carriage == [\"WIN\"]\n carriage = \"\\r\\n\"\n end\n\n file = File.open(filename, 'w')\n file << \"#{data[0]}#{data[1]}\"\n data[2].row_vectors.each do |row|\n line = \"H\\t#{row[0]}\\t#{row[1]}\\t#{row[2]}#{carriage}\"\n file << line\n end\n\n file.close()\n end",
"def change_lines_in_file(file_path, &change)\n print \"Fixing #{file_path}...\\n\"\n \n contents = []\n \n file = File.open(file_path, 'r')\n file.each_line do | line |\n contents << line\n end\n file.close\n \n File.open(file_path, 'w') do |f|\n f.puts(change.call(contents))\n end\nend",
"def edit_text text\n # 2010-06-29 10:24 \n require 'fileutils'\n require 'tempfile'\n ed = ENV['EDITOR'] || \"vim\"\n temp = Tempfile.new \"tmp\"\n File.open(temp,\"w\"){ |f| f.write text }\n mtime = File.mtime(temp.path)\n #system(\"#{ed} #{temp.path}\")\n system(ed, temp.path)\n\n newmtime = File.mtime(temp.path)\n newstr = nil\n if mtime < newmtime\n # check timestamp, if updated ..\n newstr = File.read(temp)\n else\n #puts \"user quit without saving\"\n return nil\n end\n return newstr.chomp if newstr\n return nil\n end",
"def set_lines\n set_line(:receiving_line,OLE_QA::Framework::OLEFS::Receiving_Line)\n end",
"def _patch_part(text_part, text_orig, sline, eline)\n lines = text_orig.split(\"\\n\", -1)\n lines[(sline -1) ..(eline-1)] = text_part.split(\"\\n\", -1)\n lines.join(\"\\n\")\n end",
"def setEndDateFormat(endDateFormat)\r\n\t\t\t\t\t@endDateFormat = endDateFormat\r\n\t\t\t\tend",
"def last_line; end",
"def last_line; end",
"def last_line; end",
"def last_line; end",
"def last_line; end",
"def last_line; end",
"def last_line; end",
"def add_linebreaks(definition)\n definition.gsub(\"\\r\", '<br>')\nend",
"def replace_string_eol\n buffer.ask 'Replace selection with: ' do |answer, action|\n case action\n when :attempt\n if !answer.empty?\n replace_string_eol!(answer)\n :abort\n else\n buffer.warn 'replacement required'\n end\n end\n end\n end"
] | [
"0.68497586",
"0.6341286",
"0.57823133",
"0.57073545",
"0.570237",
"0.5607141",
"0.55474347",
"0.5509994",
"0.5402241",
"0.53981376",
"0.5395558",
"0.5331249",
"0.52781695",
"0.52503693",
"0.5241467",
"0.5238761",
"0.5163444",
"0.5163444",
"0.50835234",
"0.50502414",
"0.48794046",
"0.48358977",
"0.4830638",
"0.48297414",
"0.4785711",
"0.4779765",
"0.47590253",
"0.4748156",
"0.47430396",
"0.47309494",
"0.47149736",
"0.46966663",
"0.4691785",
"0.4688569",
"0.46874753",
"0.46860045",
"0.46840185",
"0.46745583",
"0.46422434",
"0.46353468",
"0.46320617",
"0.45849255",
"0.45828304",
"0.457897",
"0.45569873",
"0.4524194",
"0.44966018",
"0.44843453",
"0.4481261",
"0.44787356",
"0.44748542",
"0.4474608",
"0.44656917",
"0.44492364",
"0.44452944",
"0.44339418",
"0.44248876",
"0.4424821",
"0.44239298",
"0.44235688",
"0.44158998",
"0.44158998",
"0.44158998",
"0.44158998",
"0.44158998",
"0.4408309",
"0.44076538",
"0.4407034",
"0.44034466",
"0.4381807",
"0.43806484",
"0.4375584",
"0.43716818",
"0.43605423",
"0.43597114",
"0.43585446",
"0.4351888",
"0.4350168",
"0.43475068",
"0.4335298",
"0.43255794",
"0.43218333",
"0.43162972",
"0.4311857",
"0.43111056",
"0.43074974",
"0.42971346",
"0.4296278",
"0.4290447",
"0.4289496",
"0.42885298",
"0.42841494",
"0.42841494",
"0.42841494",
"0.42841494",
"0.42841494",
"0.42841494",
"0.42841494",
"0.42840248",
"0.42791012"
] | 0.562701 | 5 |
Detect line endings of a text file Detect line ending type (Windows, Unix or Mac) of an input file. | def edit_text_detect_line_endings(input_file, opts = {})
data, _status_code, _headers = edit_text_detect_line_endings_with_http_info(input_file, opts)
data
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getFileLineEndings(file)\n File.open(file, 'rb') do |f|\n return f.readline[/\\r?\\n$/]\n end\nend",
"def getFileLineEndings(file)\n File.open(file, 'rb') do |f|\n return f.readline[/\\r?\\n$/]\n end\nend",
"def guess_line_ending(filehandle, options)\n counts = {\"\\n\" => 0, \"\\r\" => 0, \"\\r\\n\" => 0}\n quoted_char = false\n\n # count how many of the pre-defined line-endings we find\n # ignoring those contained within quote characters\n last_char = nil\n lines = 0\n filehandle.each_char do |c|\n quoted_char = !quoted_char if c == options[:quote_char]\n next if quoted_char\n\n if last_char == \"\\r\"\n if c == \"\\n\"\n counts[\"\\r\\n\"] += 1\n else\n counts[\"\\r\"] += 1 # \\r are counted after they appeared\n end\n elsif c == \"\\n\"\n counts[\"\\n\"] += 1\n end\n last_char = c\n lines += 1\n break if options[:auto_row_sep_chars] && options[:auto_row_sep_chars] > 0 && lines >= options[:auto_row_sep_chars]\n end\n rewind(filehandle)\n\n counts[\"\\r\"] += 1 if last_char == \"\\r\"\n # find the most frequent key/value pair:\n k, _ = counts.max_by{|_, v| v}\n return k\n end",
"def eol_pattern()\n return /\\r\\n?|\\n/ # Applicable to *nix, Mac, Windows eol conventions\n end",
"def edit_text_change_line_endings(line_ending_type, input_file, opts = {})\n data, _status_code, _headers = edit_text_change_line_endings_with_http_info(line_ending_type, input_file, opts)\n data\n end",
"def newline_check(file_name)\n # check if the file has no newline or multiple newlines\n lines = File.open(file_name, 'r').to_a\n # if the last character of the last line with code is a newline character AND there is additional text on that line, set hasSingleNewline to true; otherwise set it to false\n hasSingleNewline = lines.last[-1] == \"\\n\" && lines.last.length > 1\n # if there isn't already a single newline at the end of the file, call the process(text) method to add one in (or delete multiple ones and add a newline in)\n if !hasSingleNewline\n text = File.read(file_name)\n # re-write the file with the final file text returned by the process(text) method\n File.open(file_name, \"w\") { |file| file.puts process(text) }\n end\nend",
"def is_text?(line)\n case NKF.guess(line)\n when NKF::BINARY then\n #puts \"===> it is binary file!\"\n return false;\n when NKF::JIS then \n #puts \"===> it is jis file!\"\n when NKF::SJIS then\n #puts \"===> it is sjis file!\"\n when NKF::UNKNOWN then\n #puts \"===> it is unknwon file!\"\n return false;\n when NKF::ASCII then\n #puts \"===> it is ascii file!\"\n when NKF::UTF8 then\n #puts \"===> it is utf8 file!\"\n when NKF::UTF16 then\n #puts \"===> it is utf16 file!\"\n end\n true\nend",
"def edit_text_detect_line_endings_with_http_info(input_file, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: EditTextApi.edit_text_detect_line_endings ...'\n end\n # verify the required parameter 'input_file' is set\n if @api_client.config.client_side_validation && input_file.nil?\n fail ArgumentError, \"Missing the required parameter 'input_file' when calling EditTextApi.edit_text_detect_line_endings\"\n end\n # resource path\n local_var_path = '/convert/edit/text/line-endings/detect'\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', 'text/json', 'application/xml', 'text/xml'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['multipart/form-data'])\n\n # form parameters\n form_params = {}\n form_params['inputFile'] = input_file\n\n # http body (model)\n post_body = nil\n auth_names = ['Apikey']\n data, status_code, headers = @api_client.call_api(:POST, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'DetectLineEndingsResponse')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: EditTextApi#edit_text_detect_line_endings\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def win_line_endings( src, dst )\n case ::File.extname(src)\n when *%w[.png .gif .jpg .jpeg]\n FileUtils.cp src, dst\n else\n ::File.open(dst,'w') do |fd|\n ::File.foreach(src, \"\\n\") do |line|\n line.tr!(\"\\r\\n\",'')\n fd.puts line\n end\n end\n end\n end",
"def end_line(kind); end",
"def end_stdin?(line)\n line =~ /^\\\\.$/\n end",
"def ensure_trailing_newline(file_text)\n count_trailing_newlines(file_text) > 0 ? file_text : (file_text + \"\\n\")\n end",
"def _normalize_line_end(line)\n return line unless @usecrlf\n # p [ \"nleln\", line ]\n line_len = line.respond_to?(:bytesize) ? line.bytesize : line.length\n last2 = line[line_len-2...line_len]\n # p [ \"nlel2\", last2 ]\n return line unless last2 == \"\\r\\n\"\n return line[0...line_len-2] + \"\\n\"\n end",
"def line_ending\n @line_ending ||= \"\\r\\n\"\n end",
"def test_file_must_not_contain_found()\n\t\tCfruby::FileEdit.file_must_not_contain(@multilinefilename, \"second line\")\n\t\tFile.open(@multilinefilename, File::RDONLY) { |fp|\n\t\t\tlines = fp.readlines()\n\t\t\tassert_equal(false, lines.include?(\"second line\\n\"))\n\t\t}\n\t\t\n\t\tCfruby::FileEdit.file_must_not_contain(@multilinefilename, /last/)\n\t\tFile.open(@multilinefilename, File::RDONLY) { |fp|\n\t\t\tlines = fp.readlines()\n\t\t\tassert_equal(false, lines.include?(\"last line\\n\"))\n\t\t}\n\tend",
"def is_unix_like?\n os_type !~ /^\\s*windows\\s*$/i\n end",
"def end_line kind\n end",
"def normalizes_line_endings\n attributes.fetch(:normalizesLineEndings)\n end",
"def ignore_processing?(mimetype)\n File.open(\"../ignore.types\", \"r\") do |f|\n while (line = f.gets)\n line.chomp!\n # ignore any commented lines and check for the extension\n if line[0] != \"#\" && line.eql?(mimetype) then\n return true\n end\n end\n end\n false\nend",
"def end_of_file(arg)\n @offenses << error('At the end of file: Final newline missing') unless arg.readlines.last.match(/\\n/)\n end",
"def is_endstr?(); @type == GRT_ENDSTR; end",
"def line_ending=(value)\n @line_ending = value || \"\\r\\n\"\n end",
"def windows?\n ::File::ALT_SEPARATOR == '\\\\'\n end",
"def relevant_file?(file)\n file.end_with?('_spec.rb')\n end",
"def on_line?(line)\n end",
"def test_file_must_not_contain_not_found()\n\t\tCfruby::FileEdit.file_must_not_contain(@multilinefilename, \"new line\")\n\t\tFile.open(@multilinefilename, File::RDONLY) { |fp|\n\t\t\tlines = fp.readlines()\n\t\t\tassert_equal(@multilinefilecontents.split(\"\\n\").length, lines.length)\n\t\t\tassert_equal(false, lines.include?(\"new line\\n\"))\n\t\t}\n\t\t\n\t\tCfruby::FileEdit.file_must_not_contain(@multilinefilename, /johnny/)\n\t\tFile.open(@multilinefilename, File::RDONLY) { |fp|\n\t\t\tlines = fp.readlines()\n\t\t\tassert_equal(@multilinefilecontents.split(\"\\n\").length, lines.length)\n\t\t}\n\tend",
"def run_newline\n newline = @raw_lines.shift\n\n # First, we test if the new line contains from/to timestamps,\n # and if so, start reading.\n try_match_to_from = @to_from_match.match(newline)\n if try_match_to_from.nil?\n newline_might_have_content(newline)\n else\n newline_has_from_to(try_match_to_from)\n end\n end",
"def lines(textFile)\n textFile.to_a.select {|line| /\\S/ =~ line and /^\\#/ !~ line}.length\nend",
"def newline?\n @kind == :newline\n end",
"def end_of_line\n @suffixes = '$'\n end",
"def on_windows?\n # Ruby only sets File::ALT_SEPARATOR on Windows and the Ruby standard\n # library uses that to test what platform it's on.\n !!File::ALT_SEPARATOR\n end",
"def end?\r\n\t\tif(@allLines.empty?)\r\n\t\t\treturn true\r\n\t\telse\r\n\t\t\treturn false\r\n\t\tend\r\n\tend",
"def handle_end\n if get_next_token.type != \"EOL\"\n raise @err_class, \"I don't know what you're talking about!\"\n end\n end",
"def find_end_line(node)\n if node.if_type? && node.else?\n node.loc.else.line\n elsif node.if_type? && node.ternary?\n node.else_branch.loc.line\n elsif node.if_type? && node.elsif?\n node.each_ancestor(:if).find(&:if?).loc.end.line\n elsif node.block_type? || node.numblock_type?\n node.loc.end.line\n elsif (next_sibling = node.right_sibling) && next_sibling.is_a?(AST::Node)\n next_sibling.loc.line\n elsif (parent = node.parent)\n parent.loc.respond_to?(:end) && parent.loc.end ? parent.loc.end.line : parent.loc.line\n else\n node.loc.end.line\n end\n end",
"def potential_lines(filename); end",
"def is_exe? filename,system_config,platform\n obj,lib,exe=*system_config.extensions(platform)\n return filename.end_with?(exe)\n end",
"def find_valid_data filename\n start = 0\n dbfile = File.new(filename)\n s = dbfile.gets\n while s[0] == ?# or s[0]==?\\n\n start+= s.size\n s = dbfile.gets\n end\n dbfile.seek(-128, File::SEEK_END)\n s = dbfile.read(128).chomp;\n last = s.rindex(\"\\n\");\n dbfile.close\n return [start-1,File.size(filename) - last]\nend",
"def potential_line?(filename, lineno); end",
"def last_line_only(range)\n if range.line != range.last_line\n range.adjust(begin_pos: range.source =~ /[^\\n]*\\z/)\n else\n range\n end\n end",
"def detect_filename_in(full_line)\n line_might_contain_filename = full_line.scan(/^\\+\\+\\+ b(.+)$/)\n\n return if line_might_contain_filename.empty?\n @filename = line_might_contain_filename.first.first\n\n if @filename !~ KNOWN_FILETYPES\n @filename = nil\n end\n end",
"def test_file_must_nofuzzy()\n\t\tCfruby::FileEdit.file_must_contain(@multilinefilename, \" first line\", :fuzzymatch => false)\n\t\tFile.open(@multilinefilename, File::RDONLY) { |fp|\n\t\t\tlines = fp.readlines()\n\t\t\tassert(lines.length == @multilinefilecontents.split(\"\\n\").length + 1)\n\t\t\tfirstcount = 0\n\t\t\tlines.each() { |line|\n\t\t\t\tif(line =~ /first/)\n\t\t\t\t\tfirstcount = firstcount + 1\n\t\t\t\tend\n\t\t\t}\n\t\t\tassert_equal(2, firstcount)\n\t\t}\n\t\t\n\t\tCfruby::FileEdit.file_must_not_contain(@multilinefilename, \" first line\", :fuzzymatch => false)\n\t\tFile.open(@multilinefilename, File::RDONLY) { |fp|\n\t\t\tlines = fp.readlines()\n\t\t\tassert(lines.length == @multilinefilecontents.split(\"\\n\").length)\n\t\t\tfirstcount = 0\n\t\t\tlines.each() { |line|\n\t\t\t\tif(line =~ /first/)\n\t\t\t\t\tfirstcount = firstcount + 1\n\t\t\t\tend\n\t\t\t}\n\t\t\tassert_equal(1, firstcount)\n\t\t}\n\tend",
"def edit_text_change_line_endings_with_http_info(line_ending_type, input_file, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: EditTextApi.edit_text_change_line_endings ...'\n end\n # verify the required parameter 'line_ending_type' is set\n if @api_client.config.client_side_validation && line_ending_type.nil?\n fail ArgumentError, \"Missing the required parameter 'line_ending_type' when calling EditTextApi.edit_text_change_line_endings\"\n end\n # verify the required parameter 'input_file' is set\n if @api_client.config.client_side_validation && input_file.nil?\n fail ArgumentError, \"Missing the required parameter 'input_file' when calling EditTextApi.edit_text_change_line_endings\"\n end\n # resource path\n local_var_path = '/convert/edit/text/line-endings/change'\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', 'text/json', 'application/xml', 'text/xml'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['multipart/form-data'])\n header_params[:'lineEndingType'] = line_ending_type\n\n # form parameters\n form_params = {}\n form_params['inputFile'] = input_file\n\n # http body (model)\n post_body = nil\n auth_names = ['Apikey']\n data, status_code, headers = @api_client.call_api(:POST, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'ChangeLineEndingResponse')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: EditTextApi#edit_text_change_line_endings\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def is_continuing_line?(line)\n line.expunge =~ /^[^#]*\\\\\\s*(#.*)?$/\n #first use expunge to eliminate inline closures\n #that may contain comment char '#'\n end",
"def test_file_must_contain_append()\n\t\tCfruby::FileEdit.file_must_contain(@multilinefilename, \"new line\", :position => Cfruby::FileEdit::APPEND)\n\t\tFile.open(@multilinefilename, File::RDONLY) { |fp|\n\t\t\tlines = fp.readlines()\n\t\t\tassert_equal(\"new line\\n\", lines[-1])\n\t\t}\n\tend",
"def line_processor\n open(\"tmp/insert_YourFileName_lines.txt\") do |f|\n f.each do |line| \n unless line =~ /^$/\n puts line.to_s.to_textual\n end\n end\n end\n \nend",
"def last_line; end",
"def last_line; end",
"def last_line; end",
"def last_line; end",
"def last_line; end",
"def last_line; end",
"def last_line; end",
"def clean_line_breaks(os_platform, script_file, contents = nil)\n return if os_platform =~ /win/\n contents = File.open(script_file).read if contents.nil?\n fil = File.open(script_file,\"w+\")\n fil.puts contents.gsub(\"\\r\", \"\")\n fil.flush\n fil.close\n script_file\nend",
"def test_file_must_contain_contains()\n\t\tCfruby::FileEdit.file_must_contain(@multilinefilename, \"second line\")\n\t\tFile.open(@multilinefilename, File::RDONLY) { |fp|\n\t\t\tlines = fp.readlines()\n\t\t\tassert_equal(@multilinefilecontents.split(\"\\n\").length, lines.length)\n\t\t}\n\tend",
"def read_end_data\n _app, data = File.read(file).split(/^__END__$/, 2)\n data || ''\n end",
"def test_file_must_contain_new()\n\t\tCfruby::FileEdit.file_must_contain(@multilinefilename, \"new line\")\n\t\tFile.open(@multilinefilename, File::RDONLY) { |fp|\n\t\t\tlines = fp.readlines()\n\t\t\tassert_equal(true, lines.include?(\"new line\\n\"))\n\t\t}\n\tend",
"def read_last_line(f)\n pos = 2\n f.seek(-pos, File::SEEK_END)\n c = f.getc\n result = ''\n while c.chr != \"\\n\"\n result.insert(0,c.chr)\n pos += 1\n f.seek(-pos, File::SEEK_END)\n c = f.getc\n end\n f.rewind\n return result\nend",
"def is_endlib?(); @type == GRT_ENDLIB; end",
"def convert_eol_to_unix!\n local_copy.in_place :perl, EOL_TO_UNIX\n end",
"def find_line_boundary(text, start_index, rightwards)\n index = start_index\n vector = -1\n vector = 1 if rightwards\n\n loop do\n character = text[index]\n\n if rightwards\n break if index >= text.length\n break if character == \"\\n\"\n else\n break if index <= 0\n break if text[index - 1] == \"\\n\"\n end\n\n index = index + vector\n end\n\n index\n end",
"def check_format(file)\n \tbegin\n content = file_content(file)\n content = content.split(\"\\n\").reject { |c| c.empty? }\n read_file(content)\n rescue\n raise_error ERROR_READING_FILE\n end\n end",
"def types(file, line, col); end",
"def types(file, line, col); end",
"def metadata_end(text)\n text.index(\"\\1\\n\", 2)\n end",
"def file_type file_name \n\t\tFile.extname( file_name ).gsub /^\\./, '' \n\tend",
"def text_file?(file)\n return false unless File.readable?(file)\n bytes = File.stat(file).blksize\n bytes = 4096 if bytes > 4096\n s = (File.read(file, bytes) || \"\")\n s = s.encode('US-ASCII', :undef => :replace).split(//)\n return (s.grep(\" \"..\"~\").size.to_f / s.size.to_f) > 0.85\n end",
"def is_multiline?(line) # ' '[0] == 32\n line && line.length > 1 && line[-1] == MULTILINE_CHAR_VALUE && line[-2] == 32\n end",
"def check\n file_nil\n if @file.end_with?(\".txt\")\n if File.exist?(@file)\n @f = Command_File.new(@file)\n else\n raise \"File \\\"#{@file}\\\" does not Exist\n Please choose a \\\".txt\\\" file that exists\"\n end\n else\n raise \"Invalid Input File \\\"#{@file}\\\"\n File must end in \\\".txt\\\"\"\n end\n end",
"def lex_end line\n ends << line\n end",
"def binary?(file)\n return false if file =~ /\\.(rb|txt)$/\n\n s = File.read(file, 1024) or return false\n\n have_encoding = s.respond_to? :encoding\n\n if have_encoding then\n return false if s.encoding != Encoding::ASCII_8BIT and s.valid_encoding?\n end\n\n return true if s[0, 2] == Marshal.dump('')[0, 2] or s.index(\"\\x00\")\n\n if have_encoding then\n s.force_encoding Encoding.default_external\n\n not s.valid_encoding?\n else\n if 0.respond_to? :fdiv then\n s.count(\"\\x00-\\x7F\", \"^ -~\\t\\r\\n\").fdiv(s.size) > 0.3\n else # HACK 1.8.6\n (s.count(\"\\x00-\\x7F\", \"^ -~\\t\\r\\n\").to_f / s.size) > 0.3\n end\n end\n end",
"def fix_normalize_trailing_newlines(options)\n # This would use the input option, however that may not work since\n # we touch lots of directories as part of an import.\n # input_file_spec = options['input'] || 'rtfile_dir/repositext_files'\n # Repositext::Cli::Utils.change_files_in_place(\n # config.compute_glob_pattern(input_file_spec),\n # /.\\z/i,\n # \"Normalizing trailing newlines\",\n # options\n # ) do |contents, filename|\n # [Outcome.new(true, { contents: contents.gsub(/(?<!\\n)\\n*\\z/, \"\\n\") }, [])]\n # end\n\n which_files = :all # :content_at_only or :all\n case which_files\n when :content_at_only\n base_dirs = %w[content_dir]\n file_type = 'at_files'\n when :all\n # Process all subfolders of root. Don't touch files in root.\n base_dirs = %w[\n content_dir\n folio_import_dir\n idml_import_dir\n plain_kramdown_export_dir\n reports_dir\n subtitle_export_dir\n subtitle_import_dir\n subtitle_tagging_export_dir\n subtitle_tagging_import_dir\n ]\n file_type = 'repositext_files'\n else\n raise \"Invalid which_files: #{ which_files.inspect }\"\n end\n base_dirs.each do |base_dir_name|\n input_file_spec = \"#{ base_dir_name }/#{ file_type }\"\n Repositext::Cli::Utils.change_files_in_place(\n config.compute_glob_pattern(input_file_spec),\n /.\\z/i,\n \"Normalizing trailing newlines in #{ base_dir_name }/#{ file_type }\",\n options\n ) do |contents, filename|\n [Outcome.new(true, { contents: contents.gsub(/(?<!\\n)\\n*\\z/, \"\\n\") }, [])]\n end\n end\n end",
"def skip_to_eoln\r\n @source.get until @source.eoln?\r\n true\r\n end",
"def valid_file_type filename\n # avoid hacks that break out of single quotes echoed to shell\n filename.gsub!(\"'\", '')\n `file '#{filename}'`.split(':').last.downcase =~ Regexp.union(*valid_file_types)\n end",
"def list?(line)\n return line =~ /^# \\* / ? '\\n' : ''\nend",
"def swap_lines sep, linebreak\n lines = File.readlines(self).collect(&:chomp)\n result = lines.collect {|line| line.swap sep}\n return false if lines == result\n linebreak = {unix: \"\\n\", mac: \"\\r\", windows: \"\\r\\n\"}.fetch(linebreak) do |k|\n raise KeyError, k.to_s\n end\n File.open(self, 'w') {|file| file.puts result.join(linebreak)}\n true\n end",
"def is_exe?(filename, system_config, platform)\n obj, lib, exe = *system_config.extensions(platform)\n return filename.end_with?(exe)\n end",
"def file?\n case type\n when T_REGULAR then true\n when T_UNKNOWN then nil\n else false\n end\n end",
"def separator(fname)\n f = File.open(fname)\n enum = f.each_char\n c = enum.next\n loop do\n case c[/\\r|\\n/]\n when \"\\n\" then break\n when \"\\r\"\n c << \"\\n\" if enum.peek == \"\\n\"\n break\n end\n c = enum.next\n end\n c[0][/\\r|\\n/] ? c : \"\\n\"\n end",
"def last_line_only(range); end",
"def last_line_only(range); end",
"def last_line_only(range); end",
"def isBinary?(fname)\n readbuf = get_file_contents(fname)\n count = 0\n# puts \"The size is: #{readbuf.length()}.\"\n threshold = Integer(readbuf.length() * 0.25)\n# puts \"Threshold: #{threshold}.\"\n readbuf.each_byte do |byte| #I have to use each_byte because Ruby 1.8.6 (Darwin) is\n #fucked and doesnt have String::each_char\n if !(0x20..0x7f).include?(byte) then\n #puts \"Non-ascii byte found: #{byte}\"\n count+=1 \n end\n end\n# puts \"#{count} nonascii bytes found in file.\"\n if count >= threshold then\n return true\n else \n return false\n end\nend",
"def eol!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 39 )\n\n type = EOL\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 138:6: ( '\\\\r' )? '\\\\n'\n # at line 138:6: ( '\\\\r' )?\n alt_2 = 2\n look_2_0 = @input.peek( 1 )\n\n if ( look_2_0 == 0xd )\n alt_2 = 1\n end\n case alt_2\n when 1\n # at line 138:6: '\\\\r'\n match( 0xd )\n\n end\n match( 0xa )\n\n \n @state.type = type\n @state.channel = channel\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 39 )\n\n end",
"def regex_end_prefix\n Regexp.new(\"endline#{VM_PREFIX}\")\nend",
"def file_type file_name \n File.extname( file_name ).gsub /^\\./, '' \n end",
"def filetype f\n return nil unless f\n\n f = Shellwords.escape(f)\n s = `file #{f}`\n return :text if s.index 'text'\n return :zip if s.index(/[Zz]ip/)\n return :zip if s.index('archive')\n return :image if s.index 'image'\n return :sqlite if s.index 'SQLite'\n # return :db if s.index 'database'\n return :text if s.index 'data'\n\n nil\nend",
"def file_type\n\t\tline = @file_desc.gets\n\t\t@file_desc.pos = 0 # Reset our location within the file\n\t\t\t\t\n\t\ttype = case line[line.rindex(' ')-1].chr\n\t\t\twhen ',' then :comma\n\t\t\twhen '|' then :pipe\n\t\t\telse :space\n\t\tend\n\tend",
"def file?\n (@typeflag == \"0\" || @typeflag == \"\\0\") && [email protected]_with?(\"/\")\n end",
"def last_line(src)\n if n = src.rindex(\"\\n\")\n src[(n+1) .. -1]\n else\n src\n end\nend",
"def eof?() end",
"def eof?() end",
"def eof?() end",
"def supported_file?(path)\n ext = File.extname(path)\n return true if ext.empty?\n ext =~ /\\.rbc\\Z/\n end",
"def parse_line_break; end",
"def modify_line_logic\n f = open($BACK_UCF,\"r\")\n new = open($ORG_UCF,\"w\")\n mode = false\n match = false\n cont = false\n i = 0, j = 0\n target_word = \"\"\n\n while line = f.gets\n\n if/_rt/ =~ line\n if /^#/ =~ line\n else\n line = \"#\" + line\n end\n end\n\n if cont == true\n if /^#/ =~ line\n else\n line = \"#\" + line\n end\n if /}\\\";$/ =~ line\n cont = false\n end\n end \n \n $remove_list_bld.each do |net|\n error_net = net.gsub(\"\\/\",\"\\\\/\")\n error_net = error_net.gsub(\"\\[\",\"\\\\[\")\n net = error_net.gsub(\"\\]\",\"\\\\]\")\n if /#{net}/ =~ line\n if /^#/ =~ line\n elsif /\\AINST/ =~ line\n line = \"#\" + line\n if $VERBOSE == true\n printf(\"match [%4d]:%s\", i, line)\n i += 1\n end\n break\n elsif /\\ANET/ =~ line\n cont = true\n line = \"#\" + line\n if $VERBOSE == true\n printf(\"match [%04d]:%s\", i, line)\n i += 1\n end\n break\n else\n printf(\"[E] %s\", line)\n exit\n end\n end\n end\n if (j / 100) == 0\n printf(\".\")\n end\n j += 1\n new.write(line)\n end\n f.close\n printf(\"\\n\")\nend",
"def proper_ext?(raw_path)\n path = raw_path.is_a?(Pathname) ? raw_path : Pathname.new(raw_path)\n LokaliseRails.file_ext_regexp.match? path.extname\n end",
"def parse_crlf data\n return if data == ''\n if ilf = data.index(\"\\n\")\n # if we find a LF and that LF is after a CR we first handle\n # the CR\n if icr = data.index(\"\\r\") and ilf != (icr+1) and icr < ilf\n parse_cr data, icr\n else\n parse_lf data, ilf\n end\n else\n if icr = data.index(\"\\r\")\n parse_cr data, icr\n else\n @linebuffer << data\n @outputbuffer.print data\n end\n end\n end",
"def uses_extension?\n @format =~ /\\.[^\\.]+$/\n end",
"def eof?\n @input.eof?\n end",
"def receive_valid_lines_from_file\n File.readlines(FILE_NAME).select { |line| line.downcase.include?('post') }\nend"
] | [
"0.6703327",
"0.6703327",
"0.6207632",
"0.6109223",
"0.60947007",
"0.5926948",
"0.5896254",
"0.58617353",
"0.57788646",
"0.56891596",
"0.5603125",
"0.5536574",
"0.55011284",
"0.5449394",
"0.5424629",
"0.53867227",
"0.53442526",
"0.52886736",
"0.5246215",
"0.5242452",
"0.52294916",
"0.52222615",
"0.52093905",
"0.5156975",
"0.51132834",
"0.5097303",
"0.5091325",
"0.508518",
"0.5014937",
"0.5011654",
"0.49921498",
"0.49785957",
"0.49091175",
"0.4901756",
"0.489575",
"0.4864398",
"0.4856892",
"0.48349217",
"0.4832262",
"0.48189408",
"0.48157206",
"0.48033786",
"0.48014298",
"0.47989696",
"0.47976995",
"0.47946152",
"0.47946152",
"0.47946152",
"0.47946152",
"0.47946152",
"0.47946152",
"0.47946152",
"0.47822937",
"0.47776896",
"0.47765875",
"0.47694635",
"0.47689945",
"0.47624564",
"0.47535595",
"0.4751002",
"0.47493997",
"0.4743384",
"0.4743384",
"0.47402608",
"0.47325918",
"0.472118",
"0.47185048",
"0.47112593",
"0.47017986",
"0.47016472",
"0.46998718",
"0.4696207",
"0.46879253",
"0.46705166",
"0.46696064",
"0.4664108",
"0.46598834",
"0.46546814",
"0.4653334",
"0.4653334",
"0.4653334",
"0.4651658",
"0.4644486",
"0.46436936",
"0.46352285",
"0.4631438",
"0.4628909",
"0.4627845",
"0.46217468",
"0.46130383",
"0.46130383",
"0.46130383",
"0.4604213",
"0.46014574",
"0.4597143",
"0.45884612",
"0.45868766",
"0.4580974",
"0.45768094",
"0.45745245"
] | 0.7301763 | 0 |
Detect line endings of a text file Detect line ending type (Windows, Unix or Mac) of an input file. | def edit_text_detect_line_endings_with_http_info(input_file, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: EditTextApi.edit_text_detect_line_endings ...'
end
# verify the required parameter 'input_file' is set
if @api_client.config.client_side_validation && input_file.nil?
fail ArgumentError, "Missing the required parameter 'input_file' when calling EditTextApi.edit_text_detect_line_endings"
end
# resource path
local_var_path = '/convert/edit/text/line-endings/detect'
# query parameters
query_params = {}
# header parameters
header_params = {}
# HTTP header 'Accept' (if needed)
header_params['Accept'] = @api_client.select_header_accept(['application/json', 'text/json', 'application/xml', 'text/xml'])
# HTTP header 'Content-Type'
header_params['Content-Type'] = @api_client.select_header_content_type(['multipart/form-data'])
# form parameters
form_params = {}
form_params['inputFile'] = input_file
# http body (model)
post_body = nil
auth_names = ['Apikey']
data, status_code, headers = @api_client.call_api(:POST, local_var_path,
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,
:body => post_body,
:auth_names => auth_names,
:return_type => 'DetectLineEndingsResponse')
if @api_client.config.debugging
@api_client.config.logger.debug "API called: EditTextApi#edit_text_detect_line_endings\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def edit_text_detect_line_endings(input_file, opts = {})\n data, _status_code, _headers = edit_text_detect_line_endings_with_http_info(input_file, opts)\n data\n end",
"def getFileLineEndings(file)\n File.open(file, 'rb') do |f|\n return f.readline[/\\r?\\n$/]\n end\nend",
"def getFileLineEndings(file)\n File.open(file, 'rb') do |f|\n return f.readline[/\\r?\\n$/]\n end\nend",
"def guess_line_ending(filehandle, options)\n counts = {\"\\n\" => 0, \"\\r\" => 0, \"\\r\\n\" => 0}\n quoted_char = false\n\n # count how many of the pre-defined line-endings we find\n # ignoring those contained within quote characters\n last_char = nil\n lines = 0\n filehandle.each_char do |c|\n quoted_char = !quoted_char if c == options[:quote_char]\n next if quoted_char\n\n if last_char == \"\\r\"\n if c == \"\\n\"\n counts[\"\\r\\n\"] += 1\n else\n counts[\"\\r\"] += 1 # \\r are counted after they appeared\n end\n elsif c == \"\\n\"\n counts[\"\\n\"] += 1\n end\n last_char = c\n lines += 1\n break if options[:auto_row_sep_chars] && options[:auto_row_sep_chars] > 0 && lines >= options[:auto_row_sep_chars]\n end\n rewind(filehandle)\n\n counts[\"\\r\"] += 1 if last_char == \"\\r\"\n # find the most frequent key/value pair:\n k, _ = counts.max_by{|_, v| v}\n return k\n end",
"def eol_pattern()\n return /\\r\\n?|\\n/ # Applicable to *nix, Mac, Windows eol conventions\n end",
"def edit_text_change_line_endings(line_ending_type, input_file, opts = {})\n data, _status_code, _headers = edit_text_change_line_endings_with_http_info(line_ending_type, input_file, opts)\n data\n end",
"def newline_check(file_name)\n # check if the file has no newline or multiple newlines\n lines = File.open(file_name, 'r').to_a\n # if the last character of the last line with code is a newline character AND there is additional text on that line, set hasSingleNewline to true; otherwise set it to false\n hasSingleNewline = lines.last[-1] == \"\\n\" && lines.last.length > 1\n # if there isn't already a single newline at the end of the file, call the process(text) method to add one in (or delete multiple ones and add a newline in)\n if !hasSingleNewline\n text = File.read(file_name)\n # re-write the file with the final file text returned by the process(text) method\n File.open(file_name, \"w\") { |file| file.puts process(text) }\n end\nend",
"def is_text?(line)\n case NKF.guess(line)\n when NKF::BINARY then\n #puts \"===> it is binary file!\"\n return false;\n when NKF::JIS then \n #puts \"===> it is jis file!\"\n when NKF::SJIS then\n #puts \"===> it is sjis file!\"\n when NKF::UNKNOWN then\n #puts \"===> it is unknwon file!\"\n return false;\n when NKF::ASCII then\n #puts \"===> it is ascii file!\"\n when NKF::UTF8 then\n #puts \"===> it is utf8 file!\"\n when NKF::UTF16 then\n #puts \"===> it is utf16 file!\"\n end\n true\nend",
"def win_line_endings( src, dst )\n case ::File.extname(src)\n when *%w[.png .gif .jpg .jpeg]\n FileUtils.cp src, dst\n else\n ::File.open(dst,'w') do |fd|\n ::File.foreach(src, \"\\n\") do |line|\n line.tr!(\"\\r\\n\",'')\n fd.puts line\n end\n end\n end\n end",
"def end_line(kind); end",
"def end_stdin?(line)\n line =~ /^\\\\.$/\n end",
"def ensure_trailing_newline(file_text)\n count_trailing_newlines(file_text) > 0 ? file_text : (file_text + \"\\n\")\n end",
"def _normalize_line_end(line)\n return line unless @usecrlf\n # p [ \"nleln\", line ]\n line_len = line.respond_to?(:bytesize) ? line.bytesize : line.length\n last2 = line[line_len-2...line_len]\n # p [ \"nlel2\", last2 ]\n return line unless last2 == \"\\r\\n\"\n return line[0...line_len-2] + \"\\n\"\n end",
"def line_ending\n @line_ending ||= \"\\r\\n\"\n end",
"def test_file_must_not_contain_found()\n\t\tCfruby::FileEdit.file_must_not_contain(@multilinefilename, \"second line\")\n\t\tFile.open(@multilinefilename, File::RDONLY) { |fp|\n\t\t\tlines = fp.readlines()\n\t\t\tassert_equal(false, lines.include?(\"second line\\n\"))\n\t\t}\n\t\t\n\t\tCfruby::FileEdit.file_must_not_contain(@multilinefilename, /last/)\n\t\tFile.open(@multilinefilename, File::RDONLY) { |fp|\n\t\t\tlines = fp.readlines()\n\t\t\tassert_equal(false, lines.include?(\"last line\\n\"))\n\t\t}\n\tend",
"def is_unix_like?\n os_type !~ /^\\s*windows\\s*$/i\n end",
"def end_line kind\n end",
"def normalizes_line_endings\n attributes.fetch(:normalizesLineEndings)\n end",
"def ignore_processing?(mimetype)\n File.open(\"../ignore.types\", \"r\") do |f|\n while (line = f.gets)\n line.chomp!\n # ignore any commented lines and check for the extension\n if line[0] != \"#\" && line.eql?(mimetype) then\n return true\n end\n end\n end\n false\nend",
"def end_of_file(arg)\n @offenses << error('At the end of file: Final newline missing') unless arg.readlines.last.match(/\\n/)\n end",
"def is_endstr?(); @type == GRT_ENDSTR; end",
"def line_ending=(value)\n @line_ending = value || \"\\r\\n\"\n end",
"def windows?\n ::File::ALT_SEPARATOR == '\\\\'\n end",
"def relevant_file?(file)\n file.end_with?('_spec.rb')\n end",
"def on_line?(line)\n end",
"def test_file_must_not_contain_not_found()\n\t\tCfruby::FileEdit.file_must_not_contain(@multilinefilename, \"new line\")\n\t\tFile.open(@multilinefilename, File::RDONLY) { |fp|\n\t\t\tlines = fp.readlines()\n\t\t\tassert_equal(@multilinefilecontents.split(\"\\n\").length, lines.length)\n\t\t\tassert_equal(false, lines.include?(\"new line\\n\"))\n\t\t}\n\t\t\n\t\tCfruby::FileEdit.file_must_not_contain(@multilinefilename, /johnny/)\n\t\tFile.open(@multilinefilename, File::RDONLY) { |fp|\n\t\t\tlines = fp.readlines()\n\t\t\tassert_equal(@multilinefilecontents.split(\"\\n\").length, lines.length)\n\t\t}\n\tend",
"def run_newline\n newline = @raw_lines.shift\n\n # First, we test if the new line contains from/to timestamps,\n # and if so, start reading.\n try_match_to_from = @to_from_match.match(newline)\n if try_match_to_from.nil?\n newline_might_have_content(newline)\n else\n newline_has_from_to(try_match_to_from)\n end\n end",
"def lines(textFile)\n textFile.to_a.select {|line| /\\S/ =~ line and /^\\#/ !~ line}.length\nend",
"def newline?\n @kind == :newline\n end",
"def end_of_line\n @suffixes = '$'\n end",
"def on_windows?\n # Ruby only sets File::ALT_SEPARATOR on Windows and the Ruby standard\n # library uses that to test what platform it's on.\n !!File::ALT_SEPARATOR\n end",
"def end?\r\n\t\tif(@allLines.empty?)\r\n\t\t\treturn true\r\n\t\telse\r\n\t\t\treturn false\r\n\t\tend\r\n\tend",
"def handle_end\n if get_next_token.type != \"EOL\"\n raise @err_class, \"I don't know what you're talking about!\"\n end\n end",
"def find_end_line(node)\n if node.if_type? && node.else?\n node.loc.else.line\n elsif node.if_type? && node.ternary?\n node.else_branch.loc.line\n elsif node.if_type? && node.elsif?\n node.each_ancestor(:if).find(&:if?).loc.end.line\n elsif node.block_type? || node.numblock_type?\n node.loc.end.line\n elsif (next_sibling = node.right_sibling) && next_sibling.is_a?(AST::Node)\n next_sibling.loc.line\n elsif (parent = node.parent)\n parent.loc.respond_to?(:end) && parent.loc.end ? parent.loc.end.line : parent.loc.line\n else\n node.loc.end.line\n end\n end",
"def potential_lines(filename); end",
"def is_exe? filename,system_config,platform\n obj,lib,exe=*system_config.extensions(platform)\n return filename.end_with?(exe)\n end",
"def find_valid_data filename\n start = 0\n dbfile = File.new(filename)\n s = dbfile.gets\n while s[0] == ?# or s[0]==?\\n\n start+= s.size\n s = dbfile.gets\n end\n dbfile.seek(-128, File::SEEK_END)\n s = dbfile.read(128).chomp;\n last = s.rindex(\"\\n\");\n dbfile.close\n return [start-1,File.size(filename) - last]\nend",
"def potential_line?(filename, lineno); end",
"def last_line_only(range)\n if range.line != range.last_line\n range.adjust(begin_pos: range.source =~ /[^\\n]*\\z/)\n else\n range\n end\n end",
"def detect_filename_in(full_line)\n line_might_contain_filename = full_line.scan(/^\\+\\+\\+ b(.+)$/)\n\n return if line_might_contain_filename.empty?\n @filename = line_might_contain_filename.first.first\n\n if @filename !~ KNOWN_FILETYPES\n @filename = nil\n end\n end",
"def test_file_must_nofuzzy()\n\t\tCfruby::FileEdit.file_must_contain(@multilinefilename, \" first line\", :fuzzymatch => false)\n\t\tFile.open(@multilinefilename, File::RDONLY) { |fp|\n\t\t\tlines = fp.readlines()\n\t\t\tassert(lines.length == @multilinefilecontents.split(\"\\n\").length + 1)\n\t\t\tfirstcount = 0\n\t\t\tlines.each() { |line|\n\t\t\t\tif(line =~ /first/)\n\t\t\t\t\tfirstcount = firstcount + 1\n\t\t\t\tend\n\t\t\t}\n\t\t\tassert_equal(2, firstcount)\n\t\t}\n\t\t\n\t\tCfruby::FileEdit.file_must_not_contain(@multilinefilename, \" first line\", :fuzzymatch => false)\n\t\tFile.open(@multilinefilename, File::RDONLY) { |fp|\n\t\t\tlines = fp.readlines()\n\t\t\tassert(lines.length == @multilinefilecontents.split(\"\\n\").length)\n\t\t\tfirstcount = 0\n\t\t\tlines.each() { |line|\n\t\t\t\tif(line =~ /first/)\n\t\t\t\t\tfirstcount = firstcount + 1\n\t\t\t\tend\n\t\t\t}\n\t\t\tassert_equal(1, firstcount)\n\t\t}\n\tend",
"def edit_text_change_line_endings_with_http_info(line_ending_type, input_file, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: EditTextApi.edit_text_change_line_endings ...'\n end\n # verify the required parameter 'line_ending_type' is set\n if @api_client.config.client_side_validation && line_ending_type.nil?\n fail ArgumentError, \"Missing the required parameter 'line_ending_type' when calling EditTextApi.edit_text_change_line_endings\"\n end\n # verify the required parameter 'input_file' is set\n if @api_client.config.client_side_validation && input_file.nil?\n fail ArgumentError, \"Missing the required parameter 'input_file' when calling EditTextApi.edit_text_change_line_endings\"\n end\n # resource path\n local_var_path = '/convert/edit/text/line-endings/change'\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', 'text/json', 'application/xml', 'text/xml'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['multipart/form-data'])\n header_params[:'lineEndingType'] = line_ending_type\n\n # form parameters\n form_params = {}\n form_params['inputFile'] = input_file\n\n # http body (model)\n post_body = nil\n auth_names = ['Apikey']\n data, status_code, headers = @api_client.call_api(:POST, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'ChangeLineEndingResponse')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: EditTextApi#edit_text_change_line_endings\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def is_continuing_line?(line)\n line.expunge =~ /^[^#]*\\\\\\s*(#.*)?$/\n #first use expunge to eliminate inline closures\n #that may contain comment char '#'\n end",
"def test_file_must_contain_append()\n\t\tCfruby::FileEdit.file_must_contain(@multilinefilename, \"new line\", :position => Cfruby::FileEdit::APPEND)\n\t\tFile.open(@multilinefilename, File::RDONLY) { |fp|\n\t\t\tlines = fp.readlines()\n\t\t\tassert_equal(\"new line\\n\", lines[-1])\n\t\t}\n\tend",
"def line_processor\n open(\"tmp/insert_YourFileName_lines.txt\") do |f|\n f.each do |line| \n unless line =~ /^$/\n puts line.to_s.to_textual\n end\n end\n end\n \nend",
"def last_line; end",
"def last_line; end",
"def last_line; end",
"def last_line; end",
"def last_line; end",
"def last_line; end",
"def last_line; end",
"def clean_line_breaks(os_platform, script_file, contents = nil)\n return if os_platform =~ /win/\n contents = File.open(script_file).read if contents.nil?\n fil = File.open(script_file,\"w+\")\n fil.puts contents.gsub(\"\\r\", \"\")\n fil.flush\n fil.close\n script_file\nend",
"def test_file_must_contain_contains()\n\t\tCfruby::FileEdit.file_must_contain(@multilinefilename, \"second line\")\n\t\tFile.open(@multilinefilename, File::RDONLY) { |fp|\n\t\t\tlines = fp.readlines()\n\t\t\tassert_equal(@multilinefilecontents.split(\"\\n\").length, lines.length)\n\t\t}\n\tend",
"def read_end_data\n _app, data = File.read(file).split(/^__END__$/, 2)\n data || ''\n end",
"def read_last_line(f)\n pos = 2\n f.seek(-pos, File::SEEK_END)\n c = f.getc\n result = ''\n while c.chr != \"\\n\"\n result.insert(0,c.chr)\n pos += 1\n f.seek(-pos, File::SEEK_END)\n c = f.getc\n end\n f.rewind\n return result\nend",
"def test_file_must_contain_new()\n\t\tCfruby::FileEdit.file_must_contain(@multilinefilename, \"new line\")\n\t\tFile.open(@multilinefilename, File::RDONLY) { |fp|\n\t\t\tlines = fp.readlines()\n\t\t\tassert_equal(true, lines.include?(\"new line\\n\"))\n\t\t}\n\tend",
"def is_endlib?(); @type == GRT_ENDLIB; end",
"def convert_eol_to_unix!\n local_copy.in_place :perl, EOL_TO_UNIX\n end",
"def find_line_boundary(text, start_index, rightwards)\n index = start_index\n vector = -1\n vector = 1 if rightwards\n\n loop do\n character = text[index]\n\n if rightwards\n break if index >= text.length\n break if character == \"\\n\"\n else\n break if index <= 0\n break if text[index - 1] == \"\\n\"\n end\n\n index = index + vector\n end\n\n index\n end",
"def check_format(file)\n \tbegin\n content = file_content(file)\n content = content.split(\"\\n\").reject { |c| c.empty? }\n read_file(content)\n rescue\n raise_error ERROR_READING_FILE\n end\n end",
"def metadata_end(text)\n text.index(\"\\1\\n\", 2)\n end",
"def types(file, line, col); end",
"def types(file, line, col); end",
"def file_type file_name \n\t\tFile.extname( file_name ).gsub /^\\./, '' \n\tend",
"def text_file?(file)\n return false unless File.readable?(file)\n bytes = File.stat(file).blksize\n bytes = 4096 if bytes > 4096\n s = (File.read(file, bytes) || \"\")\n s = s.encode('US-ASCII', :undef => :replace).split(//)\n return (s.grep(\" \"..\"~\").size.to_f / s.size.to_f) > 0.85\n end",
"def is_multiline?(line) # ' '[0] == 32\n line && line.length > 1 && line[-1] == MULTILINE_CHAR_VALUE && line[-2] == 32\n end",
"def check\n file_nil\n if @file.end_with?(\".txt\")\n if File.exist?(@file)\n @f = Command_File.new(@file)\n else\n raise \"File \\\"#{@file}\\\" does not Exist\n Please choose a \\\".txt\\\" file that exists\"\n end\n else\n raise \"Invalid Input File \\\"#{@file}\\\"\n File must end in \\\".txt\\\"\"\n end\n end",
"def lex_end line\n ends << line\n end",
"def binary?(file)\n return false if file =~ /\\.(rb|txt)$/\n\n s = File.read(file, 1024) or return false\n\n have_encoding = s.respond_to? :encoding\n\n if have_encoding then\n return false if s.encoding != Encoding::ASCII_8BIT and s.valid_encoding?\n end\n\n return true if s[0, 2] == Marshal.dump('')[0, 2] or s.index(\"\\x00\")\n\n if have_encoding then\n s.force_encoding Encoding.default_external\n\n not s.valid_encoding?\n else\n if 0.respond_to? :fdiv then\n s.count(\"\\x00-\\x7F\", \"^ -~\\t\\r\\n\").fdiv(s.size) > 0.3\n else # HACK 1.8.6\n (s.count(\"\\x00-\\x7F\", \"^ -~\\t\\r\\n\").to_f / s.size) > 0.3\n end\n end\n end",
"def fix_normalize_trailing_newlines(options)\n # This would use the input option, however that may not work since\n # we touch lots of directories as part of an import.\n # input_file_spec = options['input'] || 'rtfile_dir/repositext_files'\n # Repositext::Cli::Utils.change_files_in_place(\n # config.compute_glob_pattern(input_file_spec),\n # /.\\z/i,\n # \"Normalizing trailing newlines\",\n # options\n # ) do |contents, filename|\n # [Outcome.new(true, { contents: contents.gsub(/(?<!\\n)\\n*\\z/, \"\\n\") }, [])]\n # end\n\n which_files = :all # :content_at_only or :all\n case which_files\n when :content_at_only\n base_dirs = %w[content_dir]\n file_type = 'at_files'\n when :all\n # Process all subfolders of root. Don't touch files in root.\n base_dirs = %w[\n content_dir\n folio_import_dir\n idml_import_dir\n plain_kramdown_export_dir\n reports_dir\n subtitle_export_dir\n subtitle_import_dir\n subtitle_tagging_export_dir\n subtitle_tagging_import_dir\n ]\n file_type = 'repositext_files'\n else\n raise \"Invalid which_files: #{ which_files.inspect }\"\n end\n base_dirs.each do |base_dir_name|\n input_file_spec = \"#{ base_dir_name }/#{ file_type }\"\n Repositext::Cli::Utils.change_files_in_place(\n config.compute_glob_pattern(input_file_spec),\n /.\\z/i,\n \"Normalizing trailing newlines in #{ base_dir_name }/#{ file_type }\",\n options\n ) do |contents, filename|\n [Outcome.new(true, { contents: contents.gsub(/(?<!\\n)\\n*\\z/, \"\\n\") }, [])]\n end\n end\n end",
"def skip_to_eoln\r\n @source.get until @source.eoln?\r\n true\r\n end",
"def valid_file_type filename\n # avoid hacks that break out of single quotes echoed to shell\n filename.gsub!(\"'\", '')\n `file '#{filename}'`.split(':').last.downcase =~ Regexp.union(*valid_file_types)\n end",
"def swap_lines sep, linebreak\n lines = File.readlines(self).collect(&:chomp)\n result = lines.collect {|line| line.swap sep}\n return false if lines == result\n linebreak = {unix: \"\\n\", mac: \"\\r\", windows: \"\\r\\n\"}.fetch(linebreak) do |k|\n raise KeyError, k.to_s\n end\n File.open(self, 'w') {|file| file.puts result.join(linebreak)}\n true\n end",
"def list?(line)\n return line =~ /^# \\* / ? '\\n' : ''\nend",
"def is_exe?(filename, system_config, platform)\n obj, lib, exe = *system_config.extensions(platform)\n return filename.end_with?(exe)\n end",
"def file?\n case type\n when T_REGULAR then true\n when T_UNKNOWN then nil\n else false\n end\n end",
"def separator(fname)\n f = File.open(fname)\n enum = f.each_char\n c = enum.next\n loop do\n case c[/\\r|\\n/]\n when \"\\n\" then break\n when \"\\r\"\n c << \"\\n\" if enum.peek == \"\\n\"\n break\n end\n c = enum.next\n end\n c[0][/\\r|\\n/] ? c : \"\\n\"\n end",
"def last_line_only(range); end",
"def last_line_only(range); end",
"def last_line_only(range); end",
"def isBinary?(fname)\n readbuf = get_file_contents(fname)\n count = 0\n# puts \"The size is: #{readbuf.length()}.\"\n threshold = Integer(readbuf.length() * 0.25)\n# puts \"Threshold: #{threshold}.\"\n readbuf.each_byte do |byte| #I have to use each_byte because Ruby 1.8.6 (Darwin) is\n #fucked and doesnt have String::each_char\n if !(0x20..0x7f).include?(byte) then\n #puts \"Non-ascii byte found: #{byte}\"\n count+=1 \n end\n end\n# puts \"#{count} nonascii bytes found in file.\"\n if count >= threshold then\n return true\n else \n return false\n end\nend",
"def regex_end_prefix\n Regexp.new(\"endline#{VM_PREFIX}\")\nend",
"def eol!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 39 )\n\n type = EOL\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 138:6: ( '\\\\r' )? '\\\\n'\n # at line 138:6: ( '\\\\r' )?\n alt_2 = 2\n look_2_0 = @input.peek( 1 )\n\n if ( look_2_0 == 0xd )\n alt_2 = 1\n end\n case alt_2\n when 1\n # at line 138:6: '\\\\r'\n match( 0xd )\n\n end\n match( 0xa )\n\n \n @state.type = type\n @state.channel = channel\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 39 )\n\n end",
"def file_type file_name \n File.extname( file_name ).gsub /^\\./, '' \n end",
"def filetype f\n return nil unless f\n\n f = Shellwords.escape(f)\n s = `file #{f}`\n return :text if s.index 'text'\n return :zip if s.index(/[Zz]ip/)\n return :zip if s.index('archive')\n return :image if s.index 'image'\n return :sqlite if s.index 'SQLite'\n # return :db if s.index 'database'\n return :text if s.index 'data'\n\n nil\nend",
"def file?\n (@typeflag == \"0\" || @typeflag == \"\\0\") && [email protected]_with?(\"/\")\n end",
"def file_type\n\t\tline = @file_desc.gets\n\t\t@file_desc.pos = 0 # Reset our location within the file\n\t\t\t\t\n\t\ttype = case line[line.rindex(' ')-1].chr\n\t\t\twhen ',' then :comma\n\t\t\twhen '|' then :pipe\n\t\t\telse :space\n\t\tend\n\tend",
"def last_line(src)\n if n = src.rindex(\"\\n\")\n src[(n+1) .. -1]\n else\n src\n end\nend",
"def eof?() end",
"def eof?() end",
"def eof?() end",
"def supported_file?(path)\n ext = File.extname(path)\n return true if ext.empty?\n ext =~ /\\.rbc\\Z/\n end",
"def parse_line_break; end",
"def modify_line_logic\n f = open($BACK_UCF,\"r\")\n new = open($ORG_UCF,\"w\")\n mode = false\n match = false\n cont = false\n i = 0, j = 0\n target_word = \"\"\n\n while line = f.gets\n\n if/_rt/ =~ line\n if /^#/ =~ line\n else\n line = \"#\" + line\n end\n end\n\n if cont == true\n if /^#/ =~ line\n else\n line = \"#\" + line\n end\n if /}\\\";$/ =~ line\n cont = false\n end\n end \n \n $remove_list_bld.each do |net|\n error_net = net.gsub(\"\\/\",\"\\\\/\")\n error_net = error_net.gsub(\"\\[\",\"\\\\[\")\n net = error_net.gsub(\"\\]\",\"\\\\]\")\n if /#{net}/ =~ line\n if /^#/ =~ line\n elsif /\\AINST/ =~ line\n line = \"#\" + line\n if $VERBOSE == true\n printf(\"match [%4d]:%s\", i, line)\n i += 1\n end\n break\n elsif /\\ANET/ =~ line\n cont = true\n line = \"#\" + line\n if $VERBOSE == true\n printf(\"match [%04d]:%s\", i, line)\n i += 1\n end\n break\n else\n printf(\"[E] %s\", line)\n exit\n end\n end\n end\n if (j / 100) == 0\n printf(\".\")\n end\n j += 1\n new.write(line)\n end\n f.close\n printf(\"\\n\")\nend",
"def proper_ext?(raw_path)\n path = raw_path.is_a?(Pathname) ? raw_path : Pathname.new(raw_path)\n LokaliseRails.file_ext_regexp.match? path.extname\n end",
"def parse_crlf data\n return if data == ''\n if ilf = data.index(\"\\n\")\n # if we find a LF and that LF is after a CR we first handle\n # the CR\n if icr = data.index(\"\\r\") and ilf != (icr+1) and icr < ilf\n parse_cr data, icr\n else\n parse_lf data, ilf\n end\n else\n if icr = data.index(\"\\r\")\n parse_cr data, icr\n else\n @linebuffer << data\n @outputbuffer.print data\n end\n end\n end",
"def uses_extension?\n @format =~ /\\.[^\\.]+$/\n end",
"def eof?\n @input.eof?\n end",
"def receive_valid_lines_from_file\n File.readlines(FILE_NAME).select { |line| line.downcase.include?('post') }\nend"
] | [
"0.7301583",
"0.6703883",
"0.6703883",
"0.62086535",
"0.61099255",
"0.6094957",
"0.59279126",
"0.5895707",
"0.57786936",
"0.56895846",
"0.56022954",
"0.55387455",
"0.5502004",
"0.54500234",
"0.5424423",
"0.5385529",
"0.53450817",
"0.5289995",
"0.5244717",
"0.5243275",
"0.52306503",
"0.5223152",
"0.5209466",
"0.51573306",
"0.51115066",
"0.50971556",
"0.50905865",
"0.5083729",
"0.50155973",
"0.5013515",
"0.4992249",
"0.49794906",
"0.49092904",
"0.49008736",
"0.48941404",
"0.48644555",
"0.48557124",
"0.4832742",
"0.4831407",
"0.48176578",
"0.4815826",
"0.4804086",
"0.4800558",
"0.4799039",
"0.47971335",
"0.47943863",
"0.47943863",
"0.47943863",
"0.47943863",
"0.47943863",
"0.47943863",
"0.47943863",
"0.47828948",
"0.47775364",
"0.4777275",
"0.47690794",
"0.47690293",
"0.476233",
"0.4752315",
"0.47511435",
"0.47489974",
"0.47416395",
"0.47413754",
"0.47413754",
"0.4732563",
"0.4721434",
"0.47177187",
"0.4711784",
"0.47024336",
"0.4702404",
"0.47014758",
"0.4695049",
"0.468686",
"0.46705195",
"0.4669705",
"0.46643698",
"0.46591985",
"0.46560737",
"0.46526378",
"0.46526378",
"0.46526378",
"0.4650828",
"0.4644532",
"0.46434596",
"0.4635257",
"0.46308345",
"0.46278495",
"0.46277043",
"0.46206865",
"0.46127838",
"0.46127838",
"0.46127838",
"0.460416",
"0.46007752",
"0.4596342",
"0.4587579",
"0.4586678",
"0.45811018",
"0.4576486",
"0.45727652"
] | 0.58623785 | 8 |
Find a regular expression regex in text input Find all occurrences of the input regular expression in the input content, and returns the matches | def edit_text_find_regex(request, opts = {})
data, _status_code, _headers = edit_text_find_regex_with_http_info(request, opts)
data
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def matching_lines(regex); end",
"def matches(s, re)\n start_at = 0\n matches = []\n while(m = s.match(re, start_at))\n matches.push(m)\n start_at = m.end(0)\n end\n matches\n end",
"def matches(s, re)\r\n start_at = 0\r\n matches = [ ]\r\n while(m = s.match(re, start_at))\r\n matches.push(m)\r\n start_at = m.end(0)\r\n end\r\n return matches\r\n end",
"def match(regexp); end",
"def find_reg_ex_matches( reg_ex )\n match_set = Set.new\n @words_set.to_a.each do |word|\n match_set.add word if word.downcase.match(reg_ex)\n end\n match_set\n end",
"def has_match_for_all(text, regexp)\n text.to_a.all?{ |line| line =~ regexp }\n end",
"def match(input)\n regexp.match(input)\n end",
"def find_regex(words)\n Array(words).map do |w|\n regexes_for_word = []\n\n possible_regexes(w).each do |regex|\n #puts \"Word: #{w} against #{regex} -> #{w =~ regex}\"\n if w =~ regex\n regexes_for_word << regex\n end\n end\n\n regexes_for_word.uniq\n end\n end",
"def match(pattern); end",
"def r regex\n raise 'First use `use`!' if @use.empty?\n \n @use.each_line do |line|\n line.gsub! /\\n$/, ''\n puts '---- ---- ---- ---- ---- ---- ----'\n puts line.inspect\n results = line.match(regex)\n if results.nil?\n puts \"No match\"\n next\n end\n puts \"Match: #{results[0].inspect}\"\n results.captures.each do |capture|\n puts \"Capture #{results.captures.index capture}: #{capture.inspect}\"\n end\n end\n puts '---- ---- ---- ---- ---- ---- ----'\nend",
"def matches(input)\n (0...input.length).reduce([]) do |memo, offset|\n memo + matches_at_offset(input, offset)\n end\n end",
"def all_matches( re, what )\n matches = []\n m = true\n\n matches << OpenStruct.new({\n :match => \"!fake!\",\n :start => 0,\n :end => 0,\n :fake => true\n })\n\n while m\n if matches.size == 1\n m = what.match(re)\n else\n m = (@@allMatchesSpecialChar + what).match(re)\n end\n\n if m\n pos = what.index(m[0])\n\n if pos > 0\n matches << OpenStruct.new({\n :match => what[0, pos],\n :start => matches.last.end,\n :end => matches.last.end + pos,\n :plain => true\n })\n end\n\n matches << OpenStruct.new({\n :match => m[0],\n :start => matches.last.end,\n :end => matches.last.end + m[0].length\n })\n\n what = what[pos + m[0].length..-1]\n end\n end\n\n if what.length > 0\n matches << OpenStruct.new({\n :match => what,\n :start => matches.last.end,\n :end => matches.last.end + what.length,\n :plain => true\n })\n end\n\n matches\n end",
"def textmatch(text, terms)\n terms.all? { |term| text =~ /#{term}/i }\nend",
"def regex(pattern)\n Regexp.new pattern.regex\n end",
"def match_text text\n @lookups.each do |rx_curr|\n return true if text =~ rx_curr\n end\n false\n end",
"def scan\n list = []\n io.each do |input|\n # TODO: limit to text files, how?\n begin\n text = read(input)\n text.scan(regex) do\n list << Match.new(input, $~)\n end\n rescue => err\n warn(input.inspect + ' ' + err.to_s) if $VERBOSE\n end\n end\n list\n end",
"def matches(str)\n each_match(str).to_a\n end",
"def search_words\n begin\n regex = Regexp.new(@pattern)\n rescue RegexpError => msg\n error_msg(msg)\n rescue NameError => msg\n error_msg(msg)\n end\n @results = DICT.select do |word|\n regex =~ word\n end\n @num_results = @results.length\n format_results\n display_results\n end",
"def matches\n parse_file.lines.each_with_object([]) do |line, matches|\n matches << line.scan(REGEXP[:name_and_score])\n end\n end",
"def matching_text_element_lines(regex, exclude_nested = T.unsafe(nil)); end",
"def regexps; end",
"def pattern2regex(pattern); end",
"def match(text)\n if match = @regexp.match(text)\n @matched_text = match.to_s\n [match.to_s, @name]\n else\n nil\n end\n end",
"def parse(text)\n #10 seconds timeout\n #because those huge regular expressions can take a LONG time if there is no match\n m = nil\n begin\n timeout(10) do\n m = @regexp.match(text)\n end\n rescue => err\n raise \"REGEXP TIMEOUT!\"\n end\n\n if m.nil?\n if @excepts\n raise \"REGEXP from #{@templatefile} IS::::::::::::::::::::::::\\n#{@regexp.source}\" +\n \"COULD NOT MATCH PAGE TEXT:::::::::::::::::::::::::::::\\n#{text}\"\n end\n return nil\n end\n\n vals = []\n # the ... means 1 to val -1 so all of the matches\n (1...m.size).each do |i|\n if @repetitions.key?(i)\n reg = @repetitions[i][0]\n vals<< m[i].scan(reg)\n else\n vals<< m[i]\n end\n end\n return vals\n end",
"def test_a_regexp_can_search_a_string_for_matching_content\n assert_equal 'match', \"some matching content\"[/match/]\n end",
"def similar_match str\n if !str || str == ''\n return Regexp.new('.*')\n end\n str_array = str.split('')\n reg_str = '(.*?)'\n str_array.each do |x| \n reg_str += \"#{x}(.*?)\"\n end\n\n return reg_str\n end",
"def regexp_matcher regexp\n lambda do |string, index = 0, counts:|\n found = regexp.match(string, index)\n result_string = found.to_s\n\n if found && found.begin(0) == index && !result_string.empty?\n result_string\n end\n end\n end",
"def regexp; end",
"def regexp; end",
"def match regexp, opt = {}, &block\n opt = { in: :line, match: :first }.merge opt\n (opt[:in] == :output ? receive_update_callbacks : receive_line_callbacks) << lambda do |data|\n matches = data.scan regexp\n if matches.length > 0\n case opt[:match]\n when :first\n EM.next_tick do\n block.call *matches[0]\n end\n when :last\n EM.next_tick do\n block.call *matches[matches.length-1]\n end\n end\n end\n end\n end",
"def each_match_range(range, regex); end",
"def matchanywhere(rgx, text)\n if rgx[0] == '^'\n return matchhere(rgx[1..-1], text)\n elsif matchhere(rgx, text)\n return true\n elsif text.nil? && !rgx.nil?\n return false\n else\n return matchanywhere(rgx, text[1..-1])\n end\nend",
"def multireg(regpexp, str)\n result = []\n while regpexp.match(str)\n result.push regpexp.match(str)\n str = regpexp.match(str).post_match\n end\n result\n end",
"def get_matching_indices pattern\n matches = []\n @obj.content.each_with_index { |e,i| \n # convert to string for tables\n e = e.to_s unless e.is_a? String\n if e =~ /#{pattern}/\n matches << i\n end\n }\n return matches\n end",
"def type_7_matches(string)\n TYPE_7_REGEXES.collect {|regex| string.scan(regex)}.flatten.uniq\n end",
"def methods_matching(re); end",
"def possible_regexes(w)\n possible = []\n w_as_regex = escape_regex(w)\n\n # Here we specify many different functions that generate regex criterias,\n #\n # For example, /\\$10/ and /\\$[0-9]+/ for $10\n possible << w_as_regex\n possible << w_as_regex.gsub(/[0-9]/, \"[0-9]+\")\n\n possible.uniq.map { |p| Regexp.new(p, Regexp::IGNORECASE) }\n end",
"def match_strings(matched_lines)\n matched_strings = []\n\n matched_lines.each do |line|\n check_patterns.each do |pattern|\n line.scan(pattern).each do |matched|\n matched_strings += matched\n end\n end\n end\n\n return matched_strings\n end",
"def all_regex(col, regex)\n regex = Regexp.new(regex, Regexp::IGNORECASE) if String === regex\n self.all.find_all {|row| row[col] =~ regex}\n end",
"def match(input); end",
"def find_all_regex(sCOMMAND)\n array = Array.new()\n search =/#{sCOMMAND}/\n @commands.each do |command|\n if (command.commandName.match(search) )\n array.push(command)\n end\n\n end\n return array\n end",
"def match(text)\n shift = 0\n result = []\n\n # Try to take previous element from cache, if .test() called before\n if (@__index__ >= 0 && @__text_cache__ == text)\n result.push(Match.createMatch(self, shift))\n shift = @__last_index__\n end\n\n # Cut head if cache was used\n tail = shift ? text.slice(shift..-1) : text\n\n # Scan string until end reached\n while (self.test(tail))\n result.push(Match.createMatch(self, shift))\n\n tail = tail.slice(@__last_index__..-1)\n shift += @__last_index__\n end\n\n if (result.length)\n return result\n end\n\n return nil\n end",
"def match_string_to_regexp(str)\n #str = str.split(/(\\(\\(.*?\\)\\))(?!\\))/).map{ |x|\n # x =~ /\\A\\(\\((.*)\\)\\)\\Z/ ? $1 : Regexp.escape(x)\n #}.join\n #str = str.gsub(/\\\\\\s+/, '\\s+')\n #Regexp.new(str, Regexp::IGNORECASE)\n\n #str = str.split(/([#$]\\(.*?\\))/).map{ |x|\n # x =~ /\\A[#$]\\((.*)\\)\\Z/ ? ($1.start_with?('#') ? \"(#{$1})\" : $1 ) : Regexp.escape(x)\n #}.join\n #str = str.gsub(/\\\\\\s+/, '\\s+')\n #Regexp.new(str, Regexp::IGNORECASE)\n\n$stderr.puts \"HERE!!!!!!\"\n\n str = str.split(PATTERN).map{ |x|\n case x\n when /\\A\\(\\((.*)\\)\\)\\Z/\n $1\n when /\\A[#$]\\((.*)\\)\\Z/\n $1.start_with?('#') ? \"(#{$1})\" : $1\n else\n Regexp.escape(x)\n end\n }.join\n\n str = str.gsub(/\\\\\\s+/, '\\s+')\n\n Regexp.new(str, Regexp::IGNORECASE)\n\n #rexps = []\n #str = str.gsub(/\\(\\((.*?)\\)\\)/) do |m|\n # rexps << '(' + $1 + ')'\n # \"\\0\"\n #end\n #str = Regexp.escape(str)\n #rexps.each do |r|\n # str = str.sub(\"\\0\", r)\n #end\n #str = str.gsub(/(\\\\\\ )+/, '\\s+')\n #Regexp.new(str, Regexp::IGNORECASE)\n end",
"def pattern_matching(pattern, genome)\n # Pattern Matching Problem: Find all occurrences of a pattern in a string.\n # Input: Two strings, Pattern and Genome.\n # Output: All starting positions where Pattern appears as a substring of Genome.\n\n # Sample Input:\n # ATAT\n # GATATATGCATATACTT\n\n # Sample Output:\n # 1 3 9\n\n match_indexes = []\n search_start_pos = 0\n while index = genome.index(pattern, search_start_pos)\n match_indexes << index\n # puts index\n search_start_pos = index + 1\n end\n return match_indexes\n end",
"def expected_content\n text = '<h1>is the most important headline</h1>\\s*?' +\n '<p>\\s*?' +\n 'This is ordinary paragraph text within the body of the document,' +\n ' where certain words and phrases may be ' +\n '<em>emphasized</em> to mark them as ' +\n '<strong.*>particularly</strong>'\n Regexp.new text\nend",
"def regex\n Regexp.new(@str)\n end",
"def scan(regex)\n while @scanner.scan_until(regex)\n match = @scanner.matched\n position = @scanner.charpos - match.length\n yield match, position, match.length\n end\n end",
"def from_with_regex(cmd, *regex_list)\n regex_list.flatten.each do |regex|\n _status, stdout, _stderr = run_command(command: cmd)\n return \"\" if stdout.nil? || stdout.empty?\n\n stdout.chomp!.strip\n md = stdout.match(regex)\n return md[1]\n end\n end",
"def match_in_string?(string, regex)\n string.match(regex).class == MatchData\nend",
"def match_in_string?(string, regex)\n string.match(regex).class == MatchData\nend",
"def match_in_string?(string, regex)\n string.match(regex).class == MatchData\nend",
"def match_in_string?(string, regex)\n string.match(regex).class == MatchData\nend",
"def match_in_string?(string, regex)\n string.match(regex).class == MatchData\nend",
"def match_in_string?(string, regex)\n string.match(regex).class == MatchData\nend",
"def match_in_string?(string, regex)\n string.match(regex).class == MatchData\nend",
"def match_in_string?(string, regex)\n string.match(regex).class == MatchData\nend",
"def match_in_string?(string, regex)\n string.match(regex).class == MatchData\nend",
"def match_in_string?(string, regex)\n string.match(regex).class == MatchData\nend",
"def match_in_string?(string, regex)\n string.match(regex).class == MatchData\nend",
"def match_in_string?(string, regex)\n string.match(regex).class == MatchData\nend",
"def match_in_string?(string, regex)\n string.match(regex).class == MatchData\nend",
"def rx(s)\n Regexp.new(Regexp.escape(s))\n end",
"def search(pattern)\n entries.grep(Regexp.new(pattern))\n end",
"def extract_regexps(line)\n r = []\n line.scan(/\\s@(rx|dfa) (?:\"((?:\\\\\"|[^\"])+)\"|([^ ]+?))(\\s|$)/) {r << $2}\n r\nend",
"def regexp\n @regexp ||= Regexp.compile(source.to_s, Regexp::IGNORECASE)\n end",
"def regex_for(pattern)\n return pattern if Regexp === pattern\n pattern = pattern.split('.') if String === pattern\n\n source = ''\n pattern.each_with_index do |part, index|\n if part == '*'\n source << '\\\\.' unless index == 0\n source << '[^\\.]+'\n elsif part == '#'\n source << '.*?' # .*? ?\n else\n source << '\\\\.' unless index == 0\n source << part\n end\n end\n\n Regexp.new(\"\\\\A#{source}\\\\Z\")\n end",
"def matches( input )\n matches = Array.new\n\n input.shorter.each_with_index do |char, idx|\n input.window_range( idx ).each do |widx|\n if input.longer[widx] == char then\n matches << widx\n break\n end\n end\n end\n\n return matches\n end",
"def check_scan(s, pattern); end",
"def check_scan(s, pattern); end",
"def scan(pattern); end",
"def scan_regex_pattern_expression expression\n words = {}\n expression.each_pair do |key, exp|\n words[key] = dictionary.scan(Regexp.new(exp)).map(&:join)\n end\n words\n end",
"def brute_force_matches string, pattern\n i = 0\n pos = []\n while i + pattern.length - 1 < string.length\n pos << i if string[i..(i + pattern.length - 1)] == pattern\n i += 1\n end\n pos\nend",
"def regex_search\n if use_regex?\n ::Arel::Nodes::Regexp.new((custom_field? ? field : table[field]), ::Arel::Nodes.build_quoted(formated_value))\n else\n non_regex_search\n end\n end",
"def run_regex(regex, message)\n characters = regex.chars\n begin\n read_character(characters) while @cursor < characters.length\n rescue RuntimeError\n puts 'SYNTAX ERROR'\n return\n end\n\n # Check all groups ar closed\n if @depth.positive?\n puts 'SYNTAX ERROR'\n else\n verify_message(message)\n end\n end",
"def grep(pattern)\n return self unless pattern\n pattern = Regexp.new(pattern)\n\n select do |l, ln|\n l =~ pattern\n end\n end",
"def match_data\n Pdfh.verbose_print \"~~~~~~~~~~~~~~~~~~ Match Data RegEx\"\n Pdfh.verbose_print \" Using regex: #{@type.re_date}\"\n Pdfh.verbose_print \" named: #{@type.re_date.named_captures}\"\n matched = @type.re_date.match(@text)\n raise ReDateError unless matched\n\n Pdfh.verbose_print \" captured: #{matched.captures}\"\n\n return matched.captures.map(&:downcase) if @type.re_date.named_captures.empty?\n\n extra = matched.captures.size > 2 ? matched[:d] : nil\n [matched[:m].downcase, matched[:y], extra]\n end",
"def regex(word)\n if word =~ /lab/\n puts word\n else\n puts \"No match\" \n end\nend",
"def search_values_in_quotes\n search_string.scan(REGEX_WORD_IN_QUOTES)\n end",
"def word_pattern(pattern, input)\n \nend",
"def find_with(match_expression)\n all_example_groups.select do |example_group|\n example_group.description.start_with?(match_expression)\n end\n end",
"def ruby_grep(filename, pattern)\n regexp = Regexp.new(pattern)\n File.open(filename, 'r') do |file|\n file.each_line {|line| puts line if regexp =~ line}\n end\nend",
"def match(regex, options={}, &block)\n if result = text.match(regex)\n item = result[1]\n end\n filtered = yield(item,result) if block_given?\n filtered || item\n end",
"def test_match \n begin\n md = @regexp =~ @s\n puts \"\\n#{regexp} =~ #{@s} yields #{@regexp =~ @s} and $~=#{$~.inspect}\"\n\n rescue => e\n $stderr.print e.message \n $stderr.print e.backtrace.join(\"\\n\")\n raise #re-raise\n end \n end",
"def prepare_for_regexp(output_str)\n split_lines(output_str).map do |str|\n Regexp.new(Regexp.escape(str), Regexp::EXTENDED)\n end\n end",
"def search(str)\n return [] if str.to_s.empty?\n \n words = str.downcase.split(' ')\n pattern = Regexp.new(words.join('|'))\n matches = []\n\n pages.each do |page|\n if page.title.downcase =~ pattern\n matches << [page, []]\n \n elsif page.body.downcase =~ pattern\n matches << [page, highlight(page.html, words)]\n end\n end\n\n matches\n end",
"def test_extended_patterns_no_flags\n [\n [ \".*\", \"abcd\\nefg\", \"abcd\" ],\n [ \"^a.\", \"abcd\\naefg\", \"ab\" ],\n [ \"^a.\", \"bacd\\naefg\", \"ae\" ],\n [ \".$\", \"bacd\\naefg\", \"d\" ]\n ].each do |reg, str, result|\n m = RustRegexp.new(reg).match(str)\n puts m.inspect\n unless m.nil?\n assert_equal result, m[0]\n end\n end\n end",
"def where_regex(attr, value, flags: \"e\")\n where_operator(attr, :matches_regexp, \"(?#{flags})\" + value)\n end",
"def where_regex(attr, value, flags: \"e\")\n where_operator(attr, :matches_regexp, \"(?#{flags})\" + value)\n end",
"def get_regex(pattern, encoding='ASCII', options=0)\n Regexp.new(pattern.encode(encoding),options)\nend",
"def matches?(pattern); end",
"def match(regexp)\n return regexp.match(pickle_format)\n end",
"def fullmatch(re)\n format(:color => false).match(re)\n end",
"def find(string)\n string = string.split(//).join(\".*?\")\n pattern = \"/#{string}/i\"\n\n results = self.cache.grep /#{string}/i\n\n return results\n end",
"def values\n @values ||= begin\n matches = []\n\n text.scan(VALUE_REGEXP) do\n offset = Regexp.last_match.offset(1)\n matches << loc.expression.adjust(begin_pos: offset.first)\n .with(end_pos: loc.expression.begin_pos + offset.last)\n end\n\n matches\n end\n end",
"def fsearch(file, regex)\n\tooo = File.stat(file)\n\toatime=foo.atime #atime before edit\n\tomtime=foo.mtime #mtime before edit\n\n\tf = File.open(file)\n\tfoo = f.readlines\n\tf.close\n\tif foo.to_s.match(/#{regex}/im) #Check for needle in haystack :p\n\t\tputs \"#{HC}#{FGRN}Found matches to '#{FWHT}#{regex}#{FGRN}' in File#{FWHT}: #{file}#{RS}\"\n\t\tocc = foo.to_s.scan(/#{regex}/im).count #How many times does it occur in file?\n\t\tputs \"\\t#{FGRN}Number of Occurances#{FWHT}: #{occ}#{RS}\"\n\telse\n\t\tputs \"#{HC}#{FRED}No Matches to '#{FWHT}#{regex}#{FRED}' in File#{FWHT}: #{file}#{RS}\"\n\tend\n\n\tFile.utime(oatime, omtime, file) #Keep timestamp preserved\nend",
"def match_against filename\n @regexp.match(filename)\n end",
"def search(pattern)\n\t\tmatching_lines = lines.select { |line| line.match(pattern) }\n\t\tmatching_lines.size == 0 ? nil : matching_lines\n\tend",
"def search(pattern)\n\t\tmatching_lines = lines.select { |line| line.match(pattern) }\n\t\tmatching_lines.size == 0 ? nil : matching_lines\n\tend",
"def get_matches(transactions=Transaction.all)\n raise \"not an array\" unless transactions.instance_of?(Array)\n transactions.select do |tr|\n raise \"Not a transaction\" unless tr.instance_of?(Transaction)\n tr.matches?(self.regexp) \n end\n end",
"def search(pattern_to_match)\n results = []\n caches = source_index_hash\n caches.each do |cache|\n results << cache[1].search(pattern_to_match)\n end\n results\n end"
] | [
"0.71646434",
"0.7088026",
"0.6991352",
"0.68928456",
"0.6569699",
"0.65328544",
"0.6454069",
"0.6361761",
"0.62941855",
"0.6291894",
"0.61693704",
"0.6130515",
"0.61188555",
"0.6113431",
"0.6106083",
"0.6015748",
"0.597976",
"0.5974627",
"0.59642094",
"0.59586",
"0.59459805",
"0.59372216",
"0.5925626",
"0.5919605",
"0.5907362",
"0.58724076",
"0.5859776",
"0.5849036",
"0.5849036",
"0.58246094",
"0.5824531",
"0.5824225",
"0.5812801",
"0.5786013",
"0.5783783",
"0.57569474",
"0.57422155",
"0.5704761",
"0.56949604",
"0.5694453",
"0.5690161",
"0.5689387",
"0.5683272",
"0.568134",
"0.56548053",
"0.5647664",
"0.5634862",
"0.56281763",
"0.5601868",
"0.5601868",
"0.5601868",
"0.5601868",
"0.5601868",
"0.5601868",
"0.5601868",
"0.5601868",
"0.5601868",
"0.5601868",
"0.5601868",
"0.5601868",
"0.5601868",
"0.5597171",
"0.559424",
"0.5588135",
"0.55734766",
"0.55660284",
"0.5564249",
"0.55627596",
"0.55627596",
"0.55606055",
"0.55601287",
"0.55549407",
"0.55513203",
"0.552332",
"0.55163664",
"0.55106616",
"0.5505018",
"0.5504311",
"0.5500103",
"0.5475458",
"0.54598206",
"0.5454133",
"0.54377335",
"0.5432315",
"0.542529",
"0.5425097",
"0.54205793",
"0.54205793",
"0.5414641",
"0.5412849",
"0.5404729",
"0.5389902",
"0.53869295",
"0.53834003",
"0.53833646",
"0.5379768",
"0.5378738",
"0.5378738",
"0.5377112",
"0.53767085"
] | 0.6205902 | 10 |
Find a regular expression regex in text input Find all occurrences of the input regular expression in the input content, and returns the matches | def edit_text_find_regex_with_http_info(request, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: EditTextApi.edit_text_find_regex ...'
end
# verify the required parameter 'request' is set
if @api_client.config.client_side_validation && request.nil?
fail ArgumentError, "Missing the required parameter 'request' when calling EditTextApi.edit_text_find_regex"
end
# resource path
local_var_path = '/convert/edit/text/find/regex'
# query parameters
query_params = {}
# header parameters
header_params = {}
# HTTP header 'Accept' (if needed)
header_params['Accept'] = @api_client.select_header_accept(['application/json', 'text/json', 'application/xml', 'text/xml'])
# HTTP header 'Content-Type'
header_params['Content-Type'] = @api_client.select_header_content_type(['application/json', 'text/json', 'application/xml', 'text/xml', 'application/x-www-form-urlencoded'])
# form parameters
form_params = {}
# http body (model)
post_body = @api_client.object_to_http_body(request)
auth_names = ['Apikey']
data, status_code, headers = @api_client.call_api(:POST, local_var_path,
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,
:body => post_body,
:auth_names => auth_names,
:return_type => 'FindStringRegexResponse')
if @api_client.config.debugging
@api_client.config.logger.debug "API called: EditTextApi#edit_text_find_regex\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def matching_lines(regex); end",
"def matches(s, re)\n start_at = 0\n matches = []\n while(m = s.match(re, start_at))\n matches.push(m)\n start_at = m.end(0)\n end\n matches\n end",
"def matches(s, re)\r\n start_at = 0\r\n matches = [ ]\r\n while(m = s.match(re, start_at))\r\n matches.push(m)\r\n start_at = m.end(0)\r\n end\r\n return matches\r\n end",
"def match(regexp); end",
"def find_reg_ex_matches( reg_ex )\n match_set = Set.new\n @words_set.to_a.each do |word|\n match_set.add word if word.downcase.match(reg_ex)\n end\n match_set\n end",
"def has_match_for_all(text, regexp)\n text.to_a.all?{ |line| line =~ regexp }\n end",
"def match(input)\n regexp.match(input)\n end",
"def find_regex(words)\n Array(words).map do |w|\n regexes_for_word = []\n\n possible_regexes(w).each do |regex|\n #puts \"Word: #{w} against #{regex} -> #{w =~ regex}\"\n if w =~ regex\n regexes_for_word << regex\n end\n end\n\n regexes_for_word.uniq\n end\n end",
"def match(pattern); end",
"def r regex\n raise 'First use `use`!' if @use.empty?\n \n @use.each_line do |line|\n line.gsub! /\\n$/, ''\n puts '---- ---- ---- ---- ---- ---- ----'\n puts line.inspect\n results = line.match(regex)\n if results.nil?\n puts \"No match\"\n next\n end\n puts \"Match: #{results[0].inspect}\"\n results.captures.each do |capture|\n puts \"Capture #{results.captures.index capture}: #{capture.inspect}\"\n end\n end\n puts '---- ---- ---- ---- ---- ---- ----'\nend",
"def edit_text_find_regex(request, opts = {})\n data, _status_code, _headers = edit_text_find_regex_with_http_info(request, opts)\n data\n end",
"def matches(input)\n (0...input.length).reduce([]) do |memo, offset|\n memo + matches_at_offset(input, offset)\n end\n end",
"def all_matches( re, what )\n matches = []\n m = true\n\n matches << OpenStruct.new({\n :match => \"!fake!\",\n :start => 0,\n :end => 0,\n :fake => true\n })\n\n while m\n if matches.size == 1\n m = what.match(re)\n else\n m = (@@allMatchesSpecialChar + what).match(re)\n end\n\n if m\n pos = what.index(m[0])\n\n if pos > 0\n matches << OpenStruct.new({\n :match => what[0, pos],\n :start => matches.last.end,\n :end => matches.last.end + pos,\n :plain => true\n })\n end\n\n matches << OpenStruct.new({\n :match => m[0],\n :start => matches.last.end,\n :end => matches.last.end + m[0].length\n })\n\n what = what[pos + m[0].length..-1]\n end\n end\n\n if what.length > 0\n matches << OpenStruct.new({\n :match => what,\n :start => matches.last.end,\n :end => matches.last.end + what.length,\n :plain => true\n })\n end\n\n matches\n end",
"def textmatch(text, terms)\n terms.all? { |term| text =~ /#{term}/i }\nend",
"def regex(pattern)\n Regexp.new pattern.regex\n end",
"def match_text text\n @lookups.each do |rx_curr|\n return true if text =~ rx_curr\n end\n false\n end",
"def scan\n list = []\n io.each do |input|\n # TODO: limit to text files, how?\n begin\n text = read(input)\n text.scan(regex) do\n list << Match.new(input, $~)\n end\n rescue => err\n warn(input.inspect + ' ' + err.to_s) if $VERBOSE\n end\n end\n list\n end",
"def matches(str)\n each_match(str).to_a\n end",
"def search_words\n begin\n regex = Regexp.new(@pattern)\n rescue RegexpError => msg\n error_msg(msg)\n rescue NameError => msg\n error_msg(msg)\n end\n @results = DICT.select do |word|\n regex =~ word\n end\n @num_results = @results.length\n format_results\n display_results\n end",
"def matches\n parse_file.lines.each_with_object([]) do |line, matches|\n matches << line.scan(REGEXP[:name_and_score])\n end\n end",
"def matching_text_element_lines(regex, exclude_nested = T.unsafe(nil)); end",
"def regexps; end",
"def pattern2regex(pattern); end",
"def match(text)\n if match = @regexp.match(text)\n @matched_text = match.to_s\n [match.to_s, @name]\n else\n nil\n end\n end",
"def parse(text)\n #10 seconds timeout\n #because those huge regular expressions can take a LONG time if there is no match\n m = nil\n begin\n timeout(10) do\n m = @regexp.match(text)\n end\n rescue => err\n raise \"REGEXP TIMEOUT!\"\n end\n\n if m.nil?\n if @excepts\n raise \"REGEXP from #{@templatefile} IS::::::::::::::::::::::::\\n#{@regexp.source}\" +\n \"COULD NOT MATCH PAGE TEXT:::::::::::::::::::::::::::::\\n#{text}\"\n end\n return nil\n end\n\n vals = []\n # the ... means 1 to val -1 so all of the matches\n (1...m.size).each do |i|\n if @repetitions.key?(i)\n reg = @repetitions[i][0]\n vals<< m[i].scan(reg)\n else\n vals<< m[i]\n end\n end\n return vals\n end",
"def test_a_regexp_can_search_a_string_for_matching_content\n assert_equal 'match', \"some matching content\"[/match/]\n end",
"def similar_match str\n if !str || str == ''\n return Regexp.new('.*')\n end\n str_array = str.split('')\n reg_str = '(.*?)'\n str_array.each do |x| \n reg_str += \"#{x}(.*?)\"\n end\n\n return reg_str\n end",
"def regexp_matcher regexp\n lambda do |string, index = 0, counts:|\n found = regexp.match(string, index)\n result_string = found.to_s\n\n if found && found.begin(0) == index && !result_string.empty?\n result_string\n end\n end\n end",
"def regexp; end",
"def regexp; end",
"def each_match_range(range, regex); end",
"def match regexp, opt = {}, &block\n opt = { in: :line, match: :first }.merge opt\n (opt[:in] == :output ? receive_update_callbacks : receive_line_callbacks) << lambda do |data|\n matches = data.scan regexp\n if matches.length > 0\n case opt[:match]\n when :first\n EM.next_tick do\n block.call *matches[0]\n end\n when :last\n EM.next_tick do\n block.call *matches[matches.length-1]\n end\n end\n end\n end\n end",
"def matchanywhere(rgx, text)\n if rgx[0] == '^'\n return matchhere(rgx[1..-1], text)\n elsif matchhere(rgx, text)\n return true\n elsif text.nil? && !rgx.nil?\n return false\n else\n return matchanywhere(rgx, text[1..-1])\n end\nend",
"def multireg(regpexp, str)\n result = []\n while regpexp.match(str)\n result.push regpexp.match(str)\n str = regpexp.match(str).post_match\n end\n result\n end",
"def get_matching_indices pattern\n matches = []\n @obj.content.each_with_index { |e,i| \n # convert to string for tables\n e = e.to_s unless e.is_a? String\n if e =~ /#{pattern}/\n matches << i\n end\n }\n return matches\n end",
"def type_7_matches(string)\n TYPE_7_REGEXES.collect {|regex| string.scan(regex)}.flatten.uniq\n end",
"def methods_matching(re); end",
"def possible_regexes(w)\n possible = []\n w_as_regex = escape_regex(w)\n\n # Here we specify many different functions that generate regex criterias,\n #\n # For example, /\\$10/ and /\\$[0-9]+/ for $10\n possible << w_as_regex\n possible << w_as_regex.gsub(/[0-9]/, \"[0-9]+\")\n\n possible.uniq.map { |p| Regexp.new(p, Regexp::IGNORECASE) }\n end",
"def match_strings(matched_lines)\n matched_strings = []\n\n matched_lines.each do |line|\n check_patterns.each do |pattern|\n line.scan(pattern).each do |matched|\n matched_strings += matched\n end\n end\n end\n\n return matched_strings\n end",
"def match(input); end",
"def all_regex(col, regex)\n regex = Regexp.new(regex, Regexp::IGNORECASE) if String === regex\n self.all.find_all {|row| row[col] =~ regex}\n end",
"def find_all_regex(sCOMMAND)\n array = Array.new()\n search =/#{sCOMMAND}/\n @commands.each do |command|\n if (command.commandName.match(search) )\n array.push(command)\n end\n\n end\n return array\n end",
"def match(text)\n shift = 0\n result = []\n\n # Try to take previous element from cache, if .test() called before\n if (@__index__ >= 0 && @__text_cache__ == text)\n result.push(Match.createMatch(self, shift))\n shift = @__last_index__\n end\n\n # Cut head if cache was used\n tail = shift ? text.slice(shift..-1) : text\n\n # Scan string until end reached\n while (self.test(tail))\n result.push(Match.createMatch(self, shift))\n\n tail = tail.slice(@__last_index__..-1)\n shift += @__last_index__\n end\n\n if (result.length)\n return result\n end\n\n return nil\n end",
"def match_string_to_regexp(str)\n #str = str.split(/(\\(\\(.*?\\)\\))(?!\\))/).map{ |x|\n # x =~ /\\A\\(\\((.*)\\)\\)\\Z/ ? $1 : Regexp.escape(x)\n #}.join\n #str = str.gsub(/\\\\\\s+/, '\\s+')\n #Regexp.new(str, Regexp::IGNORECASE)\n\n #str = str.split(/([#$]\\(.*?\\))/).map{ |x|\n # x =~ /\\A[#$]\\((.*)\\)\\Z/ ? ($1.start_with?('#') ? \"(#{$1})\" : $1 ) : Regexp.escape(x)\n #}.join\n #str = str.gsub(/\\\\\\s+/, '\\s+')\n #Regexp.new(str, Regexp::IGNORECASE)\n\n$stderr.puts \"HERE!!!!!!\"\n\n str = str.split(PATTERN).map{ |x|\n case x\n when /\\A\\(\\((.*)\\)\\)\\Z/\n $1\n when /\\A[#$]\\((.*)\\)\\Z/\n $1.start_with?('#') ? \"(#{$1})\" : $1\n else\n Regexp.escape(x)\n end\n }.join\n\n str = str.gsub(/\\\\\\s+/, '\\s+')\n\n Regexp.new(str, Regexp::IGNORECASE)\n\n #rexps = []\n #str = str.gsub(/\\(\\((.*?)\\)\\)/) do |m|\n # rexps << '(' + $1 + ')'\n # \"\\0\"\n #end\n #str = Regexp.escape(str)\n #rexps.each do |r|\n # str = str.sub(\"\\0\", r)\n #end\n #str = str.gsub(/(\\\\\\ )+/, '\\s+')\n #Regexp.new(str, Regexp::IGNORECASE)\n end",
"def pattern_matching(pattern, genome)\n # Pattern Matching Problem: Find all occurrences of a pattern in a string.\n # Input: Two strings, Pattern and Genome.\n # Output: All starting positions where Pattern appears as a substring of Genome.\n\n # Sample Input:\n # ATAT\n # GATATATGCATATACTT\n\n # Sample Output:\n # 1 3 9\n\n match_indexes = []\n search_start_pos = 0\n while index = genome.index(pattern, search_start_pos)\n match_indexes << index\n # puts index\n search_start_pos = index + 1\n end\n return match_indexes\n end",
"def expected_content\n text = '<h1>is the most important headline</h1>\\s*?' +\n '<p>\\s*?' +\n 'This is ordinary paragraph text within the body of the document,' +\n ' where certain words and phrases may be ' +\n '<em>emphasized</em> to mark them as ' +\n '<strong.*>particularly</strong>'\n Regexp.new text\nend",
"def regex\n Regexp.new(@str)\n end",
"def scan(regex)\n while @scanner.scan_until(regex)\n match = @scanner.matched\n position = @scanner.charpos - match.length\n yield match, position, match.length\n end\n end",
"def from_with_regex(cmd, *regex_list)\n regex_list.flatten.each do |regex|\n _status, stdout, _stderr = run_command(command: cmd)\n return \"\" if stdout.nil? || stdout.empty?\n\n stdout.chomp!.strip\n md = stdout.match(regex)\n return md[1]\n end\n end",
"def match_in_string?(string, regex)\n string.match(regex).class == MatchData\nend",
"def match_in_string?(string, regex)\n string.match(regex).class == MatchData\nend",
"def match_in_string?(string, regex)\n string.match(regex).class == MatchData\nend",
"def match_in_string?(string, regex)\n string.match(regex).class == MatchData\nend",
"def match_in_string?(string, regex)\n string.match(regex).class == MatchData\nend",
"def match_in_string?(string, regex)\n string.match(regex).class == MatchData\nend",
"def match_in_string?(string, regex)\n string.match(regex).class == MatchData\nend",
"def match_in_string?(string, regex)\n string.match(regex).class == MatchData\nend",
"def match_in_string?(string, regex)\n string.match(regex).class == MatchData\nend",
"def match_in_string?(string, regex)\n string.match(regex).class == MatchData\nend",
"def match_in_string?(string, regex)\n string.match(regex).class == MatchData\nend",
"def match_in_string?(string, regex)\n string.match(regex).class == MatchData\nend",
"def match_in_string?(string, regex)\n string.match(regex).class == MatchData\nend",
"def rx(s)\n Regexp.new(Regexp.escape(s))\n end",
"def search(pattern)\n entries.grep(Regexp.new(pattern))\n end",
"def extract_regexps(line)\n r = []\n line.scan(/\\s@(rx|dfa) (?:\"((?:\\\\\"|[^\"])+)\"|([^ ]+?))(\\s|$)/) {r << $2}\n r\nend",
"def regexp\n @regexp ||= Regexp.compile(source.to_s, Regexp::IGNORECASE)\n end",
"def matches( input )\n matches = Array.new\n\n input.shorter.each_with_index do |char, idx|\n input.window_range( idx ).each do |widx|\n if input.longer[widx] == char then\n matches << widx\n break\n end\n end\n end\n\n return matches\n end",
"def regex_for(pattern)\n return pattern if Regexp === pattern\n pattern = pattern.split('.') if String === pattern\n\n source = ''\n pattern.each_with_index do |part, index|\n if part == '*'\n source << '\\\\.' unless index == 0\n source << '[^\\.]+'\n elsif part == '#'\n source << '.*?' # .*? ?\n else\n source << '\\\\.' unless index == 0\n source << part\n end\n end\n\n Regexp.new(\"\\\\A#{source}\\\\Z\")\n end",
"def check_scan(s, pattern); end",
"def check_scan(s, pattern); end",
"def scan_regex_pattern_expression expression\n words = {}\n expression.each_pair do |key, exp|\n words[key] = dictionary.scan(Regexp.new(exp)).map(&:join)\n end\n words\n end",
"def scan(pattern); end",
"def brute_force_matches string, pattern\n i = 0\n pos = []\n while i + pattern.length - 1 < string.length\n pos << i if string[i..(i + pattern.length - 1)] == pattern\n i += 1\n end\n pos\nend",
"def regex_search\n if use_regex?\n ::Arel::Nodes::Regexp.new((custom_field? ? field : table[field]), ::Arel::Nodes.build_quoted(formated_value))\n else\n non_regex_search\n end\n end",
"def run_regex(regex, message)\n characters = regex.chars\n begin\n read_character(characters) while @cursor < characters.length\n rescue RuntimeError\n puts 'SYNTAX ERROR'\n return\n end\n\n # Check all groups ar closed\n if @depth.positive?\n puts 'SYNTAX ERROR'\n else\n verify_message(message)\n end\n end",
"def grep(pattern)\n return self unless pattern\n pattern = Regexp.new(pattern)\n\n select do |l, ln|\n l =~ pattern\n end\n end",
"def match_data\n Pdfh.verbose_print \"~~~~~~~~~~~~~~~~~~ Match Data RegEx\"\n Pdfh.verbose_print \" Using regex: #{@type.re_date}\"\n Pdfh.verbose_print \" named: #{@type.re_date.named_captures}\"\n matched = @type.re_date.match(@text)\n raise ReDateError unless matched\n\n Pdfh.verbose_print \" captured: #{matched.captures}\"\n\n return matched.captures.map(&:downcase) if @type.re_date.named_captures.empty?\n\n extra = matched.captures.size > 2 ? matched[:d] : nil\n [matched[:m].downcase, matched[:y], extra]\n end",
"def regex(word)\n if word =~ /lab/\n puts word\n else\n puts \"No match\" \n end\nend",
"def search_values_in_quotes\n search_string.scan(REGEX_WORD_IN_QUOTES)\n end",
"def word_pattern(pattern, input)\n \nend",
"def find_with(match_expression)\n all_example_groups.select do |example_group|\n example_group.description.start_with?(match_expression)\n end\n end",
"def ruby_grep(filename, pattern)\n regexp = Regexp.new(pattern)\n File.open(filename, 'r') do |file|\n file.each_line {|line| puts line if regexp =~ line}\n end\nend",
"def match(regex, options={}, &block)\n if result = text.match(regex)\n item = result[1]\n end\n filtered = yield(item,result) if block_given?\n filtered || item\n end",
"def test_match \n begin\n md = @regexp =~ @s\n puts \"\\n#{regexp} =~ #{@s} yields #{@regexp =~ @s} and $~=#{$~.inspect}\"\n\n rescue => e\n $stderr.print e.message \n $stderr.print e.backtrace.join(\"\\n\")\n raise #re-raise\n end \n end",
"def prepare_for_regexp(output_str)\n split_lines(output_str).map do |str|\n Regexp.new(Regexp.escape(str), Regexp::EXTENDED)\n end\n end",
"def test_extended_patterns_no_flags\n [\n [ \".*\", \"abcd\\nefg\", \"abcd\" ],\n [ \"^a.\", \"abcd\\naefg\", \"ab\" ],\n [ \"^a.\", \"bacd\\naefg\", \"ae\" ],\n [ \".$\", \"bacd\\naefg\", \"d\" ]\n ].each do |reg, str, result|\n m = RustRegexp.new(reg).match(str)\n puts m.inspect\n unless m.nil?\n assert_equal result, m[0]\n end\n end\n end",
"def search(str)\n return [] if str.to_s.empty?\n \n words = str.downcase.split(' ')\n pattern = Regexp.new(words.join('|'))\n matches = []\n\n pages.each do |page|\n if page.title.downcase =~ pattern\n matches << [page, []]\n \n elsif page.body.downcase =~ pattern\n matches << [page, highlight(page.html, words)]\n end\n end\n\n matches\n end",
"def where_regex(attr, value, flags: \"e\")\n where_operator(attr, :matches_regexp, \"(?#{flags})\" + value)\n end",
"def where_regex(attr, value, flags: \"e\")\n where_operator(attr, :matches_regexp, \"(?#{flags})\" + value)\n end",
"def get_regex(pattern, encoding='ASCII', options=0)\n Regexp.new(pattern.encode(encoding),options)\nend",
"def matches?(pattern); end",
"def match(regexp)\n return regexp.match(pickle_format)\n end",
"def fullmatch(re)\n format(:color => false).match(re)\n end",
"def find(string)\n string = string.split(//).join(\".*?\")\n pattern = \"/#{string}/i\"\n\n results = self.cache.grep /#{string}/i\n\n return results\n end",
"def values\n @values ||= begin\n matches = []\n\n text.scan(VALUE_REGEXP) do\n offset = Regexp.last_match.offset(1)\n matches << loc.expression.adjust(begin_pos: offset.first)\n .with(end_pos: loc.expression.begin_pos + offset.last)\n end\n\n matches\n end\n end",
"def fsearch(file, regex)\n\tooo = File.stat(file)\n\toatime=foo.atime #atime before edit\n\tomtime=foo.mtime #mtime before edit\n\n\tf = File.open(file)\n\tfoo = f.readlines\n\tf.close\n\tif foo.to_s.match(/#{regex}/im) #Check for needle in haystack :p\n\t\tputs \"#{HC}#{FGRN}Found matches to '#{FWHT}#{regex}#{FGRN}' in File#{FWHT}: #{file}#{RS}\"\n\t\tocc = foo.to_s.scan(/#{regex}/im).count #How many times does it occur in file?\n\t\tputs \"\\t#{FGRN}Number of Occurances#{FWHT}: #{occ}#{RS}\"\n\telse\n\t\tputs \"#{HC}#{FRED}No Matches to '#{FWHT}#{regex}#{FRED}' in File#{FWHT}: #{file}#{RS}\"\n\tend\n\n\tFile.utime(oatime, omtime, file) #Keep timestamp preserved\nend",
"def match_against filename\n @regexp.match(filename)\n end",
"def search(pattern)\n\t\tmatching_lines = lines.select { |line| line.match(pattern) }\n\t\tmatching_lines.size == 0 ? nil : matching_lines\n\tend",
"def search(pattern)\n\t\tmatching_lines = lines.select { |line| line.match(pattern) }\n\t\tmatching_lines.size == 0 ? nil : matching_lines\n\tend",
"def get_matches(transactions=Transaction.all)\n raise \"not an array\" unless transactions.instance_of?(Array)\n transactions.select do |tr|\n raise \"Not a transaction\" unless tr.instance_of?(Transaction)\n tr.matches?(self.regexp) \n end\n end",
"def search(pattern_to_match)\n results = []\n caches = source_index_hash\n caches.each do |cache|\n results << cache[1].search(pattern_to_match)\n end\n results\n end"
] | [
"0.7165732",
"0.70880353",
"0.6991217",
"0.6893286",
"0.6569845",
"0.65322",
"0.6453851",
"0.6362643",
"0.6295005",
"0.62933683",
"0.62046385",
"0.6170565",
"0.61315477",
"0.611829",
"0.61130303",
"0.61058277",
"0.6016935",
"0.5980959",
"0.59751236",
"0.5965583",
"0.5959748",
"0.59471804",
"0.5938073",
"0.5925281",
"0.59194136",
"0.5907277",
"0.58727014",
"0.5860357",
"0.5849074",
"0.5849074",
"0.58256876",
"0.58252156",
"0.5823825",
"0.5814197",
"0.57861865",
"0.57847494",
"0.5757876",
"0.5743096",
"0.57062936",
"0.569541",
"0.5695241",
"0.5691822",
"0.56898934",
"0.56844765",
"0.568133",
"0.56538194",
"0.56476045",
"0.5635553",
"0.56301045",
"0.560137",
"0.560137",
"0.560137",
"0.560137",
"0.560137",
"0.560137",
"0.560137",
"0.560137",
"0.560137",
"0.560137",
"0.560137",
"0.560137",
"0.560137",
"0.5597722",
"0.55946404",
"0.5590362",
"0.55737686",
"0.5565775",
"0.5565624",
"0.5563031",
"0.5563031",
"0.55622476",
"0.55617476",
"0.55555344",
"0.5551464",
"0.5523517",
"0.55161273",
"0.5511169",
"0.55049694",
"0.5504588",
"0.5500693",
"0.5476503",
"0.54600644",
"0.5453963",
"0.5438096",
"0.54332805",
"0.54261076",
"0.54255193",
"0.5420934",
"0.5420934",
"0.54148483",
"0.54131335",
"0.5405635",
"0.539059",
"0.53878284",
"0.5384045",
"0.5382973",
"0.5379926",
"0.53788644",
"0.53788644",
"0.5377225",
"0.5377029"
] | 0.0 | -1 |
Find a string in text input Finds all occurrences of the input string in the input content, and returns the matches | def edit_text_find_simple(request, opts = {})
data, _status_code, _headers = edit_text_find_simple_with_http_info(request, opts)
data
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def match_text text\n @lookups.each do |rx_curr|\n return true if text =~ rx_curr\n end\n false\n end",
"def partial_matches_for(input_string)\n # [\"aardvark\", \"apple\"]\n @word_list.select do |word|\n word.start_with?(input_string)\n end\n end",
"def textmatch(text, terms)\n terms.all? { |term| text =~ /#{term}/i }\nend",
"def search_words\n begin\n regex = Regexp.new(@pattern)\n rescue RegexpError => msg\n error_msg(msg)\n rescue NameError => msg\n error_msg(msg)\n end\n @results = DICT.select do |word|\n regex =~ word\n end\n @num_results = @results.length\n format_results\n display_results\n end",
"def exact_matches(search_word, string)\n regexp = Regexp.new(Regexp.escape(search_word), \"i\")\n return (string.scan(regexp) || []).length\n end",
"def find(string)\n string = string.split(//).join(\".*?\")\n pattern = \"/#{string}/i\"\n\n results = self.cache.grep /#{string}/i\n\n return results\n end",
"def matches(input)\n (0...input.length).reduce([]) do |memo, offset|\n memo + matches_at_offset(input, offset)\n end\n end",
"def matches(str)\n each_match(str).to_a\n end",
"def find(input)\n end",
"def search(word)\n \n end",
"def find(t)\n text = t\n text.downcase! unless @case_sensitive\n text.gsub!(/\\s+/,' ') # Get rid of multiple spaces.\n @state = 0\n index = 0\n text.each_char do |char|\n # Incrementing now so that I can announce index - @length.\n index += 1\n @state = step(@state,char)\n if @state == @length # Yay, we've got ourselves a match!\n puts \"Match found for #{@word[1,@length]} at #{index - @length}\"\n @state = 0\n end\n end\n end",
"def search(str)\n return [] if str.to_s.empty?\n \n words = str.downcase.split(' ')\n pattern = Regexp.new(words.join('|'))\n matches = []\n\n pages.each do |page|\n if page.title.downcase =~ pattern\n matches << [page, []]\n \n elsif page.body.downcase =~ pattern\n matches << [page, highlight(page.html, words)]\n end\n end\n\n matches\n end",
"def find_reg_ex_matches( reg_ex )\n match_set = Set.new\n @words_set.to_a.each do |word|\n match_set.add word if word.downcase.match(reg_ex)\n end\n match_set\n end",
"def search_values_in_quotes\n search_string.scan(REGEX_WORD_IN_QUOTES)\n end",
"def search(string)\n raise 'The library is not open!' unless @open\n myStr = string\n count = 0\n pattern = Regexp.new(myStr, 'i')\n unless myStr.length >= 4\n puts 'Search string must contain at least four characters'\n else\n books_available.each_with_index do |line, index|\n tempString = line.to_s\n if tempString =~ pattern\n puts line\n temp_object = books_available.at(index)\n book_ids << temp_object.get_id\n count = count + 1\n end\n end\n\n if count == 0\n puts 'No books found'\n end\n\n end\n\n end",
"def matches( input )\n matches = Array.new\n\n input.shorter.each_with_index do |char, idx|\n input.window_range( idx ).each do |widx|\n if input.longer[widx] == char then\n matches << widx\n break\n end\n end\n end\n\n return matches\n end",
"def pattern_matching(pattern, genome)\n # Pattern Matching Problem: Find all occurrences of a pattern in a string.\n # Input: Two strings, Pattern and Genome.\n # Output: All starting positions where Pattern appears as a substring of Genome.\n\n # Sample Input:\n # ATAT\n # GATATATGCATATACTT\n\n # Sample Output:\n # 1 3 9\n\n match_indexes = []\n search_start_pos = 0\n while index = genome.index(pattern, search_start_pos)\n match_indexes << index\n # puts index\n search_start_pos = index + 1\n end\n return match_indexes\n end",
"def search\n\t\terror_message = nil\n\t\tresults = []\n\t\tloop do\n\t\t\t# system \"clear\"\n\t\t\tputs error_message || \"Please enter how you'd like to search.\".green\n\t\t\tputs \"1) Exact Match\\n2) Partial Match\\n3) Begins With...\\n4) Ends With...\\n\"\n\t\t\tprint \">\".blink.cyan\n\t\t\tinput = gets.chomp.to_i\n\t\t\tif input.is_a?(Fixnum) && input >= 1 && input <= 4\n\t\t\t\tresults = @dictionary_analyzer.search(input, @dictionary)\n\t\t\t\tbreak\n\t\t\telse\n\t\t\t\terror_message = \"Sorry, invalid input. Please choose 1,2,3 or 4.\"\n\t\t\t\tredo\n\t\t\tend\t\n\t\tend\n\n\t\t# Now that we have the results let's do something\n\t\t# with them. Unless there aren't any.\n\t\tif results.count == 0\n\t\t\tputs \"Sorry, no words were found that match that string.\"\n\t\telse\n\t\t\tfound_match(results)\n\t\tend\n\tend",
"def search(term)\n # pattern = Regexp.new(pattern, case_insensitive=true)\n # pattern = Regexp.new(pattern, Regexp::EXTENDED | Regexp::IGNORECASE)\n # pattern = Regexp.new(pattern)\n pattern = Regexp.new(term)\n select do |tweet|\n tweet.full_text =~ pattern\n end\n end",
"def search_text(query, text)\n text = pattern(text)\n query.where { title.ilike(text) | description.ilike(text) }\n end",
"def match(input)\n input \n end",
"def search_in(label, string)\n if !LABELS.include? label.to_sym\n raise ArgumentError, \"Unknown key: #{label}\"\n end\n\n find_all do |entry|\n text = entry.send(label).str\n text.match(/#{string}/i)\n end\n end",
"def word_finder (arr, str)\n arr.select do |value|\n value.include? str\n end\nend",
"def my_array_finding_method(source, thing_to_find)\n match_words = []\n source.each do |word| \n for i in 0...word.to_s.length\n if thing_to_find === word[i]\n match_words.push(word)\n break\n end\n end\n end\n return match_words\nend",
"def findWord(query, array_of_strings)\n\t#array_of_strings.select {|str| str.match(query) }\n #array_of_strings.any? {|i| i[query] }\n array_of_strings.reject {|x| x.match (/#{query}/) }\nend",
"def matches(s, re)\n start_at = 0\n matches = []\n while(m = s.match(re, start_at))\n matches.push(m)\n start_at = m.end(0)\n end\n matches\n end",
"def match(text)\n shift = 0\n result = []\n\n # Try to take previous element from cache, if .test() called before\n if (@__index__ >= 0 && @__text_cache__ == text)\n result.push(Match.createMatch(self, shift))\n shift = @__last_index__\n end\n\n # Cut head if cache was used\n tail = shift ? text.slice(shift..-1) : text\n\n # Scan string until end reached\n while (self.test(tail))\n result.push(Match.createMatch(self, shift))\n\n tail = tail.slice(@__last_index__..-1)\n shift += @__last_index__\n end\n\n if (result.length)\n return result\n end\n\n return nil\n end",
"def match_text_exact(match_string, reject = false)\n text = match_string.downcase || \"\"\n proc = Proc.new { |entry|\n title, summary, content = cleaned_content(entry)\n title.include?(text) ||\n summary.include?(text) ||\n content.include?(text)\n }\n reject ? self.entries.reject(&proc) : self.entries.find_all(&proc)\n end",
"def search_text(text)\n sets = @schemes.map do |scheme|\n scheme.find_all(text).uniq\n end\n sets.flatten.uniq\n end",
"def search_note(string)\n logger.info 'Searching for a string within a note'\n search string\n end",
"def brute_force_matches string, pattern\n i = 0\n pos = []\n while i + pattern.length - 1 < string.length\n pos << i if string[i..(i + pattern.length - 1)] == pattern\n i += 1\n end\n pos\nend",
"def my_array_finding_method(source, thing_to_find)\n result = [] # result is the output array\n source.each do |word|\n word_array = word.to_s.split(//) # This creates an array of charaters of 'word'\n if word_array.include?(thing_to_find)\n result.push(word)\n end\n end\n return result\nend",
"def include?(searchstring, substring)\n\nend",
"def my_array_finding_method(source, thing_to_find)\n result = source.select{ |word| word.to_s.include? (thing_to_find) }\n result\nend",
"def my_array_finding_method(source, thing_to_find)\n source.select { |word| word.to_s.include? thing_to_find}\nend",
"def match(input); end",
"def my_array_finding_method(source, thing_to_find)\n source.select { |word| word.to_s.include? thing_to_find }\nend",
"def match(keyword); end",
"def my_array_finding_method(source, thing_to_find)\n # final_array = []\n # source.each do |word|\n # if word.class == thing_to_find.class && word.include?(thing_to_find) == true\n # final_array << word\n # end\n # end\n # return final_array\n ###### refactor\n return source.grep(/#{ thing_to_find }/)\nend",
"def brute_search string, pattern\n pattern_length = pattern.length\n for string_index in (0... string.length)\n match_count = 0\n loop do\n # if a non-match is found, then break.\n break if string[string_index + match_count] != pattern[match_count]\n # if it wasn't a non-match, it must be a match!\n match_count += 1\n # if match_count reaches the length of the pattern, you've found your pattern!\n # return the index in string where the pattern begins\n return string_index if match_count == pattern_length\n end\n end\n return \"not found\"\nend",
"def brute_search string, pattern\n pattern_length = pattern.length\n for string_index in (0... string.length)\n match_count = 0\n loop do\n # if a non-match is found, then break.\n break if string[string_index + match_count] != pattern[match_count]\n # if it wasn't a non-match, it must be a match!\n match_count += 1\n # if match_count reaches the length of the pattern, you've found your pattern!\n # return the index in string where the pattern begins\n return string_index if match_count == pattern_length\n end\n end\n return \"not found\"\nend",
"def matches(s, re)\r\n start_at = 0\r\n matches = [ ]\r\n while(m = s.match(re, start_at))\r\n matches.push(m)\r\n start_at = m.end(0)\r\n end\r\n return matches\r\n end",
"def search(word)\r\n \r\n end",
"def found_match(str)\n\tif dictionary.include?(str) # returns true if found in the dictionary\n\t\treturn str # don't stop the recursion, but return the word ?\n\tend\n\tfalse\nend",
"def bruteForceStringSearch(text,pattern)\n\treturn nil if pattern.nil? or text.nil?\n\tn = text.length\n\tm = pattern.length\n\t0.upto(n-m) do |i|\n\t\tj = 0\n\t\twhile (j < m) and text[i+j] == pattern[j] do\n\t\t\tj += 1\n\t\tend\n\t\treturn i if j==m\n\tend\n\treturn nil\nend",
"def search(pattern)\n entries.grep(Regexp.new(pattern))\n end",
"def check_for (array, thing_to_find )\n array.select { |word| word.include? thing_to_find }\n end",
"def find_a(array)\n array.find_all do |words|\n words.start_with?(\"a\")\n end\nend",
"def find_contact(input)\n # binding.pry\n index_result = []\n matches = Contact.all.each_with_index do |one_contact, index|\n if one_contact.name.to_s =~ /#{Regexp.quote(input)}/i \n index_result << index\n end\n end\n puts \"Here's a list of contacts matching your search: \"\n puts \"================================\"\n index_result.each do |index|\n puts \"Name: #{Contact.find(index).name}\"\n puts \"Email: #{Contact.find(index).email}\"\n puts Contact.find(n).phone_hash.to_yaml\n puts \"================================\"\n end\n end",
"def match(string)\n result = @trie[string]\n return nil unless result\n result.each do |pattern, block|\n match = pattern.match(string)\n block.call(match) if match\n end\n end",
"def linear_search(input)\n \n search_name = input.downcase.split(' ')\n search_name.each do |name_el|\n \n entries.each do |entry|\n \n name_array = entry.name.downcase.split(' ')\n \n if name_array.include?(name_el)\n return entry\n end\n end\n end\n return nil\n end",
"def text_search (string,text)\n\tif !$browser.text.include? string \n\t\tputs \"Error: #{text} not found\"\n\tend\nend",
"def fuzzy_match( input, match_against )\n [*match_against].each_with_index do |targ, idx|\n if input =~ /^#{targ}$/i\n return idx\n elsif input.slice(0..5) =~ /^#{targ.slice(0..5)}/i\n return idx\n end\n end\n return nil\n\n end",
"def search_str(to, po)\n # final value\n s_val = []\n\n # convert into array\n t_arr = to.split('')\n p_arr = po.split('')\n\n # get the count of lookup array\n t_len = t_arr.count - 1\n p_len = p_arr.count - 1\n nxt_ctr = 0 # counter\n\n # loop at t array\n t_arr.each_with_index do |_v, i|\n # break if the counter reached the last element\n break if p_len == t_len\n\n # Compare the set of values in an array with the p array\n s_val << i if t_arr[nxt_ctr..p_len] == p_arr\n\n # Increment the next counter set\n nxt_ctr += 1\n p_len += 1\n end\n s_val\nend",
"def search(word, list)\n\tlist.each do |item|\n\t\tif item == word\n\t\t\tp \" '#{item}' was found\" \n\t\tend\n\tend\nend",
"def textField(textField, completions:somecompletions, forPartialWordRange:partialWordRange, indexOfSelectedItem:theIndexOfSelectedItem)\n matches = Entry.where(:title).contains(textField.stringValue,NSCaseInsensitivePredicateOption).map(&:title).uniq\n matches\n end",
"def search_non_note(string)\n logger.info \"Searching for '#{string}'\"\n search string\n end",
"def findi(words)\n puts words.scan(/i/i).count\nend",
"def find_bigrams(str, bigrams)\n bigrams.select { |bigram| str.include?(bigram)}\nend",
"def rabinKarpStringSearch(text, pattern)\n return nil if pattern.nil? or text.nil?\n n = text.length\n m = pattern.length\n\n patternHash = hash_of(pattern)\n textHash = hash_of(text[0,m]) \n\n 0.upto(n-m) do |i|\n if textHash == patternHash\n if text[i..i+m-1] == pattern\n return i\n end\n end\n \n textHash = hash_of(text[i+1..i+m])\n end\n \n nil\nend",
"def match_string( tree, string )\n # puts \"Checking for `#{string}` in tree (#{tree}).\"\n\n if tree.empty?\n # puts \"Tree is empty, returning empty\"\n return [ ]\n\n elsif string.empty?\n # puts \"No search string, returning empty\"\n return [ ]\n\n else\n matches = [ ]\n\n tree.each do |key,val|\n # puts \"Checking for `#{string}` in `#{key}` branch.\"\n\n simdex = string.simdex(key)\n\n if 0 < simdex\n if string == key\n # puts \"Matched full word! #{string} is #{key}\"\n # matches = collect_keys(val, key).unshift(key)\n return collect_keys(val, key).unshift(key)\n # puts \"Got matches: #{matches}\"\n\n else\n leaf = string.leaf(simdex)\n # puts \"Got leaf #{leaf}\"\n\n check = match_string(val, leaf)\n # puts \"Got check: #{check}\"\n\n if !check.empty?\n # matches = (check.map { |m| key + m })\n return check.map { |m| key + m }\n # puts \"New matches: #{matches}\"\n end\n end\n\n # break\n\n else\n check = match_string(val, string)\n\n if !check.empty?\n matches += check\n end\n end\n end\n\n # if matches.empty?\n # # puts \"No matches (#{string})\"\n # else\n # # puts \"Returning matches (#{string}): #{matches}\"\n # end\n\n return matches\n end\n end",
"def check_in(word)\n if /lab/ =~ word\n puts word\n else\n puts \"No match\"\n end\nend",
"def check_in(word)\n if /lab/ =~ word\n puts word\n else\n puts \"No match\"\n end\nend",
"def check_in(word)\n if /lab/ =~ word\n puts word\n else\n puts \"No match\"\n end\nend",
"def find(input)\r\n if include?(input)\r\n Hash[input, (@@words[input])]\r\n elsif keywords.any? {|key| key.start_with?(input)}\r\n @@words.select {|key, value| key.start_with?(input)}\r\n else\r\n Hash.new\r\n end \r\nend",
"def search(plaintext)\n call(:search, :plaintext => plaintext)[:search_response][:return]\n end",
"def search_full(pattern, succptr, getstr)\n _scan(pattern, succptr, getstr)\n end",
"def match(array)\n array.find_all do |word|\n # split word into arry of letters\n if word.split(\"\").sort == @word.sort\n word\n end\n end\n end",
"def article_match? (query, article_title)\n found = false\n return true if query.empty?\n temp_article = article_title.downcase\n query.each do |kw|\n pattern = Regexp.new /.*#{kw.downcase}.*/\n found = true if temp_article =~ pattern\n end\n found\nend",
"def match(text)\n if match = @regexp.match(text)\n @matched_text = match.to_s\n [match.to_s, @name]\n else\n nil\n end\n end",
"def search_helper *args\n matches = []\n @script_executor.search(*args) { |match|\n matches << match\n }\n matches\nend",
"def custom_count(string, search_characters)\n str = string.chars\n searched = search_characters.chars\n p str\n p searched\n count = 0\n str.each do |item|\n if searched.include?(item)\n count = count + 1\n end\n end\n count\nend",
"def search_search(exploits_array, query)\n search_results=[]\n exploits_array.each do |line|\n line = line.unpack('C*').pack('U*') if !line.valid_encoding?\n if query == 'nil'\n search_results << line\n else\n search_results << line if line =~ /#{query}/i\n end\n end\n return search_results\nend",
"def searchABatch(directory, extension, searchString)\n return Dir.entries(directory).select{|file| File.open(file, \"r\").include?(searchString)}\nend",
"def contains_text(str)\n text.index(str)\n end",
"def find(prepostion)\n\t\tpartial_search_kb = string_to_internal(preposition)\n\t\tpartial_search_kb.each do |sentence|\n\t\t\tind = @kb.index(sentence)\n\t\tend\n\t\treturn ind\n\tend",
"def match(str)\n d, m = str.split(\" \")\n _match(d, m) \n end",
"def matchanywhere(rgx, text)\n if rgx[0] == '^'\n return matchhere(rgx[1..-1], text)\n elsif matchhere(rgx, text)\n return true\n elsif text.nil? && !rgx.nil?\n return false\n else\n return matchanywhere(rgx, text[1..-1])\n end\nend",
"def find_ocurrences(text, first, second)\n text = text.split(' ')\n \n word_output = []\n \n text.each_with_index do |word, index|\n next if index == 0 || index == 1\n \n word_output << word if text[index - 1] == second && text[index - 2] == first\n end\n \n word_output\nend",
"def word_pattern(pattern, input)\n \nend",
"def search(list)\n count = 0\n list.each_line do |string|\n count += 1 if is_a_nice_string?(string)\n end\n count\nend",
"def find_matches(bucket, word)\n\t\tmatches = bucket.map do |exp, match|\n\t\t\tword =~ exp ? match : nil\n\t\tend\n\t\tmatches.compact\n\tend",
"def search_substr( fullText, searchText, allowOverlap = true )\n if searchText == ''\n 0\n else\n fullText.scan(allowOverlap ? Regexp.new(\"(?=(#{searchText}))\") : searchText).size\n end\nend",
"def match_in_string?(string, regex)\n string.match(regex).class == MatchData\nend",
"def match_in_string?(string, regex)\n string.match(regex).class == MatchData\nend",
"def match_in_string?(string, regex)\n string.match(regex).class == MatchData\nend",
"def match_in_string?(string, regex)\n string.match(regex).class == MatchData\nend",
"def match_in_string?(string, regex)\n string.match(regex).class == MatchData\nend",
"def match_in_string?(string, regex)\n string.match(regex).class == MatchData\nend",
"def match_in_string?(string, regex)\n string.match(regex).class == MatchData\nend",
"def match_in_string?(string, regex)\n string.match(regex).class == MatchData\nend",
"def match_in_string?(string, regex)\n string.match(regex).class == MatchData\nend",
"def match_in_string?(string, regex)\n string.match(regex).class == MatchData\nend",
"def match_in_string?(string, regex)\n string.match(regex).class == MatchData\nend",
"def match_in_string?(string, regex)\n string.match(regex).class == MatchData\nend",
"def match_in_string?(string, regex)\n string.match(regex).class == MatchData\nend",
"def check_for_matches(input)\n @matched = false\n secret_word_array = @secret_word.split(\"\")\n\n secret_word_array.each_with_index do |char, idx|\n if char == input || char == input.upcase\n @matched_letters.insert(idx, char).slice!(idx+1)\n @matched = true\n end\n end\n\n if !@matched\n @guesses_left -= 1\n @misses += \", \" unless @misses == \"\"\n @misses += input\n end\n end",
"def match(*strings)\n result = []\n @tags.each do |tag|\n strings.each do |string|\n if string.downcase =~ /#{tag.downcase}/\n strings.delete string\n result << tag\n break\n end\n end\n end\n return result\n end",
"def all_alpha_matches(input)\n where(alpha: sort_letters(input)).pluck :text\n end",
"def matches (string, pattern)\n if string . length == 0 || pattern . length == 0\n return 0\n end\n\n count = matches string [1 .. -1], pattern\n\n if string [0] == pattern [0]\n if pattern . length == 1\n count += 1\n else\n count += matches string [1 .. -1], pattern [1 .. -1]\n end\n end\n\n return count\nend",
"def alpha_search(str)\r\n\r\nend"
] | [
"0.68030685",
"0.6795328",
"0.67800766",
"0.6778386",
"0.67155194",
"0.6652916",
"0.6603315",
"0.6558996",
"0.6537478",
"0.64943457",
"0.64856493",
"0.6435088",
"0.62865627",
"0.6266953",
"0.6253671",
"0.62390107",
"0.62112385",
"0.62011117",
"0.6197337",
"0.61906886",
"0.6185128",
"0.617493",
"0.6161676",
"0.61594105",
"0.6159083",
"0.61522985",
"0.6134628",
"0.61282057",
"0.6128204",
"0.61237854",
"0.6102058",
"0.60907006",
"0.60548246",
"0.604928",
"0.60210854",
"0.6013621",
"0.6011174",
"0.59934765",
"0.5987462",
"0.598464",
"0.598464",
"0.59543294",
"0.5951569",
"0.5938528",
"0.5937109",
"0.59287983",
"0.59232104",
"0.59024054",
"0.5884107",
"0.58797926",
"0.5877642",
"0.58695394",
"0.5863786",
"0.58627516",
"0.58533674",
"0.5853179",
"0.5852249",
"0.58200836",
"0.5818901",
"0.58158356",
"0.58141154",
"0.5809319",
"0.5809319",
"0.5809319",
"0.5806532",
"0.5805404",
"0.5800454",
"0.5765455",
"0.5765063",
"0.5763786",
"0.5750897",
"0.57429814",
"0.5741964",
"0.57400614",
"0.5732135",
"0.5732018",
"0.57304686",
"0.5729853",
"0.5728629",
"0.57277405",
"0.57033116",
"0.56965417",
"0.5696148",
"0.56914735",
"0.56914735",
"0.56914735",
"0.56914735",
"0.56914735",
"0.56914735",
"0.56914735",
"0.56914735",
"0.56914735",
"0.56914735",
"0.56914735",
"0.56914735",
"0.56914735",
"0.5690036",
"0.5687956",
"0.56839645",
"0.5681881",
"0.5676631"
] | 0.0 | -1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.