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 |
|---|---|---|---|---|---|---|
POST /adversaires POST /adversaires.json | def create
@adversaire = Adversaire.new(params[:adversaire])
@equipe = Equipe.find(params[:equipe_id])
respond_to do |format|
if @adversaire.save
format.html { redirect_to @equipe, :notice => 'Adversaire was successfully created.' }
format.json { render :json => @adversaire, :status =... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @adversaires = Adversaire.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @adversaires }\n end\n end",
"def new\n @equipe = Equipe.find(params[:equipe_id])\n \n @adversaire = Adversaire.new\n @adversaire.equipe = @equipe\n\... | [
"0.6595888",
"0.6097787",
"0.5984594",
"0.59205884",
"0.59102035",
"0.5710794",
"0.57097685",
"0.57028395",
"0.56891876",
"0.56860554",
"0.5677027",
"0.56554306",
"0.55997515",
"0.5596368",
"0.5591963",
"0.55614734",
"0.55543166",
"0.55108947",
"0.55046207",
"0.549766",
"0.54... | 0.69416124 | 0 |
PUT /adversaires/1 PUT /adversaires/1.json | def update
@adversaire = Adversaire.find(params[:id])
@equipe = Equipe.find(params[:equipe_id])
respond_to do |format|
if @adversaire.update_attributes(params[:adversaire])
format.html { redirect_to @equipe, :notice => 'Adversaire was successfully updated.' }
format.json { head :no_con... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @serv_adicionale = ServAdicionale.find(params[:id])\n\n respond_to do |format|\n if @serv_adicionale.update_attributes(params[:serv_adicionale])\n format.html { redirect_to @serv_adicionale, notice: 'Serv adicionale was successfully updated.' }\n format.json { head :no_content... | [
"0.6274904",
"0.61585337",
"0.6100573",
"0.6089805",
"0.60569453",
"0.60055006",
"0.5990302",
"0.59811807",
"0.59247917",
"0.59129006",
"0.59076166",
"0.5906806",
"0.5903343",
"0.58729",
"0.58480173",
"0.5806164",
"0.57998765",
"0.57883483",
"0.57594556",
"0.57495445",
"0.572... | 0.6757945 | 0 |
DELETE /adversaires/1 DELETE /adversaires/1.json | def destroy
@equipe = Equipe.find(params[:equipe_id])
@adversaire = Adversaire.find(params[:id])
@adversaire.destroy
respond_to do |format|
format.html { redirect_to @equipe }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @serv_adicionale = ServAdicionale.find(params[:id])\n @serv_adicionale.destroy\n\n respond_to do |format|\n format.html { redirect_to serv_adicionales_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @respuesta = Respuesta.find(params[:id])\n @respu... | [
"0.7122333",
"0.6964952",
"0.69625217",
"0.69597495",
"0.695259",
"0.6923468",
"0.6904102",
"0.6899791",
"0.68929213",
"0.6891559",
"0.68866503",
"0.68860847",
"0.68840605",
"0.68811786",
"0.6878483",
"0.6855115",
"0.68507683",
"0.6849284",
"0.6842502",
"0.68303394",
"0.68281... | 0.7383552 | 0 |
Reconfigures the provided option, setting its value to `value`. | def call(value)
raise NotImplementedError
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def call(value)\n Datadog.logger.debug { \"Reconfigured tracer option `#{@setting_key}` with value `#{value}`\" }\n\n if value.nil?\n # Restore the local configuration value\n configuration_object.unset_option(\n @setting_key,\n preceden... | [
"0.7694386",
"0.6517668",
"0.63965523",
"0.62105966",
"0.6131494",
"0.6083835",
"0.6018801",
"0.6017789",
"0.5912808",
"0.58869994",
"0.58243126",
"0.57893103",
"0.5787713",
"0.5778378",
"0.57754105",
"0.57529026",
"0.57093865",
"0.57069963",
"0.5667481",
"0.5635249",
"0.5629... | 0.0 | -1 |
Reconfigures the provided option, setting its value to `value`. | def call(value)
Datadog.logger.debug { "Reconfigured tracer option `#{@setting_key}` with value `#{value}`" }
if value.nil?
# Restore the local configuration value
configuration_object.unset_option(
@setting_key,
precedence: Core::Conf... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def configure_setting(name, value)\n configure do |settings|\n settings.unset!(name)\n settings[name] = parse_setting(settings.setting(name), value)\n end\n end",
"def update_option(opt, val)\n @options[opt] = val\n end",
"def option(key, value)\n key = Bcpm::Match.engine_op... | [
"0.65158695",
"0.63972855",
"0.62106466",
"0.61317176",
"0.60825855",
"0.6017806",
"0.601639",
"0.59119356",
"0.58890015",
"0.58227146",
"0.57885504",
"0.5786829",
"0.5778286",
"0.57754695",
"0.5751139",
"0.5707841",
"0.5706225",
"0.56685907",
"0.5634623",
"0.5628221",
"0.562... | 0.76933825 | 0 |
The base where `setting_key` will apply | def configuration_object
Datadog.configuration.tracing
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def settings(key)\n self_settings = self.super_settings(key)\n return self_settings if self_settings.value?\n# self.dmptemplate.settings(key)\n self.template.settings(key) unless self.template.nil?\n end",
"def build_top_level_setting\n Grape::Util::InheritableSetting.new.tap do |setting|\n ... | [
"0.7133781",
"0.648585",
"0.6442454",
"0.6413651",
"0.64020663",
"0.63138145",
"0.62761515",
"0.6249901",
"0.61908674",
"0.61645323",
"0.61010903",
"0.6077919",
"0.5959357",
"0.5933034",
"0.5932983",
"0.5906075",
"0.59060407",
"0.5885649",
"0.58824235",
"0.58414584",
"0.57913... | 0.0 | -1 |
call this method if you want to log someone in | def set_current_user(user)
sha1 = Digest::SHA1.hexdigest(user.id.to_s + Time.now.to_i.to_s)
cookies[:remember_token] = { :value => sha1, :expires => 3.years.from_now }
user.remember_token = sha1
user.save
@current_user = user
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def log_in\n end",
"def logging_in\n \t\t\n \tend",
"def logged_in\r\n end",
"def logging_in\n end",
"def login\n end",
"def login\n make_login_call\n end",
"def login\n end",
"def login\n end",
"def login\n end",
"def login\n end",
"def login\n end",
"def login\n end",
... | [
"0.8026422",
"0.7781602",
"0.7730076",
"0.7654372",
"0.7555326",
"0.7553889",
"0.747378",
"0.747378",
"0.747378",
"0.747378",
"0.747378",
"0.747378",
"0.747378",
"0.747378",
"0.747378",
"0.74429035",
"0.7375008",
"0.7375008",
"0.7322554",
"0.73092467",
"0.73064697",
"0.7276... | 0.0 | -1 |
call this if you want to log someone out | def unset_current_user
unless current_user.nil?
current_user.remember_token = nil
current_user.save
end
cookies[:remember_token] = nil
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def log_out\n\t\tforget(current_user) #call user.forget\n\t\tsession.delete(:user_id)\n\t\t@current_user = nil\n\tend",
"def log_out\n\t\t# current_user.delete_auth_token # won't work with curl, but html is good\n\t\tsession.delete(:user_id)\n\t\t@current_user = nil\n\tend",
"def log_out\n forget(curren... | [
"0.82659775",
"0.8235964",
"0.8176305",
"0.81750834",
"0.8143294",
"0.8123878",
"0.8123878",
"0.8123878",
"0.8123878",
"0.8123437",
"0.8113428",
"0.8113428",
"0.8113428",
"0.8113428",
"0.8113428",
"0.811233",
"0.81044745",
"0.80966556",
"0.80966556",
"0.80966556",
"0.80868566... | 0.0 | -1 |
getter that will increment the next_bib value in the database and return the result | def next_bib
self[:next_bib] = self[:next_bib] + 1
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def next_bib\n self[:next_bib] = self.inc(next_bib: 1)[:next_bib]\n\tend",
"def next_id\n self.latest_id += 1\n end",
"def next\n\t\tself + 1\n\tend",
"def next_id\n (@curr_id +=1).to_s\n end",
"def increment\n curr_value = counter\n self.counter = curr_value + 1\n save\n cur... | [
"0.848909",
"0.66430503",
"0.64042443",
"0.63620085",
"0.6321063",
"0.6306583",
"0.6282942",
"0.6275506",
"0.62644005",
"0.624657",
"0.6228603",
"0.61961347",
"0.61890036",
"0.6177413",
"0.61709696",
"0.6167986",
"0.6123598",
"0.61110866",
"0.61020774",
"0.6096994",
"0.609190... | 0.8294113 | 1 |
returns a Placing instance with its name set to the name of the age group the racer will be competing in | def get_group racer
if racer && racer.birth_year && racer.gender
quotient=(date.year-racer.birth_year)/10
min_age=quotient*10
max_age=((quotient+1)*10)-1
gender=racer.gender
name=min_age >= 60 ? "masters #{gender}" : "#{min_age} to #{max_age} (#{gender})"
Placing.demongoize(:name... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_group racer\n\t\tif racer && racer.birth_year && racer.gender\n\t\t\tquotient=(date.year-racer.birth_year)/10\n\t\t\tmin_age=quotient*10\n\t\t\tmax_age=((quotient+1)*10)-1\n\t\t\tgender=racer.gender\n\t\t\tname=min_age >= 60 ? \"masters #{gender}\" : \"#{min_age} to #{max_age} (#{gender})\"\n\t\t\tPlacing.... | [
"0.70971876",
"0.5949645",
"0.59472334",
"0.57195187",
"0.56466264",
"0.5625743",
"0.5339288",
"0.5335686",
"0.5334706",
"0.53182876",
"0.52509105",
"0.5249419",
"0.52217895",
"0.52217895",
"0.52217895",
"0.52217895",
"0.52217895",
"0.5219858",
"0.52095926",
"0.5207008",
"0.5... | 0.7204882 | 0 |
create a new Entrant for the Race for a supplied Racer | def create_entrant racer
# build a new Entrant
entrant = Entrant.new { |r|
# clone the relevant Race information within Entrant.race
r.build_race(self.attributes.symbolize_keys.slice(:_id, :n, :date))
# clone the RaceInfo attributes within Entrant.racer
r.build_racer(racer.info.attribut... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_entrant racer\n\t\tentrant = Entrant.new\n\t\tentrant.race = self.attributes.symbolize_keys.slice(:_id, :n, :date)\n\t\tentrant.racer = racer.info.attributes\n\t\tentrant.group = self.get_group(racer)\n\t\tevents.each do |event|\n \t \tif event\n \t\tentrant.send(\"#{event.name}=\", event)\n ... | [
"0.7477985",
"0.66777647",
"0.62276137",
"0.5967927",
"0.5967927",
"0.58257663",
"0.581496",
"0.5790698",
"0.5737334",
"0.57169336",
"0.5685861",
"0.56776965",
"0.56316113",
"0.56316113",
"0.56316113",
"0.56316113",
"0.56316113",
"0.5503881",
"0.54605424",
"0.5459186",
"0.540... | 0.8058066 | 0 |
default curl Accept header Also used by browsers to request various web assets like woff files | def accept_all(env)
env["HTTP_ACCEPT"] == "*/*"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def default_accept_header\n RDF::Util::File::HttpAdapter.default_accept_header.sub(/, \\*\\/\\*;q=0\\.1\\Z/, '')\n end",
"def prefered_http_accept\n Rack::Utils.best_q_match(@request.env[\"HTTP_ACCEPT\"], %w(text/html application/json))\n end",
"def accept(env)\n Rack::AcceptMediaTyp... | [
"0.6825097",
"0.64791125",
"0.6403577",
"0.6371897",
"0.6367981",
"0.62955797",
"0.6257307",
"0.62529063",
"0.6214424",
"0.618227",
"0.61762315",
"0.61665905",
"0.6166253",
"0.6115122",
"0.6065883",
"0.6029473",
"0.6023836",
"0.5999954",
"0.5914391",
"0.58629346",
"0.58546996... | 0.5816417 | 26 |
No browser ever makes a request without an accept header, so it must be an API request if there is no Accept header | def no_accept_header(env)
env["HTTP_ACCEPT"] == nil || env["HTTP_ACCEPT"] == ""
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_accept_header!\n return if request.headers[\"Accept\"] == \"application/vnd.api+json\"\n\n error!(\"415 Unsupported Media Type\", 415)\n end",
"def check_json_api_headers\n unless request.headers[\"Content-Type\"] && request.headers[\"Content-Type\"].\n include?(\"application/vnd.a... | [
"0.7697095",
"0.7233592",
"0.70484567",
"0.6956011",
"0.68605506",
"0.68258375",
"0.6760034",
"0.67585355",
"0.67549103",
"0.6737145",
"0.6674046",
"0.65703475",
"0.65351933",
"0.6440902",
"0.63286555",
"0.6308815",
"0.62895906",
"0.6261089",
"0.6255518",
"0.62498856",
"0.624... | 0.7058104 | 2 |
calls the private methods below passing in the given attributes | def virus_effects
predicted_deaths
speed_of_spread
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def attributes=(_arg0); end",
"def initialize_attributes(attributes); end",
"def attributes(*args)\n args.each do |attr|\n attribute(attr)\n end\n end",
"def method_missing(method, *args, &block)\n @attributes.send(method, *args, &block)\n end",
"def meth... | [
"0.7211032",
"0.67893666",
"0.6716527",
"0.66168666",
"0.65419316",
"0.6541509",
"0.652478",
"0.6515039",
"0.6420641",
"0.6336361",
"0.63285196",
"0.62964886",
"0.62964886",
"0.6227347",
"0.62199205",
"0.62199205",
"0.6219378",
"0.6219378",
"0.6219378",
"0.6219378",
"0.621937... | 0.0 | -1 |
takes attributes in based upon population density and preforms calculation providing anticipated deaths | def predicted_deaths
# predicted deaths is solely based on population density
if @population_density >= 200
number_of_deaths = (@population * 0.4)
elsif @population_density >= 150
number_of_deaths = (@population * 0.3)
elsif @population_density >= 100
number_of_deaths = (@population * ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def predicted_deaths #(population_density, population, state)\n # predicted deaths is solely based on population density\n\n\n if @population_density >= 200\n number_of_deaths = (@population * 0.4).floor\n elsif @population_density < 200 && @population_density >= 50\n number_of_deaths = (@popula... | [
"0.76750445",
"0.7655298",
"0.76462144",
"0.7643955",
"0.7642",
"0.7636896",
"0.76294565",
"0.7614499",
"0.7598468",
"0.7597625",
"0.75833505",
"0.7582063",
"0.7582063",
"0.7557443",
"0.75538945",
"0.75524235",
"0.7544485",
"0.7541529",
"0.75355726",
"0.75355726",
"0.75355726... | 0.0 | -1 |
takes attributes in based upon population density and preforms calculation providing the speed at which it will spread | def speed_of_spread #in months
# We are still perfecting our formula here. The speed is also affected
# by additional factors we haven't added into this functionality.
if @population_density >= 200
speed = 0.5
elsif @population_density >= 150
speed = 1
elsif @population_density >= 100
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def speed_of_spread\n if @population_density >= 200\n speed = 0.5\n else @population_density < 200\n multiplier = (@population_density/50).floor\n speed = 2.5 - (multiplier * 0.5)\n end\n end",
"def speed_of_spread #(population_density, state) #in months\n # We are still perfecting ou... | [
"0.80283123",
"0.79928255",
"0.7940139",
"0.79339826",
"0.78185743",
"0.7814368",
"0.7773902",
"0.7773902",
"0.7769669",
"0.77674353",
"0.7691136",
"0.7685977",
"0.7661941",
"0.75963223",
"0.75612056",
"0.75612056",
"0.75612056",
"0.75514895",
"0.7546612",
"0.751866",
"0.7477... | 0.0 | -1 |
Subject can be set in your I18n file at config/locales/en.yml with the following lookup: en.user_mailer.newsletter.subject | def newsletter(newsletter, user)
@newsletter = newsletter
@greeting = "Repeat Eats Newsletter!"
mail to: user.email, subject: @newsletter.title
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.70856094",
"0.6955006",
"0.6880311",
"0.68272316",
"0.6825893",
"0.6792881",
"0.6791113",
"0.6741581",
"0.6727536",
"0.6702391",
"0.6658228",
"0.6657666",
"0.658742",
"0.656914",
"0.65605366",
"0.64660364",
"0.64660364",
"0.64660364",
"0.64660364",
"0.64660364",
"0.6466036... | 0.573055 | 72 |
Subject can be set in your I18n file at config/locales/en.yml with the following lookup: en.user_mailer.contactUs.subject | def contactUs(name, email, phone, question, contact_pref)
@contact_pref = contact_pref
@name = name
@email = email
@phone = phone
@question = question
@greeting = @name + " " + "Has a question!"
@subject = "User Question"
mail to: "bubba99207@gmail.com", subject: @subject
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def translate(mapping, key)\n I18n.t(:\"#{mapping.name}_subject\", :scope => [:devise, :mailer, key],\n :default => [:subject, key.to_s.humanize])\n end",
"def message_subject=(value)\n @message_subject = value\n end",
"def subject (recipient)\n subject_variables = alert... | [
"0.71999085",
"0.71812636",
"0.71363145",
"0.69230187",
"0.68938017",
"0.67406553",
"0.6725831",
"0.6724764",
"0.66969573",
"0.66559994",
"0.66541964",
"0.6632981",
"0.6627675",
"0.66057485",
"0.65181434",
"0.6511013",
"0.6488825",
"0.6427663",
"0.6367147",
"0.6342508",
"0.63... | 0.59062636 | 63 |
define the arguments that the user will input | def arguments(model)
args = OpenStudio::Ruleset::OSArgumentVector.new
# create an argument for a space type to be used in the model, to see if one should be mapped as ceiling return air plenum
spaceTypes = model.getSpaceTypes
usedSpaceTypes_handle = OpenStudio::StringVector.new
usedSpaceTypes_displ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def arguments; end",
"def arguments; end",
"def arguments; end",
"def arguments\n \"\"\n end",
"def args; end",
"def args; end",
"def args; end",
"def args; end",
"def args; end",
"def args; end",
"def args; end",
"def args; end",
"def args; end",
"def args; end",
"def args; end... | [
"0.7374333",
"0.7374333",
"0.7374333",
"0.70872897",
"0.70077103",
"0.70077103",
"0.70077103",
"0.70077103",
"0.70077103",
"0.70077103",
"0.70077103",
"0.70077103",
"0.70077103",
"0.70077103",
"0.70077103",
"0.70077103",
"0.70077103",
"0.70077103",
"0.70077103",
"0.70077103",
... | 0.0 | -1 |
define what happens when the measure is run | def run(model, runner, user_arguments)
super(model, runner, user_arguments)
#use the built-in error checking
if not runner.validateUserArguments(arguments(model), user_arguments)
return false
end
### START INPUTS
#assign the user inputs to variables
ceilingReturnPlenumSpaceType = ru... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def measure; end",
"def measure=(_arg0); end",
"def measure\n\t\t1\n\tend",
"def measure(*args, &b)\n end",
"def communicate_measure_result(_ = nil, _ = nil); end",
"def communicate_measure_result(_ = nil, _ = nil); end",
"def called\n self.measurement.called\n end",
"def measure\n ... | [
"0.79848564",
"0.7639647",
"0.76355976",
"0.7170129",
"0.66926914",
"0.66926914",
"0.66718984",
"0.66311747",
"0.6599127",
"0.65870225",
"0.65324444",
"0.6481582",
"0.6405596",
"0.64028287",
"0.6333309",
"0.6283632",
"0.6283632",
"0.6283632",
"0.6281165",
"0.6269874",
"0.6242... | 0.0 | -1 |
used in edit meal view to display ingredient macros in table | def foods_converted
foods_result = []
self.foods.each do |food|
food_macros_serving = Hash.new
serving_size = (food.serving_size / 100.0)
food_macros_serving["name"] = self.name
food_macros_serving["kcal"] = (serving_size * food.kcal).round
food_macros_serving["protein"] = (serving... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @ingredients = Ingredient.all\n end",
"def show\n @ingredient_recettes = @ingredient.recettes\n end",
"def ingredient_name\n return ingredient.name\n end",
"def show\n @recipe_ingredient_group = RecipeIngredientGroup.new\n @recipe_ingredients = @recipe.recipe_ingredients\n @re... | [
"0.6153587",
"0.6143423",
"0.61109203",
"0.60974365",
"0.60917294",
"0.6018128",
"0.59337914",
"0.592422",
"0.59125805",
"0.58612365",
"0.585769",
"0.58232474",
"0.5816479",
"0.5815542",
"0.5787807",
"0.5787807",
"0.5771478",
"0.5767419",
"0.5752202",
"0.5751808",
"0.5733441"... | 0.0 | -1 |
GET /evaluaciones/1 GET /evaluaciones/1.xml | def show
@evaluacione = Evaluacione.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.xml { render :xml => @evaluacione }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\r\n @evaluaciones = Evaluacione.all\r\n end",
"def index\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @evaluators }\n end\n end",
"def show\r\n @evaluation = Evaluation.find(params[:id])\r\n @responses = Response.find_all_by_Evalu... | [
"0.65458894",
"0.6539789",
"0.6520937",
"0.6506127",
"0.6478041",
"0.6476702",
"0.643366",
"0.6340797",
"0.62616915",
"0.6201947",
"0.61645305",
"0.6144908",
"0.60656065",
"0.6037255",
"0.60119736",
"0.59711564",
"0.59603727",
"0.5948803",
"0.59164196",
"0.58901685",
"0.58869... | 0.7179133 | 0 |
GET /evaluaciones/new GET /evaluaciones/new.xml | def new
@evaluacione = Evaluacione.new
respond_to do |format|
format.html # new.html.erb
format.xml { render :xml => @evaluacione }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @estacion = Estacion.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @estacion }\n end\n end",
"def new\n @estagio = Estagio.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @est... | [
"0.73444235",
"0.7029901",
"0.700799",
"0.6965129",
"0.69602835",
"0.694903",
"0.69425124",
"0.6895614",
"0.6863163",
"0.6862484",
"0.6858303",
"0.6849317",
"0.684832",
"0.68457526",
"0.6836905",
"0.6826136",
"0.68043894",
"0.68008494",
"0.68008494",
"0.6800445",
"0.6791564",... | 0.774188 | 0 |
POST /evaluaciones POST /evaluaciones.xml | def create
@evaluacione = Evaluacione.new(params[:evaluacione])
respond_to do |format|
if @evaluacione.save
format.html { redirect_to(@evaluacione, :notice => 'Evaluacione was successfully created.') }
format.xml { render :xml => @evaluacione, :status => :created, :location => @evaluacio... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def post_evaluate(excon, body)\n excon.request(\n method: :post,\n path: '/evaluate',\n headers: { 'Content-Type' => 'application/json' },\n body: body\n )\nend",
"def evaluacione_params\r\n params.require(:evaluacione).permit(:contestada, :curso_id, :encuesta_id, :nombre)\r\n end",
"def ... | [
"0.6443393",
"0.61755776",
"0.60337514",
"0.6032301",
"0.5985007",
"0.5968063",
"0.594564",
"0.59177965",
"0.5874566",
"0.5771221",
"0.57186526",
"0.56468993",
"0.564466",
"0.5627873",
"0.5609866",
"0.55782497",
"0.5567646",
"0.55050796",
"0.55003476",
"0.5490839",
"0.5487217... | 0.6520938 | 0 |
PUT /evaluaciones/1 PUT /evaluaciones/1.xml | def update
@evaluacione = Evaluacione.find(params[:id])
respond_to do |format|
if @evaluacione.update_attributes(params[:evaluacione])
format.html { redirect_to(@evaluacione, :notice => 'Evaluacione was successfully updated.') }
format.xml { head :ok }
else
format.html { re... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @evaluacion = Evaluacion.find(params[:id])\n\n respond_to do |format|\n if @evaluacion.update_attributes(params[:evaluacion])\n format.html { redirect_to @evaluacion, notice: 'Evaluacion was successfully updated.' }\n format.json { head :no_content }\n else\n forma... | [
"0.6807242",
"0.6507722",
"0.6355236",
"0.63372445",
"0.6139806",
"0.6082772",
"0.6077134",
"0.6025371",
"0.6008826",
"0.5974862",
"0.59637237",
"0.5961347",
"0.59553313",
"0.5954125",
"0.5931183",
"0.5917951",
"0.59129953",
"0.59085566",
"0.5891922",
"0.5878923",
"0.5829348"... | 0.6813215 | 0 |
DELETE /evaluaciones/1 DELETE /evaluaciones/1.xml | def destroy
@evaluacione = Evaluacione.find(params[:id])
@evaluacione.destroy
respond_to do |format|
format.html { redirect_to(evaluaciones_url) }
format.xml { head :ok }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @evaluacion = Evaluacion.find(params[:id])\n @evaluacion.destroy\n\n respond_to do |format|\n format.html { redirect_to evaluaciones_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @estacion = Estacion.find(params[:id])\n @estacion.destroy\n\n r... | [
"0.68952584",
"0.67754596",
"0.66590357",
"0.66368866",
"0.6585356",
"0.65540206",
"0.6540472",
"0.6540472",
"0.6505618",
"0.6480637",
"0.6465142",
"0.6417233",
"0.6404615",
"0.6403051",
"0.6400472",
"0.6393812",
"0.63901806",
"0.6389374",
"0.637874",
"0.63649964",
"0.6354835... | 0.733809 | 0 |
All the graph statements except hasModel and those with missing objects | def statements
graph.statements.reject { |stmt| predicate_blacklist.include?(stmt.predicate) || missing_object?(stmt) }
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def relation_none(model)\n validate_model(model)\n model.none\n end",
"def graph?\n false\n end",
"def graph?\n true\n end",
"def generate_graph\n end",
"def dangling_relationships\n relationships.select do |relationship|\n relationship.subject.nil? || relationship.o... | [
"0.5597195",
"0.55133337",
"0.5406379",
"0.530991",
"0.5297998",
"0.5282695",
"0.525528",
"0.5249848",
"0.5246992",
"0.51800144",
"0.51720977",
"0.5172053",
"0.5152756",
"0.5147899",
"0.51356155",
"0.51356155",
"0.51038206",
"0.50939673",
"0.5085285",
"0.5081328",
"0.5078451"... | 0.5764731 | 0 |
returns the number of items within the entire collection | def item_count
@collection.length
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def item_count\n @collection.size\n end",
"def item_count\n collection.length\n end",
"def item_count\n @collection.count\n end",
"def count\n collection.count\n end",
"def number_of_elements_in_collection\n # collection here refers to the collection that is set with the initialize m... | [
"0.8950768",
"0.8918706",
"0.881112",
"0.8568127",
"0.8565642",
"0.82640946",
"0.8262284",
"0.822973",
"0.8160236",
"0.8156021",
"0.8138456",
"0.805573",
"0.79227865",
"0.7866197",
"0.7866197",
"0.78629667",
"0.7862662",
"0.7845518",
"0.7803834",
"0.7803348",
"0.7711624",
"... | 0.8898303 | 2 |
returns the number of pages | def page_count
@collection.max + 1
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def page_count; pages.count; end",
"def number_of_pages\n return @number_of_pages\n end",
"def page_count\n @total_pages\n end",
"def num_pages\n n, rest = @num_entries.divmod(@entries_per_page)\n if rest > 0 then n + 1 else n end\n end",
"def total_pages\n ... | [
"0.8871328",
"0.8835811",
"0.87635493",
"0.86556756",
"0.8639673",
"0.8625077",
"0.8625077",
"0.8625077",
"0.8625077",
"0.8606896",
"0.84872305",
"0.8312499",
"0.8308352",
"0.82833606",
"0.82538044",
"0.8244665",
"0.82341814",
"0.82276404",
"0.8223418",
"0.81749964",
"0.81725... | 0.7386953 | 99 |
returns the number of items on the current page. page_index is zero based. this method should return 1 for page_index values that are out of range | def page_item_count(page_index)
return -1 if page_index > @collection[-1] || page_index < 0
@collection.count {|v| v == page_index}
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def page_item_count(page_index)\n return -1 if page_index < 0 || page_index >= self.page_count\n @pages[page_index].count\n end",
"def page_item_count(page_index)\n if (page_index + 1 < page_count)\n page_size\n elsif page_index + 1 > page_count\n -1\n else\n item_count % page_size... | [
"0.90772384",
"0.8794858",
"0.86657184",
"0.84735316",
"0.84356713",
"0.8316049",
"0.82967085",
"0.7996766",
"0.7991153",
"0.79892004",
"0.78802973",
"0.78521496",
"0.7756084",
"0.77449316",
"0.77258366",
"0.76960295",
"0.7683067",
"0.7683067",
"0.7683067",
"0.7683067",
"0.76... | 0.88058585 | 1 |
determines what page an item is on. Zero based indexes. this method should return 1 for item_index values that are out of range | def page_index(item_index)
return -1 if !(item_index < item_count) || item_index < 0
@collection[item_index]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def page_index(item_index)\n return -1 if item_index < 0 || item_index >= self.item_count\n location = item_index.divmod @items_per_page\n location[0]\n end",
"def page_index(item_index)\n if (item_index >= item_count || item_index < 0)\n -1\n elsif item_count == item_index - 1\n page_c... | [
"0.8317278",
"0.82632387",
"0.80230683",
"0.8019768",
"0.7967099",
"0.72548354",
"0.69349074",
"0.6880199",
"0.68635756",
"0.68510646",
"0.6838713",
"0.67769283",
"0.6733125",
"0.6696102",
"0.65258515",
"0.6493964",
"0.6490064",
"0.64006805",
"0.6397563",
"0.6358977",
"0.6250... | 0.82983905 | 1 |
Implements the ids reader method, e.g. foo.item_ids for Foo.indirectly_contains :items, ... | def ids_reader
predicate = reflection.options.fetch(:has_member_relation)
if loaded?
target.map(&:id)
else
owner.resource.query({ predicate: predicate })
.map { |s| ActiveFedora::Base.uri_to_id(s.object) } | target.map(&:id)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ids_getter(name, metadata)\n ids_method = \"#{name.to_s.singularize}_ids\"\n re_define_method(ids_method) do\n send(name).only(:id).map(&:id)\n end\n self\n end",
"def ids\n (1..get_item_count).map do |index|\n get_item_identifier index\n end\n... | [
"0.7071506",
"0.6968297",
"0.6785989",
"0.65630686",
"0.6425952",
"0.64023226",
"0.6367779",
"0.63203144",
"0.6312439",
"0.6233021",
"0.6220249",
"0.6191885",
"0.6191885",
"0.6191885",
"0.6147744",
"0.6124463",
"0.61093843",
"0.60776937",
"0.60561687",
"0.6050675",
"0.6018001... | 0.70116866 | 1 |
use to_f if you convert unexact values | def converts(option)
if option == "a"
puts "Insert the value in mm :"
millimeters = gets.chomp.to_i
centimeters = Conversions.convert_millimeters_to_centimeters millimeters
puts "#{millimeters} mm represent #{centimeters} cm"
elsif option == "b"
puts "Insert the value in cm :"
centimeters = gets.chomp.to_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_f() end",
"def to_f() end",
"def to_f() end",
"def to_f() end",
"def to_f; end",
"def to_f\n end",
"def to_f\n end",
"def to_f\n end",
"def to_f\n case @kind\n when :float_lit, :float_exp_lit,\n :integer_lit, :integer_exp_lit,\n :single_string_lit, :double_string_lit... | [
"0.837901",
"0.837901",
"0.837901",
"0.837901",
"0.80831075",
"0.77847016",
"0.77847016",
"0.77847016",
"0.7709833",
"0.76996845",
"0.76516867",
"0.7643432",
"0.76333004",
"0.76147074",
"0.75944954",
"0.75668126",
"0.75668126",
"0.75668126",
"0.75668126",
"0.7400291",
"0.7339... | 0.0 | -1 |
return the name of the role | def role_str
case name
when ROLE_ADMIN then I18n.t("model.role.admin")
when ROLE_COMPANY then I18n.t("model.role.company")
when ROLE_ENGINEER then I18n.t("model.role.engineer")
when ROLE_NORMAL then I18n.t("model.role.normal")
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def role_name\n @role_name ||= object.meta[:role].try(:capitalize)\n end",
"def role_name\r\n Role.find(object.role_id).role_name\r\n end",
"def role_name\n object.role_name\n end",
"def role\r\n r = read_attribute(:role)\r\n r.capitalize unless r.nil?\r\n end",
"def name_with_role\n... | [
"0.8877166",
"0.8833476",
"0.87497485",
"0.8400174",
"0.83137137",
"0.81513506",
"0.8113835",
"0.7994746",
"0.78880656",
"0.78487027",
"0.7735582",
"0.77353096",
"0.7721731",
"0.7701005",
"0.76615936",
"0.76540244",
"0.7581208",
"0.755716",
"0.7501846",
"0.7480339",
"0.747146... | 0.7570399 | 17 |
Locale in xx_XX format | def full_locale(lang=I18n.locale.to_s)
if lang == "en"
"en_US"
else
"#{lang.downcase}_#{lang.upcase}"
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def format_locale\n self.locale = self.locale.gsub('_', '-').split(',').first.split('-').first if self.locale.present?\n end",
"def apply_locale; end",
"def to_deepl_compatible_locale(locale)\n locale.to_s.split('-', 2).first.upcase\n end",
"def _calc_locale(_l)\n _l = (_l || @_deco_locale... | [
"0.7725891",
"0.7055182",
"0.6987029",
"0.6929199",
"0.6824065",
"0.6806571",
"0.6806571",
"0.6806571",
"0.6806571",
"0.6806571",
"0.6806571",
"0.6806571",
"0.67514277",
"0.6677381",
"0.6646012",
"0.6639206",
"0.65349495",
"0.645439",
"0.63492495",
"0.63492495",
"0.6312461",
... | 0.6825189 | 4 |
Link_to with active class if current_page | def nav_link_to(text, url, options = {})
is_active = url_for(url.split("#")[0], relative: false) ==
url_for(current_page.url, relative: false)
options[:class] ||= ""
options[:class] << " active" if is_active
link_to(text, url, options)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def link_to_if_current(text, page, active_class: \"active\")\n if page == current_page\n link_to text, page.request_path, class: active_class\n else\n link_to text, page.request_path\n end\n end",
"def nav_link_to(link, url, opts={})\n if current_resource.url == url_for(url)\n opts[:c... | [
"0.86151206",
"0.8035615",
"0.7871288",
"0.77930945",
"0.7607686",
"0.7607686",
"0.7537126",
"0.7535651",
"0.75335747",
"0.7404182",
"0.73309106",
"0.7302635",
"0.7293621",
"0.72701323",
"0.7182329",
"0.7123731",
"0.7111835",
"0.7102652",
"0.7099457",
"0.70991486",
"0.7086910... | 0.74980676 | 9 |
Use callbacks to share common setup or constraints between actions. | def set_article
@article = Article.find(params[:article_id])
render json: {
error: 'not found'
}, status: 404 if @article.nil?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_... | [
"0.6163163",
"0.6045976",
"0.5946146",
"0.591683",
"0.5890051",
"0.58349305",
"0.5776858",
"0.5703237",
"0.5703237",
"0.5652805",
"0.5621621",
"0.54210985",
"0.5411113",
"0.5411113",
"0.5411113",
"0.5391541",
"0.53794575",
"0.5357573",
"0.53402257",
"0.53394014",
"0.53321576"... | 0.0 | -1 |
extended data janitor model validations that apply data_janitor audit purposes | def dj_audit_validations(&block)
with_options(on: [:dj_audit], &block)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def validation; end",
"def validation; end",
"def extra_validations\n success\n end",
"def pre_validation\n\n\n end",
"def validate\n \n \n end",
"def validate; end",
"def validate; end",
"def validate; end",
"def validate; end",
"def pre_validation\n\n end",
"def valid... | [
"0.6437803",
"0.6437803",
"0.63117343",
"0.6299481",
"0.6273503",
"0.6260488",
"0.6260488",
"0.6260488",
"0.6260488",
"0.62549055",
"0.6194469",
"0.6141859",
"0.61279804",
"0.61114573",
"0.61035025",
"0.60986215",
"0.6083659",
"0.60651106",
"0.60651106",
"0.60651106",
"0.6058... | 0.60993713 | 15 |
Add a white list of extensions which are allowed to be uploaded. | def extension_white_list
%w(jpg jpeg gif png JPG JPEG GIF PNG)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def extension_whitelist\n Spotlight::Engine.config.allowed_upload_extensions\n end",
"def extension_whitelist\n %w(jpg jpeg gif png tif tiff avi m4v mov mp4 mpg mpeg mpeg wmv qt)\n end",
"def extension_whitelist\n %w(jpg jpeg gif png)\n end",
"def extension_whitelist\n %w(jpg jpeg gi... | [
"0.8075808",
"0.75609756",
"0.7526584",
"0.74878633",
"0.74878633",
"0.74878633",
"0.74878633",
"0.74878633",
"0.74878633",
"0.74878633",
"0.74878633",
"0.74878633",
"0.74878633",
"0.74878633",
"0.74878633",
"0.74878633",
"0.74864304",
"0.7485972",
"0.7485972",
"0.7485972",
"... | 0.71089274 | 46 |
Override the filename of the uploaded files: Avoid using model.id or version_name here, see uploader/store.rb for details. | def filename
if super.present?
@name ||= Digest::MD5.hexdigest(File.dirname(current_path))
"#{@name}#{File.extname(original_filename).downcase}"
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def filename\n if super.present?\n @name ||=\"#{SecureRandom.hex}.#{file.extension.downcase}\" if original_filename\n Rails.logger.debug(\"(BaseUploader.filename) #{@name}\")\n @name\n end\n end",
"def filename\n if original_filename\n \"#{model.name.parameterize}-#{secure_token(8)}... | [
"0.8077653",
"0.8019424",
"0.7978584",
"0.79266495",
"0.7855941",
"0.78141326",
"0.7767793",
"0.77503246",
"0.7706582",
"0.7576993",
"0.75461215",
"0.7528873",
"0.7521613",
"0.7504146",
"0.7487593",
"0.7486038",
"0.7444368",
"0.7435015",
"0.7411776",
"0.73934406",
"0.7320671"... | 0.7305732 | 22 |
Provide a default URL as a default if there hasn't been a file uploaded | def default_url
ActionController::Base.helpers.asset_path('mails/bigimage.jpg', type: :image).to_s
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def url_with_default *args\n unless file_name.nil?\n url_without_default *args\n else\n nil\n end\n end",
"def default_url\n nil\n end",
"def default_url\n end",
"def default_url\n url 'default'\n end",
"def default_url\n file_path = [\n 'fallbacks',\n ... | [
"0.78345007",
"0.76724994",
"0.7374204",
"0.70699346",
"0.704846",
"0.70038724",
"0.6925955",
"0.69040054",
"0.6878755",
"0.6872561",
"0.6865552",
"0.68286866",
"0.6819201",
"0.68122137",
"0.68122137",
"0.68122137",
"0.677967",
"0.6777166",
"0.676122",
"0.67448753",
"0.673382... | 0.6416765 | 50 |
Constructor Returns an instance of a TLV. | def initialize(type, value = nil, compress=false)
@type = type
@compress = compress
if (value != nil)
if (type & TLV_META_TYPE_STRING == TLV_META_TYPE_STRING)
if (value.kind_of?(Fixnum))
@value = value.to_s
else
@value = value.dup
end
else
@value = value
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initialize(type, value = nil)\n\t\t@type = type\n\t\t\n\t\tif (value != nil)\n\t\t\tif (type & TLV_META_TYPE_STRING == TLV_META_TYPE_STRING)\n\t\t\t\tif (value.kind_of?(Fixnum))\n\t\t\t\t\t@value = value.to_s\n\t\t\t\telse\n\t\t\t\t\t@value = value.dup\n\t\t\t\tend\n\t\t\telse\n\t\t\t\t@value = value\n\t\t\te... | [
"0.6402868",
"0.6103011",
"0.5926326",
"0.5926326",
"0.5908427",
"0.5730844",
"0.570433",
"0.56687784",
"0.5597977",
"0.557782",
"0.5570558",
"0.5570558",
"0.5564883",
"0.54935753",
"0.5487293",
"0.54816663",
"0.54783285",
"0.5473276",
"0.5473276",
"0.5438282",
"0.5424904",
... | 0.57649475 | 5 |
Conditionals Checks to see if a TLVs meta type is equivalent to the meta type passed. | def meta_type?(meta)
return (self.type & meta == meta)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def has_tlv?(type)\n\t\treturn get_tlv(type) != nil\n\tend",
"def has_tlv?(type)\n\t\treturn get_tlv(type) != nil\n\tend",
"def term?\n type.in?(%i[tag metatag wildcard all none])\n end",
"def meta?\n @meta\n end",
"def type?( in_type )\n type == in_type\n end",
"def is_multi?\n... | [
"0.59200716",
"0.59200716",
"0.55792856",
"0.55123144",
"0.54043",
"0.53813577",
"0.535251",
"0.53254145",
"0.53163666",
"0.5311763",
"0.5309913",
"0.52808046",
"0.5193332",
"0.51906294",
"0.51764625",
"0.5174394",
"0.51338243",
"0.5090406",
"0.5084725",
"0.5083678",
"0.50759... | 0.70168734 | 1 |
Checks to see if the TLVs type is equivalent to the type passed. | def type?(type)
return self.type == type
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def type_of?(type)\n type.raw_type == raw_type\n end",
"def type?( in_type )\n type == in_type\n end",
"def has_tlv?(type)\n\t\treturn get_tlv(type) != nil\n\tend",
"def has_tlv?(type)\n\t\treturn get_tlv(type) != nil\n\tend",
"def check_type(type)\n %w{galera mysql}.each do |t|\n ret... | [
"0.68759",
"0.6807026",
"0.67534614",
"0.67534614",
"0.6587615",
"0.64330775",
"0.64236933",
"0.6405375",
"0.6294758",
"0.6284693",
"0.6276997",
"0.6261629",
"0.6256036",
"0.6227613",
"0.6180734",
"0.61251134",
"0.60295665",
"0.5990569",
"0.5987478",
"0.59523165",
"0.59264225... | 0.63684654 | 9 |
Checks to see if the TLVs value is equivalent to the value passed. | def value?(value)
return self.value == value
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_raw_value(value)\n check(value, {\n :type => :uint8,\n :count => (size < 1 ? 1 : size),\n :length => 1,\n :bit_length => 8,\n :sign => :unsigned,\n :default_value => 0,\n })\n end",
"def valid_value?\n if ape_type == 'utf8' || ape_type == 'ext... | [
"0.6237748",
"0.619103",
"0.6182821",
"0.61303514",
"0.6072317",
"0.6013846",
"0.6007214",
"0.5981066",
"0.59719974",
"0.5948616",
"0.5939308",
"0.59384906",
"0.59384906",
"0.5905601",
"0.5819519",
"0.5819146",
"0.5808179",
"0.58048415",
"0.578565",
"0.578565",
"0.577681",
... | 0.62886584 | 1 |
Serializers Converts the TLV to raw. | def to_r
raw = value.to_s;
if (self.type & TLV_META_TYPE_STRING == TLV_META_TYPE_STRING)
raw += "\x00"
elsif (self.type & TLV_META_TYPE_UINT == TLV_META_TYPE_UINT)
raw = [value].pack("N")
elsif (self.type & TLV_META_TYPE_BOOL == TLV_META_TYPE_BOOL)
if (value == true)
raw = [1].pack("c")
else
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_r\n\t\traw = value.to_s;\n\n\t\tif (self.type & TLV_META_TYPE_STRING == TLV_META_TYPE_STRING)\n\t\t\traw += \"\\x00\"\n\t\telsif (self.type & TLV_META_TYPE_UINT == TLV_META_TYPE_UINT)\n\t\t\traw = [value].pack(\"N\")\n\t\telsif (self.type & TLV_META_TYPE_BOOL == TLV_META_TYPE_BOOL)\n\t\t\tif (value == true)... | [
"0.6859719",
"0.63497025",
"0.6252269",
"0.6252269",
"0.62424344",
"0.6140392",
"0.5937109",
"0.59352195",
"0.5920375",
"0.58088326",
"0.58088326",
"0.5777562",
"0.57747245",
"0.57376057",
"0.57376057",
"0.56898165",
"0.5672061",
"0.55899584",
"0.55899584",
"0.55899584",
"0.5... | 0.7012267 | 0 |
Translates the raw format of the TLV into a sanitize version. | def from_r(raw)
self.value = nil
length, self.type = raw.unpack("NN");
# check if the tlv value has been compressed...
if( self.type & TLV_META_TYPE_COMPRESSED == TLV_META_TYPE_COMPRESSED )
# set this TLV as using compression
@compress = true
# remove the TLV_META_TYPE_COMPRESSED flag from the tlv t... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def unnormalize(string, doctype = T.unsafe(nil), filter = T.unsafe(nil), illegal = T.unsafe(nil)); end",
"def from_r(raw)\n\t\tself.value = nil\n\n\t\tlength, self.type = raw.unpack(\"NN\");\n\n\t\tif (self.type & TLV_META_TYPE_STRING == TLV_META_TYPE_STRING)\n\t\t\tif (raw.length > 0)\n\t\t\t\tself.value = raw... | [
"0.6193213",
"0.57636374",
"0.55234313",
"0.5228051",
"0.5213243",
"0.518444",
"0.51834846",
"0.51834846",
"0.5154971",
"0.5140968",
"0.5122174",
"0.51009953",
"0.50373274",
"0.5011793",
"0.50004846",
"0.49918544",
"0.49756673",
"0.4962281",
"0.49432832",
"0.49171636",
"0.490... | 0.55871564 | 2 |
Constructor Initializes the group TLV container to the supplied type and creates an empty TLV array. | def initialize(type)
super(type)
self.tlvs = [ ]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initialize groupSize\n\t\t@groupSize=groupSize\n\t\t@arrayChromosomes=Array.new\n\tend",
"def group_type=(value)\n @group_type = value\n end",
"def initialize(type)\n @items = []\n @type = type\n end",
"def initialize(type = TYPES[:empty])\n @type = type... | [
"0.5959835",
"0.58469665",
"0.5821178",
"0.5817117",
"0.57417417",
"0.5656058",
"0.5633167",
"0.5556355",
"0.5556355",
"0.5307821",
"0.5232313",
"0.52197134",
"0.52197134",
"0.52070105",
"0.52035844",
"0.51866245",
"0.51866245",
"0.5176312",
"0.5162468",
"0.51504487",
"0.5144... | 0.5399001 | 10 |
Groupbased TLV accessors Enumerates TLVs of the supplied type. | def each(type = TLV_TYPE_ANY, &block)
get_tlvs(type).each(&block)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def each_with_index(type = TLV_TYPE_ANY, &block)\n\t\tget_tlvs(type).each_with_index(&block)\n\tend",
"def each_with_index(type = TLV_TYPE_ANY, &block)\n\t\tget_tlvs(type).each_with_index(&block)\n\tend",
"def get_tlv_values(type)\n\t\tget_tlvs(type).collect { |a| a.value }\n\tend",
"def get_tlv_values(type)... | [
"0.6970296",
"0.6970296",
"0.65281516",
"0.65281516",
"0.637367",
"0.637367",
"0.6174964",
"0.6174964",
"0.61379886",
"0.61072034",
"0.55152637",
"0.54214716",
"0.54214716",
"0.53846",
"0.52289146",
"0.5179602",
"0.51663953",
"0.508196",
"0.5049436",
"0.5049436",
"0.5046244",... | 0.70094895 | 1 |
Enumerates TLVs of a supplied type with indexes. | def each_with_index(type = TLV_TYPE_ANY, &block)
get_tlvs(type).each_with_index(&block)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def each(type = TLV_TYPE_ANY, &block)\n\t\tget_tlvs(type).each(&block)\n\tend",
"def each(type = TLV_TYPE_ANY, &block)\n\t\tget_tlvs(type).each(&block)\n\tend",
"def enumerate(type, opts)\n raise Error::SubclassResponsibility\n end",
"def get_tlv(type, index = 0)\n\t\ttype_tlvs = get_tlvs(type)\n... | [
"0.6651781",
"0.6651781",
"0.6077107",
"0.59453034",
"0.59453034",
"0.59292334",
"0.59292334",
"0.5442824",
"0.5428451",
"0.5387065",
"0.53594124",
"0.5347856",
"0.5347715",
"0.5347715",
"0.5302907",
"0.5184244",
"0.51747185",
"0.51728725",
"0.5158427",
"0.51135314",
"0.50870... | 0.7803846 | 1 |
Returns an array of TLVs for the given type. | def get_tlvs(type)
if (type == TLV_TYPE_ANY)
return self.tlvs
else
type_tlvs = []
self.tlvs.each() { |tlv|
if (tlv.type?(type))
type_tlvs << tlv
end
}
return type_tlvs
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_tlv_values(type)\n\t\tget_tlvs(type).collect { |a| a.value }\n\tend",
"def get_tlv_values(type)\n\t\tget_tlvs(type).collect { |a| a.value }\n\tend",
"def get_tlv(type, index = 0)\n\t\ttype_tlvs = get_tlvs(type)\n\n\t\tif (type_tlvs.length > index)\n\t\t\treturn type_tlvs[index]\n\t\tend\n\n\t\treturn n... | [
"0.74816453",
"0.74816453",
"0.67054456",
"0.67054456",
"0.6422999",
"0.6422999",
"0.6100501",
"0.58411473",
"0.5706038",
"0.5645888",
"0.55949676",
"0.5576011",
"0.55497086",
"0.5510361",
"0.5505722",
"0.5505722",
"0.54669064",
"0.54653496",
"0.54378575",
"0.5436767",
"0.535... | 0.7621979 | 1 |
TLV management Adds a TLV of a given type and value. | def add_tlv(type, value = nil, replace = false, compress=false)
# If we should replace any TLVs with the same type...remove them first
if (replace)
each(type) { |tlv|
if (tlv.type == type)
self.tlvs.delete(tlv)
end
}
end
if (type & TLV_META_TYPE_GROUP == TLV_META_TYPE_GROUP)
tlv = GroupT... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_field(type, value)# {{{\n t = TLV.new(2,2)\n t.type = type\n t.value = value\n t.length = 4 + value.length\n self.payload += t.encode \n end",
"def add_tlv(t,l,v=nil)\n tlv = [(t << 9) + l, v]\n self.payload += tlv.flatten.pack(\"na*\")\n end",
"def add_tlv(type, value = nil, r... | [
"0.78159946",
"0.7622521",
"0.7575506",
"0.65320927",
"0.65320927",
"0.6370173",
"0.6156051",
"0.5919875",
"0.5919875",
"0.56553566",
"0.5556474",
"0.5556474",
"0.5506013",
"0.54831356",
"0.54609066",
"0.54539067",
"0.54539067",
"0.53963107",
"0.53696126",
"0.53538275",
"0.53... | 0.7435301 | 3 |
Adds zero or more TLVs to the packet. | def add_tlvs(tlvs)
if (tlvs != nil)
tlvs.each { |tlv|
add_tlv(tlv['type'], tlv['value'])
}
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_tlv(t,l,v=nil)\n tlv = [(t << 9) + l, v]\n self.payload += tlv.flatten.pack(\"na*\")\n end",
"def add_field(type, value)# {{{\n t = TLV.new(2,2)\n t.type = type\n t.value = value\n t.length = 4 + value.length\n self.payload += t.encode \n end",
"def add_tlv(type, value = nil, r... | [
"0.7512073",
"0.6452581",
"0.5446231",
"0.5387242",
"0.50093186",
"0.4855799",
"0.4843963",
"0.48399767",
"0.4839363",
"0.48284498",
"0.48074946",
"0.48074946",
"0.4796561",
"0.4761504",
"0.4731864",
"0.47066212",
"0.46885264",
"0.4682039",
"0.46717402",
"0.46441925",
"0.4643... | 0.6175277 | 3 |
Gets the first TLV of a given type. | def get_tlv(type, index = 0)
type_tlvs = get_tlvs(type)
if (type_tlvs.length > index)
return type_tlvs[index]
end
return nil
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_tlv_value(type, index = 0)\n\t\ttlv = get_tlv(type, index)\n\n\t\treturn (tlv != nil) ? tlv.value : nil\n\tend",
"def get_tlv_value(type, index = 0)\n\t\ttlv = get_tlv(type, index)\n\n\t\treturn (tlv != nil) ? tlv.value : nil\n\tend",
"def by_t(type)\n return self.find_all{|slot| slot.type == type}[... | [
"0.6748661",
"0.6748661",
"0.6053849",
"0.5868394",
"0.5867666",
"0.5590036",
"0.5545002",
"0.5545002",
"0.55343395",
"0.551295",
"0.551295",
"0.5489713",
"0.54462934",
"0.5434431",
"0.5429876",
"0.5429876",
"0.5332865",
"0.5319422",
"0.52711165",
"0.52538824",
"0.52532554",
... | 0.7892362 | 1 |
Returns the value of a TLV if it exists, otherwise nil. | def get_tlv_value(type, index = 0)
tlv = get_tlv(type, index)
return (tlv != nil) ? tlv.value : nil
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_tlv(type, index = 0)\n\t\ttype_tlvs = get_tlvs(type)\n\n\t\tif (type_tlvs.length > index)\n\t\t\treturn type_tlvs[index]\n\t\tend\n\n\t\treturn nil\n\tend",
"def get_tlv(type, index = 0)\n\t\ttype_tlvs = get_tlvs(type)\n\n\t\tif (type_tlvs.length > index)\n\t\t\treturn type_tlvs[index]\n\t\tend\n\n\t\tre... | [
"0.6762493",
"0.6762493",
"0.6418291",
"0.5981156",
"0.5981156",
"0.58768827",
"0.5690261",
"0.55697",
"0.5522212",
"0.5402827",
"0.5337459",
"0.5290298",
"0.528098",
"0.5278988",
"0.5274449",
"0.523043",
"0.52296036",
"0.5215547",
"0.52152973",
"0.52152973",
"0.51826054",
... | 0.72710985 | 1 |
Returns an array of values for all tlvs of type type. | def get_tlv_values(type)
get_tlvs(type).collect { |a| a.value }
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_tlvs(type)\n\t\tif (type == TLV_TYPE_ANY)\n\t\t\treturn self.tlvs\n\t\telse\n\t\t\ttype_tlvs = []\n\n\t\t\tself.tlvs.each() { |tlv|\n\t\t\t\tif (tlv.type?(type))\n\t\t\t\t\ttype_tlvs << tlv\n\t\t\t\tend\n\t\t\t}\n\n\t\t\treturn type_tlvs\n\t\tend\n\tend",
"def get_tlvs(type)\n\t\tif (type == TLV_TYPE_ANY... | [
"0.75675505",
"0.75675505",
"0.65907633",
"0.64082175",
"0.64082175",
"0.59582686",
"0.5935431",
"0.5657677",
"0.5644466",
"0.5640378",
"0.5611651",
"0.55993783",
"0.5592396",
"0.5590408",
"0.55671597",
"0.55671597",
"0.5558564",
"0.5556186",
"0.55391705",
"0.5527216",
"0.551... | 0.736128 | 3 |
Checks to see if the container has a TLV of a given type. | def has_tlv?(type)
return get_tlv(type) != nil
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def has_type?\n ! type.nil?\n end",
"def has_type?\n ! get_internal_word(TYPE_INDEX).nil?\n end",
"def type?\n @data[:type].empty? ? false : true\n end",
"def has_type?(type_)\n @mutex.synchronize do\n @types.has_key?(type_)\n end\n end",
"def has_encounter_type?... | [
"0.6494128",
"0.6314078",
"0.6088852",
"0.60273576",
"0.6008003",
"0.5998794",
"0.5949617",
"0.58603334",
"0.580964",
"0.57994646",
"0.57676595",
"0.57545716",
"0.5713449",
"0.5710575",
"0.570083",
"0.570083",
"0.56475633",
"0.563804",
"0.5596937",
"0.5565976",
"0.5558136",
... | 0.8031238 | 1 |
Zeros out the array of TLVs. | def reset
self.tlvs = []
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def zero(&contents) X(0, &contents) end",
"def clear\n @field.each_index { |i| @field[i] = 0 }\n end",
"def zero()\n\treturn([0,0,0,0,0,0,0,0,0])\nend",
"def zero\n 0.upto(@words-1) do |w|\n @bits[w] = 0\n end\n end",
"def reset\n @array = nil\n end",
"def clear\n @stor... | [
"0.6547851",
"0.63611776",
"0.62478995",
"0.6174784",
"0.5755311",
"0.57310677",
"0.5726876",
"0.5709297",
"0.56672347",
"0.5639802",
"0.5623227",
"0.56199676",
"0.5542608",
"0.55307347",
"0.55280787",
"0.551068",
"0.5469376",
"0.5459057",
"0.5449602",
"0.5447047",
"0.5445972... | 0.5074507 | 65 |
Serializers Converts all of the TLVs in the TLV array to raw and prefixes them with a container TLV of this instance's TLV type. | def to_r
raw = ''
self.each() { |tlv|
raw << tlv.to_r
}
return [raw.length + 8, self.type].pack("NN") + raw
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_r\n\t\traw = value.to_s;\n\n\t\tif (self.type & TLV_META_TYPE_STRING == TLV_META_TYPE_STRING)\n\t\t\traw += \"\\x00\"\n\t\telsif (self.type & TLV_META_TYPE_UINT == TLV_META_TYPE_UINT)\n\t\t\traw = [value].pack(\"N\")\n\t\telsif (self.type & TLV_META_TYPE_BOOL == TLV_META_TYPE_BOOL)\n\t\t\tif (value == true)... | [
"0.5961077",
"0.55862504",
"0.5171367",
"0.5171367",
"0.4940702",
"0.4853383",
"0.48212346",
"0.47799745",
"0.47709346",
"0.47346047",
"0.47083202",
"0.4617202",
"0.4575752",
"0.4575752",
"0.45729294",
"0.4497814",
"0.44894177",
"0.4464",
"0.4462754",
"0.44606584",
"0.4433930... | 0.52299935 | 3 |
Converts the TLV group container from raw to all of the individual TLVs. | def from_r(raw)
offset = 8
# Reset the TLVs array
self.tlvs = []
self.type = raw.unpack("NN")[1]
# Enumerate all of the TLVs
while (offset < raw.length-1)
tlv = nil
# Get the length and type
length, type = raw[offset..offset+8].unpack("NN")
if (type & TLV_META_TYPE_GROUP == TLV_META_TYPE_GR... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def from_r(raw)\n\t\tself.value = nil\n\n\t\tlength, self.type = raw.unpack(\"NN\");\n\n\t\t# check if the tlv value has been compressed...\n\t\tif( self.type & TLV_META_TYPE_COMPRESSED == TLV_META_TYPE_COMPRESSED )\n\t\t\t# set this TLV as using compression\n\t\t\t@compress = true\n\t\t\t# remove the TLV_META_TY... | [
"0.5510347",
"0.53835297",
"0.49199915",
"0.47071126",
"0.46451247",
"0.46189794",
"0.46009475",
"0.45888084",
"0.45409986",
"0.45144984",
"0.45144984",
"0.44911018",
"0.44801974",
"0.44712278",
"0.44627753",
"0.44476873",
"0.44408685",
"0.43709478",
"0.43474317",
"0.43166432",... | 0.670376 | 1 |
Constructor Initializes the packet to the supplied packet type and method, if any. If the packet is a request, a request identifier is created. | def initialize(type = nil, method = nil)
super(type)
if (method)
self.method = method
end
self.created_at = ::Time.now
# If it's a request, generate a random request identifier
if ((type == PACKET_TYPE_REQUEST) ||
(type == PACKET_TYPE_PLAIN_REQUEST))
rid = ''
32.times { |val| rid << rand(... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initialize(type = nil, method = nil)\n\t\tsuper(type)\n\n\t\tif (method)\n\t\t\tself.method = method\n\t\tend\n\n\t\t# If it's a request, generate a random request identifier\n\t\tif ((type == PACKET_TYPE_REQUEST) ||\n\t\t (type == PACKET_TYPE_PLAINTEXT_REQUEST))\n\t\t\trid = ''\n\n\t\t\t32.times { |val| ri... | [
"0.7971575",
"0.63409096",
"0.63333994",
"0.63333994",
"0.59193516",
"0.57540977",
"0.55405766",
"0.55356",
"0.54965144",
"0.5494459",
"0.5494459",
"0.5466833",
"0.54543734",
"0.5431925",
"0.54091877",
"0.5394551",
"0.5359059",
"0.5281987",
"0.5274823",
"0.527208",
"0.5262265... | 0.80640596 | 0 |
Conditionals Checks to see if the packet is a response. | def response?
return ((self.type == PACKET_TYPE_RESPONSE) ||
(self.type == PACKET_TYPE_PLAIN_RESPONSE))
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def response?\n @type == :response\n end",
"def command_response?\n type == :command_response\n end",
"def response?\n !!response\n end",
"def response?\n !response.nil?\n end",
"def response_received?\n !! @status\n end",
"def response_received?\... | [
"0.7562703",
"0.71092147",
"0.7090517",
"0.7055952",
"0.6656699",
"0.6656699",
"0.65791756",
"0.6459464",
"0.64453536",
"0.64201343",
"0.63938594",
"0.6357915",
"0.6324102",
"0.63155806",
"0.6286529",
"0.62470406",
"0.62134886",
"0.6127917",
"0.6115845",
"0.6079836",
"0.60617... | 0.83357817 | 1 |
Accessors Checks to see if the packet's method is equal to the supplied method. | def method?(method)
return (get_tlv_value(TLV_TYPE_METHOD) == method)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def method?(meth)\n get_method(meth)\n end",
"def method?(name)\n method_name == name.to_sym\n end",
"def method?\n type == TYPE_METHOD\n end",
"def method?\n type == TYPE_METHOD\n end",
"def method_missing(method, *args)\n method = method.to_s\n ... | [
"0.69155854",
"0.64431316",
"0.641461",
"0.641461",
"0.6277275",
"0.62540424",
"0.62319046",
"0.62319046",
"0.62219185",
"0.6196342",
"0.6066746",
"0.59882295",
"0.59676826",
"0.5954562",
"0.5952327",
"0.59304565",
"0.59228283",
"0.58531755",
"0.583721",
"0.5803583",
"0.58011... | 0.7064831 | 1 |
Sets the packet's method TLV to the method supplied. | def method=(method)
add_tlv(TLV_TYPE_METHOD, method, true)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def method=(value)\n @method = value\n end",
"def method=(method)\n if !method.nil? && method.to_s.length > 50\n fail ArgumentError, 'invalid value for \"method\", the character length must be smaller than or equal to 50.'\n end\n\n if !method.nil? && method.to_s.l... | [
"0.67816097",
"0.65247405",
"0.63467485",
"0.63467485",
"0.6029751",
"0.5918826",
"0.59114987",
"0.59114987",
"0.57330585",
"0.5731458",
"0.56493545",
"0.56493545",
"0.5646641",
"0.5646641",
"0.56248724",
"0.56207037",
"0.5620436",
"0.55733067",
"0.5537182",
"0.55149496",
"0.... | 0.7885921 | 1 |
Returns the value of the packet's method TLV. | def method
return get_tlv_value(TLV_TYPE_METHOD)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def method\n @attributes[:method]\n end",
"def method\n @method ||= XmlRpc::API::Message.parse_value(@document.root.elements[\"methodName\"])\n end",
"def method=(method)\n\t\tadd_tlv(TLV_TYPE_METHOD, method, true)\n\tend",
"def method=(method)\n\t\tadd_tlv(TLV_TYPE_METHOD, method, true)\... | [
"0.66449827",
"0.6427894",
"0.62348956",
"0.62348956",
"0.61928266",
"0.6185657",
"0.61612",
"0.6147445",
"0.60788554",
"0.60273",
"0.60273",
"0.59890664",
"0.59378624",
"0.590511",
"0.590511",
"0.58919007",
"0.5833403",
"0.5778146",
"0.573545",
"0.5673272",
"0.56294584",
"... | 0.85062265 | 1 |
Checks to see if the packet's result value is equal to the supplied result. | def result?(result)
return (get_tlv_value(TLV_TYPE_RESULT) == result)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def validate_answer(answer)\n answer == @result\n end",
"def expected_result\n if @assert['result'] == '&result'\n @result\n elsif @assert['result'] != 'void'\n to_hex(@assert['result']['$hex'])\n end\n end",
"def result(answer)\n @answer == answer... | [
"0.6461885",
"0.62522304",
"0.6238519",
"0.6054772",
"0.6046574",
"0.60230297",
"0.6018356",
"0.60050684",
"0.5895863",
"0.5877504",
"0.58765954",
"0.58644533",
"0.58367515",
"0.57947993",
"0.5793753",
"0.57920253",
"0.57537067",
"0.574996",
"0.5731237",
"0.5721371",
"0.57113... | 0.7156735 | 1 |
Sets the packet's result TLV. | def result=(result)
add_tlv(TLV_TYPE_RESULT, result, true)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def result\n\t\treturn get_tlv_value(TLV_TYPE_RESULT)\n\tend",
"def result\n\t\treturn get_tlv_value(TLV_TYPE_RESULT)\n\tend",
"def result=(r)\n\n fields['__result__'] = r\n end",
"def set_result\n raw.data.status_code = raw.statusCode\n raw.data.status_text = raw.statusText\n @result ... | [
"0.6488828",
"0.6488828",
"0.63450575",
"0.6304807",
"0.59019977",
"0.58609015",
"0.5736919",
"0.55704635",
"0.55072874",
"0.5491611",
"0.5491611",
"0.5338689",
"0.52981764",
"0.52925867",
"0.5281694",
"0.52587295",
"0.52587295",
"0.5245461",
"0.5219698",
"0.5218221",
"0.5218... | 0.80659664 | 1 |
Gets the value of the packet's result TLV. | def result
return get_tlv_value(TLV_TYPE_RESULT)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def result\n if not elements[\"result\"].nil?\n r = elements[\"result\"].elements[1]\n if r.nil?\n elements[\"result\"].text\n else\n r\n end\n else\n nil\n end\n end",
"def value(result)\n r... | [
"0.6561463",
"0.6532747",
"0.6441651",
"0.6441651",
"0.63099337",
"0.6220412",
"0.6183481",
"0.61491686",
"0.61491686",
"0.6082777",
"0.6055409",
"0.6023753",
"0.5932441",
"0.5932441",
"0.5871171",
"0.5732631",
"0.5697697",
"0.5693756",
"0.56585586",
"0.56520253",
"0.56520253... | 0.8387234 | 1 |
Gets the value of the packet's request identifier TLV. | def rid
return get_tlv_value(TLV_TYPE_REQUEST_ID)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def request_id\n @error['request_id']\n end",
"def get_request_id\n request_id = ''\n @id_lock.synchronize do\n request_id = @@current_request_id += 1\n end\n request_id\n end",
"def get_request_id\n request_id = ''\n @id_lock.synchronize do\n request_id =... | [
"0.6200948",
"0.61256003",
"0.61256003",
"0.6103415",
"0.5917814",
"0.5907701",
"0.5843926",
"0.57700074",
"0.57154477",
"0.5599692",
"0.5570395",
"0.55416703",
"0.55416703",
"0.5513826",
"0.5486862",
"0.5425236",
"0.5393464",
"0.5386217",
"0.5377741",
"0.53320426",
"0.525821... | 0.73957974 | 1 |
def select_category_from_projects "SELECT category FROM projects;" end Make sure each ruby method returns a string containing a valid SQL statement. | def selects_the_titles_of_all_projects_and_their_pledge_amounts_alphabetized_by_name
"SELECT projects.title, SUM (pledges.amount)
FROM projects
INNER JOIN pledges
ON projects.id = pledges.project_id
GROUP BY title
ORDER BY title ASC;"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def select_category_from_projects\n\"SELECT category FROM projects;\"\nend",
"def selects_the_category_names_and_pledge_amounts_of_all_pledges_in_the_music_category\n\"SELECT projects.category, pledges.amount\nFROM pledges\nINNER JOIN projects\nON projects.id = pledges.project_id\nWHERE projects.category = 'musi... | [
"0.91975725",
"0.70677555",
"0.6991048",
"0.6650848",
"0.6622102",
"0.65142804",
"0.6486619",
"0.6324411",
"0.6060808",
"0.5940286",
"0.5938452",
"0.5936497",
"0.59008545",
"0.5882288",
"0.58708847",
"0.5854367",
"0.5853117",
"0.5840391",
"0.58196145",
"0.57844824",
"0.578232... | 0.53407246 | 75 |
Function to determine the status of a piece of a equipment attached to the booking | def get_item_status(item_id)
status = ""
overdue = true
equipment = Equipment.find_by_id(item_id)
# if a equipment is not in or signed out return the status
if equipment.status > 1
status = Equipment.get_status(equipment.status)
return status
end
# Is the booking recurring?
if self.schedule.nil?
# Not ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def availability\n STATUS_TO_AVAILABILITY[self.status]\n end",
"def is_basic_equipment_status?\n type == 'EquipmentStatus'\n end",
"def status\n return I18n.t('activerecord.attributes.item.building') if rq_prod_point > built_point\n if mob.blank?\n return I18n.t('activerecord.attributes.item... | [
"0.6663784",
"0.66445756",
"0.63720214",
"0.63123393",
"0.6297724",
"0.6172591",
"0.6144509",
"0.60678864",
"0.6031442",
"0.60260904",
"0.6020678",
"0.6020678",
"0.6000286",
"0.5986241",
"0.5950257",
"0.5937592",
"0.5923177",
"0.5901572",
"0.58922786",
"0.58764285",
"0.587618... | 0.6505924 | 2 |
GET /keywords GET /keywords.json | def index
@user_keywords = @login_user.user_keywords.includes(:keyword).group_by{|u_k| u_k.keyword.category}
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def call\n Success(\n JSON.parse(decode(@params['keywords']))\n )\n rescue StandardError\n Failure(\n Response::ApiResult.new(\n status: :bad_request,\n message: 'Keywords not found'\n )\n )\n end",
"def index\n @keywords =... | [
"0.7787767",
"0.74239135",
"0.74185944",
"0.7270267",
"0.7241232",
"0.7170488",
"0.7048936",
"0.7048936",
"0.7048936",
"0.7048936",
"0.7048936",
"0.7048936",
"0.7048936",
"0.68914783",
"0.68455505",
"0.68270147",
"0.6742713",
"0.67107964",
"0.6705525",
"0.6669747",
"0.6668888... | 0.0 | -1 |
POST /keywords POST /keywords.json | def create
Keyword.transaction do
@keyword = Keyword.where(:value => params[:keyword][:value], :category => params[:keyword][:category]).first
if @keyword.blank?
@keyword = Keyword.new(params[:keyword].permit(:value, :category))
@keyword.save
end
if @keyword.user_keywords.wh... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def call\n Success(\n JSON.parse(decode(@params['keywords']))\n )\n rescue StandardError\n Failure(\n Response::ApiResult.new(\n status: :bad_request,\n message: 'Keywords not found'\n )\n )\n end",
"def create_keywords(data=n... | [
"0.70997",
"0.6996516",
"0.6916172",
"0.6916172",
"0.6849703",
"0.6844992",
"0.6826331",
"0.68003076",
"0.66363025",
"0.6631286",
"0.659442",
"0.659442",
"0.65702176",
"0.654342",
"0.6498331",
"0.64907765",
"0.6483866",
"0.6453119",
"0.6372649",
"0.6347654",
"0.6313034",
"0... | 0.5695796 | 64 |
DELETE /keywords/1 DELETE /keywords/1.json | def destroy
UserKeyword.transaction do
begin
@user_keyword = @login_user.user_keywords.find(params[:id])
@keyword = @user_keyword.keyword
@user_keyword.destroy
@keyword.destroy if @keyword.user_keywords.count == 0
rescue ActiveRecord::RecordNotFound
missing
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @keyword = Keyword.find(params[:id])\n @keyword.destroy\n\n respond_to do |format|\n format.html { redirect_to keywords_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @keyword = Keyword.find(params[:id])\n @keyword.destroy\n\n respond_to do |fo... | [
"0.7552868",
"0.74610204",
"0.73675156",
"0.73675156",
"0.73675156",
"0.73675156",
"0.73675156",
"0.73285633",
"0.73285633",
"0.72880286",
"0.72091866",
"0.7166722",
"0.71421427",
"0.686459",
"0.66316104",
"0.6629172",
"0.6543365",
"0.64898705",
"0.6456973",
"0.6388983",
"0.6... | 0.6214952 | 29 |
Log request/response information in common log format to logger. | def _roda_after_90__common_logger(result)
super if result && _common_log_request?(result)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def log(request, response)\n time = Time.new.strftime(\"%Y-%m-%d %H-%M-%S\")\n http_request = \"#{request.http_method} #{request.uri}\"\n http_response = \"#{response.code}\"\n @log_file.puts \"#{++@log_no} -- [#{time}] #{http_request} #{http_response}\"\n end",
"def log_request\n logge... | [
"0.7614704",
"0.73613125",
"0.7317517",
"0.73113173",
"0.72239053",
"0.7180419",
"0.71608245",
"0.7125867",
"0.68964547",
"0.68443376",
"0.68349683",
"0.67651093",
"0.67422485",
"0.66206527",
"0.6585409",
"0.6527793",
"0.64848816",
"0.6470006",
"0.646892",
"0.63984",
"0.63733... | 0.5973035 | 41 |
TODO [11/9/10 12:18 AM] => VALIDATIONS ADD_VALIDATIONS_FOR_DOCUMENTS ADD_VALIDATIONS_FOR_SECTION_AND_ITEM_TEMPLATE_IF_NECESSARY def Item.all_active Item.find_all_by_is_active(true) end | def update_completed_count
self.section.update_completed_count
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fetch_all_active_items\n @items.values.select{|item| item.active}\n end",
"def get_active_items\r\n self.items.select { |i| i.active? } #TODO only fixed or only auction\r\n end",
"def get_active_items\n self.items.select { |i| i.active? } #TODO only fixed or only auction\n ... | [
"0.8136205",
"0.76644063",
"0.75894743",
"0.7191235",
"0.7152048",
"0.6791746",
"0.6701609",
"0.66791606",
"0.66791606",
"0.6678782",
"0.6300499",
"0.6263089",
"0.6246039",
"0.6228809",
"0.61847275",
"0.61354446",
"0.6099375",
"0.6056984",
"0.60555136",
"0.6044676",
"0.603498... | 0.0 | -1 |
update_attributes should be used, but it isn't working perfectly for some weired reason :( | def mark_as_complete(options)
self.is_complete = options[:is_complete]
self.is_applicable = true # if item.is_complete
self.save_with_validation(false)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_attributes!(args = {})\n assign_attributes(args)\n save!\n end",
"def update(...)\n assign_attributes(...)\n save\n end",
"def update_attributes!(attributes)\n assign_attributes attributes\n save!\n end",
"def update_attributes(args = {})\n ... | [
"0.7645054",
"0.7633404",
"0.73756105",
"0.7366844",
"0.73351717",
"0.7297924",
"0.71421564",
"0.71411645",
"0.71272355",
"0.7118093",
"0.7118093",
"0.7118093",
"0.7118093",
"0.7071239",
"0.70699656",
"0.7041255",
"0.70398355",
"0.69911385",
"0.6910913",
"0.69062734",
"0.6859... | 0.0 | -1 |
Set some defaults when the task lib is set up. | def setup( _name, **options )
super if defined?( super )
self.extensions.include( Rake::DevEiate::EXT_DIR + EXTENSION_GLOB_PATTERN )
@disable_rake_compiler = false
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_defaults\n self.help ||= ENV['help_text']\n self.help_url ||= ENV['help_url']\n self.created_at ||= DateTime.current\n end",
"def define_default_tasks\n\n\t\t# task used to indicate that rake-deveiate has already been setup once; for\n\t\t# global rakefiles.\n\t\ttask :deveiate do\n\t\t\t# no-o... | [
"0.70905405",
"0.69210917",
"0.68945366",
"0.68945366",
"0.6879856",
"0.6806768",
"0.6771333",
"0.6771333",
"0.6771333",
"0.6771333",
"0.6771333",
"0.6771333",
"0.67461807",
"0.66423833",
"0.6638912",
"0.6575797",
"0.65376776",
"0.6518301",
"0.65101755",
"0.650838",
"0.649368... | 0.0 | -1 |
Predicate for the disable_rake_compiler attribute. | def disable_rake_compiler?
return self.disable_rake_compiler ? true :false
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def has_rakecompiler_dependency?\n\t\treturn self.dependencies.any? do |dep|\n\t\t\tdep.name == 'rake-compiler'\n\t\tend\n\tend",
"def agent_should_start?\n !blacklisted_constants? &&\n !blacklisted_executables? &&\n !in_blacklisted_rake_task?\n end",
"def auto_exclude?\n ... | [
"0.6383474",
"0.55502146",
"0.54244685",
"0.5416403",
"0.5401313",
"0.5360261",
"0.5332903",
"0.53170156",
"0.53077435",
"0.522613",
"0.5174628",
"0.51405907",
"0.51320493",
"0.5130798",
"0.5088376",
"0.5084573",
"0.5083059",
"0.50676864",
"0.5049461",
"0.50479543",
"0.504359... | 0.8187891 | 0 |
Returns +true+ if there appear to be extensions as part of the current project. | def extensions_present?
return !self.extensions.empty?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def appearable_extensions?\n exs = @extensions.keys - APPEARABLE_CH_EXTENSIONS\n return true if exs.empty?\n\n !(exs - DEFINED_EXTENSIONS).empty?\n end",
"def missing_extensions?\n return false if extensions.empty?\n return false if default_gem?\n return false if File.exist? ge... | [
"0.7635198",
"0.75941896",
"0.74812496",
"0.73279864",
"0.73279864",
"0.7179598",
"0.70683795",
"0.70683795",
"0.7045263",
"0.70179784",
"0.6989766",
"0.6984739",
"0.6984739",
"0.6905511",
"0.67384905",
"0.6601999",
"0.6594085",
"0.6456295",
"0.6452495",
"0.6432571",
"0.64325... | 0.77635753 | 0 |
Set up the tasks to build extensions. | def define_extension_tasks
ENV['RUBY_CC_VERSION'] ||= RUBY_VERSION[ /(\d+\.\d+)/ ]
require 'rake/extensiontask'
self.extensions.each do |extconf|
Rake::ExtensionTask.new( extconf.pathmap('%{ext/,}d') )
end
task :spec => :compile
task :maint do
ENV['V'] = '1'
ENV['MAINTAINER_MODE'] = 'yes'
end
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def define_tasks\r\n define_clobber_task\r\n define_build_task\r\n end",
"def define_compiler_tasks\n require \"rake/extensiontask\"\n\n @extensions.each do |name|\n clean_globs << \"lib/#{name}/*.{so,bundle,dll}\"\n\n Rake::ExtensionTask.new name, spec do |ext|\n ext.lib_dir ... | [
"0.71884984",
"0.7062708",
"0.70167685",
"0.6988959",
"0.6921596",
"0.6753971",
"0.6698098",
"0.66938114",
"0.6672065",
"0.6625058",
"0.66134447",
"0.65917397",
"0.6524384",
"0.64845943",
"0.6466148",
"0.6444607",
"0.63418984",
"0.63400584",
"0.62423944",
"0.6240044",
"0.6226... | 0.78485155 | 0 |
Returns +true+ if the projects dependencies include `rakecompiler`. | def has_rakecompiler_dependency?
return self.dependencies.any? do |dep|
dep.name == 'rake-compiler'
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def disable_rake_compiler?\n\t\treturn self.disable_rake_compiler ? true :false\n\tend",
"def has_dependencies?\n update_for.length > 0 or requires.length > 0\n end",
"def is_rake\n\tFile.basename($0) == 'rake'\nend",
"def activate_compiler_deps\n dependency \"rake-compiler\", \"~> 1.0\", :development... | [
"0.7176959",
"0.6499878",
"0.6452307",
"0.6440881",
"0.6309507",
"0.62916625",
"0.62530977",
"0.61711013",
"0.6141234",
"0.6139968",
"0.6090912",
"0.6054291",
"0.60233134",
"0.5975129",
"0.5960222",
"0.59555286",
"0.595487",
"0.59412783",
"0.59394854",
"0.5927395",
"0.592355"... | 0.8673069 | 0 |
Task function output debugging for extension tasks. | def do_extensions_debug( task, args )
self.prompt.say( "Extension config scripts:", color: :bright_green )
if self.extensions.empty?
self.prompt.say "None."
else
self.extensions.uniq.each do |path|
self.prompt.say "- %s" % [ path ]
end
end
if self.has_rakecompiler_dependency?
self.prompt.say... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def print_task(task)\n print \"==> \".info, task.bold, \"\\n\"\nend",
"def print_task_info(task:)\n path = task.files.first['path'].chomp(\"/tasks/#{task.files.first['name']}\")\n module_dir = if path.start_with?(Bolt::Config::Modulepath::MODULES_PATH)\n \"built-in module\"\n... | [
"0.6818291",
"0.67156774",
"0.66474164",
"0.6489559",
"0.6489559",
"0.6489559",
"0.6489559",
"0.6459194",
"0.6370725",
"0.6303394",
"0.6285485",
"0.6280167",
"0.61767304",
"0.61711234",
"0.613699",
"0.60860735",
"0.6062757",
"0.6056759",
"0.60391605",
"0.6021989",
"0.6021989"... | 0.7081757 | 0 |
Receives a view and update it accordingly with the given object id and the association cardinality. | def update(view, object)
raise NotImplementedError
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def UpdateView params = {}\n \n APICall(path: 'views.json',method: 'PUT',payload: params.to_json)\n \n end",
"def record_view\n self.views += 1\n save\n end",
"def hit!\n raise ActiveRecord::MissingAttributeError, \"can't hit! #{ self.short_inspect }, missing attribute: vi... | [
"0.5944343",
"0.58926123",
"0.58195937",
"0.57695425",
"0.5719503",
"0.5638591",
"0.5634786",
"0.5610564",
"0.55988353",
"0.5581667",
"0.5581667",
"0.5581667",
"0.55463135",
"0.5542066",
"0.55208164",
"0.55062175",
"0.54996866",
"0.54605067",
"0.54462576",
"0.54462576",
"0.53... | 0.6959323 | 0 |
Includes this module into a Class, and changes all public methods to protected. Examples: module MyCoolUtils def some_meth "hi" end self.include_safely_into(FooController) end or: MyCoolUtils.include_safely_into(FooController, SomeOtherClass) | def include_safely_into(*args)
[args].flatten.each do |a|
if a.is_a?(String) || a.is_a?(Symbol)
a = a.to_s.constantize
end
a.send(:include, self.convert_security_of_methods)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def inherited(klass)\n super\n klass.send :include, ::Henshin::Safety\n klass.instance_variable_set(:@unsafe_methods, @unsafe_methods)\n end",
"def included(other)\n class <<other\n include ClassMethods\n end\nend",
"def extend_class(class_, module_)\n class_.class_eval do\n... | [
"0.5964037",
"0.5789869",
"0.5714196",
"0.55760556",
"0.54506856",
"0.5437987",
"0.5415791",
"0.5403711",
"0.53042275",
"0.5301927",
"0.5301927",
"0.5301927",
"0.5301927",
"0.5301461",
"0.5268169",
"0.5256856",
"0.5197367",
"0.51913303",
"0.5171968",
"0.5105985",
"0.5105985",... | 0.5939363 | 1 |
Override with your own usage banner. | def banner
"Usage: #{$0} my_controller controller"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def usage; end",
"def usage; end",
"def banner\n \"#{basename} #{self_command.formatted_usage(self, false)}\"\n end",
"def display_usage\n end",
"def print_usage; end",
"def banner\n unless @banner\n @banner = +\"Usage: #{program_name} [options]\"\n visit(:add_banner, @banner)\n ... | [
"0.77102196",
"0.77102196",
"0.7697215",
"0.758689",
"0.7539001",
"0.7450375",
"0.7229269",
"0.71680474",
"0.7024788",
"0.70237845",
"0.6986238",
"0.69539636",
"0.68358403",
"0.67964435",
"0.67648196",
"0.6731819",
"0.6729866",
"0.6591336",
"0.658199",
"0.65733933",
"0.654696... | 0.64513123 | 28 |
only contain 4 elements and be in the form (x y) where x and y are both integers, and return the area of the rectangle formed by the 4 points on a Cartesian grid. The 4 elements will be in arbitrary order. For example: if strArr is ["(0 0)", "(3 0)", "(0 2)", "(3 2)"] then your program should return 6 because the width... | def RectangleArea(strArr)
# code goes here
return strArr
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def rectangle_area(str_arr)\n str_arr = str_arr.sort.map do |co_ord|\n co_ord.delete('()').split.map(&:to_i)\n end\n width = str_arr[2][0] - str_arr[0][0]\n height = str_arr[1][1] - str_arr[0][1]\n width * height\nend",
"def RectangleArea(strArr)\n pool = strArr.join.scan(/(-?[0-9]+)/).flatten.map{|i|i.... | [
"0.77164143",
"0.7568225",
"0.670488",
"0.63067716",
"0.62193173",
"0.6018003",
"0.591587",
"0.59056187",
"0.5904961",
"0.5836517",
"0.5782233",
"0.5743191",
"0.5674866",
"0.5671332",
"0.5616109",
"0.5564751",
"0.5564439",
"0.5563994",
"0.5545396",
"0.55370104",
"0.553384",
... | 0.6193472 | 5 |
=end def self.create_with_omniauth(auth) create! do |user| user.provider = auth["provider"] user.uid = auth["uid"] user.name = auth["info"]["name"] end end private def generate_authentication_token! begin self.auth_token = Devise.friendly_token end while self.class.exists?(auth_token: auth_token) end | def admin?
self.role == 53
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def generate_authentication_token!\n begin\n self.auth_token = Devise.friendly_token\n end while self.class.exists?(auth_token: auth_token)\n end",
"def generate_authentication_token!\n begin\n self.auth_token = Devise.friendly_token\n end while self.class.exists?(auth_token: auth_token)\n... | [
"0.7944953",
"0.7944953",
"0.7944953",
"0.7944953",
"0.7916079",
"0.7912612",
"0.7912612",
"0.7891473",
"0.7885886",
"0.78756183",
"0.78655016",
"0.7824129",
"0.76585925",
"0.76384014",
"0.7603551",
"0.7575889",
"0.7527779",
"0.7495971",
"0.7456773",
"0.7430941",
"0.7403918",... | 0.0 | -1 |
this allows you to have a gemwide layout | def index
@translations = TRANSLATION_STORE
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def layouts; end",
"def layouts; end",
"def layout; end",
"def set_layout\n if 1==1\n 'application'\n else\n 'dean'\n end\n end",
"def place_in_layout?; end",
"def place_in_layout?; end",
"def layout\n lookup_layout\n end",
"def determine_layout\n 'akinu'\n end",
... | [
"0.7322657",
"0.7322657",
"0.72663337",
"0.69341785",
"0.6756317",
"0.6756317",
"0.6700033",
"0.6642863",
"0.66199946",
"0.66178036",
"0.6592611",
"0.6592611",
"0.65076905",
"0.6495358",
"0.64934576",
"0.6459209",
"0.6453792",
"0.64510304",
"0.6444389",
"0.64278203",
"0.63888... | 0.0 | -1 |
Sort by the follow list first and then based on score | def newsfeed
posts = @@posts.map { |_, v| v }
posts.sort do |a, b|
if @follows[a.username] && !@follows[b.username]
-1
elsif !@follows[a.username] && @follows[b.username]
1
else
a <=> b
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sort_using_rank\n score[1]\n end",
"def sort\n @hits = all.sort {|x,y| y.score <=> x.score }\n end",
"def sorted_results(unsorted)\n scores = []\n sorted = []\n\n unsorted.group_by(&:itself).each_pair do |result, results|\n relevance = result_relevance(result, results.length)\... | [
"0.7518348",
"0.73827475",
"0.67644227",
"0.6711024",
"0.66596",
"0.66506",
"0.66304684",
"0.6618273",
"0.66063637",
"0.6534374",
"0.6513551",
"0.64678913",
"0.6459505",
"0.64507",
"0.64472705",
"0.6446873",
"0.64281577",
"0.64167196",
"0.6407793",
"0.64047974",
"0.6399341",
... | 0.0 | -1 |
... and delegate "everything else" via method_missing, taking care that a nil card template isn't a problem | def method_missing(name, *args, &block)
respond_to_missing?(name) ? card_template.andand.send(name, *args, &block) : super
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def method_missing(method, *args, &block)\n if @card.respond_to?(method)\n @card.send(method, *args, &block)\n else\n super\n end\n end",
"def default_card\n # noop\n end",
"def get_card\n end",
"def get_card_data method\n get_card.send(method) ... | [
"0.7059851",
"0.65993464",
"0.6114283",
"0.59664536",
"0.5779522",
"0.5779522",
"0.5755772",
"0.57497287",
"0.5702806",
"0.5657755",
"0.56481373",
"0.5642659",
"0.56303084",
"0.56303084",
"0.56303084",
"0.56303084",
"0.5611988",
"0.5561731",
"0.5558175",
"0.5558175",
"0.55070... | 0.78657037 | 0 |
requires login for new and create actions only+ | def new
# render login page
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n #user wants to log in \n end",
"def new\n #user wants to log in \n end",
"def new\n # If someone is already logged in, skip this step\n login(current_user) and return if logged_in?\n end",
"def create?\n #everyone who is loggedin can do this action\n true\n end",
"def new #l... | [
"0.7438733",
"0.7438733",
"0.7344537",
"0.728793",
"0.71829647",
"0.70024157",
"0.69352365",
"0.6924324",
"0.68553334",
"0.6844659",
"0.6827712",
"0.6824782",
"0.6806438",
"0.6767501",
"0.6767501",
"0.6767501",
"0.6767501",
"0.6767501",
"0.6767501",
"0.6767501",
"0.6767501",
... | 0.68266046 | 11 |
Use callbacks to share common setup or constraints between actions. | def set_repository
@repository = @user.owned_repositories.find_by_slug!(params[:repository_id])
raise ActiveRecord::RecordNotFound unless @repository.has_issues?
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 |
POST /accounts POST /accounts.json POST /accounts.xml | def create
@account = Account.new(params[:account])
respond_to do |format|
if @account.save
#format.html { redirect_to(@account, :notice => 'Account was successfully created.') }
format.json { render :json => @account, :status => :created, :location => @account }
format.xml { re... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n megam_rest.post_accounts(to_hash)\n end",
"def post_accounts(json_hash)\n @options = {:path => '/users.json',\n :body => json_hash[:json]}.merge(@options)\n\n request(\n :expects => 201,\n :method => :post,\n :body => @options[:body]\n )\n ... | [
"0.71102715",
"0.6868741",
"0.6684269",
"0.6524815",
"0.6496906",
"0.64758265",
"0.6316858",
"0.62342477",
"0.6197244",
"0.6140472",
"0.6137",
"0.61312675",
"0.61183816",
"0.6117599",
"0.6101864",
"0.60753256",
"0.60753256",
"0.60753256",
"0.60753256",
"0.60753256",
"0.607532... | 0.6160803 | 9 |
PUT /accounts/1 PUT /accounts/1.json PUT /accounts/1.xml | def update
@account = Account.find(params[:id])
respond_to do |format|
if @account.update_attributes(params[:account])
format.html { redirect_to(@account, :notice => 'Account was successfully updated.') }
#format.xml { head :ok }
format.json { render :json => @account }
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update \n begin\n @resource = Account.find(params[:id])\n @resource.update_attributes!(params[:account])\n render :response => :PUT\n rescue Exception => e\n @error = process_exception(e)\n render :response => :error\n end\n end",
"def update\n @account = Account.find... | [
"0.6582911",
"0.62882286",
"0.6170285",
"0.6144252",
"0.61401206",
"0.6111649",
"0.60994047",
"0.6091328",
"0.6059104",
"0.6051299",
"0.6023935",
"0.5987549",
"0.5971014",
"0.59697706",
"0.5955359",
"0.5952719",
"0.5938624",
"0.59378016",
"0.5932825",
"0.59210664",
"0.5893963... | 0.6237412 | 2 |
By this point, we assume ScheduleMergeRequestDiffMigrations the first version of this has already run. On GitLab.com, we have ~220k unmigrated rows, but these rows will, in general, take a long time. With a gap of 10 minutes per batch, and 500 rows per batch, these migrations are scheduled over 220_000 / 500 / 6 ~= 74 ... | def up
queue_background_migration_jobs_by_range_at_intervals(MergeRequestDiff, MIGRATION, DELAY_INTERVAL, batch_size: BATCH_SIZE)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def up\n Build.where(stage_id: nil).each_batch(of: BATCH_SIZE) do |relation, index|\n relation.each_batch(of: RANGE_SIZE) do |relation|\n range = relation.pluck('MIN(id)', 'MAX(id)').first\n\n BackgroundMigrationWorker\n .perform_in(index * 2.minutes, MIGRATION, range)\n end\n ... | [
"0.6388077",
"0.5842477",
"0.5773407",
"0.56487805",
"0.54802555",
"0.547335",
"0.54634887",
"0.53449374",
"0.5319112",
"0.52696264",
"0.5211735",
"0.515682",
"0.5112737",
"0.5086521",
"0.50740397",
"0.5068204",
"0.50645584",
"0.5062173",
"0.5035551",
"0.5032376",
"0.503051",... | 0.6655419 | 0 |
search_text is found within the full_text. Usage example: solution('aa_bb_cc_dd_bb_e', 'bb') should return 2 since bb shows up twice solution('aaabbbcccc', 'bbb') should return 1 =begin Input: Output: Data types: Algorithm: =end | def substr(str)
arr = []
0.upto(str.size - 1) do |idx1|
idx1.upto(str.size - 1) do |idx2|
arr << str[idx1..idx2]
end
end
arr
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def search_substr( fullText, searchText, allowOverlap = true )\n if searchText == ''\n 0\n else\n fullText.scan(allowOverlap ? Regexp.new(\"(?=(#{searchText}))\") : searchText).size\n end\nend",
"def fulltextsearch(query, text, words=2)\n result = \"\"\n if text =~ /.*#{query}.*/i\n tex... | [
"0.641207",
"0.6186786",
"0.6085298",
"0.5994506",
"0.5994298",
"0.5979353",
"0.59656686",
"0.5902823",
"0.5877119",
"0.5868725",
"0.5821212",
"0.5814449",
"0.5771998",
"0.5771998",
"0.57702315",
"0.5757451",
"0.575182",
"0.5749668",
"0.5718444",
"0.57113755",
"0.5709403",
... | 0.0 | -1 |
get all user's responses | def userReponses
user=User.find(params[:userId])
render :json=> user.response
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @user_responses = UserResponse.all\n end",
"def responses\n @responses\n end",
"def all_users\n all_users = User.all\n @api_response[:code] = @response_codes[:success]\n @api_response[:result] = all_users\n rescue Exception => e\n @errors, @api_response = api_exceptio... | [
"0.7613305",
"0.70175827",
"0.7017241",
"0.6954248",
"0.6937111",
"0.6867089",
"0.6733598",
"0.6733598",
"0.6733598",
"0.6733598",
"0.6733598",
"0.66834754",
"0.66497314",
"0.66495097",
"0.6509322",
"0.6469114",
"0.64436543",
"0.6442597",
"0.6400458",
"0.63912696",
"0.6374723... | 0.59532887 | 51 |
get all responses that belongs to a qeustion | def responses
question=Question.find(params[:questionId])
render :json=> question.response
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def responses\n object.questions.map do |q|\n Embedded::ResponseSerializer.new(q.filtered_responses.first,root: false)\n end\n end",
"def answers\n extracted_answers = []\n\n unless self.qp_values.nil?\n self.qp_values.each do |answer| \n extracted_answers.push(ResponseAns... | [
"0.6753169",
"0.63133025",
"0.6192644",
"0.61607665",
"0.6005587",
"0.5984561",
"0.59360796",
"0.5927058",
"0.5915947",
"0.58813715",
"0.5841246",
"0.58410424",
"0.5832909",
"0.5832909",
"0.5826983",
"0.5824624",
"0.5822528",
"0.58136135",
"0.5797115",
"0.5780034",
"0.5742842... | 0.5933696 | 7 |
Creates a new BlockArgs object | def initialize
@block_args = []
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initialize args\n hash_make args, BlockState::ARG_SPECS\n end",
"def initialize args = {}\n hash_make args, Block::ARG_SPECS\n @initial_params = collect_params\n end",
"def new_block_el(*args); end",
"def new_block_el(*args)\n el = Element.new(*args)\n if @block_ial\n el... | [
"0.7048354",
"0.66508985",
"0.651996",
"0.6477823",
"0.6382113",
"0.63376254",
"0.60286266",
"0.6026347",
"0.58338714",
"0.57980645",
"0.57770985",
"0.5766437",
"0.5714325",
"0.5669368",
"0.5618859",
"0.5612283",
"0.56080014",
"0.55175626",
"0.55001444",
"0.54964507",
"0.5496... | 0.6632462 | 2 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.