query stringlengths 7 9.55k | document stringlengths 10 363k | metadata dict | negatives listlengths 0 101 | negative_scores listlengths 0 101 | document_score stringlengths 3 10 | document_rank stringclasses 102
values |
|---|---|---|---|---|---|---|
Returns +true+ if this entity has a component of the specified +component_class+. | def has_component?( component_class )
return self.world.has_component_for?( self, component_class )
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def has_component?(component_id)\n self.account.component_enabled?(component_id)\n end",
"def has?(name)\n @_componentable_container.include?(name)\n end",
"def get_component( component_class )\n\t\treturn self.world.get_component_for( self, component_class )\n\tend",
"def has_component leveljson... | [
"0.6896807",
"0.6247299",
"0.61158055",
"0.6113589",
"0.6098746",
"0.6082909",
"0.60411966",
"0.60240465",
"0.5884295",
"0.57897234",
"0.5655268",
"0.5649825",
"0.5626848",
"0.56121147",
"0.56111515",
"0.5547993",
"0.5526287",
"0.5516171",
"0.5515546",
"0.54792607",
"0.547926... | 0.85227215 | 0 |
Equality operator returns +true+ if the receiver and +other+ belong to the same world, have the same ID, and have equal components. | def ==( other )
return other.instance_of?( self.class ) &&
self.id == other.id
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def equal?(other)\n other.respond_to?(:mol) && mol.equal?(other.mol) && id == other.id \n end",
"def ===(other)\n self.object_id == other.object_id\n end",
"def == other\n self.id == other.id\n end",
"def ==(other)\n self.id == other.id\n end",
"def equal?(other)\n ... | [
"0.7459722",
"0.7404279",
"0.7378225",
"0.73409235",
"0.7320336",
"0.73152053",
"0.7312753",
"0.7304232",
"0.7302719",
"0.7302719",
"0.7302719",
"0.7302719",
"0.72697055",
"0.7264004",
"0.72613704",
"0.72465575",
"0.72465575",
"0.7242084",
"0.72255516",
"0.7224474",
"0.718782... | 0.6979348 | 31 |
Return the detailed part of the Entity's inspect output | def inspect_details
return "ID=%s (%s)" % [
self.id,
self.components.keys.map( &:name ).sort.join( '+' )
]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def inspect_details\n ''\n end",
"def inspect\n @info.inspect\n end",
"def inspect\n @info.inspect\n end",
"def inspect\n @info.inspect \n end",
"def inspect\n redacted_string(:inspect)\n end",
"def inspect\n redacted_string(:inspect)\n end",
"def g... | [
"0.76645565",
"0.7383781",
"0.7383781",
"0.73495466",
"0.73357147",
"0.73357147",
"0.7330073",
"0.72787344",
"0.72676724",
"0.71961987",
"0.71592695",
"0.71592695",
"0.7153959",
"0.7152266",
"0.7107441",
"0.7107441",
"0.7107441",
"0.7107441",
"0.7107441",
"0.7107441",
"0.7107... | 0.7110667 | 14 |
Before filters Confirms and filters a loggedin user. | def logged_in_user
if logged_in?
redirect_to(user_path(@current_user)) if params[:id] != @current_user.id.to_s
else
flash[:danger] = "Please log in."
redirect_to login_url
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def run_filters\n set_user\n authorize\n end",
"def before_filter\n if current_user\n true\n end\n end",
"def current_user_required\n\t\t# Have to add \".filter(self)\" when not in before_filter line.\n\t\tCASClient::Frameworks::Rails::Filter.filter(self)\n\tend",
"def signed_in_user_filte... | [
"0.70717573",
"0.682533",
"0.67365456",
"0.6600906",
"0.64600724",
"0.637605",
"0.635774",
"0.6195784",
"0.61688256",
"0.6089797",
"0.6024675",
"0.601501",
"0.59992737",
"0.5972026",
"0.5890176",
"0.58537114",
"0.58009773",
"0.5790112",
"0.5782537",
"0.5765768",
"0.5763011",
... | 0.0 | -1 |
The full path to the python or python3 executable, depending on `version`. | def binary
@binary ||= begin
if brewed?
# If the python is brewed we always prefer it!
# Note, we don't support homebrew/versions/pythonXX.rb, though.
Formula.factory(@name).opt_prefix/"bin/python#{@min_version.major}"
else
# Using the ORIGINAL_PATHS here because in super... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def executable(type)\n type = type.to_s\n exe_path = File.join(File.dirname(RbConfig.ruby), \"#{type}.exe\")\n bat_path = File.join(File.dirname(RbConfig.ruby), \"#{type}.bat\")\n ruby_path = File.join(File.dirname(RbConfig.ruby), type)\n\n if Gem.win_platform?\n if File.exist?(exe_path)\n ... | [
"0.6667997",
"0.646037",
"0.63878053",
"0.6295289",
"0.62922734",
"0.623336",
"0.6182829",
"0.6142744",
"0.6071557",
"0.60465807",
"0.60284036",
"0.60284036",
"0.60284036",
"0.60213375",
"0.598574",
"0.5971756",
"0.5946419",
"0.591761",
"0.59005094",
"0.59005094",
"0.5897448"... | 0.6049051 | 9 |
The python prefix (special cased for a brewed python to point into the opt_prefix) | def prefix
if brewed?
# Homebrew since a long while only supports frameworked python
HOMEBREW_PREFIX/"opt/#{name}/Frameworks/Python.framework/Versions/#{version.major}.#{version.minor}"
elsif from_osx?
# Python on OS X has been stripped off its includes (unless you install the CLT), therefore ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def exec_prefix() return @prefix end",
"def oprefix(f)\n Formula[f].opt_prefix\n end",
"def name_prefix=(_arg0); end",
"def prefixed_label(package)\n label = ( package =~ /^#{$prefix}(.*)$/ ) && $1 || package\n label = '.' if label.empty?\n label\nend",
"def prefix=(_arg0); end",
"def cli_prefix=(... | [
"0.73513204",
"0.69646734",
"0.67286235",
"0.6686187",
"0.6642076",
"0.66277415",
"0.66128755",
"0.65872",
"0.65872",
"0.65872",
"0.65872",
"0.65872",
"0.65872",
"0.65872",
"0.65872",
"0.65872",
"0.65872",
"0.6538184",
"0.6494737",
"0.6482897",
"0.64713037",
"0.6453779",
... | 0.7039538 | 1 |
python.xy => "python2.7" is often used (and many formulae had this as `which_python`). | def xy
"python#{version.major}.#{version.minor}"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def python_binary\n @python_binary ||= begin\n `which python2`\n $?.success? ? \"python2\" : \"python\"\n end\n end",
"def pythons\n deps.map(&:to_formula)\n .select { |f| f.name.match?(/^python@\\d\\.\\d+$/) }\n .sort_by(&:version)\n .map { |f| f.opt_libexec/\"... | [
"0.6997486",
"0.6806498",
"0.6525157",
"0.64577234",
"0.6449469",
"0.6393039",
"0.62619495",
"0.61606455",
"0.60845625",
"0.59949553",
"0.597788",
"0.5964837",
"0.59580004",
"0.59409386",
"0.5928516",
"0.5905413",
"0.59021574",
"0.5898555",
"0.5831733",
"0.58002406",
"0.57638... | 0.74154866 | 0 |
Homebrew's global sitepackages. The local ones (just `site_packages`) are populated by the python_helperg method when the `prefix` of a formula is known. | def global_site_packages
HOMEBREW_PREFIX/"lib/#{xy}/site-packages"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def prefix_site_packages\n HOMEBREW_PREFIX+\"lib/python2.7/site-packages\"\n end",
"def prefix_site_packages\n HOMEBREW_PREFIX+\"lib/pypy/site-packages\"\n end",
"def site_packages\n HOMEBREW_PREFIX/\"lib/python2.7/site-packages\"\n end",
"def site_packages\n HOMEBREW_PREFIX/\"lib/python#{VER... | [
"0.7728604",
"0.75405145",
"0.7352996",
"0.72848046",
"0.7037962",
"0.69045746",
"0.662996",
"0.6090095",
"0.6067755",
"0.56822765",
"0.5609186",
"0.56056386",
"0.55483085",
"0.5444139",
"0.5433049",
"0.53689796",
"0.53689796",
"0.53454846",
"0.532192",
"0.5319571",
"0.530550... | 0.8429956 | 0 |
Dir containing Python.h and others. | def incdir
if (from_osx? || brewed?) && framework?
prefix/"Headers"
else
# For all other we use Python's own standard method (works with a non-framework version, too)
Pathname.new(`#{binary} -c 'from distutils import sysconfig; print(sysconfig.get_python_inc())'`.strip)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def includeDirs() return @INCDIRS end",
"def scripts_folder\n HOMEBREW_PREFIX/\"share/pypy#{abi_version}\"\n end",
"def modules_home\n FilePath.new(@build_dir, \"modules\").ensure_directory\n end",
"def prefix_site_packages\n HOMEBREW_PREFIX+\"lib/pypy/site-packages\"\n end",
"def scripts_folde... | [
"0.6564436",
"0.6192385",
"0.61786133",
"0.60838807",
"0.6028059",
"0.59730977",
"0.5918386",
"0.59113234",
"0.5902611",
"0.58697927",
"0.58697927",
"0.5865753",
"0.5838693",
"0.58333105",
"0.58333105",
"0.58333105",
"0.57053804",
"0.56804734",
"0.5661426",
"0.5660717",
"0.56... | 0.6723964 | 0 |
Dir containing e.g. libpython2.7.dylib | def libdir
if brewed? || from_osx?
if @min_version.major == 3
prefix/"lib/#{xy}/config-#{version.major}.#{version.minor}m"
else
prefix/"lib/#{xy}/config"
end
else
Pathname.new(`#{binary} -c "from distutils import sysconfig; print(sysconfig.get_config_var('LIBPL'))"`.strip... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def libname(dir)\n \"lib#{dir}.dylib\"\nend",
"def scripts_folder\n HOMEBREW_PREFIX/\"share/pypy#{abi_version}\"\n end",
"def lib_path; end",
"def lib_path; end",
"def lib_path; end",
"def site_packages\n HOMEBREW_PREFIX/\"lib/python2.7/site-packages\"\n end",
"def prefix_site_packages\n ... | [
"0.7305549",
"0.67240757",
"0.6705783",
"0.6705783",
"0.6705783",
"0.6554612",
"0.6519863",
"0.6505372",
"0.6469466",
"0.6461621",
"0.6461621",
"0.643082",
"0.6420193",
"0.63974214",
"0.6395289",
"0.63515604",
"0.63144827",
"0.6198368",
"0.61159426",
"0.6095842",
"0.60895014"... | 0.69172806 | 1 |
Pkgconfig (pc) files of python | def pkg_config_path
if from_osx?
# No matter if CLT-only or Xcode-only, the pc file is always here on OS X:
path = Pathname.new("/System/Library/Frameworks/Python.framework/Versions/#{version.major}.#{version.minor}/lib/pkgconfig")
path if path.exist?
else
prefix/"lib/pkgconfig"
end
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pkg_config(pkg)\n if pkgconfig = with_config(\"#{pkg}-config\") and find_executable0(pkgconfig)\n # iff package specific config command is given\n get = proc {|opt| `#{pkgconfig} --#{opt}`.chomp}\n elsif ($PKGCONFIG ||= \n (pkgconfig = with_config(\"pkg-config\", (\"pkg-config\" unless CROSS_CO... | [
"0.66039133",
"0.6307981",
"0.60535955",
"0.60199654",
"0.5904554",
"0.5846568",
"0.5834499",
"0.58007467",
"0.5791877",
"0.57675844",
"0.5743112",
"0.5716511",
"0.5696352",
"0.56906486",
"0.564057",
"0.5619223",
"0.56131434",
"0.5604064",
"0.55925846",
"0.5579182",
"0.556953... | 0.6802971 | 0 |
Is the brewed Python installed | def brewed?
@brewed ||= begin
require 'formula'
Formula.factory(@name).linked_keg.exist?
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def have_brew?\n have_command? :brew\n end",
"def should_do_python_install?\n return (osx? and (not (File.exists?(python_directory))))\n end",
"def installed?\n MacOS.dev_tools_path == Pathname.new(\"/usr/bin\")\n end",
"def has_virtualenv_installed(python)\n `#{python} -m virtualenv --hel... | [
"0.7677192",
"0.73926574",
"0.7209262",
"0.71071357",
"0.7059898",
"0.6941745",
"0.6840349",
"0.68254817",
"0.6806444",
"0.6785254",
"0.67020744",
"0.67019945",
"0.67016274",
"0.66570336",
"0.66096073",
"0.6576016",
"0.6503841",
"0.64933306",
"0.6460363",
"0.63668823",
"0.636... | 0.75761867 | 1 |
Is the python the one from OS X? | def from_osx?
@from_osx ||= begin
p = `#{binary} -c "import sys; print(sys.prefix)"`.strip
p.start_with?("/System/Library/Frameworks/Python.framework")
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def os_x?\n RUBY_PLATFORM.match(/darwin/)\n end",
"def mac? ; RUBY_PLATFORM =~ /.*(sal|86).*-darwin1/i end",
"def mac?\n RUBY_PLATFORM =~ /darwin/i\nend",
"def darwin?\n RUBY_PLATFORM.include?('darwin')\n end",
"def should_do_python_install?\n return (osx? and (not (File.exists?(python_... | [
"0.79528993",
"0.78498656",
"0.7739245",
"0.7678259",
"0.76770926",
"0.7566542",
"0.7559864",
"0.75282973",
"0.74896395",
"0.745421",
"0.7413869",
"0.7374769",
"0.7356724",
"0.72925997",
"0.72925043",
"0.72890586",
"0.7220732",
"0.7200416",
"0.712465",
"0.7115675",
"0.7071526... | 0.8303217 | 0 |
Is the `python` a PyPy? | def pypy?
@pypy ||= !(`#{binary} -c "import sys; print(sys.version)"`.downcase =~ /.*pypy.*/).nil?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_system_python\n @candidate_pythons = lookup_local_pythons\n return 0 != @candidate_pythons.length\n end",
"def worked_with_ruby?(c)\n c.languages_worked_with.include?('Ruby')\nend",
"def is_a?(p0) end",
"def builtin_type?\n\t\ttrue\n\tend",
"def ruby?\n [C, CPlusPlus].any? { |langu... | [
"0.6610377",
"0.59354144",
"0.5879644",
"0.5859301",
"0.58419853",
"0.58346343",
"0.5736925",
"0.5728284",
"0.5716424",
"0.5697069",
"0.5679664",
"0.56707454",
"0.56707454",
"0.56583136",
"0.56543994",
"0.5651148",
"0.56442094",
"0.56442094",
"0.56429404",
"0.562732",
"0.5618... | 0.7883681 | 0 |
Objects of this class are used to represent dependencies on Python and dependencies on Python modules, so the combination of name + imports is enough to identify them uniquely. | def eql?(other)
instance_of?(other.class) && name == other.name && imports == other.imports
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def importer_names\n importers.map{|e| e.const_name }\n end",
"def name\n @dependency.name\n end",
"def name\n @dependency.name\n end",
"def dependencies(ctx)\n @i_name ||= ctx.lookup(name).i_name\n s = Set.new\n s << i_name\n s\n end",
"def implausible_comm... | [
"0.6003884",
"0.5958584",
"0.5958584",
"0.5955099",
"0.5843309",
"0.58014256",
"0.5571391",
"0.5518838",
"0.5500836",
"0.54965633",
"0.54965633",
"0.54719234",
"0.54377544",
"0.54317594",
"0.541769",
"0.5385215",
"0.53366286",
"0.53354615",
"0.53230506",
"0.53222805",
"0.5318... | 0.0 | -1 |
Eigenclass Return a new instance of Vedeu::Clear::NamedGroup. | def initialize(name)
@name = name
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def clear_group!\n Vedeu.bind(:_clear_group_) do |name|\n Vedeu::Clear::NamedGroup.render(name)\n end\n end",
"def group(name)\n @_group = name\n end",
"def new\n @group = Group.new\n end",
"def find_group(name)\n NetCDF::Group.new(@netcdf_elmt.findGroup(nam... | [
"0.6634407",
"0.58794355",
"0.58674335",
"0.5846967",
"0.5766173",
"0.57354593",
"0.57039076",
"0.57039076",
"0.57039076",
"0.57039076",
"0.57039076",
"0.5603265",
"0.55817324",
"0.55518496",
"0.5503342",
"0.5503342",
"0.5484954",
"0.54817176",
"0.5463388",
"0.5453234",
"0.54... | 0.0 | -1 |
3 as a case statement | def evaluate_number(num)
case num
when 0..50
puts "#{num} is less than 50!"
when 51..100
puts "#{num} is between 50 and 100!"
else
if num < 0
puts "#{num} is less than zero! Not in a valid range"
else
puts "#{num} is too big!"
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def case!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 23 )\n\n type = CASE\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 144:8: 'case'\n match( \"case\" )\n\n \n @state.type = t... | [
"0.6690558",
"0.6441033",
"0.6441033",
"0.6391254",
"0.63227654",
"0.6289957",
"0.6203544",
"0.6194225",
"0.6187135",
"0.61592513",
"0.615375",
"0.6139076",
"0.6137224",
"0.61288023",
"0.6037808",
"0.60157126",
"0.60034305",
"0.600283",
"0.5921158",
"0.5904641",
"0.581783",
... | 0.53616637 | 61 |
Make sure a product is not referenced by any line item | def ensure_not_referenced_by_any_line_item
if line_items.empty?
return true
else
errors.add(:base, "Line items exist")
return false
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ensure_not_referenced_by_any_line_item_product\n unless line_item_products.empty?\n errors.add(:base, 'Line Items Products present')\n throw :abort\n end\n end",
"def ensure_not_referenced_by_any_line_item\n\t\t\tunless line_items.empty?\n\t\t\t\terrors.add(:base, 'Line items reference this pr... | [
"0.8371898",
"0.8186138",
"0.79768384",
"0.76960856",
"0.76607746",
"0.7625046",
"0.76232016",
"0.76224107",
"0.7506339",
"0.75009656",
"0.7490604",
"0.7483383",
"0.7474026",
"0.7473931",
"0.74666715",
"0.7466647",
"0.74599624",
"0.74578786",
"0.7453736",
"0.7453336",
"0.7452... | 0.7341775 | 64 |
Write your code here. | def dictionary
the_dictionary = {
"hello" => "hi",
"to" => "2",
"two" => "2",
"too" => "2",
"for" => "4",
"four" => "4",
"be" => "b",
"you" => "u",
"at" => "@",
"and" => "&"
}
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def code; end",
"def code; end",
"def code; end",
"def code; end",
"def code; end",
"def code; end",
"def code; end",
"def run\n \n end",
"def run\n \n end",
"def method\n\t\t# code code\n\tend",
"def run; end",
"def run; end",
"def run; end",
"def run; end",
"def run; end",
"... | [
"0.7117752",
"0.7117752",
"0.7117752",
"0.7117752",
"0.7117752",
"0.7117752",
"0.7117752",
"0.6527089",
"0.6527089",
"0.6524399",
"0.64633006",
"0.64633006",
"0.64633006",
"0.64633006",
"0.64633006",
"0.64633006",
"0.64633006",
"0.64633006",
"0.64633006",
"0.6418008",
"0.6343... | 0.0 | -1 |
Refresh the object with the new response. This happens when a new access token is requested using a request token. | def refresh(response)
@access_token = response[:access_token]
@expires_at = Time.now + response[:expires_in]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def token_refresh!\n self.access_token = access_token.refresh!\n end",
"def refresh(response)\n @code = response.code\n @body = response.body\n @next_page = response.next_page\n response\n end",
"def refresh!\n response = request_token_from_google\n data = JSON.pa... | [
"0.7548074",
"0.75460774",
"0.7426984",
"0.73923093",
"0.7334377",
"0.7289308",
"0.72811836",
"0.72426546",
"0.7103068",
"0.6999891",
"0.6978634",
"0.694417",
"0.6941053",
"0.6926988",
"0.6910955",
"0.6848234",
"0.6830027",
"0.6785182",
"0.6752679",
"0.6711105",
"0.67084694",... | 0.8065298 | 0 |
Check all available mapings and only load related controllers. | def eager_load!
mappings = Devise.mappings.values.map(&:modules).flatten.uniq
controllers = Devise::CONTROLLERS.values_at(*mappings)
path = paths.app.controllers.to_a.first
matcher = /\A#{Regexp.escape(path)}\/(.*)\.rb\Z/
Dir.glob("#{path}/devise/{#{controllers.join(',')}}_c... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load_all\n load(*@mappings.keys)\n end",
"def all\n load_clients\n load_preferences\n end",
"def site_maps\n if current_user && current_user.admin?\n Map.all\n else\n Map.active\n end\n end",
"def index\n @makers = Maker.all.order(name: :asc)\n if @makers.blank?\n... | [
"0.6363527",
"0.5867729",
"0.5767758",
"0.5591032",
"0.55556184",
"0.5497477",
"0.5497477",
"0.5497477",
"0.5469305",
"0.546831",
"0.5463449",
"0.54498965",
"0.54442626",
"0.5431245",
"0.5419746",
"0.54184985",
"0.53822684",
"0.5367075",
"0.5357731",
"0.5354214",
"0.5337986",... | 0.5398446 | 16 |
GET /sport_categories GET /sport_categories.json | def index
@sport_categories = SportCategory.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def categories(sport_id)\n get(\"sports/en/sports/sr:sport:#{sport_id}/categories.xml\")\n end",
"def categories\n get('venues/categories').categories\n end",
"def categories\n\t\tbegin\n\t\t\t@categories = Category.select(:id, :name)\n\t\t\trender json: @categories\n\t\trescue Exception =>... | [
"0.8373419",
"0.7519292",
"0.7152745",
"0.7061413",
"0.70152587",
"0.68787336",
"0.6592121",
"0.657593",
"0.65674096",
"0.6541808",
"0.653638",
"0.65109533",
"0.650085",
"0.64421546",
"0.6410062",
"0.6406676",
"0.6400949",
"0.6396598",
"0.6371252",
"0.63710046",
"0.6359399",
... | 0.7443307 | 2 |
GET /sport_categories/1 GET /sport_categories/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def categories(sport_id)\n get(\"sports/en/sports/sr:sport:#{sport_id}/categories.xml\")\n end",
"def index\n @sport_categories = SportCategory.all\n end",
"def categories\n get('venues/categories').categories\n end",
"def GetCategory id\n\n APICall(path: \"categories/#{id}.jso... | [
"0.8071743",
"0.7319696",
"0.69233894",
"0.69145495",
"0.68963164",
"0.678848",
"0.6781618",
"0.66316986",
"0.6627023",
"0.65891904",
"0.65718454",
"0.6538579",
"0.6502783",
"0.6492566",
"0.6490712",
"0.6486433",
"0.64526963",
"0.64374655",
"0.64329714",
"0.64223903",
"0.6413... | 0.0 | -1 |
POST /sport_categories POST /sport_categories.json | def create
@sport_category = SportCategory.new(sport_category_params)
respond_to do |format|
if @sport_category.save
format.html { redirect_to @sport_category, notice: 'Sport category was successfully created.' }
format.json { render :show, status: :created, location: @sport_category }
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def CreateCategory params = {}\n \n APICall(path: 'categories.json',method: 'POST',payload: params.to_json)\n \n end",
"def categories(sport_id)\n get(\"sports/en/sports/sr:sport:#{sport_id}/categories.xml\")\n end",
"def create_category payload\n\t\t\t\t\tFreshdesk::Api::Clie... | [
"0.6854986",
"0.6824455",
"0.67615044",
"0.6519123",
"0.6463909",
"0.6447741",
"0.6398709",
"0.63410187",
"0.6268359",
"0.62230575",
"0.6179313",
"0.6167834",
"0.6148527",
"0.6128114",
"0.6114518",
"0.6083891",
"0.60808897",
"0.60568386",
"0.6045661",
"0.602542",
"0.6020887",... | 0.70841235 | 0 |
PATCH/PUT /sport_categories/1 PATCH/PUT /sport_categories/1.json | def update
respond_to do |format|
if @sport_category.update(sport_category_params)
format.html { redirect_to @sport_category, notice: t('success_update_sport_category') }
format.json { render :show, status: :ok, location: @sport_category }
else
format.html { render :edit }
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n json_update(category,category_params, Category)\n end",
"def UpdateCategory params = {}\n \n APICall(path: 'categories.json',method: 'PUT',payload: params.to_json)\n \n end",
"def update\n if @categoria.update(categoria_params)\n render json: @categoria\n ... | [
"0.7030569",
"0.7026373",
"0.63891226",
"0.63813806",
"0.6366911",
"0.63146776",
"0.6255854",
"0.61987036",
"0.61924344",
"0.6168347",
"0.616824",
"0.615138",
"0.6144984",
"0.6141",
"0.61155814",
"0.61107314",
"0.60975915",
"0.60961515",
"0.60954756",
"0.6093977",
"0.60872096... | 0.6962825 | 2 |
DELETE /sport_categories/1 DELETE /sport_categories/1.json | def destroy
@sport_category.destroy
respond_to do |format|
format.html { redirect_to sport_categories_url, notice: 'Sport category was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @category.destroy\n render json: @category, status: :ok\n end",
"def destroy\n @category = Category.find(params[:id])\n @category.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_scenic_spots_url }\n format.json { head :no_content }\n end\n end",
... | [
"0.724886",
"0.711839",
"0.70800954",
"0.7067073",
"0.7046831",
"0.70290244",
"0.7016771",
"0.69709486",
"0.6953723",
"0.6950192",
"0.69475824",
"0.6926173",
"0.6924559",
"0.6921198",
"0.69175273",
"0.69113684",
"0.68788916",
"0.6872656",
"0.6863453",
"0.6859689",
"0.68591404... | 0.76403123 | 0 |
Use callbacks to share common setup or constraints between actions. | def set_sport_category
@sport_category = SportCategory.find(params[:id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_... | [
"0.6164095",
"0.6046031",
"0.5945298",
"0.59179014",
"0.58890367",
"0.58341795",
"0.5776118",
"0.5700777",
"0.5700777",
"0.5656277",
"0.56218207",
"0.5423995",
"0.5411516",
"0.5411516",
"0.5411516",
"0.5395004",
"0.53783494",
"0.53593004",
"0.53412604",
"0.534078",
"0.5332865... | 0.0 | -1 |
Never trust parameters from the scary internet, only allow the white list through. | def sport_category_params
params.require(:sport_category).permit(:sport_id, :category_id)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def allow_params_authentication!; end",
"def allowed_params\n ALLOWED_PARAMS\n end",
"def default_param_whitelist\n [\"mode\"]\n... | [
"0.6981273",
"0.6783789",
"0.67460483",
"0.6742222",
"0.67354137",
"0.65934366",
"0.65028495",
"0.6497783",
"0.64826745",
"0.6479415",
"0.6456823",
"0.6440081",
"0.63800216",
"0.6376521",
"0.636652",
"0.6319898",
"0.6300256",
"0.62994003",
"0.6293621",
"0.6292629",
"0.6291586... | 0.0 | -1 |
Delegates to the node for convenience. | def switch_state(state)
node.switch_state(state)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def node; end",
"def node; end",
"def node; end",
"def node; end",
"def node; end",
"def node; end",
"def node; end",
"def node; end",
"def node; end",
"def node; end",
"def node; end",
"def node; end",
"def node; end",
"def node; end",
"def node; end",
"def node; end",
"def node; e... | [
"0.72726446",
"0.72726446",
"0.72726446",
"0.72726446",
"0.72726446",
"0.72726446",
"0.72726446",
"0.72726446",
"0.72726446",
"0.72726446",
"0.72726446",
"0.72726446",
"0.72726446",
"0.72726446",
"0.72726446",
"0.72726446",
"0.72726446",
"0.72726446",
"0.72726446",
"0.72726446"... | 0.0 | -1 |
Called when entering this state. | def enter_state
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def on_enter\n end",
"def pre_enter(state_manager, game)\n # puts \"State : #{self.class}\"\n @exiting = false\n end",
"def on_enter\n @state = :HIGHLIGHTED # duplicating since often these are inside containers\n @focussed = true\n if @handler && @handler.has_key?(:ENTER)\... | [
"0.7514419",
"0.72205937",
"0.68172616",
"0.6694841",
"0.6681643",
"0.656525",
"0.6539525",
"0.65318465",
"0.64346033",
"0.6377199",
"0.6341891",
"0.6235423",
"0.62087077",
"0.62087077",
"0.62087077",
"0.62087077",
"0.62087077",
"0.62087077",
"0.62087077",
"0.62087077",
"0.62... | 0.796985 | 0 |
Called on transition to another state. | def exit_state
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def transition\n new_state = fetch_sensor_state\n return if new_state == @state\n puts \"Transitioned from #{@state} to #{new_state}\"\n if valid_transition?(new_state)\n @state = new_state\n # Do nothing\n else\n puts \"Invalid transition!\"\n @beam_broken = 0\n # TODO: tos... | [
"0.6974673",
"0.69634545",
"0.6944193",
"0.69234854",
"0.69234854",
"0.67243105",
"0.6688235",
"0.65664977",
"0.6551246",
"0.65479225",
"0.63865566",
"0.63865566",
"0.63863444",
"0.6384869",
"0.63436025",
"0.63354665",
"0.6325798",
"0.63116276",
"0.63036567",
"0.62852615",
"0... | 0.0 | -1 |
Reset timeout when granting vote to candidate. | def handle_vote_request(payload)
response = super(payload)
timeout.reset if response[:vote_granted]
response
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def vote(candidates) sleep(1) end",
"def set_election_timeout(timeout)\n cfg = get_rs_config\n cfg['settings']['electionTimeoutMillis'] = timeout * 1000\n set_rs_config(cfg)\n end",
"def on_timeout\n trigger\n reset\n end",
"def reset_on_timeout_state\n super\n end",
"def on_... | [
"0.6442214",
"0.6311502",
"0.60184366",
"0.59780014",
"0.5930885",
"0.58609116",
"0.5846801",
"0.5820405",
"0.5808638",
"0.57818854",
"0.57547736",
"0.5711083",
"0.5668925",
"0.5607585",
"0.55842406",
"0.55705476",
"0.55359036",
"0.55260056",
"0.5524599",
"0.54745054",
"0.546... | 0.6593118 | 0 |
Reset timeout when receiving valid AppendEntries RPC. FIXME: This is pseudocode. | def handle_append_entries(payload)
response = super(payload)
if response[:success]
timeout.reset
end
response
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def timeouts_set; end",
"def timeout\n @dups += 1\n send_dat(:resend => true)\n # FIXME - need to give up eventually!\n end",
"def handle_timeout\n pop_outstanding_request\n nil\n end",
"def timeout_at; end",
"def timeouts_set=(_arg0); end",
"def write_timeout=(_arg0)... | [
"0.59108114",
"0.5791757",
"0.57551646",
"0.5562574",
"0.5530305",
"0.55210537",
"0.55210537",
"0.54931474",
"0.54931474",
"0.54931474",
"0.5456012",
"0.5436747",
"0.54294",
"0.5395273",
"0.530549",
"0.52839315",
"0.52839315",
"0.52839315",
"0.52809423",
"0.52795947",
"0.5275... | 0.6979478 | 0 |
GET /standard_measurements/1 GET /standard_measurements/1.json | def show
@standard_measurement = StandardMeasurement.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.json { render json: @standard_measurement }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_measurements\n render json: @data_source.measurements\n end",
"def measurements_get(opts = {})\n if Configuration.debugging\n Configuration.logger.debug \"Calling API: MeasurementApi#measurements_get ...\"\n end\n \n # resource path\n path = \"/measurements\".sub('{for... | [
"0.7209802",
"0.6763065",
"0.67466545",
"0.66054237",
"0.6527712",
"0.6463424",
"0.6409387",
"0.63467795",
"0.6322982",
"0.6279228",
"0.62436205",
"0.62432706",
"0.6231266",
"0.61964923",
"0.61827165",
"0.614854",
"0.61384076",
"0.61325634",
"0.6064852",
"0.6053855",
"0.60538... | 0.75955856 | 0 |
GET /standard_measurements/new GET /standard_measurements/new.json | def new
@standard_measurement = StandardMeasurement.new
respond_to do |format|
format.html # new.html.erb
format.json { render json: @standard_measurement }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @standard_measurement = StandardMeasurement.new(params[:standard_measurement])\n\n respond_to do |format|\n if @standard_measurement.save\n format.html { redirect_to @standard_measurement, notice: 'Standard measurement was successfully created.' }\n format.json { render json: ... | [
"0.75623345",
"0.75206405",
"0.7367227",
"0.73218995",
"0.6924188",
"0.6924188",
"0.6900503",
"0.67950404",
"0.6735633",
"0.6720964",
"0.6676942",
"0.6673398",
"0.66562223",
"0.663609",
"0.6631962",
"0.6604483",
"0.6593",
"0.6587469",
"0.65795076",
"0.6530831",
"0.6530831",
... | 0.8141197 | 0 |
POST /standard_measurements POST /standard_measurements.json | def create
@standard_measurement = StandardMeasurement.new(params[:standard_measurement])
respond_to do |format|
if @standard_measurement.save
format.html { redirect_to @standard_measurement, notice: 'Standard measurement was successfully created.' }
format.json { render json: @standard_m... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @standard_measurement = StandardMeasurement.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @standard_measurement }\n end\n end",
"def create\n\n @measurement = Measurement.new(measurement_params)\n\n respond_to do |format|\n if @m... | [
"0.6429276",
"0.63355666",
"0.62782013",
"0.61576194",
"0.61373514",
"0.6132276",
"0.61311173",
"0.61311173",
"0.6104575",
"0.6047039",
"0.5985993",
"0.59762275",
"0.5972711",
"0.5950687",
"0.5949903",
"0.5926422",
"0.5910583",
"0.58732665",
"0.5859941",
"0.5849956",
"0.58461... | 0.7387875 | 0 |
PUT /standard_measurements/1 PUT /standard_measurements/1.json | def update
@standard_measurement = StandardMeasurement.find(params[:id])
respond_to do |format|
if @standard_measurement.update_attributes(params[:standard_measurement])
format.html { redirect_to @standard_measurement, notice: 'Standard measurement was successfully updated.' }
format.json... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n if @measure.update(measure_params)\n head :no_content\n else\n render json: @measure.errors, status: :unprocessable_entity\n end\n end",
"def create\n @standard_measurement = StandardMeasurement.new(params[:standard_measurement])\n\n respond_to do |format|\n if @standa... | [
"0.6623499",
"0.6574194",
"0.62610966",
"0.621395",
"0.61939704",
"0.61939704",
"0.61928976",
"0.6150381",
"0.6149403",
"0.6149403",
"0.6149403",
"0.6134836",
"0.6070747",
"0.60668766",
"0.60641694",
"0.6038781",
"0.6037735",
"0.5980917",
"0.5972274",
"0.59581435",
"0.5926617... | 0.74349487 | 0 |
DELETE /standard_measurements/1 DELETE /standard_measurements/1.json | def destroy
@standard_measurement = StandardMeasurement.find(params[:id])
@standard_measurement.destroy
respond_to do |format|
format.html { redirect_to standard_measurements_url }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @k_measurement.destroy\n respond_to do |format|\n format.html { redirect_to k_measurements_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @measurement = Measurement.find(params[:id])\n @measurement.destroy\n\n respond_to do |format|\n ... | [
"0.72167015",
"0.7209673",
"0.71771055",
"0.7160497",
"0.7098865",
"0.7067766",
"0.7067766",
"0.7067766",
"0.70599055",
"0.70365137",
"0.70349425",
"0.7020637",
"0.6996403",
"0.6996403",
"0.6990344",
"0.69738626",
"0.69738626",
"0.69738626",
"0.6921939",
"0.688923",
"0.687852... | 0.78450507 | 0 |
after_action :redirect_back, except: [:index] | def index
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n redirect_to :back\n rescue ActionController::RedirectBackError\n redirect_to root_path\n end",
"def index\n redirect_back_or_default \"/\"\n end",
"def redirect_back\n super(fallback_location: root_path)\n end",
"def redirect_back\n RedirectBack.new self\n end",
"def go_back... | [
"0.8120499",
"0.7796019",
"0.7664812",
"0.7620621",
"0.75639355",
"0.74002415",
"0.7328752",
"0.72042865",
"0.71997",
"0.7149452",
"0.7129703",
"0.71285754",
"0.71184605",
"0.7050673",
"0.70376444",
"0.698919",
"0.69856477",
"0.69548965",
"0.69498134",
"0.69367445",
"0.693150... | 0.0 | -1 |
TODO: deprecate below for above | def ret_request_params(*args)
request_params(*args)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def private; end",
"def custom; end",
"def custom; end",
"def specie; end",
"def specie; end",
"def specie; end",
"def specie; end",
"def internal; end",
"def extra; end",
"def macro; raise NotImplementedError; end",
"def macro; raise NotImplementedError; end",
"def macro; raise NotImplemente... | [
"0.7870495",
"0.6554256",
"0.6554256",
"0.64194894",
"0.64194894",
"0.64194894",
"0.64194894",
"0.6388552",
"0.63553476",
"0.63413006",
"0.63413006",
"0.63413006",
"0.62910026",
"0.62216467",
"0.6214052",
"0.614607",
"0.61438346",
"0.6116201",
"0.6116201",
"0.609698",
"0.6041... | 0.0 | -1 |
GET /registrations/1 GET /registrations/1.xml | def show
@registration = Registration.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.xml { render :xml => @registration }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @registry = @user.registries.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @registry }\n end\n end",
"def index\n @registrations = Registration.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml... | [
"0.6932481",
"0.6882738",
"0.6882738",
"0.68394166",
"0.65443987",
"0.6493665",
"0.63526964",
"0.63090444",
"0.62824297",
"0.62824297",
"0.62824297",
"0.62824297",
"0.62824297",
"0.616175",
"0.6160659",
"0.61495835",
"0.614892",
"0.6134301",
"0.61063945",
"0.6096005",
"0.6071... | 0.6567442 | 8 |
GET /registrations/new GET /registrations/new.xml | def new
@registration = Registration.new
respond_to do |format|
format.html # new.html.erb
format.xml { render :xml => @registration }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @registry = @user.registries.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @registry }\n end\n end",
"def new\n @registration = Registration.new()\n respond_to do |format|\n format.html # new.html.erb\n format.xml { r... | [
"0.7861713",
"0.752154",
"0.7231291",
"0.69919074",
"0.6987084",
"0.6936533",
"0.69357586",
"0.6907146",
"0.6893142",
"0.68860555",
"0.68632025",
"0.6843415",
"0.68418413",
"0.6789135",
"0.6771799",
"0.6736874",
"0.6723378",
"0.67173696",
"0.6681538",
"0.6681538",
"0.6681538"... | 0.75352323 | 3 |
POST /registrations POST /registrations.xml | def create
@registration = Registration.new(params[:registration])
respond_to do |format|
if @registration.save
format.html { redirect_to(@registration, :notice => 'Registration was successfully created.') }
format.xml { render :xml => @registration, :status => :created, :location => @re... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @registry = @user.registries.new(registry_params)\n\n respond_to do |format|\n if @registry.save\n flash[:notice] = 'Registry was successfully created.'\n format.html { redirect_to user_registry_path(@user, @registry) }\n format.xml { render :xml => @registry, :status ... | [
"0.6708856",
"0.64457864",
"0.63351065",
"0.61734116",
"0.6133497",
"0.60770154",
"0.6061787",
"0.6043259",
"0.5976246",
"0.5974912",
"0.59664583",
"0.59457755",
"0.59436136",
"0.5885215",
"0.58809704",
"0.58795255",
"0.587475",
"0.58635116",
"0.58514893",
"0.58500516",
"0.58... | 0.6395468 | 2 |
DELETE /registrations/1 DELETE /registrations/1.xml | def destroy
@registration = Registration.find(params[:id])
@registration.destroy
respond_to do |format|
format.html { redirect_to(registrations_url) }
format.xml { head :ok }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @registry = Registry.find(params[:id])\n @registry.destroy\n logger.info \"*-*-*-*-* #{@registry.name} deleted by #{@user.name}.\"\n\n respond_to do |format|\n format.html { redirect_to( user_gifts_url(@user)) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @r... | [
"0.6969644",
"0.66810244",
"0.66656166",
"0.66656166",
"0.66525084",
"0.66104376",
"0.6553427",
"0.6546345",
"0.6514577",
"0.6507054",
"0.64914834",
"0.6491141",
"0.6485453",
"0.6483532",
"0.6459968",
"0.6445944",
"0.6429972",
"0.6426703",
"0.6409733",
"0.6343492",
"0.6330740... | 0.7132907 | 4 |
GET /many_alumnos_has_many_asignaturas GET /many_alumnos_has_many_asignaturas.json | def index
@many_alumnos_has_many_asignaturas = ManyAlumnosHasManyAsignatura.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_many_alumnos_has_many_asignatura\n @many_alumnos_has_many_asignatura = ManyAlumnosHasManyAsignatura.find(params[:id])\n end",
"def many_alumnos_has_many_asignatura_params\n params.require(:many_alumnos_has_many_asignatura).permit(:nota, :ponderacion, :alumno_id, :asignatura_id)\n end",
... | [
"0.73995626",
"0.66339123",
"0.63247967",
"0.631442",
"0.5975656",
"0.5637693",
"0.5555099",
"0.54892063",
"0.5470869",
"0.5361782",
"0.5306779",
"0.5286144",
"0.52753204",
"0.5238359",
"0.51464635",
"0.5109377",
"0.51071614",
"0.50870997",
"0.50803983",
"0.5072888",
"0.50716... | 0.7365246 | 1 |
GET /many_alumnos_has_many_asignaturas/1 GET /many_alumnos_has_many_asignaturas/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_many_alumnos_has_many_asignatura\n @many_alumnos_has_many_asignatura = ManyAlumnosHasManyAsignatura.find(params[:id])\n end",
"def index\n @many_alumnos_has_many_asignaturas = ManyAlumnosHasManyAsignatura.all\n end",
"def many_alumnos_has_many_asignatura_params\n params.require(:many_a... | [
"0.740251",
"0.72773695",
"0.6539893",
"0.64462525",
"0.6325858",
"0.6223348",
"0.59349155",
"0.5838496",
"0.5515335",
"0.53800446",
"0.5331264",
"0.5325931",
"0.5306064",
"0.52969587",
"0.52926576",
"0.5235055",
"0.52240634",
"0.51372087",
"0.51241255",
"0.5118731",
"0.51003... | 0.0 | -1 |
POST /many_alumnos_has_many_asignaturas POST /many_alumnos_has_many_asignaturas.json | def create
@many_alumnos_has_many_asignatura = ManyAlumnosHasManyAsignatura.new(many_alumnos_has_many_asignatura_params)
respond_to do |format|
if @many_alumnos_has_many_asignatura.save
format.html { redirect_to @many_alumnos_has_many_asignatura, notice: 'Many alumnos has many asignatura was succ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_many_alumnos_has_many_asignatura\n @many_alumnos_has_many_asignatura = ManyAlumnosHasManyAsignatura.find(params[:id])\n end",
"def many_alumnos_has_many_asignatura_params\n params.require(:many_alumnos_has_many_asignatura).permit(:nota, :ponderacion, :alumno_id, :asignatura_id)\n end",
... | [
"0.73918563",
"0.73905003",
"0.6629029",
"0.65761757",
"0.64902925",
"0.5914079",
"0.5652136",
"0.55683994",
"0.5455887",
"0.5369937",
"0.53325844",
"0.52227485",
"0.51413417",
"0.510015",
"0.50938326",
"0.5085373",
"0.5083555",
"0.5077932",
"0.50680155",
"0.50675523",
"0.501... | 0.73339915 | 2 |
PATCH/PUT /many_alumnos_has_many_asignaturas/1 PATCH/PUT /many_alumnos_has_many_asignaturas/1.json | def update
respond_to do |format|
if @many_alumnos_has_many_asignatura.update(many_alumnos_has_many_asignatura_params)
format.html { redirect_to @many_alumnos_has_many_asignatura, notice: 'Many alumnos has many asignatura was successfully updated.' }
format.json { render :show, status: :ok, lo... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_many_alumnos_has_many_asignatura\n @many_alumnos_has_many_asignatura = ManyAlumnosHasManyAsignatura.find(params[:id])\n end",
"def many_alumnos_has_many_asignatura_params\n params.require(:many_alumnos_has_many_asignatura).permit(:nota, :ponderacion, :alumno_id, :asignatura_id)\n end",
... | [
"0.69011843",
"0.6448078",
"0.5987733",
"0.5918507",
"0.59097755",
"0.5888849",
"0.5887748",
"0.588391",
"0.5842193",
"0.5763357",
"0.5742971",
"0.57030773",
"0.5664563",
"0.5598415",
"0.5582704",
"0.5544442",
"0.5531136",
"0.5499777",
"0.5499184",
"0.54814094",
"0.54760337",... | 0.74059004 | 0 |
DELETE /many_alumnos_has_many_asignaturas/1 DELETE /many_alumnos_has_many_asignaturas/1.json | def destroy
@many_alumnos_has_many_asignatura.destroy
respond_to do |format|
format.html { redirect_to many_alumnos_has_many_asignaturas_url, notice: 'Many alumnos has many asignatura was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @alumno.destroy\n respond_to do |format|\n format.html { redirect_to grupos_path }\n format.json { head :no_content }\n end\n end",
"def destroy\n @asignatura.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"def destroy\n beg... | [
"0.6936676",
"0.68490344",
"0.68376625",
"0.6752037",
"0.67070466",
"0.665883",
"0.66478527",
"0.66203845",
"0.65554965",
"0.6554469",
"0.65544003",
"0.6545487",
"0.65299356",
"0.6525786",
"0.6525211",
"0.65146804",
"0.6496686",
"0.6493881",
"0.64900285",
"0.64788085",
"0.645... | 0.82324785 | 0 |
Use callbacks to share common setup or constraints between actions. | def set_many_alumnos_has_many_asignatura
@many_alumnos_has_many_asignatura = ManyAlumnosHasManyAsignatura.find(params[:id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_... | [
"0.6164095",
"0.6046031",
"0.5945298",
"0.59179014",
"0.58890367",
"0.58341795",
"0.5776118",
"0.5700777",
"0.5700777",
"0.5656277",
"0.56218207",
"0.5423995",
"0.5411516",
"0.5411516",
"0.5411516",
"0.5395004",
"0.53783494",
"0.53593004",
"0.53412604",
"0.534078",
"0.5332865... | 0.0 | -1 |
Never trust parameters from the scary internet, only allow the white list through. | def many_alumnos_has_many_asignatura_params
params.require(:many_alumnos_has_many_asignatura).permit(:nota, :ponderacion, :alumno_id, :asignatura_id)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def allow_params_authentication!; end",
"def allowed_params\n ALLOWED_PARAMS\n end",
"def default_param_whitelist\n [\"mode\"]\n... | [
"0.6979893",
"0.6781746",
"0.6746611",
"0.6742344",
"0.6735229",
"0.6592651",
"0.65027124",
"0.6498011",
"0.648163",
"0.647716",
"0.64556813",
"0.64386255",
"0.63784456",
"0.63756156",
"0.636574",
"0.6319542",
"0.63004524",
"0.6299559",
"0.62925464",
"0.62923217",
"0.6289894"... | 0.0 | -1 |
replacement for Kaminari::ActionViewExtensionpaginate only shows `next` and `prev` links and not page numbers, saving a COUNT(DISTINCT ..) query | def plain_paginate(items)
render "layouts/plain_paginate", items: items
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def paginator; end",
"def pagination_links(objects, count = 100)\n will_paginate(objects, {\n :per_page => count,\n :next_label => _('Next') + ' »', \n :prev_label => '« ' + _('Previous')\n })\n end",
"def pagination\n ... | [
"0.72308487",
"0.7115417",
"0.6985807",
"0.68673974",
"0.685308",
"0.68480337",
"0.6845218",
"0.68115234",
"0.6779555",
"0.6765502",
"0.6759802",
"0.6749334",
"0.6641164",
"0.66356826",
"0.66311663",
"0.66141945",
"0.6603575",
"0.66033256",
"0.6578574",
"0.65361404",
"0.65313... | 0.0 | -1 |
before_action :set_equipament, only: [:create] load_and_authorize_resource | def new
@transfer_source = ControlPalletInternal.new
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @equipo = Equipo.new(params[:equipo])\n\n respond_to do |format|\n if @equipo.save\n newAuditoria = Auditoria.new\n newAuditoria.tabla = params[:controller]\n newAuditoria.action = params[:action]\n newAuditoria.usuario = User.all.first.id\n newAuditoria.clave = @equipo.id\n... | [
"0.7019389",
"0.6738149",
"0.67178756",
"0.6707005",
"0.66535926",
"0.65033257",
"0.64944834",
"0.6493106",
"0.64532465",
"0.6418104",
"0.6384957",
"0.63671774",
"0.6367148",
"0.6364442",
"0.6348962",
"0.63348806",
"0.63143194",
"0.63116115",
"0.6310484",
"0.63033265",
"0.630... | 0.0 | -1 |
GET /employeer_photos/1 GET /employeer_photos/1.xml | def show
@employeer_photo = EmployeerPhoto.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.xml { render :xml => @employeer_photo }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @photos = @place.photos\n\n respond_to do |format|\n format.html # index.rhtml\n format.xml { render :xml => @photos.to_xml }\n end\n end",
"def index\n @photos = @album.photos\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml =... | [
"0.7021205",
"0.6991186",
"0.68855643",
"0.68562967",
"0.6823314",
"0.6785245",
"0.675399",
"0.67269087",
"0.67197615",
"0.67099184",
"0.67099184",
"0.67016125",
"0.6654352",
"0.6654352",
"0.6654352",
"0.65854",
"0.6563475",
"0.6556171",
"0.65220076",
"0.64986163",
"0.6496768... | 0.73147124 | 0 |
GET /employeer_photos/new GET /employeer_photos/new.xml | def new
@employeer_photo = EmployeerPhoto.new
respond_to do |format|
format.html # new.html.erb
format.xml { render :xml => @employeer_photo }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @photo = Photo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @photo }\n end\n end",
"def new\n @photo = Photo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @photo }\n end\n e... | [
"0.76789093",
"0.7656881",
"0.7656881",
"0.7656881",
"0.7656881",
"0.7589211",
"0.73934376",
"0.73681027",
"0.728968",
"0.72493386",
"0.71546924",
"0.71333224",
"0.71193355",
"0.7117364",
"0.7097368",
"0.70949614",
"0.7073234",
"0.70600307",
"0.7032316",
"0.70208544",
"0.6968... | 0.7681196 | 0 |
POST /employeer_photos POST /employeer_photos.xml | def create
params.permit!
@employeer_photo = EmployeerPhoto.new(params[:employeer_photo])
respond_to do |format|
if @employeer_photo.save
format.html { redirect_to(@employeer_photo, :notice => 'Employeer photo was successfully created.') }
format.xml { render :xml => @employeer_photo... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_photos\n end",
"def new\n @employeer_photo = EmployeerPhoto.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @employeer_photo }\n end\n end",
"def create\n @photos = Photo.new(photos_params)\n if @photos.save\n render json: { ... | [
"0.62909913",
"0.6231604",
"0.6213617",
"0.6114858",
"0.6065218",
"0.6017984",
"0.59850466",
"0.59501106",
"0.59114724",
"0.5888159",
"0.58792484",
"0.5852893",
"0.58437455",
"0.58437455",
"0.583115",
"0.5822247",
"0.5814714",
"0.5786569",
"0.57839644",
"0.57589906",
"0.57575... | 0.66124815 | 0 |
PUT /employeer_photos/1 PUT /employeer_photos/1.xml | def update
params.permit!
@employeer_photo = EmployeerPhoto.find(params[:id])
respond_to do |format|
if @employeer_photo.update_attributes(params[:employeer_photo])
format.html { redirect_to(@employeer_photo, :notice => 'Employeer photo was successfully updated.') }
format.xml { head... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @external_photo = ExternalPhoto.find(params[:id])\n\n respond_to do |format|\n if @external_photo.update_attributes(params[:external_photo])\n format.html { redirect_to(@external_photo, :notice => 'External photo was successfully updated.') }\n format.xml { head :ok }\n ... | [
"0.6551682",
"0.6227479",
"0.62112594",
"0.62112594",
"0.61981505",
"0.61981505",
"0.61912674",
"0.61843866",
"0.61517113",
"0.61387724",
"0.609813",
"0.609813",
"0.6084965",
"0.60780185",
"0.6056148",
"0.60500723",
"0.60146433",
"0.6010446",
"0.60079616",
"0.60002404",
"0.59... | 0.67561495 | 0 |
DELETE /employeer_photos/1 DELETE /employeer_photos/1.xml | def destroy
@employeer_photo = EmployeerPhoto.find(params[:id])
@employeer_photo.destroy
respond_to do |format|
format.html { redirect_to(employeer_photos_url) }
format.xml { head :ok }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @external_photo = ExternalPhoto.find(params[:id])\n @external_photo.destroy\n\n respond_to do |format|\n format.html { redirect_to(external_photos_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @photo = Photo.find(params[:id])\n @photo.destroy\n\n res... | [
"0.7390071",
"0.73049176",
"0.73049176",
"0.73049176",
"0.73049176",
"0.724216",
"0.7152938",
"0.7133334",
"0.7076093",
"0.70603186",
"0.7057082",
"0.70190424",
"0.70150715",
"0.6977161",
"0.69474304",
"0.69354755",
"0.69307935",
"0.6925841",
"0.69199824",
"0.6914239",
"0.690... | 0.7741073 | 0 |
Displays changelogs. If specified a `append` or `prepend` option, updates CHANGELOG.md with generated changelog. | def call
if append
changelog_editor.append!(content: changelog)
elsif prepend
changelog_editor.prepend!(content: changelog)
end
changelog
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def changelog\n # Add a changelog file to the project\n template 'CHANGELOG.md.tt', 'CHANGELOG.md'\n end",
"def changelog\n log = []\n method_name = \"changelog_format_#{ options[:format] }\"\n method_name = \"changelog_format_default\" unless internal_respond_to?(method_name)\n ... | [
"0.6310751",
"0.57279265",
"0.5565462",
"0.54473585",
"0.5424319",
"0.53452647",
"0.52762055",
"0.5273637",
"0.5247002",
"0.52327466",
"0.5216544",
"0.51734585",
"0.51233727",
"0.50943494",
"0.5040458",
"0.50107723",
"0.50029063",
"0.49747255",
"0.49681973",
"0.49261534",
"0.... | 0.66686517 | 0 |
Generate a changelog. The result is memoized. | def changelog
@changelog ||= Generator.call(version: version)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def make_changelog\n @hg_opener.open \"00changelog.i\", \"w\" do |file|\n file.write \"\\0\\0\\0\\2\" # represents revlogv2\n file.write \" dummy changelog to avoid using the old repo type\"\n end\n end",
"def changelog\n @changelog ||= Changelog.new\n end",... | [
"0.69628495",
"0.686272",
"0.6716532",
"0.6696447",
"0.6693983",
"0.662848",
"0.6592235",
"0.6544176",
"0.6369849",
"0.63471717",
"0.6214034",
"0.6166393",
"0.61531216",
"0.61159587",
"0.6011929",
"0.60071373",
"0.5903511",
"0.5848513",
"0.57742256",
"0.57402027",
"0.5728591"... | 0.80528075 | 0 |
GET /users/search GET /users/search.json | def search
@term = params[:term]
if @term.blank?
@users = []
else
@users = User.where("username like ? or name like ?", '%' + @term + '%', '%' + @term +'%')
end
respond_to do |format|
format.html { render action: "index" }
format.json { render json: @users, :except => [:encr... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def user_search(search, options = {})\n options[:search] = search\n get('/users', query: options)\n end",
"def user_search(options = {})\n get('users/search', options)\n end",
"def search\n render json: User.first(10)\n end",
"def search(query=nil)\n get \"/users/search\",... | [
"0.8416404",
"0.8318383",
"0.8209581",
"0.8060654",
"0.80482066",
"0.796682",
"0.7961551",
"0.79075205",
"0.7849024",
"0.7815027",
"0.77991945",
"0.77825606",
"0.7746899",
"0.77075386",
"0.7694017",
"0.7687762",
"0.76798165",
"0.7655766",
"0.7634275",
"0.7595615",
"0.7578957"... | 0.78788143 | 8 |
numb The number to be checked. Examples even(2) => true Returns the apropriate boolean. | def even(numb)
return true if numb % 2 == 0
return false
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def odd (numb)\n return true if numb % 2 == 1\n return false\nend",
"def yra_lyginis(number)\n return true if number.even?\n end",
"def bi_prime?(num)\n primers = prime_factors(num)\n primers.any? do |a|\n b = num / a * 1.0\n primers.include?(b)\n end\n\nend",
"def negative? ... | [
"0.63620746",
"0.63532937",
"0.6326939",
"0.6241462",
"0.61715555",
"0.61666137",
"0.6121135",
"0.60867345",
"0.6037339",
"0.6032077",
"0.6025928",
"0.5976946",
"0.5944149",
"0.59329545",
"0.5928087",
"0.59250134",
"0.59219056",
"0.5914971",
"0.589322",
"0.58822966",
"0.58470... | 0.6896664 | 0 |
return this string's note at fretNumber | def [](fretNum)
raise NoSuchFretError, E__M[:no_such_fret_error] unless (0..@length-1).include? fretNum
@notes[fretNum]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_notes(string, fret)\n raise \"bad string\" if string < 1 or string > 6\n raise \"bad fret\" if fret < 0 or fret > 15\n base_offset = 0\n base_offset =\n case(string)\n when 1 then 7\n when 2 then 2\n when 3 then 10\n when 4 then 5\n when 5 then 0\n when 6 then 7\n end\n offset ... | [
"0.7289233",
"0.6266605",
"0.6130525",
"0.61293477",
"0.59188145",
"0.5794624",
"0.571983",
"0.5705089",
"0.56339365",
"0.5610455",
"0.5583297",
"0.5565156",
"0.54837304",
"0.54532593",
"0.54488045",
"0.5441618",
"0.5441618",
"0.5422277",
"0.54064405",
"0.5401733",
"0.5397215... | 0.7308784 | 0 |
Is the note in the range of this string ? | def can_play_note?(*args)
case args[0]
when Tones::Note then #its a Note Object
@notes.include?(args[0])
when Object::String then #it's a String
if args[1].class == Fixnum
@notes.include?(Note.new(args[0], args[... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_range?\n self =~ /\\A(([\\d]+)|(['\"][\\w]{1}['\"]))\\.\\.\\.?(([\\d]+)|(['\"][\\w]{1}['\"]))\\z/i\n end",
"def matched_by_basic_range?(range)\n if range.kind_of?(Composition)\n s = range.composition\n elsif range.respond_to?(:to_str)\n s = range.to_str.downcase\n ... | [
"0.68953663",
"0.67529184",
"0.6697993",
"0.66948265",
"0.6673296",
"0.6548788",
"0.6392588",
"0.62981284",
"0.6277933",
"0.62529135",
"0.61955726",
"0.6192958",
"0.6192922",
"0.6143991",
"0.6129853",
"0.612511",
"0.60864174",
"0.6067615",
"0.60615224",
"0.6029926",
"0.601910... | 0.0 | -1 |
Perform the blockchain related operations that we couldn't perform earlier because the user did not have a vault, therefore they did not have wallet address | def push_transactions
AirdropMint.push_transactions_for_pending_rewards(user)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def post_transaction_process\n bet_wallet.persist_wallet!\n end",
"def wallet_address\n vault = current_resource_owner_vault\n return render({ json: nil, status: :no_content }) unless vault.present?\n render json: {wallet_address: vault.wallet_address}, status: :ok\n end",
"def transfer_s... | [
"0.59711444",
"0.5962332",
"0.570852",
"0.5659938",
"0.56377697",
"0.56377196",
"0.56142867",
"0.56038994",
"0.56012803",
"0.5525575",
"0.5506316",
"0.55037177",
"0.54473084",
"0.5375779",
"0.5370913",
"0.5296485",
"0.5292182",
"0.5291526",
"0.52772796",
"0.5249164",
"0.52464... | 0.0 | -1 |
format sequences: %c Current capacity (mAh) %r Current rate %b short battery status, '+', '', '!' %p battery load percentage %m remaining time in minutes %h remaining time in hours %t remaining time in as 'H:M' | def battery(format = '[%b] %p% %t')
now = Time.now
if @battery_last
if @battery_last < (now - 60)
@battery_last = now
@battery_value = battery_build(format)
else
@battery_value
end
else
@battery_last = now
@ba... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def format_status(prefix = '')\n cat, t_elapsed = status\n return \"\" if !cat or cat == \"break\"\n return \"#{prefix}#{cat}, for #{minutes_format(t_elapsed)}\"\nend",
"def format_time\n hours = format_hour @hour\n minutes = format_minute @minutes\n ampm = @hour < 12 ? @@ampm_hash['a'] : @@ampm_hash... | [
"0.6962964",
"0.6799334",
"0.6698788",
"0.65420026",
"0.6343325",
"0.6293248",
"0.62862194",
"0.6239424",
"0.62070775",
"0.61991924",
"0.61753184",
"0.6137737",
"0.6131172",
"0.6096232",
"0.6082391",
"0.60609263",
"0.6049755",
"0.60459703",
"0.6040806",
"0.6016988",
"0.599893... | 0.61377007 | 12 |
This method is really paranoid and will hopefully break right away if any of my assumptions about the API interface are broken. | def ledger_entries
tx = raw
# Delete keys that have expected values.
raise "UNHANDLED CASE" unless tx.delete("is_market") == false
raise "UNHANDLED CASE" unless tx.delete("is_market_cancel") == false
raise "UNHANDLED CASE" unless tx.delete("is_virtual") == false
raise "UNHANDLED CA... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def private; end",
"def internal; end",
"def implementation; end",
"def implementation; end",
"def private_method\n end",
"def awaken!\n\t\traise 'Not implemented'\n\tend",
"def internal?; end",
"def full_object\n fail NotImplementedError\n end",
"def api_error; end",
"de... | [
"0.7573199",
"0.65217817",
"0.6485746",
"0.6485746",
"0.6454619",
"0.6249976",
"0.62457365",
"0.60665125",
"0.60277593",
"0.6021228",
"0.5989127",
"0.59749806",
"0.59250057",
"0.59064263",
"0.5881737",
"0.58785737",
"0.5875965",
"0.58071935",
"0.5777537",
"0.5777537",
"0.5777... | 0.0 | -1 |
Write a badge_maker method that, when provided a person's name, will create and return this message. E.g.: | def badge_maker(name)
return "Hello, my name is #{name}."
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def badge_maker(name)\n return \"Hello, my name is #{name}.\"\n end",
"def badge_maker(name)\n\treturn \"Hello, my name is #{name}.\" \nend",
"def badge_maker( name )\n return \"Hello, my name is #{name}.\"\nend",
"def badge_maker(name)\n return \"Hello, my name is #{name}.\"\nend",
"def badge_make... | [
"0.79895234",
"0.7832717",
"0.7671825",
"0.7579022",
"0.75549",
"0.75549",
"0.7377434",
"0.7367538",
"0.7367538",
"0.7367538",
"0.7351128",
"0.7313941",
"0.7313941",
"0.7313941",
"0.7313941",
"0.7313941",
"0.7313941",
"0.7313941",
"0.7313941",
"0.7313941",
"0.7313941",
"0.7... | 0.75709677 | 11 |
Write a batch_badge_creator method that takes an array of names as an argument and returns an array of badge messages. | def batch_badge_creator(attendees)
greet_attendees = []
attendees.each do |name|
greet_attendees.push("Hello, my name is #{name}.")
end
return greet_attendees
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def batch_badge_creator(array_of_names)\n badge_messages = []\n\n array_of_names.each do |name|\n badge_messages << badge_maker(name)\n end\n\n return badge_messages\nend",
"def batch_badge_creator(names)\n names.collect { |array_value| badge_maker(array_value) }\nend",
"def batch_badge_cre... | [
"0.8926995",
"0.87869465",
"0.8723649",
"0.8635981",
"0.8611365",
"0.8535019",
"0.8495413",
"0.849157",
"0.83260304",
"0.827069",
"0.8246153",
"0.8200431",
"0.808915",
"0.8045892",
"0.8035544",
"0.8009779",
"0.7943623",
"0.7898613",
"0.7646562",
"0.76378477",
"0.7634635",
"... | 0.7347188 | 30 |
You just realized that you also need to give each speaker a room assignment. Write a method called assign_rooms that takes the list of speakers and assigns each speaker to a room. Make sure that each room only has one speaker. You have rooms 17. Return a list of room assignments in the form of: "Hello, _____! You'll be... | def assign_rooms(attendees)
attendees_room = []
attendees.each_with_index do |name, index|
attendees_room.push("Hello, #{name}! You'll be assigned to room #{index + 1}!")
end
return attendees_room
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def assign_rooms(array_speakers)\n room_assignments = []\n array_speakers.each_with_index {|speaker, room| room_assignments.push \"Hello, #{speaker}! You'll be assigned to room #{room+1}!\"}\n room_assignments\nend",
"def assign_rooms(speakers)\n speakers.each.with_index(1).collect {|speaker, index| \"Hello,... | [
"0.8686995",
"0.86576635",
"0.86492807",
"0.86211795",
"0.85808486",
"0.8293431",
"0.7869351",
"0.78606606",
"0.76937485",
"0.7661461",
"0.76115763",
"0.7549242",
"0.75321436",
"0.74951524",
"0.74301666",
"0.74120164",
"0.73732185",
"0.7364075",
"0.73588187",
"0.73423874",
"0... | 0.71280295 | 26 |
Now you have to tell the printer what to print. Create a method called printer that will output first the results of the batch_badge_creator method and then of the assign_rooms method to the screen. Hint: Remember that methods can call other methods. If the return value of assign_rooms is an array of room assignments, ... | def printer(attendees)
batch_badge_creator(attendees).each do |x|
puts x
end
assign_rooms(attendees).each do |x|
puts x
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def printer(guests)\n batch_badge_creator(guests).map{|greeting| puts greeting}\n assign_rooms(guests).map{|room_assignment| puts room_assignment}\nend",
"def printer(attendees)\n batch_badge_creator(attendees)\n assign_rooms(attendees)\n\n batch_badge_creator(attendees).each do |badge|\n p... | [
"0.8426307",
"0.84011465",
"0.8270863",
"0.8264054",
"0.82623553",
"0.82505107",
"0.82379055",
"0.81680423",
"0.8164418",
"0.81554896",
"0.8151146",
"0.8143917",
"0.81305045",
"0.80967873",
"0.80967873",
"0.80967873",
"0.8088773",
"0.8082243",
"0.8082243",
"0.8068585",
"0.799... | 0.79606116 | 21 |
Creates an object and saves it to the MLS. The resulting object is returned whether or no the object was saved successfully to the MLS or not. ==== Examples !ruby Create a single new object User.create(:first_name => 'Jamie') Create a single object and pass it into a block to set other attributes. User.create(:first_na... | def create(attributes={}, &block) # TODO: testme
model = self.new(attributes)
yield(model) if block_given?
model.save
model
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create(attributes = {}, &block)\n new(attributes, &block).tap { |record| record.save }\n end",
"def create!(*args)\n new(*args).tap do |o|\n yield o if block_given?\n o.save!\n end\n end",
"def save(**options, &block)\n create_or_update(**... | [
"0.6797134",
"0.6675679",
"0.6591543",
"0.6539692",
"0.6411254",
"0.63473856",
"0.6270805",
"0.6263824",
"0.6213461",
"0.62050974",
"0.62050974",
"0.61817825",
"0.61689556",
"0.6123473",
"0.61142623",
"0.6111527",
"0.60815126",
"0.6053065",
"0.5992786",
"0.5932042",
"0.591941... | 0.6969298 | 0 |
== for rails form stuff | def model_name
self
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def form; end",
"def form_data?; end",
"def ing_form; end",
"def forms; end",
"def is_valid; end",
"def text_field?(field_name); end",
"def form_node; end",
"def is_valid\n\tend",
"def is_valid\n\tend",
"def text_field; end",
"def set_form(easy)\n end",
"def form\n end",
"def form?\... | [
"0.6859142",
"0.66955876",
"0.6690325",
"0.65602326",
"0.6176512",
"0.6079743",
"0.5978453",
"0.59347993",
"0.59347993",
"0.5934294",
"0.59267324",
"0.59130585",
"0.5875503",
"0.58684087",
"0.5775239",
"0.57683486",
"0.57681",
"0.5763611",
"0.5759861",
"0.5735767",
"0.5735767... | 0.0 | -1 |
GET /ballots GET /ballots.json | def index
@ballots = Ballot.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n\t\tboats = Boat.all\n \trender json: boats, status: 200\n\tend",
"def index\n @biddings = Bidding.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @biddings }\n end\n end",
"def index\n @bounties = Bounty.all\n\n respond_to do |... | [
"0.69473237",
"0.6832516",
"0.67861664",
"0.67768717",
"0.67754745",
"0.6649296",
"0.6544957",
"0.6514344",
"0.6500484",
"0.64289516",
"0.64177483",
"0.64098406",
"0.6382525",
"0.6376516",
"0.63596666",
"0.63553804",
"0.6354657",
"0.6349308",
"0.63492274",
"0.63451",
"0.63356... | 0.7346722 | 1 |
GET /ballots/1 GET /ballots/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @boat = Boat.find(params[:id])\n\n render json: @boat\n end",
"def index\n @ballots = Ballot.all\n end",
"def index\n @ballots = Ballot.all\n end",
"def index\n\t\tboats = Boat.all\n \trender json: boats, status: 200\n\tend",
"def show\n @boat = Boat.find(params[:id])\n\n ... | [
"0.7154891",
"0.7102896",
"0.7102896",
"0.67852986",
"0.6756211",
"0.66598725",
"0.6634666",
"0.6632429",
"0.66032934",
"0.6557399",
"0.64695853",
"0.64421344",
"0.643513",
"0.639747",
"0.63197416",
"0.6308758",
"0.6283131",
"0.6244497",
"0.6232777",
"0.6224811",
"0.62192154"... | 0.0 | -1 |
POST /ballots POST /ballots.json | def create
@ballot = Ballot.new(ballot_params)
category_id = params[category_id].to_i
# Registra que voto en esa categoria, pero no se sabrá a quien voto.
@emitted_vote = EmittedVote.create!(user_id: current_user.id , category_id: @ballot.category_id)
respond_to do |format|
if @ballot.save
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @ballot = Ballot.new(ballot_params)\n\n respond_to do |format|\n if @ballot.save\n format.html { redirect_to ballots_url, notice: 'Thank you for voting.' }\n format.json { render :show, status: :created, location: @ballot }\n else\n format.html { render :new }\n ... | [
"0.6852122",
"0.6581447",
"0.64713854",
"0.6326145",
"0.6084623",
"0.6071214",
"0.60545236",
"0.60543203",
"0.60488826",
"0.59930396",
"0.59762484",
"0.5975742",
"0.59015805",
"0.58721465",
"0.5869704",
"0.5842882",
"0.58309186",
"0.5821373",
"0.581941",
"0.5816376",
"0.58015... | 0.5911212 | 12 |
Use callbacks to share common setup or constraints between actions. | def set_ballot
@ballot = Ballot.find(params[:id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_... | [
"0.6163754",
"0.6045816",
"0.5944853",
"0.59169096",
"0.58892167",
"0.58342934",
"0.5776148",
"0.57057375",
"0.57057375",
"0.56534296",
"0.56209534",
"0.54244673",
"0.54101455",
"0.54101455",
"0.54101455",
"0.53951085",
"0.5378493",
"0.53563684",
"0.53399915",
"0.5338049",
"0... | 0.0 | -1 |
Never trust parameters from the scary internet, only allow the white list through. | def ballot_params
params.require(:ballot).permit( :selection_process_id , :category_id , :candidate_id , :digital_signature )
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def allow_params_authentication!; end",
"def allowed_params\n ALLOWED_PARAMS\n end",
"def default_param_whitelist\n [\"mode\"]\n... | [
"0.6979893",
"0.6781746",
"0.6746611",
"0.6742344",
"0.6735229",
"0.6592651",
"0.65027124",
"0.6498011",
"0.648163",
"0.647716",
"0.64556813",
"0.64386255",
"0.63784456",
"0.63756156",
"0.636574",
"0.6319542",
"0.63004524",
"0.6299559",
"0.62925464",
"0.62923217",
"0.6289894"... | 0.0 | -1 |
GET /configuration_files GET /configuration_files.json | def index
@configuration_files = ConfigurationFile.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def config_files\n @config_files\n end",
"def configuration\n _get(\"/system/configuration\") { |json| json }\n end",
"def index\n if current_user.role.title != 'admin'\n if current_user.developer.nil?\n @config_files = []\n else\n @config_files = current_user.dev... | [
"0.6963498",
"0.66987467",
"0.6693345",
"0.6639942",
"0.64749026",
"0.64508426",
"0.6441026",
"0.6415851",
"0.6415851",
"0.64132625",
"0.63984317",
"0.637665",
"0.63569623",
"0.6355815",
"0.62953866",
"0.62118906",
"0.61420554",
"0.6134027",
"0.61274266",
"0.61037856",
"0.610... | 0.7120772 | 0 |
GET /configuration_files/1 GET /configuration_files/1.json | def show
puts @configuration_file.file_content
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @configuration_files = ConfigurationFile.all\n end",
"def show\n #@config_file = ConfigFile.find(params[:id])\n @config_file = current_user.developer.config_files.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @config_fil... | [
"0.7009513",
"0.678855",
"0.6685456",
"0.6589298",
"0.6560235",
"0.6546722",
"0.64701444",
"0.64074725",
"0.63482505",
"0.6345484",
"0.6335407",
"0.63209593",
"0.62865525",
"0.6162066",
"0.6150729",
"0.6131899",
"0.6084534",
"0.6060576",
"0.60595065",
"0.60279167",
"0.6016612... | 0.6198728 | 13 |
POST /configuration_files POST /configuration_files.json | def create
@configuration_file = ConfigurationFile.new(configuration_file_params)
respond_to do |format|
if @configuration_file.save
format.html { redirect_to @configuration_file, notice: 'Configuration file was successfully created.' }
format.json { render :show, status: :created, locati... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @config_file = ConfigFile.new(params[:config_file])\n\n respond_to do |format|\n if @config_file.save\n format.html { redirect_to @config_file, notice: 'Config file was successfully created.' }\n format.json { render json: @config_file, status: :created, location: @config_file... | [
"0.68451416",
"0.64829373",
"0.6166733",
"0.5969217",
"0.58534807",
"0.5797711",
"0.5761078",
"0.5725908",
"0.5719378",
"0.5695943",
"0.5671669",
"0.56287867",
"0.56283504",
"0.5614032",
"0.5599285",
"0.55959713",
"0.557251",
"0.5567103",
"0.5548194",
"0.54997635",
"0.5486249... | 0.70808 | 0 |
PATCH/PUT /configuration_files/1 PATCH/PUT /configuration_files/1.json | def update
respond_to do |format|
if @configuration_file.update(configuration_file_params)
format.html { redirect_to @configuration_file, notice: 'Configuration file was successfully updated.' }
format.json { render :show, status: :ok, location: @configuration_file }
else
format.... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @config_file = ConfigFile.find(params[:id])\n\n respond_to do |format|\n if @config_file.update_attributes(params[:config_file])\n format.html { redirect_to @config_file, notice: 'Config file was successfully updated.' }\n format.json { head :no_content }\n else\n ... | [
"0.7010898",
"0.62737185",
"0.62599784",
"0.6163748",
"0.6099116",
"0.6018442",
"0.5942897",
"0.59357065",
"0.59334445",
"0.58940834",
"0.5849135",
"0.5835924",
"0.5834922",
"0.58349",
"0.58242553",
"0.5810742",
"0.58087045",
"0.5791788",
"0.5788883",
"0.5760921",
"0.5744056"... | 0.6980877 | 1 |
DELETE /configuration_files/1 DELETE /configuration_files/1.json | def destroy
@configuration_file.destroy
respond_to do |format|
format.html { redirect_to configuration_files_url, notice: 'Configuration file was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @config_file = ConfigFile.find(params[:id])\n @config_file.destroy\n\n respond_to do |format|\n format.html { redirect_to config_files_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @my_configuration = MyConfiguration.find(params[:id])\n @my_confi... | [
"0.7482981",
"0.7143029",
"0.7079989",
"0.68211895",
"0.6815434",
"0.6791247",
"0.675717",
"0.66720086",
"0.6653171",
"0.6618411",
"0.6618411",
"0.6590796",
"0.65703946",
"0.65522623",
"0.6548",
"0.6544999",
"0.65396523",
"0.65049106",
"0.64773864",
"0.64437485",
"0.64077663"... | 0.7533817 | 0 |
Use callbacks to share common setup or constraints between actions. | def set_configuration_file
@configuration_file = ConfigurationFile.find(params[:id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_... | [
"0.6165152",
"0.60463154",
"0.59467196",
"0.5917112",
"0.5890387",
"0.58345735",
"0.57773316",
"0.56991524",
"0.56991524",
"0.565454",
"0.5622282",
"0.54232633",
"0.54119074",
"0.54119074",
"0.54119074",
"0.53937256",
"0.53801376",
"0.5358599",
"0.53412294",
"0.5340814",
"0.5... | 0.0 | -1 |
Never trust parameters from the scary internet, only allow the white list through. | def configuration_file_params
params.require(:configuration_file).permit(:configuration_template_id, :version, :file_content)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def allow_params_authentication!; end",
"def allowed_params\n ALLOWED_PARAMS\n end",
"def default_param_whitelist\n [\"mode\"]\n... | [
"0.6980629",
"0.67819995",
"0.67467666",
"0.67419875",
"0.67347664",
"0.65928614",
"0.6504013",
"0.6498014",
"0.64819515",
"0.64797956",
"0.64562726",
"0.64400834",
"0.6380117",
"0.6377456",
"0.63656694",
"0.6320543",
"0.63002014",
"0.62997127",
"0.629425",
"0.6293866",
"0.62... | 0.0 | -1 |
wrap run_locally so we can catch failures | def run_local(cmd)
require 'English'
system cmd
return unless $CHILD_STATUS.exitstatus != 0
puts 'exit code: ' + $CHILD_STATUS.exitstatus.to_s
exit
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def run_and_raise_on_failure\n # TODO ?\n end",
"def run_failed; end",
"def run_locally(cmd)\n if dry_run\n return logger.debug \"executing locally: #{cmd.inspect}\"\n end\n logger.trace \"executing locally: #{cmd.inspect}\" if logger\n output_on_stdout = nil\n elapsed = Ben... | [
"0.6465648",
"0.61050826",
"0.5868986",
"0.57489115",
"0.57344484",
"0.5713881",
"0.5712282",
"0.56999326",
"0.5635161",
"0.5632869",
"0.5580629",
"0.5534057",
"0.5508429",
"0.5506986",
"0.5490259",
"0.54633874",
"0.5443327",
"0.5421142",
"0.54037976",
"0.53697765",
"0.536658... | 0.4901929 | 93 |
DELETE /users/1 DELETE /users/1.json | def destroy
@user.destroy
respond_to do |format|
format.html { redirect_to users_url, notice: 'User was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def DeleteUser id\n \n APICall(path: \"users/#{id}.json\",method: 'DELETE')\n \n end",
"def delete\n render json: User.delete(params[\"id\"])\n end",
"def delete(id)\n request(:delete, \"/users/#{id}.json\")\n end",
"def delete\n render json: Users.delete(params[\"id\... | [
"0.78748035",
"0.7751536",
"0.77133286",
"0.7609853",
"0.74719006",
"0.74066395",
"0.74066395",
"0.73689586",
"0.73451644",
"0.7339677",
"0.732709",
"0.73090446",
"0.7308616",
"0.73056364",
"0.72965425",
"0.7290797",
"0.7290501",
"0.72882193",
"0.7283193",
"0.7249783",
"0.724... | 0.0 | -1 |
Use callbacks to share common setup or constraints between actions. | def set_user
@user = User.find(params[:id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_... | [
"0.6165152",
"0.60463154",
"0.59467196",
"0.5917112",
"0.5890387",
"0.58345735",
"0.57773316",
"0.56991524",
"0.56991524",
"0.565454",
"0.5622282",
"0.54232633",
"0.54119074",
"0.54119074",
"0.54119074",
"0.53937256",
"0.53801376",
"0.5358599",
"0.53412294",
"0.5340814",
"0.5... | 0.0 | -1 |
Never trust parameters from the scary internet, only allow the white list through. | def user_params
params.require(:user).permit(:name, :password)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def allow_params_authentication!; end",
"def allowed_params\n ALLOWED_PARAMS\n end",
"def default_param_whitelist\n [\"mode\"]\n... | [
"0.6980629",
"0.67819995",
"0.67467666",
"0.67419875",
"0.67347664",
"0.65928614",
"0.6504013",
"0.6498014",
"0.64819515",
"0.64797956",
"0.64562726",
"0.64400834",
"0.6380117",
"0.6377456",
"0.63656694",
"0.6320543",
"0.63002014",
"0.62997127",
"0.629425",
"0.6293866",
"0.62... | 0.0 | -1 |
returns a string representation | def to_s
"ValidationError on #{@element_type} #{@element_name}: #{@message}"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_s() end",
"def to_s() end",
"def to_s() end",
"def to_s() end",
"def to_s() end",
"def to_s() end",
"def to_s() end",
"def to_s() end",
"def to_s() end",
"def to_s() end",
"def to_s() end",
"def to_s() end",
"def to_s() end",
"def to_s() end",
"def to_s() end",
"def to_s() end"... | [
"0.8577759",
"0.8577759",
"0.8577759",
"0.8577759",
"0.8577759",
"0.8577759",
"0.8577759",
"0.8577759",
"0.8577759",
"0.8577759",
"0.8577759",
"0.8577759",
"0.8577759",
"0.8577759",
"0.8577759",
"0.8577759",
"0.8577759",
"0.8577759",
"0.85576206",
"0.8524609",
"0.8499994",
... | 0.0 | -1 |
initializes the Validation object on given +project+ | def initialize(project)
@project = project
@errors = []
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initialize(project)\n @project = project\n end",
"def initialize(project)\n @project = project\n end",
"def initialize(project)\n @project = project\n end",
"def new\n @project = Project.new\n @errors = []\n end",
"def validate\n needs :project\n end",
"def init... | [
"0.6946855",
"0.6946855",
"0.6936382",
"0.6813741",
"0.6678214",
"0.6427678",
"0.6379047",
"0.63122326",
"0.6067123",
"0.595172",
"0.5941557",
"0.5867634",
"0.58595675",
"0.58304214",
"0.5817937",
"0.57701635",
"0.5741473",
"0.57131386",
"0.5707738",
"0.56871665",
"0.5682119"... | 0.75609404 | 0 |
ensures that objects of given +type_as_string+ (i.e. networks) are attached to zones | def objects_attached_to_zones?(type_as_string)
zones = @project.get_element('zones')
@project.get_element(type_as_string).each do |name, data|
zone = data[:zone] # assume that this object contains ref to a zone
if !zone
mark("#{type_as_string} is not attached to a zone", type_as... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def uplink_has_network_of_type?(uplink, type)\n uplink_networks(uplink).map do |network|\n network[\"type\"].downcase\n end.include?(type.downcase)\n end",
"def objects_in_zone(type_name, zone_name)\n return {} unless @project.element?(type_name)\n objects = @project... | [
"0.5933915",
"0.5790724",
"0.5671992",
"0.5326637",
"0.52994096",
"0.52509725",
"0.52442294",
"0.52385736",
"0.5236246",
"0.5221936",
"0.5221063",
"0.52001566",
"0.5163778",
"0.51371914",
"0.50815135",
"0.50777096",
"0.50111014",
"0.49819335",
"0.49797684",
"0.49673697",
"0.4... | 0.76799417 | 0 |
Ask the player to enter the row and column of their next move TODO: Handle bad user input here. Q: Should we handle the case when the row and column are already taken in the UserInterface class? | def ask_player_for_move(player)
print "#{player} - enter your next move (row, column): "
row_col = gets.chomp
row, col = row_col.split(",").map {|row_or_col| row_or_col.to_i }
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def player_move\n\t \tvalid_move = false\n\t \twhile !valid_move\n\t \t\tdisplay_game\n\t \t\trow_choice = 0\n\t \t\tstick_choice = 0\n\t\t # get the user selections\n\t\t valid_input = false\n\t\t puts \"Enter the row (1-#{@current_config.length}): \"\n\t\t row_choice = gets.chomp.to_i - 1\n\t\t ... | [
"0.74995023",
"0.73497105",
"0.71226096",
"0.7111984",
"0.7110302",
"0.7025113",
"0.7017189",
"0.68529767",
"0.6830236",
"0.68229944",
"0.6817832",
"0.68176275",
"0.67493427",
"0.67189",
"0.66936547",
"0.66461706",
"0.66092795",
"0.6596585",
"0.6584486",
"0.6562168",
"0.65587... | 0.7822993 | 0 |
rubocop:disable Metrics/CyclomaticComplexity rubocop:disable Metrics/PerceivedComplexity rubocop:disable Metrics/MethodLength rubocop:disable Metrics/BlockNesting | def operator_validator(line)
operators = ['+', '-', '>', '<', '!', '*', '=']
ret_arr = []
operators.each do |n|
arr = line.chars
counter = 0
while counter < arr.length
if arr[counter] == n
if operators.include?(arr[counter - 1]) && n == '='
counter += 1
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def block; end",
"def block; end",
"def block; end",
"def block; end",
"def block; end",
"def block; end",
"def block; end",
"def block; end",
"def block; end",
"def block; end",
"def block; end",
"def block; end",
"def block; end",
"def block; end",
"def block; end",
"def block; end"... | [
"0.687058",
"0.687058",
"0.687058",
"0.687058",
"0.687058",
"0.687058",
"0.687058",
"0.687058",
"0.687058",
"0.687058",
"0.687058",
"0.687058",
"0.687058",
"0.687058",
"0.687058",
"0.687058",
"0.687058",
"0.687058",
"0.687058",
"0.687058",
"0.6375489",
"0.6375489",
"0.637... | 0.0 | -1 |
This is simplified from examples/h2o/h2o.conf upstream. | def conf_example(port = 8080)
<<~EOS
listen: #{port}
hosts:
"127.0.0.1.xip.io:#{port}":
paths:
/:
file.dir: #{var}/h2o/
EOS
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def configuration_for(host, use_ssh_config); end",
"def configure; end",
"def ec2_driver_config\n {\n 'name' => 'ec2',\n 'aws_ssh_key_id' => \"#{cookbook_name}-kitchen\",\n 'security_group_ids' => ENV['AWS_SECURITY_GROUP_ID'] ? [ENV['AWS_SECURITY_GROUP_ID']] : [DEFAULT_EC2_SEC... | [
"0.5503104",
"0.5449274",
"0.5243229",
"0.5231314",
"0.5199859",
"0.51627195",
"0.5158672",
"0.5084295",
"0.50738186",
"0.4991646",
"0.4991646",
"0.49602443",
"0.4909721",
"0.48599014",
"0.48531184",
"0.48499158",
"0.48365283",
"0.47960937",
"0.4784005",
"0.47756404",
"0.4769... | 0.6411706 | 0 |
Using `const_get` we can resolve a class name (a string), into a real reference to the class. | def adapter(db_name)
adapter_class_name = "#{db_name.capitalize}Adapter"
Adapters.const_get(adapter_class_name)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def class_from_string(class_name)\n parts = class_name.split('::')\n constant = Object\n parts.each do |part|\n constant = constant.const_get(part)\n end\n constant\nend",
"def get_class(name)\n # 'self' -- the class from which get_class is called.\n self.const_get(name)\n end",
"def get_class_r... | [
"0.7734858",
"0.7679182",
"0.76622945",
"0.7531244",
"0.74756914",
"0.74756914",
"0.7348552",
"0.72855407",
"0.7257973",
"0.7220335",
"0.7141776",
"0.7141776",
"0.7087129",
"0.7034064",
"0.70241696",
"0.69683343",
"0.6927187",
"0.6878889",
"0.6840849",
"0.6804589",
"0.6791509... | 0.0 | -1 |
TODO RUN THE TESTS | def decrease_wallet_after_buying_food(food)
return @wallet -= food.price
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def private; end",
"def run; end",
"def run; end",
"def run; end",
"def run; end",
"def run; end",
"def run; end",
"def run; end",
"def run; end",
"def run; end",
"def setup; end",
"def setup; end",
"def setup; end",
"def setup; end",
"def setup; end",
"def setup; end",
"def setup; ... | [
"0.6755467",
"0.66386086",
"0.66386086",
"0.66386086",
"0.66386086",
"0.66386086",
"0.66386086",
"0.66386086",
"0.66386086",
"0.66386086",
"0.6539626",
"0.6539626",
"0.6539626",
"0.6539626",
"0.6539626",
"0.6539626",
"0.6539626",
"0.6539626",
"0.6539626",
"0.6539626",
"0.6539... | 0.0 | -1 |
Displays the detail page of a client. | def show
@client = Client.find(params[:id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @client = clients.find(params[:id])\n end",
"def show\n\n @client = Client.find(params[:id])\n end",
"def show\n @client = Client.find(params[:id])\n\n end",
"def show\n @client = Client.find_by(id: params[:id])\n end",
"def show\n # @client = Client.find(params[:client_id])\n ... | [
"0.76072675",
"0.75797534",
"0.74878526",
"0.7410436",
"0.73494667",
"0.7333948",
"0.7330242",
"0.7286186",
"0.72826463",
"0.72035426",
"0.72035426",
"0.72035426",
"0.72035426",
"0.72035426",
"0.72035426",
"0.72035426",
"0.71739703",
"0.7171317",
"0.71235085",
"0.71234006",
"... | 0.7528069 | 5 |
Deactivates a client changeing `is_active` to false. | def deactivate
@client = Client.find(params[:client_id])
@client.is_active = false
if @client.save
redirect_to client_path(@client), notice: 'El cliente fue desactivado'
else
redirect_to client_path(@client), notice: 'No pudimos deactivar este cliente'
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def deactivate\n @client.delete(\"paypal_accounts/#{id}\")\n @attributes['active'] = false\n true\n end",
"def deactivate!\n update(status: false)\n end",
"def deactivate\n update(state: 'inactive')\n end",
"def deactivate\n @active = false\n end",
"def deactivate\n ... | [
"0.7335975",
"0.72230077",
"0.71297145",
"0.7119514",
"0.70644593",
"0.69905686",
"0.69077224",
"0.6907242",
"0.680328",
"0.6705646",
"0.66635585",
"0.66569644",
"0.66094613",
"0.6600349",
"0.6571529",
"0.6571529",
"0.6548756",
"0.6511431",
"0.6510686",
"0.6507199",
"0.640881... | 0.7935806 | 0 |
The capybara current session | def page
Capybara.current_session
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def current_page\n Capybara.current_session\n end",
"def session\n if Thread.current['capybara_session'].nil?\n Thread.current['capybara_session'] = Capybara::Session.new(config[:default_driver])\n Thread.current['capybara_session'].driver.browser.manage.window.maximize\n ... | [
"0.8389733",
"0.78076035",
"0.752785",
"0.747175",
"0.73563373",
"0.7108148",
"0.7053154",
"0.69947046",
"0.6963991",
"0.6886916",
"0.6881265",
"0.6825173",
"0.6807369",
"0.6807369",
"0.6807369",
"0.67574143",
"0.6705335",
"0.66786915",
"0.6673125",
"0.6623218",
"0.66121894",... | 0.79169714 | 1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.