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 |
|---|---|---|---|---|---|---|
creates a simple_box using the passed key created_simple_box('secret') | def create_simple_box(key)
@simple_box ||= RbNaCl::SimpleBox.from_secret_key(RbNaCl::Hash.sha256(key))
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def box(message)\n nonce = generate_nonce\n salt, iters, @key = generate_key\n ciphertext = super(nonce, message)\n\n Base64.encode64(nonce + salt + iters + ciphertext)\n end",
"def initialize(secret, *_signature_key_or_options)\n @box = RbNaCl::SimpleBox.from_secret_key(secret)\n end",
"d... | [
"0.6342796",
"0.61566824",
"0.60359806",
"0.5960799",
"0.5935055",
"0.5865981",
"0.57662684",
"0.5755996",
"0.572328",
"0.5687613",
"0.5666768",
"0.5653951",
"0.55917954",
"0.55862254",
"0.5583061",
"0.558299",
"0.5580354",
"0.5572881",
"0.55629635",
"0.55563784",
"0.55394053... | 0.87237 | 0 |
Input: an array Output: return the same array object Reverses it's elements in place Do not use the built in reverse method If the array has only one element, it should not be modified If the array is empty, return an empty array Algorithm: Create a copy of the array Initialize a counter variable at 1 Iterate through t... | def reverse!(array)
copy = array.clone
index = -1
copy.each do |element|
array[index] = element
index -= 1
end
array
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def reverse(array)\n new_array = array.dup\n counter, finish, max = 0, -1, (array.length)\n while counter < max\n new_array[finish] = array[counter]\n counter += 1\n finish -= 1\n end\n new_array\nend",
"def reverse_array(array_new)\n array_new.reverse \n end",
"def reverse_array(array)\n ... | [
"0.8345768",
"0.83048946",
"0.82791376",
"0.8254615",
"0.82431704",
"0.8236108",
"0.8221178",
"0.82112265",
"0.8158189",
"0.8158189",
"0.81335837",
"0.8127086",
"0.8127086",
"0.81184006",
"0.8116939",
"0.8102993",
"0.8100507",
"0.8100507",
"0.8100507",
"0.8095291",
"0.8086722... | 0.85933065 | 0 |
Cookbook Name:: postgresql Provider:: user Support whyrun | def whyrun_supported?
true
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def configure_postgres\n<<BASH\necho \"deb http://apt.postgresql.org/pub/repos/apt/ trusty-pgdg main\" > /etc/apt/sources.list.d/pgdg.list\nwget --quiet https://www.postgresql.org/media/keys/ACCC4CF8.asc\napt-key add ACCC4CF8.asc\napt-get update\napt-get install postgresql-9.2 -y\necho \"host all al... | [
"0.62886536",
"0.60091764",
"0.5991353",
"0.5370633",
"0.53499204",
"0.53455484",
"0.53128284",
"0.52619463",
"0.5256299",
"0.525462",
"0.5250388",
"0.5200656",
"0.5199335",
"0.5197407",
"0.51899636",
"0.5172871",
"0.5150379",
"0.51087534",
"0.50926024",
"0.5075708",
"0.50500... | 0.5110954 | 68 |
log in, create session | def create
# raise.params
@teacher = Teacher.find_by_name(params[:teacher][:name])
# byebug
if @teacher.try(:authenticate, params[:teacher][:password])
session[:teacher_id] = @teacher.id
flash[:message] = 'Login successful!'
redirect_to home_path
e... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_session\n login, password = get_login_and_password\n create_session_with authenticate_user(login, password, :trace => true)\n end",
"def create\n action = LogUserIn.new :web\n @session = Session.new params[:session]\n\n if user = action.run(@session.login, @session.password)\n pre... | [
"0.78070337",
"0.7703659",
"0.74900514",
"0.748062",
"0.746704",
"0.73388034",
"0.7338072",
"0.73370826",
"0.7324193",
"0.73100644",
"0.7305753",
"0.7299712",
"0.7249769",
"0.7249769",
"0.7249769",
"0.7249769",
"0.7249769",
"0.7249769",
"0.7249769",
"0.7249769",
"0.7249769",
... | 0.0 | -1 |
the virus_effects method is responisbile for returning the predicted_deaths and speed_of_spread methods within the VirusPredictor class. | def virus_effects #HINT: What is the SCOPE of instance variables? these methods can only be used within a virusPredictor class, its scope.
predicted_deaths(@population_density, @population, @state)
speed_of_spread(@population_density, @state)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def virus_effects\n #removed parameters for predicted_deaths and speed_of_spread, as these are class variables and are accessible throughout the method\n predicted_deaths\n speed_of_spread\n end",
"def virus_effects\n predicted_deaths()\n speed_of_spread()\n end",
"def virus_effects\n predi... | [
"0.90412235",
"0.8724202",
"0.8724202",
"0.8724202",
"0.86995494",
"0.8694428",
"0.86938316",
"0.86925656",
"0.8670471",
"0.86605644",
"0.8638227",
"0.86316586",
"0.86263496",
"0.8620752",
"0.86095816",
"0.8602829",
"0.8575213",
"0.8575213",
"0.85514617",
"0.85514617",
"0.855... | 0.8626954 | 12 |
private methods can not be called with an explicit receiver, the receiver is always 'self'. the preducted_deaths method is responsible for taking the inputs of population_density, population and state and returning the estimated number of deaths that will be caused by an 'this' outbreak. | def predicted_deaths(population_density, population, state)
if @population_density >= 200
number_of_deaths = (@population * 0.4).floor
elsif @population_density >= 150
number_of_deaths = (@population * 0.3).floor
elsif @population_density >= 100
number_of_deaths = (@population * 0.2).floor... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def predicted_deaths#(population_density, population, state)\r\n # predicted deaths is solely based on population density\r\n number_of_deaths = (@population * 0.4).floor if @population_density >= 200\r\n \r\n number_of_deaths = (@population * 0.3).floor if @population_density >= 150\r\n \r\n ... | [
"0.83057314",
"0.8271507",
"0.8221329",
"0.82123244",
"0.82113117",
"0.8210758",
"0.82071584",
"0.82010776",
"0.82004523",
"0.8186866",
"0.8168186",
"0.8168119",
"0.8157305",
"0.8157305",
"0.8157305",
"0.8157305",
"0.8157305",
"0.8154987",
"0.8134828",
"0.8112779",
"0.8108260... | 0.81517947 | 22 |
the speed_of_spread method is responisble for taking the inputs of populations_density and state to predict the amount of time it will take for the vrius to spread across each state | def speed_of_spread(population_density, state) #in months
speed = 0.0
if @population_density >= 200
speed += 0.5
elsif @population_density >= 150
speed += 1
elsif @population_density >= 100
speed += 1.5
elsif @population_density >= 50
speed += 2
else
speed += 2.5
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def speed_of_spread #(population_density, state) #in months\n # We are still perfecting our formula here. The speed is also affected\n # by additional factors we haven't added into this functionality.\n @speed = 0.0\n # REFACTOR: Rename speed variable to time or months.\n \n\n if @population_dens... | [
"0.7992882",
"0.7933123",
"0.78764474",
"0.77607876",
"0.7729412",
"0.76411736",
"0.7634601",
"0.7602168",
"0.75863165",
"0.75834787",
"0.7556087",
"0.7552795",
"0.7543614",
"0.7541492",
"0.7520189",
"0.7520189",
"0.7520189",
"0.7520189",
"0.7509598",
"0.75032705",
"0.7488389... | 0.72636825 | 51 |
To simplify, all admin permissions are linked to the Notification resource | def initialize(user)
user ||= User.new(nil) # Guest user
if user.role == "staff_admin"
can :manage, :all
elsif user.role == "staff_user"
can :read, :all
can [:update, :show], User, :id => user.id
elsif %w(member_admin member_user datacenter_admin datacenter_user user).include?(user.ro... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @b1 = isadmin\n @ns = @b1 ? Notification.all : current_user.notifications\n end",
"def admin_permissions\n {\n id: 1,\n appendable_permissions: [\n { permission_type: 'basic' },\n { permission_type: 'admin' }\n ]\n }\n end",
"def send_admin_notification\n ... | [
"0.6465373",
"0.6419778",
"0.64068544",
"0.62858355",
"0.61325127",
"0.61179847",
"0.5944921",
"0.5918193",
"0.590509",
"0.5899432",
"0.5898609",
"0.58977956",
"0.5893435",
"0.58845997",
"0.58845997",
"0.58704567",
"0.5866118",
"0.5847938",
"0.58370566",
"0.58341736",
"0.5829... | 0.0 | -1 |
Delete browser session for user_id and set current_user variable to nil | def logout
session.delete(:user_id)
@current_user = nil
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def log_out\n session.delete(:user_id) #remove the user id from the browser cache\n @current_user = nil\n end",
"def destroy\n @session[:user_id] = nil\n @current_user = nil\n end",
"def destroy\n # Remove the user id from the session\n @_current_user = session[:current_user_id] =... | [
"0.8519564",
"0.84066254",
"0.8391304",
"0.83007234",
"0.8267739",
"0.8267739",
"0.8208102",
"0.8208062",
"0.8206682",
"0.81940824",
"0.8191726",
"0.8191726",
"0.8191726",
"0.8190487",
"0.8190487",
"0.8190487",
"0.8190487",
"0.8190487",
"0.8190487",
"0.8186305",
"0.81858087",... | 0.8117421 | 42 |
Check if the current_user variable has been made. | def logged_in?
!current_user.nil?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_if_current_user\r\n User.current_user && User.current_user != self\r\n end",
"def check_current_user\n if !current_user.nil?\n Thread.current[:user] = current_user\n end\n end",
"def user_is_current\n fetch_user\n\n unless current_user?(@user)\n flash[:error] = t(:not_autho... | [
"0.82309544",
"0.7786227",
"0.77798015",
"0.75662744",
"0.7534663",
"0.7528867",
"0.74949205",
"0.7491567",
"0.7481851",
"0.74669063",
"0.7465773",
"0.7465773",
"0.7465773",
"0.7465773",
"0.7465773",
"0.7465773",
"0.7465773",
"0.7465773",
"0.7465773",
"0.7465773",
"0.7463339"... | 0.0 | -1 |
Is this a logged in user? | def logged_in_user?
unless logged_in?
redirect_to new_user_session_path
flash[:danger] = "Please login to do that action"
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def user_is_logged_in()\n user = get_user()\n if user != nil\n true\n else\n false\n end\n end",
"def logged_in?\n\t\t\tcurrent_user.is_a? User\n\t\tend",
"def logged_in?\n current_user.is_a? User\n end",
"def logged_in?\n (current_user ? login_access : false).is_a?(User)\... | [
"0.8852318",
"0.88150066",
"0.874516",
"0.86400723",
"0.860853",
"0.8601797",
"0.8597546",
"0.8579224",
"0.8556409",
"0.8556409",
"0.8548862",
"0.8547121",
"0.8546232",
"0.8546232",
"0.8537645",
"0.85324574",
"0.85324574",
"0.8529247",
"0.852886",
"0.850725",
"0.84970963",
... | 0.0 | -1 |
Function that checks if the current logged in user is an admin > returns boolean | def is_admin
current_user.admin?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def user_admin?\n user_logged_in? && @current_user.type == 'Admin'\n end",
"def admin_user?\n (current_user.role == 'admin') if logged_in?\n end",
"def admin_user?\n if current_user != nil\n !!current_user.admin\n end\n end",
"def is_admin?\n return false unless logged_in?\... | [
"0.91614664",
"0.9136512",
"0.9066485",
"0.8998232",
"0.8984596",
"0.897419",
"0.8973058",
"0.89394665",
"0.89313716",
"0.8913201",
"0.8899528",
"0.88987356",
"0.8883215",
"0.8853819",
"0.88409084",
"0.8837151",
"0.88282764",
"0.8826087",
"0.88232815",
"0.8822417",
"0.8822125... | 0.8532626 | 91 |
before_action for authorization in controller | def is_admin?
if !is_admin
flash[:danger] = "Only admins can do that"
redirect_to home_path
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def authorize\n end",
"def authorize\n end",
"def before_authorization(action, role, resource_config)\n raise NotImplementedError\n end",
"def skip_authorization_check(*args)\n before_action(*args) do |controller|\n controller.instance_variable_set(:@_authorized, true)\n ... | [
"0.7546334",
"0.7546334",
"0.7355968",
"0.7350696",
"0.733706",
"0.73347044",
"0.73261905",
"0.73211014",
"0.7255175",
"0.72483754",
"0.72363716",
"0.72295904",
"0.7206448",
"0.7206448",
"0.7206448",
"0.7206448",
"0.7206448",
"0.7206448",
"0.7206448",
"0.7206448",
"0.7200607"... | 0.0 | -1 |
Subject can be set in your I18n file at config/locales/en.yml with the following lookup: en.user_mailer.confirm.subject | def confirm(blank)
@blank = blank
if @blank.apply_type == "ex_apply"
mail(to: @blank.email,
subject: "您的参展申请已经审核通过",
from: "fair@ewatch.cn",
date: Time.now,
content_type: "text/html",
body: "亲爱的参展商朋友:<br/>
恭喜您,您所提交的参展申请已经审核通过,请携... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def subject (recipient)\n subject_variables = alert_variables[:subject].dup\n subject_variables.merge!(recipient_details(recipient))\n subject = \"#{I18n.t(\"#{recipient_type.to_s}_subject_#{alert_name.to_s}\", subject_variables)}\"\n subject\n end",
"def message_subject=(value)\n ... | [
"0.6844668",
"0.6728532",
"0.6619229",
"0.6570691",
"0.6569526",
"0.65660495",
"0.65563184",
"0.65544105",
"0.64984375",
"0.64506423",
"0.64287543",
"0.63882244",
"0.6369962",
"0.63351214",
"0.6254757",
"0.62342656",
"0.62245756",
"0.6215832",
"0.62095755",
"0.61885214",
"0.6... | 0.0 | -1 |
Returns the tag's name. | def to_s
name
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def tag_name\n return @tag_name\n end",
"def tag_name\n @tag_name ||= name && name.to_s.split(\"::\")[-1].downcase\n end",
"def name\n tag.name\n end",
"def tagname\n @tagname.id2name\n end",
"def name\n _name = nil\n self.tags.each do |x|\n if x.tkey == \"name\"\... | [
"0.84684724",
"0.83745277",
"0.83534455",
"0.8328301",
"0.81432235",
"0.8031486",
"0.7988133",
"0.7929584",
"0.76863813",
"0.766636",
"0.76432526",
"0.7381563",
"0.7381563",
"0.7381563",
"0.7275752",
"0.72638005",
"0.7227197",
"0.7192375",
"0.714341",
"0.71423894",
"0.7120228... | 0.0 | -1 |
OBJECT =begin create_edge connects two vertexes The parameter o_class can be either a class or a string =end | def create_edge o_class, attributes: {}, from:, to:, unique: false
logger.progname = "ActiveOrient::RestCreate#CreateEdge"
if from.is_a? Array
from.map{|f| create_edge o_class, attributes: attributes, from: f, to: to, unique: unique}
elsif to.is_a? Array
to.map{|t| create_edge o_class, attributes:... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_edge(object_1, object_2)\n node_1 = check_object(object_1)\n node_2 = check_object(object_2)\n node_1.adjacents << node_2\n node_2.adjacents << node_1\n end",
"def connect(vertex1, vertex2, edge_attributes = {})\n self.vertices << vertex1 unless self.vertices.include? vertex1\n sel... | [
"0.7207717",
"0.67521507",
"0.6598686",
"0.63870955",
"0.6199021",
"0.6189003",
"0.6166753",
"0.61589813",
"0.61369723",
"0.6133915",
"0.6125344",
"0.61103606",
"0.6048848",
"0.6034895",
"0.6009034",
"0.5939379",
"0.58898515",
"0.5888138",
"0.5839554",
"0.5806454",
"0.5775500... | 0.7181008 | 1 |
=begin Creating a new DatabaseEntry (where is omitted) Or updating the DatabaseEntry (if present) The optional Block should provide a hash with attributes (properties). These are used if a new dataset is created. Based on the query specified in :where records are updated according to :set Returns an Array of updated do... | def update_or_create_records o_class, set: {}, where: {}, **args, &b
logger.progname = 'RestCreate#UpdateOrCreateRecords'
if where.blank?
[create_record(o_class, attributes: set)]
else
set.extract!(where.keys) # removes any keys from where in set
possible_records = get_records from: classnam... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def write_db(entry_hash)\n formatted = format_hash(entry_hash)\n v_fname = formatted[\"fname\"] # prepare data from entry_hash for database insert\n v_lname = formatted[\"lname\"]\n v_addr = formatted[\"addr\"]\n v_city = formatted[\"city\"]\n v_state = formatted[\"state\"]\n v_zip = formatted[\"zip\"]\n ... | [
"0.5512253",
"0.5296057",
"0.5119197",
"0.5118045",
"0.5054637",
"0.50478977",
"0.50459236",
"0.50419444",
"0.5015013",
"0.5004416",
"0.49891543",
"0.49727663",
"0.4966059",
"0.49586535",
"0.49524686",
"0.4951725",
"0.49515307",
"0.49489525",
"0.49470556",
"0.49466217",
"0.49... | 0.6081629 | 0 |
INDEX Used to create an index | def create_index o_class, name:, on: :automatic, type: :unique
logger.progname = 'RestCreate#CreateIndex'
begin
c = classname o_class
execute transaction: false do
command = if on == :automatic
"CREATE INDEX #{c}.#{name} #{type.to_s.upcase}"
elsif on.is_a? Array
"CREATE ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def construct_index\n end",
"def create_index\n self[:create_index]\n end",
"def create_search_index\n Tire.index self.index_name\n end",
"def create_index(table_name, index_spec)\n @iadmin ||= IndexedTableAdmin.new(@configuration)\n @iadmin.addIndex(table_name.to_java_bytes, index_spec)... | [
"0.809648",
"0.7917219",
"0.7789689",
"0.74820215",
"0.74579585",
"0.7432173",
"0.7391598",
"0.7367966",
"0.7359166",
"0.7347466",
"0.7324604",
"0.7310694",
"0.7274581",
"0.7256076",
"0.72286767",
"0.72115326",
"0.71936965",
"0.71899354",
"0.71803254",
"0.71585673",
"0.714341... | 0.71550655 | 20 |
prevent people doing badness like filenames like ../../../foobar | def setup_file_path
@sanitized_name = sanitize_filename(params[:filename])
@file_path = "#{@resource.s3_dir_name(type: 'data')}/#{@sanitized_name}"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sanitized_path(base_directory, questionable_path); end",
"def sanitized_path(base_directory, questionable_path); end",
"def sanitized_path(base_directory, questionable_path); end",
"def sanitized_path(base_directory, questionable_path); end",
"def sanitized_path(base_directory, questionable_path); end"... | [
"0.7140084",
"0.7140084",
"0.7140084",
"0.7140084",
"0.7140084",
"0.7140084",
"0.70149654",
"0.6982829",
"0.6978901",
"0.6973261",
"0.6917444",
"0.68690634",
"0.686887",
"0.6830307",
"0.6830307",
"0.6830307",
"0.6830307",
"0.6662913",
"0.6604769",
"0.6604645",
"0.66033304",
... | 0.0 | -1 |
prevent people from sending bad filenames | def sanitize_filename(filename)
@original_filename = filename
# TODO: replace with GenericFile?
StashEngine::DataFile.sanitize_file_name(filename)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def confirm_filename(filename)\n filename.gsub!(/[<>:\"\\/\\\\|?*]/) { \"\" }\n end",
"def sanitize_filename(value)\n # get only the filename, not the whole path\n just_filename = value.gsub(/^.*(\\\\|\\/)/, '')\n # Finally, replace all non alphanumeric, underscore or periods with unde... | [
"0.7272096",
"0.7154271",
"0.7143945",
"0.70779425",
"0.6981785",
"0.69465494",
"0.690772",
"0.68985355",
"0.6888023",
"0.6836724",
"0.68348646",
"0.682261",
"0.6803153",
"0.67654",
"0.67524797",
"0.6752251",
"0.6752251",
"0.6752251",
"0.6752251",
"0.67446446",
"0.67099255",
... | 0.68355507 | 10 |
only allow to proceed if no other current uploads or only other urltype uploads | def require_file_current_uploads
the_type = @resource.upload_type
return if %i[files unknown].include?(the_type)
render json: { error:
'You may not submit a file by direct upload in the same version when you have submitted files by URL' }.to_json, status: 409
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def can_upload?\n false\n end",
"def validate_upload?\n upload? || review? || published? || unpublished_changes?\n end",
"def image_upload_allowed?\n company = sender.company\n !!company.settings.recognition_editor_settings[:allow_uploading_images]\n end",
"def route_upload?\n req... | [
"0.6945872",
"0.6862721",
"0.6642575",
"0.6445945",
"0.6262041",
"0.6185484",
"0.6185484",
"0.6185484",
"0.6185484",
"0.6185484",
"0.6185484",
"0.61551964",
"0.61282957",
"0.61118",
"0.6064923",
"0.60640836",
"0.60577875",
"0.6032626",
"0.60139483",
"0.60136974",
"0.59449553"... | 0.73006123 | 0 |
make a file deleted and return the hash for what it looks like after with HATEOAS, I forgot this marks for deletion also in second version | def make_deleted(data_file:)
case data_file.file_state
when 'created' # delete from db since it's new in this version
my_hate = { _links: StashApi::File.new(file_id: data_file.id).links.except(:self) }
data_file.destroy
return my_hate
when 'copied' # make 'deleted' which will r... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete(filename); end",
"def delete(bucket, file); end",
"def b2_delete_file(file)\n\n if parse_files_json(file) == {}\n\n puts \"File not present\"\n\n else\n \n result_hash = convert_json(b2_delete_file_version(file))\n\n if result_hash[\"fileName\"] == file\n puts \"File d... | [
"0.6515165",
"0.6366274",
"0.62996364",
"0.62622553",
"0.6227984",
"0.6210749",
"0.61107886",
"0.61107886",
"0.60612535",
"0.6046231",
"0.602636",
"0.60086805",
"0.6001875",
"0.6000878",
"0.5988672",
"0.59539706",
"0.5920531",
"0.5919227",
"0.59076357",
"0.59076357",
"0.59046... | 0.75997406 | 0 |
In short, this is the XML string that makes the report. | def build_report
# build cases
builder = Nokogiri::XML::Builder.new do |xml|
xml.testsuites {
testsuite = xml.testsuite {
@cases.each do |tc|
testcase = xml.testcase {
if tc.result_has_message?
result_type ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def xml; end",
"def to_xml\n Builder.new(self).to_s\n end",
"def toxml\n\t\tend",
"def to_s\n return self.xml\n end",
"def generate_xml_report(servers)\n\t\t\txmlstring = \"\"\n\t\t\tdoc = Document.new xmlstring\n\t\t\tdoc << XMLDecl.new\n\t\t\tdocroot = doc.add_element('ServerM... | [
"0.6823564",
"0.6819919",
"0.6790851",
"0.6748462",
"0.6727792",
"0.6721197",
"0.67134976",
"0.67134976",
"0.6658119",
"0.6637681",
"0.6572329",
"0.65516496",
"0.65443593",
"0.65443593",
"0.64920175",
"0.6483857",
"0.64778906",
"0.6471283",
"0.6465603",
"0.63399243",
"0.63307... | 0.58023363 | 71 |
Writes the report to the specified file also returns the new XML report content | def write_report_file
raise FileNotFoundException.new 'There is no report file path specified' if report_path.blank?
report = build_report
if append_report.present? && File.exist?(report_path)
f = File.open(report_path)
existing_xml = Nokogiri::XML(f)
f.close
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def write_report\n\n end",
"def write_xml_output\n output = File.open('report.xml', 'w')\n output << \"<?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?>\\n\"\n @array_list.each do |item|\n output << item << \"\\n\"\n end\n output << \"</testsuite>\\n\"\n end",
"def report_file\n r... | [
"0.6964601",
"0.69384015",
"0.6784601",
"0.66628367",
"0.65555406",
"0.6455338",
"0.6450576",
"0.64373916",
"0.6392135",
"0.637434",
"0.63622445",
"0.63491815",
"0.63061565",
"0.62771094",
"0.62653697",
"0.6244162",
"0.61975574",
"0.61851436",
"0.61779505",
"0.61745346",
"0.6... | 0.8077999 | 0 |
TODO: make a method in the model to say his name and catchphrase remember the model is yours do with as you please, you are free to add methods that perform actions on the model's data | def say_that_thing_you_say
"#{self.name} always says: #{self.catchphrase}"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def name\n model_name\n end",
"def name\n model_name\n end",
"def model\n end",
"def name\n self.title\n end",
"def name\n self.title\n end",
"def name\n self.title\n end",
"def model\n end",
"def model\n end",
"def model\n end",
"def model; end",
"def model; end",
"... | [
"0.6821749",
"0.6821749",
"0.6796064",
"0.6757444",
"0.6757444",
"0.6757444",
"0.6744755",
"0.6744755",
"0.6744755",
"0.6719385",
"0.6719385",
"0.6719385",
"0.6719385",
"0.6719385",
"0.6719385",
"0.6719385",
"0.6719385",
"0.6719385",
"0.6719385",
"0.6709233",
"0.6670044",
"... | 0.0 | -1 |
Initialize a new instance | def initialize(connector, environment)
@connector = connector
@environment = environment
@source_mapper = @connector.source_mapper.class
@target_aliases = @connector.target_aliases
@target_model = @connector.target_model
@relationship... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initialize\n initialize!\n end",
"def initialize\n initialize!\n end",
"def initialize() end",
"def initialize\n init\n end",
"def initialize()\n end",
"def initialize\n \n end",
"def initialize\n end",
"def initialize\n end",
"def initialize... | [
"0.84960294",
"0.84960294",
"0.8450621",
"0.83879954",
"0.8384256",
"0.8367309",
"0.83547676",
"0.8331709",
"0.8331709",
"0.8331709",
"0.8331709",
"0.8331709",
"0.8331709",
"0.81545556",
"0.81545556",
"0.81545556",
"0.81545556",
"0.81545556",
"0.81545556",
"0.81545556",
"0.81... | 0.0 | -1 |
GET /army_lists/1 GET /army_lists/1.xml | def show
@army_list = ArmyList.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.xml { render :xml => @army_list }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @list = List.find(params[:list_id])\n @list_items = @list.list_items.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @list_items }\n end\n end",
"def index\n @lists = List.find(:all)\n\n respond_to do |format|\n for... | [
"0.71256316",
"0.7024899",
"0.6866922",
"0.6695999",
"0.65940297",
"0.6579557",
"0.65785354",
"0.6547372",
"0.65383106",
"0.6532962",
"0.6532403",
"0.6503592",
"0.648093",
"0.6441977",
"0.64348274",
"0.64244753",
"0.63393104",
"0.6295415",
"0.6275473",
"0.6210011",
"0.6204896... | 0.6688695 | 4 |
GET /army_lists/new GET /army_lists/new.xml | def new
@army_list = ArmyList.new
respond_to do |format|
format.html # new.html.erb
format.xml { render :xml => @army_list }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @mylist = Mylist.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @mylist }\n end\n end",
"def new\n\t\t@list = List.new\n\n\t\trespond_to do |format|\n\t\t\tformat.html # new.html.erb\n\t\t\tformat.xml\t{ render :xml => @list }\n\t\tend\n\t... | [
"0.7369981",
"0.7134376",
"0.7107756",
"0.6895632",
"0.68806374",
"0.6871423",
"0.6838593",
"0.6816435",
"0.67724615",
"0.6754766",
"0.67339206",
"0.6725714",
"0.67150176",
"0.6713894",
"0.67105085",
"0.66977906",
"0.6688502",
"0.6682343",
"0.66789496",
"0.66787034",
"0.66787... | 0.7228396 | 1 |
POST /army_lists POST /army_lists.xml | def create
@army_list = ArmyList.new(params[:army_list])
respond_to do |format|
if @army_list.save
flash[:notice] = 'ArmyList was successfully created.'
format.html { redirect_to :controller => :builder }
format.xml { render :xml => @army_list, :status => :created, :location => @... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_list(name)\n data = {\n list: {\n name: name\n }\n }\n rest(\"post\", \"lists\", data)\n end",
"def create_list(params={})\n @obj.post('create-list', @auth.merge(params))\n end",
"def create\n @mylist = Mylist.new(params[:mylist])\n\n respond_to do |format|\n... | [
"0.66280645",
"0.658954",
"0.6486587",
"0.6476401",
"0.642153",
"0.6255608",
"0.618146",
"0.6116023",
"0.61071444",
"0.6084231",
"0.6045623",
"0.59249085",
"0.58552176",
"0.5852251",
"0.5850342",
"0.5820887",
"0.58190733",
"0.5806132",
"0.5787208",
"0.57851523",
"0.57776415",... | 0.6588098 | 2 |
PUT /army_lists/1 PUT /army_lists/1.xml | def update
@army_list = ArmyList.find(params[:id])
respond_to do |format|
if @army_list.update_attributes(params[:army_list])
flash[:notice] = 'ArmyList was successfully updated.'
format.html { redirect_to :controller => :builder }
format.xml { head :ok }
else
forma... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_list(list_id, name)\n data = {\n list: {\n name: name\n }\n }\n rest(\"patch\", \"lists/#{list_id}\", data)\n end",
"def update_list(id, list)\n record \"/todos/update_list/#{id}\", :list => list\n end",
"def update\n @list = current_user.lists.find(params[:id])\n ... | [
"0.7008218",
"0.69624025",
"0.67561203",
"0.6622661",
"0.6458029",
"0.6418825",
"0.638197",
"0.63693744",
"0.62782913",
"0.62637234",
"0.62621045",
"0.62538046",
"0.6249655",
"0.6249655",
"0.6220581",
"0.62132204",
"0.61795914",
"0.6178647",
"0.6174157",
"0.61711895",
"0.6149... | 0.66017514 | 4 |
DELETE /army_lists/1 DELETE /army_lists/1.xml | def destroy
@army_list = ArmyList.find(params[:id])
@army_list.destroy
respond_to do |format|
format.html { redirect_to :controller => :builder }
format.xml { head :ok }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @mylist = Mylist.find(params[:id])\n @mylist.destroy\n\n respond_to do |format|\n format.html { redirect_to(mylists_url) }\n format.xml { head :ok }\n end\n end",
"def delete_list(list_id)\n rest(\"delete\", \"lists/#{list_id}\")\n\n return true\n end",
"def delete(... | [
"0.70959854",
"0.6994988",
"0.68928635",
"0.6787498",
"0.6702264",
"0.6695867",
"0.6693613",
"0.66741854",
"0.6628108",
"0.66154337",
"0.6609067",
"0.65970886",
"0.65857184",
"0.6556935",
"0.6551562",
"0.6546071",
"0.6537721",
"0.64970076",
"0.6472539",
"0.64319074",
"0.64301... | 0.6780774 | 4 |
Show invalid properties with the reasons. Usually used together with valid? | def list_invalid_properties
invalid_properties = Array.new
if @account.nil?
invalid_properties.push('invalid value for "account", account cannot be nil.')
end
if @name.nil?
invalid_properties.push('invalid value for "name", name cannot be nil.')
end
if !@port_restri... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def list_invalid_properties\n invalid_properties = super\n if @class_id.nil?\n invalid_properties.push('invalid value for \"class_id\", class_id cannot be nil.')\n end\n\n if @object_type.nil?\n invalid_properties.push('invalid value for \"object_type\", object_type cannot be nil.... | [
"0.76497203",
"0.76497203",
"0.76497203",
"0.76497203",
"0.7637422",
"0.7637422",
"0.7637422",
"0.7637422",
"0.7637422",
"0.7637422",
"0.7637422",
"0.7637422",
"0.7356452",
"0.7334807",
"0.72685325",
"0.7238964",
"0.7231359",
"0.72258264",
"0.7208294",
"0.71760833",
"0.717024... | 0.0 | -1 |
Check to see if the all the properties in the model are valid | def valid?
return false if @account.nil?
return false if @name.nil?
return false if !@port_restriction.nil? && @port_restriction > 65535
return false if !@port_restriction.nil? && @port_restriction < 1
return false if @site_assignment.nil?
true
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def validate_properties\n true\n end",
"def validate_properties\n true\n end",
"def validate\n super\n\n check_optional_property :collection, String\n check_optional_property :create, String\n check_optional_property :delete, String\n check_optional_property :... | [
"0.78989387",
"0.78989387",
"0.7097542",
"0.7077744",
"0.7031459",
"0.703038",
"0.69501424",
"0.6869871",
"0.68576187",
"0.68576187",
"0.68280154",
"0.68235457",
"0.682004",
"0.6814453",
"0.67930245",
"0.67521733",
"0.66832304",
"0.6675793",
"0.66681546",
"0.6629595",
"0.6617... | 0.0 | -1 |
Custom attribute writer method with validation | def port_restriction=(port_restriction)
if !port_restriction.nil? && port_restriction > 65535
fail ArgumentError, 'invalid value for "port_restriction", must be smaller than or equal to 65535.'
end
if !port_restriction.nil? && port_restriction < 1
fail ArgumentError, 'invalid value fo... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def attr_writer_tag(text); end",
"def allowed_attributes=(_arg0); end",
"def allowed_attributes=(_arg0); end",
"def writer(*args)\n attr_writer(*args)\n args\n end",
"def define_write_method(attr_name)\n evaluate_attribute_method attr_name, \"def #{attr_name}=(new_value);write_attribute('#{at... | [
"0.6472992",
"0.6315012",
"0.6315012",
"0.62821025",
"0.6279224",
"0.6211609",
"0.61891466",
"0.6182247",
"0.60683644",
"0.6032628",
"0.5995443",
"0.5988785",
"0.5959885",
"0.5938289",
"0.5931089",
"0.58951056",
"0.5859927",
"0.5851703",
"0.58493423",
"0.58465594",
"0.5832836... | 0.0 | -1 |
Checks equality by comparing each attribute. | def ==(o)
return true if self.equal?(o)
self.class == o.class &&
account == o.account &&
description == o.description &&
host_restriction == o.host_restriction &&
id == o.id &&
name == o.name &&
port_restriction == o.port_restriction &&
s... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ==(other)\n attributes == other.attributes\n end",
"def ==(other) # :nodoc:\n @attrs == other.attrs\n end",
"def eql?(other)\n return true if self == other\n @@ATTRIBUTES.each do |att|\n return false unless self.send(att).eql?(other.send(att))\n end\n true\n en... | [
"0.7291717",
"0.7188103",
"0.70395297",
"0.7007927",
"0.68874705",
"0.6861532",
"0.6707156",
"0.6660597",
"0.66147524",
"0.658478",
"0.6584619",
"0.6580019",
"0.65543133",
"0.6543933",
"0.65068495",
"0.6479513",
"0.6456241",
"0.6415999",
"0.6412208",
"0.6412208",
"0.6412208",... | 0.0 | -1 |
Calculates hash code according to all attributes. | def hash
[account, description, host_restriction, id, name, port_restriction, site_assignment, sites].hash
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def attr_hash\n Digest::MD5.hexdigest(\"#{@name}:#{@ruby_type}\")\n end",
"def hash() end",
"def hash() end",
"def hash() end",
"def hash() end",
"def hash() end",
"def hash() end",
"def hash() end",
"def hash\n code = 17\n code = 37*code + @x.hash\n code = 37*code + @y.hash\n ... | [
"0.7118691",
"0.70400536",
"0.70400536",
"0.70400536",
"0.70400536",
"0.70400536",
"0.70400536",
"0.70400536",
"0.68960655",
"0.67847186",
"0.6707762",
"0.670052",
"0.6688737",
"0.66705376",
"0.6489735",
"0.6462376",
"0.6462376",
"0.64444333",
"0.6413127",
"0.6395483",
"0.638... | 0.0 | -1 |
Builds the object from hash | def build_from_hash(attributes)
return nil unless attributes.is_a?(Hash)
self.class.swagger_types.each_pair do |key, type|
if type =~ /\AArray<(.*)>/i
# check to ensure the input is an array given that the the attribute
# is documented as an array but the input is not
i... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def build(hash)\n obj = new\n hash.each_pair do |k,v|\n obj[k] = v if variables[k]\n end\n return obj\n end",
"def build_from_hash(attributes)\n\n end",
"def build_from_hash(hash)\n instance = self.new\n\n # Add the instance attributes dynamically ... | [
"0.8011074",
"0.7470833",
"0.7457607",
"0.7256629",
"0.72455454",
"0.70060325",
"0.6973257",
"0.6955014",
"0.69459796",
"0.69398683",
"0.69363195",
"0.6917627",
"0.6872358",
"0.6796184",
"0.6783521",
"0.67575246",
"0.67575246",
"0.67560464",
"0.67514306",
"0.67136854",
"0.666... | 0.0 | -1 |
Deserializes the data based on type | def _deserialize(type, value)
case type.to_sym
when :DateTime
DateTime.parse(value)
when :Date
Date.parse(value)
when :String
value.to_s
when :Integer
value.to_i
when :Float
value.to_f
when :BOOLEAN
if value.to_s =~ /\A(true|t|yes... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s... | [
"0.7330926",
"0.7274019",
"0.72504056",
"0.7245751",
"0.72291344",
"0.72291344",
"0.72291344",
"0.72291344",
"0.72291344",
"0.72291344",
"0.72291344",
"0.72291344",
"0.72291344",
"0.72291344",
"0.72291344",
"0.72291344",
"0.72291344",
"0.72291344",
"0.72291344",
"0.72291344",
... | 0.0 | -1 |
Returns the string representation of the object | def to_s
to_hash.to_s
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_s\n @object.to_s\n end",
"def to_s\n object.to_s\n end",
"def serialize(object)\n object.to_s\n end",
"def to_s\n self.inspect\n end",
"def to_s\n @string || @object.to_s('F')\n end",
"def to_s\n @string || @object.to_s('F')\n end",
"de... | [
"0.901024",
"0.89506465",
"0.84703195",
"0.83409667",
"0.8337169",
"0.8337169",
"0.8332247",
"0.82546586",
"0.8145818",
"0.8144667",
"0.81357557",
"0.812714",
"0.8093436",
"0.8086725",
"0.8073356",
"0.8039774",
"0.80308646",
"0.80064154",
"0.80064154",
"0.80064154",
"0.800641... | 0.0 | -1 |
to_body is an alias to to_hash (backward compatibility) | def to_body
to_hash
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_body\r\n to_hash\r\n end",
"def to_body\n to_hash\nend",
"def to_body\n to_hash\nend"
] | [
"0.84289175",
"0.8345984",
"0.8345984"
] | 0.0 | -1 |
Returns the object in the form of hash | def to_hash
hash = {}
self.class.attribute_map.each_pair do |attr, param|
value = self.send(attr)
next if value.nil?
hash[param] = _to_hash(value)
end
hash
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_hash\n object\n end",
"def hash\r\n return to_s.hash\r\n end",
"def hash\n to_a.hash\n end",
"def hash\n [_hash, name, owner].hash\n end",
"def hash\n return to_s.hash\n end",
"def hash\n @hash\n end",
"def hash\n @hash.hash\n end",
"def hash\n ... | [
"0.8270299",
"0.78767854",
"0.78726953",
"0.7802364",
"0.7789188",
"0.77806795",
"0.7775915",
"0.7767511",
"0.7760525",
"0.7760525",
"0.77559966",
"0.7731286",
"0.7713916",
"0.7713916",
"0.7713916",
"0.7713916",
"0.7713916",
"0.7713916",
"0.7713916",
"0.7713916",
"0.7713916",... | 0.0 | -1 |
Outputs nonarray value in the form of hash For object, use to_hash. Otherwise, just return the value | def _to_hash(value)
if value.is_a?(Array)
value.compact.map { |v| _to_hash(v) }
elsif value.is_a?(Hash)
{}.tap do |hash|
value.each { |k, v| hash[k] = _to_hash(v) }
end
elsif value.respond_to? :to_hash
value.to_hash
else
value
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def hash\n [value].hash\n end",
"def hash\n [value].hash\n end",
"def hash\n\t\tvalue.hash\n\tend",
"def hash\n value.hash\n end",
"def hash\n @value.hash\n end",
"def hash\r\n return to_s.hash\r\n end",
"def to_hash\n @value\n end",
"def to_hash\n @va... | [
"0.67215014",
"0.67215014",
"0.66696423",
"0.6657961",
"0.65888",
"0.6453018",
"0.64178324",
"0.64178324",
"0.6383847",
"0.6345226",
"0.63030654",
"0.62241983",
"0.61531323",
"0.61044014",
"0.6079903",
"0.6079903",
"0.6072242",
"0.6036524",
"0.6022057",
"0.59387356",
"0.59046... | 0.0 | -1 |
GET /users GET /users.json def index | def show
@courses = Course.select("id, course_code, course_name")
require 'ostruct'
@mycourses = @user.courses.all
timetable = Array.new
colors = ['#FFBBFF','#FFFFCC','#CCFFFF','#BBBBEE','#EEBBBB','#BBEEBB','#CCCCCC','#6699FF']
color_index = 0
@mycourses.each do |mycourse|
cur... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n users = User.all\n json_response(users)\n end",
"def index\n @users = User.all\n logger.debug(\"user index\")\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @users }\n end\n end",
"def index\n if params[:single]\n\t url =... | [
"0.85333496",
"0.85263276",
"0.8451336",
"0.83828354",
"0.8381708",
"0.83795655",
"0.83712995",
"0.8360554",
"0.8356165",
"0.8350339",
"0.8280744",
"0.8264254",
"0.8264254",
"0.82625717",
"0.82575315",
"0.82527727",
"0.82527727",
"0.82527727",
"0.82527727",
"0.82527727",
"0.8... | 0.0 | -1 |
POST /users POST /users.json | def create
# user_params.permit(:first_name, :last_name, :email, :password, :password_confirmation)
@user = User.new(user_params)
respond_to do |format|
if @user.save
format.html { redirect_to @user, notice: 'User was successfully created.' }
format.json { render :show, status: :creat... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def post_users(users)\n self.class.post('https://api.yesgraph.com/v0/users', {\n :body => users.to_json,\n :headers => @options,\n })\n end",
"def CreateUser params = {}\n \n APICall(path: 'users.json',method: 'POST',payload: params.to_json)\n \n end",
"def post b... | [
"0.77179813",
"0.75206673",
"0.73831296",
"0.72405374",
"0.719841",
"0.7140812",
"0.71038526",
"0.7058827",
"0.7041636",
"0.70236504",
"0.7003128",
"0.70021695",
"0.70021695",
"0.70021695",
"0.69936967",
"0.6990463",
"0.6980393",
"0.6979075",
"0.69788617",
"0.69788617",
"0.69... | 0.0 | -1 |
PATCH/PUT /users/1 PATCH/PUT /users/1.json | def update
respond_to do |format|
if @user.update(user_params)
format.html { redirect_to user_url, notice: 'User was successfully updated.' }
format.json { render :show, status: :ok, location: @user }
else
format.html { render :edit }
format.json { render json: @user.erro... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n render json: User.update(params[\"id\"], params[\"user\"])\n end",
"def update\n render json: Users.update(params[\"id\"], params[\"user\"])\n end",
"def UpdateUser params = {}\n \n APICall(path: 'users.json',method: 'PUT',payload: params.to_json)\n \n end",
"de... | [
"0.7226113",
"0.71298933",
"0.70042306",
"0.69043857",
"0.68226177",
"0.6815946",
"0.6709818",
"0.669393",
"0.6681972",
"0.6674142",
"0.6673297",
"0.66659427",
"0.66659427",
"0.66601443",
"0.66601443",
"0.6655739",
"0.6649701",
"0.6644151",
"0.6642196",
"0.6636578",
"0.661886... | 0.0 | -1 |
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.78750724",
"0.77518034",
"0.7713981",
"0.7610077",
"0.747295",
"0.74073994",
"0.74073994",
"0.7369968",
"0.7346072",
"0.7340465",
"0.7328618",
"0.7309635",
"0.73095363",
"0.7306841",
"0.7297868",
"0.72917855",
"0.7291585",
"0.7289111",
"0.7284347",
"0.7250935",
"0.7250935"... | 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.6163163",
"0.6045976",
"0.5946146",
"0.591683",
"0.5890051",
"0.58349305",
"0.5776858",
"0.5703237",
"0.5703237",
"0.5652805",
"0.5621621",
"0.54210985",
"0.5411113",
"0.5411113",
"0.5411113",
"0.5391541",
"0.53794575",
"0.5357573",
"0.53402257",
"0.53394014",
"0.53321576"... | 0.0 | -1 |
Never trust parameters from the scary internet, only allow the white list through. | def user_params
params.require(:user).permit(:first_name, :last_name, :email, :password, :password_confirmation)
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.6980384",
"0.6782743",
"0.6746196",
"0.6742575",
"0.6736",
"0.6594004",
"0.65037984",
"0.6496699",
"0.64819324",
"0.64791185",
"0.6456292",
"0.64403296",
"0.63795286",
"0.6375975",
"0.6365291",
"0.63210756",
"0.6300542",
"0.6299717",
"0.62943304",
"0.6292561",
"0.6290683",... | 0.0 | -1 |
Return true if a person is connected to (or is) the current person | def connected_to?(person)
current_person?(person) or Connection.connected?(person, current_person)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def connected_to?(dog)\n current_person?(dog.owner) or Connection.connected_with_person?(dog, current_person)\n end",
"def connected?\n !!@connected_to\n end",
"def connected_with?(user)\n friendshiped_with?(user)\n end",
"def connected?(relation_name, other_object)\n return Relation.conne... | [
"0.77904004",
"0.7476528",
"0.720864",
"0.7121038",
"0.7061839",
"0.7044249",
"0.7044249",
"0.7044249",
"0.7044249",
"0.7044249",
"0.7044249",
"0.6986394",
"0.69849527",
"0.69815326",
"0.69815326",
"0.69815326",
"0.69815326",
"0.69815326",
"0.696961",
"0.6964569",
"0.6962929"... | 0.86889356 | 1 |
Return true if a person is the owner of a group or if member of it | def is_member_of?(group)
group.owner?(current_person) or Membership.accepted?(current_person, group)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_member_of?(group)\n current_person.dogs.include?(group.owner) or Membership.accepted_by_person?(current_person, group)\n end",
"def is_owned_by?(member = nil)\n return false if member.blank?\n if self.designer == member or self.client == member\n true\n else\n member.is_super_user? ... | [
"0.80137825",
"0.7836463",
"0.77031654",
"0.7658705",
"0.76582843",
"0.76066774",
"0.7568354",
"0.7563996",
"0.7546074",
"0.7430361",
"0.74122876",
"0.73883903",
"0.73883903",
"0.736792",
"0.7352787",
"0.72951335",
"0.72928065",
"0.7266973",
"0.7241143",
"0.7241143",
"0.72251... | 0.82579446 | 0 |
Returns true for text starting with a capital letter and ending with puncutation | def first_word_capitalized_and_ends_with_punctuation?(text)
if text.match(/^[A-Z].*\W$/)
return true
else false
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def first_word_capitalized_and_ends_with_punctuation?(text)\n text.match(/^[A-Z].+[.!?]$/) ? true : false\nend",
"def proper(word)\n /[[:upper:]]/.match(word) != nil\n end",
"def is_capitalized?(word)\n return true if word == word.upcase\n return false\n end",
"def contains_only_capital_letters\n... | [
"0.7951948",
"0.7369874",
"0.72919714",
"0.7216759",
"0.7035173",
"0.6937531",
"0.69025916",
"0.6832181",
"0.6796863",
"0.6784545",
"0.6722563",
"0.66529226",
"0.6633444",
"0.6620567",
"0.6588874",
"0.6587878",
"0.65796196",
"0.6535229",
"0.6486172",
"0.64794576",
"0.64749336... | 0.7982709 | 0 |
GET /orgs GET /orgs.json | def index
@orgs = policy_scope(Org)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_organizations\n params = {\n 'method' => :get,\n 'command' => '/org'\n }\n\n response, headers = send_request(params)\n orgs = response.css('OrgList Org')\n\n results = {}\n orgs.each do |org|\n results[org['name']] = or... | [
"0.8225091",
"0.82032317",
"0.81419045",
"0.80084276",
"0.77180505",
"0.7662824",
"0.7642154",
"0.760724",
"0.7527597",
"0.7515002",
"0.75061363",
"0.7469479",
"0.74528176",
"0.7420496",
"0.7416651",
"0.7371034",
"0.7294072",
"0.7293994",
"0.72784925",
"0.72426736",
"0.711883... | 0.6422903 | 65 |
GET /orgs/1 GET /orgs/1.json | def show; end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def GetOrg id\n\n APICall(path: \"organizations/#{id}.json\")\n\n end",
"def get_organizations\n params = {\n 'method' => :get,\n 'command' => '/org'\n }\n\n response, headers = send_request(params)\n orgs = response.css('OrgList Org')\n\n ... | [
"0.7909572",
"0.7778068",
"0.7710016",
"0.7683112",
"0.75700176",
"0.7553109",
"0.75113815",
"0.74482125",
"0.73917687",
"0.7277325",
"0.72571486",
"0.72571486",
"0.7229728",
"0.7122852",
"0.705718",
"0.7035057",
"0.70209175",
"0.70043594",
"0.69909835",
"0.693224",
"0.692582... | 0.0 | -1 |
PATCH/PUT /orgs/1 PATCH/PUT /orgs/1.json | def update
respond_to do |format|
if @org.update(org_params)
format.html do
redirect_to @org, notice: 'Org was successfully updated.'
end
format.json { render :show, status: :ok, location: @org }
else
format.html { render :edit }
format.json { render jso... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update(name: nil)\n data = name.nil? ? {} : {name: name}\n cf_patch(path: \"/organizations/#{org_id}\", data: data)\n end",
"def UpdateOrganization params = {}\n \n APICall(path: 'organizations.json',method: 'PUT',payload: params.to_json)\n \n end",
"def edit_organization(o... | [
"0.70604837",
"0.69143784",
"0.680683",
"0.6701571",
"0.651835",
"0.6349722",
"0.6348687",
"0.63297087",
"0.6307214",
"0.62709713",
"0.62605596",
"0.623217",
"0.6185855",
"0.6175902",
"0.61738664",
"0.6155775",
"0.613398",
"0.61281973",
"0.6111401",
"0.6085728",
"0.6062639",
... | 0.6756067 | 3 |
Use callbacks to share common setup or constraints between actions. | def set_authorize_org
@org = Org.find(params[:id])
authorize(@org)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_... | [
"0.6163163",
"0.6045976",
"0.5946146",
"0.591683",
"0.5890051",
"0.58349305",
"0.5776858",
"0.5703237",
"0.5703237",
"0.5652805",
"0.5621621",
"0.54210985",
"0.5411113",
"0.5411113",
"0.5411113",
"0.5391541",
"0.53794575",
"0.5357573",
"0.53402257",
"0.53394014",
"0.53321576"... | 0.0 | -1 |
Never trust parameters from the scary internet, only allow the white list through. | def org_params
params.require(:org).permit(:name)
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.6980384",
"0.6782743",
"0.6746196",
"0.6742575",
"0.6736",
"0.6594004",
"0.65037984",
"0.6496699",
"0.64819324",
"0.64791185",
"0.6456292",
"0.64403296",
"0.63795286",
"0.6375975",
"0.6365291",
"0.63210756",
"0.6300542",
"0.6299717",
"0.62943304",
"0.6292561",
"0.6290683",... | 0.0 | -1 |
Instance method which creates the profile and associates this instance as the user | def add_profile(userinput)
profile = Profile.create(name:userinput)
profile.user_id = self.id
profile.save
profile
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_profile\n new_profile = Profile.new\n new_profile.user_id = self.id\n new_profile.save!\n end",
"def create_profile\n Profile.create(user_id: self.id)\n end",
"def create\n if current_user.profile.nil?\n profile = Profile.new(profile_params)\n profile.user = ... | [
"0.84900963",
"0.84399056",
"0.78476804",
"0.7779336",
"0.76296604",
"0.75609875",
"0.7555463",
"0.7496617",
"0.74759173",
"0.7451084",
"0.7425866",
"0.74243534",
"0.7421795",
"0.73812324",
"0.73660696",
"0.73284173",
"0.73106027",
"0.73088735",
"0.7294683",
"0.7283232",
"0.7... | 0.75145036 | 7 |
Instance method which returns the count of positive, negative, and neutral profiles the user searched up Analysis: Option 5 See the breakdown by positive/negative/netural of the people you creeped. | def sentiments_counts
#This will get the sentiments related to each instance
x = self.sentiments
#These two lines are instantiated for the while loop below
y = 0
sentiments_count = []
#This is a loop taking 'positive', 'negative', or 'neutral' from the instances
while y < x.count
sen... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def user_score\n total_score = 0\n score.each do |_phase, categories|\n total_score += categories.reject { |category| category.include? \"oath\" }.count { |category| category[1] >= 80 }\n end\n total_score\n end",
"def cult_population\n my_followers.count\n end",
"def fitness_count\n f... | [
"0.64134216",
"0.6266843",
"0.6076378",
"0.6044608",
"0.60341233",
"0.5991891",
"0.5991891",
"0.598716",
"0.59864444",
"0.59732056",
"0.5969949",
"0.59590673",
"0.592803",
"0.59148514",
"0.59083503",
"0.58904374",
"0.5887222",
"0.58810717",
"0.58716047",
"0.58687735",
"0.5839... | 0.0 | -1 |
OPTION 2. See the results of the profiles you've looked | def results
x = Profile.all.select { |profile| profile.user_id == self.id }
k = x.map {|profile| profile[:name]}
v = x.map do |profile|
if profile[:sentiment_id] == 1
"Negative"
elsif profile[:sentiment_id] == 2
"Positive"
elsif profile[:sentiment_id] == 3
"Neutral"... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def profiles; end",
"def profile; end",
"def profile; end",
"def show\n @profiles = @grab.profiles\n end",
"def profile\n end",
"def profile\n end",
"def profile\n end",
"def profile\n end",
"def profile\n end",
"def profile\n end",
"def profile\n \n end",
"def profile\n\n end"... | [
"0.77373433",
"0.7429318",
"0.7429318",
"0.7177294",
"0.69443977",
"0.69443977",
"0.69443977",
"0.69443977",
"0.69443977",
"0.69443977",
"0.6809534",
"0.6694894",
"0.6687045",
"0.661304",
"0.6610483",
"0.65513235",
"0.64698267",
"0.6454599",
"0.6444931",
"0.6408672",
"0.64019... | 0.0 | -1 |
Create a copy of a fresh listdir into /tmp. | def make_listdir
dirname = "%s/%s.%d.%0.4f" % [
Dir.tmpdir,
'ezmlm_list',
Process.pid,
(Time.now.to_f % 3600),
]
list = Pathname.new( __FILE__ ).dirname + 'data' + 'testlist'
cp_r( list.to_s, dirname )
return dirname
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def make_tmp_dir dir\n tmp_dir = File.join dir, \"lsa_cluster_tmp.#{rand}\"\n\n # Make sure tmp_dir doesn't already exist\n while Dir.exist? tmp_dir\n tmp_dir = File.join dir, \"lsa_cluster_tmp.#{rand}\"\n end\n\n FileUtils.mkdir_p tmp_dir\n\n tmp_dir\nend",
"def mktestdir\n testdir = File.join(tmpdi... | [
"0.6576401",
"0.65092534",
"0.6295392",
"0.6269736",
"0.6224501",
"0.61967915",
"0.6160272",
"0.6096456",
"0.6081917",
"0.6065032",
"0.6062152",
"0.60302687",
"0.6020064",
"0.59926444",
"0.5979184",
"0.5953939",
"0.5935949",
"0.5907077",
"0.5851921",
"0.58486044",
"0.58439684... | 0.67344093 | 0 |
validates :stripe_session, uniqueness: true | def has_a_tax
fields = %i[PST GST HST]
errors.add(:base, "Please specify a tax") unless fields.any? { |field| send(field).present? }
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ensure_token_uniqueness\n self.session_token = generate_token\n while User.find_by(session_token: self.session_token)\n self.session_token = generate_token\n end\n self.session_token\n end",
"def test_database_session_id_unique_constraint\n epp_session = EppSession.new(session_id: @epp_s... | [
"0.6529058",
"0.64022434",
"0.6255638",
"0.6151785",
"0.613368",
"0.6047372",
"0.5980979",
"0.5968657",
"0.59382147",
"0.59150445",
"0.58722997",
"0.58591676",
"0.5827845",
"0.57965785",
"0.57861763",
"0.5780016",
"0.5763174",
"0.5763174",
"0.5763174",
"0.5763174",
"0.5763174... | 0.0 | -1 |
this should permit reading and writing intial_balance in pennies | def initialize(id, balance, open_date)
# ruby dosen't like constants in intialize values, lowercase it
@id = id
@balance = balance
@open_date = open_date
# pretty_initial_balance = (@initial_balance / 100).to_f
is_negative # method to determine if transaction would lead to overdraft
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def starting_balance\n @balance\n end",
"def initialize\n @balance = 0\n end",
"def sync_balance\n begin\n synced_balance = BigDecimal.new(ripple_client.xrp_balance)\n update balance: synced_balance, validated: true\n rescue => e\n nil # raise custom error he... | [
"0.6399593",
"0.6299151",
"0.62652886",
"0.6214882",
"0.61238897",
"0.6072836",
"0.6016549",
"0.6016549",
"0.6009727",
"0.599138",
"0.599138",
"0.59496593",
"0.59438723",
"0.5942988",
"0.5915666",
"0.59060115",
"0.5866594",
"0.58646005",
"0.5863064",
"0.58499503",
"0.5844218"... | 0.0 | -1 |
print debuggin' raises error as expected if transaction is negative | def is_negative
unless @balance > 0
raise ArgumentError.new("You must enter a positive balance!")
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_negative_trans\n assert_raises SystemExit do\n assert_output 'Line 0: Invalid amount of billcoins: (-12)\\nBLOCKCHAIN INVALID' do\n trans = '281974>669488(-12):281974>669488(17):281974>217151(12):281974>814708(5):SYSTEM>933987(100)'\n line_num = 0\n address = { '281974' => 10... | [
"0.6395701",
"0.6371376",
"0.63665545",
"0.61881673",
"0.61610353",
"0.60165507",
"0.5947237",
"0.5884398",
"0.5847601",
"0.5801686",
"0.57832825",
"0.5695877",
"0.56749755",
"0.56548953",
"0.56276494",
"0.562665",
"0.56248707",
"0.56217617",
"0.56168634",
"0.55905074",
"0.55... | 0.0 | -1 |
Imports the service document | def import(doc)
services = doc['items']
puts "Importing service document"
sdm_doc_links = detach_children(services, 'service', 'key', 'docLinks')
seiso_services = services.map { |s| @service_mapper.seiso_service s }
services_uri = @uri_factory_v1.services_uri true
@rest_connect... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def import()\n # TODO\n end",
"def import\n end",
"def import\n end",
"def import\n end",
"def import\n end",
"def import(doc)\n si_key = doc['serviceInstance']\n nodes = doc['items']\n puts \"Importing node document for service instance #{si_key}\"\n\n del... | [
"0.68901855",
"0.663443",
"0.663443",
"0.663443",
"0.663443",
"0.6492935",
"0.61914337",
"0.6144591",
"0.61361206",
"0.6027336",
"0.5961427",
"0.58509916",
"0.57582074",
"0.565189",
"0.5541582",
"0.5507993",
"0.54940736",
"0.5487037",
"0.54330015",
"0.5428744",
"0.5413861",
... | 0.7425777 | 0 |
services: services doc_links: SDM doc links | def import_doc_links(services, doc_links)
# We can't simply infer the services from the doc links, because we have to handle the case
# where we remove all doc links from a service instance that formerly had some.
doc_links_by_service = group_doc_links_by_service doc_links
serv... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def doc_links(pid)\n @client.call(:get_doc_links, message: {pid: pid})\n end",
"def link_documentation; end",
"def provided_service_links\n links.joins(:service).merge(provided_services)\n end",
"def provided_service_links\n links.joins(:service).merge(provided_services)\n end",
"de... | [
"0.7168102",
"0.66004884",
"0.65774775",
"0.65774775",
"0.65553266",
"0.64972645",
"0.64972645",
"0.6333713",
"0.6272802",
"0.62080014",
"0.6196288",
"0.61616504",
"0.5937366",
"0.5936171",
"0.5915189",
"0.58797926",
"0.58715564",
"0.58715564",
"0.586185",
"0.58334786",
"0.57... | 0.7479588 | 0 |
set :ec2_project_tag, 'Project' set :ec2_roles_tag, 'Roles' set :ec2_stages_tag, 'Stages' | def application
'api.your-domain.com'
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def post_provision_configure\n add_stack_to_resource\n link_orchestration_template\n assign_vms_owner\n apply_provisioning_tags\n end",
"def customize_cloud_config(cloud_init_yaml, vm_i)\n case vm_i\n when 1 then cloud_init_yaml['coreos']['fleet']['metadata'] = 'role=head'\n when 2 ... | [
"0.6092563",
"0.60452473",
"0.5701011",
"0.5604312",
"0.552324",
"0.55094796",
"0.545778",
"0.544995",
"0.5444694",
"0.5432992",
"0.5407714",
"0.54005736",
"0.5345617",
"0.5320014",
"0.5278548",
"0.5244123",
"0.5223604",
"0.51782256",
"0.5173151",
"0.5164543",
"0.51322925",
... | 0.0 | -1 |
Render the form input based on the type of the field. | def render_custom_field(field, form)
highlighted = field._id == field._parent.label_field_id
default_options = default_custom_field_options(field, form, highlighted)
field_options = custom_field_options(field, form)
return '' if field_options.nil?
options = default_options.merge(fi... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def form_input(fieldtype, modelname, fieldname)\n case fieldtype\n when \"text\"\n text_field modelname, fieldname\n when \"password\"\n password_field modelname, fieldname\n when \"textarea\"\n text_area modelname, fieldname, \"rows\" => 5, \"cols\" => 30\n when \"submi... | [
"0.71106017",
"0.7060276",
"0.6892896",
"0.68529403",
"0.6751643",
"0.654978",
"0.649613",
"0.6446807",
"0.6384367",
"0.63762873",
"0.63411707",
"0.63259345",
"0.62435836",
"0.62067926",
"0.6168306",
"0.6156561",
"0.61173666",
"0.6113162",
"0.6102807",
"0.6095287",
"0.6056062... | 0.62570095 | 12 |
Never trust parameters from the scary internet, only allow the white list through. | def proposal_params
params.require(:proposal).permit(:multi_app_identifier, :proposal_status_id, :category, :creator_id,
:name, :given_names, :pesel, :citizenship_code, :birth_date, :birth_place, :family_name, :phone, :email,
:lives_in_poland, :address_combine_id, :province_code, :province_name, ... | {
"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.6980384",
"0.6782743",
"0.6746196",
"0.6742575",
"0.6736",
"0.6594004",
"0.65037984",
"0.6496699",
"0.64819324",
"0.64791185",
"0.6456292",
"0.64403296",
"0.63795286",
"0.6375975",
"0.6365291",
"0.63210756",
"0.6300542",
"0.6299717",
"0.62943304",
"0.6292561",
"0.6290683",... | 0.0 | -1 |
Some events are only relevant for people in a project | def related_projects
case self.object
when Project
[self.object]
when TimeSheet
self.object.projects
else
[]
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def event_requirement; end",
"def relevant_events_scope\n raise NotImplementedError\n end",
"def common_event_reserved?\n @common_event_id > 0\n end",
"def events_commissioned_at\n find_related_frbr_objects( :is_commissioned_for, :which_events?) \n end",
"def awaiting_admin_events\n... | [
"0.64695245",
"0.64448166",
"0.64252675",
"0.64130574",
"0.6402315",
"0.6360857",
"0.629512",
"0.62794447",
"0.6266041",
"0.6206639",
"0.6174923",
"0.6166811",
"0.6159821",
"0.61441326",
"0.6142808",
"0.6124801",
"0.6124442",
"0.6098195",
"0.60820657",
"0.60774523",
"0.605926... | 0.0 | -1 |
Some events are only relevant admins of a chair | def related_chair
case self.object
when Chair
self.object
when Contract
self.object.chair
else
nil
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def eventunscrape?\n @user.is_admin?\n end",
"def awaiting_admin_events\n candidate_events.select(&:awaiting_admin?)\n end",
"def is_admin_or_owner client, event\n # calls users_info on slack\n info = client.users_info(user: event.user_id ) \n info['user']['is_admin'] || info['user']['is... | [
"0.69552934",
"0.6951172",
"0.67735094",
"0.65227264",
"0.64134455",
"0.64106065",
"0.64094037",
"0.634634",
"0.629375",
"0.6259087",
"0.62319314",
"0.6223706",
"0.6215872",
"0.6206489",
"0.6202485",
"0.6202485",
"0.61764985",
"0.61741626",
"0.6155666",
"0.6143797",
"0.607761... | 0.0 | -1 |
O(n log n), mergesort it | def dominant_eat(fishes)
prc = Proc.new { |x, y| y.length <=> x.length}
largest_sorted = fish.merge_sort(&prc)
largest_sorted[0]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def merge_sort(a)\n\tif n == 1\n\t\treturn a\n\tend\n\n\tm = n/2\n\n\tb = merge_sort(a)\n\tc = merge_sort(c)\n\t\n\tresult = merge(b,c)\n\n\treturn result\nend",
"def merge_sort(arr)\n \n midpoint = arr.size/2\n sub_list_a = arr[0, midpoint]\n sub_list_b = arr[(midpoint + 1)..(arr.size - 1)]\n \n sub_list_... | [
"0.7919054",
"0.78269625",
"0.7694328",
"0.7692288",
"0.75886726",
"0.7566666",
"0.756315",
"0.7521227",
"0.7500438",
"0.749705",
"0.7470136",
"0.7462127",
"0.7461491",
"0.7461098",
"0.7453996",
"0.7438161",
"0.7437598",
"0.7434766",
"0.74292266",
"0.7422333",
"0.7414054",
... | 0.0 | -1 |
To display output immediately on windows using git bash | def letter_case_count(string)
counts = {}
counts[:lowercase] = string.count('a-z')
counts[:uppercase] = string.count('A-Z')
counts[:neither] = string.count('^a-zA-Z')
counts
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def prompt_git_branch\n if !is_git?\n return \"\"\n end\n stat = `git status`\n \"[#{stat.split(\"\\n\")[0].split(\" \")[-1]}]\".yellow\nend",
"def stdout; end",
"def stdout; end",
"def stdout; end",
"def stdout; end",
"def stdout; end",
"def stdout; end",
"def prep_screen\n system(\"clear\... | [
"0.6219506",
"0.61200327",
"0.61200327",
"0.61200327",
"0.61200327",
"0.61200327",
"0.61200327",
"0.6103044",
"0.60350794",
"0.59949106",
"0.5973232",
"0.59097284",
"0.58951396",
"0.5886012",
"0.586864",
"0.58550465",
"0.582788",
"0.5807792",
"0.5802978",
"0.5773198",
"0.5745... | 0.0 | -1 |
say_goodbye say_goodbye do puts "Calling say_goodbay, I'm inside block" end | def block_with_param
puts "Before calling block"
yield(123)
puts "After calling block"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def say_goodbye \n puts \"Thanks for running the program! This function was passed into a block using the yield keyword.\"\nend",
"def greeting(&block)\n puts 'good morning'\n text = block.call('hello')\n puts text\n puts 'good evening'\nend",
"def greeting(&block)\n puts 'good morning'\n ... | [
"0.8552012",
"0.76749617",
"0.76749617",
"0.75121385",
"0.7493285",
"0.73522544",
"0.7320112",
"0.72693074",
"0.70990837",
"0.7089663",
"0.70629996",
"0.7060479",
"0.7037338",
"0.7036645",
"0.703111",
"0.703111",
"0.70306164",
"0.70170754",
"0.69820106",
"0.6970253",
"0.69649... | 0.0 | -1 |
GET /skills GET /skills.json | def index
@skill_categories = SkillCategory.includes(:skills)
# @skills = Skill.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def list_skills\n\t\trender json: Skill.where(language_id: params[:language_id]).to_json\n\tend",
"def skills(id={}, options={})\n options = parse_id(id, options)\n path = \"#{profile_path(options, false)}/skills\"\n get(path, options)\n end",
"def index\n @skills = Skill.all\n\n render... | [
"0.77104056",
"0.76897246",
"0.7647922",
"0.72971785",
"0.72352403",
"0.72209233",
"0.7069087",
"0.7066106",
"0.70481795",
"0.7045893",
"0.7045893",
"0.702972",
"0.7023174",
"0.70074195",
"0.6933796",
"0.6913562",
"0.6899148",
"0.6863808",
"0.68407696",
"0.6782673",
"0.676088... | 0.632453 | 36 |
GET /skills/1 GET /skills/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @skills = Skill.all\n\n render json: @skills\n end",
"def skills(id={}, options={})\n options = parse_id(id, options)\n path = \"#{profile_path(options, false)}/skills\"\n get(path, options)\n end",
"def list_skills\n\t\trender json: Skill.where(language_id: params[:languag... | [
"0.76305854",
"0.74864537",
"0.74588233",
"0.7398721",
"0.73283345",
"0.71914107",
"0.71163577",
"0.70911264",
"0.705166",
"0.705166",
"0.70449716",
"0.70291656",
"0.7028146",
"0.70239824",
"0.70239824",
"0.6968934",
"0.6966247",
"0.69029534",
"0.68685746",
"0.68497473",
"0.6... | 0.0 | -1 |
POST /skills POST /skills.json | def create
@skill = Skill.new(skill_params)
respond_to do |format|
if @skill.save
if @skill.approved == true # approved value is true if it is created by the Admin user
format.html { redirect_to skill_categories_path, notice: 'Skill was successfully created.' }
format.json { re... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @saved_skills, @unsaved_skills = [], []\n Skill.parse(params[:skills]).each do |skill|\n s = Skill.new(:name => skill, :user => current_user)\n begin\n s.save!\n @saved_skills << skill\n rescue\n @unsaved_skills << skill\n end\n end\n\n respond_to d... | [
"0.7452112",
"0.7402541",
"0.724633",
"0.7190522",
"0.70012826",
"0.7000764",
"0.6970021",
"0.6928008",
"0.6890643",
"0.6868538",
"0.6866135",
"0.684074",
"0.683468",
"0.6812771",
"0.6797417",
"0.6795299",
"0.67784053",
"0.6769494",
"0.67188495",
"0.6718154",
"0.6705141",
"... | 0.0 | -1 |
PATCH/PUT /skills/1 PATCH/PUT /skills/1.json | def update
respond_to do |format|
if @skill.update(skill_params)
format.html { redirect_to @skill, notice: 'Skill was successfully updated.' }
format.json { render :show, status: :ok, location: @skill }
else
format.html { render :edit }
format.json { render json: @skill.e... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @skill = Skill.find(params[:id])\n\n if @skill.update(skill_params)\n head :no_content\n else\n render json: @skill.errors, status: :unprocessable_entity\n end\n end",
"def update\n @skill = Skill.find(params[:id])\n\n respond_to do |format|\n if @skill.update_attri... | [
"0.7498395",
"0.73728853",
"0.7244446",
"0.71422035",
"0.71169215",
"0.71112335",
"0.7085032",
"0.70628667",
"0.7031596",
"0.70154625",
"0.69845456",
"0.68984604",
"0.68760616",
"0.68635136",
"0.6857508",
"0.6849486",
"0.6820918",
"0.6772107",
"0.6749592",
"0.67439055",
"0.67... | 0.71659476 | 4 |
DELETE /skills/1 DELETE /skills/1.json | def destroy
@skill.destroy
respond_to do |format|
format.html { redirect_to skill_categories_path, notice: 'Skill was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @skill = Skill.find(params[:id])\n @skill.destroy\n\n respond_to do |format|\n format.html { redirect_to skills_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @person.skills.delete_all\n \n @person.destroy\n respond_to do |format|\n form... | [
"0.7987014",
"0.79761726",
"0.7750361",
"0.77327317",
"0.7661071",
"0.7616309",
"0.7595619",
"0.75881016",
"0.7582667",
"0.7554071",
"0.75137293",
"0.7482423",
"0.7479869",
"0.7451204",
"0.74376893",
"0.7426212",
"0.7424524",
"0.739311",
"0.73703104",
"0.7354894",
"0.7341822"... | 0.7407659 | 17 |
Use callbacks to share common setup or constraints between actions. | def set_skill
@skill = Skill.find(params[:id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_... | [
"0.6163163",
"0.6045976",
"0.5946146",
"0.591683",
"0.5890051",
"0.58349305",
"0.5776858",
"0.5703237",
"0.5703237",
"0.5652805",
"0.5621621",
"0.54210985",
"0.5411113",
"0.5411113",
"0.5411113",
"0.5391541",
"0.53794575",
"0.5357573",
"0.53402257",
"0.53394014",
"0.53321576"... | 0.0 | -1 |
Never trust parameters from the scary internet, only allow the white list through. | def skill_params
params.require(:skill).permit(:skill_category_id, :name, :description, :approved)
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.6980384",
"0.6782743",
"0.6746196",
"0.6742575",
"0.6736",
"0.6594004",
"0.65037984",
"0.6496699",
"0.64819324",
"0.64791185",
"0.6456292",
"0.64403296",
"0.63795286",
"0.6375975",
"0.6365291",
"0.63210756",
"0.6300542",
"0.6299717",
"0.62943304",
"0.6292561",
"0.6290683",... | 0.0 | -1 |
Returns the value for specified attribute. A value will only be available if it was overridden when calling the factory, or if a value is added earlier in the definition of the factory. Arguments: attribute: (Symbol) The attribute whose value should be returned. Returns: The value of the requested attribute. (Object) | def value_for (attribute)
unless current_values.key?(attribute)
raise ArgumentError, "No such attribute: #{attribute.inspect}"
end
current_values[attribute]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_attribute_value(attribute)\n data[attribute]\n end",
"def get attribute\n attributes[attribute]\n end",
"def get(attribute)\n @attributes[attribute.to_s]\n end",
"def call(attribute)\n @attributes[attribute]\n end",
"def attribute_get(attribute)\n check_attrib... | [
"0.79293764",
"0.7736012",
"0.7653168",
"0.746931",
"0.74647266",
"0.74647266",
"0.7320546",
"0.71388304",
"0.70920956",
"0.7080016",
"0.6942377",
"0.69394886",
"0.6887812",
"0.68839145",
"0.6878179",
"0.6869735",
"0.6800729",
"0.6779142",
"0.67108935",
"0.6572807",
"0.657083... | 0.7226117 | 7 |
top ::= definition | external | expression | '' | def mainLoop
token = @parser.start
while token
token = token.next if ";" == token.value
return if token.kind == :eof
case token.value
when "def"
if function_ast = @parser.parseDefinition(token)
if function_code = function_ast.code(@module ,@builder)
#puts "R... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def top;end",
"def top_expression\n\n exp = @top_expressions.first\n\n return nil unless exp\n\n exp_name = OpenWFE::to_underscore(exp[0])\n\n DefineExpression.expression_names.include?(exp_name) ? exp : nil\n end",
"def top\n end",
"def naked_top_level; end",
"d... | [
"0.657042",
"0.6528482",
"0.6329504",
"0.6228006",
"0.6184273",
"0.61029744",
"0.6061573",
"0.5986591",
"0.59389895",
"0.59303933",
"0.59303623",
"0.59169996",
"0.59038764",
"0.59038764",
"0.5893588",
"0.58821386",
"0.58028805",
"0.5802291",
"0.58022535",
"0.5681141",
"0.5671... | 0.0 | -1 |
id, action, suffix, attrs.. | def assert_div(*args)
attributes = args.last.is_a?(Hash) ? args.pop : {}
attributes[:id] = public_id(*args)
assert_tag :tag => "div", :attributes => attributes
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def attributes_for(action)\n end",
"def attributes_for(action)\n end",
"def attr(name); end",
"def attr; end",
"def action_name; end",
"def helper_attr(*attrs); end",
"def html_safe_attributes\n [:actions]\n end",
"def html_attributes(attr); end",
"def action\n @attributes[:action]\n ... | [
"0.63210166",
"0.63210166",
"0.6257255",
"0.6241486",
"0.6232727",
"0.614034",
"0.60979515",
"0.5959315",
"0.59435797",
"0.59435797",
"0.59225935",
"0.59124404",
"0.57952243",
"0.57832646",
"0.57832646",
"0.57832646",
"0.5766566",
"0.57621855",
"0.57621855",
"0.57444036",
"0.... | 0.0 | -1 |
Show report details and only show selescted problem in gmap | def show
@list = List.find(params[:id])
@problems = Problem.paginate(page: params[:page])
#Respond to will create a call to csv and prepare the list for .xls exporting
#See lists/show.xls.erb for table formatting details
respond_to do |format|
format.html # index.html.erb
format... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show_solutions\n\t\t@normal_solutions = current_problem.solutions.where(reported: false)\n\t\t@reported_solutions = current_problem.solutions.where(reported: true)\n\tend",
"def show\n @hash = Gmaps4rails.build_markers(@report) do |report, marker|\n marker.lat report.latitude\n marker.lng report... | [
"0.6477904",
"0.60773075",
"0.59132004",
"0.55941236",
"0.5521068",
"0.55128837",
"0.5493375",
"0.5463759",
"0.5452543",
"0.54339087",
"0.5423804",
"0.54069567",
"0.5398842",
"0.5397239",
"0.53835315",
"0.5364544",
"0.5363988",
"0.5360641",
"0.5359028",
"0.5359028",
"0.535902... | 0.0 | -1 |
Show list of reports and show all of them in gmap | def index
@lists = List.paginate(page: params[:page])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @reports = Report.valid_reports\n @hash = Gmaps4rails.build_markers(@reports) do |report, marker|\n marker.lat report.latitude\n marker.lng report.longitude\n marker.infowindow report.post\n end\n end",
"def show\n @hash = Gmaps4rails.build_markers(@report) do |report, mar... | [
"0.71736634",
"0.6651422",
"0.65161145",
"0.64369446",
"0.6388888",
"0.63139343",
"0.6298535",
"0.6296825",
"0.6249891",
"0.6188159",
"0.61650115",
"0.616299",
"0.6058917",
"0.6018471",
"0.6018471",
"0.6018471",
"0.6018471",
"0.6018471",
"0.6018471",
"0.6018471",
"0.6018471",... | 0.0 | -1 |
Is the passed value a boolean? | def is_a?(other)
if other == Mongoid::Boolean || other.class == Mongoid::Boolean
return true
end
super(other)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def boolean?\n !@arg[:boolValue].nil?\n end",
"def is_bool(value) #method\n if value == 'verdadero' || value == 'falso'\n true\n else\n false\n end\n end",
"def boolean?\n proc do |o|\n o.is_a? String and o.is_b?\n end\n end",
"def to_boolean(val)\n va... | [
"0.8556975",
"0.8147522",
"0.81432986",
"0.8127934",
"0.8126203",
"0.812554",
"0.81174374",
"0.80644095",
"0.8057694",
"0.8027011",
"0.8020354",
"0.79498076",
"0.7932162",
"0.792273",
"0.78634006",
"0.7851141",
"0.7824134",
"0.78222615",
"0.77795005",
"0.7768506",
"0.7751301"... | 0.0 | -1 |
rubocop:enable Metrics/AbcSize rubocop:disable Naming/AccessorMethodName | def set_url(url_value)
@path = url_value.delete_prefix "/"
@dir = File.dirname(@path)
@url = url_value
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def private; end",
"def private_method\n end",
"def get()\n \n end",
"def getters; end",
"def attr_reader(*)\n end",
"def implementation; end",
"def implementation; end",
"def attribute; end",
"def attribute; end",
"def attribute; end",
"def attribute; end",
"def attri... | [
"0.77613294",
"0.6771952",
"0.64930516",
"0.64524096",
"0.6325302",
"0.62434363",
"0.62434363",
"0.6199795",
"0.6199795",
"0.6199795",
"0.6199795",
"0.6199795",
"0.6199795",
"0.6199795",
"0.6091678",
"0.60822135",
"0.6051886",
"0.6051886",
"0.6032032",
"0.6032032",
"0.6032032... | 0.0 | -1 |
GET /attorneys GET /attorneys.json | def index
add_breadcrumb I18n.t('listing', entity: Attorney.model_name.human(count: 10))
@q = policy_scope(Attorney).ransack(params[:q])
@attorneys = @q.result.page(params[:page]).per(session[:default_per])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @attorneys = Attorney.all\n end",
"def index_attending\n puts \"user: #{@current_user.json_hash[:id]}\"\n dinners = []\n @dinners = @current_user.attended_dinners\n @dinners.each do |dinner|\n dinners << dinner.all_info\n end\n render json: dinners\n end",
"def index\n ... | [
"0.67740446",
"0.65428793",
"0.62526363",
"0.612773",
"0.611677",
"0.61039126",
"0.6080454",
"0.5944585",
"0.591119",
"0.58474904",
"0.58321285",
"0.5830098",
"0.5822952",
"0.5813293",
"0.5764677",
"0.5745407",
"0.5741776",
"0.5741393",
"0.5730757",
"0.5730757",
"0.57177025",... | 0.60437506 | 7 |
GET /attorneys/1 GET /attorneys/1.json | def show
authorize @attorney
add_breadcrumb @attorney.name
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @attorneys = Attorney.all\n end",
"def index_attending\n puts \"user: #{@current_user.json_hash[:id]}\"\n dinners = []\n @dinners = @current_user.attended_dinners\n @dinners.each do |dinner|\n dinners << dinner.all_info\n end\n render json: dinners\n end",
"def show\n ... | [
"0.66491973",
"0.6322717",
"0.62398964",
"0.617681",
"0.60078365",
"0.59911615",
"0.59350246",
"0.5925389",
"0.59184074",
"0.58972144",
"0.58477336",
"0.57922655",
"0.5790302",
"0.5784054",
"0.57712364",
"0.567892",
"0.56614786",
"0.5648322",
"0.5639814",
"0.5636183",
"0.5634... | 0.0 | -1 |
POST /attorneys POST /attorneys.json | def create
@attorney = Attorney.new(attorney_params)
authorize @attorney
respond_to do |format|
if @attorney.save
format.html { redirect_to (params[:save_and_new].present? ? new_attorney_path : @attorney), success: I18n.t('notices.created', entity: Attorney.model_name.human, id: @attorney.id) ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n \n \n\t@attending = current_user.attendings.build(params[:attending])\n\n respond_to do |format|\n if @attending.save\n\t \n format.html { redirect_to @attending, notice: 'Your RSVP was successfully created.' }\n format.json { render json: @attending, status: :created, loc... | [
"0.60662335",
"0.5858708",
"0.5773574",
"0.5759115",
"0.57201195",
"0.5651526",
"0.56321645",
"0.55783844",
"0.5566196",
"0.55359614",
"0.55290115",
"0.5515351",
"0.55062634",
"0.5505112",
"0.5502833",
"0.5497073",
"0.5475794",
"0.5463293",
"0.5437321",
"0.54316664",
"0.54178... | 0.6002338 | 1 |
PATCH/PUT /attorneys/1 PATCH/PUT /attorneys/1.json | def update
authorize @attorney
respond_to do |format|
if @attorney.update(attorney_params)
format.html { redirect_to @attorney, success: I18n.t('notices.updated', entity: Attorney.model_name.human, title: @attorney.name) }
format.json { render :show, status: :ok, location: @attorney }
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update!(params)\n res = @client.put(path, nil, params, \"Content-Type\" => \"application/json\")\n @attributes = res.json if res.status == 201\n res\n end",
"def patch!\n request! :patch\n end",
"def update(attrs, path=nil)\n resp = api_client.put(path || url, JSON.dump(attrs))\n ... | [
"0.64468575",
"0.6292797",
"0.61264193",
"0.6059532",
"0.6045576",
"0.6032921",
"0.59984034",
"0.59779584",
"0.5938059",
"0.59252864",
"0.59080595",
"0.5888185",
"0.5872539",
"0.5869206",
"0.5862026",
"0.585973",
"0.5839309",
"0.583005",
"0.5815883",
"0.5815883",
"0.5813042",... | 0.6654184 | 0 |
DELETE /attorneys/1 DELETE /attorneys/1.json | def destroy
authorize @attorney
@attorney.destroy
respond_to do |format|
format.html { redirect_to attorneys_url, notice: 'Attorney was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @attorney.destroy\n respond_to do |format|\n format.html { redirect_to attorneys_url, notice: 'Attorney was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete\n client.delete(\"/#{id}\")\n end",
"def delete_tenant_circle(args = {}) ... | [
"0.69923544",
"0.69680786",
"0.67611885",
"0.66443765",
"0.66395587",
"0.6632094",
"0.6625803",
"0.66063505",
"0.6552549",
"0.65092826",
"0.6488161",
"0.6484654",
"0.64676017",
"0.6466041",
"0.64658093",
"0.64616174",
"0.6458462",
"0.6458171",
"0.64386904",
"0.64386904",
"0.6... | 0.68697304 | 2 |
Use callbacks to share common setup or constraints between actions. | def set_attorney
@attorney = Attorney.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.61642385",
"0.60448",
"0.5945487",
"0.5915654",
"0.58890367",
"0.58330417",
"0.5776098",
"0.5703048",
"0.5703048",
"0.5654613",
"0.5620029",
"0.5423114",
"0.540998",
"0.540998",
"0.540998",
"0.5393666",
"0.53783023",
"0.53568405",
"0.53391176",
"0.5339061",
"0.53310865",
... | 0.0 | -1 |
Never trust parameters from the scary internet, only allow the white list through. | def attorney_params
params.require(:attorney).permit(:name, :telephone, :email, :preferred)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def allow_params_authentication!; end",
"def allowed_params\n ALLOWED_PARAMS\n end",
"def default_param_whitelist\n [\"mode\"]\n... | [
"0.69792545",
"0.6781151",
"0.67419964",
"0.674013",
"0.6734356",
"0.6591046",
"0.6502396",
"0.6496313",
"0.6480641",
"0.6477825",
"0.64565",
"0.6438387",
"0.63791263",
"0.63740575",
"0.6364131",
"0.63192815",
"0.62991166",
"0.62978333",
"0.6292148",
"0.6290449",
"0.6290076",... | 0.0 | -1 |
Define a method called name on this class which returns false and then define a method on true_class which returns true === Examples Class Entity extend Purugin::Predicate defines living? method on Entity and Living predicate :living, Living end | def predicate(true_class, name=nil)
name = name ? name.to_s : true_class.name.split('::')[-1]
label = Purugin::StringUtils.camelcase_to(name, ' ')
name = Purugin::StringUtils.camelcase_to(name, '_').downcase
true_class.__send__(:define_method, :kind) { name }
true_class.__send__(:define_me... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def define_state_predicate\n name = self.name\n \n # Still use class_eval here instance of define_instance_method since\n # we need to be able to call +super+\n @instance_helper_module.class_eval do\n define_method(\"#{name}?\") do |*args|\n args... | [
"0.61665624",
"0.6156552",
"0.5809894",
"0.5795419",
"0.57528275",
"0.56929004",
"0.5686195",
"0.5686195",
"0.565144",
"0.56170136",
"0.55858594",
"0.55760366",
"0.5574076",
"0.55619264",
"0.5544886",
"0.55181",
"0.5514339",
"0.5502588",
"0.5462134",
"0.5449284",
"0.54476243"... | 0.8509046 | 0 |
:correct_task_owner, only: [:create, :edit, :update, :destroy] GET /tasks GET /tasks.json | def index
@tasks = Task.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @task = Task.new(task_params)\n @task.created_by = current_user\n authorize @task\n unless can_change_task_owner(@task)\n @task.assigned_by = current_user\n end\n respond_to do |format|\n if @task.save\n format.html { redirect_back_or_default tasks_url, t('Record has... | [
"0.7013628",
"0.68321735",
"0.68319505",
"0.679489",
"0.6755889",
"0.66547537",
"0.6623464",
"0.65952075",
"0.65952075",
"0.6538627",
"0.65164965",
"0.6505874",
"0.6491687",
"0.6491687",
"0.6491687",
"0.6491687",
"0.6491687",
"0.6474804",
"0.6446225",
"0.6432151",
"0.6428795"... | 0.0 | -1 |
GET /tasks/1 GET /tasks/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @task = Task.find(params[:id])\n\n render json: @task\n end",
"def task(name)\n get \"#{base_url}/tasks/#{name}\"\n end",
"def show\n render :json => Project.find(params[:project_id]).tasks.find(params[:id])\n end",
"def show\n \n @task = @project.tasks.find(params[:i... | [
"0.76102495",
"0.75540173",
"0.74559313",
"0.7447613",
"0.73462164",
"0.733567",
"0.7333314",
"0.72563857",
"0.72424746",
"0.72254133",
"0.7208007",
"0.7204103",
"0.7203866",
"0.7203866",
"0.7203866",
"0.7203866",
"0.7203866",
"0.7203866",
"0.7203866",
"0.7203866",
"0.7203866... | 0.0 | -1 |
POST /tasks POST /tasks.json | def create
@task = current_user.tasks.build(task_params)
respond_to do |format|
if @task.save
format.html {redirect_to @task.user, notice: 'Task was successfully created.'}
else
format.html {render :new}
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n #@task = Task.new(task_params)\n task = @task_list.tasks.create!(task_params)\n render json: task\n end",
"def create\n @task = Task.new(task_params)\n\n if @task.save\n render json: @task, status: :created\n else\n render json: @task.errors, status: :unprocessable_entit... | [
"0.7529737",
"0.74976224",
"0.7411092",
"0.7389878",
"0.7261207",
"0.72587913",
"0.7183996",
"0.7147952",
"0.71120256",
"0.70759165",
"0.70639485",
"0.70576006",
"0.70560944",
"0.70294535",
"0.7016957",
"0.7012058",
"0.70110804",
"0.7009976",
"0.6993863",
"0.69896185",
"0.698... | 0.0 | -1 |
PATCH/PUT /tasks/1 PATCH/PUT /tasks/1.json | def update
respond_to do |format|
if @task.update(task_params)
format.html {redirect_to @task.user, notice: 'Task was successfully updated.'}
else
format.html {render :edit}
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\r\n @tasks = Task.find(params[:id])\r\n if @tasks.update(task_params)\r\n render json: @tasks\r\n else\r\n render json: @tasks.errors, status: :unprocessable_entity\r\n end\r\n end",
"def update\n task = Task.find(params[:id])\n if task.update(t... | [
"0.7446562",
"0.7293086",
"0.7265396",
"0.7265396",
"0.71397257",
"0.70778626",
"0.70257324",
"0.6966163",
"0.6963022",
"0.69535804",
"0.6911542",
"0.6907889",
"0.6907889",
"0.6907889",
"0.6897803",
"0.6897803",
"0.6897803",
"0.6897803",
"0.6897803",
"0.6897803",
"0.6897803",... | 0.0 | -1 |
DELETE /tasks/1 DELETE /tasks/1.json | def destroy
@task.destroy
respond_to do |format|
format.html {redirect_to current_user, notice: 'Task was successfully deleted.'}
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete_task id\n request :delete, \"tasks/#{id}\"\n nil\n end",
"def delete_task\n @task = Task.find_by(id: params[:id])\n @task.destroy\n render :json => @task.as_json(:only => [:id])\n end",
"def destroy\n @task = Task.find(params[:id])\n @task.destroy\n\n respond_to do |f... | [
"0.78328025",
"0.75880355",
"0.75650203",
"0.7564277",
"0.7530549",
"0.7530549",
"0.7530549",
"0.7530549",
"0.7530549",
"0.7530549",
"0.7530549",
"0.7530549",
"0.7530549",
"0.7530549",
"0.7530549",
"0.7530549",
"0.7530549",
"0.7489193",
"0.7489193",
"0.7489193",
"0.7489193",
... | 0.0 | -1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.