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 |
|---|---|---|---|---|---|---|
Shut down a stream. | def cancel stream_id, code
# TODO: @streams[stream_id].close_local!
g = Frame.new FrameTypes::RST_STREAM, 0x00, stream_id, [code].pack('N')
send_frame g
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def stream_close\n self[STREAM_CLOSE].call\n end",
"def shutdown\n if @out.respond_to?(:close)\n Log.debug(\"close, #{@out.inspect}\")\n @out.close\n end\n end",
"def close\n close_stream\n end",
"def shutdown\n connection.write(\"shutdown\")\n ... | [
"0.6846515",
"0.6720754",
"0.6612288",
"0.6547716",
"0.644275",
"0.6429142",
"0.6392803",
"0.63903385",
"0.6379166",
"0.6375019",
"0.6326812",
"0.6320638",
"0.63201",
"0.6299269",
"0.628928",
"0.6247632",
"0.6221675",
"0.62196195",
"0.62176603",
"0.6192461",
"0.61751944",
"... | 0.0 | -1 |
triggered when a new H2 frame arrives | def recv_frame f
if @first_frame_in
# first frame has to be settings
# FIXME: make sure this is the actual settings, not the ACK to ours
# RFC 7540, Section 3.5
# "Clients and servers MUST treat an invalid connection preface
# as a connection error (Section 5.4.1) of type
# PROTOCOL_ERROR."
raise ConnectionError.new(PROTOCOL_ERROR, 'invalid preface - no SETTINGS') if f.type != FrameTypes::SETTINGS
@first_frame_in = false
end
if @goaway
case f.type
when FrameTypes::DATA
when FrameTypes::HEADERS
when FrameTypes::PUSH_PROMISE
when FrameTypes::CONTINUATION
when FrameTypes::GZIPPED_DATA
when FrameTypes::DROPPED_FRAME
else
# FIXME
@logger.warn "Ignoring frame 0x#{f.type.to_s 16} after GOAWAY"
return
end
end
case f.type
when FrameTypes::DATA
handle_data f
when FrameTypes::HEADERS
handle_headers f
when FrameTypes::PRIORITY
handle_priority f
when FrameTypes::RST_STREAM
handle_rst_stream f
when FrameTypes::SETTINGS
handle_settings f
when FrameTypes::PUSH_PROMISE
handle_push_promise f
when FrameTypes::PING
handle_ping f
when FrameTypes::GOAWAY
handle_goaway f
when FrameTypes::WINDOW_UPDATE
handle_window_update f
when FrameTypes::CONTINUATION
# never emitted by the Hook
raise 'unexpected CONTINUATION frame'
# EXTENSION FRAME HANDLING
when FrameTypes::GZIPPED_DATA
handle_gzipped_data f
when FrameTypes::DROPPED_FRAME
handle_dropped_frame f
else
# ignore unrecognised/extension frames
drop_frame f
end
rescue ConnectionError => e
@logger.info "connection error [#{e.code}:#{e}] in client #{@descr} {3}"
die e.code
rescue StreamError => e
@logger.info "stream error [#{e.code}:#{e.stream}:#{e}] in client #{@descr}"
cancel e.stream, e.code
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def on_helo_event(ctx, helo_data); end",
"def handle_frame(*params)\n video = connection.receive_data\n publish(event_topic_name(\"update\"), \"video\", video)\n publish(event_topic_name(\"frame\"), video.frame)\n end",
"def on_helo_event(ctx, helo_data) end",
"def h_2!\n # -> ... | [
"0.5566477",
"0.5552477",
"0.5523484",
"0.5520057",
"0.5425172",
"0.5355866",
"0.52813625",
"0.52813625",
"0.52813625",
"0.5226536",
"0.52250487",
"0.515683",
"0.5148552",
"0.5117584",
"0.5104847",
"0.50481784",
"0.5023244",
"0.50119907",
"0.5004341",
"0.50010365",
"0.4994644... | 0.0 | -1 |
tell the peer we ignored it | def drop_frame f
if !@ext__sent_dropped_frame[f.type]
@ext__sent_dropped_frame[f.type] = true
g = Frame.new FrameTypes::DROPPED_FRAME, 0x00, 0, [f.type].pack('C')
send_frame g
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def on_non_directed_message(message, speaker, buddy, command_executed)\n #at this stage we do nothing...\n end",
"def ignore!\n self.ignored = true\n end",
"def ignore\n @ignore = true\n end",
"def ignore\n @ignore = true\n end",
"def discard!\n ... | [
"0.64901257",
"0.6412995",
"0.6347565",
"0.6322945",
"0.6299946",
"0.62176156",
"0.61456174",
"0.6140341",
"0.60764843",
"0.60144955",
"0.59870857",
"0.59659874",
"0.5960402",
"0.5959419",
"0.59091693",
"0.58741677",
"0.5871683",
"0.58613896",
"0.5841756",
"0.5838762",
"0.583... | 0.0 | -1 |
triggered when a completed HTTP message arrives (farms it off to the registered callback) | def emit_message sid, stream
# NB: this function only invoked once we get an END_STREAM flag
stream.close_remote!
@last_stream = sid
headers = stream.headers
mandatory_headers = mandatory_pseudoheaders
nonpseudo_headers = false
malformed_headers = catch(:MALFORMED) do
headers.each_pair do |k, v|
throw :MALFORMED, "uppercase header #{k.inspect}" unless k.downcase == k
if k.start_with? ':'
throw :MALFORMED, "invalid pseudo-header #{k.inspect}" unless allowed_pseudoheader? k
throw :MALFORMED, "pseudo-header after regular header" if nonpseudo_headers
throw :MALFORMED, "repeated pseudo-header" if v.is_a?(Array) && v.length > 1
mandatory_headers.delete k
else
nonpseudo_headers = true
case k
when 'connection'
throw :MALFORMED, "\"connection\" header"
when 'te'
throw :MALFORMED, "invalid \"te\" header" unless v == '' || v.downcase == 'trailers'
end
end
end
nil
end
# missing mandatory pseudo-headers
malformed_headers ||= "missing mandatory pseudo-headers #{mandatory_headers.inspect}" unless mandatory_headers.empty?
# RFC 7540, Section 8.1.2
# "A request or response containing uppercase header field
# names MUST be treated as malformed ..."
# > S8.1.2.6 "Malformed requests ... MUST be treated as a
# stream error ..."
raise StreamError.new(PROTOCOL_ERROR, sid, "malformed message: #{malformed_headers}") if malformed_headers
# RFC 7540, Section 8.1.2.6
# "A request or response is also malformed if the value of a
# content-length header field does not equal the sum of the DATA
# frame payload lengths that form the body."
cl = headers['content-length']
raise StreamError.new(PROTOCOL_ERROR, sid, "malformed message: content-length #{cl.inspect}, expected #{stream.body.bytesize}") if cl and (Integer(cl) rescue -1) != stream.body.bytesize
_do_emit sid, headers, stream.body
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def on_message_complete\n @finished = true\n end",
"def on_message_complete\n send_response\n close_socket\n write_to_screen\n end",
"def on_finished(&block)\n @finished_handler = block\n end",
"def finish_response; end",
"def handlers_completed\n end",
"def on_finished... | [
"0.7133765",
"0.6825107",
"0.68248385",
"0.67794",
"0.67699605",
"0.6753991",
"0.6734238",
"0.6504002",
"0.6470272",
"0.6453286",
"0.64127564",
"0.6391106",
"0.6345263",
"0.63216937",
"0.6307912",
"0.6234946",
"0.62248695",
"0.6198725",
"0.6183158",
"0.6182577",
"0.61782336",... | 0.0 | -1 |
triggered when a stream is cancelled (RST_STREAM) | def emit_cancel sid, error
@cancel_proc.call sid, error if @cancel_proc
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cancel stream_id, code\n # TODO: @streams[stream_id].close_local!\n g = Frame.new FrameTypes::RST_STREAM, 0x00, stream_id, [code].pack('N')\n send_frame g\n end",
"def cancel()\n @callback = nil\n @cancelled = true\n end",
"def stop_all_streams; end",
"def cancelled?; end",... | [
"0.741806",
"0.65571564",
"0.65128267",
"0.64735764",
"0.6469966",
"0.6469108",
"0.6425561",
"0.6396142",
"0.6396142",
"0.63609236",
"0.6348107",
"0.6285297",
"0.62592465",
"0.62592465",
"0.6246117",
"0.6207932",
"0.620155",
"0.6153716",
"0.6151282",
"0.61459184",
"0.6110414"... | 0.652337 | 2 |
new function to set the password without knowing the current password used in our confirmation controller. | def attempt_set_password(params)
p = {}
p[:password] = params[:password]
p[:password_confirmation] = params[:password_confirmation]
update_attributes(p)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def password=(new_password); end",
"def password_set(password)\n self.password.set password\n self.passwordconfirm.set password\n end",
"def set_password\n @password = Password.last\n @new_password = Password.new\n end",
"def set_password; nil; end",
"def set_new_password \n ... | [
"0.8250233",
"0.81630933",
"0.7915941",
"0.7883785",
"0.7852942",
"0.781907",
"0.77806485",
"0.77640253",
"0.7739314",
"0.7727213",
"0.77190316",
"0.7670281",
"0.7634641",
"0.7623225",
"0.761761",
"0.7601502",
"0.7597661",
"0.7597661",
"0.7597661",
"0.75880957",
"0.75880957",... | 0.7490439 | 63 |
new function to return whether a password has been set | def has_no_password?
self.encrypted_password.blank?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def password?\n password\n end",
"def valid_password?(password); end",
"def password_present?\n return self.password\n end",
"def password_required?\n new? or password\n end",
"def password_required?\n new? or password\n end",
"def valid_password?; end",
"def has_password?\n encr... | [
"0.8368719",
"0.8306715",
"0.8158366",
"0.8109824",
"0.8102572",
"0.80512345",
"0.80399185",
"0.8039435",
"0.80136216",
"0.79841316",
"0.7973115",
"0.7957743",
"0.7953654",
"0.7953654",
"0.7941312",
"0.7939082",
"0.7929907",
"0.7916777",
"0.79076153",
"0.78981304",
"0.7893610... | 0.0 | -1 |
Devise::Models:unless_confirmed` method doesn't exist in Devise 2.0.0 anymore. Instead you should use `pending_any_confirmation`. | def only_if_unconfirmed
pending_any_confirmation {yield}
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def skip_confirmation_auth \n if self.provider\n self.skip_confirmation_notification! \n self.confirmed_at = Time.now\n end\n end",
"def only_if_unconfirmed\n pending_any_confirmation { yield }\n end",
"def only_if_unconfirmed\n pending_any_confirmation { yield }\n end",
"def only_if_unconf... | [
"0.74534804",
"0.68441474",
"0.68441474",
"0.68441474",
"0.68441474",
"0.68441474",
"0.6812012",
"0.6812012",
"0.6812012",
"0.6812012",
"0.6812012",
"0.6812012",
"0.6812012",
"0.6812012",
"0.6812012",
"0.6812012",
"0.6812012",
"0.6812012",
"0.6812012",
"0.6812012",
"0.6812012... | 0.6826165 | 6 |
Adds a new callback | def add(login, wallet, prefix, regexp, uri)
puts @pgsql.exec('SELECT * FROM callback')
# exit
total = @pgsql.exec('SELECT COUNT(*) FROM callback WHERE login = $1', [login])[0]['count'].to_i
raise UserError, "You have too many of them already: #{total}" if total >= 8
cid = @pgsql.exec(
[
'INSERT INTO callback (login, wallet, prefix, regexp, uri)',
'VALUES ($1, $2, $3, $4, $5)',
'RETURNING id'
].join(' '),
[login, wallet, prefix, regexp, uri]
)[0]['id'].to_i
@log.info("New callback ##{cid} registered by @#{login} for wallet #{wallet}, \
prefix \"#{prefix}\", regexp #{regexp}, and URI: #{uri}")
cid
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def insert_callback(&block)\n @callbacks << block\n end",
"def add_callback(type, options, &block); end",
"def callback(&block)\n @callbacks << block\n end",
"def append_callback(callback_name, &callback)\n connection.append_callback(callback_name, callback)\n end",
"def add_cal... | [
"0.81014997",
"0.80793417",
"0.79236585",
"0.7770657",
"0.77510977",
"0.77123874",
"0.7526772",
"0.7329962",
"0.7290012",
"0.72719646",
"0.72719646",
"0.71921736",
"0.7188636",
"0.71737903",
"0.7154294",
"0.7111245",
"0.7111245",
"0.7111245",
"0.7111245",
"0.71009904",
"0.708... | 0.0 | -1 |
Returns the list of IDs of matches found | def match(wallet, prefix, details)
found = []
@pgsql.exec('SELECT * FROM callback WHERE wallet = $1 AND prefix = $2', [wallet, prefix]).each do |r|
next unless Regexp.new(r['regexp']).match?(details)
id = @pgsql.exec(
'INSERT INTO match (callback) VALUES ($1) ON CONFLICT (callback) DO NOTHING RETURNING id',
[r['id'].to_i]
)
next if id.empty?
mid = id[0]['id'].to_i
found << mid
@log.info("Callback ##{r['id']} just matched in #{wallet}/#{prefix} with \"#{details}\", match ##{mid}")
end
found
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def matches\n @matches ||= []\n end",
"def matched_identities\n @matched_identities ||= @provider_identity.find_records\n end",
"def matches()\n sql = \"SELECT matches.* FROM matches WHERE away_team_id = #{@id} OR home_team_id = #{@id};\"\n matches = SqlRunner.run( sql )\n result =... | [
"0.67075837",
"0.65926355",
"0.6243506",
"0.62410814",
"0.6193099",
"0.61323595",
"0.61249554",
"0.6111172",
"0.6090769",
"0.60560113",
"0.6028848",
"0.6011612",
"0.6005121",
"0.60022587",
"0.5977436",
"0.5974049",
"0.59479386",
"0.5894848",
"0.5894351",
"0.5865732",
"0.58566... | 0.0 | -1 |
does the questions table need an answer_id to make this connection work? generate question objects that are associated to quiz by question_id | def create_question
question_hash = Adapter.quiz_api(difficulty) #use adapter method, with difficulty passes into the url as a variable, to gnerate a new list of questions.
new_question = Question.new #make a new question instance
new_question.save #save now so we can store the question's id in the answer by calling self.id
new_question.content = question_hash['question'] #adding all necessary column data to this question object/row
new_question.create_answers(question_hash)
new_question.quiz_id = self.id
new_question.save #send the newly created question to the database
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def questions\n results = CONNECTION.execute(\"SELECT * FROM questions WHERE student_id = #{@id};\")\n \n results_as_objects = []\n \n results.each do |result_hash|\n results_as_objects << Question.new(result_hash[\"id\"], result_hash[\"student_id\"], result_hash[\"content\"])\n end\n \n ... | [
"0.7032894",
"0.67263997",
"0.6716732",
"0.644409",
"0.6424999",
"0.6343684",
"0.6338102",
"0.62696993",
"0.62696993",
"0.6223113",
"0.6167304",
"0.61640286",
"0.614915",
"0.61425966",
"0.6113575",
"0.6096051",
"0.6089674",
"0.60862046",
"0.6074964",
"0.6073646",
"0.60510755"... | 0.701326 | 1 |
To handle the internal_surveys, some surveys are started via different actions in the people_controller | def determine_consent_activity_path(person, activity, survey, contact_link)
case survey.title
when "IRB_CON_Informed_Consent", "IRB_CON_Reconsent", "IRB_CON_Withdrawal"
start_consent_person_path(person, :participant_id => activity.participant.id,
:survey_access_code => survey.access_code,
:contact_link_id => contact_link.id)
when "IRB_CON_NonInterviewReport"
start_non_interview_report_person_path(person, :participant_id => activity.participant.id,
:survey_access_code => survey.access_code,
:contact_link_id => contact_link.id)
else
start_instrument_person_path(person, :participant_id => activity.participant.id,
:references_survey_access_code => activity.references.to_s,
:survey_access_code => survey.access_code,
:contact_link_id => contact_link.id)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def goto_surveys\n goto_controller('Assignment Survey')\n end",
"def goto_course_surveys\n goto_controller('Course Survey')\n end",
"def goto_global_survey\n goto_controller('Global Survey')\n end",
"def surveyWorkflow\n survey_status = session[:survey_status]\n \n case survey_status\n ... | [
"0.68029886",
"0.62881535",
"0.62613386",
"0.61485803",
"0.614344",
"0.6079169",
"0.6018612",
"0.59907675",
"0.5984553",
"0.59085006",
"0.59039104",
"0.5899586",
"0.5803739",
"0.5792714",
"0.57909125",
"0.5778259",
"0.57562053",
"0.5747111",
"0.5746988",
"0.57394254",
"0.5732... | 0.0 | -1 |
Add a new vehicle | def add_vehicle(body, opts = {})
add_vehicle_with_http_info(body, opts)
return nil
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def addVehicle _obj, _args\n \"_obj addVehicle _args;\" \n end",
"def create\n @vehicle=Vehicle.find_or_create_by(vehicle_params)\n end",
"def create\n @vehicle = Vehicle.new(vehicle_params)\n\n respond_to do |format|\n if @vehicle.save\n format.html { redirect_to @vehicle, no... | [
"0.7512086",
"0.7509933",
"0.73035157",
"0.73035157",
"0.73035157",
"0.72753036",
"0.72546947",
"0.72368264",
"0.71539927",
"0.70501333",
"0.69899243",
"0.6952996",
"0.6945067",
"0.6922338",
"0.69045883",
"0.68687505",
"0.6833409",
"0.6791883",
"0.6751762",
"0.67360276",
"0.6... | 0.74116766 | 2 |
Add a new vehicle | def add_vehicle_with_http_info(body, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug "Calling API: VehicleApi.add_vehicle ..."
end
# verify the required parameter 'body' is set
if @api_client.config.client_side_validation && body.nil?
fail ArgumentError, "Missing the required parameter 'body' when calling VehicleApi.add_vehicle"
end
# resource path
local_var_path = "/vehicle"
# query parameters
query_params = {}
# header parameters
header_params = {}
# HTTP header 'Accept' (if needed)
header_params['Accept'] = @api_client.select_header_accept(['application/xml', 'application/json'])
# HTTP header 'Content-Type'
header_params['Content-Type'] = @api_client.select_header_content_type(['application/json', 'application/xml'])
# form parameters
form_params = {}
# http body (model)
post_body = @api_client.object_to_http_body(body)
auth_names = ['vehiclegarage_auth']
data, status_code, headers = @api_client.call_api(:POST, local_var_path,
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,
:body => post_body,
:auth_names => auth_names)
if @api_client.config.debugging
@api_client.config.logger.debug "API called: VehicleApi#add_vehicle\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def addVehicle _obj, _args\n \"_obj addVehicle _args;\" \n end",
"def create\n @vehicle=Vehicle.find_or_create_by(vehicle_params)\n end",
"def add_vehicle(body, opts = {})\n add_vehicle_with_http_info(body, opts)\n return nil\n end",
"def create\n @vehicle = Vehicle.new(vehicl... | [
"0.7512086",
"0.7509933",
"0.74116766",
"0.73035157",
"0.73035157",
"0.73035157",
"0.72753036",
"0.72546947",
"0.72368264",
"0.71539927",
"0.70501333",
"0.69899243",
"0.6952996",
"0.6945067",
"0.6922338",
"0.69045883",
"0.68687505",
"0.6833409",
"0.6791883",
"0.6751762",
"0.6... | 0.6570017 | 30 |
Find vehicle by ID Returns a single vehicle | def get_vehicle_by_id(vehicle_id, opts = {})
data, _status_code, _headers = get_vehicle_by_id_with_http_info(vehicle_id, opts)
return data
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def vehicle()\n sql = \"SELECT * FROM vehicles INNER JOIN rentals ON rentals.vehicle_id\n = vehicles.id WHERE rentals.id = $1\"\n values = [@id]\n result = SqlRunner.run(sql, values)[0]\n return Vehicle.new(result)\n end",
"def get(id)\n record = @dao.read(id)\n record_to_vehicle(... | [
"0.7599343",
"0.75089073",
"0.74935037",
"0.71453893",
"0.71277475",
"0.70305127",
"0.69990027",
"0.6963956",
"0.695047",
"0.6929321",
"0.6928588",
"0.691262",
"0.68311274",
"0.68311274",
"0.68311274",
"0.68311274",
"0.68311274",
"0.68311274",
"0.68311274",
"0.68311274",
"0.6... | 0.0 | -1 |
Find vehicle by ID Returns a single vehicle | def get_vehicle_by_id_with_http_info(vehicle_id, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug "Calling API: VehicleApi.get_vehicle_by_id ..."
end
# verify the required parameter 'vehicle_id' is set
if @api_client.config.client_side_validation && vehicle_id.nil?
fail ArgumentError, "Missing the required parameter 'vehicle_id' when calling VehicleApi.get_vehicle_by_id"
end
# resource path
local_var_path = "/vehicle/{vehicleId}".sub('{' + 'vehicleId' + '}', vehicle_id.to_s)
# query parameters
query_params = {}
# header parameters
header_params = {}
# HTTP header 'Accept' (if needed)
header_params['Accept'] = @api_client.select_header_accept(['application/xml', 'application/json'])
# form parameters
form_params = {}
# http body (model)
post_body = nil
auth_names = ['api_key']
data, status_code, headers = @api_client.call_api(:GET, local_var_path,
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,
:body => post_body,
:auth_names => auth_names,
:return_type => 'Vehicle')
if @api_client.config.debugging
@api_client.config.logger.debug "API called: VehicleApi#get_vehicle_by_id\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def vehicle()\n sql = \"SELECT * FROM vehicles INNER JOIN rentals ON rentals.vehicle_id\n = vehicles.id WHERE rentals.id = $1\"\n values = [@id]\n result = SqlRunner.run(sql, values)[0]\n return Vehicle.new(result)\n end",
"def get(id)\n record = @dao.read(id)\n record_to_vehicle(... | [
"0.7599343",
"0.75089073",
"0.74935037",
"0.71453893",
"0.71277475",
"0.70305127",
"0.69990027",
"0.6963956",
"0.695047",
"0.6929321",
"0.6928588",
"0.691262",
"0.68311274",
"0.68311274",
"0.68311274",
"0.68311274",
"0.68311274",
"0.68311274",
"0.68311274",
"0.68311274",
"0.6... | 0.0 | -1 |
Update an existing vehicle | def update_vehicle(body, opts = {})
update_vehicle_with_http_info(body, opts)
return nil
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n if @vehicle.update(vehicle_params)\n redirect_to @vehicle, notice: 'Vehicle was successfully updated.'\n else\n render :edit\n end\n end",
"def update\n if @vehicle.update(vehicle_params)\n render json: { status: 'Vehicle was successfully updated', vehicle: @vehicle }, st... | [
"0.7814475",
"0.7809251",
"0.78012484",
"0.7762433",
"0.7755087",
"0.7755087",
"0.76520824",
"0.763282",
"0.763282",
"0.763282",
"0.757407",
"0.75501186",
"0.7520261",
"0.7520261",
"0.7490543",
"0.7260161",
"0.72100323",
"0.7145258",
"0.7145258",
"0.7121304",
"0.70999664",
... | 0.6951491 | 25 |
Update an existing vehicle | def update_vehicle_with_http_info(body, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug "Calling API: VehicleApi.update_vehicle ..."
end
# verify the required parameter 'body' is set
if @api_client.config.client_side_validation && body.nil?
fail ArgumentError, "Missing the required parameter 'body' when calling VehicleApi.update_vehicle"
end
# resource path
local_var_path = "/vehicle"
# query parameters
query_params = {}
# header parameters
header_params = {}
# HTTP header 'Accept' (if needed)
header_params['Accept'] = @api_client.select_header_accept(['application/xml', 'application/json'])
# HTTP header 'Content-Type'
header_params['Content-Type'] = @api_client.select_header_content_type(['application/json', 'application/xml'])
# form parameters
form_params = {}
# http body (model)
post_body = @api_client.object_to_http_body(body)
auth_names = ['vehiclegarage_auth']
data, status_code, headers = @api_client.call_api(:PUT, local_var_path,
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,
:body => post_body,
:auth_names => auth_names)
if @api_client.config.debugging
@api_client.config.logger.debug "API called: VehicleApi#update_vehicle\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n if @vehicle.update(vehicle_params)\n redirect_to @vehicle, notice: 'Vehicle was successfully updated.'\n else\n render :edit\n end\n end",
"def update\n if @vehicle.update(vehicle_params)\n render json: { status: 'Vehicle was successfully updated', vehicle: @vehicle }, st... | [
"0.7814475",
"0.7809251",
"0.78012484",
"0.7762433",
"0.7755087",
"0.7755087",
"0.76520824",
"0.763282",
"0.763282",
"0.763282",
"0.757407",
"0.75501186",
"0.7520261",
"0.7520261",
"0.7490543",
"0.7260161",
"0.72100323",
"0.7145258",
"0.7145258",
"0.7121304",
"0.70999664",
... | 0.6607186 | 58 |
Updates a vehicle in the garage with form data | def update_vehicle_with_form(vehicle_id, opts = {})
update_vehicle_with_form_with_http_info(vehicle_id, opts)
return nil
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n if @vehicle.update(vehicle_params)\n redirect_to @vehicle, notice: 'Vehicle was successfully updated.'\n else\n render :edit\n end\n end",
"def update\n respond_to do |format|\n if @vehicle.update(vehicle_params)\n format.html { redirect_to @vehicle, notice: 'Vehic... | [
"0.7319538",
"0.72641045",
"0.7183325",
"0.7183325",
"0.7183325",
"0.7138628",
"0.71367556",
"0.7109435",
"0.7054036",
"0.7054036",
"0.7011052",
"0.6896129",
"0.687501",
"0.68493056",
"0.68493056",
"0.6833592",
"0.6833592",
"0.68106824",
"0.67963856",
"0.6773562",
"0.67497766... | 0.0 | -1 |
Updates a vehicle in the garage with form data | def update_vehicle_with_form_with_http_info(vehicle_id, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug "Calling API: VehicleApi.update_vehicle_with_form ..."
end
# verify the required parameter 'vehicle_id' is set
if @api_client.config.client_side_validation && vehicle_id.nil?
fail ArgumentError, "Missing the required parameter 'vehicle_id' when calling VehicleApi.update_vehicle_with_form"
end
# resource path
local_var_path = "/vehicle/{vehicleId}".sub('{' + 'vehicleId' + '}', vehicle_id.to_s)
# query parameters
query_params = {}
# header parameters
header_params = {}
# HTTP header 'Accept' (if needed)
header_params['Accept'] = @api_client.select_header_accept(['application/xml', 'application/json'])
# HTTP header 'Content-Type'
header_params['Content-Type'] = @api_client.select_header_content_type(['application/x-www-form-urlencoded'])
# form parameters
form_params = {}
form_params["name"] = opts[:'name'] if !opts[:'name'].nil?
form_params["vehicletype"] = opts[:'vehicletype'] if !opts[:'vehicletype'].nil?
# http body (model)
post_body = nil
auth_names = ['vehiclegarage_auth']
data, status_code, headers = @api_client.call_api(:POST, local_var_path,
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,
:body => post_body,
:auth_names => auth_names)
if @api_client.config.debugging
@api_client.config.logger.debug "API called: VehicleApi#update_vehicle_with_form\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n if @vehicle.update(vehicle_params)\n redirect_to @vehicle, notice: 'Vehicle was successfully updated.'\n else\n render :edit\n end\n end",
"def update\n respond_to do |format|\n if @vehicle.update(vehicle_params)\n format.html { redirect_to @vehicle, notice: 'Vehic... | [
"0.7319538",
"0.72641045",
"0.7183325",
"0.7183325",
"0.7183325",
"0.7138628",
"0.71367556",
"0.7109435",
"0.7054036",
"0.7054036",
"0.7011052",
"0.6896129",
"0.687501",
"0.68493056",
"0.68493056",
"0.6833592",
"0.6833592",
"0.68106824",
"0.67963856",
"0.6773562",
"0.67497766... | 0.65430206 | 34 |
Public: Prevents sensitive data from being logged | def sql_with_postgres_pgp(event)
filter = /(pgp_sym_(encrypt|decrypt))\(((.|\n)*?)\)/i
event.payload[:sql] = event.payload[:sql].gsub(filter) do |_|
"#{$1}([FILTERED])"
end
sql_without_postgres_pgp(event)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def logger\n params[:secure] ? nil : super\n end",
"def logged?; false end",
"def logged?; false end",
"def logged?;\n false\n end",
"def safe; end",
"def secure?\n #debugger\n false\n end",
"def logging_prefs; end",
"def log_without_unused_attrs(log)\n log.select! { |k| k == 'c... | [
"0.6699917",
"0.6543605",
"0.6543605",
"0.6351119",
"0.60259545",
"0.60082334",
"0.5939371",
"0.59335285",
"0.59334844",
"0.5888962",
"0.5828944",
"0.5785802",
"0.5785058",
"0.5757186",
"0.5757186",
"0.5757186",
"0.5757186",
"0.5757186",
"0.5757186",
"0.5757186",
"0.5757186",... | 0.0 | -1 |
Centroid of an empty should return an empty collection rather than throw a weird exception out of ffigeos | def test_empty_centroid
assert_equal(@factory.collection([]), @factory.multi_polygon([]).centroid)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def centroid\n return @centroid if defined?(@centroid)\n\n cx, cy = 0, 0\n\n (0...vertices.length).each do |i|\n prev = vertices[i - 1]\n curr = vertices[i]\n\n v = prev.x * curr.y - curr.x * prev.y\n cx += v * (prev.x + curr.x)\n cy += v * (prev.y ... | [
"0.6222692",
"0.60607773",
"0.5992386",
"0.5939178",
"0.58846116",
"0.58846116",
"0.5828418",
"0.57966566",
"0.5743518",
"0.57348335",
"0.57344866",
"0.56697625",
"0.56311977",
"0.56003714",
"0.56003714",
"0.56003714",
"0.55759805",
"0.55759805",
"0.55273706",
"0.5524584",
"0... | 0.79611725 | 0 |
Method to validate user answer | def validate_answer
skip_authorization
active_cell = @play.cell_active
return unless active_cell
if active_cell.npc.correct_answer?(params[:answer])
@play.active_next_cell
@play.check_if_game_over
render json: { message: random_phrase_correct(@play), correct: true }
else
render json: { message: "#{random_phrase_incorrect_and_tip(@play)}<br><br>#{active_cell.npc.question}",
correct: false }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def validate_answer(answer)\n end",
"def validate_answer(answer)\n answer == @result\n end",
"def validate_answer(answer)\n if rules[:presence] == \"1\"\n answer.validates_presence_of :answer_text\n end\n\n if rules[:minimum].present? || rules[:maximum].present?\n mi... | [
"0.88483614",
"0.80566174",
"0.7434427",
"0.7434427",
"0.7434427",
"0.7133763",
"0.70523155",
"0.7044562",
"0.704156",
"0.6935951",
"0.6926468",
"0.69052166",
"0.6902254",
"0.688688",
"0.68093103",
"0.68015313",
"0.6789832",
"0.6789149",
"0.67777896",
"0.6724738",
"0.67169636... | 0.75790596 | 2 |
API to request infos about the play | def update_infos
skip_authorization
respond_to do |format|
format.json do
render json: hashing_infos
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getinfo\n @api.request 'getinfo'\n end",
"def info\n get(\"/api-info\")\n end",
"def show\n # puts \"PARAMSSSSS CONTROLLER #{params[:id]}\"\n url = \"https://api-2445582011268.apicast.io/games/#{params[:id]}\"\n response = HTTParty.get(url, headers: {\"user-key\" => Figaro.env.igdb... | [
"0.67480403",
"0.674038",
"0.67014307",
"0.66755074",
"0.6642902",
"0.65461016",
"0.6545603",
"0.6538762",
"0.6490063",
"0.64303094",
"0.6324526",
"0.63166666",
"0.6308883",
"0.6292306",
"0.6249913",
"0.6213457",
"0.61989605",
"0.61893845",
"0.61839795",
"0.61562467",
"0.6151... | 0.0 | -1 |
API to request a random speach of Robert with a direction to user | def random_roberto_speech
skip_authorization
respond_to do |format|
format.json do
render json: { roberto_speech: "#{RobertoBarros.in_ingrish} #{direction_for_active_cell(@play)}" }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def greeting\n random_response(:greeting)\n end",
"def farewell\n random_response(:farewell)\n end",
"def greeting\n\t\trandom_response(:greeting)\n\tend",
"def greeting\n\t\trandom_response :greeting\n\tend",
"def random\n redirect_to_random(Word)\n end",
"def select_word\n uri = URI(... | [
"0.6410003",
"0.62890655",
"0.617846",
"0.6140068",
"0.60641664",
"0.6027653",
"0.5996284",
"0.5993427",
"0.5981577",
"0.5953854",
"0.5953854",
"0.5915373",
"0.5882376",
"0.58802176",
"0.57827646",
"0.57559085",
"0.5744108",
"0.5732625",
"0.5730949",
"0.57013685",
"0.56785595... | 0.6819541 | 0 |
if tile is explored, show it forever, else show "| |"" | def render
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def print_tile\n if @value == \"0\"\n print \"\"\n elsif @value != \"0\" && @given == false\n print @value.to_s.colorize(:blue)\n else\n print @value.to_s.colorize(:red)\n end\n end",
"def render\n puts \" #{(0..8).to_a.join(\" \")}\"\n grid.each_with_index do |row, i|\... | [
"0.69416994",
"0.6581957",
"0.638554",
"0.616015",
"0.61187124",
"0.6024451",
"0.60114384",
"0.6004442",
"0.59648365",
"0.5960846",
"0.5849293",
"0.58454055",
"0.58251613",
"0.58164877",
"0.58096415",
"0.578748",
"0.57730657",
"0.5769512",
"0.57598037",
"0.5755963",
"0.569475... | 0.0 | -1 |
get prompt from player | def get_turn
@pos, @action = @player.prompt
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_player_name(name)\n return prompt(\"Player Name? [Player #{name}]\",\"Player #{name}\")\n end",
"def ask_player_name\n puts \"Rentre le pseudo du joueur #{@symbol} : \"\n print '> '\n name = gets.chomp\n name\n end",
"def get_question\r\n\t\t\r\n\t\treply = \"\"\r\n\t\t\r\n\t\t#loop un... | [
"0.70916533",
"0.692187",
"0.6906691",
"0.68448883",
"0.68130505",
"0.6810279",
"0.67899364",
"0.6775074",
"0.6775074",
"0.6775074",
"0.6775074",
"0.67702526",
"0.6768751",
"0.67602354",
"0.67589563",
"0.6730849",
"0.67108375",
"0.67091715",
"0.6688264",
"0.6679",
"0.6679",
... | 0.683469 | 4 |
all tile are either explored or flagged for bombs | def won?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def won?\n safe_tiles = @grid.flatten.select { | tile | tile.value != BOMB }\n safe_tiles.all? { | tile | tile.revealed }\n end",
"def lost?\n all_bombs = @grid.flatten.select { | tile | tile.value == BOMB }\n all_bombs.all? { | tile | tile.revealed }\n end",
"def handle_gray_... | [
"0.71210366",
"0.6897641",
"0.68840057",
"0.67177224",
"0.6488009",
"0.6301064",
"0.6251675",
"0.61384654",
"0.6091865",
"0.6038126",
"0.6008439",
"0.59998655",
"0.5961591",
"0.5918325",
"0.5908431",
"0.5907984",
"0.58894527",
"0.58550894",
"0.58433497",
"0.58242786",
"0.5818... | 0.0 | -1 |
any bomb is explored | def lose?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def draw_bomb bomb\r\n bomb.cur_image.draw(bomb.x,bomb.y,2)\r\nend",
"def make_bomb\n @has_bomb = true\n end",
"def handle_gray_booms!\n return if @pending_gray_boom_tile_lays.values.flatten.empty?\n\n # clear gray double boom city actions, no tiles remain\n if (num_double_boo... | [
"0.6169543",
"0.6158107",
"0.60957676",
"0.6033918",
"0.596871",
"0.59323",
"0.59242344",
"0.589714",
"0.5884102",
"0.58073044",
"0.5800217",
"0.57543415",
"0.57478553",
"0.57199997",
"0.56938344",
"0.5682575",
"0.566121",
"0.5633931",
"0.5552999",
"0.5532422",
"0.5526697",
... | 0.0 | -1 |
Returns the User who collected this Collectible. | def collector
ep = collection_event_parameters
ep.user if ep
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def user\n User.where(id: object.user_id)[0]\n end",
"def created_by\n user\n end",
"def user\n metadata&.dig('event', 'user')\n end",
"def user\r\n return for_context(nil, false) { |c| c.user }\r\n end",
"def user\n return @user\n end",
"def user\n ... | [
"0.6727901",
"0.66001344",
"0.659657",
"0.6504615",
"0.64844245",
"0.64844245",
"0.6447795",
"0.64296883",
"0.6427472",
"0.64193124",
"0.6396026",
"0.63800365",
"0.63641757",
"0.63551164",
"0.63411665",
"0.63200265",
"0.6309862",
"0.62918496",
"0.6263978",
"0.6263978",
"0.626... | 0.655936 | 3 |
Returns the CollectionEventParameters for this Collectible. | def collection_event_parameters
event_parameters.detect { |ep| CaTissue::CollectionEventParameters === ep }
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def collection_params\n params[:collection]\n end",
"def params\n @parameter_collection ||= ParameterCollection.new(self)\n end",
"def parameters\n params = []\n self.event_parameters.each do |param|\n params << OpenStruct.new( :param_id => param.id, :name => param.Descript... | [
"0.6391381",
"0.61298275",
"0.6054056",
"0.5796431",
"0.55367786",
"0.5498293",
"0.5491343",
"0.543182",
"0.5366797",
"0.53638387",
"0.5360491",
"0.5342864",
"0.53407526",
"0.5338184",
"0.52496517",
"0.5236401",
"0.5235768",
"0.5219217",
"0.52115715",
"0.51969904",
"0.5188255... | 0.7778192 | 0 |
Returns whether this Collectible has a received event. | def received?
received_event_parameters
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def event_received(sequence)\n false # return true if we handled the event here\n end",
"def received?\n !!self.received_at?\n end",
"def event?\n @events_mutex.synchronize do\n !@events.empty?\n end\n end",
"def ready?\n running? && @event_received\n end",
"... | [
"0.72068524",
"0.7193023",
"0.7118438",
"0.70399374",
"0.6855773",
"0.68084085",
"0.67628276",
"0.675207",
"0.6705036",
"0.6678729",
"0.6634484",
"0.65112597",
"0.65058595",
"0.6502429",
"0.6453903",
"0.6441787",
"0.63667846",
"0.63488317",
"0.6328561",
"0.63088006",
"0.62748... | 0.7875182 | 0 |
Returns the User who received this Collectible. | def receiver
ep = received_event_parameters
ep.user if ep
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def user\n if scope.id == object.sender_user_id\n object.recipient_user\n else\n object.sender_user\n end\n end",
"def receiver\n users[0].id.eql?(sent_by) ? users[1] : users[0]\n end",
"def sender\n begin\n User.cached_find(self.sender_id)\n rescue\n nil\n end\n end... | [
"0.711885",
"0.6865034",
"0.67757773",
"0.67352474",
"0.65792996",
"0.6475021",
"0.6413105",
"0.6411423",
"0.64075875",
"0.6384262",
"0.6384262",
"0.637585",
"0.637585",
"0.63387114",
"0.63319635",
"0.63318956",
"0.63241655",
"0.63183",
"0.6310762",
"0.63099045",
"0.6288951",... | 0.611055 | 41 |
Returns the ReceivedEventParameters for this Collectible. | def received_event_parameters
event_parameters.detect { |ep| CaTissue::ReceivedEventParameters === ep }
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def parameters\n params = []\n self.event_parameters.each do |param|\n params << OpenStruct.new( :param_id => param.id, :name => param.Description, :param_type => param.parameter_type.Description )\n end\n params\n end",
"def collection_event_parameters\n event_parameters.detec... | [
"0.6323639",
"0.6012966",
"0.56432647",
"0.5609585",
"0.5517666",
"0.5517666",
"0.5517666",
"0.54708624",
"0.54607844",
"0.5360808",
"0.5338348",
"0.5233195",
"0.5230966",
"0.5226758",
"0.5193156",
"0.5133072",
"0.5131748",
"0.510998",
"0.5108963",
"0.5099242",
"0.5064849",
... | 0.7330431 | 0 |
Overrides +Jinx::Resource.each_defaultable_reference+ to visit the +CaTissue::ReceivedEventParameters+. | def each_defaultable_reference
# visit ReceivedEventParameters first
rep = received_event_parameters
yield rep if rep
# add other dependent defaults
super { |dep| yield dep unless ReceivedEventParameters === dep }
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_default_event_parameters\n rep = received_event_parameters || create_default_received_event_parameters || return\n if collection_event_parameters.nil? then\n create_default_collection_event_parameters(rep)\n end\n end",
"def add_defaults_local\n super\n self.collection_... | [
"0.6164295",
"0.5381283",
"0.4969595",
"0.4838806",
"0.47838664",
"0.47681656",
"0.47594526",
"0.46621728",
"0.4611608",
"0.46099967",
"0.46099967",
"0.46076325",
"0.45855463",
"0.4564988",
"0.45619994",
"0.4556502",
"0.45543855",
"0.4546286",
"0.4544712",
"0.453702",
"0.4533... | 0.80867386 | 0 |
GET /todos GET /todos.json | def index
@filter = params[:status] ||= :pending
@todos =
scoped
.order(created_at: :desc)
.where(status: params[:status])
.normal
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @todos = Todo.all\n json_response(@todos)\n end",
"def show\n todo = Todo.find_by_id(params[:id])\n render json: todo.todos\n end",
"def index\n @todos = @list.todos\n render json: @todos\n end",
"def index\n @todos = Todo.all\n render json: @todos\n ... | [
"0.80015033",
"0.7946748",
"0.7915049",
"0.7910324",
"0.767061",
"0.75529414",
"0.7513659",
"0.74718785",
"0.74510056",
"0.7441282",
"0.74228525",
"0.7407939",
"0.7388406",
"0.72670317",
"0.7216767",
"0.7216767",
"0.71763384",
"0.71687216",
"0.7158836",
"0.71497715",
"0.71280... | 0.0 | -1 |
GET /todos/1 GET /todos/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n todo = Todo.find_by_id(params[:id])\n render json: todo.todos\n end",
"def show\n puts params[:id]\n render json: Todo.find(params[:id])\n end",
"def show\n @todo = @list.todos.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { r... | [
"0.7953201",
"0.7647965",
"0.7603146",
"0.7571494",
"0.75503665",
"0.751457",
"0.7503114",
"0.7458781",
"0.7458781",
"0.7443962",
"0.7373681",
"0.72946733",
"0.7290071",
"0.72630847",
"0.7247785",
"0.72369283",
"0.7234159",
"0.71743184",
"0.71338177",
"0.7111886",
"0.71102434... | 0.0 | -1 |
POST /todos POST /todos.json | def create
@todo = TodoService.create_todo(scope: @project.todos, attrs: todo_params)
respond_to do |format|
if @todo.persisted?
format.html { redirect_to project_todos_path(@project), notice: 'Todo was successfully created.' }
format.json { render :show, status: :created, location: @todo }
else
format.html { render :new }
format.json { render json: @todo.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @todo = Todo.create(todo_params)\n render json: @todo\n end",
"def create\n @todo = Todo.new(todo_params)\n if @todo.save\n render json: @todo, status: :created, location: @todo\n else\n render json: @todo.errors, status: :unprocessable_entity\n end\n end",
... | [
"0.77191365",
"0.7682156",
"0.7584383",
"0.7571844",
"0.7390803",
"0.7379874",
"0.73744744",
"0.7349123",
"0.7333154",
"0.73257005",
"0.7285942",
"0.7235614",
"0.722343",
"0.72165036",
"0.72165036",
"0.72165036",
"0.71789914",
"0.7135808",
"0.7118579",
"0.71103877",
"0.702635... | 0.6811388 | 32 |
PATCH/PUT /todos/1 PATCH/PUT /todos/1.json | def update
respond_to do |format|
if TodoService.update_todo(@todo, todo_params)
format.html { redirect_to project_todos_path(@project), notice: 'Todo was successfully updated.' }
format.json { render :show, status: :ok, location: @todo }
else
format.html { render :edit }
format.json { render json: @todo.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @todo = Todo.find(params[:id])\n @todo.update_attributes(params[:todo])\n render :json => @todo\n end",
"def update\n respond_to do |format|\n if @api_v1_todo.update(api_v1_todo_params)\n format.json { render json: @api_v1_todo, status: :ok }\n else\n format.json... | [
"0.73876435",
"0.73800725",
"0.72687894",
"0.7246782",
"0.70655125",
"0.70095533",
"0.695816",
"0.69538754",
"0.69361985",
"0.69361985",
"0.68700045",
"0.6847399",
"0.68226784",
"0.6788569",
"0.67627513",
"0.6751422",
"0.6751128",
"0.6751128",
"0.6726497",
"0.6714954",
"0.670... | 0.6609618 | 23 |
DELETE /todos/1 DELETE /todos/1.json | def destroy
TodoService.destroy_todo(@todo)
respond_to do |format|
format.html { redirect_to project_todos_url(@project), notice: 'Todo was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @api_v1_todo.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"def destroy\n @todo = Todo.find(params[:id])\n @todo.destroy\n render json: nil, status: :ok\n end",
"def destroy\n @todo = Todo.find(params[:id])\n @todo.destroy\n\n ... | [
"0.79151887",
"0.7865625",
"0.77419454",
"0.77419454",
"0.7713188",
"0.7664772",
"0.7655661",
"0.7619602",
"0.7612175",
"0.75980675",
"0.75966346",
"0.7569626",
"0.7567462",
"0.75221884",
"0.75175065",
"0.75142604",
"0.75054616",
"0.7441618",
"0.7424936",
"0.74210566",
"0.738... | 0.71754384 | 36 |
Use callbacks to share common setup or constraints between actions. | def set_todo
@todo = Todo.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 todo_params
params.require(:todo).permit(:content, :status, :project_id, :creator_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 |
human readable description of modeling approach | def modeler_description
return 'The user can optionally selected to remove air loops, plant loops, zone hvac, vrf systems, and curves from the model. By default all systems except water systems and zone exhaust fans are removed.'
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def modeler_description\n return 'Gather orientation and story specific construction, fenestration (including overhang) specific information'\n end",
"def modeler_description\n return \"Example use case is adding special loads like an elevator to a model as part of an analysis workflow\"\n end",
"def m... | [
"0.7710149",
"0.76145315",
"0.75934714",
"0.74018747",
"0.7299891",
"0.7296635",
"0.727943",
"0.71912926",
"0.71912926",
"0.7191264",
"0.7100944",
"0.70977926",
"0.70629936",
"0.7045383",
"0.7044268",
"0.70413125",
"0.7040473",
"0.7032938",
"0.70267737",
"0.70182866",
"0.6987... | 0.0 | -1 |
methods copied from openstudiostandards Remove all air loops in model | def remove_air_loops(model)
model.getAirLoopHVACs.each(&:remove)
return model
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remove_all_plant_loops(model)\n model.getPlantLoops.each(&:remove)\n return model\n end",
"def remove_plant_loops(model, runner)\n plant_loops = model.getPlantLoops\n plant_loops.each do |plant_loop|\n shw_use = false\n plant_loop.demandComponents.each do |component|\n if compon... | [
"0.72458667",
"0.66515267",
"0.6582943",
"0.60994804",
"0.5972743",
"0.59486586",
"0.5842645",
"0.5763797",
"0.57474786",
"0.5698407",
"0.5690245",
"0.5642426",
"0.5619892",
"0.561644",
"0.5603296",
"0.556087",
"0.5513277",
"0.54816663",
"0.54705334",
"0.54594445",
"0.5438511... | 0.8150995 | 0 |
Remove plant loops in model except those used for service hot water | def remove_plant_loops(model, runner)
plant_loops = model.getPlantLoops
plant_loops.each do |plant_loop|
shw_use = false
plant_loop.demandComponents.each do |component|
if component.to_WaterUseConnections.is_initialized or component.to_CoilWaterHeatingDesuperheater.is_initialized
shw_use = true
runner.registerInfo("#{plant_loop.name} is used for SHW or refrigeration heat reclaim and will not be removed.")
break
end
end
plant_loop.remove unless shw_use
end
return model
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remove_all_plant_loops(model)\n model.getPlantLoops.each(&:remove)\n return model\n end",
"def remove_all_HVAC(model)\n remove_air_loops(model)\n remove_all_plant_loops(model)\n remove_vrf(model)\n remove_all_zone_equipment(model, runner)\n remove_unused_curves(model)\n return model\... | [
"0.7977865",
"0.6317917",
"0.6171294",
"0.59789693",
"0.59051365",
"0.58486855",
"0.5725123",
"0.56902903",
"0.56771296",
"0.5660775",
"0.5614084",
"0.55762285",
"0.55254906",
"0.55183774",
"0.54585844",
"0.5440105",
"0.5421288",
"0.5401321",
"0.53636134",
"0.5352844",
"0.533... | 0.8130865 | 0 |
Remove all plant loops in model including those used for service hot water | def remove_all_plant_loops(model)
model.getPlantLoops.each(&:remove)
return model
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remove_plant_loops(model, runner)\n plant_loops = model.getPlantLoops\n plant_loops.each do |plant_loop|\n shw_use = false\n plant_loop.demandComponents.each do |component|\n if component.to_WaterUseConnections.is_initialized or component.to_CoilWaterHeatingDesuperheater.is_initialized\n... | [
"0.81790364",
"0.6589813",
"0.6502841",
"0.6242478",
"0.6119649",
"0.58563393",
"0.57929134",
"0.57875216",
"0.5780385",
"0.5763786",
"0.57443535",
"0.56694466",
"0.5651515",
"0.56339765",
"0.56157476",
"0.5593708",
"0.55870295",
"0.5569084",
"0.5567656",
"0.5567593",
"0.5553... | 0.8488544 | 0 |
Remove zone equipment except for exhaust fans | def remove_zone_equipment(model, runner)
zone_equipment_removed_count = 0
model.getThermalZones.each do |zone|
zone.equipment.each do |equipment|
if equipment.to_FanZoneExhaust.is_initialized
runner.registerInfo("#{equipment.name} is a zone exhaust fan and will not be removed.")
else
equipment.remove
zone_equipment_removed_count += 1
end
end
end
runner.registerInfo("#{zone_equipment_removed_count} zone equipment removed.")
return model
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remove_all_zone_equipment(model, runner)\n zone_equipment_removed_count = 0\n model.getThermalZones.each do |zone|\n zone.equipment.each do |equipment|\n equipment.remove\n zone_equipment_removed_count += 1\n end\n end\n runner.registerInfo(\"#{zone_equipment_removed_count} ... | [
"0.70199895",
"0.6247393",
"0.58842",
"0.57995945",
"0.57291377",
"0.56963205",
"0.5600381",
"0.5579024",
"0.5498476",
"0.5490843",
"0.5441397",
"0.5415022",
"0.5409011",
"0.5407079",
"0.54061013",
"0.53802806",
"0.5371178",
"0.5355217",
"0.535057",
"0.53460014",
"0.5339017",... | 0.7796493 | 0 |
Remove all zone equipment including exhaust fans | def remove_all_zone_equipment(model, runner)
zone_equipment_removed_count = 0
model.getThermalZones.each do |zone|
zone.equipment.each do |equipment|
equipment.remove
zone_equipment_removed_count += 1
end
end
runner.registerInfo("#{zone_equipment_removed_count} zone equipment removed.")
return model
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remove_zone_equipment(model, runner)\n zone_equipment_removed_count = 0\n model.getThermalZones.each do |zone|\n zone.equipment.each do |equipment|\n if equipment.to_FanZoneExhaust.is_initialized\n runner.registerInfo(\"#{equipment.name} is a zone exhaust fan and will not be removed.... | [
"0.80142355",
"0.6505793",
"0.63005346",
"0.617482",
"0.6059574",
"0.60200137",
"0.595982",
"0.5894745",
"0.5813889",
"0.57174635",
"0.571298",
"0.5707686",
"0.57023436",
"0.56797737",
"0.5645785",
"0.56434333",
"0.56410253",
"0.5605959",
"0.55543077",
"0.5544964",
"0.5537663... | 0.7808084 | 1 |
Remove unused performance curves | def remove_unused_curves(model)
model.getCurves.each do |curve|
if curve.directUseCount == 0
model.removeObject(curve.handle)
end
end
return model
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def discard_trip_outliers\n @drivers.each do |driver|\n driver.discard_trip_outliers\n end\n end",
"def remove_useless_traces_data(params)\n convert_list_of_json_traces_to_objects(params[0])\n create_new_traces\n @traces_json_string = '[' + @traces_json_string[0...-1] + ']'\n puts @traces... | [
"0.63622653",
"0.5890391",
"0.58874714",
"0.5548547",
"0.5514475",
"0.54884386",
"0.544713",
"0.5444272",
"0.54383636",
"0.54342604",
"0.5347522",
"0.5347522",
"0.5339887",
"0.53289837",
"0.5318336",
"0.5307225",
"0.5307121",
"0.5300492",
"0.52713186",
"0.5260212",
"0.5233385... | 0.6594909 | 0 |
Remove HVAC equipment except for service hot water loops and zone exhaust fans | def remove_HVAC(model, runner)
remove_air_loops(model)
remove_plant_loops(model, runner)
remove_vrf(model)
remove_zone_equipment(model, runner)
remove_unused_curves(model)
return model
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remove_zone_equipment(model, runner)\n zone_equipment_removed_count = 0\n model.getThermalZones.each do |zone|\n zone.equipment.each do |equipment|\n if equipment.to_FanZoneExhaust.is_initialized\n runner.registerInfo(\"#{equipment.name} is a zone exhaust fan and will not be removed.... | [
"0.708251",
"0.7034332",
"0.65862423",
"0.5993105",
"0.58707464",
"0.5774016",
"0.5690015",
"0.5621989",
"0.56190306",
"0.54812324",
"0.5461543",
"0.54552877",
"0.5450163",
"0.54436845",
"0.54333687",
"0.54281473",
"0.53985685",
"0.5368796",
"0.5337964",
"0.53176856",
"0.5297... | 0.66084063 | 2 |
Remove all HVAC equipment including service hot water loops and zone exhaust fans | def remove_all_HVAC(model)
remove_air_loops(model)
remove_all_plant_loops(model)
remove_vrf(model)
remove_all_zone_equipment(model, runner)
remove_unused_curves(model)
return model
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remove_all_zone_equipment(model, runner)\n zone_equipment_removed_count = 0\n model.getThermalZones.each do |zone|\n zone.equipment.each do |equipment|\n equipment.remove\n zone_equipment_removed_count += 1\n end\n end\n runner.registerInfo(\"#{zone_equipment_removed_count} ... | [
"0.7198777",
"0.7169061",
"0.662502",
"0.6248277",
"0.6094765",
"0.60933167",
"0.60856855",
"0.60630375",
"0.6013214",
"0.5910571",
"0.58979416",
"0.58232826",
"0.57867634",
"0.5696978",
"0.5696209",
"0.5675323",
"0.5628587",
"0.55907035",
"0.5582356",
"0.5573607",
"0.5572154... | 0.75487345 | 0 |
define the arguments that the user will input | def arguments(model)
args = OpenStudio::Ruleset::OSArgumentVector.new
# bool for removing air loops
remove_air_loops = OpenStudio::Ruleset::OSArgument::makeBoolArgument('remove_air_loops',true)
remove_air_loops.setDisplayName('Remove Air Loops?:')
remove_air_loops.setDefaultValue(true)
args << remove_air_loops
# bool for removing plant loops
remove_plant_loops = OpenStudio::Ruleset::OSArgument::makeBoolArgument('remove_plant_loops',true)
remove_plant_loops.setDisplayName('Remove Plant Loops?:')
remove_plant_loops.setDefaultValue(true)
args << remove_plant_loops
# bool for removing service hot water loops
remove_shw_loops = OpenStudio::Ruleset::OSArgument::makeBoolArgument('remove_shw_loops',true)
remove_shw_loops.setDisplayName('Also Remove Service Hot Water Plant Loops?:')
remove_shw_loops.setDefaultValue(false)
args << remove_shw_loops
# bool for removing zone equipment
remove_zone_equipment = OpenStudio::Ruleset::OSArgument::makeBoolArgument('remove_zone_equipment',true)
remove_zone_equipment.setDisplayName('Remove Zone Equipment?:')
remove_zone_equipment.setDefaultValue(true)
args << remove_zone_equipment
# bool for removing zone exhaust fans
remove_zone_exhaust_fans = OpenStudio::Ruleset::OSArgument::makeBoolArgument('remove_zone_exhaust_fans',true)
remove_zone_exhaust_fans.setDisplayName('Also Zone Exhaust Fans?:')
remove_zone_exhaust_fans.setDefaultValue(false)
args << remove_zone_exhaust_fans
# bool for removing vrf equipment
remove_vrf = OpenStudio::Ruleset::OSArgument::makeBoolArgument('remove_vrf',true)
remove_vrf.setDisplayName('Remove VRF?:')
remove_vrf.setDefaultValue(true)
args << remove_vrf
# bool for removing unused curves
remove_unused_curves = OpenStudio::Ruleset::OSArgument::makeBoolArgument('remove_unused_curves',true)
remove_unused_curves.setDisplayName('Remove Unused Curves?:')
remove_unused_curves.setDefaultValue(true)
args << remove_unused_curves
return args
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def arguments; end",
"def arguments; end",
"def arguments; end",
"def arguments\n \"\"\n end",
"def args; end",
"def args; end",
"def args; end",
"def args; end",
"def args; end",
"def args; end",
"def args; end",
"def args; end",
"def args; end",
"def args; end",
"def args; end... | [
"0.73753476",
"0.73753476",
"0.73753476",
"0.70890766",
"0.7008301",
"0.7008301",
"0.7008301",
"0.7008301",
"0.7008301",
"0.7008301",
"0.7008301",
"0.7008301",
"0.7008301",
"0.7008301",
"0.7008301",
"0.7008301",
"0.7008301",
"0.7008301",
"0.7008301",
"0.7008301",
"0.7008301",... | 0.0 | -1 |
define what happens when the measure is run | def run(model, runner, user_arguments)
super(model, runner, user_arguments)
# use the built-in error checking
if !runner.validateUserArguments(arguments(model), user_arguments)
return false
end
# assign the user inputs to variables
remove_air_loops_bool = runner.getBoolArgumentValue('remove_air_loops', user_arguments)
remove_plant_loops_bool = runner.getBoolArgumentValue('remove_plant_loops', user_arguments)
remove_shw_loops_bool = runner.getBoolArgumentValue('remove_shw_loops', user_arguments)
remove_zone_equipment_bool = runner.getBoolArgumentValue('remove_zone_equipment', user_arguments)
remove_zone_exhaust_fans_bool = runner.getBoolArgumentValue('remove_zone_exhaust_fans', user_arguments)
remove_vrf_bool = runner.getBoolArgumentValue('remove_vrf', user_arguments)
remove_unused_curves_bool = runner.getBoolArgumentValue('remove_unused_curves', user_arguments)
# report initial condition
runner.registerInitialCondition("The building started with #{model.getPlantLoops.size} plant loops and #{model.getAirLoopHVACs.size} air loops. If zone equipment is present, it will be removed.")
# remove HVAC equipment according to user inputs
remove_air_loops(model) if remove_air_loops_bool
remove_plant_loops(model, runner) if remove_plant_loops_bool && !remove_shw_loops_bool
remove_all_plant_loops(model) if remove_plant_loops_bool && remove_shw_loops_bool
remove_zone_equipment(model, runner) if remove_zone_equipment_bool &&! remove_zone_exhaust_fans_bool
remove_all_zone_equipment(model, runner) if remove_zone_equipment_bool && remove_zone_exhaust_fans_bool
remove_vrf(model) if remove_vrf_bool
remove_unused_curves(model) if remove_unused_curves_bool
# report final condition
runner.registerFinalCondition("The building finished with #{model.getPlantLoops.size} plant loops and #{model.getAirLoopHVACs.size} air loops.")
return true
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def measure; end",
"def measure=(_arg0); end",
"def measure\n\t\t1\n\tend",
"def measure(*args, &b)\n end",
"def communicate_measure_result(_ = nil, _ = nil); end",
"def communicate_measure_result(_ = nil, _ = nil); end",
"def called\n self.measurement.called\n end",
"def measure\n ... | [
"0.79848564",
"0.7639647",
"0.76355976",
"0.7170129",
"0.66926914",
"0.66926914",
"0.66718984",
"0.66311747",
"0.6599127",
"0.65870225",
"0.65324444",
"0.6481582",
"0.6405596",
"0.64028287",
"0.6333309",
"0.6283632",
"0.6283632",
"0.6283632",
"0.6281165",
"0.6269874",
"0.6242... | 0.0 | -1 |
GET /android_profiles/1 GET /android_profiles/1.json | def show
@android_profile = @user.android_profile
if @android_profile == nil
@android_profile = @user.build_android_profile
render action: "new"
else
respond_to do |format|
format.html # show.html.erb
format.json { render json: @android_profile }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_default_profile \n get(\"/profiles.json/default\")\nend",
"def get_profile_configuration(args = {}) \n get(\"/profiles.json/#{args[:profileId]}/configuration\", args)\nend",
"def profiles \n personid = params[:id]\n @response = JSON.parse(current_user.access_token.token.get('/api/v0/aspects/p... | [
"0.69868946",
"0.6734137",
"0.66739714",
"0.66245306",
"0.6581291",
"0.6516702",
"0.64842314",
"0.64786243",
"0.64786243",
"0.64758646",
"0.6455374",
"0.64484584",
"0.64483094",
"0.6446698",
"0.6385766",
"0.63744044",
"0.6348571",
"0.6320081",
"0.629736",
"0.62541974",
"0.622... | 0.6726018 | 2 |
GET /android_profiles/new GET /android_profiles/new.json | def new
@android_profile = @user.build_android_profile
respond_to do |format|
format.html # new.html.erb
format.json { render json: @android_profile }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @android_profile = @user.build_android_profile(params[:android_profile])\n\n respond_to do |format|\n if @android_profile.save\n format.html { redirect_to user_android_profile_url, :flash => { success: 'Successfully saved.' } }\n format.json { render json: @android_profile, st... | [
"0.72782207",
"0.7229526",
"0.7157012",
"0.7157012",
"0.7157012",
"0.7157012",
"0.7157012",
"0.7157012",
"0.7157012",
"0.7157012",
"0.7157012",
"0.707604",
"0.7030763",
"0.7012275",
"0.6968892",
"0.6918348",
"0.69110125",
"0.69033355",
"0.6857037",
"0.6840285",
"0.6818574",
... | 0.7586584 | 0 |
POST /android_profiles POST /android_profiles.json | def create
@android_profile = @user.build_android_profile(params[:android_profile])
respond_to do |format|
if @android_profile.save
format.html { redirect_to user_android_profile_url, :flash => { success: 'Successfully saved.' } }
format.json { render json: @android_profile, status: :created, location: @android_profile }
else
format.html { render action: "new" }
format.json { render json: @android_profile.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @android_profile = @user.build_android_profile\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @android_profile }\n end\n end",
"def newprofile\n if params[\"auth_key\"] == nil or params[\"device_id\"] == nil or params[\"profile_url\"] == nil\... | [
"0.6620486",
"0.6309191",
"0.6241737",
"0.6217791",
"0.6216352",
"0.61435705",
"0.6082825",
"0.60503715",
"0.6032393",
"0.6011774",
"0.59844774",
"0.5958668",
"0.59420544",
"0.59111065",
"0.5891704",
"0.5876368",
"0.5872493",
"0.5856541",
"0.5846068",
"0.58314735",
"0.5818122... | 0.7356422 | 0 |
PUT /android_profiles/1 PUT /android_profiles/1.json | def update
@android_profile = @user.android_profile
respond_to do |format|
if @android_profile.update_attributes(params[:android_profile])
format.html { redirect_to user_android_profile_url, :flash => { success: 'Successfully updated.' } }
format.json { head :no_content }
else
format.html { render action: "edit" }
format.json { render json: @android_profile.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def assign_default_profile(args = {}) \n put(\"/profiles.json/#{args[:profileId]}/default\", args)\nend",
"def update_profile(options = {}) \n # query profile info\n response = HTTP.auth('Bearer ' + Asca::Tools::Token.new_token).get(URI_PROFILES, :params => { 'filter[name]' => options[:name... | [
"0.6951007",
"0.6715517",
"0.66986156",
"0.6642862",
"0.6555922",
"0.6541912",
"0.6474071",
"0.63844603",
"0.6382593",
"0.6366721",
"0.63333946",
"0.6270955",
"0.61857677",
"0.6096249",
"0.60856724",
"0.6079825",
"0.60654044",
"0.60649693",
"0.60550237",
"0.60038793",
"0.6003... | 0.72788167 | 0 |
DELETE /android_profiles/1 DELETE /android_profiles/1.json | def destroy
@android_profile = @user.android_profile
@android_profile.destroy
respond_to do |format|
format.html { redirect_to new_user_android_profile_url, :flash => { success: 'Successfully deleted.' } }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def clear_default_profile \n put(\"/profiles.json/default/clear\")\nend",
"def destroy\n @profile.destroy\n end",
"def destroy\n @profile.destroy\n respond_to do |format|\n format.html { redirect_to profiles_url, :notice => t('alerts.profiles.destroy') }\n format.json { head :no_content }\n... | [
"0.688106",
"0.67451817",
"0.66933864",
"0.6646937",
"0.66443163",
"0.663883",
"0.66304415",
"0.66253275",
"0.6622983",
"0.6622587",
"0.6622587",
"0.661696",
"0.661696",
"0.661696",
"0.66095537",
"0.65910894",
"0.65910894",
"0.65910894",
"0.65910894",
"0.65910894",
"0.6591089... | 0.7638798 | 0 |
Any error raised during connection is considered false | def doi_server_reachable?
Ezid::Client.new.server_status.up? rescue false
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def connect_error?\n @connerror || false\n end",
"def error?\n\t\tEventMachine::report_connection_error_status(@signature) != 0\n\tend",
"def conn_errors?\n !@errors.empty?\n end",
"def connection_valid?\n if status.untested? or (changed? and (changes.keys & @@status_fields).empty?)\n beg... | [
"0.859693",
"0.82112604",
"0.7966869",
"0.7855087",
"0.77661616",
"0.7407604",
"0.7403902",
"0.733191",
"0.71956456",
"0.7184316",
"0.71205264",
"0.71205264",
"0.70779717",
"0.705048",
"0.704793",
"0.70465875",
"0.70465875",
"0.70397586",
"0.7031831",
"0.7027299",
"0.7000298"... | 0.0 | -1 |
though Hirsute can use set and get within itself, set also configures require(ibute accessors for the specified field, thus allowing more userfriendly management of Hirsute objects | def set(field,value)
set_method = (field.to_s + "=").to_sym
m = self.method((field.to_s + "=").to_sym)
m.call value
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setter\r\n @setter ||= Field.setter(@name)\r\n end",
"def attribute_to_set; end",
"def field_set!(key, value)\n send \"_#{key}_set\", value\n end",
"def method_missing field, *args, &block\n set field, *args, &block\n end",
"def set_attribute(name, value); end",
"def creat... | [
"0.68091214",
"0.6643863",
"0.644471",
"0.64339876",
"0.6386558",
"0.6323139",
"0.6231261",
"0.6217809",
"0.61760414",
"0.6128255",
"0.61211544",
"0.61211544",
"0.61167884",
"0.60852253",
"0.6067124",
"0.60385895",
"0.5965137",
"0.5953104",
"0.59182835",
"0.5910111",
"0.59068... | 0.6430263 | 4 |
GET /produto_pedidos GET /produto_pedidos.json | def index
@produto_pedidos = ProdutoPedido.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @pedido_produtos = PedidoProduto.where(pedido_id: @pedido.id)\n end",
"def index\n @pedidos = Pedido.find(:all, :conditions => [\"cliente_id=?\", session[:usuario_id]])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @pedidos }\n end\n en... | [
"0.72378254",
"0.6929861",
"0.67154497",
"0.6686139",
"0.6676781",
"0.6616784",
"0.6533514",
"0.639381",
"0.639212",
"0.63884914",
"0.6384648",
"0.6343808",
"0.62596184",
"0.6243416",
"0.62310517",
"0.621577",
"0.6210604",
"0.62047404",
"0.61924344",
"0.6186697",
"0.6181588",... | 0.70695865 | 2 |
GET /produto_pedidos/1 GET /produto_pedidos/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @pedido_produtos = PedidoProduto.where(pedido_id: @pedido.id)\n end",
"def show\n @produto = Produto.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @produto }\n end\n end",
"def index\n @pedidos = Pedido.find(:all, ... | [
"0.7085734",
"0.68980646",
"0.6897631",
"0.68870723",
"0.6871847",
"0.67968404",
"0.67968404",
"0.6792648",
"0.67155504",
"0.66517323",
"0.6608677",
"0.6584952",
"0.6584597",
"0.6533525",
"0.64984655",
"0.64629674",
"0.64309657",
"0.63860166",
"0.6365918",
"0.635099",
"0.6305... | 0.0 | -1 |
POST /produto_pedidos POST /produto_pedidos.json | def create
produto_pedido = ProdutoPedido.new(produto_pedido_params)
if produto_pedido.save
@pedido = produto_pedido.pedido
@produto_pedido = ProdutoPedido.new(pedido: @pedido)
@total = 0.0
@pedido.produto_pedidos.each { |pp| @total += pp.produto.preco*pp.quantidade }
render 'create.js'
else
render 'create.js'
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @pedido_produto = PedidoProduto.new(pedido_produto_params)\n @pedido_produto.pedido = @pedido\n\n respond_to do |format|\n if @pedido_produto.save\n format.html { redirect_to pedido_pedido_produtos_path(@pedido), notice: 'Pedido produto was successfully created.' }\n format... | [
"0.751055",
"0.7084851",
"0.7079815",
"0.7017887",
"0.6899256",
"0.6836317",
"0.6810373",
"0.6797833",
"0.6757518",
"0.6733286",
"0.6723919",
"0.671566",
"0.671566",
"0.671566",
"0.6686678",
"0.6668992",
"0.6667497",
"0.66344756",
"0.6619405",
"0.6615967",
"0.66098493",
"0.... | 0.6720197 | 11 |
PATCH/PUT /produto_pedidos/1 PATCH/PUT /produto_pedidos/1.json | def update
respond_to do |format|
if @produto_pedido.update(produto_pedido_params)
format.html { redirect_to @produto_pedido, notice: 'Produto pedido was successfully updated.' }
format.json { render :show, status: :ok, location: @produto_pedido }
else
format.html { render :edit }
format.json { render json: @produto_pedido.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @produto.update(produto_params)\n respond_with @produto\n end",
"def update\n @produto = Produto.find(params[:id])\n \n params[:produto][:preco_compra] = converte_valor_banco params[:produto][:preco_compra]\n params[:produto][:preco_venda] = converte_valor_banco params[:produto][... | [
"0.71673286",
"0.6947943",
"0.6930344",
"0.6782087",
"0.6777799",
"0.6769938",
"0.6769938",
"0.6769938",
"0.6761912",
"0.67606634",
"0.6760414",
"0.6734121",
"0.67220426",
"0.6692741",
"0.6692619",
"0.6682146",
"0.6678831",
"0.6673155",
"0.66707563",
"0.6668085",
"0.66595525"... | 0.6990137 | 2 |
DELETE /produto_pedidos/1 DELETE /produto_pedidos/1.json | def destroy
@pedido = @produto_pedido.pedido
@produto_pedido.destroy
@produto_pedido = ProdutoPedido.new(pedido: @pedido)
@total = 0.0
@pedido.produto_pedidos.each { |pp| @total += pp.produto.preco*pp.quantidade }
render 'destroy.js'
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @produto = Produto.find(params[:id])\n @produto.destroy\n\n respond_to do |format|\n format.html { redirect_to produtos_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @producto_ofertado.destroy\n respond_to do |format|\n format.html { redirect_to pro... | [
"0.73804325",
"0.73489904",
"0.7330365",
"0.73263186",
"0.72852165",
"0.72815555",
"0.7277842",
"0.7273673",
"0.72511274",
"0.7235521",
"0.72345144",
"0.7230909",
"0.72287416",
"0.72287416",
"0.72287416",
"0.7226857",
"0.7226857",
"0.7226857",
"0.7226857",
"0.71946096",
"0.71... | 0.0 | -1 |
Use callbacks to share common setup or constraints between actions. | def set_produto_pedido
@produto_pedido = ProdutoPedido.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 produto_pedido_params
params.require(:produto_pedido).permit(:pedido_id, :produto_id, :quantidade)
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 |
We strip the segments before code analysis begins | def pre_code_analyze
# grab the section names we will strip
return if not options[ '/strip' ]
# split the string into an array of section names
names = options[ '/strip' ].split( ';' )
# don't bother to continue if we have no sections to strip
return if names.empty?
# we must hold the write lock while we delete segments...
cm.synchronize_write do
# grab the current auto_analyze value so we can restore it when we are done
orig_auto_analyze = cm.auto_analyze
# disable auto analysis so every time we call cm.delete_segment() we don't trigger
# cm.analyze() not only would this incur an unnecessary performance hit, but as
# we are running pre_code_analyze we do not want to invoke the analyze at this
# stage in the pipeline.
cm.auto_analyze = false
# keep an array of the segments we will delete
del = []
# iterate over every segment to see if we want to delete it
cm.segments do | segment |
if( names.include?( segment.name ) )
del << segment
end
end
# delete every segment in our list
del.each do | segment |
cm.delete_segment( segment )
end
# restore the original auto_analyze value
cm.auto_analyze = orig_auto_analyze
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remove_segments()\n if @handle.ptr == nil\n raise \"this is disposed\"\n end\n Native.RunEditor_remove_segments(@handle.ptr)\n end",
"def strip() end",
"def segments; end",
"def code_splitter(code)\n student_code = []\n code = code.split('startTrac... | [
"0.63169897",
"0.6114767",
"0.6013568",
"0.59254557",
"0.59133667",
"0.58593154",
"0.57742417",
"0.575581",
"0.57271725",
"0.5725265",
"0.570112",
"0.5669288",
"0.56517005",
"0.563582",
"0.5633089",
"0.5595469",
"0.55848056",
"0.55652046",
"0.5541076",
"0.5530846",
"0.5519808... | 0.7150977 | 0 |
POST /forum_comentarios POST /forum_comentarios.json | def create
@forum_comentario = ForumComentario.new(forum_comentario_params)
@forum_comentario.usuario_curso_id = @perfil.id
if @forum_comentario.save
ApplicationMailer.nova_postagem_forum(@forum_comentario).deliver
@forum_comentario = ForumComentario.where(forum_id: @forum_comentario.forum_id)
else
respond_to do |format|
format.js { render :new }
format.json { render json: @forum_comentario.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def forum_comentario_params\n params.require(:forum_comentario).permit(:usuario_curso_id, :forum_id, :texto, :forum_comentario_id)\n end",
"def set_forum_comentario\n @forum_comentario = ForumComentario.find(params[:id])\n end",
"def CreateForum params = {}\n \n APICall(path: 'for... | [
"0.68770254",
"0.6542328",
"0.61994195",
"0.61258686",
"0.6037483",
"0.5904276",
"0.5897215",
"0.5894291",
"0.58818334",
"0.58128065",
"0.579469",
"0.57040703",
"0.56828684",
"0.5668554",
"0.5662532",
"0.56562525",
"0.56545424",
"0.5638724",
"0.56264144",
"0.5622462",
"0.5617... | 0.7176462 | 0 |
PATCH/PUT /forum_comentarios/1 PATCH/PUT /forum_comentarios/1.json | def update
if @forum_comentario.update(forum_comentario_params)
@forum_comentario = ForumComentario.where(forum_id: @forum_comentario.forum_id)
else
respond_to do |format|
format.js { render :edit }
format.json { render json: @forum_comentario.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_forum_comentario\n @forum_comentario = ForumComentario.find(params[:id])\n end",
"def UpdateForum id,params = {}\n \n APICall(path: \"forums/#{id}.json\",method: 'PUT',payload: params.to_json)\n \n end",
"def update\n respond_to do |format|\n if @forum.update(f... | [
"0.64999384",
"0.64824",
"0.64161706",
"0.6259877",
"0.6259877",
"0.6259877",
"0.6223598",
"0.6206684",
"0.62062985",
"0.6204959",
"0.6182075",
"0.6182075",
"0.61629933",
"0.6117606",
"0.61157",
"0.61007637",
"0.6095807",
"0.60956335",
"0.60912025",
"0.608763",
"0.6086541",
... | 0.7314524 | 0 |
DELETE /forum_comentarios/1 DELETE /forum_comentarios/1.json | def destroy
authorize! :destroy, ForumComentario
@forum = @forum_comentario.forum_id
@forum_comentario.destroy
if @forum_comentario.destroy
@forum_comentario = ForumComentario.where(forum_id: @forum)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def DeleteForum id\n \n APICall(path: \"forums/#{id}.json\",method: 'DELETE')\n \n end",
"def destroy\n @forum.destroy\n respond_to do |format|\n format.html { redirect_to forums_url, notice: 'Foro eliminado exitosamente.' }\n format.json { head :no_content }\n end\n ... | [
"0.7317778",
"0.73058254",
"0.7304083",
"0.7258103",
"0.7258103",
"0.7258103",
"0.7258103",
"0.7258103",
"0.7218876",
"0.7163052",
"0.7084888",
"0.70713013",
"0.70666856",
"0.7061846",
"0.7061364",
"0.70522696",
"0.70380616",
"0.7022656",
"0.7019304",
"0.6998135",
"0.6988827"... | 0.7514427 | 0 |
Use callbacks to share common setup or constraints between actions. | def set_forum_comentario
@forum_comentario = ForumComentario.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 forum_comentario_params
params.require(:forum_comentario).permit(:usuario_curso_id, :forum_id, :texto, :forum_comentario_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 |
Reset the options to their default values. Returns nothing. | def reset
@caller_context_padding = 2
@has_at_exit_report = true
@alert_frequency = 1
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def reset!\n @options = defaults\n end",
"def reset!\n @options = defaults\n end",
"def reset_options\n VALID_OPTIONS_KEYS.each do |key|\n send(\"#{key}=\", default_options[key])\n end\n end",
"def reset\n @options = VALID_OPTIONS_KEYS.inject({}) do |opts, k|\n ... | [
"0.8979338",
"0.8979338",
"0.88335377",
"0.86823213",
"0.86310595",
"0.84959155",
"0.8318671",
"0.82497853",
"0.81840485",
"0.81701046",
"0.7814807",
"0.7737769",
"0.7618335",
"0.74746984",
"0.7428437",
"0.7356556",
"0.7321451",
"0.7259501",
"0.7256305",
"0.7225897",
"0.71877... | 0.0 | -1 |
Public: Set the number of lines of context surrounding the call site of the deprecated method to display in the alerts and reports. (default: 2) count The number of lines before and after the callsite to report. This must be a positive number. Returns the count. | def caller_context_padding=( count )
raise ArgumentError, "caller_content_padding must have a count > 0" unless count > 0
@caller_context_padding = count
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def deprecated_method_report( dm, call_site = nil )\n m = \"`#{dm.klass}##{dm.method}`\"\n lines = [ m ]\n lines << \"-\" * m.length\n lines << \"\"\n lines << \"* Originally defined at #{dm.file}:#{dm.line_number}\"\n\n if msg = dm.message then\n lines << \"* #{msg}\"\n e... | [
"0.5567094",
"0.5497209",
"0.54014057",
"0.5372055",
"0.5371807",
"0.53022724",
"0.5272472",
"0.5204537",
"0.52019477",
"0.5188958",
"0.5188958",
"0.5188958",
"0.5188958",
"0.5188958",
"0.5188958",
"0.5188958",
"0.5171998",
"0.5142886",
"0.5101744",
"0.507284",
"0.5011006",
... | 0.5041417 | 20 |
Public: Get the number of lines of context padding. This may be overridden with the environment variable DEPRECATABLE_CALLER_CONTEXT_PADDING. Returns the Integer number of context padding lines. | def caller_context_padding
p = ENV['DEPRECATABLE_CALLER_CONTEXT_PADDING']
if p then
p = Float(p).to_i
raise ArgumentError, "DEPRECATABLE_CALLER_CONTEXT_APDDING must have a value > 0, it is currently #{p}" unless p > 0
return p
end
return @caller_context_padding
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def formatted_context_lines\n if @formatted_context_lines.empty? then\n number_width = (\"%d\" % @context_line_numbers.last).length\n @context_lines.each_with_index do |line, idx|\n prefix = (idx == @context_index) ? CallSiteContext.pointer : CallSiteContext.not_pointer\n numbe... | [
"0.61622196",
"0.6041935",
"0.577995",
"0.56787866",
"0.564149",
"0.55461526",
"0.5533148",
"0.5525991",
"0.5525991",
"0.55059415",
"0.54337305",
"0.54337305",
"0.5407679",
"0.5312454",
"0.5302851",
"0.5294514",
"0.52807075",
"0.5265841",
"0.5219367",
"0.5211028",
"0.5199492"... | 0.69588923 | 0 |
Public: Set the maximum number of times an alert for a unqiue CallSite of a DeprecatedMethod will be emitted. (default: :once) That is, when a deprecated method is called from a particular CallSite, normally an 'alert' is sent. This setting controls the maximum number of times that the 'alert' for a particular CallSite is emitted. freq The alert frequency. This may be set to any number, or to one of the special token values: :never Never send any alerts :once Send an alert for a given CallSite only once. :always Send an alert for every invocation of the DeprecatedMethod. Returns the alert_frequency. | def alert_frequency=( freq )
@alert_frequency = frequency_of( freq )
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def alert_frequency\n p = ENV['DEPRECATABLE_ALERT_FREQUENCY']\n return frequency_of(p) if p\n return @alert_frequency\n end",
"def alert( call_site )\n if call_site.invocation_count <= ::Deprecatable.options.alert_frequency then\n ::Deprecatable.alerter.alert( self, call_site )\n ... | [
"0.6306147",
"0.538227",
"0.53795356",
"0.53001046",
"0.52460736",
"0.5233095",
"0.5148796",
"0.5124275",
"0.49778658",
"0.49561843",
"0.4932399",
"0.4873181",
"0.48727104",
"0.4861797",
"0.48283324",
"0.48092556",
"0.4808774",
"0.47439083",
"0.47408217",
"0.47212908",
"0.470... | 0.6525837 | 0 |
Public: Get the current value of the alert_frequency. This may be overridden with the environment variable DEPRECATABLE_ALERT_FREQUENCY. Returns the Integer value representing the alert_frequency. | def alert_frequency
p = ENV['DEPRECATABLE_ALERT_FREQUENCY']
return frequency_of(p) if p
return @alert_frequency
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def alert_frequency=( freq )\n @alert_frequency = frequency_of( freq )\n end",
"def getFrequency()\n# @config[\"demandFactoryConf\"][\"frequency\"]\n interval = @config[\"demandFactoryConf\"][\"configList\"][0][\"interval\"] ;\n return 60 * 60 / interval.to_f ;\n end",
"def frequency\n F... | [
"0.7243557",
"0.5936833",
"0.59023714",
"0.58545506",
"0.5589659",
"0.54387724",
"0.5435269",
"0.5387118",
"0.5350051",
"0.52953535",
"0.5264387",
"0.52528775",
"0.5251148",
"0.5225531",
"0.52203304",
"0.5218486",
"0.52042353",
"0.5189414",
"0.51863307",
"0.51800543",
"0.5158... | 0.8939573 | 0 |
Public: Say whether or not the final at exit report shall be emitted. This may be overridden by the environment variable DEPRECATABLE_HAS_AT_EXIT_REPORT. Setting the environment variable to 'true' will override the existing setting. Returns the boolean of whether or not the exti report should be done. | def has_at_exit_report?
return true if ENV['DEPRECATABLE_HAS_AT_EXIT_REPORT'] == "true"
return @has_at_exit_report
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def final_report( registry = Deprecatable.registry )\n lines = [ \"Deprecatable 'at_exit' Report\",\n \"=============================\" ]\n lines << \"\"\n lines << \"To turn this report off do one of the following:\"\n lines << \"\"\n lines << \"* in your ruby code set `Dep... | [
"0.6626738",
"0.65446526",
"0.5816383",
"0.57172364",
"0.5506578",
"0.5466769",
"0.5463742",
"0.5445951",
"0.5421882",
"0.53928465",
"0.5387986",
"0.5358838",
"0.53575164",
"0.5351999",
"0.53495646",
"0.5297472",
"0.52193785",
"0.52143604",
"0.5198657",
"0.5189402",
"0.517628... | 0.87594885 | 0 |
Convert the given frequency Symbol/String into its Numeric representation. Return the Numeric value of the input frequency. | def frequency_of( frequency )
case frequency.to_s
when 'always'
(1.0/0.0)
when 'once'
1
when 'never'
0
else
Float(frequency).to_i
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cast_to_num(str)\n Integer(str)\n rescue ArgumentError\n Float(str)\n rescue ArgumentError\n nil\n end",
"def convert_string_to_number(str); end",
"def str_to_number(s)\r\n\t\tval_str = s.to_s()\r\n\t\tif INT_REGEX.match(val_str)\r\n\t\t\treturn val_str.to_i()\r\n\t\tels... | [
"0.61489683",
"0.6129352",
"0.6106038",
"0.5841778",
"0.58360636",
"0.5768424",
"0.5725269",
"0.57184565",
"0.5648782",
"0.5639311",
"0.56323946",
"0.5585127",
"0.55759907",
"0.54289913",
"0.53136504",
"0.52957815",
"0.52791196",
"0.5242355",
"0.5221317",
"0.52049947",
"0.520... | 0.51815724 | 23 |
Fetches hier data for tgns | def fetch_heir_geographic
return if bpldc_url.blank?
auth_data = Curator::ControlledTerms::AuthorityService.call(path: bpldc_url, path_prefix: '/geomash')
return if auth_data.blank? || auth_data&.fetch(:hier_geo, {}).blank?
hier_geo_attrs = auth_data[:hier_geo].dup
if auth_data.dig(:non_hier_geo, :value).blank?
hier_geo_attrs = Curator::Parsers::GeoParser.normalize_tgn_hgeo(hier_geo_attrs)
return TgnHierGeo.new(**hier_geo_attrs)
end
other_geo_value = auth_data[:non_hier_geo][:value]
other_geo_value << " (#{geographic.area_type})" if geographic.area_type.present?
hier_geo_attrs[:other] = other_geo_value
hier_geo_attrs = Curator::Parsers::GeoParser.normalize_tgn_hgeo(hier_geo_attrs)
TgnHierGeo.new(**hier_geo_attrs)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def all_hiera_data\n {}\n end",
"def node_ids() ; ext_info[:nodes] ; end",
"def descendents\n\n\t\t #children.preload(:parent).each do |child| child.descendents end\n\t\t children.each do |child|\n\t [child] + child.descendents\n\t end\n end",
"def nodes; end",
"def n... | [
"0.60252184",
"0.55931914",
"0.5577352",
"0.5568202",
"0.5568202",
"0.5568202",
"0.5531581",
"0.53964746",
"0.5351637",
"0.53380257",
"0.5333059",
"0.53235406",
"0.5307445",
"0.5301621",
"0.527825",
"0.5257851",
"0.5245576",
"0.52378494",
"0.5233969",
"0.52169734",
"0.5215245... | 0.0 | -1 |
Use callbacks to share common setup or constraints between actions. | def set_feedback
@feedback = Feedback.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 feedback_params
params.require(:feedback).permit(:title, :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 |
GET /customersessions GET /customersessions.json | def index
@customersessions = Customersession.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_customer_profile\n authenticate_request!\n json_response(current_customer)\n end",
"def index\n if !session[:user_id]\n redirect_to customer_path(session[:customer_id]) , notice: 'Access Denied'\n return\n else\n @customers = Customer.all\n\n respond_to do |format|\n forma... | [
"0.6467191",
"0.6334141",
"0.6325294",
"0.6248147",
"0.62335366",
"0.6228345",
"0.62056506",
"0.6198579",
"0.61951417",
"0.61770505",
"0.6167864",
"0.6160193",
"0.6143405",
"0.6134287",
"0.61129445",
"0.60850716",
"0.6084903",
"0.6082777",
"0.6080246",
"0.60394037",
"0.600201... | 0.72994256 | 0 |
GET /customersessions/1 GET /customersessions/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @customersessions = Customersession.all\n end",
"def set_customersession\n @customersession = Customersession.find(params[:id])\n end",
"def get_customer_profile\n authenticate_request!\n json_response(current_customer)\n end",
"def show\n @session = Sso::Session.find(sso_... | [
"0.7168473",
"0.6497178",
"0.6436581",
"0.63681936",
"0.6356754",
"0.6338776",
"0.62980026",
"0.62630075",
"0.6257806",
"0.6233763",
"0.6231233",
"0.6221195",
"0.6217396",
"0.6163801",
"0.6104877",
"0.6103743",
"0.6102624",
"0.6093152",
"0.6081201",
"0.6061316",
"0.6052598",
... | 0.0 | -1 |
POST /customersessions POST /customersessions.json | def create
@customersession = Customersession.new(customersession_params)
respond_to do |format|
if @customersession.save
format.html { redirect_to @customersession, notice: 'Customersession was successfully created.' }
format.json { render :show, status: :created, location: @customersession }
else
format.html { render :new }
format.json { render json: @customersession.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @customer = Customer.new(params[:customer])\n\n respond_to do |format|\n if @customer.save\n session[:customer_id] = @customer.id\n format.html { redirect_to new_order_path, method: :get, notice: \"Your account was successfully created.\" }\n format.json { render json: ... | [
"0.6517261",
"0.6481007",
"0.63280153",
"0.6311892",
"0.62295717",
"0.62247634",
"0.61894065",
"0.61664677",
"0.6150127",
"0.6123724",
"0.6082324",
"0.60772586",
"0.60659003",
"0.60503364",
"0.60067624",
"0.5990653",
"0.5957539",
"0.5898321",
"0.5867269",
"0.58659714",
"0.583... | 0.7304028 | 0 |
PATCH/PUT /customersessions/1 PATCH/PUT /customersessions/1.json | def update
respond_to do |format|
if @customersession.update(customersession_params)
format.html { redirect_to @customersession, notice: 'Customersession was successfully updated.' }
format.json { render :show, status: :ok, location: @customersession }
else
format.html { render :edit }
format.json { render json: @customersession.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n\n\n respond_to do |format|\n if @customer.update(customer_params)\n @@current_customer = @customer.id\n format.html { redirect_to @customer, notice: 'Customer was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: ... | [
"0.6316203",
"0.631569",
"0.63069785",
"0.63013405",
"0.6294324",
"0.62768227",
"0.62220925",
"0.620664",
"0.6156126",
"0.61463845",
"0.61080676",
"0.61055964",
"0.60857433",
"0.60844153",
"0.60844153",
"0.60844153",
"0.60844153",
"0.60844153",
"0.60844153",
"0.60844153",
"0.... | 0.7107896 | 0 |
DELETE /customersessions/1 DELETE /customersessions/1.json | def destroy
@customersession.destroy
respond_to do |format|
format.html { redirect_to customersessions_url, notice: 'Customersession was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete_session\n request.method = :get\n request.uri = '_session'\n Couchdbtools.execute(request)\n end",
"def destroy\n @sixmonth_customer = SixmonthCustomer.find(params[:id])\n @sixmonth_customer.destroy\n\n respond_to do |format|\n format.html { redirect_to sixmonth_custome... | [
"0.6928423",
"0.67967445",
"0.6662833",
"0.66535",
"0.6631406",
"0.6631406",
"0.6631406",
"0.6631406",
"0.6631406",
"0.6631406",
"0.6631406",
"0.6631406",
"0.66313607",
"0.6622446",
"0.6622446",
"0.66223925",
"0.66176987",
"0.6601827",
"0.6599062",
"0.65986556",
"0.65911",
... | 0.73525804 | 0 |
Use callbacks to share common setup or constraints between actions. | def set_customersession
@customersession = Customersession.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 customersession_params
params.require(:customersession).permit(:customeremail, :startdatetime, :enddatetime, :ip)
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 |
sidekiq_options queue: "push notification" | def perform(message_id)
message = Message.find(message_id)
store = message.store
corporate = store.root
app = corporate.app
devices = Device.with_token.joins(:user).where(users: { store_id: [store.id, corporate.id] })
send_android_notification(app, devices)
send_ios_notification(app, devices)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sidekiq_options(opts = T.unsafe(nil)); end",
"def sidekiq_payload(options, message)\n {\n 'queue' => options[:queue],\n 'jid' => SecureRandom.hex(12),\n 'enqueued_at' => Time.now.to_f,\n 'class' => options[:worker],\n 'args' => [message],\n 'backtra... | [
"0.69126374",
"0.6740631",
"0.64571846",
"0.6302214",
"0.6228707",
"0.6204837",
"0.61889356",
"0.6107317",
"0.6093456",
"0.6003927",
"0.59994054",
"0.5976475",
"0.59680855",
"0.59158367",
"0.58597744",
"0.58546567",
"0.5812002",
"0.57590634",
"0.5748572",
"0.57382256",
"0.573... | 0.0 | -1 |
action for genearting bills; | def generate_bill
if !user_signed_in?
render :js => "window.location = '/users/sign_in'"
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def game_bomb_action\n if tool_canuse?(BweaponId) and not @showing_bomb\n if $game_party.has_item?($data_items[BcostItemId]) \n $game_party.consume_item($data_items[BcostItemId])\n @gamebomb.direction = @direction\n @gamebomb.moveto(@x, @y)\n @gamebomb.jump_passable?(1)?@gamebom... | [
"0.6661113",
"0.6538154",
"0.63302934",
"0.6188756",
"0.61545473",
"0.5938563",
"0.58851206",
"0.58851206",
"0.58851206",
"0.58851206",
"0.58851206",
"0.58399796",
"0.5791314",
"0.57801455",
"0.5777837",
"0.57028854",
"0.5700752",
"0.56894225",
"0.5660339",
"0.5638698",
"0.56... | 0.0 | -1 |
function to update the session and add in cart | def add_in_cart
product_id=params[:id].to_i
@product=Product.find(product_id)
total_request=1
update_through_cart=0
if params.has_key?(:quant)
total_request=params[:quant][:total_request].to_i
update_through_cart=1
end
if(check_availabilty(product_id,total_request,update_through_cart))
update_session(product_id,total_request,update_through_cart)
else
flash[:notice] = "#{Product.find(product_id).name} is not available in this quantity"
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_to_cart\n \tif session[\"cart\"].nil?\n \t\tsession[\"cart\"] = []\n \tend\n \t#So luong cua san pham add vao gio hang\n \tquantity_ = 1\n \tsession[\"item\"] = {:id => params[:id].to_i, :name => params[:name], :quantity => quantity_.to_i, :price => params[:price].to_i, :total => quantity_.to_i * par... | [
"0.77462834",
"0.74573016",
"0.7444345",
"0.7436648",
"0.7408306",
"0.73057497",
"0.72427255",
"0.7237766",
"0.7228131",
"0.7190924",
"0.7139007",
"0.7130779",
"0.7122372",
"0.7094831",
"0.70561075",
"0.70561075",
"0.70561075",
"0.70561075",
"0.70348644",
"0.7030617",
"0.7026... | 0.75841796 | 1 |
so we can assume that products are available | def home
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def available\n @products = Product.where.not(inventory_count: 0)\n json_response(@products)\n end",
"def products_not_used\n @products_not_used ||= object\n .products\n .select { |p| p.inventory_id == current_inventory.id && !p.used? ... | [
"0.7305376",
"0.7134208",
"0.70824265",
"0.70496833",
"0.7038297",
"0.69546837",
"0.6926023",
"0.6926023",
"0.68531",
"0.6743112",
"0.6673782",
"0.66271484",
"0.6615559",
"0.65865874",
"0.6561162",
"0.65567595",
"0.65479016",
"0.6547087",
"0.64865893",
"0.64796096",
"0.647785... | 0.0 | -1 |
To view or fill out the form | def form
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def form; end",
"def forms; end",
"def form_view\n end",
"def set_form(easy)\n end",
"def ing_form; end",
"def fill_out_admission_form(options = {})#incomplet fill out\n @org_codes = AdmissionHelper.get_org_codes_info(CONFIG['location'], options[:org_code] || \"0287\") if options[:org_code]\n ... | [
"0.7874452",
"0.7570237",
"0.7158963",
"0.7024453",
"0.6973726",
"0.6750572",
"0.66734934",
"0.6654096",
"0.66520834",
"0.6631199",
"0.6431091",
"0.6375422",
"0.6330114",
"0.6328348",
"0.62941176",
"0.62941176",
"0.62898064",
"0.62727416",
"0.62727416",
"0.6253111",
"0.624495... | 0.7714907 | 1 |
test Polynom class test parse | def test_polynom_parse_standart_case
polynom = Polynom.parse '3x^2 + 7x + 13'
monom1 = Monom.new(3, 'x', 2)
monom2 = Monom.new(7, 'x', 1)
monom3 = Monom.new(13, '', 0)
assert_equal Polynom.new([monom1, monom2, monom3]), polynom
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def parse; end",
"def parse; end",
"def parse; end",
"def parse\n end",
"def test_it_can_get_instance_of_parser\n parser = Rubasteme.parser\n refute_nil parser\n end",
"def parsed; end",
"def parsed; end",
"def test_parse_body\n config = OrderedOptions.new\n config.key1='test-ke... | [
"0.6551044",
"0.6551044",
"0.6551044",
"0.6507315",
"0.6247259",
"0.6141403",
"0.6141403",
"0.60856164",
"0.6076865",
"0.6072371",
"0.6072371",
"0.6072371",
"0.6072371",
"0.603293",
"0.5997302",
"0.5978532",
"0.5978532",
"0.5978532",
"0.5978532",
"0.5938547",
"0.5933155",
"... | 0.6377914 | 4 |
GET /code_samples GET /code_samples.json | def index
@code_samples = CodeSample.all.order([:id]).reverse_order
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test\n get(\"/help/test.json\")\n end",
"def test\n get(\"/help/test.json\")\n end",
"def create\n @code_sample = current_user.code_samples.new(code_sample_params)\n\n respond_to do |format|\n if @code_sample.save\n format.html { redirect_to @code_sample, notice: 'Code sam... | [
"0.6548604",
"0.6548604",
"0.6300596",
"0.622489",
"0.6106695",
"0.61040163",
"0.60440475",
"0.601701",
"0.593148",
"0.59175265",
"0.59002817",
"0.58988494",
"0.58545643",
"0.58392805",
"0.58186305",
"0.5769708",
"0.57359844",
"0.5698854",
"0.5690377",
"0.56842303",
"0.567512... | 0.574769 | 16 |
GET /code_samples/1 GET /code_samples/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test\n get(\"/help/test.json\")\n end",
"def test\n get(\"/help/test.json\")\n end",
"def get_api_results(_url)\n JSON.parse File.read('spec/inspector/stubbed_example.json')\n end",
"def show\n @sample = Sample.find(params[:id])\n respond_to do |format|\n format.html # ... | [
"0.6825668",
"0.6825668",
"0.6421059",
"0.62973666",
"0.62558365",
"0.6246413",
"0.61241305",
"0.60530543",
"0.6004653",
"0.6004653",
"0.5958857",
"0.5958025",
"0.59538",
"0.59504664",
"0.59294003",
"0.59096783",
"0.5828535",
"0.58243346",
"0.58179665",
"0.58145195",
"0.57935... | 0.0 | -1 |
POST /code_samples POST /code_samples.json | def create
@code_sample = current_user.code_samples.new(code_sample_params)
respond_to do |format|
if @code_sample.save
format.html { redirect_to @code_sample, notice: 'Code sample was successfully created.' }
format.json { render :show, status: :created, location: @code_sample }
else
format.html { render :new }
format.json { render json: @code_sample.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def code_sample_params\n params.require(:code_sample).permit(:title, :versions, :description, :code, :featured, :code_info)\n end",
"def create\n @sample = Sample.new(params[:sample])\n\n respond_to do |format|\n if @sample.save\n format.html { redirect_to samples_path, notice: 'Sample ... | [
"0.6404364",
"0.64013237",
"0.63031113",
"0.63031113",
"0.63031113",
"0.62829536",
"0.62224555",
"0.6166463",
"0.5935846",
"0.58953506",
"0.5800161",
"0.5715335",
"0.56703776",
"0.56488675",
"0.564442",
"0.56327534",
"0.55416656",
"0.55367595",
"0.553587",
"0.553587",
"0.5522... | 0.7403989 | 0 |
PATCH/PUT /code_samples/1 PATCH/PUT /code_samples/1.json | def update
respond_to do |format|
if @code_sample.update(code_sample_params)
format.html { redirect_to @code_sample, notice: 'Code sample was successfully updated.' }
format.json { render :show, status: :ok, location: @code_sample }
else
format.html { render :edit }
format.json { render json: @code_sample.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def api_patch(path, data = {})\n api_request(:patch, path, :data => data)\n end",
"def patch!\n request! :patch\n end",
"def patch\n headers = {\"If-Match\" => @version}\n response = @context.request :patch, \"#{@path}/#{@id}\", @data.to_json, headers\n @version += 1\n response\... | [
"0.6729245",
"0.6524164",
"0.6497863",
"0.64708906",
"0.6443897",
"0.64304364",
"0.6414849",
"0.6311112",
"0.6290555",
"0.6268531",
"0.625859",
"0.6229678",
"0.6190898",
"0.6147672",
"0.6131888",
"0.61213505",
"0.60661477",
"0.60617965",
"0.6032838",
"0.6032838",
"0.6029673",... | 0.6299878 | 8 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.