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
Use callbacks to share common setup or constraints between actions.
def set_serie_detalle @serie_detalle = SerieDetalle.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 serie_detalle_params params.require(:serie_detalle).permit(:lugar, :marca, :pista, :atleta, :an, :club, :region, :pais) 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
Use callbacks to share common setup or constraints between actions.
def set_game_event @game_event = GameEvent.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 game_event_params params.fetch(:game_event, {}) 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 /task_stats/1 GET /task_stats/1.json
def show @task_stat = TaskStat.find(params[:id]) respond_to do |format| format.html # show.html.erb format.json { render json: @task_stat } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def stats\n # find project\n @project = Project.find(params[:id])\n # check user is manager of project\n if (!@superuser_is_superadmin && !(superuser_is_part_of_project? @project))\n flash[:warning] = \"You can't see stats for this project\"\n redirect_to lato_core.root_path and r...
[ "0.69776034", "0.6922608", "0.6896724", "0.6896724", "0.6692689", "0.6617102", "0.65072155", "0.6478461", "0.6474785", "0.646865", "0.646865", "0.6409019", "0.6399133", "0.63694054", "0.63545054", "0.63197196", "0.6291455", "0.6265213", "0.62576157", "0.6249133", "0.6210367",...
0.72672075
0
GET /task_stats/new GET /task_stats/new.json
def new @task_stat = TaskStat.new respond_to do |format| format.html # new.html.erb format.json { render json: @task_stat } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @task = Task.new\n # tasks_counts\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @task }\n end\n end", "def create\n @task_stat = TaskStat.new(params[:task_stat])\n\n respond_to do |format|\n if @task_stat.save\n format.html {...
[ "0.78133494", "0.72910285", "0.7270663", "0.7237737", "0.71275204", "0.7059263", "0.70552117", "0.70552117", "0.70552117", "0.70552117", "0.70552117", "0.70552117", "0.70552117", "0.70552117", "0.70552117", "0.70552117", "0.70552117", "0.70552117", "0.70043796", "0.69897836", ...
0.81066436
0
POST /task_stats POST /task_stats.json
def create @task_stat = TaskStat.new(params[:task_stat]) respond_to do |format| if @task_stat.save format.html { redirect_to @task_stat, notice: 'Task stat was successfully created.' } format.json { render json: @task_stat, status: :created, location: @task_stat } else format.html { render action: "new" } format.json { render json: @task_stat.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def statistics_task_by_status_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: StatisticsApi.statistics_task_by_status ...'\n end\n # resource path\n local_var_path = '/statistics/task_by_status'\n\n # query parameters\n ...
[ "0.6606174", "0.6347322", "0.6204695", "0.6117633", "0.6081023", "0.60808617", "0.60805625", "0.60656995", "0.60319394", "0.6025828", "0.6003379", "0.59607047", "0.59454805", "0.5935364", "0.58997285", "0.5896659", "0.5887065", "0.5876836", "0.5869597", "0.58550096", "0.58487...
0.66440123
0
PUT /task_stats/1 PUT /task_stats/1.json
def update @task_stat = TaskStat.find(params[:id]) respond_to do |format| if @task_stat.update_attributes(params[:task_stat]) format.html { redirect_to @task_stat, notice: 'Task stat was successfully updated.' } format.json { head :no_content } else format.html { render action: "edit" } format.json { render json: @task_stat.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n if @task.update(task_param)\n render json: get_task_hash(@task)\n else\n render json: @task.errors.full_messages\n end\n end", "def update\n task = Task.find(params[:id])\n if task.update(task_params)\n render json: task\n else\n render_errors(task)\n end\n ...
[ "0.6494094", "0.64695954", "0.640526", "0.64043784", "0.6371463", "0.63683265", "0.6362095", "0.6270969", "0.6215636", "0.61990005", "0.6189865", "0.6180383", "0.6169725", "0.61266315", "0.61251986", "0.6118998", "0.61010355", "0.6078507", "0.60655224", "0.6021252", "0.601854...
0.6878912
0
DELETE /task_stats/1 DELETE /task_stats/1.json
def destroy @task_stat = TaskStat.find(params[:id]) @task_stat.destroy respond_to do |format| format.html { redirect_to task_stats_url } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @task_metric = TaskMetric.find(params[:id])\n @task_metric.destroy\n\n respond_to do |format|\n format.html { redirect_to task_metrics_url }\n format.json { head :no_content }\n end\n end", "def destroy\r\n @status_task = StatusTask.find(params[:id])\r\n @status_task.de...
[ "0.73404455", "0.70162857", "0.6989718", "0.6897651", "0.6883265", "0.6833848", "0.6825231", "0.68120944", "0.6805821", "0.67921865", "0.6781934", "0.67806923", "0.67802155", "0.6775632", "0.6775491", "0.67549527", "0.6746142", "0.6745404", "0.6744259", "0.67413694", "0.67360...
0.7928342
0
initialize the 'verse with empty hash to add planets to
def initialize(verse) @the_verse = verse @planets = {} end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initialize\n @planets = {}\n end", "def initialize(h = {})\n @vector = Hash.new(0)\n @vector = @vector.merge!(h)\n end", "def initialize\n\t\t\t@hash = {}\n\t\tend", "def initialize(planets_hash)\n @name = planets_hash[:name]\n @orbits = planets_hash[:orbits]\n @moons = planets_hash[:...
[ "0.7054539", "0.61360115", "0.60881835", "0.6036678", "0.60051775", "0.59888273", "0.5929172", "0.581281", "0.5809486", "0.5798407", "0.5798407", "0.57707095", "0.57640386", "0.57557666", "0.5723301", "0.5717671", "0.5712388", "0.57121176", "0.5699053", "0.5680995", "0.564853...
0.7631313
0
method to add new planets to the hash, adding name as key
def new_planet(planet) @planets[planet.name] = planet end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add new_planet\n @planets << new_planet\n end", "def initialize\n @planets = {}\n end", "def add_planet(new_planet)\n @planets << new_planet\n end", "def add_planet(new_planet)\n @planets << new_planet\n end", "def add_planet(new_planet)\n @planets << new_planet\n end", "def add_p...
[ "0.700943", "0.67678547", "0.67073286", "0.67073286", "0.67073286", "0.67073286", "0.66107464", "0.6601579", "0.6596737", "0.6593632", "0.6557101", "0.651149", "0.651149", "0.651149", "0.651149", "0.651149", "0.65045094", "0.6502309", "0.64114976", "0.63861555", "0.6367412", ...
0.71357214
0
method to print out planet names as ordered list
def list_planets counter = 1 @planets.each_key do |planet| puts counter.to_s + ". " + planet counter += 1 end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def planet_list\n list = \"\"\n @planets.each_with_index do |planet, i|\n list += \" #{i+1}. #{planet.name}\\n\"\n end\n return list\n end", "def list_planets\n planet_list = ''\n i = 0\n @planets.each do |planet|\n i += 1\n planet_list << \"#{i}. #{planet.name.capitalize}\\...
[ "0.8038312", "0.7909215", "0.7888411", "0.7775698", "0.77554214", "0.77265286", "0.770354", "0.7662915", "0.7594998", "0.75379795", "0.750365", "0.7492974", "0.74704254", "0.74613446", "0.74046934", "0.74029946", "0.74027395", "0.737152", "0.7370719", "0.73535645", "0.7334707...
0.0
-1
creates hash of planets with variables as keys
def initialize(planets_hash) @name = planets_hash[:name] @orbits = planets_hash[:orbits] @moons = planets_hash[:number_of_moons] @region = planets_hash[:region] # central, border, rim @diameter = planets_hash[:diameter_km] # diameter in kilometers @terraformed = planets_hash[:terraformed] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initialize\n @planets = {}\n end", "def create_planet\n new_planet ={}\n\n print \"\\nWhat is the name of the planet? \"\n new_planet[:name] = gets.chomp.downcase\n\n print \"How old is #{new_planet[:name].each_first_letters} in Earth years? \"\n new_planet[:age] = gets.chomp.to_i\n\n print \"What ...
[ "0.655195", "0.6120683", "0.5855577", "0.58059615", "0.5792365", "0.5791664", "0.5707559", "0.56860614", "0.5603455", "0.5591035", "0.55902445", "0.5559945", "0.5558671", "0.5528472", "0.55091715", "0.5490801", "0.5490801", "0.5486575", "0.5409635", "0.5399172", "0.53591746",...
0.5982115
2
Register one or more Interceptors which will be called before SMS is sent.
def register_interceptors(*interceptors) interceptors.flatten.compact.each { |interceptor| register_interceptor(interceptor) } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def register_interceptor(interceptor)\r\n delivery_interceptor = case interceptor\r\n when String, Symbol\r\n interceptor.to_s.camelize.constantize\r\n else\r\n interceptor\r\n end\r\n\r\n Sms.register_interceptor(delivery_interceptor)\r\n end", ...
[ "0.58921146", "0.5437073", "0.54194987", "0.5410355", "0.53355217", "0.53355217", "0.53178066", "0.5304436", "0.5270519", "0.52503604", "0.52453095", "0.5239487", "0.52116627", "0.51802504", "0.51708525", "0.5167625", "0.51627654", "0.5157047", "0.51506746", "0.51312304", "0....
0.70476365
0
Register an Observer which will be notified when SMS is delivered. Either a class, string or symbol can be passed in as the Observer. If a string or symbol is passed in it will be camelized and constantized.
def register_observer(observer) delivery_observer = case observer when String, Symbol observer.to_s.camelize.constantize else observer end Sms.register_observer(delivery_observer) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def register_observer(observer)\n unless @@delivery_notification_observers.include?(observer)\n @@delivery_notification_observers << observer\n end\n end", "def register_observer(observer, cmd_name=nil)\n codes= []\n if cmd_name\n codes << Protocol.find_cmd_by_nam...
[ "0.64920133", "0.6275205", "0.6202513", "0.61565375", "0.59722304", "0.5963348", "0.59285307", "0.5902843", "0.5902843", "0.58158433", "0.5759751", "0.56803155", "0.56201535", "0.550342", "0.54893345", "0.5482523", "0.54738873", "0.5463691", "0.5428636", "0.5395923", "0.52986...
0.7881037
0
Register an Interceptor which will be called before SMS is sent. Either a class, string or symbol can be passed in as the Interceptor. If a string or symbol is passed in it will be camelized and constantized.
def register_interceptor(interceptor) delivery_interceptor = case interceptor when String, Symbol interceptor.to_s.camelize.constantize else interceptor end Sms.register_interceptor(delivery_interceptor) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def insert_interceptor_before(before_class, interceptor_class, opts = {})\n raise ServerAlreadyStartedError if @started\n\n @interceptors.insert_before(before_class, interceptor_class, opts)\n end", "def add_interceptor\n if block_given?\n return ::Vertx::Util::Utils.safe_create(@j_del.j...
[ "0.59021276", "0.55795234", "0.5575204", "0.53699553", "0.5249061", "0.5235346", "0.49543458", "0.48993805", "0.48193035", "0.4788649", "0.4740327", "0.47201663", "0.46990988", "0.46858713", "0.46667594", "0.46568", "0.4645143", "0.46406376", "0.46191972", "0.4602056", "0.459...
0.7562432
0
Returns the name of current carrier. If this is an anonymous carrier, this method will return +anonymous+ instead.
def carrier_name @carrier_name ||= anonymous? ? "anonymous" : name.underscore end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def carrier_name\r\n self.class.carrier_name\r\n end", "def carrier_code\n @raw_data[:CarrierCode]\n end", "def get_carrier\n return self.sendcmd(\"modem.get_carrier\")\n end", "def carrier_named(str)\n format(str, @carrier)\n end", "def carrier_named(str)\n for...
[ "0.8495651", "0.68502456", "0.66989446", "0.65293354", "0.6158759", "0.60516113", "0.5974905", "0.5963875", "0.5916474", "0.5898807", "0.58903426", "0.5866937", "0.57878906", "0.57865316", "0.57840097", "0.5755189", "0.57543296", "0.568458", "0.56831473", "0.5657896", "0.5652...
0.8844491
0
Sets the defaults through app configuration: config.sms_carrier.default(from: "+886987654321") Aliased by ::default_options=
def default(value = nil) self.default_params = default_params.merge(value).freeze if value default_params end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def default_options\n {\n appid: app_id,\n device_id: device_id,\n locale: locale,\n ip: ip,\n offer_types: offer_types,\n timestamp: Time.now.to_i\n }\n end", "def set_defaults!\n __load_config( DEFAULTS )\n end", "def default(options = {})\n options.s...
[ "0.6775421", "0.6588495", "0.65129876", "0.64122325", "0.63508976", "0.62678385", "0.6261237", "0.6261237", "0.6217607", "0.6217607", "0.6217607", "0.6217607", "0.6217607", "0.6217607", "0.6184522", "0.61431485", "0.6136129", "0.6120609", "0.60916364", "0.60627145", "0.605377...
0.0
-1
Wraps an SMS delivery inside of ActiveSupport::Notifications instrumentation. This method is actually called by the Sms object itself through a callback when you call :deliver on the Sms, calling +deliver_sms+ directly and passing a Sms will do nothing except tell the logger you sent the SMS.
def deliver_sms(sms) #:nodoc: ActiveSupport::Notifications.instrument("deliver.sms_carrier") do |payload| set_payload_for_sms(payload, sms) yield # Let Sms do the delivery actions end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def deliver\n #inform_interceptors\n if delivery_handler\n delivery_handler.deliver_sms(self) { do_delivery }\n else\n do_delivery\n end\n inform_observers\n self\n end", "def deliver!(sms = @sms) #:nodoc:\n raise \"no SMS object available for delivery!\" unles...
[ "0.74633884", "0.6971011", "0.6612493", "0.6426253", "0.6391535", "0.62926674", "0.6189963", "0.6067854", "0.60270166", "0.59456044", "0.58586025", "0.5830061", "0.5798084", "0.57877594", "0.57648844", "0.57234144", "0.5710934", "0.5624566", "0.560353", "0.55971485", "0.55241...
0.79985523
0
Instantiate a new carrier object. If +method_name+ is not +nil+, the carrier will be initialized according to the named method. If not, the carrier will remain uninitialized (useful when you only need to invoke the "receive" method, for instance).
def initialize(method_name=nil, *args) super() @_sms_was_called = false @_message = Sms.new process(method_name, *args) if method_name end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initialize(method_name = nil, *parameters) #:nodoc:\n create!(method_name, *parameters) if method_name\n end", "def initialize(method_name)\n @method_name = method_name\n end", "def initialize(receiver, method_name, binding=nil)\n @receiver, @name = receiver, method_name\n end",...
[ "0.62899864", "0.6024044", "0.5677715", "0.5597838", "0.5566101", "0.5518339", "0.5264826", "0.5236656", "0.5186653", "0.5111068", "0.5108602", "0.5096543", "0.50646687", "0.5051293", "0.504573", "0.5018599", "0.49267265", "0.48979396", "0.48811573", "0.48317456", "0.47956795...
0.5704887
2
Returns the name of the carrier object.
def carrier_name self.class.carrier_name end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def carrier_name\r\n @carrier_name ||= anonymous? ? \"anonymous\" : name.underscore\r\n end", "def name\n @object.to_s\n end", "def getName()\n return @obj_name\n end", "def carrier_named(str)\n format(str, @carrier)\n end", "def object_name\n @object.name.split(...
[ "0.76730263", "0.6974779", "0.6893569", "0.6643859", "0.6603426", "0.6565774", "0.6454566", "0.64064866", "0.6369259", "0.6363048", "0.63179505", "0.63048327", "0.62445253", "0.6231405", "0.6218", "0.6210503", "0.6210503", "0.6210503", "0.6151897", "0.6135332", "0.6131647", ...
0.85588706
0
Allows you to pass random and unusual options to the new SmsCarrier::Sms object which will add them to itself. options['XSpecialDomainSpecificOption'] = "SecretValue" The resulting SmsCarrier::Sms will have the following in its option: XSpecialDomainSpecificOption: SecretValue def options
def options(args = nil) if args @_message.options.merge!(args) else @_message end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def options_express\n\t\t@options_express = {\n\t\t\t:ip => ip,\n\t\t\t:token => paypal_express_token,\n\t\t\t:payer_id => paypal_express_payer_id\n\t\t}\t\n\tend", "def initialize(options = {})\n super\n if Hash === settings[:'x-smtpapi']\n settings[:'x-smtpapi'] = JSON.dump(settings[:'x-...
[ "0.6264604", "0.6156757", "0.5664667", "0.5649857", "0.56305474", "0.56128013", "0.5608313", "0.55831003", "0.5536525", "0.5532046", "0.55244935", "0.5522931", "0.5514655", "0.5512254", "0.55044", "0.54933006", "0.54933006", "0.54933006", "0.54933006", "0.54933006", "0.549330...
0.0
-1
The main method that creates the message and renders the SMS templates. There are two ways to call this method, with a block, or without a block. It accepts a headers hash. This hash allows you to specify the most used headers in an SMS message, these are: +:to+ Who the message is destined for, can be a string of addresses, or an array of addresses. +:from+ Who the message is from You can set default values for any of the above headers (except +:date+) by using the ::default class method: class Notifier Sms ready to call :deliver on to send. For example: class Notifier < SmsCarrier::Base
def sms(options = {}) return @_message if @_sms_was_called && options.blank? m = @_message # Call all the procs (if any) default_values = {} self.class.default.each do |k,v| default_values[k] = v.is_a?(Proc) ? instance_eval(&v) : v end # Handle defaults options = options.reverse_merge(default_values) # Set configure delivery behavior wrap_delivery_behavior!(options.delete(:delivery_method), options.delete(:delivery_method_options)) # Assign all options except body, template_name, and template_path assignable = options.except(:body, :template_name, :template_path) assignable.each { |k, v| m[k] = v } # Render the templates and blocks m.body = response(options) @_sms_was_called = true m end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mail params = {}, &block\n\n raise ArgumentError.new( \"sender required\" ) unless params[ :from ].present?\n raise ArgumentError.new( \":to needs to be an array\" ) unless params[ :to ].present? && params[ :to ].is_a?( Array )\n raise ArgumentError.new( \"at least one recipient required\" ) unl...
[ "0.6228201", "0.6178817", "0.6168813", "0.61537635", "0.6130894", "0.6090694", "0.60137093", "0.5940313", "0.59294", "0.5923421", "0.5903832", "0.5891516", "0.5882746", "0.58775634", "0.58106244", "0.57944214", "0.57863754", "0.57690144", "0.5751187", "0.5747487", "0.57446426...
0.6579642
0
Updates its receiver just like +update+ but calls save! instead of +save+, so an exception is raised if the record is invalid.
def update!(attributes) # The following transaction covers any possible database side-effects of the # attributes assignment. For example, setting the IDs of a child collection. # with_transaction_returning_status do # assign_attributes(attributes) # save! # end send_log "#{self.class}(#{self.id})\n -update!(attributes=#{attributes}) - new_record? #{self.new_record?}", BLUE, WHITE_BG super end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_record(record, model)\n raise_must_override\n end", "def update_model(model, record)\n raise_must_override\n end", "def save!\n create_or_update or raise RecordNotSaved\n end", "def save!(*)\n create_or_update || raise(RecordNotSaved)\n end", "def save_with_valida...
[ "0.67011845", "0.656212", "0.6325528", "0.6268453", "0.6085279", "0.5977361", "0.59665185", "0.5933047", "0.59068745", "0.5894534", "0.5867078", "0.5847304", "0.5760507", "0.5753609", "0.5734288", "0.5721243", "0.5717203", "0.5695688", "0.5691783", "0.5690164", "0.5670649", ...
0.51869404
94
GET /weapons/1 GET /weapons/1.json
def show @weapon = Weapon.find(params[:id]) respond_to do |format| format.html # show.html.erb format.json { render json: @weapon } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @weapons = Weapon.all\n\n render json: @weapons\n end", "def show\n @weapons_type = WeaponsType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @weapons_type }\n end\n end", "def show\n render json: @weapon\n end...
[ "0.7620624", "0.7189642", "0.7102485", "0.69799143", "0.69799143", "0.69689846", "0.68149984", "0.68138134", "0.6691", "0.66799194", "0.66679573", "0.66334397", "0.6530178", "0.6520478", "0.64106685", "0.63381404", "0.63181996", "0.6242265", "0.61179525", "0.6091401", "0.6040...
0.7386189
1
GET /weapons/new GET /weapons/new.json
def new @weapon = Weapon.new respond_to do |format| format.html # new.html.erb format.json { render json: @weapon } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @weapons_type = WeaponsType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @weapons_type }\n end\n end", "def new\n @weapon_kind = WeaponKind.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render ...
[ "0.7845575", "0.75163627", "0.7183567", "0.7163825", "0.706204", "0.7027837", "0.7027837", "0.6948872", "0.6893723", "0.68547326", "0.6840513", "0.67925453", "0.6792377", "0.67888635", "0.6782877", "0.6778225", "0.6738559", "0.6707748", "0.6690493", "0.6686553", "0.6676164", ...
0.7992131
0
POST /weapons POST /weapons.json
def create @weapon = Weapon.new(params[:weapon]) respond_to do |format| if @weapon.save format.html { redirect_to @weapon, notice: 'Weapon was successfully created.' } format.json { render json: @weapon, status: :created, location: @weapon } else format.html { render action: "new" } format.json { render json: @weapon.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @weapon = Weapon.new(weapon_params)\n\n if @weapon.save\n render json: @weapon, status: :created, location: @weapon\n else\n render json: @weapon.errors, status: :unprocessable_entity\n end\n end", "def create\n @weapon = Weapon.new(weapon_params)\n\n respond_to do |form...
[ "0.727721", "0.6872981", "0.68676937", "0.68676937", "0.67620575", "0.6574865", "0.6567704", "0.6530898", "0.6409188", "0.6345288", "0.61694443", "0.6140537", "0.61349064", "0.6081107", "0.6062876", "0.60300845", "0.5990556", "0.5892557", "0.587066", "0.58628786", "0.5834465"...
0.6927277
1
PUT /weapons/1 PUT /weapons/1.json
def update @weapon = Weapon.find(params[:id]) respond_to do |format| if @weapon.update_attributes(params[:weapon]) format.html { redirect_to @weapon, notice: 'Weapon was successfully updated.' } format.json { head :no_content } else format.html { render action: "edit" } format.json { render json: @weapon.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @weapon = Weapon.find(params[:id])\n\n if @weapon.update(weapon_params)\n head :no_content\n else\n render json: @weapon.errors, status: :unprocessable_entity\n end\n end", "def set_api_v1_weapon\n @weapon = Weapon.find(params[:id])\n end", "def update\n @weap...
[ "0.7508383", "0.7056804", "0.70372385", "0.68401027", "0.68264973", "0.68264973", "0.67953235", "0.658942", "0.6334765", "0.6251913", "0.6251913", "0.6251913", "0.6220673", "0.619808", "0.61721087", "0.6110915", "0.6085381", "0.5924258", "0.5892903", "0.589166", "0.5885448", ...
0.7070163
1
DELETE /weapons/1 DELETE /weapons/1.json
def destroy @weapon = Weapon.find(params[:id]) @weapon.destroy respond_to do |format| format.html { redirect_to weapons_url } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @weapons_type = WeaponsType.find(params[:id])\n @weapons_type.destroy\n\n respond_to do |format|\n format.html { redirect_to weapons_types_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @weapon.destroy\n\n head :no_content\n end", "def destroy\...
[ "0.7346109", "0.73445624", "0.7285096", "0.7285096", "0.7280427", "0.7171071", "0.70926833", "0.70523924", "0.69661045", "0.68320554", "0.68047464", "0.6727977", "0.67099714", "0.66829544", "0.6642405", "0.66210496", "0.6579506", "0.6578651", "0.6552099", "0.6531495", "0.6486...
0.75593835
0
Can take trains (one at a time)
def arrival(train) @trains << train end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def trains\n currently_owned(Transaction::IS_TRAIN)\n end", "def list_trains_on_station\n if @trains.empty? || @stations.empty?\n trains_or_stations_void\n else\n request = request_station\n station = getting(request, :approve_station_selection, :select_station)\n check_the_trai...
[ "0.6562159", "0.6277997", "0.6132191", "0.59968495", "0.5958699", "0.58918655", "0.58738065", "0.56264275", "0.56124353", "0.55535334", "0.55197066", "0.54711455", "0.5419702", "0.5418781", "0.5409581", "0.5407284", "0.5394797", "0.53548205", "0.5345095", "0.5344221", "0.5321...
0.5557728
9
May return a list of all trains at a station currently in use.
def trains_list @trains.each_with_index do |train, index| puts "#{index}. Поезд номер #{train.num}" end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def list_trains_on_station\n if @trains.empty? || @stations.empty?\n trains_or_stations_void\n else\n request = request_station\n station = getting(request, :approve_station_selection, :select_station)\n check_the_trains(station)\n end\n end", "def list_stations\n if @stations.em...
[ "0.7824395", "0.70303375", "0.693891", "0.6926481", "0.6796568", "0.6625474", "0.6580129", "0.65419567", "0.6461296", "0.6461236", "0.6455939", "0.64547074", "0.6373118", "0.6348109", "0.63069975", "0.62987155", "0.6212069", "0.6201019", "0.62005323", "0.61925745", "0.611712"...
0.5606175
47
Can send trains (one at a time, while the train is removed from the list of trains located at the station).
def departure(train) @trains.delete(train) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def list_trains_on_station\n if @trains.empty? || @stations.empty?\n trains_or_stations_void\n else\n request = request_station\n station = getting(request, :approve_station_selection, :select_station)\n check_the_trains(station)\n end\n end", "def transfer_trains(buyer, minor)\n ...
[ "0.6386513", "0.62325746", "0.6177805", "0.5990064", "0.5900681", "0.58220434", "0.5757583", "0.568733", "0.5662197", "0.5625975", "0.5621492", "0.54829425", "0.54636014", "0.54334444", "0.541536", "0.5385499", "0.5385499", "0.5379937", "0.53464854", "0.53431845", "0.5340136"...
0.4692161
88
Can return the list of trains at the station by type (see below): number of freight, passenger
def trains_type(type) @trains.select { |train| train.type == type } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def list_trains_on_station\n if @trains.empty? || @stations.empty?\n trains_or_stations_void\n else\n request = request_station\n station = getting(request, :approve_station_selection, :select_station)\n check_the_trains(station)\n end\n end", "def amount_trains(type_of_train)\n ...
[ "0.68424284", "0.6778056", "0.6342554", "0.6283103", "0.6283103", "0.62027794", "0.6158821", "0.61308414", "0.59996545", "0.5978338", "0.5971476", "0.59548247", "0.5944395", "0.591398", "0.58937263", "0.5870441", "0.58124983", "0.5801478", "0.5786857", "0.5760002", "0.5750971...
0.66560495
2
Subject can be set in your I18n file at config/locales/en.yml with the following lookup: en.system_mailer.info.subject
def provide_course(user, host, course ) @host = host @course = course @user = user @subject = I18n.t('mailer.subject.provide_course') mail to: user.email, subject: @subject do |format| format.html format.text end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def message_subject=(value)\n @message_subject = value\n end", "def subject (recipient)\n subject_variables = alert_variables[:subject].dup\n subject_variables.merge!(recipient_details(recipient))\n subject = \"#{I18n.t(\"#{recipient_type.to_s}_subject_#{alert_name.to_s}\...
[ "0.7526513", "0.7352996", "0.72834325", "0.72603995", "0.7136496", "0.70399773", "0.6931514", "0.68924624", "0.6881371", "0.6786234", "0.67808723", "0.6779901", "0.6758667", "0.67564535", "0.6742295", "0.6664095", "0.6662977", "0.66543335", "0.66125125", "0.65540534", "0.6506...
0.0
-1
Opens google analytics for given date range
def analytics_day(start_date=nil, end_date=nil) start_date = start_date ? Date.parse("#{start_date}/2010") : Date.today start_date = start_date.strftime("%Y%m%d") end_date ||= start_date "https://www.google.com/analytics/reporting/?reset=1&id=14680769&pdr=#{start_date}-#{end_date}" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_data(startdate, enddate)\n\t\t\n\t\tdate_range = @analytics::DateRange.new(start_date: startdate, end_date: enddate)\n\t\torder_by = @analytics::OrderBy.new(field_name: 'ga:pageviews', sort_order: 'DESCENDING')\n\t\t# metric = @analytics::Metric.new(expression: 'ga:sessions')\n\t\t# metric = @analytics::Me...
[ "0.63572794", "0.6313685", "0.60575753", "0.59435356", "0.5846436", "0.58456767", "0.58207065", "0.58202654", "0.5750075", "0.5693158", "0.5683875", "0.56447446", "0.5629932", "0.5623933", "0.5623061", "0.56173193", "0.55412436", "0.5487006", "0.54596186", "0.5445153", "0.539...
0.7239136
0
GET /resource/sign_up def new super end POST /resource def create super end GET /resource/edit def edit super end PUT /resource
def update @user = User.find(current_user.id) successfully_updated = if needs_password?(@user, params) @user.update_with_password(params.require(:user).permit(:city, :email, :image, :mobile, :name, :current_password, :password, :password_confirmation)) # Rails 3: @user.update_with_password(params[:user]) else # remove the virtual current_password attribute update_without_password # doesn't know how to ignore it params[:user].delete(:current_password) params[:user].delete(:password) params[:user].delete(:password_confirmation) @user.update_without_password(params.require(:user).permit(:city, :email, :image, :mobile, :name)) # Rails 3: @user.update_without_password(params[:user]) end if successfully_updated set_flash_message :notice, :updated # Sign in the user bypassing validation in case his password changed sign_in @user, :bypass => true redirect_to after_update_path_for(@user) else render "edit" end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sign_up(resource_name, resource)\n end", "def create\n build_resource(configure_sign_up_params)\n resource.save\n if resource.persisted?\n if resource.active_for_authentication?\n set_flash_message! :notice, :signed_up\n # To avoid login comment out sign_up method\n # sign...
[ "0.73094225", "0.7143316", "0.7139352", "0.7093727", "0.70841634", "0.70673263", "0.70468694", "0.7030183", "0.7023876", "0.70186096", "0.69935054", "0.68971246", "0.6887406", "0.68824106", "0.68538487", "0.6840544", "0.68178946", "0.678085", "0.6775286", "0.67693114", "0.675...
0.0
-1
Lambda needed for number of files scanned, which will be displayed to update user
def increase_by(i) start = 0 lambda { start += i } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def total_views_per_file_path\n iterate_over_file_paths.group_by { |x| x }.map { |k, v| [k, v.count] }\n end", "def parse_remaining_files; end", "def file_count\n source_dir = Item.new(Path.new(params[:source]))\n type = params[:type]\n\n response = {}\n response[:source_dir] = source_dir\n ...
[ "0.6182283", "0.61806554", "0.6175058", "0.61569154", "0.60688233", "0.5996847", "0.5982496", "0.5973599", "0.59651846", "0.59515804", "0.5921781", "0.58880675", "0.5874029", "0.5843044", "0.58203965", "0.58097774", "0.57933515", "0.57842255", "0.57836914", "0.5776995", "0.57...
0.0
-1
Builds an array of FileName Objects (array of files), and prints to console how many files scanned iterates through each item in the cwd, determines if it's a file if it's a file push it to the an array of FileName objects and print every time it scans another 100 items or it's a directory, cd into dir and recursively call itself
def buildArray(localObjCache, increase) localDirContents=[] #Array of all items in the cwd localDirContents=Dir[Dir.pwd+"/*"] #Builds the array of items in cwd localDirContents.each do |item| if File.file?(item) fileObj = FileName.new(item) localObjCache.push(fileObj) n = increase.call #printing every 100 files scanned if n % 100 == 0 puts n end elsif File.directory?(item) Dir.chdir(item) buildArray(localObjCache, increase) end end return localObjCache end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def run_through_directory\n@file_array = []\n Dir.foreach('text_files') do |item|\n next if item == '.' or item == '..'\n @file_array << item\n end\nend", "def list\n\t\t\tbegin\n\n\t\t\t\t# Prepare result, array of absolute paths for found files\n # within given directory. Also empty cache\n\t\t\...
[ "0.68762404", "0.6591346", "0.6549699", "0.6525785", "0.65008914", "0.6456145", "0.64399177", "0.6364088", "0.6328656", "0.6282633", "0.6266714", "0.626177", "0.6255684", "0.62280965", "0.6217155", "0.6205192", "0.6200233", "0.61635053", "0.61617696", "0.61573184", "0.6133623...
0.81003904
0
Compares each fileObj's md5sum against all But first, if it's empty write to push it to a blanks array However, if equal create a hash of the files and
def findDups(objArray, dupsHashArray, emptyFileArray) objArray.each_with_index do |obj, idx1| if obj.is_empty? emptyFileArray.push(obj.fileName) next end objArray.each_with_index do |obj2, idx2| next if idx1 >= idx2 if obj.md5 === obj2.md5 foundDupHash= {:filePath => obj.fileName, :duplicatePath => obj2.fileName} dupsHashArray.push(foundDupHash) end end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def digest_md5(*files)\n files.flatten.collect { |file| \n File.exists?(file) ? Digest::MD5.hexdigest(File.read(file)) : nil\n }\n end", "def create_chksum_manifest\n chksum_manifest = {}\n files = Dir['*'].select{ |f| File.file? f }\n files.each do |file|\n chksum_manifest[file...
[ "0.7309035", "0.6222126", "0.62051445", "0.61634356", "0.6143314", "0.60822695", "0.60662055", "0.6013033", "0.5989002", "0.5984541", "0.5959028", "0.5919082", "0.5893212", "0.58859193", "0.5865386", "0.585678", "0.58500415", "0.584677", "0.58399975", "0.5839947", "0.58067626...
0.7070345
1
Print all blanks to a file
def printEmpty(emptyFileArray) puts "Writing blanks to: /tmp/blanks.txt" File.open("/tmp/blanks.txt", "w") do |f| emptyFileArray.each { |element| f.puts(element)} end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def null_finish\n file.write(\"\\r\" + ' ' * @last_printed_length + \"\\r\")\n end", "def Blank(lines)\n (0..lines).each do |i|\n puts ''\n end\nend", "def blank_line\n output \"\"\n end", "def blank\n print \"\\r\"\n if @last_print_msg\n print ' ' * IO.console.winsi...
[ "0.7097197", "0.65455383", "0.65428", "0.62220454", "0.6126611", "0.59796596", "0.5907679", "0.5874472", "0.5841131", "0.5837019", "0.581967", "0.5817886", "0.5814973", "0.5811486", "0.57828283", "0.5703171", "0.56993085", "0.56838024", "0.5672721", "0.56619817", "0.5656799",...
0.75180495
0
Write all dups to a file
def printDups(dupsHashArray) puts "Writing duplicates to: /tmp/duplicates.txt" File.open("/tmp/duplicates.txt","w") do |f| dupsHashArray.each { |element| f.puts(element[:filePath] + " : " + element[:duplicatePath]) } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_dups(hash)\n open(\"dups.txt\", 'w') do |f|\n f.puts '=== Identical Files ===' \n hash.each_value do |a|\n next if a.length == 1\n a.each { |fname| f << (\"\\t\" + fname) }\n f << \"\\n\\n\"\n end\n end\nend", "def write_file(log)\n log[:files_revised] += 1\n File.op...
[ "0.66661114", "0.632595", "0.59438217", "0.5790082", "0.5757605", "0.5696864", "0.5665927", "0.56114036", "0.5498036", "0.5468797", "0.54248947", "0.5416237", "0.5406858", "0.5397021", "0.53969204", "0.53860706", "0.53577125", "0.53319633", "0.53247267", "0.53167874", "0.5301...
0.6451853
1
Use callbacks to share common setup or constraints between actions.
def set_background @background = Background.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 background_params params.require(:background).permit(:name) 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
this method jpins to strings together and prints to the screen
def get_info_from_user puts "Enter some random text" random_stuff = gets in_one_line = "This is what you just wrote: " + random_stuff.chomp puts in_one_line end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def stringOutput\n\t\tend", "def stringOutput\n\t\tend", "def display\n to_s.split(\"\\n\")\n .map { |line| line.split('').join(' ') }\n .join(\"\\n\")\n end", "def to_s\n r = \"##### ##### ##### ##### #####\\n\"\n (0..2).each { |y|\n (0..2).each { |x|\n r += get_p...
[ "0.66156185", "0.66156185", "0.64604497", "0.64210224", "0.63958246", "0.6366173", "0.6295643", "0.6204997", "0.6189268", "0.6180986", "0.611861", "0.611861", "0.611861", "0.611861", "0.6116211", "0.6099918", "0.6098071", "0.6088893", "0.6085352", "0.6064517", "0.6062601", ...
0.0
-1
rubocop:disable AbcSize, BlockLength, LineLength, MethodLength
def conflicts @planning = Planning.find(params[:id]) @slots = @planning.slots.order(:id) @slot = Slot.new @slot_templates = Slot.slot_templates # liste des roles # modifier 1 slot mécano du mercredi 13/9 en "no solution" # guersbru : le dit slot n'a pas toujours l'id 887... ça crash je commente la ligne # Slot.find(887).user_id = "no solution" @url = 'conflicts' # variables pour fullcalendar @slots_array = [] @slots_solution = [] @user = current_user @slots.each do |slot| # Fake solution > def user id solution if !User.find(slot.user_id).profile_picture.nil? # picture du user picture = 'http://res.cloudinary.com/dksqsr3pd/image/upload/c_fill,r_60,w_60/' + User.find(slot.user_id).profile_picture.path else # point d'interrogation par defaut picture = 'http://a398.idata.over-blog.com/60x60/3/91/14/12/novembre-2010/point-d-interrogation-bleu-ciel.jpg' end a = { id: slot.id, start: slot.start_at, end: slot.end_at, title: Role.find_by(id: slot.role_id).name, # nom du role role_id: slot.role_id, # nom du role created_at: slot.created_at, updated_at: slot.updated_at, color: Role.find_by(id: slot.role_id).role_color, planning_id: slot.planning_id, user_id: User.find(slot.user_id).id, picture: picture } picture_solution = 'http://res.cloudinary.com/dksqsr3pd/image/upload/c_fill,r_60,w_60/' + User.find_by(first_name: 'jean').profile_picture.path user_id_solution = User.find_by(first_name: 'jean').id b = { id: slot.id, start: slot.start_at, end: slot.end_at, title: Role.find_by(id: slot.role_id).name, # nom du role role_id: slot.role_id, # nom du role created_at: slot.created_at, updated_at: slot.updated_at, color: Role.find_by(id: slot.role_id).role_color, planning_id: slot.planning_id, user_id: user_id_solution, picture: picture_solution } @slots_array << a @slots_solution << if slot.user_id == User.find_by(first_name: 'no solution').id b else a end end # Fake solution => le boss remplacera le no solution @user_solution = User.find_by(first_name: 'jean') demo_method(@planning) if @planning.week_number == 37 end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def private; end", "def big_bad; end", "def probers; end", "def private_method\n end", "def implementation; end", "def implementation; end", "def schubert; end", "def code_of_conduct; end", "def custom; end", "def custom; end", "def extra; end", "def suivre; end", "def operations; end"...
[ "0.7032071", "0.5972274", "0.5872646", "0.5856577", "0.5762335", "0.5762335", "0.5735455", "0.5687095", "0.5597882", "0.5597882", "0.5542398", "0.5530145", "0.54522645", "0.54522645", "0.54329884", "0.54105234", "0.54105234", "0.54035926", "0.5383898", "0.5383798", "0.5383798...
0.0
-1
rubocop:enable AbcSize, BlockLength, LineLength
def update @planning = Planning.find(params[:id]) @planning.update(planning_params) @planning.save! redirect_to planning_conflicts_path(@planning) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def private; end", "def big_bad; end", "def lines_of_code; end", "def lines_of_code; end", "def probers; end", "def run_line_length_cop; end", "def code_of_conduct; end", "def source_line; end", "def schubert; end", "def coverage_exceeding_source_warn; end", "def extra; end", "def implementat...
[ "0.69074905", "0.60839236", "0.58996403", "0.58996403", "0.58639127", "0.57792765", "0.5758479", "0.55996275", "0.5596788", "0.55755144", "0.55025595", "0.5475239", "0.5475239", "0.5468404", "0.5468404", "0.5442064", "0.5438099", "0.5437117", "0.5426335", "0.5426335", "0.5415...
0.0
-1
before_filter :authenticate_user! prepend_before_filter :require_admin_access , :only => [ :new, :create, :cancel ] prepend_before_filter :authenticate_scope! , :only => [:edit, :update, :destroy] GET /resource/edit
def edit render :edit end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n # authorize Admin\n end", "def edit\n #@user = User.find(params[:id]) \n #replced by the before_action at the top\n end", "def edit\n authorize! :edit, @user, :id => current_user.id\n end", "def edit\n authorize! :update, @user\n end", "def authorize\n rend...
[ "0.68939215", "0.67663276", "0.6688926", "0.6678317", "0.66612405", "0.66326237", "0.6627623", "0.66241854", "0.6611571", "0.6563689", "0.656317", "0.6562768", "0.65524554", "0.65347296", "0.652652", "0.6512788", "0.65017927", "0.65015656", "0.6460848", "0.6445243", "0.644238...
0.0
-1
PUT /resource We need to use a copy of the resource because we don't want to change the current user in place.
def update self.resource = resource_class.to_adapter.get!(send(:"current_#{resource_name}").to_key) if resource.update_with_password(resource_params) if is_navigational_format? if resource.respond_to?(:pending_reconfirmation?) && resource.pending_reconfirmation? flash_key = :update_needs_confirmation end set_flash_message :notice, flash_key || :updated end sign_in resource_name, resource, :bypass => true respond_with resource, :location => after_update_path_for(resource) else clean_up_passwords resource respond_with resource end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def put\n if(resource.collection?)\n Forbidden\n elsif(!resource.parent_exists? || !resource.parent_collection?)\n Conflict\n else\n resource.lock_check if resource.supports_locking?\n status = resource.put(request, response)\n response['Location'] = \"#{scheme}://...
[ "0.7224355", "0.7005823", "0.69810694", "0.6971466", "0.69555235", "0.6954134", "0.6753178", "0.6746057", "0.6743163", "0.67177105", "0.67177105", "0.6707934", "0.6707934", "0.6707934", "0.6707934", "0.6707934", "0.6707934", "0.6707934", "0.6707934", "0.6702649", "0.6697928",...
0.0
-1
def simplify_through_dictionary (0...columns).each do |col| (0...rows).each do |row|
def print_all @data.each do |row| row.each do |item| print " ", item.area end print "\n" end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def print_map\n map.each_with_index do |row, i|\n row.each_with_index do |col , j|\n #puts col\n if col == 'R'\n print 'R'\n elsif col == 'S'\n print 'S'\n elsif col == 'B'\n print 'B'\n elsif col == 'W'\n print 'W'\n else\n ...
[ "0.6015866", "0.5902497", "0.5893342", "0.5833148", "0.5833148", "0.5823839", "0.5727281", "0.5672835", "0.567249", "0.5602327", "0.5602327", "0.55974495", "0.5595926", "0.557455", "0.5567937", "0.55205506", "0.5499634", "0.54925597", "0.5471352", "0.54660463", "0.54648113", ...
0.0
-1
GET /users GET /users.json
def index @users = User.all if is_admin? @users = User.all - User.where(:username => "Anonymous") elsif is_member? @users = [@current_user] else redirect_to "signup" end respond_to do |format| format.html # index.html.erb format.json { render json: @users } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def users(args = {})\n get(\"/users.json\",args)\n end", "def show\n begin\n user = User.find(params[:user_id])\n render json: { users: user }, status: :ok\n rescue => e\n render json: { errors: e.message}, status: 404\n end\n end", "def GetUsers params = {}\n\n para...
[ "0.82109934", "0.7873764", "0.7860689", "0.78108346", "0.78067017", "0.7678852", "0.76586664", "0.76318866", "0.7582366", "0.75291824", "0.7487637", "0.74485743", "0.7439024", "0.7437192", "0.7427442", "0.73978853", "0.73978853", "0.73978853", "0.73978853", "0.7377353", "0.73...
0.0
-1
GET /users/1 GET /users/1.json
def show @user = User.find(params[:id]) @post_count = Post.where(:user_id => @user.id).count @vote_count = Vote.where(:user_id => @user.id).count @vote_for_your_posts_count = Post.where(:user_id => @user.id).joins(:votes).count if !is_admin? if !(@user == @current_user) redirect_to @current_user return end end respond_to do |format| format.html # show.html.erb format.json { render json: @user } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n if params[:single]\n\t url = \"#{API_BASE_URL}/users/#{params[:id]}.json\"\n\t response = RestClient.get(url)\n\t @user = JSON.parse(response.body)\n\telse\n\t url = \"#{API_BASE_URL}/users.json\"\t \n response = RestClient.get(url)\n @users = JSON.parse(response.body)\t\t \n\tend\n ...
[ "0.81046426", "0.7703556", "0.77011716", "0.76262826", "0.7582106", "0.74818", "0.7461394", "0.7446168", "0.730656", "0.7300699", "0.72902125", "0.72781444", "0.72358584", "0.72335744", "0.72335744", "0.72335744", "0.72335744", "0.72335744", "0.72335744", "0.72335744", "0.722...
0.0
-1
GET /users/new GET /users/new.json
def new if is_admin? if @superadmin_user @role_options = ["Administrator", "Member"] else @role_options = ["Member"] end else redirect_back_or(home_url) return end @user = User.new respond_to do |format| format.html #new.html.erb format.json { render json: @user } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @newuser = Newuser.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @newuser }\n end\n end", "def new\n @usernew = Usernew.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @usernew }\n ...
[ "0.8287397", "0.8169197", "0.8155916", "0.80483407", "0.8022376", "0.8021751", "0.8009459", "0.7950995", "0.793078", "0.793078", "0.7873476", "0.7873476", "0.7873476", "0.7860956", "0.7860956", "0.7860956", "0.7860956", "0.7860956", "0.7860956", "0.7860956", "0.7860956", "0...
0.0
-1
POST /users POST /users.json
def create @user = User.new(params[:user]) if !is_admin? @user.role = "Member" end respond_to do |format| if @user.save format.html { redirect_to @user, notice: 'User was successfully created.'} format.json { render json: @user, status: :created, location: @user } else if !is_admin? format.html { render "signup"} format.json { render json: @user.errors, status: :unprocessable_entity } else if @superadmin_user @role_options = ["Administrator", "Member"] else @role_options = ["Member"] end format.html {render "new"} format.json { render json: @user.errors, status: :unprocessable_entity } end end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def post_users(users)\n self.class.post('https://api.yesgraph.com/v0/users', {\n :body => users.to_json,\n :headers => @options,\n })\n end", "def CreateUser params = {}\n \n APICall(path: 'users.json',method: 'POST',payload: params.to_json)\n \n end", "def post b...
[ "0.77179813", "0.75206673", "0.73831296", "0.72405374", "0.719841", "0.7140812", "0.71038526", "0.7058827", "0.7041636", "0.70236504", "0.7003128", "0.70021695", "0.70021695", "0.70021695", "0.69936967", "0.6990463", "0.6980393", "0.6979075", "0.69788617", "0.69788617", "0.69...
0.0
-1
PUT /users/1 PUT /users/1.json
def update @user = User.find(params[:id]) respond_to do |format| if @user.update_attributes(params[:user]) format.html { redirect_to @user, notice: 'User was successfully updated.' } format.json { head :no_content } else format.html { render action: "edit" } format.json { render json: @user.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n render json: Users.update(params[\"id\"], params[\"user\"])\n end", "def update\n render json: User.update(params[\"id\"], params[\"user\"])\n end", "def UpdateUser params = {}\n \n APICall(path: 'users.json',method: 'PUT',payload: params.to_json)\n \n end", "de...
[ "0.74114245", "0.73920554", "0.73041475", "0.7254177", "0.7202618", "0.70756376", "0.70535713", "0.7029043", "0.70075685", "0.69883573", "0.6983195", "0.694263", "0.69409895", "0.692315", "0.6909438", "0.687742", "0.68486536", "0.6834162", "0.6821841", "0.6801179", "0.6770304...
0.0
-1
DELETE /users/1 DELETE /users/1.json
def destroy @user = User.find(params[:id]) if is_admin? if @user.role == "Super Administrator" flash[:notice] = "The Super Administrator cannot be deleted" redirect_to @user return end if @user.role == "Administrator" if !@superadmin_user if !(@current_user == @user) flash[:notice] = "Only the super administrator can delete other administrators" redirect_to @user return end end end else if !(@current_user == @user) flash[:notice] = "You do not have permission to delete this user!" redirect_to @current_user return end end @posts = Post.where(:user_id => @user.id).all #@replies = Reply.where(:user_id => @user.id).all @anonymous = User.where(:username => 'Anonymous').first @posts.each do |p| p.update_attributes(:user_id => @anonymous.id) end #@replies.each do |r| # r.update_attributes(:user_id => @anonymous.id) #end @user.destroy respond_to do |format| format.html { redirect_to users_url } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def DeleteUser id\n \n APICall(path: \"users/#{id}.json\",method: 'DELETE')\n \n end", "def delete\n render json: User.delete(params[\"id\"])\n end", "def delete(id)\n request(:delete, \"/users/#{id}.json\")\n end", "def delete\n render json: Users.delete(params[\"id\...
[ "0.78750724", "0.77518034", "0.7713981", "0.7610077", "0.747295", "0.74073994", "0.74073994", "0.7369968", "0.7346072", "0.7340465", "0.7328618", "0.7309635", "0.73095363", "0.7306841", "0.7297868", "0.72917855", "0.7291585", "0.7289111", "0.7284347", "0.7250935", "0.7250935"...
0.0
-1
Instantiates a new Angle object.
def initialize(angle, unit) case unit when :degrees, :deg then convert_and_normalize_degrees(angle) when :radians, :rad then convert_and_normalize_radians(angle) else raise InvalidArgumentsError, "Unit should be :degrees, :deg, :radians ord :rad." end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initialize(angle = 0, radians = false)\n # assumes that we are getting an angle in degrees.\n @angle = if radians == true || radians == :radians\n angle.to_f # works for String, Fixed, other Angles and for Float.\n elsif angle.instance_of?(Array)\n self.class.decim...
[ "0.67836183", "0.604015", "0.60051924", "0.5812162", "0.5794369", "0.57705545", "0.5723011", "0.5721475", "0.57086426", "0.56977314", "0.5696677", "0.5642626", "0.55957353", "0.55941373", "0.5579113", "0.55628693", "0.5552162", "0.55390257", "0.5537195", "0.5490472", "0.54695...
0.59488565
3
Returns the value of the angle (default unit: radians).
def to_f(unit = :radians) case unit when :degrees, :deg then @degrees when :radians, :rad then @radians else raise InvalidArgumentsError, "Unit should be :degrees, :deg, :radians ord :rad." end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def angle\n @angle\n end", "def angle_deg\n angle * RAD_TO_DEG\n end", "def angle\n rad / Math::PI * 180\n end", "def angle()\n a, c = @view__.angle, @context__\n c ? c.fromDegrees__(a) : a * Processing::GraphicsContext::DEG2RAD__\n end", "def angle_of_specified_r...
[ "0.7752398", "0.76539093", "0.763003", "0.75645053", "0.73539823", "0.72630644", "0.720393", "0.7139845", "0.70931804", "0.70875067", "0.70855814", "0.70381397", "0.70200324", "0.6990044", "0.69408244", "0.68078065", "0.6799878", "0.67603284", "0.6564051", "0.6561205", "0.655...
0.0
-1
Returns the string representation of the angle (default unit: radians).
def to_s(unit = :radians) case unit when :degrees, :deg then "#{@degrees}°" when :radians, :rad then "#@radians rad" else raise InvalidArgumentsError, "Unit should be :degrees, :deg, :radians ord :rad." end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def format_angle(value, unit)\n if unit == :degree\n value + '&#176;'\n else\n value + ' gon'\n end\n end", "def to_s\n \"#{@degrees.round(2)} #{@scale}\"\n end", "def angle_deg\n angle * RAD_TO_DEG\n end", "def to_s(angle_unit = :degrees)\n...
[ "0.75823575", "0.72691846", "0.7002912", "0.6994467", "0.6843078", "0.6805929", "0.67732173", "0.67571175", "0.6685982", "0.6598627", "0.65901154", "0.6551482", "0.6514853", "0.64941305", "0.64688224", "0.6359093", "0.62246895", "0.62061405", "0.62038636", "0.62018436", "0.61...
0.7584844
0
Normalize the angle (in degrees) and converts it in radians.
def convert_and_normalize_degrees(angle) @degrees = normalize_angle(angle, 360) @radians = deg_to_rad(@degrees) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def convert_and_normalize_radians(angle)\n @radians = normalize_angle(angle, (2 * Math::PI))\n @degrees = rad_to_deg(@radians)\n end", "def norm_angle(angle)\n while angle < 0; angle += Const::PI2; end\n while angle > Const::PI2; angle -= Const::PI2; end\n return angle\...
[ "0.8137588", "0.7489256", "0.7373862", "0.7199988", "0.7065164", "0.7023501", "0.7015415", "0.7009003", "0.69523966", "0.6831785", "0.67868745", "0.6752624", "0.6690953", "0.65927774", "0.659094", "0.65434813", "0.6506284", "0.6493496", "0.64889234", "0.6471543", "0.64454556"...
0.77647895
1
Normalize the angle (in radians) and converts it in degrees.
def convert_and_normalize_radians(angle) @radians = normalize_angle(angle, (2 * Math::PI)) @degrees = rad_to_deg(@radians) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def convert_and_normalize_degrees(angle)\n @degrees = normalize_angle(angle, 360)\n @radians = deg_to_rad(@degrees)\n end", "def norm_angle(angle)\n while angle < 0; angle += Const::PI2; end\n while angle > Const::PI2; angle -= Const::PI2; end\n return angle\n rescue...
[ "0.8270539", "0.7413582", "0.6906046", "0.6905473", "0.6809431", "0.6809337", "0.6805236", "0.6720024", "0.66929656", "0.6655652", "0.66262394", "0.66030914", "0.65747476", "0.64690137", "0.6419076", "0.6316655", "0.63118374", "0.62411577", "0.62169427", "0.62063026", "0.6179...
0.79983586
1
Convert an angle in degrees into radians
def deg_to_rad(deg) return (2 * Math::PI) * deg / 360 end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def convert_to_radians(degrees)\n degrees * PI / 180\nend", "def deg2rad(angle)\n angle * (Math::PI / 180.0)\n end", "def to_rad(angle)\n angle * Math::PI / 180\n end", "def to_radians\n self * Math::PI.fdiv(180)\n end", "def to_radians(deg)\n deg * Math::PI / 180\n end", "def an...
[ "0.8170839", "0.8003487", "0.79211396", "0.78019285", "0.7771638", "0.77399975", "0.7691498", "0.7684574", "0.75916225", "0.75691694", "0.75187236", "0.74985194", "0.7495361", "0.7476968", "0.74729913", "0.7400484", "0.7400484", "0.7385782", "0.7326304", "0.7310339", "0.72934...
0.7017877
32
Convert an angle in radians into degrees.
def rad_to_deg(rad) return 360 * rad / (2 * Math::PI) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_degrees(radians)\n (radians * 180.0) / Math::PI\n end", "def to_degrees\n self / Math::PI.fdiv(180)\n end", "def angle_deg\n angle * RAD_TO_DEG\n end", "def convert_and_normalize_degrees(angle)\n @degrees = normalize_angle(angle, 360)\n @radians = deg_to_rad(@degrees)\n ...
[ "0.81189156", "0.790555", "0.7879468", "0.78327274", "0.76273376", "0.7575523", "0.7331729", "0.7296378", "0.7281546", "0.72458893", "0.72180253", "0.7157238", "0.7086928", "0.7071854", "0.6983566", "0.6952312", "0.6918229", "0.688397", "0.68577486", "0.6825215", "0.6819694",...
0.6982797
15
Instantiates a new Science::Angle with the unit "radians".
def radians Science::Angle.new(self, :radians) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initialize(angle, unit)\n case unit\n when :degrees, :deg then convert_and_normalize_degrees(angle)\n when :radians, :rad then convert_and_normalize_radians(angle)\n else\n raise InvalidArgumentsError, \"Unit should be :degrees, :deg, :radians ord :rad.\"\n end\n end"...
[ "0.6892005", "0.68631434", "0.65866053", "0.6382998", "0.6376083", "0.636931", "0.6235788", "0.622283", "0.6215951", "0.61803144", "0.61582", "0.6068199", "0.6054293", "0.60163283", "0.6010951", "0.60075235", "0.59861964", "0.5979657", "0.5969036", "0.593779", "0.593302", "...
0.7452839
0
the desired result. To check your work, run this file by entering the following command in your terminal: `ruby section2/exercises/methods.rb` Example: Write a method that when called will print your name:
def print_name p "Severus Snape" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def print_name\n puts \"Will Meighan\"\nend", "def print_name(name)\nputs \"Name: #{name}\"\nend", "def print_name\n p \"Alexander Mathieu\"\nend", "def print_name\r\nputs \"Person called #{@name}\"\r\nend", "def print_name\n puts \"Person called #{@name}\" \n end", "def print_name\n p \"Chris\"\nen...
[ "0.7981318", "0.79593337", "0.7927941", "0.7921451", "0.7860017", "0.7855943", "0.7834982", "0.7834982", "0.7834982", "0.7834982", "0.7834982", "0.78063095", "0.7805286", "0.7803275", "0.7803275", "0.7803275", "0.77970177", "0.77950853", "0.7788758", "0.7786055", "0.7786028",...
0.0
-1
Write a method that takes a name as an argument and prints it:
def print_name(name) p "#{name} is my name." end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def print_name(name)\n puts name\nend", "def print_name(name)\n puts name\nend", "def print_name(name)\n puts name\nend", "def print_name(name)\n puts name\nend", "def print_name(name)\n puts name\nend", "def print_name(name)\n puts name\nend", "def print_name(name)\n puts name\nend", "def pri...
[ "0.8691205", "0.8691205", "0.8691205", "0.8691205", "0.8691205", "0.8691205", "0.8691205", "0.8691205", "0.8691205", "0.8691205", "0.8691205", "0.8691205", "0.8691205", "0.8691205", "0.8691205", "0.8691205", "0.8691205", "0.8691205", "0.8691205", "0.8691205", "0.8686641", "...
0.84173834
58
Write a method that takes in 2 numbers as arguments and prints their sum. Then call your method three times with different arguments passed in:
def summator(x, y) p x + y end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sum_these_numbers (a, b)\n puts a + b\nend", "def two_sum(nums)\nend", "def sum_these_numbers(a, b)\n puts a + b\nend", "def sum_these_numbers(a,b)\n puts a + b\nend", "def numbers(a, b)\n puts \"First number is #{a}\"\n puts \"Second number is #{b}\"\n return a + b\nend", "def sum_nums(num1, n...
[ "0.7773777", "0.7760679", "0.77463275", "0.7746314", "0.7674677", "0.7632542", "0.7614532", "0.7522872", "0.75148404", "0.75112593", "0.7504093", "0.7488711", "0.74648464", "0.7450623", "0.7448441", "0.74280834", "0.7426093", "0.73960274", "0.7391773", "0.73876697", "0.737364...
0.0
-1
Write a method that takes in two strings as arguments and prints a concatenation of those two strings. Example: The arguments could be (man, woman) and the end result might output: "When Harry Met Sally". Then call your method three times with different arguments passed in.
def concat_str(str1, str2) p str1 + str2 end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def string_concat(name_1, name_2)\n puts \"I went to the concert with \" +name_1 + \" and \" + name_2 + \".\"\nend", "def concatenation(word1, word2)\n puts \"Artist #{word1} just released their newest album, titled #{word2}.\"\nend", "def two_strings(man, woman)\n p \"When \" + man + \" Met \" + woman\nend...
[ "0.79055405", "0.78413045", "0.75947124", "0.74779415", "0.7411419", "0.73758453", "0.73172253", "0.730744", "0.7302126", "0.72814775", "0.7260351", "0.72505903", "0.7204876", "0.7182308", "0.71699727", "0.71513385", "0.71478766", "0.7142378", "0.7102632", "0.70819914", "0.70...
0.6807772
50
Update properties of this object
def update!(**args) @id = args[:id] unless args[:id].nil? @message = args[:message] unless args[:message].nil? end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_properties(hash)\n hash.each do |key, value|\n setter_method = \"#{key}=\"\n if self.respond_to?(setter_method)\n self.send(setter_method, value)\n end\n end\n end", "def update!(**args)\n @properties = args[:properties] if args.key?(:properties)\n ...
[ "0.7012263", "0.69181895", "0.69181895", "0.69181895", "0.69181895", "0.69181895", "0.67403597", "0.6709326", "0.6709326", "0.6696149", "0.6696149", "0.6696149", "0.6696149", "0.6618882", "0.6571848", "0.65386343", "0.65178275", "0.6394807", "0.6389745", "0.6389745", "0.63328...
0.0
-1
Update properties of this object
def update!(**args) @id = args[:id] unless args[:id].nil? @labels_added = args[:labels_added] unless args[:labels_added].nil? @labels_removed = args[:labels_removed] unless args[:labels_removed].nil? @messages = args[:messages] unless args[:messages].nil? @messages_added = args[:messages_added] unless args[:messages_added].nil? @messages_deleted = args[:messages_deleted] unless args[:messages_deleted].nil? end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_properties(hash)\n hash.each do |key, value|\n setter_method = \"#{key}=\"\n if self.respond_to?(setter_method)\n self.send(setter_method, value)\n end\n end\n end", "def update!(**args)\n @properties = args[:properties] if args.key?(:properties)\n ...
[ "0.7012263", "0.69181895", "0.69181895", "0.69181895", "0.69181895", "0.69181895", "0.67403597", "0.6709326", "0.6709326", "0.6696149", "0.6696149", "0.6696149", "0.6696149", "0.6618882", "0.6571848", "0.65386343", "0.65178275", "0.6394807", "0.6389745", "0.6389745", "0.63328...
0.0
-1
Update properties of this object
def update!(**args) @label_ids = args[:label_ids] unless args[:label_ids].nil? @message = args[:message] unless args[:message].nil? end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_properties(hash)\n hash.each do |key, value|\n setter_method = \"#{key}=\"\n if self.respond_to?(setter_method)\n self.send(setter_method, value)\n end\n end\n end", "def update!(**args)\n @properties = args[:properties] if args.key?(:properties)\n ...
[ "0.7012263", "0.69181895", "0.69181895", "0.69181895", "0.69181895", "0.69181895", "0.67403597", "0.6709326", "0.6709326", "0.6696149", "0.6696149", "0.6696149", "0.6696149", "0.6618882", "0.6571848", "0.65386343", "0.65178275", "0.6394807", "0.6389745", "0.6389745", "0.63328...
0.0
-1
Update properties of this object
def update!(**args) @label_ids = args[:label_ids] unless args[:label_ids].nil? @message = args[:message] unless args[:message].nil? end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_properties(hash)\n hash.each do |key, value|\n setter_method = \"#{key}=\"\n if self.respond_to?(setter_method)\n self.send(setter_method, value)\n end\n end\n end", "def update!(**args)\n @properties = args[:properties] if args.key?(:properties)\n ...
[ "0.7012263", "0.69181895", "0.69181895", "0.69181895", "0.69181895", "0.69181895", "0.67403597", "0.6709326", "0.6709326", "0.6696149", "0.6696149", "0.6696149", "0.6696149", "0.6618882", "0.6571848", "0.65386343", "0.65178275", "0.6394807", "0.6389745", "0.6389745", "0.63328...
0.0
-1
Update properties of this object
def update!(**args) @message = args[:message] unless args[:message].nil? end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_properties(hash)\n hash.each do |key, value|\n setter_method = \"#{key}=\"\n if self.respond_to?(setter_method)\n self.send(setter_method, value)\n end\n end\n end", "def update!(**args)\n @properties = args[:properties] if args.key?(:properties)\n ...
[ "0.7012263", "0.69181895", "0.69181895", "0.69181895", "0.69181895", "0.69181895", "0.67403597", "0.6709326", "0.6709326", "0.6696149", "0.6696149", "0.6696149", "0.6696149", "0.6618882", "0.6571848", "0.65386343", "0.65178275", "0.6394807", "0.6389745", "0.6389745", "0.63328...
0.0
-1
Update properties of this object
def update!(**args) @message = args[:message] unless args[:message].nil? end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_properties(hash)\n hash.each do |key, value|\n setter_method = \"#{key}=\"\n if self.respond_to?(setter_method)\n self.send(setter_method, value)\n end\n end\n end", "def update!(**args)\n @properties = args[:properties] if args.key?(:properties)\n ...
[ "0.7012263", "0.69181895", "0.69181895", "0.69181895", "0.69181895", "0.69181895", "0.67403597", "0.6709326", "0.6709326", "0.6696149", "0.6696149", "0.6696149", "0.6696149", "0.6618882", "0.6571848", "0.65386343", "0.65178275", "0.6394807", "0.6389745", "0.6389745", "0.63328...
0.0
-1
Update properties of this object
def update!(**args) @id = args[:id] unless args[:id].nil? @label_list_visibility = args[:label_list_visibility] unless args[:label_list_visibility].nil? @message_list_visibility = args[:message_list_visibility] unless args[:message_list_visibility].nil? @messages_total = args[:messages_total] unless args[:messages_total].nil? @messages_unread = args[:messages_unread] unless args[:messages_unread].nil? @name = args[:name] unless args[:name].nil? @threads_total = args[:threads_total] unless args[:threads_total].nil? @threads_unread = args[:threads_unread] unless args[:threads_unread].nil? @type = args[:type] unless args[:type].nil? end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_properties(hash)\n hash.each do |key, value|\n setter_method = \"#{key}=\"\n if self.respond_to?(setter_method)\n self.send(setter_method, value)\n end\n end\n end", "def update!(**args)\n @properties = args[:properties] if args.key?(:properties)\n ...
[ "0.7012263", "0.69181895", "0.69181895", "0.69181895", "0.69181895", "0.69181895", "0.67403597", "0.6709326", "0.6709326", "0.6696149", "0.6696149", "0.6696149", "0.6696149", "0.6618882", "0.6571848", "0.65386343", "0.65178275", "0.6394807", "0.6389745", "0.6389745", "0.63328...
0.0
-1
Update properties of this object
def update!(**args) @drafts = args[:drafts] unless args[:drafts].nil? @next_page_token = args[:next_page_token] unless args[:next_page_token].nil? @result_size_estimate = args[:result_size_estimate] unless args[:result_size_estimate].nil? end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_properties(hash)\n hash.each do |key, value|\n setter_method = \"#{key}=\"\n if self.respond_to?(setter_method)\n self.send(setter_method, value)\n end\n end\n end", "def update!(**args)\n @properties = args[:properties] if args.key?(:properties)\n ...
[ "0.7012263", "0.69181895", "0.69181895", "0.69181895", "0.69181895", "0.69181895", "0.67403597", "0.6709326", "0.6709326", "0.6696149", "0.6696149", "0.6696149", "0.6696149", "0.6618882", "0.6571848", "0.65386343", "0.65178275", "0.6394807", "0.6389745", "0.6389745", "0.63328...
0.0
-1
Update properties of this object
def update!(**args) @history = args[:history] unless args[:history].nil? @history_id = args[:history_id] unless args[:history_id].nil? @next_page_token = args[:next_page_token] unless args[:next_page_token].nil? end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_properties(hash)\n hash.each do |key, value|\n setter_method = \"#{key}=\"\n if self.respond_to?(setter_method)\n self.send(setter_method, value)\n end\n end\n end", "def update!(**args)\n @properties = args[:properties] if args.key?(:properties)\n ...
[ "0.7012263", "0.69181895", "0.69181895", "0.69181895", "0.69181895", "0.69181895", "0.67403597", "0.6709326", "0.6709326", "0.6696149", "0.6696149", "0.6696149", "0.6696149", "0.6618882", "0.6571848", "0.65386343", "0.65178275", "0.6394807", "0.6389745", "0.6389745", "0.63328...
0.0
-1
Update properties of this object
def update!(**args) @labels = args[:labels] unless args[:labels].nil? end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_properties(hash)\n hash.each do |key, value|\n setter_method = \"#{key}=\"\n if self.respond_to?(setter_method)\n self.send(setter_method, value)\n end\n end\n end", "def update!(**args)\n @properties = args[:properties] if args.key?(:properties)\n ...
[ "0.7012263", "0.69181895", "0.69181895", "0.69181895", "0.69181895", "0.69181895", "0.67403597", "0.6709326", "0.6709326", "0.6696149", "0.6696149", "0.6696149", "0.6696149", "0.6618882", "0.6571848", "0.65386343", "0.65178275", "0.6394807", "0.6389745", "0.6389745", "0.63328...
0.0
-1
Update properties of this object
def update!(**args) @messages = args[:messages] unless args[:messages].nil? @next_page_token = args[:next_page_token] unless args[:next_page_token].nil? @result_size_estimate = args[:result_size_estimate] unless args[:result_size_estimate].nil? end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_properties(hash)\n hash.each do |key, value|\n setter_method = \"#{key}=\"\n if self.respond_to?(setter_method)\n self.send(setter_method, value)\n end\n end\n end", "def update!(**args)\n @properties = args[:properties] if args.key?(:properties)\n ...
[ "0.7012263", "0.69181895", "0.69181895", "0.69181895", "0.69181895", "0.69181895", "0.67403597", "0.6709326", "0.6709326", "0.6696149", "0.6696149", "0.6696149", "0.6696149", "0.6618882", "0.6571848", "0.65386343", "0.65178275", "0.6394807", "0.6389745", "0.6389745", "0.63328...
0.0
-1
Update properties of this object
def update!(**args) @next_page_token = args[:next_page_token] unless args[:next_page_token].nil? @result_size_estimate = args[:result_size_estimate] unless args[:result_size_estimate].nil? @threads = args[:threads] unless args[:threads].nil? end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_properties(hash)\n hash.each do |key, value|\n setter_method = \"#{key}=\"\n if self.respond_to?(setter_method)\n self.send(setter_method, value)\n end\n end\n end", "def update!(**args)\n @properties = args[:properties] if args.key?(:properties)\n ...
[ "0.7012263", "0.69181895", "0.69181895", "0.69181895", "0.69181895", "0.69181895", "0.67403597", "0.6709326", "0.6709326", "0.6696149", "0.6696149", "0.6696149", "0.6696149", "0.6618882", "0.6571848", "0.65386343", "0.65178275", "0.6394807", "0.6389745", "0.6389745", "0.63328...
0.0
-1
Update properties of this object
def update!(**args) @history_id = args[:history_id] unless args[:history_id].nil? @id = args[:id] unless args[:id].nil? @internal_date = args[:internal_date] unless args[:internal_date].nil? @label_ids = args[:label_ids] unless args[:label_ids].nil? @payload = args[:payload] unless args[:payload].nil? @raw = args[:raw] unless args[:raw].nil? @size_estimate = args[:size_estimate] unless args[:size_estimate].nil? @snippet = args[:snippet] unless args[:snippet].nil? @thread_id = args[:thread_id] unless args[:thread_id].nil? end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_properties(hash)\n hash.each do |key, value|\n setter_method = \"#{key}=\"\n if self.respond_to?(setter_method)\n self.send(setter_method, value)\n end\n end\n end", "def update!(**args)\n @properties = args[:properties] if args.key?(:properties)\n ...
[ "0.7012263", "0.69181895", "0.69181895", "0.69181895", "0.69181895", "0.69181895", "0.67403597", "0.6709326", "0.6709326", "0.6696149", "0.6696149", "0.6696149", "0.6696149", "0.6618882", "0.6571848", "0.65386343", "0.65178275", "0.6394807", "0.6389745", "0.6389745", "0.63328...
0.0
-1
Update properties of this object
def update!(**args) @body = args[:body] unless args[:body].nil? @filename = args[:filename] unless args[:filename].nil? @headers = args[:headers] unless args[:headers].nil? @mime_type = args[:mime_type] unless args[:mime_type].nil? @part_id = args[:part_id] unless args[:part_id].nil? @parts = args[:parts] unless args[:parts].nil? end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_properties(hash)\n hash.each do |key, value|\n setter_method = \"#{key}=\"\n if self.respond_to?(setter_method)\n self.send(setter_method, value)\n end\n end\n end", "def update!(**args)\n @properties = args[:properties] if args.key?(:properties)\n ...
[ "0.7012263", "0.69181895", "0.69181895", "0.69181895", "0.69181895", "0.69181895", "0.67403597", "0.6709326", "0.6709326", "0.6696149", "0.6696149", "0.6696149", "0.6696149", "0.6618882", "0.6571848", "0.65386343", "0.65178275", "0.6394807", "0.6389745", "0.6389745", "0.63328...
0.0
-1
Update properties of this object
def update!(**args) @attachment_id = args[:attachment_id] unless args[:attachment_id].nil? @data = args[:data] unless args[:data].nil? @size = args[:size] unless args[:size].nil? end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_properties(hash)\n hash.each do |key, value|\n setter_method = \"#{key}=\"\n if self.respond_to?(setter_method)\n self.send(setter_method, value)\n end\n end\n end", "def update!(**args)\n @properties = args[:properties] if args.key?(:properties)\n ...
[ "0.7012263", "0.69181895", "0.69181895", "0.69181895", "0.69181895", "0.69181895", "0.67403597", "0.6709326", "0.6709326", "0.6696149", "0.6696149", "0.6696149", "0.6696149", "0.6618882", "0.6571848", "0.65386343", "0.65178275", "0.6394807", "0.6389745", "0.6389745", "0.63328...
0.0
-1
Update properties of this object
def update!(**args) @name = args[:name] unless args[:name].nil? @value = args[:value] unless args[:value].nil? end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_properties(hash)\n hash.each do |key, value|\n setter_method = \"#{key}=\"\n if self.respond_to?(setter_method)\n self.send(setter_method, value)\n end\n end\n end", "def update!(**args)\n @properties = args[:properties] if args.key?(:properties)\n ...
[ "0.7012263", "0.69181895", "0.69181895", "0.69181895", "0.69181895", "0.69181895", "0.67403597", "0.6709326", "0.6709326", "0.6696149", "0.6696149", "0.6696149", "0.6696149", "0.6618882", "0.6571848", "0.65386343", "0.65178275", "0.6394807", "0.6389745", "0.6389745", "0.63328...
0.0
-1
Update properties of this object
def update!(**args) @add_label_ids = args[:add_label_ids] unless args[:add_label_ids].nil? @remove_label_ids = args[:remove_label_ids] unless args[:remove_label_ids].nil? end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_properties(hash)\n hash.each do |key, value|\n setter_method = \"#{key}=\"\n if self.respond_to?(setter_method)\n self.send(setter_method, value)\n end\n end\n end", "def update!(**args)\n @properties = args[:properties] if args.key?(:properties)\n ...
[ "0.7012263", "0.69181895", "0.69181895", "0.69181895", "0.69181895", "0.69181895", "0.67403597", "0.6709326", "0.6709326", "0.6696149", "0.6696149", "0.6696149", "0.6696149", "0.6618882", "0.6571848", "0.65386343", "0.65178275", "0.6394807", "0.6389745", "0.6389745", "0.63328...
0.0
-1
Update properties of this object
def update!(**args) @add_label_ids = args[:add_label_ids] unless args[:add_label_ids].nil? @remove_label_ids = args[:remove_label_ids] unless args[:remove_label_ids].nil? end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_properties(hash)\n hash.each do |key, value|\n setter_method = \"#{key}=\"\n if self.respond_to?(setter_method)\n self.send(setter_method, value)\n end\n end\n end", "def update!(**args)\n @properties = args[:properties] if args.key?(:properties)\n ...
[ "0.7012263", "0.69181895", "0.69181895", "0.69181895", "0.69181895", "0.69181895", "0.67403597", "0.6709326", "0.6709326", "0.6696149", "0.6696149", "0.6696149", "0.6696149", "0.6618882", "0.6571848", "0.65386343", "0.65178275", "0.6394807", "0.6389745", "0.6389745", "0.63328...
0.0
-1
Update properties of this object
def update!(**args) @email_address = args[:email_address] unless args[:email_address].nil? @history_id = args[:history_id] unless args[:history_id].nil? @messages_total = args[:messages_total] unless args[:messages_total].nil? @threads_total = args[:threads_total] unless args[:threads_total].nil? end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_properties(hash)\n hash.each do |key, value|\n setter_method = \"#{key}=\"\n if self.respond_to?(setter_method)\n self.send(setter_method, value)\n end\n end\n end", "def update!(**args)\n @properties = args[:properties] if args.key?(:properties)\n ...
[ "0.7012263", "0.69181895", "0.69181895", "0.69181895", "0.69181895", "0.69181895", "0.67403597", "0.6709326", "0.6709326", "0.6696149", "0.6696149", "0.6696149", "0.6696149", "0.6618882", "0.6571848", "0.65386343", "0.65178275", "0.6394807", "0.6389745", "0.6389745", "0.63328...
0.0
-1
Update properties of this object
def update!(**args) @history_id = args[:history_id] unless args[:history_id].nil? @id = args[:id] unless args[:id].nil? @messages = args[:messages] unless args[:messages].nil? @snippet = args[:snippet] unless args[:snippet].nil? end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_properties(hash)\n hash.each do |key, value|\n setter_method = \"#{key}=\"\n if self.respond_to?(setter_method)\n self.send(setter_method, value)\n end\n end\n end", "def update!(**args)\n @properties = args[:properties] if args.key?(:properties)\n ...
[ "0.7012263", "0.69181895", "0.69181895", "0.69181895", "0.69181895", "0.69181895", "0.67403597", "0.6709326", "0.6709326", "0.6696149", "0.6696149", "0.6696149", "0.6696149", "0.6618882", "0.6571848", "0.65386343", "0.65178275", "0.6394807", "0.6389745", "0.6389745", "0.63328...
0.0
-1
Update properties of this object
def update!(**args) @label_filter_action = args[:label_filter_action] unless args[:label_filter_action].nil? @label_ids = args[:label_ids] unless args[:label_ids].nil? @topic_name = args[:topic_name] unless args[:topic_name].nil? end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_properties(hash)\n hash.each do |key, value|\n setter_method = \"#{key}=\"\n if self.respond_to?(setter_method)\n self.send(setter_method, value)\n end\n end\n end", "def update!(**args)\n @properties = args[:properties] if args.key?(:properties)\n ...
[ "0.7012263", "0.69181895", "0.69181895", "0.69181895", "0.69181895", "0.69181895", "0.67403597", "0.6709326", "0.6709326", "0.6696149", "0.6696149", "0.6696149", "0.6696149", "0.6618882", "0.6571848", "0.65386343", "0.65178275", "0.6394807", "0.6389745", "0.6389745", "0.63328...
0.0
-1
Update properties of this object
def update!(**args) @expiration = args[:expiration] unless args[:expiration].nil? @history_id = args[:history_id] unless args[:history_id].nil? end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_properties(hash)\n hash.each do |key, value|\n setter_method = \"#{key}=\"\n if self.respond_to?(setter_method)\n self.send(setter_method, value)\n end\n end\n end", "def update!(**args)\n @properties = args[:properties] if args.key?(:properties)\n ...
[ "0.7012263", "0.69181895", "0.69181895", "0.69181895", "0.69181895", "0.69181895", "0.67403597", "0.6709326", "0.6709326", "0.6696149", "0.6696149", "0.6696149", "0.6696149", "0.6618882", "0.6571848", "0.65386343", "0.65178275", "0.6394807", "0.6389745", "0.6389745", "0.63328...
0.0
-1
Return symbol name for supported digest algorithms and string name for custom ones.
def digest_algorithm @digester.symbol || @digester.digest_name end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def signature_digest_algorithm\n @sign_digester.symbol || @sign_digester.digest_name\n end", "def digest_name(name)\n Digest::SHA2.hexdigest(short_name(name))[0..24]\n end", "def to_sym\n name\n end", "def digest_short_name(name)\n Digest::SHA2.hexdigest(name)[0..24]\n end", ...
[ "0.7170623", "0.632829", "0.60010874", "0.59882784", "0.58345854", "0.58336776", "0.5763421", "0.5750439", "0.5745365", "0.5692395", "0.56923664", "0.56011367", "0.55982345", "0.55792636", "0.55559343", "0.55513453", "0.55513453", "0.55513453", "0.5540581", "0.5519668", "0.55...
0.7308521
0
Allows to change algorithm for node digesting (default is SHA1). You may pass either a one of +:sha1+, +:sha256+ or +:gostr3411+ symbols or +Hash+ with keys +:id+ with a string, which will denote algorithm in XML Reference tag and +:digester+ with instance of class with interface compatible with +OpenSSL::Digest+ class.
def digest_algorithm=(algorithm) @digester = Kiji::Digester.new(algorithm) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def digest_algorithm\n @digester.symbol || @digester.digest_name\n end", "def digest(string, algorithm)\n Base64.encode64 digester(algorithm).digest(string)\n end", "def generate_digest(element, algorithm)\n element = document.at_xpath(element, namespaces) if element.is_a? String\n ...
[ "0.7002007", "0.66663814", "0.6597156", "0.65157485", "0.6472355", "0.6472355", "0.627788", "0.62028486", "0.6133024", "0.6080581", "0.60600656", "0.60600656", "0.6028101", "0.6023464", "0.6017885", "0.59559715", "0.59235394", "0.5881173", "0.5875797", "0.58557427", "0.584705...
0.69125223
1
Return symbol name for supported digest algorithms and string name for custom ones.
def signature_digest_algorithm @sign_digester.symbol || @sign_digester.digest_name end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def digest_algorithm\n @digester.symbol || @digester.digest_name\n end", "def digest_name(name)\n Digest::SHA2.hexdigest(short_name(name))[0..24]\n end", "def to_sym\n name\n end", "def digest_short_name(name)\n Digest::SHA2.hexdigest(name)[0..24]\n end", "def openssl_name\n...
[ "0.7308521", "0.632829", "0.60010874", "0.59882784", "0.58345854", "0.58336776", "0.5763421", "0.5750439", "0.5745365", "0.5692395", "0.56923664", "0.56011367", "0.55982345", "0.55792636", "0.55559343", "0.55513453", "0.55513453", "0.55513453", "0.5540581", "0.5519668", "0.55...
0.7170623
1
Allows to change digesting algorithm for signature creation. Same as +digest_algorithm=+
def signature_digest_algorithm=(algorithm) @sign_digester = Kiji::Digester.new(algorithm) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def signature_digest_algorithm\n @sign_digester.symbol || @sign_digester.digest_name\n end", "def digest_algorithm=(algorithm)\n @digester = Kiji::Digester.new(algorithm)\n end", "def set_default_signature_method!\n # self.signature_digest_algorithm = :sha1\n # self.signature_algorith...
[ "0.7462788", "0.7210203", "0.7161311", "0.7045905", "0.66351146", "0.6572472", "0.65375257", "0.65375257", "0.6377582", "0.6335187", "0.61894286", "0.6094229", "0.6005794", "0.5986462", "0.5964601", "0.59476775", "0.5918975", "0.59141046", "0.5890726", "0.5880813", "0.5880813...
0.78329134
0
Receives certificate for signing and tries to guess a digest algorithm for signature creation. Will change +signature_digest_algorithm+ and +signature_algorithm_id+ for known certificate types and reset to defaults for others.
def cert=(certificate) @cert = certificate # Try to guess a digest algorithm for signature creation case @cert.signature_algorithm when 'GOST R 34.11-94 with GOST R 34.10-2001' self.signature_digest_algorithm = :gostr3411 self.signature_algorithm_id = 'http://www.w3.org/2001/04/xmldsig-more#gostr34102001-gostr3411' # Add clauses for other types of keys that require other digest algorithms and identifiers else # most common 'sha1WithRSAEncryption' type included here set_default_signature_method! # Reset any changes as they can become malformed end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def signature_digest_algorithm=(algorithm)\n @sign_digester = Kiji::Digester.new(algorithm)\n end", "def set_default_signature_method!\n # self.signature_digest_algorithm = :sha1\n # self.signature_algorithm_id = 'http://www.w3.org/2000/09/xmldsig#rsa-sha1'\n self.signature_digest_algorith...
[ "0.6409925", "0.63705426", "0.63635504", "0.6288841", "0.62522954", "0.60069263", "0.59798944", "0.59655166", "0.590693", "0.5739672", "0.57230186", "0.5706069", "0.56976324", "0.55488294", "0.5545869", "0.55281913", "0.54226375", "0.5416415", "0.53022736", "0.5196886", "0.51...
0.6383257
1
Digests some +target_node+, which integrity you wish to track. Any changes in digested node will invalidate signed message. All digest should be calculated before signing. Available options: [+:id+] Id for the node, if you don't want to use automatically calculated one [+:inclusive_namespaces+] Array of namespace prefixes which definitions should be added to node during canonicalization [+:enveloped+] Example of XML that will be inserted in message for call like digest!(node, inclusive_namespaces: ['soap']): aeqXriJuUCk4tPNPAGDXGqHj6ao=
def digest!(target_node, options = {}) wsu_ns = namespace_prefix(target_node, WSU_NAMESPACE) current_id = target_node["#{wsu_ns}:Id"] if wsu_ns id = options[:id] || current_id || "_#{Digest::SHA1.hexdigest(target_node.to_s)}" # if id.to_s.size > 0 # wsu_ns ||= namespace_prefix(target_node, WSU_NAMESPACE, 'wsu') # target_node["#{wsu_ns}:Id"] = id.to_s # end target_canon = canonicalize(target_node, options[:inclusive_namespaces]) # target_digest = Base64.encode64(@digester.digest(target_canon)).strip target_digest = @digester.base64(target_canon) reference_node = Nokogiri::XML::Node.new('Reference', document) reference_node['URI'] = !id.to_s.empty? ? encode_ja(id) : '' signed_info_node.add_child(reference_node) transforms_node = Nokogiri::XML::Node.new('Transforms', document) reference_node.add_child(transforms_node) transform_node = Nokogiri::XML::Node.new('Transform', document) transform_node['Algorithm'] = if options[:enveloped] 'http://www.w3.org/2000/09/xmldsig#enveloped-signature' else # transform_node['Algorithm'] = 'http://www.w3.org/2001/10/xml-exc-c14n#' 'http://www.w3.org/TR/2001/REC-xml-c14n-20010315' end if options[:inclusive_namespaces] inclusive_namespaces_node = Nokogiri::XML::Node.new('ec:InclusiveNamespaces', document) inclusive_namespaces_node.add_namespace_definition('ec', transform_node['Algorithm']) inclusive_namespaces_node['PrefixList'] = options[:inclusive_namespaces].join(' ') transform_node.add_child(inclusive_namespaces_node) end transforms_node.add_child(transform_node) digest_method_node = Nokogiri::XML::Node.new('DigestMethod', document) digest_method_node['Algorithm'] = @digester.digest_id reference_node.add_child(digest_method_node) digest_value_node = Nokogiri::XML::Node.new('DigestValue', document) digest_value_node.content = target_digest reference_node.add_child(digest_value_node) self end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def digest(*args)\n options = args.extract_options!\n ::Klarna::API.digest(*[(self.store_id unless options[:store_id] == false), args, self.store_secret].compact.flatten)\n end", "def generate_digest(element, algorithm)\n element = document.at_xpath(element, namespaces) if element...
[ "0.5318144", "0.53022665", "0.5112031", "0.4929795", "0.49201173", "0.49194315", "0.49063328", "0.47994432", "0.47525492", "0.4747147", "0.4734291", "0.4723136", "0.4705035", "0.4689216", "0.4641407", "0.4625129", "0.461728", "0.46135968", "0.46096346", "0.45957282", "0.45944...
0.8205236
0
Sign document with provided certificate, private key and other options This should be very last action before calling +to_xml+, all the required nodes should be digested with +digest!+ before signing. Available options: [+:security_token+] Serializes certificate in DER format, encodes it with Base64 and inserts it within ++ tag [+:issuer_serial+] [+:inclusive_namespaces+] Array of namespace prefixes which definitions should be added to signed info node during canonicalization
def sign!(options = {}) binary_security_token_node if options[:security_token] x509_data_node if options[:issuer_serial] if options[:inclusive_namespaces] c14n_method_node = signed_info_node.at_xpath('ds:CanonicalizationMethod', ds: 'http://www.w3.org/2000/09/xmldsig#') inclusive_namespaces_node = Nokogiri::XML::Node.new('ec:InclusiveNamespaces', document) inclusive_namespaces_node.add_namespace_definition('ec', c14n_method_node['Algorithm']) inclusive_namespaces_node['PrefixList'] = options[:inclusive_namespaces].join(' ') c14n_method_node.add_child(inclusive_namespaces_node) end signed_info_canon = canonicalize(signed_info_node, options[:inclusive_namespaces]) signature = private_key.sign(@sign_digester.digester, signed_info_canon) signature_value_digest = Base64.encode64(signature).delete("\n") signature_value_node = Nokogiri::XML::Node.new('SignatureValue', document) signature_value_node.content = signature_value_digest signed_info_node.add_next_sibling(signature_value_node) self end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def canonicalized_signed_info\n\n parametros = ActiveSupport::OrderedHash.new\n parametros[\"xmlns\"] = \"http://www.w3.org/2000/09/xmldsig#\"\n parametros[\"xmlns:xsd\"] = \"http://www.w3.org/2001/XMLSchema\"\n parametros[\"xmlns:xsi\"] = \"http://www.w3.org/2001/XMLSchema-instance\"\n \n...
[ "0.59415257", "0.5758002", "0.57578945", "0.56604856", "0.56379086", "0.55662215", "0.5553731", "0.5552196", "0.5411213", "0.5408934", "0.53781074", "0.53595304", "0.529558", "0.52936125", "0.5251523", "0.5246577", "0.52071613", "0.5183398", "0.51571876", "0.5154924", "0.5016...
0.8422334
0
Reset digest algorithm for signature creation and signature algorithm identifier
def set_default_signature_method! # self.signature_digest_algorithm = :sha1 # self.signature_algorithm_id = 'http://www.w3.org/2000/09/xmldsig#rsa-sha1' self.signature_digest_algorithm = :sha256 self.signature_algorithm_id = 'http://www.w3.org/2001/04/xmldsig-more#rsa-sha256' end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reset\n check_valid\n OpenSSL::LibCrypto.EVP_DigestInit_ex(self, self.md, nil)\n self\n end", "def signature_digest_algorithm=(algorithm)\n @sign_digester = Kiji::Digester.new(algorithm)\n end", "def signature_digest_algorithm\n @sign_digester.symbol || @sign_digester...
[ "0.73125803", "0.69204104", "0.68029976", "0.6341454", "0.61070776", "0.6096316", "0.60683715", "0.60480535", "0.5979214", "0.5938267", "0.5932809", "0.5888691", "0.5888691", "0.588021", "0.5864254", "0.5864254", "0.5854045", "0.5811001", "0.58022064", "0.5788237", "0.5784802...
0.68817925
2
Searches in namespaces, defined on +target_node+ or its ancestors, for the +namespace+ with given URI and returns its prefix. If there is no such namespace and +desired_prefix+ is specified, adds such a namespace to +target_node+ with +desired_prefix+
def namespace_prefix(target_node, namespace, desired_prefix = nil) ns = target_node.namespaces.key(namespace) if ns ns.match(/(?:xmlns:)?(.*)/) && Regexp.last_match(1) elsif desired_prefix target_node.add_namespace_definition(desired_prefix, namespace) desired_prefix end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_namespace(node, prefix); end", "def prefix_for(ns_uri)\n if namespaces_by_uri().has_key?(ns_uri)\n namespaces_by_uri()[ns_uri].prefix || \"\" # namespace.prefix returns nil if there is no prefix defined (default prefix)\n end\n end", "def prefix_for(ns_href)\n nam...
[ "0.675067", "0.6494743", "0.6395798", "0.61228865", "0.6001941", "0.59689844", "0.58908814", "0.5786866", "0.5773298", "0.5680329", "0.56723136", "0.56331795", "0.55357695", "0.5507548", "0.54717785", "0.54670006", "0.5460989", "0.54460114", "0.53890336", "0.5384815", "0.5328...
0.8329108
0
Write a method that returns true if its integer argument is palindromic, false otherwise. A palindromic number reads the same forwards and backwards. Examples:
def palindromic_number?(n) n.to_s == n.to_s.reverse end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def palindromic?(number)\n if number.to_s == number.to_s.reverse\n return true\n end\nend", "def palindromic_number?(int)\r\n int.to_s == int.to_s.reverse\r\nend", "def palindromic_number?(int)\n int.to_s == int.to_s.reverse\nend", "def palindromic_number?(integer)\n integer.to_s == integer.to_s.reve...
[ "0.8824028", "0.8821626", "0.8816631", "0.8810726", "0.8789885", "0.87653863", "0.872211", "0.872211", "0.8690405", "0.8687968", "0.8687968", "0.86749405", "0.86710507", "0.86615694", "0.8655318", "0.8598389", "0.85953796", "0.85943776", "0.8587044", "0.85838616", "0.8569998"...
0.8804961
4
Using a private method to encapsulate the permissible parameters is just a good pattern since you'll be able to reuse the same permit list between create and update. Also, you can specialize this method with peruser checking of permissible attributes.
def taxon_params params.permit(:visible) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def permitted_params\n policy(resource || resource_class.new).send(\"permitted_#{action_name}_attributes\")\n end", "def safe_params\n resurce_name = self.class.resource_name\n params_method_name = \"#{resurce_name}_params\".to_sym\n if params[resurce_name]\n if respond_to?(params_method_name) ...
[ "0.70202553", "0.70113915", "0.68419456", "0.68100685", "0.6692469", "0.6688504", "0.6683111", "0.66686696", "0.66341746", "0.6619179", "0.66165733", "0.6604276", "0.6590041", "0.65745556", "0.65722924", "0.6531341", "0.6526208", "0.65222895", "0.65171784", "0.65098655", "0.6...
0.0
-1