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 |
|---|---|---|---|---|---|---|
When we create a new queue, `Bunny` stores its name in an internal cache. The problem is that as we are creating ephemeral queues that can expire shortly after they are created, this cached queue may not exist anymore when we try to publish a second message to it. Removing queues from the cache guarantees that `Bunny` ... | def clear_queues_cache
channel.queues.clear
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def mock_queue(name=nil)\n MockQueue.new(name || \"anonymous-#{rand(2**32).to_s(16)}\")\n end",
"def add_queue(queue_name)\n queue = MockQueue.new(queue_name)\n data[queue_name] = queue\n queue\n end",
"def create_queues\n queue\n exchange\n end",
"def q... | [
"0.667098",
"0.6658198",
"0.6642623",
"0.6627603",
"0.64918566",
"0.6433362",
"0.64322084",
"0.6377304",
"0.6339483",
"0.6332589",
"0.62552035",
"0.6230091",
"0.6223305",
"0.62216413",
"0.6215756",
"0.6200129",
"0.6195308",
"0.6161967",
"0.6149455",
"0.61124164",
"0.6111615",... | 0.6372564 | 8 |
Write a method doubler(numbers) that takes an array of numbers The method will return a new array where every element of the original array is multiplied by 2. | def doubler(numbers)
# Write your code here
array=[]
numbers.each do |num|
array << num *= 2
end
array
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def doubler(numbers)\n i = 0\n while i < numbers.length\n numbers[i] = numbers[i] * 2\n i += 1\n end\n return numbers\nend",
"def doubler(numbers)\n\tfor i in 0..numbers.length-1\n numbers[i] = numbers[i] * 2\n end\n return numbers\nend",
"def doubler(numbers)\n\ti = 0\... | [
"0.86299485",
"0.86072916",
"0.85767555",
"0.85320723",
"0.84275866",
"0.8372944",
"0.8372944",
"0.83449316",
"0.83305395",
"0.82761705",
"0.82723224",
"0.8245112",
"0.81862205",
"0.8135845",
"0.7993511",
"0.79741967",
"0.79596996",
"0.79131794",
"0.7887194",
"0.7876727",
"0.... | 0.8125462 | 14 |
Use callbacks to share common setup or constraints between actions. | def set_raffle
@raffle = Raffle.find(params[:id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_... | [
"0.6163163",
"0.6045976",
"0.5946146",
"0.591683",
"0.5890051",
"0.58349305",
"0.5776858",
"0.5703237",
"0.5703237",
"0.5652805",
"0.5621621",
"0.54210985",
"0.5411113",
"0.5411113",
"0.5411113",
"0.5391541",
"0.53794575",
"0.5357573",
"0.53402257",
"0.53394014",
"0.53321576"... | 0.0 | -1 |
Only allow a trusted parameter "white list" through. | def raffle_params
params.require(:raffle).permit(:title, :description, :starts_at, :ends_at)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def allowed_params\n ALLOWED_PARAMS\n end",
"def expected_permitted_parameter_names; end",
"def param_whitelist\n [:role, :title]\n end",
"def default_param_whitelist\n [\"mode\"]\n end",
"def permitir_parametros\n \t\tparams.permit!\n \tend",
"def permitted_params\n []\n end",
... | [
"0.7121987",
"0.70541996",
"0.69483954",
"0.6902367",
"0.6733912",
"0.6717838",
"0.6687021",
"0.6676254",
"0.66612333",
"0.6555296",
"0.6527056",
"0.6456324",
"0.6450841",
"0.6450127",
"0.6447226",
"0.6434961",
"0.64121825",
"0.64121825",
"0.63913447",
"0.63804525",
"0.638045... | 0.0 | -1 |
finding instrument user clicked on and creating inctance of booking for form | def show
@instrument = Instrument.find(params[:id])
@booking = Booking.new
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @booking = @instrument.bookings.new(booking_params)\n @booking.user = current_user\n respond_to do |format|\n if @booking.save\n format.html { redirect_to @booking, notice: t('.success') }\n format.json { render :show, status: :created, location: @booking }\n else\n ... | [
"0.590109",
"0.58447176",
"0.57752013",
"0.5624643",
"0.5611555",
"0.55997604",
"0.55992717",
"0.55907995",
"0.5579643",
"0.5565253",
"0.55044836",
"0.55027217",
"0.5495404",
"0.5493622",
"0.54798585",
"0.5456145",
"0.5451069",
"0.5450739",
"0.5447786",
"0.5441641",
"0.543879... | 0.5966437 | 0 |
creating new instance of instrument for instrument creation form | def new
@instrument = Instrument.new
@category = ["bowed strings", "wood wind", "brass", "percussions", "keyboard" , "guitar family"]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @instrument = Instrument.new(instrument_params)\n \n respond_to do |format|\n if @instrument.save\n format.html { redirect_to @instrument, notice: t('.success') }\n format.json { render :show, status: :created, location: @instrument }\n else\n format.html { rend... | [
"0.74290264",
"0.73726946",
"0.7213497",
"0.72132087",
"0.7120137",
"0.6671315",
"0.6671315",
"0.66683656",
"0.6622714",
"0.65950817",
"0.65950817",
"0.65950817",
"0.65950817",
"0.65950817",
"0.65288204",
"0.6506303",
"0.6475359",
"0.64551514",
"0.6449361",
"0.6358469",
"0.63... | 0.68658847 | 5 |
now actually creating the new instrument with user params and saving it rendering new page if user did not input all params | def create
@instrument = Instrument.new(instrument_params)
@instrument.user = current_user
if @instrument.save
redirect_to instrument_path(@instrument), notice: 'Created new instrument.'
else
render :new
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n p \"*******INST CREATE*********\"\n user = User.find_by(id: session[:user_id])\n instrument = user.instruments.build(instrument_params)\n if instrument.save\n render json: instrument, status: :created\n else\n render json: {error: \"Not Created\"}, status: :not_created\n en... | [
"0.6965199",
"0.6878428",
"0.6794587",
"0.6776414",
"0.6501877",
"0.64043325",
"0.639236",
"0.6371121",
"0.6355526",
"0.6307005",
"0.6291374",
"0.6257015",
"0.6242751",
"0.6237534",
"0.6237511",
"0.6214765",
"0.62130183",
"0.6210843",
"0.6204317",
"0.6187289",
"0.61665154",
... | 0.6991258 | 0 |
finding instrument to destroy destroying the instrument redirecting to root_path | def destroy
@instrument = Instrument.find(params[:id])
@instrument.destroy
redirect_to root_path
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n log_out\n redirected_to root_url\n end",
"def destroy\n @instrument = Instrument.find(params[:id])\n @instrument.destroy\n\n respond_to do |format|\n format.html { redirect_to(instruments_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n log_out if logged_... | [
"0.66026914",
"0.6579177",
"0.65782744",
"0.63811505",
"0.6361402",
"0.6350783",
"0.6333396",
"0.6294609",
"0.6234069",
"0.62336135",
"0.6205419",
"0.6205419",
"0.61742634",
"0.61619437",
"0.61619437",
"0.61340487",
"0.6130461",
"0.6129906",
"0.6086645",
"0.6060793",
"0.60301... | 0.6830277 | 0 |
finding instrument to update updating instrument with user_params redirecting to instrument_path | def update
@instrument = Instrument.find(params[:id])
@instrument.update(instrument_params)
redirect_to instrument_path(@instrument)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @instrument = Instrument.find(params[:id])\n @person = @instrument.person\n @participant = @person.participant\n\n respond_to do |format|\n if @instrument.update_attributes(params[:instrument])\n\n redirect_path = @participant ? participant_path(@participant) : person_... | [
"0.69305575",
"0.69022447",
"0.68359554",
"0.6640227",
"0.6536821",
"0.6509439",
"0.6470895",
"0.6465339",
"0.6367576",
"0.6351798",
"0.6343359",
"0.63422906",
"0.63205796",
"0.630853",
"0.6302393",
"0.62972105",
"0.6296563",
"0.62776315",
"0.62370056",
"0.62232256",
"0.62066... | 0.7233495 | 0 |
whitelisting instrument params for input | def instrument_params
params.require(:instrument).permit(:name, :category, :description, :photo)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def filtered_parameters; end",
"def filter_parameters; end",
"def filter_parameters; end",
"def instrument_params\n params.require(:instrument).permit(:name)\n end",
"def instrument_params\n params.require(:instrument).permit(:name)\n end",
"def ignore_parameter(key)\n ignore_params[ke... | [
"0.6530378",
"0.648588",
"0.648588",
"0.6359304",
"0.6359304",
"0.6222486",
"0.61704934",
"0.60890114",
"0.60890114",
"0.60837376",
"0.6069426",
"0.6008625",
"0.59424895",
"0.592663",
"0.589303",
"0.5889139",
"0.5888235",
"0.58807015",
"0.58302355",
"0.5807628",
"0.5768226",
... | 0.5686558 | 27 |
This should return the minimal set of attributes required to create a valid Score. As you add validations to Score, be sure to update the return value of this method accordingly. | def valid_attributes
{ }
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def valid_attributes\n {\n name: \"Unlimited\",\n award_title_name: \"10k Unlimited\",\n scoring_class: \"Freestyle\"\n }\n end",
"def valid_attributes\n {\n standard_skill_score_entries_attributes: [\n FactoryBot.attributes_for(:standard_skill_score_entry, standard_skill_rou... | [
"0.6666884",
"0.6378554",
"0.5905087",
"0.5807429",
"0.5743964",
"0.5692576",
"0.5688275",
"0.5549835",
"0.5516674",
"0.5452958",
"0.54527175",
"0.5450464",
"0.54452527",
"0.5442482",
"0.5439364",
"0.5433813",
"0.5430439",
"0.5414338",
"0.5414338",
"0.5414338",
"0.5414338",
... | 0.52040637 | 51 |
Show invalid properties with the reasons. Usually used together with valid? | def list_invalid_properties
invalid_properties = Array.new
if @plan.nil?
invalid_properties.push("invalid value for 'plan', plan cannot be nil.")
end
if !@amount.nil? && @amount < 0
invalid_properties.push("invalid value for 'amount', must be greater than or equal to 0.")
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def list_invalid_properties\n invalid_properties = super\n if @class_id.nil?\n invalid_properties.push('invalid value for \"class_id\", class_id cannot be nil.')\n end\n\n if @object_type.nil?\n invalid_properties.push('invalid value for \"object_type\", object_type cannot be nil.... | [
"0.76497203",
"0.76497203",
"0.76497203",
"0.76497203",
"0.7637422",
"0.7637422",
"0.7637422",
"0.7637422",
"0.7637422",
"0.7637422",
"0.7637422",
"0.7637422",
"0.7356452",
"0.7334807",
"0.72685325",
"0.7238964",
"0.7231359",
"0.72258264",
"0.7208294",
"0.71760833",
"0.717024... | 0.0 | -1 |
Check to see if the all the properties in the model are valid | def valid?
return false if @plan.nil?
return false if !@amount.nil? && @amount < 0
return false if !@quantity.nil? && @quantity < 1
return false if !@plan_version.nil? && @plan_version < 1
return false if !@grace_duration.nil? && @grace_duration < 0
return false if @signup_method.nil... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def validate_properties\n true\n end",
"def validate_properties\n true\n end",
"def validate\n super\n\n check_optional_property :collection, String\n check_optional_property :create, String\n check_optional_property :delete, String\n check_optional_property :... | [
"0.7898049",
"0.7898049",
"0.7097583",
"0.7078707",
"0.7033638",
"0.70323414",
"0.6950563",
"0.68693584",
"0.68592983",
"0.68592983",
"0.68299854",
"0.68259233",
"0.6819868",
"0.6813614",
"0.67961836",
"0.67519176",
"0.6685518",
"0.6678095",
"0.6667411",
"0.66312236",
"0.6618... | 0.0 | -1 |
Custom attribute writer method with validation | def amount=(amount)
if !amount.nil? && amount < 0
fail ArgumentError, "invalid value for 'amount', must be greater than or equal to 0."
end
@amount = amount
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def attr_writer_tag(text); end",
"def allowed_attributes=(_arg0); end",
"def allowed_attributes=(_arg0); end",
"def writer(*args)\n attr_writer(*args)\n args\n end",
"def define_write_method(attr_name)\n evaluate_attribute_method attr_name, \"def #{attr_name}=(new_value);write_attribute('#{at... | [
"0.6472992",
"0.6315012",
"0.6315012",
"0.62821025",
"0.6279224",
"0.6211609",
"0.61891466",
"0.6182247",
"0.60683644",
"0.6032628",
"0.5995443",
"0.5988785",
"0.5959885",
"0.5938289",
"0.5931089",
"0.58951056",
"0.5859927",
"0.5851703",
"0.58493423",
"0.58465594",
"0.5832836... | 0.0 | -1 |
Custom attribute writer method with validation | def quantity=(quantity)
if !quantity.nil? && quantity < 1
fail ArgumentError, "invalid value for 'quantity', must be greater than or equal to 1."
end
@quantity = quantity
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def attr_writer_tag(text); end",
"def allowed_attributes=(_arg0); end",
"def allowed_attributes=(_arg0); end",
"def writer(*args)\n attr_writer(*args)\n args\n end",
"def define_write_method(attr_name)\n evaluate_attribute_method attr_name, \"def #{attr_name}=(new_value);write_attribute('#{at... | [
"0.6472992",
"0.6315012",
"0.6315012",
"0.62821025",
"0.6279224",
"0.6211609",
"0.61891466",
"0.6182247",
"0.60683644",
"0.6032628",
"0.5995443",
"0.5988785",
"0.5959885",
"0.5938289",
"0.5931089",
"0.58951056",
"0.5859927",
"0.5851703",
"0.58493423",
"0.58465594",
"0.5832836... | 0.0 | -1 |
Custom attribute writer method with validation | def plan_version=(plan_version)
if !plan_version.nil? && plan_version < 1
fail ArgumentError, "invalid value for 'plan_version', must be greater than or equal to 1."
end
@plan_version = plan_version
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def attr_writer_tag(text); end",
"def allowed_attributes=(_arg0); end",
"def allowed_attributes=(_arg0); end",
"def writer(*args)\n attr_writer(*args)\n args\n end",
"def define_write_method(attr_name)\n evaluate_attribute_method attr_name, \"def #{attr_name}=(new_value);write_attribute('#{at... | [
"0.6472992",
"0.6315012",
"0.6315012",
"0.62821025",
"0.6279224",
"0.6211609",
"0.61891466",
"0.6182247",
"0.60683644",
"0.6032628",
"0.5995443",
"0.5988785",
"0.5959885",
"0.5938289",
"0.5931089",
"0.58951056",
"0.5859927",
"0.5851703",
"0.58493423",
"0.58465594",
"0.5832836... | 0.0 | -1 |
Custom attribute writer method with validation | def grace_duration=(grace_duration)
if !grace_duration.nil? && grace_duration < 0
fail ArgumentError, "invalid value for 'grace_duration', must be greater than or equal to 0."
end
@grace_duration = grace_duration
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def attr_writer_tag(text); end",
"def allowed_attributes=(_arg0); end",
"def allowed_attributes=(_arg0); end",
"def writer(*args)\n attr_writer(*args)\n args\n end",
"def define_write_method(attr_name)\n evaluate_attribute_method attr_name, \"def #{attr_name}=(new_value);write_attribute('#{at... | [
"0.6472992",
"0.6315012",
"0.6315012",
"0.62821025",
"0.6279224",
"0.6211609",
"0.61891466",
"0.6182247",
"0.60683644",
"0.6032628",
"0.5995443",
"0.5988785",
"0.5959885",
"0.5938289",
"0.5931089",
"0.58951056",
"0.5859927",
"0.5851703",
"0.58493423",
"0.58465594",
"0.5832836... | 0.0 | -1 |
Checks equality by comparing each attribute. | def ==(o)
return true if self.equal?(o)
self.class == o.class &&
customer == o.customer &&
plan == o.plan &&
amount == o.amount &&
quantity == o.quantity &&
test == o.test &&
handle == o.handle &&
source == o.source &&
create_cu... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ==(other)\n attributes == other.attributes\n end",
"def ==(other) # :nodoc:\n @attrs == other.attrs\n end",
"def eql?(other)\n return true if self == other\n @@ATTRIBUTES.each do |att|\n return false unless self.send(att).eql?(other.send(att))\n end\n true\n en... | [
"0.7291717",
"0.7188103",
"0.70395297",
"0.7007927",
"0.68874705",
"0.6861532",
"0.6707156",
"0.6660597",
"0.66147524",
"0.658478",
"0.6584619",
"0.6580019",
"0.65543133",
"0.6543933",
"0.65068495",
"0.6479513",
"0.6456241",
"0.6415999",
"0.6412208",
"0.6412208",
"0.6412208",... | 0.0 | -1 |
Calculates hash code according to all attributes. | def hash
[customer, plan, amount, quantity, test, handle, source, create_customer, plan_version, amount_incl_vat, generate_handle, start_date, end_date, grace_duration, no_trial, no_setup_fee, subscription_discounts, coupon_codes, add_ons, additional_costs, signup_method, conditional_create].hash
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def attr_hash\n Digest::MD5.hexdigest(\"#{@name}:#{@ruby_type}\")\n end",
"def hash() end",
"def hash() end",
"def hash() end",
"def hash() end",
"def hash() end",
"def hash() end",
"def hash() end",
"def hash\n code = 17\n code = 37*code + @x.hash\n code = 37*code + @y.hash\n ... | [
"0.7118691",
"0.70400536",
"0.70400536",
"0.70400536",
"0.70400536",
"0.70400536",
"0.70400536",
"0.70400536",
"0.68960655",
"0.67847186",
"0.6707762",
"0.670052",
"0.6688737",
"0.66705376",
"0.6489735",
"0.6462376",
"0.6462376",
"0.64444333",
"0.6413127",
"0.6395483",
"0.638... | 0.0 | -1 |
Builds the object from hash | def build_from_hash(attributes)
return nil unless attributes.is_a?(Hash)
self.class.swagger_types.each_pair do |key, type|
if type =~ /\AArray<(.*)>/i
# check to ensure the input is an array given that the the attribute
# is documented as an array but the input is not
i... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def build(hash)\n obj = new\n hash.each_pair do |k,v|\n obj[k] = v if variables[k]\n end\n return obj\n end",
"def build_from_hash(attributes)\n\n end",
"def build_from_hash(hash)\n instance = self.new\n\n # Add the instance attributes dynamically ... | [
"0.8011074",
"0.7470833",
"0.7457607",
"0.7256629",
"0.72455454",
"0.70060325",
"0.6973257",
"0.6955014",
"0.69459796",
"0.69398683",
"0.69363195",
"0.6917627",
"0.6872358",
"0.6796184",
"0.6783521",
"0.67575246",
"0.67575246",
"0.67560464",
"0.67514306",
"0.67136854",
"0.666... | 0.0 | -1 |
Deserializes the data based on type | def _deserialize(type, value)
case type.to_sym
when :DateTime
DateTime.parse(value)
when :Date
Date.parse(value)
when :String
value.to_s
when :Integer
value.to_i
when :Float
value.to_f
when :BOOLEAN
if value.to_s =~ /\A(true|t|yes... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s... | [
"0.7330779",
"0.72736627",
"0.7249906",
"0.7245557",
"0.7228973",
"0.7228973",
"0.7228973",
"0.7228973",
"0.7228973",
"0.7228973",
"0.7228973",
"0.7228973",
"0.7228973",
"0.7228973",
"0.7228973",
"0.7228973",
"0.7228973",
"0.7228973",
"0.7228973",
"0.7228973",
"0.72182643",
... | 0.0 | -1 |
Returns the string representation of the object | def to_s
to_hash.to_s
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_s\n @object.to_s\n end",
"def to_s\n object.to_s\n end",
"def serialize(object)\n object.to_s\n end",
"def to_s\n self.inspect\n end",
"def to_s\n @string || @object.to_s('F')\n end",
"def to_s\n @string || @object.to_s('F')\n end",
"de... | [
"0.901024",
"0.89506465",
"0.84703195",
"0.83409667",
"0.8337169",
"0.8337169",
"0.8332247",
"0.82546586",
"0.8145818",
"0.8144667",
"0.81357557",
"0.812714",
"0.8093436",
"0.8086725",
"0.8073356",
"0.8039774",
"0.80308646",
"0.80064154",
"0.80064154",
"0.80064154",
"0.800641... | 0.0 | -1 |
to_body is an alias to to_hash (backward compatibility) | def to_body
to_hash
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_body\r\n to_hash\r\n end",
"def to_body\n to_hash\nend",
"def to_body\n to_hash\nend"
] | [
"0.84283537",
"0.8347048",
"0.8347048"
] | 0.0 | -1 |
Returns the object in the form of hash | def to_hash
hash = {}
self.class.attribute_map.each_pair do |attr, param|
value = self.send(attr)
next if value.nil?
hash[param] = _to_hash(value)
end
hash
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_hash\n object\n end",
"def hash\r\n return to_s.hash\r\n end",
"def hash\n to_a.hash\n end",
"def hash\n [_hash, name, owner].hash\n end",
"def hash\n return to_s.hash\n end",
"def hash\n @hash\n end",
"def hash\n @hash.hash\n end",
"def hash\n ... | [
"0.8270299",
"0.78767854",
"0.78726953",
"0.7802364",
"0.7789188",
"0.77806795",
"0.7775915",
"0.7767511",
"0.7760525",
"0.7760525",
"0.77559966",
"0.7731286",
"0.7713916",
"0.7713916",
"0.7713916",
"0.7713916",
"0.7713916",
"0.7713916",
"0.7713916",
"0.7713916",
"0.7713916",... | 0.0 | -1 |
Outputs nonarray value in the form of hash For object, use to_hash. Otherwise, just return the value | def _to_hash(value)
if value.is_a?(Array)
value.compact.map{ |v| _to_hash(v) }
elsif value.is_a?(Hash)
{}.tap do |hash|
value.each { |k, v| hash[k] = _to_hash(v) }
end
elsif value.respond_to? :to_hash
value.to_hash
else
value
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def hash\n [value].hash\n end",
"def hash\n [value].hash\n end",
"def hash\n\t\tvalue.hash\n\tend",
"def hash\n value.hash\n end",
"def hash\n @value.hash\n end",
"def hash\r\n return to_s.hash\r\n end",
"def to_hash\n @value\n end",
"def to_hash\n @va... | [
"0.6721637",
"0.6721637",
"0.66700774",
"0.6658082",
"0.65889424",
"0.6454406",
"0.6417279",
"0.6417279",
"0.6383659",
"0.6346423",
"0.63042206",
"0.62255245",
"0.615367",
"0.61042213",
"0.6080766",
"0.6080766",
"0.60735184",
"0.6037671",
"0.6020518",
"0.59375167",
"0.5904366... | 0.0 | -1 |
Use callbacks to share common setup or constraints between actions. | def set_user_movie
@evaluated_movie = UserMovie.find(params[:id])
@movie = Movie.find_by(id: @evaluated_movie.movie_id)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_... | [
"0.6163163",
"0.6045976",
"0.5946146",
"0.591683",
"0.5890051",
"0.58349305",
"0.5776858",
"0.5703237",
"0.5703237",
"0.5652805",
"0.5621621",
"0.54210985",
"0.5411113",
"0.5411113",
"0.5411113",
"0.5391541",
"0.53794575",
"0.5357573",
"0.53402257",
"0.53394014",
"0.53321576"... | 0.0 | -1 |
Never trust parameters from the scary internet, only allow the white list through. | def evaluated_movie_params
params.require(:user_movie).permit(:star, :movie_id)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def allow_params_authentication!; end",
"def allowed_params\n ALLOWED_PARAMS\n end",
"def default_param_whitelist\n [\"mode\"]\n... | [
"0.69792545",
"0.6781151",
"0.67419964",
"0.674013",
"0.6734356",
"0.6591046",
"0.6502396",
"0.6496313",
"0.6480641",
"0.6477825",
"0.64565",
"0.6438387",
"0.63791263",
"0.63740575",
"0.6364131",
"0.63192815",
"0.62991166",
"0.62978333",
"0.6292148",
"0.6290449",
"0.6290076",... | 0.0 | -1 |
GET /users GET /users.json | def index
@users = User.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def users(args = {})\n get(\"/users.json\",args)\n end",
"def show\n begin\n user = User.find(params[:user_id])\n render json: { users: user }, status: :ok\n rescue => e\n render json: { errors: e.message}, status: 404\n end\n end",
"def GetUsers params = {}\n\n para... | [
"0.82109934",
"0.7873764",
"0.7860689",
"0.78108346",
"0.78067017",
"0.7678852",
"0.76586664",
"0.76318866",
"0.7582366",
"0.75291824",
"0.7487637",
"0.74485743",
"0.7439024",
"0.7437192",
"0.7427442",
"0.73978853",
"0.73978853",
"0.73978853",
"0.73978853",
"0.7377353",
"0.73... | 0.0 | -1 |
GET /users/1 GET /users/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n if params[:single]\n\t url = \"#{API_BASE_URL}/users/#{params[:id]}.json\"\n\t response = RestClient.get(url)\n\t @user = JSON.parse(response.body)\n\telse\n\t url = \"#{API_BASE_URL}/users.json\"\t \n response = RestClient.get(url)\n @users = JSON.parse(response.body)\t\t \n\tend\n ... | [
"0.81052464",
"0.77023965",
"0.7701738",
"0.7625992",
"0.7582116",
"0.74812186",
"0.74603623",
"0.74466217",
"0.73053813",
"0.72993654",
"0.7288848",
"0.72773314",
"0.7234603",
"0.72322416",
"0.72322416",
"0.72322416",
"0.72322416",
"0.72322416",
"0.72322416",
"0.72322416",
"... | 0.0 | -1 |
POST /users POST /users.json | def create
@user = User.new(user_params)
respond_to do |format|
if @user.save
format.html { redirect_to @user, notice: 'User was successfully created.' }
format.json { render action: 'show', status: :created, location: @user }
else
format.html { render action: 'new' }
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def post_users(users)\n self.class.post('https://api.yesgraph.com/v0/users', {\n :body => users.to_json,\n :headers => @options,\n })\n end",
"def CreateUser params = {}\n \n APICall(path: 'users.json',method: 'POST',payload: params.to_json)\n \n end",
"def post b... | [
"0.77179813",
"0.75206673",
"0.73831296",
"0.72405374",
"0.719841",
"0.7140812",
"0.71038526",
"0.7058827",
"0.7041636",
"0.70236504",
"0.7003128",
"0.70021695",
"0.70021695",
"0.70021695",
"0.69936967",
"0.6990463",
"0.6980393",
"0.6979075",
"0.69788617",
"0.69788617",
"0.69... | 0.0 | -1 |
PATCH/PUT /users/1 PATCH/PUT /users/1.json | def update
respond_to do |format|
if @user.update(user_params)
format.html { redirect_to @user, notice: 'User was successfully updated.' }
format.json { head :no_content }
else
format.html { render action: 'edit' }
format.json { render json: @user.errors, status: :unproce... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n render json: User.update(params[\"id\"], params[\"user\"])\n end",
"def update\n render json: Users.update(params[\"id\"], params[\"user\"])\n end",
"def UpdateUser params = {}\n \n APICall(path: 'users.json',method: 'PUT',payload: params.to_json)\n \n end",
"de... | [
"0.7225568",
"0.7129473",
"0.70036036",
"0.6903525",
"0.6821961",
"0.68157715",
"0.6708618",
"0.66936064",
"0.66810983",
"0.6673763",
"0.6672601",
"0.6664346",
"0.6664346",
"0.6659468",
"0.6659468",
"0.6654875",
"0.66486204",
"0.66436917",
"0.6641295",
"0.6635214",
"0.6618464... | 0.0 | -1 |
DELETE /users/1 DELETE /users/1.json | def destroy
@user.destroy
respond_to do |format|
format.html { redirect_to users_url }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def DeleteUser id\n \n APICall(path: \"users/#{id}.json\",method: 'DELETE')\n \n end",
"def delete\n render json: User.delete(params[\"id\"])\n end",
"def delete(id)\n request(:delete, \"/users/#{id}.json\")\n end",
"def delete\n render json: Users.delete(params[\"id\... | [
"0.78750724",
"0.77518034",
"0.7713981",
"0.7610077",
"0.747295",
"0.74073994",
"0.74073994",
"0.7369968",
"0.7346072",
"0.7340465",
"0.7328618",
"0.7309635",
"0.73095363",
"0.7306841",
"0.7297868",
"0.72917855",
"0.7291585",
"0.7289111",
"0.7284347",
"0.7250935",
"0.7250935"... | 0.0 | -1 |
Use callbacks to share common setup or constraints between actions. | def set_user
@user = User.find(params[:id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_... | [
"0.61637366",
"0.60446453",
"0.59452957",
"0.591511",
"0.58885515",
"0.5834122",
"0.57761765",
"0.5702554",
"0.5702554",
"0.5652102",
"0.5619581",
"0.5423898",
"0.5409782",
"0.5409782",
"0.5409782",
"0.5394745",
"0.53780794",
"0.5356209",
"0.5338898",
"0.53381324",
"0.5328622... | 0.0 | -1 |
Never trust parameters from the scary internet, only allow the white list through. | def user_params
params.require(:user).permit(:name, :phone_number, :ssn)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def allow_params_authentication!; end",
"def allowed_params\n ALLOWED_PARAMS\n end",
"def default_param_whitelist\n [\"mode\"]\n... | [
"0.69792545",
"0.6781151",
"0.67419964",
"0.674013",
"0.6734356",
"0.6591046",
"0.6502396",
"0.6496313",
"0.6480641",
"0.6477825",
"0.64565",
"0.6438387",
"0.63791263",
"0.63740575",
"0.6364131",
"0.63192815",
"0.62991166",
"0.62978333",
"0.6292148",
"0.6290449",
"0.6290076",... | 0.0 | -1 |
lowlevel HTTP Delete. Returns HTTP::Response | def delete(uri)
request(Net::HTTP::Delete.new(uri))
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete\n url = prefix + \"delete\"\n return response(url)\n end",
"def delete\n url = prefix + \"delete\"\n return response(url)\n end",
"def delete\n url = prefix + \"delete\"\n return response(url)\n end",
"def delete\n url = prefix + \"delete\"\n return response(ur... | [
"0.843776",
"0.843776",
"0.8384498",
"0.8384498",
"0.80834377",
"0.79935634",
"0.794935",
"0.7863636",
"0.7748908",
"0.77340084",
"0.77154166",
"0.76363534",
"0.76291275",
"0.76080817",
"0.75998324",
"0.7556298",
"0.75016916",
"0.7450397",
"0.7423766",
"0.74234027",
"0.739311... | 0.7589196 | 15 |
lowlevel HTTP Get. Returns HTTP::Response | def get(uri)
request(Net::HTTP::Get.new(uri))
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get()\n return @http.request(@req)\n end",
"def get\n url = prefix + \"get\"\n return response(url)\n end",
"def get\n url = prefix + \"get\"\n return response(url)\n end",
"def get\n @response = Net::HTTP.get_response(URI(@url))\n end",
"def get\n url = prefix + \"get\... | [
"0.7783487",
"0.7782818",
"0.7782818",
"0.7756773",
"0.7752004",
"0.7752004",
"0.7659445",
"0.7642315",
"0.76037097",
"0.7593802",
"0.75517094",
"0.7548873",
"0.75416183",
"0.75408477",
"0.74693763",
"0.74499416",
"0.7388132",
"0.73817945",
"0.7380954",
"0.7377455",
"0.735701... | 0.71320677 | 34 |
lowlevel HTTP Put. Returns HTTP::Response | def put(uri, xml)
req = Net::HTTP::Put.new(uri)
req["content-type"] = "application/xml"
req.body = xml
request(req)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _http_put resource, path\n uri = ::URI.parse(resource.auth_uri)\n path = _path uri, path\n request = Net::HTTP::Put.new(path)\n _build_request resource, request\nend",
"def _http_put resource, path\n uri = ::URI.parse(resource.auth_uri)\n path = _path uri, path\n request = Net::HTTP::Put.new(path)\n ... | [
"0.7591203",
"0.75902414",
"0.7561298",
"0.7532378",
"0.73348856",
"0.73348856",
"0.73322767",
"0.7303618",
"0.727986",
"0.72694504",
"0.72430974",
"0.7212183",
"0.718796",
"0.71813744",
"0.71742606",
"0.7159381",
"0.71476024",
"0.70940435",
"0.7084473",
"0.70633495",
"0.7048... | 0.0 | -1 |
lowlevel HTTP Post. Returns HTTP::Response | def post(uri, xml)
req = Net::HTTP::Post.new(uri)
req["content-type"] = "application/xml"
req.body = xml
request(req)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def post()\n return @http.request(@req)\n end",
"def post_http(args)\n\t\t return(Net::HTTP.post_form @uri, args)\t\t\t\n \tend",
"def post url, body, headers = {}\n http_request(url, Net::HTTP::Post, body, headers)\n end",
"def http_post(url, data)\n\turi = URI(url)\n\treq = Net::HTTP::P... | [
"0.777407",
"0.75932395",
"0.7469033",
"0.737807",
"0.73620135",
"0.73221916",
"0.7295526",
"0.72773695",
"0.72410315",
"0.7204745",
"0.71624535",
"0.7159403",
"0.7157308",
"0.7154533",
"0.71117723",
"0.7105036",
"0.70569545",
"0.70553535",
"0.704971",
"0.7033353",
"0.7031534... | 0.0 | -1 |
Implicitly hints that a uniform exists. | def uniform_location(uniform_name)
uniform_sym = uniform_name.to_sym
@uniform_locations[uniform_sym] ||=
Gl.glGetUniformLocation(@name, uniform_name.to_s)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def bind_uniform(name, location)\n return if location == NO_UNIFORM\n value = self[name]\n return unless value\n\n type, length, address =\n if value.kind_of? PackedValue\n [value.type, value.length, value.value]\n elsif value.respond_to? :address\n [value.class, value.length, v... | [
"0.6586444",
"0.6070382",
"0.6019188",
"0.58786976",
"0.5696789",
"0.5485203",
"0.5438191",
"0.52530164",
"0.5137256",
"0.5043726",
"0.5036066",
"0.50084376",
"0.49949974",
"0.49572346",
"0.476907",
"0.47566202",
"0.46102747",
"0.4549433",
"0.4522176",
"0.44944403",
"0.447254... | 0.6331245 | 1 |
GET /party_lists GET /party_lists.json | def index
@party_lists = PartyList.all.order(:id)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_party_list\n @party_list = PartyList.find(params[:id])\n end",
"def index\n @parties = Party.order(:name).all\n\n respond_to do |format|\n format.html\n format.json { render json: @parties }\n format.xml { render xml: @parties }\n end\n end",
"def get_list(list_id)\n ... | [
"0.6903512",
"0.65883553",
"0.6513864",
"0.64896125",
"0.64874274",
"0.6350442",
"0.6239866",
"0.6165532",
"0.615419",
"0.6144732",
"0.6142607",
"0.6142607",
"0.61384887",
"0.6124252",
"0.6110967",
"0.6096433",
"0.60715467",
"0.60371333",
"0.6007722",
"0.6006174",
"0.5996661"... | 0.69582874 | 0 |
GET /party_lists/1 GET /party_lists/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_party_list\n @party_list = PartyList.find(params[:id])\n end",
"def index\n @party_lists = PartyList.all.order(:id)\n end",
"def create\n @party_list = PartyList.new(party_list_params)\n\n respond_to do |format|\n if @party_list.save\n format.html { redirect_to @party_list... | [
"0.71191454",
"0.69362956",
"0.66354036",
"0.65790975",
"0.6535242",
"0.650388",
"0.63659203",
"0.63168854",
"0.629646",
"0.62214667",
"0.61743015",
"0.61649615",
"0.61649615",
"0.61463755",
"0.6141843",
"0.6047149",
"0.600672",
"0.5967662",
"0.5950912",
"0.59055215",
"0.5898... | 0.0 | -1 |
POST /party_lists POST /party_lists.json | def create
@party_list = PartyList.new(party_list_params)
respond_to do |format|
if @party_list.save
format.html { redirect_to @party_list, notice: 'Party list was successfully created.' }
format.json { render :show, status: :created, location: @party_list }
else
format.html... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_list(params={})\n @obj.post('create-list', @auth.merge(params))\n end",
"def party_list_params\n params.require(:party_list).permit(:name, :avatar, :comments)\n end",
"def set_party_list\n @party_list = PartyList.find(params[:id])\n end",
"def create_list(name)\n data = ... | [
"0.682729",
"0.68098384",
"0.67933476",
"0.646228",
"0.6279475",
"0.6260335",
"0.6246846",
"0.6113207",
"0.6087917",
"0.6043834",
"0.6038729",
"0.6024267",
"0.6020488",
"0.5995758",
"0.5992617",
"0.5991819",
"0.59204835",
"0.5911908",
"0.591147",
"0.5906218",
"0.59047765",
... | 0.7633069 | 0 |
PATCH/PUT /party_lists/1 PATCH/PUT /party_lists/1.json | def update
respond_to do |format|
if @party_list.update(party_list_params)
format.html { redirect_to @party_list, notice: 'Party list was successfully updated.' }
format.json { render :show, status: :ok, location: @party_list }
else
format.html { render :edit }
format.jso... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_list(list_id, name)\n data = {\n list: {\n name: name\n }\n }\n rest(\"patch\", \"lists/#{list_id}\", data)\n end",
"def set_party_list\n @party_list = PartyList.find(params[:id])\n end",
"def update\n @party = Party.find(params[:id])\n\n respond_to do |forma... | [
"0.68373257",
"0.6601413",
"0.6437038",
"0.6427672",
"0.64179814",
"0.6396705",
"0.63779783",
"0.6304405",
"0.62960064",
"0.62570167",
"0.6256205",
"0.62478465",
"0.62421215",
"0.62073237",
"0.61918515",
"0.61918515",
"0.6182753",
"0.6152058",
"0.6152058",
"0.61432374",
"0.61... | 0.7505886 | 0 |
DELETE /party_lists/1 DELETE /party_lists/1.json | def destroy
@party_list.destroy
respond_to do |format|
format.html { redirect_to party_lists_url, notice: 'Party list was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @party = Party.find(params[:id])\n @party.destroy\n\n respond_to do |format|\n format.html { redirect_to parties_url }\n format.json { head :no_content }\n end\n end",
"def delete_list(user, list)\n delete(\"/#{user}/lists/#{list}.json\")\n end",
"def delete_list(li... | [
"0.7019293",
"0.68459284",
"0.68293315",
"0.67457783",
"0.6743022",
"0.6743022",
"0.67038476",
"0.6685997",
"0.66618425",
"0.6631687",
"0.6631687",
"0.6631687",
"0.65966743",
"0.6596603",
"0.65961313",
"0.6591933",
"0.6591933",
"0.6591933",
"0.6581921",
"0.6576677",
"0.653149... | 0.76714146 | 0 |
Use callbacks to share common setup or constraints between actions. | def set_party_list
@party_list = PartyList.find(params[:id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_... | [
"0.61637366",
"0.60446453",
"0.59452957",
"0.591511",
"0.58885515",
"0.5834122",
"0.57761765",
"0.5702554",
"0.5702554",
"0.5652102",
"0.5619581",
"0.5423898",
"0.5409782",
"0.5409782",
"0.5409782",
"0.5394745",
"0.53780794",
"0.5356209",
"0.5338898",
"0.53381324",
"0.5328622... | 0.0 | -1 |
Never trust parameters from the scary internet, only allow the white list through. | def party_list_params
params.require(:party_list).permit(:name, :avatar, :comments)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def allow_params_authentication!; end",
"def allowed_params\n ALLOWED_PARAMS\n end",
"def default_param_whitelist\n [\"mode\"]\n... | [
"0.69792545",
"0.6781151",
"0.67419964",
"0.674013",
"0.6734356",
"0.6591046",
"0.6502396",
"0.6496313",
"0.6480641",
"0.6477825",
"0.64565",
"0.6438387",
"0.63791263",
"0.63740575",
"0.6364131",
"0.63192815",
"0.62991166",
"0.62978333",
"0.6292148",
"0.6290449",
"0.6290076",... | 0.0 | -1 |
Compare attributes between given freelancer profile and stored freelancer profiles. Using downcase() to efficiently compare the same text. | def compare_profile(freelancersStored, freelancerProfile)
result = true
i = 1
while (i <= freelancersStored.length)
result = true
if !freelancerProfile["Name"].downcase().include? freelancersStored[i]["Name"].downcase().strip
result = false
e... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def compare_with(freelancer)\n profile_items = { job_title: job_title, name: name, hourly_rate: hourly_rate,\n job_description: job_description, skills: skills, country: country, success_rate: success_rate }\n profile_items.each do |key,value|\n condition = case key \n ... | [
"0.67164403",
"0.60532564",
"0.565528",
"0.54137385",
"0.5201897",
"0.5059606",
"0.49327978",
"0.4878133",
"0.48191154",
"0.48163188",
"0.47856662",
"0.47563824",
"0.47451153",
"0.468852",
"0.46847275",
"0.46172652",
"0.45923197",
"0.4586045",
"0.45827553",
"0.45751408",
"0.4... | 0.58345884 | 2 |
Simple method to merge strings from freelancer skills | def merge_skills(skills, newSkill)
if newSkill!=""
skills = skills + " " + newSkill
end
return skills
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def full_name_with_skills\n self.full_name + ' ' + self.all_skills_with_hashtags\n end",
"def join_strings(word_1, word_2)\n join_strings=\"#{word_1} #{word_2}\"\nend",
"def concatenate_words(sentence)\nend",
"def merica(str)\n # concatenating the strings\n str + \"only in America!\"\nend",
"def... | [
"0.6761452",
"0.6377818",
"0.6332484",
"0.6289049",
"0.628144",
"0.6273637",
"0.6091111",
"0.6054331",
"0.60448396",
"0.59827167",
"0.5976189",
"0.5950364",
"0.5895003",
"0.5895003",
"0.5815763",
"0.5796502",
"0.57707345",
"0.57617056",
"0.57538474",
"0.5745201",
"0.573637",
... | 0.7227419 | 0 |
Use the Anemone page store to find the closest referer in the crawl tree that is a case (or nil if any URL in the chain can't be found) | def find_nearest_page_matching(url, regex)
raise ArgumentError,
'No crawl found. Set @crawl as the first thing in your Anemone.crawl block' if crawl.nil?
page = @crawl.pages[url]
return page if page.nil? || page.url.to_s =~ regex
find_nearest_page_matching(page.referer, regex)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def go\n captured = query_by_referrer\n return captured if captured.found?\n\n default_ordered_query\n end",
"def crawl\n # TODO flush the page cache. We cache the crawled pages.\n begin\n account_detail_page #This will get us as far as we want to go, through several pages\n rescu... | [
"0.5892724",
"0.54694486",
"0.5422239",
"0.54116744",
"0.5401807",
"0.5366848",
"0.5318751",
"0.5318751",
"0.5318751",
"0.5318751",
"0.53057516",
"0.52883935",
"0.52883935",
"0.52799827",
"0.52797985",
"0.5278542",
"0.5261298",
"0.5260768",
"0.5240728",
"0.52315557",
"0.52315... | 0.54917854 | 1 |
Use callbacks to share common setup or constraints between actions. | def set_military_branch_medal
@military_branch_medal = MilitaryBranchMedal.find(params[:id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_... | [
"0.6163163",
"0.6045976",
"0.5946146",
"0.591683",
"0.5890051",
"0.58349305",
"0.5776858",
"0.5703237",
"0.5703237",
"0.5652805",
"0.5621621",
"0.54210985",
"0.5411113",
"0.5411113",
"0.5411113",
"0.5391541",
"0.53794575",
"0.5357573",
"0.53402257",
"0.53394014",
"0.53321576"... | 0.0 | -1 |
Only allow a trusted parameter "white list" through. | def military_branch_medal_params
params.require(:military_branch_medal).permit(:military_branch_id, :medal_id, :order)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def allowed_params\n ALLOWED_PARAMS\n end",
"def expected_permitted_parameter_names; end",
"def param_whitelist\n [:role, :title]\n end",
"def default_param_whitelist\n [\"mode\"]\n end",
"def permitir_parametros\n \t\tparams.permit!\n \tend",
"def permitted_params\n []\n end",
... | [
"0.7121987",
"0.70541996",
"0.69483954",
"0.6902367",
"0.6733912",
"0.6717838",
"0.6687021",
"0.6676254",
"0.66612333",
"0.6555296",
"0.6527056",
"0.6456324",
"0.6450841",
"0.6450127",
"0.6447226",
"0.6434961",
"0.64121825",
"0.64121825",
"0.63913447",
"0.63804525",
"0.638045... | 0.0 | -1 |
:nodoc: Creates new Issues::Milestones API | def initialize(options = {})
super(options)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_milestones(project_id, milestones)\n records \"milestone\", \"/projects/#{project_id}/milestones/create\", :milestone => milestones\n end",
"def create_milestones(project_id, milestones)\n records \"milestone\", \"/projects/#{project_id}/milestones/create\", :milestone => milestones\n end",
... | [
"0.7913776",
"0.7913776",
"0.7847756",
"0.76855725",
"0.76173526",
"0.76173526",
"0.7422526",
"0.7128848",
"0.7128848",
"0.705406",
"0.70200115",
"0.7001954",
"0.6970233",
"0.68854994",
"0.6799491",
"0.67917025",
"0.66488975",
"0.66128105",
"0.6582812",
"0.65409225",
"0.65325... | 0.0 | -1 |
List milestones for a repository = Examples bitbucket = BitBucket.new :user => 'username', :repo => 'reponame' bitbucket.issues.milestones.list | def list(user_name, repo_name, params={})
_update_user_repo_params(user_name, repo_name)
_validate_user_repo_params(user, repo) unless user? && repo?
normalize! params
response = get_request("/1.0/repositories/#{user}/#{repo.downcase}/issues/milestones", params)
return response unless bl... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def milestones\n process_list_response( send(:get , \"/api/v1/milestones.json\")[:body] , Unfuddled::Milestone)\n end",
"def list(*args)\n arguments(args, required: [:user, :repo]) do\n permit VALID_MILESTONE_OPTIONS.keys\n assert_values VALID_MILESTONE_OPTIONS\n end\n\n ... | [
"0.77072847",
"0.7568576",
"0.7454273",
"0.74063873",
"0.74063873",
"0.7121403",
"0.7085949",
"0.7025663",
"0.67735606",
"0.67034525",
"0.6407855",
"0.63975126",
"0.6324642",
"0.6321691",
"0.6308109",
"0.62788457",
"0.6249693",
"0.6249168",
"0.619153",
"0.6112057",
"0.6093981... | 0.7597863 | 1 |
Get a single milestone = Examples bitbucket = BitBucket.new bitbucket.issues.milestones.get 'username', 'reponame', 'milestoneid' | def get(user_name, repo_name, milestone_id, params={})
_update_user_repo_params(user_name, repo_name)
_validate_user_repo_params(user, repo) unless user? && repo?
_validate_presence_of milestone_id
normalize! params
get_request("/1.0/repositories/#{user}/#{repo.downcase}/issues/milestones... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def milestone(project, id)\n get(\"/projects/#{url_encode project}/milestones/#{id}\")\n end",
"def get(*args)\n arguments(args, required: [:user, :repo, :number])\n\n get_request(\"/repos/#{arguments.user}/#{arguments.repo}/milestones/#{arguments.number}\", arguments.params)\n end",
"def ... | [
"0.7819083",
"0.7612949",
"0.7431844",
"0.73931336",
"0.72962254",
"0.7260072",
"0.69790673",
"0.68825376",
"0.6781671",
"0.672304",
"0.672304",
"0.65509117",
"0.6515731",
"0.64766014",
"0.64080536",
"0.6237649",
"0.6204116",
"0.61893845",
"0.6105815",
"0.6105815",
"0.6105815... | 0.7675952 | 1 |
Create a milestone = Inputs :name Required string = Examples bitbucket = BitBucket.new :user => 'username', :repo => 'reponame' bitbucket.issues.milestones.create :name => 'helloworld' | def create(user_name, repo_name, params={})
_update_user_repo_params(user_name, repo_name)
_validate_user_repo_params(user, repo) unless user? && repo?
normalize! params
filter! VALID_MILESTONE_INPUTS, params
assert_required_keys(%w[ name ], params)
post_request("/1.0/repositories/... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_milestone(user_name=nil, repo_name=nil, params={})\n _update_user_repo_params(user_name, repo_name)\n _validate_user_repo_params(user, repo) unless user? && repo?\n\n _normalize_params_keys(params)\n _filter_params_keys(VALID_MILESTONE_INPUTS, params)\n _validate_input... | [
"0.77197176",
"0.750156",
"0.750156",
"0.74777544",
"0.74777544",
"0.7393882",
"0.7183288",
"0.71807665",
"0.701479",
"0.67870593",
"0.67266417",
"0.6600806",
"0.65512276",
"0.65328",
"0.6465845",
"0.64473456",
"0.6412497",
"0.63975304",
"0.63808376",
"0.63702047",
"0.6332788... | 0.7817186 | 0 |
Update a milestone = Inputs :name Required string = Examples bitbucket = BitBucket.new bitbucket.issues.milestones.update 'username', 'reponame', 'milestoneid', :name => 'helloworld' | def update(user_name, repo_name, milestone_id, params={})
_update_user_repo_params(user_name, repo_name)
_validate_user_repo_params(user, repo) unless user? && repo?
_validate_presence_of milestone_id
normalize! params
filter! VALID_MILESTONE_INPUTS, params
assert_required_keys(%w[ ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_milestone(user_name, repo_name, milestone_id, params={})\n _update_user_repo_params(user_name, repo_name)\n _validate_user_repo_params(user, repo) unless user? && repo?\n _validate_presence_of milestone_id\n\n _normalize_params_keys(params)\n _filter_params_keys(VALID_... | [
"0.7766192",
"0.6965826",
"0.69231004",
"0.68547994",
"0.66919667",
"0.6685642",
"0.6607864",
"0.65276617",
"0.64786583",
"0.64303184",
"0.63980436",
"0.6381614",
"0.63498455",
"0.6195654",
"0.61362535",
"0.61362535",
"0.61362535",
"0.6132694",
"0.6084681",
"0.60752535",
"0.6... | 0.79767275 | 0 |
Delete a milestone = Examples bitbucket = BitBucket.new bitbucket.issues.milestones.delete 'username', 'reponame', 'milestoneid' | def delete(user_name, repo_name, milestone_id, params={})
_update_user_repo_params(user_name, repo_name)
_validate_user_repo_params(user, repo) unless user? && repo?
_validate_presence_of milestone_id
normalize! params
delete_request("/1.0/repositories/#{user}/#{repo.downcase}/issues/mile... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete_milestone(project, id)\n delete(\"/projects/#{url_encode project}/milestones/#{id}\")\n end",
"def delete_milestone(id)\n record \"/milestones/delete/#{id}\"\n end",
"def delete_milestone(id)\n record \"/milestones/delete/#{id}\"\n end",
"def delete_milestone(user_name, repo_name, ... | [
"0.83969676",
"0.82414395",
"0.82414395",
"0.81124216",
"0.729065",
"0.72365636",
"0.7071941",
"0.7008665",
"0.69833946",
"0.6932683",
"0.68305415",
"0.6664191",
"0.6487293",
"0.64781463",
"0.63204455",
"0.63167715",
"0.63059294",
"0.6226998",
"0.604947",
"0.604947",
"0.60143... | 0.8142582 | 3 |
micro_links_for method can be found in /app/controllers/staff_controller.rb | def quick_links_for(object)
case object
when :welcome
links = StaticPage.find_by_url("parent-resources").try(:links) || []
return_links = Array.new([["Parent Resources"]])
links.each do |link|
return_links << [link.name, link.url]
end
return_links
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def my_links\n end",
"def link_twitter\n\n end",
"def link_to_identifier; end",
"def link_to_identifier; end",
"def magic_links(model, options = 'crudhib', opts = {} )\n separator = ' '\n verbose = opts.fetch(:verbose, false ) #!= false\n lnks = %( <span class=\"magic_links\" ><small>\\n )\n ... | [
"0.6639435",
"0.613625",
"0.61332667",
"0.61332667",
"0.6120191",
"0.6108162",
"0.6089443",
"0.6089443",
"0.59911984",
"0.5929846",
"0.5929846",
"0.58407336",
"0.5819298",
"0.57868487",
"0.57642496",
"0.5759856",
"0.5694906",
"0.56903243",
"0.5658384",
"0.564147",
"0.564147",... | 0.5545492 | 27 |
populate array function a_few_of returns a random number of random elements | def load_array
dump_truck = []
puts "Gimme one of your favorite things"
dump_truck[0] = gets.chomp
count = 1
while dump_truck.last != "Meh"
puts "Gimme another of your favorite things or enter Meh to end"
dump_truck[count] = gets.chomp
count +=1
end
dump_truck.pop
return dump_truck
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ary(n); Array.new(n){rand}; end",
"def random_select(array, n)\n random_arr = Array.new\n n.times do\n random_array << array[rand(array.length)]\n end\nend",
"def random_select(array, n)\n [].tap do |result|\n n.times { result << array[rand(array.size)] }\n end\nend",
"def random_select(array,... | [
"0.7324045",
"0.7039403",
"0.70376885",
"0.69477224",
"0.6934536",
"0.6869241",
"0.6851215",
"0.6836631",
"0.6833092",
"0.6820848",
"0.6815583",
"0.67810345",
"0.67810345",
"0.67810345",
"0.67810345",
"0.67810345",
"0.6779834",
"0.67759496",
"0.6757302",
"0.6750843",
"0.67422... | 0.0 | -1 |
GET /custom_events GET /custom_events.xml Get /my_digi/1/event_list | def event_list
@custom_event = Custom_event.find(params[:id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_events\n Resources::Event.parse(request(:get, \"Events\"))\n end",
"def get_events()\n @client.make_request(:get, @client.concat_user_path(\"#{CALL_PATH}/#{id}/events\"))[0]\n end",
"def get_events(args)\n\tapi_url = \"#{@base_url}/#{args[:collection]}/#{args[:key]}/events/#{args[:event... | [
"0.77732545",
"0.7575515",
"0.7232345",
"0.72057706",
"0.71183234",
"0.70229137",
"0.69484943",
"0.6947583",
"0.69432527",
"0.6940914",
"0.6926933",
"0.6853421",
"0.6838126",
"0.6792133",
"0.67767125",
"0.67310077",
"0.67264867",
"0.67249906",
"0.6655148",
"0.66442764",
"0.66... | 0.705254 | 5 |
GET /custom_events/1 GET /custom_events/1.xml | def show
@custom_event = CustomEvent.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.xml { render :xml => @custom_event }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def calendar_event(event_id)\n record \"/calendar_events/#{event_id}.xml\", :method => :get\n end",
"def get_events\n Resources::Event.parse(request(:get, \"Events\"))\n end",
"def index\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @events ... | [
"0.73055834",
"0.7061174",
"0.7059969",
"0.6891292",
"0.6814387",
"0.67884237",
"0.6784532",
"0.66897553",
"0.6648841",
"0.6634603",
"0.66315025",
"0.66249067",
"0.66249067",
"0.66249067",
"0.66249067",
"0.6621328",
"0.66013557",
"0.6597169",
"0.6581267",
"0.65727425",
"0.657... | 0.7364384 | 0 |
GET /custom_events/new GET /custom_events/new.xml | def new
@custom_event = CustomEvent.new
respond_to do |format|
format.html # new.html.erb
format.xml { render :xml => @custom_event }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @event = Event.new_default\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @event }\n end\n end",
"def new\n respond_to do |format|\n format.html { render_template } # new.html.erb\n format.xml { render xml: @event }\n end\n e... | [
"0.77585804",
"0.77302665",
"0.7719559",
"0.77181804",
"0.75723165",
"0.7566058",
"0.7557748",
"0.7557748",
"0.7557748",
"0.7557748",
"0.7557748",
"0.7557748",
"0.7557748",
"0.7557748",
"0.7557748",
"0.7557748",
"0.7557748",
"0.7557748",
"0.7557748",
"0.7556257",
"0.75440925"... | 0.8144636 | 0 |
POST /custom_events POST /custom_events.xml | def create
@custom_event = CustomEvent.new(params[:custom_event])
#@custom_event.idee = @custom_event.id + 1
logger.debug "@current_user: #{@current_user}"
logger.debug "current_user: #{current_user}"
logger.debug ":current_user: #{:current_user}"
@custom_event.author = current_account.username
res... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n Rails.logger.debug(\"Received event #{params[:event]}\")\n head :ok\n end",
"def create_event event, data={}\n data[:event] = event\n post '/event', data\n end",
"def create_events\n end",
"def new\n @custom_event = CustomEvent.new\n\n respond_to do |format|\n ... | [
"0.6652726",
"0.65956634",
"0.6522141",
"0.64905876",
"0.6371255",
"0.62430525",
"0.6228574",
"0.62100077",
"0.62003696",
"0.61029667",
"0.6101863",
"0.6094898",
"0.6074326",
"0.60527307",
"0.60377115",
"0.6032891",
"0.60301644",
"0.60189986",
"0.60189986",
"0.60189986",
"0.6... | 0.5731644 | 64 |
PUT /custom_events/1 PUT /custom_events/1.xml | def update
@custom_event = CustomEvent.find(params[:id])
respond_to do |format|
if @custom_event.update_attributes(params[:custom_event])
logger.info "updated attribute"
flash[:notice] = 'CustomEvent was successfully updated.'
#@custom_events = CustomEvent.find(:all)
#@public... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def put_events(args)\n\tapi_url = \"#{@base_url}/#{args[:collection]}/#{args[:key]}/events/#{args[:event_type]}\"\n\tputs do_the_put_call( url: api_url, user: @user, json: args[:json] )\nend",
"def save_event(event)\n method = (event.id == nil || event.id == '') ? :post : :put\n query_string = (method ... | [
"0.6588095",
"0.6568102",
"0.6243368",
"0.621931",
"0.62188065",
"0.6208661",
"0.6199198",
"0.6195833",
"0.61794114",
"0.61794114",
"0.6170073",
"0.6161636",
"0.6159317",
"0.61148846",
"0.60678035",
"0.60676235",
"0.60486925",
"0.60443777",
"0.6043721",
"0.6034516",
"0.603451... | 0.67838293 | 0 |
DELETE /custom_events/1 DELETE /custom_events/1.xml | def destroy
@custom_event = CustomEvent.find(params[:id])
@custom_event.destroy
respond_to do |format|
format.html { redirect_to(custom_events_url) }
format.xml { head :ok }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @event.destroy\n respond_to do |format|\n format.html { redirect_to(admin_events_url) }\n format.xml { head :ok }\n end\n website.add_log(user: current_user, action: \"Deleted event: #{@event.name}\")\n end",
"def destroy\n @event.destroy\n respond_to do | format |\n ... | [
"0.67766184",
"0.67501277",
"0.66798496",
"0.66798496",
"0.66341573",
"0.6602487",
"0.6602487",
"0.6602487",
"0.6602487",
"0.6602487",
"0.6602487",
"0.6602487",
"0.6602487",
"0.6602487",
"0.6602487",
"0.6602487",
"0.6602487",
"0.6602487",
"0.6602487",
"0.6602487",
"0.6602487"... | 0.7358108 | 0 |
The host name at which to connect to Solr. Default 'localhost'. ==== Returns String:: host name | def hostname
unless defined?(@hostname)
@hostname = solr_url.host if solr_url
@hostname ||= user_configuration_from_key('solr', 'hostname')
@hostname ||= default_hostname
end
@hostname
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def hostname\n name + '.localhost'\n end",
"def hostname\n Socket.gethostname\n end",
"def hostname\n Socket.gethostname\n end",
"def hostname\n Socket.gethostname.split('.').first.strip\n end",
"def hostname\n @hostname ||= `hostname`.strip\n end",
"def host\n\t\t... | [
"0.8081543",
"0.766098",
"0.766098",
"0.7570593",
"0.75348055",
"0.7517301",
"0.7513532",
"0.7499513",
"0.74338406",
"0.73406804",
"0.7334358",
"0.7272968",
"0.72699684",
"0.72640216",
"0.72274613",
"0.72138935",
"0.7205254",
"0.71442604",
"0.71016604",
"0.7094605",
"0.709403... | 0.8438428 | 0 |
The port at which to connect to Solr. Defaults to 8981 in test, 8982 in development and 8983 in production. ==== Returns Integer:: port | def port
unless defined?(@port)
@port = solr_url.port if solr_url
@port ||= user_configuration_from_key('solr', 'port')
@port ||= default_port
@port = @port.to_i
end
@port
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def port\n @port ||=\n if user_configuration.has_key?('solr')\n user_configuration['solr']['port']\n end || 8983\n end",
"def port\n ENV.fetch('PORT', 8983)\n end",
"def port\n return @port.to_i\n end",
"def port\n conf['port'] || '80'\n en... | [
"0.8887995",
"0.78635365",
"0.753607",
"0.746951",
"0.74600095",
"0.737927",
"0.72772104",
"0.72772104",
"0.7272419",
"0.7261463",
"0.72520155",
"0.7220364",
"0.71657413",
"0.71630394",
"0.71619445",
"0.7136809",
"0.7133696",
"0.7097821",
"0.7089192",
"0.7069812",
"0.7048421"... | 0.8874344 | 1 |
The scheme to use, http or https. Defaults to http ==== Returns String:: scheme | def scheme
unless defined?(@scheme)
@scheme = solr_url.scheme if solr_url
@scheme ||= user_configuration_from_key('solr', 'scheme')
@scheme ||= default_scheme
end
@scheme
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def scheme\n\t\treturn self.headers.url_scheme || 'http'\n\tend",
"def build_scheme\n case @https_value\n when FalseClass then 'http'\n when NilClass then base_value.scheme || 'http'\n else 'https'\n end\n end",
"def scheme(value = nil)\n if value\n @scheme = value\n ... | [
"0.8433826",
"0.81597507",
"0.81436366",
"0.8128131",
"0.8128131",
"0.79061484",
"0.78994834",
"0.78745526",
"0.7804455",
"0.7775145",
"0.7762959",
"0.7680611",
"0.7599043",
"0.752075",
"0.7497267",
"0.7497267",
"0.7497267",
"0.7409535",
"0.7344844",
"0.7236472",
"0.7236472",... | 0.77777016 | 9 |
The userinfo used for authentication, a colondelimited string like "user:pass" Defaults to nil, which means no authentication ==== Returns String:: userinfo | def userinfo
unless defined?(@userinfo)
@userinfo = solr_url.userinfo if solr_url
user = user_configuration_from_key('solr', 'user')
pass = user_configuration_from_key('solr', 'pass')
@userinfo ||= [ user, pass ].compact.join(":") if user && pass
@userinfo ||=... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def userinfo\n if @user.nil?\n nil\n elsif @password.nil?\n @user\n else\n @user + ':' + @password\n end\n end",
"def normalized_userinfo\n normalized_user + (password ? \":#{normalized_password}\" : \"\") if userinfo\n end",
"def userinfo\n object.fetch... | [
"0.84532124",
"0.7837448",
"0.76085037",
"0.7589299",
"0.75487024",
"0.7478984",
"0.7478984",
"0.7364744",
"0.7211526",
"0.7087367",
"0.6907442",
"0.67785776",
"0.6776495",
"0.6705591",
"0.663462",
"0.6569991",
"0.6543963",
"0.65301716",
"0.6433289",
"0.64207494",
"0.63568467... | 0.76132905 | 2 |
The url path to the Solr servlet (useful if you are running multicore). Default '/solr/default'. ==== Returns String:: path | def path
unless defined?(@path)
@path = solr_url.path if solr_url
@path ||= user_configuration_from_key('solr', 'path')
@path ||= default_path
end
@path
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def path\n @path ||=\n if user_configuration.has_key?('solr')\n \"#{user_configuration['solr']['path'] || '/solr'}\"\n end\n end",
"def solr_url\n @solr_url ||= endpoint_url.gsub(/\\/select$/, '')\n end",
"def solr_url\n @solr_url ||= @configuration... | [
"0.7688001",
"0.737315",
"0.72818965",
"0.72788775",
"0.72108835",
"0.72043043",
"0.7180702",
"0.7105819",
"0.7105819",
"0.6896259",
"0.6644922",
"0.66327626",
"0.6546388",
"0.6526908",
"0.63638675",
"0.61476773",
"0.61078197",
"0.60974234",
"0.60502315",
"0.60310876",
"0.600... | 0.78345346 | 0 |
The host name at which to connect to the master Solr instance. Defaults to the 'hostname' configuration option. ==== Returns String:: host name | def master_hostname
@master_hostname ||= (user_configuration_from_key('master_solr', 'hostname') || hostname)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def hostname\n unless defined?(@hostname)\n @hostname = solr_url.host if solr_url\n @hostname ||= user_configuration_from_key('solr', 'hostname')\n @hostname ||= default_hostname\n end\n @hostname\n end",
"def hostname\n @hostname ||= ENV['HOSTNAME'] ... | [
"0.86222357",
"0.80152357",
"0.8015042",
"0.7977208",
"0.79480636",
"0.7927828",
"0.79022527",
"0.78599745",
"0.7843177",
"0.78336364",
"0.78336364",
"0.767907",
"0.765595",
"0.76495343",
"0.75163424",
"0.75045174",
"0.74878716",
"0.7477721",
"0.7473205",
"0.7445822",
"0.7368... | 0.86314994 | 0 |
The port at which to connect to the master Solr instance. Defaults to the 'port' configuration option. ==== Returns Integer:: port | def master_port
@master_port ||= (user_configuration_from_key('master_solr', 'port') || port).to_i
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def port\n unless defined?(@port)\n @port = solr_url.port if solr_url\n @port ||= user_configuration_from_key('solr', 'port')\n @port ||= default_port\n @port = @port.to_i\n end\n @port\n end",
"def port\n @port ||=\n if user_confi... | [
"0.8602891",
"0.85504204",
"0.7744657",
"0.77146566",
"0.76798654",
"0.7656932",
"0.7656932",
"0.7651915",
"0.76186365",
"0.75924927",
"0.75657576",
"0.7548996",
"0.7372144",
"0.73615295",
"0.7314484",
"0.73138916",
"0.73130816",
"0.72891116",
"0.7286879",
"0.72153026",
"0.72... | 0.8533811 | 2 |
The path to the master Solr servlet (useful if you are running multicore). Defaults to the value of the 'path' configuration option. ==== Returns String:: path | def master_path
@master_path ||= (user_configuration_from_key('master_solr', 'path') || path)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def path\n @path ||=\n if user_configuration.has_key?('solr')\n \"#{user_configuration['solr']['path'] || '/solr'}\"\n end\n end",
"def path\n unless defined?(@path)\n @path = solr_url.path if solr_url\n @path ||= user_configuration_from_key('so... | [
"0.7058772",
"0.69833034",
"0.65264505",
"0.65264505",
"0.6415586",
"0.634893",
"0.6310563",
"0.6214633",
"0.62054557",
"0.61280555",
"0.6002132",
"0.5982079",
"0.59138626",
"0.59138626",
"0.59016633",
"0.5860812",
"0.58013314",
"0.57949394",
"0.57855964",
"0.57624555",
"0.57... | 0.79840094 | 0 |
True if there is a master Solr instance configured, otherwise false. ==== Returns Boolean:: bool | def has_master?
@has_master = !!user_configuration_from_key('master_solr')
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def registered_master?\n !level_db.get(KEY_PREFIX[:master]).nil?\n end",
"def master?\n return !@slaveof.nil?\n end",
"def master?\n !!@master\n end",
"def master_enabled?\n return false if @master_preferences[@master_label].nil?\n return @master_preferences[@master_label].to_ruby.e... | [
"0.7382707",
"0.72885257",
"0.72652435",
"0.7227414",
"0.7213131",
"0.7196507",
"0.71719575",
"0.7039075",
"0.69160664",
"0.69160664",
"0.69134843",
"0.6821734",
"0.6814533",
"0.6681748",
"0.6658148",
"0.6478363",
"0.6450845",
"0.64502746",
"0.64502746",
"0.6438817",
"0.64314... | 0.89232886 | 0 |
The default log_level that should be passed to solr. You can change the individual log_levels in the solr admin interface. If no level is specified in the sunspot configuration file, use a level similar to Rails own logging level. ==== Returns String:: log_level | def log_level
@log_level ||= (
user_configuration_from_key('solr', 'log_level') ||
LOG_LEVELS[::Rails.logger.level]
)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def log_level\n @log_level ||= DEFAULT_LOG_LEVEL\n end",
"def log_level\n @log_level ||= DEFAULT_LOG_LEVEL\n end",
"def default_log_level\n\t\t\tif $DEBUG\n\t\t\t\tLogger::DEBUG\n\t\t\telsif $VERBOSE\n\t\t\t\tLogger::INFO\n\t\t\telse\n\t\t\t\tLogger::WARN\n\t\t\tend\n\t\tend",
"def log_level\... | [
"0.7756941",
"0.7756941",
"0.7729737",
"0.725342",
"0.7119505",
"0.7109365",
"0.70924956",
"0.70824856",
"0.7079741",
"0.7076367",
"0.70716816",
"0.7067309",
"0.70527816",
"0.704302",
"0.6902376",
"0.689047",
"0.68899703",
"0.684474",
"0.684474",
"0.6842628",
"0.68242055",
... | 0.836026 | 0 |
Should the solr index receive a commit after each httprequest. Default true ==== Returns Boolean: auto_commit_after_request? | def auto_commit_after_request?
@auto_commit_after_request ||=
user_configuration_from_key('auto_commit_after_request') != false
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def send_commit\n post_to_solr({},true)\n end",
"def autocommit?()\n #This is a stub, used for indexing\n end",
"def solr_commit\n Solarize::Post.execute(Solr::Request::Commit.new)\n end",
"def commit\n solr_service_connection.commit\n end",
"def autocommit\n IBM_DB.aut... | [
"0.65083295",
"0.6402352",
"0.637911",
"0.63104665",
"0.6305918",
"0.61351115",
"0.60815436",
"0.6076705",
"0.60358244",
"0.59923846",
"0.59923846",
"0.5928472",
"0.5851154",
"0.5743252",
"0.5690118",
"0.5660516",
"0.5573864",
"0.5535565",
"0.5486534",
"0.5477988",
"0.5459385... | 0.7125242 | 0 |
As for auto_commit_after_request? but only for deletes Default false ==== Returns Boolean: auto_commit_after_delete_request? | def auto_commit_after_delete_request?
@auto_commit_after_delete_request ||=
(user_configuration_from_key('auto_commit_after_delete_request') || false)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def auto_commit_after_request?\n @auto_commit_after_request ||=\n user_configuration_from_key('auto_commit_after_request') != false\n end",
"def autocommit?()\n #This is a stub, used for indexing\n end",
"def is_marked_for_delete?\n return @mark_for_delete\n end",
"def ... | [
"0.72737837",
"0.6947962",
"0.6916931",
"0.68600065",
"0.68319523",
"0.67506546",
"0.67094284",
"0.6562226",
"0.65547186",
"0.6538855",
"0.6512156",
"0.6506255",
"0.65055305",
"0.6478739",
"0.6478739",
"0.64314866",
"0.64314866",
"0.63832146",
"0.6379776",
"0.6379776",
"0.634... | 0.8775177 | 0 |
The log directory for solr logfiles ==== Returns String:: log_dir | def log_file
@log_file ||= (user_configuration_from_key('solr', 'log_file') || default_log_file_location )
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def log_directory\n File.join(@relative_to_base, LOG_DIRECTORY_NAME)\n end",
"def log_directory\n @log_directory ||= begin\n Rails.root.join('log')\n rescue => e\n File.join Dir.pwd, 'log'\n end\n ... | [
"0.8161084",
"0.8004787",
"0.798347",
"0.7853203",
"0.777655",
"0.77673423",
"0.77389795",
"0.75920385",
"0.753639",
"0.753639",
"0.7284381",
"0.7159942",
"0.69289976",
"0.6918402",
"0.68383634",
"0.6792803",
"0.674933",
"0.66759664",
"0.6658987",
"0.65898037",
"0.65664923",
... | 0.7241973 | 11 |
The solr home directory. Sunspot::Rails expects this directory to contain a config, data and pids directory. See Sunspot::Rails::Server.bootstrap for more information. ==== Returns String:: solr_home | def solr_home
@solr_home ||=
if user_configuration_from_key('solr', 'solr_home')
user_configuration_from_key('solr', 'solr_home')
else
File.join(::Rails.root, 'solr')
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def solr_home\n File.join(configuration.solr_home)\n end",
"def solr_home\n File.join(configuration.solr_home)\n end",
"def solr_home\n File.join(FileUtils.pwd, 'solr')\n end",
"def solr_data_dir\n File.join(solr_home, 'data', ::Rails.env)\n end",
"def config... | [
"0.9198283",
"0.9198283",
"0.89740425",
"0.76873946",
"0.75035125",
"0.7440174",
"0.7124235",
"0.7121647",
"0.68871886",
"0.6721906",
"0.6717368",
"0.669989",
"0.6660822",
"0.6655272",
"0.6570457",
"0.6547159",
"0.6531739",
"0.652856",
"0.65116864",
"0.6465354",
"0.6449979",
... | 0.891595 | 3 |
java heap size for Solr instance | def memory
@memory ||= user_configuration_from_key('solr', 'memory')
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def engine_size; end",
"def memsize\n end",
"def dbsize; end",
"def dbsize; end",
"def memsize; RAtlas::memsize(@storage);end",
"def max_size; end",
"def worker_pool_size; end",
"def initialize\n @max_resource_size = 10_000_000\n end",
"def size\n @heap.size\n end",
"def size\n ... | [
"0.6682031",
"0.6442611",
"0.6284952",
"0.6284952",
"0.61379427",
"0.61219174",
"0.60656536",
"0.5979285",
"0.59155715",
"0.59155715",
"0.58702344",
"0.5801402",
"0.5781308",
"0.5781308",
"0.5764262",
"0.5718293",
"0.5708105",
"0.5698572",
"0.56704706",
"0.56704706",
"0.56627... | 0.60829276 | 6 |
Interface on which to run Solr | def bind_address
@bind_address ||= user_configuration_from_key('solr', 'bind_address')
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def solr\n @solr ||= RSolr.connect(url: solr_url)\n end",
"def do_local_indexing(solr_doc); end",
"def solr\n @solr_fields = get_solr_fields\n @solr_info = get_solr_information\n end",
"def url\n \"http://127.0.0.1:#{port}/solr/\"\n end",
"def adapter_name\n 'solr'\n... | [
"0.7336324",
"0.7102809",
"0.70656735",
"0.6894963",
"0.66818327",
"0.66075337",
"0.65933067",
"0.6539617",
"0.651284",
"0.64937675",
"0.64692503",
"0.64489627",
"0.64005256",
"0.6355499",
"0.6336533",
"0.6331659",
"0.63223076",
"0.6276888",
"0.62559325",
"0.6250449",
"0.6209... | 0.0 | -1 |
Whether or not to disable Solr. Defaults to false. | def disabled?
@disabled ||= (user_configuration_from_key('disabled') || false)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def solr_powered?\n self.solr_powered\n end",
"def disable_lucene\n set_lucene_enabled false\n end",
"def disable?\n false\n end",
"def index_disabled= bool\n @index_disabled = bool\n end",
"def enabled?\n false\n end",
"def disabled?\n self.disabled = !site.i... | [
"0.6872914",
"0.6836539",
"0.6598196",
"0.62825036",
"0.62673384",
"0.62527007",
"0.6201383",
"0.61979413",
"0.6095136",
"0.60823923",
"0.6023448",
"0.6004908",
"0.5986306",
"0.5980726",
"0.59471244",
"0.5942936",
"0.59302807",
"0.5927977",
"0.592277",
"0.5906471",
"0.5899364... | 0.56523275 | 39 |
The callback to use when automatically indexing records. Defaults to after_save. | def auto_index_callback
@auto_index_callback ||=
(user_configuration_from_key('auto_index_callback') || 'after_save')
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def after_update\n super\n self.class.call_es { _index_document }\n end",
"def after_create\n super\n self.class.call_es { _index_document }\n end",
"def after_index(indexable = nil,batch_connection = nil)\n\n end",
"def after_create(model)\n update_s... | [
"0.6939893",
"0.67688876",
"0.66032654",
"0.6318067",
"0.6232138",
"0.61771023",
"0.61178",
"0.59324807",
"0.59281695",
"0.5830446",
"0.58153766",
"0.580166",
"0.5648313",
"0.558993",
"0.55820465",
"0.5565247",
"0.5551486",
"0.5495859",
"0.5488556",
"0.5478083",
"0.54610854",... | 0.7952479 | 0 |
The callback to use when automatically removing records after deletation. Defaults to after_destroy. | def auto_remove_callback
@auto_remove_callback ||=
(user_configuration_from_key('auto_remove_callback') || 'after_destroy')
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def after_destroy_callback\n puts('----------after_destroyをコール----------')\n end",
"def after_destroy_hook\n execute_hooks_for(:after, :destroy)\n end",
"def after_destroyed\n end",
"def after_delete\n end",
"def destroy\n run_callbacks :destroy do \n self.update_column(:dele... | [
"0.7895729",
"0.781113",
"0.7518744",
"0.7497578",
"0.7374357",
"0.7374357",
"0.7374357",
"0.7361616",
"0.7300363",
"0.72834414",
"0.72834414",
"0.72076786",
"0.72076786",
"0.7136787",
"0.71229666",
"0.7098748",
"0.69639134",
"0.6871885",
"0.6869551",
"0.6858329",
"0.6853285"... | 0.7342098 | 8 |
Logging in rails_root/log as solr_.log as a default. ===== Returns String:: default_log_file_location | def default_log_file_location
File.join(::Rails.root, 'log', "solr_" + ::Rails.env + ".log")
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def log_file\n @log_file ||= (user_configuration_from_key('solr', 'log_file') || default_log_file_location )\n end",
"def default_log_path\n if @config.log_root\n File.join(@config.log_root, default_log_file_name)\n else\n nil\n end\n end",
"def log_file\n Fil... | [
"0.8302128",
"0.8208753",
"0.78582126",
"0.78211004",
"0.7616691",
"0.7476673",
"0.72833616",
"0.7124547",
"0.7078312",
"0.7078312",
"0.69465417",
"0.6759343",
"0.6755002",
"0.6745315",
"0.66719025",
"0.6661914",
"0.66196275",
"0.6592591",
"0.6569379",
"0.65335244",
"0.653346... | 0.93332016 | 0 |
return a specific key from the user configuration in config/sunspot.yml ==== Returns Mixed:: requested_key or nil | def user_configuration_from_key( *keys )
keys.inject(user_configuration) do |hash, key|
hash[key] if hash
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def locate_config_value(key)\n key = key.to_sym\n config[key] || Chef::Config[:knife][key]\n end",
"def get(key)\n key = key.to_s\n %w(local_config app_config m2mhub_config).each do |config_key|\n if (config = @yaml_config[config_key])\n if config_key == 'app_config'\n ... | [
"0.6163021",
"0.6108201",
"0.604241",
"0.59862113",
"0.5914306",
"0.5886036",
"0.5871398",
"0.58591574",
"0.5813271",
"0.58017755",
"0.57947606",
"0.5794006",
"0.57878757",
"0.5759524",
"0.575478",
"0.5742151",
"0.57382476",
"0.5736923",
"0.5725269",
"0.57062346",
"0.5673206"... | 0.0 | -1 |
Memoized hash of configuration options for the current Rails environment as specified in config/sunspot.yml ==== Returns Hash:: configuration options for current environment | def user_configuration
@user_configuration ||=
begin
path = File.join(::Rails.root, 'config', 'sunspot.yml')
if File.exist?(path)
File.open(path) do |file|
processed = ERB.new(file.read).result
YAML.load(processed)[::Rails.env]
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def app_config\n values = {}\n\n GCLOUD_OPTIONS_LIST.each do |option|\n values[option] = ENV[option.to_s.upcase] || self.send(option)\n end\n\n return values\n end",
"def config_opts\n CONFIG_OPTS.inject({}) do |config_hash, key|\n config_hash[key] = send(key)\n c... | [
"0.68621457",
"0.66899234",
"0.666701",
"0.654316",
"0.65237164",
"0.64602",
"0.6424403",
"0.64195067",
"0.641386",
"0.6411879",
"0.640594",
"0.638492",
"0.63747156",
"0.6370078",
"0.6370078",
"0.6335864",
"0.6326342",
"0.63126063",
"0.6297777",
"0.6297777",
"0.6287156",
"0... | 0.5682471 | 70 |
When a specific hostname, port and path aren't provided in the sunspot.yml file, look for a key named 'url', then check the environment, then fall back to a sensible localhost default. | def solr_url
if ENV['SOLR_URL'] || ENV['WEBSOLR_URL']
URI.parse(ENV['SOLR_URL'] || ENV['WEBSOLR_URL'])
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def targeting_localhost?\n ENV['TARGET_HOST'].nil? || ENV['TARGET_HOST'] == 'localhost'\n end",
"def ensure_site_host_setup\n @site_host = \"localhost:3000\"\n @site_host = Rails.application.routes.default_url_options[:host] ||= @site_host\n end",
"def desired_hostname\n if path.start_with?('/foo... | [
"0.6409413",
"0.639016",
"0.6249595",
"0.61854076",
"0.61683154",
"0.6141041",
"0.6107273",
"0.6107273",
"0.6107273",
"0.6107273",
"0.6090185",
"0.6088205",
"0.602524",
"0.5955463",
"0.5955054",
"0.5931499",
"0.5917369",
"0.5916848",
"0.5886444",
"0.5843034",
"0.58014673",
... | 0.56207055 | 43 |
otherwise the spec throws error saying 'no id given' | def index
@users = User.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def id; 1; end",
"def id; 1; end",
"def id\n #NOOP\n end",
"def id\n raise \"Method 'id' must be defined\"\n end",
"def id\n raise NotImplementedError\n end",
"def id; end",
"def id; end",
"def id; end",
"def id; end",
"def id; end",
"def id; end",
"def id; ... | [
"0.7068191",
"0.7002079",
"0.70001554",
"0.6925415",
"0.6900035",
"0.6860984",
"0.6860984",
"0.6860984",
"0.6860984",
"0.6860984",
"0.6860984",
"0.6860984",
"0.6860984",
"0.6860984",
"0.6860984",
"0.6860984",
"0.6860984",
"0.6792911",
"0.6756899",
"0.6646558",
"0.66412",
"0... | 0.0 | -1 |
SENDING PHONE NUMBER HERE | def sendSMS(to, body = "No body was send for this message.", media = nil)
account_sid = $accountsid
auth_token = $authtoken
@client = Twilio::REST::Client.new(account_sid, auth_token)
if media
message = @client.messages.create(
body: body,
from: $phone,
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def phone_number\n \"(#{Helpers::FakeIt.area_code}) #{Helpers::FakeIt.exchange_code}-#{Helpers::FakeIt.subscriber_number}\"\n end",
"def phone_number\n '+18773289677'\n end",
"def phone_number; end",
"def phone_number; end",
"def change_phone\n current_user.genarate_phone_confirmation_code p... | [
"0.72278905",
"0.70141256",
"0.6980835",
"0.6980835",
"0.6976423",
"0.6909531",
"0.6896044",
"0.687051",
"0.6866951",
"0.6855206",
"0.67973435",
"0.67857736",
"0.6774222",
"0.6746749",
"0.67323107",
"0.67187655",
"0.6698334",
"0.66796345",
"0.66366607",
"0.6630295",
"0.662245... | 0.0 | -1 |
Context hash list: ++ Builds a new instance, resetting the internal counters. | def initialize()
clear
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initialize context\n @context = context\n @store = context.store\n\n @seen = {}\n end",
"def new_context( name, parent_context = nil )\n @last_unique_id += 1\n @context_list[ @last_unique_id ] = V3::ContextDAO.new( @last_unique_id, name.to_s, parent_context )\n end",
"def initialize(cont... | [
"0.65169495",
"0.6144861",
"0.592511",
"0.57768714",
"0.56917655",
"0.5641539",
"0.5617274",
"0.55813605",
"0.5546594",
"0.55240935",
"0.5521841",
"0.54716325",
"0.5470241",
"0.5437719",
"0.5429748",
"0.540701",
"0.5391916",
"0.53918207",
"0.53898203",
"0.53830814",
"0.537893... | 0.0 | -1 |
Clears both the internal lists of entities and contexts. | def clear
@entity_list = {}
@context_list = {}
@last_unique_id = 0
@entity_names = {} # Internal cache of context names for quick key retrieval
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def clear!\n contexts.clear\n end",
"def clear!\n contexts.clear\n end",
"def clear\n \n @hook_contexts.clear if @hook_contexts\n @execution_contexts.clear if @execution_contexts\n @cascade_contexts.clear if @cascade_contexts\n \n self\n \n end",
"def clea... | [
"0.80656564",
"0.80656564",
"0.7758154",
"0.7511816",
"0.71288586",
"0.70125735",
"0.69689256",
"0.6922737",
"0.67608523",
"0.6704949",
"0.6704949",
"0.6582116",
"0.6539126",
"0.6500507",
"0.64793265",
"0.6388345",
"0.6363253",
"0.63163555",
"0.63068825",
"0.63050246",
"0.628... | 0.82883865 | 0 |
++ Creates a new EntityDAO, adding it to the internal list and returning its instance. Entity names should be unique among the same context. (No check is performed about this, though.) They will be converted to strings internally. | def new_entity( name, parent_context = nil )
@last_unique_id += 1
entity = V3::EntityDAO.new( @last_unique_id, name.to_s, parent_context )
parent_context.entity_list[ name.to_s ] = entity if parent_context.instance_of?( V3::ContextDAO )
# Cache the key for... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_entity( name, parent_context = nil )\n id = @entity_names[ get_entity_unique_name(name, parent_context) ]\n @entity_list[ id ]\n end",
"def create(entity)\n unless entity.id\n @adapter.create(collection, entity)\n end\n\n entity\n end",
"def add_entity\n e =... | [
"0.59213907",
"0.5712357",
"0.5544077",
"0.5470924",
"0.5442165",
"0.5435268",
"0.5411286",
"0.5395928",
"0.5395928",
"0.5353739",
"0.5339533",
"0.5243308",
"0.52074516",
"0.5197445",
"0.5126106",
"0.5115129",
"0.5112657",
"0.5103246",
"0.5075333",
"0.504723",
"0.504196",
"... | 0.76475114 | 0 |
Creates a new ContextDAO, adding it to the internal list and returning its instance. Context names can be duplicated, to allow multiple childcontexts holding different values of the same group of entities. The suggested way to process the contexts is as a sequential list. (i.e. scanning all the contexts named "result_r... | def new_context( name, parent_context = nil )
@last_unique_id += 1
@context_list[ @last_unique_id ] = V3::ContextDAO.new( @last_unique_id, name.to_s, parent_context )
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def context(name)\n contexts[name] = [] unless contexts.has_key?(name)\n contexts[name]\n end",
"def new_context(description, klass, &definition)\n (@contexts << klass.new(description, self, &definition)).last\n end",
"def contexts\n @contexts ||= @contexts = {}\n end",
... | [
"0.5780692",
"0.569332",
"0.5647364",
"0.5625411",
"0.5610783",
"0.5574601",
"0.5529271",
"0.55218893",
"0.54197496",
"0.5403604",
"0.540133",
"0.5371174",
"0.53683686",
"0.5363313",
"0.53301746",
"0.5250172",
"0.52384293",
"0.52018565",
"0.5169296",
"0.5167105",
"0.51572734"... | 0.72843516 | 0 |
++ Retrieves the unique entity name, used internally to cache its key. | def get_entity_unique_name( name, parent_context = nil )
"#{ parent_context ? "#{parent_context.id}-#{parent_context.name}" : '' }-#{ name.to_s }"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def entity_name(entity)\n entity_value(entity, :full_name, :name, I18n.t('name_missing'))\n end",
"def entity_name\n parse\n return @names.first\n end",
"def key\n @entity.key\n end",
"def entity_key\n resource_name.underscore.to_sym\n end",
"def entities_key\n entities_name.underscor... | [
"0.75129724",
"0.7383636",
"0.7166202",
"0.7164908",
"0.70936126",
"0.68073434",
"0.6784813",
"0.67693895",
"0.6714521",
"0.6640207",
"0.66210496",
"0.6604858",
"0.6581592",
"0.6579659",
"0.65703875",
"0.6562822",
"0.65472656",
"0.6522637",
"0.6512543",
"0.6504823",
"0.645099... | 0.7681559 | 0 |
Retrieves an entity by its name, given the parent context instance. | def get_entity( name, parent_context = nil )
id = @entity_names[ get_entity_unique_name(name, parent_context) ]
@entity_list[ id ]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_entity_detail(detail_name)\n @entity.get_detail(detail_name)\n end",
"def retrieve_entity\n if self.id\n @entity = Deltacloud::Database::Entity::retrieve(@model)\n if @entity.exists?\n after_retrieve\n end\n else\n @entity = nil\n end\n end",
... | [
"0.6002163",
"0.5986662",
"0.5839882",
"0.5722929",
"0.5712308",
"0.57045996",
"0.56919765",
"0.5672888",
"0.56506896",
"0.56452113",
"0.56427515",
"0.56408864",
"0.56331366",
"0.5602796",
"0.55974",
"0.5587156",
"0.55840814",
"0.55147374",
"0.55143225",
"0.5483278",
"0.54781... | 0.8633785 | 0 |
++ Retrieves the contexts named as indicated. (i.e. "all the contexts named 'result_row'") | def get_contexts_named( name )
@context_list.values.map{ |context| context if context.name == name }.compact
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def contexts\n JSON.parse(raw_contexts())[\"results\"][\"bindings\"].map{|x| x[\"contextID\"][\"value\"] }\n end",
"def raw_contexts(result_format=\"application/sparql-results+json\")\n easy = Curl::Easy.new\n easy.headers[\"Accept\"] = result_format\n\n easy.url = self.uri + \"/contexts\"... | [
"0.6872841",
"0.6479896",
"0.6432969",
"0.64063144",
"0.6317191",
"0.618607",
"0.6027422",
"0.5980706",
"0.5964562",
"0.5953163",
"0.59507924",
"0.59482753",
"0.5936626",
"0.591796",
"0.58460456",
"0.5837163",
"0.5825554",
"0.5822491",
"0.581935",
"0.5809059",
"0.5790083",
... | 0.73007816 | 0 |
++ Retrieves all the entities for a specific context. | def get_entities_for_context( parent_context = nil )
if parent_context.instance_of?( V3::ContextDAO )# Context specified? Return its entity list:
parent_context.entity_list.values
else # Let's do a "manual" search among the entities:
# [Steve, 20150805] Thi... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def retrieve_all_entities\n response = self.execute(\"RetrieveAllEntities\", {\n EntityFilters: \"Entity\",\n RetrieveAsIfPublished: true\n },\n Metadata::RetrieveAllEntitiesResponse)\n end",
"def entities\n _entities\n end",
"def entities\n _entities\n end",... | [
"0.68490154",
"0.67188394",
"0.67188394",
"0.67042935",
"0.6647013",
"0.6510834",
"0.6442118",
"0.6441165",
"0.6312841",
"0.6219882",
"0.6214106",
"0.6214106",
"0.62096983",
"0.6199449",
"0.617377",
"0.60952556",
"0.6017993",
"0.600789",
"0.5987142",
"0.59783435",
"0.5957629"... | 0.736744 | 0 |
Retrieves all the (siblings) contexts for a specific context. Note that by specifying +nil+ as a parent context, will result in all root context retrieved. | def get_siblings_for_context( parent_context = nil )
@context_list.values.map do |context|
context if context.respond_to?(:parent_context) && (context.parent_context == parent_context)
end.compact
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def contexts\n @contexts ||= @contexts = {}\n end",
"def contexts\n @contexts ||= {}\n end",
"def contexts\n map(&:contexts).flatten.uniq.sort\n end",
"def get_entities_for_context( parent_context = nil )\n if parent_context.instance_of?( V3::ContextDAO )# Context specified... | [
"0.6483445",
"0.63141906",
"0.6299211",
"0.6076121",
"0.6060163",
"0.6013197",
"0.5993317",
"0.5941617",
"0.569801",
"0.56862205",
"0.56248105",
"0.5547251",
"0.54995495",
"0.54655653",
"0.54520154",
"0.54301244",
"0.5393248",
"0.53757703",
"0.5327133",
"0.5313975",
"0.528915... | 0.78469086 | 0 |
++ Dumps all the contents of the current instance to a readable string. (For debugging purposes only.) | def dump_to_s
output = "\r\n---- Factory dump: ----"
@context_list.each do |context_key, context|
if context.parent_context.instance_of?( V3::ContextDAO )
output << "\r\n(#{context.parent_context.id}) => '#{context_key}': #{ context }"
else
output << "\r\n'#{context_key}': #{ context... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def dump\r\n super + to_s\r\n end",
"def to_s\r\n dump\r\n end",
"def dump() end",
"def _dump\n self.contents\n end",
"def inspect\n # Concise to not dump too much information on the dev\n \"#<#{self.class.name}>\"\n end",
"def dump\n do_dump(0)\n ... | [
"0.7812782",
"0.76497245",
"0.75963664",
"0.7564084",
"0.73642004",
"0.73553866",
"0.7225692",
"0.7214467",
"0.7201368",
"0.71647793",
"0.71579754",
"0.7144222",
"0.7144222",
"0.71368474",
"0.71368474",
"0.71368474",
"0.71368474",
"0.71368474",
"0.7126588",
"0.71258914",
"0.7... | 0.68819237 | 61 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.