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 |
|---|---|---|---|---|---|---|
DELETE /clothing_types/1 DELETE /clothing_types/1.json | def destroy
@clothing_type.destroy
respond_to do |format|
format.html { redirect_to clothing_types_url, notice: 'Clothing type was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @cloth_type.destroy\n respond_to do |format|\n format.html { redirect_to cloth_types_url, notice: \"Cloth type was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @thing_type.destroy\n respond_to do |format|\n format.html { ... | [
"0.7239849",
"0.72201526",
"0.6934042",
"0.6914329",
"0.69123995",
"0.68993366",
"0.6889503",
"0.6876798",
"0.68743277",
"0.6870587",
"0.686866",
"0.6840677",
"0.68209153",
"0.6719631",
"0.67120177",
"0.66883004",
"0.66814125",
"0.6680943",
"0.66778535",
"0.66736174",
"0.6656... | 0.74771965 | 0 |
Use callbacks to share common setup or constraints between actions. | def set_clothing_type
@clothing_type = ClothingType.find(params[:id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_... | [
"0.6163163",
"0.6045976",
"0.5946146",
"0.591683",
"0.5890051",
"0.58349305",
"0.5776858",
"0.5703237",
"0.5703237",
"0.5652805",
"0.5621621",
"0.54210985",
"0.5411113",
"0.5411113",
"0.5411113",
"0.5391541",
"0.53794575",
"0.5357573",
"0.53402257",
"0.53394014",
"0.53321576"... | 0.0 | -1 |
Never trust parameters from the scary internet, only allow the white list through. | def clothing_type_params
params.require(:clothing_type).permit(:name)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def allow_params_authentication!; end",
"def allowed_params\n ALLOWED_PARAMS\n end",
"def default_param_whitelist\n [\"mode\"]\n... | [
"0.69792545",
"0.6781151",
"0.67419964",
"0.674013",
"0.6734356",
"0.6591046",
"0.6502396",
"0.6496313",
"0.6480641",
"0.6477825",
"0.64565",
"0.6438387",
"0.63791263",
"0.63740575",
"0.6364131",
"0.63192815",
"0.62991166",
"0.62978333",
"0.6292148",
"0.6290449",
"0.6290076",... | 0.0 | -1 |
Initialize safe interrupt signal handling. | def initialize
self.isolate_signals = false
self.signal_received = false
self.reenable_on_interrupt = false
Signal.trap('INT') do
if isolate_signals
self.signal_received = true
else
if reenable_on_interrupt
self.reenable_on_interrupt = false
self.isolate_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initialize_sighandlers\n trap(:INT) do\n stop\n exit\n end\n end",
"def interrupt_handler\n @interrupt_handler ||= {}\n end",
"def interrupt_handler\n signal_handler(2)\n end",
"def handler_for signal, &block\n interrupt_handler[signal] = block\n end",
... | [
"0.71182626",
"0.6957753",
"0.6920888",
"0.6736934",
"0.67054206",
"0.66690415",
"0.6616816",
"0.6583977",
"0.65809315",
"0.65661544",
"0.6539934",
"0.6519308",
"0.6519306",
"0.64826894",
"0.64522636",
"0.6389082",
"0.6344813",
"0.6334798",
"0.6321591",
"0.63041043",
"0.63041... | 0.76101196 | 0 |
Enable interrupt isolation while executing the provided block. | def isolate_from_interrupts
instance.signal_received = false
instance.isolate_signals = true
result = yield
instance.isolate_signals = false
result
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def interrupt!\n @mutex.synchronize do\n case @blocked\n when NOT_YET, BLOCKED\n @result = INTERRUPTED\n @cond.broadcast\n else\n return\n end\n end\n end",
"def interrupt!\n @mutex.synchronize do\n case @blocked\n when NOT_YE... | [
"0.612763",
"0.612763",
"0.6092227",
"0.6071936",
"0.5825111",
"0.57552683",
"0.5610327",
"0.56070465",
"0.55918354",
"0.5585449",
"0.5576833",
"0.55591756",
"0.5552823",
"0.55511093",
"0.5548635",
"0.5525107",
"0.5525107",
"0.5510029",
"0.5465711",
"0.5454295",
"0.5428596",
... | 0.59046 | 4 |
def sell_pet_to_customer(shop_name, sold_pet, customer) if sold_pet != nil if customer_can_afford_pet(customer, sold_pet) == true customer[:pets].push(sold_pet) shop_name[:admin][:pets_sold] += 1 customer[:cash] = sold_pet[:price] shop_name[:admin][:total_cash] += sold_pet[:price] end end end refactor of above code | def sell_pet_to_customer(shop_name, sold_pet, customer)
#p find_pet_by_name(shop_name, sold_pet) != nil
if sold_pet != nil
if customer_can_afford_pet(customer, sold_pet) == true
add_pet_to_customer(customer, sold_pet)
increase_pets_sold(shop_name, 1)
remove_customer_cash(customer, sold_pet[:pr... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sell_pet_to_customer(pet_shop, pet, customer)\n if pet != nil && customer[:cash] >= pet[:price]\n customer[:pets].push(pet)\n pet_shop[:admin][:pets_sold] += 1\n customer[:cash] -= pet[:price]\n pet_shop[:admin][:total_cash] += pet[:price]\n end\nend",
"def sell_pet_to_customer(pet_shop, pet, c... | [
"0.926649",
"0.91111356",
"0.9076376",
"0.90406996",
"0.89973867",
"0.8898211",
"0.8872287",
"0.8846247",
"0.88131094",
"0.881286",
"0.8765514",
"0.8747758",
"0.8738167",
"0.87179595",
"0.87166286",
"0.8637125",
"0.86181784",
"0.8616811",
"0.8605483",
"0.8604716",
"0.85988814... | 0.90558106 | 3 |
checks whether str is a reserved word in Java | def reserved_word?(str)
RESERVED_WORDS.include?(str.downcase)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def carefull_name?(name)\n not !! (name =~ /\\w{8}-\\w{4}-\\w{4}-\\w{4}-\\w{12}/)\nend",
"def is_valid_name(str)\r\n\twords = str.split(\" \")\r\n \tif words.length < 2\r\n return false\r\n end\r\n \twords.each do |word|\r\n if !capitalized(word)\r\n return false\r\n end\r\n end\... | [
"0.6982103",
"0.6770801",
"0.6726206",
"0.6711649",
"0.66656363",
"0.6643939",
"0.6615959",
"0.66113997",
"0.6596157",
"0.6581923",
"0.6538478",
"0.65255153",
"0.6509208",
"0.65040374",
"0.648614",
"0.6476759",
"0.6380845",
"0.6378968",
"0.63714474",
"0.6369776",
"0.63506275"... | 0.85317874 | 0 |
GET /customer_orders/1 GET /customer_orders/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def customer_single_orders\n @orders = Order.where(customer_id: current_user.customer_id, category: :single)\n render json: @orders, status: 200\n\n end",
"def index\n #data = HTTParty.get(\"http://localhost:8081/customers.json\")\n #p data.parsed_response[0]['email']\n if params[:customerId].pre... | [
"0.79557955",
"0.74624723",
"0.7157917",
"0.715425",
"0.71153116",
"0.70964265",
"0.70905644",
"0.7080021",
"0.69856757",
"0.6935622",
"0.6935622",
"0.6880677",
"0.68762624",
"0.68221533",
"0.68179893",
"0.67965513",
"0.67824316",
"0.6766102",
"0.6764944",
"0.67247516",
"0.67... | 0.0 | -1 |
POST /customer_orders POST /customer_orders.json | def create
@customer_order = CustomerOrder.new(customer_order_params)
@gig = Gig.friendly.find(params[:gig_id])
@seller = @gig.user
@customer_order.gig_id = @gig.id
@customer_order.buyer_id = current_user.id
@customer_order.seller_id = @seller.id
@customer_order.status = 'Pending'
resp... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def orders\n authenticated_post(\"auth/r/orders\").body\n end",
"def orders\n authenticated_post(\"orders\").body\n end",
"def create\n @customer = current_user.customers.build(params[:customer])\n\n respond_to do |format|\n if @customer.save \n @customer.orders.create(:user_i... | [
"0.69789916",
"0.696484",
"0.6937983",
"0.69300014",
"0.6698278",
"0.6646996",
"0.6630315",
"0.6593213",
"0.65674573",
"0.65642923",
"0.6552874",
"0.6548555",
"0.6527178",
"0.6526833",
"0.64830434",
"0.6479466",
"0.6444979",
"0.64400864",
"0.6431233",
"0.64212334",
"0.6392835... | 0.0 | -1 |
PATCH/PUT /customer_orders/1 PATCH/PUT /customer_orders/1.json | def update
respond_to do |format|
if @customer_order.update(customer_order_params)
format.html { redirect_to @customer_order, notice: 'Customer order was successfully updated.' }
format.json { render :show, status: :ok, location: @customer_order }
else
format.html { render :edit ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @customer = current_user.customers.find(params[:id])\n\n respond_to do |format|\n if @customer.update_attributes(params[:customer])\n @customer.orders.create(:user_id => @customer.user.id, \n :total => params[:total], :name => @customer.name, :phone => @customer.phone,\n ... | [
"0.6974683",
"0.6818983",
"0.67156845",
"0.66982263",
"0.6695755",
"0.6646129",
"0.65215284",
"0.6504266",
"0.64991516",
"0.646106",
"0.646106",
"0.6442553",
"0.6400033",
"0.63637644",
"0.63637644",
"0.63637644",
"0.63637644",
"0.63637644",
"0.63637644",
"0.63637644",
"0.6363... | 0.69867307 | 0 |
DELETE /customer_orders/1 DELETE /customer_orders/1.json | def destroy
@customer_order.destroy
respond_to do |format|
format.html { redirect_to admin_url, notice: 'Customer order was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @customer_order = CustomerOrder.find(params[:id])\n @customer_order.destroy\n\n respond_to do |format|\n format.html { redirect_to(customer_orders_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @customer_order = CustomerOrder.find(params[:id])\n @custome... | [
"0.7126436",
"0.7126436",
"0.7124442",
"0.7058449",
"0.7058449",
"0.7058449",
"0.7058449",
"0.7058449",
"0.7058449",
"0.7058449",
"0.7058449",
"0.70416665",
"0.7026223",
"0.69898367",
"0.6987618",
"0.6987618",
"0.69852036",
"0.6980124",
"0.69787604",
"0.69787604",
"0.69787604... | 0.72230715 | 0 |
Use callbacks to share common setup or constraints between actions. | def set_customer_order
@customer_order = CustomerOrder.find(params[:id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_... | [
"0.6163163",
"0.6045976",
"0.5946146",
"0.591683",
"0.5890051",
"0.58349305",
"0.5776858",
"0.5703237",
"0.5703237",
"0.5652805",
"0.5621621",
"0.54210985",
"0.5411113",
"0.5411113",
"0.5411113",
"0.5391541",
"0.53794575",
"0.5357573",
"0.53402257",
"0.53394014",
"0.53321576"... | 0.0 | -1 |
Never trust parameters from the scary internet, only allow the white list through. | def customer_order_params
params.require(:customer_order).permit(:name, :address_one, :address_two, :city, :state, :zipcode, :country, :email, :remarks, :gig_id, :buyer_id, :seller_id, :payment_status, :notification_params, :status, :transaction_id, :purchased_at)
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.6980957",
"0.6783065",
"0.6747844",
"0.6741468",
"0.67356336",
"0.6592548",
"0.65036845",
"0.64978707",
"0.64825076",
"0.64795035",
"0.64560914",
"0.64397955",
"0.6379666",
"0.6376688",
"0.6366702",
"0.6319728",
"0.6300833",
"0.6300629",
"0.6294277",
"0.6293905",
"0.629117... | 0.0 | -1 |
def set_betting_pool return if params[:betting_pool_id].blank? | def filter_bets(bets)
%w[country continent tournament_id].each do |parameter|
bets = bets.where("#{parameter} = ?", params[parameter.to_sym].downcase) if params[parameter.to_sym].present?
end
bets
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_spending_pool\n @spending_pool = SpendingPool.find(params[:id])\n end",
"def set_pooling\n @pooling = Pooling.find(params[:id])\n end",
"def set_pool\n @pool = Pool.find(params[:id])\n end",
"def set_pool\n @pool = Pool.find(params[:id])\n end",
"def set_pool\n ... | [
"0.70370317",
"0.69827324",
"0.68882954",
"0.68882954",
"0.68882954",
"0.6832543",
"0.6717023",
"0.67165333",
"0.6681342",
"0.6681342",
"0.6681342",
"0.6681342",
"0.6681342",
"0.66643035",
"0.6577661",
"0.6517689",
"0.65031",
"0.64823294",
"0.6453814",
"0.6446396",
"0.6377424... | 0.0 | -1 |
GET /meetings/1 GET /meetings/1.xml | def show
@model = Meeting.find(params[:id])
@meeting = Meeting.find(params[:id], :include => :organizator)
# @organizator = User.find(@meeting.organizator)
respond_to do |format|
format.html # show.html.erb
format.xml { render :xml => @meeting }
format.json { render :json => @meeting ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @meetings = Meeting.recent\n @past_meetings = Meeting.recent.past\n @upcoming_meetings = Meeting.upcoming\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @meetings }\n format.atom\n end\n end",
"def show\n @meeting = Meeting.f... | [
"0.7432931",
"0.7222755",
"0.7093803",
"0.6994988",
"0.69380337",
"0.69144934",
"0.6865746",
"0.6850136",
"0.68181527",
"0.6812334",
"0.67647654",
"0.6715466",
"0.6715466",
"0.6715466",
"0.6715466",
"0.6715466",
"0.6715466",
"0.66911983",
"0.6554662",
"0.645799",
"0.645799",
... | 0.0 | -1 |
PUT /meetings/1 PUT /meetings/1.xml | def update
@meeting = Meeting.find(params[:id])
respond_to do |format|
if @meeting.update_attributes(params[:meeting])
flash[:notice] = 'Meeting aggiornato con successo.'
format.html { redirect_to(@meeting) }
format.xml { head :ok }
else
format.html { render :action... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @meet = Meet.find(params[:id])\n\n respond_to do |format|\n if @meet.update_attributes(params[:meet])\n format.html { redirect_to @meet, notice: 'Meet was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n... | [
"0.6736497",
"0.67130566",
"0.66743153",
"0.6501453",
"0.64961463",
"0.64853835",
"0.64713913",
"0.6402791",
"0.6387426",
"0.6382748",
"0.6344773",
"0.63203645",
"0.62660897",
"0.62633264",
"0.6178516",
"0.61440146",
"0.6125862",
"0.61159986",
"0.61159945",
"0.6113205",
"0.60... | 0.6698899 | 2 |
POST /meetings POST /meetings.xml | def create
@meeting = Meeting.new(params[:meeting])
respond_to do |format|
if @meeting.save
flash[:notice] = 'Meeting creato con successo.'
format.html { redirect_to(@meeting) }
format.xml { render :xml => @meeting, :status => :created, :location => @meeting }
else
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @meeting = current_user.meetings.new(meeting_params)\n new_event(@meeting)\n respond_to do |format|\n if @meeting.save\n format.html { redirect_to new_event_path, notice: 'Meeting was successfully created.' }\n else\n format.html { render :new }\n format.json { ... | [
"0.6385355",
"0.63848025",
"0.63660413",
"0.6332388",
"0.6302386",
"0.6289513",
"0.62788576",
"0.6221645",
"0.6170628",
"0.6160674",
"0.614793",
"0.61457247",
"0.60964406",
"0.6095229",
"0.60608953",
"0.606086",
"0.60464096",
"0.60216075",
"0.60052437",
"0.59765655",
"0.59733... | 0.63697445 | 2 |
GET /meetings/new GET /meetings/new.xml | def new
@meeting = Meeting.new
respond_to do |format|
format.html # new.html.erb
format.xml { render :xml => @meeting }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @meeting = Meeting.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @meeting }\n end\n end",
"def new\n @meeting = Meeting.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @meeting }\n ... | [
"0.7177989",
"0.7177989",
"0.7177989",
"0.7172814",
"0.69502544",
"0.68651795",
"0.68575746",
"0.68321866",
"0.67510706",
"0.672825",
"0.67152536",
"0.66885686",
"0.66578853",
"0.66542256",
"0.6652893",
"0.66417617",
"0.6626984",
"0.6626984",
"0.66234565",
"0.66234565",
"0.66... | 0.7672542 | 2 |
Returns a unique symbol identifying the type of story. This is generally more granular than the story subclass itself. For example, the story types +:listing_commented+, +:listing_liked+ and +:listing_sold+ could all be represented by a ListingStory subclass. Subclasses must override this method. | def type
raise UnimplementedError
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def type_as_symbol\n underscore(self.type).intern\n end",
"def type\n self_class.to_s.to_sym\n end",
"def type_title\n \treturn SurvivorEntry.game_type_title(SurvivorEntry.name_to_game_type(self.game_type))\n end",
"def type_slug\n to_s.downcase + 's'\n end",
"def type_name\n TYPE[... | [
"0.6381671",
"0.6078831",
"0.5843133",
"0.58255666",
"0.5790667",
"0.5786875",
"0.577921",
"0.57291925",
"0.56812173",
"0.5681065",
"0.56767565",
"0.5649004",
"0.5636525",
"0.5631604",
"0.5631604",
"0.56203365",
"0.56119263",
"0.5596801",
"0.559591",
"0.55841905",
"0.55684805... | 0.0 | -1 |
Returns +true+ if the story has resolved all of its associations and has enough associated objects that it can be fully rendered. A story might be incomplete if, for example, rendering it depends on an associated user but that user no longer exists in the system. This implementation always returns +true+. Subclasses sh... | def complete?
true
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def has_associations?\n (!self.pulves.empty? ||\n !self.labours.empty? || \n !self.factures.empty? || \n !self.ventes.empty?)\n end",
"def associations?\n @_associations && @_associations.size > 0\n end",
"def empty?\n if loaded? || @association_ids || reflection.has_cach... | [
"0.7180754",
"0.7075273",
"0.69676816",
"0.66504705",
"0.6494176",
"0.63878757",
"0.6371758",
"0.63014424",
"0.62598485",
"0.6230916",
"0.6225315",
"0.6179139",
"0.6173583",
"0.616725",
"0.61095357",
"0.61033505",
"0.60987437",
"0.60864174",
"0.6071527",
"0.6069536",
"0.60692... | 0.0 | -1 |
convert ip address to string | def to_s
@ip
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_s\n @ip_string\n end",
"def ip_string(ipint)\n octets = []\n 4.times do\n octet = ipint & 0xFF\n octets.unshift(octet.to_s)\n ipint = ipint >> 8\n end\n ip = octets.join('.')\n\t\treturn ip\n\tend",
"def ip_string(ipint)\n octets = ... | [
"0.79507446",
"0.78629315",
"0.78629315",
"0.7741849",
"0.77154285",
"0.7607007",
"0.7538",
"0.75099576",
"0.7299841",
"0.7048022",
"0.6967195",
"0.69585764",
"0.6947165",
"0.68370914",
"0.6819209",
"0.68160725",
"0.6757893",
"0.6713718",
"0.6647558",
"0.6617141",
"0.6613868"... | 0.7650839 | 5 |
compare two ip addresses | def==(other)
to_s==other.to_s
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def compare_ips(detected, requested)\n Chef::Log.warn(\" Detected ip '#{detected}'; Requested ip:'#{requested}'\")\n detected == requested\nend",
"def nip_test (a_ip,b_ip)\n 0.upto(3) {|x| return false if (a_ip[x] != b_ip[x])}\n return true;\n end",
"def check_ip; end",
"def hosts_eql?(a, ... | [
"0.7764306",
"0.7666487",
"0.6457155",
"0.6390514",
"0.63575995",
"0.63007975",
"0.6210535",
"0.6204737",
"0.6165809",
"0.6150026",
"0.614879",
"0.6119721",
"0.6085773",
"0.6045308",
"0.60085213",
"0.5965203",
"0.5963678",
"0.5938784",
"0.5922525",
"0.58956605",
"0.58685505",... | 0.0 | -1 |
Returns a hash mapping uris to known routes. | def cached_routes
if !defined?(@cached_routes) || @cached_routes.blank?
@cached_routes = {}
end
return @cached_routes
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def route_hash\n {}\n end",
"def url_map opts = {}\n map = {}\n @mounted_controllers.each do |c|\n c.url_map.each_pair do |r, s|\n s.each_pair { |rm, as| (map[r] ||= {})[rm] = as.dup.unshift(c) }\n end\n end\n\n def map.to_s\n out = []\n self.each do |data|\n ... | [
"0.68485314",
"0.6798121",
"0.67278105",
"0.6715279",
"0.65818834",
"0.648751",
"0.6359572",
"0.6326179",
"0.6306511",
"0.6282067",
"0.6254708",
"0.6223775",
"0.6223775",
"0.6161822",
"0.6160272",
"0.61500674",
"0.61264277",
"0.6118149",
"0.61087006",
"0.60741925",
"0.6071064... | 0.6130554 | 16 |
Selects the first route that matches the given HTTP request. | def select_route(uri)
variables = nil
selected_route = nil
cached_route = self.cached_routes[uri.to_s]
if cached_route == nil
for route in self.routes
variables = uri.extract_mapping(
route.pattern, route.processor)
if variables != nil
selected... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def match(req)\n @routes.select{|rt| rt.matches?(req) }.first\n end",
"def find_route(request)\n @routes.find {|r| r.match?(request) }\n end",
"def find_route(routes, request)\n transport = request.websocket? ? 'WS' : 'HTTP'\n routes.match(request.request_method, transport, request.path)\... | [
"0.69903344",
"0.66252315",
"0.65773124",
"0.6536336",
"0.6516434",
"0.65057623",
"0.6402103",
"0.63907397",
"0.63815475",
"0.6300309",
"0.6300309",
"0.62768537",
"0.6234614",
"0.61923045",
"0.6149708",
"0.61297196",
"0.6115479",
"0.60806197",
"0.60226184",
"0.59944266",
"0.5... | 0.63958037 | 7 |
Creates one or more new routes with the given RouteBuilder. | def route(pattern, options={})
options[:builder] ||= GentleREST::RouteBuilder
builder_class = options[:builder]
begin
builder = builder_class.new(pattern, options)
rescue ArgumentError
raise ArgumentError,
"A RouteBuilder class must take a pattern and an " +
"... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_routes(&block)\n @router ||= Routes.new\n @router.define(&block)\n url.router = @router\n end",
"def routes(&block)\n routes = Routes.new\n routes.instance_eval(&block) if block_given?\n @route_definition = routes\n end",
"def initialize( routes=[], options={... | [
"0.66036123",
"0.63681597",
"0.6274103",
"0.6205145",
"0.6205145",
"0.61425513",
"0.6112729",
"0.61083657",
"0.60807806",
"0.5909204",
"0.58644545",
"0.5846665",
"0.5762638",
"0.5695183",
"0.5680032",
"0.56583595",
"0.5637725",
"0.5616316",
"0.55805933",
"0.55805933",
"0.5580... | 0.6109129 | 7 |
Handles route macros which are defined at runtime. | def method_missing(method, *params, &block)
route_macro = self.class.macros[method]
if route_macro.nil?
super
else
pattern = params.shift || route_macro[:pattern]
options = route_macro[:options].merge(params.shift || {})
if !params.empty?
raise ArgumentError,
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def custom_routes; end",
"def route() request.route end",
"def routes; end",
"def routes; end",
"def routes; end",
"def routes; end",
"def routes; end",
"def routes; end",
"def routes; end",
"def routes; end",
"def routes; end",
"def routes; end",
"def routes; end",
"def route_name; e... | [
"0.6710371",
"0.6395875",
"0.63448924",
"0.63448924",
"0.63448924",
"0.63448924",
"0.63448924",
"0.63448924",
"0.63448924",
"0.63448924",
"0.63448924",
"0.63448924",
"0.63448924",
"0.62931424",
"0.62931424",
"0.6286691",
"0.627123",
"0.6246792",
"0.6174232",
"0.6142897",
"0.6... | 0.696215 | 0 |
Returns true if the instance responds to the given method. | def respond_to?(method, include_private=false)
route_macro = self.class.macros[method]
if route_macro.nil?
super
else
true
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def respond_to?(method,type=false)\n return true if delegated_instance_methods.include?(method)\n old_respond_to?(method,type)\n end",
"def respond_to?(method,type=false)\n return true if delegated_instance_methods.include?(method)\n old_respond_to?(method,type)\n end",
"d... | [
"0.7971032",
"0.7971032",
"0.7963525",
"0.78766304",
"0.780857",
"0.7765392",
"0.7632725",
"0.75954264",
"0.749048",
"0.749048",
"0.7439942",
"0.7386779",
"0.7367235",
"0.7363654",
"0.7358858",
"0.7356971",
"0.7354909",
"0.73213",
"0.72951967",
"0.72870195",
"0.7253446",
"0... | 0.69863635 | 59 |
Returns the URI Template processor object. | def processor
return @options[:processor]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def uri_template\n return @uri_template ||= Addressable::Template.new(\n self.method_base.join(Addressable::URI.parse(@discovery_document['path']))\n )\n end",
"def _uri_template\n @uri_template ||= Addressable::Template.new(@link['href'])\n end",
"def to_uri_template(option... | [
"0.68230444",
"0.6652555",
"0.587742",
"0.5793919",
"0.5769041",
"0.5726363",
"0.5717262",
"0.569438",
"0.56875455",
"0.5676523",
"0.564437",
"0.56228656",
"0.55190706",
"0.5487434",
"0.54859483",
"0.54819095",
"0.54650176",
"0.5459225",
"0.54548323",
"0.5443858",
"0.5401483"... | 0.5487471 | 13 |
Sets the URI Template processor object. | def processor=(new_processor)
@options[:processor] = new_processor
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _uri_template\n @uri_template ||= Addressable::Template.new(@link['href'])\n end",
"def set_template\n end",
"def initialize (object)\n\n super()\n\n template_uri = OpenWFE::parse_known_uri(object)\n\n @template = template_uri || object\n end",
"def template(set_template)\n ... | [
"0.5652144",
"0.5620096",
"0.5567383",
"0.5464023",
"0.54504544",
"0.5405479",
"0.5405479",
"0.53173935",
"0.5255567",
"0.52436334",
"0.5200459",
"0.5193917",
"0.5164236",
"0.5153659",
"0.5119461",
"0.51069605",
"0.50847334",
"0.5074092",
"0.5052796",
"0.5036626",
"0.50343686... | 0.5722789 | 0 |
Returns the variables that were specified for this route. | def variables
return @options[:variables]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def vars\n variables.values\n end",
"def vars\n variables.values\n end",
"def _variables\n _uri_template.variables\n end",
"def variables\n context.variables.keys - context.allowed_variables\n end",
"def locals\n variables - parameters - hidden\n end",
"def get_var... | [
"0.764712",
"0.764712",
"0.75677395",
"0.75283325",
"0.73402655",
"0.71862125",
"0.71019816",
"0.6983861",
"0.6932186",
"0.6912349",
"0.68415177",
"0.68078274",
"0.6788161",
"0.6765577",
"0.67572886",
"0.673028",
"0.66335654",
"0.6604688",
"0.6525796",
"0.6520125",
"0.6510249... | 0.7647704 | 0 |
Inspects the internal state of the route. | def inspect
return "#<GentleREST::Route:0x#{self.object_id.to_s(16)} " +
"PATTERN:#{self.pattern.inspect} " +
"CONTROLLER:#{self.controller.class.to_s}>"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def inspect\n route.to_s\n end",
"def _debug_routing_tree\n\n puts self.path + \" - #{self.route_mode}\"\n @endpoints.each do |route|\n puts \"\\t#{route[:method].to_s.upcase} to ##{self.action_for route} (#{self.action_mode})\"\n end\n @subroutes.each do |k, subroute... | [
"0.6511439",
"0.625979",
"0.6155607",
"0.60762775",
"0.60321075",
"0.6024042",
"0.60196203",
"0.600613",
"0.56636363",
"0.5642388",
"0.56369865",
"0.5616252",
"0.5612074",
"0.56057435",
"0.5589509",
"0.5579636",
"0.5563864",
"0.55249447",
"0.55247235",
"0.5509879",
"0.5498879... | 0.5265465 | 38 |
GET /weapons GET /weapons.json | def index
@weapons = Weapon.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @weapons = Weapon.all\n\n render json: @weapons\n end",
"def show\n render json: @weapon\n end",
"def show\n @weapon = Weapon.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @weapon }\n end\n end",
"def index\n... | [
"0.7756858",
"0.6977078",
"0.6960484",
"0.6886618",
"0.68247867",
"0.6681907",
"0.66779226",
"0.6468281",
"0.6449637",
"0.6389201",
"0.6335293",
"0.6327807",
"0.6245701",
"0.61452085",
"0.6141549",
"0.6133341",
"0.6097861",
"0.608029",
"0.6015072",
"0.5992586",
"0.59722674",
... | 0.7019049 | 2 |
GET /weapons/1 GET /weapons/1.json | def show
@weapon = Weapon.find(params[:id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @weapons = Weapon.all\n\n render json: @weapons\n end",
"def show\n @weapon = Weapon.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @weapon }\n end\n end",
"def show\n @weapons_type = WeaponsType.find(params[:id]... | [
"0.7620624",
"0.7386189",
"0.7189642",
"0.7102485",
"0.69799143",
"0.69799143",
"0.69689846",
"0.68149984",
"0.6691",
"0.66799194",
"0.66679573",
"0.66334397",
"0.6530178",
"0.6520478",
"0.64106685",
"0.63381404",
"0.63181996",
"0.6242265",
"0.61179525",
"0.6091401",
"0.60400... | 0.68138134 | 8 |
POST /weapons POST /weapons.json | def create
@weapon = Weapon.new(weapon_params)
respond_to do |format|
if @weapon.save
format.html { redirect_to @weapon, notice: 'Weapon was successfully created.' }
format.json { render :show, status: :created, location: @weapon }
else
format.html { render :new }
fo... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @weapon = Weapon.new(weapon_params)\n\n if @weapon.save\n render json: @weapon, status: :created, location: @weapon\n else\n render json: @weapon.errors, status: :unprocessable_entity\n end\n end",
"def create\n @weapon = Weapon.new(params[:weapon])\n\n respond_to do |fo... | [
"0.727721",
"0.6927277",
"0.6872981",
"0.67620575",
"0.6574865",
"0.6567704",
"0.6530898",
"0.6409188",
"0.6345288",
"0.61694443",
"0.6140537",
"0.61349064",
"0.6081107",
"0.6062876",
"0.60300845",
"0.5990556",
"0.5892557",
"0.587066",
"0.58628786",
"0.5834465",
"0.5834465",
... | 0.68676937 | 4 |
PATCH/PUT /weapons/1 PATCH/PUT /weapons/1.json | def update
respond_to do |format|
if @weapon.update(weapon_params)
format.html { redirect_to @weapon, notice: 'Weapon was successfully updated.' }
format.json { render :show, status: :ok, location: @weapon }
else
format.html { render :edit }
format.json { render json: @we... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @weapon = Weapon.find(params[:id])\n\n if @weapon.update(weapon_params)\n head :no_content\n else\n render json: @weapon.errors, status: :unprocessable_entity\n end\n end",
"def update\n @weapon = Weapon.find(params[:id])\n\n respond_to do |format|\n if @weapon.upda... | [
"0.727393",
"0.70371974",
"0.6880298",
"0.6874306",
"0.68005896",
"0.65980154",
"0.64594257",
"0.6417891",
"0.6392344",
"0.63077337",
"0.6303939",
"0.62894285",
"0.62789357",
"0.6252193",
"0.6188642",
"0.61754525",
"0.6116306",
"0.6101216",
"0.60824406",
"0.60711664",
"0.6068... | 0.6833245 | 5 |
DELETE /weapons/1 DELETE /weapons/1.json | def destroy
@weapon.destroy
respond_to do |format|
format.html { redirect_to weapons_url, notice: 'Weapon was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @weapon = Weapon.find(params[:id])\n @weapon.destroy\n\n respond_to do |format|\n format.html { redirect_to weapons_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @weapons_type = WeaponsType.find(params[:id])\n @weapons_type.destroy\n\n respond... | [
"0.75593835",
"0.7346109",
"0.73445624",
"0.7280427",
"0.7171071",
"0.70926833",
"0.70523924",
"0.69661045",
"0.68320554",
"0.68047464",
"0.6727977",
"0.67099714",
"0.66829544",
"0.6642405",
"0.66210496",
"0.6579506",
"0.6578651",
"0.6552099",
"0.6531495",
"0.648614",
"0.6464... | 0.7285096 | 4 |
Use callbacks to share common setup or constraints between actions. | def set_weapon
@weapon = Weapon.find(params[:id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_... | [
"0.6163163",
"0.6045976",
"0.5946146",
"0.591683",
"0.5890051",
"0.58349305",
"0.5776858",
"0.5703237",
"0.5703237",
"0.5652805",
"0.5621621",
"0.54210985",
"0.5411113",
"0.5411113",
"0.5411113",
"0.5391541",
"0.53794575",
"0.5357573",
"0.53402257",
"0.53394014",
"0.53321576"... | 0.0 | -1 |
Never trust parameters from the scary internet, only allow the white list through. | def weapon_params
params.require(:weapon).permit(:name, :description, :weapon_type)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def allow_params_authentication!; end",
"def allowed_params\n ALLOWED_PARAMS\n end",
"def default_param_whitelist\n [\"mode\"]\n... | [
"0.69792545",
"0.6781151",
"0.67419964",
"0.674013",
"0.6734356",
"0.6591046",
"0.6502396",
"0.6496313",
"0.6480641",
"0.6477825",
"0.64565",
"0.6438387",
"0.63791263",
"0.63740575",
"0.6364131",
"0.63192815",
"0.62991166",
"0.62978333",
"0.6292148",
"0.6290449",
"0.6290076",... | 0.0 | -1 |
custom 404 error handler | def what_are_you_looking_for?
raise Exceptions::NotFound.new(404, 'Not Found; You did not find what you were expecting because it is not here. What are you looking for?')
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_404\n end",
"def error_404\n render 'error/error404'\n end",
"def render_404\n render_optional_error_file(404)\n end",
"def method_missing(*args)\n rescue_404\n end",
"def render_404\n raise ActionController::RoutingError.new('Not Found')\n end",
"def page404(... | [
"0.8086546",
"0.80669194",
"0.8054244",
"0.79053795",
"0.7815444",
"0.77778804",
"0.7717882",
"0.7705247",
"0.7695926",
"0.76900077",
"0.7679302",
"0.7666346",
"0.7653613",
"0.76195276",
"0.75962985",
"0.759163",
"0.7577697",
"0.7571261",
"0.75608253",
"0.7535019",
"0.7523430... | 0.0 | -1 |
GET /calls GET /calls.json | def index
@calls = Call.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_calls()\n @client.make_request(:get, @client.concat_user_path(\"#{BRIDGE_PATH}/#{id}/calls\"))[0].map do |item|\n Call.new(item, @client)\n end\n end",
"def index\n @calls = Call.all\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render j... | [
"0.77972907",
"0.7322993",
"0.71231306",
"0.69490033",
"0.6921336",
"0.6867964",
"0.67478853",
"0.6747202",
"0.6721535",
"0.66803306",
"0.66491276",
"0.6598642",
"0.6478125",
"0.64536726",
"0.6418689",
"0.6367717",
"0.6249453",
"0.62471557",
"0.62298805",
"0.61550784",
"0.613... | 0.66808426 | 11 |
GET /calls/1 GET /calls/1.json | def show; end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_calls()\n @client.make_request(:get, @client.concat_user_path(\"#{BRIDGE_PATH}/#{id}/calls\"))[0].map do |item|\n Call.new(item, @client)\n end\n end",
"def index\n @calls = Call.all\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render j... | [
"0.7085216",
"0.7034136",
"0.70049185",
"0.69574934",
"0.6860939",
"0.67924064",
"0.67169565",
"0.669272",
"0.664764",
"0.6569741",
"0.638547",
"0.6375643",
"0.6375643",
"0.6375643",
"0.6375643",
"0.63599813",
"0.63530993",
"0.6351805",
"0.62812245",
"0.6279105",
"0.6272321",... | 0.0 | -1 |
POST /calls POST /calls.json | def create
@call = Call.new(call_params)
respond_to do |format|
if @call.save
format.html { redirect_to :back, notice: 'Call was successfully created.' }
format.json { render action: 'show', status: :created, location: @call }
else
format.html { render action: 'new' }
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def post_calls(calls, opts = {})\n post_calls_with_http_info(calls, opts)\n nil\n end",
"def create\n @call = Call.new(call_params)\n\n respond_to do |format|\n if @call.save\n record_call_activity\n format.html { redirect_to @call, notice: 'Call was successfully created.' }... | [
"0.6947176",
"0.6741156",
"0.6614128",
"0.6578006",
"0.65733045",
"0.65627563",
"0.6550393",
"0.6429492",
"0.636054",
"0.62526894",
"0.62277645",
"0.62148064",
"0.6137315",
"0.61327255",
"0.6131071",
"0.6088025",
"0.60740584",
"0.60724384",
"0.6022822",
"0.6006601",
"0.600357... | 0.6655496 | 2 |
PATCH/PUT /calls/1 PATCH/PUT /calls/1.json | def update
respond_to do |format|
if @call.update(call_params)
format.html { redirect_to @call, notice: 'Call was successfully updated.' }
format.json { head :no_content }
else
format.html { render action: 'edit' }
format.json { render json: @call.errors, status: :unproce... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def patch!\n request! :patch\n end",
"def update\n @request_call = RequestCall.find(params[:id])\n\n respond_to do |format|\n if @request_call.update_attributes(params[:request_call])\n format.html { redirect_to @request_call, notice: 'Request call was successfully updated.' }\n form... | [
"0.6730913",
"0.6638005",
"0.65655315",
"0.65655315",
"0.6441413",
"0.6418613",
"0.6418613",
"0.63757586",
"0.63690454",
"0.6357464",
"0.6337483",
"0.6333296",
"0.631156",
"0.62713116",
"0.6261271",
"0.62377465",
"0.61656857",
"0.6133847",
"0.60801804",
"0.6079785",
"0.607978... | 0.6549112 | 4 |
DELETE /calls/1 DELETE /calls/1.json | def destroy
@call.destroy
respond_to do |format|
format.html { redirect_to calls_url }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @call = Call.find(params[:id])\n @call.destroy\n\n respond_to do |format|\n format.html { redirect_to calls_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @call = Call.find(params[:id])\n @call.destroy\n\n respond_to do |format|\n format.h... | [
"0.76046777",
"0.76046777",
"0.76046777",
"0.7582449",
"0.7393218",
"0.7358547",
"0.73455924",
"0.73455924",
"0.7273029",
"0.7273029",
"0.7273029",
"0.7273029",
"0.7263371",
"0.71280706",
"0.7106809",
"0.7036674",
"0.702898",
"0.70037293",
"0.68805474",
"0.6863541",
"0.685261... | 0.74180835 | 5 |
Use callbacks to share common setup or constraints between actions. | def set_call
@call = Call.find(params[:id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_... | [
"0.6163163",
"0.6045976",
"0.5946146",
"0.591683",
"0.5890051",
"0.58349305",
"0.5776858",
"0.5703237",
"0.5703237",
"0.5652805",
"0.5621621",
"0.54210985",
"0.5411113",
"0.5411113",
"0.5411113",
"0.5391541",
"0.53794575",
"0.5357573",
"0.53402257",
"0.53394014",
"0.53321576"... | 0.0 | -1 |
Never trust parameters from the scary internet, only allow the white list through. | def call_params
params.require(:call).permit(:subject, :call_type, :time, :user_id, :company_id, :contact_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 |
A (1: not measured) | def current_battery
@current_battery ||= (int16_t(16..17) / 100.0)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def band_a\n 1000\n end",
"def a\n return @a\n end",
"def prop_a\n bases_a / length.to_f\n end",
"def dec_a\n end",
"def measure\n\t\t1\n\tend",
"def inc_a\n end",
"def sbc_a_a\n end",
"def get_1DAA()... | [
"0.6260599",
"0.6190872",
"0.61834306",
"0.6049051",
"0.59552085",
"0.5948394",
"0.5899339",
"0.5878825",
"0.5858935",
"0.57149714",
"0.5704444",
"0.56951565",
"0.5676054",
"0.56158894",
"0.5605649",
"0.5560886",
"0.55586815",
"0.554862",
"0.55366457",
"0.55234706",
"0.551577... | 0.0 | -1 |
0%..100% (bad packet %age) | def drop_rate_comm
@drop_rate_comm ||= (uint16_t(18..19) / 100)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def warn_packet_overtime packet_id; end",
"def maximum_inbound_packet_loss_rate_in_percentage\n return @maximum_inbound_packet_loss_rate_in_percentage\n end",
"def maximum_outbound_packet_loss_rate_in_percentage\n return @maximum_outbound_packet_loss_rate_in_percentage\... | [
"0.6538751",
"0.6164601",
"0.60290176",
"0.6027019",
"0.59486324",
"0.59204197",
"0.5895606",
"0.58714294",
"0.5864296",
"0.56684315",
"0.56684315",
"0.5567538",
"0.5459169",
"0.5419179",
"0.5377948",
"0.53543615",
"0.53516835",
"0.53430206",
"0.53387517",
"0.53288436",
"0.53... | 0.0 | -1 |
0%..100% (1: not measured) | def battery_remaining
@battery_remaining ||= uint8_t(30)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def percent_passes; end",
"def percent_passes; end",
"def percentage; end",
"def percentage\n 0.0\n end",
"def percentage=(_arg0); end",
"def covered_percent; end",
"def covered_percent; end",
"def covered_percentages; end",
"def percentage(percent, total)\n percent.to_f / total * 100\nend... | [
"0.76969475",
"0.76969475",
"0.7654355",
"0.7444564",
"0.73547244",
"0.7191478",
"0.7191478",
"0.6938842",
"0.69212365",
"0.68925256",
"0.6859096",
"0.6831596",
"0.6831596",
"0.6829849",
"0.6761875",
"0.6754469",
"0.6727381",
"0.671534",
"0.67074656",
"0.6705559",
"0.6705559"... | 0.0 | -1 |
This method uses parts of zipline to implement streaming. This is how Zipline usually works: Rails calls response_body.each response_body is Zipline::ZipGenerator, it creates a Zipline::FakeStream with the block given to each The FakeStream is used as output for ZipLine::OutputStream (which inherits from Zip::OutputStr... | def each(&block)
fake_stream = Zipline::FakeStream.new(&block)
Zipline::OutputStream.open(fake_stream) do |zip|
@package.parts.each do |name, part|
begin
if part.respond_to?(:stream) && part.respond_to?(:size)
zip.put_next_entry name, part.size
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_buffer\n io = ::StringIO.new('')\n zf = ::Zip::File.new(io, true, true)\n yield zf\n zf.write_buffer(io)\n end",
"def update_content\n @buffer = Zip::OutputStream.write_buffer do |out|\n @output_stream = out\n yield self\n end\n end",
"def str... | [
"0.65020716",
"0.62388986",
"0.6196497",
"0.6062434",
"0.60072994",
"0.58972543",
"0.5862566",
"0.5809194",
"0.58011675",
"0.56542194",
"0.5630636",
"0.56149054",
"0.5595658",
"0.5563648",
"0.5562739",
"0.5562384",
"0.5532742",
"0.55101705",
"0.5500589",
"0.549413",
"0.547316... | 0.6514389 | 0 |
Implements a 'bare words' like feature for dependency injection using ServiceRegistry | def method_missing(method, *args, &block)
calling_method = caller_locations(1, 2)[1]
Rails.logger.debug("#{self.class.name}##{__method__}() looking for: ##{method}, from #{calling_method.path}##{calling_method.label}")
block_given? ? registry.send(method, *args, block) :
(args.size == 0 ? ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def inject(services_container); end",
"def registry; end",
"def registry; end",
"def register(service,configFileName)\n # We now derive the service Class from the string 'service'\n # 'service' is the service name given by the calling run() method\n # This new design allows us to avoid calling 'register' ... | [
"0.68971246",
"0.62266856",
"0.62266856",
"0.60543275",
"0.5957229",
"0.59035337",
"0.5892843",
"0.58846515",
"0.58390665",
"0.5822236",
"0.58096385",
"0.5791793",
"0.57807267",
"0.5744998",
"0.5741907",
"0.5733841",
"0.5731832",
"0.5730754",
"0.5716835",
"0.57121277",
"0.570... | 0.0 | -1 |
GET /partner_payments GET /partner_payments.json | def index
@partner_payments = PartnerPayment.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @payments = Payment.find(params[:id]) \n render json: @payments\n end",
"def set_partner_payment\n @partner_payment = PartnerPayment.find(params[:id])\n end",
"def investor_payments(entity_id)\n API::request(:get, \"entities/#{entity_id}/investor_payments\")\n end",
"def... | [
"0.65914005",
"0.6541627",
"0.6490365",
"0.6417016",
"0.6398402",
"0.63236934",
"0.6312949",
"0.62137663",
"0.62137663",
"0.6208062",
"0.6174154",
"0.61099416",
"0.6107622",
"0.60786146",
"0.6071058",
"0.60594666",
"0.6053158",
"0.60450685",
"0.6038191",
"0.59885776",
"0.5975... | 0.73731166 | 0 |
GET /partner_payments/1 GET /partner_payments/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @partner_payments = PartnerPayment.all\n end",
"def show\n @payments = Payment.find(params[:id]) \n render json: @payments\n end",
"def set_partner_payment\n @partner_payment = PartnerPayment.find(params[:id])\n end",
"def show\n find_payment\n render json: @payment\n en... | [
"0.71721786",
"0.67685235",
"0.6618919",
"0.6516833",
"0.6345026",
"0.6300374",
"0.6254625",
"0.6254625",
"0.62526774",
"0.61352557",
"0.6101205",
"0.6098424",
"0.60929596",
"0.60639954",
"0.6063855",
"0.6051597",
"0.6032751",
"0.60325974",
"0.6029751",
"0.6017415",
"0.599813... | 0.0 | -1 |
POST /partner_payments POST /partner_payments.json | def create
@partner_payment = PartnerPayment.new(partner_payment_params)
session.delete(:return_to)
session[:return_to] ||= request.referer
respond_to do |format|
if @partner_payment.save
format.html { redirect_to session.delete(:return_to), notice: 'Partner payment was successfully Added... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def partner_payment_params\n params.require(:partner_payment).permit(:payment_type, :date, :amount, :payment_method, :payment_desc, :partner_id)\n end",
"def payment(params)\n check_token\n\n Request.perform(:post, URI.parse(Urls::PAYMENTS_URL), headers_for_other, params.to_json)\n end",
"... | [
"0.7099244",
"0.6623038",
"0.66198033",
"0.6511064",
"0.64592165",
"0.6440121",
"0.6430455",
"0.6388495",
"0.6291547",
"0.6291437",
"0.6272542",
"0.6249106",
"0.6249106",
"0.6229413",
"0.62195903",
"0.6216075",
"0.62065774",
"0.61824286",
"0.6174678",
"0.61422956",
"0.6140604... | 0.66078836 | 3 |
PATCH/PUT /partner_payments/1 PATCH/PUT /partner_payments/1.json | def update
respond_to do |format|
if @partner_payment.update(partner_payment_params)
format.html { redirect_to partner_path(@partner_payment.partner), notice: 'Partner payment was successfully updated.' }
format.json { render :show, status: :ok, location: @partner_payment }
else
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @partner = Partner.find(params[:id])\n\n respond_to do |format|\n if @partner.update_attributes(params[:partner])\n format.html { redirect_to @partner }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { rende... | [
"0.6825548",
"0.67668444",
"0.67668444",
"0.66886526",
"0.66502976",
"0.66403073",
"0.6406839",
"0.63643336",
"0.6356928",
"0.635083",
"0.6270487",
"0.6203443",
"0.6146604",
"0.6139117",
"0.6134546",
"0.6120484",
"0.61138844",
"0.61126935",
"0.6099603",
"0.60960037",
"0.60509... | 0.7268959 | 0 |
DELETE /partner_payments/1 DELETE /partner_payments/1.json | def destroy
session.delete(:return_to)
session[:return_to] ||= request.referer
@partner_payment.destroy
respond_to do |format|
format.html { redirect_to session.delete(:return_to), notice: 'Partner payment was successfully removed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @payment.destroy\n\n respond_to do |format|\n format.html { redirect_to payments_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @payment.destroy\n respond_to do |format|\n format.html { redirect_to payments_url }\n format.json { head :no_co... | [
"0.71138173",
"0.7089294",
"0.7089294",
"0.7089294",
"0.7089294",
"0.7089294",
"0.7089294",
"0.7089294",
"0.70849043",
"0.70849043",
"0.70849043",
"0.70849043",
"0.70849043",
"0.70849043",
"0.70849043",
"0.70849043",
"0.70849043",
"0.7065417",
"0.706212",
"0.70399964",
"0.703... | 0.6724701 | 74 |
Use callbacks to share common setup or constraints between actions. | def set_partner_payment
@partner_payment = PartnerPayment.find(params[:id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_... | [
"0.6163163",
"0.6045976",
"0.5946146",
"0.591683",
"0.5890051",
"0.58349305",
"0.5776858",
"0.5703237",
"0.5703237",
"0.5652805",
"0.5621621",
"0.54210985",
"0.5411113",
"0.5411113",
"0.5411113",
"0.5391541",
"0.53794575",
"0.5357573",
"0.53402257",
"0.53394014",
"0.53321576"... | 0.0 | -1 |
Never trust parameters from the scary internet, only allow the white list through. | def partner_payment_params
params.require(:partner_payment).permit(:payment_type, :date, :amount, :payment_method, :payment_desc, :partner_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 |
Public: Initializes this class providing initial filter information start_date Used to limit the result set. It is the start of time records end_date Used to limit the result set. It is the end of time records board_id Identification of the given board. Used to grab information from an specific board. | def initialize(start_date, end_date, board_id, prefix)
@start_date = start_date
@end_date = end_date
@board_id = board_id
@prefix = prefix
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initialize_filters(params)\n # integer arrays\n [\n :location_ids,\n :model_ids,\n :scenario_ids,\n :indicator_ids,\n :sector_ids,\n :category_ids\n ].map do |param_name|\n if params[para... | [
"0.6143267",
"0.60123813",
"0.6003416",
"0.59494567",
"0.5811787",
"0.56555325",
"0.5628935",
"0.5617286",
"0.56028223",
"0.5588366",
"0.5577816",
"0.5485099",
"0.547881",
"0.54783535",
"0.5466963",
"0.5448392",
"0.5389787",
"0.53784674",
"0.5370079",
"0.53697735",
"0.5369773... | 0.6908527 | 0 |
Public: Generates the report based on a filter, if provided. The filter is a block that will filter the result set accordingly. The result set is always an array containing instances of ActivityRecord. See:: ActivityRecord filter Block used to filter the result set even further. It must follow the same format for the b... | def find_all &filter
result_set = self.driver.activities.find_all { |activity| activity.start_date >= @start_date && activity.start_date <= @end_date }
if filter
return result_set.find_all &filter
end
result_set
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def filter(filter, options={})\n options.reverse_merge!(:filter => filter)\n records(path, options)\n end",
"def report_results(filter = nil, limit = nil, format = 'json')\n url_filter_limit_format_request('arborws/reports/results', filter,\n limit... | [
"0.5893029",
"0.58540267",
"0.5832963",
"0.5814515",
"0.5746752",
"0.5744843",
"0.57369286",
"0.57055944",
"0.56629217",
"0.5603734",
"0.5555423",
"0.5538091",
"0.55148053",
"0.55148053",
"0.5469587",
"0.5461719",
"0.54480964",
"0.5371381",
"0.53656006",
"0.53648126",
"0.5315... | 0.5932803 | 0 |
Public: Setter. Overrides the board_id setter in order to reinitialize the driver properly with new settings. | def board_id=(board_id)
if board_id != @board_id
@board_id = board_id
# Forces the driver reload with the new settings
@driver = nil
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_board(board)\n @board = board\n end",
"def set_board\n @board = Board.find(params[:id]||params[:board_id])\n end",
"def set_board\n @board = Board.find(params[:board_id])\n end",
"def set_board\n @board = Board.find(params[:board_id])\n end",
"def set_board\n @boa... | [
"0.68552417",
"0.6852944",
"0.6719064",
"0.6719064",
"0.66861546",
"0.66457283",
"0.66457283",
"0.66457283",
"0.66457283",
"0.66457283",
"0.66457283",
"0.66457283",
"0.66457283",
"0.66457283",
"0.66457283",
"0.66457283",
"0.66457283",
"0.66457283",
"0.66457283",
"0.66457283",
... | 0.8344044 | 0 |
take a filename and return an array of the unique integers within the file | def read_and_sort_unique_numbers_from_file(filename)
fh = File.new(filename, 'r')
numbers = Hash.new
while line = fh.gets
number = line.to_i
numbers[number] = 1
end
fh.close
return numbers.keys.sort
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def array_to_unique\n a = File.readlines(file_name)\n b = a.sort\n c = b.uniq\n while d = c.shift\n puts d.to_textual unless nil?\n end\n end",
"def file_into_array(array)\r\n integer_unsorted_array = []\r\n\r\n array.each do |line|\r\n integer_unsorted_array << line.strip.to_i\r\n ... | [
"0.71165156",
"0.7037182",
"0.6971952",
"0.69364357",
"0.6476765",
"0.64044833",
"0.63603497",
"0.6286158",
"0.6285036",
"0.62123525",
"0.6171824",
"0.6112185",
"0.6106521",
"0.606427",
"0.6037164",
"0.5945611",
"0.59101117",
"0.588037",
"0.58542067",
"0.58213156",
"0.5815621... | 0.7576167 | 0 |
perform a binary search between lower_range and upper_range using recursion the condition we are looking to satisfy is that $sorted_numbers[j] + $sorted_numbers[index] is between LOWER_BOUND and UPPER_BOUND | def find_a_starting_index_within_range(j, lower_range, upper_range)
step = ((upper_range - lower_range) / 2).round
index = lower_range + step
sum = $sorted_numbers[j] + $sorted_numbers[index]
# if we found an index that satisifies the conditions, we return it
if sum.between?(LOWER_BOUND, UPPER_BOU... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def search_range(nums, target)\n output_range = [-1, -1]\n # try to go left\n binary_search_helper(nums, target, 0, nums.length - 1, output_range, true)\n\n # go right\n binary_search_helper(nums, target, 0, nums.length - 1, output_range, false)\n output_range\nend",
"def binary_search_iterative(array, tar... | [
"0.72599113",
"0.7131189",
"0.68988836",
"0.684628",
"0.68124753",
"0.6724732",
"0.67113304",
"0.6678369",
"0.6675311",
"0.6673447",
"0.6671573",
"0.666156",
"0.66177046",
"0.66153055",
"0.66149807",
"0.6572728",
"0.6558886",
"0.6550527",
"0.65431154",
"0.65308285",
"0.652695... | 0.86764246 | 0 |
args are optional arguments for constructing the url opts are data to retrieve | def initialize(args={}, &block)
@args = args
@targets = []
if block
self.instance_eval(&block)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def build_retrieve_url(args)\n url_type = args[type]\n url_device_id = args[device_id]\n url_sensor_type = args[sensot_type]\n url_retrieve_type = args[retrieve_type]\n\n complete_url = \"/data/#{url_type}/#{url_device_id}/#{url_sensor_type}/#{url_retrieve_type}\"\n\n retu... | [
"0.6584773",
"0.65480125",
"0.64939123",
"0.64838713",
"0.638941",
"0.62441",
"0.6235979",
"0.6199546",
"0.61911964",
"0.61911964",
"0.61911964",
"0.61911964",
"0.61911964",
"0.61911964",
"0.61911964",
"0.61509997",
"0.6118477",
"0.60387844",
"0.59964955",
"0.5976679",
"0.595... | 0.0 | -1 |
before_action :consultar GET /organizations/1 GET /organizations/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def org_dashboard\n respond_to do |format|\n format.html { @organization = Organization.first }\n format.json { render json: Organization.first }\n end\n end",
"def index\n redirect_to :root unless current_user.is_admin?\n @organizations = Organization.all\n end",
"def set_consultorio\n... | [
"0.6315581",
"0.6146877",
"0.6140955",
"0.61169344",
"0.6097989",
"0.60642034",
"0.60520226",
"0.60357237",
"0.6016508",
"0.60043573",
"0.60023606",
"0.60014784",
"0.60014784",
"0.60014784",
"0.60014784",
"0.60014784",
"0.60014784",
"0.60014784",
"0.60014784",
"0.60014784",
"... | 0.0 | -1 |
PATCH/PUT /organizations/1 PATCH/PUT /organizations/1.json | def update
@organization.user_updated_id = current_user.id
respond_to do |format|
if @organization.update(organization_params)
format.html { redirect_to @organization, notice: 'Información actualizada satisfactoriamente.' }
format.json { render :show, status: :ok, location: @organization }... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def UpdateOrganization params = {}\n \n APICall(path: 'organizations.json',method: 'PUT',payload: params.to_json)\n \n end",
"def update(name: nil)\n data = name.nil? ? {} : {name: name}\n cf_patch(path: \"/organizations/#{org_id}\", data: data)\n end",
"def update\n @organi... | [
"0.74092907",
"0.72068834",
"0.7111541",
"0.71057266",
"0.70979273",
"0.6975314",
"0.69394696",
"0.69285125",
"0.6913647",
"0.68745047",
"0.68745047",
"0.68361604",
"0.6831236",
"0.68225026",
"0.67911184",
"0.676107",
"0.67583406",
"0.67277133",
"0.67277133",
"0.67277133",
"0... | 0.629198 | 56 |
Use callbacks to share common setup or constraints between actions. | def set_organization
@organization = Organization.find(params[:id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_... | [
"0.6163163",
"0.6045976",
"0.5946146",
"0.591683",
"0.5890051",
"0.58349305",
"0.5776858",
"0.5703237",
"0.5703237",
"0.5652805",
"0.5621621",
"0.54210985",
"0.5411113",
"0.5411113",
"0.5411113",
"0.5391541",
"0.53794575",
"0.5357573",
"0.53402257",
"0.53394014",
"0.53321576"... | 0.0 | -1 |
Never trust parameters from the scary internet, only allow the white list through. | def organization_params
params.require(:organization).permit(
:name,
:rif,
:email,
:address,
:phone,
:user_updated_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 |
returns true if moved piece, false if not | def move_piece(piece_name, team, coordinate)
pieces = @board.get_pieces(piece_name, team)
can_move = []
pieces.each do |piece|
can_move << piece if @board.can_move?(piece, coordinate)
end
#CHECK CASTLING
if piece_name == "King"
unless pieces[0].has_moved
if check_castle(team, coordinate)
cas... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def moved?(index)\n if @@pieces[index][\"moved\"]\n return true\n else\n return false\n end\n end",
"def could_be_valid_move?\n return @board_gfx.is_draggingpiece_valid?\n end",
"def moved?(index)\n Move.pieces[index][:moved] ? true : false\n end",
"def moved?\n @moved\n e... | [
"0.81296283",
"0.78528094",
"0.77984774",
"0.7793161",
"0.7761913",
"0.77375394",
"0.77144897",
"0.7687019",
"0.76199013",
"0.761266",
"0.76107717",
"0.7446842",
"0.74199116",
"0.73906726",
"0.73749936",
"0.7367079",
"0.73655236",
"0.73655236",
"0.736448",
"0.7363448",
"0.736... | 0.0 | -1 |
returns nil if no checkmate or name of player that won if there is checkmate | def checkmate?
return @name2 if @board.checkmate?(@board.pieces, 1)
return @name1 if @board.checkmate?(@board.pieces, 2)
nil
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def winner\n\t\tvictor = false\n\t\tvictor = \"Player1\" unless @board.on_board? player2.tokens[-1][0].position\n\t\tvictor = \"Player2\" unless @board.on_board? player1.tokens[-1][0].position\n\t\tvictor\n\tend",
"def winner\n if check_rows_for_winner || check_columns_for_winner || check_diagonals_for_winner... | [
"0.7136158",
"0.70921826",
"0.70817137",
"0.7059529",
"0.6977675",
"0.6969166",
"0.69679016",
"0.6845422",
"0.6811812",
"0.67690825",
"0.6756776",
"0.67193943",
"0.66667515",
"0.66526115",
"0.6651366",
"0.6621928",
"0.6614152",
"0.6601058",
"0.6542354",
"0.65273",
"0.65225863... | 0.7232527 | 0 |
Virtual attribute for authenticating by either username or email This is in addition to a real persisted field like 'username' | def assign_role
self.role = Role.find_by name: "Aanvrager" if self.role.nil?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def login_attribute\n super\n end",
"def username\n @username || email\n end",
"def username\n username = self.name + \" \" + self.email\n\t end",
"def downcase_email_username\n self.email = email.downcase\n self.username = username.downcase\n end",
"def set_username\n r... | [
"0.7030964",
"0.68902403",
"0.6677204",
"0.66488284",
"0.6535422",
"0.6505948",
"0.64728385",
"0.6470033",
"0.6467896",
"0.6453128",
"0.6386226",
"0.6380835",
"0.6380835",
"0.6380835",
"0.6380835",
"0.63468784",
"0.6342363",
"0.6341589",
"0.6311187",
"0.6306197",
"0.6258747",... | 0.0 | -1 |
Need to add the ability to only see your bookmarks and category bookmarks insure correct user | def index
@categorybookmarks = CategoryBookmark.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_bookmark_check_owner\n @bookmark = Bookmark.find(params[:id])\n\n if @bookmark.user != current_user\n respond_to do |format|\n\n format.html { redirect_to root_url, alert: \"You dont have permissions for this action\"}\n\n end\n end\n end",
"def index\n\t\trespond... | [
"0.68501127",
"0.68065476",
"0.6658878",
"0.66234785",
"0.65524346",
"0.65350693",
"0.65238297",
"0.65234125",
"0.65078306",
"0.6498095",
"0.6489301",
"0.64509857",
"0.6365932",
"0.63574976",
"0.6354134",
"0.63231456",
"0.62371176",
"0.6227973",
"0.61851156",
"0.6184392",
"0.... | 0.0 | -1 |
This method will return the user object of the currently signed in user Returns nil if not signed in | def current_user
if(session[:user_id])
@u ||= User.first(id: session[:user_id])
return @u
else
return nil
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def authenticated_user\n if session[:user_id].nil?\n return nil\n else\n return User.find(session[:user_id])\n end\n end",
"def getLoggedInUser\n if session[:user_id]\n return User.find(session[:user_id])\n else\n return nil\n end\n end",
"def c... | [
"0.8409964",
"0.829934",
"0.82523227",
"0.8243354",
"0.816909",
"0.8135597",
"0.807751",
"0.80428314",
"0.8040612",
"0.8038677",
"0.80298156",
"0.80208105",
"0.7995469",
"0.7995469",
"0.7995469",
"0.7984957",
"0.7982638",
"0.79345214",
"0.7931915",
"0.7923639",
"0.79188436",
... | 0.8128513 | 9 |
if the user is not signed in, will redirect to login page | def authenticate!
if !current_user
redirect "/login"
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def auth\n #redirect to login page unless already logged in\n redirect_to new_user_session_path, alert: \"You must login to access that page\" unless logged_in?\n end",
"def authenticate_user\n redirect_to \"/login\" unless logged_in?\n end",
"def authenticate_user\n redirect_to root_path u... | [
"0.85041475",
"0.83932316",
"0.8382496",
"0.82858115",
"0.82819813",
"0.82710826",
"0.8244852",
"0.8237731",
"0.82004553",
"0.81980324",
"0.81859344",
"0.8164383",
"0.8162151",
"0.815686",
"0.81457675",
"0.81389344",
"0.81316805",
"0.8130777",
"0.8130777",
"0.81200445",
"0.81... | 0.0 | -1 |
if the user is not admin, will redirect to home page | def administrate!
if current_user.admin == false
redirect "/home"
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def admin_user\n redirect_to(root_path) unless is_admin?\n end",
"def admin_user\n redirect_to(root_url) unless current_user.admin? # se current_user.admin for falso redireciona para pagina principal\n end",
"def admin_user\n\t\t\tredirect_to(root_url) unless current_user.admin?\n\t end",
... | [
"0.87880343",
"0.87618697",
"0.8751413",
"0.8710242",
"0.8710242",
"0.87093705",
"0.87093705",
"0.87093705",
"0.87093705",
"0.87045133",
"0.87045133",
"0.87045133",
"0.8664462",
"0.8664462",
"0.8664462",
"0.8664462",
"0.8664462",
"0.8664462",
"0.8664462",
"0.8664462",
"0.8664... | 0.85297585 | 100 |
Returns a total quantity of advised companies addons | def advised_company_add_ons_quantity
return 0 if not has_active_subscription?
add_ons = subscription.add_ons
return 0 if add_ons.empty?
by_advised_company_add_on_code = lambda { |add_on| add_on['add_on_code'] == ADVISED_COMPANY_ADD_ON_CODE }
advised_company_add_on = add_ons.find(&by_advised_compan... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def total_inventory_valuation(company, as_on_date)\n products = company.products.where(:inventory=> true)\n valuation_amount =0\n products.each do |product|\n valuation_amount += product.inventory_valuation(as_on_date)\n end\n return valuation_amount\n end",
"def experience_bon... | [
"0.63421524",
"0.627167",
"0.6162234",
"0.61431795",
"0.6125673",
"0.60598534",
"0.59750944",
"0.59381294",
"0.59353596",
"0.5884259",
"0.5884259",
"0.58824825",
"0.58691704",
"0.58691704",
"0.58688265",
"0.5868193",
"0.5868193",
"0.58617824",
"0.58605534",
"0.58605534",
"0.5... | 0.8001372 | 0 |
Terminate an active subscription | def terminate_subscription_for(company)
subscriber = company.subscriber
terminated = subscriber.terminate_subscription
company.subscription.update_attribute(:terminated_by_advisor, true) if terminated
terminated
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cancel_subscription\n case stripe_customer.subscription.status\n when 'active'\n stripe_customer.cancel_subscription(at_period_end: true)\n when 'trialing'\n stripe_customer.cancel_subscription(at_period_end: false)\n end \n rescue Stripe::StripeError => e\n log_stripe_error(e... | [
"0.7355941",
"0.73160267",
"0.6958567",
"0.68507516",
"0.67745185",
"0.67103034",
"0.6688916",
"0.66491866",
"0.662244",
"0.6477377",
"0.64756954",
"0.64340216",
"0.64019257",
"0.63789254",
"0.6369564",
"0.6362362",
"0.6362346",
"0.63482803",
"0.6344524",
"0.63175994",
"0.629... | 0.7098674 | 2 |
Add a type alias. Also modifies type map. | def alias_entry(from, to)
from = to_key(from)
to = to_key(to)
@aliases[from] = to
clone_entry(from, to)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def type_alias(alias_name)\n registered_aliases.push(String(alias_name))\n self\n end",
"def register_alias(type, shortcut); end",
"def create_alias(new_name, old_type)\n register(validate_type_argument(old_type), name: new_name)\n end",
"def type_alias(name, typ)\n raise Ru... | [
"0.7672064",
"0.70397604",
"0.69927275",
"0.68279696",
"0.6795114",
"0.66243",
"0.66243",
"0.66043",
"0.65162575",
"0.6462303",
"0.6450739",
"0.6360035",
"0.6344077",
"0.6343423",
"0.63375765",
"0.6292116",
"0.62890184",
"0.62740755",
"0.6265863",
"0.6260311",
"0.62126815",
... | 0.0 | -1 |
Looks up first in the annotation options, then in the type options. | def lookup_entry(attribute, options, type)
(get_entry(type) || {}).dup.update(options)[attribute]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def options_by_type(key)\n validation_type_overrides[key] || options[key]\n end",
"def option_type_config; end",
"def process_options\n fields = options[:fields]\n if fields && fields.size > 0 && !fields.include?(:_type)\n if fields.kind_of?(Hash)\n fields[:_type] ... | [
"0.59130716",
"0.58847547",
"0.5816491",
"0.57729584",
"0.5761075",
"0.57373977",
"0.5655661",
"0.5631273",
"0.5554039",
"0.54915977",
"0.54822063",
"0.54725915",
"0.53807855",
"0.5320661",
"0.5305519",
"0.52845156",
"0.52687216",
"0.5218577",
"0.51992506",
"0.51979303",
"0.5... | 0.0 | -1 |
Returns a C++ declaration | def var_decl(type, name)
if entry = get_entry(type)
entry[:ctype].gsub("%s", name.to_s)
# FIXME type.to_s
elsif type.to_s.include?("%s")
type.gsub("%s", name.to_s)
else
"#{type} #{name}"
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_declaration(codeClass, cfg)\n return \"\"\n end",
"def parse_declaration(input = T.unsafe(nil)); end",
"def get_declaration(cls, bld, funItem)\n eqString = String.new\n\n bld.add(Utils.instance.getStyledClassName(cls.getUName()))\n bld.sameLine(\"(const \" + Utils.instance.getStyledC... | [
"0.6721344",
"0.63822216",
"0.6222487",
"0.6188036",
"0.6154247",
"0.6125779",
"0.6106524",
"0.60559154",
"0.6029916",
"0.60186285",
"0.6002276",
"0.5999633",
"0.595482",
"0.595482",
"0.59215826",
"0.58519477",
"0.5840775",
"0.58308524",
"0.5827363",
"0.5819",
"0.57711",
"0... | 0.50937754 | 64 |
Returns true if Ruby C conversion for this type is possible | def can_convert?(type)
get_entry(type) ? true : false
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def native_based_primitive?\n return false unless pacemaker_options[:native_based_primitive_classes].is_a? Array\n return false unless pacemaker_options[:native_based_primitive_classes].any?\n pacemaker_options[:native_based_primitive_classes].include? primitive_class name\n end",
"def builtin_type?\n\... | [
"0.61795455",
"0.6080604",
"0.60675466",
"0.5939685",
"0.5907895",
"0.5902121",
"0.5860411",
"0.5853721",
"0.5846073",
"0.58428913",
"0.58425707",
"0.58347046",
"0.58010894",
"0.5794748",
"0.57822865",
"0.5741578",
"0.5720393",
"0.5700774",
"0.5695998",
"0.56912833",
"0.56867... | 0.5487312 | 45 |
env contains parameters Accepts the environment variables, parses the headers Identifies and subscribes to the channel and returns a 202 accepted On successful subscription activate on message callbacks which should return a deferred respose Async.callback | def respond(env)
@env = env
@deferrable_response = IODemon::DeferrableResponse.new
request = ::Rack::Request.new(@env)
channel = request.params["channel"]
# puts "*" * 50
# puts "Channel: #{channel}"
# puts "*" * 50
return IODemon::Rack::Responses::NOT_ACCEPTABLE unless channel.present?
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def on_open(env)\n @subscription = @config.consumer(env).subscription(@config.channel(env))\n @subscription.on_message {|message, consumer| send_data message }\n @subscription.subscribe\n end",
"def prepare_connection(env)\n env.trace 'init connection'\n @env = env\n init_queue\n... | [
"0.63147056",
"0.62285656",
"0.5728997",
"0.5574882",
"0.54855347",
"0.5441229",
"0.5372498",
"0.5369023",
"0.5240136",
"0.5209203",
"0.5162778",
"0.51159465",
"0.506932",
"0.505723",
"0.49261108",
"0.49126524",
"0.49084643",
"0.4902552",
"0.48962834",
"0.48733947",
"0.487339... | 0.60588837 | 2 |
initialize: allowing the user to set the instance variables to use throughout the class | def initialize(state_of_origin, population_density, population)
@state = state_of_origin
@population = population
@population_density = population_density
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initialize(*args)\n set_instance_variables args\n end",
"def initialize() end",
"def initialize(*args)\n set_instance_variables args if args.size > 0\n end",
"def initialize\n init\n end",
"def init; end",
"def init; end",
"def init; end",
"def init; end",
"def initialize\n\n\te... | [
"0.820656",
"0.79142916",
"0.7911624",
"0.7882808",
"0.7864399",
"0.7864399",
"0.7864399",
"0.7864399",
"0.7838501",
"0.7838501",
"0.7812796",
"0.78019905",
"0.78019905",
"0.77893203",
"0.77737725",
"0.77737725",
"0.77737725",
"0.7753292",
"0.7753292",
"0.7726742",
"0.7723554... | 0.0 | -1 |
virus_effects: pulling data from state_data.rb and taking information to plug into the method (the final equation) | def virus_effects
predicted_deaths
speed_of_spread
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def virus_effects \n # predicted_deaths(@population_density, @population, @state) - ORIGINAL\n # speed_of_spread(@population_density, @state) - ORIGINAL\n # REFACTOR\n predicted_deaths\n speed_of_spread\n end",
"def virus_effects\r\n # predicted_deaths(@population_density, @population, @s... | [
"0.7763506",
"0.7757491",
"0.7726507",
"0.77187604",
"0.7630522",
"0.75794363",
"0.75787103",
"0.75055",
"0.74733645",
"0.7464089",
"0.7464089",
"0.7464089",
"0.7464089",
"0.7464089",
"0.7464089",
"0.7464089",
"0.7464089",
"0.7456706",
"0.7456706",
"0.74417603",
"0.74417603",... | 0.0 | -1 |
does method inside of the class but doesn't but can not access method outside of the class take information from state_data and predict number of deaths in those states based on population density, population in general of that state | def predicted_deaths
# predicted deaths is solely based on population density
if @population_density >= 200
number_of_deaths = num_death_setter(0.4)
elsif @population_density >= 150
number_of_deaths = num_death_setter(0.3)
elsif @population_density >= 100
number_of_deaths = num_de... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def access_state_data\n STATE_DATA.each do |state, population_hash|\n VirusPredictor.new(state, population_hash[:population_density], population_hash[:population]).virus_effects\n end\nend",
"def all_states\n STATE_DATA.each do |x, y|\n state = VirusPredictor.new(x, STATE_DATA[x][:population_density], ... | [
"0.749789",
"0.7376329",
"0.73094976",
"0.7200475",
"0.7159345",
"0.7056651",
"0.7025908",
"0.6959599",
"0.6813297",
"0.6806105",
"0.67572963",
"0.6728555",
"0.67044",
"0.66988176",
"0.6690227",
"0.6667916",
"0.6606681",
"0.66028434",
"0.65949357",
"0.65699077",
"0.6567841",
... | 0.6313995 | 48 |
calculating the speed at which the population will become infected based on the states population density | def speed_of_spread #in months
# We are still perfecting our formula here. The speed is also affected
# by additional factors we haven't added into this functionality.
speed = 0.0
if @population_density >= 200
speed += 0.5
elsif @population_density >= 150
speed += 1
elsif @populatio... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def speed_of_spread #(population_density, state) #in months\r\n # We are still perfecting our formula here. The speed is also affected\r\n # by additional factors we haven't added into this functionality.\r\n\r\n if @population_density >= 200\r\n speed = 0.5\r\n elsif @population_density >= 150\r\... | [
"0.8241415",
"0.82275915",
"0.8038759",
"0.7962115",
"0.7918625",
"0.77835923",
"0.77835923",
"0.7775249",
"0.7751164",
"0.7737276",
"0.7719237",
"0.77112204",
"0.7693267",
"0.768537",
"0.7667661",
"0.7652961",
"0.7652024",
"0.7644157",
"0.7644157",
"0.7641656",
"0.7638695",
... | 0.0 | -1 |
======================================================================= DRIVER CODE initialize VirusPredictor for each state pulling information from state_Data and plugging it into class VirusPredictor | def show_all_states(hash)
hash.each do |key,state|
all_state = VirusPredictor.new(key, state[:population_density], state[:population])
all_state.virus_effects
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def all_states\n STATE_DATA.each do |x, y|\n state = VirusPredictor.new(x, STATE_DATA[x][:population_density], STATE_DATA[x][:population], STATE_DATA[x][:region], STATE_DATA[x][:regional_spread])\n state.virus_effects\n end\nend",
"def access_state_data\n STATE_DATA.each do |state, population_hash|\n ... | [
"0.8008362",
"0.7904392",
"0.7750009",
"0.77362496",
"0.7567737",
"0.7454",
"0.72833943",
"0.72107536",
"0.7205012",
"0.6888219",
"0.68369013",
"0.6747654",
"0.6354393",
"0.62439215",
"0.60144204",
"0.59954244",
"0.59947604",
"0.59709394",
"0.5958171",
"0.59206843",
"0.581036... | 0.6505932 | 12 |
This program demonstrates how the pop method is destructive, while the select method is not. | def mutate(arr)
arr.pop
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pop; end",
"def pop; end",
"def pop; end",
"def pop; end",
"def pop; end",
"def pop() end",
"def pop()\n \n end",
"def pop()\n \n end",
"def pop()\n \n end",
"def pop\r\n # IMPLEMENT ME\r\n end",
"def pop\n end",
"def unselect; end",
"def deselect\n ... | [
"0.70116264",
"0.70116264",
"0.70116264",
"0.70116264",
"0.70116264",
"0.699551",
"0.6614294",
"0.6614294",
"0.6614294",
"0.658434",
"0.6552858",
"0.65132904",
"0.6453986",
"0.64176625",
"0.64074236",
"0.6397137",
"0.63769084",
"0.6294934",
"0.6294828",
"0.6287347",
"0.626949... | 0.0 | -1 |
Part 1: Access multiple elements of a nested array Pseudocode Initial Solution | def create_word(board, *coords)
@boggle_board = board
coords.map { |coord| board[coord.first][coord.last]}.join("")
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sub_arrays(arr)\n sub_arr = []\n i_arr = []\n arr.length.times do |x|\n arr.map do |ele1|\n i_arr += [ele1]\n sub_arr << i_arr\n end\n i_arr = []\n arr.shift\n end\n sub_arr\nend",
"def nested_array\n curr = @nested\n @list.each do |num|\n r = rand(3)\n if r == 1\n ... | [
"0.64195484",
"0.6259801",
"0.615396",
"0.5885334",
"0.5885334",
"0.58823496",
"0.5862445",
"0.5828345",
"0.58196026",
"0.5818722",
"0.57510954",
"0.57503086",
"0.57246333",
"0.57139343",
"0.5653048",
"0.564493",
"0.56416774",
"0.5628169",
"0.56189114",
"0.5595629",
"0.559120... | 0.0 | -1 |
=> creates what california slang word? rad Reflection Part 2: Write a method that takes a row number and returns all the elements in the row. Pseudocode Initial Solution | def get_row(row,board)
return board[row]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def row_search \n horizontal_words = []\n search = @@boards_templates[1].to_s.scan(/...../).each_slice(1).to_a\n rows = search.join \n @@boards_templates[0].each { |x| rows.include?(x) ? horizontal_words << x : rows.reverse.include?(x) ? horizontal_words << x : \"No hay palabras en dirección horiz... | [
"0.6270586",
"0.60535884",
"0.60095793",
"0.5959492",
"0.5830256",
"0.5799173",
"0.579041",
"0.5781229",
"0.5757052",
"0.56534904",
"0.56424385",
"0.56009376",
"0.5598756",
"0.5562154",
"0.5547776",
"0.55259484",
"0.55151147",
"0.54981697",
"0.5492956",
"0.5462707",
"0.544837... | 0.54325324 | 23 |
=> ["i", "o", "d", "t"] Reflection Part 3: Now write a method that takes a column number and returns all the elements in the column. Pseudocode input: column, board output: all thoses values in column in one array steps: =begin DEF get_col function that takes arguments column and board DEF a new array answer FOR each e... | def get_col(column)
create_word(@boggle_board, [0,column], [1,column], [2,column], [3,column]).split("")
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_col(col)\n boggle_board = [\n\t \t\t\t\t[\"b\", \"r\", \"a\", \"e\"],\n\t [\"i\", \"o\", \"d\", \"t\"],\n\t [\"e\", \"c\", \"l\", \"r\"],\n\t [\"t\", \"a\", \"k\", \"e\"]\n\t \t\t\t\t\t\t\t]\ncol_arr = []\nrow_num = boggle_board.length\nrow_num.times ... | [
"0.8229565",
"0.8105714",
"0.7902258",
"0.7855425",
"0.77193224",
"0.7683532",
"0.76656353",
"0.7635395",
"0.7611165",
"0.7590895",
"0.74906725",
"0.74712694",
"0.7446124",
"0.7410582",
"0.73871624",
"0.73275894",
"0.7280709",
"0.7261201",
"0.72384316",
"0.72209233",
"0.71826... | 0.7449244 | 12 |
Builds a list of deliveries for potential changes Some from the past, some from future, and the order's actual one. | def setup_deliveries(order)
recent_deliveries = order.market.deliveries.recent.active.uniq
future_deliveries = order.market.deliveries.future.active.uniq
@deliveries = recent_deliveries | future_deliveries | [order.delivery]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_deliveries\n @deliveries = Hash.new\n @dup_drivers = @drivers.clone\n\n # iterate through the orders\n @orders.each do |order|\n # generate a distance metric for each driver\n @distance = Hash.new\n\n # iterate through the drivers calculating the distance to the order\n ... | [
"0.5731644",
"0.5604466",
"0.55895424",
"0.55565464",
"0.5516753",
"0.5508395",
"0.54202366",
"0.53710884",
"0.5275225",
"0.5275225",
"0.5270028",
"0.5259994",
"0.5259537",
"0.52339697",
"0.5202691",
"0.51625454",
"0.51501846",
"0.5096319",
"0.50283355",
"0.5023623",
"0.49860... | 0.7301327 | 0 |
Checks if response is truthy | def check_affirmation_of message
AFFIRMATIVE_RESPONSES.include? message.chomp.downcase
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def response?\n !!response\n end",
"def response?\n !response.nil?\n end",
"def check_response!\n body[:stat] == 'ok' || fail(ClientError, \"#{ body.inspect }\")\n end",
"def ok?(response)\n case response\n when Net::HTTPSuccess\n true\n else\n false\n end\n end... | [
"0.8232375",
"0.81993884",
"0.77520686",
"0.77392083",
"0.7700959",
"0.7617732",
"0.7533054",
"0.7476643",
"0.74493396",
"0.7383416",
"0.73618424",
"0.7334752",
"0.73288816",
"0.7317724",
"0.73017794",
"0.73004895",
"0.7299879",
"0.7293801",
"0.7280726",
"0.72754663",
"0.7258... | 0.0 | -1 |
Aliases print, adds spacing | def ask query
print query.concat "\s"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def print_alias(*) end",
"def pretty_print\n @word_display.each do |letter|\n print \"#{letter} \"\n end\n puts \"\"\n end",
"def show\n\t puts \"\t#{@spaces[0]} #{@spaces[1]} #{@spaces[2]}\"\n\t puts \"\t#{@spaces[3]} #{@spaces[4]} #{@spaces[5]}\"\n\t puts \"\t#{@spaces[6]} #{@spaces[7]} #{@... | [
"0.7340184",
"0.66597164",
"0.6430944",
"0.63301647",
"0.6232813",
"0.61103165",
"0.60592765",
"0.6023837",
"0.5946633",
"0.5840873",
"0.5838504",
"0.583106",
"0.5829139",
"0.5823024",
"0.5817317",
"0.5809229",
"0.5804157",
"0.5800301",
"0.57999855",
"0.5773208",
"0.57548773"... | 0.0 | -1 |
Delegates to the HTTP NIO response | def status_line
@response_impl.status_line
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def net_http_res; end",
"def raw_response; end",
"def handle_response(response); end",
"def handle_response(response); end",
"def response\n http = Net::HTTP.new(@options[:url], 443)\n http.use_ssl = true\n path = '/nvp'\n headers = {\n 'Content-Type' => 'appl... | [
"0.7029075",
"0.6679554",
"0.6548155",
"0.6548155",
"0.64435434",
"0.6419255",
"0.64173776",
"0.6414909",
"0.6414909",
"0.6414909",
"0.6414909",
"0.6414909",
"0.6414909",
"0.6414909",
"0.6414909",
"0.6414909",
"0.6414909",
"0.6414909",
"0.6414909",
"0.6414909",
"0.637602",
... | 0.0 | -1 |
Delegates to the HTTP NIO response | def entity
@response_impl.entity
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def net_http_res; end",
"def raw_response; end",
"def handle_response(response); end",
"def handle_response(response); end",
"def response\n http = Net::HTTP.new(@options[:url], 443)\n http.use_ssl = true\n path = '/nvp'\n headers = {\n 'Content-Type' => 'appl... | [
"0.7029075",
"0.6679554",
"0.6548155",
"0.6548155",
"0.64435434",
"0.6419255",
"0.64173776",
"0.6414909",
"0.6414909",
"0.6414909",
"0.6414909",
"0.6414909",
"0.6414909",
"0.6414909",
"0.6414909",
"0.6414909",
"0.6414909",
"0.6414909",
"0.6414909",
"0.6414909",
"0.637602",
... | 0.0 | -1 |
Get the response content type | def content_type
@content_type ||= @response_impl.entity.content_type.value
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def response_content_type\n @response_headers[\"Content-Type\"]\n end",
"def content_type\n @response_headers[\"Content-Type\"]\n end",
"def content_type\n response.content_type\n end",
"def content_type\n response_headers[\"Content-Type\"]\n end",
"def content_type\n self.clas... | [
"0.9143747",
"0.9010345",
"0.89893854",
"0.8897245",
"0.8865847",
"0.87579685",
"0.8752372",
"0.8734544",
"0.84998053",
"0.8468617",
"0.84658194",
"0.8465277",
"0.8462099",
"0.8462099",
"0.8458771",
"0.8454932",
"0.845086",
"0.845086",
"0.8440301",
"0.83613896",
"0.82081205",... | 0.8299077 | 20 |
Get the response content length | def content_length
@content_length ||= @response_impl.entity.content_length
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def length\n return unless headers['Content-Length']\n\n headers['Content-Length'].to_i\n end",
"def content_length; end",
"def content_length; end",
"def content_length; end",
"def content_length\n @content_length ||= ((s = self[HttpClient::CONTENT_LENGTH]) &&\n ... | [
"0.8554254",
"0.8371115",
"0.8371115",
"0.8371115",
"0.8370522",
"0.83528477",
"0.8308874",
"0.8266172",
"0.8141091",
"0.8084241",
"0.7997578",
"0.7892038",
"0.7833953",
"0.7824365",
"0.7643632",
"0.7517021",
"0.7461583",
"0.7461583",
"0.7446315",
"0.74354255",
"0.74077386",
... | 0.8604022 | 0 |
Get the body text | def body
@body ||= begin
begin
io = Java.java_to_ruby(
org.jruby.RubyIO.new(JRuby.runtime, entity.content).java_object
)
io.read
rescue Exception => e
puts "Error in Response#body: #{e.message}"
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def text\n body.text\n end",
"def text\n @body\n end",
"def text\n xpath(\"/html/body\").inner_text\n end",
"def text\n self.body\n end",
"def text\n text = \"\"\n\n if html_part\n text = html_part.decode_body.to_s\n @is_text_html = true\n end\n\... | [
"0.8684726",
"0.850187",
"0.8165327",
"0.78462505",
"0.7824825",
"0.7772712",
"0.77065885",
"0.76688904",
"0.7635147",
"0.7503271",
"0.7450387",
"0.7434093",
"0.74194515",
"0.7382745",
"0.73416924",
"0.7306146",
"0.73050475",
"0.72819155",
"0.7237097",
"0.72277397",
"0.722773... | 0.0 | -1 |
Explanation You will be building a calculator. A calculator can perform multiple arithmetic operations. Your function should allow the user to choose which operation is expected, enter in the values to perform the operation on, and ultimately view the result. Specification: A user should be given a menu of operations A... | def get_user_choice
puts "(+) - Addition"
puts "(-) - Subtraction"
puts "(*) - Multiplication"
puts "(/) - Division"
# puts "(**) - Exponent"
puts "(q) - Quit"
print "Enter your selection: "
gets.downcase.chomp #implicit return
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def calculator \n valid_operations = [\"add\",\"+\",\"subtract\",\"-\",\"multiply\",\"*\",\"divide\",\"/\"]\n \n # ask user for math operations \n # check if operation is valid and if not ask for a new input \n puts \"What is the math operation?\"\n operation = gets.chomp.strip.downcase \n unt... | [
"0.81025857",
"0.7939551",
"0.76871425",
"0.7680384",
"0.7626303",
"0.75893277",
"0.7577614",
"0.75653875",
"0.7546789",
"0.75114363",
"0.7464408",
"0.7461063",
"0.74444366",
"0.7394778",
"0.73739535",
"0.7373527",
"0.7319067",
"0.7309669",
"0.7304595",
"0.7284862",
"0.727531... | 0.0 | -1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.