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 /collections/1 DELETE /collections/1.json | def destroy
@collection.destroy
respond_to do |format|
format.html { redirect_to collections_url, notice: 'Collection was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n response = connection.delete(\"/collections/#{id}\")\n (200..299).include?(response.status)\n end",
"def destroy\n @collection = Collection.find(params[:id])\n @collection.destroy\n\n respond_to do |format|\n format.html { redirect_to collections_url }\n format.json ... | [
"0.7954751",
"0.7678637",
"0.7664071",
"0.7664071",
"0.7664071",
"0.7664071",
"0.7570485",
"0.7557602",
"0.7540449",
"0.7539605",
"0.75315905",
"0.74896747",
"0.7464705",
"0.7448929",
"0.7430879",
"0.72955173",
"0.7281619",
"0.7269472",
"0.7264738",
"0.7257437",
"0.7252717",
... | 0.74489444 | 15 |
Use callbacks to share common setup or constraints between actions. | def set_collection
@collection = Collection.find(params[:id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_... | [
"0.6163163",
"0.6045976",
"0.5946146",
"0.591683",
"0.5890051",
"0.58349305",
"0.5776858",
"0.5703237",
"0.5703237",
"0.5652805",
"0.5621621",
"0.54210985",
"0.5411113",
"0.5411113",
"0.5411113",
"0.5391541",
"0.53794575",
"0.5357573",
"0.53402257",
"0.53394014",
"0.53321576"... | 0.0 | -1 |
Only allow a list of trusted parameters through. | def collection_params
params.require(:collection).permit(:cl_date, :location, :tag_id, :name, :amount, :collection_type, :fix_amount)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def allowed_params\n ALLOWED_PARAMS\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def parameters_list_params\n params.require(:parameters_list).permit(:name, :description, :is_user_specific)\n end",
"def param_whitelist\n [:role, :title]\... | [
"0.69497335",
"0.6812623",
"0.6803639",
"0.6795365",
"0.67448795",
"0.67399913",
"0.6526815",
"0.6518771",
"0.64931697",
"0.6430388",
"0.6430388",
"0.6430388",
"0.63983387",
"0.6356042",
"0.63535863",
"0.63464934",
"0.63444513",
"0.6337208",
"0.6326454",
"0.6326454",
"0.63264... | 0.0 | -1 |
Return a string that is humanized renderer Eg.: text_renderer => Text | def humanize_renderer(str)
str.split("_").map{ |split| split.capitalize }[0...-1].join(" ")
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def render_tech\n object.render_tech * \", \"\n end",
"def format\n return :text if text?\n return :html if html?\n end",
"def rendered_format\n Mime[:text]\n end",
"def humanize\n # TODO\n # Inflector.humanize(self)\n end",
"def formatted_text\n\t\tc... | [
"0.6217599",
"0.6149338",
"0.6138068",
"0.60857147",
"0.5972903",
"0.59387684",
"0.5926732",
"0.5923971",
"0.5921199",
"0.59065783",
"0.5870052",
"0.5860674",
"0.5853825",
"0.58432585",
"0.5807953",
"0.57927084",
"0.57807636",
"0.57576925",
"0.57576925",
"0.574008",
"0.573539... | 0.65748143 | 0 |
4/ EXTENDED, RM 4.0.3 OK | def column_value_hook_with_extended_queries(column, item, value, options={})
hours_by_day = options.has_key?(:hours_by_day) ? options[:hours_by_day] : nil
result_column_value = nil
case column.name
################
# Smile specific : Id column a... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def user_os_complex\r\n end",
"def verdi; end",
"def private; end",
"def ext; end",
"def ext; end",
"def storage_failure; end",
"def diagnostic; end",
"def available; end",
"def available; end",
"def outdated; end",
"def server_version; end",
"def version; end",
"def version; end",
"def ... | [
"0.60216004",
"0.5717974",
"0.56841826",
"0.5536218",
"0.5536218",
"0.5514803",
"0.5503474",
"0.54973483",
"0.54973483",
"0.5439798",
"0.5393032",
"0.5380427",
"0.5380427",
"0.5380427",
"0.5380427",
"0.5380427",
"0.5380427",
"0.5380427",
"0.5380427",
"0.5380427",
"0.5380427",... | 0.0 | -1 |
6/ New method, RM 4.0.3 OK | def groupable_columns_options(query, columns)
columns_options = columns.collect do |column|
#######################
# Smile specific #245965 Rapport : critères, indication type champ personnalisé
# Smile specific : New hook
criteria_order = n... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def private; end",
"def schubert; end",
"def probers; end",
"def custom; end",
"def custom; end",
"def verdi; end",
"def method_731(base); end",
"def operations; end",
"def operations; end",
"def specie; end",
"def specie; end",
"def specie; end",
"def specie; end",
"def operation; end",
... | [
"0.71420616",
"0.6540691",
"0.6465769",
"0.6368816",
"0.6368816",
"0.63623625",
"0.62945867",
"0.62749964",
"0.62749964",
"0.6274569",
"0.6274569",
"0.6274569",
"0.6274569",
"0.618872",
"0.61880213",
"0.6135953",
"0.6074119",
"0.6044454",
"0.6029131",
"0.60132843",
"0.6010508... | 0.0 | -1 |
GET /expenses/new GET /expenses/new.xml | def new
@expense = @bucket.expenses.new
respond_to do |format|
format.html # new.html.erb
format.xml { render :xml => @expense }
format.js
format.iphone { render :layout => false}
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @expense = Expense.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @expense }\n end\n end",
"def new\n @expense = Expense.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @expense }\... | [
"0.7698009",
"0.7698009",
"0.74895585",
"0.7223368",
"0.7193849",
"0.710044",
"0.70691586",
"0.6997567",
"0.69928855",
"0.6953326",
"0.6861213",
"0.68602324",
"0.68534184",
"0.6844892",
"0.68061686",
"0.67847925",
"0.67730206",
"0.6745749",
"0.6745699",
"0.67436504",
"0.67301... | 0.0 | -1 |
POST /expenses POST /expenses.xml | def create
@expense = @bucket.expenses.new(params[:expense])
respond_to do |format|
if @expense.save
flash[:notice] = 'Expense was successfully created.'
format.html { redirect_to(@expense) }
format.xml { render :xml => @expense, :status => :created, :location => @expense }
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @expense = Expense.new(params[:expense])\n\n respond_to do |format|\n if @expense.save\n flash[:notice] = 'Expense was successfully created.'\n format.html { redirect_to expense_url(@expense) }\n format.xml { head :created, :location => expense_url(@expense) }\n e... | [
"0.66622084",
"0.66240114",
"0.6277781",
"0.6252371",
"0.62318313",
"0.6230122",
"0.61683774",
"0.6145671",
"0.6132487",
"0.6127874",
"0.61248",
"0.6060666",
"0.60051405",
"0.5961345",
"0.59579355",
"0.594407",
"0.5939226",
"0.5936809",
"0.5936809",
"0.5918574",
"0.5861648",
... | 0.0 | -1 |
DELETE /expenses/1 DELETE /expenses/1.xml | def destroy
@expense.destroy
respond_to do |format|
format.html { redirect_to(expenses_url) }
format.xml { head :ok }
format.js
format.iphone { redirect_to(@bucket) }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @expense = Expense.find(params[:id])\n @expense.destroy\n\n respond_to do |format|\n format.html { redirect_to(expenses_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @expense = Expense.find(params[:id])\n @expense.destroy\n\n respond_to do |format|\n... | [
"0.7350629",
"0.7350629",
"0.69291025",
"0.6920262",
"0.6887448",
"0.6820444",
"0.6820444",
"0.67913884",
"0.6727542",
"0.6717109",
"0.671098",
"0.66997546",
"0.66701406",
"0.66617596",
"0.6653737",
"0.66451687",
"0.6633537",
"0.6633537",
"0.662096",
"0.66042364",
"0.6575776"... | 0.64579433 | 31 |
The constructor for this operator. Expects the operand and the operator type as parameters. | def initialize(operand = nil, unary_operator_type = UnaryOperatorType::NOT)
self.operand = operand
self.operator_type = unary_operator_type
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initialize(operator)\n @operator = operator\n end",
"def initialize(operator)\n @operator = operator\n end",
"def initialize(operator, value, options = {}) \n @operator = operator\n @value = value\n @options = options\n end",
"def initialize(operand, as, exp... | [
"0.7445711",
"0.7445711",
"0.71521044",
"0.7028684",
"0.6953207",
"0.692657",
"0.6845483",
"0.6781937",
"0.6669218",
"0.66681814",
"0.66151875",
"0.65494007",
"0.6411111",
"0.63445765",
"0.632791",
"0.63273215",
"0.63192254",
"0.6303913",
"0.6277571",
"0.62770706",
"0.6277070... | 0.7583274 | 0 |
we get initial parameters from the product | def add_params
product = self.product
self.name = product.name
self.original_price = product.current_price
self.alert_price = product.current_price
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def product_params\n params.fetch(:product, {})\n end",
"def product_params\n params.fetch(:product, {})\n end",
"def product_params\n params[:product]\n end",
"def init_values\n self.status ||= 'in_stock'\n self.code ||= Helpers::RandomHelper.unique_code(Product, :code)\n se... | [
"0.66926515",
"0.66923577",
"0.65700626",
"0.6301681",
"0.6288005",
"0.62843496",
"0.6181243",
"0.61697847",
"0.61315197",
"0.61315197",
"0.6117234",
"0.6061604",
"0.6031011",
"0.601503",
"0.59737706",
"0.5957104",
"0.5953058",
"0.5942256",
"0.5920609",
"0.5899714",
"0.588782... | 0.64622986 | 3 |
destroy product if that was the last tracker that used it | def destroy_single_product
if self.product.trackers.length == 0
self.product.destroy
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def after_destroy(product)\n expire_cache_for(product)\n end",
"def destroy\n @product.destroy\n set_products\n end",
"def destroy\n @product.destroy\n end",
"def destroy\n @my_product.destroy\n end",
"def before_destroy\n self.product.destroy\n\nend",
"def destroy\n @product.d... | [
"0.7358901",
"0.7095655",
"0.7009754",
"0.6982024",
"0.6908831",
"0.6846199",
"0.6590784",
"0.6571452",
"0.654048",
"0.6492858",
"0.64719605",
"0.6465515",
"0.6449429",
"0.6435671",
"0.6428788",
"0.6426077",
"0.64214104",
"0.6389488",
"0.6351324",
"0.6344835",
"0.63372743",
... | 0.82212895 | 0 |
Initializing the participant, right before calling on_workitem or another on_ method. | def initialize(options)
@options = options
@conf = (@options['conf'] || 'params, fields, options').split(/\s*,\s*/)
@conf = %w[ params fields options ] if @conf.include?('all')
@field_prefix = @options['field_prefix'] || ''
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pre_initialize\n end",
"def post_initialize\n end",
"def pre_initialize; end",
"def at_init\n\n\t\tend",
"def before_initialize(&block); end",
"def on_initialize\n end",
"def after_initialize\n end",
"def initialize\n super\n\n self.verified = false\n self.is_complete... | [
"0.66592866",
"0.6303897",
"0.62936884",
"0.617467",
"0.6164754",
"0.61600935",
"0.61459225",
"0.61431867",
"0.6101282",
"0.60935754",
"0.6070676",
"0.60502696",
"0.588059",
"0.58570355",
"0.58570355",
"0.5854293",
"0.5851172",
"0.5845307",
"0.5845307",
"0.5816733",
"0.581673... | 0.0 | -1 |
No need for a dedicated thread when dispatching messages. Respond true. | def do_not_thread; true; end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def msg_sent?\n true\n end",
"def work(message)\n if message.is_a?(Message)\n self.count = count + 1\n\n Concurrent::IVar.new(:ok)\n else\n expected_messages_received?\n end\n end",
"def dispatch\n @queue.pop.run while @queue... | [
"0.6458014",
"0.6283421",
"0.627769",
"0.62761194",
"0.62424463",
"0.6217263",
"0.6185135",
"0.6154714",
"0.61392546",
"0.61222315",
"0.60617673",
"0.6052626",
"0.6044091",
"0.6028877",
"0.600964",
"0.59446055",
"0.5940261",
"0.5935733",
"0.5918045",
"0.59166676",
"0.590698",... | 0.0 | -1 |
Returns the exchange coordinates (a triple [ type, name, options ]). Defaults to the direct exchange. Available as a method so it can be overriden (the return value could | def exchange
opt('exchange') || [ 'direct', '', {} ]
#
# defaults to the "default exchange"...
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def location\n return @peer.getXLocationStyle.to_s, @peer.getYLocationStyle.to_s\n end",
"def to_coord\n self[:to_coord].to_sym unless self[:to_coord].blank?\n end",
"def coordinates\n @coordinates\n end",
"def to_coordinates\n coord = [x, y]\n coord << z if with_z\n ... | [
"0.5965124",
"0.5655784",
"0.5612129",
"0.55447775",
"0.54508775",
"0.5378147",
"0.53772753",
"0.5362559",
"0.53607523",
"0.5342084",
"0.53340405",
"0.531896",
"0.53117436",
"0.5261672",
"0.5237992",
"0.52374667",
"0.5221457",
"0.52145857",
"0.5211511",
"0.5208433",
"0.519871... | 0.60093635 | 0 |
Returns the message to publish. Available as a method so it can be overriden (the return value could | def message; opt('message') || encode_workitem; end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def publish( message )\n raise NotImplementedError, \"please implement 'publish'\"\n end",
"def get_message\n raise NotImplementedError.new(\"#{self.class.name}#get_message() is not implemented.\")\n end",
"def get_message\n raise NotImplementedError.new(\"#{self.class.name}#get_mess... | [
"0.6944443",
"0.6865523",
"0.6865523",
"0.6823891",
"0.68166643",
"0.68166643",
"0.67868304",
"0.6688478",
"0.6686157",
"0.6686157",
"0.6677027",
"0.66357154",
"0.6562927",
"0.6562927",
"0.6511248",
"0.64311033",
"0.6429006",
"0.64180094",
"0.64072996",
"0.6360943",
"0.636094... | 0.0 | -1 |
Returns the routing key for the message to publish. Available as a method so it can be overriden (the return value could | def routing_key; opt('routing_key'); end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def consumer_routing_key(consumer_class)\n consumer_class.routing_keys.to_a.first\n end",
"def routing_key; delivery_details[:routing_key]; end",
"def routing_key\n model.is_a?(Cocina::Models::AdminPolicy) ? 'SDR' : AdministrativeTags.project(identifier: model.externalIdentifier).first\n end",
... | [
"0.715228",
"0.68050665",
"0.64803547",
"0.6467015",
"0.6206085",
"0.6169608",
"0.6084006",
"0.60255116",
"0.6016355",
"0.5813177",
"0.5761995",
"0.5729639",
"0.5700036",
"0.56866544",
"0.56866544",
"0.5666232",
"0.56652504",
"0.5663084",
"0.56603956",
"0.56548524",
"0.565384... | 0.60407704 | 7 |
Returns whether the publish should be persistent or not. Available as a method so it can be overriden (the return value could | def persistent; opt('persistent'); end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def persistent?\n !transient?\n end",
"def persistent?\n @persistent\n end",
"def persistent?\n persistent\n end",
"def persistent?\n false\n end",
"def persistent?\n true\n end",
"def publish?\n false\n end",
"def persiste... | [
"0.8097863",
"0.79647005",
"0.7871432",
"0.78629434",
"0.782346",
"0.77669847",
"0.7750848",
"0.7750848",
"0.772557",
"0.7642968",
"0.76289076",
"0.75889623",
"0.75335777",
"0.73645973",
"0.7323199",
"0.7323199",
"0.7275133",
"0.7272327",
"0.7267632",
"0.72517055",
"0.7231432... | 0.0 | -1 |
Returns the correlation_id for the message publication. Returns '' by default. Available as a method so it can be overriden (the return value could | def correlation_id
opt('correlation_id') || ''
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def correlation_id; @message_impl.getCorrelationId; end",
"def correlation_id\n return @correlation_id\n end",
"def get_CorrelationId()\n \t return @outputs[\"CorrelationId\"]\n \tend",
"def get_CorrelationId()\n \t return @outputs[\"CorrelationId\"]\n \tend",
"def g... | [
"0.80083495",
"0.75710577",
"0.6714652",
"0.6714652",
"0.6564549",
"0.64110315",
"0.6227291",
"0.6164732",
"0.6114811",
"0.6106958",
"0.61048853",
"0.6016644",
"0.601567",
"0.6003379",
"0.5979137",
"0.59705144",
"0.5950326",
"0.59313744",
"0.58589363",
"0.58016694",
"0.575486... | 0.7522826 | 2 |
Returns something trueish if the participant should not reply to the engine once the publish operation is done. Available as a method so it can be overriden (the return value could | def forget; opt('forget'); end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def publish?\n false\n end",
"def should_send_email?\n self.published? && !self.email_sent?\n end",
"def replyable?\n false\n end",
"def publishing?\n # This probably does not need to be synchronized\n @publishing\n end",
"def can_send?\n !sent?\n ... | [
"0.6986968",
"0.67302483",
"0.6704671",
"0.66015285",
"0.6532949",
"0.651847",
"0.6517061",
"0.64993143",
"0.6411391",
"0.63976014",
"0.63789326",
"0.637118",
"0.63459736",
"0.6294316",
"0.62938046",
"0.6293127",
"0.6274953",
"0.62409645",
"0.62270784",
"0.6217874",
"0.621218... | 0.0 | -1 |
How a workitem is turned into an AMQP message payload (string). Feel free to override this method to accommodate your needs. | def encode_workitem
workitem.as_json
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def encode_workitem( wi )\n wi.attributes['reply_queue'] = AMQPListener.queue\n OpenWFE::Json.encode( wi.to_h )\n end",
"def message; opt('message') || encode_workitem; end",
"def encode_workitem (wi)\n\n msg = wi.to_h\n msg = YAML.dump(msg)\n msg = Base64.encode64(msg)\... | [
"0.7289454",
"0.68946",
"0.67198133",
"0.67198133",
"0.6373974",
"0.6253218",
"0.6210384",
"0.6062712",
"0.60201764",
"0.5985146",
"0.5954152",
"0.5909096",
"0.584149",
"0.5830905",
"0.5821324",
"0.5802912",
"0.5774104",
"0.57039684",
"0.57023704",
"0.56245583",
"0.5610957",
... | 0.6502237 | 4 |
How a "cancelitem" is turned into an AMQP message payload (string). Feel free to override this method to accommodate your needs. | def encode_cancelitem
Rufus::Json.encode(
'cancel' => true, 'fei' => @fei.h, 'flavour' => @flavour)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cancel_item(message)\n request(:cancel_item, Boolean, message)\n end",
"def cancel (cancelitem)\n\n Workitem.destroy_all([ 'fei = ?', cancelitem.fei.to_s ])\n # note that delete_all was not removing workitem fields\n # probably my fault (bad :has_many setting)\n end",
"def... | [
"0.6911291",
"0.5881666",
"0.5877182",
"0.587107",
"0.58417517",
"0.5814218",
"0.57219344",
"0.5571052",
"0.55424094",
"0.55424094",
"0.54702187",
"0.54185736",
"0.5364931",
"0.53576285",
"0.53530097",
"0.53055406",
"0.5300707",
"0.52382827",
"0.52187884",
"0.52122706",
"0.52... | 0.73078406 | 0 |
Default AMQP.connect method. Feel free to override this method to accommodate your needs (See the README for an example). | def amqp_connect
ocon = opt('connection')
if BOSS.connection && ( ! ocon)
BOSS.connection
else
Bunny.new(Ruote.keys_to_sym(ocon || {}))
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def connect\n # backwards compatible code\n @host ||= ::Ragnar::Config.host\n @port ||= ::Ragnar::Config.port\n @connection = ::AMQP.connect({:host => @host, :port => @port})\n end",
"def connect opts={}\n unless EM.reactor_running?\n Thread.new { EventMachine.run... | [
"0.83128774",
"0.7833769",
"0.7377829",
"0.7312974",
"0.7308071",
"0.7290593",
"0.70497084",
"0.6969204",
"0.6955746",
"0.6849436",
"0.6836601",
"0.679484",
"0.6660154",
"0.6644683",
"0.66326714",
"0.66144687",
"0.65986794",
"0.6597572",
"0.65525526",
"0.65493965",
"0.654123"... | 0.74843645 | 2 |
Given connection options passed at registration time (when the participant is registered in ruote) or from the process definition, returns a Bunny::Channel instance. | def channel
Thread.current['_boss_amqp_channel'] ||= amqp_connect.create_channel
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def channel\n @channel ||= Proletariat.connection.create_channel\n end",
"def channel\n @channel ||= Proletariat.connection.create_channel\n end",
"def channel\n # Create new channel if closed\n if @channel.nil? || @channel.closed?\n @channel = connection.create_channel\n ... | [
"0.6616983",
"0.6616983",
"0.6474393",
"0.64182806",
"0.6158137",
"0.6117933",
"0.607823",
"0.60629743",
"0.6002163",
"0.5976246",
"0.59442663",
"0.5867937",
"0.5840667",
"0.58095604",
"0.5779803",
"0.5721828",
"0.5698306",
"0.5650072",
"0.56491375",
"0.5599275",
"0.55537295"... | 0.6272807 | 4 |
Given exchange options passed at registrations time or from the process definition, returns a Bunny::Exchange instance. | def instantiate_exchange
Thread.current['_boss_amqp_exchange'] ||= begin
exc = exchange
type, name, options = exc
raise ArgumentError.new(
"couldn't determine exchange from #{exc.inspect}"
) unless name
exchange_opts = (options || {}).each_with_object({}) { |(... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def exchange\n @exchange ||= produce_exchange\n end",
"def exchange\n @exchange ||= Hightops.connection.channel.exchange(exchange_naming.to_s, type: exchange_type, durable: true)\n end",
"def exchange\n\n opt('exchange') || [ 'direct', '', {} ]\n #\n # defaults to the \"default e... | [
"0.70989555",
"0.6885886",
"0.6880292",
"0.6702446",
"0.64478153",
"0.63074875",
"0.60515505",
"0.5957646",
"0.59250546",
"0.5738746",
"0.5696357",
"0.56869876",
"0.5660143",
"0.5657831",
"0.56431204",
"0.558735",
"0.55684674",
"0.55684674",
"0.55684674",
"0.55684674",
"0.556... | 0.7398569 | 0 |
The mechanism for looking up options like 'connection', 'exchange', 'routing_key' in either the participant options, the process definition or the workitem fields... | def opt(key)
@conf.each do |type|
container = (type == 'options' ? @options : workitem.send(type))
k = type == 'fields' ? "#{@field_prefix}#{key}" : key
return container[k] if container.has_key?(k)
end
nil
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def process_options\n \n end",
"def process_options\n \n end",
"def process_options\n \n end",
"def process_options\n \n end",
"def job_options\n end",
"def get_options; end",
"def user_options; end",
"def options() end",
"def reqopt(type, queue = nil)\n raise unless... | [
"0.63129985",
"0.63129985",
"0.63129985",
"0.6222892",
"0.6027795",
"0.5910994",
"0.58980805",
"0.5844141",
"0.5842651",
"0.5789664",
"0.5758626",
"0.5716652",
"0.5708395",
"0.5703298",
"0.56822485",
"0.5661976",
"0.5661976",
"0.5661976",
"0.5661976",
"0.5661976",
"0.5661976"... | 0.5525166 | 89 |
Saves instance of artist in the 'all' array | def save
self.class.all << self
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def save \n# # - this method will add Song instances to the @@all array\n @@all << self \n end",
"def artist=(artist_obj)\n @artist = artist_obj\n\n #self is a song obj\n artist_obj.songs.push(self)\n end",
"def save\n @@all << self\n end",
"def save\n @@all << self\n end",
"def... | [
"0.7417234",
"0.700113",
"0.6924737",
"0.6907827",
"0.6907827",
"0.6907827",
"0.6907827",
"0.6907827",
"0.6907827",
"0.6907827",
"0.6907827",
"0.6906484",
"0.6891921",
"0.6843107",
"0.68415874",
"0.6766924",
"0.6660642",
"0.66546345",
"0.664455",
"0.66432256",
"0.6622108",
... | 0.6146921 | 55 |
Define method as delegator instance method with an optional alias name m_alias. Method calls to alias will be delegated to accessor.method. | def delegate(obj, method, m_alias = method)
dynlink(m_alias) do |*args|
instance = (obj[0] == "@") ?
instance_variable_get(obj) :
send(obj)
instance.send(method, *args)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def def_delegator(accessor, method, alias_ = method, **kwd)\n kwd, alias_ = alias_, method if alias_.is_a?(Hash) && !kwd.any?\n\n if alias_.is_a?(Hash) || !kwd.any?\n Forwardable.instance_method(:def_delegator).bind(self) \\\n .call(accessor, method, alias_)\n\n elsif !kwd[:type]\n ... | [
"0.7727208",
"0.7211998",
"0.7177099",
"0.690848",
"0.6861208",
"0.6810771",
"0.6759139",
"0.6731365",
"0.67297715",
"0.667843",
"0.6643847",
"0.6618874",
"0.6618874",
"0.6482003",
"0.64487034",
"0.64217544",
"0.64036965",
"0.64031804",
"0.6377554",
"0.63313234",
"0.6192061",... | 0.7400482 | 1 |
Import Callable as a method | def externalize(obj, m_alias)
dynlink(m_alias) do |*args|
obj.call(*args)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def import(meth, recv)\n Kernel.module_eval do\n define_method(meth) {|*args| recv.send(meth, *args) }\n end\nend",
"def initialize(callable)\n @callable = callable\n freeze\n end",
"def import_method\n @import_method ||= self.class.import_method\n end",
"def import_into\n... | [
"0.6219747",
"0.604388",
"0.60091186",
"0.59039235",
"0.5893997",
"0.57798713",
"0.57798713",
"0.57798713",
"0.57798713",
"0.5698982",
"0.56868404",
"0.568494",
"0.55482435",
"0.5541432",
"0.5541432",
"0.55225843",
"0.55225843",
"0.5477981",
"0.5465095",
"0.5465095",
"0.54650... | 0.0 | -1 |
Calls another method when the instance variable is changing | def attr_accessor_callback(to_call, m)
define_method("#{m}=") do |v|
if instance_variable_get("@#{m}") != v
instance_variable_set("@#{m}", v)
method(to_call).call
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def process\n changed\n notify_observers(@pointer)\n @pointer\n end",
"def change!\n @alive = !@alive\n end",
"def change!\n @_changed = true\n unsend!\n self\n end",
"def _after_update\n # SEQUEL5: Remove\n @this = nil\n end",
"def callback\n\t\tvars = se... | [
"0.6699795",
"0.6607268",
"0.64765364",
"0.6318039",
"0.6283385",
"0.62810934",
"0.6243372",
"0.61821246",
"0.6156908",
"0.61535794",
"0.61208653",
"0.61093557",
"0.61093557",
"0.6072193",
"0.6070098",
"0.6037381",
"0.6037381",
"0.6018643",
"0.59927577",
"0.5981844",
"0.59694... | 0.0 | -1 |
End of Object.self Identity (Blank operation) | def identity
return self
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def end() end",
"def end; end",
"def end; end",
"def end; end",
"def end\n end",
"def end\n end",
"def _end!; end",
"def end\n end",
"def end\n end",
"def finish()\n #This is a stub, used for indexing\n end",
"def ending\n abstract!\n end",
"def f... | [
"0.7486183",
"0.7454907",
"0.7454907",
"0.7454907",
"0.72468245",
"0.7228349",
"0.7185504",
"0.70866454",
"0.70866454",
"0.7006939",
"0.68539757",
"0.6783218",
"0.67006403",
"0.66515344",
"0.66436267",
"0.661799",
"0.65490717",
"0.65341616",
"0.65286255",
"0.6524173",
"0.6471... | 0.0 | -1 |
Returns an Hash of instance variables :name => value | def attr_values
values = self.instance_variables.collect do |key|
[key, self.instance_variable_get(key)]
end
return Hash[values]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def attributes\n Hash[instance_variables.map { |name| [name, instance_variable_get(name)] }]\n end",
"def hash\n fields.map { |field| instance_variable_get(field[:name]) }.hash\n end",
"def to_hash\n Hash[instance_variables.map { |name| [name.to_s.gsub(\"@\",\"\").to_sym, instance_vari... | [
"0.78293645",
"0.7686278",
"0.7663033",
"0.75601065",
"0.74614835",
"0.7388186",
"0.73741436",
"0.73258275",
"0.7315693",
"0.726874",
"0.7268352",
"0.7224148",
"0.7213081",
"0.7198444",
"0.7186518",
"0.7183917",
"0.71483",
"0.71299154",
"0.7124742",
"0.7110301",
"0.71046954",... | 0.75914574 | 3 |
Create buffer (for Win32API) | def buffer(size = 4)
"\0" * size
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_buffer(contents)\n end",
"def create_buffer!\n @buffer = Hash.new { |h, k| h[k] = Array.new }\n end",
"def alloc_buffer(len, data=nil)\n if !@buffer || len>@buffer.size\n free_buffer\n @buffer = FFI::MemoryPointer.new(len, 1, false)\n end\n @buffer.put_bytes(0, data... | [
"0.6721533",
"0.6568917",
"0.6491273",
"0.6446591",
"0.6198338",
"0.61205846",
"0.60006016",
"0.59482247",
"0.59270394",
"0.570449",
"0.570449",
"0.570449",
"0.5673119",
"0.56159455",
"0.5614532",
"0.55948067",
"0.55785805",
"0.5555494",
"0.55501413",
"0.5542266",
"0.5542266"... | 0.5849933 | 9 |
Deep clone (to be improved) | def custom_deep_clone
value = self.clone
return Marshal.load(Marshal.dump(value))
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def deep_clone; end",
"def deep_clone\n Marshal.load(Marshal.dump(self))\n end",
"def deep_clone; Marshal::load(Marshal.dump(self)); end",
"def deep_clone\n cloned = self.clone\n cloned.initialize_from_copy(self)\n cloned\n end",
"def clone() end",
"def deep_clone\n Marshal::load(Marshal... | [
"0.8957084",
"0.8617692",
"0.85876405",
"0.8583133",
"0.8544574",
"0.85298336",
"0.8422425",
"0.83622485",
"0.83622485",
"0.83622485",
"0.83414",
"0.8216666",
"0.820054",
"0.8149605",
"0.81463295",
"0.81427246",
"0.81427246",
"0.81237316",
"0.8099514",
"0.8099514",
"0.8065300... | 0.75986373 | 51 |
Setup transition for the given method | def set_transition(method, target, duration, easing = :InLinear)
m = method
return method("#{m}=")[target] if duration == 0
return if (base = method(m).call).nil? || base == target
instance_variable_set("@trans_b_#{m}", base)
instance_variable_set("@trans_c_#{m}", target - base)
instance_variabl... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_transition(method)\n m = method\n return if (d = instance_variable_get(\"@trans_d_#{m}\")).nil? || d==0\n return if (t = instance_variable_get(\"@trans_t_#{m}\")) > d\n b = instance_variable_get(\"@trans_b_#{m}\")\n c = instance_variable_get(\"@trans_c_#{m}\")\n f = instance_variable_g... | [
"0.69280124",
"0.6513752",
"0.6500763",
"0.6476941",
"0.63012594",
"0.6153835",
"0.61407435",
"0.61407435",
"0.60147935",
"0.5977504",
"0.5951176",
"0.5951176",
"0.5897331",
"0.58731997",
"0.58242846",
"0.57233363",
"0.5719726",
"0.57173663",
"0.5672139",
"0.56644726",
"0.564... | 0.7300128 | 0 |
Update transition for the given method | def update_transition(method)
m = method
return if (d = instance_variable_get("@trans_d_#{m}")).nil? || d==0
return if (t = instance_variable_get("@trans_t_#{m}")) > d
b = instance_variable_get("@trans_b_#{m}")
c = instance_variable_get("@trans_c_#{m}")
f = instance_variable_get("@trans_f_#{m}")... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_transition\r\n # If transition is processing\r\n if $game_temp.transition_processing\r\n # Clear transition processing flag\r\n $game_temp.transition_processing = false\r\n # Execute transition\r\n if $game_temp.transition_name == \"\"\r\n Graphics.transition(20)\r\n ... | [
"0.6855807",
"0.68323994",
"0.6699976",
"0.64358604",
"0.620832",
"0.6204268",
"0.6095183",
"0.6095183",
"0.60261333",
"0.5985212",
"0.5980711",
"0.59373283",
"0.59373283",
"0.59373283",
"0.58555865",
"0.577821",
"0.5760814",
"0.5727261",
"0.57246834",
"0.57150817",
"0.567726... | 0.80290806 | 0 |
Cast integer to digit | def to_digit
return NUMBER[self] if self <= 9 && self >= 0
NUMBER[0]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_i(base=10) end",
"def to_int() end",
"def to_int() end",
"def digitize(n)\n n.to_s.chars.map(&:to_i)\nend",
"def digitize(n)\n n.to_s.chars.map(&:to_i)\nend",
"def digitize(n)\n n.digits\nend",
"def to_2digit(number)\n if number < 9\n number=\"0\"+number.to_s\n else\n number=number.to... | [
"0.73920345",
"0.7333855",
"0.7333855",
"0.71020514",
"0.71020514",
"0.70861226",
"0.7047405",
"0.6908735",
"0.6899399",
"0.6899154",
"0.687608",
"0.6874464",
"0.6865847",
"0.68579155",
"0.68495905",
"0.68415487",
"0.6808824",
"0.68011224",
"0.6795483",
"0.67865855",
"0.67748... | 0.75519556 | 0 |
Extract Point object from array "[x,y]" or "[Point]" | def to_point
if length == 2
p = Point.new(*self)
elsif length == 1
p = self[0].clone
end
return p
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_a\n [x_point,y_point]\n end",
"def point\n x = []\n y = []\n case geometry.type\n when 'MultiPolygon'\n coordinates.each { |list| append_list list, x, y }\n when 'LineString'\n append coordinates, x, y\n when 'Point'\n x << coordinates.first\n y << coordinates... | [
"0.6642379",
"0.6609655",
"0.65670365",
"0.65670365",
"0.6496746",
"0.64277405",
"0.6094152",
"0.6005626",
"0.5982081",
"0.58906996",
"0.58312094",
"0.5820954",
"0.58070034",
"0.5772802",
"0.57167065",
"0.5700178",
"0.567984",
"0.56426793",
"0.5631291",
"0.56231105",
"0.56121... | 0.692448 | 0 |
Extract x, y from array "[x,y]" or "[Point]" | def to_xy
a = self
a = [a[0].x, a[0].y] if length == 1
return *a
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_xy\n [x, y]\n end",
"def to_a\n [x_point,y_point]\n end",
"def parse_coord_args(x, y = 0)\n if x.is_a?(String)\n x, y = *Axlsx.name_to_indices(x)\n end\n if x.is_a?(Cell)\n x, y = *x.pos\n end\n if x.is_a?(Array)\n x, y = *x\n end\n ... | [
"0.7011584",
"0.6994766",
"0.6837739",
"0.6807783",
"0.6699579",
"0.66158235",
"0.65197134",
"0.648923",
"0.6399156",
"0.6390653",
"0.63344175",
"0.63129795",
"0.6267922",
"0.62655115",
"0.6251937",
"0.62352186",
"0.62352186",
"0.61949694",
"0.6160307",
"0.61331856",
"0.61091... | 0.6896802 | 2 |
return self in ASCII8BIT | def to_ascii; convert_format(UTF8, ASCII8BIT);end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_utf8; convert_format(ASCII8BIT, UTF8); end",
"def utf8\n self.encode('UTF-8', 'binary', :invalid => :replace, :undef => :replace, :replace => '?')\n end",
"def toutf8; Kconv.toutf8(self) end",
"def to_ascii\n options = {\n :invalid => :replace,\n :undef => :replace,\n :replace =>... | [
"0.7473333",
"0.7358924",
"0.70689195",
"0.68423676",
"0.67519605",
"0.6735504",
"0.6672237",
"0.6658224",
"0.6658224",
"0.66313314",
"0.65863246",
"0.65742165",
"0.65684",
"0.6532898",
"0.6527204",
"0.643861",
"0.6435059",
"0.6435059",
"0.6435059",
"0.6435059",
"0.6435059",
... | 0.7612197 | 0 |
convert self in ASCII8BIT | def to_ascii!; replace(to_ascii); end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_ascii; convert_format(UTF8, ASCII8BIT);end",
"def to_utf8; convert_format(ASCII8BIT, UTF8); end",
"def toutf8; Kconv.toutf8(self) end",
"def utf8\n self.encode('UTF-8', 'binary', :invalid => :replace, :undef => :replace, :replace => '?')\n end",
"def to_ascii!; self.replace(self.to_ascii); end",... | [
"0.83020633",
"0.81778955",
"0.7416065",
"0.7409046",
"0.7016851",
"0.6978239",
"0.69001067",
"0.68099385",
"0.6786371",
"0.67760766",
"0.67692",
"0.6738731",
"0.6713119",
"0.66968864",
"0.6654996",
"0.66240764",
"0.6620183",
"0.6600153",
"0.6592339",
"0.6562045",
"0.6444436"... | 0.6663135 | 14 |
return self to UTF8 | def to_utf8; convert_format(ASCII8BIT, UTF8); end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def toutf8; Kconv.toutf8(self) end",
"def utf8\n c = self.class\n if String.method_defined? :force_encoding\n replace c.new(map(&:utf8))\n else\n self\n end\n end",
"def utf8\n self.encode('UTF-8', 'binary', :invalid => :replace, :undef => :replace, :replace => '?')\n e... | [
"0.8263505",
"0.80622697",
"0.80433625",
"0.7960527",
"0.76305413",
"0.76305413",
"0.71966493",
"0.7126885",
"0.7048167",
"0.70290726",
"0.70173496",
"0.69495577",
"0.69384235",
"0.6900439",
"0.6899102",
"0.68945324",
"0.6891665",
"0.6890791",
"0.6836022",
"0.682471",
"0.6806... | 0.77548665 | 4 |
convert self in UTF8 | def to_utf8!; replace(to_utf8); end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def toutf8; Kconv.toutf8(self) end",
"def to_utf8; convert_format(ASCII8BIT, UTF8); end",
"def utf8\n self.encode('UTF-8', 'binary', :invalid => :replace, :undef => :replace, :replace => '?')\n end",
"def utf8\n c = self.class\n if String.method_defined? :force_encoding\n replace c.new(m... | [
"0.8391115",
"0.8048779",
"0.7858691",
"0.7583317",
"0.74730235",
"0.73806626",
"0.73806626",
"0.71528465",
"0.70787483",
"0.7054214",
"0.70235676",
"0.6991398",
"0.69624764",
"0.69128126",
"0.69019043",
"0.6891964",
"0.68738735",
"0.6857967",
"0.6841649",
"0.6835401",
"0.681... | 0.78405786 | 3 |
Calcul the Damerau Levenshtein 's Distance | def damerau_levenshtein(other)
n, m = self.length, other.length
return m if n == 0
return n if m == 0
matrix = Array.new(n+1) do |i|
Array.new(m+1) do |j|
if i == 0 then j
elsif j == 0 then i
else 0 end
end
end
(1..n).each do |i|
(1..m).each do |j|
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def calculate_distance(translated_text, answer)\n DamerauLevenshtein.distance(prepare(translated_text), prepare(answer))\n end",
"def levenshtein_distance(str1, str2)\n s = str1\n t = str2\n n = s.length\n m = t.length\n\n return m if (0 == n)\n return n if (0 == m)\n\n d = (0..m).to_a\n... | [
"0.7711068",
"0.76716924",
"0.76302487",
"0.7571858",
"0.75222486",
"0.741657",
"0.7402389",
"0.7385979",
"0.7310357",
"0.72803",
"0.7264417",
"0.72344863",
"0.7208945",
"0.71680903",
"0.6969926",
"0.69489926",
"0.6934372",
"0.6914022",
"0.6872072",
"0.68074024",
"0.67845607"... | 0.7138797 | 14 |
add songs to your library | def add title, artist
$albums.each do |album, status|
# screen for duplicates
if album[0].downcase == title.downcase
puts "You already have a song by that name."
return nil
end
end
album = [title, artist]
$albums[album] = "unplayed"
# artist = artist.gsub('"', '')
puts "Added... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_songs(songs)\n songs.each { |song| add_song(song) }\n end",
"def add_songs(songs)\n songs.each { |song| add_song(song) }\n end",
"def add_songs(songs)\n songs.each { |song| add_song(song) }\n end",
"def add_song(song)\n songs << song\n end",
"def add_song(song)\n songs << son... | [
"0.8177917",
"0.8177917",
"0.8177917",
"0.7857076",
"0.7846397",
"0.7767088",
"0.7618104",
"0.7578501",
"0.7564979",
"0.7564979",
"0.7564979",
"0.7564979",
"0.7564979",
"0.7564979",
"0.75578195",
"0.75309944",
"0.74724406",
"0.7396033",
"0.7341118",
"0.73215765",
"0.7305718",... | 0.0 | -1 |
show all songs by a specific artist | def show_all_by artist
if $albums.any?
x = nil
artist_albums = []
$albums.each do |album, status|
if album[1].downcase == artist.downcase
puts "#{album[0]} by #{album[1].gsub('"', '')} (#{status})"
artist_albums.push(album)
x = true
end
end
if x == true
re... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def view_artist_songs(artist)\n artist_name = artist\n artist_id = Artist.find_by(name: artist_name).id\n songs = Song.where(artist_id: artist_id).map{|song| song.name}\n puts \"**************************\"\n puts \"**************************\"\n prompt(\"#{artist_name}'s ... | [
"0.8174135",
"0.7627778",
"0.7623308",
"0.762308",
"0.75569993",
"0.7480369",
"0.73301244",
"0.73153603",
"0.72663504",
"0.7255875",
"0.7252771",
"0.72491866",
"0.723146",
"0.72281164",
"0.7205447",
"0.7199976",
"0.7177495",
"0.7175523",
"0.7165476",
"0.71574455",
"0.71259445... | 0.0 | -1 |
show unplayed songs by a specific artist | def show_unplayed_by artist
if $albums.any?
x = nil
artist_unplayed = []
$albums.each do |album, status|
if album[1].downcase == artist.downcase
if status == "unplayed"
puts "#{album[0]} by #{album[1].gsub('"', '')}"
artist_unplayed.push(album)
x = true
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def view_artist_songs(artist)\n artist_name = artist\n artist_id = Artist.find_by(name: artist_name).id\n songs = Song.where(artist_id: artist_id).map{|song| song.name}\n puts \"**************************\"\n puts \"**************************\"\n prompt(\"#{artist_name}'s ... | [
"0.7024862",
"0.6665314",
"0.649254",
"0.64486086",
"0.6404874",
"0.6402237",
"0.6355805",
"0.62314904",
"0.621471",
"0.6213746",
"0.6168396",
"0.61638284",
"0.61550325",
"0.614816",
"0.61445683",
"0.61366934",
"0.6127493",
"0.6116851",
"0.61166704",
"0.6109793",
"0.6106188",... | 0.71577334 | 0 |
GET /asignacion_familiars GET /asignacion_familiars.json | def index
@asignacion_familiars = AsignacionFamiliar.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @familia = Familium.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @familia }\n end\n end",
"def index\n @familia = Familium.all\n end",
"def show\n @familium = Familium.find(params[:id])\n\n respond_to do |format|\n for... | [
"0.7218275",
"0.67492104",
"0.6643578",
"0.6531485",
"0.6390075",
"0.62481636",
"0.6160634",
"0.6160634",
"0.61502314",
"0.6146182",
"0.6104924",
"0.6097285",
"0.6043903",
"0.5995902",
"0.59930664",
"0.5976038",
"0.5969145",
"0.5923658",
"0.5921382",
"0.59177",
"0.5911735",
... | 0.72004366 | 1 |
GET /asignacion_familiars/1 GET /asignacion_familiars/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @familia = Familium.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @familia }\n end\n end",
"def index\n @asignacion_familiars = AsignacionFamiliar.all\n end",
"def show\n @familium = Familium.find(params[:id])\n\n respond_to... | [
"0.7359741",
"0.7223324",
"0.6915606",
"0.6842688",
"0.6673424",
"0.6539857",
"0.65026814",
"0.65026814",
"0.6487245",
"0.648587",
"0.63385284",
"0.62807226",
"0.62131685",
"0.6183756",
"0.61763114",
"0.61716956",
"0.6169945",
"0.61552525",
"0.6144874",
"0.6140274",
"0.613075... | 0.0 | -1 |
POST /asignacion_familiars POST /asignacion_familiars.json | def create
@asignacion_familiar = AsignacionFamiliar.new(asignacion_familiar_params)
respond_to do |format|
if @asignacion_familiar.save
format.html { redirect_to @asignacion_familiar, notice: 'Asignacion familiar creada exitosamente.' }
format.json { render :show, status: :created, locat... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @familium = Familium.new(params[:familium])\n\n respond_to do |format|\n if @familium.save\n format.html { redirect_to familia_path, notice: 'Familia fue creada exitosamente.' }\n format.json { render json: @familium, status: :created, location: @familium }\n else\n ... | [
"0.6884972",
"0.68544024",
"0.6835764",
"0.65892744",
"0.65817696",
"0.64905566",
"0.6422099",
"0.6357317",
"0.63176346",
"0.6267305",
"0.622651",
"0.6210565",
"0.6183936",
"0.6136921",
"0.61037576",
"0.6095569",
"0.60359746",
"0.6015163",
"0.6005451",
"0.5980955",
"0.5972091... | 0.640411 | 7 |
PATCH/PUT /asignacion_familiars/1 PATCH/PUT /asignacion_familiars/1.json | def update
respond_to do |format|
if @asignacion_familiar.update(asignacion_familiar_params)
format.html { redirect_to @asignacion_familiar, notice: 'Asignacion familiar actualizada exitosamente.' }
format.json { render :show, status: :ok, location: @asignacion_familiar }
else
fo... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n \n if params[:id]==\"edit_familias_propiedades\"\n edit_familias_propiedades\n return\n end\n \n #if params[:familia][\"articulos_grupopropiedades_attributes\"]\n# componer_articulo\n# return\n #end \n \n respond_to do |format|\n if @f... | [
"0.6928513",
"0.69161284",
"0.6762127",
"0.6695618",
"0.66536075",
"0.6552162",
"0.65212494",
"0.649081",
"0.6472495",
"0.6417595",
"0.63856524",
"0.6361644",
"0.63539654",
"0.63164806",
"0.6303633",
"0.6268184",
"0.6255153",
"0.6243087",
"0.6236582",
"0.62351364",
"0.6224746... | 0.63648814 | 11 |
DELETE /asignacion_familiars/1 DELETE /asignacion_familiars/1.json | def destroy
@asignacion_familiar.destroy
respond_to do |format|
format.html { redirect_to asignacion_familiars_url, notice: 'Asignacion familiar eliminada exitosamente.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @asignatura.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"def destroy\n @familium = Familium.find(params[:id])\n @familium.destroy\n\n respond_to do |format|\n format.html { redirect_to familia_url }\n format.json { head :no_con... | [
"0.77161556",
"0.7682693",
"0.7581327",
"0.74903303",
"0.74903303",
"0.7459824",
"0.7432243",
"0.7419323",
"0.7281992",
"0.7272112",
"0.72661966",
"0.72356963",
"0.71982086",
"0.71702474",
"0.71565634",
"0.7150124",
"0.71488756",
"0.71448475",
"0.7138916",
"0.7138598",
"0.713... | 0.7460872 | 5 |
Use callbacks to share common setup or constraints between actions. | def set_asignacion_familiar
@asignacion_familiar = AsignacionFamiliar.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.61642385",
"0.60448",
"0.5945487",
"0.5915654",
"0.58890367",
"0.58330417",
"0.5776098",
"0.5703048",
"0.5703048",
"0.5654613",
"0.5620029",
"0.5423114",
"0.540998",
"0.540998",
"0.540998",
"0.5393666",
"0.53783023",
"0.53568405",
"0.53391176",
"0.5339061",
"0.53310865",
... | 0.0 | -1 |
Never trust parameters from the scary internet, only allow the white list through. | def asignacion_familiar_params
params.require(:asignacion_familiar).permit(:tramo, :monto, :requisitoMinimo, :requisitoMaximo)
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 |
Title: Sentence Smash v1 | def smash(words)
words.join(' ')
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def wookiee_sentence; end",
"def wookie_sentence; end",
"def\n \nend\n\n\n# 6. sentence_maker refactored solution",
"def sentence; end",
"def sentence\n\t\t@markov.generate_100_words\n\tend",
"def smash(words)\n sentence = \"\"\n words.each do |w|\n sentence = sentence + \"#{w} \"\n end\n sentence[... | [
"0.7396309",
"0.71534884",
"0.6998634",
"0.6617179",
"0.6516311",
"0.63488454",
"0.6278234",
"0.602322",
"0.5948714",
"0.59012794",
"0.5871539",
"0.58596456",
"0.58334124",
"0.5821405",
"0.57559264",
"0.5733659",
"0.5728337",
"0.57266796",
"0.5711701",
"0.568567",
"0.5677339"... | 0.5390763 | 66 |
GET /events GET /events.json | def index
@events = Event.all
respond_to do |format|
format.html # index.html.erb
format.json { render json: @events }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def events\n response = self.class.get('/v1/events.json')\n response.code == 200 ? JSON.parse(response.body) : nil\n end",
"def get_events\n Resources::Event.parse(request(:get, \"Events\"))\n end",
"def get_events()\n @client.make_request(:get, @client.concat_user_path(\"#{CALL_PATH}... | [
"0.8337294",
"0.82393",
"0.7943906",
"0.7928331",
"0.77682066",
"0.77408546",
"0.76701826",
"0.7665501",
"0.76581633",
"0.7642472",
"0.76212007",
"0.7615658",
"0.7615658",
"0.7612881",
"0.75687",
"0.7522498",
"0.7488667",
"0.74813455",
"0.74698067",
"0.7441679",
"0.74408287",... | 0.74091715 | 33 |
GET /events/1 GET /events/1.json | def show
@event = Event.find(params[:id])
@users = @event.users
respond_to do |format|
format.html # show.html.erb
format.json { render json: @event }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @event = Event.find(params[:id])\n render json: @event\n end",
"def get(event_id)\n @client.request \"events/#{event_id}\"\n end",
"def show\n event_id = params[:id]\n if event_id.present?\n @event = Com::Nbos::Events::Event.active_events.where(id: event_id, tenant_id: @use... | [
"0.75029767",
"0.74019474",
"0.7361382",
"0.7348975",
"0.73475033",
"0.7338018",
"0.7317425",
"0.72875094",
"0.72813755",
"0.7246173",
"0.72317284",
"0.7219172",
"0.7219172",
"0.7218839",
"0.7218839",
"0.721464",
"0.7204848",
"0.71989256",
"0.7196662",
"0.71925515",
"0.719221... | 0.0 | -1 |
GET /events/new GET /events/new.json | def new
@event = Event.new
#debugger
@options = Array.new
@options << ['Toda la web','Toda la web']
if params[:from] == 'user'
@options << ['Mi grupo','Mi grupo']
@options << ['Mis contactos','Mis contactos']
@options << ['Algunos contactos','Algunos contactos']
@group = fals... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @event = Event.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @event }\n end\n end",
"def new\n @event = Event.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @event }\n end\n end",
... | [
"0.81609446",
"0.81505513",
"0.81505513",
"0.81505513",
"0.81505513",
"0.81505513",
"0.81505513",
"0.81505513",
"0.81505513",
"0.81505513",
"0.81505513",
"0.81505513",
"0.81505513",
"0.81505513",
"0.81505513",
"0.81505513",
"0.81505513",
"0.81505513",
"0.81505513",
"0.81505513"... | 0.0 | -1 |
POST /events POST /events.json | def create
#debugger
@event = Event.new(params[:event])
@event.owner = current_user.id
#@event.update_attribute(:owner,@current_user.id)
@current_user.events << @event
respond_to do |format|
if @event.save
format.html { redirect_to @event, notice: 'Event was successfully created.'... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_event event, data={}\n data[:event] = event\n post '/event', data\n end",
"def create\n event = Event.new(event_params)\n event.save!\n render json: event\n end",
"def create\n Rails.logger.debug(\"Received event #{params[:event]}\")\n head :ok\n end",
"def crea... | [
"0.7714071",
"0.7611226",
"0.76028967",
"0.7541319",
"0.7444731",
"0.73206913",
"0.73138195",
"0.728203",
"0.7251226",
"0.7235907",
"0.7235907",
"0.7215051",
"0.71682763",
"0.7150409",
"0.7126664",
"0.7118896",
"0.7117831",
"0.71162695",
"0.70964044",
"0.70907074",
"0.7083036... | 0.0 | -1 |
PUT /events/1 PUT /events/1.json | def update
@event = Event.find(params[:id])
respond_to do |format|
if @event.update_attributes(params[:event])
format.html { redirect_to @event, notice: 'Event was successfully updated.' }
format.json { head :no_content }
else
format.html { render action: "edit" }
fo... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n if @event.update(event_params)\n render json: @event, status: 201\n else\n render json: { message: \"Error. Error. Please try again.\"}, status: 400\n end\n end",
"def put_events(args)\n\tapi_url = \"#{@base_url}/#{args[:collection]}/#{args[:key]}/events/#{args[:event_type]}\"\n\... | [
"0.75664943",
"0.74722904",
"0.7472032",
"0.7430477",
"0.7370732",
"0.7366599",
"0.7356629",
"0.73164594",
"0.73164594",
"0.73085743",
"0.72540325",
"0.72540325",
"0.72351176",
"0.7175737",
"0.71719027",
"0.7161037",
"0.7161037",
"0.7160709",
"0.71240234",
"0.71132576",
"0.70... | 0.0 | -1 |
DELETE /events/1 DELETE /events/1.json | def destroy
@event = Event.find(params[:id])
@event.destroy
respond_to do |format|
format.html { redirect_to events_url }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @event = Event.using(:shard_one).find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @event.destroy\n respond_to do |format|\n format.json { head :no_... | [
"0.769507",
"0.7689384",
"0.7689384",
"0.7689384",
"0.7682634",
"0.7587508",
"0.7570296",
"0.7562454",
"0.7542835",
"0.75425243",
"0.75425243",
"0.75425243",
"0.75425243",
"0.75425243",
"0.75425243",
"0.75425243",
"0.75425243",
"0.75425243",
"0.75425243",
"0.75425243",
"0.754... | 0.7516586 | 71 |
GET /event/1/register?userid=1 Register a user to an event | def register
@event = Event.find(params[:id])
#@user = User.find(params[:userid])
# Register a user if it is not registered already
unless @event.registered?(@current_user)
# Add event to a user's events list
@current_user.events << @event
flash[:notice] = 'User registered at the... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def register\n @event.users << current_user\n @event.save\n #flash[:notice] = \"Successfully registered for #{@event.title}\"\n respond_to do |format|\n format.js\n end\n end",
"def create\n # this one is trickier, due to users needing to be able to do it.\n # here, we want to use the ... | [
"0.6694703",
"0.66700655",
"0.66348803",
"0.66331226",
"0.66186494",
"0.6603594",
"0.6527446",
"0.6479887",
"0.64676553",
"0.6389938",
"0.63549894",
"0.63318664",
"0.6220435",
"0.61833566",
"0.6170525",
"0.61468285",
"0.60874265",
"0.6040068",
"0.6033156",
"0.60170823",
"0.59... | 0.7892869 | 0 |
Unregister a user to an event | def unregister
@event = Event.find(params[:id])
#@user = User.find(params[:userid])
@event.users.delete(@current_user)
# Redirect to the action "show"
redirect_to :action => :show, :id => @event
# Redirect to the action "users"
# Redirect to /event/1/users for event id 1
#redirect_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def unregister\n user_to_be_removed = @event.users.find(current_user)\n if user_to_be_removed\n @event.users.delete(user_to_be_removed)\n end\n #flash[:notice] = \"Unregistered for #{@event.title}\"\n respond_to do |format|\n format.js\n end\n end",
"def deregister\n @event = Even... | [
"0.8084683",
"0.7622206",
"0.7350028",
"0.7043617",
"0.70108634",
"0.696896",
"0.6954495",
"0.6831151",
"0.6789341",
"0.6735697",
"0.6708173",
"0.66141075",
"0.66131485",
"0.660875",
"0.65968496",
"0.6591798",
"0.6542478",
"0.6529763",
"0.6520444",
"0.6503039",
"0.648101",
... | 0.79049784 | 1 |
Display all users of an event GET /event/1/users | def users
@users = Event.find(params[:id]).users
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @events = Event.find(params[:id])\n @users = @events.users\n end",
"def show\n @users = @event.users\n end",
"def index\n @event = Event.find(params[:id])\n @users = @event.users\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @users... | [
"0.81001896",
"0.80598015",
"0.8051511",
"0.77966315",
"0.77966315",
"0.77530897",
"0.7614591",
"0.75906736",
"0.75906736",
"0.75906736",
"0.72519594",
"0.72345513",
"0.72231245",
"0.7220758",
"0.7147393",
"0.7082841",
"0.70812374",
"0.7074559",
"0.7074559",
"0.7067823",
"0.7... | 0.8145625 | 0 |
NOTE: if i decide to make the error message more useful on the parent then I should implement a solution similar to this one: NOTE: this only checks for new records. existing records are not checked once they are saved | def validate_uniqueness_of_new_image_url
self.errors[:"image.url"] = 'Image url has already been added to this collection' if self.dup_image?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def validates_presence_of_parent(foreign_key)\n after_save do |record|\n unless record.send(foreign_key)\n record.errors.add_on_blank(foreign_key)\n raise ActiveRecord::ActiveRecordError, record.errors.full_messages.to_sentence\n end\n end\n end",
"def check_parent\n ... | [
"0.69525754",
"0.69340163",
"0.6903813",
"0.6435508",
"0.6415046",
"0.63737506",
"0.6348704",
"0.63363546",
"0.62602454",
"0.62349784",
"0.6227645",
"0.61959773",
"0.617515",
"0.6154603",
"0.6075926",
"0.6072987",
"0.60678667",
"0.60447913",
"0.60415125",
"0.6036541",
"0.6017... | 0.0 | -1 |
Most recent vaccine dosage | def latest_dosage
dosages.order(date_given: :desc).first
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_recent_vitals\n earliest = 2.years.ago\n vital_signs.timelimit(earliest).desc(:time)\n end",
"def dominant_octopus(fishes)\n fishes.merge_sort[-1]\nend",
"def date_last_aviso\n avisos.publicados.last.created_at\n end",
"def dose_vaccine\n dose&.vaccine || follow_up_for_dose&.vaccine\... | [
"0.57265687",
"0.5621858",
"0.5605152",
"0.5543663",
"0.5482271",
"0.5400351",
"0.53853244",
"0.5363504",
"0.5317885",
"0.5279893",
"0.52458507",
"0.5240422",
"0.5236329",
"0.5216328",
"0.5206511",
"0.5204234",
"0.52023906",
"0.51442814",
"0.5141529",
"0.51324666",
"0.5129617... | 0.6610862 | 0 |
Gets the current date in the patient's timezone | def curr_date_in_timezone
Time.now.getlocal(address_timezone_offset)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def current_time\n Time.now.in_time_zone(\"Berlin\").to_date\n end",
"def today\n tzinfo.now.to_date\n end",
"def date\n Time.now.in_time_zone\n end",
"def current_zone\n ::Time.new.zone\n end",
"def today\n if time_zone.nil?\n Date.today\n else\n Time.no... | [
"0.8226668",
"0.780563",
"0.77844965",
"0.74522036",
"0.7430485",
"0.7245047",
"0.7241714",
"0.71133506",
"0.71133506",
"0.71133506",
"0.7090321",
"0.7073411",
"0.70021397",
"0.6992954",
"0.69382524",
"0.69273484",
"0.6911592",
"0.6898107",
"0.6877083",
"0.6877083",
"0.682718... | 0.8052444 | 1 |
Checks is at the end of or past their monitoring period | def end_of_monitoring_period?
return false if continuous_exposure
monitoring_period_days = ADMIN_OPTIONS['monitoring_period_days'].days
# If there is a last date of exposure - base monitoring period off of that date
monitoring_end_date = if !last_date_of_exposure.nil?
last_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def monitored_now?\n tf = circuit.monitoring_setting.todays_monitoring_times\n return false unless tf \n \n from,to = tf.split('-').map { |e| (\"%02d%02d\" % _sh(e)).to_i }\n now = (\"%02d%02d\" % [Time.now.hour, Time.now.min]).to_i\n \n $stderr.puts \"#{f... | [
"0.68366575",
"0.67889905",
"0.6745626",
"0.67050207",
"0.669508",
"0.66318625",
"0.662858",
"0.65867203",
"0.6540799",
"0.6532424",
"0.65093005",
"0.648647",
"0.6477371",
"0.63939816",
"0.63623583",
"0.63437814",
"0.6334041",
"0.6328244",
"0.6317718",
"0.6316096",
"0.6260244... | 0.693164 | 0 |
True if this person is responsible for reporting | def self_reporter_or_proxy?
responder_id == id
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def only_one_responsible?\n responsibles.count == 1\n end",
"def person_award?\n !store_award?\n end",
"def report?\n !@user.nil? && !Report.where(reportable_id: @proposal.id,\n reportable_type: 'Proposal',\n user_id: @user.id).... | [
"0.698937",
"0.69597286",
"0.6916169",
"0.67899853",
"0.6767083",
"0.676204",
"0.6693245",
"0.6653851",
"0.6632554",
"0.6585398",
"0.6564676",
"0.6529759",
"0.6504904",
"0.6461251",
"0.6457279",
"0.6443952",
"0.64415884",
"0.6428025",
"0.6364637",
"0.6353591",
"0.6342528",
... | 0.0 | -1 |
Patient name to be displayed in linelist | def displayed_name
first_name.present? || last_name.present? ? "#{last_name}#{first_name.blank? ? '' : ', ' + first_name}" : 'NAME NOT PROVIDED'
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def augmented_name_for(_patient)\n name\n end",
"def patient_name\n patient_id, qualifier = eob.patient_id_and_qualifier\n patient_name_elements = []\n patient_name_elements << 'NM1'\n patient_name_elements << 'QC'\n patient_name_elements << '1'\n patient_name_elements << eob.patien... | [
"0.6665741",
"0.66294396",
"0.6563057",
"0.63766354",
"0.6275996",
"0.6220096",
"0.6200596",
"0.61859995",
"0.61851156",
"0.6162249",
"0.6147639",
"0.6147639",
"0.61393756",
"0.6133175",
"0.608057",
"0.60355616",
"0.6032552",
"0.5973673",
"0.5966494",
"0.5927348",
"0.5897116"... | 0.0 | -1 |
Allow information on the monitoree's jurisdiction to be displayed | def jurisdiction_path
jurisdiction&.path&.map(&:name)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @jurisdiction = Jurisdiction.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @jurisdiction }\n end\n end",
"def new\n @jurisdiction = Jurisdiction.new\n\n respond_to do |format|\n format.html # new.html.erb\n f... | [
"0.68652594",
"0.6145764",
"0.61309195",
"0.59503484",
"0.5794362",
"0.5794362",
"0.57879347",
"0.567545",
"0.56116533",
"0.5609023",
"0.55524504",
"0.55430186",
"0.5534438",
"0.55150616",
"0.54747",
"0.54590654",
"0.54515153",
"0.54426885",
"0.5410044",
"0.5408808",
"0.54066... | 0.58407366 | 5 |
Get all dependents (including self if id = responder_id) that are being actively monitored, meaning: not purged AND not closed (monitoring = true) AND in continuous exposure OR in isolation OR within monitoring period based on LDE OR within monitoring period based on creation date if no LDE specified | def active_dependents
monitoring_days_ago = ADMIN_OPTIONS['monitoring_period_days'].days.ago.beginning_of_day
dependents.where(purged: false, monitoring: true)
.where('isolation = ? OR continuous_exposure = ? OR last_date_of_exposure >= ? OR (last_date_of_exposure IS NULL AND created_at >= ?)',
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def report_eligibility\n report_cutoff_time = Time.now.getlocal('-04:00').beginning_of_day\n reporting_period = (ADMIN_OPTIONS['monitoring_period_days'] + 1).days.ago\n eligible = true\n sent = false\n reported = false\n household = false\n messages = []\n\n # Workflow agnostic conditions\n... | [
"0.5749637",
"0.53202987",
"0.51684624",
"0.51643",
"0.50252676",
"0.4991624",
"0.4989913",
"0.49468136",
"0.49277678",
"0.48928365",
"0.47732234",
"0.47353283",
"0.4696625",
"0.46815816",
"0.46555805",
"0.465558",
"0.46152857",
"0.45764902",
"0.4563487",
"0.45356268",
"0.452... | 0.66982484 | 0 |
Get all dependents (excluding self if id = responder_id) that are being monitored | def active_dependents_exclude_self
active_dependents.where.not(id: id)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def dependents_exclude_self\n dependents.where.not(id: id)\n end",
"def listeners\n users_to_notify = Set.new\n users_to_notify += self.proposal.currently_awaiting_approvers\n users_to_notify += self.proposal.individual_steps.approved.map(&:user)\n users_to_notify += self.proposal.observers\n ... | [
"0.67197937",
"0.5773798",
"0.57137233",
"0.5609332",
"0.55241174",
"0.54752165",
"0.5383092",
"0.5381061",
"0.5371345",
"0.53117377",
"0.52953273",
"0.5285351",
"0.5285351",
"0.5285351",
"0.5282942",
"0.52814585",
"0.52761483",
"0.52519655",
"0.52177423",
"0.5199877",
"0.515... | 0.6347128 | 1 |
Get this patient's dependents excluding itself | def dependents_exclude_self
dependents.where.not(id: id)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def active_dependents_exclude_self\n active_dependents.where.not(id: id)\n end",
"def dependencies(include_parent = false)\n []\n end",
"def dependencies(include_parent = false)\n []\n end",
"def dependencies(include_parent = false)\n []\n end",
"def excl... | [
"0.75502163",
"0.6712525",
"0.6712525",
"0.6712525",
"0.6479356",
"0.64384514",
"0.6412101",
"0.6118397",
"0.6115338",
"0.611149",
"0.6111015",
"0.61073333",
"0.60925364",
"0.6088178",
"0.60775965",
"0.60210705",
"0.59757966",
"0.59337395",
"0.5913672",
"0.58980733",
"0.58826... | 0.8046886 | 0 |
Single place for calculating the end of monitoring date for this subject. TODO: For now, end of monitoring will be a year away from Dose 2 | def end_of_monitoring
return nil if latest_dosage.nil?
return (latest_dosage.date_given + 1.year) if latest_dosage&.dose_number == 2
# --- Previous definition
# return 'Continuous Exposure' if continuous_exposure
# return (last_date_of_exposure + ADMIN_OPTIONS['monitoring_period_days'].days)&.to_s ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def effective_end_datetime\n end_date + 1.day + roster.switchover.minutes\n end",
"def end_date\n @end_date ||= Date.new()\n end",
"def end_date\n @end_date ||= respond_to?(:constituencyGroupEndDate) ? DateTime.parse(constituencyGroupEndDate) : nil\n end",
"def end_date\n\t \... | [
"0.71678996",
"0.7143411",
"0.7045263",
"0.6958282",
"0.6950141",
"0.6942313",
"0.693923",
"0.6913093",
"0.68693507",
"0.6868072",
"0.68051535",
"0.68051535",
"0.68051535",
"0.68051535",
"0.68051535",
"0.68051535",
"0.68051535",
"0.678567",
"0.6785534",
"0.672205",
"0.6681941... | 0.75252956 | 0 |
Date when patient is expected to be purged | def expected_purge_date
(updated_at + ADMIN_OPTIONS['purgeable_after'].minutes)&.rfc2822
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def date_purchased\n return @date_purchased\n end",
"def original_purchase_date\n read_datetime_from_string('original_purchase_date')\n end",
"def purchase_date\n read_datetime_from_string('purchase_date')\n ... | [
"0.72265404",
"0.68737674",
"0.66848564",
"0.651668",
"0.65010595",
"0.6313934",
"0.6297613",
"0.6245129",
"0.62335294",
"0.6204129",
"0.6130888",
"0.61085355",
"0.60940987",
"0.6092115",
"0.6085786",
"0.60672915",
"0.6060633",
"0.60400546",
"0.60383594",
"0.60383594",
"0.603... | 0.7027658 | 1 |
Send initial enrollment notification via patient's preferred contact method | def send_enrollment_notification
return if ['Unknown', 'Opt-out', '', nil].include?(preferred_contact_method)
if email.present? && preferred_contact_method == 'E-mailed Web Link'
# deliver_later forces the use of ActiveJob
# sidekiq and redis should be running for this to work
# If these are ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def send_conference_code!\n send_sms!(\n self[:phone],\n I18n.t('activerecord.attributes.concern.sns_snsable.conference_code',\n did: dialer.did, conference_code: dialer.conference_code)\n )\n ApplicationMailer.email_conference_code(self).deliver_later\n end",
"def notify(doctor ,... | [
"0.58641076",
"0.58561295",
"0.5728438",
"0.5678585",
"0.56631804",
"0.564965",
"0.562282",
"0.5620441",
"0.5602735",
"0.5571426",
"0.5570165",
"0.5567051",
"0.555337",
"0.55478835",
"0.55370575",
"0.55230975",
"0.55143267",
"0.5512025",
"0.55065334",
"0.5499365",
"0.5496715"... | 0.7264282 | 0 |
Send a daily assessment to this monitoree (if currently eligible). By setting send_now to true, an assessment will be sent immediately without any consideration of the monitoree's preferred_contact_time. | def send_assessment(send_now: false)
return if ['Unknown', 'Opt-out', '', nil].include?(preferred_contact_method)
return if !last_assessment_reminder_sent.nil? && last_assessment_reminder_sent > 12.hours.ago
# Do not allow messages to go to household members
return unless responder_id == id
# Sto... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def send_final_exam_invitation!\n update_attribute(:final_exam_invitation_sent_at, Time.now)\n end",
"def email_students\n date = params[:date][:send_email]\n reminder = params[:date][:reminder]\n #@emails = Survey.pluck(:student_email)\n @surveys = Survey.where.not(student_email: nil)\n\n if ... | [
"0.60464907",
"0.5859332",
"0.5775817",
"0.57476264",
"0.5649272",
"0.56422067",
"0.5604188",
"0.55805653",
"0.55730915",
"0.557257",
"0.5534258",
"0.55329925",
"0.5520572",
"0.5495575",
"0.5469992",
"0.5466477",
"0.5458348",
"0.54498744",
"0.5432244",
"0.5381378",
"0.5351178... | 0.76073456 | 0 |
Patient initials and age | def initials_age(separator = '')
"#{initials}#{separator}#{(calc_current_age || 0).to_s.truncate(3, omission: nil)}"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def age\n Date.current.year - self.year_of_birth\n end",
"def age\n \n end",
"def age\n Time.current.year - date_of_birth.year\n end",
"def birth_year\n @current_year - @age\n end",
"def age\n\t\t\"#Age------\"\n\t\tage = Date.today.year - self.birthday.year\n\tend",
"de... | [
"0.70526123",
"0.7029297",
"0.69250154",
"0.68213177",
"0.67303526",
"0.6724646",
"0.66640496",
"0.6663895",
"0.66537476",
"0.66537476",
"0.66510606",
"0.6638828",
"0.6624405",
"0.65932155",
"0.65929085",
"0.65832573",
"0.65809035",
"0.65783346",
"0.6561927",
"0.6538133",
"0.... | 0.68977517 | 3 |
Return the calculated age based on the date of birth | def calc_current_age
Patient.calc_current_age_base(provided_date_of_birth: date_of_birth)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def age_calculate\n date = self.date_of_birth\n d1 = Date.parse date\n d2 = Date.today\n age = d2.year - d1.year\n age\n end",
"def age\n Date.today.year - birthdate[/\\d+$/].to_i\n end",
"def age\n if self.date_of_birth\n now = Time.now.utc.to_date\n age = now.year - self... | [
"0.8932665",
"0.89035743",
"0.8867572",
"0.8852391",
"0.8852305",
"0.88486165",
"0.882191",
"0.8819658",
"0.8812673",
"0.87966543",
"0.87870663",
"0.877765",
"0.8745702",
"0.87385786",
"0.8736788",
"0.8692965",
"0.869254",
"0.8690803",
"0.8690678",
"0.8686497",
"0.8682536",
... | 0.80348665 | 57 |
Determine the proper language for sending reports to this monitoree | def select_language
I18n.backend.send(:init_translations) unless I18n.backend.initialized?
lang = PatientHelper.languages(primary_language)&.dig(:code)&.to_sym || :en
lang = :en unless %i[en es es-PR so fr].include?(lang)
lang
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def lang locale\n if translations.find_by(locale: locale).try(:automated?)\n \"#{locale}-x-mtfrom-de\"\n else\n locale.to_s\n end\n end",
"def language; end",
"def language; end",
"def language; end",
"def language; end",
"def language\n ENV['NETAXEPT_LA... | [
"0.70144844",
"0.68384516",
"0.68384516",
"0.68384516",
"0.68384516",
"0.67728645",
"0.6683573",
"0.6648987",
"0.6647468",
"0.661841",
"0.661841",
"0.661841",
"0.661841",
"0.6567391",
"0.6551727",
"0.65516937",
"0.65516937",
"0.65516937",
"0.65516937",
"0.65516937",
"0.655169... | 0.66580164 | 7 |
Determine if this patient is eligible for receiving daily report messages; return a boolean result to switch on, and a tailored message useful for user interfaces. | def report_eligibility
report_cutoff_time = Time.now.getlocal('-04:00').beginning_of_day
reporting_period = (ADMIN_OPTIONS['monitoring_period_days'] + 1).days.ago
eligible = true
sent = false
reported = false
household = false
messages = []
# Workflow agnostic conditions
# Can't se... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def notification_due?\n notification_due = false\n if hw_coverage_end_date.present?\n planned_notification_dates.each do |planned_notice|\n if in_the_past(planned_notice) and last_notice_before(planned_notice)\n notification_due = true\n break\n end\n end\n end\n ... | [
"0.6648873",
"0.6648873",
"0.6370328",
"0.63100237",
"0.5976136",
"0.59205616",
"0.5905786",
"0.58502764",
"0.5824101",
"0.58062434",
"0.57516724",
"0.5737905",
"0.5729671",
"0.570806",
"0.56453353",
"0.5644004",
"0.5636018",
"0.5628644",
"0.56225026",
"0.5599997",
"0.5589909... | 0.6554132 | 2 |
Returns a representative FHIR::Patient for an instance of a Sara Alert Patient. Uses US Core extensions for sex, race, and ethnicity. | def as_fhir
FHIR::Patient.new(
meta: FHIR::Meta.new(lastUpdated: updated_at.strftime('%FT%T%:z')),
id: id,
active: monitoring,
name: [FHIR::HumanName.new(given: [first_name, middle_name].reject(&:blank?), family: last_name)],
telecom: [
primary_telephone ? FHIR::ContactPoint.ne... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def patient\n insurance_provider.patient\n end",
"def soa_record\n Record.find_by_name_and_type(name, 'SOA')\n end",
"def resourceType\n 'Patient'\n end",
"def as_fhir\n FHIR::Observation.new(\n meta: FHIR::Meta.new(lastUpdated: updated_at.strftime('%FT%T%:z')),\n ... | [
"0.55751926",
"0.556928",
"0.54332036",
"0.53802824",
"0.5269208",
"0.5269208",
"0.501167",
"0.49688357",
"0.49430698",
"0.4908976",
"0.48431316",
"0.4756551",
"0.46669638",
"0.46357086",
"0.46270666",
"0.45570266",
"0.45570266",
"0.4543561",
"0.44963148",
"0.44963148",
"0.44... | 0.6460077 | 0 |
Override as_json to include linelist | def as_json(options = {})
super((options || {}).merge(methods: :linelist))
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_json(options={}, &block)\n super(options.reverse_merge(:include => :parts), &block)\n end",
"def as_json(options = {})\n options = {\n :encoded => true,\n :level => 3\n }.merge options\n\n if options[:encoded]\n {\n :type => 'lineString',\n :encode... | [
"0.656839",
"0.65259176",
"0.6346193",
"0.631394",
"0.62999964",
"0.62999964",
"0.6286552",
"0.6283411",
"0.6282213",
"0.6282213",
"0.6282213",
"0.6270937",
"0.6270845",
"0.62673336",
"0.62646365",
"0.62566155",
"0.62307054",
"0.6222",
"0.6215717",
"0.6192498",
"0.61851907",
... | 0.83607036 | 0 |
Use the cached attribute if it exists, if not query with count for performance instead of loading all dependents. | def head_of_household?
return head_of_household unless head_of_household.nil?
dependents_exclude_self.where(purged: false).size.positive?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cache_attribute?(attr_name)\n cached_attributes.include?(attr_name)\n end",
"def cache_attribute?(attr_name)\n cached_attributes.include?(attr_name)\n end",
"def size\n if has_cached_counter?\n owner.send(:read_attribute, cached_counter_attribute_name)\n e... | [
"0.6078806",
"0.6000322",
"0.58758026",
"0.583559",
"0.58338344",
"0.582224",
"0.58205307",
"0.577127",
"0.57447547",
"0.57057124",
"0.55478823",
"0.55298513",
"0.5510642",
"0.5496272",
"0.5448663",
"0.5440484",
"0.543778",
"0.5398533",
"0.5397184",
"0.534195",
"0.532159",
... | 0.0 | -1 |
Create a secure random token to act as the monitoree's password when they submit assessments This gets included in the URL sent to the monitoree to allow them to report without having to type in a password | def new_submission_token
token = nil
loop do
token = SecureRandom.urlsafe_base64[0, 10]
break unless Patient.where(submission_token: token).any?
end
token
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def password_token\n rng = MT19937.new(Time.now.to_i)\n password = 16.times.map { rng.extract_byte }\n base64_encode_bytes(password)\nend",
"def make_token\n secure_digest(Time.now, (1..10).map{ rand.to_s })\n end",
"def generate_secure_token_string\n SecureRandom.urlsafe_base64(25).tr('lIO0', 'sxyz'... | [
"0.77929693",
"0.76615894",
"0.7560164",
"0.7552963",
"0.7522785",
"0.7493645",
"0.74832565",
"0.74665004",
"0.7455418",
"0.7454558",
"0.73787045",
"0.7377269",
"0.73709774",
"0.73433816",
"0.73387796",
"0.73387796",
"0.73387796",
"0.73295355",
"0.7314892",
"0.72995675",
"0.7... | 0.0 | -1 |
Public: Send errors to the clients. code Internal code for the error, useful if you want to obscure errors for security error A description of what happened data Further data you might want to send to the client | def send_error(code, status = :bad_request, error = nil, data = nil)
error_hash = {
code: code
}
error_hash[:message] = error if error
error_hash[:data] = data if data
render json: error_hash, status: status
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def send_error(e, res)\n res.code = 500\n res['Content-Type'] = 'application/json'\n body = { code: -1, error: \"#{e.class}: #{e.message}\" }\n body[:backtrace] = e.backtrace\n res.body = @shell.data(body).json(@shell.indent)\n @shell.logger.warn(Impl.format_er... | [
"0.7359482",
"0.7227198",
"0.7032887",
"0.7016342",
"0.6992438",
"0.68921125",
"0.68795764",
"0.68194413",
"0.6762258",
"0.67356324",
"0.67043906",
"0.66879654",
"0.6681296",
"0.66716546",
"0.6669107",
"0.6668884",
"0.6658153",
"0.6658153",
"0.6658153",
"0.6658153",
"0.665815... | 0.72128564 | 2 |
determine if there exists a kelement subset of the original list of n real numbers that is less than t. | def ullman(nums, t, k)
return false if nums.size < k
nums.sort[0...k].reduce(:+) < t
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def small_enough(arr, limit)\n arr.all? { |num|\n num <= limit\n }\nend",
"def at_least?(arr, n, &blck)\n count = 0\n arr.each do |el|\n count += 1 if blck.call(el)\n end\n count >= n\nend",
"def contains_nearby_duplicate(nums, k)\n nums_hash = {}\n \n nums.each_with_index do |num, ind... | [
"0.5961892",
"0.5769074",
"0.56646204",
"0.5653458",
"0.56460196",
"0.56313854",
"0.5559651",
"0.5512993",
"0.5505975",
"0.5503902",
"0.54751974",
"0.5472048",
"0.545337",
"0.5420972",
"0.5416402",
"0.5416276",
"0.54122037",
"0.5407968",
"0.54076463",
"0.5398107",
"0.5393416"... | 0.65608805 | 0 |
Ruby 1.9.1 doesn't have SyncEnumerator This function is inspired by Python's zip | def zip(*enums)
r = block_given? ? nil : []
len = enums.collect { |x| x.size }.max
len.times do |i|
val = enums.collect { |x| x[i] }
if block_given?
yield val
else
r << val
end
end
r
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def zip(*rest) end",
"def zip(first, second)\n first.zip(second)\nend",
"def pairs\n seq = to_a\n seq.zip([*seq[1..-1], unit.advance(to)])\n end",
"def merge(array1, array2)\n merged = []\n\n iterator1 = EnumeratorAdaptor.new(array1.to_enum)\n iterator2 = EnumeratorAdaptor.new(array2.to_enum... | [
"0.60905856",
"0.5922339",
"0.5598171",
"0.5597882",
"0.5574872",
"0.5564226",
"0.55573094",
"0.54249406",
"0.5393347",
"0.5391154",
"0.53281367",
"0.52623093",
"0.52563626",
"0.5210458",
"0.52090114",
"0.5204841",
"0.51869607",
"0.517561",
"0.5157605",
"0.51520544",
"0.51520... | 0.56059045 | 2 |
::: :::::::: croissant.rb :+: :+: :+: +:+ +:+ +:+ | def croissant
array = []
File.open("./numbers.txt", "r") do |file|
file.each_line { |line| array << line.delete!(",").to_i}
array.sort!.each { |nb| puts nb }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cop; end",
"def cop; end",
"def principes(circumagitate_starosta, sabuline, jointuress_ritualist)\n magnetogram_preaccumulate_innovant(antisiphonal)\n end",
"def suivre; end",
"def feruchemist; end",
"def relax\n # Sometimes a farmer wants to relax. In doing so, you will get a chance to en... | [
"0.5637805",
"0.5637805",
"0.55612814",
"0.5551761",
"0.54491997",
"0.5436042",
"0.53599656",
"0.5354722",
"0.5340828",
"0.5314874",
"0.5308813",
"0.5299751",
"0.525463",
"0.52020705",
"0.52016777",
"0.5199851",
"0.51426494",
"0.5140801",
"0.5136356",
"0.51362014",
"0.5128556... | 0.0 | -1 |
Note: Authentication is NOT ActiveRecord model, so we mock and stub it using RSpec. | def login(user_stubs = {}, session_stubs = {})
@current_user = Factory(:user, user_stubs)
@current_user_session = mock_model(UserSession, {:record => @current_user}.merge(session_stubs))
UserSession.stub!(:find).and_return(@current_user_session)
set_timezone
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def mock_defective_auth_hash\n nil\n end",
"def test_authentication\n @api.test_authentication\n return\n end",
"def mock_signin\n activate_authlogic\n account = Factory.create :account\n user = Factory.create :user, :account => account\n UserSession.create user\n return user, account\nend",... | [
"0.72575593",
"0.7045598",
"0.70089686",
"0.6702914",
"0.664867",
"0.6619246",
"0.66158247",
"0.6596173",
"0.6562636",
"0.6562636",
"0.65604854",
"0.6458862",
"0.64327854",
"0.64327854",
"0.6412298",
"0.6411377",
"0.63985217",
"0.63985217",
"0.6391182",
"0.63412046",
"0.63119... | 0.0 | -1 |
Get current server timezone and set it (see rake time:zones:local for details). | def set_timezone
offset = [ Time.now.beginning_of_year.utc_offset, Time.now.beginning_of_year.change(:month => 7).utc_offset ].min
offset *= 3600 if offset.abs < 13
Time.zone = ActiveSupport::TimeZone.all.select { |zone| zone.utc_offset == offset }.first
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_timezone\n Time.zone = current_account.time_zone if current_account.time_zone\n end",
"def set_timezone()\n current_tz = Time.zone\n if logged_in?\n Time.zone = current_user.timezone\n end\n ensure\n Time.zone = current_tz\n end",
"def set_timezone\n tz = cur... | [
"0.77169067",
"0.7637709",
"0.7580173",
"0.75696206",
"0.75492054",
"0.746714",
"0.7416497",
"0.74083465",
"0.7314913",
"0.7240717",
"0.72363704",
"0.7212217",
"0.7212217",
"0.7212217",
"0.7212217",
"0.7212217",
"0.7202356",
"0.7199108",
"0.7196967",
"0.71732444",
"0.7134546"... | 0.67235416 | 40 |
Adjusts current timezone by given offset (in seconds). | def adjust_timezone(offset)
if offset
ActiveSupport::TimeZone[offset]
adjusted_time = Time.now + offset.seconds
Time.stub(:now).and_return(adjusted_time)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def adjust_timezone(offset)\n if offset\n ActiveSupport::TimeZone[offset]\n adjusted_time = Time.now + offset.seconds\n allow(Time).to receive(:now).and_return(adjusted_time)\n end\nend",
"def set_timezone(timezone); end",
"def set_timezone(timezone); end",
"def set_timezone(timezone); end",
"de... | [
"0.75370157",
"0.66409045",
"0.66409045",
"0.66409045",
"0.66409045",
"0.66409045",
"0.66399133",
"0.6398784",
"0.63691264",
"0.635976",
"0.63442934",
"0.6302371",
"0.62853277",
"0.6233554",
"0.62140876",
"0.6206593",
"0.6195524",
"0.61573076",
"0.6138862",
"0.60494536",
"0.6... | 0.83657503 | 0 |
GET /team_requests GET /team_requests.json | def index
@invites = current_user.recieved_team_requests
@sent = current_user.sent_team_requests
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @team = Team.find_by_id(params[:team_id])\n @invite_requests = @team.invite_requests\n end",
"def get_team_list ( page = 1 )\n get_api_resource \"#{@@api_base_url}teams/#{page}\"\n end",
"def get_team ( team_key )\n get_api_resource \"#{@@api_base_url}team/#{team_key}\"\n end",
"de... | [
"0.69116116",
"0.6679551",
"0.66208154",
"0.65438783",
"0.6354794",
"0.6325802",
"0.63154197",
"0.6285619",
"0.62718475",
"0.625604",
"0.61879873",
"0.6187594",
"0.6183771",
"0.6182624",
"0.618172",
"0.616328",
"0.61225134",
"0.61031926",
"0.6082299",
"0.60762846",
"0.6062606... | 0.647792 | 4 |
GET /team_requests/1 GET /team_requests/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @team = Team.find_by_id(params[:team_id])\n @invite_requests = @team.invite_requests\n end",
"def get_team ( team_key )\n get_api_resource \"#{@@api_base_url}team/#{team_key}\"\n end",
"def show\n render status: 200, json: Team.find(params[:id])\n end",
"def show\n @team = Team.... | [
"0.6808917",
"0.64891595",
"0.6375284",
"0.6339627",
"0.6334933",
"0.6317765",
"0.6278487",
"0.6275012",
"0.62577313",
"0.62258947",
"0.6216869",
"0.6160613",
"0.6160613",
"0.6160613",
"0.6160613",
"0.61330265",
"0.61326164",
"0.61100435",
"0.60928595",
"0.60881823",
"0.60832... | 0.0 | -1 |
POST /team_requests POST /team_requests.json | def create
@team_request = TeamRequest.new(sender: current_user,
reciever_id: team_request_params[:reciever_id],
team: current_user.team)
respond_to do |format|
if @team_request.save
format.html { redirect_to @team_reque... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @team_request = TeamRequest.for_email(request_params['email'], @team.id, current_user.id)\n\n respond_to do |format|\n if @team_request.save\n format.html { redirect_to @team, notice: 'Request to join the team was sent!' }\n format.json { render :show, status: :sent, location:... | [
"0.6762997",
"0.6431668",
"0.6345502",
"0.62129325",
"0.6205193",
"0.61970866",
"0.6136341",
"0.60707176",
"0.60378253",
"0.5963379",
"0.5947636",
"0.59342694",
"0.5931578",
"0.59315467",
"0.5922459",
"0.5900529",
"0.58954257",
"0.5871366",
"0.5867555",
"0.5866857",
"0.583607... | 0.67770267 | 0 |
PATCH/PUT /team_requests/1 PATCH/PUT /team_requests/1.json | def update
respond_to do |format|
if @team_request.update(team_request_params)
format.html { redirect_to @team_request, notice: 'Team request was successfully updated.' }
format.json { render :show, status: :ok, location: @team_request }
else
format.html { render :edit }
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @team = Team.find(params[:id])\n\n if @team.update_attributes(params[:team])\n head :no_content\n else\n render json: @team.errors, status: :unprocessable_entity\n end\n end",
"def update\n @team = Team.find(params[:id])\n\n respond_to do |format|\n if @team.update_... | [
"0.6697032",
"0.65699357",
"0.65471697",
"0.6439995",
"0.64204663",
"0.640412",
"0.6379417",
"0.63282496",
"0.6307756",
"0.63043547",
"0.6283093",
"0.6283093",
"0.62777275",
"0.62777275",
"0.6275381",
"0.62660044",
"0.62598693",
"0.62598693",
"0.62598693",
"0.62598693",
"0.62... | 0.71661645 | 0 |
DELETE /team_requests/1 DELETE /team_requests/1.json | def destroy
if @team_request.status != "pending"
flash[:notice] = "could not delete team request."
redirect_to action: "index"
else
@team_request.destroy
respond_to do |format|
format.html { redirect_to team_requests_url, notice: 'Team request was successfully destroyed.' }
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\r\n @project_request = ProjectRequest.find(params[:id])\r\n @project_request.delete\r\n \r\n respond_to do |format|\r\n format.html { redirect_to my_requests_url }\r\n format.json { head :no_content }\r\n end\r\n end",
"def destroy\n team.destroy\n\n respond_to do |form... | [
"0.73119664",
"0.7145342",
"0.7136581",
"0.7086519",
"0.7050379",
"0.7050379",
"0.7050379",
"0.7050379",
"0.7050379",
"0.7050379",
"0.7050379",
"0.7050379",
"0.7050379",
"0.7050379",
"0.7050379",
"0.7050379",
"0.70381427",
"0.70381427",
"0.70381427",
"0.70381427",
"0.70334905... | 0.727559 | 1 |
Use callbacks to share common setup or constraints between actions. | def set_team_request
@team_request = TeamRequest.find(params[:id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_... | [
"0.6163163",
"0.6045976",
"0.5946146",
"0.591683",
"0.5890051",
"0.58349305",
"0.5776858",
"0.5703237",
"0.5703237",
"0.5652805",
"0.5621621",
"0.54210985",
"0.5411113",
"0.5411113",
"0.5411113",
"0.5391541",
"0.53794575",
"0.5357573",
"0.53402257",
"0.53394014",
"0.53321576"... | 0.0 | -1 |
Only allows reciever_id, the sender and team are inferred from current_user | def team_request_params
params.require(:team_request).permit(:reciever_id)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def recipient(current_user)\n \tself.sender_id == current_user.id ? self.receiver : self.sender\n \tend",
"def sender? usr\n usr.id == user_id\n end",
"def exclude_sender_in_team_from_recognition_recipients\n sender_recipients = recognition_recipients.select {|rr| rr.user_id == sender&.id }\n if ... | [
"0.6635803",
"0.6633528",
"0.65591675",
"0.64564",
"0.6437362",
"0.6391272",
"0.6371022",
"0.6225947",
"0.62003267",
"0.616818",
"0.6140303",
"0.601727",
"0.6012699",
"0.60089576",
"0.60089576",
"0.60089576",
"0.59944",
"0.59611773",
"0.590879",
"0.59005815",
"0.58604103",
... | 0.5890341 | 20 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.