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
checks error and raises an exception for error if necessary
def check_and_raise( err_ptr ) return if err_ptr.null? raise specific_error_class( err_ptr ).new( err_ptr.message ) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def recover_from(_error); end", "def error?; end", "def error?; end", "def error?; end", "def check_error(response)\n raise NotImplementedError\n end", "def handle_error(e)\n raise e\n end", "def rescue_from(exception); end", "def raise_error(error)\n # @todo: log error...
[ "0.731029", "0.72157824", "0.72157824", "0.72157824", "0.7136832", "0.71030176", "0.70683837", "0.7059608", "0.7019183", "0.6982991", "0.6957556", "0.6932696", "0.6904045", "0.6904045", "0.6904045", "0.6904045", "0.6904045", "0.6904045", "0.6904045", "0.68887854", "0.6880007"...
0.65850866
58
returns a proc that calls check_and_raise
def return_check @@return_check ||= Proc.new { |ptr| Error.check_and_raise( ptr ) } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def helper_nested_raise(*args)\n Proc.new{\n raise(*args)\n }.call\n end", "def f(&block)\n # The block is a proc.\n block.class == Proc or raise\n block.call\n end", "def may_fail # block\n begin\n yield\n rescue\n end\nend", "def f(&code)\n ...
[ "0.67252994", "0.6558676", "0.6490675", "0.6389631", "0.6379924", "0.63684845", "0.6277363", "0.6260393", "0.6224094", "0.6224094", "0.61996484", "0.6193658", "0.6193658", "0.6191877", "0.61769205", "0.61461157", "0.6119099", "0.6110435", "0.60961807", "0.6081463", "0.6031172...
0.74244803
0
returns the most specific error message from this error chain
def cause_message root_cause.best_message end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def error_msg\n name\n end", "def error_message\n error.message\n end", "def first_error_message\n errors.messages.values.flatten.first if errors.any?\n end", "def get_error_message(error)\n case error\n when Dentaku::UnboundVariableError\n vars = error.unbound_va...
[ "0.7642966", "0.7586796", "0.7450561", "0.74010396", "0.73366463", "0.7306635", "0.72649014", "0.72581166", "0.71840465", "0.7182479", "0.71521527", "0.71314394", "0.71314394", "0.7124953", "0.71193755", "0.7070158", "0.7054843", "0.70399314", "0.70072746", "0.69810045", "0.6...
0.65683246
47
returns a combined message if there are children, or the best otherwise
def message if self[:child].null? best_message else "#{best_message}: #{cause_message}" end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parent_message\n end", "def tree\n return nil if messages.size == 0\n build_tree unless @tree\n @tree\n end", "def thread_messages\n #thread.messages + [thread]\n Message.where([\"id = ? or parent_id = ?\", thread_id, thread_id])\n end", "def chatting_with\n ChatMessage...
[ "0.5837178", "0.5774578", "0.5715154", "0.5591046", "0.5425546", "0.54043156", "0.5273015", "0.5265586", "0.5210616", "0.5178147", "0.5162563", "0.51509714", "0.51467884", "0.5145365", "0.5138349", "0.5120865", "0.5084809", "0.5076625", "0.5065209", "0.50590575", "0.5035394",...
0.71339303
0
create a hotel search with the same parameters for a given hotel
def hotel_search(result_or_hotel_id) hotel_id = result_or_hotel_id.is_a?(Fixnum) ? result_or_hotel_id : result_or_hotel_id.hotel_id params = parameters params.delete(:city_id) params.delete(:region_id) params[:hotel_id] = hotel_id TAPI::V3::Hotels::Search.new(params) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @hotels = if params[:term]\n Hotel.where(\"name LIKE (?) OR address LIKE (?)\", \"%#{params[:term]}%\", \"%#{params[:term]}%\").paginate(page: params[:page], per_page: 5)\n else\n Hotel.paginate(page: params[:page], per_page: 6)\n end\n end", "def index\n @q = Hotel.ransack(sea...
[ "0.6747231", "0.6406488", "0.60836864", "0.6081106", "0.60795575", "0.59815687", "0.5966343", "0.5950032", "0.59352696", "0.59194386", "0.59005445", "0.58388746", "0.58325577", "0.5828995", "0.58226323", "0.5821731", "0.57954097", "0.5777463", "0.5770678", "0.5683203", "0.567...
0.7208193
0
Write a function to reverse a string
def reverse(string) string.reverse end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reverse(string)\nend", "def reverse_string(str)\nend", "def reverseString(string)\n\nend", "def reverse_string string\n\tstring.reverse\nend", "def reverse_string input\n input.reverse\nend", "def reverse_string(s)\n s.reverse!\nend", "def reverse_string(string)\r\n return string.reverse\r\n...
[ "0.877524", "0.8711648", "0.8679222", "0.86263543", "0.86139816", "0.8611876", "0.8590328", "0.8578234", "0.8574694", "0.8556721", "0.8547193", "0.8531772", "0.85233575", "0.8522481", "0.8522481", "0.8479142", "0.8458592", "0.84470016", "0.84199566", "0.84031993", "0.83980495...
0.8566587
11
override devise_auth_token create method
def create @resource = User.find_by_phone_number(params[:phone_number]) if @resource && @resource&.valid_password?(params[:password]) @client_id, @token = @resource.create_token @resource.add_user_uid @resource.save sign_in(:user, @resource, store: false, bypass: false) add_device_id render_create_success else render_create_error_bad_credentials # devise_auth_token method (parent class) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n super do\n resource.authentication_token = Devise.friendly_token\n resource.save\n end\n end", "def generate_token\n self.token = Devise.friendly_token\n end", "def generate_auth_token\n token = AuthToken.new(user: self)\n token if token.save\n end", "def create_token...
[ "0.7914498", "0.7146864", "0.7135895", "0.7129288", "0.6985425", "0.69661564", "0.6870447", "0.68378377", "0.68331784", "0.6795782", "0.677803", "0.6761746", "0.67491704", "0.6746395", "0.67286116", "0.67286116", "0.67286116", "0.67286116", "0.6696324", "0.6687873", "0.66503"...
0.6173407
86
GET /dashboards/1 GET /dashboards/1.json
def capa_pending_audits puts "**************************" puts params[:audit_id] puts "***************************" @capa_pending_findings = [] @audit = Audit.find(params[:audit_id]) @audit.findings.each do |finding| if finding.status_id == "CAPA Pending" || finding.status_id == "" @capa_pending_findings << finding end end respond_to do |format| # format.html # show.html.erb format.json { render json: @capa_pending_findings.to_json } end puts "*****@capa_pending_findings*************#{@capa_pending_findings.inspect}" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_dashboards\n @dash_service.get_dashboards\n end", "def index\n @dashboards = Dashboard.all\n end", "def index\n @dashboards = Dashboard.all\n end", "def index\n @dashboards = Dashboard.all\n end", "def index\n @dashboards = Dashboard.all\n end", "def index\n @dashboards...
[ "0.76852626", "0.7571133", "0.7571133", "0.7571133", "0.7571133", "0.7455056", "0.7354721", "0.7228398", "0.70155984", "0.6975706", "0.6947698", "0.6885013", "0.68410456", "0.68410456", "0.68410456", "0.68410456", "0.68410456", "0.68410456", "0.68410456", "0.67870796", "0.672...
0.0
-1
returns a list of conversations that the user is a part of
def index userID = whoAreYou() #get a list of the 20 most recent conversations for the user #user_id has to be gotten from authentication myConvo = UserConversationMmTable.where({:user_id => userID}).order("updated_at DESC").limit(20) #this array will hold the most recent message for each conversation mostRecentMessageForEachConversation = [] #iterate through the 20 most recent conversations myConvo.each do |conversation| #find the most recent message for each conversation #remember this can't be an array myMessage = Message.where(:conversation_id => conversation.conversation_id).order("created_at DESC").limit(1) #append the most recent message mostRecentMessageForEachConversation << myMessage[0] end #sort the messages by created at with most recent coming up first mostRecentMessageForEachConversation.sort_by!{|message| message.created_at}.reverse! @myJSON=[] #store message object attributes in a a dictionary mostRecentMessageForEachConversation.each do |message| diction = {} diction[:conversation_id] = message.conversation_id #look up all participants in the conversation linkingUserConvoList = UserConversationMmTable.where(:conversation_id => message.conversation_id) #iterate this list to find the names of the users recipient = "" linkingUserConvoList.each do |record| myUser = User.find(record.user_id) #find the user firstName = myUser.first_name name = firstName + ". " recipient << name end diction[:recipient] = recipient diction[:created_at] = message.created_at diction[:id] = message.id diction[:message_content] = message.message_content diction[:user_id] = message.user_id #look up the user's name myUser = User.find(message.user_id) firstName = myUser.first_name lastName = myUser.last_name name = firstName + " " + lastName diction[:full_name] = name diction[:userName] = myUser.userName diction[:profilePic] = myUser.profilePic #build a string of userNames that consists of all users in the conversation listOfMmObjects = UserConversationMmTable.where(:conversation_id =>message.conversation_id) #create a userIDs list of all people in the conversation userIDs = [] listOfMmObjects.each do |x| userIDs << x.user_id puts x.user_id end #cultivate a list of userNames for all people in the conversation preAddressing = "" userIDs.each do | someUser | #don't add the person requesting the conversations into the preaddressing if(someUser == userID) next end myUser = User.where(:id => someUser)[0] #because User.where returns an array of length 1 preAddressing = preAddressing + myUser.userName + " " end diction[:preAddressing] = preAddressing #append the number of likes that message has diction[:likes] = message.likes #check whether this message has been liked by the user asking for the message if( Like.where(:user_id => userID, :message_id => message.id).length == 0 ) #there is no record, therefore no like diction[:hasBeenLiked] = false else diction[:hasBeenLiked] = true end #append the dictionary into the array @myJSON << diction end render :json => @myJSON end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_conversations\n n = Notification.where(user_id:current_user)\n conversation_ids = Array.new\n n.each do |v|\n conversation_ids << v.conversation_id\n end\n conversations = Conversation.where(id:conversation_ids)\n\n end", "def conversations\n Conversation.where(\"sender_id = ? or ...
[ "0.8065832", "0.7568365", "0.7539648", "0.7493028", "0.7427118", "0.72925544", "0.7161733", "0.7146437", "0.71147466", "0.7033808", "0.69876266", "0.6972412", "0.6919085", "0.6854869", "0.6827358", "0.6764426", "0.67407817", "0.67375034", "0.67133987", "0.6713123", "0.6687785...
0.0
-1
Create a new hook object that will execute the scripts located in specified directory.
def initialize(hook_dir, git = Git.new) @config = Raincoat::Configuration.new @script_dir = File.join(@config.script_dir, hook_dir) @git = git end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def install(executable_path, base_directory = base_directory_guess, &block)\n executable_file = Pathname.new(executable_path).expand_path\n executable_name = executable_file.basename.to_s\n\n used_hook_paths(base_directory).each do |hook_path|\n hook_path.mkpath\n h...
[ "0.61132085", "0.60169864", "0.59998745", "0.58129936", "0.57211137", "0.57206327", "0.5689492", "0.5609018", "0.55125886", "0.5459696", "0.54345775", "0.5422069", "0.53994673", "0.53977233", "0.53671914", "0.5303225", "0.52999556", "0.5289883", "0.52718925", "0.52686477", "0...
0.64887255
0
This is called when the hook is executed by git's callbacks. It loads each file in the script_dir and creates an instance of the defined class call is then called on the instance being passed the result of git_diff.
def run c = changes success = scripts.inject(true) do |result, script| script.call(c) && result end if success 0 else $stderr.puts "Operation unsuccessful!" $stderr.puts "One or more of your raincoat scripts failed" 1 end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initialize(hook_dir, git = Git.new)\n @config = Raincoat::Configuration.new\n @script_dir = File.join(@config.script_dir, hook_dir)\n @git = git\n end", "def run\n # Try to get the diff_filename and open it for the comparison\n # And if this is the first time the import is run...
[ "0.6328214", "0.6294134", "0.6046456", "0.5895316", "0.5772724", "0.5731927", "0.55034196", "0.5491819", "0.5466589", "0.54172677", "0.5407422", "0.53497607", "0.53289706", "0.5328779", "0.5309476", "0.53045785", "0.53009796", "0.52993965", "0.52976704", "0.52867913", "0.5272...
0.0
-1
This loads all of the scripts in the script dir and instantiates the objects.
def scripts Dir.glob(File.join(script_dir, "*.rb")).inject([]) do |a, e| Kernel.load(e) a + [initialize_script(e)] end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_scripts!\n scripts_dir = File.expand_path @config['blur']['scripts_dir']\n script_file_paths = Dir.glob File.join scripts_dir, '*.rb'\n\n # Sort the script file paths by file name so they load by alphabetical\n # order.\n #\n # This will make it possible to create a script ca...
[ "0.75904685", "0.7583609", "0.7528638", "0.7510601", "0.6979835", "0.6902221", "0.6805119", "0.6616926", "0.6605479", "0.6579169", "0.65181077", "0.65181077", "0.646364", "0.64323914", "0.63872325", "0.6338628", "0.63203245", "0.6299968", "0.62865806", "0.6256452", "0.6234568...
0.7919553
0
Just like ActiveSupport's classify
def class_name_for(file_name) file_name.split(/\//).last.sub(/\.rb$/, '').split(/_/).map do |s| s.capitalize end.join('') end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def classify\n # TODO\n # Inflector.classify(self)\n end", "def classify(string)\n camelize(string.to_s.sub(/.*\\./, ''))\n end", "def classify\n ActiveSupport::Inflector.classify(self)\n end", "def classify\n self.sub(/.*\\./, '').split(\"::\").map {|ele| ele.camelcase }.jo...
[ "0.7637864", "0.73866475", "0.734221", "0.72592825", "0.7240348", "0.7112953", "0.6997507", "0.692697", "0.6772904", "0.67588764", "0.6662905", "0.65644026", "0.64646745", "0.6458568", "0.6412765", "0.637354", "0.6346891", "0.6282724", "0.6190514", "0.6185695", "0.61819434", ...
0.0
-1
A user should be given a menu of operations A user should be able to choose from the menu A user should be able to enter numbers to perform the operation on A user should be shown the result This process should continue until the user selects a quit option from the menu we create a method called menu that prints out a bunch of information. This means we can call it lots of time.
def menu puts "(a) - addition" puts "(s) - subtraction" puts "(m) - multiplication" puts "(d) - division" puts "(e) - exponents" # makes a new line puts "(sq) - squareroot" puts "(q) - quitting" # makes a new line print "Enter your choice: " # allows user to type next to it gets.chomp() # ask user for input and we implicitly return that. end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def menu\n puts \"------Calculator----\"\n puts \"Welcome to the calculator!\"\n puts \"Please select an option:\"\n puts \"\\t1) Enter numbers and modifier\"\n puts \"\\t2) Enter a string input\"\n puts \"\\t3) View the calculations you have preformed\"\n puts \"\\t4) Exit\"\n main_menu\n ...
[ "0.8158758", "0.8009346", "0.7989659", "0.7967174", "0.7953983", "0.7850194", "0.78458804", "0.78038394", "0.77273756", "0.7703754", "0.7662247", "0.7660992", "0.7641135", "0.7639223", "0.7610692", "0.7607816", "0.7603632", "0.75790983", "0.75714767", "0.75590944", "0.7542375...
0.7166903
93
store whatever was typed as the user_choice create an add method
def add # ask for some inputs, after some text. # turn those inputs into a float, and saves it in some variable. print "What is your first number?" first_number = gets.to_f print "What is your second number?" second_number = gets.to_f # add the two inputs given together and save the result. result = first_number + second_number # Print these things out ot the screen puts "The result is #{result}" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def register_choice\n end", "def add\n # ask the user for the user name\n new_user_name = @view.ask_user_for(:username)\n # ask the user for the user continent\n new_user_continent = @view.ask_user_for(:password)\n # create an instance of `Country` based on what the user said\n new_user = User...
[ "0.69116676", "0.6711179", "0.6652111", "0.6453446", "0.6408938", "0.62639046", "0.6257522", "0.62476134", "0.6216477", "0.6154708", "0.6154708", "0.6103031", "0.6092562", "0.60556847", "0.6055016", "0.60512877", "0.6040529", "0.60327613", "0.59934807", "0.5982254", "0.598084...
0.0
-1
Metodo initialize para inicializar los atributos
def initialize(numero_historia, nombre, apellido, fecha_nacimiento, ocupacion, fumador, sexo, edad) @numero_historia, @nombre, @apellido, @fecha_nacimiento, @ocupacion, @fumador, @sexo, @edad = numero_historia, nombre, apellido, fecha_nacimiento, ocupacion, fumador, sexo, edad end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def init\n end", "def init\n end", "def init\n end", "def initialize\n init\n end", "def init; end", "def init; end", "def init; end", "def init; end", "def init\n\n end", "def at_init\n\n\t\tend", "def initialize\n\t\t\n\tend", "def initialize\n\tinit\n\tsuper\nend", "def...
[ "0.77381283", "0.77381283", "0.77381283", "0.7711427", "0.75847304", "0.75847304", "0.75847304", "0.75847304", "0.7552943", "0.74693817", "0.73675567", "0.7359476", "0.7320686", "0.7320686", "0.73079675", "0.72992045", "0.7296054", "0.7288239", "0.7288239", "0.72222334", "0.7...
0.0
-1
Metodo para mostrar el flujo de salida formateado
def to_s "[Numero De Historia=#{@numero_historia}, Nombre=#{@nombre}, Apellido=#{@apellido}, Fecha De Nacimiento=#{@fecha_nacimiento}, Ocupacion=#{@ocupacion}, Fumador=#{@fumador}, Sexo=#{@sexo}, Edad=#{@edad}]:" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_s\n salida = \"\\n #{@operacion} \\n\"\n \n case @operacion\n when \"suma\" then salida << \"\\n#{(@operador[0]+@operador[1]).to_s}\\n\"\n when \"producto\" then salida << \"\\n#{(@operador[0]*@operador[1...
[ "0.6413712", "0.6186878", "0.61642057", "0.609885", "0.6090751", "0.6057884", "0.60208297", "0.5978218", "0.59709007", "0.5968338", "0.5923462", "0.59152174", "0.5902862", "0.5874759", "0.58718324", "0.58496827", "0.5799905", "0.5797655", "0.5794906", "0.577238", "0.57524484"...
0.56645215
25
Metodo initialize para iniciar los atributos
def initialize(numero_historia, nombre, apellido, fecha_nacimiento, ocupacion, fumador, sexo, edad, peso, talla, cintura, cadera, bicipital, tricipital, subescapular, suprailiaco, brazo, factor_actividad_fisica) super(numero_historia, nombre, apellido, fecha_nacimiento, ocupacion, fumador, sexo, edad) @peso, @talla, @cintura, @cadera, @bicipital, @tricipital, @subescapular, @suprailiaco, @brazo, @factor_actividad_fisica = peso, talla, cintura, cadera, bicipital, tricipital, subescapular, suprailiaco, brazo, factor_actividad_fisica end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def init\n end", "def init\n end", "def init\n end", "def initialize\n init\n end", "def init; end", "def init; end", "def init; end", "def init; end", "def at_init\n\n\t\tend", "def init\n\n end", "def initialize\n\t\t\n\tend", "def initialize\n\n\tend", "def initialize\n...
[ "0.7903371", "0.7903371", "0.7903371", "0.77975315", "0.77887475", "0.77887475", "0.77887475", "0.77887475", "0.778501", "0.77715164", "0.7584528", "0.75171626", "0.75171626", "0.7463529", "0.74486214", "0.7415969", "0.74071276", "0.7399128", "0.7386086", "0.7384305", "0.7373...
0.0
-1
Metodo para mostrar el flujo de salida formateado
def to_s "[Peso=#{@peso}, Talla=#{@talla}, Cintura=#{cintura}, Cadera=#{cadera}, Bicipital=#{bicipital}, Tricipital=#{tricipital}, Subescapular=#{subescapular}, Suprailiaco=#{suprailiaco}, Brazo=#{brazo}]:" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_s\n salida = \"\\n #{@operacion} \\n\"\n \n case @operacion\n when \"suma\" then salida << \"\\n#{(@operador[0]+@operador[1]).to_s}\\n\"\n when \"producto\" then salida << \"\\n#{(@operador[0]*@operador[1...
[ "0.6413712", "0.6186878", "0.61642057", "0.609885", "0.6090751", "0.6057884", "0.60208297", "0.5978218", "0.59709007", "0.5968338", "0.5923462", "0.59152174", "0.5902862", "0.5874759", "0.58718324", "0.58496827", "0.5799905", "0.5797655", "0.5794906", "0.577238", "0.57524484"...
0.53042513
86
Funcion para calcular el bicipital de un individuo
def bicipital (@bicipital[0] + @bicipital[1] + @bicipital[2])/3 end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def irfibra\n vag=(fibra * 100) / 50\n vag.round(2)\n end", "def irfibrap\n vag=(valorfibrap * 100) / 50\n vag.round(2)\n end", "def calc_bottles(spend_amt)\n spend_amt.to_i/2\nend", "def valorfibrap\n\t\tvag=(fibra * 70) / 100\n ...
[ "0.6993849", "0.69370884", "0.6769184", "0.6710291", "0.65059274", "0.6392177", "0.63342714", "0.62793887", "0.62614506", "0.62394893", "0.62047225", "0.620142", "0.61983865", "0.6194312", "0.61757386", "0.61593854", "0.6142707", "0.61264545", "0.6124069", "0.61082965", "0.61...
0.74450773
0
Funcion para calcular el tricipital de un individuo
def tricipital (@tricipital[0] + @tricipital[1] + @tricipital[2])/3 end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def huella_nutricional\n (valor_calorico() + huella_carbono()) / 2\n end", "def calculoDiametro(raio)\n return raio * 2\nend", "def defineSueldoVendedor(monto)\n sueldoBase = 1500\n comision = 0.0\n if(monto >= 0 && monto <=1999)\n comision = 0.00*monto\n elsif(monto >= 2000 && monto ...
[ "0.66809225", "0.65129966", "0.6501298", "0.6496744", "0.6468029", "0.6453711", "0.6451471", "0.64411837", "0.6439646", "0.64294696", "0.6406726", "0.64003897", "0.63933676", "0.637482", "0.634377", "0.63432544", "0.6337572", "0.63282794", "0.63282335", "0.63227296", "0.63189...
0.703226
0
Funcion para calcular el indice de masa corporal de un individuo
def imc @peso/(@talla*@talla) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def indice_masa_corporal\n\t\t(peso / (talla * talla) * 10000).round(1)\n\tend", "def calcularIntensidad\n grados = fuzzyfication\n intensidad = defuzzyfication(grados)\n intensidad\n end", "def ig_ind\n\t\taibc(@datos[0]).each_with_index.map{ |ind, i| (ind/aibc(@datos[1])[i])*100 }\n\tend", ...
[ "0.75217146", "0.6367633", "0.6363353", "0.6081151", "0.59999096", "0.5966513", "0.5896482", "0.5891365", "0.5855704", "0.57865673", "0.5785043", "0.57820475", "0.5780088", "0.5767415", "0.5754187", "0.5728229", "0.57207453", "0.56857306", "0.566228", "0.563719", "0.56228906"...
0.50990206
98
Funcion para calcular el subescapular de un individuo
def subescapular (@subescapular[0] + @subescapular[1] + @subescapular[2])/3 end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def subtotal\n precio * cantidad\n end", "def subtotal_sub\n itemis.collect{|itemi| itemi.valid? ? itemi.unit_price*itemi.quantity_quantity : 0}.sum\n end", "def mediaSubescapular\n\t\tmedia = 0.0\n\t\t@subescapular.length.times do |i|\n\t\t media += @subescapular[i]\n\t\tend\n\t\tmedia /= @su...
[ "0.6616092", "0.6565551", "0.6446513", "0.630912", "0.62840444", "0.6211124", "0.6206137", "0.6144855", "0.6103989", "0.6057801", "0.59809613", "0.5883294", "0.5855191", "0.5823878", "0.5811414", "0.5790539", "0.57505375", "0.57327175", "0.57254624", "0.5705029", "0.5695027",...
0.70975626
0
Funcion para calcular el suprailiaco de un individuo
def suprailiaco (@suprailiaco[0] + @suprailiaco[1] + @suprailiaco[2])/3 end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def calcular()\n lista_nombres=@individuos[0].get_lista_nombres\n lista_nombres.each do |nombre|\n cont=0\n igind=0\n #puts nombre\n for j in 0..@individuos.length-1\n\tglucosa=@individuos[j].get_glucosa.to_f\n #puts glucosa\n aibc=@individuos[j].get_aibc(nombre)\n #p...
[ "0.6699335", "0.66900486", "0.6679919", "0.66560453", "0.66449153", "0.6584965", "0.65825987", "0.6546935", "0.65140474", "0.6510144", "0.650166", "0.64967066", "0.6472225", "0.64442104", "0.64425266", "0.64408636", "0.64381146", "0.6437435", "0.64354545", "0.640605", "0.6397...
0.7608092
0
Funcion para calcular el porcentaje de grasa de un individuo
def porcentajegrasa 1.2 * imc + 0.23 * @edad - 10.8 * @sexo - 5.4 end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def porcentajeGlucidos\r\n total_glucidos = 0.0\r\n la = @listaAlimentos.head\r\n lg = @listaGramos.head\r\n while la != nil do\r\n total_glucidos += (la.value.carbohidratos * lg.value) / 100\r\n la = la.next\r\n lg = lg.next\r\n end\r\n to...
[ "0.7294071", "0.7237452", "0.7145337", "0.71443427", "0.7034982", "0.6995583", "0.69877493", "0.69753474", "0.68999594", "0.68623835", "0.68354225", "0.6786946", "0.67867875", "0.6764507", "0.6745375", "0.67411697", "0.67233133", "0.67225444", "0.67169833", "0.6715355", "0.66...
0.7132911
4
Funcion para calcular la cintura de un individuo
def cintura (@cintura[0] + @cintura[1])/2 end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def calcular_imc\n (@peso)/(@altura*@altura)\n end", "def relacion_cc\n\t\t(ccintura / ccadera).round(2)\n\tend", "def calcula_imc(peso, altura)\n return peso / altura ** 2\nend", "def calculoIMC(peso, altura)\n return '%.2f' % (peso.to_f/(altura.to_f * altura.to_f))\nend", "def calcular()\...
[ "0.7066059", "0.7048841", "0.70412034", "0.6872555", "0.68162596", "0.66681737", "0.65959954", "0.65864426", "0.65673316", "0.65308064", "0.6529723", "0.652067", "0.6506596", "0.6501375", "0.6495341", "0.64817375", "0.64793986", "0.6465161", "0.6464806", "0.6458139", "0.64513...
0.78039557
0
Funcion para calcular la cadera de un individuo
def cadera (@cadera[0] + @cadera[1])/2 end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def relacion_cc\n\t\t(ccintura / ccadera).round(2)\n\tend", "def calcular()\n lista_nombres=@individuos[0].get_lista_nombres\n lista_nombres.each do |nombre|\n cont=0\n igind=0\n #puts nombre\n for j in 0..@individuos.length-1\n\tglucosa=@individuos[j].get_glucosa.to_f\n #puts gl...
[ "0.7201646", "0.70900863", "0.6889152", "0.6807586", "0.6756323", "0.6653803", "0.66293025", "0.66290486", "0.66211176", "0.65689844", "0.65653205", "0.6552728", "0.65387875", "0.64770204", "0.6473988", "0.64695156", "0.6437499", "0.6392834", "0.63888216", "0.6385349", "0.638...
0.70479834
2
Funcion para calcular la relacion cintura cadera
def RCC cintura/cadera end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def relacion_cc\n\t\t(ccintura / ccadera).round(2)\n\tend", "def cintura\n\t\t(@cintura[0] + @cintura[1])/2\n\tend", "def cadera\n\t\t(@cadera[0] + @cadera[1])/2\n\tend", "def rcc(c_cintura,c_cadera)\n\t\t@rcc = (c_cintura/c_cadera)\t\n\tend", "def calculo_valor_energetico\n\t\t\t(@carbohidratos*4) + (@lip...
[ "0.8059312", "0.7296065", "0.69505924", "0.6885646", "0.6810975", "0.67546207", "0.6742215", "0.6682075", "0.66603315", "0.66011167", "0.6582324", "0.6576182", "0.6573017", "0.6507364", "0.6490913", "0.64213985", "0.63981247", "0.6397169", "0.63917273", "0.6383493", "0.636246...
0.0
-1
Funcion para calcular el brazo de un individuo
def brazo (@brazo[0] + @brazo[1])/2 end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def irpolialcoholesp\n vag=(valorpolialcoholesp * 100) / 90\n vag.round(2)\n end", "def irazucaresp\n vag=(valorazucaresp * 100) / 90\n vag.round(2)\n end", "def irazucares\n vag=(azucares * 100) / 90\n vag....
[ "0.6826432", "0.66487104", "0.65342224", "0.6503517", "0.6460217", "0.64349926", "0.6429034", "0.6402506", "0.6321047", "0.6278766", "0.62711555", "0.62585795", "0.62510854", "0.62420577", "0.62262666", "0.62252045", "0.6222057", "0.62120134", "0.6187649", "0.6184739", "0.618...
0.7455574
0
Funcion para comparar la edad de los individuos con , ==, =
def <=>(otro) edad <=> otro.edad end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def == (otro)\nif(@num == otro.num) && (@deno == otro.deno)\ntrue\nelse\nfalse\nend\nend", "def <=> (aux)\n\n\t\t\tself.valorKj<=>aux.valorKj && self.valorKcal<=>aux.valorKcal\t\n\tend", "def es (other)\n if other.is_a? Individuo\n @nombre == other.nombre\n elsif\n false\n ...
[ "0.6505936", "0.62279356", "0.6220049", "0.60705745", "0.59967756", "0.597352", "0.5938113", "0.59076446", "0.59004575", "0.5889619", "0.5854635", "0.5824348", "0.576979", "0.5763729", "0.5755853", "0.57548696", "0.5743666", "0.5664053", "0.56605554", "0.5647436", "0.56344134...
0.65535146
0
For each model instance in resources, issues an SQL INSERT (or equivalent) statement to create a new record in the data store for the instance Note that this method does not update identity map. A plugin needs to use adapter directly, it is up to plugin developer to keep identity map up to date.
def create(resources) resources.each do |resource| model = resource.model identity_field = model.identity_field attributes = resource.dirty_attributes properties = [] bind_values = [] # make the order of the properties consistent model.properties(name).each do |property| next unless attributes.key?(property) bind_value = attributes[property] next if property.eql?(identity_field) && bind_value.nil? properties << property bind_values << bind_value end statement = insert_statement(model, properties, identity_field) result = execute(statement, *bind_values) if result.to_i == 1 if identity_field identity_field.set!(resource, result.insert_id) end end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_to_instances\n instances.each do |ins|\n if ins.ie.nil?\n ins.ie = self\n ins.save\n end\n end\n end", "def create\r\n if self.id.nil? && connection.prefetch_primary_key?(self.class.table_name)\r\n self.id = connection.next_sequence_value(self....
[ "0.606938", "0.6047993", "0.59970343", "0.59969777", "0.5968663", "0.59499884", "0.5925161", "0.5925161", "0.59241146", "0.5923034", "0.5911633", "0.58625215", "0.58625215", "0.58202237", "0.58072096", "0.5787964", "0.5722111", "0.5701426", "0.5688754", "0.56715363", "0.56564...
0.7444703
0
Constructs and executes SELECT query, then instantiates one or many object from result set.
def read(query) fields = query.fields types = fields.map { |property| property.primitive } statement, bind_values = select_statement(query) records = [] with_connection do |connection| command = connection.create_command(statement) command.set_types(types) reader = command.execute_reader(*bind_values) begin while reader.next! records << fields.zip(reader.values).to_hash end ensure reader.close end end records end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def execute(input_set = nil)\n resp = super(input_set)\n results = CreateDatabaseResultSet.new(resp)\n return results\n end", "def all_as_objects\n table_name = self.to_s.pluralize\n \n results = CONNECTION.execute(\"SELECT * FROM #{table_name};\")\n \n results_as_objec...
[ "0.6422497", "0.64092475", "0.62273204", "0.6197882", "0.61637044", "0.6148217", "0.61278796", "0.61218035", "0.6120393", "0.6071237", "0.6001185", "0.5995187", "0.5959109", "0.59568846", "0.59500784", "0.5925198", "0.591476", "0.590207", "0.58952653", "0.58466995", "0.582167...
0.0
-1
Constructs and executes UPDATE statement for given attributes and a query
def update(attributes, collection) query = collection.query # TODO: if the query contains any links, a limit or an offset # use a subselect to get the rows to be updated properties = [] bind_values = [] # make the order of the properties consistent query.model.properties(name).each do |property| next unless attributes.key?(property) properties << property bind_values << attributes[property] end statement, conditions_bind_values = update_statement(properties, query) bind_values.concat(conditions_bind_values) execute(statement, *bind_values).to_i end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n eqs = self.class.columns.map { |column| \"#{column} = ?\"}.join(\", \")\n DBConnection.execute(<<-SQL, *attribute_values, id)\n UPDATE\n #{self.class.table_name}\n SET\n #{eqs}\n WHERE\n id = ?\n SQL\n end", "def update_statement(properties, query)\n ...
[ "0.7522876", "0.73528254", "0.7331798", "0.7325052", "0.7279366", "0.71219677", "0.7097367", "0.7083915", "0.7058442", "0.7009169", "0.6951129", "0.69391876", "0.69160694", "0.6915413", "0.68500566", "0.6844156", "0.6844156", "0.68007135", "0.68007135", "0.67430836", "0.66256...
0.664314
20
Constructs and executes DELETE statement for given query
def delete(collection) query = collection.query # TODO: if the query contains any links, a limit or an offset # use a subselect to get the rows to be deleted statement, bind_values = delete_statement(query) execute(statement, *bind_values).to_i end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete_statement(query)\n conditions_statement, bind_values = conditions_statement(query.conditions)\n\n statement = \"DELETE FROM #{quote_name(query.model.storage_name(name))}\"\n statement << \" WHERE #{conditions_statement}\" unless conditions_statement.blank?\n\n return ...
[ "0.80720747", "0.76438046", "0.7323798", "0.73074234", "0.72761494", "0.7241622", "0.7212369", "0.7155227", "0.7086021", "0.7041985", "0.7041985", "0.6999669", "0.6959037", "0.6908855", "0.689507", "0.6799975", "0.67992395", "0.67913157", "0.67913157", "0.67607933", "0.670667...
0.0
-1
Databasespecific method TODO: document
def execute(statement, *bind_values) with_connection do |connection| command = connection.create_command(statement) command.execute_non_query(*bind_values) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def db; end", "def db; end", "def orm; end", "def single_object_db; end", "def determine_database\n self.class.database \n end", "def select(db); end", "def select(db); end", "def database\n @database ||= determine_database\n end", "def database\n @data...
[ "0.72744626", "0.72744626", "0.7055921", "0.69624114", "0.67835546", "0.6748626", "0.6748626", "0.6551997", "0.6544741", "0.6544741", "0.6465475", "0.6465475", "0.64380485", "0.6365966", "0.63547367", "0.6337803", "0.6291422", "0.6202319", "0.61712784", "0.6159298", "0.615588...
0.0
-1
Instantiates new connection object
def open_connection # DataObjects::Connection.new(uri) will give you back the right # driver based on the DataObjects::URI#scheme connection = connection_stack.last || DataObjects::Connection.new(normalized_uri) connection_stack << connection connection end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new_connection; end", "def connect\n @connection.create\n end", "def connect\n Connection.new\n end", "def connection\n @connection = create_connection! unless connected?\n @connection\n end", "def connection\n Connection.new(conn_spec)\n end", "def connect_using ...
[ "0.79401755", "0.79083735", "0.7889366", "0.7696711", "0.7678823", "0.76670307", "0.7664852", "0.75868225", "0.7583175", "0.75813854", "0.7543662", "0.74612194", "0.7380366", "0.73459566", "0.7281644", "0.7268845", "0.7242396", "0.72245324", "0.71336704", "0.71253276", "0.711...
0.7235793
17
Takes connection and closes it
def close_connection(connection) connection_stack.pop connection.close if connection_stack.empty? end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def close_connection; end", "def disconnect; @connection.close end", "def close\n connection.close if connection\n end", "def close_connection\n @connection.close\n end", "def close_connection\n @connection.finish\n end", "def close\n @connection.close\n end", "def close\n @c...
[ "0.85541034", "0.85503864", "0.8452845", "0.8379335", "0.83761245", "0.82687443", "0.82687443", "0.8241984", "0.8224705", "0.82111716", "0.81722766", "0.8164449", "0.8143872", "0.81144017", "0.81144017", "0.81144017", "0.81144017", "0.81056494", "0.81056494", "0.80470073", "0...
0.7345513
45
Adapters requiring a RETURNING syntax for INSERT statements should overwrite this to return true.
def supports_returning? false end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def insert(*values)\n if @opts[:returning]\n # Already know which columns to return, let the standard code handle it\n super\n elsif @opts[:sql] || @opts[:disable_insert_returning]\n # Raw SQL used or RETURNING disabled, just use the default behavior\n # and return...
[ "0.72702754", "0.7250906", "0.70410603", "0.67452997", "0.67057014", "0.67057014", "0.6534281", "0.6534281", "0.6465703", "0.64049315", "0.63920844", "0.6301807", "0.620574", "0.6127585", "0.61147845", "0.60968816", "0.6063822", "0.6060297", "0.6038282", "0.6021109", "0.60007...
0.57566845
41
Adapters that do not support the DEFAULT VALUES syntax for INSERT statements should overwrite this to return false.
def supports_default_values? true end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def insert_default_values_sql\n \"INSERT INTO #{source_list(@opts[:from])} DEFAULT VALUES\"\n end", "def supports_insert_select?\n !@opts[:disable_insert_returning]\n end", "def default_values_clause\n 'VALUES (DEFAULT)'\n end", "def non_sql_option?(key)\n super || ...
[ "0.6799311", "0.65598977", "0.64089286", "0.639646", "0.63255566", "0.6252817", "0.6252817", "0.62359554", "0.62359554", "0.61434484", "0.60691154", "0.6044134", "0.6018062", "0.6001227", "0.59813243", "0.5923848", "0.58947563", "0.58533835", "0.58327657", "0.58252877", "0.58...
0.7004122
0
Constructs SELECT statement for given query,
def select_statement(query) model = query.model fields = query.fields conditions = query.conditions limit = query.limit offset = query.offset order = query.order group_by = nil # FIXME: using a boolean for qualify does not work in some cases, # such as when you have a self-referrential many to many association. # if you don't qualfiy the columns with a unique alias, then the # SQL query will fail. This may mean though, that it might not # be enough to pass in a Property, but we may need to know the # table and the alias we should use for the column. qualify = query.links.any? if qualify || query.unique? group_by = fields.select { |property| property.kind_of?(Property) } end unless (limit && limit > 1) || offset > 0 || qualify # TODO: move this method to Query, so that it walks the conditions # and finds an OR operator # TODO: handle cases where two or more properties need to be # used together to be unique # if a unique property is used, and there is no OR operator, then an ORDER # and LIMIT are unecessary because it should only return a single row if conditions.kind_of?(Query::Conditions::AndOperation) && conditions.any? { |operand| operand.kind_of?(Query::Conditions::EqualToComparison) && operand.subject.respond_to?(:unique?) && operand.subject.unique? } && !conditions.any? { |operand| operand.kind_of?(Query::Conditions::OrOperation) } order = nil limit = nil end end conditions_statement, bind_values = conditions_statement(conditions, qualify) statement = "SELECT #{columns_statement(fields, qualify)}" statement << " FROM #{quote_name(model.storage_name(name))}" statement << join_statement(query, qualify) if qualify statement << " WHERE #{conditions_statement}" unless conditions_statement.blank? statement << " GROUP BY #{columns_statement(group_by, qualify)}" unless group_by.blank? statement << " ORDER BY #{order_statement(order, qualify)}" unless order.blank? if limit statement << ' LIMIT ?' bind_values << limit end if limit && offset > 0 statement << ' OFFSET ?' bind_values << offset end return statement, bind_values end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def select_from_sql(sql)\n sql << \" FROM #{source_list(@opts[:from] || ['DUAL'])}\"\n end", "def select_statement(query)\n model = query.model\n fields = query.fields\n conditions = query.conditions\n limit = query.limit\n offset = query...
[ "0.7276348", "0.721525", "0.7083347", "0.69008046", "0.68876725", "0.68361926", "0.67536837", "0.67397344", "0.6716386", "0.6668979", "0.6607533", "0.65709937", "0.6472723", "0.6453972", "0.64482725", "0.6434176", "0.6420779", "0.6400054", "0.63037384", "0.6281319", "0.627209...
0.7398064
0
Constructs INSERT statement for given query,
def insert_statement(model, properties, identity_field) statement = "INSERT INTO #{quote_name(model.storage_name(name))} " if supports_default_values? && properties.empty? statement << 'DEFAULT VALUES' else statement << <<-SQL.compress_lines (#{properties.map { |property| quote_name(property.field) }.join(', ')}) VALUES (#{(['?'] * properties.size).join(', ')}) SQL end if supports_returning? && identity_field statement << " RETURNING #{quote_name(identity_field.field)}" end statement end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def statement\n [\n \"insert into\",\n @table,\n column_list,\n query_expression,\n ].compact.join(' ')\n end", "def insert_into_sql(sql)\n sql << \" INTO \"\n if (f = @opts[:from]) && f.length == 1\n identifier_append(sql, server_version >= 90500 ?...
[ "0.79744565", "0.70723426", "0.68953127", "0.6856649", "0.680273", "0.6784809", "0.6717811", "0.6690609", "0.6689311", "0.6661563", "0.6634855", "0.6630683", "0.66003054", "0.6549925", "0.65310884", "0.6434469", "0.63848644", "0.63742423", "0.63634884", "0.63585085", "0.63315...
0.5871714
46
Constructs UPDATE statement for given query,
def update_statement(properties, query) conditions_statement, bind_values = conditions_statement(query.conditions) statement = "UPDATE #{quote_name(query.model.storage_name(name))}" statement << " SET #{properties.map { |property| "#{quote_name(property.field)} = ?" }.join(', ')}" statement << " WHERE #{conditions_statement}" unless conditions_statement.blank? return statement, bind_values end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update!(**args)\n @sql_expression = args[:sql_expression] if args.key?(:sql_expression)\n end", "def update!(**args)\n @sql_expression = args[:sql_expression] if args.key?(:sql_expression)\n end", "def update_where(table, what, where, *bindvars)\n sql = \"update #{table.n...
[ "0.64834064", "0.64834064", "0.6470476", "0.642931", "0.64075136", "0.6374777", "0.6367274", "0.6330752", "0.63002557", "0.626654", "0.62376714", "0.62376714", "0.6227346", "0.62005913", "0.61719", "0.61538166", "0.61538166", "0.6046042", "0.6034266", "0.59880096", "0.5980297...
0.7544324
0
Constructs DELETE statement for given query,
def delete_statement(query) conditions_statement, bind_values = conditions_statement(query.conditions) statement = "DELETE FROM #{quote_name(query.model.storage_name(name))}" statement << " WHERE #{conditions_statement}" unless conditions_statement.blank? return statement, bind_values end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete_query(query)\n do_delete_query(query)\n end", "def delete(table, where)\n sql = \"delete from #{table} #{where_clause(where)};\"\n execute sql\n end", "def delete_query(query, params = {})\n do_delete_query(query, params)\n end", "def delete_query(query=nil, options={})\n ...
[ "0.7087463", "0.6939915", "0.68764764", "0.6811165", "0.66586393", "0.66089845", "0.65925324", "0.65554893", "0.6544348", "0.6518879", "0.6513294", "0.6483571", "0.6404003", "0.6367086", "0.6346607", "0.63375366", "0.63338107", "0.63338107", "0.6322173", "0.6295357", "0.62953...
0.81732446
0
Constructs comma separated list of fields
def columns_statement(properties, qualify) properties.map { |property| property_to_column_name(property, qualify) }.join(', ') end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def format_fields(fields)\n if fields.instance_of?(Array)\n return fields.join(\",\")\n elsif fields.instance_of?(String)\n return fields\n end\n end", "def from_fields(input)\n input.map { |key, val| \"#{key}=#{val.inspect}\" }.join(', ')\n end", "def field_list(no_plac...
[ "0.7534873", "0.7335013", "0.6958882", "0.68035233", "0.67931074", "0.6744082", "0.66725826", "0.6564833", "0.65002793", "0.6422085", "0.64124835", "0.62586504", "0.62401575", "0.61910224", "0.6096022", "0.60756564", "0.6072797", "0.60610414", "0.60582155", "0.6037197", "0.60...
0.0
-1
given the name of an instruction, the address it's at, and a list of fields, generate a microcode word returns a two element array with the word and a text description of the contents
def gen_mc_word(instruction, addr, ins_fields, next_addr_override = nil) next_addr = nil; rptz_next_addr = nil; desc = ""; bits = 0 ins_fields.each do |ins_field| field_name, enum_name = ins_field.match(/([^\(]+)\(?([^\)]*)\)?/).captures if(field_name == "next_addr") then next if next_addr_override != nil if(enum_name == "ir") then desc = "next: ir #{desc}" next_addr = 0 next elsif(enum_name == "self") then desc = "next: self #{desc}" next_addr = addr next elsif(enum_name[0] == "-") nbr = enum_name[1..-1].to_i desc = "next: -#{nbr} #{desc}" next_addr = addr - nbr next elsif(enum_name[0] == "+") nbr = enum_name[1..-1].to_i desc = "next: +#{nbr} #{desc}" next_addr = addr + nbr next end loc_addr = @locations.find_index(enum_name) next_addr = loc_addr desc = "next: 0x#{loc_addr.to_s(16)}(#{enum_name}) #{desc}" next end if(field_name == "rptz_next_addr") then rptz_next_addr = @locations.find_index(enum_name) # rptz_next_addr can only jump within the same 16-instruction block if(rptz_next_addr.to_s(2)[0..-5] != next_addr.to_s(2)[0..-5]) then raise "RPTZ Next Addr can only jump within the same 16-instruction block, realignment required in instruction #{instruction} (#{rptz_next_addr.to_s(2)} vs #{next_addr.to_s(2)})" elsif(rptz_next_addr == next_addr) then raise("RPTZ Next Addr does not allow jumping to self in #{instruction}") end desc = "rptz_next: 0x#{rptz_next_addr.to_s(16)}(#{enum_name}) #{desc}" rptz_next_addr &= 0xF next end raise "Invalid field '#{field_name}' in instruction '#{instruction}'" if !@fields[field_name] # find out if there are enums for this field, and make sure they're valid and used if so raise "Enum expected for field '#{field_name}' in instruction #{instruction}" if @enums[field_name] and enum_name == "" raise "No enum expected for field #{field_name} in instruction #{instruction}" if enum_name != "" and !@enums[field_name] raise "Invalid enum '#{enum_name}' given for field '#{field_name}' in instruction #{instruction}" if enum_name != "" and !@enums[field_name][enum_name] # TODO: check that we don't overflow the length of the field # if no enum used, then specifying the field means we want it as a 1 bit_val = 1 bit_val = @enums[field_name][enum_name] if @enums[field_name] bits |= bit_val << @fields[field_name].begin desc += "#{field_name}(#{enum_name}) " if enum_name != "" desc += "#{field_name} " if enum_name == "" end if(next_addr_override) then next_addr = next_addr_override desc = "next: 0x#{next_addr_override.to_s(16)} #{desc}" else next_addr = addr + 1 if next_addr == nil end rptz_next_addr = 0 if !rptz_next_addr bits |= next_addr << @fields["next_addr"].begin bits |= rptz_next_addr << @fields["rptz_next_addr"].begin return [bits, desc] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def word_bytecode(word,image)\n case word\n when MFStringLit then\n inline_seq_header(HEADER_TYPES[:data],1,word.value.chars.to_a.length,image)\n image.concat word.value.chars.map{|c| \"'#{escape_c_char(c)}'\"}\n when Quotation then\n image << prim(:qstart)\n image << quo...
[ "0.59559715", "0.55604017", "0.552698", "0.52979946", "0.5257735", "0.5253277", "0.5250721", "0.52038765", "0.51917773", "0.5158921", "0.5145852", "0.51291525", "0.510946", "0.508367", "0.50749975", "0.50550663", "0.5042072", "0.5009299", "0.49965566", "0.49737394", "0.496435...
0.6112065
0
Provide a default URL as a default if there hasn't been a file uploaded:
def default_url # # For Rails 3.1+ asset pipeline compatibility: #asset_path([version_name, "default.png"].compact.join('_')) # [version_name, "logono.gif"].compact.join('_') end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def url_with_default *args\n unless file_name.nil?\n url_without_default *args\n else\n nil\n end\n end", "def default_url\n nil\n end", "def default_url\n end", "def default_url\n url 'default'\n end", "def default_url\n file_path = [\n 'fallbacks',\n ...
[ "0.788327", "0.77585304", "0.74635595", "0.7161452", "0.713886", "0.7078496", "0.69854933", "0.69454616", "0.6932205", "0.69272566", "0.6924041", "0.6924041", "0.6924041", "0.691804", "0.6916976", "0.690665", "0.6888884", "0.6869819", "0.68616575", "0.68318623", "0.67751837",...
0.6547985
38
Add a white list of extensions which are allowed to be uploaded. For images you might use something like this:
def extension_white_list %w(jpg jpeg gif png) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def extension_whitelist\n %w(jpg jpeg gif png)\n end", "def extension_whitelist\n %w[jpg jpeg gif png]\n end", "def extension_whitelist\n %w[jpg jpeg gif png]\n end", "def extension_whitelist\n %w[jpg jpeg gif png]\n end", "def extension_whitelist\n %w(jpg jpeg gif png)\n end", ...
[ "0.815735", "0.81485915", "0.81485915", "0.81485915", "0.81240284", "0.81240284", "0.81240284", "0.81240284", "0.81240284", "0.81240284", "0.81240284", "0.81240284", "0.81240284", "0.81240284", "0.81240284", "0.81240284", "0.81240284", "0.81230646", "0.8091994", "0.8091994", ...
0.7649628
86
2/ Smile specific : REWRITTEN Returns the additional blocks that are defined by plugin partials
def additional_blocks_with_time_report_query return @@additional_blocks if defined?(@@additional_blocks) @@additional_blocks = Dir.glob("#{Redmine::Plugin.directory}/*/app/views/my/blocks/_*.{rhtml,erb}").inject({}) do |h,file| name = File.basename(file).split('.').first.gsub(/^_/, '') ################ # Smile specific : partials overriden in plugin ignored unless ( # Query selection partials ignored : plugins overrides partial name.end_with?('_query_selection') || # Core blocks partials ignored : plugins overrides partial (name == 'issues') || CORE_BLOCKS.keys.include?(name) ) h[name] = {:label => name.to_sym, :partial => "my/blocks/#{name}"} else Rails.logger.debug "==>prof additional_blocks_with_time_report_query, overriden by plugin : #{name} partial" end h end Rails.logger.debug "==>prof additional_blocks_with_time_report_query #{@@additional_blocks}" @@additional_blocks end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_prepare_blocks; end", "def reapply_blocks\n @reapply_blocks ||= []\n end", "def anonymous_blocklists; end", "def view_layouts_base_body_bottom(context={})\n html = \"\"\n html << stylesheet_link_tag('htmlmacro.css', :plugin => 'redmine_html_macro')\n html << javascript_include_tag('ma...
[ "0.6499791", "0.5759432", "0.57176965", "0.57045317", "0.569257", "0.5644804", "0.56332964", "0.5603212", "0.55621254", "0.55621254", "0.5518809", "0.5518809", "0.5518809", "0.5518809", "0.55041707", "0.54888207", "0.5485641", "0.5454681", "0.54523855", "0.5419388", "0.539818...
0.6506574
0
GET /offers GET /offers.json
def index @offers = Offer.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @offers = Offer.all\n\n render json: @offers\n end", "def get_offers\n unless get_connection_object.headers.has_key?(\"X-Auth-Token\")\n raise \"Please authenticate() to see your offers\"\n end\n get('offer')\n end", "def index\n @offers = Offer.all\n\n respond...
[ "0.8171875", "0.7944721", "0.79157716", "0.79029083", "0.7764754", "0.76819086", "0.7671478", "0.7586528", "0.7481807", "0.7481807", "0.7466798", "0.74593174", "0.7443136", "0.7368404", "0.73248607", "0.7323364", "0.727816", "0.7111794", "0.70934635", "0.70629996", "0.7034231...
0.73937756
16
GET /offers/1 GET /offers/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @offers = Offer.all\n\n render json: @offers\n end", "def index\n @offers = Offer.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @offers }\n end\n end", "def index\n @offers = Offer.all\n respond_to do |format|\n form...
[ "0.7893452", "0.7734393", "0.76324385", "0.7481251", "0.7394545", "0.7394545", "0.73184246", "0.7309764", "0.72893107", "0.72650313", "0.7260039", "0.72340804", "0.7228739", "0.72237456", "0.71911067", "0.71911067", "0.71911067", "0.71911067", "0.71791774", "0.7166139", "0.70...
0.0
-1
POST /offers POST /offers.json
def create @offer = Offer.new(offer_params) respond_to do |format| if @offer.save format.html { redirect_to @offer, notice: 'Offer was successfully created.' } format.json { render :show, status: :created, location: @offer } else format.html { render :new } format.json { render json: @offer.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def offers \n @host.offers.create(offer_params) if request.post?\n @offers = @host.offers\n end", "def create\n @offer = Offer.new(offers_params)\n\n respond_to do |format|\n if @offer.save\n format.jsonapi { render jsonapi: @offer, status: :created }\n else\n format.jsona...
[ "0.77871877", "0.77477473", "0.7656886", "0.74715626", "0.73440135", "0.724452", "0.7134333", "0.7107879", "0.7107663", "0.70903563", "0.70714766", "0.704194", "0.69456", "0.68764096", "0.6863539", "0.6815171", "0.6815171", "0.6815171", "0.67943436", "0.6789791", "0.6784528",...
0.7178497
7
PATCH/PUT /offers/1 PATCH/PUT /offers/1.json
def update respond_to do |format| if @offer.update(offer_params) format.html { redirect_to @offer, notice: 'Offer was successfully updated.' } format.json { render :show, status: :ok, location: @offer } else format.html { render :edit } format.json { render json: @offer.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n respond_to do |format|\n if @offer.update(offers_params)\n format.jsonapi { render :show, status: :ok, location: @offer }\n else\n format.jsonapi { render jsonapi: @offer.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @offer = Offer.f...
[ "0.74339384", "0.7110587", "0.7080391", "0.7080391", "0.6979401", "0.69471204", "0.69373626", "0.6936734", "0.6856799", "0.6839258", "0.6719154", "0.669173", "0.6616138", "0.66114545", "0.6611033", "0.6597479", "0.6562729", "0.6559597", "0.6522435", "0.6494571", "0.6465132", ...
0.68097216
11
DELETE /offers/1 DELETE /offers/1.json
def destroy @offer.destroy respond_to do |format| format.html { redirect_to offers_url, notice: 'Offer was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @offer.destroy\n respond_to do |format|\n format.jsonapi { head :no_content }\n end\n end", "def destroy\n @offer.destroy\n respond_to do |format|\n format.jsonapi { head :no_content }\n end\n end", "def destroy\n @offer = Offer.find(params[:id])\n checkaccount...
[ "0.78265435", "0.78265435", "0.77179426", "0.7585767", "0.7585767", "0.753747", "0.753747", "0.7530682", "0.7455453", "0.74433076", "0.74234", "0.73523116", "0.73467505", "0.73374295", "0.7321798", "0.7311942", "0.7264411", "0.72176605", "0.72171134", "0.7195898", "0.71922493...
0.7332255
17
Use callbacks to share common setup or constraints between actions.
def set_offer @offer = Offer.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 offer_params params.require(:offer).permit(:available_from, :available_to, :available_limit, :discount_id, :coupon_id) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def allow_params_authentication!; end", "def allowed_params\n ALLOWED_PARAMS\n end", "def default_param_whitelist\n [\"mode\"]\n...
[ "0.69792545", "0.6781151", "0.67419964", "0.674013", "0.6734356", "0.6591046", "0.6502396", "0.6496313", "0.6480641", "0.6477825", "0.64565", "0.6438387", "0.63791263", "0.63740575", "0.6364131", "0.63192815", "0.62991166", "0.62978333", "0.6292148", "0.6290449", "0.6290076",...
0.0
-1
Test to see if the resource exists, returns true if it does, false if it does not. Here we simply monopolize the resource API, to execute a test to see if the database is connectable. When we return a state of `false` it triggers the create method where we can return an error message.
def exists? start_time = Time.now timeout = resource[:timeout] try_sleep = resource[:try_sleep] success = validator.attempt_connection while success == false && ((Time.now - start_time) < timeout) # It can take several seconds for an HTTP service to start up; # especially on the first install. Therefore, our first connection attempt # may fail. Here we have somewhat arbitrarily chosen to retry every 2 # seconds until the configurable timeout has expired. Puppet.notice("Failed to make an HTTP connection; sleeping #{try_sleep} seconds before retry") sleep try_sleep success = validator.attempt_connection end if success Puppet.debug("Connected to the host in #{Time.now - start_time} seconds.") else Puppet.notice("Failed to make an HTTP connection within timeout window of #{timeout} seconds; giving up.") end success end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def exist?\n @resource.exist?\n end", "def resource_exists?\n ciudades\n end", "def resource_exists?\n reload!\n @exists = true\n rescue Google::Cloud::NotFoundError\n @exists = false\n end", "def exists?\n start_time = Time.now\n timeout = resource[...
[ "0.7518702", "0.6923532", "0.68256617", "0.6815582", "0.67932105", "0.65993905", "0.65264285", "0.6515843", "0.64382684", "0.6390642", "0.6323923", "0.6319319", "0.631903", "0.631903", "0.631903", "0.6305856", "0.63030666", "0.6298201", "0.62872696", "0.6284635", "0.62811327"...
0.65875083
6
This method is called when the exists? method returns false.
def create # If `#create` is called, that means that `#exists?` returned false, which # means that the connection could not be established... so we need to # cause a failure here. raise Puppet::Error, "Unable to connect to the HTTP server! (#{@validator.test_uri.host}:#{@validator.test_uri.port} with HTTP code #{@validator.expected_code})" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def exists?\n false\n end", "def exists?\n false\n end", "def exists?; end", "def exists?()\n #This is a stub, used for indexing\n end", "def exists?\n\t\treturn false\n\tend", "def exist?\n nil\n end", "def exists?\n true\n end", "def exists!\n @exists = tr...
[ "0.81899315", "0.81899315", "0.8176006", "0.79248196", "0.791414", "0.78266245", "0.7666891", "0.76183444", "0.7612135", "0.7543587", "0.74987334", "0.7453703", "0.7406984", "0.7395722", "0.7393455", "0.73756063", "0.73695743", "0.7362365", "0.7362365", "0.7362365", "0.735950...
0.0
-1
Returns the existing validator, if one exists otherwise creates a new object from the class.
def validator @validator ||= PuppetX::PuppetCommunity::HttpValidator.new( resource[:name], resource[:host], resource[:port], resource[:use_ssl], resource[:test_url], resource[:expected_code], resource[:verify_peer] ) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_validator\n @validator = Managers::Validator.find(params[:id])\n end", "def get_validator(type)\n return Validators[type] if Validators.key?(type)\n method_name = type.to_s << '?'\n return self.method(method_name)\n end", "def validator(name, **options, &code)\n ...
[ "0.58212376", "0.57798725", "0.57737", "0.5736536", "0.5706617", "0.56655", "0.5653328", "0.5645537", "0.5620749", "0.56144994", "0.56061625", "0.5546209", "0.55194044", "0.5491938", "0.54916656", "0.54766315", "0.5388803", "0.53617007", "0.5307408", "0.5296242", "0.52924204"...
0.47300482
55
the orderRef (order) value sent to Paydollar
def item_id params['Ref'] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pay_ref\n params['PayRef']\n end", "def bank_reference\r\n params['Ord']\r\n end", "def order\n params[\"RefNo\"]\n end", "def add_order(post, options={})\n validate! options, :our_ref\n post[:OrderId] = options[:our_ref]\n end", "def o...
[ "0.69250345", "0.6797262", "0.67300224", "0.66520524", "0.6399625", "0.6277538", "0.6241084", "0.62083507", "0.61890984", "0.6134876", "0.6112129", "0.611141", "0.60906523", "0.6087044", "0.6048065", "0.6041245", "0.5899691", "0.5838296", "0.581176", "0.57736003", "0.5756361"...
0.0
-1
the payment reference number generated by Paydollar
def transaction_id params['PayRef'] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pay_ref\n params['PayRef']\n end", "def transaction_id\n params['PNREF']\n end", "def polish_taxpayer_identification_number; end", "def credit_card_number; end", "def reference_credit_note\n object.credit_note_ref.to_s\n end", "def paybox_transaction_number...
[ "0.74056315", "0.7042171", "0.7038679", "0.68793935", "0.680711", "0.66081375", "0.6570525", "0.6498554", "0.64806306", "0.63812774", "0.6336982", "0.6326495", "0.6263594", "0.62291706", "0.62227124", "0.6221865", "0.61987406", "0.61785376", "0.61496663", "0.6142993", "0.6099...
0.6906879
3
When was this payment received by the client.
def received_at params['TxTime'] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def received_at\n request_datetime\n end", "def received_date_time\n return @received_date_time\n end", "def received_date_time\n return @received_date_time\n end", "def received_at\n params['_raw_orderCreatedDatetime']\n end...
[ "0.7477951", "0.7458964", "0.7458964", "0.73005956", "0.72560185", "0.7117314", "0.6927185", "0.6680007", "0.6673697", "0.6664138", "0.6660423", "0.6618419", "0.66141844", "0.6606248", "0.6606248", "0.6585226", "0.65120727", "0.6498135", "0.6394116", "0.6291404", "0.62894064"...
0.695467
6
the money amount we received in X.2 decimal.
def gross params['Amt'] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def amount\n\n @amount_bigdecimal.to_f.round(2)\n\n end", "def to_money amount\n\t\t\tamount.to_f.round(2) rescue 0.0\n\t\tend", "def net_amount\n ((transaction_value - 0.2) / 1.034).floor_with_two_decimal_places\n end", "def money\n Money.from_amount(amount.to_f)\n end", "def real_amount()...
[ "0.7892483", "0.7726781", "0.7675196", "0.74354327", "0.74190515", "0.72904646", "0.7234745", "0.7206801", "0.7206801", "0.7172812", "0.70087874", "0.6990968", "0.69473934", "0.6922877", "0.69112027", "0.6905546", "0.68354803", "0.68313223", "0.6821918", "0.6809633", "0.68018...
0.0
-1
the primary response code
def primary_response_code params['prc'] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def response_code; end", "def response_code; end", "def response_code; end", "def response_code; end", "def response_code\n @response.code\n end", "def code\n @response.code\n end", "def code\n response&.code\n end", "def status_code\n @response.status\n end", ...
[ "0.866097", "0.866097", "0.866097", "0.866097", "0.84234655", "0.82850677", "0.8230671", "0.8225507", "0.8183196", "0.8165604", "0.8165604", "0.8142274", "0.8132753", "0.80682844", "0.80117726", "0.80034536", "0.7908554", "0.7797087", "0.7713228", "0.7683259", "0.7677975", ...
0.7465416
28
the secondary response code
def secondary_response_code params['src'] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def response_code; end", "def response_code; end", "def response_code; end", "def response_code; end", "def response_code\n @response.code\n end", "def code\n response&.code\n end", "def status_code; end", "def code\n @response.code\n end", "def code\n @response...
[ "0.8194845", "0.8194845", "0.8194845", "0.8194845", "0.77007675", "0.76052326", "0.75189567", "0.7492563", "0.74079174", "0.74079174", "0.7391604", "0.7372789", "0.73455006", "0.7308143", "0.729737", "0.72189295", "0.72181624", "0.7174808", "0.7164362", "0.7158494", "0.711427...
0.77144367
4
the bank reference number
def bank_reference params['Ord'] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reference_credit_note\n object.credit_note_ref.to_s\n end", "def ref_number\n batch = check.batch\n facility_name = facility.name.upcase\n if (facility_name == 'AHN' || facility_name == 'SUBURBAN HEALTH' ||\n facility_name == 'UWL' || facility_name == 'ANTHEM')\n file_number = batc...
[ "0.68831307", "0.6815639", "0.67729145", "0.67304707", "0.6666966", "0.6618702", "0.66143155", "0.66061354", "0.6578303", "0.657355", "0.6558529", "0.6478471", "0.6463188", "0.64008415", "0.6355345", "0.6349116", "0.63408583", "0.6329413", "0.63145447", "0.63117284", "0.62859...
0.74870384
0
the card/account holder name
def holder_name params['Holder'] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def account_card_title\n name_too_long ? name[0..Account::DISPLAY_NAME_LIMIT] + '...' : name\n end", "def account_name\n return @account_name\n end", "def account_name\n return @account_name\n end", "def acct_name\n @name\n end", "def card_f...
[ "0.7573408", "0.7074646", "0.7074646", "0.7053638", "0.70450157", "0.7011078", "0.6937637", "0.68826145", "0.68289626", "0.67731225", "0.6733641", "0.6691311", "0.6657829", "0.66549283", "0.6632512", "0.6625688", "0.66255623", "0.661458", "0.6602401", "0.6598074", "0.6590703"...
0.7095098
1
the description sent to Paydollar via the remark field
def description params['remark'] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remark\n I18n.t(\n \"bets.remarks.#{status}\", match: match.title, market: market_title,\n amount: @amount\n )\n end", "def description; @text; end", "def remarks\n self.dig_for_array(\"remarks\")\n end", "def set_remark(text)\n @remark = text\n...
[ "0.74128276", "0.7010169", "0.7007329", "0.6882351", "0.6860016", "0.6839088", "0.67760044", "0.67699045", "0.6712544", "0.66296124", "0.66099", "0.6602793", "0.6554882", "0.653898", "0.6537595", "0.6537595", "0.6535534", "0.6534041", "0.6534041", "0.6512258", "0.6491338", ...
0.77182806
0
the eci value for credit card transactions
def eci_value params['eci'] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def eci\n params['eci']\n end", "def currency_code\n h.e_system_currency\n end", "def ot_currency_code\n end", "def credit_card_number; end", "def transaction_currency_code\n hash[\"TransactionCurrencyCode\"]\n end", "def value\r\r\n @currency[:amount]\r\...
[ "0.72413784", "0.62871647", "0.6200239", "0.61605453", "0.6100607", "0.60865986", "0.60819024", "0.6067302", "0.6043518", "0.6024255", "0.59825903", "0.59814596", "0.59484637", "0.5893751", "0.5877582", "0.58636904", "0.58515984", "0.5849818", "0.57909083", "0.57871854", "0.5...
0.75269705
0
the payer authentication status
def payer_auth_status params['payerAuth'] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def authok?\n @authok\n end", "def authok?\n @authok\n end", "def authok?\n @authok\n end", "def authok?\n @authok\n end", "def buyer_auth_result\n params['3DSecureStatus']\n end", "def payer_auth\n params['payerAuth']\n end", "def...
[ "0.7088479", "0.7088479", "0.7088479", "0.7088479", "0.70209163", "0.6961816", "0.67904633", "0.67793816", "0.67793816", "0.67793816", "0.6771945", "0.67558867", "0.6719673", "0.6687326", "0.66116416", "0.66116416", "0.6570754", "0.6522444", "0.63876265", "0.6362352", "0.6337...
0.8294233
0
the card issuing country
def card_issuing_country params['cardIssuingCountry'] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def country\n 'United Kingdom'\n end", "def country\n self[:C]\n end", "def country_code; end", "def country_code; end", "def country_code\n cc = carmen_country\n\n cc ? \"#{cc.code.upcase}\" : nil\n end", "def country_code\n end", "def represented_country; end", "def coun...
[ "0.79909855", "0.79168046", "0.7773504", "0.7773504", "0.7755279", "0.77544767", "0.77441394", "0.76728433", "0.765663", "0.75585276", "0.75512516", "0.7520707", "0.74811757", "0.74811757", "0.74811757", "0.74763286", "0.745356", "0.7442385", "0.74314433", "0.7422565", "0.741...
0.78145117
2
the PAN first 4 digits
def pan_first4 params['panFirst4'] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def card_number_mask\n \"XXX XXXX XXX #{last4}\"\n end", "def get_telephone\n area_code = @rand.rand(1000).to_s.rjust(3, '0')\n last_four_digits = @rand.rand(10000).to_s.rjust(4, '0')\n \"(\" + area_code + \") 555-\" + last_four_digits\n end", "def area_code\n number[0..2]\n end", "d...
[ "0.6508212", "0.6146855", "0.6146409", "0.6099243", "0.6047017", "0.5960994", "0.5900333", "0.5837181", "0.5803082", "0.5798505", "0.5779119", "0.5761087", "0.5761087", "0.5761087", "0.5756039", "0.57228935", "0.57216054", "0.57178384", "0.5699352", "0.56949997", "0.5689041",...
0.63296384
1
the PAN last 4 digits
def pan_last4 params['panLast4'] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def card_number_mask\n \"XXX XXXX XXX #{last4}\"\n end", "def last_four\n card_number.slice(-4,4)\n end", "def card_number_last_four_digits\n hash[\"CardNumberLastFourDigits\"]\n end", "def credit_card_last_4_digits\n params['Last4Digits']\n end", "def area_code\...
[ "0.6811904", "0.66464865", "0.6497532", "0.6412759", "0.6182001", "0.613591", "0.6106006", "0.6063582", "0.60292286", "0.595982", "0.58894986", "0.58773607", "0.5837218", "0.58273375", "0.5815619", "0.58056074", "0.58056074", "0.58056074", "0.57984114", "0.5745248", "0.574295...
0.6376235
4
the PAN last 4 digits
def secure_hash params['secureHash'] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def card_number_mask\n \"XXX XXXX XXX #{last4}\"\n end", "def last_four\n card_number.slice(-4,4)\n end", "def card_number_last_four_digits\n hash[\"CardNumberLastFourDigits\"]\n end", "def credit_card_last_4_digits\n params['Last4Digits']\n end", "def pan_last4\...
[ "0.6811904", "0.66464865", "0.6497532", "0.6412759", "0.6376235", "0.6182001", "0.613591", "0.6106006", "0.6063582", "0.60292286", "0.595982", "0.58894986", "0.58773607", "0.5837218", "0.58273375", "0.5815619", "0.58056074", "0.58056074", "0.58056074", "0.57984114", "0.574524...
0.0
-1
Take the posted data and move the relevant data into a hash
def parse(post) @raw = post.to_s for line in @raw.split('&') key, value = *line.scan( %r{^([A-Za-z0-9_.-]+)\=(.*)$} ).flatten params[key] = CGI.unescape(value.to_s) if key.present? end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def map_input_data(hash)\n hash\n end", "def prepare_data(data)\n d = {}\n data.each do |key, val|\n case key.to_s\n when /^<(.*?)>(.*)$/\n d[\"#{$1}#{$2}\"] = val\n when /^\\w/\n d[\"##{key}\"] = val\n else\n d[key.to_s] = val\n end...
[ "0.6129246", "0.60565877", "0.5941875", "0.59048563", "0.5894289", "0.58379674", "0.58175665", "0.579716", "0.57822824", "0.5776555", "0.57565945", "0.573793", "0.57162327", "0.5700307", "0.5684137", "0.5673046", "0.56681484", "0.5661724", "0.5654561", "0.5648143", "0.5624488...
0.0
-1
Defines a new scenario scenario('Do something') do uses SomeSteps step 'Do this' step 'Do that' end
def scenario(description, &block) @scenarios ||= [] # instantiate scenario scenario = Scenario.new( script: self, context: context, description: description, run_result: run_result ) # run the DSL scenario.instance_eval(&block) # add to our collection of scenarios @scenarios << scenario end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def scenario(scenario_name, &block)\n @scenarios[scenario_name] = Scenario.new(@_method_name, &block)\n end", "def before_scenario(*steps, &block)\n before_scenario_steps.append(*steps) unless steps.empty?\n before_scenario_steps.append(block) if block_given?\n end", "def setup(step_name, ...
[ "0.6878845", "0.6832487", "0.6787737", "0.6659345", "0.66186994", "0.66186994", "0.64906764", "0.64221025", "0.6411034", "0.6403056", "0.6379032", "0.63583446", "0.6339911", "0.6331138", "0.63130397", "0.6293068", "0.6229016", "0.61560476", "0.6126138", "0.6118554", "0.610557...
0.67536104
3
Performs authentication for mobile users. Here we take the password that the user entered and compare it against the decrypted database password (provided we get a hit on the database for the username). If the comparison is successful then we package all the user information up into an XML structure and send it back to the caller. If the comparison fails then we simply send back an empty XML aggregate.
def mobile_login(email, password) user = authenticate(email, password) xml = "<user>" if user mobile_token = MobileToken.new mobile_token.user_id = user.id mobile_token.token = Digest::SHA2.hexdigest(user.id.to_s + Time.now().to_s) mobile_token.save xml += generate_mobile_xml(user, mobile_token) end xml += "</user>" xml end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def login\n @user = ::Accounts::Account.find_for_database_authentication(mobile: \n params.require(:data).require(:mobile))\n\n if @user && @user.valid_password?(\n params.require(:data).require(:password))\n sign_in(@user)\n # @user.reset_authentication_token! # make sure the user has a...
[ "0.6638051", "0.6402791", "0.635038", "0.6333801", "0.63194704", "0.62193483", "0.6208028", "0.6192527", "0.61769", "0.6167274", "0.6165264", "0.6159216", "0.6150725", "0.61424077", "0.6124884", "0.6103897", "0.60937905", "0.60915637", "0.60878456", "0.6083508", "0.60766", ...
0.703194
0
Attempts to log out a mobile user by deleting their token from the database. def mobile_logout(token) mobile_token = MobileToken.find_by_token(token) if mobile_token mobile_token.delete end end
def generate_mobile_xml(user, mobile_token) xml = "<id>#{ user.id }</id>" xml += "<firstname>#{ user.first_name }</firstname>" xml += "<lastname>#{ user.last_name }</lastname>" xml += "<gender>#{ user.gender }</gender>" xml += "<email>#{ user.email }</email>" xml += "<dob>#{ user.dob }</dob>" xml += "<city>#{ user.city }</city>" xml += "<state>#{ user.state }</state>" xml += "<token>#{ mobile_token.token }</token>" logger.debug("Generated mobile xml of #{ xml }") xml end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def logout_device(device_token)\n\t\t\tdevice = MobileDevice.find_by_token(device_token)\n\t\t\tdevice.update_attributes!({ logged_in: false })\n\t\tend", "def log_out\n message = ''\n auth_token = params[:token]\n if auth_token.include?(':')\n user_id = auth_token.split(':').first\n user = Us...
[ "0.78865963", "0.7629406", "0.7420316", "0.7304675", "0.7295713", "0.7261484", "0.7111401", "0.7100462", "0.70658255", "0.7059846", "0.6990615", "0.6990615", "0.6969148", "0.6963098", "0.69614923", "0.6951125", "0.69169754", "0.6899877", "0.6859484", "0.6857394", "0.68416667"...
0.0
-1
End of static methods
def fetch_non_favorite_bar_events() events = Hash.new temp = Bar.find(:all, :select => 'bars.name, bar_events.detail', :joins => :bar_event, :conditions => ['bars.id not in (select bar_id from favorites where user_id = ?) and verified = 1', [self.id] ]) for t in temp do if events.key?(t.name) events[t.name] << t.detail else events[t.name] = [t.detail] end end events end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def private; end", "def internal; end", "def methods; end", "def methods; end", "def methods; end", "def methods; end", "def methods() end", "def probers; end", "def final; end", "def implementation; end", "def implementation; end", "def schubert; end", "def private_method\n end", "d...
[ "0.8102231", "0.7061251", "0.69598544", "0.69598544", "0.69598544", "0.69598544", "0.694681", "0.6889969", "0.6818959", "0.67715424", "0.67715424", "0.6653852", "0.6605305", "0.6559627", "0.65353566", "0.65353566", "0.6508361", "0.6508361", "0.6508361", "0.6508361", "0.647555...
0.0
-1
password is a virtual attribute
def password=(password) @password = password if password.present? generate_salt self.hashed_password = self.class.encrypt_password(password, salt) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def password\n \t\t return password_virtual_attr\n end", "def password\n\t\tPassword.new( attribute_get(:password) )\n\tend", "def password\n @attributes[:password]\n end", "def password\n @attributes[:password]\n end", "def password_field; end", "def password\n super\n end", ...
[ "0.90575004", "0.8366685", "0.82089376", "0.82089376", "0.8136895", "0.8126847", "0.8125252", "0.8111407", "0.8111407", "0.8111407", "0.8111407", "0.8111407", "0.8111407", "0.8110578", "0.8077016", "0.8075071", "0.805824", "0.80493104", "0.8045858", "0.8045858", "0.8045858", ...
0.0
-1
Add a single file to the pack
def addFile(src, dest=nil) orig = dest dest = File.join(@defaultPath, File.basename(src)) if !dest @files[src] = dest end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_file file\n if not File.file? file\n raise ArgumentError\n else\n @files.push file\n puts \"#{File.basename file} added to package #{@name}\" if @verbose\n end\n end", "def add_file (file)\n @files[file.path] = file\n end", "def add_file (file)\n ...
[ "0.7696228", "0.7184664", "0.71381664", "0.69576955", "0.69509625", "0.6899685", "0.6862512", "0.6856229", "0.68265647", "0.67862403", "0.67642766", "0.6681994", "0.6585522", "0.6576857", "0.6534333", "0.6521629", "0.65139246", "0.6504083", "0.6504083", "0.6503448", "0.650129...
0.58793694
74
collect the XML representation for the pack using an XMLMarkup object
def emitIzPackXML(xm) # raise "xm must be an Builder::XmlMarkup object, but is #{xm.class}" if xm.class != Builder::XmlMarkup xm.pack(@attributes) { xm.description(@description) @files.each{ |src, dest| xm.singlefile('src'=> src, 'target' =>dest) } } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def xml; end", "def render_xml\n @xml = Builder::XmlMarkup.new\n @xml.gauge do\n @xml.license( @license ) unless @license.nil?\n render_extra_components \n render_components\n end\n @xml.to_s.gsub( /<to_s\\/>/, '' ) \n end", "def to_xm...
[ "0.6798426", "0.6571042", "0.64597476", "0.63559526", "0.6348788", "0.62905777", "0.6277738", "0.6241334", "0.6241029", "0.62032837", "0.61509144", "0.61509144", "0.61509144", "0.61509144", "0.61509144", "0.61509144", "0.61453533", "0.61453533", "0.6104607", "0.61028904", "0....
0.6686109
1
The ArchiveTask class delegates this method so we can create the archive. the file_map is the result of the computations of the include and exclude filters.
def create_from(file_map) @izpackVersion ||= '4.3.5' @appName ||= project.id @izpackBaseDir = File.dirname(@output) if !@izpackBaseDir @installerType ||= 'standard' @inheritAll ||= 'true' @compression ||= 'deflate' @compressionLevel ||= '9' @locales ||= ['eng'] @panels ||= ['TargetPanel', 'InstallPanel'] @packs ||= raise "You must include at least one file to create an izPack installer" if file_map.size == 0 and !File.exists?(@input) izPackArtifact = Buildr.artifact( "org.codehaus.izpack:izpack-standalone-compiler:jar:#{@izpackVersion}") doc = nil if !File.exists?(@input) genInstaller(Builder::XmlMarkup.new(:target=>File.open(@input, 'w+'), :indent => 2), file_map) # genInstaller(Builder::XmlMarkup.new(:target=>$stdout, :indent => 2), file_map) # genInstaller(Builder::XmlMarkup.new(:target=>File.open('/home/niklaus/tmp2.xml', 'w+'), :indent => 2), file_map) end Buildr.ant('izpack-ant') do |x| izPackArtifact.invoke msg = "Generating izpack aus #{File.expand_path(@input)}" trace msg if properties properties.each{ |name, value| puts "Need added property #{name} with value #{value}" x.property(:name => name, :value => value) } end x.echo(:message =>msg) x.taskdef :name=>'izpack', :classname=>'com.izforge.izpack.ant.IzPackTask', :classpath=>izPackArtifact.to_s x.izpack :input=> @input, :output => @output, :basedir => @izpackBaseDir, :installerType=> @installerType, :inheritAll=> @inheritAll, :compression => @compression, :compressionLevel => @compressionLevel do end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def build\n entries = Dir.entries(@input_dir)\n entries.delete_if {|e| @exclude.include?(e)}\n FileUtils.rm_f(@output_file) # Make sure file doesn't exist\n ::Zip::File.open(@output_file, ::Zip::File::CREATE) do |zipfile|\n write_entries entries, '', zipfile\n end\n end", "def ...
[ "0.6196129", "0.5955121", "0.5703889", "0.5585267", "0.55840296", "0.552532", "0.55179995", "0.54706115", "0.53400856", "0.5332515", "0.53203374", "0.5317186", "0.5309138", "0.52895355", "0.5263104", "0.5237083", "0.52360165", "0.5194238", "0.5189375", "0.517976", "0.5173471"...
0.5346515
8
Renders the assignment types partial view.
def assignment_types @course = Course.find(params[:id]) respond_to do |format| format.json end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @type_of_assignments = TypeOfAssignment.all\n end", "def new\n\t\t@assignment = Assignment.new\n\t\t@assignment_types = @course.assignment_types\n\n\t\trespond_to do |format|\n\t\t\tformat.html # new.html.erb\n\t\t\tformat.json { render json: @assignment }\n\t\tend\n\tend", "def show\n #...
[ "0.64509195", "0.565831", "0.56420684", "0.545015", "0.54162914", "0.54088235", "0.5398073", "0.5397676", "0.53725666", "0.5369579", "0.5357744", "0.5310843", "0.52847564", "0.526827", "0.525492", "0.52489835", "0.52413183", "0.5229563", "0.5210391", "0.5195914", "0.5192779",...
0.60494226
1
Renders the assignments partial view.
def assignments @course = Course.find(params[:id]) respond_to do |format| format.json end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n render json: { assignments: [ @assignment.as_json ] }\n end", "def forassignment\n @meetings = Meeting.needing_assignments params[:club_id]\n render :layout => 'admins' \n end", "def show\n\t\t@assignment = Assignment.find(params[:id])\n\tend", "def show\n\t\t@disabled\t= @course.d...
[ "0.68457276", "0.6805403", "0.6272993", "0.61631405", "0.6145284", "0.61032706", "0.61032706", "0.61032706", "0.61032706", "0.59910196", "0.59855074", "0.59730947", "0.5972317", "0.5968352", "0.5964073", "0.5949186", "0.5944346", "0.5940816", "0.59055865", "0.59055865", "0.59...
0.5901199
21
Renders the course partial view.
def course @course = Course.find(params[:id]) respond_to do |format| format.json end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n\t\t@course = Course.find(params[:course_id])\n\t\trespond_to do |format|\n\t\t\tformat.html\n\t\tend\n\tend", "def describe_course\r\n course = Course.find(params[:c]) rescue nil \r\n render_return if !logged_in_user or !course or !logged_in_user.see_course?(course)\r\n r...
[ "0.6997058", "0.69522506", "0.687269", "0.68243533", "0.6797706", "0.6730414", "0.66466665", "0.64830744", "0.6467955", "0.64656806", "0.64257014", "0.64198357", "0.6313833", "0.6291369", "0.62616605", "0.62519234", "0.62519234", "0.6246492", "0.6240691", "0.6221128", "0.6188...
0.6062913
33
verify if the array of the parameters is valid
def verify_search_arguments(options) if options.nil? || options.empty? return ARGUMENT_ERROR end if options[:org].nil? return ARGUMENT_NOT_VALID end if options[:obj_name].nil? || options[:obj_id].nil? return ARGUMENT_NOT_VALID end if !options[:obj_id].nil? && (@obj = MetaData.active.find(options[:obj_id])).nil? return OBJ_NOT_FOUND elsif !options[:obj_name].nil? && (@obj = MetaData.active.by_name(options[:org], options[:obj_name])).nil? return OBJ_NOT_FOUND end if (@fields = MetaDataField.all_fields.by_id(@obj.obj_id)).nil? return FIELD_NOT_FOUND end return OK end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def validate_params\n if command == 'PLACE'\n if params.kind_of?(Array)\n errors[:params] << '[PLACE] Must be three params' unless params.size == 3\n validate_coords\n validate_direction\n else\n errors[:params] << '[PLACE] Not valid params'\n end\n ...
[ "0.73596287", "0.72649884", "0.72649884", "0.72181267", "0.71743935", "0.71732825", "0.71615124", "0.71610373", "0.71609265", "0.7152663", "0.71266115", "0.7123797", "0.7115323", "0.7103153", "0.71029353", "0.70925134", "0.70831484", "0.70525295", "0.7042686", "0.70413375", "...
0.0
-1
generate sql to get the object
def generate_sql sql = 'guid, obj_id' @fields.each do |field| sql << ',v' sql << field.num.to_s sql << ' as ' sql << field.name end return sql end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sql_string\n self\n end", "def sql\n @context.sql\n end", "def inspect\n \"#<#{self.class.name}: #{sql.inspect}>\"\n end", "def orm; end", "def inspect\n \"#<#{self.class}: #{sql.inspect}>\"\n end", "def sql\n @sql ||= begin\n bind_param...
[ "0.7057635", "0.69791365", "0.6854589", "0.6761046", "0.67121863", "0.6706179", "0.6706179", "0.6685739", "0.6645993", "0.65933394", "0.65788364", "0.6420503", "0.64060456", "0.638308", "0.63705254", "0.63705254", "0.6342647", "0.6327013", "0.63181853", "0.6291547", "0.623174...
0.74031425
0
Call the function tag on all objects in the tree of children, if they respond to the object. Then add these to the array of results
def retrieve_all_tags(element, tag = :content) result = [] if(element.respond_to? tag) result << element.send(tag) end if element.respond_to? :children element.children.each do |child| result += retrieve_all_tags(child, tag) end end return result end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def process_tree(tags, property, content, itemprop: nil, **opts)\n method = case content\n when Hash\n :process_hash\n when Array\n :process_array\n else\n iprop = itemprop\n :render_tag\n end\n __send__(method, tags, property, content, itemprop: iprop, **o...
[ "0.61541533", "0.60818696", "0.6081371", "0.60235125", "0.6010992", "0.5933437", "0.5835709", "0.5786577", "0.57772857", "0.57292074", "0.572624", "0.5674065", "0.56413865", "0.56246305", "0.56219715", "0.56191987", "0.5614662", "0.5571699", "0.5568134", "0.55548793", "0.5548...
0.6446864
0
input: string of items separated by spaces (example: "carrots apples cereal pizza") steps: declare an empty hash break apart given string add each item to the hash set default quantity print the list to the console [can you use one of your other methods here?] output: [what data type goes here, array or hash?]
def shopping_list(user_input) grocery_list = {} list = user_input.split(" ") list.each do |item| grocery_list[item] = 1 end p grocery_list end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def createlist(str)\r\n# steps:\r\n# break the string into an array\r\n items = str.split\r\n item_list = {}\r\n\r\n\t# iterate through array and build hash\r\n items.each do |item|\r\n\r\n\t\t# iterate through array and build hash\r\n\t\t# set default quantity to 1\r\n \titem_list[item] = 1\r\n e...
[ "0.77693856", "0.7635838", "0.75477976", "0.7238942", "0.7212598", "0.7140138", "0.712054", "0.6999461", "0.696055", "0.6950762", "0.69277084", "0.6922574", "0.69103825", "0.6909962", "0.68977016", "0.6890946", "0.68669266", "0.68424845", "0.6840372", "0.68109006", "0.6778909...
0.6216189
81
Method to add an item to a list input: item name and optional quantity steps: get string get quantity add string to hash output: output updated hash
def add_item(grocery_list, new_item, new_quant=1) grocery_list[new_item] = new_quant p grocery_list end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_item(list_name, item, quantity=1)\r\n# input: list, item name, and optional quantity\r\n# steps: add item and its quantity to the hash\r\n list_name.store(item, quantity)\r\n# output: hash with new item\r\n p list_name\r\nend", "def add_item(list, add_item, add_quantity=1)\n# steps:\n # Add item as ke...
[ "0.8598926", "0.84444773", "0.83593905", "0.8204692", "0.81023645", "0.81023645", "0.8099763", "0.80251914", "0.80251247", "0.80251247", "0.7999168", "0.7987689", "0.79424363", "0.7941065", "0.79146606", "0.78928214", "0.78874487", "0.78697467", "0.7859075", "0.7857964", "0.7...
0.0
-1
Method to remove an item from the list input: whatever item to be removed steps: delete the item and quantity output: updated hash
def remove_item(grocery_list, rem_item) grocery_list.delete(rem_item) p grocery_list end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove_item(input_hash, item)\n# input: list, item name, and optional quantity\n# steps: use input item to delete key\n input_hash.delete(item)\n# output: hash data structure of key/value pairs\nreturn input_hash\nend", "def remove_item(item_to_remove)\n $list_hash.delete_if{|current_item, quantity|item_to...
[ "0.8566312", "0.82889336", "0.809296", "0.79017544", "0.77964044", "0.7785669", "0.7751077", "0.7748775", "0.7721867", "0.77004635", "0.7697788", "0.7600119", "0.7596979", "0.75825804", "0.75803965", "0.75757945", "0.75757945", "0.74983066", "0.74977446", "0.74957454", "0.748...
0.0
-1
Method to update the quantity of an item input: item to updated, and new quantity steps: select the item in the hash and assign new value output: updated hash
def new_quantity(grocery_list, item, new_quan) grocery_list[item] = new_quan p grocery_list end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_item_quantity(hash_of_items, item, quantity)\n hash_of_items[item] = quantity\n hash_of_items\nend", "def update_quantity(hash, item, quantity)\n\thash[item] = quantity\n\treturn hash\nend", "def update_quantity (item, quantity)\n item_hash[item] = quantity\nend", "def update_item_quantity(hash...
[ "0.8457938", "0.8309848", "0.8240743", "0.8238489", "0.8201234", "0.8200625", "0.81670004", "0.8100379", "0.8049133", "0.8034033", "0.8008113", "0.79529476", "0.7915534", "0.7915534", "0.79100585", "0.787543", "0.7844897", "0.782312", "0.7767047", "0.77519137", "0.77396363", ...
0.0
-1
Method to print a list and make it look pretty input: existing hash steps: print a string containing eash item in hash output: Pretty list
def print_list(grocery_list) puts "Here is your grocery list: " puts grocery_list.each { |x, y| puts "#{x}: #{y}" } puts "Have a wonderful shopping day!" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pretty_list(list)\n puts \"Grocery List:\"\n list.each do |key, value|\n puts \"#{value} #{key}(s)\"\n end\n \nend", "def pretty_list(list)\n\tlist.each do |item, quantity|\n\t\tputs \"There are #{quantity} #{item} on the grocery list.\"\n\tend\nend", "def print_list(list_name)\r\n# input: hash name\r\n#...
[ "0.77163833", "0.7696395", "0.7682835", "0.76466227", "0.76223963", "0.75836027", "0.7579596", "0.75540155", "0.75518954", "0.7530299", "0.75224084", "0.75105584", "0.750468", "0.7471241", "0.7458772", "0.7458772", "0.74177456", "0.7381975", "0.7354331", "0.73105973", "0.7269...
0.0
-1
parse the info delivered by package manager save in json
def software_parser(file_name) software = Hash.new # read the file list = Hash.new File.open(file_name).each do |line| if (line.to_s.start_with? "ii") tmp = line.split("\s") str = "" for i in 3..(tmp.length-1) do str += tmp[i] str += " " end key = tmp[1] value = Hash["version" => tmp[2], "description" => str] list[key] = value end end software[:software] = list File.open("#{file_name}.json","w") do |f| f << JSON.pretty_generate(software) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read_package_info\n PackageInfo.load((@location + \"pione-package.json\").read)\n rescue Location::NotFound\n raise InvalidPackage.new(self, \"pione-package.json not found in %s\" % @location.uri)\n end", "def package_information\n puts\n puts \"%30s%s\" % [\"Plugin info...
[ "0.65316767", "0.64911926", "0.6388142", "0.6238443", "0.62258446", "0.61981624", "0.6067711", "0.59126264", "0.59017044", "0.58140796", "0.5807881", "0.56939065", "0.56423825", "0.56314737", "0.5602791", "0.5602191", "0.5600063", "0.55934143", "0.55851215", "0.55848455", "0....
0.5533238
25
Use callbacks to share common setup or constraints between actions.
def set_event @event = Event.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
Only allow a trusted parameter "white list" through.
def event_params params.require(:attributes).permit(:name, :short_description, :description, :image_url, :external_url, :longitude, :latitude, :active, :css_style_id, :order) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def allowed_params\n ALLOWED_PARAMS\n end", "def expected_permitted_parameter_names; end", "def param_whitelist\n [:role, :title]\n end", "def default_param_whitelist\n [\"mode\"]\n end", "def permitir_parametros\n \t\tparams.permit!\n \tend", "def permitted_params\n []\n end", ...
[ "0.7121987", "0.70541996", "0.69483954", "0.6902367", "0.6733912", "0.6717838", "0.6687021", "0.6676254", "0.66612333", "0.6555296", "0.6527056", "0.6456324", "0.6450841", "0.6450127", "0.6447226", "0.6434961", "0.64121825", "0.64121825", "0.63913447", "0.63804525", "0.638045...
0.0
-1
TBD richiedi che appartenga...
def to_s ulterior = name ? ": #{name}" : '' name || "#{person_id} did a #{duration}' #{activity}" + ulterior end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def suivre; end", "def zuruecksetzen()\n end", "def probers; end", "def private; end", "def schubert; end", "def verdi; end", "def terpene; end", "def specie; end", "def specie; end", "def specie; end", "def specie; end", "def mi_carrera\n\n\tend", "def eplore\n end", "def villian; end"...
[ "0.7596256", "0.70228434", "0.67818874", "0.6773903", "0.6652402", "0.65246433", "0.6492706", "0.64238787", "0.64238787", "0.64238787", "0.64238787", "0.64125484", "0.63399315", "0.6230348", "0.6146825", "0.61325526", "0.60683423", "0.5984401", "0.5975963", "0.59580094", "0.5...
0.0
-1
per ora lo calcolo cosi
def auto_calories cals_per_hour = $calories_per_hour.fetch(activity,42) cals_per_hour end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def calculo \n self.minutos_reales = 5 * 480 #cantidad de OPERARIOS * Jornada de Trabajo(Turnos)\n self.costo_minuto = 89 #Costo Real por minuto\n self.otros_costos = 540 * 89 #Tiempo Total(Minutos) * Costo Real por Minutos\n self.costo_mano_obra = 420 * 5 * 89 # Jornada Minutos * Canti...
[ "0.75046915", "0.74124587", "0.710968", "0.69313776", "0.690593", "0.6874101", "0.68481094", "0.6846512", "0.68349624", "0.6811641", "0.6704334", "0.6694291", "0.6579729", "0.6545785", "0.6534785", "0.6528049", "0.64793146", "0.6470024", "0.6464288", "0.64397806", "0.6422281"...
0.0
-1
GET /cotiz_apps GET /cotiz_apps.json
def index @cotiz_apps = CotizApp.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @apps = @client.apps\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @apps }\n end\n end", "def get_applist\n return get_response(\"applist\", :json)\n end", "def applications_list\n get \"applications\"\n end", "def all_a...
[ "0.7433588", "0.735426", "0.7301787", "0.7238365", "0.7066311", "0.7051246", "0.703583", "0.7032041", "0.70253354", "0.6893208", "0.6879529", "0.6878784", "0.6877305", "0.68656737", "0.6858064", "0.68385565", "0.6831084", "0.68285733", "0.680234", "0.67797434", "0.67709863", ...
0.74896973
0
GET /cotiz_apps/1 GET /cotiz_apps/1.json
def show @marca = Make.find_by(:code => @cotiz_app.vehicle_brand).make @modelo = Vehicle.find_by(:make => @cotiz_app.vehicle_brand, :code => @cotiz_app.vehicle_model).model @version = Version.find_by(:make => @cotiz_app.vehicle_brand, :model => @cotiz_app.vehicle_model, :code => @cotiz_app.vehicle_version).version @universitas = JSON.parse(InsuranceResponse.where(:cotiz_app_id => @cotiz_app.id, :insurance => "universitas").last.response) rescue [] @vivir = JSON.parse(InsuranceResponse.where(:cotiz_app_id => @cotiz_app.id, :insurance => "vivir").last.response) rescue [] @estar = JSON.parse(InsuranceResponse.where(:cotiz_app_id => @cotiz_app.id, :insurance => "estar").last.response) rescue [] @oriental = JSON.parse(InsuranceResponse.where(:cotiz_app_id => @cotiz_app.id, :insurance => "oriental").last.response) rescue [] @ibero = JSON.parse(InsuranceResponse.where(:cotiz_app_id => @cotiz_app.id, :insurance => "ibero").last.response) rescue [] respond_to do |format| format.html format.pdf do send_data ReportPdf.new(@cotiz_app).render, filename: "cotizacion_#{@cotiz_app.id}.pdf", type: "application/pdf", disposition: "inline" end format.xlsx { render xlsx: 'show', filename: "show.xlsx"} format.json { render json: @cotiz_app } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @apps = @client.apps\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @apps }\n end\n end", "def index\n @cotiz_apps = CotizApp.all\n end", "def get_applist\n return get_response(\"applist\", :json)\n end", "def index\n @app...
[ "0.744247", "0.7216464", "0.71038234", "0.7057781", "0.6983077", "0.68927085", "0.685019", "0.6814249", "0.67683613", "0.6746453", "0.66921234", "0.66817665", "0.667678", "0.6675503", "0.6663864", "0.6654479", "0.6650358", "0.6648888", "0.6582603", "0.653477", "0.6505357", ...
0.0
-1