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 /service_masters/1 DELETE /service_masters/1.json
def destroy @service_master.destroy @service_masters = ServiceMaster.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @service_type_master.destroy\n respond_to do |format|\n format.html { redirect_to service_type_masters_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @masterservice.destroy\n respond_to do |format|\n format.html { redirect_to masterservices_url,...
[ "0.7549704", "0.74739534", "0.7120769", "0.69918126", "0.6988008", "0.6978518", "0.69578296", "0.69523615", "0.69523615", "0.69523615", "0.6899181", "0.68965125", "0.68860614", "0.68840736", "0.68638843", "0.6862643", "0.6860777", "0.6860643", "0.6830138", "0.6826659", "0.680...
0.71129304
3
Use callbacks to share common setup or constraints between actions.
def set_service_master @service_master = ServiceMaster.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 service_master_params params.require(:service_master).permit(:code, :name, :description, :status) 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 the registered kind of the class of object +self+.
def kind self.class.kind end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_class()\n l = get_type()\n #puts \"Type #{l.class} in #{self.class} , #{self}\"\n l.object_class()\n end", "def get_class()\n l = get_type()\n #puts \"Type #{l.class} in #{self.class} , #{self}\"\n l.object_class()\n end", "def kind\n self.class.kind\n end", "d...
[ "0.707713", "0.707713", "0.7052652", "0.7052652", "0.7052652", "0.69318646", "0.6781225", "0.6707776", "0.6645637", "0.66327494", "0.65749514", "0.65119433", "0.6511681", "0.6511681", "0.6511681", "0.64812106", "0.64812106", "0.6451409", "0.6451409", "0.64346105", "0.63985395...
0.71691734
0
Consumes the +sexp+ translating it into an Array suitable for input to method +args+ or +normalize+.
def consume(sexp) out = [] sexp.each do |s| if s.kind_of?(Array) # # Reject +nil+, so that we can optimize out whole expressions # just by returning +nil+ from sexp_to_node. # v = @compiler.sexp_to_node(s) out << v unless v.nil? else out << s end end return out end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def args(sexp)\n if call_site?(sexp)\n (rest(sexp[3])).collect { |each| Code.from_s_expression(each) }\n else\n []\n end\n end", "def method_call_args(args_sexp)\n return [] if args_sexp[1].nil?\n args_sexp = args_sexp.last[1]\n args_sexp.map(&method(:parse_one))\n end", "def proc...
[ "0.7726933", "0.7499902", "0.7418638", "0.73796445", "0.6804043", "0.6681664", "0.6582786", "0.65823746", "0.652859", "0.6352124", "0.62929857", "0.60398704", "0.58450884", "0.5833182", "0.57801664", "0.5684614", "0.5674687", "0.56730276", "0.56659514", "0.5587061", "0.557621...
0.74015844
3
Used for accessing/propagating state within the AST Access dynamic state variables
def get(key) @compiler.get(key) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __state_internal\n @state\n end", "def define_state_accessor; end", "def state; end", "def state; end", "def state; end", "def state; end", "def state; end", "def state; end", "def state; end", "def state; end", "def state=(_arg0); end", "def state=(_arg0); end", "def state=(_ar...
[ "0.63197964", "0.6263718", "0.62448126", "0.62448126", "0.62448126", "0.62448126", "0.62448126", "0.62448126", "0.62448126", "0.62448126", "0.6241601", "0.6241601", "0.6241601", "0.62312543", "0.62312543", "0.62312543", "0.61064935", "0.6055895", "0.604763", "0.604763", "0.60...
0.0
-1
Set dynamic state variables which propagate through the AST
def set(hash, &block) @compiler.set(hash, &block) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setFSMVariable _obj, _args\n \"_obj setFSMVariable _args;\" \n end", "def on_casgn(node)\n super\n _scope, name, = *node\n position = find_local name\n if position\n # TODO: raise error, can't re-assign contstant\n else\n ...
[ "0.62109476", "0.6102802", "0.5998049", "0.5914373", "0.5804196", "0.5783977", "0.57604766", "0.56914943", "0.56914943", "0.56914943", "0.56838614", "0.5645996", "0.5597518", "0.5587066", "0.5580274", "0.55783117", "0.55151594", "0.5506821", "0.54946566", "0.54800314", "0.544...
0.0
-1
Is +self+ of class +klass+?
def is?(klass) self.is_a?(klass) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_a klass\n msg = \"#{self} is not a #{klass}\"\n check_if self.is_a?(klass), msg\n end", "def instance_of?(klass)\n super || __getobj__.instance_of?(klass)\n end", "def instance_of?(klass)\n super || object.instance_of?(klass)\n end", "def is_a?(klass)\n __getobj__.class.obj...
[ "0.81911457", "0.8024201", "0.79849213", "0.79812056", "0.79812056", "0.7881308", "0.7753866", "0.7753587", "0.75908005", "0.75121504", "0.75121504", "0.750277", "0.73763126", "0.73500884", "0.71802646", "0.70679444", "0.703912", "0.7024621", "0.69830036", "0.6940655", "0.693...
0.85259837
0
Eine Stehlampe wird sichtbar, wenn alle Komponenten der Stehlampe sichtbar gemacht werden
def sichtbar_machen() @fuss.sichtbar_machen() @stiel.sichtbar_machen() @schirm.sichtbar_machen() @leuchtstrahl1.sichtbar_machen() @leuchtstrahl2.sichtbar_machen() @leuchtstrahl3.sichtbar_machen() @leuchtstrahl4.sichtbar_machen() end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def letzte_komponente\n \n end", "def sichtbar_machen()\n end", "def sichtbar_machen\n @sichtbar = true\n zeichnen()\n puts(self) \n end", "def sichtbar_machen()\n # TODO\n end", "def unsichtbar_machen()\n end", "def unsichtbar_machen\n loeschen()\n @sichtbar = false ...
[ "0.7189444", "0.66306186", "0.6476884", "0.64394855", "0.6348359", "0.6133877", "0.5820762", "0.57868284", "0.57574123", "0.568264", "0.56513774", "0.55251783", "0.55251783", "0.55251783", "0.55251783", "0.546585", "0.5431152", "0.54098946", "0.5406905", "0.5306613", "0.53066...
0.60955733
6
Eine Stehlampe wird unsichtbar wenn alle komponenten der Stehlampe unsichtbar gemacht werden
def unsichtbar_machen() @fuss.unsichtbar_machen() @stiel.unsichtbar_machen() @schirm.unsichtbar_machen() @leuchtstrahl1.unsichtbar_machen() @leuchtstrahl2.unsichtbar_machen() @leuchtstrahl3.unsichtbar_machen() @leuchtstrahl4.unsichtbar_machen() end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def letzte_komponente\n \n end", "def unsichtbar_machen()\n end", "def sichtbar_machen()\n end", "def zuruecksetzen()\n end", "def unsichtbar_machen\n loeschen()\n @sichtbar = false \n end", "def sichtbar_machen\n @sichtbar = true\n zeichnen()\n puts(self) \n end", ...
[ "0.72942615", "0.6034785", "0.5940375", "0.58270395", "0.57866514", "0.57337886", "0.5716815", "0.57017624", "0.57017624", "0.57017624", "0.57017624", "0.5653898", "0.5635757", "0.5498021", "0.5498021", "0.5498021", "0.5470622", "0.54310805", "0.5418579", "0.5395117", "0.5379...
0.5556724
13
TODO vertikal_bewegen(anzahl_punkte) Eine Stehlampe wird vertikal bewegt, indem alle Komponenten vertikal bewegt werden. Parameter: anzahl_punkte gibt an um wieviele Punkte verschoben werden soll
def vertikal_bewegen(anzahl_punkte) @fuss.vertikal_bewegen(anzahl_punkte) @stiel.vertikal_bewegen(anzahl_punkte) @schirm.vertikal_bewegen(anzahl_punkte) @leuchtstrahl1.vertikal_bewegen(anzahl_punkte) @leuchtstrahl2.vertikal_bewegen(anzahl_punkte) @leuchtstrahl3.vertikal_bewegen(anzahl_punkte) @leuchtstrahl4.vertikal_bewegen(anzahl_punkte) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def vertikal_bewegen(anzahl)\n bewegen_um_punkt(Punkt.new(0,anzahl))\n end", "def horizontal_bewegen(anzahl)\n bewegen_um_punkt(Punkt.new(anzahl,0)) \n end", "def langsam_vertikal_bewegen(entfernung)\n absolute_entfernung = entfernung\n if sichtbar? \n delta = 1\n if en...
[ "0.75803155", "0.6462873", "0.6264656", "0.5689303", "0.55157787", "0.5409677", "0.5314131", "0.5161683", "0.50854415", "0.5034072", "0.50107783", "0.49555966", "0.49034607", "0.48636156", "0.48212966", "0.48212966", "0.48134047", "0.48004064", "0.47816136", "0.47786757", "0....
0.7475189
1
TODO horizontal_bewegen(anzahl_punkte) Eine Stehlampe wird horizontal bewegt, indem alle Komponenten horizontal bewegt werden. Parameter: anzahl_punkte gibt an um wieviele Punkte verschoben werden soll
def horizontal_bewegen(anzahl_punkte) @fuss.horizontal_bewegen(anzahl_punkte) @stiel.horizontal_bewegen(anzahl_punkte) @schirm.horizontal_bewegen(anzahl_punkte) @leuchtstrahl1.horizontal_bewegen(anzahl_punkte) @leuchtstrahl2.horizontal_bewegen(anzahl_punkte) @leuchtstrahl3.horizontal_bewegen(anzahl_punkte) @leuchtstrahl4.horizontal_bewegen(anzahl_punkte) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def horizontal_bewegen(anzahl)\n bewegen_um_punkt(Punkt.new(anzahl,0)) \n end", "def vertikal_bewegen(anzahl)\n bewegen_um_punkt(Punkt.new(0,anzahl))\n end", "def vertikal_bewegen(anzahl_punkte)\n @fuss.vertikal_bewegen(anzahl_punkte)\n @stiel.vertikal_bewegen(anzahl_punkte)\n @schirm....
[ "0.72925496", "0.61027193", "0.58929026", "0.5379447", "0.53573483", "0.52829516", "0.52797586", "0.525909", "0.52497256", "0.52311414", "0.5167526", "0.51593584", "0.5139814", "0.51337856", "0.5089822", "0.50797206", "0.50691766", "0.5061724", "0.50225306", "0.500439", "0.50...
0.729477
0
TODO einschalten Schaltet die Stehlampe ein. Beim Einschalten werden der Lampenschirm und die Leuchtstrahlen gelb.
def einschalten() @schirm.farbe_aendern('gelb') @leuchtstrahl1.sichtbar_machen() @leuchtstrahl2.sichtbar_machen() @leuchtstrahl3.sichtbar_machen() @leuchtstrahl4.sichtbar_machen() @leuchtstrahl1.farbe_aendern('gelb') @leuchtstrahl2.farbe_aendern('gelb') @leuchtstrahl3.farbe_aendern('gelb') @leuchtstrahl4.farbe_aendern('gelb') end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def private; end", "def schubert; end", "def zuruecksetzen()\n end", "def suivre; end", "def specie; end", "def specie; end", "def specie; end", "def specie; end", "def refutal()\n end", "def probers; end", "def verdi; end", "def terpene; end", "def berlioz; end", "def malts; end", ...
[ "0.74280405", "0.71628886", "0.6870136", "0.67495936", "0.66496456", "0.66496456", "0.66496456", "0.66496456", "0.6531873", "0.648348", "0.63253015", "0.63148075", "0.62070286", "0.619244", "0.61620516", "0.6161472", "0.61490446", "0.6121353", "0.6060122", "0.6051984", "0.591...
0.0
-1
TODO ausschalten Schaltet die Stehlampe aus. Beim Ausschalten wird der Lampenschirm orange und die Leuchtstrahlen werden unsichtbar
def ausschalten() @schirm.farbe_aendern('orange') @leuchtstrahl1.unsichtbar_machen() @leuchtstrahl2.unsichtbar_machen() @leuchtstrahl3.unsichtbar_machen() @leuchtstrahl4.unsichtbar_machen() end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def red=(_); end", "def red; end", "def red; end", "def terpene; end", "def green=(_); end", "def red\n end", "def suivre; end", "def blue=(_); end", "def legionnairs\n\n end", "def bellini; end", "def schubert; end", "def refutal()\n end", "def superweening_adorningly(counterstand_p...
[ "0.63480026", "0.62180257", "0.62180257", "0.6195435", "0.6090918", "0.60759676", "0.60553646", "0.6055027", "0.6049825", "0.5858049", "0.58576554", "0.58173954", "0.5807605", "0.57986134", "0.57957524", "0.5753951", "0.57354784", "0.57354784", "0.5726284", "0.5724566", "0.57...
0.0
-1
rows = [] rows rows puts table
def hash_to_arr(player) hash_to_array = [] player.table.each do |x,y| hash_to_array << "#{x}#{y}" end create_table(hash) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def history_report(rows)\n table = Terminal::Table.new :headings => ['Date','Exercise', 'Set', 'Weight', 'Reps'], \n :title => \"Exercise Log History\",\n :rows => rows \n puts table\nend", "def output_table(title = '', headings, rows)\n table = Terminal::Table.new\n table.title = tit...
[ "0.7571995", "0.7494996", "0.7396382", "0.7335193", "0.72900903", "0.72675455", "0.7167665", "0.7164863", "0.7152365", "0.71247864", "0.7046587", "0.7010264", "0.70092046", "0.7005035", "0.69843507", "0.6975677", "0.6948033", "0.69049937", "0.68764746", "0.6843163", "0.682493...
0.0
-1
GET /ordems GET /ordems.json
def index @ordems = Ordem.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @ordens = Orden.all\n render json: @ordens\n end", "def getOrden \n \t@orden = Orden.where(:rest => params[:id_res])\n \trender json: @orden\n end", "def index\n @ordenes = Orden.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @or...
[ "0.7425618", "0.7182112", "0.6949205", "0.66160715", "0.653922", "0.6472049", "0.644005", "0.63889486", "0.63889486", "0.6377185", "0.6315284", "0.6196921", "0.61406684", "0.609983", "0.6094538", "0.60733485", "0.6047664", "0.6028901", "0.6016722", "0.601195", "0.60028213", ...
0.7343044
1
GET /ordems/1 GET /ordems/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getOrden \n \t@orden = Orden.where(:rest => params[:id_res])\n \trender json: @orden\n end", "def index\n @ordens = Orden.all\n render json: @ordens\n end", "def index\n @ordems = Ordem.all\n end", "def index\n @ordenes = Orden.all\n\n respond_to do |format|\n format.html # index...
[ "0.75797284", "0.7340945", "0.7039434", "0.6974005", "0.6802147", "0.6802147", "0.6519971", "0.6501119", "0.6452761", "0.64261436", "0.6416109", "0.637802", "0.6321634", "0.6308893", "0.6267159", "0.6247305", "0.6224811", "0.6175111", "0.616847", "0.6164189", "0.61618423", ...
0.0
-1
POST /ordems POST /ordems.json
def create @ordem = Ordem.new(ordem_params) respond_to do |format| if @ordem.save format.html { redirect_to @ordem, notice: 'Ordem was successfully created.' } format.json { render :show, status: :created, location: @ordem } else format.html { render :new } format.json { render json: @ordem.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @orden = Orden.new(params[:orden])\n\n respond_to do |format|\n if @orden.save\n format.html { redirect_to @orden, notice: 'Orden was successfully created.' }\n format.json { render json: @orden, status: :created, location: @orden }\n else\n format.html { render ac...
[ "0.629966", "0.59660774", "0.5821297", "0.58088535", "0.58087426", "0.57770014", "0.57725674", "0.57627004", "0.5724189", "0.57188845", "0.56020874", "0.56006616", "0.5591847", "0.55784696", "0.55217594", "0.55169964", "0.55006427", "0.5495015", "0.54865825", "0.5467058", "0....
0.6142741
1
PATCH/PUT /ordems/1 PATCH/PUT /ordems/1.json
def update respond_to do |format| if @ordem.update(ordem_params) format.html { redirect_to @ordem, notice: 'Ordem was successfully updated.' } format.json { render :show, status: :ok, location: @ordem } else format.html { render :edit } format.json { render json: @ordem.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @ore = Ore.find(params[:id])\n \n respond_to do |format|\n if @ore.update_attributes(params[:ore])\n format.html { redirect_to @ore, notice: 'Ore was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n ...
[ "0.63438976", "0.63092023", "0.63092023", "0.62058187", "0.61583024", "0.61366796", "0.60985565", "0.60947984", "0.60888106", "0.6077002", "0.6071598", "0.6065358", "0.6064885", "0.6052602", "0.60346574", "0.60184556", "0.6008994", "0.6008923", "0.60022634", "0.5998056", "0.5...
0.6155636
5
DELETE /ordems/1 DELETE /ordems/1.json
def destroy @ordem.destroy respond_to do |format| format.html { redirect_to ordems_url, notice: 'Ordem was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete\n client.delete(\"/#{id}\")\n end", "def destroy\n @orden = Orden.find(params[:id])\n @orden.destroy\n\n respond_to do |format|\n format.html { redirect_to ordenes_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @orden = Orden.find(params[:id])...
[ "0.70713896", "0.69773066", "0.6964826", "0.69073784", "0.6856611", "0.6821957", "0.6807641", "0.68071806", "0.67742455", "0.67498964", "0.6749857", "0.6729382", "0.6728905", "0.6714401", "0.6714287", "0.6697991", "0.6686482", "0.6686176", "0.6675933", "0.6674856", "0.6662325...
0.70635885
1
Use callbacks to share common setup or constraints between actions.
def set_ordem @ordem = Ordem.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 ordem_params params.require(:ordem).permit(:data, :cliente, :relato, :colaborador, :resultado) 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
has_many :global_classifications, dependent: :delete_all has_many :global_taxons, through: :global_classifications, source: :taxon Try building a slug based on the following fields in increasing order of specificity.
def slug_candidates [ :name_to_url, [:name_to_url, :sku], [:name_to_url, :sku, :site_id] ] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def subtaxa_whose_classification_needs_to_be_changed\n subtaxa = Name.subtaxa_of_genus_or_below(text_name).not_deprecated.to_a\n uniq_subtaxa = subtaxa.filter_map(&:synonym_id).uniq\n # Beware of AR where.not gotcha - will not match a null classification below\n synonyms = Name.where(deprecated: true, ...
[ "0.6048295", "0.5771876", "0.5755997", "0.5754917", "0.5754917", "0.5715092", "0.56437457", "0.561554", "0.55880743", "0.5569522", "0.55643654", "0.55643654", "0.5553974", "0.5537942", "0.55190116", "0.5499645", "0.5494031", "0.54683447", "0.54652363", "0.54652363", "0.545450...
0.5333361
27
Returns all optional group picks for a user
def for_user(user) group_list=user.groups.map(&:user_optional_group_pick).join(",") conditions = "" conditions += "id IN (#{group_list}) AND" unless group_list.empty? conditions += "(role_id <= #{user.role_id} OR role_id IS NULL)" UserOptionalGroupPick.all(:conditions => conditions) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def for_user_with_selected(user)\n conditions = \"(id IN (#{user.groups.map(&:user_optional_group_pick).join(\",\")})) AND (role_id <= #{user.role_id} OR role_id IS NULL)\"\n picks = UserOptionalGroupPick.all(:conditions => conditions)\n picks.each do |pick|\n unless (intersection = (user.gro...
[ "0.69329786", "0.64752686", "0.6391191", "0.6301416", "0.6277793", "0.6276514", "0.6239401", "0.62042683", "0.6147166", "0.6141781", "0.60951453", "0.6094769", "0.60913664", "0.6084481", "0.607374", "0.6056936", "0.60502785", "0.60445225", "0.5990983", "0.595756", "0.5942964"...
0.7838122
0
Returns all optional group picks for a user with the selected option for each group pick
def for_user_with_selected(user) conditions = "(id IN (#{user.groups.map(&:user_optional_group_pick).join(",")})) AND (role_id <= #{user.role_id} OR role_id IS NULL)" picks = UserOptionalGroupPick.all(:conditions => conditions) picks.each do |pick| unless (intersection = (user.groups & pick.groups)).empty? pick.selected_group = intersection.first pick.selected_group_id = pick.selected_group.id end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def for_user(user)\n group_list=user.groups.map(&:user_optional_group_pick).join(\",\")\n conditions = \"\"\n conditions += \"id IN (#{group_list}) AND\" unless group_list.empty?\n conditions += \"(role_id <= #{user.role_id} OR role_id IS NULL)\"\n UserOptionalGroupPick.all(:conditions => ...
[ "0.734327", "0.6243488", "0.6185795", "0.6104983", "0.60530525", "0.60270214", "0.5974829", "0.5876784", "0.58364016", "0.5831615", "0.5731956", "0.5718277", "0.56862515", "0.56621695", "0.5642139", "0.56127846", "0.5531436", "0.5531436", "0.5503125", "0.5448608", "0.54059714...
0.72494125
1
TODO: Rename to decorated_vocabulary
def vocabulary wayfinder.decorated_parent_vocabulary end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_instance_vocabulary_views\n return if self.vocabulary.nil?\n self.vocabulary.key_list.each {|k| add_instance_view(k)}\n instance_design_doc\n end", "def add_instance_vocabulary_views\n return if self.vocabulary.nil?\n self.vocabulary.key_list.each {|k| add_instance_view(k)}\n instance_...
[ "0.69255877", "0.69255877", "0.67879504", "0.6433755", "0.63250095", "0.6324542", "0.62638915", "0.62252206", "0.6186369", "0.61375266", "0.61147577", "0.61031765", "0.60693675", "0.6049297", "0.6041185", "0.5970617", "0.59500045", "0.584415", "0.58388084", "0.58372766", "0.5...
0.72697484
0
a category is just a nested vocabulary TODO: Rename to decorated_vocabularies
def categories @categories ||= wayfinder.decorated_vocabularies.sort_by(&:label) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def categories\n add_to_query restrict_kind: 'category'\n end", "def category\n adventure.category\n end", "def categories\n category\n end", "def categories\n taxonomies.all :conditions => { :classification => :category }\n end", "def category; end", "def category\n revision.c...
[ "0.6361074", "0.6256138", "0.6230612", "0.6216884", "0.61369336", "0.6125785", "0.61185235", "0.607322", "0.60439306", "0.5979153", "0.5963539", "0.5952022", "0.5947593", "0.5912913", "0.5903255", "0.58572805", "0.5849453", "0.58372223", "0.58324015", "0.5806571", "0.5803528"...
0.72968405
0
TODO: Rename to decorated_ephemera_terms
def terms @terms ||= wayfinder.decorated_ephemera_terms.sort_by(&:label) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def terms\n raise NotImplementedError\n end", "def terms\n end", "def terms\n\n end", "def terms\n\n end", "def termsig(*) end", "def term; end", "def terms\n\tend", "def terms\n [self]\n end", "def primary_terms\n terms - self.class.hyrax_form_fields\n end", "def e...
[ "0.66673064", "0.64938486", "0.6469182", "0.6469182", "0.63910985", "0.6194696", "0.61887723", "0.6053308", "0.6029827", "0.589088", "0.5682934", "0.56768566", "0.5672608", "0.5647448", "0.55914557", "0.55827516", "0.55827516", "0.55827516", "0.54371905", "0.5415531", "0.5399...
0.7211633
0
method that is called by parse_helper
def playGame(user, message) #Set up the game if this is the user's first time if user.scramble_game == nil game = user.create_scramble_game # game.user_id = user.id # game.save return initScrambleGame(game) end #passes on the word to the game game = user.scramble_game play(game, message) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse; end", "def parse; end", "def parse; end", "def parse\n end", "def parsed; end", "def parsed; end", "def parse()\n #This is a stub, used for indexing\n end", "def after_parse; end", "def after_parse; end", "def parse\n raise \"absctract method called\"\n ...
[ "0.79691046", "0.79691046", "0.79691046", "0.7809429", "0.7802742", "0.7802742", "0.7758646", "0.741533", "0.741533", "0.7338311", "0.7186284", "0.7152722", "0.70627743", "0.70159656", "0.69405293", "0.69405293", "0.69405293", "0.69405293", "0.6895667", "0.6895667", "0.687287...
0.0
-1
Start ScrambleGame logic Main method for a game
def play(game, message) round = game.scramble_round score = game.score if status(round) >= 2 return initRound(round) end if message[0, 6] == "-start" return initRound(round) end out = checkWord(round, message) #out << word.to_s[0,5] if status(round) == 3 game.score = score.to_i + round.roundScore.to_i end if status(round) >= 2 out << " Your total score is: #{game.score}. " end return out end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def start\r\n initialize_game\r\n until @game.over?\r\n take_turn\r\n end\r\n print_outcome\r\n end", "def start_game\n game_logo\n game_start_screen\n game_rules\n last_rules\n choice = maker_breaker\n game_maker if choice == 'm'\n game_breaker if choice == 'b'...
[ "0.7349935", "0.73076195", "0.73068", "0.71988887", "0.71523744", "0.7148998", "0.7100178", "0.70946956", "0.708954", "0.7081722", "0.7074511", "0.7072987", "0.7059057", "0.7026563", "0.7014751", "0.6986009", "0.69219047", "0.6912558", "0.68880934", "0.68642324", "0.68361664"...
0.0
-1
end play Sets up a game, run only if a user doesn't have a game
def initScrambleGame(game) initWords() game.update_attributes score: 0 game.create_scramble_round round = game.scramble_round initRound(round) initRound(round) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def start_game(user)\n $game_session = nil\n UserGuess.delete_all\n\n initiate_game(user)\n question_loop\n end_message\n menu(user)\nend", "def play\n # unless the game is over players take turns\n take_turn until game_over?\n\n #start a new game if the game is over\n new_game_or_quit\n end",...
[ "0.7269086", "0.7238647", "0.7231406", "0.714167", "0.7071981", "0.7053089", "0.7025451", "0.70133954", "0.69383496", "0.692823", "0.6912096", "0.6900278", "0.68598217", "0.6848562", "0.6837065", "0.6819435", "0.6811782", "0.6765006", "0.67506707", "0.6748519", "0.6743812", ...
0.0
-1
Start ScrambleRound logic Sets up a round. Called each time a new round is made
def initRound(round) i = Random.rand(1..50) round.roundScore = 10 round.usedHint = 0 round.correctWord = @wordList[i] #round.correctWord = get_random(4, 8) #round.correctWord = "apple" round.correctWord = round.correctWord.to_s round.scrambledWord = randomizeString(round.correctWord).to_s round.save return "Starting new round... Scrambled word is: #{round.scrambledWord}" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def start_round!\n @players.each { |player| player.empty_hand! }\n @players_in_round.replace(@players)\n @round_winner = nil\n ante_up!\n deal_initial_hands\n end", "def beginBetting\r\n\tprintLine\r\n\tstartBetRound\r\n\tprintLine\r\n\tstartBetting\r\n\t@new_round = false...
[ "0.74133325", "0.6861252", "0.6759349", "0.6725576", "0.66460836", "0.65486395", "0.6508009", "0.6486761", "0.64758724", "0.64591175", "0.6457222", "0.6361314", "0.6350842", "0.62894386", "0.6280015", "0.6276726", "0.6261579", "0.62566584", "0.6247394", "0.6244581", "0.624346...
0.7116682
1
Checks if a word is correct. Handles parsing for "hint"
def checkWord(round, inWord) #Logic to deal with word if inWord[0, 5] == "-hint" if round.usedHint == 0 if round.roundScore <=4 return "You have used too many guesses to use your hint!" end round.roundScore += -4 round.usedHint = 1 return hint(round.correctWord) else return "You have already used your hint for this round" end else # if the word is correct, return score if inWord == round.correctWord round.usedHint = 3 return "#{inWord} is correct! Score for this round is: #{round.roundScore}." else #If the word is incorrect round.roundScore += -2 if round.roundScore <= 0 round.usedHint = 2 return "Round over! You used all your attempts. The correct word was #{round.correctWord}. " end return "#{inWord} is incorrect! Please try again. The word is: #{round.scrambledWord}. " end end#end word logic round.roundScore end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_word(word)\n if self.player.word_list.include?(word)\n puts \"Already found that one!\"\n elsif word.length < 4\n puts \"That word is too short. Words must be 4 letters or longer.\"\n elsif word.chars.include?(self.board.inner_letter) == false\n puts \"Missing center letter.\"\n ...
[ "0.732869", "0.70052326", "0.69552815", "0.67844737", "0.6784141", "0.6771078", "0.67493206", "0.673752", "0.6708885", "0.66962487", "0.6688009", "0.66397715", "0.6616572", "0.6613002", "0.659509", "0.65747213", "0.6557829", "0.65430355", "0.65360665", "0.6446802", "0.6442005...
0.7209456
1
end checkWord Returns the definition of a word. Can only be used once per round
def hint(word) get_definition(word) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_for_definitions\n @words.each do |word|\n @lemma ? lemma = \" - #{@lemmas[word]}\" : lemma = \"\"\n\n # Strip characters - mimics trimWordLowerCase in texts.js\n regex = /[\\u200B-\\u200D\\uFEFF\\u00A0]/\n word.gsub!(regex, \"\")\n regex = /^[.,!¡?¿:;\\/|\\\\'\"“”‘...
[ "0.72379375", "0.71943927", "0.7089018", "0.7043437", "0.7043437", "0.7043437", "0.7043437", "0.7043437", "0.6996515", "0.68594396", "0.6797021", "0.67428935", "0.67413425", "0.66960603", "0.6687422", "0.6663738", "0.665114", "0.6646196", "0.66287804", "0.6596279", "0.6592638...
0.6724004
13
Returns the status of the given round.
def status(round) round.usedHint end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def status\n case completed_rounds.size\n when 0 then :hasnt_started\n when ROUNDS.size then :completed\n else :in_progress\n end\n end", "def get_status()\n\n puts \"Rounds: #{@rounds}\"\n puts \"Player wins: #{@player_wins}\"\n puts \"...
[ "0.7130492", "0.656539", "0.65178776", "0.642484", "0.6402165", "0.63747376", "0.63335466", "0.6230013", "0.62278306", "0.62218946", "0.6193923", "0.61853224", "0.6149045", "0.6149045", "0.61204344", "0.60412484", "0.59927905", "0.59721726", "0.59556365", "0.592826", "0.58584...
0.7725389
0
Never trust parameters from the scary internet, only allow the white list through.
def double_mattress_one_params params.require(:double_mattress_one).permit(:name, :gender, :age, :email, :weight, :length, :sleep_position, :body_shape, :warm_sleeping, :neck_or_back_pain, :session_id, :mattress_length, :mattress_width, :comfort, :chassis) 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
curl d "client_id=160603714647&client_secret=zJsqR9XiRaJQzDjpxxpqgS3FAq0Equkp&grant_type=authorization_code& code=f83fb7f4db89231a939f8ca56f5670ae&redirect_uri=
def data_acc_token(code, client_id, client_secret, grant_type="authorization_code", redirect_uri=REDIRECT_URL) "client_id=#{client_id}&client_secret=#{client_secret}&grant_type=#{grant_type}&code=#{code}&redirect_uri=#{redirect_uri}" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def request(code:, redirect_uri: Keap::REST.redirect_uri)\n body = {\n client_id: Keap::REST.client_id,\n client_secret: Keap::REST.client_secret,\n code: code,\n grant_type: \"authorization_code\",\n redirect_uri: redirect_uri\n }\n\n ...
[ "0.6782264", "0.67442983", "0.67113537", "0.66831654", "0.66799355", "0.66406083", "0.6621363", "0.6568282", "0.6564558", "0.65446275", "0.6481472", "0.64684767", "0.6441047", "0.6428085", "0.6411563", "0.6404167", "0.6311375", "0.63090146", "0.63060147", "0.62915593", "0.627...
0.7078704
0
GET /sites/1 GET /sites/1.json
def show update_and_decorate smartrender end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @sites = Site.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @sites }\n end\n end", "def index\n @sites = Site.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @sites }\n end\n...
[ "0.7444836", "0.7444836", "0.7214904", "0.7204854", "0.7108241", "0.70891887", "0.70891887", "0.70891887", "0.7068557", "0.703299", "0.69449097", "0.68207115", "0.68081486", "0.67804134", "0.67772996", "0.6742932", "0.67404276", "0.6618609", "0.656212", "0.6556428", "0.655562...
0.0
-1
GET /sites/new GET /sites/new.json
def new # return if need_login true, true update_and_decorate response_service.title = "New Site" render :edit end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @site = Site.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @site }\n end\n end", "def new\n @site = Site.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @site }\n end\n end", ...
[ "0.80053765", "0.79289687", "0.79289687", "0.79289687", "0.79289687", "0.76236874", "0.7538435", "0.7462429", "0.72648567", "0.72642076", "0.725427", "0.71223825", "0.7115141", "0.70964307", "0.7091733", "0.7066875", "0.70665777", "0.7032004", "0.70274115", "0.70027065", "0.6...
0.0
-1
POST /sites POST /sites.json
def create update_and_decorate respond_to do |format| if !@site.errors.any? format.html { redirect_to @site, notice: 'Site was successfully created.' } format.json { render json: @site, status: :created, location: @site } else format.html { render action: "new" } format.json { render json: @site.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @site = current_user.sites.create(params[:site])\n respond_to do |format|\n if @site.save\n format.html { flash_and_redirect(\"successfully saved!\", sites_url) }\n format.json { render json: @site, status: :created, location: @site }\n else\n format.html { render ...
[ "0.67946297", "0.66968215", "0.65516245", "0.65030956", "0.64209604", "0.64209604", "0.64209604", "0.6335178", "0.63177776", "0.629245", "0.62879896", "0.6279627", "0.6162099", "0.61234045", "0.6087425", "0.6069964", "0.6069242", "0.6069242", "0.6049953", "0.60482645", "0.602...
0.5690528
52
PUT /sites/1 PUT /sites/1.json
def update if update_and_decorate respond_to do |format| format.html { redirect_to @site, notice: 'Site #{@site.name} was successfully updated.' } format.json { flash[:popup] = "#{@site.name} updated" render :update } end else if @site post_resource_errors @site else flash[:alert] = "Couldn't fetch site" end render :edit, status: :unprocessable_entity end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @site = current_user.sites.find(params[:id])\n\n respond_to do |format|\n if @site.update_attributes(params[:site])\n format.html { flash_and_redirect(\"successfully updated!\", sites_url) }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" ...
[ "0.6714442", "0.6679554", "0.66156656", "0.6500878", "0.64867646", "0.64633393", "0.6455145", "0.6401375", "0.63247436", "0.6320626", "0.63044417", "0.6296157", "0.62479657", "0.6227342", "0.6216542", "0.6211085", "0.619438", "0.61918175", "0.61918175", "0.61883056", "0.61883...
0.56141543
75
DELETE /sites/1 DELETE /sites/1.json
def destroy # return if need_login true, true @site = Site.find params[:id] @site.destroy respond_to do |format| format.html { redirect_to sites_url } format.json { head :ok } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @site.destroy\n\n respond_to do |format|\n format.html { redirect_to sites_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @site.destroy\n respond_to do |format|\n format.html { redirect_to sites_url }\n format.json { head :no_content }\n ...
[ "0.7356214", "0.73258954", "0.73258954", "0.73258954", "0.73258954", "0.73258954", "0.7317765", "0.7289903", "0.7289903", "0.7289903", "0.7289903", "0.7289903", "0.7289426", "0.7267864", "0.72534925", "0.7246142", "0.7225299", "0.7222419", "0.7191969", "0.71299064", "0.710079...
0.6695226
65
One pass using a stack
def remove_nth_from_end3(head, n) node=head stack=[] until node.nil? stack.push(node) node=node.next end return head.next if stack.length == n #Remove first node (n+1).times {node = stack.pop} #Middle and last nodes node.next=node.next.next return head end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def stack(*args); end", "def stack; end", "def stack; end", "def StartStack\n\n end", "def take_from_stack\n stack.pop\n end", "def to_stack; end", "def push\n CGContextSaveGState(@ctx)\n @stacksize = @stacksize + 1\n end", "def push_stack\n bb = {:black => get_black,:white => ...
[ "0.7622253", "0.7207581", "0.7207581", "0.66762197", "0.6608391", "0.6566702", "0.65523124", "0.64558053", "0.6427265", "0.6393154", "0.6296804", "0.6185683", "0.61577433", "0.6111072", "0.60920596", "0.6079776", "0.6078906", "0.6051927", "0.60299385", "0.6003411", "0.599751"...
0.0
-1
One pass. No additional space. Two pointers
def remove_nth_from_end(head, n) node1 = node2 = head # Two pointers n.times do return head.next if node2.next.nil? node2=node2.next end node1=node1.next until (node2=node2.next).nil? node1.next=node1.next.next #Remove node n return head end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def *(p0) end", "def *(p0) end", "def *(p0) end", "def store(p0, p1) end", "def two1 a; a[0] + a[1] end", "def []=(p0, p1) end", "def []=(p0, p1) end", "def &(p0) end", "def &(p0) end", "def swap_fix_it(p1, p2)\n\n p1_copy = p1.dup\n \n p1.x = p2.x\n p1.y = p2.y\n\n p2.x = p1_copy.x\n p2.y ...
[ "0.6253374", "0.6253374", "0.6252994", "0.6175468", "0.6047269", "0.6002611", "0.6002611", "0.59984654", "0.59984654", "0.5845303", "0.58429253", "0.5815255", "0.5815255", "0.57969266", "0.5779903", "0.5778763", "0.55499846", "0.54909176", "0.5467767", "0.5439011", "0.5435452...
0.0
-1
Returns a new instance of Vedeu::Renderers::EscapeSequence.
def initialize(output) @output = output end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initialize\n super(name: 'Escape')\n end", "def _escape(object)\n ::Hanami::View::Escape::Presenter.new(object)\n end", "def escape(target)\n new(target.to_s.gsub(/[#{Entities}]/) {|m| \"&#{Encode[m]};\" })\n end", "def initialize(output, escape_from = nil)\n @out...
[ "0.61984944", "0.55808824", "0.5510202", "0.54157424", "0.53599584", "0.53272575", "0.52848655", "0.5152683", "0.50377053", "0.502366", "0.4988816", "0.4969157", "0.49680075", "0.49486387", "0.49412054", "0.49386084", "0.48958707", "0.4875744", "0.48671928", "0.48668352", "0....
0.0
-1
Escapes the escape sequences.
def parsed @parsed ||= Array(output).flatten.map do |char| Esc.escape(char.to_s) + "\n" end.join end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def escape(*chars)\n gsub(/(?<!\\\\)(#{chars.join(\"|\")})/) do |char|\n \"\\\\\" + char\n end\n end", "def escape(string); end", "def escape(text)\n return text.gsub(/[\\`*_{}\\[\\]()#+\\-.!]/, \"\\\\\\\\\\\\0\")\n end", "def escape(stream = '')\n return stream if abse...
[ "0.7433243", "0.7394004", "0.7252334", "0.7153068", "0.7028619", "0.6949779", "0.6939599", "0.6803806", "0.6745386", "0.67050564", "0.66434574", "0.6615006", "0.65891075", "0.6580175", "0.6580175", "0.6580175", "0.6580175", "0.6580175", "0.6580175", "0.6580175", "0.6580175", ...
0.0
-1
GET /magisterial_districts GET /magisterial_districts.json
def index @magisterial_districts = MagisterialDistrict.where(user_id: current_user.user_id).search(params[:search]).paginate(page: params[:page], per_page: 50).order('updated_at DESC') end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_magisterial_district\n @magisterial_district = MagisterialDistrict.find(params[:id])\n end", "def show\n @districtclass = Districtclass.find(params[:id])\n @districts = @districtclass.districts.all(:order => 'district_name')\n\n respond_to do |format|\n format.html # show.html.erb\n...
[ "0.7035503", "0.6979753", "0.68250364", "0.6799545", "0.66891664", "0.66223246", "0.6576849", "0.6494897", "0.6446574", "0.64063174", "0.63703495", "0.63409287", "0.6323352", "0.62738657", "0.6258018", "0.6199975", "0.617803", "0.61627305", "0.6137722", "0.6124771", "0.609435...
0.68578106
2
GET /magisterial_districts/1 GET /magisterial_districts/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_magisterial_district\n @magisterial_district = MagisterialDistrict.find(params[:id])\n end", "def show\n @districtclass = Districtclass.find(params[:id])\n @districts = @districtclass.districts.all(:order => 'district_name')\n\n respond_to do |format|\n format.html # show.html.erb\n...
[ "0.7301953", "0.7014119", "0.6937816", "0.682459", "0.6764693", "0.6749708", "0.67492706", "0.6677338", "0.66005427", "0.6466002", "0.6451877", "0.6450642", "0.6437659", "0.6380719", "0.636016", "0.6306895", "0.6305034", "0.62844163", "0.62758005", "0.6273465", "0.6269933", ...
0.0
-1
POST /magisterial_districts POST /magisterial_districts.json
def create #@magisterial_district = MagisterialDistrict.new(magisterial_district_params) @zone = Zone.find_by(zone_description: params[:magisterial_district][:magisterialdistrict_zone]) if !@zone @zone1 = Zone.create!(zone_description: params[:magisterial_district][:magisterialdistrict_zone],user_id: current_user.user_id) @magisterial_district = MagisterialDistrict.new(user_id: current_user.user_id,magisterialdistrict_zone: params[:magisterial_district][:magisterialdistrict_zone],magisterialdistrict_code: params[:magisterial_district][:magisterialdistrict_code],magisterialdistrict_district: params[:magisterial_district][:magisterialdistrict_district],magisterialdistrict_province: params[:magisterial_district][:magisterialdistrict_province],:zone_id => @zone1.id) respond_to do |format| if @magisterial_district.save @magisterial_district.update(uid: "md_" + @magisterial_district.id.to_s) @dis = @magisterial_district.created_at.to_s + "$" + @magisterial_district.magisterialdistrict_zone.to_s + '$' + @magisterial_district.magisterialdistrict_district.to_s + '$' + @magisterial_district.magisterialdistrict_code.to_s + '$' + @magisterial_district.magisterialdistrict_province.to_s Log.create!(description: @dis, username: current_user.name, uid: "md_" + @magisterial_district.id.to_s,user_id: current_user.user_id) format.html { redirect_to magisterial_districts_url, notice: 'Magisterial district was successfully created.' } format.json { render :show, status: :ok, location: @magisterial_district } else format.html { render :new } format.json { render json: @magisterial_district.errors, status: :unprocessable_entity } end end else @magisterial_district1 = MagisterialDistrict.new(user_id: current_user.user_id,magisterialdistrict_zone: params[:magisterial_district][:magisterialdistrict_zone],magisterialdistrict_district: params[:magisterial_district][:magisterialdistrict_district],magisterialdistrict_province: params[:magisterial_district][:magisterialdistrict_province],:zone_id => @zone.id) respond_to do |format| if @magisterial_district1.save @magisterial_district1.update(uid: "md_" + @magisterial_district1.id.to_s) @dis1 = @magisterial_district1.created_at.to_s + "$" + @magisterial_district1.magisterialdistrict_zone.to_s + '$' + @magisterial_district1.magisterialdistrict_district.to_s + '$' + @magisterial_district1.magisterialdistrict_code.to_s + '$' + @magisterial_district1.magisterialdistrict_province.to_s Log.create!(description: @dis1, username: current_user.name, uid: "md_" + @magisterial_district1.id.to_s,user_id: current_user.user_id) format.html { redirect_to magisterial_districts_url, notice: 'Magisterial district was successfully created.' } format.json { render :show, status: :ok, location: @magisterial_district1 } else format.html { render :new } format.json { render json: @magisterial_district.errors, status: :unprocessable_entity } end end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @district = District.new(district_params)\n\n respond_to do |format|\n if @district.save\n format.html { redirect_to @district, notice: 'District was successfully created.' }\n format.json { render :show, status: :created, location: @district }\n else\n format.html...
[ "0.7025748", "0.7025748", "0.68858445", "0.6882479", "0.68403846", "0.6701153", "0.6660749", "0.6638711", "0.6626325", "0.66118777", "0.66081536", "0.66016495", "0.65715176", "0.65500635", "0.64203984", "0.64111423", "0.63387215", "0.63387215", "0.6277854", "0.62676394", "0.6...
0.63583875
16
PATCH/PUT /magisterial_districts/1 PATCH/PUT /magisterial_districts/1.json
def update respond_to do |format| if @magisterial_district.update(magisterial_district_params) @dis1 = @magisterial_district.created_at.to_s + "$" + @magisterial_district.magisterialdistrict_zone.to_s + '$' + @magisterial_district.magisterialdistrict_district.to_s + '$' + @magisterial_district.magisterialdistrict_code.to_s + '$' + @magisterial_district.magisterialdistrict_province.to_s Log.create!(description: @dis1, username: current_user.name, uid: @magisterial_district.uid,user_id: current_user.user_id) format.html { redirect_to magisterial_districts_url, notice: 'Magisterial district was successfully updated.' } format.json { render :show, status: :ok, location: @magisterial_district } else format.html { render :edit } format.json { render json: @magisterial_district.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @district = District.find(params[:id])\n\n respond_to do |format|\n if @district.update_attributes(params[:district])\n flash[:success] = \"Район успешно отредактирован.\"\n format.html { redirect_to @district }\n format.json { head :no_content }\n else\n fl...
[ "0.67293596", "0.6675795", "0.6675795", "0.66723055", "0.65453947", "0.650972", "0.6494883", "0.64921963", "0.6402152", "0.6390123", "0.6344601", "0.62592256", "0.62512594", "0.62512594", "0.6128648", "0.6090195", "0.6084774", "0.6055886", "0.6035119", "0.60142046", "0.600701...
0.617227
14
DELETE /magisterial_districts/1 DELETE /magisterial_districts/1.json
def destroy @magisterial_district.destroy respond_to do |format| format.html { redirect_to magisterial_districts_url, notice: 'Magisterial district was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @district.destroy\n respond_to do |format|\n format.html { redirect_to admin_districts_url, notice: '删除成功!' }\n format.json { head :no_content }\n end\n end", "def destroy\n @clidistrict = Clidistrict.find(params[:id])\n @clidistrict.destroy\n\n respond_to do |format|\n...
[ "0.74152", "0.73835677", "0.7350727", "0.7344662", "0.73413295", "0.73082995", "0.73082995", "0.7275211", "0.7244149", "0.7228908", "0.7148574", "0.71406156", "0.7019948", "0.6927039", "0.6927039", "0.68556404", "0.6844657", "0.6836599", "0.6759194", "0.6756045", "0.67435825"...
0.7899928
0
Use callbacks to share common setup or constraints between actions.
def set_magisterial_district @magisterial_district = MagisterialDistrict.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 magisterial_district_params params.require(:magisterial_district).permit(:user_id, :magisterialdistrict_zone, :magisterialdistrict_district, :magisterialdistrict_code, :magisterialdistrict_province) 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
=== self ==== Authorizations ====
def allow_to? action, editor case action when :create true when :read false when :update false when :delete editor.data._id == owner!.fetch('_id') end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def authorizations\n @@authorized_actions ||= {}\n @@authorized_actions\n end", "def authorization; end", "def index\n @authorizations = Authorization.all\n end", "def index\n @authorizations = Authorization.all\n end", "def ach_authorizations(entity_id)\n API::request(:get, \"e...
[ "0.7339607", "0.7142362", "0.7054916", "0.7054916", "0.6971667", "0.6871236", "0.6871236", "0.68635637", "0.68391144", "0.6629766", "0.65932447", "0.65372276", "0.6515634", "0.6515634", "0.6507924", "0.6427242", "0.6396003", "0.63493145", "0.62674475", "0.62462544", "0.624302...
0.0
-1
Returns a string which describes this task.
def description "This task hits the Corpwatch API and creates an object for all found entities." end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_s # Method to display completion status and description of Task\n \"#{represent_status} : #{description}\"\n end", "def task_details_for_log\n \"Node #{@puppet_mclient.node_id}, task #{@task}, manifest \"\\\n \"#{@puppet_mclient.manifest}\"\n end", "def taskDescription _args\n \"ta...
[ "0.799827", "0.7680068", "0.7404178", "0.7316715", "0.7292764", "0.72387326", "0.71553576", "0.714361", "0.7133372", "0.7100784", "0.70201147", "0.70195675", "0.7015218", "0.7006205", "0.6996942", "0.6971912", "0.69639343", "0.694675", "0.69346523", "0.6879938", "0.6846278", ...
0.60670894
93
Returns an array of valid types for this task
def allowed_types [SearchString] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_tasks_for(object)\n tasks_for_type = []\n\n @tasks.each do |task|\n if task.allowed_types.include?(object.class)\n tasks_for_type << task\n end\n end\n\n tasks_for_type\n end", "def get_task_types_eng\n [\"vat_jan\", \"vat_mar\", \"vat_may\", \"vat_jul\", \"vat_sept\", \"...
[ "0.6776899", "0.67113894", "0.6647227", "0.6628171", "0.64743054", "0.6272285", "0.62337744", "0.62003124", "0.61788154", "0.6147509", "0.61128145", "0.6110746", "0.6025798", "0.59960765", "0.59960765", "0.5962587", "0.5962587", "0.5962587", "0.5962587", "0.5962587", "0.59515...
0.0
-1
Default method, subclasses must override this
def run super # Attach to the corpwatch service & search x = Ear::Client::Corpwatch::CorpwatchService.new corps = x.search @object.name corps.each do |corp| # Create a new organization object & attach a record o = create_object Organization, { :name => corp.name, } o.physical_locations << create_object(PhysicalLocation, { :address => corps.first.address, :state => corps.first.state, :country => corps.first.country } ) end #@task_run.save_raw_result corps.to_s # Queue a detailed search TaskManager.instance.queue_task_run("hoovers_company_detail",o, {}) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def overrides; end", "def custom; end", "def custom; end", "def default; end", "def default; end", "def private; end", "def special\n override\n end", "def defaults\n super\n end", "def implementation; end", "def implementation; end", "def default\n end", "def defaults; end", ...
[ "0.7415348", "0.73554313", "0.73554313", "0.6991004", "0.6991004", "0.69613177", "0.69572926", "0.6824949", "0.6801543", "0.6801543", "0.67361915", "0.66934764", "0.66934764", "0.66934764", "0.66934764", "0.66934764", "0.66934764", "0.66934764", "0.66934764", "0.66934764", "0...
0.0
-1
given right and down, we continually move in those increments and count trees hit. if we hit the right edge of the map, continue back wrapping on the left side (cylinder). End when we hit the bottom. returns: count of trees hit
def trees_on_slope(right:, down:) x = 0 y = 0 count = 0 loop do count += 1 if map(x, y) == "#" x += right y += down break if y >= @height end count end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def traverse(map, right, down)\n bottom = map.count\n x, y, level, trees = 0, 0, 1, 0\n\n while level < bottom do\n x += right\n y += down\n trees += 1 if map[y][x.remainder(map[0].size)] == \"#\"\n level += down\n end\n trees\nend", "def tree_checker(map,right,down)\n horz = 0\n counter = 0\n...
[ "0.71847934", "0.6974354", "0.6372562", "0.62935925", "0.6131845", "0.61261404", "0.6034334", "0.60340583", "0.594764", "0.5928487", "0.5909727", "0.5852644", "0.58415204", "0.57238865", "0.5680727", "0.5680035", "0.56683224", "0.5639057", "0.56215173", "0.56213963", "0.56117...
0.7114001
1
top left is 0,0, moving right and down is positive.
def map(x, y) return nil if y >= @height @text_lines[y][x % @width] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def move_left\n\t\tmove([-1,0])\n\tend", "def move_down\n\t\tmove([0,1])\n\tend", "def move_up\n current_y = position[0] - 1\n position[0] = (current_y < 0 ) ? (width-1) : current_y\n end", "def move_up_left\n i = 1\n until false\n x, y = @pos\n x -= i\n y -= i\n pos = [x, y]...
[ "0.73159647", "0.7291958", "0.713752", "0.70265347", "0.694619", "0.6867119", "0.6863916", "0.6831575", "0.6798406", "0.6652431", "0.6638478", "0.66245294", "0.6616558", "0.6605461", "0.6594733", "0.6540594", "0.6539586", "0.6514284", "0.64754575", "0.64122313", "0.6363974", ...
0.0
-1
Since Data Objects are not "Marshallable", and they generally contain lots of types of data in their instance variables, we have this method. This will create and return a 'deep copy' of the data object as well as any and all nested data objects and collections it contains. Please note that this method will fail if you are putting Data Objects into Arrays or Hashes instead of into Collection classes
def data_object_copy opts = {} self.instance_variables.each do |var| key = var.to_s.gsub('@','').to_sym orig_val = instance_variable_get var opts[key] = case when orig_val.kind_of?(CollectionsFactory) orig_val.copy when orig_val.instance_of?(Array) || orig_val.instance_of?(Hash) begin Marshal::load(Marshal.dump(orig_val)) rescue TypeError raise %{\nKey: #{key.inspect}\nValue: #{orig_val.inspect}\nClass: #{orig_val.class}\n\nThe copying of the Data Object has thrown a TypeError,\nwhich means the object detailed above is not "Marshallable".\nThe most likely cause is that you have put\na Data Object inside an\nArray or Hash.\nIf possible, put the Data Object into a Collection.\n\n} end when orig_val.kind_of?(DataFactory) orig_val.data_object_copy else orig_val end end self.class.new(@browser, opts) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def deep_copy\n Marshal.load(Marshal.dump(self))\n end", "def deep_copy\n Marshal.load(Marshal.dump(self))\n end", "def deep_copy\n Marshal.load(Marshal.dump(self))\n end", "def deep_copy\n Marshal.load(Marshal.dump(self))\n end", "def deep_copy\r\n Marshal.load(Marshal...
[ "0.7011679", "0.69687396", "0.6947443", "0.6947443", "0.69451165", "0.6902215", "0.6899989", "0.6882338", "0.6851656", "0.6847303", "0.67907864", "0.67907864", "0.6748858", "0.6739522", "0.6715923", "0.6710733", "0.6681505", "0.6598908", "0.65953803", "0.6591149", "0.65718746...
0.775375
0
Add this to the bottom of your Data Object's initialize method. This method does 2 things: 1) Converts the contents of the hash into the class's instance variables. 2) Grabs the names of your collection class instance variables and stores them in an Array. This is to allow for the data object class to send any needed updates to its children. See notify_coolections for more details.
def set_options(hash) @collections ||= [] hash.each do |key, value| instance_variable_set("@#{key}", value) @collections << key if value.kind_of?(CollectionsFactory) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initialize(hash)\r\n hash.each { |k, v|\r\n # Create getters and setters\r\n self.class.attr_accessor(k)\r\n # Set value for created variable\r\n self.send(\"#{k}=\", v)\r\n }\r\n self.class.all.push(self)\r\n end", "def initialize\n @collection={}\n end", "def initialize\...
[ "0.6609248", "0.6515485", "0.6307325", "0.621523", "0.615191", "0.61383194", "0.61383194", "0.61383194", "0.61383194", "0.61293703", "0.6124861", "0.6124547", "0.6115768", "0.6115768", "0.6115768", "0.6115768", "0.6115768", "0.6115768", "0.6115768", "0.6115768", "0.61146194",...
0.0
-1
Use for setting a data object's class instance variable as a nested collection class. This method assumes your collection class name ends with "Collection". Therefore, the string you pass in its parameter is the first part of the class name. E.g., your collection class is called "DataObjectCollection", so, inside your parent object's defaults, you'd set the instance variable like this:
def collection(name) Kernel.const_get("#{name}Collection").new(@browser) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_collection value\n instance_variable_set(collection_name, value)\n end", "def set_collection_instance\n instance_variable_set(:\"@#{model_type.to_s.gsub('/', '__').pluralize}\", @resources)\n end", "def set_collection_instance\n instance_variable_set(:\"@#{model_type.to_s.gsub('/', '__...
[ "0.64904046", "0.6440576", "0.6440576", "0.64281964", "0.63543", "0.6299363", "0.6272293", "0.62131006", "0.615326", "0.6124549", "0.60392296", "0.5915849", "0.58903664", "0.5865865", "0.58012974", "0.57873106", "0.5742627", "0.57342726", "0.5689846", "0.5654925", "0.5635986"...
0.5148373
67
Items passed to this method are checked to ensure that the associated class instance variable is not nil. If it is, the script is aborted and an error is thrown. Use symbols separated by commas with this method. The symbol(s) should exactly match the name of the instance variable that must not be empty. NOTE: Currently this is backwards compatible with prior versions, which took the instance variables directly in the parameter. This backwards compatibility will be removed in some future update of the gem.
def requires(*elements) elements.each do |inst_var| if inst_var.kind_of? Symbol string="@#{inst_var.to_s}" if instance_variable_get(string)==nil raise "You've neglected to define a required variable for your #{self.class}.\n\nPlease ensure you always specify a value for #{string} when you create the data object." end elsif inst_var.kind_of? String warn "<<<<WARNING!>>>>\n\nPlease update the requires method in your\n#{self.class} class to refer to symbols\ninstead of directly referencing the class'\ninstance variables.\n\n Example:\n\n This...\n requires @document_id\n Should be updated to...\n requires :document_id\n\nIn future versions of TestFactory the 'requires'\nmethod will only support symbolized references\nto the instance variables. The backwards\ncompatibility will be removed.\n\n<<<<WARNING!>>>>" elsif inst_var==nil raise "You've neglected to define a required variable for your #{self.class}.\n\n<<<<WARNING!>>>>\n\nPlease update the requires method in your #{self} class to refer to symbols\ninstead of directly referencing the class'\ninstance variables.\n\nIn future versions of TestFactory the 'requires' method\nwill only support symbolized references\nto the instance variables. The backwards\ncompatibility will be removed.\n\n<<<<WARNING!>>>>" end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def class_variable_defined?(sym) end", "def instance_variable(opts)\n opts = check_params(opts,[:instance_variable])\n super(opts)\n end", "def validate_instance_vars\n flag = true\n self.instance_variables.each { |iv| flag = false if (self.instance_variable_get(iv) == nil && !iv.to_s.st...
[ "0.55488706", "0.54775286", "0.5469794", "0.5437752", "0.52681535", "0.52368313", "0.5214656", "0.5186134", "0.51348335", "0.5132921", "0.51042986", "0.50777125", "0.50387436", "0.5032946", "0.50233537", "0.50087476", "0.49781993", "0.496753", "0.4949717", "0.49490774", "0.49...
0.49096
24
A shortcut method for filling out fields on a page. The method's first parameter is the page class that contains the fields you want to fill out. That is followed by the list of field name(s) (as Symbols). This method has a number of requirements: 1) The field name and the instance variable name in your data object must be identical. For this reason, this method can only be used in your data objects' create methods. 2) Your checkbox and radio button data object instance variables are either +nil+, +:set+, or +:clear+. Any other values will not be handled correctly. 3) Since the listed fields get filled out in random order, be sure that this is okay in the context of your pagein other words, if field A needs to be specified before field B then having them both in your fill_out step would be inappropriate. If you need a specific order, use ordered_fill instead. 4) This method supports text fields, select lists, check boxes, and radio buttons, but only if their element definitions don't take a parameter. Please use the +fill_out_item+ with elements that do need a parameter defined.
def fill_out(page, *fields) f_o_i true, nil, page, *fields end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fill_out(page, *fields)\n methods={\n 'Watir::TextField' => lambda{|p, f| p.send(f).fit(get f)},\n 'Watir::Select' => lambda{|p, f| p.send(f).pick!(get f)},\n 'Watir::Radio' => lambda{|p, f| p.send(f, get(f)) unless get(f)==nil }\n }\n fields.shuffle.each do |field|\n ...
[ "0.7537317", "0.695396", "0.68847597", "0.6740197", "0.6460676", "0.6365686", "0.6063819", "0.6020217", "0.59549004", "0.591912", "0.5908911", "0.57603025", "0.57333016", "0.57215744", "0.5689913", "0.5674017", "0.56228125", "0.56205237", "0.5566601", "0.5565855", "0.55542535...
0.73711246
1
Use when you need to specify the order that the fields should be updated.
def ordered_fill(page, *fields) f_o_i false, nil, page, *fields end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update!(**args)\n @field_name = args[:field_name] if args.key?(:field_name)\n @order_type = args[:order_type] if args.key?(:order_type)\n @sort_order = args[:sort_order] if args.key?(:sort_order)\n end", "def set_order_fields(ar_values, ar_defaults, ar_ascdesc)\n @of_option...
[ "0.73239577", "0.6604324", "0.6357157", "0.63338774", "0.62369764", "0.6223821", "0.6215494", "0.6158562", "0.61510164", "0.61467063", "0.6132211", "0.6132211", "0.60800064", "0.60780877", "0.6053456", "0.60514957", "0.60422987", "0.6023765", "0.600803", "0.59943646", "0.5993...
0.0
-1
Same as fill_out, but used with methods that take a parameter to identify the target element...
def fill_out_item(name, page, *fields) f_o_i true, name, page, *fields end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def element=(_arg0); end", "def user_fill (element, data)\r\n begin\r\n key_processor(element)\r\n ****_fill(@selector, @locator, data)\r\n rescue Exception => e\r\n raise e.message\r\n raise e.backtrace.inspect\r\n end\r\n end", "def element=(element); end", "def get_elem_and_f...
[ "0.5905805", "0.5813838", "0.5752224", "0.57482135", "0.566211", "0.54436004", "0.5329991", "0.52728146", "0.52728146", "0.52728146", "0.52728146", "0.52675956", "0.5202291", "0.5187857", "0.514804", "0.514804", "0.5135194", "0.5118066", "0.5118066", "0.50657463", "0.49449825...
0.45026368
81
Use instead of fill_out_item when you need to specify the order that the fields should be updated.
def ordered_item_fill(name, page, *fields) f_o_i false, name, page, *fields end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_order_item\n \n end", "def fill_out_item(name, page, *fields)\n f_o_i true, name, page, *fields\n end", "def up_item \n order_op2(true, @item)\n end", "def update\n @order_item.update_attributes(order_item_params)\n @order_items = @order.order_items\n end", "def upda...
[ "0.7091839", "0.663792", "0.63053936", "0.6046482", "0.59861636", "0.5983068", "0.5980521", "0.5974038", "0.59021866", "0.59003824", "0.5840011", "0.5840011", "0.58225536", "0.5802636", "0.57861555", "0.57788676", "0.5770317", "0.57618135", "0.57544744", "0.57544744", "0.5754...
0.6550206
2
Equivalent to ordered_fill, except that it's used in the context of a Data Object's edit method(s). As such, it requires the edit method's hash to be passed as its own first parameter.
def edit_fields(opts, page, *fields) edit_item_fields opts, nil, page, *fields end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_fill\n end", "def fill\n \t@fill\n end", "def ordered_item_fill(name, page, *fields)\n f_o_i false, name, page, *fields\n end", "def ordered_fill(page, *fields)\n f_o_i false, nil, page, *fields\n end", "def fill(*args, &block)\n ary = self.to_a\n ary.fill *args, &block\...
[ "0.6152981", "0.5553991", "0.5484016", "0.5368501", "0.51676047", "0.5116156", "0.5094571", "0.5009489", "0.49598512", "0.49309552", "0.48295805", "0.48136133", "0.4799891", "0.4796327", "0.4781655", "0.47407764", "0.47381595", "0.47351995", "0.47276494", "0.4719763", "0.4712...
0.0
-1
Equivalent to ordered_item_fill, except that it's used in the context of a Data Object's edit method(s). As such, it requires the edit method's hash to be passed as its own first parameter.
def edit_item_fields(opts, name, page, *fields) parse_fields(opts, name, page, *fields) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ordered_item_fill(name, page, *fields)\n f_o_i false, name, page, *fields\n end", "def update_order_item\n \n end", "def update_fill\n end", "def edit_props(_item)\n {}\n end", "def fill(model, item_path, args)\n fill_properties(model, item_path, args)\n end", "def ...
[ "0.6235429", "0.5772273", "0.57348466", "0.5414943", "0.5389747", "0.52992976", "0.5192998", "0.5187993", "0.51463395", "0.51343155", "0.5119054", "0.50927675", "0.5059844", "0.5013317", "0.5011979", "0.5011979", "0.50112027", "0.49999487", "0.49955627", "0.4984093", "0.49828...
0.0
-1
This is a specialized method for use with any select list boxes that exist in the site you're testing and will contain unpredictable default values. Admittedly, this is a bit unusual, but one example would be be a "due date" list that changes its default selection based on today's date. You're going to want to do one of two things with that select list: 1) Retrieve and store the select list's value 2) Specify a custom value to select Enter: +get_or_select!+ Assuming you just want to store the default value, then your Data Object's instance variable for the field willinitiallybe nil. In that case, +get_or_select!+ will grab the select list's current value and store it in your instance variable. On the other hand, if you want to update that field with your custom value, then your instance variable will not be nil, so +get_or_select!+ will take that value and use it to update the select list. Note that this method only works with select lists that take a single selection. Multiselects are not supported. Also note that the first parameter is not the instance variable you need to use/update. It is a symbol that otherwise matches the instance variable.
def get_or_select!(inst_var_sym, select_list) value = instance_variable_get inst_var_sym if value==nil instance_variable_set inst_var_sym, select_list.selected_options[0].text else select_list.select value end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_or_select(hash_inst_var, select_list)\n if hash_inst_var==nil\n select_list.selected_options[0].text\n else\n select_list.select hash_inst_var\n hash_inst_var\n end\n end", "def select\n cached_fetch(:select){default_select}\n end", "def select_with_default_obje...
[ "0.6851508", "0.6680143", "0.66532165", "0.6593154", "0.6580418", "0.5992219", "0.5954685", "0.5914034", "0.58419466", "0.58045405", "0.57990193", "0.5797739", "0.57960916", "0.57870847", "0.5743054", "0.5722698", "0.5718249", "0.5680567", "0.567887", "0.56716496", "0.5656888...
0.6946114
0
This method accomplishes the same thing as get_or_select! but is used specifically when the instance variable being used/updated is a Hash and you only need to update one of its key/value pairs. Pay close attention to the syntax differences between this method and get_or_select! First, note that the returned value of this method must be explicitly passed to the relevant key in the Hash instance variable. Note also that, unlike get_or_select!, this method does not take a symbolized representation of the instance variable.
def get_or_select(hash_inst_var, select_list) if hash_inst_var==nil select_list.selected_options[0].text else select_list.select hash_inst_var hash_inst_var end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update(struct_or_hash)\n struct_or_hash.each_pair do |key,value|\n method = \"#{key}=\".to_sym\n self.send(method, value) if self.respond_to?(method)\n end\n self\n end", "def update(hash)\n raise(ArgumentError, \"Argument 'hash' must be a Hash.\") unless hash.is_a?(Hash)\n ...
[ "0.6106242", "0.57399076", "0.56935257", "0.5685999", "0.5672556", "0.5590889", "0.54329115", "0.5362421", "0.5355095", "0.533251", "0.53024805", "0.5270968", "0.5241519", "0.52025676", "0.52025676", "0.52025676", "0.52025676", "0.52025676", "0.52025676", "0.52025676", "0.520...
0.5241314
13
Define this method in your data object when it has a parent, and that parent may periodically need to send it updated information about itself.
def update_from_parent(update) raise %{ This method must be implemented in your data object class if you plan to pass updates from a parent object to the members of its collections. } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def prepare_refresh_before_update\n @parent_id_before = self.class.find(self.id).read_attribute(parent_id_column)\n end", "def _parent; end", "def has_changed_parent?\n self.parent_id_changed?\n end", "def touch_parent\n self.parent.touch if parent\n end", "def ensure_pa...
[ "0.6640496", "0.66165036", "0.64577186", "0.641736", "0.6399439", "0.6364909", "0.6276035", "0.6270406", "0.625676", "0.6245648", "0.6175689", "0.6138122", "0.61339575", "0.61337304", "0.6117112", "0.6117112", "0.6117112", "0.6117112", "0.6117112", "0.6117112", "0.6117112", ...
0.68893355
0
======= Do not use this method directly.
def f_o_i(shuffle, name, page, *fields) shuffle ? fields.shuffle! : fields parse_fields(nil, name, page, *fields) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def private; end", "def schubert; end", "def refutal()\n end", "def probers; end", "def specie; end", "def specie; end", "def specie; end", "def specie; end", "def implementation; end", "def implementation; end", "def custom; end", "def custom; end", "def private_method\n end", "d...
[ "0.8252392", "0.67681545", "0.6726084", "0.6719593", "0.6671715", "0.6671715", "0.6671715", "0.6671715", "0.6656349", "0.6656349", "0.6543532", "0.6543532", "0.65095156", "0.64012843", "0.6323797", "0.6318867", "0.62757844", "0.62757844", "0.6230124", "0.62047565", "0.6201184...
0.0
-1
Do not use this method directly.
def parse_fields(opts, name, page, *fields) fields.each do |field| lmnt = page.send(*[field, name].compact) var = opts.nil? ? instance_variable_get("@#{field}") : opts[field] lmnt.class.to_s == 'Watir::Select' ? lmnt.pick!(var) : lmnt.fit(var) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def private; end", "def refutal()\n end", "def private_method\n end", "def implementation; end", "def implementation; end", "def schubert; end", "def probers; end", "def specie; end", "def specie; end", "def specie; end", "def specie; end", "def internal; end", "def custom; end", ...
[ "0.81749564", "0.68876845", "0.6858681", "0.672525", "0.672525", "0.6687892", "0.6585444", "0.6568359", "0.6568359", "0.6568359", "0.6568359", "0.65178233", "0.6508353", "0.6508353", "0.6470677", "0.63410556", "0.63141227", "0.63141227", "0.6311893", "0.6311893", "0.6311893",...
0.0
-1
Use this method in conjunction with your nested collection classes. The collections will notify their members about the passed parameters. Note: You must write a custom update_from_parent method in your data object that will know what to do with the parameter(s) passed to it.
def notify_collections *updates @collections.each {|coll| instance_variable_get("@#{coll}").notify_members *updates } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_from_parent(update)\n raise %{\n This method must be implemented in your data object\n class if you plan to pass updates from a\n parent object to the members of its\n collections.\n }\n end", "def update!(**args)\n @added_parents = args[:added_parents] if args.key?(...
[ "0.7287591", "0.67292494", "0.64092076", "0.62018067", "0.613157", "0.60565156", "0.6010278", "0.59763867", "0.5961938", "0.5934803", "0.58548933", "0.5803025", "0.5775928", "0.5771621", "0.5767551", "0.57454264", "0.57449317", "0.5737535", "0.5722586", "0.56717587", "0.56491...
0.5899027
10
GET /entradas/1 GET /entradas/1.xml
def show @entradas = Entrada.find(params[:id]) respond_to do |format| format.html # show.html.erb format.xml { render :xml => @entradas } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @entradas = Entrada.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @entradas }\n end\n end", "def download_xml\n\t\turi = URI.parse(\"http://www.esmadrid.com/opendata/tiendas_v1_es.xml\")\n\t\tresponse = Net::HTTP.get_response(uri)\n\t...
[ "0.7061323", "0.6945601", "0.689327", "0.6778746", "0.67777807", "0.6742282", "0.67287076", "0.6726005", "0.6687699", "0.66863966", "0.66270137", "0.6602745", "0.65891427", "0.65837246", "0.6577213", "0.6568468", "0.65055186", "0.6441277", "0.6425853", "0.64174986", "0.639987...
0.71619743
0
GET /entradas/new GET /entradas/new.xml
def new @entradas = Entrada.new respond_to do |format| format.html # new.html.erb format.xml { render :xml => @entradas } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @entrada = Entrada.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @entrada }\n end\n end", "def new\n @entidade = Entidade.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @entidade...
[ "0.750877", "0.74450177", "0.7419376", "0.7406951", "0.7393879", "0.73839754", "0.73657215", "0.7357614", "0.73553085", "0.73335063", "0.73245776", "0.7294583", "0.72857344", "0.7284219", "0.7263424", "0.7260114", "0.7253674", "0.7235877", "0.7214056", "0.7189867", "0.7181234...
0.76676595
0
POST /entradas POST /entradas.xml
def create @entradas = Entrada.new(params[:entrada]) respond_to do |format| if @entradas.save flash[:notice] = 'LANÇAMENTO ENTRADA EFETUADO' format.html { redirect_to(homes_path) } format.xml { render :xml => @entradas, :status => :created, :location => @entradas } else format.html { render :action => "new" } format.xml { render :xml => @entradas.errors, :status => :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def post(uri, xml)\r\n req = Net::HTTP::Post.new(uri)\r\n req[\"content-type\"] = \"application/xml\"\r\n req.body = xml\r\n request(req)\r\n end", "def create\n @entrada = Entrada.new(params[:entrada])\n\n respond_to do |format|\n if @entrada.save\n format.html { redirec...
[ "0.62639266", "0.62356067", "0.61845964", "0.60700524", "0.6051735", "0.59288335", "0.5914491", "0.58594537", "0.58487284", "0.58299905", "0.58166957", "0.5815974", "0.58082336", "0.57998073", "0.5765661", "0.5762491", "0.5759754", "0.57429814", "0.57043785", "0.5691574", "0....
0.6533152
0
PUT /entradas/1 PUT /entradas/1.xml
def update @entradas = Entrada.find(params[:id]) respond_to do |format| if @entradas.update_attributes(params[:entrada]) flash[:notice] = 'LANÇAMENTO ENTRADA ALTERADO.' format.html { redirect_to(@entradas) } format.xml { head :ok } else format.html { render :action => "edit" } format.xml { render :xml => @entradas.errors, :status => :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def put(uri, xml)\r\n req = Net::HTTP::Put.new(uri)\r\n req[\"content-type\"] = \"application/xml\"\r\n req.body = xml\r\n request(req)\r\n end", "def update opts = {}\n opts[:headers] ||= {}\n opts[:headers]['Content-Type'] ||= 'text/xml'\n post 'update', opts\n end", "def res...
[ "0.69834185", "0.6891512", "0.6691822", "0.6121258", "0.60664713", "0.60394675", "0.6000748", "0.5985617", "0.5967839", "0.5933656", "0.590277", "0.5888278", "0.5886702", "0.5837349", "0.57978743", "0.5785754", "0.57576865", "0.57565486", "0.57489926", "0.57309973", "0.571200...
0.6197738
3
DELETE /entradas/1 DELETE /entradas/1.xml
def destroy @entradas = Entrada.find(params[:id]) @entradas.destroy respond_to do |format| format.html{ redirect_to(homes_path) } format.xml { head :ok } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @entrada = Entrada.find(params[:id])\n @entrada.destroy\n\n respond_to do |format|\n format.html { redirect_to(mngr_entradas_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n RestClient.delete \"#{REST_API_URI}/contents/#{id}.xml\" \n self\n end", "def n...
[ "0.71183896", "0.70800704", "0.7068831", "0.7021387", "0.6967288", "0.6966857", "0.6933286", "0.6916873", "0.6902021", "0.68703675", "0.685086", "0.68047154", "0.68047154", "0.6800856", "0.67372394", "0.6732682", "0.67231053", "0.67208207", "0.66987675", "0.66954094", "0.6689...
0.70902103
1
Outline 5m Intro In hasketball couldn't we just have done this instead of going deep into map def get_players game_hash.values.map do |team_info| team_info[:players] end.flatten > game_hash[:home][:players] + game_hash[:away][:players] end Yes! However if the data changed our code would break. We need to think about how we can write our code to be dynamic. But at this point all of the data we have been working with has come from our specs. How can we retrieve real data to work with? 5m How the internet works 1. What is HTTP? HTTP stands for Hypertext Transfer Protocol and is used to structure requests and responses over the internet. HTTP requires data to be transferred from one point to another over the network. 2. The transfer of resources happens using TCP (Transmission Control Protocol). In viewing this webpage, TCP manages the channels between your browser and the server (in this case, When we type an address into the browser we are commanding it to open a TCP channel to the server that responds to that URL (or Uniform Resource Locator) In this situation, your computer, which is making the request, is called the client. The URL you are requesting is the address that belongs to the server. Once the TCP connection is established, the client sends a HTTP GET request to the server to retrieve the webpage it should display. After the server has sent the response, it closes the TCP connection. If you open the website in your browser again, or if your browser automatically requests something from the server, a new connection is opened which follows the same process described above. GET requests are one kind of HTTP method a client can call and are what we will be makeing today in order to retrieve data from googles books api. 3. What is JSON? JSON (JavaScript Object Notation) is a lightweight datainterchange format. It is easy for humans to read and write. It is easy for machines to parse and generate. JSON is built on two structures: 1. A collection of name/value pairs. In various languages, this is realized as an object, record, struct, dictionary, hash table, keyed list, or associative array. 2. An ordered list of values. In most languages, this is realized as an array, vector, list, or sequence. These are universal data structures. Virtually all modern programming languages support them in one form or another. 5m Ruby gems for working with APIs 15m Making requests to Google Books API 15m Student Exercise 15m Refactoring with Single Responsibility Principle Deliverables 1. Write an application that takes a search term from a user 2. Make a Request to the GoogleBooks API and get back some results 3. Display the titles, author names, and description for each book Stretch Bring in gems that help style terminal for module one week three project week.
def red colorize(:red) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def player_data\n players = []\n game_hash.each do |home_away, team_details|\n players << team_details[:players]\n end\n return players.flatten\nend", "def game_hash\n { :home => {\n :team_name => \"Brooklyn Nets\",\n :colors => [\"Black\", \"White\"],\n :players => {\n \"Alan Anderson\" =>{...
[ "0.7386598", "0.7376205", "0.7373844", "0.736783", "0.736771", "0.7364428", "0.7332361", "0.7330428", "0.7269265", "0.72675395", "0.7260697", "0.7248342", "0.72460854", "0.7243899", "0.723621", "0.72143316", "0.7210056", "0.72100544", "0.71837246", "0.7183036", "0.71756035", ...
0.0
-1
Run cvdr query for patients who have had a risk assessment eligability is determined by age at time of assessment
def run_cvdr_risk_assess_query(filter) filter = '1=1' if filter.blank? query = Query.find_by_sql([ "select e.order_by_cvdr orderby, e.ethnicity_cvdr ethnicity, count(distinct c.patient_id) count\n"+ "from claims c\n"+ " left join claims_data d on d.id = c.id\n"+ " left join patients p on p.id = c.patient_id\n"+ " left join ethnicities e on e.id = IsNull(p.ethnicity_id,#{Ethnicity::OTHER})\n"+ "where c.date_service >= ? and c.date_service <= ?\n"+ " and c.programme_id = ?\n"+ " and c.claim_status_id <= 6\n"+ " and d.cvdr_cvd_risk > 0\n"+ " and #{filter}\n"+ "group by e.order_by_cvdr, e.ethnicity_cvdr\n"+ "order by 1\n", @criteria.start_date, @criteria.end_date, @criteria.programme_id]) query end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def run_cvdr_query(heading,filter)\n filter = '1=1' if filter.blank?\n query = Query.find_by_sql([\n \"select dbo.ethnicity_cvdr(p.ethnicity_id) ethnicity, '#{heading}' heading, count(c.id) count\\n\"+\n \"from claims c\\n\"+\n \" left join claims_data d on d.id = c.id\\n\"+\n ...
[ "0.6775541", "0.5739233", "0.5534905", "0.55235", "0.54737264", "0.52981263", "0.52107453", "0.51919913", "0.5179983", "0.5170878", "0.5114624", "0.5066608", "0.49660265", "0.49580848", "0.4955932", "0.49481264", "0.49461946", "0.49372458", "0.49145687", "0.49009484", "0.4894...
0.7173858
0
Parameter: +value+:: string input to console
def initialize( value ) self.value = value end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def echo(value); end", "def echo(value); end", "def cli=(value); end", "def echo(value)\n send_command([:echo, value])\n end", "def user_input_value()\n puts \"Enter a value: \"\n value = gets.chomp.to_s\n return value\nend", "def echo (input)\n input\n end", "def echo(value)\n...
[ "0.67334706", "0.67334706", "0.666614", "0.6392982", "0.6336621", "0.62604016", "0.6210086", "0.61866313", "0.6119907", "0.6095233", "0.5991108", "0.596197", "0.58932", "0.58923584", "0.58870894", "0.58828664", "0.58695686", "0.58634835", "0.57708067", "0.57681155", "0.575878...
0.0
-1
Returns hash with flags as keys and arguments as values f argument >> f => arugment Parameter: +remove+:: Regexp of stuff to remove from argument
def get_flags( remove = nil ) # escape dashes for split @value.gsub!(/\\\-/, "<dash>") # Remove command, split by spaces if remove.nil? vars = @value.split(/\s-/) else vars = @value.gsub( remove, '' ).split(/\s-/) end # Hash to return flags = Hash.new # for each pair of arguments, place in Hash # flags[ flag ] = argument vars.each do |str| # Extract key and value key = str[/^\S+/] value = str.sub(/^\S+ /, '' ).gsub("<dash>", '-') # parse true/false values value = true if value.downcase == 'yes' or value.downcase == 'true' value = false if value.downcase == 'no' or value.downcase == 'false' value.chop! if value[-1] =~ /\s/ value = nil if value == '' flags[ key.to_sym ] = value unless key.nil? end # Return result flags end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_flags(msg)\n msg.scan(/-(\\w+)\\s*([^-]+)?/)\n .uniq{ |e| e[0] }\n .map{ |k, v| [k, v.nil? ? nil : v.squish] }\n .to_h\n .symbolize_keys\nend", "def extract_command_flags!(parameters)\n raw_command_flags = parameters.flatten.find_all { |arg| arg.start_with? \"--\" }\n par...
[ "0.5824933", "0.5819659", "0.57355857", "0.57305515", "0.56878215", "0.5686714", "0.5526422", "0.5500887", "0.54832506", "0.5472093", "0.5434607", "0.5423765", "0.540224", "0.53611374", "0.5332078", "0.5306812", "0.5306812", "0.5263861", "0.52573615", "0.52493393", "0.5245299...
0.69216317
0
get_flags Returns array of variables split by spaces. _ are repalced with space. Parameter: +command+:: command to be removed from string prior to variable extraction.
def get_vars( command = nil ) # Remove command and split by space. if command.is_a? NilClass # No command, so just split vars = self.value.split ' ' else vars = self.value.sub( /#{command} ?/, '' ).split ' ' end vars.map! do |element| # Replace underscores element.gsub!('_', ' ') # Parse true/false values if element.include? 'yes' or element.include? 'true' element = true elsif element.include? 'no' or element.include? 'false' element = false end # Return to map element end # Return element if only 1 exists, else the array vars = vars.length == 1 ? vars.first : vars end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_flags( remove = nil )\n\n\t\t# escape dashes for split\n\t\t@value.gsub!(/\\\\\\-/, \"<dash>\")\n\n\t\t# Remove command, split by spaces\n\t\tif remove.nil?\n\t\t\tvars = @value.split(/\\s-/)\n\t\telse\n\t\t\tvars = @value.gsub( remove, '' ).split(/\\s-/)\n\t\tend\n\n\t\t# Hash to return\n\t\tflags = Hash....
[ "0.677437", "0.6241095", "0.6149447", "0.6149447", "0.59495705", "0.59292763", "0.5900841", "0.5778978", "0.5711718", "0.5572573", "0.54367596", "0.5308906", "0.5306816", "0.5291266", "0.5277881", "0.52610624", "0.52498484", "0.52341205", "0.521454", "0.5201909", "0.5196954",...
0.7049445
0
def menu_2 input = nil while input != "exit" puts "Press '1' for a quick description. Type 'menu' or 'list' to check out another store. Type 'exit' to exit. if input.to_i == 1
def goodbye puts "Safe travels!" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def menu_exit\n puts \"\\nPlease type 'Menu' to navigate to the menu, or 'Exit' to exit\"\n puts\"\\n-------------------------------------------------------------------------------------------\"\n input = gets.strip.downcase\n if input == \"menu\"\n menu_items\n elsif input == \"exit\"\n ...
[ "0.8311977", "0.8019222", "0.7848229", "0.7715284", "0.7711254", "0.7674966", "0.7637215", "0.7627625", "0.7582747", "0.755939", "0.75565946", "0.7537525", "0.7532865", "0.7518804", "0.75169826", "0.7513054", "0.7504034", "0.7491208", "0.74805415", "0.74744797", "0.7470289", ...
0.0
-1
TODO: This might be accessible from the rendering scope, which wouldn't be good. Figure out if this needs to be removed.
def load_helpers paths = Dir.glob @site.helpers_path.join("**.rb") HelperLoader.new(paths: paths).extend_instance(self) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rendered=(_arg0); end", "def rendered; end", "def rendered_format; end", "def rendered_format; end", "def render_calls; end", "def view_renderer; end", "def view_renderer; end", "def rendering_options\n end", "def renderer; end", "def render\n # To be implemented.\n end", "def rend...
[ "0.6734758", "0.65610355", "0.6535139", "0.6535139", "0.64332193", "0.6288024", "0.6288024", "0.62429976", "0.6208683", "0.61731166", "0.61498857", "0.61498857", "0.61498857", "0.61498857", "0.61498857", "0.6089764", "0.608868", "0.6086577", "0.60823286", "0.6008946", "0.5968...
0.0
-1
GET /share_users GET /share_users.json
def index @share_users = ShareUser.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def share\n\n # Queries User by Tack Username\n item = ShareProfile.find(params[:share_profile_id])\n user = User.where({ username: params[:username] }).first\n\n # If user exists\n if item && user && user.id\n\n # Adds user to linked users\n item.linked_users << user\n\n # Updates Sh...
[ "0.73488945", "0.7194028", "0.6801358", "0.67829275", "0.6774161", "0.6660985", "0.6640296", "0.6502691", "0.64917284", "0.63922036", "0.6306559", "0.6266041", "0.6221967", "0.6208254", "0.61940163", "0.61698866", "0.6153805", "0.6117428", "0.6117398", "0.6083847", "0.6058798...
0.72937405
1
GET /share_users/1 GET /share_users/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def share\n\n # Queries User by Tack Username\n item = ShareProfile.find(params[:share_profile_id])\n user = User.where({ username: params[:username] }).first\n\n # If user exists\n if item && user && user.id\n\n # Adds user to linked users\n item.linked_users << user\n\n # Updates Sh...
[ "0.72067124", "0.7146753", "0.7119718", "0.6940541", "0.66387784", "0.65921736", "0.651367", "0.63808775", "0.63776875", "0.634454", "0.631378", "0.6306496", "0.62871367", "0.6284617", "0.6283312", "0.62640613", "0.6231682", "0.6176956", "0.61291814", "0.6122994", "0.61070967...
0.0
-1
POST /share_users POST /share_users.json
def create @share_user = ShareUser.new(share_user_params) respond_to do |format| if @share_user.save format.html { redirect_to @share_user, notice: 'Share user was successfully created.' } format.json { render :show, status: :created, location: @share_user } else format.html { render :new } format.json { render json: @share_user.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @user_share = UserShare.new(params[:user_share])\n if @user_share.insert(current_user.id)\n render json: @user_share, status: :created\n else\n render json: @user_share.errors, status: :unprocessable_entity\n end\n end", "def share\n\n # Queries User by Tack Username\n i...
[ "0.74918485", "0.74162614", "0.7359967", "0.6730021", "0.6656618", "0.6603353", "0.63517565", "0.63503736", "0.6214381", "0.6154856", "0.6123745", "0.61230737", "0.6015433", "0.60097766", "0.5970783", "0.59562206", "0.5942581", "0.59266406", "0.58844745", "0.5868589", "0.5863...
0.70680857
3
PATCH/PUT /share_users/1 PATCH/PUT /share_users/1.json
def update respond_to do |format| if @share_user.update(share_user_params) format.html { redirect_to @share_user, notice: 'Share user was successfully updated.' } format.json { render :show, status: :ok, location: @share_user } else format.html { render :edit } format.json { render json: @share_user.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @user_share = UserShare.find(params[:id])\n\n respond_to do |format|\n if @user_share.update_attributes(params[:user_share])\n format.html { redirect_to @user_share, notice: 'User share was successfully updated.' }\n format.json { head :no_content }\n else\n format...
[ "0.6920846", "0.6533159", "0.65174747", "0.64933646", "0.6312157", "0.6295694", "0.6256517", "0.6218623", "0.6218556", "0.6215037", "0.6207625", "0.62015057", "0.6190834", "0.61903775", "0.61903775", "0.61752856", "0.6140617", "0.614007", "0.6135823", "0.6126525", "0.6072917"...
0.6791532
1
DELETE /share_users/1 DELETE /share_users/1.json
def destroy @share_user.destroy respond_to do |format| format.html { redirect_to share_users_url, notice: 'Share user was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @user_share = UserShare.find(params[:id])\n @user_share.destroy\n\n respond_to do |format|\n format.html { redirect_to user_shares_url }\n format.json { head :no_content }\n end\n end", "def delete_user_for_tenant(args = {}) \n delete(\"/tenants.json/#{args[:tenantId]}/users/...
[ "0.7457554", "0.70546687", "0.69386435", "0.681555", "0.6814426", "0.68126345", "0.6809501", "0.6798605", "0.6789914", "0.67596567", "0.6743911", "0.67426634", "0.6733153", "0.6716762", "0.6709729", "0.6706167", "0.66956764", "0.6693896", "0.66714644", "0.6669154", "0.6668935...
0.73961973
1
Use callbacks to share common setup or constraints between actions.
def set_share_user @share_user = ShareUser.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 share_user_params params.require(:share_user).permit(:driver) 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
test that the 'for_category' method works
def test_feature_for_category features = Feature.for_category(categories(:root).id, 99) assert_equal(2, features.length) assert_equal(true, features.include?(products(:persian))) assert_equal(true, features.include?(products(:cow2))) features = Feature.for_category(categories(:livestock).id, 99) assert_equal(1, features.length) assert_equal(true, features.include?(products(:optioner))) features = Feature.for_category(categories(:dogs).id, 99) assert_equal(3, features.length) assert_equal(true, features.include?(products(:cow2))) assert_equal(true, features.include?(products(:cow3))) assert_equal(true, features.include?(products(:optioner))) # inherited from livestock features = Feature.for_category(categories(:dogs).id) assert_equal(1, features.length) # check that the correct number is given when the number to return is < the number of # results found in the db features = Feature.for_category(categories(:dogs).id, 1) assert_equal(1, features.length) features = Feature.for_category(categories(:dogs).id) assert_equal(1, features.length) # check a blank return features = Feature.for_category(categories(:utilities).id, 1) assert_equal(0, features.length) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_passed_by_category(category)\n tests.by_category_name(category)\n end", "def category; end", "def set_category\n end", "def has_categories? \n true\n end", "def _category\n @_category ||= if category\n category\n elsif special_category\n special_categ...
[ "0.72616935", "0.69063866", "0.68122345", "0.6669073", "0.66170114", "0.64175934", "0.640196", "0.63726133", "0.63534564", "0.63397866", "0.6320818", "0.6317749", "0.6282083", "0.6277704", "0.624677", "0.62357694", "0.6209901", "0.61985326", "0.61964905", "0.61961824", "0.616...
0.72666824
0
test that the 'for_static_page' method works basically the same as the 'for_category' method above, but for static pages
def test_feature_for_static_page features = Feature.for_static_page(static_pages(:home).id, 99) assert_equal(2, features.length) assert_equal(true, features.include?(products(:optioner))) assert_equal(true, features.include?(products(:cow2))) features = Feature.for_static_page(static_pages(:aboutus).id, 99) assert_equal(1, features.length) assert_equal(true, features.include?(products(:cow3))) # check that the correct number is given when the number to return is < the number of # results found in the db features = Feature.for_static_page(static_pages(:home).id, 1) assert_equal(1, features.length) features = Feature.for_static_page(static_pages(:home).id) assert_equal(1, features.length) # check a blank return features = Feature.for_static_page(static_pages(:contactus).id, 1) assert_equal(0, features.length) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def should_display_about_and_features\n controller.controller_name == \"static_pages\"\n end", "def should_have_correct_static_pages_links\n\tvisit root_path\n\tclick_link \"About\"\n\tpage.should have_selector 'title', text: full_title('About Us')\n\tclick_link \"Help\"\n\tpage.should have_selector 'title',...
[ "0.68735874", "0.65604675", "0.65017354", "0.6421043", "0.6204321", "0.61512256", "0.6124385", "0.60597634", "0.59955233", "0.5970512", "0.5968935", "0.5968935", "0.5968935", "0.5946535", "0.587916", "0.5862247", "0.581144", "0.57564056", "0.5745617", "0.573739", "0.5663539",...
0.6940014
0
test that the 'for_layout' method works similar to the 'for_category' method above, but for the layout
def test_feature_for_layout features = Feature.for_layout(99) assert_equal(2, features.length) assert_equal(true, features.include?(products(:optioner))) assert_equal(true, features.include?(products(:cow3))) # check that the correct number is given when the number to return is < the number of # results found in the db features = Feature.for_layout(1) assert_equal(1, features.length) features = Feature.for_layout assert_equal(1, features.length) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def validate_layout(layout); end", "def _conditional_layout?; end", "def determine_layout\n 'akinu'\n end", "def invalid_layout?(layout); end", "def invalid_layout?(layout); end", "def layout_children\n \n end", "def do_layout(payload, layouts)\n end", "def render_layout(output, layout, in...
[ "0.67871284", "0.67183465", "0.66343105", "0.6602513", "0.6602513", "0.6593199", "0.6570429", "0.65600795", "0.6556182", "0.65549105", "0.64628446", "0.64628446", "0.6434807", "0.6348855", "0.6339298", "0.63178384", "0.63096833", "0.63096833", "0.6307876", "0.6266978", "0.626...
0.64807606
10
test that a description given to a feature overrides (if provided) the products description
def test_overriding_description # first, a feature with no description assigned features = Feature.for_static_page(static_pages(:aboutus).id) assert_equal("Short description", features.first[:short_description]) # now, a feature with a description to override features = Feature.for_category(categories(:livestock).id) assert_equal("Different description", features.first[:short_description]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def try_to_get_product_description\n unless self.supply_item.nil?\n gotten_description = self.supply_item.get_description\n self.description = gotten_description unless (gotten_description == false or gotten_description.blank? or gotten_description.nil?)\n end\n end", "def description\n desc ...
[ "0.59656394", "0.587942", "0.58644414", "0.5852973", "0.5829416", "0.5804395", "0.5789326", "0.57739043", "0.57720995", "0.5770592", "0.57246614", "0.5695366", "0.56161153", "0.5609189", "0.5558953", "0.5555314", "0.5540665", "0.55264", "0.55184907", "0.55171055", "0.54949254...
0.77414656
0
Validates a Bearer token This method should return the full principal url, or false if the token was incorrect.
def validate_bearer_token(bearer_token) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def validate_token(token)\n object_from_response(Code42::TokenValidation, :get, \"authToken/#{token.to_s}\")\n end", "def check(request, response)\n auth = Http::Auth::Bearer.new(\n @realm,\n request,\n response\n )\n\n bearer_to...
[ "0.6986445", "0.6962431", "0.6884224", "0.66639704", "0.66567284", "0.654704", "0.6500449", "0.6499687", "0.64814454", "0.64327896", "0.64022934", "0.638969", "0.6384866", "0.6327826", "0.63148266", "0.6307271", "0.63028896", "0.6296748", "0.6276759", "0.6276759", "0.62716764...
0.6490489
8
When this method is called, the backend must check if authentication was successful. The returned value must be one of the following [true, "principals/username"] [false, "reason for failure"] If authentication was successful, it's expected that the authentication backend returns a socalled principal url. Examples of a principal url: principals/admin principals/user1 principals/users/joe principals/uid/123457 If you don't use WebDAV ACL (RFC3744) we recommend that you simply return a string such as: principals/users/[username]
def check(request, response) auth = Http::Auth::Bearer.new( @realm, request, response ) bearer_token = auth.token if bearer_token.blank? return [false, "No 'Authorization: Bearer' header found. Either the client didn't send one, or the server is mis-configured"] end principal_url = validate_bearer_token(bearer_token) if principal_url.blank? return [false, "Bearer token was incorrect"] end return [true, principal_url] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def authentication_successful?\n current_user.present?\n end", "def authentication_successful?\n @user.present?\n end", "def authentication_response_status\n authenticate_user.success? ? :ok : :unauthorized\n end", "def authenticate\n authenticate_or_request_with_http_digest(REALM) do |u...
[ "0.61524093", "0.61462736", "0.5964628", "0.5783895", "0.5690838", "0.5630399", "0.5630399", "0.5603501", "0.5585095", "0.5554351", "0.5554351", "0.5554351", "0.5554351", "0.5525431", "0.5517561", "0.5491214", "0.548388", "0.54707175", "0.54631275", "0.5460907", "0.5458479", ...
0.52848744
49