query stringlengths 7 6.41k | document stringlengths 12 28.8k | metadata dict | negatives listlengths 30 30 | negative_scores listlengths 30 30 | document_score stringlengths 5 10 | document_rank stringclasses 2
values |
|---|---|---|---|---|---|---|
Stubs SOAP requests to a given soap_action. | def stubs(soap_action)
setup :stubs, soap_action
self
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def dispatch(soap_action)\n response = @request.soap @soap\n Response.new response\n end",
"def setup(soap_action, &block)\n @soap = SOAP.new @wsdl.soap_actions[soap_action]\n @wsse = WSSE.new\n\n yield_parameters &block if block\n\n @soap.namespaces[\"xmlns:wsdl\"] = @wsdl.names... | [
"0.7005628",
"0.6440213",
"0.63615036",
"0.6125479",
"0.6076433",
"0.60549504",
"0.58985615",
"0.5896121",
"0.58701813",
"0.5791605",
"0.5756803",
"0.5471734",
"0.5461388",
"0.5436634",
"0.5424589",
"0.54219496",
"0.54078627",
"0.53144324",
"0.53101104",
"0.5275829",
"0.52747... | 0.80295694 | 0 |
Expects a given SOAP body Hash to be used. | def with(soap_body)
Savon::SOAP::XML.any_instance.expects(:body=).with(soap_body) if mock_method == :expects
self
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def find_soap_body\n envelope = self[self.keys.first] || {}\n body_key = envelope.keys.find { |key| /.+:Body/ =~ key } rescue nil\n body_key ? envelope[body_key].map_soap_response : {}\n end",
"def soap_body(env)\n env['rack.input'].respond_to?(:string) ? env['rack.input'].string\n ... | [
"0.5992388",
"0.5599322",
"0.55401725",
"0.52851087",
"0.51988",
"0.5166695",
"0.5096424",
"0.5090427",
"0.50637686",
"0.50632364",
"0.5051357",
"0.50453806",
"0.50090665",
"0.49846715",
"0.4972368",
"0.49688593",
"0.49623933",
"0.49608627",
"0.49439153",
"0.49319795",
"0.492... | 0.585774 | 1 |
Sets up Savon to respond like there was a SOAP fault. | def raises_soap_fault
Savon::SOAP::Response.any_instance.expects(:soap_fault?).returns(true)
self
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def format_soap_faults\n fault = self.hash[:envelope][:body].delete(\"soap:Fault\") || self.hash[:envelope][:body].delete(:fault)\n self.errors << (fault[:faultstring] || fault[\"faultstring\"])\n self.valid = false\n end",
"def raise_errors\n message = 'FIXME: Need to parse http for res... | [
"0.614185",
"0.6041459",
"0.60386366",
"0.6015774",
"0.59535646",
"0.5841786",
"0.5819629",
"0.5807705",
"0.5764952",
"0.5753135",
"0.5753135",
"0.57317203",
"0.5716532",
"0.5706272",
"0.566745",
"0.5649483",
"0.5637122",
"0.5628838",
"0.5577762",
"0.5465068",
"0.54605436",
... | 0.6792786 | 0 |
Wrap tests that use Mocha and skip if unavailable. | def uses_mocha(test_name)
require 'mocha' unless Object.const_defined?(:Mocha)
rescue LoadError => load_error
$stderr.puts "Skipping #{test_name} tests. `gem install mocha` and try again."
else
yield
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def uses_mocha(test_name)\n require 'mocha'\n yield\nrescue LoadError\n $stderr.puts \"Skipping #{test_name} tests. `gem install mocha` and try again.\"\nend",
"def uses_mocha(test_name)\n unless Object.const_defined?(:Mocha)\n gem 'mocha', '>= 0.9.5'\n require 'mocha'\n end\nrescue LoadError => load_... | [
"0.7830533",
"0.7767795",
"0.59468395",
"0.59468395",
"0.57822424",
"0.5688788",
"0.5685269",
"0.56059647",
"0.55875677",
"0.5562946",
"0.5555831",
"0.55513185",
"0.55316496",
"0.55299443",
"0.55291027",
"0.5526648",
"0.55130935",
"0.547739",
"0.5475869",
"0.5448887",
"0.5441... | 0.7847089 | 0 |
lexer rules lexer rule t__6! (T__6) (in CSV.g) | def t__6!
# -> uncomment the next line to manually enable rule tracing
# trace_in( __method__, 1 )
type = T__6
channel = ANTLR3::DEFAULT_CHANNEL
# - - - - main rule block - - - -
# at line 7:8: '+'
match( 0x2b )
@state.type = type
@sta... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def t__63!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 2 )\n\n type = T__63\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 8:9: '\\\\n'\n match( 0xa )\n\n \n @state.type = type\n... | [
"0.64735585",
"0.6448308",
"0.64443517",
"0.6433646",
"0.64273816",
"0.6420842",
"0.6401554",
"0.63948524",
"0.63883007",
"0.63377064",
"0.6299572",
"0.6292796",
"0.62752616",
"0.6272566",
"0.626987",
"0.62571025",
"0.6247509",
"0.62355816",
"0.6226294",
"0.6211529",
"0.62088... | 0.65833735 | 0 |
lexer rule number! (NUMBER) (in CSV.g) | def number!
# -> uncomment the next line to manually enable rule tracing
# trace_in( __method__, 2 )
type = NUMBER
channel = ANTLR3::DEFAULT_CHANNEL
# - - - - main rule block - - - -
# at line 11:10: ( '0' .. '9' )+
# at file 11:10: ( '0' .. '9' )+
mat... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def num!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 5 )\n\n type = NUM\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 37:9: ( '1' .. '9' ) ( '0' .. '9' )*\n # at line 37:9: ( '1' .. '9' )... | [
"0.7435637",
"0.71241164",
"0.68142223",
"0.6804753",
"0.67911065",
"0.664575",
"0.66360193",
"0.66350996",
"0.6434702",
"0.63688004",
"0.6323316",
"0.62384313",
"0.6213848",
"0.62036186",
"0.6157369",
"0.60919815",
"0.60741335",
"0.6072288",
"0.597126",
"0.5920029",
"0.59157... | 0.7509113 | 0 |
lexer rule space! (SPACE) (in CSV.g) | def space!
# -> uncomment the next line to manually enable rule tracing
# trace_in( __method__, 3 )
type = SPACE
channel = ANTLR3::DEFAULT_CHANNEL
# - - - - main rule block - - - -
# at line 12:9: ( ' ' )+
# at file 12:9: ( ' ' )+
match_count_2 = 0
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delim!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 13 )\n\n\n\n type = DELIM\n channel = ANTLR3::DEFAULT_CHANNEL\n # - - - - label initialization - - - -\n\n\n # - - - - main rule block - - - -\n # at line 305:3: '|'\n match( 0x... | [
"0.72857696",
"0.7151333",
"0.7031983",
"0.7002252",
"0.6868628",
"0.67804253",
"0.6627531",
"0.6617852",
"0.6569228",
"0.6249484",
"0.6244152",
"0.62422854",
"0.6228803",
"0.62190044",
"0.61122173",
"0.6088007",
"0.60851634",
"0.597342",
"0.5960626",
"0.59551775",
"0.5930669... | 0.7325442 | 0 |
Returns an array of locations for a circle. | def get_circle(location, r)
startY = location.y - r
startX = 0
endX = 0
if startY % 2 == 0
startX = location.x - (r / 2.0).floor
endX = location.x + r;
else
startX = location.x - (r / 2.0).floor
endX = location.x + r;
if r % 2 == 0
startX+=1; endX+=1;
end
end
e... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def points_for_circle(x, y, r)\n cur_page.points_for_circle(x, y, r)\n end",
"def location(x, y, theta, distance)\n \t return [\n \t x + distance * Math.cos(theta),\n \t y - distance * Math.sin(theta)\n \t ]\n \tend",
"def bresenham_circle_coordinates\n coordinates = []\n\n p... | [
"0.68248504",
"0.67919993",
"0.64993674",
"0.64616084",
"0.6434406",
"0.6395247",
"0.6297898",
"0.62888646",
"0.62259",
"0.62119913",
"0.61935437",
"0.6125707",
"0.6115966",
"0.6093299",
"0.60277575",
"0.6024512",
"0.6022414",
"0.60211587",
"0.59975594",
"0.59971297",
"0.5919... | 0.700229 | 0 |
List all available style names | def style_names
styles.keys
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def styles\n mentos(:get_all_styles)\n end",
"def list_styles(**opt)\n # Overridden by the subclass if configured for search analysis.\n end",
"def get_styles &block\n response = self.search :styles => nil\n doc = Nokogiri::XML(response)\n styles = doc.xpath(Style.root_xpath).collect... | [
"0.7380433",
"0.7204228",
"0.67233413",
"0.67182636",
"0.6682742",
"0.6538333",
"0.6526848",
"0.65208",
"0.6436264",
"0.63944024",
"0.63812304",
"0.6332522",
"0.61585027",
"0.61585027",
"0.61585027",
"0.6083059",
"0.6081906",
"0.60627264",
"0.6058523",
"0.6042654",
"0.601944"... | 0.83735865 | 0 |
Remove notifications from problem editors | def remove_problem_upvote_notifications
((@resource.versions.map{ |version| version.user }).uniq - [@actor]).each do |editor|
n = Notification.find_by(recipient: editor,
actor: @actor,
notifiable: @resource,
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remove_from_notifications\n notifications.find_all { |n| n.noti_read == 'N' }.each do |n|\n remove_from_notification(n)\n end # each n\n end",
"def remove_proof_upvote_notifications\n ((@resource.versions.map{ |version| version.user }).uniq - [@actor]).each do |editor|\n n = Notif... | [
"0.6260517",
"0.6110999",
"0.6046434",
"0.60085297",
"0.59338176",
"0.5880503",
"0.5869141",
"0.5804477",
"0.57785124",
"0.5757553",
"0.5727281",
"0.5698001",
"0.5684405",
"0.56784624",
"0.56572413",
"0.5634316",
"0.56001025",
"0.55715257",
"0.55238694",
"0.54960984",
"0.5458... | 0.66725373 | 0 |
Remove notifications from proof editors | def remove_proof_upvote_notifications
((@resource.versions.map{ |version| version.user }).uniq - [@actor]).each do |editor|
n = Notification.find_by(recipient: @resource.user, actor: @actor,
action_type: "like",
notifiable: @resource) if @resource.user != @act... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remove_problem_upvote_notifications\n ((@resource.versions.map{ |version| version.user }).uniq - [@actor]).each do |editor|\n n = Notification.find_by(recipient: editor,\n actor: @actor,\n notifiable: @resource,\n ... | [
"0.6593376",
"0.6380433",
"0.6120637",
"0.6116147",
"0.61107093",
"0.6052392",
"0.5969748",
"0.59078586",
"0.5905529",
"0.58484566",
"0.58292305",
"0.5812028",
"0.5777078",
"0.56985176",
"0.5674592",
"0.5670423",
"0.56559753",
"0.5570358",
"0.5560994",
"0.55516726",
"0.552027... | 0.6894099 | 0 |
Remove notification from owner of comment | def remove_comment_upvote_notifications
n = Notification.find_by(recipient: @resource.user, actor: @actor,
action_type: "like",
notifiable: @resource) if @resource.user != @actor
if !n.nil?
n.destroy
@removed += 1
end
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remove_notification\n if followable_type == \"User\"\n notice = Notification.where({\n target_id: followable_id,\n target_type: \"User\",\n notice_id: id,\n notice_type: \"Follow\",\n user_id: followable_id,\n notifier_id: follower_id\n }).first\n not... | [
"0.6999875",
"0.69937617",
"0.6849901",
"0.67677766",
"0.6663127",
"0.659714",
"0.6530698",
"0.6475304",
"0.63988656",
"0.6389776",
"0.63698304",
"0.6322537",
"0.6279924",
"0.6260112",
"0.6244098",
"0.6233276",
"0.6212999",
"0.61734164",
"0.613409",
"0.59765583",
"0.5971494",... | 0.7223053 | 0 |
'anchor' is one of the ANCHOR_ constants above. 'where' is the pixel location to slide around, and slide_direction is +/1 to indicate which way to slide when showing. 'displacement' is where along the nonanchored axis the box should be. | def initialize(anchor, where, slide_direction, disp = 0)
super()
@rl = Opal::ResourceLocator.instance
@bgcolor = Rubygame::Color[:blue]
@border = Rubygame::Color[:white]
@anchor = anchor
@where = where
@slide_direction = slide_direction
@displacement = disp
@slide_offset = 0
@spe... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def showing?\n return true if @state == STATE_DISPLAYED\n ext = extent\n case(@anchor)\n when ANCHOR_TOP\n return @slide_offset >= 0\n when ANCHOR_LEFT\n return @slide_offset >= 0\n when ANCHOR_BOTTOM\n return @slide_offset <= -ext\n when ANCHOR_RIGHT\n return @slide_offset... | [
"0.56952196",
"0.5655555",
"0.5618236",
"0.537118",
"0.53434837",
"0.53434837",
"0.5302156",
"0.5202816",
"0.51520866",
"0.5117545",
"0.5083145",
"0.5079932",
"0.507465",
"0.49990264",
"0.4939094",
"0.4862796",
"0.48468092",
"0.47734866",
"0.47325787",
"0.46962148",
"0.468138... | 0.60322 | 0 |
Adjusts the scale (and inverse_scale) by the given amount ZOOM_SPEED | def zoom(delay)
self.scale += delay * ZOOM_SPEED
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_zoom\n @effectus_old_zoom_x = @picture.zoom_x\n @effectus_old_zoom_y = @picture.zoom_y\n self.zoom_x = @effectus_old_zoom_x / 100.0\n self.zoom_y = @effectus_old_zoom_y / 100.0\n end",
"def vscale(factor)\n @height = @height * factor\n @top *= factor\n self\n end",
"def zoom(d... | [
"0.6357948",
"0.63213265",
"0.61937875",
"0.59902763",
"0.590808",
"0.58783174",
"0.5777762",
"0.577419",
"0.5753107",
"0.57381606",
"0.570375",
"0.5629697",
"0.5622397",
"0.5600802",
"0.5596528",
"0.55393696",
"0.5528985",
"0.54692817",
"0.5465162",
"0.5460557",
"0.54478043"... | 0.703119 | 0 |
Register a lock to be renewed every extend_interval seconds. | def register(lock, extend_interval)
registration = Registration.new
registration.lock = lock
registration.mutex = Mutex.new
registration.thread = Thread.current
registration.acquired_at = Time.now
registration.extend_interval = extend_interval
registration.released = false
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def extend_lock_if_expires_in_less_than(duration)\n extend_lock if duration > remaining_lock_time\n end",
"def extend_lock!\n Resque.redis.expire(key, timeout)\n end",
"def lock_interval= value\n put_settings(get_settings.tap {|s| s[:lock_interval] = value})\n end",
... | [
"0.6693901",
"0.6399278",
"0.6149864",
"0.6066555",
"0.60389113",
"0.5899571",
"0.58183295",
"0.5671344",
"0.55594057",
"0.5495701",
"0.54651004",
"0.54388404",
"0.5399389",
"0.53882456",
"0.5364531",
"0.5355837",
"0.5348644",
"0.52948856",
"0.5271662",
"0.52258074",
"0.52215... | 0.8018224 | 0 |
Extend all currently registered locks that have been held longer than the extend_interval since they were last acquired/extended. If any locks have expired (should not happen), it will release them. | def extend_locks
# Make a local copy of the locks array to avoid accessing it outside of the mutex.
locks_copy = @locks_mutex.synchronize { locks.dup }
locks_copy.each { |registration| extend_lock(registration) }
@locks_mutex.synchronize do
locks.delete_if(&:released)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def extend_lock_if_expires_in_less_than(duration)\n extend_lock if duration > remaining_lock_time\n end",
"def extend_lock!\n Resque.redis.expire(key, timeout)\n end",
"def register(lock, extend_interval)\n registration = Registration.new\n registration.lock = lock... | [
"0.67517155",
"0.59968555",
"0.5689523",
"0.559227",
"0.5391564",
"0.52705073",
"0.5240198",
"0.51786256",
"0.5078256",
"0.5058195",
"0.49850562",
"0.49557242",
"0.4947205",
"0.49445063",
"0.4943477",
"0.49239856",
"0.49131888",
"0.4823957",
"0.4818961",
"0.47674716",
"0.4735... | 0.7650049 | 0 |
GET /selecaos/1 GET /selecaos/1.json | def show
@selecao = Selecao.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.json { render json: @selecao }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @seguro = Seguro.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @seguro }\n end\n end",
"def index\n @socios = Socio.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @... | [
"0.71064365",
"0.6753639",
"0.66718787",
"0.6658466",
"0.66025007",
"0.65756786",
"0.6562154",
"0.653512",
"0.65227085",
"0.6406556",
"0.6405248",
"0.63974494",
"0.6388989",
"0.63684595",
"0.6367398",
"0.6338508",
"0.63342",
"0.6314306",
"0.6309118",
"0.63060516",
"0.6303607"... | 0.69207305 | 1 |
GET /selecaos/new GET /selecaos/new.json | def new
@selecao = Selecao.new
respond_to do |format|
format.html # new.html.erb
format.json { render json: @selecao }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @seguro = Seguro.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @seguro }\n end\n end",
"def new\n @sezione = Sezione.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @sezione }\n en... | [
"0.7673355",
"0.7500561",
"0.74599725",
"0.73434454",
"0.73012733",
"0.7284069",
"0.72820944",
"0.72461057",
"0.7233107",
"0.7222035",
"0.71592706",
"0.7148576",
"0.7142686",
"0.7138414",
"0.7121858",
"0.7118427",
"0.71063447",
"0.70926577",
"0.7088671",
"0.7081683",
"0.70816... | 0.7744536 | 0 |
POST /selecaos POST /selecaos.json | def create
@selecao = Selecao.new(params[:selecao])
respond_to do |format|
if @selecao.save
format.html { redirect_to @selecao, notice: 'Selecao was successfully created.' }
format.json { render json: @selecao, status: :created, location: @selecao }
else
format.html { render... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @seguro = Seguro.new(params[:seguro])\n\n respond_to do |format|\n if @seguro.save\n format.html { redirect_to @seguro, notice: 'Seguro was successfully created.' }\n format.json { render json: @seguro, status: :created, location: @seguro }\n else\n format.html { r... | [
"0.6663375",
"0.65300363",
"0.6406342",
"0.6395286",
"0.6338467",
"0.63044035",
"0.6278391",
"0.6276684",
"0.6267618",
"0.62545985",
"0.62474227",
"0.6229199",
"0.6219681",
"0.6217479",
"0.62123716",
"0.62107056",
"0.6206724",
"0.6206048",
"0.619697",
"0.6191094",
"0.61886233... | 0.6659651 | 1 |
PUT /selecaos/1 PUT /selecaos/1.json | def update
@selecao = Selecao.find(params[:id])
respond_to do |format|
if @selecao.update_attributes(params[:selecao])
format.html { redirect_to @selecao, notice: 'Selecao was successfully updated.' }
format.json { head :no_content }
else
format.html { render action: "edit" ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @seguro = Seguro.find(params[:id])\n\n respond_to do |format|\n if @seguro.update_attributes(params[:seguro])\n format.html { redirect_to @seguro, notice: 'Seguro was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: ... | [
"0.6427689",
"0.6255403",
"0.61362725",
"0.6129032",
"0.60895616",
"0.6065918",
"0.6046543",
"0.6029601",
"0.60295624",
"0.6023039",
"0.60130554",
"0.60099554",
"0.6006212",
"0.59947383",
"0.59772074",
"0.59656155",
"0.5962535",
"0.5933297",
"0.59308934",
"0.59105206",
"0.590... | 0.634854 | 1 |
DELETE /selecaos/1 DELETE /selecaos/1.json | def destroy
@selecao = Selecao.find(params[:id])
@selecao.destroy
respond_to do |format|
format.html { redirect_to selecaos_url }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @seguro = Seguro.find(params[:id])\n @seguro.destroy\n\n respond_to do |format|\n format.html { redirect_to seguros_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @seguidore = Seguidore.find(params[:id])\n @seguidore.destroy\n\n respond_to do |... | [
"0.71521413",
"0.7094811",
"0.70051724",
"0.69976777",
"0.69643164",
"0.6921676",
"0.6911437",
"0.6901799",
"0.6891904",
"0.6860565",
"0.683041",
"0.6826397",
"0.68180317",
"0.68075925",
"0.68063647",
"0.68016326",
"0.68003345",
"0.67889255",
"0.67889255",
"0.67889255",
"0.67... | 0.71586585 | 0 |
GET /franchises GET /franchises.json | def index
@franchises = Franchise.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show \n @franchise = @franchise_set.franchises.find(params[:id])\n\n respond_with(@franchise_set, @franchise)\n end",
"def show \n @franchise_set = FranchiseSet.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @franchise_set }... | [
"0.68629324",
"0.66568244",
"0.65204364",
"0.6466579",
"0.6461302",
"0.6414443",
"0.6412911",
"0.63708305",
"0.63563764",
"0.6344071",
"0.6344071",
"0.63136554",
"0.6311347",
"0.6288984",
"0.626852",
"0.624103",
"0.6216137",
"0.6170594",
"0.61650807",
"0.6142835",
"0.6113395"... | 0.69259226 | 0 |
Converts the given field to the value that the database adapter returns as a usable column name: column_alias_for("users.id") => "users_id" column_alias_for("sum(id)") => "sum_id" column_alias_for("count(distinct users.id)") => "count_distinct_users_id" column_alias_for("count()") => "count_all" | def column_alias_for(field)
column_alias = +field
column_alias.gsub!(/\*/, "all")
column_alias.gsub!(/\W+/, " ")
column_alias.strip!
column_alias.gsub!(/ +/, "_")
@connection.table_alias_for(column_alias)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def col_name(col)\n [@_table_name, col.name].join('.')\n end",
"def converted_field_name\n FIELD_NAMES_TABLE[@field_name] || @field_name\n end",
"def aggregated_fact_column_sql\n aggregate_fields.collect { |c| \n \"#{c.strategy_name}(#{c.from_table_name}.#{c.name}) AS #{c.la... | [
"0.5895517",
"0.58782315",
"0.58514905",
"0.5712649",
"0.56917036",
"0.5688646",
"0.56815845",
"0.56802845",
"0.56715626",
"0.5626864",
"0.56251174",
"0.56140554",
"0.5603858",
"0.5601835",
"0.5581238",
"0.5534465",
"0.5524514",
"0.5519214",
"0.54917383",
"0.5488859",
"0.5488... | 0.7471608 | 0 |
Same as count but perform the query asynchronously and returns an ActiveRecord::Promise | def async_count(column_name = nil)
async.count(column_name)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def count\n @count ||=\n begin\n # self.sql sets self.model_class.\n this_sql = sql(:count => true)\n model_class.connection.\n query(this_sql).\n first.first\n end\n end",
"def count\n query.count\n end",
"def count\n query.count\n e... | [
"0.6552634",
"0.6464964",
"0.6464964",
"0.63392395",
"0.61851805",
"0.590122",
"0.58874714",
"0.5857866",
"0.58360636",
"0.58178264",
"0.5779527",
"0.57781446",
"0.5759162",
"0.5729152",
"0.5725027",
"0.5710067",
"0.5634603",
"0.56287456",
"0.5612585",
"0.55990654",
"0.558016... | 0.7223257 | 0 |
Calculates the average value on a given column. Returns +nil+ if there's no row. See calculate for examples with options. Person.average(:age) => 35.8 | def average(column_name)
calculate(:average, column_name)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def average(column)\n if s = sum(column)\n s / _all_with_present_column(column).count.to_f\n end\n end",
"def column_average(input_query, key)\n output = input_query.average(key)\n number_with_precision(output, precision: 1)\n end",
"def avg(field)\n to... | [
"0.8124579",
"0.6897474",
"0.66772103",
"0.66442484",
"0.66257405",
"0.6408009",
"0.6398571",
"0.63593835",
"0.63576573",
"0.635402",
"0.63029486",
"0.6258484",
"0.61673945",
"0.6148234",
"0.60933393",
"0.6086343",
"0.60742986",
"0.6063052",
"0.6054823",
"0.6044952",
"0.60206... | 0.80437046 | 1 |
Same as average but perform the query asynchronously and returns an ActiveRecord::Promise | def async_average(column_name)
async.average(column_name)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def average_student_gpa\n \"SELECT AVG(gpa) from students;\"\nend",
"def async_sum(identity_or_column = nil)\n async.sum(identity_or_column)\n end",
"def calculate(operation, column_name)\n operation = operation.to_s.downcase\n\n if @none\n case operation\n when \"count\", \"s... | [
"0.5835753",
"0.547055",
"0.5469689",
"0.54238045",
"0.52602386",
"0.52592427",
"0.52137923",
"0.52137923",
"0.52137923",
"0.5198025",
"0.51939225",
"0.51723516",
"0.51477414",
"0.5140449",
"0.51170796",
"0.51098645",
"0.50977683",
"0.5089294",
"0.50892437",
"0.5078895",
"0.5... | 0.72706807 | 0 |
Calculates the minimum value on a given column. The value is returned with the same data type of the column, or +nil+ if there's no row. See calculate for examples with options. Person.minimum(:age) => 7 | def minimum(column_name)
calculate(:minimum, column_name)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def min(column)\n _all_with_present_column(column).min\n end",
"def min(args)\n col = column field: args[:field]\n col.map! {|item| item = item.to_f} \n col.min\n end",
"def min(attr)\n column(attr).min\n end",
"def get_min()\n @data.min\n end",
"def ... | [
"0.80278295",
"0.79727817",
"0.79599094",
"0.70214087",
"0.70161986",
"0.6862306",
"0.67386323",
"0.6722003",
"0.6711711",
"0.6696324",
"0.66915125",
"0.663722",
"0.6621367",
"0.6616968",
"0.6611135",
"0.65922457",
"0.65894884",
"0.6576366",
"0.65665114",
"0.6523344",
"0.6507... | 0.8268641 | 0 |
Same as minimum but perform the query asynchronously and returns an ActiveRecord::Promise | def async_minimum(column_name)
async.minimum(column_name)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def find_min()\r\n self.min\r\n end",
"def get_min()\n # O(1) time\n @min.last\n end",
"def lowest_student_gpa\n \"SELECT MIN(gpa) FROM students\"\nend",
"def oldest(constraints = {})\n constraints.merge!(order: :created_at.asc)\n _q = query(constraints)\n _q.define_singleton... | [
"0.5744234",
"0.5733445",
"0.5683802",
"0.5457232",
"0.54498786",
"0.5439021",
"0.54343444",
"0.5344327",
"0.5337682",
"0.5315812",
"0.5305487",
"0.5303429",
"0.5288761",
"0.52610934",
"0.5255177",
"0.52475387",
"0.52416587",
"0.523488",
"0.5215397",
"0.5209032",
"0.51844305"... | 0.7292647 | 0 |
Calculates the maximum value on a given column. The value is returned with the same data type of the column, or +nil+ if there's no row. See calculate for examples with options. Person.maximum(:age) => 93 | def maximum(column_name)
calculate(:maximum, column_name)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def max(attr)\n column(attr).max\n end",
"def max(args)\n col = column field: args[:field]\n col.map! {|item| item = item.to_f} \n col.max\n end",
"def max(column)\n _all_with_present_column(column).max\n end",
"def max_value(table_name, column_name)\n ... | [
"0.7988431",
"0.7961002",
"0.79240566",
"0.77619857",
"0.755031",
"0.69626755",
"0.68912166",
"0.68822396",
"0.6876943",
"0.6874555",
"0.6835841",
"0.681519",
"0.6812449",
"0.68052596",
"0.6793194",
"0.6715649",
"0.6711083",
"0.66858816",
"0.66575557",
"0.66409886",
"0.663825... | 0.80665714 | 0 |
Same as maximum but perform the query asynchronously and returns an ActiveRecord::Promise | def async_maximum(column_name)
async.maximum(column_name)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def calculate_latest_submissions\n max_version_subquery = \"SELECT * FROM (SELECT MAX(version), course_user_datum_id\n FROM `submissions`\n WHERE assessment_id = #{id} AND ignored = FALSE\n GROUP BY course_user_datum_id) AS x\"\n ... | [
"0.5775883",
"0.5580071",
"0.55321914",
"0.5442837",
"0.5436593",
"0.53789496",
"0.53772753",
"0.5294841",
"0.5290199",
"0.5259959",
"0.5196192",
"0.51851493",
"0.51657784",
"0.516499",
"0.5159016",
"0.51292676",
"0.5123591",
"0.51186675",
"0.51104236",
"0.5088175",
"0.507164... | 0.7333761 | 0 |
Same as sum but perform the query asynchronously and returns an ActiveRecord::Promise | def async_sum(identity_or_column = nil)
async.sum(identity_or_column)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def record_sum(session, record_type, database)\n session.send(database).select_one( \\\n \"select sum(number1) + sum(number2) + sum(number3) + sum(number4) as sum\n from big_scan where diff_type = '#{record_type}'\")['sum'].to_f\n end",
"def calculate(operation, column_name)\n operation =... | [
"0.591459",
"0.58025765",
"0.5746341",
"0.56798476",
"0.56798476",
"0.56158334",
"0.55061966",
"0.545525",
"0.54466367",
"0.5435918",
"0.54290265",
"0.53577954",
"0.53356",
"0.53315973",
"0.5273493",
"0.5221661",
"0.5211997",
"0.5177458",
"0.5129632",
"0.51146936",
"0.5112505... | 0.74440587 | 0 |
This calculates aggregate values in the given column. Methods for count, sum, average, minimum, and maximum have been added as shortcuts. Person.calculate(:count, :all) The same as Person.count Person.average(:age) SELECT AVG(age) FROM people... Selects the minimum age for any family without any minors Person.group(:la... | def calculate(operation, column_name)
operation = operation.to_s.downcase
if @none
case operation
when "count", "sum"
result = group_values.any? ? Hash.new : 0
return @async ? Promise::Complete.new(result) : result
when "average", "minimum", "maximum"
r... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sum(column)\n result = all\n\n if result.any?\n result.inject(0.0) do |acc, record|\n if value = record.public_send(column)\n acc += value\n end\n\n acc\n end\n end\n end",
"def s... | [
"0.6312181",
"0.5965439",
"0.5858012",
"0.58323276",
"0.57973707",
"0.57532007",
"0.5661123",
"0.5625472",
"0.55592465",
"0.5552942",
"0.55311996",
"0.54411584",
"0.5381846",
"0.536721",
"0.5345193",
"0.52855587",
"0.52511686",
"0.52275676",
"0.5203544",
"0.51965743",
"0.5191... | 0.6134351 | 1 |
Use pluck as a shortcut to select one or more attributes without loading an entire record object per row. Person.pluck(:name) instead of Person.all.map(&:name) Pluck returns an Array of attribute values typecasted to match the plucked column names, if they can be deduced. Plucking an SQL fragment returns String values ... | def pluck(*column_names)
return [] if @none
if loaded? && all_attributes?(column_names)
result = records.pluck(*column_names)
if @async
return Promise::Complete.new(result)
else
return result
end
end
if has_include?(column_names.first)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pluck(column_name)\n merge_array([\"$pluck\", [column_name.to_s]])\n map { |r| r.send(column_name.to_sym) }\n end",
"def pluck(name)\n map { |t| t[name] }\n end",
"def pluck(*columns)\n fail ArgumentError, 'No columns specified for Query#pluck' if columns.size.zero?\n\n ... | [
"0.73665416",
"0.73337096",
"0.7298219",
"0.7228862",
"0.7130534",
"0.69548666",
"0.68428504",
"0.67168826",
"0.65780044",
"0.6573343",
"0.646296",
"0.63349944",
"0.6244439",
"0.6131515",
"0.60042065",
"0.5932946",
"0.58840156",
"0.5862882",
"0.5838078",
"0.57468736",
"0.5649... | 0.7516116 | 0 |
Same as pluck but perform the query asynchronously and returns an ActiveRecord::Promise | def async_pluck(*column_names)
async.pluck(*column_names)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pluck(*column_names)\n return [] if @none\n\n if loaded? && all_attributes?(column_names)\n result = records.pluck(*column_names)\n if @async\n return Promise::Complete.new(result)\n else\n return result\n end\n end\n\n if has_include?(column_na... | [
"0.72998756",
"0.68385845",
"0.64958185",
"0.6487218",
"0.62413484",
"0.596295",
"0.5930414",
"0.57285315",
"0.56897277",
"0.5619563",
"0.55649126",
"0.55202496",
"0.54578054",
"0.5420883",
"0.54006255",
"0.53791386",
"0.5354856",
"0.53156954",
"0.52780575",
"0.52760834",
"0.... | 0.76475996 | 0 |
Pick the value(s) from the named column(s) in the current relation. This is shorthand for relation.limit(1).pluck(column_names).first, and is primarily useful when you have a relation that's already narrowed down to a single row. Just like pluck, pick will only load the actual value, not the entire record object, so it... | def pick(*column_names)
if loaded? && all_attributes?(column_names)
result = records.pick(*column_names)
return @async ? Promise::Complete.new(result) : result
end
limit(1).pluck(*column_names).then(&:first)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pluck(*columns)\n fail ArgumentError, 'No columns specified for Query#pluck' if columns.size.zero?\n\n query = return_query(columns)\n columns = query.response.columns\n\n if columns.size == 1\n column = columns[0]\n query.map { |row| row[column] }\n else\n ... | [
"0.68192977",
"0.6554405",
"0.6462056",
"0.6354714",
"0.62995535",
"0.62829036",
"0.62457407",
"0.5963593",
"0.58643395",
"0.56886715",
"0.5661968",
"0.5649603",
"0.5627481",
"0.5615555",
"0.5595623",
"0.5537795",
"0.54360074",
"0.5402875",
"0.53860325",
"0.5380074",
"0.53757... | 0.77229655 | 0 |
Same as pick but perform the query asynchronously and returns an ActiveRecord::Promise | def async_pick(*column_names)
async.pick(*column_names)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pick(*column_names)\n if loaded? && all_attributes?(column_names)\n result = records.pick(*column_names)\n return @async ? Promise::Complete.new(result) : result\n end\n\n limit(1).pluck(*column_names).then(&:first)\n end",
"def async_lookup args\n unless Hash === args\... | [
"0.6451383",
"0.6228038",
"0.62044704",
"0.5987701",
"0.5839192",
"0.534773",
"0.5245327",
"0.5233414",
"0.5173465",
"0.51208097",
"0.5100011",
"0.5082961",
"0.50784767",
"0.50784767",
"0.5074259",
"0.5069922",
"0.50564957",
"0.5028578",
"0.50239676",
"0.50180995",
"0.5014732... | 0.6798223 | 0 |
GET /qx/take_offs GET /qx/take_offs.json | def index
# @qx_take_offs = Qx::TakeOff.all
per_page = params[:per_page] || 100
@q = Qx::TakeOff.ransack(params[:q])
@qx_take_offs = @q.result().paginate(:page => params[:page], :per_page => per_page)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_qx_take_off\n @qx_take_off = Qx::TakeOff.find(params[:id])\n end",
"def qx_take_off_params\n params.require(:qx_take_off).permit(:airport_id, :runway, :aircraft_type, :hirl_rcls, :hirl, :hirl_rcls_stop, :lights)\n end",
"def client_choose(offset = 10, limit = 20)\n response = Net::HTTP... | [
"0.6381655",
"0.5682251",
"0.55859435",
"0.54620636",
"0.5439219",
"0.5405428",
"0.53818953",
"0.5358595",
"0.5263549",
"0.5156631",
"0.51341677",
"0.51270944",
"0.5113039",
"0.5068326",
"0.5066294",
"0.5064037",
"0.5054704",
"0.5027866",
"0.50010014",
"0.5000613",
"0.4991291... | 0.6435972 | 0 |
POST /qx/take_offs POST /qx/take_offs.json | def create
runway = qx_take_off_params[:runway].split("/")
runway.each do |item|
qx_take_off_params[:runway_id] = Qx::Runway.get_runay_id(qx_take_off_params[:airport_id], item)
@qx_take_off = Qx::TakeOff.new(qx_take_off_params)
end
p runway
respond_to do |format|
if @qx_take_off... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_qx_take_off\n @qx_take_off = Qx::TakeOff.find(params[:id])\n end",
"def qx_take_off_params\n params.require(:qx_take_off).permit(:airport_id, :runway, :aircraft_type, :hirl_rcls, :hirl, :hirl_rcls_stop, :lights)\n end",
"def update\n respond_to do |format|\n if @qx_take_off.upda... | [
"0.62888044",
"0.62379766",
"0.5595522",
"0.5462763",
"0.5343938",
"0.52733797",
"0.51407516",
"0.5062816",
"0.5062299",
"0.5022074",
"0.49795154",
"0.49691406",
"0.49611592",
"0.49168292",
"0.49149147",
"0.4893492",
"0.48847798",
"0.4867671",
"0.4867671",
"0.48537987",
"0.48... | 0.63028187 | 0 |
PATCH/PUT /qx/take_offs/1 PATCH/PUT /qx/take_offs/1.json | def update
respond_to do |format|
if @qx_take_off.update(qx_take_off_params)
format.html { redirect_to @qx_take_off, notice: 'Take off was successfully updated.' }
format.json { render :show, status: :ok, location: @qx_take_off }
else
format.html { render :edit }
format.j... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @kickoff = Kickoff.find(params[:id])\n\n respond_to do |format|\n if @kickoff.update_attributes(params[:kickoff])\n format.html { redirect_to @kickoff, notice: 'Kickoff was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render ac... | [
"0.61186934",
"0.60202146",
"0.5990585",
"0.5884832",
"0.5873944",
"0.5863343",
"0.5852479",
"0.58492684",
"0.58492684",
"0.58492684",
"0.58492684",
"0.5827921",
"0.58020145",
"0.5784272",
"0.57669574",
"0.5726589",
"0.5726461",
"0.5709916",
"0.5709825",
"0.5709825",
"0.57098... | 0.70002294 | 0 |
DELETE /qx/take_offs/1 DELETE /qx/take_offs/1.json | def destroy
@qx_take_off.destroy
respond_to do |format|
format.html { redirect_to qx_take_offs_url, notice: 'Take off was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_del\n header 'Content-Type', 'application/json'\n\n data = File.read 'sample-traces/0.json'\n post('/traces', data, 'CONTENT_TYPE': 'application/json')\n\n id = last_response.body\n\n delete \"/traces/#{id}\"\n assert last_response.ok?\n\n get \"/traces/#{id}\"\n\n contents = JSON.... | [
"0.6665254",
"0.6639267",
"0.64180845",
"0.6404461",
"0.63492167",
"0.63488585",
"0.62898624",
"0.6282538",
"0.6251904",
"0.6247144",
"0.62224615",
"0.6197994",
"0.61745656",
"0.6173084",
"0.61641586",
"0.61477196",
"0.61431575",
"0.6116767",
"0.6110208",
"0.6104028",
"0.6102... | 0.713365 | 0 |
GET /host_states GET /host_states.json | def index
@host_states = HostState.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_states\n perform(:get, 'enum/states', nil, nonauth_headers).body\n end",
"def device_states_list\n get \"deviceStates\"\n end",
"def index\n @api_states = Api::State.all\n end",
"def index\n @project_states = ProjectState.all\n json_response(@project_states)\n end",
"def ... | [
"0.730695",
"0.70312136",
"0.7012061",
"0.6694319",
"0.6684666",
"0.6555589",
"0.6412258",
"0.63435274",
"0.63435274",
"0.63435274",
"0.63435274",
"0.63435274",
"0.6295455",
"0.6283629",
"0.6279372",
"0.62609327",
"0.61760485",
"0.6172597",
"0.6142149",
"0.61174744",
"0.61124... | 0.7808806 | 0 |
POST /host_states POST /host_states.json | def create
@host_state = HostState.new(host_state_params)
respond_to do |format|
if @host_state.save
format.html { redirect_to @host_state, notice: 'Host state was successfully created.' }
format.json { render :show, status: :created, location: @host_state }
else
format.html... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def host_state_params\n params.require(:host_state).permit(:name)\n end",
"def create\n @project_states = ProjectState.create!(project_state_params)\n json_response(@project_states, :created)\n end",
"def index\n @host_states = HostState.all\n end",
"def create\n @api_state = Api::State... | [
"0.654604",
"0.63822395",
"0.6341647",
"0.6176897",
"0.6072829",
"0.60607713",
"0.60364217",
"0.59012187",
"0.589734",
"0.584827",
"0.58350354",
"0.58149356",
"0.57847863",
"0.57847863",
"0.5740959",
"0.57045966",
"0.56913495",
"0.56911147",
"0.5685016",
"0.56608015",
"0.5640... | 0.728463 | 0 |
PATCH/PUT /host_states/1 PATCH/PUT /host_states/1.json | def update
respond_to do |format|
if @host_state.update(host_state_params)
format.html { redirect_to @host_state, notice: 'Host state was successfully updated.' }
format.json { render :show, status: :ok, location: @host_state }
else
format.html { render :edit }
format.jso... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @api_state = Api::State.find(params[:id])\n\n if @api_state.update(api_state_params)\n head :no_content\n else\n render json: @api_state.errors, status: :unprocessable_entity\n end\n end",
"def doUpdate(startState)\n if (new_resource.rackID.nil? || new_resource.rackID.empty?)... | [
"0.6497511",
"0.64649504",
"0.6267247",
"0.60965145",
"0.6086928",
"0.6080035",
"0.5969168",
"0.5969168",
"0.5962687",
"0.5962687",
"0.5962687",
"0.59392345",
"0.593494",
"0.58545715",
"0.581591",
"0.5802865",
"0.5795398",
"0.57630813",
"0.57114613",
"0.5705047",
"0.5684276",... | 0.7084269 | 0 |
DELETE /host_states/1 DELETE /host_states/1.json | def destroy
@host_state.destroy
respond_to do |format|
format.html { redirect_to host_states_url, notice: 'Host state was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @state.destroy\n respond_to do |format|\n format.html { redirect_to states_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @state = State.find(params[:id])\n @state.destroy\n\n respond_to do |format|\n format.html { redirect_to states_url }\n ... | [
"0.7050063",
"0.69603527",
"0.69603527",
"0.6844968",
"0.682533",
"0.682533",
"0.6792103",
"0.67317134",
"0.6710184",
"0.6671888",
"0.6667248",
"0.6662834",
"0.6634493",
"0.6606606",
"0.65867525",
"0.6580446",
"0.6539016",
"0.65047234",
"0.64885247",
"0.64866644",
"0.6475302"... | 0.7547102 | 0 |
GET /warehouse_lists GET /warehouse_lists.xml | def index
@warehouse_lists = get_warehouse_lists(:page => params[:page])
respond_to do |format|
format.html # index.html.erb
format.xml { render :xml => @warehouse_lists }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @warehouse_list = WarehouseList.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @warehouse_list }\n end\n end",
"def index\n @list = List.find(params[:list_id])\n @list_items = @list.list_items.find(:all)\n\n respon... | [
"0.7143045",
"0.68311036",
"0.6796568",
"0.66165483",
"0.6465858",
"0.64015865",
"0.63735044",
"0.6365254",
"0.6299561",
"0.6297443",
"0.6289316",
"0.6277761",
"0.61959577",
"0.6194372",
"0.6188527",
"0.61832726",
"0.61490804",
"0.61489165",
"0.6148731",
"0.6147261",
"0.61342... | 0.78969884 | 0 |
GET /warehouse_lists/1 GET /warehouse_lists/1.xml | def show
@warehouse_list = WarehouseList.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.xml { render :xml => @warehouse_list }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @warehouse_lists = get_warehouse_lists(:page => params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @warehouse_lists }\n end\n end",
"def index\n @list = List.find(params[:list_id])\n @list_items = @list.list_items.find(:al... | [
"0.78040993",
"0.6989726",
"0.67724437",
"0.6578505",
"0.6502015",
"0.64768416",
"0.6421959",
"0.64177686",
"0.6362747",
"0.63504845",
"0.6283207",
"0.626409",
"0.62463486",
"0.62199175",
"0.62149996",
"0.6178516",
"0.61613166",
"0.61356306",
"0.6131409",
"0.6109113",
"0.6082... | 0.74691695 | 1 |
Iterates until reaches coordinate | def each_until(coordinate)
raise UnexpectedUntilCoordinate if coordinate < self
(y_param..coordinate.y).each do |j|
(x_param..coordinate.x).each do |i|
yield(Coordinate.new(i, j))
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def loop\n measurement = yield @position\n\n while true do\n position = control measurement\n\n measurement = yield position\n end\n end",
"def get_next_coords_with_check(rv_inst)\n x, y = next_step(rv_inst)\n return false unless within_boundary?(x, y)\n [x, y]\n end",
"def each\n... | [
"0.6523282",
"0.6360793",
"0.6354928",
"0.63234884",
"0.63194156",
"0.631505",
"0.6284666",
"0.6135726",
"0.60872346",
"0.6002506",
"0.5974839",
"0.5931942",
"0.58962446",
"0.5892695",
"0.58629024",
"0.5848547",
"0.5833824",
"0.5828226",
"0.5788702",
"0.577835",
"0.57647467",... | 0.7370368 | 0 |
def user_project_participation(project_id) self.participants.where(project_id: project_id).first end | def current_project_participant(project_id)
# if self.has_accepted?(project_id)
Participant.where(project_id: project_id, user_id: self.id).first
# end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def project_membership_for(project)\n ProjectMembership.where(:user_id => self.id , :project_id => project.id ).first\n end",
"def set_project_participant\n @project_participant = ProjectParticipant.find(params[:id])\n end",
"def team_member_by_id(user_id)\n users_projects.find_by_user_id(user_i... | [
"0.73596805",
"0.6996389",
"0.6979085",
"0.69536024",
"0.6896722",
"0.67803675",
"0.674018",
"0.66495156",
"0.66357595",
"0.6621383",
"0.65551883",
"0.6523127",
"0.6487788",
"0.6459968",
"0.6458519",
"0.64512056",
"0.6442027",
"0.6372113",
"0.6370301",
"0.6370301",
"0.6363528... | 0.8785469 | 0 |
POST /electronic_prescriptions POST /electronic_prescriptions.json | def create
electronic_prescription_params[:status] = electronic_prescription_params[:status].to_i
@electronic_prescription = ElectronicPrescription.new(electronic_prescription_params)
respond_to do |format|
if @electronic_prescription.save
format.html { redirect_to @electronic_prescription, ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_electronic_prescription\n @electronic_prescription = ElectronicPrescription.find(params[:id])\n end",
"def create\n @patient = Patient.find(params[:patient_id])\n @prescription = @patient.prescriptions.build(prescription_params)\n @prescription.formulary_status = FORMULARY_STATUSES.sampl... | [
"0.6454775",
"0.6200591",
"0.61784387",
"0.57580733",
"0.57375103",
"0.56991684",
"0.5672648",
"0.56177115",
"0.56099194",
"0.55871487",
"0.5541126",
"0.55156654",
"0.5419449",
"0.5417522",
"0.5398359",
"0.5385897",
"0.53522325",
"0.53424793",
"0.5315568",
"0.5310835",
"0.530... | 0.6846904 | 0 |
PATCH/PUT /electronic_prescriptions/1 PATCH/PUT /electronic_prescriptions/1.json | def update
electronic_prescription_params[:status] = electronic_prescription_params[:status].to_i
respond_to do |format|
if @electronic_prescription.update(electronic_prescription_params)
format.html { redirect_to @electronic_prescription, notice: 'Electronic prescription was successfully update... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_electronic_prescription\n @electronic_prescription = ElectronicPrescription.find(params[:id])\n end",
"def update\n respond_to do |format|\n if @prescription.update(prescription_params)\n format.html { redirect_to @prescription, notice: 'Prescription was successfully updated.' }\n ... | [
"0.5922881",
"0.58994466",
"0.585252",
"0.58353597",
"0.58185875",
"0.5803188",
"0.5802312",
"0.5777868",
"0.5719064",
"0.5700488",
"0.56282824",
"0.5626181",
"0.56121945",
"0.5609578",
"0.5609193",
"0.55819356",
"0.5573889",
"0.5572505",
"0.5549453",
"0.5548523",
"0.55394995... | 0.65522915 | 0 |
DELETE /electronic_prescriptions/1 DELETE /electronic_prescriptions/1.json | def destroy
@electronic_prescription.destroy
respond_to do |format|
format.html { redirect_to electronic_prescriptions_url, notice: 'Electronic prescription was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete\n client.delete(\"/#{id}\")\n end",
"def destroy\n @prescription.destroy\n respond_to do |format|\n format.html { redirect_to prescriptions_url, notice: 'Prescription was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete_aos_version(a... | [
"0.66685146",
"0.66485566",
"0.66148996",
"0.65510267",
"0.65432596",
"0.65199184",
"0.6503917",
"0.64740396",
"0.6459258",
"0.64404917",
"0.6439363",
"0.64307564",
"0.6426494",
"0.6418418",
"0.6417049",
"0.64164597",
"0.6397672",
"0.63815844",
"0.63809764",
"0.63780427",
"0.... | 0.7207343 | 0 |
Greet displays a greeting. | def greet
puts '------------------------'
puts "Greetings to you #{@name}"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def greet\n separator\n puts \"Welcome to #{pastel.bright_cyan('Groupie')}.\"\n puts \"Keep up with your favorite bands, never miss a show!\"\n puts \"Type #{pastel.bright_cyan('concerts')} to get started.\"\n separator\n end",
"def greet\n separator\n puts \"Welcome to #{pastel.bright_cyan... | [
"0.80120677",
"0.80120677",
"0.7954985",
"0.791066",
"0.79105985",
"0.7864962",
"0.77740765",
"0.77100253",
"0.76761246",
"0.764491",
"0.7588278",
"0.7587949",
"0.75714904",
"0.75714904",
"0.75493693",
"0.74946696",
"0.7472094",
"0.74581087",
"0.7372165",
"0.73680884",
"0.733... | 0.8350204 | 0 |
Joke displays a joke. | def joke
puts "#{@name} here is a joke for you:"
puts ''
puts "Teacher: Anyone who thinks he's stupid may stand up!"
puts ''
puts 'Nobody stands up'
puts ''
puts 'Teacher: Im sure there are some stupid students over here!!'
puts ''
puts 'Little Johnny stands up'
puts ''
puts ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n\t\t@joke = Joke.find(params[:id])\n\tend",
"def show\n @joke = Joke.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @joke }\n end\n end",
"def joke; end",
"def set_joke\n @joke = Joke.find(params[:id])\n end",
... | [
"0.73874974",
"0.6765242",
"0.6705981",
"0.6505746",
"0.6505746",
"0.6357412",
"0.63181466",
"0.6234914",
"0.622758",
"0.62187207",
"0.6072637",
"0.602608",
"0.5950052",
"0.58317834",
"0.571904",
"0.5716257",
"0.5625925",
"0.5597951",
"0.55358344",
"0.55128044",
"0.5499703",
... | 0.6988611 | 1 |
GET /splits GET /splits.json | def index
@splits = Split.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def stock_splits_with_http_info(symbol, from, to, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: DefaultApi.stock_splits ...'\n end\n # verify the required parameter 'symbol' is set\n if @api_client.config.client_side_validation && symbol.nil... | [
"0.6231144",
"0.60699904",
"0.6005092",
"0.6005092",
"0.5919354",
"0.5505157",
"0.542354",
"0.5385456",
"0.5378271",
"0.529883",
"0.52949107",
"0.5273118",
"0.52076787",
"0.520723",
"0.52013344",
"0.5185526",
"0.51850635",
"0.51794523",
"0.51708585",
"0.5166124",
"0.51606214"... | 0.65537053 | 0 |
POST /splits POST /splits.json | def create
@split = Split.new(split_params)
respond_to do |format|
if @split.save
format.html { redirect_to @split, notice: 'Split was successfully created.' }
format.json { render :show, status: :created, location: @split }
else
format.html { render :new }
format.js... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @test_split = TestSplit.new(test_split_params)\n\n respond_to do |format|\n if @test_split.save\n format.html { redirect_to @test_split, notice: 'Test split was successfully created.' }\n format.json { render :show, status: :created, location: @test_split }\n else\n ... | [
"0.6476602",
"0.63241184",
"0.618205",
"0.6164083",
"0.573422",
"0.56279194",
"0.559353",
"0.55533266",
"0.5549331",
"0.5482597",
"0.532622",
"0.5202808",
"0.52014714",
"0.51888865",
"0.51056457",
"0.51000106",
"0.5061213",
"0.50597984",
"0.5024198",
"0.5017644",
"0.50047326"... | 0.6598925 | 0 |
PATCH/PUT /splits/1 PATCH/PUT /splits/1.json | def update
respond_to do |format|
if @split.update(split_params)
format.html { redirect_to @split, notice: 'Split was successfully updated.' }
format.json { render :show, status: :ok, location: @split }
else
format.html { render :edit }
format.json { render json: @split.e... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @split = Split.find(params[:id])\n\n respond_to do |format|\n if @split.update_attributes(params[:split])\n format.html { redirect_to(@split, :notice => 'Split was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\... | [
"0.6155166",
"0.6092165",
"0.5983275",
"0.59644645",
"0.58819485",
"0.58766145",
"0.57270175",
"0.55355525",
"0.551988",
"0.5509019",
"0.54922634",
"0.5476285",
"0.54658496",
"0.54658496",
"0.54658496",
"0.54610956",
"0.54610956",
"0.54610956",
"0.54610956",
"0.5455925",
"0.5... | 0.62421286 | 0 |
DELETE /splits/1 DELETE /splits/1.json | def destroy
@split.destroy
respond_to do |format|
format.html { redirect_to splits_url, notice: 'Split was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @split = Split.find(params[:id])\n @split.destroy\n\n respond_to do |format|\n format.html { redirect_to(splits_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @item_split.destroy\n respond_to do |format|\n format.html { redirect_to item_splits_url }... | [
"0.68012905",
"0.65741265",
"0.645117",
"0.6365106",
"0.620803",
"0.6162729",
"0.6156314",
"0.6150774",
"0.6146079",
"0.6134942",
"0.60868806",
"0.6068242",
"0.59982467",
"0.59869677",
"0.59481984",
"0.59379613",
"0.5935878",
"0.5928589",
"0.59187114",
"0.59006506",
"0.589829... | 0.66208994 | 1 |
Fetch recordings from their sources to local paths | def fetch
@recordings.map do |uri, path|
STDERR.puts("# Fetching #{uri} to #{path}")
fetch = Mixlib::ShellOut.new(
"curl --continue-at - --output #{path} #{uri}",
live_stream: STDERR
)
fetch.run_command
{
path: path,
result: fetch.exi... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_remote_files\n manager = @current_source.file_manager\n manager.start do \n @current_source.folders.each do |folder|\n @files[folder] = manager.find_files folder\n @files[folder] = @files[folder].take(@take) if @take\n Logger.<<(__FILE__... | [
"0.6627812",
"0.63842523",
"0.63178474",
"0.6213546",
"0.6194053",
"0.60738885",
"0.58785415",
"0.5864768",
"0.5858369",
"0.58271086",
"0.57969624",
"0.57946855",
"0.5767589",
"0.5754805",
"0.5730557",
"0.5719597",
"0.5674711",
"0.56639427",
"0.5632406",
"0.56231606",
"0.5609... | 0.6591445 | 1 |
Load configuration from `path`. It should be a YAMLformatted file with this content: `base_uri`: the base URI common to all recordings `base_path`: the base local path common to all recordings `file_pattern`: a pattern to construct each file's name, in `format`'s format. The format may vary yeartoyear. `recordings`: a ... | def load_config(path)
# Read and parse the YAML configuration file
config = YAML.safe_load(File.read(path))
recordings = []
# Build a hash whose keys are URIs and values are local file paths
# Iterate over the list of each speaker's recordings
config['recordings'].map do |speaker, ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def parse(path)\n YAML.load(File.read(path))\n end",
"def load_file(path)\n @configuration_data = YAML.load_file(path)[CONFIGURATION_KEY]\n end",
"def load!(path)\n settings = YAML.safe_load(ERB.new(File.new(path).read).result)['api']\n from_hash(settings) if settings.is_a? Hash\n ... | [
"0.64147174",
"0.6405994",
"0.6370983",
"0.6341235",
"0.6307997",
"0.6246298",
"0.616635",
"0.6074817",
"0.6064165",
"0.6048362",
"0.60279423",
"0.5988539",
"0.5932992",
"0.5883497",
"0.5875856",
"0.5869258",
"0.5860466",
"0.58380675",
"0.58353287",
"0.5823937",
"0.58114713",... | 0.7753792 | 0 |
PATCH/PUT /school_cycle_has_subjects/1 PATCH/PUT /school_cycle_has_subjects/1.json | def update
respond_to do |format|
if @school_cycle_has_subject.update(school_cycle_has_subject_params)
format.html { redirect_to ["asig",@school_cycle_has_subject], notice: 'School cycle has subject was successfully updated.' }
format.json { render :show, status: :ok, location: @school_cycle_h... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @manual_subject = Manual::Subject.find(params[:id])\n\n respond_to do |format|\n if @manual_subject.update_attributes(params[:manual_subject])\n format.html { redirect_to @manual_subject, notice: 'Subject was successfully updated.' }\n format.json { head :no_content }\n e... | [
"0.708378",
"0.7005787",
"0.69465834",
"0.6943446",
"0.6921974",
"0.6832406",
"0.6823597",
"0.68084157",
"0.6792497",
"0.6765972",
"0.6758409",
"0.66994804",
"0.6636598",
"0.6636386",
"0.6609275",
"0.6609275",
"0.65811723",
"0.65713036",
"0.655361",
"0.65315545",
"0.65271455"... | 0.73374045 | 0 |
DELETE /school_cycle_has_subjects/1 DELETE /school_cycle_has_subjects/1.json | def destroy
@school_cycle_has_subject.destroy
respond_to do |format|
format.html { redirect_to asig_school_cycle_has_subjects_path, notice: 'School cycle has subject was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @manual_subject = Manual::Subject.find(params[:id])\n @manual_subject.destroy\n\n respond_to do |format|\n format.html { redirect_to manual_subjects_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @university_subject.destroy\n respond_to do |format... | [
"0.7499838",
"0.7461394",
"0.7353867",
"0.7336008",
"0.73294383",
"0.7318542",
"0.73138005",
"0.72352684",
"0.72241604",
"0.71797633",
"0.7178253",
"0.71506447",
"0.7117193",
"0.70920557",
"0.7075181",
"0.7070072",
"0.7068816",
"0.704322",
"0.70381296",
"0.70363796",
"0.70278... | 0.78074205 | 0 |
Instance methods transform categories hash into nested objects for view simplicity | def categories
raw_categories.to_hashugar
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def categories\n Hash[self.class.catalogs.map { |fld, klass|\n name = fld.gsub(/_id$/, '_name');\n [fld, {:id => self.send(fld), :name => self.send(name)}] rescue nil\n }.reject {|cat| cat.nil?}]\n end",
"def extract_categories cats\n cats.inject Hash.new do |hash, tag|\n\... | [
"0.67276347",
"0.6575168",
"0.65098906",
"0.6462346",
"0.64343816",
"0.64003175",
"0.6368787",
"0.6296995",
"0.62545556",
"0.6230784",
"0.6230784",
"0.62003106",
"0.61347383",
"0.6066618",
"0.60473025",
"0.60440326",
"0.5909906",
"0.5891107",
"0.57944393",
"0.57944393",
"0.57... | 0.70369136 | 0 |
POST /ads POST /ads.json | def create
@ad = Ad.new(ad_params)
respond_to do |format|
if @ad.save
format.html { redirect_to @ad, notice: 'Ad was successfully created.' }
format.json { render :show, status: :created, location: @ad }
else
format.html { render :new }
format.json { render json: @ad... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @ad = Ad.new(ad_params)\n\n if @ad.save\n render :show, status: :created, location: @ad\n else\n render json: @ad.errors, status: :unprocessable_entity\n end\n end",
"def create\n fix_tokenized_input_params\n @ad = @org.ads.build(ad_params)\n\n respond_to do |format|\... | [
"0.71051663",
"0.70117784",
"0.69783634",
"0.6958402",
"0.687992",
"0.6796889",
"0.6729126",
"0.66890365",
"0.6644174",
"0.66278136",
"0.649528",
"0.64633185",
"0.64579415",
"0.6427978",
"0.64220244",
"0.6417364",
"0.63306385",
"0.63099897",
"0.6308368",
"0.62947494",
"0.6282... | 0.7014856 | 1 |
Todo: Anyone can write or view the list of reviews for a movie, but only an admin or the user who created a review should be allowed to edit or delete it Implement this by removing the edit and delete buttons on the reviewshow page except for Admins, and create a link on the user profile page to My Reviews. Create a ne... | def index
@reviews = @movie.reviews
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @reviews = current_user.reviews\n end",
"def my_reviews\n @owner = current_user\n @reviews = Review.find(:all, :conditions => [\"user_id = ?\", @owner.id])\n render :action => \"index\"\n end",
"def set_movie_review\n @movie_review = MovieReview.find(params[:id])\n end",
"de... | [
"0.6863232",
"0.6801164",
"0.6780731",
"0.67340565",
"0.67065465",
"0.6663382",
"0.6626354",
"0.6625354",
"0.6615033",
"0.6600781",
"0.6511863",
"0.6511863",
"0.64851224",
"0.64693564",
"0.64437056",
"0.64303917",
"0.6428562",
"0.64200634",
"0.6419192",
"0.64183176",
"0.64140... | 0.7156778 | 0 |
POST /numbers POST /numbers.json | def create
@number = Number.new(params[:number])
respond_to do |format|
if @number.save
format.json { render json: @number, status: :created }
else
format.json { render json: @number.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @num = Num.new(num_params)\n\n respond_to do |format|\n if @num.save\n format.html { redirect_to @num, notice: \"Num was successfully created.\" }\n format.json { render :show, status: :created, location: @num }\n else\n format.html { render :new, status: :unproces... | [
"0.6095283",
"0.6064746",
"0.5995411",
"0.5855993",
"0.57869804",
"0.5778158",
"0.57576627",
"0.57191694",
"0.56227565",
"0.5611352",
"0.55656797",
"0.5527828",
"0.5458485",
"0.54570806",
"0.54384583",
"0.5425506",
"0.53820324",
"0.53790694",
"0.5375236",
"0.5356631",
"0.5329... | 0.6475641 | 0 |
DELETE /numbers/1 DELETE /numbers/1.json | def destroy
@number = Number.where(:value => params[:number][:value]).first
@number.destroy
respond_to do |format|
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete\n client.delete(\"/#{id}\")\n end",
"def destroy\n @num.destroy\n respond_to do |format|\n format.html { redirect_to nums_url, notice: \"Num was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @number.destroy\n respond_to ... | [
"0.6984806",
"0.6934817",
"0.6903177",
"0.6854766",
"0.6800874",
"0.67897856",
"0.6745548",
"0.673172",
"0.67171174",
"0.66145045",
"0.66094214",
"0.6599608",
"0.65958166",
"0.65958166",
"0.6590628",
"0.6587603",
"0.6579372",
"0.6579372",
"0.6579372",
"0.6579372",
"0.6573329"... | 0.7314413 | 0 |
GET /contentperpages GET /contentperpages.json | def index
@contentperpages = Contentperpage.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pages\n project_size = Project.all.length\n\n puts project_size\n\n respond_to do |format|\n format.json {\n @pages = (project_size/10.0).ceil\n render :json => @pages \n }\n end\n end",
"def index\n respond_to do |format|\... | [
"0.74854624",
"0.69791067",
"0.67317206",
"0.67220896",
"0.66817164",
"0.6681638",
"0.6668635",
"0.66148823",
"0.66008604",
"0.65884984",
"0.65853417",
"0.65749717",
"0.65550464",
"0.65483326",
"0.6512134",
"0.6512056",
"0.6495431",
"0.64908034",
"0.6466655",
"0.646083",
"0.6... | 0.74143445 | 1 |
PATCH/PUT /contentperpages/1 PATCH/PUT /contentperpages/1.json | def update
respond_to do |format|
if @contentperpage.update(contentperpage_params)
format.html { redirect_to @contentperpage, notice: 'Contentperpage was successfully updated.' }
format.json { render :show, status: :ok, location: @contentperpage }
else
format.html { render :edit ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n authorize @page_content.page, :update?\n\n respond_to do |format|\n if @page_content.update(page_content_params)\n format.json { render :show, status: :ok, location: @page_content }\n else\n format.json { render json: @page_content.errors, status: :unprocessable_entity }\... | [
"0.6984614",
"0.67693335",
"0.67587143",
"0.66510755",
"0.65030694",
"0.64939773",
"0.6458537",
"0.64460236",
"0.6378556",
"0.634167",
"0.6336183",
"0.6332773",
"0.63246524",
"0.63081795",
"0.62519807",
"0.6249785",
"0.6232803",
"0.62251186",
"0.6208463",
"0.61989087",
"0.618... | 0.7100395 | 0 |
DELETE /contentperpages/1 DELETE /contentperpages/1.json | def destroy
@contentperpage.destroy
respond_to do |format|
format.html { redirect_to contentperpages_url, notice: 'Contentperpage was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete_page(id)\n @client.raw('delete', \"/content/pages/#{id}\")\n end",
"def destroy\n @page = current_cms.pages.find(params[:id])\n @page.destroy\n\n respond_to do |format|\n format.html { redirect_to(big_cms_pages_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n... | [
"0.7242123",
"0.7154377",
"0.7109982",
"0.7057982",
"0.7038644",
"0.7029839",
"0.7024557",
"0.7015564",
"0.7015564",
"0.7015564",
"0.7015564",
"0.7005398",
"0.69948715",
"0.69797426",
"0.69797426",
"0.69797426",
"0.69797426",
"0.69797426",
"0.69797426",
"0.69797426",
"0.69797... | 0.7574797 | 0 |
Adds authentication information to the request based on the challenge from the response. | def respond_to_challenge(request, response)
authenticate_header = response['www-authenticate'].downcase
authenticate_header.sub!(/^digest /, '')
@authentication_params = authenticate_header.split(", ").inject({}) { |h, field|
key, value = field.split("=")
h[key] = value.gsub(/^"|"$/, ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def challenge(request, response)\n auth = Http::Auth::Bearer.new(\n @realm,\n request,\n response\n )\n auth.require_login\n end",
"def challenge(req, res)\n res[@response_field] = \"#{@auth_scheme} realm=\\\"#{@realm}\\\"\"\... | [
"0.73826385",
"0.6834293",
"0.6728466",
"0.6561607",
"0.65466154",
"0.6543275",
"0.6372046",
"0.63232297",
"0.62966216",
"0.6267182",
"0.62235886",
"0.6153276",
"0.6144353",
"0.6096307",
"0.6031068",
"0.6009908",
"0.59887373",
"0.59194124",
"0.5912835",
"0.58936375",
"0.58906... | 0.7717408 | 0 |
Shorthand for "public && public_write" | def fully_public?
public && public_write
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def public_writer?\n options[:writer] == :public\n end",
"def public_write\n @public_write ||= public_write_was\n end",
"def public?\n !private\n end",
"def writable?() end",
"def public?\n self.mode == PUBLIC\n end",
"def writeable?\n !readonly?\n end",
"def public?\n ... | [
"0.7049207",
"0.69965374",
"0.69866514",
"0.6872203",
"0.6838355",
"0.6768611",
"0.6737977",
"0.6708214",
"0.66859204",
"0.6680215",
"0.66389877",
"0.6602248",
"0.6596751",
"0.6596751",
"0.6593567",
"0.65919363",
"0.65503883",
"0.6549893",
"0.6544702",
"0.6533534",
"0.6520825... | 0.81533474 | 0 |
Same as +format_name+ but with id tacked on. | def unique_format_name
string_with_id(format_name)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def unique_format_name\n format_name + \" (#{id || \"?\"})\"\n end",
"def unique_format_name\n display_name + \" (#{id || \"?\"})\"\n end",
"def unique_format_name\n title + \" (#{id || \"?\"})\"\n end",
"def unique_partial_format_name\n string_with_id(partial_format_name)\n end",
"def form... | [
"0.8623903",
"0.8175796",
"0.8014996",
"0.78277445",
"0.778792",
"0.74193877",
"0.74193877",
"0.7338339",
"0.72988826",
"0.7238947",
"0.72147614",
"0.71021295",
"0.7087537",
"0.7034134",
"0.703271",
"0.69954866",
"0.6799551",
"0.678007",
"0.6762309",
"0.67522067",
"0.67522067... | 0.8229673 | 1 |
Same as +partial_text_name+ but with id tacked on. | def unique_partial_text_name
string_with_id(partial_text_name)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def partial_text_name\n put_together_name(:part).t.html_to_ascii\n end",
"def text_id\n \"#{name} (##{id})\"\n end",
"def unique_text_name\n real_text_name + \" (#{id || \"?\"})\"\n end",
"def unique_text_name\n text_name + \" (#{id || \"?\"})\"\n end",
"def unique_text_name\n text_n... | [
"0.7489171",
"0.7369709",
"0.71538615",
"0.70609725",
"0.70609725",
"0.6977048",
"0.66406703",
"0.65177035",
"0.6517408",
"0.64556587",
"0.63567877",
"0.6286126",
"0.6286126",
"0.6286126",
"0.61330307",
"0.60118985",
"0.59641963",
"0.59144765",
"0.59062105",
"0.59052896",
"0.... | 0.79724365 | 0 |
Same as +partial_format_name+ but with id tacked on. | def unique_partial_format_name
string_with_id(partial_format_name)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def unique_format_name\n format_name + \" (#{id || \"?\"})\"\n end",
"def partial_format_name\n put_together_name(:part)\n end",
"def unique_format_name\n display_name + \" (#{id || \"?\"})\"\n end",
"def unique_format_name\n string_with_id(format_name)\n end",
"def unique_format_name\n ... | [
"0.79678214",
"0.7906469",
"0.7731711",
"0.758865",
"0.74807924",
"0.69325715",
"0.6918187",
"0.6901638",
"0.6901638",
"0.67789215",
"0.67576563",
"0.673776",
"0.65637577",
"0.6549228",
"0.65298337",
"0.6363199",
"0.6362516",
"0.6331806",
"0.6330905",
"0.63198966",
"0.6294971... | 0.8659818 | 0 |
Returns a Hash containing all the descriptive text fields. (See also the counterpart writermethod +all_notes=+.) | def all_notes
result = {}
self.class.all_note_fields.each do |field|
value = send(field).to_s
result[field] = value.presence
end
result
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def INFO_FIELDS\n %w(name created updated type ref user description comments)\n end",
"def descMetadata_display_fields\n [:identifier, :title, :alternative, :creator, :contributor, :description, :abstract,\n :toc, :publisher, :source, :date, :date_created, :date_copyrighted,\n :date_submitted,... | [
"0.6294499",
"0.6227788",
"0.6216737",
"0.61570185",
"0.61438",
"0.6032089",
"0.59499097",
"0.59088653",
"0.5904997",
"0.5897702",
"0.587941",
"0.5843357",
"0.58196956",
"0.581921",
"0.5804228",
"0.57735866",
"0.57711905",
"0.57700074",
"0.5764043",
"0.5763801",
"0.57572037",... | 0.64422196 | 0 |
Update all the descriptive text fields via Hash. hash = name.all_notes hash[:look_alikes] = "new value" name.all_notes = hash | def all_notes=(notes)
self.class.all_note_fields.each do |field|
send("#{field}=", notes[field])
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def notes=(value)\n @notes = value\n end",
"def notes=(value)\n @notes = value\n end",
"def notes=(value)\n @notes = value\n end",
"def notes=(value)\n @notes = value\n end",
"def update!(**args)\n ... | [
"0.588104",
"0.588104",
"0.588104",
"0.588104",
"0.5802742",
"0.57873756",
"0.5714335",
"0.56542444",
"0.55394685",
"0.5524737",
"0.55091524",
"0.5487705",
"0.54819363",
"0.54783964",
"0.5423867",
"0.5414819",
"0.5414819",
"0.5397254",
"0.5397254",
"0.537522",
"0.5366863",
... | 0.61266375 | 0 |
Find out how much descriptive text has been written for this object. Returns the number of fields filled in, and how many characters total. num_fields, total_length = name.note_status | def note_status
field_count = size_count = 0
all_notes.each_value do |v|
if v.present?
field_count += 1
size_count += v.strip_squeeze.length
end
end
[field_count, size_count]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def name_length\n name.length\n end",
"def length\n @fields.length\n end",
"def num_fields\n @fields.size\n end",
"def inspect_details\n\t\treturn %Q{%s -- %d headers, %0.2fK body (%p)} % [\n\t\t\tself.status_line,\n\t\t\tself.headers.length,\n\t\t\t(self.get_content_length / 1024.0),... | [
"0.5937865",
"0.59200543",
"0.5760106",
"0.5666546",
"0.5665476",
"0.5664266",
"0.56375414",
"0.56290567",
"0.5618939",
"0.5604621",
"0.5583017",
"0.5570458",
"0.5570094",
"0.5555435",
"0.5539693",
"0.553884",
"0.5536162",
"0.552772",
"0.54713106",
"0.54580325",
"0.5448924",
... | 0.71564275 | 0 |
Retreive object representing the source (if applicable). Presently, this only works for Project drafts and User's personal descriptions. All others return +nil+. | def source_object
case source_type
# (this may eventually be replaced with source_id)
when "project" then project
when "source" then nil # (haven't created "Source" model yet)
when "user" then user
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def source_object\n @source_object ||= load_source_object_from_params\n end",
"def source\n return @source\n end",
"def source\n return @source\n end",
"def source\n # force update if we only have part of source\n attrs.merge!(fetch) u... | [
"0.7247506",
"0.66357994",
"0.66357994",
"0.661893",
"0.6422995",
"0.6422995",
"0.62939125",
"0.62939125",
"0.6290268",
"0.62900406",
"0.62849873",
"0.62569153",
"0.6111213",
"0.6060943",
"0.6035761",
"0.5980306",
"0.5889795",
"0.5868077",
"0.58623666",
"0.58553004",
"0.58083... | 0.75499564 | 0 |
Does this Description belong to a given Project? | def belongs_to_project?(project)
(source_type == "project") &&
(project_id == project.id)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def project?(p)\r\n projects.include?(p)\r\n end",
"def has_project?\n !project_id.nil? && project.visible\n end",
"def is_for_project?\n not self.project.nil?\n end",
"def project?\n ! @project.nil?\n end",
"def project?\n true\n end",
"def project_exists?(name)\n pr... | [
"0.76962286",
"0.726558",
"0.70722294",
"0.7044041",
"0.6984354",
"0.6905717",
"0.68513834",
"0.6663294",
"0.6540573",
"0.6504762",
"0.64169717",
"0.6400738",
"0.63710165",
"0.637062",
"0.6315698",
"0.6297305",
"0.6282142",
"0.6281135",
"0.62582123",
"0.62500346",
"0.6199254"... | 0.7785322 | 0 |
List of all the writers for this description, as ids. | def writer_ids
group_user_ids(writers_join_table)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def writers\n find_related_frbr_objects( :is_written_by, :which_roles?) \n end",
"def index\n @writers = Writer.all\n end",
"def writers\n group_users(writers_join_table)\n end",
"def index\n @expert_writers = ExpertWriter.all\n end",
"def list_ids\n @documents.keys\n en... | [
"0.6417494",
"0.630041",
"0.6018598",
"0.5694543",
"0.5693277",
"0.56871736",
"0.56491023",
"0.5479413",
"0.5411642",
"0.5390456",
"0.5327604",
"0.52752316",
"0.5240123",
"0.5211612",
"0.51640105",
"0.51636523",
"0.5144273",
"0.5143399",
"0.51323634",
"0.5101834",
"0.5101291"... | 0.6702613 | 0 |
List of all the readers for this description, as ids. | def reader_ids
group_user_ids(readers_join_table)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def list_ids\n @documents.keys\n end",
"def index\n @readers = Reader.all\n end",
"def identifier_uris\n return @identifier_uris\n end",
"def readers\n group_users(readers_join_table)\n end",
"def all_readings\n @readings.map do |reading|\n [rea... | [
"0.61472845",
"0.6024501",
"0.59517485",
"0.5912843",
"0.58371985",
"0.58128726",
"0.5662913",
"0.5625332",
"0.55959505",
"0.5571755",
"0.5564738",
"0.55548733",
"0.5513426",
"0.54963195",
"0.54736215",
"0.54735345",
"0.5450988",
"0.54486924",
"0.5445581",
"0.5376282",
"0.537... | 0.66206783 | 0 |
Is a given user an writer for this description? | def writer?(user)
public_write || permitted?(writers_join_table, user)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def readable_by? user\n true\n end",
"def creatable_by?(creator)\n creator.administrator? || !administrator\n end",
"def canBeWrittenBy? user\n unless user.class == Modeles::User\n username = user.to_s\n user = Modeles::User.find_by_name username\n unless user\n @erro... | [
"0.73256534",
"0.7215667",
"0.71244144",
"0.70904756",
"0.7086124",
"0.7006786",
"0.69867325",
"0.6936943",
"0.6925994",
"0.6922083",
"0.6905442",
"0.69052166",
"0.68814886",
"0.6879818",
"0.6877545",
"0.68649095",
"0.68621093",
"0.6859863",
"0.6832547",
"0.67703986",
"0.6768... | 0.7896809 | 0 |
Is a given user an reader for this description? | def is_reader?(user)
public || permitted?(readers_join_table, user)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def read_by?(user)\n\t user and self.readers.find_by_id(user.id)\n end",
"def is_reviewer?(user)\n review_result = self.design_review_results.detect { |drr| drr.reviewer == user }\n review_result != nil\n end",
"def readable?(_user)\n true\n end",
"def readable_by? user\n true\n end",
"def... | [
"0.7935975",
"0.74457484",
"0.72876996",
"0.72351986",
"0.7111891",
"0.7111891",
"0.7111891",
"0.7100824",
"0.70548874",
"0.6968953",
"0.6940173",
"0.69332594",
"0.6913268",
"0.6814002",
"0.67558503",
"0.6684775",
"0.6677316",
"0.664605",
"0.65852547",
"0.6579565",
"0.653642"... | 0.76218224 | 1 |
Give a User or UserGroup writer privileges. | def add_writer(arg)
chg_permission(writers, arg, :add)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def permits_write_access_for(user)\n end",
"def writer?(user)\n public_write || permitted?(writers_join_table, user)\n end",
"def can_write=(value)\n set_privileges('d', value) unless value\n set_privileges('w', value)\n end",
"def user_can_write(user)\n if (self.writing? or self.rejec... | [
"0.6684174",
"0.6661647",
"0.6607145",
"0.6030306",
"0.5999047",
"0.58052886",
"0.5783605",
"0.57647496",
"0.5731121",
"0.57253546",
"0.57219595",
"0.5712993",
"0.5708839",
"0.5677376",
"0.5641599",
"0.5641154",
"0.5625049",
"0.56211215",
"0.56158066",
"0.5602194",
"0.558604"... | 0.7183148 | 0 |
Give a User or UserGroup reader privileges. | def add_reader(arg)
chg_permission(readers, arg, :add)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def assign_reader(user_id)\n add_user(user_id)\n end",
"def assign_reader(user_id)\n\t\tadd_user(user_id)\n\tend",
"def permits_read_acccess_for(user)\n end",
"def is_reader?(user)\n public || permitted?(readers_join_table, user)\n end",
"def grant_access(user_identifier)\n Scribd::Security... | [
"0.6733607",
"0.65807956",
"0.63644356",
"0.62446564",
"0.60599303",
"0.5910222",
"0.5858134",
"0.58206403",
"0.5796846",
"0.5728223",
"0.5716442",
"0.57161105",
"0.5694812",
"0.5605373",
"0.5599412",
"0.55444336",
"0.551846",
"0.5516621",
"0.54649436",
"0.54520494",
"0.54383... | 0.6599822 | 1 |
Revoke a User's or UserGroup's writer privileges. | def remove_writer(arg)
chg_permission(writers, arg, :remove)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def revoke_admin\n authorize! @user\n @user.roles = @user.roles - ['admin']\n @user.save\n redirect_to @user, notice: t('user.revoked_admin', name: @user.username)\n end",
"def revoke_privileges(role_name, privileges, options = nil)\n policy = create_policy(options, AdminPolicy, default_admin_p... | [
"0.6460848",
"0.62574023",
"0.6123704",
"0.61066264",
"0.5954562",
"0.5946864",
"0.5877412",
"0.5857137",
"0.5718096",
"0.565587",
"0.5617169",
"0.55969906",
"0.5582123",
"0.5581712",
"0.5563368",
"0.55628145",
"0.55310524",
"0.5528573",
"0.5485884",
"0.5480639",
"0.54636854"... | 0.67918736 | 0 |
Is the given User an author? | def author?(user)
authors.member?(user)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def author?(user)\n user && author.id == user.id\n end",
"def author?(user)\n self.user == user\n end",
"def current_user_is_author?\n current_user && current_user.is_author\n end",
"def has_author?(author)\n ret = false\n @authors.each{ |auth| ret = true if auth == author }\n ret\... | [
"0.89332795",
"0.8765247",
"0.83865756",
"0.8183136",
"0.80978",
"0.807365",
"0.80580676",
"0.7832285",
"0.77401567",
"0.76317245",
"0.7575179",
"0.7459884",
"0.7452254",
"0.7279688",
"0.7157843",
"0.7127489",
"0.702948",
"0.6986775",
"0.6982226",
"0.6972093",
"0.6970805",
... | 0.8925612 | 1 |
Is the given User an editor? | def editor?(user)
editors.member?(user)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def current_user_is_editor?(node)\n current_user_has_role?('editor', node)\n end",
"def edited_by?(user)\n return true if editors.include?(user)\n false\n end",
"def is_editor?\n role == \"editor\"\n end",
"def editor?\n has_role? :editor\n end",
"def editor?\n self[:editor] || ad... | [
"0.84314317",
"0.8376149",
"0.82757425",
"0.8126538",
"0.7926827",
"0.7918434",
"0.7855206",
"0.7744756",
"0.77002305",
"0.7697662",
"0.7608588",
"0.7578496",
"0.7545994",
"0.75184685",
"0.74401253",
"0.7428089",
"0.73473215",
"0.73250145",
"0.7292475",
"0.72890776",
"0.72637... | 0.90980387 | 0 |
Add a User on as an "author". Saves User if changed. Returns nothing. | def add_author(user)
return if authors.member?(user)
authors.push(user)
SiteData.update_contribution(:add, authors_join_table, user.id)
return unless editors.member?(user)
editors.delete(user)
SiteData.update_contribution(:del, editors_join_table, user.id)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_author\n add_author_editor \"author\"\n end",
"def add_author_or_editor\n return unless !@save_without_our_callbacks && (user = User.current)\n\n authors.empty? && author_worthy? ? add_author(user) : add_editor(user)\n end",
"def set_author\n @author = User.find(params[:id])\n ... | [
"0.74157155",
"0.7114053",
"0.68789184",
"0.6757846",
"0.6700198",
"0.6700198",
"0.6700198",
"0.6652552",
"0.65635043",
"0.65498966",
"0.65464115",
"0.65287846",
"0.65051913",
"0.6502722",
"0.650102",
"0.64896494",
"0.64849484",
"0.64849484",
"0.6482096",
"0.63033175",
"0.626... | 0.7802577 | 0 |
:section: Callbacks Callback that updates editors and/or authors after a User makes a change. If the Name has no author and they've made sufficient contributions, they get promoted to author by default. In all cases make sure the user is added on as an editor. | def add_author_or_editor
return unless !@save_without_our_callbacks && (user = User.current)
authors.empty? && author_worthy? ? add_author(user) : add_editor(user)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_editor(user)\n return unless !authors.member?(user) && !editors.member?(user)\n\n editors.push(user)\n SiteData.update_contribution(:add, editors_join_table, user.id)\n end",
"def add_author(user)\n return if authors.member?(user)\n\n authors.push(user)\n SiteData.update_contribution(:... | [
"0.6516556",
"0.64840055",
"0.6371271",
"0.62815714",
"0.6194216",
"0.61086464",
"0.6064158",
"0.606095",
"0.6017654",
"0.5987579",
"0.5984764",
"0.5870205",
"0.586114",
"0.586114",
"0.58566636",
"0.58293194",
"0.5824801",
"0.577044",
"0.57544994",
"0.5752118",
"0.5749067",
... | 0.67487556 | 0 |
returns only value part of value block | def value(block_num = nil)
v, _ = value_with_addr(block_num)
v
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def value\n @value ||= extract_value\n end",
"def process_field_value(value)\r\n value\r\n end",
"def raw_value; end",
"def parse_value; end",
"def get_value\n value\n end",
"def get_value\n value\n end",
"def value() end",
"def raw_value\n @value\n end",
"def value_read... | [
"0.6678275",
"0.64614433",
"0.64219344",
"0.63476545",
"0.6270926",
"0.6270926",
"0.62671334",
"0.6231581",
"0.62206393",
"0.6179265",
"0.61725265",
"0.6169654",
"0.61566406",
"0.61286974",
"0.60795116",
"0.6079091",
"0.6076884",
"0.60742074",
"0.60552114",
"0.6049564",
"0.60... | 0.67158556 | 0 |
The method should return the number of pairs of elements that sum to 0. | def pairs_to_zero(nums)
# Write your code here
c = []
a = nums.select { |n| c.push(n) if n < 0 }
nums.delete_if { |n| c.push(n) if n < 0 }
i = 0
pairs = 0
a = a.map { |n| n*-1 }
loop do
if nums.count(a[i]) > 0
pairs += 1
end
i += 1
break if i == ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pairs_to_zero(nums)\n\n count = 0\n newArr = []\n\n for i in 0..nums.length do\n for j in 1..nums.length do\n if nums[i].to_i + nums[j].to_i == 0\n count = count + 1\n end\n end\n end\n return count-2\nend",
"def opposite_count(nums)\n pairs = 0... | [
"0.80429035",
"0.777874",
"0.75099903",
"0.7424152",
"0.73820204",
"0.7309957",
"0.7276644",
"0.72716993",
"0.7233506",
"0.72101665",
"0.7209892",
"0.719596",
"0.71955144",
"0.7182001",
"0.71734196",
"0.7156854",
"0.7144943",
"0.70880026",
"0.7020093",
"0.7007946",
"0.6960717... | 0.78253675 | 1 |
subtract attrs_skip from attrs | def ext_attrs(values, attrs_skip = [])
result = values.except *attrs_always_skip
return result
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def skip_name\n @attributes[:skip_name]\n end",
"def exclude_attrs(hash, attrs, must_exclude, associations)\n exclude = attrs + associations + must_exclude\n hash.except(*exclude)\n end",
"def skipped_attributes\n if model.respond_to?(:skipped_alchemy_resource_attributes)\n ... | [
"0.6426769",
"0.61645734",
"0.6150883",
"0.60867596",
"0.6056458",
"0.6052449",
"0.599769",
"0.599769",
"0.59952945",
"0.5987856",
"0.595818",
"0.5899168",
"0.5884298",
"0.58841485",
"0.5859921",
"0.58376354",
"0.57960564",
"0.57952917",
"0.57867104",
"0.5779215",
"0.5773433"... | 0.774333 | 0 |
Run startup tasks, then start the functions framework server in the background. The startup tasks and target function will be looked up in the global registry. | def start target, &block
require "functions_framework/server"
if target.is_a? ::FunctionsFramework::Function
function = target
else
function = global_registry[target]
raise ::ArgumentError, "Undefined function: #{target.inspect}" if function.nil?
end
globals = funct... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def work\n Logger.info \"Starting work...\"\n execute_startup(connections) {|c| c.future.connect}\n execute_startup(devices) {|d| d.future.start_device}\n execute_working_code\n end",
"def start!\n message \"Launching minimum_instances\"\n launch_minimum_instances\n message ... | [
"0.60056525",
"0.59079665",
"0.58106196",
"0.57933325",
"0.5769415",
"0.57481724",
"0.57481724",
"0.57481724",
"0.5702265",
"0.5702265",
"0.5702265",
"0.5671864",
"0.5635277",
"0.5633227",
"0.5622795",
"0.558078",
"0.55694795",
"0.5569316",
"0.5560733",
"0.55540943",
"0.55186... | 0.7279588 | 0 |
Classlevel client class config. Note: late evaluation of `client_class` blocks allows us using classlevel configs in those blocks, e.g.: class ConfigurableOnClassLevel < Netzke::Base class_attribute :title self.title = "Default" client_class do |c| c.title = self.title end end ConfigurableOnClassLevel.title = "Overridd... | def client_class_config
return @client_class_config if @client_class_config
@client_class_config = Netzke::Core::ClientClassConfig.new(self, called_from)
(@configure_blocks || []).each do |block, dir|
@client_class_config.dir = dir
block&.call(@client_class_config)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_client_class(cls)\n @@client_class = cls\n end",
"def class_constant(superclass=nil, opts={}, &block)\n symc = ((opts && opts[:preserve]) ? (\"#{self.camelcase}Class\") : \"PoolParty#{self.camelcase}Class\").classify\n\n kla=<<-EOE\n class #{symc} #{\"< #{superclass}\" if superclas... | [
"0.6208662",
"0.5702407",
"0.55793685",
"0.55435836",
"0.5534328",
"0.5418085",
"0.5378345",
"0.53714126",
"0.52870744",
"0.52784985",
"0.5205428",
"0.51389766",
"0.5063481",
"0.5063053",
"0.5034326",
"0.5025482",
"0.5014208",
"0.4975403",
"0.49713236",
"0.49398336",
"0.49367... | 0.7153891 | 0 |
Hash containing configuration for all child components to be instantiated at the JS side | def js_components
@js_components ||= eagerly_loaded_components.inject({}) do |out, name|
instance = component_instance(name.to_sym)
out.merge(name => instance.js_config)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def js_extend_properties\n {\n :init_component => js_init_component.l\n }\n end",
"def initial_components\n {}\n end",
"def initialize(args, kwargs = nil)\n super(args, kwargs)\n client_config[:child_components] = child_components || []\n client_config... | [
"0.68288743",
"0.6606852",
"0.6599132",
"0.6599132",
"0.645475",
"0.6347905",
"0.61376214",
"0.5947426",
"0.5925811",
"0.5888696",
"0.583883",
"0.5829227",
"0.578068",
"0.5765497",
"0.57645583",
"0.57635915",
"0.5725941",
"0.5715021",
"0.56984115",
"0.5687548",
"0.56468475",
... | 0.6792842 | 1 |
All the JScode required by this instance of the component to be instantiated in the browser, excluding cached code. It includes JSclasses for the parents, eagerly loaded child components, and itself. | def js_missing_code(cached = [])
code = dependency_classes.inject('') do |r, k|
cached.include?(k.client_class_config.xtype) ? r : r + k.client_class_config.code_with_dependencies
end
code.blank? ? nil : Netzke::Core::DynamicAssets.minify_js(code)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def js_components\n @js_components ||= eagerly_loaded_components.inject({}) do |out, name|\n instance = component_instance(name.to_sym)\n out.merge(name => instance.js_config)\n end\n end",
"def js_extend_properties\n {\n :init_component => js_init_component.l\n ... | [
"0.6987342",
"0.62005204",
"0.59476984",
"0.57031167",
"0.56941164",
"0.5689748",
"0.56699264",
"0.55704015",
"0.5471457",
"0.5460117",
"0.53911954",
"0.53889585",
"0.53390664",
"0.5331553",
"0.5321037",
"0.53018314",
"0.5296758",
"0.5288552",
"0.5284311",
"0.52685255",
"0.52... | 0.630698 | 1 |
with the same values except the vowels removed remove_vowels(%w(abcdefghijklmnopqrstuvwxyz)) == %w(bcdfghjklmnpqrstvwxyz) remove_vowels(%w(green YELLOW black white)) == %w(grn YLLW blck wht) remove_vowels(%w(ABC AEIOU XYZ)) == ['BC', '', 'XYZ'] create method remove_vowels that takes an array called strings iterate with... | def remove_vowels(strings)
strings.map { |string| string.delete "aeiouAEIOU" }
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remove_vowels(strings)\n strings.map { |str| str.gsub(/[aeiou]/i, '')}\nend",
"def remove_vowels(strings)\n strings.map { |string| string.delete('aeiouAEIOU') }\nend",
"def remove_vowels(strings)\n strings.map { |string| string.delete('aeiouAEIOU') }\nend",
"def remove_vowels_simple(strings)\n string... | [
"0.8641376",
"0.8540051",
"0.8540051",
"0.85351545",
"0.8497217",
"0.84227705",
"0.8411659",
"0.8399283",
"0.838643",
"0.83858603",
"0.837722",
"0.83602464",
"0.8357461",
"0.83537096",
"0.83397967",
"0.83214515",
"0.8316907",
"0.8313133",
"0.830906",
"0.8306005",
"0.83025485"... | 0.8548237 | 1 |
Ask the influencer to link his twitter account | def link_twitter
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def twitter\n callback_from :twitter\n end",
"def twitter_link(player)\n if player.twitter_screen_name\n # clean up any bad characters in a player's twitter name\n twitter_user = player.twitter_screen_name.sub(/^.*[@\\/]/, '')\n\n link_to(\"@\" + twitter_user, \"http://twitter.com/#{twitter... | [
"0.78661543",
"0.73285854",
"0.7265497",
"0.7256906",
"0.7228",
"0.7225449",
"0.7190844",
"0.71783227",
"0.7130772",
"0.7085071",
"0.7058437",
"0.7017137",
"0.69061947",
"0.68787605",
"0.6850809",
"0.6839857",
"0.6756167",
"0.67295533",
"0.670247",
"0.67005837",
"0.6655384",
... | 0.7762805 | 1 |
Omniauth setup phase hook, that is used to dynamically set up a omniauth strategy for provider on customer basis | def auth_setup
service = Person::OmniauthService::SetupPhase.new(community: @current_community, params: params, request: request)
service.run
render :plain => "Setup complete.", :status => 404 #This notifies the ominauth to continue
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setup\n case\n when session.delete(:only_dtu)\n request.env['omniauth.strategy'].options[:login_url] = '/login?only=dtu&template=dtu_user'\n when session.delete(:prefer_dtu)\n request.env['omniauth.strategy'].options[:login_url] = '/login?template=dtu_user'\n when session.delete(:public)\... | [
"0.73006517",
"0.7193139",
"0.6808927",
"0.6621159",
"0.65283954",
"0.6527101",
"0.62718433",
"0.6267364",
"0.6242243",
"0.61745125",
"0.6172827",
"0.6151476",
"0.61464876",
"0.61355233",
"0.6134691",
"0.61205226",
"0.6083893",
"0.6047887",
"0.6046003",
"0.59811467",
"0.59738... | 0.7395827 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.