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
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
required to enumerate objects for Enumerable iterator returns each block at a time
def each @block_args.each do |arg| yield arg end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def enumerator ; end", "def enumerator ; end", "def enumerator; end", "def each\n if @length > 0\n item = @head\n begin\n yield item.object\n item = item.next\n end until item.nil?\n end\n end", "def each_with_iterator\n\n iterator = get_iterator_fast\n while (iter...
[ "0.7165281", "0.7165281", "0.7036953", "0.70275724", "0.7010053", "0.6977278", "0.6977278", "0.6977278", "0.6977278", "0.6977278", "0.6977278", "0.6944076", "0.6905531", "0.687465", "0.68448454", "0.6825723", "0.68233407", "0.6796772", "0.67934835", "0.6780284", "0.6779413", ...
0.0
-1
same as each but returns index of each block instead of block itself.
def each_index @block_args.each_index do |i| yield i end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def each_index\n return to_enum(__callee__) unless block_given?\n \n each_with_index{ |_, idx| yield(idx) }\n end", "def each_with_index(&block)\n to_a.each_with_index(&block)\n end", "def each_with_index(&block)\n to_a.each_with_index(&block)\n end", "def each &block\n ...
[ "0.7734222", "0.7663159", "0.7663159", "0.76547736", "0.76475453", "0.7624016", "0.76234496", "0.76048094", "0.7553684", "0.7546723", "0.74547505", "0.7449822", "0.7435243", "0.7407649", "0.7403577", "0.73991257", "0.73741364", "0.7366451", "0.73591226", "0.735764", "0.733929...
0.7645553
5
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
GET /cpanel/tags/1 GET /cpanel/tags/1.json
def show 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.7779269", "0.73845357", "0.73795176", "0.7331087", "0.71544605", "0.71344113", "0.71050936", "0.708074", "0.7032825", "0.6960143", "0.69230896", "0.6874273", "0.68694156", "0.6828036", "0.68220276", "0.6807662", "0.680135", "0.67931074", "0.67931074", "0.67931074", "0.6793...
0.0
-1
POST /cpanel/tags POST /cpanel/tags.json
def create @cpanel_tag = Cpanel::Tag.new(cpanel_tag_params) respond_to do |format| if @cpanel_tag.save format.html { redirect_to @cpanel_tag, notice: 'Tag was successfully created.' } format.json { render action: 'show', status: :created, location: @cpanel_tag } else format....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def tag!(params = {})\n self.post params, edge: :tags\n end", "def tags\n send_tags('tags', @handle, @security)\n end", "def create_tags\n\tend", "def tag\n @session_user = User.find(session[:user_id])\n @page = @session_user.page\n @tags = Array.new \n for panel in @page.panels.o...
[ "0.7175724", "0.6999948", "0.6811086", "0.67192256", "0.6650813", "0.65976113", "0.65713054", "0.65681833", "0.6511931", "0.6503915", "0.64171827", "0.6399328", "0.6350125", "0.634897", "0.633181", "0.6286692", "0.6277253", "0.6269605", "0.62690544", "0.6263475", "0.6263475",...
0.6844606
2
PATCH/PUT /cpanel/tags/1 PATCH/PUT /cpanel/tags/1.json
def update respond_to do |format| if @cpanel_tag.update(cpanel_tag_params) format.html { redirect_to @cpanel_tag, notice: 'Tag was successfully updated.' } format.json { head :no_content } else format.html { render action: 'edit' } format.json { render json: @cpanel_tag.e...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def modify_tag tag\n data = {\n \"tag\" => params\n }\n temp = data[\"servers\"]\n data[\"servers\"] = { \"server\" => temp }\n\n json = JSON.generate data\n\n response = put \"tag/#{tag}\", json\n return response unless response.code == 200\n\n body = JSON.parse response.body\n bod...
[ "0.7226494", "0.6899246", "0.6704542", "0.6684745", "0.6621449", "0.65921783", "0.6515848", "0.64672214", "0.6466572", "0.64545995", "0.6452774", "0.6401909", "0.63852096", "0.63628", "0.63628", "0.6337545", "0.62948054", "0.6288853", "0.62865406", "0.62737775", "0.62584", ...
0.666079
4
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
Use callbacks to share common setup or constraints between actions.
def set_cpanel_tag @cpanel_tag = Cpanel::Tag.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 cpanel_tag_params params.require(:cpanel_tag).permit(:name, :section_id) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def allow_params_authentication!; end", "def allowed_params\n ALLOWED_PARAMS\n end", "def default_param_whitelist\n [\"mode\"]\n...
[ "0.6981273", "0.6783789", "0.67460483", "0.6742222", "0.67354137", "0.65934366", "0.65028495", "0.6497783", "0.64826745", "0.6479415", "0.6456823", "0.6440081", "0.63800216", "0.6376521", "0.636652", "0.6319898", "0.6300256", "0.62994003", "0.6293621", "0.6292629", "0.6291586...
0.0
-1
sum = 0 while !n %2==0 || !n %3==0 end puts sum end
def prob_three max = 600851475143**0.5 for i in (1..max).step(2) if 600851475143 % i == 0 if is_prime(i) ans = i end end end ans end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def solution(n)\n sum = 0\n (1...n).each do |elem|\n sum += elem if elem % 3 == 0 or elem % 5 == 0\n end\n sum\nend", "def findSum(n)\n theFinal = 0\n for i in 3..n do\n if (i % 3 == 0 || i % 5 == 0) \n theFinal += i\n end\n end\n puts theFinal\nend", "def solution(n...
[ "0.8117247", "0.8114005", "0.8062517", "0.80507076", "0.80402356", "0.8012201", "0.79993814", "0.79921454", "0.7988418", "0.7920752", "0.78322285", "0.7813181", "0.77627844", "0.7729503", "0.766986", "0.76513755", "0.7626816", "0.75789535", "0.75603974", "0.75565386", "0.7550...
0.0
-1
Custom validation methods Check if the user has, at least, one role
def roles_presence if roles.size == 0 errors.add(:roles, "User must have, at least, one role") end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def must_have_a_role\n errors.add(:roles, \"Must have a staff or admin role\") unless admin_or_staff?\n end", "def role_required?\n @role_required || false\n end", "def role_valid\n if (APP_CONFIG[\"user_roles\"]+SYSTEM_DATA[\"user_roles\"]).select{|role| role[\"name\"] == self.role}.empty?\n e...
[ "0.79573935", "0.7698732", "0.7675534", "0.7653518", "0.75591224", "0.75169206", "0.73782134", "0.73148614", "0.73056096", "0.72914416", "0.7278201", "0.7247163", "0.703482", "0.7000041", "0.6947494", "0.6918426", "0.68983364", "0.68725675", "0.6865548", "0.6848384", "0.68398...
0.7429432
6
Check if user has a given role
def role?(role) return !!self.roles.find_by_name(role.to_s) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def has_role?(role)\n current_user && current_user.has_role?(role)\n end", "def has_role?(role)\n current_user && current_user.has_role?(role)\n end", "def has_role?(role)\n if self.roles.exists? then\n self.roles.find_by(:name => role).present?\n end\n end", "def has_role(r)\n self.ro...
[ "0.8478626", "0.8478626", "0.8435144", "0.8402428", "0.8399518", "0.83606", "0.83278924", "0.83156085", "0.82329905", "0.822057", "0.822057", "0.822057", "0.822057", "0.822057", "0.822057", "0.82067007", "0.820393", "0.8198993", "0.8198993", "0.8194761", "0.81928426", "0.81...
0.80047
42
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
GET /enrolls/new GET /enrolls/new.json
def new @actions = [{"YGO战网" => users_path}, "参加比赛"] @enroll = Enroll.new @enroll.name = @current_user.name if @current_user.id != 0 @enroll.tournament = Tournament.find params[:tournament_id] if params[:tournament_id] respond_to do |format| format.html # new.html.erb format.json { rende...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @enrollment = Enrollment.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @enrollment }\n end\n end", "def new\n @enrollment = Enrollment.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: ...
[ "0.78642637", "0.78642637", "0.7677734", "0.7499671", "0.71483815", "0.7146724", "0.711371", "0.71082497", "0.7101876", "0.7101876", "0.70664245", "0.7041032", "0.70106286", "0.70106286", "0.701044", "0.7010137", "0.70066035", "0.69908917", "0.6989849", "0.6966022", "0.690134...
0.6873895
24
POST /enrolls POST /enrolls.json
def create file = params[:enroll][:deck] params[:enroll][:deck] = nil @enroll = Enroll.new(params[:enroll]) @enroll.score = -1 @enroll.user = @current_user @enroll.tournament = Tournament.find params[:enroll][:tournament_id] if @enroll.tournament.need_deck if file extname = Fil...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def enrollment(params = {})\n scope 'default'\n post('enrollment/', params)\n end", "def create\n @enroll = Enroll.new(enroll_params)\n\n respond_to do |format|\n if @enroll.save\n format.html { redirect_to @enroll, notice: 'Enroll was successfully created.' }\n format.json ...
[ "0.7566068", "0.74632406", "0.72054386", "0.718063", "0.6777213", "0.6672076", "0.66152406", "0.6612462", "0.65868115", "0.65868115", "0.65717965", "0.6530254", "0.6508454", "0.64719474", "0.6457346", "0.64413095", "0.64152694", "0.63479143", "0.63470614", "0.633733", "0.6337...
0.0
-1
PUT /enrolls/1 PUT /enrolls/1.json
def update @enroll = Enroll.find(params[:id]) @enroll.tournament = Tournament.find params[:enroll][:tournament_id] respond_to do |format| if @enroll.update_attributes(params[:enroll]) format.html { redirect_to @enroll, notice: 'Enroll was successfully updated.' } format.json { head :no...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @enroll = Enroll.find(params[:id])\n if @enroll.update_attributes(params[:enroll])\n render json: JSON.parse(@enroll.to_json)\n else\n render json: JSON.parse(@enroll.errors.to_json)\n end\n end", "def update\n respond_to do |format|\n if @enroll.update(enroll_params)\...
[ "0.77015555", "0.73457915", "0.73457915", "0.71257854", "0.71257854", "0.71257854", "0.71257854", "0.7108434", "0.70981526", "0.68159974", "0.6729866", "0.6627292", "0.6578257", "0.6570706", "0.65609324", "0.65262467", "0.65262467", "0.65262467", "0.65262467", "0.65262467", "...
0.71183705
7
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
GET /rooms GET /rooms.json
def index # @rooms = Room.searchroom(params[:r]) # @rooms = Room.where("admin_id = ?",current_admin.id) @areas = Area.where(admin_id: current_admin.id).map { |a| [a.name, a.id] } @room1 = ActiveRecord::Base.connection.execute("select r.id ,r.name,r.status,r.admin_id, b.total,s.datebegin,s.dateend from rooms...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n\t\t@rooms = Room.order(updated_at: :desc)\n\t\trespond_to do |format|\n\t\t\tformat.html\n\t\t\tformat.json { render json: @rooms }\n\t\tend\n\tend", "def get_rooms\n # DO NOT DELETE. Condition used for load testing\n @user_id = (params.has_key? :user_id) ? params[:user_id] : session[:u...
[ "0.788489", "0.78231525", "0.7690326", "0.76826984", "0.76242465", "0.7573095", "0.75299007", "0.737599", "0.7297831", "0.72899485", "0.7252718", "0.7222336", "0.7193262", "0.71638155", "0.7132772", "0.7118043", "0.7118043", "0.7118043", "0.7118043", "0.7118043", "0.7118043",...
0.0
-1
GET /rooms/1 GET /rooms/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n\t\t@rooms = Room.order(updated_at: :desc)\n\t\trespond_to do |format|\n\t\t\tformat.html\n\t\t\tformat.json { render json: @rooms }\n\t\tend\n\tend", "def index\n @rooms = Room.all\n respond_to do | format |\n format.html\n format.json\n end\n \n end", "def index\n @rooms ...
[ "0.7478235", "0.7468609", "0.7457006", "0.7416629", "0.7338858", "0.73378056", "0.73378056", "0.73378056", "0.72945076", "0.7131917", "0.707778", "0.7031814", "0.70124215", "0.69494665", "0.6912663", "0.6889057", "0.68889284", "0.68889284", "0.68889284", "0.68889284", "0.6888...
0.0
-1
POST /rooms POST /rooms.json
def create @room = Room.new(room_params) @room.name = "Room " +@room.name @room.admin_id = current_admin.id respond_to do |format| if @room.save format.html { redirect_to rooms_path , notice: 'Room was successfully created.' } format.json { render :show, status: :created, location:...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @room = Room.new(params[:room])\n\n if @room.save\n render :json => @room, :status => :created, :location => @room\n else\n render :json => @room.errors, :status => :unprocessable_entity\n end\n end", "def create\n @user=User.find(params[:user_id])\n @room = @user.rooms....
[ "0.72056574", "0.707968", "0.69656384", "0.6932348", "0.68974215", "0.68974215", "0.6837064", "0.68087316", "0.67632353", "0.67632353", "0.67632353", "0.67160654", "0.66814065", "0.66665167", "0.6651527", "0.6645849", "0.6636827", "0.66291404", "0.65891176", "0.656336", "0.65...
0.635287
39
PATCH/PUT /rooms/1 PATCH/PUT /rooms/1.json
def update respond_to do |format| if @room.update(room_params) format.html { redirect_to rooms_path, notice: 'Room was successfully updated.' } format.json { render :show, status: :ok, location: @room } else format.html { render :edit } format.json { render json: @room.er...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @room = Room.find(params[:id])\n\n if @room.update_attributes(params[:room])\n head :ok\n else\n render :json => @room.errors, :status => :unprocessable_entity \n end\n end", "def update\n if @room.update(room_params)\n render json: @room, status: :ok, serializer: Room...
[ "0.71675444", "0.7049212", "0.7000274", "0.6996011", "0.69671804", "0.6927408", "0.6926342", "0.6926342", "0.690636", "0.68662703", "0.68121725", "0.6795969", "0.6792735", "0.674421", "0.674305", "0.67349285", "0.6731771", "0.67010766", "0.67010766", "0.67010766", "0.67010766...
0.6773955
13
DELETE /rooms/1 DELETE /rooms/1.json
def destroy @room.destroy respond_to do |format| format.html { redirect_to rooms_url, notice: 'Room was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @room = Room.find(params[:id])\n @room.destroy\n\n respond_to do |format|\n format.html { redirect_to rooms_url }\n format.json { head :ok }\n end\n end", "def destroy\n @room = Room.find(params[:id])\n @room.destroy\n\n respond_to do |format|\n format.html { re...
[ "0.7635934", "0.7620118", "0.761992", "0.7589228", "0.7583094", "0.7565785", "0.7555699", "0.75015026", "0.7446661", "0.7445735", "0.7438515", "0.73450273", "0.7341036", "0.7299027", "0.7295218", "0.72534937", "0.72534937", "0.725146", "0.72453046", "0.72278804", "0.72278804"...
0.72336674
28
Use callbacks to share common setup or constraints between actions.
def set_room @room = Room.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 room_params params.require(:room).permit(:name, :status, :price, :slot, :area_id,:admin_id,:r,:quantity,:deposit,:av) 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.6981273", "0.6783789", "0.67460483", "0.6742222", "0.67354137", "0.65934366", "0.65028495", "0.6497783", "0.64826745", "0.6479415", "0.6456823", "0.6440081", "0.63800216", "0.6376521", "0.636652", "0.6319898", "0.6300256", "0.62994003", "0.6293621", "0.6292629", "0.6291586...
0.0
-1
For some reason this doesn't work, so a workaround is used load_and_authorize_resource :event, through: :program
def index @events = Event.accessible_by(current_ability).where(program: @program) @events_commercials = Commercial.where(commercialable_type: 'Event', commercialable_id: @events.pluck(:id)) @events_missing_commercial = @events.where.not(id: @events_commercials.pluck(:commercialable_id)) @events_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_resource\n #apply policy scope\n @event = EventPolicy::Scope.new(current_user, Event).resolve.find(params[:id])\n end", "def set_event\n @event = Event.find(params[:id])\n authorize @event\n end", "def show\n authorize @event\n end", "def authorize_admin\n authorize! :update, con...
[ "0.6791258", "0.677467", "0.6675366", "0.6483827", "0.6156664", "0.6090217", "0.6069886", "0.6021218", "0.589772", "0.5872916", "0.5749754", "0.57417494", "0.57368666", "0.57301223", "0.56887525", "0.566999", "0.56336766", "0.56028837", "0.55934423", "0.5578263", "0.5520868",...
0.0
-1
questions: did the candidate design a method or a class? any thoughts regarding testing? followon: modify to print the first N digits how flexible is the implementation? How much rework involved, if any?
def fibonacci(n) a = 0 b = 1 n.times do temp = a a = b b = temp + b end a end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def solution(n)\r\n unit = UNITS[n % 10]\r\n dozen = DOZENS[(n % 100) / 10]\r\n hundred = HUNDREDS[(n % 1000) / 100]\r\n thousand = THOUSAND * (n / 1000)\r\n [thousand, hundred, dozen, unit].join\r\nend", "def print_number(number, number_string_length, required_length)\n puts \"#{number}, #{number_string_l...
[ "0.6485079", "0.6400109", "0.63423723", "0.6289188", "0.62436855", "0.6241543", "0.61501276", "0.61470395", "0.61365926", "0.611719", "0.61133426", "0.611205", "0.61092514", "0.6084901", "0.60542333", "0.60273254", "0.60240096", "0.60122144", "0.6011806", "0.59990585", "0.599...
0.0
-1
Constructor de una lista doblemente enlazada
def initialize @Node = Struct.new(:value, :next, :prev) @head = nil @tail = nil end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initialize(list)\n @list = list\n end", "def initialize(list)\n @list = list\n end", "def initialize(base_list)\n @list = base_list\n end", "def initialize\n @lista_contas = []\n end", "def initialize()\n @contenu = [\n [\"t\", \"i\", \"c\"],\n [\"t\", \"a\", \"c\"],\n ...
[ "0.7614568", "0.7565089", "0.73375154", "0.7317544", "0.71179426", "0.70677465", "0.7060995", "0.69934046", "0.6993102", "0.6980053", "0.6974631", "0.6966772", "0.69313204", "0.69313204", "0.6904812", "0.68217254", "0.6801455", "0.67572653", "0.67567945", "0.674178", "0.67276...
0.0
-1
Ver que valores vas a comparar de la lista
def what(v) @v=v end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def has_similar_property_value_list?( property_value_list )\n property_value_list.each do |property_value_pair|\n if self.property_values.where(:property_id => property_value_pair[:property_id], \n :value_id => property_value_pair[:value_id]).count == 0 \n next\n else...
[ "0.598365", "0.5930304", "0.5918263", "0.5692191", "0.55947196", "0.5529169", "0.5526782", "0.55149204", "0.5504688", "0.5460339", "0.5427653", "0.5420974", "0.5414546", "0.54072195", "0.5378469", "0.53717905", "0.5363165", "0.5352386", "0.5349939", "0.5338657", "0.53374577",...
0.0
-1
Mostrar los valores de la cabeza de la lista
def to_s "#{@head.value}" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def listar_arreglo(arreglo)\n cadena = '| '\n # puts 'el indice: #{index} y el valor: #{value}'\n arreglo.each { |value| cadena += \" #{value} | \" }\n puts cadena\nend", "def print_items\n return values\n end", "def lista(contatos)\n\tfor i in 0..contatos.size-1\n\t\tputs (\"#{i+1}. #{cont...
[ "0.64224577", "0.63708043", "0.63429993", "0.63303196", "0.63251066", "0.63100123", "0.62320286", "0.6219579", "0.6181895", "0.61796343", "0.6150321", "0.6150321", "0.6100619", "0.6048726", "0.60370904", "0.6022908", "0.6021368", "0.6000858", "0.59981227", "0.5987866", "0.598...
0.0
-1
Sirve para recorrer la lista, enumerable
def each(&block) node = @Node.new(nil,nil,nil) node = @head while !(node.nil?) yield node.value node = node.next end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def list\n return @enumerable\n end", "def list(*) end", "def items\n items, iter = [], @obj.items\n while (i = iter.next) do\n items << i\n end\n items\n end", "def list; end", "def list; end", "def list; end", "def list; end", "def list; end", "def each\n to_a.each...
[ "0.7011855", "0.6359514", "0.6310448", "0.6287517", "0.6287517", "0.6287517", "0.6287517", "0.6287517", "0.6275133", "0.6275133", "0.6275133", "0.62693816", "0.6236609", "0.62325674", "0.61988324", "0.6150444", "0.6061723", "0.604379", "0.6032112", "0.6030455", "0.60212445", ...
0.0
-1
Insertar al final de la lista un objeto
def insert_by_end(value) if @head.nil? @head = @Node.new(value, nil, nil) @tail = @head else @tail[:next] = @Node.new(value, nil, @tail) @tail = @tail[:next] end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def insertar(texto,timestamp,usuario,fotousuario)\n\t\n\t\tlistaobjeto=[texto,timestamp,usuario,fotousuario]\n\t\t@Lista+=[listaobjeto]\n\tend", "def insertar_lista_final(referencia)\n if @final != nil\n @final = Nodo.new(referencia, nil, @final)\n n = @final.anterior\n ...
[ "0.6997016", "0.6977173", "0.6171723", "0.6167173", "0.608169", "0.60140973", "0.5989488", "0.59858423", "0.59395766", "0.591478", "0.5836549", "0.57913935", "0.5784744", "0.57830185", "0.5753295", "0.5701729", "0.56861204", "0.5683191", "0.5590882", "0.55694574", "0.5565263"...
0.0
-1
Insertar al comienzo de la lista
def insert_by_begin(value) if @head.nil? @head = @Node.new(value, nil, nil) @tail = @head else @head[:prev] = @Node.new(value, @head, nil) @head = @head[:prev] end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def insertar(texto,timestamp,usuario,fotousuario)\n\t\n\t\tlistaobjeto=[texto,timestamp,usuario,fotousuario]\n\t\t@Lista+=[listaobjeto]\n\tend", "def insert_takoble\n\t\tsql = \"insert into TAKO_List values (?, ?)\"\n\t\treturn sql\n\tend", "def agregar_compra(producto, unidades = 1)\n DB.execute(\"insert int...
[ "0.71916693", "0.6845767", "0.6710367", "0.6560496", "0.64945215", "0.62143415", "0.6160945", "0.6136621", "0.61317945", "0.60741496", "0.6067267", "0.60642874", "0.605406", "0.6039778", "0.6017522", "0.6006295", "0.6000629", "0.5986575", "0.5940899", "0.59371734", "0.5870948...
0.0
-1
Extraer al comienzo de la lista
def extract_by_begin() if @head == @tail @head, @tail = nil else @head = @head[:next] @tail = @tail[:prev] @tail[:next] = nil end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def liste()\n puts(\"LISTE DES ORDRES\\n\");\n printf(\"%8s %8s %5s %10s\\n\",\n \"ID\", \"DEBUT\", \"DUREE\", \"PRIX\")\n printf(\"%8s %8s %5s %10s\\n\",\n \"--------\", \"-------\", \"-----\", \"----------\")\n @listOrdre = @listOrdre.sort{ |a,b| a.debut <=> b.deb...
[ "0.64497757", "0.64112437", "0.63231516", "0.6316969", "0.63040507", "0.6236165", "0.62184566", "0.61983", "0.61309683", "0.60884625", "0.6030821", "0.6030821", "0.6030821", "0.59506583", "0.58929974", "0.58924073", "0.5884651", "0.5873622", "0.58721846", "0.5828492", "0.5827...
0.0
-1
Time this data was processed
def processed_at @data.has_key?('processed_at') ? Time.parse(data['processed_at']) : nil end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def processed_date_time\n return @processed_date_time\n end", "def processed_date_time\n return @processed_date_time\n end", "def time\n return @time\n end", "def time; end", "def time; end", "def time; end", "def time; end",...
[ "0.7575571", "0.7575571", "0.7322301", "0.72568333", "0.72568333", "0.72568333", "0.72568333", "0.72568333", "0.72568333", "0.72568333", "0.72568333", "0.72568333", "0.7240576", "0.71006215", "0.7082745", "0.705201", "0.69457346", "0.69243026", "0.68922687", "0.68641275", "0....
0.68988043
18
a single dash before and after each odd digit. There is one exception: don't start or end the string with a dash. You may wish to use the `%` modulo operation; you can see if a number is even if it has zero remainder when divided by two. Difficulty: medium.
def dasherize_number(num) i=1 num = num.to_s new_str = num[0] while (i>0 && i<num.length) if (num[i].to_i%2==1 || num[i-1].to_i%2==1) new_str = new_str + "-" + num[i].to_s else new_str = new_str + num[i].to_s end i+=1 end return new_str end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dasherize_number(num)\n\n index = 0\n \n num_string = num.to_s\n new_string = ''\n \n while index < num_string.length\n # Simplify your checks for odd and evenness here. \n # You are checking for so many things which makes the code messy.\n # Just divide the number using modulo you don't need to chec...
[ "0.83188766", "0.7967828", "0.792637", "0.792181", "0.79200864", "0.7898977", "0.78481513", "0.777453", "0.7764941", "0.7703267", "0.7702926", "0.76862717", "0.7661154", "0.7652543", "0.765168", "0.76323277", "0.7630894", "0.7611904", "0.7605826", "0.7599978", "0.7582187", ...
0.79424214
2
Read in AH data from CSV file
def read_file(fname=nil) return if fname.nil? # Array we use to store entries lines = Array.new ah_data = Array.new # Deal with DOS line endings by reading in file, then manually splitting on DOS line ending File.open(fname).each_line do |line| lines = line.split(/\r\n?/).map(&:chomp) end return lin...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read_in_csv_data(csv_file_name)\n begin\n CSV.foreach(csv_file_name, headers: true) do |row|\n @songs << Song.new(row['name'], row['location'])\n end\n rescue Exception\n @songs = nil\n end\n @songs\n end", "def load\n CSV.foreach(@csv_file, headers: :first_row, header_c...
[ "0.6840709", "0.6812845", "0.6753627", "0.67416865", "0.66207886", "0.6611238", "0.6594113", "0.65697026", "0.65382767", "0.6517975", "0.651279", "0.64944214", "0.6486111", "0.6482863", "0.6425298", "0.63752025", "0.63615036", "0.6338695", "0.632677", "0.630831", "0.6298699",...
0.0
-1
Merges given configuration parameters with defined during initialization and returns the result.
def configure(settings = {}) abstract_method end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def merge_config!(config = {})\n self.config.url = config[:url] if config.key?(:url)\n self.config.opts = config[:opts] if config.key?(:opts)\n self.config.db = config[:db] if config.key?(:db)\n end", "def config_merge(config)\n @config.merge!(config)\n end", "def initial_conf...
[ "0.7071678", "0.69807863", "0.67086303", "0.6531987", "0.6501963", "0.645218", "0.6424541", "0.64244926", "0.6417341", "0.63183165", "0.6314637", "0.6313858", "0.62458676", "0.6232559", "0.62201583", "0.61650246", "0.61438435", "0.6096816", "0.60810095", "0.60730255", "0.6051...
0.0
-1
Method for defining other methods as abstract.
def abstract_method method_not_implemented end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def abstract!; end", "def abstract?; end", "def abstract!\n @abstract = true\n end", "def abstract!\n @abstract = true\n end", "def abstract!\n @abstract = true\n end", "def abstract?; @abstract; end", "def abstract\n @abstract = true\n ...
[ "0.84944344", "0.8262082", "0.81707656", "0.8026988", "0.79551786", "0.78130686", "0.78109115", "0.70584995", "0.6977021", "0.68376577", "0.682224", "0.68141264", "0.68141264", "0.67399716", "0.67399716", "0.6660936", "0.662506", "0.66215926", "0.654345", "0.65226305", "0.649...
0.73208475
7
As a user I should be able to list meals As a user I should be able to create a meal
def list display_meals end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_meal\n @meal = current_user.meals.find(params[:id])\n end", "def meals\n get(\"/user/#{@user_id}/meals.json\")\n end", "def set_meal\n @meal = Meal.available.exclusive(current_user).find(params[:id])\n end", "def set_meal\n @meal = Meal.find_by(user_id: current_user.id)\n end"...
[ "0.71216446", "0.7096165", "0.70177394", "0.6932517", "0.6847684", "0.68153816", "0.6728353", "0.6681564", "0.66689736", "0.66546756", "0.66472256", "0.6592594", "0.65827924", "0.6570472", "0.6569442", "0.6569442", "0.65679926", "0.6458745", "0.64425606", "0.64425606", "0.643...
0.57579494
59
Returns the current fallbacks implementation. Defaults to +I18n::Locale::Fallbacks+. source://i18n//lib/i18n/backend/fallbacks.rb17
def fallbacks; end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fallbacks\n @fallbacks ||= {}\n end", "def fallback\n @@fallback\n end", "def ar_fallbacks(force = false)\n return @@ar_fallbacks if @@ar_fallbacks\n return fallbacks unless force\n @@ar_fallbacks = Globalize::Locale::Fallbacks.new\n end", "def locale_fallback?\n...
[ "0.7676079", "0.7343258", "0.660933", "0.6498168", "0.6493042", "0.6470338", "0.64479476", "0.6431005", "0.6210287", "0.6094286", "0.5987497", "0.5829084", "0.5816213", "0.5570987", "0.5507317", "0.5507317", "0.54668903", "0.54631096", "0.5412813", "0.5351174", "0.5350387", ...
0.65809137
3
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
Return String or raises MissingInterpolationArgument exception. Missing argument's logic is handled by I18n.config.missing_interpolation_argument_handler.
def interpolate(string, values); end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def missing_interpolation_argument_handler; end", "def string_interpolation?(value = @value)\n !value.index(INTERPOLATION).nil?\n end", "def ignore_interpolation? arg, suspect\n return unless string_interp? arg\n return true unless arg[1].chomp.empty? # plain string before interpolation\n...
[ "0.6942147", "0.6067322", "0.5788349", "0.5743582", "0.57110333", "0.5502603", "0.53332263", "0.52484816", "0.51980627", "0.51798755", "0.517934", "0.5028087", "0.5028087", "0.5021697", "0.5018917", "0.49953845", "0.4950353", "0.48989996", "0.48874968", "0.4886459", "0.488141...
0.51238894
11
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
Evaluates defaults. If given subject is an Array, it walks the array and returns the first translation that can be resolved. Otherwise it tries to resolve the translation directly. source://i18n//lib/i18n/backend/base.rb125
def default(locale, object, subject, options = T.unsafe(nil)); end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def default(locale, object, subject, options = {})\n options = options.dup.reject { |key, value| key == :default }\n case subject\n when Array\n subject.count - 1\n subject.each do |item|\n result = resolve(locale, object, item, options) #and return res...
[ "0.73392236", "0.5986221", "0.59776527", "0.59714496", "0.5765452", "0.5482785", "0.54764575", "0.53853554", "0.536861", "0.5346757", "0.5334776", "0.5306782", "0.5297737", "0.52549946", "0.51945865", "0.5161835", "0.5151408", "0.514883", "0.50704414", "0.5014808", "0.4953723...
0.5466102
7
Loads a single translations file by delegating to load_rb or load_yml depending on the file extension and directly merges the data to the existing translations. Raises I18n::UnknownFileType for all other file extensions.
def load_file(filename); 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.6884348", "0.6668286", "0.6668286", "0.651807", "0.6482737", "0.6285057", "0.6182364", "0.6182364", "0.61569136", "0.6142363", "0.61227286", "0.6052862", "0.60503095", "0.59643984", "0.59460646", "0.5942739", "0.5933745", "0.5922498", "0.5796637", "0.57852334", "0.568418",...
0.55584794
26
Loads a JSON translations file. The data must have locales as toplevel keys. source://i18n//lib/i18n/backend/base.rb266
def load_json(filename); end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read_json_file(locale)\n\t\tember_json_file_path = File.join(Rails.root, \"frontend\", \"translations\", \"#{locale.to_sym}.json\")\n\t\tfile_exists = File.exist?(ember_json_file_path)\n\t\tif file_exists # Read file contents, if file exists.\n\t\t\tfile_contents = File.read(ember_json_file_path)\n\t\t\tember_...
[ "0.7047893", "0.6657459", "0.64885545", "0.6479761", "0.6408364", "0.6368965", "0.62687755", "0.62687755", "0.6224206", "0.6219601", "0.6200123", "0.6154813", "0.6136007", "0.6136007", "0.6099765", "0.6079235", "0.60539055", "0.59556514", "0.58981043", "0.5855989", "0.5802763...
0.6439563
4
Loads a plain Ruby translations file. eval'ing the file must yield a Hash containing translation data with locales as toplevel keys. source://i18n//lib/i18n/backend/base.rb244
def load_rb(filename); end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_translations(*filenames); end", "def load_translations(*filenames); end", "def translations\n raise \"i18n has no load_path(s)\" if ::I18n.load_path.empty?\n ::I18n.backend.instance_eval do\n init_translations unless initialized?\n translations\n end\n end", "def load_i18n\n ...
[ "0.7082958", "0.7082958", "0.6813423", "0.67102414", "0.655972", "0.65539837", "0.65329677", "0.6460485", "0.6437766", "0.6375245", "0.6345969", "0.63019913", "0.62080586", "0.62069494", "0.61903834", "0.61903834", "0.61797833", "0.6172525", "0.6165779", "0.6136125", "0.61024...
0.0
-1
Loads a YAML translations file. The data must have locales as toplevel keys. source://i18n//lib/i18n/backend/base.rb251
def load_yaml(filename); end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_yml(filename); end", "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...
[ "0.72406995", "0.6987751", "0.6949591", "0.6899159", "0.66687495", "0.6665493", "0.6591126", "0.65860075", "0.65714854", "0.6557816", "0.6534201", "0.6506259", "0.6465095", "0.64310896", "0.6410187", "0.63956946", "0.63916564", "0.6381389", "0.63684714", "0.6359302", "0.63593...
0.6920773
3
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
Picks a translation from a pluralized mnemonic subkey according to English pluralization rules : It will pick the :one subkey if count is equal to 1. It will pick the :other subkey otherwise. It will pick the :zero subkey in the special case where count is equal to 0 and there is a :zero subkey present. This behaviour ...
def pluralize(locale, entry, count); end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pluralize(locale, entry, count)\n\n # return the entry directly if it is a string\n return entry unless entry.is_a?(Hash)\n\n key = pluralizer(locale).call(count.nil? ? 1 : count)\n # fallback to other if :zero is not set\n key = :other if key == :zero && !entry.has_key?(:zer...
[ "0.65760964", "0.6508447", "0.6155993", "0.612094", "0.61165696", "0.59416956", "0.5794986", "0.5783066", "0.5713492", "0.57092893", "0.5707097", "0.56927174", "0.56564534", "0.56412506", "0.5623333", "0.5586661", "0.5562212", "0.55326295", "0.55300367", "0.55134994", "0.5505...
0.6254238
2
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
Track loaded translation files in the `i18n.load_file` scope, and skip loading the file if its contents are still uptodate. source://i18n//lib/i18n/backend/cache_file.rb17
def load_file(filename); end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_translations_and_collect_file_errors(files); 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 $stderr.puts 'No valid trans...
[ "0.64713883", "0.62355065", "0.61133826", "0.6104112", "0.6056092", "0.602115", "0.60041994", "0.5991724", "0.5811452", "0.5780131", "0.5770043", "0.5754264", "0.5694176", "0.5694176", "0.56774527", "0.56449616", "0.563705", "0.5634282", "0.5634282", "0.56184894", "0.560932",...
0.0
-1
Translate absolute filename to relative path for i18n key. source://i18n//lib/i18n/backend/cache_file.rb28
def normalized_path(file); end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def file_path\n Dir.glob(config.cache).first || File.join(File.dirname(config.cache),\n File.basename(config.cache).gsub(/_.+\\.txt/, '_0.txt'))\n end", "def cache_file key\n File.join( store, key+\".cache\" )\n end", "def file_path(file_name)\n file ...
[ "0.6430694", "0.63742805", "0.6372514", "0.6198732", "0.6191566", "0.61423457", "0.6133886", "0.61234", "0.6119151", "0.61188346", "0.60943013", "0.6041107", "0.60368574", "0.60319185", "0.60319185", "0.59548765", "0.5950963", "0.58849734", "0.5881956", "0.58752", "0.5807847"...
0.0
-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
This is approximately what gets used in ActiveSupport. However since we are not guaranteed to run in an ActiveSupport context it is wise to have our own copy. We underscore it to not pollute the namespace of the including class. source://i18n//lib/i18n/backend/chain.rb117
def _deep_merge(hash, other_hash); end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def freeze\n context and inclusions and super\n end", "def lookup_chain = locale(true).lookup", "def initialize\n super('unify')\n freeze\n end", "def transitive_closure() self.class.new(self).transitive_closure!; end", "def underscore\n dup.underscore!\n end", "def undersc...
[ "0.5785937", "0.54091036", "0.52652746", "0.5110023", "0.50062156", "0.49867928", "0.4923765", "0.49087626", "0.49065316", "0.48771864", "0.4865894", "0.48566875", "0.48519343", "0.48506147", "0.48506147", "0.48376495", "0.47736067", "0.4762625", "0.47577792", "0.47304142", "...
0.0
-1
Overwrites the Base backend translate method so that it will try each locale given by I18n.fallbacks for the given locale. E.g. for the locale :"deDE" it might try the locales :"deDE", :de and :en (depends on the fallbacks implementation) until it finds a result with the given options. If it does not find any result fo...
def translate(locale, key, options = T.unsafe(nil)); end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def translate_with_fallbacks opts, locale = nil\n locale ||= default_locale\n\n opts.each.with_index do |(key, vars), index|\n next unless I18n.exists?(key, locale) || index == opts.count - 1\n\n return I18n.translate(key, vars)\n end # each\n end", "def on_fallback(_original_loca...
[ "0.80864644", "0.68280923", "0.6678587", "0.66095275", "0.6457375", "0.62876064", "0.62848794", "0.6255123", "0.6195622", "0.61422807", "0.60571635", "0.60564685", "0.59982437", "0.59956896", "0.59906256", "0.58794403", "0.581109", "0.5762872", "0.56726027", "0.5646645", "0.5...
0.5691512
18
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
Store flattened links. source://i18n//lib/i18n/backend/flatten.rb50
def links; end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_flatten_link\r\n link = @link_list.add_link(@measure, @perfind) \r\n assert_equal( { \"from_id\"=>1, \"to_id\"=>2 },\r\n link.flatten_data)\r\n end", "def translatable_items_links\n AvailableLocale.translatables.map do |t|\n translatable_links(t)\n end.join....
[ "0.64987916", "0.6374803", "0.62614495", "0.6160253", "0.6079002", "0.5951829", "0.59395635", "0.58430517", "0.57470155", "0.55781007", "0.5577545", "0.55084294", "0.5495729", "0.5456861", "0.5456288", "0.5436947", "0.54067767", "0.5398912", "0.539842", "0.5397416", "0.537518...
0.52297366
35
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
Returns the value of attribute store. source://i18n//lib/i18n/backend/key_value.rb71
def store; end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def key_value\n @attrs[self.class.key_attribute.to_s]\n end", "def key_value\n @attrs[self.class.key_attribute.to_s]\nend", "def value\n attributes.fetch(:value)\n end", "def value\n @attributes[:value]\n end", "def attribute_value(key, node = @current_node)\n\t\tif is_va...
[ "0.7275061", "0.69266886", "0.69018704", "0.66743445", "0.6652223", "0.6612008", "0.65270466", "0.6488031", "0.64869785", "0.6470758", "0.6448968", "0.63930184", "0.63240355", "0.6313026", "0.63064104", "0.6255721", "0.6224604", "0.62069124", "0.619038", "0.619038", "0.617730...
0.0
-1
Sets the attribute store
def store=(_arg0); end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def store=(store)\n @store = store\n end", "def store= store\n super\n\n @attributes .each do |attr| attr.store = store end\n @constants .each do |const| const.store = store end\n @includes .each do |incl| incl.store = store end\n @extends .each do |ext| ext.store = store...
[ "0.6954436", "0.6744716", "0.6744155", "0.67336833", "0.6701682", "0.66674626", "0.6648697", "0.6648697", "0.6648697", "0.6648697", "0.6648697", "0.6648697", "0.6648697", "0.6648697", "0.6648697", "0.66077995", "0.6590807", "0.6590807", "0.650644", "0.6481785", "0.6469278", ...
0.0
-1
Queries the translations from the keyvalue store and converts them into a hash such as the one returned from loading the haml files source://i18n//lib/i18n/backend/key_value.rb115
def translations; end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def translations_hash; end", "def t_hash(key)\n translations = {}\n %i[en fr].each do |locale|\n translations[locale] = I18n.t(key, locale: locale, default: key.to_s.titleize)\n end\n translations\n end", "def translations\n @translations ||= {}\n end", "def translations\n ...
[ "0.7221288", "0.69811535", "0.64487255", "0.62537754", "0.6169108", "0.61664224", "0.61107737", "0.6027025", "0.6013877", "0.5980078", "0.59714925", "0.58560467", "0.58380735", "0.58132577", "0.5808619", "0.5800313", "0.5789081", "0.5772418", "0.5760478", "0.5727814", "0.5703...
0.59110403
11
Parse the load path and extract all locales. source://i18n//lib/i18n/backend/lazy_loadable.rb99
def available_locales; end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_localization!\n reset_l10n_data\n\n # Load the rails localization\n if rails_localization_files\n rails_localization_files.each do |file|\n lang = File.basename(file, '.*')[0,2].downcase.to_sym\n # if a country is defined\n if File.basename(file, '.*')[3,5]...
[ "0.6734436", "0.64431256", "0.6354007", "0.6354007", "0.6298475", "0.6288107", "0.62688625", "0.6185744", "0.60980767", "0.6091885", "0.60335535", "0.5944286", "0.5915943", "0.5872034", "0.5813465", "0.58125365", "0.578604", "0.578604", "0.57639205", "0.57400817", "0.573697",...
0.55900156
38
Eager loading is not supported in the lazy context. source://i18n//lib/i18n/backend/lazy_loadable.rb90
def eager_load!; end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def eager_load; end", "def eager_load; end", "def eager_load; end", "def before_eager_load(&block); end", "def lazy_load(resource)\n # If we're trying to load a lazy property, load it. Otherwise, lazy-load\n # any properties that should be eager-loaded but were not included\n # in the origin...
[ "0.65472996", "0.65472996", "0.65472996", "0.589751", "0.5847515", "0.5797289", "0.57864857", "0.57864857", "0.57429194", "0.56940943", "0.56790775", "0.5674697", "0.5671582", "0.5671582", "0.5671582", "0.5616953", "0.56122524", "0.56041926", "0.559358", "0.558242", "0.558242...
0.6535038
5
Returns whether the current locale is initialized.
def initialized?; end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def available_locales_initialized?; end", "def default_locale?\n I18n.default_locale == I18n.locale\n end", "def default_locale?\n I18n.default_locale == I18n.locale\n end", "def locale_available?(locale); end", "def initialized?\n !!@initialized\n end", "def initialized?\n ...
[ "0.75861937", "0.7351446", "0.7344053", "0.7281233", "0.72687453", "0.7245525", "0.7242455", "0.7238693", "0.7238693", "0.6974474", "0.68707436", "0.6794784", "0.67677003", "0.6748638", "0.67189324", "0.6680789", "0.66416013", "0.6630796", "0.6629202", "0.6629202", "0.6628812...
0.56124884
64
Clean up translations and uninitialize all locales. source://i18n//lib/i18n/backend/lazy_loadable.rb80
def reload!; end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reload!\n @initialized = false\n @translations = nil\n super\n end", "def clear_available_locales_set; end", "def clear_translations!\r\n @translation_caches = {}\r\n @stop_merging_translated_attributes = nil\r\n end", "def reset_i18n()\n I18n.backend = I18...
[ "0.6890106", "0.6849679", "0.6837956", "0.6833947", "0.6544167", "0.65328145", "0.639525", "0.6362533", "0.6293889", "0.62539196", "0.62218136", "0.61651367", "0.60983944", "0.60973525", "0.6094566", "0.60881585", "0.60881585", "0.60396343", "0.6032227", "0.6020931", "0.58921...
0.0
-1
Load translations from files that belong to the current locale.
def init_translations; 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.8110398", "0.8110398", "0.8002204", "0.7828437", "0.7494513", "0.7494513", "0.7382705", "0.7329905", "0.725488", "0.7182078", "0.7167792", "0.71451235", "0.71451235", "0.6969895", "0.6852915", "0.6847574", "0.6830502", "0.68037724", "0.6780127", "0.6670729", "0.66265965", ...
0.57182807
59
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
Select all files from I18n load path that belong to current locale. These files must start with the locale identifier (ie. "en", "ptBR"), followed by an "_" demarcation to separate proceeding text. source://i18n//lib/i18n/backend/lazy_loadable.rb167
def filenames_for_current_locale; end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def locale_files\n Dir[File.join(File.dirname(__FILE__), \"polish\", \"locale\", \"**/*\")]\n end", "def locale_files\n Dir[File.join(File.dirname(__FILE__), \"polish\", \"locale\", \"**/*\")]\n end", "def ui_localization_files\n loc_files = Dir[File.join(RAILS_ROOT, 'lang/ui/', '*.{yml,ya...
[ "0.70203483", "0.70203483", "0.6718164", "0.666479", "0.6584111", "0.65177417", "0.6438265", "0.6398446", "0.6338702", "0.62744534", "0.62744534", "0.62686056", "0.6265694", "0.6247467", "0.62008595", "0.6171809", "0.6162883", "0.6128528", "0.61251605", "0.6105777", "0.609243...
0.6213842
14
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
Normalizes categories of 0.0 and 1.0 and returns the symbolic version source://i18n//lib/i18n/backend/pluralization.rb89
def symbolic_count(count); end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def simple_pluralize count, singular, plural=nil\n ((count == 1 || count =~ /^1(\\.0+)?$/) ? singular : (plural || singular.pluralize))\n end", "def default_pluralizer(count)\n count == 1 ? :one : :other\n end", "def make_plural\n\t\tsentence_array=Array.new\n\t\tnew_sentence_array=Array.ne...
[ "0.68241817", "0.6746467", "0.64894277", "0.64882284", "0.64794225", "0.64554673", "0.63860613", "0.6365204", "0.6301192", "0.629816", "0.6266324", "0.6265869", "0.6261882", "0.6247847", "0.62098503", "0.6201506", "0.6188937", "0.6185592", "0.6183827", "0.6183827", "0.612485"...
0.0
-1
Get available locales from the translations hash source://i18n//lib/i18n/backend/simple.rb49
def available_locales; end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def available_locales\n init_translations unless initialized?\n translations.inject([]) do |locales, (locale, data)|\n locales << locale unless (data.keys - [:i18n]).empty?\n locales\n end\n end", "def available_locales\n resource.translations.all(...
[ "0.7795505", "0.7594396", "0.7231203", "0.7217417", "0.7215168", "0.72047263", "0.71941084", "0.7124471", "0.711734", "0.70609784", "0.7049899", "0.7041021", "0.7019433", "0.6969116", "0.69545597", "0.6909755", "0.6909755", "0.6902939", "0.68827", "0.68690604", "0.68629074", ...
0.6868777
21
Clean up translations hash and set initialized to false on reload! source://i18n//lib/i18n/backend/simple.rb58
def reload!; end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reload!\n @initialized = false\n @translations = nil\n super\n end", "def reset_i18n()\n I18n.backend = I18n::Backend::Simple.new\nend", "def init_translations; end", "def clear_translations!\r\n @translation_caches = {}\r\n @stop_merging_translated_attributes...
[ "0.7954132", "0.70641816", "0.69595075", "0.6919442", "0.6725708", "0.66081476", "0.646304", "0.6453719", "0.6423782", "0.6372822", "0.62522215", "0.61921304", "0.61864215", "0.61251813", "0.61063397", "0.602579", "0.602579", "0.6025587", "0.59504515", "0.59426296", "0.590936...
0.0
-1
Stores translations for the given locale in memory. This uses a deep merge for the translations hash, so existing translations will be overwritten by new ones only at the deepest level of the hash. source://i18n//lib/i18n/backend/simple.rb36
def store_translations(locale, data, options = T.unsafe(nil)); end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def store_translations(locale, data, options = {})\n locale = locale.to_sym\n translations[locale] ||= {}\n data = data.deep_symbolize_keys\n translations[locale].deep_merge!(data)\n end", "def store_translations(locale, data)\n flatten_data(locale => data).each do |...
[ "0.8079555", "0.7767193", "0.7732029", "0.7404124", "0.7088", "0.70876396", "0.70876396", "0.69401413", "0.69018346", "0.6747246", "0.665445", "0.64230585", "0.6250312", "0.6158846", "0.61491776", "0.6114319", "0.6084317", "0.6078684", "0.6046479", "0.5980826", "0.5876105", ...
0.7078084
7
Looks up a translation from the translations hash. Returns nil if either key is nil, or locale, scope or key do not exist as a key in the nested translations hash. Splits keys or scopes containing dots into multiple keys, i.e. currency.format is regarded the same as %w(currency format). source://i18n//lib/i18n/backend/...
def lookup(locale, key, scope = T.unsafe(nil), options = T.unsafe(nil)); end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def lookup(locale, key, scope = [], options = {})\n key = normalize_flat_keys(locale, key, scope, options[:separator])\n\n return if translations.missing?(locale, key)\n\n result = translations.lookup(locale, key, options)\n translations.missing(locale, key, options) if result.nil?\n\n ...
[ "0.76751006", "0.707611", "0.67588884", "0.66506654", "0.6601622", "0.64001673", "0.63686395", "0.6267941", "0.6219027", "0.6099977", "0.60696435", "0.60575545", "0.5892969", "0.5819957", "0.58131915", "0.5810905", "0.58023244", "0.5532237", "0.5487296", "0.5477236", "0.53488...
0.5802403
16
Add transliteration rules to the approximations hash. source://i18n//lib/i18n/backend/transliterator.rb100
def add(hash); end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def lex_en_interp_words; end", "def lex_en_interp_words; end", "def lex_en_interp_words; end", "def customize_fr_dictionary(dict)\n dict.add('Alert')\n dict.add('ltr')\n dict.add('org')\n dict.add('Other')\n dict.add('Sara')\n dict.add('saraalert')\n end", "def translate(text,dictonary)\...
[ "0.5835699", "0.5835699", "0.5835699", "0.575385", "0.57177186", "0.57145286", "0.56272817", "0.56239116", "0.557654", "0.5574478", "0.5574478", "0.5574478", "0.5573385", "0.5447518", "0.539471", "0.5385845", "0.5378572", "0.53784126", "0.5372482", "0.5355296", "0.5355296", ...
0.0
-1
Gets I18n configuration object. source://i18n//lib/i18n.rb56
def config; end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_locale\n I18n.locale = session[:i18n] || I18n.default_locale || :en\n end", "def load_i18n\n res = YAML.load_file(File.join(File.dirname(__FILE__), 'ie6nomore.i18n.yml'))\n end", "def use_i18n; end", "def configure_i18n\n I18n.load_path += Dir[self.class.root_pathname.join('con...
[ "0.63729435", "0.62221944", "0.6167822", "0.59829676", "0.5938354", "0.5818081", "0.5735795", "0.5706033", "0.5695791", "0.5681474", "0.5661287", "0.5645338", "0.56435734", "0.56435734", "0.56031936", "0.5598879", "0.5597194", "0.5586421", "0.55640906", "0.55640906", "0.55533...
0.0
-1
Sets I18n configuration object. source://i18n//lib/i18n.rb61
def config=(value); end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def use_i18n=(value); end", "def configure_i18n\n I18n.load_path += Dir[self.class.root_pathname.join('config', 'locales', '*.{rb,yml}')]\n end", "def set_locale\n I18n.locale = Rails.configuration.oyambre.languages.first\n end", "def initialize\n self.namespace = \"i18n_languag...
[ "0.6981374", "0.65649277", "0.65131193", "0.6511873", "0.6372405", "0.6367812", "0.6367812", "0.6366951", "0.6360399", "0.63399667", "0.63041973", "0.6289104", "0.6288381", "0.62868583", "0.6217682", "0.61952424", "0.61271507", "0.607679", "0.60690695", "0.60079885", "0.59980...
0.0
-1
Tells the backend to load translations now. Used in situations like the Rails production environment. Backends can implement whatever strategy is useful. source://i18n//lib/i18n.rb90
def eager_load!; end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def translations\n raise \"i18n has no load_path(s)\" if ::I18n.load_path.empty?\n ::I18n.backend.instance_eval do\n init_translations unless initialized?\n translations\n end\n end", "def translations\n ::I18n.backend.instance_eval do\n init_translations unless initialize...
[ "0.7476398", "0.738462", "0.72456765", "0.7151758", "0.7151758", "0.7107111", "0.70435876", "0.6864971", "0.68643826", "0.67471796", "0.6738159", "0.65648824", "0.65023535", "0.6496432", "0.6455962", "0.6387617", "0.63376004", "0.6294993", "0.6273274", "0.6262533", "0.6224913...
0.0
-1
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
Returns true if a translation exists for a given key, otherwise returns false.
def exists?(key, _locale = T.unsafe(nil), locale: T.unsafe(nil), **options); end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def key_exist?(key)\n FastGettext.key_exist?(key)\n rescue Errno::ENOENT => error\n Yast.y2warning(\"File not found when translating '#{key}' on textdomain #{@my_textdomain}'. \"\\\n \"Error: #{error}. Backtrace: #{error.backtrace}\")\n false\n end", "def one_translation_per_lang_per_...
[ "0.7618886", "0.72968954", "0.72556454", "0.7175665", "0.7140171", "0.7086438", "0.70421803", "0.7025646", "0.70164347", "0.70164347", "0.699866", "0.6966423", "0.69571394", "0.69490457", "0.6946193", "0.6940823", "0.6920112", "0.691393", "0.691393", "0.6891443", "0.68899125"...
0.6431996
69
Localizes certain objects, such as dates and numbers to local formatting.
def l(object, locale: T.unsafe(nil), format: T.unsafe(nil), **options); end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def localize(object, **options); end", "def localize(object, **options); end", "def localize(object, locale: T.unsafe(nil), format: T.unsafe(nil), **options); end", "def localize(object, **options)\n I18n.localize(object, **options)\n end", "def localize(*args)\n I18n.localize(*args)\n ...
[ "0.7576494", "0.7576494", "0.7558256", "0.7387076", "0.7198532", "0.7198532", "0.7198532", "0.7197788", "0.7187726", "0.7187726", "0.7186084", "0.7020376", "0.6825264", "0.6587345", "0.65222496", "0.6291261", "0.62178284", "0.6076371", "0.60617816", "0.59505117", "0.59505117"...
0.5809348
31
Returns true when the passed locale, which can be either a String or a Symbol, is in the list of available locales. Returns false otherwise.
def locale_available?(locale); end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def has_locale? locale\n locales.include?(locale.to_sym)\n end", "def has_available_locale? locale\n available_locales.include?(locale.to_sym)\n end", "def check_availability(locale)\n if ['en', 'es'].include? locale.to_s\n locale\n else\n false\n end\n end", "def valid_lo...
[ "0.80649173", "0.7921756", "0.78618103", "0.7635542", "0.7378551", "0.73482186", "0.73356074", "0.7039958", "0.7039958", "0.67875314", "0.63923645", "0.6376659", "0.63715035", "0.631821", "0.6147968", "0.6133758", "0.6127884", "0.6125635", "0.60624176", "0.60459256", "0.59774...
0.77475053
3
Localizes certain objects, such as dates and numbers to local formatting.
def localize(object, locale: T.unsafe(nil), format: T.unsafe(nil), **options); end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def localize(object, **options); end", "def localize(object, **options); end", "def localize(object, **options)\n I18n.localize(object, **options)\n end", "def localize(*args)\n I18n.localize(*args)\n end", "def localize(*args)\n I18n.localize(*args)\n end", "def local...
[ "0.75768316", "0.75768316", "0.7388077", "0.7198687", "0.7198687", "0.7198687", "0.71979046", "0.7187928", "0.7187928", "0.7186119", "0.7021551", "0.68252957", "0.6588167", "0.65228957", "0.62908906", "0.62176716", "0.60762066", "0.60624653", "0.59500843", "0.59500843", "0.59...
0.7558665
2
Merges the given locale, key and scope into a single array of keys. Splits keys that contain dots into multiple keys. Makes sure all keys are Symbols. source://i18n//lib/i18n.rb332
def normalize_keys(locale, key, scope, separator = T.unsafe(nil)); end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def normalize_keys(locale, key, scope, separator = nil)\n keys = [locale] + Array(scope) + Array(key)\n keys = keys.map {|k| I18n.translation_key_escaped?(k) ? I18n.unescape_translation_key(k) : k.to_s.split(separator || I18n.default_separator)}\n keys = (keys.flatten - ['']).reject {|k| !k}\n ...
[ "0.7766871", "0.72663033", "0.72663033", "0.7161529", "0.6404735", "0.6251713", "0.6175191", "0.5956065", "0.5935087", "0.56829524", "0.5657044", "0.55625105", "0.5553841", "0.55200654", "0.5452371", "0.5416747", "0.539464", "0.5330687", "0.53244793", "0.53172946", "0.5278677...
0.7111197
4
Tells the backend to reload translations. Used in situations like the Rails development environment. Backends can implement whatever strategy is useful. source://i18n//lib/i18n.rb82
def reload!; end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def translations\n ::I18n.backend.instance_eval do\n init_translations unless initialized?\n translations\n end\n end", "def use_i18n; end", "def translations\n raise \"i18n has no load_path(s)\" if ::I18n.load_path.empty?\n ::I18n.backend.instance_eval do\n...
[ "0.70088494", "0.68589634", "0.6840616", "0.68170846", "0.6731393", "0.6637949", "0.6619912", "0.65739566", "0.65739566", "0.6521624", "0.6493551", "0.6387629", "0.634272", "0.63236946", "0.6250576", "0.62379646", "0.6229648", "0.6199509", "0.6189279", "0.61372334", "0.607366...
0.0
-1
Wrapper for translate that adds :raise => true. With this option, if no translation is found, it will raise I18n::MissingTranslationData source://i18n//lib/i18n.rb229
def t!(key, **options); end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def translate(key, **options)\n I18n.t key, **options.merge(scope: :quo_vadis, raise: true) rescue nil\n end", "def t(key, options = {})\n options[:raise] = true\n translate(key, options)\n end", "def translate(key, options = {})\n options = options.dup\n if options.has_key?(:defau...
[ "0.66068226", "0.6571936", "0.6490723", "0.61729616", "0.60273767", "0.5949705", "0.5937595", "0.59009826", "0.589076", "0.5889784", "0.5804128", "0.57450473", "0.57219005", "0.57057226", "0.5641733", "0.55808485", "0.55714333", "0.5516033", "0.5516033", "0.55033755", "0.5482...
0.0
-1
Wrapper for translate that adds :raise => true. With this option, if no translation is found, it will raise I18n::MissingTranslationData source://i18n//lib/i18n.rb229
def translate!(key, **options); end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def translate(key, **options)\n I18n.t key, **options.merge(scope: :quo_vadis, raise: true) rescue nil\n end", "def t(key, options = {})\n options[:raise] = true\n translate(key, options)\n end", "def translate(key, options = {})\n options = options.dup\n if options.has_key?(:defau...
[ "0.66070175", "0.65727067", "0.6490433", "0.6172325", "0.6025658", "0.5947924", "0.5936465", "0.5898825", "0.58887774", "0.5802334", "0.5742642", "0.5720782", "0.57044584", "0.5639981", "0.5580546", "0.557122", "0.5514886", "0.5514886", "0.55027807", "0.54809695", "0.54789954...
0.5888501
9
Executes block with given I18n.locale set. source://i18n//lib/i18n.rb315
def with_locale(tmp_locale = T.unsafe(nil)); end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __with_locale__(locale, &block)\n yield\n end", "def i18n_set_locale(locale, &blk)\n locale = ::R18n::I18n.default.to_s if locale.nil?\n \n i18n = ::R18n::I18n.new(\n locale, \n ::R18n.default_places, \n off_filters: :untranslated, \n ...
[ "0.79622006", "0.7961856", "0.7892074", "0.7621341", "0.7596587", "0.75914526", "0.7283137", "0.71972877", "0.7119325", "0.7088867", "0.7074945", "0.7056728", "0.6884442", "0.6812741", "0.6811464", "0.67295754", "0.6712164", "0.67107445", "0.66648245", "0.6662093", "0.6662093...
0.0
-1
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