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 |
|---|---|---|---|---|---|---|
pull the children data criteria out of a set of preconditions | def extract_group_data_criteria_tree(conjunction, preconditions, type, parent_id)
children = []
preconditions.each do |precondition|
if (precondition.comparison?)
if (precondition.reference.id == HQMF::Document::MEASURE_PERIOD_ID)
children << measure_period_criteria
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def handle_preconditions(id_generator)\n # Nest multiple preconditions under a single root precondition\n @preconditions = @entry.xpath('./*/cda:precondition[not(@nullFlavor)]', HQMF2::Document::NAMESPACES)\n .collect do |pre|\n precondition = Precondition.parse(pre, @doc, id... | [
"0.5988411",
"0.5931404",
"0.5831462",
"0.5815192",
"0.5726317",
"0.57222396",
"0.5721646",
"0.57026654",
"0.5683599",
"0.5663575",
"0.55867195",
"0.554012",
"0.55324525",
"0.5521617",
"0.5519212",
"0.5510316",
"0.55065024",
"0.54812956",
"0.5478857",
"0.5478098",
"0.5478098"... | 0.6397039 | 0 |
this method creates V1 data criteria for the measurement period. These data criteria can be referenced properly within the restrictions | def create_measure_period_v1_data_criteria(doc,measure_period,v1_data_criteria_by_id)
attributes = doc[:attributes]
attributes.keys.each {|key| attributes[key.to_s] = attributes[key]}
measure_period_key = attributes['MEASUREMENT_PERIOD'][:id]
measure_start_key = attributes['MEASUREMENT_S... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_criteria\n parameters = params[:analysis] ? params[:analysis] : params\n criteria = { name: parameters[:name] }\n criteria[:collection] = parameters[:collection] if parameters[:collection].present?\n if parameters[:date_from].present?\n criteria[:attribute] = :date\n criteria[:value] ... | [
"0.5967572",
"0.5835231",
"0.5782021",
"0.5782021",
"0.57141113",
"0.5661995",
"0.55709654",
"0.5482097",
"0.54420584",
"0.5421056",
"0.5305653",
"0.527834",
"0.5271336",
"0.5240499",
"0.5232515",
"0.51993436",
"0.51601005",
"0.51544195",
"0.5145331",
"0.5116554",
"0.5114316"... | 0.76895666 | 0 |
Returns the zone in AXFR format. | def axfr_export_zone(server_id, zone_id, opts = {})
data, _status_code, _headers = axfr_export_zone_with_http_info(server_id, zone_id, opts)
data
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def zone\n strftime('%Z')\n end",
"def zone\n period.abbreviation\n end",
"def zone\n fetch('games.final_fantasy_xiv.zones')\n end",
"def zone_info\n @info.zones\n end",
"def axfr(zone)\n\t\tkey_opt = @key ? \"-k #{@key}\" : ''\n\t\treturning `dig #{key_opt} @#{@serv... | [
"0.6602191",
"0.63417953",
"0.63229257",
"0.62029743",
"0.6157255",
"0.6062643",
"0.60338104",
"0.5987932",
"0.59604216",
"0.59154314",
"0.59009314",
"0.59009314",
"0.5870869",
"0.5870869",
"0.5855183",
"0.5832555",
"0.57851034",
"0.57735795",
"0.5763109",
"0.573633",
"0.5701... | 0.49022776 | 84 |
Returns the zone in AXFR format. | def axfr_export_zone_with_http_info(server_id, zone_id, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: ZonesApi.axfr_export_zone ...'
end
# verify the required parameter 'server_id' is set
if @api_client.config.client_side_validation && server_id... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def zone\n strftime('%Z')\n end",
"def zone\n period.abbreviation\n end",
"def zone\n fetch('games.final_fantasy_xiv.zones')\n end",
"def zone_info\n @info.zones\n end",
"def axfr(zone)\n\t\tkey_opt = @key ? \"-k #{@key}\" : ''\n\t\treturning `dig #{key_opt} @#{@serv... | [
"0.6602191",
"0.63417953",
"0.63229257",
"0.62029743",
"0.6157255",
"0.6062643",
"0.60338104",
"0.5987932",
"0.59604216",
"0.59154314",
"0.59009314",
"0.59009314",
"0.5870869",
"0.5870869",
"0.5855183",
"0.5832555",
"0.57851034",
"0.57735795",
"0.5763109",
"0.573633",
"0.5701... | 0.0 | -1 |
Send a DNS NOTIFY to all slaves. Fails when zone kind is not Master or Slave, or master and slave are disabled in the configuration. Only works for Slave if renotify is on. Clients MUST NOT send a body. | def axfr_retrieve_zone(server_id, zone_id, opts = {})
axfr_retrieve_zone_with_http_info(server_id, zone_id, opts)
nil
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def notify_observers(*args)\n return unless changed?\n\n unwrap(connection).exec \"NOTIFY #{channel}, #{args}\"\n\n changed false\n end",
"def notify_zone(server_id, zone_id, opts = {})\n notify_zone_with_http_info(server_id, zone_id, opts)\n nil\n end",
"def notify\n ... | [
"0.55068815",
"0.54300976",
"0.54274255",
"0.5386323",
"0.52719194",
"0.5217797",
"0.5206146",
"0.51541644",
"0.5061161",
"0.5005842",
"0.49723345",
"0.49572045",
"0.49262062",
"0.49209508",
"0.49111345",
"0.49102062",
"0.490065",
"0.48738137",
"0.48706087",
"0.4821461",
"0.4... | 0.0 | -1 |
Send a DNS NOTIFY to all slaves. Fails when zone kind is not Master or Slave, or master and slave are disabled in the configuration. Only works for Slave if renotify is on. Clients MUST NOT send a body. | def axfr_retrieve_zone_with_http_info(server_id, zone_id, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: ZonesApi.axfr_retrieve_zone ...'
end
# verify the required parameter 'server_id' is set
if @api_client.config.client_side_validation && serve... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def notify_observers(*args)\n return unless changed?\n\n unwrap(connection).exec \"NOTIFY #{channel}, #{args}\"\n\n changed false\n end",
"def notify_zone(server_id, zone_id, opts = {})\n notify_zone_with_http_info(server_id, zone_id, opts)\n nil\n end",
"def notify\n ... | [
"0.55064976",
"0.5428681",
"0.54266",
"0.5386663",
"0.5272532",
"0.52168757",
"0.5206294",
"0.51546526",
"0.50620687",
"0.500609",
"0.49716547",
"0.49582714",
"0.49265265",
"0.49204832",
"0.49112862",
"0.4909745",
"0.49021855",
"0.48742917",
"0.4870624",
"0.48214668",
"0.4810... | 0.0 | -1 |
Deletes this zone, all attached metadata and rrsets. | def delete_zone(server_id, zone_id, opts = {})
delete_zone_with_http_info(server_id, zone_id, opts)
nil
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n Puppet.debug \"starting with destroy #{self.class.to_s}\"\n dns_service = get_dns_service(get_zone)\n if dns_service != nil\n dnszone = dns_service.get_zone(get_zone)\n \n dns_service.remove_zone(dnszone.id)\n end\n Puppet.debug \"done wit... | [
"0.71654993",
"0.6778753",
"0.6700406",
"0.6577938",
"0.64820933",
"0.64092624",
"0.6260306",
"0.62433475",
"0.6233076",
"0.61717474",
"0.61614305",
"0.61043876",
"0.60917616",
"0.60139436",
"0.59692603",
"0.59513354",
"0.58930725",
"0.5892053",
"0.5850893",
"0.5849925",
"0.5... | 0.0 | -1 |
Deletes this zone, all attached metadata and rrsets. | def delete_zone_with_http_info(server_id, zone_id, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: ZonesApi.delete_zone ...'
end
# verify the required parameter 'server_id' is set
if @api_client.config.client_side_validation && server_id.nil?
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n Puppet.debug \"starting with destroy #{self.class.to_s}\"\n dns_service = get_dns_service(get_zone)\n if dns_service != nil\n dnszone = dns_service.get_zone(get_zone)\n \n dns_service.remove_zone(dnszone.id)\n end\n Puppet.debug \"done wit... | [
"0.71654993",
"0.6778753",
"0.6700406",
"0.6577938",
"0.64820933",
"0.64092624",
"0.6260306",
"0.62433475",
"0.6233076",
"0.61717474",
"0.61614305",
"0.61043876",
"0.60917616",
"0.60139436",
"0.59692603",
"0.59513354",
"0.58930725",
"0.5892053",
"0.5850893",
"0.5849925",
"0.5... | 0.0 | -1 |
zone managed by a server | def list_zone(server_id, zone_id, opts = {})
data, _status_code, _headers = list_zone_with_http_info(server_id, zone_id, opts)
data
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def zone() end",
"def zone; end",
"def zone\n @zone\n end",
"def zone_identifier; end",
"def zone_identifier; end",
"def zone\n fetch('games.final_fantasy_xiv.zones')\n end",
"def zone_info\n @info.zones\n end",
"def current_zone\n return @zone\n end",
... | [
"0.7497363",
"0.73772615",
"0.7335927",
"0.6959754",
"0.6959754",
"0.6933401",
"0.6873258",
"0.67957485",
"0.6749222",
"0.66471845",
"0.6549456",
"0.6549456",
"0.6495824",
"0.6462087",
"0.6462087",
"0.6458615",
"0.6444615",
"0.64421",
"0.6413621",
"0.63885975",
"0.6379396",
... | 0.0 | -1 |
zone managed by a server | def list_zone_with_http_info(server_id, zone_id, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: ZonesApi.list_zone ...'
end
# verify the required parameter 'server_id' is set
if @api_client.config.client_side_validation && server_id.nil?
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def zone() end",
"def zone; end",
"def zone\n @zone\n end",
"def zone_identifier; end",
"def zone_identifier; end",
"def zone\n fetch('games.final_fantasy_xiv.zones')\n end",
"def zone_info\n @info.zones\n end",
"def current_zone\n return @zone\n end",
... | [
"0.7497363",
"0.73772615",
"0.7335927",
"0.6959754",
"0.6959754",
"0.6933401",
"0.6873258",
"0.67957485",
"0.6749222",
"0.66471845",
"0.6549456",
"0.6549456",
"0.6495824",
"0.6462087",
"0.6462087",
"0.6458615",
"0.6444615",
"0.64421",
"0.6413621",
"0.63885975",
"0.6379396",
... | 0.0 | -1 |
List all Zones in a server | def list_zones(server_id, opts = {})
data, _status_code, _headers = list_zones_with_http_info(server_id, opts)
data
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def list_zones\n request(\n :expects => 200,\n :method => 'GET',\n :parser => Fog::Parsers::DNS::Zerigo::ListZones.new,\n :path => '/api/1.1/zones.xml'\n )\n end",
"def get_zones\n request(\n :expects => 200,\n ... | [
"0.7378976",
"0.66667914",
"0.6357467",
"0.6357467",
"0.62640935",
"0.6259796",
"0.62554705",
"0.6237542",
"0.6223324",
"0.62202877",
"0.61837137",
"0.61541545",
"0.61142534",
"0.60893536",
"0.6060851",
"0.60431415",
"0.6037524",
"0.6031474",
"0.60141355",
"0.5974768",
"0.596... | 0.6133064 | 12 |
List all Zones in a server | def list_zones_with_http_info(server_id, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: ZonesApi.list_zones ...'
end
# verify the required parameter 'server_id' is set
if @api_client.config.client_side_validation && server_id.nil?
fail Ar... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def list_zones\n request(\n :expects => 200,\n :method => 'GET',\n :parser => Fog::Parsers::DNS::Zerigo::ListZones.new,\n :path => '/api/1.1/zones.xml'\n )\n end",
"def get_zones\n request(\n :expects => 200,\n ... | [
"0.7378976",
"0.66667914",
"0.6357467",
"0.6357467",
"0.62640935",
"0.6259796",
"0.62554705",
"0.6237542",
"0.6223324",
"0.62202877",
"0.61837137",
"0.61541545",
"0.6133064",
"0.61142534",
"0.60893536",
"0.6060851",
"0.60431415",
"0.6037524",
"0.6031474",
"0.60141355",
"0.597... | 0.5664747 | 56 |
Send a DNS NOTIFY to all slaves. Fails when zone kind is not Master or Slave, or master and slave are disabled in the configuration. Only works for Slave if renotify is on. Clients MUST NOT send a body. | def notify_zone(server_id, zone_id, opts = {})
notify_zone_with_http_info(server_id, zone_id, opts)
nil
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def notify_observers(*args)\n return unless changed?\n\n unwrap(connection).exec \"NOTIFY #{channel}, #{args}\"\n\n changed false\n end",
"def notify\n ### TO DO: Flatten the replication group deployment metadata structure. It is probably waaaaaaay too nested.\n if @co... | [
"0.55068815",
"0.54274255",
"0.5386323",
"0.52719194",
"0.5217797",
"0.5206146",
"0.51541644",
"0.5061161",
"0.5005842",
"0.49723345",
"0.49572045",
"0.49262062",
"0.49209508",
"0.49111345",
"0.49102062",
"0.490065",
"0.48738137",
"0.48706087",
"0.4821461",
"0.4810104",
"0.48... | 0.54300976 | 1 |
Send a DNS NOTIFY to all slaves. Fails when zone kind is not Master or Slave, or master and slave are disabled in the configuration. Only works for Slave if renotify is on. Clients MUST NOT send a body. | def notify_zone_with_http_info(server_id, zone_id, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: ZonesApi.notify_zone ...'
end
# verify the required parameter 'server_id' is set
if @api_client.config.client_side_validation && server_id.nil?
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def notify_observers(*args)\n return unless changed?\n\n unwrap(connection).exec \"NOTIFY #{channel}, #{args}\"\n\n changed false\n end",
"def notify_zone(server_id, zone_id, opts = {})\n notify_zone_with_http_info(server_id, zone_id, opts)\n nil\n end",
"def notify\n ... | [
"0.55064976",
"0.5428681",
"0.54266",
"0.5386663",
"0.5272532",
"0.52168757",
"0.5206294",
"0.51546526",
"0.50620687",
"0.500609",
"0.49716547",
"0.49582714",
"0.49265265",
"0.49204832",
"0.49112862",
"0.4909745",
"0.49021855",
"0.48742917",
"0.4870624",
"0.48214668",
"0.4810... | 0.0 | -1 |
Creates/modifies/deletes RRsets present in the payload and their comments. Returns 204 No Content on success. | def patch_zone(server_id, zone_id, zone_struct, opts = {})
patch_zone_with_http_info(server_id, zone_id, zone_struct, opts)
nil
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def make_modification\n cur_resp = ResponseSet.where(:user_id => current_user, :access_code => params[:protocol_id]).first\n mod = ResponseSet.create(:user_id=>current_user.id,\n :survey_id => params[:survey_id])\n mod.parent_id = params[:protocol_id]\n mod.save\n resp_set_i... | [
"0.51635635",
"0.50579345",
"0.5010883",
"0.5010883",
"0.49046355",
"0.4860087",
"0.4811291",
"0.47991884",
"0.47865835",
"0.47719198",
"0.47712442",
"0.47449645",
"0.46788147",
"0.46735832",
"0.4616409",
"0.4616409",
"0.4616409",
"0.45735177",
"0.45598143",
"0.45557097",
"0.... | 0.0 | -1 |
Creates/modifies/deletes RRsets present in the payload and their comments. Returns 204 No Content on success. | def patch_zone_with_http_info(server_id, zone_id, zone_struct, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: ZonesApi.patch_zone ...'
end
# verify the required parameter 'server_id' is set
if @api_client.config.client_side_validation && server_i... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def make_modification\n cur_resp = ResponseSet.where(:user_id => current_user, :access_code => params[:protocol_id]).first\n mod = ResponseSet.create(:user_id=>current_user.id,\n :survey_id => params[:survey_id])\n mod.parent_id = params[:protocol_id]\n mod.save\n resp_set_i... | [
"0.51635635",
"0.50579345",
"0.5010883",
"0.5010883",
"0.49046355",
"0.4860087",
"0.4811291",
"0.47991884",
"0.47865835",
"0.47719198",
"0.47712442",
"0.47449645",
"0.46788147",
"0.46735832",
"0.4616409",
"0.4616409",
"0.4616409",
"0.45735177",
"0.45598143",
"0.45557097",
"0.... | 0.0 | -1 |
Modifies basic zone data (metadata). Allowed fields in client body: all except id, url and name. Returns 204 No Content on success. | def put_zone(server_id, zone_id, zone_struct, opts = {})
put_zone_with_http_info(server_id, zone_id, zone_struct, opts)
nil
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def patch_zone_with_http_info(server_id, zone_id, zone_struct, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ZonesApi.patch_zone ...'\n end\n # verify the required parameter 'server_id' is set\n if @api_client.config.client_side_validation &... | [
"0.62837857",
"0.62543327",
"0.6178739",
"0.60269654",
"0.5796591",
"0.57243276",
"0.5701556",
"0.56655365",
"0.56521755",
"0.5570741",
"0.55289054",
"0.5464886",
"0.5427461",
"0.5419158",
"0.53975946",
"0.5380221",
"0.53416127",
"0.5299217",
"0.5279337",
"0.52576256",
"0.524... | 0.0 | -1 |
Modifies basic zone data (metadata). Allowed fields in client body: all except id, url and name. Returns 204 No Content on success. | def put_zone_with_http_info(server_id, zone_id, zone_struct, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: ZonesApi.put_zone ...'
end
# verify the required parameter 'server_id' is set
if @api_client.config.client_side_validation && server_id.ni... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def patch_zone_with_http_info(server_id, zone_id, zone_struct, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ZonesApi.patch_zone ...'\n end\n # verify the required parameter 'server_id' is set\n if @api_client.config.client_side_validation &... | [
"0.62829363",
"0.6178106",
"0.60264516",
"0.5796762",
"0.57241666",
"0.57006466",
"0.5665017",
"0.5650679",
"0.5571441",
"0.55278534",
"0.54657495",
"0.5426717",
"0.54182565",
"0.53974503",
"0.5378266",
"0.53403944",
"0.52980757",
"0.52779007",
"0.5256391",
"0.52432215",
"0.5... | 0.6253449 | 1 |
Rectify the zone data. This does not take into account the APIRECTIFY metadata. Fails on slave zones and zones that do not have DNSSEC. | def rectify_zone(server_id, zone_id, opts = {})
data, _status_code, _headers = rectify_zone_with_http_info(server_id, zone_id, opts)
data
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def rectify_zone_with_http_info(server_id, zone_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ZonesApi.rectify_zone ...'\n end\n # verify the required parameter 'server_id' is set\n if @api_client.config.client_side_validation && server_... | [
"0.6328306",
"0.57722944",
"0.56120765",
"0.5167219",
"0.5156847",
"0.4907511",
"0.4907511",
"0.48955747",
"0.4825676",
"0.4825676",
"0.48141387",
"0.47559738",
"0.47294152",
"0.47270972",
"0.4726333",
"0.47172368",
"0.46735924",
"0.46735924",
"0.4659557",
"0.4621927",
"0.461... | 0.6769124 | 0 |
Rectify the zone data. This does not take into account the APIRECTIFY metadata. Fails on slave zones and zones that do not have DNSSEC. | def rectify_zone_with_http_info(server_id, zone_id, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: ZonesApi.rectify_zone ...'
end
# verify the required parameter 'server_id' is set
if @api_client.config.client_side_validation && server_id.nil?
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def rectify_zone(server_id, zone_id, opts = {})\n data, _status_code, _headers = rectify_zone_with_http_info(server_id, zone_id, opts)\n data\n end",
"def zone_data\n @zone_data ||= ComplianceCheckerApi.clean_air_zones\n end",
"def clean_air_zones_data\n ComplianceCheckerApi.clean_air_zones... | [
"0.67686886",
"0.57726985",
"0.56118315",
"0.51661247",
"0.51566607",
"0.49062398",
"0.49062398",
"0.48945752",
"0.48250657",
"0.48250657",
"0.48127612",
"0.47543982",
"0.4729267",
"0.47262433",
"0.47259018",
"0.47161737",
"0.46722355",
"0.46722355",
"0.46585092",
"0.46195218",... | 0.6327752 | 1 |
So we can upload a photo via URL | def photo_from_url(url)
self.photo = URI.parse(url)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def photo_from_url(url)\n end",
"def upload_photo(file, params)\n url_str = BASE_URL + PHOTO_UPLOAD_ENDPOINT + \"?\"\n # build out url based on params of photo\n url_str = url_str + \"name=#{params['name']}&description=#{params['description']}&category=0&privacy=0\"\n\n url = URI.parse(url_str)\n ... | [
"0.74559456",
"0.73500764",
"0.717173",
"0.7153085",
"0.7118005",
"0.70522404",
"0.70059395",
"0.70059395",
"0.69840235",
"0.69710153",
"0.6939853",
"0.6868767",
"0.68163574",
"0.6774108",
"0.6763723",
"0.6758164",
"0.6718802",
"0.671815",
"0.66784877",
"0.6671088",
"0.666143... | 0.6939097 | 11 |
Provides view level support for printing out all the errors associated with the models you tell it. The DEFAULT_PARTIAL constant provides a simple, default, set of HTML for displaying the errors. If you wish to change this HTML there are two simple ways of doing it. First if you have a partial named: app/views/applicat... | def error_messages_for(object_names = [], view_partial = nil)
object_names = [object_names].flatten
app_errors = []
object_names.each do |name|
object = instance_variable_get("@#{name}")
if object
if object.respond_to?(:errors)
if object.errors.respo... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def error_messages_for(object)\n render(:partial => 'application/error_messages',\n :locals => {:object => object})\n end",
"def error_messages_for(object)\n render(:partial => \"application/error_messages\", :locals => {:object => object})\n end",
"def form_errors(model_obj)\n render pa... | [
"0.6486466",
"0.64474255",
"0.6284738",
"0.59605813",
"0.5917462",
"0.5869297",
"0.5849602",
"0.57363266",
"0.56865454",
"0.55203545",
"0.55019355",
"0.54639626",
"0.5435293",
"0.53684914",
"0.5363643",
"0.5309689",
"0.5296561",
"0.52614534",
"0.52240545",
"0.5221031",
"0.520... | 0.61977005 | 3 |
HACK: to map a MPQ that do not respond_to :content | def base_to_subjects(base, filename)
print "."
@lines << subject_to_csv_line(base, filename)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def content_methods; end",
"def content\n if @content.nil?\n @content = @message_impl.getContent\n\n # decode the content is necessary if it\n # has an encoded content type\n if [\"amqp/list\", \"amqp/map\"].include? @message_impl.getContentType\n @content = ... | [
"0.5834593",
"0.54814625",
"0.5433272",
"0.5433272",
"0.5433272",
"0.5433272",
"0.5433272",
"0.5433272",
"0.5433272",
"0.5433272",
"0.5433272",
"0.5433272",
"0.5433272",
"0.5433272",
"0.5433272",
"0.5433272",
"0.5329772",
"0.53143495",
"0.5302746",
"0.52332187",
"0.52332187",... | 0.0 | -1 |
Demonstrates a simple stack based algorithm for expanding a Path to a full Path . e.g. will expand to Return the full path given a composite path | def expandPath(url)
stack = []
urlTokens = url.split '/'
while urlTokens.count > 0
token = urlTokens.shift
next if token == '.'
if token == '..'
puts 'error: invalid path' and return if stack.count == 0
stack.pop
else
stack.push token
end
end
stack.join('/')
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def expand_path path\n path_segments, path_root = partition_path path\n if path.include? DOT_DOT\n resolved_segments = []\n path_segments.each do |segment|\n segment == DOT_DOT ? resolved_segments.pop : resolved_segments << segment\n end\n join_path resolved_segments, path_root\n ... | [
"0.7207498",
"0.70965654",
"0.6986126",
"0.6705524",
"0.66498256",
"0.66207796",
"0.650378",
"0.6485102",
"0.64218765",
"0.6421237",
"0.6389173",
"0.6360449",
"0.62336695",
"0.6225211",
"0.62179506",
"0.6213985",
"0.6211552",
"0.6195727",
"0.6188497",
"0.61875767",
"0.6157446... | 0.6663562 | 4 |
Strings representaion of provider's box | def provider_box
strings = []
strings << @document.provider_name
strings << @labels[:provider]
@document.provider_lines.split("\n").each do |line|
strings << line
end
strings << "#{@labels[:tax_id]}: #{@document.provider_tax_id}" \
unless @document.provider_tax_id.... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def inspect\n state_provider = \"[#{box_state} (#{provider})]\"\n \"#{name.ljust(max_length)} #{state_provider.ljust(max_length)} [VM OS <-- #{guest_os}]\"\n end",
"def element_box_string\n box = \"-\" * 14\n box += \"\\n|\" + \"#{@number}\".ljust(12) + \"|\"\n box += \"\\n|\" + \"#{@symbol... | [
"0.7458671",
"0.6628833",
"0.63081676",
"0.6302336",
"0.62584555",
"0.62356347",
"0.6226782",
"0.62147534",
"0.6170703",
"0.6117425",
"0.60976416",
"0.60885984",
"0.6063436",
"0.60435534",
"0.59873384",
"0.5968766",
"0.5960962",
"0.5942853",
"0.593033",
"0.5885358",
"0.585078... | 0.76040787 | 0 |
Strings representaion of purchaser's box | def purchaser_box
strings = []
strings << @document.purchaser_name
strings << @labels[:purchaser]
@document.purchaser_lines.split("\n").each do |line|
strings << line
end
strings << "#{@labels[:tax_id]}: #{@document.purchaser_tax_id}" \
unless @document.purchaser_t... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def element_box_string\n box = \"-\" * 14\n box += \"\\n|\" + \"#{@number}\".ljust(12) + \"|\"\n box += \"\\n|\" + \"#{@symbol}\".ljust(12) + \"|\"\n box += \"\\n|\" + \"#{@name}\".ljust(12) + \"|\"\n box += \"\\n|\" + \"#{@atomic_mass}\".ljust(12) + \"|\\n\"\n box += \"-\" * 14\n end",
"def b... | [
"0.6942338",
"0.67089593",
"0.6450219",
"0.64365536",
"0.6339225",
"0.6326188",
"0.6209087",
"0.6112576",
"0.6103081",
"0.59676266",
"0.5962142",
"0.59339076",
"0.59304535",
"0.58934623",
"0.5888115",
"0.58795106",
"0.5858813",
"0.58556974",
"0.58512497",
"0.58498836",
"0.584... | 0.76010454 | 0 |
Strings representaion of account's box | def account_box
strings = []
if @document.bank_account_number.nil?
strings << @labels[:payment_in_cash]
else
strings << @labels[:payment_by_transfer]
end
strings << "#{@labels[:account_number]}"
strings << @document.bank_account_number
strings << "#{@labels[:swi... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def element_box_string\n box = \"-\" * 14\n box += \"\\n|\" + \"#{@number}\".ljust(12) + \"|\"\n box += \"\\n|\" + \"#{@symbol}\".ljust(12) + \"|\"\n box += \"\\n|\" + \"#{@name}\".ljust(12) + \"|\"\n box += \"\\n|\" + \"#{@atomic_mass}\".ljust(12) + \"|\\n\"\n box += \"-\" * 14\n end",
"def p... | [
"0.6939714",
"0.6464319",
"0.6309872",
"0.6266019",
"0.62651783",
"0.6198005",
"0.6147975",
"0.6131625",
"0.60644954",
"0.6043292",
"0.6034567",
"0.60281456",
"0.5956859",
"0.5942608",
"0.5886632",
"0.5881265",
"0.58804",
"0.58406043",
"0.583726",
"0.57932186",
"0.576264",
... | 0.8322438 | 0 |
Strings representaion of dates box | def dates_box
strings = []
strings << "#{@labels[:issue_date]}"
strings << @document.issue_date
strings << "#{@labels[:due_date]}"
strings << @document.due_date
strings
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_s\n \"#{@date.to_s}: #{@text}\"\n end",
"def date_str d\n Util::date(d)\n end",
"def date_string\n times = []\n showtimes.all.each do |time|\n times << time.date_time\n end\n times = times.sort\n first_date = times.first.to_date.strftime('%m/%d')\n last_date ... | [
"0.6462693",
"0.64459676",
"0.641424",
"0.6413449",
"0.63576764",
"0.63261056",
"0.6304754",
"0.6279921",
"0.627463",
"0.6262681",
"0.6261269",
"0.62338495",
"0.6223701",
"0.6169384",
"0.6144235",
"0.6127829",
"0.6124052",
"0.60920477",
"0.6055131",
"0.6048584",
"0.6042294",
... | 0.7927963 | 0 |
Strings representaion of items table | def items_table
strings = []
strings << @labels[:item] if determine_items_structure[:names]
strings << @labels[:quantity] if determine_items_structure[:quantities]
strings << @labels[:unit] if determine_items_structure[:units]
strings << @labels[:price_per_item] if determine_items_structur... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_s\n\t\t\"#{@label}:#{@items.map { |x| x.to_s }.join(' ')}\"\n\tend",
"def to_str\n str = \"Id: \" + @id.to_s + \"\\nName: \" + @name.to_s + \"\\nItem(s): \\n\"\n @items.each do |item|\n str += \">\" + item.to_s + \" \\n\"\n end\n str\n end",
"def to_s\n # The widest item in the ta... | [
"0.7085714",
"0.6985781",
"0.6807167",
"0.6724211",
"0.6602726",
"0.64668",
"0.6385745",
"0.6366281",
"0.63151705",
"0.63151705",
"0.63123935",
"0.62930274",
"0.6292821",
"0.6255836",
"0.6253999",
"0.62446123",
"0.62430197",
"0.6207605",
"0.61727804",
"0.61727804",
"0.6166187... | 0.8515596 | 0 |
Strings representaion of totals table | def totals_table
strings = []
strings << "#{@labels[:subtotal]}:"
strings << @document.subtotal
strings << "#{@labels[:tax]}:"
strings << @document.tax
strings << "#{@labels[:tax2]}:"
strings << @document.tax2
strings << "#{@labels[:tax3]}:"
strings << @document.tax... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def spending_table(hash, total)\n puts \"\".center(80, \"_\")\n hash.each{ |item, value| puts tabled_format(item, value) }\n puts \"\".center(80, \"_\")\n total = hash.values.inject(:+)\n puts tabled_format(\"Total\", total)\n end",
"def summary_table\n update_now_date_time\n calc... | [
"0.7193603",
"0.6863629",
"0.6822937",
"0.68085456",
"0.68085456",
"0.67764485",
"0.6744532",
"0.6672489",
"0.66474843",
"0.6595377",
"0.65335685",
"0.6519944",
"0.64450455",
"0.6437405",
"0.6431223",
"0.6421539",
"0.6400202",
"0.63823694",
"0.63746893",
"0.6320597",
"0.63151... | 0.876565 | 0 |
Convert document +items+ to a single string array | def items_to_a(items)
ary = []
items.each do |item|
ary << item_to_a(item)
end
ary.flatten
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def parse_items(doc_items)\n parsed_items = []\n doc_items.each do |doc_item|\n parsed_items << Item.new(doc_item)\n end\n parsed_items\n end",
"def parse_items(doc_items)\n parsed_items = []\n doc_items.each do |doc_item|\n parsed_items << ::Item.new(doc_item)\n ... | [
"0.69643843",
"0.69332963",
"0.64301074",
"0.6258552",
"0.6111497",
"0.5967791",
"0.58997816",
"0.58439654",
"0.5829073",
"0.58203804",
"0.57574093",
"0.57217085",
"0.5703468",
"0.56927925",
"0.5673908",
"0.5631647",
"0.5598547",
"0.5596327",
"0.5577443",
"0.5577085",
"0.5518... | 0.6717284 | 2 |
Convert document +item+ to a single string array | def item_to_a(item)
ary = []
ary << item.name
ary << item.quantity
ary << item.unit
ary << item.price
ary << item.tax
ary << item.tax2
ary << item.tax3
ary << item.amount
ary.compact
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _getarray\n if @document.nil?\n return @list\n else\n return @document.native_text\n end\n end",
"def parse_items(doc_items)\n parsed_items = []\n doc_items.each do |doc_item|\n parsed_items << ::Item.new(doc_item)\n end\n parsed_items\n end",
"... | [
"0.6056956",
"0.5993569",
"0.5976446",
"0.57340914",
"0.5696483",
"0.5652424",
"0.55959266",
"0.55771637",
"0.5561166",
"0.5554272",
"0.5515335",
"0.5503311",
"0.5446031",
"0.5429522",
"0.5429066",
"0.5379978",
"0.5343272",
"0.5296066",
"0.5243139",
"0.5237757",
"0.52229613",... | 0.62704563 | 0 |
'password' is a virtual attribute | def password
@password
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def password\n \t\t return password_virtual_attr\n end",
"def password\n\t\tPassword.new( attribute_get(:password) )\n\tend",
"def password_field\n self.password\n end",
"def password\n @attributes[:password]\n end",
"def password\n @attributes[:password]\n end",
"def password\n ... | [
"0.8923515",
"0.82171404",
"0.81790924",
"0.81615293",
"0.81615293",
"0.8124509",
"0.8069165",
"0.8048135",
"0.8043672",
"0.80031204",
"0.7998858",
"0.7942966",
"0.7942966",
"0.7942966",
"0.7942966",
"0.7942966",
"0.7942966",
"0.79252744",
"0.79252744",
"0.79245543",
"0.79245... | 0.80647916 | 29 |
Use callbacks to share common setup or constraints between actions. | def set_datapoint
@datapoint = Datapoint.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 trusted parameter "white list" through. | def datapoint_params
params.require(:datapoint).permit(:x, :y)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def allowed_params\n ALLOWED_PARAMS\n end",
"def expected_permitted_parameter_names; end",
"def param_whitelist\n [:role, :title]\n end",
"def default_param_whitelist\n [\"mode\"]\n end",
"def permitir_parametros\n \t\tparams.permit!\n \tend",
"def permitted_params\n []\n end",
... | [
"0.7121987",
"0.70541996",
"0.69483954",
"0.6902367",
"0.6733912",
"0.6717838",
"0.6687021",
"0.6676254",
"0.66612333",
"0.6555296",
"0.6527056",
"0.6456324",
"0.6450841",
"0.6450127",
"0.6447226",
"0.6434961",
"0.64121825",
"0.64121825",
"0.63913447",
"0.63804525",
"0.638045... | 0.0 | -1 |
finds job id within url | def find_job
@job = Job.find(params[:job_id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def extract_work_id( url )\n /^.*\\/(\\d+-\\d+-.*)$/.match( url )[ 1 ]\nend",
"def find_job(job_id)\n response = HTTParty.get(\"#{@host}/api/jobs/#{job_id}\")\n\n return response['job']\n end",
"def get_job_id\n # check if the job ID has already been set (the job name will not change\n # dur... | [
"0.7573492",
"0.7280827",
"0.70596355",
"0.6794246",
"0.6718588",
"0.6648479",
"0.64914405",
"0.6370085",
"0.63472086",
"0.63185114",
"0.6311975",
"0.6284159",
"0.62779164",
"0.6231102",
"0.6199557",
"0.6184709",
"0.6184709",
"0.6184709",
"0.6184709",
"0.6184709",
"0.6184709"... | 0.6398102 | 7 |
returns false if either review has been made or user is trying to post a review to a job he created | def job_creator
@job.reviews.empty? && @job.user.id != current_user.id
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def post_review?(next_review, user)\n\n (next_review && \n !self.review_locked? && \n next_review.designer_id == user.id &&\n next_review.review_type_id == next_review.design.phase_id)\n\n end",
"def pending_repost?\n self.review_status_id == ReviewStatus.f... | [
"0.7388885",
"0.68355733",
"0.6673574",
"0.66656756",
"0.6639059",
"0.660654",
"0.6595817",
"0.65588206",
"0.65271467",
"0.651431",
"0.64665097",
"0.64589894",
"0.6453949",
"0.6344974",
"0.6337375",
"0.63294107",
"0.6328936",
"0.63181335",
"0.6278323",
"0.62414366",
"0.623805... | 0.71920294 | 1 |
New building operator accounts are only created when an asset manager delegates a question to them, so send an onboarding email telling them they have new questions. | def send_onboarding_email
BuildingOperatorMailer.new_user_delegated_email(self).deliver_now
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def organisation_and_operator_created(operator)\n @operator = operator\n @organisation = operator.organisation\n mail(\n to: @operator.email,\n subject: 'Confirmation instructions'\n )\n end",
"def new_enquiry(operator, trip)\n @trip = trip\n @operator = operator\n @emails = O... | [
"0.7197136",
"0.6688063",
"0.6562798",
"0.61965823",
"0.6133112",
"0.6122628",
"0.6120826",
"0.6056202",
"0.5912709",
"0.58488214",
"0.57194847",
"0.5671627",
"0.5669893",
"0.566491",
"0.5661498",
"0.5628743",
"0.56171954",
"0.5609464",
"0.55694175",
"0.55694175",
"0.5545861"... | 0.60074806 | 8 |
has_many :work_hour_notes, foreign_key: :item_id, source: :work_hour, dependent: :destroy has_many :notes, through: :work_hour_notes, source: :note, dependent: :destroy, order: "created_at asc" | def entry
(self.entry_stories.first and self.entry_stories.first.entry)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def notes_chronologically\n notes.in_order\n end",
"def set_note_order\n self.note_order = noteable.notes.maximum(:note_order) + 1\n end",
"def index\n @notes_lists = @note.notes_lists.all\n end",
"def hestory\n @orders = current_user.orders.all.order(created_at: :desc)\n end",
... | [
"0.554321",
"0.54037535",
"0.5397733",
"0.52827173",
"0.5159585",
"0.5141621",
"0.5135001",
"0.5126834",
"0.51232123",
"0.50956863",
"0.507309",
"0.50596",
"0.50413644",
"0.50383526",
"0.50346875",
"0.503276",
"0.5020488",
"0.50117224",
"0.49997017",
"0.49869588",
"0.49837828... | 0.0 | -1 |
Adds a message and callback to the batch. The method will indicate how the message is added. It will either be added to the active list of items, it will be queued to be picked up once the active publishing job has been completed, or it will indicate that the batch is full and a publishing job should be created. | def add msg, callback
synchronize do
raise AsyncPublisherStopped if @stopping
raise OrderingKeyError, @ordering_key if @canceled
if @publishing
queue_add msg, callback
:queued
elsif try_add msg, callback
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def enqueue_message(message); end",
"def add_message(message,opts={})\n # Append the message to @messages\n (@messages ||= []) << message\n end",
"def add(item)\n @batch << item\n execute if ready?\n end",
"def add(*messages)\n [messages].flatten.map do |message|\n repor... | [
"0.60798675",
"0.5979099",
"0.59738064",
"0.5908946",
"0.5817309",
"0.58045137",
"0.5737912",
"0.5673885",
"0.56657135",
"0.55941486",
"0.5569261",
"0.5537726",
"0.54699326",
"0.54660684",
"0.543383",
"0.5390558",
"0.5378355",
"0.536574",
"0.5346551",
"0.53450155",
"0.5338699... | 0.71693957 | 0 |
Indicates whether the batch has an active publishing job. | def publishing?
# This probably does not need to be synchronized
@publishing
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_published?\n self.publishing_state == PublishingState::PUBLISHED\n end",
"def publishable?\n self.status == STATUS_PENDING\n end",
"def has_pending?\n self.class.job_run_class.has_pending?(@job, @batch)\n end",
"def finishable?\n self.status == STATUS_PUBLISHED\n end",
"def p... | [
"0.7092565",
"0.7046915",
"0.697137",
"0.68403363",
"0.6787609",
"0.6730412",
"0.6706712",
"0.66858566",
"0.6682703",
"0.6682703",
"0.6682703",
"0.6682703",
"0.6682703",
"0.6633486",
"0.6625956",
"0.6612918",
"0.66008",
"0.6568907",
"0.6564555",
"0.6554126",
"0.6526646",
"0... | 0.72980046 | 0 |
Indicates whether the batch has been stopped and all items will be published until the batch is empty. | def stopping?
# This does not need to be synchronized because nothing un-stops
@stopping
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def empty?\n synchronize do\n return false if @publishing || @canceled || @stopping\n\n @items.empty? && @queue.empty?\n end\n end",
"def reset!\n synchronize do\n @items = []\n @total_message_bytes = @default_message_b... | [
"0.6604054",
"0.65913385",
"0.65470517",
"0.6442103",
"0.63337433",
"0.63337433",
"0.6313236",
"0.6313236",
"0.6294846",
"0.62674963",
"0.6247633",
"0.6237229",
"0.619095",
"0.61784774",
"0.61577874",
"0.6146483",
"0.6146483",
"0.6130557",
"0.6121836",
"0.61088246",
"0.610130... | 0.6059426 | 27 |
Fills the batch by sequentially moving the queued items that will fit into the active item list. This method is only intended to be used by the active publishing job. | def rebalance!
synchronize do
return [] if @canceled
until @queue.empty?
item = @queue.first
if try_add item.msg, item.callback, item.create_time
@queue.shift
next
end
break
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def flush\n send_batch( Traject::Util.drain_queue(@batched_queue) )\n end",
"def next_batch!(queue)\n conditions = {:run_at.lte => Time.now.utc}\n conditions[:record_class_name] = queue.class_names unless queue.class_names.empty?\n batch_entries = all(conditions.merge(:fields... | [
"0.6515677",
"0.6098283",
"0.6043204",
"0.5947932",
"0.5942163",
"0.5932357",
"0.589157",
"0.58890575",
"0.588336",
"0.57475895",
"0.57431597",
"0.56925726",
"0.5675697",
"0.5651217",
"0.5607522",
"0.56004345",
"0.55894506",
"0.55754495",
"0.5573757",
"0.55722123",
"0.5570175... | 0.5557052 | 22 |
Resets the batch after a successful publish. This clears the active item list and moves the queued items that will fit into the active item list. If the batch has enough queued items to fill the batch again, the publishing job should continue to publish the reset batch until the batch indicated it should stop. This met... | def reset!
synchronize do
@items = []
@total_message_bytes = @default_message_bytes
if @canceled
@queue = []
@publishing = false
return false
end
refill_items
return false u... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def clearance_items!\n return if @batch_ids.empty?\n @batch.save!\n @batch_ids.each do |item_id|\n item = Item.find(item_id)\n item.clearance!\n # NOTE: Considered adding a catch here if the item fails to save.\n # Feels unneeded as the item cannot possibly have invalid state at this p... | [
"0.644794",
"0.6287525",
"0.6106443",
"0.5997815",
"0.59200215",
"0.590472",
"0.5889299",
"0.58841485",
"0.5714644",
"0.57142055",
"0.56894344",
"0.56689215",
"0.56237227",
"0.5563751",
"0.55473936",
"0.5525789",
"0.5525134",
"0.5510468",
"0.54936194",
"0.5478881",
"0.5449109... | 0.66239285 | 0 |
Determines whether the batch is empty and ready to be culled. | def empty?
synchronize do
return false if @publishing || @canceled || @stopping
@items.empty? && @queue.empty?
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_for_empty_batch?\n batch.empty?\n end",
"def ready?\n @batch.size >= @size\n end",
"def empty?\n @queued.empty?\n end",
"def empty?\n @buffers.values.all?(&:empty?)\n end",
"def work_pending?\n !buffer.empty?\n end",
"def empty?\n ... | [
"0.85985684",
"0.83903337",
"0.73804486",
"0.7337316",
"0.7245077",
"0.7226049",
"0.71763146",
"0.7131619",
"0.7127082",
"0.70940727",
"0.70396686",
"0.69822186",
"0.69808894",
"0.69808894",
"0.6974499",
"0.6958689",
"0.6958689",
"0.69558215",
"0.6940395",
"0.69384676",
"0.69... | 0.7072725 | 10 |
Create a new node [nid] The unique network id for this node. | def initialize(nid, start_peer_addr = nil, report_converge_time = false)
super()
@report_join = report_converge_time
@start_peer_addr = start_peer_addr
@config = Configuration::instance.node
@pad = Scratchpad::instance
analysis_setup_aspects()
extend(@config.maintenance_alg... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_node!\n node.save\n end",
"def create\n Souffle::Log.info \"#{@node.log_prefix} Creating a new node...\"\n provider.create_node(@node)\n end",
"def new_node\n id = @nodes.size\n node = Node.new(id: id)\n @nodes.push(node)\n id\n end",
"def create\n ... | [
"0.70270467",
"0.6899186",
"0.68186337",
"0.66778034",
"0.65947",
"0.6257533",
"0.61281145",
"0.6124614",
"0.6042873",
"0.603262",
"0.6027207",
"0.6026854",
"0.6016661",
"0.59854084",
"0.5934879",
"0.592184",
"0.59109753",
"0.59109753",
"0.59109753",
"0.58806777",
"0.5877495"... | 0.0 | -1 |
representing the number of rows to print, and prints out a right triangle consisting of characters, one line per row. | def print_triangle(rows)
n = 1
while n <= rows
n += 1
x = 1
while x < n
print "*"
x += 1
end
puts ' '
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def triangle(rows)\n 1.upto(rows) { |num| puts \"#{\"*\" * num}\".rjust(rows)}\nend",
"def print_triangle(rows)\n 1.upto(rows) do |i|\n puts \"*\" * i\n end\nend",
"def triangle(n)\n (1..n).each { |row| puts ' ' * (n - row) + '*' * row }\nend",
"def triangle(num)\n 1.upto(num) { |n| puts \"#{\"*\" * ... | [
"0.8594005",
"0.8273039",
"0.7945396",
"0.78356624",
"0.7740806",
"0.76873267",
"0.75644577",
"0.7504713",
"0.74525875",
"0.7445144",
"0.7392367",
"0.73776656",
"0.7373175",
"0.73609436",
"0.7360933",
"0.7297804",
"0.7297104",
"0.7295596",
"0.7226398",
"0.721843",
"0.7211108"... | 0.8350542 | 1 |
This check will be executed on each user that have not registration log or credit for registration log, in order to exclude the possibility that his logs haven't been stocked yet. To do so, we will throw errors only if user's updated_at time goes back more than 1 minute before last event timestamp. | def check_if_user_has_been_updated_recently(conn, user_ids, max_events_timestamp)
users_with_errors = []
conn.exec("SELECT id, updated_at FROM users WHERE id IN (#{user_ids.join(",")})").each do |user|
if DateTime.parse(user["updated_at"]) < DateTime.parse(max_events_timestamp) - 1.minutes
users_with_erro... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_timestamp\n @recent.save! if Time.now - @recent.updated_at >= 600\n end",
"def _update_check_needed\n (Time.now - @last_update_check) > UPDATE_VALID_PERIOD\n end",
"def user_is_old? user\n return user.logins_number > 1\n end",
"def check_daily_limit\n # unless self.user.glucose_l... | [
"0.61338156",
"0.5922295",
"0.58492076",
"0.5843501",
"0.5794646",
"0.577582",
"0.5763356",
"0.57482195",
"0.57188123",
"0.57188123",
"0.5715663",
"0.5715663",
"0.57141536",
"0.5703036",
"0.56643456",
"0.565473",
"0.56211394",
"0.56142086",
"0.56122434",
"0.5611087",
"0.55922... | 0.66827714 | 0 |
Use callbacks to share common setup or constraints between actions. | def set_order
@order = Order.find(params[:id])
@order_product = OrderProduct.where(order_id: params[:id]).first
if @order_product
@product = Product.where(id: @order_product.product_id).first
end
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 order_params
params.require(:order).permit(:payment_total, :payment_type, :employee, order_products_attributes: [:id, :product_count])
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 |
Sets autoloads in the root namespace. | def setup
mutex.synchronize do
break if @setup
actual_root_dirs.each do |root_dir, namespace|
set_autoloads_in_dir(root_dir, namespace)
end
on_setup_callbacks.each(&:call)
@setup = true
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def on_namespace_loaded(namespace)\n if subdirs = lazy_subdirs.delete(namespace.name)\n subdirs.each do |subdir|\n set_autoloads_in_dir(subdir, namespace)\n end\n end\n end",
"def on_namespace_loaded(namespace)\n if subdirs = lazy_subdirs.delete(namespace.name)\n subdirs.each do |... | [
"0.7001044",
"0.7001044",
"0.69222564",
"0.6331033",
"0.6249489",
"0.6236177",
"0.6201375",
"0.6065821",
"0.5846158",
"0.5838213",
"0.5769517",
"0.5735688",
"0.5690227",
"0.56343436",
"0.5630549",
"0.5480594",
"0.5446557",
"0.543661",
"0.543661",
"0.54263073",
"0.5414013",
... | 0.7215619 | 0 |
Removes loaded constants and configured autoloads. The objects the constants stored are no longer reachable through them. In addition, since said objects are normally not referenced from anywhere else, they are eligible for garbage collection, which would effectively unload them. This method is public but undocumented.... | def unload
mutex.synchronize do
# We are going to keep track of the files that were required by our
# autoloads to later remove them from $LOADED_FEATURES, thus making them
# loadable by Kernel#require again.
#
# Directories are not stored in $LOADED_FEATURES, keeping track... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remove_unloadable_constants!\n log(\"removing unloadable constants\")\n autoloaded_constants.each { |const| remove_constant const }\n autoloaded_constants.clear\n Reference.clear!\n explicitly_unloadable_constants.each { |const| remove_constant const }\n end",
"def delete_all\n ... | [
"0.800774",
"0.73467034",
"0.7162853",
"0.68508434",
"0.6631435",
"0.660699",
"0.65245396",
"0.645922",
"0.64171344",
"0.63920647",
"0.63900554",
"0.6303465",
"0.6257931",
"0.6235782",
"0.62315667",
"0.6219133",
"0.62123746",
"0.62085444",
"0.6193876",
"0.6176018",
"0.6171236... | 0.72774655 | 2 |
Eager loads all files in the root directories, recursively. Files do not need to be in `$LOAD_PATH`, absolute file names are used. Ignored files are not eager loaded. You can optout specifically in specific files and directories with `do_not_eager_load`, and that can be overridden passing `force: true`. | def eager_load(force: false)
mutex.synchronize do
break if @eager_loaded
log("eager load start") if logger
honour_exclusions = !force
queue = []
actual_root_dirs.each do |root_dir, namespace|
queue << [namespace, root_dir] unless honour_exclusions && excluded_f... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load_all\n return if defined?(@loaded_all)\n\n load_env\n\n paths = search_path\n unless paths.nil?\n paths.each do |dir|\n # dir is already an absolute path\n Dir.glob(File.join(dir, '*.rb')).each do |path|\n # exclude dirs that end with .rb\n load_file(path) i... | [
"0.6583624",
"0.6579591",
"0.6536675",
"0.6399464",
"0.63251936",
"0.63088393",
"0.62971264",
"0.62489426",
"0.62374836",
"0.6156482",
"0.6086927",
"0.5995995",
"0.5962755",
"0.5962755",
"0.5962755",
"0.5962755",
"0.5910089",
"0.5910089",
"0.5910089",
"0.59090376",
"0.5909037... | 0.7410023 | 0 |
Says if the given constant path would be unloaded on reload. This predicate returns `false` if reloading is disabled. | def unloadable_cpath?(cpath)
to_unload.key?(cpath)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def reload?\n return true unless loaded?\n return false unless Gretel.reload_environments.include?(Rails.env)\n\n loaded_file_mtimes != breadcrumb_files.map { |file| File.mtime(file) }\n end",
"def will_unload?(const_desc)\n autoloaded?(const_desc) ||\n explicitly_unloadable... | [
"0.6870964",
"0.6683748",
"0.6485462",
"0.6455939",
"0.6409432",
"0.6409432",
"0.6361479",
"0.63596547",
"0.63047457",
"0.6287906",
"0.6287906",
"0.6287906",
"0.6287583",
"0.6265141",
"0.6229217",
"0.6165802",
"0.61527455",
"0.60171795",
"0.59798056",
"0.5893381",
"0.58204293... | 0.6986678 | 0 |
Returns an array with the constant paths that would be unloaded on reload. This predicate returns an empty array if reloading is disabled. | def unloadable_cpaths
to_unload.keys.freeze
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def paths(reload = false)\n thread_local_store.keys(reload).map(&:to_s)\n end",
"def all_loaded_constants\n constants.map { |c| const_get(c) }.\n select { |a| a.respond_to?(:loaded?) && a.loaded? }\n end",
"def paths(reload = T.unsafe(nil)); end",
"def ignorable_paths\n []\n ... | [
"0.7018042",
"0.6981975",
"0.686046",
"0.65666914",
"0.625814",
"0.6228755",
"0.62015635",
"0.6138259",
"0.6138259",
"0.60683566",
"0.60456896",
"0.6026595",
"0.5986734",
"0.59265816",
"0.58902895",
"0.58711857",
"0.58481234",
"0.581778",
"0.5801543",
"0.577083",
"0.57692283"... | 0.737368 | 0 |
This is a dangerous method. | def unregister
Registry.unregister_loader(self)
ExplicitNamespace.unregister_loader(self)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def private; end",
"def safe; end",
"def awaken!\n\t\traise 'Not implemented'\n\tend",
"def sharp; accidental; end",
"def big_bad; end",
"def private_method\n end",
"def schubert; end",
"def suivre; end",
"def safe_by_default; end",
"def name_safe?; end",
"def specialty; end",
"def probe... | [
"0.72046036",
"0.6777324",
"0.67640567",
"0.63404125",
"0.6295656",
"0.6239635",
"0.6199375",
"0.61958027",
"0.615783",
"0.61269385",
"0.6082272",
"0.60586333",
"0.60515887",
"0.60178673",
"0.6017463",
"0.59892094",
"0.598779",
"0.59796554",
"0.5979193",
"0.5958044",
"0.59549... | 0.0 | -1 |
This is a shortcut for require "zeitwerk" loader = Zeitwerk::Loader.new loader.tag = File.basename(__FILE__, ".rb") loader.inflector = Zeitwerk::GemInflector.new(__FILE__) loader.push_dir(__dir__) except that this method returns the same object in subsequent calls from the same file, in the unlikely case the gem wants ... | def for_gem
called_from = caller_locations(1, 1).first.path
Registry.loader_for_gem(called_from)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def loader_for_gem(root_file)\n loaders_managing_gems[root_file] ||= begin\n Loader.new.tap do |loader|\n loader.tag = File.basename(root_file, \".rb\")\n loader.inflector = GemInflector.new(root_file)\n loader.push_dir(File.dirname(root_file))\n end\n ... | [
"0.6551123",
"0.65391845",
"0.6524838",
"0.6480942",
"0.64726454",
"0.64422536",
"0.6438188",
"0.63565207",
"0.6329452",
"0.63090235",
"0.6268216",
"0.62598014",
"0.61835426",
"0.6071442",
"0.60670495",
"0.605926",
"0.6035279",
"0.6025146",
"0.60194147",
"0.60075235",
"0.5986... | 0.6611234 | 0 |
Broadcasts `eager_load` to all loaders. | def eager_load_all
Registry.loaders.each(&:eager_load)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def before_eager_load(&block); end",
"def eager_load!; end",
"def eager_load!; end",
"def eager_load!; end",
"def eager_load!; end",
"def eager_load; end",
"def eager_load; end",
"def eager_load; end",
"def eager_load=(_arg0); end",
"def eager_load=(_arg0); end",
"def eager_load=(_arg0); end",
... | [
"0.65489805",
"0.65004903",
"0.65004903",
"0.65004903",
"0.65004903",
"0.6381046",
"0.6381046",
"0.6381046",
"0.60709685",
"0.60709685",
"0.60709685",
"0.59599966",
"0.5922014",
"0.5922014",
"0.5871958",
"0.5847346",
"0.5813926",
"0.5791262",
"0.5718439",
"0.56477946",
"0.559... | 0.73521113 | 0 |
Returns an array with the absolute paths of the root directories of all registered loaders. This is a readonly collection. | def all_dirs
Registry.loaders.flat_map(&:dirs).freeze
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def resolve_paths(loaders)\n mod_resolver = loaders.instance_variable_get(:@module_resolver)\n all_mods = mod_resolver.instance_variable_get(:@all_module_loaders)\n end",
"def get_dirs\n Dir.glob(\"#{@options[:load_path]}/*/**/\")\n end",
"def paths\n root.paths\n end",
"def lo... | [
"0.71185875",
"0.7065195",
"0.6832043",
"0.68179905",
"0.6809799",
"0.6773039",
"0.6692352",
"0.6667865",
"0.66467553",
"0.66467553",
"0.6628909",
"0.6621036",
"0.6555652",
"0.65367115",
"0.653388",
"0.653388",
"0.6488609",
"0.6487691",
"0.6487341",
"0.64749736",
"0.6467899",... | 0.85586613 | 0 |
`dir` is the directory that would have autovivified a namespace. `file` is the file where we've found the namespace is explicitly defined. | def promote_namespace_from_implicit_to_explicit(dir:, file:, parent:, cname:)
autoloads.delete(dir)
Registry.unregister_autoload(dir)
log("earlier autoload for #{cpath(parent, cname)} discarded, it is actually an explicit namespace defined in #{file}") if logger
set_autoload(parent, cname, fil... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def file_namespace\n name\n end",
"def find_or_create_namespace(file)\n @namespace = YARD::CodeObjects::Lucid::LUCID_NAMESPACE\n\n File.dirname(file).split('/').each do |directory|\n @namespace = @namespace.children.find { |child| child.is_a?(YARD::CodeObjects::Lucid::FeatureDirect... | [
"0.6913929",
"0.6515073",
"0.6099591",
"0.6023175",
"0.60051274",
"0.59305346",
"0.58969754",
"0.5854991",
"0.5726016",
"0.5674416",
"0.56598014",
"0.5626435",
"0.5626435",
"0.5626435",
"0.5530093",
"0.5486882",
"0.5480185",
"0.54424596",
"0.5440011",
"0.5409874",
"0.5408309"... | 0.52816105 | 33 |
This sort logic is critical for determining the encoding index, which is internally used in String. It must be IDENTICAL to MRI's counterpart logic. | def sort_by_encoding_index(files)
files.sort_by do |file|
token_pairs = file.scan(/(\D+)|(\d+)/)
sort_key = token_pairs.map do |letters, digits|
if letters
letters
else
padded_numeric_sort_key(digits)
end
end
sort_key.flatten
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sort3(strings, length)\n (length - 1).downto(0) do |i|\n buckets = Array.new(26) { [] }\n strings.each do |string|\n letter = string[i]\n buckets[letter.ord - \"a\".ord] << string\n end\n\n strings = []\n buckets.each do |bucket|\n bucket.each { |string| strings << string }\n ... | [
"0.6031197",
"0.59595317",
"0.5951772",
"0.5843466",
"0.5839619",
"0.58291477",
"0.58013076",
"0.57966053",
"0.5795176",
"0.57227314",
"0.572213",
"0.5703483",
"0.5692866",
"0.56857926",
"0.5667759",
"0.5658228",
"0.5649168",
"0.5643698",
"0.5643698",
"0.5643698",
"0.56147957... | 0.72133523 | 0 |
Random Mutation Hill Climbing each generation, one mutation is created. grows relatively slowly, but seems to do a better job with this problem set of creating a maximum score. I wonder to what extent a more complicated scoring function would need a different algorithm. | def mutate_rmhc(array)
mutated_position = rand(array.length)
array.clone.tap do |new_array|
new_array[mutated_position] = inverse(new_array[mutated_position])
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def compute_damage\n rand(1..6)\n end",
"def compute_damage\n return rand(1..6)\n end",
"def compute_damage\n return rand(1..6)\n end",
"def compute_damage\r\n return rand(1..6)\r\n end",
"def mutation\r\n @population += @mutation.times.map do\r\n mask = 0\r\n 0.upto(@length-1)... | [
"0.63141143",
"0.62148505",
"0.62148505",
"0.6197536",
"0.61833984",
"0.6165073",
"0.6150017",
"0.61341333",
"0.60880095",
"0.607404",
"0.6073896",
"0.5954107",
"0.59230673",
"0.5894315",
"0.58495104",
"0.58495104",
"0.5844857",
"0.583839",
"0.583839",
"0.5837964",
"0.5834784... | 0.0 | -1 |
ES(1+1, m, hc) each cell has an equal (defined) probability of being changed for any given generation. interesting that for this problem set, it's hard to get to the global optimum solution with this strategy. as we get close, even with a large number of iterations, we tend to take as many steps backward as forward. | def mutate_es11(array, probability: 0.2)
new_array = array.clone
0.upto(new_array.length) do |i|
new_array[i] = inverse(new_array[i]) if rand() < probability
end
new_array
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_ce_deBoer_2\n NArray.srand(567) # must use NArray's generator, not Ruby's\n\n # Cost matrix\n n = 5\n c = NArray[[0,1,3,5,6],\n [1,0,3,6,5],\n [3,3,0,2,2],\n [5,6,2,0,2],\n [6,5,2,2,0]]\n\n mp = CrossEntropy::MatrixProblem.new\n mp.... | [
"0.6094058",
"0.5824809",
"0.5727021",
"0.5695636",
"0.5681956",
"0.56171846",
"0.55273116",
"0.5519771",
"0.54910415",
"0.5483538",
"0.54559416",
"0.54454505",
"0.5436835",
"0.5417094",
"0.5392065",
"0.5374075",
"0.53668827",
"0.5332794",
"0.5324338",
"0.53033376",
"0.530312... | 0.53813475 | 15 |
Recursively processes the specified list of nodes. | def iterate(node)
return unless node.is_a?(AST::Node)
before = :"on_#{node.type}"
after = :"after_#{node.type}"
skip_node = catch :skip_child_nodes do
execute_callback(before, node)
end
if skip_node != node
node.children.each do |child|
iterate(chil... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def process_child_nodes(node); end",
"def apply(nodes)\n node_manager.assert_known(nodes)\n for node in nodes\n node_manager.find(node).apply\n end\n end",
"def process_all_nodes\n debug 'Start processing all nodes'\n each_node do |node|\n process_node node\n end\n end",... | [
"0.73506546",
"0.70891476",
"0.6987708",
"0.6873874",
"0.6765917",
"0.6523009",
"0.6401689",
"0.63430876",
"0.62677675",
"0.6264041",
"0.6087162",
"0.6014352",
"0.5935879",
"0.58571756",
"0.58289427",
"0.5827841",
"0.5824102",
"0.57995975",
"0.57524985",
"0.5740199",
"0.57260... | 0.0 | -1 |
Executes the specified callback method if it exists. | def execute_callback(name, *args)
return unless respond_to?(name)
unless arity_cache.key?(name)
arity_cache[name] = method(name).arity
end
if arity_cache[name] == 0
send(name)
else
send(name, *args)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def invoke_callback(callback)\n return unless callback\n if callback.is_a?(Proc) || callback.is_a?(Method)\n callback.call(self)\n else\n invoke_callback_class_instance(callback)\n end\n end",
"def have_callback(method)\n HaveCallback.new(method)\n end",
"... | [
"0.72083116",
"0.7084256",
"0.7071174",
"0.7063166",
"0.68225044",
"0.67809844",
"0.66488045",
"0.66300267",
"0.65775824",
"0.64308864",
"0.64308864",
"0.64152205",
"0.6412886",
"0.6395469",
"0.6392238",
"0.6294697",
"0.62468266",
"0.6242307",
"0.6242006",
"0.6242006",
"0.616... | 0.6259195 | 16 |
GET /regions GET /regions.json | def index
@regions = Region.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def regions\n client.get_stats('/stats/regions')\n end",
"def get_region\n respond_to do |format|\n format.json{ render :json => { :region => Region.all } }\n end\n end",
"def regions\n @regions = Region.all\n\n render json: @regions.to_json(:include => :vertices)\n end",
"def index\n ... | [
"0.82105464",
"0.7807286",
"0.77090687",
"0.752034",
"0.73698556",
"0.73571515",
"0.7281078",
"0.72503275",
"0.722394",
"0.7162424",
"0.7105898",
"0.7041133",
"0.7002221",
"0.69372696",
"0.691359",
"0.68754053",
"0.6867506",
"0.6861832",
"0.6837167",
"0.6833347",
"0.6833011",... | 0.73242235 | 7 |
GET /regions/1 GET /regions/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_region\n respond_to do |format|\n format.json{ render :json => { :region => Region.all } }\n end\n end",
"def regions\n client.get_stats('/stats/regions')\n end",
"def show\n render json: @region\n end",
"def index\n @regiones = Region.all\n\n render json: @regiones\n end",... | [
"0.7814793",
"0.76752275",
"0.7434239",
"0.7433416",
"0.73747057",
"0.72422254",
"0.72422254",
"0.7206756",
"0.7147996",
"0.70249045",
"0.70006865",
"0.6868591",
"0.6833247",
"0.6782174",
"0.670647",
"0.6690898",
"0.6671465",
"0.6656398",
"0.6652386",
"0.6652386",
"0.6603537"... | 0.0 | -1 |
POST /regions POST /regions.json | def create
@region = Region.new(region_params)
respond_to do |format|
if @region.save
format.html { redirect_to @region, notice: 'Region was successfully created.' }
format.json { render :show, status: :created, location: @region }
else
format.html { render :new }
fo... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @region = Region.new(region_params)\n\n if @region.save\n render json: @region, status: :created, location: @region\n else\n render json: @region.errors, status: :unprocessable_entity\n end\n end",
"def create_region\n Region.create!(params[:record])\n render :json => {}... | [
"0.7346728",
"0.7197264",
"0.7171319",
"0.69664764",
"0.69578725",
"0.69392407",
"0.6894397",
"0.68618876",
"0.6619195",
"0.656873",
"0.64114285",
"0.63875526",
"0.6359836",
"0.6330061",
"0.6293564",
"0.62596035",
"0.624277",
"0.62411666",
"0.62159806",
"0.6180307",
"0.617212... | 0.69151163 | 7 |
PATCH/PUT /regions/1 PATCH/PUT /regions/1.json | def update
respond_to do |format|
if @region.update(region_params)
format.html { redirect_to @region, notice: 'Region was successfully updated.' }
format.json { render :show, status: :ok, location: @region }
else
format.html { render :edit }
format.json { render json: @re... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @region = Region.find(params[:id])\n\n if @region.update(region_params)\n head :no_content\n else\n render json: @region.errors, status: :unprocessable_entity\n end\n end",
"def update\n\n @regions = Region.all\n if params[:regions]\n @location_regions = Region.find... | [
"0.71145266",
"0.6931054",
"0.6919681",
"0.68813133",
"0.6855132",
"0.68395084",
"0.6519122",
"0.6411803",
"0.6356662",
"0.6352091",
"0.63252425",
"0.63046616",
"0.62931603",
"0.6289735",
"0.6283126",
"0.6276821",
"0.62574995",
"0.61981046",
"0.6176063",
"0.6131582",
"0.61246... | 0.66937166 | 7 |
DELETE /regions/1 DELETE /regions/1.json | def destroy
@region.destroy
respond_to do |format|
format.html { redirect_to regions_url, notice: 'Region was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete_region\n Region.find(params[:id]).destroy\n render :json => {}\n end",
"def destroy\n @region = Region.find(params[:id])\n @region.destroy\n\n respond_to do |format|\n format.html { redirect_to regions_url }\n format.json { head :no_content }\n end\n end",
"def destroy\... | [
"0.7899007",
"0.76018757",
"0.7396433",
"0.7393135",
"0.7210346",
"0.7137638",
"0.7135508",
"0.7129871",
"0.70940995",
"0.7071564",
"0.7051998",
"0.69521856",
"0.69017345",
"0.6893489",
"0.6873033",
"0.68651175",
"0.6838611",
"0.679861",
"0.6776843",
"0.6770787",
"0.66332644"... | 0.7364275 | 6 |
Use callbacks to share common setup or constraints between actions. | def set_region
@region = Region.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 region_params
params.require(:region).permit(:name, :type)
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 |
GET /feelings GET /feelings.json | def index
@feelings = Feeling.where(user: current_user).all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @feeling = Feeling.find(params[:id])\n @sake = Sake.find(params[:sake_id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @feeling }\n end\n end",
"def set_feeling\n @feeling = Feeling.find(params[:id])\n end",
"def find_feeling(us... | [
"0.6582722",
"0.6093263",
"0.599948",
"0.59310174",
"0.5898559",
"0.5810903",
"0.576901",
"0.5768626",
"0.57481486",
"0.5735731",
"0.56963444",
"0.5662499",
"0.56059664",
"0.5577753",
"0.5577292",
"0.5564127",
"0.5560774",
"0.5550423",
"0.55363643",
"0.55308616",
"0.5506306",... | 0.65986603 | 0 |
GET /feelings/1 GET /feelings/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @feeling = Feeling.find(params[:id])\n @sake = Sake.find(params[:sake_id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @feeling }\n end\n end",
"def set_feeling\n @feeling = Feeling.find(params[:id])\n end",
"def index\n @fee... | [
"0.67607564",
"0.6514888",
"0.6437005",
"0.6366638",
"0.6219202",
"0.59916764",
"0.5969163",
"0.59359723",
"0.58561265",
"0.58251756",
"0.57725096",
"0.5748256",
"0.57419086",
"0.57375115",
"0.5707649",
"0.5705727",
"0.5690068",
"0.56868",
"0.56758875",
"0.56696403",
"0.56613... | 0.0 | -1 |
POST /feelings POST /feelings.json | def create
@feeling = Feeling.new(feeling_params)
respond_to do |format|
if @feeling.save
format.html { redirect_to new_feeling_path }
#format.js
format.json { render :show, status: :created, location: @feeling }
else
format.html { render :new }
#format.json ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @survey = Survey.find(params[:survey_id])\n emoji = params[:emoji]\n mood = params[:mood]\n @feeling = Feeling.new(mood: mood, emoji: emoji)\n @survey.feelings << @feeling\n\n if @feeling.save\n render :ok, json: @feeling\n else\n @errors = @feelings.error.full_messages... | [
"0.6759365",
"0.6236334",
"0.6069841",
"0.59626603",
"0.5945",
"0.59052575",
"0.58893055",
"0.5792679",
"0.5703197",
"0.54381406",
"0.54201496",
"0.5408075",
"0.5404182",
"0.5372743",
"0.53477365",
"0.53181267",
"0.52923554",
"0.5287696",
"0.5279218",
"0.5261609",
"0.52605724... | 0.6599813 | 1 |
PATCH/PUT /feelings/1 PATCH/PUT /feelings/1.json | def update
puts "update #{@feeling.as_json} #{updated_params.as_json}"
respond_to do |format|
if @feeling.update(updated_params)
puts "brucep update success"
#format.html { redirect_to @feeling, notice: 'Feeling was successfully updated.' }
format.html { redirect_to new_feeling_pat... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @feeling = Feeling.find(params[:id])\n\n respond_to do |format|\n if @feeling.update_attributes(params[:feeling])\n format.html { redirect_to @feeling, notice: 'Feeling was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"... | [
"0.7461367",
"0.6571757",
"0.6441113",
"0.6428073",
"0.6328956",
"0.632603",
"0.6290097",
"0.62337244",
"0.62337244",
"0.6231714",
"0.6217275",
"0.6194632",
"0.61911047",
"0.61891526",
"0.61497563",
"0.6148214",
"0.61343247",
"0.61277854",
"0.6121599",
"0.6118495",
"0.6106701... | 0.6957383 | 1 |
DELETE /feelings/1 DELETE /feelings/1.json | def destroy
@feeling.destroy
respond_to do |format|
format.html { redirect_to feelings_url, notice: 'Feeling was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @feeling = Feeling.find(params[:id])\n @feeling.destroy\n\n respond_to do |format|\n format.html { redirect_to feelings_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @feeling = Feeling.find(params[:id])\n @feeling.destroy\n render :ok, json: { feeling... | [
"0.76133984",
"0.75344604",
"0.65957564",
"0.6550693",
"0.65335524",
"0.6480991",
"0.64769334",
"0.64597166",
"0.6458533",
"0.64491343",
"0.6445286",
"0.64166766",
"0.6363522",
"0.6354666",
"0.63456863",
"0.63364524",
"0.63364524",
"0.6334461",
"0.63302004",
"0.63289845",
"0.... | 0.7383988 | 2 |
Use callbacks to share common setup or constraints between actions. | def set_feeling
@feeling = Feeling.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 feeling_params
params.require(:feeling).permit(:feeling_card_id, :super_category, :category, :vfeeling, :experience_id, :note).merge(user_id: current_user.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... | [
"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 |
GET /api/v1/users GET /api/v1/users.json | def index
@users = User.top.publishers.page(params[:page])
render 'api/v1/users/index'
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def users(args = {})\n get(\"/users.json\",args)\n end",
"def list_users\n self.class.get('/users')\n end",
"def GetUsers params = {}\n\n params = params.merge(path: 'users.json')\n APICall(params)\n\n end",
"def index\n if params[:single]\n\t url = \"#{API_BASE_URL}/us... | [
"0.82615596",
"0.8254775",
"0.8235713",
"0.8003468",
"0.796299",
"0.78340375",
"0.7793857",
"0.77717274",
"0.7734692",
"0.7723559",
"0.77133703",
"0.7628978",
"0.76163024",
"0.7598166",
"0.75882965",
"0.7576901",
"0.7547478",
"0.7540626",
"0.7538698",
"0.7493941",
"0.7485545"... | 0.0 | -1 |
GET /api/v1/users/1 GET /api/v1/users/1.json | def show
@user = User.find(params[:id])
render 'api/v1/users/show'
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n if params[:single]\n\t url = \"#{API_BASE_URL}/users/#{params[:id]}.json\"\n\t response = RestClient.get(url)\n\t @user = JSON.parse(response.body)\n\telse\n\t url = \"#{API_BASE_URL}/users.json\"\t \n response = RestClient.get(url)\n @users = JSON.parse(response.body)\t\t \n\tend\n ... | [
"0.8151287",
"0.8034047",
"0.76478434",
"0.75915617",
"0.7531901",
"0.74863833",
"0.7466015",
"0.744585",
"0.73873836",
"0.7288591",
"0.7258942",
"0.7242966",
"0.7240201",
"0.72295207",
"0.7101087",
"0.7100835",
"0.7079742",
"0.70649767",
"0.7059839",
"0.7059183",
"0.7058539"... | 0.7164394 | 14 |
PATCH/PUT /api/v1/users PATCH/PUT /api/v1/users.json | def update
@user = current_user
if @user.update(update_user_params)
render 'api/v1/users/show'
else
render json: @user.errors, status: :unprocessable_entity
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def UpdateUser params = {}\n \n APICall(path: 'users.json',method: 'PUT',payload: params.to_json)\n \n end",
"def update\n render json: Users.update(params[\"id\"], params[\"user\"])\n end",
"def update\n render json: User.update(params[\"id\"], params[\"user\"])\n end",
"de... | [
"0.7434313",
"0.7236834",
"0.7193013",
"0.6878131",
"0.68405676",
"0.6811207",
"0.6806519",
"0.67899346",
"0.6783909",
"0.67625993",
"0.6756856",
"0.6732802",
"0.6732582",
"0.6720031",
"0.6703983",
"0.6685524",
"0.6643247",
"0.66352874",
"0.66240585",
"0.66144943",
"0.6599352... | 0.6410815 | 43 |
Method to set data on an employee | def data()
puts("Please enter the name of the employee")
@name = gets
puts("Now the age")
@age = gets
puts("Finally his social number")
@social_n = gets
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_employee\n if params[:id] != nil\n @employee = Employee.find(params[:id])\n end\n end",
"def set_employee\n @employee = Employee.employee_by_id(params[:id])\n end",
"def set_employee\n @employee = Employee.find_by_id(params[:id])\n end",
"def set_employee\n @e... | [
"0.76264507",
"0.7548999",
"0.7517002",
"0.75157255",
"0.75157255",
"0.75157255",
"0.75157255",
"0.75157255",
"0.75157255",
"0.75157255",
"0.75157255",
"0.75157255",
"0.75157255",
"0.75157255",
"0.75157255",
"0.75157255",
"0.75157255",
"0.75157255",
"0.75157255",
"0.75157255",
... | 0.0 | -1 |
For IronMQ it should just be (message) | def push(message, options = {})
queue_connection.post build_push_message(message, options)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def message(message) end",
"def message\n data.message\n end",
"def message\n @_message\n end",
"def message\n @_message\n end",
"def message( message )\n\tend",
"def message\n @message\n end",
"def message\n @message\n end",
"def message\n to_s\n end",
"def ... | [
"0.7248705",
"0.7103054",
"0.7085352",
"0.7085352",
"0.7065338",
"0.7030131",
"0.7028326",
"0.70136136",
"0.70136136",
"0.7010512",
"0.69814825",
"0.69334686",
"0.69334686",
"0.69334686",
"0.68803793",
"0.6769555",
"0.6768315",
"0.6758436",
"0.6751066",
"0.6746697",
"0.673310... | 0.0 | -1 |
POST /configattribmasters POST /configattribmasters.json | def create
@configattribmaster = Configattribmaster.new(configattribmaster_params)
@configattribmaster.configattrib_id=session[:configattrib_id]
respond_to do |format|
if @configattribmaster.save
format.html { redirect_to @configattribmaster, notice: 'Configattribmaster was successfully create... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_configattribmaster\n @configattribmaster = Configattribmaster.find(params[:id])\n end",
"def update\n respond_to do |format|\n if @configattribmaster.update(configattribmaster_params)\n format.html { redirect_to @configattribmaster, notice: 'Configattribmaster was successfully upda... | [
"0.5887775",
"0.5558511",
"0.55328333",
"0.5384109",
"0.50748706",
"0.50684273",
"0.50166965",
"0.49974224",
"0.49441412",
"0.4910047",
"0.48543125",
"0.48529655",
"0.4835907",
"0.48289785",
"0.48282343",
"0.48208714",
"0.48202655",
"0.4787455",
"0.47615314",
"0.47388837",
"0... | 0.6301413 | 0 |
PATCH/PUT /configattribmasters/1 PATCH/PUT /configattribmasters/1.json | def update
respond_to do |format|
if @configattribmaster.update(configattribmaster_params)
format.html { redirect_to @configattribmaster, notice: 'Configattribmaster was successfully updated.' }
format.json { render :show, status: :ok, location: @configattribmaster }
else
format.... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n respond_to do |format|\n if @configattribincl.update(configattribincl_params)\n format.html { redirect_to @configattribincl, notice: 'Configattribincl was successfully updated.' }\n format.json { render :show, status: :ok, location: @configattribincl }\n else\n format... | [
"0.65170056",
"0.64549184",
"0.6126316",
"0.5971214",
"0.5874343",
"0.5794653",
"0.5685638",
"0.56430316",
"0.55588186",
"0.55306184",
"0.5524135",
"0.5482366",
"0.54755825",
"0.54548186",
"0.54548186",
"0.5424287",
"0.5414935",
"0.5399959",
"0.5382078",
"0.5381866",
"0.53817... | 0.70524836 | 0 |
DELETE /configattribmasters/1 DELETE /configattribmasters/1.json | def destroy
@configattribmaster.destroy
respond_to do |format|
format.html { redirect_to configattribmasters_url, notice: 'Configattribmaster was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @configattribdetail.destroy\n respond_to do |format|\n format.html { redirect_to configattribdetails_url, notice: 'Configattribdetail was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @configattribincl.destroy\n respond_to do |f... | [
"0.6941195",
"0.6915329",
"0.6626266",
"0.6568597",
"0.64137554",
"0.6267224",
"0.6244578",
"0.6243874",
"0.6237131",
"0.6194447",
"0.61931425",
"0.61778295",
"0.6174045",
"0.6165826",
"0.61543965",
"0.6145287",
"0.6133191",
"0.6095352",
"0.6093399",
"0.60883254",
"0.60793537... | 0.74341184 | 0 |
Use callbacks to share common setup or constraints between actions. | def set_configattribmaster
@configattribmaster = Configattribmaster.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 configattribmaster_params
params.require(:configattribmaster).permit(:configattrib_id, :log_time, :param1, :param2, :notified)
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 |
Returns ture or false if user with a particular token exists | def exists
res = {}
if User.find_by_token(params[:token])
res[:status] = "1"
else
res[:status] = "0"
end
render json: res
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def user_present?\n user_token_present? && User.find_by(auth_token: user_token)\n end",
"def checkUser(userToken)\n\n user = User.find_by_token(userToken)\n\n if user\n @@userID = user.id\n return true\n else\n return false\n end\n end",
"def check_current_user(id, token)\n ... | [
"0.80777436",
"0.7838917",
"0.75483584",
"0.74021",
"0.71251607",
"0.70296174",
"0.7019666",
"0.6977171",
"0.6977171",
"0.69661427",
"0.6943281",
"0.694105",
"0.6909042",
"0.6906111",
"0.6892956",
"0.6882963",
"0.6880848",
"0.68692976",
"0.6869242",
"0.68641955",
"0.68320906"... | 0.7348186 | 4 |
Returns account balance of the user | def coins
res = {}
user = User.find_by_token(params[:token])
if user
res[:status] = "0"
res[:coins] = user.coins
else
res[:status] = "1"
end
render json: res
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def account_balance\n response = execute_command('getbalance')\n parse_response(response)['Credit'].to_f\n end",
"def balance\n # If in development, return a mocked amount\n return 1234 if Rails.env.development?\n\n # If in production, fetch the user's balance from Tab.\n @balance || beg... | [
"0.82801056",
"0.8085215",
"0.8069943",
"0.8010713",
"0.78060055",
"0.775474",
"0.7748731",
"0.77145755",
"0.7683603",
"0.7680898",
"0.7678514",
"0.75831467",
"0.7569568",
"0.7547663",
"0.7511534",
"0.75087357",
"0.74803257",
"0.74677896",
"0.7461412",
"0.7448422",
"0.7447005... | 0.0 | -1 |
Returns list of lists with names and emails of the users matching the regex pattern [ [user1,email1], [user2,email2].....] | def user_list
res = {}
users = User.where("lower(name) ~ ?",params[:pattern].downcase)
if users
res[:status] = "0"
res[:users] = users.pluck(:name, :email, :image)
else
res[:status] = "1"
end
render json: res
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_reg_users(guest_emails)\n g_arr = Array.new\n guest_emails.split(\",\").each do |e|\n # add user to guests array\n if user = User.find_by(email: e.strip)\n g_arr << user unless user == current_user\n else\n p \"User with email #{e} not found\"\n # Tell the UserMaile... | [
"0.7057752",
"0.7052805",
"0.68770856",
"0.6854133",
"0.6803691",
"0.66019946",
"0.6520864",
"0.65173745",
"0.6505647",
"0.6505647",
"0.6473199",
"0.6472258",
"0.6456526",
"0.64110893",
"0.6330112",
"0.631976",
"0.6289348",
"0.6278883",
"0.62657005",
"0.6259061",
"0.6251044",... | 0.6310139 | 16 |
Returns the invite code for the user | def invite_code
res = {}
user = User.find_by_token(params[:token])
if user
res[:status] = "0"
res[:invite_code] = user.invite_code
else
res[:status] = "1"
end
render json: res
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def guest_invite_code\n load\n @active_token_value\n end",
"def generate_invite_code\n self.invite_code = generate_token\n end",
"def create_invite_code_for(identifier)\n #if email has been invited before, just update with new code.\n invite = Invite.find_by_identifier(ident... | [
"0.70551866",
"0.6804561",
"0.6572714",
"0.6439567",
"0.6285623",
"0.61842597",
"0.6127676",
"0.60859084",
"0.60319597",
"0.6028113",
"0.5888468",
"0.5876279",
"0.5852079",
"0.5850502",
"0.57593966",
"0.57563716",
"0.57548517",
"0.5744687",
"0.57325625",
"0.5703604",
"0.56872... | 0.75592875 | 0 |
Merge the various header hashes and make sure we carry all of the attributes through instead of overwriting them. | def merge_headers(*headers)
hdr = {}
headers.each do |h|
hdr.merge!(h) do |k, v1, v2|
v1.merge!(v2) if k == :attributes!
end
end
hdr
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def merge_headers(*headers)\r\n hdr = {}\r\n headers.each do |h|\r\n hdr.merge!(h) do |k,v1,v2|\r\n v1.merge!(v2) if k == :attributes!\r\n end\r\n end\r\n hdr\r\n end",
"def merge_headers(*headers)\n hdr = {}\n headers.each do |h|\n hdr.merge!(h) do ... | [
"0.74580884",
"0.74496",
"0.67175037",
"0.67175037",
"0.6498371",
"0.6409787",
"0.63406944",
"0.62466455",
"0.6243946",
"0.6163279",
"0.6161923",
"0.60745895",
"0.6024583",
"0.5944831",
"0.5918004",
"0.5900009",
"0.58792526",
"0.58726746",
"0.58387023",
"0.5809983",
"0.580643... | 0.75650084 | 0 |
Helper methods for SOAP Headers | def resource_uri_shell(shell_uri)
{
"#{SOAP::NS_WSMAN_DMTF}:ResourceURI" => shell_uri, :attributes! => {
"#{SOAP::NS_WSMAN_DMTF}:ResourceURI" => {
'mustUnderstand' => true
}
}
}
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def soap_headers\n { \"Content-Type\" => ContentType[@soap.version], \"SOAPAction\" => @soap.action }\n end",
"def soap_headers\n @soap_headers ||= {}\n @soap_headers.merge!(:client_id => @client_id) if @client_id\n @soap_headers\n end",
"def format_headers(nfg_method, soap_request)\n {\... | [
"0.7690824",
"0.75773424",
"0.7324002",
"0.72506416",
"0.72506416",
"0.72506416",
"0.72506416",
"0.7204436",
"0.71862566",
"0.715495",
"0.7147141",
"0.71154565",
"0.7091316",
"0.7091316",
"0.7091316",
"0.7091316",
"0.7091316",
"0.7091316",
"0.7091316",
"0.7091316",
"0.7091316... | 0.0 | -1 |
Use callbacks to share common setup or constraints between actions. | def set_product_category
@product_category = ProductCategory.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 trusted parameter "white list" through. | def product_category_params
params.require(:product_category).permit(:name, :description)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def allowed_params\n ALLOWED_PARAMS\n end",
"def expected_permitted_parameter_names; end",
"def param_whitelist\n [:role, :title]\n end",
"def default_param_whitelist\n [\"mode\"]\n end",
"def permitir_parametros\n \t\tparams.permit!\n \tend",
"def permitted_params\n []\n end",
... | [
"0.7121987",
"0.70541996",
"0.69483954",
"0.6902367",
"0.6733912",
"0.6717838",
"0.6687021",
"0.6676254",
"0.66612333",
"0.6555296",
"0.6527056",
"0.6456324",
"0.6450841",
"0.6450127",
"0.6447226",
"0.6434961",
"0.64121825",
"0.64121825",
"0.63913447",
"0.63804525",
"0.638045... | 0.0 | -1 |
Public user can execute public actions, but when they try executing an administrator action they are redirected to login. | def test_action_security
# A public action
get '/goldberg/auth/login'
assert_response :success
# An administrator action
get '/goldberg/users/list'
assert_redirected_to_login
form_login('admin', 'admin')
get '/goldberg/users/list'
assert_response :success
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def authorized\n\t unless admin?\n\t redirect_to root_path\n\t end\n end",
"def restrict_access\n redirect_to root_path if is_superuser_or_admin? == false\n end",
"def authorize_access\n redirect_to admin_sites_url unless @site || current_user.admin?\n end",
"def authorize_as_admin\n ... | [
"0.75311565",
"0.75057834",
"0.74983966",
"0.74750775",
"0.74739236",
"0.7411954",
"0.7411954",
"0.74073493",
"0.7405817",
"0.74037904",
"0.7402794",
"0.7364153",
"0.73289114",
"0.7299788",
"0.728256",
"0.72791654",
"0.72744316",
"0.7257032",
"0.72543997",
"0.7248431",
"0.723... | 0.0 | -1 |
Public user can view public pages, but when they try accessing an administrator page they are redirected to login. | def test_page_security
# A public page
get '/home'
assert_response :success
# An administrator page
get '/admin'
assert_redirected_to_login
form_login('admin', 'admin')
get '/admin'
assert_response :success
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def enforce_public\n return unless current_user\n\n Rails.logger.info('Authenticated user accessing public page - redirecting to dashboard')\n redirect_to dashboard_url\n end",
"def restrict_access\n redirect_to root_path if is_superuser_or_admin? == false\n end",
"def protected!\n red... | [
"0.8071529",
"0.7706886",
"0.76297265",
"0.76124585",
"0.7576573",
"0.7482726",
"0.74650884",
"0.7463724",
"0.743466",
"0.7375773",
"0.7372433",
"0.7372433",
"0.73582006",
"0.73498696",
"0.7314961",
"0.731379",
"0.7306649",
"0.730643",
"0.72997963",
"0.72693384",
"0.7267942",... | 0.0 | -1 |
If a public user tries to access a resource for which they lack authorisation, after logging in they should be redirected to that resource. | def test_pending_request
get '/goldberg/users/list'
assert_redirected_to_login
form_login('admin', 'admin')
assert_match /goldberg\/users\/list/, response.redirected_to
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def authorized\n redirect_to \"/login\" unless logged_in? \n end",
"def user_authorized\n redirect_to \"/\" unless session[:user_id]\n end",
"def authorized_user!\n unless user_logged_in?\n redirect_to root_path\n end\n end",
"def access_denied\n if @current_user\n render_401... | [
"0.758611",
"0.7504794",
"0.74233174",
"0.7407618",
"0.7378123",
"0.7367375",
"0.7367191",
"0.7359354",
"0.7358923",
"0.734325",
"0.7305841",
"0.7301115",
"0.7300637",
"0.73004067",
"0.72924054",
"0.72844464",
"0.728125",
"0.72680247",
"0.72530025",
"0.7252687",
"0.7252687",
... | 0.0 | -1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.