query
stringlengths
7
6.41k
document
stringlengths
12
28.8k
metadata
dict
negatives
listlengths
30
30
negative_scores
listlengths
30
30
document_score
stringlengths
5
10
document_rank
stringclasses
2 values
DELETE /occasions/1 DELETE /occasions/1.json
def destroy @occasion.destroy respond_to do |format| format.html { redirect_to occasions_url, notice: 'Occasion was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @occasion = Occasion.find(params[:id])\n @occasion.destroy\n\n respond_to do |format|\n format.html { redirect_to occasions_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @occasion.destroy\n respond_to do |format|\n format.html { redirect_to ...
[ "0.74619406", "0.717632", "0.6953965", "0.6805877", "0.6805877", "0.67915905", "0.6772811", "0.6764485", "0.6761373", "0.67551094", "0.67510015", "0.6746758", "0.67355454", "0.6722409", "0.6721993", "0.6720928", "0.67192477", "0.67051435", "0.66965383", "0.6686966", "0.668549...
0.7194895
1
getredisproto method mostly taken from redis documentation, with no license noted there.
def getredisproto(*args) proto = [] proto.push("*"+args.length.to_s+"\r\n") args.each{|arg| proto.push("$"+arg.to_s.bytesize.to_s+"\r\n") proto.push(arg.to_s+"\r\n") } proto end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def gen_redis_proto(*cmd)\n proto = \"\"\n proto << \"*\" + cmd.length.to_s + \"\\r\\n\"\n cmd.each do |arg|\n proto << \"$\" + arg.to_s.bytesize.to_s + \"\\r\\n\"\n proto << arg.to_s + \"\\r\\n\"\n end\n proto\n end", "def gen_redis_proto *cmd\n proto...
[ "0.68973935", "0.6895657", "0.68576854", "0.55794096", "0.5522293", "0.5379072", "0.5369867", "0.531917", "0.5317122", "0.5317122", "0.5270904", "0.51870227", "0.5186309", "0.51819515", "0.5172141", "0.5155367", "0.5116555", "0.5109411", "0.51070595", "0.51070595", "0.510531"...
0.74751437
0
clean up dangling content blobs that are older than BLOB_GRACE_PERIOD and not associated with an asset
def clean_content_blobs ContentBlob.where(asset: nil).where('created_at < ?', BLOB_GRACE_PERIOD.ago).select do |blob| Rails.logger.info("Cleaning up content blob #{blob.id}") blob.reload blob.destroy if blob.asset.nil? end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def purge_blobs\n photos_attachments.each do |photo_attachment|\n if photo_attachment.marked_for_destruction?\n photo_attachment.blob.purge_later\n end\n end\n end", "def cleanup_temporary_image\n self.transaction do\n self.where('keep_till < ?', Time.now).all.each do |record|...
[ "0.660854", "0.644825", "0.60443336", "0.59394455", "0.57942045", "0.5724272", "0.57048047", "0.5686879", "0.56603986", "0.56121755", "0.5596388", "0.55824083", "0.55557215", "0.55536395", "0.55338305", "0.55080605", "0.55010486", "0.55003375", "0.55003375", "0.54932195", "0....
0.8183501
0
removes any users accounts that have not fully registered by creating an associated profile, and that were created longer ago than the USER_GRACE_PERIOD
def remove_unregistered_users User.where(person: nil).where('created_at < ?', USER_GRACE_PERIOD.ago).destroy_all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def perform\n inactive_users = User.inactive_for_more_than(2.days)\n inactive_users.destroy_all\n end", "def clean_up\n User.where(\"confirmed IS NULL AND created_at < ?\", Time.now-1.day).destroy_all\n end", "def destroy_old_admin_applicants\n old_applicants = User.where(role: \"admin_applicant\...
[ "0.6712928", "0.62407935", "0.6160999", "0.6159996", "0.614098", "0.59418", "0.58645093", "0.5833298", "0.5744255", "0.5725912", "0.5702757", "0.5682002", "0.5676569", "0.5655934", "0.5610859", "0.56041414", "0.55320877", "0.5494167", "0.54889226", "0.54574656", "0.54445475",...
0.7399721
0
trims old sessions, using the db:sessions:trim task
def trim_session Rails.application.load_tasks Rake::Task['db:sessions:trim'].invoke end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cleanup\n\t\tcurrent_time = current_date_time\n\n\t\tputs current_time\n\n\t\t# delete all sessions that are older than 30 minutes\n\t\tActiveRecord::Base.connection.execute(\"DELETE FROM sessions WHERE updated_at < '#{current_time}'\")\n\tend", "def clean_sessions\n self.log_puts(\"Cleaning sessions on a...
[ "0.6645038", "0.6458709", "0.63670707", "0.58837026", "0.5831319", "0.57956046", "0.5744739", "0.5724672", "0.56819606", "0.56790954", "0.5668713", "0.5583643", "0.5544497", "0.54910743", "0.54902", "0.5477252", "0.5449822", "0.5423184", "0.5398256", "0.5395869", "0.52884156"...
0.7720065
0
resends an activation email, for unactivated users that haven't received an email since RESEND_ACTIVATION_EMAIL_DELAY and a total maximum of MAX_ACTIVATION_EMAILS (which will include the first one)
def resend_activation_emails User.where.not(person: nil).where.not(activation_code: nil).each do |user| if user.person logs = user.person.activation_email_logs if logs.count < MAX_ACTIVATION_EMAILS && (logs.empty? || logs.last.created_at < RESEND_ACTIVATION_EMAIL_DELAY.ago) Mailer.ac...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def send_activation_email\n ensure_activation_token_set\n UserMailer.account_activation(self, activation_token).deliver_later unless activated?\n end", "def resend_activation_email\n create_activation_digest\n save\n send_activation_email\n end", "def send_activation_email\n UserMailer.acco...
[ "0.76395684", "0.7530265", "0.74310166", "0.7217659", "0.7192913", "0.7174737", "0.71179324", "0.7113635", "0.70671463", "0.7021973", "0.69925255", "0.6991832", "0.6991832", "0.6991832", "0.6991832", "0.6991832", "0.6991832", "0.6991832", "0.6991832", "0.6991832", "0.6991832"...
0.84578097
0
GET /service_type_masters GET /service_type_masters.json
def index @service_type_masters = ServiceTypeMaster.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @masterservices = Masterservice.all\n end", "def index\n @service_master = ServiceMaster.new\n @service_masters = ServiceMaster.all\n end", "def set_masterservice\n @masterservice = Masterservice.find(params[:id])\n end", "def set_service_type_master\n @service_type_master...
[ "0.70567447", "0.6760248", "0.6460342", "0.6335917", "0.61507744", "0.6123434", "0.60862994", "0.6051508", "0.5936328", "0.59284437", "0.5909053", "0.5819673", "0.5799555", "0.57958573", "0.5771779", "0.57429564", "0.574087", "0.57207215", "0.5720252", "0.5715079", "0.5715079...
0.7554534
0
POST /service_type_masters POST /service_type_masters.json
def create @service_type_master = ServiceTypeMaster.new(service_type_master_params) respond_to do |format| if @service_type_master.save format.html { redirect_to @service_type_master, notice: 'Service type master was successfully created.' } format.json { render action: 'show', status: :c...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @masterservice = Masterservice.new(masterservice_params)\n\n respond_to do |format|\n if @masterservice.save\n format.html { redirect_to @masterservice, notice: 'Masterservice was successfully created.' }\n format.json { render :show, status: :created, location: @masterservice...
[ "0.66971606", "0.6608551", "0.6330021", "0.61909145", "0.61005056", "0.6083999", "0.6026088", "0.59835273", "0.59105617", "0.59062785", "0.5885013", "0.5877628", "0.58439934", "0.57504576", "0.5729869", "0.5679843", "0.56456363", "0.5640379", "0.55992275", "0.5594981", "0.558...
0.7162778
0
PATCH/PUT /service_type_masters/1 PATCH/PUT /service_type_masters/1.json
def update respond_to do |format| if @service_type_master.update(service_type_master_params) format.html { redirect_to @service_type_master, notice: 'Service type master was successfully updated.' } format.json { head :no_content } else format.html { render action: 'edit' } ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @service_master.update(service_master_params)\n @service_master = ServiceMaster.new\n @service_masters = ServiceMaster.all\n end", "def set_service_type_master\n @service_type_master = ServiceTypeMaster.find(params[:id])\n end", "def update\n respond_to do |format|\n if @...
[ "0.6626589", "0.6460784", "0.6457169", "0.6215841", "0.6012411", "0.60110337", "0.6009971", "0.59858805", "0.59663457", "0.59586585", "0.5921562", "0.58804315", "0.58310306", "0.57609785", "0.57364327", "0.57131785", "0.57071", "0.57071", "0.56954354", "0.56954354", "0.568258...
0.71282756
0
DELETE /service_type_masters/1 DELETE /service_type_masters/1.json
def destroy @service_type_master.destroy respond_to do |format| format.html { redirect_to service_type_masters_url } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @masterservice.destroy\n respond_to do |format|\n format.html { redirect_to masterservices_url, notice: 'Masterservice was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @service_type = ServiceType.find(params[:id])\n @service_ty...
[ "0.7238404", "0.7077941", "0.6990478", "0.6959615", "0.6959615", "0.687877", "0.6852835", "0.6819308", "0.6808207", "0.6792213", "0.6763455", "0.6763455", "0.6763455", "0.6763115", "0.67594284", "0.6754525", "0.6737758", "0.6695694", "0.66737854", "0.66716367", "0.6660031", ...
0.781496
0
GET /adversaires GET /adversaires.json
def index @adversaires = Adversaire.all respond_to do |format| format.html # index.html.erb format.json { render :json => @adversaires } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n @adversaire = Adversaire.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @adversaire }\n end\n end", "def index\n @antecedentes = Antecedente.all\n\n respond_to do |format|\n format.html # index.html.erb\n f...
[ "0.7044205", "0.61279804", "0.61175853", "0.6100125", "0.6073722", "0.60164106", "0.6011114", "0.59592867", "0.59421694", "0.59224385", "0.58847535", "0.58794487", "0.58718944", "0.5863959", "0.5859205", "0.5837101", "0.58307415", "0.58307415", "0.5830564", "0.582776", "0.581...
0.77473766
0
GET /adversaires/1 GET /adversaires/1.json
def show @adversaire = Adversaire.find(params[:id]) respond_to do |format| format.html # show.html.erb format.json { render :json => @adversaire } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @adversaires = Adversaire.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @adversaires }\n end\n end", "def show\n @serv_adicionale = ServAdicionale.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\...
[ "0.7689759", "0.66538554", "0.6489223", "0.64495176", "0.6445517", "0.6419912", "0.6332981", "0.62747234", "0.6272778", "0.6271669", "0.6259928", "0.6247678", "0.6246665", "0.6244119", "0.6241534", "0.623722", "0.62278074", "0.6189951", "0.61771756", "0.6142741", "0.613485", ...
0.7403843
1
POST /adversaires POST /adversaires.json
def create @adversaire = Adversaire.new(params[:adversaire]) @equipe = Equipe.find(params[:equipe_id]) respond_to do |format| if @adversaire.save format.html { redirect_to @equipe, :notice => 'Adversaire was successfully created.' } format.json { render :json => @adversaire, :status =...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @adversaires = Adversaire.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @adversaires }\n end\n end", "def new\n @equipe = Equipe.find(params[:equipe_id])\n \n @adversaire = Adversaire.new\n @adversaire.equipe = @equipe\n\...
[ "0.6595888", "0.6097787", "0.5984594", "0.59205884", "0.59102035", "0.5710794", "0.57097685", "0.57028395", "0.56891876", "0.56860554", "0.5677027", "0.56554306", "0.55997515", "0.5596368", "0.5591963", "0.55614734", "0.55543166", "0.55108947", "0.55046207", "0.549766", "0.54...
0.69416124
0
PUT /adversaires/1 PUT /adversaires/1.json
def update @adversaire = Adversaire.find(params[:id]) @equipe = Equipe.find(params[:equipe_id]) respond_to do |format| if @adversaire.update_attributes(params[:adversaire]) format.html { redirect_to @equipe, :notice => 'Adversaire was successfully updated.' } format.json { head :no_con...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @serv_adicionale = ServAdicionale.find(params[:id])\n\n respond_to do |format|\n if @serv_adicionale.update_attributes(params[:serv_adicionale])\n format.html { redirect_to @serv_adicionale, notice: 'Serv adicionale was successfully updated.' }\n format.json { head :no_content...
[ "0.6274904", "0.61585337", "0.6100573", "0.6089805", "0.60569453", "0.60055006", "0.5990302", "0.59811807", "0.59247917", "0.59129006", "0.59076166", "0.5906806", "0.5903343", "0.58729", "0.58480173", "0.5806164", "0.57998765", "0.57883483", "0.57594556", "0.57495445", "0.572...
0.6757945
0
DELETE /adversaires/1 DELETE /adversaires/1.json
def destroy @equipe = Equipe.find(params[:equipe_id]) @adversaire = Adversaire.find(params[:id]) @adversaire.destroy respond_to do |format| format.html { redirect_to @equipe } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @serv_adicionale = ServAdicionale.find(params[:id])\n @serv_adicionale.destroy\n\n respond_to do |format|\n format.html { redirect_to serv_adicionales_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @respuesta = Respuesta.find(params[:id])\n @respu...
[ "0.7122333", "0.6964952", "0.69625217", "0.69597495", "0.695259", "0.6923468", "0.6904102", "0.6899791", "0.68929213", "0.6891559", "0.68866503", "0.68860847", "0.68840605", "0.68811786", "0.6878483", "0.6855115", "0.68507683", "0.6849284", "0.6842502", "0.68303394", "0.68281...
0.7383552
0
Reconfigures the provided option, setting its value to `value`.
def call(value) Datadog.logger.debug { "Reconfigured tracer option `#{@setting_key}` with value `#{value}`" } if value.nil? # Restore the local configuration value configuration_object.unset_option( @setting_key, precedence: Core::Conf...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def configure_setting(name, value)\n configure do |settings|\n settings.unset!(name)\n settings[name] = parse_setting(settings.setting(name), value)\n end\n end", "def update_option(opt, val)\n @options[opt] = val\n end", "def option(key, value)\n key = Bcpm::Match.engine_op...
[ "0.65158695", "0.63972855", "0.62106466", "0.61317176", "0.60825855", "0.6017806", "0.601639", "0.59119356", "0.58890015", "0.58227146", "0.57885504", "0.5786829", "0.5778286", "0.57754695", "0.5751139", "0.5707841", "0.5706225", "0.56685907", "0.5634623", "0.5628221", "0.562...
0.76933825
0
getter that will increment the next_bib value in the database and return the result
def next_bib self[:next_bib] = self[:next_bib] + 1 end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def next_bib\n self[:next_bib] = self.inc(next_bib: 1)[:next_bib]\n\tend", "def next_id\n self.latest_id += 1\n end", "def next\n\t\tself + 1\n\tend", "def next_id\n (@curr_id +=1).to_s\n end", "def increment\n curr_value = counter\n self.counter = curr_value + 1\n save\n cur...
[ "0.848909", "0.66430503", "0.64042443", "0.63620085", "0.6321063", "0.6306583", "0.6282942", "0.6275506", "0.62644005", "0.624657", "0.6228603", "0.61961347", "0.61890036", "0.6177413", "0.61709696", "0.6167986", "0.6123598", "0.61110866", "0.61020774", "0.6096994", "0.609190...
0.8294113
1
returns a Placing instance with its name set to the name of the age group the racer will be competing in
def get_group racer if racer && racer.birth_year && racer.gender quotient=(date.year-racer.birth_year)/10 min_age=quotient*10 max_age=((quotient+1)*10)-1 gender=racer.gender name=min_age >= 60 ? "masters #{gender}" : "#{min_age} to #{max_age} (#{gender})" Placing.demongoize(:name...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_group racer\n\t\tif racer && racer.birth_year && racer.gender\n\t\t\tquotient=(date.year-racer.birth_year)/10\n\t\t\tmin_age=quotient*10\n\t\t\tmax_age=((quotient+1)*10)-1\n\t\t\tgender=racer.gender\n\t\t\tname=min_age >= 60 ? \"masters #{gender}\" : \"#{min_age} to #{max_age} (#{gender})\"\n\t\t\tPlacing....
[ "0.70971876", "0.5949645", "0.59472334", "0.57195187", "0.56466264", "0.5625743", "0.5339288", "0.5335686", "0.5334706", "0.53182876", "0.52509105", "0.5249419", "0.52217895", "0.52217895", "0.52217895", "0.52217895", "0.52217895", "0.5219858", "0.52095926", "0.5207008", "0.5...
0.7204882
0
create a new Entrant for the Race for a supplied Racer
def create_entrant racer # build a new Entrant entrant = Entrant.new { |r| # clone the relevant Race information within Entrant.race r.build_race(self.attributes.symbolize_keys.slice(:_id, :n, :date)) # clone the RaceInfo attributes within Entrant.racer r.build_racer(racer.info.attribut...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_entrant racer\n\t\tentrant = Entrant.new\n\t\tentrant.race = self.attributes.symbolize_keys.slice(:_id, :n, :date)\n\t\tentrant.racer = racer.info.attributes\n\t\tentrant.group = self.get_group(racer)\n\t\tevents.each do |event|\n \t \tif event\n \t\tentrant.send(\"#{event.name}=\", event)\n ...
[ "0.7477985", "0.66777647", "0.62276137", "0.5967927", "0.5967927", "0.58257663", "0.581496", "0.5790698", "0.5737334", "0.57169336", "0.5685861", "0.56776965", "0.56316113", "0.56316113", "0.56316113", "0.56316113", "0.56316113", "0.5503881", "0.54605424", "0.5459186", "0.540...
0.8058066
0
GET /evaluaciones/1 GET /evaluaciones/1.xml
def show @evaluacione = Evaluacione.find(params[:id]) respond_to do |format| format.html # show.html.erb format.xml { render :xml => @evaluacione } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\r\n @evaluaciones = Evaluacione.all\r\n end", "def index\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @evaluators }\n end\n end", "def show\r\n @evaluation = Evaluation.find(params[:id])\r\n @responses = Response.find_all_by_Evalu...
[ "0.65458894", "0.6539789", "0.6520937", "0.6506127", "0.6478041", "0.6476702", "0.643366", "0.6340797", "0.62616915", "0.6201947", "0.61645305", "0.6144908", "0.60656065", "0.6037255", "0.60119736", "0.59711564", "0.59603727", "0.5948803", "0.59164196", "0.58901685", "0.58869...
0.7179133
0
GET /evaluaciones/new GET /evaluaciones/new.xml
def new @evaluacione = Evaluacione.new respond_to do |format| format.html # new.html.erb format.xml { render :xml => @evaluacione } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @estacion = Estacion.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @estacion }\n end\n end", "def new\n @estagio = Estagio.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @est...
[ "0.73444235", "0.7029901", "0.700799", "0.6965129", "0.69602835", "0.694903", "0.69425124", "0.6895614", "0.6863163", "0.6862484", "0.6858303", "0.6849317", "0.684832", "0.68457526", "0.6836905", "0.6826136", "0.68043894", "0.68008494", "0.68008494", "0.6800445", "0.6791564",...
0.774188
0
POST /evaluaciones POST /evaluaciones.xml
def create @evaluacione = Evaluacione.new(params[:evaluacione]) respond_to do |format| if @evaluacione.save format.html { redirect_to(@evaluacione, :notice => 'Evaluacione was successfully created.') } format.xml { render :xml => @evaluacione, :status => :created, :location => @evaluacio...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def post_evaluate(excon, body)\n excon.request(\n method: :post,\n path: '/evaluate',\n headers: { 'Content-Type' => 'application/json' },\n body: body\n )\nend", "def evaluacione_params\r\n params.require(:evaluacione).permit(:contestada, :curso_id, :encuesta_id, :nombre)\r\n end", "def ...
[ "0.6443393", "0.61755776", "0.60337514", "0.6032301", "0.5985007", "0.5968063", "0.594564", "0.59177965", "0.5874566", "0.5771221", "0.57186526", "0.56468993", "0.564466", "0.5627873", "0.5609866", "0.55782497", "0.5567646", "0.55050796", "0.55003476", "0.5490839", "0.5487217...
0.6520938
0
PUT /evaluaciones/1 PUT /evaluaciones/1.xml
def update @evaluacione = Evaluacione.find(params[:id]) respond_to do |format| if @evaluacione.update_attributes(params[:evaluacione]) format.html { redirect_to(@evaluacione, :notice => 'Evaluacione was successfully updated.') } format.xml { head :ok } else format.html { re...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @evaluacion = Evaluacion.find(params[:id])\n\n respond_to do |format|\n if @evaluacion.update_attributes(params[:evaluacion])\n format.html { redirect_to @evaluacion, notice: 'Evaluacion was successfully updated.' }\n format.json { head :no_content }\n else\n forma...
[ "0.6807242", "0.6507722", "0.6355236", "0.63372445", "0.6139806", "0.6082772", "0.6077134", "0.6025371", "0.6008826", "0.5974862", "0.59637237", "0.5961347", "0.59553313", "0.5954125", "0.5931183", "0.5917951", "0.59129953", "0.59085566", "0.5891922", "0.5878923", "0.5829348"...
0.6813215
0
DELETE /evaluaciones/1 DELETE /evaluaciones/1.xml
def destroy @evaluacione = Evaluacione.find(params[:id]) @evaluacione.destroy respond_to do |format| format.html { redirect_to(evaluaciones_url) } format.xml { head :ok } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @evaluacion = Evaluacion.find(params[:id])\n @evaluacion.destroy\n\n respond_to do |format|\n format.html { redirect_to evaluaciones_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @estacion = Estacion.find(params[:id])\n @estacion.destroy\n\n r...
[ "0.68952584", "0.67754596", "0.66590357", "0.66368866", "0.6585356", "0.65540206", "0.6540472", "0.6540472", "0.6505618", "0.6480637", "0.6465142", "0.6417233", "0.6404615", "0.6403051", "0.6400472", "0.6393812", "0.63901806", "0.6389374", "0.637874", "0.63649964", "0.6354835...
0.733809
0
All the graph statements except hasModel and those with missing objects
def statements graph.statements.reject { |stmt| predicate_blacklist.include?(stmt.predicate) || missing_object?(stmt) } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def relation_none(model)\n validate_model(model)\n model.none\n end", "def graph?\n false\n end", "def graph?\n true\n end", "def generate_graph\n end", "def dangling_relationships\n relationships.select do |relationship|\n relationship.subject.nil? || relationship.o...
[ "0.5597195", "0.55133337", "0.5406379", "0.530991", "0.5297998", "0.5282695", "0.525528", "0.5249848", "0.5246992", "0.51800144", "0.51720977", "0.5172053", "0.5152756", "0.5147899", "0.51356155", "0.51356155", "0.51038206", "0.50939673", "0.5085285", "0.5081328", "0.5078451"...
0.5764731
0
returns the number of items on the current page. page_index is zero based. this method should return 1 for page_index values that are out of range
def page_item_count(page_index) return -1 if page_index > @collection[-1] || page_index < 0 @collection.count {|v| v == page_index} end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def page_item_count(page_index)\n return -1 if page_index < 0 || page_index >= self.page_count\n @pages[page_index].count\n end", "def page_item_count(page_index)\n if (page_index + 1 < page_count)\n page_size\n elsif page_index + 1 > page_count\n -1\n else\n item_count % page_size...
[ "0.90772384", "0.8794858", "0.86657184", "0.84735316", "0.84356713", "0.8316049", "0.82967085", "0.7996766", "0.7991153", "0.79892004", "0.78802973", "0.78521496", "0.7756084", "0.77449316", "0.77258366", "0.76960295", "0.7683067", "0.7683067", "0.7683067", "0.7683067", "0.76...
0.88058585
1
determines what page an item is on. Zero based indexes. this method should return 1 for item_index values that are out of range
def page_index(item_index) return -1 if !(item_index < item_count) || item_index < 0 @collection[item_index] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def page_index(item_index)\n return -1 if item_index < 0 || item_index >= self.item_count\n location = item_index.divmod @items_per_page\n location[0]\n end", "def page_index(item_index)\n if (item_index >= item_count || item_index < 0)\n -1\n elsif item_count == item_index - 1\n page_c...
[ "0.8317278", "0.82632387", "0.80230683", "0.8019768", "0.7967099", "0.72548354", "0.69349074", "0.6880199", "0.68635756", "0.68510646", "0.6838713", "0.67769283", "0.6733125", "0.6696102", "0.65258515", "0.6493964", "0.6490064", "0.64006805", "0.6397563", "0.6358977", "0.6250...
0.82983905
1
Implements the ids reader method, e.g. foo.item_ids for Foo.indirectly_contains :items, ...
def ids_reader predicate = reflection.options.fetch(:has_member_relation) if loaded? target.map(&:id) else owner.resource.query({ predicate: predicate }) .map { |s| ActiveFedora::Base.uri_to_id(s.object) } | target.map(&:id) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ids_getter(name, metadata)\n ids_method = \"#{name.to_s.singularize}_ids\"\n re_define_method(ids_method) do\n send(name).only(:id).map(&:id)\n end\n self\n end", "def ids\n (1..get_item_count).map do |index|\n get_item_identifier index\n end\n...
[ "0.7071506", "0.6968297", "0.6785989", "0.65630686", "0.6425952", "0.64023226", "0.6367779", "0.63203144", "0.6312439", "0.6233021", "0.6220249", "0.6191885", "0.6191885", "0.6191885", "0.6147744", "0.6124463", "0.61093843", "0.60776937", "0.60561687", "0.6050675", "0.6018001...
0.70116866
1
Conditionals Checks to see if a TLVs meta type is equivalent to the meta type passed.
def meta_type?(meta) return (self.type & meta == meta) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def has_tlv?(type)\n\t\treturn get_tlv(type) != nil\n\tend", "def has_tlv?(type)\n\t\treturn get_tlv(type) != nil\n\tend", "def term?\n type.in?(%i[tag metatag wildcard all none])\n end", "def meta?\n @meta\n end", "def type?( in_type )\n type == in_type\n end", "def is_multi?\n...
[ "0.59200716", "0.59200716", "0.55792856", "0.55123144", "0.54043", "0.53813577", "0.535251", "0.53254145", "0.53163666", "0.5311763", "0.5309913", "0.52808046", "0.5193332", "0.51906294", "0.51764625", "0.5174394", "0.51338243", "0.5090406", "0.5084725", "0.5083678", "0.50759...
0.70168734
1
Checks to see if the TLVs value is equivalent to the value passed.
def value?(value) return self.value == value end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_raw_value(value)\n check(value, {\n :type => :uint8,\n :count => (size < 1 ? 1 : size),\n :length => 1,\n :bit_length => 8,\n :sign => :unsigned,\n :default_value => 0,\n })\n end", "def valid_value?\n if ape_type == 'utf8' || ape_type == 'ext...
[ "0.6237748", "0.619103", "0.6182821", "0.61303514", "0.6072317", "0.6013846", "0.6007214", "0.5981066", "0.59719974", "0.5948616", "0.5939308", "0.59384906", "0.59384906", "0.5905601", "0.5819519", "0.5819146", "0.5808179", "0.58048415", "0.578565", "0.578565", "0.577681", ...
0.62886584
1
Serializers Converts the TLV to raw.
def to_r raw = value.to_s; if (self.type & TLV_META_TYPE_STRING == TLV_META_TYPE_STRING) raw += "\x00" elsif (self.type & TLV_META_TYPE_UINT == TLV_META_TYPE_UINT) raw = [value].pack("N") elsif (self.type & TLV_META_TYPE_BOOL == TLV_META_TYPE_BOOL) if (value == true) raw = [1].pack("c") else ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_r\n\t\traw = value.to_s;\n\n\t\tif (self.type & TLV_META_TYPE_STRING == TLV_META_TYPE_STRING)\n\t\t\traw += \"\\x00\"\n\t\telsif (self.type & TLV_META_TYPE_UINT == TLV_META_TYPE_UINT)\n\t\t\traw = [value].pack(\"N\")\n\t\telsif (self.type & TLV_META_TYPE_BOOL == TLV_META_TYPE_BOOL)\n\t\t\tif (value == true)...
[ "0.6859719", "0.63497025", "0.6252269", "0.6252269", "0.62424344", "0.6140392", "0.5937109", "0.59352195", "0.5920375", "0.58088326", "0.58088326", "0.5777562", "0.57747245", "0.57376057", "0.57376057", "0.56898165", "0.5672061", "0.55899584", "0.55899584", "0.55899584", "0.5...
0.7012267
0
Groupbased TLV accessors Enumerates TLVs of the supplied type.
def each(type = TLV_TYPE_ANY, &block) get_tlvs(type).each(&block) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def each_with_index(type = TLV_TYPE_ANY, &block)\n\t\tget_tlvs(type).each_with_index(&block)\n\tend", "def each_with_index(type = TLV_TYPE_ANY, &block)\n\t\tget_tlvs(type).each_with_index(&block)\n\tend", "def get_tlv_values(type)\n\t\tget_tlvs(type).collect { |a| a.value }\n\tend", "def get_tlv_values(type)...
[ "0.6970296", "0.6970296", "0.65281516", "0.65281516", "0.637367", "0.637367", "0.6174964", "0.6174964", "0.61379886", "0.61072034", "0.55152637", "0.54214716", "0.54214716", "0.53846", "0.52289146", "0.5179602", "0.51663953", "0.508196", "0.5049436", "0.5049436", "0.5046244",...
0.70094895
1
Enumerates TLVs of a supplied type with indexes.
def each_with_index(type = TLV_TYPE_ANY, &block) get_tlvs(type).each_with_index(&block) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def each(type = TLV_TYPE_ANY, &block)\n\t\tget_tlvs(type).each(&block)\n\tend", "def each(type = TLV_TYPE_ANY, &block)\n\t\tget_tlvs(type).each(&block)\n\tend", "def enumerate(type, opts)\n raise Error::SubclassResponsibility\n end", "def get_tlv(type, index = 0)\n\t\ttype_tlvs = get_tlvs(type)\n...
[ "0.6651781", "0.6651781", "0.6077107", "0.59453034", "0.59453034", "0.59292334", "0.59292334", "0.5442824", "0.5428451", "0.5387065", "0.53594124", "0.5347856", "0.5347715", "0.5347715", "0.5302907", "0.5184244", "0.51747185", "0.51728725", "0.5158427", "0.51135314", "0.50870...
0.7803846
1
Returns an array of TLVs for the given type.
def get_tlvs(type) if (type == TLV_TYPE_ANY) return self.tlvs else type_tlvs = [] self.tlvs.each() { |tlv| if (tlv.type?(type)) type_tlvs << tlv end } return type_tlvs end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_tlv_values(type)\n\t\tget_tlvs(type).collect { |a| a.value }\n\tend", "def get_tlv_values(type)\n\t\tget_tlvs(type).collect { |a| a.value }\n\tend", "def get_tlv(type, index = 0)\n\t\ttype_tlvs = get_tlvs(type)\n\n\t\tif (type_tlvs.length > index)\n\t\t\treturn type_tlvs[index]\n\t\tend\n\n\t\treturn n...
[ "0.74816453", "0.74816453", "0.67054456", "0.67054456", "0.6422999", "0.6422999", "0.6100501", "0.58411473", "0.5706038", "0.5645888", "0.55949676", "0.5576011", "0.55497086", "0.5510361", "0.5505722", "0.5505722", "0.54669064", "0.54653496", "0.54378575", "0.5436767", "0.535...
0.7621979
1
Gets the first TLV of a given type.
def get_tlv(type, index = 0) type_tlvs = get_tlvs(type) if (type_tlvs.length > index) return type_tlvs[index] end return nil end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_tlv_value(type, index = 0)\n\t\ttlv = get_tlv(type, index)\n\n\t\treturn (tlv != nil) ? tlv.value : nil\n\tend", "def get_tlv_value(type, index = 0)\n\t\ttlv = get_tlv(type, index)\n\n\t\treturn (tlv != nil) ? tlv.value : nil\n\tend", "def by_t(type)\n return self.find_all{|slot| slot.type == type}[...
[ "0.6748661", "0.6748661", "0.6053849", "0.5868394", "0.5867666", "0.5590036", "0.5545002", "0.5545002", "0.55343395", "0.551295", "0.551295", "0.5489713", "0.54462934", "0.5434431", "0.5429876", "0.5429876", "0.5332865", "0.5319422", "0.52711165", "0.52538824", "0.52532554", ...
0.7892362
1
Returns the value of a TLV if it exists, otherwise nil.
def get_tlv_value(type, index = 0) tlv = get_tlv(type, index) return (tlv != nil) ? tlv.value : nil end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_tlv(type, index = 0)\n\t\ttype_tlvs = get_tlvs(type)\n\n\t\tif (type_tlvs.length > index)\n\t\t\treturn type_tlvs[index]\n\t\tend\n\n\t\treturn nil\n\tend", "def get_tlv(type, index = 0)\n\t\ttype_tlvs = get_tlvs(type)\n\n\t\tif (type_tlvs.length > index)\n\t\t\treturn type_tlvs[index]\n\t\tend\n\n\t\tre...
[ "0.6762493", "0.6762493", "0.6418291", "0.5981156", "0.5981156", "0.58768827", "0.5690261", "0.55697", "0.5522212", "0.5402827", "0.5337459", "0.5290298", "0.528098", "0.5278988", "0.5274449", "0.523043", "0.52296036", "0.5215547", "0.52152973", "0.52152973", "0.51826054", ...
0.72710985
1
Checks to see if the container has a TLV of a given type.
def has_tlv?(type) return get_tlv(type) != nil end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def has_type?\n ! type.nil?\n end", "def has_type?\n ! get_internal_word(TYPE_INDEX).nil?\n end", "def type?\n @data[:type].empty? ? false : true\n end", "def has_type?(type_)\n @mutex.synchronize do\n @types.has_key?(type_)\n end\n end", "def has_encounter_type?...
[ "0.6494128", "0.6314078", "0.6088852", "0.60273576", "0.6008003", "0.5998794", "0.5949617", "0.58603334", "0.580964", "0.57994646", "0.57676595", "0.57545716", "0.5713449", "0.5710575", "0.570083", "0.570083", "0.56475633", "0.563804", "0.5596937", "0.5565976", "0.5558136", ...
0.8031238
1
Converts the TLV group container from raw to all of the individual TLVs.
def from_r(raw) offset = 8 # Reset the TLVs array self.tlvs = [] self.type = raw.unpack("NN")[1] # Enumerate all of the TLVs while (offset < raw.length-1) tlv = nil # Get the length and type length, type = raw[offset..offset+8].unpack("NN") if (type & TLV_META_TYPE_GROUP == TLV_META_TYPE_GR...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def from_r(raw)\n\t\tself.value = nil\n\n\t\tlength, self.type = raw.unpack(\"NN\");\n\n\t\t# check if the tlv value has been compressed...\n\t\tif( self.type & TLV_META_TYPE_COMPRESSED == TLV_META_TYPE_COMPRESSED )\n\t\t\t# set this TLV as using compression\n\t\t\t@compress = true\n\t\t\t# remove the TLV_META_TY...
[ "0.5510347", "0.53835297", "0.49199915", "0.47071126", "0.46451247", "0.46189794", "0.46009475", "0.45888084", "0.45409986", "0.45144984", "0.45144984", "0.44911018", "0.44801974", "0.44712278", "0.44627753", "0.44476873", "0.44408685", "0.43709478", "0.43474317", "0.43166432",...
0.670376
1
Constructor Initializes the packet to the supplied packet type and method, if any. If the packet is a request, a request identifier is created.
def initialize(type = nil, method = nil) super(type) if (method) self.method = method end self.created_at = ::Time.now # If it's a request, generate a random request identifier if ((type == PACKET_TYPE_REQUEST) || (type == PACKET_TYPE_PLAIN_REQUEST)) rid = '' 32.times { |val| rid << rand(...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initialize(type = nil, method = nil)\n\t\tsuper(type)\n\n\t\tif (method)\n\t\t\tself.method = method\n\t\tend\n\n\t\t# If it's a request, generate a random request identifier\n\t\tif ((type == PACKET_TYPE_REQUEST) ||\n\t\t (type == PACKET_TYPE_PLAINTEXT_REQUEST))\n\t\t\trid = ''\n\n\t\t\t32.times { |val| ri...
[ "0.7971575", "0.63409096", "0.63333994", "0.63333994", "0.59193516", "0.57540977", "0.55405766", "0.55356", "0.54965144", "0.5494459", "0.5494459", "0.5466833", "0.54543734", "0.5431925", "0.54091877", "0.5394551", "0.5359059", "0.5281987", "0.5274823", "0.527208", "0.5262265...
0.80640596
0
Conditionals Checks to see if the packet is a response.
def response? return ((self.type == PACKET_TYPE_RESPONSE) || (self.type == PACKET_TYPE_PLAIN_RESPONSE)) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def response?\n @type == :response\n end", "def command_response?\n type == :command_response\n end", "def response?\n !!response\n end", "def response?\n !response.nil?\n end", "def response_received?\n !! @status\n end", "def response_received?\...
[ "0.7562703", "0.71092147", "0.7090517", "0.7055952", "0.6656699", "0.6656699", "0.65791756", "0.6459464", "0.64453536", "0.64201343", "0.63938594", "0.6357915", "0.6324102", "0.63155806", "0.6286529", "0.62470406", "0.62134886", "0.6127917", "0.6115845", "0.6079836", "0.60617...
0.83357817
1
Accessors Checks to see if the packet's method is equal to the supplied method.
def method?(method) return (get_tlv_value(TLV_TYPE_METHOD) == method) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def method?(meth)\n get_method(meth)\n end", "def method?(name)\n method_name == name.to_sym\n end", "def method?\n type == TYPE_METHOD\n end", "def method?\n type == TYPE_METHOD\n end", "def method_missing(method, *args)\n method = method.to_s\n ...
[ "0.69155854", "0.64431316", "0.641461", "0.641461", "0.6277275", "0.62540424", "0.62319046", "0.62319046", "0.62219185", "0.6196342", "0.6066746", "0.59882295", "0.59676826", "0.5954562", "0.5952327", "0.59304565", "0.59228283", "0.58531755", "0.583721", "0.5803583", "0.58011...
0.7064831
1
Sets the packet's method TLV to the method supplied.
def method=(method) add_tlv(TLV_TYPE_METHOD, method, true) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def method=(value)\n @method = value\n end", "def method=(method)\n if !method.nil? && method.to_s.length > 50\n fail ArgumentError, 'invalid value for \"method\", the character length must be smaller than or equal to 50.'\n end\n\n if !method.nil? && method.to_s.l...
[ "0.67816097", "0.65247405", "0.63467485", "0.63467485", "0.6029751", "0.5918826", "0.59114987", "0.59114987", "0.57330585", "0.5731458", "0.56493545", "0.56493545", "0.5646641", "0.5646641", "0.56248724", "0.56207037", "0.5620436", "0.55733067", "0.5537182", "0.55149496", "0....
0.7885921
1
Returns the value of the packet's method TLV.
def method return get_tlv_value(TLV_TYPE_METHOD) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def method\n @attributes[:method]\n end", "def method\n @method ||= XmlRpc::API::Message.parse_value(@document.root.elements[\"methodName\"])\n end", "def method=(method)\n\t\tadd_tlv(TLV_TYPE_METHOD, method, true)\n\tend", "def method=(method)\n\t\tadd_tlv(TLV_TYPE_METHOD, method, true)\...
[ "0.66449827", "0.6427894", "0.62348956", "0.62348956", "0.61928266", "0.6185657", "0.61612", "0.6147445", "0.60788554", "0.60273", "0.60273", "0.59890664", "0.59378624", "0.590511", "0.590511", "0.58919007", "0.5833403", "0.5778146", "0.573545", "0.5673272", "0.56294584", "...
0.85062265
1
Checks to see if the packet's result value is equal to the supplied result.
def result?(result) return (get_tlv_value(TLV_TYPE_RESULT) == result) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def validate_answer(answer)\n answer == @result\n end", "def expected_result\n if @assert['result'] == '&result'\n @result\n elsif @assert['result'] != 'void'\n to_hex(@assert['result']['$hex'])\n end\n end", "def result(answer)\n @answer == answer...
[ "0.6461885", "0.62522304", "0.6238519", "0.6054772", "0.6046574", "0.60230297", "0.6018356", "0.60050684", "0.5895863", "0.5877504", "0.58765954", "0.58644533", "0.58367515", "0.57947993", "0.5793753", "0.57920253", "0.57537067", "0.574996", "0.5731237", "0.5721371", "0.57113...
0.7156735
1
Sets the packet's result TLV.
def result=(result) add_tlv(TLV_TYPE_RESULT, result, true) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def result\n\t\treturn get_tlv_value(TLV_TYPE_RESULT)\n\tend", "def result\n\t\treturn get_tlv_value(TLV_TYPE_RESULT)\n\tend", "def result=(r)\n\n fields['__result__'] = r\n end", "def set_result\n raw.data.status_code = raw.statusCode\n raw.data.status_text = raw.statusText\n @result ...
[ "0.6488828", "0.6488828", "0.63450575", "0.6304807", "0.59019977", "0.58609015", "0.5736919", "0.55704635", "0.55072874", "0.5491611", "0.5491611", "0.5338689", "0.52981764", "0.52925867", "0.5281694", "0.52587295", "0.52587295", "0.5245461", "0.5219698", "0.5218221", "0.5218...
0.80659664
1
Gets the value of the packet's result TLV.
def result return get_tlv_value(TLV_TYPE_RESULT) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def result\n if not elements[\"result\"].nil?\n r = elements[\"result\"].elements[1]\n if r.nil?\n elements[\"result\"].text\n else\n r\n end\n else\n nil\n end\n end", "def value(result)\n r...
[ "0.6561463", "0.6532747", "0.6441651", "0.6441651", "0.63099337", "0.6220412", "0.6183481", "0.61491686", "0.61491686", "0.6082777", "0.6055409", "0.6023753", "0.5932441", "0.5932441", "0.5871171", "0.5732631", "0.5697697", "0.5693756", "0.56585586", "0.56520253", "0.56520253...
0.8387234
1
Gets the value of the packet's request identifier TLV.
def rid return get_tlv_value(TLV_TYPE_REQUEST_ID) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def request_id\n @error['request_id']\n end", "def get_request_id\n request_id = ''\n @id_lock.synchronize do\n request_id = @@current_request_id += 1\n end\n request_id\n end", "def get_request_id\n request_id = ''\n @id_lock.synchronize do\n request_id =...
[ "0.6200948", "0.61256003", "0.61256003", "0.6103415", "0.5917814", "0.5907701", "0.5843926", "0.57700074", "0.57154477", "0.5599692", "0.5570395", "0.55416703", "0.55416703", "0.5513826", "0.5486862", "0.5425236", "0.5393464", "0.5386217", "0.5377741", "0.53320426", "0.525821...
0.73957974
1
Predicate for the disable_rake_compiler attribute.
def disable_rake_compiler? return self.disable_rake_compiler ? true :false end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def has_rakecompiler_dependency?\n\t\treturn self.dependencies.any? do |dep|\n\t\t\tdep.name == 'rake-compiler'\n\t\tend\n\tend", "def agent_should_start?\n !blacklisted_constants? &&\n !blacklisted_executables? &&\n !in_blacklisted_rake_task?\n end", "def auto_exclude?\n ...
[ "0.6383474", "0.55502146", "0.54244685", "0.5416403", "0.5401313", "0.5360261", "0.5332903", "0.53170156", "0.53077435", "0.522613", "0.5174628", "0.51405907", "0.51320493", "0.5130798", "0.5088376", "0.5084573", "0.5083059", "0.50676864", "0.5049461", "0.50479543", "0.504359...
0.8187891
0
Returns +true+ if there appear to be extensions as part of the current project.
def extensions_present? return !self.extensions.empty? end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def appearable_extensions?\n exs = @extensions.keys - APPEARABLE_CH_EXTENSIONS\n return true if exs.empty?\n\n !(exs - DEFINED_EXTENSIONS).empty?\n end", "def missing_extensions?\n return false if extensions.empty?\n return false if default_gem?\n return false if File.exist? ge...
[ "0.7635198", "0.75941896", "0.74812496", "0.73279864", "0.73279864", "0.7179598", "0.70683795", "0.70683795", "0.7045263", "0.70179784", "0.6989766", "0.6984739", "0.6984739", "0.6905511", "0.67384905", "0.6601999", "0.6594085", "0.6456295", "0.6452495", "0.6432571", "0.64325...
0.77635753
0
Set up the tasks to build extensions.
def define_extension_tasks ENV['RUBY_CC_VERSION'] ||= RUBY_VERSION[ /(\d+\.\d+)/ ] require 'rake/extensiontask' self.extensions.each do |extconf| Rake::ExtensionTask.new( extconf.pathmap('%{ext/,}d') ) end task :spec => :compile task :maint do ENV['V'] = '1' ENV['MAINTAINER_MODE'] = 'yes' end ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def define_tasks\r\n define_clobber_task\r\n define_build_task\r\n end", "def define_compiler_tasks\n require \"rake/extensiontask\"\n\n @extensions.each do |name|\n clean_globs << \"lib/#{name}/*.{so,bundle,dll}\"\n\n Rake::ExtensionTask.new name, spec do |ext|\n ext.lib_dir ...
[ "0.71884984", "0.7062708", "0.70167685", "0.6988959", "0.6921596", "0.6753971", "0.6698098", "0.66938114", "0.6672065", "0.6625058", "0.66134447", "0.65917397", "0.6524384", "0.64845943", "0.6466148", "0.6444607", "0.63418984", "0.63400584", "0.62423944", "0.6240044", "0.6226...
0.78485155
0
Returns +true+ if the projects dependencies include `rakecompiler`.
def has_rakecompiler_dependency? return self.dependencies.any? do |dep| dep.name == 'rake-compiler' end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def disable_rake_compiler?\n\t\treturn self.disable_rake_compiler ? true :false\n\tend", "def has_dependencies?\n update_for.length > 0 or requires.length > 0\n end", "def is_rake\n\tFile.basename($0) == 'rake'\nend", "def activate_compiler_deps\n dependency \"rake-compiler\", \"~> 1.0\", :development...
[ "0.7176959", "0.6499878", "0.6452307", "0.6440881", "0.6309507", "0.62916625", "0.62530977", "0.61711013", "0.6141234", "0.6139968", "0.6090912", "0.6054291", "0.60233134", "0.5975129", "0.5960222", "0.59555286", "0.595487", "0.59412783", "0.59394854", "0.5927395", "0.592355"...
0.8673069
0
Task function output debugging for extension tasks.
def do_extensions_debug( task, args ) self.prompt.say( "Extension config scripts:", color: :bright_green ) if self.extensions.empty? self.prompt.say "None." else self.extensions.uniq.each do |path| self.prompt.say "- %s" % [ path ] end end if self.has_rakecompiler_dependency? self.prompt.say...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def print_task(task)\n print \"==> \".info, task.bold, \"\\n\"\nend", "def print_task_info(task:)\n path = task.files.first['path'].chomp(\"/tasks/#{task.files.first['name']}\")\n module_dir = if path.start_with?(Bolt::Config::Modulepath::MODULES_PATH)\n \"built-in module\"\n...
[ "0.6818291", "0.67156774", "0.66474164", "0.6489559", "0.6489559", "0.6489559", "0.6489559", "0.6459194", "0.6370725", "0.6303394", "0.6285485", "0.6280167", "0.61767304", "0.61711234", "0.613699", "0.60860735", "0.6062757", "0.6056759", "0.60391605", "0.6021989", "0.6021989"...
0.7081757
0
Receives a view and update it accordingly with the given object id and the association cardinality.
def update(view, object) raise NotImplementedError end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def UpdateView params = {}\n \n APICall(path: 'views.json',method: 'PUT',payload: params.to_json)\n \n end", "def record_view\n self.views += 1\n save\n end", "def hit!\n raise ActiveRecord::MissingAttributeError, \"can't hit! #{ self.short_inspect }, missing attribute: vi...
[ "0.5944343", "0.58926123", "0.58195937", "0.57695425", "0.5719503", "0.5638591", "0.5634786", "0.5610564", "0.55988353", "0.5581667", "0.5581667", "0.5581667", "0.55463135", "0.5542066", "0.55208164", "0.55062175", "0.54996866", "0.54605067", "0.54462576", "0.54462576", "0.53...
0.6959323
0
Includes this module into a Class, and changes all public methods to protected. Examples: module MyCoolUtils def some_meth "hi" end self.include_safely_into(FooController) end or: MyCoolUtils.include_safely_into(FooController, SomeOtherClass)
def include_safely_into(*args) [args].flatten.each do |a| if a.is_a?(String) || a.is_a?(Symbol) a = a.to_s.constantize end a.send(:include, self.convert_security_of_methods) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def inherited(klass)\n super\n klass.send :include, ::Henshin::Safety\n klass.instance_variable_set(:@unsafe_methods, @unsafe_methods)\n end", "def included(other)\n class <<other\n include ClassMethods\n end\nend", "def extend_class(class_, module_)\n class_.class_eval do\n...
[ "0.5964037", "0.5789869", "0.5714196", "0.55760556", "0.54506856", "0.5437987", "0.5415791", "0.5403711", "0.53042275", "0.5301927", "0.5301927", "0.5301927", "0.5301927", "0.5301461", "0.5268169", "0.5256856", "0.5197367", "0.51913303", "0.5171968", "0.5105985", "0.5105985",...
0.5939363
1
... and delegate "everything else" via method_missing, taking care that a nil card template isn't a problem
def method_missing(name, *args, &block) respond_to_missing?(name) ? card_template.andand.send(name, *args, &block) : super end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def method_missing(method, *args, &block)\n if @card.respond_to?(method)\n @card.send(method, *args, &block)\n else\n super\n end\n end", "def default_card\n # noop\n end", "def get_card\n end", "def get_card_data method\n get_card.send(method) ...
[ "0.7059851", "0.65993464", "0.6114283", "0.59664536", "0.5779522", "0.5779522", "0.5755772", "0.57497287", "0.5702806", "0.5657755", "0.56481373", "0.5642659", "0.56303084", "0.56303084", "0.56303084", "0.56303084", "0.5611988", "0.5561731", "0.5558175", "0.5558175", "0.55070...
0.78657037
0
By this point, we assume ScheduleMergeRequestDiffMigrations the first version of this has already run. On GitLab.com, we have ~220k unmigrated rows, but these rows will, in general, take a long time. With a gap of 10 minutes per batch, and 500 rows per batch, these migrations are scheduled over 220_000 / 500 / 6 ~= 74 ...
def up queue_background_migration_jobs_by_range_at_intervals(MergeRequestDiff, MIGRATION, DELAY_INTERVAL, batch_size: BATCH_SIZE) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def up\n Build.where(stage_id: nil).each_batch(of: BATCH_SIZE) do |relation, index|\n relation.each_batch(of: RANGE_SIZE) do |relation|\n range = relation.pluck('MIN(id)', 'MAX(id)').first\n\n BackgroundMigrationWorker\n .perform_in(index * 2.minutes, MIGRATION, range)\n end\n ...
[ "0.6388077", "0.5842477", "0.5773407", "0.56487805", "0.54802555", "0.547335", "0.54634887", "0.53449374", "0.5319112", "0.52696264", "0.5211735", "0.515682", "0.5112737", "0.5086521", "0.50740397", "0.5068204", "0.50645584", "0.5062173", "0.5035551", "0.5032376", "0.503051",...
0.6655419
0
Adds a block to the BlockArgs object
def add(&block) @block_args << block end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_block block\n block.at self.length\n @blocks << block\n end", "def add_block(article_block)\n self.blocks << article_block\n end", "def add(name, &block)\n blocks[name.to_sym] = block\n end", "def add(*args, &block)\n end", "def add_block(block)\n return if il...
[ "0.7374964", "0.68489355", "0.66917056", "0.65283126", "0.65031314", "0.6482519", "0.64730287", "0.64226466", "0.63106906", "0.6299988", "0.6241403", "0.6238178", "0.6185426", "0.6149992", "0.614374", "0.60489124", "0.60339093", "0.6033659", "0.60122275", "0.599923", "0.59992...
0.8359032
0
Deletes a block to the BlockArgs object
def delete(&block) @block_args.delete(block) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy_block(user)\n delete \"blocks/destroy/#{user}\"\n end", "def delete_block\n Block.destroy(params[:id])\n render :text => \"Block with ID #{params[:id]} was successfully destroyed.\"\n end", "def destroy\n @block.destroy\n\n head :no_content\n end", "def destroy\n @block = Blo...
[ "0.71437997", "0.697673", "0.6745141", "0.6623005", "0.6562336", "0.6495251", "0.64677906", "0.6440162", "0.6423591", "0.6410092", "0.6407131", "0.6356241", "0.6337435", "0.631876", "0.631876", "0.6305668", "0.6300602", "0.62919676", "0.6269776", "0.62613267", "0.622092", "...
0.8450111
0
GET /cpanel/tags GET /cpanel/tags.json
def index @cpanel_tags = Cpanel::Tag.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def tags\n get('tags')\n end", "def get_tags_by_url\n url = Url.find_by(id: params[:id])\n tags = url.tags\n render json: {code: 200, tags: tags}\n end", "def tags\n @tags_with_count = Asset.tag_counts_on(:tags)\n \n @tags = @tags_with_count.map{|tag_hash| tag_hash = tag_ha...
[ "0.8089872", "0.751737", "0.74441135", "0.74037737", "0.73850274", "0.7211302", "0.7208338", "0.7162299", "0.71619993", "0.71595573", "0.71595573", "0.71595573", "0.71595573", "0.71595573", "0.7140949", "0.713974", "0.7107557", "0.70756036", "0.70202917", "0.7018946", "0.7017...
0.7524852
1
DELETE /cpanel/tags/1 DELETE /cpanel/tags/1.json
def destroy @cpanel_tag.destroy respond_to do |format| format.html { redirect_to cpanel_tags_url } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete_tag tag\n delete \"tag/#{tag}\"\n end", "def destroy\n @tags_of_novel = TagsOfNovel.find(params[:id])\n @tags_of_novel.destroy\n\n respond_to do |format|\n format.html { redirect_to tags_of_novels_url }\n format.json { head :no_content }\n end\n end", "def delete(tag)\n ...
[ "0.7276123", "0.7219809", "0.71863914", "0.7176537", "0.7154785", "0.71402436", "0.71328014", "0.71023256", "0.7083655", "0.70803547", "0.7077671", "0.70524395", "0.70261616", "0.70261616", "0.70261616", "0.70125365", "0.7012272", "0.70014805", "0.7000115", "0.6989769", "0.69...
0.7599052
0
GET /enrolls GET /enrolls.json
def index @enrolls = Enroll.all respond_to do |format| format.html # index.html.erb format.json { render json: @enrolls } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @enrolls = Enroll.all\n end", "def show\n @enroll = Enroll.find(params[:id])\n render json: JSON.parse(@enroll.to_json)\n end", "def show\n @enroll = Enroll.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @enroll }\n...
[ "0.75139695", "0.7464566", "0.7215442", "0.7062653", "0.7062653", "0.7062653", "0.7062653", "0.70049214", "0.68922675", "0.6869819", "0.6869684", "0.6869684", "0.6835898", "0.67717296", "0.67250055", "0.66916007", "0.66702443", "0.6646835", "0.66368353", "0.6564454", "0.65290...
0.77163905
0
GET /enrolls/1 GET /enrolls/1.json
def show @enroll = Enroll.find(params[:id]) respond_to do |format| format.html # show.html.erb format.json { render json: @enroll } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n @enroll = Enroll.find(params[:id])\n render json: JSON.parse(@enroll.to_json)\n end", "def index\n @enrolls = Enroll.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @enrolls }\n end\n end", "def index\n @enrolls = Enroll.all\n ...
[ "0.7857512", "0.75780815", "0.7383003", "0.73398715", "0.7039861", "0.69629484", "0.69629484", "0.69629484", "0.69629484", "0.69476426", "0.68799406", "0.68404394", "0.68404394", "0.68404394", "0.68404394", "0.6828348", "0.6741487", "0.6740403", "0.665598", "0.66470414", "0.6...
0.7685274
1
DELETE /enrolls/1 DELETE /enrolls/1.json
def destroy @enroll = Enroll.find(params[:id]) @enroll.destroy respond_to do |format| format.html { redirect_to enrolls_url } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @enroll = Enroll.find(params[:id])\n @enroll.destroy\n render json: JSON.parse({msg:\"success\"}.to_json)\n end", "def destroy\n @enroll.destroy\n respond_to do |format|\n format.html { redirect_to enrolls_path, notice: 'Test was successfully destroyed.' }\n format.json { ...
[ "0.78918463", "0.769313", "0.7638765", "0.76297796", "0.7512439", "0.73133063", "0.73133063", "0.73133063", "0.73133063", "0.73133063", "0.72751975", "0.72677577", "0.7267682", "0.7247389", "0.7242299", "0.7142559", "0.7133361", "0.7058846", "0.70414436", "0.6952568", "0.6947...
0.7937095
0
Sets the current fallbacks implementation. Use this to set a different fallbacks implementation. source://i18n//lib/i18n/backend/fallbacks.rb23
def fallbacks=(fallbacks); end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fallbacks\n @fallbacks ||= {}\n end", "def fallback\n @@fallback\n end", "def languagefallback()\n merge(languagefallback: 'true')\n end", "def fallback_locales=(value)\n @fallback_locales = Array(value).map { |l| Nii::Locale.parse(l) }\n @fallback_context = ...
[ "0.6867249", "0.6768516", "0.66921115", "0.6677767", "0.66431564", "0.645006", "0.63633806", "0.63633806", "0.63354605", "0.59322584", "0.5886629", "0.5800504", "0.5763564", "0.56800824", "0.5643504", "0.5621275", "0.5584741", "0.5487874", "0.5421522", "0.5385849", "0.5385849...
0.7369854
0
Marks a key as reserved. Reserved keys are used internally, and can't also be used for interpolation. If you are using any extra keys as I18n options, you should call I18n.reserve_key before any I18n.translate (etc) calls are made. source://i18n//lib/i18n.rb45
def reserve_key(key); end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def deprecated_key=(_arg0); end", "def reserve_for(key)\n reserves.fetch(key)\n end", "def fill_key_name\n self.key_name = key_name&.parameterize(separator: '_')\n end", "def ensure_valid_key( key )\n key.to_s.index( /\\./ ) ? key.to_s.gsub( /\\./, '_' ) : key\n end", ...
[ "0.57092774", "0.5637886", "0.5629352", "0.55948514", "0.5532422", "0.5491892", "0.54411393", "0.54411393", "0.54227424", "0.5416488", "0.5406671", "0.5398595", "0.5373242", "0.53245187", "0.5323265", "0.53149354", "0.5314035", "0.5307312", "0.52914375", "0.52865493", "0.5264...
0.68313456
0
Accepts a list of paths to translation files. Loads translations from plain Ruby (.rb), YAML files (.yml), or JSON files (.json). See load_rb, load_yml, and load_json for details. source://i18n//lib/i18n/backend/base.rb14
def load_translations(*filenames); end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_translations\n files = if File.directory?(@path)\n Dir[@path + '/**/*.yml']\n elsif File.file?(@path)\n detect_list_or_file @path\n else\n $stderr.puts 'No valid translation file given'\n []\n end\n ...
[ "0.8155875", "0.8110001", "0.7122936", "0.70008355", "0.69906133", "0.6961666", "0.6930811", "0.6836793", "0.6796501", "0.6796501", "0.6506182", "0.6363883", "0.632046", "0.6258818", "0.6198518", "0.61548525", "0.6090957", "0.60649735", "0.60345614", "0.5994245", "0.59636754"...
0.8322083
1
Loads a YAML translations file. The data must have locales as toplevel keys. source://i18n//lib/i18n/backend/base.rb251
def load_yml(filename); end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_i18n\n res = YAML.load_file(File.join(File.dirname(__FILE__), 'ie6nomore.i18n.yml'))\n end", "def load_yml(filename)\n require 'yaml' unless defined? YAML\n data = YAML::load(IO.read(filename))\n data.each {|locale, d| merge_names(locale, d)}\n end", "def load_yaml(fi...
[ "0.6988969", "0.6950346", "0.69206053", "0.68981314", "0.6668233", "0.6665346", "0.65910846", "0.6585902", "0.657155", "0.65576965", "0.6534299", "0.6505571", "0.64643013", "0.6430723", "0.6410576", "0.63957375", "0.63915175", "0.63816226", "0.63686204", "0.63591725", "0.6359...
0.7240902
0
Resolves a translation. If the given subject is a Symbol, it will be translated with the given options. If it is a Proc then it will be evaluated. All other subjects will be returned directly. source://i18n//lib/i18n/backend/base.rb147
def resolve(locale, object, subject, options = T.unsafe(nil)); end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def resolve_entry(locale, object, subject, options = T.unsafe(nil)); end", "def translate(key, **options); end", "def translate(key, **options); end", "def translate!(key, **options); end", "def translate!(key, options = {}, &block)\n I18n.translate!(*object_scoped_i18n_options(key, options.dup), &block...
[ "0.6081512", "0.57755125", "0.57755125", "0.5770379", "0.57339454", "0.55334115", "0.55221367", "0.5483578", "0.5434893", "0.54323936", "0.5372875", "0.5344528", "0.533782", "0.52454305", "0.5224909", "0.5148097", "0.5084306", "0.50790006", "0.5060139", "0.5059775", "0.505744...
0.7048989
0
Resolves a translation. If the given subject is a Symbol, it will be translated with the given options. If it is a Proc then it will be evaluated. All other subjects will be returned directly. source://i18n//lib/i18n/backend/base.rb147
def resolve_entry(locale, object, subject, options = T.unsafe(nil)); end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def resolve(locale, object, subject, options = T.unsafe(nil)); end", "def translate(key, **options); end", "def translate(key, **options); end", "def translate!(key, **options); end", "def translate!(key, options = {}, &block)\n I18n.translate!(*object_scoped_i18n_options(key, options.dup), &block)\n e...
[ "0.7048549", "0.57764614", "0.57764614", "0.5771221", "0.57347834", "0.5534656", "0.5524339", "0.54842705", "0.54361075", "0.5432805", "0.5373786", "0.534529", "0.5338804", "0.5246283", "0.5225907", "0.5148661", "0.50838643", "0.5080042", "0.5062191", "0.5061418", "0.50565755...
0.6081169
1
Optionally provide path_roots array to normalize filename paths, to make the cached i18n data portable across environments. source://i18n//lib/i18n/backend/cache_file.rb11
def path_roots=(_arg0); end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def in_cache_dir(*paths)\n paths.reduce(cache_dir) do |base, path|\n Jekyll.sanitized_path(base, path)\n end\n end", "def in_cache_dir(*paths); end", "def load_translations_and_collect_file_errors(files); end", "def ui_localization_files\n loc_files = Dir[File.join(RAILS_ROOT, 'lang/...
[ "0.6122637", "0.5991171", "0.58114535", "0.5808625", "0.5790239", "0.5790239", "0.57875615", "0.5785835", "0.5767829", "0.57562494", "0.5744699", "0.57141316", "0.56974804", "0.5668343", "0.56582797", "0.5622436", "0.5606561", "0.55918765", "0.558392", "0.5562617", "0.5562617...
0.6008322
1
Returns the value of attribute backends. source://i18n//lib/i18n/backend/chain.rb25
def backends; end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def backends\n # Lets cache the values and return the cache\n if @backends.nil?\n @backends = {}\n backend_instances.each do | name, backend|\n @backends[name] = backend.servers\n end\n end\n @backends\n end", "def backends=(_arg0); end", "def backends(servi...
[ "0.6028862", "0.5753905", "0.55582607", "0.5541924", "0.5420075", "0.5180032", "0.5069253", "0.5029616", "0.49384916", "0.4811482", "0.47198647", "0.47198647", "0.47013897", "0.46853134", "0.46760073", "0.4660199", "0.46557003", "0.46506983", "0.46330804", "0.46274912", "0.46...
0.5782034
1
Sets the attribute backends
def backends=(_arg0); end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def backend=(backend); end", "def set_backend(val)\n end", "def backend=(backend)\n @backend = backend&.to_sym\n set_encoder\n end", "def backends; end", "def add_backend_attributes(backend_attributes)\n @converter_options[:attributes].merge!(backend_attributes)\n end", "def default...
[ "0.65605336", "0.6500653", "0.6433733", "0.6365601", "0.6104919", "0.5916037", "0.5811745", "0.57213545", "0.5719456", "0.5555846", "0.54233223", "0.5414856", "0.53305554", "0.52814925", "0.50719905", "0.50671947", "0.5053091", "0.50285685", "0.5026914", "0.50216365", "0.5016...
0.66283345
0
Overwrite on_fallback to add specified logic when the fallback succeeds. source://i18n//lib/i18n/backend/fallbacks.rb110
def on_fallback(_original_locale, _fallback_locale, _key, _options); end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fallbacks=(fallbacks); end", "def languagefallback()\n merge(languagefallback: 'true')\n end", "def do_fallback action\n do_redirect fallback_path\n end", "def fallbacks; end", "def fallbacks; end", "def handle_fallback(*args)\n case @fallback_policy\n when :abort\n ...
[ "0.6950204", "0.6739096", "0.65947044", "0.65587056", "0.65587056", "0.64567757", "0.64348406", "0.64153975", "0.6396886", "0.63627595", "0.63547003", "0.63185555", "0.61661243", "0.6044893", "0.6013029", "0.6000662", "0.59310025", "0.5894697", "0.5885549", "0.5807471", "0.58...
0.8132445
0
Receives a hash of translations (where the key is a locale and the value is another hash) and return a hash with all translations flattened. Nested hashes are included in the flattened hash just if subtree is true and Symbols are automatically stored as links. source://i18n//lib/i18n/backend/flatten.rb74
def flatten_translations(locale, data, escape, subtree); end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dn_flatten hash, ancestor=[ ]\n result = { }\n for key,value in hash\n present = ancestor + [key]\n if value.is_a? Hash and !value.empty?\n result.merge! dn_flatten value, present\n else\n result.merge! present.join('.') => value\n end\n end\n result\n end", "de...
[ "0.6057858", "0.6009155", "0.57518613", "0.55665195", "0.5540064", "0.5529943", "0.54662913", "0.546608", "0.546608", "0.54058444", "0.5393934", "0.5354033", "0.53431004", "0.5340005", "0.53286284", "0.5294363", "0.52942866", "0.526291", "0.5248819", "0.52178377", "0.5207493"...
0.768723
0
Shortcut to I18n::Backend::Flatten.normalize_flat_keys and then resolve_links. source://i18n//lib/i18n/backend/flatten.rb44
def normalize_flat_keys(locale, key, scope, separator); end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def deep_transform_keys(&block); end", "def deep_transform_keys!(&block); end", "def normalize_links!\n # TODO: normalize Array of Symbol, String, DM::Property 1-jump-away or DM::Query::Path\n end", "def flatten_translations(locale, data, escape, subtree); end", "def normalize_links\n @links.m...
[ "0.6134193", "0.60334873", "0.598983", "0.59615266", "0.56846285", "0.5613128", "0.5611419", "0.5534217", "0.55025566", "0.54849684", "0.5479207", "0.5479207", "0.5437252", "0.54320985", "0.53847706", "0.5365686", "0.53631747", "0.53597885", "0.5337433", "0.53102684", "0.5300...
0.685187
1
normalize_keys the flatten way. This method is significantly faster and creates way less objects than the one at I18n.normalize_keys. It also handles escaping the translation keys. source://i18n//lib/i18n/backend/flatten.rb20
def normalize_flat_keys(locale, key, scope, separator); end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def recursively_normalize_keys\n recursively_transform_keys { |key| key.downcase.to_sym rescue key }\n end", "def normalize_keys(locale, key, scope, separator = T.unsafe(nil)); end", "def normalize_keys(locale, key, scope, separator = nil)\n keys = [locale] + Array(scope) + Array(key)\n keys = ke...
[ "0.7088645", "0.69359946", "0.6900623", "0.687252", "0.66158926", "0.6584695", "0.64313006", "0.64258945", "0.6407195", "0.63808405", "0.6367964", "0.6353864", "0.6283611", "0.6254634", "0.62532336", "0.62529534", "0.6252492", "0.6250688", "0.6248819", "0.6235353", "0.6200009...
0.7964173
0
Checks if a filename is named in correspondence to the translations it loaded. The locale extracted from the path must be the single locale loaded in the translations.
def assert_file_named_correctly!(file, translations); end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def valid_translation? translation_file\n raise TranslationFileNotFound, \"Translation file is required\" unless translation_file\n raise TranslationFileNotFound, \"Unable to find Translation File #{translation_file}\" unless File.exists?(translation_file)\n end", "def has_file? na...
[ "0.6395695", "0.6377267", "0.61988324", "0.6192202", "0.6184694", "0.6061273", "0.6058161", "0.59734136", "0.596862", "0.5955389", "0.5942154", "0.5930342", "0.5911605", "0.59033096", "0.58174664", "0.5810139", "0.5810139", "0.5794215", "0.577166", "0.5768979", "0.57588035", ...
0.7073991
0
Loads each file supplied and asserts that the file only loads translations as expected by the name. The method returns a list of errors corresponding to offending files. source://i18n//lib/i18n/backend/lazy_loadable.rb152
def load_translations_and_collect_file_errors(files); end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_translations(*filenames); end", "def load_translations(*filenames); end", "def load_translations\n files = if File.directory?(@path)\n Dir[@path + '/**/*.yml']\n elsif File.file?(@path)\n detect_list_or_file @path\n else\n $st...
[ "0.662972", "0.662972", "0.6486297", "0.6274989", "0.6266235", "0.6032316", "0.59935445", "0.5818389", "0.58173627", "0.58173627", "0.5807299", "0.5755714", "0.57399386", "0.56895924", "0.56047267", "0.5601714", "0.55890983", "0.5559645", "0.5510317", "0.5499207", "0.5475547"...
0.8011651
0
Raises an InvalidLocale exception when the passed locale is not available. source://i18n//lib/i18n.rb349
def enforce_available_locales!(locale); end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initialize(locale)\n LOCALES.include?(locale) or raise BadLocale\n @locale = locale\n end", "def valid_locale?(locale)\n FastGettext.available_locales.include?(locale)\n end", "def locale_in_context(locale)\n return @locale if @locale && @locale.code == locale.to_s\n #Loc...
[ "0.68707335", "0.63898605", "0.6340171", "0.6323789", "0.629247", "0.60979164", "0.60438544", "0.60401165", "0.6038137", "0.6037172", "0.59767675", "0.5975047", "0.59715027", "0.58499944", "0.58274907", "0.5803372", "0.57953465", "0.57890517", "0.5786042", "0.57789034", "0.57...
0.720186
0
Sets the available locales. source://i18n//lib/i18n/config.rb57
def available_locales=(locales); end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def translated_in=(locales)\n self._locales = locales.map(&:to_sym)\n end", "def set_i18n\n if params[:locale]\n if I18n.available_locales.include?(params[:locale].to_sym)\n I18n.locale = params[:locale]\n else\n flash.now[:notice] = \"#{params[:locale]} not a...
[ "0.68784225", "0.68308413", "0.6816556", "0.6816556", "0.67949677", "0.67649126", "0.67481863", "0.6700948", "0.66904336", "0.66848886", "0.66686445", "0.6661873", "0.6633606", "0.6608253", "0.6598595", "0.65736765", "0.65610206", "0.65610206", "0.65610206", "0.65610206", "0....
0.75680006
0
Returns true if the available_locales have been initialized
def available_locales_initialized?; end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def available_locales\n evaluate_localization_option!(:available_locales)\n end", "def available_locales\n @available_locales ||= self.languages.published\n end", "def localized?\n self.locales.size > 1\n end", "def locale_available?(locale); end", "def available_locales_set; en...
[ "0.73823977", "0.7142856", "0.7131945", "0.71311575", "0.68821996", "0.6841551", "0.6841551", "0.68159914", "0.67886496", "0.6757621", "0.6686077", "0.6673215", "0.66670877", "0.66355133", "0.662808", "0.662808", "0.6620581", "0.6618938", "0.6594498", "0.6477159", "0.6403219"...
0.8490245
0
Caches the available locales list as both strings and symbols in a Set, so that we can have faster lookups to do the available locales enforce check. source://i18n//lib/i18n/config.rb50
def available_locales_set; end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def used_locales\r\n locales = globalize.stash.keys.concat(globalize.stash.keys).concat(translations.translated_locales)\r\n locales.uniq!\r\n locales\r\n end", "def available_locales\n locales = self.keys.map { |k| k =~ /\\./; $` }\n locales.uniq!\n locales.compact!\n local...
[ "0.7525165", "0.72818416", "0.72818416", "0.72321254", "0.72142446", "0.71887887", "0.71097803", "0.71097803", "0.7088116", "0.70164996", "0.6978896", "0.69147426", "0.6868781", "0.68599707", "0.6820874", "0.6819864", "0.67624193", "0.6753491", "0.6753491", "0.67385703", "0.6...
0.7505384
1
Clears the available locales set so it can be recomputed again after I18n gets reloaded. source://i18n//lib/i18n/config.rb70
def clear_available_locales_set; end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reset_stats!\r\n @@available_locales = nil\r\n @@enabled_locales = nil\r\n @@language_completion = nil\r\n @@all_translation_info = nil\r\n @@datetime_vars = nil\r\n end", "def used_locales\r\n locales = globalize.stash.keys.concat(globalize.stash.keys).concat(tra...
[ "0.6305831", "0.63036907", "0.621971", "0.61627036", "0.5980066", "0.5942033", "0.5900893", "0.5896212", "0.58955187", "0.5887825", "0.5867933", "0.5847686", "0.5841113", "0.5746414", "0.5731636", "0.5727976", "0.5725601", "0.5716796", "0.5686499", "0.56807715", "0.5673065", ...
0.8240911
0
Returns the current default scope separator. Defaults to '.' source://i18n//lib/i18n/config.rb75
def default_separator; end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def period_separator\n '.'\n end", "def default_line_separator\n @def_line_sep ||= infer_line_separator\n end", "def default_separator=(separator); end", "def default_separator(value = T.unsafe(nil)); end", "def trailing_dots_to_scope_name!\n @hsh = self.class.tdtsn @hsh, scope_name\n end",...
[ "0.6190831", "0.61389744", "0.606381", "0.58894265", "0.5763356", "0.567675", "0.55871004", "0.55486345", "0.55370724", "0.5493453", "0.5467525", "0.5446332", "0.5423758", "0.53667825", "0.53614277", "0.5360762", "0.5360762", "0.53599805", "0.5357077", "0.53401446", "0.531959...
0.63961184
0
Sets the current default scope separator. source://i18n//lib/i18n/config.rb80
def default_separator=(separator); end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def default_line_separator\n @def_line_sep ||= infer_line_separator\n end", "def default_separator; end", "def default_separator(value = T.unsafe(nil)); end", "def separator=(value)\n @separator = value\n end", "def path_sep=(val)\n Vitals::Utils.path_sep = val\n end",...
[ "0.6848044", "0.67540807", "0.62274724", "0.609345", "0.5825628", "0.53762394", "0.5374709", "0.5310626", "0.52978414", "0.52885926", "0.52831006", "0.52605486", "0.5254276", "0.5254276", "0.5233846", "0.5233846", "0.5230837", "0.52280027", "0.51832384", "0.51468235", "0.5114...
0.7294296
0
Sets the exception handler. source://i18n//lib/i18n/config.rb91
def exception_handler=(exception_handler); end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def i18n\n return unless defined?(I18n)\n I18n.config.exception_handler = ->(exception, _locale, _key, _options) do\n raise exception.respond_to?(:to_exception) ? exception.to_exception : exception\n end\n end", "def exception_handler\n @exception_handler ||= {}\n end", "de...
[ "0.7286301", "0.6443783", "0.6399727", "0.62148654", "0.6202593", "0.61766106", "0.59608763", "0.5849426", "0.5799362", "0.57777995", "0.5645895", "0.5636454", "0.56064546", "0.5556423", "0.55394614", "0.5509799", "0.55031306", "0.5468964", "0.5463749", "0.5441261", "0.543817...
0.6949438
1
Returns the current interpolation patterns. Defaults to I18n::DEFAULT_INTERPOLATION_PATTERNS. source://i18n//lib/i18n/config.rb151
def interpolation_patterns; end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def region_patterns\n @@region_patterns\n end", "def interpolators()\n return @interpolators\n end", "def term_qa_replacement_patterns\n Config.config_value(term_config, :qa_replacement_patterns)\n end", "def patterns_for_file( file )\n Hash(config_file(file)[:patterns]).keys +...
[ "0.58912766", "0.5884981", "0.58711416", "0.5808277", "0.5632519", "0.5521293", "0.5463352", "0.5445024", "0.54146683", "0.53358305", "0.5327459", "0.5255294", "0.51123923", "0.5088376", "0.50714624", "0.50555164", "0.5011109", "0.49977556", "0.4968294", "0.4949765", "0.49326...
0.7268299
0
Sets the load path instance. Custom implementations are expected to behave like a Ruby Array. source://i18n//lib/i18n/config.rb132
def load_path=(load_path); end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def loadpath=(list)\n @loadpath = makelist(list)\n end", "def load_translations\n super(@load_paths)\n end", "def load_translations\n super(@load_paths)\n end", "def load_paths\n @load_paths ||= Config::LoadPaths.new\n end", "def initialize(load_path: LOAD_PATH)\n ...
[ "0.6769355", "0.6761703", "0.6761703", "0.6641526", "0.6622645", "0.6529562", "0.6456223", "0.6377205", "0.6334327", "0.62206495", "0.6048509", "0.59980035", "0.59872425", "0.5951372", "0.5912234", "0.5900734", "0.5899993", "0.58590525", "0.5852497", "0.5852497", "0.57656765"...
0.72574174
0
Returns the current handler for situations when interpolation argument is missing. MissingInterpolationArgument will be raised by default. source://i18n//lib/i18n/config.rb97
def missing_interpolation_argument_handler; end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def i18n\n return unless defined?(I18n)\n I18n.config.exception_handler = ->(exception, _locale, _key, _options) do\n raise exception.respond_to?(:to_exception) ? exception.to_exception : exception\n end\n end", "def string_interpolation?(value = @value)\n !value.index(INTERPOLA...
[ "0.5517022", "0.5260013", "0.5257614", "0.51578754", "0.4976981", "0.4906172", "0.48765105", "0.48153022", "0.4802552", "0.4802552", "0.47337902", "0.46863475", "0.46790642", "0.46790642", "0.46781546", "0.46509776", "0.46246645", "0.46230543", "0.46203578", "0.46012974", "0....
0.68051827
0
Method signatures: npgettext('Fruits', 'apple', 'apples', 2) npgettext('Fruits', ['apple', 'apples'], 2) source://i18n//lib/i18n/gettext/helpers.rb61
def npgettext(msgctxt, msgid, msgid_plural, n = T.unsafe(nil)); end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def nsgettext(msgid, msgid_plural, n = T.unsafe(nil), separator = T.unsafe(nil)); end", "def t(*args); I18n.t(*args) end", "def n_(*msgids)\n count = msgids.pop\n \n translations = FastGettext.current_repository.plural(*msgids)\n selected = FastGettext.current_repository.pluralisation_rule....
[ "0.7721742", "0.6507781", "0.63917255", "0.6312333", "0.6190085", "0.6061964", "0.60387564", "0.5962843", "0.5949399", "0.59180874", "0.5904026", "0.58546674", "0.5769935", "0.5748329", "0.57399404", "0.569274", "0.56877345", "0.5640801", "0.562679", "0.5613142", "0.55351084"...
0.78737795
0
Method signatures: nsgettext('Fruits|apple', 'apples', 2) nsgettext(['Fruits|apple', 'apples'], 2) source://i18n//lib/i18n/gettext/helpers.rb46
def nsgettext(msgid, msgid_plural, n = T.unsafe(nil), separator = T.unsafe(nil)); end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def npgettext(msgctxt, msgid, msgid_plural, n = T.unsafe(nil)); end", "def ns_(msgid, msgid_plural, n = T.unsafe(nil), separator = T.unsafe(nil)); end", "def l(*args); I18n.l(*args) end", "def t(*args); I18n.t(*args) end", "def n_(*msgids)\n count = msgids.pop\n \n translations = FastGettext...
[ "0.6792097", "0.66764313", "0.5781654", "0.5726153", "0.5725643", "0.56406915", "0.5438408", "0.5438408", "0.5438408", "0.5358775", "0.53412116", "0.5301072", "0.52857107", "0.5277405", "0.5263729", "0.5263729", "0.5263729", "0.5251851", "0.5247334", "0.5197781", "0.5197781",...
0.75832784
0
Returns the value of attribute backend_klass. source://i18n//lib/i18n/exceptions.rb125
def backend_klass; end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def inspect\n \"Inspec::Backend::Class @transport=#{backend.class}\"\n end", "def klass\n class_name = self[\"_type\"]\n class_name ? class_name.constantize : nil\n end", "def klass\n @klass ||= begin\n @klass_name.split('::').inject(Object){|n,i| n.const_get(i)}\n ...
[ "0.6439473", "0.6364077", "0.6353455", "0.62631845", "0.6179496", "0.61606276", "0.61606276", "0.6159273", "0.61586124", "0.60690385", "0.60690385", "0.60690385", "0.6047836", "0.60435575", "0.6043083", "0.6015774", "0.6010699", "0.5976511", "0.597107", "0.5953714", "0.591720...
0.72675484
0
Write a method called 'in_array' which will take two parameteres: One as a string and one as an array of strings Return a boolean indicationg whether or not the string is found in the array. Test your solution with: ruby tests/05_in_array_test.rb Example: "hello", ["hi","howdy","hello"] should return true. Defining met...
def in_array(needle, haystack) (string_in_array(needle, haystack) == true and needle.is_a? String) ? true : false end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def in_array(array, string)\n array.each do |object|\n if object == string\n return true\n else\n return false\n end\n end\nend", "def is_it_in(array, string)\n array.include?(string) ? array.index(string) : nil\nend", "def arr_in_phrase? (arr, string)\n\t#might be unefficient to recrea...
[ "0.7816119", "0.74933344", "0.74730855", "0.74123037", "0.7315693", "0.7283202", "0.72668666", "0.7142964", "0.7074229", "0.7035094", "0.70348394", "0.70124453", "0.70107067", "0.6939859", "0.6839054", "0.6736855", "0.67250067", "0.6700291", "0.66987336", "0.6493552", "0.6489...
0.8270633
0
block caller until lock is aquired, then yield
def with_lock lock!(true) yield ensure unlock! end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def with_lock\n lock\n begin\n yield if block_given?\n ensure\n unlock\n end\n end", "def synchronize\n lock\n yield\n ensure\n unlock\n end", "def synchronize # :yields:\n lock\n yield\n ensure\n unlock\n end", "def synchronize\n lock...
[ "0.8058668", "0.76484823", "0.7619658", "0.7459504", "0.74217576", "0.7381096", "0.7303057", "0.72804105", "0.72804105", "0.72804105", "0.72804105", "0.72190434", "0.71801776", "0.71436113", "0.71273816", "0.71096826", "0.7001381", "0.6898819", "0.6898819", "0.6898819", "0.68...
0.811213
0
the basename of our lock path for the lock_path '/_zklocking/foobar/__blah/lock000000007' lock_basename is 'lock000000007' returns nil if lock_path is not set
def lock_basename lock_path and File.basename(lock_path) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def lockfile_basename\n \"sync-#{syncer_name}.lock\"\n end", "def lock_path\n File.join(lock_dir,\"Kellerkind.lock\")\n end", "def lock_path; end", "def lockfile_path\n return unless gemfile_path\n @lockfile_path ||= gemfile_path.dirname.join(\"#{gemfile_path.basename}.lock\...
[ "0.6698864", "0.6475923", "0.64210224", "0.64033467", "0.621156", "0.6184906", "0.600972", "0.5983802", "0.59661984", "0.59616673", "0.5881011", "0.58205074", "0.5798359", "0.578139", "0.5766341", "0.56991315", "0.5672897", "0.5625355", "0.56149566", "0.55898243", "0.5580524"...
0.81779593
0
returns the sequence number of the next lowest write lock node raises NoWriteLockFoundException when there are no write nodes with a sequence less than ours
def next_lowest_write_lock_num #:nodoc: digit_from(next_lowest_write_lock_name) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def next_lowest_write_lock_num\n digit_from(next_lowest_write_lock_name)\n end", "def next_lowest_write_lock_name\n ary = ordered_lock_children()\n my_idx = ary.index(lock_basename) # our idx would be 2\n\n ary[0..my_idx].reverse.find { |n| n.start_with?(EXCLUSIVE_LOCK_PREFIX) ...
[ "0.796564", "0.7624367", "0.7462293", "0.7143519", "0.6344001", "0.60185", "0.6001479", "0.5832082", "0.5823021", "0.5794594", "0.57213014", "0.5692753", "0.5692438", "0.5651834", "0.5635214", "0.5607697", "0.55554646", "0.5539939", "0.55361444", "0.54989177", "0.54843944", ...
0.79211247
1
Testing password complexity for dat securitayyy
def password_complexity return if password.blank? || password =~ /^(?=.*?[A-Z])(?=.*?[a-z])(?=.*?[0-9]).{8,20}$/ errors.add :password, 'Password complexity requirement not met.' end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def password_complexity\n if password.present? and not password.match(/\\A(?=.*[a-z])(?=.*[A-Z])(?=.*\\d).*/)\n errors.add :password, I18n.t('weak_password')\n end\n end", "def password_complexity\n if password.present? and not password.match('^(?=.*[a-z])(?=.*[A-Z])(?=.*\\d)(?=.*[$@$!%*?&#]).{8,}...
[ "0.7701583", "0.75790644", "0.75339276", "0.75182414", "0.75172895", "0.73275155", "0.7224962", "0.72051704", "0.71196306", "0.70846075", "0.70819974", "0.70616686", "0.7053988", "0.698081", "0.69537574", "0.693175", "0.6907298", "0.68338525", "0.68187827", "0.67965794", "0.6...
0.7872143
0
Escape bytea values. Uses historical format instead of hex format for maximum compatibility.
def escape_bytea(str) # each_byte used instead of [] for 1.9 compatibility str.gsub(/[\000-\037\047\134\177-\377]/n){|b| "\\#{sprintf('%o', b.each_byte{|x| break x}).rjust(3, '0')}"} end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def bytea(value)\n \"'\\\\x#{value.unpack1('H*')}'::bytea\"\n end", "def quote_binary(v)\n X_AND_SINGLE_QUOTE + v.unpack(\"H*\")[0] + SINGLE_QUOTE\n end", "def quote_binary(v)\n X_AND_SINGLE_QUOTE + v.unpack(\"H*\")[0] + SINGLE_QUOTE\n end", "def quote_binary(v)\n X_A...
[ "0.6670051", "0.6374127", "0.6374127", "0.6338109", "0.6279088", "0.6274744", "0.61785936", "0.6166857", "0.61466247", "0.6128632", "0.60658073", "0.6060971", "0.59690356", "0.589262", "0.5851431", "0.58511394", "0.58188415", "0.58101386", "0.5790922", "0.5764202", "0.5746119...
0.7547868
0
Escape strings by doubling apostrophes. This only works if standard conforming strings are used.
def escape_string(str) str.gsub("'", "''") end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def escape(input); input.to_s.gsub('\"', '\\\\\"'); end", "def qesc(s)\n s.gsub(\"'\", \"''\")\nend", "def shell_escape(s)\n s = s.to_s\n if s !~ /^[0-9A-Za-z+,.\\/:=@_-]+$/\n s = s.gsub(\"'\") { \"'\\\\''\" }\n s = \"'#{s}'\"\n end\n s\n end", "def quote_str(s)\n ...
[ "0.7722508", "0.7642704", "0.7585502", "0.7551453", "0.7524091", "0.7514853", "0.75065154", "0.747003", "0.745325", "0.74331826", "0.74293447", "0.7424182", "0.7401624", "0.7389724", "0.7354956", "0.7320594", "0.73129207", "0.7294251", "0.7289715", "0.7284854", "0.7272765", ...
0.76568407
1
Convert given argument so that it can be used directly by pg. Currently, pg doesn't handle fractional seconds in Time/DateTime or blobs with "\0", and it won't ever handle Sequel::SQLTime values correctly. Only public for use by the adapter, shouldn't be used by external code.
def bound_variable_arg(arg, conn) case arg when Sequel::SQL::Blob {:value=>arg, :type=>17, :format=>1} when Sequel::SQLTime literal(arg) when DateTime, Time literal(arg) else arg end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def convert_for_timestamp_shape(arg)\n return nil if arg.nil?\n\n time_value = case arg\n when Time\n arg\n when Date, DateTime\n arg.to_time\n when Integer, Float\n Time.at(arg)\n else\n Time.parse(arg.to_s)\n end\n time_value.utc...
[ "0.64404684", "0.6386962", "0.61356", "0.5956805", "0.592637", "0.59039587", "0.58744115", "0.5859715", "0.582636", "0.5805587", "0.5797189", "0.57115", "0.5707423", "0.57020915", "0.566127", "0.55909127", "0.55830276", "0.55764776", "0.5537971", "0.55216724", "0.55148417", ...
0.6654411
0