query stringlengths 7 9.55k | document stringlengths 10 363k | metadata dict | negatives listlengths 0 101 | negative_scores listlengths 0 101 | document_score stringlengths 3 10 | document_rank stringclasses 102
values |
|---|---|---|---|---|---|---|
Return a +Duration+ between this +Instant+ and another. | def duration_since(earlier)
raise TypeError, 'Not an Instant' unless earlier.is_a?(Instant)
earlier - self
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def duration\n if start_time && end_time\n end_time.to_i - start_time.to_i\n else\n 0.0\n end\n end",
"def slice(other)\n fail TypeError unless like_duration?(other)\n return nil unless overlap?(other)\n s_time = @start_time < other.start_time ? ot... | [
"0.60668737",
"0.5999777",
"0.5951549",
"0.5933865",
"0.5860478",
"0.58177656",
"0.5815404",
"0.58090025",
"0.57606184",
"0.57566726",
"0.57494307",
"0.5730793",
"0.57098913",
"0.56569844",
"0.5630851",
"0.56275845",
"0.5593419",
"0.5541217",
"0.5529948",
"0.550354",
"0.55009... | 0.630348 | 0 |
Return a +Duration+ since this +Instant+ and now. | def elapsed
duration_since(self.class.now)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def duration_since(earlier)\n raise TypeError, 'Not an Instant' unless earlier.is_a?(Instant)\n\n earlier - self\n end",
"def seconds_until_expiration(now=Time.now)\n ((@ends_at - now).abs).round\n end",
"def time_duration\n t1 = Time.now.to_f\n Time.now.to_f - t1\nend",
"def elapsed_time\... | [
"0.6999616",
"0.6402447",
"0.6358216",
"0.6283728",
"0.62622654",
"0.62622654",
"0.6255973",
"0.62059706",
"0.6172525",
"0.61245656",
"0.61084867",
"0.6082774",
"0.6072874",
"0.6032454",
"0.601759",
"0.59909874",
"0.5983704",
"0.5981128",
"0.5977994",
"0.59648746",
"0.5943084... | 0.66674054 | 1 |
Return whether this +Instant+ is in the past. | def in_past?
elapsed.positive?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def past?\r\n @at < DateTime.now\r\n end",
"def past?\n utc.past?\n end",
"def from_past?\n return !flags.anybits?(FLAG_PRESENT_TIME)\n end",
"def past?\n date_and_time < Time.now\n end",
"def past?\n end_on.past?\n end",
"def past?\n\n @next_time &&\n @next_time < T... | [
"0.81675124",
"0.79641646",
"0.79266274",
"0.7913261",
"0.7795148",
"0.7714054",
"0.7676584",
"0.7676428",
"0.7526488",
"0.75049776",
"0.7327761",
"0.7244667",
"0.71324784",
"0.7126643",
"0.711525",
"0.7071074",
"0.7033223",
"0.70125234",
"0.7010349",
"0.6894591",
"0.6890203"... | 0.80355316 | 1 |
Return whether this +Instant+ is in the future. | def in_future?
elapsed.negative?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def future?\n return if missing?\n\n reference_time < time\n end",
"def future?\r\n @at > DateTime.now\r\n end",
"def future?\n utc.future?\n end",
"def future?\n !current? && !complete?\n end",
"def future?\n start_date.future?\n end",
"def in_the_future(no... | [
"0.81696594",
"0.79870903",
"0.7798542",
"0.74801034",
"0.74775153",
"0.73908657",
"0.73613715",
"0.73595285",
"0.73027205",
"0.7184937",
"0.7088844",
"0.7036193",
"0.68208414",
"0.68164486",
"0.6796522",
"0.6782472",
"0.6747135",
"0.67418706",
"0.6721679",
"0.67186624",
"0.6... | 0.781764 | 2 |
Sleep until this +Instant+, plus an optional +Duration+, returning a +Duration+ that's either positive if any time was slept, or negative if sleeping would require time travel. | def sleep(duration = nil)
remaining = duration ? duration - elapsed : -elapsed
remaining.tap { |rem| rem.sleep if rem.positive? }
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sleep(duration)\n if duration == nil || duration == Float::INFINITY\n Thread.stop\n else\n Thread.sleep(duration)\n end\n nil\n end",
"def sleep_until(t)\n dt = (t - Time.zone.now).ceil \n blather(\"sleep_until #{t} (#{dt} seconds)\")\n sleep(d... | [
"0.67218953",
"0.6209635",
"0.5929279",
"0.5786608",
"0.5786608",
"0.570934",
"0.5681634",
"0.5668224",
"0.56307864",
"0.5613143",
"0.5613143",
"0.56008816",
"0.55479383",
"0.5521961",
"0.5495794",
"0.5479851",
"0.5463147",
"0.54368514",
"0.54368514",
"0.54250556",
"0.5419218... | 0.73148876 | 0 |
Sleep for the given number of seconds past this +Instant+, if any. Equivalent to +sleep(Duration.from_secs(secs))+ | def sleep_secs(secs)
sleep(Duration.from_secs(secs))
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sleep(seconds)\n task = start(Tasks::Timeout.new(delay: seconds), explicit_start: true)\n wait task.stop_event\n end",
"def delay(seconds)\n sleep(seconds)\n end",
"def sleep(duration = nil)\n remaining = duration ? duration - elapsed : -elapsed\n\n ... | [
"0.7186416",
"0.681497",
"0.6546185",
"0.65368503",
"0.63583153",
"0.63583153",
"0.6353483",
"0.62893486",
"0.6277359",
"0.62078965",
"0.6200521",
"0.61726487",
"0.61549044",
"0.6091573",
"0.60650545",
"0.5963332",
"0.5954447",
"0.59453535",
"0.59401137",
"0.5904255",
"0.5871... | 0.7649065 | 0 |
Sleep for the given number of milliseconds past this +Instant+, if any. Equivalent to +sleep(Duration.from_millis(millis))+ | def sleep_millis(millis)
sleep(Duration.from_millis(millis))
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def msleep( msec )\n NSThread.sleepForTimeInterval(msec / 1000.0)\n end",
"def delay(seconds)\n sleep(seconds)\n end",
"def sleep_until(t)\n dt = (t - Time.zone.now).ceil \n blather(\"sleep_until #{t} (#{dt} seconds)\")\n sleep(dt) if dt > 0.0\n end",
"def sle... | [
"0.6576366",
"0.62369585",
"0.6095295",
"0.60482556",
"0.59525305",
"0.59483004",
"0.5906756",
"0.5906756",
"0.5889285",
"0.5835958",
"0.57620186",
"0.5723446",
"0.5614892",
"0.5613263",
"0.56061316",
"0.5601406",
"0.56004417",
"0.55193275",
"0.5517852",
"0.5515326",
"0.54414... | 0.7629813 | 0 |
Add a +Duration+ or +to_nanos+coercible object to this +Instant+, returning a new +Instant+. | def +(other)
return TypeError, 'Not one of: [Duration, #to_nanos]' unless other.respond_to?(:to_nanos)
Instant.new(@ns + other.to_nanos)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def + duration\n if duration.is_a? MTK::Core::Duration\n MTK::Core::Duration[@value + duration.value]\n else\n MTK::Core::Duration[@value + duration]\n end\n end",
"def +(duration)\n duration.add_to_date_time_value(self)\n end",
"def +(seconds)\n T... | [
"0.6087425",
"0.5998529",
"0.59605265",
"0.58028877",
"0.57767886",
"0.56741977",
"0.56741977",
"0.56692415",
"0.5648471",
"0.56016314",
"0.5516103",
"0.53263175",
"0.53263175",
"0.52923054",
"0.5291565",
"0.5097509",
"0.50717604",
"0.49812132",
"0.49705058",
"0.48997775",
"0... | 0.7775075 | 0 |
Determine if the given +Instant+ is before, equal to or after this one. +nil+ if not passed an +Instant+. | def <=>(other)
@ns <=> other.ns if other.is_a?(Instant)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ===(instant)\n (instant >= self.begin) and (instant < self.end)\n end",
"def past?\r\n @at < DateTime.now\r\n end",
"def earlier?(timestamp)\n starts_at && timestamp < starts_at\n end",
"def future?\r\n @at > DateTime.now\r\n end",
"def ==(other)\n other.is_a?(Instant) && @... | [
"0.6355505",
"0.6304301",
"0.6026231",
"0.58486694",
"0.5844636",
"0.58184195",
"0.5743361",
"0.5741577",
"0.57373184",
"0.57205784",
"0.5716239",
"0.5565988",
"0.55554223",
"0.55326194",
"0.55326194",
"0.5509825",
"0.5505544",
"0.5495966",
"0.5486619",
"0.54587346",
"0.54118... | 0.5614729 | 11 |
Determine if +other+'s value equals that of this +Instant+. Use +eql?+ if type checks are desired for future compatibility. | def ==(other)
other.is_a?(Instant) && @ns == other.ns
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def eql?(other)\n self.class == other.class && value == other.value\n end",
"def eql?(other)\n self.class == other.class && value == other.value\n end",
"def ==(other)\n self.class == other.class && value == other.value\n end",
"def eql?(other)\n self.class.equal?(o... | [
"0.7442291",
"0.7442291",
"0.73950994",
"0.7362177",
"0.7362177",
"0.71868694",
"0.71805924",
"0.7112803",
"0.69669014",
"0.69520766",
"0.69100136",
"0.69100136",
"0.69100136",
"0.6890395",
"0.6881319",
"0.68783486",
"0.68778086",
"0.6874862",
"0.68708515",
"0.6867783",
"0.68... | 0.7727403 | 0 |
Generate a hash for this type and value. | def hash
self.class.hash ^ @ns.hash
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def hash\n raw = [name, type, values.join('/')].join(' ')\n Digest::MD5.hexdigest(raw)\n end",
"def hash\r\n\t\treturn @name.hash() + @type.hash()\r\n\tend",
"def hash\n type.hash ^ (id.hash >> 1)\n end",
"def hash\n [@bit, @type].hash\n end",
"def hash() end",
"def hash(... | [
"0.78975546",
"0.7428938",
"0.7367448",
"0.7274831",
"0.71981776",
"0.71981776",
"0.71981776",
"0.71981776",
"0.71981776",
"0.71981776",
"0.71981776",
"0.7185575",
"0.71039927",
"0.71039927",
"0.71038365",
"0.7078571",
"0.70419604",
"0.70218384",
"0.70213014",
"0.7005473",
"0... | 0.0 | -1 |
Reset the internal CPU Registers | def reset_cpu
# Correct CPU Cycles for Odd Games
# Reset the CPU Registers
accumulator, x, y = 0x00
stack_pointer = 0x04
status = 0xFF
program_counter = 0#readWord(0xFFFC)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def reset_regs\n @regs.clear\n end",
"def reset\n write(SYSTEM_RESET)\n end",
"def reset\n self.cpus = 1\n self.ram = 512\n self.video_ram = 18\n self.hardware_id = UUID.generate\n\n self.os = :other \n self.pae = false\n self.acpi = true\n self.io_apic = false\n \... | [
"0.7898958",
"0.6539224",
"0.6461188",
"0.6414754",
"0.6387086",
"0.63474506",
"0.6259056",
"0.6247606",
"0.6235213",
"0.6207217",
"0.6207217",
"0.6151762",
"0.6113251",
"0.6111514",
"0.60600626",
"0.60567033",
"0.6042687",
"0.59984183",
"0.59860164",
"0.59747493",
"0.5954017... | 0.7904633 | 0 |
Read value from a specified memory address | def read_memory(address)
# nes.memory.readWord(address)
# Memory Manager readWord above
# return read(address) | (read(address + 1) << 8);
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def read(address)\n tag, slot_num, block_offset = split_address(address)\n slot = @slots[slot_num.to_i(16)]\n hit_miss = hit_miss(slot, tag)\n if hit_miss == \"hit\"\n value = slot.saved_blocks[block_offset.to_i(16)]\n else\n value = @main_memory.content[address.to_i(16)]\n ... | [
"0.7385886",
"0.7238109",
"0.71221876",
"0.70623004",
"0.6976079",
"0.6830919",
"0.6769013",
"0.6659813",
"0.6605937",
"0.656547",
"0.6459124",
"0.6424056",
"0.6411788",
"0.6410193",
"0.6251591",
"0.6174591",
"0.61349386",
"0.61253065",
"0.5999151",
"0.5989126",
"0.5961494",
... | 0.7624218 | 0 |
Adds the payload to the queue. | def dispatch(payload)
queue.push(payload)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def enqueue(payload)\n end",
"def enqueue(payload)\n @queue.publish(payload.encode, :persistent => true)\n end",
"def enqueue(payload)\n @queue.publish(JSON.generate(payload), :routing_key => @queue.name)\n end",
"def enqueue_packet(payload); end",
"def add_to_queue(data)\n fa... | [
"0.7826754",
"0.78091455",
"0.77673197",
"0.6987519",
"0.691199",
"0.6860891",
"0.67413974",
"0.6699238",
"0.6633177",
"0.6626214",
"0.6621248",
"0.66151893",
"0.6582523",
"0.6526812",
"0.65113175",
"0.6501613",
"0.64463854",
"0.64413095",
"0.6426413",
"0.64177555",
"0.641566... | 0.77404654 | 3 |
Start the agent process and begin dispatching events. | def start
unless Octave.config.enabled?
Octave.logger.warn do
"Octave agent is disabled. Metrics will not be reported."
end
return
end
Octave.logger.info { "Starting Octave agent..." }
@thread = Thread.new(&method(:run))
@running = true
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def start\n return unless agent_should_start?\n\n log_startup\n check_config_and_start_agent\n log_version_and_pid\n\n events.subscribe(:initial_configuration_complete) do\n log_ignore_url_regexes\n end\n end",
"def start\n \n register... | [
"0.69285935",
"0.69175625",
"0.6883847",
"0.6830206",
"0.6719538",
"0.67011315",
"0.65750533",
"0.65750366",
"0.6431998",
"0.636776",
"0.632446",
"0.6321929",
"0.62749714",
"0.6268988",
"0.6233263",
"0.6228073",
"0.62110895",
"0.6205813",
"0.6202435",
"0.6159375",
"0.61345315... | 0.64100945 | 9 |
Loop to pass the payload to each dispatcher as the payload enters the queue. | def run
while running? || !queue.empty?
payload = queue.pop(false)
call_dispatchers(payload)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def dispatch\n queue << nil\n while message = queue.shift\n consumers.each do |consumer|\n if response = consumer.on_message(message)\n @queue += Array(response)\n end\n end\n end\n end",
"def dispa... | [
"0.6795199",
"0.6727409",
"0.66844016",
"0.657914",
"0.64906245",
"0.60291713",
"0.59795696",
"0.59724104",
"0.5930753",
"0.5841825",
"0.58250546",
"0.58125275",
"0.5804279",
"0.5803039",
"0.57994634",
"0.5790355",
"0.5749025",
"0.573814",
"0.5726239",
"0.56915784",
"0.568993... | 0.6995397 | 0 |
Determines whether the agent is running. | def running?
@running
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def running?\n spawned? and !@status and alive?\n end",
"def is_running?\n return @running\n end",
"def is_running?\n # TODO: cache this maybe?\n fetch_is_running?\n end",
"def is_running?\n return @running\n end",
"def running?\n self.status == STATUS_RUNNING\n end",... | [
"0.79790425",
"0.7858174",
"0.7720738",
"0.77044934",
"0.7696464",
"0.76599324",
"0.7568913",
"0.75632405",
"0.75613886",
"0.7554008",
"0.7548252",
"0.75426066",
"0.75133973",
"0.74969256",
"0.74773794",
"0.74754405",
"0.7471044",
"0.7457789",
"0.7454824",
"0.7454824",
"0.745... | 0.751144 | 19 |
Submits the payload to each dispatcher. | def call_dispatchers(payload)
dispatchers.each do |dispatcher|
dispatcher.call(payload)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def dispatch(payload)\n queue.push(payload)\n end",
"def dispatch\n Engine.instance.dispatch([self])\n end",
"def dispatch!\n \n # negotiates initial configuration\n @meta = self.negotiate!\n \n # dispatches hash set to the server\n ... | [
"0.68341804",
"0.63120216",
"0.62619406",
"0.6209953",
"0.61586046",
"0.6114723",
"0.5990449",
"0.5900391",
"0.5850905",
"0.58164334",
"0.57939774",
"0.5766454",
"0.57431424",
"0.55824906",
"0.55619663",
"0.5446535",
"0.54019773",
"0.53970355",
"0.5389584",
"0.53823143",
"0.5... | 0.7233402 | 0 |
Given a singly linked list, group all odd nodes together followed by the even nodes. Please note here we are talking about the node number and not the value in the nodes. Note: The relative order inside both the even and odd groups should remain as it was in the input. The first node is considered odd, the second node ... | def odd_even_list(head)
return head if (head.nil? || head.next.nil? || head.next.next.nil?)
odd_head = head
even_head = odd_head.next
initial_even_head = even_head
while odd_head.next && even_head.next
odd_head.next = odd_head.next.next
even_head.next = even_head.next.next
odd_head = odd_head.ne... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def odd_even_list(head)\n\treturn if head == nil\n odd = head\n even = odd.next\n even_head = even\n while even != nil && even.next != nil do\n \todd.next = even.next\n \todd = odd.next\n \teven.next = odd.next\n \teven = even.next\n end\n odd.next = even_head\n head\nend",
"def ... | [
"0.7443766",
"0.7365721",
"0.7217693",
"0.6648216",
"0.63088036",
"0.58362323",
"0.5804309",
"0.580271",
"0.5706807",
"0.5705696",
"0.568462",
"0.56650364",
"0.56466097",
"0.5636556",
"0.5598854",
"0.55833364",
"0.55782914",
"0.55647314",
"0.55580556",
"0.55397916",
"0.552681... | 0.71727806 | 3 |
Replaces the hash without only the given keys. | def except!(*keys)
replace(except(*keys))
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def unaltered(hash)\n hash\n end",
"def replace(hash, **keyvals)\n hash.map { |k, v| [k, keyvals.include?(k) ? keyvals[k] : v] }.to_h\n end",
"def reject_keys!(hash, keys)\n hash.reject { |k, _| keys.include?(k) }\n end",
"def replace(hash)\n __replace__(deep_transform_hashes_of(hash))... | [
"0.6902467",
"0.6725943",
"0.6682949",
"0.66349316",
"0.6597016",
"0.6590528",
"0.6577608",
"0.6577608",
"0.6543084",
"0.6530244",
"0.64778405",
"0.64201623",
"0.6385208",
"0.63345957",
"0.63084495",
"0.6306464",
"0.6273494",
"0.62554586",
"0.6240956",
"0.6228762",
"0.6204353... | 0.64928836 | 14 |
def blog_url Crunchbase::Company.get(crunchbase_slug).blog_url end | def blog_feed_url
if Crunchbase::Company.get(crunchbase_slug).blog_feed_url.nil?
" "
else
Crunchbase::Company.get(crunchbase_slug).blog_feed_url
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def noter_blog_url\n\t\t\"blogs/#{self.noter.main_blog_id}\"\n\tend",
"def bloglink\n @@URL = params[:blog_url]\n end",
"def blog_url(path)\n \"http://blog.jtribe.com.au#{path}\"\n end",
"def set_blog_url\n @blog_url = BlogUrl.find(params[:id])\n end",
"def blog_url(blog, mime_typ... | [
"0.81673986",
"0.81095016",
"0.806285",
"0.74129885",
"0.7365669",
"0.7275116",
"0.7130342",
"0.6994221",
"0.6930588",
"0.69283766",
"0.6908416",
"0.6854315",
"0.6829376",
"0.6784034",
"0.67631775",
"0.6708662",
"0.670383",
"0.6667892",
"0.6666386",
"0.66294837",
"0.6604978",... | 0.8642203 | 0 |
Append nci templates to list. | def all_template_files
files = super
files + Dir.glob("#{JenkinsJob.flavor_dir}/templates/**.xml.erb")
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def template_files\r\n \t[].concat(@templates)\r\n end",
"def add_template_pages; end",
"def select_template\n templatelist = []\n templatelist\n end",
"def append_template(filepath, template, tokens = {})\n # TODO: ensure template exists\n # TODO: is \\n included with STDIN?\n ... | [
"0.6158826",
"0.5638966",
"0.5582683",
"0.54497474",
"0.5440673",
"0.54267645",
"0.5306471",
"0.53048813",
"0.528245",
"0.5277297",
"0.5246052",
"0.52285033",
"0.52169013",
"0.52169013",
"0.52169013",
"0.52169013",
"0.52169013",
"0.5206905",
"0.51762885",
"0.5128883",
"0.5121... | 0.48475546 | 42 |
before_action :require_user, only: [:edit, :show, :update] before_action :is_owner, only: [:destroy] | def new
@color = Color.new
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def require_object_owner\n if User.find(params[:user_id]) != current_user\n flash[:error] = \"Sorry! Viewing not authorized.\"\n redirect_to :back\n end\n end",
"def owner\n redirect_to shelters_path, notice: 'Woah there! Only owners can edit shelters.' unless current_user.owner || current_us... | [
"0.718527",
"0.70505244",
"0.7043187",
"0.7022288",
"0.6974551",
"0.6955193",
"0.6812878",
"0.6799402",
"0.6767523",
"0.67597",
"0.6752398",
"0.6747147",
"0.6726869",
"0.66935545",
"0.66901094",
"0.66775113",
"0.66764563",
"0.66658604",
"0.6626103",
"0.65890396",
"0.6551271",... | 0.0 | -1 |
GET /tour_reviews GET /tour_reviews.json | def index
@tour_reviews = TourReview.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @reviews = reviewable.reviews\n\n respond_to do |format|\n format.html\n format.json { render json: @reviews }\n end\n end",
"def index\n @reviews = @place.reviews\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @reviews }\n ... | [
"0.76432246",
"0.74221915",
"0.7293651",
"0.7222462",
"0.72170144",
"0.72135395",
"0.70975775",
"0.70578474",
"0.70578474",
"0.70442367",
"0.70110273",
"0.70110273",
"0.69929004",
"0.69667214",
"0.6960019",
"0.69508034",
"0.6937265",
"0.6908441",
"0.69034773",
"0.68680084",
"... | 0.7647757 | 0 |
GET /tour_reviews/1 GET /tour_reviews/1.json | def show
@tour_reviews = TourReview.new
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @reviews = reviewable.reviews\n\n respond_to do |format|\n format.html\n format.json { render json: @reviews }\n end\n end",
"def index\n @tour_reviews = TourReview.all\n end",
"def index\n @reviews = @place.reviews\n respond_to do |format|\n format.html # index.h... | [
"0.75821537",
"0.74063945",
"0.7319594",
"0.7245342",
"0.7200131",
"0.7193364",
"0.71312815",
"0.70894754",
"0.70894754",
"0.7045985",
"0.7045985",
"0.6966814",
"0.6938449",
"0.69377404",
"0.6914949",
"0.69128376",
"0.68623936",
"0.6851481",
"0.6851137",
"0.6828499",
"0.68274... | 0.6844351 | 19 |
POST /tour_reviews POST /tour_reviews.json | def create
@tour_review = TourReview.new(tour_review_params)
respond_to do |format|
if @tour_review.save
format.html { redirect_to tours_url(current_user.id), notice: 'ツアーレビューが正常に作成されました。' }
#format.json { render :show, status: :created, location: @tour_review }
else
format.... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n review = course.reviews.new(review_params)\n \n if review.save\n render json: ReviewSerializer.new(review).serialized_json\n else\n render json: { error: review.errors.messages }, status: 422\n end\n end",
"def create\n @review = Review.new(re... | [
"0.7199632",
"0.71714365",
"0.71714365",
"0.71714365",
"0.7082025",
"0.7043133",
"0.6947895",
"0.69398093",
"0.6934093",
"0.6877289",
"0.6845461",
"0.6845461",
"0.682088",
"0.68139625",
"0.6781081",
"0.6779433",
"0.6751917",
"0.67480683",
"0.6701449",
"0.6697413",
"0.6672882"... | 0.71554613 | 4 |
PATCH/PUT /tour_reviews/1 PATCH/PUT /tour_reviews/1.json | def update
respond_to do |format|
if @tour_review.update(tour_review_params)
format.html { redirect_to @tour_review, notice: 'ツアーレビューが正常に更新されました。' }
format.json { render :show, status: :ok, location: @tour_review }
else
format.html { render :edit }
format.json { render js... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @review = Review.find(params[:id])\n @review.update(review_params)\n render json: @review\n end",
"def update\n @review = Review.find(params[:id])\n respond_to do |format|\n if @review.update(review_params)\n format.html { redirect_to @review.lecture, notice: 'Review was ... | [
"0.7378243",
"0.69430536",
"0.6917533",
"0.689476",
"0.6883341",
"0.6879472",
"0.68149275",
"0.68149275",
"0.68149275",
"0.6813139",
"0.6736672",
"0.6736672",
"0.6736672",
"0.6736672",
"0.6730169",
"0.6633542",
"0.66317236",
"0.66173965",
"0.66173965",
"0.66173965",
"0.661739... | 0.68086267 | 10 |
DELETE /tour_reviews/1 DELETE /tour_reviews/1.json | def destroy
@tour_review.destroy
respond_to do |format|
format.html { redirect_to tour_reviews_url, notice: 'ツアーレビューは正常に削除されました。' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @review = reviewable.reviews.find(params[:id])\n @review.destroy\n\n respond_to do |format|\n format.html { redirect_to reviewable_reviews_url(reviewable) }\n format.json { head :no_content }\n end\n end",
"def destroy\n @review = Review.find(params[:id])\n @review.dest... | [
"0.755252",
"0.75450385",
"0.75307447",
"0.75307447",
"0.75307447",
"0.75307447",
"0.75307447",
"0.74509495",
"0.74365276",
"0.74365276",
"0.74365276",
"0.74288917",
"0.74103993",
"0.7348113",
"0.7328676",
"0.73280394",
"0.72967845",
"0.72749",
"0.72641927",
"0.72641927",
"0.... | 0.7600105 | 0 |
Use callbacks to share common setup or constraints between actions. | def set_tour_review
@tour_review = TourReview.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_... | [
"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.0 | -1 |
Only allow a list of trusted parameters through. | def tour_review_params
params.require(:tour_review).permit(:user_id, :tour_id, :review)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def allowed_params\n ALLOWED_PARAMS\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def parameters_list_params\n params.require(:parameters_list).permit(:name, :description, :is_user_specific)\n end",
"def param_whitelist\n [:role, :title]\... | [
"0.69497335",
"0.6812623",
"0.6803639",
"0.6795365",
"0.67448795",
"0.67399913",
"0.6526815",
"0.6518771",
"0.64931697",
"0.6430388",
"0.6430388",
"0.6430388",
"0.63983387",
"0.6356042",
"0.63535863",
"0.63464934",
"0.63444513",
"0.6337208",
"0.6326454",
"0.6326454",
"0.63264... | 0.0 | -1 |
Creates a new instance of an API client for querying the Typeform Data API. | def initialize(api_key:)
@api_key = api_key
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def client\r\n @client ||= APIController.new config\r\n end",
"def client\n @client ||= Contentful::Client.new(\n access_token: options.access_token,\n space: options.space,\n dynamic_entries: :auto,\n api_url: options.api_url\n )\n end",
"def initialize... | [
"0.62756985",
"0.6265953",
"0.6213855",
"0.614384",
"0.614384",
"0.614384",
"0.611771",
"0.6062385",
"0.60030437",
"0.5984607",
"0.59812146",
"0.5971246",
"0.59344983",
"0.59229976",
"0.5913592",
"0.590998",
"0.5906619",
"0.58933467",
"0.5880711",
"0.5862287",
"0.5835296",
... | 0.0 | -1 |
Queries the Typeform Data API /form/ endpoint to retrieve a specific response (filtered by token) for a specific Form. | def find_form_by(form_id:, token:, **query_params)
forms_by_id(form_id: form_id, token: token, **query_params)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_form(form_name)\r\n\t\t\tself.get_design_note(form_name, API::DFLAGPAT_FORM_OR_SIMILAR, Form)\r\n\t\tend",
"def get_result\n form_data = params.require(:form).permit(:id)\n\n render json: Form.get_result(form_data[:id], current_user[\"id\"])\n end",
"def get_all\n with_monitoring ... | [
"0.6295144",
"0.61487526",
"0.60442346",
"0.5977204",
"0.5921939",
"0.58471274",
"0.5835249",
"0.5708605",
"0.567906",
"0.5653238",
"0.5574373",
"0.55231744",
"0.5398636",
"0.53657824",
"0.5355909",
"0.5350851",
"0.5335521",
"0.5332817",
"0.53158545",
"0.52952856",
"0.5294977... | 0.61909175 | 1 |
Run Validation if status is active or if current page == the step listed. Necessary for validations of multistep form. | def active?
status.to_s == 'active'
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def validate_step\n case action_name\n when 'protocol'\n validate_catalog\n when -> (n) { ['service_details', 'save_and_exit'].include?(n) }\n validate_catalog && validate_protocol\n when 'service_calendar'\n validate_catalog && validate_protocol && validate_service_details\n else\n ... | [
"0.6135402",
"0.5892125",
"0.58576554",
"0.58202803",
"0.5741542",
"0.5721506",
"0.5672311",
"0.56595796",
"0.56286436",
"0.5605794",
"0.544256",
"0.5431995",
"0.54276836",
"0.5404554",
"0.5397347",
"0.5389353",
"0.535002",
"0.534497",
"0.5336966",
"0.53248584",
"0.53115875",... | 0.0 | -1 |
"x" greater than or equal to "y" && "d" greater than 0 | def validate?
( @x <= @y && @d > 0 )
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def boundaries(x, y)\n return false if x > 7 || x < 0 || y > 7 || y < 0\n return true\n\n end",
"def between?(x,y) end",
"def safe_position?(x, y)\n x >= 0 &&\n x <= 4 &&\n y >= 0 &&\n y <= 4\n end",
"def greater_than?(x,y)\n x-y > relative_to(y)\n end",
"def validate_xy(x... | [
"0.6457442",
"0.6437741",
"0.64077103",
"0.6406135",
"0.63305366",
"0.631078",
"0.631078",
"0.631078",
"0.630243",
"0.6220054",
"0.62179714",
"0.62179303",
"0.619147",
"0.61765903",
"0.6172544",
"0.61719614",
"0.61675906",
"0.61617714",
"0.61497885",
"0.6135356",
"0.61333877"... | 0.7554507 | 0 |
if "x" equal to "y" return is 0 | def jumps_to_end
( @x == @y ) ? 0 : get_jumps_to_end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def num(x,y)\n if x > 0 && y > 0\n return x.digits.first == y.digits.first\n else\n puts \"invalid\"\n end\nend",
"def check(x, y)\n calc(RADIUS, const, x + y * 1i)\n end",
"def equal_to?(x, y)\n (x-y).abs <= relative_to(y)\n end",
"def approxmatching(a,b)\n\treturn (a==b)\nend",
"def ... | [
"0.708828",
"0.6566572",
"0.65488386",
"0.65207565",
"0.6506016",
"0.6496544",
"0.64704454",
"0.6386663",
"0.6366447",
"0.63663167",
"0.63638294",
"0.6307663",
"0.62994844",
"0.62980664",
"0.62397295",
"0.6199056",
"0.61824447",
"0.6181054",
"0.61429197",
"0.6125387",
"0.6115... | 0.0 | -1 |
Input: loan amount: float annual percentage rate (APR): float loan duration: float Output: monthly payment: float Rules: m = p (j / (1 (1 + j)(n))) where m = monthly payment p = loan amount j = monthly interest rate n = loan duration in months Notes: We have the `loan_amount` given, we can deduce the `monthly_interest_... | def prompt(message)
puts "=> #{message}"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def calculate_monthly_pay(loan_amount, interest_rate, loan_duration)\n loan_amount * (interest_rate * ( 1 + interest_rate) * loan_duration) /\n (interest_rate * ( 1 + interest_rate) * (loan_duration - 1))\nend",
"def monthly_payment(salary_per_annum)\n return salary_per_annum / 12\nend",
"def get_monthly_pa... | [
"0.79089284",
"0.74057144",
"0.72735214",
"0.71692556",
"0.71528405",
"0.70939577",
"0.70757735",
"0.6921527",
"0.6779027",
"0.67700666",
"0.6725083",
"0.6703878",
"0.6575333",
"0.654379",
"0.65072083",
"0.64919114",
"0.6466706",
"0.64514834",
"0.6419182",
"0.6360741",
"0.636... | 0.0 | -1 |
Create a METHOD to STORE information into a database | def create_user (db, first_name, last_name, age, location, social_media,time,date)
db.execute("INSERT INTO users (first_name, last_name, age, location, social_media, time, date) values (?,?,?,?,?,?,?)",[first_name,last_name,age,location,social_media,time,date])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def save\n result = nil\n # iterate over each instance variable and insert create row to table\n\t\t\t\t obj = self.inst_strip_braces(self.object)\n self.instance_variables.each do |method|\n method = method.to_s.gsub(/@/,\"\")\n ... | [
"0.68779415",
"0.6464044",
"0.6464044",
"0.6464044",
"0.6464044",
"0.64194816",
"0.6260532",
"0.6254821",
"0.6254821",
"0.6254821",
"0.62378526",
"0.62209123",
"0.6214601",
"0.6189156",
"0.617394",
"0.61680233",
"0.6167898",
"0.6150736",
"0.612923",
"0.61182165",
"0.61044484"... | 0.0 | -1 |
Confirms the correct user. | def correct_user
@user = User.find(params[:id])
redirect_to(root_url) unless current_user?(@user)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def correct_user\n msg = \"You do not have permission to update another user's information\"\n require_correct_user(@user, msg)\n end",
"def correct_user\n\t\t\tauthenticate_user!\n\t\t\tunless @user == current_user || current_user.admin?\n\t\t\t\tredirect_to (root_path)\n\t\t\t\tflash[:alert]\n... | [
"0.7474259",
"0.73411936",
"0.7317917",
"0.7183303",
"0.7174887",
"0.7049758",
"0.70130193",
"0.7012358",
"0.7006517",
"0.7006201",
"0.7003461",
"0.69663024",
"0.69136065",
"0.6911695",
"0.690295",
"0.6892608",
"0.68439376",
"0.6842948",
"0.68397075",
"0.683463",
"0.6826711",... | 0.0 | -1 |
Confirms an admin user. | def admin_user
redirect_to(root_url) unless current_user.admin?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def confirm_admin\n \tunless session[:admin]\n \t\tflash[:notice] = \"You are not an admin.\"\n \t\tredirect_to(user_path( :id => session[:user_id]))\n \tend\n end",
"def admin_user\n\t\t\tflash_text = \"Administrative privilege required to perform this action.\"\n\t\t\tflash[:danger] = flash_text unless cu... | [
"0.79044944",
"0.767215",
"0.76483077",
"0.76210374",
"0.7605678",
"0.7605678",
"0.75945777",
"0.7588445",
"0.7588445",
"0.7503662",
"0.74675834",
"0.7451482",
"0.7424005",
"0.7411313",
"0.74107665",
"0.7402138",
"0.73993605",
"0.7358812",
"0.7329228",
"0.73179626",
"0.731276... | 0.0 | -1 |
Confirms a loggedin user. | def logged_in_user
unless logged_in?
store_location
flash[:danger] = "Please log in."
redirect_to login_url
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def correct_user\n @user = User.find(params[:id])\n if !current_user?(@user)\n message = \"currently logged in as #{current_user.name}. Not you? \"\n message += \"#{view_context.link_to('Log out.', log_out)}\".html_safe\n flash[:warning] = message\n redirect_to(root_url)\n ... | [
"0.70087826",
"0.6982988",
"0.6919373",
"0.688131",
"0.6845446",
"0.68326277",
"0.67944413",
"0.67929715",
"0.6642435",
"0.6624581",
"0.66114175",
"0.66022736",
"0.6589018",
"0.65539706",
"0.65349805",
"0.65303934",
"0.6512816",
"0.650312",
"0.64878744",
"0.6487622",
"0.64804... | 0.0 | -1 |
Header do arquivo remessa | def monta_header
# CAMPO TAMANHO VALOR
# tipo do registro [1] 0
# operacao [1] 1
# literal remessa [7] REMESSA
# brancos [16]
# info. conta [20]
# empresa mae ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def header; end",
"def header; end",
"def header; end",
"def header\n end",
"def monta_header_arquivo\n header_arquivo = '' # Descrição Posição Tamanho\n header_arquivo << cod_banco ... | [
"0.71965265",
"0.71965265",
"0.71965265",
"0.71827716",
"0.7086203",
"0.69784904",
"0.6800275",
"0.6749812",
"0.67211866",
"0.66576993",
"0.66473716",
"0.6603498",
"0.6603498",
"0.6603498",
"0.6603498",
"0.6603498",
"0.6603498",
"0.6603498",
"0.6603498",
"0.6603498",
"0.66034... | 0.63861847 | 26 |
GET /estacionamientos GET /estacionamientos.json | def index
@estacionamientos = Estacionamiento.all
@serv_adicinales = ServAdicinale.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @establecimientos = Establecimiento.all\n respond_to do |format|\n format.json { \n\n if (params[:appkey].eql? appkey) #si el appkey es correcto\n\n ests = @establecimientos.map { |establecimiento| { :nombre_establecimiento => establecimiento.nombre,... | [
"0.7369505",
"0.7191689",
"0.7166151",
"0.71062523",
"0.70375276",
"0.69870865",
"0.69026834",
"0.68429923",
"0.6775864",
"0.67711896",
"0.6763271",
"0.674462",
"0.6692842",
"0.6684084",
"0.66701543",
"0.66660947",
"0.66595733",
"0.66171837",
"0.6616942",
"0.6612117",
"0.6608... | 0.6460975 | 38 |
GET /estacionamientos/1 GET /estacionamientos/1.json | def show
#@departamento = Ubigeo.find_by_sql("where idDepartamento="+@estacionamiento.departamento.to_s)
@serv_adicinales = ServAdicinale.all
@departamento = Ubigeo.where(:idDepartamento => @estacionamiento.departamento).first
@provincia = Ubigeo.where(:idProvincia => @estacionamiento.provincia).first
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @estacionamiento = Estacionamiento.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @estacionamiento }\n end\n end",
"def index\n @establecimientos = Establecimiento.all\n respond_to do |format|\n format.json { \n\n... | [
"0.7098263",
"0.6955227",
"0.6864724",
"0.6800419",
"0.6770888",
"0.67672354",
"0.6670859",
"0.662671",
"0.660335",
"0.65826845",
"0.6559107",
"0.65500027",
"0.6496385",
"0.6445476",
"0.6428249",
"0.64205086",
"0.64078784",
"0.6406692",
"0.6383198",
"0.63824797",
"0.6380957",... | 0.0 | -1 |
POST /estacionamientos POST /estacionamientos.json | def create
@estacionamiento = Estacionamiento.new(estacionamiento_params)
@lista_departamentos = Ubigeo.find_by_sql("select distinct idDepartamento, Departamento from ubigeos")
@lista_provincias = Ubigeo.find_by_sql("select distinct idProvincia, Provincia from ubigeos")
@lista_distritos = Ubigeo.find_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @estacionamiento = Estacionamiento.new(params[:estacionamiento])\n\n respond_to do |format|\n if @estacionamiento.save\n format.html { redirect_to @estacionamiento, notice: 'Estacionamiento was successfully created.' }\n format.json { render json: @estacionamiento, status: :cr... | [
"0.70379937",
"0.69729424",
"0.6660928",
"0.6640575",
"0.6531335",
"0.64955896",
"0.6487215",
"0.64305115",
"0.64167494",
"0.64099914",
"0.64021164",
"0.63258356",
"0.63204014",
"0.6314737",
"0.630447",
"0.6283524",
"0.6283194",
"0.6265076",
"0.6263003",
"0.62481993",
"0.6224... | 0.6457525 | 7 |
PATCH/PUT /estacionamientos/1 PATCH/PUT /estacionamientos/1.json | def update
respond_to do |format|
if @estacionamiento.update(estacionamiento_params)
format.html { redirect_to @estacionamiento, notice: 'Estacionamiento was successfully updated.' }
format.json { render :show, status: :ok, location: @estacionamiento }
else
format.html { render :... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @estacionamiento = Estacionamiento.find(params[:id])\n\n respond_to do |format|\n if @estacionamiento.update_attributes(params[:estacionamiento])\n format.html { redirect_to @estacionamiento, notice: 'Estacionamiento was successfully updated.' }\n format.json { head :ok }\n ... | [
"0.6671131",
"0.65198225",
"0.642481",
"0.63430583",
"0.6332238",
"0.63139135",
"0.62990016",
"0.6288844",
"0.6256668",
"0.62424934",
"0.6241868",
"0.62330097",
"0.62269056",
"0.62169796",
"0.6208481",
"0.6205181",
"0.6204292",
"0.61808515",
"0.6162784",
"0.6139564",
"0.61371... | 0.6493198 | 3 |
DELETE /estacionamientos/1 DELETE /estacionamientos/1.json | def destroy
@estacionamiento.destroy
respond_to do |format|
format.html { redirect_to estacionamientos_url, notice: 'Estacionamiento was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @estacionamiento = Estacionamiento.find(params[:id])\n @estacionamiento.destroy\n\n respond_to do |format|\n format.html { redirect_to estacionamientos_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @estatuto = Estatuto.find(params[:id])\n @estatuto.destr... | [
"0.7722961",
"0.76240695",
"0.74080485",
"0.73558074",
"0.7306669",
"0.7294676",
"0.7271957",
"0.72687227",
"0.72663015",
"0.7258721",
"0.72524077",
"0.72195184",
"0.72193265",
"0.7214538",
"0.7214304",
"0.7209871",
"0.72082675",
"0.72038954",
"0.7196695",
"0.71846473",
"0.71... | 0.7483989 | 3 |
Use callbacks to share common setup or constraints between actions. | def set_estacionamiento
@estacionamiento = Estacionamiento.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_... | [
"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.0 | -1 |
Never trust parameters from the scary internet, only allow the white list through. | def estacionamiento_params
params.require(:estacionamiento).permit(:nombre, :departamento, :provincia, :distrito, :direccion, :latitud, :longitud, :lunes, :martes, :miercoles, :jueves, :viernes, :sabado, :domingo, :hinicio, :hcierre, :telf, :nespac, :largo, :ancho, :alto, :precio, :img)
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... | [
"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.0 | -1 |
Synchronize the given configmap volume mount item. Examples ``` ns = 'telegraf' deployment/telegrafping deploy = 'telegrafping' default volume name from telegraf chart volume = 'config' configmap/telegrafping configmap = 'telegrafping' configmap_key = 'ping.conf' items = DeploymentVolumeItem.new(api, ns, deploy, volume... | def sync!(desired)
# Ensure that the telegraf.conf item is always mounted
items = [
{
key: 'telegraf.conf',
path: 'telegraf.conf'
},
desired
].sort_by { |item| item[:path] }
cm_volume = {
name: @volume,
configMap: {
name: @co... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sync_config\n return unless config.config_files\n upload_files(config.config_files, release_path.join('config'))\n end",
"def sync(deploy = {})\n extraconfig = []\n device_change = []\n sync_opt = nil\n\n # Disk are only synced with :all ... | [
"0.5246843",
"0.5026395",
"0.49823868",
"0.4967586",
"0.49231645",
"0.4922401",
"0.49007204",
"0.48837677",
"0.48187003",
"0.48111975",
"0.47514057",
"0.47045586",
"0.46703756",
"0.46078727",
"0.46052244",
"0.45235568",
"0.45126316",
"0.44853312",
"0.44717643",
"0.44653144",
... | 0.61075395 | 0 |
Fetch and set the current deployment volume item | def fetch!
cm = @api.api('apps/v1').resource('deployments', namespace: @ns).get(@deployment)
volume = cm.spec.template.spec.volumes.map(&:to_h).find { |h| h[:name] == @volume }
items = volume.dig(:configMap, :items) || []
@_current = items.find { |item| item[:key] == @key }
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_volume\n @volume = services.block_storage.get_volume(params[:id])\n end",
"def set_actual_volume\n @actual_volume = ActualVolume.find(params[:id])\n end",
"def set_volume\n @volume = Volume.find(params[:id])\n end",
"def set_volume\n @volume = Volume.find(params[:id])\n ... | [
"0.65050125",
"0.64919734",
"0.6094535",
"0.6094535",
"0.6050955",
"0.58868134",
"0.5829944",
"0.5817884",
"0.5804211",
"0.5760362",
"0.5736933",
"0.5727875",
"0.56865925",
"0.56837225",
"0.5658759",
"0.56359845",
"0.56312865",
"0.5624862",
"0.5623747",
"0.5598997",
"0.555672... | 0.68126994 | 0 |
GET /estate_maps GET /estate_maps.json | def index
@estate_maps = EstateMap.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @estate = Estate.find(params[:id])\n @json = @estate.to_gmaps4rails\n respond_with(@estate)\n \n end",
"def index\n @estates = Estate.all\n @json = @estates.to_gmaps4rails\n respond_with(@estates)\n \n end",
"def index\n @map = Map.find(params[:map_id])\n if @map.kind... | [
"0.7247639",
"0.72285974",
"0.70276606",
"0.69009054",
"0.6686956",
"0.6669282",
"0.6644719",
"0.6639099",
"0.6636885",
"0.6636885",
"0.66257226",
"0.66160953",
"0.6582888",
"0.6550575",
"0.6527658",
"0.6514354",
"0.6502179",
"0.6446928",
"0.64056206",
"0.6351782",
"0.6342478... | 0.76822895 | 0 |
GET /estate_maps/1 GET /estate_maps/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @estate_maps = EstateMap.all\n end",
"def show\n @estate = Estate.find(params[:id])\n @json = @estate.to_gmaps4rails\n respond_with(@estate)\n \n end",
"def index\n @estates = Estate.all\n @json = @estates.to_gmaps4rails\n respond_with(@estates)\n \n end",
"def index... | [
"0.74606854",
"0.72709924",
"0.70318",
"0.70105314",
"0.6929811",
"0.69190395",
"0.69190395",
"0.6915701",
"0.68311334",
"0.6742102",
"0.6699397",
"0.66991144",
"0.66916764",
"0.66545796",
"0.65630186",
"0.65532213",
"0.65187097",
"0.65134096",
"0.6491114",
"0.64679325",
"0.6... | 0.0 | -1 |
POST /estate_maps POST /estate_maps.json | def create
@estate_map = EstateMap.new(estate_map_params)
respond_to do |format|
if @estate_map.save
format.html { redirect_to @estate_map, notice: 'Estate map was successfully created.' }
format.json { render :show, status: :created, location: @estate_map }
else
format.html... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @map = Map.new(map_params)\n\n respond_to do |format|\n if @map.save\n format.html { redirect_to maps_url }\n format.json { head :no_content }\n else\n format.html { redirect_to maps_url }\n format.json { render json: @map.errors, status: :unprocessable_enti... | [
"0.66776395",
"0.65997225",
"0.6577268",
"0.65048486",
"0.6493322",
"0.6413862",
"0.64082575",
"0.6399853",
"0.636634",
"0.6354511",
"0.6327593",
"0.62711275",
"0.62555856",
"0.62525284",
"0.6225352",
"0.617142",
"0.6166281",
"0.61534494",
"0.61472106",
"0.61371183",
"0.61223... | 0.76566714 | 0 |
PATCH/PUT /estate_maps/1 PATCH/PUT /estate_maps/1.json | def update
respond_to do |format|
if @estate_map.update(estate_map_params)
format.html { redirect_to @estate_map, notice: 'Estate map was successfully updated.' }
format.json { render :show, status: :ok, location: @estate_map }
else
format.html { render :edit }
format.jso... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n get_map\n\n respond_to do |format|\n if @map.update_attributes(params[:map])\n format.html { redirect_to @map, notice: 'Map was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { rende... | [
"0.6841554",
"0.6816522",
"0.6747521",
"0.6624113",
"0.6576149",
"0.65681225",
"0.6563984",
"0.654371",
"0.6467585",
"0.6460798",
"0.64336574",
"0.64094836",
"0.6407671",
"0.6362653",
"0.6332293",
"0.63257027",
"0.63237834",
"0.6314493",
"0.6310701",
"0.63063604",
"0.630131",... | 0.73558646 | 0 |
DELETE /estate_maps/1 DELETE /estate_maps/1.json | def destroy
@estate_map.destroy
respond_to do |format|
format.html { redirect_to estate_maps_url, notice: 'Estate map was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @map.destroy\n\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"def destroy\n get_map\n @map.destroy\n\n respond_to do |format|\n format.html { redirect_to maps_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n ... | [
"0.74241763",
"0.73438156",
"0.7317218",
"0.73107064",
"0.73107064",
"0.73107064",
"0.72230405",
"0.7173614",
"0.71456593",
"0.70690554",
"0.7059893",
"0.70573866",
"0.70521545",
"0.70503235",
"0.7039176",
"0.7032028",
"0.70318997",
"0.7006183",
"0.6986432",
"0.69750535",
"0.... | 0.77090883 | 0 |
Use callbacks to share common setup or constraints between actions. | def set_estate_map
@estate_map = EstateMap.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_... | [
"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.0 | -1 |
Never trust parameters from the scary internet, only allow the white list through. | def estate_map_params
params.require(:estate_map).permit(:EstateID)
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... | [
"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.0 | -1 |
Loads and returns the resource pointed to by +href+. The returned resource will be blessed into its "proper" class, if +self.class.namespace != nil+. | def get
execute_request('GET') do |uri, headers|
HTTP.http_client.get(
uri,
follow_redirect: true,
header: headers
)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def uri\n @uri ||= if @href then\n begin\n URI.parse @href\n rescue URI::InvalidURIError\n begin\n URI.parse(Addressable::URI.escape(@href))\n rescue Addressable::URI::InvalidURIError\n raise URI::Inv... | [
"0.57823724",
"0.5660902",
"0.55181396",
"0.53470594",
"0.5253644",
"0.5173033",
"0.51605",
"0.51412004",
"0.5123295",
"0.51198107",
"0.50802666",
"0.50566995",
"0.5011185",
"0.49861145",
"0.49761203",
"0.49549443",
"0.49521533",
"0.4891173",
"0.48888862",
"0.48708954",
"0.48... | 0.0 | -1 |
By default, calls +post+ with the given arguments. Override to change this behavior. | def create(*args)
post(*args)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def post(*args)\n execute(:post, *args)\n end",
"def post(*args, &block)\n map_method(:post, args, &block)\n end",
"def post(*args, &block); end",
"def post(*args)\n request :post, *args\n end",
"def post(*args)\n request(:post, *args)\n end",
"def post(*args)\n ... | [
"0.8539335",
"0.8118961",
"0.8012813",
"0.8003426",
"0.7998969",
"0.7909862",
"0.76435095",
"0.7578881",
"0.75255156",
"0.75226605",
"0.75028455",
"0.74775684",
"0.73549974",
"0.7313169",
"0.7256608",
"0.7142784",
"0.7113197",
"0.6967181",
"0.6917487",
"0.690304",
"0.6835413"... | 0.67622715 | 27 |
POSTs the given attributes to this resource's href, and returns the response resource. | def post(attrs = nil)
attrs ||= attributes
execute_request('POST') do |uri, headers|
HTTP.http_client.post(
uri,
body: adapter.serialize(attrs),
header: headers.merge(CONTENT_TYPE_HEADERS)
)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def post(attributes, header = {})\n return new(attributes) if ApiKits.config.mock\n url = \"#{ApiKits.config.api_uri}#{self.resource_path}\"\n response = ApiKits::Dispatcher.post(url, { self.root_node.to_sym => attributes }, header)\n build(response, url)\n end",
"def post\n resource.... | [
"0.6335614",
"0.6164808",
"0.5933781",
"0.58792317",
"0.58701414",
"0.5869296",
"0.585542",
"0.5825307",
"0.57770604",
"0.5754397",
"0.5741388",
"0.5682404",
"0.56015015",
"0.5532165",
"0.552478",
"0.55127746",
"0.55125225",
"0.5508098",
"0.542763",
"0.5413253",
"0.5410021",
... | 0.5600307 | 13 |
By default, calls +put+ with the given arguments. Override to change this behavior. | def update(*args)
put(*args)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def put(*args)\n execute(:put, *args)\n end",
"def put(*args, &block)\n map_method(:put, args, &block)\n end",
"def put(*args, &block); end",
"def put(path, **args); end",
"def put(*args)\n request(:put, *args)\n end",
"def put(*args)\n request :put, *args\n end",
... | [
"0.8162347",
"0.8102213",
"0.77828544",
"0.7622887",
"0.7561257",
"0.7489252",
"0.7324486",
"0.7293989",
"0.71647394",
"0.71391296",
"0.7089725",
"0.70717686",
"0.70188975",
"0.6940081",
"0.6825094",
"0.6799438",
"0.6687945",
"0.6646751",
"0.6558103",
"0.65578115",
"0.6557811... | 0.6685694 | 18 |
PUTs this resource's attributes to this resource's href, and returns the response resource. If attributes are given, +put+ uses those instead. | def put(attrs = nil)
attrs ||= attributes
execute_request('PUT') do |uri, headers|
HTTP.http_client.put(
uri,
body: adapter.serialize(attrs),
header: headers.merge(CONTENT_TYPE_HEADERS)
)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update(attributes = {})\n set_all(attributes)\n ensure_client && ensure_uri\n response = @client.rest_put(@data['uri'], { 'Accept-Language' => 'en_US', 'body' => @data }, @api_version)\n @client.response_handler(response)\n self\n end",
"def update(attributes = {})\n ... | [
"0.64882064",
"0.6469099",
"0.6423827",
"0.63472545",
"0.63081014",
"0.6252576",
"0.6176417",
"0.6167486",
"0.6141043",
"0.60985094",
"0.6097664",
"0.59649485",
"0.5877676",
"0.5836202",
"0.5825436",
"0.5825032",
"0.5787517",
"0.57548594",
"0.571797",
"0.57130486",
"0.5686828... | 0.61612546 | 8 |
PATCHes this resource's changed attributes to this resource's href, and returns the response resource. If attributes are given, +patch+ uses those instead. | def patch(attrs = nil)
attrs ||= attributes.changed_attributes
execute_request('PATCH') do |uri, headers|
HTTP.http_client.patch(
uri,
body: adapter.serialize(attrs),
header: headers.merge(CONTENT_TYPE_HEADERS)
)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def patch_resource(payload)\n execute(resource_path, method: :patch, payload: payload.to_json)\n end",
"def update(attributes = {})\n set_all(attributes)\n ensure_client && ensure_uri\n response = @client.rest_put(@data['uri'], { 'Accept-Language' => 'en_US', 'body' => @data }, @... | [
"0.65413636",
"0.6524317",
"0.6468689",
"0.6464266",
"0.62318105",
"0.62026453",
"0.62026453",
"0.6177255",
"0.61129737",
"0.610248",
"0.60893863",
"0.60214204",
"0.6003641",
"0.5975037",
"0.5922737",
"0.5872406",
"0.5852594",
"0.5840236",
"0.5820538",
"0.5808353",
"0.5790742... | 0.6749765 | 0 |
DELETEs this resource's href, and returns the response resource. | def delete
execute_request('DELETE') do |uri, headers|
HTTP.http_client.delete(uri, header: headers)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete!\n connection.delete(\n path: resource_path,\n status: 204\n ).data\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 ... | [
"0.76157093",
"0.73861855",
"0.73861855",
"0.73161477",
"0.73161477",
"0.72777486",
"0.7268185",
"0.7170953",
"0.7086113",
"0.70682335",
"0.70682335",
"0.70574194",
"0.70046943",
"0.6974811",
"0.6938748",
"0.68997604",
"0.68992496",
"0.6888408",
"0.6888408",
"0.68837625",
"0.... | 0.6851784 | 22 |
GET /events GET /events.json | def index
@events = Event.all
file_names = Dir.glob('config/*.yml')
exist = false
file_names.each do |file_name|
exist = true if(file_name == 'config/settings.local.yml')
end
holiday(params[:start], params[:end]) if !params[:start].nil? && !params[:end].nil? && exist
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def events\n response = self.class.get('/v1/events.json')\n response.code == 200 ? JSON.parse(response.body) : nil\n end",
"def get_events\n Resources::Event.parse(request(:get, \"Events\"))\n end",
"def get_events()\n @client.make_request(:get, @client.concat_user_path(\"#{CALL_PATH}... | [
"0.8337294",
"0.82393",
"0.7943906",
"0.7928331",
"0.77682066",
"0.77408546",
"0.76701826",
"0.7665501",
"0.76581633",
"0.7642472",
"0.76212007",
"0.7615658",
"0.7615658",
"0.7612881",
"0.75687",
"0.7522498",
"0.7488667",
"0.74813455",
"0.74698067",
"0.7441679",
"0.74408287",... | 0.0 | -1 |
GET /events/1 GET /events/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @event = Event.find(params[:id])\n render json: @event\n end",
"def get(event_id)\n @client.request \"events/#{event_id}\"\n end",
"def show\n event_id = params[:id]\n if event_id.present?\n @event = Com::Nbos::Events::Event.active_events.where(id: event_id, tenant_id: @use... | [
"0.75029767",
"0.74019474",
"0.7361382",
"0.7348975",
"0.73475033",
"0.7338018",
"0.7317425",
"0.72875094",
"0.72813755",
"0.7246173",
"0.72317284",
"0.7219172",
"0.7219172",
"0.7218839",
"0.7218839",
"0.721464",
"0.7204848",
"0.71989256",
"0.7196662",
"0.71925515",
"0.719221... | 0.0 | -1 |
POST /events POST /events.json | def create
@event = Event.new(event_params)
respond_to do |format|
if @event.save
format.html { redirect_to :controller => 'calendar', :action => 'index' }
else
format.html { render :new }
format.json { render json: @event.errors, status: :unprocessable_entity }
end
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_event event, data={}\n data[:event] = event\n post '/event', data\n end",
"def create\n event = Event.new(event_params)\n event.save!\n render json: event\n end",
"def create\n Rails.logger.debug(\"Received event #{params[:event]}\")\n head :ok\n end",
"def crea... | [
"0.7714071",
"0.7611226",
"0.76028967",
"0.7541319",
"0.7444731",
"0.73206913",
"0.73138195",
"0.728203",
"0.7251226",
"0.7235907",
"0.7235907",
"0.7215051",
"0.71682763",
"0.7150409",
"0.7126664",
"0.7118896",
"0.7117831",
"0.71162695",
"0.70964044",
"0.70907074",
"0.7083036... | 0.0 | -1 |
PATCH/PUT /events/1 PATCH/PUT /events/1.json | def update
respond_to do |format|
if @event.update(event_params)
format.html { redirect_to @event, notice: 'Event was successfully updated.' }
format.json { render :show, status: :ok, location: @event }
else
format.html { render :edit }
format.json { render json: @event.e... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def patch_event\n user_id = params[\"user_id\"]\n group_id = params[\"group_id\"]\n event_id = params[\"event_id\"]\n\n #TODO Handle 404 if event not found\n event = Event.find(event_id)\n\n json_body = JSON.parse(request.body.read)\n\n @@event_service.patch_event(j... | [
"0.75299805",
"0.7372486",
"0.71766764",
"0.7172103",
"0.7170955",
"0.71424884",
"0.70959055",
"0.7082709",
"0.7082709",
"0.7057662",
"0.70209146",
"0.6989379",
"0.69825095",
"0.69775003",
"0.69601995",
"0.6954494",
"0.6954494",
"0.6951992",
"0.692109",
"0.692109",
"0.692109"... | 0.0 | -1 |
DELETE /events/1 DELETE /events/1.json | def destroy
@event.destroy
respond_to do |format|
format.html { redirect_to events_url, notice: 'Event was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @event = Event.using(:shard_one).find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @event.destroy\n respond_to do |format|\n format.json { head :no_... | [
"0.76929694",
"0.7688217",
"0.7688217",
"0.7688217",
"0.7681325",
"0.7585923",
"0.75685203",
"0.7560765",
"0.7541314",
"0.75410026",
"0.75410026",
"0.75410026",
"0.75410026",
"0.75410026",
"0.75410026",
"0.75410026",
"0.75410026",
"0.75410026",
"0.75410026",
"0.75410026",
"0.... | 0.0 | -1 |
Use callbacks to share common setup or constraints between actions. | def set_event
@event = Event.find(params[:id]) if(Event.find_by_id(params[:id]) != nil)
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_... | [
"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.0 | -1 |
Never trust parameters from the scary internet, only allow the white list through. | def event_params
params.require(:event).permit(:title, :start, :end, :color, :allDay)
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... | [
"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.0 | -1 |
instance method return all memberships for this specific lifter | def memeberships
Membership.all.select do |memebership|
memebership.lifter == self
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def memberships\n # 1. get list of all memberships.\n\n # 2. select the ones that matches with current instancse of lifter.\n Membership.all.select do |member_object|\n if member_object.name == self\n member_object.name\n end\n end\n end",
"def member... | [
"0.7985923",
"0.79687625",
"0.791396",
"0.78664666",
"0.7857405",
"0.7809267",
"0.77937955",
"0.7606337",
"0.74174887",
"0.73836076",
"0.7293574",
"0.7170606",
"0.7170606",
"0.7166732",
"0.7159646",
"0.7081917",
"0.7063647",
"0.7057254",
"0.70344275",
"0.7030658",
"0.69998693... | 0.64579034 | 34 |
return the list of all gym that a specific lifter has memberships to | def gyms
self.memeberships.map do |memebership|
memebership.gym
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def gym_memberships\n Membership.all.select {|m| m.lifter == self}.map {|m| m.gym}\n end",
"def all_gyms\n lifter_membership.map {|lifter| lifter.gym}\n end",
"def all_gyms\n Membership.all.map do |membership| \n if membership.lifter == self\n membership.gym\n end\n end\n end",
... | [
"0.83345866",
"0.8142278",
"0.80337584",
"0.7880515",
"0.78661174",
"0.77800834",
"0.7779989",
"0.7760923",
"0.77235526",
"0.7642559",
"0.761407",
"0.761407",
"0.76115626",
"0.7610466",
"0.7610435",
"0.7603629",
"0.74889916",
"0.7437564",
"0.74365896",
"0.74019456",
"0.737729... | 0.6413608 | 42 |
return the cost of a specific lifter | def total_membership_cost
self.memeberships.map do |memebership|
memebership.cost
end.sum
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cost\r\n return @extra_cost + @basic_shifted.cost\r\n end",
"def cost\n\t\treturn @extra_cost + @real_shake.cost\n\tend",
"def cost\n cost = 0\n @solution.each { |route| cost += route.travel_time_and_cost[0] }\n return cost\n end",
"def cost\n deductible * RATE\n end",
"de... | [
"0.71007854",
"0.69990367",
"0.6624258",
"0.6549348",
"0.65334487",
"0.6498403",
"0.64777315",
"0.6426869",
"0.64253575",
"0.6403488",
"0.6401049",
"0.63787466",
"0.63679254",
"0.63679254",
"0.629682",
"0.6287275",
"0.6266133",
"0.62450254",
"0.6235116",
"0.6234333",
"0.62275... | 0.0 | -1 |
sign up for a new membership | def sign_up (gym, cost)
Membership.new(cost, gym, self)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def signup\n end",
"def signup\n end",
"def sign_up(gym, cost)\n Membership.new(self, gym, cost)\n\n end",
"def sign_up(gym, cost)\n Membership.new(self, gym, cost)\n end",
"def sign_up(cost,gym)\n Membership.new(self,gym,cost)\n end",
"def gym_sign_up(gym, membership_cost)\n Members... | [
"0.7513763",
"0.7513763",
"0.7451305",
"0.7366461",
"0.7241292",
"0.7200116",
"0.7122292",
"0.71082896",
"0.7010281",
"0.6970225",
"0.6933769",
"0.68873",
"0.6879172",
"0.6868517",
"0.68457276",
"0.6842171",
"0.6816496",
"0.67974526",
"0.67966866",
"0.67033964",
"0.66973436",... | 0.73526675 | 4 |
return the average lift total of all lifters | def lift_total
@@all.map do |lift|
lift.lift_total
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def average_lift_total\n num_of_lifters = Lifter.all.length \n total_lifter_num = 0 \n Lifter.all.each do |lifter_instance|\n total_lifter_num += lifter_instance.lift_total\n end\n average = total_lifter_num/num_of_lifters \n average\n end",
"def average\nlift_Average = @@all.map do |lyft... | [
"0.8564704",
"0.7914088",
"0.78338635",
"0.7698646",
"0.76906484",
"0.7595214",
"0.7593382",
"0.75651634",
"0.7450514",
"0.742769",
"0.72484136",
"0.7222317",
"0.7088583",
"0.7036078",
"0.6847907",
"0.6824365",
"0.6779688",
"0.6778334",
"0.6770855",
"0.67444646",
"0.670664",
... | 0.6939387 | 14 |
This fingerprinting routine will cause the structure base address to slide down 120 bytes. Subsequent fingerprints will not push this down any futher, however we need to make sure that fingerprint is always called before exploitation or the alignment will be way off. | def fprint
ret = [Exploit::CheckCode::Safe, '', '', '']
req = "\x00\x00\x00\x29\x00\x00\x78\x00\x00\x00\x00\x00"+
"\x00\x00\x00\x00\x00\x00\x00\x40\x00\x02\x00\x05"+
"\x00\x00\x00\x00\x60\x56\x02\x01\x00\x1F\x6E\x03"+
"\x00\x1F\x6E\x03\x08\xFE\x66\x03\x00"
connect
sock.put(req)
data = s... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fingerprint; end",
"def save_fingerprint; end",
"def update_fingerprint\n data = self.attributes.merge({endpoint: transaction_endpoint.name})\n write_attribute(:fingerprint, Transaction.fingerprint(data))\n end",
"def recompute_offsets()\n @header.resource_index.number_of_records = @records.len... | [
"0.54259515",
"0.51541597",
"0.51460946",
"0.51391774",
"0.5137436",
"0.5135033",
"0.5053903",
"0.502026",
"0.4955206",
"0.49545756",
"0.49021798",
"0.48667133",
"0.48582706",
"0.48487473",
"0.48350325",
"0.47958717",
"0.47711676",
"0.47709334",
"0.4747175",
"0.47023654",
"0.... | 0.0 | -1 |
def manager_can_default_actions [:show, :read].freeze super [:new, :create, :delete, :destroy] end | def admin_cannot_actions
[:new, :create].freeze
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_actions\n actions :all\n end",
"def admin\n\t\tcan :manage, :all\n\tend",
"def default_actions\n [\n Constants.TASK_ACTIONS.ADD_ADMIN_ACTION.to_h,\n Constants.TASK_ACTIONS.CANCEL_AND_RETURN_TASK.to_h\n ]\n end",
"def defined_actions\n\n controller.instance_m... | [
"0.7041416",
"0.684939",
"0.6671885",
"0.6663212",
"0.6632504",
"0.66096455",
"0.6598322",
"0.6592513",
"0.6589389",
"0.65834856",
"0.657688",
"0.6574994",
"0.65267086",
"0.65267086",
"0.65267086",
"0.650689",
"0.64847046",
"0.64588994",
"0.64422977",
"0.64422977",
"0.6417223... | 0.7568558 | 0 |
The Rack call interface. The receiver acts as a prototype and runs each request in a duplicate object, unless the +rack.run_once+ variable is set in the environment. | def call(env)
if env['rack.run_once']
call! env
else
clone.call! env
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def call(*args)\n if request = rack_request(*args)\n rack_response base_call(request: request)\n else\n base_call(*args)\n end\n end",
"def call(env)\n @request = Rack::Request.new(env)\n @params = @path_params.merge(@request.params.symbolize_keys)\n pro... | [
"0.6726511",
"0.6393524",
"0.6322877",
"0.6224793",
"0.6214515",
"0.61670953",
"0.6013528",
"0.60043114",
"0.59961766",
"0.59573823",
"0.59423757",
"0.5935915",
"0.5921953",
"0.5889135",
"0.58833057",
"0.5879075",
"0.5867398",
"0.58409625",
"0.5824122",
"0.58061725",
"0.58021... | 0.72104675 | 3 |
IOlike object that receives log, warning, and error messages; defaults to the rack.errors environment variable. | def errors
@errors || (@env && (@errors = @env['rack.errors'])) || STDERR
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def io\n @io || $stderr\n end",
"def error_io\n exit_code == -1 ? $stderr : $stdout\n end",
"def ioerr; end",
"def errors\n @env[ENV_WARDEN_ERRORS] ||= Errors.new\n end",
"def err(message, title=nil)\n Sinatra::Messages.error(\"#{get_env}#{message}\", title)\n end",
"def e... | [
"0.6449567",
"0.6283448",
"0.624947",
"0.59810627",
"0.5927857",
"0.5900253",
"0.58936495",
"0.5890302",
"0.5785741",
"0.5785741",
"0.5785741",
"0.5785741",
"0.57655257",
"0.5688381",
"0.5652707",
"0.5626612",
"0.559147",
"0.5566583",
"0.55523354",
"0.5532512",
"0.5522653",
... | 0.7282433 | 0 |
Set the output stream for log messages, warnings, and errors. | def errors=(ioish)
fail "stream must respond to :write" if ! ioish.respond_to?(:write)
@errors = ioish
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def stream=(stream)\n logger = Logger.new(stream)\n logger.level = @logger.level\n logger.formatter = @logger.formatter\n @logger = logger\n end",
"def set_output(log_device)\n __setobj__(Logger.new(log_device))\n end",
"def log_standard_outputs\n [STDOUT, STDERR].each do |out... | [
"0.6783061",
"0.67520493",
"0.6198485",
"0.6117742",
"0.60309494",
"0.5932744",
"0.59095937",
"0.58865905",
"0.5868156",
"0.5867783",
"0.583747",
"0.5830252",
"0.5830094",
"0.58070976",
"0.5772177",
"0.57525283",
"0.57331705",
"0.5696743",
"0.565669",
"0.565669",
"0.5644532",... | 0.5664615 | 18 |
The configured MetaStore instance. Changing the rackcache.metastore environment variable effects the result of this method immediately. | def metastore
uri = options['rack-cache.metastore']
storage.resolve_metastore_uri(uri)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setup_cache\n @caching_settings ||= {}\n @cache_tmpdir ||= Dir.mktmpdir(CACHE) unless @caching_settings[:metastore]\n @cache_meta = @caching_settings[:metastore] || ('file:' + @cache_tmpdir + '/meta')\n @cache_tmpdir ||= Dir.mktmpdir(CACHE) unless @caching_settings[:entitystore]\n @cac... | [
"0.6424982",
"0.6352583",
"0.6325856",
"0.61683846",
"0.6120281",
"0.59079605",
"0.5877557",
"0.58396626",
"0.57958",
"0.57784414",
"0.57758486",
"0.5732405",
"0.57182646",
"0.5714646",
"0.57140416",
"0.56617475",
"0.56606716",
"0.5602641",
"0.5575063",
"0.5571135",
"0.556364... | 0.76013523 | 0 |
The configured EntityStore instance. Changing the rackcache.entitystore environment variable effects the result of this method immediately. | def entitystore
uri = options['rack-cache.entitystore']
storage.resolve_entitystore_uri(uri)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cache_store\n return nil if context.environment.cache.nil?\n\n CacheStore.new context.environment\n end",
"def fetch_store\n @store ||= self.store || create_store!\n end",
"def store\n @store ||= storage.new self\n end",
"def store\n @cache.compute_if_absent(current_... | [
"0.6054104",
"0.5986785",
"0.57194364",
"0.5694784",
"0.5691667",
"0.56830686",
"0.56783676",
"0.56757516",
"0.56027853",
"0.56027853",
"0.5588582",
"0.55817693",
"0.5531382",
"0.55188376",
"0.5517974",
"0.5494856",
"0.5494856",
"0.5483486",
"0.54818034",
"0.5479059",
"0.5473... | 0.7585641 | 0 |
Write a log message to the errors stream. +level+ is a symbol such as :error, :warn, :info, or :trace. | def log(level, message=nil, *params)
errors.write("[cache] #{level}: #{message}\n" % params)
errors.flush
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def error_level=(level)\n\t\t\t@stderr_logger.level = level\n\t\tend",
"def error_level=(level)\n\t\t\t@stderr_logger.level = level\n\t\tend",
"def write(level, message)\n if Boxlet.debug?\n if message.is_a? String\n puts message\n else\n pp message\n end\n else... | [
"0.6968947",
"0.6968947",
"0.6849481",
"0.67420775",
"0.6583",
"0.6548029",
"0.65440726",
"0.65440726",
"0.650768",
"0.64591277",
"0.64241",
"0.6381651",
"0.6376457",
"0.6321604",
"0.63100487",
"0.63100487",
"0.6309118",
"0.6307058",
"0.625724",
"0.6236429",
"0.62008834",
"... | 0.6554973 | 5 |
Checks that the returned object is a PositionHandler | def test_block_verifier_is_a_block_verifier
assert @bv.is_a?(BlockVerifier)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def position?(value)\n value.respond_to?(:position) &&\n value.position.is_a?(Vedeu::Geometry::Position)\n end",
"def valid_position?\n unless position.present?\n errors[:cmd] ||= []\n errors[:cmd] << 'Robot current position is unknown for some reason'\n end\n er... | [
"0.62181515",
"0.57920426",
"0.57795125",
"0.57585627",
"0.56542444",
"0.55664897",
"0.55547106",
"0.553601",
"0.54296577",
"0.5375824",
"0.5375824",
"0.5347496",
"0.53249115",
"0.5247062",
"0.5237874",
"0.52360594",
"0.52193964",
"0.5177889",
"0.5174656",
"0.51666117",
"0.51... | 0.0 | -1 |
Tests that the an empty balances hash was initialized | def test_initialize
assert @bv.balances.is_a?(Hash)
assert @bv.balances.empty?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_create_an_empty_honeybadger_hash\n # create and empty hash with name honeybadger\n\n assert_equal ({}), honeybadger\n assert_equal true, honeybadger.empty?\n end",
"def test_Hash_InstanceMethods_empty?\n\t\tassert_equal(true, {}.empty?)\n\t\tassert_equal(false, {'b'=>1}.empty?)\n\tend",
"de... | [
"0.7247885",
"0.7037807",
"0.65794617",
"0.65510213",
"0.65399635",
"0.65009665",
"0.6434707",
"0.6434707",
"0.6434707",
"0.6374719",
"0.6373753",
"0.6309352",
"0.6309352",
"0.6301975",
"0.6289472",
"0.6269149",
"0.62021154",
"0.6189628",
"0.6082366",
"0.60280126",
"0.6027165... | 0.7996393 | 0 |
UNIT TESTs FOR METHOD block_count_correct(x,y) Equivalence classes: x >= 0 and y.count == 5 > return true x >= 0 and y.count != 5 > print message and return false Tests if the block count is correct Returns true if the count == 5 | def test_block_count_correct_true
assert @bv.block_count_correct?(1, [1,2,3,4,5])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_block_count_correct_false\n assert_equal(false, @bv.block_count_correct?(1, [1,2,3,4]))\n end",
"def test_check_block_num_equal\r\n assert_equal true, @g.check_block_num(1, 1)\r\n end",
"def test_block_number_correct_true\n assert @bv.block_number_correct?(1, 1)\n end",
"def test_block... | [
"0.8232098",
"0.7590504",
"0.7415733",
"0.70647085",
"0.689947",
"0.66073084",
"0.6569114",
"0.6536695",
"0.645847",
"0.6439367",
"0.63187146",
"0.6311842",
"0.6270875",
"0.6222196",
"0.61462736",
"0.6039827",
"0.6016441",
"0.6004144",
"0.59678596",
"0.59623295",
"0.5944626",... | 0.83276296 | 0 |
Returns false if the count != 5 | def test_block_count_correct_false
assert_equal(false, @bv.block_count_correct?(1, [1,2,3,4]))
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def count_ok?\n\t\tcount <= 5\n\tend",
"def berzerk?\n @woot_count >= 5\n end",
"def has5?(a)\n return 5<=a.size\nend",
"def full?\n users.count.eql? 5\n end",
"def discount5\n\t\tif @number_items>=5\n\t\t\treturn true\n\t\telse\n\t\t\treturn false\n\t\tend\n\tend",
"def check_user_idea_coun... | [
"0.84920555",
"0.74338096",
"0.74232066",
"0.7178468",
"0.7022458",
"0.69922537",
"0.6986203",
"0.69349706",
"0.6791477",
"0.6771467",
"0.6703313",
"0.66794",
"0.6649871",
"0.664689",
"0.6644862",
"0.6637076",
"0.6598591",
"0.65231746",
"0.65037817",
"0.64881474",
"0.64597034... | 0.6258464 | 31 |
UNIT TESTs FOR METHOD block_number_correct(x,y) Equivalence classes: x >= 0 and y = x > return true x >= 0 and y != x > print message and return false Tests if the current block number equals the expected block number Returns true if they match | def test_block_number_correct_true
assert @bv.block_number_correct?(1, 1)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_block_number_correct_false\n assert_equal(false, @bv.block_number_correct?(0, 1))\n end",
"def test_check_block_num_equal\r\n assert_equal true, @g.check_block_num(1, 1)\r\n end",
"def test_check_block_num_unequal\r\n assert_nil nil, @g.check_block_num(1, 0)\r\n end",
"def test_block_cou... | [
"0.8061629",
"0.7945756",
"0.7327642",
"0.7236902",
"0.71862704",
"0.71278244",
"0.7013688",
"0.6934874",
"0.6803227",
"0.6750381",
"0.67071754",
"0.6519623",
"0.6512271",
"0.6382669",
"0.63354117",
"0.6327517",
"0.63221705",
"0.6266504",
"0.6261206",
"0.6095436",
"0.6028317"... | 0.81732565 | 0 |
Returns false if they do not match | def test_block_number_correct_false
assert_equal(false, @bv.block_number_correct?(0, 1))
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def match?\n false\n end",
"def reactive_pair?(a, b)\n (a.ord - b.ord).abs == MATCH_DIFF\n end",
"def pass?\n expected_array.size == actual_array.size &&\n [expected_array, actual_array].transpose.all? do |expected_element, actual_value|\n expected_element.match_against_actua... | [
"0.7039937",
"0.6890884",
"0.68589437",
"0.68163615",
"0.66947275",
"0.6665359",
"0.6599592",
"0.65481436",
"0.65407145",
"0.652657",
"0.65158755",
"0.65019333",
"0.64779186",
"0.6398796",
"0.6352518",
"0.63334674",
"0.63251835",
"0.6311721",
"0.6310732",
"0.6269914",
"0.6261... | 0.0 | -1 |
UNIT TESTs FOR METHOD prev_hash_correct(x,y,z) Equivalence classes: y == String and z = y > return true y == String and z != y > print message and return false Tests if the current previous hash equals the expected previous hash Returns true if they match | def test_prev_hash_correct_true
assert @bv.prev_hash_correct?(0, "abcd", "abcd")
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_prev_hash_correct_false\n assert_equal(false, @bv.prev_hash_correct?(0, \"abcd\", \"efgh\"))\n end",
"def test_previous_hash_equal\r\n block_checker = Minitest::Mock.new('test_block_checker')\r\n def block_checker.check_hex(string); true; end\r\n def block_checker.check_hash(actual, stored)... | [
"0.80106777",
"0.74224395",
"0.7417352",
"0.7326249",
"0.72881407",
"0.69010425",
"0.68504983",
"0.6835617",
"0.68353033",
"0.6804265",
"0.68025947",
"0.6788918",
"0.67589027",
"0.67463815",
"0.67185783",
"0.6695785",
"0.66618943",
"0.66327024",
"0.6587469",
"0.6534594",
"0.6... | 0.8026025 | 0 |
Returns false if they do not match | def test_prev_hash_correct_false
assert_equal(false, @bv.prev_hash_correct?(0, "abcd", "efgh"))
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def match?\n false\n end",
"def reactive_pair?(a, b)\n (a.ord - b.ord).abs == MATCH_DIFF\n end",
"def pass?\n expected_array.size == actual_array.size &&\n [expected_array, actual_array].transpose.all? do |expected_element, actual_value|\n expected_element.match_against_actua... | [
"0.7039937",
"0.6890884",
"0.68589437",
"0.68163615",
"0.66947275",
"0.6665359",
"0.6599592",
"0.65481436",
"0.65407145",
"0.652657",
"0.65158755",
"0.65019333",
"0.64779186",
"0.6398796",
"0.6352518",
"0.63334674",
"0.63251835",
"0.6311721",
"0.6310732",
"0.6269914",
"0.6261... | 0.0 | -1 |
UNIT TESTs FOR METHOD num_transactions_correct(x,y) Equivalence classes: x == 0 and y.count == 1 > return true x == 0 and y.count != 1 print message and return false x > 0 and y.count > 0 > return true x > 0 and y.count == 0 > print message and return false Tests if the amount of individual transactions if correct for ... | def test_num_transactions_correct_0_true
assert @bv.num_transactions_correct(0, [0])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_num_transactions_correct_0_true\n assert_equal(false, @bv.num_transactions_correct?(0, [0,1]))\n end",
"def test_num_transactions_correct_not_0_true\n assert @bv.num_transactions_correct?(1, [0,2,3])\n end",
"def test_num_transactions_correct_false_not_0_false\n assert_equal(false, @bv.num_... | [
"0.7804623",
"0.765273",
"0.74003834",
"0.7241576",
"0.7208825",
"0.69343054",
"0.6858764",
"0.6854747",
"0.6750887",
"0.6638767",
"0.65261614",
"0.65023726",
"0.64114225",
"0.63978827",
"0.63960576",
"0.6359326",
"0.6320653",
"0.62420756",
"0.6235909",
"0.62297344",
"0.62046... | 0.7669643 | 1 |
Returns false if block is 0 and transactions != 1 | def test_num_transactions_correct_0_true
assert_equal(false, @bv.num_transactions_correct?(0, [0,1]))
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def verify_transactions\r\n raise \"Line #{total_block_number}: transaction resulted in a negative\" if Transaction.negatives?\r\n\r\n true\r\n end",
"def virgin?\n self.transactions.empty?\n end",
"def check_valid_transactions\n transactions_split = []\n i = 0\n while i < @blocks.count\n ... | [
"0.8192625",
"0.7468561",
"0.7435234",
"0.70832944",
"0.70233554",
"0.6903869",
"0.68136734",
"0.6793924",
"0.67895985",
"0.67670375",
"0.66242003",
"0.66140634",
"0.65953827",
"0.65918523",
"0.65589833",
"0.65474623",
"0.6515542",
"0.6503987",
"0.65000856",
"0.64855635",
"0.... | 0.69345367 | 5 |
For any other block number it must have >0 transactions Returns true if it does | def test_num_transactions_correct_not_0_true
assert @bv.num_transactions_correct?(1, [0,2,3])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def verify_transactions\r\n raise \"Line #{total_block_number}: transaction resulted in a negative\" if Transaction.negatives?\r\n\r\n true\r\n end",
"def check_valid_transactions\n transactions_split = []\n i = 0\n while i < @blocks.count\n # Splits and counts how many transactions there ar... | [
"0.765676",
"0.740378",
"0.70519215",
"0.70482725",
"0.6865559",
"0.68387437",
"0.6811478",
"0.6780793",
"0.6584146",
"0.6478716",
"0.6455413",
"0.6414442",
"0.63931155",
"0.63799965",
"0.6290647",
"0.6290234",
"0.6285389",
"0.6278612",
"0.62561136",
"0.6244276",
"0.622675",
... | 0.6488759 | 9 |
Returns false if there are no transactions | def test_num_transactions_correct_false_not_0_false
assert_equal(false, @bv.num_transactions_correct?(0, []))
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def virgin?\n self.transactions.empty?\n end",
"def has_transaction?\r\n !transaction_id.blank?\r\n end",
"def has_transactions?\n queue.any?\n end",
"def within_transaction?\n !current_transaction.nil?\n end",
"def within_transaction?\n !current_transaction.nil?\n ... | [
"0.81329876",
"0.81027603",
"0.80472714",
"0.79819244",
"0.78962886",
"0.7765052",
"0.7533867",
"0.7440846",
"0.7408962",
"0.7373919",
"0.7325108",
"0.72970515",
"0.7283023",
"0.72169363",
"0.71757257",
"0.71206325",
"0.7102927",
"0.70962125",
"0.7093536",
"0.70572484",
"0.70... | 0.6061387 | 61 |
UNIT TESTs FOR METHOD final_trans(x,y,z) Equivalence classes: y == z1 and x[0] == "SYSTEM" > return true y == z1 and x[0] != "SYSTEM" > print message and return false y != z1 and y return true Tests if the final transaction for a block is SYSTEM>TO_ADDR Returns true if so | def test_final_trans_true
assert @bv.final_trans?(["SYSTEM", "TO_ADDR", "46"], 3, 4)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_final_trans_not_final_trans\n assert @bv.final_trans?([\"FROM_ADDR\", \"TO_ADDR\", \"46\"], 2, 4)\n end",
"def test_final_trans_false\n assert_equal(false, @bv.final_trans?([\"FROM_ADDR\", \"TO_ADDR\", \"46\"], 3, 4))\n end",
"def test_transactions_not_system\r\n account_tracker = Minitest:... | [
"0.7731719",
"0.75521815",
"0.6461911",
"0.6446918",
"0.6359223",
"0.6290164",
"0.62699056",
"0.6110422",
"0.6098986",
"0.5992868",
"0.5971657",
"0.59580964",
"0.5924732",
"0.5863204",
"0.58302295",
"0.5819677",
"0.5808866",
"0.5807524",
"0.5793034",
"0.57702017",
"0.5746616"... | 0.79320735 | 0 |
Returns false if final transaction is anything else | def test_final_trans_false
assert_equal(false, @bv.final_trans?(["FROM_ADDR", "TO_ADDR", "46"], 3, 4))
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def within_transaction?\n !current_transaction.nil?\n end",
"def within_transaction?\n !current_transaction.nil?\n end",
"def in_transaction?\n _session&.in_transaction? || false\n end",
"def rollback_transaction?\n false\n end",
"def in_transaction?\n ... | [
"0.8015239",
"0.791889",
"0.7646997",
"0.7645657",
"0.75752",
"0.74552345",
"0.7379613",
"0.7369971",
"0.7357982",
"0.73240584",
"0.7309726",
"0.7288595",
"0.7287134",
"0.7239135",
"0.7145053",
"0.7130155",
"0.7128707",
"0.7119202",
"0.70559627",
"0.6951369",
"0.6949861",
"... | 0.6289394 | 71 |
Returns true if the transaction being tested is not the final one | def test_final_trans_not_final_trans
assert @bv.final_trans?(["FROM_ADDR", "TO_ADDR", "46"], 2, 4)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def within_transaction?\n !current_transaction.nil?\n end",
"def within_transaction?\n !current_transaction.nil?\n end",
"def rollback_transaction?\n false\n end",
"def virgin?\n self.transactions.empty?\n end",
"def failed?\n latest_transaction.failed? unless t... | [
"0.7542637",
"0.74694663",
"0.74430674",
"0.72859555",
"0.7217911",
"0.71840656",
"0.7075496",
"0.7063645",
"0.7014594",
"0.7013",
"0.69439065",
"0.68787944",
"0.6849115",
"0.68322754",
"0.67408085",
"0.6697244",
"0.6615646",
"0.6595315",
"0.6587348",
"0.65708625",
"0.6544156... | 0.62600243 | 38 |
UNIT TESTs FOR METHOD add_trasaction(x) Equivalence classes: x[0] or x[1] == New user balances > return current [x[0], x[1]] balances x[0] or x[1] == Existing user balances > return current [x[0], x[1]] balance Tests if the transactions are being added if the users do not have balances Returns the current balances for ... | def test_add_transaction_new_balances
assert_equal([-46, 46], @bv.add_trasaction(["FROM_ADDR", "TO_ADDR", "46"]))
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_add_transaction_existing_balances\n @bv.balances[\"FROM_ADDR\"] = 90\n @bv.balances[\"TO_ADDR\"] = 25\n assert_equal([44, 71], @bv.add_trasaction([\"FROM_ADDR\", \"TO_ADDR\", \"46\"]))\n end",
"def balance\n transactions.inject(:+)\n end",
"def add_amount_to(transactions, value) \n ... | [
"0.707847",
"0.6192674",
"0.61388606",
"0.60652053",
"0.599827",
"0.593389",
"0.59284073",
"0.59145045",
"0.58827835",
"0.5830827",
"0.58221436",
"0.5705032",
"0.56597304",
"0.56515485",
"0.5633322",
"0.562624",
"0.5617615",
"0.558254",
"0.5570263",
"0.55620986",
"0.5559252",... | 0.6805539 | 1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.