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 |
|---|---|---|---|---|---|---|
get medium sized event (event id, user id who's profile current user is on) | def getEventMd(e, u)
@cuid = isSignedIn ? current_user.id : nil
@e = Event.find_by(id: e)
@html = '<a href="/events/' + @e.id.to_s + '">' +
'<div class="col-xs-12 col-md-6">' +
'<div class="event-md">' +
'<p class="image">'
@html += @e.avatar.attached?... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def find_user_event(event)\n users_events.where(event_id: event.id).first\n end",
"def user\n metadata&.dig('event', 'user')\n end",
"def event\n @event ||= Event.from_hash(session.post('facebook.events.get', :eids => [eid]).first)\n end",
"def view_event(user, event) \n\tend",
"def get... | [
"0.7158817",
"0.6353213",
"0.60736626",
"0.6035974",
"0.60078704",
"0.59819037",
"0.5976519",
"0.5974271",
"0.5943757",
"0.5861234",
"0.58539927",
"0.58484143",
"0.58309335",
"0.5797496",
"0.5776442",
"0.5767535",
"0.5763241",
"0.5730675",
"0.5705953",
"0.56751955",
"0.567397... | 0.5932303 | 9 |
get large main event (event id) | def getEventL(e)
@cuid = isSignedIn ? current_user.id : nil
@e = Event.find_by(id: e)
@b1 = isadmin
@b2 = @b1 || (@cuid == @e.user_id)
@html = eventEnded(e) ? '<p class="summary">This event has ended.<br>Average Rating: ' + getAvgStarRating(e) + '</p>' : ""
@html... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def current_event_id\n return @data[@index][:id]\n end",
"def event_data(event_id)\n @map.events[event_id]\n end",
"def id\n self.event['id'].to_i\n end",
"def max_event_id; $game_map.max_id; end",
"def generateEventID\n Random.rand(10000)\n end",
"def get_event_id\n ... | [
"0.6718199",
"0.66696745",
"0.6546894",
"0.6490052",
"0.64622587",
"0.6415307",
"0.6369481",
"0.6261661",
"0.61968803",
"0.61745626",
"0.61274874",
"0.6126025",
"0.6125404",
"0.60579437",
"0.6043293",
"0.6022551",
"0.5981844",
"0.5965993",
"0.5957826",
"0.59577733",
"0.59315"... | 0.0 | -1 |
search events for word | def searchEvents(word)
@w = word.downcase()
@ufEvents = Event.all
@es = []
@ufEvents.each do |e|
if e.name.to_s.downcase().include?(@w) ||
e.description.to_s.downcase().include?(@w) ||
e.street.to_s.downcase().include?(@w) ||
e.... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def search(word)\n \n end",
"def match_event(query); end",
"def search(word)\r\n \r\n end",
"def search(event)\n self.class.runtime += event.duration\n return unless logger.debug?\n\n payload = event.payload\n name = \"#{payload[:klass]} #{payload[:n... | [
"0.7222943",
"0.7169262",
"0.70236367",
"0.6595644",
"0.6548998",
"0.64325553",
"0.61798084",
"0.6141781",
"0.6108465",
"0.6108465",
"0.6103692",
"0.60822713",
"0.6069361",
"0.60584736",
"0.5980915",
"0.59419",
"0.5940527",
"0.5926139",
"0.59198505",
"0.59033865",
"0.588642",... | 0.7783192 | 0 |
get distance between two points of lat, lng in km (user lat, user lng, event lat, event lng) | def distanceBetween(uLat, uLng, eLat, eLng)
@R = 6371
@c1 = uLat * Math::PI/180
@c2 = eLat * Math::PI/180
@dLat = (eLat - uLat) * Math::PI/180
@dLng = (eLng - uLng) * Math::PI/180
@a = Math.sin(@dLat/2) * Math.sin(@dLat/2) +
Math.cos(@c1) * Math.cos(@... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def distance(p1, p2)\n dx = ED * (p1['lat']-p2['lat'])\n dy = ED * Math::cos(Math::PI*p1['lat']/180)*(p1['lon']-p2['lon'])\n return (dx**2 + dy**2)**0.5\nend",
"def distanceBetweenTwoPointsLatAndLongInKM(lat1, long1, lat2, long2)\n earthRadius = 6371; # Earth's mean radius in KM\n latitudeChange = (lat2... | [
"0.7595482",
"0.75709164",
"0.75613195",
"0.75041854",
"0.75032175",
"0.7429025",
"0.7412327",
"0.73447454",
"0.73189497",
"0.73189497",
"0.7311318",
"0.72955024",
"0.72893435",
"0.72827613",
"0.72193253",
"0.72173625",
"0.72042036",
"0.71665967",
"0.71604395",
"0.71575665",
... | 0.719245 | 17 |
distance from user to event (user id, event id) | def userDist(u, e)
@u = User.find_by(id: u)
@e = Event.find_by(id: e)
return distanceBetween(@u.lat, @u.lng, @e.lat, @e.lng)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def display_event_distance\n x = self.event_id\n y = Event.find_by_id(x)\n return y.distance\n end",
"def dist_user(a, b)\n earth_R = 6371e3 #The earth radius, im meters!\n φ1 = (a[\"latitude\"]).to_f * Math::PI / 180\n φ2 = (b[\"coords\"][\"latitude\"]).to_f * Math::PI / 180\n ... | [
"0.7433423",
"0.63239604",
"0.6223802",
"0.6172682",
"0.5934219",
"0.5909352",
"0.5896524",
"0.5874881",
"0.58259946",
"0.57854867",
"0.57562554",
"0.57152283",
"0.5702475",
"0.5700154",
"0.56935644",
"0.5689806",
"0.568617",
"0.56704974",
"0.5669259",
"0.5668425",
"0.5659248... | 0.82096016 | 0 |
get nearby events (distance in km) | def nearbyEvents(dist)
@es = []
@ufEvents = Event.all
@ufEvents.each do |e|
if coordsSet(current_user.id, "u") && coordsSet(e.id, "e")
if userDist(current_user.id, e) <= dist.to_i
@es.push(e)
end
#if addrSet(current_user... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def nearby_metros(miles=400)\n return nil unless self.lat and self.lng\n puts \"within 30 miles of #{self.lat}/#{self.lng}\"\n Metro.find(:all, :origin => [self.lat,self.lng],:within=>miles,:order=>'distance')\n end",
"def near_to(p)\n\t\treturn around(p).sort_by{|e| e.distance_sq_to(p)}\n\tend",
"d... | [
"0.6501512",
"0.6447499",
"0.63889575",
"0.63276434",
"0.6274733",
"0.62546897",
"0.617484",
"0.6132561",
"0.60956883",
"0.604308",
"0.6042226",
"0.59955627",
"0.5985305",
"0.59490496",
"0.59490496",
"0.58868885",
"0.58816975",
"0.5876659",
"0.5863587",
"0.5858753",
"0.585732... | 0.7485949 | 0 |
GET /mylists/1 GET /mylists/1.xml | def show
@mylist = Mylist.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.xml { render :xml => @mylist }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_list(list_id)\n rest(\"get\", \"lists/#{list_id}\")\n end",
"def index\n @list = List.find(params[:list_id])\n @list_items = @list.list_items.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @list_items }\n end\n end",
"def i... | [
"0.72040725",
"0.71212673",
"0.70334023",
"0.6846774",
"0.66344804",
"0.65973586",
"0.6556166",
"0.6502176",
"0.6501529",
"0.6473892",
"0.6425134",
"0.6381616",
"0.6380361",
"0.63701814",
"0.6336718",
"0.63107234",
"0.6272196",
"0.6236656",
"0.62121415",
"0.621094",
"0.619834... | 0.67066324 | 4 |
GET /mylists/new GET /mylists/new.xml | def new
@mylist = Mylist.new
respond_to do |format|
format.html # new.html.erb
format.xml { render :xml => @mylist }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n\t\t@list = List.new\n\n\t\trespond_to do |format|\n\t\t\tformat.html # new.html.erb\n\t\t\tformat.xml\t{ render :xml => @list }\n\t\tend\n\tend",
"def new\n @thing_list = ThingList.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @thing_list }\n... | [
"0.70292425",
"0.6924246",
"0.6770573",
"0.67642885",
"0.67599154",
"0.6734779",
"0.6702841",
"0.66889423",
"0.6682593",
"0.6653151",
"0.6651824",
"0.6651824",
"0.6651824",
"0.6640963",
"0.6619525",
"0.66166884",
"0.65985614",
"0.659291",
"0.65838724",
"0.65832096",
"0.657066... | 0.7344123 | 0 |
POST /mylists POST /mylists.xml | def create
@mylist = Mylist.new(params[:mylist])
respond_to do |format|
if @mylist.save
format.html { redirect_to(@mylist, :notice => 'Mylist was successfully created.') }
format.xml { render :xml => @mylist, :status => :created, :location => @mylist }
else
format.html { re... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_list(name)\n data = {\n list: {\n name: name\n }\n }\n rest(\"post\", \"lists\", data)\n end",
"def create_list(params={})\n @obj.post('create-list', @auth.merge(params))\n end",
"def create_list(name)\n path = \"lists\"\n params = { list: { name: name }}\n ... | [
"0.6962332",
"0.688225",
"0.67873013",
"0.6533834",
"0.6485284",
"0.639647",
"0.6371025",
"0.6304802",
"0.6302288",
"0.6298249",
"0.6293628",
"0.61632633",
"0.6146267",
"0.6129664",
"0.61255646",
"0.6093621",
"0.60840374",
"0.6074523",
"0.6074523",
"0.6068069",
"0.60526824",
... | 0.68574125 | 2 |
PUT /mylists/1 PUT /mylists/1.xml | def update
@mylist = Mylist.find(params[:id])
respond_to do |format|
if @mylist.update_attributes(params[:mylist])
format.html { redirect_to(@mylist, :notice => 'Mylist was successfully updated.') }
format.xml { head :ok }
else
format.html { render :action => "edit" }
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_list(list_id, name)\n data = {\n list: {\n name: name\n }\n }\n rest(\"patch\", \"lists/#{list_id}\", data)\n end",
"def update_list(id, list)\n record \"/todos/update_list/#{id}\", :list => list\n end",
"def update\n @list = current_user.lists.find(params[:id])\n ... | [
"0.7157859",
"0.7056906",
"0.6871232",
"0.66377753",
"0.6493983",
"0.6420745",
"0.6357143",
"0.63494056",
"0.634375",
"0.62953174",
"0.62883097",
"0.62883097",
"0.6279634",
"0.62494326",
"0.6231228",
"0.6178253",
"0.61675745",
"0.6157332",
"0.6156681",
"0.6150616",
"0.6126777... | 0.66952884 | 3 |
DELETE /mylists/1 DELETE /mylists/1.xml | def destroy
@mylist = Mylist.find(params[:id])
@mylist.destroy
respond_to do |format|
format.html { redirect_to(mylists_url) }
format.xml { head :ok }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete_list(list_id)\n rest(\"delete\", \"lists/#{list_id}\")\n\n return true\n end",
"def delete(list_id)\n Iterable.request(conf, \"/lists/#{list_id}\").delete\n end",
"def delete_list(user, list)\n delete(\"/#{user}/lists/#{list}.json\")\n end",
"def delete_list(id)\n query(\... | [
"0.7341387",
"0.71832883",
"0.7161345",
"0.690263",
"0.686192",
"0.6661128",
"0.6655903",
"0.6650257",
"0.66208446",
"0.66187537",
"0.6610393",
"0.6608872",
"0.6591712",
"0.6591712",
"0.6591712",
"0.6576415",
"0.6568028",
"0.65569293",
"0.65537584",
"0.65537584",
"0.65537584"... | 0.73169047 | 1 |
Checks whether a password is needed or not. For validations only. Passwords are always required if it's a new record, or if the password or confirmation are being set somewhere. | def password_required?
signing && (!persisted? || !password.nil? || !password_confirmation.nil?)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def password_required?\n @password_required\n end",
"def password_required?\n self.crypted_password.blank? || !self.password.blank?\n end",
"def password_required?\n crypted_password.blank? || !password.blank?\n end",
"def password_required?\n return false if new_record?\n retur... | [
"0.8490695",
"0.8452125",
"0.84224594",
"0.8366064",
"0.83115566",
"0.830653",
"0.8303484",
"0.8282777",
"0.8282777",
"0.8279725",
"0.8269906",
"0.8269906",
"0.8252542",
"0.8245313",
"0.82383794",
"0.82270837",
"0.82270837",
"0.82265055",
"0.82150817",
"0.8213109",
"0.8213109... | 0.79700667 | 63 |
================================= Instance Methods ================================= | def update_without_password(params, *options)
params.delete(:current_password)
super(params)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def private; end",
"def initialize\n \n end",
"def initialize\r\n\r\n end",
"def initialize\n\t\t\n\tend",
"def initialize\n\n end",
"def initialize\n\n end",
"def implementation; end",
"def implementation; end",
"def initialize\n end",
"def initialize\n end",
"def initialize\n ... | [
"0.8399549",
"0.74597514",
"0.74053514",
"0.7403467",
"0.7381441",
"0.7381441",
"0.7312087",
"0.7312087",
"0.7269607",
"0.7269607",
"0.7269607",
"0.7269607",
"0.7269607",
"0.7269607",
"0.7269607",
"0.7269607",
"0.7269607",
"0.7269607",
"0.72584826",
"0.7201168",
"0.71846515",... | 0.0 | -1 |
this function returns the member object from a flash team based on a teamId, taskId and memberId | def getMemberById(teamId, taskId, memId)
flash_team = FlashTeam.find(teamId)
# Extract data from the JSON
flash_team_status = JSON.parse(flash_team.status)
flash_team_event = flash_team_status['flash_teams_json']['events'][taskId]
team_members = flash_team_status['flash_teams_json']['members']
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def retrieve_team_member(team_member_id:)\n new_api_call_builder\n .request(new_request_builder(HttpMethodEnum::GET,\n '/v2/team-members/{team_member_id}',\n 'default')\n .template_param(new_parameter(team_member_... | [
"0.6758673",
"0.65804154",
"0.6437838",
"0.63650167",
"0.63455415",
"0.6338006",
"0.6215233",
"0.6172236",
"0.6143372",
"0.6137813",
"0.61233133",
"0.61204714",
"0.6036456",
"0.60167164",
"0.6004606",
"0.5998888",
"0.5998888",
"0.5998888",
"0.5953097",
"0.5899303",
"0.5891908... | 0.8254558 | 0 |
Gets the API request URL with the search parameters | def api_request_url(object)
api_uri = 'http://timezonedb.wellfounded.ca/api/v1'
api_request_url = "#{api_uri}/timezones?"
api_request_url << get_filters(object).join('&')
log "Making request to #{api_request_url} for timezone."
api_request_url
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def search_url(*args)\n options = args.extract_options!.stringify_keys!\n protocol = (options.delete('protocol') || self.protocol).to_s\n \n uri = search_uri\n uri.scheme = protocol\n uri.query = [\"key=#{api_key}\", \"q=#{URI.escape(args.join(','))}\", *options.map{ |k,v| \"#{k}=#{v}... | [
"0.7750059",
"0.77009296",
"0.76314026",
"0.76314026",
"0.75477916",
"0.75243515",
"0.74424005",
"0.7331728",
"0.72406995",
"0.7230254",
"0.7228493",
"0.7225282",
"0.7187127",
"0.71574116",
"0.7102491",
"0.7064375",
"0.6924787",
"0.69034505",
"0.6859676",
"0.6843424",
"0.6824... | 0.0 | -1 |
Gets the API request filter parts | def get_filters(object)
if @options[:using].is_a?(Array)
gen_array_attribute_filters(object, @options[:using])
else
gen_map_attribute_filters(object, @options[:using])
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def filter_parameters\n if @filter_parameters\n @filter_parameters || []\n else\n defined?(Rails) && Rails.application.config.filter_parameters\n end\n end",
"def filters\n end",
"def filter_parameters; end",
"def filter_parameters; end",
"def filters; end",
"def filter... | [
"0.6196496",
"0.6172723",
"0.6157198",
"0.6157198",
"0.6145454",
"0.6145454",
"0.6145383",
"0.6102213",
"0.60277003",
"0.6003891",
"0.59599555",
"0.59073335",
"0.59028584",
"0.5894818",
"0.5886816",
"0.5884791",
"0.5884791",
"0.5870658",
"0.5867008",
"0.5864758",
"0.58389115"... | 0.0 | -1 |
Gets the API request URL with the search parameters | def gen_array_attribute_filters(object, attributes)
attributes.map { |filter_name| gen_object_filter(object, filter_name, filter_name) }
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def search_url(*args)\n options = args.extract_options!.stringify_keys!\n protocol = (options.delete('protocol') || self.protocol).to_s\n \n uri = search_uri\n uri.scheme = protocol\n uri.query = [\"key=#{api_key}\", \"q=#{URI.escape(args.join(','))}\", *options.map{ |k,v| \"#{k}=#{v}... | [
"0.7750059",
"0.77009296",
"0.76314026",
"0.76314026",
"0.75477916",
"0.75243515",
"0.74424005",
"0.7331728",
"0.72406995",
"0.7230254",
"0.7228493",
"0.7225282",
"0.7187127",
"0.71574116",
"0.7102491",
"0.7064375",
"0.6924787",
"0.69034505",
"0.6859676",
"0.6843424",
"0.6824... | 0.0 | -1 |
Logs out as 'info' level using whatever logger the system is using | def log(msg)
@logger.info("UserTimezone::TimezoneDetector - #{msg}") if @options[:log]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def log_info(info_message)\n logger.info(info_message)\n end",
"def log_info(info_message)\n logger.info(info_message)\n end",
"def log_info(msg)\n logger ? logger.info(msg) : puts(msg)\n end",
"def info(msg); @logger.info(msg); end",
"def info(log)\n output.puts log if log_level <= ... | [
"0.79195863",
"0.79195863",
"0.7869169",
"0.78653747",
"0.7841109",
"0.7825049",
"0.77325636",
"0.77261066",
"0.7706695",
"0.7689946",
"0.766048",
"0.76142967",
"0.7526488",
"0.7516378",
"0.75148284",
"0.7499752",
"0.7453539",
"0.7397948",
"0.7379566",
"0.7379566",
"0.7358434... | 0.0 | -1 |
Log out an error using the system's logger. | def err(e)
@logger.error(e)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def log_error(msg)\n logger ? logger.error(msg) : $stderr.puts(msg)\n end",
"def error(msg); @logger.error(msg); end",
"def log_error(message)\n logger.error(message) if logger && logger.error?\n end",
"def error(msg)\n @logger.error(msg)\n end",
"def log_error(e = $!)\n (@logg... | [
"0.7568321",
"0.7548407",
"0.75458014",
"0.7426813",
"0.74027413",
"0.7393063",
"0.73745286",
"0.7199768",
"0.70707893",
"0.70435387",
"0.6992036",
"0.6981805",
"0.69694203",
"0.6955864",
"0.6945824",
"0.6942485",
"0.6902378",
"0.6851384",
"0.6845979",
"0.6839522",
"0.6790068... | 0.74002814 | 5 |
support_identity name, with volunteer designation if support response | def byline
parens = self.support_response? ? " (volunteer)" : ""
self.support_identity.name + parens
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def byline\n return \"ticket owner\" if self.show_generic?\n parens = self.support_response? ? \" (volunteer)\" : \"\"\n self.support_identity.name + parens\n end",
"def name_with_seat_incumbency_text(person_display_name, seat_incumbency_text)\n \"#{person_display_name} #{seat_incumbency_text}.\"\... | [
"0.74321854",
"0.59097946",
"0.5875079",
"0.5870932",
"0.58702517",
"0.5844025",
"0.5807327",
"0.57748437",
"0.56349677",
"0.5629438",
"0.56286734",
"0.5623449",
"0.5609138",
"0.56025183",
"0.5602493",
"0.5596325",
"0.5596325",
"0.5596325",
"0.5596325",
"0.5581139",
"0.557553... | 0.80183697 | 0 |
concise representation of all info except content | def info
date = self.updated_at.to_s(:short)
wrote = self.system_log? ? "" : " wrote"
private = self.private? ? " [private]" : ""
"[#{date}] #{self.byline}#{wrote}#{private}"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def stringify\n matter + excerpt + content\n end",
"def to_s\n \"[#{@type}]#{@content}\"\n end",
"def to_s\n content.to_s\n end",
"def to_s\n content\n end",
"def to_s\n content\n end",
"def to_s\n content.to_s\n end",
"def to_s\n pieces = []\n piec... | [
"0.64011973",
"0.61913097",
"0.6171218",
"0.598241",
"0.598241",
"0.59792614",
"0.59710485",
"0.5943612",
"0.59086955",
"0.59052634",
"0.5882928",
"0.5880206",
"0.5766292",
"0.5756758",
"0.5756758",
"0.5756758",
"0.574874",
"0.573959",
"0.5734386",
"0.5720196",
"0.56996906",
... | 0.0 | -1 |
GET /frames GET /frames.json | def index
@frames = Frame.all.where(:game_id => params[:game_id]).group_by(&:user_id)
@game_id = params[:game_id]
@game_turn = Game.find(@game_id).game_turn
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\r\n @frames = Frame.all\r\n\r\n respond_to do |format|\r\n format.html # index.html.erb\r\n format.json { render json: @frames }\r\n end\r\n end",
"def index\n @time_frames = TimeFrame.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { rend... | [
"0.7772678",
"0.72516",
"0.7158505",
"0.7158505",
"0.7158505",
"0.7158505",
"0.7029236",
"0.7029236",
"0.696004",
"0.6725629",
"0.63862574",
"0.62651855",
"0.6203388",
"0.6135733",
"0.6108031",
"0.6107241",
"0.5847398",
"0.5801659",
"0.5801659",
"0.57809466",
"0.5702045",
"... | 0.52549237 | 86 |
GET /frames/1 GET /frames/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\r\n @frames = Frame.all\r\n\r\n respond_to do |format|\r\n format.html # index.html.erb\r\n format.json { render json: @frames }\r\n end\r\n end",
"def show\n @frame = Frame.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { re... | [
"0.73865396",
"0.7315628",
"0.7315628",
"0.72622114",
"0.69779676",
"0.680213",
"0.680213",
"0.680213",
"0.680213",
"0.67649955",
"0.6345788",
"0.6193901",
"0.60525674",
"0.60428625",
"0.6030689",
"0.5863437",
"0.5846861",
"0.580915",
"0.56906015",
"0.5649849",
"0.5640713",
... | 0.0 | -1 |
POST /frames POST /frames.json requires game id for frames for that game | def create
@game_id = params[:game_id]
@players = User.where(:id => Game.find(@game_id).score_board.keys)
@frame = Frame.new(frame_params.merge!(game_id: @game_id))
respond_to do |format|
if @frame.save
format.html { redirect_to game_frames_url, notice: 'Frame was successfully created.' }
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\r\n @pad = Pad.find(:first, :conditions => [\"id=?\", params[:frame][:pad_id]])\r\n @frame = Frame.new\r\n @frame.name = params[:frame][:name]\r\n @frame.pad_id = params[:frame][:pad_id]\r\n @frame.descr = params[:frame][:descr]\r\n @frame.image = params[:frame][:image]\r\n respond_... | [
"0.65378785",
"0.6479914",
"0.64176553",
"0.6322742",
"0.6314639",
"0.6237494",
"0.61822",
"0.6117651",
"0.6014857",
"0.590016",
"0.58645695",
"0.58561057",
"0.5815516",
"0.57869047",
"0.5782682",
"0.5743653",
"0.57299155",
"0.57268775",
"0.5724718",
"0.57209575",
"0.571623",... | 0.73722655 | 0 |
Use callbacks to share common setup or constraints between actions. | def set_frame
@frame = Frame.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 frame_params
params.require(:frame).permit(:try1, :try2, :turn, :score, :user_id, :game_id)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def allow_params_authentication!; end",
"def allowed_params\n ALLOWED_PARAMS\n end",
"def default_param_whitelist\n [\"mode\"]\n... | [
"0.69792545",
"0.6781151",
"0.67419964",
"0.674013",
"0.6734356",
"0.6591046",
"0.6502396",
"0.6496313",
"0.6480641",
"0.6477825",
"0.64565",
"0.6438387",
"0.63791263",
"0.63740575",
"0.6364131",
"0.63192815",
"0.62991166",
"0.62978333",
"0.6292148",
"0.6290449",
"0.6290076",... | 0.0 | -1 |
TOO SLOW Times out | def divide(dividend, divisor)
negative_sign = (dividend < 0 && divisor >= 0) || (dividend >= 0 && divisor < 0)
remaining = dividend.abs
abs_divisor = divisor.abs
quotient = 0
while remaining >= abs_divisor
remaining -= abs_divisor
quotient += 1
end
negative_sign ? "-#{quotient.to_s}".to_i : quot... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def build_timing; end",
"def server_timing; end",
"def timer; end",
"def timer; end",
"def timer; end",
"def timer; end",
"def cstime=(*) end",
"def timeout; end",
"def timeout; end",
"def timeout; end",
"def throttles; end",
"def time; end",
"def time; end",
"def time; end",
"def time;... | [
"0.64147025",
"0.6389626",
"0.6252543",
"0.6252543",
"0.6252543",
"0.6252543",
"0.6238736",
"0.6105386",
"0.6105386",
"0.6105386",
"0.5922965",
"0.59088975",
"0.59088975",
"0.59088975",
"0.59088975",
"0.59088975",
"0.59088975",
"0.59088975",
"0.59088975",
"0.59088975",
"0.585... | 0.0 | -1 |
Multiply divisor by 2 using left shift until it doesn't go in any more. Add the multiplier to our quotient. Repeat dividend / divisor | def divide(dividend, divisor)
# new_dividend = dividend > 0 : -divident : dividend
# new_divisor = divisor > 0 : -divisor : divisor
new_dividend = dividend
new_divisor = divisor
quotient = 0
while new_dividend >= new_divisor
multiplier = 0
while (new_divisor << multiplier + 1) < new_dividend
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def divide(dividend, divisor)\n\n denom = divisor\n current = 0\n\n return 0 if denom > dividend\n return 1 if denom == dividend\n\n # 5 45\n while denom <= dividend do \n \tdenom += divisor\n \tcurrent += 1 \n end\n remainder = dividend - (denom - divisor)\n current\nend",
"def divmod(va... | [
"0.6389013",
"0.61868346",
"0.6084153",
"0.595254",
"0.5911586",
"0.5893576",
"0.5872545",
"0.584118",
"0.5771722",
"0.573919",
"0.57303274",
"0.56619114",
"0.5628106",
"0.5618854",
"0.5608424",
"0.56076264",
"0.55903",
"0.55903",
"0.558577",
"0.5582801",
"0.5581786",
"0.55... | 0.71537244 | 0 |
GET /variants/1 GET /variants/1.json | def show
@variant = Variant.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.json { render json: @variant }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @variants = Variant.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @variants }\n end\n end",
"def get_variant\n @product = Spree::Product.find_by :slug => params[:product_id]\n @variant = @product.find_variant_by_options(params[:id... | [
"0.7698987",
"0.7659386",
"0.71672744",
"0.7162939",
"0.714378",
"0.70946586",
"0.7022754",
"0.6837232",
"0.67905617",
"0.6689519",
"0.66659415",
"0.6644483",
"0.6565237",
"0.65603095",
"0.6478554",
"0.6359342",
"0.6211591",
"0.620342",
"0.6203163",
"0.61971295",
"0.6177925",... | 0.756742 | 3 |
GET /variants/new GET /variants/new.json | def new
@variant = Variant.new
@master_variant = Variant.find(params[:product_id])
@variant.prices = @master_variant.prices
@path = admin_product_variants_path(@master_variant)
@cancel_path = admin_product_variants_path(@master_variant)
respond_to do |format|
format.html # new.html.erb
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @variant = Variant.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @variant }\n end\n end",
"def new\n @sub_variant = SubVariant.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @sub_var... | [
"0.8039135",
"0.75358695",
"0.7199068",
"0.71013314",
"0.7032789",
"0.70125926",
"0.70104784",
"0.6887418",
"0.68714106",
"0.68091834",
"0.6788637",
"0.6771423",
"0.67477715",
"0.6747659",
"0.67459476",
"0.6744768",
"0.6744768",
"0.6744768",
"0.6683985",
"0.6626096",
"0.66216... | 0.7157831 | 3 |
POST /variants POST /variants.json | def create
@master_variant = Variant.find(params[:product_id])
params[:variant][:is_master] = false
params[:variant][:master_id] = @master_variant.id
params[:variant][:product] = @master_variant.product
@variant = Variant.new(params[:variant])
respond_to do |format|
if @variant.save
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @variant = @product.variants.new(params.require(:variant).permit!)\n @variant.price = params[:variant][:price]\n respond_to do |format|\n if @variant.save\n format.html { redirect_to admin_product_variants_url(@product), notice: 'Variant was successfully created.' }\n forma... | [
"0.7008151",
"0.69920534",
"0.6849896",
"0.6725554",
"0.6652456",
"0.6605582",
"0.6468086",
"0.6463546",
"0.6432997",
"0.6429803",
"0.64122856",
"0.64112705",
"0.63064384",
"0.62869364",
"0.6214496",
"0.6198307",
"0.6168048",
"0.61336213",
"0.61117804",
"0.608433",
"0.6051242... | 0.67275393 | 3 |
PUT /variants/1 PUT /variants/1.json | def update
@variant = Variant.find(params[:id])
respond_to do |format|
if @variant.update_attributes(params[:variant])
format.html { redirect_to admin_product_variants_path(@variant.master_id),
notice: 'Variant was successfully updated.' }
format.json { head :no_content }
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n respond_to do |format|\n if @variant.update(variant_params)\n format.html { redirect_to edit_admin_good_url(@variant.good, anchor: \"variants\"), notice: 'Variant was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'ed... | [
"0.69623905",
"0.6624575",
"0.65043414",
"0.6449337",
"0.6449337",
"0.6449337",
"0.6449337",
"0.6357102",
"0.63500136",
"0.626245",
"0.62265766",
"0.62029916",
"0.61973304",
"0.617579",
"0.6102145",
"0.60890913",
"0.6035807",
"0.5950867",
"0.5881909",
"0.5874598",
"0.5857736"... | 0.68151605 | 1 |
DELETE /variants/1 DELETE /variants/1.json | def destroy
@variant = Variant.find(params[:id])
@variant.destroy
respond_to do |format|
format.html { redirect_to admin_product_variants_url(@variant.master_id) }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @variant.destroy\n respond_to do |format|\n format.html { redirect_to edit_admin_good_url(@variant.good, anchor: \"variants\") }\n format.json { head :no_content }\n end\n end",
"def destroy\n @variant.destroy\n respond_to do |format|\n format.html { redirect_to admin... | [
"0.7788831",
"0.7449988",
"0.73520213",
"0.70726305",
"0.7024134",
"0.6997436",
"0.6960339",
"0.6932273",
"0.6852169",
"0.67922324",
"0.6787438",
"0.67235047",
"0.6717155",
"0.66262656",
"0.661933",
"0.6617433",
"0.65919",
"0.658308",
"0.65775794",
"0.65163875",
"0.6464705",
... | 0.7515366 | 1 |
Used to check if the project is already known. | def url
RepoURL.new(@repo[:html_url]).repo_url
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def has_project?(name)\n available_projects.has_key?(name)\n end",
"def project_exists?(name)\n projects.include?(name)\n end",
"def project?(p)\r\n projects.include?(p)\r\n end",
"def project?\n true\n end",
"def is_for_project?\n not self.project.n... | [
"0.7915486",
"0.78171676",
"0.72179323",
"0.7215405",
"0.7047818",
"0.7031217",
"0.69716096",
"0.69112366",
"0.68999296",
"0.68500584",
"0.67757964",
"0.67716277",
"0.66795903",
"0.6650568",
"0.6523869",
"0.65050334",
"0.6481487",
"0.64623445",
"0.6460473",
"0.64451545",
"0.6... | 0.0 | -1 |
The test suite calls this method directly to bypass the Listen gem for certain tests. | def on_change(modified, added, deleted)
# Modifications and additions are treated the same.
(modified + added).uniq.each do |path|
if file = Ichiban::ProjectFile.from_abs(path)
begin
@loader.change(file) # Tell the Loader that this file has changed
file.update
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def spoof()\n\t\tlisten()\n\n\t\tlisten()\n\tend",
"def listen\r\n end",
"def define_listening\n end",
"def listening?; end",
"def listen\n raise NotImplementedError.new(\"Implement listen() in your Invoker. \")\n end",
"def listen\n em_run do\n end\n end",
"def listen(p0) end"... | [
"0.72312087",
"0.6696147",
"0.66041493",
"0.6547509",
"0.6410477",
"0.6348928",
"0.6207661",
"0.6207661",
"0.6207661",
"0.6174469",
"0.6120414",
"0.6018043",
"0.5869698",
"0.57803345",
"0.5747145",
"0.5744269",
"0.5744269",
"0.5732857",
"0.5731306",
"0.5721582",
"0.570336",
... | 0.0 | -1 |
GET /goals GET /goals.json | def index
@goals = Goal.all
@goals_today = Goal.where("start_date between ? and ?",Date.today, DateTime.now.end_of_day ).order(:sort_order)
@goals_past = Goal.where("start_date < ? ",Date.today ).where.not(fixed: true).order(:sort_order)
@goals_next = Goal.where("start_date > ?",DateTime.now.end_of_day ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def goals\n get(\"/user/#{@user_id}/activities/goals/daily.json\")\n end",
"def goals\n get(\"/user/#{@user_id}/activities/goals/daily.json\")\n end",
"def index\n @goals = @user.goals\n \n render json: @goals\n end",
"def goals(*args)\n @client.get \"#{@path}/goa... | [
"0.826191",
"0.8260275",
"0.8180174",
"0.80670863",
"0.7758634",
"0.7750546",
"0.77415055",
"0.7585685",
"0.7510723",
"0.7510723",
"0.7510723",
"0.7510723",
"0.7423019",
"0.73233336",
"0.7302528",
"0.72730386",
"0.72055686",
"0.7153684",
"0.71175015",
"0.71036863",
"0.7049537... | 0.0 | -1 |
GET /goals/1 GET /goals/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @goals = @user.goals\n \n render json: @goals\n end",
"def goals\n get(\"/user/#{@user_id}/activities/goals/daily.json\")\n end",
"def goals\n get(\"/user/#{@user_id}/activities/goals/daily.json\")\n end",
"def index\n @goals = Goal.all\n\n respond_to d... | [
"0.7842559",
"0.7739336",
"0.77372223",
"0.7640476",
"0.7636972",
"0.76317835",
"0.7568846",
"0.7563066",
"0.75395364",
"0.74954337",
"0.7390843",
"0.7390843",
"0.7390843",
"0.7390843",
"0.73780483",
"0.73780483",
"0.73780483",
"0.73780483",
"0.73735607",
"0.7358084",
"0.7201... | 0.0 | -1 |
POST /goals POST /goals.json | def create
@goal = Goal.new(goal_params)
respond_to do |format|
if @goal.save
format.html { redirect_to goals_url, notice: 'Goal was successfully created.' }
format.json { render :show, status: :created, location: @goal }
else
format.html { render :new }
format.json ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @goal = @todo.goals.create(goal_params)\n render json: @goal\n end",
"def create\n @goals = goals_for_current_user\n @goal = Goal.new(params[:goal])\n @goal.user = current_user\n\n respond_to do |format|\n if @goal.save\n format.html { redirect_to({action: 'i... | [
"0.7675624",
"0.74291724",
"0.72749054",
"0.72453797",
"0.71145284",
"0.71145284",
"0.70561117",
"0.6993439",
"0.69871545",
"0.6968615",
"0.69321275",
"0.68897337",
"0.68752927",
"0.6872396",
"0.68634003",
"0.68587345",
"0.68497473",
"0.67752355",
"0.67364514",
"0.67005104",
... | 0.71667904 | 4 |
PATCH/PUT /goals/1 PATCH/PUT /goals/1.json | def update
respond_to do |format|
if @goal.update(goal_params)
format.html { redirect_to goals_url, notice: 'Goal was successfully updated.' }
format.json { render :show, status: :ok, location: @goal }
else
format.html { render :edit }
format.json { render json: @goal.err... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n goal = Goal.find params[:id]\n if goal.update(goal_params)\n render json: goal, status: 200\n else\n render json: goal.errors.full_messages, status: 422\n end\n end",
"def update\n @goal = Goal.find(params[:id])\n\n respond_to do |format|\n if @goal.update_attribute... | [
"0.7669722",
"0.7401158",
"0.7256745",
"0.7241275",
"0.7116259",
"0.70932436",
"0.70483243",
"0.704416",
"0.7028727",
"0.70198107",
"0.7012725",
"0.7012725",
"0.7012725",
"0.7012725",
"0.7012725",
"0.7012134",
"0.700617",
"0.6999183",
"0.6992672",
"0.6917769",
"0.6913847",
... | 0.7021177 | 9 |
DELETE /goals/1 DELETE /goals/1.json | def destroy
@goal.destroy
respond_to do |format|
format.html { redirect_to goals_url, notice: 'Goal was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @goal = @user.goals.find(params[:id])\n @goal.destroy\n\n respond_to do |format|\n format.html { redirect_to user_goals_url(@user) }\n format.json { head :no_content }\n end\n end",
"def destroy\n @goal = Goal.find(params[:id])\n @goal.destroy\n\n respond_to do |form... | [
"0.78347373",
"0.7833998",
"0.78066665",
"0.78066665",
"0.7780294",
"0.7715573",
"0.7665398",
"0.7636985",
"0.7550337",
"0.7520411",
"0.7478559",
"0.7463108",
"0.7446832",
"0.7391049",
"0.73121864",
"0.7287229",
"0.72365314",
"0.7206321",
"0.7187978",
"0.7111413",
"0.70921785... | 0.74801785 | 16 |
Use callbacks to share common setup or constraints between actions. | def set_goal
@goal = Goal.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 goal_params
params.require(:goal).permit(:name, :description, :user_id, :fixed, :personal, :start_date, :goal, :sort_order, :priority_id)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def allow_params_authentication!; end",
"def allowed_params\n ALLOWED_PARAMS\n end",
"def default_param_whitelist\n [\"mode\"]\n... | [
"0.69792545",
"0.6781151",
"0.67419964",
"0.674013",
"0.6734356",
"0.6591046",
"0.6502396",
"0.6496313",
"0.6480641",
"0.6477825",
"0.64565",
"0.6438387",
"0.63791263",
"0.63740575",
"0.6364131",
"0.63192815",
"0.62991166",
"0.62978333",
"0.6292148",
"0.6290449",
"0.6290076",... | 0.0 | -1 |
return an array of http endpoints | def nsqlookupd_http_endpoints
@nsqlookupd.map { |lookupd| "http://#{lookupd.host}:#{lookupd.http_port}" }
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def endpoints\n @endpoints ||= []\n end",
"def endpoints_list\n get \"endpoints\"\n end",
"def endpoints\n unless @endpoints_collected\n @endpoints += get_missing(\"endpoints\")\n @endpoints_collected = true\n end\n\n @endpoints\n end",
"def endpoints\n @endpoints |... | [
"0.7595229",
"0.74570227",
"0.7431377",
"0.7237215",
"0.7113277",
"0.70815",
"0.6917491",
"0.68723565",
"0.68116015",
"0.669304",
"0.6683924",
"0.6683924",
"0.66726685",
"0.6615788",
"0.65744984",
"0.6519725",
"0.6480132",
"0.63723236",
"0.63718903",
"0.6348347",
"0.63144696"... | 0.6244391 | 24 |
GET /freeboards GET /freeboards.xml | def index
@menu = "board"
@board = "freeboard"
@section = "index"
@freeboard = Freeboard.search(params[:search], params[:page])
@total_count = Freeboard.search(params[:search],"").count
render 'admin/freeboards/freeboard'
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @freeboards = Freeboard.all\n end",
"def index\n @boards = Board.root_boards\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @boards }\n end\n end",
"def index\n @boards = Board.all\n \n respond_to do |format|\n form... | [
"0.71989846",
"0.700872",
"0.6586122",
"0.618464",
"0.605068",
"0.60324544",
"0.5927253",
"0.5888459",
"0.5888459",
"0.5888459",
"0.5888459",
"0.5888459",
"0.5888459",
"0.5888459",
"0.5887581",
"0.5887581",
"0.58858716",
"0.58858716",
"0.5884765",
"0.5818888",
"0.5786289",
... | 0.61025256 | 4 |
GET /freeboards/1 GET /freeboards/1.xml | def show
@freeboard = Freeboard.get(params[:id])
if @freeboard
@freeboard.hit_cnt += 1
@freeboard.save
@menu = "board"
@board = "freeboard"
@section = "show"
render 'freeboard'
else
redirect_to '/freeboards'
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @boards = Board.root_boards\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @boards }\n end\n end",
"def index\n @freeboards = Freeboard.all\n end",
"def index\n @boards = Board.all\n \n respond_to do |format|\n form... | [
"0.7208981",
"0.68508893",
"0.6694966",
"0.6570101",
"0.627565",
"0.616305",
"0.61513776",
"0.6097582",
"0.5992248",
"0.5973403",
"0.5959247",
"0.5959247",
"0.59510016",
"0.59510016",
"0.59510016",
"0.59510016",
"0.59510016",
"0.59510016",
"0.59510016",
"0.59499276",
"0.59499... | 0.61426413 | 7 |
DELETE /freeboards/1 DELETE /freeboards/1.xml | def destroy
@freeboard = Freeboard.get(params[:id])
# session check
if signed_in? && @freeboard.user_id == current_user.id
@freeboard.destroy
end
respond_to do |format|
format.html { redirect_to(admin_freeboards_url) }
format.xml { head :ok }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @board = Board.find_by_permalink(params[:id])\n @board.destroy\n\n respond_to do |format|\n format.html { redirect_to(boards_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @board = Board.find_by_slug(params[:id])\n @board.destroy\n\n respond_to do |fo... | [
"0.6649917",
"0.660378",
"0.6599441",
"0.655718",
"0.65051806",
"0.6397999",
"0.6340362",
"0.6279481",
"0.6202899",
"0.6192677",
"0.61899805",
"0.61732703",
"0.6164044",
"0.61628884",
"0.6156335",
"0.6148693",
"0.61316603",
"0.6126021",
"0.6126021",
"0.6119181",
"0.6102815",
... | 0.6703618 | 0 |
GET /surgery_supplies GET /surgery_supplies.json | def index
@surgery_supplies = SurgerySupply.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @supplies_loan = SuppliesLoan.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @supplies_loan }\n end\n end",
"def show\n @supplies_providers_loan = SuppliesProvidersLoan.find(params[:id])\n\n respond_to do |format|\n ... | [
"0.64246446",
"0.6402802",
"0.61622626",
"0.60562795",
"0.6049399",
"0.6001818",
"0.5982796",
"0.5966808",
"0.59579355",
"0.594165",
"0.594165",
"0.5931768",
"0.5926332",
"0.5857816",
"0.58003104",
"0.57987064",
"0.57669175",
"0.5746441",
"0.5723055",
"0.5709717",
"0.5696149"... | 0.7438007 | 0 |
GET /surgery_supplies/1 GET /surgery_supplies/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @surgery_supplies = SurgerySupply.all\n end",
"def show\n @supplies_loan = SuppliesLoan.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @supplies_loan }\n end\n end",
"def show\n @supplies_providers_loan = SuppliesPr... | [
"0.71894145",
"0.6586798",
"0.651056",
"0.6422497",
"0.6277984",
"0.6277033",
"0.6236483",
"0.60996646",
"0.60892487",
"0.6085909",
"0.604269",
"0.6027128",
"0.5983372",
"0.59795386",
"0.5976787",
"0.5939478",
"0.5931736",
"0.5926653",
"0.587694",
"0.587599",
"0.5874208",
"... | 0.0 | -1 |
POST /surgery_supplies POST /surgery_supplies.json | def create
@surgery_supply = SurgerySupply.new(surgery_supply_params)
respond_to do |format|
if @surgery_supply.save
format.html { redirect_to @surgery_supply, notice: 'Surgery supply was successfully created.' }
format.json { render :show, status: :created, location: @surgery_supply }
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @surgery_supplies = SurgerySupply.all\n end",
"def surgery_supply_params\n params.require(:surgery_supply).permit(:surgery_id, :supply_id, :cantidad_utilizada)\n end",
"def create\n @surgery = Surgery.new(params[:surgery])\n\n respond_to do |format|\n if @surgery.save\n ... | [
"0.6550764",
"0.63927716",
"0.62806624",
"0.6230173",
"0.59973216",
"0.5993771",
"0.59521675",
"0.58444077",
"0.57445985",
"0.57197326",
"0.56622976",
"0.562225",
"0.5544858",
"0.554288",
"0.5542734",
"0.5521738",
"0.54945457",
"0.5490406",
"0.54838467",
"0.5481636",
"0.54616... | 0.6876755 | 0 |
PATCH/PUT /surgery_supplies/1 PATCH/PUT /surgery_supplies/1.json | def update
respond_to do |format|
if @surgery_supply.update(surgery_supply_params)
format.html { redirect_to @surgery_supply, notice: 'Surgery supply was successfully updated.' }
format.json { render :show, status: :ok, location: @surgery_supply }
else
format.html { render :edit ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @supplies_loan = SuppliesLoan.find(params[:id])\n\n respond_to do |format|\n if @supplies_loan.update_attributes(params[:supplies_loan])\n format.html { redirect_to @supplies_loan, notice: 'Supplies loan was successfully updated.' }\n format.json { head :no_content }\n el... | [
"0.63750255",
"0.63458806",
"0.630077",
"0.61618096",
"0.6160118",
"0.61508834",
"0.6145215",
"0.6090808",
"0.6085679",
"0.6082022",
"0.6063573",
"0.6062951",
"0.6021937",
"0.60192263",
"0.60129917",
"0.5988692",
"0.5987409",
"0.59730816",
"0.5964768",
"0.5961198",
"0.5954055... | 0.6798373 | 0 |
DELETE /surgery_supplies/1 DELETE /surgery_supplies/1.json | def destroy
@surgery_supply.destroy
respond_to do |format|
format.html { redirect_to surgery_supplies_url, notice: 'Surgery supply was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @surgery = Surgery.find(params[:id])\n @surgery.destroy\n\n respond_to do |format|\n format.html { redirect_to surgeries_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @supplies_loan = SuppliesLoan.find(params[:id])\n @supplies_loan.destroy\n\n ... | [
"0.7083414",
"0.7037802",
"0.7000871",
"0.6971586",
"0.6930049",
"0.692229",
"0.6921463",
"0.6906121",
"0.6863728",
"0.685429",
"0.6840892",
"0.6838609",
"0.68249565",
"0.6789046",
"0.67875415",
"0.6787253",
"0.6785002",
"0.6779684",
"0.67631876",
"0.6760394",
"0.6751685",
... | 0.7617825 | 0 |
Use callbacks to share common setup or constraints between actions. | def set_surgery_supply
@surgery_supply = SurgerySupply.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 surgery_supply_params
params.require(:surgery_supply).permit(:surgery_id, :supply_id, :cantidad_utilizada)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def allow_params_authentication!; end",
"def allowed_params\n ALLOWED_PARAMS\n end",
"def default_param_whitelist\n [\"mode\"]\n... | [
"0.69792545",
"0.6781151",
"0.67419964",
"0.674013",
"0.6734356",
"0.6591046",
"0.6502396",
"0.6496313",
"0.6480641",
"0.6477825",
"0.64565",
"0.6438387",
"0.63791263",
"0.63740575",
"0.6364131",
"0.63192815",
"0.62991166",
"0.62978333",
"0.6292148",
"0.6290449",
"0.6290076",... | 0.0 | -1 |
Expects that name_args have been pulled into config | def initialize(config)
@yaml = nil
@ui = Chef::Knife::UI.new(STDOUT, STDERR, STDIN, {})
defaults = BsConfig.save(true)
super(defaults.merge! config)
@@required_mixins = Set.new
@@qualified_mixins = Set.new
usr_mixin_location = Chef::Config[:knife][:mixins]
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def configName _args\n \"configName _args;\" \n end",
"def name _args\n \"name _args;\" \n end",
"def parse_args\r\n self.names = cmd.args ? list_arg(cmd.args) : [enactor.name]\r\n end",
"def manage_args(*args)\n end",
"def initialize(args = {})\n @name = args[:name]\n... | [
"0.7454494",
"0.6731877",
"0.6619881",
"0.65967476",
"0.6527949",
"0.65277165",
"0.6496626",
"0.645654",
"0.6444724",
"0.64155936",
"0.64155936",
"0.64155936",
"0.64155936",
"0.64155936",
"0.64155936",
"0.64155936",
"0.64155936",
"0.64155936",
"0.64155936",
"0.64155936",
"0.6... | 0.0 | -1 |
TODO iterate over all orgs | def get_mixin_data_for_org(mixin, org=nil)
base = @yaml.organizations.first[1]
get_mixin_data_for_level(base, mixin)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def orgs\n client.organizations\n end",
"def orgs\n return @orgs if defined?(@orgs)\n\n @orgs = []\n orgs_from_annotations.each { |org| @orgs << org unless org_found(@orgs, org) }\n orgs_from_guidance_groups.each { |org| @orgs << org unless org_found(@orgs, org) }\n @orgs\n end",
"def orgs\... | [
"0.7511172",
"0.73263514",
"0.7045647",
"0.700294",
"0.67063844",
"0.6699211",
"0.669428",
"0.65991896",
"0.6545071",
"0.63962686",
"0.63661325",
"0.6140349",
"0.6121383",
"0.5979317",
"0.59574634",
"0.59470916",
"0.5894753",
"0.58617896",
"0.5850847",
"0.5824762",
"0.5787616... | 0.0 | -1 |
Will duplicated the Manufacturer and all related entities | def dup_entity(options = {})
entity = super(options)
entity.object_type = self.object_type.dup_entity(options) if object_type
entity.save
return entity
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def dup_entity (options ={})\n entity = super(options)\n entity.update_attributes(:serial_number => self.send(:serial_number))\n \n entity.manufacturer = self.manufacturer.dup_entity(options) if manufacturer\n entity.model = self.model.dup_entity(options) if model\n entity.valid_network = self.va... | [
"0.69850683",
"0.6476741",
"0.6355061",
"0.61382365",
"0.6120707",
"0.5997164",
"0.5956026",
"0.59295803",
"0.5887072",
"0.57475513",
"0.56933814",
"0.5647062",
"0.5604246",
"0.5562246",
"0.5542628",
"0.5488594",
"0.5466851",
"0.54557925",
"0.54311645",
"0.53971076",
"0.53746... | 0.58008504 | 9 |
GET /layer_filters/1 GET /layer_filters/1.xml | def show
@layer_filter = LayerFilter.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.xml { render :xml => @layer_filter }
format.json { render :json => @layer_filter }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @layer_filter = LayerFilter.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @layer_filter }\n format.json { render :json => @layer_filter }\n end\n end",
"def index\n @filters = @account.filters\n\n respond_to do |format|\n ... | [
"0.67280686",
"0.6421974",
"0.63545215",
"0.6226494",
"0.6182508",
"0.61799425",
"0.6169532",
"0.6050721",
"0.59956115",
"0.59931594",
"0.5969334",
"0.59657395",
"0.59605765",
"0.5914289",
"0.580794",
"0.5759558",
"0.5759558",
"0.5759558",
"0.57537717",
"0.57384014",
"0.57293... | 0.7384387 | 0 |
GET layer_filters/new GET /layer_filters/new.xml | def new
@layer_filter = LayerFilter.new
respond_to do |format|
format.html # new.html.erb
format.xml { render :xml => @layer_filter }
format.json { render :json => @layer_filter }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @layer_filter = LayerFilter.new(params[:layer_filter])\n respond_to do |format|\n if @layer_filter.save\n flash[:notice] = 'LayerFilter was successfully created.'\n format.html { redirect_to(@layer_filter) }\n format.xml { render :xml => @layer_filter, :status => :crea... | [
"0.70916444",
"0.6775535",
"0.6775535",
"0.6775535",
"0.6775535",
"0.6748088",
"0.66548",
"0.6595161",
"0.65146667",
"0.6484698",
"0.6346273",
"0.61825395",
"0.616494",
"0.61447936",
"0.6138832",
"0.6092349",
"0.60132766",
"0.60132766",
"0.6002778",
"0.59665364",
"0.59595525"... | 0.7928051 | 0 |
POST /layer_filters POST /layer_filters.xml | def create
@layer_filter = LayerFilter.new(params[:layer_filter])
respond_to do |format|
if @layer_filter.save
flash[:notice] = 'LayerFilter was successfully created.'
format.html { redirect_to(@layer_filter) }
format.xml { render :xml => @layer_filter, :status => :created, :locat... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_filters(filters); end",
"def new\n @layer_filter = LayerFilter.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @layer_filter }\n format.json { render :json => @layer_filter }\n end\n end",
"def parse_filters(params)\n if params['fi... | [
"0.6300316",
"0.61180294",
"0.5826756",
"0.5823691",
"0.577887",
"0.57217157",
"0.5702963",
"0.5697902",
"0.56359076",
"0.56032974",
"0.5565472",
"0.5534369",
"0.5524504",
"0.55158645",
"0.546805",
"0.5463528",
"0.54573125",
"0.545244",
"0.54399943",
"0.5422287",
"0.5419798",... | 0.68700874 | 0 |
PUT /layer_filters/1 PUT /layer_filters/1.xml | def update
@layer_filter = LayerFilter.find(params[:id])
respond_to do |format|
if @layer_filter.update_attributes(params[:layer_filter])
flash[:notice] = 'LayerFilter was successfully updated.'
format.html { redirect_to(@layer_filter) }
format.xml { head :ok }
else
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @filter = Object::Filter.find(params[:id])\n @filter.source = @source\n\n respond_to do |format|\n if @filter.update_attributes(params[:filter])\n flash[:notice] = 'Filter was successfully updated.'\n format.html { redirect_to(@source) }\n format.xml { head :ok }\n ... | [
"0.6288472",
"0.6262636",
"0.6061544",
"0.6029697",
"0.58850306",
"0.5872993",
"0.5870695",
"0.58693874",
"0.5864669",
"0.5847353",
"0.58207965",
"0.5805187",
"0.5805187",
"0.5789868",
"0.5779342",
"0.5713658",
"0.5700597",
"0.5661342",
"0.56122154",
"0.5598329",
"0.5524994",... | 0.69163126 | 0 |
DELETE /layer_filters/1 DELETE /layer_filters/1.xml | def destroy
@layer_filter = LayerFilter.find(params[:id])
@layer_filter.destroy
respond_to do |format|
format.html { redirect_to(layer_filters_url) }
format.xml { head :ok }
format.json { render :json => @layer_filter.attributes }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @data_filter = Probe::DataFilter.find(params[:id])\n @data_filter.destroy\n\n respond_to do |format|\n format.html { redirect_to(data_filters_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @data_file_filter = DataFileFilter.find(params[:id])\n @data_file... | [
"0.69096345",
"0.683555",
"0.67077136",
"0.6656668",
"0.6627254",
"0.6538338",
"0.6466187",
"0.64106697",
"0.6378882",
"0.6374839",
"0.6374839",
"0.6374839",
"0.6373489",
"0.6323196",
"0.6307682",
"0.6288046",
"0.62301373",
"0.6196265",
"0.6195338",
"0.61754113",
"0.6147606",... | 0.7515468 | 0 |
Norme L2 d'un observable | def norm
Math::sqrt(data.values.inject(0) { |m,v| m+v**2})
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def l2\n\t\t\t\t@l2\n\t\t\tend",
"def nor( *args ); { $nor => args } end",
"def unnormalized; end",
"def nn\n end",
"def symmetry\n ang_moment.symmetry\n end",
"def d2logL\n raise \"No implemented\"\n end",
"def zn(start, dur, freq, amp, length1, length2, feedforward)\n s = make_pulse_train(:... | [
"0.5322207",
"0.52211386",
"0.5163097",
"0.4938554",
"0.48711786",
"0.4865896",
"0.47580788",
"0.47501197",
"0.47501197",
"0.4708128",
"0.46878034",
"0.46855634",
"0.46612087",
"0.46612087",
"0.465798",
"0.4644529",
"0.4641359",
"0.46321356",
"0.4617115",
"0.46103543",
"0.460... | 0.0 | -1 |
Distance de deux observables (norme L2) | def dist_L2 other
raise ArgumentError if other.size != size or other.data.keys != data.keys
sum=0.0
data.each { |key,value|
sum+=(value-other[key])**2
}
Math::sqrt(sum)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def distance_measurement; end",
"def dist first, second\n first = first.is_a? Atom ? frac(first.pos(false)) : first.to_v\n second = second.is_a? Atom ? frac(second.pos(false)) : second.to_v\n real((first - second).map{|v| v = v % 1; v > 0.5 ? 1 - v : v}).magnitude\n end",
"def distance\n distance ... | [
"0.6565679",
"0.6470687",
"0.61788565",
"0.6173463",
"0.61205935",
"0.6117472",
"0.60829103",
"0.60829103",
"0.60803515",
"0.60755855",
"0.6048603",
"0.6004199",
"0.5998488",
"0.5984307",
"0.5962325",
"0.59558356",
"0.5949712",
"0.59173644",
"0.5913201",
"0.58886737",
"0.5855... | 0.60030085 | 12 |
Distance relative de deux observables (norme L2) | def dist_L2_relative other
raise ArgumentError if other.size != size or other.data.keys != data.keys
sum=0.0
data.each{ |key,value|
denom = (other[key]!=0) ? other[key]**2 : 1.0
sum+=(value-other[key])**2/denom
}
(1.0/data.size) * Math::sqrt(sum)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def dist first, second\n first = first.is_a? Atom ? frac(first.pos(false)) : first.to_v\n second = second.is_a? Atom ? frac(second.pos(false)) : second.to_v\n real((first - second).map{|v| v = v % 1; v > 0.5 ? 1 - v : v}).magnitude\n end",
"def normaldist(z)\r\n p_nor(z)\r\n end",
"def distan... | [
"0.66065204",
"0.6517394",
"0.64492714",
"0.62658715",
"0.61830646",
"0.6155694",
"0.6152001",
"0.6115411",
"0.60818887",
"0.60649776",
"0.6059392",
"0.6049528",
"0.6045707",
"0.60443836",
"0.60443836",
"0.60198605",
"0.6009837",
"0.596208",
"0.5960298",
"0.59570456",
"0.5949... | 0.61852765 | 4 |
Create new column with given type and name. | def initialize( type, name, opts = {} )
@type = type
@name = name
@opts = opts
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def column(name, type)\n @fields.merge!(name => type.to_s)\n end",
"def register_column(type, name)\n type = type.to_s.downcase\n raise ArgumentError.new(\"invalid column type #{type}, permitted types are #{COLUMN_TYPES.join(', ')}\") unless COLUMN_TYPES.include?(type)\n @table_columns << ... | [
"0.77926373",
"0.7518167",
"0.7346148",
"0.72464585",
"0.7204203",
"0.71306896",
"0.7125542",
"0.70478725",
"0.69887716",
"0.6974754",
"0.6873491",
"0.6868689",
"0.6834151",
"0.68337446",
"0.682504",
"0.6815993",
"0.6802857",
"0.6790123",
"0.67598933",
"0.6759472",
"0.6758281... | 0.0 | -1 |
Test if the column is in fact just a primary key constraint. | def primary_key_constraint?
type == :primary_key && name.is_a?( Array )
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def has_primary_key_column?\n @has_primary_key_column ||= !primary_key_name.nil?\n end",
"def primary_key?\n schema && schema[:primary_key]\n end",
"def has_primary_key(db, table, key)\n return db.primary_key(table) == key.to_s if db.respond_to?(:primary_key)\n\n pk_column_info = db.schema(ta... | [
"0.8006801",
"0.7988881",
"0.76741725",
"0.76427245",
"0.7550088",
"0.7550088",
"0.75482315",
"0.7529847",
"0.74599856",
"0.72223717",
"0.7162727",
"0.7087731",
"0.7077",
"0.70402884",
"0.6954488",
"0.69422424",
"0.6902698",
"0.6898038",
"0.688791",
"0.68780065",
"0.6875637",... | 0.78398323 | 2 |
Get the column default. | def default
d = opts[ :default ]
d = type_default if d.nil? && ! allow_null
d
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def default(column)\n column_named(column).default || nil\n end",
"def default(col)\n _col = column(col)\n _col.nil? ? nil : _col.default\n end",
"def column_default(key)\n self.class.column_default(key)\n end",
"def default_db_value\n class_name.columns_hash... | [
"0.8384351",
"0.83713925",
"0.82274824",
"0.8053527",
"0.7348304",
"0.7141178",
"0.70507896",
"0.70171875",
"0.6901012",
"0.6838679",
"0.6733507",
"0.672678",
"0.66602045",
"0.6651905",
"0.6642645",
"0.66086733",
"0.6504183",
"0.65023947",
"0.64841497",
"0.6457161",
"0.638459... | 0.64413875 | 20 |
Get default default for column type. | def type_default
case canonic_type
when :string
""
when :boolean
false
when :enum, :set
[ *opts[ :elements ], "" ].first
else
0
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def default(column)\n column_named(column).default || nil\n end",
"def column_default(key)\n self.class.column_default(key)\n end",
"def default(col)\n _col = column(col)\n _col.nil? ? nil : _col.default\n end",
"def default_db_value\n class_name.columns_hash... | [
"0.79363704",
"0.7847279",
"0.7836527",
"0.76020294",
"0.7174836",
"0.68243647",
"0.6818012",
"0.6786197",
"0.67330396",
"0.6659418",
"0.6612415",
"0.6580107",
"0.6562606",
"0.6508216",
"0.6494158",
"0.6466501",
"0.6405183",
"0.6377024",
"0.63624895",
"0.6316157",
"0.6305459"... | 0.5951911 | 34 |
Check whether the column allow NULL values. | def allow_null
allow = opts[ :null ]
allow.nil? || allow
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def null?(record)\n type.nullable? && record[:header][:field_nulls][position]\n end",
"def nullable?\n @nullable\n end",
"def nullable?\n @nullable\n end",
"def nullable?\n @nullable\n end",
"def null?(field_info, field)\n field_info[\"notnull\"] == 1 && self.send(field).bla... | [
"0.7087324",
"0.69022876",
"0.69022876",
"0.69022876",
"0.6875453",
"0.67219937",
"0.67219937",
"0.6684456",
"0.66837674",
"0.65505934",
"0.65497273",
"0.6547716",
"0.65322727",
"0.65322727",
"0.6496357",
"0.6496357",
"0.6493867",
"0.6482547",
"0.64715606",
"0.6468489",
"0.64... | 0.6533563 | 12 |
Get opts relevant to the column type only (excludes :null and :default). | def type_opts
opts.reject{ |key, value| NON_TYPE_OPTS.include? key }
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def import_column_type_and_options( opts )\n opts = opts.dup\n\n # Discard anything we don't need.\n\n opts.delete_if{ |key, value| IGNORED_OPTS.include? key }\n\n # Import type.\n\n type = opts.delete( :type )\n db_type = opts.delete( :db_type )\n\n type, type_opts = revert_type... | [
"0.7130852",
"0.67579895",
"0.6346507",
"0.62267095",
"0.60055673",
"0.5997012",
"0.5970994",
"0.590039",
"0.5770805",
"0.5707638",
"0.5702476",
"0.55382735",
"0.5537228",
"0.55181915",
"0.55088264",
"0.5493651",
"0.54925513",
"0.5491627",
"0.5481602",
"0.547832",
"0.545979",... | 0.7237113 | 0 |
Get the canonic type name, for type comparison. | def canonic_type
t = type.to_s.downcase.to_sym
CANONIC_TYPES[ t ] || t
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def readable_type_name(type)\n return TYPE_MAPPING.fetch(type, type)\n end",
"def type_name\n @type_name ||= name.underscore\n end",
"def type_name\n @type_name ||= StringHelpers.underscore(StringHelpers.demodulize(@value.class.name)).to_sym\n end",
"def name\n @type_name... | [
"0.7761256",
"0.7651721",
"0.7601751",
"0.75507283",
"0.738525",
"0.73349047",
"0.7333108",
"0.72897494",
"0.72184193",
"0.71745",
"0.7091434",
"0.7091434",
"0.7091434",
"0.7091434",
"0.7091434",
"0.7091434",
"0.7091434",
"0.7091434",
"0.7091434",
"0.7091434",
"0.7091434",
... | 0.82153815 | 0 |
Convert given size into its canonic form. | def canonic_size( size )
if canonic_type == :decimal && size.is_a?( Integer )
[ size, 0 ]
else
size
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def input_to_bytes(size)\n case size\n when /g|gb/i\n size.to_i.gb.to_bytes.to_i\n when /m|mb/i\n size.to_i.mb.to_bytes.to_i\n when /t|tb/i\n size.to_i.tb.to_bytes.to_i\n else\n size.to_i.gb.to_bytes.to_i\n end\n end",
"def size_to_s\n case\n ... | [
"0.60717446",
"0.6001984",
"0.5763703",
"0.5756931",
"0.56644154",
"0.56125414",
"0.548653",
"0.54837346",
"0.54502815",
"0.5398917",
"0.5376649",
"0.53701174",
"0.5316983",
"0.5309131",
"0.526445",
"0.52643806",
"0.5259333",
"0.5219745",
"0.5195246",
"0.51886153",
"0.5182980... | 0.75589335 | 0 |
Get the column options in a canonic way. | def canonic_opts
return {} if primary_key_constraint?
o = { :type => canonic_type, :default => default, :null => true }
o.merge!( DEFAULT_OPTS[ canonic_type ] || {} )
o.merge!( opts )
o[ :size ] = canonic_size( o[ :size ] )
o.delete_if{ |key, value| IGNORED_OPTS.include? ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def column_options_for(type, request, obj, column)\n opts = model.column_options_for(type, request, column)\n if opts[:class] == 'autoforme_autocomplete'\n if type == :show\n opts[:value] = model.column_value(type, request, obj, column)\n elsif key = obj.send(model.association_key(... | [
"0.7038966",
"0.6791831",
"0.67749727",
"0.67599183",
"0.6560084",
"0.6526487",
"0.64884657",
"0.64800954",
"0.64267397",
"0.6421884",
"0.64142346",
"0.63994557",
"0.63988465",
"0.6353088",
"0.6345133",
"0.63303524",
"0.63211656",
"0.6314592",
"0.6308601",
"0.6308403",
"0.630... | 0.0 | -1 |
Get options with default value included. | def default_opts
{ :default => default }.merge( opts )
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def default_options\n DEFAULT_OPTIONS\n end",
"def calculate_defaults\n # see http://www.ruby-forum.com/topic/185611#811055 for the source of\n # this obtuseness (basically, I wanted Hash.map, but it didn't work)\n opts_with_defaults = @options.select {|_, opt| opt.should_have_default_valu... | [
"0.77525306",
"0.7421275",
"0.7391701",
"0.7366225",
"0.73644686",
"0.7294104",
"0.72635365",
"0.72502726",
"0.7238241",
"0.7236767",
"0.7236767",
"0.716595",
"0.71606827",
"0.71606827",
"0.715235",
"0.715235",
"0.715235",
"0.7152073",
"0.7123174",
"0.70407104",
"0.70348644",... | 0.7154805 | 14 |
Compare one column with another one. | def == other
other.is_a?( Column ) &&
name == other.name &&
canonic_type == other.canonic_type &&
canonic_opts == other.canonic_opts
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ==(other) #:nodoc:\n # another column\n if other.respond_to?(:name) && other.class == self.class\n name == other.name.to_sym\n elsif other.is_a? Symbol\n name == other\n elsif other.is_a? String\n name.to_s == other # avoid creating new symbols\n else # unknown\n ... | [
"0.66105807",
"0.6271133",
"0.6199349",
"0.61804706",
"0.6006166",
"0.6006166",
"0.59942734",
"0.5962231",
"0.5942128",
"0.59258616",
"0.5923648",
"0.5923648",
"0.589797",
"0.58285433",
"0.58213717",
"0.57984024",
"0.57938874",
"0.5743763",
"0.57413137",
"0.56746495",
"0.5667... | 0.69297427 | 0 |
Create new index for given column(s). | def initialize( table, columns, opts = {} )
@table = table
@columns = [ *columns ]
@opts = opts
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_simple_index(table_name, index_name, column)\n spec = new IndexSpecification(index_name, column.to_java_bytes)\n create_index(table_name, spec)\nend",
"def add_index(table_name, column_name, options = {})\n column_names = Array(column_name)\n index_name = index_name(table_name, :column => co... | [
"0.72049123",
"0.71596295",
"0.71596295",
"0.7098425",
"0.7082959",
"0.7061836",
"0.6896134",
"0.6891945",
"0.6873058",
"0.6820621",
"0.68110555",
"0.67913985",
"0.64587",
"0.6402865",
"0.63862145",
"0.6374848",
"0.6367957",
"0.6311305",
"0.63062745",
"0.62810314",
"0.6263203... | 0.0 | -1 |
Get the index options, in a canonic way. | def canonic_opts
o = { :unique => false, :name => default_index_name }
o.merge!( opts )
o.delete_if{ |key, value| IGNORED_OPTS.include? key }
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @options = Option.all\n end",
"def options\n {:index => (index.blank? ? nil : index)}\n end",
"def index_options options\n defaults = {\n :type => 'string',\n :indexed => true,\n :stored => false,\n :multi_valued => false,\n :required => false,\n :co... | [
"0.71825665",
"0.6990442",
"0.6916997",
"0.6913718",
"0.6913718",
"0.6913718",
"0.6913718",
"0.6913718",
"0.6599601",
"0.6578675",
"0.657107",
"0.6519886",
"0.64904416",
"0.6446878",
"0.64017546",
"0.63924384",
"0.63923645",
"0.63839024",
"0.63342524",
"0.6318799",
"0.6239909... | 0.6318238 | 20 |
Get default index name for this index. | def default_index_name
[ table.name, *columns, :index ].join( '_' ).to_sym
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index_name\n @index_name ||= @options[:index_name] ||\n __get_class_value(:index_name) ||\n DEFAULT_INDEX_NAME\n end",
"def index_name\n get_key('ALGOLIA_INDEX_NAME', 'index_name')\n end",
"def default_index_name(table_name, columns)\n ... | [
"0.802172",
"0.78136975",
"0.7407229",
"0.73492986",
"0.7308497",
"0.7302651",
"0.708094",
"0.7021927",
"0.68833655",
"0.68227327",
"0.6767898",
"0.67478204",
"0.6726711",
"0.6726711",
"0.67087406",
"0.6650116",
"0.64947534",
"0.64729846",
"0.6418985",
"0.63390654",
"0.622327... | 0.8441589 | 0 |
Compare one index with another one. | def == other
other.is_a?( Index ) &&
columns == other.columns &&
canonic_opts == other.canonic_opts
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def <=> other\n index <=> other.index\n end",
"def <=>(other)\n @index <=> other.index\n end",
"def <=>(other)\n @index <=> other.index\n end",
"def <=>(other)\n self.index <=> other.index\n end",
"def & other\n Index.new(to_a & other.to_a)\n end",
"def eql?(other)... | [
"0.7258774",
"0.7146192",
"0.7146192",
"0.71429706",
"0.66309565",
"0.66036844",
"0.6410718",
"0.6405335",
"0.6405335",
"0.635684",
"0.6320278",
"0.6287093",
"0.62148505",
"0.6210288",
"0.6103725",
"0.60356",
"0.60099953",
"0.6003168",
"0.5988848",
"0.5933384",
"0.5908012",
... | 0.7219976 | 1 |
Create new foreign key for given columns referring to given table. | def initialize( columns, table_name, opts = {} )
@columns = [ *columns ]
@table_name = table_name
@opts = opts
if key = opts[ :key ]
opts[ :key ] = [ *key ]
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_foreign_key( columns, table_name, opts = {} )\n add_column( opts[:type] || :integer, columns, opts ) unless columns.is_a? Array\n @foreign_keys << ForeignKey.new( columns, table_name, opts )\n end",
"def add_foreign_key(from_table, from_column, options = {})\n execute [ \"alter ... | [
"0.76499766",
"0.67459065",
"0.67118895",
"0.6605615",
"0.64375496",
"0.63165885",
"0.61126494",
"0.6050172",
"0.59982765",
"0.59399277",
"0.5924828",
"0.5923736",
"0.5859541",
"0.582701",
"0.57886994",
"0.5782282",
"0.57683253",
"0.5710815",
"0.5697814",
"0.5673992",
"0.5625... | 0.49312052 | 83 |
Get the foreign key options, in a canonic way. | def canonic_opts
o = { :on_update => :no_action, :on_delete => :no_action }
o.merge!( opts )
o.delete_if{ |key, value| IGNORED_OPTS.include? key }
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def foreign_key_choices\n choices = []\n foreign_keys.each do |foreign_key|\n choices << foreign_key.all_from_class\n end\n choices\n end",
"def foreign_keys\n vals = []\n foreign_key_fields.each do |field|\n vals << self.send(field)\n end\n vals\n end",
"def foreign_key\n ... | [
"0.74499434",
"0.7226539",
"0.6937884",
"0.69100606",
"0.69098556",
"0.6843026",
"0.669963",
"0.6678167",
"0.6617834",
"0.6607018",
"0.660104",
"0.65676594",
"0.6534405",
"0.6487344",
"0.6487344",
"0.64256805",
"0.63325816",
"0.62914175",
"0.6281148",
"0.624297",
"0.6216923",... | 0.0 | -1 |
Compare one foreign key with another one. | def == other
other.is_a?( ForeignKey ) &&
columns == other.columns &&
table_name == other.table_name &&
canonic_opts == other.canonic_opts
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ==(other)\r\n self.id == other.id\r\n end",
"def ==(other)\n self.id == other.id\n end",
"def == other\n self.id == other.id\n end",
"def ==(other)\n other.book_id == book_id && other.author_id == author_id\n end",
"def foreign_key?\n true\n end",
... | [
"0.6210493",
"0.62019694",
"0.6156279",
"0.61486506",
"0.60758984",
"0.6069061",
"0.60560477",
"0.6029296",
"0.60060275",
"0.60060275",
"0.60038954",
"0.6000526",
"0.5971323",
"0.5962947",
"0.59544784",
"0.5937002",
"0.59344584",
"0.59298843",
"0.5917572",
"0.59091747",
"0.58... | 0.72334915 | 0 |
Dump foreign key definition. | def dump( out )
out << "foreign_key #{out_columns}, #{out_table_name}#{out_opts}"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_dump\n opts = {column: self.column}.merge options_for_dump\n dump = \"add_foreign_key #{from_table.inspect}, #{to_table.inspect}, #{opts.to_s.sub(/^{(.*)}$/, '\\1')}\"\n end",
"def to_dump(opts={})\n dump = (opts[:inline] ? \" t.foreign_key\" : \"add_foreign_key #{table_... | [
"0.7962987",
"0.76619637",
"0.7658654",
"0.75222635",
"0.7520305",
"0.6518105",
"0.6447481",
"0.63670313",
"0.63556087",
"0.6305238",
"0.63017577",
"0.6279212",
"0.6084604",
"0.6061066",
"0.60276407",
"0.60151225",
"0.5981093",
"0.592483",
"0.59065735",
"0.5857687",
"0.5847",... | 0.7262841 | 5 |
Send anything unrecognized as new definition to our table. | def method_missing( name, *args )
@table.add_definition( name, *args )
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def save_definition(word_id, definition)\n MinWords::DB[:defines].insert definition_text: definition, word_id: word_id\n end",
"def trigger_definition(table_name, trigger_name, name = nil)\n raise \"Internal Error: Connection adapter did not override abstract function\"\n end",
"def bef... | [
"0.56576794",
"0.563139",
"0.54886943",
"0.5474269",
"0.5454956",
"0.54223406",
"0.54204565",
"0.53745085",
"0.5345065",
"0.5233798",
"0.52311647",
"0.52311647",
"0.5230716",
"0.5199721",
"0.51790774",
"0.515192",
"0.51368815",
"0.5094409",
"0.50619423",
"0.50619423",
"0.5055... | 0.64197934 | 0 |
Create the default timestamp fields. | def timestamps
opts = @table.schema.opts
if opts[ :mysql_timestamps ]
# Unfortunately, MySQL allows only either automatic create timestamp
# (DEFAULT CURRENT_TIMESTAMP) or automatic update timestamp (DEFAULT
# CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP), but no... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def generate_default_values\n self.created_at = DateTime.now unless self.created_at\n end",
"def timestamp name, description: nil, mode: :nullable, policy_tags: nil\n record_check!\n\n add_field name, :timestamp, description: description, mode: mode, policy_tags: policy_tags\n ... | [
"0.7167384",
"0.6988887",
"0.6806876",
"0.6774439",
"0.67611367",
"0.6758728",
"0.6694382",
"0.6590579",
"0.656661",
"0.65658",
"0.64910394",
"0.647527",
"0.64562535",
"0.6425667",
"0.63923323",
"0.6363523",
"0.63210386",
"0.6247093",
"0.6247093",
"0.6247093",
"0.6247093",
... | 0.6563914 | 10 |
Create new table with given name belonging to given schema. | def initialize( schema, name )
@schema = schema
@name = name
@columns = {}
@indexes = []
@foreign_keys = []
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_table(name, &block)\n g = Schema::Generator.new(self, &block)\n create_table_sql_list(name, *g.create_info).each {|sql| execute(sql)}\n end",
"def create_schema schema_name\n execute \"CREATE SCHEMA #{quote_schema_name(schema_name)}\"\n end",
"def create_schema(name)\n ... | [
"0.76783735",
"0.76134664",
"0.7356186",
"0.72961164",
"0.7283719",
"0.72460204",
"0.72426605",
"0.71902114",
"0.7175562",
"0.71705776",
"0.71498114",
"0.7008549",
"0.6945021",
"0.6929936",
"0.6908591",
"0.69009286",
"0.68806046",
"0.68377876",
"0.68284863",
"0.677682",
"0.67... | 0.0 | -1 |
Get names of all table columns. | def column_names
@columns.keys
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def column_names(table_name)\n columns(table_name).map(&:name)\n end",
"def get_table_column_names(table)\r\n @db[table].columns\r\n end",
"def column_names\n columns.map(&:name)\n end",
"def columns(table_name)\n @db.table_info(table_name).map { |info| info[\"name\"].to_sy... | [
"0.8192165",
"0.81756794",
"0.81727433",
"0.8014352",
"0.79842603",
"0.79723",
"0.7945247",
"0.7868736",
"0.78438693",
"0.7793571",
"0.7647232",
"0.76426107",
"0.7616371",
"0.75887173",
"0.7588456",
"0.757044",
"0.75675845",
"0.7563518",
"0.75588447",
"0.74757",
"0.7454858",
... | 0.82083106 | 0 |
Get given named columns. | def named_columns( names )
@columns.values_at( *names )
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def retrieve_name_columns\n fetch_columns.grep /name/\n end",
"def get_columns!( *headers )\n data.get_columns!( *headers ); self\n end",
"def column_named(name) #nodoc\n @_column_hashes[name.to_sym]\n end",
"def columns(table_name, name = nil) end",
"def columns\n if @column... | [
"0.7586316",
"0.7240528",
"0.71018326",
"0.69985956",
"0.6924033",
"0.68418777",
"0.6784023",
"0.6724344",
"0.6724344",
"0.67028505",
"0.6677261",
"0.66500425",
"0.6636371",
"0.65978473",
"0.6589361",
"0.65747917",
"0.6553989",
"0.6547298",
"0.65396607",
"0.6453224",
"0.64511... | 0.7992063 | 0 |
Add foreign key definition. | def add_foreign_key( columns, table_name, opts = {} )
add_column( opts[:type] || :integer, columns, opts ) unless columns.is_a? Array
@foreign_keys << ForeignKey.new( columns, table_name, opts )
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_foreign_key(table, target, column: nil, name: nil)\n current_instructions << Instructions::AddForeignKey.new(\n table: table,\n target: target,\n column: column,\n name: name,\n )\n end",
"def set_foreign_key\n @foreign_key = ForeignKey.find(params[:id])\n ... | [
"0.70706135",
"0.70545036",
"0.6908963",
"0.6835647",
"0.6807187",
"0.67810374",
"0.6768968",
"0.6757401",
"0.67427254",
"0.65275955",
"0.64902025",
"0.64681244",
"0.64681244",
"0.6341557",
"0.6341381",
"0.63388175",
"0.6290242",
"0.6269413",
"0.6237672",
"0.62037706",
"0.615... | 0.6860535 | 3 |
Add definition of column, index or foreign key. | def add_definition( name, *args )
name, *args = schema.apply_defaults( self.name, name, *args )
case name
when :index
add_index( *args )
when :foreign_key
add_foreign_key( *args )
else
add_column( name, *args )
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def method_missing( name, *args )\n @table.add_definition( name, *args )\n end",
"def new_column_definition(base, name, type)\n definition = ColumnDefinition.new base, name, type\n @columns << definition\n @columns_hash[name] = definition\n definition\n... | [
"0.7049695",
"0.64576614",
"0.60562056",
"0.6047868",
"0.5912686",
"0.58480865",
"0.58139724",
"0.57989776",
"0.57479167",
"0.57357645",
"0.56998944",
"0.5699079",
"0.56780195",
"0.5665402",
"0.56423813",
"0.56337404",
"0.56337404",
"0.5631296",
"0.5623347",
"0.55852604",
"0.... | 0.8078934 | 0 |
Define table using the provided block. | def define( &block )
fail( ArgumentError, "missing table definition block" ) unless block
Context.new( self ).instance_eval( &block )
self
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_table( name, &block )\n name = name.to_sym\n fail( ArgumentError, \"table #{name} is already defined\" ) if @tables[ name ]\n @tables[ name ] = table = Table.new( self, name )\n table.define( &block ) if block\n table\n end",
"def create_table(table, **kwargs, &block)\n c... | [
"0.7247835",
"0.72063375",
"0.7030051",
"0.6824748",
"0.6752133",
"0.6750146",
"0.67391694",
"0.65237546",
"0.6521882",
"0.64187086",
"0.63780993",
"0.6346758",
"0.63344634",
"0.63081545",
"0.6297679",
"0.6287566",
"0.6284473",
"0.6226038",
"0.6171724",
"0.6142619",
"0.610079... | 0.7873098 | 0 |
Dump table definition to given output. | def dump( out = Dumper.new )
out.dump "table #{out_name}" do
for column in columns
column.dump( out )
end
for index in indexes
index.dump( out )
end
for foreign_key in foreign_keys
foreign_key.dump( out )
end
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def dump( out = Dumper.new )\n for table in tables\n table.dump( out )\n end\n out\n end",
"def dump!\n MODEL_TO_OUTPUT_FILEMAPPING.each do |klass, filepath|\n write_table_to_file(klass, filepath, %w[created_at updated_at])\n end\n end",
"def dump( out )\n ou... | [
"0.7372447",
"0.7149362",
"0.6905634",
"0.6772581",
"0.6589981",
"0.6437448",
"0.6419542",
"0.63311404",
"0.6303169",
"0.6197529",
"0.6195435",
"0.61665475",
"0.6119507",
"0.6075815",
"0.60756487",
"0.60481167",
"0.6046823",
"0.60223466",
"0.6020591",
"0.59550065",
"0.5934567... | 0.7657854 | 0 |
Get names of all tables. | def table_names
@tables.keys
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def list_names_of_all_tables\n tables = @stargate.list_tables\n tables.collect { |t| t.name}\n end",
"def tables\n table_names.map { |tn| table(tn) }\n end",
"def tables(name = nil)\n @connection.table_names\n end",
"def tables\n execute(\"SHOW TABLES FROM #{@opts[:databas... | [
"0.868819",
"0.80150527",
"0.7945177",
"0.7894375",
"0.78352535",
"0.7771431",
"0.7709065",
"0.7690249",
"0.7690024",
"0.7676483",
"0.7648005",
"0.74975884",
"0.748344",
"0.7479852",
"0.7436276",
"0.741571",
"0.7289928",
"0.7288114",
"0.7230454",
"0.72270626",
"0.71287674",
... | 0.8196497 | 1 |
Get tables with given names. | def named_tables( names )
@tables.values_at( *names )
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def tables(name = nil) #:nodoc:\n select_all(\"select decode(table_name,upper(table_name),lower(table_name),table_name) name from all_tables where owner = sys_context('userenv','session_user')\").map {|t| t['name']}\n end",
"def tables\n table_names.map { |tn| table(tn) }\n end",
"def tables(na... | [
"0.77721715",
"0.76077294",
"0.75813",
"0.75204664",
"0.751458",
"0.7501683",
"0.7498851",
"0.7495465",
"0.7495384",
"0.74202806",
"0.7402412",
"0.7345369",
"0.71536106",
"0.6998749",
"0.6972265",
"0.6787248",
"0.6787176",
"0.6730984",
"0.6722885",
"0.66985106",
"0.66903126",... | 0.78259826 | 0 |
Add table with given name, optionally defined with provided block. | def add_table( name, &block )
name = name.to_sym
fail( ArgumentError, "table #{name} is already defined" ) if @tables[ name ]
@tables[ name ] = table = Table.new( self, name )
table.define( &block ) if block
table
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_table(name, &block)\n DB.drop_table? name if @opts.drop_tables?\n DB.create_table? name.to_sym, &block\n info \"Setup database table: #{name}\"\n end",
"def create_table!(name, &block)\n drop_table(name) rescue nil\n create_table(name, &block)\n end",
"def table_detail... | [
"0.7218562",
"0.71529025",
"0.7142175",
"0.69880444",
"0.6757752",
"0.67360175",
"0.66709596",
"0.6590812",
"0.6578832",
"0.6557854",
"0.6539419",
"0.6430282",
"0.6374517",
"0.62653923",
"0.62106055",
"0.6153612",
"0.61458635",
"0.6127584",
"0.6074914",
"0.6033953",
"0.600119... | 0.8664357 | 0 |
Helper for creating join tables conveniently. It is equivalent to the following: add_table name do foreign_key id_left, table_left foreign_key id_right, table_right primary_key [id_left, id_right] unique [id_right, id_left] end In case a block is provided, it is used to further extend the table defined. | def add_join_table( id_left, table_left, id_right, table_right, name = nil, &block )
name ||= [ table_left, table_right ].sort.join( '_' )
add_table name do
foreign_key id_left, table_left
foreign_key id_right, table_right
primary_key [ id_left, id_right ]
unique [ id_right, ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_join_table!(hash, options=OPTS)\n drop_table?(join_table_name(hash, options))\n create_join_table(hash, options)\n end",
"def define_linkable_table( name, base_table = nil )\n define_table(name) do |table|\n id_name = create_internal_name(\"id\")\n\n marks = []\n ... | [
"0.6804557",
"0.6593587",
"0.65624344",
"0.6546389",
"0.636334",
"0.6353856",
"0.6344232",
"0.63413435",
"0.62980753",
"0.62753755",
"0.62578416",
"0.6234961",
"0.62103796",
"0.6172775",
"0.6107549",
"0.6074894",
"0.6067044",
"0.6042369",
"0.5958771",
"0.59560376",
"0.5934358... | 0.8380122 | 0 |
Set default options for given statement used in +add_table+ blocks. It uses the following arguments: +name+:: The name of the statement, like +:primary_key+ or +:String+. The special name +:global+ may be used to set default options for any statement. +alias+:: Optional real statement to use instead of +name+, like +:S... | def set_defaults( name, *args, &block )
clear_defaults( name )
@aliases[ name ] = args.shift if args.first.is_a? Symbol
@defaults[ name ] = args.pop if args.last.is_a? Hash
@callbacks[ name ] = block
fail( ArgumentError, "invalid defaults for #{name}" ) unless args.empty?
self
en... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def apply_defaults( table_name, name, *args )\n opts = {}\n opts.merge!( get_defaults( :global ) )\n\n if name[ -1 ] == '?'\n opts[ :null ] = true\n original_name = name\n name = name[ 0..-2 ].to_sym\n end\n\n opts.merge!( get_defaults( name ) )\n opts.merge!( get... | [
"0.67017245",
"0.5640359",
"0.5339222",
"0.52487427",
"0.51766264",
"0.5128777",
"0.50680465",
"0.50680465",
"0.5033426",
"0.49523544",
"0.4943699",
"0.4912845",
"0.49092075",
"0.48640245",
"0.48624027",
"0.48552185",
"0.48450184",
"0.48220885",
"0.48203057",
"0.47746554",
"0... | 0.5890923 | 1 |
Clear defaults and aliases for given statement. | def clear_defaults( name )
@aliases.delete( name )
@defaults.delete( name )
@callbacks.delete( name )
self
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def reset_and_clear_bindings!\n reset!\n @stmt_api.clear_bindings!\n end",
"def clear_scoping\n selector.clear\n options.clear\n end",
"def reset_defaults_and_overrides\n default.clear\n override.clear\n end",
"def reset_query_state\n @scope.clear\n ... | [
"0.60926485",
"0.5834253",
"0.5749861",
"0.5693735",
"0.5689571",
"0.5602106",
"0.55537236",
"0.5535399",
"0.5513252",
"0.5482121",
"0.54799694",
"0.5435238",
"0.54187137",
"0.5417043",
"0.5358915",
"0.5326439",
"0.532221",
"0.530123",
"0.530123",
"0.5269858",
"0.5232908",
... | 0.5721392 | 3 |
Get default options for given statement. | def get_defaults( name )
@defaults[ name ] || {}
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def default_options\n DEFAULT_OPTIONS\n end",
"def default_options\n option_type_config_for :default\n end",
"def default_options\n { }\n end",
"def calculate_defaults\n # see http://www.ruby-forum.com/topic/185611#811055 for the source of\n # this obtuseness (basically,... | [
"0.6408276",
"0.6334127",
"0.60928845",
"0.60903883",
"0.6062651",
"0.605976",
"0.6043617",
"0.59224784",
"0.59044814",
"0.5903377",
"0.5903377",
"0.5881927",
"0.58709085",
"0.5848603",
"0.5848603",
"0.5848603",
"0.5843831",
"0.5843831",
"0.5843831",
"0.5835225",
"0.5815151",... | 0.0 | -1 |
Set standard defaults and aliases for often used types. The current set of defaults is as follows: :global, :null => false :Bool, :TrueClass :True, :TrueClass, :default => true :False, :TrueClass, :default => false :Signed, :integer, :unsigned => false :Unsigned, :integer, :unsigned => true :Text, :String, :text => tru... | def set_standard_defaults( opts = self.opts )
# We set NOT NULL on everything by default, but note the ?
# syntax (like Text?) which declares the column as NULL.
set_defaults :global, :null => false
# We also like our keys unsigned, so we allow setting that, too.
# Unfortunately, :unsig... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def defaults\n self.searchable ||= false\n self.displayable ||= true\n self.facetable ||= false\n self.multivalued ||= false\n self.sortable ||= false\n self.data_type ||= \"string\"\n end",
"def default\n @type = :default\n end",
"def native_database_types\n @... | [
"0.681881",
"0.6498714",
"0.6316785",
"0.6287604",
"0.62855375",
"0.6033214",
"0.60170764",
"0.5963225",
"0.59537935",
"0.59537935",
"0.59537935",
"0.59537935",
"0.59537935",
"0.59537935",
"0.59537935",
"0.59537935",
"0.59537935",
"0.59537935",
"0.5889581",
"0.5864443",
"0.58... | 0.78106165 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.